@agent-native/dispatch 0.15.25 → 0.15.27

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.
@@ -2,7 +2,7 @@ import { defineAction } from "@agent-native/core";
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";
5
- import { discoverAgents, getBuiltinAgents, shouldIncludeRemoteAgentManifest, } from "@agent-native/core/server/agent-discovery";
5
+ import { discoverAgents, getBuiltinAgents, normalizeAgentId, shouldIncludeRemoteAgentManifest, } from "@agent-native/core/server/agent-discovery";
6
6
  import { z } from "zod";
7
7
  export default defineAction({
8
8
  description: "List agents available to dispatch for A2A delegation, including built-in apps and connected remote agents.",
@@ -34,9 +34,13 @@ export default defineAction({
34
34
  continue;
35
35
  if (!shouldIncludeRemoteAgentManifest(manifest, "dispatch"))
36
36
  continue;
37
- if (builtinIds.has(manifest.id))
37
+ // discoverAgents keys agents by the normalized id (image/images/asset
38
+ // all collapse to assets). Keying this map by the raw manifest id makes
39
+ // the id lookups below miss, so the same agent lands in the list twice.
40
+ const manifestId = normalizeAgentId(manifest.id);
41
+ if (builtinIds.has(manifestId))
38
42
  continue;
39
- customById.set(manifest.id, {
43
+ customById.set(manifestId, {
40
44
  resourceId: resource.id,
41
45
  path: resource.path,
42
46
  scope: resource.owner === SHARED_OWNER ? "shared" : "personal",
@@ -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,oBAAoB,CAAC;AAClD,OAAO,EACL,8BAA8B,EAC9B,wBAAwB,GACzB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACL,WAAW,EACX,sBAAsB,EACtB,YAA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M,EAAE,SAAS,CAAC,CAAC,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 } from \"@agent-native/core\";\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 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 = await discoverAgents(\"dispatch\");\n const builtinIds = new Set(\n getBuiltinAgents(\"dispatch\").map((agent) => agent.id),\n );\n const ownerEmail = getRequestUserEmail();\n if (!ownerEmail) throw new Error(\"no authenticated user\");\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 // Only treat a resource as a \"custom\" agent if its id is not a builtin.\n // Built-in agents may also be seeded as shared resources so the agent-chat\n // plugin can overlay them — those should still be reported as builtin.\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 if (builtinIds.has(manifest.id)) continue;\n customById.set(manifest.id, {\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 return {\n ...agent,\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
+ {"version":3,"file":"list-connected-agents.js","sourceRoot":"","sources":["../../src/actions/list-connected-agents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,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,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,UAAU,GAAG,MAAM,cAAc,CAAC,UAAU,CAAC,CAAC;QACpD,MAAM,UAAU,GAAG,IAAI,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;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 } from \"@agent-native/core\";\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 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 = await discoverAgents(\"dispatch\");\n const builtinIds = new Set(\n getBuiltinAgents(\"dispatch\").map((agent) => agent.id),\n );\n const ownerEmail = getRequestUserEmail();\n if (!ownerEmail) throw new Error(\"no authenticated user\");\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 // Only treat a resource as a \"custom\" agent if its id is not a builtin.\n // Built-in agents may also be seeded as shared resources so the agent-chat\n // plugin can overlay them — those should still be reported as builtin.\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 // discoverAgents keys agents by the normalized id (image/images/asset\n // all collapse to assets). Keying this map by the raw manifest id makes\n // the id lookups below miss, so the same agent lands in the list twice.\n const manifestId = normalizeAgentId(manifest.id);\n if (builtinIds.has(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 return {\n ...agent,\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"]}
@@ -47,8 +47,9 @@ declare const _default: import("node_modules/@agent-native/core/dist").ActionDef
47
47
  notes?: string | undefined;
48
48
  scope?: "org" | "user" | undefined;
49
49
  }, {
50
- id?: undefined;
51
50
  deleted?: undefined;
51
+ id?: undefined;
52
+ provider?: undefined;
52
53
  found?: undefined;
53
54
  message?: undefined;
54
55
  providers: {
@@ -61,45 +62,44 @@ declare const _default: import("node_modules/@agent-native/core/dist").ActionDef
61
62
  updatedAt: number;
62
63
  }[];
63
64
  count: number;
64
- provider?: undefined;
65
65
  registered?: undefined;
66
66
  label?: undefined;
67
67
  } | {
68
- id?: undefined;
69
68
  deleted?: undefined;
69
+ count?: undefined;
70
+ id?: undefined;
70
71
  message?: undefined;
71
72
  providers?: undefined;
72
- count?: undefined;
73
73
  found: boolean;
74
74
  provider: import("node_modules/@agent-native/core/dist/provider-api").CustomProviderConfig;
75
75
  registered?: undefined;
76
76
  label?: undefined;
77
77
  } | {
78
78
  deleted?: undefined;
79
- message?: undefined;
80
- providers?: undefined;
81
79
  count?: undefined;
82
80
  provider?: undefined;
81
+ message?: undefined;
82
+ providers?: undefined;
83
83
  found: boolean;
84
84
  id: string;
85
85
  registered?: undefined;
86
86
  label?: undefined;
87
87
  } | {
88
+ count?: undefined;
89
+ provider?: undefined;
88
90
  found?: undefined;
89
91
  message?: undefined;
90
92
  providers?: undefined;
91
- count?: undefined;
92
- provider?: undefined;
93
93
  deleted: boolean;
94
94
  id: string;
95
95
  registered?: undefined;
96
96
  label?: undefined;
97
97
  } | {
98
98
  deleted?: undefined;
99
- found?: undefined;
100
- providers?: undefined;
101
99
  count?: undefined;
102
100
  provider?: undefined;
101
+ found?: undefined;
102
+ providers?: undefined;
103
103
  registered: boolean;
104
104
  id: string;
105
105
  label: string;
@@ -1 +1 @@
1
- {"version":3,"file":"dispatch-control-plane.d.ts","sourceRoot":"","sources":["../../src/components/dispatch-control-plane.tsx"],"names":[],"mappings":"AAgLA,wBAAgB,oBAAoB,oDAqBnC"}
1
+ {"version":3,"file":"dispatch-control-plane.d.ts","sourceRoot":"","sources":["../../src/components/dispatch-control-plane.tsx"],"names":[],"mappings":"AAkPA,wBAAgB,oBAAoB,oDAqBnC"}
@@ -4,13 +4,15 @@ import { PromptComposer } from "@agent-native/core/client/composer";
4
4
  import { useActionQuery } from "@agent-native/core/client/hooks";
5
5
  import { isInBuilderFrame } from "@agent-native/core/client/host";
6
6
  import { useT } from "@agent-native/core/client/i18n";
7
- import { IconArrowUpRight } from "@tabler/icons-react";
7
+ import { IconArrowUpRight, IconChevronDown, IconClockHour4, } from "@tabler/icons-react";
8
+ import { useState } from "react";
8
9
  import { Link, useNavigate } from "react-router";
9
10
  import { submitOverviewPrompt } from "../lib/overview-chat.js";
10
11
  import { ActionQueryError } from "./action-query-error.js";
11
12
  import { CreateAppPopover } from "./create-app-popover.js";
12
13
  import { useSetPageTitle } from "./layout/HeaderActions.js";
13
14
  import { Button } from "./ui/button.js";
15
+ import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from "./ui/collapsible.js";
14
16
  import { Skeleton } from "./ui/skeleton.js";
15
17
  import { WorkspaceAppCard } from "./workspace-app-card.js";
16
18
  function SectionHeader({ title, action, }) {
@@ -60,9 +62,17 @@ function CommandPanel() {
60
62
  }), selectedEffort: selectedEffort, selectedEngine: selectedEngine, selectedModel: selectedModel, onEffortChange: onEffortChange, onModelChange: onModelChange, onSubmit: (text) => send(text) }), _jsx("div", { className: "mt-3 flex flex-wrap justify-center gap-2", children: promptSuggestions.map((suggestion) => (_jsx("button", { type: "button", onClick: () => send(suggestion), 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", children: suggestion }, suggestion))) })] }) }));
61
63
  }
62
64
  function AppsPanel({ apps, isLoading, }) {
65
+ const t = useT();
66
+ const [showPending, setShowPending] = useState(false);
63
67
  const visibleApps = apps.filter((app) => !app.isDispatch && !app.archived);
64
- const showSkeletons = isLoading && visibleApps.length === 0;
65
- return (_jsxs("section", { className: "flex flex-col gap-3", children: [_jsx(SectionHeader, { title: "Apps", action: _jsx(Button, { variant: "outline", size: "sm", asChild: true, children: _jsxs(Link, { to: "/apps", children: ["View all", _jsx(IconArrowUpRight, { size: 14 })] }) }) }), showSkeletons ? (_jsx("div", { className: "grid gap-3 md:grid-cols-2", children: Array.from({ length: 4 }).map((_, index) => (_jsxs("div", { className: "rounded-xl bg-card/40 p-4", children: [_jsx(Skeleton, { className: "h-4 w-32" }), _jsx(Skeleton, { className: "mt-3 h-3 w-24" }), _jsx(Skeleton, { className: "mt-3 h-3 w-full" })] }, index))) })) : visibleApps.length > 0 ? (_jsx("div", { className: "grid gap-3 md:grid-cols-2", children: visibleApps.map((app) => (_jsx(WorkspaceAppCard, { app: app, className: "min-h-32" }, app.id))) })) : (_jsx(CreateAppPopover, {}))] }));
68
+ const activeApps = visibleApps.filter((app) => app.status !== "pending");
69
+ const pendingApps = visibleApps.filter((app) => app.status === "pending");
70
+ const showSkeletons = isLoading && activeApps.length === 0 && pendingApps.length === 0;
71
+ return (_jsxs("section", { className: "flex flex-col gap-3", children: [_jsx(SectionHeader, { title: "Apps", action: _jsx(Button, { variant: "outline", size: "sm", asChild: true, children: _jsxs(Link, { to: "/apps", children: ["View all", _jsx(IconArrowUpRight, { size: 14 })] }) }) }), showSkeletons ? (_jsx("div", { className: "grid gap-3 md:grid-cols-2", children: Array.from({ length: 4 }).map((_, index) => (_jsxs("div", { className: "rounded-xl bg-card/40 p-4", children: [_jsx(Skeleton, { className: "h-4 w-32" }), _jsx(Skeleton, { className: "mt-3 h-3 w-24" }), _jsx(Skeleton, { className: "mt-3 h-3 w-full" })] }, index))) })) : activeApps.length > 0 ? (_jsx("div", { className: "grid gap-3 md:grid-cols-2", children: activeApps.map((app) => (_jsx(WorkspaceAppCard, { app: app, className: "min-h-32" }, app.id))) })) : (_jsx(CreateAppPopover, {})), pendingApps.length > 0 ? (_jsx(Collapsible, { open: showPending, onOpenChange: setShowPending, children: _jsxs("div", { className: "space-y-3 border-t pt-3", children: [_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-3", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [_jsx(IconClockHour4, { size: 15, className: "shrink-0 text-muted-foreground" }), _jsxs("div", { className: "min-w-0", children: [_jsx("h3", { className: "text-xs font-semibold text-foreground", children: t("dispatch.pages.pendingApps") }), _jsx("p", { className: "text-xs text-muted-foreground", children: t("dispatch.pages.pendingAppsDescription", {
72
+ count: pendingApps.length,
73
+ }) })] })] }), _jsx(CollapsibleTrigger, { asChild: true, children: _jsxs(Button, { type: "button", variant: "ghost", size: "sm", className: "h-7 gap-1.5 px-2 text-xs", children: [showPending
74
+ ? t("dispatch.pages.hidePendingApps")
75
+ : t("dispatch.pages.showPendingApps"), _jsx(IconChevronDown, { size: 13, className: showPending ? "rotate-180" : undefined })] }) })] }), _jsx(CollapsibleContent, { children: _jsx("div", { className: "grid gap-3 md:grid-cols-2", children: pendingApps.map((app) => (_jsx(WorkspaceAppCard, { app: app, className: "min-h-32" }, app.id))) }) })] }) })) : null] }));
66
76
  }
