@sema-agent/core 7.70.0 → 7.71.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 (434) hide show
  1. package/CHANGELOG.md +728 -0
  2. package/dist/agents/agent-transcript-tool.js +43 -19
  3. package/dist/agents/inherited-tool-pool.d.ts +5 -1
  4. package/dist/agents/inherited-tool-pool.js +6 -0
  5. package/dist/agents/retain-ledger.js +2 -0
  6. package/dist/agents/send-message-tool.d.ts +12 -1
  7. package/dist/agents/send-message-tool.js +47 -9
  8. package/dist/agents/subagent.js +31 -10
  9. package/dist/agents/tool-filter.js +1 -2
  10. package/dist/agents/verify.js +13 -2
  11. package/dist/agents/yield-adoption.js +11 -1
  12. package/dist/brain/claude-model-id.d.ts +11 -0
  13. package/dist/brain/claude-model-id.js +3 -1
  14. package/dist/config/catalog.js +10 -1
  15. package/dist/config/defaults.d.ts +3 -0
  16. package/dist/config/defaults.js +1 -0
  17. package/dist/core/allow-entry.js +1 -2
  18. package/dist/core/ask-origin.d.ts +55 -21
  19. package/dist/core/ask-origin.js +19 -11
  20. package/dist/core/ask-question.d.ts +4 -7
  21. package/dist/core/ask-question.js +2 -4
  22. package/dist/core/ask-unresolvable-notice.d.ts +17 -3
  23. package/dist/core/ask-unresolvable-notice.js +18 -4
  24. package/dist/core/attachment-source.d.ts +1 -1
  25. package/dist/core/attachment-source.js +2 -0
  26. package/dist/core/auto-compaction.d.ts +14 -4
  27. package/dist/core/auto-compaction.js +3 -2
  28. package/dist/core/auto-strip.js +2 -0
  29. package/dist/core/caller-text.d.ts +2 -33
  30. package/dist/core/caller-text.js +2 -23
  31. package/dist/core/caller-tool-name.js +1 -2
  32. package/dist/core/canonical-json.d.ts +9 -0
  33. package/dist/core/canonical-json.js +6 -0
  34. package/dist/core/checkpoint-features.d.ts +43 -80
  35. package/dist/core/checkpoint-features.js +10 -20
  36. package/dist/core/checkpoint-generation.d.ts +89 -19
  37. package/dist/core/checkpoint-generation.js +89 -14
  38. package/dist/core/checkpoint-queries.d.ts +95 -15
  39. package/dist/core/checkpoint-queries.js +108 -7
  40. package/dist/core/checkpoint-rekey.d.ts +2 -1
  41. package/dist/core/checkpoint-rekey.js +2 -2
  42. package/dist/core/checkpoint-requirements.d.ts +7 -6
  43. package/dist/core/checkpoint-requirements.js +2 -5
  44. package/dist/core/checkpoint-row-verdict.d.ts +3 -4
  45. package/dist/core/checkpoint-row-verdict.js +20 -41
  46. package/dist/core/checkpoint-store.d.ts +65 -41
  47. package/dist/core/checkpoint-store.js +28 -14
  48. package/dist/core/command-sandbox.d.ts +5 -3
  49. package/dist/core/command-sandbox.js +17 -9
  50. package/dist/core/config-refusal-codes.d.ts +1 -1
  51. package/dist/core/config-refusal-codes.js +1 -0
  52. package/dist/core/declaration-words.d.ts +2 -1
  53. package/dist/core/declaration-words.js +13 -2
  54. package/dist/core/effective-path-target.d.ts +23 -0
  55. package/dist/core/effective-path-target.js +15 -1
  56. package/dist/core/engine-attestation.d.ts +5 -1
  57. package/dist/core/engine-attestation.js +1 -0
  58. package/dist/core/engine-capabilities.d.ts +14 -9
  59. package/dist/core/engine-capabilities.js +1 -1
  60. package/dist/core/engine-notice.d.ts +62 -32
  61. package/dist/core/engine-version.js +1 -1
  62. package/dist/core/entries-not-applied.d.ts +1 -1
  63. package/dist/core/entries-not-applied.js +1 -0
  64. package/dist/core/file-history-store.d.ts +95 -11
  65. package/dist/core/file-history-store.js +117 -19
  66. package/dist/core/gate-fold.js +13 -7
  67. package/dist/core/gate-lanes.js +9 -9
  68. package/dist/core/governance-codes.d.ts +56 -7
  69. package/dist/core/governance-codes.js +105 -7
  70. package/dist/core/grant-holder.d.ts +53 -0
  71. package/dist/core/grant-holder.js +80 -0
  72. package/dist/core/hooks.d.ts +7 -3
  73. package/dist/core/hooks.js +2 -2
  74. package/dist/core/locked-config.d.ts +7 -1
  75. package/dist/core/locked-config.js +9 -2
  76. package/dist/core/mcp-call-meta.d.ts +52 -7
  77. package/dist/core/mcp-call-meta.js +21 -2
  78. package/dist/core/mcp-host-read.d.ts +1 -1
  79. package/dist/core/mcp-server-spec.d.ts +18 -0
  80. package/dist/core/mcp-server-spec.js +1 -0
  81. package/dist/core/mcp.js +2 -2
  82. package/dist/core/member-outcome.d.ts +22 -1
  83. package/dist/core/member-outcome.js +18 -6
  84. package/dist/core/memory-engine/delegation-settlement.js +5 -5
  85. package/dist/core/memory-engine/engine.js +19 -19
  86. package/dist/core/memory-engine/file-backend.d.ts +7 -2
  87. package/dist/core/memory-engine/file-backend.js +14 -12
  88. package/dist/core/memory-engine/frontmatter.js +1 -1
  89. package/dist/core/memory-engine/index.d.ts +1 -0
  90. package/dist/core/memory-engine/index.js +1 -0
  91. package/dist/core/memory-engine/layout.d.ts +34 -9
  92. package/dist/core/memory-engine/layout.js +36 -19
  93. package/dist/core/memory-engine/memory-deployment.js +8 -8
  94. package/dist/core/memory-engine/mount-failed-notice.d.ts +8 -5
  95. package/dist/core/memory-engine/mount-failed-notice.js +5 -2
  96. package/dist/core/mode-policy.d.ts +5 -0
  97. package/dist/core/mode-policy.js +6 -0
  98. package/dist/core/mods/host.d.ts +2 -1
  99. package/dist/core/mods/host.js +7 -6
  100. package/dist/core/mods/kernel/index.d.ts +1 -1
  101. package/dist/core/mods/kernel/index.js +1 -1
  102. package/dist/core/mods/kernel/registration.d.ts +5 -2
  103. package/dist/core/mods/kernel/registration.js +19 -3
  104. package/dist/core/mods/package.d.ts +12 -1
  105. package/dist/core/mods/package.js +36 -9
  106. package/dist/core/mods/stations.d.ts +7 -1
  107. package/dist/core/mods/stations.js +17 -3
  108. package/dist/core/mods/teammate-stations.d.ts +4 -1
  109. package/dist/core/mods/teammate-stations.js +1 -1
  110. package/dist/core/native-signal.d.ts +13 -0
  111. package/dist/core/native-signal.js +18 -0
  112. package/dist/core/park-resumability.d.ts +16 -14
  113. package/dist/core/park-resumability.js +9 -4
  114. package/dist/core/path-rule-binding.js +1 -1
  115. package/dist/core/permission-rule-model.d.ts +11 -5
  116. package/dist/core/permission-rule-model.js +5 -3
  117. package/dist/core/permission-rule-org.js +1 -1
  118. package/dist/core/permission-rule-provider.d.ts +5 -1
  119. package/dist/core/permission-rule-provider.js +6 -1
  120. package/dist/core/permission-rule-session.d.ts +35 -5
  121. package/dist/core/permission-rule-session.js +32 -1
  122. package/dist/core/permission-rule-store.d.ts +5 -1
  123. package/dist/core/permission-rule-store.js +28 -5
  124. package/dist/core/permission-rules.d.ts +2 -2
  125. package/dist/core/permission-rules.js +2 -3
  126. package/dist/core/principal-name.d.ts +12 -0
  127. package/dist/core/principal-name.js +6 -2
  128. package/dist/core/read-root-grant-screen.d.ts +7 -6
  129. package/dist/core/read-root-grant-screen.js +7 -8
  130. package/dist/core/remote-env.d.ts +42 -8
  131. package/dist/core/resume-config-judge.js +1 -1
  132. package/dist/core/resume-startup-cause.d.ts +19 -4
  133. package/dist/core/resume-startup-cause.js +25 -6
  134. package/dist/core/rewind-conversation.d.ts +4 -0
  135. package/dist/core/rewrite-rejudge.d.ts +9 -1
  136. package/dist/core/rewrite-rejudge.js +11 -1
  137. package/dist/core/rule-offer-read.js +3 -2
  138. package/dist/core/runner/assemble-result.d.ts +21 -11
  139. package/dist/core/runner/assemble-result.js +24 -4
  140. package/dist/core/runner/boundary-reminders.d.ts +104 -0
  141. package/dist/core/runner/boundary-reminders.js +108 -0
  142. package/dist/core/runner/branch-writeback.d.ts +21 -7
  143. package/dist/core/runner/branch-writeback.js +44 -6
  144. package/dist/core/runner/command-sandbox-frame.js +2 -1
  145. package/dist/core/runner/compact-session.js +11 -4
  146. package/dist/core/runner/constraint-layers.d.ts +24 -5
  147. package/dist/core/runner/constraint-layers.js +21 -2
  148. package/dist/core/runner/continuation-gate.js +3 -1
  149. package/dist/core/runner/contracts.d.ts +83 -13
  150. package/dist/core/runner/cross-boundary-lane.js +2 -1
  151. package/dist/core/runner/delegation-owner.d.ts +246 -45
  152. package/dist/core/runner/delegation-owner.js +237 -63
  153. package/dist/core/runner/expire-settle.d.ts +17 -0
  154. package/dist/core/runner/expire-settle.js +8 -2
  155. package/dist/core/runner/file-history-request.d.ts +4 -3
  156. package/dist/core/runner/file-history-request.js +4 -1
  157. package/dist/core/runner/file-history-restore.d.ts +11 -3
  158. package/dist/core/runner/file-history-restore.js +11 -3
  159. package/dist/core/runner/gate-exit.d.ts +22 -1
  160. package/dist/core/runner/gate-exit.js +12 -14
  161. package/dist/core/runner/nested-memory-content.js +1 -1
  162. package/dist/core/runner/nested-memory-lane.d.ts +10 -2
  163. package/dist/core/runner/nested-memory-lane.js +29 -8
  164. package/dist/core/runner/own-model-money-door.d.ts +13 -0
  165. package/dist/core/runner/own-model-money-door.js +17 -0
  166. package/dist/core/runner/park-commit.d.ts +4 -2
  167. package/dist/core/runner/park-commit.js +2 -1
  168. package/dist/core/runner/permission-rule-lanes.d.ts +4 -0
  169. package/dist/core/runner/permission-rule-lanes.js +7 -0
  170. package/dist/core/runner/person-path-rows.js +1 -1
  171. package/dist/core/runner/placement-fence.d.ts +8 -2
  172. package/dist/core/runner/placement-fence.js +8 -3
  173. package/dist/core/runner/policy-throw.d.ts +3 -2
  174. package/dist/core/runner/policy-throw.js +2 -2
  175. package/dist/core/runner/prepare-acquire-reconcile.d.ts +23 -14
  176. package/dist/core/runner/prepare-acquire-reconcile.js +33 -15
  177. package/dist/core/runner/prepare-artifact.d.ts +14 -1
  178. package/dist/core/runner/prepare-artifact.js +7 -2
  179. package/dist/core/runner/prepare-ask-lane.d.ts +8 -0
  180. package/dist/core/runner/prepare-ask-lane.js +14 -5
  181. package/dist/core/runner/prepare-boundary-parks.js +5 -4
  182. package/dist/core/runner/prepare-config-doors.d.ts +9 -4
  183. package/dist/core/runner/prepare-config-doors.js +25 -8
  184. package/dist/core/runner/prepare-defer-classify.d.ts +8 -4
  185. package/dist/core/runner/prepare-defer-classify.js +6 -6
  186. package/dist/core/runner/prepare-execution-env.d.ts +4 -1
  187. package/dist/core/runner/prepare-execution-env.js +8 -3
  188. package/dist/core/runner/prepare-file-history.d.ts +26 -0
  189. package/dist/core/runner/prepare-file-history.js +15 -1
  190. package/dist/core/runner/prepare-inherited-gate.d.ts +8 -3
  191. package/dist/core/runner/prepare-inherited-gate.js +9 -2
  192. package/dist/core/runner/prepare-leg-adoption.d.ts +2 -2
  193. package/dist/core/runner/prepare-park-ask.js +8 -5
  194. package/dist/core/runner/prepare-policy-chain.d.ts +5 -0
  195. package/dist/core/runner/prepare-policy-chain.js +18 -7
  196. package/dist/core/runner/prepare-prompt-assembly.d.ts +3 -0
  197. package/dist/core/runner/prepare-prompt-assembly.js +4 -3
  198. package/dist/core/runner/prepare-suspend-saga.d.ts +4 -1
  199. package/dist/core/runner/prepare-suspend-saga.js +19 -5
  200. package/dist/core/runner/prepare-task.d.ts +2 -5
  201. package/dist/core/runner/prepare-task.js +71 -26
  202. package/dist/core/runner/prepare-turn-wiring.js +7 -5
  203. package/dist/core/runner/prepare-workspace-restore.js +59 -28
  204. package/dist/core/runner/read-root-grant.d.ts +1 -0
  205. package/dist/core/runner/read-root-grant.js +1 -2
  206. package/dist/core/runner/resume-admission.d.ts +3 -0
  207. package/dist/core/runner/resume-admission.js +6 -4
  208. package/dist/core/runner/resume-apply.js +7 -5
  209. package/dist/core/runner/resume-claim.d.ts +2 -2
  210. package/dist/core/runner/resume-claim.js +4 -4
  211. package/dist/core/runner/resume-policy-outcome.d.ts +1 -1
  212. package/dist/core/runner/resume-policy-outcome.js +6 -4
  213. package/dist/core/runner/resume-preflight.d.ts +3 -0
  214. package/dist/core/runner/resume-preflight.js +10 -3
  215. package/dist/core/runner/rewind-conversation.js +11 -4
  216. package/dist/core/runner/rewind-files.js +29 -14
  217. package/dist/core/runner/rewind-outcome.d.ts +27 -0
  218. package/dist/core/runner/rewind-outcome.js +14 -0
  219. package/dist/core/runner/run-attachment-seats.js +2 -1
  220. package/dist/core/runner/run-clock-and-content.js +2 -0
  221. package/dist/core/runner/run-identity-wiring.js +2 -0
  222. package/dist/core/runner/run-leg.js +11 -1
  223. package/dist/core/runner/run-notification-lane.d.ts +3 -0
  224. package/dist/core/runner/run-notification-lane.js +2 -2
  225. package/dist/core/runner/run-settle-and-teardown.d.ts +4 -2
  226. package/dist/core/runner/run-settle-and-teardown.js +52 -40
  227. package/dist/core/runner/run-stop-and-final-verify.d.ts +4 -0
  228. package/dist/core/runner/run-stop-and-final-verify.js +5 -4
  229. package/dist/core/runner/run-terminal-adoption.d.ts +1 -1
  230. package/dist/core/runner/run-terminal-adoption.js +3 -3
  231. package/dist/core/runner/run-turn-boundary.js +7 -0
  232. package/dist/core/runner/runtask.d.ts +7 -4
  233. package/dist/core/runner/runtask.js +18 -9
  234. package/dist/core/runner/session-call-grant-station.d.ts +64 -0
  235. package/dist/core/runner/session-call-grant-station.js +119 -0
  236. package/dist/core/runner/session-file-state-replay.js +2 -2
  237. package/dist/core/runner/session-prompt-seats.d.ts +95 -0
  238. package/dist/core/runner/session-prompt-seats.js +62 -0
  239. package/dist/core/runner/session-rule-policy.js +1 -1
  240. package/dist/core/runner/session-write-ledger.d.ts +8 -0
  241. package/dist/core/runner/session-write-ledger.js +16 -0
  242. package/dist/core/runner/side-call-account.js +5 -1
  243. package/dist/core/runner/stop-tail-notice.d.ts +7 -0
  244. package/dist/core/runner/stop-tail-notice.js +23 -8
  245. package/dist/core/runner/stream-reap.js +4 -2
  246. package/dist/core/runner/stream-settle-backstop.d.ts +1 -1
  247. package/dist/core/runner/stream-settle-backstop.js +17 -18
  248. package/dist/core/runner/terminal-account.js +17 -8
  249. package/dist/core/runner/terminal-projection.d.ts +3 -2
  250. package/dist/core/runner/terminal-projection.js +1 -1
  251. package/dist/core/runner/tool-turn-repair-seat.d.ts +2 -2
  252. package/dist/core/runner/tool-turn-repair-seat.js +12 -7
  253. package/dist/core/runner/turn-attachments.d.ts +22 -1
  254. package/dist/core/runner/turn-attachments.js +20 -3
  255. package/dist/core/runner-deps.d.ts +6 -2
  256. package/dist/core/secret-env.d.ts +26 -6
  257. package/dist/core/secret-env.js +6 -6
  258. package/dist/core/session-call-grant-screen.d.ts +58 -0
  259. package/dist/core/session-call-grant-screen.js +18 -0
  260. package/dist/core/session-call-grant.d.ts +93 -0
  261. package/dist/core/session-call-grant.js +524 -0
  262. package/dist/core/session-checkout.d.ts +3 -0
  263. package/dist/core/session-checkout.js +8 -3
  264. package/dist/core/session-policy-store.d.ts +14 -0
  265. package/dist/core/session-policy-store.js +16 -2
  266. package/dist/core/session-store.d.ts +18 -1
  267. package/dist/core/session-store.js +20 -4
  268. package/dist/core/session.d.ts +36 -4
  269. package/dist/core/shared-artifact-reads.d.ts +93 -0
  270. package/dist/core/shared-artifact-reads.js +94 -0
  271. package/dist/core/skill-grant.js +1 -1
  272. package/dist/core/skills-directory.d.ts +9 -45
  273. package/dist/core/skills-directory.js +9 -722
  274. package/dist/core/spend-account.js +3 -0
  275. package/dist/core/store-contracts/checkpoint-store-contract.d.ts +22 -4
  276. package/dist/core/store-contracts/checkpoint-store-contract.js +363 -29
  277. package/dist/core/store-contracts/file-history-store-contract.d.ts +11 -3
  278. package/dist/core/store-contracts/file-history-store-contract.js +62 -2
  279. package/dist/core/store-contracts/grant-fixture.d.ts +52 -0
  280. package/dist/core/store-contracts/grant-fixture.js +84 -0
  281. package/dist/core/store-contracts/session-repo-contract.js +18 -0
  282. package/dist/core/store-contracts/session-store-contract.d.ts +15 -1
  283. package/dist/core/store-contracts/session-store-contract.js +211 -2
  284. package/dist/core/store-contracts/workflow-journal-store-contract.js +47 -8
  285. package/dist/core/suspend-lane-reasons.d.ts +13 -0
  286. package/dist/core/suspend-lane-reasons.js +5 -0
  287. package/dist/core/synthetic-read-verdict.d.ts +5 -3
  288. package/dist/core/synthetic-read-verdict.js +1 -1
  289. package/dist/core/task-limits.d.ts +15 -0
  290. package/dist/core/task-notification.d.ts +33 -7
  291. package/dist/core/task-notification.js +34 -9
  292. package/dist/core/task-registry-agent.d.ts +1 -1
  293. package/dist/core/task-registry-agent.js +18 -7
  294. package/dist/core/task-registry-shared.d.ts +29 -4
  295. package/dist/core/task-registry-shared.js +7 -0
  296. package/dist/core/task-registry.d.ts +21 -1
  297. package/dist/core/task-registry.js +36 -9
  298. package/dist/core/task-result.d.ts +55 -1
  299. package/dist/core/task-spec.d.ts +17 -3
  300. package/dist/core/terminal-cause.d.ts +68 -5
  301. package/dist/core/tool-catalog-entries.js +1 -1
  302. package/dist/core/tool-check-reading.js +2 -1
  303. package/dist/core/tool-errors.js +1 -0
  304. package/dist/core/tool-list-grammar.d.ts +0 -47
  305. package/dist/core/tool-list-grammar.js +1 -75
  306. package/dist/core/tool-model-gate.d.ts +7 -11
  307. package/dist/core/tool-model-gate.js +5 -8
  308. package/dist/core/tool-name-aliases.js +2 -3
  309. package/dist/core/tool-name-readings.d.ts +4 -0
  310. package/dist/core/tool-name-readings.js +1 -0
  311. package/dist/core/tool-policy.d.ts +46 -4
  312. package/dist/core/tool-policy.js +47 -18
  313. package/dist/core/tool-result-store.d.ts +0 -24
  314. package/dist/core/tool-result-store.js +1 -36
  315. package/dist/core/tool-spec.d.ts +8 -4
  316. package/dist/core/untrusted-egress.js +2 -2
  317. package/dist/core/untrusted-text.d.ts +8 -0
  318. package/dist/core/untrusted-text.js +14 -0
  319. package/dist/core/user-attachment.d.ts +16 -1
  320. package/dist/core/user-attachment.js +42 -18
  321. package/dist/core/wiring-manifest.d.ts +4 -9
  322. package/dist/core/wiring-manifest.js +1 -1
  323. package/dist/core/workflow-journal-store.d.ts +55 -8
  324. package/dist/core/workflow-journal-store.js +34 -10
  325. package/dist/core/workflow-run-store-contract.js +56 -1
  326. package/dist/core/workflow-run-store.d.ts +43 -19
  327. package/dist/core/workflow-run-store.js +17 -2
  328. package/dist/engine/execution-env/node-execution-env.d.ts +3 -0
  329. package/dist/engine/execution-env/node-execution-env.js +4 -0
  330. package/dist/engine/harness/agent-harness.d.ts +10 -5
  331. package/dist/engine/harness/agent-harness.js +12 -4
  332. package/dist/engine/harness/types.d.ts +18 -0
  333. package/dist/engine/llm/tool-turns.d.ts +1 -1
  334. package/dist/engine/llm/types.d.ts +5 -4
  335. package/dist/engine/session/memory-repo.d.ts +15 -3
  336. package/dist/engine/session/memory-repo.js +21 -3
  337. package/dist/engine/session/memory-storage.d.ts +5 -0
  338. package/dist/engine/session/memory-storage.js +8 -3
  339. package/dist/engine/session/repo-utils.d.ts +9 -0
  340. package/dist/engine/session/repo-utils.js +14 -0
  341. package/dist/engine/session/storage-base.d.ts +20 -7
  342. package/dist/engine/session/storage-base.js +13 -1
  343. package/dist/index.d.ts +37 -19
  344. package/dist/index.js +30 -15
  345. package/dist/internal/harness.d.ts +1 -1
  346. package/dist/internal/harness.js +1 -1
  347. package/dist/orchestration/run-workflow-tool.d.ts +13 -1
  348. package/dist/orchestration/run-workflow-tool.js +101 -32
  349. package/dist/orchestration/workflow-park-adoption.d.ts +309 -92
  350. package/dist/orchestration/workflow-park-adoption.js +588 -323
  351. package/dist/orchestration/workflow-tree-id.d.ts +66 -0
  352. package/dist/orchestration/workflow-tree-id.js +66 -0
  353. package/dist/orchestration/workflow-types.d.ts +90 -11
  354. package/dist/orchestration/workflow-types.js +10 -1
  355. package/dist/orchestration/workflow.d.ts +30 -4
  356. package/dist/orchestration/workflow.js +424 -114
  357. package/dist/prompt-assembly/catalog/constitution.js +5 -1
  358. package/dist/prompt-assembly/catalog/core-behavior.d.ts +3 -4
  359. package/dist/prompt-assembly/catalog/core-behavior.js +61 -22
  360. package/dist/prompt-assembly/catalog/environment.js +2 -2
  361. package/dist/prompt-assembly/catalog/events.d.ts +16 -0
  362. package/dist/prompt-assembly/catalog/events.js +2 -0
  363. package/dist/prompt-assembly/catalog/locales/zh-Hans/core-behavior.js +72 -44
  364. package/dist/prompt-assembly/catalog/locales/zh-Hans/environment.js +2 -2
  365. package/dist/prompt-assembly/catalog/locales/zh-Hans/events.js +2 -0
  366. package/dist/prompt-assembly/catalog/schema.d.ts +5 -1
  367. package/dist/prompt-assembly/catalog/schema.js +2 -0
  368. package/dist/prompt-assembly/catalog/sections.js +3 -14
  369. package/dist/prompt-assembly/event-registry.js +2 -0
  370. package/dist/prompt-assembly/select.js +1 -0
  371. package/dist/prompt-assembly/tool-catalog.d.ts +10 -7
  372. package/dist/prompt-assembly/tool-catalog.js +21 -7
  373. package/dist/prompt-assembly/types.d.ts +3 -0
  374. package/dist/prompts/default.d.ts +4 -1
  375. package/dist/prompts/default.js +6 -0
  376. package/dist/stores/file/checkpoint-store.d.ts +11 -10
  377. package/dist/stores/file/checkpoint-store.js +36 -10
  378. package/dist/stores/file/file-history-store.d.ts +6 -0
  379. package/dist/stores/file/file-history-store.js +21 -4
  380. package/dist/stores/file/fs-atomic.d.ts +1 -1
  381. package/dist/stores/file/index.d.ts +14 -4
  382. package/dist/stores/file/index.js +21 -5
  383. package/dist/stores/file/process-anchor.d.ts +9 -1
  384. package/dist/stores/file/session-policy-store.js +2 -17
  385. package/dist/stores/file/session-store.d.ts +27 -0
  386. package/dist/stores/file/session-store.js +81 -9
  387. package/dist/stores/file/workflow-journal-store.d.ts +14 -4
  388. package/dist/stores/file/workflow-journal-store.js +32 -24
  389. package/dist/stores/file/workflow-run-store.d.ts +15 -4
  390. package/dist/stores/file/workflow-run-store.js +76 -0
  391. package/dist/tools/artifact/artifact-tool.d.ts +10 -3
  392. package/dist/tools/artifact/artifact-tool.js +16 -1
  393. package/dist/tools/fs/bash-program-position.d.ts +10 -4
  394. package/dist/tools/fs/bash-program-position.js +11 -8
  395. package/dist/tools/fs/bash-readonly-classifier.d.ts +3 -1
  396. package/dist/tools/fs/bash-readonly-classifier.js +9 -2
  397. package/dist/tools/fs/find-actions.d.ts +30 -16
  398. package/dist/tools/fs/find-actions.js +272 -19
  399. package/dist/tools/fs/fs-bash.js +8 -5
  400. package/dist/tools/fs/fs-shared.d.ts +0 -29
  401. package/dist/tools/fs/fs-shared.js +0 -5
  402. package/dist/tools/fs/fs-write.js +2 -1
  403. package/dist/tools/fs/read-deny.d.ts +6 -1
  404. package/dist/tools/fs/read-deny.js +6 -1
  405. package/dist/tools/fs/read-floor.d.ts +6 -0
  406. package/dist/tools/fs/read-floor.js +5 -1
  407. package/dist/tools/fs/removal-actions.d.ts +43 -0
  408. package/dist/tools/fs/removal-actions.js +25 -0
  409. package/dist/tools/fs/removal-targets.d.ts +2 -21
  410. package/dist/tools/fs/removal-targets.js +2 -3
  411. package/dist/tools/fs/safety.d.ts +37 -1
  412. package/dist/tools/fs/safety.js +52 -0
  413. package/dist/tools/fs/shell-climb.d.ts +46 -0
  414. package/dist/tools/fs/shell-climb.js +79 -0
  415. package/dist/tools/fs/shell-read-check.js +47 -19
  416. package/dist/tools/fs/shell-read-establish.js +36 -22
  417. package/dist/tools/fs/shell-read-judge.d.ts +10 -2
  418. package/dist/tools/fs/shell-read-judge.js +4 -4
  419. package/dist/tools/fs/shell-read-plan.d.ts +3 -0
  420. package/dist/tools/fs/shell-read-plan.js +1 -1
  421. package/dist/tools/fs/shell-read-workdir.js +3 -2
  422. package/dist/tools/fs/shell-read-write-targets.d.ts +4 -3
  423. package/dist/tools/fs/shell-read-write-targets.js +3 -0
  424. package/package.json +2 -2
  425. package/test/export-surface.snapshot.json +169 -15
  426. package/wire-changes/core-stores-sql@7.71.0.json +40 -0
  427. package/wire-changes/core@7.71.0.json +5827 -0
  428. package/wire-changes/mods-kernel@7.71.0.json +52 -0
  429. package/wire-changes/primitives@7.71.0.json +473 -0
  430. package/wire-changes/wiki-gate@7.71.0.json +40 -0
  431. package/dist/core/frontmatter-fence.d.ts +0 -10
  432. package/dist/core/frontmatter-fence.js +0 -6
  433. package/dist/core/permission-rule-syntax.d.ts +0 -46
  434. package/dist/core/permission-rule-syntax.js +0 -52
