@cerebriline/core 4.100.240

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 (479) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +16 -0
  3. package/assets/office-oxide/LICENSE-APACHE +176 -0
  4. package/assets/office-oxide/LICENSE-MIT +25 -0
  5. package/assets/office-oxide/office_oxide_bg.wasm +0 -0
  6. package/assets/prompt-templates/claude.md +516 -0
  7. package/assets/prompt-templates/deepseek.md +331 -0
  8. package/assets/prompt-templates/default.md +386 -0
  9. package/assets/prompt-templates/gemma.md +352 -0
  10. package/assets/prompt-templates/glm.md +334 -0
  11. package/assets/prompt-templates/kimi-k3.md +408 -0
  12. package/assets/prompt-templates/kimi.md +402 -0
  13. package/assets/prompt-templates/minimax.md +473 -0
  14. package/assets/prompt-templates/nemotron.md +358 -0
  15. package/assets/prompt-templates/qwen.md +612 -0
  16. package/dist/ClineCore.d.ts +365 -0
  17. package/dist/account/cline-account-service.d.ts +41 -0
  18. package/dist/account/index.d.ts +3 -0
  19. package/dist/account/rpc.d.ts +40 -0
  20. package/dist/account/types.d.ts +122 -0
  21. package/dist/auth/bounded-ttl-cache.d.ts +13 -0
  22. package/dist/auth/client.d.ts +30 -0
  23. package/dist/auth/cline.d.ts +71 -0
  24. package/dist/auth/codex.d.ts +40 -0
  25. package/dist/auth/oca.d.ts +21 -0
  26. package/dist/auth/provider-auth-registry.d.ts +52 -0
  27. package/dist/auth/server.d.ts +54 -0
  28. package/dist/auth/types.d.ts +103 -0
  29. package/dist/auth/utils.d.ts +31 -0
  30. package/dist/cline-core/automation.d.ts +34 -0
  31. package/dist/cline-core/runtime-services.d.ts +5 -0
  32. package/dist/cline-core/start-input.d.ts +10 -0
  33. package/dist/cline-core/telemetry.d.ts +10 -0
  34. package/dist/cline-core/types.d.ts +236 -0
  35. package/dist/cron/events/cron-event-ingress.d.ts +37 -0
  36. package/dist/cron/reports/cron-report-writer.d.ts +42 -0
  37. package/dist/cron/runner/cron-materializer.d.ts +35 -0
  38. package/dist/cron/runner/cron-runner.d.ts +60 -0
  39. package/dist/cron/runner/resource-limiter.d.ts +8 -0
  40. package/dist/cron/schedule/scheduler.d.ts +12 -0
  41. package/dist/cron/service/cron-service.d.ts +56 -0
  42. package/dist/cron/service/schedule-command-service.d.ts +14 -0
  43. package/dist/cron/service/schedule-service.d.ts +116 -0
  44. package/dist/cron/service/schedule-tool.d.ts +81 -0
  45. package/dist/cron/specs/cron-reconciler.d.ts +61 -0
  46. package/dist/cron/specs/cron-spec-parser.d.ts +26 -0
  47. package/dist/cron/specs/cron-watcher.d.ts +22 -0
  48. package/dist/cron/store/cron-schema.d.ts +2 -0
  49. package/dist/cron/store/sqlite-cron-store.d.ts +261 -0
  50. package/dist/extensions/agent-plugin/agent-skill.d.ts +21 -0
  51. package/dist/extensions/agent-plugin/index.d.ts +4 -0
  52. package/dist/extensions/agent-plugin/loader.d.ts +10 -0
  53. package/dist/extensions/agent-plugin/types.d.ts +67 -0
  54. package/dist/extensions/complexity/grammars.d.ts +92 -0
  55. package/dist/extensions/complexity/walker.d.ts +115 -0
  56. package/dist/extensions/config/builtin-templates.d.ts +10 -0
  57. package/dist/extensions/config/builtin-templates.generated.d.ts +5 -0
  58. package/dist/extensions/config/index.d.ts +15 -0
  59. package/dist/extensions/config/prompt-template-compaction.d.ts +92 -0
  60. package/dist/extensions/config/prompt-template-delta.d.ts +107 -0
  61. package/dist/extensions/config/prompt-template-hooks.d.ts +47 -0
  62. package/dist/extensions/config/prompt-template-loader.d.ts +79 -0
  63. package/dist/extensions/config/prompt-template-parser.d.ts +56 -0
  64. package/dist/extensions/config/prompt-template-review.d.ts +327 -0
  65. package/dist/extensions/config/prompt-template-session.d.ts +46 -0
  66. package/dist/extensions/config/runtime-commands.d.ts +23 -0
  67. package/dist/extensions/config/shipped-tool-signatures.d.ts +36 -0
  68. package/dist/extensions/config/skill-frontmatter-toggle.d.ts +11 -0
  69. package/dist/extensions/config/unified-config-file-watcher.d.ts +77 -0
  70. package/dist/extensions/config/user-instruction-config-loader.d.ts +77 -0
  71. package/dist/extensions/config/user-instruction-plugin.d.ts +26 -0
  72. package/dist/extensions/config/user-instruction-service.d.ts +31 -0
  73. package/dist/extensions/context/agentic-compaction.d.ts +129 -0
  74. package/dist/extensions/context/basic-compaction.d.ts +19 -0
  75. package/dist/extensions/context/budget-projection/index.d.ts +2 -0
  76. package/dist/extensions/context/budget-projection/project.d.ts +4 -0
  77. package/dist/extensions/context/budget-projection/types.d.ts +58 -0
  78. package/dist/extensions/context/capped-thinking.d.ts +195 -0
  79. package/dist/extensions/context/compaction-cause.d.ts +27 -0
  80. package/dist/extensions/context/compaction-journal.d.ts +65 -0
  81. package/dist/extensions/context/compaction-revisions.d.ts +72 -0
  82. package/dist/extensions/context/compaction-shared.d.ts +608 -0
  83. package/dist/extensions/context/compaction.d.ts +161 -0
  84. package/dist/extensions/context/context-minimum-warning.d.ts +27 -0
  85. package/dist/extensions/context/continuation-compaction.d.ts +260 -0
  86. package/dist/extensions/context/council-compaction.d.ts +262 -0
  87. package/dist/extensions/context/full-compaction.d.ts +44 -0
  88. package/dist/extensions/context/kv-pressure.d.ts +258 -0
  89. package/dist/extensions/context/polykv-session.d.ts +372 -0
  90. package/dist/extensions/context/replay-compaction.d.ts +90 -0
  91. package/dist/extensions/context/tool-ledger.d.ts +198 -0
  92. package/dist/extensions/context/work-digest.d.ts +92 -0
  93. package/dist/extensions/index.d.ts +7 -0
  94. package/dist/extensions/mcp/client.d.ts +28 -0
  95. package/dist/extensions/mcp/config-loader.d.ts +102 -0
  96. package/dist/extensions/mcp/index.d.ts +15 -0
  97. package/dist/extensions/mcp/manager.d.ts +23 -0
  98. package/dist/extensions/mcp/name-transform.d.ts +2 -0
  99. package/dist/extensions/mcp/oauth.d.ts +68 -0
  100. package/dist/extensions/mcp/plugin-server-registration.d.ts +18 -0
  101. package/dist/extensions/mcp/policies.d.ts +14 -0
  102. package/dist/extensions/mcp/remote-proxy.d.ts +9 -0
  103. package/dist/extensions/mcp/timeout.d.ts +2 -0
  104. package/dist/extensions/mcp/tools.d.ts +3 -0
  105. package/dist/extensions/mcp/types.d.ts +133 -0
  106. package/dist/extensions/plugin/plugin-config-loader.d.ts +44 -0
  107. package/dist/extensions/plugin/plugin-load-report.d.ts +18 -0
  108. package/dist/extensions/plugin/plugin-loader.d.ts +23 -0
  109. package/dist/extensions/plugin/plugin-module-import.d.ts +4 -0
  110. package/dist/extensions/plugin/plugin-sandbox.d.ts +82 -0
  111. package/dist/extensions/plugin/plugin-targeting.d.ts +6 -0
  112. package/dist/extensions/plugin-sandbox-bootstrap.js +1 -0
  113. package/dist/extensions/tools/ask-lsp.d.ts +150 -0
  114. package/dist/extensions/tools/audio-tools.d.ts +156 -0
  115. package/dist/extensions/tools/browser.d.ts +137 -0
  116. package/dist/extensions/tools/check-file.d.ts +218 -0
  117. package/dist/extensions/tools/check-on-failure.d.ts +49 -0
  118. package/dist/extensions/tools/code-intel.d.ts +131 -0
  119. package/dist/extensions/tools/command-guard-extension.d.ts +22 -0
  120. package/dist/extensions/tools/command-guard.d.ts +29 -0
  121. package/dist/extensions/tools/constants.d.ts +28 -0
  122. package/dist/extensions/tools/definitions.d.ts +178 -0
  123. package/dist/extensions/tools/delimiter-balance.d.ts +121 -0
  124. package/dist/extensions/tools/edit-verification.d.ts +86 -0
  125. package/dist/extensions/tools/error-locations.d.ts +53 -0
  126. package/dist/extensions/tools/executors/apply-patch-parser.d.ts +68 -0
  127. package/dist/extensions/tools/executors/apply-patch.d.ts +48 -0
  128. package/dist/extensions/tools/executors/awk-parser.d.ts +163 -0
  129. package/dist/extensions/tools/executors/awk.d.ts +41 -0
  130. package/dist/extensions/tools/executors/bash.d.ts +119 -0
  131. package/dist/extensions/tools/executors/document/assets.d.ts +22 -0
  132. package/dist/extensions/tools/executors/document/ebook.d.ts +11 -0
  133. package/dist/extensions/tools/executors/document/formats.d.ts +83 -0
  134. package/dist/extensions/tools/executors/document/images.d.ts +73 -0
  135. package/dist/extensions/tools/executors/document/legacy.d.ts +20 -0
  136. package/dist/extensions/tools/executors/document/ocr.d.ts +67 -0
  137. package/dist/extensions/tools/executors/document/office-oxide.d.ts +19 -0
  138. package/dist/extensions/tools/executors/document/office-oxide.generated.d.ts +82 -0
  139. package/dist/extensions/tools/executors/document/office.d.ts +10 -0
  140. package/dist/extensions/tools/executors/document/pdf.d.ts +6 -0
  141. package/dist/extensions/tools/executors/document/pdfjs.d.ts +30 -0
  142. package/dist/extensions/tools/executors/document/range.d.ts +18 -0
  143. package/dist/extensions/tools/executors/document/recognition.d.ts +67 -0
  144. package/dist/extensions/tools/executors/document-extract.d.ts +55 -0
  145. package/dist/extensions/tools/executors/editor.d.ts +68 -0
  146. package/dist/extensions/tools/executors/file-locks.d.ts +41 -0
  147. package/dist/extensions/tools/executors/file-read.d.ts +136 -0
  148. package/dist/extensions/tools/executors/grep.d.ts +35 -0
  149. package/dist/extensions/tools/executors/index.d.ts +97 -0
  150. package/dist/extensions/tools/executors/line-endings.d.ts +23 -0
  151. package/dist/extensions/tools/executors/output-limits.d.ts +58 -0
  152. package/dist/extensions/tools/executors/overlay-receipts.d.ts +25 -0
  153. package/dist/extensions/tools/executors/posix-regex.d.ts +52 -0
  154. package/dist/extensions/tools/executors/read-receipts.d.ts +93 -0
  155. package/dist/extensions/tools/executors/run-command-execution-controller.d.ts +16 -0
  156. package/dist/extensions/tools/executors/search.d.ts +50 -0
  157. package/dist/extensions/tools/executors/sed.d.ts +92 -0
  158. package/dist/extensions/tools/executors/unchanged-reads.d.ts +55 -0
  159. package/dist/extensions/tools/executors/web-fetch.d.ts +58 -0
  160. package/dist/extensions/tools/helpers.d.ts +59 -0
  161. package/dist/extensions/tools/image-edit.d.ts +76 -0
  162. package/dist/extensions/tools/image-generation.d.ts +183 -0
  163. package/dist/extensions/tools/index.d.ts +68 -0
  164. package/dist/extensions/tools/jev.d.ts +336 -0
  165. package/dist/extensions/tools/list-files.d.ts +128 -0
  166. package/dist/extensions/tools/media-endpoint.d.ts +160 -0
  167. package/dist/extensions/tools/media-tools.d.ts +140 -0
  168. package/dist/extensions/tools/model-tool-routing.d.ts +33 -0
  169. package/dist/extensions/tools/presets.d.ts +154 -0
  170. package/dist/extensions/tools/qa-credentials.d.ts +133 -0
  171. package/dist/extensions/tools/runtime.d.ts +39 -0
  172. package/dist/extensions/tools/schemas.d.ts +845 -0
  173. package/dist/extensions/tools/task-progress.d.ts +217 -0
  174. package/dist/extensions/tools/team/agent-admission.d.ts +127 -0
  175. package/dist/extensions/tools/team/agent-check.d.ts +152 -0
  176. package/dist/extensions/tools/team/agent-controls.d.ts +55 -0
  177. package/dist/extensions/tools/team/agent-file.d.ts +28 -0
  178. package/dist/extensions/tools/team/agent-iteration-cap.d.ts +328 -0
  179. package/dist/extensions/tools/team/agent-names.d.ts +29 -0
  180. package/dist/extensions/tools/team/agent-node-placement.d.ts +160 -0
  181. package/dist/extensions/tools/team/agent-placement-queue.d.ts +199 -0
  182. package/dist/extensions/tools/team/agent-placement.d.ts +118 -0
  183. package/dist/extensions/tools/team/agent-reports.d.ts +53 -0
  184. package/dist/extensions/tools/team/agent-rounds.d.ts +666 -0
  185. package/dist/extensions/tools/team/agent-sandbox-executors.d.ts +79 -0
  186. package/dist/extensions/tools/team/agent-slot-gate.d.ts +186 -0
  187. package/dist/extensions/tools/team/agent-status.d.ts +84 -0
  188. package/dist/extensions/tools/team/agent-trouble.d.ts +91 -0
  189. package/dist/extensions/tools/team/background-delegations.d.ts +106 -0
  190. package/dist/extensions/tools/team/batch-report.d.ts +151 -0
  191. package/dist/extensions/tools/team/configured-agent-config.d.ts +37 -0
  192. package/dist/extensions/tools/team/configured-agent-tool.d.ts +135 -0
  193. package/dist/extensions/tools/team/create-agent-tool.d.ts +45 -0
  194. package/dist/extensions/tools/team/delegate-to-agent.d.ts +105 -0
  195. package/dist/extensions/tools/team/delegated-agent.d.ts +272 -0
  196. package/dist/extensions/tools/team/delegated-sandboxes.d.ts +125 -0
  197. package/dist/extensions/tools/team/delegated-tools.d.ts +40 -0
  198. package/dist/extensions/tools/team/delegation-call-hooks.d.ts +30 -0
  199. package/dist/extensions/tools/team/engine-evictions.d.ts +38 -0
  200. package/dist/extensions/tools/team/index.d.ts +20 -0
  201. package/dist/extensions/tools/team/lead-agent-tools.d.ts +92 -0
  202. package/dist/extensions/tools/team/multi-agent.d.ts +364 -0
  203. package/dist/extensions/tools/team/node-reachability.d.ts +53 -0
  204. package/dist/extensions/tools/team/node-throughput.d.ts +40 -0
  205. package/dist/extensions/tools/team/placed-run.d.ts +114 -0
  206. package/dist/extensions/tools/team/projections.d.ts +8 -0
  207. package/dist/extensions/tools/team/runtime.d.ts +6 -0
  208. package/dist/extensions/tools/team/session-window-retry.d.ts +28 -0
  209. package/dist/extensions/tools/team/spawn-agent-tool.d.ts +450 -0
  210. package/dist/extensions/tools/team/spawn-sampling.d.ts +188 -0
  211. package/dist/extensions/tools/team/spawn-swarm-tool.d.ts +330 -0
  212. package/dist/extensions/tools/team/subagent-cancellation.d.ts +188 -0
  213. package/dist/extensions/tools/team/subagent-layout.d.ts +90 -0
  214. package/dist/extensions/tools/team/subagent-output.d.ts +73 -0
  215. package/dist/extensions/tools/team/subagent-progress.d.ts +211 -0
  216. package/dist/extensions/tools/team/subagent-prompts.d.ts +3 -0
  217. package/dist/extensions/tools/team/team-state-dates.d.ts +10 -0
  218. package/dist/extensions/tools/team/team-tools.d.ts +56 -0
  219. package/dist/extensions/tools/team/teammates-off.d.ts +14 -0
  220. package/dist/extensions/tools/team/token-split.d.ts +28 -0
  221. package/dist/extensions/tools/team/turn-fault-recovery.d.ts +71 -0
  222. package/dist/extensions/tools/types.d.ts +410 -0
  223. package/dist/extensions/tools/video-generation.d.ts +94 -0
  224. package/dist/hooks/checkpoint-hooks.d.ts +39 -0
  225. package/dist/hooks/hook-extension.d.ts +2 -0
  226. package/dist/hooks/hook-file-config.d.ts +24 -0
  227. package/dist/hooks/hook-file-hooks.d.ts +22 -0
  228. package/dist/hooks/index.d.ts +5 -0
  229. package/dist/hooks/subprocess-runner.d.ts +21 -0
  230. package/dist/hooks/subprocess.d.ts +74 -0
  231. package/dist/hub/client/connect.d.ts +14 -0
  232. package/dist/hub/client/index.d.ts +146 -0
  233. package/dist/hub/client/managed-hub-build-watcher.d.ts +62 -0
  234. package/dist/hub/client/session-client.d.ts +138 -0
  235. package/dist/hub/client/ui-client.d.ts +52 -0
  236. package/dist/hub/daemon/entry.d.ts +15 -0
  237. package/dist/hub/daemon/entry.js +2033 -0
  238. package/dist/hub/daemon/index.d.ts +125 -0
  239. package/dist/hub/daemon/runtime-handlers.d.ts +12 -0
  240. package/dist/hub/daemon/shutdown-coordinator.d.ts +31 -0
  241. package/dist/hub/daemon/start-shared-server.d.ts +18 -0
  242. package/dist/hub/daemon/telemetry.d.ts +19 -0
  243. package/dist/hub/discovery/defaults.d.ts +16 -0
  244. package/dist/hub/discovery/index.d.ts +139 -0
  245. package/dist/hub/discovery/instance-lock.d.ts +51 -0
  246. package/dist/hub/discovery/workspace.d.ts +13 -0
  247. package/dist/hub/index.d.ts +38 -0
  248. package/dist/hub/index.js +2023 -0
  249. package/dist/hub/runtime-host/hub-runtime-host.d.ts +83 -0
  250. package/dist/hub/runtime-host/remote-runtime-host.d.ts +9 -0
  251. package/dist/hub/server/browser-websocket.d.ts +22 -0
  252. package/dist/hub/server/command-transport.d.ts +29 -0
  253. package/dist/hub/server/handlers/approval-handlers.d.ts +24 -0
  254. package/dist/hub/server/handlers/capability-handlers.d.ts +12 -0
  255. package/dist/hub/server/handlers/client-handlers.d.ts +6 -0
  256. package/dist/hub/server/handlers/connector-handlers.d.ts +20 -0
  257. package/dist/hub/server/handlers/context.d.ts +98 -0
  258. package/dist/hub/server/handlers/run-handlers.d.ts +6 -0
  259. package/dist/hub/server/handlers/run-queue-handlers.d.ts +33 -0
  260. package/dist/hub/server/handlers/session-event-projector.d.ts +7 -0
  261. package/dist/hub/server/handlers/session-handlers.d.ts +30 -0
  262. package/dist/hub/server/hub-client-contributions.d.ts +19 -0
  263. package/dist/hub/server/hub-event-log.d.ts +57 -0
  264. package/dist/hub/server/hub-notifications.d.ts +7 -0
  265. package/dist/hub/server/hub-run-queue.d.ts +82 -0
  266. package/dist/hub/server/hub-schedule-events.d.ts +2 -0
  267. package/dist/hub/server/hub-server-logging.d.ts +2 -0
  268. package/dist/hub/server/hub-server-options.d.ts +94 -0
  269. package/dist/hub/server/hub-server-transport.d.ts +71 -0
  270. package/dist/hub/server/hub-session-records.d.ts +9 -0
  271. package/dist/hub/server/hub-websocket-server.d.ts +12 -0
  272. package/dist/hub/server/index.d.ts +4 -0
  273. package/dist/hub/server/native-transport.d.ts +25 -0
  274. package/dist/hub/server/task-command-service.d.ts +11 -0
  275. package/dist/index.d.ts +172 -0
  276. package/dist/index.js +5435 -0
  277. package/dist/logging/early-logger.d.ts +37 -0
  278. package/dist/remote-config/integration.d.ts +17 -0
  279. package/dist/runtime/atomic/base-revision-reads.d.ts +106 -0
  280. package/dist/runtime/atomic/base-revision.d.ts +77 -0
  281. package/dist/runtime/atomic/check-first-edits.d.ts +79 -0
  282. package/dist/runtime/atomic/file-revisions.d.ts +268 -0
  283. package/dist/runtime/atomic/oracle.d.ts +178 -0
  284. package/dist/runtime/atomic/page-check.d.ts +39 -0
  285. package/dist/runtime/atomic/plan-capture.d.ts +40 -0
  286. package/dist/runtime/atomic/plan-text.d.ts +33 -0
  287. package/dist/runtime/atomic/plan-tool.d.ts +159 -0
  288. package/dist/runtime/atomic/proposal.d.ts +112 -0
  289. package/dist/runtime/atomic/propose-check-tool.d.ts +76 -0
  290. package/dist/runtime/atomic/protocol.d.ts +233 -0
  291. package/dist/runtime/atomic/restore-file-tool.d.ts +196 -0
  292. package/dist/runtime/atomic/revision-capture.d.ts +75 -0
  293. package/dist/runtime/atomic/run-check-tool.d.ts +64 -0
  294. package/dist/runtime/atomic/session-protocol.d.ts +304 -0
  295. package/dist/runtime/atomic/session-revisions.d.ts +77 -0
  296. package/dist/runtime/atomic/snapshot.d.ts +77 -0
  297. package/dist/runtime/atomic/stalled-checks.d.ts +106 -0
  298. package/dist/runtime/atomic/submit-transaction-tool.d.ts +50 -0
  299. package/dist/runtime/atomic/tool-activity.d.ts +15 -0
  300. package/dist/runtime/atomic/transaction-controller.d.ts +364 -0
  301. package/dist/runtime/atomic/unparseable-change.d.ts +35 -0
  302. package/dist/runtime/capabilities/index.d.ts +2 -0
  303. package/dist/runtime/capabilities/normalize-runtime-capabilities.d.ts +2 -0
  304. package/dist/runtime/capabilities/runtime-capabilities.d.ts +18 -0
  305. package/dist/runtime/config/agent-message-codec.d.ts +6 -0
  306. package/dist/runtime/config/agent-runtime-config-builder.d.ts +93 -0
  307. package/dist/runtime/config/connection-update.d.ts +40 -0
  308. package/dist/runtime/escalation/a2a.d.ts +109 -0
  309. package/dist/runtime/escalation/assessment.d.ts +54 -0
  310. package/dist/runtime/escalation/brief.d.ts +70 -0
  311. package/dist/runtime/escalation/escalate-tool.d.ts +93 -0
  312. package/dist/runtime/escalation/escalation-controller.d.ts +62 -0
  313. package/dist/runtime/escalation/escalation-session.d.ts +241 -0
  314. package/dist/runtime/escalation/expert-failure.d.ts +20 -0
  315. package/dist/runtime/escalation/expert-guards.d.ts +46 -0
  316. package/dist/runtime/escalation/expert-mailbox.d.ts +34 -0
  317. package/dist/runtime/escalation/expert-notes.d.ts +115 -0
  318. package/dist/runtime/escalation/expert-prompt.d.ts +29 -0
  319. package/dist/runtime/escalation/expert-revisions.d.ts +62 -0
  320. package/dist/runtime/escalation/expert-session.d.ts +164 -0
  321. package/dist/runtime/escalation/expert-transcript.d.ts +32 -0
  322. package/dist/runtime/escalation/forced-escalation.d.ts +58 -0
  323. package/dist/runtime/escalation/stand-down.d.ts +66 -0
  324. package/dist/runtime/escalation/struggle-offer.d.ts +100 -0
  325. package/dist/runtime/escalation/watch-tool.d.ts +34 -0
  326. package/dist/runtime/host/history.d.ts +19 -0
  327. package/dist/runtime/host/host.d.ts +7 -0
  328. package/dist/runtime/host/local/agent-event-bridge.d.ts +50 -0
  329. package/dist/runtime/host/local/session-record.d.ts +6 -0
  330. package/dist/runtime/host/local/session-service-invoker.d.ts +4 -0
  331. package/dist/runtime/host/local/spawn-tool.d.ts +57 -0
  332. package/dist/runtime/host/local/user-files.d.ts +1 -0
  333. package/dist/runtime/host/local-runtime-host.d.ts +298 -0
  334. package/dist/runtime/host/runtime-host-support.d.ts +39 -0
  335. package/dist/runtime/host/runtime-host.d.ts +280 -0
  336. package/dist/runtime/host/steer-side-turn.d.ts +119 -0
  337. package/dist/runtime/orchestration/runtime-builder.d.ts +14 -0
  338. package/dist/runtime/orchestration/runtime-event-adapter.d.ts +104 -0
  339. package/dist/runtime/orchestration/runtime-oauth-token-manager.d.ts +28 -0
  340. package/dist/runtime/orchestration/session-runtime-orchestrator.d.ts +339 -0
  341. package/dist/runtime/orchestration/session-runtime.d.ts +118 -0
  342. package/dist/runtime/orchestration/user-input-builder.d.ts +15 -0
  343. package/dist/runtime/process-start-token.d.ts +23 -0
  344. package/dist/runtime/safety/loop-detection.d.ts +160 -0
  345. package/dist/runtime/safety/mistake-tracker.d.ts +84 -0
  346. package/dist/runtime/safety/rules.d.ts +6 -0
  347. package/dist/runtime/safety/struggle-detector.d.ts +414 -0
  348. package/dist/runtime/safety/worker-struggle-stop.d.ts +20 -0
  349. package/dist/runtime/safety/worker-struggle.d.ts +166 -0
  350. package/dist/runtime/sandbox/agent-sandbox.d.ts +111 -0
  351. package/dist/runtime/sandbox/overlay-fs.d.ts +71 -0
  352. package/dist/runtime/sandbox/sandbox-binaries.d.ts +10 -0
  353. package/dist/runtime/tools/subprocess-sandbox-lifecycle.d.ts +9 -0
  354. package/dist/runtime/tools/subprocess-sandbox.d.ts +62 -0
  355. package/dist/runtime/tools/tool-approval.d.ts +9 -0
  356. package/dist/runtime/turn-queue/harness-notes.d.ts +18 -0
  357. package/dist/runtime/turn-queue/pending-prompt-service.d.ts +117 -0
  358. package/dist/services/agent-events.d.ts +59 -0
  359. package/dist/services/config.d.ts +2 -0
  360. package/dist/services/connectors/active-connectors.d.ts +2 -0
  361. package/dist/services/connectors/connector-autostart.d.ts +33 -0
  362. package/dist/services/connectors/connector-child-env.d.ts +14 -0
  363. package/dist/services/connectors/connector-cleanup.d.ts +20 -0
  364. package/dist/services/connectors/connector-supervisor.d.ts +134 -0
  365. package/dist/services/connectors/daemon-connector-reconnect.d.ts +15 -0
  366. package/dist/services/feature-flags/FeatureFlagsService.d.ts +49 -0
  367. package/dist/services/feature-flags/index.d.ts +2 -0
  368. package/dist/services/feature-flags/posthog.d.ts +24 -0
  369. package/dist/services/feature-flags/posthog.js +1 -0
  370. package/dist/services/feature-flags/providers.d.ts +7 -0
  371. package/dist/services/global-settings.d.ts +113 -0
  372. package/dist/services/llms/apihandler-agent-model-adapter.d.ts +26 -0
  373. package/dist/services/llms/cline-recommended-models.d.ts +62 -0
  374. package/dist/services/llms/configured-provider-registry.d.ts +27 -0
  375. package/dist/services/llms/handler-factory.d.ts +23 -0
  376. package/dist/services/llms/provider-defaults.d.ts +36 -0
  377. package/dist/services/llms/provider-settings.d.ts +420 -0
  378. package/dist/services/llms/runtime-config.d.ts +3 -0
  379. package/dist/services/llms/runtime-registry.d.ts +19 -0
  380. package/dist/services/llms/runtime-types.d.ts +84 -0
  381. package/dist/services/llms/session-budget.d.ts +88 -0
  382. package/dist/services/local-runtime-bootstrap.d.ts +62 -0
  383. package/dist/services/marketplace.d.ts +41 -0
  384. package/dist/services/mcp-install.d.ts +35 -0
  385. package/dist/services/plugin-install.d.ts +52 -0
  386. package/dist/services/plugin-mcp-settings.d.ts +31 -0
  387. package/dist/services/plugin-tools.d.ts +40 -0
  388. package/dist/services/plugin-uninstall.d.ts +13 -0
  389. package/dist/services/providers/local-provider-registry.d.ts +354 -0
  390. package/dist/services/providers/local-provider-service.d.ts +101 -0
  391. package/dist/services/providers/model-source.d.ts +3 -0
  392. package/dist/services/providers/provider-config-fields.d.ts +37 -0
  393. package/dist/services/providers/provider-readiness.d.ts +10 -0
  394. package/dist/services/session-artifacts.d.ts +18 -0
  395. package/dist/services/session-data.d.ts +61 -0
  396. package/dist/services/session-import/claude-code.d.ts +16 -0
  397. package/dist/services/session-import/codex.d.ts +34 -0
  398. package/dist/services/session-import/index.d.ts +6 -0
  399. package/dist/services/session-import/opencode.d.ts +25 -0
  400. package/dist/services/session-import/sanitize.d.ts +16 -0
  401. package/dist/services/session-import/service.d.ts +31 -0
  402. package/dist/services/session-import/types.d.ts +87 -0
  403. package/dist/services/session-telemetry.d.ts +15 -0
  404. package/dist/services/storage/file-team-store.d.ts +32 -0
  405. package/dist/services/storage/provider-settings-legacy-migration.d.ts +38 -0
  406. package/dist/services/storage/provider-settings-manager.d.ts +31 -0
  407. package/dist/services/storage/sqlite-session-store.d.ts +35 -0
  408. package/dist/services/storage/sqlite-team-store.d.ts +42 -0
  409. package/dist/services/storage/team-events-retention.d.ts +25 -0
  410. package/dist/services/storage/team-store.d.ts +16 -0
  411. package/dist/services/telemetry/ITelemetryAdapter.d.ts +54 -0
  412. package/dist/services/telemetry/OpenTelemetryAdapter.d.ts +43 -0
  413. package/dist/services/telemetry/OpenTelemetryProvider.d.ts +99 -0
  414. package/dist/services/telemetry/TelemetryLoggerSink.d.ts +27 -0
  415. package/dist/services/telemetry/TelemetryService.d.ts +40 -0
  416. package/dist/services/telemetry/core-events.d.ts +396 -0
  417. package/dist/services/telemetry/distinct-id.d.ts +2 -0
  418. package/dist/services/telemetry/index.d.ts +4 -0
  419. package/dist/services/telemetry/index.js +1 -0
  420. package/dist/services/usage.d.ts +19 -0
  421. package/dist/services/workspace/agent-schedules-workspace.d.ts +8 -0
  422. package/dist/services/workspace/chat-workspace.d.ts +9 -0
  423. package/dist/services/workspace/file-indexer.d.ts +5 -0
  424. package/dist/services/workspace/index.d.ts +6 -0
  425. package/dist/services/workspace/mention-enricher.d.ts +13 -0
  426. package/dist/services/workspace/workspace-manager.d.ts +27 -0
  427. package/dist/services/workspace/workspace-manifest.d.ts +42 -0
  428. package/dist/services/workspace/workspace-telemetry.d.ts +18 -0
  429. package/dist/session/checkpoint-diff.d.ts +25 -0
  430. package/dist/session/checkpoint-restore.d.ts +34 -0
  431. package/dist/session/display-messages.d.ts +28 -0
  432. package/dist/session/history-origin.d.ts +19 -0
  433. package/dist/session/models/session-compaction.d.ts +22 -0
  434. package/dist/session/models/session-graph.d.ts +15 -0
  435. package/dist/session/models/session-manifest.d.ts +32 -0
  436. package/dist/session/models/session-row.d.ts +107 -0
  437. package/dist/session/persisted-tool-result-content.d.ts +8 -0
  438. package/dist/session/search/index.d.ts +1 -0
  439. package/dist/session/search/session-history-search.d.ts +51 -0
  440. package/dist/session/services/file-session-service.d.ts +10 -0
  441. package/dist/session/services/message-builder.d.ts +208 -0
  442. package/dist/session/services/persistence-service.d.ts +92 -0
  443. package/dist/session/services/read-overlap.d.ts +40 -0
  444. package/dist/session/services/session-service.d.ts +15 -0
  445. package/dist/session/session-snapshot.d.ts +59 -0
  446. package/dist/session/session-versioning-service.d.ts +50 -0
  447. package/dist/session/stores/atomic-file.d.ts +1 -0
  448. package/dist/session/stores/conversation-store.d.ts +29 -0
  449. package/dist/session/stores/session-manifest-store.d.ts +49 -0
  450. package/dist/session/stores/team-persistence-store.d.ts +23 -0
  451. package/dist/session/team/index.d.ts +2 -0
  452. package/dist/session/team/team-child-session-manager.d.ts +35 -0
  453. package/dist/session/team/team-session-coordinator.d.ts +13 -0
  454. package/dist/session/user-run-messages.d.ts +20 -0
  455. package/dist/settings/index.d.ts +2 -0
  456. package/dist/settings/settings-service.d.ts +8 -0
  457. package/dist/settings/types.d.ts +83 -0
  458. package/dist/tasks/agenda-task-api.d.ts +20 -0
  459. package/dist/tasks/agenda-task-manager.d.ts +109 -0
  460. package/dist/tasks/agenda-task-tool.d.ts +94 -0
  461. package/dist/tasks/index.d.ts +9 -0
  462. package/dist/tasks/specs/task-spec-file-store.d.ts +38 -0
  463. package/dist/tasks/specs/task-spec-parser.d.ts +65 -0
  464. package/dist/tasks/store/sqlite-task-store.d.ts +73 -0
  465. package/dist/tasks/store/task-schema.d.ts +2 -0
  466. package/dist/tasks/task-location.d.ts +14 -0
  467. package/dist/tasks/task-tool.d.ts +143 -0
  468. package/dist/types/chat-schema.d.ts +194 -0
  469. package/dist/types/common.d.ts +35 -0
  470. package/dist/types/config.d.ts +994 -0
  471. package/dist/types/events.d.ts +102 -0
  472. package/dist/types/provider-settings.d.ts +29 -0
  473. package/dist/types/session.d.ts +187 -0
  474. package/dist/types/sessions.d.ts +42 -0
  475. package/dist/types/storage.d.ts +36 -0
  476. package/dist/types.d.ts +34 -0
  477. package/dist/version.d.ts +1 -0
  478. package/package.json +98 -0
  479. package/scripts/document-reader-assets.mjs +161 -0
