@agent-native/dispatch 0.15.0 → 0.15.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/README.md +3 -0
- package/dist/components/action-query-error.js +1 -1
- package/dist/components/action-query-error.js.map +1 -1
- package/dist/components/agents-panel.js +1 -1
- package/dist/components/agents-panel.js.map +1 -1
- package/dist/components/app-keys-popover.d.ts.map +1 -1
- package/dist/components/app-keys-popover.js +1 -1
- package/dist/components/app-keys-popover.js.map +1 -1
- package/dist/components/create-app-popover.js +5 -1
- package/dist/components/create-app-popover.js.map +1 -1
- package/dist/components/dispatch-control-plane.js +5 -1
- package/dist/components/dispatch-control-plane.js.map +1 -1
- package/dist/components/dispatch-shell.js +1 -1
- package/dist/components/dispatch-shell.js.map +1 -1
- package/dist/components/layout/Header.d.ts.map +1 -1
- package/dist/components/layout/Header.js +2 -1
- package/dist/components/layout/Header.js.map +1 -1
- package/dist/components/layout/Layout.d.ts.map +1 -1
- package/dist/components/layout/Layout.js +5 -1
- 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 +2 -1
- package/dist/components/messaging-setup-panel.js.map +1 -1
- package/dist/components/task-queue-health.d.ts.map +1 -1
- package/dist/components/task-queue-health.js +2 -1
- package/dist/components/task-queue-health.js.map +1 -1
- package/dist/components/workspace-app-card.d.ts.map +1 -1
- package/dist/components/workspace-app-card.js +1 -1
- package/dist/components/workspace-app-card.js.map +1 -1
- package/dist/components/workspace-resource-effective-stack.js +1 -1
- package/dist/components/workspace-resource-effective-stack.js.map +1 -1
- package/dist/components/workspace-resource-impact-preview.js +1 -1
- package/dist/components/workspace-resource-impact-preview.js.map +1 -1
- package/dist/components/workspace-template-card.js +1 -1
- package/dist/components/workspace-template-card.js.map +1 -1
- package/dist/hooks/use-navigation-state.d.ts.map +1 -1
- package/dist/hooks/use-navigation-state.js +2 -1
- package/dist/hooks/use-navigation-state.js.map +1 -1
- package/dist/lib/automations.js +1 -1
- package/dist/lib/automations.js.map +1 -1
- package/dist/lib/overview-chat.d.ts.map +1 -1
- package/dist/lib/overview-chat.js +2 -1
- package/dist/lib/overview-chat.js.map +1 -1
- package/dist/lib/task-queue.js +1 -1
- package/dist/lib/task-queue.js.map +1 -1
- package/dist/routes/pages/$appId.d.ts.map +1 -1
- package/dist/routes/pages/$appId.js +3 -1
- package/dist/routes/pages/$appId.js.map +1 -1
- package/dist/routes/pages/_index.js +1 -1
- package/dist/routes/pages/_index.js.map +1 -1
- package/dist/routes/pages/agents.js +2 -1
- package/dist/routes/pages/agents.js.map +1 -1
- package/dist/routes/pages/approval.d.ts.map +1 -1
- package/dist/routes/pages/approval.js +3 -1
- package/dist/routes/pages/approval.js.map +1 -1
- package/dist/routes/pages/approvals.d.ts.map +1 -1
- package/dist/routes/pages/approvals.js +1 -1
- package/dist/routes/pages/approvals.js.map +1 -1
- package/dist/routes/pages/apps.$appId.d.ts.map +1 -1
- package/dist/routes/pages/apps.$appId.js +2 -1
- package/dist/routes/pages/apps.$appId.js.map +1 -1
- package/dist/routes/pages/apps.d.ts.map +1 -1
- package/dist/routes/pages/apps.js +2 -1
- package/dist/routes/pages/apps.js.map +1 -1
- package/dist/routes/pages/audit.js +1 -1
- package/dist/routes/pages/audit.js.map +1 -1
- package/dist/routes/pages/automations.d.ts.map +1 -1
- package/dist/routes/pages/automations.js +3 -1
- package/dist/routes/pages/automations.js.map +1 -1
- package/dist/routes/pages/chat.d.ts.map +1 -1
- package/dist/routes/pages/chat.js +3 -1
- package/dist/routes/pages/chat.js.map +1 -1
- package/dist/routes/pages/destinations.js +2 -1
- package/dist/routes/pages/destinations.js.map +1 -1
- package/dist/routes/pages/dreams.d.ts.map +1 -1
- package/dist/routes/pages/dreams.js +1 -1
- package/dist/routes/pages/dreams.js.map +1 -1
- package/dist/routes/pages/identities.d.ts.map +1 -1
- package/dist/routes/pages/identities.js +1 -1
- package/dist/routes/pages/identities.js.map +1 -1
- package/dist/routes/pages/integrations.d.ts.map +1 -1
- package/dist/routes/pages/integrations.js +1 -1
- package/dist/routes/pages/integrations.js.map +1 -1
- package/dist/routes/pages/metrics.d.ts.map +1 -1
- package/dist/routes/pages/metrics.js +2 -1
- package/dist/routes/pages/metrics.js.map +1 -1
- package/dist/routes/pages/new-app.d.ts.map +1 -1
- package/dist/routes/pages/new-app.js +2 -1
- package/dist/routes/pages/new-app.js.map +1 -1
- package/dist/routes/pages/operations.d.ts.map +1 -1
- package/dist/routes/pages/operations.js +3 -1
- package/dist/routes/pages/operations.js.map +1 -1
- package/dist/routes/pages/settings.d.ts.map +1 -1
- package/dist/routes/pages/settings.js +3 -1
- package/dist/routes/pages/settings.js.map +1 -1
- package/dist/routes/pages/thread-debug.d.ts.map +1 -1
- package/dist/routes/pages/thread-debug.js +2 -1
- package/dist/routes/pages/thread-debug.js.map +1 -1
- package/dist/routes/pages/vault.d.ts.map +1 -1
- package/dist/routes/pages/vault.js +1 -1
- package/dist/routes/pages/vault.js.map +1 -1
- package/dist/routes/pages/workspace.d.ts.map +1 -1
- package/dist/routes/pages/workspace.js +1 -1
- package/dist/routes/pages/workspace.js.map +1 -1
- package/package.json +8 -2
- package/src/components/action-query-error.spec.tsx +1 -1
- package/src/components/action-query-error.tsx +1 -1
- package/src/components/agents-panel.tsx +1 -1
- package/src/components/app-keys-popover.spec.tsx +4 -1
- package/src/components/app-keys-popover.tsx +4 -1
- package/src/components/create-app-popover.tsx +5 -5
- package/src/components/dispatch-control-plane.spec.tsx +20 -8
- package/src/components/dispatch-control-plane.tsx +5 -5
- package/src/components/dispatch-shell.tsx +1 -1
- package/src/components/layout/Header.tsx +2 -1
- package/src/components/layout/Layout.spec.tsx +17 -8
- package/src/components/layout/Layout.tsx +5 -6
- package/src/components/messaging-setup-panel.spec.tsx +4 -1
- package/src/components/messaging-setup-panel.tsx +2 -3
- package/src/components/task-queue-health.tsx +2 -1
- package/src/components/workspace-app-card.spec.tsx +1 -1
- package/src/components/workspace-app-card.tsx +4 -1
- package/src/components/workspace-resource-effective-stack.spec.tsx +1 -1
- package/src/components/workspace-resource-effective-stack.tsx +1 -1
- package/src/components/workspace-resource-impact-preview.spec.tsx +1 -1
- package/src/components/workspace-resource-impact-preview.tsx +1 -1
- package/src/components/workspace-template-card.spec.tsx +1 -1
- package/src/components/workspace-template-card.tsx +1 -1
- package/src/hooks/use-navigation-state.ts +5 -3
- package/src/lib/automations.ts +1 -1
- package/src/lib/overview-chat.spec.ts +5 -2
- package/src/lib/overview-chat.ts +2 -1
- package/src/lib/task-queue.ts +1 -1
- package/src/routes/pages/$appId.tsx +3 -1
- package/src/routes/pages/_index.tsx +1 -1
- package/src/routes/pages/agents.tsx +2 -2
- package/src/routes/pages/approval.tsx +4 -2
- package/src/routes/pages/approvals.tsx +4 -1
- package/src/routes/pages/apps.$appId.tsx +2 -1
- package/src/routes/pages/apps.tsx +2 -1
- package/src/routes/pages/audit.tsx +1 -1
- package/src/routes/pages/automations.tsx +3 -5
- package/src/routes/pages/chat.spec.tsx +15 -4
- package/src/routes/pages/chat.tsx +3 -4
- package/src/routes/pages/destinations.tsx +2 -2
- package/src/routes/pages/dreams.tsx +4 -1
- package/src/routes/pages/identities.tsx +4 -1
- package/src/routes/pages/integrations.tsx +4 -1
- package/src/routes/pages/metrics.tsx +2 -1
- package/src/routes/pages/new-app.tsx +2 -1
- package/src/routes/pages/operations.tsx +3 -5
- package/src/routes/pages/settings.tsx +4 -5
- package/src/routes/pages/thread-debug.tsx +2 -1
- package/src/routes/pages/vault.tsx +4 -1
- package/src/routes/pages/workspace.tsx +4 -1
package/README.md
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# @agent-native/dispatch
|
|
2
2
|
|
|
3
|
+
Dispatch is the Agent-Native workspace control plane and a separate product.
|
|
4
|
+
It is not a Toolkit capability module.
|
|
5
|
+
|
|
3
6
|
Workspace control plane for agent-native apps — vault, integrations,
|
|
4
7
|
destinations, cross-app workspace resources, recurring "dream" report jobs,
|
|
5
8
|
and cross-app delegation, shipped as a single drop-in package.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useT } from "@agent-native/core/client";
|
|
2
|
+
import { useT } from "@agent-native/core/client/i18n";
|
|
3
3
|
import { IconAlertTriangle, IconRefresh } from "@tabler/icons-react";
|
|
4
4
|
import { Alert, AlertDescription, AlertTitle } from "./ui/alert.js";
|
|
5
5
|
import { Button } from "./ui/button.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action-query-error.js","sourceRoot":"","sources":["../../src/components/action-query-error.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"action-query-error.js","sourceRoot":"","sources":["../../src/components/action-query-error.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAErE,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAQrC,MAAM,UAAU,gBAAgB,CAAC,EAC/B,OAAO,EACP,SAAS,GACa;IACtB,MAAM,CAAC,GAAG,IAAI,EAAE,CAAC;IAEjB,OAAO,CACL,MAAC,KAAK,IAAC,OAAO,EAAC,aAAa,EAAC,SAAS,EAAE,SAAS,aAC/C,KAAC,iBAAiB,IAAC,SAAS,EAAC,QAAQ,GAAG,EACxC,KAAC,UAAU,cAAE,CAAC,CAAC,+BAA+B,CAAC,GAAc,EAC7D,MAAC,gBAAgB,IAAC,SAAS,EAAC,mDAAmD,aAC7E,yBAAO,CAAC,CAAC,0CAA0C,CAAC,GAAQ,EAC5D,MAAC,MAAM,IAAC,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAC,SAAS,EAAC,IAAI,EAAC,IAAI,EAAC,OAAO,EAAE,OAAO,aAChE,KAAC,WAAW,IAAC,SAAS,EAAC,QAAQ,GAAG,EACjC,CAAC,CAAC,yBAAyB,CAAC,IACtB,IACQ,IACb,CACT,CAAC;AACJ,CAAC","sourcesContent":["import { useT } from \"@agent-native/core/client/i18n\";\nimport { IconAlertTriangle, IconRefresh } from \"@tabler/icons-react\";\n\nimport { Alert, AlertDescription, AlertTitle } from \"./ui/alert\";\nimport { Button } from \"./ui/button\";\n\ninterface ActionQueryErrorProps {\n error?: unknown;\n onRetry: () => unknown;\n className?: string;\n}\n\nexport function ActionQueryError({\n onRetry,\n className,\n}: ActionQueryErrorProps) {\n const t = useT();\n\n return (\n <Alert variant=\"destructive\" className={className}>\n <IconAlertTriangle className=\"size-4\" />\n <AlertTitle>{t(\"dispatch.pages.dataLoadFailed\")}</AlertTitle>\n <AlertDescription className=\"flex flex-wrap items-center justify-between gap-3\">\n <span>{t(\"dispatch.pages.dataLoadFailedDescription\")}</span>\n <Button type=\"button\" variant=\"outline\" size=\"sm\" onClick={onRetry}>\n <IconRefresh className=\"size-4\" />\n {t(\"dispatch.pages.tryAgain\")}\n </Button>\n </AlertDescription>\n </Alert>\n );\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { agentNativePath } from "@agent-native/core/client";
|
|
2
|
+
import { agentNativePath } from "@agent-native/core/client/api-path";
|
|
3
3
|
import { IconExternalLink, IconTrash } from "@tabler/icons-react";
|
|
4
4
|
import { useRef, useState } from "react";
|
|
5
5
|
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, } from "./ui/alert-dialog.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents-panel.js","sour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ACN,KAAC,KAAK,IACJ,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EACvD,WAAW,EAAC,wBAAwB,GACpC,EACD,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CACb,YAAG,SAAS,EAAC,sCAAsC,YAChD,MAAM,CAAC,IAAI,GACV,CACL,CAAC,CAAC,CAAC,IAAI,EACR,KAAC,MAAM,IAAC,IAAI,EAAC,QAAQ,EAAC,SAAS,EAAC,QAAQ,EAAC,QAAQ,EAAE,MAAM,YACtD,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,GAC5B,IACJ,IACH,IACF,GACE,CACX,CAAC;AACJ,CAAC","sourcesContent":["import { agentNativePath } from \"@agent-native/core/client\";\nimport { IconExternalLink, IconTrash } from \"@tabler/icons-react\";\nimport { useRef, useState, type FormEvent } from \"react\";\n\nimport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n AlertDialogTrigger,\n} from \"./ui/alert-dialog\";\nimport { Button } from \"./ui/button\";\nimport { Input } from \"./ui/input\";\n\nexport interface ConnectedAgent {\n id: string;\n name: string;\n description: string;\n url: string;\n color: string;\n source: \"builtin\" | \"custom\" | \"workspace\";\n resourceId?: string;\n path?: string;\n scope?: \"shared\" | \"personal\";\n}\n\ntype AgentFormErrors = Partial<Record<\"name\" | \"url\" | \"form\", string>>;\n\nfunction slugifyAgentName(value: string): string {\n return value\n .trim()\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\");\n}\n\nfunction validateAgentForm(name: string, url: string): AgentFormErrors {\n const errors: AgentFormErrors = {};\n const trimmedName = name.trim();\n const trimmedUrl = url.trim();\n\n if (!trimmedName) {\n errors.name = \"Agent name is required.\";\n } else if (!slugifyAgentName(trimmedName)) {\n errors.name = \"Agent name must include at least one letter or number.\";\n }\n\n if (!trimmedUrl) {\n errors.url = \"Agent endpoint URL is required.\";\n } else {\n try {\n const parsed = new URL(trimmedUrl);\n if (parsed.protocol !== \"https:\" && parsed.protocol !== \"http:\") {\n errors.url = \"Use an http:// or https:// endpoint URL.\";\n } else if (!parsed.hostname) {\n errors.url = \"Enter a complete endpoint URL with a host.\";\n } else if (parsed.username || parsed.password) {\n errors.url = \"Do not include credentials in the endpoint URL.\";\n }\n } catch {\n errors.url =\n \"Enter a valid endpoint URL, such as https://app.example.com.\";\n }\n }\n\n return errors;\n}\n\nexport function AgentsPanel({\n agents,\n onRefresh,\n}: {\n agents: ConnectedAgent[];\n onRefresh: () => void;\n}) {\n const [name, setName] = useState(\"\");\n const [url, setUrl] = useState(\"\");\n const [description, setDescription] = useState(\"\");\n const [saving, setSaving] = useState(false);\n const [errors, setErrors] = useState<AgentFormErrors>({});\n const nameRef = useRef<HTMLInputElement>(null);\n\n const customAgents = agents.filter((agent) => agent.source === \"custom\");\n const workspaceAgents = agents.filter(\n (agent) => agent.source === \"workspace\",\n );\n const builtinAgents = agents.filter((agent) => agent.source === \"builtin\");\n\n const handleAdd = async (event?: FormEvent<HTMLFormElement>) => {\n event?.preventDefault();\n const trimmedName = name.trim();\n const trimmedUrl = url.trim();\n const nextErrors = validateAgentForm(trimmedName, trimmedUrl);\n if (Object.keys(nextErrors).length > 0) {\n setErrors(nextErrors);\n return;\n }\n\n const id = slugifyAgentName(trimmedName);\n const agentJson = JSON.stringify(\n {\n id,\n name: trimmedName,\n description: description.trim() || undefined,\n url: trimmedUrl,\n color: \"#6B7280\",\n },\n null,\n 2,\n );\n\n setSaving(true);\n try {\n const res = await fetch(agentNativePath(\"/_agent-native/resources\"), {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({\n path: `remote-agents/${id}.json`,\n content: agentJson,\n shared: true,\n }),\n });\n if (res.ok) {\n setName(\"\");\n setUrl(\"\");\n setDescription(\"\");\n setErrors({});\n onRefresh();\n nameRef.current?.focus();\n } else {\n setErrors({\n form: `Could not add agent. Request failed with ${res.status}.`,\n });\n }\n } catch (error) {\n setErrors({\n form:\n error instanceof Error\n ? error.message\n : \"Could not add agent. Please try again.\",\n });\n } finally {\n setSaving(false);\n }\n };\n\n const handleDelete = async (resourceId?: string) => {\n if (!resourceId) return;\n const res = await fetch(\n agentNativePath(`/_agent-native/resources/${resourceId}`),\n {\n method: \"DELETE\",\n },\n );\n if (res.ok) onRefresh();\n };\n\n return (\n <section className=\"rounded-2xl border bg-card p-5\">\n <div className=\"grid gap-4 xl:grid-cols-[minmax(0,1fr)_320px]\">\n <div className=\"space-y-4\">\n <div>\n <div className=\"text-sm font-medium text-foreground\">\n Available by default\n </div>\n <div className=\"mt-2 flex flex-wrap gap-2\">\n {builtinAgents.map((agent) => (\n <div\n key={agent.id}\n className=\"inline-flex items-center gap-2 rounded-full border px-3 py-1.5 text-xs text-muted-foreground\"\n >\n <span\n className=\"h-2 w-2 rounded-full\"\n style={{ backgroundColor: agent.color }}\n />\n <span>{agent.name}</span>\n </div>\n ))}\n {builtinAgents.length === 0 && (\n <div className=\"rounded-xl border border-dashed px-4 py-6 text-sm text-muted-foreground\">\n No default agents detected.\n </div>\n )}\n </div>\n </div>\n\n <div>\n <div className=\"text-sm font-medium text-foreground\">\n Added in this workspace\n </div>\n <div className=\"mt-2 space-y-2\">\n {workspaceAgents.map((agent) => (\n <div\n key={agent.id}\n className=\"flex items-start justify-between gap-3 rounded-xl border bg-muted/30 px-4 py-3\"\n >\n <div className=\"min-w-0\">\n <div className=\"text-sm font-medium text-foreground\">\n {agent.name}\n </div>\n {agent.description ? (\n <div className=\"mt-1 text-xs text-muted-foreground\">\n {agent.description}\n </div>\n ) : null}\n <div className=\"mt-1 text-xs text-muted-foreground\">\n <a\n href={agent.url}\n target=\"_blank\"\n rel=\"noreferrer\"\n className=\"inline-flex items-center gap-1 hover:text-foreground\"\n >\n {agent.url}\n <IconExternalLink className=\"h-3 w-3\" />\n </a>\n </div>\n </div>\n </div>\n ))}\n {customAgents.map((agent) => (\n <div\n key={agent.id}\n className=\"flex items-start justify-between gap-3 rounded-xl border bg-muted/30 px-4 py-3\"\n >\n <div className=\"min-w-0\">\n <div className=\"text-sm font-medium text-foreground\">\n {agent.name}\n </div>\n {agent.description ? (\n <div className=\"mt-1 text-xs text-muted-foreground\">\n {agent.description}\n </div>\n ) : null}\n <div className=\"mt-1 flex items-center gap-2 text-xs text-muted-foreground\">\n <a\n href={agent.url}\n target=\"_blank\"\n rel=\"noreferrer\"\n className=\"inline-flex items-center gap-1 hover:text-foreground\"\n >\n {agent.url}\n <IconExternalLink className=\"h-3 w-3\" />\n </a>\n <span>·</span>\n <span>{agent.scope || \"shared\"}</span>\n </div>\n </div>\n <AlertDialog>\n <AlertDialogTrigger asChild>\n <Button variant=\"ghost\" size=\"icon\">\n <IconTrash className=\"h-4 w-4\" />\n </Button>\n </AlertDialogTrigger>\n <AlertDialogContent>\n <AlertDialogHeader>\n <AlertDialogTitle>Remove this agent?</AlertDialogTitle>\n <AlertDialogDescription>\n “{agent.name}” will be removed from the workspace. Any\n jobs or chats that delegate to it will stop working.\n </AlertDialogDescription>\n </AlertDialogHeader>\n <AlertDialogFooter>\n <AlertDialogCancel>Cancel</AlertDialogCancel>\n <AlertDialogAction\n onClick={() => handleDelete(agent.resourceId)}\n >\n Remove\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n </div>\n ))}\n {workspaceAgents.length === 0 && customAgents.length === 0 && (\n <div className=\"rounded-xl border border-dashed px-4 py-6 text-sm text-muted-foreground\">\n No extra agents added yet.\n </div>\n )}\n </div>\n </div>\n </div>\n\n <div className=\"rounded-xl border bg-muted/20 p-4\">\n <div className=\"text-sm font-medium text-foreground\">\n Add external agent\n </div>\n <p className=\"mt-1 text-xs leading-relaxed text-muted-foreground\">\n Add another A2A-compatible app by saving its agent endpoint here.\n </p>\n <form className=\"mt-4 space-y-3\" onSubmit={handleAdd} noValidate>\n <div className=\"space-y-1.5\">\n <Input\n ref={nameRef}\n value={name}\n onChange={(event) => {\n setName(event.target.value);\n setErrors((current) => ({ ...current, name: undefined }));\n }}\n placeholder=\"Name\"\n aria-invalid={Boolean(errors.name)}\n aria-describedby={\n errors.name ? \"external-agent-name-error\" : undefined\n }\n />\n {errors.name ? (\n <p\n id=\"external-agent-name-error\"\n className=\"text-xs font-medium text-destructive\"\n >\n {errors.name}\n </p>\n ) : null}\n </div>\n <div className=\"space-y-1.5\">\n <Input\n value={url}\n onChange={(event) => {\n setUrl(event.target.value);\n setErrors((current) => ({ ...current, url: undefined }));\n }}\n placeholder=\"https://app.example.com\"\n aria-invalid={Boolean(errors.url)}\n aria-describedby={\n errors.url ? \"external-agent-url-error\" : undefined\n }\n />\n {errors.url ? (\n <p\n id=\"external-agent-url-error\"\n className=\"text-xs font-medium text-destructive\"\n >\n {errors.url}\n </p>\n ) : null}\n </div>\n <Input\n value={description}\n onChange={(event) => setDescription(event.target.value)}\n placeholder=\"Description (optional)\"\n />\n {errors.form ? (\n <p className=\"text-xs font-medium text-destructive\">\n {errors.form}\n </p>\n ) : null}\n <Button type=\"submit\" className=\"w-full\" disabled={saving}>\n {saving ? \"Saving...\" : \"Add agent\"}\n </Button>\n </form>\n </div>\n </div>\n </section>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"agents-panel.js","sourceRoot":"","sources":["../../src/components/agents-panel.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AAEzD,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,sBAAsB,EACtB,iBA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IAAC,IAAI,EAAC,QAAQ,EAAC,SAAS,EAAC,QAAQ,EAAC,QAAQ,EAAE,MAAM,YACtD,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,GAC5B,IACJ,IACH,IACF,GACE,CACX,CAAC;AACJ,CAAC","sourcesContent":["import { agentNativePath } from \"@agent-native/core/client/api-path\";\nimport { IconExternalLink, IconTrash } from \"@tabler/icons-react\";\nimport { useRef, useState, type FormEvent } from \"react\";\n\nimport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n AlertDialogTrigger,\n} from \"./ui/alert-dialog\";\nimport { Button } from \"./ui/button\";\nimport { Input } from \"./ui/input\";\n\nexport interface ConnectedAgent {\n id: string;\n name: string;\n description: string;\n url: string;\n color: string;\n source: \"builtin\" | \"custom\" | \"workspace\";\n resourceId?: string;\n path?: string;\n scope?: \"shared\" | \"personal\";\n}\n\ntype AgentFormErrors = Partial<Record<\"name\" | \"url\" | \"form\", string>>;\n\nfunction slugifyAgentName(value: string): string {\n return value\n .trim()\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\");\n}\n\nfunction validateAgentForm(name: string, url: string): AgentFormErrors {\n const errors: AgentFormErrors = {};\n const trimmedName = name.trim();\n const trimmedUrl = url.trim();\n\n if (!trimmedName) {\n errors.name = \"Agent name is required.\";\n } else if (!slugifyAgentName(trimmedName)) {\n errors.name = \"Agent name must include at least one letter or number.\";\n }\n\n if (!trimmedUrl) {\n errors.url = \"Agent endpoint URL is required.\";\n } else {\n try {\n const parsed = new URL(trimmedUrl);\n if (parsed.protocol !== \"https:\" && parsed.protocol !== \"http:\") {\n errors.url = \"Use an http:// or https:// endpoint URL.\";\n } else if (!parsed.hostname) {\n errors.url = \"Enter a complete endpoint URL with a host.\";\n } else if (parsed.username || parsed.password) {\n errors.url = \"Do not include credentials in the endpoint URL.\";\n }\n } catch {\n errors.url =\n \"Enter a valid endpoint URL, such as https://app.example.com.\";\n }\n }\n\n return errors;\n}\n\nexport function AgentsPanel({\n agents,\n onRefresh,\n}: {\n agents: ConnectedAgent[];\n onRefresh: () => void;\n}) {\n const [name, setName] = useState(\"\");\n const [url, setUrl] = useState(\"\");\n const [description, setDescription] = useState(\"\");\n const [saving, setSaving] = useState(false);\n const [errors, setErrors] = useState<AgentFormErrors>({});\n const nameRef = useRef<HTMLInputElement>(null);\n\n const customAgents = agents.filter((agent) => agent.source === \"custom\");\n const workspaceAgents = agents.filter(\n (agent) => agent.source === \"workspace\",\n );\n const builtinAgents = agents.filter((agent) => agent.source === \"builtin\");\n\n const handleAdd = async (event?: FormEvent<HTMLFormElement>) => {\n event?.preventDefault();\n const trimmedName = name.trim();\n const trimmedUrl = url.trim();\n const nextErrors = validateAgentForm(trimmedName, trimmedUrl);\n if (Object.keys(nextErrors).length > 0) {\n setErrors(nextErrors);\n return;\n }\n\n const id = slugifyAgentName(trimmedName);\n const agentJson = JSON.stringify(\n {\n id,\n name: trimmedName,\n description: description.trim() || undefined,\n url: trimmedUrl,\n color: \"#6B7280\",\n },\n null,\n 2,\n );\n\n setSaving(true);\n try {\n const res = await fetch(agentNativePath(\"/_agent-native/resources\"), {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({\n path: `remote-agents/${id}.json`,\n content: agentJson,\n shared: true,\n }),\n });\n if (res.ok) {\n setName(\"\");\n setUrl(\"\");\n setDescription(\"\");\n setErrors({});\n onRefresh();\n nameRef.current?.focus();\n } else {\n setErrors({\n form: `Could not add agent. Request failed with ${res.status}.`,\n });\n }\n } catch (error) {\n setErrors({\n form:\n error instanceof Error\n ? error.message\n : \"Could not add agent. Please try again.\",\n });\n } finally {\n setSaving(false);\n }\n };\n\n const handleDelete = async (resourceId?: string) => {\n if (!resourceId) return;\n const res = await fetch(\n agentNativePath(`/_agent-native/resources/${resourceId}`),\n {\n method: \"DELETE\",\n },\n );\n if (res.ok) onRefresh();\n };\n\n return (\n <section className=\"rounded-2xl border bg-card p-5\">\n <div className=\"grid gap-4 xl:grid-cols-[minmax(0,1fr)_320px]\">\n <div className=\"space-y-4\">\n <div>\n <div className=\"text-sm font-medium text-foreground\">\n Available by default\n </div>\n <div className=\"mt-2 flex flex-wrap gap-2\">\n {builtinAgents.map((agent) => (\n <div\n key={agent.id}\n className=\"inline-flex items-center gap-2 rounded-full border px-3 py-1.5 text-xs text-muted-foreground\"\n >\n <span\n className=\"h-2 w-2 rounded-full\"\n style={{ backgroundColor: agent.color }}\n />\n <span>{agent.name}</span>\n </div>\n ))}\n {builtinAgents.length === 0 && (\n <div className=\"rounded-xl border border-dashed px-4 py-6 text-sm text-muted-foreground\">\n No default agents detected.\n </div>\n )}\n </div>\n </div>\n\n <div>\n <div className=\"text-sm font-medium text-foreground\">\n Added in this workspace\n </div>\n <div className=\"mt-2 space-y-2\">\n {workspaceAgents.map((agent) => (\n <div\n key={agent.id}\n className=\"flex items-start justify-between gap-3 rounded-xl border bg-muted/30 px-4 py-3\"\n >\n <div className=\"min-w-0\">\n <div className=\"text-sm font-medium text-foreground\">\n {agent.name}\n </div>\n {agent.description ? (\n <div className=\"mt-1 text-xs text-muted-foreground\">\n {agent.description}\n </div>\n ) : null}\n <div className=\"mt-1 text-xs text-muted-foreground\">\n <a\n href={agent.url}\n target=\"_blank\"\n rel=\"noreferrer\"\n className=\"inline-flex items-center gap-1 hover:text-foreground\"\n >\n {agent.url}\n <IconExternalLink className=\"h-3 w-3\" />\n </a>\n </div>\n </div>\n </div>\n ))}\n {customAgents.map((agent) => (\n <div\n key={agent.id}\n className=\"flex items-start justify-between gap-3 rounded-xl border bg-muted/30 px-4 py-3\"\n >\n <div className=\"min-w-0\">\n <div className=\"text-sm font-medium text-foreground\">\n {agent.name}\n </div>\n {agent.description ? (\n <div className=\"mt-1 text-xs text-muted-foreground\">\n {agent.description}\n </div>\n ) : null}\n <div className=\"mt-1 flex items-center gap-2 text-xs text-muted-foreground\">\n <a\n href={agent.url}\n target=\"_blank\"\n rel=\"noreferrer\"\n className=\"inline-flex items-center gap-1 hover:text-foreground\"\n >\n {agent.url}\n <IconExternalLink className=\"h-3 w-3\" />\n </a>\n <span>·</span>\n <span>{agent.scope || \"shared\"}</span>\n </div>\n </div>\n <AlertDialog>\n <AlertDialogTrigger asChild>\n <Button variant=\"ghost\" size=\"icon\">\n <IconTrash className=\"h-4 w-4\" />\n </Button>\n </AlertDialogTrigger>\n <AlertDialogContent>\n <AlertDialogHeader>\n <AlertDialogTitle>Remove this agent?</AlertDialogTitle>\n <AlertDialogDescription>\n “{agent.name}” will be removed from the workspace. Any\n jobs or chats that delegate to it will stop working.\n </AlertDialogDescription>\n </AlertDialogHeader>\n <AlertDialogFooter>\n <AlertDialogCancel>Cancel</AlertDialogCancel>\n <AlertDialogAction\n onClick={() => handleDelete(agent.resourceId)}\n >\n Remove\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n </div>\n ))}\n {workspaceAgents.length === 0 && customAgents.length === 0 && (\n <div className=\"rounded-xl border border-dashed px-4 py-6 text-sm text-muted-foreground\">\n No extra agents added yet.\n </div>\n )}\n </div>\n </div>\n </div>\n\n <div className=\"rounded-xl border bg-muted/20 p-4\">\n <div className=\"text-sm font-medium text-foreground\">\n Add external agent\n </div>\n <p className=\"mt-1 text-xs leading-relaxed text-muted-foreground\">\n Add another A2A-compatible app by saving its agent endpoint here.\n </p>\n <form className=\"mt-4 space-y-3\" onSubmit={handleAdd} noValidate>\n <div className=\"space-y-1.5\">\n <Input\n ref={nameRef}\n value={name}\n onChange={(event) => {\n setName(event.target.value);\n setErrors((current) => ({ ...current, name: undefined }));\n }}\n placeholder=\"Name\"\n aria-invalid={Boolean(errors.name)}\n aria-describedby={\n errors.name ? \"external-agent-name-error\" : undefined\n }\n />\n {errors.name ? (\n <p\n id=\"external-agent-name-error\"\n className=\"text-xs font-medium text-destructive\"\n >\n {errors.name}\n </p>\n ) : null}\n </div>\n <div className=\"space-y-1.5\">\n <Input\n value={url}\n onChange={(event) => {\n setUrl(event.target.value);\n setErrors((current) => ({ ...current, url: undefined }));\n }}\n placeholder=\"https://app.example.com\"\n aria-invalid={Boolean(errors.url)}\n aria-describedby={\n errors.url ? \"external-agent-url-error\" : undefined\n }\n />\n {errors.url ? (\n <p\n id=\"external-agent-url-error\"\n className=\"text-xs font-medium text-destructive\"\n >\n {errors.url}\n </p>\n ) : null}\n </div>\n <Input\n value={description}\n onChange={(event) => setDescription(event.target.value)}\n placeholder=\"Description (optional)\"\n />\n {errors.form ? (\n <p className=\"text-xs font-medium text-destructive\">\n {errors.form}\n </p>\n ) : null}\n <Button type=\"submit\" className=\"w-full\" disabled={saving}>\n {saving ? \"Saving...\" : \"Add agent\"}\n </Button>\n </form>\n </div>\n </div>\n </section>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-keys-popover.d.ts","sourceRoot":"","sources":["../../src/components/app-keys-popover.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"app-keys-popover.d.ts","sourceRoot":"","sources":["../../src/components/app-keys-popover.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAqB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAwB1D,UAAU,mBAAmB;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IACnC,IAAI,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;CAC5C;AAED,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,OAAO,EACP,OAAO,EACP,KAAa,EACb,IAAe,GAChB,EAAE,mBAAmB,mDAwCrB;AAED,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,OAAO,GACR,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB,mDA8LA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useActionMutation, useActionQuery } from "@agent-native/core/client";
|
|
2
|
+
import { useActionMutation, useActionQuery, } from "@agent-native/core/client/hooks";
|
|
3
3
|
import { IconCheck, IconLoader2, IconRefresh, IconSettings, } from "@tabler/icons-react";
|
|
4
4
|
import { useMemo, useState } from "react";
|
|
5
5
|
import { toast } from "sonner";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-keys-popover.js","sourceRoot":"","sources":["../../src/components/app-keys-popover.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC9E,OAAO,EACL,SAAS,EACT,WAAW,EACX,WAAW,EACX,YAAY,GACb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAE/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAyBvE,MAAM,UAAU,cAAc,CAAC,EAC7B,KAAK,EACL,OAAO,EACP,OAAO,EACP,KAAK,GAAG,KAAK,EACb,IAAI,GAAG,QAAQ,GACK;IACpB,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC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CACV,CAAC;gBACJ,CAAC,CAAC,CACH,GACG,IACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["import { useActionMutation, useActionQuery } from \"@agent-native/core/client\";\nimport {\n IconCheck,\n IconLoader2,\n IconRefresh,\n IconSettings,\n} from \"@tabler/icons-react\";\nimport { useMemo, useState, type ReactNode } from \"react\";\nimport { toast } from \"sonner\";\n\nimport { ActionQueryError } from \"./action-query-error\";\nimport { Button } from \"./ui/button\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"./ui/popover\";\nimport { Skeleton } from \"./ui/skeleton\";\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"./ui/tooltip\";\n\ninterface VaultSecret {\n id: string;\n name?: string | null;\n credentialKey: string;\n provider?: string | null;\n description?: string | null;\n}\n\ninterface VaultGrant {\n id: string;\n secretId: string;\n appId: string;\n status?: string | null;\n}\n\ninterface AppKeysPopoverProps {\n appId: string;\n appName: string;\n trigger?: ReactNode;\n align?: \"start\" | \"center\" | \"end\";\n side?: \"top\" | \"right\" | \"bottom\" | \"left\";\n}\n\nexport function AppKeysPopover({\n appId,\n appName,\n trigger,\n align = \"end\",\n side = \"bottom\",\n}: AppKeysPopoverProps) {\n const [open, setOpen] = useState(false);\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <Tooltip>\n <TooltipTrigger asChild>\n <PopoverTrigger asChild>\n {trigger ?? (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n aria-label={`Manage keys for ${appName}`}\n onClick={(event) => {\n // Keep parent card click handlers from also firing. Do not\n // preventDefault here: Radix uses the same click to open the\n // popover trigger.\n event.stopPropagation();\n }}\n className=\"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 >\n <IconSettings size={14} />\n </Button>\n )}\n </PopoverTrigger>\n </TooltipTrigger>\n <TooltipContent>Manage keys</TooltipContent>\n </Tooltip>\n <PopoverContent\n align={align}\n side={side}\n sideOffset={6}\n className=\"w-80 p-3\"\n onClick={(event) => event.stopPropagation()}\n >\n {open ? <AppKeysPanel appId={appId} appName={appName} /> : null}\n </PopoverContent>\n </Popover>\n );\n}\n\nexport function AppKeysPanel({\n appId,\n appName,\n}: {\n appId: string;\n appName: string;\n}) {\n const secretsQuery = useActionQuery(\"list-vault-secret-options\", {});\n const grantsQuery = useActionQuery(\"list-vault-grants\", { appId });\n const accessQuery = useActionQuery(\"get-vault-access-settings\", {});\n const { data: secrets = [], isLoading: secretsLoading } = secretsQuery;\n const {\n data: grants = [],\n isLoading: grantsLoading,\n refetch: refetchGrants,\n } = grantsQuery;\n const { data: accessSettings, isLoading: accessLoading } = accessQuery;\n const accessMode =\n (accessSettings as any)?.mode === \"manual\" ? \"manual\" : \"all-apps\";\n\n const grantBySecretId = useMemo(() => {\n const map = new Map<string, VaultGrant>();\n for (const grant of grants as VaultGrant[]) {\n if (grant.status && grant.status !== \"active\") continue;\n map.set(grant.secretId, grant);\n }\n return map;\n }, [grants]);\n\n // Track per-secret pending state so a fast double-click on the same row\n // can't queue two `create-vault-grant` requests (which would silently\n // create duplicate active grants — a later revoke only clears one).\n const [pendingSecretIds, setPendingSecretIds] = useState<Set<string>>(\n () => new Set(),\n );\n const markPending = (secretId: string, pending: boolean) =>\n setPendingSecretIds((prev) => {\n const next = new Set(prev);\n if (pending) next.add(secretId);\n else next.delete(secretId);\n return next;\n });\n\n const grantMutation = useActionMutation(\"create-vault-grant\", {\n onSuccess: () => refetchGrants(),\n onError: (err) => toast.error(`Could not grant: ${String(err)}`),\n });\n\n const revokeMutation = useActionMutation(\"revoke-vault-grant\", {\n onSuccess: () => refetchGrants(),\n onError: (err) => toast.error(`Could not revoke: ${String(err)}`),\n });\n\n const syncMutation = useActionMutation(\"sync-vault-to-app\", {\n onSuccess: (result: any) => {\n const synced = result?.synced ?? 0;\n toast.success(\n synced > 0\n ? `Synced ${synced} key${synced === 1 ? \"\" : \"s\"} to ${appName}`\n : `${appName} is up to date`,\n );\n },\n onError: (err) => toast.error(`Sync failed: ${String(err)}`),\n });\n\n const isLoading = secretsLoading || grantsLoading || accessLoading;\n const error = secretsQuery.error ?? grantsQuery.error ?? accessQuery.error;\n const grantedCount = grantBySecretId.size;\n const typedSecrets = secrets as VaultSecret[];\n const allApps = accessMode !== \"manual\";\n\n const toggleSecret = (secret: VaultSecret) => {\n if (allApps) return;\n if (pendingSecretIds.has(secret.id)) return;\n const existing = grantBySecretId.get(secret.id);\n markPending(secret.id, true);\n const onSettled = () => markPending(secret.id, false);\n if (existing) {\n revokeMutation.mutate({ grantId: existing.id }, { onSettled });\n } else {\n grantMutation.mutate({ secretId: secret.id, appId }, { onSettled });\n }\n };\n\n return (\n <div className=\"flex flex-col gap-3\">\n <div className=\"flex items-center justify-between gap-2 px-1\">\n <div className=\"min-w-0\">\n <p className=\"truncate text-sm font-semibold text-foreground\">\n Keys for {appName}\n </p>\n <p className=\"text-[11px] text-muted-foreground\">\n {error\n ? null\n : allApps\n ? `${typedSecrets.length} available`\n : `${grantedCount} of ${typedSecrets.length} granted`}\n </p>\n </div>\n {!error ? (\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n disabled={\n syncMutation.isPending ||\n typedSecrets.length === 0 ||\n (!allApps && grantedCount === 0)\n }\n onClick={() => syncMutation.mutate({ appId })}\n className=\"h-7 px-2\"\n >\n {syncMutation.isPending ? (\n <IconLoader2 className=\"h-3 w-3 animate-spin\" />\n ) : (\n <IconRefresh className=\"h-3 w-3\" />\n )}\n <span className=\"ml-1 text-xs\">Sync</span>\n </Button>\n ) : null}\n </div>\n\n <div className=\"max-h-[320px] space-y-1.5 overflow-y-auto rounded-md border border-border bg-card p-1.5\">\n {error ? (\n <ActionQueryError\n error={error}\n onRetry={() => {\n void secretsQuery.refetch();\n void grantsQuery.refetch();\n void accessQuery.refetch();\n }}\n />\n ) : isLoading ? (\n <div className=\"space-y-1.5 p-1.5\">\n {Array.from({ length: 3 }).map((_, index) => (\n <div\n key={index}\n className=\"flex items-start gap-3 rounded-md px-2.5 py-2\"\n >\n <Skeleton className=\"mt-0.5 h-4 w-4 shrink-0 rounded\" />\n <div className=\"flex-1 space-y-1.5\">\n <Skeleton className=\"h-3 w-1/2\" />\n <Skeleton className=\"h-3 w-3/4\" />\n </div>\n </div>\n ))}\n </div>\n ) : typedSecrets.length === 0 ? (\n <p className=\"rounded-md border border-dashed border-border px-3 py-3 text-xs text-muted-foreground\">\n No vault keys yet. Add one from the Vault page.\n </p>\n ) : (\n typedSecrets.map((secret) => {\n const granted = allApps || grantBySecretId.has(secret.id);\n const pending = pendingSecretIds.has(secret.id);\n return (\n <button\n key={secret.id}\n type=\"button\"\n aria-pressed={granted}\n disabled={pending || allApps}\n onClick={() => toggleSecret(secret)}\n className={`flex w-full items-start gap-3 rounded-md px-2.5 py-2 text-left text-sm disabled:cursor-not-allowed disabled:opacity-60 ${\n pending || allApps ? \"\" : \"cursor-pointer\"\n } ${\n granted\n ? \"border border-primary/45 bg-primary/5\"\n : \"border border-transparent hover:border-muted-foreground/30 hover:bg-accent/35\"\n }`}\n >\n <span\n className={`mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded border ${\n granted\n ? \"border-primary/60 bg-primary/10 text-primary\"\n : \"border-muted-foreground/35 text-transparent\"\n }`}\n >\n {granted ? <IconCheck className=\"h-3 w-3\" /> : null}\n </span>\n <span className=\"min-w-0 flex-1\">\n <span className=\"block truncate font-medium\">\n {secret.credentialKey}\n </span>\n <span className=\"block truncate text-xs text-muted-foreground/70\">\n {allApps\n ? \"Available to this app\"\n : secret.provider || secret.name || \"Vault secret\"}\n </span>\n </span>\n </button>\n );\n })\n )}\n </div>\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"app-keys-popover.js","sourceRoot":"","sources":["../../src/components/app-keys-popover.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,iBAAiB,EACjB,cAAc,GACf,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AAC,YAAY,CAAC,MAAM,CAAC,EACnC,SAAS,EAAE,0HACT,OAAO,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,gBAC5B,IACE,OAAO;4BACL,CAAC,CAAC,uCAAuC;4BACzC,CAAC,CAAC,+EACN,EAAE,aAEF,eACE,SAAS,EAAE,2EACT,OAAO;oCACL,CAAC,CAAC,8CAA8C;oCAChD,CAAC,CAAC,6CACN,EAAE,YAED,OAAO,CAAC,CAAC,CAAC,KAAC,SAAS,IAAC,SAAS,EAAC,SAAS,GAAG,CAAC,CAAC,CAAC,IAAI,GAC9C,EACP,gBAAM,SAAS,EAAC,gBAAgB,aAC9B,eAAM,SAAS,EAAC,4BAA4B,YACzC,MAAM,CAAC,aAAa,GAChB,EACP,eAAM,SAAS,EAAC,iDAAiD,YAC9D,OAAO;4CACN,CAAC,CAAC,uBAAuB;4CACzB,CAAC,CAAC,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,IAAI,IAAI,cAAc,GAC/C,IACF,KA/BF,MAAM,CAAC,EAAE,CAgCP,CACV,CAAC;gBACJ,CAAC,CAAC,CACH,GACG,IACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["import {\n useActionMutation,\n useActionQuery,\n} from \"@agent-native/core/client/hooks\";\nimport {\n IconCheck,\n IconLoader2,\n IconRefresh,\n IconSettings,\n} from \"@tabler/icons-react\";\nimport { useMemo, useState, type ReactNode } from \"react\";\nimport { toast } from \"sonner\";\n\nimport { ActionQueryError } from \"./action-query-error\";\nimport { Button } from \"./ui/button\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"./ui/popover\";\nimport { Skeleton } from \"./ui/skeleton\";\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"./ui/tooltip\";\n\ninterface VaultSecret {\n id: string;\n name?: string | null;\n credentialKey: string;\n provider?: string | null;\n description?: string | null;\n}\n\ninterface VaultGrant {\n id: string;\n secretId: string;\n appId: string;\n status?: string | null;\n}\n\ninterface AppKeysPopoverProps {\n appId: string;\n appName: string;\n trigger?: ReactNode;\n align?: \"start\" | \"center\" | \"end\";\n side?: \"top\" | \"right\" | \"bottom\" | \"left\";\n}\n\nexport function AppKeysPopover({\n appId,\n appName,\n trigger,\n align = \"end\",\n side = \"bottom\",\n}: AppKeysPopoverProps) {\n const [open, setOpen] = useState(false);\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <Tooltip>\n <TooltipTrigger asChild>\n <PopoverTrigger asChild>\n {trigger ?? (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n aria-label={`Manage keys for ${appName}`}\n onClick={(event) => {\n // Keep parent card click handlers from also firing. Do not\n // preventDefault here: Radix uses the same click to open the\n // popover trigger.\n event.stopPropagation();\n }}\n className=\"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 >\n <IconSettings size={14} />\n </Button>\n )}\n </PopoverTrigger>\n </TooltipTrigger>\n <TooltipContent>Manage keys</TooltipContent>\n </Tooltip>\n <PopoverContent\n align={align}\n side={side}\n sideOffset={6}\n className=\"w-80 p-3\"\n onClick={(event) => event.stopPropagation()}\n >\n {open ? <AppKeysPanel appId={appId} appName={appName} /> : null}\n </PopoverContent>\n </Popover>\n );\n}\n\nexport function AppKeysPanel({\n appId,\n appName,\n}: {\n appId: string;\n appName: string;\n}) {\n const secretsQuery = useActionQuery(\"list-vault-secret-options\", {});\n const grantsQuery = useActionQuery(\"list-vault-grants\", { appId });\n const accessQuery = useActionQuery(\"get-vault-access-settings\", {});\n const { data: secrets = [], isLoading: secretsLoading } = secretsQuery;\n const {\n data: grants = [],\n isLoading: grantsLoading,\n refetch: refetchGrants,\n } = grantsQuery;\n const { data: accessSettings, isLoading: accessLoading } = accessQuery;\n const accessMode =\n (accessSettings as any)?.mode === \"manual\" ? \"manual\" : \"all-apps\";\n\n const grantBySecretId = useMemo(() => {\n const map = new Map<string, VaultGrant>();\n for (const grant of grants as VaultGrant[]) {\n if (grant.status && grant.status !== \"active\") continue;\n map.set(grant.secretId, grant);\n }\n return map;\n }, [grants]);\n\n // Track per-secret pending state so a fast double-click on the same row\n // can't queue two `create-vault-grant` requests (which would silently\n // create duplicate active grants — a later revoke only clears one).\n const [pendingSecretIds, setPendingSecretIds] = useState<Set<string>>(\n () => new Set(),\n );\n const markPending = (secretId: string, pending: boolean) =>\n setPendingSecretIds((prev) => {\n const next = new Set(prev);\n if (pending) next.add(secretId);\n else next.delete(secretId);\n return next;\n });\n\n const grantMutation = useActionMutation(\"create-vault-grant\", {\n onSuccess: () => refetchGrants(),\n onError: (err) => toast.error(`Could not grant: ${String(err)}`),\n });\n\n const revokeMutation = useActionMutation(\"revoke-vault-grant\", {\n onSuccess: () => refetchGrants(),\n onError: (err) => toast.error(`Could not revoke: ${String(err)}`),\n });\n\n const syncMutation = useActionMutation(\"sync-vault-to-app\", {\n onSuccess: (result: any) => {\n const synced = result?.synced ?? 0;\n toast.success(\n synced > 0\n ? `Synced ${synced} key${synced === 1 ? \"\" : \"s\"} to ${appName}`\n : `${appName} is up to date`,\n );\n },\n onError: (err) => toast.error(`Sync failed: ${String(err)}`),\n });\n\n const isLoading = secretsLoading || grantsLoading || accessLoading;\n const error = secretsQuery.error ?? grantsQuery.error ?? accessQuery.error;\n const grantedCount = grantBySecretId.size;\n const typedSecrets = secrets as VaultSecret[];\n const allApps = accessMode !== \"manual\";\n\n const toggleSecret = (secret: VaultSecret) => {\n if (allApps) return;\n if (pendingSecretIds.has(secret.id)) return;\n const existing = grantBySecretId.get(secret.id);\n markPending(secret.id, true);\n const onSettled = () => markPending(secret.id, false);\n if (existing) {\n revokeMutation.mutate({ grantId: existing.id }, { onSettled });\n } else {\n grantMutation.mutate({ secretId: secret.id, appId }, { onSettled });\n }\n };\n\n return (\n <div className=\"flex flex-col gap-3\">\n <div className=\"flex items-center justify-between gap-2 px-1\">\n <div className=\"min-w-0\">\n <p className=\"truncate text-sm font-semibold text-foreground\">\n Keys for {appName}\n </p>\n <p className=\"text-[11px] text-muted-foreground\">\n {error\n ? null\n : allApps\n ? `${typedSecrets.length} available`\n : `${grantedCount} of ${typedSecrets.length} granted`}\n </p>\n </div>\n {!error ? (\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n disabled={\n syncMutation.isPending ||\n typedSecrets.length === 0 ||\n (!allApps && grantedCount === 0)\n }\n onClick={() => syncMutation.mutate({ appId })}\n className=\"h-7 px-2\"\n >\n {syncMutation.isPending ? (\n <IconLoader2 className=\"h-3 w-3 animate-spin\" />\n ) : (\n <IconRefresh className=\"h-3 w-3\" />\n )}\n <span className=\"ml-1 text-xs\">Sync</span>\n </Button>\n ) : null}\n </div>\n\n <div className=\"max-h-[320px] space-y-1.5 overflow-y-auto rounded-md border border-border bg-card p-1.5\">\n {error ? (\n <ActionQueryError\n error={error}\n onRetry={() => {\n void secretsQuery.refetch();\n void grantsQuery.refetch();\n void accessQuery.refetch();\n }}\n />\n ) : isLoading ? (\n <div className=\"space-y-1.5 p-1.5\">\n {Array.from({ length: 3 }).map((_, index) => (\n <div\n key={index}\n className=\"flex items-start gap-3 rounded-md px-2.5 py-2\"\n >\n <Skeleton className=\"mt-0.5 h-4 w-4 shrink-0 rounded\" />\n <div className=\"flex-1 space-y-1.5\">\n <Skeleton className=\"h-3 w-1/2\" />\n <Skeleton className=\"h-3 w-3/4\" />\n </div>\n </div>\n ))}\n </div>\n ) : typedSecrets.length === 0 ? (\n <p className=\"rounded-md border border-dashed border-border px-3 py-3 text-xs text-muted-foreground\">\n No vault keys yet. Add one from the Vault page.\n </p>\n ) : (\n typedSecrets.map((secret) => {\n const granted = allApps || grantBySecretId.has(secret.id);\n const pending = pendingSecretIds.has(secret.id);\n return (\n <button\n key={secret.id}\n type=\"button\"\n aria-pressed={granted}\n disabled={pending || allApps}\n onClick={() => toggleSecret(secret)}\n className={`flex w-full items-start gap-3 rounded-md px-2.5 py-2 text-left text-sm disabled:cursor-not-allowed disabled:opacity-60 ${\n pending || allApps ? \"\" : \"cursor-pointer\"\n } ${\n granted\n ? \"border border-primary/45 bg-primary/5\"\n : \"border border-transparent hover:border-muted-foreground/30 hover:bg-accent/35\"\n }`}\n >\n <span\n className={`mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded border ${\n granted\n ? \"border-primary/60 bg-primary/10 text-primary\"\n : \"border-muted-foreground/35 text-transparent\"\n }`}\n >\n {granted ? <IconCheck className=\"h-3 w-3\" /> : null}\n </span>\n <span className=\"min-w-0 flex-1\">\n <span className=\"block truncate font-medium\">\n {secret.credentialKey}\n </span>\n <span className=\"block truncate text-xs text-muted-foreground/70\">\n {allApps\n ? \"Available to this app\"\n : secret.provider || secret.name || \"Vault secret\"}\n </span>\n </span>\n </button>\n );\n })\n )}\n </div>\n </div>\n );\n}\n"]}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { sendToAgentChat } from "@agent-native/core/client/agent-chat";
|
|
3
|
+
import { useDevMode } from "@agent-native/core/client/agent-chat";
|
|
4
|
+
import { agentNativePath, appBasePath, } from "@agent-native/core/client/api-path";
|
|
5
|
+
import { PromptComposer } from "@agent-native/core/client/composer";
|
|
6
|
+
import { isInBuilderFrame } from "@agent-native/core/client/host";
|
|
3
7
|
import { getWorkspaceAppIdValidationError } from "@agent-native/core/shared";
|
|
4
8
|
import { IconArrowLeft, IconArrowUpRight, IconBook, IconCheck, IconChevronDown, IconFileText, IconKey, IconLoader2, IconPlus, } from "@tabler/icons-react";
|
|
5
9
|
import { useEffect, useMemo, useState } from "react";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-app-popover.js","sourceRoot":"","sources":["../../src/components/create-app-popover.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,cAAc,EACd,eAAe,EACf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B,KAAC,cAAc,IACb,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,EAAE,EACd,SAAS,EAAC,4DAA4D,YAEtE,KAAC,aAAa,IAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,GAAI,GACjC,IACT,CACX,CAAC;AACJ,CAAC","sourcesContent":["import {\n PromptComposer,\n agentNativePath,\n appBasePath,\n isInBuilderFrame,\n sendToAgentChat,\n useDevMode,\n} from \"@agent-native/core/client\";\nimport { getWorkspaceAppIdValidationError } from \"@agent-native/core/shared\";\nimport {\n IconArrowLeft,\n IconArrowUpRight,\n IconBook,\n IconCheck,\n IconChevronDown,\n IconFileText,\n IconKey,\n IconLoader2,\n IconPlus,\n} from \"@tabler/icons-react\";\nimport { useEffect, useMemo, useState, type ReactNode } from \"react\";\n\nimport { Button } from \"./ui/button\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"./ui/popover\";\n\ninterface VaultSecretOption {\n id: string;\n name: string;\n credentialKey: string;\n provider?: string | null;\n description?: string | null;\n}\n\ninterface WorkspaceResourceOption {\n id: string;\n kind: \"skill\" | \"instruction\" | \"agent\" | \"knowledge\" | \"mcp-server\";\n name: string;\n description?: string | null;\n path: string;\n scope: \"all\" | \"selected\";\n updatedAt?: number;\n}\n\ntype VaultAccessMode = \"all-apps\" | \"manual\";\n\ninterface CreateAppPopoverProps {\n /**\n * Custom trigger element. Defaults to a dashed-border tile that matches the\n * apps grid empty state.\n */\n trigger?: ReactNode;\n /**\n * Override the popover alignment. Defaults to \"center\" with a 10px offset.\n */\n align?: \"start\" | \"center\" | \"end\";\n}\n\nfunction slugify(value: string): string {\n return value\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\")\n .replace(/^[^a-z]+/, \"\")\n .slice(0, 48);\n}\n\nfunction titleFromPrompt(prompt: string): string {\n const cleaned = prompt\n .replace(/\\b(build|create|make|an?|the|app|tool|dashboard)\\b/gi, \" \")\n .replace(/\\s+/g, \" \")\n .trim();\n return slugify(cleaned || \"new-app\") || \"new-app\";\n}\n\nfunction buildAppCreationPrompt(input: {\n appId: string;\n prompt: string;\n selectedKeys: string[];\n selectedResources: WorkspaceResourceOption[];\n vaultAccessMode: VaultAccessMode;\n}): string {\n const keyList = input.selectedKeys.join(\", \");\n const grantRequest =\n input.vaultAccessMode === \"all-apps\"\n ? `Dispatch vault access: all saved vault keys are available to every workspace app by default. No per-app vault grants are needed.`\n : keyList\n ? `Requested Dispatch vault key grants for this app: ${keyList}`\n : `Requested Dispatch vault key grants for this app: none`;\n const resourceList = input.selectedResources.length\n ? input.selectedResources\n .map(\n (resource) =>\n `- ${resource.name} (${resource.kind}, ${resource.path})`,\n )\n .join(\"\\n\")\n : \"none\";\n\n return [\n `Create a new agent-native app in this workspace.`,\n `This is a new workspace app request, not a feature request for the current app.`,\n ``,\n `Suggested app name: ${input.appId} (you may adjust the slug if it conflicts)`,\n `User prompt: ${input.prompt.trim()}`,\n `Generate a concise one-sentence app description from the user prompt before coding; save it in apps/${input.appId}/package.json \"description\" so Dispatch and A2A can describe the app.`,\n `If the user mentions a product or company such as Granola, Loom, Superhuman, Linear, or Notion, treat it as product inspiration unless they explicitly ask to connect to that service. Do not invent or require third-party API keys like GRANOLA_API_KEY just because a product is named.`,\n grantRequest,\n `Requested Dispatch workspace resources for this app:\\n${resourceList}`,\n `Dispatch workspace resources with scope=all are inherited workspace context. Do not copy or sync them into the new app; every workspace app reads them at runtime and may override with app shared or personal resources.`,\n ``,\n `Pick a UI template that fits the user's prompt — analytics, assets, brain, calendar, chat, content, design, dispatch, forms, mail, slides, or clips when none of the others fit.`,\n `If you use the chat template, treat it as scaffolding only: the finished app must use the requested app's real name, home screen, navigation, package metadata, and manifest, and it must not leave visible \"Chat\", \"Starter\", \"Blank app\", or \"New app\" UI behind.`,\n `Use the workspace app layout: create it under apps/${input.appId}, mount it at /${input.appId}, keep it on the shared workspace database/hosting model, and avoid table-name collisions by namespacing any new domain tables to the app.`,\n `Important routing rule: from outside the app, link to /${input.appId}; inside apps/${input.appId}, React Router routes are app-local. Use <Link to=\"/review\"> and navigate(\"/review\"), not \"/${input.appId}/review\"; APP_BASE_PATH supplies the mounted prefix, and hardcoding it causes doubled URLs like /${input.appId}/${input.appId}/review.`,\n `Prefer useActionQuery/useActionMutation for actions. If you must raw-fetch framework endpoints, wrap them with agentNativePath(\"/_agent-native/actions/<name>\") so mounted apps call the right URL.`,\n `Use relative workspace links like /${input.appId}. Do not hardcode localhost, 127.0.0.1, 8080, 8100, or any dev port; the active workspace gateway/browser origin owns the port.`,\n `Use the framework/template UI stack: shadcn/ui components and @tabler/icons-react. Do not add lucide-react or another icon library for standard UI.`,\n `Existing first-party apps are neighbors, not implementation details for this app. If the user's prompt mentions Mail, Calendar, Analytics, Brain, Assets, Dispatch, or other templates, treat them as existing hosted/connected apps that this app can link to or call through A2A/default connected agents. For example, Mail, Calendar, Analytics, Brain, and Assets already exist at https://mail.agent-native.com, https://calendar.agent-native.com, https://analytics.agent-native.com, https://brain.agent-native.com, and https://assets.agent-native.com.`,\n `Do not clone first-party templates, create wrapper apps, or scaffold child apps/routes for Mail, Calendar, Analytics, Brain, Assets, etc. inside apps/${input.appId} just so this app can access them. If the request is a cross-app dashboard or overview, build only the new dashboard/overview app and delegate to the existing apps for domain work.`,\n `Only create another first-party app copy when the user explicitly asks for a customized fork/copy of that app; otherwise keep using the hosted/shared app so improvements to the base template keep flowing to users.`,\n `Do not satisfy this by adding a route, page, component, or file inside apps/chat or another existing app unless the user explicitly asks to modify that existing app.`,\n input.vaultAccessMode === \"all-apps\"\n ? `Do not create per-app Dispatch vault grants unless the workspace switches vault access to manual or the user explicitly asks for manual grants.`\n : keyList\n ? `After the app exists, grant the selected Dispatch vault keys to appId \"${input.appId}\" and sync them once the app server is available. Treat these as requested grants, not active grants before creation succeeds.`\n : `Do not grant any Dispatch vault keys unless the user asks later.`,\n input.selectedResources.length\n ? `After the app exists, grant the selected Dispatch workspace resources to appId \"${input.appId}\". Do not sync All-app workspace resources; they are inherited.`\n : `Do not grant any selected-only Dispatch workspace resources unless the user asks later.`,\n ``,\n `App readiness requirements before handing off:`,\n `- Ensure apps/${input.appId}/package.json exists with displayName/name and a concise description; Dispatch discovers workspace apps from apps/<app-id>/package.json, not a separate app registry.`,\n `- Update the app manifest/package/deploy metadata needed by the existing workspace deployment model.`,\n `- Ensure the React Router client entry preserves APP_BASE_PATH/VITE_APP_BASE_PATH via appBasePath() so /${input.appId} hydrates correctly.`,\n `- Verify the app's agent card/A2A metadata is ready so Dispatch can discover and delegate to the app after deployment. Every sibling workspace app is available over A2A by default through call-agent, with names and descriptions from the workspace app registry.`,\n `When it is ready, start or update the workspace dev server and navigate the user to the absolute path /${input.appId} on the workspace origin. Do not prefix with /dispatch/, /apps/, /workspace/, or any other Dispatch tab — the new app is mounted at the workspace root, not under Dispatch. If you have a navigate tool available, pass /${input.appId} verbatim; if you only have a window.location-style escape hatch, set it to /${input.appId}.`,\n ].join(\"\\n\");\n}\n\nasync function fetchJson(url: string, init?: RequestInit): Promise<any> {\n const res = await fetch(url, init);\n const data = await res.json().catch(() => null);\n if (!res.ok) {\n throw new Error(\n data?.error || data?.message || `Request failed ${res.status}`,\n );\n }\n return data;\n}\n\nfunction defaultDispatchBasePath(): string | null {\n const base = appBasePath();\n if (base === \"/dispatch\") return null;\n return null;\n}\n\nfunction actionUrl(basePath: string | null, action: string): string {\n const path = `/_agent-native/actions/${action}`;\n if (basePath === null) return agentNativePath(path);\n const normalized = basePath.replace(/\\/+$/, \"\");\n return `${normalized}${path}`;\n}\n\n/**\n * Inline two-step app-creation flow: prompt → optional access picker → submit.\n * Used both in the popover form and in the dedicated `/new-app` page so the\n * same UX shows up everywhere a teammate kicks off a new workspace app.\n */\nexport function CreateAppFlow({\n onClose,\n className = \"\",\n}: {\n onClose?: () => void;\n className?: string;\n}) {\n const [step, setStep] = useState<\"prompt\" | \"access\">(\"prompt\");\n const [prompt, setPrompt] = useState(\"\");\n const [selectedSecretIds, setSelectedSecretIds] = useState<string[]>([]);\n const [selectedResourceIds, setSelectedResourceIds] = useState<string[]>([]);\n const [secrets, setSecrets] = useState<VaultSecretOption[]>([]);\n const [resources, setResources] = useState<WorkspaceResourceOption[]>([]);\n const [vaultAccessMode, setVaultAccessMode] =\n useState<VaultAccessMode>(\"all-apps\");\n const [secretsError, setSecretsError] = useState<string | null>(null);\n const [resourcesError, setResourcesError] = useState<string | null>(null);\n const [statusMessage, setStatusMessage] = useState<string | null>(null);\n const [branchUrl, setBranchUrl] = useState<string | null>(null);\n const [isSubmitting, setIsSubmitting] = useState(false);\n const { isDevMode } = useDevMode();\n\n const basePath = useMemo(() => defaultDispatchBasePath(), []);\n\n // Fetch access options eagerly so step 2 has them ready immediately.\n useEffect(() => {\n let cancelled = false;\n fetchJson(actionUrl(basePath, \"list-vault-secret-options\"))\n .then((data) => {\n if (cancelled) return;\n setSecrets(Array.isArray(data) ? data : []);\n setSecretsError(null);\n })\n .catch((err) => {\n if (cancelled) return;\n setSecrets([]);\n setSecretsError(err?.message || \"Could not load Dispatch keys\");\n });\n fetchJson(actionUrl(basePath, \"get-vault-access-settings\"))\n .then((data) => {\n if (cancelled) return;\n setVaultAccessMode(data?.mode === \"manual\" ? \"manual\" : \"all-apps\");\n })\n .catch(() => {\n if (cancelled) return;\n setVaultAccessMode(\"manual\");\n });\n fetchJson(actionUrl(basePath, \"list-workspace-resource-options\"))\n .then((data) => {\n if (cancelled) return;\n setResources(Array.isArray(data) ? data : []);\n setResourcesError(null);\n })\n .catch((err) => {\n if (cancelled) return;\n setResources([]);\n setResourcesError(err?.message || \"Could not load Dispatch resources\");\n });\n return () => {\n cancelled = true;\n };\n }, [basePath]);\n\n const selectedSecrets = useMemo(\n () => secrets.filter((s) => selectedSecretIds.includes(s.id)),\n [secrets, selectedSecretIds],\n );\n const selectedResources = useMemo(\n () => resources.filter((r) => selectedResourceIds.includes(r.id)),\n [resources, selectedResourceIds],\n );\n const selectedSecretLabel =\n vaultAccessMode === \"all-apps\"\n ? \"all keys\"\n : selectedSecretIds.length === 0\n ? \"no keys\"\n : `${selectedSecretIds.length} key${selectedSecretIds.length === 1 ? \"\" : \"s\"}`;\n const selectedResourceLabel =\n selectedResourceIds.length === 0\n ? \"no resources\"\n : `${selectedResourceIds.length} resource${selectedResourceIds.length === 1 ? \"\" : \"s\"}`;\n const selectedAccessLabel = [selectedSecretLabel, selectedResourceLabel].join(\n \" · \",\n );\n\n function toggleSecret(id: string) {\n setSelectedSecretIds((cur) =>\n cur.includes(id) ? cur.filter((x) => x !== id) : [...cur, id],\n );\n }\n\n function toggleResource(id: string) {\n setSelectedResourceIds((cur) =>\n cur.includes(id) ? cur.filter((x) => x !== id) : [...cur, id],\n );\n }\n\n async function submit(rawPrompt: string) {\n const trimmed = rawPrompt.trim();\n if (!trimmed || isSubmitting) return;\n const appId = titleFromPrompt(trimmed);\n const validationError = getWorkspaceAppIdValidationError(appId);\n if (validationError) {\n setStatusMessage(validationError);\n return;\n }\n\n const message = buildAppCreationPrompt({\n appId,\n prompt: trimmed,\n selectedKeys:\n vaultAccessMode === \"manual\"\n ? selectedSecrets.map((s) => s.credentialKey)\n : [],\n selectedResources,\n vaultAccessMode,\n });\n setIsSubmitting(true);\n setStatusMessage(null);\n setBranchUrl(null);\n\n try {\n if (isInBuilderFrame()) {\n sendToAgentChat({ message, submit: true, type: \"code\" });\n setStatusMessage(\"Sent to Builder chat.\");\n onClose?.();\n } else if (isDevMode) {\n sendToAgentChat({ message, submit: true, type: \"code\", newTab: true });\n setStatusMessage(\"Sent to the local agent.\");\n onClose?.();\n } else {\n const result = await fetchJson(\n actionUrl(basePath, \"start-workspace-app-creation\"),\n {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({\n prompt: trimmed,\n appId,\n secretIds:\n vaultAccessMode === \"manual\" && selectedSecretIds.length > 0\n ? selectedSecretIds\n : [],\n resourceIds:\n selectedResourceIds.length > 0 ? selectedResourceIds : [],\n }),\n },\n );\n if (result?.mode === \"builder\") {\n setBranchUrl(result?.url || null);\n setStatusMessage(\"Builder branch created.\");\n } else {\n setStatusMessage(\n result?.message ||\n \"This requires a code change. Edit locally or use Builder.io to edit this code in the cloud and continue customizing the app any way you like.\",\n );\n }\n }\n } catch (err: any) {\n setStatusMessage(err?.message || \"Could not start the new app flow.\");\n } finally {\n setIsSubmitting(false);\n }\n }\n\n const submitWithSelectedAccess = () => submit(prompt);\n\n return (\n <div className={`flex flex-col gap-3 ${className}`}>\n {step === \"prompt\" ? (\n <>\n <div className=\"flex items-center justify-between gap-2 px-1\">\n <p className=\"text-sm font-semibold text-foreground\">Create app</p>\n <button\n type=\"button\"\n onClick={() => setStep(\"access\")}\n className=\"inline-flex cursor-pointer items-center gap-1 rounded-md border border-border bg-background/40 px-2 py-1 text-[11px] text-muted-foreground hover:text-foreground hover:bg-accent/50\"\n >\n <IconKey size={11} />\n {selectedAccessLabel}\n </button>\n </div>\n <PromptComposer\n autoFocus\n disabled={isSubmitting}\n placeholder=\"Describe the app your teammate should be able to use...\"\n draftScope=\"dispatch:create-app\"\n preserveDraftOnSubmit\n onSubmit={(text) => {\n setPrompt(text);\n submit(text);\n }}\n />\n </>\n ) : (\n <>\n <div className=\"flex items-center justify-between gap-2 px-1\">\n <button\n type=\"button\"\n onClick={() => setStep(\"prompt\")}\n className=\"inline-flex cursor-pointer items-center gap-1 text-xs text-muted-foreground hover:text-foreground\"\n >\n <IconArrowLeft size={12} />\n Back\n </button>\n <span className=\"text-[11px] text-muted-foreground/70\">\n {selectedAccessLabel}\n </span>\n </div>\n <div className=\"max-h-[180px] space-y-2 overflow-y-auto rounded-md border border-border bg-card p-2\">\n <div className=\"flex items-center gap-1.5 px-1 pb-1 text-[11px] font-medium text-muted-foreground\">\n <IconKey size={12} />\n Dispatch keys\n </div>\n {vaultAccessMode === \"all-apps\" ? (\n <p className=\"rounded-md border border-dashed border-border px-3 py-3 text-xs text-muted-foreground\">\n Every saved Dispatch vault key is available to new apps.\n </p>\n ) : secretsError ? (\n <p className=\"rounded-md border border-dashed border-border px-3 py-3 text-xs text-muted-foreground\">\n {secretsError}\n </p>\n ) : secrets.length === 0 ? (\n <p className=\"rounded-md border border-dashed border-border px-3 py-3 text-xs text-muted-foreground\">\n No Dispatch vault keys found yet.\n </p>\n ) : (\n secrets.map((secret) => {\n const selected = selectedSecretIds.includes(secret.id);\n return (\n <div\n key={secret.id}\n className={`group rounded-md border text-sm ${\n selected\n ? \"border-primary/45 bg-primary/5\"\n : \"border-border hover:border-muted-foreground/40 hover:bg-accent/35\"\n }`}\n >\n <button\n type=\"button\"\n aria-pressed={selected}\n onClick={() => toggleSecret(secret.id)}\n className=\"flex w-full cursor-pointer items-start gap-3 rounded-md px-3 py-2 text-left\"\n >\n <span\n className={`mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded border ${\n selected\n ? \"border-primary/60 bg-primary/10 text-primary\"\n : \"border-muted-foreground/35 text-transparent\"\n }`}\n >\n {selected ? <IconCheck className=\"h-3 w-3\" /> : null}\n </span>\n <span className=\"min-w-0 flex-1\">\n <span className=\"block truncate font-medium\">\n {secret.credentialKey}\n </span>\n <span className=\"block truncate text-xs text-muted-foreground/70\">\n {selected\n ? \"Will be requested for this app\"\n : \"Click to request\"}\n </span>\n </span>\n </button>\n {(secret.provider || secret.name) && (\n <details className=\"group/details border-t border-border/60 px-3 py-1.5 text-xs text-muted-foreground/75\">\n <summary className=\"flex cursor-pointer list-none items-center gap-1.5 text-[11px] hover:text-muted-foreground [&::-webkit-details-marker]:hidden\">\n <IconChevronDown className=\"h-3 w-3 transition-transform group-open/details:rotate-180\" />\n Details\n </summary>\n <div className=\"mt-1.5 space-y-1 pb-0.5 pl-4\">\n <div className=\"truncate\">\n Provider: {secret.provider || \"Not specified\"}\n </div>\n <div className=\"truncate\">Name: {secret.name}</div>\n </div>\n </details>\n )}\n </div>\n );\n })\n )}\n </div>\n <div className=\"max-h-[180px] space-y-2 overflow-y-auto rounded-md border border-border bg-card p-2\">\n <div className=\"flex items-center gap-1.5 px-1 pb-1 text-[11px] font-medium text-muted-foreground\">\n <IconBook size={12} />\n Resource packs\n </div>\n {resourcesError ? (\n <p className=\"rounded-md border border-dashed border-border px-3 py-3 text-xs text-muted-foreground\">\n {resourcesError}\n </p>\n ) : resources.length === 0 ? (\n <p className=\"rounded-md border border-dashed border-border px-3 py-3 text-xs text-muted-foreground\">\n No Dispatch resource packs found yet.\n </p>\n ) : (\n resources.map((resource) => {\n const selected = selectedResourceIds.includes(resource.id);\n return (\n <div\n key={resource.id}\n className={`group rounded-md border text-sm ${\n selected\n ? \"border-primary/45 bg-primary/5\"\n : \"border-border hover:border-muted-foreground/40 hover:bg-accent/35\"\n }`}\n >\n <button\n type=\"button\"\n aria-pressed={selected}\n onClick={() => toggleResource(resource.id)}\n className=\"flex w-full cursor-pointer items-start gap-3 rounded-md px-3 py-2 text-left\"\n >\n <span\n className={`mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded border ${\n selected\n ? \"border-primary/60 bg-primary/10 text-primary\"\n : \"border-muted-foreground/35 text-transparent\"\n }`}\n >\n {selected ? <IconCheck className=\"h-3 w-3\" /> : null}\n </span>\n <span className=\"min-w-0 flex-1\">\n <span className=\"flex min-w-0 items-center gap-1.5\">\n <IconFileText className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground/70\" />\n <span className=\"block truncate font-medium\">\n {resource.name}\n </span>\n </span>\n <span className=\"block truncate text-xs text-muted-foreground/70\">\n {resource.kind} · {resource.path}\n </span>\n </span>\n </button>\n <details className=\"group/details border-t border-border/60 px-3 py-1.5 text-xs text-muted-foreground/75\">\n <summary className=\"flex cursor-pointer list-none items-center gap-1.5 text-[11px] hover:text-muted-foreground [&::-webkit-details-marker]:hidden\">\n <IconChevronDown className=\"h-3 w-3 transition-transform group-open/details:rotate-180\" />\n Details\n </summary>\n <div className=\"mt-1.5 space-y-1 pb-0.5 pl-4\">\n <div className=\"truncate\">\n Scope:{\" \"}\n {resource.scope === \"all\"\n ? \"All apps\"\n : \"Selected apps\"}\n </div>\n {resource.description ? (\n <div className=\"line-clamp-2\">\n {resource.description}\n </div>\n ) : null}\n </div>\n </details>\n </div>\n );\n })\n )}\n </div>\n <div className=\"flex items-center justify-end gap-2\">\n <Button\n type=\"button\"\n size=\"sm\"\n onClick={submitWithSelectedAccess}\n disabled={!prompt.trim() || isSubmitting}\n >\n {isSubmitting ? (\n <IconLoader2 className=\"h-3.5 w-3.5 animate-spin\" />\n ) : (\n <IconPlus className=\"h-3.5 w-3.5\" />\n )}\n Create app\n </Button>\n </div>\n {!prompt.trim() ? (\n <p className=\"px-1 text-[11px] text-muted-foreground/70\">\n Add a prompt on the previous step before creating the app.\n </p>\n ) : null}\n </>\n )}\n\n {statusMessage ? (\n <div className=\"rounded-md border border-border bg-muted/40 px-3 py-2 text-xs text-muted-foreground\">\n {statusMessage}\n {branchUrl ? (\n <a\n href={branchUrl}\n target=\"_blank\"\n rel=\"noreferrer\"\n className=\"ml-2 inline-flex items-center gap-1 font-medium text-foreground underline\"\n >\n Open branch <IconArrowUpRight className=\"h-3 w-3\" />\n </a>\n ) : null}\n </div>\n ) : null}\n </div>\n );\n}\n\nexport function CreateAppPopover({\n trigger,\n align = \"center\",\n}: CreateAppPopoverProps) {\n const [open, setOpen] = useState(false);\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild>\n {trigger ?? (\n <button\n type=\"button\"\n className=\"flex min-h-32 cursor-pointer items-center justify-center rounded-lg border border-dashed bg-card p-4 text-sm font-medium text-muted-foreground transition hover:border-foreground/30 hover:text-foreground\"\n >\n <span className=\"inline-flex items-center gap-2\">\n <IconPlus size={16} />\n Create app\n </span>\n </button>\n )}\n </PopoverTrigger>\n <PopoverContent\n align={align}\n sideOffset={10}\n className=\"w-[calc(100vw-2rem)] rounded-xl p-3 shadow-xl sm:w-[460px]\"\n >\n <CreateAppFlow onClose={() => setOpen(false)} />\n </PopoverContent>\n </Popover>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"create-app-popover.js","sourceRoot":"","sources":["../../src/components/create-app-popover.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAClE,OAAO,EACL,eAAe,EACf,WAAW,GACZ,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,gCAAgC,EAAE,MAAM,2BAA2B,CAAC;AAC7E,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,QAAQ,EACR,SAAS,EACT,eAAe,EACf,YAAY,EACZ,OAAO,EACP,WAAW,EACX,QAAQ,GACT,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AAErE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAkCvE,SAAS,OAAO,CAAC,KAAa;IAC5B,OAAO,KAAK;SACT,WAAW,EAAE;SACb,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC;SAC3B,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;SACvB,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;SACvB,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAClB,CAAC;AAED,SAAS,eAAe,CAAC,MAAc;IACrC,MAAM,OAAO,GAAG,MAAM;SACnB,OAAO,CAAC,sDAAsD,EAAE,GAAG,CAAC;SACpE,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;SACpB,IAAI,EAAE,CAAC;IACV,OAAO,OAAO,CAAC,OAAO,IAAI,SAAS,CAAC,IA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AC;IACxC,OAAO,CACL,MAAC,OAAO,IAAC,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,aACxC,KAAC,cAAc,IAAC,OAAO,kBACpB,OAAO,IAAI,CACV,iBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,4MAA4M,YAEtN,gBAAM,SAAS,EAAC,gCAAgC,aAC9C,KAAC,QAAQ,IAAC,IAAI,EAAE,EAAE,GAAI,kBAEjB,GACA,CACV,GACc,EACjB,KAAC,cAAc,IACb,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,EAAE,EACd,SAAS,EAAC,4DAA4D,YAEtE,KAAC,aAAa,IAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,GAAI,GACjC,IACT,CACX,CAAC;AACJ,CAAC","sourcesContent":["import { sendToAgentChat } from \"@agent-native/core/client/agent-chat\";\nimport { useDevMode } from \"@agent-native/core/client/agent-chat\";\nimport {\n agentNativePath,\n appBasePath,\n} from \"@agent-native/core/client/api-path\";\nimport { PromptComposer } from \"@agent-native/core/client/composer\";\nimport { isInBuilderFrame } from \"@agent-native/core/client/host\";\nimport { getWorkspaceAppIdValidationError } from \"@agent-native/core/shared\";\nimport {\n IconArrowLeft,\n IconArrowUpRight,\n IconBook,\n IconCheck,\n IconChevronDown,\n IconFileText,\n IconKey,\n IconLoader2,\n IconPlus,\n} from \"@tabler/icons-react\";\nimport { useEffect, useMemo, useState, type ReactNode } from \"react\";\n\nimport { Button } from \"./ui/button\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"./ui/popover\";\n\ninterface VaultSecretOption {\n id: string;\n name: string;\n credentialKey: string;\n provider?: string | null;\n description?: string | null;\n}\n\ninterface WorkspaceResourceOption {\n id: string;\n kind: \"skill\" | \"instruction\" | \"agent\" | \"knowledge\" | \"mcp-server\";\n name: string;\n description?: string | null;\n path: string;\n scope: \"all\" | \"selected\";\n updatedAt?: number;\n}\n\ntype VaultAccessMode = \"all-apps\" | \"manual\";\n\ninterface CreateAppPopoverProps {\n /**\n * Custom trigger element. Defaults to a dashed-border tile that matches the\n * apps grid empty state.\n */\n trigger?: ReactNode;\n /**\n * Override the popover alignment. Defaults to \"center\" with a 10px offset.\n */\n align?: \"start\" | \"center\" | \"end\";\n}\n\nfunction slugify(value: string): string {\n return value\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\")\n .replace(/^[^a-z]+/, \"\")\n .slice(0, 48);\n}\n\nfunction titleFromPrompt(prompt: string): string {\n const cleaned = prompt\n .replace(/\\b(build|create|make|an?|the|app|tool|dashboard)\\b/gi, \" \")\n .replace(/\\s+/g, \" \")\n .trim();\n return slugify(cleaned || \"new-app\") || \"new-app\";\n}\n\nfunction buildAppCreationPrompt(input: {\n appId: string;\n prompt: string;\n selectedKeys: string[];\n selectedResources: WorkspaceResourceOption[];\n vaultAccessMode: VaultAccessMode;\n}): string {\n const keyList = input.selectedKeys.join(\", \");\n const grantRequest =\n input.vaultAccessMode === \"all-apps\"\n ? `Dispatch vault access: all saved vault keys are available to every workspace app by default. No per-app vault grants are needed.`\n : keyList\n ? `Requested Dispatch vault key grants for this app: ${keyList}`\n : `Requested Dispatch vault key grants for this app: none`;\n const resourceList = input.selectedResources.length\n ? input.selectedResources\n .map(\n (resource) =>\n `- ${resource.name} (${resource.kind}, ${resource.path})`,\n )\n .join(\"\\n\")\n : \"none\";\n\n return [\n `Create a new agent-native app in this workspace.`,\n `This is a new workspace app request, not a feature request for the current app.`,\n ``,\n `Suggested app name: ${input.appId} (you may adjust the slug if it conflicts)`,\n `User prompt: ${input.prompt.trim()}`,\n `Generate a concise one-sentence app description from the user prompt before coding; save it in apps/${input.appId}/package.json \"description\" so Dispatch and A2A can describe the app.`,\n `If the user mentions a product or company such as Granola, Loom, Superhuman, Linear, or Notion, treat it as product inspiration unless they explicitly ask to connect to that service. Do not invent or require third-party API keys like GRANOLA_API_KEY just because a product is named.`,\n grantRequest,\n `Requested Dispatch workspace resources for this app:\\n${resourceList}`,\n `Dispatch workspace resources with scope=all are inherited workspace context. Do not copy or sync them into the new app; every workspace app reads them at runtime and may override with app shared or personal resources.`,\n ``,\n `Pick a UI template that fits the user's prompt — analytics, assets, brain, calendar, chat, content, design, dispatch, forms, mail, slides, or clips when none of the others fit.`,\n `If you use the chat template, treat it as scaffolding only: the finished app must use the requested app's real name, home screen, navigation, package metadata, and manifest, and it must not leave visible \"Chat\", \"Starter\", \"Blank app\", or \"New app\" UI behind.`,\n `Use the workspace app layout: create it under apps/${input.appId}, mount it at /${input.appId}, keep it on the shared workspace database/hosting model, and avoid table-name collisions by namespacing any new domain tables to the app.`,\n `Important routing rule: from outside the app, link to /${input.appId}; inside apps/${input.appId}, React Router routes are app-local. Use <Link to=\"/review\"> and navigate(\"/review\"), not \"/${input.appId}/review\"; APP_BASE_PATH supplies the mounted prefix, and hardcoding it causes doubled URLs like /${input.appId}/${input.appId}/review.`,\n `Prefer useActionQuery/useActionMutation for actions. If you must raw-fetch framework endpoints, wrap them with agentNativePath(\"/_agent-native/actions/<name>\") so mounted apps call the right URL.`,\n `Use relative workspace links like /${input.appId}. Do not hardcode localhost, 127.0.0.1, 8080, 8100, or any dev port; the active workspace gateway/browser origin owns the port.`,\n `Use the framework/template UI stack: shadcn/ui components and @tabler/icons-react. Do not add lucide-react or another icon library for standard UI.`,\n `Existing first-party apps are neighbors, not implementation details for this app. If the user's prompt mentions Mail, Calendar, Analytics, Brain, Assets, Dispatch, or other templates, treat them as existing hosted/connected apps that this app can link to or call through A2A/default connected agents. For example, Mail, Calendar, Analytics, Brain, and Assets already exist at https://mail.agent-native.com, https://calendar.agent-native.com, https://analytics.agent-native.com, https://brain.agent-native.com, and https://assets.agent-native.com.`,\n `Do not clone first-party templates, create wrapper apps, or scaffold child apps/routes for Mail, Calendar, Analytics, Brain, Assets, etc. inside apps/${input.appId} just so this app can access them. If the request is a cross-app dashboard or overview, build only the new dashboard/overview app and delegate to the existing apps for domain work.`,\n `Only create another first-party app copy when the user explicitly asks for a customized fork/copy of that app; otherwise keep using the hosted/shared app so improvements to the base template keep flowing to users.`,\n `Do not satisfy this by adding a route, page, component, or file inside apps/chat or another existing app unless the user explicitly asks to modify that existing app.`,\n input.vaultAccessMode === \"all-apps\"\n ? `Do not create per-app Dispatch vault grants unless the workspace switches vault access to manual or the user explicitly asks for manual grants.`\n : keyList\n ? `After the app exists, grant the selected Dispatch vault keys to appId \"${input.appId}\" and sync them once the app server is available. Treat these as requested grants, not active grants before creation succeeds.`\n : `Do not grant any Dispatch vault keys unless the user asks later.`,\n input.selectedResources.length\n ? `After the app exists, grant the selected Dispatch workspace resources to appId \"${input.appId}\". Do not sync All-app workspace resources; they are inherited.`\n : `Do not grant any selected-only Dispatch workspace resources unless the user asks later.`,\n ``,\n `App readiness requirements before handing off:`,\n `- Ensure apps/${input.appId}/package.json exists with displayName/name and a concise description; Dispatch discovers workspace apps from apps/<app-id>/package.json, not a separate app registry.`,\n `- Update the app manifest/package/deploy metadata needed by the existing workspace deployment model.`,\n `- Ensure the React Router client entry preserves APP_BASE_PATH/VITE_APP_BASE_PATH via appBasePath() so /${input.appId} hydrates correctly.`,\n `- Verify the app's agent card/A2A metadata is ready so Dispatch can discover and delegate to the app after deployment. Every sibling workspace app is available over A2A by default through call-agent, with names and descriptions from the workspace app registry.`,\n `When it is ready, start or update the workspace dev server and navigate the user to the absolute path /${input.appId} on the workspace origin. Do not prefix with /dispatch/, /apps/, /workspace/, or any other Dispatch tab — the new app is mounted at the workspace root, not under Dispatch. If you have a navigate tool available, pass /${input.appId} verbatim; if you only have a window.location-style escape hatch, set it to /${input.appId}.`,\n ].join(\"\\n\");\n}\n\nasync function fetchJson(url: string, init?: RequestInit): Promise<any> {\n const res = await fetch(url, init);\n const data = await res.json().catch(() => null);\n if (!res.ok) {\n throw new Error(\n data?.error || data?.message || `Request failed ${res.status}`,\n );\n }\n return data;\n}\n\nfunction defaultDispatchBasePath(): string | null {\n const base = appBasePath();\n if (base === \"/dispatch\") return null;\n return null;\n}\n\nfunction actionUrl(basePath: string | null, action: string): string {\n const path = `/_agent-native/actions/${action}`;\n if (basePath === null) return agentNativePath(path);\n const normalized = basePath.replace(/\\/+$/, \"\");\n return `${normalized}${path}`;\n}\n\n/**\n * Inline two-step app-creation flow: prompt → optional access picker → submit.\n * Used both in the popover form and in the dedicated `/new-app` page so the\n * same UX shows up everywhere a teammate kicks off a new workspace app.\n */\nexport function CreateAppFlow({\n onClose,\n className = \"\",\n}: {\n onClose?: () => void;\n className?: string;\n}) {\n const [step, setStep] = useState<\"prompt\" | \"access\">(\"prompt\");\n const [prompt, setPrompt] = useState(\"\");\n const [selectedSecretIds, setSelectedSecretIds] = useState<string[]>([]);\n const [selectedResourceIds, setSelectedResourceIds] = useState<string[]>([]);\n const [secrets, setSecrets] = useState<VaultSecretOption[]>([]);\n const [resources, setResources] = useState<WorkspaceResourceOption[]>([]);\n const [vaultAccessMode, setVaultAccessMode] =\n useState<VaultAccessMode>(\"all-apps\");\n const [secretsError, setSecretsError] = useState<string | null>(null);\n const [resourcesError, setResourcesError] = useState<string | null>(null);\n const [statusMessage, setStatusMessage] = useState<string | null>(null);\n const [branchUrl, setBranchUrl] = useState<string | null>(null);\n const [isSubmitting, setIsSubmitting] = useState(false);\n const { isDevMode } = useDevMode();\n\n const basePath = useMemo(() => defaultDispatchBasePath(), []);\n\n // Fetch access options eagerly so step 2 has them ready immediately.\n useEffect(() => {\n let cancelled = false;\n fetchJson(actionUrl(basePath, \"list-vault-secret-options\"))\n .then((data) => {\n if (cancelled) return;\n setSecrets(Array.isArray(data) ? data : []);\n setSecretsError(null);\n })\n .catch((err) => {\n if (cancelled) return;\n setSecrets([]);\n setSecretsError(err?.message || \"Could not load Dispatch keys\");\n });\n fetchJson(actionUrl(basePath, \"get-vault-access-settings\"))\n .then((data) => {\n if (cancelled) return;\n setVaultAccessMode(data?.mode === \"manual\" ? \"manual\" : \"all-apps\");\n })\n .catch(() => {\n if (cancelled) return;\n setVaultAccessMode(\"manual\");\n });\n fetchJson(actionUrl(basePath, \"list-workspace-resource-options\"))\n .then((data) => {\n if (cancelled) return;\n setResources(Array.isArray(data) ? data : []);\n setResourcesError(null);\n })\n .catch((err) => {\n if (cancelled) return;\n setResources([]);\n setResourcesError(err?.message || \"Could not load Dispatch resources\");\n });\n return () => {\n cancelled = true;\n };\n }, [basePath]);\n\n const selectedSecrets = useMemo(\n () => secrets.filter((s) => selectedSecretIds.includes(s.id)),\n [secrets, selectedSecretIds],\n );\n const selectedResources = useMemo(\n () => resources.filter((r) => selectedResourceIds.includes(r.id)),\n [resources, selectedResourceIds],\n );\n const selectedSecretLabel =\n vaultAccessMode === \"all-apps\"\n ? \"all keys\"\n : selectedSecretIds.length === 0\n ? \"no keys\"\n : `${selectedSecretIds.length} key${selectedSecretIds.length === 1 ? \"\" : \"s\"}`;\n const selectedResourceLabel =\n selectedResourceIds.length === 0\n ? \"no resources\"\n : `${selectedResourceIds.length} resource${selectedResourceIds.length === 1 ? \"\" : \"s\"}`;\n const selectedAccessLabel = [selectedSecretLabel, selectedResourceLabel].join(\n \" · \",\n );\n\n function toggleSecret(id: string) {\n setSelectedSecretIds((cur) =>\n cur.includes(id) ? cur.filter((x) => x !== id) : [...cur, id],\n );\n }\n\n function toggleResource(id: string) {\n setSelectedResourceIds((cur) =>\n cur.includes(id) ? cur.filter((x) => x !== id) : [...cur, id],\n );\n }\n\n async function submit(rawPrompt: string) {\n const trimmed = rawPrompt.trim();\n if (!trimmed || isSubmitting) return;\n const appId = titleFromPrompt(trimmed);\n const validationError = getWorkspaceAppIdValidationError(appId);\n if (validationError) {\n setStatusMessage(validationError);\n return;\n }\n\n const message = buildAppCreationPrompt({\n appId,\n prompt: trimmed,\n selectedKeys:\n vaultAccessMode === \"manual\"\n ? selectedSecrets.map((s) => s.credentialKey)\n : [],\n selectedResources,\n vaultAccessMode,\n });\n setIsSubmitting(true);\n setStatusMessage(null);\n setBranchUrl(null);\n\n try {\n if (isInBuilderFrame()) {\n sendToAgentChat({ message, submit: true, type: \"code\" });\n setStatusMessage(\"Sent to Builder chat.\");\n onClose?.();\n } else if (isDevMode) {\n sendToAgentChat({ message, submit: true, type: \"code\", newTab: true });\n setStatusMessage(\"Sent to the local agent.\");\n onClose?.();\n } else {\n const result = await fetchJson(\n actionUrl(basePath, \"start-workspace-app-creation\"),\n {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({\n prompt: trimmed,\n appId,\n secretIds:\n vaultAccessMode === \"manual\" && selectedSecretIds.length > 0\n ? selectedSecretIds\n : [],\n resourceIds:\n selectedResourceIds.length > 0 ? selectedResourceIds : [],\n }),\n },\n );\n if (result?.mode === \"builder\") {\n setBranchUrl(result?.url || null);\n setStatusMessage(\"Builder branch created.\");\n } else {\n setStatusMessage(\n result?.message ||\n \"This requires a code change. Edit locally or use Builder.io to edit this code in the cloud and continue customizing the app any way you like.\",\n );\n }\n }\n } catch (err: any) {\n setStatusMessage(err?.message || \"Could not start the new app flow.\");\n } finally {\n setIsSubmitting(false);\n }\n }\n\n const submitWithSelectedAccess = () => submit(prompt);\n\n return (\n <div className={`flex flex-col gap-3 ${className}`}>\n {step === \"prompt\" ? (\n <>\n <div className=\"flex items-center justify-between gap-2 px-1\">\n <p className=\"text-sm font-semibold text-foreground\">Create app</p>\n <button\n type=\"button\"\n onClick={() => setStep(\"access\")}\n className=\"inline-flex cursor-pointer items-center gap-1 rounded-md border border-border bg-background/40 px-2 py-1 text-[11px] text-muted-foreground hover:text-foreground hover:bg-accent/50\"\n >\n <IconKey size={11} />\n {selectedAccessLabel}\n </button>\n </div>\n <PromptComposer\n autoFocus\n disabled={isSubmitting}\n placeholder=\"Describe the app your teammate should be able to use...\"\n draftScope=\"dispatch:create-app\"\n preserveDraftOnSubmit\n onSubmit={(text) => {\n setPrompt(text);\n submit(text);\n }}\n />\n </>\n ) : (\n <>\n <div className=\"flex items-center justify-between gap-2 px-1\">\n <button\n type=\"button\"\n onClick={() => setStep(\"prompt\")}\n className=\"inline-flex cursor-pointer items-center gap-1 text-xs text-muted-foreground hover:text-foreground\"\n >\n <IconArrowLeft size={12} />\n Back\n </button>\n <span className=\"text-[11px] text-muted-foreground/70\">\n {selectedAccessLabel}\n </span>\n </div>\n <div className=\"max-h-[180px] space-y-2 overflow-y-auto rounded-md border border-border bg-card p-2\">\n <div className=\"flex items-center gap-1.5 px-1 pb-1 text-[11px] font-medium text-muted-foreground\">\n <IconKey size={12} />\n Dispatch keys\n </div>\n {vaultAccessMode === \"all-apps\" ? (\n <p className=\"rounded-md border border-dashed border-border px-3 py-3 text-xs text-muted-foreground\">\n Every saved Dispatch vault key is available to new apps.\n </p>\n ) : secretsError ? (\n <p className=\"rounded-md border border-dashed border-border px-3 py-3 text-xs text-muted-foreground\">\n {secretsError}\n </p>\n ) : secrets.length === 0 ? (\n <p className=\"rounded-md border border-dashed border-border px-3 py-3 text-xs text-muted-foreground\">\n No Dispatch vault keys found yet.\n </p>\n ) : (\n secrets.map((secret) => {\n const selected = selectedSecretIds.includes(secret.id);\n return (\n <div\n key={secret.id}\n className={`group rounded-md border text-sm ${\n selected\n ? \"border-primary/45 bg-primary/5\"\n : \"border-border hover:border-muted-foreground/40 hover:bg-accent/35\"\n }`}\n >\n <button\n type=\"button\"\n aria-pressed={selected}\n onClick={() => toggleSecret(secret.id)}\n className=\"flex w-full cursor-pointer items-start gap-3 rounded-md px-3 py-2 text-left\"\n >\n <span\n className={`mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded border ${\n selected\n ? \"border-primary/60 bg-primary/10 text-primary\"\n : \"border-muted-foreground/35 text-transparent\"\n }`}\n >\n {selected ? <IconCheck className=\"h-3 w-3\" /> : null}\n </span>\n <span className=\"min-w-0 flex-1\">\n <span className=\"block truncate font-medium\">\n {secret.credentialKey}\n </span>\n <span className=\"block truncate text-xs text-muted-foreground/70\">\n {selected\n ? \"Will be requested for this app\"\n : \"Click to request\"}\n </span>\n </span>\n </button>\n {(secret.provider || secret.name) && (\n <details className=\"group/details border-t border-border/60 px-3 py-1.5 text-xs text-muted-foreground/75\">\n <summary className=\"flex cursor-pointer list-none items-center gap-1.5 text-[11px] hover:text-muted-foreground [&::-webkit-details-marker]:hidden\">\n <IconChevronDown className=\"h-3 w-3 transition-transform group-open/details:rotate-180\" />\n Details\n </summary>\n <div className=\"mt-1.5 space-y-1 pb-0.5 pl-4\">\n <div className=\"truncate\">\n Provider: {secret.provider || \"Not specified\"}\n </div>\n <div className=\"truncate\">Name: {secret.name}</div>\n </div>\n </details>\n )}\n </div>\n );\n })\n )}\n </div>\n <div className=\"max-h-[180px] space-y-2 overflow-y-auto rounded-md border border-border bg-card p-2\">\n <div className=\"flex items-center gap-1.5 px-1 pb-1 text-[11px] font-medium text-muted-foreground\">\n <IconBook size={12} />\n Resource packs\n </div>\n {resourcesError ? (\n <p className=\"rounded-md border border-dashed border-border px-3 py-3 text-xs text-muted-foreground\">\n {resourcesError}\n </p>\n ) : resources.length === 0 ? (\n <p className=\"rounded-md border border-dashed border-border px-3 py-3 text-xs text-muted-foreground\">\n No Dispatch resource packs found yet.\n </p>\n ) : (\n resources.map((resource) => {\n const selected = selectedResourceIds.includes(resource.id);\n return (\n <div\n key={resource.id}\n className={`group rounded-md border text-sm ${\n selected\n ? \"border-primary/45 bg-primary/5\"\n : \"border-border hover:border-muted-foreground/40 hover:bg-accent/35\"\n }`}\n >\n <button\n type=\"button\"\n aria-pressed={selected}\n onClick={() => toggleResource(resource.id)}\n className=\"flex w-full cursor-pointer items-start gap-3 rounded-md px-3 py-2 text-left\"\n >\n <span\n className={`mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded border ${\n selected\n ? \"border-primary/60 bg-primary/10 text-primary\"\n : \"border-muted-foreground/35 text-transparent\"\n }`}\n >\n {selected ? <IconCheck className=\"h-3 w-3\" /> : null}\n </span>\n <span className=\"min-w-0 flex-1\">\n <span className=\"flex min-w-0 items-center gap-1.5\">\n <IconFileText className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground/70\" />\n <span className=\"block truncate font-medium\">\n {resource.name}\n </span>\n </span>\n <span className=\"block truncate text-xs text-muted-foreground/70\">\n {resource.kind} · {resource.path}\n </span>\n </span>\n </button>\n <details className=\"group/details border-t border-border/60 px-3 py-1.5 text-xs text-muted-foreground/75\">\n <summary className=\"flex cursor-pointer list-none items-center gap-1.5 text-[11px] hover:text-muted-foreground [&::-webkit-details-marker]:hidden\">\n <IconChevronDown className=\"h-3 w-3 transition-transform group-open/details:rotate-180\" />\n Details\n </summary>\n <div className=\"mt-1.5 space-y-1 pb-0.5 pl-4\">\n <div className=\"truncate\">\n Scope:{\" \"}\n {resource.scope === \"all\"\n ? \"All apps\"\n : \"Selected apps\"}\n </div>\n {resource.description ? (\n <div className=\"line-clamp-2\">\n {resource.description}\n </div>\n ) : null}\n </div>\n </details>\n </div>\n );\n })\n )}\n </div>\n <div className=\"flex items-center justify-end gap-2\">\n <Button\n type=\"button\"\n size=\"sm\"\n onClick={submitWithSelectedAccess}\n disabled={!prompt.trim() || isSubmitting}\n >\n {isSubmitting ? (\n <IconLoader2 className=\"h-3.5 w-3.5 animate-spin\" />\n ) : (\n <IconPlus className=\"h-3.5 w-3.5\" />\n )}\n Create app\n </Button>\n </div>\n {!prompt.trim() ? (\n <p className=\"px-1 text-[11px] text-muted-foreground/70\">\n Add a prompt on the previous step before creating the app.\n </p>\n ) : null}\n </>\n )}\n\n {statusMessage ? (\n <div className=\"rounded-md border border-border bg-muted/40 px-3 py-2 text-xs text-muted-foreground\">\n {statusMessage}\n {branchUrl ? (\n <a\n href={branchUrl}\n target=\"_blank\"\n rel=\"noreferrer\"\n className=\"ml-2 inline-flex items-center gap-1 font-medium text-foreground underline\"\n >\n Open branch <IconArrowUpRight className=\"h-3 w-3\" />\n </a>\n ) : null}\n </div>\n ) : null}\n </div>\n );\n}\n\nexport function CreateAppPopover({\n trigger,\n align = \"center\",\n}: CreateAppPopoverProps) {\n const [open, setOpen] = useState(false);\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild>\n {trigger ?? (\n <button\n type=\"button\"\n className=\"flex min-h-32 cursor-pointer items-center justify-center rounded-lg border border-dashed bg-card p-4 text-sm font-medium text-muted-foreground transition hover:border-foreground/30 hover:text-foreground\"\n >\n <span className=\"inline-flex items-center gap-2\">\n <IconPlus size={16} />\n Create app\n </span>\n </button>\n )}\n </PopoverTrigger>\n <PopoverContent\n align={align}\n sideOffset={10}\n className=\"w-[calc(100vw-2rem)] rounded-xl p-3 shadow-xl sm:w-[460px]\"\n >\n <CreateAppFlow onClose={() => setOpen(false)} />\n </PopoverContent>\n </Popover>\n );\n}\n"]}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { navigateWithAgentChatViewTransition, useChatModels, } from "@agent-native/core/client/agent-chat";
|
|
3
|
+
import { PromptComposer } from "@agent-native/core/client/composer";
|
|
4
|
+
import { useActionQuery } from "@agent-native/core/client/hooks";
|
|
5
|
+
import { isInBuilderFrame } from "@agent-native/core/client/host";
|
|
6
|
+
import { useT } from "@agent-native/core/client/i18n";
|
|
3
7
|
import { IconArrowUpRight } from "@tabler/icons-react";
|
|
4
8
|
import { Link, useNavigate } from "react-router";
|
|
5
9
|
import { submitOverviewPrompt } from "../lib/overview-chat.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispatch-control-plane.js","sourceRoot":"","sources":["../../src/components/dispatch-control-plane.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,mCAAmC,EACnC,cAAc,EACd,aAAa,EACb,IAAI,GACL,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,oBAA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;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 PromptComposer,\n isInBuilderFrame,\n navigateWithAgentChatViewTransition,\n useActionQuery,\n useChatModels,\n useT,\n} from \"@agent-native/core/client\";\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 { selectedModel } = useChatModels();\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 },\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 placeholder={t(\"dispatch.pages.overviewPromptPlaceholder\", {\n defaultValue: \"Ask Dispatch anything...\",\n })}\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\n key={index}\n className=\"rounded-xl border border-border/60 bg-card/40 p-4\"\n >\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-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AAC,QAAQ,IAAC,SAAS,EAAC,iBAAiB,GAAG,KALnC,KAAK,CAMN,CACP,CAAC,GACE,CACP,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAC3B,cAAK,SAAS,EAAC,2BAA2B,YACvC,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 { selectedModel } = useChatModels();\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 },\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 placeholder={t(\"dispatch.pages.overviewPromptPlaceholder\", {\n defaultValue: \"Ask Dispatch anything...\",\n })}\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\n key={index}\n className=\"rounded-xl border border-border/60 bg-card/40 p-4\"\n >\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,5 +1,5 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useT } from "@agent-native/core/client";
|
|
2
|
+
import { useT } from "@agent-native/core/client/i18n";
|
|
3
3
|
import { IconInfoCircle } from "@tabler/icons-react";
|
|
4
4
|
import { useSetPageTitle } from "./layout/HeaderActions.js";
|
|
5
5
|
import { Popover, PopoverContent, PopoverTrigger } from "./ui/popover.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispatch-shell.js","sourceRoot":"","sources":["../../src/components/dispatch-shell.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"dispatch-shell.js","sourceRoot":"","sources":["../../src/components/dispatch-shell.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAGrD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEvE;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,EAC5B,KAAK,EACL,WAAW,EACX,QAAQ,GAKT;IACC,MAAM,CAAC,GAAG,IAAI,EAAE,CAAC;IACjB,eAAe,CACb,eAAK,SAAS,EAAC,iCAAiC,aAC9C,aAAI,SAAS,EAAC,+DAA+D,YAC1E,KAAK,GACH,EACJ,WAAW,CAAC,CAAC,CAAC,CACb,MAAC,OAAO,eACN,KAAC,cAAc,IAAC,OAAO,kBACrB,iBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,0IAA0I,gBACxI,CAAC,CAAC,4BAA4B,EAAE,EAAE,KAAK,EAAE,CAAC,YAEtD,KAAC,cAAc,IAAC,SAAS,EAAC,aAAa,GAAG,GACnC,GACM,EACjB,KAAC,cAAc,IACb,IAAI,EAAC,QAAQ,EACb,KAAK,EAAC,OAAO,EACb,SAAS,EAAC,kCAAkC,YAE3C,WAAW,GACG,IACT,CACX,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;IAEF,OAAO,4BAAG,QAAQ,GAAI,CAAC;AACzB,CAAC","sourcesContent":["import { useT } from \"@agent-native/core/client/i18n\";\nimport { IconInfoCircle } from \"@tabler/icons-react\";\nimport { type ReactNode } from \"react\";\n\nimport { useSetPageTitle } from \"./layout/HeaderActions\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"./ui/popover\";\n\n/**\n * DispatchShell renders the per-page title (with an optional click-to-open\n * description popover) into the global header via the HeaderActions store.\n * The actual chrome (sidebar, AgentSidebar, header bar with AgentToggleButton)\n * is provided by `Layout` mounted in `root.tsx`.\n */\nexport function DispatchShell({\n title,\n description,\n children,\n}: {\n title: string;\n description?: string;\n children: ReactNode;\n}) {\n const t = useT();\n useSetPageTitle(\n <div className=\"flex items-center gap-2 min-w-0\">\n <h1 className=\"text-lg font-semibold tracking-tight truncate text-foreground\">\n {title}\n </h1>\n {description ? (\n <Popover>\n <PopoverTrigger asChild>\n <button\n type=\"button\"\n className=\"inline-flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground/70 hover:bg-accent hover:text-foreground cursor-pointer\"\n aria-label={t(\"dispatch.sidebar.aboutPage\", { title })}\n >\n <IconInfoCircle className=\"h-3.5 w-3.5\" />\n </button>\n </PopoverTrigger>\n <PopoverContent\n side=\"bottom\"\n align=\"start\"\n className=\"max-w-72 text-xs leading-relaxed\"\n >\n {description}\n </PopoverContent>\n </Popover>\n ) : null}\n </div>,\n );\n\n return <>{children}</>;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../../src/components/layout/Header.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../../src/components/layout/Header.tsx"],"names":[],"mappings":"AAiCA,wBAAgB,MAAM,CAAC,EACrB,YAAY,EACZ,eAAsB,GACvB,EAAE;IACD,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,mDAsDA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { AgentToggleButton
|
|
2
|
+
import { AgentToggleButton } from "@agent-native/core/client/agent-chat";
|
|
3
|
+
import { LanguagePicker } from "@agent-native/core/client/i18n";
|
|
3
4
|
import { RunsTray } from "@agent-native/core/client/progress";
|
|
4
5
|
import { IconLayoutSidebar } from "@tabler/icons-react";
|
|
5
6
|
import { useLocation, useNavigate } from "react-router";
|