67
77
  export function DispatchControlPlane() {
68
78
  useSetPageTitle(_jsx("span", { "aria-hidden": true }));
@@ -1 +1 @@
1
- {"version":3,"file":"dispatch-control-plane.js","sourceRoot":"","sources":["../../src/components/dispatch-control-plane.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,mCAAmC,EACnC,aAAa,GACd,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAE5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,C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,WAAW,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CACxB,KAAC,gBAAgB,IAAc,GAAG,EAAE,GAAG,EAAE,SAAS,EAAC,UAAU,IAAtC,GAAG,CAAC,EAAE,CAAmC,CACjE,CAAC,GACE,CACP,CAAC,CAAC,CAAC,CACF,KAAC,gBAAgB,KAAG,CACrB,IACO,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 navigateWithAgentChatViewTransition,\n useChatModels,\n} from \"@agent-native/core/client/agent-chat\";\nimport { PromptComposer } from \"@agent-native/core/client/composer\";\nimport { useActionQuery } from \"@agent-native/core/client/hooks\";\nimport { isInBuilderFrame } from \"@agent-native/core/client/host\";\nimport { useT } from \"@agent-native/core/client/i18n\";\nimport { IconArrowUpRight } from \"@tabler/icons-react\";\nimport type { ReactNode } from \"react\";\nimport { Link, useNavigate } from \"react-router\";\n\nimport { submitOverviewPrompt } from \"../lib/overview-chat\";\nimport type { WorkspaceAppSummary } from \"../lib/workspace-apps\";\nimport { ActionQueryError } from \"./action-query-error\";\nimport { CreateAppPopover } from \"./create-app-popover\";\nimport { useSetPageTitle } from \"./layout/HeaderActions\";\nimport { Button } from \"./ui/button\";\nimport { Skeleton } from \"./ui/skeleton\";\nimport { WorkspaceAppCard } from \"./workspace-app-card\";\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 {\n availableModels,\n isLoading: modelListLoading,\n onEffortChange,\n onModelChange,\n selectedEffort,\n selectedEngine,\n selectedModel,\n } = useChatModels({ storageKey: \"dispatch\" });\n const navigate = useNavigate();\n const promptSuggestions = [\n t(\"dispatch.pages.suggestionWorkspaceHealth\", {\n defaultValue: \"Summarize the current workspace health\",\n }),\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 if (isInBuilderFrame()) {\n submitOverviewPrompt(trimmed, selectedModel);\n return;\n }\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-3xl 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 <PromptComposer\n availableModels={availableModels}\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 onEffortChange={onEffortChange}\n onModelChange={onModelChange}\n onSubmit={(text) => send(text)}\n />\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 visibleApps = apps.filter((app) => !app.isDispatch && !app.archived);\n const showSkeletons = isLoading && visibleApps.length === 0;\n\n return (\n <section className=\"flex flex-col gap-3\">\n <SectionHeader\n title=\"Apps\"\n action={\n <Button variant=\"outline\" size=\"sm\" asChild>\n <Link to=\"/apps\">\n View all\n <IconArrowUpRight size={14} />\n </Link>\n </Button>\n }\n />\n {showSkeletons ? (\n <div className=\"grid gap-3 md:grid-cols-2\">\n {Array.from({ length: 4 }).map((_, index) => (\n <div key={index} className=\"rounded-xl bg-card/40 p-4\">\n <Skeleton className=\"h-4 w-32\" />\n <Skeleton className=\"mt-3 h-3 w-24\" />\n <Skeleton className=\"mt-3 h-3 w-full\" />\n </div>\n ))}\n </div>\n ) : visibleApps.length > 0 ? (\n <div className=\"grid gap-3 md:grid-cols-2\">\n {visibleApps.map((app) => (\n <WorkspaceAppCard key={app.id} app={app} className=\"min-h-32\" />\n ))}\n </div>\n ) : (\n <CreateAppPopover />\n )}\n </section>\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,mCAAmC,EACnC,aAAa,GACd,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AACtD,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,cAAc,GACf,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAE5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM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,CAAC","sourcesContent":["import {\n navigateWithAgentChatViewTransition,\n useChatModels,\n} from \"@agent-native/core/client/agent-chat\";\nimport { PromptComposer } from \"@agent-native/core/client/composer\";\nimport { useActionQuery } from \"@agent-native/core/client/hooks\";\nimport { isInBuilderFrame } from \"@agent-native/core/client/host\";\nimport { useT } from \"@agent-native/core/client/i18n\";\nimport {\n IconArrowUpRight,\n IconChevronDown,\n IconClockHour4,\n} from \"@tabler/icons-react\";\nimport type { ReactNode } from \"react\";\nimport { useState } from \"react\";\nimport { Link, useNavigate } from \"react-router\";\n\nimport { submitOverviewPrompt } from \"../lib/overview-chat\";\nimport type { WorkspaceAppSummary } from \"../lib/workspace-apps\";\nimport { ActionQueryError } from \"./action-query-error\";\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\";\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 {\n availableModels,\n isLoading: modelListLoading,\n onEffortChange,\n onModelChange,\n selectedEffort,\n selectedEngine,\n selectedModel,\n } = useChatModels({ storageKey: \"dispatch\" });\n const navigate = useNavigate();\n const promptSuggestions = [\n t(\"dispatch.pages.suggestionWorkspaceHealth\", {\n defaultValue: \"Summarize the current workspace health\",\n }),\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 if (isInBuilderFrame()) {\n submitOverviewPrompt(trimmed, selectedModel);\n return;\n }\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-3xl 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 <PromptComposer\n availableModels={availableModels}\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 onEffortChange={onEffortChange}\n onModelChange={onModelChange}\n onSubmit={(text) => send(text)}\n />\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 visibleApps = apps.filter((app) => !app.isDispatch && !app.archived);\n const activeApps = visibleApps.filter((app) => app.status !== \"pending\");\n const pendingApps = visibleApps.filter((app) => app.status === \"pending\");\n const showSkeletons =\n isLoading && activeApps.length === 0 && pendingApps.length === 0;\n\n return (\n <section className=\"flex flex-col gap-3\">\n <SectionHeader\n title=\"Apps\"\n action={\n <Button variant=\"outline\" size=\"sm\" asChild>\n <Link to=\"/apps\">\n View all\n <IconArrowUpRight size={14} />\n </Link>\n </Button>\n }\n />\n {showSkeletons ? (\n <div className=\"grid gap-3 md:grid-cols-2\">\n {Array.from({ length: 4 }).map((_, index) => (\n <div key={index} className=\"rounded-xl bg-card/40 p-4\">\n <Skeleton className=\"h-4 w-32\" />\n <Skeleton className=\"mt-3 h-3 w-24\" />\n <Skeleton className=\"mt-3 h-3 w-full\" />\n </div>\n ))}\n </div>\n ) : activeApps.length > 0 ? (\n <div className=\"grid gap-3 md:grid-cols-2\">\n {activeApps.map((app) => (\n <WorkspaceAppCard key={app.id} app={app} className=\"min-h-32\" />\n ))}\n </div>\n ) : (\n <CreateAppPopover />\n )}\n {pendingApps.length > 0 ? (\n <Collapsible open={showPending} onOpenChange={setShowPending}>\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\n ? t(\"dispatch.pages.hidePendingApps\")\n : t(\"dispatch.pages.showPendingApps\")}\n <IconChevronDown\n size={13}\n className={showPending ? \"rotate-180\" : undefined}\n />\n </Button>\n </CollapsibleTrigger>\n </div>\n <CollapsibleContent>\n <div className=\"grid gap-3 md:grid-cols-2\">\n {pendingApps.map((app) => (\n <WorkspaceAppCard\n key={app.id}\n app={app}\n className=\"min-h-32\"\n />\n ))}\n </div>\n </CollapsibleContent>\n </div>\n </Collapsible>\n ) : null}\n </section>\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 +1 @@
1
- {"version":3,"file":"workspace-app-card.d.ts","sourceRoot":"","sources":["../../src/components/workspace-app-card.tsx"],"names":[],"mappings":"AAoBA,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,uBAAuB,CAAC;AA6B/B,wBAAgB,gBAAgB,CAAC,EAC/B,GAAG,EACH,SAAS,GACV,EAAE;IACD,GAAG,EAAE,mBAAmB,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,mDA0OA"}
1
+ {"version":3,"file":"workspace-app-card.d.ts","sourceRoot":"","sources":["../../src/components/workspace-app-card.tsx"],"names":[],"mappings":"AAwBA,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,uBAAuB,CAAC;AA+B/B,wBAAgB,gBAAgB,CAAC,EAC/B,GAAG,EACH,SAAS,GACV,EAAE;IACD,GAAG,EAAE,mBAAmB,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,mDA0PA"}
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useActionMutation, useActionQuery, } from "@agent-native/core/client/hooks";
3
- import { IconChevronDown, IconChevronRight, IconClockHour4, IconDots, IconEdit, IconEye, IconEyeOff, IconFileText, IconWorld, IconTrash, } from "@tabler/icons-react";
3
+ import { useFormatters, useT } from "@agent-native/core/client/i18n";
4
+ import { IconCalendar, IconChevronDown, IconChevronRight, IconClockHour4, IconDots, IconEdit, IconEye, IconEyeOff, IconFileText, IconWorld, IconTrash, IconUser, IconUsersGroup, } from "@tabler/icons-react";
4
5
  import { useEffect, useState } from "react";
5
6
  import { toast } from "sonner";
6
7
  import { cn } from "../lib/utils.js";
@@ -10,7 +11,7 @@ import { AppKeysPopover } from "./app-keys-popover.js";
10
11
  import { Badge } from "./ui/badge.js";
11
12
  import { Button } from "./ui/button.js";
12
13
  import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, } from "./ui/dialog.js";
13
- import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, } from "./ui/dropdown-menu.js";
14
+ import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, } from "./ui/dropdown-menu.js";
14
15
  import { Input } from "./ui/input.js";
