repoburg 1.3.318 → 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 (236) hide show
  1. package/agent-pane/backend/dist/index.js +361 -135
  2. package/agent-pane/backend/dist/server.js +361 -135
  3. package/agent-pane/frontend/dist/assets/{TerminalView-DRgcCvox.js → TerminalView-D5Hg3Fzf.js} +1 -1
  4. package/agent-pane/frontend/dist/assets/index-C1m0abtH.css +1 -0
  5. package/agent-pane/frontend/dist/assets/index-Cckb2tlY.js +852 -0
  6. package/agent-pane/frontend/dist/index.html +2 -2
  7. package/backend/dist/src/agent-runtime/agent-runtime-event-emitter.d.ts +2 -1
  8. package/backend/dist/src/agent-runtime/agent-runtime-event-emitter.js +10 -0
  9. package/backend/dist/src/agent-runtime/agent-runtime-event-emitter.js.map +1 -1
  10. package/backend/dist/src/agent-runtime/agent-runtime.types.d.ts +12 -1
  11. package/backend/dist/src/ai-actions/ai-action-batch.service.js +6 -3
  12. package/backend/dist/src/ai-actions/ai-action-batch.service.js.map +1 -1
  13. package/backend/dist/src/app.module.js +2 -9
  14. package/backend/dist/src/app.module.js.map +1 -1
  15. package/backend/dist/src/application-state/application-state.service.d.ts +8 -4
  16. package/backend/dist/src/application-state/application-state.service.js +39 -25
  17. package/backend/dist/src/application-state/application-state.service.js.map +1 -1
  18. package/backend/dist/src/context-generation/context-generation.service.js +3 -0
  19. package/backend/dist/src/context-generation/context-generation.service.js.map +1 -1
  20. package/backend/dist/src/context-generation/project-guidance.d.ts +12 -0
  21. package/backend/dist/src/context-generation/project-guidance.js +103 -0
  22. package/backend/dist/src/context-generation/project-guidance.js.map +1 -0
  23. package/backend/dist/src/core-entities/enums.d.ts +1 -0
  24. package/backend/dist/src/core-entities/enums.js +1 -0
  25. package/backend/dist/src/core-entities/enums.js.map +1 -1
  26. package/backend/dist/src/core-entities/mcp-config.entity.d.ts +3 -1
  27. package/backend/dist/src/core-entities/mcp-config.entity.js +17 -1
  28. package/backend/dist/src/core-entities/mcp-config.entity.js.map +1 -1
  29. package/backend/dist/src/global-config/dto/update-global-config.dto.d.ts +2 -0
  30. package/backend/dist/src/global-config/dto/update-global-config.dto.js +12 -0
  31. package/backend/dist/src/global-config/dto/update-global-config.dto.js.map +1 -1
  32. package/backend/dist/src/global-config/global-config.service.d.ts +3 -0
  33. package/backend/dist/src/global-config/global-config.service.js +15 -1
  34. package/backend/dist/src/global-config/global-config.service.js.map +1 -1
  35. package/backend/dist/src/interactive-chat/auto-compact.service.d.ts +34 -0
  36. package/backend/dist/src/interactive-chat/auto-compact.service.js +259 -0
  37. package/backend/dist/src/interactive-chat/auto-compact.service.js.map +1 -0
  38. package/backend/dist/src/interactive-chat/chat.module.js +2 -5
  39. package/backend/dist/src/interactive-chat/chat.module.js.map +1 -1
  40. package/backend/dist/src/interactive-chat/chat.service.d.ts +12 -4
  41. package/backend/dist/src/interactive-chat/chat.service.js +102 -39
  42. package/backend/dist/src/interactive-chat/chat.service.js.map +1 -1
  43. package/backend/dist/src/llm-orchestration/action-handlers/execute-code.handler.d.ts +1 -1
  44. package/backend/dist/src/llm-orchestration/action-handlers/execute-code.handler.js +8 -2
  45. package/backend/dist/src/llm-orchestration/action-handlers/execute-code.handler.js.map +1 -1
  46. package/backend/dist/src/llm-orchestration/action-handlers/mcp-tool-action.handler.d.ts +5 -2
  47. package/backend/dist/src/llm-orchestration/action-handlers/mcp-tool-action.handler.js +50 -17
  48. package/backend/dist/src/llm-orchestration/action-handlers/mcp-tool-action.handler.js.map +1 -1
  49. package/backend/dist/src/llm-orchestration/action-handlers/run-command.handler.js +9 -1
  50. package/backend/dist/src/llm-orchestration/action-handlers/run-command.handler.js.map +1 -1
  51. package/backend/dist/src/llm-orchestration/hooks/follow-up-post-execution.hook.js +8 -0
  52. package/backend/dist/src/llm-orchestration/hooks/follow-up-post-execution.hook.js.map +1 -1
  53. package/backend/dist/src/llm-orchestration/hooks/yolo-mode-post-execution.hook.js +2 -1
  54. package/backend/dist/src/llm-orchestration/hooks/yolo-mode-post-execution.hook.js.map +1 -1
  55. package/backend/dist/src/llm-orchestration/llm-orchestration.interfaces.d.ts +2 -0
  56. package/backend/dist/src/llm-orchestration/llm-orchestration.interfaces.js.map +1 -1
  57. package/backend/dist/src/llm-orchestration/llm-orchestration.module.js +0 -2
  58. package/backend/dist/src/llm-orchestration/llm-orchestration.module.js.map +1 -1
  59. package/backend/dist/src/llm-orchestration/llm-turn-processor.service.d.ts +8 -1
  60. package/backend/dist/src/llm-orchestration/llm-turn-processor.service.js +237 -194
  61. package/backend/dist/src/llm-orchestration/llm-turn-processor.service.js.map +1 -1
  62. package/backend/dist/src/llm-orchestration/turn-execution-plan.d.ts +18 -0
  63. package/backend/dist/src/llm-orchestration/turn-execution-plan.js +53 -0
  64. package/backend/dist/src/llm-orchestration/turn-execution-plan.js.map +1 -0
  65. package/backend/dist/src/llm-provider/alibaba-llm.provider.d.ts +18 -2
  66. package/backend/dist/src/llm-provider/alibaba-llm.provider.js +155 -17
  67. package/backend/dist/src/llm-provider/alibaba-llm.provider.js.map +1 -1
  68. package/backend/dist/src/llm-provider/credential-check.d.ts +3 -0
  69. package/backend/dist/src/llm-provider/credential-check.js +27 -0
  70. package/backend/dist/src/llm-provider/credential-check.js.map +1 -0
  71. package/backend/dist/src/llm-provider/dto/set-inference-credentials.dto.d.ts +5 -0
  72. package/backend/dist/src/{visual-editor/visual-editor.dto.js → llm-provider/dto/set-inference-credentials.dto.js} +24 -10
  73. package/backend/dist/src/llm-provider/dto/set-inference-credentials.dto.js.map +1 -0
  74. package/backend/dist/src/llm-provider/inference-credentials.service.d.ts +24 -0
  75. package/backend/dist/src/llm-provider/inference-credentials.service.js +120 -0
  76. package/backend/dist/src/llm-provider/inference-credentials.service.js.map +1 -0
  77. package/backend/dist/src/llm-provider/inference-registry.d.ts +15 -0
  78. package/backend/dist/src/llm-provider/inference-registry.js +68 -0
  79. package/backend/dist/src/llm-provider/inference-registry.js.map +1 -0
  80. package/backend/dist/src/llm-provider/llm-provider.controller.d.ts +15 -1
  81. package/backend/dist/src/llm-provider/llm-provider.controller.js +75 -3
  82. package/backend/dist/src/llm-provider/llm-provider.controller.js.map +1 -1
  83. package/backend/dist/src/llm-provider/llm-provider.interface.d.ts +34 -1
  84. package/backend/dist/src/llm-provider/llm-provider.interface.js +8 -1
  85. package/backend/dist/src/llm-provider/llm-provider.interface.js.map +1 -1
  86. package/backend/dist/src/llm-provider/llm-provider.module.js +5 -1
  87. package/backend/dist/src/llm-provider/llm-provider.module.js.map +1 -1
  88. package/backend/dist/src/llm-provider/ollama-llm.provider.d.ts +15 -6
  89. package/backend/dist/src/llm-provider/ollama-llm.provider.js +229 -85
  90. package/backend/dist/src/llm-provider/ollama-llm.provider.js.map +1 -1
  91. package/backend/dist/src/llm-provider/openai-llm.provider.d.ts +7 -2
  92. package/backend/dist/src/llm-provider/openai-llm.provider.js +50 -8
  93. package/backend/dist/src/llm-provider/openai-llm.provider.js.map +1 -1
  94. package/backend/dist/src/llm-provider/openrouter-llm.provider.d.ts +24 -2
  95. package/backend/dist/src/llm-provider/openrouter-llm.provider.js +132 -14
  96. package/backend/dist/src/llm-provider/openrouter-llm.provider.js.map +1 -1
  97. package/backend/dist/src/llm-provider/proxy-llm.provider.d.ts +4 -11
  98. package/backend/dist/src/llm-provider/proxy-llm.provider.js +17 -47
  99. package/backend/dist/src/llm-provider/proxy-llm.provider.js.map +1 -1
  100. package/backend/dist/src/llm-provider/reasoning.d.ts +9 -0
  101. package/backend/dist/src/llm-provider/reasoning.js +73 -0
  102. package/backend/dist/src/llm-provider/reasoning.js.map +1 -0
  103. package/backend/dist/src/llm-provider/zai-llm.provider.d.ts +24 -2
  104. package/backend/dist/src/llm-provider/zai-llm.provider.js +134 -17
  105. package/backend/dist/src/llm-provider/zai-llm.provider.js.map +1 -1
  106. package/backend/dist/src/llm-responses/llm-responses.module.js +0 -4
  107. package/backend/dist/src/llm-responses/llm-responses.module.js.map +1 -1
  108. package/backend/dist/src/llm-responses/llm-responses.service.d.ts +12 -4
  109. package/backend/dist/src/llm-responses/llm-responses.service.js +4 -45
  110. package/backend/dist/src/llm-responses/llm-responses.service.js.map +1 -1
  111. package/backend/dist/src/main.js +4 -0
  112. package/backend/dist/src/main.js.map +1 -1
  113. package/backend/dist/src/mcp/marketplace/dto/initiate-connect.dto.d.ts +3 -1
  114. package/backend/dist/src/mcp/marketplace/dto/initiate-connect.dto.js +19 -0
  115. package/backend/dist/src/mcp/marketplace/dto/initiate-connect.dto.js.map +1 -1
  116. package/backend/dist/src/mcp/marketplace/marketplace.controller.js +7 -0
  117. package/backend/dist/src/mcp/marketplace/marketplace.controller.js.map +1 -1
  118. package/backend/dist/src/mcp/marketplace/marketplace.service.d.ts +9 -0
  119. package/backend/dist/src/mcp/marketplace/marketplace.service.js +68 -13
  120. package/backend/dist/src/mcp/marketplace/marketplace.service.js.map +1 -1
  121. package/backend/dist/src/mcp/marketplace/oauth-provider.d.ts +3 -0
  122. package/backend/dist/src/mcp/marketplace/oauth-provider.js.map +1 -1
  123. package/backend/dist/src/mcp/mcp-result.d.ts +12 -0
  124. package/backend/dist/src/mcp/mcp-result.js +125 -0
  125. package/backend/dist/src/mcp/mcp-result.js.map +1 -0
  126. package/backend/dist/src/mcp/mcp.service.d.ts +33 -1
  127. package/backend/dist/src/mcp/mcp.service.js +364 -79
  128. package/backend/dist/src/mcp/mcp.service.js.map +1 -1
  129. package/backend/dist/src/metadata-store/schemas/metadata-schemas.d.ts +3 -1
  130. package/backend/dist/src/metadata-store/schemas/metadata-schemas.js +11 -1
  131. package/backend/dist/src/metadata-store/schemas/metadata-schemas.js.map +1 -1
  132. package/backend/dist/src/seeding/data/shared/project-guidance-section.d.ts +1 -0
  133. package/backend/dist/src/seeding/data/shared/project-guidance-section.js +22 -0
  134. package/backend/dist/src/seeding/data/shared/project-guidance-section.js.map +1 -0
  135. package/backend/dist/src/seeding/data/system-prompts/default_native_tool_agent.d.ts +1 -1
  136. package/backend/dist/src/seeding/data/system-prompts/default_native_tool_agent.js +10 -38
  137. package/backend/dist/src/seeding/data/system-prompts/default_native_tool_agent.js.map +1 -1
  138. package/backend/dist/src/seeding/data/system-prompts/explore-codebase-agent.d.ts +1 -1
  139. package/backend/dist/src/seeding/data/system-prompts/explore-codebase-agent.js +3 -1
  140. package/backend/dist/src/seeding/data/system-prompts/explore-codebase-agent.js.map +1 -1
  141. package/backend/dist/src/seeding/data/system-prompts/general-purpose-agent.d.ts +1 -1
  142. package/backend/dist/src/seeding/data/system-prompts/general-purpose-agent.js +3 -1
  143. package/backend/dist/src/seeding/data/system-prompts/general-purpose-agent.js.map +1 -1
  144. package/backend/dist/src/session-cancellation/session-cancellation.module.d.ts +2 -0
  145. package/backend/dist/src/{message-bus/message-bus.module.js → session-cancellation/session-cancellation.module.js} +10 -11
  146. package/backend/dist/src/session-cancellation/session-cancellation.module.js.map +1 -0
  147. package/backend/dist/src/session-cancellation/session-cancellation.service.d.ts +13 -0
  148. package/backend/dist/src/session-cancellation/session-cancellation.service.js +75 -0
  149. package/backend/dist/src/session-cancellation/session-cancellation.service.js.map +1 -0
  150. package/backend/dist/src/session-inputs/session-inputs.service.js +3 -1
  151. package/backend/dist/src/session-inputs/session-inputs.service.js.map +1 -1
  152. package/backend/dist/src/sessions/sessions.module.js +0 -2
  153. package/backend/dist/src/sessions/sessions.module.js.map +1 -1
  154. package/backend/dist/src/sessions/sessions.service.d.ts +1 -3
  155. package/backend/dist/src/sessions/sessions.service.js +1 -5
  156. package/backend/dist/src/sessions/sessions.service.js.map +1 -1
  157. package/backend/dist/src/tool-hooks/hook-runtime.d.ts +1 -1
  158. package/backend/dist/src/tool-hooks/hook-runtime.js +17 -16
  159. package/backend/dist/src/tool-hooks/hook-runtime.js.map +1 -1
  160. package/backend/dist/src/utils/spawn-with-kill.d.ts +2 -0
  161. package/backend/dist/src/utils/spawn-with-kill.js +18 -3
  162. package/backend/dist/src/utils/spawn-with-kill.js.map +1 -1
  163. package/backend/dist/tsconfig.build.tsbuildinfo +1 -1
  164. package/daemon/dist/index.js +1 -17
  165. package/package.json +2 -8
  166. package/platform-cli.js +0 -316
  167. package/tabtape/extension/dist/build-info.json +3 -3
  168. package/tabtape/extension/dist/manifest.json +1 -1
  169. package/tabtape/ui/dist/build-info.json +3 -3
  170. package/agent-pane/frontend/dist/assets/index-CvyygQ2I.js +0 -852
  171. package/agent-pane/frontend/dist/assets/index-nEHdBY3j.css +0 -1
  172. package/backend/dist/src/llm-responses/dto/submit-llm-response.dto.d.ts +0 -9
  173. package/backend/dist/src/llm-responses/dto/submit-llm-response.dto.js +0 -80
  174. package/backend/dist/src/llm-responses/dto/submit-llm-response.dto.js.map +0 -1
  175. package/backend/dist/src/llm-responses/llm-responses.controller.d.ts +0 -8
  176. package/backend/dist/src/llm-responses/llm-responses.controller.js +0 -51
  177. package/backend/dist/src/llm-responses/llm-responses.controller.js.map +0 -1
  178. package/backend/dist/src/mcp-server/mcp-internal.controller.d.ts +0 -12
  179. package/backend/dist/src/mcp-server/mcp-internal.controller.js +0 -50
  180. package/backend/dist/src/mcp-server/mcp-internal.controller.js.map +0 -1
  181. package/backend/dist/src/mcp-server/mcp-server.bootstrap.d.ts +0 -2
  182. package/backend/dist/src/mcp-server/mcp-server.bootstrap.js +0 -166
  183. package/backend/dist/src/mcp-server/mcp-server.bootstrap.js.map +0 -1
  184. package/backend/dist/src/mcp-server/mcp-server.constants.d.ts +0 -8
  185. package/backend/dist/src/mcp-server/mcp-server.constants.js +0 -12
  186. package/backend/dist/src/mcp-server/mcp-server.constants.js.map +0 -1
  187. package/backend/dist/src/mcp-server/mcp-server.controller.d.ts +0 -19
  188. package/backend/dist/src/mcp-server/mcp-server.controller.js +0 -72
  189. package/backend/dist/src/mcp-server/mcp-server.controller.js.map +0 -1
  190. package/backend/dist/src/mcp-server/mcp-server.module.d.ts +0 -2
  191. package/backend/dist/src/mcp-server/mcp-server.module.js +0 -29
  192. package/backend/dist/src/mcp-server/mcp-server.module.js.map +0 -1
  193. package/backend/dist/src/mcp-server/mcp-server.process.service.d.ts +0 -23
  194. package/backend/dist/src/mcp-server/mcp-server.process.service.js +0 -130
  195. package/backend/dist/src/mcp-server/mcp-server.process.service.js.map +0 -1
  196. package/backend/dist/src/mcp-server/mcp-server.service.d.ts +0 -34
  197. package/backend/dist/src/mcp-server/mcp-server.service.js +0 -260
  198. package/backend/dist/src/mcp-server/mcp-server.service.js.map +0 -1
  199. package/backend/dist/src/message-bus/dto/submit-message.dto.d.ts +0 -4
  200. package/backend/dist/src/message-bus/dto/submit-message.dto.js +0 -22
  201. package/backend/dist/src/message-bus/dto/submit-message.dto.js.map +0 -1
  202. package/backend/dist/src/message-bus/message-bus.controller.d.ts +0 -13
  203. package/backend/dist/src/message-bus/message-bus.controller.js +0 -50
  204. package/backend/dist/src/message-bus/message-bus.controller.js.map +0 -1
  205. package/backend/dist/src/message-bus/message-bus.module.d.ts +0 -2
  206. package/backend/dist/src/message-bus/message-bus.module.js.map +0 -1
  207. package/backend/dist/src/message-bus/message-bus.service.d.ts +0 -7
  208. package/backend/dist/src/message-bus/message-bus.service.js +0 -32
  209. package/backend/dist/src/message-bus/message-bus.service.js.map +0 -1
  210. package/backend/dist/src/visual-editor/visual-editor.controller.d.ts +0 -14
  211. package/backend/dist/src/visual-editor/visual-editor.controller.js +0 -101
  212. package/backend/dist/src/visual-editor/visual-editor.controller.js.map +0 -1
  213. package/backend/dist/src/visual-editor/visual-editor.dto.d.ts +0 -5
  214. package/backend/dist/src/visual-editor/visual-editor.dto.js.map +0 -1
  215. package/backend/dist/src/visual-editor/visual-editor.module.d.ts +0 -2
  216. package/backend/dist/src/visual-editor/visual-editor.module.js +0 -24
  217. package/backend/dist/src/visual-editor/visual-editor.module.js.map +0 -1
  218. package/daemon/dist/mcp-gateway.js +0 -401
  219. package/daemon/dist/mcp-gateway.spec.js +0 -295
  220. package/visual-editor-proxy/client/dist/main.js +0 -89
  221. package/visual-editor-proxy/client/tsconfig.json +0 -14
  222. package/visual-editor-proxy/dist/client/src/inspector.d.ts +0 -9
  223. package/visual-editor-proxy/dist/client/src/inspector.js +0 -96
  224. package/visual-editor-proxy/dist/client/src/inspector.js.map +0 -1
  225. package/visual-editor-proxy/dist/client/src/main.d.ts +0 -6
  226. package/visual-editor-proxy/dist/client/src/main.js +0 -108
  227. package/visual-editor-proxy/dist/client/src/main.js.map +0 -1
  228. package/visual-editor-proxy/dist/client/src/ui.d.ts +0 -6
  229. package/visual-editor-proxy/dist/client/src/ui.js +0 -153
  230. package/visual-editor-proxy/dist/client/src/ui.js.map +0 -1
  231. package/visual-editor-proxy/dist/src/main.d.ts +0 -1
  232. package/visual-editor-proxy/dist/src/main.js +0 -61
  233. package/visual-editor-proxy/dist/src/main.js.map +0 -1
  234. package/visual-editor-proxy/dist/tsconfig.tsbuildinfo +0 -1
  235. package/visual-editor-proxy/package.json +0 -21
  236. package/visual-editor-proxy/tsconfig.json +0 -21
