@sema-agent/core 5.19.0 → 5.21.0

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 (329) hide show
  1. package/CHANGELOG.md +102 -4
  2. package/dist/agents/agent-definition.d.ts +7 -0
  3. package/dist/agents/agent-transcript-tool.d.ts +30 -0
  4. package/dist/agents/builtin-agents.d.ts +60 -0
  5. package/dist/agents/cascade.d.ts +107 -0
  6. package/dist/agents/cumulative-stats.d.ts +56 -0
  7. package/dist/agents/observer.d.ts +162 -0
  8. package/dist/agents/peer-admission.d.ts +95 -0
  9. package/dist/agents/repair-loop.d.ts +226 -0
  10. package/dist/agents/retain-ledger.d.ts +141 -0
  11. package/dist/agents/roster-store.d.ts +105 -0
  12. package/dist/agents/roster-store.js +3 -0
  13. package/dist/agents/send-message-tool.d.ts +92 -0
  14. package/dist/agents/session-util.d.ts +5 -0
  15. package/dist/agents/subagent-steps.d.ts +66 -0
  16. package/dist/agents/subagent.d.ts +600 -0
  17. package/dist/agents/suspend-guard.d.ts +29 -0
  18. package/dist/agents/teacher.d.ts +75 -0
  19. package/dist/agents/team.d.ts +120 -1
  20. package/dist/agents/tool-filter.d.ts +34 -0
  21. package/dist/agents/verify.d.ts +198 -0
  22. package/dist/bench/metrics.d.ts +455 -0
  23. package/dist/brain/anthropic.d.ts +30 -0
  24. package/dist/brain/circuit-breaker.d.ts +33 -0
  25. package/dist/brain/circuit-breaker.js +14 -3
  26. package/dist/brain/context-overflow.d.ts +60 -3
  27. package/dist/brain/degrading.d.ts +67 -0
  28. package/dist/brain/errors.d.ts +42 -0
  29. package/dist/brain/failover.d.ts +15 -0
  30. package/dist/brain/media-degrade.d.ts +39 -0
  31. package/dist/brain/model-presets.d.ts +31 -0
  32. package/dist/brain/open-responses.d.ts +19 -0
  33. package/dist/brain/openai.d.ts +46 -0
  34. package/dist/brain/reasoning.d.ts +106 -1
  35. package/dist/brain/repetition.d.ts +83 -0
  36. package/dist/brain/request-params.d.ts +56 -0
  37. package/dist/brain/retry.d.ts +46 -0
  38. package/dist/brain/routing.d.ts +12 -0
  39. package/dist/brain/status-sink.d.ts +30 -1
  40. package/dist/brain/stream-engine.d.ts +147 -0
  41. package/dist/brain/stream-shared.d.ts +34 -0
  42. package/dist/brain/terminal-cause.d.ts +31 -0
  43. package/dist/brain/timeout.d.ts +108 -0
  44. package/dist/brain/timeout.js +11 -0
  45. package/dist/brain/tool-call-id.d.ts +20 -0
  46. package/dist/brain/tool-call-repair.d.ts +13 -0
  47. package/dist/config/catalog.d.ts +47 -0
  48. package/dist/config/defaults.d.ts +33 -0
  49. package/dist/core/a2a-task-state.d.ts +53 -0
  50. package/dist/core/a2a.d.ts +51 -0
  51. package/dist/core/arg-summary.d.ts +62 -0
  52. package/dist/core/ask-question.d.ts +272 -2
  53. package/dist/core/auto-compaction.d.ts +467 -0
  54. package/dist/core/auto-compaction.js +20 -6
  55. package/dist/core/auto-mode-prompt-assets.d.ts +8 -0
  56. package/dist/core/auto-mode-prompt.d.ts +27 -0
  57. package/dist/core/auto-mode.d.ts +54 -3
  58. package/dist/core/auto-promote.d.ts +100 -0
  59. package/dist/core/background-agent-store.d.ts +293 -0
  60. package/dist/core/background-agent-store.js +5 -0
  61. package/dist/core/background-shell.d.ts +110 -0
  62. package/dist/core/cache-break-detector.d.ts +34 -0
  63. package/dist/core/canonical-json.d.ts +57 -0
  64. package/dist/core/checkpoint-store.d.ts +1574 -16
  65. package/dist/core/compliance.d.ts +30 -0
  66. package/dist/core/consolidate-scope.d.ts +75 -0
  67. package/dist/core/context-edit.d.ts +99 -0
  68. package/dist/core/context-guard.d.ts +46 -0
  69. package/dist/core/exec-gate.d.ts +44 -0
  70. package/dist/core/exec-output-tail.d.ts +61 -0
  71. package/dist/core/file-snapshot-store.d.ts +104 -0
  72. package/dist/core/fs-write-gate-policy.d.ts +36 -0
  73. package/dist/core/git-worktree-env.d.ts +31 -0
  74. package/dist/core/governance-codes.d.ts +19 -0
  75. package/dist/core/hooks.d.ts +609 -1
  76. package/dist/core/human-input-projection.d.ts +37 -0
  77. package/dist/core/human-input-projection.js +13 -0
  78. package/dist/core/image-downsample.d.ts +74 -0
  79. package/dist/core/locked-config.d.ts +37 -0
  80. package/dist/core/lsp-diagnostics.d.ts +77 -0
  81. package/dist/core/lsp-protocol.d.ts +29 -0
  82. package/dist/core/lsp-session.d.ts +60 -1
  83. package/dist/core/lsp.d.ts +150 -1
  84. package/dist/core/mailbox-store.d.ts +57 -0
  85. package/dist/core/mailbox-store.js +2 -0
  86. package/dist/core/mcp.d.ts +385 -0
  87. package/dist/core/mcp.js +58 -11
  88. package/dist/core/media-byte-cap.d.ts +21 -0
  89. package/dist/core/memory-admission.d.ts +71 -0
  90. package/dist/core/memory-engine/content-origin.d.ts +64 -0
  91. package/dist/core/memory-engine/data-plane.d.ts +43 -0
  92. package/dist/core/memory-engine/dual-root.d.ts +24 -0
  93. package/dist/core/memory-engine/engine.d.ts +230 -0
  94. package/dist/core/memory-engine/engine.js +103 -35
  95. package/dist/core/memory-engine/file-backend.d.ts +155 -0
  96. package/dist/core/memory-engine/frontmatter.d.ts +16 -0
  97. package/dist/core/memory-engine/layout.d.ts +217 -0
  98. package/dist/core/memory-engine/memory-backend-contract.d.ts +12 -0
  99. package/dist/core/memory-engine/migrate.d.ts +9 -0
  100. package/dist/core/memory-engine/scan.d.ts +12 -0
  101. package/dist/core/memory-engine/scope-contract.d.ts +61 -1
  102. package/dist/core/memory-engine/sync-client.d.ts +87 -0
  103. package/dist/core/memory-engine/sync.d.ts +60 -0
  104. package/dist/core/memory-engine/tools.d.ts +41 -0
  105. package/dist/core/memory-engine/types.d.ts +188 -0
  106. package/dist/core/memory-recall.d.ts +141 -0
  107. package/dist/core/memory-vector.d.ts +20 -0
  108. package/dist/core/memory.d.ts +458 -0
  109. package/dist/core/message-utils.d.ts +6 -0
  110. package/dist/core/oracle-isolation.d.ts +69 -0
  111. package/dist/core/permission-rule-consent.d.ts +138 -0
  112. package/dist/core/permission-rule-model.d.ts +122 -0
  113. package/dist/core/permission-rule-store.d.ts +119 -3
  114. package/dist/core/permission-rules.d.ts +87 -1
  115. package/dist/core/present-plan-tool.d.ts +20 -0
  116. package/dist/core/pricing.d.ts +26 -0
  117. package/dist/core/property-harness.d.ts +86 -0
  118. package/dist/core/protocol-naming.d.ts +38 -0
  119. package/dist/core/protocol-table.d.ts +61 -0
  120. package/dist/core/push-queue.d.ts +1 -0
  121. package/dist/core/remote-env.d.ts +383 -1
  122. package/dist/core/retention-policy.d.ts +40 -0
  123. package/dist/core/retention-policy.js +21 -0
  124. package/dist/core/retention.d.ts +51 -0
  125. package/dist/core/roles.d.ts +59 -0
  126. package/dist/core/runner/active-skill-scope.d.ts +34 -0
  127. package/dist/core/runner/assemble-result.d.ts +134 -0
  128. package/dist/core/runner/compaction-call-options.d.ts +97 -1
  129. package/dist/core/runner/grounding-signal.d.ts +10 -0
  130. package/dist/core/runner/image.d.ts +17 -0
  131. package/dist/core/runner/image.js +29 -15
  132. package/dist/core/runner/memory-consolidation.d.ts +60 -0
  133. package/dist/core/runner/prepare-memory.d.ts +59 -0
  134. package/dist/core/runner/prepare-task.d.ts +1011 -2
  135. package/dist/core/runner/prepare-task.js +51 -14
  136. package/dist/core/runner/prompt-suggestions.d.ts +7 -0
  137. package/dist/core/runner/runtask.d.ts +304 -3
  138. package/dist/core/runner/runtask.js +17 -2
  139. package/dist/core/runner/session-file-state-replay.d.ts +49 -0
  140. package/dist/core/runner/session-rule-policy.d.ts +58 -0
  141. package/dist/core/runner/strict-output-schema.d.ts +18 -3
  142. package/dist/core/runner/synthetic-tools.d.ts +113 -0
  143. package/dist/core/runner/teardown-bounded.d.ts +34 -0
  144. package/dist/core/runner/tool-disclosure.d.ts +227 -0
  145. package/dist/core/runner/tool-output-projection.d.ts +6 -0
  146. package/dist/core/runner/turn-attachments.d.ts +634 -0
  147. package/dist/core/runner/usage-accounting.d.ts +32 -0
  148. package/dist/core/runtime.d.ts +9 -0
  149. package/dist/core/safe-notify.d.ts +64 -0
  150. package/dist/core/safety-axis-vocab.d.ts +23 -0
  151. package/dist/core/safety-merge-corpus.d.ts +37 -0
  152. package/dist/core/scheduler.d.ts +121 -0
  153. package/dist/core/secret-env.d.ts +32 -0
  154. package/dist/core/select-model.d.ts +15 -0
  155. package/dist/core/sensitive-path-policy.d.ts +42 -0
  156. package/dist/core/session-policy-store.d.ts +94 -0
  157. package/dist/core/session-reconcile.d.ts +80 -0
  158. package/dist/core/session-store.d.ts +85 -0
  159. package/dist/core/session.d.ts +153 -0
  160. package/dist/core/shared-memory/contract.d.ts +22 -0
  161. package/dist/core/shared-memory/normalize.d.ts +123 -2
  162. package/dist/core/shared-memory/tools.d.ts +14 -0
  163. package/dist/core/shared-memory/types.d.ts +105 -0
  164. package/dist/core/shutdown-debug.d.ts +6 -0
  165. package/dist/core/side-query.d.ts +38 -0
  166. package/dist/core/side-query.js +6 -1
  167. package/dist/core/skill-tool-specifier.d.ts +72 -0
  168. package/dist/core/skills-directory.d.ts +100 -1
  169. package/dist/core/spec-contract.d.ts +89 -0
  170. package/dist/core/store-contracts/background-agent-store-contract.d.ts +31 -0
  171. package/dist/core/store-contracts/checkpoint-store-contract.d.ts +26 -0
  172. package/dist/core/store-contracts/contract-harness.d.ts +20 -0
  173. package/dist/core/store-contracts/contract-kit-version.d.ts +27 -0
  174. package/dist/core/store-contracts/file-snapshot-store-contract.d.ts +8 -0
  175. package/dist/core/store-contracts/mailbox-store-contract.d.ts +42 -0
  176. package/dist/core/store-contracts/tool-result-store-contract.d.ts +13 -0
  177. package/dist/core/strategy-store.d.ts +37 -0
  178. package/dist/core/stub-env.d.ts +7 -0
  179. package/dist/core/surrogate-safe-slice.d.ts +35 -0
  180. package/dist/core/task-notification.d.ts +202 -0
  181. package/dist/core/task-outcome.d.ts +53 -0
  182. package/dist/core/task-registry-agent.d.ts +337 -1
  183. package/dist/core/task-registry-agent.js +2 -0
  184. package/dist/core/task-registry-monitor.d.ts +12 -0
  185. package/dist/core/task-registry-shared.d.ts +540 -0
  186. package/dist/core/task-registry.d.ts +343 -0
  187. package/dist/core/task-registry.js +13 -2
  188. package/dist/core/task-tool-shape.d.ts +44 -0
  189. package/dist/core/tighten-task-spec.d.ts +21 -0
  190. package/dist/core/tool-detach.d.ts +21 -0
  191. package/dist/core/tool-errors.d.ts +131 -0
  192. package/dist/core/tool-errors.js +4 -0
  193. package/dist/core/tool-name-aliases.d.ts +27 -0
  194. package/dist/core/tool-policy.d.ts +555 -0
  195. package/dist/core/tool-policy.js +3 -0
  196. package/dist/core/tool-result-budget.d.ts +32 -0
  197. package/dist/core/tool-result-store.d.ts +174 -1
  198. package/dist/core/tools.d.ts +45 -0
  199. package/dist/core/trace.d.ts +323 -0
  200. package/dist/core/types.d.ts +3859 -2
  201. package/dist/core/untrusted-egress.d.ts +8 -0
  202. package/dist/core/untrusted-text.d.ts +156 -0
  203. package/dist/core/usage-window-store.d.ts +95 -0
  204. package/dist/core/version.d.ts +1 -0
  205. package/dist/core/warm-resume.d.ts +17 -0
  206. package/dist/core/wiring-manifest.d.ts +169 -0
  207. package/dist/core/with-retry.d.ts +24 -0
  208. package/dist/core/workflow-journal-store.d.ts +160 -0
  209. package/dist/core/workflow-run-store-contract.d.ts +25 -0
  210. package/dist/core/workflow-run-store.d.ts +119 -0
  211. package/dist/core/workflow-run-store.js +2 -0
  212. package/dist/engine/compaction/compaction.d.ts +256 -1
  213. package/dist/engine/compaction/utils.d.ts +94 -0
  214. package/dist/engine/execution-env/kill-tree.d.ts +29 -0
  215. package/dist/engine/execution-env/node-execution-env.d.ts +94 -0
  216. package/dist/engine/harness/agent-harness.d.ts +116 -0
  217. package/dist/engine/harness/agent-harness.js +3 -14
  218. package/dist/engine/harness/messages.d.ts +15 -0
  219. package/dist/engine/harness/types.d.ts +464 -2
  220. package/dist/engine/llm/diagnostics.d.ts +4 -0
  221. package/dist/engine/llm/event-stream.d.ts +3 -0
  222. package/dist/engine/llm/index.d.ts +7 -0
  223. package/dist/engine/llm/types.d.ts +500 -3
  224. package/dist/engine/llm/validation.d.ts +3 -0
  225. package/dist/engine/loop/agent-loop.d.ts +87 -2
  226. package/dist/engine/loop/runtime-deps.d.ts +7 -0
  227. package/dist/engine/loop/types.d.ts +424 -0
  228. package/dist/engine/lsp/frame-decoder.d.ts +13 -0
  229. package/dist/engine/lsp/node-lsp-manager.d.ts +107 -0
  230. package/dist/engine/lsp/stdio-lsp-transport.d.ts +7 -0
  231. package/dist/engine/session/import-validate.d.ts +27 -0
  232. package/dist/engine/session/log-digest.d.ts +93 -0
  233. package/dist/engine/session/memory-repo.d.ts +6 -0
  234. package/dist/engine/session/memory-storage.d.ts +2 -0
  235. package/dist/engine/session/session.d.ts +75 -0
  236. package/dist/engine/session/storage-base.d.ts +8 -0
  237. package/dist/fixtures/index.d.ts +36 -0
  238. package/dist/index.d.ts +17 -2
  239. package/dist/index.js +1 -2
  240. package/dist/internal/harness-types.d.ts +6 -0
  241. package/dist/internal/harness.d.ts +11 -0
  242. package/dist/internal/llm.d.ts +6 -0
  243. package/dist/orchestration/builtin-workflows.d.ts +53 -0
  244. package/dist/orchestration/dev-vm-script-runner.d.ts +19 -0
  245. package/dist/orchestration/goal.d.ts +57 -0
  246. package/dist/orchestration/goal.js +3 -0
  247. package/dist/orchestration/run-spec.d.ts +42 -0
  248. package/dist/orchestration/run-spec.js +4 -0
  249. package/dist/orchestration/run-workflow-tool.d.ts +169 -0
  250. package/dist/orchestration/workflow-governance.d.ts +61 -0
  251. package/dist/orchestration/workflow-meta.d.ts +28 -0
  252. package/dist/orchestration/workflow-observe.d.ts +60 -0
  253. package/dist/orchestration/workflow-primitives.d.ts +23 -1
  254. package/dist/orchestration/workflow-sandbox-conformance.d.ts +38 -0
  255. package/dist/orchestration/workflow-script-runner.d.ts +88 -0
  256. package/dist/orchestration/workflow-script-store.d.ts +98 -0
  257. package/dist/orchestration/workflow-size-guideline.d.ts +67 -0
  258. package/dist/orchestration/workflow-types.d.ts +169 -2
  259. package/dist/orchestration/workflow.d.ts +358 -0
  260. package/dist/orchestration/workflow.js +13 -2
  261. package/dist/prompt-assembly/artifact-store.d.ts +33 -0
  262. package/dist/prompt-assembly/artifact.d.ts +25 -0
  263. package/dist/prompt-assembly/assemble.d.ts +20 -0
  264. package/dist/prompt-assembly/composer.d.ts +29 -0
  265. package/dist/prompt-assembly/epoch.d.ts +55 -1
  266. package/dist/prompt-assembly/event-registry.d.ts +35 -0
  267. package/dist/prompt-assembly/explain.d.ts +12 -0
  268. package/dist/prompt-assembly/tool-catalog.d.ts +38 -0
  269. package/dist/prompt-assembly/turn-snapshot.d.ts +40 -0
  270. package/dist/prompt-assembly/types.d.ts +115 -0
  271. package/dist/prompts/coordinator.d.ts +27 -0
  272. package/dist/prompts/default.d.ts +539 -0
  273. package/dist/prompts/simple-sections.d.ts +45 -0
  274. package/dist/prompts/supervisor.d.ts +66 -0
  275. package/dist/scenarios/env.d.ts +28 -0
  276. package/dist/scenarios/full-body.d.ts +50 -0
  277. package/dist/scenarios/scenario-registry.d.ts +60 -0
  278. package/dist/scenarios/teacher-quickstart.d.ts +27 -0
  279. package/dist/server/http.d.ts +17 -0
  280. package/dist/stores/cc/lockfile.d.ts +6 -0
  281. package/dist/stores/cc/mailbox-store.d.ts +8 -0
  282. package/dist/stores/cc/roster-adapter.d.ts +4 -0
  283. package/dist/stores/cc/sidecar-transcript.d.ts +66 -0
  284. package/dist/stores/file/background-agent-store.d.ts +24 -0
  285. package/dist/stores/file/background-agent-store.js +2 -1
  286. package/dist/stores/file/checkpoint-store.d.ts +38 -0
  287. package/dist/stores/file/file-snapshot-store.d.ts +25 -0
  288. package/dist/stores/file/fs-atomic.d.ts +155 -0
  289. package/dist/stores/file/index.d.ts +89 -0
  290. package/dist/stores/file/mailbox-store.d.ts +36 -0
  291. package/dist/stores/file/mailbox-store.js +2 -0
  292. package/dist/stores/file/memory-store.d.ts +82 -0
  293. package/dist/stores/file/permission-rule-store.d.ts +79 -0
  294. package/dist/stores/file/session-policy-store.d.ts +28 -0
  295. package/dist/stores/file/session-store.d.ts +40 -0
  296. package/dist/stores/file/shared-ledger.d.ts +83 -0
  297. package/dist/stores/file/tool-result-store.d.ts +11 -0
  298. package/dist/stores/file/usage-window-store.d.ts +18 -0
  299. package/dist/stores/file/workflow-journal-store.d.ts +100 -0
  300. package/dist/stores/file/workflow-run-store.d.ts +11 -0
  301. package/dist/stores/file/workflow-run-store.js +2 -0
  302. package/dist/tools/fs/bash-readonly-classifier.d.ts +282 -0
  303. package/dist/tools/fs/encoding.d.ts +60 -0
  304. package/dist/tools/fs/fs-bash.d.ts +133 -0
  305. package/dist/tools/fs/fs-pdf.d.ts +28 -0
  306. package/dist/tools/fs/fs-search-tools.d.ts +5 -0
  307. package/dist/tools/fs/fs-shared.d.ts +360 -0
  308. package/dist/tools/fs/fs-write.d.ts +16 -0
  309. package/dist/tools/fs/gh-rate-limit.d.ts +22 -0
  310. package/dist/tools/fs/index.d.ts +79 -0
  311. package/dist/tools/fs/notebook.d.ts +56 -0
  312. package/dist/tools/fs/pdf.d.ts +70 -0
  313. package/dist/tools/fs/pdf.js +8 -2
  314. package/dist/tools/fs/repo-map.d.ts +10 -0
  315. package/dist/tools/fs/safety.d.ts +376 -0
  316. package/dist/tools/fs/search.d.ts +131 -0
  317. package/dist/tools/loop-tick.d.ts +24 -0
  318. package/dist/tools/monitor.d.ts +55 -0
  319. package/dist/tools/scheduler-tools.d.ts +51 -0
  320. package/dist/tools/sql-adapters.d.ts +18 -0
  321. package/dist/tools/sql.d.ts +25 -0
  322. package/dist/tools/task-list.d.ts +77 -0
  323. package/dist/tools/todo.d.ts +8 -0
  324. package/dist/tools/web.d.ts +184 -0
  325. package/dist/tools/web.js +32 -5
  326. package/dist/tools/worktree.d.ts +81 -0
  327. package/package.json +2 -2
  328. package/dist/tools/gitea-issue.d.ts +0 -13
  329. package/dist/tools/gitea-issue.js +0 -75