15
16
  import { Label } from "./ui/label.js";
16
17
  import { Textarea } from "./ui/textarea.js";
@@ -18,6 +19,8 @@ import { Tooltip, TooltipContent, TooltipTrigger } from "./ui/tooltip.js";
18
19
  import { AppResourceEffectiveStack } from "./workspace-resource-effective-stack.js";
19
20
  const APP_CARD_ACTION_CLASS = "size-7 rounded-md p-0 text-muted-foreground transition-[background-color,color] hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring data-[state=open]:bg-accent data-[state=open]:text-foreground";
20
21
  export function WorkspaceAppCard({ app, className, }) {
22
+ const t = useT();
23
+ const { formatDate } = useFormatters();
21
24
  const href = workspaceAppHref(app);
22
25
  const openInNewTab = isPendingBuilderHref(app);
23
26
  const isPending = app.status === "pending";
@@ -74,10 +77,38 @@ export function WorkspaceAppCard({ app, className, }) {
74
77
  description: draftDescription.trim(),
75
78
  });
76
79
  };
77
- return (_jsxs("div", { "aria-disabled": !href, className: cn("group relative rounded-xl bg-card/40 p-4 transition-[background-color] hover:bg-accent/15 focus-within:bg-accent/15 aria-disabled:opacity-60", isArchived && "opacity-70", className), children: [href ? (_jsx("a", { href: href, target: openInNewTab ? "_blank" : undefined, rel: openInNewTab ? "noreferrer" : undefined, "aria-label": `Open ${app.name}`, className: "absolute inset-0 z-0 rounded-xl outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background" })) : null, _jsxs("div", { className: "pointer-events-none relative z-10 flex h-full min-w-0 items-start justify-between gap-3", children: [_jsxs("div", { className: "min-w-0 flex-1", children: [_jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-1.5", children: [_jsx("h3", { className: "min-w-0 flex-1 truncate text-sm font-semibold text-foreground", children: app.name }), isPending ? (_jsxs(Badge, { variant: "outline", className: "shrink-0 gap-1 border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300", children: [_jsx(IconClockHour4, { size: 12 }), pendingLabel] })) : null, isArchived ? (_jsxs(Badge, { variant: "outline", className: "shrink-0 gap-1", children: [_jsx(IconEyeOff, { size: 12 }), "Hidden"] })) : null, audience === "public" ? (_jsxs(Badge, { variant: "outline", className: "shrink-0 gap-1", children: [_jsx(IconWorld, { size: 12 }), "Public"] })) : null] }), _jsx("p", { className: "mt-1 truncate font-mono text-[11px] text-muted-foreground", children: app.path }), isPending && app.branchName ? (_jsxs("p", { className: "mt-1 truncate text-xs text-muted-foreground", children: ["Builder branch: ", app.branchName] })) : null, app.description ? (_jsx("p", { className: "mt-2 min-h-10 line-clamp-2 text-[13px] leading-5 text-muted-foreground", children: app.description })) : null] }), _jsxs("div", { className: "flex shrink-0 items-center gap-1", children: [!isPending && !isArchived ? (_jsx("div", { className: "pointer-events-auto", children: _jsx(AppResourcesDialog, { app: app }) })) : null, !isPending && !isArchived ? (_jsx("div", { className: "pointer-events-auto", children: _jsx(AppKeysPopover, { appId: app.id, appName: app.name }) })) : null, _jsx("div", { className: "pointer-events-auto", children: _jsxs(DropdownMenu, { children: [_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(DropdownMenuTrigger, { asChild: true, children: _jsx("button", { type: "button", "aria-label": `More actions for ${app.name}`, className: cn(APP_CARD_ACTION_CLASS, "inline-flex cursor-pointer items-center justify-center"), onClick: (e) => e.stopPropagation(), children: _jsx(IconDots, { size: 15 }) }) }) }), _jsx(TooltipContent, { children: "More actions" })] }), _jsxs(DropdownMenuContent, { align: "end", className: "w-44", children: [_jsxs(DropdownMenuItem, { onSelect: (event) => {
80
+ return (_jsxs("div", { "aria-disabled": !href, className: cn("group relative rounded-xl bg-card/40 p-4 transition-[background-color] hover:bg-accent/15 focus-within:bg-accent/15 aria-disabled:opacity-60", isArchived && "opacity-70", className), children: [href ? (_jsx("a", { href: href, target: openInNewTab ? "_blank" : undefined, rel: openInNewTab ? "noreferrer" : undefined, "aria-label": `Open ${app.name}`, className: "absolute inset-0 z-0 rounded-xl outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background" })) : null, _jsxs("div", { className: "pointer-events-none relative z-10 flex h-full min-w-0 items-start justify-between gap-3", children: [_jsxs("div", { className: "min-w-0 flex-1", children: [_jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-1.5", children: [_jsx("h3", { className: "min-w-0 flex-1 truncate text-sm font-semibold text-foreground", children: app.name }), isPending ? (_jsxs(Badge, { variant: "outline", className: "shrink-0 gap-1 border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300", children: [_jsx(IconClockHour4, { size: 12 }), pendingLabel] })) : null, isArchived ? (_jsxs(Badge, { variant: "outline", className: "shrink-0 gap-1", children: [_jsx(IconEyeOff, { size: 12 }), "Hidden"] })) : null, audience === "public" ? (_jsxs(Badge, { variant: "outline", className: "shrink-0 gap-1", children: [_jsx(IconWorld, { size: 12 }), "Public"] })) : null] }), _jsx("p", { className: "mt-1 truncate font-mono text-[11px] text-muted-foreground", children: app.path }), isPending && app.branchName ? (_jsxs("p", { className: "mt-1 truncate text-xs text-muted-foreground", children: ["Builder branch: ", app.branchName] })) : null, app.description ? (_jsx("p", { className: "mt-2 min-h-10 line-clamp-2 text-[13px] leading-5 text-muted-foreground", children: app.description })) : null] }), _jsxs("div", { className: "flex shrink-0 items-center gap-1", children: [!isPending && !isArchived ? (_jsx("div", { className: "pointer-events-auto", children: _jsx(AppResourcesDialog, { app: app }) })) : null, !isPending && !isArchived ? (_jsx("div", { className: "pointer-events-auto", children: _jsx(AppKeysPopover, { appId: app.id, appName: app.name }) })) : null, _jsx("div", { className: "pointer-events-auto", children: _jsxs(DropdownMenu, { children: [_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(DropdownMenuTrigger, { asChild: true, children: _jsx("button", { type: "button", "aria-label": `More actions for ${app.name}`, className: cn(APP_CARD_ACTION_CLASS, "inline-flex cursor-pointer items-center justify-center"), onClick: (e) => e.stopPropagation(), children: _jsx(IconDots, { size: 15 }) }) }) }), _jsx(TooltipContent, { children: "More actions" })] }), _jsxs(DropdownMenuContent, { align: "end", className: "w-72", children: [_jsxs(DropdownMenuItem, { onSelect: (event) => {
78
81
  event.preventDefault();
79
82
  setEditOpen(true);
80
- }, children: [_jsx(IconEdit, { size: 14, className: "mr-2" }), "Edit details"] }), isPending ? (_jsxs(DropdownMenuItem, { onSelect: handleRemovePending, className: "text-red-600 focus:text-red-600 dark:text-red-400 dark:focus:text-red-400", children: [_jsx(IconTrash, { size: 14, className: "mr-2" }), "Remove from list"] })) : isArchived ? (_jsxs(DropdownMenuItem, { onSelect: handleUnarchive, children: [_jsx(IconEye, { size: 14, className: "mr-2" }), "Restore to list"] })) : (_jsxs(DropdownMenuItem, { onSelect: handleArchive, children: [_jsx(IconEyeOff, { size: 14, className: "mr-2" }), "Hide from list"] }))] })] }) })] })] }), _jsx(Dialog, { open: editOpen, onOpenChange: setEditOpen, children: _jsxs(DialogContent, { children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: "Edit app details" }) }), _jsxs("form", { className: "space-y-4", onSubmit: handleMetadataSubmit, children: [_jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: `app-name-${app.id}`, children: "Name" }), _jsx(Input, { id: `app-name-${app.id}`, value: draftName, maxLength: 120, onChange: (event) => setDraftName(event.target.value) })] }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: `app-description-${app.id}`, children: "Description" }), _jsx(Textarea, { id: `app-description-${app.id}`, value: draftDescription, maxLength: 500, rows: 4, onChange: (event) => setDraftDescription(event.target.value) })] }), _jsxs(DialogFooter, { children: [_jsx(Button, { type: "button", variant: "outline", onClick: () => setEditOpen(false), children: "Cancel" }), _jsx(Button, { type: "submit", disabled: updateMetadata.isPending, children: updateMetadata.isPending ? "Saving..." : "Save" })] })] })] }) })] }));
83
+ }, children: [_jsx(IconEdit, { size: 14, className: "mr-2" }), "Edit details"] }), isPending ? (_jsxs(DropdownMenuItem, { onSelect: handleRemovePending, className: "text-red-600 focus:text-red-600 dark:text-red-400 dark:focus:text-red-400", children: [_jsx(IconTrash, { size: 14, className: "mr-2" }), "Remove from list"] })) : isArchived ? (_jsxs(DropdownMenuItem, { onSelect: handleUnarchive, children: [_jsx(IconEye, { size: 14, className: "mr-2" }), "Restore to list"] })) : (_jsxs(DropdownMenuItem, { onSelect: handleArchive, children: [_jsx(IconEyeOff, { size: 14, className: "mr-2" }), "Hide from list"] })), _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuLabel, { className: "font-normal", children: _jsx(WorkspaceAppMetadata, { app: app, formatDate: formatDate, labels: {
84
+ created: t("agents.dashboardMetadataCreated"),
85
+ createdBy: t("agents.dashboardMetadataCreatedBy"),
86
+ owner: t("dispatch.pages.appMetadataOwner"),
87
+ teams: t("dispatch.pages.appMetadataTeams"),
88
+ notTracked: t("agents.notTracked"),
89
+ } }) })] })] }) })] })] }), _jsx(Dialog, { open: editOpen, onOpenChange: setEditOpen, children: _jsxs(DialogContent, { children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: "Edit app details" }) }), _jsxs("form", { className: "space-y-4", onSubmit: handleMetadataSubmit, children: [_jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: `app-name-${app.id}`, children: "Name" }), _jsx(Input, { id: `app-name-${app.id}`, value: draftName, maxLength: 120, onChange: (event) => setDraftName(event.target.value) })] }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: `app-description-${app.id}`, children: "Description" }), _jsx(Textarea, { id: `app-description-${app.id}`, value: draftDescription, maxLength: 500, rows: 4, onChange: (event) => setDraftDescription(event.target.value) })] }), _jsxs(DialogFooter, { children: [_jsx(Button, { type: "button", variant: "outline", onClick: () => setEditOpen(false), children: "Cancel" }), _jsx(Button, { type: "submit", disabled: updateMetadata.isPending, children: updateMetadata.isPending ? "Saving..." : "Save" })] })] })] }) })] }));
90
+ }
91
+ function WorkspaceAppMetadata({ app, formatDate, labels, }) {
92
+ function formatMetadataDate(value) {
93
+ if (!value)
94
+ return labels.notTracked;
95
+ try {
96
+ return formatDate(value, {
97
+ year: "numeric",
98
+ month: "short",
99
+ day: "numeric",
100
+ hour: "numeric",
101
+ minute: "2-digit",
102
+ });
103
+ }
104
+ catch {
105
+ return value;
106
+ }
107
+ }
108
+ return (_jsxs("div", { className: "flex flex-col gap-1.5 text-xs text-muted-foreground", children: [_jsx(WorkspaceAppMetadataRow, { icon: IconCalendar, label: labels.created, value: formatMetadataDate(app.createdAt) }), _jsx(WorkspaceAppMetadataRow, { icon: IconUser, label: labels.createdBy, value: app.createdBy || labels.notTracked }), _jsx(WorkspaceAppMetadataRow, { icon: IconUser, label: labels.owner, value: app.owner || labels.notTracked }), _jsx(WorkspaceAppMetadataRow, { icon: IconUsersGroup, label: labels.teams, value: app.teams?.join(", ") || labels.notTracked })] }));
109
+ }
110
+ function WorkspaceAppMetadataRow({ icon: Icon, label, value, }) {
111
+ return (_jsxs("div", { className: "flex items-start gap-1.5", children: [_jsx(Icon, { className: "mt-0.5 h-3 w-3 shrink-0" }), _jsx("span", { className: "shrink-0", children: label }), _jsx("span", { className: "min-w-0 truncate text-foreground/80", children: value })] }));
81
112
  }
