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