@claude-sessions/web 0.3.3 → 0.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/README.md +51 -0
  2. package/build/client/_app/immutable/assets/0.DYXbBCWs.css +1 -0
  3. package/build/client/_app/immutable/assets/0.DYXbBCWs.css.br +0 -0
  4. package/build/client/_app/immutable/assets/0.DYXbBCWs.css.gz +0 -0
  5. package/build/client/_app/immutable/chunks/{CzuOkoRV.js → BdX-57is.js} +1 -1
  6. package/build/client/_app/immutable/chunks/BdX-57is.js.br +0 -0
  7. package/build/client/_app/immutable/chunks/BdX-57is.js.gz +0 -0
  8. package/build/client/_app/immutable/chunks/BsiXkKmR.js +1 -0
  9. package/build/client/_app/immutable/chunks/BsiXkKmR.js.br +0 -0
  10. package/build/client/_app/immutable/chunks/BsiXkKmR.js.gz +0 -0
  11. package/build/client/_app/immutable/chunks/C68Ru4Jq.js +90 -0
  12. package/build/client/_app/immutable/chunks/C68Ru4Jq.js.br +0 -0
  13. package/build/client/_app/immutable/chunks/C68Ru4Jq.js.gz +0 -0
  14. package/build/client/_app/immutable/chunks/{HouQR_BO.js → HaThayHP.js} +1 -1
  15. package/build/client/_app/immutable/chunks/HaThayHP.js.br +0 -0
  16. package/build/client/_app/immutable/chunks/HaThayHP.js.gz +0 -0
  17. package/build/client/_app/immutable/chunks/fuY-CvTV.js +1 -0
  18. package/build/client/_app/immutable/chunks/fuY-CvTV.js.br +0 -0
  19. package/build/client/_app/immutable/chunks/fuY-CvTV.js.gz +0 -0
  20. package/build/client/_app/immutable/chunks/nUq5tIUU.js +2 -0
  21. package/build/client/_app/immutable/chunks/nUq5tIUU.js.br +0 -0
  22. package/build/client/_app/immutable/chunks/nUq5tIUU.js.gz +0 -0
  23. package/build/client/_app/immutable/chunks/pOdkXMWy.js +1 -0
  24. package/build/client/_app/immutable/chunks/pOdkXMWy.js.br +0 -0
  25. package/build/client/_app/immutable/chunks/pOdkXMWy.js.gz +0 -0
  26. package/build/client/_app/immutable/entry/app.qHc_uqht.js +2 -0
  27. package/build/client/_app/immutable/entry/app.qHc_uqht.js.br +0 -0
  28. package/build/client/_app/immutable/entry/app.qHc_uqht.js.gz +0 -0
  29. package/build/client/_app/immutable/entry/start.CMr0TC12.js +1 -0
  30. package/build/client/_app/immutable/entry/start.CMr0TC12.js.br +2 -0
  31. package/build/client/_app/immutable/entry/start.CMr0TC12.js.gz +0 -0
  32. package/build/client/_app/immutable/nodes/0.BJ_w-1Nt.js +1 -0
  33. package/build/client/_app/immutable/nodes/0.BJ_w-1Nt.js.br +0 -0
  34. package/build/client/_app/immutable/nodes/0.BJ_w-1Nt.js.gz +0 -0
  35. package/build/client/_app/immutable/nodes/1._FRxD68P.js +1 -0
  36. package/build/client/_app/immutable/nodes/1._FRxD68P.js.br +0 -0
  37. package/build/client/_app/immutable/nodes/1._FRxD68P.js.gz +0 -0
  38. package/build/client/_app/immutable/nodes/2.MZuWFdHT.js +4 -0
  39. package/build/client/_app/immutable/nodes/2.MZuWFdHT.js.br +0 -0
  40. package/build/client/_app/immutable/nodes/2.MZuWFdHT.js.gz +0 -0
  41. package/build/client/_app/immutable/nodes/3.B_st5yrl.js +4 -0
  42. package/build/client/_app/immutable/nodes/3.B_st5yrl.js.br +0 -0
  43. package/build/client/_app/immutable/nodes/3.B_st5yrl.js.gz +0 -0
  44. package/build/client/_app/version.json +1 -1
  45. package/build/client/_app/version.json.br +0 -0
  46. package/build/client/_app/version.json.gz +0 -0
  47. package/build/server/chunks/0-48UfwAoW.js +17 -0
  48. package/build/server/chunks/0-48UfwAoW.js.map +1 -0
  49. package/build/server/chunks/1-iKu9xlG-.js +9 -0
  50. package/build/server/chunks/{1-NzhdkXbT.js.map → 1-iKu9xlG-.js.map} +1 -1
  51. package/build/server/chunks/2-BnOskmnU.js +9 -0
  52. package/build/server/chunks/2-BnOskmnU.js.map +1 -0
  53. package/build/server/chunks/3-CxYJayeh.js +9 -0
  54. package/build/server/chunks/3-CxYJayeh.js.map +1 -0
  55. package/build/server/chunks/InputModal-XaplAR5y.js +36 -0
  56. package/build/server/chunks/InputModal-XaplAR5y.js.map +1 -0
  57. package/build/server/chunks/Toast-DctHqvip.js +80 -0
  58. package/build/server/chunks/Toast-DctHqvip.js.map +1 -0
  59. package/build/server/chunks/_layout.svelte-gA6iNIQM.js +105 -0
  60. package/build/server/chunks/_layout.svelte-gA6iNIQM.js.map +1 -0
  61. package/build/server/chunks/_page.svelte-CTdF2hwa.js +96 -0
  62. package/build/server/chunks/_page.svelte-CTdF2hwa.js.map +1 -0
  63. package/build/server/chunks/{_page.svelte-Bgd-L7N_.js → _page.svelte-g3nbsvo6.js} +612 -463
  64. package/build/server/chunks/_page.svelte-g3nbsvo6.js.map +1 -0
  65. package/build/server/chunks/{_server.ts-DZQssvoI.js → _server.ts-CDkvpI_I.js} +2 -2
  66. package/build/server/chunks/{_server.ts-DZQssvoI.js.map → _server.ts-CDkvpI_I.js.map} +1 -1
  67. package/build/server/chunks/{error.svelte-DNhMU_b6.js → error.svelte-C43AeaaJ.js} +4 -4
  68. package/build/server/chunks/{error.svelte-DNhMU_b6.js.map → error.svelte-C43AeaaJ.js.map} +1 -1
  69. package/build/server/chunks/{exports-CgQJUv15.js → exports-BXvEiaiv.js} +6 -6
  70. package/build/server/chunks/exports-BXvEiaiv.js.map +1 -0
  71. package/build/server/chunks/index-CoD1IJuy.js.map +1 -1
  72. package/build/server/chunks/{index-CMS8WiSi.js → index-DzYX9r1_.js} +4 -4
  73. package/build/server/chunks/index-DzYX9r1_.js.map +1 -0
  74. package/build/server/chunks/{index2-gtN4acH3.js → index2-Da0doXJY.js} +2 -2
  75. package/build/server/chunks/{index2-gtN4acH3.js.map → index2-Da0doXJY.js.map} +1 -1
  76. package/build/server/chunks/{index4-Cm9gf6zG.js → index4-BUZEWk-I.js} +3 -3
  77. package/build/server/chunks/{index4-Cm9gf6zG.js.map → index4-BUZEWk-I.js.map} +1 -1
  78. package/build/server/index.js +5 -11
  79. package/build/server/index.js.map +1 -1
  80. package/build/server/manifest.js +6 -6
  81. package/build/server/manifest.js.map +1 -1
  82. package/package.json +24 -11
  83. package/build/client/_app/immutable/assets/0.B2yA_bPQ.css +0 -1
  84. package/build/client/_app/immutable/assets/0.B2yA_bPQ.css.br +0 -0
  85. package/build/client/_app/immutable/assets/0.B2yA_bPQ.css.gz +0 -0
  86. package/build/client/_app/immutable/chunks/Bapp9IYO.js +0 -1
  87. package/build/client/_app/immutable/chunks/Bapp9IYO.js.br +0 -0
  88. package/build/client/_app/immutable/chunks/Bapp9IYO.js.gz +0 -0
  89. package/build/client/_app/immutable/chunks/BzTxzCCu.js +0 -1
  90. package/build/client/_app/immutable/chunks/BzTxzCCu.js.br +0 -0
  91. package/build/client/_app/immutable/chunks/BzTxzCCu.js.gz +0 -0
  92. package/build/client/_app/immutable/chunks/CUTXPORg.js +0 -1
  93. package/build/client/_app/immutable/chunks/CUTXPORg.js.br +0 -0
  94. package/build/client/_app/immutable/chunks/CUTXPORg.js.gz +0 -0
  95. package/build/client/_app/immutable/chunks/CzuOkoRV.js.br +0 -0
  96. package/build/client/_app/immutable/chunks/CzuOkoRV.js.gz +0 -0
  97. package/build/client/_app/immutable/chunks/DHCLGQT_.js +0 -1
  98. package/build/client/_app/immutable/chunks/DHCLGQT_.js.br +0 -0
  99. package/build/client/_app/immutable/chunks/DHCLGQT_.js.gz +0 -0
  100. package/build/client/_app/immutable/chunks/DUNnSDh5.js +0 -66
  101. package/build/client/_app/immutable/chunks/DUNnSDh5.js.br +0 -0
  102. package/build/client/_app/immutable/chunks/DUNnSDh5.js.gz +0 -0
  103. package/build/client/_app/immutable/chunks/Di6YbRZt.js +0 -2
  104. package/build/client/_app/immutable/chunks/Di6YbRZt.js.br +0 -0
  105. package/build/client/_app/immutable/chunks/Di6YbRZt.js.gz +0 -0
  106. package/build/client/_app/immutable/chunks/HouQR_BO.js.br +0 -0
  107. package/build/client/_app/immutable/chunks/HouQR_BO.js.gz +0 -0
  108. package/build/client/_app/immutable/chunks/IVrlObbe.js +0 -25
  109. package/build/client/_app/immutable/chunks/IVrlObbe.js.br +0 -0
  110. package/build/client/_app/immutable/chunks/IVrlObbe.js.gz +0 -0
  111. package/build/client/_app/immutable/entry/app.Dj3HhwA8.js +0 -2
  112. package/build/client/_app/immutable/entry/app.Dj3HhwA8.js.br +0 -0
  113. package/build/client/_app/immutable/entry/app.Dj3HhwA8.js.gz +0 -0
  114. package/build/client/_app/immutable/entry/start.DhjCZi9N.js +0 -1
  115. package/build/client/_app/immutable/entry/start.DhjCZi9N.js.br +0 -2
  116. package/build/client/_app/immutable/entry/start.DhjCZi9N.js.gz +0 -0
  117. package/build/client/_app/immutable/nodes/0.CAbelkQT.js +0 -1
  118. package/build/client/_app/immutable/nodes/0.CAbelkQT.js.br +0 -0
  119. package/build/client/_app/immutable/nodes/0.CAbelkQT.js.gz +0 -0
  120. package/build/client/_app/immutable/nodes/1.DYaH4O8k.js +0 -1
  121. package/build/client/_app/immutable/nodes/1.DYaH4O8k.js.br +0 -0
  122. package/build/client/_app/immutable/nodes/1.DYaH4O8k.js.gz +0 -0
  123. package/build/client/_app/immutable/nodes/2.VvV6w9cZ.js +0 -5
  124. package/build/client/_app/immutable/nodes/2.VvV6w9cZ.js.br +0 -0
  125. package/build/client/_app/immutable/nodes/2.VvV6w9cZ.js.gz +0 -0
  126. package/build/client/_app/immutable/nodes/3.D_uYLiIh.js +0 -4
  127. package/build/client/_app/immutable/nodes/3.D_uYLiIh.js.br +0 -0
  128. package/build/client/_app/immutable/nodes/3.D_uYLiIh.js.gz +0 -0
  129. package/build/server/chunks/0-CWHakFRJ.js +0 -17
  130. package/build/server/chunks/0-CWHakFRJ.js.map +0 -1
  131. package/build/server/chunks/1-NzhdkXbT.js +0 -9
  132. package/build/server/chunks/2-DrysGJ9C.js +0 -9
  133. package/build/server/chunks/2-DrysGJ9C.js.map +0 -1
  134. package/build/server/chunks/3-D4BIPCPc.js +0 -9
  135. package/build/server/chunks/3-D4BIPCPc.js.map +0 -1
  136. package/build/server/chunks/Toast-CTZhGpnd.js +0 -45
  137. package/build/server/chunks/Toast-CTZhGpnd.js.map +0 -1
  138. package/build/server/chunks/_layout.svelte-D9DyGgZM.js +0 -61
  139. package/build/server/chunks/_layout.svelte-D9DyGgZM.js.map +0 -1
  140. package/build/server/chunks/_page.svelte-Bgd-L7N_.js.map +0 -1
  141. package/build/server/chunks/_page.svelte-C7sseaTW.js +0 -56
  142. package/build/server/chunks/_page.svelte-C7sseaTW.js.map +0 -1
  143. package/build/server/chunks/config-DKyxRWWg.js +0 -20
  144. package/build/server/chunks/config-DKyxRWWg.js.map +0 -1
  145. package/build/server/chunks/exports-CgQJUv15.js.map +0 -1
  146. package/build/server/chunks/index-CMS8WiSi.js.map +0 -1
  147. package/readme.md +0 -47
