@agent-native/dispatch 0.8.20 → 0.8.24

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.
Files changed (37) hide show
  1. package/dist/components/messaging-setup-panel.d.ts.map +1 -1
  2. package/dist/components/messaging-setup-panel.js +2 -3
  3. package/dist/components/messaging-setup-panel.js.map +1 -1
  4. package/dist/routes/pages/chat.d.ts +21 -2
  5. package/dist/routes/pages/chat.d.ts.map +1 -1
  6. package/dist/routes/pages/chat.js +12 -3
  7. package/dist/routes/pages/chat.js.map +1 -1
  8. package/dist/routes/pages/overview.d.ts +21 -2
  9. package/dist/routes/pages/overview.d.ts.map +1 -1
  10. package/dist/routes/pages/overview.js +13 -4
  11. package/dist/routes/pages/overview.js.map +1 -1
  12. package/dist/server/lib/dispatch-integrations.d.ts.map +1 -1
  13. package/dist/server/lib/dispatch-integrations.js +27 -3
  14. package/dist/server/lib/dispatch-integrations.js.map +1 -1
  15. package/dist/server/lib/mcp-gateway.d.ts.map +1 -1
  16. package/dist/server/lib/mcp-gateway.js +0 -6
  17. package/dist/server/lib/mcp-gateway.js.map +1 -1
  18. package/dist/server/lib/thread-link-preview.d.ts +24 -0
  19. package/dist/server/lib/thread-link-preview.d.ts.map +1 -0
  20. package/dist/server/lib/thread-link-preview.js +176 -0
  21. package/dist/server/lib/thread-link-preview.js.map +1 -0
  22. package/dist/server/lib/vault-store.d.ts +1 -0
  23. package/dist/server/lib/vault-store.d.ts.map +1 -1
  24. package/dist/server/lib/vault-store.js +67 -20
  25. package/dist/server/lib/vault-store.js.map +1 -1
  26. package/package.json +1 -1
  27. package/src/components/messaging-setup-panel.tsx +2 -3
  28. package/src/routes/pages/chat.tsx +20 -3
  29. package/src/routes/pages/overview.tsx +21 -8
  30. package/src/server/lib/dispatch-integrations.spec.ts +69 -0
  31. package/src/server/lib/dispatch-integrations.ts +26 -3
  32. package/src/server/lib/mcp-gateway.ts +0 -6
  33. package/src/server/lib/thread-link-preview.spec.ts +129 -0
  34. package/src/server/lib/thread-link-preview.ts +187 -0
  35. package/src/server/lib/vault-store.spec.ts +25 -0
  36. package/src/server/lib/vault-store.ts +75 -20
  37. package/src/server/lib/workspace-resource-approval-lifecycle.spec.ts +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"messaging-setup-panel.d.ts","sourceRoot":"","sources":["../../src/components/messaging-setup-panel.tsx"],"names":[],"mappings":"AAuNA,wBAAgB,mBAAmB,4CAidlC"}
