@kvman/kvcoder 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/api.d.ts +34 -0
  2. package/dist/api.d.ts.map +1 -1
  3. package/dist/connectors/delegate.d.ts.map +1 -1
  4. package/dist/connectors/delegate.js +1 -0
  5. package/dist/connectors/delegate.js.map +1 -1
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +4 -1
  8. package/dist/index.js.map +1 -1
  9. package/dist/prompt/session-prompt.d.ts +1 -1
  10. package/dist/prompt/session-prompt.d.ts.map +1 -1
  11. package/dist/prompt/session-prompt.js +17 -2
  12. package/dist/prompt/session-prompt.js.map +1 -1
  13. package/dist/registry/register-connectors.d.ts +1 -0
  14. package/dist/registry/register-connectors.d.ts.map +1 -1
  15. package/dist/registry/register-connectors.js +32 -4
  16. package/dist/registry/register-connectors.js.map +1 -1
  17. package/dist/registry/register-slash-commands.d.ts +6 -0
  18. package/dist/registry/register-slash-commands.d.ts.map +1 -0
  19. package/dist/registry/register-slash-commands.js +85 -0
  20. package/dist/registry/register-slash-commands.js.map +1 -0
  21. package/dist/schemas/records.d.ts +1 -0
  22. package/dist/schemas/records.d.ts.map +1 -1
  23. package/dist/schemas/records.js +2 -0
  24. package/dist/schemas/records.js.map +1 -1
  25. package/dist/schemas/registry.d.ts +32 -0
  26. package/dist/schemas/registry.d.ts.map +1 -1
  27. package/dist/schemas/registry.js +9 -2
  28. package/dist/schemas/registry.js.map +1 -1
  29. package/dist/sessions/new-session.d.ts.map +1 -1
  30. package/dist/sessions/new-session.js +1 -0
  31. package/dist/sessions/new-session.js.map +1 -1
  32. package/dist/store/collections.d.ts +18 -0
  33. package/dist/store/collections.d.ts.map +1 -1
  34. package/dist/store/collections.js +5 -2
  35. package/dist/store/collections.js.map +1 -1
  36. package/dist/turns/start-turn.d.ts +1 -0
  37. package/dist/turns/start-turn.d.ts.map +1 -1
  38. package/dist/web/components/call.js +142 -238
  39. package/dist/web/components/connectors.js +1174 -1549
  40. package/dist/web/components/conversation.js +1912 -2708
  41. package/dist/web/components/mcp-sign-in.js +86 -120
  42. package/dist/web/components/model.js +226 -331
  43. package/dist/web/components/question.js +129 -185
  44. package/dist/web/components/sessions.js +90 -138
  45. package/docs/connectors.md +21 -1
  46. package/locales/ar.json +4 -0
  47. package/locales/en.json +4 -0
  48. package/package.json +4 -4
@@ -1,6 +1,6 @@
1
- import { Fragment as e, computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createTextVNode as o, createVNode as s, defineComponent as c, h as l, inject as u, mergeModels as d, mergeProps as f, nextTick as p, onBeforeUnmount as m, onMounted as h, onUnmounted as g, openBlock as _, reactive as v, ref as y, renderList as b, renderSlot as x, shallowRef as S, toDisplayString as C, useModel as w, useTemplateRef as T, vModelCheckbox as E, vModelRadio as D, vModelSelect as O, vModelText as k, watch as A, withCtx as j, withDirectives as M, withKeys as N, withModifiers as P } from "vue";
1
+ import { Fragment as e, computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createTextVNode as o, createVNode as s, defineComponent as c, h as l, inject as u, isRef as d, mergeModels as f, mergeProps as p, nextTick as m, onBeforeUnmount as h, onMounted as g, onUnmounted as _, openBlock as v, reactive as y, ref as b, renderList as x, renderSlot as S, shallowRef as C, toDisplayString as w, unref as T, useModel as E, useTemplateRef as D, vModelCheckbox as O, vModelRadio as k, vModelSelect as A, vModelText as j, watch as M, withCtx as N, withDirectives as P, withKeys as F, withModifiers as I } from "vue";
2
2
  //#region ../../node_modules/.pnpm/@lucide+vue@1.49.0_vue@3.5.43_typescript@6.0.3_/node_modules/@lucide/vue/dist/esm/shared/src/build/defaultAttributes.mjs
