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);
@@ -43950,7 +43950,26 @@ async function registerProviderRoutes(fastify) {
43950
43950
  );
43951
43951
  }
43952
43952
 
43953
+ // src/providers/runtime-provider.ts
43954
+ var InferenceCredentialsError = class extends Error {
43955
+ };
43956
+
43953
43957
  // src/routes/models.ts
43958
+ function inferenceRuntime(id, reply) {
43959
+ const provider = hasProvider(id) ? getProvider(id) : void 0;
43960
+ if (!provider?.getInferenceProviders) {
43961
+ void reply.code(404).send({ error: `Provider ${id} has no inference providers` });
43962
+ return void 0;
43963
+ }
43964
+ return provider;
43965
+ }
43966
+ function sendInferenceError(reply, error51) {
43967
+ if (error51 instanceof InferenceCredentialsError) {
43968
+ return reply.code(400).send({ error: error51.message });
43969
+ }
43970
+ const message = error51 instanceof Error ? error51.message : String(error51);
43971
+ return reply.code(503).send({ error: message });
43972
+ }
43954
43973
  async function registerModelRoutes(fastify) {
43955
43974
  fastify.get(
43956
43975
  "/api/providers/:id/models",
@@ -43962,6 +43981,54 @@ async function registerModelRoutes(fastify) {
43962
43981
  return getProvider(id).getModels(request.query.cwd);
43963
43982
  }
43964
43983
  );
43984
+ fastify.get(
43985
+ "/api/providers/:id/inference",
43986
+ async (request, reply) => {
43987
+ const provider = inferenceRuntime(request.params.id, reply);
43988
+ if (!provider) return reply;
43989
+ try {
43990
+ return await provider.getInferenceProviders(request.query.cwd);
43991
+ } catch (error51) {
43992
+ return sendInferenceError(reply, error51);
43993
+ }
43994
+ }
43995
+ );
43996
+ fastify.put(
43997
+ "/api/providers/:id/inference/:inferenceId/credentials",
43998
+ async (request, reply) => {
43999
+ const provider = inferenceRuntime(request.params.id, reply);
44000
+ if (!provider) return reply;
44001
+ if (!provider.setInferenceCredentials) {
44002
+ return reply.code(404).send({ error: "This provider cannot save keys" });
44003
+ }
44004
+ const body = request.body ?? {};
44005
+ const field = (value) => typeof value === "string" ? value : void 0;
44006
+ try {
44007
+ return await provider.setInferenceCredentials(request.params.inferenceId, {
44008
+ apiKey: field(body.apiKey),
44009
+ baseUrl: field(body.baseUrl),
44010
+ cwd: field(body.cwd)
44011
+ });
44012
+ } catch (error51) {
44013
+ return sendInferenceError(reply, error51);
44014
+ }
44015
+ }
44016
+ );
44017
+ fastify.delete(
44018
+ "/api/providers/:id/inference/:inferenceId/credentials",
44019
+ async (request, reply) => {
44020
+ const provider = inferenceRuntime(request.params.id, reply);
44021
+ if (!provider) return reply;
44022
+ if (!provider.removeInferenceCredentials) {
44023
+ return reply.code(404).send({ error: "This provider cannot remove keys" });
44024
+ }
44025
+ try {
44026
+ return await provider.removeInferenceCredentials(request.params.inferenceId, request.query.cwd);
44027
+ } catch (error51) {
44028
+ return sendInferenceError(reply, error51);
44029
+ }
44030
+ }
44031
+ );
43965
44032
  }
43966
44033
 
43967
44034
  // src/routes/skills.ts
@@ -119747,6 +119814,21 @@ function reapOrphanCliProcesses(db2, deps = defaultDeps) {
119747
119814
  return reapOrphanProcesses(db2, "claude", deps);
119748
119815
  }
119749
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
+
119750
119832
  // src/codex/codex-provider.ts
119751
119833
  var TERMINAL_TASK_TYPE = "background_terminal";
