@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,79 @@
1
+ /**
2
+ * Set up a delegated agent's private sandbox and the executor options that bind
3
+ * every one of its file tools to the overlay.
4
+ *
5
+ * A delegated agent must not reuse the lead's executors: its file tools have to
6
+ * resolve through the agent's overlay, and its shell has to run rooted at the
7
+ * native launcher. `createBuiltinTools` builds its file executors from
8
+ * `executorOptions`, so setting `overlay` there is what makes read, editor,
9
+ * apply_patch, grep, sed and awk overlay-backed in one place — no per-executor
10
+ * wiring to forget, and none of the lead's disk-backed overrides slipping
11
+ * through to re-point a tool at the real workspace.
12
+ *
13
+ * The shell is the escape-prone part. It is bound to the launcher through
14
+ * `bash.wrapSpawn`, and where the platform has no launcher there is no wrapper —
15
+ * so `commandsEnabled` is false and the caller passes `enableBash: false`. An
16
+ * un-wrapped command runs against the real workspace, so "no launcher" always
17
+ * means "no run_commands", never "run it unsandboxed".
18
+ */
19
+ import { type AgentSandbox, type SandboxBinaries } from "../../../runtime/sandbox/agent-sandbox";
20
+ import type { DefaultExecutorsOptions } from "../executors";
21
+ /**
22
+ * The host's per-session capability to sandbox delegated agents. Supplied only
23
+ * when isolation is turned on and the workspace/storage are known; absent means
24
+ * delegated agents run exactly as before, sharing the lead's executors.
25
+ *
26
+ * The host owns the two things core cannot know: where the agent's overlay may
27
+ * be written (persistent storage, never tmpfs), and where the native launcher
28
+ * binaries live (shipped in the extension). `binaries` absent — or not built for
29
+ * this platform — yields file isolation without a shell.
30
+ */
31
+ export interface DelegatedSandboxProvider {
32
+ /** The lead's workspace, read-only to every delegated agent. */
33
+ workspaceRoot: string;
34
+ /** The native command-sandbox binaries, when present for this platform. */
35
+ binaries?: SandboxBinaries;
36
+ /**
37
+ * Confine every agent's commands to its workspace copy and a temp folder.
38
+ * On unless `false` (the host's `subagentSandboxConfine`).
39
+ */
40
+ confine?: boolean;
41
+ /**
42
+ * A private overlay directory for the agent behind this spawning tool call.
43
+ * Distinct per call, and in persistent storage — copy-ups can be large, and
44
+ * tmpfs would lose them and pressure RAM.
45
+ */
46
+ overlayRootFor(toolCallId: string): string;
47
+ }
48
+ export interface DelegatedSandboxOptions {
49
+ /** The lead's workspace, read-only to the agent. */
50
+ workspaceRoot: string;
51
+ /** This agent's private overlay directory, in persistent host storage. */
52
+ overlayRoot: string;
53
+ /**
54
+ * The native command-sandbox binaries. Absent — or present but not built for
55
+ * this platform — means the agent gets file isolation but no shell.
56
+ */
57
+ binaries?: SandboxBinaries;
58
+ /** Confine the agent's commands to the workspace and temp; on unless `false`. */
59
+ confine?: boolean;
60
+ /**
61
+ * Executor tuning to carry over from the lead (timeouts, limits, shell). The
62
+ * overlay and the shell wrapper are set on top and win over anything here.
63
+ */
64
+ base?: DefaultExecutorsOptions;
65
+ }
66
+ export interface DelegatedSandboxSetup {
67
+ /** The sandbox, for the hand-back to the lead and for disposal. */
68
+ sandbox: AgentSandbox;
69
+ /** Pass straight to `createBuiltinTools({ executorOptions })`. */
70
+ executorOptions: DefaultExecutorsOptions;
71
+ /**
72
+ * Whether the agent has a shell. When false the caller passes
73
+ * `enableBash: false` so `run_commands` is left off the agent's tool list.
74
+ */
75
+ commandsEnabled: boolean;
76
+ }
77
+ export declare function setUpDelegatedSandbox(options: DelegatedSandboxOptions): Promise<DelegatedSandboxSetup>;
78
+ /** {@link setUpDelegatedSandbox} for a caller that cannot await. */
79
+ export declare function setUpDelegatedSandboxSync(options: DelegatedSandboxOptions): DelegatedSandboxSetup;
@@ -0,0 +1,186 @@
1
+ import type { AgentAdmissionController } from "./agent-admission";
2
+ /**
3
+ * Holds delegated agents to the number of requests their endpoint will serve.
4
+ *
5
+ * A local server queues a request that finds no free slot rather than refusing
6
+ * it, and says nothing while it does. Spawning four sub-agents against a
7
+ * one-slot Ollama does not run four agents: it runs one and leaves three
8
+ * waiting, and the run reads as slow rather than blocked. The team runtime
9
+ * already had a concurrency bound of its own (`maxConcurrentRuns`), so this
10
+ * exists for the other path -- `spawn_agent`, which the agent loop can issue
11
+ * several of in a single iteration, each running its sub-agent to completion
12
+ * inline with nothing between them and the server.
13
+ *
14
+ * Deliberately a queue and not a refusal. The waiting has to happen somewhere;
15
+ * doing it here means it happens once, in order, and can be said out loud,
16
+ * rather than inside a provider's socket where nothing can see it.
17
+ */
18
+ export interface AgentSlotGate {
19
+ /**
20
+ * Runs `task` when a slot is free. Slots are released on throw too.
21
+ *
22
+ * `admitted` is the task's to call on the agent's first output
23
+ * (`isAdmissionEvent`). Where the engine decides admission, that call is
24
+ * what lets the next agent start; a task that ends without calling it
25
+ * releases its turn to try all the same.
26
+ */
27
+ run<T>(task: (admitted: () => void) => Promise<T>): Promise<T>;
28
+ /** How many are running now. For diagnostics; never a scheduling input. */
29
+ active(): number;
30
+ /**
31
+ * Whether one more would be admitted right now, without taking anything.
32
+ *
33
+ * For a caller deciding whether to launch, where the launch itself will go
34
+ * through {@link run} and do the real acquiring — a consuming probe here
35
+ * would book every worker twice. `true` where there is no admission
36
+ * control to ask, which is the same reading the rest of this file takes: a
37
+ * question that cannot be asked has not been answered no.
38
+ */
39
+ canAdmitMore(): Promise<boolean>;
40
+ }
41
+ export interface AgentSlotGateOptions {
42
+ /**
43
+ * Whether this endpoint's engine admits agents itself (opencoti or xOllama
44
+ * with PolyKV pools). Asked on each start of an uncapped gate; where it
45
+ * answers yes, one agent at a time waits for admission (see `run`).
46
+ * Absent or no: every agent starts at once.
47
+ */
48
+ paced?: () => Promise<boolean>;
49
+ }
50
+ /**
51
+ * @param limit Most agents at once, or `undefined` for no gate of ours.
52
+ * @param admission The engine's own answer, where there is one.
53
+ *
54
+ * `undefined` is not "unlimited": it is the caller saying something else is
55
+ * deciding -- opencoti with PolyKV on, where admission control answers against
56
+ * measured KV headroom and counting slots here would refuse work the server
57
+ * would have taken.
58
+ *
59
+ * `admission` is that something else, made explicit. The two bounds measure
60
+ * different things and both apply: the slot count is what the endpoint will
61
+ * *serve* at once, the engine's answer is what the pool's KV will *hold*, and
62
+ * an agent starts only once both say yes. Asking before the spawn rather than
63
+ * absorbing the refusal after it is the better half of the same fix -- a
64
+ * request that is going to be refused is a request worth not sending.
65
+ */
66
+ export declare function createAgentSlotGate(limit: number | undefined, admission?: AgentAdmissionController, options?: AgentSlotGateOptions): AgentSlotGate;
67
+ /**
68
+ * Whether an endpoint with this bound can run a delegated agent *beside* the
69
+ * agent that asked for one.
70
+ *
71
+ * The gate above makes one-slot delegation safe; it does not make it useful. A
72
+ * spawned agent on a one-slot server runs after its parent's request rather
73
+ * than alongside it, so nothing finishes sooner and the model has spent a turn
74
+ * arranging it. Measured on a live transaction: the model sent
75
+ * `team_spawn_teammate`, the call was refused on its arguments, the model
76
+ * answered with `team_cleanup` and went back to editing -- three turns spent
77
+ * on a capability the endpoint never had.
78
+ *
79
+ * So the tools are not offered at all when the count says one. A tool a model
80
+ * can see is a tool it will try, and one that cannot help it is a distraction
81
+ * priced in turns.
82
+ *
83
+ * `undefined` is not one: it means no host resolved a count, and a host that
84
+ * has not been taught to ask keeps the behaviour it had. `0` is not one
85
+ * either -- that is the host saying admission control decides, which is
86
+ * opencoti with PolyKV, where agents share a KV pool and the server paces
87
+ * them.
88
+ */
89
+ /**
90
+ * Whether two delegated agents can actually run beside one another.
91
+ *
92
+ * The question the tools are offered on. It used to be asked of the session's
93
+ * one endpoint alone, which was right while there was only one place a
94
+ * delegated agent could go. Agent nodes made that false: two nodes serving one
95
+ * request each serve two at once, and reading only the session's count withheld
96
+ * `spawn_agent` and the team tools from exactly the configuration that exists
97
+ * to run them in parallel. Measured on a live run — two nodes configured, the
98
+ * tools absent, and the model falling back to `create_agent`, which writes an
99
+ * agent definition file and runs nothing.
100
+ */
101
+ export declare function delegationCanRunInParallel(input: {
102
+ maxConcurrentAgents: number | undefined;
103
+ nodes?: ReadonlyArray<{
104
+ capacity: number;
105
+ }>;
106
+ }): boolean;
107
+ /**
108
+ * Whether the configured nodes together have room for more than one agent.
109
+ *
110
+ * `0` is a node that is off and contributes nothing; `Infinity` is an endpoint
111
+ * that decides its own admission and settles the question on its own. Anything
112
+ * else adds up.
113
+ */
114
+ export declare function agentNodesAllowParallelDelegation(nodes: ReadonlyArray<{
115
+ capacity: number;
116
+ }> | undefined): boolean;
117
+ /** Whether one endpoint on its own serves more than one request at a time. */
118
+ export declare function slotsAllowParallelDelegation(maxConcurrentAgents: number | undefined): boolean;
119
+ /**
120
+ * The endpoint two agents share, or do not.
121
+ *
122
+ * Provider and base URL together, because a provider id alone says nothing
123
+ * about which server: two profiles both naming `ollama` may point at a machine
124
+ * each. Lower-cased, and the trailing slash dropped, so a base URL that differs
125
+ * only in those is one endpoint rather than two.
126
+ */
127
+ export declare function agentEndpointKey(connection: {
128
+ providerId?: string;
129
+ baseUrl?: string;
130
+ }): string;
131
+ /**
132
+ * Host-supplied bounds, keyed the way the gates are keyed.
133
+ *
134
+ * The host names connections; only this file knows that a trailing slash and a
135
+ * capital letter do not make a second server. First entry wins, so a caller may
136
+ * put the specific answers first -- a profile carries its own count, and the
137
+ * shared provider entry answers for every profile that does not.
138
+ */
139
+ export declare function agentSlotLimitsByEndpoint(entries: ReadonlyArray<{
140
+ providerId?: string;
141
+ baseUrl?: string;
142
+ limit: number;
143
+ }> | undefined): Record<string, number> | undefined;
144
+ /**
145
+ * A gate per endpoint, from one bound.
146
+ *
147
+ * The single gate above was written when every delegated agent ran on the
148
+ * session's connection, and its own comment says so -- "they all read this
149
+ * provider". That stopped being true when a configured agent gained
150
+ * `providerId`, and again when it gained `profile:`. Agents on a cloud
151
+ * provider and agents on a local one would otherwise contend for the same
152
+ * slots, so a one-slot Ollama serialises work that was never going near it.
153
+ *
154
+ * The bound is applied per endpoint rather than shared because that is what it
155
+ * measures: how many requests *that server* will serve at once. Which also
156
+ * means one number cannot answer for all of them: an agent whose profile names
157
+ * a four-slot server was held to the lead's one, and the three slots it was
158
+ * entitled to went unused while its siblings queued. So the host may hand over
159
+ * a bound per endpoint as well, and the session's stays the answer for every
160
+ * endpoint it did not name -- conservative in the right direction, since it
161
+ * never over-subscribes a server it knows nothing about.
162
+ */
163
+ export interface AgentSlotGateRegistry {
164
+ /** The gate for one endpoint, created on first use and kept. */
165
+ for(key: string): AgentSlotGate;
166
+ /** The bound this endpoint's gate was built with. Diagnostics only. */
167
+ limitFor(key: string): number | undefined;
168
+ /** How many are running across every endpoint. Diagnostics only. */
169
+ active(): number;
170
+ }
171
+ /**
172
+ * @param limit The bound for an endpoint the host said nothing about.
173
+ * @param limits A bound per {@link agentEndpointKey}, from the host.
174
+ * @param admissionFor The engine's own answer for an endpoint that has one.
175
+ *
176
+ * `limits` is consulted before `limit`, and `0` in it is honoured rather than
177
+ * treated as absent: zero is the host saying admission control decides for that
178
+ * endpoint, which is a different statement from having no answer for it.
179
+ *
180
+ * `admissionFor` is asked once per endpoint, when that endpoint's gate is
181
+ * first built, and returning `undefined` is the ordinary case -- only opencoti
182
+ * with a pool has anything to ask. It is keyed by endpoint for the same reason
183
+ * the bound is: a pool belongs to one server, and an agent whose profile points
184
+ * at another must not be held against it.
185
+ */
186
+ export declare function createAgentSlotGateRegistry(limit: number | undefined, limits?: Readonly<Record<string, number>>, admissionFor?: (key: string) => AgentAdmissionController | undefined, pacedFor?: (key: string) => AgentSlotGateOptions["paced"]): AgentSlotGateRegistry;
@@ -0,0 +1,84 @@
1
+ /**
2
+ * `agents_status`: what the lead's agents are doing, and why.
3
+ *
4
+ * Read-only, and offered in every mode the lead can be in -- its own turn
5
+ * beside a background round, the side turn while a blocking round runs, and
6
+ * an escalation's expert (spec B, rulings 3 and 6). Three shapes:
7
+ *
8
+ * - no arguments: a summary -- per round, how many agents are in each state
9
+ * and for how long the round has run; per node, what it runs, whether it
10
+ * answers, how full it is, its admission policy and recent refusals, and
11
+ * the retry policy in words;
12
+ * - `round_id`: one line per agent of that round;
13
+ * - `agent_id` (or several): an agent in detail -- its state and the reason
14
+ * for it, node, model, window, tokens, speed, iterations against its cap,
15
+ * compactions by cause, sampler, the oracle's verdict, the tail of its
16
+ * output and of its activity, and its errors with their class.
17
+ *
18
+ * Bounded: never a transcript, and never more than {@link STATUS_MAX_CHARS}.
19
+ * Everything it says comes from what is already known -- the round records,
20
+ * the placement queue, and the last `/kv` read the compaction trigger made.
21
+ * It never asks a server anything.
22
+ */
23
+ import { type AgentTool, type TeamMemberSnapshot, type TeamRunRecord } from "@cerebriline/shared";
24
+ import { type AgentRounds, type AgentRunState, type RoundAgentRecord, type RoundRecord } from "./agent-rounds";
25
+ import type { DelegatedAgentConfigProvider } from "./delegated-agent";
26
+ export declare const AGENTS_STATUS_TOOL_NAME = "agents_status";
27
+ /** The most a status answer may take. */
28
+ export declare const STATUS_MAX_CHARS = 12000;
29
+ /**
30
+ * How the harness treats infrastructure trouble, in words, for the lead:
31
+ * it must not try to route around a node itself (ruling 1).
32
+ */
33
+ export declare const RETRY_POLICY_TEXT: string;
34
+ /** A teammate, as the team runtime reports it. */
35
+ export interface TeammateStatusSource {
36
+ members: TeamMemberSnapshot[];
37
+ runs: TeamRunRecord[];
38
+ }
39
+ export interface AgentsStatusOptions {
40
+ sessionId: string;
41
+ /** The session's delegated connection: its nodes, or its single endpoint. */
42
+ configProvider?: () => DelegatedAgentConfigProvider | undefined;
43
+ /** The team, when the session has teammates. */
44
+ teammates?: () => TeammateStatusSource | undefined;
45
+ now?: () => number;
46
+ }
47
+ export declare function formatDuration(ms: number): string;
48
+ /**
49
+ * What the status knows beyond one record: where each node is and what its
50
+ * compaction threshold is, the order of the placement queue, and how fast
51
+ * agents have been finishing. Built once per call.
52
+ */
53
+ export interface StatusContext {
54
+ /** By node id ("" for the session's single connection). */
55
+ nodes: Map<string, {
56
+ baseUrl?: string;
57
+ threshold: number;
58
+ polykv: boolean;
59
+ }>;
60
+ /** Agent id -> its place in the placement queue, 1-based, and the length. */
61
+ queue: Map<string, number>;
62
+ queueLength: number;
63
+ /** Agents of this session that ended in the last five minutes. */
64
+ finishedRecently: number;
65
+ }
66
+ /** Build the context once per status call. */
67
+ export declare function buildStatusContext(rounds: AgentRounds, provider: DelegatedAgentConfigProvider | undefined, now: number): StatusContext;
68
+ /** Why an agent is where it is, in words (ruling 6). */
69
+ export declare function describeReason(agent: RoundAgentRecord, state: AgentRunState, now: number): string;
70
+ /** The nodes block of the summary. */
71
+ export declare function describeNodes(provider: DelegatedAgentConfigProvider | undefined, now: number): string[];
72
+ /** The whole summary: rounds, nodes, retry policy, teammates. */
73
+ export declare function describeSummary(rounds: AgentRounds, options: Omit<AgentsStatusOptions, "sessionId">): string;
74
+ /** One line per agent of a round. */
75
+ export declare function describeRound(round: RoundRecord, now: number, ctx?: StatusContext): string;
76
+ /** One agent in full: everything ruling 6 and spec B ask for, bounded. */
77
+ export declare function describeAgent(round: RoundRecord, agent: RoundAgentRecord, now: number, ctx?: StatusContext): string;
78
+ export declare function renderAgentsStatus(input: {
79
+ agent_id?: string;
80
+ agent_ids?: string[];
81
+ round_id?: string;
82
+ }, options: AgentsStatusOptions): string;
83
+ export declare const AGENTS_STATUS_DESCRIPTION: string;
84
+ export declare function createAgentsStatusTool(options: AgentsStatusOptions): AgentTool;
@@ -0,0 +1,91 @@
1
+ import { type TurnFaultWait } from "./turn-fault-recovery";
2
+ /** Continuous waiting after which the lead is told about an agent. */
3
+ export declare const LEAD_NUDGE_AFTER_MS: number;
4
+ /**
5
+ * Continuous waiting after which an agent counts as having no node to run on,
6
+ * and the lead is asked to decide instead of waiting on.
7
+ */
8
+ export declare const NO_NODE_AFTER_MS: number;
9
+ /**
10
+ * How long the first overdue agent waits for others to join its report.
11
+ *
12
+ * A round of agents on one node goes wrong together: 75 agents crossing the
13
+ * line within a minute of each other are one report, not 75 side turns.
14
+ */
15
+ export declare const LEAD_NUDGE_BATCH_MS = 30000;
16
+ /**
17
+ * How a nudge waits for the lead: `awaiting` for the agents-waiting-on-you
18
+ * notice (one replaces another), and a `refresh` that rewrites it as it is
19
+ * read, or drops it once it no longer applies.
20
+ */
21
+ export interface LeadNudgeOptions {
22
+ noteKind?: "awaiting" | "queued";
23
+ refresh?: () => string | undefined;
24
+ /**
25
+ * Nothing in it asks the lead to decide anything, so it does not end a
26
+ * wait on the agents: it is read with whatever ends that wait next. In
27
+ * wlafh r3 three "queued, not broken: wait for them" notes each ended an
28
+ * `await_agents` that the lead could only call again.
29
+ */
30
+ quiet?: boolean;
31
+ }
32
+ /** Per-session listener: whoever can put a message in front of the lead. */
33
+ type LeadNudgeListener = (text: string, options?: LeadNudgeOptions) => void;
34
+ /**
35
+ * Receive the nudges for a session's lead. One listener per session: the
36
+ * host that owns the lead. Returns the unsubscribe.
37
+ */
38
+ export declare function onLeadNudge(sessionId: string, listener: LeadNudgeListener): () => void;
39
+ /** Whether a host is listening for this session's lead: a side turn or a queue. */
40
+ export declare function leadCanBeReached(sessionId: string): boolean;
41
+ /** Put a message in front of the lead. `false` when no host is listening. */
42
+ export declare function sendLeadNudge(sessionId: string, text: string, options?: LeadNudgeOptions): boolean;
43
+ interface TroubleRecord {
44
+ name: string;
45
+ /** Start of the current stretch of waiting. */
46
+ since: number;
47
+ kind: TurnFaultWait["kind"];
48
+ where: string;
49
+ detail: string;
50
+ /** Refusals in the current stretch. */
51
+ refusals: number;
52
+ /** Told the lead already; never twice for one agent. */
53
+ nudged: boolean;
54
+ /** Told the lead it has had no node for hours; never twice either. */
55
+ escalated: boolean;
56
+ }
57
+ /** One agent's line in the lead's report. */
58
+ export declare function describeTrouble(record: Pick<TroubleRecord, "name" | "since" | "kind" | "where" | "detail" | "refusals">, now: number): string;
59
+ /** The whole report, as the lead reads it. */
60
+ export declare function describeLeadNudge(records: ReadonlyArray<Pick<TroubleRecord, "name" | "since" | "kind" | "where" | "detail" | "refusals">>, now: number): string;
61
+ /** The second report: these agents have had nowhere to run for hours. */
62
+ export declare function describeNoNodeNudge(records: ReadonlyArray<Pick<TroubleRecord, "name" | "since" | "kind" | "where" | "detail" | "refusals">>, now: number, afterMs?: number): string;
63
+ /** A wait the engine's fetch reported (`onPolykvRoomWait`), as a trouble. */
64
+ export declare function roomWaitTrouble(reason: string | undefined): TurnFaultWait;
65
+ export interface AgentTroubleWatch {
66
+ /** The agent is waiting on this; starts or continues a stretch. */
67
+ waiting(state: TurnFaultWait): void;
68
+ /** The engine produced something for the agent: the stretch is over. */
69
+ progressed(): void;
70
+ /** The agent ended. */
71
+ dispose(): void;
72
+ }
73
+ export interface AgentTroubleWatchOptions {
74
+ /** The lead's session; absent means nobody to tell, and nothing is kept. */
75
+ sessionId?: string;
76
+ /** The agent's name, as the round and `stop_agents` call it. */
77
+ name: string;
78
+ /** Seams for tests. */
79
+ now?: () => number;
80
+ nudgeAfterMs?: number;
81
+ noNodeAfterMs?: number;
82
+ batchMs?: number;
83
+ /** Where the report goes; defaults to the session's lead listener. */
84
+ send?: (sessionId: string, text: string, options?: LeadNudgeOptions) => boolean;
85
+ /** For when no lead could be reached: the log still says it. */
86
+ logger?: {
87
+ log: (message: string) => void;
88
+ };
89
+ }
90
+ export declare function createAgentTroubleWatch(options: AgentTroubleWatchOptions): AgentTroubleWatch;
91
+ export {};
@@ -0,0 +1,106 @@
1
+ /**
2
+ * Delegations the user started and then went back to work.
3
+ *
4
+ * `delegateToConfiguredAgent` runs an agent and returns its answer, which is
5
+ * the right shape for "run the QA agent on this and tell me". It is the wrong
6
+ * shape for the reason people ask for it: the lead is blocked for as long as
7
+ * the delegated run takes, and pressing stop on the lead takes the delegation
8
+ * down with it. A run the user asked for should outlive the turn they asked in.
9
+ *
10
+ * So a background run is held here rather than on the turn. The registry owns
11
+ * the three things such a run needs and a promise does not have: a way to be
12
+ * paused, a way to be stopped, and a status somebody can render.
13
+ *
14
+ * Deliberately ignorant of how an agent runs. It is handed a `run` function and
15
+ * gives it back the controls; the caller wires those into whatever it is
16
+ * running. That keeps the delegation path -- provider resolution, the endpoint
17
+ * slot gate, the per-agent tool filtering -- exactly the one the synchronous
18
+ * path already uses, instead of a second copy of it that drifts.
19
+ */
20
+ import type { AgentHooks } from "@cerebriline/shared";
21
+ import { type ConfiguredAgentDelegationResult, type DelegateToConfiguredAgentInput } from "./delegate-to-agent";
22
+ export type BackgroundDelegationStatus = "running" | "paused" | "completed" | "failed"
23
+ /** The user stopped it. Not a failure, and not to be reported as one. */
24
+ | "stopped";
25
+ export interface BackgroundDelegationView {
26
+ id: string;
27
+ agentName: string;
28
+ prompt: string;
29
+ status: BackgroundDelegationStatus;
30
+ startedAt: number;
31
+ endedAt?: number;
32
+ /** The last thing worth putting on a one-line row. */
33
+ activity?: string;
34
+ /** Turns taken so far, so a row can show progress and not just elapsed time. */
35
+ iterations?: number;
36
+ result?: ConfiguredAgentDelegationResult;
37
+ error?: string;
38
+ }
39
+ export interface BackgroundDelegationControls {
40
+ runId: string;
41
+ /** Aborted when the user stops the run. */
42
+ signal: AbortSignal;
43
+ /**
44
+ * Hooks that suspend the run while it is paused.
45
+ *
46
+ * The barrier is in `beforeModel`, which the runtime awaits before every
47
+ * request, so a paused run stops between requests and never mid-stream.
48
+ * Pausing does not cancel the request already in flight -- that would throw
49
+ * away work the user has paid for and asked to keep.
50
+ */
51
+ hooks: AgentHooks;
52
+ /**
53
+ * Where the run hands over the release of its engine session. A pause
54
+ * calls it -- a paused run must not hold a booked window for as long as
55
+ * the user leaves it -- and the resume waits for that close to land, so
56
+ * the next request books afresh rather than racing it.
57
+ */
58
+ bindEngineSession: (release: () => Promise<unknown>) => void;
59
+ }
60
+ export interface StartBackgroundDelegationInput {
61
+ agentName: string;
62
+ prompt: string;
63
+ run: (controls: BackgroundDelegationControls) => Promise<ConfiguredAgentDelegationResult>;
64
+ /**
65
+ * Called once when the run has finished, failed or been stopped.
66
+ *
67
+ * This is where a host delivers the answer back into the conversation. It
68
+ * runs outside the lead's turn by definition, so it must not assume there is
69
+ * one.
70
+ */
71
+ onSettled?: (view: BackgroundDelegationView) => void;
72
+ }
73
+ export interface BackgroundDelegationRegistry {
74
+ /** Starts the run and returns immediately. */
75
+ start(input: StartBackgroundDelegationInput): BackgroundDelegationView;
76
+ list(): BackgroundDelegationView[];
77
+ get(id: string): BackgroundDelegationView | undefined;
78
+ /** @returns whether there was a running run to pause. */
79
+ pause(id: string): boolean;
80
+ /** @returns whether there was a paused run to resume. */
81
+ resume(id: string): boolean;
82
+ /** @returns whether there was a live run to stop. */
83
+ stop(id: string): boolean;
84
+ /** Records what the run is doing, for the panel. */
85
+ note(id: string, activity: string): void;
86
+ /** Every change, for a panel that redraws. Returns an unsubscribe. */
87
+ subscribe(listener: (runs: BackgroundDelegationView[]) => void): () => void;
88
+ /** Stops everything. For a host tearing the session down for good. */
89
+ stopAll(): void;
90
+ }
91
+ export declare function createBackgroundDelegationRegistry(options?: {
92
+ now?: () => number;
93
+ newId?: () => string;
94
+ }): BackgroundDelegationRegistry;
95
+ /**
96
+ * Start a configured agent in the background, on the same path the foreground
97
+ * one runs down.
98
+ *
99
+ * The agent name is checked here rather than inside the run, so a typo is an
100
+ * error at the prompt where it was typed instead of a background run that
101
+ * appears in the panel and immediately fails. Every other failure belongs to
102
+ * the run and is reported there.
103
+ */
104
+ export declare function startBackgroundDelegation(registry: BackgroundDelegationRegistry, input: Omit<DelegateToConfiguredAgentInput, "signal" | "hooks" | "bindEngineSession"> & {
105
+ onSettled?: (view: BackgroundDelegationView) => void;
106
+ }): BackgroundDelegationView;