@sema-agent/core 7.72.0 → 7.74.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 (375) hide show
  1. package/CHANGELOG.md +565 -0
  2. package/dist/agents/inherited-tool-pool.d.ts +26 -1
  3. package/dist/agents/inherited-tool-pool.js +46 -2
  4. package/dist/agents/list-agents-tool.js +1 -1
  5. package/dist/agents/parked-resume-drive.d.ts +10 -0
  6. package/dist/agents/parked-resume-drive.js +9 -0
  7. package/dist/agents/retain-ledger.d.ts +3 -0
  8. package/dist/agents/retain-ledger.js +3 -3
  9. package/dist/agents/send-message-tool.js +5 -4
  10. package/dist/agents/send-user-message-tool.d.ts +12 -0
  11. package/dist/agents/send-user-message-tool.js +67 -0
  12. package/dist/agents/subagent-steps.d.ts +9 -0
  13. package/dist/agents/subagent-steps.js +38 -0
  14. package/dist/agents/subagent.d.ts +2 -0
  15. package/dist/agents/subagent.js +43 -12
  16. package/dist/agents/verify.js +23 -8
  17. package/dist/agents/yield-adoption.js +3 -1
  18. package/dist/brain/anthropic.d.ts +42 -1
  19. package/dist/brain/anthropic.js +68 -13
  20. package/dist/brain/failover.d.ts +5 -0
  21. package/dist/brain/failover.js +51 -22
  22. package/dist/brain/model-lane.d.ts +12 -3
  23. package/dist/brain/model-lane.js +5 -5
  24. package/dist/brain/open-responses.js +7 -8
  25. package/dist/brain/openai.js +31 -24
  26. package/dist/brain/route-adjudicator.d.ts +33 -4
  27. package/dist/brain/route-adjudicator.js +49 -12
  28. package/dist/brain/stream-engine.js +166 -156
  29. package/dist/brain/stream-shared.d.ts +4 -3
  30. package/dist/brain/stream-shared.js +2 -2
  31. package/dist/core/actions-digest.d.ts +43 -0
  32. package/dist/core/actions-digest.js +22 -0
  33. package/dist/core/allow-entry.js +4 -4
  34. package/dist/core/ask-class.d.ts +2 -2
  35. package/dist/core/ask-headline.d.ts +1 -1
  36. package/dist/core/ask-origin.d.ts +44 -4
  37. package/dist/core/ask-origin.js +29 -10
  38. package/dist/core/auto-mode.d.ts +7 -9
  39. package/dist/core/auto-mode.js +114 -8
  40. package/dist/core/background-agent-store.d.ts +1 -0
  41. package/dist/core/background-agent-store.js +49 -8
  42. package/dist/core/checkpoint-features.d.ts +3 -2
  43. package/dist/core/checkpoint-features.js +1 -1
  44. package/dist/core/checkpoint-rekey.d.ts +1 -1
  45. package/dist/core/checkpoint-rekey.js +6 -1
  46. package/dist/core/checkpoint-requirements.d.ts +23 -3
  47. package/dist/core/checkpoint-requirements.js +5 -1
  48. package/dist/core/checkpoint-row-verdict.d.ts +1 -1
  49. package/dist/core/checkpoint-row-verdict.js +9 -3
  50. package/dist/core/checkpoint-store.d.ts +26 -2
  51. package/dist/core/checkpoint-store.js +9 -2
  52. package/dist/core/child-clamp-seats.d.ts +15 -0
  53. package/dist/core/child-clamp-seats.js +15 -0
  54. package/dist/core/config-refusal-codes.d.ts +1 -1
  55. package/dist/core/config-refusal-codes.js +1 -0
  56. package/dist/core/cron.js +9 -1
  57. package/dist/core/delegation-frames.d.ts +1 -0
  58. package/dist/core/delegation-frames.js +1 -1
  59. package/dist/core/deployment-shape.d.ts +7 -0
  60. package/dist/core/deployment-shape.js +19 -0
  61. package/dist/core/engine-capabilities.d.ts +13 -1
  62. package/dist/core/engine-capabilities.js +1 -1
  63. package/dist/core/engine-notice.d.ts +41 -28
  64. package/dist/core/engine-version.js +1 -1
  65. package/dist/core/entries-not-applied.d.ts +19 -7
  66. package/dist/core/entries-not-applied.js +33 -1
  67. package/dist/core/gate-fold.js +5 -4
  68. package/dist/core/gate-lanes.js +8 -12
  69. package/dist/core/gate-outcome.d.ts +8 -2
  70. package/dist/core/gate-outcome.js +10 -3
  71. package/dist/core/governance-codes.d.ts +14 -2
  72. package/dist/core/governance-codes.js +22 -6
  73. package/dist/core/hook-condition.d.ts +37 -0
  74. package/dist/core/hook-condition.js +567 -0
  75. package/dist/core/hooks.d.ts +5 -0
  76. package/dist/core/hooks.js +1 -0
  77. package/dist/core/host-instance.d.ts +23 -0
  78. package/dist/core/host-instance.js +69 -0
  79. package/dist/core/instruction-preview.d.ts +63 -0
  80. package/dist/core/instruction-preview.js +406 -0
  81. package/dist/core/leg-budget.d.ts +26 -0
  82. package/dist/core/leg-budget.js +9 -0
  83. package/dist/core/leg-identity.d.ts +51 -1
  84. package/dist/core/leg-identity.js +45 -2
  85. package/dist/core/manager-launch-check.d.ts +48 -0
  86. package/dist/core/manager-launch-check.js +64 -0
  87. package/dist/core/mcp-call-meta.d.ts +2 -2
  88. package/dist/core/mcp-injection-drop.d.ts +20 -10
  89. package/dist/core/mcp-injection-drop.js +9 -3
  90. package/dist/core/mcp-server-spec.d.ts +2 -1
  91. package/dist/core/member-outcome.d.ts +3 -2
  92. package/dist/core/member-outcome.js +1 -1
  93. package/dist/core/memory-engine/deletion-record.d.ts +46 -0
  94. package/dist/core/memory-engine/deletion-record.js +96 -0
  95. package/dist/core/memory-engine/engine.js +24 -16
  96. package/dist/core/memory-engine/file-backend.js +7 -5
  97. package/dist/core/memory-engine/projection-ledger.d.ts +1 -1
  98. package/dist/core/memory-engine/projection-ledger.js +1 -1
  99. package/dist/core/memory-engine/scope-contract.d.ts +18 -13
  100. package/dist/core/memory-engine/scope-contract.js +18 -18
  101. package/dist/core/memory-engine/sync-client.js +26 -6
  102. package/dist/core/memory-engine/sync.d.ts +20 -2
  103. package/dist/core/memory-engine/sync.js +18 -17
  104. package/dist/core/mode-policy.d.ts +25 -6
  105. package/dist/core/mode-policy.js +33 -8
  106. package/dist/core/model-seat.d.ts +8 -5
  107. package/dist/core/model-shell.d.ts +129 -0
  108. package/dist/core/model-shell.js +249 -0
  109. package/dist/core/mods/kernel/digest.d.ts +4 -0
  110. package/dist/core/mods/kernel/digest.js +5 -0
  111. package/dist/core/mods/kernel/dispatch.d.ts +3 -0
  112. package/dist/core/mods/kernel/dispatch.js +15 -6
  113. package/dist/core/mods/kernel/events.d.ts +21 -5
  114. package/dist/core/mods/kernel/events.js +19 -10
  115. package/dist/core/mods/kernel/hash-mirror.d.ts +1 -0
  116. package/dist/core/mods/kernel/hash-mirror.js +55 -0
  117. package/dist/core/mods/kernel/index.d.ts +1 -0
  118. package/dist/core/mods/kernel/index.js +1 -0
  119. package/dist/core/mods/kernel/package-reader.d.ts +48 -0
  120. package/dist/core/mods/kernel/package-reader.js +149 -0
  121. package/dist/core/mods/kernel/site-rules.d.ts +4 -0
  122. package/dist/core/mods/kernel/site-rules.js +13 -0
  123. package/dist/core/mods/package.d.ts +7 -3
  124. package/dist/core/mods/package.js +47 -80
  125. package/dist/core/own-property-receipt.js +11 -4
  126. package/dist/core/parent-spec-seat.d.ts +13 -11
  127. package/dist/core/parent-spec-seat.js +13 -9
  128. package/dist/core/peer-seat.js +3 -3
  129. package/dist/core/peer-task-store.d.ts +365 -0
  130. package/dist/core/peer-task-store.js +682 -0
  131. package/dist/core/permission-rule-consent.js +6 -11
  132. package/dist/core/permission-rule-model.d.ts +27 -0
  133. package/dist/core/permission-rule-model.js +33 -5
  134. package/dist/core/permission-rule-org.js +13 -3
  135. package/dist/core/permission-rule-provider.d.ts +35 -33
  136. package/dist/core/permission-rule-provider.js +38 -295
  137. package/dist/core/permission-rule-store.d.ts +181 -8
  138. package/dist/core/permission-rule-store.js +420 -17
  139. package/dist/core/permission-rule-sync.js +15 -1
  140. package/dist/core/permission-rules.js +4 -1
  141. package/dist/core/project-seat.d.ts +55 -0
  142. package/dist/core/project-seat.js +96 -0
  143. package/dist/core/protocol-http-auth.d.ts +3 -2
  144. package/dist/core/protocol-http-auth.js +26 -18
  145. package/dist/core/remote-env.d.ts +4 -4
  146. package/dist/core/retain-seat.d.ts +42 -0
  147. package/dist/core/retain-seat.js +76 -0
  148. package/dist/core/retired-keys.js +1 -0
  149. package/dist/core/rewind-refusal-codes.d.ts +8 -0
  150. package/dist/core/rewind-refusal-codes.js +12 -0
  151. package/dist/core/roles.d.ts +2 -2
  152. package/dist/core/roles.js +15 -1
  153. package/dist/core/rule-offer-read.d.ts +1 -1
  154. package/dist/core/rule-offer-read.js +32 -4
  155. package/dist/core/rule-store-fault.d.ts +9 -7
  156. package/dist/core/rule-store-fault.js +8 -3
  157. package/dist/core/run-ledger-seat.d.ts +66 -0
  158. package/dist/core/run-ledger-seat.js +70 -0
  159. package/dist/core/run-ledger.d.ts +332 -0
  160. package/dist/core/run-ledger.js +550 -0
  161. package/dist/core/runner/checkpoint-scope.d.ts +14 -3
  162. package/dist/core/runner/checkpoint-scope.js +16 -6
  163. package/dist/core/runner/compact-session.js +1 -1
  164. package/dist/core/runner/construction-doors.js +8 -0
  165. package/dist/core/runner/contracts.d.ts +21 -5
  166. package/dist/core/runner/cross-boundary-lane.d.ts +8 -1
  167. package/dist/core/runner/cross-boundary-lane.js +4 -0
  168. package/dist/core/runner/delegation-owner.d.ts +30 -0
  169. package/dist/core/runner/delegation-owner.js +20 -4
  170. package/dist/core/runner/finish-reason-seat.js +4 -2
  171. package/dist/core/runner/gate-exit.d.ts +7 -0
  172. package/dist/core/runner/gate-exit.js +2 -1
  173. package/dist/core/runner/leg-frame.js +3 -0
  174. package/dist/core/runner/model-lane-seat.d.ts +3 -0
  175. package/dist/core/runner/model-lane-seat.js +4 -0
  176. package/dist/core/runner/nested-memory-lane.d.ts +22 -5
  177. package/dist/core/runner/nested-memory-lane.js +91 -30
  178. package/dist/core/runner/person-path-rows.d.ts +27 -16
  179. package/dist/core/runner/person-path-rows.js +93 -15
  180. package/dist/core/runner/prepare-caps-and-workflow.js +98 -88
  181. package/dist/core/runner/prepare-config-doors.d.ts +1 -0
  182. package/dist/core/runner/prepare-config-doors.js +13 -7
  183. package/dist/core/runner/prepare-context-lane.js +1 -0
  184. package/dist/core/runner/prepare-delegation-surface.d.ts +3 -0
  185. package/dist/core/runner/prepare-delegation-surface.js +6 -0
  186. package/dist/core/runner/prepare-execution-env.d.ts +3 -3
  187. package/dist/core/runner/prepare-gate-stations.d.ts +6 -0
  188. package/dist/core/runner/prepare-gate-stations.js +3 -1
  189. package/dist/core/runner/prepare-hands-readface.d.ts +5 -2
  190. package/dist/core/runner/prepare-hands-readface.js +15 -3
  191. package/dist/core/runner/prepare-inherited-gate.d.ts +6 -3
  192. package/dist/core/runner/prepare-inherited-gate.js +13 -5
  193. package/dist/core/runner/prepare-offload-wrappers.js +1 -1
  194. package/dist/core/runner/prepare-run-refs.d.ts +1 -1
  195. package/dist/core/runner/prepare-run-refs.js +3 -2
  196. package/dist/core/runner/prepare-suspend-saga.d.ts +6 -2
  197. package/dist/core/runner/prepare-suspend-saga.js +4 -2
  198. package/dist/core/runner/prepare-task.js +42 -30
  199. package/dist/core/runner/prepare-turn-wiring.d.ts +4 -3
  200. package/dist/core/runner/prepare-turn-wiring.js +2 -1
  201. package/dist/core/runner/prepare-wiring-manifest.d.ts +3 -1
  202. package/dist/core/runner/prepare-wiring-manifest.js +8 -6
  203. package/dist/core/runner/resume-apply.js +11 -5
  204. package/dist/core/runner/resume-policy-outcome.js +5 -2
  205. package/dist/core/runner/resume-review-outcome.d.ts +3 -0
  206. package/dist/core/runner/resume-review-outcome.js +24 -1
  207. package/dist/core/runner/role-seat-defaulted.d.ts +3 -3
  208. package/dist/core/runner/role-seat-defaulted.js +1 -1
  209. package/dist/core/runner/rule-store-unreadable-notice.d.ts +1 -1
  210. package/dist/core/runner/rule-store-unreadable-notice.js +3 -3
  211. package/dist/core/runner/run-harness-handlers.js +4 -1
  212. package/dist/core/runner/run-identity-wiring.js +3 -2
  213. package/dist/core/runner/run-leg.js +5 -2
  214. package/dist/core/runner/run-notification-lane.js +20 -1
  215. package/dist/core/runner/run-settle-and-teardown.js +21 -12
  216. package/dist/core/runner/run-stop-and-final-verify.js +6 -0
  217. package/dist/core/runner/run-telemetry-and-budget-seats.js +1 -1
  218. package/dist/core/runner/runtask.d.ts +6 -2
  219. package/dist/core/runner/runtask.js +21 -9
  220. package/dist/core/runner/shell-env-withheld.d.ts +6 -4
  221. package/dist/core/runner/shell-env-withheld.js +25 -3
  222. package/dist/core/runner/stop-tail-notice.d.ts +10 -2
  223. package/dist/core/runner/stop-tail-notice.js +9 -2
  224. package/dist/core/runner/stream-settle-backstop.d.ts +1 -0
  225. package/dist/core/runner/stream-settle-backstop.js +1 -0
  226. package/dist/core/runner/sub-agent-deny-lists.js +9 -5
  227. package/dist/core/runner/task-start-doors.js +6 -3
  228. package/dist/core/runner/terminal-account.d.ts +6 -1
  229. package/dist/core/runner/terminal-account.js +16 -1
  230. package/dist/core/runner/tool-end-body.d.ts +1 -1
  231. package/dist/core/runner/tool-not-executed.d.ts +27 -8
  232. package/dist/core/runner/tool-not-executed.js +22 -11
  233. package/dist/core/runner/unreadable-person-rows.d.ts +2 -1
  234. package/dist/core/runner/write-protection-station.d.ts +1 -1
  235. package/dist/core/runner/write-protection-station.js +1 -1
  236. package/dist/core/runner-deps.d.ts +17 -10
  237. package/dist/core/secret-env.d.ts +61 -37
  238. package/dist/core/secret-env.js +49 -49
  239. package/dist/core/session-checkout.d.ts +3 -0
  240. package/dist/core/session-checkout.js +1 -0
  241. package/dist/core/session-store.d.ts +12 -6
  242. package/dist/core/session-store.js +26 -6
  243. package/dist/core/session.d.ts +31 -8
  244. package/dist/core/shell-read-silence.d.ts +40 -2
  245. package/dist/core/shell-read-silence.js +23 -4
  246. package/dist/core/store-contracts/checkpoint-store-contract.js +10 -0
  247. package/dist/core/store-contracts/peer-task-store-contract.d.ts +21 -0
  248. package/dist/core/store-contracts/peer-task-store-contract.js +516 -0
  249. package/dist/core/store-contracts/session-store-contract.d.ts +15 -2
  250. package/dist/core/store-contracts/session-store-contract.js +87 -3
  251. package/dist/core/store-contracts/workflow-journal-store-contract.d.ts +19 -1
  252. package/dist/core/store-contracts/workflow-journal-store-contract.js +89 -1
  253. package/dist/core/task-event.d.ts +14 -7
  254. package/dist/core/task-notification.d.ts +96 -10
  255. package/dist/core/task-notification.js +135 -6
  256. package/dist/core/task-registry-agent.d.ts +1 -0
  257. package/dist/core/task-registry-agent.js +1 -1
  258. package/dist/core/task-registry-shared.d.ts +12 -1
  259. package/dist/core/task-registry-shared.js +3 -1
  260. package/dist/core/task-registry-workflow.d.ts +1 -1
  261. package/dist/core/task-registry-workflow.js +9 -1
  262. package/dist/core/task-registry.d.ts +40 -2
  263. package/dist/core/task-registry.js +80 -15
  264. package/dist/core/task-result.d.ts +18 -3
  265. package/dist/core/task-spec-members.d.ts +3 -1
  266. package/dist/core/task-spec-members.js +19 -3
  267. package/dist/core/task-spec.d.ts +48 -22
  268. package/dist/core/tool-catalog-entries.js +2 -0
  269. package/dist/core/tool-gate-phase.d.ts +6 -3
  270. package/dist/core/tool-gate-phase.js +1 -0
  271. package/dist/core/tool-mount-facts.d.ts +8 -4
  272. package/dist/core/tool-mount-facts.js +7 -2
  273. package/dist/core/tool-mount-plan.d.ts +3 -1
  274. package/dist/core/tool-mount-plan.js +10 -3
  275. package/dist/core/tool-mount-static.d.ts +1 -1
  276. package/dist/core/tool-mount-static.js +4 -2
  277. package/dist/core/tool-result-store.d.ts +56 -3
  278. package/dist/core/tool-result-store.js +219 -25
  279. package/dist/core/tool-spec.d.ts +9 -2
  280. package/dist/core/trace.d.ts +3 -3
  281. package/dist/core/user-attachment.d.ts +5 -1
  282. package/dist/core/user-attachment.js +14 -7
  283. package/dist/core/wiring-manifest.d.ts +26 -20
  284. package/dist/core/wiring-manifest.js +7 -3
  285. package/dist/core/workflow-journal-store.d.ts +53 -10
  286. package/dist/core/workflow-journal-store.js +27 -4
  287. package/dist/core/workflow-run-store-contract.js +16 -0
  288. package/dist/core/workflow-run-store.d.ts +9 -7
  289. package/dist/core/workflow-run-store.js +4 -1
  290. package/dist/engine/execution-env/node-execution-env.d.ts +75 -1
  291. package/dist/engine/execution-env/node-execution-env.js +227 -13
  292. package/dist/engine/harness/types.d.ts +49 -1
  293. package/dist/engine/harness/types.js +10 -0
  294. package/dist/engine/llm/types.d.ts +13 -7
  295. package/dist/engine/llm/validation.d.ts +8 -1
  296. package/dist/engine/llm/validation.js +31 -2
  297. package/dist/engine/lsp/node-lsp-manager.js +2 -1
  298. package/dist/engine/session/import-validate.js +6 -1
  299. package/dist/engine/session/session.d.ts +15 -2
  300. package/dist/engine/session/session.js +34 -4
  301. package/dist/host-env.d.ts +10 -0
  302. package/dist/host-env.js +1 -0
  303. package/dist/index.d.ts +28 -9
  304. package/dist/index.js +22 -6
  305. package/dist/internal/harness-types.d.ts +1 -1
  306. package/dist/orchestration/goal.js +1 -1
  307. package/dist/orchestration/run-workflow-tool.js +40 -32
  308. package/dist/orchestration/workflow-park-adoption.d.ts +51 -12
  309. package/dist/orchestration/workflow-park-adoption.js +47 -12
  310. package/dist/orchestration/workflow-primitives.js +10 -1
  311. package/dist/orchestration/workflow-script-runner.d.ts +2 -2
  312. package/dist/orchestration/workflow-stop.d.ts +128 -0
  313. package/dist/orchestration/workflow-stop.js +156 -0
  314. package/dist/orchestration/workflow.d.ts +31 -7
  315. package/dist/orchestration/workflow.js +119 -57
  316. package/dist/prompts/manager-recipe.d.ts +18 -0
  317. package/dist/prompts/manager-recipe.js +24 -0
  318. package/dist/shell/lex.d.ts +2 -2
  319. package/dist/shell/lex.js +1 -1
  320. package/dist/stores/file/permission-rule-store.d.ts +3 -1
  321. package/dist/stores/file/permission-rule-store.js +0 -1
  322. package/dist/stores/file/workflow-journal-store.d.ts +16 -3
  323. package/dist/stores/file/workflow-journal-store.js +93 -5
  324. package/dist/stores/file/workflow-run-store.d.ts +1 -1
  325. package/dist/tools/fs/bash-model-shell.d.ts +23 -0
  326. package/dist/tools/fs/bash-model-shell.js +25 -0
  327. package/dist/tools/fs/bash-readonly-classifier.d.ts +6 -0
  328. package/dist/tools/fs/bash-readonly-classifier.js +3 -0
  329. package/dist/tools/fs/file-write-check.js +9 -3
  330. package/dist/tools/fs/fs-bash.js +13 -11
  331. package/dist/tools/fs/index.d.ts +8 -7
  332. package/dist/tools/fs/index.js +4 -4
  333. package/dist/tools/fs/read-deny-home.d.ts +1 -1
  334. package/dist/tools/fs/read-deny-home.js +5 -5
  335. package/dist/tools/fs/read-deny.d.ts +33 -8
  336. package/dist/tools/fs/read-deny.js +114 -25
  337. package/dist/tools/fs/safety.d.ts +4 -1
  338. package/dist/tools/fs/safety.js +4 -2
  339. package/dist/tools/fs/shell-read-argv.js +1 -0
  340. package/dist/tools/fs/shell-read-check.d.ts +9 -2
  341. package/dist/tools/fs/shell-read-check.js +134 -22
  342. package/dist/tools/fs/shell-read-establish.d.ts +9 -0
  343. package/dist/tools/fs/shell-read-establish.js +21 -11
  344. package/dist/tools/fs/shell-read-judge.d.ts +13 -1
  345. package/dist/tools/fs/shell-read-judge.js +26 -7
  346. package/dist/tools/fs/shell-read-plan.d.ts +7 -3
  347. package/dist/tools/fs/shell-read-plan.js +8 -5
  348. package/dist/tools/fs/shell-read-word.d.ts +8 -0
  349. package/dist/tools/fs/shell-read-word.js +13 -4
  350. package/dist/tools/fs/shell-read-write-targets.js +17 -9
  351. package/dist/tools/monitor.js +12 -8
  352. package/dist/tools/scheduler-tools.d.ts +1 -0
  353. package/dist/tools/scheduler-tools.js +5 -2
  354. package/package.json +3 -2
  355. package/test/export-surface.snapshot.json +192 -3
  356. package/wire-changes/answers/core-stores-sql@7.73.0.json +28 -0
  357. package/wire-changes/answers/core-stores-sql@7.74.0.json +7 -0
  358. package/wire-changes/answers/core@7.73.0.json +216 -0
  359. package/wire-changes/answers/core@7.74.0.json +68 -0
  360. package/wire-changes/answers/mods-kernel@7.73.0.json +7 -0
  361. package/wire-changes/answers/mods-kernel@7.74.0.json +21 -0
  362. package/wire-changes/answers/primitives@7.73.0.json +12 -0
  363. package/wire-changes/answers/primitives@7.74.0.json +7 -0
  364. package/wire-changes/answers/wiki-gate@7.73.0.json +7 -0
  365. package/wire-changes/answers/wiki-gate@7.74.0.json +8 -0
  366. package/wire-changes/core-stores-sql@7.73.0.json +326 -0
  367. package/wire-changes/core-stores-sql@7.74.0.json +143 -0
  368. package/wire-changes/core@7.73.0.json +6480 -0
  369. package/wire-changes/core@7.74.0.json +2210 -0
  370. package/wire-changes/mods-kernel@7.73.0.json +147 -0
  371. package/wire-changes/mods-kernel@7.74.0.json +421 -0
  372. package/wire-changes/primitives@7.73.0.json +227 -0
  373. package/wire-changes/primitives@7.74.0.json +174 -0
  374. package/wire-changes/wiki-gate@7.73.0.json +145 -0
  375. package/wire-changes/wiki-gate@7.74.0.json +145 -0