119752
119834
  function taskPollMs() {
@@ -120078,7 +120160,9 @@ function completeTurn(db2, sessionId, turnId, usage) {
120078
120160
  const response = turnResponse(db2, turnId);
120079
120161
  const result = usage !== void 0 ? db2.prepare(
120080
120162
  "UPDATE turns SET status = 'completed', token_usage = ?, updated_at = ? WHERE id = ? AND status IN ('pending', 'running')"
120081
- ).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);
120082
120166
  if (result.changes === 0) return;
120083
120167
  broadcast("turn:completed", {
120084
120168
  sessionId,
@@ -120730,17 +120814,7 @@ async function summarizeCodexThread(session, _thread, transcript, directives) {
120730
120814
  ephemeral: true
120731
120815
  });
120732
120816
  const threadId = initResult.thread.id;
120733
- const directiveLine = directives.trim() ? `
120734
-
120735
- The user has given these summarization directives \u2014 follow them exactly:
120736
- "${directives.trim()}"` : "";
120737
- 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}
120738
-
120739
- The discussion transcript (from the discussion's beginning):
120740
-
120741
- ${transcript}
120742
-
120743
- 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);
120744
120818
  let summaryResolve;
120745
120819
  let summaryReject;
120746
120820
  const summaryPromise = new Promise((resolve, reject) => {
@@ -120846,7 +120920,10 @@ async function forkSession(session, targetTurn) {
120846
120920
  try {
120847
120921
  result = await fork({ lastTurnId });
120848
120922
  } catch (err) {
120849
- 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
+ );
120850
120927
  if (!range) throw err;
120851
120928
  result = await fork(range);
120852
120929
  }
@@ -121087,7 +121164,9 @@ function hostFor(sessionId, cwd, options, onDirect) {
121087
121164
  const { command, args } = appServerCommand(options);
121088
121165
  return startCodexHost(getDb(), { sessionId, cwd, command, args, env: { ...process.env }, onDirect });
121089
121166
  } catch (err) {
121090
- 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
+ );
121091
121170
  return null;
121092
121171
  }
121093
121172
  }
@@ -121141,7 +121220,9 @@ function settleHostTurn(entry) {
121141
121220
  function maybeRetire(entry) {
121142
121221
  const why = entry.retireWhenIdle;
121143
121222
  if (!why || entry.replaying || entry.turns.length > 0 || !isCurrent(entry)) return;
121144
- 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
+ );
121145
121226
  void retireEntry(entry, "keep");
121146
121227
  }
121147
121228
  function detachEntry(entry) {
@@ -121303,7 +121384,9 @@ var codexHostAdopter = {
121303
121384
  if (!session || session.runtime_type !== "codex") return;
121304
121385
  const detail = describeExit(exit);
121305
121386
  const threadId = row.external_id ?? session.external_thread_id;
121306
- 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
+ );
121307
121390
  if (log && log.length > 0 && threadId) {
121308
121391
  const logged = new LoggedAppServer();
121309
121392
  const client = new AppServerClient({ cwd: session.cwd ?? process.cwd(), process: logged, replaying: true });
@@ -123334,7 +123417,7 @@ Agent responded: "${truncatedResponse}"`;
123334
123417
  }
123335
123418
  }
123336
123419
  }
123337
- function buildThreadSummaryPrompt(transcript, directives, hasNativeContext) {
123420
+ function buildThreadSummaryPrompt2(transcript, directives, hasNativeContext) {
123338
123421
  const directiveLine = directives.trim() ? `
123339
123422
 
123340
123423
  The user has given these summarization directives \u2014 follow them exactly:
@@ -123362,7 +123445,7 @@ async function summarizeClaudeThread(session, thread, transcript, directives) {
123362
123445
  console.error("[claude] summarizeThread fork failed \u2014 falling back to embedded transcript:", err);
123363
123446
  }
123364
123447
  }
123365
- const prompt = buildThreadSummaryPrompt(transcript, directives, !!resumeId);
123448
+ const prompt = buildThreadSummaryPrompt2(transcript, directives, !!resumeId);
123366
123449
  q = query({
123367
123450
  prompt,
123368
123451
  options: {
@@ -123659,6 +123742,22 @@ var claudeProvider = {
123659
123742
  };
123660
123743
 
123661
123744
  // src/repoburg/repoburg-client.ts
123745
+ var RepoburgHttpError = class extends Error {
123746
+ constructor(message, status, detail) {
123747
+ super(message);
123748
+ this.status = status;
123749
+ this.detail = detail;
123750
+ }
123751
+ };
123752
+ function errorDetail(body) {
123753
+ const parsed = body;
123754
+ const message = parsed?.error && typeof parsed.error === "object" ? parsed.error.message : parsed?.message;
123755
+ if (typeof message === "string") return message || null;
123756
+ if (Array.isArray(message)) {
123757
+ return message.filter((m) => typeof m === "string").join("; ") || null;
123758
+ }
123759
+ return null;
123760
+ }
123662
123761
  function defaultRepoburgBaseUrl() {
123663
123762
  return process.env.REPOBURG_BACKEND_URL || "http://localhost:3000";
123664
123763
  }
@@ -123686,7 +123785,12 @@ var RepoburgHttpClient = class {
123686
123785
  `${method} ${path21} failed: ${response.status} HTML response from ${this.baseUrl} \u2014 the URL points to the wrong server`
123687
123786
  );
123688
123787
  }
123689
- throw new Error(`${method} ${path21} failed: ${response.status} ${text2}`);
123788
+ let detail = null;
123789
+ try {
123790
+ detail = errorDetail(JSON.parse(text2));
123791
+ } catch {
123792
+ }
123793
+ throw new RepoburgHttpError(`${method} ${path21} failed: ${response.status} ${text2}`, response.status, detail);
123690
123794
  }
123691
123795
  if (text2.length === 0) return void 0;
123692
123796
  try {
@@ -123742,6 +123846,26 @@ var RepoburgHttpClient = class {
123742
123846
  const result = await this.request("GET", "/llm-provider/models");
123743
123847
  return result.models ?? [];
123744
123848
  }
123849
+ async getInferenceProviders() {
123850
+ const result = await this.request(
123851
+ "GET",
123852
+ "/llm-provider/inference-providers"
123853
+ );
123854
+ return result.providers ?? [];
123855
+ }
123856
+ async setInferenceCredentials(id, dto) {
123857
+ return this.request(
123858
+ "PUT",
123859
+ `/llm-provider/inference-providers/${encodeURIComponent(id)}/credentials`,
123860
+ dto
123861
+ );
123862
+ }
123863
+ async removeInferenceCredentials(id) {
123864
+ return this.request(
123865
+ "DELETE",
123866
+ `/llm-provider/inference-providers/${encodeURIComponent(id)}/credentials`
123867
+ );
123868
+ }
123745
123869
  async getSlashCommands() {
123746
123870
  return this.request("GET", "/slash-commands");
123747
123871
  }
@@ -123935,7 +124059,7 @@ function parseSelectionGroups(raw) {
123935
124059
  }).filter((g) => g !== null);
123936
124060
  }
123937
124061
  function mapActionToItem(action) {
123938
- const failed = action.status === "EXECUTION_FAILED";
124062
+ const failed = String(action.status ?? "").toLowerCase() === "execution_failed";
123939
124063
  const status = failed ? "failed" : "completed";
123940
124064
  const log = action.executionLogs?.[0];
123941
124065
  const output = log?.output ?? "";
@@ -124158,11 +124282,7 @@ async function streamAgentRuntimeMessages(baseUrl, sessionId, onMessage, opts =
124158
124282
  await reconnectDelay(delayMs, opts.signal);
124159
124283
  continue;
124160
124284
  }
124161
- const reason = await readBody(
124162
- response.body,
124163
- onMessage,
124164
- opts
124165
- );
124285
+ const reason = await readBody(response.body, onMessage, opts);
124166
124286
  if (reason !== null) {
124167
124287
  await response.body.cancel().catch(() => {
124168
124288
  });
@@ -124237,6 +124357,50 @@ function reconnectDelay(delayMs, signal) {
124237
124357
  });
124238
124358
  }
124239
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
+
124240
124404
  // src/repoburg/turn-projector.ts
124241
124405
  var RESULT_TIMEOUT_MS = 15 * 6e4;
124242
124406
  var MAX_RESULT_EXTENSIONS = 3;
@@ -124271,8 +124435,8 @@ var TurnProjector = class {
124271
124435
  }
124272
124436
  switch (message.type) {
124273
124437
  case "system":
124438
+ if (message.subtype === "compact_boundary") this.handleCompactBoundary(message);
124274
124439
  break;
124275
- // init — connection marker only; gaps go to recoverGap
124276
124440
  case "stream_event":
124277
124441
  this.handleStreamEvent(message);
124278
124442
  break;
@@ -124389,10 +124553,7 @@ var TurnProjector = class {
124389
124553
  }
124390
124554
  if (ids.includes(inputId)) return;
124391
124555
  ids.push(inputId);
124392
- db2.prepare("UPDATE turns SET runtime_input_ids = ? WHERE id = ?").run(
124393
- JSON.stringify(ids),
124394
- this.deps.turnId
124395
- );
124556
+ db2.prepare("UPDATE turns SET runtime_input_ids = ? WHERE id = ?").run(JSON.stringify(ids), this.deps.turnId);
124396
124557
  } catch {
124397
124558
  }
124398
124559
  }
@@ -124467,7 +124628,14 @@ var TurnProjector = class {
124467
124628
  else info.reasoningItemId = existing.id;
124468
124629
  const data = existing.data ? JSON.parse(existing.data) : {};
124469
124630
  if (existing.status !== "completed" || data.text !== text2) {
124470
- 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
+ );
124471
124639
  }
124472
124640
  return;
124473
124641
  }