@@ -1,7 +1,7 @@
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';
1
+ import { Y as escape_html, Z as is_array, _ as get_prototype_of, $ as object_prototype } from './index-DzYX9r1_.js';
2
+ import { T as Toast, C as ConfirmModal, f as formatProjectName, a as appConfig, t as truncate, b as formatDate, m as maskHomePath } from './Toast-DctHqvip.js';
3
+ import { I as InputModal } from './InputModal-XaplAR5y.js';
4
+ 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-Da0doXJY.js';
5
5
  import { t as sortProjects, u as getDisplayTitle } from './index3-DVZVsHMK.js';
6
6
  import 'marked';
7
7
  import 'fs';
@@ -133,6 +133,9 @@ const deleteSession = (project, id) => del(
133
133
  `/session?project=${encodeURIComponent(project)}&id=${encodeURIComponent(id)}`
134
134
  );
135
135
  const renameSession = (project, id, title) => post("/session/rename", { project, id, title });
136
+ const deleteMessage = (project, session, uuid) => del(
137
+ `/message?project=${encodeURIComponent(project)}&session=${encodeURIComponent(session)}&uuid=${encodeURIComponent(uuid)}`
138
+ );
136
139
  const updateCustomTitle = (project, session, uuid, customTitle) => patch(
137
140
  `/message?project=${encodeURIComponent(project)}&session=${encodeURIComponent(session)}&uuid=${encodeURIComponent(uuid)}`,
138
141
  { customTitle }
@@ -207,252 +210,6 @@ const parseIdeTags = (content) => {
207
210
  }
208
211
  return segments;
209
212
  };
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
213
  function ExpandableContent($$renderer, $$props) {
457
214
  $$renderer.component(($$renderer2) => {
458
215
  let { content, maxLines = 10, lang } = $$props;
@@ -608,16 +365,41 @@ function TodoItem($$renderer, $$props) {
608
365
  }
609
366
  $$renderer.push(`<!--]--></ul>`);
610
367
  }
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 ?? "";
368
+ function TooltipButton($$renderer, $$props) {
369
+ let {
370
+ title,
371
+ children,
372
+ position = "bottom",
373
+ class: className = "",
374
+ $$slots,
375
+ $$events,
376
+ ...buttonProps
377
+ } = $$props;
378
+ $$renderer.push(`<button${attributes(
379
+ {
380
+ class: `tooltip-btn ${stringify(className)}`,
381
+ ...buttonProps
382
+ },
383
+ "svelte-1yfjzin"
384
+ )}>`);
385
+ children($$renderer);
386
+ $$renderer.push(`<!----></button> `);
387
+ {
388
+ $$renderer.push("<!--[!-->");
389
+ }
390
+ $$renderer.push(`<!--]-->`);
391
+ }
392
+ function MessageItem($$renderer, $$props) {
393
+ $$renderer.component(($$renderer2) => {
394
+ let {
395
+ msg,
396
+ sessionId,
397
+ isFirst = false,
398
+ onDelete,
399
+ onEditTitle,
400
+ onSplit
401
+ } = $$props;
402
+ const msgId = msg.uuid ?? "";
621
403
  const isAssistant = msg.type === "assistant";
622
404
  const isCustomTitle = msg.type === "custom-title";
623
405
  const isFileSnapshot = msg.type === "file-history-snapshot";
@@ -690,14 +472,30 @@ function MessageItem($$renderer, $$props) {
690
472
  function splitButton($$renderer3) {
691
473
  if (onSplit && !isFirst && msg.uuid) {
692
474
  $$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>`);
475
+ TooltipButton($$renderer3, {
476
+ class: "opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-gh-accent/20 text-xs",
477
+ onclick: () => onSplit(msg),
478
+ title: "Split session from this message",
479
+ children: ($$renderer4) => {
480
+ $$renderer4.push(`<!---->✂️`);
481
+ },
482
+ $$slots: { default: true }
483
+ });
694
484
  } else {
695
485
  $$renderer3.push("<!--[!-->");
696
486
  }
697
487
  $$renderer3.push(`<!--]-->`);
698
488
  }
699
489
  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>`);
490
+ TooltipButton($$renderer3, {
491
+ class: "opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-gh-red/20 text-xs",
492
+ onclick: () => onDelete(msg),
493
+ title: "Delete message",
494
+ children: ($$renderer4) => {
495
+ $$renderer4.push(`<!---->🗑️`);
496
+ },
497
+ $$slots: { default: true }
498
+ });
701
499
  }
702
500
  if (isQueueOperation) {
703
501
  $$renderer2.push("<!--[-->");
@@ -752,157 +550,387 @@ function MessageItem($$renderer, $$props) {
752
550
  $$renderer2.push(`<!----></div></div> `);
753
551
  if (toolUseData.filePath) {
754
552
  $$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>`);
553
+ await_block(
554
+ $$renderer2,
555
+ checkFileExists(toolUseData.filePath),
556
+ () => {
557
+ $$renderer2.push(`<span class="mt-1 text-sm text-gh-text-secondary font-mono">${escape_html(toolUseData.filePath.split("/").pop())}</span>`);
558
+ },
559
+ (exists) => {
560
+ if (exists) {
561
+ $$renderer2.push("<!--[-->");
562
+ $$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>`);
563
+ } else {
564
+ $$renderer2.push("<!--[!-->");
565
+ $$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>`);
566
+ }
567
+ $$renderer2.push(`<!--]-->`);
568
+ }
569
+ );
570
+ $$renderer2.push(`<!--]-->`);
571
+ } else {
572
+ $$renderer2.push("<!--[!-->");
573
+ if (toolUseData.input.command) {
574
+ $$renderer2.push("<!--[-->");
575
+ if (toolUseData.input.description) {
576
+ $$renderer2.push("<!--[-->");
577
+ $$renderer2.push(`<p class="mt-1 text-sm text-gh-text-secondary">${escape_html(toolUseData.input.description)}</p>`);
578
+ } else {
579
+ $$renderer2.push("<!--[!-->");
580
+ }
581
+ $$renderer2.push(`<!--]--> `);
582
+ ExpandableContent($$renderer2, {
583
+ content: String(toolUseData.input.command),
584
+ lang: "sh",
585
+ maxLines: 3
586
+ });
587
+ $$renderer2.push(`<!---->`);
588
+ } else {
589
+ $$renderer2.push("<!--[!-->");
590
+ const { path: _path, ...input } = toolUseData.input;
591
+ const keys = Object.keys(input);
592
+ if (keys.length === 1) {
593
+ $$renderer2.push("<!--[-->");
594
+ const key = keys[0];
595
+ const value = input[key];
596
+ $$renderer2.push(`${escape_html((() => {
597
+ console.info(`${key} =`, value);
598
+ return "";
599
+ })())} `);
600
+ if (key === "todos" && Array.isArray(value)) {
601
+ $$renderer2.push("<!--[-->");
602
+ TodoItem($$renderer2, { todos: value });
603
+ } else {
604
+ $$renderer2.push("<!--[!-->");
605
+ ExpandableContent($$renderer2, {
606
+ content: `${key} = ${JSON.stringify(value, null, 2)}`,
607
+ lang: "js",
608
+ maxLines: 1
609
+ });
610
+ }
611
+ $$renderer2.push(`<!--]-->`);
612
+ } else {
613
+ $$renderer2.push("<!--[!-->");
614
+ ExpandableContent($$renderer2, {
615
+ content: JSON.stringify(input, null, 2),
616
+ lang: "json",
617
+ maxLines: 6
618
+ });
619
+ }
620
+ $$renderer2.push(`<!--]-->`);
621
+ }
622
+ $$renderer2.push(`<!--]-->`);
623
+ }
624
+ $$renderer2.push(`<!--]--></div>`);
625
+ } else {
626
+ $$renderer2.push("<!--[!-->");
627
+ if (hasAnyContent) {
628
+ $$renderer2.push("<!--[-->");
629
+ $$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> `);
630
+ if (isCustomTitle && onEditTitle) {
631
+ $$renderer2.push("<!--[-->");
632
+ TooltipButton($$renderer2, {
633
+ class: "opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-gh-border text-xs",
634
+ onclick: () => onEditTitle(msg),
635
+ title: "Edit title",
636
+ children: ($$renderer3) => {
637
+ $$renderer3.push(`<!---->✏️`);
638
+ },
639
+ $$slots: { default: true }
640
+ });
641
+ } else {
642
+ $$renderer2.push("<!--[!-->");
643
+ }
644
+ $$renderer2.push(`<!--]--> `);
645
+ splitButton($$renderer2);
646
+ $$renderer2.push(`<!----> `);
647
+ deleteButton($$renderer2);
648
+ $$renderer2.push(`<!----></div></div> `);
649
+ if (thinkingBlocks.length > 0) {
650
+ $$renderer2.push("<!--[-->");
651
+ $$renderer2.push(`<div class="message-content text-sm"><!--[-->`);
652
+ const each_array_1 = ensure_array_like(thinkingBlocks);
653
+ for (let i = 0, $$length = each_array_1.length; i < $$length; i++) {
654
+ let block = each_array_1[i];
655
+ $$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>`);
656
+ }
657
+ $$renderer2.push(`<!--]--></div>`);
658
+ } else {
659
+ $$renderer2.push("<!--[!-->");
660
+ }
661
+ $$renderer2.push(`<!--]--> `);
662
+ if (hasContent) {
663
+ $$renderer2.push("<!--[-->");
664
+ $$renderer2.push(`<div class="message-content text-sm">`);
665
+ if (isCustomTitle) {
666
+ $$renderer2.push("<!--[-->");
667
+ $$renderer2.push(`<span class="font-semibold text-purple-400">${escape_html(customTitle)}</span>`);
668
+ } else {
669
+ $$renderer2.push("<!--[!-->");
670
+ const msgContent = getMessageContent(msg);
671
+ const segments = parseIdeTags(msgContent);
672
+ $$renderer2.push(`<!--[-->`);
673
+ const each_array_2 = ensure_array_like(segments);
674
+ for (let $$index_2 = 0, $$length = each_array_2.length; $$index_2 < $$length; $$index_2++) {
675
+ let segment = each_array_2[$$index_2];
676
+ if (segment.type === "ide_tag" && segment.tag) {
677
+ $$renderer2.push("<!--[-->");
678
+ IdeTag($$renderer2, { tag: segment.tag, content: segment.content });
679
+ } else {
680
+ $$renderer2.push("<!--[!-->");
681
+ const textLines = segment.content.split("\n");
682
+ if (textLines.length > 10) {
683
+ $$renderer2.push("<!--[-->");
684
+ ExpandableContent($$renderer2, { content: segment.content, maxLines: 10 });
685
+ } else {
686
+ $$renderer2.push("<!--[!-->");
687
+ $$renderer2.push(`<p class="whitespace-pre-wrap">${escape_html(segment.content)}</p>`);
688
+ }
689
+ $$renderer2.push(`<!--]-->`);
690
+ }
691
+ $$renderer2.push(`<!--]-->`);
692
+ }
693
+ $$renderer2.push(`<!--]-->`);
694
+ }
695
+ $$renderer2.push(`<!--]--></div>`);
696
+ } else {
697
+ $$renderer2.push("<!--[!-->");
698
+ }
699
+ $$renderer2.push(`<!--]--></div>`);
700
+ } else {
701
+ $$renderer2.push("<!--[!-->");
702
+ }
703
+ $$renderer2.push(`<!--]-->`);
704
+ }
705
+ $$renderer2.push(`<!--]-->`);
706
+ }
707
+ $$renderer2.push(`<!--]-->`);
708
+ }
709
+ $$renderer2.push(`<!--]-->`);
710
+ }
711
+ $$renderer2.push(`<!--]-->`);
712
+ });
713
+ }
714
+ function ProjectTree($$renderer, $$props) {
715
+ $$renderer.component(($$renderer2) => {
716
+ var $$store_subs;
717
+ let {
718
+ projects,
719
+ projectSessions,
720
+ projectSessionData,
721
+ expandedProjects,
722
+ selectedSession,
723
+ loadingProject,
724
+ onRenameSession,
725
+ onDeleteSession,
726
+ onResumeSession
727
+ } = $$props;
728
+ const getSessionData = (projectName, sessionId) => {
729
+ return projectSessionData.get(projectName)?.get(sessionId);
730
+ };
731
+ const getDisplayTitle2 = (session) => {
732
+ const data = getSessionData(session.projectName, session.id);
733
+ if (data?.customTitle) return data.customTitle;
734
+ if (data?.currentSummary) {
735
+ const summary = data.currentSummary;
736
+ return summary.length > 60 ? summary.slice(0, 57) + "..." : summary;
737
+ }
738
+ if (session.title && session.title !== "Untitled") return session.title;
739
+ return "Untitled";
740
+ };
741
+ const getTooltipText = (session) => {
742
+ const data = getSessionData(session.projectName, session.id);
743
+ if (data?.customTitle && data?.currentSummary) {
744
+ return data.currentSummary;
745
+ }
746
+ if (data?.currentSummary && session.title && session.title !== "Untitled") {
747
+ return session.title;
748
+ }
749
+ if (data?.currentSummary) {
750
+ return data.currentSummary;
751
+ }
752
+ return session.title ?? "No summary available";
753
+ };
754
+ const getSessionInfo = (session) => {
755
+ const data = getSessionData(session.projectName, session.id);
756
+ const todoCount = data?.todos ? data.todos.sessionTodos.length + data.todos.agentTodos.reduce((acc, at) => acc + at.todos.length, 0) : 0;
757
+ return {
758
+ agents: data?.agents.length ?? 0,
759
+ todos: todoCount,
760
+ summaries: data?.summaries.length ?? 0
761
+ };
762
+ };
763
+ const sortedProjects = sortProjects(projects, {
764
+ currentProjectName: store_get($$store_subs ??= {}, "$appConfig", appConfig).currentProjectName,
765
+ homeDir: store_get($$store_subs ??= {}, "$appConfig", appConfig).homeDir
766
+ });
767
+ let expandedSessions = selectedSession ? /* @__PURE__ */ new Set([selectedSession.id]) : /* @__PURE__ */ new Set();
768
+ let draggedSession = null;
769
+ let dropTargetProject = null;
770
+ $$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"><!--[-->`);
771
+ const each_array = ensure_array_like(sortedProjects);
772
+ for (let $$index_4 = 0, $$length = each_array.length; $$index_4 < $$length; $$index_4++) {
773
+ let project = each_array[$$index_4];
774
+ const isDropTarget = dropTargetProject === project.name;
775
+ $$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> `);
776
+ if (expandedProjects.has(project.name)) {
777
+ $$renderer2.push("<!--[-->");
778
+ $$renderer2.push(`<ul class="bg-gh-bg">`);
779
+ if (loadingProject === project.name) {
780
+ $$renderer2.push("<!--[-->");
781
+ $$renderer2.push(`<li class="py-2 px-8 text-gh-text-secondary text-sm">Loading...</li>`);
782
+ } else {
783
+ $$renderer2.push("<!--[!-->");
784
+ $$renderer2.push(`<!--[-->`);
785
+ const each_array_1 = ensure_array_like(projectSessions.get(project.name) ?? []);
786
+ for (let $$index_3 = 0, $$length2 = each_array_1.length; $$index_3 < $$length2; $$index_3++) {
787
+ let session = each_array_1[$$index_3];
788
+ const isSelected = selectedSession?.id === session.id;
789
+ const isDragging = draggedSession?.id === session.id;
790
+ const sessionInfo = getSessionInfo(session);
791
+ const displayTitle = getDisplayTitle2(session);
792
+ const tooltipText = getTooltipText(session);
793
+ const data = getSessionData(session.projectName, session.id);
794
+ const isSummaryFallback = !data?.customTitle && !data?.currentSummary;
795
+ const isExpanded = expandedSessions.has(session.id);
796
+ const hasSubItems = sessionInfo.summaries > 0 || sessionInfo.agents > 0 || sessionInfo.todos > 0;
797
+ $$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">`);
798
+ if (hasSubItems) {
799
+ $$renderer2.push("<!--[-->");
800
+ $$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>`);
801
+ } else {
802
+ $$renderer2.push("<!--[!-->");
803
+ $$renderer2.push(`<span class="w-5 ml-1"></span>`);
804
+ }
805
+ $$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> `);
806
+ if (sessionInfo.agents > 0) {
807
+ $$renderer2.push("<!--[-->");
808
+ $$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>`);
809
+ } else {
810
+ $$renderer2.push("<!--[!-->");
811
+ }
812
+ $$renderer2.push(`<!--]--> `);
813
+ if (sessionInfo.todos > 0) {
814
+ $$renderer2.push("<!--[-->");
815
+ $$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>`);
816
+ } else {
817
+ $$renderer2.push("<!--[!-->");
818
+ }
819
+ $$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">`);
820
+ if (data?.currentSummary) {
821
+ $$renderer2.push("<!--[-->");
822
+ $$renderer2.push(`${escape_html(data.currentSummary.length > 50 ? data.currentSummary.slice(0, 47) + "..." : data.currentSummary)}`);
823
+ } else {
824
+ $$renderer2.push("<!--[!-->");
825
+ $$renderer2.push(`${escape_html(displayTitle)}`);
826
+ }
827
+ $$renderer2.push(`<!--]--></span> <div class="flex-shrink-0 flex gap-0.5 pr-2 pointer-events-auto">`);
828
+ if (onResumeSession) {
829
+ $$renderer2.push("<!--[-->");
830
+ TooltipButton($$renderer2, {
831
+ class: "p-1 rounded hover:bg-gh-green/20 text-xs",
832
+ onclick: (e) => onResumeSession(e, session),
833
+ title: "Resume session",
834
+ children: ($$renderer3) => {
835
+ $$renderer3.push(`<!---->▶️`);
760
836
  },
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(`<!--]-->`);
837
+ $$slots: { default: true }
838
+ });
773
839
  } else {
774
840
  $$renderer2.push("<!--[!-->");
775
- if (toolUseData.input.command) {
841
+ }
842
+ $$renderer2.push(`<!--]--> `);
843
+ TooltipButton($$renderer2, {
844
+ class: "p-1 rounded hover:bg-gh-border text-xs",
845
+ onclick: (e) => onRenameSession(e, session),
846
+ title: "Rename",
847
+ children: ($$renderer3) => {
848
+ $$renderer3.push(`<!---->✏️`);
849
+ },
850
+ $$slots: { default: true }
851
+ });
852
+ $$renderer2.push(`<!----> `);
853
+ TooltipButton($$renderer2, {
854
+ class: "p-1 rounded hover:bg-gh-red/20 text-xs",
855
+ onclick: (e) => onDeleteSession(e, session),
856
+ title: "Delete",
857
+ children: ($$renderer3) => {
858
+ $$renderer3.push(`<!---->🗑️`);
859
+ },
860
+ $$slots: { default: true }
861
+ });
862
+ $$renderer2.push(`<!----></div></div></div> `);
863
+ if (isExpanded && hasSubItems) {
864
+ $$renderer2.push("<!--[-->");
865
+ $$renderer2.push(`<ul class="bg-gh-bg-secondary/50 border-t border-gh-border-subtle text-xs">`);
866
+ if (data?.summaries && data.summaries.length > 0) {
776
867
  $$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)) {
868
+ $$renderer2.push(`<!--[-->`);
869
+ const each_array_2 = ensure_array_like(data.summaries);
870
+ for (let idx = 0, $$length3 = each_array_2.length; idx < $$length3; idx++) {
871
+ let summary = each_array_2[idx];
872
+ $$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> `);
873
+ if (summary.timestamp) {
803
874
  $$renderer2.push("<!--[-->");
804
- TodoItem($$renderer2, { todos: value });
875
+ $$renderer2.push(`<span class="pl-6 text-[10px] text-gh-text-secondary/70">${escape_html(new Date(summary.timestamp).toLocaleString())}</span>`);
805
876
  } else {
806
877
  $$renderer2.push("<!--[!-->");
807
- ExpandableContent($$renderer2, {
808
- content: `${key} = ${JSON.stringify(value, null, 2)}`,
809
- lang: "js",
810
- maxLines: 1
811
- });
812
878
  }
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
- });
879
+ $$renderer2.push(`<!--]--></li>`);
821
880
  }
822
881
  $$renderer2.push(`<!--]-->`);
882
+ } else {
883
+ $$renderer2.push("<!--[!-->");
823
884
  }
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) {
885
+ $$renderer2.push(`<!--]--> `);
886
+ if (data?.todos?.sessionTodos && data.todos.sessionTodos.length > 0) {
833
887
  $$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>`);
