repoburg 1.3.319 → 1.3.320

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 (192) hide show
  1. package/agent-pane/backend/dist/index.js +156 -100
  2. package/agent-pane/backend/dist/server.js +156 -100
  3. package/backend/dist/src/agent-runtime/agent-runtime-event-emitter.d.ts +2 -1
  4. package/backend/dist/src/agent-runtime/agent-runtime-event-emitter.js +10 -0
  5. package/backend/dist/src/agent-runtime/agent-runtime-event-emitter.js.map +1 -1
  6. package/backend/dist/src/agent-runtime/agent-runtime.types.d.ts +12 -1
  7. package/backend/dist/src/ai-actions/ai-action-batch.service.js +6 -3
  8. package/backend/dist/src/ai-actions/ai-action-batch.service.js.map +1 -1
  9. package/backend/dist/src/app.module.js +2 -9
  10. package/backend/dist/src/app.module.js.map +1 -1
  11. package/backend/dist/src/application-state/application-state.service.d.ts +3 -4
  12. package/backend/dist/src/application-state/application-state.service.js +21 -25
  13. package/backend/dist/src/application-state/application-state.service.js.map +1 -1
  14. package/backend/dist/src/context-generation/context-generation.service.js +3 -0
  15. package/backend/dist/src/context-generation/context-generation.service.js.map +1 -1
  16. package/backend/dist/src/context-generation/project-guidance.d.ts +12 -0
  17. package/backend/dist/src/context-generation/project-guidance.js +103 -0
  18. package/backend/dist/src/context-generation/project-guidance.js.map +1 -0
  19. package/backend/dist/src/core-entities/mcp-config.entity.d.ts +3 -1
  20. package/backend/dist/src/core-entities/mcp-config.entity.js +17 -1
  21. package/backend/dist/src/core-entities/mcp-config.entity.js.map +1 -1
  22. package/backend/dist/src/global-config/dto/update-global-config.dto.d.ts +2 -0
  23. package/backend/dist/src/global-config/dto/update-global-config.dto.js +12 -0
  24. package/backend/dist/src/global-config/dto/update-global-config.dto.js.map +1 -1
  25. package/backend/dist/src/global-config/global-config.service.d.ts +2 -0
  26. package/backend/dist/src/global-config/global-config.service.js.map +1 -1
  27. package/backend/dist/src/interactive-chat/auto-compact.service.d.ts +34 -0
  28. package/backend/dist/src/interactive-chat/auto-compact.service.js +259 -0
  29. package/backend/dist/src/interactive-chat/auto-compact.service.js.map +1 -0
  30. package/backend/dist/src/interactive-chat/chat.module.js +2 -5
  31. package/backend/dist/src/interactive-chat/chat.module.js.map +1 -1
  32. package/backend/dist/src/interactive-chat/chat.service.d.ts +12 -4
  33. package/backend/dist/src/interactive-chat/chat.service.js +102 -39
  34. package/backend/dist/src/interactive-chat/chat.service.js.map +1 -1
  35. package/backend/dist/src/llm-orchestration/action-handlers/execute-code.handler.d.ts +1 -1
  36. package/backend/dist/src/llm-orchestration/action-handlers/execute-code.handler.js +8 -2
  37. package/backend/dist/src/llm-orchestration/action-handlers/execute-code.handler.js.map +1 -1
  38. package/backend/dist/src/llm-orchestration/action-handlers/mcp-tool-action.handler.d.ts +5 -2
  39. package/backend/dist/src/llm-orchestration/action-handlers/mcp-tool-action.handler.js +50 -17
  40. package/backend/dist/src/llm-orchestration/action-handlers/mcp-tool-action.handler.js.map +1 -1
  41. package/backend/dist/src/llm-orchestration/action-handlers/run-command.handler.js +9 -1
  42. package/backend/dist/src/llm-orchestration/action-handlers/run-command.handler.js.map +1 -1
  43. package/backend/dist/src/llm-orchestration/hooks/follow-up-post-execution.hook.js +8 -0
  44. package/backend/dist/src/llm-orchestration/hooks/follow-up-post-execution.hook.js.map +1 -1
  45. package/backend/dist/src/llm-orchestration/hooks/yolo-mode-post-execution.hook.js +2 -1
  46. package/backend/dist/src/llm-orchestration/hooks/yolo-mode-post-execution.hook.js.map +1 -1
  47. package/backend/dist/src/llm-orchestration/llm-orchestration.interfaces.d.ts +2 -0
  48. package/backend/dist/src/llm-orchestration/llm-orchestration.interfaces.js.map +1 -1
  49. package/backend/dist/src/llm-orchestration/llm-orchestration.module.js +0 -2
  50. package/backend/dist/src/llm-orchestration/llm-orchestration.module.js.map +1 -1
  51. package/backend/dist/src/llm-orchestration/llm-turn-processor.service.d.ts +8 -1
  52. package/backend/dist/src/llm-orchestration/llm-turn-processor.service.js +237 -194
  53. package/backend/dist/src/llm-orchestration/llm-turn-processor.service.js.map +1 -1
  54. package/backend/dist/src/llm-orchestration/turn-execution-plan.d.ts +18 -0
  55. package/backend/dist/src/llm-orchestration/turn-execution-plan.js +53 -0
  56. package/backend/dist/src/llm-orchestration/turn-execution-plan.js.map +1 -0
  57. package/backend/dist/src/llm-provider/ollama-llm.provider.d.ts +1 -0
  58. package/backend/dist/src/llm-provider/ollama-llm.provider.js +21 -5
  59. package/backend/dist/src/llm-provider/ollama-llm.provider.js.map +1 -1
  60. package/backend/dist/src/llm-provider/openrouter-llm.provider.d.ts +3 -0
  61. package/backend/dist/src/llm-provider/openrouter-llm.provider.js +8 -0
  62. package/backend/dist/src/llm-provider/openrouter-llm.provider.js.map +1 -1
  63. package/backend/dist/src/llm-responses/llm-responses.module.js +0 -4
  64. package/backend/dist/src/llm-responses/llm-responses.module.js.map +1 -1
  65. package/backend/dist/src/llm-responses/llm-responses.service.d.ts +12 -4
  66. package/backend/dist/src/llm-responses/llm-responses.service.js +4 -45
  67. package/backend/dist/src/llm-responses/llm-responses.service.js.map +1 -1
  68. package/backend/dist/src/main.js +4 -0
  69. package/backend/dist/src/main.js.map +1 -1
  70. package/backend/dist/src/mcp/marketplace/dto/initiate-connect.dto.d.ts +3 -1
  71. package/backend/dist/src/mcp/marketplace/dto/initiate-connect.dto.js +19 -0
  72. package/backend/dist/src/mcp/marketplace/dto/initiate-connect.dto.js.map +1 -1
  73. package/backend/dist/src/mcp/marketplace/marketplace.controller.js +7 -0
  74. package/backend/dist/src/mcp/marketplace/marketplace.controller.js.map +1 -1
  75. package/backend/dist/src/mcp/marketplace/marketplace.service.d.ts +9 -0
  76. package/backend/dist/src/mcp/marketplace/marketplace.service.js +68 -13
  77. package/backend/dist/src/mcp/marketplace/marketplace.service.js.map +1 -1
  78. package/backend/dist/src/mcp/marketplace/oauth-provider.d.ts +3 -0
  79. package/backend/dist/src/mcp/marketplace/oauth-provider.js.map +1 -1
  80. package/backend/dist/src/mcp/mcp-result.d.ts +12 -0
  81. package/backend/dist/src/mcp/mcp-result.js +125 -0
  82. package/backend/dist/src/mcp/mcp-result.js.map +1 -0
  83. package/backend/dist/src/mcp/mcp.service.d.ts +33 -1
  84. package/backend/dist/src/mcp/mcp.service.js +364 -79
  85. package/backend/dist/src/mcp/mcp.service.js.map +1 -1
  86. package/backend/dist/src/metadata-store/schemas/metadata-schemas.d.ts +3 -1
  87. package/backend/dist/src/metadata-store/schemas/metadata-schemas.js +11 -1
  88. package/backend/dist/src/metadata-store/schemas/metadata-schemas.js.map +1 -1
  89. package/backend/dist/src/seeding/data/shared/project-guidance-section.d.ts +1 -0
  90. package/backend/dist/src/seeding/data/shared/project-guidance-section.js +22 -0
  91. package/backend/dist/src/seeding/data/shared/project-guidance-section.js.map +1 -0
  92. package/backend/dist/src/seeding/data/system-prompts/default_native_tool_agent.d.ts +1 -1
  93. package/backend/dist/src/seeding/data/system-prompts/default_native_tool_agent.js +10 -38
  94. package/backend/dist/src/seeding/data/system-prompts/default_native_tool_agent.js.map +1 -1
  95. package/backend/dist/src/seeding/data/system-prompts/explore-codebase-agent.d.ts +1 -1
  96. package/backend/dist/src/seeding/data/system-prompts/explore-codebase-agent.js +3 -1
  97. package/backend/dist/src/seeding/data/system-prompts/explore-codebase-agent.js.map +1 -1
  98. package/backend/dist/src/seeding/data/system-prompts/general-purpose-agent.d.ts +1 -1
  99. package/backend/dist/src/seeding/data/system-prompts/general-purpose-agent.js +3 -1
  100. package/backend/dist/src/seeding/data/system-prompts/general-purpose-agent.js.map +1 -1
  101. package/backend/dist/src/session-cancellation/session-cancellation.module.d.ts +2 -0
  102. package/backend/dist/src/{message-bus/message-bus.module.js → session-cancellation/session-cancellation.module.js} +10 -11
  103. package/backend/dist/src/session-cancellation/session-cancellation.module.js.map +1 -0
  104. package/backend/dist/src/session-cancellation/session-cancellation.service.d.ts +13 -0
  105. package/backend/dist/src/session-cancellation/session-cancellation.service.js +75 -0
  106. package/backend/dist/src/session-cancellation/session-cancellation.service.js.map +1 -0
  107. package/backend/dist/src/session-inputs/session-inputs.service.js +3 -1
  108. package/backend/dist/src/session-inputs/session-inputs.service.js.map +1 -1
  109. package/backend/dist/src/sessions/sessions.module.js +0 -2
  110. package/backend/dist/src/sessions/sessions.module.js.map +1 -1
  111. package/backend/dist/src/sessions/sessions.service.d.ts +1 -3
  112. package/backend/dist/src/sessions/sessions.service.js +1 -5
  113. package/backend/dist/src/sessions/sessions.service.js.map +1 -1
  114. package/backend/dist/src/tool-hooks/hook-runtime.d.ts +1 -1
  115. package/backend/dist/src/tool-hooks/hook-runtime.js +17 -16
  116. package/backend/dist/src/tool-hooks/hook-runtime.js.map +1 -1
  117. package/backend/dist/src/utils/spawn-with-kill.d.ts +2 -0
  118. package/backend/dist/src/utils/spawn-with-kill.js +18 -3
  119. package/backend/dist/src/utils/spawn-with-kill.js.map +1 -1
  120. package/backend/dist/tsconfig.build.tsbuildinfo +1 -1
  121. package/daemon/dist/index.js +1 -17
  122. package/package.json +2 -8
  123. package/platform-cli.js +0 -316
  124. package/tabtape/extension/dist/build-info.json +3 -3
  125. package/tabtape/extension/dist/manifest.json +1 -1
  126. package/tabtape/ui/dist/build-info.json +3 -3
  127. package/backend/dist/src/llm-responses/dto/submit-llm-response.dto.d.ts +0 -9
  128. package/backend/dist/src/llm-responses/dto/submit-llm-response.dto.js +0 -80
  129. package/backend/dist/src/llm-responses/dto/submit-llm-response.dto.js.map +0 -1
  130. package/backend/dist/src/llm-responses/llm-responses.controller.d.ts +0 -8
  131. package/backend/dist/src/llm-responses/llm-responses.controller.js +0 -51
  132. package/backend/dist/src/llm-responses/llm-responses.controller.js.map +0 -1
  133. package/backend/dist/src/mcp-server/mcp-internal.controller.d.ts +0 -12
  134. package/backend/dist/src/mcp-server/mcp-internal.controller.js +0 -50
  135. package/backend/dist/src/mcp-server/mcp-internal.controller.js.map +0 -1
  136. package/backend/dist/src/mcp-server/mcp-server.bootstrap.d.ts +0 -2
  137. package/backend/dist/src/mcp-server/mcp-server.bootstrap.js +0 -166
  138. package/backend/dist/src/mcp-server/mcp-server.bootstrap.js.map +0 -1
  139. package/backend/dist/src/mcp-server/mcp-server.constants.d.ts +0 -8
  140. package/backend/dist/src/mcp-server/mcp-server.constants.js +0 -12
  141. package/backend/dist/src/mcp-server/mcp-server.constants.js.map +0 -1
  142. package/backend/dist/src/mcp-server/mcp-server.controller.d.ts +0 -19
  143. package/backend/dist/src/mcp-server/mcp-server.controller.js +0 -72
  144. package/backend/dist/src/mcp-server/mcp-server.controller.js.map +0 -1
  145. package/backend/dist/src/mcp-server/mcp-server.module.d.ts +0 -2
  146. package/backend/dist/src/mcp-server/mcp-server.module.js +0 -29
  147. package/backend/dist/src/mcp-server/mcp-server.module.js.map +0 -1
  148. package/backend/dist/src/mcp-server/mcp-server.process.service.d.ts +0 -23
  149. package/backend/dist/src/mcp-server/mcp-server.process.service.js +0 -130
  150. package/backend/dist/src/mcp-server/mcp-server.process.service.js.map +0 -1
  151. package/backend/dist/src/mcp-server/mcp-server.service.d.ts +0 -34
  152. package/backend/dist/src/mcp-server/mcp-server.service.js +0 -260
  153. package/backend/dist/src/mcp-server/mcp-server.service.js.map +0 -1
  154. package/backend/dist/src/message-bus/dto/submit-message.dto.d.ts +0 -4
  155. package/backend/dist/src/message-bus/dto/submit-message.dto.js +0 -22
  156. package/backend/dist/src/message-bus/dto/submit-message.dto.js.map +0 -1
  157. package/backend/dist/src/message-bus/message-bus.controller.d.ts +0 -13
  158. package/backend/dist/src/message-bus/message-bus.controller.js +0 -50
  159. package/backend/dist/src/message-bus/message-bus.controller.js.map +0 -1
  160. package/backend/dist/src/message-bus/message-bus.module.d.ts +0 -2
  161. package/backend/dist/src/message-bus/message-bus.module.js.map +0 -1
  162. package/backend/dist/src/message-bus/message-bus.service.d.ts +0 -7
  163. package/backend/dist/src/message-bus/message-bus.service.js +0 -32
  164. package/backend/dist/src/message-bus/message-bus.service.js.map +0 -1
  165. package/backend/dist/src/visual-editor/visual-editor.controller.d.ts +0 -14
  166. package/backend/dist/src/visual-editor/visual-editor.controller.js +0 -101
  167. package/backend/dist/src/visual-editor/visual-editor.controller.js.map +0 -1
  168. package/backend/dist/src/visual-editor/visual-editor.dto.d.ts +0 -5
  169. package/backend/dist/src/visual-editor/visual-editor.dto.js +0 -32
  170. package/backend/dist/src/visual-editor/visual-editor.dto.js.map +0 -1
  171. package/backend/dist/src/visual-editor/visual-editor.module.d.ts +0 -2
  172. package/backend/dist/src/visual-editor/visual-editor.module.js +0 -24
  173. package/backend/dist/src/visual-editor/visual-editor.module.js.map +0 -1
  174. package/daemon/dist/mcp-gateway.js +0 -401
  175. package/daemon/dist/mcp-gateway.spec.js +0 -295
  176. package/visual-editor-proxy/client/dist/main.js +0 -89
  177. package/visual-editor-proxy/client/tsconfig.json +0 -14
  178. package/visual-editor-proxy/dist/client/src/inspector.d.ts +0 -9
  179. package/visual-editor-proxy/dist/client/src/inspector.js +0 -96
  180. package/visual-editor-proxy/dist/client/src/inspector.js.map +0 -1
  181. package/visual-editor-proxy/dist/client/src/main.d.ts +0 -6
  182. package/visual-editor-proxy/dist/client/src/main.js +0 -108
  183. package/visual-editor-proxy/dist/client/src/main.js.map +0 -1
  184. package/visual-editor-proxy/dist/client/src/ui.d.ts +0 -6
  185. package/visual-editor-proxy/dist/client/src/ui.js +0 -153
  186. package/visual-editor-proxy/dist/client/src/ui.js.map +0 -1
  187. package/visual-editor-proxy/dist/src/main.d.ts +0 -1
  188. package/visual-editor-proxy/dist/src/main.js +0 -61
  189. package/visual-editor-proxy/dist/src/main.js.map +0 -1
  190. package/visual-editor-proxy/dist/tsconfig.tsbuildinfo +0 -1
  191. package/visual-editor-proxy/package.json +0 -21
  192. package/visual-editor-proxy/tsconfig.json +0 -21