@@ -124484,6 +124652,28 @@ var TurnProjector = class {
124484
124652
  if (kind === "message") info.messageItemId = item.id;
124485
124653
  else info.reasoningItemId = item.id;
124486
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
+ }
124487
124677
  existingItemId(externalId) {
124488
124678
  const row = getDb().prepare("SELECT id FROM items WHERE turn_id = ? AND external_item_id = ?").get(this.deps.turnId, externalId);
124489
124679
  return row?.id ?? null;
@@ -124603,9 +124793,13 @@ var TurnProjector = class {
124603
124793
  output: msg.usage.output_tokens
124604
124794
  }) : null;
124605
124795
  this.closeOpenItems("completed");
124606
- db2.prepare(
124607
- "UPDATE turns SET status = ?, agent_response = ?, token_usage = ?, updated_at = ? WHERE id = ?"
124608
- ).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
+ );
124609
124803
  recomputeSessionRunning(db2, this.deps.agentPaneSessionId, "active", true);
124610
124804
  broadcast("turn:completed", {
124611
124805
  sessionId: this.deps.agentPaneSessionId,
@@ -124649,9 +124843,7 @@ var TurnProjector = class {
124649
124843
  async syncTitle() {
124650
124844
  try {
124651
124845
  const db2 = getDb();
124652
- const session = db2.prepare("SELECT title FROM sessions WHERE id = ?").get(
124653
- this.deps.agentPaneSessionId
124654
- );
124846
+ const session = db2.prepare("SELECT title FROM sessions WHERE id = ?").get(this.deps.agentPaneSessionId);
124655
124847
  if (!session || session.title) return;
124656
124848
  const runtimeSession = await this.deps.client.getSession(this.deps.repoburgSessionId);
124657
124849
  const title = (runtimeSession.session_title || "").trim();
@@ -124682,54 +124874,19 @@ var TurnProjector = class {
124682
124874
  const sessionId = this.deps.agentPaneSessionId;
124683
124875
  if (titleGenerating3.has(sessionId)) return;
124684
124876
  const db2 = getDb();
124685
- const firstTurn = db2.prepare(
124686
- "SELECT user_prompt, agent_response FROM turns WHERE session_id = ? ORDER BY created_at ASC LIMIT 1"
124687
- ).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);
124688
124878
  if (!firstTurn) return;
124689
124879
  titleGenerating3.add(sessionId);
124690
- let throwawayId = null;
124691
124880
  try {
124692
124881
  const pane = db2.prepare("SELECT model FROM sessions WHERE id = ?").get(sessionId);
124693
- const created = await this.deps.client.createSession(
124694
- pane?.model ? { model_id: pane.model } : {}
124695
- );
124696
- throwawayId = created.id;
124697
- const controller = new AbortController();
124698
- const timer2 = setTimeout(() => controller.abort(), TITLE_TIMEOUT_MS);
124699
- try {
124700
- await this.deps.client.createInput(throwawayId, {
124701
- user_prompt: buildTitlePrompt(firstTurn.user_prompt, firstTurn.agent_response),
124702
- execution_strategy: "auto_apply"
124703
- });
124704
- let reply = "";
124705
- const consume = (message) => {
124706
- if (message.type === "assistant") {
124707
- reply += message.content.filter((b) => b.type === "text").map((b) => b.text).join("");
124708
- } else if (message.type === "result" && !message.is_error && message.result) {
124709
- reply = message.result;
124710
- }
124711
- };
124712
- const reason = await streamAgentRuntimeMessages(
124713
- this.deps.client.baseUrl,
124714
- throwawayId,
124715
- consume,
124716
- { signal: controller.signal, deltas: false }
124717
- );
124718
- if (reason === "aborted") {
124719
- void this.deps.client.cancel(throwawayId).catch(() => {
124720
- });
124721
- }
124722
- const title = cleanTitle(reply);
124723
- if (title) this.applyTitle(title);
124724
- } finally {
124725
- clearTimeout(timer2);
124726
- }
124727
- } 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);
124728
124889
  } finally {
124729
- if (throwawayId) {
124730
- void this.deps.client.deleteSession(throwawayId).catch(() => {
124731
- });
124732
- }
124733
124890
  titleGenerating3.delete(sessionId);
124734
124891
  }
124735
124892
  }
@@ -124755,11 +124912,7 @@ var TurnProjector = class {
124755
124912
  const db2 = getDb();
124756
124913
  const now = (/* @__PURE__ */ new Date()).toISOString();
124757
124914
  this.closeOpenItems("completed");
124758
- db2.prepare("UPDATE turns SET status = ?, updated_at = ? WHERE id = ?").run(
124759
- "aborted",
124760
- now,
124761
- this.deps.turnId
124762
- );
124915
+ db2.prepare("UPDATE turns SET status = ?, updated_at = ? WHERE id = ?").run("aborted", now, this.deps.turnId);
124763
124916
  recomputeSessionRunning(db2, this.deps.agentPaneSessionId);
124764
124917
  broadcast("turn:cancelled", {
124765
124918
  sessionId: this.deps.agentPaneSessionId,
@@ -124826,9 +124979,13 @@ var TurnProjector = class {
124826
124979
  const db2 = getDb();
124827
124980
  const now = (/* @__PURE__ */ new Date()).toISOString();
124828
124981
  this.closeOpenItems("completed");
124829
- db2.prepare(
124830
- "UPDATE turns SET status = ?, agent_response = ?, token_usage = ?, updated_at = ? WHERE id = ?"
124831
- ).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
+ );
124832
124989
  recomputeSessionRunning(db2, this.deps.agentPaneSessionId, "active", true);
124833
124990
  broadcast("turn:completed", {
124834
124991
  sessionId: this.deps.agentPaneSessionId,
@@ -124897,9 +125054,7 @@ var TurnProjector = class {
124897
125054
  }
124898
125055
  };
124899
125056
  function extractFinalPlain(input) {
124900
- const action = input?.aiActions?.find(
124901
- (a) => a.action_type === "final" || a.action_type === "html_final"
124902
- );
125057
+ const action = input?.aiActions?.find((a) => a.action_type === "final" || a.action_type === "html_final");
124903
125058
  return action?.plain ?? null;
124904
125059
  }
124905
125060
  function buildTitlePrompt(userPrompt, agentResponse) {
@@ -124916,22 +125071,27 @@ function cleanTitle(raw) {
124916
125071
  }
124917
125072
 
124918
125073
  // src/repoburg/repoburg-provider.ts
124919
- var REASONING_LEVELS = [
125074
+ var FALLBACK_REASONING_LEVELS = [
124920
125075
  { effort: "low", label: "Low" },
124921
125076
  { effort: "medium", label: "Medium" },
124922
125077
  { effort: "high", label: "High" },
124923
125078
  { effort: "xhigh", label: "Extra High" }
124924
125079
  ];
124925
- var OLLAMA_REASONING_LEVELS = REASONING_LEVELS.filter((l) => l.effort !== "xhigh");
124926
- function mapReasoningEffort(modelId, effort) {
124927
- if (!effort) return void 0;
124928
- if (!["xhigh", "high", "medium", "low", "minimal", "none"].includes(effort)) return void 0;
124929
- if (modelId?.startsWith("ollama/")) {
124930
- if (effort === "xhigh") return "high";
124931
- if (effort === "low" || effort === "medium" || effort === "high") return effort;
124932
- return void 0;
124933
- }
124934
- return effort;
125080
+ var FALLBACK_OLLAMA_LEVELS = FALLBACK_REASONING_LEVELS.filter((l) => l.effort !== "xhigh");
125081
+ var RUNTIME_EFFORTS = /* @__PURE__ */ new Set(["none", "minimal", "low", "medium", "high", "xhigh", "max"]);
125082
+ function mapReasoningEffort(effort) {
125083
+ return effort && RUNTIME_EFFORTS.has(effort) ? effort : void 0;
125084
+ }
125085
+ var INFERENCE_PROVIDER_IDS = /* @__PURE__ */ new Set(["ollama", "zai", "alibaba", "openrouter", "openai"]);
125086
+ function inferenceProviderOf(modelId) {
125087
+ const slash = modelId.indexOf("/");
125088
+ if (slash <= 0) return void 0;
125089
+ const prefix = modelId.slice(0, slash);
125090
+ return INFERENCE_PROVIDER_IDS.has(prefix) ? prefix : "openrouter";
125091
+ }
125092
+ function httpStatus(error51) {
125093
+ const status = error51?.status;
125094
+ return typeof status === "number" ? status : void 0;
124935
125095
  }
124936
125096
  var sessionMap3 = /* @__PURE__ */ new Map();
124937
125097
  var STALLED_STREAM_MS = 6e4;
@@ -124940,9 +125100,7 @@ var BACKEND_RESTARTED_ERROR = "The Repoburg backend restarted while this turn ra
124940
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.`;
124941
125101
  function isConnectionError(err) {
124942
125102
  const message = String(err?.message ?? "");
124943
- return /fetch failed|ECONNREFUSED|ENOTFOUND|ECONNRESET|ETIMEDOUT|EHOSTUNREACH|socket hang up/i.test(
124944
- message
124945
- );
125103
+ return /fetch failed|ECONNREFUSED|ENOTFOUND|ECONNRESET|ETIMEDOUT|EHOSTUNREACH|socket hang up/i.test(message);
124946
125104
  }
124947
125105
  async function ensureSession(session, client, baseUrl) {
124948
125106
  const existing = sessionMap3.get(session.id);
@@ -124965,7 +125123,7 @@ async function ensureSession(session, client, baseUrl) {
124965
125123
  sessionMap3.set(session.id, entry2);
124966
125124
  return entry2;
124967
125125
  }
124968
- const mappedEffort = mapReasoningEffort(session.model, session.model_reasoning_effort);
125126
+ const mappedEffort = mapReasoningEffort(session.model_reasoning_effort);
124969
125127
  const created = await client.createSession({
124970
125128
  session_title: session.title ?? void 0,
124971
125129
  model_id: session.model || void 0,
@@ -125004,7 +125162,7 @@ async function ensureThreadSession(session, turn, client, baseUrl) {
125004
125162
  const created = await client.createSession({
125005
125163
  session_title: session.title ? `Discussion: ${session.title}` : "Discussion",
125006
125164
  model_id: session.model || void 0,
125007
- reasoning_effort: mapReasoningEffort(session.model, session.model_reasoning_effort)
125165
+ reasoning_effort: mapReasoningEffort(session.model_reasoning_effort)
125008
125166
  });
125009
125167
  runtimeId = created.id;
125010
125168
  const now = (/* @__PURE__ */ new Date()).toISOString();
@@ -125052,12 +125210,7 @@ async function ensureContextWindow(entry) {
125052
125210
  }
125053
125211
  function failTurnBeforeStart(db2, sessionId, turnId, error51) {
125054
125212
  const now = (/* @__PURE__ */ new Date()).toISOString();
125055
- db2.prepare("UPDATE turns SET status = ?, error = ?, updated_at = ? WHERE id = ?").run(
125056
- "failed",
125057
- error51,
125058
- now,
125059
- turnId
125060
- );
125213
+ db2.prepare("UPDATE turns SET status = ?, error = ?, updated_at = ? WHERE id = ?").run("failed", error51, now, turnId);
125061
125214
  recomputeSessionRunning(db2, sessionId, "failed");
125062
125215
  broadcast("turn:failed", { sessionId, turnId, error: error51 });
125063
125216
  }
@@ -125112,7 +125265,7 @@ async function runStreamLoop(entry, projector) {
125112
125265
  });
125113
125266
  return;
125114
125267
  }
125115
- if (message.type === "system") {
125268
+ if (message.type === "system" && message.subtype === "init") {
125116
125269
  clearLostTimer();
125117
125270
  const bootId = message.bootId ?? null;
125118
125271
  if (active.bootId === void 0) active.bootId = bootId;
@@ -125210,7 +125363,7 @@ async function startTurn4(session, turn) {
125210
125363
  entry.client = client;
125211
125364
  }
125212
125365
  const wantedModel = session.model || null;
125213
- const wantedEffort = mapReasoningEffort(session.model, session.model_reasoning_effort);
125366
+ const wantedEffort = mapReasoningEffort(session.model_reasoning_effort);
125214
125367
  if (wantedModel !== entry.modelId || wantedEffort !== entry.reasoningEffort) {
125215
125368
  try {
125216
125369
  await entry.client.patchSession(entry.repoburgSessionId, {
@@ -125474,6 +125627,21 @@ async function forkSession2(session, targetTurn) {
125474
125627
  const forked = await client.forkSession(session.external_thread_id, anchor);
125475
125628
  return forked.id;
125476
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
+ }
125477
125645
  function clearAllThreads3() {
125478
125646
  for (const entry of sessionMap3.values()) {
125479
125647
  if (entry.activeTurn) {
@@ -125490,18 +125658,72 @@ async function getModels3(cwd) {
125490
125658
  const resolved = await resolveBackendUrl(cwd ?? process.cwd(), { autoStart: false });
125491
125659
  if (!resolved) return [];
125492
125660
  const models = await new RepoburgHttpClient(resolved.baseUrl).getModels();
125493
- return models.map((m) => ({
125494
- slug: m.id,
125495
- displayName: m.name,
125496
- description: "Repoburg backend",
125497
- defaultReasoning: "medium",
125498
- // Ollama rejects xhigh/minimal/none as `think` — offer only valid levels.
125499
- reasoningLevels: m.id.startsWith("ollama/") ? OLLAMA_REASONING_LEVELS : REASONING_LEVELS
125500
- }));
125661
+ return models.map((m) => {
125662
+ const levels = m.reasoning_levels ?? (m.id.startsWith("ollama/") ? FALLBACK_OLLAMA_LEVELS : FALLBACK_REASONING_LEVELS);
125663
+ const inferenceProvider = m.provider ?? inferenceProviderOf(m.id);
125664
+ return {
125665
+ slug: m.id,
125666
+ displayName: m.name,
125667
+ description: m.description ?? "Repoburg backend",
125668
+ // '' = the model's own default, which the runtime does not name.
125669
+ defaultReasoning: m.default_reasoning ?? (m.reasoning_levels ? "" : "medium"),
125670
+ reasoningLevels: levels,
125671
+ ...inferenceProvider ? { inferenceProvider } : {},
125672
+ ...m.aliases?.length ? { aliases: m.aliases } : {},
125673
+ ...m.capabilities ? { capabilities: m.capabilities } : {},
125674
+ ...m.context_window ? { contextWindow: m.context_window } : {}
125675
+ };
125676
+ });
125501
125677
  } catch {
125502
125678
  return [];
125503
125679
  }
125504
125680
  }
125681
+ async function runtimeFor(cwd) {
125682
+ const resolved = await resolveBackendUrl(cwd ?? process.cwd(), { autoStart: Boolean(cwd) });
125683
+ if (!resolved) {
125684
+ throw new Error("Repoburg is not running for this workspace.");
125685
+ }
125686
+ return new RepoburgHttpClient(resolved.baseUrl);
125687
+ }
125688
+ async function getInferenceProviders(cwd) {
125689
+ const client = await runtimeFor(cwd);
125690
+ try {
125691
+ return await client.getInferenceProviders();
125692
+ } catch (error51) {
125693
+ if (httpStatus(error51) === 404) return [];
125694
+ throw error51;
125695
+ }
125696
+ }
125697
+ async function setInferenceCredentials(id, input) {
125698
+ const client = await runtimeFor(input.cwd);
125699
+ try {
125700
+ return await client.setInferenceCredentials(id, {
125701
+ ...input.apiKey ? { apiKey: input.apiKey } : {},
125702
+ ...input.baseUrl ? { baseUrl: input.baseUrl } : {}
125703
+ });
125704
+ } catch (error51) {
125705
+ throw credentialsError(error51);
125706
+ }
125707
+ }
125708
+ async function removeInferenceCredentials(id, cwd) {
125709
+ const client = await runtimeFor(cwd);
125710
+ try {
125711
+ return await client.removeInferenceCredentials(id);
125712
+ } catch (error51) {
125713
+ throw credentialsError(error51);
125714
+ }
125715
+ }
125716
+ function credentialsError(error51) {
125717
+ const status = httpStatus(error51);
125718
+ if (status === 400) {
125719
+ const detail = error51.detail;
125720
+ return new InferenceCredentialsError(detail || "The provider refused the key.");
125721
+ }
125722
+ if (status === 404) {
125723
+ return new InferenceCredentialsError("This Repoburg version cannot save keys here. Update Repoburg.");
125724
+ }
125725
+ return error51;
125726
+ }
125505
125727
  async function getCommands3(cwd) {
125506
125728
  try {
125507
125729
  const resolved = await resolveBackendUrl(cwd ?? process.cwd(), { autoStart: false });
@@ -125526,9 +125748,13 @@ var repoburgProvider = {
125526
125748
  clearThreadBranch: clearThreadBranch3,
125527
125749
  clearAllThreads: clearAllThreads3,
125528
125750
  getModels: getModels3,
125751
+ getInferenceProviders,
125752
+ setInferenceCredentials,
125753
+ removeInferenceCredentials,
125529
125754
  getCommands: getCommands3,
125530
125755
  rewindRuntime,
125531
125756
  forkSession: forkSession2,
125757
+ summarizeThread,
125532
125758
  shutdown: shutdown3
125533
125759
  };
125534
125760