@@ -0,0 +1,233 @@
1
+ import { type Oracle, type OracleVerdict } from "./oracle";
2
+ /**
3
+ * How a transaction was judged, and by whom.
4
+ *
5
+ * `self-declared` is not a lesser flavour of the same thing and is never
6
+ * presented as one. An oracle answers about the program; a model answers about
7
+ * the edit it meant to make, and across the atomic campaign those disagreed
8
+ * routinely — transactions that reported success and failed the oracle were
9
+ * the normal case, because the model had fixed the error it was looking at and
10
+ * not the one the program still had.
11
+ *
12
+ * `undeclared` is a third thing and the weakest of the three: nothing could
13
+ * check the change and the model never said whether it worked. The files are
14
+ * kept, because discarding real work over a sentence nobody wrote is the
15
+ * failure this boundary exists to avoid -- but calling that `self-declared`
16
+ * would report a judgement that was never made.
17
+ */
18
+ export type TransactionVerdictSource = "oracle" | "self-declared" | "undeclared";
19
+ export interface TransactionOutcome {
20
+ /** One-based, in the order they were opened. */
21
+ transaction: number;
22
+ kept: boolean;
23
+ /**
24
+ * Not kept, and not rolled back either.
25
+ *
26
+ * The check said something it had never said before in this run, which is
27
+ * the one observable that separates an attempt that moved the problem from
28
+ * one that failed on the same wall. The changes stayed on disk and the next
29
+ * transaction opened on top of them, with the rollback target unchanged.
30
+ */
31
+ carried?: boolean;
32
+ source: TransactionVerdictSource;
33
+ /** What the model said it would change, as it declared it. */
34
+ plan?: string;
35
+ /** What the model said about the change when it tried to end the turn. */
36
+ account?: string;
37
+ /** The oracle's output, or the model's own account when there was none. */
38
+ evidence: string;
39
+ }
40
+ export interface ProtocolPromptInput {
41
+ /** One-based number of the transaction about to open. */
42
+ transaction: number;
43
+ /** Hard limit on declared changes. Three, unless the host says otherwise. */
44
+ maxChanges: number;
45
+ /** Last transaction this task will get, so the model knows the budget. */
46
+ maxTransactions: number;
47
+ /**
48
+ * Something the host wants said on the last transaction only.
49
+ *
50
+ * The escalation offer uses it. Kept as opaque text because the protocol
51
+ * has no business knowing what an expert is.
52
+ */
53
+ lastTransactionNotice?: string;
54
+ /** The check that will decide, when there is one. */
55
+ oracle?: Oracle;
56
+ /**
57
+ * Whether the model may name its own check, for a workspace with none.
58
+ *
59
+ * Only ever true where `oracle` is absent and there is a user to approve
60
+ * one: the alternative in that case is the model's own account of its work,
61
+ * which is the verdict every wrong outcome measured so far came from.
62
+ */
63
+ canProposeCheck?: boolean;
64
+ /**
65
+ * Whether the check this run adopted has yet to pass on any files at all.
66
+ *
67
+ * Changes what the record of earlier transactions is allowed to conclude.
68
+ */
69
+ checkNeverPassed?: boolean;
70
+ /** Whether the model may replace that check, this transaction, once. */
71
+ canReplaceCheck?: boolean;
72
+ /**
73
+ * Whether the check came from the host rather than from the model.
74
+ *
75
+ * A different situation from `checkNeverPassed`, which only ever describes
76
+ * a check the model proposed and may replace. This one cannot be replaced:
77
+ * the user named it, so a run that keeps failing it is not evidence against
78
+ * the check.
79
+ */
80
+ hostSuppliedCheck?: boolean;
81
+ /** What earlier transactions tried, in order. */
82
+ history: readonly TransactionOutcome[];
83
+ }
84
+ /**
85
+ * The rules, restated in full at the open of every transaction.
86
+ *
87
+ * Repeated rather than referred back to, the way the harness does it: a
88
+ * transaction the model experiences as a continuation of a conversation still
89
+ * has to be one it can see the rules of, and a rule that scrolled out of the
90
+ * window is a rule that is not followed. The cost is a few hundred tokens per
91
+ * transaction against a protocol that only works if it is understood.
92
+ */
93
+ export declare function buildProtocolPrompt(input: ProtocolPromptInput): string;
94
+ /**
95
+ * What the model is told when it ends a transaction it never changed.
96
+ *
97
+ * Not the protocol rules again. The rules are already in the window — it read
98
+ * them when the transaction opened and followed none of them — so restating
99
+ * them buys another few hundred tokens of the same. What is new is that the
100
+ * submission was empty, that it cost nothing, and how much budget is left.
101
+ *
102
+ * IT MUST NOT OFFER AN EXIT. The first version ended with "if you have run out
103
+ * of ideas, say so plainly in one sentence and stop... it is not counted
104
+ * against you". Measured on pandorum session 1789114968332_v7fsq
105
+ * (JackDeltaCoder 9B, 4.100.92): the model took that offer on its first empty
106
+ * attempt and closed the run, reporting that "all my edits failed to match any
107
+ * lines" — which the transcript contradicts, since one edit had applied and it
108
+ * had used `restore_file` six times to undo its own work. A model facing a task
109
+ * it finds hard reads a sanctioned, unpenalised exit as permission, and a small
110
+ * one takes it immediately.
111
+ *
112
+ * So this says the opposite: the budget is counted out loud, an empty
113
+ * submission is named as an attempt that has not happened rather than a failed
114
+ * one, and the next step is concrete. Stopping is still possible — nothing
115
+ * here prevents it — but it is no longer suggested, and no longer described as
116
+ * worth more than trying again.
117
+ */
118
+ export declare function buildEmptyAttemptPrompt(input: {
119
+ transaction: number;
120
+ maxChanges: number;
121
+ maxTransactions: number;
122
+ /**
123
+ * The check, run at the boundary, that disagrees with the model's decision
124
+ * to stop. Present only when it failed: a completion on top of a failing
125
+ * check is a fix being reported rather than made, and the model is told so
126
+ * in the same message that tells it the transaction is still open.
127
+ */
128
+ check?: {
129
+ label: string;
130
+ output?: string;
131
+ };
132
+ /**
133
+ * No tool was called in this transaction at all. Worth saying, because the
134
+ * advice that follows assumes edits were tried and refused, and here
135
+ * nothing has been tried — the useful next move is the first tool call, not
136
+ * a better plan.
137
+ */
138
+ neverBegan?: boolean;
139
+ }): string;
140
+ /**
141
+ * The line an empty submission ends on, for the user and for the log.
142
+ *
143
+ * Worth a line of its own precisely because it is not a verdict: no check ran,
144
+ * nothing was put back, and a run where this happened reads — from the
145
+ * transcript alone — like a transaction that quietly went missing.
146
+ *
147
+ * `continued` says which of the two things is about to happen: the transaction
148
+ * is held open for another attempt, or it has come back empty often enough
149
+ * that it is spent and closed like any other. Neither of them ends the run.
150
+ */
151
+ export declare function describeEmptyAttempt(transaction: number, continued: boolean, neverBegan?: boolean): string;
152
+ /**
153
+ * What a turn that called nothing is told, while the guard is still holding.
154
+ *
155
+ * Deliberately not phrased as a submission. The message this replaces opened
156
+ * "TX-01 was submitted with…", which was a report of something the model had
157
+ * not done — it had thought a turn through and called nothing, and the protocol
158
+ * treated that as an act. On a model that could not reconcile the two, that
159
+ * produced six identical boundary messages and reasoning reading "I keep
160
+ * failing to emit actual tool calls".
161
+ *
162
+ * So this says what actually happened, names the tool that does submit, and is
163
+ * honest that the guard exists and when it fires.
164
+ */
165
+ export declare function describeSilentTurn(input: {
166
+ transaction: number;
167
+ silent: number;
168
+ before: number;
169
+ untouched: boolean;
170
+ check?: {
171
+ label: string;
172
+ output?: string;
173
+ };
174
+ }): string;
175
+ /**
176
+ * The line a run ends on when the model never called a tool.
177
+ *
178
+ * The backstop for an unstarted transaction, and it says what actually
179
+ * happened. The alternative this replaces — spending a transaction per pair of
180
+ * quiet turns — left six discarded transactions behind and read as six failed
181
+ * attempts when nothing had been attempted once.
182
+ */
183
+ export declare function describeNeverStarted(transaction: number, attempts: number): string;
184
+ /**
185
+ * The line a transaction ends on, for the user and for the log.
186
+ *
187
+ * Says which of the two things happened to their files, because "discarded" is
188
+ * the word that matters and it has to be unmissable.
189
+ */
190
+ export declare function describeVerdict(transaction: number, kept: boolean, source: TransactionVerdictSource, verdict?: OracleVerdict, forced?: boolean, carried?: boolean): string;
191
+ /**
192
+ * What the model is told when the user turns the protocol off mid-run.
193
+ *
194
+ * Sent as a steer, not a queued message, and so delivered after the previous
195
+ * turn's tool results and before the next model request -- the one window in
196
+ * the loop where no edit is in flight. That matters for more than tidiness: a
197
+ * discarded transaction puts every file it touched back, and doing that while
198
+ * an `editor` call is open would rewrite the file underneath the call that is
199
+ * writing it. So the rollback happens at this same boundary, and this message
200
+ * reports what has *already* happened rather than warning about what is about
201
+ * to.
202
+ *
203
+ * Three things it has to get right, each learned from a way a model reads a
204
+ * message like this wrongly:
205
+ *
206
+ * 1. **Whose decision this was.** A model told only that the protocol stopped
207
+ * reads it as a verdict on its work and starts apologising or re-doing the
208
+ * change. It is the user's choice about how the session runs, and saying so
209
+ * first is what stops that.
210
+ * 2. **That the files on disk may have moved.** A rollback invalidates every
211
+ * read the model is holding. The host forgets the receipts mechanically
212
+ * (`forgetReads`), so the next edit is refused until the file is read again
213
+ * -- but a model that does not know why reads the refusal as a bug and
214
+ * retries the same call. Saying it here turns a confusing refusal into an
215
+ * expected one.
216
+ * 3. **That the tools are gone.** The protocol's tools leave with it. A model
217
+ * that calls `submit_transaction` afterwards gets an unknown-tool error and
218
+ * no explanation, and unknown-tool errors are the kind a model repeats.
219
+ *
220
+ * The verdict line is passed in already written rather than rebuilt here, so
221
+ * the sentence the model reads is character for character the one it would have
222
+ * read had the transaction closed on its own.
223
+ */
224
+ export declare function describeDisengagement(input: {
225
+ /** The transaction that was open, if one was. */
226
+ transaction?: number;
227
+ /** `describeVerdict` for that transaction, if one was judged. */
228
+ verdict?: string;
229
+ /** Files put back by the rollback. Absent or zero means nothing moved. */
230
+ filesPutBack?: number;
231
+ /** Whether the judged transaction was kept. */
232
+ kept?: boolean;
233
+ }): string;
@@ -0,0 +1,196 @@
1
+ /**
2
+ * Put one file back to what it said when this transaction opened.
3
+ *
4
+ * The rollback the protocol already performs, made available before the
5
+ * transaction ends and narrowed to a single file. The model that has just
6
+ * broken something can undo exactly that, keep everything else it got right,
7
+ * and carry on.
8
+ *
9
+ * Why it is worth a tool. Measured on the run that prompted it (pandorum,
10
+ * 2026-09-05): three discarded transactions, 7328s, and 22 of 43 edits went to
11
+ * a line the same transaction had already edited. The model announced it had
12
+ * damaged the file nineteen times — "I accidentally deleted the entire `dDec`
13
+ * method", "I accidentally merged dGrid and dDec into one line!" — and each
14
+ * time set about rebuilding a 400-character minified line from memory. 91% of
15
+ * that run's wall clock came after the first of those.
16
+ *
17
+ * What it takes with it. The base is the whole file as the transaction found
18
+ * it, so a restore discards anything changed in that file since the
19
+ * transaction opened — including an edit the user made in their own editor
20
+ * while it was open. That is not new: the rollback at the transaction boundary
21
+ * has always had exactly this reach, and this only brings it forward and
22
+ * narrows it to one file. It is worth knowing rather than discovering.
23
+ *
24
+ * Why it is bounded. The same model class has been measured issuing twelve
25
+ * `rm` of the file under test in one transaction, recreating it whole each
26
+ * time, and losing the file when the twelfth outlived the transaction. A cheap
27
+ * undo lowers the price of a reckless edit, so this one counts itself, says so
28
+ * every time, and stops. A restore loop that announces itself is the point:
29
+ * the failure it replaces was silent and cost two hours.
30
+ */
31
+ import { type AgentTool } from "@cerebriline/shared";
32
+ import { type RevisionLog } from "./file-revisions";
33
+ import type { Snapshot } from "./snapshot";
34
+ export declare const RESTORE_FILE_TOOL_NAME = "restore_file";
35
+ /**
36
+ * Restores one transaction is allowed before it is told to stop.
37
+ *
38
+ * Nine. It was three, on the reasoning that a fourth restore in one
39
+ * transaction is not a recovery but the loop -- and for a model that edits
40
+ * accurately it still is. For one that does not, the cap turned out to be the
41
+ * thing that ended the run rather than the thing that saved it.
42
+ *
43
+ * Measured on a JackDelta 9B session: 19 restore attempts, 8 of them refused
44
+ * because the cap was already spent, and the model then named the cap as its
45
+ * reason for giving up in three separate transactions -- "exhausted restore
46
+ * slots (3/3)" in TX-02, and the same again in TX-03 and TX-05. Faced with a
47
+ * mangled file it could neither restore nor repair, it submitted an apology
48
+ * instead of a change. The cap was doing the opposite of its job: the
49
+ * transaction still gets rolled back wholesale if the check fails, so a
50
+ * restore costs nothing but the tokens, while refusing one costs the
51
+ * transaction.
52
+ *
53
+ * It was then nine, for the same reason, and nine was still too few. Measured
54
+ * on pandorum session 1789122866533_br1d0 (JackOD 9B, 4.100.94): the
55
+ * transaction spent all nine and was refused twice more, and the model's own
56
+ * account of why it stopped names the state it could not get out of -- "this
57
+ * transaction has accumulated 14+ failed/rolled-back attempts with no clean fix
58
+ * landing on disk", ending in a question to the user rather than a change.
59
+ * Twenty-seven is three times the last figure and, unlike it, is not a number
60
+ * the measured runs reach.
61
+ *
62
+ * The cap costs more than it saves at small sizes and the asymmetry is not
63
+ * close. A restore cannot lose the file -- it writes the base revision back, so
64
+ * the worst case is tokens -- while refusing one strands a model in a file it
65
+ * mangled, and the transaction is rolled back wholesale anyway if the check
66
+ * fails. The looping this was meant to catch is caught better elsewhere now:
67
+ * `MAX_NOOP_RESTORES_PER_TRANSACTION` stops the degenerate case where nothing
68
+ * is being undone at all, which is what the 102-restore run actually was, and
69
+ * the repeated-call guard stops an identical call being retried. This number
70
+ * only has to stop a model restoring real work in circles forever, and it is
71
+ * the last line rather than the first.
72
+ */
73
+ export declare const MAX_RESTORES_PER_TRANSACTION = 27;
74
+ /**
75
+ * No-op restores answered before the tool stops answering them.
76
+ *
77
+ * A restore of a file that already matches the base changes nothing, so it
78
+ * never touched the budget above and never refused. That made it free, and a
79
+ * free call that returns a reassuring sentence is a loop waiting to happen.
80
+ *
81
+ * Measured on pandorum session 1789117848964_zhbk5 (JackOD 9B, 4.100.93):
82
+ * 108 `restore_file` calls in a single transaction, of which **102 were
83
+ * no-ops** and 6 were real -- against a cap of 9 that was therefore never
84
+ * reached. The model was told "that is 102 times you have asked" and asked
85
+ * again. 212 tool calls and 33 minutes went to a transaction that never
86
+ * closed.
87
+ *
88
+ * Three, and they are counted across the transaction rather than
89
+ * consecutively: while the file matches the base there is nothing to undo, and
90
+ * that is equally true whatever the model did in between. Three leaves room
91
+ * for the honest case -- an edit that did not apply, restored out of caution --
92
+ * without leaving the door open on a hundred.
93
+ */
94
+ export declare const MAX_NOOP_RESTORES_PER_TRANSACTION = 3;
95
+ export declare const RESTORE_FILE_TOOL_DESCRIPTION = "Put one file back exactly as it was when this transaction opened, discarding every change you have made to it since.\n\nUse it the moment an edit goes wrong in a way you would otherwise have to undo by hand \u2014 you deleted more than you meant to, you merged two lines together, you have rewritten the same line four times and it is further from working than when you started. Restoring is exact. Retyping the original from memory is not, and on a long or minified line it is where runs go to die.\n\nIt affects one file. Anything you changed in other files this transaction stays. If the file did not exist when the transaction opened, restoring it deletes it.\n\n**You do not have to go all the way back.** Every time a tool writes a file, that version is kept and numbered, and `revision` says which one to return to:\n\n- `revision: \"last\"` undoes only your most recent change to the file, keeping everything before it. This is almost always the one you want after a single edit goes wrong.\n- `revision: \"#3\"` (or `3`) returns to that numbered version. Every edit's result tells you the number it just made, and every read of the file lists the ones you can go back to.\n- `revision: \"original\"` is the file as this transaction opened, which is what you get if you say nothing.\n\nGoing back one step is not the same as starting again. If you have fixed three things and broken the fourth, `last` keeps the three.\n\nThis is not the end of the transaction and it does not spend one \u2014 you carry on, from the file as it was. Read the file again afterwards: its line numbers are back to what they were at that revision, and any range you read earlier no longer addresses the same code.\n\nIf you only want to *see* what the file said before your changes, do not restore it \u2014 call `read_files` with `revision: \"base\"` and it is shown to you with the file left alone.";
96
+ /**
97
+ * The same tool, described for a session that has no transactions.
98
+ *
99
+ * Written separately rather than templated, because almost every sentence in
100
+ * the transaction version is about the transaction: what the base is, what
101
+ * survives, what a restore does not spend. Here the base is the file as this
102
+ * session first found it, there is nothing to spend, and the one thing that
103
+ * carries over unchanged is the part that matters — going back is exact and
104
+ * retyping from memory is not.
105
+ */
106
+ export declare const RESTORE_FILE_TOOL_SESSION_DESCRIPTION = "Put one file back to a version of it you had earlier, discarding what you have written to it since.\n\nUse it the moment an edit goes wrong in a way you would otherwise have to undo by hand \u2014 you deleted more than you meant to, you merged two lines together, you replaced the file with something that was never meant to be its contents. Restoring is exact. Retyping the original from memory is not, and on a long or minified line it is where runs go to die.\n\nEvery time a tool writes a file, that version is kept and numbered, and `revision` says which one to return to:\n\n- `revision: \"last\"` undoes only your most recent change to the file, keeping everything before it. This is almost always the one you want after a single edit goes wrong.\n- `revision: \"#3\"` (or `3`) returns to that numbered version. Every edit's result tells you the number it just made, and every read of the file lists the ones you can go back to.\n- `revision: \"original\"` is the file as it stood before this session first wrote to it, which is what you get if you say nothing.\n\nIt affects one file, and only files this session has written: a file nothing has touched has no earlier version held, and this will say so rather than guess.\n\nRead the file again afterwards: its line numbers are back to what they were at that revision, and any range you read earlier no longer addresses the same code.\n\nIf you only want to *see* what the file said before your changes, do not restore it \u2014 call `read_files` with `revision: \"original\"` (or a number) and it is shown to you with the file left alone.";
107
+ export declare const RESTORE_FILE_TOOL_INPUT_SCHEMA: {
108
+ readonly type: "object";
109
+ readonly properties: {
110
+ readonly path: {
111
+ readonly type: "string";
112
+ readonly description: "The file to put back, absolute or relative to the workspace root.";
113
+ };
114
+ readonly revision: {
115
+ readonly type: "string";
116
+ readonly description: "Which version to return to: \"last\" to undo only your most recent change to this file, a number such as \"#3\" for that version, or \"original\" for the file as this transaction opened. Defaults to \"original\".";
117
+ };
118
+ readonly find: {
119
+ readonly type: "string";
120
+ readonly description: "Search this file's revisions instead of restoring anything: the text you are looking for, matched against each revision's note and its contents. Nothing is written and no restore is spent. Use it when you know what you want back but not which number holds it — a method you deleted, a line that used to read differently, or your own note about a change.";
121
+ };
122
+ readonly reason: {
123
+ readonly type: "string";
124
+ readonly description: "One sentence: what went wrong with this file that restoring it undoes.";
125
+ };
126
+ };
127
+ readonly required: readonly ["path"];
128
+ };
129
+ /** The part of the controller this tool drives. */
130
+ export interface RestoreFileSource {
131
+ /** The open transaction's base, or nothing when none is open. */
132
+ readonly pending: Snapshot | undefined;
133
+ /** Which transaction is open, or 0 when there is no protocol. */
134
+ readonly transaction: number;
135
+ /** Every version of every file a tool has written. */
136
+ readonly revisions: RevisionLog;
137
+ /**
138
+ * Where paths resolve when no transaction is open.
139
+ *
140
+ * Supplying it is what makes the tool work with the change protocol off.
141
+ * The base then comes from the log -- `#1`, seeded from the file itself at
142
+ * first touch -- rather than from a snapshot, so the undo covers this
143
+ * session's writes to that one file instead of the whole tree. Left out,
144
+ * a call with no transaction open is refused exactly as it was.
145
+ */
146
+ readonly root?: string;
147
+ }
148
+ export interface RestoreFileToolOptions {
149
+ controller: RestoreFileSource;
150
+ /**
151
+ * Retires what the model had read about this file.
152
+ *
153
+ * A restore moves every line in the file, so the reads that justify an edit
154
+ * by line number no longer describe it. Without this the editor's
155
+ * read-before-edit guard — the one thing standing between a stale line
156
+ * number and the file on disk — waves through an edit aimed at code that
157
+ * has since moved. Hosts that own the receipts supply it; one that does not
158
+ * gets a restore whose warning is only words.
159
+ */
160
+ forgetReads?: (absolutePath: string) => void;
161
+ /** For the host to say, in its own voice, that a file was put back. */
162
+ onRestored?: (event: {
163
+ path: string;
164
+ transaction: number;
165
+ deleted: boolean;
166
+ }) => void;
167
+ onError?: (message: string, error: unknown) => void;
168
+ /**
169
+ * Which world this instance is describing.
170
+ *
171
+ * `session` swaps the description for one that does not talk about
172
+ * transactions. The execute path already tells them apart from
173
+ * `controller.pending`; this is the half that is fixed at creation time.
174
+ */
175
+ scope?: "transaction" | "session";
176
+ }
177
+ export declare function createRestoreFileTool(options: RestoreFileToolOptions): AgentTool;
178
+ /**
179
+ * Real restores in one transaction before the tool says what that many means.
180
+ *
181
+ * Measured on the JackOD4-AC 9B arm: 13.6 `restore_file` calls per run against
182
+ * 0.23 for qwen3.6 27B over 40 runs, a factor of 59. Within the arm the count
183
+ * is near-monotonic with wall time -- the three runs that restored nothing were
184
+ * the three fastest successes, and the three highest counts (28, 30, 36) were
185
+ * the three timeouts. One of them deleted 4,939 bytes, 35% of the file, before
186
+ * it reached the cap.
187
+ *
188
+ * Three is early on purpose, because this is a sentence and not a refusal. The
189
+ * cap that refuses is `MAX_RESTORES_PER_TRANSACTION` and it is deliberately
190
+ * generous: a restore is the right call for an edit that went wrong, and a
191
+ * model told to stop restoring goes back to retyping the original from memory,
192
+ * which is how the runs this came from actually lost files.
193
+ */
194
+ export declare const RESTORE_HABIT_AFTER = 3;
195
+ /** Where the same sentence stops being a nudge and starts being the answer. */
196
+ export declare const RESTORE_HABIT_INSISTS_AFTER = 6;
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Capture a revision of every file a tool writes.
3
+ *
4
+ * The choke point the change protocol never had. `withChangeSignal` next door
5
+ * answers "did something change" for the stalled-check counter; this answers
6
+ * "what did it say afterwards", which is what makes going back to a particular
7
+ * point possible at all.
8
+ *
9
+ * Coverage is deliberately not "re-walk the tree after every call". A snapshot
10
+ * reads every file under the root, and doing that per edit makes a real
11
+ * repository unusable. Instead the tools that name what they write are asked
12
+ * what they wrote, and `run_commands` -- which can write anything -- re-checks
13
+ * the files the model has already touched. That is where the realistic desync
14
+ * is: a `sed -i` or a shell redirect over the file being edited, which would
15
+ * otherwise leave the log claiming a revision that is no longer on disk and
16
+ * make a later restore resurrect stale content.
17
+ *
18
+ * What is NOT covered, stated so it is known rather than discovered: a
19
+ * `run_commands` that writes a file the model has never touched with a tool.
20
+ * That file has no revisions, `restore_file` says so, and the transaction
21
+ * rollback still covers it because the base snapshot does.
22
+ */
23
+ import type { AgentToolDefinition } from "@cerebriline/shared";
24
+ import { type RevisionLog } from "./file-revisions";
25
+ import type { Snapshot } from "./snapshot";
26
+ export interface RevisionCaptureSource {
27
+ /** The open transaction's base, or nothing when none is open. */
28
+ readonly pending: Snapshot | undefined;
29
+ /**
30
+ * Where paths resolve and what counts as inside, when there is no
31
+ * transaction.
32
+ *
33
+ * Supplying it is what makes capture session-scoped: `#1` is seeded from the
34
+ * file's own content at first touch instead of from a base snapshot, and the
35
+ * log outlives every transaction because it never belonged to one. Left out,
36
+ * a session with no open transaction captures nothing, which is what every
37
+ * caller did before this existed.
38
+ *
39
+ * The promise changes with it and the label says so. Inside a transaction
40
+ * `#1` is what a rollback returns the whole tree to; outside one it is what
41
+ * this one file said before this session touched it. "Can the rollback reach
42
+ * this path" stops being a precondition of recording history and becomes a
43
+ * question the rollback asks -- which is the point, since the history is
44
+ * worth having in a session that has no rollback at all.
45
+ */
46
+ readonly root?: string;
47
+ /** Which transaction is open. */
48
+ readonly transaction: number;
49
+ /** Where the revisions go. */
50
+ readonly log: RevisionLog;
51
+ }
52
+ export interface RevisionCaptureOptions {
53
+ readonly source: RevisionCaptureSource;
54
+ /** Read a file as it stands, or nothing when it does not exist. */
55
+ readFile(absolutePath: string): Promise<Buffer | undefined>;
56
+ /**
57
+ * What the checker last said, when it has run and said anything.
58
+ *
59
+ * Appended to the label rather than used as it: it answers "was this
60
+ * working here", which is a different question from "what changed here",
61
+ * and for plenty of files -- a README, anything the checker does not look
62
+ * at -- it has nothing to say at all.
63
+ */
64
+ lastCheck?(): string | undefined;
65
+ }
66
+ /**
67
+ * Every path an `apply_patch` payload names.
68
+ *
69
+ * The paths are in the patch grammar rather than in a field, so they are read
70
+ * out of the text. A payload whose header this does not match captures
71
+ * nothing, which is the same position a `run_commands` write is in — covered
72
+ * by the transaction rollback, not by a revision.
73
+ */
74
+ export declare function patchTargets(payload: string): string[];
75
+ export declare function withRevisionCapture<T extends AgentToolDefinition>(tools: readonly T[], options: RevisionCaptureOptions): T[];
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Run the check that judges this run, on demand, without settling anything.
3
+ *
4
+ * Why it exists. The check reached the model from exactly one place — `settle`,
5
+ * at the completion attempt — while the tool that proposes it told the model
6
+ * the opposite: "it is run for you, unattended, every time your turn ends, and
7
+ * its result comes back to you". So the model believed it had a feedback loop,
8
+ * did not build one of its own, and got no verdict at all until the transaction
9
+ * was over. Measured on pandorum 2026-09-05 under 4.100.68: TX-01 ran 341
10
+ * messages and 65 edits with nothing judged, then one `SyntaxError: missing )
11
+ * after argument list` at the end, then a full rollback — after which the model
12
+ * copied the original file back over its work and started again.
13
+ *
14
+ * The arm that works has never had this problem, and not because its check is
15
+ * better. There the check is a shell line named in the opening prompt, so the
16
+ * model simply reruns it whenever it wants — 88 `run_commands` in one run that
17
+ * ended FIXED. A check the model cannot type is a check it cannot consult, and
18
+ * the only remedy is to hand it one.
19
+ *
20
+ * It settles nothing and rolls nothing back. A failing result here is
21
+ * information, not a verdict: the transaction is still open and the files are
22
+ * still the model's.
23
+ */
24
+ import { type AgentTool } from "@cerebriline/shared";
25
+ import type { Oracle, OracleVerdict } from "./oracle";
26
+ export declare const RUN_CHECK_TOOL_NAME = "run_check";
27
+ /**
28
+ * Runs per transaction before the model is told to stop.
29
+ *
30
+ * Ten, which is deliberately generous next to the protocol's other budgets:
31
+ * this is the one call that is *supposed* to be made repeatedly, and a model
32
+ * that checks after every edit is doing exactly what the check is for. The
33
+ * ceiling exists for the loop that checks without editing — measured on the
34
+ * same class of run as `restore_file`'s — not to ration the loop that works.
35
+ */
36
+ export declare const MAX_CHECKS_PER_TRANSACTION = 10;
37
+ export declare const RUN_CHECK_TOOL_DESCRIPTION = "Run the check that decides whether this task is done, right now, against the files as they currently stand.\n\nThis is your feedback loop. Nothing is settled and nothing is rolled back: the result is information, the transaction stays open, and your changes stay in place whatever it says.\n\nRun it early, on the unmodified files, so you see the failure you are fixing in the check's own words rather than inferring it. Run it after each change. A change you have not run it against is a change you are guessing about, and your own reading of the code is the weakest evidence available to you.\n\nTake no output as no output. If the check passes, say so and finish; the same check runs once more when you do.";
38
+ export declare const RUN_CHECK_TOOL_INPUT_SCHEMA: {
39
+ readonly type: "object";
40
+ readonly properties: {};
41
+ readonly required: readonly [];
42
+ };
43
+ /** The part of the controller this tool drives. */
44
+ export interface CheckRunner {
45
+ readonly oracle: Oracle | undefined;
46
+ readonly transaction: number;
47
+ runCheck(): Promise<OracleVerdict>;
48
+ }
49
+ export interface RunCheckToolOptions {
50
+ controller: CheckRunner;
51
+ /** Whether a check could still arrive, for the message when there is none. */
52
+ canProposeCheck?: boolean;
53
+ /**
54
+ * Told about every run, and given the chance to add to what the model is
55
+ * told about it. Anything returned is appended to the result -- which is how
56
+ * a transaction closed out from under a stalled check gets its settlement
57
+ * and the next transaction's rules into the same reply as the verdict.
58
+ */
59
+ onRun?: (verdict: OracleVerdict, oracle: Oracle) => string | void | Promise<string | void>;
60
+ onError?: (message: string, error: unknown) => void;
61
+ }
62
+ /** What the model is told, so a passing and a failing run read differently. */
63
+ export declare function describeCheckRun(verdict: OracleVerdict, label: string): string;
64
+ export declare function createRunCheckTool(options: RunCheckToolOptions): AgentTool;