3
- var F = {
3
+ var L = {
4
4
  xmlns: "http://www.w3.org/2000/svg",
5
5
  width: 24,
6
6
  height: 24,
@@ -10,25 +10,25 @@ var F = {
10
10
  "stroke-width": 2,
11
11
  "stroke-linecap": "round",
12
12
  "stroke-linejoin": "round"
13
- }, I = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim();
13
+ }, R = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim();
14
14
  //#endregion
15
15
  //#region ../../node_modules/.pnpm/@lucide+vue@1.49.0_vue@3.5.43_typescript@6.0.3_/node_modules/@lucide/vue/dist/esm/shared/src/build/buildLucideIconNode.mjs
16
- function L(e) {
16
+ function z(e) {
17
17
  return e != null;
18
18
  }
19
- function ee(e, t = {}) {
20
- let n = t.attributeNames ?? {}, r = (e) => n[e] ?? e, i = e.size ?? e.width ?? F.width, a = e.size ?? e.height ?? F.height, o = e.aliases?.filter((e) => typeof e == "string" && e.trim() !== "").map((e) => `lucide-${e}`) ?? [], s = [...e.name ? [`lucide-${e.name}`] : [], ...o], c = t.className?.split(" ").filter(Boolean) ?? [], l = t.includeDefaultClasses === !1 ? I(...c) : I("lucide", ...s, ...c), u = t.absoluteStrokeWidth ? Number(t.strokeWidth ?? F["stroke-width"]) * Number(e.size ?? e.width ?? F.width) / Number(t.size ?? t.width ?? F.width) : t.strokeWidth ?? F["stroke-width"];
19
+ function B(e, t = {}) {
20
+ let n = t.attributeNames ?? {}, r = (e) => n[e] ?? e, i = e.size ?? e.width ?? L.width, a = e.size ?? e.height ?? L.height, o = e.aliases?.filter((e) => typeof e == "string" && e.trim() !== "").map((e) => `lucide-${e}`) ?? [], s = [...e.name ? [`lucide-${e.name}`] : [], ...o], c = t.className?.split(" ").filter(Boolean) ?? [], l = t.includeDefaultClasses === !1 ? R(...c) : R("lucide", ...s, ...c), u = t.absoluteStrokeWidth ? Number(t.strokeWidth ?? L["stroke-width"]) * Number(e.size ?? e.width ?? L.width) / Number(t.size ?? t.width ?? L.width) : t.strokeWidth ?? L["stroke-width"];
21
21
  return [
22
22
  "svg",
23
23
  {
24
- ...Object.entries(F).reduce((e, [t, n]) => (e[r(t)] = n, e), {}),
24
+ ...Object.entries(L).reduce((e, [t, n]) => (e[r(t)] = n, e), {}),
25
25
  ..."color" in t && t.color && { [r("stroke")]: t.color },
26
- ..."size" in t && L(t.size) && {
26
+ ..."size" in t && z(t.size) && {
27
27
  [r("width")]: t.size,
28
28
  [r("height")]: t.size
29
29
  },
30
- ..."width" in t && L(t.width) && { [r("width")]: t.width },
31
- ..."height" in t && L(t.height) && { [r("height")]: t.height },
30
+ ..."width" in t && z(t.width) && { [r("width")]: t.width },
31
+ ..."height" in t && z(t.height) && { [r("height")]: t.height },
32
32
  [r("stroke-width")]: u,
33
33
  ...l && { [r("class")]: l },
34
34
  [r("viewBox")]: `0 0 ${i} ${a}`,
@@ -50,24 +50,24 @@ function ee(e, t = {}) {
50
50
  }
51
51
  //#endregion
52
52
  //#region ../../node_modules/.pnpm/@lucide+vue@1.49.0_vue@3.5.43_typescript@6.0.3_/node_modules/@lucide/vue/dist/esm/shared/src/utils/hasA11yProp.mjs
53
- var te = (e) => {
53
+ var V = (e) => {
54
54
  for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
55
55
  return !1;
56
- }, R = (e) => e === "", ne = (e) => e?.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), re = /* @__PURE__ */ Symbol("lucide-icons");
57
- function ie() {
58
- return u(re, {});
56
+ }, H = (e) => e === "", U = (e) => e?.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), ee = /* @__PURE__ */ Symbol("lucide-icons");
57
+ function te() {
58
+ return u(ee, {});
59
59
  }
60
60
  //#endregion
61
61
  //#region ../../node_modules/.pnpm/@lucide+vue@1.49.0_vue@3.5.43_typescript@6.0.3_/node_modules/@lucide/vue/dist/esm/Icon.mjs
62
- var ae = ({ name: e, iconNode: t, "icon-node": n, icon: r = {
63
- name: e && ne(e),
62
+ var ne = ({ name: e, iconNode: t, "icon-node": n, icon: r = {
63
+ name: e && U(e),
64
64
  node: t ?? n ?? [],
65
65
  size: 24,
66
66
  aliases: []
67
67
  }, absoluteStrokeWidth: i, "absolute-stroke-width": a, nonScalingStroke: o, "non-scaling-stroke": s, strokeWidth: c, "stroke-width": u, size: d, width: f = d, height: p = d, color: m, ...h }, { slots: g }) => {
68
- let { size: _, color: v, strokeWidth: y = 2, absoluteStrokeWidth: b = !1, nonScalingStroke: x = !1, class: S = "" } = ie(), C = R(i) || R(a) || i === !0 || a === !0 || b === !0, w = R(o) || R(s) || o === !0 || s === !0 || x === !0;
68
+ let { size: _, color: v, strokeWidth: y = 2, absoluteStrokeWidth: b = !1, nonScalingStroke: x = !1, class: S = "" } = te(), C = H(i) || H(a) || i === !0 || a === !0 || b === !0, w = H(o) || H(s) || o === !0 || s === !0 || x === !0;
69
69
  delete h.class;
70
- let T = g.default?.(), [, E, D = []] = ee(r, {
70
+ let T = g.default?.(), [, E, D = []] = B(r, {
71
71
  color: m ?? v,
72
72
  width: f ?? d ?? _,
73
73
  height: p ?? d ?? _,
@@ -75,38 +75,38 @@ var ae = ({ name: e, iconNode: t, "icon-node": n, icon: r = {
75
75
  absoluteStrokeWidth: C,
76
76
  nonScalingStroke: w,
77
77
  className: S,
78
- hasA11yProp: T != null && T.length > 0 || te(h),
78
+ hasA11yProp: T != null && T.length > 0 || V(h),
79
79
  attributes: h
80
80
  });
81
81
  return l("svg", E, [...D.map(([e, t]) => l(e, t)), ...T ?? []]);
82
82
  };
83
83
  //#endregion
84
84
  //#region ../../node_modules/.pnpm/@lucide+vue@1.49.0_vue@3.5.43_typescript@6.0.3_/node_modules/@lucide/vue/dist/esm/createLucideIcon.mjs
85
- function z(e, t = []) {
85
+ function W(e, t = []) {
86
86
  let n = typeof e == "string" ? {
87
87
  name: e,
88
88
  node: t
89
89
  } : e;
90
- return (e, { slots: t }) => l(ae, {
90
+ return (e, { slots: t }) => l(ne, {
91
91
  ...e,
92
92
  icon: n
93
93
  }, t.default ? { default: t.default } : void 0);
94
94
  }
95
- var oe = z({
95
+ var re = W({
96
96
  name: "check",
97
97
  size: 24,
98
98
  node: [["path", {
99
99
  d: "M20 6 9 17l-5-5",
100
100
  key: "1gmf2c"
101
101
  }]]
102
- }), se = z({
102
+ }), ie = W({
103
103
  name: "chevron-down",
104
104
  size: 24,
105
105
  node: [["path", {
106
106
  d: "m6 9 6 6 6-6",
107
107
  key: "qrunsl"
108
108
  }]]
109
- }), ce = z({
109
+ }), G = W({
110
110
  name: "pencil",
111
111
  size: 24,
112
112
  node: [["path", {
@@ -116,7 +116,7 @@ var oe = z({
116
116
  d: "m15 5 4 4",
117
117
  key: "1mk7zo"
118
118
  }]]
119
- }), B = z({
119
+ }), K = W({
120
120
  name: "plus",
121
121
  size: 24,
122
122
  node: [["path", {
@@ -126,7 +126,7 @@ var oe = z({
126
126
  d: "M12 5v14",
127
127
  key: "s699le"
128
128
  }]]
129
- }), le = z({
129
+ }), ae = W({
130
130
  name: "search",
131
131
  size: 24,
132
132
  node: [["path", {
@@ -138,7 +138,7 @@ var oe = z({
138
138
  r: "8",
139
139
  key: "4ej97u"
140
140
  }]]
141
- }), ue = z({
141
+ }), oe = W({
142
142
  name: "settings",
143
143
  size: 24,
144
144
  node: [["path", {
@@ -150,7 +150,7 @@ var oe = z({
150
150
  r: "3",
151
151
  key: "1v7zrd"
152
152
  }]]
153
- }), de = z({
153
+ }), se = W({
154
154
  name: "trash",
155
155
  size: 24,
156
156
  node: [
@@ -176,7 +176,7 @@ var oe = z({
176
176
  }]
177
177
  ],
178
178
  aliases: ["trash-2"]
179
- }), fe = z({
179
+ }), ce = W({
180
180
  name: "x",
181
181
  size: 24,
182
182
  node: [["path", {
@@ -189,108 +189,82 @@ var oe = z({
189
189
  });
190
190
  //#endregion
191
191
  //#region web/src/kvman.ts
192
- function V() {
192
+ function q() {
193
193
  let e = u("kvman");
194
194
  if (e === void 0) throw Error("kvcoder components run inside kvwebui, which provides kvman.");
195
195
  return e;
196
196
  }
197
- function pe(e) {
197
+ function le(e) {
198
198
  return typeof e == "object" && e && !Array.isArray(e) ? Object.fromEntries(Object.entries(e)) : {};
199
199
  }
200
- function me(e) {
200
+ function ue(e) {
201
201
  let t = e.indexOf("/");
202
202
  return t < 0 ? `kernel.errors.${e}` : `${e.slice(0, t)}.errors.${e.slice(t + 1)}`;
203
203
  }
204
- function he(e) {
204
+ function de(e) {
205
205
  if (!(e instanceof Error) || !("problem" in e)) return;
206
206
  let t = e.problem;
207
207
  if (typeof t == "object" && t && "code" in t && typeof t.code == "string") return {
208
208
  code: t.code,
209
- params: ge("params" in t ? t.params : void 0)
209
+ params: fe("params" in t ? t.params : void 0)
210
210
  };
211
211
  }
212
- function ge(e) {
213
- return Object.fromEntries(Object.entries(pe(e)).map(([e, t]) => [e, typeof t == "string" ? t : JSON.stringify(t)]));
212
+ function fe(e) {
213
+ return Object.fromEntries(Object.entries(le(e)).map(([e, t]) => [e, typeof t == "string" ? t : JSON.stringify(t)]));
214
214
  }
215
- function H(e, t) {
216
- let n = he(t);
217
- e.toast(n === void 0 ? "kvcoder.ui.failed" : me(n.code), n?.params ?? {}, "error");
215
+ function J(e, t) {
216
+ let n = de(t);
217
+ e.toast(n === void 0 ? "kvcoder.ui.failed" : ue(n.code), n?.params ?? {}, "error");
218
218
  }
219
219
  //#endregion
220
220
  //#region web/src/ConnectorDialog.vue?vue&type=script&setup=true&lang.ts
221
- var _e = /*@__PURE__*/ c({
222
- __name: "ConnectorDialog",
223
- props: { name: {
224
- type: String,
225
- required: !0
226
- } },
227
- emits: ["close"],
228
- setup(e, { expose: t, emit: n }) {
229
- t();
230
- let r = e, i = n, a = V(), o = T("dialog"), s = () => [...o.value?.querySelectorAll("button:not(:disabled), select:not(:disabled), input:not(:disabled), textarea:not(:disabled), a[href]") ?? []];
231
- function c(e) {
232
- let t = s(), n = e.shiftKey ? t[0] : t.at(-1);
233
- (document.activeElement === n || document.activeElement === o.value) && (e.preventDefault(), (e.shiftKey ? t.at(-1) : t[0])?.focus());
234
- }
235
- h(() => o.value?.focus());
236
- let l = {
237
- props: r,
238
- emit: i,
239
- kvman: a,
240
- dialog: o,
241
- focusable: s,
242
- onTab: c,
243
- get X() {
244
- return fe;
245
- }
246
- };
247
- return Object.defineProperty(l, "__isScriptSetup", {
248
- enumerable: !1,
249
- value: !0
250
- }), l;
251
- }
252
- }), U = (e, t) => {
253
- let n = e.__vccOpts || e;
254
- for (let [e, r] of t) n[e] = r;
255
- return n;
256
- }, ve = ["aria-label"], ye = { class: "kvc-dialog-head" }, be = { class: "kvc-connector-text" }, xe = {
221
+ var pe = ["aria-label"], me = { class: "kvc-dialog-head" }, he = { class: "kvc-connector-text" }, ge = {
257
222
  class: "kvc-mono kvc-dialog-title",
258
223
  "data-test": "connector-dialog-title"
259
- }, Se = {
224
+ }, _e = {
260
225
  class: "kvc-muted",
261
226
  "data-test": "connector-dialog-scope"
262
- }, Ce = ["aria-label", "title"];
263
- function we(e, t, n, r, o, c) {
264
- return _(), i("div", {
265
- class: "kvc-dialog-backdrop",
266
- "data-test": "connector-dialog-backdrop",
267
- onClick: t[2] ||= P((e) => r.emit("close"), ["self"])
268
- }, [a("div", {
269
- ref: "dialog",
270
- class: "kvc-dialog",
271
- role: "dialog",
272
- "aria-modal": "true",
273
- "aria-label": r.kvman.t("kvcoder.config.connectors.configure", { name: r.props.name }),
274
- tabindex: "-1",
275
- "data-test": "connector-dialog",
276
- onKeydown: [t[1] ||= N(P((e) => r.emit("close"), ["stop"]), ["esc"]), N(r.onTab, ["tab"])]
277
- }, [a("div", ye, [a("span", be, [a("span", xe, C(r.props.name), 1), a("span", Se, C(r.kvman.t(`kvcoder.config.dialog.scope.${r.kvman.scope.value}`, { name: r.kvman.workspace.value.name })), 1)]), a("button", {
278
- type: "button",
279
- class: "kvc-button kvc-ghost kvc-icon-button",
280
- "aria-label": r.kvman.t("kvcoder.config.dialog.close"),
281
- title: r.kvman.t("kvcoder.config.dialog.close"),
282
- "data-test": "connector-dialog-close",
283
- onClick: t[0] ||= (e) => r.emit("close")
284
- }, [s(r.X, {
285
- size: 18,
286
- "aria-hidden": "true"
287
- })], 8, Ce)]), x(e.$slots, "default")], 40, ve)]);
288
- }
289
- var Te = /*#__PURE__*/ U(_e, [["render", we], ["__file", "/home/runner/work/kvman/kvman/extensions/kvcoder/web/src/ConnectorDialog.vue"]]);
227
+ }, ve = ["aria-label", "title"], ye = /* @__PURE__ */ c({
228
+ __name: "ConnectorDialog",
229
+ props: { name: {} },
230
+ emits: ["close"],
231
+ setup(e, { emit: t }) {
232
+ let n = e, r = t, o = q(), c = D("dialog"), l = () => [...c.value?.querySelectorAll("button:not(:disabled), select:not(:disabled), input:not(:disabled), textarea:not(:disabled), a[href]") ?? []];
233
+ function u(e) {
234
+ let t = l(), n = e.shiftKey ? t[0] : t.at(-1);
235
+ (document.activeElement === n || document.activeElement === c.value) && (e.preventDefault(), (e.shiftKey ? t.at(-1) : t[0])?.focus());
236
+ }
237
+ return g(() => c.value?.focus()), (e, t) => (v(), i("div", {
238
+ class: "kvc-dialog-backdrop",
239
+ "data-test": "connector-dialog-backdrop",
240
+ onClick: t[2] ||= I((e) => r("close"), ["self"])
241
+ }, [a("div", {
242
+ ref_key: "dialog",
243
+ ref: c,
244
+ class: "kvc-dialog",
245
+ role: "dialog",
246
+ "aria-modal": "true",
247
+ "aria-label": T(o).t("kvcoder.config.connectors.configure", { name: n.name }),
248
+ tabindex: "-1",
249
+ "data-test": "connector-dialog",
250
+ onKeydown: [t[1] ||= F(I((e) => r("close"), ["stop"]), ["esc"]), F(u, ["tab"])]
251
+ }, [a("div", me, [a("span", he, [a("span", ge, w(n.name), 1), a("span", _e, w(T(o).t(`kvcoder.config.dialog.scope.${T(o).scope.value}`, { name: T(o).workspace.value.name })), 1)]), a("button", {
252
+ type: "button",
253
+ class: "kvc-button kvc-ghost kvc-icon-button",
254
+ "aria-label": T(o).t("kvcoder.config.dialog.close"),
255
+ title: T(o).t("kvcoder.config.dialog.close"),
256
+ "data-test": "connector-dialog-close",
257
+ onClick: t[0] ||= (e) => r("close")
258
+ }, [s(T(ce), {
259
+ size: 18,
260
+ "aria-hidden": "true"
261
+ })], 8, ve)]), S(e.$slots, "default")], 40, pe)]));
262
+ }
263
+ });
290
264
  //#endregion
291
265
  //#region web/src/use-setting.ts
292
- function W(e, n) {
293
- let r = S(null), i = y("default"), a = y(!1), o = async () => {
266
+ function Y(e, n) {
267
+ let r = C(null), i = b("default"), a = b(!1), o = async () => {
294
268
  let t = (await e.exec("kernel.settings.list", {})).find((e) => e.key === n);
295
269
  r.value = t?.value ?? null, i.value = t?.source ?? "default";
296
270
  }, s = async (t) => {
@@ -298,12 +272,12 @@ function W(e, n) {
298
272
  try {
299
273
  return await t(), await o(), !0;
300
274
  } catch (t) {
301
- return H(e, t), !1;
275
+ return J(e, t), !1;
302
276
  } finally {
303
277
  a.value = !1;
304
278
  }
305
279
  };
306
- return h(o), A(() => [e.scope.value, e.workspace.value.id], o), {
280
+ return g(o), M(() => [e.scope.value, e.workspace.value.id], o), {
307
281
  value: r,
308
282
  saving: a,
309
283
  locked: t(() => e.scope.value === "global" && i.value === "workspace"),
@@ -321,7 +295,7 @@ function W(e, n) {
321
295
  }
322
296
  //#endregion
323
297
  //#region web/src/model-groups.ts
324
- function Ee(e, t, n) {
298
+ function be(e, t, n) {
325
299
  let r = new Map(e.map((e) => [e.id, e.title])), i = new Set(e.filter((e) => e.status !== "needsKey").map((e) => e.id)), a = t.filter((e) => i.has(e.provider) || e.id === n), o = /* @__PURE__ */ new Map();
326
300
  for (let e of a) {
327
301
  let t = o.get(e.provider) ?? {
@@ -336,7 +310,7 @@ function Ee(e, t, n) {
336
310
  }
337
311
  return [...o.values()].sort((e, t) => e.title.localeCompare(t.title));
338
312
  }
339
- function De(e, t) {
313
+ function xe(e, t) {
340
314
  let n = t.toLowerCase().split(/\s+/).filter((e) => e !== ""), r = (e) => n.every((t) => `${e.name} ${e.id}`.toLowerCase().includes(t)), i = e.map((e) => ({
341
315
  ...e,
342
316
  models: e.models.filter(r)
@@ -347,13 +321,13 @@ function De(e, t) {
347
321
  total: e.reduce((e, t) => e + t.models.length, 0)
348
322
  };
349
323
  }
350
- var Oe = [
324
+ var Se = [
351
325
  "off",
352
326
  "minimal",
353
327
  "low",
354
328
  "medium",
355
329
  "high"
356
- ], ke = [
330
+ ], Ce = [
357
331
  "off",
358
332
  "minimal",
359
333
  "low",
@@ -361,28 +335,28 @@ var Oe = [
361
335
  "high",
362
336
  "xhigh",
363
337
  "max"
364
- ], Ae = [
338
+ ], we = [
365
339
  "low",
366
340
  "medium",
367
341
  "high",
368
342
  "xhigh",
369
343
  "max"
370
- ], je = [
344
+ ], Te = [
371
345
  "acceptEdits",
372
346
  "auto",
373
347
  "bypassPermissions",
374
348
  "dontAsk",
375
349
  "plan"
376
- ], Me = [
350
+ ], Ee = [
377
351
  "subagent",
378
352
  "opencode",
379
353
  "pi",
380
354
  "claude"
381
- ], Ne = (e) => Array.isArray(e) && e.every((e) => typeof e == "string"), G = (e) => e === null || typeof e == "string", K = (e, t) => e.some((e) => e === t), q = (e, ...t) => t.every((t) => t in e);
382
- function Pe(e) {
383
- return typeof e != "object" || !e || !q(e, "name", "description", "enabled", "kind", "instructions") || typeof e.name != "string" || typeof e.description != "string" || typeof e.enabled != "boolean" || typeof e.instructions != "string" ? !1 : e.kind === "subagent" ? q(e, "connectors", "model", "thinking") && (e.connectors === null || Ne(e.connectors)) && G(e.model) && (e.thinking === null || K(Oe, e.thinking)) : !q(e, "approval", "timeoutMs", "model") || !K(["ask", "auto"], e.approval) || typeof e.timeoutMs != "number" || !G(e.model) ? !1 : e.kind === "opencode" ? q(e, "agent", "autoApprove") && G(e.agent) && typeof e.autoApprove == "boolean" : e.kind === "pi" ? q(e, "thinking", "tools") && (e.thinking === null || K(ke, e.thinking)) && (e.tools === null || Ne(e.tools)) : e.kind === "claude" && q(e, "effort", "permissionMode") && (e.effort === null || K(Ae, e.effort)) && K(je, e.permissionMode);
355
+ ], De = (e) => Array.isArray(e) && e.every((e) => typeof e == "string"), Oe = (e) => e === null || typeof e == "string", X = (e, t) => e.some((e) => e === t), Z = (e, ...t) => t.every((t) => t in e);
356
+ function ke(e) {
357
+ return typeof e != "object" || !e || !Z(e, "name", "description", "enabled", "kind", "instructions") || typeof e.name != "string" || typeof e.description != "string" || typeof e.enabled != "boolean" || typeof e.instructions != "string" ? !1 : e.kind === "subagent" ? Z(e, "connectors", "model", "thinking") && (e.connectors === null || De(e.connectors)) && Oe(e.model) && (e.thinking === null || X(Se, e.thinking)) : !Z(e, "approval", "timeoutMs", "model") || !X(["ask", "auto"], e.approval) || typeof e.timeoutMs != "number" || !Oe(e.model) ? !1 : e.kind === "opencode" ? Z(e, "agent", "autoApprove") && Oe(e.agent) && typeof e.autoApprove == "boolean" : e.kind === "pi" ? Z(e, "thinking", "tools") && (e.thinking === null || X(Ce, e.thinking)) && (e.tools === null || De(e.tools)) : e.kind === "claude" && Z(e, "effort", "permissionMode") && (e.effort === null || X(we, e.effort)) && X(Te, e.permissionMode);
384
358
  }
385
- var Fe = (e) => Array.isArray(e) ? e.filter(Pe) : [], Ie = {
359
+ var Ae = (e) => Array.isArray(e) ? e.filter(ke) : [], je = {
386
360
  name: "",
387
361
  description: "",
388
362
  enabled: !0,
@@ -402,10 +376,10 @@ var Fe = (e) => Array.isArray(e) ? e.filter(Pe) : [], Ie = {
402
376
  effort: "",
403
377
  permissionMode: "acceptEdits"
404
378
  };
405
- function Le(e) {
406
- if (e === void 0) return { ...Ie };
379
+ function Me(e) {
380
+ if (e === void 0) return { ...je };
407
381
  let t = {
408
- ...Ie,
382
+ ...je,
409
383
  name: e.name,
410
384
  description: e.description,
411
385
  enabled: e.enabled,
@@ -442,8 +416,8 @@ function Le(e) {
442
416
  permissionMode: e.permissionMode
443
417
  };
444
418
  }
445
- var J = (e) => e === "" ? null : e;
446
- function Re(e, t) {
419
+ var Q = (e) => e === "" ? null : e;
420
+ function Ne(e, t) {
447
421
  let n = {
448
422
  name: e.name.trim(),
449
423
  description: e.description.trim(),
@@ -457,47 +431,47 @@ function Re(e, t) {
457
431
  kind: "subagent",
458
432
  connectors: r,
459
433
  model: e.model,
460
- thinking: J(e.thinking)
434
+ thinking: Q(e.thinking)
461
435
  };
462
436
  }
463
437
  let r = {
464
438
  ...n,
465
439
  approval: e.approval,
466
440
  timeoutMs: Number(e.minutes) * 6e4,
467
- model: J(e.programModel.trim())
441
+ model: Q(e.programModel.trim())
468
442
  };
469
443
  if (e.kind === "opencode") return {
470
444
  ...r,
471
445
  kind: "opencode",
472
- agent: J(e.agent.trim()),
446
+ agent: Q(e.agent.trim()),
473
447
  autoApprove: e.autoApprove
474
448
  };
475
449
  let i = e.tools.split("\n").map((e) => e.trim()).filter((e) => e !== "");
476
450
  return e.kind === "pi" ? {
477
451
  ...r,
478
452
  kind: "pi",
479
- thinking: J(e.piThinking),
453
+ thinking: Q(e.piThinking),
480
454
  tools: i.length === 0 ? null : i
481
455
  } : {
482
456
  ...r,
483
457
  kind: "claude",
484
- effort: J(e.effort),
458
+ effort: Q(e.effort),
485
459
  permissionMode: e.permissionMode
486
460
  };
487
461
  }
488
- var ze = /^[a-z][a-z0-9]*(-[a-z0-9]+)*$/, Be = 16384, Ve = /^(?:[1-9]|[1-9]\d|1[01]\d|120)$/, He = [
462
+ var Pe = /^[a-z][a-z0-9]*(-[a-z0-9]+)*$/, Fe = 16384, Ie = /^(?:[1-9]|[1-9]\d|1[01]\d|120)$/, Le = [
489
463
  "bypassPermissions",
490
464
  "auto",
491
465
  "dontAsk"
492
- ], Ue = (e) => e.approval === "auto" && (e.kind === "opencode" && e.autoApprove || e.kind === "claude" && He.includes(e.permissionMode));
493
- function We(e, t) {
466
+ ], Re = (e) => e.approval === "auto" && (e.kind === "opencode" && e.autoApprove || e.kind === "claude" && Le.includes(e.permissionMode));
467
+ function ze(e, t) {
494
468
  let n = e.name.trim(), r = {};
495
- return n === "" ? r.name = "kvcoder.config.workers.invalid.nameEmpty" : ze.test(n) ? t.includes(n) && (r.name = "kvcoder.config.workers.invalid.nameTaken") : r.name = "kvcoder.config.workers.invalid.nameShape", e.description.trim() === "" && (r.description = "kvcoder.config.workers.invalid.descriptionEmpty"), new TextEncoder().encode(e.instructions).length > Be && (r.instructions = "kvcoder.config.workers.invalid.instructionsLong"), e.kind === "subagent" && !e.all && e.connectors.length === 0 && (r.connectors = "kvcoder.config.workers.invalid.connectorsEmpty"), e.kind !== "subagent" && !Ve.test(e.minutes.trim()) && (r.minutes = "kvcoder.config.workers.invalid.minutes"), Ue(e) && (r.approval = "kvcoder.config.workers.invalid.unattended"), r;
469
+ return n === "" ? r.name = "kvcoder.config.workers.invalid.nameEmpty" : Pe.test(n) ? t.includes(n) && (r.name = "kvcoder.config.workers.invalid.nameTaken") : r.name = "kvcoder.config.workers.invalid.nameShape", e.description.trim() === "" && (r.description = "kvcoder.config.workers.invalid.descriptionEmpty"), new TextEncoder().encode(e.instructions).length > Fe && (r.instructions = "kvcoder.config.workers.invalid.instructionsLong"), e.kind === "subagent" && !e.all && e.connectors.length === 0 && (r.connectors = "kvcoder.config.workers.invalid.connectorsEmpty"), e.kind !== "subagent" && !Ie.test(e.minutes.trim()) && (r.minutes = "kvcoder.config.workers.invalid.minutes"), Re(e) && (r.approval = "kvcoder.config.workers.invalid.unattended"), r;
496
470
  }
497
471
  //#endregion
498
472
  //#region web/src/use-workers.ts
499
- function Ge(e) {
500
- let n = W(e, "kvcoder.delegate.workers"), r = t(() => Fe(n.value.value)), i = y({});
473
+ function Be(e) {
474
+ let n = Y(e, "kvcoder.delegate.workers"), r = t(() => Ae(n.value.value)), i = b({});
501
475
  async function a(t) {
502
476
  i.value = {
503
477
  ...i.value,
@@ -507,14 +481,14 @@ function Ge(e) {
507
481
  try {
508
482
  n = (await e.exec("kvcoder.delegate.worker.check", { name: t })).status;
509
483
  } catch (t) {
510
- H(e, t), n = "notFound";
484
+ J(e, t), n = "notFound";
511
485
  }
512
486
  i.value = {
513
487
  ...i.value,
514
488
  [t]: n
515
489
  };
516
490
  }
517
- return A(r, (e) => {
491
+ return M(r, (e) => {
518
492
  for (let t of e) t.kind !== "subagent" && !(t.name in i.value) && a(t.name);
519
493
  }), {
520
494
  workers: r,
@@ -541,240 +515,169 @@ function Ge(e) {
541
515
  }
542
516
  //#endregion
543
517
  //#region web/src/ModelPicker.vue?vue&type=script&setup=true&lang.ts
544
- var Y = 24, Ke = /*@__PURE__*/ c({
545
- __name: "ModelPicker",
546
- props: {
547
- groups: {
548
- type: Array,
549
- required: !0
550
- },
551
- current: {
552
- type: [String, null],
553
- required: !0
554
- },
555
- empty: {
556
- type: null,
557
- required: !1
558
- },
559
- none: {
560
- type: null,
561
- required: !1
562
- },
563
- disabled: {
564
- type: Boolean,
565
- required: !1
566
- }
567
- },
568
- emits: ["pick", "none"],
569
- setup(e, { expose: n, emit: r }) {
570
- n();
571
- let i = e, a = r, o = V(), s = y(!1), c = y(""), l = y(0), u = T("trigger"), d = T("search"), f = T("panel"), h = t(() => De(i.groups, c.value)), g = t(() => h.value.groups.flatMap((e) => e.models)), _ = t(() => i.groups.flatMap((e) => e.models).find((e) => e.id === i.current)?.name ?? i.current ?? i.empty ?? ""), v = t(() => i.none !== void 0 && c.value.trim() === ""), b = t(() => +!!v.value), x = t(() => g.value.length + b.value), S = (e) => {
572
- let t = g.value.findIndex((t) => t.id === e);
573
- return t < 0 ? -1 : t + b.value;
574
- };
575
- function C() {
576
- s.value = !1, u.value?.focus();
577
- }
578
- async function w() {
579
- c.value = "", l.value = Math.max(S(i.current ?? ""), 0), E = 0, s.value = !0, await p(), O(), d.value?.focus(), j();
580
- }
581
- let E = 0, D = 0;
582
- function O() {
583
- let e = f.value, t = u.value?.closest(".kvc-conversation")?.getBoundingClientRect();
584
- if (e === null || t === void 0) return;
585
- let n = e.getBoundingClientRect(), r = t.left + Y - (n.left - E), i = t.right - Y - (n.right - E), a = r > 0 ? r : i < 0 ? i : 0;
586
- a !== E && (E = a, e.style.translate = `${a}px 0`);
587
- }
588
- function k() {
589
- O(), D = requestAnimationFrame(k);
590
- }
591
- function j() {
592
- f.value?.querySelector("[data-active=\"true\"]")?.scrollIntoView?.({ block: "nearest" });
593
- }
594
- async function M(e) {
595
- x.value !== 0 && (l.value = (l.value + e + x.value) % x.value, await p(), j());
596
- }
597
- function N(e) {
598
- e !== void 0 && (a("pick", e), C());
599
- }
600
- function P() {
601
- a("none"), C();
602
- }
603
- function F() {
604
- v.value && l.value === 0 ? P() : N(g.value[l.value - b.value]?.id);
605
- }
606
- function I(e) {
607
- e.target instanceof Node && !u.value?.parentElement?.contains(e.target) && (s.value = !1);
608
- }
609
- A(c, () => l.value = 0), A(s, (e) => {
610
- e ? (document.addEventListener("pointerdown", I), D = requestAnimationFrame(k)) : (document.removeEventListener("pointerdown", I), cancelAnimationFrame(D));
611
- }), m(() => {
612
- document.removeEventListener("pointerdown", I), cancelAnimationFrame(D);
613
- });
614
- let L = {
615
- props: i,
616
- emit: a,
617
- kvman: o,
618
- open: s,
619
- query: c,
620
- highlight: l,
621
- trigger: u,
622
- search: d,
623
- panel: f,
624
- gutterPx: Y,
625
- found: h,
626
- models: g,
627
- label: _,
628
- offersNone: v,
629
- first: b,
630
- count: x,
631
- indexOf: S,
632
- close: C,
633
- show: w,
634
- get shift() {
635
- return E;
636
- },
637
- set shift(e) {
638
- E = e;
639
- },
640
- get frame() {
641
- return D;
642
- },
643
- set frame(e) {
644
- D = e;
645
- },
646
- keepInside: O,
647
- follow: k,
648
- scrollToHighlight: j,
649
- move: M,
650
- pick: N,
651
- pickNone: P,
652
- pickHighlighted: F,
653
- outside: I,
654
- get Check() {
655
- return oe;
656
- },
657
- get ChevronDown() {
658
- return se;
659
- },
660
- get Search() {
661
- return le;
662
- }
663
- };
664
- return Object.defineProperty(L, "__isScriptSetup", {
665
- enumerable: !1,
666
- value: !0
667
- }), L;
668
- }
669
- }), qe = { class: "kvc-picker" }, Je = [
518
+ var Ve = { class: "kvc-picker" }, He = [
670
519
  "aria-expanded",
671
520
  "aria-label",
672
521
  "disabled"
673
- ], Ye = { class: "kvc-picker-label" }, Xe = ["onKeydown"], Ze = { class: "kvc-search" }, Qe = [
522
+ ], Ue = { class: "kvc-picker-label" }, We = ["onKeydown"], Ge = { class: "kvc-search" }, Ke = [
674
523
  "placeholder",
675
524
  "aria-label",
676
525
  "onKeydown"
677
- ], $e = ["aria-label"], et = ["aria-selected", "data-active"], tt = { class: "kvc-model-name" }, nt = {
526
+ ], qe = ["aria-label"], Je = ["aria-selected", "data-active"], Ye = { class: "kvc-model-name" }, Xe = {
678
527
  class: "kvc-group",
679
528
  role: "presentation",
680
529
  "data-test": "model-group"
681
- }, rt = [
530
+ }, Ze = [
682
531
  "aria-selected",
683
532
  "data-active",
684
533
  "data-test",
685
534
  "onClick",
686
535
  "onMousemove"
687
- ], it = { class: "kvc-model-name" }, at = {
536
+ ], Qe = { class: "kvc-model-name" }, $e = {
688
537
  key: 1,
689
538
  class: "kvc-muted kvc-none",
690
539
  "data-test": "model-none"
691
- }, ot = {
540
+ }, et = {
692
541
  class: "kvc-muted kvc-count",
693
542
  "data-test": "model-count"
694
- };
695
- function st(t, o, c, l, u, d) {
696
- return _(), i("div", qe, [a("button", {
697
- ref: "trigger",
698
- type: "button",
699
- class: "kvc-button",
700
- "aria-haspopup": "listbox",
701
- "aria-expanded": l.open,
702
- "aria-label": `${l.kvman.t("kvcoder.ui.model")}: ${l.label}`,
703
- disabled: l.props.disabled,
704
- "data-test": "model-picker",
705
- onClick: o[0] ||= (e) => l.open ? l.close() : l.show()
706
- }, [a("span", Ye, C(l.label), 1), s(l.ChevronDown, {
707
- size: 16,
708
- "aria-hidden": "true"
709
- })], 8, Je), l.open ? (_(), i("div", {
710
- key: 0,
711
- ref: "panel",
712
- class: "kvc-popover",
713
- "data-test": "model-popover",
714
- onKeydown: N(P(l.close, ["stop"]), ["esc"])
715
- }, [
716
- a("label", Ze, [s(l.Search, {
543
+ }, tt = 24, nt = /* @__PURE__ */ c({
544
+ __name: "ModelPicker",
545
+ props: {
546
+ groups: {},
547
+ current: {},
548
+ empty: {},
549
+ none: {},
550
+ disabled: { type: Boolean }
551
+ },
552
+ emits: ["pick", "none"],
553
+ setup(o, { emit: c }) {
554
+ let l = o, u = c, d = q(), f = b(!1), p = b(""), g = b(0), _ = D("trigger"), y = D("search"), S = D("panel"), C = t(() => xe(l.groups, p.value)), E = t(() => C.value.groups.flatMap((e) => e.models)), O = t(() => l.groups.flatMap((e) => e.models).find((e) => e.id === l.current)?.name ?? l.current ?? l.empty ?? ""), k = t(() => l.none !== void 0 && p.value.trim() === ""), A = t(() => +!!k.value), N = t(() => E.value.length + A.value), L = (e) => {
555
+ let t = E.value.findIndex((t) => t.id === e);
556
+ return t < 0 ? -1 : t + A.value;
557
+ };
558
+ function R() {
559
+ f.value = !1, _.value?.focus();
560
+ }
561
+ async function z() {
562
+ p.value = "", g.value = Math.max(L(l.current ?? ""), 0), B = 0, f.value = !0, await m(), H(), y.value?.focus(), ee();
563
+ }
564
+ let B = 0, V = 0;
565
+ function H() {
566
+ let e = S.value, t = _.value?.closest(".kvc-conversation")?.getBoundingClientRect();
567
+ if (e === null || t === void 0) return;
568
+ let n = e.getBoundingClientRect(), r = t.left + tt - (n.left - B), i = t.right - tt - (n.right - B), a = r > 0 ? r : i < 0 ? i : 0;
569
+ a !== B && (B = a, e.style.translate = `${a}px 0`);
570
+ }
571
+ function U() {
572
+ H(), V = requestAnimationFrame(U);
573
+ }
574
+ function ee() {
575
+ S.value?.querySelector("[data-active=\"true\"]")?.scrollIntoView?.({ block: "nearest" });
576
+ }
577
+ async function te(e) {
578
+ N.value !== 0 && (g.value = (g.value + e + N.value) % N.value, await m(), ee());
579
+ }
580
+ function ne(e) {
581
+ e !== void 0 && (u("pick", e), R());
582
+ }
583
+ function W() {
584
+ u("none"), R();
585
+ }
586
+ function G() {
587
+ k.value && g.value === 0 ? W() : ne(E.value[g.value - A.value]?.id);
588
+ }
589
+ function K(e) {
590
+ e.target instanceof Node && !_.value?.parentElement?.contains(e.target) && (f.value = !1);
591
+ }
592
+ return M(p, () => g.value = 0), M(f, (e) => {
593
+ e ? (document.addEventListener("pointerdown", K), V = requestAnimationFrame(U)) : (document.removeEventListener("pointerdown", K), cancelAnimationFrame(V));
594
+ }), h(() => {
595
+ document.removeEventListener("pointerdown", K), cancelAnimationFrame(V);
596
+ }), (t, o) => (v(), i("div", Ve, [a("button", {
597
+ ref_key: "trigger",
598
+ ref: _,
599
+ type: "button",
600
+ class: "kvc-button",
601
+ "aria-haspopup": "listbox",
602
+ "aria-expanded": f.value,
603
+ "aria-label": `${T(d).t("kvcoder.ui.model")}: ${O.value}`,
604
+ disabled: l.disabled,
605
+ "data-test": "model-picker",
606
+ onClick: o[0] ||= (e) => f.value ? R() : z()
607
+ }, [a("span", Ue, w(O.value), 1), s(T(ie), {
717
608
  size: 16,
718
609
  "aria-hidden": "true"
719
- }), M(a("input", {
720
- ref: "search",
721
- "onUpdate:modelValue": o[1] ||= (e) => l.query = e,
722
- type: "search",
723
- role: "combobox",
724
- "aria-expanded": "true",
725
- "aria-controls": "kvc-models",
726
- placeholder: l.kvman.t("kvcoder.ui.searchModels"),
727
- "aria-label": l.kvman.t("kvcoder.ui.searchModels"),
728
- "data-test": "model-search",
729
- onKeydown: [
730
- o[2] ||= N(P((e) => l.move(1), ["prevent"]), ["down"]),
731
- o[3] ||= N(P((e) => l.move(-1), ["prevent"]), ["up"]),
732
- N(P(l.pickHighlighted, ["prevent"]), ["enter"])
733
- ]
734
- }, null, 40, Qe), [[k, l.query]])]),
735
- a("div", {
736
- id: "kvc-models",
737
- class: "kvc-options",
738
- role: "listbox",
739
- "aria-label": l.kvman.t("kvcoder.ui.model")
610
+ })], 8, He), f.value ? (v(), i("div", {
611
+ key: 0,
612
+ ref_key: "panel",
613
+ ref: S,
614
+ class: "kvc-popover",
615
+ "data-test": "model-popover",
616
+ onKeydown: F(I(R, ["stop"]), ["esc"])
740
617
  }, [
741
- l.offersNone ? (_(), i("div", {
742
- key: 0,
743
- class: "kvc-model",
744
- role: "option",
745
- "aria-selected": l.props.current === null,
746
- "data-active": l.highlight === 0,
747
- "data-test": "model-none-entry",
748
- onClick: l.pickNone,
749
- onMousemove: o[4] ||= (e) => l.highlight = 0
750
- }, [a("span", tt, C(l.props.none), 1), l.props.current === null ? (_(), n(l.Check, {
751
- key: 0,
752
- size: 16,
753
- "aria-hidden": "true"
754
- })) : r("v-if", !0)], 40, et)) : r("v-if", !0),
755
- (_(!0), i(e, null, b(l.found.groups, (t) => (_(), i(e, { key: t.provider }, [a("div", nt, C(t.title), 1), (_(!0), i(e, null, b(t.models, (e) => (_(), i("div", {
756
- key: e.id,
757
- class: "kvc-model",
758
- role: "option",
759
- "aria-selected": e.id === l.props.current,
760
- "data-active": l.indexOf(e.id) === l.highlight,
761
- "data-test": `model-${e.id}`,
762
- onClick: (t) => l.pick(e.id),
763
- onMousemove: (t) => l.highlight = l.indexOf(e.id)
764
- }, [a("span", it, C(e.name), 1), e.id === l.props.current ? (_(), n(l.Check, {
765
- key: 0,
618
+ a("label", Ge, [s(T(ae), {
766
619
  size: 16,
767
620
  "aria-hidden": "true"
768
- })) : r("v-if", !0)], 40, rt))), 128))], 64))), 128)),
769
- l.found.shown === 0 ? (_(), i("p", at, C(l.kvman.t("kvcoder.ui.noModels")), 1)) : r("v-if", !0)
770
- ], 8, $e),
771
- a("p", ot, C(l.kvman.t("kvcoder.ui.modelsCount", {
772
- shown: l.found.shown,
773
- total: l.found.total
774
- })), 1)
775
- ], 40, Xe)) : r("v-if", !0)]);
776
- }
777
- var ct = /*#__PURE__*/ U(Ke, [["render", st], ["__file", "/home/runner/work/kvman/kvman/extensions/kvcoder/web/src/ModelPicker.vue"]]), lt = [
621
+ }), P(a("input", {
622
+ ref_key: "search",
623
+ ref: y,
624
+ "onUpdate:modelValue": o[1] ||= (e) => p.value = e,
625
+ type: "search",
626
+ role: "combobox",
627
+ "aria-expanded": "true",
628
+ "aria-controls": "kvc-models",
629
+ placeholder: T(d).t("kvcoder.ui.searchModels"),
630
+ "aria-label": T(d).t("kvcoder.ui.searchModels"),
631
+ "data-test": "model-search",
632
+ onKeydown: [
633
+ o[2] ||= F(I((e) => te(1), ["prevent"]), ["down"]),
634
+ o[3] ||= F(I((e) => te(-1), ["prevent"]), ["up"]),
635
+ F(I(G, ["prevent"]), ["enter"])
636
+ ]
637
+ }, null, 40, Ke), [[j, p.value]])]),
638
+ a("div", {
639
+ id: "kvc-models",
640
+ class: "kvc-options",
641
+ role: "listbox",
642
+ "aria-label": T(d).t("kvcoder.ui.model")
643
+ }, [
644
+ k.value ? (v(), i("div", {
645
+ key: 0,
646
+ class: "kvc-model",
647
+ role: "option",
648
+ "aria-selected": l.current === null,
649
+ "data-active": g.value === 0,
650
+ "data-test": "model-none-entry",
651
+ onClick: W,
652
+ onMousemove: o[4] ||= (e) => g.value = 0
653
+ }, [a("span", Ye, w(l.none), 1), l.current === null ? (v(), n(T(re), {
654
+ key: 0,
655
+ size: 16,
656
+ "aria-hidden": "true"
657
+ })) : r("v-if", !0)], 40, Je)) : r("v-if", !0),
658
+ (v(!0), i(e, null, x(C.value.groups, (t) => (v(), i(e, { key: t.provider }, [a("div", Xe, w(t.title), 1), (v(!0), i(e, null, x(t.models, (e) => (v(), i("div", {
659
+ key: e.id,
660
+ class: "kvc-model",
661
+ role: "option",
662
+ "aria-selected": e.id === l.current,
663
+ "data-active": L(e.id) === g.value,
664
+ "data-test": `model-${e.id}`,
665
+ onClick: (t) => ne(e.id),
666
+ onMousemove: (t) => g.value = L(e.id)
667
+ }, [a("span", Qe, w(e.name), 1), e.id === l.current ? (v(), n(T(re), {
668
+ key: 0,
669
+ size: 16,
670
+ "aria-hidden": "true"
671
+ })) : r("v-if", !0)], 40, Ze))), 128))], 64))), 128)),
672
+ C.value.shown === 0 ? (v(), i("p", $e, w(T(d).t("kvcoder.ui.noModels")), 1)) : r("v-if", !0)
673
+ ], 8, qe),
674
+ a("p", et, w(T(d).t("kvcoder.ui.modelsCount", {
675
+ shown: C.value.shown,
676
+ total: C.value.total
677
+ })), 1)
678
+ ], 40, We)) : r("v-if", !0)]));
679
+ }
680
+ }), rt = [
778
681
  "shell",
779
682
  "fs",
780
683
  "artifact",
@@ -782,15 +685,15 @@ var ct = /*#__PURE__*/ U(Ke, [["render", st], ["__file", "/home/runner/work/kvma
782
685
  "ask",
783
686
  "delegate",
784
687
  "mcp"
785
- ], ut = [
688
+ ], it = [
786
689
  "shell",
787
690
  "delegate",
788
691
  "mcp"
789
- ], dt = (e) => Array.isArray(e) ? e.filter((e) => typeof e == "string") : [];
790
- function ft(e) {
791
- let n = y([]), r = W(e, "kvcoder.connectors.disabled"), i = t(() => dt(r.value.value)), a = async () => {
692
+ ], at = (e) => Array.isArray(e) ? e.filter((e) => typeof e == "string") : [];
693
+ function ot(e) {
694
+ let n = b([]), r = Y(e, "kvcoder.connectors.disabled"), i = t(() => at(r.value.value)), a = async () => {
792
695
  n.value = await e.exec("kvcoder.connector.list", {});
793
- }, o = t(() => [...lt.map((t) => ({
696
+ }, o = t(() => [...rt.map((t) => ({
794
697
  name: t,
795
698
  description: e.t(`kvcoder.config.connector.${t}`)
796
699
  })), ...n.value.map((e) => ({
@@ -799,9 +702,9 @@ function ft(e) {
799
702
  }))].map((e) => ({
800
703
  ...e,
801
704
  on: !i.value.includes(e.name),
802
- configurable: ut.includes(e.name)
705
+ configurable: it.includes(e.name)
803
706
  })));
804
- return h(a), A(() => e.workspace.value.id, a), {
707
+ return g(a), M(() => e.workspace.value.id, a), {
805
708
  items: o,
806
709
  locked: r.locked,
807
710
  changed: r.changed,
@@ -812,626 +715,512 @@ function ft(e) {
812
715
  }
813
716
  //#endregion
814
717
  //#region web/src/WorkerProgramFields.vue?vue&type=script&setup=true&lang.ts
815
- var pt = /*@__PURE__*/ c({
816
- __name: "WorkerProgramFields",
817
- props: /*@__PURE__*/ d({
818
- minutesProblem: {
819
- type: null,
820
- required: !1
821
- },
822
- approvalProblem: {
823
- type: null,
824
- required: !1
825
- }
826
- }, {
827
- draft: {
828
- type: Object,
829
- required: !0
830
- },
831
- draftModifiers: {}
832
- }),
833
- emits: ["update:draft"],
834
- setup(e, { expose: t }) {
835
- t();
836
- let n = w(e, "draft"), r = e, i = V(), a = {
837
- draft: n,
838
- props: r,
839
- kvman: i,
840
- text: (e) => i.t(`kvcoder.config.workers.form.${e}`),
841
- get claudeEffort() {
842
- return Ae;
843
- },
844
- get permissionModes() {
845
- return je;
846
- },
847
- get piThinking() {
848
- return ke;
849
- }
850
- };
851
- return Object.defineProperty(a, "__isScriptSetup", {
852
- enumerable: !1,
853
- value: !0
854
- }), a;
855
- }
856
- }), mt = { class: "kvc-form-choice" }, ht = { class: "kvc-form-label" }, gt = ["value", "data-test"], _t = {
718
+ var st = { class: "kvc-form-choice" }, ct = { class: "kvc-form-label" }, lt = ["value", "data-test"], ut = {
857
719
  key: 0,
858
720
  class: "kvc-form-error",
859
721
  role: "alert",
860
722
  "data-test": "worker-approval-error"
861
- }, vt = {
723
+ }, dt = {
862
724
  key: 1,
863
725
  class: "kvc-muted"
864
- }, yt = { class: "kvc-form-field" }, bt = { class: "kvc-form-label" }, xt = ["aria-invalid"], St = {
726
+ }, ft = { class: "kvc-form-field" }, pt = { class: "kvc-form-label" }, mt = ["aria-invalid"], ht = {
865
727
  key: 0,
866
728
  class: "kvc-form-error",
867
729
  role: "alert",
868
730
  "data-test": "worker-minutes-error"
869
- }, Ct = {
731
+ }, gt = {
870
732
  key: 1,
871
733
  class: "kvc-muted"
872
- }, wt = { class: "kvc-form-field" }, Tt = { class: "kvc-form-label" }, Et = { class: "kvc-muted" }, Dt = { class: "kvc-form-field" }, Ot = { class: "kvc-form-label" }, kt = { class: "kvc-muted" }, At = { class: "kvc-form-radio" }, jt = { class: "kvc-form-field" }, Mt = { class: "kvc-form-label" }, Nt = { value: "" }, Pt = ["value"], Ft = { class: "kvc-form-field" }, It = { class: "kvc-form-label" }, Lt = { class: "kvc-muted" }, Rt = { class: "kvc-form-field" }, zt = { class: "kvc-form-label" }, Bt = { value: "" }, Vt = ["value"], Ht = { class: "kvc-form-field" }, Ut = { class: "kvc-form-label" }, Wt = ["value"], Gt = { class: "kvc-muted" };
873
- function Kt(t, n, r, s, c, l) {
874
- return _(), i(e, null, [
875
- a("fieldset", mt, [
876
- a("legend", ht, C(s.text("approval")), 1),
877
- (_(), i(e, null, b(["ask", "auto"], (e) => a("label", {
734
+ }, _t = { class: "kvc-form-field" }, vt = { class: "kvc-form-label" }, yt = { class: "kvc-muted" }, bt = { class: "kvc-form-field" }, xt = { class: "kvc-form-label" }, St = { class: "kvc-muted" }, Ct = { class: "kvc-form-radio" }, wt = { class: "kvc-form-field" }, Tt = { class: "kvc-form-label" }, Et = { value: "" }, Dt = ["value"], Ot = { class: "kvc-form-field" }, kt = { class: "kvc-form-label" }, At = { class: "kvc-muted" }, jt = { class: "kvc-form-field" }, Mt = { class: "kvc-form-label" }, Nt = { value: "" }, Pt = ["value"], Ft = { class: "kvc-form-field" }, It = { class: "kvc-form-label" }, Lt = ["value"], Rt = { class: "kvc-muted" }, zt = /* @__PURE__ */ c({
735
+ __name: "WorkerProgramFields",
736
+ props: /*@__PURE__*/ f({
737
+ minutesProblem: {},
738
+ approvalProblem: {}
739
+ }, {
740
+ draft: { required: !0 },
741
+ draftModifiers: {}
742
+ }),
743
+ emits: ["update:draft"],
744
+ setup(t) {
745
+ let n = E(t, "draft"), r = t, s = q(), c = (e) => s.t(`kvcoder.config.workers.form.${e}`);
746
+ return (t, l) => (v(), i(e, null, [
747
+ a("fieldset", st, [
748
+ a("legend", ct, w(c("approval")), 1),
749
+ (v(), i(e, null, x(["ask", "auto"], (e) => a("label", {
750
+ key: e,
751
+ class: "kvc-form-radio"
752
+ }, [P(a("input", {
753
+ "onUpdate:modelValue": l[0] ||= (e) => n.value.approval = e,
754
+ type: "radio",
755
+ name: "kvc-worker-approval",
756
+ value: e,
757
+ "data-test": `worker-approval-${e}`
758
+ }, null, 8, lt), [[k, n.value.approval]]), o(" " + w(c(`approval.${e}`)), 1)])), 64)),
759
+ r.approvalProblem === void 0 ? (v(), i("span", dt, w(c("approvalHint")), 1)) : (v(), i("span", ut, w(T(s).t(r.approvalProblem)), 1))
760
+ ]),
761
+ a("label", ft, [
762
+ a("span", pt, w(c("minutes")), 1),
763
+ P(a("input", {
764
+ "onUpdate:modelValue": l[1] ||= (e) => n.value.minutes = e,
765
+ type: "text",
766
+ inputmode: "numeric",
767
+ dir: "ltr",
768
+ class: "kvc-field kvc-mono",
769
+ autocomplete: "off",
770
+ "aria-invalid": r.minutesProblem !== void 0,
771
+ "data-test": "worker-minutes"
772
+ }, null, 8, mt), [[j, n.value.minutes]]),
773
+ r.minutesProblem === void 0 ? (v(), i("span", gt, w(c("minutesHint")), 1)) : (v(), i("span", ht, w(T(s).t(r.minutesProblem)), 1))
774
+ ]),
775
+ a("label", _t, [
776
+ a("span", vt, w(c("model")), 1),
777
+ P(a("input", {
778
+ "onUpdate:modelValue": l[2] ||= (e) => n.value.programModel = e,
779
+ type: "text",
780
+ dir: "ltr",
781
+ class: "kvc-field kvc-mono",
782
+ spellcheck: "false",
783
+ autocomplete: "off",
784
+ "data-test": "worker-program-model"
785
+ }, null, 512), [[j, n.value.programModel]]),
786
+ a("span", yt, w(c("programDefault")), 1)
787
+ ]),
788
+ n.value.kind === "opencode" ? (v(), i(e, { key: 0 }, [a("label", bt, [
789
+ a("span", xt, w(c("agent")), 1),
790
+ P(a("input", {
791
+ "onUpdate:modelValue": l[3] ||= (e) => n.value.agent = e,
792
+ type: "text",
793
+ dir: "ltr",
794
+ class: "kvc-field kvc-mono",
795
+ spellcheck: "false",
796
+ autocomplete: "off",
797
+ "data-test": "worker-agent"
798
+ }, null, 512), [[j, n.value.agent]]),
799
+ a("span", St, w(c("programDefault")), 1)
800
+ ]), a("label", Ct, [P(a("input", {
801
+ "onUpdate:modelValue": l[4] ||= (e) => n.value.autoApprove = e,
802
+ type: "checkbox",
803
+ "data-test": "worker-auto-approve"
804
+ }, null, 512), [[O, n.value.autoApprove]]), o(" " + w(c("autoApprove")), 1)])], 64)) : n.value.kind === "pi" ? (v(), i(e, { key: 1 }, [a("label", wt, [a("span", Tt, w(c("thinking")), 1), P(a("select", {
805
+ "onUpdate:modelValue": l[5] ||= (e) => n.value.piThinking = e,
806
+ class: "kvc-button",
807
+ "data-test": "worker-pi-thinking"
808
+ }, [a("option", Et, w(c("programDefault")), 1), (v(!0), i(e, null, x(T(Ce), (e) => (v(), i("option", {
878
809
  key: e,
879
- class: "kvc-form-radio"
880
- }, [M(a("input", {
881
- "onUpdate:modelValue": n[0] ||= (e) => s.draft.approval = e,
882
- type: "radio",
883
- name: "kvc-worker-approval",
884
- value: e,
885
- "data-test": `worker-approval-${e}`
886
- }, null, 8, gt), [[D, s.draft.approval]]), o(" " + C(s.text(`approval.${e}`)), 1)])), 64)),
887
- s.props.approvalProblem === void 0 ? (_(), i("span", vt, C(s.text("approvalHint")), 1)) : (_(), i("span", _t, C(s.kvman.t(s.props.approvalProblem)), 1))
888
- ]),
889
- a("label", yt, [
890
- a("span", bt, C(s.text("minutes")), 1),
891
- M(a("input", {
892
- "onUpdate:modelValue": n[1] ||= (e) => s.draft.minutes = e,
893
- type: "text",
894
- inputmode: "numeric",
895
- dir: "ltr",
896
- class: "kvc-field kvc-mono",
897
- autocomplete: "off",
898
- "aria-invalid": s.props.minutesProblem !== void 0,
899
- "data-test": "worker-minutes"
900
- }, null, 8, xt), [[k, s.draft.minutes]]),
901
- s.props.minutesProblem === void 0 ? (_(), i("span", Ct, C(s.text("minutesHint")), 1)) : (_(), i("span", St, C(s.kvman.t(s.props.minutesProblem)), 1))
902
- ]),
903
- a("label", wt, [
904
- a("span", Tt, C(s.text("model")), 1),
905
- M(a("input", {
906
- "onUpdate:modelValue": n[2] ||= (e) => s.draft.programModel = e,
907
- type: "text",
908
- dir: "ltr",
909
- class: "kvc-field kvc-mono",
910
- spellcheck: "false",
911
- autocomplete: "off",
912
- "data-test": "worker-program-model"
913
- }, null, 512), [[k, s.draft.programModel]]),
914
- a("span", Et, C(s.text("programDefault")), 1)
915
- ]),
916
- s.draft.kind === "opencode" ? (_(), i(e, { key: 0 }, [a("label", Dt, [
917
- a("span", Ot, C(s.text("agent")), 1),
918
- M(a("input", {
919
- "onUpdate:modelValue": n[3] ||= (e) => s.draft.agent = e,
920
- type: "text",
921
- dir: "ltr",
922
- class: "kvc-field kvc-mono",
923
- spellcheck: "false",
924
- autocomplete: "off",
925
- "data-test": "worker-agent"
926
- }, null, 512), [[k, s.draft.agent]]),
927
- a("span", kt, C(s.text("programDefault")), 1)
928
- ]), a("label", At, [M(a("input", {
929
- "onUpdate:modelValue": n[4] ||= (e) => s.draft.autoApprove = e,
930
- type: "checkbox",
931
- "data-test": "worker-auto-approve"
932
- }, null, 512), [[E, s.draft.autoApprove]]), o(" " + C(s.text("autoApprove")), 1)])], 64)) : s.draft.kind === "pi" ? (_(), i(e, { key: 1 }, [a("label", jt, [a("span", Mt, C(s.text("thinking")), 1), M(a("select", {
933
- "onUpdate:modelValue": n[5] ||= (e) => s.draft.piThinking = e,
934
- class: "kvc-button",
935
- "data-test": "worker-pi-thinking"
936
- }, [a("option", Nt, C(s.text("programDefault")), 1), (_(!0), i(e, null, b(s.piThinking, (e) => (_(), i("option", {
937
- key: e,
938
- value: e
939
- }, C(e), 9, Pt))), 128))], 512), [[O, s.draft.piThinking]])]), a("label", Ft, [
940
- a("span", It, C(s.text("tools")), 1),
941
- M(a("textarea", {
942
- "onUpdate:modelValue": n[6] ||= (e) => s.draft.tools = e,
943
- dir: "ltr",
944
- rows: "3",
945
- class: "kvc-field kvc-mono",
946
- spellcheck: "false",
947
- "data-test": "worker-tools"
948
- }, null, 512), [[k, s.draft.tools]]),
949
- a("span", Lt, C(s.text("toolsHint")), 1)
950
- ])], 64)) : (_(), i(e, { key: 2 }, [a("label", Rt, [a("span", zt, C(s.text("effort")), 1), M(a("select", {
951
- "onUpdate:modelValue": n[7] ||= (e) => s.draft.effort = e,
952
- class: "kvc-button",
953
- "data-test": "worker-effort"
954
- }, [a("option", Bt, C(s.text("programDefault")), 1), (_(!0), i(e, null, b(s.claudeEffort, (e) => (_(), i("option", {
955
- key: e,
956
- value: e
957
- }, C(e), 9, Vt))), 128))], 512), [[O, s.draft.effort]])]), a("label", Ht, [
958
- a("span", Ut, C(s.text("permissionMode")), 1),
959
- M(a("select", {
960
- "onUpdate:modelValue": n[8] ||= (e) => s.draft.permissionMode = e,
810
+ value: e
811
+ }, w(e), 9, Dt))), 128))], 512), [[A, n.value.piThinking]])]), a("label", Ot, [
812
+ a("span", kt, w(c("tools")), 1),
813
+ P(a("textarea", {
814
+ "onUpdate:modelValue": l[6] ||= (e) => n.value.tools = e,
815
+ dir: "ltr",
816
+ rows: "3",
817
+ class: "kvc-field kvc-mono",
818
+ spellcheck: "false",
819
+ "data-test": "worker-tools"
820
+ }, null, 512), [[j, n.value.tools]]),
821
+ a("span", At, w(c("toolsHint")), 1)
822
+ ])], 64)) : (v(), i(e, { key: 2 }, [a("label", jt, [a("span", Mt, w(c("effort")), 1), P(a("select", {
823
+ "onUpdate:modelValue": l[7] ||= (e) => n.value.effort = e,
961
824
  class: "kvc-button",
962
- "data-test": "worker-permission-mode"
963
- }, [(_(!0), i(e, null, b(s.permissionModes, (e) => (_(), i("option", {
825
+ "data-test": "worker-effort"
826
+ }, [a("option", Nt, w(c("programDefault")), 1), (v(!0), i(e, null, x(T(we), (e) => (v(), i("option", {
964
827
  key: e,
965
828
  value: e
966
- }, C(e), 9, Wt))), 128))], 512), [[O, s.draft.permissionMode]]),
967
- a("span", Gt, C(s.text("permissionModeHint")), 1)
968
- ])], 64))
969
- ], 64);
970
- }
971
- var qt = /*#__PURE__*/ U(pt, [["render", Kt], ["__file", "/home/runner/work/kvman/kvman/extensions/kvcoder/web/src/WorkerProgramFields.vue"]]), Jt = /*@__PURE__*/ c({
972
- __name: "WorkerForm",
973
- props: {
974
- entry: {
975
- type: Object,
976
- required: !1
977
- },
978
- taken: {
979
- type: Array,
980
- required: !0
981
- },
982
- working: {
983
- type: Boolean,
984
- required: !0
985
- }
986
- },
987
- emits: ["save", "cancel"],
988
- setup(e, { expose: n, emit: r }) {
989
- n();
990
- let i = e, a = r, o = V(), s = v(Le(i.entry)), c = y({}), l = y([]), u = y([]), d = y([]), f = (e) => o.t(`kvcoder.config.workers.form.${e}`), p = i.entry !== void 0, m = t(() => [...lt.filter((e) => e !== "delegate"), ...d.value]), g = t(() => Ee(l.value, u.value, s.model));
991
- h(async () => {
992
- try {
993
- let [e, t, n] = await Promise.all([
994
- o.exec("kvai.provider.list", {}),
995
- o.exec("kvai.model.list", {}),
996
- o.exec("kvcoder.connector.list", {})
997
- ]);
998
- l.value = e, u.value = t, d.value = n.map((e) => e.name);
999
- } catch (e) {
1000
- H(o, e);
1001
- }
1002
- });
1003
- function _(e, t) {
1004
- let n = t.target instanceof HTMLInputElement && t.target.checked;
1005
- s.connectors = n ? [...s.connectors, e] : s.connectors.filter((t) => t !== e);
1006
- }
1007
- function b() {
1008
- c.value = We(s, i.taken), !(Object.keys(c.value).length > 0) && a("save", Re(s, m.value));
1009
- }
1010
- let x = {
1011
- props: i,
1012
- emit: a,
1013
- kvman: o,
1014
- get draft() {
1015
- return s;
1016
- },
1017
- set draft(e) {
1018
- s = e;
1019
- },
1020
- problems: c,
1021
- providers: l,
1022
- models: u,
1023
- added: d,
1024
- text: f,
1025
- editing: p,
1026
- offered: m,
1027
- groups: g,
1028
- tick: _,
1029
- submit: b,
1030
- get thinkingLevels() {
1031
- return Oe;
1032
- },
1033
- ModelPicker: ct,
1034
- get workerKinds() {
1035
- return Me;
1036
- },
1037
- WorkerProgramFields: qt
1038
- };
1039
- return Object.defineProperty(x, "__isScriptSetup", {
1040
- enumerable: !1,
1041
- value: !0
1042
- }), x;
829
+ }, w(e), 9, Pt))), 128))], 512), [[A, n.value.effort]])]), a("label", Ft, [
830
+ a("span", It, w(c("permissionMode")), 1),
831
+ P(a("select", {
832
+ "onUpdate:modelValue": l[8] ||= (e) => n.value.permissionMode = e,
833
+ class: "kvc-button",
834
+ "data-test": "worker-permission-mode"
835
+ }, [(v(!0), i(e, null, x(T(Te), (e) => (v(), i("option", {
836
+ key: e,
837
+ value: e
838
+ }, w(e), 9, Lt))), 128))], 512), [[A, n.value.permissionMode]]),
839
+ a("span", Rt, w(c("permissionModeHint")), 1)
840
+ ])], 64))
841
+ ], 64));
1043
842
  }
1044
- }), Yt = {
843
+ }), Bt = {
1045
844
  class: "kvc-setting-title",
1046
845
  "data-test": "worker-form-title"
1047
- }, Xt = { class: "kvc-form-field" }, Zt = { class: "kvc-form-label" }, Qt = ["aria-invalid"], $t = {
846
+ }, Vt = { class: "kvc-form-field" }, Ht = { class: "kvc-form-label" }, Ut = ["aria-invalid"], Wt = {
1048
847
  key: 0,
1049
848
  class: "kvc-form-error",
1050
849
  role: "alert",
1051
850
  "data-test": "worker-name-error"
1052
- }, en = {
851
+ }, Gt = {
1053
852
  key: 1,
1054
853
  class: "kvc-muted"
1055
- }, tn = { class: "kvc-form-field" }, nn = { class: "kvc-form-label" }, rn = ["aria-invalid"], an = {
854
+ }, Kt = { class: "kvc-form-field" }, qt = { class: "kvc-form-label" }, Jt = ["aria-invalid"], Yt = {
1056
855
  key: 0,
1057
856
  class: "kvc-form-error",
1058
857
  role: "alert",
1059
858
  "data-test": "worker-description-error"
1060
- }, on = {
859
+ }, Xt = {
1061
860
  key: 1,
1062
861
  class: "kvc-muted"
1063
- }, sn = { class: "kvc-form-field" }, cn = { class: "kvc-form-label" }, ln = ["value"], un = { class: "kvc-muted" }, dn = { class: "kvc-form-field" }, fn = { class: "kvc-form-label" }, pn = ["aria-invalid"], mn = {
862
+ }, Zt = { class: "kvc-form-field" }, Qt = { class: "kvc-form-label" }, $t = ["value"], en = { class: "kvc-muted" }, tn = { class: "kvc-form-field" }, nn = { class: "kvc-form-label" }, rn = ["aria-invalid"], an = {
1064
863
  key: 0,
1065
864
  class: "kvc-form-error",
1066
865
  role: "alert",
1067
866
  "data-test": "worker-instructions-error"
1068
- }, hn = {
867
+ }, on = {
1069
868
  key: 1,
1070
869
  class: "kvc-muted"
1071
- }, gn = { class: "kvc-form-choice" }, _n = { class: "kvc-form-label" }, vn = { class: "kvc-form-radio" }, yn = ["checked"], bn = { class: "kvc-form-radio" }, xn = ["checked"], Sn = [
870
+ }, sn = { class: "kvc-form-choice" }, cn = { class: "kvc-form-label" }, ln = { class: "kvc-form-radio" }, un = ["checked"], dn = { class: "kvc-form-radio" }, fn = ["checked"], pn = [
1072
871
  "checked",
1073
872
  "data-test",
1074
873
  "onChange"
1075
- ], Cn = {
874
+ ], mn = {
1076
875
  key: 1,
1077
876
  class: "kvc-form-error",
1078
877
  role: "alert",
1079
878
  "data-test": "worker-connectors-error"
1080
- }, wn = {
879
+ }, hn = {
1081
880
  key: 2,
1082
881
  class: "kvc-muted"
1083
- }, Tn = {
882
+ }, gn = {
1084
883
  class: "kvc-form-field",
1085
884
  "data-test": "worker-model"
1086
- }, En = { class: "kvc-form-label" }, Dn = { class: "kvc-form-field" }, On = { class: "kvc-form-label" }, kn = { value: "" }, An = ["value"], jn = { class: "kvc-actions" }, Mn = ["disabled"], Nn = ["disabled"];
1087
- function Pn(t, c, l, u, d, f) {
1088
- return _(), i("form", {
1089
- class: "kvc-form",
1090
- novalidate: "",
1091
- "data-test": "worker-form",
1092
- onSubmit: P(u.submit, ["prevent"])
1093
- }, [
1094
- a("span", Yt, C(u.editing ? u.kvman.t("kvcoder.config.workers.form.titleEdit", { name: u.draft.name }) : u.text("titleNew")), 1),
1095
- a("label", Xt, [
1096
- a("span", Zt, C(u.text("name")), 1),
1097
- M(a("input", {
1098
- "onUpdate:modelValue": c[0] ||= (e) => u.draft.name = e,
1099
- type: "text",
1100
- dir: "ltr",
1101
- class: "kvc-field kvc-mono",
1102
- disabled: u.editing,
1103
- spellcheck: "false",
1104
- autocomplete: "off",
1105
- "aria-invalid": u.problems.name !== void 0,
1106
- "data-test": "worker-name"
1107
- }, null, 8, Qt), [[k, u.draft.name]]),
1108
- u.problems.name === void 0 ? (_(), i("span", en, C(u.text("nameHint")), 1)) : (_(), i("span", $t, C(u.kvman.t(u.problems.name)), 1))
1109
- ]),
1110
- a("label", tn, [
1111
- a("span", nn, C(u.text("description")), 1),
1112
- M(a("input", {
1113
- "onUpdate:modelValue": c[1] ||= (e) => u.draft.description = e,
1114
- type: "text",
1115
- dir: "auto",
1116
- class: "kvc-field",
1117
- autocomplete: "off",
1118
- "aria-invalid": u.problems.description !== void 0,
1119
- "data-test": "worker-description"
1120
- }, null, 8, rn), [[k, u.draft.description]]),
1121
- u.problems.description === void 0 ? (_(), i("span", on, C(u.text("descriptionHint")), 1)) : (_(), i("span", an, C(u.kvman.t(u.problems.description)), 1))
1122
- ]),
1123
- a("label", sn, [
1124
- a("span", cn, C(u.text("kind")), 1),
1125
- M(a("select", {
1126
- "onUpdate:modelValue": c[2] ||= (e) => u.draft.kind = e,
1127
- class: "kvc-button",
1128
- disabled: u.editing,
1129
- "data-test": "worker-kind-select"
1130
- }, [(_(!0), i(e, null, b(u.workerKinds, (e) => (_(), i("option", {
1131
- key: e,
1132
- value: e
1133
- }, C(u.kvman.t(`kvcoder.config.workers.kind.${e}`)), 9, ln))), 128))], 512), [[O, u.draft.kind]]),
1134
- a("span", un, C(u.text("kindHint")), 1)
1135
- ]),
1136
- a("label", dn, [
1137
- a("span", fn, C(u.text("instructions")), 1),
1138
- M(a("textarea", {
1139
- "onUpdate:modelValue": c[3] ||= (e) => u.draft.instructions = e,
1140
- dir: "auto",
1141
- rows: "8",
1142
- class: "kvc-field",
1143
- "aria-invalid": u.problems.instructions !== void 0,
1144
- "data-test": "worker-instructions"
1145
- }, null, 8, pn), [[k, u.draft.instructions]]),
1146
- u.problems.instructions === void 0 ? (_(), i("span", hn, C(u.text("instructionsHint")), 1)) : (_(), i("span", mn, C(u.kvman.t(u.problems.instructions)), 1))
1147
- ]),
1148
- u.draft.kind === "subagent" ? (_(), i(e, { key: 1 }, [
1149
- a("fieldset", gn, [
1150
- a("legend", _n, C(u.text("connectors")), 1),
1151
- a("label", vn, [a("input", {
1152
- type: "radio",
1153
- name: "kvc-worker-connectors",
1154
- checked: u.draft.all,
1155
- "data-test": "worker-connectors-all",
1156
- onChange: c[5] ||= (e) => u.draft.all = !0
1157
- }, null, 40, yn), o(" " + C(u.text("connectors.all")), 1)]),
1158
- a("label", bn, [a("input", {
1159
- type: "radio",
1160
- name: "kvc-worker-connectors",
1161
- checked: !u.draft.all,
1162
- "data-test": "worker-connectors-some",
1163
- onChange: c[6] ||= (e) => u.draft.all = !1
1164
- }, null, 40, xn), o(" " + C(u.text("connectors.some")), 1)]),
1165
- u.draft.all ? r("v-if", !0) : (_(!0), i(e, { key: 0 }, b(u.offered, (e) => (_(), i("label", {
885
+ }, _n = { class: "kvc-form-label" }, vn = { class: "kvc-form-field" }, yn = { class: "kvc-form-label" }, bn = { value: "" }, xn = ["value"], Sn = { class: "kvc-actions" }, Cn = ["disabled"], wn = ["disabled"], Tn = /* @__PURE__ */ c({
886
+ __name: "WorkerForm",
887
+ props: {
888
+ entry: {},
889
+ taken: {},
890
+ working: { type: Boolean }
891
+ },
892
+ emits: ["save", "cancel"],
893
+ setup(c, { emit: l }) {
894
+ let u = c, f = l, p = q(), m = y(Me(u.entry)), h = b({}), _ = b([]), S = b([]), C = b([]), E = (e) => p.t(`kvcoder.config.workers.form.${e}`), D = u.entry !== void 0, O = t(() => [...rt.filter((e) => e !== "delegate"), ...C.value]), k = t(() => be(_.value, S.value, m.model));
895
+ g(async () => {
896
+ try {
897
+ let [e, t, n] = await Promise.all([
898
+ p.exec("kvai.provider.list", {}),
899
+ p.exec("kvai.model.list", {}),
900
+ p.exec("kvcoder.connector.list", {})
901
+ ]);
902
+ _.value = e, S.value = t, C.value = n.map((e) => e.name);
903
+ } catch (e) {
904
+ J(p, e);
905
+ }
906
+ });
907
+ function M(e, t) {
908
+ let n = t.target instanceof HTMLInputElement && t.target.checked;
909
+ m.connectors = n ? [...m.connectors, e] : m.connectors.filter((t) => t !== e);
910
+ }
911
+ function N() {
912
+ h.value = ze(m, u.taken), !(Object.keys(h.value).length > 0) && f("save", Ne(m, O.value));
913
+ }
914
+ return (t, c) => (v(), i("form", {
915
+ class: "kvc-form",
916
+ novalidate: "",
917
+ "data-test": "worker-form",
918
+ onSubmit: I(N, ["prevent"])
919
+ }, [
920
+ a("span", Bt, w(D ? T(p).t("kvcoder.config.workers.form.titleEdit", { name: T(m).name }) : E("titleNew")), 1),
921
+ a("label", Vt, [
922
+ a("span", Ht, w(E("name")), 1),
923
+ P(a("input", {
924
+ "onUpdate:modelValue": c[0] ||= (e) => T(m).name = e,
925
+ type: "text",
926
+ dir: "ltr",
927
+ class: "kvc-field kvc-mono",
928
+ disabled: D,
929
+ spellcheck: "false",
930
+ autocomplete: "off",
931
+ "aria-invalid": h.value.name !== void 0,
932
+ "data-test": "worker-name"
933
+ }, null, 8, Ut), [[j, T(m).name]]),
934
+ h.value.name === void 0 ? (v(), i("span", Gt, w(E("nameHint")), 1)) : (v(), i("span", Wt, w(T(p).t(h.value.name)), 1))
935
+ ]),
936
+ a("label", Kt, [
937
+ a("span", qt, w(E("description")), 1),
938
+ P(a("input", {
939
+ "onUpdate:modelValue": c[1] ||= (e) => T(m).description = e,
940
+ type: "text",
941
+ dir: "auto",
942
+ class: "kvc-field",
943
+ autocomplete: "off",
944
+ "aria-invalid": h.value.description !== void 0,
945
+ "data-test": "worker-description"
946
+ }, null, 8, Jt), [[j, T(m).description]]),
947
+ h.value.description === void 0 ? (v(), i("span", Xt, w(E("descriptionHint")), 1)) : (v(), i("span", Yt, w(T(p).t(h.value.description)), 1))
948
+ ]),
949
+ a("label", Zt, [
950
+ a("span", Qt, w(E("kind")), 1),
951
+ P(a("select", {
952
+ "onUpdate:modelValue": c[2] ||= (e) => T(m).kind = e,
953
+ class: "kvc-button",
954
+ disabled: D,
955
+ "data-test": "worker-kind-select"
956
+ }, [(v(!0), i(e, null, x(T(Ee), (e) => (v(), i("option", {
1166
957
  key: e,
1167
- class: "kvc-form-radio kvc-mono"
1168
- }, [a("input", {
1169
- type: "checkbox",
1170
- checked: u.draft.connectors.includes(e),
1171
- "data-test": `worker-connector-${e}`,
1172
- onChange: (t) => u.tick(e, t)
1173
- }, null, 40, Sn), o(" " + C(e), 1)]))), 128)),
1174
- u.problems.connectors === void 0 ? (_(), i("span", wn, C(u.text("connectorsHint")), 1)) : (_(), i("span", Cn, C(u.kvman.t(u.problems.connectors)), 1))
958
+ value: e
959
+ }, w(T(p).t(`kvcoder.config.workers.kind.${e}`)), 9, $t))), 128))], 512), [[A, T(m).kind]]),
960
+ a("span", en, w(E("kindHint")), 1)
961
+ ]),
962
+ a("label", tn, [
963
+ a("span", nn, w(E("instructions")), 1),
964
+ P(a("textarea", {
965
+ "onUpdate:modelValue": c[3] ||= (e) => T(m).instructions = e,
966
+ dir: "auto",
967
+ rows: "8",
968
+ class: "kvc-field",
969
+ "aria-invalid": h.value.instructions !== void 0,
970
+ "data-test": "worker-instructions"
971
+ }, null, 8, rn), [[j, T(m).instructions]]),
972
+ h.value.instructions === void 0 ? (v(), i("span", on, w(E("instructionsHint")), 1)) : (v(), i("span", an, w(T(p).t(h.value.instructions)), 1))
1175
973
  ]),
1176
- a("div", Tn, [a("span", En, C(u.text("model")), 1), s(u.ModelPicker, {
1177
- groups: u.groups,
1178
- current: u.draft.model,
1179
- empty: u.text("sameModel"),
1180
- none: u.text("sameModel"),
1181
- onPick: c[7] ||= (e) => u.draft.model = e,
1182
- onNone: c[8] ||= (e) => u.draft.model = null
974
+ T(m).kind === "subagent" ? (v(), i(e, { key: 1 }, [
975
+ a("fieldset", sn, [
976
+ a("legend", cn, w(E("connectors")), 1),
977
+ a("label", ln, [a("input", {
978
+ type: "radio",
979
+ name: "kvc-worker-connectors",
980
+ checked: T(m).all,
981
+ "data-test": "worker-connectors-all",
982
+ onChange: c[5] ||= (e) => T(m).all = !0
983
+ }, null, 40, un), o(" " + w(E("connectors.all")), 1)]),
984
+ a("label", dn, [a("input", {
985
+ type: "radio",
986
+ name: "kvc-worker-connectors",
987
+ checked: !T(m).all,
988
+ "data-test": "worker-connectors-some",
989
+ onChange: c[6] ||= (e) => T(m).all = !1
990
+ }, null, 40, fn), o(" " + w(E("connectors.some")), 1)]),
991
+ T(m).all ? r("v-if", !0) : (v(!0), i(e, { key: 0 }, x(O.value, (e) => (v(), i("label", {
992
+ key: e,
993
+ class: "kvc-form-radio kvc-mono"
994
+ }, [a("input", {
995
+ type: "checkbox",
996
+ checked: T(m).connectors.includes(e),
997
+ "data-test": `worker-connector-${e}`,
998
+ onChange: (t) => M(e, t)
999
+ }, null, 40, pn), o(" " + w(e), 1)]))), 128)),
1000
+ h.value.connectors === void 0 ? (v(), i("span", hn, w(E("connectorsHint")), 1)) : (v(), i("span", mn, w(T(p).t(h.value.connectors)), 1))
1001
+ ]),
1002
+ a("div", gn, [a("span", _n, w(E("model")), 1), s(nt, {
1003
+ groups: k.value,
1004
+ current: T(m).model,
1005
+ empty: E("sameModel"),
1006
+ none: E("sameModel"),
1007
+ onPick: c[7] ||= (e) => T(m).model = e,
1008
+ onNone: c[8] ||= (e) => T(m).model = null
1009
+ }, null, 8, [
1010
+ "groups",
1011
+ "current",
1012
+ "empty",
1013
+ "none"
1014
+ ])]),
1015
+ a("label", vn, [a("span", yn, w(E("thinking")), 1), P(a("select", {
1016
+ "onUpdate:modelValue": c[9] ||= (e) => T(m).thinking = e,
1017
+ class: "kvc-button",
1018
+ "data-test": "worker-thinking"
1019
+ }, [a("option", bn, w(E("sameThinking")), 1), (v(!0), i(e, null, x(T(Se), (e) => (v(), i("option", {
1020
+ key: e,
1021
+ value: e
1022
+ }, w(T(p).t(`kvcoder.ui.thinkingLevels.${e}`)), 9, xn))), 128))], 512), [[A, T(m).thinking]])])
1023
+ ], 64)) : (v(), n(zt, {
1024
+ key: 0,
1025
+ draft: T(m),
1026
+ "onUpdate:draft": c[4] ||= (e) => d(m) ? m.value = e : m = e,
1027
+ "minutes-problem": h.value.minutes,
1028
+ "approval-problem": h.value.approval
1183
1029
  }, null, 8, [
1184
- "groups",
1185
- "current",
1186
- "empty",
1187
- "none"
1188
- ])]),
1189
- a("label", Dn, [a("span", On, C(u.text("thinking")), 1), M(a("select", {
1190
- "onUpdate:modelValue": c[9] ||= (e) => u.draft.thinking = e,
1030
+ "draft",
1031
+ "minutes-problem",
1032
+ "approval-problem"
1033
+ ])),
1034
+ a("div", Sn, [a("button", {
1035
+ type: "button",
1191
1036
  class: "kvc-button",
1192
- "data-test": "worker-thinking"
1193
- }, [a("option", kn, C(u.text("sameThinking")), 1), (_(!0), i(e, null, b(u.thinkingLevels, (e) => (_(), i("option", {
1194
- key: e,
1195
- value: e
1196
- }, C(u.kvman.t(`kvcoder.ui.thinkingLevels.${e}`)), 9, An))), 128))], 512), [[O, u.draft.thinking]])])
1197
- ], 64)) : (_(), n(u.WorkerProgramFields, {
1198
- key: 0,
1199
- draft: u.draft,
1200
- "onUpdate:draft": c[4] ||= (e) => u.draft = e,
1201
- "minutes-problem": u.problems.minutes,
1202
- "approval-problem": u.problems.approval
1203
- }, null, 8, [
1204
- "draft",
1205
- "minutes-problem",
1206
- "approval-problem"
1207
- ])),
1208
- a("div", jn, [a("button", {
1209
- type: "button",
1210
- class: "kvc-button",
1211
- disabled: u.props.working,
1212
- "data-test": "worker-cancel",
1213
- onClick: c[10] ||= (e) => u.emit("cancel")
1214
- }, C(u.kvman.t("kvcoder.config.workers.cancel")), 9, Mn), a("button", {
1215
- type: "submit",
1216
- class: "kvc-button kvc-primary",
1217
- disabled: u.props.working,
1218
- "data-test": "worker-save"
1219
- }, C(u.text("save")), 9, Nn)])
1220
- ], 32);
1221
- }
1222
- var Fn = /*#__PURE__*/ U(Jt, [["render", Pn], ["__file", "/home/runner/work/kvman/kvman/extensions/kvcoder/web/src/WorkerForm.vue"]]), In = /*@__PURE__*/ c({
1223
- __name: "DelegateWorkers",
1224
- setup(e, { expose: t }) {
1225
- t();
1226
- let n = V(), { workers: r, states: i, locked: a, changed: o, working: s, save: c, remove: l, toggle: u, reset: d, check: f } = Ge(n), p = y(), m = y(), h = (e) => n.t(`${e}.${n.scope.value}`, { name: n.workspace.value.name }), g = (e, t) => n.t(`kvcoder.config.workers.${e}`, { name: t });
1227
- async function _(e) {
1228
- await c(e) && (p.value = void 0, n.toast("kvcoder.config.workers.saved", { name: e.name }, "success"));
1229
- }
1230
- async function v(e) {
1231
- await l(e) && n.toast("kvcoder.config.workers.removed", { name: e }, "success"), m.value = void 0;
1232
- }
1233
- let b = {
1234
- kvman: n,
1235
- workers: r,
1236
- states: i,
1237
- locked: a,
1238
- changed: o,
1239
- working: s,
1240
- save: c,
1241
- remove: l,
1242
- toggle: u,
1243
- reset: d,
1244
- check: f,
1245
- form: p,
1246
- removing: m,
1247
- scoped: h,
1248
- named: g,
1249
- saved: _,
1250
- removed: v,
1251
- get Pencil() {
1252
- return ce;
1253
- },
1254
- get Plus() {
1255
- return B;
1256
- },
1257
- get Trash2() {
1258
- return de;
1259
- },
1260
- WorkerForm: Fn
1261
- };
1262
- return Object.defineProperty(b, "__isScriptSetup", {
1263
- enumerable: !1,
1264
- value: !0
1265
- }), b;
1037
+ disabled: u.working,
1038
+ "data-test": "worker-cancel",
1039
+ onClick: c[10] ||= (e) => f("cancel")
1040
+ }, w(T(p).t("kvcoder.config.workers.cancel")), 9, Cn), a("button", {
1041
+ type: "submit",
1042
+ class: "kvc-button kvc-primary",
1043
+ disabled: u.working,
1044
+ "data-test": "worker-save"
1045
+ }, w(E("save")), 9, wn)])
1046
+ ], 32));
1266
1047
  }
1267
- }), Ln = {
1048
+ }), En = {
1268
1049
  key: 1,
1269
1050
  class: "kvc-dialog-rows",
1270
1051
  "data-test": "workers"
1271
- }, Rn = { class: "kvc-muted" }, zn = {
1052
+ }, Dn = { class: "kvc-muted" }, On = {
1272
1053
  key: 0,
1273
1054
  class: "kvc-muted",
1274
1055
  "data-test": "workers-own-value"
1275
- }, Bn = {
1056
+ }, kn = {
1276
1057
  key: 1,
1277
1058
  class: "kvc-connectors-state"
1278
- }, Vn = {
1059
+ }, An = {
1279
1060
  class: "kvc-chip",
1280
1061
  "data-test": "workers-changed"
1281
- }, Hn = ["disabled"], Un = {
1062
+ }, jn = ["disabled"], Mn = {
1282
1063
  key: 2,
1283
1064
  class: "kvc-muted",
1284
1065
  "data-test": "workers-empty"
1285
- }, Wn = ["data-test"], Gn = { class: "kvc-connector-text" }, Kn = {
1066
+ }, Nn = ["data-test"], Pn = { class: "kvc-connector-text" }, Fn = {
1286
1067
  class: "kvc-mono kvc-connector-name",
1287
1068
  "data-test": "worker-name"
1288
- }, qn = {
1069
+ }, In = {
1289
1070
  class: "kvc-muted",
1290
1071
  dir: "auto",
1291
1072
  "data-test": "worker-description"
1292
- }, Jn = {
1073
+ }, Ln = {
1293
1074
  class: "kvc-chip",
1294
1075
  "data-test": "worker-kind"
1295
- }, Yn = {
1076
+ }, Rn = {
1296
1077
  key: 0,
1297
1078
  class: "kvc-server-state",
1298
1079
  "data-status": "checking",
1299
1080
  role: "status",
1300
1081
  "data-test": "worker-state"
1301
- }, Xn = {
1082
+ }, zn = {
1302
1083
  key: 1,
1303
1084
  class: "kvc-server-state",
1304
1085
  "data-status": "failed",
1305
1086
  role: "status",
1306
1087
  "data-test": "worker-state"
1307
- }, Zn = ["onClick"], Qn = ["aria-label"], $n = { class: "kvc-muted" }, er = ["disabled"], tr = ["disabled", "onClick"], nr = {
1088
+ }, Bn = ["onClick"], Vn = ["aria-label"], Hn = { class: "kvc-muted" }, Un = ["disabled"], Wn = ["disabled", "onClick"], Gn = {
1308
1089
  key: 1,
1309
1090
  class: "kvc-connector-actions"
1310
- }, rr = [
1091
+ }, Kn = [
1311
1092
  "disabled",
1312
1093
  "aria-label",
1313
1094
  "title",
1314
1095
  "onClick"
1315
- ], ir = [
1096
+ ], qn = [
1316
1097
  "disabled",
1317
1098
  "aria-label",
1318
1099
  "title",
1319
1100
  "onClick"
1320
- ], ar = [
1101
+ ], Jn = [
1321
1102
  "aria-checked",
1322
1103
  "aria-label",
1323
1104
  "disabled",
1324
1105
  "onClick"
1325
- ], or = { class: "kvc-actions" }, sr = ["disabled"];
1326
- function cr(t, c, l, u, d, p) {
1327
- return u.form === void 0 ? (_(), i("div", Ln, [
1328
- a("p", Rn, C(u.kvman.t("kvcoder.config.workers.intro")), 1),
1329
- u.locked ? (_(), i("p", zn, C(u.kvman.t("kvcoder.config.connectors.ownValue", { name: u.kvman.workspace.value.name })), 1)) : u.changed ? (_(), i("div", Bn, [a("span", Vn, C(u.scoped("kvcoder.config.connectors.changed")), 1), a("button", {
1330
- type: "button",
1331
- class: "kvc-text-button",
1332
- disabled: u.working,
1333
- "data-test": "workers-reset",
1334
- onClick: c[1] ||= (...e) => u.reset && u.reset(...e)
1335
- }, C(u.scoped("kvcoder.config.connectors.reset")), 9, Hn)])) : r("v-if", !0),
1336
- u.workers.length === 0 ? (_(), i("p", Un, C(u.kvman.t("kvcoder.config.workers.empty")), 1)) : r("v-if", !0),
1337
- (_(!0), i(e, null, b(u.workers, (e) => (_(), i("div", {
1338
- key: e.name,
1339
- class: "kvc-connector",
1340
- "data-test": `worker-${e.name}`
1341
- }, [a("span", Gn, [
1342
- a("span", Kn, C(e.name), 1),
1343
- a("span", qn, C(e.description), 1),
1344
- a("span", null, [a("span", Jn, C(u.kvman.t(`kvcoder.config.workers.kind.${e.kind}`)), 1)]),
1345
- u.states[e.name] === "checking" ? (_(), i("span", Yn, C(u.kvman.t("kvcoder.config.workers.checking")), 1)) : u.states[e.name] === "notFound" ? (_(), i("span", Xn, [o(C(u.kvman.t("kvcoder.config.workers.notFound", { program: e.kind })) + " ", 1), a("button", {
1106
+ ], Yn = { class: "kvc-actions" }, Xn = ["disabled"], Zn = /* @__PURE__ */ c({
1107
+ __name: "DelegateWorkers",
1108
+ setup(t) {
1109
+ let c = q(), { workers: l, states: u, locked: d, changed: f, working: m, save: h, remove: g, toggle: _, reset: y, check: S } = Be(c), C = b(), E = b(), D = (e) => c.t(`${e}.${c.scope.value}`, { name: c.workspace.value.name }), O = (e, t) => c.t(`kvcoder.config.workers.${e}`, { name: t });
1110
+ async function k(e) {
1111
+ await h(e) && (C.value = void 0, c.toast("kvcoder.config.workers.saved", { name: e.name }, "success"));
1112
+ }
1113
+ async function A(e) {
1114
+ await g(e) && c.toast("kvcoder.config.workers.removed", { name: e }, "success"), E.value = void 0;
1115
+ }
1116
+ return (t, h) => C.value === void 0 ? (v(), i("div", En, [
1117
+ a("p", Dn, w(T(c).t("kvcoder.config.workers.intro")), 1),
1118
+ T(d) ? (v(), i("p", On, w(T(c).t("kvcoder.config.connectors.ownValue", { name: T(c).workspace.value.name })), 1)) : T(f) ? (v(), i("div", kn, [a("span", An, w(D("kvcoder.config.connectors.changed")), 1), a("button", {
1346
1119
  type: "button",
1347
1120
  class: "kvc-text-button",
1348
- "data-test": "worker-check",
1349
- onClick: (t) => u.check(e.name)
1350
- }, C(u.kvman.t("kvcoder.config.workers.recheck")), 9, Zn)])) : r("v-if", !0)
1351
- ]), u.removing === e.name ? (_(), i("span", {
1352
- key: 0,
1353
- class: "kvc-connector-actions",
1354
- role: "alertdialog",
1355
- "aria-label": u.named("removeConfirm", e.name),
1356
- "data-test": "worker-remove-confirm"
1357
- }, [
1358
- a("span", $n, C(u.named("removeConfirm", e.name)), 1),
1359
- a("button", {
1360
- type: "button",
1361
- class: "kvc-button",
1362
- disabled: u.working,
1363
- "data-test": "worker-remove-cancel",
1364
- onClick: c[2] ||= (e) => u.removing = void 0
1365
- }, C(u.kvman.t("kvcoder.config.workers.cancel")), 9, er),
1366
- a("button", {
1367
- type: "button",
1368
- class: "kvc-button kvc-danger",
1369
- disabled: u.working,
1370
- "data-test": "worker-remove-yes",
1371
- onClick: (t) => u.removed(e.name)
1372
- }, C(u.kvman.t("kvcoder.config.workers.removeYes")), 9, tr)
1373
- ], 8, Qn)) : (_(), i("span", nr, [
1374
- a("button", {
1375
- type: "button",
1376
- class: "kvc-button kvc-ghost kvc-icon-button",
1377
- disabled: u.locked || u.working,
1378
- "aria-label": u.named("edit", e.name),
1379
- title: u.named("edit", e.name),
1380
- "data-test": "worker-edit",
1381
- onClick: (t) => u.form = { entry: e }
1382
- }, [s(u.Pencil, {
1383
- size: 16,
1384
- "aria-hidden": "true"
1385
- })], 8, rr),
1386
- a("button", {
1121
+ disabled: T(m),
1122
+ "data-test": "workers-reset",
1123
+ onClick: h[1] ||= (...e) => T(y) && T(y)(...e)
1124
+ }, w(D("kvcoder.config.connectors.reset")), 9, jn)])) : r("v-if", !0),
1125
+ T(l).length === 0 ? (v(), i("p", Mn, w(T(c).t("kvcoder.config.workers.empty")), 1)) : r("v-if", !0),
1126
+ (v(!0), i(e, null, x(T(l), (e) => (v(), i("div", {
1127
+ key: e.name,
1128
+ class: "kvc-connector",
1129
+ "data-test": `worker-${e.name}`
1130
+ }, [a("span", Pn, [
1131
+ a("span", Fn, w(e.name), 1),
1132
+ a("span", In, w(e.description), 1),
1133
+ a("span", null, [a("span", Ln, w(T(c).t(`kvcoder.config.workers.kind.${e.kind}`)), 1)]),
1134
+ T(u)[e.name] === "checking" ? (v(), i("span", Rn, w(T(c).t("kvcoder.config.workers.checking")), 1)) : T(u)[e.name] === "notFound" ? (v(), i("span", zn, [o(w(T(c).t("kvcoder.config.workers.notFound", { program: e.kind })) + " ", 1), a("button", {
1135
+ type: "button",
1136
+ class: "kvc-text-button",
1137
+ "data-test": "worker-check",
1138
+ onClick: (t) => T(S)(e.name)
1139
+ }, w(T(c).t("kvcoder.config.workers.recheck")), 9, Bn)])) : r("v-if", !0)
1140
+ ]), E.value === e.name ? (v(), i("span", {
1141
+ key: 0,
1142
+ class: "kvc-connector-actions",
1143
+ role: "alertdialog",
1144
+ "aria-label": O("removeConfirm", e.name),
1145
+ "data-test": "worker-remove-confirm"
1146
+ }, [
1147
+ a("span", Hn, w(O("removeConfirm", e.name)), 1),
1148
+ a("button", {
1149
+ type: "button",
1150
+ class: "kvc-button",
1151
+ disabled: T(m),
1152
+ "data-test": "worker-remove-cancel",
1153
+ onClick: h[2] ||= (e) => E.value = void 0
1154
+ }, w(T(c).t("kvcoder.config.workers.cancel")), 9, Un),
1155
+ a("button", {
1156
+ type: "button",
1157
+ class: "kvc-button kvc-danger",
1158
+ disabled: T(m),
1159
+ "data-test": "worker-remove-yes",
1160
+ onClick: (t) => A(e.name)
1161
+ }, w(T(c).t("kvcoder.config.workers.removeYes")), 9, Wn)
1162
+ ], 8, Vn)) : (v(), i("span", Gn, [
1163
+ a("button", {
1164
+ type: "button",
1165
+ class: "kvc-button kvc-ghost kvc-icon-button",
1166
+ disabled: T(d) || T(m),
1167
+ "aria-label": O("edit", e.name),
1168
+ title: O("edit", e.name),
1169
+ "data-test": "worker-edit",
1170
+ onClick: (t) => C.value = { entry: e }
1171
+ }, [s(T(G), {
1172
+ size: 16,
1173
+ "aria-hidden": "true"
1174
+ })], 8, Kn),
1175
+ a("button", {
1176
+ type: "button",
1177
+ class: "kvc-button kvc-ghost kvc-icon-button",
1178
+ disabled: T(d) || T(m),
1179
+ "aria-label": O("remove", e.name),
1180
+ title: O("remove", e.name),
1181
+ "data-test": "worker-remove",
1182
+ onClick: (t) => E.value = e.name
1183
+ }, [s(T(se), {
1184
+ size: 16,
1185
+ "aria-hidden": "true"
1186
+ })], 8, qn),
1187
+ a("button", {
1188
+ type: "button",
1189
+ role: "switch",
1190
+ class: "kvc-switch",
1191
+ "aria-checked": e.enabled,
1192
+ "aria-label": O("use", e.name),
1193
+ disabled: T(d) || T(m),
1194
+ "data-test": "worker-switch",
1195
+ onClick: (t) => T(_)(e.name)
1196
+ }, [...h[4] ||= [a("span", {
1197
+ class: "kvc-switch-knob",
1198
+ "aria-hidden": "true"
1199
+ }, null, -1)]], 8, Jn)
1200
+ ]))], 8, Nn))), 128)),
1201
+ a("div", Yn, [a("button", {
1387
1202
  type: "button",
1388
- class: "kvc-button kvc-ghost kvc-icon-button",
1389
- disabled: u.locked || u.working,
1390
- "aria-label": u.named("remove", e.name),
1391
- title: u.named("remove", e.name),
1392
- "data-test": "worker-remove",
1393
- onClick: (t) => u.removing = e.name
1394
- }, [s(u.Trash2, {
1203
+ class: "kvc-button kvc-primary",
1204
+ disabled: T(d) || T(m),
1205
+ "data-test": "worker-add",
1206
+ onClick: h[3] ||= (e) => C.value = {}
1207
+ }, [s(T(K), {
1395
1208
  size: 16,
1396
1209
  "aria-hidden": "true"
1397
- })], 8, ir),
1398
- a("button", {
1399
- type: "button",
1400
- role: "switch",
1401
- class: "kvc-switch",
1402
- "aria-checked": e.enabled,
1403
- "aria-label": u.named("use", e.name),
1404
- disabled: u.locked || u.working,
1405
- "data-test": "worker-switch",
1406
- onClick: (t) => u.toggle(e.name)
1407
- }, [...c[4] ||= [a("span", {
1408
- class: "kvc-switch-knob",
1409
- "aria-hidden": "true"
1410
- }, null, -1)]], 8, ar)
1411
- ]))], 8, Wn))), 128)),
1412
- a("div", or, [a("button", {
1413
- type: "button",
1414
- class: "kvc-button kvc-primary",
1415
- disabled: u.locked || u.working,
1416
- "data-test": "worker-add",
1417
- onClick: c[3] ||= (e) => u.form = {}
1418
- }, [s(u.Plus, {
1419
- size: 16,
1420
- "aria-hidden": "true"
1421
- }), o(C(u.kvman.t("kvcoder.config.workers.add")), 1)], 8, sr)])
1422
- ])) : (_(), n(u.WorkerForm, f({ key: 0 }, u.form.entry === void 0 ? {} : { entry: u.form.entry }, {
1423
- taken: u.workers.filter((e) => e.name !== u.form?.entry?.name).map((e) => e.name),
1424
- working: u.working,
1425
- onSave: u.saved,
1426
- onCancel: c[0] ||= (e) => u.form = void 0
1427
- }), null, 16, ["taken", "working"]));
1428
- }
1429
- var lr = /*#__PURE__*/ U(In, [["render", cr], ["__file", "/home/runner/work/kvman/kvman/extensions/kvcoder/web/src/DelegateWorkers.vue"]]), X = "@kvman/kvcoder", Z = (e) => Array.isArray(e) && e.every((e) => typeof e == "string");
1430
- function ur(e) {
1431
- return typeof e != "object" || !e || !("name" in e) || !("description" in e) || typeof e.name != "string" || typeof e.description != "string" ? !1 : "command" in e ? typeof e.command == "string" && "args" in e && Z(e.args) && "env" in e && Z(e.env) : "url" in e && typeof e.url == "string" && "headers" in e && Z(e.headers);
1210
+ }), o(w(T(c).t("kvcoder.config.workers.add")), 1)], 8, Xn)])
1211
+ ])) : (v(), n(Tn, p({ key: 0 }, C.value.entry === void 0 ? {} : { entry: C.value.entry }, {
1212
+ taken: T(l).filter((e) => e.name !== C.value?.entry?.name).map((e) => e.name),
1213
+ working: T(m),
1214
+ onSave: k,
1215
+ onCancel: h[0] ||= (e) => C.value = void 0
1216
+ }), null, 16, ["taken", "working"]));
1217
+ }
1218
+ }), Qn = "@kvman/kvcoder", $n = (e) => Array.isArray(e) && e.every((e) => typeof e == "string");
1219
+ function er(e) {
1220
+ return typeof e != "object" || !e || !("name" in e) || !("description" in e) || typeof e.name != "string" || typeof e.description != "string" ? !1 : "command" in e ? typeof e.command == "string" && "args" in e && $n(e.args) && "env" in e && $n(e.env) : "url" in e && typeof e.url == "string" && "headers" in e && $n(e.headers);
1432
1221
  }
1433
- var dr = (e) => Array.isArray(e) ? e.filter(ur) : [], Q = (e, t, n) => `mcp.${e}.${t}.${n}`, $ = (e) => `mcp.${e}.`, fr = (e) => e.kind === "command" ? "env" : "header";
1434
- function pr(e, t) {
1222
+ var tr = (e) => Array.isArray(e) ? e.filter(er) : [], nr = (e, t, n) => `mcp.${e}.${t}.${n}`, $ = (e) => `mcp.${e}.`, rr = (e) => e.kind === "command" ? "env" : "header";
1223
+ function ir(e, t) {
1435
1224
  if (e === void 0) return {
1436
1225
  name: "",
1437
1226
  description: "",
@@ -1444,7 +1233,7 @@ function pr(e, t) {
1444
1233
  let [n, r] = "command" in e ? ["env", e.env] : ["header", e.headers], i = r.map((r) => ({
1445
1234
  name: r,
1446
1235
  value: "",
1447
- set: t.includes(Q(e.name, n, r)),
1236
+ set: t.includes(nr(e.name, n, r)),
1448
1237
  replacing: !1
1449
1238
  }));
1450
1239
  return "command" in e ? {
@@ -1465,7 +1254,7 @@ function pr(e, t) {
1465
1254
  values: i
1466
1255
  };
1467
1256
  }
1468
- function mr(e) {
1257
+ function ar(e) {
1469
1258
  let t = {
1470
1259
  name: e.name.trim(),
1471
1260
  description: e.description.trim()
@@ -1481,314 +1270,276 @@ function mr(e) {
1481
1270
  env: n
1482
1271
  };
1483
1272
  }
1484
- var hr = /^[a-z][a-z0-9]*(-[a-z0-9]+)*$/, gr = {
1273
+ var or = /^[a-z][a-z0-9]*(-[a-z0-9]+)*$/, sr = {
1485
1274
  env: /^[A-Za-z_][A-Za-z0-9_]*$/,
1486
1275
  header: /^[A-Za-z0-9!#$%&'*+.^_`|~-]+$/
1487
- }, _r = (e) => URL.canParse(e) && ["http:", "https:"].includes(new URL(e).protocol);
1488
- function vr(e) {
1489
- let t = fr(e), n = e.values.map((e) => e.name.trim());
1490
- return n.some((e) => !gr[t].test(e)) ? `kvcoder.config.mcp.invalid.valueName.${t}` : new Set(n).size === n.length ? e.values.some((e) => (!e.set || e.replacing) && e.value === "") ? "kvcoder.config.mcp.invalid.valueEmpty" : void 0 : "kvcoder.config.mcp.invalid.valueRepeated";
1276
+ }, cr = (e) => URL.canParse(e) && ["http:", "https:"].includes(new URL(e).protocol);
1277
+ function lr(e) {
1278
+ let t = rr(e), n = e.values.map((e) => e.name.trim());
1279
+ return n.some((e) => !sr[t].test(e)) ? `kvcoder.config.mcp.invalid.valueName.${t}` : new Set(n).size === n.length ? e.values.some((e) => (!e.set || e.replacing) && e.value === "") ? "kvcoder.config.mcp.invalid.valueEmpty" : void 0 : "kvcoder.config.mcp.invalid.valueRepeated";
1491
1280
  }
1492
- function yr(e, t) {
1281
+ function ur(e, t) {
1493
1282
  let n = e.name.trim(), r = {};
1494
- n === "" ? r.name = "kvcoder.config.mcp.invalid.nameEmpty" : hr.test(n) ? t.includes(n) && (r.name = "kvcoder.config.mcp.invalid.nameTaken") : r.name = "kvcoder.config.mcp.invalid.nameShape", e.description.trim() === "" && (r.description = "kvcoder.config.mcp.invalid.descriptionEmpty"), e.kind === "command" && e.command.trim() === "" && (r.command = "kvcoder.config.mcp.invalid.commandEmpty"), e.kind === "url" && !_r(e.url.trim()) && (r.url = "kvcoder.config.mcp.invalid.url");
1495
- let i = vr(e);
1283
+ n === "" ? r.name = "kvcoder.config.mcp.invalid.nameEmpty" : or.test(n) ? t.includes(n) && (r.name = "kvcoder.config.mcp.invalid.nameTaken") : r.name = "kvcoder.config.mcp.invalid.nameShape", e.description.trim() === "" && (r.description = "kvcoder.config.mcp.invalid.descriptionEmpty"), e.kind === "command" && e.command.trim() === "" && (r.command = "kvcoder.config.mcp.invalid.commandEmpty"), e.kind === "url" && !cr(e.url.trim()) && (r.url = "kvcoder.config.mcp.invalid.url");
1284
+ let i = lr(e);
1496
1285
  return i !== void 0 && (r.values = i), r;
1497
1286
  }
1498
- function br(e, t, n) {
1499
- let r = e.name.trim(), i = fr(e), a = new Set(e.values.map((e) => Q(r, i, e.name.trim())));
1287
+ function dr(e, t, n) {
1288
+ let r = e.name.trim(), i = rr(e), a = new Set(e.values.map((e) => nr(r, i, e.name.trim())));
1500
1289
  return {
1501
- set: Object.fromEntries(e.values.filter((e) => !e.set || e.replacing).map((e) => [Q(r, i, e.name.trim()), e.value])),
1290
+ set: Object.fromEntries(e.values.filter((e) => !e.set || e.replacing).map((e) => [nr(r, i, e.name.trim()), e.value])),
1502
1291
  remove: (t === void 0 ? [] : n.filter((e) => e.startsWith(`${$(r)}env.`) || e.startsWith(`${$(r)}header.`))).filter((e) => !a.has(e))
1503
1292
  };
1504
1293
  }
1505
1294
  //#endregion
1506
1295
  //#region web/src/McpServerForm.vue?vue&type=script&setup=true&lang.ts
1507
- var xr = /*@__PURE__*/ c({
1508
- __name: "McpServerForm",
1509
- props: {
1510
- entry: {
1511
- type: Object,
1512
- required: !1
1513
- },
1514
- taken: {
1515
- type: Array,
1516
- required: !0
1517
- },
1518
- secrets: {
1519
- type: Array,
1520
- required: !0
1521
- },
1522
- working: {
1523
- type: Boolean,
1524
- required: !0
1525
- }
1526
- },
1527
- emits: ["save", "cancel"],
1528
- setup(e, { expose: n, emit: r }) {
1529
- n();
1530
- let i = e, a = r, o = V(), s = v(pr(i.entry, i.secrets)), c = y({}), l = t(() => fr(s)), u = (e) => o.t(`kvcoder.config.mcp.form.${e}`), d = i.entry !== void 0;
1531
- function f() {
1532
- c.value = yr(s, i.taken), !(Object.keys(c.value).length > 0) && a("save", mr(s), br(s, i.entry, i.secrets));
1533
- }
1534
- function p(e) {
1535
- s.kind !== e && (s.kind = e, s.values = []);
1536
- }
1537
- let m = {
1538
- props: i,
1539
- emit: a,
1540
- kvman: o,
1541
- draft: s,
1542
- problems: c,
1543
- kind: l,
1544
- text: u,
1545
- editing: d,
1546
- submit: f,
1547
- runAs: p,
1548
- get Plus() {
1549
- return B;
1550
- },
1551
- get X() {
1552
- return fe;
1553
- }
1554
- };
1555
- return Object.defineProperty(m, "__isScriptSetup", {
1556
- enumerable: !1,
1557
- value: !0
1558
- }), m;
1559
- }
1560
- }), Sr = {
1296
+ var fr = {
1561
1297
  class: "kvc-setting-title",
1562
1298
  "data-test": "mcp-form-title"
1563
- }, Cr = { class: "kvc-form-field" }, wr = { class: "kvc-form-label" }, Tr = ["aria-invalid"], Er = {
1299
+ }, pr = { class: "kvc-form-field" }, mr = { class: "kvc-form-label" }, hr = ["aria-invalid"], gr = {
1564
1300
  key: 0,
1565
1301
  class: "kvc-form-error",
1566
1302
  role: "alert",
1567
1303
  "data-test": "mcp-name-error"
1568
- }, Dr = {
1304
+ }, _r = {
1569
1305
  key: 1,
1570
1306
  class: "kvc-muted"
1571
- }, Or = { class: "kvc-form-field" }, kr = { class: "kvc-form-label" }, Ar = ["aria-invalid"], jr = {
1307
+ }, vr = { class: "kvc-form-field" }, yr = { class: "kvc-form-label" }, br = ["aria-invalid"], xr = {
1572
1308
  key: 0,
1573
1309
  class: "kvc-form-error",
1574
1310
  role: "alert",
1575
1311
  "data-test": "mcp-description-error"
1576
- }, Mr = {
1312
+ }, Sr = {
1577
1313
  key: 1,
1578
1314
  class: "kvc-muted"
1579
- }, Nr = { class: "kvc-form-choice" }, Pr = { class: "kvc-form-label" }, Fr = [
1315
+ }, Cr = { class: "kvc-form-choice" }, wr = { class: "kvc-form-label" }, Tr = [
1580
1316
  "value",
1581
1317
  "checked",
1582
1318
  "data-test",
1583
1319
  "onChange"
1584
- ], Ir = { class: "kvc-form-field" }, Lr = { class: "kvc-form-label" }, Rr = ["aria-invalid"], zr = {
1320
+ ], Er = { class: "kvc-form-field" }, Dr = { class: "kvc-form-label" }, Or = ["aria-invalid"], kr = {
1585
1321
  key: 0,
1586
1322
  class: "kvc-form-error",
1587
1323
  role: "alert",
1588
1324
  "data-test": "mcp-command-error"
1589
- }, Br = {
1325
+ }, Ar = {
1590
1326
  key: 1,
1591
1327
  class: "kvc-muted"
1592
- }, Vr = { class: "kvc-form-field" }, Hr = { class: "kvc-form-label" }, Ur = { class: "kvc-muted" }, Wr = {
1328
+ }, jr = { class: "kvc-form-field" }, Mr = { class: "kvc-form-label" }, Nr = { class: "kvc-muted" }, Pr = {
1593
1329
  key: 1,
1594
1330
  class: "kvc-form-field"
1595
- }, Gr = { class: "kvc-form-label" }, Kr = ["aria-invalid"], qr = {
1331
+ }, Fr = { class: "kvc-form-label" }, Ir = ["aria-invalid"], Lr = {
1596
1332
  key: 0,
1597
1333
  class: "kvc-form-error",
1598
1334
  role: "alert",
1599
1335
  "data-test": "mcp-url-error"
1600
- }, Jr = {
1336
+ }, Rr = {
1601
1337
  class: "kvc-form-field",
1602
1338
  "data-test": "mcp-values"
1603
- }, Yr = { class: "kvc-form-label" }, Xr = { class: "kvc-muted" }, Zr = [
1339
+ }, zr = { class: "kvc-form-label" }, Br = { class: "kvc-muted" }, Vr = [
1604
1340
  "onUpdate:modelValue",
1605
1341
  "disabled",
1606
1342
  "placeholder",
1607
1343
  "aria-label"
1608
- ], Qr = {
1344
+ ], Hr = {
1609
1345
  key: 0,
1610
1346
  class: "kvc-form-set"
1611
- }, $r = {
1347
+ }, Ur = {
1612
1348
  class: "kvc-chip",
1613
1349
  "data-test": "mcp-value-set"
1614
- }, ei = ["onClick"], ti = [
1350
+ }, Wr = ["onClick"], Gr = [
1615
1351
  "onUpdate:modelValue",
1616
1352
  "placeholder",
1617
1353
  "aria-label"
1618
- ], ni = ["aria-label", "onClick"], ri = {
1354
+ ], Kr = ["aria-label", "onClick"], qr = {
1619
1355
  key: 0,
1620
1356
  class: "kvc-form-error",
1621
1357
  role: "alert",
1622
1358
  "data-test": "mcp-values-error"
1623
- }, ii = { class: "kvc-actions" }, ai = ["disabled"], oi = ["disabled"];
1624
- function si(t, n, c, l, u, d) {
1625
- return _(), i("form", {
1626
- class: "kvc-form",
1627
- novalidate: "",
1628
- "data-test": "mcp-form",
1629
- onSubmit: P(l.submit, ["prevent"])
1630
- }, [
1631
- a("span", Sr, C(l.editing ? l.kvman.t("kvcoder.config.mcp.form.titleEdit", { name: l.draft.name }) : l.text("titleNew")), 1),
1632
- a("label", Cr, [
1633
- a("span", wr, C(l.text("name")), 1),
1634
- M(a("input", {
1635
- "onUpdate:modelValue": n[0] ||= (e) => l.draft.name = e,
1636
- type: "text",
1637
- dir: "ltr",
1638
- class: "kvc-field kvc-mono",
1639
- disabled: l.editing,
1640
- spellcheck: "false",
1641
- autocomplete: "off",
1642
- "aria-invalid": l.problems.name !== void 0,
1643
- "data-test": "mcp-name"
1644
- }, null, 8, Tr), [[k, l.draft.name]]),
1645
- l.problems.name === void 0 ? (_(), i("span", Dr, C(l.text("nameHint")), 1)) : (_(), i("span", Er, C(l.kvman.t(l.problems.name)), 1))
1646
- ]),
1647
- a("label", Or, [
1648
- a("span", kr, C(l.text("description")), 1),
1649
- M(a("input", {
1650
- "onUpdate:modelValue": n[1] ||= (e) => l.draft.description = e,
1651
- type: "text",
1652
- dir: "auto",
1653
- class: "kvc-field",
1654
- autocomplete: "off",
1655
- "aria-invalid": l.problems.description !== void 0,
1656
- "data-test": "mcp-description"
1657
- }, null, 8, Ar), [[k, l.draft.description]]),
1658
- l.problems.description === void 0 ? (_(), i("span", Mr, C(l.text("descriptionHint")), 1)) : (_(), i("span", jr, C(l.kvman.t(l.problems.description)), 1))
1659
- ]),
1660
- a("fieldset", Nr, [a("legend", Pr, C(l.text("kind")), 1), (_(), i(e, null, b(["command", "url"], (e) => a("label", {
1661
- key: e,
1662
- class: "kvc-form-radio"
1663
- }, [a("input", {
1664
- type: "radio",
1665
- name: "kvc-mcp-kind",
1666
- value: e,
1667
- checked: l.draft.kind === e,
1668
- "data-test": `mcp-kind-${e}`,
1669
- onChange: (t) => l.runAs(e)
1670
- }, null, 40, Fr), o(" " + C(l.text(`kind.${e}`)), 1)])), 64))]),
1671
- l.draft.kind === "command" ? (_(), i(e, { key: 0 }, [a("label", Ir, [
1672
- a("span", Lr, C(l.text("command")), 1),
1673
- M(a("input", {
1674
- "onUpdate:modelValue": n[2] ||= (e) => l.draft.command = e,
1675
- type: "text",
1676
- dir: "ltr",
1677
- class: "kvc-field kvc-mono",
1678
- spellcheck: "false",
1679
- autocomplete: "off",
1680
- "aria-invalid": l.problems.command !== void 0,
1681
- "data-test": "mcp-command"
1682
- }, null, 8, Rr), [[k, l.draft.command]]),
1683
- l.problems.command === void 0 ? (_(), i("span", Br, C(l.text("commandHint")), 1)) : (_(), i("span", zr, C(l.kvman.t(l.problems.command)), 1))
1684
- ]), a("label", Vr, [
1685
- a("span", Hr, C(l.text("args")), 1),
1686
- M(a("textarea", {
1687
- "onUpdate:modelValue": n[3] ||= (e) => l.draft.args = e,
1688
- dir: "ltr",
1689
- rows: "3",
1690
- class: "kvc-field kvc-mono",
1691
- spellcheck: "false",
1692
- "data-test": "mcp-args"
1693
- }, null, 512), [[k, l.draft.args]]),
1694
- a("span", Ur, C(l.text("argsHint")), 1)
1695
- ])], 64)) : (_(), i("label", Wr, [
1696
- a("span", Gr, C(l.text("url")), 1),
1697
- M(a("input", {
1698
- "onUpdate:modelValue": n[4] ||= (e) => l.draft.url = e,
1699
- type: "url",
1700
- dir: "ltr",
1701
- class: "kvc-field kvc-mono",
1702
- spellcheck: "false",
1703
- autocomplete: "off",
1704
- placeholder: "https://",
1705
- "aria-invalid": l.problems.url !== void 0,
1706
- "data-test": "mcp-url"
1707
- }, null, 8, Kr), [[k, l.draft.url]]),
1708
- l.problems.url === void 0 ? r("v-if", !0) : (_(), i("span", qr, C(l.kvman.t(l.problems.url)), 1))
1709
- ])),
1710
- a("div", Jr, [
1711
- a("span", Yr, C(l.text(l.kind)), 1),
1712
- a("span", Xr, C(l.text("secretsHint")), 1),
1713
- (_(!0), i(e, null, b(l.draft.values, (e, t) => (_(), i("div", {
1714
- key: t,
1715
- class: "kvc-form-value",
1716
- "data-test": "mcp-value"
1717
- }, [
1718
- M(a("input", {
1719
- "onUpdate:modelValue": (t) => e.name = t,
1359
+ }, Jr = { class: "kvc-actions" }, Yr = ["disabled"], Xr = ["disabled"], Zr = /* @__PURE__ */ c({
1360
+ __name: "McpServerForm",
1361
+ props: {
1362
+ entry: {},
1363
+ taken: {},
1364
+ secrets: {},
1365
+ working: { type: Boolean }
1366
+ },
1367
+ emits: ["save", "cancel"],
1368
+ setup(n, { emit: c }) {
1369
+ let l = n, u = c, d = q(), f = y(ir(l.entry, l.secrets)), p = b({}), m = t(() => rr(f)), h = (e) => d.t(`kvcoder.config.mcp.form.${e}`), g = l.entry !== void 0;
1370
+ function _() {
1371
+ p.value = ur(f, l.taken), !(Object.keys(p.value).length > 0) && u("save", ar(f), dr(f, l.entry, l.secrets));
1372
+ }
1373
+ function S(e) {
1374
+ f.kind !== e && (f.kind = e, f.values = []);
1375
+ }
1376
+ return (t, n) => (v(), i("form", {
1377
+ class: "kvc-form",
1378
+ novalidate: "",
1379
+ "data-test": "mcp-form",
1380
+ onSubmit: I(_, ["prevent"])
1381
+ }, [
1382
+ a("span", fr, w(g ? T(d).t("kvcoder.config.mcp.form.titleEdit", { name: f.name }) : h("titleNew")), 1),
1383
+ a("label", pr, [
1384
+ a("span", mr, w(h("name")), 1),
1385
+ P(a("input", {
1386
+ "onUpdate:modelValue": n[0] ||= (e) => f.name = e,
1720
1387
  type: "text",
1721
1388
  dir: "ltr",
1722
1389
  class: "kvc-field kvc-mono",
1723
- disabled: e.set,
1724
- placeholder: l.text(`valueName.${l.kind}`),
1725
- "aria-label": l.text(`valueName.${l.kind}`),
1390
+ disabled: g,
1726
1391
  spellcheck: "false",
1727
1392
  autocomplete: "off",
1728
- "data-test": "mcp-value-name"
1729
- }, null, 8, Zr), [[k, e.name]]),
1730
- e.set && !e.replacing ? (_(), i("span", Qr, [a("span", $r, C(l.text("set")), 1), a("button", {
1731
- type: "button",
1732
- class: "kvc-text-button",
1733
- "data-test": "mcp-value-replace",
1734
- onClick: (t) => e.replacing = !0
1735
- }, C(l.text("replace")), 9, ei)])) : M((_(), i("input", {
1736
- key: 1,
1737
- "onUpdate:modelValue": (t) => e.value = t,
1738
- type: "password",
1739
- autocomplete: "off",
1393
+ "aria-invalid": p.value.name !== void 0,
1394
+ "data-test": "mcp-name"
1395
+ }, null, 8, hr), [[j, f.name]]),
1396
+ p.value.name === void 0 ? (v(), i("span", _r, w(h("nameHint")), 1)) : (v(), i("span", gr, w(T(d).t(p.value.name)), 1))
1397
+ ]),
1398
+ a("label", vr, [
1399
+ a("span", yr, w(h("description")), 1),
1400
+ P(a("input", {
1401
+ "onUpdate:modelValue": n[1] ||= (e) => f.description = e,
1402
+ type: "text",
1403
+ dir: "auto",
1740
1404
  class: "kvc-field",
1741
- placeholder: l.text("value"),
1742
- "aria-label": l.kvman.t("kvcoder.config.mcp.form.valueOf", { name: e.name }),
1743
- "data-test": "mcp-value-secret"
1744
- }, null, 8, ti)), [[k, e.value]]),
1405
+ autocomplete: "off",
1406
+ "aria-invalid": p.value.description !== void 0,
1407
+ "data-test": "mcp-description"
1408
+ }, null, 8, br), [[j, f.description]]),
1409
+ p.value.description === void 0 ? (v(), i("span", Sr, w(h("descriptionHint")), 1)) : (v(), i("span", xr, w(T(d).t(p.value.description)), 1))
1410
+ ]),
1411
+ a("fieldset", Cr, [a("legend", wr, w(h("kind")), 1), (v(), i(e, null, x(["command", "url"], (e) => a("label", {
1412
+ key: e,
1413
+ class: "kvc-form-radio"
1414
+ }, [a("input", {
1415
+ type: "radio",
1416
+ name: "kvc-mcp-kind",
1417
+ value: e,
1418
+ checked: f.kind === e,
1419
+ "data-test": `mcp-kind-${e}`,
1420
+ onChange: (t) => S(e)
1421
+ }, null, 40, Tr), o(" " + w(h(`kind.${e}`)), 1)])), 64))]),
1422
+ f.kind === "command" ? (v(), i(e, { key: 0 }, [a("label", Er, [
1423
+ a("span", Dr, w(h("command")), 1),
1424
+ P(a("input", {
1425
+ "onUpdate:modelValue": n[2] ||= (e) => f.command = e,
1426
+ type: "text",
1427
+ dir: "ltr",
1428
+ class: "kvc-field kvc-mono",
1429
+ spellcheck: "false",
1430
+ autocomplete: "off",
1431
+ "aria-invalid": p.value.command !== void 0,
1432
+ "data-test": "mcp-command"
1433
+ }, null, 8, Or), [[j, f.command]]),
1434
+ p.value.command === void 0 ? (v(), i("span", Ar, w(h("commandHint")), 1)) : (v(), i("span", kr, w(T(d).t(p.value.command)), 1))
1435
+ ]), a("label", jr, [
1436
+ a("span", Mr, w(h("args")), 1),
1437
+ P(a("textarea", {
1438
+ "onUpdate:modelValue": n[3] ||= (e) => f.args = e,
1439
+ dir: "ltr",
1440
+ rows: "3",
1441
+ class: "kvc-field kvc-mono",
1442
+ spellcheck: "false",
1443
+ "data-test": "mcp-args"
1444
+ }, null, 512), [[j, f.args]]),
1445
+ a("span", Nr, w(h("argsHint")), 1)
1446
+ ])], 64)) : (v(), i("label", Pr, [
1447
+ a("span", Fr, w(h("url")), 1),
1448
+ P(a("input", {
1449
+ "onUpdate:modelValue": n[4] ||= (e) => f.url = e,
1450
+ type: "url",
1451
+ dir: "ltr",
1452
+ class: "kvc-field kvc-mono",
1453
+ spellcheck: "false",
1454
+ autocomplete: "off",
1455
+ placeholder: "https://",
1456
+ "aria-invalid": p.value.url !== void 0,
1457
+ "data-test": "mcp-url"
1458
+ }, null, 8, Ir), [[j, f.url]]),
1459
+ p.value.url === void 0 ? r("v-if", !0) : (v(), i("span", Lr, w(T(d).t(p.value.url)), 1))
1460
+ ])),
1461
+ a("div", Rr, [
1462
+ a("span", zr, w(h(m.value)), 1),
1463
+ a("span", Br, w(h("secretsHint")), 1),
1464
+ (v(!0), i(e, null, x(f.values, (e, t) => (v(), i("div", {
1465
+ key: t,
1466
+ class: "kvc-form-value",
1467
+ "data-test": "mcp-value"
1468
+ }, [
1469
+ P(a("input", {
1470
+ "onUpdate:modelValue": (t) => e.name = t,
1471
+ type: "text",
1472
+ dir: "ltr",
1473
+ class: "kvc-field kvc-mono",
1474
+ disabled: e.set,
1475
+ placeholder: h(`valueName.${m.value}`),
1476
+ "aria-label": h(`valueName.${m.value}`),
1477
+ spellcheck: "false",
1478
+ autocomplete: "off",
1479
+ "data-test": "mcp-value-name"
1480
+ }, null, 8, Vr), [[j, e.name]]),
1481
+ e.set && !e.replacing ? (v(), i("span", Hr, [a("span", Ur, w(h("set")), 1), a("button", {
1482
+ type: "button",
1483
+ class: "kvc-text-button",
1484
+ "data-test": "mcp-value-replace",
1485
+ onClick: (t) => e.replacing = !0
1486
+ }, w(h("replace")), 9, Wr)])) : P((v(), i("input", {
1487
+ key: 1,
1488
+ "onUpdate:modelValue": (t) => e.value = t,
1489
+ type: "password",
1490
+ autocomplete: "off",
1491
+ class: "kvc-field",
1492
+ placeholder: h("value"),
1493
+ "aria-label": T(d).t("kvcoder.config.mcp.form.valueOf", { name: e.name }),
1494
+ "data-test": "mcp-value-secret"
1495
+ }, null, 8, Gr)), [[j, e.value]]),
1496
+ a("button", {
1497
+ type: "button",
1498
+ class: "kvc-button kvc-ghost kvc-icon-button",
1499
+ "aria-label": T(d).t("kvcoder.config.mcp.form.removeValue", { name: e.name }),
1500
+ "data-test": "mcp-value-remove",
1501
+ onClick: (e) => f.values.splice(t, 1)
1502
+ }, [s(T(ce), {
1503
+ size: 16,
1504
+ "aria-hidden": "true"
1505
+ })], 8, Kr)
1506
+ ]))), 128)),
1507
+ p.value.values === void 0 ? r("v-if", !0) : (v(), i("span", qr, w(T(d).t(p.value.values)), 1)),
1745
1508
  a("button", {
1746
1509
  type: "button",
1747
- class: "kvc-button kvc-ghost kvc-icon-button",
1748
- "aria-label": l.kvman.t("kvcoder.config.mcp.form.removeValue", { name: e.name }),
1749
- "data-test": "mcp-value-remove",
1750
- onClick: (e) => l.draft.values.splice(t, 1)
1751
- }, [s(l.X, {
1752
- size: 16,
1510
+ class: "kvc-text-button kvc-form-add",
1511
+ "data-test": "mcp-value-add",
1512
+ onClick: n[5] ||= (e) => f.values.push({
1513
+ name: "",
1514
+ value: "",
1515
+ set: !1,
1516
+ replacing: !1
1517
+ })
1518
+ }, [s(T(K), {
1519
+ size: 14,
1753
1520
  "aria-hidden": "true"
1754
- })], 8, ni)
1755
- ]))), 128)),
1756
- l.problems.values === void 0 ? r("v-if", !0) : (_(), i("span", ri, C(l.kvman.t(l.problems.values)), 1)),
1757
- a("button", {
1521
+ }), o(w(h(`add.${m.value}`)), 1)])
1522
+ ]),
1523
+ a("div", Jr, [a("button", {
1758
1524
  type: "button",
1759
- class: "kvc-text-button kvc-form-add",
1760
- "data-test": "mcp-value-add",
1761
- onClick: n[5] ||= (e) => l.draft.values.push({
1762
- name: "",
1763
- value: "",
1764
- set: !1,
1765
- replacing: !1
1766
- })
1767
- }, [s(l.Plus, {
1768
- size: 14,
1769
- "aria-hidden": "true"
1770
- }), o(C(l.text(`add.${l.kind}`)), 1)])
1771
- ]),
1772
- a("div", ii, [a("button", {
1773
- type: "button",
1774
- class: "kvc-button",
1775
- disabled: l.props.working,
1776
- "data-test": "mcp-cancel",
1777
- onClick: n[6] ||= (e) => l.emit("cancel")
1778
- }, C(l.kvman.t("kvcoder.config.mcp.cancel")), 9, ai), a("button", {
1779
- type: "submit",
1780
- class: "kvc-button kvc-primary",
1781
- disabled: l.props.working,
1782
- "data-test": "mcp-save"
1783
- }, C(l.text("save")), 9, oi)])
1784
- ], 32);
1785
- }
1786
- var ci = /*#__PURE__*/ U(xr, [["render", si], ["__file", "/home/runner/work/kvman/kvman/extensions/kvcoder/web/src/McpServerForm.vue"]]);
1525
+ class: "kvc-button",
1526
+ disabled: l.working,
1527
+ "data-test": "mcp-cancel",
1528
+ onClick: n[6] ||= (e) => u("cancel")
1529
+ }, w(T(d).t("kvcoder.config.mcp.cancel")), 9, Yr), a("button", {
1530
+ type: "submit",
1531
+ class: "kvc-button kvc-primary",
1532
+ disabled: l.working,
1533
+ "data-test": "mcp-save"
1534
+ }, w(h("save")), 9, Xr)])
1535
+ ], 32));
1536
+ }
1537
+ });
1787
1538
  //#endregion
1788
1539
  //#region web/src/use-mcp-servers.ts
1789
- function li(e) {
1790
- let n = W(e, "kvcoder.mcp.servers"), r = t(() => dr(n.value.value)), i = y({}), a = y([]), o = y(!1), s = /* @__PURE__ */ new Set(), c = async () => {
1791
- a.value = (await e.exec("kernel.secrets.list", {})).filter((e) => e.extension === X).map((e) => e.name);
1540
+ function Qr(e) {
1541
+ let n = Y(e, "kvcoder.mcp.servers"), r = t(() => tr(n.value.value)), i = b({}), a = b([]), o = b(!1), s = /* @__PURE__ */ new Set(), c = async () => {
1542
+ a.value = (await e.exec("kernel.secrets.list", {})).filter((e) => e.extension === Qn).map((e) => e.name);
1792
1543
  };
1793
1544
  async function l(t) {
1794
1545
  i.value = {
@@ -1802,13 +1553,13 @@ function li(e) {
1802
1553
  status: "failed",
1803
1554
  problem: {
1804
1555
  code: r.problem.code,
1805
- params: ge(r.problem.params)
1556
+ params: fe(r.problem.params)
1806
1557
  }
1807
1558
  } : r;
1808
1559
  } catch (e) {
1809
1560
  n = {
1810
1561
  status: "failed",
1811
- problem: he(e)
1562
+ problem: de(e)
1812
1563
  };
1813
1564
  }
1814
1565
  i.value = {
@@ -1822,14 +1573,14 @@ function li(e) {
1822
1573
  try {
1823
1574
  return await t();
1824
1575
  } catch (t) {
1825
- return H(e, t), !1;
1576
+ return J(e, t), !1;
1826
1577
  } finally {
1827
1578
  o.value = !1;
1828
1579
  }
1829
1580
  }
1830
1581
  let f = async (t) => {
1831
1582
  for (let n of t) await e.exec("kernel.secrets.delete", {
1832
- extension: X,
1583
+ extension: Qn,
1833
1584
  name: n
1834
1585
  });
1835
1586
  }, p = (t, i) => d(async () => {
@@ -1842,7 +1593,7 @@ function li(e) {
1842
1593
  try {
1843
1594
  if (!await n.set(u)) return !1;
1844
1595
  for (let [t, n] of Object.entries(i.set)) await e.exec("kernel.secrets.set", {
1845
- extension: X,
1596
+ extension: Qn,
1846
1597
  name: t,
1847
1598
  value: n
1848
1599
  });
@@ -1861,25 +1612,25 @@ function li(e) {
1861
1612
  let r = window.open(n, "_blank");
1862
1613
  return r === null ? "blocked" : (r.opener = null, "opened");
1863
1614
  }
1864
- let _ = (e) => d(async () => (await f(a.value.filter((t) => t.startsWith(`${$(e)}oauth.`))), await c(), l(e), !0)), v = (e) => a.value.includes(`${$(e)}oauth.tokens`);
1865
- async function b() {
1615
+ let h = (e) => d(async () => (await f(a.value.filter((t) => t.startsWith(`${$(e)}oauth.`))), await c(), l(e), !0)), v = (e) => a.value.includes(`${$(e)}oauth.tokens`);
1616
+ async function y() {
1866
1617
  let e = r.value.filter((e) => i.value[e.name]?.status === "signInNeeded");
1867
1618
  if (e.length !== 0) {
1868
1619
  await c();
1869
1620
  for (let t of e) l(t.name);
1870
1621
  }
1871
1622
  }
1872
- return h(async () => {
1873
- window.addEventListener("focus", b);
1623
+ return g(async () => {
1624
+ window.addEventListener("focus", y);
1874
1625
  try {
1875
1626
  await c();
1876
1627
  } catch (t) {
1877
- H(e, t);
1628
+ J(e, t);
1878
1629
  }
1879
- }), A(r, (e, t) => {
1630
+ }), M(r, (e, t) => {
1880
1631
  let n = new Set((t ?? []).map((e) => e.name));
1881
1632
  for (let t of e) !s.has(t.name) && (!n.has(t.name) || !(t.name in i.value)) && l(t.name);
1882
- }), g(() => window.removeEventListener("focus", b)), A(() => e.workspace.value.id, u), {
1633
+ }), _(() => window.removeEventListener("focus", y)), M(() => e.workspace.value.id, u), {
1883
1634
  servers: r,
1884
1635
  states: i,
1885
1636
  secrets: a,
@@ -1891,513 +1642,387 @@ function li(e) {
1891
1642
  reset: n.reset,
1892
1643
  check: l,
1893
1644
  signIn: m,
1894
- signOut: _,
1645
+ signOut: h,
1895
1646
  signedIn: v
1896
1647
  };
1897
1648
  }
1898
1649
  //#endregion
1899
1650
  //#region web/src/McpServers.vue?vue&type=script&setup=true&lang.ts
1900
- var ui = /*@__PURE__*/ c({
1901
- __name: "McpServers",
1902
- setup(e, { expose: t }) {
1903
- t();
1904
- let n = V(), { servers: r, states: i, secrets: a, locked: o, changed: s, working: c, save: l, remove: u, reset: d, check: f, signIn: p, signOut: m, signedIn: h } = li(n), g = y(), _ = y(), v = (e) => n.t(`${e}.${n.scope.value}`, { name: n.workspace.value.name }), b = (e) => i.value[e] ?? { status: "checking" };
1905
- function x(e) {
1906
- return e.status === "ready" ? n.t("kvcoder.config.mcp.ready", { count: e.tools }) : n.t(`kvcoder.config.mcp.${e.status}`);
1907
- }
1908
- let S = (e) => e.status === "failed" && e.problem !== void 0 ? n.t(me(e.problem.code), e.problem.params) : void 0;
1909
- async function C(e, t) {
1910
- await l(e, t) && (g.value = void 0, n.toast("kvcoder.config.mcp.saved", { name: e.name }, "success"));
1911
- }
1912
- async function w(e) {
1913
- await p(e) === "blocked" && n.toast("kvcoder.config.mcp.signIn.blocked", {}, "warning");
1914
- }
1915
- async function T(e) {
1916
- await u(e) && n.toast("kvcoder.config.mcp.removed", { name: e }, "success"), _.value = void 0;
1917
- }
1918
- let E = {
1919
- kvman: n,
1920
- servers: r,
1921
- states: i,
1922
- secrets: a,
1923
- locked: o,
1924
- changed: s,
1925
- working: c,
1926
- save: l,
1927
- remove: u,
1928
- reset: d,
1929
- check: f,
1930
- signIn: p,
1931
- signOut: m,
1932
- signedIn: h,
1933
- form: g,
1934
- removing: _,
1935
- scoped: v,
1936
- stateOf: b,
1937
- stateText: x,
1938
- reason: S,
1939
- saved: C,
1940
- startSignIn: w,
1941
- removed: T,
1942
- get Pencil() {
1943
- return ce;
1944
- },
1945
- get Plus() {
1946
- return B;
1947
- },
1948
- get Trash2() {
1949
- return de;
1950
- },
1951
- McpServerForm: ci
1952
- };
1953
- return Object.defineProperty(E, "__isScriptSetup", {
1954
- enumerable: !1,
1955
- value: !0
1956
- }), E;
1957
- }
1958
- }), di = {
1651
+ var $r = {
1959
1652
  key: 1,
1960
1653
  class: "kvc-dialog-rows",
1961
1654
  "data-test": "mcp-servers"
1962
- }, fi = { class: "kvc-muted" }, pi = {
1655
+ }, ei = { class: "kvc-muted" }, ti = {
1963
1656
  key: 0,
1964
1657
  class: "kvc-muted",
1965
1658
  "data-test": "mcp-own-value"
1966
- }, mi = {
1659
+ }, ni = {
1967
1660
  key: 1,
1968
1661
  class: "kvc-connectors-state"
1969
- }, hi = {
1662
+ }, ri = {
1970
1663
  class: "kvc-chip",
1971
1664
  "data-test": "mcp-changed"
1972
- }, gi = ["disabled"], _i = {
1665
+ }, ii = ["disabled"], ai = {
1973
1666
  key: 2,
1974
1667
  class: "kvc-muted",
1975
1668
  "data-test": "mcp-empty"
1976
- }, vi = ["data-test"], yi = { class: "kvc-connector-text" }, bi = {
1669
+ }, oi = ["data-test"], si = { class: "kvc-connector-text" }, ci = {
1977
1670
  class: "kvc-mono kvc-connector-name",
1978
1671
  "data-test": "mcp-server-name"
1979
- }, xi = {
1672
+ }, li = {
1980
1673
  class: "kvc-muted",
1981
1674
  dir: "auto",
1982
1675
  "data-test": "mcp-server-description"
1983
- }, Si = ["data-status"], Ci = ["onClick"], wi = ["disabled", "onClick"], Ti = ["disabled", "onClick"], Ei = {
1676
+ }, ui = ["data-status"], di = ["onClick"], fi = ["disabled", "onClick"], pi = ["disabled", "onClick"], mi = {
1984
1677
  key: 1,
1985
1678
  class: "kvc-muted kvc-server-reason",
1986
1679
  dir: "auto",
1987
1680
  "data-test": "mcp-server-reason"
1988
- }, Di = ["aria-label"], Oi = { class: "kvc-muted" }, ki = ["disabled"], Ai = ["disabled", "onClick"], ji = {
1681
+ }, hi = ["aria-label"], gi = { class: "kvc-muted" }, _i = ["disabled"], vi = ["disabled", "onClick"], yi = {
1989
1682
  key: 1,
1990
1683
  class: "kvc-connector-actions"
1991
- }, Mi = [
1684
+ }, bi = [
1992
1685
  "disabled",
1993
1686
  "aria-label",
1994
1687
  "title",
1995
1688
  "onClick"
1996
- ], Ni = [
1689
+ ], xi = [
1997
1690
  "disabled",
1998
1691
  "aria-label",
1999
1692
  "title",
2000
1693
  "onClick"
2001
- ], Pi = { class: "kvc-actions" }, Fi = ["disabled"];
2002
- function Ii(t, c, l, u, d, p) {
2003
- return u.form === void 0 ? (_(), i("div", di, [
2004
- a("p", fi, C(u.kvman.t("kvcoder.config.mcp.intro")), 1),
2005
- u.locked ? (_(), i("p", pi, C(u.kvman.t("kvcoder.config.connectors.ownValue", { name: u.kvman.workspace.value.name })), 1)) : u.changed ? (_(), i("div", mi, [a("span", hi, C(u.scoped("kvcoder.config.connectors.changed")), 1), a("button", {
2006
- type: "button",
2007
- class: "kvc-text-button",
2008
- disabled: u.working,
2009
- "data-test": "mcp-reset",
2010
- onClick: c[1] ||= (...e) => u.reset && u.reset(...e)
2011
- }, C(u.scoped("kvcoder.config.connectors.reset")), 9, gi)])) : r("v-if", !0),
2012
- u.servers.length === 0 ? (_(), i("p", _i, C(u.kvman.t("kvcoder.config.mcp.empty")), 1)) : r("v-if", !0),
2013
- (_(!0), i(e, null, b(u.servers, (e) => (_(), i("div", {
2014
- key: e.name,
2015
- class: "kvc-connector kvc-server",
2016
- "data-test": `mcp-server-${e.name}`
2017
- }, [a("span", yi, [
2018
- a("span", bi, C(e.name), 1),
2019
- a("span", xi, C(e.description), 1),
2020
- a("span", {
2021
- class: "kvc-server-state",
2022
- "data-status": u.stateOf(e.name).status,
2023
- role: "status",
2024
- "data-test": "mcp-server-state"
2025
- }, [
2026
- o(C(u.stateText(u.stateOf(e.name))) + " ", 1),
2027
- u.stateOf(e.name).status === "checking" ? r("v-if", !0) : (_(), i("button", {
1694
+ ], Si = { class: "kvc-actions" }, Ci = ["disabled"], wi = /* @__PURE__ */ c({
1695
+ __name: "McpServers",
1696
+ setup(t) {
1697
+ let c = q(), { servers: l, states: u, secrets: d, locked: f, changed: m, working: h, save: g, remove: _, reset: y, check: S, signIn: C, signOut: E, signedIn: D } = Qr(c), O = b(), k = b(), A = (e) => c.t(`${e}.${c.scope.value}`, { name: c.workspace.value.name }), j = (e) => u.value[e] ?? { status: "checking" };
1698
+ function M(e) {
1699
+ return e.status === "ready" ? c.t("kvcoder.config.mcp.ready", { count: e.tools }) : c.t(`kvcoder.config.mcp.${e.status}`);
1700
+ }
1701
+ let N = (e) => e.status === "failed" && e.problem !== void 0 ? c.t(ue(e.problem.code), e.problem.params) : void 0;
1702
+ async function P(e, t) {
1703
+ await g(e, t) && (O.value = void 0, c.toast("kvcoder.config.mcp.saved", { name: e.name }, "success"));
1704
+ }
1705
+ async function F(e) {
1706
+ await C(e) === "blocked" && c.toast("kvcoder.config.mcp.signIn.blocked", {}, "warning");
1707
+ }
1708
+ async function I(e) {
1709
+ await _(e) && c.toast("kvcoder.config.mcp.removed", { name: e }, "success"), k.value = void 0;
1710
+ }
1711
+ return (t, u) => O.value === void 0 ? (v(), i("div", $r, [
1712
+ a("p", ei, w(T(c).t("kvcoder.config.mcp.intro")), 1),
1713
+ T(f) ? (v(), i("p", ti, w(T(c).t("kvcoder.config.connectors.ownValue", { name: T(c).workspace.value.name })), 1)) : T(m) ? (v(), i("div", ni, [a("span", ri, w(A("kvcoder.config.connectors.changed")), 1), a("button", {
1714
+ type: "button",
1715
+ class: "kvc-text-button",
1716
+ disabled: T(h),
1717
+ "data-test": "mcp-reset",
1718
+ onClick: u[1] ||= (...e) => T(y) && T(y)(...e)
1719
+ }, w(A("kvcoder.config.connectors.reset")), 9, ii)])) : r("v-if", !0),
1720
+ T(l).length === 0 ? (v(), i("p", ai, w(T(c).t("kvcoder.config.mcp.empty")), 1)) : r("v-if", !0),
1721
+ (v(!0), i(e, null, x(T(l), (e) => (v(), i("div", {
1722
+ key: e.name,
1723
+ class: "kvc-connector kvc-server",
1724
+ "data-test": `mcp-server-${e.name}`
1725
+ }, [a("span", si, [
1726
+ a("span", ci, w(e.name), 1),
1727
+ a("span", li, w(e.description), 1),
1728
+ a("span", {
1729
+ class: "kvc-server-state",
1730
+ "data-status": j(e.name).status,
1731
+ role: "status",
1732
+ "data-test": "mcp-server-state"
1733
+ }, [
1734
+ o(w(M(j(e.name))) + " ", 1),
1735
+ j(e.name).status === "checking" ? r("v-if", !0) : (v(), i("button", {
1736
+ key: 0,
1737
+ type: "button",
1738
+ class: "kvc-text-button",
1739
+ "data-test": "mcp-server-check",
1740
+ onClick: (t) => T(S)(e.name)
1741
+ }, w(T(c).t("kvcoder.config.mcp.recheck")), 9, di)),
1742
+ "url" in e && T(D)(e.name) ? (v(), i("button", {
1743
+ key: 1,
1744
+ type: "button",
1745
+ class: "kvc-text-button",
1746
+ disabled: T(h),
1747
+ "data-test": "mcp-server-sign-out",
1748
+ onClick: (t) => T(E)(e.name)
1749
+ }, w(T(c).t("kvcoder.config.mcp.signOut")), 9, fi)) : r("v-if", !0)
1750
+ ], 8, ui),
1751
+ "url" in e && j(e.name).status === "signInNeeded" ? (v(), i("button", {
2028
1752
  key: 0,
2029
1753
  type: "button",
2030
- class: "kvc-text-button",
2031
- "data-test": "mcp-server-check",
2032
- onClick: (t) => u.check(e.name)
2033
- }, C(u.kvman.t("kvcoder.config.mcp.recheck")), 9, Ci)),
2034
- "url" in e && u.signedIn(e.name) ? (_(), i("button", {
2035
- key: 1,
2036
- type: "button",
2037
- class: "kvc-text-button",
2038
- disabled: u.working,
2039
- "data-test": "mcp-server-sign-out",
2040
- onClick: (t) => u.signOut(e.name)
2041
- }, C(u.kvman.t("kvcoder.config.mcp.signOut")), 9, wi)) : r("v-if", !0)
2042
- ], 8, Si),
2043
- "url" in e && u.stateOf(e.name).status === "signInNeeded" ? (_(), i("button", {
1754
+ class: "kvc-button kvc-primary kvc-server-sign-in",
1755
+ disabled: T(h),
1756
+ "data-test": "mcp-server-sign-in",
1757
+ onClick: (t) => F(e.name)
1758
+ }, w(T(c).t("kvcoder.config.mcp.signIn")), 9, pi)) : r("v-if", !0),
1759
+ N(j(e.name)) === void 0 ? r("v-if", !0) : (v(), i("span", mi, w(N(j(e.name))), 1))
1760
+ ]), k.value === e.name ? (v(), i("span", {
2044
1761
  key: 0,
1762
+ class: "kvc-connector-actions",
1763
+ role: "alertdialog",
1764
+ "aria-label": T(c).t("kvcoder.config.mcp.removeConfirm", { name: e.name }),
1765
+ "data-test": "mcp-remove-confirm"
1766
+ }, [
1767
+ a("span", gi, w(T(c).t("kvcoder.config.mcp.removeConfirm", { name: e.name })), 1),
1768
+ a("button", {
1769
+ type: "button",
1770
+ class: "kvc-button",
1771
+ disabled: T(h),
1772
+ "data-test": "mcp-remove-cancel",
1773
+ onClick: u[2] ||= (e) => k.value = void 0
1774
+ }, w(T(c).t("kvcoder.config.mcp.cancel")), 9, _i),
1775
+ a("button", {
1776
+ type: "button",
1777
+ class: "kvc-button kvc-danger",
1778
+ disabled: T(h),
1779
+ "data-test": "mcp-remove-yes",
1780
+ onClick: (t) => I(e.name)
1781
+ }, w(T(c).t("kvcoder.config.mcp.removeYes")), 9, vi)
1782
+ ], 8, hi)) : (v(), i("span", yi, [a("button", {
2045
1783
  type: "button",
2046
- class: "kvc-button kvc-primary kvc-server-sign-in",
2047
- disabled: u.working,
2048
- "data-test": "mcp-server-sign-in",
2049
- onClick: (t) => u.startSignIn(e.name)
2050
- }, C(u.kvman.t("kvcoder.config.mcp.signIn")), 9, Ti)) : r("v-if", !0),
2051
- u.reason(u.stateOf(e.name)) === void 0 ? r("v-if", !0) : (_(), i("span", Ei, C(u.reason(u.stateOf(e.name))), 1))
2052
- ]), u.removing === e.name ? (_(), i("span", {
2053
- key: 0,
2054
- class: "kvc-connector-actions",
2055
- role: "alertdialog",
2056
- "aria-label": u.kvman.t("kvcoder.config.mcp.removeConfirm", { name: e.name }),
2057
- "data-test": "mcp-remove-confirm"
2058
- }, [
2059
- a("span", Oi, C(u.kvman.t("kvcoder.config.mcp.removeConfirm", { name: e.name })), 1),
2060
- a("button", {
1784
+ class: "kvc-button kvc-ghost kvc-icon-button",
1785
+ disabled: T(f) || T(h),
1786
+ "aria-label": T(c).t("kvcoder.config.mcp.edit", { name: e.name }),
1787
+ title: T(c).t("kvcoder.config.mcp.edit", { name: e.name }),
1788
+ "data-test": "mcp-server-edit",
1789
+ onClick: (t) => O.value = { entry: e }
1790
+ }, [s(T(G), {
1791
+ size: 16,
1792
+ "aria-hidden": "true"
1793
+ })], 8, bi), a("button", {
2061
1794
  type: "button",
2062
- class: "kvc-button",
2063
- disabled: u.working,
2064
- "data-test": "mcp-remove-cancel",
2065
- onClick: c[2] ||= (e) => u.removing = void 0
2066
- }, C(u.kvman.t("kvcoder.config.mcp.cancel")), 9, ki),
2067
- a("button", {
1795
+ class: "kvc-button kvc-ghost kvc-icon-button",
1796
+ disabled: T(f) || T(h),
1797
+ "aria-label": T(c).t("kvcoder.config.mcp.remove", { name: e.name }),
1798
+ title: T(c).t("kvcoder.config.mcp.remove", { name: e.name }),
1799
+ "data-test": "mcp-server-remove",
1800
+ onClick: (t) => k.value = e.name
1801
+ }, [s(T(se), {
1802
+ size: 16,
1803
+ "aria-hidden": "true"
1804
+ })], 8, xi)]))], 8, oi))), 128)),
1805
+ a("div", Si, [a("button", {
2068
1806
  type: "button",
2069
- class: "kvc-button kvc-danger",
2070
- disabled: u.working,
2071
- "data-test": "mcp-remove-yes",
2072
- onClick: (t) => u.removed(e.name)
2073
- }, C(u.kvman.t("kvcoder.config.mcp.removeYes")), 9, Ai)
2074
- ], 8, Di)) : (_(), i("span", ji, [a("button", {
2075
- type: "button",
2076
- class: "kvc-button kvc-ghost kvc-icon-button",
2077
- disabled: u.locked || u.working,
2078
- "aria-label": u.kvman.t("kvcoder.config.mcp.edit", { name: e.name }),
2079
- title: u.kvman.t("kvcoder.config.mcp.edit", { name: e.name }),
2080
- "data-test": "mcp-server-edit",
2081
- onClick: (t) => u.form = { entry: e }
2082
- }, [s(u.Pencil, {
2083
- size: 16,
2084
- "aria-hidden": "true"
2085
- })], 8, Mi), a("button", {
2086
- type: "button",
2087
- class: "kvc-button kvc-ghost kvc-icon-button",
2088
- disabled: u.locked || u.working,
2089
- "aria-label": u.kvman.t("kvcoder.config.mcp.remove", { name: e.name }),
2090
- title: u.kvman.t("kvcoder.config.mcp.remove", { name: e.name }),
2091
- "data-test": "mcp-server-remove",
2092
- onClick: (t) => u.removing = e.name
2093
- }, [s(u.Trash2, {
2094
- size: 16,
2095
- "aria-hidden": "true"
2096
- })], 8, Ni)]))], 8, vi))), 128)),
2097
- a("div", Pi, [a("button", {
2098
- type: "button",
2099
- class: "kvc-button kvc-primary",
2100
- disabled: u.locked || u.working,
2101
- "data-test": "mcp-add",
2102
- onClick: c[3] ||= (e) => u.form = {}
2103
- }, [s(u.Plus, {
2104
- size: 16,
2105
- "aria-hidden": "true"
2106
- }), o(C(u.kvman.t("kvcoder.config.mcp.add")), 1)], 8, Fi)])
2107
- ])) : (_(), n(u.McpServerForm, f({ key: 0 }, u.form.entry === void 0 ? {} : { entry: u.form.entry }, {
2108
- taken: u.servers.filter((e) => e.name !== u.form?.entry?.name).map((e) => e.name),
2109
- secrets: u.secrets,
2110
- working: u.working,
2111
- onSave: u.saved,
2112
- onCancel: c[0] ||= (e) => u.form = void 0
2113
- }), null, 16, [
2114
- "taken",
2115
- "secrets",
2116
- "working"
2117
- ]));
2118
- }
2119
- var Li = /*#__PURE__*/ U(ui, [["render", Ii], ["__file", "/home/runner/work/kvman/kvman/extensions/kvcoder/web/src/McpServers.vue"]]), Ri = /*@__PURE__*/ c({
2120
- __name: "SettingFrame",
2121
- props: {
2122
- settingKey: {
2123
- type: String,
2124
- required: !0
2125
- },
2126
- name: {
2127
- type: String,
2128
- required: !0
2129
- },
2130
- setting: {
2131
- type: null,
2132
- required: !0
2133
- },
2134
- saved: {
2135
- type: Boolean,
2136
- required: !0
2137
- }
2138
- },
2139
- setup(e, { expose: t }) {
2140
- t();
2141
- let n = e, r = V(), i = {
2142
- props: n,
2143
- kvman: r,
2144
- scoped: (e) => r.t(`${e}.${r.scope.value}`, { name: r.workspace.value.name })
2145
- };
2146
- return Object.defineProperty(i, "__isScriptSetup", {
2147
- enumerable: !1,
2148
- value: !0
2149
- }), i;
1807
+ class: "kvc-button kvc-primary",
1808
+ disabled: T(f) || T(h),
1809
+ "data-test": "mcp-add",
1810
+ onClick: u[3] ||= (e) => O.value = {}
1811
+ }, [s(T(K), {
1812
+ size: 16,
1813
+ "aria-hidden": "true"
1814
+ }), o(w(T(c).t("kvcoder.config.mcp.add")), 1)], 8, Ci)])
1815
+ ])) : (v(), n(Zr, p({ key: 0 }, O.value.entry === void 0 ? {} : { entry: O.value.entry }, {
1816
+ taken: T(l).filter((e) => e.name !== O.value?.entry?.name).map((e) => e.name),
1817
+ secrets: T(d),
1818
+ working: T(h),
1819
+ onSave: P,
1820
+ onCancel: u[0] ||= (e) => O.value = void 0
1821
+ }), null, 16, [
1822
+ "taken",
1823
+ "secrets",
1824
+ "working"
1825
+ ]));
2150
1826
  }
2151
- }), zi = ["data-test"], Bi = { class: "kvc-setting-text" }, Vi = ["data-test"], Hi = { class: "kvc-muted" }, Ui = { class: "kvc-setting-control" }, Wi = ["data-test"], Gi = {
1827
+ }), Ti = ["data-test"], Ei = { class: "kvc-setting-text" }, Di = ["data-test"], Oi = { class: "kvc-muted" }, ki = { class: "kvc-setting-control" }, Ai = ["data-test"], ji = {
2152
1828
  key: 1,
2153
1829
  class: "kvc-connectors-state"
2154
- }, Ki = ["data-test"], qi = ["data-test"], Ji = ["disabled", "data-test"];
2155
- function Yi(t, n, o, s, c, l) {
2156
- return _(), i("div", {
2157
- class: "kvc-setting",
2158
- "data-test": s.props.name
2159
- }, [a("span", Bi, [a("span", {
2160
- class: "kvc-setting-title",
2161
- "data-test": `${s.props.name}-title`
2162
- }, C(s.kvman.t(`${s.props.settingKey}.title`)), 9, Vi), a("span", Hi, C(s.kvman.t(`${s.props.settingKey}.description`)), 1)]), a("span", Ui, [x(t.$slots, "default", { disabled: s.props.setting.locked.value || s.props.setting.saving.value }), s.props.setting.locked.value ? (_(), i("span", {
2163
- key: 0,
2164
- class: "kvc-muted",
2165
- "data-test": `${s.props.name}-own-value`
2166
- }, C(s.kvman.t("kvcoder.config.setting.ownValue", { name: s.kvman.workspace.value.name })), 9, Wi)) : s.props.setting.changed.value || s.props.saved ? (_(), i("span", Gi, [s.props.saved ? (_(), i("span", {
2167
- key: 0,
2168
- class: "kvc-muted",
2169
- role: "status",
2170
- "data-test": `${s.props.name}-saved`
2171
- }, C(s.kvman.t("kvcoder.config.setting.saved")), 9, Ki)) : r("v-if", !0), s.props.setting.changed.value ? (_(), i(e, { key: 1 }, [a("span", {
2172
- class: "kvc-chip",
2173
- "data-test": `${s.props.name}-changed`
2174
- }, C(s.scoped("kvcoder.config.setting.changed")), 9, qi), a("button", {
2175
- type: "button",
2176
- class: "kvc-text-button",
2177
- disabled: s.props.setting.saving.value,
2178
- "data-test": `${s.props.name}-reset`,
2179
- onClick: n[0] ||= (...e) => s.props.setting.reset && s.props.setting.reset(...e)
2180
- }, C(s.scoped("kvcoder.config.setting.reset")), 9, Ji)], 64)) : r("v-if", !0)])) : r("v-if", !0)])], 8, zi);
2181
- }
2182
- var Xi = /*#__PURE__*/ U(Ri, [["render", Yi], ["__file", "/home/runner/work/kvman/kvman/extensions/kvcoder/web/src/SettingFrame.vue"]]), Zi = /*@__PURE__*/ c({
2183
- __name: "ShellSettings",
2184
- setup(e, { expose: n }) {
2185
- n();
2186
- let r = V(), i = W(r, "kvcoder.shell.approval"), a = W(r, "kvcoder.shell.path"), o = y(), s = ["auto", "ask"], c = t(() => typeof a.value.value == "string" ? a.value.value : ""), l = y("");
2187
- A(c, (e) => l.value = e, { immediate: !0 });
2188
- async function u(e) {
2189
- e.target instanceof HTMLSelectElement && (o.value = await i.set(e.target.value) ? "approval" : void 0);
2190
- }
2191
- async function d() {
2192
- let e = l.value.trim();
2193
- if (e === c.value) return void (l.value = e);
2194
- o.value = await a.set(e === "" ? null : e) ? "path" : void 0, l.value = c.value;
2195
- }
2196
- let f = {
2197
- kvman: r,
2198
- approval: i,
2199
- path: a,
2200
- saved: o,
2201
- choices: s,
2202
- storedPath: c,
2203
- typed: l,
2204
- saveApproval: u,
2205
- savePath: d,
2206
- SettingFrame: Xi
2207
- };
2208
- return Object.defineProperty(f, "__isScriptSetup", {
2209
- enumerable: !1,
2210
- value: !0
2211
- }), f;
1830
+ }, Mi = ["data-test"], Ni = ["data-test"], Pi = ["disabled", "data-test"], Fi = /* @__PURE__ */ c({
1831
+ __name: "SettingFrame",
1832
+ props: {
1833
+ settingKey: {},
1834
+ name: {},
1835
+ setting: {},
1836
+ saved: { type: Boolean }
1837
+ },
1838
+ setup(t) {
1839
+ let n = t, o = q(), s = (e) => o.t(`${e}.${o.scope.value}`, { name: o.workspace.value.name });
1840
+ return (t, c) => (v(), i("div", {
1841
+ class: "kvc-setting",
1842
+ "data-test": n.name
1843
+ }, [a("span", Ei, [a("span", {
1844
+ class: "kvc-setting-title",
1845
+ "data-test": `${n.name}-title`
1846
+ }, w(T(o).t(`${n.settingKey}.title`)), 9, Di), a("span", Oi, w(T(o).t(`${n.settingKey}.description`)), 1)]), a("span", ki, [S(t.$slots, "default", { disabled: n.setting.locked.value || n.setting.saving.value }), n.setting.locked.value ? (v(), i("span", {
1847
+ key: 0,
1848
+ class: "kvc-muted",
1849
+ "data-test": `${n.name}-own-value`
1850
+ }, w(T(o).t("kvcoder.config.setting.ownValue", { name: T(o).workspace.value.name })), 9, Ai)) : n.setting.changed.value || n.saved ? (v(), i("span", ji, [n.saved ? (v(), i("span", {
1851
+ key: 0,
1852
+ class: "kvc-muted",
1853
+ role: "status",
1854
+ "data-test": `${n.name}-saved`
1855
+ }, w(T(o).t("kvcoder.config.setting.saved")), 9, Mi)) : r("v-if", !0), n.setting.changed.value ? (v(), i(e, { key: 1 }, [a("span", {
1856
+ class: "kvc-chip",
1857
+ "data-test": `${n.name}-changed`
1858
+ }, w(s("kvcoder.config.setting.changed")), 9, Ni), a("button", {
1859
+ type: "button",
1860
+ class: "kvc-text-button",
1861
+ disabled: n.setting.saving.value,
1862
+ "data-test": `${n.name}-reset`,
1863
+ onClick: c[0] ||= (...e) => n.setting.reset && n.setting.reset(...e)
1864
+ }, w(s("kvcoder.config.setting.reset")), 9, Pi)], 64)) : r("v-if", !0)])) : r("v-if", !0)])], 8, Ti));
2212
1865
  }
2213
- }), Qi = {
1866
+ }), Ii = {
2214
1867
  class: "kvc-dialog-rows",
2215
1868
  "data-test": "shell-settings"
2216
- }, $i = [
1869
+ }, Li = [
2217
1870
  "value",
2218
1871
  "disabled",
2219
1872
  "aria-label"
2220
- ], ea = ["value"], ta = [
1873
+ ], Ri = ["value"], zi = [
2221
1874
  "disabled",
2222
1875
  "placeholder",
2223
1876
  "aria-label"
2224
- ];
2225
- function na(t, n, r, o, c, l) {
2226
- return _(), i("div", Qi, [s(o.SettingFrame, {
2227
- "setting-key": "kvcoder.shell.approval",
2228
- name: "shell-approval",
2229
- setting: o.approval,
2230
- saved: o.saved === "approval"
2231
- }, {
2232
- default: j(({ disabled: t }) => [a("select", {
2233
- class: "kvc-field",
2234
- value: o.approval.value.value,
2235
- disabled: t,
2236
- "aria-label": o.kvman.t("kvcoder.shell.approval.title"),
2237
- "data-test": "shell-approval-control",
2238
- onChange: o.saveApproval
2239
- }, [(_(), i(e, null, b(o.choices, (e) => a("option", {
2240
- key: e,
2241
- value: e
2242
- }, C(o.kvman.t(`kvcoder.shell.approval.options.${e}`)), 9, ea)), 64))], 40, $i)]),
2243
- _: 1
2244
- }, 8, ["setting", "saved"]), s(o.SettingFrame, {
2245
- "setting-key": "kvcoder.shell.path",
2246
- name: "shell-path",
2247
- setting: o.path,
2248
- saved: o.saved === "path"
2249
- }, {
2250
- default: j(({ disabled: e }) => [M(a("input", {
2251
- "onUpdate:modelValue": n[0] ||= (e) => o.typed = e,
2252
- type: "text",
2253
- dir: "ltr",
2254
- class: "kvc-field kvc-mono",
2255
- disabled: e,
2256
- placeholder: o.kvman.t("kvcoder.config.shell.pathFound"),
2257
- "aria-label": o.kvman.t("kvcoder.shell.path.title"),
2258
- spellcheck: "false",
2259
- autocomplete: "off",
2260
- "data-test": "shell-path-control",
2261
- onKeydown: N(o.savePath, ["enter"]),
2262
- onBlur: o.savePath
2263
- }, null, 40, ta), [[k, o.typed]])]),
2264
- _: 1
2265
- }, 8, ["setting", "saved"])]);
2266
- }
2267
- var ra = /*#__PURE__*/ U(Zi, [["render", na], ["__file", "/home/runner/work/kvman/kvman/extensions/kvcoder/web/src/ShellSettings.vue"]]), ia = /*@__PURE__*/ c({
2268
- __name: "ConnectorsList",
2269
- setup(e, { expose: t }) {
2270
- t();
2271
- let n = V(), { items: r, locked: i, changed: a, saving: o, toggle: s, reset: c } = ft(n), l = y(), u = /* @__PURE__ */ new Map();
2272
- function d(e, t) {
2273
- t instanceof HTMLElement ? u.set(e, t) : u.delete(e);
1877
+ ], Bi = /* @__PURE__ */ c({
1878
+ __name: "ShellSettings",
1879
+ setup(n) {
1880
+ let r = q(), o = Y(r, "kvcoder.shell.approval"), c = Y(r, "kvcoder.shell.path"), l = b(), u = ["auto", "ask"], d = t(() => typeof c.value.value == "string" ? c.value.value : ""), f = b("");
1881
+ M(d, (e) => f.value = e, { immediate: !0 });
1882
+ async function p(e) {
1883
+ e.target instanceof HTMLSelectElement && (l.value = await o.set(e.target.value) ? "approval" : void 0);
2274
1884
  }
2275
- async function f() {
2276
- let e = l.value;
2277
- l.value = void 0, await p(), e !== void 0 && u.get(e)?.focus();
1885
+ async function m() {
1886
+ let e = f.value.trim();
1887
+ if (e === d.value) return void (f.value = e);
1888
+ l.value = await c.set(e === "" ? null : e) ? "path" : void 0, f.value = d.value;
2278
1889
  }
2279
- let m = {
2280
- kvman: n,
2281
- items: r,
2282
- locked: i,
2283
- changed: a,
2284
- saving: o,
2285
- toggle: s,
2286
- reset: c,
2287
- opened: l,
2288
- cogs: u,
2289
- keepCog: d,
2290
- close: f,
2291
- scoped: (e) => n.t(`${e}.${n.scope.value}`, { name: n.workspace.value.name }),
2292
- get Settings() {
2293
- return ue;
2294
- },
2295
- ConnectorDialog: Te,
2296
- DelegateWorkers: lr,
2297
- McpServers: Li,
2298
- ShellSettings: ra
2299
- };
2300
- return Object.defineProperty(m, "__isScriptSetup", {
2301
- enumerable: !1,
2302
- value: !0
2303
- }), m;
1890
+ return (t, n) => (v(), i("div", Ii, [s(Fi, {
1891
+ "setting-key": "kvcoder.shell.approval",
1892
+ name: "shell-approval",
1893
+ setting: T(o),
1894
+ saved: l.value === "approval"
1895
+ }, {
1896
+ default: N(({ disabled: t }) => [a("select", {
1897
+ class: "kvc-field",
1898
+ value: T(o).value.value,
1899
+ disabled: t,
1900
+ "aria-label": T(r).t("kvcoder.shell.approval.title"),
1901
+ "data-test": "shell-approval-control",
1902
+ onChange: p
1903
+ }, [(v(), i(e, null, x(u, (e) => a("option", {
1904
+ key: e,
1905
+ value: e
1906
+ }, w(T(r).t(`kvcoder.shell.approval.options.${e}`)), 9, Ri)), 64))], 40, Li)]),
1907
+ _: 1
1908
+ }, 8, ["setting", "saved"]), s(Fi, {
1909
+ "setting-key": "kvcoder.shell.path",
1910
+ name: "shell-path",
1911
+ setting: T(c),
1912
+ saved: l.value === "path"
1913
+ }, {
1914
+ default: N(({ disabled: e }) => [P(a("input", {
1915
+ "onUpdate:modelValue": n[0] ||= (e) => f.value = e,
1916
+ type: "text",
1917
+ dir: "ltr",
1918
+ class: "kvc-field kvc-mono",
1919
+ disabled: e,
1920
+ placeholder: T(r).t("kvcoder.config.shell.pathFound"),
1921
+ "aria-label": T(r).t("kvcoder.shell.path.title"),
1922
+ spellcheck: "false",
1923
+ autocomplete: "off",
1924
+ "data-test": "shell-path-control",
1925
+ onKeydown: F(m, ["enter"]),
1926
+ onBlur: m
1927
+ }, null, 40, zi), [[j, f.value]])]),
1928
+ _: 1
1929
+ }, 8, ["setting", "saved"])]));
2304
1930
  }
2305
- }), aa = {
1931
+ }), Vi = {
2306
1932
  class: "kvc-connectors",
2307
1933
  "data-test": "connectors"
2308
- }, oa = {
1934
+ }, Hi = {
2309
1935
  key: 0,
2310
1936
  class: "kvc-muted",
2311
1937
  "data-test": "connectors-own-value"
2312
- }, sa = {
1938
+ }, Ui = {
2313
1939
  key: 1,
2314
1940
  class: "kvc-connectors-state"
2315
- }, ca = {
1941
+ }, Wi = {
2316
1942
  class: "kvc-chip",
2317
1943
  "data-test": "connectors-changed"
2318
- }, la = ["disabled"], ua = ["data-test"], da = { class: "kvc-connector-text" }, fa = {
1944
+ }, Gi = ["disabled"], Ki = ["data-test"], qi = { class: "kvc-connector-text" }, Ji = {
2319
1945
  class: "kvc-mono kvc-connector-name",
2320
1946
  "data-test": "connector-name"
2321
- }, pa = {
1947
+ }, Yi = {
2322
1948
  class: "kvc-muted",
2323
1949
  dir: "auto",
2324
1950
  "data-test": "connector-description"
2325
- }, ma = { class: "kvc-connector-actions" }, ha = [
1951
+ }, Xi = { class: "kvc-connector-actions" }, Zi = [
2326
1952
  "aria-label",
2327
1953
  "title",
2328
1954
  "onClick"
2329
- ], ga = [
1955
+ ], Qi = [
2330
1956
  "aria-checked",
2331
1957
  "aria-label",
2332
1958
  "disabled",
2333
1959
  "onClick"
2334
- ];
2335
- function _a(t, o, c, l, u, d) {
2336
- return _(), i("div", aa, [
2337
- l.locked ? (_(), i("p", oa, C(l.kvman.t("kvcoder.config.connectors.ownValue", { name: l.kvman.workspace.value.name })), 1)) : l.changed ? (_(), i("div", sa, [a("span", ca, C(l.scoped("kvcoder.config.connectors.changed")), 1), a("button", {
2338
- type: "button",
2339
- class: "kvc-text-button",
2340
- disabled: l.saving,
2341
- "data-test": "connectors-reset",
2342
- onClick: o[0] ||= (...e) => l.reset && l.reset(...e)
2343
- }, C(l.scoped("kvcoder.config.connectors.reset")), 9, la)])) : r("v-if", !0),
2344
- (_(!0), i(e, null, b(l.items, (e) => (_(), i("div", {
2345
- key: e.name,
2346
- class: "kvc-connector",
2347
- "data-test": `connector-${e.name}`
2348
- }, [a("span", da, [a("span", fa, C(e.name), 1), a("span", pa, C(e.description), 1)]), a("span", ma, [e.configurable ? (_(), i("button", {
2349
- key: 0,
2350
- ref_for: !0,
2351
- ref: (t) => l.keepCog(e.name, t),
2352
- type: "button",
2353
- class: "kvc-button kvc-ghost kvc-icon-button",
2354
- "aria-haspopup": "dialog",
2355
- "aria-label": l.kvman.t("kvcoder.config.connectors.configure", { name: e.name }),
2356
- title: l.kvman.t("kvcoder.config.connectors.configure", { name: e.name }),
2357
- "data-test": "connector-configure",
2358
- onClick: (t) => l.opened = e.name
2359
- }, [s(l.Settings, {
2360
- size: 18,
2361
- "aria-hidden": "true"
2362
- })], 8, ha)) : r("v-if", !0), a("button", {
2363
- type: "button",
2364
- role: "switch",
2365
- class: "kvc-switch",
2366
- "aria-checked": e.on,
2367
- "aria-label": l.kvman.t("kvcoder.config.connectors.use", { name: e.name }),
2368
- disabled: l.locked || l.saving,
2369
- "data-test": "connector-switch",
2370
- onClick: (t) => l.toggle(e.name)
2371
- }, [...o[1] ||= [a("span", {
2372
- class: "kvc-switch-knob",
2373
- "aria-hidden": "true"
2374
- }, null, -1)]], 8, ga)])], 8, ua))), 128)),
2375
- l.opened === void 0 ? r("v-if", !0) : (_(), n(l.ConnectorDialog, {
2376
- key: 2,
2377
- name: l.opened,
2378
- onClose: l.close
2379
- }, {
2380
- default: j(() => [l.opened === "shell" ? (_(), n(l.ShellSettings, { key: 0 })) : l.opened === "delegate" ? (_(), n(l.DelegateWorkers, { key: 1 })) : l.opened === "mcp" ? (_(), n(l.McpServers, { key: 2 })) : r("v-if", !0)]),
2381
- _: 1
2382
- }, 8, ["name"]))
2383
- ]);
2384
- }
2385
- var va = /*#__PURE__*/ U(ia, [["render", _a], ["__file", "/home/runner/work/kvman/kvman/extensions/kvcoder/web/src/ConnectorsList.vue"]]), ya = /*@__PURE__*/ c({
1960
+ ], $i = /* @__PURE__ */ c({
1961
+ __name: "ConnectorsList",
1962
+ setup(t) {
1963
+ let o = q(), { items: c, locked: l, changed: u, saving: d, toggle: f, reset: p } = ot(o), h = b(), g = /* @__PURE__ */ new Map();
1964
+ function _(e, t) {
1965
+ t instanceof HTMLElement ? g.set(e, t) : g.delete(e);
1966
+ }
1967
+ async function y() {
1968
+ let e = h.value;
1969
+ h.value = void 0, await m(), e !== void 0 && g.get(e)?.focus();
1970
+ }
1971
+ let S = (e) => o.t(`${e}.${o.scope.value}`, { name: o.workspace.value.name });
1972
+ return (t, m) => (v(), i("div", Vi, [
1973
+ T(l) ? (v(), i("p", Hi, w(T(o).t("kvcoder.config.connectors.ownValue", { name: T(o).workspace.value.name })), 1)) : T(u) ? (v(), i("div", Ui, [a("span", Wi, w(S("kvcoder.config.connectors.changed")), 1), a("button", {
1974
+ type: "button",
1975
+ class: "kvc-text-button",
1976
+ disabled: T(d),
1977
+ "data-test": "connectors-reset",
1978
+ onClick: m[0] ||= (...e) => T(p) && T(p)(...e)
1979
+ }, w(S("kvcoder.config.connectors.reset")), 9, Gi)])) : r("v-if", !0),
1980
+ (v(!0), i(e, null, x(T(c), (e) => (v(), i("div", {
1981
+ key: e.name,
1982
+ class: "kvc-connector",
1983
+ "data-test": `connector-${e.name}`
1984
+ }, [a("span", qi, [a("span", Ji, w(e.name), 1), a("span", Yi, w(e.description), 1)]), a("span", Xi, [e.configurable ? (v(), i("button", {
1985
+ key: 0,
1986
+ ref_for: !0,
1987
+ ref: (t) => _(e.name, t),
1988
+ type: "button",
1989
+ class: "kvc-button kvc-ghost kvc-icon-button",
1990
+ "aria-haspopup": "dialog",
1991
+ "aria-label": T(o).t("kvcoder.config.connectors.configure", { name: e.name }),
1992
+ title: T(o).t("kvcoder.config.connectors.configure", { name: e.name }),
1993
+ "data-test": "connector-configure",
1994
+ onClick: (t) => h.value = e.name
1995
+ }, [s(T(oe), {
1996
+ size: 18,
1997
+ "aria-hidden": "true"
1998
+ })], 8, Zi)) : r("v-if", !0), a("button", {
1999
+ type: "button",
2000
+ role: "switch",
2001
+ class: "kvc-switch",
2002
+ "aria-checked": e.on,
2003
+ "aria-label": T(o).t("kvcoder.config.connectors.use", { name: e.name }),
2004
+ disabled: T(l) || T(d),
2005
+ "data-test": "connector-switch",
2006
+ onClick: (t) => T(f)(e.name)
2007
+ }, [...m[1] ||= [a("span", {
2008
+ class: "kvc-switch-knob",
2009
+ "aria-hidden": "true"
2010
+ }, null, -1)]], 8, Qi)])], 8, Ki))), 128)),
2011
+ h.value === void 0 ? r("v-if", !0) : (v(), n(ye, {
2012
+ key: 2,
2013
+ name: h.value,
2014
+ onClose: y
2015
+ }, {
2016
+ default: N(() => [h.value === "shell" ? (v(), n(Bi, { key: 0 })) : h.value === "delegate" ? (v(), n(Zn, { key: 1 })) : h.value === "mcp" ? (v(), n(wi, { key: 2 })) : r("v-if", !0)]),
2017
+ _: 1
2018
+ }, 8, ["name"]))
2019
+ ]));
2020
+ }
2021
+ }), ea = /* @__PURE__ */ c({
2386
2022
  __name: "connectors",
2387
- setup(e, { expose: t }) {
2388
- t();
2389
- let n = { ConnectorsList: va };
2390
- return Object.defineProperty(n, "__isScriptSetup", {
2391
- enumerable: !1,
2392
- value: !0
2393
- }), n;
2023
+ setup(e) {
2024
+ return (e, t) => (v(), n($i));
2394
2025
  }
2395
2026
  });
2396
2027
  //#endregion
2397
- //#region web/components/connectors.vue
2398
- function ba(e, t, r, i, a, o) {
2399
- return _(), n(i.ConnectorsList);
2400
- }
2401
- var xa = /*#__PURE__*/ U(ya, [["render", ba], ["__file", "/home/runner/work/kvman/kvman/extensions/kvcoder/web/components/connectors.vue"]]);
2402
- //#endregion
2403
- export { xa as default };
2028
+ export { ea as default };