@agent-native/dispatch 0.14.1 → 0.14.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/messaging-setup-panel.d.ts.map +1 -1
- package/dist/components/messaging-setup-panel.js +15 -2
- package/dist/components/messaging-setup-panel.js.map +1 -1
- package/dist/server/lib/env-config.js +1 -1
- package/dist/server/lib/env-config.js.map +1 -1
- package/package.json +2 -2
- package/src/components/messaging-setup-panel.spec.tsx +17 -1
- package/src/components/messaging-setup-panel.tsx +81 -1
- package/src/server/lib/env-config.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messaging-setup-panel.d.ts","sourceRoot":"","sources":["../../src/components/messaging-setup-panel.tsx"],"names":[],"mappings":"AAqKA,wBAAgB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"messaging-setup-panel.d.ts","sourceRoot":"","sources":["../../src/components/messaging-setup-panel.tsx"],"names":[],"mappings":"AAqKA,wBAAgB,mBAAmB,oDAs2BlC"}
|
|
@@ -311,6 +311,8 @@ export function MessagingSetupPanel() {
|
|
|
311
311
|
installations.some((installation) => installation.status === "connected"));
|
|
312
312
|
const enabled = !!status?.enabled;
|
|
313
313
|
const envKeys = platform.credentialRequirements;
|
|
314
|
+
const primaryEnvKeys = envKeys.filter((envKey) => envKey.key !== "SLACK_BOT_TOKEN");
|
|
315
|
+
const legacyEnvKeys = envKeys.filter((envKey) => envKey.key === "SLACK_BOT_TOKEN");
|
|
314
316
|
const missingRequiredCredentials = hasMissingRequiredCredentials(envKeys, envStatusByKey);
|
|
315
317
|
const Icon = PLATFORM_ICONS[platform.iconKey] ?? IconPlug;
|
|
316
318
|
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(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.name }), _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.documentation.href, target: "_blank", rel: "noreferrer", children: ["Docs", _jsx(IconExternalLink, { className: "ml-1 h-3 w-3" })] }) }), platform.documentation.externalHref ? (_jsx(Button, { asChild: true, variant: "ghost", size: "sm", className: "h-7 px-2 text-xs text-muted-foreground", children: _jsxs("a", { href: platform.documentation.externalHref, target: "_blank", rel: "noreferrer", children: [platform.documentation.externalLabel ?? "Open", _jsx(IconExternalLink, { className: "ml-1 h-3 w-3" })] }) })) : null] })] }), platform.id === "slack" ? (_jsxs("div", { className: "mt-5 space-y-3 rounded-xl border bg-muted/20 p-4", children: [_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-3", children: [_jsxs("div", { children: [_jsx("div", { className: "text-sm font-medium text-foreground", children: t("messaging.managed.title") }), _jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: t("messaging.managed.description") }), _jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: t("messaging.managed.agentManifestDescription") })] }), _jsxs("div", { className: "space-y-2", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsx(Button, { asChild: true, variant: "outline", size: "sm", children: _jsxs("a", { href: managedSlackAgentManifestUrl(), children: [_jsx(IconFileDescription, { className: "mr-2 h-4 w-4" }), t("messaging.managed.agentManifest")] }) }), missingRequiredCredentials ? (_jsxs(Button, { size: "sm", disabled: true, children: [_jsx(IconBrandSlack, { className: "mr-2 h-4 w-4" }), t("messaging.managed.addToSlack")] })) : (_jsx(Button, { asChild: true, size: "sm", children: _jsxs("a", { href: managedIntegrationOAuthUrl("slack"), children: [_jsx(IconBrandSlack, { className: "mr-2 h-4 w-4" }), t("messaging.managed.addToSlack")] }) }))] }), missingRequiredCredentials ? (_jsx("p", { className: "max-w-72 text-xs text-amber-700 dark:text-amber-300", children: t("messaging.managed.requiredCredentials") })) : null] })] }), installations.length ? (_jsx("div", { className: "space-y-2", children: installations.map((installation) => (_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-3 rounded-lg border bg-background/60 px-3 py-2", children: [_jsxs("div", { children: [_jsx("div", { className: "text-sm font-medium text-foreground", children: installation.teamName ||
|
|
@@ -355,7 +357,7 @@ export function MessagingSetupPanel() {
|
|
|
355
357
|
...current,
|
|
356
358
|
[scope.id]: event.target.value,
|
|
357
359
|
})), placeholder: "25" })] }), _jsx(Button, { variant: "outline", onClick: () => saveScopeBudget(scope), disabled: savingScope === `budget:${scope.id}`, children: t("messaging.managed.saveBudget") })] })] }, scope.id));
|
|
358
|
-
})] })) : 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.setup.steps.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:
|
|
360
|
+
})] })) : 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.setup.steps.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: primaryEnvKeys.map((envKey) => {
|
|
359
361
|
const envStatus = envStatusByKey.get(envKey.key);
|
|
360
362
|
const isConfigured = !!envStatus?.configured;
|
|
361
363
|
const helpText = envKey.helpText ?? envStatus?.helpText;
|
|
@@ -369,7 +371,18 @@ export function MessagingSetupPanel() {
|
|
|
369
371
|
})), placeholder: isPublicValue
|
|
370
372
|
? "agent@yourcompany.com"
|
|
371
373
|
: `Enter ${label}`, autoComplete: "off" })) : null] }, envKey.key));
|
|
372
|
-
}) }),
|
|
374
|
+
}) }), legacyEnvKeys.length ? (_jsxs(Collapsible, { 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: legacyEnvKeys[0]?.label })] }), _jsx(CollapsibleContent, { children: _jsxs("div", { className: "mt-2 space-y-3 rounded-xl border border-amber-500/30 bg-amber-500/5 p-4", children: [_jsx("p", { className: "text-xs text-muted-foreground", children: legacyEnvKeys[0]?.helpText }), legacyEnvKeys.map((envKey) => {
|
|
375
|
+
const envStatus = envStatusByKey.get(envKey.key);
|
|
376
|
+
const isConfigured = !!envStatus?.configured;
|
|
377
|
+
const helpText = envKey.helpText ?? envStatus?.helpText;
|
|
378
|
+
const label = envKey.label || envStatus?.label || envKey.key;
|
|
379
|
+
return (_jsxs("div", { className: "space-y-1.5", children: [_jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsxs("div", { className: "flex items-center gap-1.5", children: [_jsx("label", { className: "text-xs font-medium text-foreground", children: label }), helpText ? (_jsx(HelpTooltip, { content: helpText })) : null] }), _jsx(StatusPill, { tone: isConfigured ? "success" : "neutral", label: isConfigured ? "Saved" : "Not set" })] }), !isConfigured ? (_jsx(Input, { type: "password", value: envValues[envKey.key] || "", onChange: (event) => setEnvValues((current) => ({
|
|
380
|
+
...current,
|
|
381
|
+
[envKey.key]: event.target.value,
|
|
382
|
+
})), placeholder: `Enter ${label}`, autoComplete: "off" })) : null] }, envKey.key));
|
|
383
|
+
}), legacyEnvKeys.some((envKey) => !envStatusByKey.get(envKey.key)?.configured) ? (_jsx(Button, { variant: "outline", onClick: () => saveEnvKeys(platform, legacyEnvKeys.map((envKey) => envKey.key)), disabled: savingKeysFor === platform.id, children: savingKeysFor === platform.id
|
|
384
|
+
? "Saving..."
|
|
385
|
+
: "Save credentials" })) : null] }) })] })) : null, missingRequiredCredentials ? (_jsx(Button, { variant: "outline", onClick: () => saveEnvKeys(platform, envKeys.map((k) => k.key)), disabled: savingKeysFor === platform.id, children: savingKeysFor === platform.id ? (_jsxs(_Fragment, { children: [_jsx(IconLoader2, { className: "mr-2 h-4 w-4 animate-spin" }), "Saving..."] })) : ("Save credentials") })) : null] }), status?.webhookUrl ? (_jsxs("div", { className: "mt-4 space-y-2", children: [_jsx("div", { className: "text-sm font-medium text-foreground", children: "Webhook URL" }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("code", { className: "flex-1 truncate rounded-md border bg-muted/30 px-3 py-2 text-xs text-foreground", children: status.webhookUrl }), _jsx(Button, { variant: "outline", size: "icon", onClick: () => copyWebhook(status.webhookUrl), "aria-label": `Copy ${platform.name} webhook URL`, children: copiedWebhook === status.webhookUrl ? (_jsx(IconCheck, { className: "h-4 w-4" })) : (_jsx(IconCopy, { className: "h-4 w-4" })) })] })] })) : null, _jsxs("div", { className: "mt-5 flex flex-wrap items-center justify-end gap-2 border-t border-border pt-4", children: [platform.id === "telegram" && configured ? (_jsx(Button, { variant: "outline", onClick: () => runSetup(platform), disabled: setupPlatform === platform.id, children: setupPlatform === platform.id ? (_jsxs(_Fragment, { children: [_jsx(IconLoader2, { className: "mr-2 h-4 w-4 animate-spin" }), "Setting up..."] })) : ("Set up webhook") })) : null, !configured && !enabled ? (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("span", { tabIndex: 0, children: _jsx(Button, { disabled: true, children: "Enable" }) }) }), _jsx(TooltipContent, { children: "Save the required credentials first." })] })) : (_jsx(Button, { onClick: () => togglePlatform(platform, enabled), disabled: togglingPlatform === platform.id, children: togglingPlatform === platform.id ? (_jsxs(_Fragment, { children: [_jsx(IconLoader2, { className: "mr-2 h-4 w-4 animate-spin" }), "Saving..."] })) : enabled ? ("Disable") : ("Enable") }))] })] }, platform.id));
|
|
373
386
|
}) }), loading ? (_jsx("div", { className: "rounded-2xl border border-dashed px-4 py-6 text-sm text-muted-foreground", children: "Loading messaging status..." })) : null] }));
|
|
374
387
|
}
|
|
375
388
|
//# sourceMappingURL=messaging-setup-panel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messaging-setup-panel.js","sourceRoot":"","sources":["../../src/components/messaging-setup-panel.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,wCAAwC,EACxC,6BAA6B,EAC7B,mCAAmC,EACnC,4BAA4B,EAC5B,0BAA0B,EAC1B,uB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,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,KA7dD,QAAQ,CAAC,EAAE,CA8dR,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 {\n disconnectManagedIntegrationInstallation,\n listManagedIntegrationBudgets,\n listManagedIntegrationInstallations,\n listManagedIntegrationScopes,\n listIntegrationEnvStatuses,\n listIntegrationStatuses,\n managedIntegrationOAuthUrl,\n managedSlackAgentManifestUrl,\n saveIntegrationEnvVars,\n saveManagedIntegrationBudget,\n saveManagedIntegrationScope,\n setIntegrationEnabled,\n setupIntegration,\n testManagedIntegrationInstallation,\n type ClientIntegrationInstallation,\n type ClientIntegrationScope,\n type ClientIntegrationUsageBudget,\n type ClientIntegrationStatus,\n type IntegrationEnvStatus,\n useFormatters,\n useT,\n} from \"@agent-native/core/client\";\nimport {\n listBuiltInChannelIntegrations,\n type IntegrationCatalogEntry,\n type IntegrationCredentialRequirement,\n} from \"@agent-native/core/integrations\";\nimport {\n IconBrandDiscord,\n IconBrandSlack,\n IconBrandTelegram,\n IconBrandTeams,\n IconBrandWhatsapp,\n IconCheck,\n IconChevronRight,\n IconCopy,\n IconExternalLink,\n IconFileDescription,\n IconInfoCircle,\n IconLoader2,\n IconMail,\n IconPlug,\n} from \"@tabler/icons-react\";\nimport { useEffect, useMemo, useState } from \"react\";\nimport { toast } from \"sonner\";\n\nimport { Button } from \"./ui/button\";\nimport {\n Collapsible,\n CollapsibleContent,\n CollapsibleTrigger,\n} from \"./ui/collapsible\";\nimport { Input } from \"./ui/input\";\nimport { Switch } from \"./ui/switch\";\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"./ui/tooltip\";\n\nconst CHANNELS = listBuiltInChannelIntegrations();\n\nconst PLATFORM_ICONS: Partial<Record<string, typeof IconBrandSlack>> = {\n slack: IconBrandSlack,\n \"microsoft-teams\": IconBrandTeams,\n discord: IconBrandDiscord,\n telegram: IconBrandTelegram,\n whatsapp: IconBrandWhatsapp,\n email: IconMail,\n};\n\nfunction hasMissingRequiredCredentials(\n credentials: readonly IntegrationCredentialRequirement[],\n envStatusByKey: Map<string, IntegrationEnvStatus>,\n) {\n const alternatives = new Map<\n string,\n readonly IntegrationCredentialRequirement[]\n >();\n\n for (const credential of credentials) {\n if (!credential.required) continue;\n if (!credential.alternativeGroup) {\n if (!envStatusByKey.get(credential.key)?.configured) return true;\n continue;\n }\n const group = alternatives.get(credential.alternativeGroup) ?? [];\n alternatives.set(credential.alternativeGroup, [...group, credential]);\n }\n\n return [...alternatives.values()].some((group) =>\n group.every(\n (credential) => !envStatusByKey.get(credential.key)?.configured,\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 t = useT();\n const { formatDate } = useFormatters();\n const [statuses, setStatuses] = useState<ClientIntegrationStatus[]>([]);\n const [loading, setLoading] = useState(true);\n const [envStatuses, setEnvStatuses] = useState<IntegrationEnvStatus[]>([]);\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 const [installations, setInstallations] = useState<\n ClientIntegrationInstallation[]\n >([]);\n const [installationAction, setInstallationAction] = useState<string | null>(\n null,\n );\n const [scopes, setScopes] = useState<ClientIntegrationScope[]>([]);\n const [budgets, setBudgets] = useState<ClientIntegrationUsageBudget[]>([]);\n const [scopeBudget, setScopeBudget] = useState<Record<string, string>>({});\n const [savingScope, setSavingScope] = useState<string | null>(null);\n\n const refreshStatuses = async () => {\n setLoading(true);\n try {\n setStatuses(await listIntegrationStatuses());\n } finally {\n setLoading(false);\n }\n };\n\n useEffect(() => {\n let active = true;\n listIntegrationStatuses()\n .then((rows) => {\n if (active) {\n setStatuses(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 listManagedIntegrationInstallations(\"slack\")\n .then((rows) => {\n if (active) setInstallations(rows);\n })\n .catch(() => {});\n listManagedIntegrationScopes(\"slack\")\n .then((rows) => {\n if (active) setScopes(rows);\n })\n .catch(() => {});\n listManagedIntegrationBudgets()\n .then((rows) => {\n if (active) setBudgets(rows);\n })\n .catch(() => {});\n return () => {\n active = false;\n };\n }, []);\n\n useEffect(() => {\n let active = true;\n listIntegrationEnvStatuses()\n .then((rows) => {\n if (active) {\n setEnvStatuses(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 setEnvStatuses(await listIntegrationEnvStatuses());\n } finally {\n setEnvLoading(false);\n }\n };\n\n const saveEnvKeys = async (\n platform: IntegrationCatalogEntry,\n keys: string[],\n ) => {\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 await saveIntegrationEnvVars(vars);\n\n toast.success(`${platform.name} 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: IntegrationCatalogEntry,\n enabled: boolean,\n ) => {\n setTogglingPlatform(platform.id);\n try {\n await setIntegrationEnabled(platform.id, !enabled);\n toast.success(\n enabled\n ? `${platform.name} disconnected`\n : `${platform.name} 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: IntegrationCatalogEntry) => {\n setSetupPlatform(platform.id);\n try {\n await setupIntegration(platform.id);\n toast.success(\n platform.id === \"telegram\"\n ? \"Telegram webhook registered\"\n : `${platform.name} 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.name}`,\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 const runInstallationAction = async (\n installation: ClientIntegrationInstallation,\n action: \"test\" | \"disconnect\",\n ) => {\n setInstallationAction(`${action}:${installation.id}`);\n try {\n await (action === \"test\"\n ? testManagedIntegrationInstallation(installation.id)\n : disconnectManagedIntegrationInstallation(installation.id));\n setInstallations(await listManagedIntegrationInstallations(\"slack\"));\n toast.success(\n action === \"test\"\n ? t(\"messaging.managed.connectionChecked\")\n : t(\"messaging.managed.workspaceDisconnected\"),\n );\n } catch (error) {\n toast.error(\n error instanceof Error\n ? error.message\n : t(\"messaging.managed.actionFailed\"),\n );\n } finally {\n setInstallationAction(null);\n }\n };\n\n const updateScopePolicy = async (\n scope: ClientIntegrationScope,\n policy: Partial<ClientIntegrationScope[\"policy\"]>,\n ) => {\n setSavingScope(scope.id);\n try {\n await saveManagedIntegrationScope({\n platform: scope.platform,\n tenantId: scope.tenantId,\n conversationId: scope.conversationId,\n conversationType: scope.conversationType,\n trust: scope.trust,\n orgId: scope.orgId,\n serviceOwnerEmail: scope.serviceOwnerEmail,\n defaultModel: scope.defaultModel,\n policy: { ...scope.policy, ...policy },\n });\n setScopes(await listManagedIntegrationScopes(\"slack\"));\n toast.success(t(\"messaging.managed.channelPolicyUpdated\"));\n } catch (error) {\n toast.error(\n error instanceof Error\n ? error.message\n : t(\"messaging.managed.policyUpdateFailed\"),\n );\n } finally {\n setSavingScope(null);\n }\n };\n\n const saveScopeBudget = async (scope: ClientIntegrationScope) => {\n const dollars = Number(scopeBudget[scope.id]);\n if (!Number.isFinite(dollars) || dollars <= 0) {\n toast.error(t(\"messaging.managed.positiveMonthlyBudget\"));\n return;\n }\n setSavingScope(`budget:${scope.id}`);\n try {\n await saveManagedIntegrationBudget({\n subject: {\n type: \"scope\",\n scope: {\n platform: scope.platform,\n tenantId: scope.tenantId,\n conversationId: scope.conversationId,\n },\n },\n period: \"month\",\n limitMicros: Math.round(dollars * 1_000_000),\n });\n setBudgets(await listManagedIntegrationBudgets());\n toast.success(t(\"messaging.managed.channelBudgetSaved\"));\n } catch (error) {\n toast.error(\n error instanceof Error\n ? error.message\n : t(\"messaging.managed.budgetSaveFailed\"),\n );\n } finally {\n setSavingScope(null);\n }\n };\n\n return (\n <div className=\"space-y-4\">\n <div className=\"grid gap-4 xl:grid-cols-2\">\n {CHANNELS.map((platform) => {\n const status = statusByPlatform.get(platform.id);\n const configured =\n !!status?.configured ||\n (platform.id === \"slack\" &&\n installations.some(\n (installation) => installation.status === \"connected\",\n ));\n const enabled = !!status?.enabled;\n const envKeys = platform.credentialRequirements;\n const missingRequiredCredentials = hasMissingRequiredCredentials(\n envKeys,\n envStatusByKey,\n );\n const Icon = PLATFORM_ICONS[platform.iconKey] ?? IconPlug;\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 <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.name}\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\n href={platform.documentation.href}\n target=\"_blank\"\n rel=\"noreferrer\"\n >\n Docs\n <IconExternalLink className=\"ml-1 h-3 w-3\" />\n </a>\n </Button>\n {platform.documentation.externalHref ? (\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.documentation.externalHref}\n target=\"_blank\"\n rel=\"noreferrer\"\n >\n {platform.documentation.externalLabel ?? \"Open\"}\n <IconExternalLink className=\"ml-1 h-3 w-3\" />\n </a>\n </Button>\n ) : null}\n </div>\n </div>\n\n {platform.id === \"slack\" ? (\n <div className=\"mt-5 space-y-3 rounded-xl border bg-muted/20 p-4\">\n <div className=\"flex flex-wrap items-center justify-between gap-3\">\n <div>\n <div className=\"text-sm font-medium text-foreground\">\n {t(\"messaging.managed.title\")}\n </div>\n <p className=\"mt-1 text-xs text-muted-foreground\">\n {t(\"messaging.managed.description\")}\n </p>\n <p className=\"mt-1 text-xs text-muted-foreground\">\n {t(\"messaging.managed.agentManifestDescription\")}\n </p>\n </div>\n <div className=\"space-y-2\">\n <div className=\"flex flex-wrap items-center gap-2\">\n <Button asChild variant=\"outline\" size=\"sm\">\n <a href={managedSlackAgentManifestUrl()}>\n <IconFileDescription className=\"mr-2 h-4 w-4\" />\n {t(\"messaging.managed.agentManifest\")}\n </a>\n </Button>\n {missingRequiredCredentials ? (\n <Button size=\"sm\" disabled>\n <IconBrandSlack className=\"mr-2 h-4 w-4\" />\n {t(\"messaging.managed.addToSlack\")}\n </Button>\n ) : (\n <Button asChild size=\"sm\">\n <a href={managedIntegrationOAuthUrl(\"slack\")}>\n <IconBrandSlack className=\"mr-2 h-4 w-4\" />\n {t(\"messaging.managed.addToSlack\")}\n </a>\n </Button>\n )}\n </div>\n {missingRequiredCredentials ? (\n <p className=\"max-w-72 text-xs text-amber-700 dark:text-amber-300\">\n {t(\"messaging.managed.requiredCredentials\")}\n </p>\n ) : null}\n </div>\n </div>\n {installations.length ? (\n <div className=\"space-y-2\">\n {installations.map((installation) => (\n <div\n key={installation.id}\n className=\"flex flex-wrap items-center justify-between gap-3 rounded-lg border bg-background/60 px-3 py-2\"\n >\n <div>\n <div className=\"text-sm font-medium text-foreground\">\n {installation.teamName ||\n installation.enterpriseName ||\n installation.teamId ||\n t(\"messaging.managed.workspaceFallback\")}\n </div>\n <div className=\"mt-0.5 text-xs text-muted-foreground\">\n {t(\"messaging.managed.scopesUpdated\", {\n count: installation.scopes.length,\n date: formatDate(installation.updatedAt, {\n dateStyle: \"medium\",\n }),\n })}\n </div>\n </div>\n <div className=\"flex items-center gap-2\">\n <StatusPill\n tone={\n installation.health === \"healthy\"\n ? \"success\"\n : installation.health === \"degraded\" ||\n installation.health === \"revoked\"\n ? \"warning\"\n : \"neutral\"\n }\n label={t(\n `messaging.managed.health.${installation.health}`,\n )}\n />\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={() =>\n runInstallationAction(installation, \"test\")\n }\n disabled={\n installationAction === `test:${installation.id}`\n }\n >\n {t(\"messaging.managed.test\")}\n </Button>\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={() =>\n runInstallationAction(\n installation,\n \"disconnect\",\n )\n }\n disabled={\n installationAction ===\n `disconnect:${installation.id}`\n }\n >\n {t(\"messaging.managed.disconnect\")}\n </Button>\n </div>\n </div>\n ))}\n </div>\n ) : (\n <p className=\"text-xs text-muted-foreground\">\n {t(\"messaging.managed.empty\")}\n </p>\n )}\n </div>\n ) : null}\n\n {platform.id === \"slack\" && scopes.length ? (\n <div className=\"mt-4 space-y-3 rounded-xl border bg-muted/20 p-4\">\n <div>\n <div className=\"text-sm font-medium text-foreground\">\n {t(\"messaging.managed.channelAccessTitle\")}\n </div>\n <p className=\"mt-1 text-xs text-muted-foreground\">\n {t(\"messaging.managed.channelAccessDescription\")}\n </p>\n </div>\n {scopes.map((scope) => {\n const subjectId = JSON.stringify([\n scope.platform,\n scope.tenantId,\n scope.conversationId,\n ]);\n const budget = budgets.find(\n (item) =>\n item.subjectType === \"scope\" &&\n item.subjectId === subjectId &&\n item.period === \"month\",\n );\n return (\n <div\n key={scope.id}\n className=\"space-y-3 rounded-lg border bg-background/60 p-3\"\n >\n <div className=\"flex flex-wrap items-center justify-between gap-2\">\n <div>\n <div className=\"font-mono text-xs text-foreground\">\n {scope.conversationId}\n </div>\n <div className=\"mt-0.5 text-xs text-muted-foreground\">\n {t(\"messaging.managed.isolatedIdentity\", {\n trust: t(\n `messaging.managed.trust.${scope.trust}`,\n ),\n })}\n </div>\n </div>\n <StatusPill\n tone={\n scope.trust === \"trusted\" ? \"success\" : \"warning\"\n }\n label={t(`messaging.managed.trust.${scope.trust}`)}\n />\n </div>\n <div className=\"grid gap-2 sm:grid-cols-3\">\n {[\n [\n \"requireMention\",\n t(\"messaging.managed.requireMention\"),\n ],\n [\"allowGuests\", t(\"messaging.managed.allowGuests\")],\n [\n \"allowExternalShared\",\n t(\"messaging.managed.allowSlackConnect\"),\n ],\n ].map(([key, label]) => (\n <label\n key={key}\n className=\"flex items-center justify-between gap-2 rounded-md border px-2.5 py-2 text-xs\"\n >\n {label}\n <Switch\n checked={\n scope.policy[\n key as keyof ClientIntegrationScope[\"policy\"]\n ]\n }\n disabled={savingScope === scope.id}\n onCheckedChange={(checked) =>\n updateScopePolicy(scope, { [key]: checked })\n }\n />\n </label>\n ))}\n </div>\n <div className=\"flex flex-wrap items-end gap-2\">\n <div className=\"min-w-40 flex-1 space-y-1\">\n <label className=\"text-xs font-medium text-foreground\">\n {t(\"messaging.managed.monthlyBudgetUsd\")}\n </label>\n <Input\n inputMode=\"decimal\"\n value={\n scopeBudget[scope.id] ??\n (budget\n ? String(budget.limitMicros / 1_000_000)\n : \"\")\n }\n onChange={(event) =>\n setScopeBudget((current) => ({\n ...current,\n [scope.id]: event.target.value,\n }))\n }\n placeholder=\"25\"\n />\n </div>\n <Button\n variant=\"outline\"\n onClick={() => saveScopeBudget(scope)}\n disabled={savingScope === `budget:${scope.id}`}\n >\n {t(\"messaging.managed.saveBudget\")}\n </Button>\n </div>\n </div>\n );\n })}\n </div>\n ) : null}\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.setup.steps.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=\"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 {missingRequiredCredentials ? (\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.name} 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,EACL,wCAAwC,EACxC,6BAA6B,EAC7B,mCAAmC,EACnC,4BAA4B,EAC5B,0BAA0B,EAC1B,uBAAuB,EACvB,0BAA0B,EAC1B,4BAA4B,EAC5B,sBAAsB,EACtB,4BAA4B,EAC5B,2BAA2B,EAC3B,qBAAqB,EACrB,gBAAgB,EAChB,kCAAkC,EAMlC,aAAa,EACb,IAAI,GACL,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,8BA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,GACM,CACV,IACG,KAviBD,QAAQ,CAAC,EAAE,CAwiBR,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 {\n disconnectManagedIntegrationInstallation,\n listManagedIntegrationBudgets,\n listManagedIntegrationInstallations,\n listManagedIntegrationScopes,\n listIntegrationEnvStatuses,\n listIntegrationStatuses,\n managedIntegrationOAuthUrl,\n managedSlackAgentManifestUrl,\n saveIntegrationEnvVars,\n saveManagedIntegrationBudget,\n saveManagedIntegrationScope,\n setIntegrationEnabled,\n setupIntegration,\n testManagedIntegrationInstallation,\n type ClientIntegrationInstallation,\n type ClientIntegrationScope,\n type ClientIntegrationUsageBudget,\n type ClientIntegrationStatus,\n type IntegrationEnvStatus,\n useFormatters,\n useT,\n} from \"@agent-native/core/client\";\nimport {\n listBuiltInChannelIntegrations,\n type IntegrationCatalogEntry,\n type IntegrationCredentialRequirement,\n} from \"@agent-native/core/integrations\";\nimport {\n IconBrandDiscord,\n IconBrandSlack,\n IconBrandTelegram,\n IconBrandTeams,\n IconBrandWhatsapp,\n IconCheck,\n IconChevronRight,\n IconCopy,\n IconExternalLink,\n IconFileDescription,\n IconInfoCircle,\n IconLoader2,\n IconMail,\n IconPlug,\n} from \"@tabler/icons-react\";\nimport { useEffect, useMemo, useState } from \"react\";\nimport { toast } from \"sonner\";\n\nimport { Button } from \"./ui/button\";\nimport {\n Collapsible,\n CollapsibleContent,\n CollapsibleTrigger,\n} from \"./ui/collapsible\";\nimport { Input } from \"./ui/input\";\nimport { Switch } from \"./ui/switch\";\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"./ui/tooltip\";\n\nconst CHANNELS = listBuiltInChannelIntegrations();\n\nconst PLATFORM_ICONS: Partial<Record<string, typeof IconBrandSlack>> = {\n slack: IconBrandSlack,\n \"microsoft-teams\": IconBrandTeams,\n discord: IconBrandDiscord,\n telegram: IconBrandTelegram,\n whatsapp: IconBrandWhatsapp,\n email: IconMail,\n};\n\nfunction hasMissingRequiredCredentials(\n credentials: readonly IntegrationCredentialRequirement[],\n envStatusByKey: Map<string, IntegrationEnvStatus>,\n) {\n const alternatives = new Map<\n string,\n readonly IntegrationCredentialRequirement[]\n >();\n\n for (const credential of credentials) {\n if (!credential.required) continue;\n if (!credential.alternativeGroup) {\n if (!envStatusByKey.get(credential.key)?.configured) return true;\n continue;\n }\n const group = alternatives.get(credential.alternativeGroup) ?? [];\n alternatives.set(credential.alternativeGroup, [...group, credential]);\n }\n\n return [...alternatives.values()].some((group) =>\n group.every(\n (credential) => !envStatusByKey.get(credential.key)?.configured,\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 t = useT();\n const { formatDate } = useFormatters();\n const [statuses, setStatuses] = useState<ClientIntegrationStatus[]>([]);\n const [loading, setLoading] = useState(true);\n const [envStatuses, setEnvStatuses] = useState<IntegrationEnvStatus[]>([]);\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 const [installations, setInstallations] = useState<\n ClientIntegrationInstallation[]\n >([]);\n const [installationAction, setInstallationAction] = useState<string | null>(\n null,\n );\n const [scopes, setScopes] = useState<ClientIntegrationScope[]>([]);\n const [budgets, setBudgets] = useState<ClientIntegrationUsageBudget[]>([]);\n const [scopeBudget, setScopeBudget] = useState<Record<string, string>>({});\n const [savingScope, setSavingScope] = useState<string | null>(null);\n\n const refreshStatuses = async () => {\n setLoading(true);\n try {\n setStatuses(await listIntegrationStatuses());\n } finally {\n setLoading(false);\n }\n };\n\n useEffect(() => {\n let active = true;\n listIntegrationStatuses()\n .then((rows) => {\n if (active) {\n setStatuses(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 listManagedIntegrationInstallations(\"slack\")\n .then((rows) => {\n if (active) setInstallations(rows);\n })\n .catch(() => {});\n listManagedIntegrationScopes(\"slack\")\n .then((rows) => {\n if (active) setScopes(rows);\n })\n .catch(() => {});\n listManagedIntegrationBudgets()\n .then((rows) => {\n if (active) setBudgets(rows);\n })\n .catch(() => {});\n return () => {\n active = false;\n };\n }, []);\n\n useEffect(() => {\n let active = true;\n listIntegrationEnvStatuses()\n .then((rows) => {\n if (active) {\n setEnvStatuses(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 setEnvStatuses(await listIntegrationEnvStatuses());\n } finally {\n setEnvLoading(false);\n }\n };\n\n const saveEnvKeys = async (\n platform: IntegrationCatalogEntry,\n keys: string[],\n ) => {\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 await saveIntegrationEnvVars(vars);\n\n toast.success(`${platform.name} 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: IntegrationCatalogEntry,\n enabled: boolean,\n ) => {\n setTogglingPlatform(platform.id);\n try {\n await setIntegrationEnabled(platform.id, !enabled);\n toast.success(\n enabled\n ? `${platform.name} disconnected`\n : `${platform.name} 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: IntegrationCatalogEntry) => {\n setSetupPlatform(platform.id);\n try {\n await setupIntegration(platform.id);\n toast.success(\n platform.id === \"telegram\"\n ? \"Telegram webhook registered\"\n : `${platform.name} 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.name}`,\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 const runInstallationAction = async (\n installation: ClientIntegrationInstallation,\n action: \"test\" | \"disconnect\",\n ) => {\n setInstallationAction(`${action}:${installation.id}`);\n try {\n await (action === \"test\"\n ? testManagedIntegrationInstallation(installation.id)\n : disconnectManagedIntegrationInstallation(installation.id));\n setInstallations(await listManagedIntegrationInstallations(\"slack\"));\n toast.success(\n action === \"test\"\n ? t(\"messaging.managed.connectionChecked\")\n : t(\"messaging.managed.workspaceDisconnected\"),\n );\n } catch (error) {\n toast.error(\n error instanceof Error\n ? error.message\n : t(\"messaging.managed.actionFailed\"),\n );\n } finally {\n setInstallationAction(null);\n }\n };\n\n const updateScopePolicy = async (\n scope: ClientIntegrationScope,\n policy: Partial<ClientIntegrationScope[\"policy\"]>,\n ) => {\n setSavingScope(scope.id);\n try {\n await saveManagedIntegrationScope({\n platform: scope.platform,\n tenantId: scope.tenantId,\n conversationId: scope.conversationId,\n conversationType: scope.conversationType,\n trust: scope.trust,\n orgId: scope.orgId,\n serviceOwnerEmail: scope.serviceOwnerEmail,\n defaultModel: scope.defaultModel,\n policy: { ...scope.policy, ...policy },\n });\n setScopes(await listManagedIntegrationScopes(\"slack\"));\n toast.success(t(\"messaging.managed.channelPolicyUpdated\"));\n } catch (error) {\n toast.error(\n error instanceof Error\n ? error.message\n : t(\"messaging.managed.policyUpdateFailed\"),\n );\n } finally {\n setSavingScope(null);\n }\n };\n\n const saveScopeBudget = async (scope: ClientIntegrationScope) => {\n const dollars = Number(scopeBudget[scope.id]);\n if (!Number.isFinite(dollars) || dollars <= 0) {\n toast.error(t(\"messaging.managed.positiveMonthlyBudget\"));\n return;\n }\n setSavingScope(`budget:${scope.id}`);\n try {\n await saveManagedIntegrationBudget({\n subject: {\n type: \"scope\",\n scope: {\n platform: scope.platform,\n tenantId: scope.tenantId,\n conversationId: scope.conversationId,\n },\n },\n period: \"month\",\n limitMicros: Math.round(dollars * 1_000_000),\n });\n setBudgets(await listManagedIntegrationBudgets());\n toast.success(t(\"messaging.managed.channelBudgetSaved\"));\n } catch (error) {\n toast.error(\n error instanceof Error\n ? error.message\n : t(\"messaging.managed.budgetSaveFailed\"),\n );\n } finally {\n setSavingScope(null);\n }\n };\n\n return (\n <div className=\"space-y-4\">\n <div className=\"grid gap-4 xl:grid-cols-2\">\n {CHANNELS.map((platform) => {\n const status = statusByPlatform.get(platform.id);\n const configured =\n !!status?.configured ||\n (platform.id === \"slack\" &&\n installations.some(\n (installation) => installation.status === \"connected\",\n ));\n const enabled = !!status?.enabled;\n const envKeys = platform.credentialRequirements;\n const primaryEnvKeys = envKeys.filter(\n (envKey) => envKey.key !== \"SLACK_BOT_TOKEN\",\n );\n const legacyEnvKeys = envKeys.filter(\n (envKey) => envKey.key === \"SLACK_BOT_TOKEN\",\n );\n const missingRequiredCredentials = hasMissingRequiredCredentials(\n envKeys,\n envStatusByKey,\n );\n const Icon = PLATFORM_ICONS[platform.iconKey] ?? IconPlug;\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 <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.name}\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\n href={platform.documentation.href}\n target=\"_blank\"\n rel=\"noreferrer\"\n >\n Docs\n <IconExternalLink className=\"ml-1 h-3 w-3\" />\n </a>\n </Button>\n {platform.documentation.externalHref ? (\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.documentation.externalHref}\n target=\"_blank\"\n rel=\"noreferrer\"\n >\n {platform.documentation.externalLabel ?? \"Open\"}\n <IconExternalLink className=\"ml-1 h-3 w-3\" />\n </a>\n </Button>\n ) : null}\n </div>\n </div>\n\n {platform.id === \"slack\" ? (\n <div className=\"mt-5 space-y-3 rounded-xl border bg-muted/20 p-4\">\n <div className=\"flex flex-wrap items-center justify-between gap-3\">\n <div>\n <div className=\"text-sm font-medium text-foreground\">\n {t(\"messaging.managed.title\")}\n </div>\n <p className=\"mt-1 text-xs text-muted-foreground\">\n {t(\"messaging.managed.description\")}\n </p>\n <p className=\"mt-1 text-xs text-muted-foreground\">\n {t(\"messaging.managed.agentManifestDescription\")}\n </p>\n </div>\n <div className=\"space-y-2\">\n <div className=\"flex flex-wrap items-center gap-2\">\n <Button asChild variant=\"outline\" size=\"sm\">\n <a href={managedSlackAgentManifestUrl()}>\n <IconFileDescription className=\"mr-2 h-4 w-4\" />\n {t(\"messaging.managed.agentManifest\")}\n </a>\n </Button>\n {missingRequiredCredentials ? (\n <Button size=\"sm\" disabled>\n <IconBrandSlack className=\"mr-2 h-4 w-4\" />\n {t(\"messaging.managed.addToSlack\")}\n </Button>\n ) : (\n <Button asChild size=\"sm\">\n <a href={managedIntegrationOAuthUrl(\"slack\")}>\n <IconBrandSlack className=\"mr-2 h-4 w-4\" />\n {t(\"messaging.managed.addToSlack\")}\n </a>\n </Button>\n )}\n </div>\n {missingRequiredCredentials ? (\n <p className=\"max-w-72 text-xs text-amber-700 dark:text-amber-300\">\n {t(\"messaging.managed.requiredCredentials\")}\n </p>\n ) : null}\n </div>\n </div>\n {installations.length ? (\n <div className=\"space-y-2\">\n {installations.map((installation) => (\n <div\n key={installation.id}\n className=\"flex flex-wrap items-center justify-between gap-3 rounded-lg border bg-background/60 px-3 py-2\"\n >\n <div>\n <div className=\"text-sm font-medium text-foreground\">\n {installation.teamName ||\n installation.enterpriseName ||\n installation.teamId ||\n t(\"messaging.managed.workspaceFallback\")}\n </div>\n <div className=\"mt-0.5 text-xs text-muted-foreground\">\n {t(\"messaging.managed.scopesUpdated\", {\n count: installation.scopes.length,\n date: formatDate(installation.updatedAt, {\n dateStyle: \"medium\",\n }),\n })}\n </div>\n </div>\n <div className=\"flex items-center gap-2\">\n <StatusPill\n tone={\n installation.health === \"healthy\"\n ? \"success\"\n : installation.health === \"degraded\" ||\n installation.health === \"revoked\"\n ? \"warning\"\n : \"neutral\"\n }\n label={t(\n `messaging.managed.health.${installation.health}`,\n )}\n />\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={() =>\n runInstallationAction(installation, \"test\")\n }\n disabled={\n installationAction === `test:${installation.id}`\n }\n >\n {t(\"messaging.managed.test\")}\n </Button>\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={() =>\n runInstallationAction(\n installation,\n \"disconnect\",\n )\n }\n disabled={\n installationAction ===\n `disconnect:${installation.id}`\n }\n >\n {t(\"messaging.managed.disconnect\")}\n </Button>\n </div>\n </div>\n ))}\n </div>\n ) : (\n <p className=\"text-xs text-muted-foreground\">\n {t(\"messaging.managed.empty\")}\n </p>\n )}\n </div>\n ) : null}\n\n {platform.id === \"slack\" && scopes.length ? (\n <div className=\"mt-4 space-y-3 rounded-xl border bg-muted/20 p-4\">\n <div>\n <div className=\"text-sm font-medium text-foreground\">\n {t(\"messaging.managed.channelAccessTitle\")}\n </div>\n <p className=\"mt-1 text-xs text-muted-foreground\">\n {t(\"messaging.managed.channelAccessDescription\")}\n </p>\n </div>\n {scopes.map((scope) => {\n const subjectId = JSON.stringify([\n scope.platform,\n scope.tenantId,\n scope.conversationId,\n ]);\n const budget = budgets.find(\n (item) =>\n item.subjectType === \"scope\" &&\n item.subjectId === subjectId &&\n item.period === \"month\",\n );\n return (\n <div\n key={scope.id}\n className=\"space-y-3 rounded-lg border bg-background/60 p-3\"\n >\n <div className=\"flex flex-wrap items-center justify-between gap-2\">\n <div>\n <div className=\"font-mono text-xs text-foreground\">\n {scope.conversationId}\n </div>\n <div className=\"mt-0.5 text-xs text-muted-foreground\">\n {t(\"messaging.managed.isolatedIdentity\", {\n trust: t(\n `messaging.managed.trust.${scope.trust}`,\n ),\n })}\n </div>\n </div>\n <StatusPill\n tone={\n scope.trust === \"trusted\" ? \"success\" : \"warning\"\n }\n label={t(`messaging.managed.trust.${scope.trust}`)}\n />\n </div>\n <div className=\"grid gap-2 sm:grid-cols-3\">\n {[\n [\n \"requireMention\",\n t(\"messaging.managed.requireMention\"),\n ],\n [\"allowGuests\", t(\"messaging.managed.allowGuests\")],\n [\n \"allowExternalShared\",\n t(\"messaging.managed.allowSlackConnect\"),\n ],\n ].map(([key, label]) => (\n <label\n key={key}\n className=\"flex items-center justify-between gap-2 rounded-md border px-2.5 py-2 text-xs\"\n >\n {label}\n <Switch\n checked={\n scope.policy[\n key as keyof ClientIntegrationScope[\"policy\"]\n ]\n }\n disabled={savingScope === scope.id}\n onCheckedChange={(checked) =>\n updateScopePolicy(scope, { [key]: checked })\n }\n />\n </label>\n ))}\n </div>\n <div className=\"flex flex-wrap items-end gap-2\">\n <div className=\"min-w-40 flex-1 space-y-1\">\n <label className=\"text-xs font-medium text-foreground\">\n {t(\"messaging.managed.monthlyBudgetUsd\")}\n </label>\n <Input\n inputMode=\"decimal\"\n value={\n scopeBudget[scope.id] ??\n (budget\n ? String(budget.limitMicros / 1_000_000)\n : \"\")\n }\n onChange={(event) =>\n setScopeBudget((current) => ({\n ...current,\n [scope.id]: event.target.value,\n }))\n }\n placeholder=\"25\"\n />\n </div>\n <Button\n variant=\"outline\"\n onClick={() => saveScopeBudget(scope)}\n disabled={savingScope === `budget:${scope.id}`}\n >\n {t(\"messaging.managed.saveBudget\")}\n </Button>\n </div>\n </div>\n );\n })}\n </div>\n ) : null}\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.setup.steps.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 {primaryEnvKeys.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=\"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 {legacyEnvKeys.length ? (\n <Collapsible>\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>{legacyEnvKeys[0]?.label}</span>\n </CollapsibleTrigger>\n <CollapsibleContent>\n <div className=\"mt-2 space-y-3 rounded-xl border border-amber-500/30 bg-amber-500/5 p-4\">\n <p className=\"text-xs text-muted-foreground\">\n {legacyEnvKeys[0]?.helpText}\n </p>\n {legacyEnvKeys.map((envKey) => {\n const envStatus = envStatusByKey.get(envKey.key);\n const isConfigured = !!envStatus?.configured;\n const helpText =\n envKey.helpText ?? envStatus?.helpText;\n const label =\n envKey.label || envStatus?.label || envKey.key;\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 </label>\n {helpText ? (\n <HelpTooltip content={helpText} />\n ) : null}\n </div>\n <StatusPill\n tone={isConfigured ? \"success\" : \"neutral\"}\n label={isConfigured ? \"Saved\" : \"Not set\"}\n />\n </div>\n {!isConfigured ? (\n <Input\n type=\"password\"\n value={envValues[envKey.key] || \"\"}\n onChange={(event) =>\n setEnvValues((current) => ({\n ...current,\n [envKey.key]: event.target.value,\n }))\n }\n placeholder={`Enter ${label}`}\n autoComplete=\"off\"\n />\n ) : null}\n </div>\n );\n })}\n {legacyEnvKeys.some(\n (envKey) =>\n !envStatusByKey.get(envKey.key)?.configured,\n ) ? (\n <Button\n variant=\"outline\"\n onClick={() =>\n saveEnvKeys(\n platform,\n legacyEnvKeys.map((envKey) => envKey.key),\n )\n }\n disabled={savingKeysFor === platform.id}\n >\n {savingKeysFor === platform.id\n ? \"Saving...\"\n : \"Save credentials\"}\n </Button>\n ) : null}\n </div>\n </CollapsibleContent>\n </Collapsible>\n ) : null}\n {missingRequiredCredentials ? (\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.name} 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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env-config.js","sourceRoot":"","sources":["../../../src/server/lib/env-config.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,OAAO,GAAmB;IACrC;QACE,GAAG,EAAE,iBAAiB;QACtB,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"env-config.js","sourceRoot":"","sources":["../../../src/server/lib/env-config.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,OAAO,GAAmB;IACrC;QACE,GAAG,EAAE,iBAAiB;QACtB,KAAK,EAAE,0BAA0B;QACjC,QAAQ,EAAE,KAAK;KAChB;IACD;QACE,GAAG,EAAE,iBAAiB;QACt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BAAuB;QAC5B,KAAK,EAAE,uBAAuB;QAC9B,QAAQ,EAAE,KAAK;KAChB;IACD;QACE,GAAG,EAAE,0BAA0B;QAC/B,KAAK,EAAE,0BAA0B;QACjC,QAAQ,EAAE,KAAK;KAChB;IACD;QACE,GAAG,EAAE,qBAAqB;QAC1B,KAAK,EAAE,qBAAqB;QAC5B,QAAQ,EAAE,KAAK;KAChB;IACD;QACE,GAAG,EAAE,eAAe;QACpB,KAAK,EAAE,eAAe;QACtB,QAAQ,EAAE,KAAK;KAChB;CACF,CAAC","sourcesContent":["import type { EnvKeyConfig } from \"@agent-native/core/server\";\n\nexport const envKeys: EnvKeyConfig[] = [\n {\n key: \"SLACK_BOT_TOKEN\",\n label: \"Slack bot token (legacy)\",\n required: false,\n },\n {\n key: \"SLACK_CLIENT_ID\",\n label: \"Slack OAuth client ID\",\n required: true,\n },\n {\n key: \"SLACK_CLIENT_SECRET\",\n label: \"Slack OAuth client secret\",\n required: true,\n },\n {\n key: \"SLACK_SIGNING_SECRET\",\n label: \"Slack signing secret\",\n required: true,\n },\n {\n key: \"TELEGRAM_BOT_TOKEN\",\n label: \"Telegram bot token\",\n required: true,\n },\n {\n key: \"TELEGRAM_WEBHOOK_SECRET\",\n label: \"Telegram webhook secret\",\n required: true,\n },\n {\n key: \"MICROSOFT_TEAMS_APP_ID\",\n label: \"Microsoft Bot app ID\",\n required: false,\n },\n {\n key: \"MICROSOFT_TEAMS_APP_PASSWORD\",\n label: \"Microsoft Bot client secret\",\n required: false,\n },\n {\n key: \"MICROSOFT_TEAMS_APP_TENANT_ID\",\n label: \"Microsoft Bot tenant ID\",\n required: false,\n },\n {\n key: \"MICROSOFT_TEAMS_ALLOWED_TENANT_IDS\",\n label: \"Allowed Microsoft Teams tenant IDs\",\n required: false,\n },\n {\n key: \"DISCORD_APPLICATION_ID\",\n label: \"Discord application ID\",\n required: false,\n },\n {\n key: \"DISCORD_PUBLIC_KEY\",\n label: \"Discord public key\",\n required: false,\n },\n {\n key: \"EMAIL_AGENT_ADDRESS\",\n label: \"Agent email address\",\n required: false,\n },\n {\n key: \"DISPATCH_DEFAULT_OWNER_EMAIL\",\n label: \"Default Slack owner email\",\n required: false,\n },\n {\n key: \"WHATSAPP_ACCESS_TOKEN\",\n label: \"WhatsApp access token\",\n required: false,\n },\n {\n key: \"WHATSAPP_VERIFY_TOKEN\",\n label: \"WhatsApp verify token\",\n required: false,\n },\n {\n key: \"WHATSAPP_PHONE_NUMBER_ID\",\n label: \"WhatsApp phone number ID\",\n required: false,\n },\n {\n key: \"WHATSAPP_APP_SECRET\",\n label: \"WhatsApp app secret\",\n required: false,\n },\n {\n key: \"PYLON_API_KEY\",\n label: \"Pylon API key\",\n required: false,\n },\n];\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-native/dispatch",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.2",
|
|
4
4
|
"description": "Dispatch — workspace control plane for agent-native apps. Vault, integrations, destinations, scheduled jobs, and cross-app delegation, shipped as a single drop-in package.",
|
|
5
5
|
"homepage": "https://github.com/BuilderIO/agent-native#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
"typescript-7": "npm:typescript@^7.0.2",
|
|
95
95
|
"vite": "8.1.0",
|
|
96
96
|
"vitest": "^4.1.5",
|
|
97
|
-
"@agent-native/core": "0.
|
|
97
|
+
"@agent-native/core": "0.95.1"
|
|
98
98
|
},
|
|
99
99
|
"peerDependencies": {
|
|
100
100
|
"@agent-native/core": ">=0.8.0",
|
|
@@ -59,7 +59,16 @@ vi.mock("@agent-native/core/integrations", () => ({
|
|
|
59
59
|
documentation: { href: "/docs/messaging#slack" },
|
|
60
60
|
setup: { steps: ["Create a Slack app."] },
|
|
61
61
|
credentialRequirements: [
|
|
62
|
-
{
|
|
62
|
+
{
|
|
63
|
+
key: "SLACK_BOT_TOKEN",
|
|
64
|
+
label: "Slack Bot Token (legacy)",
|
|
65
|
+
required: false,
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
key: "SLACK_CLIENT_ID",
|
|
69
|
+
label: "Slack OAuth Client ID",
|
|
70
|
+
required: true,
|
|
71
|
+
},
|
|
63
72
|
],
|
|
64
73
|
},
|
|
65
74
|
{
|
|
@@ -142,6 +151,7 @@ describe("MessagingSetupPanel", () => {
|
|
|
142
151
|
expect(container.textContent).toContain(
|
|
143
152
|
"Save the required Slack app credentials below",
|
|
144
153
|
);
|
|
154
|
+
expect(container.textContent).toContain("Slack Bot Token (legacy)");
|
|
145
155
|
});
|
|
146
156
|
|
|
147
157
|
it("shows connected and alternative credential states", async () => {
|
|
@@ -155,6 +165,12 @@ describe("MessagingSetupPanel", () => {
|
|
|
155
165
|
required: true,
|
|
156
166
|
configured: true,
|
|
157
167
|
},
|
|
168
|
+
{
|
|
169
|
+
key: "SLACK_CLIENT_ID",
|
|
170
|
+
label: "Slack OAuth Client ID",
|
|
171
|
+
required: true,
|
|
172
|
+
configured: true,
|
|
173
|
+
},
|
|
158
174
|
{
|
|
159
175
|
key: "RESEND_API_KEY",
|
|
160
176
|
label: "Resend API Key",
|
|
@@ -455,6 +455,12 @@ export function MessagingSetupPanel() {
|
|
|
455
455
|
));
|
|
456
456
|
const enabled = !!status?.enabled;
|
|
457
457
|
const envKeys = platform.credentialRequirements;
|
|
458
|
+
const primaryEnvKeys = envKeys.filter(
|
|
459
|
+
(envKey) => envKey.key !== "SLACK_BOT_TOKEN",
|
|
460
|
+
);
|
|
461
|
+
const legacyEnvKeys = envKeys.filter(
|
|
462
|
+
(envKey) => envKey.key === "SLACK_BOT_TOKEN",
|
|
463
|
+
);
|
|
458
464
|
const missingRequiredCredentials = hasMissingRequiredCredentials(
|
|
459
465
|
envKeys,
|
|
460
466
|
envStatusByKey,
|
|
@@ -789,7 +795,7 @@ export function MessagingSetupPanel() {
|
|
|
789
795
|
) : null}
|
|
790
796
|
</div>
|
|
791
797
|
<div className="space-y-3">
|
|
792
|
-
{
|
|
798
|
+
{primaryEnvKeys.map((envKey) => {
|
|
793
799
|
const envStatus = envStatusByKey.get(envKey.key);
|
|
794
800
|
const isConfigured = !!envStatus?.configured;
|
|
795
801
|
const helpText = envKey.helpText ?? envStatus?.helpText;
|
|
@@ -847,6 +853,80 @@ export function MessagingSetupPanel() {
|
|
|
847
853
|
);
|
|
848
854
|
})}
|
|
849
855
|
</div>
|
|
856
|
+
{legacyEnvKeys.length ? (
|
|
857
|
+
<Collapsible>
|
|
858
|
+
<CollapsibleTrigger className="group flex w-full cursor-pointer items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground">
|
|
859
|
+
<IconChevronRight className="h-3.5 w-3.5 transition-transform group-data-[state=open]:rotate-90" />
|
|
860
|
+
<span>{legacyEnvKeys[0]?.label}</span>
|
|
861
|
+
</CollapsibleTrigger>
|
|
862
|
+
<CollapsibleContent>
|
|
863
|
+
<div className="mt-2 space-y-3 rounded-xl border border-amber-500/30 bg-amber-500/5 p-4">
|
|
864
|
+
<p className="text-xs text-muted-foreground">
|
|
865
|
+
{legacyEnvKeys[0]?.helpText}
|
|
866
|
+
</p>
|
|
867
|
+
{legacyEnvKeys.map((envKey) => {
|
|
868
|
+
const envStatus = envStatusByKey.get(envKey.key);
|
|
869
|
+
const isConfigured = !!envStatus?.configured;
|
|
870
|
+
const helpText =
|
|
871
|
+
envKey.helpText ?? envStatus?.helpText;
|
|
872
|
+
const label =
|
|
873
|
+
envKey.label || envStatus?.label || envKey.key;
|
|
874
|
+
return (
|
|
875
|
+
<div key={envKey.key} className="space-y-1.5">
|
|
876
|
+
<div className="flex items-center justify-between gap-3">
|
|
877
|
+
<div className="flex items-center gap-1.5">
|
|
878
|
+
<label className="text-xs font-medium text-foreground">
|
|
879
|
+
{label}
|
|
880
|
+
</label>
|
|
881
|
+
{helpText ? (
|
|
882
|
+
<HelpTooltip content={helpText} />
|
|
883
|
+
) : null}
|
|
884
|
+
</div>
|
|
885
|
+
<StatusPill
|
|
886
|
+
tone={isConfigured ? "success" : "neutral"}
|
|
887
|
+
label={isConfigured ? "Saved" : "Not set"}
|
|
888
|
+
/>
|
|
889
|
+
</div>
|
|
890
|
+
{!isConfigured ? (
|
|
891
|
+
<Input
|
|
892
|
+
type="password"
|
|
893
|
+
value={envValues[envKey.key] || ""}
|
|
894
|
+
onChange={(event) =>
|
|
895
|
+
setEnvValues((current) => ({
|
|
896
|
+
...current,
|
|
897
|
+
[envKey.key]: event.target.value,
|
|
898
|
+
}))
|
|
899
|
+
}
|
|
900
|
+
placeholder={`Enter ${label}`}
|
|
901
|
+
autoComplete="off"
|
|
902
|
+
/>
|
|
903
|
+
) : null}
|
|
904
|
+
</div>
|
|
905
|
+
);
|
|
906
|
+
})}
|
|
907
|
+
{legacyEnvKeys.some(
|
|
908
|
+
(envKey) =>
|
|
909
|
+
!envStatusByKey.get(envKey.key)?.configured,
|
|
910
|
+
) ? (
|
|
911
|
+
<Button
|
|
912
|
+
variant="outline"
|
|
913
|
+
onClick={() =>
|
|
914
|
+
saveEnvKeys(
|
|
915
|
+
platform,
|
|
916
|
+
legacyEnvKeys.map((envKey) => envKey.key),
|
|
917
|
+
)
|
|
918
|
+
}
|
|
919
|
+
disabled={savingKeysFor === platform.id}
|
|
920
|
+
>
|
|
921
|
+
{savingKeysFor === platform.id
|
|
922
|
+
? "Saving..."
|
|
923
|
+
: "Save credentials"}
|
|
924
|
+
</Button>
|
|
925
|
+
) : null}
|
|
926
|
+
</div>
|
|
927
|
+
</CollapsibleContent>
|
|
928
|
+
</Collapsible>
|
|
929
|
+
) : null}
|
|
850
930
|
{missingRequiredCredentials ? (
|
|
851
931
|
<Button
|
|
852
932
|
variant="outline"
|