@agent-native/dispatch 0.43.7 → 0.43.8-nightly-20261202183703
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/dist/actions/execute-action-suggestion.js +6 -3
- package/dist/actions/execute-action-suggestion.js.map +1 -1
- package/dist/components/workspace-app-host.d.ts.map +1 -1
- package/dist/components/workspace-app-host.js +17 -16
- package/dist/components/workspace-app-host.js.map +1 -1
- package/dist/lib/workspace-apps.d.ts +1 -1
- package/dist/lib/workspace-apps.d.ts.map +1 -1
- package/dist/lib/workspace-apps.js +16 -114
- package/dist/lib/workspace-apps.js.map +1 -1
- package/dist/lib/workspace-apps.test.js +7 -9
- package/dist/lib/workspace-apps.test.js.map +1 -1
- package/dist/server/lib/app-creation-store.d.ts.map +1 -1
- package/dist/server/lib/app-creation-store.js +38 -69
- package/dist/server/lib/app-creation-store.js.map +1 -1
- package/dist/server/lib/mcp-gateway.d.ts +1 -1
- package/dist/server/lib/mcp-gateway.d.ts.map +1 -1
- package/dist/server/lib/mcp-gateway.js +36 -93
- package/dist/server/lib/mcp-gateway.js.map +1 -1
- package/dist/shared/workspace-app-route.d.ts +0 -1
- package/dist/shared/workspace-app-route.d.ts.map +1 -1
- package/dist/shared/workspace-app-route.js +0 -3
- package/dist/shared/workspace-app-route.js.map +1 -1
- package/package.json +5 -5
- package/src/actions/action-suggestions.spec.ts +2 -1
- package/src/actions/execute-action-suggestion.ts +7 -5
- package/src/components/layout/workspace-apps-rail.spec.tsx +1 -1
- package/src/components/workspace-app-card.spec.tsx +4 -4
- package/src/components/workspace-app-host.spec.tsx +20 -16
- package/src/components/workspace-app-host.tsx +19 -16
- package/src/lib/workspace-apps.spec.ts +22 -30
- package/src/lib/workspace-apps.test.ts +8 -15
- package/src/lib/workspace-apps.ts +19 -128
- package/src/server/lib/app-creation-store.spec.ts +55 -7
- package/src/server/lib/app-creation-store.ts +42 -82
- package/src/server/lib/mcp-gateway.spec.ts +57 -113
- package/src/server/lib/mcp-gateway.ts +63 -94
- package/src/shared/workspace-app-route.spec.ts +5 -17
- package/src/shared/workspace-app-route.ts +0 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-app-route.d.ts","sourceRoot":"","sources":["../../src/shared/workspace-app-route.ts"],"names":[],"mappings":"AAAA,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEvD
|
|
1
|
+
{"version":3,"file":"workspace-app-route.d.ts","sourceRoot":"","sources":["../../src/shared/workspace-app-route.ts"],"names":[],"mappings":"AAAA,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEvD"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
export function workspaceAppRoute(appId) {
|
|
2
2
|
return `/apps/${encodeURIComponent(appId)}`;
|
|
3
3
|
}
|
|
4
|
-
export function workspaceAppCatalogRoute(appId) {
|
|
5
|
-
return appId === "dispatch" ? "/dispatch" : workspaceAppRoute(appId);
|
|
6
|
-
}
|
|
7
4
|
//# sourceMappingURL=workspace-app-route.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-app-route.js","sourceRoot":"","sources":["../../src/shared/workspace-app-route.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC7C,OAAO,SAAS,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC;AAC9C,CAAC
|
|
1
|
+
{"version":3,"file":"workspace-app-route.js","sourceRoot":"","sources":["../../src/shared/workspace-app-route.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC7C,OAAO,SAAS,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC;AAC9C,CAAC","sourcesContent":["export function workspaceAppRoute(appId: string): string {\n return `/apps/${encodeURIComponent(appId)}`;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-native/dispatch",
|
|
3
|
-
"version": "0.43.
|
|
3
|
+
"version": "0.43.8-nightly-20261202183703",
|
|
4
4
|
"description": "Dispatch — workspace control plane for agent-native apps. Vault, integrations, destinations, scheduled jobs, and cross-app delegation, shipped as a single drop-in package.",
|
|
5
5
|
"homepage": "https://github.com/BuilderIO/agent-native#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -90,8 +90,8 @@
|
|
|
90
90
|
"tailwind-merge": "^3.5.0",
|
|
91
91
|
"vaul": "^1.1.2",
|
|
92
92
|
"zod": "^4.3.6",
|
|
93
|
-
"@agent-native/
|
|
94
|
-
"@agent-native/
|
|
93
|
+
"@agent-native/agentkit": "0.237.2-nightly-20261202183703",
|
|
94
|
+
"@agent-native/toolkit": "0.237.2-nightly-20261202183703"
|
|
95
95
|
},
|
|
96
96
|
"devDependencies": {
|
|
97
97
|
"@react-router/dev": "^8.1.0",
|
|
@@ -105,10 +105,10 @@
|
|
|
105
105
|
"typescript-7": "npm:typescript@^7.0.2",
|
|
106
106
|
"vite": "8.3.8",
|
|
107
107
|
"vitest": "^5.1.2",
|
|
108
|
-
"@agent-native/core": "0.237.
|
|
108
|
+
"@agent-native/core": "0.237.2-nightly-20261202183703"
|
|
109
109
|
},
|
|
110
110
|
"peerDependencies": {
|
|
111
|
-
"@agent-native/core": "
|
|
111
|
+
"@agent-native/core": "0.237.2-nightly-20261202183703",
|
|
112
112
|
"react": ">=19.2.7",
|
|
113
113
|
"react-dom": ">=19.2.7",
|
|
114
114
|
"react-router": ">=8"
|
|
@@ -329,7 +329,8 @@ it("opens the pending Builder branch when the app is already being created", asy
|
|
|
329
329
|
mocks.listWorkspaceApps.mockResolvedValue([
|
|
330
330
|
{
|
|
331
331
|
id: "equipment",
|
|
332
|
-
url:
|
|
332
|
+
url: null,
|
|
333
|
+
builderUrl: "https://builder.example.test/branches/equipment",
|
|
333
334
|
status: "pending",
|
|
334
335
|
},
|
|
335
336
|
]);
|
|
@@ -143,14 +143,16 @@ export default defineAction({
|
|
|
143
143
|
prompt: result.prompt,
|
|
144
144
|
};
|
|
145
145
|
case "app-id-taken": {
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
).find(
|
|
146
|
+
const apps = await listWorkspaceApps({ includeAgentCards: false });
|
|
147
|
+
const app = apps.find(
|
|
149
148
|
(item) =>
|
|
150
149
|
item.id === result.appId && !item.archived && !item.isDispatch,
|
|
151
150
|
);
|
|
152
|
-
|
|
153
|
-
|
|
151
|
+
if (!app) return unavailable();
|
|
152
|
+
const url = safeAppUrl(
|
|
153
|
+
app.status === "pending" ? app.builderUrl : app.url,
|
|
154
|
+
);
|
|
155
|
+
if (!url) return unavailable();
|
|
154
156
|
if (result.conflict === "registered" && app.status === "ready") {
|
|
155
157
|
return {
|
|
156
158
|
suggestionId,
|
|
@@ -557,7 +557,7 @@ describe("WorkspaceAppCard", () => {
|
|
|
557
557
|
);
|
|
558
558
|
});
|
|
559
559
|
|
|
560
|
-
it("opens in a new tab at
|
|
560
|
+
it("opens a same-origin app in a new tab at its standalone URL", async () => {
|
|
561
561
|
const origin = window.location.origin;
|
|
562
562
|
await act(async () => {
|
|
563
563
|
root.render(
|
|
@@ -569,7 +569,7 @@ describe("WorkspaceAppCard", () => {
|
|
|
569
569
|
name: "Coach",
|
|
570
570
|
path: "/coach",
|
|
571
571
|
homePath: "/",
|
|
572
|
-
url: `${origin}/
|
|
572
|
+
url: `${origin}/coach`,
|
|
573
573
|
status: "ready",
|
|
574
574
|
}}
|
|
575
575
|
/>
|
|
@@ -591,7 +591,7 @@ describe("WorkspaceAppCard", () => {
|
|
|
591
591
|
).find((item) =>
|
|
592
592
|
item.textContent.includes("dispatch.pages.chatFirstOpenInNewTab"),
|
|
593
593
|
);
|
|
594
|
-
expect(newTabItem?.getAttribute("href")).toBe(
|
|
594
|
+
expect(newTabItem?.getAttribute("href")).toBe(`${origin}/coach`);
|
|
595
595
|
expect(newTabItem?.getAttribute("target")).toBe("_blank");
|
|
596
596
|
});
|
|
597
597
|
|
|
@@ -616,7 +616,7 @@ describe("WorkspaceAppCard", () => {
|
|
|
616
616
|
name: "Coach",
|
|
617
617
|
path: "/coach",
|
|
618
618
|
homePath: "/",
|
|
619
|
-
url: `${window.location.origin}/
|
|
619
|
+
url: `${window.location.origin}/coach`,
|
|
620
620
|
status: "ready",
|
|
621
621
|
}}
|
|
622
622
|
/>
|
|
@@ -423,7 +423,7 @@ describe("WorkspaceAppKeepAlive", () => {
|
|
|
423
423
|
// Labs 11/5: 0 of 16 action calls returned 200 and the app rendered
|
|
424
424
|
// "Couldn't load content"; the same app framed directly returned 16 of 16).
|
|
425
425
|
// A same-origin app shares the workspace cookie, so it now loads directly.
|
|
426
|
-
"loads %s directly at its own home path when
|
|
426
|
+
"loads %s directly at its own home path when it shares Dispatch's origin",
|
|
427
427
|
async (id, homePath, expectedPath) => {
|
|
428
428
|
await act(async () => {
|
|
429
429
|
root.render(
|
|
@@ -433,7 +433,7 @@ describe("WorkspaceAppKeepAlive", () => {
|
|
|
433
433
|
name: id,
|
|
434
434
|
path: `/${id}`,
|
|
435
435
|
homePath,
|
|
436
|
-
url: `${window.location.origin}
|
|
436
|
+
url: `${window.location.origin}/${id}`,
|
|
437
437
|
}}
|
|
438
438
|
/>,
|
|
439
439
|
);
|
|
@@ -446,7 +446,9 @@ describe("WorkspaceAppKeepAlive", () => {
|
|
|
446
446
|
document
|
|
447
447
|
.querySelector("[data-chat-first-app-embed-url]")
|
|
448
448
|
?.getAttribute("data-chat-first-app-embed-url"),
|
|
449
|
-
).toBe(
|
|
449
|
+
).toBe(
|
|
450
|
+
`${window.location.origin}/${id}${expectedPath}`.replace(/\/+$/, ""),
|
|
451
|
+
);
|
|
450
452
|
},
|
|
451
453
|
);
|
|
452
454
|
|
|
@@ -459,7 +461,7 @@ describe("WorkspaceAppKeepAlive", () => {
|
|
|
459
461
|
name: "Docs",
|
|
460
462
|
path: "/docs",
|
|
461
463
|
homePath: "/home",
|
|
462
|
-
url: `${window.location.origin}/
|
|
464
|
+
url: `${window.location.origin}/docs`,
|
|
463
465
|
}}
|
|
464
466
|
initialPath="/settings/integrations/notion"
|
|
465
467
|
/>,
|
|
@@ -473,10 +475,10 @@ describe("WorkspaceAppKeepAlive", () => {
|
|
|
473
475
|
document
|
|
474
476
|
.querySelector("[data-chat-first-app-embed-url]")
|
|
475
477
|
?.getAttribute("data-chat-first-app-embed-url"),
|
|
476
|
-
).toBe(
|
|
478
|
+
).toBe(`${window.location.origin}/docs/settings/integrations/notion`);
|
|
477
479
|
});
|
|
478
480
|
|
|
479
|
-
it("never falls back to
|
|
481
|
+
it("never falls back to an embed session for a same-origin app", async () => {
|
|
480
482
|
clientState.legacyMutateError = new Error("Embed failed");
|
|
481
483
|
clientState.legacyErrorMutateAsync.mockRejectedValue(
|
|
482
484
|
clientState.legacyMutateError,
|
|
@@ -491,7 +493,7 @@ describe("WorkspaceAppKeepAlive", () => {
|
|
|
491
493
|
name: "Onboarding",
|
|
492
494
|
path: "/onboarding",
|
|
493
495
|
homePath: "/accounts",
|
|
494
|
-
url: `${window.location.origin}/
|
|
496
|
+
url: `${window.location.origin}/onboarding`,
|
|
495
497
|
}}
|
|
496
498
|
/>,
|
|
497
499
|
);
|
|
@@ -503,7 +505,7 @@ describe("WorkspaceAppKeepAlive", () => {
|
|
|
503
505
|
container
|
|
504
506
|
.querySelector("[data-chat-first-app-embed-url]")
|
|
505
507
|
?.getAttribute("data-chat-first-app-embed-url"),
|
|
506
|
-
).toBe(
|
|
508
|
+
).toBe(`${window.location.origin}/onboarding/accounts`);
|
|
507
509
|
});
|
|
508
510
|
|
|
509
511
|
it("keeps a Dispatch page url on another origin as the app url", async () => {
|
|
@@ -1402,7 +1404,7 @@ describe("WorkspaceAppKeepAlive", () => {
|
|
|
1402
1404
|
name: "Docs",
|
|
1403
1405
|
path: "/docs",
|
|
1404
1406
|
homePath: "/home",
|
|
1405
|
-
url: `${window.location.origin}/
|
|
1407
|
+
url: `${window.location.origin}/docs`,
|
|
1406
1408
|
status: "ready",
|
|
1407
1409
|
},
|
|
1408
1410
|
];
|
|
@@ -1422,7 +1424,7 @@ describe("WorkspaceAppKeepAlive", () => {
|
|
|
1422
1424
|
container
|
|
1423
1425
|
.querySelector("[data-chat-first-app-embed-url]")
|
|
1424
1426
|
?.getAttribute("data-chat-first-app-embed-url"),
|
|
1425
|
-
).toBe(
|
|
1427
|
+
).toBe(`${window.location.origin}/docs/settings/integrations/notion`);
|
|
1426
1428
|
});
|
|
1427
1429
|
|
|
1428
1430
|
it("gives the kept-alive pane the deep route it is showing", async () => {
|
|
@@ -1432,7 +1434,7 @@ describe("WorkspaceAppKeepAlive", () => {
|
|
|
1432
1434
|
name: "Docs",
|
|
1433
1435
|
path: "/docs",
|
|
1434
1436
|
homePath: "/home",
|
|
1435
|
-
url: `${window.location.origin}/
|
|
1437
|
+
url: `${window.location.origin}/docs`,
|
|
1436
1438
|
status: "ready",
|
|
1437
1439
|
},
|
|
1438
1440
|
];
|
|
@@ -1451,7 +1453,7 @@ describe("WorkspaceAppKeepAlive", () => {
|
|
|
1451
1453
|
container
|
|
1452
1454
|
.querySelector("[data-chat-first-app-embed-url]")
|
|
1453
1455
|
?.getAttribute("data-chat-first-app-embed-url"),
|
|
1454
|
-
).toBe(
|
|
1456
|
+
).toBe(`${window.location.origin}/docs/settings/integrations/notion`);
|
|
1455
1457
|
});
|
|
1456
1458
|
|
|
1457
1459
|
it("keeps a neighbour's route when another app becomes active", async () => {
|
|
@@ -1461,7 +1463,7 @@ describe("WorkspaceAppKeepAlive", () => {
|
|
|
1461
1463
|
name: "Docs",
|
|
1462
1464
|
path: "/docs",
|
|
1463
1465
|
homePath: "/home",
|
|
1464
|
-
url: `${window.location.origin}/
|
|
1466
|
+
url: `${window.location.origin}/docs`,
|
|
1465
1467
|
status: "ready",
|
|
1466
1468
|
},
|
|
1467
1469
|
{
|
|
@@ -1469,7 +1471,7 @@ describe("WorkspaceAppKeepAlive", () => {
|
|
|
1469
1471
|
name: "Mail",
|
|
1470
1472
|
path: "/mail",
|
|
1471
1473
|
homePath: "/inbox",
|
|
1472
|
-
url: `${window.location.origin}/
|
|
1474
|
+
url: `${window.location.origin}/mail`,
|
|
1473
1475
|
status: "ready",
|
|
1474
1476
|
},
|
|
1475
1477
|
];
|
|
@@ -1501,7 +1503,9 @@ describe("WorkspaceAppKeepAlive", () => {
|
|
|
1501
1503
|
?.getAttribute("data-chat-first-app-embed-url"),
|
|
1502
1504
|
].join("="),
|
|
1503
1505
|
);
|
|
1504
|
-
expect(urls).toContain(
|
|
1505
|
-
|
|
1506
|
+
expect(urls).toContain(
|
|
1507
|
+
`docs=${window.location.origin}/docs/settings/integrations/notion`,
|
|
1508
|
+
);
|
|
1509
|
+
expect(urls).toContain(`mail=${window.location.origin}/mail/threads/42`);
|
|
1506
1510
|
});
|
|
1507
1511
|
});
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
type WorkspaceAppFrameView,
|
|
37
37
|
} from "../lib/workspace-app-frame-view";
|
|
38
38
|
import {
|
|
39
|
-
|
|
39
|
+
isSameOriginWorkspaceApp,
|
|
40
40
|
isWorkspaceSsoApp,
|
|
41
41
|
isDispatchWorkspaceAppId,
|
|
42
42
|
navigateToWorkspaceApp,
|
|
@@ -140,7 +140,7 @@ export function usePrefetchChatFirstEmbedSession(): (
|
|
|
140
140
|
return useCallback(
|
|
141
141
|
(app, embedPath) => {
|
|
142
142
|
if (typeof window === "undefined" || !embedPath.startsWith("/")) return;
|
|
143
|
-
if (
|
|
143
|
+
if (isSameOriginWorkspaceApp(app, window.location.origin)) return;
|
|
144
144
|
if (shouldOpenWorkspaceAppInTopWindow()) return;
|
|
145
145
|
if (workspaceSsoEnabled && isWorkspaceSsoApp(app)) return;
|
|
146
146
|
const input = buildChatFirstEmbedSessionInput(app.id, embedPath);
|
|
@@ -538,11 +538,11 @@ export function WorkspaceAppFrame({
|
|
|
538
538
|
skipActionQueryInvalidation: true,
|
|
539
539
|
timeoutMs: EMBED_SESSION_TIMEOUT_MS,
|
|
540
540
|
});
|
|
541
|
-
const
|
|
541
|
+
const isSameOriginMount = isSameOriginWorkspaceApp(
|
|
542
542
|
app,
|
|
543
543
|
typeof window === "undefined" ? undefined : window.location.origin,
|
|
544
544
|
);
|
|
545
|
-
const appUrl =
|
|
545
|
+
const appUrl = app.url ?? null;
|
|
546
546
|
const appHref = workspaceAppHref({
|
|
547
547
|
id: app.id,
|
|
548
548
|
name: app.name,
|
|
@@ -578,8 +578,8 @@ export function WorkspaceAppFrame({
|
|
|
578
578
|
// the token the app answered none of 16 action calls with 200 and rendered its
|
|
579
579
|
// failure copy; framed directly it answered all 16.
|
|
580
580
|
// Keep the embedded presentation without the credential.
|
|
581
|
-
const
|
|
582
|
-
if (!
|
|
581
|
+
const sameOriginDirectUrl = useMemo(() => {
|
|
582
|
+
if (!isSameOriginMount) return null;
|
|
583
583
|
const targetPath = framePath;
|
|
584
584
|
const href =
|
|
585
585
|
targetPath !== undefined
|
|
@@ -592,14 +592,14 @@ export function WorkspaceAppFrame({
|
|
|
592
592
|
// batching, and the plain app URL is what the existing direct fallback
|
|
593
593
|
// already loads when a mint fails.
|
|
594
594
|
return href || null;
|
|
595
|
-
}, [app.path, appHref, appUrl, framePath,
|
|
595
|
+
}, [app.path, appHref, appUrl, framePath, isSameOriginMount]);
|
|
596
596
|
|
|
597
597
|
const embedInput = useMemo<EmbedSessionInput | null>(() => {
|
|
598
598
|
if (framePath !== undefined) {
|
|
599
599
|
return buildChatFirstEmbedSessionInput(app.id, framePath);
|
|
600
600
|
}
|
|
601
601
|
if (!appHref) return null;
|
|
602
|
-
if (
|
|
602
|
+
if (isSameOriginMount) {
|
|
603
603
|
return buildChatFirstEmbedSessionInput(
|
|
604
604
|
app.id,
|
|
605
605
|
workspaceAppTargetPath({ homePath: app.homePath ?? null }),
|
|
@@ -610,7 +610,7 @@ export function WorkspaceAppFrame({
|
|
|
610
610
|
...(appUrl?.trim() ? { url: appHref } : { path: appHref }),
|
|
611
611
|
chrome: "minimal",
|
|
612
612
|
};
|
|
613
|
-
}, [app.homePath, app.id, appHref, appUrl, framePath,
|
|
613
|
+
}, [app.homePath, app.id, appHref, appUrl, framePath, isSameOriginMount]);
|
|
614
614
|
|
|
615
615
|
useEffect(() => {
|
|
616
616
|
if (openInTopWindow && useWorkspaceSso && embedInput) {
|
|
@@ -645,21 +645,24 @@ export function WorkspaceAppFrame({
|
|
|
645
645
|
setLoadedDocument(null);
|
|
646
646
|
observedPath.current = null;
|
|
647
647
|
childBrowserTabClaim.current = null;
|
|
648
|
-
if (
|
|
648
|
+
if (
|
|
649
|
+
sameOriginDirectUrl &&
|
|
650
|
+
(!openInTopWindow || topWindowNavigationFailed)
|
|
651
|
+
) {
|
|
649
652
|
if (claimBrowserTab) {
|
|
650
|
-
const url = new URL(
|
|
653
|
+
const url = new URL(sameOriginDirectUrl, window.location.href);
|
|
651
654
|
const id = crypto.randomUUID();
|
|
652
655
|
url.searchParams.set(DISPATCH_CHILD_BROWSER_TAB_PARAM, id);
|
|
653
656
|
childBrowserTabClaim.current = { startUrl: url.href, id };
|
|
654
657
|
setEmbedUrl(url.href);
|
|
655
658
|
} else {
|
|
656
|
-
setEmbedUrl(
|
|
659
|
+
setEmbedUrl(sameOriginDirectUrl);
|
|
657
660
|
}
|
|
658
661
|
setEmbedError(null);
|
|
659
662
|
setIsDirectFallback(false);
|
|
660
663
|
return;
|
|
661
664
|
}
|
|
662
|
-
if (
|
|
665
|
+
if (sameOriginDirectUrl) return;
|
|
663
666
|
const useTopWindowSso = openInTopWindow && useWorkspaceSso && !!embedInput;
|
|
664
667
|
if (
|
|
665
668
|
!embedInput ||
|
|
@@ -745,7 +748,7 @@ export function WorkspaceAppFrame({
|
|
|
745
748
|
createWorkspaceSsoEmbedSession.mutateAsync,
|
|
746
749
|
embedInput,
|
|
747
750
|
framePath,
|
|
748
|
-
|
|
751
|
+
sameOriginDirectUrl,
|
|
749
752
|
embedAttempt,
|
|
750
753
|
openInTopWindow,
|
|
751
754
|
navigateToTopWindow,
|
|
@@ -819,7 +822,7 @@ export function WorkspaceAppFrame({
|
|
|
819
822
|
return;
|
|
820
823
|
}
|
|
821
824
|
if (
|
|
822
|
-
|
|
825
|
+
sameOriginDirectUrl &&
|
|
823
826
|
navigateSameOriginWorkspaceApp(target, app.path, url)
|
|
824
827
|
) {
|
|
825
828
|
finishNavigation(requestedPath, true);
|
|
@@ -850,7 +853,7 @@ export function WorkspaceAppFrame({
|
|
|
850
853
|
appUrl,
|
|
851
854
|
completedNavigation,
|
|
852
855
|
embedUrl,
|
|
853
|
-
|
|
856
|
+
sameOriginDirectUrl,
|
|
854
857
|
loadedDocument,
|
|
855
858
|
requestedPathAccepted,
|
|
856
859
|
openInTopWindow,
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
isEmbeddedInExternalHost,
|
|
9
9
|
isInIframe,
|
|
10
10
|
isPathMountedWorkspaceApp,
|
|
11
|
-
|
|
11
|
+
isSameOriginWorkspaceApp,
|
|
12
12
|
isWorkspaceAppVisibleInDefaultLaunchers,
|
|
13
13
|
isWorkspaceSsoApp,
|
|
14
14
|
mergeChatFirstWorkspaceApps,
|
|
@@ -153,36 +153,26 @@ describe("workspace app routes", () => {
|
|
|
153
153
|
expect(workspaceAppIdFromRoute("/apps/mail/inbox")).toBe("mail");
|
|
154
154
|
});
|
|
155
155
|
|
|
156
|
-
it("
|
|
156
|
+
it("treats an app as same-origin only when its address is on Dispatch's origin", () => {
|
|
157
157
|
const origin = "https://beta.agent-workspace.builder.io";
|
|
158
|
-
const
|
|
158
|
+
const mounted = { url: `${origin}/coach` };
|
|
159
159
|
|
|
160
|
-
expect(
|
|
161
|
-
expect(
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
origin,
|
|
165
|
-
),
|
|
166
|
-
).toBe(true);
|
|
167
|
-
expect(
|
|
168
|
-
isWorkspaceAppHostPageUrl(hostPage, "https://beta.dispatch.example.test"),
|
|
169
|
-
).toBe(false);
|
|
170
|
-
expect(isWorkspaceAppHostPageUrl(hostPage, undefined)).toBe(false);
|
|
160
|
+
expect(isSameOriginWorkspaceApp(mounted, origin)).toBe(true);
|
|
161
|
+
expect(isSameOriginWorkspaceApp({ url: `${origin}/coach/` }, origin)).toBe(
|
|
162
|
+
true,
|
|
163
|
+
);
|
|
171
164
|
expect(
|
|
172
|
-
|
|
173
|
-
{ id: "coach", url: `${origin}/coach` },
|
|
174
|
-
origin,
|
|
175
|
-
),
|
|
165
|
+
isSameOriginWorkspaceApp(mounted, "https://beta.dispatch.example.test"),
|
|
176
166
|
).toBe(false);
|
|
167
|
+
expect(isSameOriginWorkspaceApp(mounted, undefined)).toBe(false);
|
|
177
168
|
expect(
|
|
178
|
-
|
|
179
|
-
{
|
|
169
|
+
isSameOriginWorkspaceApp(
|
|
170
|
+
{ url: "https://coach.agent-native.com" },
|
|
180
171
|
origin,
|
|
181
172
|
),
|
|
182
173
|
).toBe(false);
|
|
183
|
-
expect(
|
|
184
|
-
|
|
185
|
-
);
|
|
174
|
+
expect(isSameOriginWorkspaceApp({ url: "not a url" }, origin)).toBe(false);
|
|
175
|
+
expect(isSameOriginWorkspaceApp({ url: null }, origin)).toBe(false);
|
|
186
176
|
});
|
|
187
177
|
|
|
188
178
|
it("preserves the initial app suffix for a standalone deep link", () => {
|
|
@@ -517,19 +507,19 @@ describe("workspace app routes", () => {
|
|
|
517
507
|
expect(workspaceAppSourceFromConnected("workspace")).toBe("workspace");
|
|
518
508
|
});
|
|
519
509
|
|
|
520
|
-
it("
|
|
510
|
+
it("resolves standalone app hrefs from a same-origin app address", () => {
|
|
521
511
|
const origin = window.location.origin;
|
|
522
512
|
const hostApp = {
|
|
523
513
|
id: "coach",
|
|
524
514
|
name: "Coach",
|
|
525
515
|
path: "/coach",
|
|
526
516
|
homePath: "/",
|
|
527
|
-
url: `${origin}/
|
|
517
|
+
url: `${origin}/coach`,
|
|
528
518
|
};
|
|
529
|
-
expect(workspaceAppHref(hostApp)).toBe(
|
|
530
|
-
expect(workspaceAppDirectHref(hostApp, "/")).toBe(
|
|
519
|
+
expect(workspaceAppHref(hostApp)).toBe(`${origin}/coach`);
|
|
520
|
+
expect(workspaceAppDirectHref(hostApp, "/")).toBe(`${origin}/coach`);
|
|
531
521
|
expect(workspaceAppDirectHref(hostApp, "/sessions")).toBe(
|
|
532
|
-
|
|
522
|
+
`${origin}/coach/sessions`,
|
|
533
523
|
);
|
|
534
524
|
|
|
535
525
|
const onboardingApp = {
|
|
@@ -537,9 +527,11 @@ describe("workspace app routes", () => {
|
|
|
537
527
|
name: "Onboarding",
|
|
538
528
|
path: "/onboarding",
|
|
539
529
|
homePath: "/accounts",
|
|
540
|
-
url: `${origin}/
|
|
530
|
+
url: `${origin}/onboarding`,
|
|
541
531
|
};
|
|
542
|
-
expect(workspaceAppHref(onboardingApp)).toBe(
|
|
532
|
+
expect(workspaceAppHref(onboardingApp)).toBe(
|
|
533
|
+
`${origin}/onboarding/accounts`,
|
|
534
|
+
);
|
|
543
535
|
});
|
|
544
536
|
|
|
545
537
|
it("auto-detects iframes and embedded desktop/chat hosts", () => {
|
|
@@ -57,7 +57,8 @@ describe("workspaceAppDirectHref", () => {
|
|
|
57
57
|
).toBe("https://workspace.example.test/atlas/emails?status=failed#latest");
|
|
58
58
|
});
|
|
59
59
|
|
|
60
|
-
it("
|
|
60
|
+
it("drops search and hash stored on an address the target omits", () => {
|
|
61
|
+
// oracle-change: registry urls are bare app addresses now (ENG-14478).
|
|
61
62
|
expect(
|
|
62
63
|
workspaceAppDirectHref(
|
|
63
64
|
{
|
|
@@ -66,7 +67,7 @@ describe("workspaceAppDirectHref", () => {
|
|
|
66
67
|
},
|
|
67
68
|
"/home",
|
|
68
69
|
),
|
|
69
|
-
).toBe("https://workspace.example.test/atlas/home
|
|
70
|
+
).toBe("https://workspace.example.test/atlas/home");
|
|
70
71
|
});
|
|
71
72
|
|
|
72
73
|
it("does not duplicate a mount path already present in the target", () => {
|
|
@@ -82,18 +83,10 @@ describe("workspaceAppDirectHref", () => {
|
|
|
82
83
|
"/decks-2/docs/abc",
|
|
83
84
|
),
|
|
84
85
|
).toBe("https://workspace.example.test/decks-2/docs/abc");
|
|
86
|
+
// oracle-change: doubled registry addresses are no longer produced, so they are not collapsed.
|
|
85
87
|
expect(
|
|
86
|
-
workspaceAppDirectHref(
|
|
87
|
-
|
|
88
|
-
path: "/decks-2",
|
|
89
|
-
url: "https://workspace.example.test/decks-2/decks-2",
|
|
90
|
-
},
|
|
91
|
-
"/decks-2/decks-2/docs/abc",
|
|
92
|
-
),
|
|
93
|
-
).toBe("https://workspace.example.test/decks-2/docs/abc");
|
|
94
|
-
expect(
|
|
95
|
-
workspaceAppDirectHref({ path: "/decks-2" }, "/decks-2/decks-2?slide=1"),
|
|
96
|
-
).toBe("/decks-2?slide=1");
|
|
88
|
+
workspaceAppDirectHref({ path: "/decks-2" }, "/decks-2/docs?slide=1"),
|
|
89
|
+
).toBe("/decks-2/docs?slide=1");
|
|
97
90
|
});
|
|
98
91
|
|
|
99
92
|
it("resolves a mounted relative app path", () => {
|
|
@@ -102,13 +95,13 @@ describe("workspaceAppDirectHref", () => {
|
|
|
102
95
|
);
|
|
103
96
|
});
|
|
104
97
|
|
|
105
|
-
it("
|
|
98
|
+
it("refuses an app whose address is invalid instead of guessing from its path", () => {
|
|
106
99
|
expect(
|
|
107
100
|
workspaceAppDirectHref(
|
|
108
101
|
{ path: "/atlas", url: "javascript:alert(1)" },
|
|
109
102
|
"/",
|
|
110
103
|
),
|
|
111
|
-
).
|
|
104
|
+
).toBeNull();
|
|
112
105
|
});
|
|
113
106
|
|
|
114
107
|
it("rejects an unsafe target path", () => {
|