@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,450 @@
1
+ /**
2
+ * Reusable spawn_agent tool for delegating tasks to sub-agents.
3
+ */
4
+ import { type AgentConfig, type AgentEvent, type AgentHooks, type AgentResult, type AgentTool, type AgentToolContext, type BasicLogger, type HookErrorMode, type ITelemetryService, type ToolApprovalRequest, type ToolApprovalResult, type ToolPolicy } from "@cerebriline/shared";
5
+ import { z } from "zod";
6
+ import type { OracleSpawnWrapper } from "../../../runtime/atomic/oracle";
7
+ import { type AgentCheck, type AgentOracleResult } from "./agent-check";
8
+ import { type DelegatedRunOutcome, type DelegatedStopReason } from "./agent-iteration-cap";
9
+ import { type AgentFacts, type RoundHandle } from "./agent-rounds";
10
+ import { type SpawnBatchReport } from "./batch-report";
11
+ import type { ConfiguredAgentConfig } from "./configured-agent-config";
12
+ import { type DelegatedAgentConfigProvider } from "./delegated-agent";
13
+ import { type RealizedSpawnSampling } from "./spawn-sampling";
14
+ import { withRevisedInstructions } from "./subagent-cancellation";
15
+ import { type MemberUsage } from "./token-split";
16
+ /** The tool a model calls to hand a self-contained piece of work to a subagent. */
17
+ export declare const SPAWN_AGENT_TOOL_NAME = "spawn_agent";
18
+ type AgentExtension = NonNullable<AgentConfig["extensions"]>[number];
19
+ type AgentFinishReason = AgentResult["finishReason"];
20
+ export declare const SpawnAgentInputSchema: z.ZodObject<{
21
+ wait: z.ZodOptional<z.ZodBoolean>;
22
+ check: z.ZodOptional<z.ZodObject<{
23
+ command: z.ZodString;
24
+ expect: z.ZodString;
25
+ must: z.ZodOptional<z.ZodEnum<{
26
+ match: "match";
27
+ not_match: "not_match";
28
+ }>>;
29
+ }, z.core.$strip>>;
30
+ temperature: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"random">]>>;
31
+ seed: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"random">]>>;
32
+ temperature_range: z.ZodOptional<z.ZodNumber>;
33
+ knowledge: z.ZodOptional<z.ZodObject<{
34
+ files: z.ZodOptional<z.ZodArray<z.ZodString>>;
35
+ text: z.ZodOptional<z.ZodString>;
36
+ }, z.core.$strip>>;
37
+ instructions: z.ZodOptional<z.ZodString>;
38
+ systemPrompt: z.ZodOptional<z.ZodString>;
39
+ task: z.ZodOptional<z.ZodString>;
40
+ name: z.ZodOptional<z.ZodString>;
41
+ }, z.core.$strip>;
42
+ /**
43
+ * Several agents in one call.
44
+ *
45
+ * What the model reaches for first: asked for 75 reports in the sx4bp run
46
+ * (pandorum, 2026-09-23), the lead planned "a swarm", found only a one-agent
47
+ * tool, and spent its turn deciding whether 75 calls was too many before
48
+ * writing all 75 -- each repeating the same `knowledge` and `instructions`.
49
+ * A list states the shared parts once and is one call.
50
+ */
51
+ export declare const SpawnAgentMemberSchema: z.ZodObject<{
52
+ name: z.ZodOptional<z.ZodString>;
53
+ task: z.ZodString;
54
+ instructions: z.ZodOptional<z.ZodString>;
55
+ type: z.ZodOptional<z.ZodString>;
56
+ count: z.ZodOptional<z.ZodNumber>;
57
+ temperature: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"random">]>>;
58
+ seed: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"random">]>>;
59
+ temperature_range: z.ZodOptional<z.ZodNumber>;
60
+ check: z.ZodOptional<z.ZodObject<{
61
+ command: z.ZodString;
62
+ expect: z.ZodString;
63
+ must: z.ZodOptional<z.ZodEnum<{
64
+ match: "match";
65
+ not_match: "not_match";
66
+ }>>;
67
+ }, z.core.$strip>>;
68
+ }, z.core.$strip>;
69
+ /** Most agents one entry's `count` may ask for. */
70
+ export declare const MAX_AGENTS_PER_ENTRY = 100;
71
+ /**
72
+ * One entry per agent, with each `count` spelled out.
73
+ *
74
+ * Copies are named `<name>-<n>` so their rows and reports tell them apart.
75
+ * The host expands the same way (`spawnBatchMembers`), which is what keeps a
76
+ * row keyed `<call>#<index>` on the agent it shows.
77
+ *
78
+ * An entry's `seed` is offset by the copy's index -- seed 7 with count 3 is
79
+ * 7, 8 and 9 -- so that copies running one task do not draw identical samples.
80
+ * Its `temperature` is the same for every copy.
81
+ */
82
+ export declare function expandAgentCounts(agents: readonly SpawnAgentMember[]): SpawnAgentMember[];
83
+ export declare const SpawnAgentBatchInputSchema: z.ZodObject<{
84
+ wait: z.ZodOptional<z.ZodBoolean>;
85
+ check: z.ZodOptional<z.ZodObject<{
86
+ command: z.ZodString;
87
+ expect: z.ZodString;
88
+ must: z.ZodOptional<z.ZodEnum<{
89
+ match: "match";
90
+ not_match: "not_match";
91
+ }>>;
92
+ }, z.core.$strip>>;
93
+ temperature: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"random">]>>;
94
+ seed: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"random">]>>;
95
+ temperature_range: z.ZodOptional<z.ZodNumber>;
96
+ knowledge: z.ZodOptional<z.ZodObject<{
97
+ files: z.ZodOptional<z.ZodArray<z.ZodString>>;
98
+ text: z.ZodOptional<z.ZodString>;
99
+ }, z.core.$strip>>;
100
+ instructions: z.ZodOptional<z.ZodString>;
101
+ systemPrompt: z.ZodOptional<z.ZodString>;
102
+ task: z.ZodOptional<z.ZodString>;
103
+ name: z.ZodOptional<z.ZodString>;
104
+ agents: z.ZodOptional<z.ZodArray<z.ZodObject<{
105
+ name: z.ZodOptional<z.ZodString>;
106
+ task: z.ZodString;
107
+ instructions: z.ZodOptional<z.ZodString>;
108
+ type: z.ZodOptional<z.ZodString>;
109
+ count: z.ZodOptional<z.ZodNumber>;
110
+ temperature: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"random">]>>;
111
+ seed: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"random">]>>;
112
+ temperature_range: z.ZodOptional<z.ZodNumber>;
113
+ check: z.ZodOptional<z.ZodObject<{
114
+ command: z.ZodString;
115
+ expect: z.ZodString;
116
+ must: z.ZodOptional<z.ZodEnum<{
117
+ match: "match";
118
+ not_match: "not_match";
119
+ }>>;
120
+ }, z.core.$strip>>;
121
+ }, z.core.$strip>>>;
122
+ }, z.core.$strip>;
123
+ /** Only offered when the session can run swarms. */
124
+ export declare const SpawnAgentSwarmInputSchema: z.ZodObject<{
125
+ wait: z.ZodOptional<z.ZodBoolean>;
126
+ check: z.ZodOptional<z.ZodObject<{
127
+ command: z.ZodString;
128
+ expect: z.ZodString;
129
+ must: z.ZodOptional<z.ZodEnum<{
130
+ match: "match";
131
+ not_match: "not_match";
132
+ }>>;
133
+ }, z.core.$strip>>;
134
+ temperature: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"random">]>>;
135
+ seed: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"random">]>>;
136
+ temperature_range: z.ZodOptional<z.ZodNumber>;
137
+ knowledge: z.ZodOptional<z.ZodObject<{
138
+ files: z.ZodOptional<z.ZodArray<z.ZodString>>;
139
+ text: z.ZodOptional<z.ZodString>;
140
+ }, z.core.$strip>>;
141
+ instructions: z.ZodOptional<z.ZodString>;
142
+ systemPrompt: z.ZodOptional<z.ZodString>;
143
+ task: z.ZodOptional<z.ZodString>;
144
+ name: z.ZodOptional<z.ZodString>;
145
+ agents: z.ZodOptional<z.ZodArray<z.ZodObject<{
146
+ name: z.ZodOptional<z.ZodString>;
147
+ task: z.ZodString;
148
+ instructions: z.ZodOptional<z.ZodString>;
149
+ type: z.ZodOptional<z.ZodString>;
150
+ count: z.ZodOptional<z.ZodNumber>;
151
+ temperature: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"random">]>>;
152
+ seed: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"random">]>>;
153
+ temperature_range: z.ZodOptional<z.ZodNumber>;
154
+ check: z.ZodOptional<z.ZodObject<{
155
+ command: z.ZodString;
156
+ expect: z.ZodString;
157
+ must: z.ZodOptional<z.ZodEnum<{
158
+ match: "match";
159
+ not_match: "not_match";
160
+ }>>;
161
+ }, z.core.$strip>>;
162
+ }, z.core.$strip>>>;
163
+ merge: z.ZodOptional<z.ZodBoolean>;
164
+ count: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">]>>;
165
+ }, z.core.$strip>;
166
+ export type SpawnAgentMember = z.infer<typeof SpawnAgentMemberSchema>;
167
+ export type SpawnAgentInput = z.infer<typeof SpawnAgentInputSchema> & {
168
+ agents?: SpawnAgentMember[];
169
+ merge?: boolean;
170
+ count?: number | "max";
171
+ /**
172
+ * What the harness changed about the call while reading it, for the lead:
173
+ * agents renamed apart, a field that does nothing here. Not part of the
174
+ * schema -- set by `checkMembers`, reported with the call's result.
175
+ */
176
+ setupNotes?: string[];
177
+ };
178
+ /** One agent of a batch, as reported back. */
179
+ export interface SpawnAgentMemberOutput extends Partial<SpawnAgentOutput> {
180
+ name: string;
181
+ /** Set when this agent failed; its siblings' reports are unaffected. */
182
+ error?: string;
183
+ /** Times the engine evicted it (an engine bug each time), when it did. */
184
+ evicted?: number;
185
+ }
186
+ /**
187
+ * An `agents` call's result: an aggregate, an index of every agent, and as
188
+ * many reports as fit -- the rest named, to read with `read_agent_report`.
189
+ * See `batch-report.ts`.
190
+ */
191
+ export type SpawnAgentBatchOutput = SpawnBatchReport;
192
+ export interface SpawnAgentOutput {
193
+ text: string;
194
+ iterations: number;
195
+ finishReason: AgentFinishReason;
196
+ usage: MemberUsage;
197
+ /**
198
+ * Which model actually spent those tokens.
199
+ *
200
+ * Not always the session's: agents can be given a connection of their own,
201
+ * and a configured agent may name a provider per file. Without this the
202
+ * host can only add a sub-agent's tokens to the lead's total, which is the
203
+ * difference between free local tokens and billed ones going unrecorded.
204
+ */
205
+ model?: {
206
+ id: string;
207
+ provider: string;
208
+ };
209
+ /**
210
+ * Which agent node this agent was placed on, when the session has any.
211
+ *
212
+ * The model and the node are different facts and both are worth showing:
213
+ * two nodes can carry the same model on two endpoints, and the reason a
214
+ * fan-out is slow is usually which node took the work rather than which
215
+ * model did it. Absent on a session with no nodes, where there is only
216
+ * one place an agent can run and naming it says nothing.
217
+ */
218
+ nodeId?: string;
219
+ /** What the settings panel calls that node: `Node1`, `Node2`. */
220
+ nodeLabel?: string;
221
+ /**
222
+ * The sampler the call asked for, when it asked: what this agent ran with
223
+ * over its model's own -- a random seed or temperature as drawn, with what
224
+ * it was drawn around. Absent means the model's own throughout.
225
+ */
226
+ sampling?: RealizedSpawnSampling;
227
+ /** The agent's own id: what `resume_agent` and the status tool name it by. */
228
+ agentId?: string;
229
+ /** Its cap: the first one plus every raise. Absent is no cap. */
230
+ maxIterations?: number;
231
+ /** Set when the iteration cap is what ended it (the lead stopped it there). */
232
+ stopReason?: DelegatedStopReason;
233
+ /**
234
+ * `awaiting_lead`: it is at its cap, waiting, work kept -- continue it with
235
+ * `resume_agent`. Only when nothing could ask the lead during the round.
236
+ */
237
+ state?: "awaiting_lead";
238
+ /** The lead's check, when one was set: pass, fail or not run. */
239
+ oracle?: AgentOracleResult;
240
+ /**
241
+ * Its place in the round and how it ended (section F): id, state, stop
242
+ * reason, iterations against its cap, tokens, compactions, check, sampler
243
+ * and node. Set on the result the lead is handed.
244
+ */
245
+ agent?: AgentFacts;
246
+ }
247
+ export interface SubAgentStartContext {
248
+ subAgentId: string;
249
+ conversationId: string;
250
+ parentAgentId: string;
251
+ input: SpawnAgentInput;
252
+ /**
253
+ * The spawning tool call. Unique per spawned agent (batch spawns suffix the
254
+ * index), and known before the agent's own id exists, so it is the key a
255
+ * per-agent sandbox is registered under and later handed back by. Optional
256
+ * because a tool context need not carry one; sandboxing is skipped when it
257
+ * does not.
258
+ */
259
+ toolCallId?: string;
260
+ }
261
+ export interface SubAgentEndContext {
262
+ subAgentId: string;
263
+ conversationId: string;
264
+ parentAgentId: string;
265
+ input: SpawnAgentInput;
266
+ /** The spawning tool call; see {@link SubAgentStartContext.toolCallId}. */
267
+ toolCallId?: string;
268
+ result?: SpawnAgentOutput;
269
+ agentResult?: AgentResult;
270
+ error?: Error;
271
+ }
272
+ /** How a delegation that has ended is identified to its last observer. */
273
+ export interface SubAgentSettledContext {
274
+ /** The spawning tool call; see {@link SubAgentStartContext.toolCallId}. */
275
+ toolCallId?: string;
276
+ /** The agent's name, as the lead gave it or as its file names it. */
277
+ name: string;
278
+ }
279
+ export interface SpawnAgentToolConfig {
280
+ configProvider: DelegatedAgentConfigProvider;
281
+ /**
282
+ * Whether the session also offers the `team_*` tools. Only then does the
283
+ * description point at them: with Teammates off (the default) a sentence
284
+ * sending the model to tools it was not given is a call that fails.
285
+ */
286
+ teammates?: boolean;
287
+ defaultMaxIterations?: number;
288
+ subAgentTools?: AgentTool[];
289
+ createSubAgentTools?: (input: SpawnAgentInput, context: AgentToolContext) => AgentTool[] | Promise<AgentTool[]>;
290
+ onSubAgentEvent?: (event: AgentEvent) => void;
291
+ /**
292
+ * Lifecycle hooks forwarded to spawned sub-agent runs.
293
+ */
294
+ hooks?: AgentHooks;
295
+ /**
296
+ * Extension list forwarded to spawned sub-agent runs.
297
+ */
298
+ extensions?: AgentExtension[];
299
+ /**
300
+ * Error handling mode for forwarded lifecycle hooks.
301
+ */
302
+ hookErrorMode?: HookErrorMode;
303
+ /**
304
+ * Called after a sub-agent instance is created and before it starts running.
305
+ * Errors are ignored so lifecycle observers cannot break task execution.
306
+ */
307
+ onSubAgentStart?: (context: SubAgentStartContext) => void | Promise<void>;
308
+ /**
309
+ * Called once a sub-agent run finishes (success or error).
310
+ * Errors are ignored so lifecycle observers cannot break task execution.
311
+ */
312
+ onSubAgentEnd?: (context: SubAgentEndContext) => void | Promise<void>;
313
+ /**
314
+ * Called once the spawn is over, however it ended -- including the paths
315
+ * {@link onSubAgentEnd} never sees, where the agent failed or was stopped
316
+ * before it started. Whatever `createSubAgentTools` opened for this call
317
+ * (its private workspace) is released here, so nothing outlives the call.
318
+ * Errors are ignored.
319
+ */
320
+ onSubAgentSettled?: (context: SubAgentSettledContext) => void | Promise<void>;
321
+ /**
322
+ * Optional per-tool policy for spawned sub-agents.
323
+ */
324
+ toolPolicies?: Record<string, ToolPolicy>;
325
+ /**
326
+ * Optional approval callback for spawned sub-agent tool calls.
327
+ */
328
+ requestToolApproval?: (request: ToolApprovalRequest) => Promise<ToolApprovalResult> | ToolApprovalResult;
329
+ /**
330
+ * Optional logger forwarded to spawned sub-agent runs.
331
+ */
332
+ logger?: BasicLogger;
333
+ telemetry?: ITelemetryService;
334
+ /**
335
+ * The configured agents an `agents[].type` may name, keyed by
336
+ * {@link configuredAgentKey}. Each runs through its own tool, so its role,
337
+ * model and placement are exactly what a direct `subagent_<name>` call
338
+ * would give it.
339
+ */
340
+ configuredAgents?: () => ReadonlyMap<string, AgentTool>;
341
+ /** The same agents' definitions, keyed alike: what a swarm worker needs. */
342
+ configuredAgentConfigs?: () => ReadonlyMap<string, ConfiguredAgentConfig>;
343
+ /**
344
+ * The session's swarm, when it can run one. Present means `merge` and
345
+ * `count` are offered and routed to it, and `spawn_swarm` is not
346
+ * registered on its own.
347
+ */
348
+ swarm?: AgentTool;
349
+ /**
350
+ * The launcher an agent's commands run under, keyed by its spawning tool
351
+ * call: where its `check` is run. `undefined` -- or no resolver -- is no
352
+ * command sandbox, and the check is reported as not run.
353
+ */
354
+ commandSandboxFor?: (toolCallId: string | undefined) => {
355
+ wrapSpawn: OracleSpawnWrapper;
356
+ cwd: string;
357
+ } | undefined;
358
+ /**
359
+ * The lead's session, when the tool is built for one: its rounds can then
360
+ * run an agent again from their record (`retry_failed`) without the call
361
+ * that first ran it.
362
+ */
363
+ sessionId?: string;
364
+ }
365
+ /** The key a configured agent is looked up by: `JS-Syntactic`, `js_syntactic` and `subagent_js_syntactic` are one agent. */
366
+ export declare function configuredAgentKey(name: string): string;
367
+ export declare function describeSpawnAgent(swarm: boolean, teammates?: boolean): string;
368
+ /**
369
+ * `agents` as the list it was meant to be, or a refusal that says how to send it.
370
+ *
371
+ * Measured on pandorum 2026-09-23 (5rybo): qwen sent `agents` as text, twice,
372
+ * and the text was the list followed by the rest of the call --
373
+ * `[{...}, ...], "merge": true`. That is not JSON on its own, it went through
374
+ * as a string, and the batch failed with `a.map is not a function`, which
375
+ * told the model nothing it could act on. It gave up on the list and fanned
376
+ * one task out fifteen times instead.
377
+ *
378
+ * Two readings are taken, each the only one its text has: the list as JSON
379
+ * text, and the list with the fields written after it, read as the object
380
+ * they close. A field that bled in fills only what the call left unset.
381
+ * Anything else is refused by name, never run.
382
+ */
383
+ export declare function readAgentsField(input: SpawnAgentInput): SpawnAgentInput;
384
+ /**
385
+ * The swarm tool's input, from a `merge` call.
386
+ *
387
+ * An entry naming a configured agent in `type` becomes a worker with that
388
+ * agent's role and tool list, on the swarm's nodes and snapshot. Dropped
389
+ * before, so asked for "15 code-verifiers as a swarm" the round ran fifteen
390
+ * generic workers under the lead's shared instructions.
391
+ */
392
+ export declare function toSwarmInput(input: SpawnAgentInput, configs?: ReadonlyMap<string, ConfiguredAgentConfig>): Record<string, unknown>;
393
+ /**
394
+ * `check`, and `max_iterations` only where the harness itself stored one,
395
+ * read and passed on only when set.
396
+ *
397
+ * A model's `max_iterations` is ignored, not refused: the field is no longer
398
+ * offered (see `AgentControlFields`), and a lead that still sends it from an
399
+ * older transcript should not lose the call over it.
400
+ */
401
+ export declare function controlFields(input: unknown, options?: {
402
+ storedCap?: boolean;
403
+ }): {
404
+ max_iterations?: number;
405
+ check?: AgentCheck;
406
+ };
407
+ /** What a session hands its spawn tool beyond the connection. */
408
+ export type SpawnToolOptions = Pick<SpawnAgentToolConfig, "swarm" | "configuredAgents" | "configuredAgentConfigs" | "teammates">;
409
+ /**
410
+ * Create a spawn_agent tool that can run a delegated task with a focused sub-agent.
411
+ */
412
+ export declare function createSpawnAgentTool(config: SpawnAgentToolConfig): AgentTool<SpawnAgentInput, SpawnAgentOutput | SpawnAgentBatchOutput | SpawnBackgroundAck>;
413
+ /**
414
+ * An agent's cap and check as its round stored them, for a rerun. The cap
415
+ * is the one it was given, not one the lead raised later: a rerun starts
416
+ * over.
417
+ */
418
+ export declare function storedControls(agent: {
419
+ maxIterations?: number;
420
+ check?: unknown;
421
+ }): {
422
+ max_iterations?: number;
423
+ check?: AgentCheck;
424
+ };
425
+ /**
426
+ * What a call that runs in the background returns at once: where its agents
427
+ * are, and how their report will reach the lead.
428
+ */
429
+ export interface SpawnBackgroundAck {
430
+ background: true;
431
+ round: string;
432
+ agents: Array<{
433
+ id: string;
434
+ name: string;
435
+ }>;
436
+ note: string;
437
+ }
438
+ export declare function backgroundAck(handle: RoundHandle): SpawnBackgroundAck;
439
+ /**
440
+ * What a blocking call returns when a message for the lead arrives first: the
441
+ * round is detached and goes on in the background.
442
+ */
443
+ export declare function wokenAck(handle: RoundHandle): SpawnBackgroundAck;
444
+ /** What an agent moved to another node is told when it carries on. */
445
+ export declare function requeueNote(reason: string | undefined): string;
446
+ export { withRevisedInstructions };
447
+ /** The report fields the cap and the check add, only where they say something. */
448
+ export declare function controlReport(agentId: string | undefined, outcome: DelegatedRunOutcome | undefined): Pick<SpawnAgentOutput, "agentId" | "maxIterations" | "stopReason" | "state" | "oracle">;
449
+ /** What the lead reads under an agent returned while it waits at its cap. */
450
+ export declare function awaitingLeadNote(name: string, agentId: string | undefined, outcome: DelegatedRunOutcome): string;
@@ -0,0 +1,188 @@
1
+ /**
2
+ * A sampler the lead chose for the agents it spawns: `temperature` and `seed`.
3
+ *
4
+ * Both are optional, and absent is not a default. An agent spawned without
5
+ * them runs on its connection's sampler exactly as before -- nothing here
6
+ * writes a value the lead did not pass, because a local model's validated
7
+ * sampler lives in its Modelfile and a client that invents one silently
8
+ * replaces it.
9
+ *
10
+ * What the lead passes is applied last, in {@link buildDelegatedAgentConfig},
11
+ * over whatever connection the agent was built on. That is the one point
12
+ * after every other source has had its say -- the session's pushes through
13
+ * `updateConnectionDefaults`, a profile, a node's connection (the priority-0
14
+ * node clears `temperature` so the lead's own applies) -- so none of them can
15
+ * move a value the lead asked for.
16
+ *
17
+ * Either may also be `"random"`, for a swarm experiment that wants its agents
18
+ * to sample differently and wants to know afterwards how:
19
+ *
20
+ * - `seed: "random"` gives each agent its own independent seed.
21
+ * - `temperature: "random"` gives each agent a draw from its model's own
22
+ * temperature +/- `temperature_range` percent (2 when not given, so a model
23
+ * at 1 draws 0.98 to 1.02). The model's own is read, never guessed (see
24
+ * {@link modelTemperatureOf}); when nothing states it the agent keeps the
25
+ * model's sampler and the row says so.
26
+ * - A numeric `temperature` with a `temperature_range` is randomized around
27
+ * that number; `temperature_range` alone around the model's own.
28
+ * - The range is the user's to widen, and only so far: a request over
29
+ * {@link MAX_TEMPERATURE_RANGE_PERCENT} is held to it and the row says so.
30
+ * A lead once judged 2% "effectively no variation", asked for 60 on its own
31
+ * and ran an agent at 0.595 on a model validated at 1.
32
+ *
33
+ * The lead's request is drawn once per agent ({@link drawSpawnSampling}) --
34
+ * so a re-placement keeps the draw -- and realized at build, where the
35
+ * connection and so the model's own temperature are known
36
+ * ({@link realizeSpawnSampling}). What each agent really ran with goes to its
37
+ * row, its result and, for a teammate, its persisted spec.
38
+ */
39
+ import type { AgentConfig } from "@cerebriline/shared";
40
+ import { z } from "zod";
41
+ /** The keyword that asks for a per-agent random value. */
42
+ export declare const SPAWN_RANDOM: "random";
43
+ /** Percent a random temperature may move either way when no range is given. */
44
+ export declare const DEFAULT_TEMPERATURE_RANGE_PERCENT = 2;
45
+ /** The widest a random temperature may move either way, whatever is asked. */
46
+ export declare const MAX_TEMPERATURE_RANGE_PERCENT = 10;
47
+ /** Seeds drawn for `seed: "random"` are in [0, this). Fits a signed int32. */
48
+ export declare const RANDOM_SEED_LIMIT: number;
49
+ /** The info line an agent gets when "random" had no temperature to start from. */
50
+ export declare const UNKNOWN_MODEL_TEMPERATURE_NOTE = "model temperature unknown; kept the model's sampler";
51
+ /** The info line an agent gets when its range was held to the limit. */
52
+ export declare function rangeOverLimitNote(requested: number): string;
53
+ /** What a lead asked for: as the tool input states it, after tolerant reading. */
54
+ export interface SpawnSampling {
55
+ temperature?: number | typeof SPAWN_RANDOM;
56
+ seed?: number | typeof SPAWN_RANDOM;
57
+ /** Percent, 0-100. Asks for a randomized temperature on its own. */
58
+ temperature_range?: number;
59
+ }
60
+ /**
61
+ * One agent's sampler, drawn: every random choice made, the model's own
62
+ * temperature not yet read. A plain `{temperature, seed}` of numbers is one
63
+ * with nothing random in it.
64
+ */
65
+ export interface SpawnSamplingDraw {
66
+ /** Fixed: used as given. */
67
+ temperature?: number;
68
+ seed?: number;
69
+ /** The seed was drawn, not given. */
70
+ seedRandom?: boolean;
71
+ /**
72
+ * Randomize the temperature: `base` (or, absent, the model's own) moved by
73
+ * `draw * range` percent, `draw` uniform in [-1, 1].
74
+ */
75
+ temperatureRandom?: {
76
+ base?: number;
77
+ range: number;
78
+ draw: number;
79
+ /** What was asked for, when it was over the limit and `range` is not it. */
80
+ requestedRange?: number;
81
+ };
82
+ }
83
+ /** What one agent ran with, for its row, its result and its record. */
84
+ export interface RealizedSpawnSampling {
85
+ temperature?: number;
86
+ seed?: number;
87
+ /** The seed was drawn per agent (`seed: "random"`). */
88
+ seedRandom?: boolean;
89
+ /** Present when the temperature was randomized: what it was drawn around. */
90
+ temperatureBase?: number;
91
+ /** Percent, present when the temperature was randomized (or asked to be). */
92
+ temperatureRange?: number;
93
+ /** An info line for the row: why a requested value was not applied. */
94
+ note?: string;
95
+ }
96
+ /** A source of uniform numbers in [0, 1). Injected by tests. */
97
+ export type SamplingRandom = () => number;
98
+ /** The fields as a spawn tool's input schema states them. */
99
+ export declare const SpawnSamplingFields: {
100
+ temperature: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"random">]>>;
101
+ seed: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"random">]>>;
102
+ temperature_range: z.ZodOptional<z.ZodNumber>;
103
+ };
104
+ /** The one line each spawn tool's description gives the options. */
105
+ export declare const SPAWN_SAMPLING_NOTE = "Optional `temperature` and `seed` set the sampler for the agents they cover, over their model's own; omit them to keep the model's. A `seed` that covers several agents is offset by each agent's index among them (seed, seed+1, ...), so they do not sample identically. Either may be \"random\": `seed: \"random\"` gives each agent its own seed; `temperature: \"random\"` gives each a draw within 2% of its model's temperature (a model at 1.0 gets 0.98 to 1.02), which is the intended variation. Set `temperature_range` only when the user states a number: it is the percent to draw within, around a numeric `temperature` or the model's own, held to 10 at most. ";
106
+ /**
107
+ * The sampler a tool input names, or `undefined` when it names none.
108
+ *
109
+ * Tolerant of the shapes a model sends: a numeric string is read as its
110
+ * number, "Random" as "random", a range of "2%" as 2, and `temperatureRange`
111
+ * as `temperature_range`. Anything that is not usable is dropped rather than
112
+ * sent -- a negative temperature, a fractional seed, a range over 100.
113
+ */
114
+ export declare function readSpawnSampling(input: unknown): SpawnSampling | undefined;
115
+ /**
116
+ * The sampler for the `index`th agent made from one entry.
117
+ *
118
+ * A numeric seed is offset by the index so that N agents running one task do
119
+ * not draw N identical samples; a "random" one stays "random", and each agent
120
+ * draws its own. The temperature is the same request for all of them.
121
+ */
122
+ export declare function samplingForCopy(sampling: SpawnSampling | undefined, index: number): SpawnSampling | undefined;
123
+ /** `inner` over `outer`, field by field: an entry's own value beats the call's. */
124
+ export declare function mergeSpawnSampling(outer: SpawnSampling | undefined, inner: SpawnSampling | undefined): SpawnSampling | undefined;
125
+ /** The fields to spread into a tool input; nothing when unset. */
126
+ export declare function spawnSamplingFields(sampling: SpawnSampling | undefined): SpawnSampling;
127
+ /**
128
+ * Make one agent's random choices: its seed, and where in the range its
129
+ * temperature falls. Once per agent -- not per attempt -- so a re-placement
130
+ * runs the same draw.
131
+ */
132
+ export declare function drawSpawnSampling(sampling: SpawnSampling | undefined, random?: SamplingRandom): SpawnSamplingDraw | undefined;
133
+ type SamplingConnection = Pick<AgentConfig, "providerId" | "modelId" | "baseUrl" | "temperature" | "providerConfig">;
134
+ /**
135
+ * The temperature the agent's model runs at when the spawn names none, from
136
+ * the first source that states one:
137
+ *
138
+ * 1. the connection's own `temperature` -- a node's or the session's setting;
139
+ * 2. its sampler bag, `providerConfig.sampling.temperature` -- a profile's or
140
+ * a node's `settings.sampling`, which is what reaches the wire;
141
+ * 3. for Ollama, the Modelfile's `temperature` parameter, from `/api/show`;
142
+ * 4. for a llama.cpp/opencoti server, `/props`' default generation settings,
143
+ * when they have already been read.
144
+ *
145
+ * `undefined` when none of them does: nothing here guesses one.
146
+ */
147
+ export declare function modelTemperatureOf(connection: SamplingConnection): number | undefined;
148
+ /**
149
+ * Read the model's own temperature from its server, when a draw needs it and
150
+ * no local setting states it: Ollama's `/api/show` (the same read its handler
151
+ * makes before the first request, cached per model) or opencoti's `/props`
152
+ * (read once per server at session start). Anything else is not asked.
153
+ * Failure is not an error: the agent then keeps the model's sampler.
154
+ */
155
+ export declare function primeModelTemperature(draw: SpawnSamplingDraw | undefined, connection: SamplingConnection, fetchImpl?: typeof fetch): Promise<void>;
156
+ /**
157
+ * One agent's draw made concrete against its model's own temperature.
158
+ *
159
+ * A randomized temperature is `base * (1 + draw * range / 100)`, rounded to
160
+ * three decimals and never below 0. With no base -- the spawn named none and
161
+ * the model states none -- the temperature is left unset and `note` says so:
162
+ * the model's sampler stands, and nothing is invented in its place.
163
+ */
164
+ export declare function realizeSpawnSampling(draw: SpawnSamplingDraw | undefined, modelTemperature: number | undefined): RealizedSpawnSampling | undefined;
165
+ /** The two values a realized sampler puts on the wire; nothing when unset. */
166
+ export declare function samplingValues(sampling: Pick<RealizedSpawnSampling, "temperature" | "seed"> | undefined): {
167
+ temperature?: number;
168
+ seed?: number;
169
+ };
170
+ /**
171
+ * The compact line a row shows for a realized sampler: `seed 2847193 · T 0.713`.
172
+ * `undefined` when there is nothing to show.
173
+ */
174
+ export declare function describeRealizedSampling(sampling: RealizedSpawnSampling | undefined): string | undefined;
175
+ /**
176
+ * An agent config with the lead's sampler over its connection's.
177
+ *
178
+ * `temperature` goes to both places a provider reads it from: the config's
179
+ * own field, which becomes the request's `temperature`, and the provider
180
+ * config's `sampling` bag, which is what Ollama and llama.cpp/opencoti put on
181
+ * the wire. Setting only the first would leave a profile's
182
+ * `sampling.temperature` in the bag to contradict it. `seed` has only the bag:
183
+ * no other route carries one.
184
+ *
185
+ * With no sampler the config is returned untouched -- the same object.
186
+ */
187
+ export declare function applySpawnSampling<T extends AgentConfig>(config: T, sampling: Pick<RealizedSpawnSampling, "temperature" | "seed"> | undefined): T;
188
+ export {};