@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,364 @@
1
+ /**
2
+ * Multi-Agent Coordination
3
+ *
4
+ * Utilities for orchestrating multiple agents working together.
5
+ */
6
+ import { type AgentConfig, type AgentEvent, type AgentResult, type AppendMissionLogInput, type AttachTeamOutcomeFragmentInput, type CreateTeamOutcomeInput, type CreateTeamTaskInput, type MissionLogEntry, type ReviewTeamOutcomeFragmentInput, type RouteToTeammateOptions, type TeamAgentSampling, type TeamMailboxMessage, type TeamMemberSnapshot, TeamMessageType, type TeammateLifecycleSpec, type TeamOutcome, type TeamOutcomeFragment, type TeamRunRecord, type TeamRunStatus, type TeamRuntimeSnapshot, type TeamRuntimeState, type TeamTask, type TeamTaskListItem, type TeamTaskStatus } from "@cerebriline/shared";
7
+ import { SessionRuntime } from "../../../runtime/orchestration/session-runtime-orchestrator";
8
+ import { type HandedRevision } from "./delegated-sandboxes";
9
+ export { type AppendMissionLogInput, type AttachTeamOutcomeFragmentInput, type CreateTeamOutcomeInput, type CreateTeamTaskInput, type MissionLogEntry, type MissionLogKind, type ReviewTeamOutcomeFragmentInput, type RouteToTeammateOptions, type TeamMailboxMessage, type TeamMemberSnapshot, TeamMessageType, type TeammateLifecycleSpec, type TeamOutcome, type TeamOutcomeFragment, type TeamOutcomeFragmentStatus, type TeamOutcomeStatus, type TeamRunRecord, type TeamRunStatus, type TeamRuntimeSnapshot, type TeamRuntimeState, type TeamTask, type TeamTaskListItem, type TeamTaskStatus, } from "@cerebriline/shared";
10
+ export interface TeamMemberConfig extends AgentConfig {
11
+ role?: string;
12
+ }
13
+ export interface AgentTask {
14
+ agentId: string;
15
+ message: string;
16
+ metadata?: Record<string, unknown>;
17
+ }
18
+ export interface TaskResult {
19
+ agentId: string;
20
+ result: AgentResult;
21
+ error?: Error;
22
+ metadata?: Record<string, unknown>;
23
+ }
24
+ type TeamTaskEndStatus = "completed" | "failed" | "cancelled";
25
+ export type TeamEvent = {
26
+ type: TeamMessageType.TaskStart;
27
+ agentId: string;
28
+ message: string;
29
+ } | {
30
+ type: TeamMessageType.TaskEnd;
31
+ agentId: string;
32
+ status?: TeamTaskEndStatus;
33
+ result?: AgentResult;
34
+ error?: Error;
35
+ messages?: AgentResult["messages"];
36
+ } | {
37
+ type: TeamMessageType.AgentEvent;
38
+ agentId: string;
39
+ event: AgentEvent;
40
+ /**
41
+ * The event moved the teammate's tool-call or compaction count, so
42
+ * its row has something new to show. Most events are streamed
43
+ * chunks that move nothing.
44
+ */
45
+ activityChanged?: boolean;
46
+ } | {
47
+ type: TeamMessageType.TeammateSpawned;
48
+ agentId: string;
49
+ role?: string;
50
+ teammate: TeammateLifecycleSpec;
51
+ } | {
52
+ type: TeamMessageType.TeammateShutdown;
53
+ agentId: string;
54
+ reason?: string;
55
+ } | {
56
+ type: TeamMessageType.TeamTaskUpdated;
57
+ task: TeamTask;
58
+ } | {
59
+ type: TeamMessageType.TeamMessage;
60
+ message: TeamMailboxMessage;
61
+ } | {
62
+ type: TeamMessageType.TeamMissionLog;
63
+ entry: MissionLogEntry;
64
+ } | {
65
+ type: TeamMessageType.RunQueued;
66
+ run: TeamRunRecord;
67
+ } | {
68
+ type: TeamMessageType.RunStarted;
69
+ run: TeamRunRecord;
70
+ } | {
71
+ type: TeamMessageType.RunProgress;
72
+ run: TeamRunRecord;
73
+ message: string;
74
+ } | {
75
+ type: TeamMessageType.RunCompleted;
76
+ run: TeamRunRecord;
77
+ } | {
78
+ type: TeamMessageType.RunFailed;
79
+ run: TeamRunRecord;
80
+ } | {
81
+ type: TeamMessageType.RunCancelled;
82
+ run: TeamRunRecord;
83
+ reason?: string;
84
+ } | {
85
+ type: TeamMessageType.RunInterrupted;
86
+ run: TeamRunRecord;
87
+ reason?: string;
88
+ } | {
89
+ type: TeamMessageType.OutcomeCreated;
90
+ outcome: TeamOutcome;
91
+ } | {
92
+ type: TeamMessageType.OutcomeFragmentAttached;
93
+ fragment: TeamOutcomeFragment;
94
+ } | {
95
+ type: TeamMessageType.OutcomeFragmentReviewed;
96
+ fragment: TeamOutcomeFragment;
97
+ } | {
98
+ type: TeamMessageType.OutcomeFinalized;
99
+ outcome: TeamOutcome;
100
+ } | {
101
+ type: TeamMessageType.TeamCleaned;
102
+ };
103
+ /**
104
+ * Whether an event changed the team's state -- what a store must write.
105
+ *
106
+ * A teammate's own agent events are not: every streamed text or reasoning
107
+ * delta is one, and each was a full-state SQLite transaction. Nor is the
108
+ * progress of a run that is still running (its 2 s heartbeat and its live
109
+ * activity): the run's recorded state is written when it starts and ends.
110
+ */
111
+ export declare function isTeamStateChange(event: TeamEvent): boolean;
112
+ export interface AgentTeamsRuntimeOptions {
113
+ teamName: string;
114
+ leadAgentId?: string;
115
+ /**
116
+ * The lead's session. A teammate's task is registered under it while it
117
+ * runs, as a `spawn_agent` agent is: the lead's stop_agents,
118
+ * restart_agent, message_agents and requeue_agent, and its row's stop,
119
+ * reach it there. Without it a task runs unregistered.
120
+ */
121
+ sessionId?: string;
122
+ missionLogIntervalSteps?: number;
123
+ missionLogIntervalMs?: number;
124
+ maxConcurrentRuns?: number;
125
+ onTeamEvent?: (event: TeamEvent) => void;
126
+ /**
127
+ * The teammates' private workspaces, when the host sandboxes them. A
128
+ * teammate's toolset opens its workspace when it is spawned; the runtime
129
+ * owns the rest of the lifecycle through these hooks.
130
+ */
131
+ teammateWorkspaces?: TeammateWorkspaceHooks;
132
+ /**
133
+ * The part of a session connection push a live teammate takes. A
134
+ * teammate on a connection of its own (the Agents tab) keeps the fields
135
+ * that connection names; without this the push takes everything.
136
+ */
137
+ acceptTeammateConnectionUpdates?: (overrides: TeammateConnectionUpdate) => TeammateConnectionUpdate;
138
+ }
139
+ type TeammateConnectionUpdate = Partial<Pick<AgentConfig, "apiKey" | "baseUrl" | "headers">>;
140
+ /**
141
+ * The lifecycle of a teammate's private workspace, as the team runtime drives
142
+ * it. A teammate is long-lived, so its overlay is too: it is handed back at
143
+ * the end of every task, and released only when the teammate goes.
144
+ */
145
+ export interface TeammateWorkspaceHooks {
146
+ /**
147
+ * Fold what the teammate changed since its last hand-back into the lead's
148
+ * revision log. Called when each of its runs ends, however it ended, so the
149
+ * lead finds the revisions named in the result it is handed.
150
+ */
151
+ handBack(agentId: string): Promise<readonly HandedRevision[]>;
152
+ /**
153
+ * Hand back anything outstanding and dispose the workspace: the teammate
154
+ * was shut down or removed. Idempotent.
155
+ */
156
+ release(agentId: string): Promise<void>;
157
+ }
158
+ export interface SpawnTeammateOptions {
159
+ agentId: string;
160
+ config: TeamMemberConfig;
161
+ /**
162
+ * The sampler the lead spawned it with, already applied to `config`.
163
+ * Carried on the spawn event so the persisted spec -- and a restore from
164
+ * it -- keeps it.
165
+ */
166
+ sampling?: TeamAgentSampling;
167
+ }
168
+ export declare class AgentTeam {
169
+ private agents;
170
+ private configs;
171
+ private onTeamEvent?;
172
+ constructor(configs?: Record<string, TeamMemberConfig>, onTeamEvent?: (event: TeamEvent) => void);
173
+ addAgent(id: string, config: TeamMemberConfig): void;
174
+ removeAgent(id: string): boolean;
175
+ getAgent(id: string): SessionRuntime | undefined;
176
+ getAgentIds(): string[];
177
+ get size(): number;
178
+ routeTo(agentId: string, message: string): Promise<AgentResult>;
179
+ continueTo(agentId: string, message: string): Promise<AgentResult>;
180
+ runParallel(tasks: AgentTask[]): Promise<TaskResult[]>;
181
+ runSequential(tasks: AgentTask[]): Promise<TaskResult[]>;
182
+ runPipeline(pipeline: string[], initialMessage: string, messageTransformer?: (prevResult: AgentResult, nextAgentId: string) => string): Promise<TaskResult[]>;
183
+ abortAll(): void;
184
+ clear(): void;
185
+ private emitEvent;
186
+ }
187
+ export declare function createAgentTeam(configs: Record<string, TeamMemberConfig>, onTeamEvent?: (event: TeamEvent) => void): AgentTeam;
188
+ export declare function createWorkerReviewerTeam(configs: {
189
+ worker: TeamMemberConfig;
190
+ reviewer: TeamMemberConfig;
191
+ }): AgentTeam & {
192
+ doAndReview: (message: string) => Promise<{
193
+ workerResult: AgentResult;
194
+ reviewResult: AgentResult;
195
+ }>;
196
+ };
197
+ export declare class AgentTeamsRuntime {
198
+ private readonly teamId;
199
+ private readonly teamName;
200
+ private readonly sessionId?;
201
+ private readonly onTeamEvent?;
202
+ private readonly members;
203
+ private readonly tasks;
204
+ private readonly missionLog;
205
+ private readonly mailbox;
206
+ private missionStepCounter;
207
+ private taskCounter;
208
+ private messageCounter;
209
+ private missionCounter;
210
+ private runCounter;
211
+ private outcomeCounter;
212
+ private outcomeFragmentCounter;
213
+ private readonly runs;
214
+ private readonly runQueue;
215
+ private queuedRunDispatchTimer;
216
+ private readonly outcomes;
217
+ private readonly outcomeFragments;
218
+ private readonly missionLogIntervalSteps;
219
+ private readonly missionLogIntervalMs;
220
+ private readonly maxConcurrentRuns;
221
+ private readonly teammateWorkspaces?;
222
+ private readonly acceptTeammateConnectionUpdates?;
223
+ constructor(options: AgentTeamsRuntimeOptions);
224
+ getTeamId(): string;
225
+ getTeamName(): string;
226
+ getMemberRole(agentId: string): "lead" | "teammate" | undefined;
227
+ getMemberIds(): string[];
228
+ getTeammateIds(): string[];
229
+ getTask(taskId: string): TeamTask | undefined;
230
+ listTasks(): TeamTask[];
231
+ listTaskItems(options?: {
232
+ status?: TeamTaskStatus;
233
+ assignee?: string;
234
+ }): TeamTaskListItem[];
235
+ listMissionLog(limit?: number): MissionLogEntry[];
236
+ listMailbox(agentId: string, options?: {
237
+ unreadOnly?: boolean;
238
+ markRead?: boolean;
239
+ limit?: number;
240
+ }): TeamMailboxMessage[];
241
+ getSnapshot(): TeamRuntimeSnapshot;
242
+ exportState(): TeamRuntimeState;
243
+ hydrateState(state: TeamRuntimeState): void;
244
+ isTeammateActive(agentId: string): boolean;
245
+ /**
246
+ * Throw unless `agentId` is a live teammate that can be given a task. A
247
+ * stopped one kept its agent for the task it was ending, and a task given
248
+ * it ran on a released workspace and booked an engine session nothing
249
+ * closed.
250
+ */
251
+ private requireTaskableTeammate;
252
+ /**
253
+ * Throw if `agentId` cannot be (re)spawned now. Asked before anything is
254
+ * built for the new teammate: building its toolset opens its workspace,
255
+ * which replaces -- and releases -- the one a teammate still running under
256
+ * the same id is writing to.
257
+ */
258
+ assertCanSpawnTeammate(agentId: string): void;
259
+ spawnTeammate({ agentId, config, sampling, }: SpawnTeammateOptions): TeamMemberSnapshot;
260
+ shutdownTeammate(agentId: string, reason?: string): void;
261
+ private releaseWorkspace;
262
+ /**
263
+ * Give the teammate's engine session back: its window, its slot affinity,
264
+ * any pool it holds. Once -- the id is dropped from the member -- and never
265
+ * waited on: this runs on shutdown paths that must not block.
266
+ */
267
+ private releaseEngineSession;
268
+ /**
269
+ * Give the engine session back at the end of a task, keeping the id: the
270
+ * teammate's next task sends it again and is booked afresh (after this
271
+ * close has landed), and its shutdown still has it to close.
272
+ */
273
+ private releaseEngineSessionBetweenTasks;
274
+ /**
275
+ * Between a restart's or a requeue's two attempts: give back the session
276
+ * the stopped one held and wait for the close, so the next books afresh.
277
+ * A fresh start asks for a fresh window; a requeue keeps its own.
278
+ */
279
+ private rebookEngineSession;
280
+ /**
281
+ * One stretch of a teammate's task, under its controls: the task itself,
282
+ * or -- after a requeue -- its carrying on from its transcript. A stop
283
+ * aborts it as intended, so the task ends cancelled; a restart or a
284
+ * requeue aborts only the stretch, and the controls run the next.
285
+ */
286
+ private runTeammateSegment;
287
+ /**
288
+ * Hand a teammate's changes back at the end of a run, and say where they
289
+ * went. Best-effort: a failed hand-back must not fail the task.
290
+ */
291
+ private handBackWorkspace;
292
+ updateTeammateConnections(overrides: TeammateConnectionUpdate): void;
293
+ createTask(input: CreateTeamTaskInput): TeamTask;
294
+ claimTask(taskId: string, agentId: string): TeamTask;
295
+ blockTask(taskId: string, agentId: string, reason: string): TeamTask;
296
+ completeTask(taskId: string, agentId: string, summary: string): TeamTask;
297
+ routeToTeammate(agentId: string, message: string, options?: RouteToTeammateOptions): Promise<AgentResult>;
298
+ startTeammateRun(agentId: string, message: string, options?: RouteToTeammateOptions & {
299
+ priority?: number;
300
+ maxRetries?: number;
301
+ leaseOwner?: string;
302
+ }): TeamRunRecord;
303
+ private dispatchQueuedRuns;
304
+ private selectNextDispatchableQueuedRun;
305
+ /** Whether `agentId` is free for its next queued run: idle, and not stopped. */
306
+ private canTakeQueuedRun;
307
+ private scheduleQueuedRunDispatch;
308
+ private clearQueuedRunDispatchTimer;
309
+ private countActiveRuns;
310
+ private executeQueuedRun;
311
+ listRuns(options?: {
312
+ status?: TeamRunStatus | null;
313
+ agentId?: string | null;
314
+ includeCompleted?: boolean | null;
315
+ }): TeamRunRecord[];
316
+ getRun(runId: string): TeamRunRecord | undefined;
317
+ /**
318
+ * Wait for one run to end. `requesterId` is who waits: a teammate asking
319
+ * for its own active run is refused, since that run cannot end while it
320
+ * waits for it.
321
+ */
322
+ awaitRun(runId: string, pollIntervalMs?: number, requesterId?: string): Promise<TeamRunRecord>;
323
+ /**
324
+ * Wait for every active run to end, and list them. The requester's own
325
+ * runs are left out: a teammate that waits for "all runs" is inside one of
326
+ * them, and waiting for it deadlocked until the lead was stopped.
327
+ */
328
+ awaitAllRuns(pollIntervalMs?: number, requesterId?: string): Promise<TeamRunRecord[]>;
329
+ /**
330
+ * Cancel work owned by this team runtime without removing teammate or
331
+ * conversation state. Used when the owning lead session is aborted.
332
+ */
333
+ cancelOutstandingWork(reason?: unknown): void;
334
+ cancelRun(runId: string, reason?: string): TeamRunRecord;
335
+ /**
336
+ * Abort what `agentId` is running now, marked as intended so its end is
337
+ * reported as cancelled. Once: a teammate already being stopped is left.
338
+ */
339
+ private abortTeammateRun;
340
+ recoverActiveRuns(reason?: string): TeamRunRecord[];
341
+ markStaleRunsInterrupted(reason?: string): TeamRunRecord[];
342
+ sendMessage(fromAgentId: string, toAgentId: string, subject: string, body: string, taskId?: string): TeamMailboxMessage;
343
+ broadcast(fromAgentId: string, subject: string, body: string, options?: {
344
+ taskId?: string;
345
+ }): TeamMailboxMessage[];
346
+ appendMissionLog(input: AppendMissionLogInput): MissionLogEntry;
347
+ createOutcome(input: CreateTeamOutcomeInput): TeamOutcome;
348
+ listOutcomes(): TeamOutcome[];
349
+ attachOutcomeFragment(input: AttachTeamOutcomeFragmentInput): TeamOutcomeFragment;
350
+ reviewOutcomeFragment(input: ReviewTeamOutcomeFragmentInput): TeamOutcomeFragment;
351
+ listOutcomeFragments(outcomeId: string): TeamOutcomeFragment[];
352
+ finalizeOutcome(outcomeId: string): TeamOutcome;
353
+ cleanup(): void;
354
+ private requireTask;
355
+ private assertDependenciesResolved;
356
+ private getUnresolvedDependencies;
357
+ private trackMeaningfulEvent;
358
+ private recordRunActivityFromAgentEvent;
359
+ private recordRunProgress;
360
+ private formatProgressErrorActivity;
361
+ private recordProgressStep;
362
+ private buildMailboxNotification;
363
+ private emitEvent;
364
+ }
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Whether a failed agent run means its node could not be reached at all.
3
+ *
4
+ * §9i.2. A node that is off, unplugged or behind a dead tunnel costs a connect
5
+ * timeout on every spawn, and with round-robin that is once a lap for the life
6
+ * of the session. Taking it out of the rotation for a cool-off is only safe if
7
+ * "unreachable" is read narrowly, because the cost of reading it too widely is
8
+ * the opposite failure: a node marked down for a cool-off because one model
9
+ * call happened to fail.
10
+ *
11
+ * So the test is transport-level and nothing else. A server that answered --
12
+ * a 429 from an admission gate, a 400 on a bad field, a context overflow, a
13
+ * model that returned an error -- is a server that is alive, and none of them
14
+ * says anything about the node's reachability. Only failures that mean no HTTP
15
+ * response ever arrived count.
16
+ *
17
+ * `fetch failed` is included because that is all undici gives for a connection
18
+ * that never opened; its `cause` carries the real code, which is checked too
19
+ * when it is there.
20
+ */
21
+ export declare function isNodeUnreachable(error: unknown, depth?: number): boolean;
22
+ export declare function isModelMissing(text: unknown): boolean;
23
+ /**
24
+ * This attempt spent nothing, so the agent may be placed again.
25
+ *
26
+ * The whole point of re-placing rather than failing: a run that never reached
27
+ * a model has done no work to lose and no side effect to repeat. Both halves
28
+ * are required -- a failure that burned tokens may have edited a file, and
29
+ * running it again on another node would do it twice.
30
+ *
31
+ * Note this reads a *returned* result, not a thrown error. The measured
32
+ * failure did not throw: the sub-agent returned `finishReason: "error"` with
33
+ * the message in `text`, so the catch clause that marks nodes down was never
34
+ * entered, and the node stayed in rotation for the rest of the session.
35
+ */
36
+ export declare function isWastedNodeRun(result: {
37
+ finishReason?: unknown;
38
+ text?: unknown;
39
+ usage?: {
40
+ inputTokens?: number;
41
+ outputTokens?: number;
42
+ };
43
+ }): boolean;
44
+ export declare function isGatewayDown(text: unknown): boolean;
45
+ /** A run that spent nothing because the node's gateway had nothing behind it. */
46
+ export declare function isGatewayDownRun(result: {
47
+ finishReason?: unknown;
48
+ text?: unknown;
49
+ usage?: {
50
+ inputTokens?: number;
51
+ outputTokens?: number;
52
+ };
53
+ }): boolean;
@@ -0,0 +1,40 @@
1
+ /**
2
+ * How fast each node produces tokens, measured from what its agents report.
3
+ *
4
+ * For the lead's `agents_status`: an ETA needs a rate, and a rate the lead
5
+ * can judge needs two -- the last five minutes and the node's own history in
6
+ * this process. When they agree the ETA can be trusted; when the recent one
7
+ * has fallen far below the historical one, something on the node changed (a
8
+ * compaction wave, a prefill storm, another client) and the ETA says so.
9
+ *
10
+ * Measured here rather than asked of a server so it works for every provider:
11
+ * an agent's output-token count rises as it works, whoever serves it. Time
12
+ * is counted in active minutes -- minutes in which the node produced
13
+ * anything -- so an idle hour between rounds does not halve the history.
14
+ */
15
+ /** The window the recent rate covers. */
16
+ export declare const RECENT_WINDOW_MS: number;
17
+ export type RateReliability = "high" | "medium" | "low" | "too early";
18
+ export interface NodeRate {
19
+ /** Tokens per second over the active part of the last five minutes. */
20
+ recentTps?: number;
21
+ /** Tokens per second over every active minute so far. */
22
+ historicalTps?: number;
23
+ activeMinutes: number;
24
+ reliability: RateReliability;
25
+ }
26
+ /** The key an agent's tokens are counted under: its node, or its model. */
27
+ export declare function nodeKeyOf(agent: {
28
+ nodeId?: string;
29
+ providerId?: string;
30
+ modelId?: string;
31
+ }): string;
32
+ export declare function noteNodeTokens(key: string, tokens: number, at: number): void;
33
+ /**
34
+ * Whether two rates agree well enough to trust an ETA drawn from them. The
35
+ * recent rate is the one used; the historical one is the check on it.
36
+ */
37
+ export declare function rateReliability(recent: number | undefined, historical: number | undefined, activeMinutes: number): RateReliability;
38
+ export declare function nodeRate(key: string, now: number): NodeRate | undefined;
39
+ /** Test seam. */
40
+ export declare function __resetNodeThroughput(): void;
@@ -0,0 +1,114 @@
1
+ import { type AgentEvent, type AgentResult, type TurnFaultRecovery } from "@cerebriline/shared";
2
+ import type { AgentNodePlacement, PlacedAgentNode } from "./agent-node-placement";
3
+ import { type TurnFaultWait } from "./turn-fault-recovery";
4
+ /**
5
+ * Longest a node is held after refusing an agent that has not started, when
6
+ * none of its agents finishes first.
7
+ *
8
+ * A refusal is never the agent's result, however many there are: ruled after
9
+ * 1tmrl, where 13 agents were never admitted and became "projected mean tps
10
+ * below floor" as their final answer. What stops a refused agent from
11
+ * hammering the node is the hold, which grows from the queue's 5 s with each
12
+ * refusal in a row to this, and ends early the moment one of the node's own
13
+ * agents finishes -- the room the refusal was waiting for.
14
+ */
15
+ export declare const REFUSED_HOLD_MAX_MS = 60000;
16
+ /** The hold after the `refusals`th consecutive refusal (1-based). */
17
+ export declare function refusedHoldMs(refusals: number): number;
18
+ /**
19
+ * The engine said no to starting this agent: a 429 from the admission gate, or
20
+ * the pool owner's window being full.
21
+ *
22
+ * Read from a thrown error, or from a run that ended in error having spent
23
+ * nothing -- the two shapes a refusal reaches a spawn path in, depending on
24
+ * whether the agent loop caught it.
25
+ */
26
+ export declare function isRefusedSpawn(outcome: unknown): boolean;
27
+ /** What the engine said when it refused, for a person to read. */
28
+ export declare function refusalReason(outcome: unknown): string;
29
+ export declare function isDurableRefusal(outcome: unknown): boolean;
30
+ /**
31
+ * The KV the pool could admit at the moment it refused, from `largest
32
+ * admissible N`, or undefined when the refusal did not state one.
33
+ *
34
+ * It is the one signal that says whether waiting is worth it: a number that
35
+ * climbs across refusals means siblings are finishing and space is opening, so
36
+ * the next attempt might fit; a number that does not move is a pool that is
37
+ * stuck — in the deadlock case every worker holds nothing and waits, so nothing
38
+ * finishes to free the cells the next worker needs.
39
+ */
40
+ export declare function admissionHeadroom(outcome: unknown): number | undefined;
41
+ /**
42
+ * The attempt never reached a server that could run it: a refused or reset
43
+ * connection, a gateway with nothing behind it, or a server going down. Read
44
+ * from a thrown error or from a run that ended in error having spent nothing.
45
+ */
46
+ export declare function isTransportFailure(outcome: {
47
+ result: AgentResult;
48
+ } | {
49
+ error: unknown;
50
+ }): boolean;
51
+ /** An event that shows the engine is generating for this agent. */
52
+ export declare function isAdmissionEvent(event: AgentEvent): boolean;
53
+ export interface PlacedRunInput {
54
+ placement: AgentNodePlacement;
55
+ signal?: AbortSignal;
56
+ emitUpdate?: (update: unknown) => void;
57
+ logger?: {
58
+ log: (message: string) => void;
59
+ };
60
+ /** How the agent is named in the log lines. */
61
+ label: string;
62
+ /**
63
+ * Build the agent for this node and run it. `admitted` is to be called on
64
+ * its first output; {@link isAdmissionEvent} says which event that is.
65
+ *
66
+ * `recoverTurnFault` is to be given to the agent (`AgentConfig`): it waits
67
+ * out a turn the server dropped or refused once the engine has admitted the
68
+ * agent, and declines before that, so the failure comes back here and the
69
+ * agent is placed again.
70
+ */
71
+ run: (placed: PlacedAgentNode, admitted: () => void, recoverTurnFault: TurnFaultRecovery) => Promise<AgentResult>;
72
+ /** Told whenever the agent is waiting on a fault or a refusal. */
73
+ onWaiting?: (state: TurnFaultWait) => void;
74
+ /**
75
+ * Move this running agent off `avoidNodeId`, with its transcript: the
76
+ * path's requeue. Called only when another node has room. `false` when it
77
+ * cannot be moved, and it waits where it is.
78
+ */
79
+ relocate?: (avoidNodeId: string, reason: string) => boolean;
80
+ /** Seam for tests: the backoff between re-placements. */
81
+ sleep?: (ms: number, signal?: AbortSignal) => Promise<void>;
82
+ /** Between a failed spawn and the next placement: close its engine session. */
83
+ beforeRetry?: () => Promise<void>;
84
+ /**
85
+ * The first placement of an agent the lead requeued: back at the front of
86
+ * the queue, and off the node it named as slow or misbehaving when another
87
+ * has room. Re-placements after a refusal or a fault are the queue's own.
88
+ */
89
+ requeued?: {
90
+ avoidNodeId?: string;
91
+ };
92
+ }
93
+ export interface PlacedRunOutcome {
94
+ result: AgentResult;
95
+ /** Where it finally ran. */
96
+ placed: Pick<PlacedAgentNode, "nodeId" | "nodeLabel">;
97
+ }
98
+ export declare function runPlacedAgent(input: PlacedRunInput): Promise<PlacedRunOutcome>;
99
+ /**
100
+ * Where an agent resumed after its spawn call returned runs: back through
101
+ * its path's placement. On a node, a lease on that same node -- its transcript
102
+ * was produced by that node's model -- at the front of the queue, taken as
103
+ * admitted (the engine held it before; a refusal on the resumed turn is the
104
+ * turn-fault recovery's). Off nodes, the endpoint's slot gate. The lease is
105
+ * given back when the resumed run ends, whatever its end.
106
+ */
107
+ export declare function resumePlacement(input: {
108
+ placement?: AgentNodePlacement;
109
+ nodeId?: string;
110
+ slotGate?: {
111
+ run<T>(task: (admitted: () => void) => Promise<T>): Promise<T>;
112
+ };
113
+ signal?: () => AbortSignal | undefined;
114
+ }): <T>(run: () => Promise<T>) => Promise<T>;
@@ -0,0 +1,8 @@
1
+ import type { TeamProgressLifecycleEvent, TeamProgressSummary, TeamRuntimeState } from "@cerebriline/shared";
2
+ import type { TeamEvent } from "./multi-agent";
3
+ export declare function buildTeamProgressSummary(teamName: string, state: TeamRuntimeState): TeamProgressSummary;
4
+ export declare function toTeamProgressLifecycleEvent(input: {
5
+ teamName: string;
6
+ sessionId: string;
7
+ event: TeamEvent;
8
+ }): TeamProgressLifecycleEvent;
@@ -0,0 +1,6 @@
1
+ export { type AgentSlotGate, type AgentSlotGateRegistry, agentEndpointKey, agentNodesAllowParallelDelegation, agentSlotLimitsByEndpoint, createAgentSlotGate, createAgentSlotGateRegistry, delegationCanRunInParallel, slotsAllowParallelDelegation, } from "./agent-slot-gate";
2
+ export { buildDelegatedAgentConfig, createDelegatedAgent, createDelegatedAgentConfigProvider, type DelegatedAgentConfigProvider, type DelegatedAgentConnectionConfig, type DelegatedAgentKind, type DelegatedAgentRuntimeConfig, type DelegatedPrepareTurnTarget, } from "./delegated-agent";
3
+ export { buildSubagentLayout, pinConversationHead, SUBAGENT_BASE_PROMPT, type SubagentKnowledge, type SubagentLayout, } from "./subagent-layout";
4
+ export { createSpawnAgentTool, type SpawnAgentInput, type SpawnAgentOutput, type SpawnAgentToolConfig, type SubAgentEndContext, type SubAgentStartContext, } from "./spawn-agent-tool";
5
+ export { type AgentTask, AgentTeam, AgentTeamsRuntime, type AgentTeamsRuntimeOptions, createAgentTeam, createWorkerReviewerTeam, type SpawnTeammateOptions, type TaskResult, type TeamEvent, type TeamMemberConfig, } from "./multi-agent";
6
+ export { type BootstrapAgentTeamsOptions, type BootstrapAgentTeamsResult, bootstrapAgentTeams, type CreateAgentTeamsToolsOptions, createAgentTeamsTools, reviveTeamStateDates, sanitizeTeamName, type TeamTeammateRuntimeConfig, } from "./team-tools";
@@ -0,0 +1,28 @@
1
+ /**
2
+ * A worker refused because the lead's window is full, which is a wait.
3
+ *
4
+ * Pooled workers are charged against the session that owns the pool -- that is
5
+ * what makes them cost no allocation of their own -- so the lead's window, not
6
+ * the server's cells, is what bounds how many can run at once. When the tree
7
+ * fills it the engine refuses the next one:
8
+ *
9
+ * admission rejected: session allocation full (worker of '<session>':
10
+ * 39653 of 65536 cells free, needs 40252) — compact the session
11
+ *
12
+ * Measured live on 8240, 2026-09-22: four workers of ~10k prompt each under a
13
+ * 65,536-token lead already holding 22k, and the fifth and sixth were refused.
14
+ * The room appears again the moment a running worker finishes, so this is a
15
+ * queueing condition wearing an error's clothes -- the same shape as the 429
16
+ * the admission gate answers with, and treated the same way.
17
+ *
18
+ * Every other failure is the worker's own and travels untouched.
19
+ */
20
+ export declare function isSessionAllocationFull(error: unknown): boolean;
21
+ export interface SessionFullRetryOptions {
22
+ /** Runs in total, the first included. */
23
+ attempts?: number;
24
+ /** Seam for tests; real waits are seconds, which is the right scale here. */
25
+ sleep?: (ms: number) => Promise<void>;
26
+ onRetry?: (attempt: number, waitMs: number) => void;
27
+ }
28
+ export declare function retryWhileSessionFull<T>(run: () => Promise<T>, options?: SessionFullRetryOptions): Promise<T>;