@@ -1,34 +1,128 @@
1
+ /** One persisted name→agent binding (the CC roster `members[{name, agentId}]` shape + sema access axes). */
1
2
  export interface RosterEntry {
3
+ /** The verbatim spawn name (display form; resolution runs over {@link normalizeAgentName}). */
2
4
  name: string;
5
+ /** The background agent's task id (`a…`). */
3
6
  agentId: string;
7
+ /** The retained child session id, when known — the cross-run resume address. */
4
8
  sessionId?: string;
9
+ /** The spawn's parent tool-call id (retain-ledger key), when known. */
5
10
  toolUseId?: string;
11
+ /** δ 批 [1498]⑦ — the ROOT host session of the delegation tree at spawn (recovery-face grouping
12
+ * key; equals the spawner's session at depth 1). Stored verbatim; no predicate arm consumes it
13
+ * yet (enumeration/recovery is the reader). */
6
14
  rootSessionId?: string;
15
+ /** design/151 S3b — the RESOLVED model id at spawn (revival lookup key; display/model-routing
16
+ * hints only, never a serialized spec). */
7
17
  model?: string;
18
+ /** Ruled 2026-08-05: the spawn requested a model word that did not bind — the row runs on its
19
+ * inherited default. Closed set, single member today; absent = bound normally (or no word). */
8
20
  modelFallback?: "inherit_no_tier_binding";
21
+ /** Spawn owner (task/session id) — consumers re-apply access checks against these two axes.
22
+ * β 批 A-2: REQUIRED (default-deny predicate; an axis-less row would be unreachable). */
9
23
  owner: string;
24
+ /** Spawn principal scope. β 批 A-2: REQUIRED (`"default"` is the single-tenant spelling). */
10
25
  scope: string;
26
+ /** codex R3 — mirrors the live registry's explicit session-scoping flag: session-ID owner matching
27
+ * is permitted ONLY when the spawn was session-scoped (TaskRegistry.canAccess parity — without
28
+ * the flag, a task-scoped agent that fell out of the live registry would become visible through
29
+ * the durable fallback to same-session callers the registry itself rejects). */
11
30
  sessionScoped?: boolean;
31
+ /** Registration wall-clock ms (latest-wins tiebreak, matching registry layer 0). */
12
32
  createdAt: number;
13
33
  }