@@ -9,7 +9,7 @@ export { CORRUPT_SESSION_DELETE_DOORS, CORRUPT_SESSION_FORMS, CORRUPT_SESSION_WA
9
9
  export type { CorruptSessionDeleteDoor, CorruptSessionDetail, CorruptSessionForm, CorruptSessionWay, CorruptSessionWayOut } from "../internal/harness.js";
10
10
  import type { CorruptSessionForm } from "../internal/harness.js";
11
11
  import type { Session } from "../internal/harness.js";
12
- import type { SessionHead, SessionRowExpectation, SessionTreeEntry } from "../internal/harness.js";
12
+ import type { SessionHead, SessionRowExpectation, SessionRowRead, SessionTreeEntry } from "../internal/harness.js";
13
13
  export type { SessionPlacementRecord } from "../internal/harness.js";
14
14
  export type { SessionHead, SessionLogMark, SessionRowExpectation, SessionRowRead } from "../internal/harness.js";
15
15
  /** True when `err` is a session optimistic-lock conflict (a concurrent writer won the branch leaf). Both
@@ -104,14 +104,15 @@ export interface SessionStoreSummary {
104
104
  * another replica or a dropped cache reads the same time, and only a later activity moves it. An acquire that writes nothing is not
105
105
  * activity. */
106
106
  lastActiveAt: number;
107
- /** The most recent task run on this session (core's `taskId`; the service projects it as `lastRunId`).
107
+ /** The most recent task run on this session (core's `taskId` — on a ledger run, the host's if it gave one other than the session id, the id the parked row recorded on a resume, otherwise the minted `rl-…` one; the service projects it as `lastRunId`).
108
108
  * Absent until a task has run on the session (recorded via {@link SessionStore.noteTaskRun}). */
109
109
  lastTaskId?: string;
110
110
  /**
111
111
  * An ENGINE-minted run identity for this session ({@link import("./types.js").TaskResult.runId}),
112
112
  * recorded by the most recent {@link SessionStore.noteTaskRun} write to LAND.
113
- * {@link lastTaskId} above is the leg's task id (a background row's id, else the declared one, else the
114
- * session id), so on the ordinary deployment that supplies no
113
+ * {@link lastTaskId} above is the leg's task id (a background row's id; on a ledger run, the host's if it gave one
114
+ * other than the session id, the id the parked row recorded on a resume, otherwise the minted `rl-…` one; else the
115
+ * declared one or the session id), so on the ordinary deployment that supplies no
115
116
  * host task id it answers the SESSION's own id: a "last run" handle that names the session it hangs off
116
117
  * cannot say WHICH run it means. This one names a specific run — read the ORDERING clause below for
117
118
  * exactly how strong "most recent" is here, which is weaker than the sibling field's wording implies.
@@ -332,7 +333,8 @@ export interface SessionStore<S extends SessionStoreSummary = SessionStoreSummar
332
333
  *
333
334
  * `runId` (#499, additive third parameter — an existing implementation keeps typechecking and keeps
334
335
  * working): the engine's own identity for THIS run, for {@link SessionStoreSummary.lastTaskRunId}. It
335
- * is supplied because `taskId` cannot answer "which run": with no host task id it IS the session id.
336
+ * is supplied because `taskId` cannot answer "which run": with no host task id it IS the session id (on a run that keeps no
337
+ * member ledger; one that keeps one records the task id the engine minted for it, `rl-…`, the same on every run of that task).
336
338
  *
337
339
  * The two seats describe ONE run and MUST move together: a call that omits `runId` records the new
338
340
  * `lastTaskId` and CLEARS `lastTaskRunId`. Keeping the previous run's id beside a newer task id would
@@ -420,6 +422,20 @@ export interface SessionStore<S extends SessionStoreSummary = SessionStoreSummar
420
422
  * fail-closed arm.
421
423
  */
422
424
  headOf?(sessionId: string): Promise<SessionHead | undefined>;
425
+ /**
426
+ * The row as it stands, for a reader that does not run on it: its metadata, its head and its whole log oldest-first, all of one row
427
+ * generation ({@link SessionRowRead}). Four rules, the same on every store:
428
+ * · **It writes nothing** — no row, entry, owner cell, file or cached view is created or changed by it, an id with no row included.
429
+ * · **It sweeps nothing** — no session, the one read or any other, is evicted from a cache or deleted because of this read.
430
+ * · **It is no activity** — no idle clock moves (the read session stays exactly as near its idle eviction as it was), nor the time
431
+ * {@link list} orders by.
432
+ * · **No row and a failed read are two answers** — an id with no row RESOLVES `undefined`: a definite "there is no such row". A row
433
+ * that is there and cannot be read REJECTS with a coded error, never `undefined`: on the bundled stores a `SessionError` with code
434
+ * `corrupt_session` for a row whose header the store cannot read, and a backend's own coded fault for a read that did not complete.
435
+ * **Optional**: absent ⇒ an entry that reads a session without running on it (`Runner.previewInstructions`) refuses a named session
436
+ * (`config.invalid_session_store`) rather than open it through {@link acquire}, which sweeps and records activity.
437
+ */
438
+ readRow?(sessionId: string): Promise<SessionRowRead | undefined>;
423
439
  /**
424
440
  * The owner write of the ownership pair ({@link headOf} + this). On an id with NO row it creates the row — an ordinary row, no
425
441
  * placement — recording `owner` in the creating write, first-write-wins and atomic: of two concurrent first registers, both
@@ -470,9 +486,14 @@ export interface SessionStore<S extends SessionStoreSummary = SessionStoreSummar
470
486
  * Delete ONE session row and its log — the row primitive, and the last leg of the session-deletion cascade
471
487
  * ({@link import("./retention.js").RETENTION_CASCADE}). It reads no reference and touches no other store: the session's checkpoints,
472
488
  * offloaded tool results, session rules, file history and the rest outlive it until the cascade's executor removes them, so a host that
473
- * offers "delete a session" runs the cascade, not this call alone. Only when the row's owner equals `guard.owner` (null-safe:
489
+ * offers "delete a session" runs the cascade, not this call alone. The guard names the row it is for in one of two forms:
490
+ * `{ owner }` — the row whose owner equals `guard.owner`, whichever occupant it holds (null-safe:
474
491
  * `null` deletes only an anonymous row; the owner is read as a stored name is — `recordedPrincipalNameOf` — so the owner of a row an
475
- * earlier release wrote under a name the rule now refuses as ill-formed deletes it by that same string); a placed row is not deleted here (its deletion is `release`'s, through the joint reap). `true`
492
+ * earlier release wrote under a name the rule now refuses as ill-formed deletes it by that same string) — or the occupant a read of the
493
+ * row answered, `{ row: { owner, incarnation } }` (#4746: the expectation the out-of-run verbs take, read by the same reader —
494
+ * `row: null`, a `log` mark and a key besides `row` are refused — and judged by `sessionRowMatches` on the head in the step that removes
495
+ * the row: a row deleted and created again under the id since that read, by the same owner too, is another occupant and is not deleted).
496
+ * A guard that is neither form, or both, is refused (`TypeError`) before anything is read. A placed row is not deleted here (its deletion is `release`'s, through the joint reap). `true`
476
497
  * = this call deleted the row; `false` = there was no row, the guard did not hold, or the row is placed — nothing was deleted, so a
477
498
  * repeat is harmless. The id answers nothing afterwards, and a later create under it is a new occupant. A store wired with
478
499
  * {@link SessionStoreHooks.beforeSessionDelete} runs it first and deletes nothing when it rejects (the call rejects with it).
@@ -482,7 +503,9 @@ export interface SessionStore<S extends SessionStoreSummary = SessionStoreSummar
482
503
  * read and a header-only placement read, `SessionRepo.placementOf`).
483
504
  */
484
505
  delete?(sessionId: string, guard: {
485
- owner: string | null;
506
+ readonly owner: string | null;
507
+ } | {
508
+ readonly row: NonNullable<SessionRowExpectation["row"]>;
486
509
  }): Promise<boolean>;
487
510
  /**
488
511
  * Delete a session whose head cannot be read — a deployment operator's act, never an owner's request: a row that cannot be read names
@@ -2,6 +2,8 @@ import type { ShellReadVerdict } from "../tools/fs/shell-read-check.js";
2
2
  import { type ShellReadDisposition } from "../tools/fs/shell-read-judge.js";
3
3
  import type { GatePass } from "./runner/gate-exit.js";
4
4
  import type { PermissionResult } from "./tool-policy.js";
5
+ import type { ConfinedCall } from "./ask-origin.js";
6
+ import { type ShellCommandShape } from "./shell-run-candidates.js";
5
7
  /** One station answer, received and read: what a reader acts on (`kind`) and the answer it acts on (`verdict` — the engine's own
6
8
  * copy, received once). `unbelieved`: the station's answer was not received or contradicted its own finding, and `verdict` is the
7
9
  * engine's refusal of it (its sentence names the station's words only where they are words of the closed sets — nothing a station
@@ -39,13 +41,49 @@ export declare function readStationAnswer(answer: ShellReadVerdict, call: Statio
39
41
  * rule that could not be read (the rule lane's class); the finding `unanswered` is, unless rows are unread, the environment's silence —
40
42
  * the station's check that did not finish (the guard `unfinished_check`, attested on the ask's record for `call` beside the guards it
41
43
  * already carries) — and the marks only pick whose. Either is a question only a person answers (the real-approval bit, which each
42
- * class explains); `probe` follows the finding. No silence ⇒ `d` itself. */
44
+ * class explains); `probe` follows the finding. Whether a person was already required on the ask the check went silent over is the
45
+ * call's own fact (`pass.silencePersonRequired`), kept on the gate's pass and on no decision. No silence ⇒ `d` itself. */
43
46
  export declare function silencedBy<D extends Extract<PermissionResult, {
44
47
  action: "ask";
45
48
  }>>(d: D, verdict: ShellReadVerdict, call: {
46
49
  readonly toolCallId: string;
47
50
  readonly toolName: string;
48
- }): D;
51
+ }, pass?: Pick<GatePass, "silencePersonRequired">): D;
52
+ /** The deny rows ONE call may meet, as a confined Runner's mode point reads them: any row at all (`any`: either face, the built-in
53
+ * tiers among them) and a row that guards WRITES (`guardsWrites`: the write face's rows), on the table the call's judgment started
54
+ * with or on the one in force now (`person-path-rows.ts` `confinedDenyRowsOf`). */
55
+ export interface ConfinedDenyRows {
56
+ readonly any: boolean;
57
+ readonly guardsWrites: boolean;
58
+ }
59
+ /** The gate's `confined` seat (`ToolGateInput.confined`) — PRESENT ⇔ the Runner declares its shape (`RunnerDeps.deploymentShape`). */
60
+ export interface ConfinedSeat {
61
+ /** The call's declared destination, on these arguments, stays on the leg's hands. */
62
+ readonly staysOnHands: (args: unknown) => boolean;
63
+ /** Asking for `bypassPermissions` now would run the leg under it (the leg's own mode fold). */
64
+ readonly bypassArmed: () => boolean;
65
+ /** The deny rows the call may meet. */
66
+ readonly denyRows: () => ConfinedDenyRows;
67
+ }
68
+ /** The allow layer's read-only reading of ONE shell call's arguments — its last member's (gate-lanes.ts) and a confined Runner's mode
69
+ * point's ({@link confinedCallOf}), one reading: the command under the command rule's primary parameter, read by the one lexer;
70
+ * read-only only where it is a string, not put in the background by the parameter (`run_in_background: true` is `cmd &`, a process
71
+ * that outlives the approval-time reading) and the read-only tables prove it at `cwd`. */
72
+ export declare function readOnlyShellCall(args: unknown, cwd: string | undefined): {
73
+ readonly readOnly: true;
74
+ readonly command: string;
75
+ readonly shape: ShellCommandShape;
76
+ } | {
77
+ readonly readOnly: false;
78
+ readonly shape?: ShellCommandShape;
79
+ };
80
+ /** What a confined Runner lends the mode point for one call ({@link ConfinedCall}) — nothing where the gate holds no seat (no shape
81
+ * declared): the silence's fact on the call's pass (none ⇒ a person required), the call's destination on the arguments that run,
82
+ * what the unfinished check left unseen (the gate put the station's fallback in its place ⇒ no row at all may stand; the station
83
+ * answered ⇒ no row that guards writes, or the command read-only at `cwd`), and the leg's mode fold for a bypass request. */
84
+ export declare function confinedCallOf(seat: ConfinedSeat | undefined, pass: Pick<GatePass, "silencePersonRequired" | "shellReadFallback">, args: unknown, cwd: string | undefined): {
85
+ readonly confined?: ConfinedCall;
86
+ };
49
87
  /** The station's SILENCE ({@link readStationAnswer}), applied once, before any disposition arm: a station — a host-mounted one
50
88
  * included — may spell `vouch`, `mandated` or `ordinary` beside it, and no word vouches for what nobody judged. A deny stands; an
51
89
  * ask keeps its words and gains the silence's class; an allow becomes the silence's question (`ask.message`), one only a person
@@ -5,6 +5,10 @@ import { refusalEchoDefects } from "./refusal-echo.js";
5
5
  import { egressThrownText } from "./untrusted-egress.js";
6
6
  import { receive } from "./mods/kernel/receive.js";
7
7
  import { attest, attestationOf } from "./engine-attestation.js";
8
+ import { readOnlyShellVerdict } from "./read-only-shell.js";
9
+ import { readShellCommand } from "./shell-run-candidates.js";
10
+ import { COMMAND_RULE_TOOL } from "./permission-rule-model.js";
11
+ import { catalogRuleFaceOf } from "./tool-registry.js";
8
12
  const DISPOSITIONS = ["refuse", "mandated", "ordinary", "vouch"];
9
13
  const MEMBER_KINDS = {
10
14
  disposition: "word",
@@ -84,24 +88,39 @@ export function readStationAnswer(answer, call) {
84
88
  call.report?.(new Error(`shell read station answered out of its contract for tool "${call.toolName}"${call.toolCallId !== undefined ? ` (toolCallId ${call.toolCallId})` : ""} — ${sentence}`));
85
89
  return { kind: "refuse", verdict: { disposition: "refuse", finding: "none", sentence }, unbelieved: true };
86
90
  }
87
- export function silencedBy(d, verdict, call) {
91
+ export function silencedBy(d, verdict, call, pass) {
88
92
  const environment = verdict.environmentSilent === true || (verdict.finding === "unanswered" && verdict.rowsUnread !== true);
89
93
  if (!environment && verdict.rowsUnread !== true)
90
94
  return d;
91
95
  const rows = verdict.rowsUnread === true && d.ruleUnreadable === undefined ? { ruleUnreadable: "persisted_rows" } : {};
92
96
  const out = { ...d, ...rows, requiresRealApproval: true };
93
97
  const held = attestationOf(d, call)?.guards ?? [];
94
- return environment && !held.includes("unfinished_check") ? attest(out, call, { guards: [...held, "unfinished_check"] }) : out;
98
+ if (!environment || held.includes("unfinished_check"))
99
+ return out;
100
+ if (pass !== undefined)
101
+ pass.silencePersonRequired = d.requiresRealApproval === true;
102
+ return attest(out, call, { guards: [...held, "unfinished_check"] });
103
+ }
104
+ export function readOnlyShellCall(args, cwd) {
105
+ const record = typeof args === "object" && args !== null && !Array.isArray(args) ? args : undefined;
106
+ const command = record?.[catalogRuleFaceOf(COMMAND_RULE_TOOL)?.primaryParams[0] ?? "command"];
107
+ if (typeof command !== "string")
108
+ return { readOnly: false };
109
+ const shape = readShellCommand(command);
110
+ return record?.run_in_background !== true && readOnlyShellVerdict(command, { shape, cwd }).readOnly ? { readOnly: true, command, shape } : { readOnly: false, shape };
111
+ }
112
+ export function confinedCallOf(seat, pass, args, cwd) {
113
+ return seat === undefined ? {} : { confined: { personAlreadyRequired: () => pass.silencePersonRequired !== false, destinationOnHands: () => seat.staysOnHands(args), unseenGuardsNothing: () => ((rows) => (pass.shellReadFallback === true ? !rows.any : !rows.guardsWrites || readOnlyShellCall(args, cwd).readOnly))(seat.denyRows()), bypassArmed: seat.bypassArmed } };
95
114
  }
96
115
  export function applyUnansweredSilence(pass, verdict, ask) {
97
116
  if (verdict.details !== undefined)
98
117
  pass.shellReadDetails = verdict.details;
99
118
  if (pass.decision.action === "ask") {
100
- pass.decision = silencedBy(pass.decision, verdict, pass.req);
119
+ pass.decision = silencedBy(pass.decision, verdict, pass.req, pass);
101
120
  return;
102
121
  }
103
122
  if (pass.decision.action !== "allow")
104
123
  return;
105
- pass.decision = silencedBy({ action: "ask", message: ask.message, decisionReason: "safety", ...(ask.account !== undefined ? { probeReason: ask.account } : {}) }, verdict, pass.req);
124
+ pass.decision = silencedBy({ action: "ask", message: ask.message, decisionReason: "safety", ...(ask.account !== undefined ? { probeReason: ask.account } : {}) }, verdict, pass.req, pass);
106
125
  pass.tightenedBy = ask.tightenedBy;
107
126
  }
@@ -185,6 +185,16 @@ export async function checkpointStoreContract(make, runAssertion, options = {})
185
185
  assert.equal(got.resolvedOutcome.boundCallId, "call-3");
186
186
  assert.equal(got.rev, 2);
187
187
  });
188
+ run("a plan review's winner keeps the mode its approval named, whole, across a reopen(env_failed)", async () => {
189
+ const store = make();
190
+ const cp = createCheckpointFixture();
191
+ await store.put(cp.token, cp);
192
+ await store.resolve(cp.token, cp.scope, { gate: "plan_review", decision: "approve", hostDecision: { decidedBy: "person" }, permissionMode: "acceptEdits" });
193
+ assert.equal((await store.get(cp.token)).resolvedOutcome?.permissionMode, "acceptEdits");
194
+ assert.equal(await store.reopen(cp.token, cp.scope, "env_failed"), true);
195
+ const got = (await store.get(cp.token)).resolvedOutcome;
196
+ assert.deepEqual({ decision: got?.decision, permissionMode: got?.permissionMode }, { decision: "approve", permissionMode: "acceptEdits" });
197
+ });
188
198
  run("rev OCC: a stale-rev resolve loses, the current-rev resolve wins", async () => {
189
199
  const store = make();
190
200
  const cp = createCheckpointFixture();
@@ -0,0 +1,21 @@
1
+ import { type PeerTaskRow, type PeerTaskStore } from "../peer-task-store.js";
2
+ import { type ContractAssertionRunner } from "./contract-harness.js";
3
+ /** Primary tenant scope used across contract cases. */
4
+ export declare const PEER_TASK_CONTRACT_SCOPE = "tenant-A";
5
+ /** Build a valid {@link PeerTaskRow} fixture; overrides adjust digest and settlement pairing unless supplied explicitly. */
6
+ export declare function createPeerTaskRowFixture(over?: Partial<PeerTaskRow>): PeerTaskRow;
7
+ /** Hooks for the damaged-row clause; provide `plantRow` for persistent backends or `unplantable` with a reason. */
8
+ export interface PeerTaskStoreContractHooks {
9
+ readonly plantRow?: (store: PeerTaskStore, key: {
10
+ readonly task_id: string;
11
+ readonly scope: string;
12
+ }, raw: unknown) => Promise<PeerTaskStore>;
13
+ readonly unplantable?: string;
14
+ }
15
+ /**
16
+ * Cross-backend {@link PeerTaskStore} contract kit (vitest-free; runs under any harness or sequentially by default).
17
+ * Every bundled and third-party backend must pass all cases; pass `hooks.plantRow` to include damaged-row checks.
18
+ */
19
+ export declare function peerTaskStoreContract(mk: () => PeerTaskStore, runAssertion?: ContractAssertionRunner, hooks?: PeerTaskStoreContractHooks): Promise<void>;
20
+ /** Optional capability contract for backends implementing {@link PeerTaskStore.listScopes}. */
21
+ export declare function peerTaskStoreScopesContract(mk: () => PeerTaskStore, runAssertion?: ContractAssertionRunner): Promise<void>;