@kvman/kvcoder 0.1.4 → 0.1.6

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 (35) hide show
  1. package/dist/connectors/builtin-connectors.d.ts +1 -0
  2. package/dist/connectors/builtin-connectors.d.ts.map +1 -1
  3. package/dist/connectors/delegate.d.ts +7 -2
  4. package/dist/connectors/delegate.d.ts.map +1 -1
  5. package/dist/connectors/delegate.js +5 -4
  6. package/dist/connectors/delegate.js.map +1 -1
  7. package/dist/files/edit-text.d.ts.map +1 -1
  8. package/dist/files/edit-text.js +7 -5
  9. package/dist/files/edit-text.js.map +1 -1
  10. package/dist/jobs/job-rows.js +1 -1
  11. package/dist/jobs/job-rows.js.map +1 -1
  12. package/dist/turns/call-groups.d.ts +9 -0
  13. package/dist/turns/call-groups.d.ts.map +1 -0
  14. package/dist/turns/call-groups.js +18 -0
  15. package/dist/turns/call-groups.js.map +1 -0
  16. package/dist/turns/compaction.d.ts.map +1 -1
  17. package/dist/turns/compaction.js +4 -2
  18. package/dist/turns/compaction.js.map +1 -1
  19. package/dist/turns/model-context.d.ts.map +1 -1
  20. package/dist/turns/model-context.js +6 -1
  21. package/dist/turns/model-context.js.map +1 -1
  22. package/dist/turns/run-calls.js +1 -1
  23. package/dist/turns/run-calls.js.map +1 -1
  24. package/dist/web/components/call.css +1 -1
  25. package/dist/web/components/call.js +745 -131
  26. package/dist/web/components/connectors.css +1 -1
  27. package/dist/web/components/conversation.css +1 -1
  28. package/dist/web/components/conversation.js +1625 -998
  29. package/dist/web/components/mcp-sign-in.css +1 -1
  30. package/dist/web/components/model.css +1 -1
  31. package/dist/web/components/question.css +1 -1
  32. package/dist/web/components/sessions.css +1 -1
  33. package/locales/ar.json +38 -2
  34. package/locales/en.json +38 -2
  35. package/package.json +2 -2