34
+ /**
35
+ * The caller's access axes for a roster read — the SAME predicate the live task registry applies
36
+ * (`canAccess`): scope mismatch = invisible; then owner match, or session match. codex F3 (S1
37
+ * review): resolution MUST filter the candidate pool by access BEFORE the latest-wins reduce —
38
+ * reduce-then-check lets one tenant's newer same-name entry shadow (and thereby suppress) another
39
+ * tenant's older authorized binding. Implementations (incl. pg/tidb) apply this in the query.
40
+ */
14
41
  export interface RosterAccess {
15
42
  owner?: string;
16
43
  scope?: string;
17
44
  sessionId?: string;
18
45
  }
46
+ /** β 批 A-2 (clay 裁定 2026-07-22): DEFAULT-DENY both axes (TaskRegistry.canAccess byte-parity —
47
+ * the polarity split was the defect). Entries are written with both axes (spawn chain guarantees
48
+ * it; {@link RosterEntry} requires them), so a missing axis is a broken row, answered with a miss. */
19
49
  export declare function entryAccessible(e: RosterEntry, access: RosterAccess): boolean;
50
+ /**
51
+ * The roster persistence seam. All methods MAY be async (a pg-backed store is); core's two bundled
52
+ * implementations are synchronous. Implementations are ADVISORY infrastructure: a throwing store
53
+ * must never fault a spawn — callers wrap writes in try/catch and treat read errors as a miss.
54
+ *
55
+ * v1 honesty contract (RB-23): writes are FIRE-AND-FORGET from the spawn path — a named-spawn
56
+ * receipt does NOT acknowledge roster persistence, and a failed/lost async write degrades to a
57
+ * later `not_found`/`roster_only` miss (never a wrong answer). Acknowledged writes (outbox) are the
58
+ * DEPLOYMENT'S half: they need a durable spool + retry scheduling, which belongs to whoever owns
59
+ * the database connection lifecycle — core's advisory contract above is the library-side final form.
60
+ *
61
+ * RB-23② release semantics (settled): a roster row's lifetime follows ADDRESSABILITY — the durable
62
+ * session data behind `sessionId` — NOT the agent's running state and NOT the parent-run retain
63
+ * ledger. Core deliberately wires NO terminal-cleanup or retain-evict call into {@link
64
+ * RosterStore.releaseAgent}: retain is a parent-run-scoped cache (disposed with the run), while the
65
+ * roster exists precisely to outlive it; releasing at terminal would kill cross-run resolution, the
66
+ * store's whole purpose. The correct trigger is durable session DELETION, which happens on the
67
+ * deployment side — a deployment's session GC calls `releaseAgent` (or joins roster rows against
68
+ * session liveness in SQL). A stale row left behind costs only an honest downstream failure on
69
+ * resume (miss / `resume.evicted`-class error — never a wrong answer); {@link RosterGcOptions}
70
+ * `maxAgeMs` is the bounded-staleness backstop for deployments that want one (RB-23③), and
71
+ * {@link RosterGcOptions.maxEntries} the bounded-SIZE one (HRD-AGO-11). Both are OFF by default: a bundled
72
+ * store keeps every live (name, owner, scope) binding forever, so a deployment that spawns under a fresh owner
73
+ * per run grows one permanent row per spawn until it opts into a bound. That default is deliberate — an
74
+ * evicted row is a durable ADDRESS a caller can no longer reach — but it is the deployment's to change.
75
+ */
20
76
  export interface RosterStore {
77
+ /** Record (or supersede — latest-wins per normalized name is applied at READ time) a binding. */
21
78
  record(entry: RosterEntry): void | Promise<void>;
79
+ /** Resolve a name for a CALLER: filter by {@link RosterAccess} FIRST, then latest `createdAt`
80
+ * wins within the authorized pool (codex F3 filter-before-reduce). Undefined = miss. */
22
81
  resolve(name: string, access: RosterAccess): RosterEntry | undefined | Promise<RosterEntry | undefined>;
82
+ /** All live entries (diagnostics / deployment listing; order unspecified). */
23
83
  list(): RosterEntry[] | Promise<RosterEntry[]>;
84
+ /** Drop every binding for an agent id (agent stopped and unaddressable / deployment GC). */
24
85
  releaseAgent(agentId: string): void | Promise<void>;
25
86
  }