1
+ {"version":3,"file":"messaging-setup-panel.d.ts","sourceRoot":"","sources":["../../src/components/messaging-setup-panel.tsx"],"names":[],"mappings":"AAuNA,wBAAgB,mBAAmB,4CAgdlC"}
@@ -216,7 +216,7 @@ export function MessagingSetupPanel() {
216
216
  setTogglingPlatform(platform.id);
217
217
  try {
218
218
  const action = enabled ? "disable" : "enable";
219
- const res = await fetch(`/_agent-native/integrations/${platform.id}/${action}`, {
219
+ const res = await fetch(agentNativePath(`/_agent-native/integrations/${platform.id}/${action}`), {
220
220
  method: "POST",
221
221
  });
222
222
  if (!res.ok) {
@@ -238,7 +238,7 @@ export function MessagingSetupPanel() {
238
238
  const runSetup = async (platform) => {
239
239
  setSetupPlatform(platform.id);
240
240
  try {
241
- const res = await fetch(`/_agent-native/integrations/${platform.id}/setup`, {
241
+ const res = await fetch(agentNativePath(`/_agent-native/integrations/${platform.id}/setup`), {
242
242
  method: "POST",
243
243
  });
244
244
  if (!res.ok) {
@@ -279,7 +279,6 @@ export function MessagingSetupPanel() {
279
279
  label: key,
280
280
  required: true,
281
281
  }));
282
- const canEnable = configured;
283
282
  return (_jsxs("section", { className: "rounded-2xl border bg-card p-5", children: [_jsxs("div", { className: "flex items-start justify-between gap-4", children: [_jsxs("div", { className: "flex items-start gap-3", children: [_jsx("div", { className: "flex h-10 w-10 items-center justify-center rounded-xl border bg-muted/30 text-foreground", children: _jsx(platform.icon, { size: 18 }) }), _jsxs("div", { children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("h3", { className: "text-base font-semibold text-foreground", children: platform.label }), _jsx(ConnectionStatus, { configured: configured, enabled: enabled })] }), _jsx("p", { className: "mt-1 text-sm text-muted-foreground", children: platform.description })] })] }), _jsxs("div", { className: "flex shrink-0 items-center gap-1", children: [_jsx(Button, { asChild: true, variant: "ghost", size: "sm", className: "h-7 px-2 text-xs text-muted-foreground", children: _jsxs("a", { href: platform.docsUrl, target: "_blank", rel: "noreferrer", children: ["Docs", _jsx(IconExternalLink, { className: "ml-1 h-3 w-3" })] }) }), platform.externalUrl ? (_jsx(Button, { asChild: true, variant: "ghost", size: "sm", className: "h-7 px-2 text-xs text-muted-foreground", children: _jsxs("a", { href: platform.externalUrl, target: "_blank", rel: "noreferrer", children: [platform.externalLabel ?? "Open", _jsx(IconExternalLink, { className: "ml-1 h-3 w-3" })] }) })) : null] })] }), _jsxs(Collapsible, { className: "mt-5", children: [_jsxs(CollapsibleTrigger, { className: "group flex w-full cursor-pointer items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground", children: [_jsx(IconChevronRight, { className: "h-3.5 w-3.5 transition-transform group-data-[state=open]:rotate-90" }), _jsx("span", { children: "Setup steps" })] }), _jsx(CollapsibleContent, { children: _jsx("div", { className: "mt-2 rounded-xl border bg-muted/20 p-4", children: _jsx("ol", { className: "space-y-2 text-sm text-muted-foreground", children: platform.setupSteps.map((step, index) => (_jsxs("li", { className: "flex gap-2", children: [_jsxs("span", { className: "text-muted-foreground/60", children: [index + 1, "."] }), _jsx("span", { children: step })] }, step))) }) }) })] }), _jsxs("div", { className: "mt-4 space-y-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("div", { className: "text-sm font-medium text-foreground", children: "Credentials" }), envLoading ? (_jsx("span", { className: "text-xs text-muted-foreground", children: "Checking..." })) : null] }), _jsx("div", { className: "space-y-3", children: envKeys.map((envKey) => {
284
283
  const envStatus = envStatusByKey.get(envKey.key);
285
284
  const isConfigured = !!envStatus?.configured;
@@ -1 +1 @@
1
- {"version":3,"file":"messaging-setup-panel.js","sourceRoot":"","sources":["../../src/components/messaging-setup-panel.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC/B,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,SAAS,EACT,gBAAgB,EAChB,QAAQ,EACR,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,QAAQ,GACT,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EACL,OAAO,EACP,cAAc,EACd,cAAc,GACf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AA6C5D,MAAM,oBAAoB,GAAyB;IACjD;QACE,EAAE,EAAE,OAAO;QACX,KAAK,EAAE,OAAO;QACd,IAAI,EAAE,cAAc;QACpB,WAAW,EAAE,2DAA2D;QACxE,OAAO,EAAE,uBAAuB;QAChC,WAAW,EAAE,4BAA4B;QACzC,aAAa,EAAE,iBAAiB;QAChC,OAAO,EAAE,CAAC,iBAAiB,EAAE,sBAAsB,CAAC;QACpD,UAAU,EAAE;YACV,mDAAmD;YACnD,2FAA2F;YAC3F,sEAAsE;YACtE,uEAAuE;YACvE,oKAAoK;SACrK;KACF;IACD;QACE,EAAE,EAAE,UAAU;QACd,KAAK,EAAE,UAAU;QACjB,IAAI,EAAE,iBAAiB;QACvB,WAAW,EAAE,4CAA4C;QACzD,OAAO,EAAE,0BAA0B;QACnC,WAAW,EAAE,wBAAwB;QACrC,aAAa,EAAE,gBAAgB;QAC/B,OAAO,EAAE,CAAC,oB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uDAEE,IACT,CACX,CAAC,CAAC,CAAC,CACF,KAAC,MAAM,IACL,OAAO,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,QAAQ,EAAE,OAAO,CAAC,EAChD,QAAQ,EAAE,gBAAgB,KAAK,QAAQ,CAAC,EAAE,YAEzC,gBAAgB,KAAK,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAClC,8BACE,KAAC,WAAW,IAAC,SAAS,EAAC,2BAA2B,GAAG,iBAEpD,CACJ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CACZ,SAAS,CACV,CAAC,CAAC,CAAC,CACF,QAAQ,CACT,GACM,CACV,IACG,KA/OD,QAAQ,CAAC,EAAE,CAgPR,CACX,CAAC;gBACJ,CAAC,CAAC,GACE,EAEL,OAAO,CAAC,CAAC,CAAC,CACT,cAAK,SAAS,EAAC,0EAA0E,4CAEnF,CACP,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;AACJ,CAAC","sourcesContent":["import { useEffect, useMemo, useState } from \"react\";\nimport { toast } from \"sonner\";\nimport {\n IconBrandSlack,\n IconBrandTelegram,\n IconBrandWhatsapp,\n IconCheck,\n IconChevronRight,\n IconCopy,\n IconExternalLink,\n IconInfoCircle,\n IconLoader2,\n IconMail,\n} from \"@tabler/icons-react\";\nimport { Button } from \"@/components/ui/button\";\nimport {\n Collapsible,\n CollapsibleContent,\n CollapsibleTrigger,\n} from \"@/components/ui/collapsible\";\nimport { Input } from \"@/components/ui/input\";\nimport {\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n} from \"@/components/ui/tooltip\";\nimport { agentNativePath } from \"@agent-native/core/client\";\n\ninterface EnvStatus {\n key: string;\n label: string;\n required: boolean;\n configured: boolean;\n helpText?: string;\n}\n\ninterface RequiredEnvKey {\n key: string;\n label: string;\n required: boolean;\n helpText?: string;\n}\n\ninterface IntegrationStatus {\n platform: string;\n label: string;\n enabled: boolean;\n configured: boolean;\n webhookUrl?: string;\n requiredEnvKeys?: RequiredEnvKey[];\n}\n\ninterface PlatformDefinition {\n id: \"slack\" | \"telegram\" | \"email\" | \"whatsapp\";\n label: string;\n icon: typeof IconBrandSlack;\n description: string;\n /** Our own docs anchor — keep these on /docs/messaging so users land on\n * the page that explains the platform in plain English. */\n docsUrl: string;\n /** Optional external link (e.g. to the platform's developer console). */\n externalUrl?: string;\n externalLabel?: string;\n setupSteps: string[];\n /** Fallback env keys when the adapter doesn't surface them via\n * `IntegrationStatus.requiredEnvKeys`. The panel prefers adapter-supplied\n * keys when present so optional fields (webhook secrets, etc.) appear\n * automatically. */\n envKeys: string[];\n}\n\nconst PLATFORM_DEFINITIONS: PlatformDefinition[] = [\n {\n id: \"slack\",\n label: \"Slack\",\n icon: IconBrandSlack,\n description: \"Receive mentions and DMs in one workspace-aware dispatch.\",\n docsUrl: \"/docs/messaging#slack\",\n externalUrl: \"https://api.slack.com/apps\",\n externalLabel: \"Open Slack apps\",\n envKeys: [\"SLACK_BOT_TOKEN\", \"SLACK_SIGNING_SECRET\"],\n setupSteps: [\n \"Create or open a Slack app at api.slack.com/apps.\",\n \"Save the bot token and signing secret below — the webhook URL appears once they're saved.\",\n \"Back in Slack, enable Event Subscriptions and paste the webhook URL.\",\n \"Subscribe to app_mention and message.im events, then install the app.\",\n \"Optional but recommended: Basic Information → Display Information → upload an app icon and pick a background color so the bot has a clean avatar in every channel.\",\n ],\n },\n {\n id: \"telegram\",\n label: \"Telegram\",\n icon: IconBrandTelegram,\n description: \"Chat with dispatch through a Telegram bot.\",\n docsUrl: \"/docs/messaging#telegram\",\n externalUrl: \"https://t.me/BotFather\",\n externalLabel: \"Open BotFather\",\n envKeys: [\"TELEGRAM_BOT_TOKEN\"],\n setupSteps: [\n \"Open @BotFather in Telegram and send /newbot.\",\n \"Save the bot token here, then click Set up webhook below.\",\n \"DM the bot in Telegram to test.\",\n ],\n },\n {\n id: \"email\",\n label: \"Email\",\n icon: IconMail,\n description:\n \"Give your agent an email address. People can email it directly or CC it on threads.\",\n docsUrl: \"/docs/messaging#email\",\n externalUrl: \"https://resend.com/webhooks\",\n externalLabel: \"Open Resend webhooks\",\n envKeys: [\"EMAIL_AGENT_ADDRESS\"],\n setupSteps: [\n \"Save your Resend or SendGrid API key (Vault or onboarding).\",\n \"Pick an email address — the easiest is a free <slug>.resend.app address.\",\n \"If using your own domain, add MX records pointing to your provider.\",\n \"Save the address here, then register the webhook URL below in Resend (event: email.received).\",\n ],\n },\n {\n id: \"whatsapp\",\n label: \"WhatsApp\",\n icon: IconBrandWhatsapp,\n description:\n \"Receive WhatsApp messages and reply through a Meta-managed phone number.\",\n docsUrl: \"/docs/messaging#whatsapp\",\n externalUrl: \"https://developers.facebook.com/apps\",\n externalLabel: \"Open Meta developer console\",\n envKeys: [\n \"WHATSAPP_ACCESS_TOKEN\",\n \"WHATSAPP_VERIFY_TOKEN\",\n \"WHATSAPP_PHONE_NUMBER_ID\",\n ],\n setupSteps: [\n \"Create a Meta app and add the WhatsApp product.\",\n \"Save the access token, verify token, and phone number ID below.\",\n \"In Meta's WhatsApp configuration, paste the webhook URL and your verify token.\",\n \"Subscribe to the messages field, then enable here.\",\n ],\n },\n];\n\nfunction HelpTooltip({ content }: { content: string }) {\n return (\n <Tooltip>\n <TooltipTrigger asChild>\n <button\n type=\"button\"\n className=\"text-muted-foreground/60 hover:text-foreground cursor-pointer\"\n >\n <IconInfoCircle className=\"h-3.5 w-3.5\" />\n </button>\n </TooltipTrigger>\n <TooltipContent side=\"top\" className=\"max-w-64 text-xs leading-relaxed\">\n {content}\n </TooltipContent>\n </Tooltip>\n );\n}\n\nfunction StatusPill({\n tone,\n label,\n}: {\n tone: \"neutral\" | \"success\" | \"warning\";\n label: string;\n}) {\n const toneClass =\n tone === \"success\"\n ? \"border-emerald-500/30 bg-emerald-500/10 text-emerald-300\"\n : tone === \"warning\"\n ? \"border-amber-500/30 bg-amber-500/10 text-amber-300\"\n : \"border-border bg-muted/40 text-muted-foreground\";\n\n return (\n <span\n className={`inline-flex items-center rounded-full border px-2.5 py-1 text-[11px] font-medium ${toneClass}`}\n >\n {label}\n </span>\n );\n}\n\n/** Render a non-secret env value (e.g. EMAIL_AGENT_ADDRESS) as a copyable\n * text block. We can't read the actual value from the backend (env-status\n * only reports `configured: true|false`), so we offer a one-click reveal\n * that hits a server endpoint, falling back to \"saved\" if the value is\n * not exposed. For now we just render a \"Saved — re-enter to change\"\n * placeholder; a future endpoint can return the actual value. */\nfunction PublicValueReveal({ envKey: _envKey }: { envKey: string }) {\n return (\n <div className=\"rounded-md border bg-muted/20 px-3 py-2 text-xs text-muted-foreground\">\n Saved. Re-enter below to change.\n </div>\n );\n}\n\nfunction ConnectionStatus({\n configured,\n enabled,\n}: {\n configured: boolean;\n enabled: boolean;\n}) {\n if (enabled) {\n return <StatusPill tone=\"success\" label=\"Connected\" />;\n }\n if (configured) {\n return <StatusPill tone=\"warning\" label=\"Configured, not enabled\" />;\n }\n return <StatusPill tone=\"neutral\" label=\"Not configured\" />;\n}\n\nexport function MessagingSetupPanel() {\n const [statuses, setStatuses] = useState<IntegrationStatus[]>([]);\n const [loading, setLoading] = useState(true);\n const [envStatuses, setEnvStatuses] = useState<EnvStatus[]>([]);\n const [envLoading, setEnvLoading] = useState(true);\n const [envValues, setEnvValues] = useState<Record<string, string>>({});\n const [savingKeysFor, setSavingKeysFor] = useState<string | null>(null);\n const [togglingPlatform, setTogglingPlatform] = useState<string | null>(null);\n const [setupPlatform, setSetupPlatform] = useState<string | null>(null);\n const [copiedWebhook, setCopiedWebhook] = useState<string | null>(null);\n\n const refreshStatuses = async () => {\n setLoading(true);\n try {\n const res = await fetch(\n agentNativePath(\"/_agent-native/integrations/status\"),\n );\n const rows = res.ok ? await res.json() : [];\n setStatuses(Array.isArray(rows) ? rows : []);\n } finally {\n setLoading(false);\n }\n };\n\n useEffect(() => {\n let active = true;\n fetch(agentNativePath(\"/_agent-native/integrations/status\"))\n .then((res) => (res.ok ? res.json() : []))\n .then((rows) => {\n if (active) {\n setStatuses(Array.isArray(rows) ? rows : []);\n setLoading(false);\n }\n })\n .catch(() => {\n if (active) setLoading(false);\n });\n return () => {\n active = false;\n };\n }, []);\n\n useEffect(() => {\n let active = true;\n fetch(agentNativePath(\"/_agent-native/env-status\"))\n .then((res) => (res.ok ? res.json() : []))\n .then((rows) => {\n if (active) {\n setEnvStatuses(Array.isArray(rows) ? rows : []);\n setEnvLoading(false);\n }\n })\n .catch(() => {\n if (active) setEnvLoading(false);\n });\n return () => {\n active = false;\n };\n }, []);\n\n const envStatusByKey = useMemo(\n () => new Map(envStatuses.map((status) => [status.key, status])),\n [envStatuses],\n );\n const statusByPlatform = useMemo(\n () => new Map(statuses.map((status) => [status.platform, status])),\n [statuses],\n );\n\n const refreshEnvStatus = async () => {\n setEnvLoading(true);\n try {\n const res = await fetch(agentNativePath(\"/_agent-native/env-status\"));\n const rows = res.ok ? await res.json() : [];\n setEnvStatuses(Array.isArray(rows) ? rows : []);\n } finally {\n setEnvLoading(false);\n }\n };\n\n const saveEnvKeys = async (platform: PlatformDefinition, keys: string[]) => {\n const vars = keys\n .map((key) => ({ key, value: envValues[key]?.trim() || \"\" }))\n .filter((item) => item.value);\n\n if (vars.length === 0) {\n toast.error(\"Add the required credentials first.\");\n return;\n }\n\n setSavingKeysFor(platform.id);\n try {\n const res = await fetch(agentNativePath(\"/_agent-native/env-vars\"), {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ vars }),\n });\n\n if (!res.ok) {\n const payload = await res.json().catch(() => ({}));\n throw new Error(payload.error || \"Failed to save credentials\");\n }\n\n toast.success(`${platform.label} credentials saved`);\n setEnvValues((current) => {\n const next = { ...current };\n for (const key of keys) delete next[key];\n return next;\n });\n await refreshEnvStatus();\n await refreshStatuses();\n } catch (error) {\n toast.error(\n error instanceof Error ? error.message : \"Failed to save credentials\",\n );\n } finally {\n setSavingKeysFor(null);\n }\n };\n\n const togglePlatform = async (\n platform: PlatformDefinition,\n enabled: boolean,\n ) => {\n setTogglingPlatform(platform.id);\n try {\n const action = enabled ? \"disable\" : \"enable\";\n const res = await fetch(\n `/_agent-native/integrations/${platform.id}/${action}`,\n {\n method: \"POST\",\n },\n );\n if (!res.ok) {\n const payload = await res.json().catch(() => ({}));\n throw new Error(\n payload.error || `Failed to ${action} ${platform.label}`,\n );\n }\n toast.success(\n enabled\n ? `${platform.label} disconnected`\n : `${platform.label} connected`,\n );\n await refreshStatuses();\n } catch (error) {\n toast.error(\n error instanceof Error ? error.message : \"Failed to update integration\",\n );\n } finally {\n setTogglingPlatform(null);\n }\n };\n\n const runSetup = async (platform: PlatformDefinition) => {\n setSetupPlatform(platform.id);\n try {\n const res = await fetch(\n `/_agent-native/integrations/${platform.id}/setup`,\n {\n method: \"POST\",\n },\n );\n if (!res.ok) {\n const payload = await res.json().catch(() => ({}));\n throw new Error(payload.error || `Failed to set up ${platform.label}`);\n }\n toast.success(\n platform.id === \"telegram\"\n ? \"Telegram webhook registered\"\n : `${platform.label} setup complete`,\n );\n await refreshStatuses();\n } catch (error) {\n toast.error(\n error instanceof Error\n ? error.message\n : `Failed to set up ${platform.label}`,\n );\n } finally {\n setSetupPlatform(null);\n }\n };\n\n const copyWebhook = async (webhookUrl: string) => {\n await navigator.clipboard.writeText(webhookUrl);\n setCopiedWebhook(webhookUrl);\n toast.success(\"Webhook URL copied\");\n setTimeout(() => setCopiedWebhook(null), 1500);\n };\n\n return (\n <div className=\"space-y-4\">\n <div className=\"grid gap-4 xl:grid-cols-2\">\n {PLATFORM_DEFINITIONS.map((platform) => {\n const status = statusByPlatform.get(platform.id);\n const configured = !!status?.configured;\n const enabled = !!status?.enabled;\n // Prefer adapter-supplied env keys (includes optional fields like\n // webhook secrets); fall back to the static list.\n const adapterKeys = status?.requiredEnvKeys;\n const envKeys: RequiredEnvKey[] =\n adapterKeys && adapterKeys.length > 0\n ? adapterKeys\n : platform.envKeys.map((key) => ({\n key,\n label: key,\n required: true,\n }));\n const canEnable = configured;\n\n return (\n <section\n key={platform.id}\n className=\"rounded-2xl border bg-card p-5\"\n >\n <div className=\"flex items-start justify-between gap-4\">\n <div className=\"flex items-start gap-3\">\n <div className=\"flex h-10 w-10 items-center justify-center rounded-xl border bg-muted/30 text-foreground\">\n <platform.icon size={18} />\n </div>\n <div>\n <div className=\"flex items-center gap-2\">\n <h3 className=\"text-base font-semibold text-foreground\">\n {platform.label}\n </h3>\n <ConnectionStatus\n configured={configured}\n enabled={enabled}\n />\n </div>\n <p className=\"mt-1 text-sm text-muted-foreground\">\n {platform.description}\n </p>\n </div>\n </div>\n <div className=\"flex shrink-0 items-center gap-1\">\n <Button\n asChild\n variant=\"ghost\"\n size=\"sm\"\n className=\"h-7 px-2 text-xs text-muted-foreground\"\n >\n <a href={platform.docsUrl} target=\"_blank\" rel=\"noreferrer\">\n Docs\n <IconExternalLink className=\"ml-1 h-3 w-3\" />\n </a>\n </Button>\n {platform.externalUrl ? (\n <Button\n asChild\n variant=\"ghost\"\n size=\"sm\"\n className=\"h-7 px-2 text-xs text-muted-foreground\"\n >\n <a\n href={platform.externalUrl}\n target=\"_blank\"\n rel=\"noreferrer\"\n >\n {platform.externalLabel ?? \"Open\"}\n <IconExternalLink className=\"ml-1 h-3 w-3\" />\n </a>\n </Button>\n ) : null}\n </div>\n </div>\n\n <Collapsible className=\"mt-5\">\n <CollapsibleTrigger className=\"group flex w-full cursor-pointer items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground\">\n <IconChevronRight className=\"h-3.5 w-3.5 transition-transform group-data-[state=open]:rotate-90\" />\n <span>Setup steps</span>\n </CollapsibleTrigger>\n <CollapsibleContent>\n <div className=\"mt-2 rounded-xl border bg-muted/20 p-4\">\n <ol className=\"space-y-2 text-sm text-muted-foreground\">\n {platform.setupSteps.map((step, index) => (\n <li key={step} className=\"flex gap-2\">\n <span className=\"text-muted-foreground/60\">\n {index + 1}.\n </span>\n <span>{step}</span>\n </li>\n ))}\n </ol>\n </div>\n </CollapsibleContent>\n </Collapsible>\n\n <div className=\"mt-4 space-y-3\">\n <div className=\"flex items-center gap-2\">\n <div className=\"text-sm font-medium text-foreground\">\n Credentials\n </div>\n {envLoading ? (\n <span className=\"text-xs text-muted-foreground\">\n Checking...\n </span>\n ) : null}\n </div>\n <div className=\"space-y-3\">\n {envKeys.map((envKey) => {\n const envStatus = envStatusByKey.get(envKey.key);\n const isConfigured = !!envStatus?.configured;\n const helpText = envKey.helpText ?? envStatus?.helpText;\n const label =\n envKey.label || envStatus?.label || envKey.key;\n // Email agent address is not a secret — show it plainly\n // so users can copy and share it.\n const isPublicValue = envKey.key === \"EMAIL_AGENT_ADDRESS\";\n return (\n <div key={envKey.key} className=\"space-y-1.5\">\n <div className=\"flex items-center justify-between gap-3\">\n <div className=\"flex items-center gap-1.5\">\n <label className=\"text-xs font-medium text-foreground\">\n {label}\n {!envKey.required ? (\n <span className=\"ml-1 text-muted-foreground\">\n (optional)\n </span>\n ) : null}\n </label>\n {helpText ? (\n <HelpTooltip content={helpText} />\n ) : null}\n </div>\n {isConfigured ? (\n <StatusPill tone=\"success\" label=\"Saved\" />\n ) : (\n <StatusPill\n tone={envKey.required ? \"neutral\" : \"neutral\"}\n label={envKey.required ? \"Missing\" : \"Not set\"}\n />\n )}\n </div>\n {isConfigured && isPublicValue ? (\n <PublicValueReveal envKey={envKey.key} />\n ) : !isConfigured ? (\n <Input\n type={isPublicValue ? \"text\" : \"password\"}\n value={envValues[envKey.key] || \"\"}\n onChange={(event) =>\n setEnvValues((current) => ({\n ...current,\n [envKey.key]: event.target.value,\n }))\n }\n placeholder={\n isPublicValue\n ? \"agent@yourcompany.com\"\n : `Enter ${label}`\n }\n autoComplete=\"off\"\n />\n ) : null}\n </div>\n );\n })}\n </div>\n {envKeys.some((k) => !envStatusByKey.get(k.key)?.configured) ? (\n <Button\n variant=\"outline\"\n onClick={() =>\n saveEnvKeys(\n platform,\n envKeys.map((k) => k.key),\n )\n }\n disabled={savingKeysFor === platform.id}\n >\n {savingKeysFor === platform.id ? (\n <>\n <IconLoader2 className=\"mr-2 h-4 w-4 animate-spin\" />\n Saving...\n </>\n ) : (\n \"Save credentials\"\n )}\n </Button>\n ) : null}\n </div>\n\n {status?.webhookUrl ? (\n <div className=\"mt-4 space-y-2\">\n <div className=\"text-sm font-medium text-foreground\">\n Webhook URL\n </div>\n <div className=\"flex items-center gap-2\">\n <code className=\"flex-1 truncate rounded-md border bg-muted/30 px-3 py-2 text-xs text-foreground\">\n {status.webhookUrl}\n </code>\n <Button\n variant=\"outline\"\n size=\"icon\"\n onClick={() => copyWebhook(status.webhookUrl!)}\n aria-label={`Copy ${platform.label} webhook URL`}\n >\n {copiedWebhook === status.webhookUrl ? (\n <IconCheck className=\"h-4 w-4\" />\n ) : (\n <IconCopy className=\"h-4 w-4\" />\n )}\n </Button>\n </div>\n </div>\n ) : null}\n\n <div className=\"mt-5 flex flex-wrap items-center justify-end gap-2 border-t border-border pt-4\">\n {platform.id === \"telegram\" && configured ? (\n <Button\n variant=\"outline\"\n onClick={() => runSetup(platform)}\n disabled={setupPlatform === platform.id}\n >\n {setupPlatform === platform.id ? (\n <>\n <IconLoader2 className=\"mr-2 h-4 w-4 animate-spin\" />\n Setting up...\n </>\n ) : (\n \"Set up webhook\"\n )}\n </Button>\n ) : null}\n {!configured && !enabled ? (\n <Tooltip>\n <TooltipTrigger asChild>\n <span tabIndex={0}>\n <Button disabled>Enable</Button>\n </span>\n </TooltipTrigger>\n <TooltipContent>\n Save the required credentials first.\n </TooltipContent>\n </Tooltip>\n ) : (\n <Button\n onClick={() => togglePlatform(platform, enabled)}\n disabled={togglingPlatform === platform.id}\n >\n {togglingPlatform === platform.id ? (\n <>\n <IconLoader2 className=\"mr-2 h-4 w-4 animate-spin\" />\n Saving...\n </>\n ) : enabled ? (\n \"Disable\"\n ) : (\n \"Enable\"\n )}\n </Button>\n )}\n </div>\n </section>\n );\n })}\n </div>\n\n {loading ? (\n <div className=\"rounded-2xl border border-dashed px-4 py-6 text-sm text-muted-foreground\">\n Loading messaging status...\n </div>\n ) : null}\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"messaging-setup-panel.js","sourceRoot":"","sources":["../../src/components/messaging-setup-panel.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC/B,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,SAAS,EACT,gBAAgB,EAChB,QAAQ,EACR,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,QAAQ,GACT,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EACL,OAAO,EACP,cAAc,EACd,cAAc,GACf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AA6C5D,MAAM,oBAAoB,GAAyB;IACjD;QACE,EAAE,EAAE,OAAO;QACX,KAAK,EAAE,OAAO;QACd,IAAI,EAAE,cAAc;QACpB,WAAW,EAAE,2DAA2D;QACxE,OAAO,EAAE,uBAAuB;QAChC,WAAW,EAAE,4BAA4B;QACzC,aAAa,EAAE,iBAAiB;QAChC,OAAO,EAAE,CAAC,iBAAiB,EAAE,sBAAsB,CAAC;QACpD,UAAU,EAAE;YACV,mDAAmD;YACnD,2FAA2F;YAC3F,sEAAsE;YACtE,uEAAuE;YACvE,oKAAoK;SACrK;KACF;IACD;QACE,EAAE,EAAE,UAAU;QACd,KAAK,EAAE,UAAU;QACjB,IAAI,EAAE,iBAAiB;QACvB,WAAW,EAAE,4CAA4C;QACzD,OAAO,EAAE,0BAA0B;QACnC,WAAW,EAAE,wBAAwB;Q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AAC,QAAQ,6BAAgB,GAC3B,GACQ,EACjB,KAAC,cAAc,uDAEE,IACT,CACX,CAAC,CAAC,CAAC,CACF,KAAC,MAAM,IACL,OAAO,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,QAAQ,EAAE,OAAO,CAAC,EAChD,QAAQ,EAAE,gBAAgB,KAAK,QAAQ,CAAC,EAAE,YAEzC,gBAAgB,KAAK,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAClC,8BACE,KAAC,WAAW,IAAC,SAAS,EAAC,2BAA2B,GAAG,iBAEpD,CACJ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CACZ,SAAS,CACV,CAAC,CAAC,CAAC,CACF,QAAQ,CACT,GACM,CACV,IACG,KA/OD,QAAQ,CAAC,EAAE,CAgPR,CACX,CAAC;gBACJ,CAAC,CAAC,GACE,EAEL,OAAO,CAAC,CAAC,CAAC,CACT,cAAK,SAAS,EAAC,0EAA0E,4CAEnF,CACP,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;AACJ,CAAC","sourcesContent":["import { useEffect, useMemo, useState } from \"react\";\nimport { toast } from \"sonner\";\nimport {\n IconBrandSlack,\n IconBrandTelegram,\n IconBrandWhatsapp,\n IconCheck,\n IconChevronRight,\n IconCopy,\n IconExternalLink,\n IconInfoCircle,\n IconLoader2,\n IconMail,\n} from \"@tabler/icons-react\";\nimport { Button } from \"@/components/ui/button\";\nimport {\n Collapsible,\n CollapsibleContent,\n CollapsibleTrigger,\n} from \"@/components/ui/collapsible\";\nimport { Input } from \"@/components/ui/input\";\nimport {\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n} from \"@/components/ui/tooltip\";\nimport { agentNativePath } from \"@agent-native/core/client\";\n\ninterface EnvStatus {\n key: string;\n label: string;\n required: boolean;\n configured: boolean;\n helpText?: string;\n}\n\ninterface RequiredEnvKey {\n key: string;\n label: string;\n required: boolean;\n helpText?: string;\n}\n\ninterface IntegrationStatus {\n platform: string;\n label: string;\n enabled: boolean;\n configured: boolean;\n webhookUrl?: string;\n requiredEnvKeys?: RequiredEnvKey[];\n}\n\ninterface PlatformDefinition {\n id: \"slack\" | \"telegram\" | \"email\" | \"whatsapp\";\n label: string;\n icon: typeof IconBrandSlack;\n description: string;\n /** Our own docs anchor — keep these on /docs/messaging so users land on\n * the page that explains the platform in plain English. */\n docsUrl: string;\n /** Optional external link (e.g. to the platform's developer console). */\n externalUrl?: string;\n externalLabel?: string;\n setupSteps: string[];\n /** Fallback env keys when the adapter doesn't surface them via\n * `IntegrationStatus.requiredEnvKeys`. The panel prefers adapter-supplied\n * keys when present so optional fields (webhook secrets, etc.) appear\n * automatically. */\n envKeys: string[];\n}\n\nconst PLATFORM_DEFINITIONS: PlatformDefinition[] = [\n {\n id: \"slack\",\n label: \"Slack\",\n icon: IconBrandSlack,\n description: \"Receive mentions and DMs in one workspace-aware dispatch.\",\n docsUrl: \"/docs/messaging#slack\",\n externalUrl: \"https://api.slack.com/apps\",\n externalLabel: \"Open Slack apps\",\n envKeys: [\"SLACK_BOT_TOKEN\", \"SLACK_SIGNING_SECRET\"],\n setupSteps: [\n \"Create or open a Slack app at api.slack.com/apps.\",\n \"Save the bot token and signing secret below — the webhook URL appears once they're saved.\",\n \"Back in Slack, enable Event Subscriptions and paste the webhook URL.\",\n \"Subscribe to app_mention and message.im events, then install the app.\",\n \"Optional but recommended: Basic Information → Display Information → upload an app icon and pick a background color so the bot has a clean avatar in every channel.\",\n ],\n },\n {\n id: \"telegram\",\n label: \"Telegram\",\n icon: IconBrandTelegram,\n description: \"Chat with dispatch through a Telegram bot.\",\n docsUrl: \"/docs/messaging#telegram\",\n externalUrl: \"https://t.me/BotFather\",\n externalLabel: \"Open BotFather\",\n envKeys: [\"TELEGRAM_BOT_TOKEN\"],\n setupSteps: [\n \"Open @BotFather in Telegram and send /newbot.\",\n \"Save the bot token here, then click Set up webhook below.\",\n \"DM the bot in Telegram to test.\",\n ],\n },\n {\n id: \"email\",\n label: \"Email\",\n icon: IconMail,\n description:\n \"Give your agent an email address. People can email it directly or CC it on threads.\",\n docsUrl: \"/docs/messaging#email\",\n externalUrl: \"https://resend.com/webhooks\",\n externalLabel: \"Open Resend webhooks\",\n envKeys: [\"EMAIL_AGENT_ADDRESS\"],\n setupSteps: [\n \"Save your Resend or SendGrid API key (Vault or onboarding).\",\n \"Pick an email address — the easiest is a free <slug>.resend.app address.\",\n \"If using your own domain, add MX records pointing to your provider.\",\n \"Save the address here, then register the webhook URL below in Resend (event: email.received).\",\n ],\n },\n {\n id: \"whatsapp\",\n label: \"WhatsApp\",\n icon: IconBrandWhatsapp,\n description:\n \"Receive WhatsApp messages and reply through a Meta-managed phone number.\",\n docsUrl: \"/docs/messaging#whatsapp\",\n externalUrl: \"https://developers.facebook.com/apps\",\n externalLabel: \"Open Meta developer console\",\n envKeys: [\n \"WHATSAPP_ACCESS_TOKEN\",\n \"WHATSAPP_VERIFY_TOKEN\",\n \"WHATSAPP_PHONE_NUMBER_ID\",\n ],\n setupSteps: [\n \"Create a Meta app and add the WhatsApp product.\",\n \"Save the access token, verify token, and phone number ID below.\",\n \"In Meta's WhatsApp configuration, paste the webhook URL and your verify token.\",\n \"Subscribe to the messages field, then enable here.\",\n ],\n },\n];\n\nfunction HelpTooltip({ content }: { content: string }) {\n return (\n <Tooltip>\n <TooltipTrigger asChild>\n <button\n type=\"button\"\n className=\"text-muted-foreground/60 hover:text-foreground cursor-pointer\"\n >\n <IconInfoCircle className=\"h-3.5 w-3.5\" />\n </button>\n </TooltipTrigger>\n <TooltipContent side=\"top\" className=\"max-w-64 text-xs leading-relaxed\">\n {content}\n </TooltipContent>\n </Tooltip>\n );\n}\n\nfunction StatusPill({\n tone,\n label,\n}: {\n tone: \"neutral\" | \"success\" | \"warning\";\n label: string;\n}) {\n const toneClass =\n tone === \"success\"\n ? \"border-emerald-500/30 bg-emerald-500/10 text-emerald-300\"\n : tone === \"warning\"\n ? \"border-amber-500/30 bg-amber-500/10 text-amber-300\"\n : \"border-border bg-muted/40 text-muted-foreground\";\n\n return (\n <span\n className={`inline-flex items-center rounded-full border px-2.5 py-1 text-[11px] font-medium ${toneClass}`}\n >\n {label}\n </span>\n );\n}\n\n/** Render a non-secret env value (e.g. EMAIL_AGENT_ADDRESS) as a copyable\n * text block. We can't read the actual value from the backend (env-status\n * only reports `configured: true|false`), so we offer a one-click reveal\n * that hits a server endpoint, falling back to \"saved\" if the value is\n * not exposed. For now we just render a \"Saved — re-enter to change\"\n * placeholder; a future endpoint can return the actual value. */\nfunction PublicValueReveal({ envKey: _envKey }: { envKey: string }) {\n return (\n <div className=\"rounded-md border bg-muted/20 px-3 py-2 text-xs text-muted-foreground\">\n Saved. Re-enter below to change.\n </div>\n );\n}\n\nfunction ConnectionStatus({\n configured,\n enabled,\n}: {\n configured: boolean;\n enabled: boolean;\n}) {\n if (enabled) {\n return <StatusPill tone=\"success\" label=\"Connected\" />;\n }\n if (configured) {\n return <StatusPill tone=\"warning\" label=\"Configured, not enabled\" />;\n }\n return <StatusPill tone=\"neutral\" label=\"Not configured\" />;\n}\n\nexport function MessagingSetupPanel() {\n const [statuses, setStatuses] = useState<IntegrationStatus[]>([]);\n const [loading, setLoading] = useState(true);\n const [envStatuses, setEnvStatuses] = useState<EnvStatus[]>([]);\n const [envLoading, setEnvLoading] = useState(true);\n const [envValues, setEnvValues] = useState<Record<string, string>>({});\n const [savingKeysFor, setSavingKeysFor] = useState<string | null>(null);\n const [togglingPlatform, setTogglingPlatform] = useState<string | null>(null);\n const [setupPlatform, setSetupPlatform] = useState<string | null>(null);\n const [copiedWebhook, setCopiedWebhook] = useState<string | null>(null);\n\n const refreshStatuses = async () => {\n setLoading(true);\n try {\n const res = await fetch(\n agentNativePath(\"/_agent-native/integrations/status\"),\n );\n const rows = res.ok ? await res.json() : [];\n setStatuses(Array.isArray(rows) ? rows : []);\n } finally {\n setLoading(false);\n }\n };\n\n useEffect(() => {\n let active = true;\n fetch(agentNativePath(\"/_agent-native/integrations/status\"))\n .then((res) => (res.ok ? res.json() : []))\n .then((rows) => {\n if (active) {\n setStatuses(Array.isArray(rows) ? rows : []);\n setLoading(false);\n }\n })\n .catch(() => {\n if (active) setLoading(false);\n });\n return () => {\n active = false;\n };\n }, []);\n\n useEffect(() => {\n let active = true;\n fetch(agentNativePath(\"/_agent-native/env-status\"))\n .then((res) => (res.ok ? res.json() : []))\n .then((rows) => {\n if (active) {\n setEnvStatuses(Array.isArray(rows) ? rows : []);\n setEnvLoading(false);\n }\n })\n .catch(() => {\n if (active) setEnvLoading(false);\n });\n return () => {\n active = false;\n };\n }, []);\n\n const envStatusByKey = useMemo(\n () => new Map(envStatuses.map((status) => [status.key, status])),\n [envStatuses],\n );\n const statusByPlatform = useMemo(\n () => new Map(statuses.map((status) => [status.platform, status])),\n [statuses],\n );\n\n const refreshEnvStatus = async () => {\n setEnvLoading(true);\n try {\n const res = await fetch(agentNativePath(\"/_agent-native/env-status\"));\n const rows = res.ok ? await res.json() : [];\n setEnvStatuses(Array.isArray(rows) ? rows : []);\n } finally {\n setEnvLoading(false);\n }\n };\n\n const saveEnvKeys = async (platform: PlatformDefinition, keys: string[]) => {\n const vars = keys\n .map((key) => ({ key, value: envValues[key]?.trim() || \"\" }))\n .filter((item) => item.value);\n\n if (vars.length === 0) {\n toast.error(\"Add the required credentials first.\");\n return;\n }\n\n setSavingKeysFor(platform.id);\n try {\n const res = await fetch(agentNativePath(\"/_agent-native/env-vars\"), {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ vars }),\n });\n\n if (!res.ok) {\n const payload = await res.json().catch(() => ({}));\n throw new Error(payload.error || \"Failed to save credentials\");\n }\n\n toast.success(`${platform.label} credentials saved`);\n setEnvValues((current) => {\n const next = { ...current };\n for (const key of keys) delete next[key];\n return next;\n });\n await refreshEnvStatus();\n await refreshStatuses();\n } catch (error) {\n toast.error(\n error instanceof Error ? error.message : \"Failed to save credentials\",\n );\n } finally {\n setSavingKeysFor(null);\n }\n };\n\n const togglePlatform = async (\n platform: PlatformDefinition,\n enabled: boolean,\n ) => {\n setTogglingPlatform(platform.id);\n try {\n const action = enabled ? \"disable\" : \"enable\";\n const res = await fetch(\n agentNativePath(`/_agent-native/integrations/${platform.id}/${action}`),\n {\n method: \"POST\",\n },\n );\n if (!res.ok) {\n const payload = await res.json().catch(() => ({}));\n throw new Error(\n payload.error || `Failed to ${action} ${platform.label}`,\n );\n }\n toast.success(\n enabled\n ? `${platform.label} disconnected`\n : `${platform.label} connected`,\n );\n await refreshStatuses();\n } catch (error) {\n toast.error(\n error instanceof Error ? error.message : \"Failed to update integration\",\n );\n } finally {\n setTogglingPlatform(null);\n }\n };\n\n const runSetup = async (platform: PlatformDefinition) => {\n setSetupPlatform(platform.id);\n try {\n const res = await fetch(\n agentNativePath(`/_agent-native/integrations/${platform.id}/setup`),\n {\n method: \"POST\",\n },\n );\n if (!res.ok) {\n const payload = await res.json().catch(() => ({}));\n throw new Error(payload.error || `Failed to set up ${platform.label}`);\n }\n toast.success(\n platform.id === \"telegram\"\n ? \"Telegram webhook registered\"\n : `${platform.label} setup complete`,\n );\n await refreshStatuses();\n } catch (error) {\n toast.error(\n error instanceof Error\n ? error.message\n : `Failed to set up ${platform.label}`,\n );\n } finally {\n setSetupPlatform(null);\n }\n };\n\n const copyWebhook = async (webhookUrl: string) => {\n await navigator.clipboard.writeText(webhookUrl);\n setCopiedWebhook(webhookUrl);\n toast.success(\"Webhook URL copied\");\n setTimeout(() => setCopiedWebhook(null), 1500);\n };\n\n return (\n <div className=\"space-y-4\">\n <div className=\"grid gap-4 xl:grid-cols-2\">\n {PLATFORM_DEFINITIONS.map((platform) => {\n const status = statusByPlatform.get(platform.id);\n const configured = !!status?.configured;\n const enabled = !!status?.enabled;\n // Prefer adapter-supplied env keys (includes optional fields like\n // webhook secrets); fall back to the static list.\n const adapterKeys = status?.requiredEnvKeys;\n const envKeys: RequiredEnvKey[] =\n adapterKeys && adapterKeys.length > 0\n ? adapterKeys\n : platform.envKeys.map((key) => ({\n key,\n label: key,\n required: true,\n }));\n\n return (\n <section\n key={platform.id}\n className=\"rounded-2xl border bg-card p-5\"\n >\n <div className=\"flex items-start justify-between gap-4\">\n <div className=\"flex items-start gap-3\">\n <div className=\"flex h-10 w-10 items-center justify-center rounded-xl border bg-muted/30 text-foreground\">\n <platform.icon size={18} />\n </div>\n <div>\n <div className=\"flex items-center gap-2\">\n <h3 className=\"text-base font-semibold text-foreground\">\n {platform.label}\n </h3>\n <ConnectionStatus\n configured={configured}\n enabled={enabled}\n />\n </div>\n <p className=\"mt-1 text-sm text-muted-foreground\">\n {platform.description}\n </p>\n </div>\n </div>\n <div className=\"flex shrink-0 items-center gap-1\">\n <Button\n asChild\n variant=\"ghost\"\n size=\"sm\"\n className=\"h-7 px-2 text-xs text-muted-foreground\"\n >\n <a href={platform.docsUrl} target=\"_blank\" rel=\"noreferrer\">\n Docs\n <IconExternalLink className=\"ml-1 h-3 w-3\" />\n </a>\n </Button>\n {platform.externalUrl ? (\n <Button\n asChild\n variant=\"ghost\"\n size=\"sm\"\n className=\"h-7 px-2 text-xs text-muted-foreground\"\n >\n <a\n href={platform.externalUrl}\n target=\"_blank\"\n rel=\"noreferrer\"\n >\n {platform.externalLabel ?? \"Open\"}\n <IconExternalLink className=\"ml-1 h-3 w-3\" />\n </a>\n </Button>\n ) : null}\n </div>\n </div>\n\n <Collapsible className=\"mt-5\">\n <CollapsibleTrigger className=\"group flex w-full cursor-pointer items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground\">\n <IconChevronRight className=\"h-3.5 w-3.5 transition-transform group-data-[state=open]:rotate-90\" />\n <span>Setup steps</span>\n </CollapsibleTrigger>\n <CollapsibleContent>\n <div className=\"mt-2 rounded-xl border bg-muted/20 p-4\">\n <ol className=\"space-y-2 text-sm text-muted-foreground\">\n {platform.setupSteps.map((step, index) => (\n <li key={step} className=\"flex gap-2\">\n <span className=\"text-muted-foreground/60\">\n {index + 1}.\n </span>\n <span>{step}</span>\n </li>\n ))}\n </ol>\n </div>\n </CollapsibleContent>\n </Collapsible>\n\n <div className=\"mt-4 space-y-3\">\n <div className=\"flex items-center gap-2\">\n <div className=\"text-sm font-medium text-foreground\">\n Credentials\n </div>\n {envLoading ? (\n <span className=\"text-xs text-muted-foreground\">\n Checking...\n </span>\n ) : null}\n </div>\n <div className=\"space-y-3\">\n {envKeys.map((envKey) => {\n const envStatus = envStatusByKey.get(envKey.key);\n const isConfigured = !!envStatus?.configured;\n const helpText = envKey.helpText ?? envStatus?.helpText;\n const label =\n envKey.label || envStatus?.label || envKey.key;\n // Email agent address is not a secret — show it plainly\n // so users can copy and share it.\n const isPublicValue = envKey.key === \"EMAIL_AGENT_ADDRESS\";\n return (\n <div key={envKey.key} className=\"space-y-1.5\">\n <div className=\"flex items-center justify-between gap-3\">\n <div className=\"flex items-center gap-1.5\">\n <label className=\"text-xs font-medium text-foreground\">\n {label}\n {!envKey.required ? (\n <span className=\"ml-1 text-muted-foreground\">\n (optional)\n </span>\n ) : null}\n </label>\n {helpText ? (\n <HelpTooltip content={helpText} />\n ) : null}\n </div>\n {isConfigured ? (\n <StatusPill tone=\"success\" label=\"Saved\" />\n ) : (\n <StatusPill\n tone={envKey.required ? \"neutral\" : \"neutral\"}\n label={envKey.required ? \"Missing\" : \"Not set\"}\n />\n )}\n </div>\n {isConfigured && isPublicValue ? (\n <PublicValueReveal envKey={envKey.key} />\n ) : !isConfigured ? (\n <Input\n type={isPublicValue ? \"text\" : \"password\"}\n value={envValues[envKey.key] || \"\"}\n onChange={(event) =>\n setEnvValues((current) => ({\n ...current,\n [envKey.key]: event.target.value,\n }))\n }\n placeholder={\n isPublicValue\n ? \"agent@yourcompany.com\"\n : `Enter ${label}`\n }\n autoComplete=\"off\"\n />\n ) : null}\n </div>\n );\n })}\n </div>\n {envKeys.some((k) => !envStatusByKey.get(k.key)?.configured) ? (\n <Button\n variant=\"outline\"\n onClick={() =>\n saveEnvKeys(\n platform,\n envKeys.map((k) => k.key),\n )\n }\n disabled={savingKeysFor === platform.id}\n >\n {savingKeysFor === platform.id ? (\n <>\n <IconLoader2 className=\"mr-2 h-4 w-4 animate-spin\" />\n Saving...\n </>\n ) : (\n \"Save credentials\"\n )}\n </Button>\n ) : null}\n </div>\n\n {status?.webhookUrl ? (\n <div className=\"mt-4 space-y-2\">\n <div className=\"text-sm font-medium text-foreground\">\n Webhook URL\n </div>\n <div className=\"flex items-center gap-2\">\n <code className=\"flex-1 truncate rounded-md border bg-muted/30 px-3 py-2 text-xs text-foreground\">\n {status.webhookUrl}\n </code>\n <Button\n variant=\"outline\"\n size=\"icon\"\n onClick={() => copyWebhook(status.webhookUrl!)}\n aria-label={`Copy ${platform.label} webhook URL`}\n >\n {copiedWebhook === status.webhookUrl ? (\n <IconCheck className=\"h-4 w-4\" />\n ) : (\n <IconCopy className=\"h-4 w-4\" />\n )}\n </Button>\n </div>\n </div>\n ) : null}\n\n <div className=\"mt-5 flex flex-wrap items-center justify-end gap-2 border-t border-border pt-4\">\n {platform.id === \"telegram\" && configured ? (\n <Button\n variant=\"outline\"\n onClick={() => runSetup(platform)}\n disabled={setupPlatform === platform.id}\n >\n {setupPlatform === platform.id ? (\n <>\n <IconLoader2 className=\"mr-2 h-4 w-4 animate-spin\" />\n Setting up...\n </>\n ) : (\n \"Set up webhook\"\n )}\n </Button>\n ) : null}\n {!configured && !enabled ? (\n <Tooltip>\n <TooltipTrigger asChild>\n <span tabIndex={0}>\n <Button disabled>Enable</Button>\n </span>\n </TooltipTrigger>\n <TooltipContent>\n Save the required credentials first.\n </TooltipContent>\n </Tooltip>\n ) : (\n <Button\n onClick={() => togglePlatform(platform, enabled)}\n disabled={togglingPlatform === platform.id}\n >\n {togglingPlatform === platform.id ? (\n <>\n <IconLoader2 className=\"mr-2 h-4 w-4 animate-spin\" />\n Saving...\n </>\n ) : enabled ? (\n \"Disable\"\n ) : (\n \"Enable\"\n )}\n </Button>\n )}\n </div>\n </section>\n );\n })}\n </div>\n\n {loading ? (\n <div className=\"rounded-2xl border border-dashed px-4 py-6 text-sm text-muted-foreground\">\n Loading messaging status...\n </div>\n ) : null}\n </div>\n );\n}\n"]}
@@ -1,5 +1,24 @@
1
- export declare function meta(): {
1
+ import { type LoaderFunctionArgs } from "react-router";
2
+ export declare function loader({ request }: LoaderFunctionArgs): Promise<{
3
+ threadPreview: import("../../server/lib/thread-link-preview.js").ThreadLinkPreview;
4
+ }>;
5
+ export declare function meta({ data }: {
6
+ data?: Awaited<ReturnType<typeof loader>>;
7
+ }): ({
2
8
  title: string;
3
- }[];
9
+ name?: undefined;
10
+ content?: undefined;
11
+ property?: undefined;
12
+ } | {
13
+ name: string;
14
+ content: string;
15
+ title?: undefined;
16
+ property?: undefined;
17
+ } | {
18
+ property: string;
19
+ content: string;
20
+ title?: undefined;
21
+ name?: undefined;
22
+ })[];
4
23
  export default function ChatRoute(): import("react/jsx-runtime").JSX.Element;
5
24
  //# sourceMappingURL=chat.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../../src/routes/pages/chat.tsx"],"names":[],"mappings":"AAiBA,wBAAgB,IAAI;;IAEnB;AAED,MAAM,CAAC,OAAO,UAAU,SAAS,4CA6EhC"}
1
+ {"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../../src/routes/pages/chat.tsx"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,cAAc,CAAC;AAoBtB,wBAAsB,MAAM,CAAC,EAAE,OAAO,EAAE,EAAE,kBAAkB;;GAK3D;AAED,wBAAgB,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC,CAAA;CAAE;;;;;;;;;;;;;;;KAI3E;AAED,MAAM,CAAC,OAAO,UAAU,SAAS,4CA6EhC"}
@@ -1,10 +1,19 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useEffect, useRef } from "react";
3
- import { useLocation, useNavigate } from "react-router";
3
+ import { useLocation, useNavigate, } from "react-router";
4
4
  import { AgentChatSurface } from "@agent-native/core/client";
5
5
  import { submitOverviewPrompt } from "../../lib/overview-chat.js";
6
- export function meta() {
7
- return [{ title: "Chat Dispatch" }];
6
+ import { buildThreadLinkPreviewMeta, loadThreadLinkPreview, } from "../../server/lib/thread-link-preview.js";
7
+ export async function loader({ request }) {
8
+ const threadId = new URL(request.url).searchParams.get("thread");
9
+ return {
10
+ threadPreview: await loadThreadLinkPreview(threadId),
11
+ };
12
+ }
13
+ export function meta({ data }) {
14
+ return data?.threadPreview
15
+ ? buildThreadLinkPreviewMeta(data.threadPreview)
16
+ : [{ title: "Chat — Dispatch" }];
8
17
  }
9
18
  export default function ChatRoute() {
10
19
  const location = useLocation();
@@ -1 +1 @@
1
- {"version":3,"file":"chat.js","sourceRoot":"","sources":["../../../src/routes/pages/chat.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAc3D,MAAM,UAAU,IAAI;IAClB,OAAO,CAAC,EAAE,KAAK,EAAE,iBAAiB,EAAE,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,CAAC,OAAO,UAAU,SAAS;IAC/B,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;IAC/B,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;IAC/B,MAAM,eAAe,GAAG,MAAM,CAAC,IAAI,GAAG,EAAU,CAAC,CAAC;IAClD,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAyC,CAAC;IACjE,MAAM,MAAM,GAAG,KAAK,EAAE,cAAc,CAAC;IACrC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AC,IAAI;QACb,QAAQ,CAAC,QAAQ;QACjB,QAAQ,CAAC,MAAM;QACf,QAAQ;QACR,MAAM,EAAE,EAAE;QACV,MAAM,EAAE,OAAO;QACf,MAAM,EAAE,aAAa;QACrB,MAAM,EAAE,EAAE;QACV,MAAM,EAAE,QAAQ;KACjB,CAAC,CAAC;IAEH,OAAO,CACL,cAAK,SAAS,EAAC,4CAA4C,YACzD,KAAC,gBAAgB,IACf,IAAI,EAAC,MAAM,EACX,SAAS,EAAC,qBAAqB,EAC/B,WAAW,EAAC,MAAM,EAClB,UAAU,EAAE,KAAK,EACjB,UAAU,EAAE,KAAK,EACjB,kBAAkB,EAAE,KAAK,EACzB,WAAW,EAAE,EAAE,EACf,cAAc,EAAC,mEAAmE,EAClF,iBAAiB,EAAC,QAAQ,EAC1B,uBAAuB,QACvB,qBAAqB,EAAC,MAAM,EAC5B,mBAAmB,EAAC,iBAAiB,EACrC,YAAY,EACV,eAAK,SAAS,EAAC,qBAAqB,aAClC,yDAAsC,EACtC,yFAEI,IACA,GAER,GACE,CACP,CAAC;AACJ,CAAC","sourcesContent":["import { useEffect, useRef } from \"react\";\nimport { useLocation, useNavigate } from \"react-router\";\nimport { AgentChatSurface } from \"@agent-native/core/client\";\nimport { submitOverviewPrompt } from \"@/lib/overview-chat\";\n\ninterface DispatchChatLocationState {\n dispatchPrompt?: {\n id?: string | number;\n message?: string;\n selectedModel?: string | null;\n };\n dispatchThread?: {\n id?: string | number;\n threadId?: string;\n };\n}\n\nexport function meta() {\n return [{ title: \"Chat — Dispatch\" }];\n}\n\nexport default function ChatRoute() {\n const location = useLocation();\n const navigate = useNavigate();\n const handledStateIds = useRef(new Set<string>());\n const state = location.state as DispatchChatLocationState | null;\n const prompt = state?.dispatchPrompt;\n const thread = state?.dispatchThread;\n\n useEffect(() => {\n const message = prompt?.message?.trim();\n const threadId = thread?.threadId?.trim();\n if (!message && !threadId) return;\n\n const stateId = String(\n prompt?.id ?? thread?.id ?? `${message ?? \"\"}:${threadId ?? \"\"}`,\n );\n if (handledStateIds.current.has(stateId)) return;\n handledStateIds.current.add(stateId);\n\n const timer = window.setTimeout(() => {\n if (threadId) {\n window.dispatchEvent(\n new CustomEvent(\"agent-chat:open-thread\", {\n detail: { threadId },\n }),\n );\n }\n if (message) {\n submitOverviewPrompt(message, prompt?.selectedModel, {\n openSidebar: false,\n });\n }\n navigate(`${location.pathname}${location.search}${location.hash}`, {\n replace: true,\n state: null,\n });\n }, 0);\n\n return () => window.clearTimeout(timer);\n }, [\n location.hash,\n location.pathname,\n location.search,\n navigate,\n prompt?.id,\n prompt?.message,\n prompt?.selectedModel,\n thread?.id,\n thread?.threadId,\n ]);\n\n return (\n <div className=\"flex h-full min-h-0 flex-col bg-background\">\n <AgentChatSurface\n mode=\"page\"\n className=\"dispatch-chat-panel\"\n defaultMode=\"chat\"\n showHeader={false}\n showTabBar={false}\n dynamicSuggestions={false}\n suggestions={[]}\n emptyStateText=\"Ask Dispatch to create apps, route work, or manage the workspace.\"\n emptyStateDisplay=\"hidden\"\n centerComposerWhenEmpty\n composerLayoutVariant=\"hero\"\n composerPlaceholder=\"Ask Dispatch...\"\n composerSlot={\n <div className=\"dispatch-chat-intro\">\n <h1>What should Dispatch do next?</h1>\n <p>\n Create apps, manage shared keys, and route work across agents.\n </p>\n </div>\n }\n />\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"chat.js","sourceRoot":"","sources":["../../../src/routes/pages/chat.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EACL,WAAW,EACX,WAAW,GAEZ,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EACL,0BAA0B,EAC1B,qBAAqB,GACtB,MAAM,kCAAkC,CAAC;AAc1C,MAAM,CAAC,KA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BAAiB,EAAC,QAAQ,EAC1B,uBAAuB,QACvB,qBAAqB,EAAC,MAAM,EAC5B,mBAAmB,EAAC,iBAAiB,EACrC,YAAY,EACV,eAAK,SAAS,EAAC,qBAAqB,aAClC,yDAAsC,EACtC,yFAEI,IACA,GAER,GACE,CACP,CAAC;AACJ,CAAC","sourcesContent":["import { useEffect, useRef } from \"react\";\nimport {\n useLocation,\n useNavigate,\n type LoaderFunctionArgs,\n} from \"react-router\";\nimport { AgentChatSurface } from \"@agent-native/core/client\";\nimport { submitOverviewPrompt } from \"@/lib/overview-chat\";\nimport {\n buildThreadLinkPreviewMeta,\n loadThreadLinkPreview,\n} from \"@/server/lib/thread-link-preview\";\n\ninterface DispatchChatLocationState {\n dispatchPrompt?: {\n id?: string | number;\n message?: string;\n selectedModel?: string | null;\n };\n dispatchThread?: {\n id?: string | number;\n threadId?: string;\n };\n}\n\nexport async function loader({ request }: LoaderFunctionArgs) {\n const threadId = new URL(request.url).searchParams.get(\"thread\");\n return {\n threadPreview: await loadThreadLinkPreview(threadId),\n };\n}\n\nexport function meta({ data }: { data?: Awaited<ReturnType<typeof loader>> }) {\n return data?.threadPreview\n ? buildThreadLinkPreviewMeta(data.threadPreview)\n : [{ title: \"Chat — Dispatch\" }];\n}\n\nexport default function ChatRoute() {\n const location = useLocation();\n const navigate = useNavigate();\n const handledStateIds = useRef(new Set<string>());\n const state = location.state as DispatchChatLocationState | null;\n const prompt = state?.dispatchPrompt;\n const thread = state?.dispatchThread;\n\n useEffect(() => {\n const message = prompt?.message?.trim();\n const threadId = thread?.threadId?.trim();\n if (!message && !threadId) return;\n\n const stateId = String(\n prompt?.id ?? thread?.id ?? `${message ?? \"\"}:${threadId ?? \"\"}`,\n );\n if (handledStateIds.current.has(stateId)) return;\n handledStateIds.current.add(stateId);\n\n const timer = window.setTimeout(() => {\n if (threadId) {\n window.dispatchEvent(\n new CustomEvent(\"agent-chat:open-thread\", {\n detail: { threadId },\n }),\n );\n }\n if (message) {\n submitOverviewPrompt(message, prompt?.selectedModel, {\n openSidebar: false,\n });\n }\n navigate(`${location.pathname}${location.search}${location.hash}`, {\n replace: true,\n state: null,\n });\n }, 0);\n\n return () => window.clearTimeout(timer);\n }, [\n location.hash,\n location.pathname,\n location.search,\n navigate,\n prompt?.id,\n prompt?.message,\n prompt?.selectedModel,\n thread?.id,\n thread?.threadId,\n ]);\n\n return (\n <div className=\"flex h-full min-h-0 flex-col bg-background\">\n <AgentChatSurface\n mode=\"page\"\n className=\"dispatch-chat-panel\"\n defaultMode=\"chat\"\n showHeader={false}\n showTabBar={false}\n dynamicSuggestions={false}\n suggestions={[]}\n emptyStateText=\"Ask Dispatch to create apps, route work, or manage the workspace.\"\n emptyStateDisplay=\"hidden\"\n centerComposerWhenEmpty\n composerLayoutVariant=\"hero\"\n composerPlaceholder=\"Ask Dispatch...\"\n composerSlot={\n <div className=\"dispatch-chat-intro\">\n <h1>What should Dispatch do next?</h1>\n <p>\n Create apps, manage shared keys, and route work across agents.\n </p>\n </div>\n }\n />\n </div>\n );\n}\n"]}
@@ -1,5 +1,24 @@
1
- export declare function meta(): {
1
+ import { type LoaderFunctionArgs } from "react-router";
2
+ export declare function loader({ request }: LoaderFunctionArgs): Promise<{
3
+ threadPreview: import("../../server/lib/thread-link-preview.js").ThreadLinkPreview;
4
+ }>;
5
+ export declare function meta({ data }: {
6
+ data?: Awaited<ReturnType<typeof loader>>;
7
+ }): ({
2
8
  title: string;
3
- }[];
9
+ name?: undefined;
10
+ content?: undefined;
11
+ property?: undefined;
12
+ } | {
13
+ name: string;
14
+ content: string;
15
+ title?: undefined;
16
+ property?: undefined;
17
+ } | {
18
+ property: string;
19
+ content: string;
20
+ title?: undefined;
21
+ name?: undefined;
22
+ })[];
4
23
  export default function OverviewRoute(): import("react/jsx-runtime").JSX.Element;
5
24
  //# sourceMappingURL=overview.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"overview.d.ts","sourceRoot":"","sources":["../../../src/routes/pages/overview.tsx"],"names":[],"mappings":"AAydA,wBAAgB,IAAI;;IAEnB;AAED,MAAM,CAAC,OAAO,UAAU,aAAa,4CA4RpC"}
1
+ {"version":3,"file":"overview.d.ts","sourceRoot":"","sources":["../../../src/routes/pages/overview.tsx"],"names":[],"mappings":"AACA,OAAO,EAAqB,KAAK,kBAAkB,EAAE,MAAM,cAAc,CAAC;AA4d1E,wBAAsB,MAAM,CAAC,EAAE,OAAO,EAAE,EAAE,kBAAkB;;GAK3D;AAED,wBAAgB,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC,CAAA;CAAE;;;;;;;;;;;;;;;KAI3E;AAED,MAAM,CAAC,OAAO,UAAU,aAAa,4CA4RpC"}
@@ -11,6 +11,7 @@ import { Button } from "../../components/ui/button.js";
11
11
  import { Skeleton } from "../../components/ui/skeleton.js";
12
12
  import { Tooltip, TooltipContent, TooltipTrigger, } from "../../components/ui/tooltip.js";
13
13
  import { submitOverviewPrompt } from "../../lib/overview-chat.js";
14
+ import { buildThreadLinkPreviewMeta, loadThreadLinkPreview, } from "../../server/lib/thread-link-preview.js";
14
15
  const ZERO_TASK_QUEUE_STATS = {
15
16
  pending: 0,
16
17
  processing: 0,
@@ -96,14 +97,22 @@ function HelpTooltip({ content }) {
96
97
  return (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("button", { type: "button", className: "text-muted-foreground/60 hover:text-foreground cursor-pointer", children: _jsx(IconInfoCircle, { className: "h-3.5 w-3.5" }) }) }), _jsx(TooltipContent, { side: "top", className: "max-w-64 text-xs leading-relaxed", children: content })] }));
97
98
  }
98
99
  function StatCard({ label, help, value, icon: Icon, cta, }) {
99
- return (_jsxs("div", { className: "rounded-2xl border bg-card p-5", children: [_jsxs("div", { className: "flex items-start justify-between gap-3", children: [_jsxs("div", { className: "min-w-0", children: [_jsxs("div", { className: "flex items-center gap-1.5 text-sm font-medium text-foreground", children: [_jsx("span", { children: label }), _jsx(HelpTooltip, { content: help })] }), _jsx("div", { className: "mt-3 text-3xl font-semibold text-foreground", children: value })] }), _jsx("div", { className: "rounded-xl border bg-muted/30 p-3 text-muted-foreground", children: _jsx(Icon, { size: 18 }) })] }), cta ? _jsx("div", { className: "mt-4", children: cta }) : null] }));
100
+ return (_jsxs("div", { className: "min-w-0 rounded-2xl border bg-card p-5", children: [_jsxs("div", { className: "flex items-start justify-between gap-3", children: [_jsxs("div", { className: "min-w-0", children: [_jsxs("div", { className: "flex items-center gap-1.5 text-sm font-medium leading-snug text-foreground", children: [_jsx("span", { className: "min-w-0", children: label }), _jsx(HelpTooltip, { content: help })] }), _jsx("div", { className: "mt-3 text-3xl font-semibold text-foreground", children: value })] }), _jsx("div", { className: "shrink-0 rounded-xl border bg-muted/30 p-3 text-muted-foreground", children: _jsx(Icon, { size: 18 }) })] }), cta ? _jsx("div", { className: "mt-4", children: cta }) : null] }));
100
101
  }
101
102
  function StepRow({ step }) {
102
103
  const done = step.complete && !step.informational;
103
104
  return (_jsxs("div", { className: `flex items-start gap-4 rounded-xl border px-5 py-4 ${done ? "border-border/50 bg-muted/20" : "bg-card"}`, children: [_jsx("div", { className: "flex-none pt-0.5", children: done ? (_jsx("div", { className: "flex h-7 w-7 items-center justify-center rounded-full bg-emerald-500/15 text-emerald-600 dark:text-emerald-400", children: _jsx(IconCheck, { size: 16, strokeWidth: 2.5 }) })) : (_jsx("div", { className: "flex h-7 w-7 items-center justify-center rounded-full border border-muted-foreground/30 text-muted-foreground", children: _jsx(IconListCheck, { size: 15 }) })) }), _jsxs("div", { className: `min-w-0 flex-1 ${done ? "opacity-50" : ""}`, children: [_jsx("div", { className: `text-sm font-semibold ${done ? "line-through decoration-muted-foreground/40" : "text-foreground"}`, children: step.title }), _jsx("p", { className: "mt-0.5 text-sm leading-relaxed text-muted-foreground", children: step.description })] }), step.to && !done && (_jsx("div", { className: "flex-none pt-0.5", children: _jsx(Button, { variant: "outline", size: "sm", asChild: true, children: _jsx(Link, { to: step.to, children: step.actionLabel || "Set up" }) }) }))] }));
104
105
  }
105
- export function meta() {
106
- return [{ title: "Overview — Dispatch" }];
106
+ export async function loader({ request }) {
107
+ const threadId = new URL(request.url).searchParams.get("thread");
108
+ return {
109
+ threadPreview: await loadThreadLinkPreview(threadId),
110
+ };
111
+ }
112
+ export function meta({ data }) {
113
+ return data?.threadPreview
114
+ ? buildThreadLinkPreviewMeta(data.threadPreview)
115
+ : [{ title: "Overview — Dispatch" }];
107
116
  }
108
117
  export default function OverviewRoute() {
109
118
  const { data, isLoading } = useActionQuery("list-dispatch-overview", {});
@@ -208,7 +217,7 @@ export default function OverviewRoute() {
208
217
  },
209
218
  ];
210
219
  const hasIncompleteSteps = steps.some((s) => !s.complete && !s.informational);
211
- return (_jsxs(DispatchShell, { title: "Overview", description: "Create apps, manage shared keys, and route work across your workspace.", children: [_jsx(HomeChatPanel, {}), _jsx(WorkspaceAppsSection, { apps: typedWorkspaceApps, isLoading: appsLoading }), hasIncompleteSteps && (_jsxs("section", { className: "space-y-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(IconRocket, { size: 16, className: "text-muted-foreground" }), _jsx("h2", { className: "text-sm font-semibold text-foreground", children: "Getting started" })] }), _jsx("div", { className: "space-y-2", children: steps.map((step) => (_jsx(StepRow, { step: step }, step.number))) })] })), _jsxs("section", { className: "space-y-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(IconActivity, { size: 16, className: "text-muted-foreground" }), _jsx("h2", { className: "text-sm font-semibold text-foreground", children: "At a glance" })] }), _jsxs("div", { className: "grid gap-4 md:grid-cols-2 xl:grid-cols-4", children: [_jsx(StatCard, { label: "Vault secrets", help: "Credentials stored in the workspace vault.", value: data?.vault?.secretCount || 0, icon: IconKey, cta: (data?.vault?.secretCount || 0) === 0 ? (_jsx(Button, { variant: "outline", size: "sm", asChild: true, children: _jsx(Link, { to: "/vault", children: "Set up vault" }) })) : undefined }), _jsx(StatCard, { label: data?.vault?.accessMode === "manual"
220
+ return (_jsxs(DispatchShell, { title: "Overview", description: "Create apps, manage shared keys, and route work across your workspace.", children: [_jsx(HomeChatPanel, {}), _jsx(WorkspaceAppsSection, { apps: typedWorkspaceApps, isLoading: appsLoading }), hasIncompleteSteps && (_jsxs("section", { className: "space-y-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(IconRocket, { size: 16, className: "text-muted-foreground" }), _jsx("h2", { className: "text-sm font-semibold text-foreground", children: "Getting started" })] }), _jsx("div", { className: "space-y-2", children: steps.map((step) => (_jsx(StepRow, { step: step }, step.number))) })] })), _jsxs("section", { className: "space-y-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(IconActivity, { size: 16, className: "text-muted-foreground" }), _jsx("h2", { className: "text-sm font-semibold text-foreground", children: "At a glance" })] }), _jsxs("div", { className: "grid grid-cols-[repeat(auto-fit,minmax(min(100%,13rem),1fr))] gap-4", children: [_jsx(StatCard, { label: "Vault secrets", help: "Credentials stored in the workspace vault.", value: data?.vault?.secretCount || 0, icon: IconKey, cta: (data?.vault?.secretCount || 0) === 0 ? (_jsx(Button, { variant: "outline", size: "sm", asChild: true, children: _jsx(Link, { to: "/vault", children: "Set up vault" }) })) : undefined }), _jsx(StatCard, { label: data?.vault?.accessMode === "manual"
212
221
  ? "Active grants"
213
222
  : "Accessible keys", help: data?.vault?.accessMode === "manual"
214
223
  ? "Secrets currently granted to apps. Sync them to push credentials."