@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,666 @@
1
+ /**
2
+ * Every delegation the lead makes, as a round it can come back to.
3
+ *
4
+ * A spawn call used to exist only as the tool call that made it: the lead
5
+ * learned what its agents did when the call returned, and not before or after.
6
+ * After the 75-agent swarm on 4.100.199 the lead's own evaluation named what
7
+ * that cost -- it sat idle for the whole round, could not see why an agent
8
+ * had stopped, and once its history was compacted it no longer had the tasks
9
+ * it had given, so a failed agent could not be run again without rewriting
10
+ * its task from memory.
11
+ *
12
+ * So each spawn call opens a round here: its id, every agent's original task,
13
+ * sampler, iteration cap and check, where each one ran, what state it is in
14
+ * and why it stopped, and its result. The round is the lead's handle for
15
+ * `agents_status`, the controls (`requeue_agent`, `restart_agent`,
16
+ * `resume_agent`, `retry_failed`), and `await_agents` for a round that runs in
17
+ * the background.
18
+ *
19
+ * Two lifetimes, kept apart:
20
+ *
21
+ * - **The record** is plain data, persisted beside the session
22
+ * (`<session>.rounds.json`), so it survives the lead's compaction and a
23
+ * reload of the window. Agents that were running when the process went away
24
+ * come back as cancelled -- "interrupted" -- which is what `retry_failed`
25
+ * runs again.
26
+ * - **The live state** -- the round's abort signal, its slots' promises, the
27
+ * runners that can start an agent -- belongs to this process and is never
28
+ * written.
29
+ *
30
+ * What an agent is doing reaches its record through the same progress
31
+ * updates its chat row is drawn from (`emitUpdate`): placement, model, tokens,
32
+ * speed, compactions, sampler, activity, and the `waiting` report of a wait on
33
+ * infrastructure. Nothing here polls anything.
34
+ */
35
+ import type { AgentToolContext } from "@cerebriline/shared";
36
+ import type { CompactionCause } from "../../context/compaction-cause";
37
+ import type { AgentOracleResult } from "./agent-check";
38
+ import { type SpawnBatchFailureClass } from "./batch-report";
39
+ import type { RealizedSpawnSampling, SpawnSampling } from "./spawn-sampling";
40
+ import { type SubagentStopActor } from "./subagent-cancellation";
41
+ import type { AgentPhase } from "./subagent-progress";
42
+ import { type MemberUsage } from "./token-split";
43
+ /** Which tool opened the round, which decides how an agent is run again. */
44
+ export type RoundKind = "spawn_agent" | "swarm" | "configured";
45
+ /** Where one agent is. The lead's status tool counts rounds by these. */
46
+ export type AgentRunState = "queued" | "running" | "waiting_infra" | "awaiting_lead" | "done" | "failed" | "cancelled";
47
+ /**
48
+ * Why an agent stopped (ruling 6). Waiting on infrastructure is a state, not
49
+ * a stop: an agent never fails on infrastructure.
50
+ */
51
+ export type AgentStopReason = "completed"
52
+ /** Reached its iteration cap. */
53
+ | "iteration_cap"
54
+ /** The loop guard stopped it for sending the same call again. */
55
+ | "looping"
56
+ /** The struggle supervisor stopped it for grinding after its nudge. */
57
+ | "struggling"
58
+ /** Its context overflowed and could not be recovered. */
59
+ | "context_overflow"
60
+ /** Too many consecutive mistakes, or a loop guard ended it. */
61
+ | "mistake_limit"
62
+ /** The engine or the connection returned an error it could not retry. */
63
+ | "engine_error"
64
+ /** Its own run failed: a tool, the model, a bad request. */
65
+ | "task_error" | "cancelled_by_lead" | "cancelled_by_user"
66
+ /** The lead's turn or the session was stopped under it. */
67
+ | "cancelled_by_session"
68
+ /** The process went away while it ran (a reload). */
69
+ | "interrupted";
70
+ export declare const LIVE_STATES: ReadonlySet<AgentRunState>;
71
+ /** What a round's agent is waiting on, while it waits. */
72
+ export interface AgentWaitInfo {
73
+ kind: "refusal" | "transport";
74
+ /** The node or server. */
75
+ where: string;
76
+ /** The refusal's text, or why the server is gone. */
77
+ detail: string;
78
+ since: number;
79
+ }
80
+ /** The check's verdict on an agent's work (section E): `agent-check.ts`. */
81
+ export type { AgentOracleResult };
82
+ /** The check's verdict in a few words: `pass`, `FAIL (exit 1)`, `not run (why)`. */
83
+ export declare function oracleWords(oracle: AgentOracleResult): string;
84
+ /** An agent as the lead asked for it: what `retry_failed` runs again. */
85
+ export interface RoundAgentSpec {
86
+ name: string;
87
+ task: string;
88
+ /** Its role, when it differs from the round's. */
89
+ instructions?: string;
90
+ /** A configured agent to run it as. */
91
+ type?: string;
92
+ /** A swarm worker's own system prompt. */
93
+ systemPrompt?: string;
94
+ /** A swarm worker's tool list. */
95
+ tools?: string[];
96
+ /** The sampler as asked for, "random" and all. */
97
+ sampling?: SpawnSampling;
98
+ maxIterations?: number;
99
+ /** The oracle, as asked for (section E). */
100
+ check?: unknown;
101
+ }
102
+ export interface ActivityLine {
103
+ at: number;
104
+ text: string;
105
+ severity?: "warn";
106
+ }
107
+ export interface AgentErrorLine {
108
+ at: number;
109
+ class: SpawnBatchFailureClass;
110
+ text: string;
111
+ }
112
+ export interface RoundAgentRecord extends RoundAgentSpec {
113
+ /** `r<round>-<n>`, what the lead's controls take. */
114
+ id: string;
115
+ index: number;
116
+ state: AgentRunState;
117
+ stopReason?: AgentStopReason;
118
+ /** A line on the stop: the error, the abort's reason. */
119
+ stopDetail?: string;
120
+ /**
121
+ * While it waits on the lead: its cap, a loop the guard stopped, or a
122
+ * grind the struggle supervisor stopped.
123
+ */
124
+ awaitingReason?: "iteration_cap" | "looping" | "struggling";
125
+ queuedAt: number;
126
+ startedAt?: number;
127
+ endedAt?: number;
128
+ nodeId?: string;
129
+ nodeLabel?: string;
130
+ providerId?: string;
131
+ modelId?: string;
132
+ contextWindow?: number;
133
+ inputTokens?: number;
134
+ outputTokens?: number;
135
+ /**
136
+ * How much of `inputTokens` the provider served from its cache (the KV
137
+ * cache on a local server, a billed cache read on a cloud one). Absent
138
+ * when the provider reported none: unknown, not zero.
139
+ */
140
+ cachedTokens?: number;
141
+ /**
142
+ * Of the cached input, what came from a PolyKV pool the agent attached to
143
+ * (the engine's `n_pool_shared`, summed over its requests). Absent off
144
+ * PolyKV.
145
+ */
146
+ poolSharedTokens?: number;
147
+ contextTokens?: number;
148
+ /** Recent generation speed, tokens per second. */
149
+ genTps?: number;
150
+ /** Its session on the engine: its row of a PolyKV server's `/kv`. */
151
+ engineSessionId?: string;
152
+ /** Start times of its latest iterations, for its pace. */
153
+ iterationTimes?: number[];
154
+ /** The stretch it is in while it runs, and since when. */
155
+ phase?: {
156
+ name: AgentPhase;
157
+ detail?: string;
158
+ since: number;
159
+ };
160
+ iterations?: number;
161
+ toolCalls?: number;
162
+ /** Of those, the calls that came back failed or refused. */
163
+ toolFailures?: number;
164
+ compactions?: number;
165
+ compactionsByCause?: Partial<Record<CompactionCause, number>>;
166
+ /** The sampler it actually ran with. */
167
+ samplingUsed?: RealizedSpawnSampling;
168
+ oracle?: AgentOracleResult;
169
+ /** The last thing it wrote while running, or the tail of its report. */
170
+ outputTail?: string;
171
+ /** Its report, bounded: the summary the lead was handed. */
172
+ result?: string;
173
+ activity: ActivityLine[];
174
+ errors: AgentErrorLine[];
175
+ waiting?: AgentWaitInfo;
176
+ /** Runs of it: 1, plus one per restart or retry. */
177
+ attempts: number;
178
+ /** Times the lead requeued it. */
179
+ requeues: number;
180
+ /** What the lead added to its task on a restart, kept for a retry. */
181
+ revisedInstructions?: string;
182
+ }
183
+ /** What a round shares across its agents, for a retry after compaction. */
184
+ export interface RoundShared {
185
+ knowledge?: {
186
+ files?: string[];
187
+ text?: string;
188
+ };
189
+ instructions?: string;
190
+ systemPrompt?: string;
191
+ sampling?: SpawnSampling;
192
+ maxIterations?: number;
193
+ check?: unknown;
194
+ }
195
+ export interface RoundRecord {
196
+ /** `r<n>`, unique in the session. */
197
+ id: string;
198
+ kind: RoundKind;
199
+ /** The tool the lead called. */
200
+ tool: string;
201
+ toolCallId?: string;
202
+ createdAt: number;
203
+ endedAt?: number;
204
+ /** Runs beside the lead (`wait: false`); its report arrives on its own. */
205
+ background: boolean;
206
+ status: "running" | "done";
207
+ shared: RoundShared;
208
+ agents: RoundAgentRecord[];
209
+ /** The report has reached the lead: returned, awaited, or delivered. */
210
+ delivered: boolean;
211
+ /** A swarm's merged report, as its call returned it. */
212
+ digest?: string;
213
+ /**
214
+ * Each agent has its own row under the call, keyed `<call>#<index>`; a
215
+ * round without it is one row, keyed by the call. Where a rerun's updates
216
+ * go, after the call is gone.
217
+ */
218
+ rowed?: boolean;
219
+ }
220
+ /**
221
+ * Where a rerun's updates belong, when the call that drew the agent's row is
222
+ * gone: the control call carries them, tagged with the row -- the original
223
+ * call and, for a rowed round, the agent's index.
224
+ */
225
+ export interface RoundRowTarget {
226
+ toolCallId: string;
227
+ member?: number;
228
+ }
229
+ /**
230
+ * What one agent of a round came back with. The spawn paths' own output
231
+ * shapes all fit it: a single agent's, a batch member's, a swarm worker's.
232
+ */
233
+ export interface RoundMemberOutput {
234
+ name?: string;
235
+ text?: string;
236
+ iterations?: number;
237
+ finishReason?: string;
238
+ usage?: Partial<MemberUsage>;
239
+ error?: string;
240
+ model?: {
241
+ id: string;
242
+ provider: string;
243
+ };
244
+ nodeId?: string;
245
+ nodeLabel?: string;
246
+ sampling?: RealizedSpawnSampling;
247
+ /** `awaiting_lead`: returned while it waits at its cap, work kept. */
248
+ state?: string;
249
+ /** `iteration_cap` when the cap ended it. */
250
+ stopReason?: string;
251
+ maxIterations?: number;
252
+ /** The check's verdict, when one was set. */
253
+ oracle?: AgentOracleResult;
254
+ /** Its runtime's id: what a detached agent's later events name it by. */
255
+ agentId?: string;
256
+ }
257
+ /**
258
+ * Runs one agent of a round again, from its stored spec: what makes
259
+ * `retry_failed` and a restart of a finished agent possible after the
260
+ * original call is long gone.
261
+ */
262
+ export type RoundRunner = (input: {
263
+ round: RoundRecord;
264
+ agent: RoundAgentRecord;
265
+ /** Its task as it should run now: the original, plus revised instructions. */
266
+ task: string;
267
+ context: AgentToolContext;
268
+ }) => Promise<RoundMemberOutput>;
269
+ /** A report the lead has not seen, for the host to deliver. */
270
+ export interface SettledRound {
271
+ record: RoundRecord;
272
+ /** What the lead is handed: the round's report, bounded. */
273
+ report: string;
274
+ }
275
+ /**
276
+ * A settled round as the lead reads it when it was not waiting for it: a
277
+ * background round, or an agent that finished after its call returned. It
278
+ * arrives at the lead's next boundary, the way a background delegation's
279
+ * report does, so it says what it is before it says what happened.
280
+ */
281
+ export declare function renderRoundNotice(settled: SettledRound): string;
282
+ /**
283
+ * The lead's completion, held while a round it did not wait for is still
284
+ * out: a background round, or an agent detached at its cap. Its report would
285
+ * otherwise arrive into a finished task. No wall clock: the round ends when
286
+ * its agents do, or when the lead stops them.
287
+ */
288
+ export declare function roundsCompletionGuard(sessionId: string): () => string | undefined;
289
+ /** Longest output tail kept per agent (spec B: "e.g. 1,500 chars"). */
290
+ export declare const ROUND_OUTPUT_TAIL_CHARS = 1500;
291
+ /** Activity lines kept per agent. */
292
+ export declare const ROUND_ACTIVITY_LIMIT = 20;
293
+ /** One runtime's cumulative report, folded into the agent's lifetime totals. */
294
+ export declare function recordAgentSpend(agent: RoundAgentRecord, report: {
295
+ inputTokens?: number;
296
+ outputTokens?: number;
297
+ cachedTokens?: number;
298
+ poolSharedTokens?: number;
299
+ }): void;
300
+ /**
301
+ * A run's end, reported whole: the finish sums every segment the run took
302
+ * (`runDelegatedWithCap` folds each `continue` into it), so it is added to
303
+ * what earlier runs spent rather than folded like a live report -- which
304
+ * would count the segments already folded a second time. The larger of the
305
+ * two stands, so a finish that summed less than was seen lowers nothing.
306
+ */
307
+ export declare function recordAgentFinalSpend(agent: RoundAgentRecord, usage: Partial<MemberUsage>): void;
308
+ /**
309
+ * The state and stop reason one finished run comes to.
310
+ *
311
+ * `stoppedBy` is who stopped it, when someone did; `sessionAborted` whether
312
+ * the lead's turn or the session was stopped under it.
313
+ */
314
+ export declare function classifyAgentEnd(outcome: RoundMemberOutput | {
315
+ thrown: unknown;
316
+ }, stoppedBy: SubagentStopActor | undefined, sessionAborted: boolean): {
317
+ state: AgentRunState;
318
+ reason: AgentStopReason;
319
+ detail?: string;
320
+ };
321
+ /** The task an agent runs now: its own, with the lead's revision after it. */
322
+ export declare function taskWithRevision(agent: RoundAgentRecord): string;
323
+ interface LiveRound {
324
+ record: RoundRecord;
325
+ controller: AbortController;
326
+ /** Each agent's current run, when it has one. */
327
+ slots: Map<number, Promise<RoundMemberOutput>>;
328
+ /** Each agent's latest output, for the round's report. */
329
+ outputs: Map<number, RoundMemberOutput>;
330
+ /** Each agent's live control id. */
331
+ cancelIds: Map<number, string>;
332
+ /** Each agent's channel to its row, kept for news after its call returned. */
333
+ rows?: Map<number, (update: unknown) => void>;
334
+ /** Where the original call's progress went, while it is still open. */
335
+ emitUpdate?: (update: unknown) => void;
336
+ /** Tags an update with its agent, as the call's rows expect. */
337
+ rowed: boolean;
338
+ idleWaiters: Array<() => void>;
339
+ /**
340
+ * Held open by the call that opened it while it is still launching agents:
341
+ * a swarm launches over time, and a round whose first worker finished
342
+ * before the second started is not a finished round.
343
+ */
344
+ holds: number;
345
+ /** Callers inside `await_agents` for it: its report goes to them. */
346
+ awaited: number;
347
+ /** Lets go of the lead's turn signal, for a blocking round detached. */
348
+ unlinkTurn?: () => void;
349
+ /** Reruns started, for unique tool-call ids. */
350
+ reruns: number;
351
+ /** A report from the call itself, in place of one built from results. */
352
+ reportOverride?: string;
353
+ }
354
+ export interface OpenRoundInput {
355
+ kind: RoundKind;
356
+ tool: string;
357
+ toolCallId?: string;
358
+ background: boolean;
359
+ shared?: RoundShared;
360
+ agents: RoundAgentSpec[];
361
+ /**
362
+ * The lead's call signal, for a blocking round: stopping the lead's turn
363
+ * stops the round. A background round is not tied to the turn it started
364
+ * in, and runs until it ends, is stopped, or the session goes.
365
+ */
366
+ signal?: AbortSignal;
367
+ /** The call's own progress channel, for its rows. */
368
+ emitUpdate?: (update: unknown) => void;
369
+ /** Each agent has its own row, keyed by `member`. */
370
+ rowed?: boolean;
371
+ }
372
+ type SettledListener = (settled: SettledRound) => void;
373
+ /** Renders a finished round's report for the lead. Set by the tools. */
374
+ export type RoundReportRenderer = (record: RoundRecord, outputs: ReadonlyMap<number, RoundMemberOutput>, sessionId: string | undefined) => string;
375
+ export declare class AgentRounds {
376
+ readonly sessionId: string;
377
+ private readonly now;
378
+ private readonly rounds;
379
+ private readonly live;
380
+ private readonly runners;
381
+ private readonly listeners;
382
+ private persistTimer;
383
+ private path;
384
+ private blocking;
385
+ private renderReport;
386
+ constructor(sessionId: string, now?: () => number);
387
+ /**
388
+ * Persist to `path`, loading what is there first. Agents recorded as live
389
+ * were running when the process went away: they are cancelled now, as
390
+ * `interrupted`, which `retry_failed` runs again.
391
+ */
392
+ attachStore(path: string): void;
393
+ /**
394
+ * The session is going with rounds still out: a reload of the window, or
395
+ * the task closed. Their agents are about to be stopped, and whatever they
396
+ * would report on the way out is not what the record keeps: each is
397
+ * `interrupted` now, its round is over with a report owed to the lead, and
398
+ * that is what is written. Nothing is written after it -- the late ends of
399
+ * the agents being stopped would otherwise land a second later as
400
+ * "cancelled by the session", or not at all if the process is gone by
401
+ * then. The next start of the session delivers the notice.
402
+ */
403
+ interruptAll(): void;
404
+ private interruptRound;
405
+ /** Write now, and stop writing: the session is going. */
406
+ flush(): void;
407
+ /** Stop every live round; the session is ending. */
408
+ stopAll(reason?: string): void;
409
+ setReportRenderer(renderer: RoundReportRenderer): void;
410
+ registerRunner(kind: RoundKind, runner: RoundRunner): void;
411
+ hasRunner(kind: RoundKind): boolean;
412
+ /** Told once per settle of a round whose report the lead has not had. */
413
+ onSettled(listener: SettledListener): () => void;
414
+ /**
415
+ * The lead is inside a call that waits on its agents: a blocking spawn, or
416
+ * `await_agents`. A user's steer is then answered in a side turn; with the
417
+ * lead working beside a background round it goes to the lead as usual.
418
+ */
419
+ enterBlocking(): () => void;
420
+ get leadBlocked(): boolean;
421
+ /**
422
+ * The lead's waits on its agents in progress -- `await_agents`, a blocking
423
+ * spawn -- each ended by {@link wakeAwaits}.
424
+ */
425
+ private readonly wakers;
426
+ /**
427
+ * `work`, or a message for the lead, whichever comes first. A blocking
428
+ * spawn waits here: measured 2026-09-26, a `wait: true` spawn of 50
429
+ * agents held the lead for the whole round while the user's steers went
430
+ * to side turns and their results queued behind it.
431
+ */
432
+ untilWoken<T>(work: Promise<T>): Promise<{
433
+ woken: false;
434
+ value: T;
435
+ } | {
436
+ woken: true;
437
+ }>;
438
+ /**
439
+ * Whether a message for the lead is already queued, as the host knows it.
440
+ *
441
+ * A wait is ended when a message is queued. One queued a moment earlier,
442
+ * while the lead was still writing the turn in which it then called
443
+ * `await_agents`, woke nothing: the wait began after it. The user's
444
+ * second message sat in the queue for the rest of the round, under a
445
+ * lead that read as "monitoring" (pandorum, session wlafh, 2026-10-04
446
+ * 05:33:46Z).
447
+ */
448
+ messageWaiting: (() => boolean) | undefined;
449
+ /** Register a wait on the agents that a message for the lead ends. */
450
+ onWake(wake: () => void): () => void;
451
+ /**
452
+ * The lead is waiting on its agents (`await_agents`, a blocking spawn):
453
+ * a message for it should end the wait rather than sit behind the round.
454
+ */
455
+ get leadAwaiting(): boolean;
456
+ /**
457
+ * Something is waiting for the lead -- the user's message, the harness's
458
+ * report of a stuck agent. Its `await_agents` returns now, so the message
459
+ * reaches it at the turn boundary right after; the rounds carry on.
460
+ * Returns whether a wait was ended.
461
+ */
462
+ wakeAwaits(): boolean;
463
+ list(): RoundRecord[];
464
+ get(roundId: string): RoundRecord | undefined;
465
+ /** Rounds still running in the background whose report is not yet in. */
466
+ pendingBackground(): RoundRecord[];
467
+ /**
468
+ * An agent by id (`r2-3`) or by name. A name used in several rounds means
469
+ * the newest round's agent of that name.
470
+ */
471
+ findAgent(ref: string): {
472
+ round: RoundRecord;
473
+ agent: RoundAgentRecord;
474
+ } | undefined;
475
+ /** The live control id of an agent that is running now. */
476
+ cancelIdOf(roundId: string, index: number): string | undefined;
477
+ isLive(roundId: string): boolean;
478
+ /** The round's signal, while it is live in this process. */
479
+ signalOf(roundId: string): AbortSignal | undefined;
480
+ open(input: OpenRoundInput): RoundHandle;
481
+ /** Add an agent to a live round: a swarm's `max` finds its size as it goes. */
482
+ addAgent(roundId: string, spec: RoundAgentSpec): RoundAgentRecord;
483
+ /**
484
+ * Run one agent of the round again, from its stored spec. For a restart of
485
+ * an agent that has finished, and for `retry_failed`. The round reopens,
486
+ * and its report goes to the lead again when it is done.
487
+ *
488
+ * `context` is the control call's: a rerun borrows its session and parent,
489
+ * never its signal -- it runs under the round's.
490
+ */
491
+ rerun(roundId: string, index: number, context: AgentToolContext, options?: {
492
+ instructions?: string;
493
+ }): {
494
+ started: boolean;
495
+ why?: string;
496
+ };
497
+ /** Wait for these rounds -- or every running one -- to finish. */
498
+ waitFor(roundIds: readonly string[] | undefined, signal?: AbortSignal): Promise<RoundRecord[]>;
499
+ /** The report of a finished round, as the lead reads it. */
500
+ reportFor(roundId: string): string;
501
+ markDelivered(roundId: string): void;
502
+ /** @internal */
503
+ schedulePersist(): void;
504
+ /** @internal */
505
+ settleIfIdle(live: LiveRound): void;
506
+ /** @internal */
507
+ resetForRun(agent: RoundAgentRecord): void;
508
+ /** @internal */
509
+ now_(): number;
510
+ private milestones;
511
+ private milestoneTimer;
512
+ /**
513
+ * An agent has run another {@link LEAD_ITERATION_NUDGE_EVERY} iterations:
514
+ * tell the lead, with every other agent that crosses a line in the next
515
+ * {@link LEAD_NUDGE_BATCH_MS}.
516
+ *
517
+ * This is what replaced the iteration cap the lead used to set (user
518
+ * ruling, 2026-09-28): nothing stops the agent, the lead is asked to look.
519
+ * @internal
520
+ */
521
+ noteIterationMilestone(milestone: IterationMilestone): void;
522
+ private newAgent;
523
+ private nextRoundNumber;
524
+ private writeNow;
525
+ }
526
+ /** Marks a tool context as one agent of a round already open. */
527
+ export declare const ROUND_MEMBER_KEY = "cerebrilineRoundMember";
528
+ /** Whether a tool call runs as a member of a round a caller already opened. */
529
+ export declare function isRoundMember(context: AgentToolContext | undefined): boolean;
530
+ /** One open round, as the tool that opened it drives it. */
531
+ export declare class RoundHandle {
532
+ private readonly rounds;
533
+ private readonly live;
534
+ constructor(rounds: AgentRounds, live: LiveRound);
535
+ get id(): string;
536
+ get record(): RoundRecord;
537
+ /** The round's own stop: the lead's turn for a blocking round. */
538
+ get signal(): AbortSignal;
539
+ agent(index: number): RoundAgentRecord | undefined;
540
+ /** The control id agent `index` is stopped, requeued and messaged by. */
541
+ bindControl(index: number, cancelId: string): void;
542
+ /** Grow the round by one agent; returns its index. */
543
+ add(spec: RoundAgentSpec): number;
544
+ /**
545
+ * Run agent `index` under `context`, recording what it does and how it
546
+ * ends. The context handed to `fn` taps the agent's progress updates on
547
+ * their way to its row. Never throws: a failed agent is an output with an
548
+ * `error`, as a batch member's always was.
549
+ */
550
+ run(index: number, context: AgentToolContext, fn: (context: AgentToolContext) => Promise<RoundMemberOutput>): Promise<RoundMemberOutput>;
551
+ /**
552
+ * Record an agent that never ran: stopped or left in the queue when the
553
+ * round ended.
554
+ */
555
+ never(index: number, why: string): void;
556
+ /** Resolves when no agent of the round is running. */
557
+ idle(): Promise<void>;
558
+ /** The latest output of every agent, in order. */
559
+ outputs(): RoundMemberOutput[];
560
+ /** A report from the call itself -- a swarm's digest -- for this settle. */
561
+ setReport(report: string, digest?: string): void;
562
+ /**
563
+ * The call is returning its report to the lead itself: nothing to deliver.
564
+ * Also lets go of the call's progress channel, which is closed once the
565
+ * call returns.
566
+ */
567
+ delivered(): void;
568
+ /**
569
+ * A blocking round whose call returns before it ends: a message for the
570
+ * lead woke it. The round goes on in the background, no longer stopped by
571
+ * the turn's signal, and its report is delivered when it ends.
572
+ */
573
+ detach(): void;
574
+ /**
575
+ * The opening call has launched everything it will: the round settles
576
+ * once its last agent ends (now, if none runs). Idempotent.
577
+ */
578
+ close(): void;
579
+ /** Where agent `index`'s updates go: its record, then its row. */
580
+ private tap;
581
+ private observe;
582
+ private pushActivity;
583
+ private runAgent;
584
+ /**
585
+ * An agent whose run returned while it waits at its cap, its call gone
586
+ * (`agent-iteration-cap.ts`: detached). The round stays open for it, its
587
+ * resume and its real end are recorded as they happen, and its end
588
+ * settles the round again -- a report the lead has not had.
589
+ */
590
+ private followDetached;
591
+ private finish;
592
+ }
593
+ /**
594
+ * A session's rounds, for a view drawn after the fact -- a task reopened, a
595
+ * window reloaded: this process's registry when it holds them, else the file
596
+ * the session wrote beside its transcript. A round the file says is running
597
+ * was not ended by any process alive now, so it reads as interrupted, as the
598
+ * session's next start will record it. Copies: nothing here changes a round.
599
+ */
600
+ export declare function readRoundRecords(sessionId: string, path?: string): RoundRecord[];
601
+ /** This session's rounds, created on first use. */
602
+ export declare function roundsFor(sessionId: string | undefined): AgentRounds;
603
+ /** The session is gone: stop its rounds, write them, forget them. */
604
+ export declare function releaseRounds(sessionId: string): void;
605
+ /** Test seam. */
606
+ export declare function __resetAgentRounds(): void;
607
+ /**
608
+ * An agent's trouble watch, also reporting each wait on its row's channel --
609
+ * `{waiting: {kind, where, detail}}` while it waits, `{waiting: null}` when
610
+ * the engine produces for it again -- so its round knows it is waiting on
611
+ * infrastructure and on what. The watch itself is untouched: the lead's
612
+ * nudge after a long wait works exactly as it did.
613
+ */
614
+ export declare function reportWaits<T extends {
615
+ waiting(state: {
616
+ kind: string;
617
+ where: string;
618
+ detail: string;
619
+ }): void;
620
+ progressed(): void;
621
+ dispose(): void;
622
+ }>(watch: T, emitUpdate: ((update: unknown) => void) | undefined, control?: {
623
+ setWaitingInfra(waiting: boolean): void;
624
+ }): T;
625
+ /**
626
+ * What every agent's result carries (section F): its state and why it
627
+ * stopped, iterations against its cap, tokens, compactions, the oracle's
628
+ * verdict, its sampler, and where it ran.
629
+ */
630
+ export interface AgentFacts {
631
+ id: string;
632
+ round: string;
633
+ state: AgentRunState;
634
+ stopReason?: AgentStopReason;
635
+ iterations?: number;
636
+ maxIterations?: number;
637
+ tokens?: {
638
+ input: number;
639
+ output: number;
640
+ };
641
+ compactions?: {
642
+ count: number;
643
+ byCause?: Partial<Record<CompactionCause, number>>;
644
+ };
645
+ oracle?: AgentOracleResult;
646
+ sampling?: RealizedSpawnSampling;
647
+ node?: string;
648
+ model?: string;
649
+ }
650
+ export declare function agentFacts(round: Pick<RoundRecord, "id">, agent: RoundAgentRecord): AgentFacts;
651
+ /** One agent's crossing of an iteration line, for the lead's note. */
652
+ export interface IterationMilestone {
653
+ round: string;
654
+ id: string;
655
+ name: string;
656
+ iterations: number;
657
+ phase?: string;
658
+ toolCalls?: number;
659
+ toolFailures?: number;
660
+ }
661
+ /** `22 of 95 tool calls failed`, when any did. */
662
+ export declare function toolFailureNote(toolCalls: number | undefined, toolFailures: number | undefined): string | undefined;
663
+ /** The note that asks the lead to look at agents that have run a long time. */
664
+ export declare function describeIterationMilestones(milestones: readonly IterationMilestone[]): string;
665
+ /** The same facts on one line, for a round's per-agent report entries. */
666
+ export declare function agentFactsLine(agent: RoundAgentRecord): string;