@burdenoff/microfe-vibecontrols 2026.522.6 → 2026.522.8

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.
@@ -84,19 +84,19 @@ var _ = [
84
84
  }, { key: "OLLAMA_HOST" }]
85
85
  }
86
86
  ];
87
- function v({ agent: t, providerIds: n, initialProviderId: r }) {
88
- let i = e(), a = n ? _.filter((e) => n.includes(e.providerId)) : _, [l, u] = o(() => r && a.some((e) => e.providerId === r) ? r : a.length === 1 ? a[0]?.providerId ?? null : null), f = a.find((e) => e.providerId === l) ?? null;
89
- return f ? /* @__PURE__ */ g("div", {
87
+ function v({ agent: t, providerIds: n, initialProviderId: r, onProviderAuthSatisfiedChange: i }) {
88
+ let a = e(), l = n ? _.filter((e) => n.includes(e.providerId)) : _, [u, f] = o(() => r && l.some((e) => e.providerId === r) ? r : l.length === 1 ? l[0]?.providerId ?? null : null), p = l.find((e) => e.providerId === u) ?? null;
89
+ return p ? /* @__PURE__ */ g("div", {
90
90
  className: "space-y-3",
91
91
  children: [/* @__PURE__ */ g("div", {
92
92
  className: "flex items-center gap-2",
93
93
  children: [
94
- a.length > 1 ? /* @__PURE__ */ g("button", {
94
+ l.length > 1 ? /* @__PURE__ */ g("button", {
95
95
  type: "button",
96
- onClick: () => u(null),
96
+ onClick: () => f(null),
97
97
  className: "inline-flex items-center gap-1 rounded-md border border-border-default px-2 py-1 text-xs text-text-secondary hover:text-text-primary hover:border-border-strong",
98
- "aria-label": i("ai.providerCredentials.back", "Back to providers"),
99
- children: [/* @__PURE__ */ h(s, { className: "h-3.5 w-3.5" }), i("ai.providerCredentials.back", "Back")]
98
+ "aria-label": a("ai.providerCredentials.back", "Back to providers"),
99
+ children: [/* @__PURE__ */ h(s, { className: "h-3.5 w-3.5" }), a("ai.providerCredentials.back", "Back")]
100
100
  }) : null,
101
101
  /* @__PURE__ */ h("div", {
102
102
  className: "rounded-lg bg-bg-sunken p-2 text-text-secondary",
@@ -106,16 +106,17 @@ function v({ agent: t, providerIds: n, initialProviderId: r }) {
106
106
  className: "min-w-0",
107
107
  children: [/* @__PURE__ */ h("h3", {
108
108
  className: "text-sm font-semibold text-text-primary truncate",
109
- children: f.label
109
+ children: p.label
110
110
  }), /* @__PURE__ */ h("p", {
111
111
  className: "text-xs text-text-secondary",
112
- children: i("ai.providerCredentials.scopedDescription", "Keys are stored on the agent and read at session start.")
112
+ children: a("ai.providerCredentials.scopedDescription", "Keys are stored on the agent and read at session start.")
113
113
  })]
114
114
  })
115
115
  ]
116
- }), /* @__PURE__ */ h(y, {
116
+ }), /* @__PURE__ */ h(b, {
117
117
  agent: t,
118
- provider: f
118
+ provider: p,
119
+ onAuthSatisfiedChange: i
119
120
  })]
120
121
  }) : /* @__PURE__ */ g("div", {
121
122
  className: "space-y-3",
@@ -128,17 +129,17 @@ function v({ agent: t, providerIds: n, initialProviderId: r }) {
128
129
  className: "space-y-1",
129
130
  children: [/* @__PURE__ */ h("h3", {
130
131
  className: "text-sm font-semibold text-text-primary",
131
- children: i("ai.providerCredentials.pickTitle", "Choose a provider")
132
+ children: a("ai.providerCredentials.pickTitle", "Choose a provider")
132
133
  }), /* @__PURE__ */ h("p", {
133
134
  className: "text-sm text-text-secondary",
134
- children: i("ai.providerCredentials.pickDescription", "Pick the provider whose credentials you want to manage. Keys are stored on the agent and read at session start.")
135
+ children: a("ai.providerCredentials.pickDescription", "Pick the provider whose credentials you want to manage. Keys are stored on the agent and read at session start.")
135
136
  })]
136
137
  })]
137
138
  }), /* @__PURE__ */ h("div", {
138
139
  className: "grid grid-cols-1 sm:grid-cols-2 gap-2",
139
- children: a.map((e) => /* @__PURE__ */ g("button", {
140
+ children: l.map((e) => /* @__PURE__ */ g("button", {
140
141
  type: "button",
141
- onClick: () => u(e.providerId),
142
+ onClick: () => f(e.providerId),
142
143
  className: "flex items-center justify-between gap-2 rounded-lg border border-border-default bg-bg-surface px-3 py-2 text-left hover:border-border-strong hover:bg-bg-sunken transition-colors",
143
144
  children: [/* @__PURE__ */ g("div", {
144
145
  className: "min-w-0",
@@ -154,83 +155,105 @@ function v({ agent: t, providerIds: n, initialProviderId: r }) {
154
155
  })]
155
156
  });
156
157
  }
157
- function y({ agent: s, provider: c }) {
158
- let l = e(), [u, d] = o({}), [p, m] = o({}), [_, v] = o(!0), [y, x] = o(null), [S, C] = o(null), [w, T] = o(null), E = i(async () => {
159
- v(!0), C(null);
158
+ function y(e) {
159
+ return e.primary ?? e.secret ?? !1;
160
+ }
161
+ function b({ agent: s, provider: c, onAuthSatisfiedChange: l }) {
162
+ let u = e(), [d, p] = o({}), [m, _] = o({}), [v, b] = o({}), [S, C] = o(!0), [w, T] = o(null), [E, D] = o(null), [O, k] = o(null), A = c.fields.filter(y).map((e) => e.key), j = A.filter((e) => (m[e] ?? "").trim().length > 0), M = j.length > 0;
163
+ a(() => {
164
+ l?.(M);
165
+ }, [M, l]);
166
+ let N = i(async () => {
167
+ C(!0), D(null);
160
168
  try {
161
- let e = await Promise.all(c.fields.map(async (e) => [e.key, await n(s, e.key) ?? ""]));
162
- d(Object.fromEntries(e));
169
+ let e = await Promise.all(c.fields.map(async (e) => [e.key, await n(s, e.key) ?? ""])), t = Object.fromEntries(e);
170
+ p(t), _(t);
163
171
  } catch (e) {
164
- C(e instanceof Error ? e.message : l("ai.providerCredentials.loadFailed", "Failed to load provider credentials"));
172
+ D(e instanceof Error ? e.message : u("ai.providerCredentials.loadFailed", "Failed to load provider credentials"));
165
173
  } finally {
166
- v(!1);
174
+ C(!1);
167
175
  }
168
176
  }, [
169
177
  s,
170
178
  c.fields,
171
- l
179
+ u
172
180
  ]);
173
181
  a(() => {
174
- E();
175
- }, [E]);
176
- let D = i(async (e, n) => {
177
- x(e), C(null), T(null);
182
+ N();
183
+ }, [N]);
184
+ let P = i(async (e, n) => {
185
+ T(e), D(null), k(null);
186
+ let i = n.trim();
178
187
  try {
179
- n.trim() ? await r(s, e, n.trim()) : await t(s, e), T(n.trim() ? l("ai.providerCredentials.saved", `${e} saved`) : l("ai.providerCredentials.cleared", `${e} cleared`));
188
+ i ? await r(s, e, i) : await t(s, e), _((t) => ({
189
+ ...t,
190
+ [e]: i
191
+ })), k(i ? u("ai.providerCredentials.saved", `${e} saved`) : u("ai.providerCredentials.cleared", `${e} cleared`));
180
192
  } catch (e) {
181
- C(e instanceof Error ? e.message : l("ai.providerCredentials.saveFailed", "Failed to save credential"));
193
+ D(e instanceof Error ? e.message : u("ai.providerCredentials.saveFailed", "Failed to save credential"));
182
194
  } finally {
183
- x(null);
195
+ T(null);
184
196
  }
185
- }, [s, l]);
197
+ }, [s, u]);
186
198
  return /* @__PURE__ */ g("div", {
187
199
  className: "rounded-xl border border-border-default bg-bg-surface p-4 space-y-3",
188
200
  children: [
189
201
  /* @__PURE__ */ g("div", {
190
202
  className: "space-y-1",
191
- children: [/* @__PURE__ */ h("h4", {
192
- className: "text-sm font-semibold text-text-primary",
193
- children: c.label
194
- }), /* @__PURE__ */ h("p", {
195
- className: "text-xs text-text-secondary",
196
- children: c.description
197
- })]
203
+ children: [
204
+ /* @__PURE__ */ h("h4", {
205
+ className: "text-sm font-semibold text-text-primary",
206
+ children: c.label
207
+ }),
208
+ /* @__PURE__ */ h("p", {
209
+ className: "text-xs text-text-secondary",
210
+ children: c.description
211
+ }),
212
+ A.length > 1 ? /* @__PURE__ */ h("p", {
213
+ className: "text-xs text-text-tertiary",
214
+ children: u("ai.providerCredentials.eitherOr", `Save any one of: ${A.join(" · ")}. You don't need to fill all of them.`)
215
+ }) : null
216
+ ]
198
217
  }),
199
- S ? /* @__PURE__ */ h("div", {
218
+ M ? /* @__PURE__ */ h("div", {
219
+ className: "rounded-lg border border-status-success-border bg-status-success-bg px-3 py-2 text-xs text-status-success-text",
220
+ children: u("ai.providerCredentials.authSatisfied", `${c.label} is ready. The agent will use ${j.join(" / ")} on the next SDK session.`)
221
+ }) : null,
222
+ E ? /* @__PURE__ */ h("div", {
200
223
  className: "rounded-lg border border-status-error-border bg-status-error-bg px-3 py-2 text-sm text-status-error-text",
201
- children: S
224
+ children: E
202
225
  }) : null,
203
- w ? /* @__PURE__ */ h("div", {
226
+ O ? /* @__PURE__ */ h("div", {
204
227
  className: "rounded-lg border border-status-success-border bg-status-success-bg px-3 py-2 text-sm text-status-success-text",
205
- children: w
228
+ children: O
206
229
  }) : null,
207
- _ ? /* @__PURE__ */ g("div", {
230
+ S ? /* @__PURE__ */ g("div", {
208
231
  className: "flex items-center gap-2 text-sm text-text-secondary",
209
- children: [/* @__PURE__ */ h(f, { className: "h-4 w-4 animate-spin" }), l("ai.providerCredentials.loading", "Loading…")]
232
+ children: [/* @__PURE__ */ h(f, { className: "h-4 w-4 animate-spin" }), u("ai.providerCredentials.loading", "Loading…")]
210
233
  }) : /* @__PURE__ */ h("div", {
211
234
  className: "space-y-3",
212
- children: c.fields.map((e) => /* @__PURE__ */ h(b, {
235
+ children: c.fields.map((e) => /* @__PURE__ */ h(x, {
213
236
  label: e.key,
214
237
  secret: e.secret ?? !1,
215
- value: u[e.key] ?? "",
216
- onChange: (t) => d((n) => ({
238
+ value: d[e.key] ?? "",
239
+ onChange: (t) => p((n) => ({
217
240
  ...n,
218
241
  [e.key]: t
219
242
  })),
220
- saving: y === e.key,
221
- visible: p[e.key] ?? !1,
222
- onToggleVisible: () => m((t) => ({
243
+ saving: w === e.key,
244
+ visible: v[e.key] ?? !1,
245
+ onToggleVisible: () => b((t) => ({
223
246
  ...t,
224
247
  [e.key]: !t[e.key]
225
248
  })),
226
- onSave: () => void D(e.key, u[e.key] ?? ""),
227
- onClear: () => void D(e.key, "")
249
+ onSave: () => void P(e.key, d[e.key] ?? ""),
250
+ onClear: () => void P(e.key, "")
228
251
  }, e.key))
229
252
  })
230
253
  ]
231
254
  });
232
255
  }
233
- function b({ label: e, secret: t, value: n, onChange: r, saving: i, visible: a, onToggleVisible: o, onSave: s, onClear: c }) {
256
+ function x({ label: e, secret: t, value: n, onChange: r, saving: i, visible: a, onToggleVisible: o, onSave: s, onClear: c }) {
234
257
  return /* @__PURE__ */ g("div", {
235
258
  className: "space-y-2 rounded-lg border border-border-default bg-bg-primary p-3",
236
259
  children: [/* @__PURE__ */ h("label", {
@@ -1 +1 @@
1
- {"version":3,"file":"AIProviderCredentialsCard.js","names":[],"sources":["../../../src/components/ai/AIProviderCredentialsCard.tsx"],"sourcesContent":["import { useCallback, useEffect, useState } from 'react';\nimport {\n ArrowLeft,\n ChevronRight,\n Eye,\n EyeOff,\n KeyRound,\n Loader2,\n Save,\n Trash2,\n} from 'lucide-react';\n\nimport { useTr } from '../../shared/hooks/useTr';\nimport {\n deleteAgentConfigValue,\n getAgentConfigValue,\n setAgentConfigValue,\n type AgentRef,\n} from '@/services/aiApi';\n\n/**\n * One provider definition — what env-var-style keys the agent stores under\n * its config bag and what to call the provider in the UI. Kept as a flat\n * static list rather than discovered from the plugin manifest because the\n * config keys are part of the upstream SDK contract (ANTHROPIC_API_KEY,\n * OPENAI_API_KEY, etc.) and don't change with each plugin release.\n */\nexport interface AIProviderCredentialDef {\n /** Stable provider id — usually matches the plugin's pluginName. */\n providerId: string;\n /** Display name shown in the card heading. */\n label: string;\n /** Short helper text under the heading. */\n description: string;\n /**\n * One row per key. The `kind` distinguishes a primary credential (for\n * which the SDK refuses to start without ONE of the listed keys) from\n * an optional URL/host override.\n */\n fields: Array<{\n /** Agent-config key name, also rendered as the input label. */\n key: string;\n /**\n * Whether the field is a secret (rendered as password with eye toggle)\n * or a plain string (URL / host overrides — visible by default).\n */\n secret?: boolean;\n }>;\n}\n\n/**\n * Catalog of every AI provider whose plugin reads credentials from the\n * agent's config bag (POST /api/config). CLI-only providers (Aider, Amp,\n * Copilot, Crush, Goose, Plandex, Pi) authenticate via their own harness\n * binary (~/.claude/, ~/.config/opencode/ etc.) — Bridle handles those\n * and they don't appear here.\n */\nexport const AI_PROVIDER_CREDENTIALS: AIProviderCredentialDef[] = [\n {\n providerId: 'claude',\n label: 'Anthropic Claude',\n description:\n 'Claude SDK sessions require either ANTHROPIC_API_KEY or ANTHROPIC_AUTH_TOKEN on the agent. Save one of them to make SDK sessions work.',\n fields: [\n { key: 'ANTHROPIC_API_KEY', secret: true },\n { key: 'ANTHROPIC_AUTH_TOKEN', secret: true },\n ],\n },\n {\n providerId: 'codex',\n label: 'OpenAI Codex',\n description:\n 'Codex SDK / CLI sessions read OPENAI_API_KEY from the agent. Set it here to enable Codex-backed sessions.',\n fields: [{ key: 'OPENAI_API_KEY', secret: true }],\n },\n {\n providerId: 'gemini',\n label: 'Google Gemini',\n description:\n 'Gemini SDK reads GEMINI_API_KEY (preferred) or GOOGLE_API_KEY. Either one works — both shown so an existing GOOGLE_API_KEY in your environment keeps working.',\n fields: [\n { key: 'GEMINI_API_KEY', secret: true },\n { key: 'GOOGLE_API_KEY', secret: true },\n ],\n },\n {\n providerId: 'openai-compat',\n label: 'OpenAI-Compatible',\n description:\n 'Generic OpenAI-compatible provider (Together, Groq, Mistral, etc.). Set the API key and the base URL the SDK should hit.',\n fields: [{ key: 'OPENAI_COMPAT_API_KEY', secret: true }, { key: 'OPENAI_COMPAT_BASE_URL' }],\n },\n {\n providerId: 'cursor',\n label: 'Cursor',\n description:\n 'Cursor agent (CLI + SDK) reads CURSOR_API_KEY from the agent. Set it here to enable both modes.',\n fields: [{ key: 'CURSOR_API_KEY', secret: true }],\n },\n {\n providerId: 'openrouter',\n label: 'OpenRouter',\n description: 'OpenRouter aggregator (300+ models, SDK only). Set OPENROUTER_API_KEY to enable.',\n fields: [{ key: 'OPENROUTER_API_KEY', secret: true }],\n },\n {\n providerId: 'minimax',\n label: 'Minimax',\n description:\n 'Minimax provider (CLI + Anthropic-compatible SDK). Set MINIMAX_API_KEY to enable.',\n fields: [{ key: 'MINIMAX_API_KEY', secret: true }],\n },\n {\n providerId: 'ollama',\n label: 'Ollama',\n description:\n 'Ollama Cloud + self-hosted (CLI + SDK). OLLAMA_API_KEY for Cloud; OLLAMA_HOST optional override (defaults: https://ollama.com when key present, http://localhost:11434 otherwise).',\n fields: [{ key: 'OLLAMA_API_KEY', secret: true }, { key: 'OLLAMA_HOST' }],\n },\n];\n\ninterface AIProviderCredentialsCardProps {\n agent: AgentRef;\n /**\n * Optional filter — when present, only render providers whose providerId\n * appears in the list. Lets a future caller scope the card to \"only the\n * providers I have plugins installed for\" without changing the catalog.\n */\n providerIds?: string[];\n /**\n * When provided, the staged picker preselects this provider so the\n * caller (e.g. the SDK-auth-missing modal) can drop the user straight\n * onto the right form without an extra click.\n */\n initialProviderId?: string;\n}\n\n/**\n * Staged credentials manager: shows a provider picker first, then on\n * select renders one card with that provider's config keys plus a back\n * button. Keeps the rendered DOM small (and the surrounding modal\n * viewport-friendly) regardless of how many providers are in the catalog.\n *\n * Replaces the older Claude-only ClaudeCredentialsCard.\n */\nexport function AIProviderCredentialsCard({\n agent,\n providerIds,\n initialProviderId,\n}: AIProviderCredentialsCardProps) {\n const tr = useTr();\n const providers = providerIds\n ? AI_PROVIDER_CREDENTIALS.filter((p) => providerIds.includes(p.providerId))\n : AI_PROVIDER_CREDENTIALS;\n\n // Preselect when the catalog narrows to exactly one provider so the\n // single-provider case (e.g. claude-only filter) skips the picker.\n const [selectedId, setSelectedId] = useState<string | null>(() => {\n if (initialProviderId && providers.some((p) => p.providerId === initialProviderId)) {\n return initialProviderId;\n }\n return providers.length === 1 ? (providers[0]?.providerId ?? null) : null;\n });\n\n const selected = providers.find((p) => p.providerId === selectedId) ?? null;\n\n if (!selected) {\n return (\n <div className=\"space-y-3\">\n <div className=\"flex items-start gap-3\">\n <div className=\"rounded-lg bg-bg-sunken p-2 text-text-secondary\">\n <KeyRound className=\"h-4 w-4\" />\n </div>\n <div className=\"space-y-1\">\n <h3 className=\"text-sm font-semibold text-text-primary\">\n {tr('ai.providerCredentials.pickTitle', 'Choose a provider')}\n </h3>\n <p className=\"text-sm text-text-secondary\">\n {tr(\n 'ai.providerCredentials.pickDescription',\n 'Pick the provider whose credentials you want to manage. Keys are stored on the agent and read at session start.'\n )}\n </p>\n </div>\n </div>\n <div className=\"grid grid-cols-1 sm:grid-cols-2 gap-2\">\n {providers.map((p) => (\n <button\n key={p.providerId}\n type=\"button\"\n onClick={() => setSelectedId(p.providerId)}\n className=\"flex items-center justify-between gap-2 rounded-lg border border-border-default bg-bg-surface px-3 py-2 text-left hover:border-border-strong hover:bg-bg-sunken transition-colors\"\n >\n <div className=\"min-w-0\">\n <div className=\"text-sm font-medium text-text-primary truncate\">{p.label}</div>\n <div className=\"text-xs text-text-secondary truncate\">\n {p.fields.map((f) => f.key).join(', ')}\n </div>\n </div>\n <ChevronRight className=\"h-4 w-4 flex-shrink-0 text-text-secondary\" />\n </button>\n ))}\n </div>\n </div>\n );\n }\n\n return (\n <div className=\"space-y-3\">\n <div className=\"flex items-center gap-2\">\n {providers.length > 1 ? (\n <button\n type=\"button\"\n onClick={() => setSelectedId(null)}\n className=\"inline-flex items-center gap-1 rounded-md border border-border-default px-2 py-1 text-xs text-text-secondary hover:text-text-primary hover:border-border-strong\"\n aria-label={tr('ai.providerCredentials.back', 'Back to providers')}\n >\n <ArrowLeft className=\"h-3.5 w-3.5\" />\n {tr('ai.providerCredentials.back', 'Back')}\n </button>\n ) : null}\n <div className=\"rounded-lg bg-bg-sunken p-2 text-text-secondary\">\n <KeyRound className=\"h-4 w-4\" />\n </div>\n <div className=\"min-w-0\">\n <h3 className=\"text-sm font-semibold text-text-primary truncate\">{selected.label}</h3>\n <p className=\"text-xs text-text-secondary\">\n {tr(\n 'ai.providerCredentials.scopedDescription',\n 'Keys are stored on the agent and read at session start.'\n )}\n </p>\n </div>\n </div>\n <ProviderCard agent={agent} provider={selected} />\n </div>\n );\n}\n\nfunction ProviderCard({ agent, provider }: { agent: AgentRef; provider: AIProviderCredentialDef }) {\n const tr = useTr();\n const [values, setValues] = useState<Record<string, string>>({});\n const [visible, setVisible] = useState<Record<string, boolean>>({});\n const [loading, setLoading] = useState(true);\n const [saving, setSaving] = useState<string | null>(null);\n const [error, setError] = useState<string | null>(null);\n const [success, setSuccess] = useState<string | null>(null);\n\n const loadValues = useCallback(async () => {\n setLoading(true);\n setError(null);\n try {\n const entries = await Promise.all(\n provider.fields.map(async (f) => [f.key, (await getAgentConfigValue(agent, f.key)) ?? ''])\n );\n setValues(Object.fromEntries(entries));\n } catch (err) {\n setError(\n err instanceof Error\n ? err.message\n : tr('ai.providerCredentials.loadFailed', 'Failed to load provider credentials')\n );\n } finally {\n setLoading(false);\n }\n }, [agent, provider.fields, tr]);\n\n useEffect(() => {\n void loadValues();\n }, [loadValues]);\n\n const persistValue = useCallback(\n async (key: string, value: string) => {\n setSaving(key);\n setError(null);\n setSuccess(null);\n try {\n if (value.trim()) {\n await setAgentConfigValue(agent, key, value.trim());\n } else {\n await deleteAgentConfigValue(agent, key);\n }\n setSuccess(\n value.trim()\n ? tr('ai.providerCredentials.saved', `${key} saved`)\n : tr('ai.providerCredentials.cleared', `${key} cleared`)\n );\n } catch (err) {\n setError(\n err instanceof Error\n ? err.message\n : tr('ai.providerCredentials.saveFailed', 'Failed to save credential')\n );\n } finally {\n setSaving(null);\n }\n },\n [agent, tr]\n );\n\n return (\n <div className=\"rounded-xl border border-border-default bg-bg-surface p-4 space-y-3\">\n <div className=\"space-y-1\">\n <h4 className=\"text-sm font-semibold text-text-primary\">{provider.label}</h4>\n <p className=\"text-xs text-text-secondary\">{provider.description}</p>\n </div>\n\n {error ? (\n <div className=\"rounded-lg border border-status-error-border bg-status-error-bg px-3 py-2 text-sm text-status-error-text\">\n {error}\n </div>\n ) : null}\n {success ? (\n <div className=\"rounded-lg border border-status-success-border bg-status-success-bg px-3 py-2 text-sm text-status-success-text\">\n {success}\n </div>\n ) : null}\n\n {loading ? (\n <div className=\"flex items-center gap-2 text-sm text-text-secondary\">\n <Loader2 className=\"h-4 w-4 animate-spin\" />\n {tr('ai.providerCredentials.loading', 'Loading…')}\n </div>\n ) : (\n <div className=\"space-y-3\">\n {provider.fields.map((f) => (\n <CredentialField\n key={f.key}\n label={f.key}\n secret={f.secret ?? false}\n value={values[f.key] ?? ''}\n onChange={(v) => setValues((cur) => ({ ...cur, [f.key]: v }))}\n saving={saving === f.key}\n visible={visible[f.key] ?? false}\n onToggleVisible={() => setVisible((cur) => ({ ...cur, [f.key]: !cur[f.key] }))}\n onSave={() => void persistValue(f.key, values[f.key] ?? '')}\n onClear={() => void persistValue(f.key, '')}\n />\n ))}\n </div>\n )}\n </div>\n );\n}\n\ninterface CredentialFieldProps {\n label: string;\n secret: boolean;\n value: string;\n onChange: (value: string) => void;\n saving: boolean;\n visible: boolean;\n onToggleVisible: () => void;\n onSave: () => void;\n onClear: () => void;\n}\n\nfunction CredentialField({\n label,\n secret,\n value,\n onChange,\n saving,\n visible,\n onToggleVisible,\n onSave,\n onClear,\n}: CredentialFieldProps) {\n const showAsPassword = secret && !visible;\n return (\n <div className=\"space-y-2 rounded-lg border border-border-default bg-bg-primary p-3\">\n <label className=\"block text-xs font-medium text-text-secondary\">{label}</label>\n <div className=\"flex gap-2\">\n <div className=\"relative flex-1\">\n <input\n type={showAsPassword ? 'password' : 'text'}\n value={value}\n onChange={(event) => onChange(event.target.value)}\n autoComplete=\"off\"\n spellCheck={false}\n className=\"w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 pr-10 text-sm text-text-primary\"\n />\n {secret ? (\n <button\n type=\"button\"\n onClick={onToggleVisible}\n className=\"absolute right-2 top-1/2 -translate-y-1/2 text-text-secondary hover:text-text-primary\"\n >\n {visible ? <EyeOff className=\"h-4 w-4\" /> : <Eye className=\"h-4 w-4\" />}\n </button>\n ) : null}\n </div>\n <button\n type=\"button\"\n onClick={onSave}\n disabled={saving}\n className=\"inline-flex items-center gap-1.5 rounded-md bg-action-primary-bg px-3 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg-hover disabled:opacity-50\"\n >\n {saving ? <Loader2 className=\"h-4 w-4 animate-spin\" /> : <Save className=\"h-4 w-4\" />}\n Save\n </button>\n <button\n type=\"button\"\n onClick={onClear}\n disabled={saving || !value}\n className=\"inline-flex items-center gap-1.5 rounded-md border border-border-default px-3 py-2 text-sm font-medium text-text-secondary hover:text-text-primary hover:border-border-strong disabled:opacity-50\"\n >\n <Trash2 className=\"h-4 w-4\" />\n Clear\n </button>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;AAyDA,IAAa,IAAqD;CAChE;EACE,YAAY;EACZ,OAAO;EACP,aACE;EACF,QAAQ,CACN;GAAE,KAAK;GAAqB,QAAQ;GAAM,EAC1C;GAAE,KAAK;GAAwB,QAAQ;GAAM,CAC9C;EACF;CACD;EACE,YAAY;EACZ,OAAO;EACP,aACE;EACF,QAAQ,CAAC;GAAE,KAAK;GAAkB,QAAQ;GAAM,CAAC;EAClD;CACD;EACE,YAAY;EACZ,OAAO;EACP,aACE;EACF,QAAQ,CACN;GAAE,KAAK;GAAkB,QAAQ;GAAM,EACvC;GAAE,KAAK;GAAkB,QAAQ;GAAM,CACxC;EACF;CACD;EACE,YAAY;EACZ,OAAO;EACP,aACE;EACF,QAAQ,CAAC;GAAE,KAAK;GAAyB,QAAQ;GAAM,EAAE,EAAE,KAAK,0BAA0B,CAAC;EAC5F;CACD;EACE,YAAY;EACZ,OAAO;EACP,aACE;EACF,QAAQ,CAAC;GAAE,KAAK;GAAkB,QAAQ;GAAM,CAAC;EAClD;CACD;EACE,YAAY;EACZ,OAAO;EACP,aAAa;EACb,QAAQ,CAAC;GAAE,KAAK;GAAsB,QAAQ;GAAM,CAAC;EACtD;CACD;EACE,YAAY;EACZ,OAAO;EACP,aACE;EACF,QAAQ,CAAC;GAAE,KAAK;GAAmB,QAAQ;GAAM,CAAC;EACnD;CACD;EACE,YAAY;EACZ,OAAO;EACP,aACE;EACF,QAAQ,CAAC;GAAE,KAAK;GAAkB,QAAQ;GAAM,EAAE,EAAE,KAAK,eAAe,CAAC;EAC1E;CACF;AA0BD,SAAgB,EAA0B,EACxC,UACA,gBACA,wBACiC;CACjC,IAAM,IAAK,GAAO,EACZ,IAAY,IACd,EAAwB,QAAQ,MAAM,EA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KAAK,GAAG;KAC3C,EAVK,EAAE,IAUP,CACF;IACE,CAAA;GAEJ;;;AAgBV,SAAS,EAAgB,EACvB,UACA,WACA,UACA,aACA,WACA,YACA,oBACA,WACA,cACuB;AAEvB,QACE,kBAAC,OAAD;EAAK,WAAU;YAAf,CACE,kBAAC,SAAD;GAAO,WAAU;aAAiD;GAAc,CAAA,EAChF,kBAAC,OAAD;GAAK,WAAU;aAAf;IACE,kBAAC,OAAD;KAAK,WAAU;eAAf,CACE,kBAAC,SAAD;MACE,MAPa,KAAU,CAAC,IAOD,aAAa;MAC7B;MACP,WAAW,MAAU,EAAS,EAAM,OAAO,MAAM;MACjD,cAAa;MACb,YAAY;MACZ,WAAU;MACV,CAAA,EACD,IACC,kBAAC,UAAD;MACE,MAAK;MACL,SAAS;MACT,WAAU;gBAEC,EAAV,IAAW,IAAiC,GAAlC,EAAQ,WAAU,WAAY,CAA8B;MAChE,CAAA,GACP,KACA;;IACN,kBAAC,UAAD;KACE,MAAK;KACL,SAAS;KACT,UAAU;KACV,WAAU;eAJZ,CAMG,IAAS,kBAAC,GAAD,EAAS,WAAU,wBAAyB,CAAA,GAAG,kBAAC,GAAD,EAAM,WAAU,WAAY,CAAA,EAAC,OAE/E;;IACT,kBAAC,UAAD;KACE,MAAK;KACL,SAAS;KACT,UAAU,KAAU,CAAC;KACrB,WAAU;eAJZ,CAME,kBAAC,GAAD,EAAQ,WAAU,WAAY,CAAA,EAAA,QAEvB;;IACL;KACF"}
1
+ {"version":3,"file":"AIProviderCredentialsCard.js","names":[],"sources":["../../../src/components/ai/AIProviderCredentialsCard.tsx"],"sourcesContent":["import { useCallback, useEffect, useState } from 'react';\nimport {\n ArrowLeft,\n ChevronRight,\n Eye,\n EyeOff,\n KeyRound,\n Loader2,\n Save,\n Trash2,\n} from 'lucide-react';\n\nimport { useTr } from '../../shared/hooks/useTr';\nimport {\n deleteAgentConfigValue,\n getAgentConfigValue,\n setAgentConfigValue,\n type AgentRef,\n} from '@/services/aiApi';\n\n/**\n * One provider definition — what env-var-style keys the agent stores under\n * its config bag and what to call the provider in the UI. Kept as a flat\n * static list rather than discovered from the plugin manifest because the\n * config keys are part of the upstream SDK contract (ANTHROPIC_API_KEY,\n * OPENAI_API_KEY, etc.) and don't change with each plugin release.\n */\nexport interface AIProviderCredentialDef {\n /** Stable provider id — usually matches the plugin's pluginName. */\n providerId: string;\n /** Display name shown in the card heading. */\n label: string;\n /** Short helper text under the heading. */\n description: string;\n /**\n * One row per key. The `kind` distinguishes a primary credential (for\n * which the SDK refuses to start without ONE of the listed keys) from\n * an optional URL/host override.\n */\n fields: Array<{\n /** Agent-config key name, also rendered as the input label. */\n key: string;\n /**\n * Whether the field is a secret (rendered as password with eye toggle)\n * or a plain string (URL / host overrides — visible by default).\n */\n secret?: boolean;\n /**\n * Whether saving this field alone (or any sibling field with\n * primary=true) is enough to authenticate the provider. The card\n * surfaces an \"at least one set\" indicator using this — used by the\n * SDK-auth-missing modal to enable the Continue button as soon as\n * either ANTHROPIC_API_KEY *or* ANTHROPIC_AUTH_TOKEN is saved.\n *\n * Defaults to `true` for secret fields and `false` for plain-text\n * overrides (URLs/hosts). Set explicitly when a secret field is\n * supplementary rather than authentication-conferring.\n */\n primary?: boolean;\n }>;\n}\n\n/**\n * Catalog of every AI provider whose plugin reads credentials from the\n * agent's config bag (POST /api/config). CLI-only providers (Aider, Amp,\n * Copilot, Crush, Goose, Plandex, Pi) authenticate via their own harness\n * binary (~/.claude/, ~/.config/opencode/ etc.) — Bridle handles those\n * and they don't appear here.\n */\nexport const AI_PROVIDER_CREDENTIALS: AIProviderCredentialDef[] = [\n {\n providerId: 'claude',\n label: 'Anthropic Claude',\n description:\n 'Claude SDK sessions require either ANTHROPIC_API_KEY or ANTHROPIC_AUTH_TOKEN on the agent. Save one of them to make SDK sessions work.',\n fields: [\n { key: 'ANTHROPIC_API_KEY', secret: true },\n { key: 'ANTHROPIC_AUTH_TOKEN', secret: true },\n ],\n },\n {\n providerId: 'codex',\n label: 'OpenAI Codex',\n description:\n 'Codex SDK / CLI sessions read OPENAI_API_KEY from the agent. Set it here to enable Codex-backed sessions.',\n fields: [{ key: 'OPENAI_API_KEY', secret: true }],\n },\n {\n providerId: 'gemini',\n label: 'Google Gemini',\n description:\n 'Gemini SDK reads GEMINI_API_KEY (preferred) or GOOGLE_API_KEY. Either one works — both shown so an existing GOOGLE_API_KEY in your environment keeps working.',\n fields: [\n { key: 'GEMINI_API_KEY', secret: true },\n { key: 'GOOGLE_API_KEY', secret: true },\n ],\n },\n {\n providerId: 'openai-compat',\n label: 'OpenAI-Compatible',\n description:\n 'Generic OpenAI-compatible provider (Together, Groq, Mistral, etc.). Set the API key and the base URL the SDK should hit.',\n fields: [{ key: 'OPENAI_COMPAT_API_KEY', secret: true }, { key: 'OPENAI_COMPAT_BASE_URL' }],\n },\n {\n providerId: 'cursor',\n label: 'Cursor',\n description:\n 'Cursor agent (CLI + SDK) reads CURSOR_API_KEY from the agent. Set it here to enable both modes.',\n fields: [{ key: 'CURSOR_API_KEY', secret: true }],\n },\n {\n providerId: 'openrouter',\n label: 'OpenRouter',\n description: 'OpenRouter aggregator (300+ models, SDK only). Set OPENROUTER_API_KEY to enable.',\n fields: [{ key: 'OPENROUTER_API_KEY', secret: true }],\n },\n {\n providerId: 'minimax',\n label: 'Minimax',\n description:\n 'Minimax provider (CLI + Anthropic-compatible SDK). Set MINIMAX_API_KEY to enable.',\n fields: [{ key: 'MINIMAX_API_KEY', secret: true }],\n },\n {\n providerId: 'ollama',\n label: 'Ollama',\n description:\n 'Ollama Cloud + self-hosted (CLI + SDK). OLLAMA_API_KEY for Cloud; OLLAMA_HOST optional override (defaults: https://ollama.com when key present, http://localhost:11434 otherwise).',\n fields: [{ key: 'OLLAMA_API_KEY', secret: true }, { key: 'OLLAMA_HOST' }],\n },\n];\n\ninterface AIProviderCredentialsCardProps {\n agent: AgentRef;\n /**\n * Optional filter — when present, only render providers whose providerId\n * appears in the list. Lets a future caller scope the card to \"only the\n * providers I have plugins installed for\" without changing the catalog.\n */\n providerIds?: string[];\n /**\n * When provided, the staged picker preselects this provider so the\n * caller (e.g. the SDK-auth-missing modal) can drop the user straight\n * onto the right form without an extra click.\n */\n initialProviderId?: string;\n /**\n * Fires whenever the currently-selected provider's saved-state changes\n * on disk. `satisfied` is true when at least one primary (auth-conferring)\n * field has a saved non-empty value. Used by the SDK-auth-missing modal\n * to enable a Continue affordance the moment the user persists any\n * acceptable credential, without forcing them to also fill the others.\n */\n onProviderAuthSatisfiedChange?: (satisfied: boolean) => void;\n}\n\n/**\n * Staged credentials manager: shows a provider picker first, then on\n * select renders one card with that provider's config keys plus a back\n * button. Keeps the rendered DOM small (and the surrounding modal\n * viewport-friendly) regardless of how many providers are in the catalog.\n *\n * Replaces the older Claude-only ClaudeCredentialsCard.\n */\nexport function AIProviderCredentialsCard({\n agent,\n providerIds,\n initialProviderId,\n onProviderAuthSatisfiedChange,\n}: AIProviderCredentialsCardProps) {\n const tr = useTr();\n const providers = providerIds\n ? AI_PROVIDER_CREDENTIALS.filter((p) => providerIds.includes(p.providerId))\n : AI_PROVIDER_CREDENTIALS;\n\n // Preselect when the catalog narrows to exactly one provider so the\n // single-provider case (e.g. claude-only filter) skips the picker.\n const [selectedId, setSelectedId] = useState<string | null>(() => {\n if (initialProviderId && providers.some((p) => p.providerId === initialProviderId)) {\n return initialProviderId;\n }\n return providers.length === 1 ? (providers[0]?.providerId ?? null) : null;\n });\n\n const selected = providers.find((p) => p.providerId === selectedId) ?? null;\n\n if (!selected) {\n return (\n <div className=\"space-y-3\">\n <div className=\"flex items-start gap-3\">\n <div className=\"rounded-lg bg-bg-sunken p-2 text-text-secondary\">\n <KeyRound className=\"h-4 w-4\" />\n </div>\n <div className=\"space-y-1\">\n <h3 className=\"text-sm font-semibold text-text-primary\">\n {tr('ai.providerCredentials.pickTitle', 'Choose a provider')}\n </h3>\n <p className=\"text-sm text-text-secondary\">\n {tr(\n 'ai.providerCredentials.pickDescription',\n 'Pick the provider whose credentials you want to manage. Keys are stored on the agent and read at session start.'\n )}\n </p>\n </div>\n </div>\n <div className=\"grid grid-cols-1 sm:grid-cols-2 gap-2\">\n {providers.map((p) => (\n <button\n key={p.providerId}\n type=\"button\"\n onClick={() => setSelectedId(p.providerId)}\n className=\"flex items-center justify-between gap-2 rounded-lg border border-border-default bg-bg-surface px-3 py-2 text-left hover:border-border-strong hover:bg-bg-sunken transition-colors\"\n >\n <div className=\"min-w-0\">\n <div className=\"text-sm font-medium text-text-primary truncate\">{p.label}</div>\n <div className=\"text-xs text-text-secondary truncate\">\n {p.fields.map((f) => f.key).join(', ')}\n </div>\n </div>\n <ChevronRight className=\"h-4 w-4 flex-shrink-0 text-text-secondary\" />\n </button>\n ))}\n </div>\n </div>\n );\n }\n\n return (\n <div className=\"space-y-3\">\n <div className=\"flex items-center gap-2\">\n {providers.length > 1 ? (\n <button\n type=\"button\"\n onClick={() => setSelectedId(null)}\n className=\"inline-flex items-center gap-1 rounded-md border border-border-default px-2 py-1 text-xs text-text-secondary hover:text-text-primary hover:border-border-strong\"\n aria-label={tr('ai.providerCredentials.back', 'Back to providers')}\n >\n <ArrowLeft className=\"h-3.5 w-3.5\" />\n {tr('ai.providerCredentials.back', 'Back')}\n </button>\n ) : null}\n <div className=\"rounded-lg bg-bg-sunken p-2 text-text-secondary\">\n <KeyRound className=\"h-4 w-4\" />\n </div>\n <div className=\"min-w-0\">\n <h3 className=\"text-sm font-semibold text-text-primary truncate\">{selected.label}</h3>\n <p className=\"text-xs text-text-secondary\">\n {tr(\n 'ai.providerCredentials.scopedDescription',\n 'Keys are stored on the agent and read at session start.'\n )}\n </p>\n </div>\n </div>\n <ProviderCard\n agent={agent}\n provider={selected}\n onAuthSatisfiedChange={onProviderAuthSatisfiedChange}\n />\n </div>\n );\n}\n\nfunction isPrimaryField(f: AIProviderCredentialDef['fields'][number]): boolean {\n // Defaults: secret fields gate auth; URL/host overrides don't.\n return f.primary ?? f.secret ?? false;\n}\n\nfunction ProviderCard({\n agent,\n provider,\n onAuthSatisfiedChange,\n}: {\n agent: AgentRef;\n provider: AIProviderCredentialDef;\n onAuthSatisfiedChange?: (satisfied: boolean) => void;\n}) {\n const tr = useTr();\n const [values, setValues] = useState<Record<string, string>>({});\n // savedValues tracks what's actually on the agent (last successful\n // load/persist), not the unsaved input buffer. This is what drives the\n // \"auth satisfied\" indicator — typing an API key in the field doesn't\n // count until the user hits Save.\n const [savedValues, setSavedValues] = useState<Record<string, string>>({});\n const [visible, setVisible] = useState<Record<string, boolean>>({});\n const [loading, setLoading] = useState(true);\n const [saving, setSaving] = useState<string | null>(null);\n const [error, setError] = useState<string | null>(null);\n const [success, setSuccess] = useState<string | null>(null);\n\n const primaryKeys = provider.fields.filter(isPrimaryField).map((f) => f.key);\n const satisfiedPrimaryKeys = primaryKeys.filter((k) => (savedValues[k] ?? '').trim().length > 0);\n const authSatisfied = satisfiedPrimaryKeys.length > 0;\n\n // Notify parent whenever satisfied flips. Effect (not inline call) so\n // children don't render-during-render of the parent.\n useEffect(() => {\n onAuthSatisfiedChange?.(authSatisfied);\n }, [authSatisfied, onAuthSatisfiedChange]);\n\n const loadValues = useCallback(async () => {\n setLoading(true);\n setError(null);\n try {\n const entries = await Promise.all(\n provider.fields.map(async (f) => [f.key, (await getAgentConfigValue(agent, f.key)) ?? ''])\n );\n const next = Object.fromEntries(entries);\n setValues(next);\n setSavedValues(next);\n } catch (err) {\n setError(\n err instanceof Error\n ? err.message\n : tr('ai.providerCredentials.loadFailed', 'Failed to load provider credentials')\n );\n } finally {\n setLoading(false);\n }\n }, [agent, provider.fields, tr]);\n\n useEffect(() => {\n void loadValues();\n }, [loadValues]);\n\n const persistValue = useCallback(\n async (key: string, value: string) => {\n setSaving(key);\n setError(null);\n setSuccess(null);\n const trimmed = value.trim();\n try {\n if (trimmed) {\n await setAgentConfigValue(agent, key, trimmed);\n } else {\n await deleteAgentConfigValue(agent, key);\n }\n // Mirror the persisted result into savedValues so the auth-\n // satisfied banner / Continue button update immediately.\n setSavedValues((cur) => ({ ...cur, [key]: trimmed }));\n setSuccess(\n trimmed\n ? tr('ai.providerCredentials.saved', `${key} saved`)\n : tr('ai.providerCredentials.cleared', `${key} cleared`)\n );\n } catch (err) {\n setError(\n err instanceof Error\n ? err.message\n : tr('ai.providerCredentials.saveFailed', 'Failed to save credential')\n );\n } finally {\n setSaving(null);\n }\n },\n [agent, tr]\n );\n\n return (\n <div className=\"rounded-xl border border-border-default bg-bg-surface p-4 space-y-3\">\n <div className=\"space-y-1\">\n <h4 className=\"text-sm font-semibold text-text-primary\">{provider.label}</h4>\n <p className=\"text-xs text-text-secondary\">{provider.description}</p>\n {primaryKeys.length > 1 ? (\n <p className=\"text-xs text-text-tertiary\">\n {tr(\n 'ai.providerCredentials.eitherOr',\n `Save any one of: ${primaryKeys.join(' · ')}. You don't need to fill all of them.`\n )}\n </p>\n ) : null}\n </div>\n\n {/* Auth-satisfied banner — surfaces the moment any primary credential\n is persisted on the agent. The SDK-auth-missing modal pairs this\n with a Continue button so the user knows they can proceed. */}\n {authSatisfied ? (\n <div className=\"rounded-lg border border-status-success-border bg-status-success-bg px-3 py-2 text-xs text-status-success-text\">\n {tr(\n 'ai.providerCredentials.authSatisfied',\n `${provider.label} is ready. The agent will use ${satisfiedPrimaryKeys.join(' / ')} on the next SDK session.`\n )}\n </div>\n ) : null}\n\n {error ? (\n <div className=\"rounded-lg border border-status-error-border bg-status-error-bg px-3 py-2 text-sm text-status-error-text\">\n {error}\n </div>\n ) : null}\n {success ? (\n <div className=\"rounded-lg border border-status-success-border bg-status-success-bg px-3 py-2 text-sm text-status-success-text\">\n {success}\n </div>\n ) : null}\n\n {loading ? (\n <div className=\"flex items-center gap-2 text-sm text-text-secondary\">\n <Loader2 className=\"h-4 w-4 animate-spin\" />\n {tr('ai.providerCredentials.loading', 'Loading…')}\n </div>\n ) : (\n <div className=\"space-y-3\">\n {provider.fields.map((f) => (\n <CredentialField\n key={f.key}\n label={f.key}\n secret={f.secret ?? false}\n value={values[f.key] ?? ''}\n onChange={(v) => setValues((cur) => ({ ...cur, [f.key]: v }))}\n saving={saving === f.key}\n visible={visible[f.key] ?? false}\n onToggleVisible={() => setVisible((cur) => ({ ...cur, [f.key]: !cur[f.key] }))}\n onSave={() => void persistValue(f.key, values[f.key] ?? '')}\n onClear={() => void persistValue(f.key, '')}\n />\n ))}\n </div>\n )}\n </div>\n );\n}\n\ninterface CredentialFieldProps {\n label: string;\n secret: boolean;\n value: string;\n onChange: (value: string) => void;\n saving: boolean;\n visible: boolean;\n onToggleVisible: () => void;\n onSave: () => void;\n onClear: () => void;\n}\n\nfunction CredentialField({\n label,\n secret,\n value,\n onChange,\n saving,\n visible,\n onToggleVisible,\n onSave,\n onClear,\n}: CredentialFieldProps) {\n const showAsPassword = secret && !visible;\n return (\n <div className=\"space-y-2 rounded-lg border border-border-default bg-bg-primary p-3\">\n <label className=\"block text-xs font-medium text-text-secondary\">{label}</label>\n <div className=\"flex gap-2\">\n <div className=\"relative flex-1\">\n <input\n type={showAsPassword ? 'password' : 'text'}\n value={value}\n onChange={(event) => onChange(event.target.value)}\n autoComplete=\"off\"\n spellCheck={false}\n className=\"w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 pr-10 text-sm text-text-primary\"\n />\n {secret ? (\n <button\n type=\"button\"\n onClick={onToggleVisible}\n className=\"absolute right-2 top-1/2 -translate-y-1/2 text-text-secondary hover:text-text-primary\"\n >\n {visible ? <EyeOff className=\"h-4 w-4\" /> : <Eye className=\"h-4 w-4\" />}\n </button>\n ) : null}\n </div>\n <button\n type=\"button\"\n onClick={onSave}\n disabled={saving}\n className=\"inline-flex items-center gap-1.5 rounded-md bg-action-primary-bg px-3 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg-hover disabled:opacity-50\"\n >\n {saving ? <Loader2 className=\"h-4 w-4 animate-spin\" /> : <Save className=\"h-4 w-4\" />}\n Save\n </button>\n <button\n type=\"button\"\n onClick={onClear}\n disabled={saving || !value}\n className=\"inline-flex items-center gap-1.5 rounded-md border border-border-default px-3 py-2 text-sm font-medium text-text-secondary hover:text-text-primary hover:border-border-strong disabled:opacity-50\"\n >\n <Trash2 className=\"h-4 w-4\" />\n Clear\n </button>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;AAqEA,IAAa,IAAqD;CAChE;EACE,YAAY;EACZ,OAAO;EACP,aACE;EACF,QAAQ,CACN;GAAE,KAAK;GAAqB,QAAQ;GAAM,EAC1C;GAAE,KAAK;GAAwB,QAAQ;GAAM,CAC9C;EACF;CACD;EACE,YAAY;EACZ,OAAO;EACP,aACE;EACF,QAAQ,CAAC;GAAE,KAAK;GAAkB,QAAQ;GAAM,CAAC;EAClD;CACD;EACE,YAAY;EACZ,OAAO;EACP,aACE;EACF,QAAQ,CACN;GAAE,KAAK;GAAkB,QAAQ;GAAM,EACvC;GAAE,KAAK;GAAkB,QAAQ;GAAM,CACxC;EACF;CACD;EACE,YAAY;EACZ,OAAO;EACP,aACE;EACF,QAAQ,CAAC;GAAE,KAAK;GAAyB,QAAQ;GAAM,EAAE,EAAE,KAAK,0BAA0B,CAAC;EAC5F;CACD;EACE,YAAY;EACZ,OAAO;EACP,aACE;EACF,QAAQ,CAAC;GAAE,KAAK;GAAkB,QAAQ;GAAM,CAAC;EAClD;CACD;EACE,YAAY;EACZ,OAAO;EACP,aAAa;EACb,QAAQ,CAAC;GAAE,KAAK;GAAsB,QAAQ;GAAM,CAAC;EACtD;CACD;EACE,YAAY;EACZ,OAAO;EACP,aACE;EACF,QAAQ,CAAC;GAAE,KAAK;GAAmB,QAAQ;GAAM,CAAC;EACnD;CACD;EACE,YAAY;EACZ,OAAO;EACP,aACE;EACF,QAAQ,CAAC;GAAE,KAAK;GAAkB,QAAQ;GAAM,EAAE,EAAE,KAAK,eAAe,CAAC;EAC1E;CACF;AAkCD,SAAgB,EAA0B,EACxC,UACA,gBACA,sBACA,oCACiC;CACjC,IAAM,IAAK,GAAO,EACZ,IAAY,IACd,EAAwB,QAAQ,MAAM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,EAAQ,WAAU,WAAY,CAA8B;MAChE,CAAA,GACP,KACA;;IACN,kBAAC,UAAD;KACE,MAAK;KACL,SAAS;KACT,UAAU;KACV,WAAU;eAJZ,CAMG,IAAS,kBAAC,GAAD,EAAS,WAAU,wBAAyB,CAAA,GAAG,kBAAC,GAAD,EAAM,WAAU,WAAY,CAAA,EAAC,OAE/E;;IACT,kBAAC,UAAD;KACE,MAAK;KACL,SAAS;KACT,UAAU,KAAU,CAAC;KACrB,WAAU;eAJZ,CAME,kBAAC,GAAD,EAAQ,WAAU,WAAY,CAAA,EAAA,QAEvB;;IACL;KACF"}
@@ -6,7 +6,55 @@ import { useMutation as s, useQuery as c } from "@apollo/client/react";
6
6
  import { jsx as l, jsxs as u } from "react/jsx-runtime";
7
7
  //#region src/components/security/SecurityProviderDrawer.tsx
8
8
  function d({ vibeId: d, stage: f, onClose: p }) {
9
- let { data: m, loading: h } = c(t), [g, { loading: _ }] = s(n), [v, { loading: y }] = s(e), [b, x] = a(null), S = i(() => (m?.securityProviders ?? []).filter((e) => e.stage === f && e.enabled), [m, f]), C = r.get(f), w = C?.slug ?? f.toLowerCase().replace(/_/g, "-");
9
+ let { data: m, loading: h } = c(t), [g, { loading: _ }] = s(n), [v, { loading: y }] = s(e), [b, x] = a(null), S = i(() => (m?.securityProviders ?? []).filter((e) => e.stage === f && e.enabled), [m, f]), C = r.get(f), w = C?.slug ?? f.toLowerCase().replace(/_/g, "-"), T = {
10
+ SECRETS_SCAN: [{
11
+ pkg: "@burdenoff/vibe-plugin-gitleaks",
12
+ desc: "Gitleaks — git secret scanner"
13
+ }, {
14
+ pkg: "@burdenoff/vibe-plugin-trufflehog",
15
+ desc: "TruffleHog — credential scanner"
16
+ }],
17
+ SAST: [{
18
+ pkg: "@burdenoff/vibe-plugin-semgrep",
19
+ desc: "Semgrep — static analysis"
20
+ }, {
21
+ pkg: "@burdenoff/vibe-plugin-codeql",
22
+ desc: "CodeQL — deep SAST (slow)"
23
+ }],
24
+ DEPENDENCY_SCAN: [{
25
+ pkg: "@burdenoff/vibe-plugin-trivy",
26
+ desc: "Trivy — deps & CVE scan"
27
+ }, {
28
+ pkg: "@burdenoff/vibe-plugin-osv-scanner",
29
+ desc: "OSV — OSS vuln DB"
30
+ }],
31
+ LICENSE_SCAN: [{
32
+ pkg: "@burdenoff/vibe-plugin-license-finder",
33
+ desc: "license-finder"
34
+ }],
35
+ SBOM: [{
36
+ pkg: "@burdenoff/vibe-plugin-syft",
37
+ desc: "Syft — SBOM generator"
38
+ }],
39
+ CONTAINER_SCAN: [{
40
+ pkg: "@burdenoff/vibe-plugin-trivy",
41
+ desc: "Trivy — image CVE scan"
42
+ }, {
43
+ pkg: "@burdenoff/vibe-plugin-grype",
44
+ desc: "Grype — image scanner"
45
+ }],
46
+ IAC_SCAN: [{
47
+ pkg: "@burdenoff/vibe-plugin-checkov",
48
+ desc: "Checkov — IaC linter"
49
+ }, {
50
+ pkg: "@burdenoff/vibe-plugin-tfsec",
51
+ desc: "tfsec — Terraform"
52
+ }],
53
+ DAST: [{
54
+ pkg: "@burdenoff/vibe-plugin-zap",
55
+ desc: "OWASP ZAP — dynamic scan"
56
+ }]
57
+ }[f] ?? [];
10
58
  return /* @__PURE__ */ u("aside", {
11
59
  "data-testid": "security-provider-drawer",
12
60
  className: "fixed right-0 top-0 bottom-0 w-[28rem] bg-bg-elevated border-l border-border-default shadow-lg z-50 overflow-y-auto",
@@ -33,9 +81,9 @@ function d({ vibeId: d, stage: f, onClose: p }) {
33
81
  className: "text-xs text-text-secondary",
34
82
  children: "Loading providers…"
35
83
  }),
36
- !h && S.length === 0 && /* @__PURE__ */ u("p", {
37
- className: "text-xs text-text-secondary",
38
- children: [
84
+ !h && S.length === 0 && /* @__PURE__ */ u("div", {
85
+ className: "space-y-2 text-xs text-text-secondary",
86
+ children: [/* @__PURE__ */ u("p", { children: [
39
87
  "No providers registered for this stage. Install one via",
40
88
  " ",
41
89
  /* @__PURE__ */ l("code", {
@@ -43,7 +91,25 @@ function d({ vibeId: d, stage: f, onClose: p }) {
43
91
  children: "vibe plugin install …"
44
92
  }),
45
93
  "."
46
- ]
94
+ ] }), T.length > 0 && /* @__PURE__ */ u("div", {
95
+ className: "rounded-md border border-border-subtle p-3 space-y-2",
96
+ children: [/* @__PURE__ */ l("p", {
97
+ className: "text-text-primary font-medium",
98
+ children: "Suggested providers"
99
+ }), /* @__PURE__ */ l("ul", {
100
+ className: "space-y-1.5",
101
+ children: T.map((e) => /* @__PURE__ */ u("li", {
102
+ className: "flex flex-col",
103
+ children: [/* @__PURE__ */ u("code", {
104
+ className: "text-text-primary text-[11px] break-all",
105
+ children: ["vibe plugin install ", e.pkg]
106
+ }), /* @__PURE__ */ l("span", {
107
+ className: "text-text-secondary",
108
+ children: e.desc
109
+ })]
110
+ }, e.pkg))
111
+ })]
112
+ })]
47
113
  }),
48
114
  S.map((e) => /* @__PURE__ */ u("label", {
49
115
  className: "flex items-start gap-3 p-3 rounded-md border border-border-subtle hover:border-border-default cursor-pointer",
@@ -75,32 +141,41 @@ function d({ vibeId: d, stage: f, onClose: p }) {
75
141
  }, e.id)),
76
142
  /* @__PURE__ */ u("div", {
77
143
  className: "flex gap-2 pt-2 border-t border-border-subtle",
78
- children: [/* @__PURE__ */ l("button", {
79
- type: "button",
80
- disabled: !b || _,
81
- onClick: async () => {
82
- b && await g({ variables: { input: {
83
- vibeId: d,
84
- stage: f,
85
- providerKey: b,
86
- config: {}
87
- } } });
88
- },
89
- className: "flex-1 px-3 py-2 rounded-md bg-action-primary-bg text-action-primary-text disabled:opacity-50",
90
- children: "Save"
91
- }), /* @__PURE__ */ l("button", {
92
- type: "button",
93
- disabled: y,
94
- "data-testid": `security-run-scan-${w}`,
95
- onClick: async () => {
96
- await v({ variables: {
97
- vibeId: d,
98
- stage: f
99
- } });
100
- },
101
- className: "flex-1 px-3 py-2 rounded-md border border-border-default bg-bg-sunken hover:bg-bg-surface text-text-primary disabled:opacity-50",
102
- children: "Run scan"
103
- })]
144
+ children: [
145
+ /* @__PURE__ */ l("button", {
146
+ type: "button",
147
+ disabled: !b || _,
148
+ onClick: async () => {
149
+ b && await g({ variables: { input: {
150
+ vibeId: d,
151
+ stage: f,
152
+ providerKey: b,
153
+ config: {}
154
+ } } });
155
+ },
156
+ className: "flex-1 px-3 py-2 rounded-md bg-action-primary-bg text-action-primary-text disabled:opacity-50",
157
+ children: "Save"
158
+ }),
159
+ /* @__PURE__ */ l("button", {
160
+ type: "button",
161
+ disabled: y,
162
+ "data-testid": `security-run-scan-${w}`,
163
+ onClick: async () => {
164
+ await v({ variables: {
165
+ vibeId: d,
166
+ stage: f
167
+ } });
168
+ },
169
+ className: "flex-1 px-3 py-2 rounded-md border border-border-default bg-bg-sunken hover:bg-bg-surface text-text-primary disabled:opacity-50",
170
+ children: "Run scan"
171
+ }),
172
+ /* @__PURE__ */ l("button", {
173
+ type: "button",
174
+ onClick: p,
175
+ className: "px-3 py-2 rounded-md border border-border-default text-text-primary hover:bg-bg-sunken",
176
+ children: "Close"
177
+ })
178
+ ]
104
179
  })
105
180
  ]
106
181
  })]
@@ -1 +1 @@
1
- {"version":3,"file":"SecurityProviderDrawer.js","names":[],"sources":["../../../src/components/security/SecurityProviderDrawer.tsx"],"sourcesContent":["import { useMemo, useState } from 'react';\nimport { useMutation, useQuery } from '@apollo/client/react';\nimport { X } from 'lucide-react';\n\nimport {\n RUN_SECURITY_SCAN_MUTATION,\n SECURITY_PROVIDERS_QUERY,\n SET_SECURITY_PROVIDER_MUTATION,\n} from './gql';\nimport { STAGE_BY_ID, type SecurityProviderRow, type SecurityStage } from './types';\n\ninterface DrawerProps {\n vibeId: string;\n stage: SecurityStage;\n onClose: () => void;\n}\n\ninterface ProvidersResp {\n securityProviders: SecurityProviderRow[];\n}\n\nexport function SecurityProviderDrawer({\n vibeId,\n stage,\n onClose,\n}: DrawerProps): React.ReactElement {\n const { data, loading } = useQuery<ProvidersResp>(SECURITY_PROVIDERS_QUERY);\n const [setProvider, { loading: saving }] = useMutation(SET_SECURITY_PROVIDER_MUTATION);\n const [runScan, { loading: scanning }] = useMutation(RUN_SECURITY_SCAN_MUTATION);\n const [selected, setSelected] = useState<string | null>(null);\n\n const available = useMemo(\n () => (data?.securityProviders ?? []).filter((p) => p.stage === stage && p.enabled),\n [data, stage]\n );\n const stageInfo = STAGE_BY_ID.get(stage);\n const stageSlug = stageInfo?.slug ?? stage.toLowerCase().replace(/_/g, '-');\n\n return (\n <aside\n data-testid=\"security-provider-drawer\"\n className=\"fixed right-0 top-0 bottom-0 w-[28rem] bg-bg-elevated border-l border-border-default shadow-lg z-50 overflow-y-auto\"\n >\n <div className=\"flex items-center justify-between px-4 py-3 border-b border-border-subtle\">\n <div>\n <h3 className=\"text-sm font-semibold text-text-primary\">{stageInfo?.label}</h3>\n <p className=\"text-xs text-text-secondary\">Configure provider for this stage</p>\n </div>\n <button\n type=\"button\"\n aria-label=\"Close drawer\"\n onClick={onClose}\n className=\"text-text-secondary hover:text-text-primary\"\n >\n <X className=\"h-4 w-4\" />\n </button>\n </div>\n\n <div className=\"p-4 space-y-4\" data-testid=\"security-provider-config-form\">\n {loading && <p className=\"text-xs text-text-secondary\">Loading providers…</p>}\n {!loading && available.length === 0 && (\n <p className=\"text-xs text-text-secondary\">\n No providers registered for this stage. Install one via{' '}\n <code className=\"text-text-primary\">vibe plugin install …</code>.\n </p>\n )}\n {available.map((p) => (\n <label\n key={p.id}\n className=\"flex items-start gap-3 p-3 rounded-md border border-border-subtle hover:border-border-default cursor-pointer\"\n >\n <input\n type=\"radio\"\n name=\"provider\"\n value={p.providerName}\n checked={selected === p.providerName || (selected === null && p.isDefault)}\n onChange={() => setSelected(p.providerName)}\n aria-label={p.providerName}\n />\n <div className=\"flex-1\">\n <div className=\"text-sm font-medium text-text-primary\">{p.providerName}</div>\n <div className=\"text-xs text-text-secondary\">\n {p.pluginName} · v{p.toolVersion}\n {p.isDefault && <span className=\"ml-2 text-action-primary-bg\">default</span>}\n </div>\n </div>\n </label>\n ))}\n\n <div className=\"flex gap-2 pt-2 border-t border-border-subtle\">\n <button\n type=\"button\"\n disabled={!selected || saving}\n onClick={async () => {\n if (!selected) return;\n await setProvider({\n variables: {\n input: { vibeId, stage, providerKey: selected, config: {} },\n },\n });\n }}\n className=\"flex-1 px-3 py-2 rounded-md bg-action-primary-bg text-action-primary-text disabled:opacity-50\"\n >\n Save\n </button>\n <button\n type=\"button\"\n disabled={scanning}\n data-testid={`security-run-scan-${stageSlug}`}\n onClick={async () => {\n await runScan({ variables: { vibeId, stage } });\n }}\n className=\"flex-1 px-3 py-2 rounded-md border border-border-default bg-bg-sunken hover:bg-bg-surface text-text-primary disabled:opacity-50\"\n >\n Run scan\n </button>\n </div>\n </div>\n </aside>\n );\n}\n"],"mappings":";;;;;;;AAqBA,SAAgB,EAAuB,EACrC,WACA,UACA,cACkC;CAClC,IAAM,EAAE,SAAM,eAAY,EAAwB,EAAyB,EACrE,CAAC,GAAa,EAAE,SAAS,OAAY,EAAY,EAA+B,EAChF,CAAC,GAAS,EAAE,SAAS,OAAc,EAAY,EAA2B,EAC1E,CAAC,GAAU,KAAe,EAAwB,KAAK,EAEvD,IAAY,SACT,GAAM,qBAAqB,EAAE,EAAE,QAAQ,MAAM,EAAE,UAAU,KAAS,EAAE,QAAQ,EACnF,CAAC,GAAM,EAAM,CACd,EACK,IAAY,EAAY,IAAI,EAAM,EAClC,IAAY,GAAW,QAAQ,EAAM,aAAa,CAAC,QAAQ,MAAM,IAAI;AAE3E,QACE,kBAAC,SAAD;EACE,eAAY;EACZ,WAAU;YAFZ,CAIE,kBAAC,OAAD;GAAK,WAAU;aAAf,CACE,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,MAAD;IAAI,WAAU;cAA2C,GAAW;IAAW,CAAA,EAC/E,kBAAC,KAAD;IAAG,WAAU;cAA8B;IAAqC,CAAA,CAC5E,EAAA,CAAA,EACN,kBAAC,UAAD;IACE,MAAK;IACL,cAAW;IACX,SAAS;IACT,WAAU;cAEV,kBAAC,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ACA"}
1
+ {"version":3,"file":"SecurityProviderDrawer.js","names":[],"sources":["../../../src/components/security/SecurityProviderDrawer.tsx"],"sourcesContent":["import { useMemo, useState } from 'react';\nimport { useMutation, useQuery } from '@apollo/client/react';\nimport { X } from 'lucide-react';\n\nimport {\n RUN_SECURITY_SCAN_MUTATION,\n SECURITY_PROVIDERS_QUERY,\n SET_SECURITY_PROVIDER_MUTATION,\n} from './gql';\nimport { STAGE_BY_ID, type SecurityProviderRow, type SecurityStage } from './types';\n\ninterface DrawerProps {\n vibeId: string;\n stage: SecurityStage;\n onClose: () => void;\n}\n\ninterface ProvidersResp {\n securityProviders: SecurityProviderRow[];\n}\n\nexport function SecurityProviderDrawer({\n vibeId,\n stage,\n onClose,\n}: DrawerProps): React.ReactElement {\n const { data, loading } = useQuery<ProvidersResp>(SECURITY_PROVIDERS_QUERY);\n const [setProvider, { loading: saving }] = useMutation(SET_SECURITY_PROVIDER_MUTATION);\n const [runScan, { loading: scanning }] = useMutation(RUN_SECURITY_SCAN_MUTATION);\n const [selected, setSelected] = useState<string | null>(null);\n\n const available = useMemo(\n () => (data?.securityProviders ?? []).filter((p) => p.stage === stage && p.enabled),\n [data, stage]\n );\n const stageInfo = STAGE_BY_ID.get(stage);\n const stageSlug = stageInfo?.slug ?? stage.toLowerCase().replace(/_/g, '-');\n\n // Suggested installable providers by stage — these are the well-known\n // vibe-plugin packages we ship and recommend for each security lifecycle\n // step. Surfaced when the workspace has no providers registered yet so the\n // user has a concrete next step (\"vibe plugin install …\") instead of a\n // dead-end empty state.\n const SUGGESTIONS_BY_STAGE: Record<string, ReadonlyArray<{ pkg: string; desc: string }>> = {\n SECRETS_SCAN: [\n { pkg: '@burdenoff/vibe-plugin-gitleaks', desc: 'Gitleaks — git secret scanner' },\n { pkg: '@burdenoff/vibe-plugin-trufflehog', desc: 'TruffleHog — credential scanner' },\n ],\n SAST: [\n { pkg: '@burdenoff/vibe-plugin-semgrep', desc: 'Semgrep — static analysis' },\n { pkg: '@burdenoff/vibe-plugin-codeql', desc: 'CodeQL — deep SAST (slow)' },\n ],\n DEPENDENCY_SCAN: [\n { pkg: '@burdenoff/vibe-plugin-trivy', desc: 'Trivy — deps & CVE scan' },\n { pkg: '@burdenoff/vibe-plugin-osv-scanner', desc: 'OSV — OSS vuln DB' },\n ],\n LICENSE_SCAN: [{ pkg: '@burdenoff/vibe-plugin-license-finder', desc: 'license-finder' }],\n SBOM: [{ pkg: '@burdenoff/vibe-plugin-syft', desc: 'Syft — SBOM generator' }],\n CONTAINER_SCAN: [\n { pkg: '@burdenoff/vibe-plugin-trivy', desc: 'Trivy — image CVE scan' },\n { pkg: '@burdenoff/vibe-plugin-grype', desc: 'Grype — image scanner' },\n ],\n IAC_SCAN: [\n { pkg: '@burdenoff/vibe-plugin-checkov', desc: 'Checkov — IaC linter' },\n { pkg: '@burdenoff/vibe-plugin-tfsec', desc: 'tfsec — Terraform' },\n ],\n DAST: [{ pkg: '@burdenoff/vibe-plugin-zap', desc: 'OWASP ZAP — dynamic scan' }],\n };\n const suggestions = SUGGESTIONS_BY_STAGE[stage] ?? [];\n\n return (\n <aside\n data-testid=\"security-provider-drawer\"\n className=\"fixed right-0 top-0 bottom-0 w-[28rem] bg-bg-elevated border-l border-border-default shadow-lg z-50 overflow-y-auto\"\n >\n <div className=\"flex items-center justify-between px-4 py-3 border-b border-border-subtle\">\n <div>\n <h3 className=\"text-sm font-semibold text-text-primary\">{stageInfo?.label}</h3>\n <p className=\"text-xs text-text-secondary\">Configure provider for this stage</p>\n </div>\n <button\n type=\"button\"\n aria-label=\"Close drawer\"\n onClick={onClose}\n className=\"text-text-secondary hover:text-text-primary\"\n >\n <X className=\"h-4 w-4\" />\n </button>\n </div>\n\n <div className=\"p-4 space-y-4\" data-testid=\"security-provider-config-form\">\n {loading && <p className=\"text-xs text-text-secondary\">Loading providers…</p>}\n {!loading && available.length === 0 && (\n <div className=\"space-y-2 text-xs text-text-secondary\">\n <p>\n No providers registered for this stage. Install one via{' '}\n <code className=\"text-text-primary\">vibe plugin install …</code>.\n </p>\n {suggestions.length > 0 && (\n <div className=\"rounded-md border border-border-subtle p-3 space-y-2\">\n <p className=\"text-text-primary font-medium\">Suggested providers</p>\n <ul className=\"space-y-1.5\">\n {suggestions.map((s) => (\n <li key={s.pkg} className=\"flex flex-col\">\n <code className=\"text-text-primary text-[11px] break-all\">\n vibe plugin install {s.pkg}\n </code>\n <span className=\"text-text-secondary\">{s.desc}</span>\n </li>\n ))}\n </ul>\n </div>\n )}\n </div>\n )}\n {available.map((p) => (\n <label\n key={p.id}\n className=\"flex items-start gap-3 p-3 rounded-md border border-border-subtle hover:border-border-default cursor-pointer\"\n >\n <input\n type=\"radio\"\n name=\"provider\"\n value={p.providerName}\n checked={selected === p.providerName || (selected === null && p.isDefault)}\n onChange={() => setSelected(p.providerName)}\n aria-label={p.providerName}\n />\n <div className=\"flex-1\">\n <div className=\"text-sm font-medium text-text-primary\">{p.providerName}</div>\n <div className=\"text-xs text-text-secondary\">\n {p.pluginName} · v{p.toolVersion}\n {p.isDefault && <span className=\"ml-2 text-action-primary-bg\">default</span>}\n </div>\n </div>\n </label>\n ))}\n\n <div className=\"flex gap-2 pt-2 border-t border-border-subtle\">\n <button\n type=\"button\"\n disabled={!selected || saving}\n onClick={async () => {\n if (!selected) return;\n await setProvider({\n variables: {\n input: { vibeId, stage, providerKey: selected, config: {} },\n },\n });\n }}\n className=\"flex-1 px-3 py-2 rounded-md bg-action-primary-bg text-action-primary-text disabled:opacity-50\"\n >\n Save\n </button>\n <button\n type=\"button\"\n disabled={scanning}\n data-testid={`security-run-scan-${stageSlug}`}\n onClick={async () => {\n await runScan({ variables: { vibeId, stage } });\n }}\n className=\"flex-1 px-3 py-2 rounded-md border border-border-default bg-bg-sunken hover:bg-bg-surface text-text-primary disabled:opacity-50\"\n >\n Run scan\n </button>\n <button\n type=\"button\"\n onClick={onClose}\n className=\"px-3 py-2 rounded-md border border-border-default text-text-primary hover:bg-bg-sunken\"\n >\n Close\n </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CACE,kBAAC,OAAD;OAAK,WAAU;iBAAyC,EAAE;OAAmB,CAAA,EAC7E,kBAAC,OAAD;OAAK,WAAU;iBAAf;QACG,EAAE;QAAW;QAAK,EAAE;QACpB,EAAE,aAAa,kBAAC,QAAD;SAAM,WAAU;mBAA8B;SAAc,CAAA;QACxE;SACF;QACA;OAlBD,EAAE,GAkBD,CACR;IAEF,kBAAC,OAAD;KAAK,WAAU;eAAf;MACE,kBAAC,UAAD;OACE,MAAK;OACL,UAAU,CAAC,KAAY;OACvB,SAAS,YAAY;AACd,aACL,MAAM,EAAY,EAChB,WAAW,EACT,OAAO;SAAE;SAAQ;SAAO,aAAa;SAAU,QAAQ,EAAE;SAAE,EAC5D,EACF,CAAC;;OAEJ,WAAU;iBACX;OAEQ,CAAA;MACT,kBAAC,UAAD;OACE,MAAK;OACL,UAAU;OACV,eAAa,qBAAqB;OAClC,SAAS,YAAY;AACnB,cAAM,EAAQ,EAAE,WAAW;SAAE;SAAQ;SAAO,EAAE,CAAC;;OAEjD,WAAU;iBACX;OAEQ,CAAA;MACT,kBAAC,UAAD;OACE,MAAK;OACL,SAAS;OACT,WAAU;iBACX;OAEQ,CAAA;MACL;;IACF;KACA"}
@@ -10,7 +10,10 @@ var p = ({ vibeId: p, tr: m, onAttached: h }) => {
10
10
  let g = n(), [_, v] = o(!1), [y, b] = o(null), [x, S] = o(null), { data: C, loading: w } = t({
11
11
  skip: !_,
12
12
  fetchPolicy: "cache-and-network"
13
- }), [T] = e(), E = a(() => C?.vibecontrolsAgents ?? [], [C]), D = i(async (e) => {
13
+ }), [T] = e({
14
+ refetchQueries: ["GetVibe", "ListVibes"],
15
+ awaitRefetchQueries: !0
16
+ }), E = a(() => C?.vibecontrolsAgents ?? [], [C]), D = i(async (e) => {
14
17
  b(null), S(e);
15
18
  try {
16
19
  await T({ variables: { input: {
@@ -1 +1 @@
1
- {"version":3,"file":"VibeAgentEmptyState.js","names":[],"sources":["../../../src/components/vibe/VibeAgentEmptyState.tsx"],"sourcesContent":["/**\n * VibeAgentEmptyState — shown on the Vibe details page when the vibe has no\n * agent attached. Tabs that depend on an agent (sessions, gitops, GraphQL\n * playground, git) are hidden, and the user is invited to attach an agent.\n *\n * UX: opens an in-place modal listing the workspace's existing agents so the\n * user can attach one without leaving the vibe detail page. Falls back to\n * navigating to the agents page only if no agents exist in the workspace\n * (so the user can register their first one).\n */\nimport { useCallback, useMemo, useState } from 'react';\nimport type { FC } from 'react';\nimport { ArrowRight, Plus, Server } from 'lucide-react';\nimport { EmptyState } from '@/components/shared';\nimport { useVibeNavigate } from '@/providers/VibeControlsProvider';\nimport {\n useListAgentsQuery,\n useAttachAgentToVibeMutation,\n type ListAgentsQuery,\n} from '@/generated/wspace-operations';\n\nexport interface VibeAgentEmptyStateProps {\n vibeId: string;\n tr: (key: string, fallback: string) => string;\n /** Optional: called after a successful attach so the parent can refetch. */\n onAttached?: () => void;\n}\n\nexport const VibeAgentEmptyState: FC<VibeAgentEmptyStateProps> = ({ vibeId, tr, onAttached }) => {\n const navigate = useVibeNavigate();\n const [open, setOpen] = useState(false);\n const [errorMessage, setErrorMessage] = useState<string | null>(null);\n const [busyAgentId, setBusyAgentId] = useState<string | null>(null);\n\n const { data, loading } = useListAgentsQuery({\n skip: !open,\n fetchPolicy: 'cache-and-network',\n });\n const [attach] = useAttachAgentToVibeMutation();\n\n const agents = useMemo<ListAgentsQuery['vibecontrolsAgents']>(\n () => data?.vibecontrolsAgents ?? [],\n [data]\n );\n\n const handleAttach = useCallback(\n async (agentId: string) => {\n setErrorMessage(null);\n setBusyAgentId(agentId);\n try {\n await attach({ variables: { input: { vibeId, agentId } } });\n setOpen(false);\n onAttached?.();\n } catch (err) {\n setErrorMessage(err instanceof Error ? err.message : String(err));\n } finally {\n setBusyAgentId(null);\n }\n },\n [attach, vibeId, onAttached]\n );\n\n const handleRegisterNew = useCallback(() => {\n // Deep-link to the agents page with vibeId so the agents UI can offer\n // a \"register and attach to this vibe\" affordance.\n const query = vibeId ? `?attachToVibe=${encodeURIComponent(vibeId)}` : '';\n navigate(`/agents${query}`);\n }, [navigate, vibeId]);\n\n return (\n <>\n <div className=\"rounded-lg border border-border-default bg-bg-surface\">\n <EmptyState\n icon={<Server className=\"w-8 h-8 text-text-secondary\" />}\n title={tr('vibeDetails.noAgentTitle', 'No agent attached')}\n description={tr(\n 'vibeDetails.noAgentDescription',\n 'This vibe is not attached to an agent yet. Sessions, GitOps, GraphQL playground, and git tooling all run through an agent — connect one to unlock those tabs.'\n )}\n action={\n <button\n type=\"button\"\n onClick={() => setOpen(true)}\n className=\"inline-flex items-center gap-1.5 px-3 py-2 text-sm font-medium rounded-md bg-action-primary-bg text-action-primary-text hover:bg-action-primary-bg-hover transition-colors\"\n >\n {tr('vibeDetails.connectAnAgent', 'Connect an agent to this vibe')}\n <ArrowRight className=\"w-4 h-4\" />\n </button>\n }\n />\n </div>\n\n {open && (\n <div\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby=\"vibe-attach-agent-title\"\n className=\"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4\"\n onClick={(e) => {\n if (e.target === e.currentTarget) setOpen(false);\n }}\n >\n <div className=\"w-full max-w-md rounded-lg bg-bg-elevated border border-border-default shadow-xl\">\n <div className=\"flex items-center justify-between px-5 py-4 border-b border-border-subtle\">\n <h2\n id=\"vibe-attach-agent-title\"\n className=\"text-base font-semibold text-text-primary\"\n >\n {tr('vibeDetails.attachAgentTitle', 'Attach an agent')}\n </h2>\n <button\n type=\"button\"\n onClick={() => setOpen(false)}\n className=\"text-text-secondary hover:text-text-primary transition-colors\"\n aria-label={tr('common.close', 'Close')}\n >\n ✕\n </button>\n </div>\n\n <div className=\"px-5 py-4 max-h-[60vh] overflow-y-auto\">\n {loading && agents.length === 0 ? (\n <p className=\"text-sm text-text-secondary\">{tr('common.loading', 'Loading…')}</p>\n ) : agents.length === 0 ? (\n <div className=\"text-sm text-text-secondary space-y-3\">\n <p>\n {tr(\n 'vibeDetails.noWorkspaceAgents',\n 'No agents in this workspace yet. Register one first, then attach it to this vibe.'\n )}\n </p>\n <button\n type=\"button\"\n onClick={handleRegisterNew}\n className=\"inline-flex items-center gap-1.5 px-3 py-2 text-sm font-medium rounded-md bg-action-primary-bg text-action-primary-text hover:bg-action-primary-bg-hover transition-colors\"\n >\n <Plus className=\"w-4 h-4\" />\n {tr('vibeDetails.registerAgent', 'Register an agent')}\n </button>\n </div>\n ) : (\n <ul className=\"space-y-2\">\n {agents.map((a) => (\n <li key={a.id}>\n <button\n type=\"button\"\n onClick={() => handleAttach(a.id)}\n disabled={busyAgentId !== null}\n className=\"w-full flex items-center justify-between gap-3 px-3 py-2.5 rounded-md border border-border-subtle hover:border-border-default hover:bg-action-ghost-bg-hover transition-colors text-left disabled:opacity-60\"\n >\n <span className=\"flex items-center gap-3 min-w-0\">\n <Server className=\"w-4 h-4 text-text-secondary flex-shrink-0\" />\n <span className=\"min-w-0\">\n <span className=\"block text-sm font-medium text-text-primary truncate\">\n {a.name}\n </span>\n <span className=\"block text-xs text-text-secondary truncate\">\n {a.hostname || '—'}{' '}\n {a.isActive\n ? `· ${tr('agents.active', 'Active')}`\n : `· ${tr('agents.inactive', 'Inactive')}`}\n </span>\n </span>\n </span>\n <span className=\"text-xs text-text-tertiary\">\n {busyAgentId === a.id\n ? tr('common.attaching', 'Attaching…')\n : tr('vibeDetails.attach', 'Attach')}\n </span>\n </button>\n </li>\n ))}\n </ul>\n )}\n\n {errorMessage && (\n <p className=\"mt-3 text-sm text-status-error-text\">{errorMessage}</p>\n )}\n </div>\n\n {agents.length > 0 && (\n <div className=\"flex items-center justify-between px-5 py-3 border-t border-border-subtle\">\n <button\n type=\"button\"\n onClick={handleRegisterNew}\n className=\"text-xs text-text-secondary hover:text-text-primary inline-flex items-center gap-1\"\n >\n <Plus className=\"w-3.5 h-3.5\" />\n {tr('vibeDetails.registerAgent', 'Register a new agent')}\n </button>\n <button\n type=\"button\"\n onClick={() => setOpen(false)}\n className=\"text-sm px-3 py-1.5 rounded-md border border-border-default text-text-primary hover:bg-action-ghost-bg-hover\"\n >\n {tr('common.cancel', 'Cancel')}\n </button>\n </div>\n )}\n </div>\n </div>\n )}\n </>\n );\n};\n"],"mappings":";;;;;;;;AA4BA,IAAa,KAAqD,EAAE,WAAQ,OAAI,oBAAiB;CAC/F,IAAM,IAAW,GAAiB,EAC5B,CAAC,GAAM,KAAW,EAAS,GAAM,EACjC,CAAC,GAAc,KAAmB,EAAwB,KAAK,EAC/D,CAAC,GAAa,KAAkB,EAAwB,KAAK,EAE7D,EAAE,SAAM,eAAY,EAAmB;EAC3C,MAAM,CAAC;EACP,aAAa;EACd,CAAC,EACI,CAAC,KAAU,GAA8B,EAEzC,IAAS,QACP,GAAM,sBAAsB,EAAE,EACpC,CAAC,EAAK,CACP,EAEK,IAAe,EACnB,OAAO,MAAoB;AAEzB,EADA,EAAgB,KAAK,EACrB,EAAe,EAAQ;AACvB,MAAI;AAGF,GAFA,MAAM,EAAO,EAAE,WAAW,EAAE,OAAO;IAAE;IAAQ;IAAS,EAAE,EAAE,CAAC,EAC3D,EAAQ,GAAM,EACd,KAAc;WACP,GAAK;AACZ,KAAgB,aAAe,QAAQ,EAAI,UAAU,OAAO,EAAI,CAAC;YACzD;AACR,KAAe,KAAK;;IAGxB;EAAC;EAAQ;EAAQ;EAAW,CAC7B,EAEK,IAAoB,QAAkB;AAI1C,IAAS,UADK,IAAS,iBAAiB,mBAAmB,EAAO,KAAK,KAC5C;IAC1B,CAAC,GAAU,EAAO,CAAC;AAEtB,QACE,kBAAA,GAAA,EAAA,UAAA,CACE,kBAAC,OAAD;EAAK,WAAU;YACb,kBAAC,GAAD;GACE,MAAM,kBAAC,GAAD,EAAQ,WAAU,+BAAgC,CAAA;GACxD,OAAO,EAAG,4BAA4B,oBAAoB;GAC1D,aAAa,EACX,kCACA,gKACD;GACD,QACE,kBAAC,UAAD;IACE,MAAK;IACL,eAAe,EAAQ,GAAK;IAC5B,WAAU;cAHZ,CAKG,EAAG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BACb,EAAE;UACE,CAAA,EACP,kBAAC,QAAD;UAAM,WAAU;oBAAhB;WACG,EAAE,YAAY;WAAK;WACnB,EAAE,WACC,KAAK,EAAG,iBAAiB,SAAS,KAClC,KAAK,EAAG,mBAAmB,WAAW;WACrC;YACF;WACF;WACP,kBAAC,QAAD;QAAM,WAAU;kBACb,MAAgB,EAAE,KACf,EAAG,oBAAoB,aAAa,GACpC,EAAG,sBAAsB,SAAS;QACjC,CAAA,CACA;UACN,EA3BI,EAAE,GA2BN,CACL;MACC,CAAA,EAGN,KACC,kBAAC,KAAD;MAAG,WAAU;gBAAuC;MAAiB,CAAA,CAEnE;;IAEL,EAAO,SAAS,KACf,kBAAC,OAAD;KAAK,WAAU;eAAf,CACE,kBAAC,UAAD;MACE,MAAK;MACL,SAAS;MACT,WAAU;gBAHZ,CAKE,kBAAC,GAAD,EAAM,WAAU,eAAgB,CAAA,EAC/B,EAAG,6BAA6B,uBAAuB,CACjD;SACT,kBAAC,UAAD;MACE,MAAK;MACL,eAAe,EAAQ,GAAM;MAC7B,WAAU;gBAET,EAAG,iBAAiB,SAAS;MACvB,CAAA,CACL;;IAEJ;;EACF,CAAA,CAEP,EAAA,CAAA"}
1
+ {"version":3,"file":"VibeAgentEmptyState.js","names":[],"sources":["../../../src/components/vibe/VibeAgentEmptyState.tsx"],"sourcesContent":["/**\n * VibeAgentEmptyState — shown on the Vibe details page when the vibe has no\n * agent attached. Tabs that depend on an agent (sessions, gitops, GraphQL\n * playground, git) are hidden, and the user is invited to attach an agent.\n *\n * UX: opens an in-place modal listing the workspace's existing agents so the\n * user can attach one without leaving the vibe detail page. Falls back to\n * navigating to the agents page only if no agents exist in the workspace\n * (so the user can register their first one).\n */\nimport { useCallback, useMemo, useState } from 'react';\nimport type { FC } from 'react';\nimport { ArrowRight, Plus, Server } from 'lucide-react';\nimport { EmptyState } from '@/components/shared';\nimport { useVibeNavigate } from '@/providers/VibeControlsProvider';\nimport {\n useListAgentsQuery,\n useAttachAgentToVibeMutation,\n type ListAgentsQuery,\n} from '@/generated/wspace-operations';\n\nexport interface VibeAgentEmptyStateProps {\n vibeId: string;\n tr: (key: string, fallback: string) => string;\n /** Optional: called after a successful attach so the parent can refetch. */\n onAttached?: () => void;\n}\n\nexport const VibeAgentEmptyState: FC<VibeAgentEmptyStateProps> = ({ vibeId, tr, onAttached }) => {\n const navigate = useVibeNavigate();\n const [open, setOpen] = useState(false);\n const [errorMessage, setErrorMessage] = useState<string | null>(null);\n const [busyAgentId, setBusyAgentId] = useState<string | null>(null);\n\n const { data, loading } = useListAgentsQuery({\n skip: !open,\n fetchPolicy: 'cache-and-network',\n });\n const [attach] = useAttachAgentToVibeMutation({\n refetchQueries: ['GetVibe', 'ListVibes'],\n awaitRefetchQueries: true,\n });\n\n const agents = useMemo<ListAgentsQuery['vibecontrolsAgents']>(\n () => data?.vibecontrolsAgents ?? [],\n [data]\n );\n\n const handleAttach = useCallback(\n async (agentId: string) => {\n setErrorMessage(null);\n setBusyAgentId(agentId);\n try {\n await attach({ variables: { input: { vibeId, agentId } } });\n setOpen(false);\n onAttached?.();\n } catch (err) {\n setErrorMessage(err instanceof Error ? err.message : String(err));\n } finally {\n setBusyAgentId(null);\n }\n },\n [attach, vibeId, onAttached]\n );\n\n const handleRegisterNew = useCallback(() => {\n // Deep-link to the agents page with vibeId so the agents UI can offer\n // a \"register and attach to this vibe\" affordance.\n const query = vibeId ? `?attachToVibe=${encodeURIComponent(vibeId)}` : '';\n navigate(`/agents${query}`);\n }, [navigate, vibeId]);\n\n return (\n <>\n <div className=\"rounded-lg border border-border-default bg-bg-surface\">\n <EmptyState\n icon={<Server className=\"w-8 h-8 text-text-secondary\" />}\n title={tr('vibeDetails.noAgentTitle', 'No agent attached')}\n description={tr(\n 'vibeDetails.noAgentDescription',\n 'This vibe is not attached to an agent yet. Sessions, GitOps, GraphQL playground, and git tooling all run through an agent — connect one to unlock those tabs.'\n )}\n action={\n <button\n type=\"button\"\n onClick={() => setOpen(true)}\n className=\"inline-flex items-center gap-1.5 px-3 py-2 text-sm font-medium rounded-md bg-action-primary-bg text-action-primary-text hover:bg-action-primary-bg-hover transition-colors\"\n >\n {tr('vibeDetails.connectAnAgent', 'Connect an agent to this vibe')}\n <ArrowRight className=\"w-4 h-4\" />\n </button>\n }\n />\n </div>\n\n {open && (\n <div\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby=\"vibe-attach-agent-title\"\n className=\"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4\"\n onClick={(e) => {\n if (e.target === e.currentTarget) setOpen(false);\n }}\n >\n <div className=\"w-full max-w-md rounded-lg bg-bg-elevated border border-border-default shadow-xl\">\n <div className=\"flex items-center justify-between px-5 py-4 border-b border-border-subtle\">\n <h2\n id=\"vibe-attach-agent-title\"\n className=\"text-base font-semibold text-text-primary\"\n >\n {tr('vibeDetails.attachAgentTitle', 'Attach an agent')}\n </h2>\n <button\n type=\"button\"\n onClick={() => setOpen(false)}\n className=\"text-text-secondary hover:text-text-primary transition-colors\"\n aria-label={tr('common.close', 'Close')}\n >\n ✕\n </button>\n </div>\n\n <div className=\"px-5 py-4 max-h-[60vh] overflow-y-auto\">\n {loading && agents.length === 0 ? (\n <p className=\"text-sm text-text-secondary\">{tr('common.loading', 'Loading…')}</p>\n ) : agents.length === 0 ? (\n <div className=\"text-sm text-text-secondary space-y-3\">\n <p>\n {tr(\n 'vibeDetails.noWorkspaceAgents',\n 'No agents in this workspace yet. Register one first, then attach it to this vibe.'\n )}\n </p>\n <button\n type=\"button\"\n onClick={handleRegisterNew}\n className=\"inline-flex items-center gap-1.5 px-3 py-2 text-sm font-medium rounded-md bg-action-primary-bg text-action-primary-text hover:bg-action-primary-bg-hover transition-colors\"\n >\n <Plus className=\"w-4 h-4\" />\n {tr('vibeDetails.registerAgent', 'Register an agent')}\n </button>\n </div>\n ) : (\n <ul className=\"space-y-2\">\n {agents.map((a) => (\n <li key={a.id}>\n <button\n type=\"button\"\n onClick={() => handleAttach(a.id)}\n disabled={busyAgentId !== null}\n className=\"w-full flex items-center justify-between gap-3 px-3 py-2.5 rounded-md border border-border-subtle hover:border-border-default hover:bg-action-ghost-bg-hover transition-colors text-left disabled:opacity-60\"\n >\n <span className=\"flex items-center gap-3 min-w-0\">\n <Server className=\"w-4 h-4 text-text-secondary flex-shrink-0\" />\n <span className=\"min-w-0\">\n <span className=\"block text-sm font-medium text-text-primary truncate\">\n {a.name}\n </span>\n <span className=\"block text-xs text-text-secondary truncate\">\n {a.hostname || '—'}{' '}\n {a.isActive\n ? `· ${tr('agents.active', 'Active')}`\n : `· ${tr('agents.inactive', 'Inactive')}`}\n </span>\n </span>\n </span>\n <span className=\"text-xs text-text-tertiary\">\n {busyAgentId === a.id\n ? tr('common.attaching', 'Attaching…')\n : tr('vibeDetails.attach', 'Attach')}\n </span>\n </button>\n </li>\n ))}\n </ul>\n )}\n\n {errorMessage && (\n <p className=\"mt-3 text-sm text-status-error-text\">{errorMessage}</p>\n )}\n </div>\n\n {agents.length > 0 && (\n <div className=\"flex items-center justify-between px-5 py-3 border-t border-border-subtle\">\n <button\n type=\"button\"\n onClick={handleRegisterNew}\n className=\"text-xs text-text-secondary hover:text-text-primary inline-flex items-center gap-1\"\n >\n <Plus className=\"w-3.5 h-3.5\" />\n {tr('vibeDetails.registerAgent', 'Register a new agent')}\n </button>\n <button\n type=\"button\"\n onClick={() => setOpen(false)}\n className=\"text-sm px-3 py-1.5 rounded-md border border-border-default text-text-primary hover:bg-action-ghost-bg-hover\"\n >\n {tr('common.cancel', 'Cancel')}\n </button>\n </div>\n )}\n </div>\n </div>\n )}\n </>\n );\n};\n"],"mappings":";;;;;;;;AA4BA,IAAa,KAAqD,EAAE,WAAQ,OAAI,oBAAiB;CAC/F,IAAM,IAAW,GAAiB,EAC5B,CAAC,GAAM,KAAW,EAAS,GAAM,EACjC,CAAC,GAAc,KAAmB,EAAwB,KAAK,EAC/D,CAAC,GAAa,KAAkB,EAAwB,KAAK,EAE7D,EAAE,SAAM,eAAY,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