@agent-native/dispatch 0.43.0-nightly-20261120212328 → 0.43.7
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 +194 -174
- package/dist/actions/ask_app.d.ts +3 -0
- package/dist/actions/ask_app.js +7 -2
- package/dist/actions/ask_app.js.map +1 -1
- package/dist/actions/ask_app_status.d.ts +3 -0
- package/dist/actions/ask_app_status.js +5 -1
- package/dist/actions/ask_app_status.js.map +1 -1
- package/dist/actions/call_app_action.d.ts +1 -0
- package/dist/actions/call_app_action.js +21 -5
- package/dist/actions/call_app_action.js.map +1 -1
- package/dist/actions/create_embed_session.d.ts +3 -2
- package/dist/actions/create_embed_session.js +4 -2
- package/dist/actions/create_embed_session.js.map +1 -1
- package/dist/actions/create_workspace_app_embed_session.d.ts +3 -2
- package/dist/actions/create_workspace_app_embed_session.js +3 -1
- package/dist/actions/create_workspace_app_embed_session.js.map +1 -1
- package/dist/actions/delete-destination.d.ts +12 -12
- package/dist/actions/execute-action-suggestion.d.ts +44 -0
- package/dist/actions/execute-action-suggestion.d.ts.map +1 -0
- package/dist/actions/execute-action-suggestion.js +148 -0
- package/dist/actions/execute-action-suggestion.js.map +1 -0
- package/dist/actions/import-agent.d.ts +13 -13
- package/dist/actions/index.d.ts.map +1 -1
- package/dist/actions/index.js +5 -1
- package/dist/actions/index.js.map +1 -1
- package/dist/actions/list-connected-agents.js +3 -2
- package/dist/actions/list-connected-agents.js.map +1 -1
- package/dist/actions/list-workspace-connections.d.ts +1 -0
- package/dist/actions/list-workspace-connections.d.ts.map +1 -1
- package/dist/actions/list_app_actions.js +1 -1
- package/dist/actions/list_app_actions.js.map +1 -1
- package/dist/actions/list_apps.d.ts +2 -0
- package/dist/actions/list_apps.js +11 -3
- package/dist/actions/list_apps.js.map +1 -1
- package/dist/actions/navigate.js +1 -0
- package/dist/actions/navigate.js.map +1 -1
- package/dist/actions/open_app.d.ts +4 -0
- package/dist/actions/open_app.js +14 -6
- package/dist/actions/open_app.js.map +1 -1
- package/dist/actions/propose-action-suggestions.d.ts +45 -0
- package/dist/actions/propose-action-suggestions.d.ts.map +1 -0
- package/dist/actions/propose-action-suggestions.js +32 -0
- package/dist/actions/propose-action-suggestions.js.map +1 -0
- package/dist/actions/provider-api-register.d.ts +12 -12
- package/dist/actions/read_view.js +1 -1
- package/dist/actions/read_view.js.map +1 -1
- package/dist/actions/remember-pointer.js +1 -1
- package/dist/actions/remember-pointer.js.map +1 -1
- package/dist/actions/resolve-pointer.js +1 -1
- package/dist/actions/resolve-pointer.js.map +1 -1
- package/dist/actions/route-app-intent.d.ts +6 -0
- package/dist/actions/route-app-intent.js +79 -5
- package/dist/actions/route-app-intent.js.map +1 -1
- package/dist/actions/send-code-agent-remote-command.js +4 -0
- package/dist/actions/send-code-agent-remote-command.js.map +1 -1
- package/dist/actions/start-workspace-app-creation.js +1 -1
- package/dist/actions/start-workspace-app-creation.js.map +1 -1
- package/dist/actions/upsert-destination.d.ts +12 -12
- package/dist/actions/view-screen.d.ts +12 -1
- package/dist/actions/view-screen.js +53 -5
- package/dist/actions/view-screen.js.map +1 -1
- package/dist/components/chat-action-suggestions.d.ts +8 -0
- package/dist/components/chat-action-suggestions.d.ts.map +1 -0
- package/dist/components/chat-action-suggestions.js +191 -0
- package/dist/components/chat-action-suggestions.js.map +1 -0
- package/dist/components/chat-home-apps.d.ts.map +1 -1
- package/dist/components/chat-home-apps.js +1 -1
- package/dist/components/chat-home-apps.js.map +1 -1
- package/dist/components/google-broker-settings-group.d.ts +2 -0
- package/dist/components/google-broker-settings-group.d.ts.map +1 -0
- package/dist/components/google-broker-settings-group.js +53 -0
- package/dist/components/google-broker-settings-group.js.map +1 -0
- package/dist/components/layout/Layout.d.ts +4 -1
- package/dist/components/layout/Layout.d.ts.map +1 -1
- package/dist/components/layout/Layout.js +246 -69
- package/dist/components/layout/Layout.js.map +1 -1
- package/dist/components/messaging-setup-panel.d.ts.map +1 -1
- package/dist/components/messaging-setup-panel.js +47 -15
- package/dist/components/messaging-setup-panel.js.map +1 -1
- package/dist/components/workspace-app-host.d.ts +27 -4
- package/dist/components/workspace-app-host.d.ts.map +1 -1
- package/dist/components/workspace-app-host.js +355 -74
- package/dist/components/workspace-app-host.js.map +1 -1
- package/dist/config.d.ts +5 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js.map +1 -1
- package/dist/db/google-broker-admission.d.ts +36 -0
- package/dist/db/google-broker-admission.d.ts.map +1 -0
- package/dist/db/google-broker-admission.js +129 -0
- package/dist/db/google-broker-admission.js.map +1 -0
- package/dist/db/migrations.d.ts +1 -1
- package/dist/db/migrations.d.ts.map +1 -1
- package/dist/db/migrations.js +42 -0
- package/dist/db/migrations.js.map +1 -1
- package/dist/lib/action-suggestions.d.ts +20 -0
- package/dist/lib/action-suggestions.d.ts.map +1 -0
- package/dist/lib/action-suggestions.js +219 -0
- package/dist/lib/action-suggestions.js.map +1 -0
- package/dist/lib/chat-first-app-route.d.ts +11 -5
- package/dist/lib/chat-first-app-route.d.ts.map +1 -1
- package/dist/lib/chat-first-app-route.js +9 -5
- package/dist/lib/chat-first-app-route.js.map +1 -1
- package/dist/lib/chat-first-pane.d.ts +25 -1
- package/dist/lib/chat-first-pane.d.ts.map +1 -1
- package/dist/lib/chat-first-pane.js +67 -1
- package/dist/lib/chat-first-pane.js.map +1 -1
- package/dist/lib/data-intent.d.ts +3 -0
- package/dist/lib/data-intent.d.ts.map +1 -0
- package/dist/lib/data-intent.js +14 -0
- package/dist/lib/data-intent.js.map +1 -0
- package/dist/lib/dispatch-app-identity.d.ts +10 -0
- package/dist/lib/dispatch-app-identity.d.ts.map +1 -0
- package/dist/lib/dispatch-app-identity.js +18 -0
- package/dist/lib/dispatch-app-identity.js.map +1 -0
- package/dist/lib/other-apps.d.ts +15 -0
- package/dist/lib/other-apps.d.ts.map +1 -1
- package/dist/lib/other-apps.js +31 -0
- package/dist/lib/other-apps.js.map +1 -1
- package/dist/lib/workspace-app-frame-view.d.ts +15 -0
- package/dist/lib/workspace-app-frame-view.d.ts.map +1 -0
- package/dist/lib/workspace-app-frame-view.js +72 -0
- package/dist/lib/workspace-app-frame-view.js.map +1 -0
- package/dist/lib/workspace-apps.d.ts +5 -0
- package/dist/lib/workspace-apps.d.ts.map +1 -1
- package/dist/lib/workspace-apps.js +85 -23
- package/dist/lib/workspace-apps.js.map +1 -1
- package/dist/lib/workspace-apps.test.js +6 -0
- package/dist/lib/workspace-apps.test.js.map +1 -1
- package/dist/routes/pages/_index.d.ts +2 -2
- package/dist/routes/pages/chat.d.ts.map +1 -1
- package/dist/routes/pages/chat.js +33 -2
- package/dist/routes/pages/chat.js.map +1 -1
- package/dist/routes/pages/settings-page.d.ts +1 -1
- package/dist/routes/pages/settings-page.d.ts.map +1 -1
- package/dist/routes/pages/settings-page.js +3 -2
- package/dist/routes/pages/settings-page.js.map +1 -1
- package/dist/server/index.d.ts +4 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +5 -5
- package/dist/server/index.js.map +1 -1
- package/dist/server/lib/action-suggestions.d.ts +41 -0
- package/dist/server/lib/action-suggestions.d.ts.map +1 -0
- package/dist/server/lib/action-suggestions.js +94 -0
- package/dist/server/lib/action-suggestions.js.map +1 -0
- package/dist/server/lib/app-action-result.d.ts +5 -0
- package/dist/server/lib/app-action-result.d.ts.map +1 -1
- package/dist/server/lib/app-action-result.js +7 -0
- package/dist/server/lib/app-action-result.js.map +1 -1
- package/dist/server/lib/app-creation-store.d.ts.map +1 -1
- package/dist/server/lib/app-creation-store.js +63 -13
- package/dist/server/lib/app-creation-store.js.map +1 -1
- package/dist/server/lib/curated-workspace-templates.d.ts.map +1 -1
- package/dist/server/lib/curated-workspace-templates.js +3 -0
- package/dist/server/lib/curated-workspace-templates.js.map +1 -1
- package/dist/server/lib/dispatch-config.d.ts +5 -0
- package/dist/server/lib/dispatch-config.d.ts.map +1 -0
- package/dist/server/lib/dispatch-config.js +11 -0
- package/dist/server/lib/dispatch-config.js.map +1 -0
- package/dist/server/lib/dispatch-pane-context.d.ts +11 -0
- package/dist/server/lib/dispatch-pane-context.d.ts.map +1 -0
- package/dist/server/lib/dispatch-pane-context.js +35 -0
- package/dist/server/lib/dispatch-pane-context.js.map +1 -0
- package/dist/server/lib/google-broker-provider.d.ts +41 -0
- package/dist/server/lib/google-broker-provider.d.ts.map +1 -0
- package/dist/server/lib/google-broker-provider.js +96 -0
- package/dist/server/lib/google-broker-provider.js.map +1 -0
- package/dist/server/lib/google-broker-rpc.d.ts +26 -0
- package/dist/server/lib/google-broker-rpc.d.ts.map +1 -0
- package/dist/server/lib/google-broker-rpc.js +52 -0
- package/dist/server/lib/google-broker-rpc.js.map +1 -0
- package/dist/server/lib/hosted-apps-settings.d.ts.map +1 -1
- package/dist/server/lib/hosted-apps-settings.js +4 -0
- package/dist/server/lib/hosted-apps-settings.js.map +1 -1
- package/dist/server/lib/mcp-app-discovery.d.ts +17 -0
- package/dist/server/lib/mcp-app-discovery.d.ts.map +1 -0
- package/dist/server/lib/mcp-app-discovery.js +231 -0
- package/dist/server/lib/mcp-app-discovery.js.map +1 -0
- package/dist/server/lib/mcp-gateway.d.ts +64 -21
- package/dist/server/lib/mcp-gateway.d.ts.map +1 -1
- package/dist/server/lib/mcp-gateway.js +730 -88
- package/dist/server/lib/mcp-gateway.js.map +1 -1
- package/dist/server/plugins/agent-chat.js +9 -7
- package/dist/server/plugins/agent-chat.js.map +1 -1
- package/dist/server/plugins/auth.d.ts.map +1 -1
- package/dist/server/plugins/auth.js +1 -0
- package/dist/server/plugins/auth.js.map +1 -1
- package/dist/server/plugins/db.d.ts.map +1 -1
- package/dist/server/plugins/db.js +0 -46
- package/dist/server/plugins/db.js.map +1 -1
- package/dist/server/plugins/integrations.d.ts.map +1 -1
- package/dist/server/plugins/integrations.js +4 -1
- package/dist/server/plugins/integrations.js.map +1 -1
- package/dist/shared/chat-first-pane.d.ts +24 -0
- package/dist/shared/chat-first-pane.d.ts.map +1 -1
- package/dist/shared/chat-first-pane.js +34 -0
- package/dist/shared/chat-first-pane.js.map +1 -1
- package/dist/shared/labs.d.ts +1 -0
- package/dist/shared/labs.d.ts.map +1 -1
- package/dist/shared/labs.js +7 -0
- package/dist/shared/labs.js.map +1 -1
- package/package.json +7 -6
- package/src/actions/action-suggestions.spec.ts +342 -0
- package/src/actions/app_actions.spec.ts +103 -0
- package/src/actions/ask_app.ts +9 -2
- package/src/actions/ask_app_status.ts +12 -1
- package/src/actions/call_app_action.ts +28 -8
- package/src/actions/create_embed_session.ts +8 -2
- package/src/actions/create_workspace_app_embed_session.ts +6 -1
- package/src/actions/execute-action-suggestion.ts +177 -0
- package/src/actions/index.spec.ts +6 -3
- package/src/actions/index.ts +5 -1
- package/src/actions/list-connected-agents.spec.ts +26 -1
- package/src/actions/list-connected-agents.ts +7 -4
- package/src/actions/list_app_actions.ts +1 -1
- package/src/actions/list_apps.spec.ts +58 -22
- package/src/actions/list_apps.ts +12 -5
- package/src/actions/navigate.ts +1 -0
- package/src/actions/open_app.spec.ts +17 -1
- package/src/actions/open_app.ts +21 -8
- package/src/actions/propose-action-suggestions.ts +42 -0
- package/src/actions/read_view.ts +1 -1
- package/src/actions/remember-pointer.ts +1 -1
- package/src/actions/resolve-pointer.ts +1 -1
- package/src/actions/route-app-intent.spec.ts +234 -5
- package/src/actions/route-app-intent.ts +89 -4
- package/src/actions/send-code-agent-remote-command.spec.ts +40 -0
- package/src/actions/send-code-agent-remote-command.ts +5 -0
- package/src/actions/start-workspace-app-creation.ts +1 -1
- package/src/actions/view-screen.bundle.spec.ts +15 -2
- package/src/actions/view-screen.spec.ts +81 -3
- package/src/actions/view-screen.ts +60 -4
- package/src/components/chat-action-suggestions.spec.tsx +362 -0
- package/src/components/chat-action-suggestions.tsx +432 -0
- package/src/components/chat-home-apps.spec.tsx +19 -0
- package/src/components/chat-home-apps.tsx +0 -1
- package/src/components/google-broker-settings-group.tsx +186 -0
- package/src/components/layout/Layout.spec.tsx +419 -28
- package/src/components/layout/Layout.tsx +304 -66
- package/src/components/messaging-setup-panel.spec.tsx +278 -4
- package/src/components/messaging-setup-panel.tsx +82 -19
- package/src/components/workspace-app-card.spec.tsx +79 -10
- package/src/components/workspace-app-chat-rail.spec.tsx +81 -3
- package/src/components/workspace-app-host.spec.tsx +269 -16
- package/src/components/workspace-app-host.tsx +464 -87
- package/src/config.ts +5 -0
- package/src/db/google-broker-admission.ts +160 -0
- package/src/db/migrations.spec.ts +165 -2
- package/src/db/migrations.ts +43 -1
- package/src/lib/action-suggestions.ts +267 -0
- package/src/lib/chat-first-app-route.spec.ts +15 -2
- package/src/lib/chat-first-app-route.ts +19 -7
- package/src/lib/chat-first-pane.spec.ts +71 -0
- package/src/lib/chat-first-pane.ts +101 -4
- package/src/lib/data-intent.spec.ts +21 -0
- package/src/lib/data-intent.ts +13 -0
- package/src/lib/dispatch-app-identity.ts +40 -0
- package/src/lib/other-apps.spec.ts +110 -1
- package/src/lib/other-apps.ts +41 -0
- package/src/lib/workspace-app-frame-view.spec.ts +13 -0
- package/src/lib/workspace-app-frame-view.ts +98 -0
- package/src/lib/workspace-apps.spec.ts +101 -0
- package/src/lib/workspace-apps.test.ts +18 -0
- package/src/lib/workspace-apps.ts +102 -24
- package/src/routes/pages/chat.spec.tsx +92 -1
- package/src/routes/pages/chat.tsx +41 -2
- package/src/routes/pages/settings-page.tsx +22 -17
- package/src/routes/pages/settings.spec.tsx +4 -0
- package/src/server/index.ts +6 -6
- package/src/server/lib/action-suggestions.ts +122 -0
- package/src/server/lib/app-action-result.ts +8 -0
- package/src/server/lib/app-creation-store.spec.ts +251 -0
- package/src/server/lib/app-creation-store.ts +72 -12
- package/src/server/lib/community-apps.spec.ts +19 -1
- package/src/server/lib/curated-workspace-templates.spec.ts +12 -0
- package/src/server/lib/curated-workspace-templates.ts +2 -0
- package/src/server/lib/dispatch-config.ts +15 -0
- package/src/server/lib/dispatch-pane-context.spec.ts +54 -0
- package/src/server/lib/dispatch-pane-context.ts +54 -0
- package/src/server/lib/google-broker-provider.ts +121 -0
- package/src/server/lib/google-broker-rpc.spec.ts +95 -0
- package/src/server/lib/google-broker-rpc.ts +107 -0
- package/src/server/lib/hosted-apps-settings.ts +4 -0
- package/src/server/lib/mcp-app-discovery.ts +318 -0
- package/src/server/lib/mcp-gateway.spec.ts +2252 -524
- package/src/server/lib/mcp-gateway.ts +1044 -181
- package/src/server/plugins/agent-chat.direct-mcp.spec.ts +84 -5
- package/src/server/plugins/agent-chat.ts +9 -7
- package/src/server/plugins/auth.spec.ts +5 -1
- package/src/server/plugins/auth.ts +1 -0
- package/src/server/plugins/db.ts +0 -51
- package/src/server/plugins/integrations.ts +4 -1
- package/src/shared/chat-first-pane.spec.ts +36 -0
- package/src/shared/chat-first-pane.ts +55 -0
- package/src/shared/labs.ts +8 -0
- package/src/server/plugins/agent-chat.spec.ts +0 -206
- package/src/server/plugins/integrations.spec.ts +0 -60
|
@@ -61,7 +61,7 @@ const clientState = vi.hoisted(() => ({
|
|
|
61
61
|
_name: string,
|
|
62
62
|
_params?: unknown,
|
|
63
63
|
_options?: unknown,
|
|
64
|
-
): Promise<unknown> => ({ status: "ok", app: "none" }),
|
|
64
|
+
): Promise<unknown> => ({ status: "ok", app: "none", confidence: 1 }),
|
|
65
65
|
),
|
|
66
66
|
}));
|
|
67
67
|
const workspaceAppNavigation = vi.hoisted(() => ({
|
|
@@ -548,6 +548,77 @@ describe("Dispatch NavContent", () => {
|
|
|
548
548
|
}
|
|
549
549
|
});
|
|
550
550
|
|
|
551
|
+
it("takes the sidebar toggle from the active kept-alive app, not an earlier retained one", async () => {
|
|
552
|
+
const install = (app: string) => ({
|
|
553
|
+
id: app,
|
|
554
|
+
name: app,
|
|
555
|
+
path: `/${app}`,
|
|
556
|
+
url: `https://${app}.example.test/${app}`,
|
|
557
|
+
status: "ready",
|
|
558
|
+
});
|
|
559
|
+
clientState.workspaceApps = [install("mail"), install("calendar")];
|
|
560
|
+
for (const app of ["calendar", "mail"]) {
|
|
561
|
+
clientState.createEmbedSessionMutateAsync.mockResolvedValueOnce({
|
|
562
|
+
startUrl: `https://${app}.example.test/${app}/initial`,
|
|
563
|
+
childBrowserTabId:
|
|
564
|
+
app === "mail"
|
|
565
|
+
? "d178e672-918b-4c93-bd78-f627f7f00001"
|
|
566
|
+
: "d178e672-918b-4c93-bd78-f627f7f00002",
|
|
567
|
+
});
|
|
568
|
+
}
|
|
569
|
+
const toggles = vi.fn();
|
|
570
|
+
window.addEventListener("agent-panel:toggle", toggles);
|
|
571
|
+
try {
|
|
572
|
+
await act(async () => {
|
|
573
|
+
root.render(
|
|
574
|
+
<MemoryRouter initialEntries={["/apps/calendar"]}>
|
|
575
|
+
<Layout>
|
|
576
|
+
<div />
|
|
577
|
+
</Layout>
|
|
578
|
+
</MemoryRouter>,
|
|
579
|
+
);
|
|
580
|
+
});
|
|
581
|
+
await act(async () => {
|
|
582
|
+
container
|
|
583
|
+
.querySelector<HTMLButtonElement>(
|
|
584
|
+
'button[data-chat-first-app][data-app-id="mail"]',
|
|
585
|
+
)
|
|
586
|
+
?.click();
|
|
587
|
+
});
|
|
588
|
+
|
|
589
|
+
const frameOf = (app: string) => {
|
|
590
|
+
const frame = container.querySelector<HTMLIFrameElement>(
|
|
591
|
+
`[data-dispatch-workspace-app-cache-entry="${app}"] iframe`,
|
|
592
|
+
);
|
|
593
|
+
if (!frame?.contentWindow) throw new Error(`Missing ${app} iframe`);
|
|
594
|
+
return frame;
|
|
595
|
+
};
|
|
596
|
+
const retained = frameOf("calendar");
|
|
597
|
+
const active = frameOf("mail");
|
|
598
|
+
expect(
|
|
599
|
+
retained
|
|
600
|
+
.closest("[data-dispatch-workspace-app-cache-entry]")
|
|
601
|
+
?.getAttribute("aria-hidden"),
|
|
602
|
+
).toBe("true");
|
|
603
|
+
const post = async (frame: HTMLIFrameElement) =>
|
|
604
|
+
act(async () => {
|
|
605
|
+
window.dispatchEvent(
|
|
606
|
+
new MessageEvent("message", {
|
|
607
|
+
data: { type: "agentNative.toggleSidebar", data: {} },
|
|
608
|
+
source: frame.contentWindow,
|
|
609
|
+
}),
|
|
610
|
+
);
|
|
611
|
+
});
|
|
612
|
+
|
|
613
|
+
await post(retained);
|
|
614
|
+
expect(toggles).not.toHaveBeenCalled();
|
|
615
|
+
await post(active);
|
|
616
|
+
expect(toggles).toHaveBeenCalledTimes(1);
|
|
617
|
+
} finally {
|
|
618
|
+
window.removeEventListener("agent-panel:toggle", toggles);
|
|
619
|
+
}
|
|
620
|
+
});
|
|
621
|
+
|
|
551
622
|
it("opens mounted apps when optional connected-app discovery fails", async () => {
|
|
552
623
|
clientState.workspaceApps = [
|
|
553
624
|
{
|
|
@@ -642,6 +713,42 @@ describe("Dispatch NavContent", () => {
|
|
|
642
713
|
expect(wrapper?.className).not.toContain("hidden");
|
|
643
714
|
});
|
|
644
715
|
|
|
716
|
+
it("opens the exact Fleet installation despite an earlier template with the same name", async () => {
|
|
717
|
+
clientState.workspaceApps = [
|
|
718
|
+
{
|
|
719
|
+
id: "fleet-2",
|
|
720
|
+
name: "Fleet",
|
|
721
|
+
path: "/fleet-2",
|
|
722
|
+
url: "/fleet-2",
|
|
723
|
+
source: "builtin",
|
|
724
|
+
status: "ready",
|
|
725
|
+
},
|
|
726
|
+
{
|
|
727
|
+
id: "fleet",
|
|
728
|
+
name: "Fleet",
|
|
729
|
+
path: "/fleet",
|
|
730
|
+
url: "/fleet",
|
|
731
|
+
source: "workspace",
|
|
732
|
+
status: "ready",
|
|
733
|
+
},
|
|
734
|
+
];
|
|
735
|
+
await act(async () => {
|
|
736
|
+
root.render(
|
|
737
|
+
<MemoryRouter initialEntries={["/chat/fleet-installation"]}>
|
|
738
|
+
<Layout extensions={{ chatFirst: true }}>
|
|
739
|
+
<div />
|
|
740
|
+
</Layout>
|
|
741
|
+
</MemoryRouter>,
|
|
742
|
+
);
|
|
743
|
+
});
|
|
744
|
+
await act(async () => {
|
|
745
|
+
emitChatFirstOpenApp({ app: "fleet" });
|
|
746
|
+
});
|
|
747
|
+
expect(
|
|
748
|
+
getChatFirstSurfaceTabsStore("fleet-installation").getSnapshot().tabs,
|
|
749
|
+
).toMatchObject([{ appId: "fleet" }]);
|
|
750
|
+
});
|
|
751
|
+
|
|
645
752
|
it("opens the app Dispatch delegates to, once", async () => {
|
|
646
753
|
clientState.workspaceApps = [
|
|
647
754
|
{
|
|
@@ -768,8 +875,12 @@ describe("Dispatch NavContent", () => {
|
|
|
768
875
|
});
|
|
769
876
|
}
|
|
770
877
|
|
|
771
|
-
async function renderChat(
|
|
772
|
-
|
|
878
|
+
async function renderChat(
|
|
879
|
+
path: string,
|
|
880
|
+
children: React.ReactNode = null,
|
|
881
|
+
registrations = apps,
|
|
882
|
+
) {
|
|
883
|
+
clientState.workspaceApps = registrations;
|
|
773
884
|
clientState.callAction.mockClear();
|
|
774
885
|
await act(async () => {
|
|
775
886
|
root.render(
|
|
@@ -782,7 +893,12 @@ describe("Dispatch NavContent", () => {
|
|
|
782
893
|
|
|
783
894
|
it("asks the route with the shown app and previous turn, and opens its answer", async () => {
|
|
784
895
|
await renderChat("/chat/route-opens");
|
|
785
|
-
const route = routeTo({
|
|
896
|
+
const route = routeTo({
|
|
897
|
+
status: "ok",
|
|
898
|
+
app: "mail",
|
|
899
|
+
confidence: 1,
|
|
900
|
+
explicit: true,
|
|
901
|
+
});
|
|
786
902
|
await send("show my inbox", "User: hi\nAssistant: hello");
|
|
787
903
|
expect(clientState.callAction).toHaveBeenCalledWith(
|
|
788
904
|
"route-app-intent",
|
|
@@ -793,7 +909,7 @@ describe("Dispatch NavContent", () => {
|
|
|
793
909
|
await route.answer();
|
|
794
910
|
expect(appTabs("route-opens").map((tab) => tab.appId)).toEqual(["mail"]);
|
|
795
911
|
|
|
796
|
-
routeTo({ status: "ok", app: "mail" });
|
|
912
|
+
routeTo({ status: "ok", app: "mail", confidence: 1, explicit: true });
|
|
797
913
|
await send("archive the first one");
|
|
798
914
|
expect(clientState.callAction).toHaveBeenLastCalledWith(
|
|
799
915
|
"route-app-intent",
|
|
@@ -803,11 +919,14 @@ describe("Dispatch NavContent", () => {
|
|
|
803
919
|
});
|
|
804
920
|
|
|
805
921
|
it.each([
|
|
806
|
-
["a chat-only answer", { status: "ok", app: "none" }],
|
|
922
|
+
["a chat-only answer", { status: "ok", app: "none", confidence: 1 }],
|
|
807
923
|
["an unconfigured route", { status: "not_configured", reason: "x" }],
|
|
808
924
|
["a failed route", { status: "failed", reason: "x" }],
|
|
809
|
-
[
|
|
810
|
-
|
|
925
|
+
[
|
|
926
|
+
"an app that is not installed",
|
|
927
|
+
{ status: "ok", app: "planner", confidence: 1 },
|
|
928
|
+
],
|
|
929
|
+
["Dispatch itself", { status: "ok", app: "dispatch", confidence: 1 }],
|
|
811
930
|
])("leaves the pane closed for %s", async (_label, answer) => {
|
|
812
931
|
await renderChat("/chat/route-skips");
|
|
813
932
|
const route = routeTo(answer);
|
|
@@ -828,8 +947,13 @@ describe("Dispatch NavContent", () => {
|
|
|
828
947
|
|
|
829
948
|
it("drops an answer once a newer message was sent", async () => {
|
|
830
949
|
await renderChat("/chat/route-newer-send");
|
|
831
|
-
const first = routeTo({
|
|
832
|
-
|
|
950
|
+
const first = routeTo({
|
|
951
|
+
status: "ok",
|
|
952
|
+
app: "mail",
|
|
953
|
+
confidence: 1,
|
|
954
|
+
explicit: true,
|
|
955
|
+
});
|
|
956
|
+
routeTo({ status: "ok", app: "none", confidence: 1 });
|
|
833
957
|
await send("show my inbox");
|
|
834
958
|
await send("never mind, just chat");
|
|
835
959
|
await first.answer();
|
|
@@ -838,7 +962,12 @@ describe("Dispatch NavContent", () => {
|
|
|
838
962
|
|
|
839
963
|
it("drops an answer once the agent already opened a pane", async () => {
|
|
840
964
|
await renderChat("/chat/route-agent-first");
|
|
841
|
-
const route = routeTo({
|
|
965
|
+
const route = routeTo({
|
|
966
|
+
status: "ok",
|
|
967
|
+
app: "mail",
|
|
968
|
+
confidence: 1,
|
|
969
|
+
explicit: true,
|
|
970
|
+
});
|
|
842
971
|
await send("show my notes");
|
|
843
972
|
await act(async () => {
|
|
844
973
|
emitChatFirstOpenApp({ app: "notes" });
|
|
@@ -849,6 +978,135 @@ describe("Dispatch NavContent", () => {
|
|
|
849
978
|
]);
|
|
850
979
|
});
|
|
851
980
|
|
|
981
|
+
it("keeps Tasks offscreen before the authoritative Mail notification handoff", async () => {
|
|
982
|
+
await renderChat("/chat/route-notifications", null, [
|
|
983
|
+
{
|
|
984
|
+
id: "mail-2",
|
|
985
|
+
name: "Mail",
|
|
986
|
+
path: "/mail",
|
|
987
|
+
url: "/mail",
|
|
988
|
+
status: "ready",
|
|
989
|
+
},
|
|
990
|
+
{
|
|
991
|
+
id: "tasks-2",
|
|
992
|
+
name: "Tasks",
|
|
993
|
+
path: "/tasks",
|
|
994
|
+
url: "/tasks",
|
|
995
|
+
status: "ready",
|
|
996
|
+
},
|
|
997
|
+
]);
|
|
998
|
+
const guess = routeTo({ status: "ok", app: "tasks-2", confidence: 0.95 });
|
|
999
|
+
await send("GitHub notifications from humans");
|
|
1000
|
+
await guess.answer();
|
|
1001
|
+
expect(appTabs("route-notifications")).toEqual([]);
|
|
1002
|
+
expect(container.querySelector("[data-chat-first-app-pane]")).toBeNull();
|
|
1003
|
+
|
|
1004
|
+
const pending = routeTo({
|
|
1005
|
+
status: "ok",
|
|
1006
|
+
app: "tasks-2",
|
|
1007
|
+
confidence: 1,
|
|
1008
|
+
explicit: true,
|
|
1009
|
+
});
|
|
1010
|
+
await send("GitHub notifications from humans, please");
|
|
1011
|
+
await act(async () => {
|
|
1012
|
+
window.dispatchEvent(
|
|
1013
|
+
new CustomEvent("agent-native:tool-start", {
|
|
1014
|
+
detail: { tool: "open_app", input: { app: "mail-2" } },
|
|
1015
|
+
}),
|
|
1016
|
+
);
|
|
1017
|
+
});
|
|
1018
|
+
await pending.answer();
|
|
1019
|
+
expect(appTabs("route-notifications")).toEqual([]);
|
|
1020
|
+
await act(async () => {
|
|
1021
|
+
emitChatFirstOpenApp({ app: "mail-2", path: "/split/github" });
|
|
1022
|
+
});
|
|
1023
|
+
expect(appTabs("route-notifications")).toMatchObject([
|
|
1024
|
+
{ appId: "mail-2", path: "/split/github" },
|
|
1025
|
+
]);
|
|
1026
|
+
});
|
|
1027
|
+
|
|
1028
|
+
it("reads a refreshed selection only from the visible workspace pane", async () => {
|
|
1029
|
+
const install = (app: string) => ({
|
|
1030
|
+
id: app,
|
|
1031
|
+
name: app,
|
|
1032
|
+
path: `/${app}`,
|
|
1033
|
+
url: `https://${app}.example.test/${app}`,
|
|
1034
|
+
status: "ready",
|
|
1035
|
+
});
|
|
1036
|
+
await renderChat("/chat/pane-context", null, [
|
|
1037
|
+
install("mail"),
|
|
1038
|
+
install("notes"),
|
|
1039
|
+
]);
|
|
1040
|
+
|
|
1041
|
+
async function openFrame(app: string, selection: () => string) {
|
|
1042
|
+
clientState.createEmbedSessionMutateAsync.mockResolvedValueOnce({
|
|
1043
|
+
startUrl: `https://${app}.example.test/${app}/initial`,
|
|
1044
|
+
childBrowserTabId:
|
|
1045
|
+
app === "mail"
|
|
1046
|
+
? "d178e672-918b-4c93-bd78-f627f7f00001"
|
|
1047
|
+
: "d178e672-918b-4c93-bd78-f627f7f00002",
|
|
1048
|
+
});
|
|
1049
|
+
await act(async () => emitChatFirstOpenApp({ app }));
|
|
1050
|
+
const frame = container.querySelector<HTMLIFrameElement>(
|
|
1051
|
+
`iframe[src^="https://${app}.example.test/"]`,
|
|
1052
|
+
);
|
|
1053
|
+
if (!frame?.contentWindow) throw new Error("Missing pane iframe");
|
|
1054
|
+
const read = vi
|
|
1055
|
+
.spyOn(frame.contentWindow, "postMessage")
|
|
1056
|
+
.mockImplementation((request, _origin, transfer) => {
|
|
1057
|
+
if (request?.operation !== "read") return;
|
|
1058
|
+
const [port] = transfer as MessagePort[];
|
|
1059
|
+
port.postMessage({
|
|
1060
|
+
result: { path: `/${app}/current`, selectedText: selection() },
|
|
1061
|
+
});
|
|
1062
|
+
port.close();
|
|
1063
|
+
});
|
|
1064
|
+
await act(async () => frame.dispatchEvent(new Event("load")));
|
|
1065
|
+
return read;
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
let selectedMail = "First message";
|
|
1069
|
+
const mailRead = await openFrame("mail", () => selectedMail);
|
|
1070
|
+
await send("Summarize this");
|
|
1071
|
+
await vi.waitFor(() =>
|
|
1072
|
+
expect(clientState.callAction).toHaveBeenLastCalledWith(
|
|
1073
|
+
"route-app-intent",
|
|
1074
|
+
expect.objectContaining({
|
|
1075
|
+
openApp: "mail",
|
|
1076
|
+
openPath: "/mail/current",
|
|
1077
|
+
selection: "First message",
|
|
1078
|
+
}),
|
|
1079
|
+
expect.anything(),
|
|
1080
|
+
),
|
|
1081
|
+
);
|
|
1082
|
+
|
|
1083
|
+
selectedMail = "Edited message";
|
|
1084
|
+
await send("Summarize this again");
|
|
1085
|
+
await vi.waitFor(() =>
|
|
1086
|
+
expect(clientState.callAction).toHaveBeenLastCalledWith(
|
|
1087
|
+
"route-app-intent",
|
|
1088
|
+
expect.objectContaining({ selection: "Edited message" }),
|
|
1089
|
+
expect.anything(),
|
|
1090
|
+
),
|
|
1091
|
+
);
|
|
1092
|
+
|
|
1093
|
+
await openFrame("notes", () => "Visible note");
|
|
1094
|
+
mailRead.mockClear();
|
|
1095
|
+
await send("Summarize the current selection");
|
|
1096
|
+
await vi.waitFor(() =>
|
|
1097
|
+
expect(clientState.callAction).toHaveBeenLastCalledWith(
|
|
1098
|
+
"route-app-intent",
|
|
1099
|
+
expect.objectContaining({
|
|
1100
|
+
openApp: "notes",
|
|
1101
|
+
openPath: "/notes/current",
|
|
1102
|
+
selection: "Visible note",
|
|
1103
|
+
}),
|
|
1104
|
+
expect.anything(),
|
|
1105
|
+
),
|
|
1106
|
+
);
|
|
1107
|
+
expect(mailRead).not.toHaveBeenCalled();
|
|
1108
|
+
});
|
|
1109
|
+
|
|
852
1110
|
it("does not route a send from another chat", async () => {
|
|
853
1111
|
await renderChat("/chat/route-own-chat");
|
|
854
1112
|
await act(async () => {
|
|
@@ -862,7 +1120,12 @@ describe("Dispatch NavContent", () => {
|
|
|
862
1120
|
|
|
863
1121
|
it("drops an answer once a queued message was sent after it", async () => {
|
|
864
1122
|
await renderChat("/chat/route-queued");
|
|
865
|
-
const route = routeTo({
|
|
1123
|
+
const route = routeTo({
|
|
1124
|
+
status: "ok",
|
|
1125
|
+
app: "mail",
|
|
1126
|
+
confidence: 1,
|
|
1127
|
+
explicit: true,
|
|
1128
|
+
});
|
|
866
1129
|
await send("show my inbox");
|
|
867
1130
|
await act(async () => {
|
|
868
1131
|
reportAgentChatComposerSubmit({ text: "and my notes", queued: true });
|
|
@@ -874,7 +1137,12 @@ describe("Dispatch NavContent", () => {
|
|
|
874
1137
|
|
|
875
1138
|
it("drops an answer for a send that was withdrawn", async () => {
|
|
876
1139
|
await renderChat("/chat/route-withdrawn");
|
|
877
|
-
const route = routeTo({
|
|
1140
|
+
const route = routeTo({
|
|
1141
|
+
status: "ok",
|
|
1142
|
+
app: "mail",
|
|
1143
|
+
confidence: 1,
|
|
1144
|
+
explicit: true,
|
|
1145
|
+
});
|
|
878
1146
|
let id: string | null = null;
|
|
879
1147
|
await act(async () => {
|
|
880
1148
|
id = reportAgentChatComposerSubmit({ text: "show my inbox" });
|
|
@@ -891,7 +1159,12 @@ describe("Dispatch NavContent", () => {
|
|
|
891
1159
|
"/chat/route-left",
|
|
892
1160
|
<ChatRouteSwitcher target="/agents" />,
|
|
893
1161
|
);
|
|
894
|
-
const route = routeTo({
|
|
1162
|
+
const route = routeTo({
|
|
1163
|
+
status: "ok",
|
|
1164
|
+
app: "mail",
|
|
1165
|
+
confidence: 1,
|
|
1166
|
+
explicit: true,
|
|
1167
|
+
});
|
|
895
1168
|
await send("show my inbox");
|
|
896
1169
|
await act(async () => {
|
|
897
1170
|
[...container.querySelectorAll("button")]
|
|
@@ -908,8 +1181,13 @@ describe("Dispatch NavContent", () => {
|
|
|
908
1181
|
"/chat",
|
|
909
1182
|
<ChatRouteSwitcher target="/chat/route-superseded" />,
|
|
910
1183
|
);
|
|
911
|
-
const first = routeTo({
|
|
912
|
-
|
|
1184
|
+
const first = routeTo({
|
|
1185
|
+
status: "ok",
|
|
1186
|
+
app: "mail",
|
|
1187
|
+
confidence: 1,
|
|
1188
|
+
explicit: true,
|
|
1189
|
+
});
|
|
1190
|
+
const second = routeTo({ status: "ok", app: "none", confidence: 1 });
|
|
913
1191
|
await send("show my inbox");
|
|
914
1192
|
await first.answer();
|
|
915
1193
|
await send("never mind");
|
|
@@ -924,7 +1202,12 @@ describe("Dispatch NavContent", () => {
|
|
|
924
1202
|
|
|
925
1203
|
it("moves the same pane when the agent opens that app deeper", async () => {
|
|
926
1204
|
await renderChat("/chat/route-same-app");
|
|
927
|
-
const route = routeTo({
|
|
1205
|
+
const route = routeTo({
|
|
1206
|
+
status: "ok",
|
|
1207
|
+
app: "mail",
|
|
1208
|
+
confidence: 1,
|
|
1209
|
+
explicit: true,
|
|
1210
|
+
});
|
|
928
1211
|
await send("show my inbox");
|
|
929
1212
|
await route.answer();
|
|
930
1213
|
const [openedId] = appTabs("route-same-app").map((tab) => tab.id);
|
|
@@ -942,7 +1225,12 @@ describe("Dispatch NavContent", () => {
|
|
|
942
1225
|
|
|
943
1226
|
it("replaces the pane when the agent opens a different app", async () => {
|
|
944
1227
|
await renderChat("/chat/route-other-app");
|
|
945
|
-
const route = routeTo({
|
|
1228
|
+
const route = routeTo({
|
|
1229
|
+
status: "ok",
|
|
1230
|
+
app: "mail",
|
|
1231
|
+
confidence: 1,
|
|
1232
|
+
explicit: true,
|
|
1233
|
+
});
|
|
946
1234
|
await send("show my inbox");
|
|
947
1235
|
await route.answer();
|
|
948
1236
|
await act(async () => {
|
|
@@ -955,7 +1243,12 @@ describe("Dispatch NavContent", () => {
|
|
|
955
1243
|
|
|
956
1244
|
it("keeps an app the agent opened after the routed turn", async () => {
|
|
957
1245
|
await renderChat("/chat/route-later-turn");
|
|
958
|
-
const route = routeTo({
|
|
1246
|
+
const route = routeTo({
|
|
1247
|
+
status: "ok",
|
|
1248
|
+
app: "mail",
|
|
1249
|
+
confidence: 1,
|
|
1250
|
+
explicit: true,
|
|
1251
|
+
});
|
|
959
1252
|
await send("show my inbox");
|
|
960
1253
|
await route.answer();
|
|
961
1254
|
await send("thanks");
|
|
@@ -974,7 +1267,12 @@ describe("Dispatch NavContent", () => {
|
|
|
974
1267
|
<ChatRouteSwitcher target="/chat/route-first-turn" />,
|
|
975
1268
|
);
|
|
976
1269
|
clientState.createEmbedSessionMutateAsync.mockClear();
|
|
977
|
-
const route = routeTo({
|
|
1270
|
+
const route = routeTo({
|
|
1271
|
+
status: "ok",
|
|
1272
|
+
app: "mail",
|
|
1273
|
+
confidence: 1,
|
|
1274
|
+
explicit: true,
|
|
1275
|
+
});
|
|
978
1276
|
await send("show my inbox");
|
|
979
1277
|
await route.answer();
|
|
980
1278
|
expect(container.querySelector("[data-chat-first-app-pane]")).toBeNull();
|
|
@@ -1001,7 +1299,12 @@ describe("Dispatch NavContent", () => {
|
|
|
1001
1299
|
"/chat",
|
|
1002
1300
|
<ChatRouteSwitcher target="/chat/route-named-thread" />,
|
|
1003
1301
|
);
|
|
1004
|
-
const route = routeTo({
|
|
1302
|
+
const route = routeTo({
|
|
1303
|
+
status: "ok",
|
|
1304
|
+
app: "mail",
|
|
1305
|
+
confidence: 1,
|
|
1306
|
+
explicit: true,
|
|
1307
|
+
});
|
|
1005
1308
|
await act(async () => {
|
|
1006
1309
|
reportAgentChatComposerSubmit({
|
|
1007
1310
|
text: "show my inbox",
|
|
@@ -1031,7 +1334,12 @@ describe("Dispatch NavContent", () => {
|
|
|
1031
1334
|
|
|
1032
1335
|
it("forgets a sent new chat's thread when another new chat starts", async () => {
|
|
1033
1336
|
await renderChat("/chat", <ChatRouteSwitcher target="/chat" />);
|
|
1034
|
-
const route = routeTo({
|
|
1337
|
+
const route = routeTo({
|
|
1338
|
+
status: "ok",
|
|
1339
|
+
app: "mail",
|
|
1340
|
+
confidence: 1,
|
|
1341
|
+
explicit: true,
|
|
1342
|
+
});
|
|
1035
1343
|
await act(async () => {
|
|
1036
1344
|
reportAgentChatComposerSubmit({
|
|
1037
1345
|
text: "show my inbox",
|
|
@@ -1055,7 +1363,12 @@ describe("Dispatch NavContent", () => {
|
|
|
1055
1363
|
|
|
1056
1364
|
it("clears a provisional new-chat thread when its send is withdrawn, without clearing a newer send", async () => {
|
|
1057
1365
|
await renderChat("/chat");
|
|
1058
|
-
const firstRoute = routeTo({
|
|
1366
|
+
const firstRoute = routeTo({
|
|
1367
|
+
status: "ok",
|
|
1368
|
+
app: "mail",
|
|
1369
|
+
confidence: 1,
|
|
1370
|
+
explicit: true,
|
|
1371
|
+
});
|
|
1059
1372
|
let firstSubmitId: string | null = null;
|
|
1060
1373
|
await act(async () => {
|
|
1061
1374
|
firstSubmitId = reportAgentChatComposerSubmit({
|
|
@@ -1072,7 +1385,12 @@ describe("Dispatch NavContent", () => {
|
|
|
1072
1385
|
expect(appTabs("route-withdrawn-thread")).toEqual([]);
|
|
1073
1386
|
expect(container.querySelector("[data-chat-first-app-pane]")).toBeNull();
|
|
1074
1387
|
|
|
1075
|
-
const secondRoute = routeTo({
|
|
1388
|
+
const secondRoute = routeTo({
|
|
1389
|
+
status: "ok",
|
|
1390
|
+
app: "mail",
|
|
1391
|
+
confidence: 1,
|
|
1392
|
+
explicit: true,
|
|
1393
|
+
});
|
|
1076
1394
|
await act(async () => {
|
|
1077
1395
|
reportAgentChatComposerSubmit({
|
|
1078
1396
|
text: "show my inbox again",
|
|
@@ -1098,7 +1416,12 @@ describe("Dispatch NavContent", () => {
|
|
|
1098
1416
|
"/chat",
|
|
1099
1417
|
<ChatRouteSwitcher target="/chat/route-back-thread" />,
|
|
1100
1418
|
);
|
|
1101
|
-
const route = routeTo({
|
|
1419
|
+
const route = routeTo({
|
|
1420
|
+
status: "ok",
|
|
1421
|
+
app: "mail",
|
|
1422
|
+
confidence: 1,
|
|
1423
|
+
explicit: true,
|
|
1424
|
+
});
|
|
1102
1425
|
await act(async () => {
|
|
1103
1426
|
reportAgentChatComposerSubmit({
|
|
1104
1427
|
text: "show my inbox",
|
|
@@ -1145,7 +1468,12 @@ describe("Dispatch NavContent", () => {
|
|
|
1145
1468
|
"/chat",
|
|
1146
1469
|
<ChatRouteSwitcher target="/chat/new-chat-no-flash" />,
|
|
1147
1470
|
);
|
|
1148
|
-
const route = routeTo({
|
|
1471
|
+
const route = routeTo({
|
|
1472
|
+
status: "ok",
|
|
1473
|
+
app: "calendar",
|
|
1474
|
+
confidence: 1,
|
|
1475
|
+
explicit: true,
|
|
1476
|
+
});
|
|
1149
1477
|
await send("hows my week look");
|
|
1150
1478
|
await route.answer();
|
|
1151
1479
|
expect(container.querySelector("[data-chat-first-app-pane]")).toBeNull();
|
|
@@ -1165,7 +1493,12 @@ describe("Dispatch NavContent", () => {
|
|
|
1165
1493
|
"/chat",
|
|
1166
1494
|
<ChatRouteSwitcher target="/chat/route-lifecycle" />,
|
|
1167
1495
|
);
|
|
1168
|
-
const first = routeTo({
|
|
1496
|
+
const first = routeTo({
|
|
1497
|
+
status: "ok",
|
|
1498
|
+
app: "mail",
|
|
1499
|
+
confidence: 1,
|
|
1500
|
+
explicit: true,
|
|
1501
|
+
});
|
|
1169
1502
|
await act(async () => {
|
|
1170
1503
|
reportAgentChatComposerSubmit({
|
|
1171
1504
|
text: "show my inbox",
|
|
@@ -1200,7 +1533,12 @@ describe("Dispatch NavContent", () => {
|
|
|
1200
1533
|
});
|
|
1201
1534
|
expect(clientState.callAction).toHaveBeenCalledTimes(1);
|
|
1202
1535
|
|
|
1203
|
-
const second = routeTo({
|
|
1536
|
+
const second = routeTo({
|
|
1537
|
+
status: "ok",
|
|
1538
|
+
app: "notes",
|
|
1539
|
+
confidence: 1,
|
|
1540
|
+
explicit: true,
|
|
1541
|
+
});
|
|
1204
1542
|
await act(async () => {
|
|
1205
1543
|
reportAgentChatComposerSubmit({
|
|
1206
1544
|
text: "open my Q4 planning doc",
|
|
@@ -1594,6 +1932,59 @@ describe("Dispatch NavContent", () => {
|
|
|
1594
1932
|
).not.toBeNull();
|
|
1595
1933
|
});
|
|
1596
1934
|
|
|
1935
|
+
it("restores a saved pane when the first mount is discarded", async () => {
|
|
1936
|
+
clientState.connectedApps = [
|
|
1937
|
+
{
|
|
1938
|
+
id: "clips",
|
|
1939
|
+
name: "Clips",
|
|
1940
|
+
url: "https://clips.agent-native.com",
|
|
1941
|
+
source: "builtin",
|
|
1942
|
+
},
|
|
1943
|
+
];
|
|
1944
|
+
clientState.appState[CHAT_FIRST_PANE_STATE_KEY] = {
|
|
1945
|
+
appId: "clips",
|
|
1946
|
+
path: "/inbox",
|
|
1947
|
+
};
|
|
1948
|
+
|
|
1949
|
+
await act(async () => {
|
|
1950
|
+
root.render(
|
|
1951
|
+
<React.StrictMode>
|
|
1952
|
+
<MemoryRouter initialEntries={["/chat/strict-restore"]}>
|
|
1953
|
+
<Layout extensions={{ chatFirst: true }}>
|
|
1954
|
+
<div />
|
|
1955
|
+
</Layout>
|
|
1956
|
+
</MemoryRouter>
|
|
1957
|
+
</React.StrictMode>,
|
|
1958
|
+
);
|
|
1959
|
+
});
|
|
1960
|
+
|
|
1961
|
+
expect(
|
|
1962
|
+
container.querySelector("[data-chat-first-app-pane]"),
|
|
1963
|
+
).not.toBeNull();
|
|
1964
|
+
expect(container.querySelector("[data-app-notice]")).toBeNull();
|
|
1965
|
+
});
|
|
1966
|
+
|
|
1967
|
+
it.each([[null], [{ appId: 7 }]])(
|
|
1968
|
+
"only reports a restore failure for unreadable pane state %j",
|
|
1969
|
+
async (saved) => {
|
|
1970
|
+
clientState.appState[CHAT_FIRST_PANE_STATE_KEY] = saved;
|
|
1971
|
+
|
|
1972
|
+
await act(async () => {
|
|
1973
|
+
root.render(
|
|
1974
|
+
<MemoryRouter initialEntries={["/chat/pane-state-outcome"]}>
|
|
1975
|
+
<Layout extensions={{ chatFirst: true }}>
|
|
1976
|
+
<div />
|
|
1977
|
+
</Layout>
|
|
1978
|
+
</MemoryRouter>,
|
|
1979
|
+
);
|
|
1980
|
+
});
|
|
1981
|
+
|
|
1982
|
+
expect(container.querySelector("[data-app-notice]") !== null).toBe(
|
|
1983
|
+
saved !== null,
|
|
1984
|
+
);
|
|
1985
|
+
},
|
|
1986
|
+
);
|
|
1987
|
+
|
|
1597
1988
|
it("puts Overview before Chat in the primary navigation", async () => {
|
|
1598
1989
|
await act(async () => {
|
|
1599
1990
|
root.render(
|