87
+ /**
88
+ * RB-23③ (settled): optional bounded-staleness GC for the bundled stores. `maxAgeMs` is a
89
+ * DEPLOYMENT knob because the right value is the deployment's durable-session retention horizon
90
+ * (align the two and a roster row can never outlive the address it points at) — core cannot know
91
+ * it, so the default is NO TTL (current behavior; the file store's upsert already bounds growth by
92
+ * live name cardinality, not spawn count). Semantics: an expired row is a MISS on every read
93
+ * (resolve/list) and is opportunistically dropped on the next write — same honesty class as every
94
+ * other degradation here (expired ⇒ miss, never a wrong answer). A pg-backed store implements the
95
+ * same two arms in SQL (`WHERE created_at > now() - ttl` + periodic delete).
96
+ */
26
97
  export interface RosterGcOptions {
98
+ /** RB-473 — disclosure channel for CONTAINED host-callback failures in this scope (the RB-463
99
+ * isolation primitive's bounded first-failure per site). Absent ⇒ failures are counted only. */
27
100
  onNotifyError?: (failure: import("../core/safe-notify.js").SafeNotifyFailure) => void;
28
101
  maxAgeMs?: number;
102
+ /**
103
+ * HRD-AGO-11 (opt-in) — hard cap on live rows in a bundled store. **Default: UNBOUNDED**, and deliberately
104
+ * so: the upsert domain is (normalized name, owner, scope), which bounds growth by LIVE NAME CARDINALITY
105
+ * only — a deployment that spawns `worker` under a FRESH owner per run (a per-task owner id is the common
106
+ * shape) accumulates one permanent row per spawn, and the file store rewrites the whole document on every
107
+ * write, so the cost is O(n²) over a deployment's lifetime. A blind default cap would be worse than the
108
+ * leak: a roster row IS a durable ADDRESS, and silently evicting one turns a live agent unaddressable
109
+ * (`not_found` on a name the caller legitimately holds). So the bound is the DEPLOYMENT's call — it is the
110
+ * only party that knows how many live addresses it needs — and this is how it says so.
111
+ *
112
+ * Policy when set: after each write, while the row count exceeds `maxEntries`, drop the row with the
113
+ * SMALLEST `createdAt` (oldest binding first; the row just written is by construction the newest, so a
114
+ * write never evicts itself). Every dropped row is reported to {@link onEvicted} — an evicted address is a
115
+ * capability the deployment loses, so it is never dropped in silence. Reads are unaffected (an evicted row
116
+ * is simply gone: an honest miss, never a wrong answer — the same honesty class as `maxAgeMs`).
117
+ *
118
+ * A pg/tidb-backed store implements the same shape in SQL (a windowed delete keyed on `created_at`).
119
+ */
29
120
  maxEntries?: number;
121
+ /** HRD-AGO-11 — called with each row dropped by the {@link maxEntries} cap (never for a normal upsert
122
+ * supersede). A throwing sink is swallowed: roster writes are advisory and must never fault a spawn. */
30
123
  onEvicted?: (entry: RosterEntry) => void;
31
124
  }