@@ -48,9 +48,9 @@ export type ToolTurnIncompleteItem = {
48
48
  * end before its batch runs. The turn boundary does not read it: whether the turn owes the next request is the loop's
49
49
  * own decision (a batch can end the run), handed to the boundary as `continues`. */
50
50
  export declare function turnCarriesToolCall(content: unknown): boolean;
51
- /** The person's line for one cause — once per run per cause, whichever observer saw it first. */
51
+ /** The person's line for one cause — once per run per code per cause, whichever observer saw it first. */
52
52
  export interface ToolTurnIncompleteSeat {
53
- /** Announce `item` unless this run already said its cause. */
53
+ /** Announce `item` unless this run already said it under its code for its cause. */
54
54
  announce(item: ToolTurnIncompleteItem): void;
55
55
  /** Observe one assistant message: announces each stream drop it reports (`streamDropsOf`), worded by what became of the turn. */
56
56
  observe(message: {
@@ -12,6 +12,8 @@ const FORM_SENTENCE = {
12
12
  duplicate_call: "a second call with the same id in one assistant message was left out (its results answer the first)",
13
13
  orphan_result: "a result that answers no call before it was left out",
14
14
  };
15
+ const INCOMPLETE_CODE = "task.tool_turn_incomplete";
16
+ const UNRECOVERED_CODE = "task.tool_turn_unrecovered";
15
17
  const afterDroppedCalls = (outcome) => outcome === "reissued" ? "; the model was asked to re-issue them" : outcome === "terminal" ? "; the run ended with this turn (the model's output was invalid)" : "";
16
18
  const INCOMPLETE_SENTENCE = {
17
19
  truncated: (i) => `${i.count} tool call(s) the model made were cut off before their arguments were complete, so they did not run${afterDroppedCalls(i.outcome)}`,
@@ -53,15 +55,18 @@ function turnFactsOf(message) {
53
55
  export function createToolTurnIncompleteSeat(onNotice, ids, reasksSoFar) {
54
56
  const announced = new Set();
55
57
  const announce = (item) => {
56
- if (announced.has(item.cause))
58
+ const said = "outcome" in item && item.outcome !== undefined;
59
+ const key = `${said ? INCOMPLETE_CODE : UNRECOVERED_CODE}\u0000${item.cause}`;
60
+ if (announced.has(key))
57
61
  return;
58
- announced.add(item.cause);
62
+ announced.add(key);
59
63
  const shown = "toolCallIds" in item ? item.toolCallIds.filter((id) => isProviderEchoShape(id)) : [];
60
- deliverEngineNotice(onNotice, {
61
- code: "task.tool_turn_incomplete",
62
- message: `${INCOMPLETE_SENTENCE[item.cause](item)}. Announced once per run for this cause.`,
63
- detail: { cause: item.cause, count: item.count, ...("outcome" in item && item.outcome !== undefined ? { outcome: item.outcome } : {}), ...("facts" in item ? item.facts : {}), ...("reasksSoFar" in item && item.reasksSoFar !== undefined ? { reasksSoFar: item.reasksSoFar } : {}), ...(shown.length > 0 ? { toolCallIds: shown } : {}), sessionId: ids.sessionId, runId: ids.runId },
64
- });
64
+ const message = `${INCOMPLETE_SENTENCE[item.cause](item)}. Announced once per run for this code and cause.`;
65
+ const detail = { cause: item.cause, count: item.count, ...("outcome" in item && item.outcome !== undefined ? { outcome: item.outcome } : {}), ...("facts" in item ? item.facts : {}), ...("reasksSoFar" in item && item.reasksSoFar !== undefined ? { reasksSoFar: item.reasksSoFar } : {}), ...(shown.length > 0 ? { toolCallIds: shown } : {}), sessionId: ids.sessionId, runId: ids.runId };
66
+ if (said)
67
+ deliverEngineNotice(onNotice, { code: INCOMPLETE_CODE, message, detail });
68
+ else
69
+ deliverEngineNotice(onNotice, { code: UNRECOVERED_CODE, message, detail });
65
70
  };
66
71
  return {
67
72
  announce,
@@ -8,6 +8,7 @@ import { type BackgroundTaskTableRow } from "../task-notification.js";
8
8
  import { type SkillListingEntry, type SkillsBlockRender } from "./synthetic-tools.js";
9
9
  import { type ResolvedSkillListingBudget } from "../skill-listing-budget.js";
10
10
  import { type EngineText } from "../../prompt-assembly/engine-text.js";
11
+ import { type SilentStretch, type SilentTurnReminderArm } from "./boundary-reminders.js";
11
12
  /**
12
13
  * Turn-boundary attachment seam: the PURE producer layer (CC `getContextAttachments`
13
14
  * parity). This module is the single home of the CC-parity cadence judgment; the words of every frame whose kind a task
@@ -386,6 +387,14 @@ export interface AttachmentInputs {
386
387
  used: number;
387
388
  total: number;
388
389
  };
390
+ /** The current stretch of silence, read off the rows the next request is built from ({@link readSilentStretch}), with the
391
+ * time on the rows' clock — passed only when the silent reminder's arm is on. */
392
+ silentTurn?: {
393
+ readonly stretch: SilentStretch;
394
+ readonly now: number;
395
+ };
396
+ /** The time since the session's clock started (ms) — passed only when the elapsed-time reminder is on. */
397
+ elapsedMs?: number;
389
398
  config: {
390
399
  todoReminder: boolean;
391
400
  /** 口径③ — CC `r2o()` kill-switch parity (pretty.js:479167-479171; consumed by both producers at
@@ -458,6 +467,11 @@ export interface AttachmentInputs {
458
467
  * TOTAL_TOKENS_REMINDER_DEFAULT_MODE}. A value outside the closed set is refused at the config
459
468
  * door (`config.attachment_invalid`), never folded to the default. */
460
469
  totalTokensReminderMode?: TotalTokensReminderMode;
470
+ /** The silent-turn reminder's arm, as prepare resolved it (`Prepared.runTimeReminders.lane`, boundary-reminders.ts): the
471
+ * model's traits, the task's switch, a top-level leg. Absent or `off` ⇒ silent. */
472
+ silentTurnReminder?: SilentTurnReminderArm;
473
+ /** The elapsed-time reminder, as prepare resolved it (same lane). */
474
+ elapsedTimeReminder?: boolean;
461
475
  /** G1: post-compact background-task announce (opt-in, default OFF like the 133 members). */
462
476
  backgroundTasks?: boolean;
463
477
  /** G1: deferred-tool materialization announce (setTools delta → boundary notice). */
@@ -557,7 +571,7 @@ export interface AttachmentInputs {
557
571
  * consumes (nothing is rendered, so nothing is owed).
558
572
  *
559
573
  * Returns attachments in EVIDENCE-STRENGTH order (todo/task → tool_search_usage_reminder →
560
- * output_style → budget_usd → total_tokens_reminder → background_tasks → tools_delta → agent_listing →
574
+ * output_style → silent_turn_reminder → elapsed_time_reminder → budget_usd → total_tokens_reminder → background_tasks → tools_delta → agent_listing →
561
575
  * skills_listing → mcp_instructions → mcp_dropped_tools → changed_files), which is also the §R3
562
576
  * MED-6 truncation order read backwards: under the 8KB cap changed_files is sacrificed first, the
563
577
  * todo/task list last. The G1/续批 members are registry/engine ground truth (strong), but the
@@ -630,6 +644,10 @@ export declare function renderDateChange(newDate: string, say: EngineText): stri
630
644
  * `state.announcedDate = today` when the carrying message's receipt settles (see {@link DateChangeState}).
631
645
  */
632
646
  export declare function collectDateChange(state: DateChangeState, today: string, say: EngineText): TurnAttachment | undefined;
647
+ /** The silent-turn reminder's one sentence. */
648
+ export declare function renderSilentTurnReminder(say: EngineText): string;
649
+ /** The elapsed-time reminder for a duration: whole minutes and the seconds past them in two digits ({@link elapsedTimeSlots}). */
650
+ export declare function renderElapsedTime(ms: number, say: EngineText): string;
633
651
  export declare function renderBudgetUsd(used: number, total: number, say?: EngineText): string;
634
652
  /**
635
653
  * The whole body is the one-line envelope (cli296.js:188983): "<total_tokens>N tokens left</total_tokens>",
@@ -688,6 +706,9 @@ export declare function renderMcpUnavailable(entries: ReadonlyArray<McpUnavailab
688
706
  * default, a boolean is itself (an explicit `true` is not vetoed by a registry flip), anything else is refused by name
689
707
  * (`config.invalid_argument`, `detail.field`), never read as either state. */
690
708
  export declare function mcpUnavailableOn(cfg: TaskSpec["attachments"] | null): boolean;
709
+ /** The boolean switches of the attachments config whose absence is their kind's registry default — one reading for each, asked
710
+ * by the config door and by the lane: absent is the registry's default, a boolean is itself, anything else is refused by name. */
711
+ export declare function attachmentSwitchOn(cfg: TaskSpec["attachments"] | null, key: "mcpUnavailable" | "silentTurnReminder" | "elapsedTimeReminder", kind: AttachmentSource): boolean;
691
712
  /** The `mcp_unavailable` frame a leg's first request owes — a fresh leg's first message or a resumed leg's continuation, the one
692
713
  * request every leg makes — or undefined (the lane is off, or nothing is pending). `entries` is what the frame names; the
693
714
  * carrying message's receipt settles exactly those. */
@@ -10,6 +10,7 @@ import { foldListingWithin, foldRemovalArmWithin, removalArmFloor } from "./list
10
10
  import { EVENT_PROMPT_REGISTRY, eventDefaultOn, eventMaxBytes } from "../../prompt-assembly/event-registry.js";
11
11
  import { engineTextFor } from "../../prompt-assembly/engine-text.js";
12
12
  import { TOOL_SEARCH_NAME as TOOL_SEARCH_TOOL_NAME } from "./tool-disclosure.js";
13
+ import { elapsedTimeSlots, silentTurnReminderDue } from "./boundary-reminders.js";
13
14
  export const TODO_REMINDER_CONFIG = {
14
15
  TURNS_SINCE_WRITE: 10,
15
16
  TURNS_BETWEEN_REMINDERS: 10,
@@ -197,6 +198,13 @@ export function collectDueAttachments(state, inp) {
197
198
  }
198
199
  if (inp.outputStyle !== undefined)
199
200
  (out ??= []).push({ source: "output_style", body: inp.outputStyle });
201
+ const silentArm = inp.config.silentTurnReminder;
202
+ if (silentArm !== undefined && silentArm !== "off" && inp.silentTurn !== undefined && silentTurnReminderDue(inp.silentTurn.stretch, silentArm, inp.silentTurn.now)) {
203
+ (out ??= []).push({ source: "silent_turn_reminder", body: renderSilentTurnReminder(say) });
204
+ }
205
+ if (inp.config.elapsedTimeReminder === true && inp.elapsedMs !== undefined) {
206
+ (out ??= []).push({ source: "elapsed_time_reminder", body: renderElapsedTime(inp.elapsedMs, say) });
207
+ }
200
208
  if (inp.config.budgetUsd && inp.budgetUsd !== undefined) {
201
209
  (out ??= []).push({ source: "budget_usd", body: renderBudgetUsd(inp.budgetUsd.used, inp.budgetUsd.total, say) });
202
210
  }
@@ -332,6 +340,12 @@ export function collectDateChange(state, today, say) {
332
340
  return undefined;
333
341
  return { source: "date_change", body: renderDateChange(today, say) };
334
342
  }
343
+ export function renderSilentTurnReminder(say) {
344
+ return say("core/event.silent-turn-reminder");
345
+ }
346
+ export function renderElapsedTime(ms, say) {
347
+ return say("core/event.elapsed-time", elapsedTimeSlots(ms));
348
+ }
335
349
  export function renderBudgetUsd(used, total, say = engineTextFor()) {
336
350
  return say("core/event.budget-usd", { used: String(used), total: String(total), remaining: String(total - used) });
337
351
  }
@@ -387,11 +401,14 @@ export function renderMcpUnavailable(entries, say = engineTextFor()) {
387
401
  return arms.length > 0 ? arms.join("\n\n") : undefined;
388
402
  }
389
403
  export function mcpUnavailableOn(cfg) {
390
- const declared = cfg?.mcpUnavailable;
404
+ return attachmentSwitchOn(cfg, "mcpUnavailable", "mcp_unavailable");
405
+ }
406
+ export function attachmentSwitchOn(cfg, key, kind) {
407
+ const declared = cfg?.[key];
391
408
  if (declared === undefined)
392
- return eventDefaultOn("mcp_unavailable");
409
+ return eventDefaultOn(kind);
393
410
  if (typeof declared !== "boolean") {
394
- const field = "TaskSpec.attachments.mcpUnavailable";
411
+ const field = `TaskSpec.attachments.${key}`;
395
412
  const e = new Error(`${field} must be a boolean when present (got ${declared === null ? "null" : Array.isArray(declared) ? "an array" : typeof declared}) — refused rather than read as on or off; omit the key for the default.`);
396
413
  e.code = "config.invalid_argument";
397
414
  e.detail = { field };
@@ -27,7 +27,7 @@ export interface ResumePreflightInfo {
27
27
  * the resume entry's identity-continuity rung already refused a contradicting supplied principal
28
28
  * before this hook runs, so a present value IS the resumed leg's identity. */
29
29
  principal?: string;
30
- /** provider / deviceId / mountPath — the placement facts: the row handle's one frozen copy (as the restore's `priorHandle`). */
30
+ /** provider / deviceId / mountPath — the placement facts: the row handle's one frozen copy (the same object the env factory's and the restore's `priorHandle` are). */
31
31
  workspaceHandle?: Readonly<import("./remote-env.js").WorkspaceHandle>;
32
32
  gateKind: import("./checkpoint-store.js").CheckpointGate["kind"];
33
33
  }
@@ -457,7 +457,7 @@ export interface RunnerDeps {
457
457
  /**
458
458
  * design/96 §20 (P1a) — DEPLOYMENT-DECLARED training knowledge cutoff per model id (e.g.
459
459
  * `{ "qwen-3.5-35b": "2025-01", "deepseek-pro": "2024-07" }`). When the resolved model id is present, the
460
- * `# Environment` block shows `Knowledge cutoff: <value>` so the agent reasons about what it may not know.
460
+ * `# Environment` block carries the line `Assistant knowledge cutoff is <value>.` so the agent reasons about what it may not know.
461
461
  * Deployment-owned ON PURPOSE: core hardcodes no model→date map (a stale cutoff = a §25 honesty breach, and
462
462
  * the model catalog is a deployment/profile concern). Omitted ⇒ no cutoff line (honest absence). Optional.
463
463
  */
@@ -1215,6 +1215,10 @@ export interface RunnerDeps {
1215
1215
  * not declare `capabilities().ownership` is not mounted.
1216
1216
  */
1217
1217
  artifactHost?: import("./artifact-host.js").ArtifactHost;
1218
+ /** The `sharedArtifactReads` setting's layers (`managed` / `user` / `repo`, as {@link crossSessionInbound}), or a getter read at each
1219
+ * prepare; one reading, `resolveSharedArtifactReads` (its module states the rule: `repo` has no vote, the organization's value
1220
+ * decides). `allow` = the `Artifact` tool's consent on a shared target asks nobody. Absent = `ask`. Inert without {@link artifactHost}. */
1221
+ sharedArtifactReads?: import("./shared-artifact-reads.js").SharedArtifactReadsLayers | (() => import("./shared-artifact-reads.js").SharedArtifactReadsLayers | undefined);
1218
1222
  /**
1219
1223
  * The deployment seat of the mods bus: extension registrations every task of this Runner carries (every leg — root,
1220
1224
  * delegated child, resume — admits them at its own prepare). Each declares its tier (`prepend`, `user` or `append`;
@@ -91,6 +91,19 @@ export declare function isBlankCredential(value: string): boolean;
91
91
  * occurrence of a request's key taken out of a remote's words (`remoteWords`): a key that names no secret (`EMPTY`, a local gateway's
92
92
  * one-letter key) is left in the words, as it is left to every child. */
93
93
  export declare function namesASecret(value: string): boolean;
94
+ /**
95
+ * THE one answer to "why is this value no credential value" — the member of {@link WithheldEnvJudgment.valueProblems} a value gets, word for
96
+ * word, and the sentence {@link declareWithheldEnv} refuses a value by (`values[i] is not a credential value (got <this>)`; for a value whose reading
97
+ * throws the declaration throws what that reading throws, where this function answers the words below).
98
+ * `undefined` = it is one: a string a variable can hold (not the empty string, no NUL, no unpaired surrogate) that is not white space only, has at
99
+ * least {@link CREDENTIAL_MIN_CHARS} characters once trimmed, is no flag or placeholder word and not one character repeated — so withholding every
100
+ * variable that holds it takes no setting (`CI=1`, `FORCE_COLOR=true`) from a child. Otherwise a phrase (a value that is no string reads as its kind) that never
101
+ * repeats the value; a value whose reading throws (a revoked Proxy) says so, in words that name no value. A host that is about to declare a credential it
102
+ * derives from its own configuration (a header value, a token) asks this first and declares only what it answers `undefined` to (the declaration
103
+ * still refuses a value that a variable this host hands every child holds: that part reads the environment, and this does not). Pure: it reads no
104
+ * process state and never throws.
105
+ */
106
+ export declare function credentialValueProblemOf(v: unknown): string | undefined;
94
107
  /**
95
108
  * Declare the engine's own credentials in this process's environment — the engine's or its host's: an approval
96
109
  * bearer, a service token — by name and by value. From then on no child spawned on this host inherits one, whatever the
@@ -198,9 +211,12 @@ export interface PeerHeldEnvDeclaration {
198
211
  /** The variables of this process's environment the entry's credential reference reads — names, never values. */
199
212
  readonly names: readonly string[];
200
213
  /** The entry whose reference reads them: its surface (`"mcp"` — an MCP server, `"a2a"` — an A2A peer; the closed set
201
- * {@link ToolAxesSurface}) and its name, a name by the engine's one name reading (visible content; no control, separator or format
202
- * character but the two joiners; at most 256 UTF-16 units; no white space at either end). A sentence names it as the engine names a
203
- * declared entry: `MCP server "acme"`. */
214
+ * {@link ToolAxesSurface}) and its name as the host's configuration holds it, whatever it holds — a LABEL, never an identity: any string
215
+ * is taken (empty, white space at an end, a control character, any length), and its content never makes the declaration refused. It
216
+ * only tells the entry apart and names it, as the receipt names an entry it takes in: a sentence writes `MCP server "acme "` — quoted,
217
+ * escaped and folded to one line; a spelling longer than 80 characters (the opening quote counted) is cut to its first 80 and ends in
218
+ * `…`, and a name longer than 4096 UTF-16 units is spelled from its first 4096 alone (so any length costs the same; its spelling is
219
+ * always cut). Two names that read the same there are one entry. */
204
220
  readonly entry: {
205
221
  readonly surface: ToolAxesSurface;
206
222
  readonly name: string;
@@ -250,8 +266,11 @@ export interface PeerHeldEnvReceipt {
250
266
  * A name that is not taken in is ANSWERED, never refused: {@link PeerHeldEnvReceipt.notTaken}, each with its reason
251
267
  * ({@link PEER_HELD_ENV_NOT_TAKEN_REASONS}). A malformed declaration THROWS and takes nothing in: not a plain object, a member besides
252
268
  * `names`, `entry` and `namedTo`, `names` not an array (or a Proxy, or an element that throws while it is read, or an element that is not
253
- * a string), an `entry` that is not `{ surface, name }` over a surface of {@link ToolAxesSurface} and a name, a `namedTo` that is neither
254
- * `"every_leg"` nor `{ isolationScope }` over a name.
269
+ * a string), an `entry` that is not `{ surface, name }` over a surface of {@link ToolAxesSurface} and a string, a `namedTo` that is neither
270
+ * `"every_leg"` nor `{ isolationScope }` over a name. The entry's name is never judged beyond being a string: a name the host's own mount
271
+ * judge refuses (white space at an end, a control character, empty, too long) still declares that entry's variables — they are the peer's
272
+ * all the same — and the entry is named by it as written ({@link PeerHeldEnvDeclaration.entry}). The audience's scope, by contrast, is an
273
+ * identity a leg is compared by, so it must be a name.
255
274
  *
256
275
  * WHEN: at start-up, before the first child is spawned — it needs no Runner, and the table is made at its first use — and again at each
257
276
  * configuration change (only what is new takes effect). A child's environment is composed when it starts: a child already running keeps
@@ -261,7 +280,8 @@ export interface PeerHeldEnvReceipt {
261
280
  * The two declarations, side by side: {@link declareWithheldEnv} — the engine's own credentials (names and values): withheld under EVERY
262
281
  * policy, an allow list naming one is refused, a finding of kind `own-credential`, each declaration REPLACES the last; this one — the
263
282
  * variables a peer's reference reads: withheld under the scrub alone, `"all"` and a list hand them on, a finding of kind `peer-held`,
264
- * only ever added to.
283
+ * only ever added to. A name neither can withhold: the first throws the whole table, this one answers it in `notTaken`. An entry: the
284
+ * first has none; this one's is a label whose content never makes the declaration refused.
265
285
  */
266
286
  export declare function declarePeerHeldEnv(declaration: PeerHeldEnvDeclaration): PeerHeldEnvReceipt;
267
287
  /** The entries a receipt took in, per variable: the process's table's own shape ({@link PeerHeldNames}), but only the (variable, entry) pairs
@@ -8,7 +8,7 @@ import { callerKey } from "./caller-text.js";
8
8
  import { describeRejectedValue } from "./tool-search-setting.js";
9
9
  import { authSchemeCredentials } from "./protocol-http-auth.js";
10
10
  import { declarationSubject, isToolAxesSurface, toolAxesSurfaceList } from "./declaration-words.js";
11
- import { principalNameFault, principalNameOf } from "./principal-name.js";
11
+ import { principalNameOf } from "./principal-name.js";
12
12
  const GIT_CONFIG_ENV_RE = /^GIT_CONFIG_(?:COUNT|PARAMETERS|(?:KEY|VALUE)_[0-9]+)$/;
13
13
  const PROXY_ENV_RE = /^(?:(?:https?|ftp|all|no)_proxy|npm_config_(?:https?_)?proxy|npm_config_noproxy|yarn_proxy|(?:yarn|global_agent|docker|claude_code)_(?:https?|no)_proxy|cloudsdk_proxy_[a-z]+|electron_get_use_proxy)$/i;
14
14
  function isExemptEnvName(name) {
@@ -291,7 +291,7 @@ function refusalText(thrown) {
291
291
  }
292
292
  return "declareWithheldEnv: the declaration could not be read — refused";
293
293
  }
294
- function valueProblemOf(v) {
294
+ export function credentialValueProblemOf(v) {
295
295
  try {
296
296
  return credentialValueProblem(v);
297
297
  }
@@ -319,7 +319,7 @@ function readWithheldDeclarationOrThrow(given, suppliedNow, told, seen) {
319
319
  if (!Array.isArray(givenValues))
320
320
  throw new Error(`declareWithheldEnv: values must be an array of credential values (got ${kindOf(givenValues)})`);
321
321
  const values = listCopy("values", givenValues);
322
- seen.valueProblems = values.map(valueProblemOf);
322
+ seen.valueProblems = values.map(credentialValueProblemOf);
323
323
  const refused = firstRefusedValue(values);
324
324
  if (refused !== undefined) {
325
325
  const toldValue = values[refused.index];
@@ -420,9 +420,9 @@ function readPeerHeldDeclaration(given) {
420
420
  const surface = entry.surface;
421
421
  if (!isToolAxesSurface(surface))
422
422
  throw new Error(`${DECLARE_PEER_HELD}: entry.surface must be a surface a peer entry is declared on, ${toolAxesSurfaceList()} (got ${typeof surface === "string" ? "another string" : kindOf(surface)})`);
423
- const entryName = principalNameOf(entry.name);
424
- if (entryName === undefined)
425
- throw new Error(`${DECLARE_PEER_HELD}: entry.name is not a name (${principalNameFault(entry.name)})`);
423
+ const entryName = entry.name;
424
+ if (typeof entryName !== "string")
425
+ throw new Error(`${DECLARE_PEER_HELD}: entry.name must be a string — the entry's name as the host's configuration holds it, whatever it holds (got ${kindOf(entryName)})`);
426
426
  const namedTo = received.namedTo;
427
427
  let audience;
428
428
  if (namedTo === "every_leg")
@@ -0,0 +1,58 @@
1
+ /**
2
+ * The card's half of the session call grant (`session-call-grant.ts`): the option a card carries, the resolver's reading of an
3
+ * approver's `sessionCallGrant` against it, and the rejection words. It only READS: writing the session row is
4
+ * the asking run's own station's act. A leaf (it imports nothing), so the resolver can read it without the rule model.
5
+ */
6
+ /**
7
+ * The option on a card (`AskRequest.sessionCallGrant`), and the same members for a listed row (`sessionCallGrantOfRow`).
8
+ * `grant` is the key a host sends back; every other member is display, never read back. Every fact `sentence` states is one
9
+ * of the structured members, so a surface in another language composes its own line from them. All nine members are always
10
+ * present: a list with nothing in it is `[]`, and `programs` is never empty (a binding has at least one run).
11
+ */
12
+ export interface SessionCallGrantOffer {
13
+ /** The grant's key: the session row's rule text. Sent back verbatim as `AskOutcome.sessionCallGrant`; on a listed row, its `rule`. */
14
+ readonly grant: string;
15
+ /** The engine's sentence for the person — one language (English), for a surface with none of its own (a headless host, a log). */
16
+ readonly sentence: string;
17
+ /** The first 12 hex digits of the digest of the command's text (its words, operands masked, when `operandDirs` is not empty). */
18
+ readonly fingerprint: string;
19
+ /** The canonical directory the call starts in. */
20
+ readonly cwd: string;
21
+ /** The canonical path each run's program resolved to (a builtin by name), run order. */
22
+ readonly programs: readonly string[];
23
+ /** The scripts bound by their content (with the interpreter's source files beside each), run order. */
24
+ readonly scripts: readonly string[];
25
+ /** The first 12 hex digits of each inline-code word's digest (`node -e <code>`), run order. */
26
+ readonly inlineCode: readonly string[];
27
+ /** The canonical path of each file a redirection writes or reads, run order. */
28
+ readonly writes: readonly string[];
29
+ /** The directories an operand may name another file inside. */
30
+ readonly operandDirs: readonly string[];
31
+ }
32
+ /** An engine-owned copy of a card's option, taken before an approver can touch the object. */
33
+ export declare function ownSessionCallGrantOffer(o: SessionCallGrantOffer | undefined): SessionCallGrantOffer | undefined;
34
+ /**
35
+ * Why a person's "for the rest of the session" took no effect, each word spelled once — the `detail.reason` of
36
+ * `approval.session_call_grant_rejected` (attention `audit`, the record of the person's own answer): every word is a choice
37
+ * that did not take.
38
+ * An answer the option does not apply to is no such choice and mints nothing: a refusal of the call, or the card's own key in
39
+ * an answer no person gave (its host reports `settledBy: "policy"`), edited or not. Any key on a card that offered none is
40
+ * `no_offer`, and a key other than the card's is `mismatch`, whoever sent it (a policy seat's card offers none).
41
+ */
42
+ export declare const SESSION_CALL_GRANT_REJECTIONS: readonly ["not_a_string", "no_offer", "mismatch", "edited", "not_written"];
43
+ export type SessionCallGrantRejection = (typeof SESSION_CALL_GRANT_REJECTIONS)[number];
44
+ /** The resolver's reading of an answer's `sessionCallGrant` against the card it answered. */
45
+ export type SessionCallGrantScreen = {
46
+ readonly verdict: "granted";
47
+ readonly grant: string;
48
+ } | {
49
+ readonly verdict: "rejected";
50
+ readonly reason: Exclude<SessionCallGrantRejection, "not_written">;
51
+ readonly requested?: string;
52
+ };
53
+ /** Screen an ALLOW's member (read once by the caller; a refusal carries no grant screen — on it the option does not apply);
54
+ * `{}` when the answer carried none, or the card's own key in an answer no person gave (`byPerson` false). `edited`: the
55
+ * approver changed the input — the grant names the call the card showed, which is not the one that runs. */
56
+ export declare function sessionCallGrantSeat(raw: unknown, offered: SessionCallGrantOffer | undefined, edited: boolean, byPerson: boolean): {
57
+ sessionCallGrant?: SessionCallGrantScreen;
58
+ };
@@ -0,0 +1,18 @@
1
+ export function ownSessionCallGrantOffer(o) {
2
+ if (o === undefined)
3
+ return undefined;
4
+ const grant = o.grant;
5
+ return typeof grant === "string" ? { ...o, grant } : undefined;
6
+ }
7
+ export const SESSION_CALL_GRANT_REJECTIONS = Object.freeze(["not_a_string", "no_offer", "mismatch", "edited", "not_written"]);
8
+ export function sessionCallGrantSeat(raw, offered, edited, byPerson) {
9
+ if (raw === undefined)
10
+ return {};
11
+ const shape = typeof raw !== "string" ? "not_a_string" : offered === undefined ? "no_offer" : raw !== offered.grant ? "mismatch" : undefined;
12
+ if (shape === undefined && !byPerson)
13
+ return {};
14
+ const reason = shape ?? (edited ? "edited" : undefined);
15
+ if (reason === undefined && typeof raw === "string")
16
+ return { sessionCallGrant: { verdict: "granted", grant: raw } };
17
+ return { sessionCallGrant: { verdict: "rejected", reason: reason ?? "not_a_string", ...(typeof raw === "string" ? { requested: raw.slice(0, 200) } : {}) } };
18
+ }
@@ -0,0 +1,93 @@
1
+ import type { ExecutionEnv } from "../internal/harness.js";
2
+ import { type PersistedRule } from "./permission-rule-model.js";
3
+ import type { SessionCallGrantOffer } from "./session-call-grant-screen.js";
4
+ /** The match word of a call grant row — a member of `PERSISTED_RULE_MATCHES`. */
5
+ export declare const CALL_GRANT_MATCH: "call";
6
+ /** One resolved program file, by the four members a later call must meet again. */
7
+ export interface CallGrantProgram {
8
+ readonly path: string;
9
+ readonly id: string;
10
+ readonly size: number;
11
+ readonly mtimeMs: number;
12
+ }
13
+ /** One segment of a bound call. */
14
+ export interface CallGrantSegment {
15
+ /** The canonical directory the segment runs in. */
16
+ readonly at: string;
17
+ readonly program: CallGrantProgram | {
18
+ readonly builtin: string;
19
+ };
20
+ /** An interpreter's script: its canonical path, its bytes' digest, and the digest of the interpreter's source files in its directory tree. */
21
+ readonly script?: {
22
+ readonly path: string;
23
+ readonly sha256: string;
24
+ readonly tree: string;
25
+ };
26
+ /** An inline-code word's digest (`node -e <code>`): display and identity both — the text form already binds the word. */
27
+ readonly inline?: string;
28
+ /** The canonical path of each file redirection target, in source order. */
29
+ readonly writes: readonly string[];
30
+ }
31
+ /** The binding a call grant row carries as its `command`: the canonical JSON (sorted keys, no white space) of this shape, `v: 1`.
32
+ * A CONTRACT, so a reader that cannot call this package at run time can read a listed row: these keys and no others, every path
33
+ * absolute, every digest 64 lowercase hex digits ({@link readCallGrantBinding} is the engine's own reading of it, and
34
+ * {@link sessionCallGrantOfRow} projects it onto the card's members). A later version changes `v`. */
35
+ export interface CallGrantBinding {
36
+ readonly v: 1;
37
+ /** The canonical directory the call starts in. */
38
+ readonly cwd: string;
39
+ /** `text`: `digest` is the folded command's; `argv`: the single run's words, the holes masked. */
40
+ readonly form: "text" | "argv";
41
+ readonly digest: string;
42
+ readonly segments: readonly CallGrantSegment[];
43
+ /** Word positions (of the single run) that may name another file, each inside its directory. Empty in the `text` form. */
44
+ readonly holes: readonly {
45
+ readonly at: number;
46
+ readonly dir: string;
47
+ }[];
48
+ }
49
+ /** The environment and places one reading takes. `env` is read live (its declared members are getters on some backends). */
50
+ export interface CallBindingSeat {
51
+ readonly env: Pick<ExecutionEnv, "canonicalPath" | "fileInfo" | "readBinaryFile" | "listDir" | "cdPath"> & {
52
+ readonly fileIdentity?: ExecutionEnv["fileIdentity"];
53
+ readonly readLink?: ExecutionEnv["readLink"];
54
+ readonly searchPath?: ExecutionEnv["searchPath"];
55
+ readonly receivedEnvNames?: ExecutionEnv["receivedEnvNames"];
56
+ };
57
+ /** The call's working directory (the run's live tracked one). */
58
+ readonly cwd: string | undefined;
59
+ /** The run's workspace roots (canonical): a script, and an operand hole's file, must lie inside one. */
60
+ readonly roots: readonly string[];
61
+ }
62
+ /** The canonical text of a binding — what a row stores as its `command`. */
63
+ export declare function callGrantCommandOf(binding: CallGrantBinding): string;
64
+ /** The rule text of a call grant row (its identity in the session): the digest of its binding. */
65
+ export declare function callGrantRuleTextOf(command: string): string;
66
+ type Unbindable = {
67
+ readonly unbindable: string;
68
+ };
69
+ /** The binding a person's grant of this call would store, or why the call has none. */
70
+ export declare function bindCall(command: unknown, seat: CallBindingSeat, signal?: AbortSignal): Promise<CallGrantBinding | Unbindable>;
71
+ /** Does a stored binding admit this call — the same reading of it, member for member, each hole's file inside its directory?
72
+ * A reading that fails is no admission (the call is then judged as if the grant were not there), never an error. */
73
+ export declare function callGrantAdmits(binding: CallGrantBinding, command: unknown, seat: CallBindingSeat, signal?: AbortSignal): Promise<boolean>;
74
+ /** The person's lane's one use of call grant rows: the first row of `rows` that is an allow of the call, under one of its granting
75
+ * command words (`words`), of THIS session, whose stored binding reads and whose text is that binding's digest, and that `judge`
76
+ * says meets this command now. Each row is judged on its own; one that cannot be judged admits nothing. No judge ⇒ none. */
77
+ export declare function callGrantRowAdmitting(rows: readonly PersistedRule[], call: {
78
+ readonly words: readonly string[];
79
+ readonly sessionId: string | undefined;
80
+ readonly command: unknown;
81
+ readonly judge: ((binding: CallGrantBinding, command: string) => Promise<boolean>) | undefined;
82
+ }): Promise<PersistedRule | undefined>;
83
+ /** The binding a stored `command` spells — `undefined` for anything that is not one (its canonical text, every member well-formed). */
84
+ export declare function readCallGrantBinding(command: unknown): CallGrantBinding | undefined;
85
+ /** The store's re-projection of a call grant row: an allow of the shell tool, in a session scope, whose command is a binding's
86
+ * canonical text and whose text is that command's digest. Anything else is damage (refused, never repaired). */
87
+ export declare function callGrantRowFault(r: Pick<PersistedRule, "behavior" | "rule" | "tool" | "match" | "command" | "scope">): "invalid_rule_text" | "metadata_mismatch" | undefined;
88
+ /** The option a binding offers (`session-call-grant-screen.ts` holds the card's half: the option's shape and the answer's screen). */
89
+ export declare function offerOfBinding(b: CallGrantBinding): SessionCallGrantOffer;
90
+ /** The card's members for a listed session row (`effective({ sessionId }).rules`) — the same projection of the same binding, so a
91
+ * rule page shows what the card showed. `undefined` for a row that is no call grant (or one whose binding does not read). */
92
+ export declare function sessionCallGrantOfRow(row: Pick<PersistedRule, "match" | "rule" | "command">): SessionCallGrantOffer | undefined;
93
+ export {};