@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
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import { getConfiguredAppBasePath, getRequestContext, getRequestOrgId, getRequestUserEmail, } from "@agent-native/core/server";
|
|
2
|
+
import { discoverAgentsWithDirectoryStatus, getBuiltinAgents, } from "@agent-native/core/server/agent-discovery";
|
|
3
|
+
import { listWorkspaceApps, } from "./app-creation-store.js";
|
|
4
|
+
import { projectEnvironmentUrl, requestEnvironmentLane, } from "./environment-lane.js";
|
|
5
|
+
const CACHE_TTL_MS = 5 * 60_000;
|
|
6
|
+
const MAX_SCOPES = 64;
|
|
7
|
+
const manifests = new Map();
|
|
8
|
+
let nextRead = 0;
|
|
9
|
+
function scopeKey(ownerEmail, orgId) {
|
|
10
|
+
const context = getRequestContext();
|
|
11
|
+
if (context?.authCapability || context?.verifiedServiceIdentity)
|
|
12
|
+
return null;
|
|
13
|
+
return JSON.stringify([
|
|
14
|
+
ownerEmail.toLowerCase(),
|
|
15
|
+
orgId,
|
|
16
|
+
context?.requestOrigin,
|
|
17
|
+
context?.a2aIdentityAssurance,
|
|
18
|
+
context?.credentialScope,
|
|
19
|
+
requestEnvironmentLane(),
|
|
20
|
+
]);
|
|
21
|
+
}
|
|
22
|
+
function readSnapshot(cache, scope) {
|
|
23
|
+
if (!scope)
|
|
24
|
+
return [];
|
|
25
|
+
const snapshot = cache.get(scope);
|
|
26
|
+
return snapshot && snapshot.expiresAt > Date.now() ? snapshot.entries : [];
|
|
27
|
+
}
|
|
28
|
+
function saveSnapshot(cache, scope, started, entries) {
|
|
29
|
+
if (!scope || (cache.get(scope)?.started ?? 0) > started)
|
|
30
|
+
return;
|
|
31
|
+
cache.delete(scope);
|
|
32
|
+
cache.set(scope, { started, expiresAt: Date.now() + CACHE_TTL_MS, entries });
|
|
33
|
+
if (cache.size > MAX_SCOPES) {
|
|
34
|
+
const oldest = cache.keys().next().value;
|
|
35
|
+
if (oldest !== undefined)
|
|
36
|
+
cache.delete(oldest);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function toManifest(agent) {
|
|
40
|
+
return {
|
|
41
|
+
id: agent.id,
|
|
42
|
+
name: agent.name,
|
|
43
|
+
description: agent.description,
|
|
44
|
+
url: agent.url,
|
|
45
|
+
color: agent.color,
|
|
46
|
+
...(agent.source ? { source: agent.source } : {}),
|
|
47
|
+
...(agent.aliases?.length ? { aliases: [...agent.aliases] } : {}),
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function withFallback(fresh, cached) {
|
|
51
|
+
const known = new Set(fresh.map((agent) => agent.id.toLowerCase()));
|
|
52
|
+
return [
|
|
53
|
+
...fresh,
|
|
54
|
+
...cached.filter((agent) => !known.has(agent.id.toLowerCase())),
|
|
55
|
+
];
|
|
56
|
+
}
|
|
57
|
+
function registrationUrl(value) {
|
|
58
|
+
const projected = projectEnvironmentUrl(value);
|
|
59
|
+
if (!URL.canParse(projected))
|
|
60
|
+
return null;
|
|
61
|
+
const url = new URL(projected);
|
|
62
|
+
return (url.protocol === "https:" || url.protocol === "http:") &&
|
|
63
|
+
!url.username &&
|
|
64
|
+
!url.password &&
|
|
65
|
+
!url.search &&
|
|
66
|
+
!url.hash
|
|
67
|
+
? url
|
|
68
|
+
: null;
|
|
69
|
+
}
|
|
70
|
+
function sameInstallation(agent, mount) {
|
|
71
|
+
if (agent.id.toLowerCase() !== mount.id.toLowerCase() || !mount.url) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
const manifestUrl = registrationUrl(agent.url);
|
|
75
|
+
const currentUrl = registrationUrl(mount.url);
|
|
76
|
+
if (!manifestUrl || !currentUrl || manifestUrl.origin !== currentUrl.origin) {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
if (!mount.path.startsWith("/") ||
|
|
80
|
+
mount.path.startsWith("//") ||
|
|
81
|
+
mount.path.includes("\\") ||
|
|
82
|
+
/%(?:2f|5c)/i.test(mount.path))
|
|
83
|
+
return false;
|
|
84
|
+
const installUrl = new URL(mount.path, currentUrl.origin);
|
|
85
|
+
if (installUrl.pathname !== mount.path ||
|
|
86
|
+
installUrl.search ||
|
|
87
|
+
installUrl.hash) {
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
const trimTrailingSlash = (path) => path.replace(/\/+$/, "");
|
|
91
|
+
const manifestPath = trimTrailingSlash(manifestUrl.pathname);
|
|
92
|
+
const installPath = trimTrailingSlash(installUrl.pathname);
|
|
93
|
+
const legacyPath = `/dispatch/apps/${encodeURIComponent(mount.id)}`;
|
|
94
|
+
return (manifestPath === trimTrailingSlash(currentUrl.pathname) ||
|
|
95
|
+
manifestPath === installPath ||
|
|
96
|
+
manifestPath === legacyPath ||
|
|
97
|
+
manifestPath === `${getConfiguredAppBasePath()}${legacyPath}`);
|
|
98
|
+
}
|
|
99
|
+
async function recheckCachedInstallations(readCached, mountRead) {
|
|
100
|
+
const { mounts, degraded } = await mountRead;
|
|
101
|
+
if (degraded)
|
|
102
|
+
return [];
|
|
103
|
+
const byId = new Map(mounts.map((mount) => [mount.id.toLowerCase(), mount]));
|
|
104
|
+
return readCached().filter((agent) => {
|
|
105
|
+
const mount = byId.get(agent.id.toLowerCase());
|
|
106
|
+
return mount !== undefined && sameInstallation(agent, mount);
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
const TRANSIENT_DIRECTORY_REASONS = new Set([
|
|
110
|
+
"network",
|
|
111
|
+
"server-error",
|
|
112
|
+
"timeout",
|
|
113
|
+
]);
|
|
114
|
+
async function readAgents(scope, started, mountRead) {
|
|
115
|
+
let result;
|
|
116
|
+
try {
|
|
117
|
+
result = await discoverAgentsWithDirectoryStatus("dispatch", {
|
|
118
|
+
requireReadableAgentSources: true,
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
const httpStatus = statusFromError(error);
|
|
123
|
+
const forbidden = httpStatus === 401 || httpStatus === 403;
|
|
124
|
+
if (forbidden)
|
|
125
|
+
saveSnapshot(manifests, scope, started, []);
|
|
126
|
+
const cached = forbidden
|
|
127
|
+
? []
|
|
128
|
+
: await recheckCachedInstallations(() => readSnapshot(manifests, scope).filter((agent) => agent.source !== "builtin" && agent.source !== "org-directory"), mountRead);
|
|
129
|
+
return {
|
|
130
|
+
agents: withFallback(getBuiltinAgents("dispatch").map(toManifest), cached),
|
|
131
|
+
degraded: {
|
|
132
|
+
source: "connected-apps",
|
|
133
|
+
status: forbidden ? "forbidden" : "unavailable",
|
|
134
|
+
usingCache: cached.length > 0,
|
|
135
|
+
...(httpStatus ? { httpStatus } : {}),
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
const agents = result.agents.map(toManifest);
|
|
140
|
+
const directory = result.directory;
|
|
141
|
+
if (directory.status === "unavailable" || directory.status === "forbidden") {
|
|
142
|
+
const reason = directory.status === "unavailable" ? directory.reason : "authorization";
|
|
143
|
+
const forbidden = reason === "authentication" ||
|
|
144
|
+
reason === "unauthorized" ||
|
|
145
|
+
reason === "authorization";
|
|
146
|
+
const transient = TRANSIENT_DIRECTORY_REASONS.has(reason);
|
|
147
|
+
const current = agents.filter((agent) => agent.source !== "org-directory");
|
|
148
|
+
const cached = transient
|
|
149
|
+
? await recheckCachedInstallations(() => readSnapshot(manifests, scope).filter((agent) => agent.source === "org-directory"), mountRead)
|
|
150
|
+
: [];
|
|
151
|
+
if (!transient)
|
|
152
|
+
saveSnapshot(manifests, scope, started, current);
|
|
153
|
+
return {
|
|
154
|
+
agents: withFallback(current, cached),
|
|
155
|
+
degraded: {
|
|
156
|
+
source: "workspace-directory",
|
|
157
|
+
status: forbidden ? "forbidden" : "unavailable",
|
|
158
|
+
usingCache: cached.length > 0,
|
|
159
|
+
},
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
const available = directory.status === "available"
|
|
163
|
+
? agents
|
|
164
|
+
: agents.filter((agent) => agent.source !== "org-directory");
|
|
165
|
+
saveSnapshot(manifests, scope, started, available);
|
|
166
|
+
return { agents: available, degraded: undefined };
|
|
167
|
+
}
|
|
168
|
+
function statusFromError(error) {
|
|
169
|
+
const seen = new Set();
|
|
170
|
+
let current = error;
|
|
171
|
+
let firstStatus;
|
|
172
|
+
while (current && typeof current === "object" && !seen.has(current)) {
|
|
173
|
+
seen.add(current);
|
|
174
|
+
for (const key of ["statusCode", "status", "code"]) {
|
|
175
|
+
const status = current[key];
|
|
176
|
+
if (status === 401 || status === 403)
|
|
177
|
+
return status;
|
|
178
|
+
if (firstStatus === undefined &&
|
|
179
|
+
typeof status === "number" &&
|
|
180
|
+
status >= 400 &&
|
|
181
|
+
status <= 599) {
|
|
182
|
+
firstStatus = status;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
current = "cause" in current ? current.cause : undefined;
|
|
186
|
+
}
|
|
187
|
+
return firstStatus;
|
|
188
|
+
}
|
|
189
|
+
async function readMounts() {
|
|
190
|
+
try {
|
|
191
|
+
const apps = await listWorkspaceApps({ includeAgentCards: false });
|
|
192
|
+
return {
|
|
193
|
+
mounts: apps
|
|
194
|
+
.filter((app) => app.status !== "pending")
|
|
195
|
+
.map(({ id, url, path }) => ({ id, url, path })),
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
catch (error) {
|
|
199
|
+
const httpStatus = statusFromError(error);
|
|
200
|
+
return {
|
|
201
|
+
mounts: [],
|
|
202
|
+
degraded: {
|
|
203
|
+
source: "workspace-mounts",
|
|
204
|
+
status: httpStatus === 401 || httpStatus === 403
|
|
205
|
+
? "forbidden"
|
|
206
|
+
: "unavailable",
|
|
207
|
+
usingCache: false,
|
|
208
|
+
...(httpStatus ? { httpStatus } : {}),
|
|
209
|
+
},
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
export async function discoverDispatchMcpApps() {
|
|
214
|
+
const ownerEmail = getRequestUserEmail();
|
|
215
|
+
if (!ownerEmail)
|
|
216
|
+
throw new Error("no authenticated user");
|
|
217
|
+
const orgId = getRequestOrgId();
|
|
218
|
+
const scope = scopeKey(ownerEmail, orgId);
|
|
219
|
+
const started = ++nextRead;
|
|
220
|
+
const mountRead = readMounts();
|
|
221
|
+
const [agents, mounts] = await Promise.all([
|
|
222
|
+
readAgents(scope, started, mountRead),
|
|
223
|
+
mountRead,
|
|
224
|
+
]);
|
|
225
|
+
const degradedSources = [agents.degraded, mounts.degraded].filter((source) => source !== undefined);
|
|
226
|
+
for (const source of degradedSources) {
|
|
227
|
+
console.warn("[dispatch] MCP app discovery degraded", source);
|
|
228
|
+
}
|
|
229
|
+
return { agents: agents.agents, mountedApps: mounts.mounts, degradedSources };
|
|
230
|
+
}
|
|
231
|
+
//# sourceMappingURL=mcp-app-discovery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-app-discovery.js","sourceRoot":"","sources":["../../../src/server/lib/mcp-app-discovery.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,iBAAiB,EACjB,eAAe,EACf,mBAAmB,GACpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,iCAAiC,EACjC,gBAAgB,GAEj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AC,uBAAuB,CAAC,CAAC;IAC1D,MAAM,KAAK,GAAG,eAAe,EAAE,CAAC;IAChC,MAAM,KAAK,GAAG,QAAQ,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IAC1C,MAAM,OAAO,GAAG,EAAE,QAAQ,CAAC;IAC3B,MAAM,SAAS,GAAG,UAAU,EAAE,CAAC;IAC/B,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QACzC,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,CAAC;QACrC,SAAS;KACV,CAAC,CAAC;IACH,MAAM,eAAe,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,MAAM,CAC/D,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,KAAK,SAAS,CACjC,CAAC;IACF,KAAK,MAAM,MAAM,IAAI,eAAe,EAAE,CAAC;QACrC,OAAO,CAAC,IAAI,CAAC,uCAAuC,EAAE,MAAM,CAAC,CAAC;IAChE,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,EAAE,CAAC;AAChF,CAAC","sourcesContent":["import {\n getConfiguredAppBasePath,\n getRequestContext,\n getRequestOrgId,\n getRequestUserEmail,\n} from \"@agent-native/core/server\";\nimport {\n discoverAgentsWithDirectoryStatus,\n getBuiltinAgents,\n type DiscoveredAgent,\n} from \"@agent-native/core/server/agent-discovery\";\n\nimport {\n listWorkspaceApps,\n type WorkspaceAppSummary,\n} from \"./app-creation-store.js\";\nimport {\n projectEnvironmentUrl,\n requestEnvironmentLane,\n} from \"./environment-lane.js\";\n\nconst CACHE_TTL_MS = 5 * 60_000;\nconst MAX_SCOPES = 64;\n\nexport interface DispatchMcpDegradedSource {\n source: \"connected-apps\" | \"workspace-directory\" | \"workspace-mounts\";\n status: \"unavailable\" | \"forbidden\";\n usingCache: boolean;\n httpStatus?: number;\n}\n\ntype WorkspaceMount = Pick<WorkspaceAppSummary, \"id\" | \"url\" | \"path\">;\ntype AgentManifest = Pick<\n DiscoveredAgent,\n \"id\" | \"name\" | \"description\" | \"url\" | \"color\" | \"source\" | \"aliases\"\n>;\ntype Snapshot<T> = { started: number; expiresAt: number; entries: T[] };\ntype Cache<T> = Map<string, Snapshot<T>>;\nconst manifests: Cache<AgentManifest> = new Map();\nlet nextRead = 0;\n\nfunction scopeKey(ownerEmail: string, orgId: string | undefined) {\n const context = getRequestContext();\n if (context?.authCapability || context?.verifiedServiceIdentity) return null;\n return JSON.stringify([\n ownerEmail.toLowerCase(),\n orgId,\n context?.requestOrigin,\n context?.a2aIdentityAssurance,\n context?.credentialScope,\n requestEnvironmentLane(),\n ]);\n}\n\nfunction readSnapshot<T>(cache: Cache<T>, scope: string | null): T[] {\n if (!scope) return [];\n const snapshot = cache.get(scope);\n return snapshot && snapshot.expiresAt > Date.now() ? snapshot.entries : [];\n}\n\nfunction saveSnapshot<T>(\n cache: Cache<T>,\n scope: string | null,\n started: number,\n entries: T[],\n) {\n if (!scope || (cache.get(scope)?.started ?? 0) > started) return;\n cache.delete(scope);\n cache.set(scope, { started, expiresAt: Date.now() + CACHE_TTL_MS, entries });\n if (cache.size > MAX_SCOPES) {\n const oldest = cache.keys().next().value;\n if (oldest !== undefined) cache.delete(oldest);\n }\n}\n\nfunction toManifest(agent: DiscoveredAgent): AgentManifest {\n return {\n id: agent.id,\n name: agent.name,\n description: agent.description,\n url: agent.url,\n color: agent.color,\n ...(agent.source ? { source: agent.source } : {}),\n ...(agent.aliases?.length ? { aliases: [...agent.aliases] } : {}),\n };\n}\n\nfunction withFallback(\n fresh: AgentManifest[],\n cached: AgentManifest[],\n): AgentManifest[] {\n const known = new Set(fresh.map((agent) => agent.id.toLowerCase()));\n return [\n ...fresh,\n ...cached.filter((agent) => !known.has(agent.id.toLowerCase())),\n ];\n}\n\nfunction registrationUrl(value: string): URL | null {\n const projected = projectEnvironmentUrl(value);\n if (!URL.canParse(projected)) return null;\n const url = new URL(projected);\n return (url.protocol === \"https:\" || url.protocol === \"http:\") &&\n !url.username &&\n !url.password &&\n !url.search &&\n !url.hash\n ? url\n : null;\n}\n\nfunction sameInstallation(agent: AgentManifest, mount: WorkspaceMount) {\n if (agent.id.toLowerCase() !== mount.id.toLowerCase() || !mount.url) {\n return false;\n }\n const manifestUrl = registrationUrl(agent.url);\n const currentUrl = registrationUrl(mount.url);\n if (!manifestUrl || !currentUrl || manifestUrl.origin !== currentUrl.origin) {\n return false;\n }\n\n if (\n !mount.path.startsWith(\"/\") ||\n mount.path.startsWith(\"//\") ||\n mount.path.includes(\"\\\\\") ||\n /%(?:2f|5c)/i.test(mount.path)\n )\n return false;\n const installUrl = new URL(mount.path, currentUrl.origin);\n if (\n installUrl.pathname !== mount.path ||\n installUrl.search ||\n installUrl.hash\n ) {\n return false;\n }\n\n const trimTrailingSlash = (path: string) => path.replace(/\\/+$/, \"\");\n const manifestPath = trimTrailingSlash(manifestUrl.pathname);\n const installPath = trimTrailingSlash(installUrl.pathname);\n const legacyPath = `/dispatch/apps/${encodeURIComponent(mount.id)}`;\n return (\n manifestPath === trimTrailingSlash(currentUrl.pathname) ||\n manifestPath === installPath ||\n manifestPath === legacyPath ||\n manifestPath === `${getConfiguredAppBasePath()}${legacyPath}`\n );\n}\n\ntype MountRead = Awaited<ReturnType<typeof readMounts>>;\n\nasync function recheckCachedInstallations(\n readCached: () => AgentManifest[],\n mountRead: Promise<MountRead>,\n) {\n const { mounts, degraded } = await mountRead;\n if (degraded) return [];\n const byId = new Map(mounts.map((mount) => [mount.id.toLowerCase(), mount]));\n return readCached().filter((agent) => {\n const mount = byId.get(agent.id.toLowerCase());\n return mount !== undefined && sameInstallation(agent, mount);\n });\n}\n\nconst TRANSIENT_DIRECTORY_REASONS = new Set([\n \"network\",\n \"server-error\",\n \"timeout\",\n]);\n\nasync function readAgents(\n scope: string | null,\n started: number,\n mountRead: Promise<MountRead>,\n) {\n let result: Awaited<ReturnType<typeof discoverAgentsWithDirectoryStatus>>;\n try {\n result = await discoverAgentsWithDirectoryStatus(\"dispatch\", {\n requireReadableAgentSources: true,\n });\n } catch (error) {\n const httpStatus = statusFromError(error);\n const forbidden = httpStatus === 401 || httpStatus === 403;\n if (forbidden) saveSnapshot(manifests, scope, started, []);\n const cached = forbidden\n ? []\n : await recheckCachedInstallations(\n () =>\n readSnapshot(manifests, scope).filter(\n (agent) =>\n agent.source !== \"builtin\" && agent.source !== \"org-directory\",\n ),\n mountRead,\n );\n return {\n agents: withFallback(\n getBuiltinAgents(\"dispatch\").map(toManifest),\n cached,\n ),\n degraded: {\n source: \"connected-apps\",\n status: forbidden ? \"forbidden\" : \"unavailable\",\n usingCache: cached.length > 0,\n ...(httpStatus ? { httpStatus } : {}),\n } satisfies DispatchMcpDegradedSource,\n };\n }\n\n const agents = result.agents.map(toManifest);\n const directory = result.directory;\n if (directory.status === \"unavailable\" || directory.status === \"forbidden\") {\n const reason =\n directory.status === \"unavailable\" ? directory.reason : \"authorization\";\n const forbidden =\n reason === \"authentication\" ||\n reason === \"unauthorized\" ||\n reason === \"authorization\";\n const transient = TRANSIENT_DIRECTORY_REASONS.has(reason);\n const current = agents.filter((agent) => agent.source !== \"org-directory\");\n const cached = transient\n ? await recheckCachedInstallations(\n () =>\n readSnapshot(manifests, scope).filter(\n (agent) => agent.source === \"org-directory\",\n ),\n mountRead,\n )\n : [];\n if (!transient) saveSnapshot(manifests, scope, started, current);\n return {\n agents: withFallback(current, cached),\n degraded: {\n source: \"workspace-directory\",\n status: forbidden ? \"forbidden\" : \"unavailable\",\n usingCache: cached.length > 0,\n } satisfies DispatchMcpDegradedSource,\n };\n }\n\n const available =\n directory.status === \"available\"\n ? agents\n : agents.filter((agent) => agent.source !== \"org-directory\");\n saveSnapshot(manifests, scope, started, available);\n return { agents: available, degraded: undefined };\n}\n\nfunction statusFromError(error: unknown): number | undefined {\n const seen = new Set<object>();\n let current: unknown = error;\n let firstStatus: number | undefined;\n while (current && typeof current === \"object\" && !seen.has(current)) {\n seen.add(current);\n for (const key of [\"statusCode\", \"status\", \"code\"] as const) {\n const status = (current as Record<string, unknown>)[key];\n if (status === 401 || status === 403) return status;\n if (\n firstStatus === undefined &&\n typeof status === \"number\" &&\n status >= 400 &&\n status <= 599\n ) {\n firstStatus = status;\n }\n }\n current = \"cause\" in current ? current.cause : undefined;\n }\n return firstStatus;\n}\n\nasync function readMounts() {\n try {\n const apps = await listWorkspaceApps({ includeAgentCards: false });\n return {\n mounts: apps\n .filter((app) => app.status !== \"pending\")\n .map(({ id, url, path }) => ({ id, url, path })),\n };\n } catch (error) {\n const httpStatus = statusFromError(error);\n return {\n mounts: [],\n degraded: {\n source: \"workspace-mounts\",\n status:\n httpStatus === 401 || httpStatus === 403\n ? \"forbidden\"\n : \"unavailable\",\n usingCache: false,\n ...(httpStatus ? { httpStatus } : {}),\n } satisfies DispatchMcpDegradedSource,\n };\n }\n}\n\nexport async function discoverDispatchMcpApps(): Promise<{\n agents: AgentManifest[];\n mountedApps: WorkspaceMount[];\n degradedSources: DispatchMcpDegradedSource[];\n}> {\n const ownerEmail = getRequestUserEmail();\n if (!ownerEmail) throw new Error(\"no authenticated user\");\n const orgId = getRequestOrgId();\n const scope = scopeKey(ownerEmail, orgId);\n const started = ++nextRead;\n const mountRead = readMounts();\n const [agents, mounts] = await Promise.all([\n readAgents(scope, started, mountRead),\n mountRead,\n ]);\n const degradedSources = [agents.degraded, mounts.degraded].filter(\n (source) => source !== undefined,\n );\n for (const source of degradedSources) {\n console.warn(\"[dispatch] MCP app discovery degraded\", source);\n }\n return { agents: agents.agents, mountedApps: mounts.mounts, degradedSources };\n}\n"]}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
import { type AppCapabilityManifest } from "@agent-native/core";
|
|
1
2
|
import { type A2APersistedMutationReceipt, type Task } from "@agent-native/core/a2a";
|
|
3
|
+
import { type ViewportMode } from "@agent-native/core/server";
|
|
4
|
+
import { type DiscoveredAgent } from "@agent-native/core/server/agent-discovery";
|
|
2
5
|
import { type DispatchMcpAppAccessSettings } from "./mcp-access-store.js";
|
|
6
|
+
import { type DispatchMcpDegradedSource } from "./mcp-app-discovery.js";
|
|
3
7
|
export interface DispatchMcpAccessibleApp {
|
|
4
8
|
id: string;
|
|
5
9
|
name: string;
|
|
@@ -7,16 +11,25 @@ export interface DispatchMcpAccessibleApp {
|
|
|
7
11
|
url: string;
|
|
8
12
|
homeUrl?: string;
|
|
9
13
|
mcpUrl?: string;
|
|
14
|
+
workspaceMount?: boolean;
|
|
10
15
|
color: string;
|
|
16
|
+
source?: DiscoveredAgent["source"];
|
|
17
|
+
aliases?: string[];
|
|
11
18
|
granted: boolean;
|
|
12
19
|
mountedPathUnavailable?: boolean;
|
|
20
|
+
manifest?: AppCapabilityManifest;
|
|
13
21
|
}
|
|
22
|
+
/** Registers or clears a parsed capability manifest for a granted app id. */
|
|
23
|
+
export declare function registerGrantedAppManifest(appId: string, manifest: unknown): AppCapabilityManifest | undefined;
|
|
24
|
+
/** Clears cached granted app capability manifests. */
|
|
25
|
+
export declare function clearGrantedAppManifestCache(): void;
|
|
14
26
|
type DispatchMutationReceipt = A2APersistedMutationReceipt;
|
|
15
27
|
type DispatchAskAppStatusErrorCategory = "transport" | "timeout" | "upstream_5xx" | "rate_limited";
|
|
16
28
|
type DispatchAskAppTaskResult = {
|
|
17
29
|
app: string;
|
|
18
30
|
routedVia: "a2a";
|
|
19
31
|
taskId: string;
|
|
32
|
+
taskHandle?: string;
|
|
20
33
|
status: string;
|
|
21
34
|
response?: string;
|
|
22
35
|
receipts?: DispatchMutationReceipt[];
|
|
@@ -32,6 +45,7 @@ type DispatchAskAppTaskResult = {
|
|
|
32
45
|
arguments: {
|
|
33
46
|
app: string;
|
|
34
47
|
taskId: string;
|
|
48
|
+
taskHandle?: string;
|
|
35
49
|
};
|
|
36
50
|
};
|
|
37
51
|
message?: string;
|
|
@@ -40,10 +54,17 @@ declare function dispatchAskAppTaskResult(app: string, task: Task, identity: {
|
|
|
40
54
|
userEmail: string;
|
|
41
55
|
orgId: string | null;
|
|
42
56
|
orgSecret: string | null;
|
|
43
|
-
}): DispatchAskAppTaskResult;
|
|
57
|
+
}, taskHandle?: string): DispatchAskAppTaskResult;
|
|
58
|
+
export declare function appHomeBaseUrl(app: Pick<DispatchMcpAccessibleApp, "url" | "homeUrl">): string;
|
|
59
|
+
export declare function joinAppBaseUrlAndPath(baseUrl: string, relPath: string): string;
|
|
44
60
|
export declare function listDispatchMcpApps(): Promise<{
|
|
45
61
|
settings: DispatchMcpAppAccessSettings;
|
|
46
62
|
apps: DispatchMcpAccessibleApp[];
|
|
63
|
+
degradedSources: DispatchMcpDegradedSource[];
|
|
64
|
+
}>;
|
|
65
|
+
export declare function listGrantedDispatchMcpAppsWithStatus(): Promise<{
|
|
66
|
+
apps: DispatchMcpAccessibleApp[];
|
|
67
|
+
degradedSources: DispatchMcpDegradedSource[];
|
|
47
68
|
}>;
|
|
48
69
|
export declare function listGrantedDispatchMcpApps(): Promise<DispatchMcpAccessibleApp[]>;
|
|
49
70
|
export declare function listGrantedDispatchMcpAppOrigins(): Promise<string[]>;
|
|
@@ -51,20 +72,29 @@ export declare function resolveGrantedDispatchMcpApp(app: string): Promise<Dispa
|
|
|
51
72
|
export declare function askGrantedDispatchMcpApp(app: string, message: string, options?: {
|
|
52
73
|
async?: boolean;
|
|
53
74
|
maxWaitMs?: number;
|
|
75
|
+
viewportMode?: ViewportMode;
|
|
54
76
|
}): Promise<ReturnType<typeof dispatchAskAppTaskResult>>;
|
|
55
|
-
export declare function getGrantedDispatchMcpAppTask(app: string, taskId: string
|
|
77
|
+
export declare function getGrantedDispatchMcpAppTask(app: string, taskId: string, options?: {
|
|
78
|
+
taskHandle?: string;
|
|
79
|
+
}): Promise<DispatchAskAppTaskResult>;
|
|
56
80
|
export declare function openGrantedDispatchMcpApp(input: {
|
|
57
81
|
app: string;
|
|
82
|
+
screen?: string | undefined;
|
|
58
83
|
view?: string | undefined;
|
|
59
84
|
path?: string | undefined;
|
|
60
85
|
params?: Record<string, string | number | boolean> | undefined;
|
|
86
|
+
focus?: boolean | undefined;
|
|
61
87
|
embed?: boolean | undefined;
|
|
62
88
|
chrome?: "full" | "minimal" | undefined;
|
|
89
|
+
}, options?: {
|
|
90
|
+
prefetchEmbed: boolean;
|
|
63
91
|
}): Promise<{
|
|
64
92
|
app: string;
|
|
93
|
+
screen?: string;
|
|
65
94
|
view?: string;
|
|
66
95
|
path?: string;
|
|
67
96
|
url: string;
|
|
97
|
+
focus?: boolean;
|
|
68
98
|
embed?: boolean;
|
|
69
99
|
chrome?: "full" | "minimal";
|
|
70
100
|
embedStartUrl?: string;
|
|
@@ -77,6 +107,7 @@ export type GrantedAppAction = {
|
|
|
77
107
|
description: string;
|
|
78
108
|
inputSchema?: Record<string, unknown>;
|
|
79
109
|
readOnly?: boolean;
|
|
110
|
+
destructive?: boolean;
|
|
80
111
|
};
|
|
81
112
|
export type GrantedAppActionResult = {
|
|
82
113
|
isError?: boolean;
|
|
@@ -104,18 +135,33 @@ export type DispatchAppActionHeaderProvider = (request: DispatchAppActionRequest
|
|
|
104
135
|
*/
|
|
105
136
|
export declare function setDispatchAppActionHeaderProvider(provider: DispatchAppActionHeaderProvider): () => void;
|
|
106
137
|
export declare function listGrantedDispatchMcpAppActions(app: string, names?: string[]): Promise<GrantedAppAction[]>;
|
|
107
|
-
export declare function callGrantedDispatchMcpAppAction(app: string, action: string, args: Record<string, unknown
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}): Promise<{
|
|
114
|
-
startUrl: string;
|
|
138
|
+
export declare function callGrantedDispatchMcpAppAction(app: string, action: string, args: Record<string, unknown>, options?: {
|
|
139
|
+
viewportMode?: ViewportMode;
|
|
140
|
+
}): Promise<GrantedAppActionResult>;
|
|
141
|
+
type InternalEmbedSession = {
|
|
142
|
+
startUrl?: string;
|
|
143
|
+
chatToken?: string;
|
|
115
144
|
targetPath?: string;
|
|
145
|
+
childBrowserTabId?: string;
|
|
116
146
|
expiresAt?: number;
|
|
117
147
|
app: string;
|
|
118
|
-
|
|
148
|
+
appBaseUrl: string;
|
|
149
|
+
};
|
|
150
|
+
declare function publicEmbedSession({ startUrl, targetPath, childBrowserTabId, expiresAt, app, }: InternalEmbedSession): {
|
|
151
|
+
startUrl: string;
|
|
152
|
+
targetPath?: string | undefined;
|
|
153
|
+
childBrowserTabId?: string | undefined;
|
|
154
|
+
expiresAt?: number | undefined;
|
|
155
|
+
app: string;
|
|
156
|
+
};
|
|
157
|
+
export declare function createGrantedDispatchMcpEmbedSession(input: {
|
|
158
|
+
app?: string | undefined;
|
|
159
|
+
url?: string | undefined;
|
|
160
|
+
path?: string | undefined;
|
|
161
|
+
chrome?: "full" | "minimal" | undefined;
|
|
162
|
+
}, options?: {
|
|
163
|
+
bindBrowserTab: boolean;
|
|
164
|
+
}): Promise<ReturnType<typeof publicEmbedSession>>;
|
|
119
165
|
export declare function createGrantedDispatchMcpEmbedSessionForWorkspaceAppChat(appId: string): Promise<{
|
|
120
166
|
token: string;
|
|
121
167
|
appBaseUrl: string;
|
|
@@ -123,16 +169,13 @@ export declare function createGrantedDispatchMcpEmbedSessionForWorkspaceAppChat(
|
|
|
123
169
|
expiresAt: number;
|
|
124
170
|
}>;
|
|
125
171
|
export declare function createWorkspaceSsoEmbedSession(input: {
|
|
126
|
-
app?: string;
|
|
127
|
-
url?: string;
|
|
128
|
-
path?: string;
|
|
129
|
-
chrome?: "full" | "minimal";
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
expiresAt?: number;
|
|
134
|
-
app: string;
|
|
135
|
-
}>;
|
|
172
|
+
app?: string | undefined;
|
|
173
|
+
url?: string | undefined;
|
|
174
|
+
path?: string | undefined;
|
|
175
|
+
chrome?: "full" | "minimal" | undefined;
|
|
176
|
+
}, options?: {
|
|
177
|
+
bindBrowserTab: boolean;
|
|
178
|
+
}): Promise<ReturnType<typeof publicEmbedSession>>;
|
|
136
179
|
export declare function createWorkspaceSsoEmbedSessionForWorkspaceAppChat(appId: string): Promise<{
|
|
137
180
|
token: string;
|
|
138
181
|
appBaseUrl: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-gateway.d.ts","sourceRoot":"","sources":["../../../src/server/lib/mcp-gateway.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mcp-gateway.d.ts","sourceRoot":"","sources":["../../../src/server/lib/mcp-gateway.ts"],"names":[],"mappings":"AAQA,OAAO,EAIL,KAAK,qBAAqB,EAC3B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EASL,KAAK,2BAA2B,EAChC,KAAK,IAAI,EACV,MAAM,wBAAwB,CAAC;AAYhC,OAAO,EAaL,KAAK,YAAY,EAClB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,2CAA2C,CAAC;AAgBnD,OAAO,EAGL,KAAK,4BAA4B,EAClC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAEL,KAAK,yBAAyB,EAC/B,MAAM,wBAAwB,CAAC;AAiPhC,MAAM,WAAW,wBAAwB;IACvC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,eAAe,CAAC,QAAQ,CAAC,CAAC;IACnC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,EAAE,qBAAqB,CAAC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