@agent-native/core 0.12.36 → 0.12.37
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/agent/engine/credential-errors.d.ts +1 -1
- package/dist/agent/engine/credential-errors.d.ts.map +1 -1
- package/dist/agent/engine/credential-errors.js +2 -2
- package/dist/agent/engine/credential-errors.js.map +1 -1
- package/dist/cli/workspace-dev.d.ts.map +1 -1
- package/dist/cli/workspace-dev.js +1 -0
- package/dist/cli/workspace-dev.js.map +1 -1
- package/dist/client/AgentPanel.d.ts.map +1 -1
- package/dist/client/AgentPanel.js +4 -4
- package/dist/client/AgentPanel.js.map +1 -1
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +252 -229
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/ConnectBuilderCard.d.ts.map +1 -1
- package/dist/client/ConnectBuilderCard.js +4 -3
- package/dist/client/ConnectBuilderCard.js.map +1 -1
- package/dist/client/frame.d.ts.map +1 -1
- package/dist/client/frame.js +25 -9
- package/dist/client/frame.js.map +1 -1
- package/dist/client/integrations/IntegrationsPanel.d.ts.map +1 -1
- package/dist/client/integrations/IntegrationsPanel.js +28 -2
- package/dist/client/integrations/IntegrationsPanel.js.map +1 -1
- package/dist/client/settings/SettingsPanel.d.ts.map +1 -1
- package/dist/client/settings/SettingsPanel.js +13 -1
- package/dist/client/settings/SettingsPanel.js.map +1 -1
- package/dist/client/settings/useBuilderStatus.d.ts.map +1 -1
- package/dist/client/settings/useBuilderStatus.js +4 -0
- package/dist/client/settings/useBuilderStatus.js.map +1 -1
- package/dist/client/sse-event-processor.js +1 -1
- package/dist/client/sse-event-processor.js.map +1 -1
- package/dist/db/client.d.ts +6 -0
- package/dist/db/client.d.ts.map +1 -1
- package/dist/db/client.js +50 -25
- package/dist/db/client.js.map +1 -1
- package/dist/db/index.d.ts +1 -1
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/index.js +1 -1
- package/dist/db/index.js.map +1 -1
- package/dist/deploy/workspace-deploy.js +7 -0
- package/dist/deploy/workspace-deploy.js.map +1 -1
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +7 -1
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/google-oauth.d.ts +8 -7
- package/dist/server/google-oauth.d.ts.map +1 -1
- package/dist/server/google-oauth.js +56 -54
- package/dist/server/google-oauth.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectBuilderCard.d.ts","sourceRoot":"","sources":["../../src/client/ConnectBuilderCard.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ConnectBuilderCard.d.ts","sourceRoot":"","sources":["../../src/client/ConnectBuilderCard.tsx"],"names":[],"mappings":"AAUA,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB;6EACyE;IACzE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AASD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,UAAU,EAAE,iBAAiB,EAC7B,cAAc,EAAE,qBAA4B,EAC5C,UAAU,EAAE,iBAAiB,EAC7B,OAAO,EAAE,cAAc,EACvB,MAAW,GACZ,EAAE,uBAAuB,2CAsSzB"}
|
|
@@ -6,6 +6,7 @@ import { useBuilderConnectFlow } from "./settings/useBuilderStatus.js";
|
|
|
6
6
|
import { BuilderBMark } from "./builder-mark.js";
|
|
7
7
|
import { cn } from "./utils.js";
|
|
8
8
|
import { agentNativePath } from "./api-path.js";
|
|
9
|
+
const DESKTOP_DOWNLOAD_URL = "https://agent-native.com/download";
|
|
9
10
|
/**
|
|
10
11
|
* Rich inline card rendered for the `connect-builder` tool call. Shows a
|
|
11
12
|
* prominent Connect button that opens the Builder CLI auth flow and polls
|
|
@@ -115,8 +116,8 @@ export function ConnectBuilderCard({ configured: initialConfigured, builderEnabl
|
|
|
115
116
|
else if (showWaitlist) {
|
|
116
117
|
title = waitlistJoined
|
|
117
118
|
? "You're on the waitlist"
|
|
118
|
-
: "
|
|
119
|
-
subtitle = waitlistJoined ? (_jsx(_Fragment, { children: "We'll let you know
|
|
119
|
+
: "Cloud code changes unavailable";
|
|
120
|
+
subtitle = waitlistJoined ? (_jsx(_Fragment, { children: "We'll let you know when Builder branch creation is available. You can still use Desktop or a local clone for code changes." })) : (_jsx(_Fragment, { children: "This workspace can't create Builder branches yet. Use Desktop or a local clone for code changes now, or join the waitlist for cloud branches." }));
|
|
120
121
|
}
|
|
121
122
|
else if (canSend) {
|
|
122
123
|
title = "Send this to Builder";
|
|
@@ -130,6 +131,6 @@ export function ConnectBuilderCard({ configured: initialConfigured, builderEnabl
|
|
|
130
131
|
title = "Connect Builder.io";
|
|
131
132
|
subtitle = (_jsx(_Fragment, { children: "One click to spin up a cloud code sandbox \u2014 Builder writes the changes for you, no local setup needed." }));
|
|
132
133
|
}
|
|
133
|
-
return (_jsx("div", { className: cn("my-2 rounded-lg border border-border overflow-hidden"), children: _jsxs("div", { className: "flex items-start gap-3 px-4 py-3.5 bg-gradient-to-br from-teal-500/5 via-transparent to-transparent", children: [_jsx("div", { className: cn("flex h-9 w-9 shrink-0 items-center justify-center rounded-lg", "bg-foreground text-background"), children: runResult ? (_jsx(IconLoader2, { className: "h-5 w-5 animate-spin" })) : (_jsx(BuilderBMark, { className: "h-5 w-5" })) }), _jsxs("div", { className: "flex-1 min-w-0", children: [_jsx("div", { className: "flex items-center gap-2 flex-wrap", children: _jsx("span", { className: "text-sm font-semibold text-foreground", children: title }) }), _jsx("div", { className: "mt-0.5 text-xs text-muted-foreground leading-relaxed", children: subtitle }), err && _jsx("div", { className: "mt-2 text-xs text-destructive", children: err }), _jsx("div", { className: "mt-3", children: runResult ? (_jsxs("a", { href: runResult.url, target: "_blank", rel: "noopener noreferrer", className: cn("inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-colors", "bg-foreground text-background hover:bg-foreground/90"), children: ["Open branch in Builder", _jsx(IconExternalLink, { className: "h-3.5 w-3.5" })] })) : canSend ? (_jsx("button", { type: "button", onClick: handleSend, disabled: sending, className: cn("inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-colors", "bg-foreground text-background hover:bg-foreground/90", sending && "opacity-70 cursor-wait"), children: sending ? (_jsxs(_Fragment, { children: [_jsx(IconLoader2, { className: "h-3.5 w-3.5 animate-spin" }), "Sending to Builder\u2026"] })) : (_jsx(_Fragment, { children: "Send to Builder" })) })) : showWaitlist && !waitlistJoined ? (_jsx("button", { type: "button", onClick: handleJoinWaitlist, disabled: joiningWaitlist, className: cn("inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-colors", "bg-foreground text-background hover:bg-foreground/90", joiningWaitlist && "opacity-70 cursor-wait"), children: joiningWaitlist ? (_jsxs(_Fragment, { children: [_jsx(IconLoader2, { className: "h-3.5 w-3.5 animate-spin" }), "Joining\u2026"] })) : (_jsx(_Fragment, { children: "Join the waitlist" })) })) : !configured ? (_jsx("button", { type: "button", onClick: flow.start, disabled: connecting, className: cn("inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-colors", "bg-foreground text-background hover:bg-foreground/90", connecting && "opacity-70 cursor-wait"), children: connecting ? (_jsxs(_Fragment, { children: [_jsx(IconLoader2, { className: "h-3.5 w-3.5 animate-spin" }), "Waiting for Builder\u2026"] })) : (_jsxs(_Fragment, { children: ["Connect Builder", _jsx(IconExternalLink, { className: "h-3.5 w-3.5" })] })) })) : null })] })] }) }));
|
|
134
|
+
return (_jsx("div", { className: cn("my-2 rounded-lg border border-border overflow-hidden"), children: _jsxs("div", { className: "flex items-start gap-3 px-4 py-3.5 bg-gradient-to-br from-teal-500/5 via-transparent to-transparent", children: [_jsx("div", { className: cn("flex h-9 w-9 shrink-0 items-center justify-center rounded-lg", "bg-foreground text-background"), children: runResult ? (_jsx(IconLoader2, { className: "h-5 w-5 animate-spin" })) : (_jsx(BuilderBMark, { className: "h-5 w-5" })) }), _jsxs("div", { className: "flex-1 min-w-0", children: [_jsx("div", { className: "flex items-center gap-2 flex-wrap", children: _jsx("span", { className: "text-sm font-semibold text-foreground", children: title }) }), _jsx("div", { className: "mt-0.5 text-xs text-muted-foreground leading-relaxed", children: subtitle }), showWaitlist && (_jsxs("a", { href: DESKTOP_DOWNLOAD_URL, target: "_blank", rel: "noopener noreferrer", className: "mt-2 inline-flex items-center gap-1 text-[11px] font-medium text-muted-foreground no-underline hover:text-foreground", children: ["Download Desktop", _jsx(IconExternalLink, { className: "h-3 w-3" })] })), err && _jsx("div", { className: "mt-2 text-xs text-destructive", children: err }), _jsx("div", { className: "mt-3", children: runResult ? (_jsxs("a", { href: runResult.url, target: "_blank", rel: "noopener noreferrer", className: cn("inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-colors", "bg-foreground text-background hover:bg-foreground/90"), children: ["Open branch in Builder", _jsx(IconExternalLink, { className: "h-3.5 w-3.5" })] })) : canSend ? (_jsx("button", { type: "button", onClick: handleSend, disabled: sending, className: cn("inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-colors", "bg-foreground text-background hover:bg-foreground/90", sending && "opacity-70 cursor-wait"), children: sending ? (_jsxs(_Fragment, { children: [_jsx(IconLoader2, { className: "h-3.5 w-3.5 animate-spin" }), "Sending to Builder\u2026"] })) : (_jsx(_Fragment, { children: "Send to Builder" })) })) : showWaitlist && !waitlistJoined ? (_jsx("button", { type: "button", onClick: handleJoinWaitlist, disabled: joiningWaitlist, className: cn("inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-colors", "bg-foreground text-background hover:bg-foreground/90", joiningWaitlist && "opacity-70 cursor-wait"), children: joiningWaitlist ? (_jsxs(_Fragment, { children: [_jsx(IconLoader2, { className: "h-3.5 w-3.5 animate-spin" }), "Joining\u2026"] })) : (_jsx(_Fragment, { children: "Join the waitlist" })) })) : !configured ? (_jsx("button", { type: "button", onClick: flow.start, disabled: connecting, className: cn("inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-colors", "bg-foreground text-background hover:bg-foreground/90", connecting && "opacity-70 cursor-wait"), children: connecting ? (_jsxs(_Fragment, { children: [_jsx(IconLoader2, { className: "h-3.5 w-3.5 animate-spin" }), "Waiting for Builder\u2026"] })) : (_jsxs(_Fragment, { children: ["Connect Builder", _jsx(IconExternalLink, { className: "h-3.5 w-3.5" })] })) })) : null })] })] }) }));
|
|
134
135
|
}
|
|
135
136
|
//# sourceMappingURL=ConnectBuilderCard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectBuilderCard.js","sourceRoot":"","sources":["../../src/client/ConnectBuilderCard.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAwBhD;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,EACjC,UAAU,EAAE,iBAAiB,EAC7B,cAAc,EAAE,qBAAqB,GAAG,IAAI,EAC5C,UAAU,EAAE,iBAAiB,EAC7B,OAAO,EAAE,cAAc,EACvB,MAAM,GAAG,EAAE,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X,+FAA+F,EAC/F,sDAAsD,EACtD,OAAO,IAAI,wBAAwB,CACpC,YAEA,OAAO,CAAC,CAAC,CAAC,CACT,8BACE,KAAC,WAAW,IAAC,SAAS,EAAC,0BAA0B,GAAG,gCAEnD,CACJ,CAAC,CAAC,CAAC,CACF,gDAAoB,CACrB,GACM,CACV,CAAC,CAAC,CAAC,YAAY,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CACpC,iBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,kBAAkB,EAC3B,QAAQ,EAAE,eAAe,EACzB,SAAS,EAAE,EAAE,CACX,+FAA+F,EAC/F,sDAAsD,EACtD,eAAe,IAAI,wBAAwB,CAC5C,YAEA,eAAe,CAAC,CAAC,CAAC,CACjB,8BACE,KAAC,WAAW,IAAC,SAAS,EAAC,0BAA0B,GAAG,qBAEnD,CACJ,CAAC,CAAC,CAAC,CACF,kDAAsB,CACvB,GACM,CACV,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAChB,iBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,IAAI,CAAC,KAAK,EACnB,QAAQ,EAAE,UAAU,EACpB,SAAS,EAAE,EAAE,CACX,+FAA+F,EAC/F,sDAAsD,EACtD,UAAU,IAAI,wBAAwB,CACvC,YAEA,UAAU,CAAC,CAAC,CAAC,CACZ,8BACE,KAAC,WAAW,IAAC,SAAS,EAAC,0BAA0B,GAAG,iCAEnD,CACJ,CAAC,CAAC,CAAC,CACF,iDAEE,KAAC,gBAAgB,IAAC,SAAS,EAAC,aAAa,GAAG,IAC3C,CACJ,GACM,CACV,CAAC,CAAC,CAAC,IAAI,GACJ,IACF,IACF,GACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["import React, { useCallback, useEffect, useRef, useState } from \"react\";\nimport { IconExternalLink, IconLoader2 } from \"@tabler/icons-react\";\nimport { getCallbackOrigin } from \"./frame.js\";\nimport { useBuilderConnectFlow } from \"./settings/useBuilderStatus.js\";\nimport { BuilderBMark } from \"./builder-mark.js\";\nimport { cn } from \"./utils.js\";\nimport { agentNativePath } from \"./api-path.js\";\n\nexport interface ConnectBuilderCardProps {\n configured: boolean;\n /**\n * True when the server has a Builder branch project configured for this\n * request. When false, the card shows a waitlist CTA instead of a Send\n * button — the /builder/run endpoint would 403 anyway.\n */\n builderEnabled?: boolean;\n connectUrl: string;\n orgName?: string | null;\n /** The user's feature/change request, forwarded to Builder's cloud agent\n * when they click Send. Empty for generic \"connect Builder\" prompts. */\n prompt?: string;\n}\n\ninterface BuilderRunResult {\n branchName: string;\n projectId: string;\n url: string;\n status: string;\n}\n\n/**\n * Rich inline card rendered for the `connect-builder` tool call. Shows a\n * prominent Connect button that opens the Builder CLI auth flow and polls\n * /_agent-native/builder/status until credentials land.\n */\nexport function ConnectBuilderCard({\n configured: initialConfigured,\n builderEnabled: initialBuilderEnabled = true,\n connectUrl: initialConnectUrl,\n orgName: initialOrgName,\n prompt = \"\",\n}: ConnectBuilderCardProps) {\n // The connect-poll state machine is shared — the tool-call result is\n // frozen at render time, so the hook's mount-time fetch + focus refresh\n // is what catches a flow the user completed in another tab.\n const flow = useBuilderConnectFlow({ popupUrl: initialConnectUrl });\n // Only use the server-rendered props until the hook's first status\n // fetch returns. After that, the hook is authoritative — including for\n // the disconnect case (where `flow.configured` flips back to `false`\n // even though `initialConfigured` was `true` at render time).\n const configured = flow.hasFetchedStatus\n ? flow.configured\n : initialConfigured;\n const builderEnabled = flow.hasFetchedStatus\n ? flow.builderEnabled\n : initialBuilderEnabled;\n const orgName = flow.hasFetchedStatus\n ? flow.orgName\n : (initialOrgName ?? null);\n const connecting = flow.connecting;\n\n const [waitlistJoined, setWaitlistJoined] = useState(false);\n const [joiningWaitlist, setJoiningWaitlist] = useState(false);\n const [waitlistErr, setWaitlistErr] = useState<string | null>(null);\n\n const [sending, setSending] = useState(false);\n const [runResult, setRunResult] = useState<BuilderRunResult | null>(null);\n const [sendErr, setSendErr] = useState<string | null>(null);\n const mountedRef = useRef(true);\n\n useEffect(() => {\n mountedRef.current = true;\n return () => {\n mountedRef.current = false;\n };\n }, []);\n\n const handleSend = useCallback(async () => {\n if (!prompt.trim()) return;\n setSending(true);\n setSendErr(null);\n try {\n const origin = getCallbackOrigin() || window.location.origin;\n const res = await fetch(\n new URL(agentNativePath(\"/_agent-native/builder/run\"), origin).href,\n {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ prompt }),\n },\n );\n const data = await res.json().catch(() => ({}));\n if (!res.ok) {\n throw new Error(\n typeof data?.error === \"string\"\n ? data.error\n : `Request failed (${res.status})`,\n );\n }\n if (!mountedRef.current) return;\n setRunResult(data as BuilderRunResult);\n setSending(false);\n } catch (e) {\n if (!mountedRef.current) return;\n setSendErr(e instanceof Error ? e.message : \"Send failed\");\n setSending(false);\n }\n }, [prompt]);\n\n const handleJoinWaitlist = useCallback(async () => {\n setJoiningWaitlist(true);\n setWaitlistErr(null);\n try {\n const origin = getCallbackOrigin() || window.location.origin;\n const res = await fetch(\n new URL(\n agentNativePath(\"/_agent-native/builder/branch-waitlist\"),\n origin,\n ).href,\n { method: \"POST\" },\n );\n if (!res.ok) {\n const data = await res.json().catch(() => ({}));\n throw new Error(\n typeof data?.error === \"string\"\n ? data.error\n : `Request failed (${res.status})`,\n );\n }\n if (!mountedRef.current) return;\n setWaitlistJoined(true);\n setJoiningWaitlist(false);\n } catch (e) {\n if (!mountedRef.current) return;\n setWaitlistErr(e instanceof Error ? e.message : \"Couldn't join waitlist\");\n setJoiningWaitlist(false);\n }\n }, []);\n\n // Combine connect-flow errors, send errors, and waitlist errors.\n const err = sendErr ?? waitlistErr ?? flow.error;\n\n const hasPrompt = prompt.trim().length > 0;\n const canSend = configured && builderEnabled && hasPrompt;\n // Branch creation is gated by a server-side project id, which may come\n // from deployment config or org-scoped secrets.\n const showWaitlist = !builderEnabled && hasPrompt;\n\n // Title + subtitle depend on which mode we're in. We compute them up front\n // so the render tree below stays flat.\n let title: string;\n let subtitle: React.ReactNode;\n if (runResult) {\n title = \"Builder is working on it\";\n subtitle = (\n <>\n Working on branch{\" \"}\n <span className=\"font-mono text-foreground\">\n {runResult.branchName}\n </span>\n . Click through to watch progress in the Visual Editor.\n </>\n );\n } else if (showWaitlist) {\n title = waitlistJoined\n ? \"You're on the waitlist\"\n : \"Builder branches unavailable\";\n subtitle = waitlistJoined ? (\n <>We'll let you know as soon as cloud branch creation is available.</>\n ) : (\n <>\n Cloud branch creation isn't available for this organization yet. Join\n the waitlist and we'll let you know when it's ready.\n </>\n );\n } else if (canSend) {\n title = \"Send this to Builder\";\n subtitle = (\n <>\n Builder's cloud coding agent will make this code change on a fresh\n branch.\n </>\n );\n } else if (configured) {\n title = \"Builder.io connected\";\n subtitle = flow.envManaged ? (\n <>\n Managed by this deployment — every user of this app uses the same\n Builder identity. LLM access, browser automation, and more are ready to\n use.\n </>\n ) : orgName ? (\n <>\n Connected to{\" \"}\n <span className=\"font-medium text-foreground\">{orgName}</span>. LLM\n access, browser automation, and more are ready to use.\n </>\n ) : (\n <>LLM access, browser automation, and more are ready to use.</>\n );\n } else {\n title = \"Connect Builder.io\";\n subtitle = (\n <>\n One click to spin up a cloud code sandbox — Builder writes the changes\n for you, no local setup needed.\n </>\n );\n }\n\n return (\n <div className={cn(\"my-2 rounded-lg border border-border overflow-hidden\")}>\n <div className=\"flex items-start gap-3 px-4 py-3.5 bg-gradient-to-br from-teal-500/5 via-transparent to-transparent\">\n <div\n className={cn(\n \"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg\",\n \"bg-foreground text-background\",\n )}\n >\n {runResult ? (\n <IconLoader2 className=\"h-5 w-5 animate-spin\" />\n ) : (\n <BuilderBMark className=\"h-5 w-5\" />\n )}\n </div>\n <div className=\"flex-1 min-w-0\">\n <div className=\"flex items-center gap-2 flex-wrap\">\n <span className=\"text-sm font-semibold text-foreground\">\n {title}\n </span>\n </div>\n <div className=\"mt-0.5 text-xs text-muted-foreground leading-relaxed\">\n {subtitle}\n </div>\n\n {err && <div className=\"mt-2 text-xs text-destructive\">{err}</div>}\n\n <div className=\"mt-3\">\n {runResult ? (\n <a\n href={runResult.url}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className={cn(\n \"inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-colors\",\n \"bg-foreground text-background hover:bg-foreground/90\",\n )}\n >\n Open branch in Builder\n <IconExternalLink className=\"h-3.5 w-3.5\" />\n </a>\n ) : canSend ? (\n <button\n type=\"button\"\n onClick={handleSend}\n disabled={sending}\n className={cn(\n \"inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-colors\",\n \"bg-foreground text-background hover:bg-foreground/90\",\n sending && \"opacity-70 cursor-wait\",\n )}\n >\n {sending ? (\n <>\n <IconLoader2 className=\"h-3.5 w-3.5 animate-spin\" />\n Sending to Builder…\n </>\n ) : (\n <>Send to Builder</>\n )}\n </button>\n ) : showWaitlist && !waitlistJoined ? (\n <button\n type=\"button\"\n onClick={handleJoinWaitlist}\n disabled={joiningWaitlist}\n className={cn(\n \"inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-colors\",\n \"bg-foreground text-background hover:bg-foreground/90\",\n joiningWaitlist && \"opacity-70 cursor-wait\",\n )}\n >\n {joiningWaitlist ? (\n <>\n <IconLoader2 className=\"h-3.5 w-3.5 animate-spin\" />\n Joining…\n </>\n ) : (\n <>Join the waitlist</>\n )}\n </button>\n ) : !configured ? (\n <button\n type=\"button\"\n onClick={flow.start}\n disabled={connecting}\n className={cn(\n \"inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-colors\",\n \"bg-foreground text-background hover:bg-foreground/90\",\n connecting && \"opacity-70 cursor-wait\",\n )}\n >\n {connecting ? (\n <>\n <IconLoader2 className=\"h-3.5 w-3.5 animate-spin\" />\n Waiting for Builder…\n </>\n ) : (\n <>\n Connect Builder\n <IconExternalLink className=\"h-3.5 w-3.5\" />\n </>\n )}\n </button>\n ) : null}\n </div>\n </div>\n </div>\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ConnectBuilderCard.js","sourceRoot":"","sources":["../../src/client/ConnectBuilderCard.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,MAAM,oBAAoB,GAAG,mCAAmC,CAAC;AAwBjE;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,EACjC,UAAU,EAAE,iBAAiB,EAC7B,cAAc,EAAE,qBAAqB,GAAG,IAAI,EAC5C,UAAU,EAAE,iBAAiB,EAC7B,OAAO,EAAE,cAAc,EACvB,MAAM,GAAG,EAAE,GACa;IACxB,qEAAqE;IACrE,wEAAwE;IACxE,4DAA4D;IAC5D,MAAM,IAAI,GAAG,qBAAqB,CAAC,EAAE,QAAQ,EAAE,iBAAiB,EAAE,CAAC,CAAC;IACpE,mEAAmE;IACnE,uEAAuE;IACvE,qEAAqE;IACrE,8DAA8D;IAC9D,MAAM,UAAU,GAAG,IAAI,CAAC,gBAAgB;QACtC,CAAC,CAAC,IAAI,CAAC,UAAU;QACjB,CAAC,CAAC,iBAAiB,CAAC;IACtB,MAAM,cAAc,GAAG,IAAI,CAAC,gBAAgB;QAC1C,CAAC,CAAC,IAAI,CAAC,cAAc;QACrB,CAAC,CAAC,qBAAqB,CAAC;IAC1B,MAAM,OAAO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AAC,CAAC,CAAC,CACpC,iBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,kBAAkB,EAC3B,QAAQ,EAAE,eAAe,EACzB,SAAS,EAAE,EAAE,CACX,+FAA+F,EAC/F,sDAAsD,EACtD,eAAe,IAAI,wBAAwB,CAC5C,YAEA,eAAe,CAAC,CAAC,CAAC,CACjB,8BACE,KAAC,WAAW,IAAC,SAAS,EAAC,0BAA0B,GAAG,qBAEnD,CACJ,CAAC,CAAC,CAAC,CACF,kDAAsB,CACvB,GACM,CACV,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAChB,iBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,IAAI,CAAC,KAAK,EACnB,QAAQ,EAAE,UAAU,EACpB,SAAS,EAAE,EAAE,CACX,+FAA+F,EAC/F,sDAAsD,EACtD,UAAU,IAAI,wBAAwB,CACvC,YAEA,UAAU,CAAC,CAAC,CAAC,CACZ,8BACE,KAAC,WAAW,IAAC,SAAS,EAAC,0BAA0B,GAAG,iCAEnD,CACJ,CAAC,CAAC,CAAC,CACF,iDAEE,KAAC,gBAAgB,IAAC,SAAS,EAAC,aAAa,GAAG,IAC3C,CACJ,GACM,CACV,CAAC,CAAC,CAAC,IAAI,GACJ,IACF,IACF,GACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["import React, { useCallback, useEffect, useRef, useState } from \"react\";\nimport { IconExternalLink, IconLoader2 } from \"@tabler/icons-react\";\nimport { getCallbackOrigin } from \"./frame.js\";\nimport { useBuilderConnectFlow } from \"./settings/useBuilderStatus.js\";\nimport { BuilderBMark } from \"./builder-mark.js\";\nimport { cn } from \"./utils.js\";\nimport { agentNativePath } from \"./api-path.js\";\n\nconst DESKTOP_DOWNLOAD_URL = \"https://agent-native.com/download\";\n\nexport interface ConnectBuilderCardProps {\n configured: boolean;\n /**\n * True when the server has a Builder branch project configured for this\n * request. When false, the card shows a waitlist CTA instead of a Send\n * button — the /builder/run endpoint would 403 anyway.\n */\n builderEnabled?: boolean;\n connectUrl: string;\n orgName?: string | null;\n /** The user's feature/change request, forwarded to Builder's cloud agent\n * when they click Send. Empty for generic \"connect Builder\" prompts. */\n prompt?: string;\n}\n\ninterface BuilderRunResult {\n branchName: string;\n projectId: string;\n url: string;\n status: string;\n}\n\n/**\n * Rich inline card rendered for the `connect-builder` tool call. Shows a\n * prominent Connect button that opens the Builder CLI auth flow and polls\n * /_agent-native/builder/status until credentials land.\n */\nexport function ConnectBuilderCard({\n configured: initialConfigured,\n builderEnabled: initialBuilderEnabled = true,\n connectUrl: initialConnectUrl,\n orgName: initialOrgName,\n prompt = \"\",\n}: ConnectBuilderCardProps) {\n // The connect-poll state machine is shared — the tool-call result is\n // frozen at render time, so the hook's mount-time fetch + focus refresh\n // is what catches a flow the user completed in another tab.\n const flow = useBuilderConnectFlow({ popupUrl: initialConnectUrl });\n // Only use the server-rendered props until the hook's first status\n // fetch returns. After that, the hook is authoritative — including for\n // the disconnect case (where `flow.configured` flips back to `false`\n // even though `initialConfigured` was `true` at render time).\n const configured = flow.hasFetchedStatus\n ? flow.configured\n : initialConfigured;\n const builderEnabled = flow.hasFetchedStatus\n ? flow.builderEnabled\n : initialBuilderEnabled;\n const orgName = flow.hasFetchedStatus\n ? flow.orgName\n : (initialOrgName ?? null);\n const connecting = flow.connecting;\n\n const [waitlistJoined, setWaitlistJoined] = useState(false);\n const [joiningWaitlist, setJoiningWaitlist] = useState(false);\n const [waitlistErr, setWaitlistErr] = useState<string | null>(null);\n\n const [sending, setSending] = useState(false);\n const [runResult, setRunResult] = useState<BuilderRunResult | null>(null);\n const [sendErr, setSendErr] = useState<string | null>(null);\n const mountedRef = useRef(true);\n\n useEffect(() => {\n mountedRef.current = true;\n return () => {\n mountedRef.current = false;\n };\n }, []);\n\n const handleSend = useCallback(async () => {\n if (!prompt.trim()) return;\n setSending(true);\n setSendErr(null);\n try {\n const origin = getCallbackOrigin() || window.location.origin;\n const res = await fetch(\n new URL(agentNativePath(\"/_agent-native/builder/run\"), origin).href,\n {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ prompt }),\n },\n );\n const data = await res.json().catch(() => ({}));\n if (!res.ok) {\n throw new Error(\n typeof data?.error === \"string\"\n ? data.error\n : `Request failed (${res.status})`,\n );\n }\n if (!mountedRef.current) return;\n setRunResult(data as BuilderRunResult);\n setSending(false);\n } catch (e) {\n if (!mountedRef.current) return;\n setSendErr(e instanceof Error ? e.message : \"Send failed\");\n setSending(false);\n }\n }, [prompt]);\n\n const handleJoinWaitlist = useCallback(async () => {\n setJoiningWaitlist(true);\n setWaitlistErr(null);\n try {\n const origin = getCallbackOrigin() || window.location.origin;\n const res = await fetch(\n new URL(\n agentNativePath(\"/_agent-native/builder/branch-waitlist\"),\n origin,\n ).href,\n { method: \"POST\" },\n );\n if (!res.ok) {\n const data = await res.json().catch(() => ({}));\n throw new Error(\n typeof data?.error === \"string\"\n ? data.error\n : `Request failed (${res.status})`,\n );\n }\n if (!mountedRef.current) return;\n setWaitlistJoined(true);\n setJoiningWaitlist(false);\n } catch (e) {\n if (!mountedRef.current) return;\n setWaitlistErr(e instanceof Error ? e.message : \"Couldn't join waitlist\");\n setJoiningWaitlist(false);\n }\n }, []);\n\n // Combine connect-flow errors, send errors, and waitlist errors.\n const err = sendErr ?? waitlistErr ?? flow.error;\n\n const hasPrompt = prompt.trim().length > 0;\n const canSend = configured && builderEnabled && hasPrompt;\n // Branch creation is gated by a server-side project id, which may come\n // from deployment config or org-scoped secrets.\n const showWaitlist = !builderEnabled && hasPrompt;\n\n // Title + subtitle depend on which mode we're in. We compute them up front\n // so the render tree below stays flat.\n let title: string;\n let subtitle: React.ReactNode;\n if (runResult) {\n title = \"Builder is working on it\";\n subtitle = (\n <>\n Working on branch{\" \"}\n <span className=\"font-mono text-foreground\">\n {runResult.branchName}\n </span>\n . Click through to watch progress in the Visual Editor.\n </>\n );\n } else if (showWaitlist) {\n title = waitlistJoined\n ? \"You're on the waitlist\"\n : \"Cloud code changes unavailable\";\n subtitle = waitlistJoined ? (\n <>\n We'll let you know when Builder branch creation is available. You can\n still use Desktop or a local clone for code changes.\n </>\n ) : (\n <>\n This workspace can't create Builder branches yet. Use Desktop or a local\n clone for code changes now, or join the waitlist for cloud branches.\n </>\n );\n } else if (canSend) {\n title = \"Send this to Builder\";\n subtitle = (\n <>\n Builder's cloud coding agent will make this code change on a fresh\n branch.\n </>\n );\n } else if (configured) {\n title = \"Builder.io connected\";\n subtitle = flow.envManaged ? (\n <>\n Managed by this deployment — every user of this app uses the same\n Builder identity. LLM access, browser automation, and more are ready to\n use.\n </>\n ) : orgName ? (\n <>\n Connected to{\" \"}\n <span className=\"font-medium text-foreground\">{orgName}</span>. LLM\n access, browser automation, and more are ready to use.\n </>\n ) : (\n <>LLM access, browser automation, and more are ready to use.</>\n );\n } else {\n title = \"Connect Builder.io\";\n subtitle = (\n <>\n One click to spin up a cloud code sandbox — Builder writes the changes\n for you, no local setup needed.\n </>\n );\n }\n\n return (\n <div className={cn(\"my-2 rounded-lg border border-border overflow-hidden\")}>\n <div className=\"flex items-start gap-3 px-4 py-3.5 bg-gradient-to-br from-teal-500/5 via-transparent to-transparent\">\n <div\n className={cn(\n \"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg\",\n \"bg-foreground text-background\",\n )}\n >\n {runResult ? (\n <IconLoader2 className=\"h-5 w-5 animate-spin\" />\n ) : (\n <BuilderBMark className=\"h-5 w-5\" />\n )}\n </div>\n <div className=\"flex-1 min-w-0\">\n <div className=\"flex items-center gap-2 flex-wrap\">\n <span className=\"text-sm font-semibold text-foreground\">\n {title}\n </span>\n </div>\n <div className=\"mt-0.5 text-xs text-muted-foreground leading-relaxed\">\n {subtitle}\n </div>\n\n {showWaitlist && (\n <a\n href={DESKTOP_DOWNLOAD_URL}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"mt-2 inline-flex items-center gap-1 text-[11px] font-medium text-muted-foreground no-underline hover:text-foreground\"\n >\n Download Desktop\n <IconExternalLink className=\"h-3 w-3\" />\n </a>\n )}\n\n {err && <div className=\"mt-2 text-xs text-destructive\">{err}</div>}\n\n <div className=\"mt-3\">\n {runResult ? (\n <a\n href={runResult.url}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className={cn(\n \"inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-colors\",\n \"bg-foreground text-background hover:bg-foreground/90\",\n )}\n >\n Open branch in Builder\n <IconExternalLink className=\"h-3.5 w-3.5\" />\n </a>\n ) : canSend ? (\n <button\n type=\"button\"\n onClick={handleSend}\n disabled={sending}\n className={cn(\n \"inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-colors\",\n \"bg-foreground text-background hover:bg-foreground/90\",\n sending && \"opacity-70 cursor-wait\",\n )}\n >\n {sending ? (\n <>\n <IconLoader2 className=\"h-3.5 w-3.5 animate-spin\" />\n Sending to Builder…\n </>\n ) : (\n <>Send to Builder</>\n )}\n </button>\n ) : showWaitlist && !waitlistJoined ? (\n <button\n type=\"button\"\n onClick={handleJoinWaitlist}\n disabled={joiningWaitlist}\n className={cn(\n \"inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-colors\",\n \"bg-foreground text-background hover:bg-foreground/90\",\n joiningWaitlist && \"opacity-70 cursor-wait\",\n )}\n >\n {joiningWaitlist ? (\n <>\n <IconLoader2 className=\"h-3.5 w-3.5 animate-spin\" />\n Joining…\n </>\n ) : (\n <>Join the waitlist</>\n )}\n </button>\n ) : !configured ? (\n <button\n type=\"button\"\n onClick={flow.start}\n disabled={connecting}\n className={cn(\n \"inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-colors\",\n \"bg-foreground text-background hover:bg-foreground/90\",\n connecting && \"opacity-70 cursor-wait\",\n )}\n >\n {connecting ? (\n <>\n <IconLoader2 className=\"h-3.5 w-3.5 animate-spin\" />\n Waiting for Builder…\n </>\n ) : (\n <>\n Connect Builder\n <IconExternalLink className=\"h-3.5 w-3.5\" />\n </>\n )}\n </button>\n ) : null}\n </div>\n </div>\n </div>\n </div>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frame.d.ts","sourceRoot":"","sources":["../../src/client/frame.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAMH;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,GAAG,IAAI,CAK1D;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,GAC3B,MAAM,IAAI,CAWZ;AAiBD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAUlE;AAmBD;;;GAGG;AACH,wBAAgB,cAAc,IAAI,MAAM,GAAG,IAAI,CAE9C;AAED;;;GAGG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAEnC;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;
|
|
1
|
+
{"version":3,"file":"frame.d.ts","sourceRoot":"","sources":["../../src/client/frame.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAMH;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,GAAG,IAAI,CAK1D;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,GAC3B,MAAM,IAAI,CAWZ;AAiBD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAUlE;AAmBD;;;GAGG;AACH,wBAAgB,cAAc,IAAI,MAAM,GAAG,IAAI,CAE9C;AAED;;;GAGG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAEnC;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAuCD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAY7D;AAMD,MAAM,WAAW,QAAQ;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,SAAS,SAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAoCnE;AAMD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAExD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAEvD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAExC"}
|
package/dist/client/frame.js
CHANGED
|
@@ -100,16 +100,28 @@ export function getCallbackOrigin() {
|
|
|
100
100
|
return typeof window !== "undefined" ? window.location.origin : "";
|
|
101
101
|
}
|
|
102
102
|
function envFlag(name) {
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
const value = runtimeEnvValue(name);
|
|
104
|
+
return value === "1" || value === "true" || value === true;
|
|
105
|
+
}
|
|
106
|
+
function runtimeEnvValue(name) {
|
|
107
|
+
const importMetaEnv = import.meta.env;
|
|
108
|
+
if (importMetaEnv?.[name] !== undefined)
|
|
109
|
+
return importMetaEnv[name];
|
|
110
|
+
return typeof process !== "undefined"
|
|
106
111
|
? process.env?.[name]
|
|
107
112
|
: undefined;
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
+
}
|
|
114
|
+
function workspaceGatewayOrigin() {
|
|
115
|
+
const raw = runtimeEnvValue("VITE_WORKSPACE_GATEWAY_URL") ||
|
|
116
|
+
runtimeEnvValue("WORKSPACE_GATEWAY_URL");
|
|
117
|
+
if (typeof raw !== "string" || !raw)
|
|
118
|
+
return null;
|
|
119
|
+
try {
|
|
120
|
+
return new URL(raw).origin;
|
|
121
|
+
}
|
|
122
|
+
catch {
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
113
125
|
}
|
|
114
126
|
function shouldUseWorkspaceCallbackRelay(path) {
|
|
115
127
|
return (envFlag("VITE_AGENT_NATIVE_WORKSPACE") &&
|
|
@@ -130,7 +142,11 @@ export function oauthRedirectUri(callbackPath) {
|
|
|
130
142
|
const path = shouldUseWorkspaceCallbackRelay(normalized)
|
|
131
143
|
? normalized
|
|
132
144
|
: agentNativePath(normalized);
|
|
133
|
-
|
|
145
|
+
const gatewayOrigin = shouldUseWorkspaceCallbackRelay(normalized)
|
|
146
|
+
? workspaceGatewayOrigin()
|
|
147
|
+
: null;
|
|
148
|
+
const origin = gatewayOrigin ?? getCallbackOrigin();
|
|
149
|
+
return `${origin}${path}`;
|
|
134
150
|
}
|
|
135
151
|
/**
|
|
136
152
|
* Request user info (name + email) from the parent frame.
|
package/dist/client/frame.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frame.js","sourceRoot":"","sources":["../../src/client/frame.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD;;;;;GAKG;AAEH,8EAA8E;AAC9E,6BAA6B;AAC7B,8EAA8E;AAE9E;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,IAAY,EAAE,IAAU;IAClD,IAAI,OAAO,MAAM,KAAK,WAAW;QAAE,OAAO;IAC1C,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;IACjE,MAAM,YAAY,GAAG,cAAc,EAAE,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;IAChE,MAAM,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,IAAI,EA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W,CAAC,+BAA+B,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;AAC7D,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAgB;IAC/C,WAAW,CAAC,8BAA8B,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;AAC5D,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB;IAC/B,WAAW,CAAC,+BAA+B,CAAC,CAAC;AAC/C,CAAC","sourcesContent":["import { agentNativePath } from \"./api-path.js\";\n\n/**\n * Frame Communication (browser)\n *\n * Utilities for communicating with the parent frame via postMessage.\n * Provides typed request/response patterns and message sending.\n */\n\n// ---------------------------------------------------------------------------\n// Low-level parent messaging\n// ---------------------------------------------------------------------------\n\n/**\n * Send a typed message to the parent frame.\n * No-op if running at top level (no parent frame).\n */\nexport function sendToFrame(type: string, data?: any): void {\n if (typeof window === \"undefined\") return;\n const target = window.parent !== window ? window.parent : window;\n const targetOrigin = getFrameOrigin() || window.location.origin;\n target.postMessage({ type, data }, targetOrigin);\n}\n\n/**\n * Listen for a specific message type from the parent frame.\n * Returns a cleanup function.\n */\nexport function onFrameMessage(\n type: string,\n handler: (data: any) => void,\n): () => void {\n if (typeof window === \"undefined\") return () => {};\n\n const listener = (event: MessageEvent) => {\n if (!isTrustedFrameMessage(event)) return;\n if (event.data?.type === type) {\n handler(event.data.data ?? event.data.detail ?? event.data);\n }\n };\n window.addEventListener(\"message\", listener);\n return () => window.removeEventListener(\"message\", listener);\n}\n\n// ---------------------------------------------------------------------------\n// Frame Origin\n// ---------------------------------------------------------------------------\n\nlet _frameOrigin: string | null = null;\n\nfunction normalizeOrigin(value: unknown): string | null {\n if (typeof value !== \"string\") return null;\n try {\n return new URL(value).origin;\n } catch {\n return null;\n }\n}\n\nexport function isTrustedFrameMessage(event: MessageEvent): boolean {\n if (typeof window === \"undefined\") return false;\n\n const ownOrigin = window.location.origin;\n if (event.origin === ownOrigin) return true;\n\n const frameOrigin = getFrameOrigin();\n if (!frameOrigin || event.origin !== frameOrigin) return false;\n\n return event.source === window.parent || event.source === window;\n}\n\n// Listen for frame origin message and cache it.\n// Only accept from the direct parent frame, and only set once.\nif (typeof window !== \"undefined\") {\n window.addEventListener(\"message\", (event: MessageEvent) => {\n const origin = normalizeOrigin(event.data?.origin);\n if (\n event.data?.type === \"agentNative.frameOrigin\" &&\n origin &&\n origin === event.origin &&\n !_frameOrigin &&\n event.source === window.parent\n ) {\n _frameOrigin = origin;\n }\n });\n}\n\n/**\n * Get the frame origin (e.g. \"http://localhost:3334\").\n * Returns null if not running inside a frame iframe.\n */\nexport function getFrameOrigin(): string | null {\n return _frameOrigin;\n}\n\n/**\n * Returns true if the app is running inside a frame iframe\n * (local dev frame, Builder.io, or any compatible frame).\n */\nexport function isInFrame(): boolean {\n return _frameOrigin !== null;\n}\n\n/**\n * Get the origin for OAuth callbacks.\n * Always uses the app's own origin (window.location.origin), NOT the frame\n * origin. The redirect URI registered in Google Cloud Console (or any OAuth\n * provider) must match the template app's direct URL, not the dev frame's\n * proxy URL, so this must be consistent regardless of how the app is accessed.\n */\nexport function getCallbackOrigin(): string {\n return typeof window !== \"undefined\" ? window.location.origin : \"\";\n}\n\nfunction envFlag(name: string): boolean {\n const env = (\n import.meta as unknown as {\n env?: Record<string, string | boolean | undefined>;\n }\n ).env;\n const value = env?.[name];\n const processValue =\n typeof process !== \"undefined\"\n ? (process.env as Record<string, string | undefined>)?.[name]\n : undefined;\n return (\n value === true ||\n value === \"1\" ||\n value === \"true\" ||\n processValue === \"1\" ||\n processValue === \"true\"\n );\n}\n\nfunction shouldUseWorkspaceCallbackRelay(path: string): boolean {\n return (\n envFlag(\"VITE_AGENT_NATIVE_WORKSPACE\") &&\n path.startsWith(\"/_agent-native/\") &&\n (path.endsWith(\"/callback\") || path.includes(\"/callback/\"))\n );\n}\n\n/**\n * Build an OAuth redirect URI for a framework callback route.\n *\n * Workspace deploys use one provider-registered root callback URL and then\n * relay to the app-specific callback based on OAuth state. Standalone apps\n * keep using their mounted app callback path.\n */\nexport function oauthRedirectUri(callbackPath: string): string {\n const normalized = callbackPath.startsWith(\"/\")\n ? callbackPath\n : `/${callbackPath}`;\n const path = shouldUseWorkspaceCallbackRelay(normalized)\n ? normalized\n : agentNativePath(normalized);\n return `${getCallbackOrigin()}${path}`;\n}\n\n// ---------------------------------------------------------------------------\n// User Info\n// ---------------------------------------------------------------------------\n\nexport interface UserInfo {\n name?: string;\n email?: string;\n}\n\n/**\n * Request user info (name + email) from the parent frame.\n * Falls back to empty object if frame doesn't respond within timeout.\n */\nexport function requestUserInfo(timeoutMs = 1500): Promise<UserInfo> {\n return new Promise((resolve) => {\n if (typeof window === \"undefined\" || window.parent === window) {\n resolve({});\n return;\n }\n\n let settled = false;\n\n const timer = setTimeout(() => {\n if (!settled) {\n settled = true;\n window.removeEventListener(\"message\", handler);\n resolve({});\n }\n }, timeoutMs);\n\n function handler(event: MessageEvent) {\n if (!event.data || event.data.type !== \"agentNative.userInfo\") return;\n if (event.source !== window.parent) return;\n const frameOrigin = getFrameOrigin();\n if (frameOrigin && event.origin !== frameOrigin) return;\n if (settled) return;\n settled = true;\n clearTimeout(timer);\n window.removeEventListener(\"message\", handler);\n const { name, email } = event.data.data ?? {};\n resolve({ name: name || undefined, email: email || undefined });\n }\n\n window.addEventListener(\"message\", handler);\n window.parent.postMessage(\n { type: \"agentNative.getUserInfo\" },\n getFrameOrigin() ?? window.location.origin,\n );\n });\n}\n\n// ---------------------------------------------------------------------------\n// Selection Mode (visual editing)\n// ---------------------------------------------------------------------------\n\n/**\n * Enter visual editing selection mode for a specific element.\n */\nexport function enterStyleEditing(selector: string): void {\n sendToFrame(\"agentNative.enterStyleEditing\", { selector });\n}\n\n/**\n * Enter text editing mode for a specific element.\n */\nexport function enterTextEditing(selector: string): void {\n sendToFrame(\"agentNative.enterTextEditing\", { selector });\n}\n\n/**\n * Exit selection mode.\n */\nexport function exitSelectionMode(): void {\n sendToFrame(\"agentNative.exitSelectionMode\");\n}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gB,CAAC,QAAgB;IAC/C,WAAW,CAAC,8BAA8B,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;AAC5D,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB;IAC/B,WAAW,CAAC,+BAA+B,CAAC,CAAC;AAC/C,CAAC","sourcesContent":["import { agentNativePath } from \"./api-path.js\";\n\n/**\n * Frame Communication (browser)\n *\n * Utilities for communicating with the parent frame via postMessage.\n * Provides typed request/response patterns and message sending.\n */\n\n// ---------------------------------------------------------------------------\n// Low-level parent messaging\n// ---------------------------------------------------------------------------\n\n/**\n * Send a typed message to the parent frame.\n * No-op if running at top level (no parent frame).\n */\nexport function sendToFrame(type: string, data?: any): void {\n if (typeof window === \"undefined\") return;\n const target = window.parent !== window ? window.parent : window;\n const targetOrigin = getFrameOrigin() || window.location.origin;\n target.postMessage({ type, data }, targetOrigin);\n}\n\n/**\n * Listen for a specific message type from the parent frame.\n * Returns a cleanup function.\n */\nexport function onFrameMessage(\n type: string,\n handler: (data: any) => void,\n): () => void {\n if (typeof window === \"undefined\") return () => {};\n\n const listener = (event: MessageEvent) => {\n if (!isTrustedFrameMessage(event)) return;\n if (event.data?.type === type) {\n handler(event.data.data ?? event.data.detail ?? event.data);\n }\n };\n window.addEventListener(\"message\", listener);\n return () => window.removeEventListener(\"message\", listener);\n}\n\n// ---------------------------------------------------------------------------\n// Frame Origin\n// ---------------------------------------------------------------------------\n\nlet _frameOrigin: string | null = null;\n\nfunction normalizeOrigin(value: unknown): string | null {\n if (typeof value !== \"string\") return null;\n try {\n return new URL(value).origin;\n } catch {\n return null;\n }\n}\n\nexport function isTrustedFrameMessage(event: MessageEvent): boolean {\n if (typeof window === \"undefined\") return false;\n\n const ownOrigin = window.location.origin;\n if (event.origin === ownOrigin) return true;\n\n const frameOrigin = getFrameOrigin();\n if (!frameOrigin || event.origin !== frameOrigin) return false;\n\n return event.source === window.parent || event.source === window;\n}\n\n// Listen for frame origin message and cache it.\n// Only accept from the direct parent frame, and only set once.\nif (typeof window !== \"undefined\") {\n window.addEventListener(\"message\", (event: MessageEvent) => {\n const origin = normalizeOrigin(event.data?.origin);\n if (\n event.data?.type === \"agentNative.frameOrigin\" &&\n origin &&\n origin === event.origin &&\n !_frameOrigin &&\n event.source === window.parent\n ) {\n _frameOrigin = origin;\n }\n });\n}\n\n/**\n * Get the frame origin (e.g. \"http://localhost:3334\").\n * Returns null if not running inside a frame iframe.\n */\nexport function getFrameOrigin(): string | null {\n return _frameOrigin;\n}\n\n/**\n * Returns true if the app is running inside a frame iframe\n * (local dev frame, Builder.io, or any compatible frame).\n */\nexport function isInFrame(): boolean {\n return _frameOrigin !== null;\n}\n\n/**\n * Get the origin for OAuth callbacks.\n * Always uses the app's own origin (window.location.origin), NOT the frame\n * origin. The redirect URI registered in Google Cloud Console (or any OAuth\n * provider) must match the template app's direct URL, not the dev frame's\n * proxy URL, so this must be consistent regardless of how the app is accessed.\n */\nexport function getCallbackOrigin(): string {\n return typeof window !== \"undefined\" ? window.location.origin : \"\";\n}\n\nfunction envFlag(name: string): boolean {\n const value = runtimeEnvValue(name);\n return value === \"1\" || value === \"true\" || value === true;\n}\n\nfunction runtimeEnvValue(name: string): string | boolean | undefined {\n const importMetaEnv = (\n import.meta as unknown as {\n env?: Record<string, string | boolean | undefined>;\n }\n ).env;\n if (importMetaEnv?.[name] !== undefined) return importMetaEnv[name];\n return typeof process !== \"undefined\"\n ? (process.env as Record<string, string | undefined>)?.[name]\n : undefined;\n}\n\nfunction workspaceGatewayOrigin(): string | null {\n const raw =\n runtimeEnvValue(\"VITE_WORKSPACE_GATEWAY_URL\") ||\n runtimeEnvValue(\"WORKSPACE_GATEWAY_URL\");\n if (typeof raw !== \"string\" || !raw) return null;\n try {\n return new URL(raw).origin;\n } catch {\n return null;\n }\n}\n\nfunction shouldUseWorkspaceCallbackRelay(path: string): boolean {\n return (\n envFlag(\"VITE_AGENT_NATIVE_WORKSPACE\") &&\n path.startsWith(\"/_agent-native/\") &&\n (path.endsWith(\"/callback\") || path.includes(\"/callback/\"))\n );\n}\n\n/**\n * Build an OAuth redirect URI for a framework callback route.\n *\n * Workspace deploys use one provider-registered root callback URL and then\n * relay to the app-specific callback based on OAuth state. Standalone apps\n * keep using their mounted app callback path.\n */\nexport function oauthRedirectUri(callbackPath: string): string {\n const normalized = callbackPath.startsWith(\"/\")\n ? callbackPath\n : `/${callbackPath}`;\n const path = shouldUseWorkspaceCallbackRelay(normalized)\n ? normalized\n : agentNativePath(normalized);\n const gatewayOrigin = shouldUseWorkspaceCallbackRelay(normalized)\n ? workspaceGatewayOrigin()\n : null;\n const origin = gatewayOrigin ?? getCallbackOrigin();\n return `${origin}${path}`;\n}\n\n// ---------------------------------------------------------------------------\n// User Info\n// ---------------------------------------------------------------------------\n\nexport interface UserInfo {\n name?: string;\n email?: string;\n}\n\n/**\n * Request user info (name + email) from the parent frame.\n * Falls back to empty object if frame doesn't respond within timeout.\n */\nexport function requestUserInfo(timeoutMs = 1500): Promise<UserInfo> {\n return new Promise((resolve) => {\n if (typeof window === \"undefined\" || window.parent === window) {\n resolve({});\n return;\n }\n\n let settled = false;\n\n const timer = setTimeout(() => {\n if (!settled) {\n settled = true;\n window.removeEventListener(\"message\", handler);\n resolve({});\n }\n }, timeoutMs);\n\n function handler(event: MessageEvent) {\n if (!event.data || event.data.type !== \"agentNative.userInfo\") return;\n if (event.source !== window.parent) return;\n const frameOrigin = getFrameOrigin();\n if (frameOrigin && event.origin !== frameOrigin) return;\n if (settled) return;\n settled = true;\n clearTimeout(timer);\n window.removeEventListener(\"message\", handler);\n const { name, email } = event.data.data ?? {};\n resolve({ name: name || undefined, email: email || undefined });\n }\n\n window.addEventListener(\"message\", handler);\n window.parent.postMessage(\n { type: \"agentNative.getUserInfo\" },\n getFrameOrigin() ?? window.location.origin,\n );\n });\n}\n\n// ---------------------------------------------------------------------------\n// Selection Mode (visual editing)\n// ---------------------------------------------------------------------------\n\n/**\n * Enter visual editing selection mode for a specific element.\n */\nexport function enterStyleEditing(selector: string): void {\n sendToFrame(\"agentNative.enterStyleEditing\", { selector });\n}\n\n/**\n * Enter text editing mode for a specific element.\n */\nexport function enterTextEditing(selector: string): void {\n sendToFrame(\"agentNative.enterTextEditing\", { selector });\n}\n\n/**\n * Exit selection mode.\n */\nexport function exitSelectionMode(): void {\n sendToFrame(\"agentNative.exitSelectionMode\");\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntegrationsPanel.d.ts","sourceRoot":"","sources":["../../../src/client/integrations/IntegrationsPanel.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"IntegrationsPanel.d.ts","sourceRoot":"","sources":["../../../src/client/integrations/IntegrationsPanel.tsx"],"names":[],"mappings":"AAkdA,wBAAgB,iBAAiB,4CAgJhC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useCallback } from "react";
|
|
2
|
+
import { useState, useCallback, useEffect } from "react";
|
|
3
3
|
import { IconPlus, IconBrandSlack, IconBrandTelegram, IconBrandWhatsapp, IconBrandGoogleDrive, IconTerminal2, IconBuildingSkyscraper, IconCopy, IconCheck, IconChevronLeft, IconExternalLink, IconCircleCheck, } from "@tabler/icons-react";
|
|
4
4
|
import { useIntegrationStatus, } from "./useIntegrationStatus.js";
|
|
5
5
|
import { agentNativePath } from "../api-path.js";
|
|
@@ -100,11 +100,31 @@ const PLATFORMS = [
|
|
|
100
100
|
docsUrl: "https://www.builder.io",
|
|
101
101
|
},
|
|
102
102
|
];
|
|
103
|
+
function useAgentEngineConfigured() {
|
|
104
|
+
const [configured, setConfigured] = useState(undefined);
|
|
105
|
+
const refresh = useCallback(() => {
|
|
106
|
+
fetch(agentNativePath("/_agent-native/agent-engine/status"))
|
|
107
|
+
.then((r) => (r.ok ? r.json() : null))
|
|
108
|
+
.then((data) => {
|
|
109
|
+
if (typeof data?.configured === "boolean") {
|
|
110
|
+
setConfigured(data.configured);
|
|
111
|
+
}
|
|
112
|
+
})
|
|
113
|
+
.catch(() => { });
|
|
114
|
+
}, []);
|
|
115
|
+
useEffect(() => {
|
|
116
|
+
refresh();
|
|
117
|
+
window.addEventListener("agent-engine:configured-changed", refresh);
|
|
118
|
+
return () => window.removeEventListener("agent-engine:configured-changed", refresh);
|
|
119
|
+
}, [refresh]);
|
|
120
|
+
return configured;
|
|
121
|
+
}
|
|
103
122
|
// ─── Integration detail view ─────────────────────────────────────────────────
|
|
104
123
|
function IntegrationDetail({ platform, serverStatus, onBack, onRefresh, }) {
|
|
105
124
|
const [toggling, setToggling] = useState(false);
|
|
106
125
|
const [copied, setCopied] = useState(false);
|
|
107
126
|
const [toggleError, setToggleError] = useState(null);
|
|
127
|
+
const agentEngineConfigured = useAgentEngineConfigured();
|
|
108
128
|
const handleToggle = useCallback(async () => {
|
|
109
129
|
setToggling(true);
|
|
110
130
|
setToggleError(null);
|
|
@@ -137,12 +157,18 @@ function IntegrationDetail({ platform, serverStatus, onBack, onRefresh, }) {
|
|
|
137
157
|
setCopied(true);
|
|
138
158
|
setTimeout(() => setCopied(false), 2000);
|
|
139
159
|
}, []);
|
|
160
|
+
const handleOpenLlmSettings = useCallback(() => {
|
|
161
|
+
window.dispatchEvent(new CustomEvent("agent-panel:open-settings", {
|
|
162
|
+
detail: { section: "llm" },
|
|
163
|
+
}));
|
|
164
|
+
}, []);
|
|
140
165
|
const isConfigured = serverStatus?.configured ?? false;
|
|
141
166
|
const isEnabled = serverStatus?.enabled ?? false;
|
|
167
|
+
const showAgentEnginePrereq = !platform.isClient && agentEngineConfigured === false;
|
|
142
168
|
const serviceAccountEmail = typeof serverStatus?.details?.serviceAccountEmail === "string"
|
|
143
169
|
? serverStatus.details.serviceAccountEmail
|
|
144
170
|
: null;
|
|
145
|
-
return (_jsxs("div", { children: [_jsxs("button", { onClick: onBack, className: "flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground mb-2", children: [_jsx(IconChevronLeft, { size: 12 }), "Back"] }), _jsxs("div", { className: "flex items-center gap-2 mb-2", children: [_jsx(platform.icon, { size: 18, className: "text-foreground shrink-0" }), _jsxs("div", { children: [_jsx("div", { className: "text-xs font-medium text-foreground", children: platform.label }), _jsx("div", { className: "text-[10px] text-muted-foreground", children: platform.description })] })] }), _jsxs("div", { className: "mb-3", children: [_jsx("div", { className: "text-[10px] font-medium text-muted-foreground mb-1.5", children: "Setup" }), _jsx("ol", { className: "space-y-1", children: platform.setupSteps.map((step, i) => (_jsxs("li", { className: "flex gap-1.5 text-[10px] text-muted-foreground leading-relaxed", children: [_jsxs("span", { className: "shrink-0 text-muted-foreground/50", children: [i + 1, "."] }), step] }, i))) })] }), serviceAccountEmail && (_jsxs("div", { className: "mb-3", children: [_jsx("div", { className: "text-[10px] font-medium text-muted-foreground mb-1", children: "Share documents with" }), _jsxs("div", { className: "flex items-center gap-1", children: [_jsx("code", { className: "flex-1 truncate rounded bg-muted px-1.5 py-0.5 text-[10px] text-foreground", children: serviceAccountEmail }), _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("button", { onClick: () => handleCopy(serviceAccountEmail), className: "shrink-0 rounded p-0.5 text-muted-foreground hover:text-foreground hover:bg-accent/50", children: copied ? _jsx(IconCheck, { size: 12 }) : _jsx(IconCopy, { size: 12 }) }) }), _jsx(TooltipContent, { children: "Copy service account email" })] })] })] })), platform.envVars.length > 0 && (_jsxs("div", { className: "mb-3", children: [_jsx("div", { className: "text-[10px] font-medium text-muted-foreground mb-1", children: "Required secrets" }), _jsx("div", { className: "space-y-0.5", children: platform.envVars.map((v) => (_jsxs("div", { className: "flex items-center gap-1", children: [_jsx("code", { className: "text-[10px] text-foreground bg-muted px-1 py-0.5 rounded", children: v }), isConfigured && (_jsx(IconCircleCheck, { size: 11, className: "text-green-500 shrink-0" }))] }, v))) }), !isConfigured && (_jsx("p", { className: "text-[10px] text-amber-500 mt-1", children: "Set these in your .env file or environment to connect." }))] })), serverStatus?.webhookUrl && !platform.isClient && (_jsxs("div", { className: "mb-3", children: [_jsx("div", { className: "text-[10px] font-medium text-muted-foreground mb-1", children: "Webhook URL" }), _jsxs("div", { className: "flex items-center gap-1", children: [_jsx("code", { className: "flex-1 truncate rounded bg-muted px-1.5 py-0.5 text-[10px] text-foreground", children: serverStatus.webhookUrl }), _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("button", { onClick: () => handleCopy(serverStatus.webhookUrl), className: "shrink-0 rounded p-0.5 text-muted-foreground hover:text-foreground hover:bg-accent/50", children: copied ? _jsx(IconCheck, { size: 12 }) : _jsx(IconCopy, { size: 12 }) }) }), _jsx(TooltipContent, { children: "Copy" })] })] })] })), platform.docsUrl && (_jsxs("a", { href: platform.docsUrl, target: "_blank", rel: "noopener noreferrer", className: "flex items-center gap-1 text-[10px] text-blue-400 hover:text-blue-300 mb-3", children: ["Documentation", _jsx(IconExternalLink, { size: 10 })] })), serverStatus && !platform.isClient && isConfigured && (_jsx("button", { onClick: handleToggle, disabled: toggling, className: `w-full rounded-md border px-2 py-1.5 text-[11px] font-medium disabled:opacity-50 ${isEnabled
|
|
171
|
+
return (_jsxs("div", { children: [_jsxs("button", { onClick: onBack, className: "flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground mb-2", children: [_jsx(IconChevronLeft, { size: 12 }), "Back"] }), _jsxs("div", { className: "flex items-center gap-2 mb-2", children: [_jsx(platform.icon, { size: 18, className: "text-foreground shrink-0" }), _jsxs("div", { children: [_jsx("div", { className: "text-xs font-medium text-foreground", children: platform.label }), _jsx("div", { className: "text-[10px] text-muted-foreground", children: platform.description })] })] }), showAgentEnginePrereq && (_jsx("div", { className: "mb-3 rounded-md border border-amber-500/30 bg-amber-500/10 px-2.5 py-2", children: _jsxs("div", { className: "flex items-center justify-between gap-2", children: [_jsxs("div", { className: "min-w-0", children: [_jsx("div", { className: "text-[10px] font-medium text-foreground", children: "Agent engine required" }), _jsxs("p", { className: "mt-0.5 text-[10px] leading-relaxed text-muted-foreground", children: ["Connect Builder.io or an LLM key before ", platform.label, " can answer."] })] }), _jsx("button", { type: "button", onClick: handleOpenLlmSettings, className: "shrink-0 rounded border border-border bg-background px-2 py-1 text-[10px] font-medium text-muted-foreground transition-colors hover:bg-accent/40 hover:text-foreground", children: "Open LLM" })] }) })), _jsxs("div", { className: "mb-3", children: [_jsx("div", { className: "text-[10px] font-medium text-muted-foreground mb-1.5", children: "Setup" }), _jsx("ol", { className: "space-y-1", children: platform.setupSteps.map((step, i) => (_jsxs("li", { className: "flex gap-1.5 text-[10px] text-muted-foreground leading-relaxed", children: [_jsxs("span", { className: "shrink-0 text-muted-foreground/50", children: [i + 1, "."] }), step] }, i))) })] }), serviceAccountEmail && (_jsxs("div", { className: "mb-3", children: [_jsx("div", { className: "text-[10px] font-medium text-muted-foreground mb-1", children: "Share documents with" }), _jsxs("div", { className: "flex items-center gap-1", children: [_jsx("code", { className: "flex-1 truncate rounded bg-muted px-1.5 py-0.5 text-[10px] text-foreground", children: serviceAccountEmail }), _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("button", { onClick: () => handleCopy(serviceAccountEmail), className: "shrink-0 rounded p-0.5 text-muted-foreground hover:text-foreground hover:bg-accent/50", children: copied ? _jsx(IconCheck, { size: 12 }) : _jsx(IconCopy, { size: 12 }) }) }), _jsx(TooltipContent, { children: "Copy service account email" })] })] })] })), platform.envVars.length > 0 && (_jsxs("div", { className: "mb-3", children: [_jsx("div", { className: "text-[10px] font-medium text-muted-foreground mb-1", children: "Required secrets" }), _jsx("div", { className: "space-y-0.5", children: platform.envVars.map((v) => (_jsxs("div", { className: "flex items-center gap-1", children: [_jsx("code", { className: "text-[10px] text-foreground bg-muted px-1 py-0.5 rounded", children: v }), isConfigured && (_jsx(IconCircleCheck, { size: 11, className: "text-green-500 shrink-0" }))] }, v))) }), !isConfigured && (_jsx("p", { className: "text-[10px] text-amber-500 mt-1", children: "Set these in your .env file or environment to connect." }))] })), serverStatus?.webhookUrl && !platform.isClient && (_jsxs("div", { className: "mb-3", children: [_jsx("div", { className: "text-[10px] font-medium text-muted-foreground mb-1", children: "Webhook URL" }), _jsxs("div", { className: "flex items-center gap-1", children: [_jsx("code", { className: "flex-1 truncate rounded bg-muted px-1.5 py-0.5 text-[10px] text-foreground", children: serverStatus.webhookUrl }), _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("button", { onClick: () => handleCopy(serverStatus.webhookUrl), className: "shrink-0 rounded p-0.5 text-muted-foreground hover:text-foreground hover:bg-accent/50", children: copied ? _jsx(IconCheck, { size: 12 }) : _jsx(IconCopy, { size: 12 }) }) }), _jsx(TooltipContent, { children: "Copy" })] })] })] })), platform.docsUrl && (_jsxs("a", { href: platform.docsUrl, target: "_blank", rel: "noopener noreferrer", className: "flex items-center gap-1 text-[10px] text-blue-400 hover:text-blue-300 mb-3", children: ["Documentation", _jsx(IconExternalLink, { size: 10 })] })), serverStatus && !platform.isClient && isConfigured && (_jsx("button", { onClick: handleToggle, disabled: toggling, className: `w-full rounded-md border px-2 py-1.5 text-[11px] font-medium disabled:opacity-50 ${isEnabled
|
|
146
172
|
? "border-border text-foreground hover:bg-accent/50"
|
|
147
173
|
: "border-green-600/50 text-green-400 hover:bg-green-900/20"}`, children: toggling ? "..." : isEnabled ? "Disable" : "Enable" })), platform.isClient && (_jsx("div", { className: "rounded-md border border-border bg-muted/30 px-2.5 py-2 text-[10px] text-muted-foreground", children: "This agent's A2A endpoint is automatically available. No configuration needed." })), serverStatus?.error && (_jsx("p", { className: "text-[10px] text-destructive mt-2", children: serverStatus.error })), toggleError && (_jsx("p", { className: "text-[10px] text-destructive mt-2", children: toggleError }))] }));
|
|
148
174
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntegrationsPanel.js","sourceRoot":"","sources":["../../../src/client/integrations/IntegrationsPanel.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EA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UAAU;wCACvB,CAAC,CAAC,cAAc;wCAChB,CAAC,CAAC,CAAC,CAAC,UAAU;4CACZ,CAAC,CAAC,eAAe;4CACjB,CAAC,CAAC,aACR,EAAE,GACF,CACH,KArBI,QAAQ,CAAC,EAAE,CAsBT,CACV,CAAC;oBACJ,CAAC,CAAC,EACF,cAAK,SAAS,EAAC,2FAA2F,gKAIpG,IACF,CACP,IACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["import React, { useState, useCallback } from \"react\";\nimport {\n IconPlus,\n IconBrandSlack,\n IconBrandTelegram,\n IconBrandWhatsapp,\n IconBrandGoogleDrive,\n IconTerminal2,\n IconBuildingSkyscraper,\n IconMessageCircle,\n IconCopy,\n IconCheck,\n IconChevronLeft,\n IconExternalLink,\n IconCircleCheck,\n} from \"@tabler/icons-react\";\nimport {\n useIntegrationStatus,\n type IntegrationStatus,\n} from \"./useIntegrationStatus.js\";\nimport { agentNativePath } from \"../api-path.js\";\nimport {\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n} from \"../components/ui/tooltip.js\";\n\n// ─── Platform config ─────────────────────────────────────────────────────────\n\ninterface PlatformInfo {\n id: string;\n label: string;\n icon: React.ComponentType<any>;\n description: string;\n envVars: string[];\n setupSteps: string[];\n docsUrl?: string;\n /** If true, this is a \"client\" integration (user connects TO the agent) rather than a webhook */\n isClient?: boolean;\n}\n\nconst PLATFORMS: PlatformInfo[] = [\n {\n id: \"slack\",\n label: \"Slack\",\n icon: IconBrandSlack,\n description: \"Message your agent from any Slack channel or DM.\",\n envVars: [\"SLACK_BOT_TOKEN\", \"SLACK_SIGNING_SECRET\"],\n setupSteps: [\n \"Create a Slack app at api.slack.com/apps\",\n 'Enable \"Event Subscriptions\" and point to your webhook URL',\n \"Subscribe to message.im and app_mention events\",\n \"Install the app to your workspace\",\n \"Copy the Bot Token and Signing Secret into your environment\",\n ],\n docsUrl: \"https://api.slack.com/apps\",\n },\n {\n id: \"telegram\",\n label: \"Telegram\",\n icon: IconBrandTelegram,\n description: \"Chat with your agent via a Telegram bot.\",\n envVars: [\"TELEGRAM_BOT_TOKEN\"],\n setupSteps: [\n \"Message @BotFather on Telegram to create a new bot\",\n \"Copy the bot token into your environment\",\n 'Click \"Setup webhook\" below to register automatically',\n ],\n },\n {\n id: \"whatsapp\",\n label: \"WhatsApp\",\n icon: IconBrandWhatsapp,\n description: \"Connect your agent to WhatsApp Business.\",\n envVars: [\"WHATSAPP_TOKEN\", \"WHATSAPP_VERIFY_TOKEN\"],\n setupSteps: [\n \"Create a Meta Business app at developers.facebook.com\",\n \"Set up WhatsApp Business API\",\n \"Configure the webhook URL and verify token\",\n \"Copy the access token into your environment\",\n ],\n docsUrl: \"https://developers.facebook.com/docs/whatsapp\",\n },\n {\n id: \"google-docs\",\n label: \"Google Docs\",\n icon: IconBrandGoogleDrive,\n description: \"Tag the agent in Google Doc comments to get responses.\",\n envVars: [\"GOOGLE_SERVICE_ACCOUNT_KEY\"],\n setupSteps: [\n \"Create a Google Cloud service account and download the JSON key\",\n \"Set GOOGLE_SERVICE_ACCOUNT_KEY in your environment (JSON string or file path)\",\n \"Share your Google Docs with the service account email\",\n 'Write a comment containing \"@Agent\" to trigger the agent',\n ],\n },\n {\n id: \"openclaw\",\n label: \"OpenClaw\",\n icon: IconTerminal2,\n description: \"Access this agent from OpenClaw's unified agent interface.\",\n envVars: [],\n isClient: true,\n setupSteps: [\n \"Install OpenClaw: npm install -g openclaw\",\n \"Add this agent's URL as a provider in your OpenClaw config\",\n \"OpenClaw discovers your agent's capabilities via the A2A protocol\",\n ],\n },\n {\n id: \"claude-code\",\n label: \"Claude Code\",\n icon: IconTerminal2,\n description:\n \"Let Claude Code call this agent via A2A for data and actions.\",\n envVars: [],\n isClient: true,\n setupSteps: [\n \"Your agent exposes an A2A endpoint at /.well-known/agent-card.json\",\n \"In Claude Code, reference your agent's URL when asking for data\",\n \"Claude Code will discover and call your agent's skills automatically\",\n ],\n },\n {\n id: \"builder\",\n label: \"Builder.io\",\n icon: IconBuildingSkyscraper,\n description:\n \"One chat interface that orchestrates all your agents together.\",\n envVars: [],\n isClient: true,\n setupSteps: [\n \"Connect your agent-native apps in your Builder.io workspace\",\n \"Builder.io discovers each agent's skills via A2A\",\n \"Chat with one agent that can trigger actions across all your apps\",\n ],\n docsUrl: \"https://www.builder.io\",\n },\n];\n\n// ─── Integration detail view ─────────────────────────────────────────────────\n\nfunction IntegrationDetail({\n platform,\n serverStatus,\n onBack,\n onRefresh,\n}: {\n platform: PlatformInfo;\n serverStatus?: IntegrationStatus;\n onBack: () => void;\n onRefresh: () => void;\n}) {\n const [toggling, setToggling] = useState(false);\n const [copied, setCopied] = useState(false);\n const [toggleError, setToggleError] = useState<string | null>(null);\n\n const handleToggle = useCallback(async () => {\n setToggling(true);\n setToggleError(null);\n try {\n const action = serverStatus?.enabled ? \"disable\" : \"enable\";\n const res = await fetch(\n agentNativePath(`/_agent-native/integrations/${platform.id}/${action}`),\n { method: \"POST\" },\n );\n if (res.ok) {\n onRefresh();\n return;\n }\n // Surface the real reason instead of silently doing nothing.\n // The endpoint returns `{ error }` for known failures (admin gating,\n // missing secrets, etc.); fall back to status text otherwise.\n const data = (await res.json().catch(() => null)) as {\n error?: string;\n } | null;\n setToggleError(\n data?.error ||\n res.statusText ||\n `Couldn't ${action} ${platform.label} (HTTP ${res.status})`,\n );\n } catch (err) {\n setToggleError(\n err instanceof Error\n ? err.message\n : \"Network error reaching the server\",\n );\n } finally {\n setToggling(false);\n }\n }, [platform.id, platform.label, serverStatus?.enabled, onRefresh]);\n\n const handleCopy = useCallback(async (text: string) => {\n await navigator.clipboard.writeText(text);\n setCopied(true);\n setTimeout(() => setCopied(false), 2000);\n }, []);\n\n const isConfigured = serverStatus?.configured ?? false;\n const isEnabled = serverStatus?.enabled ?? false;\n const serviceAccountEmail =\n typeof serverStatus?.details?.serviceAccountEmail === \"string\"\n ? serverStatus.details.serviceAccountEmail\n : null;\n\n return (\n <div>\n <button\n onClick={onBack}\n className=\"flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground mb-2\"\n >\n <IconChevronLeft size={12} />\n Back\n </button>\n\n <div className=\"flex items-center gap-2 mb-2\">\n <platform.icon size={18} className=\"text-foreground shrink-0\" />\n <div>\n <div className=\"text-xs font-medium text-foreground\">\n {platform.label}\n </div>\n <div className=\"text-[10px] text-muted-foreground\">\n {platform.description}\n </div>\n </div>\n </div>\n\n {/* Setup steps */}\n <div className=\"mb-3\">\n <div className=\"text-[10px] font-medium text-muted-foreground mb-1.5\">\n Setup\n </div>\n <ol className=\"space-y-1\">\n {platform.setupSteps.map((step, i) => (\n <li\n key={i}\n className=\"flex gap-1.5 text-[10px] text-muted-foreground leading-relaxed\"\n >\n <span className=\"shrink-0 text-muted-foreground/50\">\n {i + 1}.\n </span>\n {step}\n </li>\n ))}\n </ol>\n </div>\n\n {serviceAccountEmail && (\n <div className=\"mb-3\">\n <div className=\"text-[10px] font-medium text-muted-foreground mb-1\">\n Share documents with\n </div>\n <div className=\"flex items-center gap-1\">\n <code className=\"flex-1 truncate rounded bg-muted px-1.5 py-0.5 text-[10px] text-foreground\">\n {serviceAccountEmail}\n </code>\n <Tooltip>\n <TooltipTrigger asChild>\n <button\n onClick={() => handleCopy(serviceAccountEmail)}\n className=\"shrink-0 rounded p-0.5 text-muted-foreground hover:text-foreground hover:bg-accent/50\"\n >\n {copied ? <IconCheck size={12} /> : <IconCopy size={12} />}\n </button>\n </TooltipTrigger>\n <TooltipContent>Copy service account email</TooltipContent>\n </Tooltip>\n </div>\n </div>\n )}\n\n {/* Required secrets */}\n {platform.envVars.length > 0 && (\n <div className=\"mb-3\">\n <div className=\"text-[10px] font-medium text-muted-foreground mb-1\">\n Required secrets\n </div>\n <div className=\"space-y-0.5\">\n {platform.envVars.map((v) => (\n <div key={v} className=\"flex items-center gap-1\">\n <code className=\"text-[10px] text-foreground bg-muted px-1 py-0.5 rounded\">\n {v}\n </code>\n {isConfigured && (\n <IconCircleCheck\n size={11}\n className=\"text-green-500 shrink-0\"\n />\n )}\n </div>\n ))}\n </div>\n {!isConfigured && (\n <p className=\"text-[10px] text-amber-500 mt-1\">\n Set these in your .env file or environment to connect.\n </p>\n )}\n </div>\n )}\n\n {/* Webhook URL */}\n {serverStatus?.webhookUrl && !platform.isClient && (\n <div className=\"mb-3\">\n <div className=\"text-[10px] font-medium text-muted-foreground mb-1\">\n Webhook URL\n </div>\n <div className=\"flex items-center gap-1\">\n <code className=\"flex-1 truncate rounded bg-muted px-1.5 py-0.5 text-[10px] text-foreground\">\n {serverStatus.webhookUrl}\n </code>\n <Tooltip>\n <TooltipTrigger asChild>\n <button\n onClick={() => handleCopy(serverStatus.webhookUrl!)}\n className=\"shrink-0 rounded p-0.5 text-muted-foreground hover:text-foreground hover:bg-accent/50\"\n >\n {copied ? <IconCheck size={12} /> : <IconCopy size={12} />}\n </button>\n </TooltipTrigger>\n <TooltipContent>Copy</TooltipContent>\n </Tooltip>\n </div>\n </div>\n )}\n\n {/* Docs link */}\n {platform.docsUrl && (\n <a\n href={platform.docsUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"flex items-center gap-1 text-[10px] text-blue-400 hover:text-blue-300 mb-3\"\n >\n Documentation\n <IconExternalLink size={10} />\n </a>\n )}\n\n {/* Enable/disable for server integrations */}\n {serverStatus && !platform.isClient && isConfigured && (\n <button\n onClick={handleToggle}\n disabled={toggling}\n className={`w-full rounded-md border px-2 py-1.5 text-[11px] font-medium disabled:opacity-50 ${\n isEnabled\n ? \"border-border text-foreground hover:bg-accent/50\"\n : \"border-green-600/50 text-green-400 hover:bg-green-900/20\"\n }`}\n >\n {toggling ? \"...\" : isEnabled ? \"Disable\" : \"Enable\"}\n </button>\n )}\n\n {/* Status for client integrations */}\n {platform.isClient && (\n <div className=\"rounded-md border border-border bg-muted/30 px-2.5 py-2 text-[10px] text-muted-foreground\">\n This agent's A2A endpoint is automatically available. No configuration\n needed.\n </div>\n )}\n\n {serverStatus?.error && (\n <p className=\"text-[10px] text-destructive mt-2\">\n {serverStatus.error}\n </p>\n )}\n\n {toggleError && (\n <p className=\"text-[10px] text-destructive mt-2\">{toggleError}</p>\n )}\n </div>\n );\n}\n\n// ─── Add integration picker ──────────────────────────────────────────────────\n\nfunction AddIntegrationPicker({\n connectedIds,\n onSelect,\n}: {\n connectedIds: Set<string>;\n onSelect: (platform: PlatformInfo) => void;\n}) {\n return (\n <div className=\"space-y-1\">\n {PLATFORMS.filter((p) => !connectedIds.has(p.id)).map((platform) => (\n <button\n key={platform.id}\n onClick={() => onSelect(platform)}\n className=\"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left hover:bg-accent/50\"\n >\n <platform.icon size={14} className=\"shrink-0 text-muted-foreground\" />\n <div className=\"flex-1 min-w-0\">\n <div className=\"text-[11px] font-medium text-foreground\">\n {platform.label}\n </div>\n <div className=\"text-[10px] text-muted-foreground truncate\">\n {platform.description}\n </div>\n </div>\n </button>\n ))}\n </div>\n );\n}\n\n// ─── Main panel ──────────────────────────────────────────────────────────────\n\nexport function IntegrationsPanel() {\n const { statuses, loading, refetch } = useIntegrationStatus();\n const [selectedPlatform, setSelectedPlatform] = useState<PlatformInfo | null>(\n null,\n );\n const [showPicker, setShowPicker] = useState(false);\n\n const statusMap = new Map(statuses.map((s) => [s.platform, s]));\n\n // Show connected (enabled or configured) integrations\n const connectedPlatforms = PLATFORMS.filter((p) => {\n const s = statusMap.get(p.id);\n return s?.configured || s?.enabled;\n });\n\n const connectedIds = new Set(connectedPlatforms.map((p) => p.id));\n\n if (selectedPlatform) {\n return (\n <IntegrationDetail\n platform={selectedPlatform}\n serverStatus={statusMap.get(selectedPlatform.id)}\n onBack={() => setSelectedPlatform(null)}\n onRefresh={refetch}\n />\n );\n }\n\n if (showPicker) {\n return (\n <div>\n <button\n onClick={() => setShowPicker(false)}\n className=\"flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground mb-2\"\n >\n <IconChevronLeft size={12} />\n Back\n </button>\n <div className=\"text-[10px] font-medium text-muted-foreground mb-1.5\">\n Add a chat integration\n </div>\n <AddIntegrationPicker\n connectedIds={connectedIds}\n onSelect={(p) => {\n setSelectedPlatform(p);\n setShowPicker(false);\n }}\n />\n </div>\n );\n }\n\n return (\n <div>\n <div className=\"flex items-center justify-between mb-1.5\">\n <div>\n <div className=\"text-xs font-medium text-foreground\">\n Chat Integrations\n </div>\n <div className=\"text-[10px] text-muted-foreground\">\n Talk to this agent from other platforms\n </div>\n </div>\n <Tooltip>\n <TooltipTrigger asChild>\n <button\n onClick={() => setShowPicker(true)}\n className=\"flex h-5 w-5 items-center justify-center rounded text-muted-foreground hover:text-foreground hover:bg-accent/50\"\n >\n <IconPlus size={12} />\n </button>\n </TooltipTrigger>\n <TooltipContent>Add integration</TooltipContent>\n </Tooltip>\n </div>\n\n {loading ? (\n <div className=\"space-y-1.5\">\n <div className=\"h-6 w-full rounded bg-muted/50 animate-pulse\" />\n <div className=\"h-6 w-3/4 rounded bg-muted/50 animate-pulse\" />\n </div>\n ) : connectedPlatforms.length === 0 ? (\n <div className=\"space-y-2\">\n <button\n onClick={() => setShowPicker(true)}\n className=\"flex w-full items-center gap-1.5 rounded-md px-2 py-1.5 text-[11px] text-muted-foreground hover:text-foreground hover:bg-accent/30\"\n >\n <IconPlus size={12} className=\"shrink-0\" />\n Add integration\n </button>\n <div className=\"rounded-md border border-border bg-muted/30 px-2.5 py-2 text-[10px] text-muted-foreground\">\n For a central Slack or Telegram entrypoint that can route work\n across multiple apps, use the{\" \"}\n <a\n href=\"https://dispatch.agent-native.com\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"no-underline font-medium text-foreground hover:text-foreground/80\"\n >\n dispatch template\n </a>\n .\n </div>\n </div>\n ) : (\n <div className=\"space-y-2\">\n {connectedPlatforms.map((platform) => {\n const s = statusMap.get(platform.id);\n return (\n <button\n key={platform.id}\n onClick={() => setSelectedPlatform(platform)}\n className=\"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left hover:bg-accent/50\"\n >\n <platform.icon\n size={14}\n className=\"shrink-0 text-muted-foreground\"\n />\n <span className=\"flex-1 text-[11px] font-medium text-foreground truncate\">\n {platform.label}\n </span>\n {s && (\n <span\n className={`inline-block h-1.5 w-1.5 rounded-full shrink-0 ${\n s.enabled && s.configured\n ? \"bg-green-500\"\n : s.configured\n ? \"bg-yellow-500\"\n : \"bg-gray-400\"\n }`}\n />\n )}\n </button>\n );\n })}\n <div className=\"rounded-md border border-border bg-muted/30 px-2.5 py-2 text-[10px] text-muted-foreground\">\n Need one shared messaging surface for your workspace? Connect Slack\n or Telegram to a dispatch app and let it delegate to other agents\n over A2A.\n </div>\n </div>\n )}\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"IntegrationsPanel.js","sourceRoot":"","sources":["../../../src/client/integrations/IntegrationsPanel.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,EACL,QAAQ,EACR,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,EACpB,aAAa,EACb,sBAAsB,EAEtB,QAAQ,EACR,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,oBAAoB,GAErB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EACL,OAAO,EACP,cAAc,EACd,cAAc,GACf,MAAM,6BAA6B,CAAC;AAgBrC,MAAM,SAAS,GAAmB;IAChC;QACE,EAAE,EAAE,OAAO;QACX,KAAK,EAAE,OAAO;QACd,IAAI,EAAE,cAAc;QACpB,WAAW,EAAE,kDAAkD;QAC/D,OAAO,EAAE,CAAC,iBAAiB,EAAE,sBAAsB,CAAC;QACpD,UAAU,EAAE;YACV,0CAA0C;YAC1C,4DAA4D;YAC5D,gDAAgD;YAChD,mCAAmC;YACnC,6DAA6D;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from \"react\";\nimport {\n IconPlus,\n IconBrandSlack,\n IconBrandTelegram,\n IconBrandWhatsapp,\n IconBrandGoogleDrive,\n IconTerminal2,\n IconBuildingSkyscraper,\n IconMessageCircle,\n IconCopy,\n IconCheck,\n IconChevronLeft,\n IconExternalLink,\n IconCircleCheck,\n} from \"@tabler/icons-react\";\nimport {\n useIntegrationStatus,\n type IntegrationStatus,\n} from \"./useIntegrationStatus.js\";\nimport { agentNativePath } from \"../api-path.js\";\nimport {\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n} from \"../components/ui/tooltip.js\";\n\n// ─── Platform config ─────────────────────────────────────────────────────────\n\ninterface PlatformInfo {\n id: string;\n label: string;\n icon: React.ComponentType<any>;\n description: string;\n envVars: string[];\n setupSteps: string[];\n docsUrl?: string;\n /** If true, this is a \"client\" integration (user connects TO the agent) rather than a webhook */\n isClient?: boolean;\n}\n\nconst PLATFORMS: PlatformInfo[] = [\n {\n id: \"slack\",\n label: \"Slack\",\n icon: IconBrandSlack,\n description: \"Message your agent from any Slack channel or DM.\",\n envVars: [\"SLACK_BOT_TOKEN\", \"SLACK_SIGNING_SECRET\"],\n setupSteps: [\n \"Create a Slack app at api.slack.com/apps\",\n 'Enable \"Event Subscriptions\" and point to your webhook URL',\n \"Subscribe to message.im and app_mention events\",\n \"Install the app to your workspace\",\n \"Copy the Bot Token and Signing Secret into your environment\",\n ],\n docsUrl: \"https://api.slack.com/apps\",\n },\n {\n id: \"telegram\",\n label: \"Telegram\",\n icon: IconBrandTelegram,\n description: \"Chat with your agent via a Telegram bot.\",\n envVars: [\"TELEGRAM_BOT_TOKEN\"],\n setupSteps: [\n \"Message @BotFather on Telegram to create a new bot\",\n \"Copy the bot token into your environment\",\n 'Click \"Setup webhook\" below to register automatically',\n ],\n },\n {\n id: \"whatsapp\",\n label: \"WhatsApp\",\n icon: IconBrandWhatsapp,\n description: \"Connect your agent to WhatsApp Business.\",\n envVars: [\"WHATSAPP_TOKEN\", \"WHATSAPP_VERIFY_TOKEN\"],\n setupSteps: [\n \"Create a Meta Business app at developers.facebook.com\",\n \"Set up WhatsApp Business API\",\n \"Configure the webhook URL and verify token\",\n \"Copy the access token into your environment\",\n ],\n docsUrl: \"https://developers.facebook.com/docs/whatsapp\",\n },\n {\n id: \"google-docs\",\n label: \"Google Docs\",\n icon: IconBrandGoogleDrive,\n description: \"Tag the agent in Google Doc comments to get responses.\",\n envVars: [\"GOOGLE_SERVICE_ACCOUNT_KEY\"],\n setupSteps: [\n \"Create a Google Cloud service account and download the JSON key\",\n \"Set GOOGLE_SERVICE_ACCOUNT_KEY in your environment (JSON string or file path)\",\n \"Share your Google Docs with the service account email\",\n 'Write a comment containing \"@Agent\" to trigger the agent',\n ],\n },\n {\n id: \"openclaw\",\n label: \"OpenClaw\",\n icon: IconTerminal2,\n description: \"Access this agent from OpenClaw's unified agent interface.\",\n envVars: [],\n isClient: true,\n setupSteps: [\n \"Install OpenClaw: npm install -g openclaw\",\n \"Add this agent's URL as a provider in your OpenClaw config\",\n \"OpenClaw discovers your agent's capabilities via the A2A protocol\",\n ],\n },\n {\n id: \"claude-code\",\n label: \"Claude Code\",\n icon: IconTerminal2,\n description:\n \"Let Claude Code call this agent via A2A for data and actions.\",\n envVars: [],\n isClient: true,\n setupSteps: [\n \"Your agent exposes an A2A endpoint at /.well-known/agent-card.json\",\n \"In Claude Code, reference your agent's URL when asking for data\",\n \"Claude Code will discover and call your agent's skills automatically\",\n ],\n },\n {\n id: \"builder\",\n label: \"Builder.io\",\n icon: IconBuildingSkyscraper,\n description:\n \"One chat interface that orchestrates all your agents together.\",\n envVars: [],\n isClient: true,\n setupSteps: [\n \"Connect your agent-native apps in your Builder.io workspace\",\n \"Builder.io discovers each agent's skills via A2A\",\n \"Chat with one agent that can trigger actions across all your apps\",\n ],\n docsUrl: \"https://www.builder.io\",\n },\n];\n\nfunction useAgentEngineConfigured() {\n const [configured, setConfigured] = useState<boolean | undefined>(undefined);\n\n const refresh = useCallback(() => {\n fetch(agentNativePath(\"/_agent-native/agent-engine/status\"))\n .then((r) => (r.ok ? r.json() : null))\n .then((data) => {\n if (typeof data?.configured === \"boolean\") {\n setConfigured(data.configured);\n }\n })\n .catch(() => {});\n }, []);\n\n useEffect(() => {\n refresh();\n window.addEventListener(\"agent-engine:configured-changed\", refresh);\n return () =>\n window.removeEventListener(\"agent-engine:configured-changed\", refresh);\n }, [refresh]);\n\n return configured;\n}\n\n// ─── Integration detail view ─────────────────────────────────────────────────\n\nfunction IntegrationDetail({\n platform,\n serverStatus,\n onBack,\n onRefresh,\n}: {\n platform: PlatformInfo;\n serverStatus?: IntegrationStatus;\n onBack: () => void;\n onRefresh: () => void;\n}) {\n const [toggling, setToggling] = useState(false);\n const [copied, setCopied] = useState(false);\n const [toggleError, setToggleError] = useState<string | null>(null);\n const agentEngineConfigured = useAgentEngineConfigured();\n\n const handleToggle = useCallback(async () => {\n setToggling(true);\n setToggleError(null);\n try {\n const action = serverStatus?.enabled ? \"disable\" : \"enable\";\n const res = await fetch(\n agentNativePath(`/_agent-native/integrations/${platform.id}/${action}`),\n { method: \"POST\" },\n );\n if (res.ok) {\n onRefresh();\n return;\n }\n // Surface the real reason instead of silently doing nothing.\n // The endpoint returns `{ error }` for known failures (admin gating,\n // missing secrets, etc.); fall back to status text otherwise.\n const data = (await res.json().catch(() => null)) as {\n error?: string;\n } | null;\n setToggleError(\n data?.error ||\n res.statusText ||\n `Couldn't ${action} ${platform.label} (HTTP ${res.status})`,\n );\n } catch (err) {\n setToggleError(\n err instanceof Error\n ? err.message\n : \"Network error reaching the server\",\n );\n } finally {\n setToggling(false);\n }\n }, [platform.id, platform.label, serverStatus?.enabled, onRefresh]);\n\n const handleCopy = useCallback(async (text: string) => {\n await navigator.clipboard.writeText(text);\n setCopied(true);\n setTimeout(() => setCopied(false), 2000);\n }, []);\n\n const handleOpenLlmSettings = useCallback(() => {\n window.dispatchEvent(\n new CustomEvent(\"agent-panel:open-settings\", {\n detail: { section: \"llm\" },\n }),\n );\n }, []);\n\n const isConfigured = serverStatus?.configured ?? false;\n const isEnabled = serverStatus?.enabled ?? false;\n const showAgentEnginePrereq =\n !platform.isClient && agentEngineConfigured === false;\n const serviceAccountEmail =\n typeof serverStatus?.details?.serviceAccountEmail === \"string\"\n ? serverStatus.details.serviceAccountEmail\n : null;\n\n return (\n <div>\n <button\n onClick={onBack}\n className=\"flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground mb-2\"\n >\n <IconChevronLeft size={12} />\n Back\n </button>\n\n <div className=\"flex items-center gap-2 mb-2\">\n <platform.icon size={18} className=\"text-foreground shrink-0\" />\n <div>\n <div className=\"text-xs font-medium text-foreground\">\n {platform.label}\n </div>\n <div className=\"text-[10px] text-muted-foreground\">\n {platform.description}\n </div>\n </div>\n </div>\n\n {showAgentEnginePrereq && (\n <div className=\"mb-3 rounded-md border border-amber-500/30 bg-amber-500/10 px-2.5 py-2\">\n <div className=\"flex items-center justify-between gap-2\">\n <div className=\"min-w-0\">\n <div className=\"text-[10px] font-medium text-foreground\">\n Agent engine required\n </div>\n <p className=\"mt-0.5 text-[10px] leading-relaxed text-muted-foreground\">\n Connect Builder.io or an LLM key before {platform.label} can\n answer.\n </p>\n </div>\n <button\n type=\"button\"\n onClick={handleOpenLlmSettings}\n className=\"shrink-0 rounded border border-border bg-background px-2 py-1 text-[10px] font-medium text-muted-foreground transition-colors hover:bg-accent/40 hover:text-foreground\"\n >\n Open LLM\n </button>\n </div>\n </div>\n )}\n\n {/* Setup steps */}\n <div className=\"mb-3\">\n <div className=\"text-[10px] font-medium text-muted-foreground mb-1.5\">\n Setup\n </div>\n <ol className=\"space-y-1\">\n {platform.setupSteps.map((step, i) => (\n <li\n key={i}\n className=\"flex gap-1.5 text-[10px] text-muted-foreground leading-relaxed\"\n >\n <span className=\"shrink-0 text-muted-foreground/50\">\n {i + 1}.\n </span>\n {step}\n </li>\n ))}\n </ol>\n </div>\n\n {serviceAccountEmail && (\n <div className=\"mb-3\">\n <div className=\"text-[10px] font-medium text-muted-foreground mb-1\">\n Share documents with\n </div>\n <div className=\"flex items-center gap-1\">\n <code className=\"flex-1 truncate rounded bg-muted px-1.5 py-0.5 text-[10px] text-foreground\">\n {serviceAccountEmail}\n </code>\n <Tooltip>\n <TooltipTrigger asChild>\n <button\n onClick={() => handleCopy(serviceAccountEmail)}\n className=\"shrink-0 rounded p-0.5 text-muted-foreground hover:text-foreground hover:bg-accent/50\"\n >\n {copied ? <IconCheck size={12} /> : <IconCopy size={12} />}\n </button>\n </TooltipTrigger>\n <TooltipContent>Copy service account email</TooltipContent>\n </Tooltip>\n </div>\n </div>\n )}\n\n {/* Required secrets */}\n {platform.envVars.length > 0 && (\n <div className=\"mb-3\">\n <div className=\"text-[10px] font-medium text-muted-foreground mb-1\">\n Required secrets\n </div>\n <div className=\"space-y-0.5\">\n {platform.envVars.map((v) => (\n <div key={v} className=\"flex items-center gap-1\">\n <code className=\"text-[10px] text-foreground bg-muted px-1 py-0.5 rounded\">\n {v}\n </code>\n {isConfigured && (\n <IconCircleCheck\n size={11}\n className=\"text-green-500 shrink-0\"\n />\n )}\n </div>\n ))}\n </div>\n {!isConfigured && (\n <p className=\"text-[10px] text-amber-500 mt-1\">\n Set these in your .env file or environment to connect.\n </p>\n )}\n </div>\n )}\n\n {/* Webhook URL */}\n {serverStatus?.webhookUrl && !platform.isClient && (\n <div className=\"mb-3\">\n <div className=\"text-[10px] font-medium text-muted-foreground mb-1\">\n Webhook URL\n </div>\n <div className=\"flex items-center gap-1\">\n <code className=\"flex-1 truncate rounded bg-muted px-1.5 py-0.5 text-[10px] text-foreground\">\n {serverStatus.webhookUrl}\n </code>\n <Tooltip>\n <TooltipTrigger asChild>\n <button\n onClick={() => handleCopy(serverStatus.webhookUrl!)}\n className=\"shrink-0 rounded p-0.5 text-muted-foreground hover:text-foreground hover:bg-accent/50\"\n >\n {copied ? <IconCheck size={12} /> : <IconCopy size={12} />}\n </button>\n </TooltipTrigger>\n <TooltipContent>Copy</TooltipContent>\n </Tooltip>\n </div>\n </div>\n )}\n\n {/* Docs link */}\n {platform.docsUrl && (\n <a\n href={platform.docsUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"flex items-center gap-1 text-[10px] text-blue-400 hover:text-blue-300 mb-3\"\n >\n Documentation\n <IconExternalLink size={10} />\n </a>\n )}\n\n {/* Enable/disable for server integrations */}\n {serverStatus && !platform.isClient && isConfigured && (\n <button\n onClick={handleToggle}\n disabled={toggling}\n className={`w-full rounded-md border px-2 py-1.5 text-[11px] font-medium disabled:opacity-50 ${\n isEnabled\n ? \"border-border text-foreground hover:bg-accent/50\"\n : \"border-green-600/50 text-green-400 hover:bg-green-900/20\"\n }`}\n >\n {toggling ? \"...\" : isEnabled ? \"Disable\" : \"Enable\"}\n </button>\n )}\n\n {/* Status for client integrations */}\n {platform.isClient && (\n <div className=\"rounded-md border border-border bg-muted/30 px-2.5 py-2 text-[10px] text-muted-foreground\">\n This agent's A2A endpoint is automatically available. No configuration\n needed.\n </div>\n )}\n\n {serverStatus?.error && (\n <p className=\"text-[10px] text-destructive mt-2\">\n {serverStatus.error}\n </p>\n )}\n\n {toggleError && (\n <p className=\"text-[10px] text-destructive mt-2\">{toggleError}</p>\n )}\n </div>\n );\n}\n\n// ─── Add integration picker ──────────────────────────────────────────────────\n\nfunction AddIntegrationPicker({\n connectedIds,\n onSelect,\n}: {\n connectedIds: Set<string>;\n onSelect: (platform: PlatformInfo) => void;\n}) {\n return (\n <div className=\"space-y-1\">\n {PLATFORMS.filter((p) => !connectedIds.has(p.id)).map((platform) => (\n <button\n key={platform.id}\n onClick={() => onSelect(platform)}\n className=\"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left hover:bg-accent/50\"\n >\n <platform.icon size={14} className=\"shrink-0 text-muted-foreground\" />\n <div className=\"flex-1 min-w-0\">\n <div className=\"text-[11px] font-medium text-foreground\">\n {platform.label}\n </div>\n <div className=\"text-[10px] text-muted-foreground truncate\">\n {platform.description}\n </div>\n </div>\n </button>\n ))}\n </div>\n );\n}\n\n// ─── Main panel ──────────────────────────────────────────────────────────────\n\nexport function IntegrationsPanel() {\n const { statuses, loading, refetch } = useIntegrationStatus();\n const [selectedPlatform, setSelectedPlatform] = useState<PlatformInfo | null>(\n null,\n );\n const [showPicker, setShowPicker] = useState(false);\n\n const statusMap = new Map(statuses.map((s) => [s.platform, s]));\n\n // Show connected (enabled or configured) integrations\n const connectedPlatforms = PLATFORMS.filter((p) => {\n const s = statusMap.get(p.id);\n return s?.configured || s?.enabled;\n });\n\n const connectedIds = new Set(connectedPlatforms.map((p) => p.id));\n\n if (selectedPlatform) {\n return (\n <IntegrationDetail\n platform={selectedPlatform}\n serverStatus={statusMap.get(selectedPlatform.id)}\n onBack={() => setSelectedPlatform(null)}\n onRefresh={refetch}\n />\n );\n }\n\n if (showPicker) {\n return (\n <div>\n <button\n onClick={() => setShowPicker(false)}\n className=\"flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground mb-2\"\n >\n <IconChevronLeft size={12} />\n Back\n </button>\n <div className=\"text-[10px] font-medium text-muted-foreground mb-1.5\">\n Add a chat integration\n </div>\n <AddIntegrationPicker\n connectedIds={connectedIds}\n onSelect={(p) => {\n setSelectedPlatform(p);\n setShowPicker(false);\n }}\n />\n </div>\n );\n }\n\n return (\n <div>\n <div className=\"flex items-center justify-between mb-1.5\">\n <div>\n <div className=\"text-xs font-medium text-foreground\">\n Chat Integrations\n </div>\n <div className=\"text-[10px] text-muted-foreground\">\n Talk to this agent from other platforms\n </div>\n </div>\n <Tooltip>\n <TooltipTrigger asChild>\n <button\n onClick={() => setShowPicker(true)}\n className=\"flex h-5 w-5 items-center justify-center rounded text-muted-foreground hover:text-foreground hover:bg-accent/50\"\n >\n <IconPlus size={12} />\n </button>\n </TooltipTrigger>\n <TooltipContent>Add integration</TooltipContent>\n </Tooltip>\n </div>\n\n {loading ? (\n <div className=\"space-y-1.5\">\n <div className=\"h-6 w-full rounded bg-muted/50 animate-pulse\" />\n <div className=\"h-6 w-3/4 rounded bg-muted/50 animate-pulse\" />\n </div>\n ) : connectedPlatforms.length === 0 ? (\n <div className=\"space-y-2\">\n <button\n onClick={() => setShowPicker(true)}\n className=\"flex w-full items-center gap-1.5 rounded-md px-2 py-1.5 text-[11px] text-muted-foreground hover:text-foreground hover:bg-accent/30\"\n >\n <IconPlus size={12} className=\"shrink-0\" />\n Add integration\n </button>\n <div className=\"rounded-md border border-border bg-muted/30 px-2.5 py-2 text-[10px] text-muted-foreground\">\n For a central Slack or Telegram entrypoint that can route work\n across multiple apps, use the{\" \"}\n <a\n href=\"https://dispatch.agent-native.com\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"no-underline font-medium text-foreground hover:text-foreground/80\"\n >\n dispatch template\n </a>\n .\n </div>\n </div>\n ) : (\n <div className=\"space-y-2\">\n {connectedPlatforms.map((platform) => {\n const s = statusMap.get(platform.id);\n return (\n <button\n key={platform.id}\n onClick={() => setSelectedPlatform(platform)}\n className=\"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left hover:bg-accent/50\"\n >\n <platform.icon\n size={14}\n className=\"shrink-0 text-muted-foreground\"\n />\n <span className=\"flex-1 text-[11px] font-medium text-foreground truncate\">\n {platform.label}\n </span>\n {s && (\n <span\n className={`inline-block h-1.5 w-1.5 rounded-full shrink-0 ${\n s.enabled && s.configured\n ? \"bg-green-500\"\n : s.configured\n ? \"bg-yellow-500\"\n : \"bg-gray-400\"\n }`}\n />\n )}\n </button>\n );\n })}\n <div className=\"rounded-md border border-border bg-muted/30 px-2.5 py-2 text-[10px] text-muted-foreground\">\n Need one shared messaging surface for your workspace? Connect Slack\n or Telegram to a dispatch app and let it delegate to other agents\n over A2A.\n </div>\n </div>\n )}\n </div>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SettingsPanel.d.ts","sourceRoot":"","sources":["../../../src/client/settings/SettingsPanel.tsx"],"names":[],"mappings":"AA2+CA,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,OAAO,CAAC;IACnB,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,aAAa,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;
|
|
1
|
+
{"version":3,"file":"SettingsPanel.d.ts","sourceRoot":"","sources":["../../../src/client/settings/SettingsPanel.tsx"],"names":[],"mappings":"AA2+CA,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,OAAO,CAAC;IACnB,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,aAAa,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AA2QD,wBAAgB,aAAa,CAAC,EAC5B,SAAS,EACT,eAAe,EACf,aAAa,EACb,SAAS,EACT,cAAc,EACd,iBAAiB,GAClB,EAAE,kBAAkB,2CAwWpB"}
|
|
@@ -686,6 +686,18 @@ const environmentOptions = [
|
|
|
686
686
|
description: "Full access to code editing, shell, and files.",
|
|
687
687
|
},
|
|
688
688
|
];
|
|
689
|
+
function CapabilityStatusRow({ label, value, active, }) {
|
|
690
|
+
return (_jsxs("div", { className: "flex items-center justify-between gap-2 text-[10px]", children: [_jsxs("span", { className: "flex items-center gap-1.5 text-muted-foreground", children: [_jsx("span", { className: `h-1.5 w-1.5 rounded-full ${active ? "bg-green-500" : "bg-muted-foreground/30"}`, "aria-hidden": "true" }), label] }), _jsx("span", { className: "min-w-0 truncate text-right text-foreground", children: value })] }));
|
|
691
|
+
}
|
|
692
|
+
function CapabilityStatusStrip({ isDevMode, builderConnected, builderLoading, builderBranchesAvailable, onOpenLlm, }) {
|
|
693
|
+
const codeAvailable = isDevMode || (builderConnected && builderBranchesAvailable);
|
|
694
|
+
const codeLabel = isDevMode
|
|
695
|
+
? "Local tools"
|
|
696
|
+
: builderConnected && builderBranchesAvailable
|
|
697
|
+
? "Builder branches"
|
|
698
|
+
: "Desktop/local";
|
|
699
|
+
return (_jsxs("div", { className: "rounded-md border border-border bg-muted/20 px-2.5 py-2", children: [_jsx("div", { className: "mb-1.5 text-[10px] font-medium text-muted-foreground", children: "Available now" }), _jsxs("div", { className: "space-y-1.5", children: [_jsx(CapabilityStatusRow, { label: "App", value: "Chat + actions", active: true }), _jsx(CapabilityStatusRow, { label: "Code", value: codeLabel, active: codeAvailable }), _jsx(CapabilityStatusRow, { label: "Builder", active: builderConnected, value: builderLoading ? ("Checking...") : builderConnected ? ("Connected") : (_jsx("button", { type: "button", onClick: onOpenLlm, className: "rounded border border-border px-1.5 py-0.5 text-[10px] text-muted-foreground transition-colors hover:bg-accent/40 hover:text-foreground", children: "Connect" })) })] })] }));
|
|
700
|
+
}
|
|
689
701
|
function AccountSectionInner({ open, onToggle, }) {
|
|
690
702
|
const { session, isLoading } = useSession();
|
|
691
703
|
const email = session?.email;
|
|
@@ -783,6 +795,6 @@ export function SettingsPanel({ isDevMode, onToggleDevMode, showDevToggle, devAp
|
|
|
783
795
|
const nextIsDev = next === "development";
|
|
784
796
|
if (nextIsDev !== isDevMode)
|
|
785
797
|
onToggleDevMode();
|
|
786
|
-
} })) })), _jsx(AccountSectionInner, { open: openSection === "account", onToggle: () => toggle("account") }), _jsx(LLMSectionInner, { builderFlow: builderFlow, builderLoading: builderLoading, connectUrl: connectUrl, connected: connected, orgName: orgName, envManaged: envManaged, credentialSource: credentialSource, open: openSection === "llm", onToggle: () => toggle("llm") }), _jsx(AgentLimitsSectionInner, { open: openSection === "limits", onToggle: () => toggle("limits") }), _jsx(SettingsSection, { icon: _jsx(IconMicrophone, { size: 14 }), title: "Voice Transcription", subtitle: "How the composer microphone turns your voice into text.", open: openSection === "voice", onToggle: () => toggle("voice"), children: _jsx(VoiceTranscriptionSection, {}) }), _jsx(SettingsSection, { icon: _jsx(IconBolt, { size: 14 }), title: "Automations", subtitle: "Event-triggered and scheduled automations.", open: openSection === "automations", onToggle: () => toggle("automations"), children: _jsx(AutomationsSection, {}) }), _jsx(SettingsSection, { id: settingsSectionDomId("secrets"), icon: _jsx(IconKey, { size: 14 }), title: "API Keys & Connections", subtitle: "Service credentials and automation keys.", open: openSection === "secrets", onToggle: () => toggle("secrets"), children: _jsx(SecretsSection, { focusKey: focusSecretKey }) }), _jsx(SettingsSection, { icon: _jsx(IconCloud, { size: 14 }), title: "Hosting", subtitle: "Deploy your app to the cloud.", connected: connected, open: openSection === "hosting", onToggle: () => toggle("hosting"), children: _jsxs("div", { className: "space-y-2", children: [_jsx(UseBuilderCard, { builderFlow: builderFlow, connectUrl: connectUrl, connected: connected, orgName: orgName, envManaged: envManaged, credentialSource: credentialSource }), _jsx(ManualSetupCard, { hint: "Deploy manually to Netlify, Vercel, Cloudflare, or any Nitro-supported target.", docsUrl: "https://www.builder.io/c/docs/agent-native-deployment", dim: connected })] }) }), _jsx(SettingsSection, { icon: _jsx(IconDatabase, { size: 14 }), title: "Database", subtitle: "Connect a cloud database for persistent storage.", connected: connected, open: openSection === "database", onToggle: () => toggle("database"), children: _jsxs("div", { className: "space-y-2", children: [_jsx(UseBuilderCard, { builderFlow: builderFlow, connectUrl: connectUrl, connected: connected, orgName: orgName, envManaged: envManaged, credentialSource: credentialSource }), _jsx(ManualSetupCard, { hint: "Set DATABASE_URL in your .env to connect Neon, Supabase, Turso, or any Postgres/SQLite database.", docsUrl: "https://www.builder.io/c/docs/agent-native-database", dim: connected })] }) }), _jsx(SettingsSection, { icon: _jsx(IconUpload, { size: 14 }), title: "File uploads", subtitle: "Where user-uploaded files (avatars, chat attachments) are stored.", connected: connected, open: openSection === "uploads", onToggle: () => toggle("uploads"), children: _jsxs("div", { className: "space-y-2", children: [_jsx(UseBuilderCard, { builderFlow: builderFlow, connectUrl: connectUrl, connected: connected, orgName: orgName, envManaged: envManaged, credentialSource: credentialSource }), _jsx(ManualSetupCard, { hint: "Without a provider, files are stored as base64 in your database. Fine for dev, not recommended for production.", docsUrl: "https://www.builder.io/c/docs/agent-native-file-uploads", dim: connected })] }) }), _jsx(SettingsSection, { icon: _jsx(IconShield, { size: 14 }), title: "Authentication", subtitle: "Set up user authentication and access control.", connected: connected, open: openSection === "auth", onToggle: () => toggle("auth"), children: _jsxs("div", { className: "space-y-2", children: [_jsx(UseBuilderCard, { builderFlow: builderFlow, connectUrl: connectUrl, connected: connected, orgName: orgName, envManaged: envManaged, credentialSource: credentialSource }), _jsx(ManualSetupCard, { hint: "Configure Better Auth with BETTER_AUTH_SECRET and optional Google/GitHub OAuth providers.", docsUrl: "https://www.builder.io/c/docs/agent-native-authentication", dim: connected })] }) }), _jsx(EmailSectionInner, { open: openSection === "email", onToggle: () => toggle("email") }), _jsx(SettingsSection, { icon: _jsx(IconBrowser, { size: 14 }), title: "Browser Automation", subtitle: "Let agents control a real browser for web tasks.", connected: connected, open: openSection === "browser", onToggle: () => toggle("browser"), children: _jsx(UseBuilderCard, { builderFlow: builderFlow, connectUrl: connectUrl, connected: connected, orgName: orgName, envManaged: envManaged, credentialSource: credentialSource }) }), builderBranchesAvailable && (_jsx(SettingsSection, { icon: _jsx(IconGitBranch, { size: 14 }), title: "Background Agent", subtitle: "Make code changes from production mode via Builder.", connected: connected, open: openSection === "background", onToggle: () => toggle("background"), children: _jsx(UseBuilderCard, { builderFlow: builderFlow, connectUrl: connectUrl, connected: connected, orgName: orgName, envManaged: envManaged, credentialSource: credentialSource }) })), _jsx(SettingsSection, { icon: _jsx(IconPlugConnected, { size: 14 }), title: "Integrations", subtitle: "Connect messaging platforms and external services.", open: openSection === "integrations", onToggle: () => toggle("integrations"), children: _jsx(Suspense, { fallback: null, children: _jsx(IntegrationsPanel, {}) }) }), _jsx(SettingsSection, { icon: _jsx(IconCoin, { size: 14 }), title: "Usage", subtitle: "Track token consumption and estimated cost \u2014 broken down by chat, automations, and background jobs.", open: openSection === "usage", onToggle: () => toggle("usage"), children: _jsx(UsageSection, {}) }), _jsx(SettingsSection, { icon: _jsx(IconTopologyRing2, { size: 14 }), title: "Connected Agents (A2A)", subtitle: "Manage remote agents connected via the A2A protocol.", open: openSection === "a2a", onToggle: () => toggle("a2a"), children: _jsx(AgentsSection, {}) })] }));
|
|
798
|
+
} })) })), _jsx(CapabilityStatusStrip, { isDevMode: isDevMode, builderConnected: connected, builderLoading: builderLoading, builderBranchesAvailable: builderBranchesAvailable, onOpenLlm: () => openSettingsSection("llm", true) }), _jsx(AccountSectionInner, { open: openSection === "account", onToggle: () => toggle("account") }), _jsx(LLMSectionInner, { builderFlow: builderFlow, builderLoading: builderLoading, connectUrl: connectUrl, connected: connected, orgName: orgName, envManaged: envManaged, credentialSource: credentialSource, open: openSection === "llm", onToggle: () => toggle("llm") }), _jsx(AgentLimitsSectionInner, { open: openSection === "limits", onToggle: () => toggle("limits") }), _jsx(SettingsSection, { icon: _jsx(IconMicrophone, { size: 14 }), title: "Voice Transcription", subtitle: "How the composer microphone turns your voice into text.", open: openSection === "voice", onToggle: () => toggle("voice"), children: _jsx(VoiceTranscriptionSection, {}) }), _jsx(SettingsSection, { icon: _jsx(IconBolt, { size: 14 }), title: "Automations", subtitle: "Event-triggered and scheduled automations.", open: openSection === "automations", onToggle: () => toggle("automations"), children: _jsx(AutomationsSection, {}) }), _jsx(SettingsSection, { id: settingsSectionDomId("secrets"), icon: _jsx(IconKey, { size: 14 }), title: "API Keys & Connections", subtitle: "Service credentials and automation keys.", open: openSection === "secrets", onToggle: () => toggle("secrets"), children: _jsx(SecretsSection, { focusKey: focusSecretKey }) }), _jsx(SettingsSection, { icon: _jsx(IconCloud, { size: 14 }), title: "Hosting", subtitle: "Deploy your app to the cloud.", connected: connected, open: openSection === "hosting", onToggle: () => toggle("hosting"), children: _jsxs("div", { className: "space-y-2", children: [_jsx(UseBuilderCard, { builderFlow: builderFlow, connectUrl: connectUrl, connected: connected, orgName: orgName, envManaged: envManaged, credentialSource: credentialSource }), _jsx(ManualSetupCard, { hint: "Deploy manually to Netlify, Vercel, Cloudflare, or any Nitro-supported target.", docsUrl: "https://www.builder.io/c/docs/agent-native-deployment", dim: connected })] }) }), _jsx(SettingsSection, { icon: _jsx(IconDatabase, { size: 14 }), title: "Database", subtitle: "Connect a cloud database for persistent storage.", connected: connected, open: openSection === "database", onToggle: () => toggle("database"), children: _jsxs("div", { className: "space-y-2", children: [_jsx(UseBuilderCard, { builderFlow: builderFlow, connectUrl: connectUrl, connected: connected, orgName: orgName, envManaged: envManaged, credentialSource: credentialSource }), _jsx(ManualSetupCard, { hint: "Set DATABASE_URL in your .env to connect Neon, Supabase, Turso, or any Postgres/SQLite database.", docsUrl: "https://www.builder.io/c/docs/agent-native-database", dim: connected })] }) }), _jsx(SettingsSection, { icon: _jsx(IconUpload, { size: 14 }), title: "File uploads", subtitle: "Where user-uploaded files (avatars, chat attachments) are stored.", connected: connected, open: openSection === "uploads", onToggle: () => toggle("uploads"), children: _jsxs("div", { className: "space-y-2", children: [_jsx(UseBuilderCard, { builderFlow: builderFlow, connectUrl: connectUrl, connected: connected, orgName: orgName, envManaged: envManaged, credentialSource: credentialSource }), _jsx(ManualSetupCard, { hint: "Without a provider, files are stored as base64 in your database. Fine for dev, not recommended for production.", docsUrl: "https://www.builder.io/c/docs/agent-native-file-uploads", dim: connected })] }) }), _jsx(SettingsSection, { icon: _jsx(IconShield, { size: 14 }), title: "Authentication", subtitle: "Set up user authentication and access control.", connected: connected, open: openSection === "auth", onToggle: () => toggle("auth"), children: _jsxs("div", { className: "space-y-2", children: [_jsx(UseBuilderCard, { builderFlow: builderFlow, connectUrl: connectUrl, connected: connected, orgName: orgName, envManaged: envManaged, credentialSource: credentialSource }), _jsx(ManualSetupCard, { hint: "Configure Better Auth with BETTER_AUTH_SECRET and optional Google/GitHub OAuth providers.", docsUrl: "https://www.builder.io/c/docs/agent-native-authentication", dim: connected })] }) }), _jsx(EmailSectionInner, { open: openSection === "email", onToggle: () => toggle("email") }), _jsx(SettingsSection, { icon: _jsx(IconBrowser, { size: 14 }), title: "Browser Automation", subtitle: "Let agents control a real browser for web tasks.", connected: connected, open: openSection === "browser", onToggle: () => toggle("browser"), children: _jsx(UseBuilderCard, { builderFlow: builderFlow, connectUrl: connectUrl, connected: connected, orgName: orgName, envManaged: envManaged, credentialSource: credentialSource }) }), builderBranchesAvailable && (_jsx(SettingsSection, { icon: _jsx(IconGitBranch, { size: 14 }), title: "Background Agent", subtitle: "Make code changes from production mode via Builder.", connected: connected, open: openSection === "background", onToggle: () => toggle("background"), children: _jsx(UseBuilderCard, { builderFlow: builderFlow, connectUrl: connectUrl, connected: connected, orgName: orgName, envManaged: envManaged, credentialSource: credentialSource }) })), _jsx(SettingsSection, { icon: _jsx(IconPlugConnected, { size: 14 }), title: "Integrations", subtitle: "Connect messaging platforms and external services.", open: openSection === "integrations", onToggle: () => toggle("integrations"), children: _jsx(Suspense, { fallback: null, children: _jsx(IntegrationsPanel, {}) }) }), _jsx(SettingsSection, { icon: _jsx(IconCoin, { size: 14 }), title: "Usage", subtitle: "Track token consumption and estimated cost \u2014 broken down by chat, automations, and background jobs.", open: openSection === "usage", onToggle: () => toggle("usage"), children: _jsx(UsageSection, {}) }), _jsx(SettingsSection, { icon: _jsx(IconTopologyRing2, { size: 14 }), title: "Connected Agents (A2A)", subtitle: "Manage remote agents connected via the A2A protocol.", open: openSection === "a2a", onToggle: () => toggle("a2a"), children: _jsx(AgentsSection, {}) })] }));
|
|
787
799
|
}
|
|
788
800
|
//# sourceMappingURL=SettingsPanel.js.map
|