@@ -11485,7 +11485,7 @@ var require_reply = __commonJS({
11485
11485
  }
11486
11486
  return serialize2;
11487
11487
  };
11488
- Reply.prototype.compileSerializationSchema = function(schema, httpStatus = null, contentType = null) {
11488
+ Reply.prototype.compileSerializationSchema = function(schema, httpStatus2 = null, contentType = null) {
11489
11489
  const { request } = this;
11490
11490
  const { method, url: url2 } = request;
11491
11491
  if (this[kRouteContext][kReplyCacheSerializeFns]?.has(schema)) {
@@ -11498,7 +11498,7 @@ var require_reply = __commonJS({
11498
11498
  schema,
11499
11499
  method,
11500
11500
  url: url2,
11501
- httpStatus,
11501
+ httpStatus: httpStatus2,
11502
11502
  contentType
11503
11503
  });
11504
11504
  if (this[kRouteContext][kReplyCacheSerializeFns] == null) {
@@ -11507,26 +11507,26 @@ var require_reply = __commonJS({
11507
11507
  this[kRouteContext][kReplyCacheSerializeFns].set(schema, serializeFn);
11508
11508
  return serializeFn;
11509
11509
  };
11510
- Reply.prototype.serializeInput = function(input, schema, httpStatus, contentType) {
11511
- const possibleContentType = httpStatus;
11510
+ Reply.prototype.serializeInput = function(input, schema, httpStatus2, contentType) {
11511
+ const possibleContentType = httpStatus2;
11512
11512
  let serialize2;
11513
- httpStatus = typeof schema === "string" || typeof schema === "number" ? schema : httpStatus;
11514
- contentType = httpStatus && possibleContentType !== httpStatus ? possibleContentType : contentType;
11515
- if (httpStatus != null) {
11513
+ httpStatus2 = typeof schema === "string" || typeof schema === "number" ? schema : httpStatus2;
11514
+ contentType = httpStatus2 && possibleContentType !== httpStatus2 ? possibleContentType : contentType;
11515
+ if (httpStatus2 != null) {
11516
11516
  if (contentType != null) {
11517
- serialize2 = this[kRouteContext][kSchemaResponse]?.[httpStatus]?.[contentType];
11517
+ serialize2 = this[kRouteContext][kSchemaResponse]?.[httpStatus2]?.[contentType];
11518
11518
  } else {
11519
- serialize2 = this[kRouteContext][kSchemaResponse]?.[httpStatus];
11519
+ serialize2 = this[kRouteContext][kSchemaResponse]?.[httpStatus2];
11520
11520
  }
11521
11521
  if (serialize2 == null) {
11522
- if (contentType) throw new FST_ERR_MISSING_CONTENTTYPE_SERIALIZATION_FN(httpStatus, contentType);
11523
- throw new FST_ERR_MISSING_SERIALIZATION_FN(httpStatus);
11522
+ if (contentType) throw new FST_ERR_MISSING_CONTENTTYPE_SERIALIZATION_FN(httpStatus2, contentType);
11523
+ throw new FST_ERR_MISSING_SERIALIZATION_FN(httpStatus2);
11524
11524
  }
11525
11525
  } else {
11526
11526
  if (this[kRouteContext][kReplyCacheSerializeFns]?.has(schema)) {
11527
11527
  serialize2 = this[kRouteContext][kReplyCacheSerializeFns].get(schema);
11528
11528
  } else {
11529
- serialize2 = this.compileSerializationSchema(schema, httpStatus, contentType);
11529
+ serialize2 = this.compileSerializationSchema(schema, httpStatus2, contentType);
11530
11530
  }
11531
11531
  }
11532
11532
  return serialize2(input);
@@ -43933,7 +43933,26 @@ async function registerProviderRoutes(fastify) {
43933
43933
  );
43934
43934
  }
43935
43935
 
43936
+ // src/providers/runtime-provider.ts
43937
+ var InferenceCredentialsError = class extends Error {
43938
+ };
43939
+
43936
43940
  // src/routes/models.ts
43941
+ function inferenceRuntime(id, reply) {
43942
+ const provider = hasProvider(id) ? getProvider(id) : void 0;
43943
+ if (!provider?.getInferenceProviders) {
43944
+ void reply.code(404).send({ error: `Provider ${id} has no inference providers` });
43945
+ return void 0;
43946
+ }
43947
+ return provider;
43948
+ }
43949
+ function sendInferenceError(reply, error51) {
43950
+ if (error51 instanceof InferenceCredentialsError) {
43951
+ return reply.code(400).send({ error: error51.message });
43952
+ }
43953
+ const message = error51 instanceof Error ? error51.message : String(error51);
43954
+ return reply.code(503).send({ error: message });
43955
+ }
43937
43956
  async function registerModelRoutes(fastify) {
43938
43957
  fastify.get(
43939
43958
  "/api/providers/:id/models",
@@ -43945,6 +43964,54 @@ async function registerModelRoutes(fastify) {
43945
43964
  return getProvider(id).getModels(request.query.cwd);
43946
43965
  }
43947
43966
  );
43967
+ fastify.get(
43968
+ "/api/providers/:id/inference",
43969
+ async (request, reply) => {
43970
+ const provider = inferenceRuntime(request.params.id, reply);
43971
+ if (!provider) return reply;
43972
+ try {
43973
+ return await provider.getInferenceProviders(request.query.cwd);
43974
+ } catch (error51) {
43975
+ return sendInferenceError(reply, error51);
43976
+ }
43977
+ }
43978
+ );
43979
+ fastify.put(
43980
+ "/api/providers/:id/inference/:inferenceId/credentials",
43981
+ async (request, reply) => {
43982
+ const provider = inferenceRuntime(request.params.id, reply);
43983
+ if (!provider) return reply;
43984
+ if (!provider.setInferenceCredentials) {
43985
+ return reply.code(404).send({ error: "This provider cannot save keys" });
43986
+ }
43987
+ const body = request.body ?? {};
43988
+ const field = (value) => typeof value === "string" ? value : void 0;
43989
+ try {
43990
+ return await provider.setInferenceCredentials(request.params.inferenceId, {
43991
+ apiKey: field(body.apiKey),
43992
+ baseUrl: field(body.baseUrl),
43993
+ cwd: field(body.cwd)
43994
+ });
43995
+ } catch (error51) {
43996
+ return sendInferenceError(reply, error51);
43997
+ }
43998
+ }
43999
+ );
44000
+ fastify.delete(
44001
+ "/api/providers/:id/inference/:inferenceId/credentials",
44002
+ async (request, reply) => {
44003
+ const provider = inferenceRuntime(request.params.id, reply);
44004
+ if (!provider) return reply;
44005
+ if (!provider.removeInferenceCredentials) {
44006
+ return reply.code(404).send({ error: "This provider cannot remove keys" });
44007
+ }
44008
+ try {
44009
+ return await provider.removeInferenceCredentials(request.params.inferenceId, request.query.cwd);
44010
+ } catch (error51) {
44011
+ return sendInferenceError(reply, error51);
44012
+ }
44013
+ }
44014
+ );
43948
44015
  }
43949
44016
 
43950
44017
  // src/routes/skills.ts
@@ -119760,6 +119827,21 @@ function reapOrphanCliProcesses(db2, deps = defaultDeps) {
119760
119827
  return reapOrphanProcesses(db2, "claude", deps);
119761
119828
  }
119762
119829
 
119830
+ // src/providers/thread-summary.ts
119831
+ function buildThreadSummaryPrompt(transcript, directives) {
119832
+ const directiveLine = directives.trim() ? `
119833
+
119834
+ The user has given these summarization directives \u2014 follow them exactly:
119835
+ "${directives.trim()}"` : "";
119836
+ 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}
119837
+
119838
+ The discussion transcript (from the discussion's beginning):
119839
+
119840
+ ${transcript}
119841
+
119842
+ 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.`;
119843
+ }
119844
+
119763
119845
  // src/codex/codex-provider.ts
119764
119846
  var TERMINAL_TASK_TYPE = "background_terminal";
119765
119847
  function taskPollMs() {
@@ -120091,7 +120173,9 @@ function completeTurn(db2, sessionId, turnId, usage) {
120091
120173
  const response = turnResponse(db2, turnId);
120092
120174
  const result = usage !== void 0 ? db2.prepare(
120093
120175
  "UPDATE turns SET status = 'completed', token_usage = ?, updated_at = ? WHERE id = ? AND status IN ('pending', 'running')"
120094
- ).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);
120176
+ ).run(JSON.stringify(usage), now, turnId) : db2.prepare(
120177
+ "UPDATE turns SET status = 'completed', updated_at = ? WHERE id = ? AND status IN ('pending', 'running')"
120178
+ ).run(now, turnId);
120095
120179
  if (result.changes === 0) return;
120096
120180
  broadcast("turn:completed", {
120097
120181
  sessionId,
@@ -120743,17 +120827,7 @@ async function summarizeCodexThread(session, _thread, transcript, directives) {
120743
120827
  ephemeral: true
120744
120828
  });
120745
120829
  const threadId = initResult.thread.id;
120746
- const directiveLine = directives.trim() ? `
120747
-
120748
- The user has given these summarization directives \u2014 follow them exactly:
120749
- "${directives.trim()}"` : "";
120750
- 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}
120751
-
120752
- The discussion transcript (from the discussion's beginning):
120753
-
120754
- ${transcript}
120755
-
120756
- 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.`;
120830
+ const summaryPrompt = buildThreadSummaryPrompt(transcript, directives);
120757
120831
  let summaryResolve;
120758
120832
  let summaryReject;
120759
120833
  const summaryPromise = new Promise((resolve, reject) => {
@@ -120859,7 +120933,10 @@ async function forkSession(session, targetTurn) {
120859
120933
  try {
120860
120934
  result = await fork({ lastTurnId });
120861
120935
  } catch (err) {
120862
- const range = await client.request("thread/read", { threadId, includeTurns: true }).then(({ thread }) => forkThroughReview(thread.turns ?? [], lastTurnId), () => void 0);
120936
+ const range = await client.request("thread/read", { threadId, includeTurns: true }).then(
120937
+ ({ thread }) => forkThroughReview(thread.turns ?? [], lastTurnId),
120938
+ () => void 0
120939
+ );
120863
120940
  if (!range) throw err;
120864
120941
  result = await fork(range);
120865
120942
  }
@@ -121100,7 +121177,9 @@ function hostFor(sessionId, cwd, options, onDirect) {
121100
121177
  const { command, args } = appServerCommand(options);
121101
121178
  return startCodexHost(getDb(), { sessionId, cwd, command, args, env: { ...process.env }, onDirect });
121102
121179
  } catch (err) {
121103
- console.error(`[codex] no session host for ${sessionId} (${err.message}); running the app-server directly`);
121180
+ console.error(
121181
+ `[codex] no session host for ${sessionId} (${err.message}); running the app-server directly`
121182
+ );
121104
121183
  return null;
121105
121184
  }
121106
121185
  }
@@ -121154,7 +121233,9 @@ function settleHostTurn(entry) {
121154
121233
  function maybeRetire(entry) {
121155
121234
  const why = entry.retireWhenIdle;
121156
121235
  if (!why || entry.replaying || entry.turns.length > 0 || !isCurrent(entry)) return;
121157
- console.log(`[codex] closing the idle app-server of session ${entry.sessionId} (${why}); the next prompt starts a new one`);
121236
+ console.log(
121237
+ `[codex] closing the idle app-server of session ${entry.sessionId} (${why}); the next prompt starts a new one`
121238
+ );
121158
121239
  void retireEntry(entry, "keep");
121159
121240
  }
121160
121241
  function detachEntry(entry) {
@@ -121316,7 +121397,9 @@ var codexHostAdopter = {
121316
121397
  if (!session || session.runtime_type !== "codex") return;
121317
121398
  const detail = describeExit(exit);
121318
121399
  const threadId = row.external_id ?? session.external_thread_id;
121319
- console.log(`[codex] the app-server of session ${session.id} ended with no daemon attached (${detail}); replaying its log`);
121400
+ console.log(
121401
+ `[codex] the app-server of session ${session.id} ended with no daemon attached (${detail}); replaying its log`
121402
+ );
121320
121403
  if (log && log.length > 0 && threadId) {
121321
121404
  const logged = new LoggedAppServer();
121322
121405
  const client = new AppServerClient({ cwd: session.cwd ?? process.cwd(), process: logged, replaying: true });
@@ -123347,7 +123430,7 @@ Agent responded: "${truncatedResponse}"`;
123347
123430
  }
123348
123431
  }
123349
123432
  }
123350
- function buildThreadSummaryPrompt(transcript, directives, hasNativeContext) {
123433
+ function buildThreadSummaryPrompt2(transcript, directives, hasNativeContext) {
123351
123434
  const directiveLine = directives.trim() ? `
123352
123435
 
123353
123436
  The user has given these summarization directives \u2014 follow them exactly:
@@ -123375,7 +123458,7 @@ async function summarizeClaudeThread(session, thread, transcript, directives) {
123375
123458
  console.error("[claude] summarizeThread fork failed \u2014 falling back to embedded transcript:", err);
123376
123459
  }
123377
123460
  }
123378
- const prompt = buildThreadSummaryPrompt(transcript, directives, !!resumeId);
123461
+ const prompt = buildThreadSummaryPrompt2(transcript, directives, !!resumeId);
123379
123462
  q = query({
123380
123463
  prompt,
123381
123464
  options: {
@@ -123672,6 +123755,22 @@ var claudeProvider = {
123672
123755
  };
123673
123756
 
123674
123757
  // src/repoburg/repoburg-client.ts
123758
+ var RepoburgHttpError = class extends Error {
123759
+ constructor(message, status, detail) {
123760
+ super(message);
123761
+ this.status = status;
123762
+ this.detail = detail;
123763
+ }
123764
+ };
123765
+ function errorDetail(body) {
123766
+ const parsed = body;
123767
+ const message = parsed?.error && typeof parsed.error === "object" ? parsed.error.message : parsed?.message;
123768
+ if (typeof message === "string") return message || null;
123769
+ if (Array.isArray(message)) {
123770
+ return message.filter((m) => typeof m === "string").join("; ") || null;
123771
+ }
123772
+ return null;
123773
+ }
123675
123774
  function defaultRepoburgBaseUrl() {
123676
123775
  return process.env.REPOBURG_BACKEND_URL || "http://localhost:3000";
123677
123776
  }
@@ -123699,7 +123798,12 @@ var RepoburgHttpClient = class {
123699
123798
  `${method} ${path21} failed: ${response.status} HTML response from ${this.baseUrl} \u2014 the URL points to the wrong server`
123700
123799
  );
123701
123800
  }
123702
- throw new Error(`${method} ${path21} failed: ${response.status} ${text2}`);
123801
+ let detail = null;
123802
+ try {
123803
+ detail = errorDetail(JSON.parse(text2));
123804
+ } catch {
123805
+ }
123806
+ throw new RepoburgHttpError(`${method} ${path21} failed: ${response.status} ${text2}`, response.status, detail);
123703
123807
  }
123704
123808
  if (text2.length === 0) return void 0;
123705
123809
  try {
@@ -123755,6 +123859,26 @@ var RepoburgHttpClient = class {
123755
123859
  const result = await this.request("GET", "/llm-provider/models");
123756
123860
  return result.models ?? [];
123757
123861
  }
123862
+ async getInferenceProviders() {
123863
+ const result = await this.request(
123864
+ "GET",
123865
+ "/llm-provider/inference-providers"
123866
+ );
123867
+ return result.providers ?? [];
123868
+ }
123869
+ async setInferenceCredentials(id, dto) {
123870
+ return this.request(
123871
+ "PUT",
123872
+ `/llm-provider/inference-providers/${encodeURIComponent(id)}/credentials`,
123873
+ dto
123874
+ );
123875
+ }
123876
+ async removeInferenceCredentials(id) {
123877
+ return this.request(
123878
+ "DELETE",
123879
+ `/llm-provider/inference-providers/${encodeURIComponent(id)}/credentials`
123880
+ );
123881
+ }
123758
123882
  async getSlashCommands() {
123759
123883
  return this.request("GET", "/slash-commands");
123760
123884
  }
@@ -123948,7 +124072,7 @@ function parseSelectionGroups(raw) {
123948
124072
  }).filter((g) => g !== null);
123949
124073
  }
123950
124074
  function mapActionToItem(action) {
123951
- const failed = action.status === "EXECUTION_FAILED";
124075
+ const failed = String(action.status ?? "").toLowerCase() === "execution_failed";
123952
124076
  const status = failed ? "failed" : "completed";
123953
124077
  const log = action.executionLogs?.[0];
123954
124078
  const output = log?.output ?? "";
@@ -124171,11 +124295,7 @@ async function streamAgentRuntimeMessages(baseUrl, sessionId, onMessage, opts =
124171
124295
  await reconnectDelay(delayMs, opts.signal);
124172
124296
  continue;
124173
124297
  }
124174
- const reason = await readBody(
124175
- response.body,
124176
- onMessage,
124177
- opts
124178
- );
124298
+ const reason = await readBody(response.body, onMessage, opts);
124179
124299
  if (reason !== null) {
124180
124300
  await response.body.cancel().catch(() => {
124181
124301
  });
@@ -124250,6 +124370,50 @@ function reconnectDelay(delayMs, signal) {
124250
124370
  });
124251
124371
  }
124252
124372
 
124373
+ // src/repoburg/throwaway-run.ts
124374
+ async function runThrowawayPrompt(client, options) {
124375
+ let throwawayId = null;
124376
+ try {
124377
+ const created = await client.createSession(options.model ? { model_id: options.model } : {});
124378
+ throwawayId = created.id;
124379
+ const controller = new AbortController();
124380
+ const timer2 = setTimeout(() => controller.abort(), options.timeoutMs);
124381
+ try {
124382
+ await client.createInput(throwawayId, {
124383
+ user_prompt: options.prompt,
124384
+ execution_strategy: "auto_apply"
124385
+ });
124386
+ let reply = "";
124387
+ let failed = false;
124388
+ const consume = (message) => {
124389
+ if (message.type === "assistant") {
124390
+ reply += message.content.filter((b) => b.type === "text").map((b) => b.text).join("");
124391
+ } else if (message.type === "result") {
124392
+ if (message.is_error) failed = true;
124393
+ else if (message.result) reply = message.result;
124394
+ }
124395
+ };
124396
+ const reason = await streamAgentRuntimeMessages(client.baseUrl, throwawayId, consume, {
124397
+ signal: controller.signal,
124398
+ deltas: false
124399
+ });
124400
+ if (reason === "aborted") {
124401
+ void client.cancel(throwawayId).catch(() => {
124402
+ });
124403
+ return null;
124404
+ }
124405
+ return failed ? null : reply;
124406
+ } finally {
124407
+ clearTimeout(timer2);
124408
+ }
124409
+ } catch {
124410
+ return null;
124411
+ } finally {
124412
+ if (throwawayId) void client.deleteSession(throwawayId).catch(() => {
124413
+ });
124414
+ }
124415
+ }
124416
+
124253
124417
  // src/repoburg/turn-projector.ts
124254
124418
  var RESULT_TIMEOUT_MS = 15 * 6e4;
124255
124419
  var MAX_RESULT_EXTENSIONS = 3;
@@ -124284,8 +124448,8 @@ var TurnProjector = class {
124284
124448
  }
124285
124449
  switch (message.type) {
124286
124450
  case "system":
124451
+ if (message.subtype === "compact_boundary") this.handleCompactBoundary(message);
124287
124452
  break;
124288
- // init — connection marker only; gaps go to recoverGap
124289
124453
  case "stream_event":
124290
124454
  this.handleStreamEvent(message);
124291
124455
  break;
@@ -124402,10 +124566,7 @@ var TurnProjector = class {
124402
124566
  }
124403
124567
  if (ids.includes(inputId)) return;
124404
124568
  ids.push(inputId);
124405
- db2.prepare("UPDATE turns SET runtime_input_ids = ? WHERE id = ?").run(
124406
- JSON.stringify(ids),
124407
- this.deps.turnId
124408
- );
124569
+ db2.prepare("UPDATE turns SET runtime_input_ids = ? WHERE id = ?").run(JSON.stringify(ids), this.deps.turnId);
124409
124570
  } catch {
124410
124571
  }
124411
124572
  }
@@ -124480,7 +124641,14 @@ var TurnProjector = class {
124480
124641
  else info.reasoningItemId = existing.id;
124481
124642
  const data = existing.data ? JSON.parse(existing.data) : {};
124482
124643
  if (existing.status !== "completed" || data.text !== text2) {
124483
- completeItem(db2, this.deps.agentPaneSessionId, this.deps.turnId, { ...existing, data }, { text: text2 }, "completed");
124644
+ completeItem(
124645
+ db2,
124646
+ this.deps.agentPaneSessionId,
124647
+ this.deps.turnId,
124648
+ { ...existing, data },
124649
+ { text: text2 },
124650
+ "completed"
124651
+ );
124484
124652
  }
124485
124653
  return;
124486
124654
  }
@@ -124497,6 +124665,28 @@ var TurnProjector = class {
124497
124665
  if (kind === "message") info.messageItemId = item.id;
124498
124666
  else info.reasoningItemId = item.id;
124499
124667
  }
124668
+ /** The backend compacted the context: a "Context compacted" row (the
124669
+ * item Claude sessions show), and the context counter drops to the fill
124670
+ * after it. */
124671
+ handleCompactBoundary(msg) {
124672
+ const meta3 = msg.compact_metadata;
124673
+ const externalId = `compact-${msg.seq ?? Date.now()}`;
124674
+ if (this.existingItemId(externalId)) return;
124675
+ insertItem(
124676
+ getDb(),
124677
+ this.deps.agentPaneSessionId,
124678
+ this.deps.turnId,
124679
+ externalId,
124680
+ "context_compaction",
124681
+ { trigger: meta3.trigger, pre_tokens: meta3.pre_tokens, post_tokens: meta3.post_tokens },
124682
+ "completed",
124683
+ "item:completed"
124684
+ );
124685
+ if (meta3.post_tokens > 0) {
124686
+ this.lastContextTokens = meta3.post_tokens;
124687
+ this.emitContextUsage();
124688
+ }
124689
+ }
124500
124690
  existingItemId(externalId) {
124501
124691
  const row = getDb().prepare("SELECT id FROM items WHERE turn_id = ? AND external_item_id = ?").get(this.deps.turnId, externalId);
124502
124692
  return row?.id ?? null;
@@ -124616,9 +124806,13 @@ var TurnProjector = class {
124616
124806
  output: msg.usage.output_tokens
124617
124807
  }) : null;
124618
124808
  this.closeOpenItems("completed");
124619
- db2.prepare(
124620
- "UPDATE turns SET status = ?, agent_response = ?, token_usage = ?, updated_at = ? WHERE id = ?"
124621
- ).run("completed", responseText || null, usage ? JSON.stringify(usage) : null, now, this.deps.turnId);
124809
+ db2.prepare("UPDATE turns SET status = ?, agent_response = ?, token_usage = ?, updated_at = ? WHERE id = ?").run(
124810
+ "completed",
124811
+ responseText || null,
124812
+ usage ? JSON.stringify(usage) : null,
124813
+ now,
124814
+ this.deps.turnId
124815
+ );
124622
124816
  recomputeSessionRunning(db2, this.deps.agentPaneSessionId, "active", true);
124623
124817
  broadcast("turn:completed", {
124624
124818
  sessionId: this.deps.agentPaneSessionId,
@@ -124662,9 +124856,7 @@ var TurnProjector = class {
124662
124856
  async syncTitle() {
124663
124857
  try {
124664
124858
  const db2 = getDb();
124665
- const session = db2.prepare("SELECT title FROM sessions WHERE id = ?").get(
124666
- this.deps.agentPaneSessionId
124667
- );
124859
+ const session = db2.prepare("SELECT title FROM sessions WHERE id = ?").get(this.deps.agentPaneSessionId);
124668
124860
  if (!session || session.title) return;
124669
124861
  const runtimeSession = await this.deps.client.getSession(this.deps.repoburgSessionId);
124670
124862
  const title = (runtimeSession.session_title || "").trim();
@@ -124695,54 +124887,19 @@ var TurnProjector = class {
124695
124887
  const sessionId = this.deps.agentPaneSessionId;
124696
124888
  if (titleGenerating3.has(sessionId)) return;
124697
124889
  const db2 = getDb();
124698
- const firstTurn = db2.prepare(
124699
- "SELECT user_prompt, agent_response FROM turns WHERE session_id = ? ORDER BY created_at ASC LIMIT 1"
124700
- ).get(sessionId);
124890
+ const firstTurn = db2.prepare("SELECT user_prompt, agent_response FROM turns WHERE session_id = ? ORDER BY created_at ASC LIMIT 1").get(sessionId);
124701
124891
  if (!firstTurn) return;
124702
124892
  titleGenerating3.add(sessionId);
124703
- let throwawayId = null;
124704
124893
  try {
124705
124894
  const pane = db2.prepare("SELECT model FROM sessions WHERE id = ?").get(sessionId);
124706
- const created = await this.deps.client.createSession(
124707
- pane?.model ? { model_id: pane.model } : {}
124708
- );
124709
- throwawayId = created.id;
124710
- const controller = new AbortController();
124711
- const timer2 = setTimeout(() => controller.abort(), TITLE_TIMEOUT_MS);
124712
- try {
124713
- await this.deps.client.createInput(throwawayId, {
124714
- user_prompt: buildTitlePrompt(firstTurn.user_prompt, firstTurn.agent_response),
124715
- execution_strategy: "auto_apply"
124716
- });
124717
- let reply = "";
124718
- const consume = (message) => {
124719
- if (message.type === "assistant") {
124720
- reply += message.content.filter((b) => b.type === "text").map((b) => b.text).join("");
124721
- } else if (message.type === "result" && !message.is_error && message.result) {
124722
- reply = message.result;
124723
- }
124724
- };
124725
- const reason = await streamAgentRuntimeMessages(
124726
- this.deps.client.baseUrl,
124727
- throwawayId,
124728
- consume,
124729
- { signal: controller.signal, deltas: false }
124730
- );
124731
- if (reason === "aborted") {
124732
- void this.deps.client.cancel(throwawayId).catch(() => {
124733
- });
124734
- }
124735
- const title = cleanTitle(reply);
124736
- if (title) this.applyTitle(title);
124737
- } finally {
124738
- clearTimeout(timer2);
124739
- }
124740
- } catch {
124895
+ const reply = await runThrowawayPrompt(this.deps.client, {
124896
+ model: pane?.model,
124897
+ prompt: buildTitlePrompt(firstTurn.user_prompt, firstTurn.agent_response),
124898
+ timeoutMs: TITLE_TIMEOUT_MS
124899
+ });
124900
+ const title = cleanTitle(reply ?? "");
124901
+ if (title) this.applyTitle(title);
124741
124902
  } finally {
124742
- if (throwawayId) {
124743
- void this.deps.client.deleteSession(throwawayId).catch(() => {
124744
- });
124745
- }
124746
124903
  titleGenerating3.delete(sessionId);
124747
124904
  }
124748
124905
  }
@@ -124768,11 +124925,7 @@ var TurnProjector = class {
124768
124925
  const db2 = getDb();
124769
124926
  const now = (/* @__PURE__ */ new Date()).toISOString();
124770
124927
  this.closeOpenItems("completed");
124771
- db2.prepare("UPDATE turns SET status = ?, updated_at = ? WHERE id = ?").run(
124772
- "aborted",
124773
- now,
124774
- this.deps.turnId
124775
- );
124928
+ db2.prepare("UPDATE turns SET status = ?, updated_at = ? WHERE id = ?").run("aborted", now, this.deps.turnId);
124776
124929
  recomputeSessionRunning(db2, this.deps.agentPaneSessionId);
124777
124930
  broadcast("turn:cancelled", {
124778
124931
  sessionId: this.deps.agentPaneSessionId,
@@ -124839,9 +124992,13 @@ var TurnProjector = class {
124839
124992
  const db2 = getDb();
124840
124993
  const now = (/* @__PURE__ */ new Date()).toISOString();
124841
124994
  this.closeOpenItems("completed");
124842
- db2.prepare(
124843
- "UPDATE turns SET status = ?, agent_response = ?, token_usage = ?, updated_at = ? WHERE id = ?"
124844
- ).run("completed", responseText || null, usage ? JSON.stringify(usage) : null, now, this.deps.turnId);
124995
+ db2.prepare("UPDATE turns SET status = ?, agent_response = ?, token_usage = ?, updated_at = ? WHERE id = ?").run(
124996
+ "completed",
124997
+ responseText || null,
124998
+ usage ? JSON.stringify(usage) : null,
124999
+ now,
125000
+ this.deps.turnId
125001
+ );
124845
125002
  recomputeSessionRunning(db2, this.deps.agentPaneSessionId, "active", true);
124846
125003
  broadcast("turn:completed", {
124847
125004
  sessionId: this.deps.agentPaneSessionId,
@@ -124910,9 +125067,7 @@ var TurnProjector = class {
124910
125067
  }
124911
125068
  };
124912
125069
  function extractFinalPlain(input) {
124913
- const action = input?.aiActions?.find(
124914
- (a) => a.action_type === "final" || a.action_type === "html_final"
124915
- );
125070
+ const action = input?.aiActions?.find((a) => a.action_type === "final" || a.action_type === "html_final");
124916
125071
  return action?.plain ?? null;
124917
125072
  }
124918
125073
  function buildTitlePrompt(userPrompt, agentResponse) {
@@ -124929,22 +125084,27 @@ function cleanTitle(raw) {
124929
125084
  }
124930
125085
 
124931
125086
  // src/repoburg/repoburg-provider.ts
124932
- var REASONING_LEVELS = [
125087
+ var FALLBACK_REASONING_LEVELS = [
124933
125088
  { effort: "low", label: "Low" },
124934
125089
  { effort: "medium", label: "Medium" },
124935
125090
  { effort: "high", label: "High" },
124936
125091
  { effort: "xhigh", label: "Extra High" }
124937
125092
  ];
124938
- var OLLAMA_REASONING_LEVELS = REASONING_LEVELS.filter((l) => l.effort !== "xhigh");
124939
- function mapReasoningEffort(modelId, effort) {
124940
- if (!effort) return void 0;
124941
- if (!["xhigh", "high", "medium", "low", "minimal", "none"].includes(effort)) return void 0;
124942
- if (modelId?.startsWith("ollama/")) {
124943
- if (effort === "xhigh") return "high";
124944
- if (effort === "low" || effort === "medium" || effort === "high") return effort;
124945
- return void 0;
124946
- }
124947
- return effort;
125093
+ var FALLBACK_OLLAMA_LEVELS = FALLBACK_REASONING_LEVELS.filter((l) => l.effort !== "xhigh");
125094
+ var RUNTIME_EFFORTS = /* @__PURE__ */ new Set(["none", "minimal", "low", "medium", "high", "xhigh", "max"]);
125095
+ function mapReasoningEffort(effort) {
125096
+ return effort && RUNTIME_EFFORTS.has(effort) ? effort : void 0;
125097
+ }
125098
+ var INFERENCE_PROVIDER_IDS = /* @__PURE__ */ new Set(["ollama", "zai", "alibaba", "openrouter", "openai"]);
125099
+ function inferenceProviderOf(modelId) {
125100
+ const slash = modelId.indexOf("/");
125101
+ if (slash <= 0) return void 0;
125102
+ const prefix = modelId.slice(0, slash);
125103
+ return INFERENCE_PROVIDER_IDS.has(prefix) ? prefix : "openrouter";
125104
+ }
125105
+ function httpStatus(error51) {
125106
+ const status = error51?.status;
125107
+ return typeof status === "number" ? status : void 0;
124948
125108
  }
124949
125109
  var sessionMap3 = /* @__PURE__ */ new Map();
124950
125110
  var STALLED_STREAM_MS = 6e4;
@@ -124953,9 +125113,7 @@ var BACKEND_RESTARTED_ERROR = "The Repoburg backend restarted while this turn ra
124953
125113
  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.`;
124954
125114
  function isConnectionError(err) {
124955
125115
  const message = String(err?.message ?? "");
124956
- return /fetch failed|ECONNREFUSED|ENOTFOUND|ECONNRESET|ETIMEDOUT|EHOSTUNREACH|socket hang up/i.test(
124957
- message
124958
- );
125116
+ return /fetch failed|ECONNREFUSED|ENOTFOUND|ECONNRESET|ETIMEDOUT|EHOSTUNREACH|socket hang up/i.test(message);
124959
125117
  }
124960
125118
  async function ensureSession(session, client, baseUrl) {
124961
125119
  const existing = sessionMap3.get(session.id);
@@ -124978,7 +125136,7 @@ async function ensureSession(session, client, baseUrl) {
124978
125136
  sessionMap3.set(session.id, entry2);
124979
125137
  return entry2;
124980
125138
  }
124981
- const mappedEffort = mapReasoningEffort(session.model, session.model_reasoning_effort);
125139
+ const mappedEffort = mapReasoningEffort(session.model_reasoning_effort);
124982
125140
  const created = await client.createSession({
124983
125141
  session_title: session.title ?? void 0,
124984
125142
  model_id: session.model || void 0,
@@ -125017,7 +125175,7 @@ async function ensureThreadSession(session, turn, client, baseUrl) {
125017
125175
  const created = await client.createSession({
125018
125176
  session_title: session.title ? `Discussion: ${session.title}` : "Discussion",
125019
125177
  model_id: session.model || void 0,
125020
- reasoning_effort: mapReasoningEffort(session.model, session.model_reasoning_effort)
125178
+ reasoning_effort: mapReasoningEffort(session.model_reasoning_effort)
125021
125179
  });
125022
125180
  runtimeId = created.id;
125023
125181
  const now = (/* @__PURE__ */ new Date()).toISOString();
@@ -125065,12 +125223,7 @@ async function ensureContextWindow(entry) {
125065
125223
  }
125066
125224
  function failTurnBeforeStart(db2, sessionId, turnId, error51) {
125067
125225
  const now = (/* @__PURE__ */ new Date()).toISOString();
125068
- db2.prepare("UPDATE turns SET status = ?, error = ?, updated_at = ? WHERE id = ?").run(
125069
- "failed",
125070
- error51,
125071
- now,
125072
- turnId
125073
- );
125226
+ db2.prepare("UPDATE turns SET status = ?, error = ?, updated_at = ? WHERE id = ?").run("failed", error51, now, turnId);
125074
125227
  recomputeSessionRunning(db2, sessionId, "failed");
125075
125228
  broadcast("turn:failed", { sessionId, turnId, error: error51 });
125076
125229
  }
@@ -125125,7 +125278,7 @@ async function runStreamLoop(entry, projector) {
125125
125278
  });
125126
125279
  return;
125127
125280
  }
125128
- if (message.type === "system") {
125281
+ if (message.type === "system" && message.subtype === "init") {
125129
125282
  clearLostTimer();
125130
125283
  const bootId = message.bootId ?? null;
125131
125284
  if (active.bootId === void 0) active.bootId = bootId;
@@ -125223,7 +125376,7 @@ async function startTurn4(session, turn) {
125223
125376
  entry.client = client;
125224
125377
  }
125225
125378
  const wantedModel = session.model || null;
125226
- const wantedEffort = mapReasoningEffort(session.model, session.model_reasoning_effort);
125379
+ const wantedEffort = mapReasoningEffort(session.model_reasoning_effort);
125227
125380
  if (wantedModel !== entry.modelId || wantedEffort !== entry.reasoningEffort) {
125228
125381
  try {
125229
125382
  await entry.client.patchSession(entry.repoburgSessionId, {
@@ -125487,6 +125640,21 @@ async function forkSession2(session, targetTurn) {
125487
125640
  const forked = await client.forkSession(session.external_thread_id, anchor);
125488
125641
  return forked.id;
125489
125642
  }
125643
+ var THREAD_SUMMARY_TIMEOUT_MS = 12e4;
125644
+ async function summarizeThread(session, _thread, transcript, directives) {
125645
+ try {
125646
+ const client = await resolveClient(session);
125647
+ const reply = await runThrowawayPrompt(client, {
125648
+ model: session.model,
125649
+ prompt: buildThreadSummaryPrompt(transcript, directives),
125650
+ timeoutMs: THREAD_SUMMARY_TIMEOUT_MS
125651
+ });
125652
+ return reply?.trim() || null;
125653
+ } catch (err) {
125654
+ console.error("[repoburg] summarizeThread failed:", err);
125655
+ return null;
125656
+ }
125657
+ }
125490
125658
  function clearAllThreads3() {
125491
125659
  for (const entry of sessionMap3.values()) {
125492
125660
  if (entry.activeTurn) {
@@ -125503,18 +125671,72 @@ async function getModels3(cwd) {
125503
125671
  const resolved = await resolveBackendUrl(cwd ?? process.cwd(), { autoStart: false });
125504
125672
  if (!resolved) return [];
125505
125673
  const models = await new RepoburgHttpClient(resolved.baseUrl).getModels();
125506
- return models.map((m) => ({
125507
- slug: m.id,
125508
- displayName: m.name,
125509
- description: "Repoburg backend",
125510
- defaultReasoning: "medium",
125511
- // Ollama rejects xhigh/minimal/none as `think` — offer only valid levels.
125512
- reasoningLevels: m.id.startsWith("ollama/") ? OLLAMA_REASONING_LEVELS : REASONING_LEVELS
125513
- }));
125674
+ return models.map((m) => {
125675
+ const levels = m.reasoning_levels ?? (m.id.startsWith("ollama/") ? FALLBACK_OLLAMA_LEVELS : FALLBACK_REASONING_LEVELS);
125676
+ const inferenceProvider = m.provider ?? inferenceProviderOf(m.id);
125677
+ return {
125678
+ slug: m.id,
125679
+ displayName: m.name,
125680
+ description: m.description ?? "Repoburg backend",
125681
+ // '' = the model's own default, which the runtime does not name.
125682
+ defaultReasoning: m.default_reasoning ?? (m.reasoning_levels ? "" : "medium"),
125683
+ reasoningLevels: levels,
125684
+ ...inferenceProvider ? { inferenceProvider } : {},
125685
+ ...m.aliases?.length ? { aliases: m.aliases } : {},
125686
+ ...m.capabilities ? { capabilities: m.capabilities } : {},
125687
+ ...m.context_window ? { contextWindow: m.context_window } : {}
125688
+ };
125689
+ });
125514
125690
  } catch {
125515
125691
  return [];
125516
125692
  }
125517
125693
  }
125694
+ async function runtimeFor(cwd) {
125695
+ const resolved = await resolveBackendUrl(cwd ?? process.cwd(), { autoStart: Boolean(cwd) });
125696
+ if (!resolved) {
125697
+ throw new Error("Repoburg is not running for this workspace.");
125698
+ }
125699
+ return new RepoburgHttpClient(resolved.baseUrl);
125700
+ }
125701
+ async function getInferenceProviders(cwd) {
125702
+ const client = await runtimeFor(cwd);
125703
+ try {
125704
+ return await client.getInferenceProviders();
125705
+ } catch (error51) {
125706
+ if (httpStatus(error51) === 404) return [];
125707
+ throw error51;
125708
+ }
125709
+ }
125710
+ async function setInferenceCredentials(id, input) {
125711
+ const client = await runtimeFor(input.cwd);
125712
+ try {
125713
+ return await client.setInferenceCredentials(id, {
125714
+ ...input.apiKey ? { apiKey: input.apiKey } : {},
125715
+ ...input.baseUrl ? { baseUrl: input.baseUrl } : {}
125716
+ });
125717
+ } catch (error51) {
125718
+ throw credentialsError(error51);
125719
+ }
125720
+ }
125721
+ async function removeInferenceCredentials(id, cwd) {
125722
+ const client = await runtimeFor(cwd);
125723
+ try {
125724
+ return await client.removeInferenceCredentials(id);
125725
+ } catch (error51) {
125726
+ throw credentialsError(error51);
125727
+ }
125728
+ }
125729
+ function credentialsError(error51) {
125730
+ const status = httpStatus(error51);
125731
+ if (status === 400) {
125732
+ const detail = error51.detail;
125733
+ return new InferenceCredentialsError(detail || "The provider refused the key.");
125734
+ }
125735
+ if (status === 404) {
125736
+ return new InferenceCredentialsError("This Repoburg version cannot save keys here. Update Repoburg.");
125737
+ }
125738
+ return error51;
125739
+ }
125518
125740
  async function getCommands3(cwd) {
125519
125741
  try {
125520
125742
  const resolved = await resolveBackendUrl(cwd ?? process.cwd(), { autoStart: false });
@@ -125539,9 +125761,13 @@ var repoburgProvider = {
125539
125761
  clearThreadBranch: clearThreadBranch3,
125540
125762
  clearAllThreads: clearAllThreads3,
125541
125763
  getModels: getModels3,
125764
+ getInferenceProviders,
125765
+ setInferenceCredentials,
125766
+ removeInferenceCredentials,
125542
125767
  getCommands: getCommands3,
125543
125768
  rewindRuntime,
125544
125769
  forkSession: forkSession2,
125770
+ summarizeThread,
125545
125771
  shutdown: shutdown3
125546
125772
  };
125547
125773