82
113
  function AppResourcesDialog({ app }) {
83
114
  const [open, setOpen] = useState(false);
@@ -1 +1 @@
1
- {"version":3,"file":"workspace-app-card.js","sourceRoot":"","sources":["../../src/components/workspace-app-card.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,iBAAiB,EACjB,cAAc,GACf,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,UAAU,EACV,YAAY,EACZ,SAAS,EACT,SAAS,GACV,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAE/B,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EACL,oBAAoB,EACpB,gBAAgB,GAEjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EACL,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,aAAa,GACd,MAAM,aAAa,CAAC;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nimport {\n IconChevronDown,\n IconChevronRight,\n IconClockHour4,\n IconDots,\n IconEdit,\n IconEye,\n IconEyeOff,\n IconFileText,\n IconWorld,\n IconTrash,\n} from \"@tabler/icons-react\";\nimport { useEffect, useState, type FormEvent } from \"react\";\nimport { toast } from \"sonner\";\n\nimport { cn } from \"../lib/utils\";\nimport {\n isPendingBuilderHref,\n workspaceAppHref,\n type WorkspaceAppSummary,\n} from \"../lib/workspace-apps\";\nimport { ActionQueryError } from \"./action-query-error\";\nimport { AppKeysPopover } from \"./app-keys-popover\";\nimport { Badge } from \"./ui/badge\";\nimport { Button } from \"./ui/button\";\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n DialogTrigger,\n} from \"./ui/dialog\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n} from \"./ui/dropdown-menu\";\nimport { Input } from \"./ui/input\";\nimport { Label } from \"./ui/label\";\nimport { Textarea } from \"./ui/textarea\";\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"./ui/tooltip\";\nimport { AppResourceEffectiveStack } from \"./workspace-resource-effective-stack\";\n\nconst APP_CARD_ACTION_CLASS =\n \"size-7 rounded-md p-0 text-muted-foreground transition-[background-color,color] hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring data-[state=open]:bg-accent data-[state=open]:text-foreground\";\n\nexport function WorkspaceAppCard({\n app,\n className,\n}: {\n app: WorkspaceAppSummary;\n className?: string;\n}) {\n const href = workspaceAppHref(app);\n const openInNewTab = isPendingBuilderHref(app);\n const isPending = app.status === \"pending\";\n const pendingLabel = app.statusLabel || \"Builder branch\";\n const isArchived = !!app.archived;\n const audience = app.audience ?? \"internal\";\n const [editOpen, setEditOpen] = useState(false);\n const [draftName, setDraftName] = useState(app.name);\n const [draftDescription, setDraftDescription] = useState(\n app.description || \"\",\n );\n\n useEffect(() => {\n if (editOpen) return;\n setDraftName(app.name);\n setDraftDescription(app.description || \"\");\n }, [app.description, app.name, editOpen]);\n\n const archive = useActionMutation(\"archive-workspace-app\", {\n onError: (err) =>\n toast.error(`Could not hide ${app.name}: ${stringifyError(err)}`),\n });\n const unarchive = useActionMutation(\"unarchive-workspace-app\", {\n onError: (err) =>\n toast.error(`Could not restore ${app.name}: ${stringifyError(err)}`),\n });\n const removePending = useActionMutation(\"remove-pending-workspace-app\", {\n onError: (err) =>\n toast.error(`Could not remove ${app.name}: ${stringifyError(err)}`),\n });\n const updateMetadata = useActionMutation(\"update-workspace-app-metadata\", {\n onSuccess: () => {\n toast.success(`Updated ${draftName.trim() || app.name}`);\n setEditOpen(false);\n },\n onError: (err) =>\n toast.error(`Could not update ${app.name}: ${stringifyError(err)}`),\n });\n\n const handleArchive = () => {\n archive.mutate({ appId: app.id });\n toast.success(`Hid ${app.name} from the Apps list`);\n };\n const handleUnarchive = () => {\n unarchive.mutate({ appId: app.id });\n toast.success(`Restored ${app.name} to the Apps list`);\n };\n const handleRemovePending = () => {\n removePending.mutate({ appId: app.id });\n toast.success(`Removed pending ${app.name}`);\n };\n const handleMetadataSubmit = (event: FormEvent<HTMLFormElement>) => {\n event.preventDefault();\n const name = draftName.trim();\n if (!name) {\n toast.error(\"App name is required.\");\n return;\n }\n updateMetadata.mutate({\n appId: app.id,\n name,\n description: draftDescription.trim(),\n });\n };\n\n return (\n <div\n aria-disabled={!href}\n className={cn(\n \"group relative rounded-xl bg-card/40 p-4 transition-[background-color] hover:bg-accent/15 focus-within:bg-accent/15 aria-disabled:opacity-60\",\n isArchived && \"opacity-70\",\n className,\n )}\n >\n {href ? (\n <a\n href={href}\n target={openInNewTab ? \"_blank\" : undefined}\n rel={openInNewTab ? \"noreferrer\" : undefined}\n aria-label={`Open ${app.name}`}\n className=\"absolute inset-0 z-0 rounded-xl outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background\"\n />\n ) : null}\n\n <div className=\"pointer-events-none relative z-10 flex h-full min-w-0 items-start justify-between gap-3\">\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex min-w-0 flex-wrap items-center gap-1.5\">\n <h3 className=\"min-w-0 flex-1 truncate text-sm font-semibold text-foreground\">\n {app.name}\n </h3>\n {isPending ? (\n <Badge\n variant=\"outline\"\n className=\"shrink-0 gap-1 border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300\"\n >\n <IconClockHour4 size={12} />\n {pendingLabel}\n </Badge>\n ) : null}\n {isArchived ? (\n <Badge variant=\"outline\" className=\"shrink-0 gap-1\">\n <IconEyeOff size={12} />\n Hidden\n </Badge>\n ) : null}\n {audience === \"public\" ? (\n <Badge variant=\"outline\" className=\"shrink-0 gap-1\">\n <IconWorld size={12} />\n Public\n </Badge>\n ) : null}\n </div>\n <p className=\"mt-1 truncate font-mono text-[11px] text-muted-foreground\">\n {app.path}\n </p>\n {isPending && app.branchName ? (\n <p className=\"mt-1 truncate text-xs text-muted-foreground\">\n Builder branch: {app.branchName}\n </p>\n ) : null}\n {app.description ? (\n <p className=\"mt-2 min-h-10 line-clamp-2 text-[13px] leading-5 text-muted-foreground\">\n {app.description}\n </p>\n ) : null}\n </div>\n <div className=\"flex shrink-0 items-center gap-1\">\n {!isPending && !isArchived ? (\n <div className=\"pointer-events-auto\">\n <AppResourcesDialog app={app} />\n </div>\n ) : null}\n {!isPending && !isArchived ? (\n <div className=\"pointer-events-auto\">\n <AppKeysPopover appId={app.id} appName={app.name} />\n </div>\n ) : null}\n <div className=\"pointer-events-auto\">\n <DropdownMenu>\n <Tooltip>\n <TooltipTrigger asChild>\n <DropdownMenuTrigger asChild>\n <button\n type=\"button\"\n aria-label={`More actions for ${app.name}`}\n className={cn(\n APP_CARD_ACTION_CLASS,\n \"inline-flex cursor-pointer items-center justify-center\",\n )}\n onClick={(e) => e.stopPropagation()}\n >\n <IconDots size={15} />\n </button>\n </DropdownMenuTrigger>\n </TooltipTrigger>\n <TooltipContent>More actions</TooltipContent>\n </Tooltip>\n <DropdownMenuContent align=\"end\" className=\"w-44\">\n <DropdownMenuItem\n onSelect={(event) => {\n event.preventDefault();\n setEditOpen(true);\n }}\n >\n <IconEdit size={14} className=\"mr-2\" />\n Edit details\n </DropdownMenuItem>\n {isPending ? (\n <DropdownMenuItem\n onSelect={handleRemovePending}\n className=\"text-red-600 focus:text-red-600 dark:text-red-400 dark:focus:text-red-400\"\n >\n <IconTrash size={14} className=\"mr-2\" />\n Remove from list\n </DropdownMenuItem>\n ) : isArchived ? (\n <DropdownMenuItem onSelect={handleUnarchive}>\n <IconEye size={14} className=\"mr-2\" />\n Restore to list\n </DropdownMenuItem>\n ) : (\n <DropdownMenuItem onSelect={handleArchive}>\n <IconEyeOff size={14} className=\"mr-2\" />\n Hide from list\n </DropdownMenuItem>\n )}\n </DropdownMenuContent>\n </DropdownMenu>\n </div>\n </div>\n </div>\n <Dialog open={editOpen} onOpenChange={setEditOpen}>\n <DialogContent>\n <DialogHeader>\n <DialogTitle>Edit app details</DialogTitle>\n </DialogHeader>\n <form className=\"space-y-4\" onSubmit={handleMetadataSubmit}>\n <div className=\"space-y-2\">\n <Label htmlFor={`app-name-${app.id}`}>Name</Label>\n <Input\n id={`app-name-${app.id}`}\n value={draftName}\n maxLength={120}\n onChange={(event) => setDraftName(event.target.value)}\n />\n </div>\n <div className=\"space-y-2\">\n <Label htmlFor={`app-description-${app.id}`}>Description</Label>\n <Textarea\n id={`app-description-${app.id}`}\n value={draftDescription}\n maxLength={500}\n rows={4}\n onChange={(event) => setDraftDescription(event.target.value)}\n />\n </div>\n <DialogFooter>\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={() => setEditOpen(false)}\n >\n Cancel\n </Button>\n <Button type=\"submit\" disabled={updateMetadata.isPending}>\n {updateMetadata.isPending ? \"Saving...\" : \"Save\"}\n </Button>\n </DialogFooter>\n </form>\n </DialogContent>\n </Dialog>\n </div>\n );\n}\n\nfunction AppResourcesDialog({ app }: { app: WorkspaceAppSummary }) {\n const [open, setOpen] = useState(false);\n const [inspectedResourceId, setInspectedResourceId] = useState<string | null>(\n null,\n );\n const query = useActionQuery(\n \"list-workspace-resources-for-app\",\n { appId: app.id },\n { enabled: open },\n );\n const { data, isLoading } = query;\n\n const resources = ((data as any)?.resources ?? []) as any[];\n const counts = (data as any)?.counts;\n\n return (\n <Dialog\n open={open}\n onOpenChange={(nextOpen) => {\n setOpen(nextOpen);\n if (!nextOpen) setInspectedResourceId(null);\n }}\n >\n <Tooltip>\n <TooltipTrigger asChild>\n <DialogTrigger asChild>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n aria-label={`View agent resources for ${app.name}`}\n className={APP_CARD_ACTION_CLASS}\n onClick={(e) => e.stopPropagation()}\n >\n <IconFileText size={14} />\n </Button>\n </DialogTrigger>\n </TooltipTrigger>\n <TooltipContent>View agent resources</TooltipContent>\n </Tooltip>\n <DialogContent className=\"max-w-2xl\">\n <DialogHeader>\n <DialogTitle>{app.name} agent resources</DialogTitle>\n <DialogDescription>\n Workspace-scope agent resources are inherited at runtime. App shared\n and personal resources can override them locally.\n </DialogDescription>\n </DialogHeader>\n <div className=\"space-y-4\">\n <div className=\"rounded-lg border bg-muted/30 px-3 py-2 text-xs leading-relaxed text-muted-foreground\">\n All-app agent resources live once at workspace scope and are read by\n each app agent when it builds context. Nothing is copied into this\n app.\n </div>\n\n <div className=\"flex flex-wrap items-center gap-2\">\n <Badge variant=\"secondary\">{counts?.total ?? 0} total</Badge>\n <Badge variant=\"outline\">\n {counts?.workspace ?? counts?.global ?? 0} workspace\n </Badge>\n <Badge variant=\"outline\">{counts?.granted ?? 0} granted</Badge>\n <Badge variant=\"outline\">\n {counts?.autoLoaded ?? 0} auto-loaded\n </Badge>\n </div>\n\n {query.isError ? (\n <ActionQueryError\n error={query.error}\n onRetry={() => void query.refetch()}\n />\n ) : isLoading ? (\n <div className=\"space-y-2\">\n <div className=\"h-14 rounded-lg border bg-muted/30\" />\n <div className=\"h-14 rounded-lg border bg-muted/30\" />\n <div className=\"h-14 rounded-lg border bg-muted/30\" />\n </div>\n ) : resources.length === 0 ? (\n <div className=\"rounded-lg border border-dashed px-4 py-8 text-center text-sm text-muted-foreground\">\n No workspace or granted resources are visible to this app yet.\n </div>\n ) : (\n <div className=\"max-h-[420px] space-y-2 overflow-y-auto pr-1\">\n {resources.map((resource) => {\n const inspected = inspectedResourceId === resource.id;\n return (\n <div\n key={resource.id}\n className=\"rounded-lg border px-3 py-3\"\n >\n <div className=\"flex items-start justify-between gap-3\">\n <div className=\"min-w-0\">\n <div className=\"flex flex-wrap items-center gap-2\">\n <span className=\"text-sm font-medium text-foreground\">\n {resource.name}\n </span>\n <Badge variant=\"secondary\">{resource.kind}</Badge>\n <Badge variant=\"outline\">\n {resource.source === \"workspace\"\n ? \"All apps\"\n : \"Granted\"}\n </Badge>\n {resource.autoLoaded ? (\n <Badge variant=\"outline\">Auto-loaded</Badge>\n ) : null}\n </div>\n <div className=\"mt-1 truncate font-mono text-xs text-muted-foreground\">\n {resource.path}\n </div>\n </div>\n <div className=\"flex shrink-0 flex-col items-end gap-2\">\n {resource.source === \"grant\" ? (\n <div className=\"text-right text-[11px] text-muted-foreground\">\n Selected grant\n </div>\n ) : null}\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n className=\"h-7 px-2 text-xs\"\n onClick={(event) => {\n event.stopPropagation();\n setInspectedResourceId(\n inspected ? null : resource.id,\n );\n }}\n >\n {inspected ? (\n <IconChevronDown size={14} className=\"mr-1\" />\n ) : (\n <IconChevronRight size={14} className=\"mr-1\" />\n )}\n Stack\n </Button>\n </div>\n </div>\n\n {resource.description ? (\n <p className=\"mt-2 line-clamp-2 text-xs text-muted-foreground\">\n {resource.description}\n </p>\n ) : null}\n\n {inspected ? (\n <AppResourceEffectiveStack\n appId={app.id}\n resource={resource}\n />\n ) : null}\n </div>\n );\n })}\n </div>\n )}\n </div>\n <DialogFooter>\n <Button type=\"button\" onClick={() => setOpen(false)}>\n Done\n </Button>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n );\n}\n\nfunction stringifyError(err: unknown): string {\n if (err instanceof Error) return err.message;\n return String(err);\n}\n"]}
1
+ {"version":3,"file":"workspace-app-card.js","sourceRoot":"","sources":["../../src/components/workspace-app-card.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,iBAAiB,EACjB,cAAc,GACf,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EACL,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,UAAU,EACV,YAAY,EACZ,SAAS,EACT,SAAS,EACT,QAAQ,EACR,cAAc,GACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAE/B,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EACL,oBAAoB,EACpB,gBAAgB,GAEjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EACL,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,aAAa,GACd,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;A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AAG,CAAC,EAAE,EACb,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC,CAAC,CAAC,IAAI,KA9DH,QAAQ,CAAC,EAAE,CA+DZ,CACP,CAAC;gCACJ,CAAC,CAAC,GACE,CACP,IACG,EACN,KAAC,YAAY,cACX,KAAC,MAAM,IAAC,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,qBAE1C,GACI,IACD,IACT,CACV,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAC,GAAY;IAClC,IAAI,GAAG,YAAY,KAAK;QAAE,OAAO,GAAG,CAAC,OAAO,CAAC;IAC7C,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;AACrB,CAAC","sourcesContent":["import {\n useActionMutation,\n useActionQuery,\n} from \"@agent-native/core/client/hooks\";\nimport { useFormatters, useT } from \"@agent-native/core/client/i18n\";\nimport {\n IconCalendar,\n IconChevronDown,\n IconChevronRight,\n IconClockHour4,\n IconDots,\n IconEdit,\n IconEye,\n IconEyeOff,\n IconFileText,\n IconWorld,\n IconTrash,\n IconUser,\n IconUsersGroup,\n} from \"@tabler/icons-react\";\nimport { useEffect, useState, type FormEvent } from \"react\";\nimport { toast } from \"sonner\";\n\nimport { cn } from \"../lib/utils\";\nimport {\n isPendingBuilderHref,\n workspaceAppHref,\n type WorkspaceAppSummary,\n} from \"../lib/workspace-apps\";\nimport { ActionQueryError } from \"./action-query-error\";\nimport { AppKeysPopover } from \"./app-keys-popover\";\nimport { Badge } from \"./ui/badge\";\nimport { Button } from \"./ui/button\";\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n DialogTrigger,\n} from \"./ui/dialog\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n} from \"./ui/dropdown-menu\";\nimport { Input } from \"./ui/input\";\nimport { Label } from \"./ui/label\";\nimport { Textarea } from \"./ui/textarea\";\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"./ui/tooltip\";\nimport { AppResourceEffectiveStack } from \"./workspace-resource-effective-stack\";\n\nconst APP_CARD_ACTION_CLASS =\n \"size-7 rounded-md p-0 text-muted-foreground transition-[background-color,color] hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring data-[state=open]:bg-accent data-[state=open]:text-foreground\";\n\nexport function WorkspaceAppCard({\n app,\n className,\n}: {\n app: WorkspaceAppSummary;\n className?: string;\n}) {\n const t = useT();\n const { formatDate } = useFormatters();\n const href = workspaceAppHref(app);\n const openInNewTab = isPendingBuilderHref(app);\n const isPending = app.status === \"pending\";\n const pendingLabel = app.statusLabel || \"Builder branch\";\n const isArchived = !!app.archived;\n const audience = app.audience ?? \"internal\";\n const [editOpen, setEditOpen] = useState(false);\n const [draftName, setDraftName] = useState(app.name);\n const [draftDescription, setDraftDescription] = useState(\n app.description || \"\",\n );\n\n useEffect(() => {\n if (editOpen) return;\n setDraftName(app.name);\n setDraftDescription(app.description || \"\");\n }, [app.description, app.name, editOpen]);\n\n const archive = useActionMutation(\"archive-workspace-app\", {\n onError: (err) =>\n toast.error(`Could not hide ${app.name}: ${stringifyError(err)}`),\n });\n const unarchive = useActionMutation(\"unarchive-workspace-app\", {\n onError: (err) =>\n toast.error(`Could not restore ${app.name}: ${stringifyError(err)}`),\n });\n const removePending = useActionMutation(\"remove-pending-workspace-app\", {\n onError: (err) =>\n toast.error(`Could not remove ${app.name}: ${stringifyError(err)}`),\n });\n const updateMetadata = useActionMutation(\"update-workspace-app-metadata\", {\n onSuccess: () => {\n toast.success(`Updated ${draftName.trim() || app.name}`);\n setEditOpen(false);\n },\n onError: (err) =>\n toast.error(`Could not update ${app.name}: ${stringifyError(err)}`),\n });\n\n const handleArchive = () => {\n archive.mutate({ appId: app.id });\n toast.success(`Hid ${app.name} from the Apps list`);\n };\n const handleUnarchive = () => {\n unarchive.mutate({ appId: app.id });\n toast.success(`Restored ${app.name} to the Apps list`);\n };\n const handleRemovePending = () => {\n removePending.mutate({ appId: app.id });\n toast.success(`Removed pending ${app.name}`);\n };\n const handleMetadataSubmit = (event: FormEvent<HTMLFormElement>) => {\n event.preventDefault();\n const name = draftName.trim();\n if (!name) {\n toast.error(\"App name is required.\");\n return;\n }\n updateMetadata.mutate({\n appId: app.id,\n name,\n description: draftDescription.trim(),\n });\n };\n\n return (\n <div\n aria-disabled={!href}\n className={cn(\n \"group relative rounded-xl bg-card/40 p-4 transition-[background-color] hover:bg-accent/15 focus-within:bg-accent/15 aria-disabled:opacity-60\",\n isArchived && \"opacity-70\",\n className,\n )}\n >\n {href ? (\n <a\n href={href}\n target={openInNewTab ? \"_blank\" : undefined}\n rel={openInNewTab ? \"noreferrer\" : undefined}\n aria-label={`Open ${app.name}`}\n className=\"absolute inset-0 z-0 rounded-xl outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background\"\n />\n ) : null}\n\n <div className=\"pointer-events-none relative z-10 flex h-full min-w-0 items-start justify-between gap-3\">\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex min-w-0 flex-wrap items-center gap-1.5\">\n <h3 className=\"min-w-0 flex-1 truncate text-sm font-semibold text-foreground\">\n {app.name}\n </h3>\n {isPending ? (\n <Badge\n variant=\"outline\"\n className=\"shrink-0 gap-1 border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300\"\n >\n <IconClockHour4 size={12} />\n {pendingLabel}\n </Badge>\n ) : null}\n {isArchived ? (\n <Badge variant=\"outline\" className=\"shrink-0 gap-1\">\n <IconEyeOff size={12} />\n Hidden\n </Badge>\n ) : null}\n {audience === \"public\" ? (\n <Badge variant=\"outline\" className=\"shrink-0 gap-1\">\n <IconWorld size={12} />\n Public\n </Badge>\n ) : null}\n </div>\n <p className=\"mt-1 truncate font-mono text-[11px] text-muted-foreground\">\n {app.path}\n </p>\n {isPending && app.branchName ? (\n <p className=\"mt-1 truncate text-xs text-muted-foreground\">\n Builder branch: {app.branchName}\n </p>\n ) : null}\n {app.description ? (\n <p className=\"mt-2 min-h-10 line-clamp-2 text-[13px] leading-5 text-muted-foreground\">\n {app.description}\n </p>\n ) : null}\n </div>\n <div className=\"flex shrink-0 items-center gap-1\">\n {!isPending && !isArchived ? (\n <div className=\"pointer-events-auto\">\n <AppResourcesDialog app={app} />\n </div>\n ) : null}\n {!isPending && !isArchived ? (\n <div className=\"pointer-events-auto\">\n <AppKeysPopover appId={app.id} appName={app.name} />\n </div>\n ) : null}\n <div className=\"pointer-events-auto\">\n <DropdownMenu>\n <Tooltip>\n <TooltipTrigger asChild>\n <DropdownMenuTrigger asChild>\n <button\n type=\"button\"\n aria-label={`More actions for ${app.name}`}\n className={cn(\n APP_CARD_ACTION_CLASS,\n \"inline-flex cursor-pointer items-center justify-center\",\n )}\n onClick={(e) => e.stopPropagation()}\n >\n <IconDots size={15} />\n </button>\n </DropdownMenuTrigger>\n </TooltipTrigger>\n <TooltipContent>More actions</TooltipContent>\n </Tooltip>\n <DropdownMenuContent align=\"end\" className=\"w-72\">\n <DropdownMenuItem\n onSelect={(event) => {\n event.preventDefault();\n setEditOpen(true);\n }}\n >\n <IconEdit size={14} className=\"mr-2\" />\n Edit details\n </DropdownMenuItem>\n {isPending ? (\n <DropdownMenuItem\n onSelect={handleRemovePending}\n className=\"text-red-600 focus:text-red-600 dark:text-red-400 dark:focus:text-red-400\"\n >\n <IconTrash size={14} className=\"mr-2\" />\n Remove from list\n </DropdownMenuItem>\n ) : isArchived ? (\n <DropdownMenuItem onSelect={handleUnarchive}>\n <IconEye size={14} className=\"mr-2\" />\n Restore to list\n </DropdownMenuItem>\n ) : (\n <DropdownMenuItem onSelect={handleArchive}>\n <IconEyeOff size={14} className=\"mr-2\" />\n Hide from list\n </DropdownMenuItem>\n )}\n <DropdownMenuSeparator />\n <DropdownMenuLabel className=\"font-normal\">\n <WorkspaceAppMetadata\n app={app}\n formatDate={formatDate}\n labels={{\n created: t(\"agents.dashboardMetadataCreated\"),\n createdBy: t(\"agents.dashboardMetadataCreatedBy\"),\n owner: t(\"dispatch.pages.appMetadataOwner\"),\n teams: t(\"dispatch.pages.appMetadataTeams\"),\n notTracked: t(\"agents.notTracked\"),\n }}\n />\n </DropdownMenuLabel>\n </DropdownMenuContent>\n </DropdownMenu>\n </div>\n </div>\n </div>\n <Dialog open={editOpen} onOpenChange={setEditOpen}>\n <DialogContent>\n <DialogHeader>\n <DialogTitle>Edit app details</DialogTitle>\n </DialogHeader>\n <form className=\"space-y-4\" onSubmit={handleMetadataSubmit}>\n <div className=\"space-y-2\">\n <Label htmlFor={`app-name-${app.id}`}>Name</Label>\n <Input\n id={`app-name-${app.id}`}\n value={draftName}\n maxLength={120}\n onChange={(event) => setDraftName(event.target.value)}\n />\n </div>\n <div className=\"space-y-2\">\n <Label htmlFor={`app-description-${app.id}`}>Description</Label>\n <Textarea\n id={`app-description-${app.id}`}\n value={draftDescription}\n maxLength={500}\n rows={4}\n onChange={(event) => setDraftDescription(event.target.value)}\n />\n </div>\n <DialogFooter>\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={() => setEditOpen(false)}\n >\n Cancel\n </Button>\n <Button type=\"submit\" disabled={updateMetadata.isPending}>\n {updateMetadata.isPending ? \"Saving...\" : \"Save\"}\n </Button>\n </DialogFooter>\n </form>\n </DialogContent>\n </Dialog>\n </div>\n );\n}\n\nfunction WorkspaceAppMetadata({\n app,\n formatDate,\n labels,\n}: {\n app: WorkspaceAppSummary;\n formatDate: ReturnType<typeof useFormatters>[\"formatDate\"];\n labels: {\n created: string;\n createdBy: string;\n owner: string;\n teams: string;\n notTracked: string;\n };\n}) {\n function formatMetadataDate(value: string | null | undefined): string {\n if (!value) return labels.notTracked;\n try {\n return formatDate(value, {\n year: \"numeric\",\n month: \"short\",\n day: \"numeric\",\n hour: \"numeric\",\n minute: \"2-digit\",\n });\n } catch {\n return value;\n }\n }\n\n return (\n <div className=\"flex flex-col gap-1.5 text-xs text-muted-foreground\">\n <WorkspaceAppMetadataRow\n icon={IconCalendar}\n label={labels.created}\n value={formatMetadataDate(app.createdAt)}\n />\n <WorkspaceAppMetadataRow\n icon={IconUser}\n label={labels.createdBy}\n value={app.createdBy || labels.notTracked}\n />\n <WorkspaceAppMetadataRow\n icon={IconUser}\n label={labels.owner}\n value={app.owner || labels.notTracked}\n />\n <WorkspaceAppMetadataRow\n icon={IconUsersGroup}\n label={labels.teams}\n value={app.teams?.join(\", \") || labels.notTracked}\n />\n </div>\n );\n}\n\nfunction WorkspaceAppMetadataRow({\n icon: Icon,\n label,\n value,\n}: {\n icon: typeof IconCalendar;\n label: string;\n value: string;\n}) {\n return (\n <div className=\"flex items-start gap-1.5\">\n <Icon className=\"mt-0.5 h-3 w-3 shrink-0\" />\n <span className=\"shrink-0\">{label}</span>\n <span className=\"min-w-0 truncate text-foreground/80\">{value}</span>\n </div>\n );\n}\n\nfunction AppResourcesDialog({ app }: { app: WorkspaceAppSummary }) {\n const [open, setOpen] = useState(false);\n const [inspectedResourceId, setInspectedResourceId] = useState<string | null>(\n null,\n );\n const query = useActionQuery(\n \"list-workspace-resources-for-app\",\n { appId: app.id },\n { enabled: open },\n );\n const { data, isLoading } = query;\n\n const resources = ((data as any)?.resources ?? []) as any[];\n const counts = (data as any)?.counts;\n\n return (\n <Dialog\n open={open}\n onOpenChange={(nextOpen) => {\n setOpen(nextOpen);\n if (!nextOpen) setInspectedResourceId(null);\n }}\n >\n <Tooltip>\n <TooltipTrigger asChild>\n <DialogTrigger asChild>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n aria-label={`View agent resources for ${app.name}`}\n className={APP_CARD_ACTION_CLASS}\n onClick={(e) => e.stopPropagation()}\n >\n <IconFileText size={14} />\n </Button>\n </DialogTrigger>\n </TooltipTrigger>\n <TooltipContent>View agent resources</TooltipContent>\n </Tooltip>\n <DialogContent className=\"max-w-2xl\">\n <DialogHeader>\n <DialogTitle>{app.name} agent resources</DialogTitle>\n <DialogDescription>\n Workspace-scope agent resources are inherited at runtime. App shared\n and personal resources can override them locally.\n </DialogDescription>\n </DialogHeader>\n <div className=\"space-y-4\">\n <div className=\"rounded-lg border bg-muted/30 px-3 py-2 text-xs leading-relaxed text-muted-foreground\">\n All-app agent resources live once at workspace scope and are read by\n each app agent when it builds context. Nothing is copied into this\n app.\n </div>\n\n <div className=\"flex flex-wrap items-center gap-2\">\n <Badge variant=\"secondary\">{counts?.total ?? 0} total</Badge>\n <Badge variant=\"outline\">\n {counts?.workspace ?? counts?.global ?? 0} workspace\n </Badge>\n <Badge variant=\"outline\">{counts?.granted ?? 0} granted</Badge>\n <Badge variant=\"outline\">\n {counts?.autoLoaded ?? 0} auto-loaded\n </Badge>\n </div>\n\n {query.isError ? (\n <ActionQueryError\n error={query.error}\n onRetry={() => void query.refetch()}\n />\n ) : isLoading ? (\n <div className=\"space-y-2\">\n <div className=\"h-14 rounded-lg border bg-muted/30\" />\n <div className=\"h-14 rounded-lg border bg-muted/30\" />\n <div className=\"h-14 rounded-lg border bg-muted/30\" />\n </div>\n ) : resources.length === 0 ? (\n <div className=\"rounded-lg border border-dashed px-4 py-8 text-center text-sm text-muted-foreground\">\n No workspace or granted resources are visible to this app yet.\n </div>\n ) : (\n <div className=\"max-h-[420px] space-y-2 overflow-y-auto pr-1\">\n {resources.map((resource) => {\n const inspected = inspectedResourceId === resource.id;\n return (\n <div\n key={resource.id}\n className=\"rounded-lg border px-3 py-3\"\n >\n <div className=\"flex items-start justify-between gap-3\">\n <div className=\"min-w-0\">\n <div className=\"flex flex-wrap items-center gap-2\">\n <span className=\"text-sm font-medium text-foreground\">\n {resource.name}\n </span>\n <Badge variant=\"secondary\">{resource.kind}</Badge>\n <Badge variant=\"outline\">\n {resource.source === \"workspace\"\n ? \"All apps\"\n : \"Granted\"}\n </Badge>\n {resource.autoLoaded ? (\n <Badge variant=\"outline\">Auto-loaded</Badge>\n ) : null}\n </div>\n <div className=\"mt-1 truncate font-mono text-xs text-muted-foreground\">\n {resource.path}\n </div>\n </div>\n <div className=\"flex shrink-0 flex-col items-end gap-2\">\n {resource.source === \"grant\" ? (\n <div className=\"text-right text-[11px] text-muted-foreground\">\n Selected grant\n </div>\n ) : null}\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n className=\"h-7 px-2 text-xs\"\n onClick={(event) => {\n event.stopPropagation();\n setInspectedResourceId(\n inspected ? null : resource.id,\n );\n }}\n >\n {inspected ? (\n <IconChevronDown size={14} className=\"mr-1\" />\n ) : (\n <IconChevronRight size={14} className=\"mr-1\" />\n )}\n Stack\n </Button>\n </div>\n </div>\n\n {resource.description ? (\n <p className=\"mt-2 line-clamp-2 text-xs text-muted-foreground\">\n {resource.description}\n </p>\n ) : null}\n\n {inspected ? (\n <AppResourceEffectiveStack\n appId={app.id}\n resource={resource}\n />\n ) : null}\n </div>\n );\n })}\n </div>\n )}\n </div>\n <DialogFooter>\n <Button type=\"button\" onClick={() => setOpen(false)}>\n Done\n </Button>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n );\n}\n\nfunction stringifyError(err: unknown): string {\n if (err instanceof Error) return err.message;\n return String(err);\n}\n"]}
@@ -13,6 +13,9 @@ export interface WorkspaceAppSummary {
13
13
  builderUrl?: string | null;
14
14
  branchName?: string | null;
15
15
  createdAt?: string | null;
16
+ createdBy?: string | null;
17
+ owner?: string | null;
18
+ teams?: string[];
16
19
  agentCardUrl?: string | null;
17
20
  agentCardReachable?: boolean;
18
21
  a2aEndpointUrl?: string | null;
@@ -1 +1 @@
1
- {"version":3,"file":"workspace-apps.d.ts","sourceRoot":"","sources":["../../src/lib/workspace-apps.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAA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Q,EAAE,SAAS;gBACnB,OAAO,EAAE,iBAAiB;aAC3B,CAAC;YACJ,CAAC,CAAC,IAAI,CAAC;IACX,CAAC;IACD,OAAO,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,GAAG,IAAI,IAAI,CAAC;AACrC,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,GAAwB;IAC3D,OAAO,GAAG,CAAC,MAAM,KAAK,SAAS,IAAI,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC;AACtD,CAAC","sourcesContent":["import { withBuilderUtmTrackingParams } from \"@agent-native/core/shared/builder-link-tracking\";\n\nexport interface WorkspaceAppSummary {\n id: string;\n name: string;\n description?: string;\n path: string;\n url?: string | null;\n isDispatch?: boolean;\n audience?: \"internal\" | \"public\";\n publicPaths?: string[];\n protectedPaths?: string[];\n status?: \"ready\" | \"pending\";\n statusLabel?: string;\n builderUrl?: string | null;\n branchName?: string | null;\n createdAt?: string | null;\n agentCardUrl?: string | null;\n agentCardReachable?: boolean;\n a2aEndpointUrl?: string | null;\n agentName?: string | null;\n agentSkillsCount?: number | null;\n archived?: boolean;\n}\n\nexport function workspaceAppHref(app: WorkspaceAppSummary): string | null {\n if (app.status === \"pending\") {\n return app.builderUrl\n ? withBuilderUtmTrackingParams(app.builderUrl, {\n campaign: \"product\",\n content: \"dispatch_branch\",\n })\n : null;\n }\n return app.path || app.url || null;\n}\n\nexport function isPendingBuilderHref(app: WorkspaceAppSummary): boolean {\n return app.status === \"pending\" && !!app.builderUrl;\n}\n"]}
1
+ {"version":3,"file":"workspace-apps.js","sourceRoot":"","sources":["../../src/lib/workspace-apps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,iDAAiD,CAAC;AA4B/F,MAAM,UAAU,gBAAgB,CAAC,GAAwB;IACvD,IAAI,GAAG,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QAC7B,OAAO,GAAG,CAAC,UAAU;YACnB,CAAC,CAAC,4BAA4B,CAAC,GAAG,CAAC,UAAU,EAAE;gBAC3C,QAAQ,EAAE,SAAS;gBACnB,OAAO,EAAE,iBAAiB;aAC3B,CAAC;YACJ,CAAC,CAAC,IAAI,CAAC;IACX,CAAC;IACD,OAAO,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,GAAG,IAAI,IAAI,CAAC;AACrC,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,GAAwB;IAC3D,OAAO,GAAG,CAAC,MAAM,KAAK,SAAS,IAAI,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC;AACtD,CAAC","sourcesContent":["import { withBuilderUtmTrackingParams } from \"@agent-native/core/shared/builder-link-tracking\";\n\nexport interface WorkspaceAppSummary {\n id: string;\n name: string;\n description?: string;\n path: string;\n url?: string | null;\n isDispatch?: boolean;\n audience?: \"internal\" | \"public\";\n publicPaths?: string[];\n protectedPaths?: string[];\n status?: \"ready\" | \"pending\";\n statusLabel?: string;\n builderUrl?: string | null;\n branchName?: string | null;\n createdAt?: string | null;\n createdBy?: string | null;\n owner?: string | null;\n teams?: string[];\n agentCardUrl?: string | null;\n agentCardReachable?: boolean;\n a2aEndpointUrl?: string | null;\n agentName?: string | null;\n agentSkillsCount?: number | null;\n archived?: boolean;\n}\n\nexport function workspaceAppHref(app: WorkspaceAppSummary): string | null {\n if (app.status === \"pending\") {\n return app.builderUrl\n ? withBuilderUtmTrackingParams(app.builderUrl, {\n campaign: \"product\",\n content: \"dispatch_branch\",\n })\n : null;\n }\n return app.path || app.url || null;\n}\n\nexport function isPendingBuilderHref(app: WorkspaceAppSummary): boolean {\n return app.status === \"pending\" && !!app.builderUrl;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"apps.d.ts","sourceRoot":"","sources":["../../../src/routes/pages/apps.tsx"],"names":[],"mappings":"AAoCA,wBAAgB,IAAI;;IAEnB;AAQD,MAAM,CAAC,OAAO,UAAU,SAAS,oDAuOhC"}
1
+ {"version":3,"file":"apps.d.ts","sourceRoot":"","sources":["../../../src/routes/pages/apps.tsx"],"names":[],"mappings":"AAqCA,wBAAgB,IAAI;;IAEnB;AAQD,MAAM,CAAC,OAAO,UAAU,SAAS,oDAwShC"}