@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,31 @@
1
+ import type { AgentExtension } from "@cerebriline/shared";
2
+ import { type SkillsExecutorWithMetadata } from "../tools";
3
+ import { type AvailableRuntimeCommand, type ResolveRuntimeSlashCommandOptions } from "./runtime-commands";
4
+ import { type CreateUserInstructionConfigWatcherOptions, type UserInstructionConfig, type UserInstructionConfigType } from "./user-instruction-config-loader";
5
+ import { type CreateUserInstructionPluginOptions } from "./user-instruction-plugin";
6
+ export interface UserInstructionConfigRecord<TConfig extends UserInstructionConfig = UserInstructionConfig> {
7
+ type: UserInstructionConfigType;
8
+ id: string;
9
+ filePath: string;
10
+ item: TConfig;
11
+ }
12
+ export interface CreateUserInstructionConfigServiceOptions extends CreateUserInstructionConfigWatcherOptions {
13
+ }
14
+ export interface UserInstructionConfigService {
15
+ start(): Promise<void>;
16
+ stop(): void;
17
+ refreshType(type: UserInstructionConfigType): Promise<void>;
18
+ listRecords<TConfig extends UserInstructionConfig = UserInstructionConfig>(type: UserInstructionConfigType): UserInstructionConfigRecord<TConfig>[];
19
+ listRuntimeCommands(): AvailableRuntimeCommand[];
20
+ resolveRuntimeSlashCommand(input: string, options?: ResolveRuntimeSlashCommandOptions): string;
21
+ hasConfiguredSkills(allowedSkillNames?: ReadonlyArray<string>): boolean;
22
+ createSkillsExecutor?(allowedSkillNames?: ReadonlyArray<string>): SkillsExecutorWithMetadata;
23
+ createExtension(options: Omit<CreateUserInstructionPluginOptions, "watcher" | "watcherReady">): AgentExtension;
24
+ }
25
+ /**
26
+ * Present multiple instruction sources as one extension/tool surface. This is
27
+ * used by the hub to overlay host-local Agent Plugin skills on a client-owned
28
+ * instruction snapshot without moving package discovery into each client.
29
+ */
30
+ export declare function combineUserInstructionConfigServices(services: ReadonlyArray<UserInstructionConfigService>): UserInstructionConfigService;
31
+ export declare function createUserInstructionConfigService(options?: CreateUserInstructionConfigServiceOptions): UserInstructionConfigService;
@@ -0,0 +1,129 @@
1
+ import type { BasicLogger, MessageWithMetadata } from "@cerebriline/shared";
2
+ import type { CoreCompactionContext, CoreCompactionResult, CoreCompactionSummarizerConfig } from "../../types/config";
3
+ import type { ProviderConfig } from "../../types/provider-settings";
4
+ import { type BudgetProjectionResult } from "./budget-projection";
5
+ import { type EstimateMessageTokens, type MeasureReportedTokens, type RecencyBounds } from "./compaction-shared";
6
+ import { type CompactionContinuation, type CompactionMeter } from "./continuation-compaction";
7
+ import { type RevisionSpanLookup } from "./tool-ledger";
8
+ export declare function buildAgenticSummaryInputBudget(options: {
9
+ messages: CoreCompactionContext["messages"];
10
+ targetTokens: number;
11
+ estimateMessageTokens: EstimateMessageTokens;
12
+ }): BudgetProjectionResult;
13
+ /**
14
+ * What the summarizer is told it is, which is not the same job in both modes.
15
+ *
16
+ * The system half used to say "concise" while the user half asked for the
17
+ * detail that has to survive, and the model was pulled both ways on the one
18
+ * message that has to carry everything. Both of these agree with their prompt
19
+ * instead — and they have to be separate texts, because the two prompts ask
20
+ * for different artifacts. A replay is written in the first person and is read
21
+ * as the model's own memory; a full summary is a state record read as the only
22
+ * surviving fact. Telling a model to write a hand-over note and then handing it
23
+ * the replay prompt reproduces the seam the replay prompt exists to remove.
24
+ */
25
+ export declare const SUMMARIZER_SYSTEM_PROMPTS: {
26
+ readonly tail: "You are re-telling your own recent work in your own voice, because the earlier part of your transcript is about to be discarded and what you write takes its place directly in front of the turns that remain. Match the prose of those turns. Keep every specific — names, paths, quoted wording, errors, numbers — that you would otherwise have to rediscover.";
27
+ readonly full: "You write the state record for a working session of any kind. The transcript you are given is about to be discarded, so what you write is the only record that remains. Follow the requested structure exactly, section for section, and keep every specific — names, paths, quoted wording, errors, numbers — that whoever continues would otherwise have to rediscover.";
28
+ readonly retrospective: "You are assessing your own reasoning on work that is about to be discarded. This is judgement, not a record — what happened is written up separately. Be terse, and say only what you would want to know before starting the next hour of this task.";
29
+ };
30
+ /**
31
+ * The model calls a compaction is about to make, counted before it makes them.
32
+ *
33
+ * A compaction is several sequential requests -- the summary, the
34
+ * retrospective, then the council -- each of which can take a minute or more
35
+ * on a local model. From outside it is one spinner that sits there, and a run
36
+ * that looked hung on 2026-09-21 was in fact four calls deep and working. The
37
+ * count is what makes the difference legible.
38
+ */
39
+ export declare function planCompactionSteps(options: {
40
+ thinkingSummaryEnabled: boolean;
41
+ councilEnabled: boolean;
42
+ }): number;
43
+ /** One compaction's progress through {@link planCompactionSteps} calls. */
44
+ export interface CompactionProgress {
45
+ /** Count one model call, by the stage it belongs to. */
46
+ step(label: string): void;
47
+ }
48
+ export declare function createCompactionProgress(total: number, emit: (progress: {
49
+ step: number;
50
+ stepTotal: number;
51
+ stepLabel: string;
52
+ }) => void): CompactionProgress;
53
+ export declare function runAgenticCompaction(options: {
54
+ context: CoreCompactionContext;
55
+ providerConfig: ProviderConfig;
56
+ summarizer?: CoreCompactionSummarizerConfig;
57
+ /** Overrides the built-in summary instruction; blank uses the default. */
58
+ summaryPrompt?: string;
59
+ /** Second phase: a retrospective over the reasoning being discarded. */
60
+ thinkingSummaryEnabled?: boolean;
61
+ /** Overrides the built-in retrospective instruction; blank uses the default. */
62
+ thinkingSummaryPrompt?: string;
63
+ /**
64
+ * Third phase: two reviewers, each holding half the transcript, correct the
65
+ * summary and the retrospective against it, and a synthesiser merges them.
66
+ *
67
+ * Defaults on. Costs three extra calls per compaction and cannot fail one:
68
+ * every path through {@link runCouncilReview} returns what it was given.
69
+ */
70
+ councilEnabled?: boolean;
71
+ /** Replaces the council reviewers' instruction; blank uses the default. */
72
+ councilCriticPrompt?: string;
73
+ /** Replaces the council synthesiser's instruction; blank uses the default. */
74
+ councilSynthesizerPrompt?: string;
75
+ /**
76
+ * Whether a recency tail survives the compaction. Defaults to true.
77
+ *
78
+ * False is a different operation, not a tighter budget: the summary becomes
79
+ * the whole context rather than its preface, `bounds` stops being consulted,
80
+ * and the prompt the caller passes has to be one written for a reader with
81
+ * nothing else. See {@link planFullCut}.
82
+ */
83
+ keepRecentMessages?: boolean;
84
+ /**
85
+ * Where the ledger gets the revisions holding each touched file's content.
86
+ *
87
+ * Absent means the ledger still runs and simply says nothing about files.
88
+ * That is the honest degradation: a wrong revision label is worse than
89
+ * none, because the model will try to restore it.
90
+ */
91
+ spanFor?: RevisionSpanLookup;
92
+ /**
93
+ * Whether to append the harness's record of what was called.
94
+ *
95
+ * Defaults on. Turned off with the Checkpoints switch, which owns the
96
+ * revision addresses the ledger quotes.
97
+ */
98
+ toolLedgerEnabled?: boolean;
99
+ bounds: RecencyBounds;
100
+ estimateMessageTokens: EstimateMessageTokens;
101
+ /**
102
+ * Measures what a transcript costs as a request, for the reported
103
+ * before/after only. Absent in callers that only need the cut.
104
+ */
105
+ measureReportedTokens?: MeasureReportedTokens;
106
+ logger?: BasicLogger;
107
+ /**
108
+ * Write the summary as the session's next turn instead of from a pasted
109
+ * transcript (`continuation-compaction.ts`). The caller owns it and
110
+ * disposes of it on every path out.
111
+ */
112
+ continuation?: CompactionContinuation;
113
+ /** Where this compaction's prefill is counted, on either path. */
114
+ meter?: CompactionMeter;
115
+ }): Promise<CoreCompactionResult | undefined>;
116
+ /**
117
+ * Which part of the context a continuation's replay covers.
118
+ *
119
+ * The writer holds the whole conversation, and with a recency tail only the
120
+ * part before the cut is folded -- the rest stays in the context verbatim,
121
+ * directly after the replay. The boundary is named by the opening words of
122
+ * the first message that stays, because an index means nothing to a model.
123
+ */
124
+ export declare function describeReplaySpan(input: {
125
+ messages: readonly MessageWithMetadata[];
126
+ cutIndex: number;
127
+ keepRecentMessages: boolean;
128
+ pinnedMessage?: MessageWithMetadata;
129
+ }): string;
@@ -0,0 +1,19 @@
1
+ import type { BasicLogger } from "@cerebriline/shared";
2
+ import type { CoreCompactionContext, CoreCompactionResult } from "../../types/config";
3
+ import { type EstimateMessageTokens, type MeasureReportedTokens } from "./compaction-shared";
4
+ /**
5
+ * Fold the conversation history without a summarizer model. Typed user
6
+ * prompts always survive. The latest typed turn keeps its newest messages
7
+ * verbatim within the token target, dropping only the oldest ones (the
8
+ * kept suffix starts at an assistant message so no tool pair is split).
9
+ * Older turns keep their concluding assistant answer when it fits, newest
10
+ * turns first. Everything else is dropped and re-surfaced as dropped-work
11
+ * summaries attached to the surviving prompts.
12
+ */
13
+ export declare function runBasicCompaction(options: {
14
+ context: CoreCompactionContext;
15
+ estimateMessageTokens: EstimateMessageTokens;
16
+ /** Measures a transcript as a request, for the reported before/after only. */
17
+ measureReportedTokens?: MeasureReportedTokens;
18
+ logger?: BasicLogger;
19
+ }): CoreCompactionResult | undefined;
@@ -0,0 +1,2 @@
1
+ export { buildBudgetProjection, findLatestTypedUserMessageIndex, } from "./project";
2
+ export type { BlockBudgetClass, BudgetAction, BudgetActionKind, BudgetActionReason, BudgetPath, BudgetPolicyIntent, BudgetProjectionOptions, BudgetProjectionResult, BudgetProjectionWarning, ContentBlockBudgetClassification, LiveTailHandling, } from "./types";
@@ -0,0 +1,4 @@
1
+ import type { MessageWithMetadata } from "@cerebriline/shared";
2
+ import type { BudgetProjectionOptions, BudgetProjectionResult } from "./types";
3
+ export declare function findLatestTypedUserMessageIndex(messages: MessageWithMetadata[]): number;
4
+ export declare function buildBudgetProjection(options: BudgetProjectionOptions): BudgetProjectionResult;
@@ -0,0 +1,58 @@
1
+ import type { ContentBlock, MessageWithMetadata } from "@cerebriline/shared";
2
+ export type BudgetPolicyIntent = "agentic_summary" | "basic_compaction_projection" | "normal_provider_request";
3
+ export type BudgetActionKind = "truncated_text" | "dropped_block" | "dropped_message" | "preserved";
4
+ export type BudgetActionReason = "over_budget" | "unsafe_to_truncate" | "tool_pair_boundary" | "protected_live_tail";
5
+ export type LiveTailHandling = "included_verbatim" | "included_degraded" | "summarized_as_context" | "omitted_with_warning" | "preserved_out_of_band";
6
+ export type BlockBudgetClass = "text" | "thinking" | "tool_use" | "tool_result" | "unsafe_binary" | "unsafe_encrypted" | "opaque";
7
+ export interface BudgetPath {
8
+ messageIndex: number;
9
+ blockIndex?: number;
10
+ }
11
+ interface BaseBudgetAction {
12
+ path: BudgetPath;
13
+ originalSize: number;
14
+ finalSize: number;
15
+ }
16
+ export type BudgetMutationAction = (BaseBudgetAction & {
17
+ kind: "truncated_text";
18
+ reason: Extract<BudgetActionReason, "over_budget">;
19
+ }) | (BaseBudgetAction & {
20
+ kind: "dropped_block";
21
+ path: Required<BudgetPath>;
22
+ reason: Exclude<BudgetActionReason, "protected_live_tail">;
23
+ }) | (BaseBudgetAction & {
24
+ kind: "dropped_message";
25
+ reason: Exclude<BudgetActionReason, "protected_live_tail">;
26
+ });
27
+ export interface BudgetPreservedAction extends BaseBudgetAction {
28
+ kind: "preserved";
29
+ reason: Extract<BudgetActionReason, "protected_live_tail" | "tool_pair_boundary">;
30
+ }
31
+ export type BudgetAction = BudgetMutationAction | BudgetPreservedAction;
32
+ export type BudgetProjectionWarningCode = "budget_impossible" | "budget_unachievable_with_protections";
33
+ export interface BudgetProjectionWarning {
34
+ code: BudgetProjectionWarningCode;
35
+ message: string;
36
+ path?: BudgetPath;
37
+ }
38
+ export interface BudgetProjectionOptions {
39
+ messages: MessageWithMetadata[];
40
+ targetTokens: number;
41
+ policyIntent: BudgetPolicyIntent;
42
+ estimateMessageTokens: (message: MessageWithMetadata) => number;
43
+ }
44
+ export interface BudgetProjectionResult {
45
+ status: "ok" | "failed";
46
+ messages: MessageWithMetadata[];
47
+ actions: BudgetAction[];
48
+ liveTailHandling: LiveTailHandling;
49
+ estimatedTokens: number;
50
+ warnings: BudgetProjectionWarning[];
51
+ }
52
+ export interface ContentBlockBudgetClassification {
53
+ block: ContentBlock;
54
+ budgetClass: BlockBudgetClass;
55
+ canStringTruncate: boolean;
56
+ canDropWholeBlock: boolean;
57
+ }
58
+ export {};
@@ -0,0 +1,195 @@
1
+ /**
2
+ * Continuation notes for a turn whose thinking ran out of budget.
3
+ *
4
+ * A model that hits its thinking cap does not stop reasoning — it stops
5
+ * mid-sentence, emits whatever tool call it can, and on the next turn starts the
6
+ * same reasoning from the beginning. Observed on a live session: the same
7
+ * ground covered a dozen times, each pass reaching "this is the final plan" and
8
+ * then "wait, I just realised…", each one ending at the same cap, and each one
9
+ * producing a differently-malformed call because the argument-writing was the
10
+ * part that got cut.
11
+ *
12
+ * The reasoning is in the transcript, so in principle nothing is lost. In
13
+ * practice seventeen thousand tokens of interrupted rambling is not something a
14
+ * model reads and continues from; it is something it re-derives. So when the cap
15
+ * fires, that turn's thinking is replaced — for the next request only — with a
16
+ * short note of what it settled, what it ruled out, and what the tool call it
17
+ * managed to make came back as. Short enough to be read, and framed as
18
+ * conclusions rather than as a transcript to resume.
19
+ */
20
+ import type { BasicLogger, DiscardedTurnCondensation, DiscardedTurnInput, MessageWithMetadata } from "@cerebriline/shared";
21
+ import type { CoreCompactionSummarizerConfig } from "../../types/config";
22
+ import type { ProviderConfig } from "../../types/provider-settings";
23
+ /**
24
+ * Whether this reasoning ended because the thinking budget ran out.
25
+ *
26
+ * With the session's budget message, the exact marker test the capped-thinking
27
+ * condenser uses. Without one, the generic admission above, in the same tail
28
+ * window.
29
+ */
30
+ export declare function reasoningHitBudget(thinking: string, budgetMessage?: string): boolean;
31
+ /**
32
+ * The output cap for the condensation call itself.
33
+ *
34
+ * A fixed cap was removed once, for a good reason: at 700 tokens against a
35
+ * summariser that reasons, the whole budget went into thinking and the call
36
+ * returned no text at all. The condensation call now asks for no reasoning, so
37
+ * the budget is the note -- and something has to bound it, because a small
38
+ * model asked for prose in its own voice can fall into repeating itself.
39
+ * Measured live: a note that opened "Summary-of-thought process:" and then said
40
+ * a variant of that line thirty times.
41
+ *
42
+ * Set well above what the note needs, so it is a stop rather than a limit the
43
+ * note is written to.
44
+ */
45
+ /**
46
+ * What the note itself has to have room for, whatever else shares the budget.
47
+ *
48
+ * The instruction above asks for every call the turn made and what each one
49
+ * returned, so this is a working budget rather than a stop: 2,000 tokens is
50
+ * about 5,000 characters, and the two notes this was measured against were 624
51
+ * and 768. It is also the ceiling that stops a small model that has started
52
+ * repeating itself, which is why it stays a fixed number and not a share.
53
+ */
54
+ export declare const CONDENSED_THINKING_NOTE_TOKENS = 2000;
55
+ /**
56
+ * The cap the condensation request carries.
57
+ *
58
+ * Static when nothing bounds the thinking, and a ladder off the level when
59
+ * something does -- because the server takes the thinking allowance out of this
60
+ * same number *first*. `ThinkBudgetWindow` prefers `num_predict` over the
61
+ * context length, so the share is a share of this cap: at `max` ({4,5}) a
62
+ * 2,000-token cap leaves the note 400 tokens, which is less than either note
63
+ * measured on pandorum already used.
64
+ *
65
+ * Whether that bites depends on the provider, which is why the ladder is a
66
+ * guard rather than a fix for a live fault. Measured on eleven2go 2026-09-19:
67
+ * `think:false` returns 0 characters of thinking against 2,743 with it unset,
68
+ * so on Ollama the switch `resolveSummarizerConfig` sets really does hold, and
69
+ * on llama.cpp `enabled: false` sends `reasoning_budget_tokens: 0`. The ladder
70
+ * is what keeps the note whole on a provider that ignores the switch and reads
71
+ * only the budget -- which is what opencoti does with `reasoning_effort`.
72
+ *
73
+ * A count rather than a level is the number the user typed. It is not a share
74
+ * of anything, so it is added rather than solved for, and it outranks a level
75
+ * the same way the request path ranks the two.
76
+ */
77
+ export declare function resolveCondensedThinkingOutputCap(providerConfig: Partial<ProviderConfig>, noteTokens?: number): number;
78
+ /**
79
+ * Whether a note is the model repeating itself rather than writing.
80
+ *
81
+ * Degeneration is not a graceful failure here: the note goes into the thinking
82
+ * channel as the model's own reasoning, so thirty near-identical lines are read
83
+ * as thirty things it thought. No note at all is strictly better -- the turn
84
+ * then re-derives, which is the behaviour this feature improves on rather than
85
+ * one it breaks.
86
+ *
87
+ * Two cheap tests, because the shape is unmistakable: mostly-repeated lines, or
88
+ * one line that repeats a phrase over and over.
89
+ */
90
+ export declare function isDegenerateNote(note: string): boolean;
91
+ /**
92
+ * The instruction half of the condensation request.
93
+ *
94
+ * Short on purpose, and separate from the task itself, which travels as the
95
+ * user message: the same split the compaction summariser uses. It says what the
96
+ * note is for; `DEFAULT_CAPPED_THINKING_PROMPT` says what it must contain.
97
+ */
98
+ export declare const CAPPED_THINKING_SYSTEM_PROMPT = "You are compressing a train of thought, in the voice of the person who was thinking it. What you write goes back into that same reasoning as its own continuation -- not as a report about it -- so write it the way thinking is written: first person, present tense, plain sentences, no headings and no lists. Keep every specific: paths, symbols, line numbers, error text, and above all what was already ruled out and why.";
99
+ export declare const DEFAULT_CAPPED_THINKING_PROMPT = "You were reasoning about a problem and ran out of thinking budget mid-thought. Below is how far you got, and what the tool call you managed to make returned.\n\nRewrite that reasoning, compressed, as the thinking it is. It is going back into your own reasoning channel as the part you have already done, so that your next pass starts from here instead of starting over and arriving at this same point again.\n\nWrite it as thought, not as a report about thought:\n- First person, present tense, the way you were already thinking. No headings, no bullet lists, no preamble, no sign-off. Do not label it or announce what it is; just think.\n- Carry what you called and what it returned. Every tool call in this turn, by name, with the argument that mattered and what came back -- the file you read and what was at the line you were looking for, the edit you attempted and whether it applied, the command you ran and what it printed. A retrospective that omits this is the one thing the next pass cannot recover, because the results are not in front of it any more.\n- State what you have settled as settled. Do not re-derive it and do not hedge it.\n- Say what you ruled out and why, in a clause each. This is the part that stops the next pass repeating this one, and it is the part that gets dropped first if you are careless.\n- Long enough that none of the above is missing, short enough that none of it is padding. Length follows the content: a turn that made four calls and settled three questions is not a paragraph. If you find yourself restating a line you have already written, you are finished: stop.\n- End on the one question still open and the single next action, stated concretely.\n\nTwo things to keep out of it:\n- Do not copy file contents. Name the file and the line and say what you concluded about it. Quoted code goes stale the moment the file is edited, and reasoning that argues with the next tool result costs more than it saved.\n- Do not narrate the interruption. It is not part of the problem.";
100
+ interface ToolOutcome {
101
+ name: string;
102
+ input: string;
103
+ result: string;
104
+ }
105
+ /**
106
+ * Why a look for a capped turn came back with nothing.
107
+ *
108
+ * Every one of these has been mistaken for "the feature is broken" at least
109
+ * once, and from the outside they are indistinguishable: no note, no error, no
110
+ * line. They are distinguishable from in here, so they are reported.
111
+ */
112
+ export type CappedThinkingStandDown = "no-budget" | "no-assistant-turn" | "turn-did-not-reason" | "budget-message-absent" | "under-budget";
113
+ export interface CappedThinkingLookup {
114
+ index: number;
115
+ reason?: CappedThinkingStandDown;
116
+ /** Characters of reasoning on the turn that was examined. */
117
+ thinkingChars?: number;
118
+ /** Its last few hundred characters, which is where the message would be. */
119
+ thinkingTail?: string;
120
+ /** What the estimate made of it, when the estimate is what decided. */
121
+ measuredTokens?: number;
122
+ /** Call-only assistant messages stepped over on the way back. */
123
+ skippedFragments?: number;
124
+ }
125
+ /**
126
+ * The most recent turn whose reasoning hit the cap, and why not when not.
127
+ *
128
+ * Only the most recent: older capped turns have already had their consequences
129
+ * play out in the transcript, and rewriting history the model has since acted on
130
+ * is a different and more dangerous idea than helping it continue.
131
+ */
132
+ export declare function locateCappedThinking(messages: readonly MessageWithMetadata[], budgetTokens: number | undefined, options?: {
133
+ budgetMessage?: string;
134
+ }): CappedThinkingLookup;
135
+ /** The index alone, for callers that have nothing to report it to. */
136
+ export declare function findCappedThinkingIndex(messages: readonly MessageWithMetadata[], budgetTokens: number | undefined, options?: {
137
+ budgetMessage?: string;
138
+ }): number;
139
+ export declare function buildCappedThinkingRequest(options: {
140
+ thinking: string;
141
+ outcomes: readonly ToolOutcome[];
142
+ promptTemplate?: string;
143
+ /** The reply the turn had begun writing before it was cut off. */
144
+ partialAnswer?: string;
145
+ }): string;
146
+ export interface CappedThinkingCondenserConfig {
147
+ enabled?: boolean;
148
+ /** The per-turn thinking allowance this session sends. */
149
+ budgetTokens?: number;
150
+ /**
151
+ * What the server appends to the reasoning when that allowance runs out,
152
+ * when the session knows it — configured by Cline, or reported by Ollama as
153
+ * the model's own. Absent for a model that has none, which is the case the
154
+ * measurement exists for.
155
+ */
156
+ budgetMessage?: string;
157
+ promptTemplate?: string;
158
+ /** Absent when no provider is resolved yet; the condenser then stands down. */
159
+ providerConfig?: ProviderConfig;
160
+ summarizer?: CoreCompactionSummarizerConfig;
161
+ logger?: BasicLogger;
162
+ }
163
+ type PrepareTurnResult = {
164
+ messages?: readonly MessageWithMetadata[];
165
+ } | undefined;
166
+ type PrepareTurn = (context: never) => PrepareTurnResult | Promise<PrepareTurnResult>;
167
+ /**
168
+ * Condense reasoning that is about to be thrown away rather than sent again.
169
+ *
170
+ * The transcript is the wrong place to catch the turn this feature was built
171
+ * for. A think only ends *at* the budget message when the model had no room to
172
+ * continue -- which means the same turn also ends at the output cap with no
173
+ * tool call, and the agent loop discards those before they reach the history.
174
+ * Measured across a full session: every capped turn was discarded, the detector
175
+ * re-examined the previous uncapped one, and the condenser stood down on each
176
+ * of them, correctly and uselessly. The reasoning went in the bin with the
177
+ * turn, and the retry started the same analysis from nothing.
178
+ *
179
+ * So the loop hands the reasoning here on its way to being dropped. The
180
+ * truncated message still never re-enters the transcript; only the note does.
181
+ *
182
+ * Returns `undefined` when there is nothing to condense with, so a caller can
183
+ * tell "off" from "produced nothing".
184
+ */
185
+ export declare function createCappedThinkingNoteWriter(config: CappedThinkingCondenserConfig): ((input: DiscardedTurnInput) => Promise<DiscardedTurnCondensation>) | undefined;
186
+ /**
187
+ * Rewrite the capped turn's reasoning, then hand off to the rest of the
188
+ * pipeline.
189
+ *
190
+ * Ahead of compaction rather than behind it, because a condensed turn is a
191
+ * smaller turn: whatever compaction then decides, it decides about a transcript
192
+ * that is not carrying seventeen thousand tokens of abandoned reasoning.
193
+ */
194
+ export declare function createCappedThinkingPrepareTurn<T extends PrepareTurn>(inner: T | undefined, config: CappedThinkingCondenserConfig): T | undefined;
195
+ export {};
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Why a compaction ran, in the four words a reader of an agent's row can use.
3
+ *
4
+ * The notice's `kind` already separates manual from automatic from overflow
5
+ * recovery, but "automatic" folds two different stories together: an agent
6
+ * that filled its own window, and one that was compacted because the server
7
+ * was short of cells for everybody else (global KV pressure). With every agent
8
+ * given the same 64k window, those are the two answers to "why did this one
9
+ * compact" -- so the notice names which.
10
+ *
11
+ * Precedence: a request that crossed its own threshold is "auto" even when the
12
+ * server was also under pressure -- it would have compacted anyway. Pressure
13
+ * is named only when it is the reason the compaction happened at all.
14
+ */
15
+ export type CompactionCause = "auto" | "pressure" | "overflow" | "manual";
16
+ export declare const COMPACTION_CAUSES: readonly CompactionCause[];
17
+ export declare function resolveCompactionCause(input: {
18
+ mode: "auto" | "manual" | "overflow_recovery";
19
+ /** The provider reported this session's request over its window. */
20
+ contextOverflow: boolean;
21
+ /** The request crossed this session's own trigger threshold. */
22
+ overOwnThreshold: boolean;
23
+ /** The window-bound output cap fell below what a reply needs. */
24
+ outputCapStarved: boolean;
25
+ /** The engine's pressure signals: PolyKV capacity or global KV pressure. */
26
+ pressure: boolean;
27
+ }): CompactionCause;
@@ -0,0 +1,65 @@
1
+ /**
2
+ * What the transcript said before a compaction replaced it.
3
+ *
4
+ * Compaction is the one operation in this runtime that destroys its own input.
5
+ * Every other thing the model does to state is recoverable — an edit has a
6
+ * revision, a transaction has a base snapshot, a file has the disk — and the
7
+ * transcript had nothing. If the summary came back wrong, or thin, or about the
8
+ * wrong half of the session, the turns it stood for were already gone and the
9
+ * only evidence that anything had been lost was the model's later behaviour.
10
+ *
11
+ * That is tolerable while a recency tail survives, because the tail is a
12
+ * fallback in itself. It stops being tolerable the moment the summary *is* the
13
+ * context: a bad no-tail compaction is terminal, and this is the configuration
14
+ * an experiment elsewhere reportedly had to withdraw.
15
+ *
16
+ * So the messages are kept. In memory, per session, bounded, and never on the
17
+ * wire — a journal that reached the model would be the transcript it exists to
18
+ * replace.
19
+ *
20
+ * **Why not disk.** A transcript holds file contents, command output, and
21
+ * whatever the user typed; writing it somewhere durable is a new place for that
22
+ * to leak from and a new thing to clean up. The lifetime that matters is the
23
+ * session, and the session lives in memory.
24
+ *
25
+ * **Why bounded, and bounded by entries rather than bytes.** The entries are
26
+ * whole transcripts, so the cap is small: two. That is what `restore` needs —
27
+ * the state before the compaction that just ran, and the one before that, so a
28
+ * generation-2 summary built on a bad generation-1 summary can be unwound past
29
+ * both. Anything older is a transcript the session has already worked from for
30
+ * several turns, and restoring to it would discard more than it recovered.
31
+ */
32
+ import type { MessageWithMetadata } from "@cerebriline/shared";
33
+ /** One compaction, and what it replaced. */
34
+ export interface CompactionJournalEntry {
35
+ /** 1-based, matching the summary message's own generation. */
36
+ generation: number;
37
+ /** The transcript as it stood before this compaction ran. */
38
+ before: readonly MessageWithMetadata[];
39
+ /** Messages it produced, for reporting what the trade actually was. */
40
+ afterMessageCount: number;
41
+ /** Which strategy wrote it, so a restore can say what it is undoing. */
42
+ strategy: string;
43
+ /** Whether a recency tail survived. A no-tail entry is the risky one. */
44
+ keptRecentMessages: boolean;
45
+ at: number;
46
+ }
47
+ /** How many pre-compaction transcripts are held. See the module comment. */
48
+ export declare const COMPACTION_JOURNAL_DEPTH = 2;
49
+ export interface CompactionJournal {
50
+ record(entry: Omit<CompactionJournalEntry, "at">): void;
51
+ /** The most recent entry, or the one at `generation` when given. */
52
+ latest(generation?: number): CompactionJournalEntry | undefined;
53
+ /**
54
+ * The transcript to go back to, undoing the last compaction.
55
+ *
56
+ * Returns the messages rather than applying them: what to do with a restored
57
+ * transcript is the caller's decision — a host may want to confirm it, and
58
+ * the runtime may want to re-run compaction with different settings rather
59
+ * than simply put the oversized transcript back.
60
+ */
61
+ restore(generation?: number): readonly MessageWithMetadata[] | undefined;
62
+ entries(): readonly CompactionJournalEntry[];
63
+ clear(): void;
64
+ }
65
+ export declare function createCompactionJournal(depth?: number): CompactionJournal;
@@ -0,0 +1,72 @@
1
+ /**
2
+ * The revision log, as compaction needs to see it.
3
+ *
4
+ * Two jobs, and they are the two halves of the same bargain. The ledger a
5
+ * summary carries says "the content is not here, it is at `#4`", which is only
6
+ * worth writing if `#4` is still there when the model reads it; and the log
7
+ * only knows which histories are still addressable because compaction tells it
8
+ * what the summary it just wrote names. Neither half works alone.
9
+ *
10
+ * A narrow port rather than the log itself, for the reason `forgetReads` is
11
+ * one: the context extension has no business importing the atomic runtime, and
12
+ * a host that has no revision log at all should be able to leave this out and
13
+ * still compact. Absent, ledger entries say nothing about files -- which is
14
+ * honest, since a wrong revision number is worse than none.
15
+ */
16
+ export interface CompactionRevisions {
17
+ /**
18
+ * The revisions held for a file, as a span like `#1–#7`, or nothing when
19
+ * the log does not track it. Fed straight to the tool ledger.
20
+ */
21
+ spanFor(filePath: string): string | undefined;
22
+ /** Every file the log currently holds a history for, as absolute paths. */
23
+ tracked(): readonly string[];
24
+ /**
25
+ * Close the compaction span and release what the next one cannot use.
26
+ * `keep` is the whitelist — see `RevisionLog.noteCompaction`.
27
+ */
28
+ noteCompaction(keep?: Iterable<string>): number;
29
+ }
30
+ /**
31
+ * Which tracked files the text still refers to.
32
+ *
33
+ * The whitelist that survives eviction. A tracked file counts as named if its
34
+ * **basename** appears in the text at a boundary, and that is the whole rule:
35
+ * the log's keys are absolute because tools resolve before they record, while
36
+ * a summary is prose and names a file however the model wrote it — absolute,
37
+ * workspace-relative, or bare in a sentence. Matching the longest tail of the
38
+ * path first sounds stricter and is not: any longer tail that appears puts a
39
+ * separator immediately before the basename, which is a boundary, so the
40
+ * basename matches in every case the longer one does. The extra comparisons
41
+ * decide nothing, and a rule that looks stricter than it is invites the reader
42
+ * to trust a precision it does not have.
43
+ *
44
+ * It follows that two files sharing a basename are kept or dropped together.
45
+ * That is the safe direction: a file kept that nothing names costs bytes the
46
+ * total cap already bounds and goes at the next compaction anyway, while a
47
+ * file dropped that the summary does name turns `#4` into an address the model
48
+ * will try to restore and cannot — the failure this mechanism exists to avoid.
49
+ *
50
+ * The one thing it will not do is match inside a word. `session.ts` found in
51
+ * `my-session.ts` is a different file, and a rule that cannot tell them apart
52
+ * keeps everything and decides nothing.
53
+ */
54
+ export declare function mentionedPaths(text: string, tracked: readonly string[]): ReadonlySet<string>;
55
+ /**
56
+ * Close the compaction span, keeping the histories the new transcript can
57
+ * still reach.
58
+ *
59
+ * The whitelist is read off the compacted messages themselves, which is both
60
+ * halves of what the user asked for in one rule: after a compaction those
61
+ * messages *are* the summary plus the retained tail, so scanning them covers
62
+ * the tail when there is one and needs no special case when there is not.
63
+ *
64
+ * The messages are scanned as JSON rather than as rendered text, deliberately.
65
+ * A path can be named in the summary prose, in the tool ledger appended after
66
+ * it, or in a tool call still sitting in the tail, and those are three
67
+ * different shapes; their serialisation is the one place all three are
68
+ * visible at once.
69
+ */
70
+ export declare function releaseUnreachableRevisions(revisions: CompactionRevisions | undefined, messages: readonly unknown[], logger?: {
71
+ log(message: string, meta?: Record<string, unknown>): void;
72
+ }): number;