888
+ $$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>`);
835
889
  } else {
836
890
  $$renderer2.push("<!--[!-->");
837
891
  }
838
892
  $$renderer2.push(`<!--]--> `);
839
- splitButton($$renderer2);
840
- $$renderer2.push(`<!----> `);
841
- deleteButton($$renderer2);
842
- $$renderer2.push(`<!----></div></div> `);
843
- if (thinkingBlocks.length > 0) {
893
+ if (data?.todos?.agentTodos) {
844
894
  $$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>`);
895
+ $$renderer2.push(`<!--[-->`);
896
+ const each_array_3 = ensure_array_like(data.todos.agentTodos);
897
+ for (let $$index_1 = 0, $$length3 = each_array_3.length; $$index_1 < $$length3; $$index_1++) {
898
+ let agentTodo = each_array_3[$$index_1];
899
+ $$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>`);
850
900
  }
851
- $$renderer2.push(`<!--]--></div>`);
901
+ $$renderer2.push(`<!--]-->`);
852
902
  } else {
853
903
  $$renderer2.push("<!--[!-->");
854
904
  }
855
905
  $$renderer2.push(`<!--]--> `);
856
- if (hasContent) {
906
+ if (data?.agents && data.agents.length > 0) {
857
907
  $$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(`<!--]-->`);
908
+ $$renderer2.push(`<!--[-->`);
909
+ const each_array_4 = ensure_array_like(data.agents);
910
+ for (let $$index_2 = 0, $$length3 = each_array_4.length; $$index_2 < $$length3; $$index_2++) {
911
+ let agent = each_array_4[$$index_2];
912
+ $$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>`);
888
913
  }
