Skip to content

Commit a548903

Browse files
committed
Merge remote-tracking branch 'origin/staging' into improvement/enterprise-self-host
# Conflicts: # bun.lock
2 parents c55e5f1 + 805ac33 commit a548903

8 files changed

Lines changed: 333 additions & 142 deletions

File tree

apps/sim/connectors/sharepoint/sharepoint.test.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,39 @@ describe('resolveFolderTarget', () => {
264264
)
265265
})
266266

267+
it('blames the matched library, not the default one, when its remainder is wrong', async () => {
268+
mockGraph({
269+
...defaultDriveRoute,
270+
...sitesDrivesRoute,
271+
...rootChildren(DEFAULT_DRIVE_ID, [folder('d1', 'Archive')]),
272+
...rootChildren(POLICIES_DRIVE_ID, [folder('p1', 'Onboarding')]),
273+
})
274+
275+
const error = await resolve('Policies/HR').catch((e: Error) => e)
276+
277+
expect(error).toBeInstanceOf(Error)
278+
const message = (error as Error).message
279+
expect(message).toContain('document library "Policies"')
280+
expect(message).toContain('"HR"')
281+
expect(message).toContain('"Onboarding"')
282+
expect(message).not.toContain('document library "Documents"')
283+
expect(message).not.toContain('Shared Documents" should be omitted')
284+
})
285+
286+
it('still offers the prefix hint when the path names the default library itself', async () => {
287+
mockGraph({
288+
...defaultDriveRoute,
289+
...sitesDrivesRoute,
290+
...rootChildren(DEFAULT_DRIVE_ID, [folder('d1', 'Archive')]),
291+
})
292+
293+
const error = await resolve('Shared Documents/Reports').catch((e: Error) => e)
294+
295+
const message = (error as Error).message
296+
expect(message).toContain('document library "Documents"')
297+
expect(message).toContain('Shared Documents" should be omitted')
298+
})
299+
267300
it('surfaces a failure to open the default library rather than reporting not-found', async () => {
268301
mockGraph({
269302
[`${GRAPH}/sites/${SITE_ID}/drive?$select=id,name,webUrl`]: { status: 403 },

apps/sim/connectors/sharepoint/sharepoint.ts

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -527,14 +527,25 @@ export async function resolveFolderTarget(
527527
return { driveId: defaultDrive.id, driveName: defaultDriveName, folderId: walked.id }
528528
}
529529

530+
/**
531+
* When the first segment named a real library, that library is the one the
532+
* user meant — report against it and its remainder, not against the default
533+
* library and the full path, which would blame the wrong library and advise
534+
* stripping a prefix that was correct.
535+
*/
536+
const reportDrive = libraryMatch
537+
? { id: libraryMatch.id, name: libraryMatch.name || segments[0] }
538+
: { id: defaultDrive.id, name: defaultDriveName }
539+
530540
throw new Error(
531541
await buildFolderNotFoundMessage(
532542
accessToken,
533-
{ id: defaultDrive.id, name: defaultDriveName },
543+
reportDrive,
534544
siteName || siteUrl,
535545
trimmed,
536-
segments,
546+
libraryMatch ? segments.slice(1) : segments,
537547
drives,
548+
reportDrive.id === defaultDrive.id,
538549
retryOptions
539550
)
540551
)
@@ -572,6 +583,11 @@ function matchesDriveName(drive: Drive, segment: string): boolean {
572583
/**
573584
* Builds a diagnostic failure message naming the site, the library searched,
574585
* the path attempted, and the folders that actually exist at that level.
586+
*
587+
* `searchedDefaultLibrary` gates the advice about stripping a leading library
588+
* name: that hint only applies when the path was interpreted against the site's
589+
* default library, and would be actively misleading when the caller supplied a
590+
* library name that matched.
575591
*/
576592
async function buildFolderNotFoundMessage(
577593
accessToken: string,
@@ -580,6 +596,7 @@ async function buildFolderNotFoundMessage(
580596
rawFolderPath: string,
581597
segments: string[],
582598
drives: Drive[],
599+
searchedDefaultLibrary: boolean,
583600
retryOptions?: RetryOptions
584601
): Promise<string> {
585602
const parts = [
@@ -614,9 +631,11 @@ async function buildFolderNotFoundMessage(
614631
}
615632
}
616633

617-
parts.push(
618-
'The folder path is relative to the document library root, so a leading "Documents" or "Shared Documents" should be omitted unless a folder by that name really exists.'
619-
)
634+
if (searchedDefaultLibrary) {
635+
parts.push(
636+
'The folder path is relative to the document library root, so a leading "Documents" or "Shared Documents" should be omitted unless a folder by that name really exists.'
637+
)
638+
}
620639

621640
return parts.join(' ')
622641
}

apps/sim/lib/execution/remote-sandbox/conformance.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const {
6262
}))
6363

6464
vi.mock('@e2b/code-interpreter', () => ({ Sandbox: { create: mockE2BCreate } }))
65-
vi.mock('@daytonaio/sdk', () => ({
65+
vi.mock('@daytona/sdk', () => ({
6666
Daytona: class {
6767
create = mockDaytonaCreate
6868
},

apps/sim/lib/execution/remote-sandbox/daytona.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ export const daytonaProvider: SandboxProvider = {
253253
const language = options?.language ?? CodeLanguage.Python
254254
logger.info('Creating Daytona sandbox', { kind, snapshot })
255255

256-
const { Daytona } = await import('@daytonaio/sdk')
256+
const { Daytona } = await import('@daytona/sdk')
257257
const daytona = new Daytona({ apiKey })
258258
const sandbox = await daytona.create({ snapshot, language: toDaytonaLanguage(language) } as any)
259259

apps/sim/next.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ const nextConfig: NextConfig = {
129129
'isolated-vm',
130130
'@e2b/code-interpreter',
131131
'e2b',
132-
'@daytonaio/sdk',
132+
'@daytona/sdk',
133133
'@earendil-works/pi-ai',
134134
'@earendil-works/pi-coding-agent',
135135
],

apps/sim/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"@browserbasehq/stagehand": "^3.2.1",
6868
"@calcom/embed-react": "1.5.3",
6969
"@cerebras/cerebras_cloud_sdk": "^1.23.0",
70-
"@daytonaio/sdk": "0.197.0",
70+
"@daytona/sdk": "0.200.0",
7171
"@e2b/code-interpreter": "^2.7.0",
7272
"@earendil-works/pi-ai": "0.80.10",
7373
"@earendil-works/pi-coding-agent": "0.80.10",
@@ -103,8 +103,8 @@
103103
"@radix-ui/react-slot": "1.2.2",
104104
"@radix-ui/react-switch": "^1.1.2",
105105
"@radix-ui/react-tabs": "^1.1.2",
106-
"@react-email/components": "0.5.7",
107-
"@react-email/render": "2.0.8",
106+
"@react-email/components": "1.0.12",
107+
"@react-email/render": "2.1.0",
108108
"@sim/audit": "workspace:*",
109109
"@sim/emcn": "workspace:*",
110110
"@sim/logger": "workspace:*",
@@ -253,7 +253,7 @@
253253
"autoprefixer": "10.4.21",
254254
"jsdom": "^26.0.0",
255255
"postcss": "^8",
256-
"react-email": "4.3.2",
256+
"react-email": "6.9.0",
257257
"tailwindcss": "^3.4.1",
258258
"typescript": "^7.0.2",
259259
"vite-tsconfig-paths": "^5.1.4",

apps/sim/scripts/build-pi-daytona-snapshot.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
* DAYTONA_PI_SNAPSHOT_ID=<name:tag>
2424
*/
2525

26-
import { Daytona, Image } from '@daytonaio/sdk'
26+
import { Daytona, Image } from '@daytona/sdk'
2727
import { getErrorMessage } from '@sim/utils/errors'
2828
import {
2929
PI_APT,

0 commit comments

Comments
 (0)