@@ -119814,6 +119814,21 @@ function reapOrphanCliProcesses(db2, deps = defaultDeps) {
119814
119814
  return reapOrphanProcesses(db2, "claude", deps);
119815
119815
  }
119816
119816
 
119817
+ // src/providers/thread-summary.ts
119818
+ function buildThreadSummaryPrompt(transcript, directives) {
119819
+ const directiveLine = directives.trim() ? `
119820
+
119821
+ The user has given these summarization directives \u2014 follow them exactly:
119822
+ "${directives.trim()}"` : "";
119823
+ return `You are summarizing a side discussion thread that forked from a main agent session. The discussion begins at the FIRST message of the transcript below \u2014 summarize ONLY the discussion itself, from its beginning up to now.${directiveLine}
119824
+
119825
+ The discussion transcript (from the discussion's beginning):
119826
+
119827
+ ${transcript}
119828
+
119829
+ Produce a concise summary of the discussion that preserves: concrete findings, file paths, decisions, and any unresolved questions. Reply with only the summary text, nothing else.`;
119830
+ }
119831
+
119817
119832
  // src/codex/codex-provider.ts
119818
119833
  var TERMINAL_TASK_TYPE = "background_terminal";
119819
119834
  function taskPollMs() {
@@ -120145,7 +120160,9 @@ function completeTurn(db2, sessionId, turnId, usage) {
120145
120160
  const response = turnResponse(db2, turnId);
120146
120161
  const result = usage !== void 0 ? db2.prepare(
120147
120162
  "UPDATE turns SET status = 'completed', token_usage = ?, updated_at = ? WHERE id = ? AND status IN ('pending', 'running')"
120148
- ).run(JSON.stringify(usage), now, turnId) : db2.prepare("UPDATE turns SET status = 'completed', updated_at = ? WHERE id = ? AND status IN ('pending', 'running')").run(now, turnId);
120163
+ ).run(JSON.stringify(usage), now, turnId) : db2.prepare(
120164
+ "UPDATE turns SET status = 'completed', updated_at = ? WHERE id = ? AND status IN ('pending', 'running')"
120165
+ ).run(now, turnId);
120149
120166
  if (result.changes === 0) return;
120150
120167
  broadcast("turn:completed", {
120151
120168
  sessionId,
@@ -120797,17 +120814,7 @@ async function summarizeCodexThread(session, _thread, transcript, directives) {
120797
120814
  ephemeral: true
120798
120815
  });
120799
120816
  const threadId = initResult.thread.id;
120800
- const directiveLine = directives.trim() ? `
120801
-
120802
- The user has given these summarization directives \u2014 follow them exactly:
120803
- "${directives.trim()}"` : "";
120804
- const summaryPrompt = `You are summarizing a side discussion thread that forked from a main agent session. The discussion begins at the FIRST message of the transcript below \u2014 summarize ONLY the discussion itself, from its beginning up to now.${directiveLine}
120805
-
120806
- The discussion transcript (from the discussion's beginning):
120807
-
120808
- ${transcript}
120809
-
120810
- Produce a concise summary of the discussion that preserves: concrete findings, file paths, decisions, and any unresolved questions. Reply with only the summary text, nothing else.`;
120817
+ const summaryPrompt = buildThreadSummaryPrompt(transcript, directives);
120811
120818
  let summaryResolve;
120812
120819
  let summaryReject;
120813
120820
  const summaryPromise = new Promise((resolve, reject) => {
@@ -120913,7 +120920,10 @@ async function forkSession(session, targetTurn) {
120913
120920
  try {
120914
120921
  result = await fork({ lastTurnId });
120915
120922
  } catch (err) {
120916
- const range = await client.request("thread/read", { threadId, includeTurns: true }).then(({ thread }) => forkThroughReview(thread.turns ?? [], lastTurnId), () => void 0);
120923
+ const range = await client.request("thread/read", { threadId, includeTurns: true }).then(
120924
+ ({ thread }) => forkThroughReview(thread.turns ?? [], lastTurnId),
120925
+ () => void 0
120926
+ );
120917
120927
  if (!range) throw err;
120918
120928
  result = await fork(range);
120919
120929
  }
@@ -121154,7 +121164,9 @@ function hostFor(sessionId, cwd, options, onDirect) {
121154
121164
  const { command, args } = appServerCommand(options);
121155
121165
  return startCodexHost(getDb(), { sessionId, cwd, command, args, env: { ...process.env }, onDirect });
121156
121166
  } catch (err) {
121157
- console.error(`[codex] no session host for ${sessionId} (${err.message}); running the app-server directly`);
121167
+ console.error(
121168
+ `[codex] no session host for ${sessionId} (${err.message}); running the app-server directly`
121169
+ );
121158
121170
  return null;
121159
121171
  }
121160
121172
  }
@@ -121208,7 +121220,9 @@ function settleHostTurn(entry) {
121208
121220
  function maybeRetire(entry) {
121209
121221
  const why = entry.retireWhenIdle;
121210
121222
  if (!why || entry.replaying || entry.turns.length > 0 || !isCurrent(entry)) return;
121211
- console.log(`[codex] closing the idle app-server of session ${entry.sessionId} (${why}); the next prompt starts a new one`);
121223
+ console.log(
121224
+ `[codex] closing the idle app-server of session ${entry.sessionId} (${why}); the next prompt starts a new one`
121225
+ );
121212
121226
  void retireEntry(entry, "keep");
121213
121227
  }
121214
121228
  function detachEntry(entry) {
@@ -121370,7 +121384,9 @@ var codexHostAdopter = {
121370
121384
  if (!session || session.runtime_type !== "codex") return;
121371
121385
  const detail = describeExit(exit);
121372
121386
  const threadId = row.external_id ?? session.external_thread_id;
121373
- console.log(`[codex] the app-server of session ${session.id} ended with no daemon attached (${detail}); replaying its log`);
121387
+ console.log(
121388
+ `[codex] the app-server of session ${session.id} ended with no daemon attached (${detail}); replaying its log`
121389
+ );
121374
121390
  if (log && log.length > 0 && threadId) {
121375
121391
  const logged = new LoggedAppServer();
121376
121392
  const client = new AppServerClient({ cwd: session.cwd ?? process.cwd(), process: logged, replaying: true });
@@ -123401,7 +123417,7 @@ Agent responded: "${truncatedResponse}"`;
123401
123417
  }
123402
123418
  }
123403
123419
  }
123404
- function buildThreadSummaryPrompt(transcript, directives, hasNativeContext) {
123420
+ function buildThreadSummaryPrompt2(transcript, directives, hasNativeContext) {
123405
123421
  const directiveLine = directives.trim() ? `
123406
123422
 
123407
123423
  The user has given these summarization directives \u2014 follow them exactly:
@@ -123429,7 +123445,7 @@ async function summarizeClaudeThread(session, thread, transcript, directives) {
123429
123445
  console.error("[claude] summarizeThread fork failed \u2014 falling back to embedded transcript:", err);
123430
123446
  }
123431
123447
  }
123432
- const prompt = buildThreadSummaryPrompt(transcript, directives, !!resumeId);
123448
+ const prompt = buildThreadSummaryPrompt2(transcript, directives, !!resumeId);
123433
123449
  q = query({
123434
123450
  prompt,
123435
123451
  options: {
@@ -124043,7 +124059,7 @@ function parseSelectionGroups(raw) {
124043
124059
  }).filter((g) => g !== null);
124044
124060
  }
124045
124061
  function mapActionToItem(action) {
124046
- const failed = action.status === "EXECUTION_FAILED";
124062
+ const failed = String(action.status ?? "").toLowerCase() === "execution_failed";
124047
124063
  const status = failed ? "failed" : "completed";
124048
124064
  const log = action.executionLogs?.[0];
124049
124065
  const output = log?.output ?? "";
@@ -124266,11 +124282,7 @@ async function streamAgentRuntimeMessages(baseUrl, sessionId, onMessage, opts =
124266
124282
  await reconnectDelay(delayMs, opts.signal);
124267
124283
  continue;
124268
124284
  }
124269
- const reason = await readBody(
124270
- response.body,
124271
- onMessage,
124272
- opts
124273
- );
124285
+ const reason = await readBody(response.body, onMessage, opts);
124274
124286
  if (reason !== null) {
124275
124287
  await response.body.cancel().catch(() => {
124276
124288
  });
@@ -124345,6 +124357,50 @@ function reconnectDelay(delayMs, signal) {
124345
124357
  });
124346
124358
  }
124347
124359
 
124360
+ // src/repoburg/throwaway-run.ts
124361
+ async function runThrowawayPrompt(client, options) {
124362
+ let throwawayId = null;
124363
+ try {
124364
+ const created = await client.createSession(options.model ? { model_id: options.model } : {});
124365
+ throwawayId = created.id;
124366
+ const controller = new AbortController();
124367
+ const timer2 = setTimeout(() => controller.abort(), options.timeoutMs);
124368
+ try {
124369
+ await client.createInput(throwawayId, {
124370
+ user_prompt: options.prompt,
124371
+ execution_strategy: "auto_apply"
124372
+ });
124373
+ let reply = "";
124374
+ let failed = false;
124375
+ const consume = (message) => {
124376
+ if (message.type === "assistant") {
124377
+ reply += message.content.filter((b) => b.type === "text").map((b) => b.text).join("");
124378
+ } else if (message.type === "result") {
124379
+ if (message.is_error) failed = true;
124380
+ else if (message.result) reply = message.result;
124381
+ }
124382
+ };
124383
+ const reason = await streamAgentRuntimeMessages(client.baseUrl, throwawayId, consume, {
124384
+ signal: controller.signal,
124385
+ deltas: false
124386
+ });
124387
+ if (reason === "aborted") {
124388
+ void client.cancel(throwawayId).catch(() => {
124389
+ });
124390
+ return null;
124391
+ }
124392
+ return failed ? null : reply;
124393
+ } finally {
124394
+ clearTimeout(timer2);
124395
+ }
124396
+ } catch {
124397
+ return null;
124398
+ } finally {
124399
+ if (throwawayId) void client.deleteSession(throwawayId).catch(() => {
124400
+ });
124401
+ }
124402
+ }
124403
+
124348
124404
  // src/repoburg/turn-projector.ts
124349
124405
  var RESULT_TIMEOUT_MS = 15 * 6e4;
124350
124406
  var MAX_RESULT_EXTENSIONS = 3;
@@ -124379,8 +124435,8 @@ var TurnProjector = class {
124379
124435
  }
124380
124436
  switch (message.type) {
124381
124437
  case "system":
124438
+ if (message.subtype === "compact_boundary") this.handleCompactBoundary(message);
124382
124439
  break;
124383
- // init — connection marker only; gaps go to recoverGap
124384
124440
  case "stream_event":
124385
124441
  this.handleStreamEvent(message);
124386
124442
  break;
@@ -124497,10 +124553,7 @@ var TurnProjector = class {
124497
124553
  }
124498
124554
  if (ids.includes(inputId)) return;
124499
124555
  ids.push(inputId);
124500
- db2.prepare("UPDATE turns SET runtime_input_ids = ? WHERE id = ?").run(
124501
- JSON.stringify(ids),
124502
- this.deps.turnId
124503
- );
124556
+ db2.prepare("UPDATE turns SET runtime_input_ids = ? WHERE id = ?").run(JSON.stringify(ids), this.deps.turnId);
124504
124557
  } catch {
124505
124558
  }
124506
124559
  }
@@ -124575,7 +124628,14 @@ var TurnProjector = class {
124575
124628
  else info.reasoningItemId = existing.id;
124576
124629
  const data = existing.data ? JSON.parse(existing.data) : {};
124577
124630
  if (existing.status !== "completed" || data.text !== text2) {
124578
- completeItem(db2, this.deps.agentPaneSessionId, this.deps.turnId, { ...existing, data }, { text: text2 }, "completed");
124631
+ completeItem(
124632
+ db2,
124633
+ this.deps.agentPaneSessionId,
124634
+ this.deps.turnId,
124635
+ { ...existing, data },
124636
+ { text: text2 },
124637
+ "completed"
124638
+ );
124579
124639
  }
124580
124640
  return;
124581
124641
  }
@@ -124592,6 +124652,28 @@ var TurnProjector = class {
124592
124652
  if (kind === "message") info.messageItemId = item.id;
124593
124653
  else info.reasoningItemId = item.id;
124594
124654
  }
124655
+ /** The backend compacted the context: a "Context compacted" row (the
124656
+ * item Claude sessions show), and the context counter drops to the fill
124657
+ * after it. */
124658
+ handleCompactBoundary(msg) {
124659
+ const meta3 = msg.compact_metadata;
124660
+ const externalId = `compact-${msg.seq ?? Date.now()}`;
124661
+ if (this.existingItemId(externalId)) return;
124662
+ insertItem(
124663
+ getDb(),
124664
+ this.deps.agentPaneSessionId,
124665
+ this.deps.turnId,
124666
+ externalId,
124667
+ "context_compaction",
124668
+ { trigger: meta3.trigger, pre_tokens: meta3.pre_tokens, post_tokens: meta3.post_tokens },
124669
+ "completed",
124670
+ "item:completed"
124671
+ );
124672
+ if (meta3.post_tokens > 0) {
124673
+ this.lastContextTokens = meta3.post_tokens;
124674
+ this.emitContextUsage();
124675
+ }
124676
+ }
124595
124677
  existingItemId(externalId) {
124596
124678
  const row = getDb().prepare("SELECT id FROM items WHERE turn_id = ? AND external_item_id = ?").get(this.deps.turnId, externalId);
124597
124679
  return row?.id ?? null;
@@ -124711,9 +124793,13 @@ var TurnProjector = class {
124711
124793
  output: msg.usage.output_tokens
124712
124794
  }) : null;
124713
124795
  this.closeOpenItems("completed");
124714
- db2.prepare(
124715
- "UPDATE turns SET status = ?, agent_response = ?, token_usage = ?, updated_at = ? WHERE id = ?"
124716
- ).run("completed", responseText || null, usage ? JSON.stringify(usage) : null, now, this.deps.turnId);
124796
+ db2.prepare("UPDATE turns SET status = ?, agent_response = ?, token_usage = ?, updated_at = ? WHERE id = ?").run(
124797
+ "completed",
124798
+ responseText || null,
124799
+ usage ? JSON.stringify(usage) : null,
124800
+ now,
124801
+ this.deps.turnId
124802
+ );
124717
124803
  recomputeSessionRunning(db2, this.deps.agentPaneSessionId, "active", true);
124718
124804
  broadcast("turn:completed", {
124719
124805
  sessionId: this.deps.agentPaneSessionId,
@@ -124757,9 +124843,7 @@ var TurnProjector = class {
124757
124843
  async syncTitle() {
124758
124844
  try {
124759
124845
  const db2 = getDb();
124760
- const session = db2.prepare("SELECT title FROM sessions WHERE id = ?").get(
124761
- this.deps.agentPaneSessionId
124762
- );
124846
+ const session = db2.prepare("SELECT title FROM sessions WHERE id = ?").get(this.deps.agentPaneSessionId);
124763
124847
  if (!session || session.title) return;
124764
124848
  const runtimeSession = await this.deps.client.getSession(this.deps.repoburgSessionId);
124765
124849
  const title = (runtimeSession.session_title || "").trim();
@@ -124790,54 +124874,19 @@ var TurnProjector = class {
124790
124874
  const sessionId = this.deps.agentPaneSessionId;
124791
124875
  if (titleGenerating3.has(sessionId)) return;
124792
124876
  const db2 = getDb();
124793
- const firstTurn = db2.prepare(
124794
- "SELECT user_prompt, agent_response FROM turns WHERE session_id = ? ORDER BY created_at ASC LIMIT 1"
124795
- ).get(sessionId);
124877
+ const firstTurn = db2.prepare("SELECT user_prompt, agent_response FROM turns WHERE session_id = ? ORDER BY created_at ASC LIMIT 1").get(sessionId);
124796
124878
  if (!firstTurn) return;
124797
124879
  titleGenerating3.add(sessionId);
124798
- let throwawayId = null;
124799
124880
  try {
124800
124881
  const pane = db2.prepare("SELECT model FROM sessions WHERE id = ?").get(sessionId);
124801
- const created = await this.deps.client.createSession(
124802
- pane?.model ? { model_id: pane.model } : {}
124803
- );
124804
- throwawayId = created.id;
124805
- const controller = new AbortController();
124806
- const timer2 = setTimeout(() => controller.abort(), TITLE_TIMEOUT_MS);
124807
- try {
124808
- await this.deps.client.createInput(throwawayId, {
124809
- user_prompt: buildTitlePrompt(firstTurn.user_prompt, firstTurn.agent_response),
124810
- execution_strategy: "auto_apply"
124811
- });
124812
- let reply = "";
124813
- const consume = (message) => {
124814
- if (message.type === "assistant") {
124815
- reply += message.content.filter((b) => b.type === "text").map((b) => b.text).join("");
124816
- } else if (message.type === "result" && !message.is_error && message.result) {
124817
- reply = message.result;
124818
- }
124819
- };
124820
- const reason = await streamAgentRuntimeMessages(
124821
- this.deps.client.baseUrl,
124822
- throwawayId,
124823
- consume,
124824
- { signal: controller.signal, deltas: false }
124825
- );
124826
- if (reason === "aborted") {
124827
- void this.deps.client.cancel(throwawayId).catch(() => {
124828
- });
124829
- }
124830
- const title = cleanTitle(reply);
124831
- if (title) this.applyTitle(title);
124832
- } finally {
124833
- clearTimeout(timer2);
124834
- }
124835
- } catch {
124882
+ const reply = await runThrowawayPrompt(this.deps.client, {
124883
+ model: pane?.model,
124884
+ prompt: buildTitlePrompt(firstTurn.user_prompt, firstTurn.agent_response),
124885
+ timeoutMs: TITLE_TIMEOUT_MS
124886
+ });
124887
+ const title = cleanTitle(reply ?? "");
124888
+ if (title) this.applyTitle(title);
124836
124889
  } finally {
124837
- if (throwawayId) {
124838
- void this.deps.client.deleteSession(throwawayId).catch(() => {
124839
- });
124840
- }
124841
124890
  titleGenerating3.delete(sessionId);
124842
124891
  }
124843
124892
  }
@@ -124863,11 +124912,7 @@ var TurnProjector = class {
124863
124912
  const db2 = getDb();
124864
124913
  const now = (/* @__PURE__ */ new Date()).toISOString();
124865
124914
  this.closeOpenItems("completed");
124866
- db2.prepare("UPDATE turns SET status = ?, updated_at = ? WHERE id = ?").run(
124867
- "aborted",
124868
- now,
124869
- this.deps.turnId
124870
- );
124915
+ db2.prepare("UPDATE turns SET status = ?, updated_at = ? WHERE id = ?").run("aborted", now, this.deps.turnId);
124871
124916
  recomputeSessionRunning(db2, this.deps.agentPaneSessionId);
124872
124917
  broadcast("turn:cancelled", {
124873
124918
  sessionId: this.deps.agentPaneSessionId,
@@ -124934,9 +124979,13 @@ var TurnProjector = class {
124934
124979
  const db2 = getDb();
124935
124980
  const now = (/* @__PURE__ */ new Date()).toISOString();
124936
124981
  this.closeOpenItems("completed");
124937
- db2.prepare(
124938
- "UPDATE turns SET status = ?, agent_response = ?, token_usage = ?, updated_at = ? WHERE id = ?"
124939
- ).run("completed", responseText || null, usage ? JSON.stringify(usage) : null, now, this.deps.turnId);
124982
+ db2.prepare("UPDATE turns SET status = ?, agent_response = ?, token_usage = ?, updated_at = ? WHERE id = ?").run(
124983
+ "completed",
124984
+ responseText || null,
124985
+ usage ? JSON.stringify(usage) : null,
124986
+ now,
124987
+ this.deps.turnId
124988
+ );
124940
124989
  recomputeSessionRunning(db2, this.deps.agentPaneSessionId, "active", true);
124941
124990
  broadcast("turn:completed", {
124942
124991
  sessionId: this.deps.agentPaneSessionId,
@@ -125005,9 +125054,7 @@ var TurnProjector = class {
125005
125054
  }
125006
125055
  };
125007
125056
  function extractFinalPlain(input) {
125008
- const action = input?.aiActions?.find(
125009
- (a) => a.action_type === "final" || a.action_type === "html_final"
125010
- );
125057
+ const action = input?.aiActions?.find((a) => a.action_type === "final" || a.action_type === "html_final");
125011
125058
  return action?.plain ?? null;
125012
125059
  }
125013
125060
  function buildTitlePrompt(userPrompt, agentResponse) {
@@ -125053,9 +125100,7 @@ var BACKEND_RESTARTED_ERROR = "The Repoburg backend restarted while this turn ra
125053
125100
  var BACKEND_UNREACHABLE_ERROR = `The Repoburg backend was unreachable for ${BACKEND_LOST_MS / 1e3} s while this turn ran, so the turn was lost. Send the prompt again.`;
125054
125101
  function isConnectionError(err) {
125055
125102
  const message = String(err?.message ?? "");
125056
- return /fetch failed|ECONNREFUSED|ENOTFOUND|ECONNRESET|ETIMEDOUT|EHOSTUNREACH|socket hang up/i.test(
125057
- message
125058
- );
125103
+ return /fetch failed|ECONNREFUSED|ENOTFOUND|ECONNRESET|ETIMEDOUT|EHOSTUNREACH|socket hang up/i.test(message);
125059
125104
  }
125060
125105
  async function ensureSession(session, client, baseUrl) {
125061
125106
  const existing = sessionMap3.get(session.id);
@@ -125165,12 +125210,7 @@ async function ensureContextWindow(entry) {
125165
125210
  }
125166
125211
  function failTurnBeforeStart(db2, sessionId, turnId, error51) {
125167
125212
  const now = (/* @__PURE__ */ new Date()).toISOString();
125168
- db2.prepare("UPDATE turns SET status = ?, error = ?, updated_at = ? WHERE id = ?").run(
125169
- "failed",
125170
- error51,
125171
- now,
125172
- turnId
125173
- );
125213
+ db2.prepare("UPDATE turns SET status = ?, error = ?, updated_at = ? WHERE id = ?").run("failed", error51, now, turnId);
125174
125214
  recomputeSessionRunning(db2, sessionId, "failed");
125175
125215
  broadcast("turn:failed", { sessionId, turnId, error: error51 });
125176
125216
  }
@@ -125225,7 +125265,7 @@ async function runStreamLoop(entry, projector) {
125225
125265
  });
125226
125266
  return;
125227
125267
  }
125228
- if (message.type === "system") {
125268
+ if (message.type === "system" && message.subtype === "init") {
125229
125269
  clearLostTimer();
125230
125270
  const bootId = message.bootId ?? null;
125231
125271
  if (active.bootId === void 0) active.bootId = bootId;
@@ -125587,6 +125627,21 @@ async function forkSession2(session, targetTurn) {
125587
125627
  const forked = await client.forkSession(session.external_thread_id, anchor);
125588
125628
  return forked.id;
125589
125629
  }
125630
+ var THREAD_SUMMARY_TIMEOUT_MS = 12e4;
125631
+ async function summarizeThread(session, _thread, transcript, directives) {
125632
+ try {
125633
+ const client = await resolveClient(session);
125634
+ const reply = await runThrowawayPrompt(client, {
125635
+ model: session.model,
125636
+ prompt: buildThreadSummaryPrompt(transcript, directives),
125637
+ timeoutMs: THREAD_SUMMARY_TIMEOUT_MS
125638
+ });
125639
+ return reply?.trim() || null;
125640
+ } catch (err) {
125641
+ console.error("[repoburg] summarizeThread failed:", err);
125642
+ return null;
125643
+ }
125644
+ }
125590
125645
  function clearAllThreads3() {
125591
125646
  for (const entry of sessionMap3.values()) {
125592
125647
  if (entry.activeTurn) {
@@ -125699,6 +125754,7 @@ var repoburgProvider = {
125699
125754
  getCommands: getCommands3,
125700
125755
  rewindRuntime,
125701
125756
  forkSession: forkSession2,
125757
+ summarizeThread,
125702
125758
  shutdown: shutdown3
125703
125759
  };
125704
125760