889
- $$renderer2.push(`<!--]--></div>`);
914
+ $$renderer2.push(`<!--]-->`);
890
915
  } else {
891
916
  $$renderer2.push("<!--[!-->");
892
917
  }
893
- $$renderer2.push(`<!--]--></div>`);
918
+ $$renderer2.push(`<!--]--></ul>`);
894
919
  } else {
895
920
  $$renderer2.push("<!--[!-->");
896
921
  }
897
- $$renderer2.push(`<!--]-->`);
922
+ $$renderer2.push(`<!--]--></li>`);
898
923
  }
899
924
  $$renderer2.push(`<!--]-->`);
900
925
  }
901
- $$renderer2.push(`<!--]-->`);
926
+ $$renderer2.push(`<!--]--></ul>`);
927
+ } else {
928
+ $$renderer2.push("<!--[!-->");
902
929
  }
903
- $$renderer2.push(`<!--]-->`);
930
+ $$renderer2.push(`<!--]--></li>`);
904
931
  }
905
- $$renderer2.push(`<!--]-->`);
932
+ $$renderer2.push(`<!--]--></ul></aside>`);
933
+ if ($$store_subs) unsubscribe_stores($$store_subs);
906
934
  });
907
935
  }
908
936
  function ScrollButtons($$renderer, $$props) {
@@ -932,6 +960,8 @@ function SessionViewer($$renderer, $$props) {
932
960
  customTitle,
933
961
  currentSummary,
934
962
  backUrl,
963
+ onDeleteMessage,
964
+ onMessagesChange,
935
965
  onEditTitle,
936
966
  onSplitSession,
937
967
  enableScroll = true,
@@ -941,6 +971,46 @@ function SessionViewer($$renderer, $$props) {
941
971
  let activeTab = "messages";
942
972
  let undoStack = [];
943
973
  let undoCountdown = 0;
974
+ let undoTimeoutId = null;
975
+ const handleMessageDeleteWithUndo = async (msg, isAgent) => {
976
+ if (!session) return;
977
+ const msgId = msg.uuid || msg.messageId || msg.leafUuid;
978
+ if (!msgId) return;
979
+ const targetSessionId = session.id;
980
+ let index;
981
+ {
982
+ index = messages.findIndex((m) => (m.uuid || m.messageId || m.leafUuid) === msgId);
983
+ if (index === -1) return;
984
+ }
985
+ try {
986
+ await deleteMessage(session.projectName, targetSessionId, msgId);
987
+ if (isAgent) ;
988
+ else {
989
+ const newMessages = messages.filter((m) => (m.uuid || m.messageId || m.leafUuid) !== msgId);
990
+ onMessagesChange?.(newMessages);
991
+ }
992
+ undoStack = [
993
+ ...undoStack,
994
+ { msg, index, isAgent, sessionId: targetSessionId }
995
+ ];
996
+ if (undoTimeoutId) clearTimeout(undoTimeoutId);
997
+ undoCountdown = 10;
998
+ undoTimeoutId = setTimeout(
999
+ () => {
1000
+ undoStack = [];
1001
+ undoCountdown = 0;
1002
+ undoTimeoutId = null;
1003
+ },
1004
+ 1e4
1005
+ );
1006
+ onDeleteMessage?.(msg);
1007
+ } catch (e) {
1008
+ console.error("Failed to delete message:", e);
1009
+ }
1010
+ };
1011
+ const handleSessionMessageDelete = (msg) => {
1012
+ handleMessageDeleteWithUndo(msg, false);
1013
+ };
944
1014
  const firstMeaningfulIndex = messages.findIndex((m) => m.type === "user" || m.type === "assistant" || m.type === "human");
945
1015
  $$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
1016
  if (backUrl) {
@@ -1004,6 +1074,7 @@ function SessionViewer($$renderer, $$props) {
1004
1074
  MessageItem($$renderer2, {
1005
1075
  msg,
1006
1076
  sessionId: session?.id ?? "",
1077
+ onDelete: handleSessionMessageDelete,
1007
1078
  onEditTitle,
1008
1079
  onSplit: onSplitSession,
1009
1080
  isFirst: i === firstMeaningfulIndex
@@ -1039,115 +1110,173 @@ function _page($$renderer, $$props) {
1039
1110
  let loadingProject = null;
1040
1111
  let error = null;
1041
1112
  let toast = null;
1113
+ let confirmModal = {
1114
+ show: false,
1115
+ title: "",
1116
+ message: "",
1117
+ variant: "default",
1118
+ onConfirm: () => {
1119
+ }
1120
+ };
1121
+ let inputModal = {
1122
+ show: false,
1123
+ title: "",
1124
+ label: "",
1125
+ initialValue: "",
1126
+ onConfirm: () => {
1127
+ }
1128
+ };
1129
+ const showConfirm = (title, message, onConfirm, variant = "default") => {
1130
+ confirmModal = { show: true, title, message, variant, onConfirm };
1131
+ };
1132
+ const closeConfirm = () => {
1133
+ confirmModal = { ...confirmModal, show: false };
1134
+ };
1135
+ const showInput = (title, label, initialValue, onConfirm) => {
1136
+ inputModal = { show: true, title, label, initialValue, onConfirm };
1137
+ };
1138
+ const closeInput = () => {
1139
+ inputModal = { ...inputModal, show: false };
1140
+ };
1042
1141
  const updateHash = (project, session) => {
1043
1142
  return;
1044
1143
  };
1045
- const handleDeleteSession = async (e, session) => {
1144
+ const handleDeleteSession = (e, session) => {
1046
1145
  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
- }
1146
+ showConfirm(
1147
+ "Delete Session",
1148
+ `Delete session "${session.title}"?`,
1149
+ async () => {
1150
+ closeConfirm();
1151
+ try {
1152
+ await deleteSession(session.projectName, session.id);
1153
+ const sessions = projectSessions.get(session.projectName);
1154
+ if (sessions) {
1155
+ projectSessions.set(session.projectName, sessions.filter((s) => s.id !== session.id));
1156
+ projectSessions = new Map(projectSessions);
1157
+ }
1158
+ if (selectedSession?.id === session.id) {
1159
+ selectedSession = null;
1160
+ messages = [];
1161
+ updateHash(session.projectName);
1162
+ }
1163
+ } catch (e2) {
1164
+ error = String(e2);
1165
+ }
1166
+ },
1167
+ "danger"
1168
+ );
1063
1169
  };
1064
- const handleRenameSession = async (e, session) => {
1170
+ const handleRenameSession = (e, session) => {
1065
1171
  e.stopPropagation();
1066
1172
  const sessionData = projectSessionData.get(session.projectName)?.get(session.id);
1067
1173
  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 }];
1174
+ showInput("Rename Session", "Sets custom-title for CLI, first summary for VSCode extension", currentTitle, async (newTitle) => {
1175
+ closeInput();
1176
+ if (newTitle === currentTitle) return;
1177
+ try {
1178
+ await renameSession(session.projectName, session.id, newTitle);
1179
+ if (sessionData) {
1180
+ sessionData.customTitle = newTitle;
1181
+ sessionData.currentSummary = newTitle;
1182
+ if (sessionData.summaries.length > 0) {
1183
+ sessionData.summaries[0] = { ...sessionData.summaries[0], summary: newTitle };
1184
+ } else {
1185
+ sessionData.summaries = [{ summary: newTitle }];
1186
+ }
1079
1187
  }
1188
+ projectSessions = new Map(projectSessions);
1189
+ projectSessionData = new Map(projectSessionData);
1190
+ if (selectedSession?.id === session.id) {
1191
+ messages = await getSession(session.projectName, session.id);
1192
+ }
1193
+ } catch (e2) {
1194
+ error = String(e2);
1080
1195
  }
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
- }
1196
+ });
1089
1197
  };
1090
- const handleEditCustomTitle = async (msg) => {
1198
+ const handleDeleteMessage = async (msg) => {
1091
1199
  if (!selectedSession) return;
1092
- const currentTitle = msg.customTitle ?? "";
1093
- const newTitle = prompt("Enter new custom title:", currentTitle);
1094
- if (newTitle === null || newTitle === currentTitle) return;
1200
+ const msgId = msg.uuid || msg.messageId || msg.leafUuid;
1201
+ if (!msgId) return;
1095
1202
  try {
1096
- await updateCustomTitle(selectedSession.projectName, selectedSession.id, msg.uuid, newTitle);
1097
- msg.customTitle = newTitle;
1098
- messages = [...messages];
1203
+ await deleteMessage(selectedSession.projectName, selectedSession.id, msgId);
1204
+ messages = messages.filter((m) => (m.uuid || m.messageId || m.leafUuid) !== msgId);
1205
+ const sessions = projectSessions.get(selectedSession.projectName);
1206
+ const session = sessions?.find((s) => s.id === selectedSession.id);
1207
+ if (session) {
1208
+ session.messageCount = messages.length;
1209
+ projectSessions = new Map(projectSessions);
1210
+ }
1099
1211
  } catch (e) {
1100
1212
  error = String(e);
1101
1213
  }
1102
1214
  };
1103
- const handleSplitSession = async (msg) => {
1215
+ const handleEditCustomTitle = (msg) => {
1216
+ if (!selectedSession) return;
1217
+ const currentTitle = msg.customTitle ?? "";
1218
+ showInput("Edit Custom Title", "Custom title:", currentTitle, async (newTitle) => {
1219
+ closeInput();
1220
+ if (newTitle === currentTitle) return;
1221
+ try {
1222
+ await updateCustomTitle(selectedSession.projectName, selectedSession.id, msg.uuid, newTitle);
1223
+ msg.customTitle = newTitle;
1224
+ messages = [...messages];
1225
+ } catch (e) {
1226
+ error = String(e);
1227
+ }
1228
+ });
1229
+ };
1230
+ const handleSplitSession = (msg) => {
1104
1231
  if (!selectedSession) return;
1105
1232
  const msgIndex = messages.findIndex((m) => m.uuid === msg.uuid);
1106
1233
  const oldMessagesCount = msgIndex;
1107
1234
  const keptMessagesCount = messages.length - msgIndex;
1108
- if (!confirm(`Split session at this message?
1235
+ showConfirm("Split Session", `Split session at this message?
1109
1236
 
1110
1237
  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 };
1238
+ Old messages (${oldMessagesCount}) will be moved to a new session.`, async () => {
1239
+ closeConfirm();
1240
+ const currentProjectName = selectedSession.projectName;
1241
+ const currentSessionId = selectedSession.id;
1242
+ try {
1243
+ loading = true;
1244
+ const result = await splitSession(currentProjectName, currentSessionId, msg.uuid);
1245
+ if (result.success && result.newSessionId) {
1246
+ const sessionDataList = await expandProject(currentProjectName);
1247
+ const sessions = [];
1248
+ const dataMap = /* @__PURE__ */ new Map();
1249
+ for (const data of sessionDataList) {
1250
+ sessions.push({
1251
+ id: data.id,
1252
+ projectName: currentProjectName,
1253
+ title: data.title,
1254
+ messageCount: data.messageCount,
1255
+ createdAt: data.createdAt,
1256
+ updatedAt: data.updatedAt
1257
+ });
1258
+ dataMap.set(data.id, data);
1259
+ }
1260
+ projectSessions.set(currentProjectName, sessions);
1261
+ projectSessions = new Map(projectSessions);
1262
+ projectSessionData.set(currentProjectName, dataMap);
1263
+ projectSessionData = new Map(projectSessionData);
1264
+ messages = messages.slice(msgIndex);
1265
+ const updatedSession = sessions.find((s) => s.id === currentSessionId);
1266
+ if (updatedSession) {
1267
+ updatedSession.messageCount = messages.length;
1268
+ selectedSession = { ...updatedSession };
1269
+ }
1270
+ toast = `Session split! Old messages moved to new session: ${result.newSessionId.slice(0, 8)}...`;
1271
+ } else {
1272
+ error = result.error ?? "Failed to split session";
1141
1273
  }
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";
1274
+ } catch (e) {
1275
+ error = String(e);
1276
+ } finally {
1277
+ loading = false;
1145
1278
  }
1146
- } catch (e) {
1147
- error = String(e);
1148
- } finally {
1149
- loading = false;
1150
- }
1279
+ });
1151
1280
  };
1152
1281
  const handleResumeSession = async (e, session) => {
1153
1282
  e.stopPropagation();
@@ -1185,6 +1314,8 @@ Old messages (${oldMessagesCount}) will be moved to a new session.`)) return;
1185
1314
  agents,
1186
1315
  customTitle: selectedSession ? projectSessionData.get(selectedSession.projectName)?.get(selectedSession.id)?.customTitle : void 0,
1187
1316
  currentSummary: selectedSession ? projectSessionData.get(selectedSession.projectName)?.get(selectedSession.id)?.currentSummary : void 0,
1317
+ onMessagesChange: (newMessages) => messages = newMessages,
1318
+ onDeleteMessage: handleDeleteMessage,
1188
1319
  onEditTitle: handleEditCustomTitle,
1189
1320
  onSplitSession: handleSplitSession
1190
1321
  });
@@ -1212,6 +1343,24 @@ Old messages (${oldMessagesCount}) will be moved to a new session.`)) return;
1212
1343
  $$settled = false;
1213
1344
  }
1214
1345
  });
1346
+ $$renderer3.push(`<!----> `);
1347
+ ConfirmModal($$renderer3, {
1348
+ show: confirmModal.show,
1349
+ title: confirmModal.title,
1350
+ message: confirmModal.message,
1351
+ variant: confirmModal.variant,
1352
+ onConfirm: confirmModal.onConfirm,
1353
+ onCancel: closeConfirm
1354
+ });
1355
+ $$renderer3.push(`<!----> `);
1356
+ InputModal($$renderer3, {
1357
+ show: inputModal.show,
1358
+ title: inputModal.title,
1359
+ label: inputModal.label,
1360
+ initialValue: inputModal.initialValue,
1361
+ onConfirm: inputModal.onConfirm,
1362
+ onCancel: closeInput
1363
+ });
1215
1364
  $$renderer3.push(`<!---->`);
1216
1365
  }
1217
1366
  do {
@@ -1224,4 +1373,4 @@ Old messages (${oldMessagesCount}) will be moved to a new session.`)) return;
1224
1373
  }
1225
1374
 
1226
1375
  export { _page as default };
1227
- //# sourceMappingURL=_page.svelte-Bgd-L7N_.js.map
1376
+ //# sourceMappingURL=_page.svelte-g3nbsvo6.js.map