@agent-native/dispatch 0.31.25 → 0.31.26-nightly-20260826210104
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/dist/actions/import-agent.d.ts +13 -13
- package/dist/actions/provider-api-register.d.ts +11 -11
- package/dist/components/workspace-app-host.d.ts.map +1 -1
- package/dist/components/workspace-app-host.js +5 -0
- package/dist/components/workspace-app-host.js.map +1 -1
- package/package.json +4 -4
- package/src/components/workspace-app-host.tsx +6 -0
|
@@ -23,19 +23,6 @@ declare const _default: import("@agent-native/core/action").ActionDefinition<{
|
|
|
23
23
|
} | {
|
|
24
24
|
status: "created";
|
|
25
25
|
resource: {
|
|
26
|
-
id: string;
|
|
27
|
-
ownerEmail: string;
|
|
28
|
-
orgId: string | null;
|
|
29
|
-
kind: string;
|
|
30
|
-
name: string;
|
|
31
|
-
description: string | null;
|
|
32
|
-
path: string;
|
|
33
|
-
content: string;
|
|
34
|
-
scope: string;
|
|
35
|
-
createdBy: string;
|
|
36
|
-
createdAt: number;
|
|
37
|
-
updatedAt: number;
|
|
38
|
-
} | {
|
|
39
26
|
id: string;
|
|
40
27
|
ownerEmail: string;
|
|
41
28
|
orgId: string | null;
|
|
@@ -52,6 +39,19 @@ declare const _default: import("@agent-native/core/action").ActionDefinition<{
|
|
|
52
39
|
reviewedAt: number | null;
|
|
53
40
|
createdAt: number;
|
|
54
41
|
updatedAt: number;
|
|
42
|
+
} | {
|
|
43
|
+
id: string;
|
|
44
|
+
ownerEmail: string;
|
|
45
|
+
orgId: string | null;
|
|
46
|
+
kind: string;
|
|
47
|
+
name: string;
|
|
48
|
+
description: string | null;
|
|
49
|
+
path: string;
|
|
50
|
+
content: string;
|
|
51
|
+
scope: string;
|
|
52
|
+
createdBy: string;
|
|
53
|
+
createdAt: number;
|
|
54
|
+
updatedAt: number;
|
|
55
55
|
};
|
|
56
56
|
source: "claude" | "json" | "markdown";
|
|
57
57
|
warnings: string[];
|
|
@@ -47,10 +47,11 @@ declare const _default: import("node_modules/@agent-native/core/dist").ActionDef
|
|
|
47
47
|
notes?: string | undefined;
|
|
48
48
|
scope?: "org" | "user" | undefined;
|
|
49
49
|
}, {
|
|
50
|
+
message?: undefined;
|
|
50
51
|
id?: undefined;
|
|
51
52
|
provider?: undefined;
|
|
52
53
|
deleted?: undefined;
|
|
53
|
-
|
|
54
|
+
found?: undefined;
|
|
54
55
|
providers: {
|
|
55
56
|
id: string;
|
|
56
57
|
label: string;
|
|
@@ -61,45 +62,44 @@ declare const _default: import("node_modules/@agent-native/core/dist").ActionDef
|
|
|
61
62
|
updatedAt: number;
|
|
62
63
|
}[];
|
|
63
64
|
count: number;
|
|
64
|
-
found?: undefined;
|
|
65
65
|
registered?: undefined;
|
|
66
66
|
label?: undefined;
|
|
67
67
|
} | {
|
|
68
|
-
|
|
68
|
+
message?: undefined;
|
|
69
69
|
id?: undefined;
|
|
70
70
|
deleted?: undefined;
|
|
71
|
-
message?: undefined;
|
|
72
71
|
providers?: undefined;
|
|
72
|
+
count?: undefined;
|
|
73
73
|
found: boolean;
|
|
74
74
|
provider: import("node_modules/@agent-native/core/dist/provider-api").CustomProviderConfig;
|
|
75
75
|
registered?: undefined;
|
|
76
76
|
label?: undefined;
|
|
77
77
|
} | {
|
|
78
|
-
|
|
78
|
+
message?: undefined;
|
|
79
79
|
provider?: undefined;
|
|
80
80
|
deleted?: undefined;
|
|
81
|
-
message?: undefined;
|
|
82
81
|
providers?: undefined;
|
|
82
|
+
count?: undefined;
|
|
83
83
|
found: boolean;
|
|
84
84
|
id: string;
|
|
85
85
|
registered?: undefined;
|
|
86
86
|
label?: undefined;
|
|
87
87
|
} | {
|
|
88
|
-
count?: undefined;
|
|
89
|
-
provider?: undefined;
|
|
90
88
|
message?: undefined;
|
|
91
|
-
|
|
89
|
+
provider?: undefined;
|
|
92
90
|
found?: undefined;
|
|
91
|
+
providers?: undefined;
|
|
92
|
+
count?: undefined;
|
|
93
93
|
deleted: boolean;
|
|
94
94
|
id: string;
|
|
95
95
|
registered?: undefined;
|
|
96
96
|
label?: undefined;
|
|
97
97
|
} | {
|
|
98
|
-
count?: undefined;
|
|
99
98
|
provider?: undefined;
|
|
100
99
|
deleted?: undefined;
|
|
101
|
-
providers?: undefined;
|
|
102
100
|
found?: undefined;
|
|
101
|
+
providers?: undefined;
|
|
102
|
+
count?: undefined;
|
|
103
103
|
registered: boolean;
|
|
104
104
|
id: string;
|
|
105
105
|
label: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-app-host.d.ts","sourceRoot":"","sources":["../../src/components/workspace-app-host.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,sCAAsC,CAAC;AAe9C,OAAO,EAML,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"workspace-app-host.d.ts","sourceRoot":"","sources":["../../src/components/workspace-app-host.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,sCAAsC,CAAC;AAe9C,OAAO,EAML,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AA+Bf,UAAU,iBAAiB;IACzB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,SAAS,CAAC;CACnB;AAqBD,wBAAgB,+BAA+B,CAC7C,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,GACX,iBAAiB,CAEnB;AAkED,MAAM,WAAW,yBAAyB;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,SAAS,CAAC;IACpB,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAC;CAClC;AAED;;;;;;GAMG;AACH,w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C,WAAW,GACZ,EAAE;IACD,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B,mDAwCA"}
|
|
@@ -20,6 +20,9 @@ import { Alert, AlertDescription } from "./ui/alert.js";
|
|
|
20
20
|
import { Badge } from "./ui/badge.js";
|
|
21
21
|
import { Button } from "./ui/button.js";
|
|
22
22
|
import { Skeleton } from "./ui/skeleton.js";
|
|
23
|
+
// The server mint spends up to a 95s cold-boot budget waiting on a target app
|
|
24
|
+
// that is still starting; aborting sooner reports a booting app as unreachable.
|
|
25
|
+
const EMBED_SESSION_TIMEOUT_MS = 100_000;
|
|
23
26
|
function buildWorkspaceAppThemeUpdate(theme) {
|
|
24
27
|
return {
|
|
25
28
|
type: "agent-native-theme-update",
|
|
@@ -140,9 +143,11 @@ export function WorkspaceAppFrame({ app, navigateToTopWindow = navigateToWorkspa
|
|
|
140
143
|
const useWorkspaceSso = workspaceSsoEnabled && isWorkspaceSsoApp(app);
|
|
141
144
|
const createEmbedSession = useActionMutation("create_embed_session", {
|
|
142
145
|
skipActionQueryInvalidation: true,
|
|
146
|
+
timeoutMs: EMBED_SESSION_TIMEOUT_MS,
|
|
143
147
|
});
|
|
144
148
|
const createWorkspaceSsoEmbedSession = useActionMutation("create-workspace-app-embed-session", {
|
|
145
149
|
skipActionQueryInvalidation: true,
|
|
150
|
+
timeoutMs: EMBED_SESSION_TIMEOUT_MS,
|
|
146
151
|
});
|
|
147
152
|
const appHref = workspaceAppHref({
|
|
148
153
|
id: app.id,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-app-host.js","sourceRoot":"","sources":["../../src/components/workspace-app-host.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EACL,gBAAgB,EAChB,oBAAoB,GAErB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,cAAc,EA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AAO,CACL,yDAE2C,KAAK,iBACjC,CAAC,MAAM,EACpB,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,QAAQ,YAE/C,KAAC,gBAAgB,IAAC,KAAK,EAAE,KAAK,GAAI,IAL7B,KAAK,CAMN,CACP,CAAC;QACJ,CAAC,CAAC,GACE,CACP,CAAC;AACJ,CAAC","sourcesContent":["import { AgentSidebar } from \"@agent-native/core/client/agent-chat\";\nimport { agentNativePath } from \"@agent-native/core/client/api-path\";\nimport {\n ChatFirstAppPane,\n defaultChatFirstCopy,\n type ChatFirstCopy,\n} from \"@agent-native/core/client/chat-first\";\nimport { useFeatureFlag } from \"@agent-native/core/client/feature-flags\";\nimport {\n useActionMutation,\n useActionQuery,\n} from \"@agent-native/core/client/hooks\";\nimport { useT } from \"@agent-native/core/client/i18n\";\nimport { AGENT_NATIVE_WORKSPACE_APP_ROUTE_MESSAGE_TYPE } from \"@agent-native/core/client/navigation\";\nimport { withBuilderUtmTrackingParams } from \"@agent-native/core/shared/builder-link-tracking\";\nimport {\n IconAlertTriangle,\n IconArrowLeft,\n IconClockHour4,\n} from \"@tabler/icons-react\";\nimport { useTheme } from \"next-themes\";\nimport {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ReactNode,\n} from \"react\";\nimport { Link } from \"react-router\";\n\nimport { isEmbedSessionExpiredMessage } from \"../lib/embed-session-recovery\";\nimport {\n mergeChatFirstWorkspaceApps,\n isWorkspaceSsoApp,\n navigateToWorkspaceApp,\n shouldOpenWorkspaceAppInTopWindow,\n workspaceAppRouteForChildPath,\n workspaceAppDirectHref,\n workspaceAppEmbedTarget,\n workspaceAppHref,\n type WorkspaceAppSummary,\n} from \"../lib/workspace-apps\";\nimport { DISPATCH_WORKSPACE_SSO_FLAG } from \"../shared/feature-flags\";\nimport { workspaceAppChatProxyPath } from \"../shared/workspace-app-chat\";\nimport { ActionQueryError } from \"./action-query-error\";\nimport { Alert, AlertDescription } from \"./ui/alert\";\nimport { Badge } from \"./ui/badge\";\nimport { Button } from \"./ui/button\";\nimport { Skeleton } from \"./ui/skeleton\";\n\ninterface EmbedSessionResult {\n startUrl: string;\n}\n\ninterface EmbedSessionInput {\n app?: string;\n path?: string;\n url?: string;\n chrome: \"minimal\";\n}\n\ninterface GrantedWorkspaceAppSummary {\n id: string;\n name: string;\n url?: string | null;\n}\n\ninterface GrantedWorkspaceAppsResult {\n apps: GrantedWorkspaceAppSummary[];\n}\n\ntype WorkspaceAppTheme = \"light\" | \"dark\";\nfunction buildWorkspaceAppThemeUpdate(theme: WorkspaceAppTheme) {\n return {\n type: \"agent-native-theme-update\" as const,\n theme,\n isDark: theme === \"dark\",\n };\n}\n\nexport function buildChatFirstEmbedSessionInput(\n appId: string,\n path: string,\n): EmbedSessionInput {\n return { app: appId, path, chrome: \"minimal\" };\n}\n\nasync function readWorkspaceAppChatProxyError(\n response: Response,\n): Promise<string> {\n let body: string;\n try {\n body = await response.text();\n } catch {\n // coercion-ok: an unreadable body is reported as such, not as an empty error.\n return `Agent chat proxy returned ${response.status} with an unreadable body.`;\n }\n try {\n const parsed = JSON.parse(body) as { error?: unknown };\n if (typeof parsed.error === \"string\" && parsed.error) return parsed.error;\n } catch {\n // coercion-ok: a non-JSON body is still reportable as the status line.\n }\n return body.trim() || `Agent chat proxy returned ${response.status}.`;\n}\n\n/**\n * Point the app pane's chat rail at the app's OWN agent through the Dispatch\n * proxy, and prove the proxy answers before claiming it works. A rail that\n * quietly fell back to Dispatch's agent would look identical while running the\n * wrong tools, instructions, and app resources, so a failed probe is a visible\n * error state instead.\n */\nfunction useWorkspaceAppChatApi(appId: string) {\n const apiUrl = useMemo(\n () => agentNativePath(workspaceAppChatProxyPath(appId)),\n [appId],\n );\n const [attempt, setAttempt] = useState(0);\n const [unavailable, setUnavailable] = useState(false);\n\n useEffect(() => {\n let cancelled = false;\n setUnavailable(false);\n // `/mode` is the app's own dev-mode surface: reaching it proves the proxy\n // minted an app session and the app's agent-chat routes answer.\n void fetch(`${apiUrl}/mode`, { credentials: \"include\" })\n .then(async (response) => {\n if (response.ok) return;\n throw new Error(await readWorkspaceAppChatProxyError(response));\n })\n .catch((cause: unknown) => {\n if (cancelled) return;\n console.warn(\n `[dispatch] app chat proxy unavailable for ${appId}`,\n cause,\n );\n setUnavailable(true);\n });\n return () => {\n cancelled = true;\n };\n }, [apiUrl, appId, attempt]);\n\n return {\n apiUrl,\n unavailable,\n retry: useCallback(() => setAttempt((value) => value + 1), []),\n };\n}\n\nexport interface WorkspaceAppChatRailProps {\n appId: string;\n appName: string;\n children: ReactNode;\n copy?: ChatFirstCopy;\n agentPageHref?: string;\n onFullscreenRequest?: () => void;\n}\n\n/**\n * The chat beside an open workspace app. Every surface that hosts an app pane\n * must go through here so the rail is always the app's own agent — same tools,\n * AGENTS.md, skills, app-scoped resources, and dev-mode surface as the app's\n * native chat — and so an unreachable app is one visible error state rather\n * than a per-surface silent handoff back to Dispatch's agent.\n */\nexport function WorkspaceAppChatRail({\n appId,\n appName,\n children,\n copy = defaultChatFirstCopy,\n agentPageHref,\n onFullscreenRequest,\n}: WorkspaceAppChatRailProps) {\n const t = useT();\n const appChat = useWorkspaceAppChatApi(appId);\n\n if (appChat.unavailable) {\n return (\n <div className=\"flex h-full min-h-0\">\n <div\n data-dispatch-app-chat-unavailable\n className=\"w-88 shrink-0 overflow-auto border-r p-4\"\n >\n <Alert variant=\"destructive\">\n <IconAlertTriangle className=\"size-4\" />\n <AlertDescription className=\"flex flex-wrap items-center justify-between gap-3\">\n <span>\n {t(\"dispatch.pages.appChatUnavailable\", {\n defaultValue:\n \"Dispatch could not connect to {{name}}'s agent, so its chat is unavailable here.\",\n name: appName,\n })}\n </span>\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n onClick={appChat.retry}\n >\n {copy(\"retry\")}\n </Button>\n </AlertDescription>\n </Alert>\n </div>\n <div className=\"min-w-0 flex-1\">{children}</div>\n </div>\n );\n }\n\n return (\n <AgentSidebar\n position=\"left\"\n defaultOpen\n openStorageKey=\"dispatch-app-chat\"\n storageKey={`dispatch-app-chat:${appId}`}\n scope={{\n type: \"workspace-app\",\n id: appId,\n label: appName,\n contextKey: `workspace-app:${appId}`,\n }}\n isolateHistoryByScope\n // The app's own server answers this chat, so its tools, AGENTS.md,\n // skills, app-scoped resources, and dev-mode surface are the real ones\n // rather than a copy maintained inside Dispatch.\n apiUrl={appChat.apiUrl}\n agentChatSurface=\"app\"\n showTabBar\n suppressInlineOpenApp\n dynamicSuggestions={false}\n suggestions={[]}\n emptyStateText={`Ask about ${appName}`}\n {...(agentPageHref ? { agentPageHref } : {})}\n {...(onFullscreenRequest ? { onFullscreenRequest } : {})}\n >\n {children}\n </AgentSidebar>\n );\n}\n\nexport interface WorkspaceAppFrameApp {\n id: string;\n name: string;\n path?: string | null;\n url?: string | null;\n}\n\ninterface WorkspaceAppFrameProps {\n app: WorkspaceAppFrameApp;\n navigateToTopWindow?: (href: string) => boolean | void;\n /** Chat-first app tabs use their own route while standalone hosts use app metadata. */\n embedPath?: string;\n /** Standalone Dispatch routes seed the iframe once from their initial suffix. */\n initialPath?: string;\n /** Standalone Dispatch hosts mirror child route changes into the shell URL. */\n onChildRouteChange?: (path: string) => void;\n /** Chat-first app surfaces own the parent chat rail around the iframe. */\n chatSidebar?: boolean;\n copy?: ChatFirstCopy;\n}\n\nexport function WorkspaceAppFrame({\n app,\n navigateToTopWindow = navigateToWorkspaceApp,\n embedPath,\n initialPath,\n onChildRouteChange,\n chatSidebar = false,\n copy = defaultChatFirstCopy,\n}: WorkspaceAppFrameProps) {\n const { resolvedTheme } = useTheme();\n const theme: WorkspaceAppTheme =\n resolvedTheme === \"dark\" || resolvedTheme === \"light\"\n ? resolvedTheme\n : typeof document !== \"undefined\" &&\n document.documentElement.classList.contains(\"dark\")\n ? \"dark\"\n : \"light\";\n const [embedUrl, setEmbedUrl] = useState<string | null>(null);\n const [embedError, setEmbedError] = useState<Error | null>(null);\n const [isDirectFallback, setIsDirectFallback] = useState(false);\n const [embedAttempt, setEmbedAttempt] = useState(0);\n const [topWindowNavigationFailed, setTopWindowNavigationFailed] =\n useState(false);\n const embedFrameRef = useRef<HTMLIFrameElement>(null);\n const postThemeToFrame = useCallback(() => {\n embedFrameRef.current?.contentWindow?.postMessage(\n buildWorkspaceAppThemeUpdate(theme),\n \"*\",\n );\n }, [theme]);\n const handleFrameLoad = useCallback(() => {\n postThemeToFrame();\n if (isDirectFallback) setEmbedError(null);\n }, [isDirectFallback, postThemeToFrame]);\n const workspaceSsoEnabled = useFeatureFlag(DISPATCH_WORKSPACE_SSO_FLAG.key);\n const useWorkspaceSso = workspaceSsoEnabled && isWorkspaceSsoApp(app);\n const createEmbedSession = useActionMutation<\n EmbedSessionResult,\n EmbedSessionInput\n >(\"create_embed_session\", {\n skipActionQueryInvalidation: true,\n });\n const createWorkspaceSsoEmbedSession = useActionMutation<\n EmbedSessionResult,\n EmbedSessionInput\n >(\"create-workspace-app-embed-session\", {\n skipActionQueryInvalidation: true,\n });\n const appHref = workspaceAppHref({\n id: app.id,\n name: app.name,\n path: app.path ?? \"\",\n url: app.url,\n });\n const topWindowHref = useMemo(() => {\n if (embedPath !== undefined) {\n return workspaceAppDirectHref(\n { path: app.path, url: app.url },\n embedPath,\n );\n }\n if (initialPath !== undefined) {\n return workspaceAppDirectHref(\n { path: app.path, url: app.url },\n initialPath,\n );\n }\n\n const target = workspaceAppEmbedTarget({\n path: app.path ?? \"\",\n url: app.url,\n });\n return target.url ?? target.path ?? null;\n }, [app.path, app.url, embedPath, initialPath]);\n const openInTopWindow = shouldOpenWorkspaceAppInTopWindow();\n const topWindowSsoAttemptKey = `${app.id}\\u0000${app.path ?? \"\"}\\u0000${app.url ?? \"\"}\\u0000${embedPath ?? \"\"}\\u0000${initialPath ?? \"\"}\\u0000${embedAttempt}`;\n const topWindowSsoAttemptedRef = useRef<string | null>(null);\n const embedInput = useMemo<EmbedSessionInput | null>(() => {\n if (embedPath !== undefined) {\n return buildChatFirstEmbedSessionInput(app.id, embedPath);\n }\n if (initialPath !== undefined) {\n return buildChatFirstEmbedSessionInput(app.id, initialPath);\n }\n if (!appHref) return null;\n return {\n app: app.id,\n ...workspaceAppEmbedTarget({ path: app.path ?? \"\", url: app.url }),\n chrome: \"minimal\",\n };\n }, [app.id, app.path, app.url, appHref, embedPath, initialPath]);\n\n useEffect(() => {\n if (openInTopWindow && useWorkspaceSso && embedInput) {\n setTopWindowNavigationFailed(false);\n return;\n }\n if (!openInTopWindow) {\n setTopWindowNavigationFailed(false);\n return;\n }\n if (!topWindowHref) {\n setTopWindowNavigationFailed(true);\n return;\n }\n\n let didNavigate = false;\n try {\n didNavigate = navigateToTopWindow(topWindowHref) !== false;\n } catch {\n didNavigate = false;\n }\n setTopWindowNavigationFailed(!didNavigate);\n }, [\n embedInput,\n navigateToTopWindow,\n openInTopWindow,\n topWindowHref,\n useWorkspaceSso,\n ]);\n\n useEffect(() => {\n const useTopWindowSso = openInTopWindow && useWorkspaceSso && !!embedInput;\n if (\n !embedInput ||\n (openInTopWindow && !useWorkspaceSso && !topWindowNavigationFailed)\n ) {\n return;\n }\n if (\n useTopWindowSso &&\n topWindowSsoAttemptedRef.current === topWindowSsoAttemptKey\n ) {\n return;\n }\n if (useTopWindowSso) {\n topWindowSsoAttemptedRef.current = topWindowSsoAttemptKey;\n }\n let cancelled = false;\n setEmbedUrl(null);\n setEmbedError(null);\n setIsDirectFallback(false);\n const createSession = useWorkspaceSso\n ? createWorkspaceSsoEmbedSession\n : createEmbedSession;\n void createSession\n .mutateAsync(embedInput)\n .then((result) => {\n if (cancelled) return;\n if (useTopWindowSso) {\n let didNavigate = false;\n try {\n didNavigate = navigateToTopWindow(result.startUrl) !== false;\n } catch {\n didNavigate = false;\n }\n setTopWindowNavigationFailed(!didNavigate);\n setEmbedUrl(didNavigate ? null : result.startUrl);\n return;\n }\n setEmbedUrl(result.startUrl);\n })\n .catch((cause: unknown) => {\n if (cancelled) return;\n const error = cause instanceof Error ? cause : new Error(String(cause));\n if (useWorkspaceSso) {\n // An SSO-enabled pane must never fall back to the child app's\n // unauthenticated shell. Keep the parent-owned retry surface in\n // place so a transient exchange failure cannot expose another\n // login form.\n setIsDirectFallback(false);\n setEmbedUrl(null);\n setEmbedError(error);\n if (useTopWindowSso) setTopWindowNavigationFailed(true);\n return;\n }\n setIsDirectFallback(true);\n setEmbedUrl(\n workspaceAppDirectHref(\n { path: app.path ?? \"\", url: app.url },\n initialPath ?? embedPath ?? \"/\",\n ),\n );\n setEmbedError(error);\n });\n return () => {\n cancelled = true;\n };\n }, [\n app.id,\n app.path,\n app.url,\n createEmbedSession.mutateAsync,\n createWorkspaceSsoEmbedSession.mutateAsync,\n embedInput,\n embedPath,\n initialPath,\n embedAttempt,\n openInTopWindow,\n navigateToTopWindow,\n topWindowSsoAttemptKey,\n topWindowNavigationFailed,\n useWorkspaceSso,\n ]);\n\n useEffect(() => {\n const handleEmbedSessionExpired = (event: MessageEvent) => {\n if (\n !isEmbedSessionExpiredMessage(event, embedFrameRef.current, embedUrl)\n ) {\n return;\n }\n setEmbedAttempt((attempt) => attempt + 1);\n };\n\n window.addEventListener(\"message\", handleEmbedSessionExpired);\n return () =>\n window.removeEventListener(\"message\", handleEmbedSessionExpired);\n }, [embedUrl]);\n\n useEffect(() => {\n if (!onChildRouteChange || !embedUrl) return;\n\n const frame = embedFrameRef.current;\n if (!frame) return;\n\n let expectedOrigin: string;\n try {\n expectedOrigin = new URL(embedUrl, window.location.href).origin;\n } catch {\n return;\n }\n\n const handleWorkspaceAppRoute = (event: MessageEvent) => {\n if (\n event.source !== frame.contentWindow ||\n event.origin !== expectedOrigin\n ) {\n return;\n }\n const message = event.data as {\n type?: unknown;\n path?: unknown;\n } | null;\n if (\n message?.type !== AGENT_NATIVE_WORKSPACE_APP_ROUTE_MESSAGE_TYPE ||\n typeof message.path !== \"string\"\n ) {\n return;\n }\n\n const route = workspaceAppRouteForChildPath(\n { id: app.id, path: app.path ?? \"\", url: app.url },\n message.path,\n );\n if (route) onChildRouteChange(route);\n };\n\n window.addEventListener(\"message\", handleWorkspaceAppRoute);\n return () => window.removeEventListener(\"message\", handleWorkspaceAppRoute);\n }, [app.id, app.path, app.url, embedUrl, onChildRouteChange]);\n\n useEffect(() => {\n postThemeToFrame();\n }, [embedUrl, postThemeToFrame]);\n\n const appPane = (\n <ChatFirstAppPane\n app={app}\n status={\n embedUrl\n ? \"ready\"\n : embedError\n ? \"error\"\n : embedInput\n ? \"loading\"\n : \"unresolved\"\n }\n embedUrl={embedUrl}\n errorMessage={embedError?.message}\n onRetry={\n embedInput ? () => setEmbedAttempt((attempt) => attempt + 1) : undefined\n }\n renderEmbed={({ url, title }) => (\n <iframe\n key={url + \":\" + embedAttempt}\n data-dispatch-workspace-app-frame\n src={url}\n title={title ?? app.name}\n ref={embedFrameRef}\n onLoad={handleFrameLoad}\n referrerPolicy=\"no-referrer\"\n allow=\"clipboard-read; clipboard-write\"\n className=\"h-full w-full border-0 bg-background\"\n />\n )}\n copy={copy}\n />\n );\n\n if (!chatSidebar) return appPane;\n\n return (\n <WorkspaceAppChatRail appId={app.id} appName={app.name} copy={copy}>\n {appPane}\n </WorkspaceAppChatRail>\n );\n}\n\nexport function WorkspaceAppHost({\n appId,\n navigateToTopWindow = navigateToWorkspaceApp,\n initialPath,\n onChildRouteChange,\n}: {\n appId?: string;\n navigateToTopWindow?: (href: string) => boolean | void;\n initialPath?: string;\n onChildRouteChange?: (path: string) => void;\n}) {\n const t = useT();\n const workspaceAppsQuery = useActionQuery<WorkspaceAppSummary[]>(\n \"list-workspace-apps\",\n { includeAgentCards: false, includeArchived: true },\n );\n const workspaceApps = useMemo(\n () => mergeChatFirstWorkspaceApps(workspaceAppsQuery.data),\n [workspaceAppsQuery.data],\n );\n const visibleWorkspaceApps = useMemo(\n () => workspaceApps.filter((item) => !item.archived),\n [workspaceApps],\n );\n const workspaceAppIds = useMemo(\n () => new Set(workspaceApps.map((item) => item.id.trim().toLowerCase())),\n [workspaceApps],\n );\n const workspaceApp = useMemo(\n () =>\n visibleWorkspaceApps.find(\n (item) => item.id.trim().toLowerCase() === appId?.trim().toLowerCase(),\n ) ?? null,\n [appId, visibleWorkspaceApps],\n );\n const grantedAppsQuery = useActionQuery<GrantedWorkspaceAppsResult>(\n \"list_apps\",\n {},\n {\n // Mounted workspace apps are already fully described by the workspace\n // registry. Defer the broader MCP grant/discovery scan until that\n // lookup misses; it is only needed for externally granted apps.\n enabled: !workspaceAppsQuery.isLoading && !workspaceApp,\n },\n );\n const apps = useMemo(() => {\n const merged = new Map<string, WorkspaceAppSummary>();\n\n for (const app of visibleWorkspaceApps) {\n merged.set(app.id.trim().toLowerCase(), app);\n }\n for (const app of grantedAppsQuery.data?.apps ?? []) {\n const id = app.id.trim();\n if (\n !id ||\n workspaceAppIds.has(id.toLowerCase()) ||\n merged.has(id.toLowerCase())\n ) {\n continue;\n }\n merged.set(id.toLowerCase(), {\n id,\n name: app.name.trim() || id,\n path: \"\",\n url: app.url?.trim() || null,\n status: \"ready\",\n });\n }\n\n return [...merged.values()];\n }, [grantedAppsQuery.data?.apps, visibleWorkspaceApps, workspaceAppIds]);\n const app = useMemo(\n () =>\n apps.find(\n (item) => item.id.trim().toLowerCase() === appId?.trim().toLowerCase(),\n ) ?? null,\n [appId, apps],\n );\n const isLoading = workspaceAppsQuery.isLoading || grantedAppsQuery.isLoading;\n const queryError = workspaceAppsQuery.isError\n ? workspaceAppsQuery.error\n : grantedAppsQuery.isError\n ? grantedAppsQuery.error\n : null;\n\n if (queryError && !app) {\n return (\n <div className=\"flex h-full min-h-0 items-center justify-center p-6\">\n <div className=\"w-full max-w-2xl\">\n <ActionQueryError\n error={queryError}\n onRetry={() => {\n void workspaceAppsQuery.refetch();\n void grantedAppsQuery.refetch();\n }}\n />\n </div>\n </div>\n );\n }\n\n if (isLoading && !app) {\n return (\n <div className=\"flex h-full min-h-0 items-center justify-center p-6\">\n <div className=\"w-full max-w-2xl space-y-3 rounded-xl border bg-card p-6\">\n <Skeleton className=\"h-5 w-48\" />\n <Skeleton className=\"h-4 w-full\" />\n <Skeleton className=\"h-4 w-2/3\" />\n </div>\n </div>\n );\n }\n\n if (!app) {\n return (\n <div className=\"flex h-full min-h-0 items-center justify-center p-6\">\n <div className=\"w-full max-w-2xl rounded-xl border bg-card p-6\">\n <Button asChild size=\"sm\" variant=\"ghost\" className=\"-ml-2 mb-4\">\n <Link to=\"/apps\">\n <IconArrowLeft size={15} className=\"mr-1.5\" />\n {t(\"dispatch.nav.apps\")}\n </Link>\n </Button>\n <div className=\"space-y-3\">\n <h2 className=\"text-base font-semibold text-foreground\">\n {t(\"dispatch.pages.appNotFound\")}\n </h2>\n <p className=\"text-sm text-muted-foreground\">\n {t(\"dispatch.pages.pageNotFoundDescription\")}\n </p>\n </div>\n </div>\n </div>\n );\n }\n\n if (app.status === \"pending\") {\n return (\n <div className=\"flex h-full min-h-0 items-center justify-center p-6\">\n <div className=\"w-full max-w-2xl rounded-xl border bg-card p-6\">\n <Button asChild size=\"sm\" variant=\"ghost\" className=\"-ml-2 mb-4\">\n <Link to=\"/apps\">\n <IconArrowLeft size={15} className=\"mr-1.5\" />\n {t(\"dispatch.nav.apps\")}\n </Link>\n </Button>\n <div className=\"space-y-4\">\n <div className=\"flex flex-wrap items-center gap-2\">\n <h2 className=\"text-base font-semibold text-foreground\">\n {app.name}\n </h2>\n <Badge\n variant=\"outline\"\n className=\"gap-1 border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300\"\n >\n <IconClockHour4 size={12} />\n {t(\"dispatch.pages.building\")}\n </Badge>\n </div>\n <p className=\"text-sm text-muted-foreground\">\n {t(\"dispatch.pages.appBuildingPrefix\")}{\" \"}\n <span className=\"font-mono text-foreground\">{app.path}</span>{\" \"}\n {t(\"dispatch.pages.appBuildingSuffix\")}\n </p>\n {app.builderUrl ? (\n <Button asChild>\n <a\n href={withBuilderUtmTrackingParams(app.builderUrl, {\n campaign: \"product\",\n content: \"dispatch_branch\",\n })}\n target=\"_blank\"\n rel=\"noreferrer\"\n >\n {t(\"dispatch.pages.openBuilderBranch\", {\n defaultValue: \"Open in Builder\",\n })}\n </a>\n </Button>\n ) : null}\n </div>\n </div>\n </div>\n );\n }\n\n return (\n <div\n data-dispatch-workspace-app-host\n className=\"flex h-full min-h-0 flex-col bg-background\"\n >\n <div className=\"min-h-0 flex-1 bg-muted/20\">\n <WorkspaceAppFrame\n app={app}\n navigateToTopWindow={navigateToTopWindow}\n initialPath={initialPath}\n onChildRouteChange={onChildRouteChange}\n />\n </div>\n </div>\n );\n}\n\nconst MAX_KEEP_ALIVE_APPS = 3;\n\nexport function WorkspaceAppKeepAlive({\n activeAppId,\n}: {\n activeAppId: string | null;\n}) {\n const [visitedAppIds, setVisitedAppIds] = useState<string[]>(() =>\n activeAppId ? [activeAppId] : [],\n );\n\n useEffect(() => {\n if (!activeAppId) return;\n setVisitedAppIds((current) =>\n [activeAppId, ...current.filter((appId) => appId !== activeAppId)].slice(\n 0,\n MAX_KEEP_ALIVE_APPS,\n ),\n );\n }, [activeAppId]);\n\n const renderedAppIds =\n activeAppId && !visitedAppIds.includes(activeAppId)\n ? [activeAppId, ...visitedAppIds]\n : visitedAppIds;\n\n return (\n <div\n data-dispatch-workspace-app-cache\n className={activeAppId ? \"absolute inset-0 overflow-hidden\" : \"hidden\"}\n >\n {renderedAppIds.map((appId) => {\n const active = appId === activeAppId;\n return (\n <div\n key={appId}\n data-dispatch-workspace-app-cache-entry={appId}\n aria-hidden={!active}\n className={active ? \"h-full min-h-0\" : \"hidden\"}\n >\n <WorkspaceAppHost appId={appId} />\n </div>\n );\n })}\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"workspace-app-host.js","sourceRoot":"","sources":["../../src/components/workspace-app-host.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,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AEpB,OAAO,CACL,yDAEE,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC,kCAAkC,CAAC,CAAC,CAAC,QAAQ,YAErE,cAAc,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;YAC5B,MAAM,MAAM,GAAG,KAAK,KAAK,WAAW,CAAC;YACrC,OAAO,CACL,yDAE2C,KAAK,iBACjC,CAAC,MAAM,EACpB,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,QAAQ,YAE/C,KAAC,gBAAgB,IAAC,KAAK,EAAE,KAAK,GAAI,IAL7B,KAAK,CAMN,CACP,CAAC;QACJ,CAAC,CAAC,GACE,CACP,CAAC;AACJ,CAAC","sourcesContent":["import { AgentSidebar } from \"@agent-native/core/client/agent-chat\";\nimport { agentNativePath } from \"@agent-native/core/client/api-path\";\nimport {\n ChatFirstAppPane,\n defaultChatFirstCopy,\n type ChatFirstCopy,\n} from \"@agent-native/core/client/chat-first\";\nimport { useFeatureFlag } from \"@agent-native/core/client/feature-flags\";\nimport {\n useActionMutation,\n useActionQuery,\n} from \"@agent-native/core/client/hooks\";\nimport { useT } from \"@agent-native/core/client/i18n\";\nimport { AGENT_NATIVE_WORKSPACE_APP_ROUTE_MESSAGE_TYPE } from \"@agent-native/core/client/navigation\";\nimport { withBuilderUtmTrackingParams } from \"@agent-native/core/shared/builder-link-tracking\";\nimport {\n IconAlertTriangle,\n IconArrowLeft,\n IconClockHour4,\n} from \"@tabler/icons-react\";\nimport { useTheme } from \"next-themes\";\nimport {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ReactNode,\n} from \"react\";\nimport { Link } from \"react-router\";\n\nimport { isEmbedSessionExpiredMessage } from \"../lib/embed-session-recovery\";\nimport {\n mergeChatFirstWorkspaceApps,\n isWorkspaceSsoApp,\n navigateToWorkspaceApp,\n shouldOpenWorkspaceAppInTopWindow,\n workspaceAppRouteForChildPath,\n workspaceAppDirectHref,\n workspaceAppEmbedTarget,\n workspaceAppHref,\n type WorkspaceAppSummary,\n} from \"../lib/workspace-apps\";\nimport { DISPATCH_WORKSPACE_SSO_FLAG } from \"../shared/feature-flags\";\nimport { workspaceAppChatProxyPath } from \"../shared/workspace-app-chat\";\nimport { ActionQueryError } from \"./action-query-error\";\nimport { Alert, AlertDescription } from \"./ui/alert\";\nimport { Badge } from \"./ui/badge\";\nimport { Button } from \"./ui/button\";\nimport { Skeleton } from \"./ui/skeleton\";\n\n// The server mint spends up to a 95s cold-boot budget waiting on a target app\n// that is still starting; aborting sooner reports a booting app as unreachable.\nconst EMBED_SESSION_TIMEOUT_MS = 100_000;\n\ninterface EmbedSessionResult {\n startUrl: string;\n}\n\ninterface EmbedSessionInput {\n app?: string;\n path?: string;\n url?: string;\n chrome: \"minimal\";\n}\n\ninterface GrantedWorkspaceAppSummary {\n id: string;\n name: string;\n url?: string | null;\n}\n\ninterface GrantedWorkspaceAppsResult {\n apps: GrantedWorkspaceAppSummary[];\n}\n\ntype WorkspaceAppTheme = \"light\" | \"dark\";\nfunction buildWorkspaceAppThemeUpdate(theme: WorkspaceAppTheme) {\n return {\n type: \"agent-native-theme-update\" as const,\n theme,\n isDark: theme === \"dark\",\n };\n}\n\nexport function buildChatFirstEmbedSessionInput(\n appId: string,\n path: string,\n): EmbedSessionInput {\n return { app: appId, path, chrome: \"minimal\" };\n}\n\nasync function readWorkspaceAppChatProxyError(\n response: Response,\n): Promise<string> {\n let body: string;\n try {\n body = await response.text();\n } catch {\n // coercion-ok: an unreadable body is reported as such, not as an empty error.\n return `Agent chat proxy returned ${response.status} with an unreadable body.`;\n }\n try {\n const parsed = JSON.parse(body) as { error?: unknown };\n if (typeof parsed.error === \"string\" && parsed.error) return parsed.error;\n } catch {\n // coercion-ok: a non-JSON body is still reportable as the status line.\n }\n return body.trim() || `Agent chat proxy returned ${response.status}.`;\n}\n\n/**\n * Point the app pane's chat rail at the app's OWN agent through the Dispatch\n * proxy, and prove the proxy answers before claiming it works. A rail that\n * quietly fell back to Dispatch's agent would look identical while running the\n * wrong tools, instructions, and app resources, so a failed probe is a visible\n * error state instead.\n */\nfunction useWorkspaceAppChatApi(appId: string) {\n const apiUrl = useMemo(\n () => agentNativePath(workspaceAppChatProxyPath(appId)),\n [appId],\n );\n const [attempt, setAttempt] = useState(0);\n const [unavailable, setUnavailable] = useState(false);\n\n useEffect(() => {\n let cancelled = false;\n setUnavailable(false);\n // `/mode` is the app's own dev-mode surface: reaching it proves the proxy\n // minted an app session and the app's agent-chat routes answer.\n void fetch(`${apiUrl}/mode`, { credentials: \"include\" })\n .then(async (response) => {\n if (response.ok) return;\n throw new Error(await readWorkspaceAppChatProxyError(response));\n })\n .catch((cause: unknown) => {\n if (cancelled) return;\n console.warn(\n `[dispatch] app chat proxy unavailable for ${appId}`,\n cause,\n );\n setUnavailable(true);\n });\n return () => {\n cancelled = true;\n };\n }, [apiUrl, appId, attempt]);\n\n return {\n apiUrl,\n unavailable,\n retry: useCallback(() => setAttempt((value) => value + 1), []),\n };\n}\n\nexport interface WorkspaceAppChatRailProps {\n appId: string;\n appName: string;\n children: ReactNode;\n copy?: ChatFirstCopy;\n agentPageHref?: string;\n onFullscreenRequest?: () => void;\n}\n\n/**\n * The chat beside an open workspace app. Every surface that hosts an app pane\n * must go through here so the rail is always the app's own agent — same tools,\n * AGENTS.md, skills, app-scoped resources, and dev-mode surface as the app's\n * native chat — and so an unreachable app is one visible error state rather\n * than a per-surface silent handoff back to Dispatch's agent.\n */\nexport function WorkspaceAppChatRail({\n appId,\n appName,\n children,\n copy = defaultChatFirstCopy,\n agentPageHref,\n onFullscreenRequest,\n}: WorkspaceAppChatRailProps) {\n const t = useT();\n const appChat = useWorkspaceAppChatApi(appId);\n\n if (appChat.unavailable) {\n return (\n <div className=\"flex h-full min-h-0\">\n <div\n data-dispatch-app-chat-unavailable\n className=\"w-88 shrink-0 overflow-auto border-r p-4\"\n >\n <Alert variant=\"destructive\">\n <IconAlertTriangle className=\"size-4\" />\n <AlertDescription className=\"flex flex-wrap items-center justify-between gap-3\">\n <span>\n {t(\"dispatch.pages.appChatUnavailable\", {\n defaultValue:\n \"Dispatch could not connect to {{name}}'s agent, so its chat is unavailable here.\",\n name: appName,\n })}\n </span>\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n onClick={appChat.retry}\n >\n {copy(\"retry\")}\n </Button>\n </AlertDescription>\n </Alert>\n </div>\n <div className=\"min-w-0 flex-1\">{children}</div>\n </div>\n );\n }\n\n return (\n <AgentSidebar\n position=\"left\"\n defaultOpen\n openStorageKey=\"dispatch-app-chat\"\n storageKey={`dispatch-app-chat:${appId}`}\n scope={{\n type: \"workspace-app\",\n id: appId,\n label: appName,\n contextKey: `workspace-app:${appId}`,\n }}\n isolateHistoryByScope\n // The app's own server answers this chat, so its tools, AGENTS.md,\n // skills, app-scoped resources, and dev-mode surface are the real ones\n // rather than a copy maintained inside Dispatch.\n apiUrl={appChat.apiUrl}\n agentChatSurface=\"app\"\n showTabBar\n suppressInlineOpenApp\n dynamicSuggestions={false}\n suggestions={[]}\n emptyStateText={`Ask about ${appName}`}\n {...(agentPageHref ? { agentPageHref } : {})}\n {...(onFullscreenRequest ? { onFullscreenRequest } : {})}\n >\n {children}\n </AgentSidebar>\n );\n}\n\nexport interface WorkspaceAppFrameApp {\n id: string;\n name: string;\n path?: string | null;\n url?: string | null;\n}\n\ninterface WorkspaceAppFrameProps {\n app: WorkspaceAppFrameApp;\n navigateToTopWindow?: (href: string) => boolean | void;\n /** Chat-first app tabs use their own route while standalone hosts use app metadata. */\n embedPath?: string;\n /** Standalone Dispatch routes seed the iframe once from their initial suffix. */\n initialPath?: string;\n /** Standalone Dispatch hosts mirror child route changes into the shell URL. */\n onChildRouteChange?: (path: string) => void;\n /** Chat-first app surfaces own the parent chat rail around the iframe. */\n chatSidebar?: boolean;\n copy?: ChatFirstCopy;\n}\n\nexport function WorkspaceAppFrame({\n app,\n navigateToTopWindow = navigateToWorkspaceApp,\n embedPath,\n initialPath,\n onChildRouteChange,\n chatSidebar = false,\n copy = defaultChatFirstCopy,\n}: WorkspaceAppFrameProps) {\n const { resolvedTheme } = useTheme();\n const theme: WorkspaceAppTheme =\n resolvedTheme === \"dark\" || resolvedTheme === \"light\"\n ? resolvedTheme\n : typeof document !== \"undefined\" &&\n document.documentElement.classList.contains(\"dark\")\n ? \"dark\"\n : \"light\";\n const [embedUrl, setEmbedUrl] = useState<string | null>(null);\n const [embedError, setEmbedError] = useState<Error | null>(null);\n const [isDirectFallback, setIsDirectFallback] = useState(false);\n const [embedAttempt, setEmbedAttempt] = useState(0);\n const [topWindowNavigationFailed, setTopWindowNavigationFailed] =\n useState(false);\n const embedFrameRef = useRef<HTMLIFrameElement>(null);\n const postThemeToFrame = useCallback(() => {\n embedFrameRef.current?.contentWindow?.postMessage(\n buildWorkspaceAppThemeUpdate(theme),\n \"*\",\n );\n }, [theme]);\n const handleFrameLoad = useCallback(() => {\n postThemeToFrame();\n if (isDirectFallback) setEmbedError(null);\n }, [isDirectFallback, postThemeToFrame]);\n const workspaceSsoEnabled = useFeatureFlag(DISPATCH_WORKSPACE_SSO_FLAG.key);\n const useWorkspaceSso = workspaceSsoEnabled && isWorkspaceSsoApp(app);\n const createEmbedSession = useActionMutation<\n EmbedSessionResult,\n EmbedSessionInput\n >(\"create_embed_session\", {\n skipActionQueryInvalidation: true,\n timeoutMs: EMBED_SESSION_TIMEOUT_MS,\n });\n const createWorkspaceSsoEmbedSession = useActionMutation<\n EmbedSessionResult,\n EmbedSessionInput\n >(\"create-workspace-app-embed-session\", {\n skipActionQueryInvalidation: true,\n timeoutMs: EMBED_SESSION_TIMEOUT_MS,\n });\n const appHref = workspaceAppHref({\n id: app.id,\n name: app.name,\n path: app.path ?? \"\",\n url: app.url,\n });\n const topWindowHref = useMemo(() => {\n if (embedPath !== undefined) {\n return workspaceAppDirectHref(\n { path: app.path, url: app.url },\n embedPath,\n );\n }\n if (initialPath !== undefined) {\n return workspaceAppDirectHref(\n { path: app.path, url: app.url },\n initialPath,\n );\n }\n\n const target = workspaceAppEmbedTarget({\n path: app.path ?? \"\",\n url: app.url,\n });\n return target.url ?? target.path ?? null;\n }, [app.path, app.url, embedPath, initialPath]);\n const openInTopWindow = shouldOpenWorkspaceAppInTopWindow();\n const topWindowSsoAttemptKey = `${app.id}\\u0000${app.path ?? \"\"}\\u0000${app.url ?? \"\"}\\u0000${embedPath ?? \"\"}\\u0000${initialPath ?? \"\"}\\u0000${embedAttempt}`;\n const topWindowSsoAttemptedRef = useRef<string | null>(null);\n const embedInput = useMemo<EmbedSessionInput | null>(() => {\n if (embedPath !== undefined) {\n return buildChatFirstEmbedSessionInput(app.id, embedPath);\n }\n if (initialPath !== undefined) {\n return buildChatFirstEmbedSessionInput(app.id, initialPath);\n }\n if (!appHref) return null;\n return {\n app: app.id,\n ...workspaceAppEmbedTarget({ path: app.path ?? \"\", url: app.url }),\n chrome: \"minimal\",\n };\n }, [app.id, app.path, app.url, appHref, embedPath, initialPath]);\n\n useEffect(() => {\n if (openInTopWindow && useWorkspaceSso && embedInput) {\n setTopWindowNavigationFailed(false);\n return;\n }\n if (!openInTopWindow) {\n setTopWindowNavigationFailed(false);\n return;\n }\n if (!topWindowHref) {\n setTopWindowNavigationFailed(true);\n return;\n }\n\n let didNavigate = false;\n try {\n didNavigate = navigateToTopWindow(topWindowHref) !== false;\n } catch {\n didNavigate = false;\n }\n setTopWindowNavigationFailed(!didNavigate);\n }, [\n embedInput,\n navigateToTopWindow,\n openInTopWindow,\n topWindowHref,\n useWorkspaceSso,\n ]);\n\n useEffect(() => {\n const useTopWindowSso = openInTopWindow && useWorkspaceSso && !!embedInput;\n if (\n !embedInput ||\n (openInTopWindow && !useWorkspaceSso && !topWindowNavigationFailed)\n ) {\n return;\n }\n if (\n useTopWindowSso &&\n topWindowSsoAttemptedRef.current === topWindowSsoAttemptKey\n ) {\n return;\n }\n if (useTopWindowSso) {\n topWindowSsoAttemptedRef.current = topWindowSsoAttemptKey;\n }\n let cancelled = false;\n setEmbedUrl(null);\n setEmbedError(null);\n setIsDirectFallback(false);\n const createSession = useWorkspaceSso\n ? createWorkspaceSsoEmbedSession\n : createEmbedSession;\n void createSession\n .mutateAsync(embedInput)\n .then((result) => {\n if (cancelled) return;\n if (useTopWindowSso) {\n let didNavigate = false;\n try {\n didNavigate = navigateToTopWindow(result.startUrl) !== false;\n } catch {\n didNavigate = false;\n }\n setTopWindowNavigationFailed(!didNavigate);\n setEmbedUrl(didNavigate ? null : result.startUrl);\n return;\n }\n setEmbedUrl(result.startUrl);\n })\n .catch((cause: unknown) => {\n if (cancelled) return;\n const error = cause instanceof Error ? cause : new Error(String(cause));\n if (useWorkspaceSso) {\n // An SSO-enabled pane must never fall back to the child app's\n // unauthenticated shell. Keep the parent-owned retry surface in\n // place so a transient exchange failure cannot expose another\n // login form.\n setIsDirectFallback(false);\n setEmbedUrl(null);\n setEmbedError(error);\n if (useTopWindowSso) setTopWindowNavigationFailed(true);\n return;\n }\n setIsDirectFallback(true);\n setEmbedUrl(\n workspaceAppDirectHref(\n { path: app.path ?? \"\", url: app.url },\n initialPath ?? embedPath ?? \"/\",\n ),\n );\n setEmbedError(error);\n });\n return () => {\n cancelled = true;\n };\n }, [\n app.id,\n app.path,\n app.url,\n createEmbedSession.mutateAsync,\n createWorkspaceSsoEmbedSession.mutateAsync,\n embedInput,\n embedPath,\n initialPath,\n embedAttempt,\n openInTopWindow,\n navigateToTopWindow,\n topWindowSsoAttemptKey,\n topWindowNavigationFailed,\n useWorkspaceSso,\n ]);\n\n useEffect(() => {\n const handleEmbedSessionExpired = (event: MessageEvent) => {\n if (\n !isEmbedSessionExpiredMessage(event, embedFrameRef.current, embedUrl)\n ) {\n return;\n }\n setEmbedAttempt((attempt) => attempt + 1);\n };\n\n window.addEventListener(\"message\", handleEmbedSessionExpired);\n return () =>\n window.removeEventListener(\"message\", handleEmbedSessionExpired);\n }, [embedUrl]);\n\n useEffect(() => {\n if (!onChildRouteChange || !embedUrl) return;\n\n const frame = embedFrameRef.current;\n if (!frame) return;\n\n let expectedOrigin: string;\n try {\n expectedOrigin = new URL(embedUrl, window.location.href).origin;\n } catch {\n return;\n }\n\n const handleWorkspaceAppRoute = (event: MessageEvent) => {\n if (\n event.source !== frame.contentWindow ||\n event.origin !== expectedOrigin\n ) {\n return;\n }\n const message = event.data as {\n type?: unknown;\n path?: unknown;\n } | null;\n if (\n message?.type !== AGENT_NATIVE_WORKSPACE_APP_ROUTE_MESSAGE_TYPE ||\n typeof message.path !== \"string\"\n ) {\n return;\n }\n\n const route = workspaceAppRouteForChildPath(\n { id: app.id, path: app.path ?? \"\", url: app.url },\n message.path,\n );\n if (route) onChildRouteChange(route);\n };\n\n window.addEventListener(\"message\", handleWorkspaceAppRoute);\n return () => window.removeEventListener(\"message\", handleWorkspaceAppRoute);\n }, [app.id, app.path, app.url, embedUrl, onChildRouteChange]);\n\n useEffect(() => {\n postThemeToFrame();\n }, [embedUrl, postThemeToFrame]);\n\n const appPane = (\n <ChatFirstAppPane\n app={app}\n status={\n embedUrl\n ? \"ready\"\n : embedError\n ? \"error\"\n : embedInput\n ? \"loading\"\n : \"unresolved\"\n }\n embedUrl={embedUrl}\n errorMessage={embedError?.message}\n onRetry={\n embedInput ? () => setEmbedAttempt((attempt) => attempt + 1) : undefined\n }\n renderEmbed={({ url, title }) => (\n <iframe\n key={url + \":\" + embedAttempt}\n data-dispatch-workspace-app-frame\n src={url}\n title={title ?? app.name}\n ref={embedFrameRef}\n onLoad={handleFrameLoad}\n referrerPolicy=\"no-referrer\"\n allow=\"clipboard-read; clipboard-write\"\n className=\"h-full w-full border-0 bg-background\"\n />\n )}\n copy={copy}\n />\n );\n\n if (!chatSidebar) return appPane;\n\n return (\n <WorkspaceAppChatRail appId={app.id} appName={app.name} copy={copy}>\n {appPane}\n </WorkspaceAppChatRail>\n );\n}\n\nexport function WorkspaceAppHost({\n appId,\n navigateToTopWindow = navigateToWorkspaceApp,\n initialPath,\n onChildRouteChange,\n}: {\n appId?: string;\n navigateToTopWindow?: (href: string) => boolean | void;\n initialPath?: string;\n onChildRouteChange?: (path: string) => void;\n}) {\n const t = useT();\n const workspaceAppsQuery = useActionQuery<WorkspaceAppSummary[]>(\n \"list-workspace-apps\",\n { includeAgentCards: false, includeArchived: true },\n );\n const workspaceApps = useMemo(\n () => mergeChatFirstWorkspaceApps(workspaceAppsQuery.data),\n [workspaceAppsQuery.data],\n );\n const visibleWorkspaceApps = useMemo(\n () => workspaceApps.filter((item) => !item.archived),\n [workspaceApps],\n );\n const workspaceAppIds = useMemo(\n () => new Set(workspaceApps.map((item) => item.id.trim().toLowerCase())),\n [workspaceApps],\n );\n const workspaceApp = useMemo(\n () =>\n visibleWorkspaceApps.find(\n (item) => item.id.trim().toLowerCase() === appId?.trim().toLowerCase(),\n ) ?? null,\n [appId, visibleWorkspaceApps],\n );\n const grantedAppsQuery = useActionQuery<GrantedWorkspaceAppsResult>(\n \"list_apps\",\n {},\n {\n // Mounted workspace apps are already fully described by the workspace\n // registry. Defer the broader MCP grant/discovery scan until that\n // lookup misses; it is only needed for externally granted apps.\n enabled: !workspaceAppsQuery.isLoading && !workspaceApp,\n },\n );\n const apps = useMemo(() => {\n const merged = new Map<string, WorkspaceAppSummary>();\n\n for (const app of visibleWorkspaceApps) {\n merged.set(app.id.trim().toLowerCase(), app);\n }\n for (const app of grantedAppsQuery.data?.apps ?? []) {\n const id = app.id.trim();\n if (\n !id ||\n workspaceAppIds.has(id.toLowerCase()) ||\n merged.has(id.toLowerCase())\n ) {\n continue;\n }\n merged.set(id.toLowerCase(), {\n id,\n name: app.name.trim() || id,\n path: \"\",\n url: app.url?.trim() || null,\n status: \"ready\",\n });\n }\n\n return [...merged.values()];\n }, [grantedAppsQuery.data?.apps, visibleWorkspaceApps, workspaceAppIds]);\n const app = useMemo(\n () =>\n apps.find(\n (item) => item.id.trim().toLowerCase() === appId?.trim().toLowerCase(),\n ) ?? null,\n [appId, apps],\n );\n const isLoading = workspaceAppsQuery.isLoading || grantedAppsQuery.isLoading;\n const queryError = workspaceAppsQuery.isError\n ? workspaceAppsQuery.error\n : grantedAppsQuery.isError\n ? grantedAppsQuery.error\n : null;\n\n if (queryError && !app) {\n return (\n <div className=\"flex h-full min-h-0 items-center justify-center p-6\">\n <div className=\"w-full max-w-2xl\">\n <ActionQueryError\n error={queryError}\n onRetry={() => {\n void workspaceAppsQuery.refetch();\n void grantedAppsQuery.refetch();\n }}\n />\n </div>\n </div>\n );\n }\n\n if (isLoading && !app) {\n return (\n <div className=\"flex h-full min-h-0 items-center justify-center p-6\">\n <div className=\"w-full max-w-2xl space-y-3 rounded-xl border bg-card p-6\">\n <Skeleton className=\"h-5 w-48\" />\n <Skeleton className=\"h-4 w-full\" />\n <Skeleton className=\"h-4 w-2/3\" />\n </div>\n </div>\n );\n }\n\n if (!app) {\n return (\n <div className=\"flex h-full min-h-0 items-center justify-center p-6\">\n <div className=\"w-full max-w-2xl rounded-xl border bg-card p-6\">\n <Button asChild size=\"sm\" variant=\"ghost\" className=\"-ml-2 mb-4\">\n <Link to=\"/apps\">\n <IconArrowLeft size={15} className=\"mr-1.5\" />\n {t(\"dispatch.nav.apps\")}\n </Link>\n </Button>\n <div className=\"space-y-3\">\n <h2 className=\"text-base font-semibold text-foreground\">\n {t(\"dispatch.pages.appNotFound\")}\n </h2>\n <p className=\"text-sm text-muted-foreground\">\n {t(\"dispatch.pages.pageNotFoundDescription\")}\n </p>\n </div>\n </div>\n </div>\n );\n }\n\n if (app.status === \"pending\") {\n return (\n <div className=\"flex h-full min-h-0 items-center justify-center p-6\">\n <div className=\"w-full max-w-2xl rounded-xl border bg-card p-6\">\n <Button asChild size=\"sm\" variant=\"ghost\" className=\"-ml-2 mb-4\">\n <Link to=\"/apps\">\n <IconArrowLeft size={15} className=\"mr-1.5\" />\n {t(\"dispatch.nav.apps\")}\n </Link>\n </Button>\n <div className=\"space-y-4\">\n <div className=\"flex flex-wrap items-center gap-2\">\n <h2 className=\"text-base font-semibold text-foreground\">\n {app.name}\n </h2>\n <Badge\n variant=\"outline\"\n className=\"gap-1 border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300\"\n >\n <IconClockHour4 size={12} />\n {t(\"dispatch.pages.building\")}\n </Badge>\n </div>\n <p className=\"text-sm text-muted-foreground\">\n {t(\"dispatch.pages.appBuildingPrefix\")}{\" \"}\n <span className=\"font-mono text-foreground\">{app.path}</span>{\" \"}\n {t(\"dispatch.pages.appBuildingSuffix\")}\n </p>\n {app.builderUrl ? (\n <Button asChild>\n <a\n href={withBuilderUtmTrackingParams(app.builderUrl, {\n campaign: \"product\",\n content: \"dispatch_branch\",\n })}\n target=\"_blank\"\n rel=\"noreferrer\"\n >\n {t(\"dispatch.pages.openBuilderBranch\", {\n defaultValue: \"Open in Builder\",\n })}\n </a>\n </Button>\n ) : null}\n </div>\n </div>\n </div>\n );\n }\n\n return (\n <div\n data-dispatch-workspace-app-host\n className=\"flex h-full min-h-0 flex-col bg-background\"\n >\n <div className=\"min-h-0 flex-1 bg-muted/20\">\n <WorkspaceAppFrame\n app={app}\n navigateToTopWindow={navigateToTopWindow}\n initialPath={initialPath}\n onChildRouteChange={onChildRouteChange}\n />\n </div>\n </div>\n );\n}\n\nconst MAX_KEEP_ALIVE_APPS = 3;\n\nexport function WorkspaceAppKeepAlive({\n activeAppId,\n}: {\n activeAppId: string | null;\n}) {\n const [visitedAppIds, setVisitedAppIds] = useState<string[]>(() =>\n activeAppId ? [activeAppId] : [],\n );\n\n useEffect(() => {\n if (!activeAppId) return;\n setVisitedAppIds((current) =>\n [activeAppId, ...current.filter((appId) => appId !== activeAppId)].slice(\n 0,\n MAX_KEEP_ALIVE_APPS,\n ),\n );\n }, [activeAppId]);\n\n const renderedAppIds =\n activeAppId && !visitedAppIds.includes(activeAppId)\n ? [activeAppId, ...visitedAppIds]\n : visitedAppIds;\n\n return (\n <div\n data-dispatch-workspace-app-cache\n className={activeAppId ? \"absolute inset-0 overflow-hidden\" : \"hidden\"}\n >\n {renderedAppIds.map((appId) => {\n const active = appId === activeAppId;\n return (\n <div\n key={appId}\n data-dispatch-workspace-app-cache-entry={appId}\n aria-hidden={!active}\n className={active ? \"h-full min-h-0\" : \"hidden\"}\n >\n <WorkspaceAppHost appId={appId} />\n </div>\n );\n })}\n </div>\n );\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-native/dispatch",
|
|
3
|
-
"version": "0.31.
|
|
3
|
+
"version": "0.31.26-nightly-20260826210104",
|
|
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": {
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"tailwind-merge": "^3.5.0",
|
|
88
88
|
"vaul": "^1.1.2",
|
|
89
89
|
"zod": "^4.3.6",
|
|
90
|
-
"@agent-native/toolkit": "0.17.
|
|
90
|
+
"@agent-native/toolkit": "0.17.4-nightly-20260826210104"
|
|
91
91
|
},
|
|
92
92
|
"devDependencies": {
|
|
93
93
|
"@react-router/dev": "^8.1.0",
|
|
@@ -101,10 +101,10 @@
|
|
|
101
101
|
"typescript-7": "npm:typescript@^7.0.2",
|
|
102
102
|
"vite": "8.1.0",
|
|
103
103
|
"vitest": "^4.1.5",
|
|
104
|
-
"@agent-native/core": "0.
|
|
104
|
+
"@agent-native/core": "0.176.0-nightly-20260826210104"
|
|
105
105
|
},
|
|
106
106
|
"peerDependencies": {
|
|
107
|
-
"@agent-native/core": "
|
|
107
|
+
"@agent-native/core": "0.176.0-nightly-20260826210104",
|
|
108
108
|
"react": ">=19.2.7",
|
|
109
109
|
"react-dom": ">=19.2.7",
|
|
110
110
|
"react-router": ">=8"
|
|
@@ -49,6 +49,10 @@ import { Badge } from "./ui/badge";
|
|
|
49
49
|
import { Button } from "./ui/button";
|
|
50
50
|
import { Skeleton } from "./ui/skeleton";
|
|
51
51
|
|
|
52
|
+
// The server mint spends up to a 95s cold-boot budget waiting on a target app
|
|
53
|
+
// that is still starting; aborting sooner reports a booting app as unreachable.
|
|
54
|
+
const EMBED_SESSION_TIMEOUT_MS = 100_000;
|
|
55
|
+
|
|
52
56
|
interface EmbedSessionResult {
|
|
53
57
|
startUrl: string;
|
|
54
58
|
}
|
|
@@ -303,12 +307,14 @@ export function WorkspaceAppFrame({
|
|
|
303
307
|
EmbedSessionInput
|
|
304
308
|
>("create_embed_session", {
|
|
305
309
|
skipActionQueryInvalidation: true,
|
|
310
|
+
timeoutMs: EMBED_SESSION_TIMEOUT_MS,
|
|
306
311
|
});
|
|
307
312
|
const createWorkspaceSsoEmbedSession = useActionMutation<
|
|
308
313
|
EmbedSessionResult,
|
|
309
314
|
EmbedSessionInput
|
|
310
315
|
>("create-workspace-app-embed-session", {
|
|
311
316
|
skipActionQueryInvalidation: true,
|
|
317
|
+
timeoutMs: EMBED_SESSION_TIMEOUT_MS,
|
|
312
318
|
});
|
|
313
319
|
const appHref = workspaceAppHref({
|
|
314
320
|
id: app.id,
|