@agent-native/dispatch 0.40.30 → 0.40.31
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 +9 -13
- package/dist/actions/list-connected-agents.js +7 -3
- package/dist/actions/list-connected-agents.js.map +1 -1
- package/dist/actions/list-workspace-connections.d.ts.map +1 -1
- package/dist/actions/list-workspace-connections.js +13 -18
- package/dist/actions/list-workspace-connections.js.map +1 -1
- package/dist/components/action-query-error.d.ts +2 -1
- package/dist/components/action-query-error.d.ts.map +1 -1
- package/dist/components/action-query-error.js +25 -2
- package/dist/components/action-query-error.js.map +1 -1
- package/dist/components/chat-home-apps.d.ts.map +1 -1
- package/dist/components/chat-home-apps.js +2 -2
- package/dist/components/chat-home-apps.js.map +1 -1
- package/dist/components/dispatch-control-plane.d.ts.map +1 -1
- package/dist/components/dispatch-control-plane.js +1 -1
- package/dist/components/dispatch-control-plane.js.map +1 -1
- package/dist/components/layout/Layout.d.ts +1 -0
- package/dist/components/layout/Layout.d.ts.map +1 -1
- package/dist/components/layout/Layout.js +7 -0
- package/dist/components/layout/Layout.js.map +1 -1
- package/dist/routes/pages/$appId.d.ts.map +1 -1
- package/dist/routes/pages/$appId.js +1 -1
- package/dist/routes/pages/$appId.js.map +1 -1
- package/dist/routes/pages/apps.js +1 -1
- package/dist/routes/pages/apps.js.map +1 -1
- package/dist/server/lib/app-creation-store.d.ts.map +1 -1
- package/dist/server/lib/app-creation-store.js +122 -54
- package/dist/server/lib/app-creation-store.js.map +1 -1
- package/package.json +3 -3
- package/src/actions/list-connected-agents.spec.ts +17 -1
- package/src/actions/list-connected-agents.ts +7 -2
- package/src/actions/list-workspace-connections.spec.ts +14 -3
- package/src/actions/list-workspace-connections.ts +13 -17
- package/src/components/action-query-error.spec.tsx +20 -0
- package/src/components/action-query-error.tsx +40 -0
- package/src/components/chat-home-apps.spec.tsx +32 -1
- package/src/components/chat-home-apps.tsx +6 -1
- package/src/components/dispatch-control-plane.tsx +1 -0
- package/src/components/layout/Layout.tsx +9 -0
- package/src/routes/pages/$appId.tsx +1 -0
- package/src/routes/pages/apps.spec.tsx +26 -2
- package/src/routes/pages/apps.tsx +2 -0
- package/src/server/lib/app-creation-store.spec.ts +281 -5
- package/src/server/lib/app-creation-store.ts +172 -60
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @agent-native/dispatch
|
|
2
2
|
|
|
3
|
+
## 0.40.31
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Release all public npm packages with a patch version bump.
|
|
8
|
+
- b697ec4: Use organization-scoped secrets for workspace app registry authentication and show which Dispatch query failed.
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
- @agent-native/toolkit@0.212.1
|
|
11
|
+
|
|
3
12
|
## 0.40.30
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -1294,17 +1303,4 @@
|
|
|
1294
1303
|
|
|
1295
1304
|
- 96ecc13: Use compact app search and pin labels that stay on one line.
|
|
1296
1305
|
|
|
1297
|
-
## 0.29.0
|
|
1298
|
-
|
|
1299
|
-
### Minor Changes
|
|
1300
|
-
|
|
1301
|
-
- 772f59a: Point the chat beside an open workspace app at that app's own agent. Dispatch now proxies `/_agent-native/workspace-app-chat/<appId>/**` to the app's `/_agent-native/agent-chat`, authenticated with the app's own embed session, so the rail has the app's tools, AGENTS.md, skills, app-scoped resources, and dev-mode surface instead of Dispatch's. When the proxy cannot be established the rail shows a retryable error rather than silently answering from Dispatch's agent, and workspace-level chat with no app open is unchanged.
|
|
1302
|
-
|
|
1303
|
-
### Patch Changes
|
|
1304
|
-
|
|
1305
|
-
- 772f59a: Allow workspace members to update mounted app names and descriptions from Dispatch.
|
|
1306
|
-
- 772f59a: Report the embedded workspace app to the Dispatch agent as structured context. `/apps/<id>` now resolves to a `workspace-app` navigation view that keeps the app id and in-app path instead of collapsing to the apps list, and `view-screen` emits an `embeddedApp` block for both that route and chat-first mode, where the route stays on `/chat` and the open app is named only by `chat-first-pane` state. An app that is open but cannot be identified reports `status: "unknown"` rather than a default or an omitted field.
|
|
1307
|
-
- 772f59a: Share the canonical localized authentication copy with native sign-in surfaces
|
|
1308
|
-
and allow authenticated packaged callers to mint workspace embed sessions.
|
|
1309
|
-
|
|
1310
1306
|
For the full list of releases, see the [changelog archive](./changelog/archive/CHANGELOG.md).
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineAction } from "@agent-native/core/action";
|
|
1
|
+
import { defineAction, fail } from "@agent-native/core/action";
|
|
2
2
|
import { REMOTE_AGENT_RESOURCE_PREFIXES, parseRemoteAgentManifest, } from "@agent-native/core/resources/metadata";
|
|
3
3
|
import { resourceGet, resourceListAccessible, SHARED_OWNER, } from "@agent-native/core/resources/store";
|
|
4
4
|
import { getRequestUserEmail } from "@agent-native/core/server";
|
|
@@ -21,8 +21,12 @@ export default defineAction({
|
|
|
21
21
|
const builtinIds = new Set(builtins.map((agent) => agent.id).filter((id) => !workspaceIds.has(id)));
|
|
22
22
|
const builtinHomeUrls = new Map(builtins.map((agent) => [agent.id, agent.url]));
|
|
23
23
|
const ownerEmail = getRequestUserEmail();
|
|
24
|
-
if (!ownerEmail)
|
|
25
|
-
|
|
24
|
+
if (!ownerEmail) {
|
|
25
|
+
fail("Sign in to list connected agents.", {
|
|
26
|
+
errorCode: "dispatch_user_identity_missing",
|
|
27
|
+
statusCode: 401,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
26
30
|
const resources = [];
|
|
27
31
|
for (const prefix of [...REMOTE_AGENT_RESOURCE_PREFIXES].reverse()) {
|
|
28
32
|
resources.push(...(await resourceListAccessible(ownerEmail, prefix)));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-connected-agents.js","sourceRoot":"","sources":["../../src/actions/list-connected-agents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"list-connected-agents.js","sourceRoot":"","sources":["../../src/actions/list-connected-agents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EACL,8BAA8B,EAC9B,wBAAwB,GACzB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACL,WAAW,EACX,sBAAsB,EACtB,YAAY,GACb,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,uBAAuB,EACvB,yBAAyB,EACzB,gBAAgB,EAChB,gCAAgC,GACjC,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAe,YAAY,CAAC;IAC1B,WAAW,EACT,4GAA4G;IAC9G,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;IACpB,IAAI,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;IACvB,GAAG,EAAE,KAAK,IAAI,EAAE;QACd,MAAM,EAAE,cAAc,GAAG,EAAE,EAAE,GAAG,MAAM,MAAM,CAAC,oBAAoB,CAAC,CAAC,IAAI,CACrE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAC7B,CAAC;QACF,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YACpD,cAAc,CAAC,UAAU,CAAC;YAC1B,yBAAyB,EAAE;SAC5B,CAAC,CAAC;QACH,uEAAuE;QACvE,uCAAuC;QACvC,MAAM,YAAY,GAAG,IAAI,GAAG,CAC1B,CAAC,aAAa,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAC7D,CAAC;QACF,MAAM,QA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AAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW;gBAC/D,UAAU,EAAE,MAAM,EAAE,UAAU;gBAC9B,IAAI,EAAE,MAAM,EAAE,IAAI;gBAClB,KAAK,EAAE,MAAM,EAAE,KAAK;aACrB,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;QAClE,KAAK,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,IAAI,UAAU,EAAE,CAAC;YACtC,IAAI,aAAa,CAAC,GAAG,CAAC,EAAE,CAAC;gBAAE,SAAS;YACpC,SAAS,CAAC,IAAI,CAAC;gBACb,EAAE;gBACF,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,WAAW,EAAE,MAAM,CAAC,WAAW;gBAC/B,GAAG,EAAE,MAAM,CAAC,GAAG;gBACf,KAAK,EAAE,MAAM,CAAC,KAAK;gBACnB,MAAM,EAAE,QAAQ;gBAChB,UAAU,EAAE,MAAM,CAAC,UAAU;gBAC7B,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,KAAK,EAAE,MAAM,CAAC,KAAK;aACpB,CAAC,CAAC;QACL,CAAC;QAED,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACjE,CAAC;CACF,CAAC,CAAC","sourcesContent":["import { defineAction, fail } from \"@agent-native/core/action\";\nimport {\n REMOTE_AGENT_RESOURCE_PREFIXES,\n parseRemoteAgentManifest,\n} from \"@agent-native/core/resources/metadata\";\nimport {\n resourceGet,\n resourceListAccessible,\n SHARED_OWNER,\n} from \"@agent-native/core/resources/store\";\nimport { getRequestUserEmail } from \"@agent-native/core/server\";\nimport {\n discoverAgents,\n getBuiltinAgents,\n isBuiltinAgentCatalogId,\n loadWorkspaceAppsManifest,\n normalizeAgentId,\n shouldIncludeRemoteAgentManifest,\n} from \"@agent-native/core/server/agent-discovery\";\nimport { z } from \"zod\";\n\nexport default defineAction({\n description:\n \"List agents available to dispatch for A2A delegation, including built-in apps and connected remote agents.\",\n schema: z.object({}),\n http: { method: \"GET\" },\n run: async () => {\n const { hiddenAgentIds = [] } = await import(\"../server/index.js\").then(\n (m) => m.getDispatchConfig(),\n );\n const [discovered, workspaceApps] = await Promise.all([\n discoverAgents(\"dispatch\"),\n loadWorkspaceAppsManifest(),\n ]);\n // A mounted workspace app with a built-in's id is a workspace app; the\n // built-in config never applies to it.\n const workspaceIds = new Set(\n (workspaceApps ?? []).map((app) => normalizeAgentId(app.id)),\n );\n const builtins = getBuiltinAgents(\"dispatch\");\n const builtinIds = new Set(\n builtins.map((agent) => agent.id).filter((id) => !workspaceIds.has(id)),\n );\n const builtinHomeUrls = new Map(\n builtins.map((agent) => [agent.id, agent.url]),\n );\n const ownerEmail = getRequestUserEmail();\n if (!ownerEmail) {\n fail(\"Sign in to list connected agents.\", {\n errorCode: \"dispatch_user_identity_missing\",\n statusCode: 401,\n });\n }\n const resources: Array<{ id: string; path: string; owner: string }> = [];\n for (const prefix of [...REMOTE_AGENT_RESOURCE_PREFIXES].reverse()) {\n resources.push(...(await resourceListAccessible(ownerEmail, prefix)));\n }\n const customById = new Map<\n string,\n {\n resourceId: string;\n path: string;\n scope: \"shared\" | \"personal\";\n name: string;\n description: string;\n url: string;\n color: string;\n }\n >();\n\n for (const resource of resources) {\n if (!resource.path.endsWith(\".json\")) continue;\n const full = await resourceGet(resource.id);\n if (!full) continue;\n const manifest = parseRemoteAgentManifest(full.content, resource.path);\n if (!manifest) continue;\n if (!shouldIncludeRemoteAgentManifest(manifest, \"dispatch\")) continue;\n const manifestId = normalizeAgentId(manifest.id);\n // Built-in ids stay under the workspace's built-in config even when a\n // seeded manifest for them exists in resources.\n if (isBuiltinAgentCatalogId(manifestId)) continue;\n customById.set(manifestId, {\n resourceId: resource.id,\n path: resource.path,\n scope: resource.owner === SHARED_OWNER ? \"shared\" : \"personal\",\n name: manifest.name,\n description: manifest.description || \"\",\n url: manifest.url,\n color: manifest.color || \"#6B7280\",\n });\n }\n\n const connected = discovered.map((agent) => {\n const custom = customById.get(agent.id);\n const isBuiltin = builtinIds.has(agent.id);\n const homeUrl = isBuiltin ? builtinHomeUrls.get(agent.id) : undefined;\n return {\n ...agent,\n ...(homeUrl ? { homeUrl } : {}),\n source: isBuiltin ? \"builtin\" : custom ? \"custom\" : \"workspace\",\n resourceId: custom?.resourceId,\n path: custom?.path,\n scope: custom?.scope,\n };\n });\n\n const discoveredIds = new Set(connected.map((agent) => agent.id));\n for (const [id, custom] of customById) {\n if (discoveredIds.has(id)) continue;\n connected.push({\n id,\n name: custom.name,\n description: custom.description,\n url: custom.url,\n color: custom.color,\n source: \"custom\",\n resourceId: custom.resourceId,\n path: custom.path,\n scope: custom.scope,\n });\n }\n\n return connected.filter((a) => !hiddenAgentIds.includes(a.id));\n },\n});\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-workspace-connections.d.ts","sourceRoot":"","sources":["../../src/actions/list-workspace-connections.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,6BAA6B,EAClC,KAAK,8BAA8B,EACpC,MAAM,gCAAgC,CAAC;AA2BxC,KAAK,QAAQ,GAAG;IACd,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AASF,KAAK,YAAY,GAAG;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,UAAU,GAAG,cAAc,GAAG,gBAAgB,CAAC;IACvD,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B,CAAC;AAEF,KAAK,uBAAuB,GAAG,YAAY,GAAG,cAAc,GAAG,aAAa,CAAC;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"list-workspace-connections.d.ts","sourceRoot":"","sources":["../../src/actions/list-workspace-connections.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,6BAA6B,EAClC,KAAK,8BAA8B,EACpC,MAAM,gCAAgC,CAAC;AA2BxC,KAAK,QAAQ,GAAG;IACd,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AASF,KAAK,YAAY,GAAG;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,UAAU,GAAG,cAAc,GAAG,gBAAgB,CAAC;IACvD,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B,CAAC;AAEF,KAAK,uBAAuB,GAAG,YAAY,GAAG,cAAc,GAAG,aAAa,CAAC;;;;;;;;;QAsOrE,WAAW;YACT,MAAM;YACN,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QASX,SAAS;QACT,WAAW;QACX,MAAM;QACN,iBAAiB;QAEjB,sBAAsB;QAGtB,cAAc"}
|
|
@@ -39,24 +39,19 @@ async function listGrantApps() {
|
|
|
39
39
|
const listWorkspaceApps = dispatchActions["list-workspace-apps"];
|
|
40
40
|
if (!listWorkspaceApps)
|
|
41
41
|
return [{ id: "dispatch", label: "Dispatch" }];
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
: [{ id: "dispatch", label: "Dispatch" }];
|
|
56
|
-
}
|
|
57
|
-
catch {
|
|
58
|
-
return [{ id: "dispatch", label: "Dispatch" }];
|
|
59
|
-
}
|
|
42
|
+
const apps = (await listWorkspaceApps.run({
|
|
43
|
+
includeAgentCards: false,
|
|
44
|
+
audience: "all",
|
|
45
|
+
}));
|
|
46
|
+
const grantApps = apps
|
|
47
|
+
.filter((app) => !app.archived && app.status !== "pending")
|
|
48
|
+
.map((app) => ({
|
|
49
|
+
id: app.id,
|
|
50
|
+
label: app.name || humanizeAppId(app.id),
|
|
51
|
+
}));
|
|
52
|
+
return grantApps.length > 0
|
|
53
|
+
? grantApps
|
|
54
|
+
: [{ id: "dispatch", label: "Dispatch" }];
|
|
60
55
|
}
|
|
61
56
|
export default defineAction({
|
|
62
57
|
description: "List the workspace integration provider catalog, saved shared connections, and app access grants.",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-workspace-connections.js","sourceRoot":"","sources":["../../src/actions/list-workspace-connections.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EACL,gCAAgC,GAGjC,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,eAAe,EACf,sBAAsB,GACvB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,+BAA+B,EAC/B,oCAAoC,EACpC,8BAA8B,GAC/B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,+BAA+B,EAC/B,6BAA6B,EAC7B,+BAA+B,EAC/B,6CAA6C,GAC9C,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,WAAW,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,EAAE;IACzC,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5C,MAAM,UAAU,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cAAc,EAAE,sBAAsB,CAAC,MAAM,CAC3C,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,MAAM,KAAK,OAAO,CACpD,CAAC,MAAM;aACT;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import { defineAction } from \"@agent-native/core/action\";\nimport {\n listWorkspaceConnectionProviders,\n type WorkspaceConnectionCapability,\n type WorkspaceConnectionTemplateUse,\n} from \"@agent-native/core/connections\";\nimport {\n isProviderApiId,\n listProviderApiCatalog,\n} from \"@agent-native/core/provider-api\";\nimport {\n CredentialStoreUnavailableError,\n hasWorkspaceProviderOAuthCredentials,\n isGoogleWorkspaceOAuthProvider,\n} from \"@agent-native/core/server\";\nimport {\n getWorkspaceConnectionAppAccess,\n listWorkspaceConnectionGrants,\n listWorkspaceConnectionsForUser,\n summarizeWorkspaceConnectionProviderReadiness,\n} from \"@agent-native/core/workspace-connections\";\nimport { dispatchActions } from \"@agent-native/dispatch/actions\";\nimport { z } from \"zod\";\n\nconst httpBoolean = z.preprocess((value) => {\n if (typeof value !== \"string\") return value;\n const normalized = value.trim().toLowerCase();\n if ([\"true\", \"1\", \"yes\", \"on\"].includes(normalized)) return true;\n if ([\"false\", \"0\", \"no\", \"off\"].includes(normalized)) return false;\n return value;\n}, z.boolean());\n\ntype GrantApp = {\n id: string;\n label: string;\n};\n\ntype WorkspaceApp = {\n id: string;\n name?: string;\n status?: \"ready\" | \"pending\";\n archived?: boolean;\n};\n\ntype GrantSummary = {\n id: string;\n connectionId: string;\n provider: string;\n appId: string;\n access: \"all-apps\" | \"selected-app\" | \"explicit-grant\";\n lastUsedAt?: string | null;\n};\n\ntype GoogleOAuthAvailability = \"configured\" | \"unconfigured\" | \"unavailable\";\n\nfunction unique(values: string[]) {\n return Array.from(\n new Set(values.map((value) => value.trim()).filter(Boolean)),\n );\n}\n\nfunction optionalTimestamp(source: object, key: string) {\n if (!Object.prototype.hasOwnProperty.call(source, key)) return undefined;\n const value = (source as Record<string, unknown>)[key];\n if (value == null) return null;\n if (value instanceof Date) return value.toISOString();\n return typeof value === \"string\" ? value : (JSON.stringify(value) ?? \"\");\n}\n\nfunction humanizeAppId(appId: string): string {\n return appId\n .split(/[-_]/)\n .filter(Boolean)\n .map((part) => part.charAt(0).toUpperCase() + part.slice(1))\n .join(\" \");\n}\n\nasync function listGrantApps(): Promise<GrantApp[]> {\n const listWorkspaceApps = dispatchActions[\"list-workspace-apps\"];\n if (!listWorkspaceApps) return [{ id: \"dispatch\", label: \"Dispatch\" }];\n\n try {\n const apps = (await listWorkspaceApps.run({\n includeAgentCards: false,\n audience: \"all\",\n } as any)) as WorkspaceApp[];\n const grantApps = apps\n .filter((app) => !app.archived && app.status !== \"pending\")\n .map((app) => ({\n id: app.id,\n label: app.name || humanizeAppId(app.id),\n }));\n return grantApps.length > 0\n ? grantApps\n : [{ id: \"dispatch\", label: \"Dispatch\" }];\n } catch {\n return [{ id: \"dispatch\", label: \"Dispatch\" }];\n }\n}\n\nexport default defineAction({\n description:\n \"List the workspace integration provider catalog, saved shared connections, and app access grants.\",\n schema: z.object({\n provider: z\n .string()\n .optional()\n .describe(\"Optional provider ID such as slack, github, or notion.\"),\n appId: z\n .string()\n .optional()\n .describe(\"Only include connections available to this app ID.\"),\n includeDisabled: httpBoolean\n .default(false)\n .describe(\"Include disabled connections. Defaults to false.\"),\n capability: z\n .string()\n .optional()\n .describe(\"Optional capability filter such as search, import, or docs.\"),\n templateUse: z\n .string()\n .optional()\n .describe(\"Optional template-use filter such as brain or analytics.\"),\n }),\n http: { method: \"GET\" },\n run: async (args) => {\n const catalogProviders = listWorkspaceConnectionProviders({\n capability: args.capability as WorkspaceConnectionCapability | undefined,\n templateUse: args.templateUse as\n | WorkspaceConnectionTemplateUse\n | undefined,\n });\n let googleOAuthAvailability: GoogleOAuthAvailability;\n try {\n googleOAuthAvailability = (await hasWorkspaceProviderOAuthCredentials(\n \"gmail\",\n ))\n ? \"configured\"\n : \"unconfigured\";\n } catch (error) {\n if (!(error instanceof CredentialStoreUnavailableError)) throw error;\n googleOAuthAvailability = \"unavailable\";\n }\n const googleOAuthConfigured = googleOAuthAvailability === \"configured\";\n const providers = catalogProviders.filter(\n (provider) =>\n (!args.provider || provider.id === args.provider) &&\n (googleOAuthConfigured || !isGoogleWorkspaceOAuthProvider(provider.id)),\n );\n const allConnections = await listWorkspaceConnectionsForUser({\n provider: args.provider,\n appId: args.appId,\n includeDisabled: args.includeDisabled,\n });\n const connections = allConnections.filter(\n (connection) =>\n googleOAuthConfigured ||\n !isGoogleWorkspaceOAuthProvider(connection.provider),\n );\n const allExplicitGrants = await listWorkspaceConnectionGrants({\n provider: args.provider,\n appId: args.appId,\n });\n const visibleConnectionIds = new Set(\n connections.map((connection) => connection.id),\n );\n const explicitGrants = allExplicitGrants.filter(\n (grant) =>\n visibleConnectionIds.has(grant.connectionId) &&\n (googleOAuthConfigured ||\n !isGoogleWorkspaceOAuthProvider(grant.provider)),\n );\n const grantApps = await listGrantApps();\n const legacyGrants = connections.flatMap<GrantSummary>((connection) => {\n if (connection.allowedApps.length === 0) {\n return [\n {\n id: `${connection.id}:all-apps`,\n connectionId: connection.id,\n provider: connection.provider,\n appId: \"*\",\n access: \"all-apps\" as const,\n },\n ];\n }\n return connection.allowedApps.map(\n (appId): GrantSummary => ({\n id: `${connection.id}:${appId}`,\n connectionId: connection.id,\n provider: connection.provider,\n appId,\n access: \"selected-app\" as const,\n }),\n );\n });\n const grants: GrantSummary[] = [\n ...legacyGrants,\n ...explicitGrants.map((grant) => {\n const lastUsedAt = optionalTimestamp(grant, \"lastUsedAt\");\n return {\n id: grant.id,\n connectionId: grant.connectionId,\n provider: grant.provider,\n appId: grant.appId,\n access: \"explicit-grant\" as const,\n ...(lastUsedAt !== undefined ? { lastUsedAt } : {}),\n };\n }),\n ];\n const grantSummaries = connections.map((connection) => {\n const explicitGrantAppIds = unique(\n explicitGrants\n .filter((grant) => grant.connectionId === connection.id)\n .map((grant) => grant.appId),\n );\n const selectedAppIds = unique(connection.allowedApps);\n const allApps = selectedAppIds.length === 0;\n const effectiveAppIds = allApps\n ? [\"*\"]\n : unique([...selectedAppIds, ...explicitGrantAppIds]);\n\n return {\n connectionId: connection.id,\n provider: connection.provider,\n accessMode: allApps\n ? (\"all-apps\" as const)\n : (\"selected-apps\" as const),\n allApps,\n selectedAppIds,\n explicitGrantAppIds,\n effectiveAppIds,\n trackedApps: grantApps.map((app) => {\n const access = getWorkspaceConnectionAppAccess(\n connection,\n app.id,\n explicitGrants,\n );\n return {\n appId: app.id,\n label: app.label,\n granted: access.available,\n mode: access.mode,\n grantId: access.grantId,\n };\n }),\n };\n });\n\n const providersWithReadiness = providers.map((provider) => {\n const providerApi = isProviderApiId(provider.id)\n ? listProviderApiCatalog(provider.id)[0]\n : null;\n return {\n ...provider,\n readiness: summarizeWorkspaceConnectionProviderReadiness({\n provider,\n connections,\n grants: explicitGrants,\n appId: args.appId,\n includeConnections: \"all\",\n }),\n rawProviderApi: providerApi\n ? {\n available: true,\n actionNames: [\n \"provider-api-catalog\",\n \"provider-api-docs\",\n \"provider-api-request\",\n ],\n docsUrls: providerApi.docsUrls,\n specUrls: providerApi.specUrls,\n auth: providerApi.auth,\n examples: providerApi.examples,\n }\n : {\n available: false,\n actionNames: [],\n docsUrls: [],\n specUrls: [],\n auth: null,\n examples: [],\n },\n };\n });\n\n return {\n availability: {\n googleOAuth: {\n status: googleOAuthAvailability,\n retryable: googleOAuthAvailability === \"unavailable\",\n },\n },\n providers: providersWithReadiness,\n connections,\n grants,\n grantSummaries,\n suggestedApps: grantApps,\n counts: {\n providers: providersWithReadiness.length,\n connections: connections.length,\n grants: grants.length,\n allAppConnections: grantSummaries.filter((summary) => summary.allApps)\n .length,\n selectedAppConnections: grantSummaries.filter(\n (summary) => !summary.allApps,\n ).length,\n readyProviders: providersWithReadiness.filter(\n (provider) => provider.readiness.status === \"ready\",\n ).length,\n },\n };\n },\n});\n"]}
|
|
1
|
+
{"version":3,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BACX,MAAM,EAAE,uBAAuB;oBAC/B,SAAS,EAAE,uBAAuB,KAAK,aAAa;iBACrD;aACF;YACD,SAAS,EAAE,sBAAsB;YACjC,WAAW;YACX,MAAM;YACN,cAAc;YACd,aAAa,EAAE,SAAS;YACxB,MAAM,EAAE;gBACN,SAAS,EAAE,sBAAsB,CAAC,MAAM;gBACxC,WAAW,EAAE,WAAW,CAAC,MAAM;gBAC/B,MAAM,EAAE,MAAM,CAAC,MAAM;gBACrB,iBAAiB,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC;qBACnE,MAAM;gBACT,sBAAsB,EAAE,cAAc,CAAC,MAAM,CAC3C,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAC9B,CAAC,MAAM;gBACR,cAAc,EAAE,sBAAsB,CAAC,MAAM,CAC3C,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,MAAM,KAAK,OAAO,CACpD,CAAC,MAAM;aACT;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import { defineAction } from \"@agent-native/core/action\";\nimport {\n listWorkspaceConnectionProviders,\n type WorkspaceConnectionCapability,\n type WorkspaceConnectionTemplateUse,\n} from \"@agent-native/core/connections\";\nimport {\n isProviderApiId,\n listProviderApiCatalog,\n} from \"@agent-native/core/provider-api\";\nimport {\n CredentialStoreUnavailableError,\n hasWorkspaceProviderOAuthCredentials,\n isGoogleWorkspaceOAuthProvider,\n} from \"@agent-native/core/server\";\nimport {\n getWorkspaceConnectionAppAccess,\n listWorkspaceConnectionGrants,\n listWorkspaceConnectionsForUser,\n summarizeWorkspaceConnectionProviderReadiness,\n} from \"@agent-native/core/workspace-connections\";\nimport { dispatchActions } from \"@agent-native/dispatch/actions\";\nimport { z } from \"zod\";\n\nconst httpBoolean = z.preprocess((value) => {\n if (typeof value !== \"string\") return value;\n const normalized = value.trim().toLowerCase();\n if ([\"true\", \"1\", \"yes\", \"on\"].includes(normalized)) return true;\n if ([\"false\", \"0\", \"no\", \"off\"].includes(normalized)) return false;\n return value;\n}, z.boolean());\n\ntype GrantApp = {\n id: string;\n label: string;\n};\n\ntype WorkspaceApp = {\n id: string;\n name?: string;\n status?: \"ready\" | \"pending\";\n archived?: boolean;\n};\n\ntype GrantSummary = {\n id: string;\n connectionId: string;\n provider: string;\n appId: string;\n access: \"all-apps\" | \"selected-app\" | \"explicit-grant\";\n lastUsedAt?: string | null;\n};\n\ntype GoogleOAuthAvailability = \"configured\" | \"unconfigured\" | \"unavailable\";\n\nfunction unique(values: string[]) {\n return Array.from(\n new Set(values.map((value) => value.trim()).filter(Boolean)),\n );\n}\n\nfunction optionalTimestamp(source: object, key: string) {\n if (!Object.prototype.hasOwnProperty.call(source, key)) return undefined;\n const value = (source as Record<string, unknown>)[key];\n if (value == null) return null;\n if (value instanceof Date) return value.toISOString();\n return typeof value === \"string\" ? value : (JSON.stringify(value) ?? \"\");\n}\n\nfunction humanizeAppId(appId: string): string {\n return appId\n .split(/[-_]/)\n .filter(Boolean)\n .map((part) => part.charAt(0).toUpperCase() + part.slice(1))\n .join(\" \");\n}\n\nasync function listGrantApps(): Promise<GrantApp[]> {\n const listWorkspaceApps = dispatchActions[\"list-workspace-apps\"];\n if (!listWorkspaceApps) return [{ id: \"dispatch\", label: \"Dispatch\" }];\n\n const apps = (await listWorkspaceApps.run({\n includeAgentCards: false,\n audience: \"all\",\n } as any)) as WorkspaceApp[];\n const grantApps = apps\n .filter((app) => !app.archived && app.status !== \"pending\")\n .map((app) => ({\n id: app.id,\n label: app.name || humanizeAppId(app.id),\n }));\n return grantApps.length > 0\n ? grantApps\n : [{ id: \"dispatch\", label: \"Dispatch\" }];\n}\n\nexport default defineAction({\n description:\n \"List the workspace integration provider catalog, saved shared connections, and app access grants.\",\n schema: z.object({\n provider: z\n .string()\n .optional()\n .describe(\"Optional provider ID such as slack, github, or notion.\"),\n appId: z\n .string()\n .optional()\n .describe(\"Only include connections available to this app ID.\"),\n includeDisabled: httpBoolean\n .default(false)\n .describe(\"Include disabled connections. Defaults to false.\"),\n capability: z\n .string()\n .optional()\n .describe(\"Optional capability filter such as search, import, or docs.\"),\n templateUse: z\n .string()\n .optional()\n .describe(\"Optional template-use filter such as brain or analytics.\"),\n }),\n http: { method: \"GET\" },\n run: async (args) => {\n const catalogProviders = listWorkspaceConnectionProviders({\n capability: args.capability as WorkspaceConnectionCapability | undefined,\n templateUse: args.templateUse as\n | WorkspaceConnectionTemplateUse\n | undefined,\n });\n let googleOAuthAvailability: GoogleOAuthAvailability;\n try {\n googleOAuthAvailability = (await hasWorkspaceProviderOAuthCredentials(\n \"gmail\",\n ))\n ? \"configured\"\n : \"unconfigured\";\n } catch (error) {\n if (!(error instanceof CredentialStoreUnavailableError)) throw error;\n googleOAuthAvailability = \"unavailable\";\n }\n const googleOAuthConfigured = googleOAuthAvailability === \"configured\";\n const providers = catalogProviders.filter(\n (provider) =>\n (!args.provider || provider.id === args.provider) &&\n (googleOAuthConfigured || !isGoogleWorkspaceOAuthProvider(provider.id)),\n );\n const allConnections = await listWorkspaceConnectionsForUser({\n provider: args.provider,\n appId: args.appId,\n includeDisabled: args.includeDisabled,\n });\n const connections = allConnections.filter(\n (connection) =>\n googleOAuthConfigured ||\n !isGoogleWorkspaceOAuthProvider(connection.provider),\n );\n const allExplicitGrants = await listWorkspaceConnectionGrants({\n provider: args.provider,\n appId: args.appId,\n });\n const visibleConnectionIds = new Set(\n connections.map((connection) => connection.id),\n );\n const explicitGrants = allExplicitGrants.filter(\n (grant) =>\n visibleConnectionIds.has(grant.connectionId) &&\n (googleOAuthConfigured ||\n !isGoogleWorkspaceOAuthProvider(grant.provider)),\n );\n const grantApps = await listGrantApps();\n const legacyGrants = connections.flatMap<GrantSummary>((connection) => {\n if (connection.allowedApps.length === 0) {\n return [\n {\n id: `${connection.id}:all-apps`,\n connectionId: connection.id,\n provider: connection.provider,\n appId: \"*\",\n access: \"all-apps\" as const,\n },\n ];\n }\n return connection.allowedApps.map(\n (appId): GrantSummary => ({\n id: `${connection.id}:${appId}`,\n connectionId: connection.id,\n provider: connection.provider,\n appId,\n access: \"selected-app\" as const,\n }),\n );\n });\n const grants: GrantSummary[] = [\n ...legacyGrants,\n ...explicitGrants.map((grant) => {\n const lastUsedAt = optionalTimestamp(grant, \"lastUsedAt\");\n return {\n id: grant.id,\n connectionId: grant.connectionId,\n provider: grant.provider,\n appId: grant.appId,\n access: \"explicit-grant\" as const,\n ...(lastUsedAt !== undefined ? { lastUsedAt } : {}),\n };\n }),\n ];\n const grantSummaries = connections.map((connection) => {\n const explicitGrantAppIds = unique(\n explicitGrants\n .filter((grant) => grant.connectionId === connection.id)\n .map((grant) => grant.appId),\n );\n const selectedAppIds = unique(connection.allowedApps);\n const allApps = selectedAppIds.length === 0;\n const effectiveAppIds = allApps\n ? [\"*\"]\n : unique([...selectedAppIds, ...explicitGrantAppIds]);\n\n return {\n connectionId: connection.id,\n provider: connection.provider,\n accessMode: allApps\n ? (\"all-apps\" as const)\n : (\"selected-apps\" as const),\n allApps,\n selectedAppIds,\n explicitGrantAppIds,\n effectiveAppIds,\n trackedApps: grantApps.map((app) => {\n const access = getWorkspaceConnectionAppAccess(\n connection,\n app.id,\n explicitGrants,\n );\n return {\n appId: app.id,\n label: app.label,\n granted: access.available,\n mode: access.mode,\n grantId: access.grantId,\n };\n }),\n };\n });\n\n const providersWithReadiness = providers.map((provider) => {\n const providerApi = isProviderApiId(provider.id)\n ? listProviderApiCatalog(provider.id)[0]\n : null;\n return {\n ...provider,\n readiness: summarizeWorkspaceConnectionProviderReadiness({\n provider,\n connections,\n grants: explicitGrants,\n appId: args.appId,\n includeConnections: \"all\",\n }),\n rawProviderApi: providerApi\n ? {\n available: true,\n actionNames: [\n \"provider-api-catalog\",\n \"provider-api-docs\",\n \"provider-api-request\",\n ],\n docsUrls: providerApi.docsUrls,\n specUrls: providerApi.specUrls,\n auth: providerApi.auth,\n examples: providerApi.examples,\n }\n : {\n available: false,\n actionNames: [],\n docsUrls: [],\n specUrls: [],\n auth: null,\n examples: [],\n },\n };\n });\n\n return {\n availability: {\n googleOAuth: {\n status: googleOAuthAvailability,\n retryable: googleOAuthAvailability === \"unavailable\",\n },\n },\n providers: providersWithReadiness,\n connections,\n grants,\n grantSummaries,\n suggestedApps: grantApps,\n counts: {\n providers: providersWithReadiness.length,\n connections: connections.length,\n grants: grants.length,\n allAppConnections: grantSummaries.filter((summary) => summary.allApps)\n .length,\n selectedAppConnections: grantSummaries.filter(\n (summary) => !summary.allApps,\n ).length,\n readyProviders: providersWithReadiness.filter(\n (provider) => provider.readiness.status === \"ready\",\n ).length,\n },\n };\n },\n});\n"]}
|
|
@@ -2,7 +2,8 @@ interface ActionQueryErrorProps {
|
|
|
2
2
|
error?: unknown;
|
|
3
3
|
onRetry: () => unknown;
|
|
4
4
|
className?: string;
|
|
5
|
+
queryName?: string;
|
|
5
6
|
}
|
|
6
|
-
export declare function ActionQueryError({ onRetry, className, }: ActionQueryErrorProps): import("node_modules/@types/react").JSX.Element;
|
|
7
|
+
export declare function ActionQueryError({ error, onRetry, className, queryName, }: ActionQueryErrorProps): import("node_modules/@types/react").JSX.Element;
|
|
7
8
|
export {};
|
|
8
9
|
//# sourceMappingURL=action-query-error.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action-query-error.d.ts","sourceRoot":"","sources":["../../src/components/action-query-error.tsx"],"names":[],"mappings":"AAMA,UAAU,qBAAqB;IAC7B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;
|
|
1
|
+
{"version":3,"file":"action-query-error.d.ts","sourceRoot":"","sources":["../../src/components/action-query-error.tsx"],"names":[],"mappings":"AAMA,UAAU,qBAAqB;IAC7B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAiCD,wBAAgB,gBAAgB,CAAC,EAC/B,KAAK,EACL,OAAO,EACP,SAAS,EACT,SAAS,GACV,EAAE,qBAAqB,mDAsBvB"}
|
|
@@ -3,8 +3,31 @@ import { useT } from "@agent-native/core/client/i18n";
|
|
|
3
3
|
import { IconAlertTriangle, IconRefresh } from "@tabler/icons-react";
|
|
4
4
|
import { Alert, AlertDescription, AlertTitle } from "./ui/alert.js";
|
|
5
5
|
import { Button } from "./ui/button.js";
|
|
6
|
-
|
|
6
|
+
function actionQueryDiagnostic(error, queryName) {
|
|
7
|
+
const parts = [];
|
|
8
|
+
if (queryName)
|
|
9
|
+
parts.push(queryName);
|
|
10
|
+
if (error && typeof error === "object") {
|
|
11
|
+
const details = error;
|
|
12
|
+
const status = typeof details.statusCode === "number"
|
|
13
|
+
? details.statusCode
|
|
14
|
+
: details.status;
|
|
15
|
+
if (typeof status === "number" &&
|
|
16
|
+
Number.isInteger(status) &&
|
|
17
|
+
status >= 100 &&
|
|
18
|
+
status <= 599) {
|
|
19
|
+
parts.push(`HTTP ${status}`);
|
|
20
|
+
}
|
|
21
|
+
const code = details.errorCode ?? details.code;
|
|
22
|
+
if (typeof code === "string" && /^[a-zA-Z0-9_.-]{1,80}$/.test(code)) {
|
|
23
|
+
parts.push(code);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return parts.length > 0 ? parts.join(" · ") : null;
|
|
27
|
+
}
|
|
28
|
+
export function ActionQueryError({ error, onRetry, className, queryName, }) {
|
|
7
29
|
const t = useT();
|
|
8
|
-
|
|
30
|
+
const diagnostic = actionQueryDiagnostic(error, queryName);
|
|
31
|
+
return (_jsxs(Alert, { variant: "destructive", className: className, children: [_jsx(IconAlertTriangle, { className: "size-4" }), _jsx(AlertTitle, { children: t("dispatch.pages.dataLoadFailed") }), _jsxs(AlertDescription, { className: "flex flex-wrap items-center justify-between gap-3", children: [_jsx("span", { children: t("dispatch.pages.dataLoadFailedDescription") }), diagnostic ? (_jsx("code", { className: "w-full break-all text-xs text-muted-foreground", children: diagnostic })) : null, _jsxs(Button, { type: "button", variant: "outline", size: "sm", onClick: onRetry, children: [_jsx(IconRefresh, { className: "size-4" }), t("dispatch.pages.tryAgain")] })] })] }));
|
|
9
32
|
}
|
|
10
33
|
//# sourceMappingURL=action-query-error.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action-query-error.js","sourceRoot":"","sources":["../../src/components/action-query-error.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAErE,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"action-query-error.js","sourceRoot":"","sources":["../../src/components/action-query-error.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAErE,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AASrC,SAAS,qBAAqB,CAC5B,KAAc,EACd,SAA6B;IAE7B,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI,SAAS;QAAE,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAErC,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACvC,MAAM,OAAO,GAAG,KAAgC,CAAC;QACjD,MAAM,MAAM,GACV,OAAO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gD,YAC7D,UAAU,GACN,CACR,CAAC,CAAC,CAAC,IAAI,EACR,MAAC,MAAM,IAAC,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAC,SAAS,EAAC,IAAI,EAAC,IAAI,EAAC,OAAO,EAAE,OAAO,aAChE,KAAC,WAAW,IAAC,SAAS,EAAC,QAAQ,GAAG,EACjC,CAAC,CAAC,yBAAyB,CAAC,IACtB,IACQ,IACb,CACT,CAAC;AACJ,CAAC","sourcesContent":["import { useT } from \"@agent-native/core/client/i18n\";\nimport { IconAlertTriangle, IconRefresh } from \"@tabler/icons-react\";\n\nimport { Alert, AlertDescription, AlertTitle } from \"./ui/alert\";\nimport { Button } from \"./ui/button\";\n\ninterface ActionQueryErrorProps {\n error?: unknown;\n onRetry: () => unknown;\n className?: string;\n queryName?: string;\n}\n\nfunction actionQueryDiagnostic(\n error: unknown,\n queryName: string | undefined,\n): string | null {\n const parts: string[] = [];\n if (queryName) parts.push(queryName);\n\n if (error && typeof error === \"object\") {\n const details = error as Record<string, unknown>;\n const status =\n typeof details.statusCode === \"number\"\n ? details.statusCode\n : details.status;\n if (\n typeof status === \"number\" &&\n Number.isInteger(status) &&\n status >= 100 &&\n status <= 599\n ) {\n parts.push(`HTTP ${status}`);\n }\n\n const code = details.errorCode ?? details.code;\n if (typeof code === \"string\" && /^[a-zA-Z0-9_.-]{1,80}$/.test(code)) {\n parts.push(code);\n }\n }\n\n return parts.length > 0 ? parts.join(\" · \") : null;\n}\n\nexport function ActionQueryError({\n error,\n onRetry,\n className,\n queryName,\n}: ActionQueryErrorProps) {\n const t = useT();\n const diagnostic = actionQueryDiagnostic(error, queryName);\n\n return (\n <Alert variant=\"destructive\" className={className}>\n <IconAlertTriangle className=\"size-4\" />\n <AlertTitle>{t(\"dispatch.pages.dataLoadFailed\")}</AlertTitle>\n <AlertDescription className=\"flex flex-wrap items-center justify-between gap-3\">\n <span>{t(\"dispatch.pages.dataLoadFailedDescription\")}</span>\n {diagnostic ? (\n <code className=\"w-full break-all text-xs text-muted-foreground\">\n {diagnostic}\n </code>\n ) : null}\n <Button type=\"button\" variant=\"outline\" size=\"sm\" onClick={onRetry}>\n <IconRefresh className=\"size-4\" />\n {t(\"dispatch.pages.tryAgain\")}\n </Button>\n </AlertDescription>\n </Alert>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-home-apps.d.ts","sourceRoot":"","sources":["../../src/components/chat-home-apps.tsx"],"names":[],"mappings":"AA0BA,wBAAgB,oBAAoB,
|
|
1
|
+
{"version":3,"file":"chat-home-apps.d.ts","sourceRoot":"","sources":["../../src/components/chat-home-apps.tsx"],"names":[],"mappings":"AA0BA,wBAAgB,oBAAoB,2DA4InC"}
|
|
@@ -29,11 +29,11 @@ export function DispatchChatHomeApps() {
|
|
|
29
29
|
if (!launcher)
|
|
30
30
|
return null;
|
|
31
31
|
if (launcher.error && launcher.workspaceApps.length === 0) {
|
|
32
|
-
return (_jsx("div", { className: "mx-auto w-full max-w-[1000px]", children: _jsx(ActionQueryError, { error: launcher.error, onRetry: launcher.retry }) }));
|
|
32
|
+
return (_jsx("div", { className: "mx-auto w-full max-w-[1000px]", children: _jsx(ActionQueryError, { error: launcher.error, onRetry: launcher.retry, queryName: launcher.errorQueryName }) }));
|
|
33
33
|
}
|
|
34
34
|
if (!launcher.isLoading && launcher.workspaceApps.length === 0)
|
|
35
35
|
return null;
|
|
36
|
-
return (_jsxs("div", { className: "mx-auto w-full max-w-[1000px]", children: [launcher.error ? (_jsx(ActionQueryError, { error: launcher.error, onRetry: launcher.retry, className: "mb-3" })) : null, _jsxs("section", { "aria-label": t("dispatch.nav.apps"), children: [_jsxs("header", { className: "mb-3 flex flex-wrap items-center justify-between gap-3", children: [_jsx("h2", { className: "text-sm font-semibold text-foreground", children: t("dispatch.nav.apps") }), _jsxs("div", { className: "flex min-w-0 flex-1 items-center justify-end gap-2 sm:flex-none", children: [_jsx(WorkspaceAppSearch, { query: query, onQueryChange: setQuery, className: "w-full max-w-[280px]" }), _jsx(CreateAppPopover, { align: "end", onCreated: launcher.retry, trigger: _jsxs(Button, { type: "button", size: "sm", variant: "outline", children: [_jsx(IconPlus, { size: 16, "aria-hidden": "true" }), t("dispatch.pages.chatFirstNewApp")] }) })] })] }), launcher.isLoading && launcher.workspaceApps.length === 0 ? (_jsx("div", { className: "grid grid-cols-1 gap-2 sm:grid-cols-2", children: Array.from({ length: 6 }, (_, index) => (_jsxs("div", { className: "flex min-w-0 items-center gap-3 rounded-xl bg-muted/30 px-3 py-2.5", children: [_jsx(Skeleton, { className: "size-7 rounded-lg" }), _jsxs("div", { className: "min-w-0 flex-1 space-y-1.5", children: [_jsx(Skeleton, { className: "h-4 w-20" }), _jsx(Skeleton, { className: "h-3 w-40 max-w-full" })] }), _jsx(Skeleton, { className: "h-7 w-20" })] }, index))) })) : apps.length > 0 ? (_jsx("div", { className: "grid grid-cols-1 gap-2 sm:grid-cols-2", children: apps.map(({ app, description }) => {
|
|
36
|
+
return (_jsxs("div", { className: "mx-auto w-full max-w-[1000px]", children: [launcher.error ? (_jsx(ActionQueryError, { error: launcher.error, onRetry: launcher.retry, className: "mb-3", queryName: launcher.errorQueryName })) : null, _jsxs("section", { "aria-label": t("dispatch.nav.apps"), children: [_jsxs("header", { className: "mb-3 flex flex-wrap items-center justify-between gap-3", children: [_jsx("h2", { className: "text-sm font-semibold text-foreground", children: t("dispatch.nav.apps") }), _jsxs("div", { className: "flex min-w-0 flex-1 items-center justify-end gap-2 sm:flex-none", children: [_jsx(WorkspaceAppSearch, { query: query, onQueryChange: setQuery, className: "w-full max-w-[280px]" }), _jsx(CreateAppPopover, { align: "end", onCreated: launcher.retry, trigger: _jsxs(Button, { type: "button", size: "sm", variant: "outline", children: [_jsx(IconPlus, { size: 16, "aria-hidden": "true" }), t("dispatch.pages.chatFirstNewApp")] }) })] })] }), launcher.isLoading && launcher.workspaceApps.length === 0 ? (_jsx("div", { className: "grid grid-cols-1 gap-2 sm:grid-cols-2", children: Array.from({ length: 6 }, (_, index) => (_jsxs("div", { className: "flex min-w-0 items-center gap-3 rounded-xl bg-muted/30 px-3 py-2.5", children: [_jsx(Skeleton, { className: "size-7 rounded-lg" }), _jsxs("div", { className: "min-w-0 flex-1 space-y-1.5", children: [_jsx(Skeleton, { className: "h-4 w-20" }), _jsx(Skeleton, { className: "h-3 w-40 max-w-full" })] }), _jsx(Skeleton, { className: "h-7 w-20" })] }, index))) })) : apps.length > 0 ? (_jsx("div", { className: "grid grid-cols-1 gap-2 sm:grid-cols-2", children: apps.map(({ app, description }) => {
|
|
37
37
|
const href = workspaceAppHref(app);
|
|
38
38
|
return (_jsxs("article", { className: "flex min-w-0 items-center gap-3 rounded-xl bg-muted/30 px-3 py-2.5 transition-colors hover:bg-muted/50", children: [_jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-3", children: [_jsx(AppIcon, { id: app.id, name: app.name, size: "sm" }), _jsxs("span", { className: "min-w-0 flex-1", children: [_jsx("span", { className: "block truncate text-sm font-semibold text-foreground", children: app.name }), description ? (_jsx("span", { className: "mt-0.5 block truncate text-xs text-muted-foreground", children: description })) : null] })] }), _jsx(AppOpenActions, { name: app.name, href: href, onOpen: () => launcher.openApp(app), showNewTabOption: Boolean(href), labels: {
|
|
39
39
|
openApp: t("dispatch.pages.openApp", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-home-apps.js","sourceRoot":"","sources":["../../src/components/chat-home-apps.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,4DAA4D,CAAC;AAC5F,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,EACL,kBAAkB,EAClB,q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AW,GACP,CACR,CAAC,CAAC,CAAC,IAAI,IACH,IACH,EACN,KAAC,cAAc,IACb,IAAI,EAAE,GAAG,CAAC,IAAI,EACd,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,EACnC,gBAAgB,EAAE,OAAO,CAAC,IAAI,CAAC,EAC/B,MAAM,EAAE;4CACN,OAAO,EAAE,CAAC,CAAC,wBAAwB,EAAE;gDACnC,YAAY,EAAE,MAAM;6CACrB,CAAC;4CACF,iBAAiB,EAAE,CAAC,CAAC,iCAAiC,EAAE;gDACtD,IAAI,EAAE,GAAG,CAAC,IAAI;6CACf,CAAC;4CACF,YAAY,EAAE,CAAC,CAAC,sCAAsC,CAAC;4CACvD,WAAW,EAAE,CAAC,CAAC,uBAAuB,EAAE;gDACtC,IAAI,EAAE,GAAG,CAAC,IAAI;6CACf,CAAC;yCACH,GACD,KAjCG,GAAG,CAAC,EAAE,CAkCH,CACX,CAAC;wBACJ,CAAC,CAAC,GACE,CACP,CAAC,CAAC,CAAC,CACF,KAAC,uBAAuB,IAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,GAAI,CACvE,EACD,MAAC,IAAI,IACH,EAAE,EAAE,qBAAqB,CAAC,OAAO,CAAC,EAClC,SAAS,EAAC,qGAAqG,aAE9G,CAAC,CAAC,wBAAwB,CAAC,EAC5B,KAAC,gBAAgB,IAAC,IAAI,EAAE,EAAE,iBAAc,MAAM,GAAG,IAC5C,IACC,IACN,CACP,CAAC;AACJ,CAAC","sourcesContent":["import { useT } from \"@agent-native/core/client/i18n\";\nimport { AppOpenActions } from \"@agent-native/toolkit/app/chat/chat-first/app-open-actions\";\nimport { IconArrowUpRight, IconPlus } from \"@tabler/icons-react\";\nimport { useMemo, useState } from \"react\";\nimport { Link } from \"react-router\";\n\nimport {\n orderWorkspaceApps,\n useWorkspaceAppLayout,\n workspaceAppMatchesQuery,\n} from \"../lib/workspace-app-layout\";\nimport { workspaceAppHref } from \"../lib/workspace-apps\";\nimport { ActionQueryError } from \"./action-query-error\";\nimport { AppIcon } from \"./app-icon\";\nimport { CreateAppPopover } from \"./create-app-popover\";\nimport {\n dispatchNavLinkTarget,\n useDispatchWorkspaceAppLauncher,\n} from \"./layout/Layout\";\nimport { Button } from \"./ui/button\";\nimport { Skeleton } from \"./ui/skeleton\";\nimport {\n WorkspaceAppSearch,\n WorkspaceAppSearchEmpty,\n} from \"./workspace-app-search\";\n\nexport function DispatchChatHomeApps() {\n const t = useT();\n const launcher = useDispatchWorkspaceAppLauncher();\n const { layout } = useWorkspaceAppLayout();\n const [query, setQuery] = useState(\"\");\n const apps = useMemo(\n () =>\n orderWorkspaceApps(launcher?.workspaceApps ?? [], layout)\n .map((app) => ({\n app,\n description: app.defaultDescriptionKey\n ? t(app.defaultDescriptionKey)\n : app.description,\n }))\n .filter(({ app, description }) =>\n workspaceAppMatchesQuery({ ...app, description }, query),\n ),\n [launcher?.workspaceApps, layout, query, t],\n );\n if (!launcher) return null;\n\n if (launcher.error && launcher.workspaceApps.length === 0) {\n return (\n <div className=\"mx-auto w-full max-w-[1000px]\">\n <ActionQueryError error={launcher.error} onRetry={launcher.retry} />\n </div>\n );\n }\n if (!launcher.isLoading && launcher.workspaceApps.length === 0) return null;\n\n return (\n <div className=\"mx-auto w-full max-w-[1000px]\">\n {launcher.error ? (\n <ActionQueryError\n error={launcher.error}\n onRetry={launcher.retry}\n className=\"mb-3\"\n />\n ) : null}\n <section aria-label={t(\"dispatch.nav.apps\")}>\n <header className=\"mb-3 flex flex-wrap items-center justify-between gap-3\">\n <h2 className=\"text-sm font-semibold text-foreground\">\n {t(\"dispatch.nav.apps\")}\n </h2>\n <div className=\"flex min-w-0 flex-1 items-center justify-end gap-2 sm:flex-none\">\n <WorkspaceAppSearch\n query={query}\n onQueryChange={setQuery}\n className=\"w-full max-w-[280px]\"\n />\n <CreateAppPopover\n align=\"end\"\n onCreated={launcher.retry}\n trigger={\n <Button type=\"button\" size=\"sm\" variant=\"outline\">\n <IconPlus size={16} aria-hidden=\"true\" />\n {t(\"dispatch.pages.chatFirstNewApp\")}\n </Button>\n }\n />\n </div>\n </header>\n {launcher.isLoading && launcher.workspaceApps.length === 0 ? (\n <div className=\"grid grid-cols-1 gap-2 sm:grid-cols-2\">\n {Array.from({ length: 6 }, (_, index) => (\n <div\n key={index}\n className=\"flex min-w-0 items-center gap-3 rounded-xl bg-muted/30 px-3 py-2.5\"\n >\n <Skeleton className=\"size-7 rounded-lg\" />\n <div className=\"min-w-0 flex-1 space-y-1.5\">\n <Skeleton className=\"h-4 w-20\" />\n <Skeleton className=\"h-3 w-40 max-w-full\" />\n </div>\n <Skeleton className=\"h-7 w-20\" />\n </div>\n ))}\n </div>\n ) : apps.length > 0 ? (\n <div className=\"grid grid-cols-1 gap-2 sm:grid-cols-2\">\n {apps.map(({ app, description }) => {\n const href = workspaceAppHref(app);\n return (\n <article\n key={app.id}\n className=\"flex min-w-0 items-center gap-3 rounded-xl bg-muted/30 px-3 py-2.5 transition-colors hover:bg-muted/50\"\n >\n <div className=\"flex min-w-0 flex-1 items-center gap-3\">\n <AppIcon id={app.id} name={app.name} size=\"sm\" />\n <span className=\"min-w-0 flex-1\">\n <span className=\"block truncate text-sm font-semibold text-foreground\">\n {app.name}\n </span>\n {description ? (\n <span className=\"mt-0.5 block truncate text-xs text-muted-foreground\">\n {description}\n </span>\n ) : null}\n </span>\n </div>\n <AppOpenActions\n name={app.name}\n href={href}\n onOpen={() => launcher.openApp(app)}\n showNewTabOption={Boolean(href)}\n labels={{\n openApp: t(\"dispatch.pages.openApp\", {\n defaultValue: \"Open\",\n }),\n openAppAccessible: t(\"dispatch.pages.chatFirstOpenApp\", {\n name: app.name,\n }),\n openInNewTab: t(\"dispatch.pages.chatFirstOpenInNewTab\"),\n moreOptions: t(\"extensions.optionsFor\", {\n name: app.name,\n }),\n }}\n />\n </article>\n );\n })}\n </div>\n ) : (\n <WorkspaceAppSearchEmpty query={query} onClear={() => setQuery(\"\")} />\n )}\n <Link\n to={dispatchNavLinkTarget(\"/apps\")}\n className=\"mt-3 inline-flex items-center gap-1 text-xs font-medium text-muted-foreground hover:text-foreground\"\n >\n {t(\"dispatch.pages.allApps\")}\n <IconArrowUpRight size={14} aria-hidden=\"true\" />\n </Link>\n </section>\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"chat-home-apps.js","sourceRoot":"","sources":["../../src/components/chat-home-apps.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,4DAA4D,CAAC;AAC5F,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EACL,qBAAqB,EACrB,+BAA+B,GAChC,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EACL,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,wBAAwB,CAAC;AAEhC,MAAM,UAAU,oBAAoB;IAClC,MAAM,CAAC,GAAG,IAAI,EAAE,CAAC;IACjB,M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AAW,EAAE,CAAC,CAAC,uBAAuB,EAAE;gDACtC,IAAI,EAAE,GAAG,CAAC,IAAI;6CACf,CAAC;yCACH,GACD,KAjCG,GAAG,CAAC,EAAE,CAkCH,CACX,CAAC;wBACJ,CAAC,CAAC,GACE,CACP,CAAC,CAAC,CAAC,CACF,KAAC,uBAAuB,IAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,GAAI,CACvE,EACD,MAAC,IAAI,IACH,EAAE,EAAE,qBAAqB,CAAC,OAAO,CAAC,EAClC,SAAS,EAAC,qGAAqG,aAE9G,CAAC,CAAC,wBAAwB,CAAC,EAC5B,KAAC,gBAAgB,IAAC,IAAI,EAAE,EAAE,iBAAc,MAAM,GAAG,IAC5C,IACC,IACN,CACP,CAAC;AACJ,CAAC","sourcesContent":["import { useT } from \"@agent-native/core/client/i18n\";\nimport { AppOpenActions } from \"@agent-native/toolkit/app/chat/chat-first/app-open-actions\";\nimport { IconArrowUpRight, IconPlus } from \"@tabler/icons-react\";\nimport { useMemo, useState } from \"react\";\nimport { Link } from \"react-router\";\n\nimport {\n orderWorkspaceApps,\n useWorkspaceAppLayout,\n workspaceAppMatchesQuery,\n} from \"../lib/workspace-app-layout\";\nimport { workspaceAppHref } from \"../lib/workspace-apps\";\nimport { ActionQueryError } from \"./action-query-error\";\nimport { AppIcon } from \"./app-icon\";\nimport { CreateAppPopover } from \"./create-app-popover\";\nimport {\n dispatchNavLinkTarget,\n useDispatchWorkspaceAppLauncher,\n} from \"./layout/Layout\";\nimport { Button } from \"./ui/button\";\nimport { Skeleton } from \"./ui/skeleton\";\nimport {\n WorkspaceAppSearch,\n WorkspaceAppSearchEmpty,\n} from \"./workspace-app-search\";\n\nexport function DispatchChatHomeApps() {\n const t = useT();\n const launcher = useDispatchWorkspaceAppLauncher();\n const { layout } = useWorkspaceAppLayout();\n const [query, setQuery] = useState(\"\");\n const apps = useMemo(\n () =>\n orderWorkspaceApps(launcher?.workspaceApps ?? [], layout)\n .map((app) => ({\n app,\n description: app.defaultDescriptionKey\n ? t(app.defaultDescriptionKey)\n : app.description,\n }))\n .filter(({ app, description }) =>\n workspaceAppMatchesQuery({ ...app, description }, query),\n ),\n [launcher?.workspaceApps, layout, query, t],\n );\n if (!launcher) return null;\n\n if (launcher.error && launcher.workspaceApps.length === 0) {\n return (\n <div className=\"mx-auto w-full max-w-[1000px]\">\n <ActionQueryError\n error={launcher.error}\n onRetry={launcher.retry}\n queryName={launcher.errorQueryName}\n />\n </div>\n );\n }\n if (!launcher.isLoading && launcher.workspaceApps.length === 0) return null;\n\n return (\n <div className=\"mx-auto w-full max-w-[1000px]\">\n {launcher.error ? (\n <ActionQueryError\n error={launcher.error}\n onRetry={launcher.retry}\n className=\"mb-3\"\n queryName={launcher.errorQueryName}\n />\n ) : null}\n <section aria-label={t(\"dispatch.nav.apps\")}>\n <header className=\"mb-3 flex flex-wrap items-center justify-between gap-3\">\n <h2 className=\"text-sm font-semibold text-foreground\">\n {t(\"dispatch.nav.apps\")}\n </h2>\n <div className=\"flex min-w-0 flex-1 items-center justify-end gap-2 sm:flex-none\">\n <WorkspaceAppSearch\n query={query}\n onQueryChange={setQuery}\n className=\"w-full max-w-[280px]\"\n />\n <CreateAppPopover\n align=\"end\"\n onCreated={launcher.retry}\n trigger={\n <Button type=\"button\" size=\"sm\" variant=\"outline\">\n <IconPlus size={16} aria-hidden=\"true\" />\n {t(\"dispatch.pages.chatFirstNewApp\")}\n </Button>\n }\n />\n </div>\n </header>\n {launcher.isLoading && launcher.workspaceApps.length === 0 ? (\n <div className=\"grid grid-cols-1 gap-2 sm:grid-cols-2\">\n {Array.from({ length: 6 }, (_, index) => (\n <div\n key={index}\n className=\"flex min-w-0 items-center gap-3 rounded-xl bg-muted/30 px-3 py-2.5\"\n >\n <Skeleton className=\"size-7 rounded-lg\" />\n <div className=\"min-w-0 flex-1 space-y-1.5\">\n <Skeleton className=\"h-4 w-20\" />\n <Skeleton className=\"h-3 w-40 max-w-full\" />\n </div>\n <Skeleton className=\"h-7 w-20\" />\n </div>\n ))}\n </div>\n ) : apps.length > 0 ? (\n <div className=\"grid grid-cols-1 gap-2 sm:grid-cols-2\">\n {apps.map(({ app, description }) => {\n const href = workspaceAppHref(app);\n return (\n <article\n key={app.id}\n className=\"flex min-w-0 items-center gap-3 rounded-xl bg-muted/30 px-3 py-2.5 transition-colors hover:bg-muted/50\"\n >\n <div className=\"flex min-w-0 flex-1 items-center gap-3\">\n <AppIcon id={app.id} name={app.name} size=\"sm\" />\n <span className=\"min-w-0 flex-1\">\n <span className=\"block truncate text-sm font-semibold text-foreground\">\n {app.name}\n </span>\n {description ? (\n <span className=\"mt-0.5 block truncate text-xs text-muted-foreground\">\n {description}\n </span>\n ) : null}\n </span>\n </div>\n <AppOpenActions\n name={app.name}\n href={href}\n onOpen={() => launcher.openApp(app)}\n showNewTabOption={Boolean(href)}\n labels={{\n openApp: t(\"dispatch.pages.openApp\", {\n defaultValue: \"Open\",\n }),\n openAppAccessible: t(\"dispatch.pages.chatFirstOpenApp\", {\n name: app.name,\n }),\n openInNewTab: t(\"dispatch.pages.chatFirstOpenInNewTab\"),\n moreOptions: t(\"extensions.optionsFor\", {\n name: app.name,\n }),\n }}\n />\n </article>\n );\n })}\n </div>\n ) : (\n <WorkspaceAppSearchEmpty query={query} onClear={() => setQuery(\"\")} />\n )}\n <Link\n to={dispatchNavLinkTarget(\"/apps\")}\n className=\"mt-3 inline-flex items-center gap-1 text-xs font-medium text-muted-foreground hover:text-foreground\"\n >\n {t(\"dispatch.pages.allApps\")}\n <IconArrowUpRight size={14} aria-hidden=\"true\" />\n </Link>\n </section>\n </div>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispatch-control-plane.d.ts","sourceRoot":"","sources":["../../src/components/dispatch-control-plane.tsx"],"names":[],"mappings":"AA2VA,wBAAgB,oBAAoB,
|
|
1
|
+
{"version":3,"file":"dispatch-control-plane.d.ts","sourceRoot":"","sources":["../../src/components/dispatch-control-plane.tsx"],"names":[],"mappings":"AA2VA,wBAAgB,oBAAoB,oDAsBnC"}
|
|
@@ -103,6 +103,6 @@ export function DispatchControlPlane() {
|
|
|
103
103
|
useSetPageTitle(_jsx("span", { "aria-hidden": true }));
|
|
104
104
|
const appsQuery = useActionQuery("list-workspace-apps", { includeAgentCards: false, includeArchived: true });
|
|
105
105
|
const { data: workspaceApps = [], isLoading: appsLoading } = appsQuery;
|
|
106
|
-
return (_jsxs("div", { className: "flex flex-col gap-8", children: [_jsx(CommandPanel, {}), appsQuery.isError ? (_jsx(ActionQueryError, { error: appsQuery.error, onRetry: () => void appsQuery.refetch() })) : (_jsx(AppsPanel, { apps: workspaceApps ?? [], isLoading: appsLoading }))] }));
|
|
106
|
+
return (_jsxs("div", { className: "flex flex-col gap-8", children: [_jsx(CommandPanel, {}), appsQuery.isError ? (_jsx(ActionQueryError, { error: appsQuery.error, onRetry: () => void appsQuery.refetch(), queryName: "list-workspace-apps" })) : (_jsx(AppsPanel, { apps: workspaceApps ?? [], isLoading: appsLoading }))] }));
|
|
107
107
|
}
|
|
108
108
|
//# sourceMappingURL=dispatch-control-plane.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispatch-control-plane.js","sourceRoot":"","sources":["../../src/components/dispatch-control-plane.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,4BAA4B,EAC5B,mCAAmC,EACnC,aAAa,GACd,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EACL,SAAS,EACT,cAAc,GACf,MAAM,+CAA+C,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;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AQ,IAAC,SAAS,EAAC,4BAA4B,GAAG,EACnD,eAAK,SAAS,EAAC,0BAA0B,aACvC,KAAC,QAAQ,IAAC,SAAS,EAAC,UAAU,GAAG,EACjC,KAAC,QAAQ,IAAC,SAAS,EAAC,WAAW,GAAG,IAC9B,EACN,KAAC,QAAQ,IAAC,SAAS,EAAC,8BAA8B,GAAG,KAXhD,KAAK,CAYN,CACP,CAAC,GACM,CACX,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,oBAAoB;IAClC,eAAe,CAAC,qCAAoB,CAAC,CAAC;IACtC,MAAM,SAAS,GAAG,cAAc,CAC9B,qBAAqB,EACrB,EAAE,iBAAiB,EAAE,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,CACpD,CAAC;IACF,MAAM,EAAE,IAAI,EAAE,aAAa,GAAG,EAAE,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,SAAS,CAAC;IAEvE,OAAO,CACL,eAAK,SAAS,EAAC,qBAAqB,aAClC,KAAC,YAAY,KAAG,EACf,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CACnB,KAAC,gBAAgB,IACf,KAAK,EAAE,SAAS,CAAC,KAAK,EACtB,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,SAAS,CAAC,OAAO,EAAE,GACvC,CACH,CAAC,CAAC,CAAC,CACF,KAAC,SAAS,IAAC,IAAI,EAAE,aAAa,IAAI,EAAE,EAAE,SAAS,EAAE,WAAW,GAAI,CACjE,IACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["import {\n chatModelSelectionStorageKey,\n navigateWithAgentChatViewTransition,\n useChatModels,\n} from \"@agent-native/core/client/agent-chat\";\nimport { useActionQuery } from \"@agent-native/core/client/hooks\";\nimport { useT } from \"@agent-native/core/client/i18n\";\nimport { useOrgRole } from \"@agent-native/core/client/org\";\nimport {\n PromptBar,\n PromptComposer,\n} from \"@agent-native/toolkit/app/chat/composer/index\";\nimport { IconChevronDown, IconClockHour4, IconPlus } from \"@tabler/icons-react\";\nimport type { ReactNode } from \"react\";\nimport { useState } from \"react\";\nimport { Link, useNavigate } from \"react-router\";\n\nimport { cn } from \"../lib/utils\";\nimport {\n orderWorkspaceApps,\n useWorkspaceAppLayout,\n workspaceAppMatchesQuery,\n} from \"../lib/workspace-app-layout\";\nimport {\n isWorkspaceAppVisibleInDefaultLaunchers,\n type WorkspaceAppSummary,\n} from \"../lib/workspace-apps\";\nimport { ActionQueryError } from \"./action-query-error\";\nimport {\n APP_LIST_GRID_CLASS,\n AppList,\n APP_LIST_GRID_ROW_CLASS,\n} from \"./app-list-row\";\nimport { CreateAppPopover } from \"./create-app-popover\";\nimport { useSetPageTitle } from \"./layout/HeaderActions\";\nimport { Button } from \"./ui/button\";\nimport {\n Collapsible,\n CollapsibleContent,\n CollapsibleTrigger,\n} from \"./ui/collapsible\";\nimport { Skeleton } from \"./ui/skeleton\";\nimport { WorkspaceAppCard } from \"./workspace-app-card\";\nimport {\n WorkspaceAppSearch,\n WorkspaceAppSearchEmpty,\n} from \"./workspace-app-search\";\n\nfunction SectionHeader({\n title,\n action,\n}: {\n title: string;\n action?: ReactNode;\n}) {\n return (\n <div className=\"flex min-w-0 items-center justify-between gap-3\">\n <h2 className=\"truncate text-sm font-semibold text-foreground\">\n {title}\n </h2>\n {action ? <div className=\"shrink-0\">{action}</div> : null}\n </div>\n );\n}\n\nfunction CommandPanel() {\n const t = useT();\n const { org } = useOrgRole();\n const draftScope = org?.orgId?.trim()\n ? `dispatch:overview:${org.orgId}`\n : \"dispatch:overview\";\n const {\n availableModels,\n isLoading: modelListLoading,\n onEffortChange,\n onModelChange,\n selectedEffort,\n selectedEngine,\n selectedModel,\n } = useChatModels({ storageKey: chatModelSelectionStorageKey(\"dispatch\") });\n const navigate = useNavigate();\n const promptSuggestions = [\n t(\"dispatch.pages.suggestionOnboardingApp\", {\n defaultValue: \"Create an app for onboarding requests\",\n }),\n t(\"dispatch.pages.suggestionAnalyticsAgents\", {\n defaultValue: \"Check which agents can help with analytics\",\n }),\n ];\n\n function send(message: string) {\n const trimmed = message.trim();\n if (!trimmed) return;\n\n navigateWithAgentChatViewTransition(navigate, \"/chat\", {\n state: {\n dispatchPrompt: {\n id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,\n message: trimmed,\n selectedModel,\n selectedEngine,\n selectedEffort,\n },\n },\n });\n }\n\n return (\n <section className=\"flex flex-col\">\n <div className=\"mx-auto flex w-full max-w-[750px] flex-col pt-4 sm:pt-6\">\n <div className=\"mb-5 text-center\">\n <h2 className=\"text-2xl font-semibold tracking-tight text-foreground sm:text-3xl\">\n {t(\"dispatch.pages.chatAcrossApps\", {\n defaultValue: \"Chat across your apps\",\n })}\n </h2>\n <p className=\"mx-auto mt-2 max-w-xl text-sm leading-6 text-muted-foreground\">\n {t(\"dispatch.pages.chatAcrossAppsDescription\", {\n defaultValue:\n \"Route work, inspect status, or create something new from one place.\",\n })}\n </p>\n </div>\n <PromptBar mode=\"inline\" className=\"contents\">\n <PromptComposer\n requireAgentEngine\n availableModels={availableModels}\n draftScope={draftScope}\n modelListLoading={modelListLoading}\n placeholder={t(\"dispatch.pages.overviewPromptPlaceholder\", {\n defaultValue: \"Ask Dispatch anything...\",\n })}\n selectedEffort={selectedEffort}\n selectedEngine={selectedEngine}\n selectedModel={selectedModel}\n layoutVariant=\"hero\"\n rootClassName=\"bg-card\"\n onEffortChange={onEffortChange}\n onModelChange={onModelChange}\n onSubmit={(text) => send(text)}\n />\n </PromptBar>\n <div className=\"mt-3 flex flex-wrap justify-center gap-2\">\n {promptSuggestions.map((suggestion) => (\n <button\n key={suggestion}\n type=\"button\"\n onClick={() => send(suggestion)}\n className=\"cursor-pointer rounded-md border border-transparent bg-muted/60 px-2.5 py-1.5 text-xs text-muted-foreground transition-[background-color,color] hover:bg-muted hover:text-foreground\"\n >\n {suggestion}\n </button>\n ))}\n </div>\n </div>\n </section>\n );\n}\n\nfunction AppsPanel({\n apps,\n isLoading,\n}: {\n apps: WorkspaceAppSummary[];\n isLoading: boolean;\n}) {\n const t = useT();\n const [showPending, setShowPending] = useState(false);\n const [searchQuery, setSearchQuery] = useState(\"\");\n const { layout, persistenceError, togglePinned } = useWorkspaceAppLayout();\n const visibleApps = apps.filter(\n (app) => isWorkspaceAppVisibleInDefaultLaunchers(app) && !app.archived,\n );\n const activeApps = visibleApps.filter((app) => app.status !== \"pending\");\n const pendingApps = visibleApps.filter((app) => app.status === \"pending\");\n const orderedActiveApps = orderWorkspaceApps(activeApps, layout);\n const orderedPendingApps = orderWorkspaceApps(pendingApps, layout);\n const filteredActiveApps = orderedActiveApps.filter((app) =>\n workspaceAppMatchesQuery(app, searchQuery),\n );\n const filteredPendingApps = orderedPendingApps.filter((app) =>\n workspaceAppMatchesQuery(app, searchQuery),\n );\n const hasSearchResults =\n filteredActiveApps.length > 0 || filteredPendingApps.length > 0;\n const showSkeletons =\n isLoading && activeApps.length === 0 && pendingApps.length === 0;\n\n return (\n <section className=\"mx-auto flex w-full max-w-[1000px] flex-col gap-3\">\n <SectionHeader\n title=\"Apps\"\n action={\n <div className=\"flex min-w-0 flex-wrap items-center justify-end gap-1.5\">\n <Button variant=\"ghost\" size=\"sm\" asChild>\n <Link to=\"/apps\" className=\"text-muted-foreground\">\n View all\n </Link>\n </Button>\n {!showSkeletons &&\n (visibleApps.length > 0 || Boolean(searchQuery.trim())) ? (\n <WorkspaceAppSearch\n className=\"w-[220px]\"\n query={searchQuery}\n onQueryChange={setSearchQuery}\n />\n ) : null}\n <CreateAppPopover\n align=\"end\"\n trigger={\n <Button variant=\"default\" size=\"sm\" className=\"gap-1.5\">\n <IconPlus size={14} />\n {t(\"dispatch.pages.newApp\", { defaultValue: \"New\" })}\n </Button>\n }\n />\n </div>\n }\n />\n {!showSkeletons && visibleApps.length > 0 && persistenceError ? (\n <p className=\"text-xs text-muted-foreground\" role=\"status\">\n {persistenceError === \"both\"\n ? t(\"dispatch.pages.appPinSaveFailed\", {\n defaultValue: \"App pins could not be saved.\",\n })\n : t(\"dispatch.pages.appPinSavedLocally\", {\n defaultValue: \"App pins are saved on this device only.\",\n })}\n </p>\n ) : null}\n {showSkeletons ? (\n <OverviewAppsSkeleton />\n ) : searchQuery.trim() && !hasSearchResults ? (\n <WorkspaceAppSearchEmpty\n query={searchQuery}\n onClear={() => setSearchQuery(\"\")}\n />\n ) : (\n <>\n <AppList className={APP_LIST_GRID_CLASS}>\n {filteredActiveApps.map((app) => (\n <WorkspaceAppCard\n key={app.id}\n app={app}\n className={APP_LIST_GRID_ROW_CLASS}\n isPinned={layout.pinnedIds.includes(app.id.toLowerCase())}\n onTogglePinned={() => togglePinned(app.id)}\n />\n ))}\n {filteredActiveApps.length === 0 &&\n pendingApps.length === 0 &&\n !searchQuery.trim() ? (\n <p className=\"px-4 py-3 text-sm text-muted-foreground\">\n {t(\"dispatch.pages.noApps\", {\n defaultValue: \"No apps yet.\",\n })}\n </p>\n ) : null}\n </AppList>\n </>\n )}\n {pendingApps.length > 0 &&\n (!searchQuery.trim() || filteredPendingApps.length > 0) ? (\n <Collapsible\n open={showPending || Boolean(searchQuery.trim())}\n onOpenChange={setShowPending}\n >\n <div className=\"space-y-3 border-t pt-3\">\n <div className=\"flex flex-wrap items-center justify-between gap-3\">\n <div className=\"flex min-w-0 items-center gap-2\">\n <IconClockHour4\n size={15}\n className=\"shrink-0 text-muted-foreground\"\n />\n <div className=\"min-w-0\">\n <h3 className=\"text-xs font-semibold text-foreground\">\n {t(\"dispatch.pages.pendingApps\")}\n </h3>\n <p className=\"text-xs text-muted-foreground\">\n {t(\"dispatch.pages.pendingAppsDescription\", {\n count: pendingApps.length,\n })}\n </p>\n </div>\n </div>\n <CollapsibleTrigger asChild>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n className=\"h-7 gap-1.5 px-2 text-xs\"\n >\n {showPending || Boolean(searchQuery.trim())\n ? t(\"dispatch.pages.hidePendingApps\")\n : t(\"dispatch.pages.showPendingApps\")}\n <IconChevronDown\n size={13}\n className={\n showPending || searchQuery.trim()\n ? \"rotate-180\"\n : undefined\n }\n />\n </Button>\n </CollapsibleTrigger>\n </div>\n <CollapsibleContent>\n <AppList className={APP_LIST_GRID_CLASS}>\n {filteredPendingApps.map((app) => (\n <WorkspaceAppCard\n key={app.id}\n app={app}\n className={APP_LIST_GRID_ROW_CLASS}\n />\n ))}\n </AppList>\n </CollapsibleContent>\n </div>\n </Collapsible>\n ) : null}\n </section>\n );\n}\n\nfunction OverviewAppsSkeleton() {\n return (\n <AppList className={APP_LIST_GRID_CLASS}>\n {Array.from({ length: 4 }).map((_, index) => (\n <div\n key={index}\n className={cn(\n \"flex min-w-0 items-center gap-3 border-b px-4 py-3.5 last:border-b-0\",\n APP_LIST_GRID_ROW_CLASS,\n )}\n >\n <Skeleton className=\"size-8 shrink-0 rounded-xl\" />\n <div className=\"min-w-0 flex-1 space-y-2\">\n <Skeleton className=\"h-4 w-32\" />\n <Skeleton className=\"h-3 w-2/3\" />\n </div>\n <Skeleton className=\"h-9 w-24 shrink-0 rounded-md\" />\n </div>\n ))}\n </AppList>\n );\n}\n\nexport function DispatchControlPlane() {\n useSetPageTitle(<span aria-hidden />);\n const appsQuery = useActionQuery<WorkspaceAppSummary[]>(\n \"list-workspace-apps\",\n { includeAgentCards: false, includeArchived: true },\n );\n const { data: workspaceApps = [], isLoading: appsLoading } = appsQuery;\n\n return (\n <div className=\"flex flex-col gap-8\">\n <CommandPanel />\n {appsQuery.isError ? (\n <ActionQueryError\n error={appsQuery.error}\n onRetry={() => void appsQuery.refetch()}\n />\n ) : (\n <AppsPanel apps={workspaceApps ?? []} isLoading={appsLoading} />\n )}\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"dispatch-control-plane.js","sourceRoot":"","sources":["../../src/components/dispatch-control-plane.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,4BAA4B,EAC5B,mCAAmC,EACnC,aAAa,GACd,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,iCA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ModelSelectionStorageKey,\n navigateWithAgentChatViewTransition,\n useChatModels,\n} from \"@agent-native/core/client/agent-chat\";\nimport { useActionQuery } from \"@agent-native/core/client/hooks\";\nimport { useT } from \"@agent-native/core/client/i18n\";\nimport { useOrgRole } from \"@agent-native/core/client/org\";\nimport {\n PromptBar,\n PromptComposer,\n} from \"@agent-native/toolkit/app/chat/composer/index\";\nimport { IconChevronDown, IconClockHour4, IconPlus } from \"@tabler/icons-react\";\nimport type { ReactNode } from \"react\";\nimport { useState } from \"react\";\nimport { Link, useNavigate } from \"react-router\";\n\nimport { cn } from \"../lib/utils\";\nimport {\n orderWorkspaceApps,\n useWorkspaceAppLayout,\n workspaceAppMatchesQuery,\n} from \"../lib/workspace-app-layout\";\nimport {\n isWorkspaceAppVisibleInDefaultLaunchers,\n type WorkspaceAppSummary,\n} from \"../lib/workspace-apps\";\nimport { ActionQueryError } from \"./action-query-error\";\nimport {\n APP_LIST_GRID_CLASS,\n AppList,\n APP_LIST_GRID_ROW_CLASS,\n} from \"./app-list-row\";\nimport { CreateAppPopover } from \"./create-app-popover\";\nimport { useSetPageTitle } from \"./layout/HeaderActions\";\nimport { Button } from \"./ui/button\";\nimport {\n Collapsible,\n CollapsibleContent,\n CollapsibleTrigger,\n} from \"./ui/collapsible\";\nimport { Skeleton } from \"./ui/skeleton\";\nimport { WorkspaceAppCard } from \"./workspace-app-card\";\nimport {\n WorkspaceAppSearch,\n WorkspaceAppSearchEmpty,\n} from \"./workspace-app-search\";\n\nfunction SectionHeader({\n title,\n action,\n}: {\n title: string;\n action?: ReactNode;\n}) {\n return (\n <div className=\"flex min-w-0 items-center justify-between gap-3\">\n <h2 className=\"truncate text-sm font-semibold text-foreground\">\n {title}\n </h2>\n {action ? <div className=\"shrink-0\">{action}</div> : null}\n </div>\n );\n}\n\nfunction CommandPanel() {\n const t = useT();\n const { org } = useOrgRole();\n const draftScope = org?.orgId?.trim()\n ? `dispatch:overview:${org.orgId}`\n : \"dispatch:overview\";\n const {\n availableModels,\n isLoading: modelListLoading,\n onEffortChange,\n onModelChange,\n selectedEffort,\n selectedEngine,\n selectedModel,\n } = useChatModels({ storageKey: chatModelSelectionStorageKey(\"dispatch\") });\n const navigate = useNavigate();\n const promptSuggestions = [\n t(\"dispatch.pages.suggestionOnboardingApp\", {\n defaultValue: \"Create an app for onboarding requests\",\n }),\n t(\"dispatch.pages.suggestionAnalyticsAgents\", {\n defaultValue: \"Check which agents can help with analytics\",\n }),\n ];\n\n function send(message: string) {\n const trimmed = message.trim();\n if (!trimmed) return;\n\n navigateWithAgentChatViewTransition(navigate, \"/chat\", {\n state: {\n dispatchPrompt: {\n id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,\n message: trimmed,\n selectedModel,\n selectedEngine,\n selectedEffort,\n },\n },\n });\n }\n\n return (\n <section className=\"flex flex-col\">\n <div className=\"mx-auto flex w-full max-w-[750px] flex-col pt-4 sm:pt-6\">\n <div className=\"mb-5 text-center\">\n <h2 className=\"text-2xl font-semibold tracking-tight text-foreground sm:text-3xl\">\n {t(\"dispatch.pages.chatAcrossApps\", {\n defaultValue: \"Chat across your apps\",\n })}\n </h2>\n <p className=\"mx-auto mt-2 max-w-xl text-sm leading-6 text-muted-foreground\">\n {t(\"dispatch.pages.chatAcrossAppsDescription\", {\n defaultValue:\n \"Route work, inspect status, or create something new from one place.\",\n })}\n </p>\n </div>\n <PromptBar mode=\"inline\" className=\"contents\">\n <PromptComposer\n requireAgentEngine\n availableModels={availableModels}\n draftScope={draftScope}\n modelListLoading={modelListLoading}\n placeholder={t(\"dispatch.pages.overviewPromptPlaceholder\", {\n defaultValue: \"Ask Dispatch anything...\",\n })}\n selectedEffort={selectedEffort}\n selectedEngine={selectedEngine}\n selectedModel={selectedModel}\n layoutVariant=\"hero\"\n rootClassName=\"bg-card\"\n onEffortChange={onEffortChange}\n onModelChange={onModelChange}\n onSubmit={(text) => send(text)}\n />\n </PromptBar>\n <div className=\"mt-3 flex flex-wrap justify-center gap-2\">\n {promptSuggestions.map((suggestion) => (\n <button\n key={suggestion}\n type=\"button\"\n onClick={() => send(suggestion)}\n className=\"cursor-pointer rounded-md border border-transparent bg-muted/60 px-2.5 py-1.5 text-xs text-muted-foreground transition-[background-color,color] hover:bg-muted hover:text-foreground\"\n >\n {suggestion}\n </button>\n ))}\n </div>\n </div>\n </section>\n );\n}\n\nfunction AppsPanel({\n apps,\n isLoading,\n}: {\n apps: WorkspaceAppSummary[];\n isLoading: boolean;\n}) {\n const t = useT();\n const [showPending, setShowPending] = useState(false);\n const [searchQuery, setSearchQuery] = useState(\"\");\n const { layout, persistenceError, togglePinned } = useWorkspaceAppLayout();\n const visibleApps = apps.filter(\n (app) => isWorkspaceAppVisibleInDefaultLaunchers(app) && !app.archived,\n );\n const activeApps = visibleApps.filter((app) => app.status !== \"pending\");\n const pendingApps = visibleApps.filter((app) => app.status === \"pending\");\n const orderedActiveApps = orderWorkspaceApps(activeApps, layout);\n const orderedPendingApps = orderWorkspaceApps(pendingApps, layout);\n const filteredActiveApps = orderedActiveApps.filter((app) =>\n workspaceAppMatchesQuery(app, searchQuery),\n );\n const filteredPendingApps = orderedPendingApps.filter((app) =>\n workspaceAppMatchesQuery(app, searchQuery),\n );\n const hasSearchResults =\n filteredActiveApps.length > 0 || filteredPendingApps.length > 0;\n const showSkeletons =\n isLoading && activeApps.length === 0 && pendingApps.length === 0;\n\n return (\n <section className=\"mx-auto flex w-full max-w-[1000px] flex-col gap-3\">\n <SectionHeader\n title=\"Apps\"\n action={\n <div className=\"flex min-w-0 flex-wrap items-center justify-end gap-1.5\">\n <Button variant=\"ghost\" size=\"sm\" asChild>\n <Link to=\"/apps\" className=\"text-muted-foreground\">\n View all\n </Link>\n </Button>\n {!showSkeletons &&\n (visibleApps.length > 0 || Boolean(searchQuery.trim())) ? (\n <WorkspaceAppSearch\n className=\"w-[220px]\"\n query={searchQuery}\n onQueryChange={setSearchQuery}\n />\n ) : null}\n <CreateAppPopover\n align=\"end\"\n trigger={\n <Button variant=\"default\" size=\"sm\" className=\"gap-1.5\">\n <IconPlus size={14} />\n {t(\"dispatch.pages.newApp\", { defaultValue: \"New\" })}\n </Button>\n }\n />\n </div>\n }\n />\n {!showSkeletons && visibleApps.length > 0 && persistenceError ? (\n <p className=\"text-xs text-muted-foreground\" role=\"status\">\n {persistenceError === \"both\"\n ? t(\"dispatch.pages.appPinSaveFailed\", {\n defaultValue: \"App pins could not be saved.\",\n })\n : t(\"dispatch.pages.appPinSavedLocally\", {\n defaultValue: \"App pins are saved on this device only.\",\n })}\n </p>\n ) : null}\n {showSkeletons ? (\n <OverviewAppsSkeleton />\n ) : searchQuery.trim() && !hasSearchResults ? (\n <WorkspaceAppSearchEmpty\n query={searchQuery}\n onClear={() => setSearchQuery(\"\")}\n />\n ) : (\n <>\n <AppList className={APP_LIST_GRID_CLASS}>\n {filteredActiveApps.map((app) => (\n <WorkspaceAppCard\n key={app.id}\n app={app}\n className={APP_LIST_GRID_ROW_CLASS}\n isPinned={layout.pinnedIds.includes(app.id.toLowerCase())}\n onTogglePinned={() => togglePinned(app.id)}\n />\n ))}\n {filteredActiveApps.length === 0 &&\n pendingApps.length === 0 &&\n !searchQuery.trim() ? (\n <p className=\"px-4 py-3 text-sm text-muted-foreground\">\n {t(\"dispatch.pages.noApps\", {\n defaultValue: \"No apps yet.\",\n })}\n </p>\n ) : null}\n </AppList>\n </>\n )}\n {pendingApps.length > 0 &&\n (!searchQuery.trim() || filteredPendingApps.length > 0) ? (\n <Collapsible\n open={showPending || Boolean(searchQuery.trim())}\n onOpenChange={setShowPending}\n >\n <div className=\"space-y-3 border-t pt-3\">\n <div className=\"flex flex-wrap items-center justify-between gap-3\">\n <div className=\"flex min-w-0 items-center gap-2\">\n <IconClockHour4\n size={15}\n className=\"shrink-0 text-muted-foreground\"\n />\n <div className=\"min-w-0\">\n <h3 className=\"text-xs font-semibold text-foreground\">\n {t(\"dispatch.pages.pendingApps\")}\n </h3>\n <p className=\"text-xs text-muted-foreground\">\n {t(\"dispatch.pages.pendingAppsDescription\", {\n count: pendingApps.length,\n })}\n </p>\n </div>\n </div>\n <CollapsibleTrigger asChild>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n className=\"h-7 gap-1.5 px-2 text-xs\"\n >\n {showPending || Boolean(searchQuery.trim())\n ? t(\"dispatch.pages.hidePendingApps\")\n : t(\"dispatch.pages.showPendingApps\")}\n <IconChevronDown\n size={13}\n className={\n showPending || searchQuery.trim()\n ? \"rotate-180\"\n : undefined\n }\n />\n </Button>\n </CollapsibleTrigger>\n </div>\n <CollapsibleContent>\n <AppList className={APP_LIST_GRID_CLASS}>\n {filteredPendingApps.map((app) => (\n <WorkspaceAppCard\n key={app.id}\n app={app}\n className={APP_LIST_GRID_ROW_CLASS}\n />\n ))}\n </AppList>\n </CollapsibleContent>\n </div>\n </Collapsible>\n ) : null}\n </section>\n );\n}\n\nfunction OverviewAppsSkeleton() {\n return (\n <AppList className={APP_LIST_GRID_CLASS}>\n {Array.from({ length: 4 }).map((_, index) => (\n <div\n key={index}\n className={cn(\n \"flex min-w-0 items-center gap-3 border-b px-4 py-3.5 last:border-b-0\",\n APP_LIST_GRID_ROW_CLASS,\n )}\n >\n <Skeleton className=\"size-8 shrink-0 rounded-xl\" />\n <div className=\"min-w-0 flex-1 space-y-2\">\n <Skeleton className=\"h-4 w-32\" />\n <Skeleton className=\"h-3 w-2/3\" />\n </div>\n <Skeleton className=\"h-9 w-24 shrink-0 rounded-md\" />\n </div>\n ))}\n </AppList>\n );\n}\n\nexport function DispatchControlPlane() {\n useSetPageTitle(<span aria-hidden />);\n const appsQuery = useActionQuery<WorkspaceAppSummary[]>(\n \"list-workspace-apps\",\n { includeAgentCards: false, includeArchived: true },\n );\n const { data: workspaceApps = [], isLoading: appsLoading } = appsQuery;\n\n return (\n <div className=\"flex flex-col gap-8\">\n <CommandPanel />\n {appsQuery.isError ? (\n <ActionQueryError\n error={appsQuery.error}\n onRetry={() => void appsQuery.refetch()}\n queryName=\"list-workspace-apps\"\n />\n ) : (\n <AppsPanel apps={workspaceApps ?? []} isLoading={appsLoading} />\n )}\n </div>\n );\n}\n"]}
|
|
@@ -57,6 +57,7 @@ interface DispatchWorkspaceAppLauncher {
|
|
|
57
57
|
workspaceApps: readonly WorkspaceAppSummary[];
|
|
58
58
|
isLoading: boolean;
|
|
59
59
|
error?: unknown;
|
|
60
|
+
errorQueryName?: "list-workspace-apps" | "list-connected-agents";
|
|
60
61
|
openApp: (app: ChatFirstAppItem) => void;
|
|
61
62
|
retry: () => void;
|
|
62
63
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Layout.d.ts","sourceRoot":"","sources":["../../../src/components/layout/Layout.tsx"],"names":[],"mappings":"AAAA,OAAO,EAiBL,KAAK,wBAAwB,EAC7B,KAAK,4BAA4B,EAYlC,MAAM,sCAAsC,CAAC;AAM9C,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,yCAAyC,CAAC;AAWjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uDAAuD,CAAC;AACjG,OAAO,KAAK,EAEV,gBAAgB,EAChB,aAAa,EAEd,MAAM,iDAAiD,CAAC;AAiCzD,OAAO,EAQL,KAAK,aAAa,EAClB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAYf,OAAO,EAaL,KAAK,mBAAmB,EACzB,MAAM,0BAA0B,CAAC;AAuClC,OAAO,EAAE,+BAA+B,EAAE,MAAM,uBAAuB,CAAC;AAExE,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,YAAY,CAAC;AAE1D,MAAM,MAAM,eAAe,GAAG,aAAa,CAAC;IAC1C,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC,CAAC;AAEH,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IAC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U,CAAC,EACzB,UAAU,EACV,UAAU,EACV,SAAkC,EAClC,SAAS,EACT,aAAqB,EACrB,iBAAyB,EACzB,SAAiB,EACjB,WAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,0BAA0B,EAC1B,aAAkB,EAClB,oBAA4B,EAC5B,kBAAkB,EAClB,oBAAoB,EACpB,yBAAyB,EACzB,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,GACrB,EAAE,uBAAuB,mDAsRzB;AAED,wBAAgB,4BAA4B,CAAC,EAC3C,YAAY,EACZ,SAAS,EACT,OAAO,EACP,eAAe,EACf,IAAI,GACL,EAAE;IACD,YAAY,EAAE,wBAAwB,GAAG,IAAI,CAAC;IAC9C,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,EAAE,OAAO,CAAC;IACzB,IAAI,EAAE,aAAa,CAAC;CACrB,GAAG,SAAS,CAuCZ;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,mBAAmB,mDAMhD"}
|
|
@@ -704,6 +704,11 @@ function DispatchLayout({ children, extensions, agentPageHref, brandName, brandI
|
|
|
704
704
|
const chatFirstAppsLoading = chatFirstWorkspaceAppsLoading || chatFirstConnectedAppsLoading;
|
|
705
705
|
const chatFirstAppsFailed = chatFirstAppsQuery.isError;
|
|
706
706
|
const chatFirstAppsError = chatFirstAppsQuery.error ?? chatFirstConnectedAppsQuery.error;
|
|
707
|
+
const chatFirstAppsErrorQueryName = chatFirstAppsQuery.error != null
|
|
708
|
+
? "list-workspace-apps"
|
|
709
|
+
: chatFirstConnectedAppsQuery.error != null
|
|
710
|
+
? "list-connected-agents"
|
|
711
|
+
: undefined;
|
|
707
712
|
const chatFirstResolvableApps = useMemo(() => mergeChatFirstWorkspaceApps(chatFirstAppsQuery.data, chatFirstEnabledBuiltinAppIds, chatFirstBuiltinApps.map((app) => ({
|
|
708
713
|
id: app.id,
|
|
709
714
|
name: app.name,
|
|
@@ -766,6 +771,7 @@ function DispatchLayout({ children, extensions, agentPageHref, brandName, brandI
|
|
|
766
771
|
workspaceApps: chatFirstWorkspaceApps,
|
|
767
772
|
isLoading: chatFirstAppsLoading,
|
|
768
773
|
error: chatFirstAppsError,
|
|
774
|
+
errorQueryName: chatFirstAppsErrorQueryName,
|
|
769
775
|
openApp: openChatFirstApp,
|
|
770
776
|
retry: () => {
|
|
771
777
|
void chatFirstAppsQuery.refetch();
|
|
@@ -773,6 +779,7 @@ function DispatchLayout({ children, extensions, agentPageHref, brandName, brandI
|
|
|
773
779
|
},
|
|
774
780
|
}), [
|
|
775
781
|
chatFirstAppsError,
|
|
782
|
+
chatFirstAppsErrorQueryName,
|
|
776
783
|
chatFirstAppsLoading,
|
|
777
784
|
chatFirstAppsQuery.refetch,
|
|
778
785
|
chatFirstConnectedAppsQuery.refetch,
|