@claude-sessions/web 0.3.1 → 0.3.3
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/build/client/_app/immutable/assets/0.B2yA_bPQ.css +1 -0
- package/build/client/_app/immutable/assets/0.B2yA_bPQ.css.br +0 -0
- package/build/client/_app/immutable/assets/0.B2yA_bPQ.css.gz +0 -0
- package/build/client/_app/immutable/assets/Toast.CQSY_S6M.css +1 -0
- package/build/client/_app/immutable/assets/Toast.CQSY_S6M.css.br +0 -0
- package/build/client/_app/immutable/assets/Toast.CQSY_S6M.css.gz +0 -0
- package/build/client/_app/immutable/chunks/{Cu54-bNJ.js → Bapp9IYO.js} +1 -1
- package/build/client/_app/immutable/chunks/Bapp9IYO.js.br +0 -0
- package/build/client/_app/immutable/chunks/Bapp9IYO.js.gz +0 -0
- package/build/client/_app/immutable/chunks/BzTxzCCu.js +1 -0
- package/build/client/_app/immutable/chunks/BzTxzCCu.js.br +0 -0
- package/build/client/_app/immutable/chunks/BzTxzCCu.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CUTXPORg.js +1 -0
- package/build/client/_app/immutable/chunks/CUTXPORg.js.br +0 -0
- package/build/client/_app/immutable/chunks/CUTXPORg.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{byP5FZXC.js → CzuOkoRV.js} +1 -1
- package/build/client/_app/immutable/chunks/CzuOkoRV.js.br +0 -0
- package/build/client/_app/immutable/chunks/CzuOkoRV.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DHCLGQT_.js +1 -0
- package/build/client/_app/immutable/chunks/DHCLGQT_.js.br +0 -0
- package/build/client/_app/immutable/chunks/DHCLGQT_.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DUNnSDh5.js +66 -0
- package/build/client/_app/immutable/chunks/DUNnSDh5.js.br +0 -0
- package/build/client/_app/immutable/chunks/DUNnSDh5.js.gz +0 -0
- package/build/client/_app/immutable/chunks/Di6YbRZt.js +2 -0
- package/build/client/_app/immutable/chunks/Di6YbRZt.js.br +0 -0
- package/build/client/_app/immutable/chunks/Di6YbRZt.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{B0nKMdd0.js → HouQR_BO.js} +1 -1
- package/build/client/_app/immutable/chunks/HouQR_BO.js.br +0 -0
- package/build/client/_app/immutable/chunks/HouQR_BO.js.gz +0 -0
- package/build/client/_app/immutable/chunks/IVrlObbe.js +25 -0
- package/build/client/_app/immutable/chunks/IVrlObbe.js.br +0 -0
- package/build/client/_app/immutable/chunks/IVrlObbe.js.gz +0 -0
- package/build/client/_app/immutable/entry/app.Dj3HhwA8.js +2 -0
- package/build/client/_app/immutable/entry/app.Dj3HhwA8.js.br +0 -0
- package/build/client/_app/immutable/entry/app.Dj3HhwA8.js.gz +0 -0
- package/build/client/_app/immutable/entry/start.DhjCZi9N.js +1 -0
- package/build/client/_app/immutable/entry/start.DhjCZi9N.js.br +2 -0
- package/build/client/_app/immutable/entry/start.DhjCZi9N.js.gz +0 -0
- package/build/client/_app/immutable/nodes/0.CAbelkQT.js +1 -0
- package/build/client/_app/immutable/nodes/0.CAbelkQT.js.br +0 -0
- package/build/client/_app/immutable/nodes/0.CAbelkQT.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{1.Bm6PSLR5.js → 1.DYaH4O8k.js} +1 -1
- package/build/client/_app/immutable/nodes/1.DYaH4O8k.js.br +0 -0
- package/build/client/_app/immutable/nodes/1.DYaH4O8k.js.gz +0 -0
- package/build/client/_app/immutable/nodes/2.VvV6w9cZ.js +5 -0
- package/build/client/_app/immutable/nodes/2.VvV6w9cZ.js.br +0 -0
- package/build/client/_app/immutable/nodes/2.VvV6w9cZ.js.gz +0 -0
- package/build/client/_app/immutable/nodes/3.D_uYLiIh.js +4 -0
- package/build/client/_app/immutable/nodes/3.D_uYLiIh.js.br +0 -0
- package/build/client/_app/immutable/nodes/3.D_uYLiIh.js.gz +0 -0
- package/build/client/_app/version.json +1 -1
- package/build/client/_app/version.json.br +0 -0
- package/build/client/_app/version.json.gz +0 -0
- package/build/server/chunks/0-CWHakFRJ.js +17 -0
- package/build/server/chunks/{0-DpMV9SJd.js.map → 0-CWHakFRJ.js.map} +1 -1
- package/build/server/chunks/1-NzhdkXbT.js +9 -0
- package/build/server/chunks/{1-D9TH1iwG.js.map → 1-NzhdkXbT.js.map} +1 -1
- package/build/server/chunks/2-DrysGJ9C.js +9 -0
- package/build/server/chunks/2-DrysGJ9C.js.map +1 -0
- package/build/server/chunks/3-D4BIPCPc.js +9 -0
- package/build/server/chunks/3-D4BIPCPc.js.map +1 -0
- package/build/server/chunks/Toast-CTZhGpnd.js +45 -0
- package/build/server/chunks/Toast-CTZhGpnd.js.map +1 -0
- package/build/server/chunks/{_layout.svelte-BsIPSbGo.js → _layout.svelte-D9DyGgZM.js} +12 -5
- package/build/server/chunks/_layout.svelte-D9DyGgZM.js.map +1 -0
- package/build/server/chunks/_page.svelte-Bgd-L7N_.js +1227 -0
- package/build/server/chunks/_page.svelte-Bgd-L7N_.js.map +1 -0
- package/build/server/chunks/_page.svelte-C7sseaTW.js +56 -0
- package/build/server/chunks/_page.svelte-C7sseaTW.js.map +1 -0
- package/build/server/chunks/{_server.ts-DiZSiHH2.js → _server.ts-5NUxXdCt.js} +2 -2
- package/build/server/chunks/{_server.ts-DiZSiHH2.js.map → _server.ts-5NUxXdCt.js.map} +1 -1
- package/build/server/chunks/{_server.ts-DU60SaEW.js → _server.ts-BIooeFZO.js} +2 -2
- package/build/server/chunks/{_server.ts-DU60SaEW.js.map → _server.ts-BIooeFZO.js.map} +1 -1
- package/build/server/chunks/{_server.ts-SZ7xXULI.js → _server.ts-BJPcYX_q.js} +2 -2
- package/build/server/chunks/{_server.ts-SZ7xXULI.js.map → _server.ts-BJPcYX_q.js.map} +1 -1
- package/build/server/chunks/{_server.ts-Ddoxzxdz.js → _server.ts-BnJ4zX_o.js} +2 -2
- package/build/server/chunks/{_server.ts-Ddoxzxdz.js.map → _server.ts-BnJ4zX_o.js.map} +1 -1
- package/build/server/chunks/{_server.ts-CkPJa8rH.js → _server.ts-Btk0wdCV.js} +2 -2
- package/build/server/chunks/{_server.ts-CkPJa8rH.js.map → _server.ts-Btk0wdCV.js.map} +1 -1
- package/build/server/chunks/{_server.ts-DFwI1irc.js → _server.ts-CLGsav13.js} +2 -2
- package/build/server/chunks/{_server.ts-DFwI1irc.js.map → _server.ts-CLGsav13.js.map} +1 -1
- package/build/server/chunks/{_server.ts-_I5t7nvC.js → _server.ts-DO-eF-5A.js} +2 -2
- package/build/server/chunks/{_server.ts-_I5t7nvC.js.map → _server.ts-DO-eF-5A.js.map} +1 -1
- package/build/server/chunks/{_server.ts-BfTOQnQK.js → _server.ts-DVuHX36m.js} +2 -2
- package/build/server/chunks/{_server.ts-BfTOQnQK.js.map → _server.ts-DVuHX36m.js.map} +1 -1
- package/build/server/chunks/_server.ts-DZQssvoI.js +19 -0
- package/build/server/chunks/_server.ts-DZQssvoI.js.map +1 -0
- package/build/server/chunks/_server.ts-DbJR6Y-D.js +95 -0
- package/build/server/chunks/_server.ts-DbJR6Y-D.js.map +1 -0
- package/build/server/chunks/{_server.ts-DKVHHXfU.js → _server.ts-Dcp7jbD9.js} +2 -2
- package/build/server/chunks/{_server.ts-DKVHHXfU.js.map → _server.ts-Dcp7jbD9.js.map} +1 -1
- package/build/server/chunks/{_server.ts-CZpt6s0c.js → _server.ts-Dga9Kz2m.js} +2 -2
- package/build/server/chunks/{_server.ts-CZpt6s0c.js.map → _server.ts-Dga9Kz2m.js.map} +1 -1
- package/build/server/chunks/{_server.ts-6PvKvlXG.js → _server.ts-DwIpb4Af.js} +2 -2
- package/build/server/chunks/{_server.ts-6PvKvlXG.js.map → _server.ts-DwIpb4Af.js.map} +1 -1
- package/build/server/chunks/{_server.ts-Dq5S_aG6.js → _server.ts-Dya9ngQs.js} +2 -2
- package/build/server/chunks/{_server.ts-Dq5S_aG6.js.map → _server.ts-Dya9ngQs.js.map} +1 -1
- package/build/server/chunks/{_server.ts-Cz-ezTau.js → _server.ts-nSWW3v6K.js} +2 -2
- package/build/server/chunks/{_server.ts-Cz-ezTau.js.map → _server.ts-nSWW3v6K.js.map} +1 -1
- package/build/server/chunks/config-DKyxRWWg.js +20 -0
- package/build/server/chunks/config-DKyxRWWg.js.map +1 -0
- package/build/server/chunks/{error.svelte-CxBB_UKu.js → error.svelte-DNhMU_b6.js} +4 -4
- package/build/server/chunks/{error.svelte-CxBB_UKu.js.map → error.svelte-DNhMU_b6.js.map} +1 -1
- package/build/server/chunks/{exports-BzHwARwz.js → exports-CgQJUv15.js} +2 -90
- package/build/server/chunks/exports-CgQJUv15.js.map +1 -0
- package/build/server/chunks/index-CMS8WiSi.js +1931 -0
- package/build/server/chunks/index-CMS8WiSi.js.map +1 -0
- package/build/server/chunks/{index-CMvE0dm6.js → index2-gtN4acH3.js} +44 -42
- package/build/server/chunks/index2-gtN4acH3.js.map +1 -0
- package/build/server/chunks/{index2-CWkjuG0Y.js → index3-DVZVsHMK.js} +71 -25
- package/build/server/chunks/index3-DVZVsHMK.js.map +1 -0
- package/build/server/chunks/{index3-NDyeileA.js → index4-Cm9gf6zG.js} +3 -3
- package/build/server/chunks/index4-Cm9gf6zG.js.map +1 -0
- package/build/server/index.js +26 -1694
- package/build/server/index.js.map +1 -1
- package/build/server/manifest.js +26 -19
- package/build/server/manifest.js.map +1 -1
- package/package.json +2 -2
- package/build/client/_app/immutable/assets/0.DHKfs7JC.css +0 -1
- package/build/client/_app/immutable/assets/0.DHKfs7JC.css.br +0 -0
- package/build/client/_app/immutable/assets/0.DHKfs7JC.css.gz +0 -0
- package/build/client/_app/immutable/chunks/B0nKMdd0.js.br +0 -0
- package/build/client/_app/immutable/chunks/B0nKMdd0.js.gz +0 -0
- package/build/client/_app/immutable/chunks/BK2z9s18.js +0 -1
- package/build/client/_app/immutable/chunks/BK2z9s18.js.br +0 -0
- package/build/client/_app/immutable/chunks/BK2z9s18.js.gz +0 -0
- package/build/client/_app/immutable/chunks/Bk8SkFX_.js +0 -1
- package/build/client/_app/immutable/chunks/Bk8SkFX_.js.br +0 -0
- package/build/client/_app/immutable/chunks/Bk8SkFX_.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CSn8t8Ix.js +0 -2
- package/build/client/_app/immutable/chunks/CSn8t8Ix.js.br +0 -0
- package/build/client/_app/immutable/chunks/CSn8t8Ix.js.gz +0 -0
- package/build/client/_app/immutable/chunks/Cu54-bNJ.js.br +0 -0
- package/build/client/_app/immutable/chunks/Cu54-bNJ.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DvQL1cTO.js +0 -2
- package/build/client/_app/immutable/chunks/DvQL1cTO.js.br +0 -0
- package/build/client/_app/immutable/chunks/DvQL1cTO.js.gz +0 -0
- package/build/client/_app/immutable/chunks/QKEgeM73.js +0 -94
- package/build/client/_app/immutable/chunks/QKEgeM73.js.br +0 -0
- package/build/client/_app/immutable/chunks/QKEgeM73.js.gz +0 -0
- package/build/client/_app/immutable/chunks/byP5FZXC.js.br +0 -0
- package/build/client/_app/immutable/chunks/byP5FZXC.js.gz +0 -0
- package/build/client/_app/immutable/chunks/elvo9mAG.js +0 -1
- package/build/client/_app/immutable/chunks/elvo9mAG.js.br +0 -0
- package/build/client/_app/immutable/chunks/elvo9mAG.js.gz +0 -0
- package/build/client/_app/immutable/entry/app.DDSmw1G2.js +0 -2
- package/build/client/_app/immutable/entry/app.DDSmw1G2.js.br +0 -0
- package/build/client/_app/immutable/entry/app.DDSmw1G2.js.gz +0 -0
- package/build/client/_app/immutable/entry/start.BBRU_Ybm.js +0 -1
- package/build/client/_app/immutable/entry/start.BBRU_Ybm.js.br +0 -2
- package/build/client/_app/immutable/entry/start.BBRU_Ybm.js.gz +0 -0
- package/build/client/_app/immutable/nodes/0.C3TdraPu.js +0 -1
- package/build/client/_app/immutable/nodes/0.C3TdraPu.js.br +0 -0
- package/build/client/_app/immutable/nodes/0.C3TdraPu.js.gz +0 -0
- package/build/client/_app/immutable/nodes/1.Bm6PSLR5.js.br +0 -2
- package/build/client/_app/immutable/nodes/1.Bm6PSLR5.js.gz +0 -0
- package/build/client/_app/immutable/nodes/2.DWRsPVe4.js +0 -6
- package/build/client/_app/immutable/nodes/2.DWRsPVe4.js.br +0 -0
- package/build/client/_app/immutable/nodes/2.DWRsPVe4.js.gz +0 -0
- package/build/client/_app/immutable/nodes/3.DMWHz6-z.js +0 -5
- package/build/client/_app/immutable/nodes/3.DMWHz6-z.js.br +0 -0
- package/build/client/_app/immutable/nodes/3.DMWHz6-z.js.gz +0 -0
- package/build/server/chunks/0-DpMV9SJd.js +0 -17
- package/build/server/chunks/1-D9TH1iwG.js +0 -9
- package/build/server/chunks/2-tlqE1QP7.js +0 -9
- package/build/server/chunks/2-tlqE1QP7.js.map +0 -1
- package/build/server/chunks/3-BGGlUEp-.js +0 -9
- package/build/server/chunks/3-BGGlUEp-.js.map +0 -1
- package/build/server/chunks/_layout.svelte-BsIPSbGo.js.map +0 -1
- package/build/server/chunks/_page.svelte-DEQJ0oPW.js +0 -280
- package/build/server/chunks/_page.svelte-DEQJ0oPW.js.map +0 -1
- package/build/server/chunks/_page.svelte-DfZkatW6.js +0 -35
- package/build/server/chunks/_page.svelte-DfZkatW6.js.map +0 -1
- package/build/server/chunks/_server.ts-g_2jTmWg.js +0 -8
- package/build/server/chunks/_server.ts-g_2jTmWg.js.map +0 -1
- package/build/server/chunks/context-R2425nfV.js +0 -64
- package/build/server/chunks/context-R2425nfV.js.map +0 -1
- package/build/server/chunks/exports-BzHwARwz.js.map +0 -1
- package/build/server/chunks/format-DgNjDoEq.js +0 -13
- package/build/server/chunks/format-DgNjDoEq.js.map +0 -1
- package/build/server/chunks/index-CMvE0dm6.js.map +0 -1
- package/build/server/chunks/index2-CWkjuG0Y.js.map +0 -1
- package/build/server/chunks/index3-NDyeileA.js.map +0 -1
|
@@ -0,0 +1,1227 @@
|
|
|
1
|
+
import { Y as escape_html, Z as is_array, _ as get_prototype_of, $ as object_prototype } from './index-CMS8WiSi.js';
|
|
2
|
+
import { c as store_get, e as ensure_array_like, b as attr_class, a as attr, s as stringify, u as unsubscribe_stores, d as attributes, f as await_block, g as clsx } from './index2-gtN4acH3.js';
|
|
3
|
+
import { T as Toast, f as formatProjectName, t as truncate, a as formatDate } from './Toast-CTZhGpnd.js';
|
|
4
|
+
import { a as appConfig, m as maskHomePath } from './config-DKyxRWWg.js';
|
|
5
|
+
import { t as sortProjects, u as getDisplayTitle } from './index3-DVZVsHMK.js';
|
|
6
|
+
import 'marked';
|
|
7
|
+
import 'fs';
|
|
8
|
+
import 'os';
|
|
9
|
+
import 'path';
|
|
10
|
+
import 'effect';
|
|
11
|
+
import 'fs/promises';
|
|
12
|
+
|
|
13
|
+
const empty = [];
|
|
14
|
+
function snapshot(value, skip_warning = false, no_tojson = false) {
|
|
15
|
+
return clone(value, /* @__PURE__ */ new Map(), "", empty, null, no_tojson);
|
|
16
|
+
}
|
|
17
|
+
function clone(value, cloned, path, paths, original = null, no_tojson = false) {
|
|
18
|
+
if (typeof value === "object" && value !== null) {
|
|
19
|
+
var unwrapped = cloned.get(value);
|
|
20
|
+
if (unwrapped !== void 0) return unwrapped;
|
|
21
|
+
if (value instanceof Map) return (
|
|
22
|
+
/** @type {Snapshot<T>} */
|
|
23
|
+
new Map(value)
|
|
24
|
+
);
|
|
25
|
+
if (value instanceof Set) return (
|
|
26
|
+
/** @type {Snapshot<T>} */
|
|
27
|
+
new Set(value)
|
|
28
|
+
);
|
|
29
|
+
if (is_array(value)) {
|
|
30
|
+
var copy = (
|
|
31
|
+
/** @type {Snapshot<any>} */
|
|
32
|
+
Array(value.length)
|
|
33
|
+
);
|
|
34
|
+
cloned.set(value, copy);
|
|
35
|
+
if (original !== null) {
|
|
36
|
+
cloned.set(original, copy);
|
|
37
|
+
}
|
|
38
|
+
for (var i = 0; i < value.length; i += 1) {
|
|
39
|
+
var element = value[i];
|
|
40
|
+
if (i in value) {
|
|
41
|
+
copy[i] = clone(element, cloned, path, paths, null, no_tojson);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return copy;
|
|
45
|
+
}
|
|
46
|
+
if (get_prototype_of(value) === object_prototype) {
|
|
47
|
+
copy = {};
|
|
48
|
+
cloned.set(value, copy);
|
|
49
|
+
if (original !== null) {
|
|
50
|
+
cloned.set(original, copy);
|
|
51
|
+
}
|
|
52
|
+
for (var key in value) {
|
|
53
|
+
copy[key] = clone(
|
|
54
|
+
// @ts-expect-error
|
|
55
|
+
value[key],
|
|
56
|
+
cloned,
|
|
57
|
+
path,
|
|
58
|
+
paths,
|
|
59
|
+
null,
|
|
60
|
+
no_tojson
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
return copy;
|
|
64
|
+
}
|
|
65
|
+
if (value instanceof Date) {
|
|
66
|
+
return (
|
|
67
|
+
/** @type {Snapshot<T>} */
|
|
68
|
+
structuredClone(value)
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
if (typeof /** @type {T & { toJSON?: any } } */
|
|
72
|
+
value.toJSON === "function" && !no_tojson) {
|
|
73
|
+
return clone(
|
|
74
|
+
/** @type {T & { toJSON(): any } } */
|
|
75
|
+
value.toJSON(),
|
|
76
|
+
cloned,
|
|
77
|
+
path,
|
|
78
|
+
paths,
|
|
79
|
+
// Associate the instance with the toJSON clone
|
|
80
|
+
value
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (value instanceof EventTarget) {
|
|
85
|
+
return (
|
|
86
|
+
/** @type {Snapshot<T>} */
|
|
87
|
+
value
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
try {
|
|
91
|
+
return (
|
|
92
|
+
/** @type {Snapshot<T>} */
|
|
93
|
+
structuredClone(value)
|
|
94
|
+
);
|
|
95
|
+
} catch (e) {
|
|
96
|
+
return (
|
|
97
|
+
/** @type {Snapshot<T>} */
|
|
98
|
+
value
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
const BASE_URL = "/api";
|
|
103
|
+
const get = async (path) => {
|
|
104
|
+
const res = await fetch(`${BASE_URL}${path}`);
|
|
105
|
+
if (!res.ok) throw new Error(await res.text());
|
|
106
|
+
return res.json();
|
|
107
|
+
};
|
|
108
|
+
const post = async (path, body) => {
|
|
109
|
+
const res = await fetch(`${BASE_URL}${path}`, {
|
|
110
|
+
method: "POST",
|
|
111
|
+
headers: { "Content-Type": "application/json" },
|
|
112
|
+
body: JSON.stringify(body)
|
|
113
|
+
});
|
|
114
|
+
if (!res.ok) throw new Error(await res.text());
|
|
115
|
+
return res.json();
|
|
116
|
+
};
|
|
117
|
+
const del = async (path) => {
|
|
118
|
+
const res = await fetch(`${BASE_URL}${path}`, { method: "DELETE" });
|
|
119
|
+
if (!res.ok) throw new Error(await res.text());
|
|
120
|
+
return res.json();
|
|
121
|
+
};
|
|
122
|
+
const patch = async (path, body) => {
|
|
123
|
+
const res = await fetch(`${BASE_URL}${path}`, {
|
|
124
|
+
method: "PATCH",
|
|
125
|
+
headers: { "Content-Type": "application/json" },
|
|
126
|
+
body: JSON.stringify(body)
|
|
127
|
+
});
|
|
128
|
+
if (!res.ok) throw new Error(await res.text());
|
|
129
|
+
return res.json();
|
|
130
|
+
};
|
|
131
|
+
const getSession = (project, id) => get(`/session?project=${encodeURIComponent(project)}&id=${encodeURIComponent(id)}`);
|
|
132
|
+
const deleteSession = (project, id) => del(
|
|
133
|
+
`/session?project=${encodeURIComponent(project)}&id=${encodeURIComponent(id)}`
|
|
134
|
+
);
|
|
135
|
+
const renameSession = (project, id, title) => post("/session/rename", { project, id, title });
|
|
136
|
+
const updateCustomTitle = (project, session, uuid, customTitle) => patch(
|
|
137
|
+
`/message?project=${encodeURIComponent(project)}&session=${encodeURIComponent(session)}&uuid=${encodeURIComponent(uuid)}`,
|
|
138
|
+
{ customTitle }
|
|
139
|
+
);
|
|
140
|
+
const splitSession = (project, sessionId, messageUuid) => post("/session/split", { project, sessionId, messageUuid });
|
|
141
|
+
const checkFileExists = async (filePath) => {
|
|
142
|
+
try {
|
|
143
|
+
const res = await get(`/file-exists?path=${encodeURIComponent(filePath)}`);
|
|
144
|
+
return res.exists;
|
|
145
|
+
} catch {
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
const expandProject = (projectName) => get(`/project/expand?project=${encodeURIComponent(projectName)}`);
|
|
150
|
+
const resumeSession = (projectName, sessionId) => post("/session/resume", { projectName, sessionId });
|
|
151
|
+
const maskHomePaths = (text) => {
|
|
152
|
+
return maskHomePath(text);
|
|
153
|
+
};
|
|
154
|
+
const extractText = (content) => {
|
|
155
|
+
if (typeof content === "string") return content;
|
|
156
|
+
if (Array.isArray(content)) {
|
|
157
|
+
return content.map(extractText).join("");
|
|
158
|
+
}
|
|
159
|
+
if (content.type === "text") return content.text ?? "";
|
|
160
|
+
if (content.type === "thinking") {
|
|
161
|
+
return "";
|
|
162
|
+
}
|
|
163
|
+
if (content.type === "tool_result") {
|
|
164
|
+
return content.content ? extractText(content.content) : "0";
|
|
165
|
+
}
|
|
166
|
+
if (content.content) return extractText(content.content);
|
|
167
|
+
return "";
|
|
168
|
+
};
|
|
169
|
+
const getMessageContent = (msg) => {
|
|
170
|
+
let content = "";
|
|
171
|
+
if (msg.summary) {
|
|
172
|
+
content = msg.summary;
|
|
173
|
+
} else if (msg.content) {
|
|
174
|
+
content = extractText(msg.content);
|
|
175
|
+
} else {
|
|
176
|
+
const m = msg.message;
|
|
177
|
+
if (m?.content) {
|
|
178
|
+
content = extractText(m.content);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return maskHomePaths(content);
|
|
182
|
+
};
|
|
183
|
+
const parseIdeTags = (content) => {
|
|
184
|
+
const segments = [];
|
|
185
|
+
const regex = /<(ide_[^>]+)>([\s\S]*?)<\/\1>/g;
|
|
186
|
+
let lastIndex = 0;
|
|
187
|
+
let match;
|
|
188
|
+
while ((match = regex.exec(content)) !== null) {
|
|
189
|
+
if (match.index > lastIndex) {
|
|
190
|
+
const text = content.slice(lastIndex, match.index).trim();
|
|
191
|
+
if (text) {
|
|
192
|
+
segments.push({ type: "text", content: text });
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
segments.push({
|
|
196
|
+
type: "ide_tag",
|
|
197
|
+
tag: match[1],
|
|
198
|
+
content: match[2].trim()
|
|
199
|
+
});
|
|
200
|
+
lastIndex = regex.lastIndex;
|
|
201
|
+
}
|
|
202
|
+
if (lastIndex < content.length) {
|
|
203
|
+
const text = content.slice(lastIndex).trim();
|
|
204
|
+
if (text) {
|
|
205
|
+
segments.push({ type: "text", content: text });
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
return segments;
|
|
209
|
+
};
|
|
210
|
+
function TooltipButton($$renderer, $$props) {
|
|
211
|
+
let {
|
|
212
|
+
title,
|
|
213
|
+
children,
|
|
214
|
+
position = "bottom",
|
|
215
|
+
class: className = "",
|
|
216
|
+
$$slots,
|
|
217
|
+
$$events,
|
|
218
|
+
...buttonProps
|
|
219
|
+
} = $$props;
|
|
220
|
+
$$renderer.push(`<button${attributes(
|
|
221
|
+
{
|
|
222
|
+
class: `tooltip-btn ${stringify(className)}`,
|
|
223
|
+
...buttonProps
|
|
224
|
+
},
|
|
225
|
+
"svelte-1yfjzin"
|
|
226
|
+
)}>`);
|
|
227
|
+
children($$renderer);
|
|
228
|
+
$$renderer.push(`<!----></button> `);
|
|
229
|
+
{
|
|
230
|
+
$$renderer.push("<!--[!-->");
|
|
231
|
+
}
|
|
232
|
+
$$renderer.push(`<!--]-->`);
|
|
233
|
+
}
|
|
234
|
+
function ProjectTree($$renderer, $$props) {
|
|
235
|
+
$$renderer.component(($$renderer2) => {
|
|
236
|
+
var $$store_subs;
|
|
237
|
+
let {
|
|
238
|
+
projects,
|
|
239
|
+
projectSessions,
|
|
240
|
+
projectSessionData,
|
|
241
|
+
expandedProjects,
|
|
242
|
+
selectedSession,
|
|
243
|
+
loadingProject,
|
|
244
|
+
onRenameSession,
|
|
245
|
+
onDeleteSession,
|
|
246
|
+
onResumeSession
|
|
247
|
+
} = $$props;
|
|
248
|
+
const getSessionData = (projectName, sessionId) => {
|
|
249
|
+
return projectSessionData.get(projectName)?.get(sessionId);
|
|
250
|
+
};
|
|
251
|
+
const getDisplayTitle2 = (session) => {
|
|
252
|
+
const data = getSessionData(session.projectName, session.id);
|
|
253
|
+
if (data?.customTitle) return data.customTitle;
|
|
254
|
+
if (data?.currentSummary) {
|
|
255
|
+
const summary = data.currentSummary;
|
|
256
|
+
return summary.length > 60 ? summary.slice(0, 57) + "..." : summary;
|
|
257
|
+
}
|
|
258
|
+
if (session.title && session.title !== "Untitled") return session.title;
|
|
259
|
+
return "Untitled";
|
|
260
|
+
};
|
|
261
|
+
const getTooltipText = (session) => {
|
|
262
|
+
const data = getSessionData(session.projectName, session.id);
|
|
263
|
+
if (data?.customTitle && data?.currentSummary) {
|
|
264
|
+
return data.currentSummary;
|
|
265
|
+
}
|
|
266
|
+
if (data?.currentSummary && session.title && session.title !== "Untitled") {
|
|
267
|
+
return session.title;
|
|
268
|
+
}
|
|
269
|
+
if (data?.currentSummary) {
|
|
270
|
+
return data.currentSummary;
|
|
271
|
+
}
|
|
272
|
+
return session.title ?? "No summary available";
|
|
273
|
+
};
|
|
274
|
+
const getSessionInfo = (session) => {
|
|
275
|
+
const data = getSessionData(session.projectName, session.id);
|
|
276
|
+
const todoCount = data?.todos ? data.todos.sessionTodos.length + data.todos.agentTodos.reduce((acc, at) => acc + at.todos.length, 0) : 0;
|
|
277
|
+
return {
|
|
278
|
+
agents: data?.agents.length ?? 0,
|
|
279
|
+
todos: todoCount,
|
|
280
|
+
summaries: data?.summaries.length ?? 0
|
|
281
|
+
};
|
|
282
|
+
};
|
|
283
|
+
const sortedProjects = sortProjects(projects, {
|
|
284
|
+
currentProjectName: store_get($$store_subs ??= {}, "$appConfig", appConfig).currentProjectName,
|
|
285
|
+
homeDir: store_get($$store_subs ??= {}, "$appConfig", appConfig).homeDir
|
|
286
|
+
});
|
|
287
|
+
let expandedSessions = /* @__PURE__ */ new Set();
|
|
288
|
+
let draggedSession = null;
|
|
289
|
+
let dropTargetProject = null;
|
|
290
|
+
$$renderer2.push(`<aside class="bg-gh-bg-secondary border border-gh-border rounded-lg overflow-hidden flex flex-col"><h2 class="p-4 text-base font-semibold border-b border-gh-border bg-gh-bg">Projects (${escape_html(sortedProjects.length)})</h2> <ul class="overflow-y-auto flex-1"><!--[-->`);
|
|
291
|
+
const each_array = ensure_array_like(sortedProjects);
|
|
292
|
+
for (let $$index_4 = 0, $$length = each_array.length; $$index_4 < $$length; $$index_4++) {
|
|
293
|
+
let project = each_array[$$index_4];
|
|
294
|
+
const isDropTarget = dropTargetProject === project.name;
|
|
295
|
+
$$renderer2.push(`<li class="border-b border-gh-border-subtle"><button${attr_class(`w-full py-3 px-4 bg-transparent border-none text-gh-text cursor-pointer text-left flex items-center gap-2 font-medium hover:bg-gh-border-subtle ${stringify(expandedProjects.has(project.name) ? "bg-gh-accent/10" : "")} ${stringify(isDropTarget ? "bg-gh-green/20 ring-2 ring-gh-green ring-inset" : "")}`)}><span class="text-xs w-3 text-gh-text-secondary">${escape_html(expandedProjects.has(project.name) ? "▼" : "▶")}</span> <span class="flex-1 overflow-hidden text-ellipsis whitespace-nowrap"${attr("title", project.displayName)}>${escape_html(formatProjectName(project.displayName))}</span> <span class="bg-gh-border px-2 py-0.5 rounded-full text-xs font-normal">${escape_html(project.sessionCount)}</span></button> `);
|
|
296
|
+
if (expandedProjects.has(project.name)) {
|
|
297
|
+
$$renderer2.push("<!--[-->");
|
|
298
|
+
$$renderer2.push(`<ul class="bg-gh-bg">`);
|
|
299
|
+
if (loadingProject === project.name) {
|
|
300
|
+
$$renderer2.push("<!--[-->");
|
|
301
|
+
$$renderer2.push(`<li class="py-2 px-8 text-gh-text-secondary text-sm">Loading...</li>`);
|
|
302
|
+
} else {
|
|
303
|
+
$$renderer2.push("<!--[!-->");
|
|
304
|
+
$$renderer2.push(`<!--[-->`);
|
|
305
|
+
const each_array_1 = ensure_array_like(projectSessions.get(project.name) ?? []);
|
|
306
|
+
for (let $$index_3 = 0, $$length2 = each_array_1.length; $$index_3 < $$length2; $$index_3++) {
|
|
307
|
+
let session = each_array_1[$$index_3];
|
|
308
|
+
const isSelected = selectedSession?.id === session.id;
|
|
309
|
+
const isDragging = draggedSession?.id === session.id;
|
|
310
|
+
const sessionInfo = getSessionInfo(session);
|
|
311
|
+
const displayTitle = getDisplayTitle2(session);
|
|
312
|
+
const tooltipText = getTooltipText(session);
|
|
313
|
+
const data = getSessionData(session.projectName, session.id);
|
|
314
|
+
const isSummaryFallback = !data?.customTitle && !data?.currentSummary;
|
|
315
|
+
const isExpanded = expandedSessions.has(session.id);
|
|
316
|
+
const hasSubItems = sessionInfo.summaries > 0 || sessionInfo.agents > 0 || sessionInfo.todos > 0;
|
|
317
|
+
$$renderer2.push(`<li${attr_class(`relative border-t border-gh-border-subtle group ${stringify(isSelected ? "bg-gh-accent/20 border-l-3 border-l-gh-accent" : "")} ${stringify(isDragging ? "opacity-50" : "")}`)} draggable="true"><div class="flex items-center">`);
|
|
318
|
+
if (hasSubItems) {
|
|
319
|
+
$$renderer2.push("<!--[-->");
|
|
320
|
+
$$renderer2.push(`<button class="flex-shrink-0 w-5 h-8 flex items-center justify-center bg-transparent border-none cursor-pointer text-gh-text-secondary text-xs ml-1 z-10 relative"${attr("title", isExpanded ? "Collapse" : "Expand")}>${escape_html(isExpanded ? "▼" : "▶")}</button>`);
|
|
321
|
+
} else {
|
|
322
|
+
$$renderer2.push("<!--[!-->");
|
|
323
|
+
$$renderer2.push(`<span class="w-5 ml-1"></span>`);
|
|
324
|
+
}
|
|
325
|
+
$$renderer2.push(`<!--]--> <button class="flex-1 min-w-0 py-2 pr-2 bg-transparent border-none text-gh-text cursor-pointer text-left flex items-center gap-2 text-sm"${attr("title", tooltipText)}><span${attr_class(`flex-1 min-w-0 overflow-hidden text-ellipsis whitespace-nowrap ${stringify(isSummaryFallback ? "italic text-gh-text-secondary" : "")}`)}>${escape_html(displayTitle)}</span> <span class="flex-shrink-0 flex items-center gap-2 text-xs text-gh-text-secondary"><span class="flex items-center gap-0.5"${attr("title", `${stringify(session.messageCount)} messages`)}><span>💬</span><span>${escape_html(session.messageCount)}</span></span> `);
|
|
326
|
+
if (sessionInfo.agents > 0) {
|
|
327
|
+
$$renderer2.push("<!--[-->");
|
|
328
|
+
$$renderer2.push(`<span class="flex items-center gap-0.5"${attr("title", `${stringify(sessionInfo.agents)} agent(s)`)}><span>🤖</span><span>${escape_html(sessionInfo.agents)}</span></span>`);
|
|
329
|
+
} else {
|
|
330
|
+
$$renderer2.push("<!--[!-->");
|
|
331
|
+
}
|
|
332
|
+
$$renderer2.push(`<!--]--> `);
|
|
333
|
+
if (sessionInfo.todos > 0) {
|
|
334
|
+
$$renderer2.push("<!--[-->");
|
|
335
|
+
$$renderer2.push(`<span class="flex items-center gap-0.5"${attr("title", `${stringify(sessionInfo.todos)} todo(s)`)}><span>📋</span><span>${escape_html(sessionInfo.todos)}</span></span>`);
|
|
336
|
+
} else {
|
|
337
|
+
$$renderer2.push("<!--[!-->");
|
|
338
|
+
}
|
|
339
|
+
$$renderer2.push(`<!--]--></span></button> <div${attr_class(`absolute left-0 right-0 top-0 h-8 flex items-center opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none ${stringify(isSelected ? "bg-gradient-to-r from-[color-mix(in_srgb,var(--color-gh-accent)_20%,var(--color-gh-bg))] via-[color-mix(in_srgb,var(--color-gh-accent)_20%,var(--color-gh-bg))] to-[color-mix(in_srgb,var(--color-gh-accent)_20%,var(--color-gh-bg))]" : "bg-gradient-to-r from-gh-bg via-gh-bg to-gh-bg")}`)}><span class="flex-1 min-w-0 pl-7 pr-2 text-xs text-gh-text-secondary italic overflow-hidden text-ellipsis whitespace-nowrap">`);
|
|
340
|
+
if (data?.currentSummary) {
|
|
341
|
+
$$renderer2.push("<!--[-->");
|
|
342
|
+
$$renderer2.push(`${escape_html(data.currentSummary.length > 50 ? data.currentSummary.slice(0, 47) + "..." : data.currentSummary)}`);
|
|
343
|
+
} else {
|
|
344
|
+
$$renderer2.push("<!--[!-->");
|
|
345
|
+
$$renderer2.push(`${escape_html(displayTitle)}`);
|
|
346
|
+
}
|
|
347
|
+
$$renderer2.push(`<!--]--></span> <div class="flex-shrink-0 flex gap-0.5 pr-2 pointer-events-auto">`);
|
|
348
|
+
if (onResumeSession) {
|
|
349
|
+
$$renderer2.push("<!--[-->");
|
|
350
|
+
TooltipButton($$renderer2, {
|
|
351
|
+
class: "p-1 rounded hover:bg-gh-green/20 text-xs",
|
|
352
|
+
onclick: (e) => onResumeSession(e, session),
|
|
353
|
+
title: "Resume session",
|
|
354
|
+
children: ($$renderer3) => {
|
|
355
|
+
$$renderer3.push(`<!---->▶️`);
|
|
356
|
+
},
|
|
357
|
+
$$slots: { default: true }
|
|
358
|
+
});
|
|
359
|
+
} else {
|
|
360
|
+
$$renderer2.push("<!--[!-->");
|
|
361
|
+
}
|
|
362
|
+
$$renderer2.push(`<!--]--> `);
|
|
363
|
+
TooltipButton($$renderer2, {
|
|
364
|
+
class: "p-1 rounded hover:bg-gh-border text-xs",
|
|
365
|
+
onclick: (e) => onRenameSession(e, session),
|
|
366
|
+
title: "Rename",
|
|
367
|
+
children: ($$renderer3) => {
|
|
368
|
+
$$renderer3.push(`<!---->✏️`);
|
|
369
|
+
},
|
|
370
|
+
$$slots: { default: true }
|
|
371
|
+
});
|
|
372
|
+
$$renderer2.push(`<!----> `);
|
|
373
|
+
TooltipButton($$renderer2, {
|
|
374
|
+
class: "p-1 rounded hover:bg-gh-red/20 text-xs",
|
|
375
|
+
onclick: (e) => onDeleteSession(e, session),
|
|
376
|
+
title: "Delete",
|
|
377
|
+
children: ($$renderer3) => {
|
|
378
|
+
$$renderer3.push(`<!---->🗑️`);
|
|
379
|
+
},
|
|
380
|
+
$$slots: { default: true }
|
|
381
|
+
});
|
|
382
|
+
$$renderer2.push(`<!----></div></div></div> `);
|
|
383
|
+
if (isExpanded && hasSubItems) {
|
|
384
|
+
$$renderer2.push("<!--[-->");
|
|
385
|
+
$$renderer2.push(`<ul class="bg-gh-bg-secondary/50 border-t border-gh-border-subtle text-xs">`);
|
|
386
|
+
if (data?.summaries && data.summaries.length > 0) {
|
|
387
|
+
$$renderer2.push("<!--[-->");
|
|
388
|
+
$$renderer2.push(`<!--[-->`);
|
|
389
|
+
const each_array_2 = ensure_array_like(data.summaries);
|
|
390
|
+
for (let idx = 0, $$length3 = each_array_2.length; idx < $$length3; idx++) {
|
|
391
|
+
let summary = each_array_2[idx];
|
|
392
|
+
$$renderer2.push(`<li${attr_class(`py-1.5 px-4 pl-8 hover:bg-gh-border-subtle/50 flex flex-col gap-0.5 ${stringify(idx === 0 ? "text-gh-text" : "text-gh-text-secondary")}`)}${attr("title", summary.summary)}><div class="flex items-start gap-2"><span class="flex-shrink-0">📝</span> <span class="overflow-hidden text-ellipsis line-clamp-2">${escape_html(summary.summary.length > 100 ? summary.summary.slice(0, 97) + "..." : summary.summary)}</span></div> `);
|
|
393
|
+
if (summary.timestamp) {
|
|
394
|
+
$$renderer2.push("<!--[-->");
|
|
395
|
+
$$renderer2.push(`<span class="pl-6 text-[10px] text-gh-text-secondary/70">${escape_html(new Date(summary.timestamp).toLocaleString())}</span>`);
|
|
396
|
+
} else {
|
|
397
|
+
$$renderer2.push("<!--[!-->");
|
|
398
|
+
}
|
|
399
|
+
$$renderer2.push(`<!--]--></li>`);
|
|
400
|
+
}
|
|
401
|
+
$$renderer2.push(`<!--]-->`);
|
|
402
|
+
} else {
|
|
403
|
+
$$renderer2.push("<!--[!-->");
|
|
404
|
+
}
|
|
405
|
+
$$renderer2.push(`<!--]--> `);
|
|
406
|
+
if (data?.todos?.sessionTodos && data.todos.sessionTodos.length > 0) {
|
|
407
|
+
$$renderer2.push("<!--[-->");
|
|
408
|
+
$$renderer2.push(`<li class="py-1.5 px-4 pl-8 text-gh-text-secondary hover:bg-gh-border-subtle/50 flex items-start gap-2"><span class="flex-shrink-0">📋</span> <span>Session Todos (${escape_html(data.todos.sessionTodos.length)})</span></li>`);
|
|
409
|
+
} else {
|
|
410
|
+
$$renderer2.push("<!--[!-->");
|
|
411
|
+
}
|
|
412
|
+
$$renderer2.push(`<!--]--> `);
|
|
413
|
+
if (data?.todos?.agentTodos) {
|
|
414
|
+
$$renderer2.push("<!--[-->");
|
|
415
|
+
$$renderer2.push(`<!--[-->`);
|
|
416
|
+
const each_array_3 = ensure_array_like(data.todos.agentTodos);
|
|
417
|
+
for (let $$index_1 = 0, $$length3 = each_array_3.length; $$index_1 < $$length3; $$index_1++) {
|
|
418
|
+
let agentTodo = each_array_3[$$index_1];
|
|
419
|
+
$$renderer2.push(`<li class="py-1.5 px-4 pl-8 text-gh-text-secondary hover:bg-gh-border-subtle/50 flex items-start gap-2"><span class="flex-shrink-0">📋</span> <span>Agent Todos (${escape_html(agentTodo.todos.length)})</span></li>`);
|
|
420
|
+
}
|
|
421
|
+
$$renderer2.push(`<!--]-->`);
|
|
422
|
+
} else {
|
|
423
|
+
$$renderer2.push("<!--[!-->");
|
|
424
|
+
}
|
|
425
|
+
$$renderer2.push(`<!--]--> `);
|
|
426
|
+
if (data?.agents && data.agents.length > 0) {
|
|
427
|
+
$$renderer2.push("<!--[-->");
|
|
428
|
+
$$renderer2.push(`<!--[-->`);
|
|
429
|
+
const each_array_4 = ensure_array_like(data.agents);
|
|
430
|
+
for (let $$index_2 = 0, $$length3 = each_array_4.length; $$index_2 < $$length3; $$index_2++) {
|
|
431
|
+
let agent = each_array_4[$$index_2];
|
|
432
|
+
$$renderer2.push(`<li class="py-1.5 px-4 pl-8 text-gh-text-secondary hover:bg-gh-border-subtle/50 flex items-start gap-2"${attr("title", agent.name ?? agent.id)}><span class="flex-shrink-0">🤖</span> <span class="overflow-hidden text-ellipsis whitespace-nowrap">${escape_html(agent.name ?? agent.id.slice(0, 12) + "...")} (${escape_html(agent.messageCount)} msgs)</span></li>`);
|
|
433
|
+
}
|
|
434
|
+
$$renderer2.push(`<!--]-->`);
|
|
435
|
+
} else {
|
|
436
|
+
$$renderer2.push("<!--[!-->");
|
|
437
|
+
}
|
|
438
|
+
$$renderer2.push(`<!--]--></ul>`);
|
|
439
|
+
} else {
|
|
440
|
+
$$renderer2.push("<!--[!-->");
|
|
441
|
+
}
|
|
442
|
+
$$renderer2.push(`<!--]--></li>`);
|
|
443
|
+
}
|
|
444
|
+
$$renderer2.push(`<!--]-->`);
|
|
445
|
+
}
|
|
446
|
+
$$renderer2.push(`<!--]--></ul>`);
|
|
447
|
+
} else {
|
|
448
|
+
$$renderer2.push("<!--[!-->");
|
|
449
|
+
}
|
|
450
|
+
$$renderer2.push(`<!--]--></li>`);
|
|
451
|
+
}
|
|
452
|
+
$$renderer2.push(`<!--]--></ul></aside>`);
|
|
453
|
+
if ($$store_subs) unsubscribe_stores($$store_subs);
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
function ExpandableContent($$renderer, $$props) {
|
|
457
|
+
$$renderer.component(($$renderer2) => {
|
|
458
|
+
let { content, maxLines = 10, lang } = $$props;
|
|
459
|
+
const lines = content.split("\n");
|
|
460
|
+
const needsExpand = lines.length > maxLines;
|
|
461
|
+
const displayContent = needsExpand && true ? lines.slice(0, maxLines).join("\n") : content;
|
|
462
|
+
if (needsExpand) {
|
|
463
|
+
$$renderer2.push("<!--[-->");
|
|
464
|
+
$$renderer2.push(`<div class="relative">`);
|
|
465
|
+
if (lang) {
|
|
466
|
+
$$renderer2.push("<!--[-->");
|
|
467
|
+
$$renderer2.push(`<pre class="whitespace-pre-wrap font-mono text-xs text-gh-text-secondary overflow-x-auto"><code${attr_class(`language-${stringify(lang)}`)}>${escape_html(displayContent)}</code></pre>`);
|
|
468
|
+
} else {
|
|
469
|
+
$$renderer2.push("<!--[!-->");
|
|
470
|
+
$$renderer2.push(`<pre class="whitespace-pre-wrap font-mono text-xs text-gh-text-secondary overflow-x-auto">${escape_html(displayContent)}</pre>`);
|
|
471
|
+
}
|
|
472
|
+
$$renderer2.push(`<!--]--> `);
|
|
473
|
+
{
|
|
474
|
+
$$renderer2.push("<!--[-->");
|
|
475
|
+
$$renderer2.push(`<div class="absolute bottom-0 left-0 right-0 h-8 bg-gradient-to-t from-gh-canvas to-transparent pointer-events-none"></div> `);
|
|
476
|
+
{
|
|
477
|
+
$$renderer2.push("<!--[!-->");
|
|
478
|
+
}
|
|
479
|
+
$$renderer2.push(`<!--]-->`);
|
|
480
|
+
}
|
|
481
|
+
$$renderer2.push(`<!--]--></div>`);
|
|
482
|
+
} else {
|
|
483
|
+
$$renderer2.push("<!--[!-->");
|
|
484
|
+
if (lang) {
|
|
485
|
+
$$renderer2.push("<!--[-->");
|
|
486
|
+
$$renderer2.push(`<pre class="whitespace-pre-wrap font-mono text-xs text-gh-text-secondary overflow-x-auto"><code${attr_class(`language-${stringify(lang)}`)}>${escape_html(content)}</code></pre>`);
|
|
487
|
+
} else {
|
|
488
|
+
$$renderer2.push("<!--[!-->");
|
|
489
|
+
$$renderer2.push(`<pre class="whitespace-pre-wrap font-mono text-xs text-gh-text-secondary overflow-x-auto">${escape_html(content)}</pre>`);
|
|
490
|
+
}
|
|
491
|
+
$$renderer2.push(`<!--]-->`);
|
|
492
|
+
}
|
|
493
|
+
$$renderer2.push(`<!--]-->`);
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
function IdeTag($$renderer, $$props) {
|
|
497
|
+
$$renderer.component(($$renderer2) => {
|
|
498
|
+
const { tag, content } = $$props;
|
|
499
|
+
const filePath = (() => {
|
|
500
|
+
const pathMatch = content.match(/(?:opened the file |selected.*from )(\/[^\s]+)/);
|
|
501
|
+
if (pathMatch) return pathMatch[1];
|
|
502
|
+
if (content.trim().startsWith("/")) {
|
|
503
|
+
return content.trim().split("\n")[0].split(" ")[0];
|
|
504
|
+
}
|
|
505
|
+
return null;
|
|
506
|
+
})();
|
|
507
|
+
const lineInfo = (() => {
|
|
508
|
+
const lineMatch = content.match(/lines? (\d+)(?:\s*to\s*(\d+))?/);
|
|
509
|
+
if (lineMatch) {
|
|
510
|
+
return lineMatch[2] ? `L${lineMatch[1]}-${lineMatch[2]}` : `L${lineMatch[1]}`;
|
|
511
|
+
}
|
|
512
|
+
return null;
|
|
513
|
+
})();
|
|
514
|
+
if (tag === "ide_opened_file") {
|
|
515
|
+
$$renderer2.push("<!--[-->");
|
|
516
|
+
$$renderer2.push(`<div class="flex items-center gap-2 text-xs text-blue-400 bg-blue-900/20 rounded px-2 py-1"><span class="opacity-60">📂</span> `);
|
|
517
|
+
if (filePath) {
|
|
518
|
+
$$renderer2.push("<!--[-->");
|
|
519
|
+
await_block(
|
|
520
|
+
$$renderer2,
|
|
521
|
+
checkFileExists(filePath),
|
|
522
|
+
() => {
|
|
523
|
+
$$renderer2.push(`<span class="font-mono">${escape_html(filePath.split("/").pop())}</span>`);
|
|
524
|
+
},
|
|
525
|
+
(exists) => {
|
|
526
|
+
if (exists) {
|
|
527
|
+
$$renderer2.push("<!--[-->");
|
|
528
|
+
$$renderer2.push(`<button class="font-mono hover:underline cursor-pointer bg-transparent border-none text-blue-400 p-0"${attr("title", filePath)}>${escape_html(filePath.split("/").pop())}${escape_html(lineInfo ? `:${lineInfo}` : "")}</button>`);
|
|
529
|
+
} else {
|
|
530
|
+
$$renderer2.push("<!--[!-->");
|
|
531
|
+
$$renderer2.push(`<span class="font-mono opacity-60"${attr("title", filePath)}>${escape_html(filePath.split("/").pop())}</span>`);
|
|
532
|
+
}
|
|
533
|
+
$$renderer2.push(`<!--]-->`);
|
|
534
|
+
}
|
|
535
|
+
);
|
|
536
|
+
$$renderer2.push(`<!--]-->`);
|
|
537
|
+
} else {
|
|
538
|
+
$$renderer2.push("<!--[!-->");
|
|
539
|
+
$$renderer2.push(`<span class="opacity-60">${escape_html(content)}</span>`);
|
|
540
|
+
}
|
|
541
|
+
$$renderer2.push(`<!--]--></div>`);
|
|
542
|
+
} else {
|
|
543
|
+
$$renderer2.push("<!--[!-->");
|
|
544
|
+
if (tag === "ide_selection") {
|
|
545
|
+
$$renderer2.push("<!--[-->");
|
|
546
|
+
$$renderer2.push(`<div class="text-xs text-purple-400 bg-purple-900/20 rounded px-2 py-1"><div class="flex items-center gap-2"><span class="opacity-60">✂️</span> `);
|
|
547
|
+
if (filePath) {
|
|
548
|
+
$$renderer2.push("<!--[-->");
|
|
549
|
+
await_block(
|
|
550
|
+
$$renderer2,
|
|
551
|
+
checkFileExists(filePath),
|
|
552
|
+
() => {
|
|
553
|
+
$$renderer2.push(`<span class="font-mono">${escape_html(filePath.split("/").pop())}${escape_html(lineInfo ? `:${lineInfo}` : "")}</span>`);
|
|
554
|
+
},
|
|
555
|
+
(exists) => {
|
|
556
|
+
if (exists) {
|
|
557
|
+
$$renderer2.push("<!--[-->");
|
|
558
|
+
$$renderer2.push(`<button class="font-mono hover:underline cursor-pointer bg-transparent border-none text-purple-400 p-0"${attr("title", filePath)}>${escape_html(filePath.split("/").pop())}${escape_html(lineInfo ? `:${lineInfo}` : "")}</button>`);
|
|
559
|
+
} else {
|
|
560
|
+
$$renderer2.push("<!--[!-->");
|
|
561
|
+
$$renderer2.push(`<span class="font-mono opacity-60"${attr("title", filePath)}>${escape_html(filePath.split("/").pop())}${escape_html(lineInfo ? `:${lineInfo}` : "")}</span>`);
|
|
562
|
+
}
|
|
563
|
+
$$renderer2.push(`<!--]-->`);
|
|
564
|
+
}
|
|
565
|
+
);
|
|
566
|
+
$$renderer2.push(`<!--]-->`);
|
|
567
|
+
} else {
|
|
568
|
+
$$renderer2.push("<!--[!-->");
|
|
569
|
+
$$renderer2.push(`<span class="font-mono">${escape_html(content.split("\n")[0].slice(0, 60))}</span>`);
|
|
570
|
+
}
|
|
571
|
+
$$renderer2.push(`<!--]--></div></div>`);
|
|
572
|
+
} else {
|
|
573
|
+
$$renderer2.push("<!--[!-->");
|
|
574
|
+
$$renderer2.push(`<div class="text-xs text-yellow-400 bg-yellow-900/20 rounded px-2 py-1"><span class="opacity-60">⚠️</span> <span class="font-mono"><${escape_html(tag)}></span> <span class="opacity-60 ml-1">${escape_html(content.slice(0, 50))}${escape_html(content.length > 50 ? "..." : "")}</span></div>`);
|
|
575
|
+
}
|
|
576
|
+
$$renderer2.push(`<!--]-->`);
|
|
577
|
+
}
|
|
578
|
+
$$renderer2.push(`<!--]-->`);
|
|
579
|
+
});
|
|
580
|
+
}
|
|
581
|
+
function TodoItem($$renderer, $$props) {
|
|
582
|
+
const { todos } = $$props;
|
|
583
|
+
const statusIcon = (status) => {
|
|
584
|
+
switch (status) {
|
|
585
|
+
case "completed":
|
|
586
|
+
return "✅";
|
|
587
|
+
case "in_progress":
|
|
588
|
+
return "🔄";
|
|
589
|
+
case "pending":
|
|
590
|
+
return "⬜";
|
|
591
|
+
}
|
|
592
|
+
};
|
|
593
|
+
const statusClass = (status) => {
|
|
594
|
+
switch (status) {
|
|
595
|
+
case "completed":
|
|
596
|
+
return "text-gh-green";
|
|
597
|
+
case "in_progress":
|
|
598
|
+
return "text-gh-accent";
|
|
599
|
+
case "pending":
|
|
600
|
+
return "text-gh-text-secondary";
|
|
601
|
+
}
|
|
602
|
+
};
|
|
603
|
+
$$renderer.push(`<ul class="space-y-1.5 mt-1"><!--[-->`);
|
|
604
|
+
const each_array = ensure_array_like(todos);
|
|
605
|
+
for (let $$index = 0, $$length = each_array.length; $$index < $$length; $$index++) {
|
|
606
|
+
let todo = each_array[$$index];
|
|
607
|
+
$$renderer.push(`<li${attr_class(`flex items-start gap-2 text-sm ${stringify(statusClass(todo.status))}`)}><span class="flex-shrink-0">${escape_html(statusIcon(todo.status))}</span> <span${attr_class(clsx(todo.status === "completed" ? "line-through opacity-70" : ""))}>${escape_html(todo.status === "in_progress" ? todo.activeForm : todo.content)}</span></li>`);
|
|
608
|
+
}
|
|
609
|
+
$$renderer.push(`<!--]--></ul>`);
|
|
610
|
+
}
|
|
611
|
+
function MessageItem($$renderer, $$props) {
|
|
612
|
+
$$renderer.component(($$renderer2) => {
|
|
613
|
+
let {
|
|
614
|
+
msg,
|
|
615
|
+
sessionId,
|
|
616
|
+
isFirst = false,
|
|
617
|
+
onEditTitle,
|
|
618
|
+
onSplit
|
|
619
|
+
} = $$props;
|
|
620
|
+
const msgId = msg.uuid ?? "";
|
|
621
|
+
const isAssistant = msg.type === "assistant";
|
|
622
|
+
const isCustomTitle = msg.type === "custom-title";
|
|
623
|
+
const isFileSnapshot = msg.type === "file-history-snapshot";
|
|
624
|
+
const isHuman = msg.type === "human" || msg.type === "user";
|
|
625
|
+
const isLocalCommand = msg.type === "system" && msg.subtype === "local_command";
|
|
626
|
+
const isQueueOperation = msg.type === "queue-operation";
|
|
627
|
+
const isToolResult = (() => {
|
|
628
|
+
if (msg.type !== "user") return false;
|
|
629
|
+
const m = msg.message;
|
|
630
|
+
if (!Array.isArray(m?.content)) return false;
|
|
631
|
+
const first = m.content[0];
|
|
632
|
+
return first?.type === "tool_result";
|
|
633
|
+
})();
|
|
634
|
+
const snapshotData = (() => {
|
|
635
|
+
if (!isFileSnapshot) return null;
|
|
636
|
+
const snapshot2 = msg.snapshot;
|
|
637
|
+
const backups = snapshot2?.trackedFileBackups ?? {};
|
|
638
|
+
return {
|
|
639
|
+
files: Object.entries(backups),
|
|
640
|
+
timestamp: snapshot2?.timestamp
|
|
641
|
+
};
|
|
642
|
+
})();
|
|
643
|
+
const commandData = (() => {
|
|
644
|
+
if (!isLocalCommand) return null;
|
|
645
|
+
const content = typeof msg.content === "string" ? msg.content : "";
|
|
646
|
+
const name = content.match(/<command-name>([^<]+)<\/command-name>/)?.[1] ?? "";
|
|
647
|
+
const message = content.match(/<command-message>([^<]+)<\/command-message>/)?.[1] ?? "";
|
|
648
|
+
return { name, message };
|
|
649
|
+
})();
|
|
650
|
+
const FILE_TOOLS = ["Read", "Write", "Edit"];
|
|
651
|
+
const toolUseData = (() => {
|
|
652
|
+
if (!isAssistant) return null;
|
|
653
|
+
const m = msg.message;
|
|
654
|
+
if (!Array.isArray(m?.content)) return null;
|
|
655
|
+
const toolUse = m.content.find((item) => typeof item === "object" && item !== null && item.type === "tool_use");
|
|
656
|
+
if (!toolUse) return null;
|
|
657
|
+
return {
|
|
658
|
+
name: toolUse.name,
|
|
659
|
+
input: toolUse.input,
|
|
660
|
+
// Extract file path for file tools (Read, Write, Edit)
|
|
661
|
+
filePath: FILE_TOOLS.includes(toolUse.name) ? toolUse.input.file_path : null
|
|
662
|
+
};
|
|
663
|
+
})();
|
|
664
|
+
const thinkingBlocks = (() => {
|
|
665
|
+
if (!isAssistant) return [];
|
|
666
|
+
const m = msg.message;
|
|
667
|
+
if (!Array.isArray(m?.content)) return [];
|
|
668
|
+
return m.content.filter((item) => typeof item === "object" && item !== null && item.type === "thinking");
|
|
669
|
+
})();
|
|
670
|
+
const customTitle = msg.customTitle ?? "";
|
|
671
|
+
const messageId = msg.uuid || msg.messageId || "";
|
|
672
|
+
const hasContent = (() => {
|
|
673
|
+
if (isQueueOperation) return false;
|
|
674
|
+
if (isFileSnapshot || isLocalCommand || isCustomTitle || toolUseData) return true;
|
|
675
|
+
const content = getMessageContent(msg);
|
|
676
|
+
if (content.trim().length > 0) return true;
|
|
677
|
+
if (msg.type === "user" || msg.type === "human") {
|
|
678
|
+
const label = isToolResult ? "Tool result" : "User message";
|
|
679
|
+
console.warn(`${label} without content:`, snapshot(msg));
|
|
680
|
+
}
|
|
681
|
+
return false;
|
|
682
|
+
})();
|
|
683
|
+
const hasAnyContent = hasContent || thinkingBlocks.length > 0;
|
|
684
|
+
const messageClass = (() => {
|
|
685
|
+
if (isHuman) return "bg-gh-accent/15 border-l-3 border-l-gh-accent";
|
|
686
|
+
if (isAssistant) return "bg-gh-green/15 border-l-3 border-l-gh-green";
|
|
687
|
+
if (isCustomTitle) return "bg-purple-500/15 border-l-3 border-l-purple-500";
|
|
688
|
+
return "bg-gh-border-subtle";
|
|
689
|
+
})();
|
|
690
|
+
function splitButton($$renderer3) {
|
|
691
|
+
if (onSplit && !isFirst && msg.uuid) {
|
|
692
|
+
$$renderer3.push("<!--[-->");
|
|
693
|
+
$$renderer3.push(`<button class="opacity-0 group-hover:opacity-100 transition-opacity bg-transparent border-none cursor-pointer p-1 rounded hover:bg-gh-accent/20 text-xs" title="Split session from this message">✂️</button>`);
|
|
694
|
+
} else {
|
|
695
|
+
$$renderer3.push("<!--[!-->");
|
|
696
|
+
}
|
|
697
|
+
$$renderer3.push(`<!--]-->`);
|
|
698
|
+
}
|
|
699
|
+
function deleteButton($$renderer3) {
|
|
700
|
+
$$renderer3.push(`<button class="opacity-0 group-hover:opacity-100 transition-opacity bg-transparent border-none cursor-pointer p-1 rounded hover:bg-gh-red/20 text-xs" title="Delete message">🗑️</button>`);
|
|
701
|
+
}
|
|
702
|
+
if (isQueueOperation) {
|
|
703
|
+
$$renderer2.push("<!--[-->");
|
|
704
|
+
} else {
|
|
705
|
+
$$renderer2.push("<!--[!-->");
|
|
706
|
+
if (isFileSnapshot && snapshotData) {
|
|
707
|
+
$$renderer2.push("<!--[-->");
|
|
708
|
+
$$renderer2.push(`<div${attr("data-msg-id", msgId)} class="p-4 rounded-lg bg-amber-500/10 border-l-3 border-l-amber-500 group relative"><div class="flex justify-between mb-2 text-xs text-gh-text-secondary"><span class="uppercase font-semibold text-amber-400">📁 File Backups (${escape_html(snapshotData.files.length)})</span> <div class="flex items-center gap-2"><span>${escape_html(formatDate(snapshotData.timestamp))}</span> `);
|
|
709
|
+
splitButton($$renderer2);
|
|
710
|
+
$$renderer2.push(`<!----> `);
|
|
711
|
+
deleteButton($$renderer2);
|
|
712
|
+
$$renderer2.push(`<!----></div></div> <ul class="space-y-1"><!--[-->`);
|
|
713
|
+
const each_array = ensure_array_like(snapshotData.files);
|
|
714
|
+
for (let $$index = 0, $$length = each_array.length; $$index < $$length; $$index++) {
|
|
715
|
+
let [filePath, info] = each_array[$$index];
|
|
716
|
+
const hasBackup = !!(info.backupFileName && sessionId);
|
|
717
|
+
$$renderer2.push(`<li class="font-mono text-xs truncate"${attr("title", maskHomePaths(filePath))}>`);
|
|
718
|
+
if (hasBackup) {
|
|
719
|
+
$$renderer2.push("<!--[-->");
|
|
720
|
+
$$renderer2.push(`<button class="text-gh-accent hover:underline cursor-pointer bg-transparent border-none p-0" title="Open backup in VS Code">${escape_html(maskHomePaths(filePath))}</button>`);
|
|
721
|
+
} else {
|
|
722
|
+
$$renderer2.push("<!--[!-->");
|
|
723
|
+
$$renderer2.push(`<span class="text-gh-text-secondary">${escape_html(maskHomePaths(filePath))}</span>`);
|
|
724
|
+
}
|
|
725
|
+
$$renderer2.push(`<!--]--></li>`);
|
|
726
|
+
}
|
|
727
|
+
$$renderer2.push(`<!--]--></ul></div>`);
|
|
728
|
+
} else {
|
|
729
|
+
$$renderer2.push("<!--[!-->");
|
|
730
|
+
if (isLocalCommand && commandData) {
|
|
731
|
+
$$renderer2.push("<!--[-->");
|
|
732
|
+
$$renderer2.push(`<div${attr("data-msg-id", msgId)} class="p-3 rounded-lg bg-cyan-500/10 border-l-3 border-l-cyan-500 group relative"><div class="flex justify-between items-center text-xs text-gh-text-secondary"><span class="font-semibold text-cyan-400">⚡ ${escape_html(commandData.name || "Command")}</span> <div class="flex items-center gap-2"><span>${escape_html(formatDate(msg.timestamp))}</span> `);
|
|
733
|
+
splitButton($$renderer2);
|
|
734
|
+
$$renderer2.push(`<!----> `);
|
|
735
|
+
deleteButton($$renderer2);
|
|
736
|
+
$$renderer2.push(`<!----></div></div> `);
|
|
737
|
+
if (commandData.message && commandData.message !== commandData.name?.slice(1)) {
|
|
738
|
+
$$renderer2.push("<!--[-->");
|
|
739
|
+
$$renderer2.push(`<p class="mt-1 text-sm text-gh-text-secondary">${escape_html(commandData.message)}</p>`);
|
|
740
|
+
} else {
|
|
741
|
+
$$renderer2.push("<!--[!-->");
|
|
742
|
+
}
|
|
743
|
+
$$renderer2.push(`<!--]--></div>`);
|
|
744
|
+
} else {
|
|
745
|
+
$$renderer2.push("<!--[!-->");
|
|
746
|
+
if (toolUseData) {
|
|
747
|
+
$$renderer2.push("<!--[-->");
|
|
748
|
+
$$renderer2.push(`<div${attr("data-msg-id", msgId)} class="p-3 rounded-lg bg-violet-500/10 border-l-3 border-l-violet-500 group relative"><div class="flex justify-between items-center text-xs text-gh-text-secondary"><span class="font-semibold text-violet-400">🔧 ${escape_html(toolUseData.name)}</span> <div class="flex items-center gap-2"><span>${escape_html(formatDate(msg.timestamp))}</span> `);
|
|
749
|
+
splitButton($$renderer2);
|
|
750
|
+
$$renderer2.push(`<!----> `);
|
|
751
|
+
deleteButton($$renderer2);
|
|
752
|
+
$$renderer2.push(`<!----></div></div> `);
|
|
753
|
+
if (toolUseData.filePath) {
|
|
754
|
+
$$renderer2.push("<!--[-->");
|
|
755
|
+
await_block(
|
|
756
|
+
$$renderer2,
|
|
757
|
+
checkFileExists(toolUseData.filePath),
|
|
758
|
+
() => {
|
|
759
|
+
$$renderer2.push(`<span class="mt-1 text-sm text-gh-text-secondary font-mono">${escape_html(toolUseData.filePath.split("/").pop())}</span>`);
|
|
760
|
+
},
|
|
761
|
+
(exists) => {
|
|
762
|
+
if (exists) {
|
|
763
|
+
$$renderer2.push("<!--[-->");
|
|
764
|
+
$$renderer2.push(`<button class="mt-1 text-sm text-gh-accent hover:underline cursor-pointer bg-transparent border-none p-0 font-mono truncate block max-w-full text-left"${attr("title", toolUseData.filePath)}>${escape_html(toolUseData.filePath.split("/").pop())}</button>`);
|
|
765
|
+
} else {
|
|
766
|
+
$$renderer2.push("<!--[!-->");
|
|
767
|
+
$$renderer2.push(`<span class="mt-1 text-sm text-gh-text-secondary font-mono"${attr("title", toolUseData.filePath)}>${escape_html(toolUseData.filePath.split("/").pop())}</span>`);
|
|
768
|
+
}
|
|
769
|
+
$$renderer2.push(`<!--]-->`);
|
|
770
|
+
}
|
|
771
|
+
);
|
|
772
|
+
$$renderer2.push(`<!--]-->`);
|
|
773
|
+
} else {
|
|
774
|
+
$$renderer2.push("<!--[!-->");
|
|
775
|
+
if (toolUseData.input.command) {
|
|
776
|
+
$$renderer2.push("<!--[-->");
|
|
777
|
+
if (toolUseData.input.description) {
|
|
778
|
+
$$renderer2.push("<!--[-->");
|
|
779
|
+
$$renderer2.push(`<p class="mt-1 text-sm text-gh-text-secondary">${escape_html(toolUseData.input.description)}</p>`);
|
|
780
|
+
} else {
|
|
781
|
+
$$renderer2.push("<!--[!-->");
|
|
782
|
+
}
|
|
783
|
+
$$renderer2.push(`<!--]--> `);
|
|
784
|
+
ExpandableContent($$renderer2, {
|
|
785
|
+
content: String(toolUseData.input.command),
|
|
786
|
+
lang: "sh",
|
|
787
|
+
maxLines: 3
|
|
788
|
+
});
|
|
789
|
+
$$renderer2.push(`<!---->`);
|
|
790
|
+
} else {
|
|
791
|
+
$$renderer2.push("<!--[!-->");
|
|
792
|
+
const { path: _path, ...input } = toolUseData.input;
|
|
793
|
+
const keys = Object.keys(input);
|
|
794
|
+
if (keys.length === 1) {
|
|
795
|
+
$$renderer2.push("<!--[-->");
|
|
796
|
+
const key = keys[0];
|
|
797
|
+
const value = input[key];
|
|
798
|
+
$$renderer2.push(`${escape_html((() => {
|
|
799
|
+
console.info(`${key} =`, value);
|
|
800
|
+
return "";
|
|
801
|
+
})())} `);
|
|
802
|
+
if (key === "todos" && Array.isArray(value)) {
|
|
803
|
+
$$renderer2.push("<!--[-->");
|
|
804
|
+
TodoItem($$renderer2, { todos: value });
|
|
805
|
+
} else {
|
|
806
|
+
$$renderer2.push("<!--[!-->");
|
|
807
|
+
ExpandableContent($$renderer2, {
|
|
808
|
+
content: `${key} = ${JSON.stringify(value, null, 2)}`,
|
|
809
|
+
lang: "js",
|
|
810
|
+
maxLines: 1
|
|
811
|
+
});
|
|
812
|
+
}
|
|
813
|
+
$$renderer2.push(`<!--]-->`);
|
|
814
|
+
} else {
|
|
815
|
+
$$renderer2.push("<!--[!-->");
|
|
816
|
+
ExpandableContent($$renderer2, {
|
|
817
|
+
content: JSON.stringify(input, null, 2),
|
|
818
|
+
lang: "json",
|
|
819
|
+
maxLines: 6
|
|
820
|
+
});
|
|
821
|
+
}
|
|
822
|
+
$$renderer2.push(`<!--]-->`);
|
|
823
|
+
}
|
|
824
|
+
$$renderer2.push(`<!--]-->`);
|
|
825
|
+
}
|
|
826
|
+
$$renderer2.push(`<!--]--></div>`);
|
|
827
|
+
} else {
|
|
828
|
+
$$renderer2.push("<!--[!-->");
|
|
829
|
+
if (hasAnyContent) {
|
|
830
|
+
$$renderer2.push("<!--[-->");
|
|
831
|
+
$$renderer2.push(`<div${attr("data-msg-id", msgId)}${attr_class(`p-4 rounded-lg group relative ${stringify(messageClass)} flex flex-col ${stringify(hasAnyContent ? "gap-2" : "")}`)}><div class="flex justify-between text-xs text-gh-text-secondary"><span class="uppercase font-semibold">${escape_html(isToolResult ? "OUT" : msg.type)}</span> <div class="flex items-center gap-2"><span class="group-hover:hidden">${escape_html(formatDate(msg.timestamp))}</span> <span class="hidden group-hover:inline font-mono text-gh-text-secondary/70">${escape_html(messageId)}</span> `);
|
|
832
|
+
if (isCustomTitle && onEditTitle) {
|
|
833
|
+
$$renderer2.push("<!--[-->");
|
|
834
|
+
$$renderer2.push(`<button class="opacity-0 group-hover:opacity-100 transition-opacity bg-transparent border-none cursor-pointer p-1 rounded hover:bg-gh-border text-xs" title="Edit title">✏️</button>`);
|
|
835
|
+
} else {
|
|
836
|
+
$$renderer2.push("<!--[!-->");
|
|
837
|
+
}
|
|
838
|
+
$$renderer2.push(`<!--]--> `);
|
|
839
|
+
splitButton($$renderer2);
|
|
840
|
+
$$renderer2.push(`<!----> `);
|
|
841
|
+
deleteButton($$renderer2);
|
|
842
|
+
$$renderer2.push(`<!----></div></div> `);
|
|
843
|
+
if (thinkingBlocks.length > 0) {
|
|
844
|
+
$$renderer2.push("<!--[-->");
|
|
845
|
+
$$renderer2.push(`<div class="message-content text-sm"><!--[-->`);
|
|
846
|
+
const each_array_1 = ensure_array_like(thinkingBlocks);
|
|
847
|
+
for (let i = 0, $$length = each_array_1.length; i < $$length; i++) {
|
|
848
|
+
let block = each_array_1[i];
|
|
849
|
+
$$renderer2.push(`<details class="text-gh-text-secondary"><summary class="cursor-pointer text-xs italic hover:text-gh-text select-none">💭 Thinking ${escape_html(thinkingBlocks.length > 1 ? `(${i + 1}/${thinkingBlocks.length})` : "")}</summary> <p class="mt-1 whitespace-pre-wrap italic opacity-70">${escape_html(block.thinking)}</p></details>`);
|
|
850
|
+
}
|
|
851
|
+
$$renderer2.push(`<!--]--></div>`);
|
|
852
|
+
} else {
|
|
853
|
+
$$renderer2.push("<!--[!-->");
|
|
854
|
+
}
|
|
855
|
+
$$renderer2.push(`<!--]--> `);
|
|
856
|
+
if (hasContent) {
|
|
857
|
+
$$renderer2.push("<!--[-->");
|
|
858
|
+
$$renderer2.push(`<div class="message-content text-sm">`);
|
|
859
|
+
if (isCustomTitle) {
|
|
860
|
+
$$renderer2.push("<!--[-->");
|
|
861
|
+
$$renderer2.push(`<span class="font-semibold text-purple-400">${escape_html(customTitle)}</span>`);
|
|
862
|
+
} else {
|
|
863
|
+
$$renderer2.push("<!--[!-->");
|
|
864
|
+
const msgContent = getMessageContent(msg);
|
|
865
|
+
const segments = parseIdeTags(msgContent);
|
|
866
|
+
$$renderer2.push(`<!--[-->`);
|
|
867
|
+
const each_array_2 = ensure_array_like(segments);
|
|
868
|
+
for (let $$index_2 = 0, $$length = each_array_2.length; $$index_2 < $$length; $$index_2++) {
|
|
869
|
+
let segment = each_array_2[$$index_2];
|
|
870
|
+
if (segment.type === "ide_tag" && segment.tag) {
|
|
871
|
+
$$renderer2.push("<!--[-->");
|
|
872
|
+
IdeTag($$renderer2, { tag: segment.tag, content: segment.content });
|
|
873
|
+
} else {
|
|
874
|
+
$$renderer2.push("<!--[!-->");
|
|
875
|
+
const textLines = segment.content.split("\n");
|
|
876
|
+
if (textLines.length > 10) {
|
|
877
|
+
$$renderer2.push("<!--[-->");
|
|
878
|
+
ExpandableContent($$renderer2, { content: segment.content, maxLines: 10 });
|
|
879
|
+
} else {
|
|
880
|
+
$$renderer2.push("<!--[!-->");
|
|
881
|
+
$$renderer2.push(`<p class="whitespace-pre-wrap">${escape_html(segment.content)}</p>`);
|
|
882
|
+
}
|
|
883
|
+
$$renderer2.push(`<!--]-->`);
|
|
884
|
+
}
|
|
885
|
+
$$renderer2.push(`<!--]-->`);
|
|
886
|
+
}
|
|
887
|
+
$$renderer2.push(`<!--]-->`);
|
|
888
|
+
}
|
|
889
|
+
$$renderer2.push(`<!--]--></div>`);
|
|
890
|
+
} else {
|
|
891
|
+
$$renderer2.push("<!--[!-->");
|
|
892
|
+
}
|
|
893
|
+
$$renderer2.push(`<!--]--></div>`);
|
|
894
|
+
} else {
|
|
895
|
+
$$renderer2.push("<!--[!-->");
|
|
896
|
+
}
|
|
897
|
+
$$renderer2.push(`<!--]-->`);
|
|
898
|
+
}
|
|
899
|
+
$$renderer2.push(`<!--]-->`);
|
|
900
|
+
}
|
|
901
|
+
$$renderer2.push(`<!--]-->`);
|
|
902
|
+
}
|
|
903
|
+
$$renderer2.push(`<!--]-->`);
|
|
904
|
+
}
|
|
905
|
+
$$renderer2.push(`<!--]-->`);
|
|
906
|
+
});
|
|
907
|
+
}
|
|
908
|
+
function ScrollButtons($$renderer, $$props) {
|
|
909
|
+
$$renderer.component(($$renderer2) => {
|
|
910
|
+
let { messages, class: className = "" } = $$props;
|
|
911
|
+
const buttonClass = "p-1.5 text-sm rounded border border-gh-border hover:bg-gh-border-subtle text-gh-text-secondary hover:text-gh-text transition-colors bg-gh-bg";
|
|
912
|
+
if (messages.length > 0) {
|
|
913
|
+
$$renderer2.push("<!--[-->");
|
|
914
|
+
$$renderer2.push(`<div${attr_class(`flex gap-0.5 ${stringify(className)}`, "svelte-12kovyu")}><button${attr_class(`nav-btn ${stringify(buttonClass)}`, "svelte-12kovyu")}><svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 11l7-7 7 7M5 19l7-7 7 7"></path></svg> <span class="tooltip svelte-12kovyu">Top</span></button> <button${attr_class(`nav-btn ${stringify(buttonClass)}`, "svelte-12kovyu")}><svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 15l7-7 7 7"></path></svg> <span class="tooltip svelte-12kovyu">Previous user message</span></button> `);
|
|
915
|
+
{
|
|
916
|
+
$$renderer2.push("<!--[!-->");
|
|
917
|
+
}
|
|
918
|
+
$$renderer2.push(`<!--]--> <button${attr_class(`nav-btn ${stringify(buttonClass)}`, "svelte-12kovyu")}><svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 9l7 7 7-7"></path></svg> <span class="tooltip svelte-12kovyu">Next user message</span></button> <button${attr_class(`nav-btn ${stringify(buttonClass)}`, "svelte-12kovyu")}><svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 5l7 7 7-7M5 13l7 7 7-7"></path></svg> <span class="tooltip svelte-12kovyu">Bottom</span></button></div>`);
|
|
919
|
+
} else {
|
|
920
|
+
$$renderer2.push("<!--[!-->");
|
|
921
|
+
}
|
|
922
|
+
$$renderer2.push(`<!--]-->`);
|
|
923
|
+
});
|
|
924
|
+
}
|
|
925
|
+
function SessionViewer($$renderer, $$props) {
|
|
926
|
+
$$renderer.component(($$renderer2) => {
|
|
927
|
+
let {
|
|
928
|
+
session,
|
|
929
|
+
messages,
|
|
930
|
+
todos = [],
|
|
931
|
+
agents = [],
|
|
932
|
+
customTitle,
|
|
933
|
+
currentSummary,
|
|
934
|
+
backUrl,
|
|
935
|
+
onEditTitle,
|
|
936
|
+
onSplitSession,
|
|
937
|
+
enableScroll = true,
|
|
938
|
+
fullWidth = false
|
|
939
|
+
} = $$props;
|
|
940
|
+
const displayTitle = getDisplayTitle(customTitle, currentSummary, session?.title, 50);
|
|
941
|
+
let activeTab = "messages";
|
|
942
|
+
let undoStack = [];
|
|
943
|
+
let undoCountdown = 0;
|
|
944
|
+
const firstMeaningfulIndex = messages.findIndex((m) => m.type === "user" || m.type === "assistant" || m.type === "human");
|
|
945
|
+
$$renderer2.push(`<section${attr_class(`bg-gh-bg-secondary overflow-hidden flex flex-col h-full ${stringify(fullWidth ? "" : "border border-gh-border rounded-lg")}`)}><div class="p-4 border-b border-gh-border bg-gh-bg flex flex-wrap justify-between items-start gap-2">`);
|
|
946
|
+
if (backUrl) {
|
|
947
|
+
$$renderer2.push("<!--[-->");
|
|
948
|
+
$$renderer2.push(`<a${attr("href", backUrl)} class="text-gh-muted hover:text-gh-fg flex-shrink-0" title="Back to project"><svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18"></path></svg></a>`);
|
|
949
|
+
} else {
|
|
950
|
+
$$renderer2.push("<!--[!-->");
|
|
951
|
+
}
|
|
952
|
+
$$renderer2.push(`<!--]--> <div class="flex-1 min-w-[200px]">`);
|
|
953
|
+
if (session) {
|
|
954
|
+
$$renderer2.push("<!--[-->");
|
|
955
|
+
$$renderer2.push(`<h2 class="text-base font-semibold">${escape_html(truncate(displayTitle, 50))}</h2> <button class="text-xs text-gh-text-secondary font-mono mt-1 hover:text-gh-accent hover:underline cursor-pointer bg-transparent border-none p-0 text-left" title="Open session file in VSCode">${escape_html(session.id)}</button>`);
|
|
956
|
+
} else {
|
|
957
|
+
$$renderer2.push("<!--[!-->");
|
|
958
|
+
$$renderer2.push(`<h2 class="text-base font-semibold">Messages</h2>`);
|
|
959
|
+
}
|
|
960
|
+
$$renderer2.push(`<!--]--></div> `);
|
|
961
|
+
{
|
|
962
|
+
$$renderer2.push("<!--[-->");
|
|
963
|
+
ScrollButtons($$renderer2, { messages });
|
|
964
|
+
}
|
|
965
|
+
$$renderer2.push(`<!--]--></div> `);
|
|
966
|
+
if (session) {
|
|
967
|
+
$$renderer2.push("<!--[-->");
|
|
968
|
+
$$renderer2.push(`<div class="flex border-b border-gh-border bg-gh-bg overflow-x-auto"><div class="flex-1 flex justify-center"><button${attr_class(`px-4 py-2 text-sm font-medium transition-colors whitespace-nowrap ${stringify(
|
|
969
|
+
"text-gh-accent border-b-2 border-gh-accent"
|
|
970
|
+
)}`)}>💬 Messages (${escape_html(messages.length)})</button> <!--[-->`);
|
|
971
|
+
const each_array = ensure_array_like(agents);
|
|
972
|
+
for (let $$index = 0, $$length = each_array.length; $$index < $$length; $$index++) {
|
|
973
|
+
let agent = each_array[$$index];
|
|
974
|
+
$$renderer2.push(`<button${attr_class(`px-4 py-2 text-sm font-medium transition-colors whitespace-nowrap ${stringify(activeTab === `agent:${agent.id}` ? "text-gh-accent border-b-2 border-gh-accent" : "text-gh-text-secondary hover:text-gh-text hover:bg-gh-border-subtle")}`)}>🤖 <span class="hidden md:inline">${escape_html(agent.id)}</span><span class="md:hidden">${escape_html(agent.id.replace("agent-", ""))}</span> (${escape_html(agent.messageCount)})</button>`);
|
|
975
|
+
}
|
|
976
|
+
$$renderer2.push(`<!--]--></div> `);
|
|
977
|
+
if (todos.length > 0) {
|
|
978
|
+
$$renderer2.push("<!--[-->");
|
|
979
|
+
$$renderer2.push(`<button${attr_class(`px-4 py-2 text-sm font-medium transition-colors whitespace-nowrap ${stringify("text-gh-text-secondary hover:text-gh-text hover:bg-gh-border-subtle")}`)}>✅ Todos (${escape_html(todos.length)})</button>`);
|
|
980
|
+
} else {
|
|
981
|
+
$$renderer2.push("<!--[!-->");
|
|
982
|
+
}
|
|
983
|
+
$$renderer2.push(`<!--]--></div>`);
|
|
984
|
+
} else {
|
|
985
|
+
$$renderer2.push("<!--[!-->");
|
|
986
|
+
}
|
|
987
|
+
$$renderer2.push(`<!--]--> <div${attr_class(`flex-1 ${stringify(enableScroll ? "overflow-y-auto" : "")}`)}>`);
|
|
988
|
+
if (!session) {
|
|
989
|
+
$$renderer2.push("<!--[-->");
|
|
990
|
+
$$renderer2.push(`<div class="flex items-center justify-center h-full text-gh-text-secondary">Select a session to view</div>`);
|
|
991
|
+
} else {
|
|
992
|
+
$$renderer2.push("<!--[!-->");
|
|
993
|
+
{
|
|
994
|
+
$$renderer2.push("<!--[-->");
|
|
995
|
+
if (messages.length === 0) {
|
|
996
|
+
$$renderer2.push("<!--[-->");
|
|
997
|
+
$$renderer2.push(`<div class="flex items-center justify-center h-full text-gh-text-secondary">No messages</div>`);
|
|
998
|
+
} else {
|
|
999
|
+
$$renderer2.push("<!--[!-->");
|
|
1000
|
+
$$renderer2.push(`<div class="p-4 flex flex-col gap-4"><!--[-->`);
|
|
1001
|
+
const each_array_1 = ensure_array_like(messages);
|
|
1002
|
+
for (let i = 0, $$length = each_array_1.length; i < $$length; i++) {
|
|
1003
|
+
let msg = each_array_1[i];
|
|
1004
|
+
MessageItem($$renderer2, {
|
|
1005
|
+
msg,
|
|
1006
|
+
sessionId: session?.id ?? "",
|
|
1007
|
+
onEditTitle,
|
|
1008
|
+
onSplit: onSplitSession,
|
|
1009
|
+
isFirst: i === firstMeaningfulIndex
|
|
1010
|
+
});
|
|
1011
|
+
}
|
|
1012
|
+
$$renderer2.push(`<!--]--></div>`);
|
|
1013
|
+
}
|
|
1014
|
+
$$renderer2.push(`<!--]-->`);
|
|
1015
|
+
}
|
|
1016
|
+
$$renderer2.push(`<!--]-->`);
|
|
1017
|
+
}
|
|
1018
|
+
$$renderer2.push(`<!--]--></div> `);
|
|
1019
|
+
if (undoStack.length > 0) {
|
|
1020
|
+
$$renderer2.push("<!--[-->");
|
|
1021
|
+
$$renderer2.push(`<div class="fixed bottom-4 left-1/2 -translate-x-1/2 bg-neutral-500/20 border border-neutral-600 rounded-lg shadow-2xl px-4 py-3 flex items-center gap-4 z-50 backdrop-blur-sm"><span class="text-sm text-white">${escape_html(undoStack.length === 1 ? "Message deleted" : `${undoStack.length} messages deleted`)}</span> <span class="text-xs text-gh-text-secondary tabular-nums">${escape_html(undoCountdown)}s</span> <button class="px-3 py-1 text-sm font-medium text-gh-accent hover:bg-gh-border-subtle rounded transition-colors">Undo</button> <button class="px-2 py-1 text-sm text-gh-text-secondary hover:text-gh-text hover:bg-gh-border-subtle rounded transition-colors" title="Dismiss (already deleted)">✕</button></div>`);
|
|
1022
|
+
} else {
|
|
1023
|
+
$$renderer2.push("<!--[!-->");
|
|
1024
|
+
}
|
|
1025
|
+
$$renderer2.push(`<!--]--></section>`);
|
|
1026
|
+
});
|
|
1027
|
+
}
|
|
1028
|
+
function _page($$renderer, $$props) {
|
|
1029
|
+
$$renderer.component(($$renderer2) => {
|
|
1030
|
+
let projects = [];
|
|
1031
|
+
let projectSessions = /* @__PURE__ */ new Map();
|
|
1032
|
+
let projectSessionData = /* @__PURE__ */ new Map();
|
|
1033
|
+
let expandedProjects = /* @__PURE__ */ new Set();
|
|
1034
|
+
let selectedSession = null;
|
|
1035
|
+
let messages = [];
|
|
1036
|
+
let todos = [];
|
|
1037
|
+
let agents = [];
|
|
1038
|
+
let loading = false;
|
|
1039
|
+
let loadingProject = null;
|
|
1040
|
+
let error = null;
|
|
1041
|
+
let toast = null;
|
|
1042
|
+
const updateHash = (project, session) => {
|
|
1043
|
+
return;
|
|
1044
|
+
};
|
|
1045
|
+
const handleDeleteSession = async (e, session) => {
|
|
1046
|
+
e.stopPropagation();
|
|
1047
|
+
if (!confirm(`Delete session "${session.title}"?`)) return;
|
|
1048
|
+
try {
|
|
1049
|
+
await deleteSession(session.projectName, session.id);
|
|
1050
|
+
const sessions = projectSessions.get(session.projectName);
|
|
1051
|
+
if (sessions) {
|
|
1052
|
+
projectSessions.set(session.projectName, sessions.filter((s) => s.id !== session.id));
|
|
1053
|
+
projectSessions = new Map(projectSessions);
|
|
1054
|
+
}
|
|
1055
|
+
if (selectedSession?.id === session.id) {
|
|
1056
|
+
selectedSession = null;
|
|
1057
|
+
messages = [];
|
|
1058
|
+
updateHash(session.projectName);
|
|
1059
|
+
}
|
|
1060
|
+
} catch (e2) {
|
|
1061
|
+
error = String(e2);
|
|
1062
|
+
}
|
|
1063
|
+
};
|
|
1064
|
+
const handleRenameSession = async (e, session) => {
|
|
1065
|
+
e.stopPropagation();
|
|
1066
|
+
const sessionData = projectSessionData.get(session.projectName)?.get(session.id);
|
|
1067
|
+
const currentTitle = getDisplayTitle(sessionData?.customTitle, sessionData?.currentSummary, session.title, Infinity, "");
|
|
1068
|
+
const newTitle = prompt("Enter session title:\n(Sets custom-title for CLI, first summary for VSCode extension)", currentTitle);
|
|
1069
|
+
if (newTitle === null) return;
|
|
1070
|
+
try {
|
|
1071
|
+
await renameSession(session.projectName, session.id, newTitle);
|
|
1072
|
+
if (sessionData) {
|
|
1073
|
+
sessionData.customTitle = newTitle;
|
|
1074
|
+
sessionData.currentSummary = newTitle;
|
|
1075
|
+
if (sessionData.summaries.length > 0) {
|
|
1076
|
+
sessionData.summaries[0] = { ...sessionData.summaries[0], summary: newTitle };
|
|
1077
|
+
} else {
|
|
1078
|
+
sessionData.summaries = [{ summary: newTitle }];
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
projectSessions = new Map(projectSessions);
|
|
1082
|
+
projectSessionData = new Map(projectSessionData);
|
|
1083
|
+
if (selectedSession?.id === session.id) {
|
|
1084
|
+
messages = await getSession(session.projectName, session.id);
|
|
1085
|
+
}
|
|
1086
|
+
} catch (e2) {
|
|
1087
|
+
error = String(e2);
|
|
1088
|
+
}
|
|
1089
|
+
};
|
|
1090
|
+
const handleEditCustomTitle = async (msg) => {
|
|
1091
|
+
if (!selectedSession) return;
|
|
1092
|
+
const currentTitle = msg.customTitle ?? "";
|
|
1093
|
+
const newTitle = prompt("Enter new custom title:", currentTitle);
|
|
1094
|
+
if (newTitle === null || newTitle === currentTitle) return;
|
|
1095
|
+
try {
|
|
1096
|
+
await updateCustomTitle(selectedSession.projectName, selectedSession.id, msg.uuid, newTitle);
|
|
1097
|
+
msg.customTitle = newTitle;
|
|
1098
|
+
messages = [...messages];
|
|
1099
|
+
} catch (e) {
|
|
1100
|
+
error = String(e);
|
|
1101
|
+
}
|
|
1102
|
+
};
|
|
1103
|
+
const handleSplitSession = async (msg) => {
|
|
1104
|
+
if (!selectedSession) return;
|
|
1105
|
+
const msgIndex = messages.findIndex((m) => m.uuid === msg.uuid);
|
|
1106
|
+
const oldMessagesCount = msgIndex;
|
|
1107
|
+
const keptMessagesCount = messages.length - msgIndex;
|
|
1108
|
+
if (!confirm(`Split session at this message?
|
|
1109
|
+
|
|
1110
|
+
This session will keep ${keptMessagesCount} messages (from here onwards).
|
|
1111
|
+
Old messages (${oldMessagesCount}) will be moved to a new session.`)) return;
|
|
1112
|
+
const currentProjectName = selectedSession.projectName;
|
|
1113
|
+
const currentSessionId = selectedSession.id;
|
|
1114
|
+
try {
|
|
1115
|
+
loading = true;
|
|
1116
|
+
const result = await splitSession(currentProjectName, currentSessionId, msg.uuid);
|
|
1117
|
+
if (result.success && result.newSessionId) {
|
|
1118
|
+
const sessionDataList = await expandProject(currentProjectName);
|
|
1119
|
+
const sessions = [];
|
|
1120
|
+
const dataMap = /* @__PURE__ */ new Map();
|
|
1121
|
+
for (const data of sessionDataList) {
|
|
1122
|
+
sessions.push({
|
|
1123
|
+
id: data.id,
|
|
1124
|
+
projectName: currentProjectName,
|
|
1125
|
+
title: data.title,
|
|
1126
|
+
messageCount: data.messageCount,
|
|
1127
|
+
createdAt: data.createdAt,
|
|
1128
|
+
updatedAt: data.updatedAt
|
|
1129
|
+
});
|
|
1130
|
+
dataMap.set(data.id, data);
|
|
1131
|
+
}
|
|
1132
|
+
projectSessions.set(currentProjectName, sessions);
|
|
1133
|
+
projectSessions = new Map(projectSessions);
|
|
1134
|
+
projectSessionData.set(currentProjectName, dataMap);
|
|
1135
|
+
projectSessionData = new Map(projectSessionData);
|
|
1136
|
+
messages = messages.slice(msgIndex);
|
|
1137
|
+
const updatedSession = sessions.find((s) => s.id === currentSessionId);
|
|
1138
|
+
if (updatedSession) {
|
|
1139
|
+
updatedSession.messageCount = messages.length;
|
|
1140
|
+
selectedSession = { ...updatedSession };
|
|
1141
|
+
}
|
|
1142
|
+
toast = `Session split! Old messages moved to new session: ${result.newSessionId.slice(0, 8)}...`;
|
|
1143
|
+
} else {
|
|
1144
|
+
error = result.error ?? "Failed to split session";
|
|
1145
|
+
}
|
|
1146
|
+
} catch (e) {
|
|
1147
|
+
error = String(e);
|
|
1148
|
+
} finally {
|
|
1149
|
+
loading = false;
|
|
1150
|
+
}
|
|
1151
|
+
};
|
|
1152
|
+
const handleResumeSession = async (e, session) => {
|
|
1153
|
+
e.stopPropagation();
|
|
1154
|
+
try {
|
|
1155
|
+
const result = await resumeSession(session.projectName, session.id);
|
|
1156
|
+
if (result.success) {
|
|
1157
|
+
toast = `Claude session started (PID: ${result.pid})`;
|
|
1158
|
+
} else {
|
|
1159
|
+
error = result.error ?? "Failed to resume session";
|
|
1160
|
+
}
|
|
1161
|
+
} catch (e2) {
|
|
1162
|
+
error = String(e2);
|
|
1163
|
+
}
|
|
1164
|
+
};
|
|
1165
|
+
let $$settled = true;
|
|
1166
|
+
let $$inner_renderer;
|
|
1167
|
+
function $$render_inner($$renderer3) {
|
|
1168
|
+
$$renderer3.push(`<div class="grid grid-cols-[350px_1fr] gap-4 h-[calc(100vh-120px)]">`);
|
|
1169
|
+
ProjectTree($$renderer3, {
|
|
1170
|
+
projects,
|
|
1171
|
+
projectSessions,
|
|
1172
|
+
projectSessionData,
|
|
1173
|
+
expandedProjects,
|
|
1174
|
+
selectedSession,
|
|
1175
|
+
loadingProject,
|
|
1176
|
+
onRenameSession: handleRenameSession,
|
|
1177
|
+
onDeleteSession: handleDeleteSession,
|
|
1178
|
+
onResumeSession: handleResumeSession
|
|
1179
|
+
});
|
|
1180
|
+
$$renderer3.push(`<!----> `);
|
|
1181
|
+
SessionViewer($$renderer3, {
|
|
1182
|
+
session: selectedSession,
|
|
1183
|
+
messages,
|
|
1184
|
+
todos,
|
|
1185
|
+
agents,
|
|
1186
|
+
customTitle: selectedSession ? projectSessionData.get(selectedSession.projectName)?.get(selectedSession.id)?.customTitle : void 0,
|
|
1187
|
+
currentSummary: selectedSession ? projectSessionData.get(selectedSession.projectName)?.get(selectedSession.id)?.currentSummary : void 0,
|
|
1188
|
+
onEditTitle: handleEditCustomTitle,
|
|
1189
|
+
onSplitSession: handleSplitSession
|
|
1190
|
+
});
|
|
1191
|
+
$$renderer3.push(`<!----></div> `);
|
|
1192
|
+
if (loading) {
|
|
1193
|
+
$$renderer3.push("<!--[-->");
|
|
1194
|
+
$$renderer3.push(`<div class="fixed bottom-4 right-4 bg-gh-accent text-white px-4 py-2 rounded">Loading...</div>`);
|
|
1195
|
+
} else {
|
|
1196
|
+
$$renderer3.push("<!--[!-->");
|
|
1197
|
+
}
|
|
1198
|
+
$$renderer3.push(`<!--]--> `);
|
|
1199
|
+
if (error) {
|
|
1200
|
+
$$renderer3.push("<!--[-->");
|
|
1201
|
+
$$renderer3.push(`<div class="fixed bottom-4 right-4 bg-gh-red text-white px-4 py-2 rounded">${escape_html(error)}</div>`);
|
|
1202
|
+
} else {
|
|
1203
|
+
$$renderer3.push("<!--[!-->");
|
|
1204
|
+
}
|
|
1205
|
+
$$renderer3.push(`<!--]--> `);
|
|
1206
|
+
Toast($$renderer3, {
|
|
1207
|
+
get message() {
|
|
1208
|
+
return toast;
|
|
1209
|
+
},
|
|
1210
|
+
set message($$value) {
|
|
1211
|
+
toast = $$value;
|
|
1212
|
+
$$settled = false;
|
|
1213
|
+
}
|
|
1214
|
+
});
|
|
1215
|
+
$$renderer3.push(`<!---->`);
|
|
1216
|
+
}
|
|
1217
|
+
do {
|
|
1218
|
+
$$settled = true;
|
|
1219
|
+
$$inner_renderer = $$renderer2.copy();
|
|
1220
|
+
$$render_inner($$inner_renderer);
|
|
1221
|
+
} while (!$$settled);
|
|
1222
|
+
$$renderer2.subsume($$inner_renderer);
|
|
1223
|
+
});
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
export { _page as default };
|
|
1227
|
+
//# sourceMappingURL=_page.svelte-Bgd-L7N_.js.map
|