125
+ /** In-memory roster (the default): cross-turn within one process, gone on restart. */
32
126
  export declare class MemoryRosterStore implements RosterStore {
33
127
  private entries;
34
128
  private readonly maxAgeMs;
@@ -50,7 +144,14 @@ export declare class FileRosterStore implements RosterStore {
50
144
  reason: string;
51
145
  }) => void;
52
146
  });
147
+ /** RB-482 #25 (baggage class-4 ruling): the LENIENT read grade's swallow stays (a store fault must read as a
148
+ * miss on resolve/list — advisory layer), but it is no longer SILENT: an IO failure or corrupt
149
+ * document was indistinguishable from an honestly empty roster. Never fires on plain ENOENT. */
53
150
  private discloseCorrupt;
151
+ /** codex F4 — two read grades: MISSING file (ENOENT) is an honest empty roster, but a corrupt or
152
+ * transiently unreadable file must THROW on the mutation path — treating it as empty would let
153
+ * the next `record` atomically REPLACE the existing file with just one row (silent data loss).
154
+ * Read paths (resolve/list) degrade the throw to a miss via `lenient`. */
54
155
  private read;
55
156
  private write;
56
157
  record(entry: RosterEntry): void;
@@ -58,4 +159,8 @@ export declare class FileRosterStore implements RosterStore {
58
159
  list(): RosterEntry[];
59
160
  releaseAgent(agentId: string): void;
60
161
  }
