@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.
- package/dist/connectors/builtin-connectors.d.ts +1 -0
- package/dist/connectors/builtin-connectors.d.ts.map +1 -1
- package/dist/connectors/delegate.d.ts +7 -2
- package/dist/connectors/delegate.d.ts.map +1 -1
- package/dist/connectors/delegate.js +5 -4
- package/dist/connectors/delegate.js.map +1 -1
- package/dist/files/edit-text.d.ts.map +1 -1
- package/dist/files/edit-text.js +7 -5
- package/dist/files/edit-text.js.map +1 -1
- package/dist/jobs/job-rows.js +1 -1
- package/dist/jobs/job-rows.js.map +1 -1
- package/dist/turns/call-groups.d.ts +9 -0
- package/dist/turns/call-groups.d.ts.map +1 -0
- package/dist/turns/call-groups.js +18 -0
- package/dist/turns/call-groups.js.map +1 -0
- package/dist/turns/compaction.d.ts.map +1 -1
- package/dist/turns/compaction.js +4 -2
- package/dist/turns/compaction.js.map +1 -1
- package/dist/turns/model-context.d.ts.map +1 -1
- package/dist/turns/model-context.js +6 -1
- package/dist/turns/model-context.js.map +1 -1
- package/dist/turns/run-calls.js +1 -1
- package/dist/turns/run-calls.js.map +1 -1
- package/dist/web/components/call.css +1 -1
- package/dist/web/components/call.js +745 -131
- package/dist/web/components/connectors.css +1 -1
- package/dist/web/components/conversation.css +1 -1
- package/dist/web/components/conversation.js +1625 -998
- package/dist/web/components/mcp-sign-in.css +1 -1
- package/dist/web/components/model.css +1 -1
- package/dist/web/components/question.css +1 -1
- package/dist/web/components/sessions.css +1 -1
- package/locales/ar.json +38 -2
- package/locales/en.json +38 -2
- 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, createVNode as s, defineComponent as c, h as l, inject as u, nextTick as d, normalizeClass as f, onBeforeUnmount as p, onMounted as m, onUnmounted as h, openBlock as g, reactive as _, ref as v, renderList as y, renderSlot as b,
|
|
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, nextTick as d, normalizeClass as f, onBeforeUnmount as p, onMounted as m, onUnmounted as h, openBlock as g, reactive as _, ref as v, renderList as y, renderSlot as b, resolveComponent as x, resolveDynamicComponent as S, shallowReactive as C, shallowRef as w, toDisplayString as T, unref as E, useTemplateRef as D, vModelText as O, watch as k, withCtx as A, withDirectives as j, withKeys as M, withModifiers as N } 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 P = {
|
|
4
4
|
xmlns: "http://www.w3.org/2000/svg",
|
|
5
5
|
width: 24,
|
|
6
6
|
height: 24,
|
|
@@ -10,25 +10,25 @@ var N = {
|
|
|
10
10
|
"stroke-width": 2,
|
|
11
11
|
"stroke-linecap": "round",
|
|
12
12
|
"stroke-linejoin": "round"
|
|
13
|
-
},
|
|
13
|
+
}, F = (...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
|
|
16
|
+
function I(e) {
|
|
17
17
|
return e != null;
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
let n = t.attributeNames ?? {}, r = (e) => n[e] ?? e, i = e.size ?? e.width ??
|
|
19
|
+
function L(e, t = {}) {
|
|
20
|
+
let n = t.attributeNames ?? {}, r = (e) => n[e] ?? e, i = e.size ?? e.width ?? P.width, a = e.size ?? e.height ?? P.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 ? F(...c) : F("lucide", ...s, ...c), u = t.absoluteStrokeWidth ? Number(t.strokeWidth ?? P["stroke-width"]) * Number(e.size ?? e.width ?? P.width) / Number(t.size ?? t.width ?? P.width) : t.strokeWidth ?? P["stroke-width"];
|
|
21
21
|
return [
|
|
22
22
|
"svg",
|
|
23
23
|
{
|
|
24
|
-
...Object.entries(
|
|
24
|
+
...Object.entries(P).reduce((e, [t, n]) => (e[r(t)] = n, e), {}),
|
|
25
25
|
..."color" in t && t.color && { [r("stroke")]: t.color },
|
|
26
|
-
..."size" in t &&
|
|
26
|
+
..."size" in t && I(t.size) && {
|
|
27
27
|
[r("width")]: t.size,
|
|
28
28
|
[r("height")]: t.size
|
|
29
29
|
},
|
|
30
|
-
..."width" in t &&
|
|
31
|
-
..."height" in t &&
|
|
30
|
+
..."width" in t && I(t.width) && { [r("width")]: t.width },
|
|
31
|
+
..."height" in t && I(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 I(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
|
|
53
|
+
var R = (e) => {
|
|
54
54
|
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
|
55
55
|
return !1;
|
|
56
|
-
},
|
|
57
|
-
function
|
|
58
|
-
return u(
|
|
56
|
+
}, z = (e) => e === "", B = (e) => e?.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), V = /* @__PURE__ */ Symbol("lucide-icons");
|
|
57
|
+
function ee() {
|
|
58
|
+
return u(V, {});
|
|
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
|
|
63
|
-
name: e &&
|
|
62
|
+
var te = ({ name: e, iconNode: t, "icon-node": n, icon: r = {
|
|
63
|
+
name: e && B(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 = "" } =
|
|
68
|
+
let { size: _, color: v, strokeWidth: y = 2, absoluteStrokeWidth: b = !1, nonScalingStroke: x = !1, class: S = "" } = ee(), C = z(i) || z(a) || i === !0 || a === !0 || b === !0, w = z(o) || z(s) || o === !0 || s === !0 || x === !0;
|
|
69
69
|
delete h.class;
|
|
70
|
-
let T = g.default?.(), [, E, D = []] =
|
|
70
|
+
let T = g.default?.(), [, E, D = []] = L(r, {
|
|
71
71
|
color: m ?? v,
|
|
72
72
|
width: f ?? d ?? _,
|
|
73
73
|
height: p ?? d ?? _,
|
|
@@ -75,24 +75,24 @@ var H = ({ 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 ||
|
|
78
|
+
hasA11yProp: T != null && T.length > 0 || R(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
|
|
85
|
+
function H(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(
|
|
90
|
+
return (e, { slots: t }) => l(te, {
|
|
91
91
|
...e,
|
|
92
92
|
icon: n
|
|
93
93
|
}, t.default ? { default: t.default } : void 0);
|
|
94
94
|
}
|
|
95
|
-
var
|
|
95
|
+
var ne = H({
|
|
96
96
|
name: "arrow-down",
|
|
97
97
|
size: 24,
|
|
98
98
|
node: [["path", {
|
|
@@ -102,7 +102,7 @@ var ee = U({
|
|
|
102
102
|
d: "m19 12-7 7-7-7",
|
|
103
103
|
key: "1idqje"
|
|
104
104
|
}]]
|
|
105
|
-
}),
|
|
105
|
+
}), U = H({
|
|
106
106
|
name: "arrow-left",
|
|
107
107
|
size: 24,
|
|
108
108
|
node: [["path", {
|
|
@@ -112,7 +112,7 @@ var ee = U({
|
|
|
112
112
|
d: "M19 12H5",
|
|
113
113
|
key: "x3x0zl"
|
|
114
114
|
}]]
|
|
115
|
-
}),
|
|
115
|
+
}), re = H({
|
|
116
116
|
name: "arrow-up",
|
|
117
117
|
size: 24,
|
|
118
118
|
node: [["path", {
|
|
@@ -122,7 +122,7 @@ var ee = U({
|
|
|
122
122
|
d: "M12 19V5",
|
|
123
123
|
key: "x0mq9r"
|
|
124
124
|
}]]
|
|
125
|
-
}),
|
|
125
|
+
}), ie = H({
|
|
126
126
|
name: "bell-ring",
|
|
127
127
|
size: 24,
|
|
128
128
|
node: [
|
|
@@ -143,7 +143,7 @@ var ee = U({
|
|
|
143
143
|
key: "tap9e0"
|
|
144
144
|
}]
|
|
145
145
|
]
|
|
146
|
-
}),
|
|
146
|
+
}), W = H({
|
|
147
147
|
name: "bot",
|
|
148
148
|
size: 24,
|
|
149
149
|
node: [
|
|
@@ -176,28 +176,28 @@ var ee = U({
|
|
|
176
176
|
key: "rq6x2g"
|
|
177
177
|
}]
|
|
178
178
|
]
|
|
179
|
-
}),
|
|
179
|
+
}), ae = H({
|
|
180
180
|
name: "check",
|
|
181
181
|
size: 24,
|
|
182
182
|
node: [["path", {
|
|
183
183
|
d: "M20 6 9 17l-5-5",
|
|
184
184
|
key: "1gmf2c"
|
|
185
185
|
}]]
|
|
186
|
-
}),
|
|
186
|
+
}), oe = H({
|
|
187
187
|
name: "chevron-down",
|
|
188
188
|
size: 24,
|
|
189
189
|
node: [["path", {
|
|
190
190
|
d: "m6 9 6 6 6-6",
|
|
191
191
|
key: "qrunsl"
|
|
192
192
|
}]]
|
|
193
|
-
}),
|
|
193
|
+
}), se = H({
|
|
194
194
|
name: "chevron-right",
|
|
195
195
|
size: 24,
|
|
196
196
|
node: [["path", {
|
|
197
197
|
d: "m9 18 6-6-6-6",
|
|
198
198
|
key: "mthhwq"
|
|
199
199
|
}]]
|
|
200
|
-
}),
|
|
200
|
+
}), ce = H({
|
|
201
201
|
name: "circle-check",
|
|
202
202
|
size: 24,
|
|
203
203
|
node: [["circle", {
|
|
@@ -210,7 +210,7 @@ var ee = U({
|
|
|
210
210
|
key: "xofnsj"
|
|
211
211
|
}]],
|
|
212
212
|
aliases: ["check-circle-2"]
|
|
213
|
-
}),
|
|
213
|
+
}), le = H({
|
|
214
214
|
name: "circle-question-mark",
|
|
215
215
|
size: 24,
|
|
216
216
|
node: [
|
|
@@ -230,7 +230,7 @@ var ee = U({
|
|
|
230
230
|
}]
|
|
231
231
|
],
|
|
232
232
|
aliases: ["help-circle", "circle-help"]
|
|
233
|
-
}),
|
|
233
|
+
}), ue = H({
|
|
234
234
|
name: "code",
|
|
235
235
|
size: 24,
|
|
236
236
|
node: [["path", {
|
|
@@ -240,7 +240,7 @@ var ee = U({
|
|
|
240
240
|
d: "m8 6-6 6 6 6",
|
|
241
241
|
key: "ppft3o"
|
|
242
242
|
}]]
|
|
243
|
-
}),
|
|
243
|
+
}), de = H({
|
|
244
244
|
name: "copy",
|
|
245
245
|
size: 24,
|
|
246
246
|
node: [["rect", {
|
|
@@ -255,7 +255,7 @@ var ee = U({
|
|
|
255
255
|
d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",
|
|
256
256
|
key: "zix9uf"
|
|
257
257
|
}]]
|
|
258
|
-
}),
|
|
258
|
+
}), fe = H({
|
|
259
259
|
name: "ellipsis",
|
|
260
260
|
size: 24,
|
|
261
261
|
node: [
|
|
@@ -279,7 +279,7 @@ var ee = U({
|
|
|
279
279
|
}]
|
|
280
280
|
],
|
|
281
281
|
aliases: ["more-horizontal"]
|
|
282
|
-
}),
|
|
282
|
+
}), pe = H({
|
|
283
283
|
name: "external-link",
|
|
284
284
|
size: 24,
|
|
285
285
|
node: [
|
|
@@ -296,7 +296,7 @@ var ee = U({
|
|
|
296
296
|
key: "a6xqqp"
|
|
297
297
|
}]
|
|
298
298
|
]
|
|
299
|
-
}),
|
|
299
|
+
}), me = H({
|
|
300
300
|
name: "eye",
|
|
301
301
|
size: 24,
|
|
302
302
|
node: [["path", {
|
|
@@ -308,7 +308,24 @@ var ee = U({
|
|
|
308
308
|
r: "3",
|
|
309
309
|
key: "1v7zrd"
|
|
310
310
|
}]]
|
|
311
|
-
}),
|
|
311
|
+
}), he = H({
|
|
312
|
+
name: "file",
|
|
313
|
+
size: 24,
|
|
314
|
+
node: [["path", {
|
|
315
|
+
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",
|
|
316
|
+
key: "1oefj6"
|
|
317
|
+
}], ["path", {
|
|
318
|
+
d: "M14 2v5a1 1 0 0 0 1 1h5",
|
|
319
|
+
key: "wfsgrz"
|
|
320
|
+
}]]
|
|
321
|
+
}), ge = H({
|
|
322
|
+
name: "folder",
|
|
323
|
+
size: 24,
|
|
324
|
+
node: [["path", {
|
|
325
|
+
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",
|
|
326
|
+
key: "1kt360"
|
|
327
|
+
}]]
|
|
328
|
+
}), _e = H({
|
|
312
329
|
name: "info",
|
|
313
330
|
size: 24,
|
|
314
331
|
node: [
|
|
@@ -327,7 +344,7 @@ var ee = U({
|
|
|
327
344
|
key: "e9boi3"
|
|
328
345
|
}]
|
|
329
346
|
]
|
|
330
|
-
}),
|
|
347
|
+
}), ve = H({
|
|
331
348
|
name: "notebook-text",
|
|
332
349
|
size: 24,
|
|
333
350
|
node: [
|
|
@@ -368,7 +385,7 @@ var ee = U({
|
|
|
368
385
|
key: "p1seyn"
|
|
369
386
|
}]
|
|
370
387
|
]
|
|
371
|
-
}),
|
|
388
|
+
}), ye = H({
|
|
372
389
|
name: "panel-right",
|
|
373
390
|
size: 24,
|
|
374
391
|
node: [["rect", {
|
|
@@ -382,14 +399,14 @@ var ee = U({
|
|
|
382
399
|
d: "M15 3v18",
|
|
383
400
|
key: "14nvp0"
|
|
384
401
|
}]]
|
|
385
|
-
}),
|
|
402
|
+
}), be = H({
|
|
386
403
|
name: "paperclip",
|
|
387
404
|
size: 24,
|
|
388
405
|
node: [["path", {
|
|
389
406
|
d: "m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",
|
|
390
407
|
key: "1miecu"
|
|
391
408
|
}]]
|
|
392
|
-
}),
|
|
409
|
+
}), xe = H({
|
|
393
410
|
name: "rotate-cw",
|
|
394
411
|
size: 24,
|
|
395
412
|
node: [["path", {
|
|
@@ -399,7 +416,7 @@ var ee = U({
|
|
|
399
416
|
d: "M21 3v5h-5",
|
|
400
417
|
key: "1q7to0"
|
|
401
418
|
}]]
|
|
402
|
-
}),
|
|
419
|
+
}), Se = H({
|
|
403
420
|
name: "scroll-text",
|
|
404
421
|
size: 24,
|
|
405
422
|
node: [
|
|
@@ -420,7 +437,7 @@ var ee = U({
|
|
|
420
437
|
key: "1ph1d7"
|
|
421
438
|
}]
|
|
422
439
|
]
|
|
423
|
-
}),
|
|
440
|
+
}), Ce = H({
|
|
424
441
|
name: "search",
|
|
425
442
|
size: 24,
|
|
426
443
|
node: [["path", {
|
|
@@ -432,7 +449,7 @@ var ee = U({
|
|
|
432
449
|
r: "8",
|
|
433
450
|
key: "4ej97u"
|
|
434
451
|
}]]
|
|
435
|
-
}),
|
|
452
|
+
}), we = H({
|
|
436
453
|
name: "shield-alert",
|
|
437
454
|
size: 24,
|
|
438
455
|
node: [
|
|
@@ -449,7 +466,7 @@ var ee = U({
|
|
|
449
466
|
key: "1drbdi"
|
|
450
467
|
}]
|
|
451
468
|
]
|
|
452
|
-
}),
|
|
469
|
+
}), Te = H({
|
|
453
470
|
name: "square",
|
|
454
471
|
size: 24,
|
|
455
472
|
node: [["rect", {
|
|
@@ -460,7 +477,7 @@ var ee = U({
|
|
|
460
477
|
rx: "2",
|
|
461
478
|
key: "afitv7"
|
|
462
479
|
}]]
|
|
463
|
-
}),
|
|
480
|
+
}), Ee = H({
|
|
464
481
|
name: "x",
|
|
465
482
|
size: 24,
|
|
466
483
|
node: [["path", {
|
|
@@ -470,25 +487,25 @@ var ee = U({
|
|
|
470
487
|
d: "m6 6 12 12",
|
|
471
488
|
key: "d8bk6v"
|
|
472
489
|
}]]
|
|
473
|
-
}),
|
|
474
|
-
function
|
|
475
|
-
let t =
|
|
476
|
-
return t === void 0 ?
|
|
490
|
+
}), De = "<meta http-equiv=\"Content-Security-Policy\" content=\"default-src 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline'; img-src data:; font-src data:; media-src data:; form-action 'none'; base-uri 'none'\">", Oe = /^\s*<!doctype[^>]*>/i;
|
|
491
|
+
function ke(e) {
|
|
492
|
+
let t = Oe.exec(e)?.[0];
|
|
493
|
+
return t === void 0 ? De + e : t + De + e.slice(t.length);
|
|
477
494
|
}
|
|
478
|
-
var
|
|
479
|
-
function
|
|
480
|
-
return `<!doctype html>${
|
|
495
|
+
var Ae = (e) => e.replaceAll("&", "&").replaceAll("\"", """), je = "html,body{margin:0;block-size:100%}iframe{display:block;border:0;inline-size:100%;block-size:100%}";
|
|
496
|
+
function Me(e) {
|
|
497
|
+
return `<!doctype html>${De}<style>${je}</style><iframe sandbox="allow-scripts" referrerpolicy="no-referrer" srcdoc="${Ae(ke(e))}"></iframe>`;
|
|
481
498
|
}
|
|
482
499
|
//#endregion
|
|
483
500
|
//#region web/src/ArtifactFrame.vue?vue&type=script&setup=true&lang.ts
|
|
484
|
-
var
|
|
501
|
+
var Ne = ["title", "srcdoc"], Pe = /* @__PURE__ */ c({
|
|
485
502
|
__name: "ArtifactFrame",
|
|
486
503
|
props: {
|
|
487
504
|
label: {},
|
|
488
505
|
content: {}
|
|
489
506
|
},
|
|
490
507
|
setup(e) {
|
|
491
|
-
let n = e, r = t(() =>
|
|
508
|
+
let n = e, r = t(() => Me(n.content));
|
|
492
509
|
return (e, t) => (g(), i("iframe", {
|
|
493
510
|
class: "kvc-artifact-frame",
|
|
494
511
|
sandbox: "allow-scripts",
|
|
@@ -496,63 +513,63 @@ var De = ["title", "srcdoc"], Oe = /* @__PURE__ */ c({
|
|
|
496
513
|
title: n.label,
|
|
497
514
|
srcdoc: r.value,
|
|
498
515
|
"data-test": "artifact-frame"
|
|
499
|
-
}, null, 8,
|
|
516
|
+
}, null, 8, Ne));
|
|
500
517
|
}
|
|
501
|
-
}),
|
|
518
|
+
}), Fe = /* @__PURE__ */ new Set(["localhost", "127.0.0.1"]), Ie = {
|
|
502
519
|
"http:": "80",
|
|
503
520
|
"https:": "443"
|
|
504
|
-
},
|
|
505
|
-
function
|
|
521
|
+
}, Le = (e) => e.port === "" ? Ie[e.protocol] ?? "" : e.port;
|
|
522
|
+
function Re(e, t) {
|
|
506
523
|
let n = e.trim();
|
|
507
524
|
if (n === "" || /\s/.test(n) || !URL.canParse(n)) return;
|
|
508
525
|
let r = new URL(n);
|
|
509
|
-
if ((r.protocol === "http:" || r.protocol === "https:") &&
|
|
526
|
+
if ((r.protocol === "http:" || r.protocol === "https:") && Fe.has(r.hostname) && r.username === "" && r.password === "") return Le(r) === Le(t) ? void 0 : r.href;
|
|
510
527
|
}
|
|
511
528
|
//#endregion
|
|
512
529
|
//#region web/src/kvman.ts
|
|
513
|
-
function
|
|
530
|
+
function G() {
|
|
514
531
|
let e = u("kvman");
|
|
515
532
|
if (e === void 0) throw Error("kvcoder components run inside kvwebui, which provides kvman.");
|
|
516
533
|
return e;
|
|
517
534
|
}
|
|
518
|
-
var
|
|
519
|
-
function
|
|
535
|
+
var ze = () => document.documentElement.lang === "" ? void 0 : document.documentElement.lang;
|
|
536
|
+
function K(e) {
|
|
520
537
|
return typeof e == "object" && e && !Array.isArray(e) ? Object.fromEntries(Object.entries(e)) : {};
|
|
521
538
|
}
|
|
522
|
-
function
|
|
539
|
+
function Be(e, t) {
|
|
523
540
|
return t === "" ? e("kvcoder.ui.newChat") : t;
|
|
524
541
|
}
|
|
525
|
-
function
|
|
542
|
+
function Ve(e) {
|
|
526
543
|
let t = e.indexOf("/");
|
|
527
544
|
return t < 0 ? `kernel.errors.${e}` : `${e.slice(0, t)}.errors.${e.slice(t + 1)}`;
|
|
528
545
|
}
|
|
529
|
-
function
|
|
546
|
+
function He(e) {
|
|
530
547
|
if (!(e instanceof Error) || !("problem" in e)) return;
|
|
531
548
|
let t = e.problem;
|
|
532
549
|
if (typeof t == "object" && t && "code" in t && typeof t.code == "string") return {
|
|
533
550
|
code: t.code,
|
|
534
|
-
params:
|
|
551
|
+
params: Ue("params" in t ? t.params : void 0)
|
|
535
552
|
};
|
|
536
553
|
}
|
|
537
|
-
function
|
|
538
|
-
return Object.fromEntries(Object.entries(
|
|
554
|
+
function Ue(e) {
|
|
555
|
+
return Object.fromEntries(Object.entries(K(e)).map(([e, t]) => [e, typeof t == "string" ? t : JSON.stringify(t)]));
|
|
539
556
|
}
|
|
540
|
-
var
|
|
541
|
-
function
|
|
542
|
-
let t =
|
|
557
|
+
var We = 200, Ge = /^(\d{3}:)?\s*\{.*?"message"\s*:\s*"((?:[^"\\]|\\.)*)"/s;
|
|
558
|
+
function Ke(e) {
|
|
559
|
+
let t = Ge.exec(e);
|
|
543
560
|
return t?.[2] === void 0 ? e : `${t[1] === void 0 ? "" : `${t[1]} `}${t[2].replaceAll("\\\"", "\"")}`;
|
|
544
561
|
}
|
|
545
|
-
function
|
|
546
|
-
let { reason: t } =
|
|
562
|
+
function qe(e) {
|
|
563
|
+
let { reason: t } = K(e);
|
|
547
564
|
if (typeof t != "string" || t.trim() === "") return;
|
|
548
|
-
let n =
|
|
549
|
-
return n.length >
|
|
565
|
+
let n = Ke(t);
|
|
566
|
+
return n.length > We ? `${n.slice(0, We)}…` : n;
|
|
550
567
|
}
|
|
551
|
-
function
|
|
552
|
-
let n =
|
|
553
|
-
e.toast(n === void 0 ? "kvcoder.ui.failed" :
|
|
568
|
+
function q(e, t) {
|
|
569
|
+
let n = He(t);
|
|
570
|
+
e.toast(n === void 0 ? "kvcoder.ui.failed" : Ve(n.code), n?.params ?? {}, "error");
|
|
554
571
|
}
|
|
555
|
-
var
|
|
572
|
+
var Je = /* @__PURE__ */ new Set([
|
|
556
573
|
"Arab",
|
|
557
574
|
"Hebr",
|
|
558
575
|
"Thaa",
|
|
@@ -560,17 +577,17 @@ var He = /* @__PURE__ */ new Set([
|
|
|
560
577
|
"Nkoo",
|
|
561
578
|
"Adlm"
|
|
562
579
|
]);
|
|
563
|
-
function
|
|
580
|
+
function Ye(e) {
|
|
564
581
|
let t = e === void 0 ? void 0 : new Intl.Locale(e).maximize().script;
|
|
565
|
-
return t !== void 0 &&
|
|
582
|
+
return t !== void 0 && Je.has(t);
|
|
566
583
|
}
|
|
567
|
-
var
|
|
568
|
-
function
|
|
569
|
-
let t =
|
|
584
|
+
var Xe = (e, t) => Ye(t) ? `\u2066${e}\u2069` : e, Ze = (e) => Ye(ze()) ? `\u2068${e}\u2069` : e;
|
|
585
|
+
function Qe(e) {
|
|
586
|
+
let t = ze(), n = {
|
|
570
587
|
style: "currency",
|
|
571
588
|
currency: "USD"
|
|
572
589
|
};
|
|
573
|
-
return
|
|
590
|
+
return Xe(e === 0 || e >= .01 ? new Intl.NumberFormat(t, n).format(e) : new Intl.NumberFormat(t, e < 1e-4 ? {
|
|
574
591
|
...n,
|
|
575
592
|
maximumSignificantDigits: 1
|
|
576
593
|
} : {
|
|
@@ -578,45 +595,46 @@ function Ke(e) {
|
|
|
578
595
|
minimumFractionDigits: 4
|
|
579
596
|
}).format(e), t);
|
|
580
597
|
}
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
598
|
+
var $e = (e) => new Intl.NumberFormat(ze(), {
|
|
599
|
+
notation: "compact",
|
|
600
|
+
maximumFractionDigits: 1
|
|
601
|
+
}).format(e);
|
|
602
|
+
function et(e, t, n) {
|
|
603
|
+
let r = Math.round(n / 1e3);
|
|
586
604
|
return e("kvcoder.ui.totals", {
|
|
587
|
-
time:
|
|
588
|
-
|
|
589
|
-
cost: i
|
|
605
|
+
time: r < 60 ? e("kvcoder.ui.seconds", { count: r }) : e("kvcoder.ui.minutes", { count: Math.round(r / 60) }),
|
|
606
|
+
cost: Qe(t.cost)
|
|
590
607
|
});
|
|
591
608
|
}
|
|
592
|
-
function
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
609
|
+
function tt(e, t) {
|
|
610
|
+
return e("kvcoder.ui.tokensUsed", { tokens: $e(t.input + t.output) });
|
|
611
|
+
}
|
|
612
|
+
function nt(e, t) {
|
|
613
|
+
if (t !== null && t.window !== null) return {
|
|
614
|
+
short: e("kvcoder.ui.memory", { percent: Math.round(t.tokens / t.window * 100) }),
|
|
615
|
+
full: e("kvcoder.ui.memoryDetail", {
|
|
616
|
+
tokens: $e(t.tokens),
|
|
617
|
+
window: $e(t.window),
|
|
618
|
+
at: Math.round(t.compactAt * 100)
|
|
619
|
+
})
|
|
620
|
+
};
|
|
603
621
|
}
|
|
604
622
|
//#endregion
|
|
605
623
|
//#region web/src/ArtifactUrlFrame.vue?vue&type=script&setup=true&lang.ts
|
|
606
|
-
var
|
|
624
|
+
var rt = ["title", "src"], it = {
|
|
607
625
|
key: 1,
|
|
608
626
|
class: "kvc-muted",
|
|
609
627
|
role: "alert",
|
|
610
628
|
"data-test": "artifact-url-refused"
|
|
611
|
-
},
|
|
629
|
+
}, at = /* @__PURE__ */ c({
|
|
612
630
|
__name: "ArtifactUrlFrame",
|
|
613
631
|
props: {
|
|
614
632
|
label: {},
|
|
615
633
|
content: {}
|
|
616
634
|
},
|
|
617
635
|
setup(e) {
|
|
618
|
-
let n = e, r =
|
|
619
|
-
return (e, t) => a.value === void 0 ? (g(), i("p",
|
|
636
|
+
let n = e, r = G(), a = t(() => Re(n.content, window.location));
|
|
637
|
+
return (e, t) => a.value === void 0 ? (g(), i("p", it, T(E(r).t("kvcoder.ui.artifacts.urlRefused")), 1)) : (g(), i("iframe", {
|
|
620
638
|
key: 0,
|
|
621
639
|
class: "kvc-artifact-frame",
|
|
622
640
|
sandbox: "allow-scripts allow-same-origin allow-forms allow-popups allow-modals allow-downloads",
|
|
@@ -624,48 +642,45 @@ var Ye = ["title", "src"], Xe = {
|
|
|
624
642
|
title: n.label,
|
|
625
643
|
src: a.value,
|
|
626
644
|
"data-test": "artifact-url-frame"
|
|
627
|
-
}, null, 8,
|
|
645
|
+
}, null, 8, rt));
|
|
628
646
|
}
|
|
629
|
-
}),
|
|
630
|
-
key: 0,
|
|
631
|
-
role: "tablist",
|
|
632
|
-
class: "kvc-artifact-tabs"
|
|
633
|
-
}, nt = [
|
|
647
|
+
}), ot = ["aria-label"], st = { class: "kvc-artifact-head" }, ct = { class: "kvc-artifact-name" }, lt = [
|
|
634
648
|
"aria-selected",
|
|
649
|
+
"title",
|
|
635
650
|
"data-test",
|
|
636
651
|
"onClick"
|
|
637
|
-
],
|
|
652
|
+
], ut = {
|
|
638
653
|
key: 1,
|
|
639
654
|
class: "kvc-artifact-title kvc-oneline",
|
|
640
655
|
"data-test": "artifact-title"
|
|
641
|
-
},
|
|
656
|
+
}, dt = {
|
|
642
657
|
class: "kvc-muted",
|
|
643
658
|
"data-test": "artifact-meta"
|
|
644
|
-
},
|
|
659
|
+
}, ft = { "data-test": "artifact-format" }, pt = { "data-test": "artifact-version" }, mt = { class: "kvc-artifact-actions" }, ht = ["aria-label"], gt = [
|
|
645
660
|
"aria-pressed",
|
|
646
661
|
"aria-label",
|
|
647
662
|
"title"
|
|
648
|
-
],
|
|
663
|
+
], _t = { class: "kvc-tab-text" }, vt = [
|
|
649
664
|
"aria-pressed",
|
|
650
665
|
"aria-label",
|
|
651
666
|
"title"
|
|
652
|
-
],
|
|
667
|
+
], yt = { class: "kvc-tab-text" }, bt = [
|
|
653
668
|
"href",
|
|
654
669
|
"aria-label",
|
|
655
670
|
"title"
|
|
656
|
-
],
|
|
671
|
+
], xt = [
|
|
657
672
|
"disabled",
|
|
658
673
|
"aria-label",
|
|
659
674
|
"title"
|
|
660
|
-
],
|
|
675
|
+
], St = ["aria-label", "title"], Ct = {
|
|
661
676
|
class: "kvc-artifact-body",
|
|
662
677
|
"data-test": "artifact-body"
|
|
663
|
-
},
|
|
678
|
+
}, wt = {
|
|
664
679
|
key: 0,
|
|
665
680
|
class: "kvc-artifact-source",
|
|
666
681
|
dir: "ltr",
|
|
667
682
|
"data-test": "artifact-source"
|
|
668
|
-
},
|
|
683
|
+
}, Tt = /* @__PURE__ */ c({
|
|
669
684
|
__name: "ArtifactPanel",
|
|
670
685
|
props: {
|
|
671
686
|
list: {},
|
|
@@ -674,116 +689,130 @@ var Ye = ["title", "src"], Xe = {
|
|
|
674
689
|
},
|
|
675
690
|
emits: ["select", "close"],
|
|
676
691
|
setup(c, { emit: l }) {
|
|
677
|
-
let u = c,
|
|
678
|
-
|
|
679
|
-
|
|
692
|
+
let u = c, f = l, p = G(), m = t(() => u.list.find((e) => e.id === u.shown)), h = t(() => u.content?.id === u.shown ? u.content : void 0), _ = t(() => h.value?.title ?? m.value?.title ?? ""), b = t(() => h.value?.version ?? m.value?.version ?? 1), x = t(() => h.value?.format ?? m.value?.format ?? "markdown"), C = t(() => h.value?.content ?? ""), w = t(() => p.t("kvcoder.ui.artifacts.frameLabel", { title: _.value })), O = v("preview");
|
|
693
|
+
k(() => u.shown, () => O.value = "preview");
|
|
694
|
+
let A = D("titles");
|
|
695
|
+
k(() => [u.shown, u.list.length], async () => {
|
|
696
|
+
await d(), A.value?.querySelector("[aria-selected=\"true\"]")?.scrollIntoView({
|
|
697
|
+
block: "nearest",
|
|
698
|
+
inline: "nearest"
|
|
699
|
+
});
|
|
700
|
+
}, { immediate: !0 });
|
|
701
|
+
async function j() {
|
|
680
702
|
try {
|
|
681
|
-
await navigator.clipboard.writeText(
|
|
703
|
+
await navigator.clipboard.writeText(C.value), p.toast("kvcoder.ui.copied", {}, "success");
|
|
682
704
|
} catch (e) {
|
|
683
|
-
|
|
705
|
+
q(p, e);
|
|
684
706
|
}
|
|
685
707
|
}
|
|
686
|
-
let
|
|
708
|
+
let M = t(() => x.value === "url" ? Re(C.value, window.location) : void 0), N = t(() => ({
|
|
687
709
|
type: "markdown",
|
|
688
710
|
text: "kvcoder.markdown",
|
|
689
|
-
params: { text:
|
|
711
|
+
params: { text: C.value }
|
|
690
712
|
}));
|
|
691
713
|
return (t, c) => (g(), i("aside", {
|
|
692
714
|
class: "kvc-artifact-panel",
|
|
693
715
|
"data-test": "artifact-panel",
|
|
694
|
-
"aria-label":
|
|
695
|
-
}, [a("div",
|
|
716
|
+
"aria-label": E(p).t("kvcoder.ui.artifacts.title")
|
|
717
|
+
}, [a("div", st, [a("div", ct, [u.list.length > 1 ? (g(), i("div", {
|
|
718
|
+
key: 0,
|
|
719
|
+
ref_key: "titles",
|
|
720
|
+
ref: A,
|
|
721
|
+
role: "tablist",
|
|
722
|
+
class: "kvc-artifact-tabs"
|
|
723
|
+
}, [(g(!0), i(e, null, y(u.list, (e) => (g(), i("button", {
|
|
696
724
|
key: e.id,
|
|
697
725
|
type: "button",
|
|
698
726
|
role: "tab",
|
|
699
727
|
class: "kvc-tab",
|
|
700
728
|
"aria-selected": e.id === u.shown,
|
|
729
|
+
title: e.title,
|
|
701
730
|
"data-test": `artifact-tab-${e.id}`,
|
|
702
|
-
onClick: (t) =>
|
|
703
|
-
},
|
|
704
|
-
a("span",
|
|
731
|
+
onClick: (t) => f("select", e.id)
|
|
732
|
+
}, T(e.title), 9, lt))), 128))], 512)) : (g(), i("span", ut, T(_.value), 1)), a("span", dt, [
|
|
733
|
+
a("span", ft, T(E(p).t(`kvcoder.ui.artifacts.format.${x.value}`)), 1),
|
|
705
734
|
c[3] ||= o(" · ", -1),
|
|
706
|
-
a("span",
|
|
707
|
-
])]), a("div",
|
|
735
|
+
a("span", pt, T(E(p).t("kvcoder.ui.artifacts.version", { version: b.value })), 1)
|
|
736
|
+
])]), a("div", mt, [
|
|
708
737
|
a("div", {
|
|
709
738
|
class: "kvc-tabs",
|
|
710
739
|
role: "group",
|
|
711
|
-
"aria-label":
|
|
740
|
+
"aria-label": E(p).t("kvcoder.ui.artifacts.view")
|
|
712
741
|
}, [a("button", {
|
|
713
742
|
type: "button",
|
|
714
743
|
class: "kvc-tab",
|
|
715
|
-
"aria-pressed":
|
|
716
|
-
"aria-label":
|
|
717
|
-
title:
|
|
744
|
+
"aria-pressed": O.value === "preview",
|
|
745
|
+
"aria-label": E(p).t("kvcoder.ui.artifacts.preview"),
|
|
746
|
+
title: E(p).t("kvcoder.ui.artifacts.preview"),
|
|
718
747
|
"data-test": "artifact-view-preview",
|
|
719
|
-
onClick: c[0] ||= (e) =>
|
|
720
|
-
}, [s(
|
|
748
|
+
onClick: c[0] ||= (e) => O.value = "preview"
|
|
749
|
+
}, [s(E(me), {
|
|
721
750
|
size: 16,
|
|
722
751
|
class: "kvc-tab-icon",
|
|
723
752
|
"aria-hidden": "true"
|
|
724
|
-
}), a("span",
|
|
753
|
+
}), a("span", _t, T(E(p).t("kvcoder.ui.artifacts.preview")), 1)], 8, gt), a("button", {
|
|
725
754
|
type: "button",
|
|
726
755
|
class: "kvc-tab",
|
|
727
|
-
"aria-pressed":
|
|
728
|
-
"aria-label":
|
|
729
|
-
title:
|
|
756
|
+
"aria-pressed": O.value === "source",
|
|
757
|
+
"aria-label": E(p).t("kvcoder.ui.artifacts.source"),
|
|
758
|
+
title: E(p).t("kvcoder.ui.artifacts.source"),
|
|
730
759
|
"data-test": "artifact-view-source",
|
|
731
|
-
onClick: c[1] ||= (e) =>
|
|
732
|
-
}, [s(
|
|
760
|
+
onClick: c[1] ||= (e) => O.value = "source"
|
|
761
|
+
}, [s(E(ue), {
|
|
733
762
|
size: 16,
|
|
734
763
|
class: "kvc-tab-icon",
|
|
735
764
|
"aria-hidden": "true"
|
|
736
|
-
}), a("span",
|
|
737
|
-
|
|
765
|
+
}), a("span", yt, T(E(p).t("kvcoder.ui.artifacts.source")), 1)], 8, vt)], 8, ht),
|
|
766
|
+
M.value === void 0 ? r("v-if", !0) : (g(), i("a", {
|
|
738
767
|
key: 0,
|
|
739
|
-
href:
|
|
768
|
+
href: M.value,
|
|
740
769
|
target: "_blank",
|
|
741
770
|
rel: "noopener noreferrer",
|
|
742
771
|
class: "kvc-button kvc-icon-button",
|
|
743
|
-
"aria-label":
|
|
744
|
-
title:
|
|
772
|
+
"aria-label": E(p).t("kvcoder.ui.artifacts.openUrl"),
|
|
773
|
+
title: E(p).t("kvcoder.ui.artifacts.openUrl"),
|
|
745
774
|
"data-test": "artifact-open-url"
|
|
746
|
-
}, [s(
|
|
775
|
+
}, [s(E(pe), {
|
|
747
776
|
size: 16,
|
|
748
777
|
"aria-hidden": "true"
|
|
749
|
-
})], 8,
|
|
778
|
+
})], 8, bt)),
|
|
750
779
|
a("button", {
|
|
751
780
|
type: "button",
|
|
752
781
|
class: "kvc-button kvc-icon-button",
|
|
753
|
-
disabled:
|
|
754
|
-
"aria-label":
|
|
755
|
-
title:
|
|
782
|
+
disabled: h.value === void 0,
|
|
783
|
+
"aria-label": E(p).t("kvcoder.ui.copy"),
|
|
784
|
+
title: E(p).t("kvcoder.ui.copy"),
|
|
756
785
|
"data-test": "artifact-copy",
|
|
757
|
-
onClick:
|
|
758
|
-
}, [s(
|
|
786
|
+
onClick: j
|
|
787
|
+
}, [s(E(de), {
|
|
759
788
|
size: 16,
|
|
760
789
|
"aria-hidden": "true"
|
|
761
|
-
})], 8,
|
|
790
|
+
})], 8, xt),
|
|
762
791
|
a("button", {
|
|
763
792
|
type: "button",
|
|
764
793
|
class: "kvc-button kvc-icon-button",
|
|
765
|
-
"aria-label":
|
|
766
|
-
title:
|
|
794
|
+
"aria-label": E(p).t("kvcoder.ui.artifacts.close"),
|
|
795
|
+
title: E(p).t("kvcoder.ui.artifacts.close"),
|
|
767
796
|
"data-test": "artifact-close",
|
|
768
|
-
onClick: c[2] ||= (e) =>
|
|
769
|
-
}, [s(
|
|
797
|
+
onClick: c[2] ||= (e) => f("close")
|
|
798
|
+
}, [s(E(Ee), {
|
|
770
799
|
size: 16,
|
|
771
800
|
"aria-hidden": "true"
|
|
772
|
-
})], 8,
|
|
773
|
-
])]), a("div",
|
|
801
|
+
})], 8, St)
|
|
802
|
+
])]), a("div", Ct, [O.value === "source" && h.value !== void 0 ? (g(), i("pre", wt, T(C.value), 1)) : x.value === "markdown" && h.value !== void 0 ? (g(), n(S(E(p).View), {
|
|
774
803
|
key: 1,
|
|
775
|
-
view:
|
|
776
|
-
}, null, 8, ["view"])) :
|
|
804
|
+
view: N.value
|
|
805
|
+
}, null, 8, ["view"])) : x.value === "html" && h.value !== void 0 ? (g(), n(Pe, {
|
|
777
806
|
key: 2,
|
|
778
|
-
label:
|
|
779
|
-
content:
|
|
780
|
-
}, null, 8, ["label", "content"])) :
|
|
807
|
+
label: w.value,
|
|
808
|
+
content: C.value
|
|
809
|
+
}, null, 8, ["label", "content"])) : x.value === "url" && h.value !== void 0 ? (g(), n(at, {
|
|
781
810
|
key: 3,
|
|
782
|
-
label:
|
|
783
|
-
content:
|
|
784
|
-
}, null, 8, ["label", "content"])) : r("v-if", !0)])], 8,
|
|
811
|
+
label: w.value,
|
|
812
|
+
content: C.value
|
|
813
|
+
}, null, 8, ["label", "content"])) : r("v-if", !0)])], 8, ot));
|
|
785
814
|
}
|
|
786
|
-
}),
|
|
815
|
+
}), Et = [
|
|
787
816
|
{ name: "compact" },
|
|
788
817
|
{ name: "export" },
|
|
789
818
|
{ name: "fork" },
|
|
@@ -794,7 +823,7 @@ var Ye = ["title", "src"], Xe = {
|
|
|
794
823
|
argument: !0
|
|
795
824
|
}
|
|
796
825
|
];
|
|
797
|
-
function
|
|
826
|
+
function Dt(e) {
|
|
798
827
|
let t = /^\/(\S*)(\s+(.*))?$/.exec(e);
|
|
799
828
|
if (!(t === null || e.includes("\n"))) return {
|
|
800
829
|
word: t[1] ?? "",
|
|
@@ -802,9 +831,9 @@ function bt(e) {
|
|
|
802
831
|
named: t[2] !== void 0
|
|
803
832
|
};
|
|
804
833
|
}
|
|
805
|
-
function
|
|
834
|
+
function Ot(e, t) {
|
|
806
835
|
let n = (t) => e.named ? t === e.word : t.startsWith(e.word);
|
|
807
|
-
return [...
|
|
836
|
+
return [...Et.filter((e) => n(e.name)).map((e) => ({
|
|
808
837
|
kind: "own",
|
|
809
838
|
command: e
|
|
810
839
|
})), ...t.filter((e) => n(e.name)).map((e) => ({
|
|
@@ -814,36 +843,36 @@ function xt(e, t) {
|
|
|
814
843
|
}
|
|
815
844
|
//#endregion
|
|
816
845
|
//#region web/src/MessageComposer.vue?vue&type=script&setup=true&lang.ts
|
|
817
|
-
var
|
|
846
|
+
var kt = { class: "kvc-composer" }, At = { class: "kvc-box" }, jt = ["aria-label"], Mt = {
|
|
818
847
|
key: 0,
|
|
819
848
|
class: "kvc-muted kvc-none",
|
|
820
849
|
"data-test": "slash-wait"
|
|
821
|
-
},
|
|
850
|
+
}, Nt = [
|
|
822
851
|
"aria-disabled",
|
|
823
852
|
"aria-selected",
|
|
824
853
|
"data-active",
|
|
825
854
|
"data-test",
|
|
826
855
|
"onMousemove",
|
|
827
856
|
"onClick"
|
|
828
|
-
],
|
|
857
|
+
], Pt = { class: "kvc-slash-name" }, Ft = {
|
|
829
858
|
class: "kvc-mono",
|
|
830
859
|
dir: "ltr"
|
|
831
|
-
},
|
|
860
|
+
}, It = { class: "kvc-muted" }, Lt = {
|
|
832
861
|
key: 1,
|
|
833
862
|
class: "kvc-muted kvc-none",
|
|
834
863
|
"data-test": "slash-none"
|
|
835
|
-
},
|
|
864
|
+
}, Rt = {
|
|
836
865
|
key: 1,
|
|
837
866
|
style: {
|
|
838
867
|
display: "flex",
|
|
839
868
|
gap: "6px",
|
|
840
869
|
"flex-wrap": "wrap"
|
|
841
870
|
}
|
|
842
|
-
},
|
|
871
|
+
}, zt = ["aria-label", "onClick"], Bt = ["placeholder", "aria-label"], Vt = { class: "kvc-composer-row" }, Ht = [
|
|
843
872
|
"aria-label",
|
|
844
873
|
"title",
|
|
845
874
|
"disabled"
|
|
846
|
-
],
|
|
875
|
+
], Ut = { class: "kvc-muted kvc-composer-hint" }, Wt = ["aria-label", "disabled"], Gt = /* @__PURE__ */ c({
|
|
847
876
|
__name: "MessageComposer",
|
|
848
877
|
props: {
|
|
849
878
|
running: { type: Boolean },
|
|
@@ -859,8 +888,8 @@ var St = { class: "kvc-composer" }, Ct = { class: "kvc-box" }, wt = ["aria-label
|
|
|
859
888
|
"registered"
|
|
860
889
|
],
|
|
861
890
|
setup(n, { emit: c }) {
|
|
862
|
-
let l = n, u = c, d =
|
|
863
|
-
|
|
891
|
+
let l = n, u = c, d = G(), f = v(""), p = v([]), m = v(null), h = v(!1), _ = v(0), x = v(!1), S = t(() => l.commands === void 0 ? void 0 : Dt(f.value)), C = t(() => l.commands === "wait"), w = t(() => S.value === void 0 ? [] : Ot(S.value, l.registered ?? [])), D = (e) => !C.value || e.kind === "registered", A = t(() => w.value.filter(D)), M = t(() => A.value[_.value]), N = t(() => A.value.length < w.value.length), P = (e) => e.kind === "own" && "argument" in e.command, F = (e) => d.t(e.kind === "own" ? `kvcoder.ui.slash.${e.command.name}` : e.command.description);
|
|
892
|
+
k(f, () => {
|
|
864
893
|
_.value = 0, x.value = !1;
|
|
865
894
|
});
|
|
866
895
|
async function I(e) {
|
|
@@ -905,15 +934,15 @@ var St = { class: "kvc-composer" }, Ct = { class: "kvc-box" }, wt = ["aria-label
|
|
|
905
934
|
}), f.value = "", p.value = []);
|
|
906
935
|
}
|
|
907
936
|
function V(e) {
|
|
908
|
-
|
|
937
|
+
A.value.length > 0 && (_.value = (_.value + e + A.value.length) % A.value.length);
|
|
909
938
|
}
|
|
910
|
-
function
|
|
911
|
-
|
|
939
|
+
function ee(e) {
|
|
940
|
+
D(e) && (_.value = A.value.indexOf(e));
|
|
912
941
|
}
|
|
913
|
-
function
|
|
914
|
-
|
|
942
|
+
function te(e) {
|
|
943
|
+
D(e) && (ee(e), z());
|
|
915
944
|
}
|
|
916
|
-
function
|
|
945
|
+
function H(e) {
|
|
917
946
|
if (S.value === void 0) return !1;
|
|
918
947
|
let t = M.value;
|
|
919
948
|
if (e.key === "Escape") x.value = !0;
|
|
@@ -923,56 +952,56 @@ var St = { class: "kvc-composer" }, Ct = { class: "kvc-box" }, wt = ["aria-label
|
|
|
923
952
|
else return !1;
|
|
924
953
|
return !0;
|
|
925
954
|
}
|
|
926
|
-
function
|
|
927
|
-
if (
|
|
955
|
+
function ne(e) {
|
|
956
|
+
if (H(e)) return e.preventDefault();
|
|
928
957
|
e.key !== "Enter" || e.shiftKey || e.isComposing || (e.preventDefault(), B());
|
|
929
958
|
}
|
|
930
|
-
return (t, n) => (g(), i("div",
|
|
959
|
+
return (t, n) => (g(), i("div", kt, [a("div", At, [
|
|
931
960
|
S.value !== void 0 && !x.value ? (g(), i("div", {
|
|
932
961
|
key: 0,
|
|
933
962
|
class: "kvc-slash",
|
|
934
963
|
role: "listbox",
|
|
935
|
-
"aria-label":
|
|
964
|
+
"aria-label": E(d).t("kvcoder.ui.slash.title"),
|
|
936
965
|
"data-test": "slash-list"
|
|
937
966
|
}, [
|
|
938
|
-
N.value ? (g(), i("p",
|
|
939
|
-
(g(!0), i(e, null, y(
|
|
967
|
+
N.value ? (g(), i("p", Mt, T(E(d).t("kvcoder.ui.slash.wait")), 1)) : r("v-if", !0),
|
|
968
|
+
(g(!0), i(e, null, y(w.value, (t) => (g(), i("div", {
|
|
940
969
|
key: t.command.name,
|
|
941
970
|
class: "kvc-slash-row",
|
|
942
971
|
role: "option",
|
|
943
|
-
"aria-disabled": !
|
|
972
|
+
"aria-disabled": !D(t),
|
|
944
973
|
"aria-selected": t === M.value,
|
|
945
974
|
"data-active": t === M.value,
|
|
946
975
|
"data-test": `slash-${t.command.name}`,
|
|
947
|
-
onMousemove: (e) =>
|
|
948
|
-
onClick: (e) =>
|
|
949
|
-
}, [a("span",
|
|
950
|
-
|
|
951
|
-
], 8,
|
|
952
|
-
p.value.length > 0 ? (g(), i("div",
|
|
976
|
+
onMousemove: (e) => ee(t),
|
|
977
|
+
onClick: (e) => te(t)
|
|
978
|
+
}, [a("span", Pt, [a("span", Ft, [o("/" + T(t.command.name), 1), P(t) ? (g(), i(e, { key: 0 }, [o(" <" + T(E(d).t(`kvcoder.ui.slash.${t.command.name}.argument`)) + ">", 1)], 64)) : r("v-if", !0)])]), a("span", It, T(F(t)), 1)], 40, Nt))), 128)),
|
|
979
|
+
w.value.length === 0 ? (g(), i("p", Lt, T(E(d).t("kvcoder.ui.slash.none")), 1)) : r("v-if", !0)
|
|
980
|
+
], 8, jt)) : r("v-if", !0),
|
|
981
|
+
p.value.length > 0 ? (g(), i("div", Rt, [(g(!0), i(e, null, y(p.value, (e) => (g(), i("span", {
|
|
953
982
|
key: e.id,
|
|
954
983
|
class: "kvc-chip",
|
|
955
984
|
"data-test": "attachment"
|
|
956
|
-
}, [o(
|
|
985
|
+
}, [o(T(e.name), 1), a("button", {
|
|
957
986
|
type: "button",
|
|
958
987
|
class: "kvc-ghost kvc-button",
|
|
959
988
|
style: {
|
|
960
989
|
"min-block-size": "20px",
|
|
961
990
|
padding: "0"
|
|
962
991
|
},
|
|
963
|
-
"aria-label":
|
|
992
|
+
"aria-label": E(d).t("kvcoder.ui.removeAttachment"),
|
|
964
993
|
onClick: (t) => p.value = p.value.filter((t) => t.id !== e.id)
|
|
965
|
-
}, [s(
|
|
966
|
-
|
|
994
|
+
}, [s(E(Ee), { size: 12 })], 8, zt)]))), 128))])) : r("v-if", !0),
|
|
995
|
+
j(a("textarea", {
|
|
967
996
|
"onUpdate:modelValue": n[0] ||= (e) => f.value = e,
|
|
968
997
|
placeholder: l.placeholder,
|
|
969
998
|
"aria-label": l.placeholder,
|
|
970
999
|
rows: "2",
|
|
971
1000
|
"data-test": "composer-text",
|
|
972
|
-
onKeydown:
|
|
1001
|
+
onKeydown: ne,
|
|
973
1002
|
onPaste: R
|
|
974
|
-
}, null, 40,
|
|
975
|
-
a("div",
|
|
1003
|
+
}, null, 40, Bt), [[O, f.value]]),
|
|
1004
|
+
a("div", Vt, [
|
|
976
1005
|
a("input", {
|
|
977
1006
|
ref_key: "picker",
|
|
978
1007
|
ref: m,
|
|
@@ -985,35 +1014,35 @@ var St = { class: "kvc-composer" }, Ct = { class: "kvc-box" }, wt = ["aria-label
|
|
|
985
1014
|
a("button", {
|
|
986
1015
|
type: "button",
|
|
987
1016
|
class: "kvc-button",
|
|
988
|
-
"aria-label":
|
|
989
|
-
title:
|
|
1017
|
+
"aria-label": E(d).t("kvcoder.ui.attach"),
|
|
1018
|
+
title: E(d).t("kvcoder.ui.attach"),
|
|
990
1019
|
disabled: h.value,
|
|
991
1020
|
onClick: n[1] ||= (e) => m.value?.click()
|
|
992
|
-
}, [s(
|
|
1021
|
+
}, [s(E(be), { size: 16 })], 8, Ht),
|
|
993
1022
|
b(t.$slots, "controls"),
|
|
994
|
-
a("span",
|
|
1023
|
+
a("span", Ut, T(E(d).t("kvcoder.ui.enterSends")), 1),
|
|
995
1024
|
l.running ? (g(), i("button", {
|
|
996
1025
|
key: 0,
|
|
997
1026
|
type: "button",
|
|
998
1027
|
class: "kvc-button",
|
|
999
1028
|
"data-test": "stop",
|
|
1000
1029
|
onClick: n[2] ||= (e) => u("stop")
|
|
1001
|
-
}, [s(
|
|
1030
|
+
}, [s(E(Te), { size: 14 }), o(T(E(d).t("kvcoder.ui.stop")), 1)])) : r("v-if", !0),
|
|
1002
1031
|
a("button", {
|
|
1003
1032
|
type: "button",
|
|
1004
1033
|
class: "kvc-button kvc-primary",
|
|
1005
|
-
"aria-label":
|
|
1034
|
+
"aria-label": E(d).t("kvcoder.ui.send"),
|
|
1006
1035
|
disabled: f.value.trim() === "" || h.value || l.blocked === !0,
|
|
1007
1036
|
"data-test": "send",
|
|
1008
1037
|
onClick: B
|
|
1009
|
-
}, [s(
|
|
1038
|
+
}, [s(E(re), { size: 16 })], 8, Wt)
|
|
1010
1039
|
])
|
|
1011
1040
|
])]));
|
|
1012
1041
|
}
|
|
1013
1042
|
});
|
|
1014
1043
|
//#endregion
|
|
1015
1044
|
//#region web/src/model-groups.ts
|
|
1016
|
-
function
|
|
1045
|
+
function Kt(e, t, n) {
|
|
1017
1046
|
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();
|
|
1018
1047
|
for (let e of a) {
|
|
1019
1048
|
let t = o.get(e.provider) ?? {
|
|
@@ -1028,7 +1057,7 @@ function zt(e, t, n) {
|
|
|
1028
1057
|
}
|
|
1029
1058
|
return [...o.values()].sort((e, t) => e.title.localeCompare(t.title));
|
|
1030
1059
|
}
|
|
1031
|
-
function
|
|
1060
|
+
function qt(e, t) {
|
|
1032
1061
|
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) => ({
|
|
1033
1062
|
...e,
|
|
1034
1063
|
models: e.models.filter(r)
|
|
@@ -1039,38 +1068,38 @@ function Bt(e, t) {
|
|
|
1039
1068
|
total: e.reduce((e, t) => e + t.models.length, 0)
|
|
1040
1069
|
};
|
|
1041
1070
|
}
|
|
1042
|
-
var
|
|
1071
|
+
var Jt = [
|
|
1043
1072
|
"off",
|
|
1044
1073
|
"minimal",
|
|
1045
1074
|
"low",
|
|
1046
1075
|
"medium",
|
|
1047
1076
|
"high"
|
|
1048
|
-
],
|
|
1077
|
+
], Yt = { class: "kvc-picker" }, Xt = [
|
|
1049
1078
|
"aria-expanded",
|
|
1050
1079
|
"aria-label",
|
|
1051
1080
|
"disabled"
|
|
1052
|
-
],
|
|
1081
|
+
], Zt = { class: "kvc-picker-label" }, Qt = ["onKeydown"], $t = { class: "kvc-search" }, en = [
|
|
1053
1082
|
"placeholder",
|
|
1054
1083
|
"aria-label",
|
|
1055
1084
|
"onKeydown"
|
|
1056
|
-
],
|
|
1085
|
+
], tn = ["aria-label"], nn = ["aria-selected", "data-active"], rn = { class: "kvc-model-name" }, an = {
|
|
1057
1086
|
class: "kvc-group",
|
|
1058
1087
|
role: "presentation",
|
|
1059
1088
|
"data-test": "model-group"
|
|
1060
|
-
},
|
|
1089
|
+
}, on = [
|
|
1061
1090
|
"aria-selected",
|
|
1062
1091
|
"data-active",
|
|
1063
1092
|
"data-test",
|
|
1064
1093
|
"onClick",
|
|
1065
1094
|
"onMousemove"
|
|
1066
|
-
],
|
|
1095
|
+
], sn = { class: "kvc-model-name" }, cn = {
|
|
1067
1096
|
key: 1,
|
|
1068
1097
|
class: "kvc-muted kvc-none",
|
|
1069
1098
|
"data-test": "model-none"
|
|
1070
|
-
},
|
|
1099
|
+
}, ln = {
|
|
1071
1100
|
class: "kvc-muted kvc-count",
|
|
1072
1101
|
"data-test": "model-count"
|
|
1073
|
-
},
|
|
1102
|
+
}, un = 24, dn = /* @__PURE__ */ c({
|
|
1074
1103
|
__name: "ModelPicker",
|
|
1075
1104
|
props: {
|
|
1076
1105
|
groups: {},
|
|
@@ -1081,74 +1110,74 @@ var Vt = [
|
|
|
1081
1110
|
},
|
|
1082
1111
|
emits: ["pick", "none"],
|
|
1083
1112
|
setup(o, { emit: c }) {
|
|
1084
|
-
let l = o, u = c, f =
|
|
1085
|
-
let t =
|
|
1113
|
+
let l = o, u = c, f = G(), m = v(!1), h = v(""), _ = v(0), b = D("trigger"), x = D("search"), S = D("panel"), C = t(() => qt(l.groups, h.value)), w = t(() => C.value.groups.flatMap((e) => e.models)), A = t(() => l.groups.flatMap((e) => e.models).find((e) => e.id === l.current)?.name ?? l.current ?? l.empty ?? ""), P = t(() => l.none !== void 0 && h.value.trim() === ""), F = t(() => +!!P.value), I = t(() => w.value.length + F.value), L = (e) => {
|
|
1114
|
+
let t = w.value.findIndex((t) => t.id === e);
|
|
1086
1115
|
return t < 0 ? -1 : t + F.value;
|
|
1087
1116
|
};
|
|
1088
1117
|
function R() {
|
|
1089
1118
|
m.value = !1, b.value?.focus();
|
|
1090
1119
|
}
|
|
1091
1120
|
async function z() {
|
|
1092
|
-
h.value = "", _.value = Math.max(L(l.current ?? ""), 0), B = 0, m.value = !0, await d(),
|
|
1121
|
+
h.value = "", _.value = Math.max(L(l.current ?? ""), 0), B = 0, m.value = !0, await d(), ee(), x.value?.focus(), H();
|
|
1093
1122
|
}
|
|
1094
1123
|
let B = 0, V = 0;
|
|
1095
|
-
function
|
|
1124
|
+
function ee() {
|
|
1096
1125
|
let e = S.value, t = b.value?.closest(".kvc-conversation")?.getBoundingClientRect();
|
|
1097
1126
|
if (e === null || t === void 0) return;
|
|
1098
|
-
let n = e.getBoundingClientRect(), r = t.left +
|
|
1127
|
+
let n = e.getBoundingClientRect(), r = t.left + un - (n.left - B), i = t.right - un - (n.right - B), a = r > 0 ? r : i < 0 ? i : 0;
|
|
1099
1128
|
a !== B && (B = a, e.style.translate = `${a}px 0`);
|
|
1100
1129
|
}
|
|
1101
|
-
function
|
|
1102
|
-
|
|
1130
|
+
function te() {
|
|
1131
|
+
ee(), V = requestAnimationFrame(te);
|
|
1103
1132
|
}
|
|
1104
|
-
function
|
|
1133
|
+
function H() {
|
|
1105
1134
|
S.value?.querySelector("[data-active=\"true\"]")?.scrollIntoView?.({ block: "nearest" });
|
|
1106
1135
|
}
|
|
1107
|
-
async function
|
|
1108
|
-
I.value !== 0 && (_.value = (_.value + e + I.value) % I.value, await d(),
|
|
1136
|
+
async function ne(e) {
|
|
1137
|
+
I.value !== 0 && (_.value = (_.value + e + I.value) % I.value, await d(), H());
|
|
1109
1138
|
}
|
|
1110
|
-
function
|
|
1139
|
+
function U(e) {
|
|
1111
1140
|
e !== void 0 && (u("pick", e), R());
|
|
1112
1141
|
}
|
|
1113
|
-
function
|
|
1142
|
+
function re() {
|
|
1114
1143
|
u("none"), R();
|
|
1115
1144
|
}
|
|
1116
|
-
function
|
|
1117
|
-
P.value && _.value === 0 ?
|
|
1145
|
+
function ie() {
|
|
1146
|
+
P.value && _.value === 0 ? re() : U(w.value[_.value - F.value]?.id);
|
|
1118
1147
|
}
|
|
1119
|
-
function
|
|
1148
|
+
function W(e) {
|
|
1120
1149
|
e.target instanceof Node && !b.value?.parentElement?.contains(e.target) && (m.value = !1);
|
|
1121
1150
|
}
|
|
1122
|
-
return
|
|
1123
|
-
e ? (document.addEventListener("pointerdown",
|
|
1151
|
+
return k(h, () => _.value = 0), k(m, (e) => {
|
|
1152
|
+
e ? (document.addEventListener("pointerdown", W), V = requestAnimationFrame(te)) : (document.removeEventListener("pointerdown", W), cancelAnimationFrame(V));
|
|
1124
1153
|
}), p(() => {
|
|
1125
|
-
document.removeEventListener("pointerdown",
|
|
1126
|
-
}), (t, o) => (g(), i("div",
|
|
1154
|
+
document.removeEventListener("pointerdown", W), cancelAnimationFrame(V);
|
|
1155
|
+
}), (t, o) => (g(), i("div", Yt, [a("button", {
|
|
1127
1156
|
ref_key: "trigger",
|
|
1128
1157
|
ref: b,
|
|
1129
1158
|
type: "button",
|
|
1130
1159
|
class: "kvc-button",
|
|
1131
1160
|
"aria-haspopup": "listbox",
|
|
1132
1161
|
"aria-expanded": m.value,
|
|
1133
|
-
"aria-label": `${
|
|
1162
|
+
"aria-label": `${E(f).t("kvcoder.ui.model")}: ${A.value}`,
|
|
1134
1163
|
disabled: l.disabled,
|
|
1135
1164
|
"data-test": "model-picker",
|
|
1136
1165
|
onClick: o[0] ||= (e) => m.value ? R() : z()
|
|
1137
|
-
}, [a("span",
|
|
1166
|
+
}, [a("span", Zt, T(A.value), 1), s(E(oe), {
|
|
1138
1167
|
size: 16,
|
|
1139
1168
|
"aria-hidden": "true"
|
|
1140
|
-
})], 8,
|
|
1169
|
+
})], 8, Xt), m.value ? (g(), i("div", {
|
|
1141
1170
|
key: 0,
|
|
1142
1171
|
ref_key: "panel",
|
|
1143
1172
|
ref: S,
|
|
1144
1173
|
class: "kvc-popover",
|
|
1145
1174
|
"data-test": "model-popover",
|
|
1146
|
-
onKeydown:
|
|
1175
|
+
onKeydown: M(N(R, ["stop"]), ["esc"])
|
|
1147
1176
|
}, [
|
|
1148
|
-
a("label",
|
|
1177
|
+
a("label", $t, [s(E(Ce), {
|
|
1149
1178
|
size: 16,
|
|
1150
1179
|
"aria-hidden": "true"
|
|
1151
|
-
}),
|
|
1180
|
+
}), j(a("input", {
|
|
1152
1181
|
ref_key: "search",
|
|
1153
1182
|
ref: x,
|
|
1154
1183
|
"onUpdate:modelValue": o[1] ||= (e) => h.value = e,
|
|
@@ -1156,20 +1185,20 @@ var Vt = [
|
|
|
1156
1185
|
role: "combobox",
|
|
1157
1186
|
"aria-expanded": "true",
|
|
1158
1187
|
"aria-controls": "kvc-models",
|
|
1159
|
-
placeholder:
|
|
1160
|
-
"aria-label":
|
|
1188
|
+
placeholder: E(f).t("kvcoder.ui.searchModels"),
|
|
1189
|
+
"aria-label": E(f).t("kvcoder.ui.searchModels"),
|
|
1161
1190
|
"data-test": "model-search",
|
|
1162
1191
|
onKeydown: [
|
|
1163
|
-
o[2] ||=
|
|
1164
|
-
o[3] ||=
|
|
1165
|
-
|
|
1192
|
+
o[2] ||= M(N((e) => ne(1), ["prevent"]), ["down"]),
|
|
1193
|
+
o[3] ||= M(N((e) => ne(-1), ["prevent"]), ["up"]),
|
|
1194
|
+
M(N(ie, ["prevent"]), ["enter"])
|
|
1166
1195
|
]
|
|
1167
|
-
}, null, 40,
|
|
1196
|
+
}, null, 40, en), [[O, h.value]])]),
|
|
1168
1197
|
a("div", {
|
|
1169
1198
|
id: "kvc-models",
|
|
1170
1199
|
class: "kvc-options",
|
|
1171
1200
|
role: "listbox",
|
|
1172
|
-
"aria-label":
|
|
1201
|
+
"aria-label": E(f).t("kvcoder.ui.model")
|
|
1173
1202
|
}, [
|
|
1174
1203
|
P.value ? (g(), i("div", {
|
|
1175
1204
|
key: 0,
|
|
@@ -1178,36 +1207,36 @@ var Vt = [
|
|
|
1178
1207
|
"aria-selected": l.current === null,
|
|
1179
1208
|
"data-active": _.value === 0,
|
|
1180
1209
|
"data-test": "model-none-entry",
|
|
1181
|
-
onClick:
|
|
1210
|
+
onClick: re,
|
|
1182
1211
|
onMousemove: o[4] ||= (e) => _.value = 0
|
|
1183
|
-
}, [a("span",
|
|
1212
|
+
}, [a("span", rn, T(l.none), 1), l.current === null ? (g(), n(E(ae), {
|
|
1184
1213
|
key: 0,
|
|
1185
1214
|
size: 16,
|
|
1186
1215
|
"aria-hidden": "true"
|
|
1187
|
-
})) : r("v-if", !0)], 40,
|
|
1188
|
-
(g(!0), i(e, null, y(C.value.groups, (t) => (g(), i(e, { key: t.provider }, [a("div",
|
|
1216
|
+
})) : r("v-if", !0)], 40, nn)) : r("v-if", !0),
|
|
1217
|
+
(g(!0), i(e, null, y(C.value.groups, (t) => (g(), i(e, { key: t.provider }, [a("div", an, T(t.title), 1), (g(!0), i(e, null, y(t.models, (e) => (g(), i("div", {
|
|
1189
1218
|
key: e.id,
|
|
1190
1219
|
class: "kvc-model",
|
|
1191
1220
|
role: "option",
|
|
1192
1221
|
"aria-selected": e.id === l.current,
|
|
1193
1222
|
"data-active": L(e.id) === _.value,
|
|
1194
1223
|
"data-test": `model-${e.id}`,
|
|
1195
|
-
onClick: (t) =>
|
|
1224
|
+
onClick: (t) => U(e.id),
|
|
1196
1225
|
onMousemove: (t) => _.value = L(e.id)
|
|
1197
|
-
}, [a("span",
|
|
1226
|
+
}, [a("span", sn, T(e.name), 1), e.id === l.current ? (g(), n(E(ae), {
|
|
1198
1227
|
key: 0,
|
|
1199
1228
|
size: 16,
|
|
1200
1229
|
"aria-hidden": "true"
|
|
1201
|
-
})) : r("v-if", !0)], 40,
|
|
1202
|
-
C.value.shown === 0 ? (g(), i("p",
|
|
1203
|
-
], 8,
|
|
1204
|
-
a("p",
|
|
1230
|
+
})) : r("v-if", !0)], 40, on))), 128))], 64))), 128)),
|
|
1231
|
+
C.value.shown === 0 ? (g(), i("p", cn, T(E(f).t("kvcoder.ui.noModels")), 1)) : r("v-if", !0)
|
|
1232
|
+
], 8, tn),
|
|
1233
|
+
a("p", ln, T(E(f).t("kvcoder.ui.modelsCount", {
|
|
1205
1234
|
shown: C.value.shown,
|
|
1206
1235
|
total: C.value.total
|
|
1207
1236
|
})), 1)
|
|
1208
|
-
], 40,
|
|
1237
|
+
], 40, Qt)) : r("v-if", !0)]));
|
|
1209
1238
|
}
|
|
1210
|
-
}),
|
|
1239
|
+
}), fn = ["value", "aria-label"], pn = ["value"], mn = /* @__PURE__ */ c({
|
|
1211
1240
|
__name: "ModelControls",
|
|
1212
1241
|
props: {
|
|
1213
1242
|
groups: {},
|
|
@@ -1217,8 +1246,8 @@ var Vt = [
|
|
|
1217
1246
|
},
|
|
1218
1247
|
emits: ["model", "thinking"],
|
|
1219
1248
|
setup(t, { emit: n }) {
|
|
1220
|
-
let r = t, o = n, c =
|
|
1221
|
-
return (t, n) => (g(), i(e, null, [s(
|
|
1249
|
+
let r = t, o = n, c = G(), l = (e) => Jt.find((t) => e.target instanceof HTMLSelectElement && t === e.target.value) ?? "medium";
|
|
1250
|
+
return (t, n) => (g(), i(e, null, [s(dn, {
|
|
1222
1251
|
groups: r.groups,
|
|
1223
1252
|
current: r.model,
|
|
1224
1253
|
empty: r.empty,
|
|
@@ -1230,18 +1259,18 @@ var Vt = [
|
|
|
1230
1259
|
]), a("select", {
|
|
1231
1260
|
value: r.thinking,
|
|
1232
1261
|
class: "kvc-button",
|
|
1233
|
-
"aria-label":
|
|
1262
|
+
"aria-label": E(c).t("kvcoder.ui.thinking"),
|
|
1234
1263
|
"data-test": "thinking-picker",
|
|
1235
1264
|
onChange: n[1] ||= (e) => o("thinking", l(e))
|
|
1236
|
-
}, [(g(!0), i(e, null, y(
|
|
1265
|
+
}, [(g(!0), i(e, null, y(E(Jt), (e) => (g(), i("option", {
|
|
1237
1266
|
key: e,
|
|
1238
1267
|
value: e
|
|
1239
|
-
},
|
|
1268
|
+
}, T(E(c).t(`kvcoder.ui.thinkingLevels.${e}`)), 9, pn))), 128))], 40, fn)], 64));
|
|
1240
1269
|
}
|
|
1241
1270
|
});
|
|
1242
1271
|
//#endregion
|
|
1243
1272
|
//#region web/src/remember-model.ts
|
|
1244
|
-
async function
|
|
1273
|
+
async function hn(e, t) {
|
|
1245
1274
|
try {
|
|
1246
1275
|
await e.exec("kernel.settings.set", {
|
|
1247
1276
|
key: "kvai.defaultModel",
|
|
@@ -1249,20 +1278,20 @@ async function cn(e, t) {
|
|
|
1249
1278
|
scope: "global"
|
|
1250
1279
|
}), e.refresh();
|
|
1251
1280
|
} catch (t) {
|
|
1252
|
-
|
|
1281
|
+
q(e, t);
|
|
1253
1282
|
}
|
|
1254
1283
|
}
|
|
1255
1284
|
//#endregion
|
|
1256
1285
|
//#region web/src/use-chat-model.ts
|
|
1257
|
-
function
|
|
1286
|
+
function gn(e, t) {
|
|
1258
1287
|
let n = e.find((e) => e.key === t)?.value;
|
|
1259
1288
|
return typeof n == "string" && n !== "" ? n : null;
|
|
1260
1289
|
}
|
|
1261
|
-
function
|
|
1290
|
+
function _n(e) {
|
|
1262
1291
|
let t = e.find((e) => e.key === "kvcoder.thinking")?.value;
|
|
1263
|
-
return
|
|
1292
|
+
return Jt.find((e) => e === t) ?? "medium";
|
|
1264
1293
|
}
|
|
1265
|
-
function
|
|
1294
|
+
function vn(e, n) {
|
|
1266
1295
|
let r = v([]), i = v([]), a = v(null), o = v(null), s = v("medium"), c = v(null), l = v(!1), u = v(!1);
|
|
1267
1296
|
m(async () => {
|
|
1268
1297
|
try {
|
|
@@ -1271,14 +1300,14 @@ function dn(e, n) {
|
|
|
1271
1300
|
e.exec("kvai.provider.list", {}),
|
|
1272
1301
|
e.exec("kvai.model.list", {})
|
|
1273
1302
|
]);
|
|
1274
|
-
a.value =
|
|
1303
|
+
a.value = gn(t, "kvcoder.model") ?? gn(t, "kvai.defaultModel"), s.value = _n(t), r.value = n, i.value = o;
|
|
1275
1304
|
} catch (e) {
|
|
1276
1305
|
u.value = !0, n(e);
|
|
1277
1306
|
} finally {
|
|
1278
1307
|
l.value = !0;
|
|
1279
1308
|
}
|
|
1280
1309
|
});
|
|
1281
|
-
let d = t(() => o.value ?? a.value), f = t(() => c.value ?? s.value), p = t(() =>
|
|
1310
|
+
let d = t(() => o.value ?? a.value), f = t(() => c.value ?? s.value), p = t(() => Kt(r.value, i.value, d.value)), h = t(() => r.value.find((e) => e.id === i.value.find((e) => e.id === d.value)?.provider));
|
|
1282
1311
|
return {
|
|
1283
1312
|
current: d,
|
|
1284
1313
|
thinking: f,
|
|
@@ -1295,29 +1324,29 @@ function dn(e, n) {
|
|
|
1295
1324
|
}
|
|
1296
1325
|
//#endregion
|
|
1297
1326
|
//#region web/src/ChatStart.vue?vue&type=script&setup=true&lang.ts
|
|
1298
|
-
var
|
|
1327
|
+
var yn = {
|
|
1299
1328
|
class: "kvc-start",
|
|
1300
1329
|
"data-test": "chat-start"
|
|
1301
|
-
},
|
|
1330
|
+
}, bn = {
|
|
1302
1331
|
key: 0,
|
|
1303
1332
|
class: "kvc-muted kvc-start-note",
|
|
1304
1333
|
role: "status",
|
|
1305
1334
|
"data-test": "key-needed"
|
|
1306
|
-
},
|
|
1335
|
+
}, xn = {
|
|
1307
1336
|
key: 1,
|
|
1308
1337
|
class: "kvc-muted kvc-start-note",
|
|
1309
1338
|
role: "status",
|
|
1310
1339
|
"data-test": "choose-model"
|
|
1311
|
-
},
|
|
1340
|
+
}, Sn = {
|
|
1312
1341
|
key: 2,
|
|
1313
1342
|
class: "kvc-muted kvc-start-note"
|
|
1314
|
-
},
|
|
1343
|
+
}, Cn = /* @__PURE__ */ c({
|
|
1315
1344
|
__name: "ChatStart",
|
|
1316
1345
|
props: { registered: {} },
|
|
1317
1346
|
setup(t) {
|
|
1318
|
-
let n =
|
|
1347
|
+
let n = G(), r = t, c = vn(n, (e) => q(n, e));
|
|
1319
1348
|
async function l(e) {
|
|
1320
|
-
c.pickModel(e), await
|
|
1349
|
+
c.pickModel(e), await hn(n, e);
|
|
1321
1350
|
}
|
|
1322
1351
|
async function u() {
|
|
1323
1352
|
let { id: e } = await n.exec("kvcoder.session.create", {}), t = c.changes();
|
|
@@ -1335,7 +1364,7 @@ var fn = {
|
|
|
1335
1364
|
...e.fileIds.length > 0 ? { fileIds: e.fileIds } : {}
|
|
1336
1365
|
}), n.navigate("kvcoder.session", { sessionId: t });
|
|
1337
1366
|
} catch (e) {
|
|
1338
|
-
|
|
1367
|
+
q(n, e);
|
|
1339
1368
|
}
|
|
1340
1369
|
}
|
|
1341
1370
|
async function f(e, t) {
|
|
@@ -1349,30 +1378,30 @@ var fn = {
|
|
|
1349
1378
|
text: t === "" ? n.t(e.message) : t
|
|
1350
1379
|
}), n.navigate("kvcoder.session", { sessionId: r });
|
|
1351
1380
|
} catch (e) {
|
|
1352
|
-
|
|
1381
|
+
q(n, e);
|
|
1353
1382
|
}
|
|
1354
1383
|
}
|
|
1355
|
-
return (t, u) => (g(), i(e, null, [a("div",
|
|
1384
|
+
return (t, u) => (g(), i(e, null, [a("div", yn, [a("h1", null, T(E(n).t("kvcoder.ui.startHeading", { workspace: E(n).workspace.value.name })), 1), E(c).state.value === "needsKey" && E(c).provider.value ? (g(), i("p", bn, [o(T(E(n).t("kvcoder.ui.keyNeeded", { provider: E(c).provider.value.title })) + " ", 1), a("button", {
|
|
1356
1385
|
type: "button",
|
|
1357
1386
|
class: "kvc-link-button",
|
|
1358
1387
|
"data-test": "add-key",
|
|
1359
|
-
onClick: u[0] ||= (e) =>
|
|
1360
|
-
},
|
|
1388
|
+
onClick: u[0] ||= (e) => E(n).navigate("kvai.provider", { providerId: E(c).provider.value.id })
|
|
1389
|
+
}, T(E(n).t("kvcoder.ui.addKey")), 1)])) : E(c).state.value === "noModel" ? (g(), i("p", xn, T(E(n).t("kvcoder.ui.chooseModelHint")), 1)) : (g(), i("p", Sn, T(E(n).t("kvcoder.ui.startHint")), 1))]), s(Gt, {
|
|
1361
1390
|
running: !1,
|
|
1362
|
-
placeholder:
|
|
1363
|
-
blocked:
|
|
1391
|
+
placeholder: E(n).t("kvcoder.ui.startPlaceholder"),
|
|
1392
|
+
blocked: E(c).state.value !== "ready",
|
|
1364
1393
|
commands: "wait",
|
|
1365
1394
|
registered: r.registered,
|
|
1366
1395
|
onSend: d,
|
|
1367
1396
|
onRegistered: f
|
|
1368
1397
|
}, {
|
|
1369
|
-
controls:
|
|
1370
|
-
groups:
|
|
1371
|
-
model:
|
|
1372
|
-
thinking:
|
|
1373
|
-
empty:
|
|
1398
|
+
controls: A(() => [s(mn, {
|
|
1399
|
+
groups: E(c).groups.value,
|
|
1400
|
+
model: E(c).current.value,
|
|
1401
|
+
thinking: E(c).thinking.value,
|
|
1402
|
+
empty: E(c).state.value === "loading" ? "" : E(n).t("kvcoder.ui.chooseModel"),
|
|
1374
1403
|
onModel: l,
|
|
1375
|
-
onThinking:
|
|
1404
|
+
onThinking: E(c).pickThinking
|
|
1376
1405
|
}, null, 8, [
|
|
1377
1406
|
"groups",
|
|
1378
1407
|
"model",
|
|
@@ -1390,23 +1419,23 @@ var fn = {
|
|
|
1390
1419
|
});
|
|
1391
1420
|
//#endregion
|
|
1392
1421
|
//#region web/src/use-now.ts
|
|
1393
|
-
function
|
|
1422
|
+
function wn() {
|
|
1394
1423
|
let e = v(Date.now()), t;
|
|
1395
1424
|
return m(() => t = setInterval(() => e.value = Date.now(), 1e3)), p(() => clearInterval(t)), e;
|
|
1396
1425
|
}
|
|
1397
1426
|
//#endregion
|
|
1398
1427
|
//#region web/src/CommandProgress.vue?vue&type=script&setup=true&lang.ts
|
|
1399
|
-
var
|
|
1428
|
+
var Tn = ["data-command"], En = { class: "kvc-activity-text" }, Dn = {
|
|
1400
1429
|
style: { "font-weight": "500" },
|
|
1401
1430
|
"data-test": "command-title"
|
|
1402
|
-
},
|
|
1431
|
+
}, On = {
|
|
1403
1432
|
class: "kvc-muted",
|
|
1404
1433
|
"data-test": "command-seconds"
|
|
1405
|
-
},
|
|
1434
|
+
}, kn = /* @__PURE__ */ c({
|
|
1406
1435
|
__name: "CommandProgress",
|
|
1407
1436
|
props: { working: {} },
|
|
1408
1437
|
setup(e) {
|
|
1409
|
-
let n = e, r =
|
|
1438
|
+
let n = e, r = G(), o = wn(), s = t(() => Math.max(0, Math.floor((o.value - n.working.startedAt) / 1e3)));
|
|
1410
1439
|
return (e, t) => (g(), i("div", {
|
|
1411
1440
|
class: "kvc-activity",
|
|
1412
1441
|
role: "status",
|
|
@@ -1418,19 +1447,19 @@ var vn = ["data-command"], yn = { class: "kvc-activity-text" }, bn = {
|
|
|
1418
1447
|
class: "kvc-spin",
|
|
1419
1448
|
"aria-hidden": "true"
|
|
1420
1449
|
}, null, -1),
|
|
1421
|
-
a("span",
|
|
1422
|
-
a("span",
|
|
1423
|
-
], 8,
|
|
1450
|
+
a("span", En, [a("span", Dn, T(E(r).t(`kvcoder.ui.working.${n.working.name}`)), 1)]),
|
|
1451
|
+
a("span", On, T(E(r).t("kvcoder.ui.seconds", { count: s.value })), 1)
|
|
1452
|
+
], 8, Tn));
|
|
1424
1453
|
}
|
|
1425
|
-
}),
|
|
1426
|
-
function
|
|
1454
|
+
}), An = 5;
|
|
1455
|
+
function jn(e, t) {
|
|
1427
1456
|
let n = Math.max(0, Math.floor(t / 1e3));
|
|
1428
1457
|
return n < 60 ? e("kvcoder.ui.seconds", { count: n }) : e("kvcoder.ui.jobs.minutes", {
|
|
1429
1458
|
minutes: Math.floor(n / 60),
|
|
1430
1459
|
seconds: n % 60
|
|
1431
1460
|
});
|
|
1432
1461
|
}
|
|
1433
|
-
function
|
|
1462
|
+
function Mn(e, n, r) {
|
|
1434
1463
|
let i = v([]), a = v({}), o = v(/* @__PURE__ */ new Set()), s = v(Date.now()), c = t(() => i.value.filter((e) => e.status === "running")), l = 0, u;
|
|
1435
1464
|
async function d() {
|
|
1436
1465
|
for (let t of Object.keys(a.value)) {
|
|
@@ -1448,7 +1477,7 @@ function Tn(e, n, r) {
|
|
|
1448
1477
|
try {
|
|
1449
1478
|
i.value = await e.exec("kvcoder.job.list", { sessionId: n() }), await d();
|
|
1450
1479
|
} catch (t) {
|
|
1451
|
-
|
|
1480
|
+
q(e, t);
|
|
1452
1481
|
}
|
|
1453
1482
|
}
|
|
1454
1483
|
async function m(e) {
|
|
@@ -1469,13 +1498,13 @@ function Tn(e, n, r) {
|
|
|
1469
1498
|
id: t
|
|
1470
1499
|
});
|
|
1471
1500
|
} catch (t) {
|
|
1472
|
-
|
|
1501
|
+
q(e, t);
|
|
1473
1502
|
}
|
|
1474
1503
|
o.value = new Set([...o.value].filter((e) => e !== t)), await f();
|
|
1475
1504
|
}
|
|
1476
|
-
return
|
|
1505
|
+
return k(() => c.value.length > 0 || r.value, (e) => {
|
|
1477
1506
|
clearInterval(u), u = void 0, e && (u = setInterval(() => {
|
|
1478
|
-
s.value = Date.now(), l += 1, l %
|
|
1507
|
+
s.value = Date.now(), l += 1, l % An === 0 && f();
|
|
1479
1508
|
}, 1e3));
|
|
1480
1509
|
}, { immediate: !0 }), p(() => clearInterval(u)), {
|
|
1481
1510
|
jobs: i,
|
|
@@ -1490,25 +1519,25 @@ function Tn(e, n, r) {
|
|
|
1490
1519
|
}
|
|
1491
1520
|
//#endregion
|
|
1492
1521
|
//#region web/src/JobItem.vue?vue&type=script&setup=true&lang.ts
|
|
1493
|
-
var
|
|
1522
|
+
var Nn = ["data-test", "data-status"], Pn = { class: "kvc-job-head" }, Fn = {
|
|
1494
1523
|
class: "kvc-job-title kvc-oneline",
|
|
1495
1524
|
"data-test": "job-title"
|
|
1496
|
-
},
|
|
1525
|
+
}, In = {
|
|
1497
1526
|
key: 0,
|
|
1498
1527
|
class: "kvc-muted",
|
|
1499
1528
|
"data-test": "job-time"
|
|
1500
|
-
},
|
|
1529
|
+
}, Ln = {
|
|
1501
1530
|
key: 1,
|
|
1502
1531
|
class: "kvc-chip",
|
|
1503
1532
|
"data-test": "job-status"
|
|
1504
|
-
},
|
|
1533
|
+
}, Rn = {
|
|
1505
1534
|
key: 0,
|
|
1506
1535
|
class: "kvc-job-links"
|
|
1507
|
-
},
|
|
1536
|
+
}, zn = ["href"], Bn = { class: "kvc-actions" }, Vn = ["aria-expanded", "data-test"], Hn = ["disabled", "data-test"], Un = {
|
|
1508
1537
|
key: 1,
|
|
1509
1538
|
class: "kvc-output",
|
|
1510
1539
|
"data-test": "job-output"
|
|
1511
|
-
},
|
|
1540
|
+
}, Wn = /* @__PURE__ */ c({
|
|
1512
1541
|
__name: "JobItem",
|
|
1513
1542
|
props: {
|
|
1514
1543
|
job: {},
|
|
@@ -1518,57 +1547,57 @@ var En = ["data-test", "data-status"], Dn = { class: "kvc-job-head" }, On = {
|
|
|
1518
1547
|
},
|
|
1519
1548
|
emits: ["stop", "logs"],
|
|
1520
1549
|
setup(t, { emit: n }) {
|
|
1521
|
-
let s = t, c = n, l =
|
|
1550
|
+
let s = t, c = n, l = G();
|
|
1522
1551
|
return (t, n) => (g(), i("div", {
|
|
1523
1552
|
class: "kvc-job",
|
|
1524
1553
|
"data-test": `job-${s.job.id}`,
|
|
1525
1554
|
"data-status": s.job.status
|
|
1526
1555
|
}, [
|
|
1527
|
-
a("div",
|
|
1528
|
-
s.job.links.length > 0 ? (g(), i("div",
|
|
1556
|
+
a("div", Pn, [a("span", Fn, T(s.job.title), 1), s.job.status === "running" ? (g(), i("span", In, T(E(jn)(E(l).t, s.now - Date.parse(s.job.startedAt))), 1)) : (g(), i("span", Ln, [o(T(E(l).t(`kvcoder.ui.jobs.status.${s.job.status}`)), 1), s.job.exitCode !== void 0 && s.job.exitCode !== 0 ? (g(), i(e, { key: 0 }, [o(" · " + T(E(l).t("kvcoder.ui.exitCode", { code: s.job.exitCode })), 1)], 64)) : r("v-if", !0)]))]),
|
|
1557
|
+
s.job.links.length > 0 ? (g(), i("div", Rn, [(g(!0), i(e, null, y(s.job.links, (e) => (g(), i("a", {
|
|
1529
1558
|
key: e,
|
|
1530
1559
|
href: e,
|
|
1531
1560
|
target: "_blank",
|
|
1532
1561
|
rel: "noopener noreferrer",
|
|
1533
1562
|
class: "kvc-link kvc-mono",
|
|
1534
1563
|
"data-test": "job-link"
|
|
1535
|
-
},
|
|
1536
|
-
a("div",
|
|
1564
|
+
}, T(e), 9, zn))), 128))])) : r("v-if", !0),
|
|
1565
|
+
a("div", Bn, [a("button", {
|
|
1537
1566
|
type: "button",
|
|
1538
1567
|
class: "kvc-button",
|
|
1539
1568
|
"aria-expanded": s.logs !== void 0,
|
|
1540
1569
|
"data-test": `job-logs-${s.job.id}`,
|
|
1541
1570
|
onClick: n[0] ||= (e) => c("logs")
|
|
1542
|
-
},
|
|
1571
|
+
}, T(E(l).t("kvcoder.ui.jobs.logs")), 9, Vn), s.job.status === "running" ? (g(), i("button", {
|
|
1543
1572
|
key: 0,
|
|
1544
1573
|
type: "button",
|
|
1545
1574
|
class: "kvc-button kvc-primary",
|
|
1546
1575
|
disabled: s.stopping,
|
|
1547
1576
|
"data-test": `job-stop-${s.job.id}`,
|
|
1548
1577
|
onClick: n[1] ||= (e) => c("stop")
|
|
1549
|
-
},
|
|
1550
|
-
s.logs === void 0 ? r("v-if", !0) : (g(), i("pre",
|
|
1551
|
-
], 8,
|
|
1578
|
+
}, T(E(l).t("kvcoder.ui.jobs.stop")), 9, Hn)) : r("v-if", !0)]),
|
|
1579
|
+
s.logs === void 0 ? r("v-if", !0) : (g(), i("pre", Un, T(s.logs === "" ? E(l).t("kvcoder.ui.jobs.noOutput") : s.logs), 1))
|
|
1580
|
+
], 8, Nn));
|
|
1552
1581
|
}
|
|
1553
|
-
}),
|
|
1582
|
+
}), Gn = {
|
|
1554
1583
|
key: 0,
|
|
1555
1584
|
class: "kvc-jobs",
|
|
1556
1585
|
"data-test": "jobs"
|
|
1557
|
-
},
|
|
1586
|
+
}, Kn = ["aria-expanded"], qn = ["aria-label", "onKeydown"], Jn = /* @__PURE__ */ c({
|
|
1558
1587
|
__name: "JobsChip",
|
|
1559
1588
|
props: {
|
|
1560
1589
|
sessionId: {},
|
|
1561
1590
|
stamp: {}
|
|
1562
1591
|
},
|
|
1563
1592
|
setup(t) {
|
|
1564
|
-
let c = t, l =
|
|
1565
|
-
function
|
|
1593
|
+
let c = t, l = G(), u = v(!1), d = D("trigger"), { jobs: f, running: h, logs: _, stopping: b, now: x, load: S, toggleLogs: C, stop: w } = Mn(l, () => c.sessionId, u);
|
|
1594
|
+
function O() {
|
|
1566
1595
|
u.value = !1, d.value?.focus();
|
|
1567
1596
|
}
|
|
1568
1597
|
function A(e) {
|
|
1569
1598
|
e.target instanceof Node && !d.value?.parentElement?.contains(e.target) && (u.value = !1);
|
|
1570
1599
|
}
|
|
1571
|
-
return m(S),
|
|
1600
|
+
return m(S), k(() => [c.sessionId, c.stamp], S), k(u, (e) => e ? document.addEventListener("pointerdown", A) : document.removeEventListener("pointerdown", A)), p(() => document.removeEventListener("pointerdown", A)), (t, c) => E(h).length > 0 || u.value ? (g(), i("div", Gn, [a("button", {
|
|
1572
1601
|
ref_key: "trigger",
|
|
1573
1602
|
ref: d,
|
|
1574
1603
|
type: "button",
|
|
@@ -1576,32 +1605,32 @@ var En = ["data-test", "data-status"], Dn = { class: "kvc-job-head" }, On = {
|
|
|
1576
1605
|
"aria-haspopup": "dialog",
|
|
1577
1606
|
"aria-expanded": u.value,
|
|
1578
1607
|
"data-test": "jobs-chip",
|
|
1579
|
-
onClick: c[0] ||= (e) => u.value ?
|
|
1608
|
+
onClick: c[0] ||= (e) => u.value ? O() : u.value = !0
|
|
1580
1609
|
}, [
|
|
1581
1610
|
c[1] ||= a("span", {
|
|
1582
1611
|
class: "kvc-dot",
|
|
1583
1612
|
"aria-hidden": "true"
|
|
1584
1613
|
}, null, -1),
|
|
1585
|
-
o(
|
|
1586
|
-
s(
|
|
1614
|
+
o(T(E(l).t("kvcoder.ui.jobs.running", { count: E(h).length })), 1),
|
|
1615
|
+
s(E(oe), {
|
|
1587
1616
|
size: 16,
|
|
1588
1617
|
"aria-hidden": "true"
|
|
1589
1618
|
})
|
|
1590
|
-
], 8,
|
|
1619
|
+
], 8, Kn), u.value ? (g(), i("div", {
|
|
1591
1620
|
key: 0,
|
|
1592
1621
|
class: "kvc-popover kvc-jobs-panel",
|
|
1593
1622
|
role: "dialog",
|
|
1594
|
-
"aria-label":
|
|
1623
|
+
"aria-label": E(l).t("kvcoder.ui.jobs.title"),
|
|
1595
1624
|
"data-test": "jobs-popover",
|
|
1596
|
-
onKeydown:
|
|
1597
|
-
}, [(g(!0), i(e, null, y(
|
|
1625
|
+
onKeydown: M(N(O, ["stop"]), ["esc"])
|
|
1626
|
+
}, [(g(!0), i(e, null, y(E(f), (e) => (g(), n(Wn, {
|
|
1598
1627
|
key: e.id,
|
|
1599
1628
|
job: e,
|
|
1600
|
-
now:
|
|
1601
|
-
logs:
|
|
1602
|
-
stopping:
|
|
1603
|
-
onStop: (t) =>
|
|
1604
|
-
onLogs: (t) =>
|
|
1629
|
+
now: E(x),
|
|
1630
|
+
logs: E(_)[e.id],
|
|
1631
|
+
stopping: E(b).has(e.id),
|
|
1632
|
+
onStop: (t) => E(w)(e.id),
|
|
1633
|
+
onLogs: (t) => E(C)(e.id)
|
|
1605
1634
|
}, null, 8, [
|
|
1606
1635
|
"job",
|
|
1607
1636
|
"now",
|
|
@@ -1609,12 +1638,12 @@ var En = ["data-test", "data-status"], Dn = { class: "kvc-job-head" }, On = {
|
|
|
1609
1638
|
"stopping",
|
|
1610
1639
|
"onStop",
|
|
1611
1640
|
"onLogs"
|
|
1612
|
-
]))), 128))], 40,
|
|
1641
|
+
]))), 128))], 40, qn)) : r("v-if", !0)])) : r("v-if", !0);
|
|
1613
1642
|
}
|
|
1614
1643
|
});
|
|
1615
1644
|
//#endregion
|
|
1616
1645
|
//#region web/src/use-dismiss.ts
|
|
1617
|
-
function
|
|
1646
|
+
function Yn(e, t, n) {
|
|
1618
1647
|
let r = (e) => {
|
|
1619
1648
|
e.target instanceof Node && t()?.contains(e.target) !== !0 && n();
|
|
1620
1649
|
}, i = (e) => {
|
|
@@ -1622,32 +1651,25 @@ function Hn(e, t, n) {
|
|
|
1622
1651
|
}, a = () => {
|
|
1623
1652
|
document.removeEventListener("pointerdown", r), document.removeEventListener("keydown", i);
|
|
1624
1653
|
};
|
|
1625
|
-
|
|
1654
|
+
k(e, (e) => {
|
|
1626
1655
|
a(), e && (document.addEventListener("pointerdown", r), document.addEventListener("keydown", i));
|
|
1627
1656
|
}), p(a);
|
|
1628
1657
|
}
|
|
1629
1658
|
//#endregion
|
|
1630
1659
|
//#region web/src/ConversationHeader.vue?vue&type=script&setup=true&lang.ts
|
|
1631
|
-
var
|
|
1660
|
+
var Xn = { class: "kvc-header" }, Zn = { class: "kvc-title" }, Qn = ["aria-label"], $n = {
|
|
1632
1661
|
key: 1,
|
|
1633
1662
|
"data-test": "session-title"
|
|
1634
|
-
},
|
|
1635
|
-
class: "kvc-muted",
|
|
1636
|
-
"data-test": "session-totals"
|
|
1637
|
-
}, Jn = {
|
|
1638
|
-
key: 2,
|
|
1639
|
-
class: "kvc-muted",
|
|
1640
|
-
"data-test": "session-context"
|
|
1641
|
-
}, Yn = [
|
|
1663
|
+
}, er = { class: "kvc-muted kvc-header-stats" }, tr = ["title"], nr = ["title", "aria-label"], rr = [
|
|
1642
1664
|
"aria-pressed",
|
|
1643
1665
|
"aria-label",
|
|
1644
1666
|
"title"
|
|
1645
|
-
],
|
|
1667
|
+
], ir = ["aria-label", "aria-expanded"], ar = {
|
|
1646
1668
|
key: 0,
|
|
1647
1669
|
class: "kvc-menu",
|
|
1648
1670
|
role: "menu",
|
|
1649
1671
|
"data-test": "chat-menu-items"
|
|
1650
|
-
},
|
|
1672
|
+
}, or = ["disabled"], sr = ["disabled"], cr = ["disabled"], lr = ["disabled"], ur = ["aria-label"], dr = { style: { padding: "6px" } }, fr = { class: "kvc-actions" }, pr = /* @__PURE__ */ c({
|
|
1651
1673
|
__name: "ConversationHeader",
|
|
1652
1674
|
props: {
|
|
1653
1675
|
session: {},
|
|
@@ -1670,178 +1692,197 @@ var Un = { class: "kvc-header" }, Wn = { class: "kvc-title" }, Gn = ["aria-label
|
|
|
1670
1692
|
"action",
|
|
1671
1693
|
"toggleArtifacts"
|
|
1672
1694
|
],
|
|
1673
|
-
setup(
|
|
1674
|
-
let
|
|
1675
|
-
function
|
|
1676
|
-
|
|
1695
|
+
setup(n, { emit: c }) {
|
|
1696
|
+
let l = n, u = c, d = G(), f = v(!1), p = v(null), m = v(!1), h = D("more"), _ = wn(), y = t(() => l.runningSince === void 0 ? 0 : Math.max(0, _.value - Date.parse(l.runningSince))), b = t(() => et(d.t, l.session.usage, l.session.durationMs + y.value)), x = t(() => `${d.t("kvcoder.ui.turns", { count: l.turns })} · ${tt(d.t, l.session.usage)}`), S = t(() => nt(d.t, l.context)), C = t(() => d.t("kvcoder.ui.artifacts.toggle", { count: l.artifacts }));
|
|
1697
|
+
function w() {
|
|
1698
|
+
f.value = !1, m.value = !1;
|
|
1677
1699
|
}
|
|
1678
|
-
|
|
1679
|
-
function
|
|
1680
|
-
|
|
1700
|
+
Yn(() => f.value || m.value, () => h.value, w);
|
|
1701
|
+
function k(e) {
|
|
1702
|
+
w(), e();
|
|
1681
1703
|
}
|
|
1682
|
-
function
|
|
1683
|
-
let e =
|
|
1684
|
-
|
|
1704
|
+
function A() {
|
|
1705
|
+
let e = p.value ?? "";
|
|
1706
|
+
p.value = null, u("action", "rename", e);
|
|
1685
1707
|
}
|
|
1686
|
-
return (
|
|
1687
|
-
a("div",
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
"
|
|
1703
|
-
|
|
1708
|
+
return (t, n) => (g(), i("header", Xn, [
|
|
1709
|
+
a("div", Zn, [p.value === null ? (g(), i("strong", $n, T(E(Be)(E(d).t, l.session.title)), 1)) : (g(), i("form", {
|
|
1710
|
+
key: 0,
|
|
1711
|
+
onSubmit: N(A, ["prevent"])
|
|
1712
|
+
}, [j(a("input", {
|
|
1713
|
+
"onUpdate:modelValue": n[0] ||= (e) => p.value = e,
|
|
1714
|
+
class: "kvc-field",
|
|
1715
|
+
"aria-label": E(d).t("kvcoder.ui.rename"),
|
|
1716
|
+
"data-test": "rename-input",
|
|
1717
|
+
onBlur: A
|
|
1718
|
+
}, null, 40, Qn), [[O, p.value]])], 32)), a("span", er, [a("span", {
|
|
1719
|
+
title: x.value,
|
|
1720
|
+
"data-test": "session-totals"
|
|
1721
|
+
}, T(b.value), 9, tr), S.value === void 0 ? r("v-if", !0) : (g(), i(e, { key: 0 }, [n[11] ||= o(" · ", -1), a("span", {
|
|
1722
|
+
title: S.value.full,
|
|
1723
|
+
"aria-label": S.value.full,
|
|
1724
|
+
"data-test": "session-context"
|
|
1725
|
+
}, T(S.value.short), 9, nr)], 64))])]),
|
|
1726
|
+
s(Jn, {
|
|
1727
|
+
"session-id": l.session.id,
|
|
1728
|
+
stamp: l.session.updatedAt
|
|
1704
1729
|
}, null, 8, ["session-id", "stamp"]),
|
|
1705
|
-
|
|
1730
|
+
l.artifacts > 0 ? (g(), i("button", {
|
|
1706
1731
|
key: 0,
|
|
1707
1732
|
type: "button",
|
|
1708
1733
|
class: "kvc-button",
|
|
1709
|
-
"aria-pressed":
|
|
1710
|
-
"aria-label":
|
|
1711
|
-
title:
|
|
1734
|
+
"aria-pressed": l.artifactsOpen,
|
|
1735
|
+
"aria-label": C.value,
|
|
1736
|
+
title: C.value,
|
|
1712
1737
|
"data-test": "artifacts-toggle",
|
|
1713
|
-
onClick:
|
|
1714
|
-
}, [s(
|
|
1738
|
+
onClick: n[1] ||= (e) => u("toggleArtifacts")
|
|
1739
|
+
}, [s(E(ye), {
|
|
1715
1740
|
size: 16,
|
|
1716
1741
|
"aria-hidden": "true"
|
|
1717
|
-
}), o(
|
|
1742
|
+
}), o(T(l.artifacts), 1)], 8, rr)) : r("v-if", !0),
|
|
1718
1743
|
a("div", {
|
|
1719
1744
|
ref_key: "more",
|
|
1720
|
-
ref:
|
|
1745
|
+
ref: h,
|
|
1721
1746
|
style: { position: "relative" }
|
|
1722
1747
|
}, [
|
|
1723
1748
|
a("button", {
|
|
1724
1749
|
type: "button",
|
|
1725
1750
|
class: "kvc-button kvc-ghost",
|
|
1726
|
-
"aria-label":
|
|
1727
|
-
"aria-expanded":
|
|
1751
|
+
"aria-label": E(d).t("kvcoder.ui.menu"),
|
|
1752
|
+
"aria-expanded": f.value,
|
|
1728
1753
|
"data-test": "chat-menu",
|
|
1729
|
-
onClick:
|
|
1730
|
-
|
|
1754
|
+
onClick: n[2] ||= (e) => {
|
|
1755
|
+
f.value = !f.value, m.value = !1;
|
|
1731
1756
|
}
|
|
1732
|
-
}, [s(
|
|
1733
|
-
|
|
1757
|
+
}, [s(E(fe), { size: 18 })], 8, ir),
|
|
1758
|
+
f.value ? (g(), i("div", ar, [
|
|
1734
1759
|
a("button", {
|
|
1735
1760
|
type: "button",
|
|
1736
1761
|
role: "menuitem",
|
|
1737
1762
|
class: "kvc-button kvc-ghost",
|
|
1738
1763
|
"data-test": "menu-rename",
|
|
1739
|
-
disabled:
|
|
1740
|
-
onClick:
|
|
1741
|
-
},
|
|
1764
|
+
disabled: l.working,
|
|
1765
|
+
onClick: n[3] ||= (e) => k(() => p.value = l.session.title)
|
|
1766
|
+
}, T(E(d).t("kvcoder.ui.rename")), 9, or),
|
|
1742
1767
|
a("button", {
|
|
1743
1768
|
type: "button",
|
|
1744
1769
|
role: "menuitem",
|
|
1745
1770
|
class: "kvc-button kvc-ghost",
|
|
1746
1771
|
"data-test": "menu-fork",
|
|
1747
|
-
disabled:
|
|
1748
|
-
onClick:
|
|
1749
|
-
},
|
|
1772
|
+
disabled: l.working,
|
|
1773
|
+
onClick: n[4] ||= (e) => k(() => u("action", "fork", ""))
|
|
1774
|
+
}, T(E(d).t("kvcoder.ui.fork")), 9, sr),
|
|
1750
1775
|
a("button", {
|
|
1751
1776
|
type: "button",
|
|
1752
1777
|
role: "menuitem",
|
|
1753
1778
|
class: "kvc-button kvc-ghost",
|
|
1754
1779
|
"data-test": "menu-export",
|
|
1755
|
-
disabled:
|
|
1756
|
-
onClick:
|
|
1757
|
-
},
|
|
1780
|
+
disabled: l.working,
|
|
1781
|
+
onClick: n[5] ||= (e) => k(() => u("action", "export", ""))
|
|
1782
|
+
}, T(E(d).t("kvcoder.ui.export")), 9, cr),
|
|
1758
1783
|
a("button", {
|
|
1759
1784
|
type: "button",
|
|
1760
1785
|
role: "menuitem",
|
|
1761
1786
|
class: "kvc-button kvc-ghost",
|
|
1762
1787
|
"data-test": "menu-compact",
|
|
1763
|
-
disabled:
|
|
1764
|
-
onClick:
|
|
1765
|
-
},
|
|
1788
|
+
disabled: l.working,
|
|
1789
|
+
onClick: n[6] ||= (e) => k(() => u("action", "compact", ""))
|
|
1790
|
+
}, T(E(d).t("kvcoder.ui.compact")), 9, lr),
|
|
1766
1791
|
a("button", {
|
|
1767
1792
|
type: "button",
|
|
1768
1793
|
role: "menuitem",
|
|
1769
1794
|
class: "kvc-button kvc-ghost",
|
|
1770
1795
|
"data-test": "menu-prompt",
|
|
1771
|
-
onClick:
|
|
1772
|
-
},
|
|
1796
|
+
onClick: n[7] ||= (e) => k(() => u("tab", l.tab === "prompt" ? "chat" : "prompt"))
|
|
1797
|
+
}, T(E(d).t(l.tab === "prompt" ? "kvcoder.ui.showChat" : "kvcoder.ui.showPrompt")), 1),
|
|
1773
1798
|
a("button", {
|
|
1774
1799
|
type: "button",
|
|
1775
1800
|
role: "menuitem",
|
|
1776
1801
|
class: "kvc-button kvc-ghost kvc-danger",
|
|
1777
1802
|
"data-test": "menu-delete",
|
|
1778
|
-
onClick:
|
|
1779
|
-
|
|
1803
|
+
onClick: n[8] ||= (e) => {
|
|
1804
|
+
f.value = !1, m.value = !0;
|
|
1780
1805
|
}
|
|
1781
|
-
},
|
|
1806
|
+
}, T(E(d).t("kvcoder.ui.delete")), 1)
|
|
1782
1807
|
])) : r("v-if", !0),
|
|
1783
|
-
|
|
1808
|
+
m.value ? (g(), i("div", {
|
|
1784
1809
|
key: 1,
|
|
1785
1810
|
class: "kvc-menu",
|
|
1786
1811
|
role: "alertdialog",
|
|
1787
|
-
"aria-label":
|
|
1812
|
+
"aria-label": E(d).t("kvcoder.ui.deleteConfirm"),
|
|
1788
1813
|
"data-test": "delete-confirm"
|
|
1789
|
-
}, [a("span",
|
|
1814
|
+
}, [a("span", dr, T(E(d).t("kvcoder.ui.deleteConfirm")), 1), a("div", fr, [a("button", {
|
|
1790
1815
|
type: "button",
|
|
1791
1816
|
class: "kvc-button",
|
|
1792
|
-
onClick:
|
|
1793
|
-
},
|
|
1817
|
+
onClick: n[9] ||= (e) => m.value = !1
|
|
1818
|
+
}, T(E(d).t("kvcoder.ui.cancel")), 1), a("button", {
|
|
1794
1819
|
type: "button",
|
|
1795
1820
|
class: "kvc-button kvc-primary",
|
|
1796
1821
|
"data-test": "confirm-delete",
|
|
1797
|
-
onClick:
|
|
1798
|
-
},
|
|
1822
|
+
onClick: n[10] ||= (e) => k(() => u("action", "delete", ""))
|
|
1823
|
+
}, T(E(d).t("kvcoder.ui.delete")), 1)])], 8, ur)) : r("v-if", !0)
|
|
1799
1824
|
], 512)
|
|
1800
1825
|
]));
|
|
1801
1826
|
}
|
|
1802
|
-
}),
|
|
1827
|
+
}), mr = 200, hr = [
|
|
1803
1828
|
"text",
|
|
1804
1829
|
"choice",
|
|
1805
1830
|
"confirm"
|
|
1806
1831
|
];
|
|
1807
|
-
function
|
|
1832
|
+
function gr(e) {
|
|
1808
1833
|
return typeof e == "object" && e && !Array.isArray(e) ? Object.fromEntries(Object.entries(e)) : void 0;
|
|
1809
1834
|
}
|
|
1810
|
-
var
|
|
1811
|
-
function
|
|
1812
|
-
let n =
|
|
1813
|
-
return
|
|
1835
|
+
var J = (e) => typeof e == "string" && e.trim() !== "" ? e : void 0;
|
|
1836
|
+
function _r(e, t) {
|
|
1837
|
+
let n = J(t.args);
|
|
1838
|
+
return J(t.line) ?? (n === void 0 ? e : `${e} ${n}`);
|
|
1814
1839
|
}
|
|
1815
|
-
function
|
|
1816
|
-
let t =
|
|
1840
|
+
function vr(e) {
|
|
1841
|
+
let t = J(e.title) ?? J(e.description), n = J(e.command);
|
|
1817
1842
|
return {
|
|
1818
1843
|
...t === void 0 ? {} : { description: t },
|
|
1819
1844
|
...n === void 0 ? {} : { line: n },
|
|
1820
1845
|
...e.mode === "async" ? { background: !0 } : {}
|
|
1821
1846
|
};
|
|
1822
1847
|
}
|
|
1823
|
-
function
|
|
1824
|
-
let t =
|
|
1825
|
-
if (t === void 0) return
|
|
1826
|
-
let r =
|
|
1848
|
+
function yr(e) {
|
|
1849
|
+
let t = J(e.connector), n = J(e.command);
|
|
1850
|
+
if (t === void 0) return vr(e);
|
|
1851
|
+
let r = J(e.description), i = gr(typeof e.payload == "string" ? void 0 : e.payload) ?? {}, a = t === "ask" ? hr.find((e) => e === n) : void 0;
|
|
1827
1852
|
return {
|
|
1828
1853
|
...r === void 0 ? {} : { description: r },
|
|
1829
|
-
|
|
1830
|
-
...
|
|
1854
|
+
connector: t,
|
|
1855
|
+
...n === void 0 ? {} : {
|
|
1856
|
+
command: n,
|
|
1857
|
+
label: `${t} · ${n}`
|
|
1858
|
+
},
|
|
1859
|
+
...n === "exec" ? { line: _r(t, i) } : {},
|
|
1860
|
+
fields: i,
|
|
1861
|
+
...i.risky === !0 ? { risky: !0 } : {},
|
|
1831
1862
|
...i.background === !0 ? { background: !0 } : {},
|
|
1832
|
-
...
|
|
1833
|
-
kind:
|
|
1863
|
+
...a === void 0 ? {} : { ask: {
|
|
1864
|
+
kind: a,
|
|
1834
1865
|
question: i
|
|
1835
1866
|
} }
|
|
1836
1867
|
};
|
|
1837
1868
|
}
|
|
1838
|
-
|
|
1869
|
+
var br = [
|
|
1870
|
+
"edit",
|
|
1871
|
+
"write",
|
|
1872
|
+
"read",
|
|
1873
|
+
"list",
|
|
1874
|
+
"search"
|
|
1875
|
+
];
|
|
1876
|
+
function xr(e) {
|
|
1877
|
+
return e.line === void 0 ? e.connector === "fs" ? br.find((t) => t === e.command) ?? "fields" : e.connector === "mcp" && e.command === "call" ? "mcp-call" : e.connector === "delegate" && e.command === "run" ? "delegate" : "fields" : "line";
|
|
1878
|
+
}
|
|
1879
|
+
function Sr(e) {
|
|
1839
1880
|
let t = e.replace(/\s+/g, " ");
|
|
1840
|
-
return t.length >
|
|
1881
|
+
return t.length > mr ? `${t.slice(0, mr)}…` : t;
|
|
1841
1882
|
}
|
|
1842
1883
|
//#endregion
|
|
1843
1884
|
//#region web/src/live-step.ts
|
|
1844
|
-
var
|
|
1885
|
+
var Cr = () => ({
|
|
1845
1886
|
text: "",
|
|
1846
1887
|
thinking: "",
|
|
1847
1888
|
summarizing: !1,
|
|
@@ -1849,28 +1890,28 @@ var fr = () => ({
|
|
|
1849
1890
|
retry: null,
|
|
1850
1891
|
startedAt: Date.now()
|
|
1851
1892
|
});
|
|
1852
|
-
function
|
|
1893
|
+
function wr(e) {
|
|
1853
1894
|
return typeof e == "object" && e && !Array.isArray(e) ? Object.fromEntries(Object.entries(e)) : void 0;
|
|
1854
1895
|
}
|
|
1855
|
-
function
|
|
1896
|
+
function Tr(e) {
|
|
1856
1897
|
let t = e.calls.at(-1);
|
|
1857
1898
|
return t === void 0 ? e.text === "" ? e.thinking === "" ? e.retry === null ? "waiting" : "retrying" : "thinking" : "writing" : t.complete ? "running" : "preparing";
|
|
1858
1899
|
}
|
|
1859
|
-
function
|
|
1860
|
-
let r =
|
|
1900
|
+
function Er(e, t, n) {
|
|
1901
|
+
let r = wr(t.arguments);
|
|
1861
1902
|
(r === void 0 || e.calls.length === 0) && e.calls.push({
|
|
1862
1903
|
name: n,
|
|
1863
1904
|
complete: !1
|
|
1864
1905
|
});
|
|
1865
1906
|
let i = e.calls.at(-1);
|
|
1866
1907
|
if (r === void 0 || i === void 0) return;
|
|
1867
|
-
let a =
|
|
1908
|
+
let a = yr(r);
|
|
1868
1909
|
a.description !== void 0 && (i.description = a.description), a.label !== void 0 && (i.label = a.label), i.complete = "payload" in r;
|
|
1869
1910
|
}
|
|
1870
|
-
function
|
|
1911
|
+
function Dr(e, t) {
|
|
1871
1912
|
if (t.type !== "progress") return { kind: "none" };
|
|
1872
|
-
let n =
|
|
1873
|
-
return n === void 0 ? { kind: "none" } : t.source === "@kvman/kvai" && !e.summarizing ? (e.retry = null, e.calls.some((e) => e.carried === !0) && (e.calls = []), n.type === "text" && typeof n.delta == "string" && (e.text += n.delta), n.type === "thinking" && typeof n.delta == "string" && (e.thinking += n.delta), n.type === "toolcall" && typeof n.name == "string" &&
|
|
1913
|
+
let n = wr(t.data);
|
|
1914
|
+
return n === void 0 ? { kind: "none" } : t.source === "@kvman/kvai" && !e.summarizing ? (e.retry = null, e.calls.some((e) => e.carried === !0) && (e.calls = []), n.type === "text" && typeof n.delta == "string" && (e.text += n.delta), n.type === "thinking" && typeof n.delta == "string" && (e.thinking += n.delta), n.type === "toolcall" && typeof n.name == "string" && Er(e, n, n.name), { kind: "none" }) : t.source === "@kvman/kvcoder" ? (n.type === "compaction" && (e.summarizing = n.state === "started"), n.type === "retry" && typeof n.attempt == "number" && typeof n.of == "number" && (e.retry = {
|
|
1874
1915
|
attempt: n.attempt,
|
|
1875
1916
|
of: n.of
|
|
1876
1917
|
}), n.type === "follow" && typeof n.jobId == "string" ? {
|
|
@@ -1884,30 +1925,30 @@ function gr(e, t) {
|
|
|
1884
1925
|
}
|
|
1885
1926
|
//#endregion
|
|
1886
1927
|
//#region web/src/ActivityLine.vue?vue&type=script&setup=true&lang.ts
|
|
1887
|
-
var
|
|
1928
|
+
var Or = ["data-phase"], kr = { class: "kvc-activity-text" }, Ar = {
|
|
1888
1929
|
style: { "font-weight": "600" },
|
|
1889
1930
|
"data-test": "activity-title"
|
|
1890
|
-
},
|
|
1931
|
+
}, jr = {
|
|
1891
1932
|
key: 0,
|
|
1892
1933
|
class: "kvc-muted",
|
|
1893
1934
|
dir: "ltr",
|
|
1894
1935
|
"data-test": "activity-label"
|
|
1895
|
-
},
|
|
1936
|
+
}, Mr = {
|
|
1896
1937
|
key: 1,
|
|
1897
1938
|
style: { "font-weight": "500" },
|
|
1898
1939
|
"data-test": "activity-title"
|
|
1899
|
-
},
|
|
1940
|
+
}, Nr = {
|
|
1900
1941
|
key: 0,
|
|
1901
1942
|
class: "kvc-muted",
|
|
1902
1943
|
"data-test": "activity-phase"
|
|
1903
|
-
},
|
|
1944
|
+
}, Pr = {
|
|
1904
1945
|
class: "kvc-muted",
|
|
1905
1946
|
"data-test": "activity-seconds"
|
|
1906
|
-
},
|
|
1947
|
+
}, Fr = /* @__PURE__ */ c({
|
|
1907
1948
|
__name: "ActivityLine",
|
|
1908
1949
|
props: { live: {} },
|
|
1909
1950
|
setup(n) {
|
|
1910
|
-
let o = n, s =
|
|
1951
|
+
let o = n, s = G(), c = wn(), l = t(() => Tr(o.live)), u = t(() => Math.max(0, Math.floor((c.value - o.live.startedAt) / 1e3)));
|
|
1911
1952
|
return (t, n) => (g(), i("div", {
|
|
1912
1953
|
class: "kvc-activity",
|
|
1913
1954
|
role: "status",
|
|
@@ -1919,99 +1960,103 @@ var _r = ["data-phase"], vr = { class: "kvc-activity-text" }, yr = {
|
|
|
1919
1960
|
class: "kvc-spin",
|
|
1920
1961
|
"aria-hidden": "true"
|
|
1921
1962
|
}, null, -1),
|
|
1922
|
-
a("span",
|
|
1963
|
+
a("span", kr, [o.live.calls.length > 0 ? (g(!0), i(e, { key: 0 }, y(o.live.calls, (e, t) => (g(), i("span", {
|
|
1923
1964
|
key: t,
|
|
1924
1965
|
class: "kvc-activity-call",
|
|
1925
1966
|
"data-test": "activity-call"
|
|
1926
|
-
}, [a("span",
|
|
1927
|
-
o.live.calls.length > 0 ? (g(), i("span",
|
|
1928
|
-
a("span",
|
|
1929
|
-
], 8,
|
|
1967
|
+
}, [a("span", Ar, T(e.description ?? E(s).t("kvcoder.ui.activity.preparing")), 1), e.label ? (g(), i("span", jr, T(e.label), 1)) : r("v-if", !0)]))), 128)) : (g(), i("span", Mr, T(E(s).t(`kvcoder.ui.activity.${l.value}`, o.live.retry ?? {})), 1))]),
|
|
1968
|
+
o.live.calls.length > 0 ? (g(), i("span", Nr, T(E(s).t(`kvcoder.ui.activity.${l.value}`)), 1)) : r("v-if", !0),
|
|
1969
|
+
a("span", Pr, T(E(s).t("kvcoder.ui.seconds", { count: u.value })), 1)
|
|
1970
|
+
], 8, Or));
|
|
1930
1971
|
}
|
|
1931
1972
|
});
|
|
1932
1973
|
//#endregion
|
|
1933
1974
|
//#region web/src/message-parts.ts
|
|
1934
|
-
function
|
|
1975
|
+
function Y(e) {
|
|
1935
1976
|
return typeof e == "object" && e && !Array.isArray(e) ? Object.fromEntries(Object.entries(e)) : void 0;
|
|
1936
1977
|
}
|
|
1937
|
-
function
|
|
1978
|
+
function Ir(e) {
|
|
1938
1979
|
return Array.isArray(e) ? e.flatMap((e) => {
|
|
1939
|
-
let t =
|
|
1980
|
+
let t = Y(e);
|
|
1940
1981
|
return t === void 0 ? [] : [t];
|
|
1941
1982
|
}) : [];
|
|
1942
1983
|
}
|
|
1943
|
-
function
|
|
1944
|
-
return typeof e == "string" ? e :
|
|
1984
|
+
function Lr(e) {
|
|
1985
|
+
return typeof e == "string" ? e : Ir(e).flatMap((e) => e.type === "text" && typeof e.text == "string" ? [e.text] : []).join("\n");
|
|
1945
1986
|
}
|
|
1946
|
-
function
|
|
1947
|
-
return
|
|
1987
|
+
function Rr(e) {
|
|
1988
|
+
return Ir(e.content.content).flatMap((e) => e.type === "thinking" && typeof e.thinking == "string" ? [e.thinking] : []).join("\n");
|
|
1948
1989
|
}
|
|
1949
|
-
function
|
|
1990
|
+
function zr(e) {
|
|
1950
1991
|
let t = /* @__PURE__ */ new Map();
|
|
1951
1992
|
for (let n of e) {
|
|
1952
1993
|
if (n.kind !== "assistant") continue;
|
|
1953
1994
|
let e = typeof n.durationMs == "number" ? { writtenMs: n.durationMs } : {};
|
|
1954
|
-
for (let r of
|
|
1955
|
-
let n =
|
|
1995
|
+
for (let r of Ir(n.content.content)) {
|
|
1996
|
+
let n = Y(r.arguments);
|
|
1956
1997
|
r.type === "toolCall" && typeof r.id == "string" && n !== void 0 && t.set(r.id, {
|
|
1957
|
-
...
|
|
1998
|
+
...yr(n),
|
|
1958
1999
|
...e
|
|
1959
2000
|
});
|
|
1960
2001
|
}
|
|
1961
2002
|
}
|
|
1962
2003
|
return t;
|
|
1963
2004
|
}
|
|
1964
|
-
function
|
|
2005
|
+
function Br(e, t) {
|
|
1965
2006
|
let { description: n, connector: r, command: i } = e;
|
|
1966
2007
|
return typeof r == "string" ? {
|
|
1967
2008
|
...t,
|
|
2009
|
+
connector: r,
|
|
1968
2010
|
...typeof n == "string" ? { description: n } : {},
|
|
1969
|
-
...typeof i == "string" ? {
|
|
2011
|
+
...typeof i == "string" ? {
|
|
2012
|
+
command: i,
|
|
2013
|
+
label: `${r} · ${i}`
|
|
2014
|
+
} : {},
|
|
1970
2015
|
...e.background === !0 ? { background: !0 } : {}
|
|
1971
2016
|
} : {
|
|
1972
2017
|
...t,
|
|
1973
|
-
...
|
|
2018
|
+
...yr(e)
|
|
1974
2019
|
};
|
|
1975
2020
|
}
|
|
1976
|
-
function
|
|
1977
|
-
let n =
|
|
2021
|
+
function Vr(e, t) {
|
|
2022
|
+
let n = Y(e.content.details), r = Lr(e.content.content), i = /\n?\[exit code (\d+)\]$/.exec(r), a = t.get(String(e.content.toolCallId)), o = typeof n?.exitCode == "number" ? n.exitCode : i === null ? void 0 : Number(i[1]);
|
|
1978
2023
|
return {
|
|
1979
|
-
...n === void 0 ? a :
|
|
2024
|
+
...n === void 0 ? a : Br(n, a),
|
|
1980
2025
|
output: typeof n?.output == "string" ? n.output : n === void 0 ? r.replace(/\n?\[exit code \d+\]$/, "") : r,
|
|
1981
2026
|
failed: e.content.isError === !0 || o !== void 0 && o !== 0,
|
|
1982
2027
|
...typeof n?.durationMs == "number" ? { durationMs: n.durationMs } : {}
|
|
1983
2028
|
};
|
|
1984
2029
|
}
|
|
1985
|
-
var
|
|
1986
|
-
function
|
|
1987
|
-
if (e ===
|
|
2030
|
+
var Hr = "dismissed by the user";
|
|
2031
|
+
function Ur(e) {
|
|
2032
|
+
if (e === Hr) return { dismissed: !0 };
|
|
1988
2033
|
try {
|
|
1989
|
-
return
|
|
2034
|
+
return Y(JSON.parse(e));
|
|
1990
2035
|
} catch {
|
|
1991
2036
|
return;
|
|
1992
2037
|
}
|
|
1993
2038
|
}
|
|
1994
|
-
function
|
|
2039
|
+
function Wr(e, t) {
|
|
1995
2040
|
if (e.kind !== "toolResult" || e.content.isError === !0) return;
|
|
1996
2041
|
let n = t.get(String(e.content.toolCallId))?.ask;
|
|
1997
2042
|
if (n === void 0) return;
|
|
1998
|
-
let r =
|
|
2043
|
+
let r = Ur(Lr(e.content.content));
|
|
1999
2044
|
return r === void 0 ? void 0 : {
|
|
2000
2045
|
...n,
|
|
2001
2046
|
answer: r
|
|
2002
2047
|
};
|
|
2003
2048
|
}
|
|
2004
|
-
function
|
|
2049
|
+
function Gr(e) {
|
|
2005
2050
|
return e.kind === "user" && e.source?.kind === "extension" && e.source.name === "@kvman/kvcoder";
|
|
2006
2051
|
}
|
|
2007
|
-
function
|
|
2052
|
+
function Kr(e) {
|
|
2008
2053
|
return e.kind === "user" && (e.source?.kind === "job" || e.source?.kind === "subagent");
|
|
2009
2054
|
}
|
|
2010
|
-
function
|
|
2055
|
+
function qr(e) {
|
|
2011
2056
|
if (e.kind !== "toolResult") return;
|
|
2012
|
-
let t =
|
|
2057
|
+
let t = Y(e.content.details);
|
|
2013
2058
|
if (t === void 0) return;
|
|
2014
|
-
let n =
|
|
2059
|
+
let n = Y(t.artifact);
|
|
2015
2060
|
if (n === void 0) return;
|
|
2016
2061
|
let { id: r, title: i, format: a, version: o } = n;
|
|
2017
2062
|
if (typeof r == "string" && typeof i == "string" && typeof o == "number" && (a === "markdown" || a === "html" || a === "url")) return {
|
|
@@ -2021,11 +2066,23 @@ function Ir(e) {
|
|
|
2021
2066
|
version: o
|
|
2022
2067
|
};
|
|
2023
2068
|
}
|
|
2069
|
+
var Jr = /\n\nAttached files:\n((?:- .+\n?)+)$/;
|
|
2070
|
+
function Yr(e, t) {
|
|
2071
|
+
return e.replace(Jr, (e, n) => `\n\n${t}\n${n}`);
|
|
2072
|
+
}
|
|
2073
|
+
function Xr(e) {
|
|
2074
|
+
if (e.kind === "user") return e.source?.kind === "job" ? e.source.jobId : e.source?.kind === "subagent" ? e.source.sessionId : void 0;
|
|
2075
|
+
}
|
|
2076
|
+
var Zr = /^The background call `([\s\S]*?)` \(job [^)\n]+\) finished:\n/;
|
|
2077
|
+
function Qr(e) {
|
|
2078
|
+
let t = Zr.exec(Lr(e.content.content))?.[1]?.trim();
|
|
2079
|
+
return t === void 0 || t === "" ? void 0 : t;
|
|
2080
|
+
}
|
|
2024
2081
|
//#endregion
|
|
2025
2082
|
//#region web/src/question-options.ts
|
|
2026
|
-
function
|
|
2083
|
+
function $r(e) {
|
|
2027
2084
|
return (Array.isArray(e.options) ? e.options : []).map((e) => {
|
|
2028
|
-
let t =
|
|
2085
|
+
let t = K(e);
|
|
2029
2086
|
return {
|
|
2030
2087
|
id: String(t.id),
|
|
2031
2088
|
label: String(t.label),
|
|
@@ -2035,56 +2092,56 @@ function Lr(e) {
|
|
|
2035
2092
|
}
|
|
2036
2093
|
//#endregion
|
|
2037
2094
|
//#region web/src/AnsweredCard.vue?vue&type=script&setup=true&lang.ts
|
|
2038
|
-
var
|
|
2095
|
+
var ei = ["aria-label"], ti = {
|
|
2039
2096
|
class: "kvc-card-row",
|
|
2040
2097
|
style: { "font-weight": "600" }
|
|
2041
|
-
},
|
|
2098
|
+
}, ni = {
|
|
2042
2099
|
dir: "auto",
|
|
2043
2100
|
"data-test": "answered-prompt"
|
|
2044
|
-
},
|
|
2101
|
+
}, ri = { class: "kvc-card-body" }, ii = {
|
|
2045
2102
|
key: 0,
|
|
2046
2103
|
class: "kvc-muted",
|
|
2047
2104
|
"data-test": "answered-skipped"
|
|
2048
|
-
},
|
|
2105
|
+
}, ai = ["data-chosen", "data-test"], oi = {
|
|
2049
2106
|
key: 1,
|
|
2050
2107
|
class: "kvc-answered-gap",
|
|
2051
2108
|
"aria-hidden": "true"
|
|
2052
|
-
},
|
|
2109
|
+
}, si = { style: {
|
|
2053
2110
|
display: "flex",
|
|
2054
2111
|
"flex-direction": "column"
|
|
2055
|
-
} },
|
|
2112
|
+
} }, ci = { dir: "auto" }, li = {
|
|
2056
2113
|
key: 0,
|
|
2057
2114
|
class: "kvc-muted",
|
|
2058
2115
|
dir: "auto"
|
|
2059
|
-
},
|
|
2116
|
+
}, ui = {
|
|
2060
2117
|
key: 2,
|
|
2061
2118
|
class: "kvc-sr"
|
|
2062
|
-
},
|
|
2119
|
+
}, di = {
|
|
2063
2120
|
key: 0,
|
|
2064
2121
|
class: "kvc-answered-option",
|
|
2065
2122
|
"data-chosen": "true",
|
|
2066
2123
|
"data-test": "answered-other"
|
|
2067
|
-
},
|
|
2124
|
+
}, fi = { style: {
|
|
2068
2125
|
display: "flex",
|
|
2069
2126
|
"flex-direction": "column"
|
|
2070
|
-
} },
|
|
2127
|
+
} }, pi = { class: "kvc-muted" }, mi = {
|
|
2071
2128
|
dir: "auto",
|
|
2072
2129
|
style: { "white-space": "pre-wrap" }
|
|
2073
|
-
},
|
|
2130
|
+
}, hi = {
|
|
2074
2131
|
key: 2,
|
|
2075
2132
|
class: "kvc-chip",
|
|
2076
2133
|
style: { "align-self": "flex-start" },
|
|
2077
2134
|
"data-test": "answered-confirmed"
|
|
2078
|
-
},
|
|
2135
|
+
}, gi = {
|
|
2079
2136
|
key: 3,
|
|
2080
2137
|
dir: "auto",
|
|
2081
2138
|
style: { "white-space": "pre-wrap" },
|
|
2082
2139
|
"data-test": "answered-text"
|
|
2083
|
-
},
|
|
2140
|
+
}, _i = /* @__PURE__ */ c({
|
|
2084
2141
|
__name: "AnsweredCard",
|
|
2085
2142
|
props: { answered: {} },
|
|
2086
2143
|
setup(o) {
|
|
2087
|
-
let c = o, l =
|
|
2144
|
+
let c = o, l = G(), u = t(() => String(c.answered.question.prompt ?? "")), d = t(() => c.answered.answer.dismissed === !0), f = t(() => Array.isArray(c.answered.answer.selected) ? c.answered.answer.selected : []), p = t(() => $r(c.answered.question).map((e) => ({
|
|
2088
2145
|
...e,
|
|
2089
2146
|
chosen: f.value.includes(e.id)
|
|
2090
2147
|
}))), m = t(() => typeof c.answered.answer.other == "string" ? c.answered.answer.other : ""), h = t(() => typeof c.answered.answer.text == "string" ? c.answered.answer.text : "");
|
|
@@ -2092,34 +2149,34 @@ var Rr = ["aria-label"], zr = {
|
|
|
2092
2149
|
class: "kvc-card",
|
|
2093
2150
|
"data-test": "answered-card",
|
|
2094
2151
|
"aria-label": u.value
|
|
2095
|
-
}, [a("div",
|
|
2152
|
+
}, [a("div", ti, [s(E(ce), {
|
|
2096
2153
|
size: 18,
|
|
2097
2154
|
"aria-hidden": "true",
|
|
2098
2155
|
class: "kvc-ok"
|
|
2099
|
-
}), a("span",
|
|
2156
|
+
}), a("span", ni, T(u.value), 1)]), a("div", ri, [d.value ? (g(), i("span", ii, T(E(l).t("kvcoder.ui.skipped")), 1)) : c.answered.kind === "choice" ? (g(), i(e, { key: 1 }, [(g(!0), i(e, null, y(p.value, (e) => (g(), i("div", {
|
|
2100
2157
|
key: e.id,
|
|
2101
2158
|
class: "kvc-answered-option",
|
|
2102
2159
|
"data-chosen": e.chosen,
|
|
2103
2160
|
"data-test": `answered-option-${e.id}`
|
|
2104
2161
|
}, [
|
|
2105
|
-
e.chosen ? (g(), n(
|
|
2162
|
+
e.chosen ? (g(), n(E(ae), {
|
|
2106
2163
|
key: 0,
|
|
2107
2164
|
size: 16,
|
|
2108
2165
|
"aria-hidden": "true",
|
|
2109
2166
|
class: "kvc-ok"
|
|
2110
|
-
})) : (g(), i("span",
|
|
2111
|
-
a("span",
|
|
2112
|
-
e.chosen ? (g(), i("span",
|
|
2113
|
-
], 8,
|
|
2167
|
+
})) : (g(), i("span", oi)),
|
|
2168
|
+
a("span", si, [a("span", ci, T(e.label), 1), e.description ? (g(), i("span", li, T(e.description), 1)) : r("v-if", !0)]),
|
|
2169
|
+
e.chosen ? (g(), i("span", ui, T(E(l).t("kvcoder.ui.chosen")), 1)) : r("v-if", !0)
|
|
2170
|
+
], 8, ai))), 128)), m.value === "" ? r("v-if", !0) : (g(), i("div", di, [s(E(ae), {
|
|
2114
2171
|
size: 16,
|
|
2115
2172
|
"aria-hidden": "true",
|
|
2116
2173
|
class: "kvc-ok"
|
|
2117
|
-
}), a("span",
|
|
2174
|
+
}), a("span", fi, [a("span", pi, T(E(l).t("kvcoder.ui.other")), 1), a("span", mi, T(m.value), 1)])]))], 64)) : c.answered.kind === "confirm" ? (g(), i("span", hi, T(E(l).t(c.answered.answer.confirmed === !0 ? "kvcoder.ui.yes" : "kvcoder.ui.no")), 1)) : (g(), i("span", gi, T(h.value), 1))])], 8, ei));
|
|
2118
2175
|
}
|
|
2119
|
-
}),
|
|
2176
|
+
}), vi = {
|
|
2120
2177
|
class: "kvc-card kvc-card-row",
|
|
2121
2178
|
"data-test": "artifact-card"
|
|
2122
|
-
},
|
|
2179
|
+
}, yi = {
|
|
2123
2180
|
style: {
|
|
2124
2181
|
flex: "1 1 auto",
|
|
2125
2182
|
"min-inline-size": "0",
|
|
@@ -2128,13 +2185,13 @@ var Rr = ["aria-label"], zr = {
|
|
|
2128
2185
|
"white-space": "nowrap"
|
|
2129
2186
|
},
|
|
2130
2187
|
"data-test": "artifact-card-title"
|
|
2131
|
-
},
|
|
2188
|
+
}, bi = {
|
|
2132
2189
|
class: "kvc-chip",
|
|
2133
2190
|
"data-test": "artifact-card-format"
|
|
2134
|
-
},
|
|
2191
|
+
}, xi = {
|
|
2135
2192
|
class: "kvc-muted",
|
|
2136
2193
|
"data-test": "artifact-card-version"
|
|
2137
|
-
},
|
|
2194
|
+
}, Si = /* @__PURE__ */ c({
|
|
2138
2195
|
__name: "ArtifactCard",
|
|
2139
2196
|
props: {
|
|
2140
2197
|
id: {},
|
|
@@ -2144,42 +2201,251 @@ var Rr = ["aria-label"], zr = {
|
|
|
2144
2201
|
},
|
|
2145
2202
|
emits: ["open"],
|
|
2146
2203
|
setup(e, { emit: t }) {
|
|
2147
|
-
let n = e, r = t, o =
|
|
2148
|
-
return (e, t) => (g(), i("div",
|
|
2149
|
-
s(
|
|
2204
|
+
let n = e, r = t, o = G();
|
|
2205
|
+
return (e, t) => (g(), i("div", vi, [
|
|
2206
|
+
s(E(ye), {
|
|
2150
2207
|
size: 16,
|
|
2151
2208
|
"aria-hidden": "true"
|
|
2152
2209
|
}),
|
|
2153
|
-
a("span",
|
|
2154
|
-
a("span",
|
|
2155
|
-
a("span",
|
|
2210
|
+
a("span", yi, T(n.title), 1),
|
|
2211
|
+
a("span", bi, T(E(o).t(`kvcoder.ui.artifacts.format.${n.format}`)), 1),
|
|
2212
|
+
a("span", xi, T(E(o).t("kvcoder.ui.artifacts.version", { version: n.version })), 1),
|
|
2156
2213
|
a("button", {
|
|
2157
2214
|
type: "button",
|
|
2158
2215
|
class: "kvc-button",
|
|
2159
2216
|
"data-test": "artifact-open",
|
|
2160
2217
|
onClick: t[0] ||= (e) => r("open", n.id)
|
|
2161
|
-
},
|
|
2218
|
+
}, T(E(o).t("kvcoder.ui.artifacts.open")), 1)
|
|
2162
2219
|
]));
|
|
2163
2220
|
}
|
|
2164
|
-
});
|
|
2221
|
+
}), Ci = 3;
|
|
2222
|
+
function wi(e) {
|
|
2223
|
+
if (e === "") return [];
|
|
2224
|
+
let t = e.split("\n");
|
|
2225
|
+
return e.endsWith("\n") ? t.slice(0, -1) : t;
|
|
2226
|
+
}
|
|
2227
|
+
function Ti(e, t) {
|
|
2228
|
+
let n = 0;
|
|
2229
|
+
for (; n < e.length && n < t.length && e[n] === t[n];) n += 1;
|
|
2230
|
+
return n;
|
|
2231
|
+
}
|
|
2232
|
+
function Ei(e, t) {
|
|
2233
|
+
let n = wi(e), r = wi(t), i = Ti(n, r), a = Ti(n.slice(i).reverse(), r.slice(i).reverse()), o = (e, t) => t.map((t) => ({
|
|
2234
|
+
kind: e,
|
|
2235
|
+
text: t
|
|
2236
|
+
}));
|
|
2237
|
+
return [
|
|
2238
|
+
...o("context", n.slice(Math.max(i - Ci, 0), i)),
|
|
2239
|
+
...o("removed", n.slice(i, n.length - a)),
|
|
2240
|
+
...o("added", r.slice(i, r.length - a)),
|
|
2241
|
+
...o("context", n.slice(n.length - a, n.length - a + Ci))
|
|
2242
|
+
];
|
|
2243
|
+
}
|
|
2244
|
+
function Di(e) {
|
|
2245
|
+
return {
|
|
2246
|
+
added: e.filter((e) => e.kind === "added").length,
|
|
2247
|
+
removed: e.filter((e) => e.kind === "removed").length
|
|
2248
|
+
};
|
|
2249
|
+
}
|
|
2165
2250
|
//#endregion
|
|
2166
|
-
//#region web/src/
|
|
2167
|
-
function
|
|
2168
|
-
if (
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2251
|
+
//#region web/src/call-summary.ts
|
|
2252
|
+
function Oi(e) {
|
|
2253
|
+
if (e !== void 0 && /^\s*[[{]/.test(e)) try {
|
|
2254
|
+
return JSON.parse(e);
|
|
2255
|
+
} catch (e) {
|
|
2256
|
+
if (e instanceof SyntaxError) return;
|
|
2257
|
+
throw e;
|
|
2258
|
+
}
|
|
2259
|
+
}
|
|
2260
|
+
var X = 1024;
|
|
2261
|
+
function ki(e, t) {
|
|
2262
|
+
return t < X ? e("kvcoder.ui.call.bytes", { count: t }) : t < X * X ? e("kvcoder.ui.call.kilobytes", { count: (t / X).toFixed(1) }) : e("kvcoder.ui.call.megabytes", { count: (t / (X * X)).toFixed(1) });
|
|
2263
|
+
}
|
|
2264
|
+
var Z = (e) => typeof e == "string" && e !== "" ? e : void 0;
|
|
2265
|
+
function Ai(e) {
|
|
2266
|
+
let t = e.edits;
|
|
2267
|
+
return Array.isArray(t) ? t.flatMap((e) => {
|
|
2268
|
+
let { oldText: t, newText: n } = K(e);
|
|
2269
|
+
return typeof t == "string" && typeof n == "string" ? [{
|
|
2270
|
+
oldText: t,
|
|
2271
|
+
newText: n
|
|
2272
|
+
}] : [];
|
|
2273
|
+
}) : [];
|
|
2274
|
+
}
|
|
2275
|
+
function ji(e) {
|
|
2276
|
+
let t = Ai(e).map((e) => Di(Ei(e.oldText, e.newText)));
|
|
2277
|
+
return `+${t.reduce((e, t) => e + t.added, 0)} −${t.reduce((e, t) => e + t.removed, 0)}`;
|
|
2278
|
+
}
|
|
2279
|
+
function Mi(e, t) {
|
|
2280
|
+
if (typeof t.bytes == "number" && typeof t.created == "boolean") return e(t.created ? "kvcoder.ui.call.created" : "kvcoder.ui.call.replaced", { size: ki(e, t.bytes) });
|
|
2281
|
+
}
|
|
2282
|
+
function Ni(e, t) {
|
|
2283
|
+
let { fromLine: n, totalLines: r, content: i } = t;
|
|
2284
|
+
if (typeof n != "number" || typeof r != "number" || typeof i != "string") return;
|
|
2285
|
+
let a = wi(i).length;
|
|
2286
|
+
return a === 0 ? void 0 : e("kvcoder.ui.call.lines", {
|
|
2287
|
+
from: n,
|
|
2288
|
+
to: n + a - 1,
|
|
2289
|
+
total: r
|
|
2290
|
+
});
|
|
2291
|
+
}
|
|
2292
|
+
function Pi(e, t) {
|
|
2293
|
+
let n = t.entries;
|
|
2294
|
+
if (Array.isArray(n)) return e(t.truncated === !0 ? "kvcoder.ui.call.entriesFirst" : "kvcoder.ui.call.entries", { count: n.length });
|
|
2295
|
+
}
|
|
2296
|
+
function Fi(e, t) {
|
|
2297
|
+
let n = t.files;
|
|
2298
|
+
if (!Array.isArray(n)) return;
|
|
2299
|
+
let r = n.reduce((e, t) => {
|
|
2300
|
+
let n = K(t).matches;
|
|
2301
|
+
return e + (Array.isArray(n) ? n.length : 0);
|
|
2302
|
+
}, 0);
|
|
2303
|
+
return e(t.truncated === !0 ? "kvcoder.ui.call.matchesFirst" : "kvcoder.ui.call.matches", {
|
|
2304
|
+
matches: r,
|
|
2305
|
+
files: n.length
|
|
2174
2306
|
});
|
|
2175
2307
|
}
|
|
2308
|
+
var Ii = (e, t, n) => Array.isArray(n) ? e(t, { count: n.length }) : void 0;
|
|
2309
|
+
function Q(e, t, n) {
|
|
2310
|
+
return {
|
|
2311
|
+
...e === void 0 ? {} : { words: e },
|
|
2312
|
+
...t === void 0 ? {} : { subject: t },
|
|
2313
|
+
...n === void 0 ? {} : { outcome: n }
|
|
2314
|
+
};
|
|
2315
|
+
}
|
|
2316
|
+
function Li(e, t, n, r) {
|
|
2317
|
+
let i = r === void 0 ? void 0 : K(r), a = Z(n.path);
|
|
2318
|
+
if (t === "edit") return Q(e("kvcoder.ui.call.edit"), a, i === void 0 ? void 0 : ji(n));
|
|
2319
|
+
if (t === "write") return Q(e("kvcoder.ui.call.write"), a, i === void 0 ? void 0 : Mi(e, i));
|
|
2320
|
+
if (t === "read") return Q(e("kvcoder.ui.call.read"), a, i === void 0 ? void 0 : Ni(e, i));
|
|
2321
|
+
if (t === "list") return Q(e("kvcoder.ui.call.list"), a ?? ".", i === void 0 ? void 0 : Pi(e, i));
|
|
2322
|
+
if (t === "search") return Q(e("kvcoder.ui.call.search"), Z(n.pattern), i === void 0 ? void 0 : Fi(e, i));
|
|
2323
|
+
}
|
|
2324
|
+
function Ri(e, t, n, r) {
|
|
2325
|
+
let i = [Z(n.server), Z(n.tool)].filter((e) => e !== void 0).join(" · ");
|
|
2326
|
+
if (t === "call") return Q(void 0, i === "" ? void 0 : i);
|
|
2327
|
+
if (t === "tools") return Q(e("kvcoder.ui.call.tools"), i === "" ? void 0 : i, Ii(e, "kvcoder.ui.call.toolCount", K(r).tools));
|
|
2328
|
+
}
|
|
2329
|
+
function zi(e, t, n, r) {
|
|
2330
|
+
if (t === "list") return Q(e("kvcoder.ui.call.backgroundRuns"), void 0, Ii(e, "kvcoder.ui.call.runCount", r));
|
|
2331
|
+
if (t === "output") return Q(e("kvcoder.ui.call.output"), Z(n.id));
|
|
2332
|
+
if (t === "stop") return Q(e("kvcoder.ui.call.stop"), Z(n.id));
|
|
2333
|
+
}
|
|
2334
|
+
function Bi(e, t, n) {
|
|
2335
|
+
let { connector: r, command: i } = t, a = t.fields ?? {};
|
|
2336
|
+
if (r !== void 0 && i !== void 0) {
|
|
2337
|
+
if (t.line !== void 0) return { subject: `$ ${t.line}` };
|
|
2338
|
+
if (r === "fs") return Li(e, i, a, n);
|
|
2339
|
+
if (r === "mcp") return Ri(e, i, a, n);
|
|
2340
|
+
if (r === "background") return zi(e, i, a, n);
|
|
2341
|
+
if (r === "delegate" && i === "run") return Q(e("kvcoder.ui.call.delegate"), [Z(a.worker), Z(a.title)].filter((e) => e !== void 0).join(" · "));
|
|
2342
|
+
if (r === "artifact" && i === "get") return Q(e("kvcoder.ui.call.readArtifact"), Z(a.id));
|
|
2343
|
+
}
|
|
2344
|
+
}
|
|
2176
2345
|
//#endregion
|
|
2177
|
-
//#region web/src/
|
|
2178
|
-
var
|
|
2179
|
-
function
|
|
2346
|
+
//#region web/src/field-rows.ts
|
|
2347
|
+
var Vi = "—", Hi = (e) => e === null || typeof e == "string" || typeof e == "number" || typeof e == "boolean", Ui = (e) => e === null ? Vi : String(e);
|
|
2348
|
+
function Wi(e) {
|
|
2349
|
+
return typeof e == "object" && e && !Array.isArray(e) ? Object.fromEntries(Object.entries(e)) : void 0;
|
|
2350
|
+
}
|
|
2351
|
+
function Gi(e) {
|
|
2352
|
+
let t = Wi(e);
|
|
2353
|
+
if (t === void 0) return;
|
|
2354
|
+
let n = {};
|
|
2355
|
+
for (let [e, r] of Object.entries(t)) {
|
|
2356
|
+
if (!Hi(r)) return;
|
|
2357
|
+
n[e] = r;
|
|
2358
|
+
}
|
|
2359
|
+
return n;
|
|
2360
|
+
}
|
|
2361
|
+
function Ki(e) {
|
|
2362
|
+
let t = [...new Set(e.flatMap((e) => Object.keys(e)))];
|
|
2363
|
+
return {
|
|
2364
|
+
kind: "table",
|
|
2365
|
+
columns: t,
|
|
2366
|
+
rows: e.map((e) => t.map((t) => t in e ? Ui(e[t] ?? null) : ""))
|
|
2367
|
+
};
|
|
2368
|
+
}
|
|
2369
|
+
function qi(e) {
|
|
2370
|
+
if (e.length === 0) return { kind: "empty" };
|
|
2371
|
+
if (e.every(Hi)) return {
|
|
2372
|
+
kind: "items",
|
|
2373
|
+
items: e.map(Ui)
|
|
2374
|
+
};
|
|
2375
|
+
let t = e.map(Gi).filter((e) => e !== void 0);
|
|
2376
|
+
return t.length === e.length ? Ki(t) : {
|
|
2377
|
+
kind: "rows",
|
|
2378
|
+
rows: e.map((e, t) => ({
|
|
2379
|
+
name: String(t + 1),
|
|
2380
|
+
value: Ji(e)
|
|
2381
|
+
}))
|
|
2382
|
+
};
|
|
2383
|
+
}
|
|
2384
|
+
function Ji(e) {
|
|
2385
|
+
if (typeof e == "string") return e.includes("\n") ? {
|
|
2386
|
+
kind: "block",
|
|
2387
|
+
text: e
|
|
2388
|
+
} : {
|
|
2389
|
+
kind: "text",
|
|
2390
|
+
text: e
|
|
2391
|
+
};
|
|
2392
|
+
if (typeof e == "number" || typeof e == "boolean") return {
|
|
2393
|
+
kind: "text",
|
|
2394
|
+
text: String(e)
|
|
2395
|
+
};
|
|
2396
|
+
if (Array.isArray(e)) return qi(e);
|
|
2397
|
+
let t = Wi(e);
|
|
2398
|
+
return t === void 0 || Object.keys(t).length === 0 ? { kind: "empty" } : {
|
|
2399
|
+
kind: "rows",
|
|
2400
|
+
rows: Yi(t)
|
|
2401
|
+
};
|
|
2402
|
+
}
|
|
2403
|
+
function Yi(e) {
|
|
2404
|
+
return Object.entries(e).map(([e, t]) => ({
|
|
2405
|
+
name: e,
|
|
2406
|
+
value: Ji(t)
|
|
2407
|
+
}));
|
|
2408
|
+
}
|
|
2409
|
+
function Xi(e, t) {
|
|
2410
|
+
return t || e.length <= 12 ? e : e.slice(0, 12);
|
|
2411
|
+
}
|
|
2412
|
+
var Zi = (e) => wi(e).map((e) => ({ text: e })), Qi = (e, t) => wi(e).map((e, n) => ({
|
|
2413
|
+
text: e,
|
|
2414
|
+
number: t + n
|
|
2415
|
+
}));
|
|
2416
|
+
function $i(e, t) {
|
|
2417
|
+
return t || e.length <= 17 ? e : [
|
|
2418
|
+
...e.slice(0, 12),
|
|
2419
|
+
"⋯",
|
|
2420
|
+
...e.slice(-5)
|
|
2421
|
+
];
|
|
2422
|
+
}
|
|
2423
|
+
//#endregion
|
|
2424
|
+
//#region web/src/FoldButton.vue?vue&type=script&setup=true&lang.ts
|
|
2425
|
+
var ea = ["aria-expanded"], ta = /* @__PURE__ */ c({
|
|
2426
|
+
__name: "FoldButton",
|
|
2427
|
+
props: {
|
|
2428
|
+
count: {},
|
|
2429
|
+
open: { type: Boolean },
|
|
2430
|
+
over: {}
|
|
2431
|
+
},
|
|
2432
|
+
emits: ["toggle"],
|
|
2433
|
+
setup(e, { emit: t }) {
|
|
2434
|
+
let n = e, a = t, o = G();
|
|
2435
|
+
return (e, t) => n.count > (n.over ?? E(12)) ? (g(), i("button", {
|
|
2436
|
+
key: 0,
|
|
2437
|
+
type: "button",
|
|
2438
|
+
class: "kvc-text-button kvc-fold",
|
|
2439
|
+
"aria-expanded": n.open,
|
|
2440
|
+
"data-test": "show-all",
|
|
2441
|
+
onClick: t[0] ||= (e) => a("toggle")
|
|
2442
|
+
}, T(n.open ? E(o).t("kvcoder.ui.call.showFewer") : E(o).t("kvcoder.ui.call.showAll", { count: n.count })), 9, ea)) : r("v-if", !0);
|
|
2443
|
+
}
|
|
2444
|
+
}), na = /http:\/\/(?:127\.0\.0\.1|localhost):\d+[^\s"'`<>()[\]{}]*/g, ra = /[.,;:!?]+$/;
|
|
2445
|
+
function ia(e) {
|
|
2180
2446
|
let t = [], n = 0;
|
|
2181
|
-
for (let r of e.matchAll(
|
|
2182
|
-
let i = r[0].replace(
|
|
2447
|
+
for (let r of e.matchAll(na)) {
|
|
2448
|
+
let i = r[0].replace(ra, "");
|
|
2183
2449
|
r.index > n && t.push({
|
|
2184
2450
|
kind: "text",
|
|
2185
2451
|
text: e.slice(n, r.index)
|
|
@@ -2193,70 +2459,396 @@ function ui(e) {
|
|
|
2193
2459
|
text: e.slice(n)
|
|
2194
2460
|
}), t;
|
|
2195
2461
|
}
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2462
|
+
//#endregion
|
|
2463
|
+
//#region web/src/LinkedText.vue?vue&type=script&setup=true&lang.ts
|
|
2464
|
+
var aa = ["href"], $ = /* @__PURE__ */ c({
|
|
2465
|
+
__name: "LinkedText",
|
|
2466
|
+
props: { text: {} },
|
|
2467
|
+
setup(n) {
|
|
2468
|
+
let r = n, a = t(() => ia(r.text));
|
|
2469
|
+
return (t, n) => (g(!0), i(e, null, y(a.value, (t, n) => (g(), i(e, { key: n }, [t.kind === "link" ? (g(), i("a", {
|
|
2470
|
+
key: 0,
|
|
2471
|
+
href: t.href,
|
|
2472
|
+
target: "_blank",
|
|
2473
|
+
rel: "noopener noreferrer",
|
|
2474
|
+
class: "kvc-link"
|
|
2475
|
+
}, T(t.href), 9, aa)) : (g(), i(e, { key: 1 }, [o(T(t.text), 1)], 64))], 64))), 128));
|
|
2476
|
+
}
|
|
2477
|
+
}), oa = { class: "kvc-code-lines" }, sa = ["dir", "data-kind"], ca = {
|
|
2478
|
+
key: 0,
|
|
2479
|
+
class: "kvc-line-number",
|
|
2480
|
+
"data-test": "call-line-number"
|
|
2481
|
+
}, la = {
|
|
2482
|
+
key: 1,
|
|
2483
|
+
class: "kvc-line-mark",
|
|
2484
|
+
"aria-hidden": "true"
|
|
2485
|
+
}, ua = {
|
|
2486
|
+
class: "kvc-line-text",
|
|
2487
|
+
dir: "auto",
|
|
2488
|
+
"data-test": "call-line-text"
|
|
2489
|
+
}, da = /* @__PURE__ */ c({
|
|
2490
|
+
__name: "FoldedLines",
|
|
2491
|
+
props: { lines: {} },
|
|
2492
|
+
setup(n) {
|
|
2493
|
+
let o = n, c = v(!1), l = t(() => Xi(o.lines, c.value)), u = t(() => o.lines.some((e) => e.number !== void 0)), d = t(() => o.lines.some((e) => e.kind !== void 0)), f = {
|
|
2494
|
+
context: " ",
|
|
2495
|
+
removed: "−",
|
|
2496
|
+
added: "+"
|
|
2497
|
+
};
|
|
2498
|
+
return (t, n) => (g(), i("div", oa, [(g(!0), i(e, null, y(l.value, (e, t) => (g(), i("div", {
|
|
2499
|
+
key: t,
|
|
2500
|
+
class: "kvc-code-line",
|
|
2501
|
+
dir: u.value || d.value ? "ltr" : void 0,
|
|
2502
|
+
"data-kind": e.kind,
|
|
2503
|
+
"data-test": "call-line-row"
|
|
2504
|
+
}, [
|
|
2505
|
+
u.value ? (g(), i("span", ca, T(e.number), 1)) : r("v-if", !0),
|
|
2506
|
+
d.value ? (g(), i("span", la, T(f[e.kind ?? "context"]), 1)) : r("v-if", !0),
|
|
2507
|
+
a("span", ua, [s($, { text: e.text }, null, 8, ["text"])])
|
|
2508
|
+
], 8, sa))), 128)), s(ta, {
|
|
2509
|
+
count: o.lines.length,
|
|
2510
|
+
open: c.value,
|
|
2511
|
+
onToggle: n[0] ||= (e) => c.value = !c.value
|
|
2512
|
+
}, null, 8, ["count", "open"])]));
|
|
2203
2513
|
}
|
|
2514
|
+
}), fa = {
|
|
2515
|
+
key: 0,
|
|
2516
|
+
dir: "auto",
|
|
2517
|
+
"data-test": "field-text"
|
|
2518
|
+
}, pa = {
|
|
2519
|
+
key: 1,
|
|
2520
|
+
class: "kvc-muted",
|
|
2521
|
+
"data-test": "field-empty"
|
|
2522
|
+
}, ma = {
|
|
2523
|
+
key: 3,
|
|
2524
|
+
class: "kvc-field-table"
|
|
2525
|
+
}, ha = { "data-test": "field-table" }, ga = {
|
|
2526
|
+
key: 4,
|
|
2527
|
+
class: "kvc-field-items",
|
|
2528
|
+
"data-test": "field-items"
|
|
2529
|
+
}, _a = {
|
|
2530
|
+
key: 5,
|
|
2531
|
+
class: "kvc-fields",
|
|
2532
|
+
"data-test": "call-fields"
|
|
2533
|
+
}, va = ["data-name"], ya = {
|
|
2534
|
+
class: "kvc-muted",
|
|
2535
|
+
dir: "ltr"
|
|
2536
|
+
}, ba = { "data-test": "field-value" }, xa = /* @__PURE__ */ c({
|
|
2537
|
+
__name: "FieldsView",
|
|
2538
|
+
props: { value: {} },
|
|
2539
|
+
setup(r) {
|
|
2540
|
+
let o = r, c = v(!1), l = t(() => o.value.kind === "table" ? Xi(o.value.rows, c.value) : []), u = t(() => o.value.kind === "items" ? Xi(o.value.items, c.value) : []);
|
|
2541
|
+
return (t, r) => {
|
|
2542
|
+
let d = x("FieldsView", !0);
|
|
2543
|
+
return o.value.kind === "text" ? (g(), i("span", fa, [s($, { text: o.value.text }, null, 8, ["text"])])) : o.value.kind === "empty" ? (g(), i("span", pa, "—")) : o.value.kind === "block" ? (g(), n(da, {
|
|
2544
|
+
key: 2,
|
|
2545
|
+
class: "kvc-field-block",
|
|
2546
|
+
lines: E(Zi)(o.value.text),
|
|
2547
|
+
"data-test": "field-block"
|
|
2548
|
+
}, null, 8, ["lines"])) : o.value.kind === "table" ? (g(), i("div", ma, [a("table", ha, [a("thead", null, [a("tr", null, [(g(!0), i(e, null, y(o.value.columns, (e) => (g(), i("th", {
|
|
2549
|
+
key: e,
|
|
2550
|
+
scope: "col",
|
|
2551
|
+
dir: "ltr"
|
|
2552
|
+
}, T(e), 1))), 128))])]), a("tbody", null, [(g(!0), i(e, null, y(l.value, (t, n) => (g(), i("tr", { key: n }, [(g(!0), i(e, null, y(t, (e, t) => (g(), i("td", {
|
|
2553
|
+
key: t,
|
|
2554
|
+
dir: "auto"
|
|
2555
|
+
}, [s($, { text: e }, null, 8, ["text"])]))), 128))]))), 128))])]), s(ta, {
|
|
2556
|
+
count: o.value.rows.length,
|
|
2557
|
+
open: c.value,
|
|
2558
|
+
onToggle: r[0] ||= (e) => c.value = !c.value
|
|
2559
|
+
}, null, 8, ["count", "open"])])) : o.value.kind === "items" ? (g(), i("div", ga, [(g(!0), i(e, null, y(u.value, (e, t) => (g(), i("div", {
|
|
2560
|
+
key: t,
|
|
2561
|
+
dir: "auto"
|
|
2562
|
+
}, [s($, { text: e }, null, 8, ["text"])]))), 128)), s(ta, {
|
|
2563
|
+
count: o.value.items.length,
|
|
2564
|
+
open: c.value,
|
|
2565
|
+
onToggle: r[1] ||= (e) => c.value = !c.value
|
|
2566
|
+
}, null, 8, ["count", "open"])])) : (g(), i("dl", _a, [(g(!0), i(e, null, y(o.value.rows, (e) => (g(), i("div", {
|
|
2567
|
+
key: e.name,
|
|
2568
|
+
class: "kvc-field-row",
|
|
2569
|
+
"data-name": e.name,
|
|
2570
|
+
"data-test": "field-row"
|
|
2571
|
+
}, [a("dt", ya, T(e.name), 1), a("dd", ba, [s(d, { value: e.value }, null, 8, ["value"])])], 8, va))), 128))]));
|
|
2572
|
+
};
|
|
2573
|
+
}
|
|
2574
|
+
}), Sa = ["aria-label"], Ca = ["aria-label"], wa = /* @__PURE__ */ c({
|
|
2575
|
+
__name: "CallRequest",
|
|
2576
|
+
props: { view: {} },
|
|
2577
|
+
setup(a) {
|
|
2578
|
+
let o = a, c = G(), l = t(() => xr(o.view)), u = t(() => o.view.fields ?? {}), d = t(() => Ai(u.value).map((e) => Ei(e.oldText, e.newText))), f = t(() => typeof u.value.content == "string" ? u.value.content : ""), p = t(() => typeof u.value.task == "string" ? u.value.task : ""), m = t(() => l.value === "mcp-call" ? K(u.value.arguments) : l.value === "fields" ? u.value : {});
|
|
2579
|
+
return (t, a) => l.value === "edit" ? (g(!0), i(e, { key: 0 }, y(d.value, (e, t) => (g(), n(da, {
|
|
2580
|
+
key: t,
|
|
2581
|
+
class: "kvc-block",
|
|
2582
|
+
lines: e,
|
|
2583
|
+
"data-test": "call-diff"
|
|
2584
|
+
}, null, 8, ["lines"]))), 128)) : l.value === "write" ? (g(), n(da, {
|
|
2585
|
+
key: 1,
|
|
2586
|
+
class: "kvc-block",
|
|
2587
|
+
lines: E(Qi)(f.value, 1),
|
|
2588
|
+
"data-test": "call-content"
|
|
2589
|
+
}, null, 8, ["lines"])) : l.value === "line" ? (g(), i("pre", {
|
|
2590
|
+
key: 2,
|
|
2591
|
+
class: "kvc-output kvc-mono",
|
|
2592
|
+
dir: "ltr",
|
|
2593
|
+
"aria-label": E(c).t("kvcoder.ui.command"),
|
|
2594
|
+
"data-test": "call-payload"
|
|
2595
|
+
}, "$ " + T(o.view.line), 9, Sa)) : l.value === "delegate" ? (g(), n(da, {
|
|
2596
|
+
key: 3,
|
|
2597
|
+
class: "kvc-block kvc-prose-lines",
|
|
2598
|
+
lines: E(Zi)(p.value),
|
|
2599
|
+
"aria-label": E(c).t("kvcoder.ui.call.task"),
|
|
2600
|
+
"data-test": "call-task"
|
|
2601
|
+
}, null, 8, ["lines", "aria-label"])) : Object.keys(m.value).length > 0 ? (g(), i("div", {
|
|
2602
|
+
key: 4,
|
|
2603
|
+
class: "kvc-block",
|
|
2604
|
+
"aria-label": E(c).t("kvcoder.ui.call.payload"),
|
|
2605
|
+
"data-test": "call-payload-fields"
|
|
2606
|
+
}, [s(xa, { value: E(Ji)(m.value) }, null, 8, ["value"])], 8, Ca)) : r("v-if", !0);
|
|
2607
|
+
}
|
|
2608
|
+
});
|
|
2609
|
+
//#endregion
|
|
2610
|
+
//#region web/src/call-results.ts
|
|
2611
|
+
function Ta(e) {
|
|
2612
|
+
let { replacements: t, firstChangedLine: n } = K(e);
|
|
2613
|
+
return typeof t == "number" && typeof n == "number" ? {
|
|
2614
|
+
replacements: t,
|
|
2615
|
+
firstChangedLine: n
|
|
2616
|
+
} : void 0;
|
|
2617
|
+
}
|
|
2618
|
+
function Ea(e) {
|
|
2619
|
+
let { fromLine: t, content: n } = K(e);
|
|
2620
|
+
return typeof t == "number" && typeof n == "string" ? {
|
|
2621
|
+
fromLine: t,
|
|
2622
|
+
content: n
|
|
2623
|
+
} : void 0;
|
|
2624
|
+
}
|
|
2625
|
+
function Da(e) {
|
|
2626
|
+
let { name: t, kind: n, bytes: r } = K(e);
|
|
2627
|
+
return typeof t == "string" && (n === "file" || n === "folder") && typeof r == "number" ? [{
|
|
2628
|
+
name: t,
|
|
2629
|
+
kind: n,
|
|
2630
|
+
bytes: r
|
|
2631
|
+
}] : [];
|
|
2632
|
+
}
|
|
2633
|
+
function Oa(e) {
|
|
2634
|
+
let t = K(e).entries;
|
|
2635
|
+
return Array.isArray(t) ? t.flatMap(Da) : void 0;
|
|
2636
|
+
}
|
|
2637
|
+
function ka(e) {
|
|
2638
|
+
let { path: t, matches: n } = K(e);
|
|
2639
|
+
return typeof t != "string" || !Array.isArray(n) ? [] : [{
|
|
2640
|
+
path: t,
|
|
2641
|
+
matches: n.flatMap((e) => {
|
|
2642
|
+
let { line: t, text: n } = K(e);
|
|
2643
|
+
return typeof t == "number" && typeof n == "string" ? [{
|
|
2644
|
+
line: t,
|
|
2645
|
+
text: n
|
|
2646
|
+
}] : [];
|
|
2647
|
+
})
|
|
2648
|
+
}];
|
|
2649
|
+
}
|
|
2650
|
+
function Aa(e) {
|
|
2651
|
+
let t = K(e).files;
|
|
2652
|
+
return Array.isArray(t) ? t.flatMap(ka) : void 0;
|
|
2653
|
+
}
|
|
2654
|
+
//#endregion
|
|
2655
|
+
//#region web/src/FoldedOutput.vue?vue&type=script&setup=true&lang.ts
|
|
2656
|
+
var ja = { class: "kvc-output-block" }, Ma = ["aria-label"], Na = /* @__PURE__ */ c({
|
|
2657
|
+
__name: "FoldedOutput",
|
|
2658
|
+
props: { output: {} },
|
|
2659
|
+
setup(e) {
|
|
2660
|
+
let n = e, r = G(), o = v(!1), c = t(() => n.output.split("\n")), l = t(() => $i(c.value, o.value).join("\n"));
|
|
2661
|
+
return (e, t) => (g(), i("div", ja, [a("pre", {
|
|
2662
|
+
class: "kvc-output",
|
|
2663
|
+
dir: "auto",
|
|
2664
|
+
"aria-label": E(r).t("kvcoder.ui.output"),
|
|
2665
|
+
"data-test": "call-output"
|
|
2666
|
+
}, [s($, { text: l.value }, null, 8, ["text"])], 8, Ma), s(ta, {
|
|
2667
|
+
count: c.value.length,
|
|
2668
|
+
open: o.value,
|
|
2669
|
+
over: E(12) + E(5),
|
|
2670
|
+
onToggle: t[0] ||= (e) => o.value = !o.value
|
|
2671
|
+
}, null, 8, [
|
|
2672
|
+
"count",
|
|
2673
|
+
"open",
|
|
2674
|
+
"over"
|
|
2675
|
+
])]));
|
|
2676
|
+
}
|
|
2677
|
+
}), Pa = {
|
|
2678
|
+
key: 0,
|
|
2679
|
+
class: "kvc-muted kvc-call-parts",
|
|
2680
|
+
"data-test": "call-replacements"
|
|
2681
|
+
}, Fa = {
|
|
2682
|
+
key: 2,
|
|
2683
|
+
class: "kvc-block kvc-entries",
|
|
2684
|
+
"data-test": "call-entries"
|
|
2685
|
+
}, Ia = ["data-kind"], La = {
|
|
2686
|
+
class: "kvc-mono",
|
|
2687
|
+
dir: "auto",
|
|
2688
|
+
"data-test": "call-entry-name"
|
|
2689
|
+
}, Ra = {
|
|
2690
|
+
key: 0,
|
|
2691
|
+
class: "kvc-muted",
|
|
2692
|
+
"data-test": "call-entry-size"
|
|
2693
|
+
}, za = {
|
|
2694
|
+
class: "kvc-mono kvc-file-path",
|
|
2695
|
+
"data-test": "call-file-path"
|
|
2696
|
+
}, Ba = ["aria-label"], Va = ["aria-label"], Ha = /* @__PURE__ */ c({
|
|
2697
|
+
__name: "CallResult",
|
|
2698
|
+
props: {
|
|
2699
|
+
view: {},
|
|
2700
|
+
output: {},
|
|
2701
|
+
result: {}
|
|
2702
|
+
},
|
|
2703
|
+
setup(o) {
|
|
2704
|
+
let c = o, l = G(), u = t(() => xr(c.view)), d = t(() => u.value === "edit" ? Ta(c.result) : void 0), f = t(() => u.value === "read" ? Ea(c.result) : void 0), p = t(() => u.value === "list" ? Oa(c.result) : void 0), m = t(() => u.value === "search" ? Aa(c.result) : void 0), h = v(!1), _ = t(() => Xi(p.value ?? [], h.value)), b = t(() => ({
|
|
2705
|
+
type: "markdown",
|
|
2706
|
+
text: "kvcoder.markdown",
|
|
2707
|
+
params: { text: c.output }
|
|
2708
|
+
})), x = t(() => u.value !== "line" && typeof c.result == "object" && c.result !== null);
|
|
2709
|
+
return (t, o) => d.value === void 0 ? f.value === void 0 ? p.value === void 0 ? m.value === void 0 ? u.value === "write" && x.value ? (g(), i(e, { key: 4 }, [], 64)) : u.value === "delegate" && c.output !== "" ? (g(), i("div", {
|
|
2710
|
+
key: 5,
|
|
2711
|
+
class: "kvc-block",
|
|
2712
|
+
"aria-label": E(l).t("kvcoder.ui.call.answer"),
|
|
2713
|
+
"data-test": "call-answer"
|
|
2714
|
+
}, [(g(), n(S(E(l).View), { view: b.value }, null, 8, ["view"]))], 8, Ba)) : x.value ? (g(), i("div", {
|
|
2715
|
+
key: 6,
|
|
2716
|
+
class: "kvc-block",
|
|
2717
|
+
"aria-label": E(l).t("kvcoder.ui.output"),
|
|
2718
|
+
"data-test": "call-result-fields"
|
|
2719
|
+
}, [s(xa, { value: E(Ji)(c.result) }, null, 8, ["value"])], 8, Va)) : c.output === "" ? r("v-if", !0) : (g(), n(Na, {
|
|
2720
|
+
key: 7,
|
|
2721
|
+
output: c.output
|
|
2722
|
+
}, null, 8, ["output"])) : (g(!0), i(e, { key: 3 }, y(m.value, (e) => (g(), i("div", {
|
|
2723
|
+
key: e.path,
|
|
2724
|
+
class: "kvc-block",
|
|
2725
|
+
"data-test": "call-file"
|
|
2726
|
+
}, [a("div", za, T(e.path), 1), s(da, { lines: e.matches.map((e) => ({
|
|
2727
|
+
text: e.text,
|
|
2728
|
+
number: e.line
|
|
2729
|
+
})) }, null, 8, ["lines"])]))), 128)) : (g(), i("div", Fa, [(g(!0), i(e, null, y(_.value, (e) => (g(), i("div", {
|
|
2730
|
+
key: e.name,
|
|
2731
|
+
class: "kvc-entry",
|
|
2732
|
+
"data-kind": e.kind,
|
|
2733
|
+
"data-test": "call-entry"
|
|
2734
|
+
}, [
|
|
2735
|
+
(g(), n(S(e.kind === "folder" ? E(ge) : E(he)), {
|
|
2736
|
+
size: 14,
|
|
2737
|
+
"aria-hidden": "true"
|
|
2738
|
+
})),
|
|
2739
|
+
a("span", La, T(e.name), 1),
|
|
2740
|
+
e.kind === "file" ? (g(), i("span", Ra, T(E(ki)(E(l).t, e.bytes)), 1)) : r("v-if", !0)
|
|
2741
|
+
], 8, Ia))), 128)), s(ta, {
|
|
2742
|
+
count: p.value.length,
|
|
2743
|
+
open: h.value,
|
|
2744
|
+
onToggle: o[0] ||= (e) => h.value = !h.value
|
|
2745
|
+
}, null, 8, ["count", "open"])])) : (g(), n(da, {
|
|
2746
|
+
key: 1,
|
|
2747
|
+
class: "kvc-block",
|
|
2748
|
+
lines: E(Qi)(f.value.content, f.value.fromLine),
|
|
2749
|
+
"data-test": "call-content"
|
|
2750
|
+
}, null, 8, ["lines"])) : (g(), i("p", Pa, T(E(l).t("kvcoder.ui.call.replacements", {
|
|
2751
|
+
count: d.value.replacements,
|
|
2752
|
+
line: d.value.firstChangedLine
|
|
2753
|
+
})), 1));
|
|
2754
|
+
}
|
|
2755
|
+
}), Ua = {
|
|
2756
|
+
key: 0,
|
|
2757
|
+
class: "kvc-summary",
|
|
2758
|
+
"data-test": "call-summary"
|
|
2759
|
+
}, Wa = {
|
|
2760
|
+
key: 0,
|
|
2761
|
+
"data-test": "call-words"
|
|
2762
|
+
}, Ga = {
|
|
2763
|
+
key: 1,
|
|
2764
|
+
class: "kvc-mono",
|
|
2765
|
+
"data-test": "call-subject"
|
|
2766
|
+
}, Ka = ["dir"], qa = {
|
|
2767
|
+
key: 1,
|
|
2768
|
+
class: "kvc-muted",
|
|
2769
|
+
dir: "ltr",
|
|
2770
|
+
style: { "align-self": "flex-start" },
|
|
2771
|
+
"data-test": "call-label"
|
|
2772
|
+
}, Ja = /* @__PURE__ */ c({
|
|
2773
|
+
__name: "CallSummaryLine",
|
|
2774
|
+
props: {
|
|
2775
|
+
view: {},
|
|
2776
|
+
result: {},
|
|
2777
|
+
whole: { type: Boolean }
|
|
2778
|
+
},
|
|
2779
|
+
setup(e) {
|
|
2780
|
+
let n = e, a = G(), o = t(() => Bi(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 : Sr(o.value.subject));
|
|
2781
|
+
return (e, t) => o.value === void 0 ? n.view.label ? (g(), i("span", qa, T(n.view.label), 1)) : r("v-if", !0) : (g(), i("span", Ua, [
|
|
2782
|
+
o.value.words ? (g(), i("span", Wa, T(o.value.words), 1)) : r("v-if", !0),
|
|
2783
|
+
c.value ? (g(), i("span", Ga, T(c.value), 1)) : r("v-if", !0),
|
|
2784
|
+
o.value.outcome ? (g(), i("span", {
|
|
2785
|
+
key: 2,
|
|
2786
|
+
class: "kvc-muted",
|
|
2787
|
+
dir: s.value,
|
|
2788
|
+
"data-test": "call-outcome"
|
|
2789
|
+
}, T(o.value.outcome), 9, Ka)) : r("v-if", !0)
|
|
2790
|
+
]));
|
|
2791
|
+
}
|
|
2792
|
+
});
|
|
2793
|
+
//#endregion
|
|
2794
|
+
//#region web/src/durations.ts
|
|
2795
|
+
function Ya(e, t) {
|
|
2796
|
+
if (t < 1e3) return e("kvcoder.ui.milliseconds", { count: Math.round(t) });
|
|
2797
|
+
if (t < 1e4) return e("kvcoder.ui.seconds", { count: (t / 1e3).toFixed(1) });
|
|
2798
|
+
let n = Math.round(t / 1e3);
|
|
2799
|
+
return n < 60 ? e("kvcoder.ui.seconds", { count: n }) : e("kvcoder.ui.minutesSeconds", {
|
|
2800
|
+
minutes: Math.floor(n / 60),
|
|
2801
|
+
seconds: n % 60
|
|
2802
|
+
});
|
|
2204
2803
|
}
|
|
2205
2804
|
//#endregion
|
|
2206
2805
|
//#region web/src/CallCard.vue?vue&type=script&setup=true&lang.ts
|
|
2207
|
-
var
|
|
2806
|
+
var Xa = ["aria-expanded", "disabled"], Za = ["aria-label"], Qa = { class: "kvc-lines" }, $a = {
|
|
2208
2807
|
key: 0,
|
|
2209
2808
|
style: { "font-weight": "600" },
|
|
2210
2809
|
"data-test": "call-description"
|
|
2211
|
-
},
|
|
2810
|
+
}, eo = {
|
|
2212
2811
|
key: 1,
|
|
2213
2812
|
class: "kvc-oneline",
|
|
2214
2813
|
"data-test": "call-line"
|
|
2215
|
-
},
|
|
2216
|
-
key: 2,
|
|
2217
|
-
class: "kvc-muted",
|
|
2218
|
-
dir: "ltr",
|
|
2219
|
-
style: { "align-self": "flex-start" },
|
|
2220
|
-
"data-test": "call-label"
|
|
2221
|
-
}, yi = {
|
|
2814
|
+
}, to = { class: "kvc-mono" }, no = {
|
|
2222
2815
|
key: 2,
|
|
2816
|
+
class: "kvc-chip kvc-warn",
|
|
2817
|
+
"data-test": "call-risky"
|
|
2818
|
+
}, ro = {
|
|
2819
|
+
key: 3,
|
|
2223
2820
|
class: "kvc-chip",
|
|
2224
2821
|
"data-test": "call-background"
|
|
2225
|
-
},
|
|
2226
|
-
key:
|
|
2822
|
+
}, io = {
|
|
2823
|
+
key: 4,
|
|
2227
2824
|
class: "kvc-chip kvc-danger",
|
|
2228
2825
|
"data-test": "call-failed"
|
|
2229
|
-
},
|
|
2826
|
+
}, ao = {
|
|
2230
2827
|
class: "kvc-muted",
|
|
2231
2828
|
"data-test": "call-time"
|
|
2232
|
-
},
|
|
2829
|
+
}, oo = {
|
|
2233
2830
|
key: 0,
|
|
2234
2831
|
class: "kvc-muted kvc-call-parts",
|
|
2235
2832
|
"data-test": "call-parts"
|
|
2236
|
-
},
|
|
2833
|
+
}, so = ["aria-label"], co = /* @__PURE__ */ c({
|
|
2237
2834
|
__name: "CallCard",
|
|
2238
2835
|
props: {
|
|
2239
|
-
|
|
2240
|
-
label: {},
|
|
2241
|
-
line: {},
|
|
2242
|
-
payload: {},
|
|
2836
|
+
view: {},
|
|
2243
2837
|
failed: { type: Boolean },
|
|
2244
2838
|
durationMs: {},
|
|
2245
|
-
writtenMs: {},
|
|
2246
2839
|
output: {},
|
|
2247
|
-
running: { type: Boolean }
|
|
2248
|
-
background: { type: Boolean }
|
|
2840
|
+
running: { type: Boolean }
|
|
2249
2841
|
},
|
|
2250
|
-
setup(
|
|
2251
|
-
let c =
|
|
2842
|
+
setup(o) {
|
|
2843
|
+
let c = o, l = G(), u = t(() => xr(c.view)), d = v(c.output !== void 0 && (c.failed === !0 || u.value === "edit" || u.value === "write")), p = t(() => c.failed === !0 ? void 0 : Oi(c.output)), m = t(() => c.failed === !0 && u.value !== "line"), h = t(() => c.durationMs === void 0 ? "" : Ya(l.t, (c.view.writtenMs ?? 0) + c.durationMs)), _ = t(() => {
|
|
2252
2844
|
if (c.durationMs === void 0) return "";
|
|
2253
|
-
let e =
|
|
2254
|
-
return c.writtenMs === void 0 ? l.t("kvcoder.ui.callRan", { ran: e }) : l.t("kvcoder.ui.callParts", {
|
|
2255
|
-
written:
|
|
2845
|
+
let e = Ya(l.t, c.durationMs);
|
|
2846
|
+
return c.view.writtenMs === void 0 ? l.t("kvcoder.ui.callRan", { ran: e }) : l.t("kvcoder.ui.callParts", {
|
|
2847
|
+
written: Ya(l.t, c.view.writtenMs),
|
|
2256
2848
|
ran: e
|
|
2257
2849
|
});
|
|
2258
|
-
})
|
|
2259
|
-
return (t,
|
|
2850
|
+
});
|
|
2851
|
+
return (t, o) => (g(), i("div", {
|
|
2260
2852
|
class: f(["kvc-card", { "kvc-failed": c.failed }]),
|
|
2261
2853
|
"data-test": "call-card"
|
|
2262
2854
|
}, [a("button", {
|
|
@@ -2266,140 +2858,163 @@ var fi = ["aria-expanded", "disabled"], pi = ["aria-label"], mi = { class: "kvc-
|
|
|
2266
2858
|
"inline-size": "100%",
|
|
2267
2859
|
"border-radius": "0"
|
|
2268
2860
|
},
|
|
2269
|
-
"aria-expanded":
|
|
2861
|
+
"aria-expanded": d.value,
|
|
2270
2862
|
disabled: c.output === void 0,
|
|
2271
|
-
onClick:
|
|
2863
|
+
onClick: o[0] ||= (e) => d.value = !d.value
|
|
2272
2864
|
}, [
|
|
2273
2865
|
c.running ? (g(), i("span", {
|
|
2274
2866
|
key: 0,
|
|
2275
2867
|
class: "kvc-spin",
|
|
2276
|
-
"aria-label":
|
|
2277
|
-
}, null, 8,
|
|
2868
|
+
"aria-label": E(l).t("kvcoder.ui.running")
|
|
2869
|
+
}, null, 8, Za)) : (g(), n(S(d.value ? E(oe) : E(se)), {
|
|
2278
2870
|
key: 1,
|
|
2279
2871
|
size: 16,
|
|
2280
2872
|
"aria-hidden": "true"
|
|
2281
2873
|
})),
|
|
2282
|
-
a("span",
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2874
|
+
a("span", Qa, [c.view.description ? (g(), i("span", $a, T(c.view.description), 1)) : c.view.connector === void 0 && c.view.line ? (g(), i("span", eo, [a("span", to, T(E(Sr)(c.view.line)), 1)])) : r("v-if", !0), s(Ja, {
|
|
2875
|
+
view: c.view,
|
|
2876
|
+
result: p.value
|
|
2877
|
+
}, null, 8, ["view", "result"])]),
|
|
2878
|
+
c.view.risky ? (g(), i("span", no, T(E(l).t("kvcoder.ui.call.risky")), 1)) : r("v-if", !0),
|
|
2879
|
+
c.view.background ? (g(), i("span", ro, T(E(l).t("kvcoder.ui.jobs.background")), 1)) : r("v-if", !0),
|
|
2880
|
+
c.failed ? (g(), i("span", io, T(E(l).t("kvcoder.ui.callFailed")), 1)) : r("v-if", !0),
|
|
2881
|
+
a("span", ao, T(h.value), 1)
|
|
2882
|
+
], 8, Xa), d.value && c.output !== void 0 ? (g(), i(e, { key: 0 }, [
|
|
2883
|
+
_.value === "" ? r("v-if", !0) : (g(), i("p", oo, T(_.value), 1)),
|
|
2884
|
+
m.value ? (g(), i("pre", {
|
|
2289
2885
|
key: 1,
|
|
2290
|
-
class: "kvc-
|
|
2291
|
-
dir: "ltr",
|
|
2292
|
-
"aria-label": T(l).t("kvcoder.ui.command"),
|
|
2293
|
-
"data-test": "call-payload"
|
|
2294
|
-
}, w(h.value), 9, Ci)),
|
|
2295
|
-
c.output === "" ? r("v-if", !0) : (g(), i("pre", {
|
|
2296
|
-
key: 2,
|
|
2297
|
-
class: "kvc-output",
|
|
2886
|
+
class: "kvc-block kvc-error",
|
|
2298
2887
|
dir: "auto",
|
|
2299
|
-
"aria-label":
|
|
2300
|
-
"data-test": "call-
|
|
2301
|
-
}, [(
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2888
|
+
"aria-label": E(l).t("kvcoder.ui.call.error"),
|
|
2889
|
+
"data-test": "call-error"
|
|
2890
|
+
}, [s($, { text: c.output }, null, 8, ["text"])], 8, so)) : r("v-if", !0),
|
|
2891
|
+
s(wa, { view: c.view }, null, 8, ["view"]),
|
|
2892
|
+
m.value ? r("v-if", !0) : (g(), n(Ha, {
|
|
2893
|
+
key: 2,
|
|
2894
|
+
view: c.view,
|
|
2895
|
+
output: c.output,
|
|
2896
|
+
result: p.value
|
|
2897
|
+
}, null, 8, [
|
|
2898
|
+
"view",
|
|
2899
|
+
"output",
|
|
2900
|
+
"result"
|
|
2901
|
+
]))
|
|
2308
2902
|
], 64)) : r("v-if", !0)], 2));
|
|
2309
2903
|
}
|
|
2310
|
-
}),
|
|
2904
|
+
}), lo = {
|
|
2311
2905
|
key: 0,
|
|
2312
2906
|
class: "kvc-card",
|
|
2313
2907
|
"data-test": "background-result"
|
|
2314
|
-
},
|
|
2908
|
+
}, uo = { class: "kvc-card-row" }, fo = {
|
|
2909
|
+
style: {
|
|
2910
|
+
flex: "1 1 auto",
|
|
2911
|
+
"min-inline-size": "0"
|
|
2912
|
+
},
|
|
2913
|
+
"data-test": "background-title"
|
|
2914
|
+
}, po = {
|
|
2915
|
+
key: 0,
|
|
2916
|
+
class: "kvc-muted",
|
|
2917
|
+
"data-test": "background-time"
|
|
2918
|
+
}, mo = { class: "kvc-output" }, ho = {
|
|
2315
2919
|
key: 1,
|
|
2316
2920
|
class: "kvc-card",
|
|
2317
2921
|
"data-test": "kvcoder-hint"
|
|
2318
|
-
},
|
|
2922
|
+
}, go = { class: "kvc-card-row" }, _o = { class: "kvc-card-body kvc-muted" }, vo = {
|
|
2319
2923
|
key: 0,
|
|
2320
2924
|
style: {
|
|
2321
2925
|
display: "flex",
|
|
2322
2926
|
gap: "6px",
|
|
2323
2927
|
"margin-block-start": "6px"
|
|
2324
2928
|
}
|
|
2325
|
-
},
|
|
2929
|
+
}, yo = ["src", "alt"], bo = {
|
|
2326
2930
|
key: 1,
|
|
2327
2931
|
class: "kvc-muted",
|
|
2328
2932
|
style: { display: "block" },
|
|
2329
2933
|
"data-test": "queued"
|
|
2330
|
-
},
|
|
2934
|
+
}, xo = {
|
|
2331
2935
|
key: 3,
|
|
2332
2936
|
class: "kvc-answer",
|
|
2333
2937
|
"data-test": "assistant-message"
|
|
2334
|
-
},
|
|
2938
|
+
}, So = {
|
|
2335
2939
|
key: 0,
|
|
2336
2940
|
"data-test": "thinking"
|
|
2337
|
-
},
|
|
2941
|
+
}, Co = { class: "kvc-muted" }, wo = {
|
|
2338
2942
|
class: "kvc-muted",
|
|
2339
2943
|
style: { "white-space": "pre-wrap" }
|
|
2340
|
-
},
|
|
2944
|
+
}, To = {
|
|
2341
2945
|
key: 7,
|
|
2342
2946
|
class: "kvc-notice",
|
|
2343
2947
|
"data-test": "notice"
|
|
2344
|
-
},
|
|
2948
|
+
}, Eo = {
|
|
2345
2949
|
key: 8,
|
|
2346
2950
|
class: "kvc-card kvc-card-row",
|
|
2347
2951
|
role: "note",
|
|
2348
2952
|
"data-test": "note"
|
|
2349
|
-
},
|
|
2953
|
+
}, Do = {
|
|
2350
2954
|
key: 9,
|
|
2351
2955
|
class: "kvc-card",
|
|
2352
2956
|
"data-test": "summary"
|
|
2353
|
-
},
|
|
2957
|
+
}, Oo = { class: "kvc-card-row" }, ko = { class: "kvc-card-body" }, Ao = /* @__PURE__ */ c({
|
|
2354
2958
|
__name: "MessageItem",
|
|
2355
2959
|
props: {
|
|
2356
2960
|
message: {},
|
|
2357
|
-
calls: {}
|
|
2961
|
+
calls: {},
|
|
2962
|
+
finishedRuns: {}
|
|
2358
2963
|
},
|
|
2359
2964
|
emits: ["openArtifact"],
|
|
2360
2965
|
setup(c, { emit: l }) {
|
|
2361
|
-
let u = c, d = l, p =
|
|
2362
|
-
let e =
|
|
2966
|
+
let u = c, d = l, p = G(), m = t(() => Lr(u.message.content.content)), h = t(() => Rr(u.message)), _ = t(() => Vr(u.message, u.calls)), v = t(() => qr(u.message)), b = t(() => {
|
|
2967
|
+
let e = u.message.source?.kind === "subagent" ? "kvcoder.ui.helperFinished" : "kvcoder.ui.backgroundFinished", t = (u.message.source?.kind === "subagent" ? u.finishedRuns?.get(u.message.source.sessionId)?.title : void 0) ?? Qr(u.message);
|
|
2968
|
+
return t === void 0 ? p.t(e) : p.t(`${e}Named`, { name: Ze(t) });
|
|
2969
|
+
}), x = t(() => {
|
|
2970
|
+
let e = u.finishedRuns?.get(Xr(u.message) ?? "");
|
|
2971
|
+
return e === void 0 ? void 0 : Ya(p.t, e.ranMs);
|
|
2972
|
+
}), C = t(() => Wr(u.message, u.calls)), w = t(() => {
|
|
2973
|
+
let e = K(u.message.content.params), t = typeof e.code == "string" ? e.code : void 0, n = Object.fromEntries(Object.entries(Ue(e.details)).map(([e, t]) => [e, Ze(t)])), r = t === void 0 ? {} : { error: p.t(Ve(t), n) }, i = qe(e.details), a = String(u.message.content.code);
|
|
2363
2974
|
return p.t(`kvcoder.notices.${i === void 0 || a !== "STEP_FAILED" ? a : "STEP_FAILED_REASON"}`, {
|
|
2364
2975
|
...e,
|
|
2365
2976
|
...r,
|
|
2366
|
-
...i === void 0 ? {} : { reason:
|
|
2977
|
+
...i === void 0 ? {} : { reason: Ze(i) }
|
|
2367
2978
|
});
|
|
2368
|
-
}),
|
|
2979
|
+
}), D = t(() => {
|
|
2369
2980
|
let e = u.message.content.params;
|
|
2370
2981
|
return p.t(String(u.message.content.key), typeof e == "object" && e && !Array.isArray(e) ? Object.fromEntries(Object.entries(e)) : {});
|
|
2371
|
-
}),
|
|
2982
|
+
}), O = (e) => `/api/files/${encodeURIComponent(e)}?workspaceId=${encodeURIComponent(p.workspace.value.id)}`, k = (e) => ({
|
|
2372
2983
|
type: "markdown",
|
|
2373
2984
|
text: "kvcoder.markdown",
|
|
2374
2985
|
params: { text: e }
|
|
2375
2986
|
});
|
|
2376
|
-
return (t, c) =>
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2987
|
+
return (t, c) => E(Kr)(u.message) ? (g(), i("div", lo, [a("details", null, [a("summary", uo, [
|
|
2988
|
+
s(E(ie), {
|
|
2989
|
+
size: 16,
|
|
2990
|
+
"aria-hidden": "true"
|
|
2991
|
+
}),
|
|
2992
|
+
a("span", fo, T(b.value), 1),
|
|
2993
|
+
x.value === void 0 ? r("v-if", !0) : (g(), i("span", po, T(x.value), 1))
|
|
2994
|
+
]), a("pre", mo, T(m.value), 1)])])) : E(Gr)(u.message) ? (g(), i("div", ho, [a("details", null, [a("summary", go, [s(E(_e), {
|
|
2380
2995
|
size: 16,
|
|
2381
2996
|
"aria-hidden": "true"
|
|
2382
|
-
}), o(
|
|
2997
|
+
}), o(T(E(p).t("kvcoder.ui.toModel")), 1)]), a("div", _o, T(m.value), 1)])])) : u.message.kind === "user" ? (g(), i("div", {
|
|
2383
2998
|
key: 2,
|
|
2384
2999
|
dir: "auto",
|
|
2385
3000
|
class: f(["kvc-user", { "kvc-queued": u.message.queued }]),
|
|
2386
3001
|
"data-test": "user-message"
|
|
2387
3002
|
}, [
|
|
2388
|
-
a("span", null,
|
|
2389
|
-
u.message.fileIds ? (g(), i("span",
|
|
3003
|
+
a("span", null, T(E(Yr)(m.value, E(p).t("kvcoder.ui.attachedFiles"))), 1),
|
|
3004
|
+
u.message.fileIds ? (g(), i("span", vo, [(g(!0), i(e, null, y(u.message.fileIds, (e) => (g(), i("img", {
|
|
2390
3005
|
key: e,
|
|
2391
|
-
src:
|
|
2392
|
-
alt:
|
|
3006
|
+
src: O(e),
|
|
3007
|
+
alt: E(p).t("kvcoder.ui.attachment"),
|
|
2393
3008
|
style: {
|
|
2394
3009
|
"block-size": "48px",
|
|
2395
3010
|
"border-radius": "6px"
|
|
2396
3011
|
}
|
|
2397
|
-
}, null, 8,
|
|
2398
|
-
u.message.queued ? (g(), i("span",
|
|
2399
|
-
], 2)) : u.message.kind === "assistant" && (h.value !== "" || m.value !== "") ? (g(), i("div",
|
|
3012
|
+
}, null, 8, yo))), 128))])) : r("v-if", !0),
|
|
3013
|
+
u.message.queued ? (g(), i("span", bo, T(E(p).t("kvcoder.ui.queued")), 1)) : r("v-if", !0)
|
|
3014
|
+
], 2)) : u.message.kind === "assistant" && (h.value !== "" || m.value !== "") ? (g(), i("div", xo, [h.value === "" ? r("v-if", !0) : (g(), i("details", So, [a("summary", Co, T(E(p).t("kvcoder.ui.thought")), 1), a("p", wo, T(h.value), 1)])), m.value === "" ? r("v-if", !0) : (g(), n(S(E(p).View), {
|
|
2400
3015
|
key: 1,
|
|
2401
|
-
view:
|
|
2402
|
-
}, null, 8, ["view"]))])) : u.message.kind === "toolResult" && v.value !== void 0 ? (g(), n(
|
|
3016
|
+
view: k(m.value)
|
|
3017
|
+
}, null, 8, ["view"]))])) : u.message.kind === "toolResult" && v.value !== void 0 ? (g(), n(Si, {
|
|
2403
3018
|
key: 4,
|
|
2404
3019
|
id: v.value.id,
|
|
2405
3020
|
title: v.value.title,
|
|
@@ -2411,144 +3026,127 @@ var fi = ["aria-expanded", "disabled"], pi = ["aria-label"], mi = { class: "kvc-
|
|
|
2411
3026
|
"title",
|
|
2412
3027
|
"format",
|
|
2413
3028
|
"version"
|
|
2414
|
-
])) :
|
|
3029
|
+
])) : C.value === void 0 ? u.message.kind === "toolResult" ? (g(), n(co, {
|
|
2415
3030
|
key: 6,
|
|
2416
|
-
|
|
2417
|
-
label: _.value.label,
|
|
2418
|
-
line: _.value.line,
|
|
2419
|
-
payload: _.value.payload,
|
|
3031
|
+
view: _.value,
|
|
2420
3032
|
failed: _.value.failed,
|
|
2421
3033
|
"duration-ms": _.value.durationMs,
|
|
2422
|
-
|
|
2423
|
-
output: _.value.output,
|
|
2424
|
-
background: _.value.background
|
|
3034
|
+
output: _.value.output
|
|
2425
3035
|
}, null, 8, [
|
|
2426
|
-
"
|
|
2427
|
-
"label",
|
|
2428
|
-
"line",
|
|
2429
|
-
"payload",
|
|
3036
|
+
"view",
|
|
2430
3037
|
"failed",
|
|
2431
3038
|
"duration-ms",
|
|
2432
|
-
"
|
|
2433
|
-
|
|
2434
|
-
"background"
|
|
2435
|
-
])) : u.message.kind === "notice" ? (g(), i("div", Bi, w(S.value), 1)) : u.message.kind === "note" ? (g(), i("div", Vi, [s(T(fe), {
|
|
3039
|
+
"output"
|
|
3040
|
+
])) : u.message.kind === "notice" ? (g(), i("div", To, T(w.value), 1)) : u.message.kind === "note" ? (g(), i("div", Eo, [s(E(ve), {
|
|
2436
3041
|
size: 18,
|
|
2437
3042
|
"aria-hidden": "true"
|
|
2438
|
-
}), o(
|
|
3043
|
+
}), o(T(D.value), 1)])) : u.message.kind === "summary" ? (g(), i("details", Do, [a("summary", Oo, [s(E(Se), {
|
|
2439
3044
|
size: 16,
|
|
2440
3045
|
"aria-hidden": "true"
|
|
2441
|
-
}), o(
|
|
3046
|
+
}), o(T(E(p).t("kvcoder.ui.summarized")), 1)]), a("div", ko, [(g(), n(S(E(p).View), { view: k(String(u.message.content.text ?? "")) }, null, 8, ["view"]))])])) : r("v-if", !0) : (g(), n(_i, {
|
|
2442
3047
|
key: 5,
|
|
2443
|
-
answered:
|
|
3048
|
+
answered: C.value
|
|
2444
3049
|
}, null, 8, ["answered"]));
|
|
2445
3050
|
}
|
|
2446
|
-
}),
|
|
3051
|
+
}), jo = {
|
|
2447
3052
|
class: "kvc-card kvc-ask",
|
|
2448
3053
|
"data-test": "approvals-card"
|
|
2449
|
-
},
|
|
3054
|
+
}, Mo = {
|
|
2450
3055
|
class: "kvc-card-row",
|
|
2451
3056
|
style: { "font-weight": "600" }
|
|
2452
|
-
},
|
|
2453
|
-
display: "flex",
|
|
2454
|
-
"flex-direction": "column",
|
|
2455
|
-
flex: "1 1 auto",
|
|
2456
|
-
gap: "2px",
|
|
2457
|
-
"min-inline-size": "0"
|
|
2458
|
-
} }, Xi = {
|
|
3057
|
+
}, No = ["data-test"], Po = { class: "kvc-card-row" }, Fo = { class: "kvc-lines" }, Io = {
|
|
2459
3058
|
key: 0,
|
|
2460
3059
|
style: { "font-weight": "600" },
|
|
2461
3060
|
"data-test": "call-description"
|
|
2462
|
-
},
|
|
2463
|
-
key: 1,
|
|
2464
|
-
class: "kvc-muted",
|
|
2465
|
-
dir: "ltr",
|
|
2466
|
-
style: { "align-self": "flex-start" },
|
|
2467
|
-
"data-test": "call-label"
|
|
2468
|
-
}, Qi = {
|
|
3061
|
+
}, Lo = {
|
|
2469
3062
|
key: 2,
|
|
2470
3063
|
dir: "ltr",
|
|
2471
3064
|
style: { "align-self": "flex-start" },
|
|
2472
3065
|
"data-test": "call-subject"
|
|
2473
|
-
},
|
|
3066
|
+
}, Ro = {
|
|
2474
3067
|
key: 3,
|
|
2475
3068
|
class: "kvc-chip",
|
|
2476
3069
|
style: { "align-self": "flex-start" },
|
|
2477
3070
|
"data-test": "call-background"
|
|
2478
|
-
},
|
|
3071
|
+
}, zo = ["onClick"], Bo = ["onClick"], Vo = {
|
|
2479
3072
|
key: 0,
|
|
2480
3073
|
class: "kvc-card-row kvc-actions",
|
|
2481
3074
|
style: { "border-block-start": "1px solid var(--kv-color-border)" }
|
|
2482
|
-
},
|
|
3075
|
+
}, Ho = /* @__PURE__ */ c({
|
|
2483
3076
|
__name: "ApprovalsCard",
|
|
2484
3077
|
props: { approvals: {} },
|
|
2485
3078
|
emits: ["decide"],
|
|
2486
|
-
setup(t, { emit:
|
|
2487
|
-
let
|
|
3079
|
+
setup(t, { emit: c }) {
|
|
3080
|
+
let l = t, u = c, d = G(), p = (e, t) => u("decide", {
|
|
2488
3081
|
approvals: [...e],
|
|
2489
3082
|
confirmed: t
|
|
2490
3083
|
});
|
|
2491
|
-
return (t,
|
|
2492
|
-
a("div",
|
|
3084
|
+
return (t, c) => (g(), i("section", jo, [
|
|
3085
|
+
a("div", Mo, [s(E(we), {
|
|
2493
3086
|
size: 18,
|
|
2494
3087
|
"aria-hidden": "true"
|
|
2495
|
-
}), o(
|
|
2496
|
-
(g(!0), i(e, null, y(
|
|
3088
|
+
}), o(T(E(d).t("kvcoder.ui.allowCommands", { count: l.approvals.length })), 1)]),
|
|
3089
|
+
(g(!0), i(e, null, y(l.approvals, (e) => (g(), i("div", {
|
|
2497
3090
|
key: e.questionId,
|
|
2498
|
-
class: "kvc-
|
|
2499
|
-
style: { "border-block-start": "1px solid var(--kv-color-border)" },
|
|
3091
|
+
class: "kvc-approval",
|
|
2500
3092
|
"data-test": `approval-${e.questionId}`
|
|
2501
|
-
}, [
|
|
2502
|
-
a("span",
|
|
2503
|
-
e.description ? (g(), i("span",
|
|
2504
|
-
e.
|
|
2505
|
-
|
|
2506
|
-
|
|
3093
|
+
}, [a("div", Po, [
|
|
3094
|
+
a("span", Fo, [
|
|
3095
|
+
e.view.description ? (g(), i("span", Io, T(e.view.description), 1)) : r("v-if", !0),
|
|
3096
|
+
e.view.connector === void 0 ? e.view.line ? (g(), i("span", Lo, [a("span", { class: f(["kvc-mono", { "kvc-muted": e.view.description }]) }, T(e.view.line), 3)])) : r("v-if", !0) : (g(), n(Ja, {
|
|
3097
|
+
key: 1,
|
|
3098
|
+
view: e.view,
|
|
3099
|
+
whole: ""
|
|
3100
|
+
}, null, 8, ["view"])),
|
|
3101
|
+
e.view.background ? (g(), i("span", Ro, T(E(d).t("kvcoder.ui.jobs.inBackground")), 1)) : r("v-if", !0)
|
|
2507
3102
|
]),
|
|
2508
3103
|
a("button", {
|
|
2509
3104
|
type: "button",
|
|
2510
3105
|
class: "kvc-button",
|
|
2511
3106
|
"data-test": "deny",
|
|
2512
|
-
onClick: (t) =>
|
|
2513
|
-
},
|
|
3107
|
+
onClick: (t) => p([e], !1)
|
|
3108
|
+
}, T(E(d).t("kvcoder.ui.deny")), 9, zo),
|
|
2514
3109
|
a("button", {
|
|
2515
3110
|
type: "button",
|
|
2516
3111
|
class: "kvc-button kvc-primary",
|
|
2517
3112
|
"data-test": "allow",
|
|
2518
|
-
onClick: (t) =>
|
|
2519
|
-
},
|
|
2520
|
-
],
|
|
2521
|
-
|
|
3113
|
+
onClick: (t) => p([e], !0)
|
|
3114
|
+
}, T(E(d).t("kvcoder.ui.allow")), 9, Bo)
|
|
3115
|
+
]), E(xr)(e.view) === "line" ? r("v-if", !0) : (g(), n(wa, {
|
|
3116
|
+
key: 0,
|
|
3117
|
+
view: e.view
|
|
3118
|
+
}, null, 8, ["view"]))], 8, No))), 128)),
|
|
3119
|
+
l.approvals.length > 1 ? (g(), i("div", Vo, [a("button", {
|
|
2522
3120
|
type: "button",
|
|
2523
3121
|
class: "kvc-button",
|
|
2524
3122
|
"data-test": "deny-all",
|
|
2525
|
-
onClick:
|
|
2526
|
-
},
|
|
3123
|
+
onClick: c[0] ||= (e) => p(l.approvals, !1)
|
|
3124
|
+
}, T(E(d).t("kvcoder.ui.denyAll")), 1), a("button", {
|
|
2527
3125
|
type: "button",
|
|
2528
3126
|
class: "kvc-button kvc-primary",
|
|
2529
3127
|
"data-test": "allow-all",
|
|
2530
|
-
onClick:
|
|
2531
|
-
},
|
|
3128
|
+
onClick: c[1] ||= (e) => p(l.approvals, !0)
|
|
3129
|
+
}, T(E(d).t("kvcoder.ui.allowAll")), 1)])) : r("v-if", !0)
|
|
2532
3130
|
]));
|
|
2533
3131
|
}
|
|
2534
|
-
}),
|
|
3132
|
+
}), Uo = ["aria-label"], Wo = {
|
|
2535
3133
|
class: "kvc-card-row",
|
|
2536
3134
|
style: { "font-weight": "600" }
|
|
2537
|
-
},
|
|
3135
|
+
}, Go = { dir: "auto" }, Ko = { class: "kvc-card-body" }, qo = ["placeholder", "aria-label"], Jo = { class: "kvc-actions" }, Yo = ["data-test"], Xo = [
|
|
2538
3136
|
"type",
|
|
2539
3137
|
"checked",
|
|
2540
3138
|
"name",
|
|
2541
3139
|
"onChange"
|
|
2542
|
-
],
|
|
3140
|
+
], Zo = { style: {
|
|
2543
3141
|
display: "flex",
|
|
2544
3142
|
"flex-direction": "column"
|
|
2545
|
-
} },
|
|
3143
|
+
} }, Qo = { style: { "font-weight": "500" } }, $o = {
|
|
2546
3144
|
key: 0,
|
|
2547
3145
|
class: "kvc-muted"
|
|
2548
|
-
},
|
|
3146
|
+
}, es = ["placeholder", "aria-label"], ts = { class: "kvc-actions" }, ns = ["disabled"], rs = {
|
|
2549
3147
|
key: 2,
|
|
2550
3148
|
class: "kvc-actions"
|
|
2551
|
-
},
|
|
3149
|
+
}, is = /* @__PURE__ */ c({
|
|
2552
3150
|
__name: "QuestionCard",
|
|
2553
3151
|
props: {
|
|
2554
3152
|
questionId: {},
|
|
@@ -2556,17 +3154,17 @@ var fi = ["aria-expanded", "disabled"], pi = ["aria-label"], mi = { class: "kvc-
|
|
|
2556
3154
|
},
|
|
2557
3155
|
emits: ["answer"],
|
|
2558
3156
|
setup(n, { emit: o }) {
|
|
2559
|
-
let c = n, l = o, u =
|
|
3157
|
+
let c = n, l = o, u = G(), d = t(() => String(c.question.kind ?? "text")), p = t(() => String(c.question.prompt ?? "")), m = t(() => $r(c.question)), h = t(() => c.question.multiple === !0), _ = t(() => c.question.other === !0), b = v(""), x = v([]), S = v("");
|
|
2560
3158
|
function C(e) {
|
|
2561
3159
|
l("answer", {
|
|
2562
3160
|
questionId: c.questionId,
|
|
2563
3161
|
answer: e
|
|
2564
3162
|
});
|
|
2565
3163
|
}
|
|
2566
|
-
function
|
|
3164
|
+
function w(e) {
|
|
2567
3165
|
x.value = h.value ? x.value.includes(e) ? x.value.filter((t) => t !== e) : [...x.value, e] : [e], h.value || (S.value = "");
|
|
2568
3166
|
}
|
|
2569
|
-
function
|
|
3167
|
+
function D() {
|
|
2570
3168
|
let e = S.value.trim();
|
|
2571
3169
|
C({
|
|
2572
3170
|
selected: e !== "" && !h.value ? [] : x.value,
|
|
@@ -2577,28 +3175,28 @@ var fi = ["aria-expanded", "disabled"], pi = ["aria-label"], mi = { class: "kvc-
|
|
|
2577
3175
|
class: "kvc-card kvc-ask",
|
|
2578
3176
|
"data-test": "question-card",
|
|
2579
3177
|
"aria-label": p.value
|
|
2580
|
-
}, [a("div",
|
|
3178
|
+
}, [a("div", Wo, [s(E(le), {
|
|
2581
3179
|
size: 18,
|
|
2582
3180
|
"aria-hidden": "true"
|
|
2583
|
-
}), a("span",
|
|
3181
|
+
}), a("span", Go, T(p.value), 1)]), a("div", Ko, [d.value === "text" ? (g(), i(e, { key: 0 }, [j(a("input", {
|
|
2584
3182
|
"onUpdate:modelValue": n[0] ||= (e) => b.value = e,
|
|
2585
3183
|
class: "kvc-field",
|
|
2586
3184
|
dir: "auto",
|
|
2587
3185
|
placeholder: String(c.question.placeholder ?? ""),
|
|
2588
3186
|
"aria-label": p.value,
|
|
2589
3187
|
"data-test": "answer-text",
|
|
2590
|
-
onKeydown: n[1] ||=
|
|
2591
|
-
}, null, 40,
|
|
3188
|
+
onKeydown: n[1] ||= M(N((e) => C({ text: b.value }), ["prevent"]), ["enter"])
|
|
3189
|
+
}, null, 40, qo), [[O, b.value]]), a("div", Jo, [a("button", {
|
|
2592
3190
|
type: "button",
|
|
2593
3191
|
class: "kvc-button",
|
|
2594
3192
|
"data-test": "skip",
|
|
2595
3193
|
onClick: n[2] ||= (e) => C({ dismissed: !0 })
|
|
2596
|
-
},
|
|
3194
|
+
}, T(E(u).t("kvcoder.ui.skip")), 1), a("button", {
|
|
2597
3195
|
type: "button",
|
|
2598
3196
|
class: "kvc-button kvc-primary",
|
|
2599
3197
|
"data-test": "answer",
|
|
2600
3198
|
onClick: n[3] ||= (e) => C({ text: b.value })
|
|
2601
|
-
},
|
|
3199
|
+
}, T(E(u).t("kvcoder.ui.answer")), 1)])], 64)) : d.value === "choice" ? (g(), i(e, { key: 1 }, [
|
|
2602
3200
|
(g(!0), i(e, null, y(m.value, (e) => (g(), i("label", {
|
|
2603
3201
|
key: e.id,
|
|
2604
3202
|
class: "kvc-option",
|
|
@@ -2607,41 +3205,41 @@ var fi = ["aria-expanded", "disabled"], pi = ["aria-label"], mi = { class: "kvc-
|
|
|
2607
3205
|
type: h.value ? "checkbox" : "radio",
|
|
2608
3206
|
checked: x.value.includes(e.id),
|
|
2609
3207
|
name: c.questionId,
|
|
2610
|
-
onChange: (t) =>
|
|
2611
|
-
}, null, 40,
|
|
2612
|
-
_.value ?
|
|
3208
|
+
onChange: (t) => w(e.id)
|
|
3209
|
+
}, null, 40, Xo), a("span", Zo, [a("span", Qo, T(e.label), 1), e.description ? (g(), i("span", $o, T(e.description), 1)) : r("v-if", !0)])], 8, Yo))), 128)),
|
|
3210
|
+
_.value ? j((g(), i("input", {
|
|
2613
3211
|
key: 0,
|
|
2614
3212
|
"onUpdate:modelValue": n[4] ||= (e) => S.value = e,
|
|
2615
3213
|
class: "kvc-field",
|
|
2616
|
-
placeholder:
|
|
2617
|
-
"aria-label":
|
|
3214
|
+
placeholder: E(u).t("kvcoder.ui.other"),
|
|
3215
|
+
"aria-label": E(u).t("kvcoder.ui.other"),
|
|
2618
3216
|
"data-test": "answer-other"
|
|
2619
|
-
}, null, 8,
|
|
2620
|
-
a("div",
|
|
3217
|
+
}, null, 8, es)), [[O, S.value]]) : r("v-if", !0),
|
|
3218
|
+
a("div", ts, [a("button", {
|
|
2621
3219
|
type: "button",
|
|
2622
3220
|
class: "kvc-button",
|
|
2623
3221
|
"data-test": "skip",
|
|
2624
3222
|
onClick: n[5] ||= (e) => C({ dismissed: !0 })
|
|
2625
|
-
},
|
|
3223
|
+
}, T(E(u).t("kvcoder.ui.skip")), 1), a("button", {
|
|
2626
3224
|
type: "button",
|
|
2627
3225
|
class: "kvc-button kvc-primary",
|
|
2628
3226
|
disabled: x.value.length === 0 && S.value.trim() === "",
|
|
2629
3227
|
"data-test": "answer",
|
|
2630
|
-
onClick:
|
|
2631
|
-
},
|
|
2632
|
-
], 64)) : (g(), i("div",
|
|
3228
|
+
onClick: D
|
|
3229
|
+
}, T(E(u).t("kvcoder.ui.answer")), 9, ns)])
|
|
3230
|
+
], 64)) : (g(), i("div", rs, [a("button", {
|
|
2633
3231
|
type: "button",
|
|
2634
3232
|
class: "kvc-button",
|
|
2635
3233
|
"data-test": "answer-no",
|
|
2636
3234
|
onClick: n[6] ||= (e) => C({ confirmed: !1 })
|
|
2637
|
-
},
|
|
3235
|
+
}, T(E(u).t("kvcoder.ui.no")), 1), a("button", {
|
|
2638
3236
|
type: "button",
|
|
2639
3237
|
class: f(["kvc-button kvc-primary", { "kvc-danger": c.question.danger === !0 }]),
|
|
2640
3238
|
"data-test": "answer-yes",
|
|
2641
3239
|
onClick: n[7] ||= (e) => C({ confirmed: !0 })
|
|
2642
|
-
},
|
|
3240
|
+
}, T(E(u).t("kvcoder.ui.yes")), 3)]))])], 8, Uo));
|
|
2643
3241
|
}
|
|
2644
|
-
}),
|
|
3242
|
+
}), as = /* @__PURE__ */ c({
|
|
2645
3243
|
__name: "PendingCards",
|
|
2646
3244
|
props: {
|
|
2647
3245
|
pending: {},
|
|
@@ -2651,42 +3249,31 @@ var fi = ["aria-expanded", "disabled"], pi = ["aria-label"], mi = { class: "kvc-
|
|
|
2651
3249
|
setup(a, { emit: o }) {
|
|
2652
3250
|
let s = a, c = o, l = (e) => e.questionId !== null && s.hidden?.has(String(e.questionId)) !== !0, u = t(() => s.pending.filter((e) => e.kind === "question" && l(e)).map((e) => ({
|
|
2653
3251
|
questionId: String(e.questionId),
|
|
2654
|
-
question:
|
|
3252
|
+
question: K(e.question)
|
|
3253
|
+
}))), d = t(() => s.pending.filter((e) => e.kind === "approval" && l(e)).map((e) => ({
|
|
3254
|
+
questionId: String(e.questionId),
|
|
3255
|
+
view: yr(K(e.question))
|
|
2655
3256
|
})));
|
|
2656
|
-
|
|
2657
|
-
let t = Q(e), n = Y(e.payload);
|
|
2658
|
-
return t.line === void 0 ? typeof n.path == "string" ? n.path : t.payload === void 0 ? void 0 : dr(t.payload) : t.line;
|
|
2659
|
-
}
|
|
2660
|
-
let f = t(() => s.pending.filter((e) => e.kind === "approval" && l(e)).map((e) => {
|
|
2661
|
-
let t = Y(e.question), n = Q(t), r = d(t);
|
|
2662
|
-
return {
|
|
2663
|
-
questionId: String(e.questionId),
|
|
2664
|
-
...n.description === void 0 ? {} : { description: n.description },
|
|
2665
|
-
...n.label === void 0 ? {} : { label: n.label },
|
|
2666
|
-
...r === void 0 ? {} : { subject: r },
|
|
2667
|
-
...n.background === !0 ? { background: !0 } : {}
|
|
2668
|
-
};
|
|
2669
|
-
}));
|
|
2670
|
-
return (t, a) => (g(), i(e, null, [(g(!0), i(e, null, y(u.value, (e) => (g(), n(ya, {
|
|
3257
|
+
return (t, a) => (g(), i(e, null, [(g(!0), i(e, null, y(u.value, (e) => (g(), n(is, {
|
|
2671
3258
|
key: e.questionId,
|
|
2672
3259
|
"question-id": e.questionId,
|
|
2673
3260
|
question: e.question,
|
|
2674
3261
|
onAnswer: a[0] ||= (e) => c("answer", e)
|
|
2675
|
-
}, null, 8, ["question-id", "question"]))), 128)),
|
|
3262
|
+
}, null, 8, ["question-id", "question"]))), 128)), d.value.length > 0 ? (g(), n(Ho, {
|
|
2676
3263
|
key: 0,
|
|
2677
|
-
approvals:
|
|
3264
|
+
approvals: d.value,
|
|
2678
3265
|
onDecide: a[1] ||= (e) => c("decide", e)
|
|
2679
3266
|
}, null, 8, ["approvals"])) : r("v-if", !0)], 64));
|
|
2680
3267
|
}
|
|
2681
3268
|
});
|
|
2682
3269
|
//#endregion
|
|
2683
3270
|
//#region web/src/use-model-groups.ts
|
|
2684
|
-
function
|
|
3271
|
+
function os(e, t, n) {
|
|
2685
3272
|
let r = v([]);
|
|
2686
3273
|
return m(async () => {
|
|
2687
3274
|
try {
|
|
2688
3275
|
let [n, i] = await Promise.all([e.exec("kvai.provider.list", {}), e.exec("kvai.model.list", {})]);
|
|
2689
|
-
r.value =
|
|
3276
|
+
r.value = Kt(n, i, t());
|
|
2690
3277
|
} catch (e) {
|
|
2691
3278
|
n(e);
|
|
2692
3279
|
}
|
|
@@ -2694,15 +3281,15 @@ function xa(e, t, n) {
|
|
|
2694
3281
|
}
|
|
2695
3282
|
//#endregion
|
|
2696
3283
|
//#region web/src/RecoveryActions.vue?vue&type=script&setup=true&lang.ts
|
|
2697
|
-
var
|
|
3284
|
+
var ss = {
|
|
2698
3285
|
class: "kvc-recovery",
|
|
2699
3286
|
"data-test": "recovery"
|
|
2700
|
-
},
|
|
3287
|
+
}, cs = { class: "kvc-recovery-picker" }, ls = /* @__PURE__ */ c({
|
|
2701
3288
|
__name: "RecoveryActions",
|
|
2702
3289
|
props: { sessionId: {} },
|
|
2703
3290
|
emits: ["sent"],
|
|
2704
3291
|
setup(e, { emit: t }) {
|
|
2705
|
-
let n = e, r = t, c =
|
|
3292
|
+
let n = e, r = t, c = G(), l = os(c, () => null, (e) => q(c, e));
|
|
2706
3293
|
async function u() {
|
|
2707
3294
|
await c.exec("kvcoder.message.send", {
|
|
2708
3295
|
sessionId: n.sessionId,
|
|
@@ -2713,109 +3300,109 @@ var Sa = {
|
|
|
2713
3300
|
try {
|
|
2714
3301
|
await e();
|
|
2715
3302
|
} catch (e) {
|
|
2716
|
-
|
|
3303
|
+
q(c, e);
|
|
2717
3304
|
}
|
|
2718
3305
|
}
|
|
2719
3306
|
let f = () => d(u), p = (e) => d(async () => {
|
|
2720
3307
|
await c.exec("kvcoder.session.configure", {
|
|
2721
3308
|
sessionId: n.sessionId,
|
|
2722
3309
|
model: e
|
|
2723
|
-
}), await
|
|
3310
|
+
}), await hn(c, e), await u();
|
|
2724
3311
|
});
|
|
2725
|
-
return (e, t) => (g(), i("div",
|
|
3312
|
+
return (e, t) => (g(), i("div", ss, [a("button", {
|
|
2726
3313
|
type: "button",
|
|
2727
3314
|
class: "kvc-button",
|
|
2728
3315
|
"data-test": "retry",
|
|
2729
3316
|
onClick: f
|
|
2730
|
-
}, [s(
|
|
3317
|
+
}, [s(E(xe), {
|
|
2731
3318
|
size: 14,
|
|
2732
3319
|
"aria-hidden": "true"
|
|
2733
|
-
}), o(
|
|
2734
|
-
groups:
|
|
3320
|
+
}), o(T(E(c).t("kvcoder.ui.retry")), 1)]), a("div", cs, [s(dn, {
|
|
3321
|
+
groups: E(l),
|
|
2735
3322
|
current: null,
|
|
2736
|
-
empty:
|
|
3323
|
+
empty: E(c).t("kvcoder.ui.chooseAnotherModel"),
|
|
2737
3324
|
onPick: p
|
|
2738
3325
|
}, null, 8, ["groups", "empty"])])]));
|
|
2739
3326
|
}
|
|
2740
|
-
}),
|
|
3327
|
+
}), us = {
|
|
2741
3328
|
class: "kvc-column",
|
|
2742
3329
|
"data-test": "prompt-tab"
|
|
2743
|
-
},
|
|
3330
|
+
}, ds = { style: {
|
|
2744
3331
|
display: "flex",
|
|
2745
3332
|
"align-items": "center",
|
|
2746
3333
|
gap: "10px"
|
|
2747
|
-
} },
|
|
3334
|
+
} }, fs = { style: { flex: "1 1 auto" } }, ps = {
|
|
2748
3335
|
key: 0,
|
|
2749
3336
|
style: {
|
|
2750
3337
|
margin: "0",
|
|
2751
3338
|
"padding-inline-start": "20px"
|
|
2752
3339
|
}
|
|
2753
|
-
},
|
|
3340
|
+
}, ms = {
|
|
2754
3341
|
key: 0,
|
|
2755
3342
|
class: "kvc-chip kvc-warn"
|
|
2756
|
-
},
|
|
3343
|
+
}, hs = {
|
|
2757
3344
|
key: 1,
|
|
2758
3345
|
class: "kvc-prompt",
|
|
2759
3346
|
"data-test": "prompt-text"
|
|
2760
|
-
},
|
|
3347
|
+
}, gs = /* @__PURE__ */ c({
|
|
2761
3348
|
__name: "PromptTab",
|
|
2762
3349
|
props: { sessionId: {} },
|
|
2763
3350
|
emits: ["back"],
|
|
2764
3351
|
setup(t, { emit: n }) {
|
|
2765
|
-
let c = t, l = n, u =
|
|
2766
|
-
|
|
3352
|
+
let c = t, l = n, u = G(), d = v(null);
|
|
3353
|
+
k(() => c.sessionId, async (e) => {
|
|
2767
3354
|
try {
|
|
2768
3355
|
d.value = await u.exec("kvcoder.prompt.get", { sessionId: e });
|
|
2769
3356
|
} catch (e) {
|
|
2770
|
-
|
|
3357
|
+
q(u, e);
|
|
2771
3358
|
}
|
|
2772
3359
|
}, { immediate: !0 });
|
|
2773
3360
|
async function f() {
|
|
2774
3361
|
d.value !== null && (await navigator.clipboard.writeText(d.value.prompt), u.toast("kvcoder.ui.copied", {}, "success"));
|
|
2775
3362
|
}
|
|
2776
|
-
return (t, n) => (g(), i("div",
|
|
2777
|
-
a("div",
|
|
3363
|
+
return (t, n) => (g(), i("div", us, [
|
|
3364
|
+
a("div", ds, [
|
|
2778
3365
|
a("button", {
|
|
2779
3366
|
type: "button",
|
|
2780
3367
|
class: "kvc-button",
|
|
2781
3368
|
"data-test": "prompt-back",
|
|
2782
3369
|
onClick: n[0] ||= (e) => l("back")
|
|
2783
|
-
}, [s(
|
|
3370
|
+
}, [s(E(U), {
|
|
2784
3371
|
size: 16,
|
|
2785
3372
|
class: "kvc-flip",
|
|
2786
3373
|
"aria-hidden": "true"
|
|
2787
|
-
}), o(
|
|
2788
|
-
a("strong",
|
|
3374
|
+
}), o(T(E(u).t("kvcoder.ui.showChat")), 1)]),
|
|
3375
|
+
a("strong", fs, T(E(u).t("kvcoder.ui.promptTitle")), 1),
|
|
2789
3376
|
a("button", {
|
|
2790
3377
|
type: "button",
|
|
2791
3378
|
class: "kvc-button",
|
|
2792
3379
|
"data-test": "copy-prompt",
|
|
2793
3380
|
onClick: f
|
|
2794
|
-
}, [s(
|
|
3381
|
+
}, [s(E(de), { size: 16 }), o(T(E(u).t("kvcoder.ui.copy")), 1)])
|
|
2795
3382
|
]),
|
|
2796
|
-
d.value ? (g(), i("ul",
|
|
3383
|
+
d.value ? (g(), i("ul", ps, [(g(!0), i(e, null, y(d.value.sections, (e) => (g(), i("li", {
|
|
2797
3384
|
key: `${e.owner}/${e.id}`,
|
|
2798
3385
|
class: "kvc-muted",
|
|
2799
3386
|
"data-test": "prompt-section"
|
|
2800
|
-
}, [o(
|
|
3387
|
+
}, [o(T(E(u).t("kvcoder.ui.section", {
|
|
2801
3388
|
title: e.title,
|
|
2802
3389
|
owner: e.owner,
|
|
2803
|
-
reach:
|
|
3390
|
+
reach: E(u).t(`kvcoder.ui.reach.${e.reach}`),
|
|
2804
3391
|
size: e.size
|
|
2805
|
-
})) + " ", 1), e.included ? r("v-if", !0) : (g(), i("span",
|
|
2806
|
-
d.value ? (g(), i("pre",
|
|
3392
|
+
})) + " ", 1), e.included ? r("v-if", !0) : (g(), i("span", ms, T(E(u).t("kvcoder.ui.leftOut")), 1))]))), 128))])) : r("v-if", !0),
|
|
3393
|
+
d.value ? (g(), i("pre", hs, T(d.value.prompt), 1)) : r("v-if", !0)
|
|
2807
3394
|
]));
|
|
2808
3395
|
}
|
|
2809
3396
|
});
|
|
2810
3397
|
//#endregion
|
|
2811
3398
|
//#region web/src/use-session-actions.ts
|
|
2812
|
-
function
|
|
2813
|
-
let r =
|
|
3399
|
+
function _s(e, t, n) {
|
|
3400
|
+
let r = w();
|
|
2814
3401
|
async function i(t) {
|
|
2815
3402
|
try {
|
|
2816
3403
|
await t(), await n();
|
|
2817
3404
|
} catch (t) {
|
|
2818
|
-
|
|
3405
|
+
q(e, t);
|
|
2819
3406
|
}
|
|
2820
3407
|
}
|
|
2821
3408
|
async function a(e, t) {
|
|
@@ -2842,7 +3429,7 @@ function Ma(e, t, n) {
|
|
|
2842
3429
|
await e.exec("kvcoder.session.configure", {
|
|
2843
3430
|
sessionId: t(),
|
|
2844
3431
|
...n
|
|
2845
|
-
}), n.model !== void 0 && await
|
|
3432
|
+
}), n.model !== void 0 && await hn(e, n.model);
|
|
2846
3433
|
}),
|
|
2847
3434
|
rename: (n) => a("rename", async () => {
|
|
2848
3435
|
n.trim() !== "" && await e.exec("kvcoder.session.rename", {
|
|
@@ -2862,7 +3449,7 @@ function Ma(e, t, n) {
|
|
|
2862
3449
|
argument: i
|
|
2863
3450
|
}), await n(), !0;
|
|
2864
3451
|
} catch (t) {
|
|
2865
|
-
return
|
|
3452
|
+
return q(e, t), !1;
|
|
2866
3453
|
}
|
|
2867
3454
|
},
|
|
2868
3455
|
remove: () => i(async () => {
|
|
@@ -2872,94 +3459,100 @@ function Ma(e, t, n) {
|
|
|
2872
3459
|
}
|
|
2873
3460
|
//#endregion
|
|
2874
3461
|
//#region web/src/SessionModel.vue
|
|
2875
|
-
var
|
|
3462
|
+
var vs = /* @__PURE__ */ c({
|
|
2876
3463
|
__name: "SessionModel",
|
|
2877
3464
|
props: { session: {} },
|
|
2878
3465
|
emits: ["changed"],
|
|
2879
3466
|
setup(e, { emit: t }) {
|
|
2880
|
-
let r = e, i = t, a =
|
|
2881
|
-
return (e, t) => (g(), n(
|
|
2882
|
-
groups:
|
|
3467
|
+
let r = e, i = t, a = G(), o = os(a, () => r.session.model, (e) => q(a, e)), s = _s(a, () => r.session.id, () => i("changed"));
|
|
3468
|
+
return (e, t) => (g(), n(mn, {
|
|
3469
|
+
groups: E(o),
|
|
2883
3470
|
model: r.session.model ?? null,
|
|
2884
3471
|
thinking: r.session.thinking,
|
|
2885
|
-
onModel: t[0] ||= (e) =>
|
|
2886
|
-
onThinking: t[1] ||= (e) =>
|
|
3472
|
+
onModel: t[0] ||= (e) => E(s).configure({ model: e }),
|
|
3473
|
+
onThinking: t[1] ||= (e) => E(s).configure({ thinking: e })
|
|
2887
3474
|
}, null, 8, [
|
|
2888
3475
|
"groups",
|
|
2889
3476
|
"model",
|
|
2890
3477
|
"thinking"
|
|
2891
3478
|
]));
|
|
2892
3479
|
}
|
|
2893
|
-
}),
|
|
3480
|
+
}), ys = ["aria-label"], bs = { class: "kvc-card-row" }, xs = {
|
|
2894
3481
|
key: 0,
|
|
2895
3482
|
class: "kvc-chip kvc-mono",
|
|
2896
3483
|
"data-test": "subagent-worker"
|
|
2897
|
-
},
|
|
2898
|
-
|
|
2899
|
-
"
|
|
2900
|
-
}
|
|
3484
|
+
}, Ss = { class: "kvc-lines" }, Cs = {
|
|
3485
|
+
style: { "font-weight": "600" },
|
|
3486
|
+
"data-test": "subagent-title"
|
|
3487
|
+
}, ws = {
|
|
3488
|
+
key: 0,
|
|
3489
|
+
class: "kvc-muted kvc-oneline",
|
|
3490
|
+
dir: "auto",
|
|
3491
|
+
"data-test": "subagent-task"
|
|
3492
|
+
}, Ts = {
|
|
2901
3493
|
key: 1,
|
|
2902
3494
|
class: "kvc-spin"
|
|
2903
|
-
},
|
|
3495
|
+
}, Es = {
|
|
2904
3496
|
key: 0,
|
|
2905
3497
|
class: "kvc-card-body"
|
|
2906
|
-
},
|
|
3498
|
+
}, Ds = {
|
|
2907
3499
|
key: 0,
|
|
2908
3500
|
class: "kvc-muted",
|
|
2909
3501
|
style: {
|
|
2910
3502
|
margin: "0",
|
|
2911
3503
|
"white-space": "pre-wrap"
|
|
2912
3504
|
}
|
|
2913
|
-
},
|
|
3505
|
+
}, Os = /* @__PURE__ */ c({
|
|
2914
3506
|
__name: "SubagentCard",
|
|
2915
3507
|
props: {
|
|
2916
3508
|
child: {},
|
|
3509
|
+
task: {},
|
|
2917
3510
|
hidden: {}
|
|
2918
3511
|
},
|
|
2919
3512
|
emits: ["answer", "decide"],
|
|
2920
3513
|
setup(e, { emit: n }) {
|
|
2921
|
-
let o = e, c = n, l =
|
|
3514
|
+
let o = e, c = n, l = G(), u = t(() => o.task?.trim().split("\n")[0]), d = t(() => l.t(`kvcoder.ui.status.${o.child.session.status}`));
|
|
2922
3515
|
return (e, t) => (g(), i("section", {
|
|
2923
3516
|
class: "kvc-card",
|
|
2924
3517
|
"data-test": "subagent-card",
|
|
2925
|
-
"aria-label":
|
|
2926
|
-
}, [a("div",
|
|
2927
|
-
s(
|
|
3518
|
+
"aria-label": E(Be)(E(l).t, o.child.session.title)
|
|
3519
|
+
}, [a("div", bs, [
|
|
3520
|
+
s(E(W), {
|
|
2928
3521
|
size: 18,
|
|
2929
3522
|
"aria-hidden": "true"
|
|
2930
3523
|
}),
|
|
2931
|
-
o.child.session.worker === void 0 ? r("v-if", !0) : (g(), i("span",
|
|
2932
|
-
a("span",
|
|
2933
|
-
o.child.session.status === "running" ? (g(), i("span",
|
|
2934
|
-
a("span", { class: f(["kvc-chip", { "kvc-warn": o.child.session.status === "waiting" }]) },
|
|
2935
|
-
]), o.child.live.text !== "" || (o.child.turn?.pending.length ?? 0) > 0 ? (g(), i("div",
|
|
3524
|
+
o.child.session.worker === void 0 ? r("v-if", !0) : (g(), i("span", xs, T(o.child.session.worker), 1)),
|
|
3525
|
+
a("span", Ss, [a("span", Cs, T(E(Be)(E(l).t, o.child.session.title)), 1), u.value ? (g(), i("span", ws, T(u.value), 1)) : r("v-if", !0)]),
|
|
3526
|
+
o.child.session.status === "running" ? (g(), i("span", Ts)) : r("v-if", !0),
|
|
3527
|
+
a("span", { class: f(["kvc-chip", { "kvc-warn": o.child.session.status === "waiting" }]) }, T(d.value), 3)
|
|
3528
|
+
]), o.child.live.text !== "" || (o.child.turn?.pending.length ?? 0) > 0 ? (g(), i("div", Es, [o.child.live.text === "" ? r("v-if", !0) : (g(), i("p", Ds, T(o.child.live.text), 1)), s(as, {
|
|
2936
3529
|
pending: o.child.turn?.pending ?? [],
|
|
2937
3530
|
hidden: o.hidden,
|
|
2938
3531
|
onAnswer: t[0] ||= (e) => c("answer", e),
|
|
2939
3532
|
onDecide: t[1] ||= (e) => c("decide", e)
|
|
2940
|
-
}, null, 8, ["pending", "hidden"])])) : r("v-if", !0)], 8,
|
|
3533
|
+
}, null, 8, ["pending", "hidden"])])) : r("v-if", !0)], 8, ys));
|
|
2941
3534
|
}
|
|
2942
|
-
}),
|
|
3535
|
+
}), ks = ["aria-label"], As = { class: "kvc-card-row" }, js = {
|
|
2943
3536
|
class: "kvc-chip kvc-mono",
|
|
2944
3537
|
"data-test": "worker-card-name"
|
|
2945
|
-
},
|
|
3538
|
+
}, Ms = {
|
|
2946
3539
|
style: {
|
|
2947
3540
|
flex: "1 1 auto",
|
|
2948
3541
|
"font-weight": "500"
|
|
2949
3542
|
},
|
|
2950
3543
|
dir: "auto",
|
|
2951
3544
|
"data-test": "worker-card-call"
|
|
2952
|
-
},
|
|
3545
|
+
}, Ns = {
|
|
2953
3546
|
class: "kvc-chip",
|
|
2954
3547
|
"data-test": "worker-card-time"
|
|
2955
|
-
},
|
|
3548
|
+
}, Ps = ["disabled"], Fs = /* @__PURE__ */ c({
|
|
2956
3549
|
__name: "WorkerCard",
|
|
2957
3550
|
props: {
|
|
2958
3551
|
sessionId: {},
|
|
2959
3552
|
runId: {}
|
|
2960
3553
|
},
|
|
2961
3554
|
setup(e) {
|
|
2962
|
-
let t = e, n =
|
|
3555
|
+
let t = e, n = G(), o = v(), c = v(Date.now()), l = v(!1), u;
|
|
2963
3556
|
m(async () => {
|
|
2964
3557
|
u = setInterval(() => c.value = Date.now(), 1e3);
|
|
2965
3558
|
try {
|
|
@@ -2968,7 +3561,7 @@ var Na = /* @__PURE__ */ c({
|
|
|
2968
3561
|
id: t.runId
|
|
2969
3562
|
});
|
|
2970
3563
|
} catch (e) {
|
|
2971
|
-
|
|
3564
|
+
q(n, e);
|
|
2972
3565
|
}
|
|
2973
3566
|
}), p(() => clearInterval(u));
|
|
2974
3567
|
async function d() {
|
|
@@ -2979,7 +3572,7 @@ var Na = /* @__PURE__ */ c({
|
|
|
2979
3572
|
id: t.runId
|
|
2980
3573
|
});
|
|
2981
3574
|
} catch (e) {
|
|
2982
|
-
|
|
3575
|
+
q(n, e);
|
|
2983
3576
|
}
|
|
2984
3577
|
l.value = !1;
|
|
2985
3578
|
}
|
|
@@ -2988,34 +3581,34 @@ var Na = /* @__PURE__ */ c({
|
|
|
2988
3581
|
class: "kvc-card",
|
|
2989
3582
|
"data-test": "worker-card",
|
|
2990
3583
|
"aria-label": o.value.title
|
|
2991
|
-
}, [a("div",
|
|
2992
|
-
s(
|
|
3584
|
+
}, [a("div", As, [
|
|
3585
|
+
s(E(W), {
|
|
2993
3586
|
size: 18,
|
|
2994
3587
|
"aria-hidden": "true"
|
|
2995
3588
|
}),
|
|
2996
|
-
a("span",
|
|
2997
|
-
a("span",
|
|
3589
|
+
a("span", js, T(o.value.title), 1),
|
|
3590
|
+
a("span", Ms, T(o.value.call), 1),
|
|
2998
3591
|
t[0] ||= a("span", { class: "kvc-spin" }, null, -1),
|
|
2999
|
-
a("span",
|
|
3592
|
+
a("span", Ns, T(E(n).t("kvcoder.ui.jobs.status.running")) + " · " + T(E(jn)(E(n).t, c.value - Date.parse(o.value.startedAt))), 1),
|
|
3000
3593
|
a("button", {
|
|
3001
3594
|
type: "button",
|
|
3002
3595
|
class: "kvc-button",
|
|
3003
3596
|
disabled: l.value,
|
|
3004
3597
|
"data-test": "worker-card-stop",
|
|
3005
3598
|
onClick: d
|
|
3006
|
-
},
|
|
3007
|
-
])], 8,
|
|
3599
|
+
}, T(E(n).t("kvcoder.ui.jobs.stop")), 9, Ps)
|
|
3600
|
+
])], 8, ks));
|
|
3008
3601
|
}
|
|
3009
|
-
}),
|
|
3010
|
-
let t = e.description ?? e.
|
|
3602
|
+
}), Is = (e) => {
|
|
3603
|
+
let t = e.view.description ?? e.view.line;
|
|
3011
3604
|
return {
|
|
3012
3605
|
name: "run",
|
|
3013
3606
|
...t === void 0 ? {} : { description: t },
|
|
3014
|
-
...e.label === void 0 ? {} : { label: e.label },
|
|
3607
|
+
...e.view.label === void 0 ? {} : { label: e.view.label },
|
|
3015
3608
|
complete: !0
|
|
3016
3609
|
};
|
|
3017
3610
|
};
|
|
3018
|
-
function
|
|
3611
|
+
function Ls(e, t) {
|
|
3019
3612
|
let n = v(/* @__PURE__ */ new Set()), r = /* @__PURE__ */ new Map();
|
|
3020
3613
|
function i(e) {
|
|
3021
3614
|
for (let { questionId: t } of e) n.value.delete(t), r.delete(t);
|
|
@@ -3026,18 +3619,18 @@ function Xa(e, t) {
|
|
|
3026
3619
|
for (let [t, n] of a.entries()) try {
|
|
3027
3620
|
o = (await e.exec("kvcoder.question.answer", n)).jobId ?? o;
|
|
3028
3621
|
} catch (n) {
|
|
3029
|
-
if (
|
|
3030
|
-
i(a.slice(t)),
|
|
3622
|
+
if (He(n)?.code === "kvcoder/QUESTION_NOT_FOUND") continue;
|
|
3623
|
+
i(a.slice(t)), q(e, n);
|
|
3031
3624
|
return;
|
|
3032
3625
|
}
|
|
3033
3626
|
let s = o === null ? [] : [...r.values()];
|
|
3034
|
-
o !== null && r.clear(), await t(s).catch((t) =>
|
|
3627
|
+
o !== null && r.clear(), await t(s).catch((t) => q(e, t));
|
|
3035
3628
|
}
|
|
3036
3629
|
return {
|
|
3037
3630
|
hidden: n,
|
|
3038
3631
|
answer: (e) => a([e]),
|
|
3039
3632
|
decide: ({ approvals: e, confirmed: t }) => {
|
|
3040
|
-
if (t) for (let t of e) r.set(t.questionId,
|
|
3633
|
+
if (t) for (let t of e) r.set(t.questionId, Is(t));
|
|
3041
3634
|
return a(e.map((e) => ({
|
|
3042
3635
|
questionId: e.questionId,
|
|
3043
3636
|
answer: { confirmed: t }
|
|
@@ -3047,7 +3640,7 @@ function Xa(e, t) {
|
|
|
3047
3640
|
}
|
|
3048
3641
|
//#endregion
|
|
3049
3642
|
//#region web/src/use-artifacts.ts
|
|
3050
|
-
function
|
|
3643
|
+
function Rs(e, t, n, r) {
|
|
3051
3644
|
let i = v([]), a = v(void 0), o = v(void 0), s = v(!1), c = /* @__PURE__ */ new Set(), l, u = !1, d = 0, f = !1;
|
|
3052
3645
|
function h(e) {
|
|
3053
3646
|
l = e, u = !1, c.clear(), i.value = [], a.value = void 0, o.value = void 0, s.value = !1;
|
|
@@ -3145,7 +3738,7 @@ function Za(e, t, n, r) {
|
|
|
3145
3738
|
function S() {
|
|
3146
3739
|
s.value = !1;
|
|
3147
3740
|
}
|
|
3148
|
-
return m(_),
|
|
3741
|
+
return m(_), k([t, n], _), p(() => {
|
|
3149
3742
|
f = !0;
|
|
3150
3743
|
}), {
|
|
3151
3744
|
list: i,
|
|
@@ -3160,9 +3753,9 @@ function Za(e, t, n, r) {
|
|
|
3160
3753
|
}
|
|
3161
3754
|
//#endregion
|
|
3162
3755
|
//#region web/src/use-conversation.ts
|
|
3163
|
-
var
|
|
3164
|
-
function
|
|
3165
|
-
let r =
|
|
3756
|
+
var zs = 5e3, Bs = 200;
|
|
3757
|
+
function Vs(e, t, n) {
|
|
3758
|
+
let r = w(null), i = w([]), a = w(0), o = w([]), s = w(null), c = w(void 0), l, u = w(!1), d = _(Cr()), f = C(/* @__PURE__ */ new Map()), p = /* @__PURE__ */ new Set(), m = !1;
|
|
3166
3759
|
async function g(t) {
|
|
3167
3760
|
let n = (t?.pending ?? []).flatMap((e) => e.childSessionId === null ? [] : [e.childSessionId]);
|
|
3168
3761
|
for (let e of [...f.keys()]) n.includes(e) || f.delete(e);
|
|
@@ -3174,7 +3767,7 @@ function eo(e, t, n) {
|
|
|
3174
3767
|
f.set(t, {
|
|
3175
3768
|
session: n,
|
|
3176
3769
|
turn: r,
|
|
3177
|
-
live: f.get(t)?.live ?? _(
|
|
3770
|
+
live: f.get(t)?.live ?? _(Cr())
|
|
3178
3771
|
});
|
|
3179
3772
|
}
|
|
3180
3773
|
}
|
|
@@ -3182,14 +3775,14 @@ function eo(e, t, n) {
|
|
|
3182
3775
|
async function y(t, n) {
|
|
3183
3776
|
let r = await e.exec("kvcoder.message.list", {
|
|
3184
3777
|
sessionId: t,
|
|
3185
|
-
limit:
|
|
3778
|
+
limit: Bs
|
|
3186
3779
|
});
|
|
3187
3780
|
i.value = r.messages, a.value = r.omitted, l = n;
|
|
3188
3781
|
}
|
|
3189
3782
|
async function b(t, n, r) {
|
|
3190
3783
|
let a = await e.exec("kvcoder.message.list", {
|
|
3191
3784
|
sessionId: t,
|
|
3192
|
-
limit:
|
|
3785
|
+
limit: Bs,
|
|
3193
3786
|
afterSeq: r
|
|
3194
3787
|
}), o = v(a.messages);
|
|
3195
3788
|
if (o[0] !== void 0 && o[0].seq !== r + 1) return y(t, n);
|
|
@@ -3208,7 +3801,7 @@ function eo(e, t, n) {
|
|
|
3208
3801
|
c.value = e;
|
|
3209
3802
|
}
|
|
3210
3803
|
}
|
|
3211
|
-
async function
|
|
3804
|
+
async function S() {
|
|
3212
3805
|
let n = t();
|
|
3213
3806
|
if (n === void 0) return;
|
|
3214
3807
|
let [i, a, c] = await Promise.all([
|
|
@@ -3224,50 +3817,50 @@ function eo(e, t, n) {
|
|
|
3224
3817
|
async function T(t, r, i, a = []) {
|
|
3225
3818
|
let o = t, s = a;
|
|
3226
3819
|
for (; o !== void 0 && !m && !p.has(o);) {
|
|
3227
|
-
p.add(o), Object.assign(r,
|
|
3820
|
+
p.add(o), Object.assign(r, Cr()), r.calls = s.map((e) => ({
|
|
3228
3821
|
...e,
|
|
3229
3822
|
complete: !0,
|
|
3230
3823
|
carried: !0
|
|
3231
3824
|
})), s = [], e.follow(o).catch(n);
|
|
3232
3825
|
let t;
|
|
3233
3826
|
for await (let i of e.stream(o)) {
|
|
3234
|
-
let e =
|
|
3235
|
-
e.kind === "follow" && (t = e.jobId), e.kind === "subagent" && D(e.sessionId, e.jobId).catch(n), e.kind === "question" &&
|
|
3827
|
+
let e = Dr(r, i);
|
|
3828
|
+
e.kind === "follow" && (t = e.jobId), e.kind === "subagent" && D(e.sessionId, e.jobId).catch(n), e.kind === "question" && S().catch(n);
|
|
3236
3829
|
}
|
|
3237
3830
|
p.delete(o);
|
|
3238
3831
|
let a = await i();
|
|
3239
3832
|
o = t ?? (a === o ? void 0 : a);
|
|
3240
3833
|
}
|
|
3241
|
-
Object.assign(r,
|
|
3834
|
+
Object.assign(r, Cr());
|
|
3242
3835
|
}
|
|
3243
3836
|
async function E(e, t = []) {
|
|
3244
3837
|
u.value = !0;
|
|
3245
3838
|
try {
|
|
3246
|
-
await T(e, d, async () => (await
|
|
3839
|
+
await T(e, d, async () => (await S(), r.value?.status === "running" ? r.value.stepJobId : void 0), t);
|
|
3247
3840
|
} finally {
|
|
3248
3841
|
u.value = p.size > 0;
|
|
3249
3842
|
}
|
|
3250
3843
|
}
|
|
3251
3844
|
async function D(t, n) {
|
|
3252
|
-
await
|
|
3845
|
+
await S();
|
|
3253
3846
|
let r = f.get(t);
|
|
3254
3847
|
r !== void 0 && (await T(n, r.live, async () => {
|
|
3255
3848
|
let n = await e.exec("kvcoder.session.get", { sessionId: t });
|
|
3256
3849
|
return n.status === "running" ? n.stepJobId : void 0;
|
|
3257
|
-
}), await
|
|
3850
|
+
}), await O());
|
|
3258
3851
|
}
|
|
3259
|
-
async function
|
|
3260
|
-
await
|
|
3852
|
+
async function O(e = []) {
|
|
3853
|
+
await S();
|
|
3261
3854
|
let t = r.value;
|
|
3262
3855
|
t?.status === "running" && t.stepJobId !== void 0 && E(t.stepJobId, e).catch(n);
|
|
3263
3856
|
for (let [e, t] of f) t.session.status === "running" && t.session.stepJobId !== void 0 && D(e, t.session.stepJobId).catch(n);
|
|
3264
3857
|
}
|
|
3265
3858
|
let A = setInterval(() => {
|
|
3266
|
-
p.size === 0 && t() !== void 0 &&
|
|
3267
|
-
},
|
|
3859
|
+
p.size === 0 && t() !== void 0 && O().catch(n);
|
|
3860
|
+
}, zs);
|
|
3268
3861
|
return h(() => {
|
|
3269
3862
|
m = !0, clearInterval(A);
|
|
3270
|
-
}),
|
|
3863
|
+
}), k([t, () => e.workspace.value.id], () => O().catch(n), { immediate: !0 }), {
|
|
3271
3864
|
session: r,
|
|
3272
3865
|
messages: i,
|
|
3273
3866
|
omitted: a,
|
|
@@ -3277,28 +3870,28 @@ function eo(e, t, n) {
|
|
|
3277
3870
|
live: d,
|
|
3278
3871
|
streaming: u,
|
|
3279
3872
|
children: f,
|
|
3280
|
-
refresh:
|
|
3873
|
+
refresh: O,
|
|
3281
3874
|
stream: E
|
|
3282
3875
|
};
|
|
3283
3876
|
}
|
|
3284
3877
|
//#endregion
|
|
3285
3878
|
//#region web/src/use-follow-latest.ts
|
|
3286
|
-
var
|
|
3287
|
-
function
|
|
3879
|
+
var Hs = 80;
|
|
3880
|
+
function Us(e, t, n) {
|
|
3288
3881
|
let r = v(!1);
|
|
3289
3882
|
function i() {
|
|
3290
3883
|
e.value !== null && (e.value.scrollTop = e.value.scrollHeight);
|
|
3291
3884
|
}
|
|
3292
3885
|
function a() {
|
|
3293
3886
|
let t = e.value;
|
|
3294
|
-
t !== null && (r.value = t.scrollHeight - t.clientHeight - t.scrollTop >
|
|
3887
|
+
t !== null && (r.value = t.scrollHeight - t.clientHeight - t.scrollTop > Hs);
|
|
3295
3888
|
}
|
|
3296
3889
|
function o() {
|
|
3297
3890
|
r.value = !1, i();
|
|
3298
3891
|
}
|
|
3299
|
-
return
|
|
3892
|
+
return k(t, async () => {
|
|
3300
3893
|
r.value || (await d(), i());
|
|
3301
|
-
}),
|
|
3894
|
+
}), k(n, async () => {
|
|
3302
3895
|
r.value = !1, await d(), i();
|
|
3303
3896
|
}), {
|
|
3304
3897
|
away: r,
|
|
@@ -3307,21 +3900,41 @@ function no(e, t, n) {
|
|
|
3307
3900
|
};
|
|
3308
3901
|
}
|
|
3309
3902
|
//#endregion
|
|
3903
|
+
//#region web/src/use-finished-runs.ts
|
|
3904
|
+
function Ws(e, t, n, r) {
|
|
3905
|
+
let i = v(/* @__PURE__ */ new Map());
|
|
3906
|
+
async function a(n) {
|
|
3907
|
+
try {
|
|
3908
|
+
let r = await e.exec("kvcoder.job.list", { sessionId: n });
|
|
3909
|
+
if (t() !== n) return;
|
|
3910
|
+
i.value = new Map(r.flatMap((e) => e.endedAt === void 0 ? [] : [[e.id, {
|
|
3911
|
+
title: e.title,
|
|
3912
|
+
ranMs: Math.max(Date.parse(e.endedAt) - Date.parse(e.startedAt), 0)
|
|
3913
|
+
}]]));
|
|
3914
|
+
} catch (e) {
|
|
3915
|
+
r(e);
|
|
3916
|
+
}
|
|
3917
|
+
}
|
|
3918
|
+
return k(() => [t(), n.value.flatMap((e) => Xr(e) ?? []).join(" ")], ([e, t], n) => {
|
|
3919
|
+
e !== n?.[0] && (i.value = /* @__PURE__ */ new Map()), e !== void 0 && t !== "" && a(e);
|
|
3920
|
+
}, { immediate: !0 }), i;
|
|
3921
|
+
}
|
|
3922
|
+
//#endregion
|
|
3310
3923
|
//#region web/src/use-slash-commands.ts
|
|
3311
|
-
function
|
|
3312
|
-
let t =
|
|
3924
|
+
function Gs(e) {
|
|
3925
|
+
let t = w([]);
|
|
3313
3926
|
return m(async () => {
|
|
3314
3927
|
try {
|
|
3315
3928
|
t.value = await e.exec("kvcoder.slash.list", {});
|
|
3316
3929
|
} catch (t) {
|
|
3317
|
-
|
|
3930
|
+
q(e, t);
|
|
3318
3931
|
}
|
|
3319
3932
|
}), t;
|
|
3320
3933
|
}
|
|
3321
3934
|
//#endregion
|
|
3322
3935
|
//#region web/src/use-workspace-session.ts
|
|
3323
|
-
function
|
|
3324
|
-
let i =
|
|
3936
|
+
function Ks(e, n, r) {
|
|
3937
|
+
let i = w(e.workspace.value.id);
|
|
3325
3938
|
async function a(t) {
|
|
3326
3939
|
let n;
|
|
3327
3940
|
try {
|
|
@@ -3331,149 +3944,151 @@ function io(e, n, r) {
|
|
|
3331
3944
|
}
|
|
3332
3945
|
e.workspace.value.id === t && (n === void 0 ? e.navigate("kvcoder.chat") : e.navigate("kvcoder.session", { sessionId: n }));
|
|
3333
3946
|
}
|
|
3334
|
-
return
|
|
3947
|
+
return k(n, () => {
|
|
3335
3948
|
i.value = e.workspace.value.id;
|
|
3336
|
-
}),
|
|
3949
|
+
}), k(() => e.workspace.value.id, (e) => {
|
|
3337
3950
|
n() === void 0 ? i.value = e : a(e);
|
|
3338
3951
|
}), t(() => i.value === e.workspace.value.id ? n() : void 0);
|
|
3339
3952
|
}
|
|
3340
3953
|
//#endregion
|
|
3341
3954
|
//#region web/src/ConversationView.vue?vue&type=script&setup=true&lang.ts
|
|
3342
|
-
var
|
|
3955
|
+
var qs = { class: "kvc-workspace" }, Js = { class: "kvc-stage" }, Ys = {
|
|
3343
3956
|
class: "kvc-conversation",
|
|
3344
3957
|
"data-test": "conversation"
|
|
3345
|
-
},
|
|
3958
|
+
}, Xs = {
|
|
3346
3959
|
key: 0,
|
|
3347
3960
|
class: "kvc-start",
|
|
3348
3961
|
role: "alert",
|
|
3349
3962
|
"data-test": "load-failure"
|
|
3350
|
-
},
|
|
3963
|
+
}, Zs = { class: "kvc-start-note" }, Qs = {
|
|
3351
3964
|
class: "kvc-actions",
|
|
3352
3965
|
style: { "justify-content": "center" }
|
|
3353
|
-
},
|
|
3966
|
+
}, $s = {
|
|
3354
3967
|
key: 1,
|
|
3355
3968
|
class: "kvc-scrollport"
|
|
3356
|
-
},
|
|
3969
|
+
}, ec = {
|
|
3357
3970
|
key: 1,
|
|
3358
3971
|
class: "kvc-column"
|
|
3359
|
-
},
|
|
3360
|
-
key: 0,
|
|
3361
|
-
class: "kvc-muted",
|
|
3362
|
-
"data-test": "turn-totals"
|
|
3363
|
-
}, ho = {
|
|
3972
|
+
}, tc = ["title"], nc = {
|
|
3364
3973
|
key: 2,
|
|
3365
3974
|
class: "kvc-notice",
|
|
3366
3975
|
"data-test": "summarizing"
|
|
3367
|
-
},
|
|
3976
|
+
}, rc = {
|
|
3368
3977
|
key: 3,
|
|
3369
3978
|
class: "kvc-answer",
|
|
3370
3979
|
"data-test": "live-answer"
|
|
3371
|
-
},
|
|
3980
|
+
}, ic = ["open"], ac = { class: "kvc-muted" }, oc = {
|
|
3372
3981
|
class: "kvc-muted",
|
|
3373
3982
|
style: { "white-space": "pre-wrap" }
|
|
3374
|
-
},
|
|
3983
|
+
}, sc = {
|
|
3375
3984
|
key: 6,
|
|
3376
3985
|
class: "kvc-muted",
|
|
3377
3986
|
style: {
|
|
3378
3987
|
"text-align": "center",
|
|
3379
3988
|
margin: "0"
|
|
3380
3989
|
}
|
|
3381
|
-
},
|
|
3990
|
+
}, cc = /* @__PURE__ */ c({
|
|
3382
3991
|
__name: "ConversationView",
|
|
3383
3992
|
props: { sessionId: {} },
|
|
3384
3993
|
setup(c) {
|
|
3385
|
-
let l = c, u =
|
|
3994
|
+
let l = c, u = G(), d = Ks(u, () => l.sessionId, (e) => q(u, e)), f = v("chat"), p = Vs(u, () => d.value, (e) => q(u, e)), { session: m, messages: h, omitted: _, turns: b, live: x, children: C } = p, w = Rs(u, () => d.value, () => m.value?.updatedAt, (e) => q(u, e)), O = t(() => w.open.value && w.shown.value !== void 0), k = t(() => zr(h.value)), j = Ws(u, () => d.value, h, (e) => q(u, e)), M = /* @__PURE__ */ new Set([
|
|
3386
3995
|
"STEP_FAILED",
|
|
3387
3996
|
"REPLY_LOST",
|
|
3388
3997
|
"INTERRUPTED"
|
|
3389
|
-
]),
|
|
3998
|
+
]), N = t(() => m.value?.status === "running"), P = t(() => N.value && b.value[0]?.outcome === void 0 ? b.value[0]?.startedAt : void 0), F = t(() => m.value?.status === "waiting" ? b.value[0]?.pending ?? [] : []), I = t(() => {
|
|
3390
3999
|
let e = /* @__PURE__ */ new Map();
|
|
3391
|
-
for (let t of h.value) t.kind === "assistant" && t.turnId !== void 0 && e.set(t.turnId, t.id);
|
|
4000
|
+
for (let t of h.value) (t.kind === "assistant" || t.kind === "toolResult") && t.turnId !== void 0 && e.set(t.turnId, t.id);
|
|
3392
4001
|
let t = /* @__PURE__ */ new Map();
|
|
3393
4002
|
for (let n of b.value) {
|
|
3394
4003
|
let r = e.get(n.id);
|
|
3395
|
-
r !== void 0 && n.outcome !== void 0 && t.set(r,
|
|
4004
|
+
r !== void 0 && n.outcome !== void 0 && t.set(r, {
|
|
4005
|
+
text: et(u.t, n.usage, n.durationMs),
|
|
4006
|
+
tokens: tt(u.t, n.usage)
|
|
4007
|
+
});
|
|
3396
4008
|
}
|
|
3397
4009
|
return t;
|
|
3398
4010
|
});
|
|
3399
|
-
async function
|
|
4011
|
+
async function L(e) {
|
|
3400
4012
|
if (d.value !== void 0) try {
|
|
3401
4013
|
await u.exec("kvcoder.message.send", {
|
|
3402
4014
|
sessionId: d.value,
|
|
3403
4015
|
text: e.text,
|
|
3404
4016
|
...e.fileIds.length > 0 ? { fileIds: e.fileIds } : {}
|
|
3405
|
-
}),
|
|
4017
|
+
}), W.resume(), await p.refresh();
|
|
3406
4018
|
} catch (e) {
|
|
3407
|
-
|
|
4019
|
+
q(u, e);
|
|
3408
4020
|
}
|
|
3409
4021
|
}
|
|
3410
|
-
async function
|
|
4022
|
+
async function R() {
|
|
3411
4023
|
if (d.value !== void 0) try {
|
|
3412
4024
|
await u.exec("kvcoder.turn.cancel", { sessionId: d.value }), await p.refresh();
|
|
3413
4025
|
} catch (e) {
|
|
3414
|
-
|
|
4026
|
+
q(u, e);
|
|
3415
4027
|
}
|
|
3416
4028
|
}
|
|
3417
|
-
let
|
|
4029
|
+
let z = Ls(u, (e) => p.refresh(e)), B = t(() => new Map(F.value.flatMap((e) => {
|
|
4030
|
+
let t = k.value.get(e.toolCallId)?.fields?.task;
|
|
4031
|
+
return typeof e.childSessionId == "string" && typeof t == "string" ? [[e.childSessionId, t]] : [];
|
|
4032
|
+
}))), V = t(() => F.value.flatMap((e) => e.kind === "worker" && e.runId !== void 0 ? [e.runId] : [])), ee = t(() => F.value.filter((e) => e.questionId === null || !z.hidden.value.has(String(e.questionId)))), te = t(() => {
|
|
3418
4033
|
let e = h.value.at(-1);
|
|
3419
|
-
return m.value?.status === "idle" && e?.kind === "notice" &&
|
|
3420
|
-
}), H =
|
|
3421
|
-
let e =
|
|
3422
|
-
return e === void 0 ? u.t("kvcoder.ui.failed") : u.t(
|
|
3423
|
-
}),
|
|
4034
|
+
return m.value?.status === "idle" && e?.kind === "notice" && M.has(String(e.content.code));
|
|
4035
|
+
}), H = Gs(u), U = _s(u, () => d.value ?? "", () => p.refresh()), re = t(() => {
|
|
4036
|
+
let e = He(p.loadFailure.value);
|
|
4037
|
+
return e === void 0 ? u.t("kvcoder.ui.failed") : u.t(Ve(e.code), e.params);
|
|
4038
|
+
}), ie = D("list"), W = Us(ie, () => [
|
|
3424
4039
|
h.value,
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
4040
|
+
x.text,
|
|
4041
|
+
x.thinking,
|
|
4042
|
+
x.calls.length,
|
|
4043
|
+
x.summarizing,
|
|
4044
|
+
N.value,
|
|
4045
|
+
F.value,
|
|
3431
4046
|
C.size,
|
|
3432
|
-
|
|
4047
|
+
z.hidden.value,
|
|
3433
4048
|
U.working.value
|
|
3434
4049
|
], () => d.value);
|
|
3435
|
-
async function
|
|
4050
|
+
async function ae() {
|
|
3436
4051
|
if (d.value !== void 0) try {
|
|
3437
4052
|
let { fileId: e } = await u.exec("kvcoder.session.export", { sessionId: d.value });
|
|
3438
4053
|
window.location.assign(`/api/files/${encodeURIComponent(e)}?workspaceId=${encodeURIComponent(u.workspace.value.id)}`);
|
|
3439
4054
|
} catch (e) {
|
|
3440
|
-
|
|
4055
|
+
q(u, e);
|
|
3441
4056
|
}
|
|
3442
4057
|
}
|
|
3443
|
-
let
|
|
3444
|
-
async function
|
|
4058
|
+
let oe = () => h.value.at(-1)?.kind === "notice" && h.value.at(-1)?.content.code === "SUMMARY_FAILED";
|
|
4059
|
+
async function se() {
|
|
3445
4060
|
return (await u.exec("kernel.settings.list", {})).find((e) => e.key === "kvcoder.compactKeep")?.value ?? null;
|
|
3446
4061
|
}
|
|
3447
|
-
async function
|
|
4062
|
+
async function ce() {
|
|
3448
4063
|
let e = await U.compact();
|
|
3449
|
-
e === !0 ? u.toast("kvcoder.ui.summarized", {}, "success") : e === !1 && !
|
|
4064
|
+
e === !0 ? u.toast("kvcoder.ui.summarized", {}, "success") : e === !1 && !oe() && u.toast("kvcoder.ui.nothingToSummarize", { count: await se() });
|
|
3450
4065
|
}
|
|
3451
|
-
function
|
|
4066
|
+
function le(e, t) {
|
|
3452
4067
|
if (e === "new") return u.navigate("kvcoder.chat");
|
|
3453
4068
|
if (e === "prompt") return void (f.value = f.value === "prompt" ? "chat" : "prompt");
|
|
3454
4069
|
if (e === "delete") return void U.remove();
|
|
3455
|
-
U.working.value === void 0 && (f.value = "chat", e === "rename" ? U.rename(t) : e === "compact" ?
|
|
4070
|
+
U.working.value === void 0 && (f.value = "chat", e === "rename" ? U.rename(t) : e === "compact" ? ce() : e === "export" ? U.exportFile() : U.fork());
|
|
3456
4071
|
}
|
|
3457
|
-
async function
|
|
3458
|
-
U.working.value === void 0 && (f.value = "chat", await U.runRegistered(e, t) && e.message !== void 0 && await
|
|
4072
|
+
async function ue(e, t) {
|
|
4073
|
+
U.working.value === void 0 && (f.value = "chat", await U.runRegistered(e, t) && e.message !== void 0 && await L({
|
|
3459
4074
|
text: t === "" ? u.t(e.message) : t,
|
|
3460
4075
|
fileIds: []
|
|
3461
4076
|
}));
|
|
3462
4077
|
}
|
|
3463
|
-
let
|
|
3464
|
-
return (t, c) => (g(), i("div",
|
|
4078
|
+
let de = (e) => e.id;
|
|
4079
|
+
return (t, c) => (g(), i("div", qs, [E(m) && E(d) !== void 0 ? (g(), n(pr, {
|
|
3465
4080
|
key: 0,
|
|
3466
|
-
session:
|
|
4081
|
+
session: E(m),
|
|
3467
4082
|
tab: f.value,
|
|
3468
|
-
turns:
|
|
3469
|
-
context:
|
|
3470
|
-
"running-since":
|
|
3471
|
-
artifacts:
|
|
3472
|
-
"artifacts-open":
|
|
3473
|
-
working:
|
|
4083
|
+
turns: E(b).length,
|
|
4084
|
+
context: E(p).context.value,
|
|
4085
|
+
"running-since": P.value,
|
|
4086
|
+
artifacts: E(w).list.value.length,
|
|
4087
|
+
"artifacts-open": E(w).open.value,
|
|
4088
|
+
working: E(U).working.value !== void 0,
|
|
3474
4089
|
onTab: c[0] ||= (e) => f.value = e,
|
|
3475
|
-
onAction:
|
|
3476
|
-
onToggleArtifacts: c[1] ||= (e) =>
|
|
4090
|
+
onAction: le,
|
|
4091
|
+
onToggleArtifacts: c[1] ||= (e) => E(w).toggle()
|
|
3477
4092
|
}, null, 8, [
|
|
3478
4093
|
"session",
|
|
3479
4094
|
"tab",
|
|
@@ -3483,122 +4098,134 @@ var ao = { class: "kvc-workspace" }, oo = { class: "kvc-stage" }, so = {
|
|
|
3483
4098
|
"artifacts",
|
|
3484
4099
|
"artifacts-open",
|
|
3485
4100
|
"working"
|
|
3486
|
-
])) : r("v-if", !0), a("div",
|
|
4101
|
+
])) : r("v-if", !0), a("div", Js, [a("section", Ys, [l.sessionId === void 0 ? (g(), n(Cn, {
|
|
3487
4102
|
key: 0,
|
|
3488
|
-
registered:
|
|
3489
|
-
}, null, 8, ["registered"])) :
|
|
4103
|
+
registered: E(H)
|
|
4104
|
+
}, null, 8, ["registered"])) : E(m) && E(d) !== void 0 ? (g(), i(e, { key: 1 }, [E(p).loadFailure.value === void 0 ? (g(), i("div", $s, [a("div", {
|
|
3490
4105
|
ref_key: "list",
|
|
3491
|
-
ref:
|
|
4106
|
+
ref: ie,
|
|
3492
4107
|
class: "kvc-scroll",
|
|
3493
|
-
onScroll: c[7] ||= (...e) =>
|
|
3494
|
-
}, [f.value === "prompt" ? (g(), n(
|
|
4108
|
+
onScroll: c[7] ||= (...e) => E(W).onScroll && E(W).onScroll(...e)
|
|
4109
|
+
}, [f.value === "prompt" ? (g(), n(gs, {
|
|
3495
4110
|
key: 0,
|
|
3496
|
-
"session-id":
|
|
4111
|
+
"session-id": E(m).id,
|
|
3497
4112
|
onBack: c[4] ||= (e) => f.value = "chat"
|
|
3498
|
-
}, null, 8, ["session-id"])) : (g(), i("div",
|
|
3499
|
-
|
|
4113
|
+
}, null, 8, ["session-id"])) : (g(), i("div", ec, [
|
|
4114
|
+
E(_) > 0 ? (g(), i("button", {
|
|
3500
4115
|
key: 0,
|
|
3501
4116
|
type: "button",
|
|
3502
4117
|
class: "kvc-button",
|
|
3503
4118
|
style: { "align-self": "center" },
|
|
3504
4119
|
"data-test": "earlier",
|
|
3505
|
-
onClick:
|
|
3506
|
-
},
|
|
3507
|
-
(g(!0), i(e, null, y(
|
|
4120
|
+
onClick: ae
|
|
4121
|
+
}, T(E(u).t("kvcoder.ui.earlierMessages", { count: E(_) })), 1)) : r("v-if", !0),
|
|
4122
|
+
(g(!0), i(e, null, y(E(h), (t) => (g(), i(e, { key: de(t) }, [s(Ao, {
|
|
3508
4123
|
message: t,
|
|
3509
|
-
calls:
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
4124
|
+
calls: k.value,
|
|
4125
|
+
"finished-runs": E(j),
|
|
4126
|
+
onOpenArtifact: c[5] ||= (e) => E(w).openArtifact(e)
|
|
4127
|
+
}, null, 8, [
|
|
4128
|
+
"message",
|
|
4129
|
+
"calls",
|
|
4130
|
+
"finished-runs"
|
|
4131
|
+
]), I.value.has(t.id) ? (g(), i("span", {
|
|
4132
|
+
key: 0,
|
|
4133
|
+
class: "kvc-muted",
|
|
4134
|
+
title: I.value.get(t.id)?.tokens,
|
|
4135
|
+
"data-test": "turn-totals"
|
|
4136
|
+
}, T(I.value.get(t.id)?.text), 9, tc)) : r("v-if", !0)], 64))), 128)),
|
|
4137
|
+
te.value ? (g(), n(ls, {
|
|
3513
4138
|
key: 1,
|
|
3514
|
-
"session-id":
|
|
4139
|
+
"session-id": E(m).id,
|
|
3515
4140
|
onSent: c[6] ||= (e) => {
|
|
3516
|
-
|
|
4141
|
+
E(W).resume(), E(p).refresh();
|
|
3517
4142
|
}
|
|
3518
4143
|
}, null, 8, ["session-id"])) : r("v-if", !0),
|
|
3519
|
-
|
|
3520
|
-
|
|
4144
|
+
E(x).summarizing ? (g(), i("div", nc, T(E(u).t("kvcoder.ui.summarizing")), 1)) : r("v-if", !0),
|
|
4145
|
+
N.value && (E(x).text !== "" || E(x).thinking !== "") ? (g(), i("div", rc, [E(x).thinking === "" ? r("v-if", !0) : (g(), i("details", {
|
|
3521
4146
|
key: 0,
|
|
3522
|
-
open:
|
|
4147
|
+
open: E(x).text === "" && E(x).calls.length === 0,
|
|
3523
4148
|
"data-test": "live-thinking"
|
|
3524
|
-
}, [a("summary",
|
|
4149
|
+
}, [a("summary", ac, T(E(u).t("kvcoder.ui.thinkingNow")), 1), a("p", oc, T(E(x).thinking), 1)], 8, ic)), E(x).text === "" ? r("v-if", !0) : (g(), n(S(E(u).View), {
|
|
3525
4150
|
key: 1,
|
|
3526
4151
|
view: {
|
|
3527
4152
|
type: "markdown",
|
|
3528
4153
|
text: "kvcoder.markdown",
|
|
3529
|
-
params: { text:
|
|
4154
|
+
params: { text: E(x).text }
|
|
3530
4155
|
}
|
|
3531
4156
|
}, null, 8, ["view"]))])) : r("v-if", !0),
|
|
3532
|
-
|
|
4157
|
+
N.value ? (g(), n(Fr, {
|
|
3533
4158
|
key: 4,
|
|
3534
|
-
live:
|
|
4159
|
+
live: E(x)
|
|
3535
4160
|
}, null, 8, ["live"])) : r("v-if", !0),
|
|
3536
|
-
|
|
4161
|
+
E(U).working.value ? (g(), n(kn, {
|
|
3537
4162
|
key: 5,
|
|
3538
|
-
working:
|
|
4163
|
+
working: E(U).working.value
|
|
3539
4164
|
}, null, 8, ["working"])) : r("v-if", !0),
|
|
3540
|
-
(g(!0), i(e, null, y(
|
|
4165
|
+
(g(!0), i(e, null, y(E(C), ([e, t]) => (g(), n(Os, {
|
|
3541
4166
|
key: e,
|
|
3542
4167
|
child: t,
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
4168
|
+
task: B.value.get(e),
|
|
4169
|
+
hidden: E(z).hidden.value,
|
|
4170
|
+
onAnswer: E(z).answer,
|
|
4171
|
+
onDecide: E(z).decide
|
|
3546
4172
|
}, null, 8, [
|
|
3547
4173
|
"child",
|
|
4174
|
+
"task",
|
|
3548
4175
|
"hidden",
|
|
3549
4176
|
"onAnswer",
|
|
3550
4177
|
"onDecide"
|
|
3551
4178
|
]))), 128)),
|
|
3552
|
-
(g(!0), i(e, null, y(
|
|
4179
|
+
(g(!0), i(e, null, y(V.value, (e) => (g(), n(Fs, {
|
|
3553
4180
|
key: e,
|
|
3554
|
-
"session-id":
|
|
4181
|
+
"session-id": E(m).id,
|
|
3555
4182
|
"run-id": e
|
|
3556
4183
|
}, null, 8, ["session-id", "run-id"]))), 128)),
|
|
3557
|
-
s(
|
|
3558
|
-
pending:
|
|
3559
|
-
hidden:
|
|
3560
|
-
onAnswer:
|
|
3561
|
-
onDecide:
|
|
4184
|
+
s(as, {
|
|
4185
|
+
pending: F.value,
|
|
4186
|
+
hidden: E(z).hidden.value,
|
|
4187
|
+
onAnswer: E(z).answer,
|
|
4188
|
+
onDecide: E(z).decide
|
|
3562
4189
|
}, null, 8, [
|
|
3563
4190
|
"pending",
|
|
3564
4191
|
"hidden",
|
|
3565
4192
|
"onAnswer",
|
|
3566
4193
|
"onDecide"
|
|
3567
4194
|
]),
|
|
3568
|
-
|
|
3569
|
-
]))], 544),
|
|
4195
|
+
ee.value.some((e) => e.kind !== "subagent" && e.kind !== "worker") ? (g(), i("p", sc, T(E(u).t("kvcoder.ui.messageDismisses")), 1)) : r("v-if", !0)
|
|
4196
|
+
]))], 544), E(W).away.value ? (g(), i("button", {
|
|
3570
4197
|
key: 0,
|
|
3571
4198
|
type: "button",
|
|
3572
4199
|
class: "kvc-button kvc-jump",
|
|
3573
4200
|
"data-test": "jump-to-latest",
|
|
3574
|
-
onClick: c[8] ||= (...e) =>
|
|
3575
|
-
}, [s(
|
|
4201
|
+
onClick: c[8] ||= (...e) => E(W).resume && E(W).resume(...e)
|
|
4202
|
+
}, [s(E(ne), {
|
|
3576
4203
|
size: 16,
|
|
3577
4204
|
"aria-hidden": "true"
|
|
3578
|
-
}), o(
|
|
4205
|
+
}), o(T(E(u).t("kvcoder.ui.jumpToLatest")), 1)])) : r("v-if", !0)])) : (g(), i("div", Xs, [a("p", Zs, T(E(u).t("kvcoder.ui.loadFailed", { error: re.value })), 1), a("div", Qs, [a("button", {
|
|
3579
4206
|
type: "button",
|
|
3580
4207
|
class: "kvc-button kvc-primary",
|
|
3581
4208
|
"data-test": "load-again",
|
|
3582
|
-
onClick: c[2] ||= (e) =>
|
|
3583
|
-
},
|
|
4209
|
+
onClick: c[2] ||= (e) => E(p).refresh()
|
|
4210
|
+
}, T(E(u).t("kvcoder.ui.tryAgain")), 1), a("button", {
|
|
3584
4211
|
type: "button",
|
|
3585
4212
|
class: "kvc-button",
|
|
3586
4213
|
"data-test": "load-export",
|
|
3587
|
-
onClick: c[3] ||= (e) =>
|
|
3588
|
-
},
|
|
3589
|
-
running:
|
|
3590
|
-
placeholder:
|
|
3591
|
-
blocked:
|
|
4214
|
+
onClick: c[3] ||= (e) => E(U).exportFile()
|
|
4215
|
+
}, T(E(u).t("kvcoder.ui.export")), 1)])])), s(Gt, {
|
|
4216
|
+
running: N.value,
|
|
4217
|
+
placeholder: E(u).t("kvcoder.ui.placeholder"),
|
|
4218
|
+
blocked: E(U).working.value !== void 0,
|
|
3592
4219
|
commands: "run",
|
|
3593
|
-
registered:
|
|
3594
|
-
onSend:
|
|
3595
|
-
onStop:
|
|
3596
|
-
onCommand:
|
|
3597
|
-
onRegistered:
|
|
4220
|
+
registered: E(H),
|
|
4221
|
+
onSend: L,
|
|
4222
|
+
onStop: R,
|
|
4223
|
+
onCommand: le,
|
|
4224
|
+
onRegistered: ue
|
|
3598
4225
|
}, {
|
|
3599
|
-
controls:
|
|
3600
|
-
session:
|
|
3601
|
-
onChanged: c[9] ||= (e) =>
|
|
4226
|
+
controls: A(() => [s(vs, {
|
|
4227
|
+
session: E(m),
|
|
4228
|
+
onChanged: c[9] ||= (e) => E(p).refresh()
|
|
3602
4229
|
}, null, 8, ["session"])]),
|
|
3603
4230
|
_: 1
|
|
3604
4231
|
}, 8, [
|
|
@@ -3606,26 +4233,26 @@ var ao = { class: "kvc-workspace" }, oo = { class: "kvc-stage" }, so = {
|
|
|
3606
4233
|
"placeholder",
|
|
3607
4234
|
"blocked",
|
|
3608
4235
|
"registered"
|
|
3609
|
-
])], 64)) : r("v-if", !0)]), O.value ? (g(), n(
|
|
4236
|
+
])], 64)) : r("v-if", !0)]), O.value ? (g(), n(Tt, {
|
|
3610
4237
|
key: 0,
|
|
3611
|
-
list:
|
|
3612
|
-
shown:
|
|
3613
|
-
content:
|
|
3614
|
-
onSelect: c[10] ||= (e) =>
|
|
3615
|
-
onClose: c[11] ||= (e) =>
|
|
4238
|
+
list: E(w).list.value,
|
|
4239
|
+
shown: E(w).shown.value,
|
|
4240
|
+
content: E(w).content.value,
|
|
4241
|
+
onSelect: c[10] ||= (e) => E(w).select(e),
|
|
4242
|
+
onClose: c[11] ||= (e) => E(w).close()
|
|
3616
4243
|
}, null, 8, [
|
|
3617
4244
|
"list",
|
|
3618
4245
|
"shown",
|
|
3619
4246
|
"content"
|
|
3620
4247
|
])) : r("v-if", !0)])]));
|
|
3621
4248
|
}
|
|
3622
|
-
}),
|
|
4249
|
+
}), lc = /* @__PURE__ */ c({
|
|
3623
4250
|
__name: "conversation",
|
|
3624
4251
|
props: { sessionId: {} },
|
|
3625
4252
|
setup(e) {
|
|
3626
4253
|
let t = e;
|
|
3627
|
-
return (e, r) => (g(), n(
|
|
4254
|
+
return (e, r) => (g(), n(cc, { "session-id": t.sessionId }, null, 8, ["session-id"]));
|
|
3628
4255
|
}
|
|
3629
4256
|
});
|
|
3630
4257
|
//#endregion
|
|
3631
|
-
export {
|
|
4258
|
+
export { lc as default };
|