@@ -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, defineComponent as s, h as c, inject as l, normalizeClass as u, openBlock as d, ref as f, renderList as p, resolveDynamicComponent as m, toDisplayString as h, unref as g } 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, normalizeClass as d, openBlock as f, ref as p, renderList as m, resolveComponent as h, resolveDynamicComponent as g, toDisplayString as _, unref as v } 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 _ = {
3
+ var y = {
4
4
  xmlns: "http://www.w3.org/2000/svg",
5
5
  width: 24,
6
6
  height: 24,
@@ -10,25 +10,25 @@ var _ = {
10
10
  "stroke-width": 2,
11
11
  "stroke-linecap": "round",
12
12
  "stroke-linejoin": "round"
13
- }, v = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim();
13
+ }, b = (...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 y(e) {
16
+ function x(e) {
17
17
  return e != null;
18
18
  }
19
- function b(e, t = {}) {
20
- let n = t.attributeNames ?? {}, r = (e) => n[e] ?? e, i = e.size ?? e.width ?? _.width, a = e.size ?? e.height ?? _.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 ? v(...c) : v("lucide", ...s, ...c), u = t.absoluteStrokeWidth ? Number(t.strokeWidth ?? _["stroke-width"]) * Number(e.size ?? e.width ?? _.width) / Number(t.size ?? t.width ?? _.width) : t.strokeWidth ?? _["stroke-width"];
19
+ function ee(e, t = {}) {
20
+ let n = t.attributeNames ?? {}, r = (e) => n[e] ?? e, i = e.size ?? e.width ?? y.width, a = e.size ?? e.height ?? y.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 ? b(...c) : b("lucide", ...s, ...c), u = t.absoluteStrokeWidth ? Number(t.strokeWidth ?? y["stroke-width"]) * Number(e.size ?? e.width ?? y.width) / Number(t.size ?? t.width ?? y.width) : t.strokeWidth ?? y["stroke-width"];
21
21
  return [
22
22
  "svg",
23
23
  {
24
- ...Object.entries(_).reduce((e, [t, n]) => (e[r(t)] = n, e), {}),
24
+ ...Object.entries(y).reduce((e, [t, n]) => (e[r(t)] = n, e), {}),
25
25
  ..."color" in t && t.color && { [r("stroke")]: t.color },
26
- ..."size" in t && y(t.size) && {
26
+ ..."size" in t && x(t.size) && {
27
27
  [r("width")]: t.size,
28
28
  [r("height")]: t.size
29
29
  },
30
- ..."width" in t && y(t.width) && { [r("width")]: t.width },
31
- ..."height" in t && y(t.height) && { [r("height")]: t.height },
30
+ ..."width" in t && x(t.width) && { [r("width")]: t.width },
31
+ ..."height" in t && x(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,92 +50,375 @@ function b(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 x = (e) => {
53
+ var S = (e) => {
54
54
  for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
55
55
  return !1;
56
- }, S = (e) => e === "", C = (e) => e?.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), w = /* @__PURE__ */ Symbol("lucide-icons");
57
- function T() {
58
- return l(w, {});
56
+ }, C = (e) => e === "", te = (e) => e?.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), ne = /* @__PURE__ */ Symbol("lucide-icons");
57
+ function re() {
58
+ return u(ne, {});
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 E = ({ name: e, iconNode: t, "icon-node": n, icon: r = {
63
- name: e && C(e),
62
+ var w = ({ name: e, iconNode: t, "icon-node": n, icon: r = {
63
+ name: e && te(e),
64
64
  node: t ?? n ?? [],
65
65
  size: 24,
66
66
  aliases: []
67
- }, absoluteStrokeWidth: i, "absolute-stroke-width": a, nonScalingStroke: o, "non-scaling-stroke": s, strokeWidth: l, "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: w = !1, nonScalingStroke: E = !1, class: D = "" } = T(), O = S(i) || S(a) || i === !0 || a === !0 || w === !0, k = S(o) || S(s) || o === !0 || s === !0 || E === !0;
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: ne = "" } = re(), w = C(i) || C(a) || i === !0 || a === !0 || b === !0, T = C(o) || C(s) || o === !0 || s === !0 || x === !0;
69
69
  delete h.class;
70
- let A = g.default?.(), [, j, M = []] = b(r, {
70
+ let E = g.default?.(), [, D, O = []] = ee(r, {
71
71
  color: m ?? v,
72
72
  width: f ?? d ?? _,
73
73
  height: p ?? d ?? _,
74
- strokeWidth: l ?? u ?? y,
75
- absoluteStrokeWidth: O,
76
- nonScalingStroke: k,
77
- className: D,
78
- hasA11yProp: A != null && A.length > 0 || x(h),
74
+ strokeWidth: c ?? u ?? y,
75
+ absoluteStrokeWidth: w,
76
+ nonScalingStroke: T,
77
+ className: ne,
78
+ hasA11yProp: E != null && E.length > 0 || S(h),
79
79
  attributes: h
80
80
  });
81
- return c("svg", j, [...M.map(([e, t]) => c(e, t)), ...A ?? []]);
81
+ return l("svg", D, [...O.map(([e, t]) => l(e, t)), ...E ?? []]);
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 D(e, t = []) {
85
+ function T(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 }) => c(E, {
90
+ return (e, { slots: t }) => l(w, {
91
91
  ...e,
92
92
  icon: n
93
93
  }, t.default ? { default: t.default } : void 0);
94
94
  }
95
- var O = D({
95
+ var E = T({
96
96
  name: "chevron-down",
97
97
  size: 24,
98
98
  node: [["path", {
99
99
  d: "m6 9 6 6 6-6",
100
100
  key: "qrunsl"
101
101
  }]]
102
- }), k = D({
102
+ }), D = T({
103
103
  name: "chevron-right",
104
104
  size: 24,
105
105
  node: [["path", {
106
106
  d: "m9 18 6-6-6-6",
107
107
  key: "mthhwq"
108
108
  }]]
109
- }), A = 200;
110
- function j(e) {
111
- let t = e.replace(/\s+/g, " ");
112
- return t.length > A ? `${t.slice(0, A)}…` : t;
109
+ }), O = T({
110
+ name: "file",
111
+ size: 24,
112
+ node: [["path", {
113
+ d: "M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",
114
+ key: "1oefj6"
115
+ }], ["path", {
116
+ d: "M14 2v5a1 1 0 0 0 1 1h5",
117
+ key: "wfsgrz"
118
+ }]]
119
+ }), ie = T({
120
+ name: "folder",
121
+ size: 24,
122
+ node: [["path", {
123
+ d: "M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",
124
+ key: "1kt360"
125
+ }]]
126
+ }), k = 3;
127
+ function A(e) {
128
+ if (e === "") return [];
129
+ let t = e.split("\n");
130
+ return e.endsWith("\n") ? t.slice(0, -1) : t;
113
131
  }
114
- //#endregion
115
- //#region web/src/durations.ts
116
- function M(e, t) {
117
- if (t < 1e3) return e("kvcoder.ui.milliseconds", { count: Math.round(t) });
118
- if (t < 1e4) return e("kvcoder.ui.seconds", { count: (t / 1e3).toFixed(1) });
119
- let n = Math.round(t / 1e3);
120
- return n < 60 ? e("kvcoder.ui.seconds", { count: n }) : e("kvcoder.ui.minutesSeconds", {
121
- minutes: Math.floor(n / 60),
122
- seconds: n % 60
123
- });
132
+ function ae(e, t) {
133
+ let n = 0;
134
+ for (; n < e.length && n < t.length && e[n] === t[n];) n += 1;
135
+ return n;
136
+ }
137
+ function oe(e, t) {
138
+ let n = A(e), r = A(t), i = ae(n, r), a = ae(n.slice(i).reverse(), r.slice(i).reverse()), o = (e, t) => t.map((t) => ({
139
+ kind: e,
140
+ text: t
141
+ }));
142
+ return [
143
+ ...o("context", n.slice(Math.max(i - k, 0), i)),
144
+ ...o("removed", n.slice(i, n.length - a)),
145
+ ...o("added", r.slice(i, r.length - a)),
146
+ ...o("context", n.slice(n.length - a, n.length - a + k))
147
+ ];
148
+ }
149
+ function se(e) {
150
+ return {
151
+ added: e.filter((e) => e.kind === "added").length,
152
+ removed: e.filter((e) => e.kind === "removed").length
153
+ };
124
154
  }
125
155
  //#endregion
126
156
  //#region web/src/kvman.ts
127
- function N() {
128
- let e = l("kvman");
157
+ function j() {
158
+ let e = u("kvman");
129
159
  if (e === void 0) throw Error("kvcoder components run inside kvwebui, which provides kvman.");
130
160
  return e;
131
161
  }
162
+ function M(e) {
163
+ return typeof e == "object" && e && !Array.isArray(e) ? Object.fromEntries(Object.entries(e)) : {};
164
+ }
132
165
  //#endregion
133
- //#region web/src/output-links.ts
134
- var P = /http:\/\/(?:127\.0\.0\.1|localhost):\d+[^\s"'`<>()[\]{}]*/g, F = /[.,;:!?]+$/;
166
+ //#region web/src/call-summary.ts
167
+ function ce(e) {
168
+ if (e !== void 0 && /^\s*[[{]/.test(e)) try {
169
+ return JSON.parse(e);
170
+ } catch (e) {
171
+ if (e instanceof SyntaxError) return;
172
+ throw e;
173
+ }
174
+ }
175
+ var N = 1024;
176
+ function P(e, t) {
177
+ return t < N ? e("kvcoder.ui.call.bytes", { count: t }) : t < N * N ? e("kvcoder.ui.call.kilobytes", { count: (t / N).toFixed(1) }) : e("kvcoder.ui.call.megabytes", { count: (t / (N * N)).toFixed(1) });
178
+ }
179
+ var F = (e) => typeof e == "string" && e !== "" ? e : void 0;
135
180
  function I(e) {
181
+ let t = e.edits;
182
+ return Array.isArray(t) ? t.flatMap((e) => {
183
+ let { oldText: t, newText: n } = M(e);
184
+ return typeof t == "string" && typeof n == "string" ? [{
185
+ oldText: t,
186
+ newText: n
187
+ }] : [];
188
+ }) : [];
189
+ }
190
+ function le(e) {
191
+ let t = I(e).map((e) => se(oe(e.oldText, e.newText)));
192
+ return `+${t.reduce((e, t) => e + t.added, 0)} −${t.reduce((e, t) => e + t.removed, 0)}`;
193
+ }
194
+ function ue(e, t) {
195
+ if (typeof t.bytes == "number" && typeof t.created == "boolean") return e(t.created ? "kvcoder.ui.call.created" : "kvcoder.ui.call.replaced", { size: P(e, t.bytes) });
196
+ }
197
+ function de(e, t) {
198
+ let { fromLine: n, totalLines: r, content: i } = t;
199
+ if (typeof n != "number" || typeof r != "number" || typeof i != "string") return;
200
+ let a = A(i).length;
201
+ return a === 0 ? void 0 : e("kvcoder.ui.call.lines", {
202
+ from: n,
203
+ to: n + a - 1,
204
+ total: r
205
+ });
206
+ }
207
+ function fe(e, t) {
208
+ let n = t.entries;
209
+ if (Array.isArray(n)) return e(t.truncated === !0 ? "kvcoder.ui.call.entriesFirst" : "kvcoder.ui.call.entries", { count: n.length });
210
+ }
211
+ function pe(e, t) {
212
+ let n = t.files;
213
+ if (!Array.isArray(n)) return;
214
+ let r = n.reduce((e, t) => {
215
+ let n = M(t).matches;
216
+ return e + (Array.isArray(n) ? n.length : 0);
217
+ }, 0);
218
+ return e(t.truncated === !0 ? "kvcoder.ui.call.matchesFirst" : "kvcoder.ui.call.matches", {
219
+ matches: r,
220
+ files: n.length
221
+ });
222
+ }
223
+ var L = (e, t, n) => Array.isArray(n) ? e(t, { count: n.length }) : void 0;
224
+ function R(e, t, n) {
225
+ return {
226
+ ...e === void 0 ? {} : { words: e },
227
+ ...t === void 0 ? {} : { subject: t },
228
+ ...n === void 0 ? {} : { outcome: n }
229
+ };
230
+ }
231
+ function me(e, t, n, r) {
232
+ let i = r === void 0 ? void 0 : M(r), a = F(n.path);
233
+ if (t === "edit") return R(e("kvcoder.ui.call.edit"), a, i === void 0 ? void 0 : le(n));
234
+ if (t === "write") return R(e("kvcoder.ui.call.write"), a, i === void 0 ? void 0 : ue(e, i));
235
+ if (t === "read") return R(e("kvcoder.ui.call.read"), a, i === void 0 ? void 0 : de(e, i));
236
+ if (t === "list") return R(e("kvcoder.ui.call.list"), a ?? ".", i === void 0 ? void 0 : fe(e, i));
237
+ if (t === "search") return R(e("kvcoder.ui.call.search"), F(n.pattern), i === void 0 ? void 0 : pe(e, i));
238
+ }
239
+ function he(e, t, n, r) {
240
+ let i = [F(n.server), F(n.tool)].filter((e) => e !== void 0).join(" · ");
241
+ if (t === "call") return R(void 0, i === "" ? void 0 : i);
242
+ if (t === "tools") return R(e("kvcoder.ui.call.tools"), i === "" ? void 0 : i, L(e, "kvcoder.ui.call.toolCount", M(r).tools));
243
+ }
244
+ function ge(e, t, n, r) {
245
+ if (t === "list") return R(e("kvcoder.ui.call.backgroundRuns"), void 0, L(e, "kvcoder.ui.call.runCount", r));
246
+ if (t === "output") return R(e("kvcoder.ui.call.output"), F(n.id));
247
+ if (t === "stop") return R(e("kvcoder.ui.call.stop"), F(n.id));
248
+ }
249
+ function _e(e, t, n) {
250
+ let { connector: r, command: i } = t, a = t.fields ?? {};
251
+ if (r !== void 0 && i !== void 0) {
252
+ if (t.line !== void 0) return { subject: `$ ${t.line}` };
253
+ if (r === "fs") return me(e, i, a, n);
254
+ if (r === "mcp") return he(e, i, a, n);
255
+ if (r === "background") return ge(e, i, a, n);
256
+ if (r === "delegate" && i === "run") return R(e("kvcoder.ui.call.delegate"), [F(a.worker), F(a.title)].filter((e) => e !== void 0).join(" · "));
257
+ if (r === "artifact" && i === "get") return R(e("kvcoder.ui.call.readArtifact"), F(a.id));
258
+ }
259
+ }
260
+ //#endregion
261
+ //#region web/src/call-view.ts
262
+ var z = 200, ve = [
263
+ "text",
264
+ "choice",
265
+ "confirm"
266
+ ];
267
+ function ye(e) {
268
+ return typeof e == "object" && e && !Array.isArray(e) ? Object.fromEntries(Object.entries(e)) : void 0;
269
+ }
270
+ var B = (e) => typeof e == "string" && e.trim() !== "" ? e : void 0;
271
+ function be(e, t) {
272
+ let n = B(t.args);
273
+ return B(t.line) ?? (n === void 0 ? e : `${e} ${n}`);
274
+ }
275
+ function xe(e) {
276
+ let t = B(e.title) ?? B(e.description), n = B(e.command);
277
+ return {
278
+ ...t === void 0 ? {} : { description: t },
279
+ ...n === void 0 ? {} : { line: n },
280
+ ...e.mode === "async" ? { background: !0 } : {}
281
+ };
282
+ }
283
+ function Se(e) {
284
+ let t = B(e.connector), n = B(e.command);
285
+ if (t === void 0) return xe(e);
286
+ let r = B(e.description), i = ye(typeof e.payload == "string" ? void 0 : e.payload) ?? {}, a = t === "ask" ? ve.find((e) => e === n) : void 0;
287
+ return {
288
+ ...r === void 0 ? {} : { description: r },
289
+ connector: t,
290
+ ...n === void 0 ? {} : {
291
+ command: n,
292
+ label: `${t} · ${n}`
293
+ },
294
+ ...n === "exec" ? { line: be(t, i) } : {},
295
+ fields: i,
296
+ ...i.risky === !0 ? { risky: !0 } : {},
297
+ ...i.background === !0 ? { background: !0 } : {},
298
+ ...a === void 0 ? {} : { ask: {
299
+ kind: a,
300
+ question: i
301
+ } }
302
+ };
303
+ }
304
+ var Ce = [
305
+ "edit",
306
+ "write",
307
+ "read",
308
+ "list",
309
+ "search"
310
+ ];
311
+ function V(e) {
312
+ return e.line === void 0 ? e.connector === "fs" ? Ce.find((t) => t === e.command) ?? "fields" : e.connector === "mcp" && e.command === "call" ? "mcp-call" : e.connector === "delegate" && e.command === "run" ? "delegate" : "fields" : "line";
313
+ }
314
+ function H(e) {
315
+ let t = e.replace(/\s+/g, " ");
316
+ return t.length > z ? `${t.slice(0, z)}…` : t;
317
+ }
318
+ //#endregion
319
+ //#region web/src/field-rows.ts
320
+ var we = "—", U = (e) => e === null || typeof e == "string" || typeof e == "number" || typeof e == "boolean", W = (e) => e === null ? we : String(e);
321
+ function G(e) {
322
+ return typeof e == "object" && e && !Array.isArray(e) ? Object.fromEntries(Object.entries(e)) : void 0;
323
+ }
324
+ function Te(e) {
325
+ let t = G(e);
326
+ if (t === void 0) return;
327
+ let n = {};
328
+ for (let [e, r] of Object.entries(t)) {
329
+ if (!U(r)) return;
330
+ n[e] = r;
331
+ }
332
+ return n;
333
+ }
334
+ function Ee(e) {
335
+ let t = [...new Set(e.flatMap((e) => Object.keys(e)))];
336
+ return {
337
+ kind: "table",
338
+ columns: t,
339
+ rows: e.map((e) => t.map((t) => t in e ? W(e[t] ?? null) : ""))
340
+ };
341
+ }
342
+ function De(e) {
343
+ if (e.length === 0) return { kind: "empty" };
344
+ if (e.every(U)) return {
345
+ kind: "items",
346
+ items: e.map(W)
347
+ };
348
+ let t = e.map(Te).filter((e) => e !== void 0);
349
+ return t.length === e.length ? Ee(t) : {
350
+ kind: "rows",
351
+ rows: e.map((e, t) => ({
352
+ name: String(t + 1),
353
+ value: K(e)
354
+ }))
355
+ };
356
+ }
357
+ function K(e) {
358
+ if (typeof e == "string") return e.includes("\n") ? {
359
+ kind: "block",
360
+ text: e
361
+ } : {
362
+ kind: "text",
363
+ text: e
364
+ };
365
+ if (typeof e == "number" || typeof e == "boolean") return {
366
+ kind: "text",
367
+ text: String(e)
368
+ };
369
+ if (Array.isArray(e)) return De(e);
370
+ let t = G(e);
371
+ return t === void 0 || Object.keys(t).length === 0 ? { kind: "empty" } : {
372
+ kind: "rows",
373
+ rows: Oe(t)
374
+ };
375
+ }
376
+ function Oe(e) {
377
+ return Object.entries(e).map(([e, t]) => ({
378
+ name: e,
379
+ value: K(t)
380
+ }));
381
+ }
382
+ function q(e, t) {
383
+ return t || e.length <= 12 ? e : e.slice(0, 12);
384
+ }
385
+ var J = (e) => A(e).map((e) => ({ text: e })), Y = (e, t) => A(e).map((e, n) => ({
386
+ text: e,
387
+ number: t + n
388
+ }));
389
+ function ke(e, t) {
390
+ return t || e.length <= 17 ? e : [
391
+ ...e.slice(0, 12),
392
+ "⋯",
393
+ ...e.slice(-5)
394
+ ];
395
+ }
396
+ //#endregion
397
+ //#region web/src/FoldButton.vue?vue&type=script&setup=true&lang.ts
398
+ var Ae = ["aria-expanded"], X = /* @__PURE__ */ c({
399
+ __name: "FoldButton",
400
+ props: {
401
+ count: {},
402
+ open: { type: Boolean },
403
+ over: {}
404
+ },
405
+ emits: ["toggle"],
406
+ setup(e, { emit: t }) {
407
+ let n = e, a = t, o = j();
408
+ return (e, t) => n.count > (n.over ?? v(12)) ? (f(), i("button", {
409
+ key: 0,
410
+ type: "button",
411
+ class: "kvc-text-button kvc-fold",
412
+ "aria-expanded": n.open,
413
+ "data-test": "show-all",
414
+ onClick: t[0] ||= (e) => a("toggle")
415
+ }, _(n.open ? v(o).t("kvcoder.ui.call.showFewer") : v(o).t("kvcoder.ui.call.showAll", { count: n.count })), 9, Ae)) : r("v-if", !0);
416
+ }
417
+ }), je = /http:\/\/(?:127\.0\.0\.1|localhost):\d+[^\s"'`<>()[\]{}]*/g, Me = /[.,;:!?]+$/;
418
+ function Ne(e) {
136
419
  let t = [], n = 0;
137
- for (let r of e.matchAll(P)) {
138
- let i = r[0].replace(F, "");
420
+ for (let r of e.matchAll(je)) {
421
+ let i = r[0].replace(Me, "");
139
422
  r.index > n && t.push({
140
423
  kind: "text",
141
424
  text: e.slice(n, r.index)
@@ -149,71 +432,397 @@ function I(e) {
149
432
  text: e.slice(n)
150
433
  }), t;
151
434
  }
152
- function L(e) {
153
- if (!/^[[{]/.test(e) || e.includes("\n")) return e;
154
- try {
155
- return JSON.stringify(JSON.parse(e), null, 2);
156
- } catch (t) {
157
- if (t instanceof SyntaxError) return e;
158
- throw t;
435
+ //#endregion
436
+ //#region web/src/LinkedText.vue?vue&type=script&setup=true&lang.ts
437
+ var Pe = ["href"], Z = /* @__PURE__ */ c({
438
+ __name: "LinkedText",
439
+ props: { text: {} },
440
+ setup(n) {
441
+ let r = n, a = t(() => Ne(r.text));
442
+ return (t, n) => (f(!0), i(e, null, m(a.value, (t, n) => (f(), i(e, { key: n }, [t.kind === "link" ? (f(), i("a", {
443
+ key: 0,
444
+ href: t.href,
445
+ target: "_blank",
446
+ rel: "noopener noreferrer",
447
+ class: "kvc-link"
448
+ }, _(t.href), 9, Pe)) : (f(), i(e, { key: 1 }, [o(_(t.text), 1)], 64))], 64))), 128));
159
449
  }
450
+ }), Fe = { class: "kvc-code-lines" }, Ie = ["dir", "data-kind"], Le = {
451
+ key: 0,
452
+ class: "kvc-line-number",
453
+ "data-test": "call-line-number"
454
+ }, Re = {
455
+ key: 1,
456
+ class: "kvc-line-mark",
457
+ "aria-hidden": "true"
458
+ }, ze = {
459
+ class: "kvc-line-text",
460
+ dir: "auto",
461
+ "data-test": "call-line-text"
462
+ }, Q = /* @__PURE__ */ c({
463
+ __name: "FoldedLines",
464
+ props: { lines: {} },
465
+ setup(n) {
466
+ let o = n, c = p(!1), l = t(() => q(o.lines, c.value)), u = t(() => o.lines.some((e) => e.number !== void 0)), d = t(() => o.lines.some((e) => e.kind !== void 0)), h = {
467
+ context: " ",
468
+ removed: "−",
469
+ added: "+"
470
+ };
471
+ return (t, n) => (f(), i("div", Fe, [(f(!0), i(e, null, m(l.value, (e, t) => (f(), i("div", {
472
+ key: t,
473
+ class: "kvc-code-line",
474
+ dir: u.value || d.value ? "ltr" : void 0,
475
+ "data-kind": e.kind,
476
+ "data-test": "call-line-row"
477
+ }, [
478
+ u.value ? (f(), i("span", Le, _(e.number), 1)) : r("v-if", !0),
479
+ d.value ? (f(), i("span", Re, _(h[e.kind ?? "context"]), 1)) : r("v-if", !0),
480
+ a("span", ze, [s(Z, { text: e.text }, null, 8, ["text"])])
481
+ ], 8, Ie))), 128)), s(X, {
482
+ count: o.lines.length,
483
+ open: c.value,
484
+ onToggle: n[0] ||= (e) => c.value = !c.value
485
+ }, null, 8, ["count", "open"])]));
486
+ }
487
+ }), Be = {
488
+ key: 0,
489
+ dir: "auto",
490
+ "data-test": "field-text"
491
+ }, Ve = {
492
+ key: 1,
493
+ class: "kvc-muted",
494
+ "data-test": "field-empty"
495
+ }, He = {
496
+ key: 3,
497
+ class: "kvc-field-table"
498
+ }, Ue = { "data-test": "field-table" }, We = {
499
+ key: 4,
500
+ class: "kvc-field-items",
501
+ "data-test": "field-items"
502
+ }, Ge = {
503
+ key: 5,
504
+ class: "kvc-fields",
505
+ "data-test": "call-fields"
506
+ }, Ke = ["data-name"], qe = {
507
+ class: "kvc-muted",
508
+ dir: "ltr"
509
+ }, Je = { "data-test": "field-value" }, Ye = /* @__PURE__ */ c({
510
+ __name: "FieldsView",
511
+ props: { value: {} },
512
+ setup(r) {
513
+ let o = r, c = p(!1), l = t(() => o.value.kind === "table" ? q(o.value.rows, c.value) : []), u = t(() => o.value.kind === "items" ? q(o.value.items, c.value) : []);
514
+ return (t, r) => {
515
+ let d = h("FieldsView", !0);
516
+ return o.value.kind === "text" ? (f(), i("span", Be, [s(Z, { text: o.value.text }, null, 8, ["text"])])) : o.value.kind === "empty" ? (f(), i("span", Ve, "—")) : o.value.kind === "block" ? (f(), n(Q, {
517
+ key: 2,
518
+ class: "kvc-field-block",
519
+ lines: v(J)(o.value.text),
520
+ "data-test": "field-block"
521
+ }, null, 8, ["lines"])) : o.value.kind === "table" ? (f(), i("div", He, [a("table", Ue, [a("thead", null, [a("tr", null, [(f(!0), i(e, null, m(o.value.columns, (e) => (f(), i("th", {
522
+ key: e,
523
+ scope: "col",
524
+ dir: "ltr"
525
+ }, _(e), 1))), 128))])]), a("tbody", null, [(f(!0), i(e, null, m(l.value, (t, n) => (f(), i("tr", { key: n }, [(f(!0), i(e, null, m(t, (e, t) => (f(), i("td", {
526
+ key: t,
527
+ dir: "auto"
528
+ }, [s(Z, { text: e }, null, 8, ["text"])]))), 128))]))), 128))])]), s(X, {
529
+ count: o.value.rows.length,
530
+ open: c.value,
531
+ onToggle: r[0] ||= (e) => c.value = !c.value
532
+ }, null, 8, ["count", "open"])])) : o.value.kind === "items" ? (f(), i("div", We, [(f(!0), i(e, null, m(u.value, (e, t) => (f(), i("div", {
533
+ key: t,
534
+ dir: "auto"
535
+ }, [s(Z, { text: e }, null, 8, ["text"])]))), 128)), s(X, {
536
+ count: o.value.items.length,
537
+ open: c.value,
538
+ onToggle: r[1] ||= (e) => c.value = !c.value
539
+ }, null, 8, ["count", "open"])])) : (f(), i("dl", Ge, [(f(!0), i(e, null, m(o.value.rows, (e) => (f(), i("div", {
540
+ key: e.name,
541
+ class: "kvc-field-row",
542
+ "data-name": e.name,
543
+ "data-test": "field-row"
544
+ }, [a("dt", qe, _(e.name), 1), a("dd", Je, [s(d, { value: e.value }, null, 8, ["value"])])], 8, Ke))), 128))]));
545
+ };
546
+ }
547
+ }), Xe = ["aria-label"], Ze = ["aria-label"], Qe = /* @__PURE__ */ c({
548
+ __name: "CallRequest",
549
+ props: { view: {} },
550
+ setup(a) {
551
+ let o = a, c = j(), l = t(() => V(o.view)), u = t(() => o.view.fields ?? {}), d = t(() => I(u.value).map((e) => oe(e.oldText, e.newText))), p = t(() => typeof u.value.content == "string" ? u.value.content : ""), h = t(() => typeof u.value.task == "string" ? u.value.task : ""), g = t(() => l.value === "mcp-call" ? M(u.value.arguments) : l.value === "fields" ? u.value : {});
552
+ return (t, a) => l.value === "edit" ? (f(!0), i(e, { key: 0 }, m(d.value, (e, t) => (f(), n(Q, {
553
+ key: t,
554
+ class: "kvc-block",
555
+ lines: e,
556
+ "data-test": "call-diff"
557
+ }, null, 8, ["lines"]))), 128)) : l.value === "write" ? (f(), n(Q, {
558
+ key: 1,
559
+ class: "kvc-block",
560
+ lines: v(Y)(p.value, 1),
561
+ "data-test": "call-content"
562
+ }, null, 8, ["lines"])) : l.value === "line" ? (f(), i("pre", {
563
+ key: 2,
564
+ class: "kvc-output kvc-mono",
565
+ dir: "ltr",
566
+ "aria-label": v(c).t("kvcoder.ui.command"),
567
+ "data-test": "call-payload"
568
+ }, "$ " + _(o.view.line), 9, Xe)) : l.value === "delegate" ? (f(), n(Q, {
569
+ key: 3,
570
+ class: "kvc-block kvc-prose-lines",
571
+ lines: v(J)(h.value),
572
+ "aria-label": v(c).t("kvcoder.ui.call.task"),
573
+ "data-test": "call-task"
574
+ }, null, 8, ["lines", "aria-label"])) : Object.keys(g.value).length > 0 ? (f(), i("div", {
575
+ key: 4,
576
+ class: "kvc-block",
577
+ "aria-label": v(c).t("kvcoder.ui.call.payload"),
578
+ "data-test": "call-payload-fields"
579
+ }, [s(Ye, { value: v(K)(g.value) }, null, 8, ["value"])], 8, Ze)) : r("v-if", !0);
580
+ }
581
+ });
582
+ //#endregion
583
+ //#region web/src/call-results.ts
584
+ function $e(e) {
585
+ let { replacements: t, firstChangedLine: n } = M(e);
586
+ return typeof t == "number" && typeof n == "number" ? {
587
+ replacements: t,
588
+ firstChangedLine: n
589
+ } : void 0;
590
+ }
591
+ function et(e) {
592
+ let { fromLine: t, content: n } = M(e);
593
+ return typeof t == "number" && typeof n == "string" ? {
594
+ fromLine: t,
595
+ content: n
596
+ } : void 0;
597
+ }
598
+ function tt(e) {
599
+ let { name: t, kind: n, bytes: r } = M(e);
600
+ return typeof t == "string" && (n === "file" || n === "folder") && typeof r == "number" ? [{
601
+ name: t,
602
+ kind: n,
603
+ bytes: r
604
+ }] : [];
605
+ }
606
+ function nt(e) {
607
+ let t = M(e).entries;
608
+ return Array.isArray(t) ? t.flatMap(tt) : void 0;
609
+ }
610
+ function rt(e) {
611
+ let { path: t, matches: n } = M(e);
612
+ return typeof t != "string" || !Array.isArray(n) ? [] : [{
613
+ path: t,
614
+ matches: n.flatMap((e) => {
615
+ let { line: t, text: n } = M(e);
616
+ return typeof t == "number" && typeof n == "string" ? [{
617
+ line: t,
618
+ text: n
619
+ }] : [];
620
+ })
621
+ }];
622
+ }
623
+ function it(e) {
624
+ let t = M(e).files;
625
+ return Array.isArray(t) ? t.flatMap(rt) : void 0;
626
+ }
627
+ //#endregion
628
+ //#region web/src/FoldedOutput.vue?vue&type=script&setup=true&lang.ts
629
+ var at = { class: "kvc-output-block" }, ot = ["aria-label"], st = /* @__PURE__ */ c({
630
+ __name: "FoldedOutput",
631
+ props: { output: {} },
632
+ setup(e) {
633
+ let n = e, r = j(), o = p(!1), c = t(() => n.output.split("\n")), l = t(() => ke(c.value, o.value).join("\n"));
634
+ return (e, t) => (f(), i("div", at, [a("pre", {
635
+ class: "kvc-output",
636
+ dir: "auto",
637
+ "aria-label": v(r).t("kvcoder.ui.output"),
638
+ "data-test": "call-output"
639
+ }, [s(Z, { text: l.value }, null, 8, ["text"])], 8, ot), s(X, {
640
+ count: c.value.length,
641
+ open: o.value,
642
+ over: v(12) + v(5),
643
+ onToggle: t[0] ||= (e) => o.value = !o.value
644
+ }, null, 8, [
645
+ "count",
646
+ "open",
647
+ "over"
648
+ ])]));
649
+ }
650
+ }), ct = {
651
+ key: 0,
652
+ class: "kvc-muted kvc-call-parts",
653
+ "data-test": "call-replacements"
654
+ }, lt = {
655
+ key: 2,
656
+ class: "kvc-block kvc-entries",
657
+ "data-test": "call-entries"
658
+ }, ut = ["data-kind"], dt = {
659
+ class: "kvc-mono",
660
+ dir: "auto",
661
+ "data-test": "call-entry-name"
662
+ }, ft = {
663
+ key: 0,
664
+ class: "kvc-muted",
665
+ "data-test": "call-entry-size"
666
+ }, pt = {
667
+ class: "kvc-mono kvc-file-path",
668
+ "data-test": "call-file-path"
669
+ }, mt = ["aria-label"], ht = ["aria-label"], gt = /* @__PURE__ */ c({
670
+ __name: "CallResult",
671
+ props: {
672
+ view: {},
673
+ output: {},
674
+ result: {}
675
+ },
676
+ setup(o) {
677
+ let c = o, l = j(), u = t(() => V(c.view)), d = t(() => u.value === "edit" ? $e(c.result) : void 0), h = t(() => u.value === "read" ? et(c.result) : void 0), y = t(() => u.value === "list" ? nt(c.result) : void 0), b = t(() => u.value === "search" ? it(c.result) : void 0), x = p(!1), ee = t(() => q(y.value ?? [], x.value)), S = t(() => ({
678
+ type: "markdown",
679
+ text: "kvcoder.markdown",
680
+ params: { text: c.output }
681
+ })), C = t(() => u.value !== "line" && typeof c.result == "object" && c.result !== null);
682
+ return (t, o) => d.value === void 0 ? h.value === void 0 ? y.value === void 0 ? b.value === void 0 ? u.value === "write" && C.value ? (f(), i(e, { key: 4 }, [], 64)) : u.value === "delegate" && c.output !== "" ? (f(), i("div", {
683
+ key: 5,
684
+ class: "kvc-block",
685
+ "aria-label": v(l).t("kvcoder.ui.call.answer"),
686
+ "data-test": "call-answer"
687
+ }, [(f(), n(g(v(l).View), { view: S.value }, null, 8, ["view"]))], 8, mt)) : C.value ? (f(), i("div", {
688
+ key: 6,
689
+ class: "kvc-block",
690
+ "aria-label": v(l).t("kvcoder.ui.output"),
691
+ "data-test": "call-result-fields"
692
+ }, [s(Ye, { value: v(K)(c.result) }, null, 8, ["value"])], 8, ht)) : c.output === "" ? r("v-if", !0) : (f(), n(st, {
693
+ key: 7,
694
+ output: c.output
695
+ }, null, 8, ["output"])) : (f(!0), i(e, { key: 3 }, m(b.value, (e) => (f(), i("div", {
696
+ key: e.path,
697
+ class: "kvc-block",
698
+ "data-test": "call-file"
699
+ }, [a("div", pt, _(e.path), 1), s(Q, { lines: e.matches.map((e) => ({
700
+ text: e.text,
701
+ number: e.line
702
+ })) }, null, 8, ["lines"])]))), 128)) : (f(), i("div", lt, [(f(!0), i(e, null, m(ee.value, (e) => (f(), i("div", {
703
+ key: e.name,
704
+ class: "kvc-entry",
705
+ "data-kind": e.kind,
706
+ "data-test": "call-entry"
707
+ }, [
708
+ (f(), n(g(e.kind === "folder" ? v(ie) : v(O)), {
709
+ size: 14,
710
+ "aria-hidden": "true"
711
+ })),
712
+ a("span", dt, _(e.name), 1),
713
+ e.kind === "file" ? (f(), i("span", ft, _(v(P)(v(l).t, e.bytes)), 1)) : r("v-if", !0)
714
+ ], 8, ut))), 128)), s(X, {
715
+ count: y.value.length,
716
+ open: x.value,
717
+ onToggle: o[0] ||= (e) => x.value = !x.value
718
+ }, null, 8, ["count", "open"])])) : (f(), n(Q, {
719
+ key: 1,
720
+ class: "kvc-block",
721
+ lines: v(Y)(h.value.content, h.value.fromLine),
722
+ "data-test": "call-content"
723
+ }, null, 8, ["lines"])) : (f(), i("p", ct, _(v(l).t("kvcoder.ui.call.replacements", {
724
+ count: d.value.replacements,
725
+ line: d.value.firstChangedLine
726
+ })), 1));
727
+ }
728
+ }), _t = {
729
+ key: 0,
730
+ class: "kvc-summary",
731
+ "data-test": "call-summary"
732
+ }, vt = {
733
+ key: 0,
734
+ "data-test": "call-words"
735
+ }, yt = {
736
+ key: 1,
737
+ class: "kvc-mono",
738
+ "data-test": "call-subject"
739
+ }, bt = ["dir"], xt = {
740
+ key: 1,
741
+ class: "kvc-muted",
742
+ dir: "ltr",
743
+ style: { "align-self": "flex-start" },
744
+ "data-test": "call-label"
745
+ }, St = /* @__PURE__ */ c({
746
+ __name: "CallSummaryLine",
747
+ props: {
748
+ view: {},
749
+ result: {},
750
+ whole: { type: Boolean }
751
+ },
752
+ setup(e) {
753
+ let n = e, a = j(), o = t(() => _e(a.t, n.view, n.result)), s = t(() => /\p{L}/u.test(o.value?.outcome ?? "") ? void 0 : "ltr"), c = t(() => o.value?.subject === void 0 || n.whole === !0 ? o.value?.subject : H(o.value.subject));
754
+ return (e, t) => o.value === void 0 ? n.view.label ? (f(), i("span", xt, _(n.view.label), 1)) : r("v-if", !0) : (f(), i("span", _t, [
755
+ o.value.words ? (f(), i("span", vt, _(o.value.words), 1)) : r("v-if", !0),
756
+ c.value ? (f(), i("span", yt, _(c.value), 1)) : r("v-if", !0),
757
+ o.value.outcome ? (f(), i("span", {
758
+ key: 2,
759
+ class: "kvc-muted",
760
+ dir: s.value,
761
+ "data-test": "call-outcome"
762
+ }, _(o.value.outcome), 9, bt)) : r("v-if", !0)
763
+ ]));
764
+ }
765
+ });
766
+ //#endregion
767
+ //#region web/src/durations.ts
768
+ function $(e, t) {
769
+ if (t < 1e3) return e("kvcoder.ui.milliseconds", { count: Math.round(t) });
770
+ if (t < 1e4) return e("kvcoder.ui.seconds", { count: (t / 1e3).toFixed(1) });
771
+ let n = Math.round(t / 1e3);
772
+ return n < 60 ? e("kvcoder.ui.seconds", { count: n }) : e("kvcoder.ui.minutesSeconds", {
773
+ minutes: Math.floor(n / 60),
774
+ seconds: n % 60
775
+ });
160
776
  }
161
777
  //#endregion
162
778
  //#region web/src/CallCard.vue?vue&type=script&setup=true&lang.ts
163
- var R = ["aria-expanded", "disabled"], z = ["aria-label"], B = { class: "kvc-lines" }, V = {
779
+ var Ct = ["aria-expanded", "disabled"], wt = ["aria-label"], Tt = { class: "kvc-lines" }, Et = {
164
780
  key: 0,
165
781
  style: { "font-weight": "600" },
166
782
  "data-test": "call-description"
167
- }, H = {
783
+ }, Dt = {
168
784
  key: 1,
169
785
  class: "kvc-oneline",
170
786
  "data-test": "call-line"
171
- }, U = { class: "kvc-mono" }, W = {
172
- key: 2,
173
- class: "kvc-muted",
174
- dir: "ltr",
175
- style: { "align-self": "flex-start" },
176
- "data-test": "call-label"
177
- }, G = {
787
+ }, Ot = { class: "kvc-mono" }, kt = {
178
788
  key: 2,
789
+ class: "kvc-chip kvc-warn",
790
+ "data-test": "call-risky"
791
+ }, At = {
792
+ key: 3,
179
793
  class: "kvc-chip",
180
794
  "data-test": "call-background"
181
- }, K = {
182
- key: 3,
795
+ }, jt = {
796
+ key: 4,
183
797
  class: "kvc-chip kvc-danger",
184
798
  "data-test": "call-failed"
185
- }, q = {
799
+ }, Mt = {
186
800
  class: "kvc-muted",
187
801
  "data-test": "call-time"
188
- }, J = {
802
+ }, Nt = {
189
803
  key: 0,
190
804
  class: "kvc-muted kvc-call-parts",
191
805
  "data-test": "call-parts"
192
- }, Y = ["aria-label"], X = ["aria-label"], Z = ["href"], Q = /* @__PURE__ */ s({
806
+ }, Pt = ["aria-label"], Ft = /* @__PURE__ */ c({
193
807
  __name: "CallCard",
194
808
  props: {
195
- description: {},
196
- label: {},
197
- line: {},
198
- payload: {},
809
+ view: {},
199
810
  failed: { type: Boolean },
200
811
  durationMs: {},
201
- writtenMs: {},
202
812
  output: {},
203
- running: { type: Boolean },
204
- background: { type: Boolean }
813
+ running: { type: Boolean }
205
814
  },
206
- setup(s) {
207
- let c = s, l = N(), _ = f(!1), v = t(() => I(L(c.output ?? ""))), y = t(() => c.durationMs === void 0 ? "" : M(l.t, (c.writtenMs ?? 0) + c.durationMs)), b = t(() => {
815
+ setup(o) {
816
+ let c = o, l = j(), u = t(() => V(c.view)), m = p(c.output !== void 0 && (c.failed === !0 || u.value === "edit" || u.value === "write")), h = t(() => c.failed === !0 ? void 0 : ce(c.output)), y = t(() => c.failed === !0 && u.value !== "line"), b = t(() => c.durationMs === void 0 ? "" : $(l.t, (c.view.writtenMs ?? 0) + c.durationMs)), x = t(() => {
208
817
  if (c.durationMs === void 0) return "";
209
- let e = M(l.t, c.durationMs);
210
- return c.writtenMs === void 0 ? l.t("kvcoder.ui.callRan", { ran: e }) : l.t("kvcoder.ui.callParts", {
211
- written: M(l.t, c.writtenMs),
818
+ let e = $(l.t, c.durationMs);
819
+ return c.view.writtenMs === void 0 ? l.t("kvcoder.ui.callRan", { ran: e }) : l.t("kvcoder.ui.callParts", {
820
+ written: $(l.t, c.view.writtenMs),
212
821
  ran: e
213
822
  });
214
- }), x = t(() => c.line ?? c.payload);
215
- return (t, s) => (d(), i("div", {
216
- class: u(["kvc-card", { "kvc-failed": c.failed }]),
823
+ });
824
+ return (t, o) => (f(), i("div", {
825
+ class: d(["kvc-card", { "kvc-failed": c.failed }]),
217
826
  "data-test": "call-card"
218
827
  }, [a("button", {
219
828
  type: "button",
@@ -222,73 +831,78 @@ var R = ["aria-expanded", "disabled"], z = ["aria-label"], B = { class: "kvc-lin
222
831
  "inline-size": "100%",
223
832
  "border-radius": "0"
224
833
  },
225
- "aria-expanded": _.value,
834
+ "aria-expanded": m.value,
226
835
  disabled: c.output === void 0,
227
- onClick: s[0] ||= (e) => _.value = !_.value
836
+ onClick: o[0] ||= (e) => m.value = !m.value
228
837
  }, [
229
- c.running ? (d(), i("span", {
838
+ c.running ? (f(), i("span", {
230
839
  key: 0,
231
840
  class: "kvc-spin",
232
- "aria-label": g(l).t("kvcoder.ui.running")
233
- }, null, 8, z)) : (d(), n(m(_.value ? g(O) : g(k)), {
841
+ "aria-label": v(l).t("kvcoder.ui.running")
842
+ }, null, 8, wt)) : (f(), n(g(m.value ? v(E) : v(D)), {
234
843
  key: 1,
235
844
  size: 16,
236
845
  "aria-hidden": "true"
237
846
  })),
238
- a("span", B, [c.description ? (d(), i("span", V, h(c.description), 1)) : c.line ? (d(), i("span", H, [a("span", U, h(g(j)(c.line)), 1)])) : r("v-if", !0), c.label ? (d(), i("span", W, h(c.label), 1)) : r("v-if", !0)]),
239
- c.background ? (d(), i("span", G, h(g(l).t("kvcoder.ui.jobs.background")), 1)) : r("v-if", !0),
240
- c.failed ? (d(), i("span", K, h(g(l).t("kvcoder.ui.callFailed")), 1)) : r("v-if", !0),
241
- a("span", q, h(y.value), 1)
242
- ], 8, R), _.value && c.output !== void 0 ? (d(), i(e, { key: 0 }, [
243
- b.value === "" ? r("v-if", !0) : (d(), i("p", J, h(b.value), 1)),
244
- x.value === void 0 ? r("v-if", !0) : (d(), i("pre", {
847
+ a("span", Tt, [c.view.description ? (f(), i("span", Et, _(c.view.description), 1)) : c.view.connector === void 0 && c.view.line ? (f(), i("span", Dt, [a("span", Ot, _(v(H)(c.view.line)), 1)])) : r("v-if", !0), s(St, {
848
+ view: c.view,
849
+ result: h.value
850
+ }, null, 8, ["view", "result"])]),
851
+ c.view.risky ? (f(), i("span", kt, _(v(l).t("kvcoder.ui.call.risky")), 1)) : r("v-if", !0),
852
+ c.view.background ? (f(), i("span", At, _(v(l).t("kvcoder.ui.jobs.background")), 1)) : r("v-if", !0),
853
+ c.failed ? (f(), i("span", jt, _(v(l).t("kvcoder.ui.callFailed")), 1)) : r("v-if", !0),
854
+ a("span", Mt, _(b.value), 1)
855
+ ], 8, Ct), m.value && c.output !== void 0 ? (f(), i(e, { key: 0 }, [
856
+ x.value === "" ? r("v-if", !0) : (f(), i("p", Nt, _(x.value), 1)),
857
+ y.value ? (f(), i("pre", {
245
858
  key: 1,
246
- class: "kvc-output kvc-mono",
247
- dir: "ltr",
248
- "aria-label": g(l).t("kvcoder.ui.command"),
249
- "data-test": "call-payload"
250
- }, h(x.value), 9, Y)),
251
- c.output === "" ? r("v-if", !0) : (d(), i("pre", {
252
- key: 2,
253
- class: "kvc-output",
859
+ class: "kvc-block kvc-error",
254
860
  dir: "auto",
255
- "aria-label": g(l).t("kvcoder.ui.output"),
256
- "data-test": "call-output"
257
- }, [(d(!0), i(e, null, p(v.value, (t, n) => (d(), i(e, { key: n }, [t.kind === "link" ? (d(), i("a", {
258
- key: 0,
259
- href: t.href,
260
- target: "_blank",
261
- rel: "noopener noreferrer",
262
- class: "kvc-link"
263
- }, h(t.href), 9, Z)) : (d(), i(e, { key: 1 }, [o(h(t.text), 1)], 64))], 64))), 128))], 8, X))
861
+ "aria-label": v(l).t("kvcoder.ui.call.error"),
862
+ "data-test": "call-error"
863
+ }, [s(Z, { text: c.output }, null, 8, ["text"])], 8, Pt)) : r("v-if", !0),
864
+ s(Qe, { view: c.view }, null, 8, ["view"]),
865
+ y.value ? r("v-if", !0) : (f(), n(gt, {
866
+ key: 2,
867
+ view: c.view,
868
+ output: c.output,
869
+ result: h.value
870
+ }, null, 8, [
871
+ "view",
872
+ "output",
873
+ "result"
874
+ ]))
264
875
  ], 64)) : r("v-if", !0)], 2));
265
876
  }
266
- }), $ = /* @__PURE__ */ s({
877
+ }), It = /* @__PURE__ */ c({
267
878
  __name: "call",
268
879
  props: {
269
880
  description: {},
270
- label: {},
271
- line: {},
881
+ connector: {},
882
+ command: {},
272
883
  payload: {},
884
+ line: {},
273
885
  failed: { type: Boolean },
274
886
  durationMs: {},
275
887
  output: {}
276
888
  },
277
889
  setup(e) {
278
- let t = e;
279
- return (e, r) => (d(), n(Q, {
280
- description: t.description,
281
- label: t.label,
282
- line: t.line,
283
- payload: t.payload,
284
- failed: t.failed,
285
- "duration-ms": t.durationMs,
286
- output: t.output
890
+ let r = e, i = t(() => r.connector === void 0 ? {
891
+ ...r.description === void 0 ? {} : { description: r.description },
892
+ ...r.line === void 0 ? {} : { line: r.line }
893
+ } : Se({
894
+ description: r.description,
895
+ connector: r.connector,
896
+ command: r.command,
897
+ payload: r.payload ?? {}
898
+ }));
899
+ return (e, t) => (f(), n(Ft, {
900
+ view: i.value,
901
+ failed: r.failed,
902
+ "duration-ms": r.durationMs,
903
+ output: r.output
287
904
  }, null, 8, [
288
- "description",
289
- "label",
290
- "line",
291
- "payload",
905
+ "view",
292
906
  "failed",
293
907
  "duration-ms",
294
908
  "output"
@@ -296,4 +910,4 @@ var R = ["aria-expanded", "disabled"], z = ["aria-label"], B = { class: "kvc-lin
296
910
  }
297
911
  });
298
912
  //#endregion
299
- export { $ as default };
913
+ export { It as default };