@agent-native/dispatch 0.14.0 → 0.14.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/navigate.js +1 -1
- package/dist/actions/navigate.js.map +1 -1
- package/dist/actions/view-screen.js +9 -0
- package/dist/actions/view-screen.js.map +1 -1
- package/dist/components/layout/Layout.d.ts.map +1 -1
- package/dist/components/layout/Layout.js +75 -70
- 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 +15 -2
- package/dist/components/messaging-setup-panel.js.map +1 -1
- package/dist/routes/index.d.ts.map +1 -1
- package/dist/routes/index.js +1 -0
- package/dist/routes/index.js.map +1 -1
- package/dist/routes/pages/operations.d.ts +5 -0
- package/dist/routes/pages/operations.d.ts.map +1 -0
- package/dist/routes/pages/operations.js +51 -0
- package/dist/routes/pages/operations.js.map +1 -0
- package/dist/routes/pages/overview.d.ts +2 -2
- package/dist/server/lib/dispatch-routing.js +1 -1
- package/dist/server/lib/dispatch-routing.js.map +1 -1
- package/dist/server/lib/env-config.js +1 -1
- package/dist/server/lib/env-config.js.map +1 -1
- package/package.json +2 -2
- package/src/actions/navigate.ts +1 -1
- package/src/actions/view-screen.ts +11 -0
- package/src/components/layout/Layout.spec.tsx +154 -0
- package/src/components/layout/Layout.tsx +196 -189
- package/src/components/messaging-setup-panel.spec.tsx +17 -1
- package/src/components/messaging-setup-panel.tsx +81 -1
- package/src/routes/index.spec.ts +23 -0
- package/src/routes/index.ts +1 -0
- package/src/routes/pages/operations.tsx +134 -0
- package/src/server/lib/dispatch-routing.spec.ts +2 -0
- package/src/server/lib/dispatch-routing.ts +1 -1
- package/src/server/lib/env-config.ts +1 -1
- package/src/styles/dispatch-css.spec.ts +11 -0
package/dist/actions/navigate.js
CHANGED
|
@@ -23,7 +23,7 @@ export default defineAction({
|
|
|
23
23
|
view: z
|
|
24
24
|
.string()
|
|
25
25
|
.optional()
|
|
26
|
-
.describe("Named dispatch view to navigate to. Built-in views include chat, overview, apps, metrics, new-app, vault, integrations, messaging, workspace, agents, destinations, identities, approvals, automations, audit, thread-debug, dreams, and team. Generated Dispatch extension tabs can also use their nav item id."),
|
|
26
|
+
.describe("Named dispatch view to navigate to. Built-in views include chat, overview, apps, operations (or monitoring, observability, database), metrics, new-app, vault, integrations, messaging, workspace, agents, destinations, identities, approvals, automations, audit, thread-debug, dreams, and team. Generated Dispatch extension tabs can also use their nav item id."),
|
|
27
27
|
path: z.string().optional().describe("URL path to navigate to"),
|
|
28
28
|
threadId: z
|
|
29
29
|
.string()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigate.js","sourceRoot":"","sources":["../../src/actions/navigate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAe,YAAY,CAAC;IAC1B,WAAW,EACT,gMAAgM;IAClM,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,IAAI,EAAE,CAAC;aACJ,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CACP,
|
|
1
|
+
{"version":3,"file":"navigate.js","sourceRoot":"","sources":["../../src/actions/navigate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAe,YAAY,CAAC;IAC1B,WAAW,EACT,gMAAgM;IAClM,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,IAAI,EAAE,CAAC;aACJ,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CACP,uWAAuW,CACxW;QACH,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,yBAAyB,CAAC;QAC/D,QAAQ,EAAE,CAAC;aACR,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CAAC,0CAA0C,CAAC;KACxD,CAAC;IACF,IAAI,EAAE,KAAK;IACX,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;QAClB,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC;QACvC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAC1C,OAAO,4DAA4D,CAAC;QACtE,CAAC;QACD,MAAM,GAAG,GAA2B,EAAE,CAAC;QACvC,iEAAiE;QACjE,IAAI,IAAI,CAAC,IAAI;YAAE,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;aAC/B,IAAI,QAAQ;YAAE,GAAG,CAAC,IAAI,GAAG,MAAM,CAAC;QACrC,IAAI,IAAI,CAAC,IAAI;YAAE,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACpC,IAAI,QAAQ;YAAE,GAAG,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACtC,MAAM,aAAa,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;QACrC,OAAO,iBAAiB,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,IAAI,eAAe,QAAQ,EAAE,EAAE,CAAC;IAChF,CAAC;CACF,CAAC,CAAC","sourcesContent":["/**\n * Navigate the UI to a view.\n *\n * Writes a navigate command to application state which the UI reads and auto-deletes.\n *\n * Usage:\n * pnpm action navigate --view=overview\n * pnpm action navigate --view=dreams\n * pnpm action navigate --view=<custom-dispatch-extension-id>\n * pnpm action navigate --path=/some/route\n *\n * Options:\n * --view View name to navigate to\n * --path URL path to navigate to\n * --threadId Chat thread ID to open on the chat route\n */\n\nimport { defineAction } from \"@agent-native/core\";\nimport { writeAppState } from \"@agent-native/core/application-state\";\nimport { z } from \"zod\";\n\nexport default defineAction({\n description:\n \"Navigate the UI to a specific view or path. Use threadId to open a specific chat thread on the chat route. Writes a navigate command to application state which the UI reads and auto-deletes.\",\n schema: z.object({\n view: z\n .string()\n .optional()\n .describe(\n \"Named dispatch view to navigate to. Built-in views include chat, overview, apps, operations (or monitoring, observability, database), metrics, new-app, vault, integrations, messaging, workspace, agents, destinations, identities, approvals, automations, audit, thread-debug, dreams, and team. Generated Dispatch extension tabs can also use their nav item id.\",\n ),\n path: z.string().optional().describe(\"URL path to navigate to\"),\n threadId: z\n .string()\n .optional()\n .describe(\"Chat thread ID to open on the chat route\"),\n }),\n http: false,\n run: async (args) => {\n const threadId = args.threadId?.trim();\n if (!args.view && !args.path && !threadId) {\n return \"Error: At least --view, --path, or --threadId is required.\";\n }\n const nav: Record<string, string> = {};\n // A thread id without an explicit view implies the chat surface.\n if (args.view) nav.view = args.view;\n else if (threadId) nav.view = \"chat\";\n if (args.path) nav.path = args.path;\n if (threadId) nav.threadId = threadId;\n await writeAppState(\"navigate\", nav);\n return `Navigating to ${args.view || args.path || `chat thread ${threadId}`}`;\n },\n});\n"]}
|
|
@@ -62,6 +62,15 @@ export default defineAction({
|
|
|
62
62
|
screen.connectedAgents = connectedAgents;
|
|
63
63
|
screen.mcpAppAccess = mcpAccess;
|
|
64
64
|
}
|
|
65
|
+
if (navigation?.view === "operations") {
|
|
66
|
+
const nav = navigation;
|
|
67
|
+
screen.operatorConsole = {
|
|
68
|
+
view: nav.operationsView === "database" ? "database" : "monitoring",
|
|
69
|
+
monitoring: "The shared observability dashboard provides traces, conversations, evaluations, experiments, and feedback.",
|
|
70
|
+
database: "The shared database admin is available in Code mode for table browsing and SQL inspection.",
|
|
71
|
+
relatedTools: ["thread-debug", "audit", "destinations", "automations"],
|
|
72
|
+
};
|
|
73
|
+
}
|
|
65
74
|
if (navigation?.view === "overview" ||
|
|
66
75
|
navigation?.view === "metrics" ||
|
|
67
76
|
navigation?.view === "apps" ||
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"view-screen.js","sourceRoot":"","sources":["../../src/actions/view-screen.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,EACL,iBAAiB,EACjB,WAAW,EACX,UAAU,EACV,YAAY,EACZ,sBAAsB,GACvB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,4BAA4B,EAC5B,4BAA4B,GAC7B,MAAM,4CAA4C,CAAC;AAEpD,KAAK,UAAU,sBAAsB,CACnC,IAAY,EACZ,IAA6B;IAE7B,MAAM,UAAU,GAAG,KAAK,IAAI,KAAK,CAAC;IAClC,MAAM,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAI1D,CAAC;IACF,IAAI,CAAC,MAAM,CAAC,OAAO;QAAE,MAAM,IAAI,KAAK,CAAC,8BAA8B,IAAI,EAAE,CAAC,CAAC;IAC3E,OAAO,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC;AAClD,CAAC;AAED,SAAS,cAAc,CAAC,IAA6B;IACnD,OAAO,MAAM,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AAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAC3D,CAAC;QACH,CAAC;QAED,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACrC,OAAO,iDAAiD,CAAC;QAC3D,CAAC;QACD,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACzC,CAAC;CACF,CAAC,CAAC","sourcesContent":["/**\n * See what the user is currently looking at on screen.\n *\n * Reads and returns the current navigation state from application state.\n *\n * Usage:\n * pnpm action view-screen\n */\n\nimport { defineAction } from \"@agent-native/core\";\nimport { readAppState } from \"@agent-native/core/application-state\";\nimport { z } from \"zod\";\n\nimport { listWorkspaceApps } from \"../server/lib/app-creation-store.js\";\nimport { listOverview } from \"../server/lib/dispatch-store.js\";\nimport {\n getAgentThreadDebug,\n listThreadDebugSources,\n searchAgentThreads,\n} from \"../server/lib/thread-debug-store.js\";\nimport { listDispatchUsageMetrics } from \"../server/lib/usage-metrics-store.js\";\nimport {\n listVaultOverview,\n listSecrets,\n listGrants,\n listRequests,\n getVaultAccessSettings,\n} from \"../server/lib/vault-store.js\";\nimport {\n listWorkspaceResourceOptions,\n listWorkspaceResourcesForApp,\n} from \"../server/lib/workspace-resources-store.js\";\n\nasync function runLocalDispatchAction(\n name: string,\n args: Record<string, unknown>,\n) {\n const modulePath = `./${name}.js`;\n const module = (await import(/* @vite-ignore */ modulePath)) as {\n default?: {\n run: (args: Record<string, unknown>) => unknown | Promise<unknown>;\n };\n };\n if (!module.default) throw new Error(`Dispatch action not found: ${name}`);\n return module.default.run(stripUndefined(args));\n}\n\nfunction stripUndefined(args: Record<string, unknown>) {\n return Object.fromEntries(\n Object.entries(args).filter(([, value]) => value !== undefined),\n );\n}\n\nexport default defineAction({\n description:\n \"See what the user is currently looking at in the dispatch UI, including navigation state and a compact operational summary.\",\n schema: z.object({}),\n http: false,\n run: async () => {\n const [navigation, overview, vaultOverview] = await Promise.all([\n readAppState(\"navigation\"),\n listOverview(),\n listVaultOverview(),\n ]);\n\n const screen: Record<string, unknown> = {\n counts: { ...overview.counts, ...vaultOverview },\n approvalPolicy: overview.settings,\n };\n if (navigation) screen.navigation = navigation;\n if (navigation?.view === \"chat\") {\n screen.chatSurface = {\n view: \"full-page Dispatch chat\",\n purpose:\n \"Create apps, manage workspace resources, route work to connected agents, and continue Dispatch conversations.\",\n };\n }\n if (navigation?.view === \"overview\") {\n screen.recentAudit = overview.recentAudit.slice(0, 5);\n screen.recentApprovals = overview.recentApprovals.slice(0, 5);\n }\n if (navigation?.view === \"destinations\") {\n screen.recentDestinations = overview.recentDestinations;\n }\n if (navigation?.view === \"agents\") {\n const [connectedAgents, mcpAccess] = await Promise.all([\n runLocalDispatchAction(\"list-connected-agents\", {}),\n runLocalDispatchAction(\"list-mcp-app-access\", {}),\n ]);\n screen.connectedAgents = connectedAgents;\n screen.mcpAppAccess = mcpAccess;\n }\n if (\n navigation?.view === \"overview\" ||\n navigation?.view === \"metrics\" ||\n navigation?.view === \"apps\" ||\n navigation?.view === \"new-app\"\n ) {\n const workspaceApps = await listWorkspaceApps({\n includeAgentCards: true,\n });\n screen.workspaceApps = workspaceApps;\n if (navigation?.view === \"apps\") {\n screen.workspaceAppResources = await Promise.all(\n workspaceApps\n .filter((app) => !app.isDispatch)\n .slice(0, 12)\n .map(async (app) => {\n const result = await listWorkspaceResourcesForApp(app.id);\n return {\n appId: app.id,\n appName: app.name,\n counts: result.counts,\n resources: result.resources.map((resource) => ({\n name: resource.name,\n path: resource.path,\n kind: resource.kind,\n source: resource.source,\n autoLoaded: resource.autoLoaded,\n })),\n };\n }),\n );\n }\n }\n if (navigation?.view === \"metrics\") {\n try {\n const metrics = await listDispatchUsageMetrics({ sinceDays: 30 });\n screen.usageMetrics = {\n billing: metrics.billing,\n totals: metrics.totals,\n byApp: metrics.byApp.slice(0, 8),\n byUser: metrics.byUser.slice(0, 8),\n appAccess: metrics.appAccess\n .filter((app) => !app.isDispatch)\n .slice(0, 8),\n };\n } catch (error) {\n screen.usageMetricsError =\n error instanceof Error ? error.message : String(error);\n }\n }\n if (navigation?.view === \"vault\" || navigation?.view === \"new-app\") {\n const [secrets, grants, requests, access] = await Promise.all([\n listSecrets(),\n listGrants(),\n listRequests({ status: \"pending\" }),\n getVaultAccessSettings(),\n ]);\n screen.vaultAccessMode = access.mode;\n screen.vaultSecrets = secrets.map((s) => ({\n id: s.id,\n name: s.name,\n credentialKey: s.credentialKey,\n provider: s.provider,\n }));\n screen.vaultActiveGrants = grants\n .filter((g) => g.status === \"active\")\n .map((g) => ({ secretId: g.secretId, appId: g.appId }));\n screen.vaultPendingRequests = requests;\n }\n if (navigation?.view === \"workspace\" || navigation?.view === \"new-app\") {\n screen.workspaceResources = await listWorkspaceResourceOptions();\n screen.workspaceResourceEffectiveContext = {\n action: \"get-workspace-resource-effective-context\",\n description:\n \"Preview workspace -> organization/app -> personal precedence for a resource path and optional app/user. All-app resources are inherited at runtime; selected resources are app-specific exceptions.\",\n };\n screen.workspaceResourceImpactPreview = {\n action: \"preview-workspace-resource-change\",\n description:\n \"Preview All-app reach, overrides, and approval behavior before creating, updating, or deleting a workspace resource.\",\n };\n }\n if (navigation?.view === \"thread-debug\") {\n try {\n const nav = navigation as Record<string, any>;\n screen.threadDebugSources = await listThreadDebugSources();\n if (nav.query) {\n screen.threadDebugResults = await searchAgentThreads({\n sourceId: nav.sourceId,\n query: nav.query,\n ownerEmail: nav.ownerEmail,\n limit: 10,\n });\n }\n if (nav.threadId) {\n const detail = await getAgentThreadDebug({\n sourceId: nav.sourceId,\n threadId: nav.threadId,\n ownerEmail: nav.ownerEmail,\n maxRuns: 5,\n maxEvents: 80,\n maxTraceSpans: 50,\n });\n screen.threadDebugSelection = {\n source: detail.source,\n thread: detail.thread,\n messageCount: detail.messages.length,\n runCount: detail.runs.length,\n debug: detail.debug,\n debugRuns: (detail as any).debugRuns?.slice(-5) ?? [],\n messages: detail.messages.slice(-6),\n };\n }\n } catch (error) {\n screen.threadDebugError =\n error instanceof Error ? error.message : String(error);\n }\n }\n if (navigation?.view === \"dreams\") {\n try {\n const nav = navigation as Record<string, any>;\n const [sources, candidates, dreams, settings] = await Promise.all([\n listThreadDebugSources(),\n runLocalDispatchAction(\"list-dream-candidates\", {\n sourceId: nav.sourceId,\n ownerEmail: nav.ownerEmail,\n limit: 10,\n }),\n runLocalDispatchAction(\"list-dreams\", {\n status: nav.status,\n limit: 10,\n }),\n runLocalDispatchAction(\"get-dream-settings\", {}),\n ]);\n screen.dreamSources = sources;\n screen.dreamCandidates = candidates;\n screen.latestDreams = dreams;\n screen.dreamSettings = settings;\n\n const dreamId = nav.dreamId ?? nav.id;\n if (dreamId) {\n screen.dreamDetail = await runLocalDispatchAction(\"get-dream\", {\n id: dreamId,\n });\n }\n } catch (error) {\n screen.dreamsError =\n error instanceof Error ? error.message : String(error);\n }\n }\n\n if (Object.keys(screen).length === 0) {\n return \"No application state found. Is the app running?\";\n }\n return JSON.stringify(screen, null, 2);\n },\n});\n"]}
|
|
1
|
+
{"version":3,"file":"view-screen.js","sourceRoot":"","sources":["../../src/actions/view-screen.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,EACL,iBAAiB,EACjB,WAAW,EACX,UAAU,EACV,YAAY,EACZ,sBAAsB,GACvB,MAAM,8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ChE,sBAAsB,EAAE;oBACxB,sBAAsB,CAAC,uBAAuB,EAAE;wBAC9C,QAAQ,EAAE,GAAG,CAAC,QAAQ;wBACtB,UAAU,EAAE,GAAG,CAAC,UAAU;wBAC1B,KAAK,EAAE,EAAE;qBACV,CAAC;oBACF,sBAAsB,CAAC,aAAa,EAAE;wBACpC,MAAM,EAAE,GAAG,CAAC,MAAM;wBAClB,KAAK,EAAE,EAAE;qBACV,CAAC;oBACF,sBAAsB,CAAC,oBAAoB,EAAE,EAAE,CAAC;iBACjD,CAAC,CAAC;gBACH,MAAM,CAAC,YAAY,GAAG,OAAO,CAAC;gBAC9B,MAAM,CAAC,eAAe,GAAG,UAAU,CAAC;gBACpC,MAAM,CAAC,YAAY,GAAG,MAAM,CAAC;gBAC7B,MAAM,CAAC,aAAa,GAAG,QAAQ,CAAC;gBAEhC,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,EAAE,CAAC;gBACtC,IAAI,OAAO,EAAE,CAAC;oBACZ,MAAM,CAAC,WAAW,GAAG,MAAM,sBAAsB,CAAC,WAAW,EAAE;wBAC7D,EAAE,EAAE,OAAO;qBACZ,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,CAAC,WAAW;oBAChB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAC3D,CAAC;QACH,CAAC;QAED,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACrC,OAAO,iDAAiD,CAAC;QAC3D,CAAC;QACD,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACzC,CAAC;CACF,CAAC,CAAC","sourcesContent":["/**\n * See what the user is currently looking at on screen.\n *\n * Reads and returns the current navigation state from application state.\n *\n * Usage:\n * pnpm action view-screen\n */\n\nimport { defineAction } from \"@agent-native/core\";\nimport { readAppState } from \"@agent-native/core/application-state\";\nimport { z } from \"zod\";\n\nimport { listWorkspaceApps } from \"../server/lib/app-creation-store.js\";\nimport { listOverview } from \"../server/lib/dispatch-store.js\";\nimport {\n getAgentThreadDebug,\n listThreadDebugSources,\n searchAgentThreads,\n} from \"../server/lib/thread-debug-store.js\";\nimport { listDispatchUsageMetrics } from \"../server/lib/usage-metrics-store.js\";\nimport {\n listVaultOverview,\n listSecrets,\n listGrants,\n listRequests,\n getVaultAccessSettings,\n} from \"../server/lib/vault-store.js\";\nimport {\n listWorkspaceResourceOptions,\n listWorkspaceResourcesForApp,\n} from \"../server/lib/workspace-resources-store.js\";\n\nasync function runLocalDispatchAction(\n name: string,\n args: Record<string, unknown>,\n) {\n const modulePath = `./${name}.js`;\n const module = (await import(/* @vite-ignore */ modulePath)) as {\n default?: {\n run: (args: Record<string, unknown>) => unknown | Promise<unknown>;\n };\n };\n if (!module.default) throw new Error(`Dispatch action not found: ${name}`);\n return module.default.run(stripUndefined(args));\n}\n\nfunction stripUndefined(args: Record<string, unknown>) {\n return Object.fromEntries(\n Object.entries(args).filter(([, value]) => value !== undefined),\n );\n}\n\nexport default defineAction({\n description:\n \"See what the user is currently looking at in the dispatch UI, including navigation state and a compact operational summary.\",\n schema: z.object({}),\n http: false,\n run: async () => {\n const [navigation, overview, vaultOverview] = await Promise.all([\n readAppState(\"navigation\"),\n listOverview(),\n listVaultOverview(),\n ]);\n\n const screen: Record<string, unknown> = {\n counts: { ...overview.counts, ...vaultOverview },\n approvalPolicy: overview.settings,\n };\n if (navigation) screen.navigation = navigation;\n if (navigation?.view === \"chat\") {\n screen.chatSurface = {\n view: \"full-page Dispatch chat\",\n purpose:\n \"Create apps, manage workspace resources, route work to connected agents, and continue Dispatch conversations.\",\n };\n }\n if (navigation?.view === \"overview\") {\n screen.recentAudit = overview.recentAudit.slice(0, 5);\n screen.recentApprovals = overview.recentApprovals.slice(0, 5);\n }\n if (navigation?.view === \"destinations\") {\n screen.recentDestinations = overview.recentDestinations;\n }\n if (navigation?.view === \"agents\") {\n const [connectedAgents, mcpAccess] = await Promise.all([\n runLocalDispatchAction(\"list-connected-agents\", {}),\n runLocalDispatchAction(\"list-mcp-app-access\", {}),\n ]);\n screen.connectedAgents = connectedAgents;\n screen.mcpAppAccess = mcpAccess;\n }\n if (navigation?.view === \"operations\") {\n const nav = navigation as { operationsView?: string };\n screen.operatorConsole = {\n view: nav.operationsView === \"database\" ? \"database\" : \"monitoring\",\n monitoring:\n \"The shared observability dashboard provides traces, conversations, evaluations, experiments, and feedback.\",\n database:\n \"The shared database admin is available in Code mode for table browsing and SQL inspection.\",\n relatedTools: [\"thread-debug\", \"audit\", \"destinations\", \"automations\"],\n };\n }\n if (\n navigation?.view === \"overview\" ||\n navigation?.view === \"metrics\" ||\n navigation?.view === \"apps\" ||\n navigation?.view === \"new-app\"\n ) {\n const workspaceApps = await listWorkspaceApps({\n includeAgentCards: true,\n });\n screen.workspaceApps = workspaceApps;\n if (navigation?.view === \"apps\") {\n screen.workspaceAppResources = await Promise.all(\n workspaceApps\n .filter((app) => !app.isDispatch)\n .slice(0, 12)\n .map(async (app) => {\n const result = await listWorkspaceResourcesForApp(app.id);\n return {\n appId: app.id,\n appName: app.name,\n counts: result.counts,\n resources: result.resources.map((resource) => ({\n name: resource.name,\n path: resource.path,\n kind: resource.kind,\n source: resource.source,\n autoLoaded: resource.autoLoaded,\n })),\n };\n }),\n );\n }\n }\n if (navigation?.view === \"metrics\") {\n try {\n const metrics = await listDispatchUsageMetrics({ sinceDays: 30 });\n screen.usageMetrics = {\n billing: metrics.billing,\n totals: metrics.totals,\n byApp: metrics.byApp.slice(0, 8),\n byUser: metrics.byUser.slice(0, 8),\n appAccess: metrics.appAccess\n .filter((app) => !app.isDispatch)\n .slice(0, 8),\n };\n } catch (error) {\n screen.usageMetricsError =\n error instanceof Error ? error.message : String(error);\n }\n }\n if (navigation?.view === \"vault\" || navigation?.view === \"new-app\") {\n const [secrets, grants, requests, access] = await Promise.all([\n listSecrets(),\n listGrants(),\n listRequests({ status: \"pending\" }),\n getVaultAccessSettings(),\n ]);\n screen.vaultAccessMode = access.mode;\n screen.vaultSecrets = secrets.map((s) => ({\n id: s.id,\n name: s.name,\n credentialKey: s.credentialKey,\n provider: s.provider,\n }));\n screen.vaultActiveGrants = grants\n .filter((g) => g.status === \"active\")\n .map((g) => ({ secretId: g.secretId, appId: g.appId }));\n screen.vaultPendingRequests = requests;\n }\n if (navigation?.view === \"workspace\" || navigation?.view === \"new-app\") {\n screen.workspaceResources = await listWorkspaceResourceOptions();\n screen.workspaceResourceEffectiveContext = {\n action: \"get-workspace-resource-effective-context\",\n description:\n \"Preview workspace -> organization/app -> personal precedence for a resource path and optional app/user. All-app resources are inherited at runtime; selected resources are app-specific exceptions.\",\n };\n screen.workspaceResourceImpactPreview = {\n action: \"preview-workspace-resource-change\",\n description:\n \"Preview All-app reach, overrides, and approval behavior before creating, updating, or deleting a workspace resource.\",\n };\n }\n if (navigation?.view === \"thread-debug\") {\n try {\n const nav = navigation as Record<string, any>;\n screen.threadDebugSources = await listThreadDebugSources();\n if (nav.query) {\n screen.threadDebugResults = await searchAgentThreads({\n sourceId: nav.sourceId,\n query: nav.query,\n ownerEmail: nav.ownerEmail,\n limit: 10,\n });\n }\n if (nav.threadId) {\n const detail = await getAgentThreadDebug({\n sourceId: nav.sourceId,\n threadId: nav.threadId,\n ownerEmail: nav.ownerEmail,\n maxRuns: 5,\n maxEvents: 80,\n maxTraceSpans: 50,\n });\n screen.threadDebugSelection = {\n source: detail.source,\n thread: detail.thread,\n messageCount: detail.messages.length,\n runCount: detail.runs.length,\n debug: detail.debug,\n debugRuns: (detail as any).debugRuns?.slice(-5) ?? [],\n messages: detail.messages.slice(-6),\n };\n }\n } catch (error) {\n screen.threadDebugError =\n error instanceof Error ? error.message : String(error);\n }\n }\n if (navigation?.view === \"dreams\") {\n try {\n const nav = navigation as Record<string, any>;\n const [sources, candidates, dreams, settings] = await Promise.all([\n listThreadDebugSources(),\n runLocalDispatchAction(\"list-dream-candidates\", {\n sourceId: nav.sourceId,\n ownerEmail: nav.ownerEmail,\n limit: 10,\n }),\n runLocalDispatchAction(\"list-dreams\", {\n status: nav.status,\n limit: 10,\n }),\n runLocalDispatchAction(\"get-dream-settings\", {}),\n ]);\n screen.dreamSources = sources;\n screen.dreamCandidates = candidates;\n screen.latestDreams = dreams;\n screen.dreamSettings = settings;\n\n const dreamId = nav.dreamId ?? nav.id;\n if (dreamId) {\n screen.dreamDetail = await runLocalDispatchAction(\"get-dream\", {\n id: dreamId,\n });\n }\n } catch (error) {\n screen.dreamsError =\n error instanceof Error ? error.message : String(error);\n }\n }\n\n if (Object.keys(screen).length === 0) {\n return \"No application state found. Is the app running?\";\n }\n return JSON.stringify(screen, null, 2);\n },\n});\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Layout.d.ts","sourceRoot":"","sources":["../../../src/components/layout/Layout.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Layout.d.ts","sourceRoot":"","sources":["../../../src/components/layout/Layout.tsx"],"names":[],"mappings":"AA2CA,OAAO,EAKL,KAAK,aAAa,EAElB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAiBf,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,uEAAuE;IACvE,EAAE,EAAE,MAAM,CAAC;IACX,iFAAiF;IACjF,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,mFAAmF;IACnF,OAAO,CAAC,EAAE,kBAAkB,CAAC;IAC7B,gEAAgE;IAChE,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;CACvC;AAED,MAAM,WAAW,uBAAuB;IACtC,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,SAAS,eAAe,EAAE,CAAC;IACtC,kFAAkF;IAClF,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC/B;AAkeD,wBAAgB,UAAU,CAAC,EACzB,UAAU,EACV,UAAU,EACV,SAAiB,EACjB,WAAmB,EACnB,iBAAiB,GAClB,EAAE;IACD,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,UAAU,CAAC,EAAE,uBAAuB,CAAC;IACrC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,iBAAiB,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;CAClD,mDA6PA;AAED,wBAAgB,MAAM,CAAC,EACrB,QAAQ,EACR,UAAU,GACX,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;IACpB,UAAU,CAAC,EAAE,uBAAuB,CAAC;CACtC,mDA2IA"}
|
|
@@ -2,13 +2,14 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import { AgentSidebar, FeedbackButton, appBasePath, appPath, focusAgentChat, navigateWithAgentChatViewTransition, useActionQuery, useAgentChatHomeHandoff, useAgentChatHomeHandoffLinks, useChatThreads, useFormatters, useT, } from "@agent-native/core/client";
|
|
3
3
|
import { ExtensionsSidebarSection } from "@agent-native/core/client/extensions";
|
|
4
4
|
import { InvitationBanner, OrgSwitcher } from "@agent-native/core/client/org";
|
|
5
|
-
import { IconArrowUpRight, IconApps, IconBrain, IconChartBar, IconBrandTelegram, IconKey, IconChevronDown, IconDots, IconEdit, IconLayersSubtract, IconMessageQuestion, IconMessages, IconPlus, IconPlugConnected, IconBroadcast, IconFingerprint, IconHistory, IconLayoutSidebarLeftCollapse, IconLayoutSidebarLeftExpand, IconPuzzle, IconSettings, IconSettingsAutomation, IconShieldCheck, } from "@tabler/icons-react";
|
|
5
|
+
import { IconActivity, IconArrowUpRight, IconApps, IconBrain, IconChartBar, IconBrandTelegram, IconKey, IconChevronDown, IconDots, IconEdit, IconLayersSubtract, IconMessageQuestion, IconMessages, IconPlus, IconPlugConnected, IconBroadcast, IconFingerprint, IconHistory, IconLayoutSidebarLeftCollapse, IconLayoutSidebarLeftExpand, IconPuzzle, IconSettings, IconSettingsAutomation, IconShieldCheck, } from "@tabler/icons-react";
|
|
6
6
|
import { useEffect, useMemo, useRef, useState, } from "react";
|
|
7
7
|
import { NavLink, useLocation, useNavigate } from "react-router";
|
|
8
8
|
import { cn } from "../../lib/utils.js";
|
|
9
9
|
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, } from "../ui/dropdown-menu.js";
|
|
10
10
|
import { Input } from "../ui/input.js";
|
|
11
11
|
import { Sheet, SheetContent, SheetDescription, SheetTitle } from "../ui/sheet.js";
|
|
12
|
+
import { Skeleton } from "../ui/skeleton.js";
|
|
12
13
|
import { Tooltip, TooltipContent, TooltipTrigger } from "../ui/tooltip.js";
|
|
13
14
|
import { Header } from "./Header.js";
|
|
14
15
|
import { HeaderActionsProvider } from "./HeaderActions.js";
|
|
@@ -34,36 +35,64 @@ const PRIMARY_NAV_ITEMS = [
|
|
|
34
35
|
icon: IconApps,
|
|
35
36
|
section: "primary",
|
|
36
37
|
},
|
|
38
|
+
];
|
|
39
|
+
const OPERATIONS_NAV_ITEMS = [
|
|
40
|
+
{
|
|
41
|
+
id: "operations",
|
|
42
|
+
to: "/operations",
|
|
43
|
+
label: "Operations",
|
|
44
|
+
icon: IconActivity,
|
|
45
|
+
section: "operations",
|
|
46
|
+
},
|
|
37
47
|
{
|
|
38
48
|
id: "metrics",
|
|
39
49
|
to: "/metrics",
|
|
40
50
|
label: "Metrics",
|
|
41
51
|
icon: IconChartBar,
|
|
42
|
-
section: "
|
|
52
|
+
section: "operations",
|
|
43
53
|
},
|
|
44
54
|
{
|
|
45
|
-
id: "
|
|
46
|
-
to: "/
|
|
47
|
-
label: "
|
|
48
|
-
icon:
|
|
49
|
-
section: "
|
|
55
|
+
id: "automations",
|
|
56
|
+
to: "/automations",
|
|
57
|
+
label: "Automations",
|
|
58
|
+
icon: IconSettingsAutomation,
|
|
59
|
+
section: "operations",
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
id: "approvals",
|
|
63
|
+
to: "/approvals",
|
|
64
|
+
label: "Approvals",
|
|
65
|
+
icon: IconShieldCheck,
|
|
66
|
+
section: "operations",
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
id: "destinations",
|
|
70
|
+
to: "/destinations",
|
|
71
|
+
label: "Destinations",
|
|
72
|
+
icon: IconArrowUpRight,
|
|
73
|
+
section: "operations",
|
|
50
74
|
},
|
|
51
75
|
{
|
|
52
76
|
id: "integrations",
|
|
53
77
|
to: "/integrations",
|
|
54
78
|
label: "Integrations",
|
|
55
79
|
icon: IconPuzzle,
|
|
56
|
-
section: "
|
|
80
|
+
section: "operations",
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
id: "vault",
|
|
84
|
+
to: "/vault",
|
|
85
|
+
label: "Vault",
|
|
86
|
+
icon: IconKey,
|
|
87
|
+
section: "operations",
|
|
57
88
|
},
|
|
58
89
|
{
|
|
59
90
|
id: "agents",
|
|
60
91
|
to: "/agents",
|
|
61
92
|
label: "Agents",
|
|
62
93
|
icon: IconPlugConnected,
|
|
63
|
-
section: "
|
|
94
|
+
section: "operations",
|
|
64
95
|
},
|
|
65
|
-
];
|
|
66
|
-
const OPERATIONS_NAV_ITEMS = [
|
|
67
96
|
{
|
|
68
97
|
id: "workspace",
|
|
69
98
|
to: "/workspace",
|
|
@@ -71,6 +100,15 @@ const OPERATIONS_NAV_ITEMS = [
|
|
|
71
100
|
icon: IconLayersSubtract,
|
|
72
101
|
section: "operations",
|
|
73
102
|
},
|
|
103
|
+
{
|
|
104
|
+
id: "settings",
|
|
105
|
+
to: "/settings",
|
|
106
|
+
label: "Settings",
|
|
107
|
+
icon: IconSettings,
|
|
108
|
+
section: "operations",
|
|
109
|
+
},
|
|
110
|
+
];
|
|
111
|
+
const ADVANCED_NAV_ITEMS = [
|
|
74
112
|
{
|
|
75
113
|
id: "messaging",
|
|
76
114
|
to: "/messaging",
|
|
@@ -78,13 +116,6 @@ const OPERATIONS_NAV_ITEMS = [
|
|
|
78
116
|
icon: IconBrandTelegram,
|
|
79
117
|
section: "operations",
|
|
80
118
|
},
|
|
81
|
-
{
|
|
82
|
-
id: "destinations",
|
|
83
|
-
to: "/destinations",
|
|
84
|
-
label: "Destinations",
|
|
85
|
-
icon: IconArrowUpRight,
|
|
86
|
-
section: "operations",
|
|
87
|
-
},
|
|
88
119
|
{
|
|
89
120
|
id: "identities",
|
|
90
121
|
to: "/identities",
|
|
@@ -92,20 +123,6 @@ const OPERATIONS_NAV_ITEMS = [
|
|
|
92
123
|
icon: IconFingerprint,
|
|
93
124
|
section: "operations",
|
|
94
125
|
},
|
|
95
|
-
{
|
|
96
|
-
id: "approvals",
|
|
97
|
-
to: "/approvals",
|
|
98
|
-
label: "Approvals",
|
|
99
|
-
icon: IconShieldCheck,
|
|
100
|
-
section: "operations",
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
id: "automations",
|
|
104
|
-
to: "/automations",
|
|
105
|
-
label: "Automations",
|
|
106
|
-
icon: IconSettingsAutomation,
|
|
107
|
-
section: "operations",
|
|
108
|
-
},
|
|
109
126
|
{
|
|
110
127
|
id: "audit",
|
|
111
128
|
to: "/audit",
|
|
@@ -127,13 +144,6 @@ const OPERATIONS_NAV_ITEMS = [
|
|
|
127
144
|
icon: IconMessages,
|
|
128
145
|
section: "operations",
|
|
129
146
|
},
|
|
130
|
-
{
|
|
131
|
-
id: "settings",
|
|
132
|
-
to: "/settings",
|
|
133
|
-
label: "Settings",
|
|
134
|
-
icon: IconSettings,
|
|
135
|
-
section: "operations",
|
|
136
|
-
},
|
|
137
147
|
];
|
|
138
148
|
const EMPTY_NAV_ITEMS = [];
|
|
139
149
|
const CHROMELESS_PATHS = ["/approval"];
|
|
@@ -241,7 +251,7 @@ function DispatchChatsSection({ onNavigate }) {
|
|
|
241
251
|
const { formatDate } = useFormatters();
|
|
242
252
|
const navigate = useNavigate();
|
|
243
253
|
const location = useLocation();
|
|
244
|
-
const { threads, activeThreadId, createThread, switchThread, renameThread, refreshThreads, } = useChatThreads(undefined, "dispatch", undefined, { autoCreate: false });
|
|
254
|
+
const { threads, activeThreadId, isLoading: chatsLoading, createThread, switchThread, renameThread, refreshThreads, } = useChatThreads(undefined, "dispatch", undefined, { autoCreate: false });
|
|
245
255
|
const [renamingThreadId, setRenamingThreadId] = useState(null);
|
|
246
256
|
const [renameDraft, setRenameDraft] = useState("");
|
|
247
257
|
const renameInputRef = useRef(null);
|
|
@@ -317,27 +327,28 @@ function DispatchChatsSection({ onNavigate }) {
|
|
|
317
327
|
event.preventDefault();
|
|
318
328
|
void commitRenameThread();
|
|
319
329
|
}
|
|
320
|
-
return (_jsxs("div", { className: "
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
330
|
+
return (_jsxs("div", { className: "ms-4 min-w-0 space-y-0.5", children: [chatsLoading &&
|
|
331
|
+
visibleThreads.length === 0 &&
|
|
332
|
+
Array.from({ length: 3 }).map((_, index) => (_jsxs("div", { className: "flex items-center gap-2 px-3 py-1", children: [_jsx(Skeleton, { className: "size-3.5 shrink-0 rounded-sm" }), _jsx(Skeleton, { className: "h-3 w-3/4 rounded" })] }, `chat-skeleton-${index}`))), visibleThreads.map((thread) => {
|
|
333
|
+
const localPathname = localDispatchPath(location.pathname);
|
|
334
|
+
const isActive = thread.id ===
|
|
335
|
+
(threadIdFromPath(localPathname) ??
|
|
336
|
+
(localPathname === "/chat" ? null : activeThreadId));
|
|
337
|
+
const isRenaming = thread.id === renamingThreadId;
|
|
338
|
+
const title = threadTitle(thread, t("dispatch.sidebar.newChat"));
|
|
339
|
+
return (_jsx("div", { className: cn("group/item relative flex min-w-0 items-center rounded-lg transition-colors", isActive
|
|
340
|
+
? "bg-sidebar-accent text-sidebar-accent-foreground"
|
|
341
|
+
: "text-muted-foreground hover:bg-sidebar-accent/50 hover:text-foreground"), children: isRenaming ? (_jsx("form", { onSubmit: handleRenameSubmit, className: "flex min-w-0 flex-1 items-center px-1", children: _jsx(Input, { ref: renameInputRef, value: renameDraft, onChange: (event) => setRenameDraft(event.target.value), onBlur: () => void commitRenameThread(), onKeyDown: (event) => {
|
|
342
|
+
if (event.key === "Escape") {
|
|
343
|
+
event.preventDefault();
|
|
344
|
+
cancelRenameThread();
|
|
345
|
+
}
|
|
346
|
+
}, maxLength: 160, "aria-label": t("dispatch.sidebar.renameThread", { title }), className: "h-6 min-w-0 rounded-sm border-sidebar-border bg-background px-1.5 text-xs" }) })) : (_jsxs(_Fragment, { children: [_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("button", { type: "button", onClick: () => openThread(thread.id), className: "min-w-0 flex-1 cursor-pointer px-2 py-1.5 pe-12 text-start text-xs outline-none focus-visible:ring-2 focus-visible:ring-ring", children: _jsx("span", { className: "block min-w-0 truncate", children: title }) }) }), _jsx(TooltipContent, { side: "right", children: title })] }), _jsxs("div", { className: "pointer-events-none absolute end-1 top-1/2 flex -translate-y-1/2 items-center gap-0.5", children: [_jsx("span", { className: "pointer-events-none pe-1 text-[11px] text-muted-foreground/60 transition-opacity group-hover/item:opacity-0 group-focus-within/item:opacity-0", children: isActive
|
|
347
|
+
? ""
|
|
348
|
+
: formatThreadAge(threadUpdatedAt(thread), formatDate) }), _jsxs(DropdownMenu, { children: [_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(DropdownMenuTrigger, { asChild: true, children: _jsx("button", { type: "button", "aria-label": t("dispatch.sidebar.chatOptions", {
|
|
349
|
+
title,
|
|
350
|
+
}), className: "pointer-events-auto rounded p-0.5 text-muted-foreground/50 opacity-0 transition-all hover:text-foreground focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring group-hover/item:opacity-100 group-focus-within/item:opacity-100 data-[state=open]:opacity-100 data-[state=open]:text-foreground", children: _jsx(IconDots, { className: "size-3" }) }) }) }), _jsx(TooltipContent, { side: "right", children: t("dispatch.sidebar.chatOptions", { title }) })] }), _jsx(DropdownMenuContent, { align: "start", side: "right", className: "w-44", children: _jsxs(DropdownMenuItem, { onSelect: () => startRenameThread(thread), children: [_jsx(IconEdit, { className: "size-3.5" }), t("dispatch.sidebar.renameChat")] }) })] })] })] })) }, thread.id));
|
|
351
|
+
}), _jsxs("button", { type: "button", onClick: () => void handleNewChat(), className: "flex w-full cursor-pointer items-center gap-2 rounded-lg px-3 py-1.5 text-xs text-muted-foreground/60 transition-colors hover:bg-sidebar-accent/50 hover:text-foreground", children: [_jsx(IconPlus, { className: "size-3 shrink-0" }), _jsx("span", { className: "truncate", children: t("dispatch.sidebar.newChat") })] })] }));
|
|
341
352
|
}
|
|
342
353
|
export function NavContent({ onNavigate, extensions, collapsed = false, collapsible = false, onCollapsedChange, }) {
|
|
343
354
|
const t = useT();
|
|
@@ -356,7 +367,7 @@ export function NavContent({ onNavigate, extensions, collapsed = false, collapsi
|
|
|
356
367
|
...navItemsForSection(extensionNavItems, "operations"),
|
|
357
368
|
];
|
|
358
369
|
const localPathname = localDispatchPath(location.pathname);
|
|
359
|
-
const
|
|
370
|
+
const advancedOpen = ADVANCED_NAV_ITEMS.some((item) => navItemMatchesPath(item, localPathname));
|
|
360
371
|
const navLabel = (item) => {
|
|
361
372
|
const key = item.id === "thread-debug"
|
|
362
373
|
? "threadDebug"
|
|
@@ -407,17 +418,11 @@ export function NavContent({ onNavigate, extensions, collapsed = false, collapsi
|
|
|
407
418
|
: "text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground");
|
|
408
419
|
}, children: [Icon ? (_jsx(Icon, { size: 16, className: "shrink-0" })) : (_jsx("span", { className: "h-4 w-4 shrink-0", "aria-hidden": "true" })), _jsx("span", { className: "truncate", children: label })] })), !collapsed && item.id === "chat" && itemMatchesLocalPath ? (_jsx(DispatchChatsSection, { onNavigate: onNavigate })) : null] }, item.id));
|
|
409
420
|
};
|
|
410
|
-
return (_jsxs(_Fragment, { children: [_jsx("div", { className: cn("border-b py-3", collapsed ? "px-1" : "px-4"), children: _jsxs("div", { className: cn("flex items-center", collapsed ? "justify-center" : "gap-
|
|
411
|
-
? t("dispatch.sidebar.workspaceSubtitle", {
|
|
412
|
-
count: ws?.appCount ?? 0,
|
|
413
|
-
})
|
|
414
|
-
: t("dispatch.sidebar.workspaceControlPlane") })] })] })), collapsible ? (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("button", { type: "button", onClick: () => onCollapsedChange?.(!collapsed), "aria-label": collapsed
|
|
421
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { className: cn("border-b py-3", collapsed ? "px-1" : "px-4"), children: _jsxs("div", { className: cn("flex items-center", collapsed ? "justify-center" : "gap-2"), children: [!collapsed && (_jsxs(_Fragment, { children: [_jsx("img", { src: appPath("/agent-native-icon-light.svg"), alt: "", "aria-hidden": "true", className: "block h-5 w-auto shrink-0 dark:hidden" }), _jsx("img", { src: appPath("/agent-native-icon-dark.svg"), alt: "", "aria-hidden": "true", className: "hidden h-5 w-auto shrink-0 dark:block" }), _jsx("div", { className: "min-w-0 flex-1", children: _jsx("div", { className: "truncate text-lg font-bold tracking-tight text-foreground", children: workspaceLabel ?? "Dispatch" }) })] })), collapsible ? (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("button", { type: "button", onClick: () => onCollapsedChange?.(!collapsed), "aria-label": collapsed
|
|
415
422
|
? t("sidebar.expandSidebar")
|
|
416
423
|
: t("sidebar.collapseSidebar"), className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-sidebar-foreground/65 transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground", children: collapsed ? (_jsx(IconLayoutSidebarLeftExpand, { className: "h-4 w-4 rtl:-scale-x-100" })) : (_jsx(IconLayoutSidebarLeftCollapse, { className: "h-4 w-4 rtl:-scale-x-100" })) }) }), _jsx(TooltipContent, { side: "right", children: collapsed
|
|
417
424
|
? t("sidebar.expandSidebar")
|
|
418
|
-
: t("sidebar.collapseSidebar") })] })) : null] }) }), _jsxs("div", { className: "flex min-h-0 flex-1 flex-col overflow-y-auto", children: [
|
|
419
|
-
? [...primaryNavItems, ...operationsNavItems]
|
|
420
|
-
: primaryNavItems).map(renderNavItem) }) }), !collapsed ? (_jsxs("div", { className: "mt-auto shrink-0", children: [_jsx("div", { className: "px-2 py-2", children: _jsxs("details", { className: "group", open: operationsOpen, children: [_jsxs("summary", { className: "flex h-8 cursor-pointer list-none items-center justify-between rounded-md px-2 text-xs font-medium uppercase text-sidebar-foreground/50 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground [&::-webkit-details-marker]:hidden", children: [_jsx("span", { children: t("dispatch.nav.operations") }), _jsx(IconChevronDown, { size: 14, className: "transition-transform group-open:rotate-180" })] }), _jsx("ul", { className: "mt-1 space-y-0.5", children: operationsNavItems.map(renderNavItem) })] }) }), _jsx("div", { className: "px-2 py-1", children: _jsx(ExtensionsSidebarSection, {}) }), _jsx("div", { className: "px-3 py-2", children: _jsx(OrgSwitcher, {}) }), _jsx("div", { className: "px-3 py-2", children: _jsx(FeedbackButton, {}) })] })) : null] })] }));
|
|
425
|
+
: t("sidebar.collapseSidebar") })] })) : null] }) }), _jsxs("div", { className: "flex min-h-0 flex-1 flex-col overflow-y-auto", children: [_jsxs("nav", { className: cn("py-3", collapsed ? "px-1" : "px-2"), children: [_jsx("ul", { className: cn("space-y-0.5", collapsed && "flex flex-col items-center"), children: primaryNavItems.map(renderNavItem) }), collapsed ? (_jsx("ul", { className: "mt-2 flex flex-col items-center space-y-0.5", children: [...operationsNavItems, ...ADVANCED_NAV_ITEMS].map(renderNavItem) })) : (_jsxs("div", { className: "mt-5", children: [_jsx("p", { className: "px-2 pb-1 text-[11px] font-medium uppercase tracking-wide text-sidebar-foreground/45", children: t("dispatch.nav.operate", { defaultValue: "Operate" }) }), _jsx("ul", { className: "space-y-0.5", children: operationsNavItems.map(renderNavItem) }), _jsxs("details", { className: "group mt-3", open: advancedOpen, children: [_jsxs("summary", { className: "flex h-8 cursor-pointer list-none items-center justify-between rounded-md px-2 text-xs font-medium text-sidebar-foreground/60 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground [&::-webkit-details-marker]:hidden", children: [_jsx("span", { children: t("dispatch.nav.advanced", { defaultValue: "Advanced" }) }), _jsx(IconChevronDown, { size: 14, className: "transition-transform group-open:rotate-180" })] }), _jsx("ul", { className: "mt-1 space-y-0.5", children: ADVANCED_NAV_ITEMS.map(renderNavItem) })] })] }))] }), !collapsed ? (_jsxs("div", { className: "mt-auto shrink-0", children: [_jsx("div", { className: "px-2 py-1", children: _jsx(ExtensionsSidebarSection, {}) }), _jsx("div", { className: "px-3 py-2", children: _jsx(OrgSwitcher, {}) }), _jsx("div", { className: "px-3 py-2", children: _jsx(FeedbackButton, {}) })] })) : null] })] }));
|
|
421
426
|
}
|
|
422
427
|
export function Layout({ children, extensions, }) {
|
|
423
428
|
const t = useT();
|