162
+ /** design/147 S1c — advisory durable-roster write for a NAMED background spawn: never throws and never
163
+ * unhandled-rejects (sync or async store alike); a roster fault must not fault the spawn.
164
+ * design/157 A7 — moved from `agents/subagent.ts`: the semantics are roster's, not the delegation
165
+ * tool's (the signature already value-imports `RosterStore`/`RosterEntry` from this module). */
61
166
  export declare function recordRosterSpawn(roster: RosterStore | undefined, entry: RosterEntry, onError?: (err: unknown) => void): void;
@@ -1,4 +1,5 @@
1
1
  import { mkdirSync, readFileSync } from "node:fs";
2
+ import { assertRetentionPolicy } from "../core/retention-policy.js";
2
3
  import { atomicWriteFile } from "../stores/file/fs-atomic.js";
3
4
  import { dirname } from "node:path";
4
5
  import { normalizeAgentName } from "../core/task-registry.js";
@@ -50,6 +51,7 @@ export class MemoryRosterStore {
50
51
  maxAgeMs;
51
52
  gc;
52
53
  constructor(opts) {
54
+ assertRetentionPolicy("RosterStore", opts);
53
55
  this.maxAgeMs = opts?.maxAgeMs;
54
56
  this.gc = opts;
55
57
  }
@@ -78,6 +80,7 @@ export class FileRosterStore {
78
80
  gc;
79
81
  onCorruptRead;
80
82
  constructor(path, opts) {
83
+ assertRetentionPolicy("RosterStore", opts);
81
84
  this.path = path;
82
85
  this.maxAgeMs = opts?.maxAgeMs;
83
86
  this.gc = opts;
@@ -5,29 +5,76 @@ import { type ToolCtxEnricher } from "../core/tools.js";
5
5
  import { SubagentRetainLedger } from "./retain-ledger.js";
6
6
  import { type SubagentSteerHandle } from "./subagent.js";
7
7
  import { type PeerAdmissionConfig, type PeerInboundChainRef, type PeerSelfRef } from "./peer-admission.js";
8
+ /** Model-facing name of the background-agent continuation tool (CC 2.1.2xx `SendMessage`). */
8
9
  export declare const SEND_MESSAGE_TOOL_NAME = "SendMessage";
9
10
  export interface SendMessageToolOptions {
11
+ /** Runner used to execute the resumed child run (the design/122 resume face's delegation runner). */
10
12
  runner: Runner;
13
+ /** The unified task registry the background Agent lane registered its a* handles in. */
11
14
  registry: import("../core/task-registry.js").TaskRegistry;
15
+ /** design/122 D1 — the parent run's retain ledger (present only when `TaskSpec.retainSubagentSessions`
16
+ * opted in). Absent ⇒ the tool stays mounted but every call returns the honest not-retained text. */
12
17
  retain?: SubagentRetainLedger;
18
+ /** Registry access identity (mirrors TaskOutput's closure identity — the mount fills these). */
13
19
  owner?: string;
14
20
  scope?: string;
15
21
  sessionId?: string;
22
+ /** Deployment-level background-notify sink — the resumed run's completion rides the existing chain. */
16
23
  notify?: (n: TaskNotificationPayload, opts?: {
17
24
  priority?: "now" | "next" | "later";
18
25
  }) => void;
26
+ /** Steer-handle sink: the revived run re-emits a FRESH handle (design/122 risk-table contract). */
19
27
  sink?: (handle: SubagentSteerHandle) => void;
28
+ /**
29
+ * design/147 S1a — the PARENT run's notification injector (RunInternals.parentNotify), present only
30
+ * when THIS run is a delegated child. Enables the "main" uplink: SendMessage("main", …) lands in the
31
+ * parent's injection queue as a `background_agent`/`event` frame at a turn boundary. Absent ⇒ the
32
+ * honest placeholder text stays.
33
+ */
20
34
  uplink?: (n: TaskNotificationPayload, opts?: {
21
35
  priority?: "now" | "next" | "later";
22
36
  }) => void;
37
+ /** design/147 S1a — this run's own spawn name (teammate identity) for uplink attribution. */
23
38
  senderName?: string;
39
+ /** design/147 S1c — the deployment's durable roster, consulted after the live registry misses. */
24
40
  roster?: import("./roster-store.js").RosterStore;
41
+ /** design/147 S3a (codex F2) — the PARENT run's retain ledger (RunInternals.parentRetainLedger):
42
+ * the sibling leg's retain entries live there. Consulted AFTER the own-run and session ledgers. */
25
43
  siblingRetain?: SubagentRetainLedger;
44
+ /** RB-390 — the SPAWNING run's taskId when THIS run is a delegated child (RunInternals.parentTaskId,
45
+ * mount-filled from the trusted internals chain — never a model argument). Historically the ONLY
46
+ * way this fact could reach a first-party mount: the adapter handed a `defineTool` product's body
47
+ * just `{toolCallId, signal}`, so `ctx.parentTaskId` never arrived and the design/147 S3a sibling
48
+ * legs (byName parent-view retry, tier-3 parent view) were dead on every auto-mounted child run —
49
+ * teammates could not reach each other by name ("no agent matches" while the parent's view
50
+ * resolved fine). RB-409 opened the ctx route as well ({@link enrichCtx}), and the Runner mount
51
+ * fills BOTH from the same internals chain; this seat remains the fallback (and the only route for
52
+ * a host that wires the tool itself). A `ctx.parentTaskId` wins when present. SendMessage ONLY —
53
+ * the TaskStop/TaskOutput mounts deliberately have no such seat (no widening of the kill/read
54
+ * surface). */
26
55
  parentTaskId?: string;
56
+ /** RB-390 — companion session axis of {@link parentTaskId} (RunInternals.parentSessionId): a
57
+ * session-scoped sibling registers with owner = the parent's sessionId, which the parent's
58
+ * taskId alone cannot satisfy when the two differ (same rationale as ToolExecuteContext.parentSessionId). */
27
59
  parentSessionId?: string;
60
+ /** [1358] the process-level background-child observer (RunnerDeps.onBackgroundChildEvent) — the
61
+ * mount fills this so a SendMessage resume re-emits the spawn→tick→terminal family (fleet row
62
+ * revival). Rides the OPTS closure like notify; RB-409's {@link enrichCtx} feeds the ctx twin. */
28
63
  onBackgroundChildEvent?: (event: import("../core/types.js").BackgroundChildEvent) => void;
64
+ /** design/151 §7 S3c — the durable execution-row ledger ({@link RunnerDeps.backgroundAgentStore}):
65
+ * the tier-3 resolution rung (exact a* handle / roster name → durable row) and the claim-CAS
66
+ * target. Tier-3 activates only when THIS + {@link mailbox} + {@link reviveSpawn} are all
67
+ * present; anything less keeps the pre-S3c honest refusal texts byte for byte. */
29
68
  agentStore?: import("../core/background-agent-store.js").BackgroundAgentStore;
69
+ /** design/151 §7.1 — the durable mailbox ({@link RunnerDeps.mailboxStore}): a message is parked
70
+ * here ONLY on the claim-winner path (append after the row CAS is won), consumed via
71
+ * claim/lease + ack at spawn success — never a destructive drain. */
30
72
  mailbox?: import("../core/mailbox-store.js").MailboxStore;
73
+ /** design/151 §6.3 案 B — the trusted revival spawner: prepare-task wraps the MOUNTED delegation
74
+ * tool's execute (object identity via the `agentListing` marker — never wire-name lookup, so a
75
+ * caller's same-named shadow tool can never receive the trusted claim) with a fresh toolCallId
76
+ * and `ctx.reviveClaim`. The revival is thereby the FULL spawn chain (observer frames, durable
77
+ * lane re-arm, notify, park semantics) — nothing re-implemented here. */
31
78
  reviveSpawn?: (req: {
32
79
  row: import("../core/background-agent-store.js").BackgroundAgentRecord;
33
80
  rev: number;
@@ -40,14 +87,59 @@ export interface SendMessageToolOptions {
40
87
  content: string;
41
88
  details?: unknown;
42
89
  }>;
90
+ /** RB-473 batch 2b — bounded disclosure for a deployment sink throwing inside the resume face's
91
+ * isolation scope (threaded into {@link createSubagentResume}); absent = counted only. */
43
92
  onNotifyError?: (failure: import("../core/safe-notify.js").SafeNotifyFailure) => void;
93
+ /**
94
+ * RB-409 — the mount's per-call ctx builder, forwarded to {@link defineTool} (see
95
+ * {@link ToolCtxEnricher}). This tool is a `defineTool` PRODUCT, so before this seat existed its
96
+ * body could only ever see `{toolCallId, signal}` and every `ctx.*` read below fell to its `opts`
97
+ * fallback — the ctx-first arms were structurally dead on the first-party mount. The Runner mount
98
+ * now passes its own trusted ctx builder here (the SAME one it applies to `spec.tools` tools), so
99
+ * the two sources agree by construction rather than by a copied table. Absent ⇒ unchanged
100
+ * behavior: the opts closure alone supplies the identity axes.
101
+ */
44
102
  enrichCtx?: ToolCtxEnricher;
103
+ /** design/176 — caller tuning for the always-on peer-message admission gate (per-field
104
+ * range-validated; out-of-range values fall back to that field's default; there is no off
105
+ * switch). The Runner mount threads {@link import("../core/types.js").RunnerDeps.peerAdmission}
106
+ * here. Read per call — a changed value governs the next message. */
45
107
  admission?: Partial<PeerAdmissionConfig>;
108
+ /** design/176 — the SENDING run's peer-identity carrier (trusted internals chain; ctx twin
109
+ * {@link import("../core/types.js").ToolExecuteContext.peerSelfRef} wins when present). Supplies
110
+ * the sender's bucket key and the hop token appended to every outbound chain. A direct mount
111
+ * without it degrades to axis synthesis from `sessionId`/`owner`; with no axes at all the sender
112
+ * is identity-less (rate/dedup skipped — hop and queue bounds still apply). */
46
113
  peerSelf?: PeerSelfRef;
114
+ /** design/176 — the SENDING run's inbound peer-chain ref (ctx twin wins): the chain of the most
115
+ * recently consumed peer message, which this run's outbound sends extend. */
47
116
  peerInbound?: PeerInboundChainRef;
117
+ /** design/176 — the RECIPIENT identity of the {@link uplink} callback, PAIR-MINTED at the same
118
+ * trust point that bound the callback (spawn internals assembly / the resume face's
119
+ * currentParentNotify replacement): `uplink` is an opaque void callback and the parent axes
120
+ * deliberately keep the ORIGINAL spawner on the revive arm while the callback points at the
121
+ * WAKER — so the uplink's admission identity can only travel WITH the binding, never be derived.
122
+ * A direct mount that wires `uplink` without this leaves L1 ungated (recorded honest boundary:
123
+ * the library does not fabricate an identity on the host's behalf). */
48
124
  uplinkRecipient?: PeerSelfRef;
49
125
  }
126
+ /** RB-382 — max chars of the `summary` arg (the short recap label, distinct from `message`'s much
127
+ * larger {@link UPLINK_RESULT_MAX}) before ITS OWN truncation. Exported for direct unit-testing only
128
+ * (module-internal path, same convention as MONITOR_SPILL_CAP_BYTES — not part of the src/index.ts
129
+ * public surface): the tool's OWN schema already declares `summary: Type.String({ maxLength: 200 })`,
130
+ * so a call arriving through the normal `AgentTool.execute` gate (`defineTool`'s `Value.Check`, see
131
+ * core/tools.ts) can never carry a summary longer than this — the clip below is a defense-in-depth
132
+ * belt for any caller that reaches this function body without going through that gate, not a live
133
+ * truncation a model-facing call can trigger today. */
50
134
  export declare const SEND_MESSAGE_SUMMARY_MAX = 200;
135
+ /** RB-382 — clip a trimmed, non-empty `summary` to {@link SEND_MESSAGE_SUMMARY_MAX} chars, appending
136
+ * the SAME "[… truncated: N chars total]" marker style every `message` truncation site in this file
137
+ * already uses (the four delivery legs each silently did `slice(0, 200)` with no marker at all — a
138
+ * double standard against `message`'s disclosed truncation in the same file, at least on paper — see
139
+ * this constant's own doc comment for why the schema gate makes the branch unreachable in practice
140
+ * today). The cap itself is unchanged; only the missing disclosure is added. RB-419 then folded those
141
+ * four re-derivations into a SINGLE call site, immediately after the gate that makes the argument
142
+ * non-empty — so this helper now has exactly one caller in the tool body. */
51
143
  export declare function clipSendMessageSummary(raw: string): string;
52
144
  export declare function createSendMessageTool(opts: SendMessageToolOptions): import("../core/types.js").AgentTool<Type.TObject<{
53
145
  to: Type.TString;
@@ -1,2 +1,7 @@
1
1
  import type { Runner } from "../core/runner/runtask.js";
2
+ /**
3
+ * Release a throwaway session, swallowing errors — best-effort cleanup for the verifier/cascade-rung
4
+ * sessions that agents spin up and discard. Always call this in a `finally` so a throwing `runTask`
5
+ * result handler or caller hook (`onRung`/`onRound`) can't leak the session.
6
+ */
2
7
  export declare function releaseSession(runner: Runner, sessionId: string): Promise<void>;
@@ -1,15 +1,53 @@
1
+ /**
2
+ * Sub-agent residual-observability recorder (lanes A/B/D — CC harness parity).
3
+ *
4
+ * A parent observing a child agent — especially one that was stopped mid-flight by a stream drop or
5
+ * TaskStop — needs more than final text + terminal status to write a PRECISE resume prompt ("you
6
+ * stopped at file X, step Y"). CC's harness feeds the parent a compact step tail + the child's edited
7
+ * files + a one-line "currently doing" progress string. This recorder derives those three from the
8
+ * child's live `TaskEvent` stream (the same `onForwardEvent` sink the display/tick lanes already tap),
9
+ * so no new engine plumbing is needed — it is a pure observer.
10
+ *
11
+ * Scope: ONE direct child. A child that itself spawns a grandchild re-threads the same forward sink,
12
+ * so grandchild events bubble through here too. Scoping is EXPLICIT, not first-come-first-served
13
+ * (CORE-2 — the old "first `sourceTaskId` seen" lock assumed direct-child content always precedes
14
+ * any grandchild frame, an ordering the shared sink does not guarantee):
15
+ * 1. the spawn site calls {@link SubagentStepRecorder.lockTo} the moment the child's taskId is known
16
+ * (fork lanes: the forked sessionId; retained lanes: the pre-minted child sessionId) — after that,
17
+ * only `sourceTaskId === lockedSource` frames are recorded;
18
+ * 2. lanes where the child id is minted inside `runTask` (plain sync / non-retained background) anchor
19
+ * by FRAME PAIRING instead: the runner stamps `sourceTaskId` + `parentToolCallId` together on every
20
+ * child content event, and the DIRECT child's `parentToolCallId` is THIS delegation's own tool-call
21
+ * id (a grandchild's frames carry the child's delegation id) — so the provisional lock only seeds
22
+ * from a matching frame;
23
+ * 3. without either anchor (bare construction — tests/legacy), the first-source lock applies as before.
24
+ * Everything is BOUNDED (step ring ≤ {@link STEP_CAP}, fields truncated) so a pathological child can't
25
+ * balloon the parent's notification/report.
26
+ */
1
27
  import type { TaskEvent } from "../core/types.js";
28
+ /** One completed tool step in the child's tail — enough for the parent to say "you stopped at X". */
2
29
  export interface SubagentStep {
30
+ /** Tool name (or its distinct {@link ToolSpec.label} when set). */
3
31
  tool: string;
32
+ /** The step's primary argument, one line: file path / command / pattern. May be "". */
4
33
  target: string;
34
+ /** Result first line — or `error: …` when the tool failed. May be "". */
5
35
  outcome: string;
6
36
  }
37
+ /** A file the child mutated, with how many times (Write/Edit/MultiEdit/NotebookEdit). */
7
38
  export interface SubagentEditedFile {
8
39
  path: string;
9
40
  edits: number;
10
41
  }
42
+ /** Keep the last N tool steps (CC's tail is ~this deep; older steps are rarely load-bearing for resume). */
11
43
  export declare const STEP_CAP = 10;
44
+ /** The tool's primary argument as a single short line (best-effort; unknown shapes → a compact JSON head). */
12
45
  export declare function extractTarget(args: unknown): string;
46
+ /**
47
+ * Observes a single child's forwarded `TaskEvent`s and derives the residual-observability projection.
48
+ * Feed it every event via {@link record}; read {@link recentSteps}/{@link editedFiles}/{@link currentAction}
49
+ * at report/notify/tick time. Swallow-safe: `record` never throws (an observer must never fault a run).
50
+ */
13
51
  export declare class SubagentStepRecorder {
14
52
  private lockedSource;
15
53
  private lockedResolved;
@@ -20,17 +58,45 @@ export declare class SubagentStepRecorder {
20
58
  private action;
21
59
  private actionTool;
22
60
  private actionTarget;
61
+ /**
62
+ * @param parentToolCallId THIS delegation's own tool-call id (`ctx.toolCallId` — the exact value the
63
+ * spawn threads as `RunInternals.parentToolCallId`, which the runner stamps back onto every direct-child
64
+ * content event). Used to seed the provisional lock ONLY from a direct-child frame while no explicit
65
+ * {@link lockTo} anchor is set. Optional: absent falls back to the legacy first-source lock.
66
+ */
23
67
  constructor(parentToolCallId?: string);
68
+ /**
69
+ * CORE-2 — explicitly anchor the observed DIRECT child by its taskId (= its sessionId on every
70
+ * delegation lane: `buildChildSpec` never sets `spec.taskId`). Call as soon as the id is known at the
71
+ * spawn site. If events arrived BEFORE the anchor and the provisional lock caught a DIFFERENT source
72
+ * (a grandchild racing through the shared sink), everything recorded so far belongs to the wrong
73
+ * descendant — reset it and re-lock, so the projection never mixes generations.
74
+ */
24
75
  lockTo(taskId: string): void;
76
+ /** Drop everything recorded under a mis-locked source (see {@link lockTo}). */
25
77
  private resetRecorded;
78
+ /** True when the event belongs to the observed direct child (see the class doc for the 3-tier anchor). */
26
79
  private inScope;
27
80
  record(e: TaskEvent): void;
81
+ /** The child's last ≤{@link STEP_CAP} completed tool steps; undefined if none observed. */
28
82
  recentSteps(): SubagentStep[] | undefined;
83
+ /** Files the child mutated with edit counts; undefined if none. */
29
84
  editedFiles(): SubagentEditedFile[] | undefined;
85
+ /** The child's most recent tool intent as one human line ("Bash npm test", "Edit src/x.ts"); undefined if none. */
30
86
  currentAction(): string | undefined;
87
+ /** [1828] (server cross-repo): {@link currentAction} pre-formatted into a fleet-view Progress-section
88
+ * shape — the SAME `{tool, target}` pair `currentAction` already concatenates into one line, exposed
89
+ * separately so a consumer can look the tool up in its own registry instead of parsing prose.
90
+ * Undefined if none observed (mirrors {@link currentAction}'s own undefined case exactly). */
31
91
  currentActionStructured(): {
32
92
  toolName: string;
33
93
  target?: string;
34
94
  } | undefined;
35
95
  }
96
+ /**
97
+ * Residual lane C — derive the last `lastN` tool steps from a session's PERSISTED messages (the pull-model
98
+ * `AgentTranscript` read face). Mirrors {@link SubagentStepRecorder} but sources from committed history
99
+ * instead of the live event stream, so a parent can retrospectively read a child's tail on demand. Walks
100
+ * assistant `toolCall`s paired with the following `toolResult`, oldest→newest, then keeps the last N.
101
+ */
36
102
  export declare function stepsFromMessages(messages: readonly unknown[], lastN: number): SubagentStep[];