@sema-agent/core 7.47.0 → 7.49.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 (431) hide show
  1. package/CHANGELOG.md +472 -0
  2. package/README.md +2 -2
  3. package/dist/agents/cascade.d.ts +2 -5
  4. package/dist/agents/child-failure.d.ts +20 -0
  5. package/dist/agents/child-failure.js +28 -0
  6. package/dist/agents/cross-session-ref.d.ts +11 -3
  7. package/dist/agents/cross-session-ref.js +6 -0
  8. package/dist/agents/cumulative-stats.d.ts +12 -15
  9. package/dist/agents/cumulative-stats.js +1 -1
  10. package/dist/agents/extra-tool-names.js +1 -1
  11. package/dist/agents/inherited-tool-pool.d.ts +17 -13
  12. package/dist/agents/inherited-tool-pool.js +4 -3
  13. package/dist/agents/peer-session-drain.d.ts +3 -2
  14. package/dist/agents/peer-session-drain.js +5 -4
  15. package/dist/agents/send-message-tool.js +2 -9
  16. package/dist/agents/subagent.d.ts +10 -29
  17. package/dist/agents/subagent.js +65 -53
  18. package/dist/agents/suspend-guard.d.ts +1 -1
  19. package/dist/agents/tool-filter.d.ts +76 -65
  20. package/dist/agents/tool-filter.js +122 -92
  21. package/dist/agents/verify.d.ts +4 -7
  22. package/dist/agents/verify.js +6 -7
  23. package/dist/bench/metrics.d.ts +1 -2
  24. package/dist/brain/anthropic.js +133 -79
  25. package/dist/brain/errors.d.ts +53 -6
  26. package/dist/brain/errors.js +22 -2
  27. package/dist/brain/input-too-long.d.ts +40 -19
  28. package/dist/brain/input-too-long.js +3 -16
  29. package/dist/brain/open-responses.js +19 -10
  30. package/dist/brain/openai.js +123 -32
  31. package/dist/brain/provider-dialect.d.ts +214 -0
  32. package/dist/brain/provider-dialect.js +186 -0
  33. package/dist/brain/request-params.d.ts +27 -8
  34. package/dist/brain/request-params.js +7 -12
  35. package/dist/brain/request-route.d.ts +84 -0
  36. package/dist/brain/request-route.js +41 -0
  37. package/dist/brain/retry.d.ts +8 -0
  38. package/dist/brain/retry.js +10 -4
  39. package/dist/brain/route-adjudicator.d.ts +7 -0
  40. package/dist/brain/route-adjudicator.js +5 -1
  41. package/dist/brain/status-sink.d.ts +20 -0
  42. package/dist/brain/status-sink.js +11 -0
  43. package/dist/brain/stream-engine.d.ts +52 -1
  44. package/dist/brain/stream-engine.js +81 -24
  45. package/dist/brain/stream-shared.d.ts +57 -11
  46. package/dist/brain/stream-shared.js +28 -2
  47. package/dist/core/a2a.d.ts +1 -0
  48. package/dist/core/agent-config-dir.js +3 -2
  49. package/dist/core/allow-entry.d.ts +21 -12
  50. package/dist/core/allow-entry.js +39 -32
  51. package/dist/core/arg-summary.d.ts +17 -24
  52. package/dist/core/arg-summary.js +169 -68
  53. package/dist/core/ask-origin.d.ts +42 -24
  54. package/dist/core/ask-origin.js +18 -13
  55. package/dist/core/auto-mode-prompt-assets.d.ts +2 -2
  56. package/dist/core/auto-mode-prompt-assets.js +1 -1
  57. package/dist/core/auto-mode-prompt.d.ts +11 -1
  58. package/dist/core/auto-mode-prompt.js +13 -10
  59. package/dist/core/auto-mode-rebuild.d.ts +7 -0
  60. package/dist/core/auto-mode-rebuild.js +4 -1
  61. package/dist/core/canonical-json.d.ts +3 -0
  62. package/dist/core/canonical-json.js +2 -1
  63. package/dist/core/checkpoint-requirements.d.ts +892 -0
  64. package/dist/core/checkpoint-requirements.js +333 -0
  65. package/dist/core/checkpoint-store.d.ts +95 -66
  66. package/dist/core/checkpoint-store.js +14 -26
  67. package/dist/core/child-clamp-seats.d.ts +228 -69
  68. package/dist/core/child-clamp-seats.js +211 -17
  69. package/dist/core/classifier-unavailable-arm.d.ts +5 -1
  70. package/dist/core/classifier-unavailable-arm.js +3 -3
  71. package/dist/core/compliance.d.ts +3 -0
  72. package/dist/core/compliance.js +9 -4
  73. package/dist/core/credential-vocabulary.d.ts +140 -0
  74. package/dist/core/credential-vocabulary.js +131 -0
  75. package/dist/core/decision-receipt.js +1 -1
  76. package/dist/core/effective-path-target.d.ts +73 -16
  77. package/dist/core/effective-path-target.js +63 -33
  78. package/dist/core/engine-notice.d.ts +32 -7
  79. package/dist/core/file-history-store.js +2 -2
  80. package/dist/core/fs-write-gate-policy.d.ts +4 -0
  81. package/dist/core/fs-write-gate-policy.js +22 -5
  82. package/dist/core/gate-bounded-await.d.ts +28 -13
  83. package/dist/core/gate-bounded-await.js +41 -4
  84. package/dist/core/gate-fold.d.ts +1 -1
  85. package/dist/core/gate-fold.js +24 -25
  86. package/dist/core/gate-lanes.js +16 -15
  87. package/dist/core/gate-outcome.d.ts +20 -5
  88. package/dist/core/gate-outcome.js +5 -0
  89. package/dist/core/governance-codes.d.ts +11 -4
  90. package/dist/core/governance-codes.js +14 -3
  91. package/dist/core/hooks.d.ts +4 -0
  92. package/dist/core/locked-config.d.ts +8 -0
  93. package/dist/core/locked-config.js +14 -2
  94. package/dist/core/lsp.js +3 -5
  95. package/dist/core/mailbox-store.d.ts +3 -4
  96. package/dist/core/mcp-connection-pool.d.ts +75 -0
  97. package/dist/core/mcp-connection-pool.js +128 -0
  98. package/dist/core/mcp-failure.d.ts +2 -1
  99. package/dist/core/mcp-failure.js +13 -2
  100. package/dist/core/mcp-server-spec.d.ts +1 -1
  101. package/dist/core/mcp.d.ts +4 -0
  102. package/dist/core/mcp.js +70 -43
  103. package/dist/core/memory-engine/content-origin.js +2 -14
  104. package/dist/core/memory-engine/engine.d.ts +32 -22
  105. package/dist/core/memory-engine/engine.js +103 -55
  106. package/dist/core/memory-engine/file-backend.d.ts +13 -30
  107. package/dist/core/memory-engine/file-backend.js +37 -252
  108. package/dist/core/memory-engine/index.d.ts +1 -1
  109. package/dist/core/memory-engine/index.js +1 -1
  110. package/dist/core/memory-engine/layout.d.ts +139 -9
  111. package/dist/core/memory-engine/layout.js +350 -7
  112. package/dist/core/memory-engine/scope-contract.d.ts +10 -0
  113. package/dist/core/memory-engine/scope-contract.js +8 -0
  114. package/dist/core/memory-engine/session-incarnation.d.ts +14 -4
  115. package/dist/core/memory-engine/session-incarnation.js +5 -2
  116. package/dist/core/memory-engine/types.d.ts +10 -1
  117. package/dist/core/memory.js +5 -17
  118. package/dist/core/model-seat.d.ts +4 -4
  119. package/dist/core/model-seat.js +1 -1
  120. package/dist/core/mounted-mcp.d.ts +57 -0
  121. package/dist/core/mounted-mcp.js +19 -0
  122. package/dist/core/namespaced-rule-name.d.ts +29 -0
  123. package/dist/core/namespaced-rule-name.js +52 -0
  124. package/dist/core/park-selfcheck.d.ts +1 -1
  125. package/dist/core/park-selfcheck.js +16 -6
  126. package/dist/core/path-guard-rows.d.ts +99 -0
  127. package/dist/core/path-guard-rows.js +45 -0
  128. package/dist/core/path-identity.d.ts +22 -16
  129. package/dist/core/path-identity.js +10 -10
  130. package/dist/core/path-rule-binding.d.ts +2 -1
  131. package/dist/core/path-rule-binding.js +3 -1
  132. package/dist/core/pause-registry.d.ts +16 -2
  133. package/dist/core/pause-registry.js +6 -0
  134. package/dist/core/permission-rule-consent.js +0 -7
  135. package/dist/core/permission-rule-model.d.ts +68 -24
  136. package/dist/core/permission-rule-model.js +105 -24
  137. package/dist/core/permission-rule-store.js +2 -2
  138. package/dist/core/permission-rules.d.ts +3 -30
  139. package/dist/core/permission-rules.js +4 -54
  140. package/dist/core/read-root-candidate.d.ts +1 -3
  141. package/dist/core/read-root-candidate.js +4 -15
  142. package/dist/core/real-approval.d.ts +4 -3
  143. package/dist/core/retired-keys.d.ts +13 -0
  144. package/dist/core/retired-keys.js +14 -0
  145. package/dist/core/roles.d.ts +2 -3
  146. package/dist/core/roles.js +15 -6
  147. package/dist/core/runner/assemble-result.d.ts +0 -7
  148. package/dist/core/runner/assemble-result.js +19 -31
  149. package/dist/core/runner/caller-roster.d.ts +78 -0
  150. package/dist/core/runner/caller-roster.js +219 -0
  151. package/dist/core/runner/checkpoint-scope.d.ts +16 -16
  152. package/dist/core/runner/checkpoint-scope.js +2 -2
  153. package/dist/core/runner/child-tree.js +2 -2
  154. package/dist/core/runner/contracts.d.ts +68 -35
  155. package/dist/core/runner/decide-continuation.d.ts +51 -3
  156. package/dist/core/runner/decide-continuation.js +76 -21
  157. package/dist/core/runner/denial-limit-arms.d.ts +17 -5
  158. package/dist/core/runner/denial-limit-arms.js +11 -9
  159. package/dist/core/runner/extra-body-dropped-seat.d.ts +8 -0
  160. package/dist/core/runner/extra-body-dropped-seat.js +22 -0
  161. package/dist/core/runner/finish-reason-seat.d.ts +9 -0
  162. package/dist/core/runner/finish-reason-seat.js +40 -0
  163. package/dist/core/runner/gate-exit.d.ts +44 -32
  164. package/dist/core/runner/gate-exit.js +112 -25
  165. package/dist/core/runner/inherited-ask-grants.js +6 -4
  166. package/dist/core/runner/mcp-redial.d.ts +3 -3
  167. package/dist/core/runner/mcp-redial.js +3 -4
  168. package/dist/core/runner/park-commit.d.ts +1 -1
  169. package/dist/core/runner/permission-rule-lanes.d.ts +1 -2
  170. package/dist/core/runner/permission-rule-lanes.js +5 -4
  171. package/dist/core/runner/prepare-artifact.d.ts +4 -0
  172. package/dist/core/runner/prepare-artifact.js +2 -1
  173. package/dist/core/runner/prepare-ask-lane.d.ts +2 -0
  174. package/dist/core/runner/prepare-ask-lane.js +12 -6
  175. package/dist/core/runner/prepare-boundary-parks.d.ts +5 -8
  176. package/dist/core/runner/prepare-boundary-parks.js +4 -7
  177. package/dist/core/runner/prepare-caps-and-workflow.d.ts +11 -15
  178. package/dist/core/runner/prepare-caps-and-workflow.js +19 -27
  179. package/dist/core/runner/prepare-config-doors.d.ts +9 -9
  180. package/dist/core/runner/prepare-config-doors.js +10 -5
  181. package/dist/core/runner/prepare-defer-classify.d.ts +2 -2
  182. package/dist/core/runner/prepare-defer-classify.js +5 -3
  183. package/dist/core/runner/prepare-delegation-surface.d.ts +1 -1
  184. package/dist/core/runner/prepare-delegation-surface.js +3 -3
  185. package/dist/core/runner/prepare-gate-stations.d.ts +4 -4
  186. package/dist/core/runner/prepare-gate-stations.js +9 -7
  187. package/dist/core/runner/prepare-hands-readface.d.ts +7 -7
  188. package/dist/core/runner/prepare-hands-readface.js +7 -7
  189. package/dist/core/runner/prepare-inherited-gate.d.ts +7 -6
  190. package/dist/core/runner/prepare-inherited-gate.js +14 -15
  191. package/dist/core/runner/prepare-listings.d.ts +7 -24
  192. package/dist/core/runner/prepare-listings.js +4 -5
  193. package/dist/core/runner/prepare-memory-engine-session.d.ts +2 -0
  194. package/dist/core/runner/prepare-memory-engine-session.js +4 -3
  195. package/dist/core/runner/prepare-memory.d.ts +6 -0
  196. package/dist/core/runner/prepare-memory.js +13 -13
  197. package/dist/core/runner/prepare-offload-wrappers.d.ts +5 -0
  198. package/dist/core/runner/prepare-offload-wrappers.js +3 -3
  199. package/dist/core/runner/prepare-park-ask.d.ts +7 -8
  200. package/dist/core/runner/prepare-park-ask.js +17 -10
  201. package/dist/core/runner/prepare-policy-chain.js +24 -44
  202. package/dist/core/runner/prepare-project-context.d.ts +1 -1
  203. package/dist/core/runner/prepare-project-context.js +3 -4
  204. package/dist/core/runner/prepare-protocol-tools.d.ts +9 -3
  205. package/dist/core/runner/prepare-protocol-tools.js +3 -4
  206. package/dist/core/runner/prepare-run-refs.d.ts +3 -0
  207. package/dist/core/runner/prepare-run-refs.js +2 -1
  208. package/dist/core/runner/prepare-safety-scan.d.ts +4 -8
  209. package/dist/core/runner/prepare-safety-scan.js +1 -2
  210. package/dist/core/runner/prepare-suspend-saga.d.ts +7 -1
  211. package/dist/core/runner/prepare-suspend-saga.js +28 -12
  212. package/dist/core/runner/prepare-task.d.ts +1 -1
  213. package/dist/core/runner/prepare-task.js +67 -56
  214. package/dist/core/runner/prepare-wiring-manifest.d.ts +11 -10
  215. package/dist/core/runner/prepare-wiring-manifest.js +5 -8
  216. package/dist/core/runner/resume-apply.js +7 -14
  217. package/dist/core/runner/resume-checkpoint-screen.js +11 -4
  218. package/dist/core/runner/resume-internals-and-config.js +2 -2
  219. package/dist/core/runner/resume-policy-outcome.js +5 -32
  220. package/dist/core/runner/resume-review-outcome.js +4 -1
  221. package/dist/core/runner/retired-runner-deps.d.ts +6 -0
  222. package/dist/core/runner/retired-runner-deps.js +10 -1
  223. package/dist/core/runner/run-brain-sinks.d.ts +4 -0
  224. package/dist/core/runner/run-brain-sinks.js +5 -2
  225. package/dist/core/runner/run-harness-handlers.js +27 -34
  226. package/dist/core/runner/run-leg.d.ts +0 -2
  227. package/dist/core/runner/run-leg.js +32 -33
  228. package/dist/core/runner/run-terminal-adoption.js +4 -3
  229. package/dist/core/runner/runtask.js +8 -8
  230. package/dist/core/runner/session-rule-policy.js +5 -5
  231. package/dist/core/runner/stream-settle-backstop.js +7 -4
  232. package/dist/core/runner/sub-agent-deny-lists.d.ts +51 -12
  233. package/dist/core/runner/sub-agent-deny-lists.js +111 -80
  234. package/dist/core/runner/terminal-account.d.ts +48 -0
  235. package/dist/core/runner/terminal-account.js +186 -0
  236. package/dist/core/runner/tool-end-body.d.ts +54 -17
  237. package/dist/core/runner/tool-end-body.js +27 -2
  238. package/dist/core/runner/tool-face-overlay.d.ts +3 -1
  239. package/dist/core/runner/tool-face-overlay.js +6 -4
  240. package/dist/core/runner/tool-occurrence.d.ts +106 -0
  241. package/dist/core/runner/tool-occurrence.js +123 -0
  242. package/dist/core/runner/tool-progress-lane.d.ts +16 -8
  243. package/dist/core/runner/tool-progress-lane.js +25 -34
  244. package/dist/core/runner/turn-attachments.d.ts +1 -1
  245. package/dist/core/runner/write-protection-station.d.ts +21 -9
  246. package/dist/core/runner/write-protection-station.js +20 -17
  247. package/dist/core/runner-deps.d.ts +12 -22
  248. package/dist/core/safety-axis-vocab.d.ts +1 -1
  249. package/dist/core/safety-merge-corpus.d.ts +1 -1
  250. package/dist/core/secret-env.d.ts +16 -5
  251. package/dist/core/secret-env.js +23 -63
  252. package/dist/core/sensitive-path-policy.d.ts +19 -18
  253. package/dist/core/sensitive-path-policy.js +73 -49
  254. package/dist/core/session-policy-store.d.ts +6 -3
  255. package/dist/core/session-policy-store.js +28 -10
  256. package/dist/core/session-reconcile.d.ts +3 -0
  257. package/dist/core/session-reconcile.js +5 -4
  258. package/dist/core/session-store.d.ts +5 -0
  259. package/dist/core/session-store.js +12 -0
  260. package/dist/core/session.d.ts +13 -0
  261. package/dist/core/shared-memory/normalize.d.ts +17 -4
  262. package/dist/core/shared-memory/normalize.js +7 -7
  263. package/dist/core/shell-lexer.js +5 -4
  264. package/dist/core/shell-wrapper-table.d.ts +2 -2
  265. package/dist/core/shell-wrapper-table.js +1 -1
  266. package/dist/core/skill-grant.js +1 -1
  267. package/dist/core/store-contracts/checkpoint-store-contract.js +13 -0
  268. package/dist/core/store-contracts/mailbox-store-contract.d.ts +7 -14
  269. package/dist/core/store-contracts/session-store-incarnation-contract.d.ts +27 -0
  270. package/dist/core/store-contracts/session-store-incarnation-contract.js +92 -0
  271. package/dist/core/stub-env.d.ts +2 -0
  272. package/dist/core/stub-env.js +1 -0
  273. package/dist/core/synthetic-read-verdict.js +2 -2
  274. package/dist/core/task-event.d.ts +59 -5
  275. package/dist/core/task-result.d.ts +1 -1
  276. package/dist/core/task-spec.d.ts +42 -9
  277. package/dist/core/terminal-cause.d.ts +94 -11
  278. package/dist/core/tighten-task-spec.d.ts +5 -4
  279. package/dist/core/tighten-task-spec.js +20 -25
  280. package/dist/core/tool-catalog-entries.d.ts +5 -7
  281. package/dist/core/tool-catalog-entries.js +14 -15
  282. package/dist/core/tool-face.d.ts +47 -0
  283. package/dist/core/tool-face.js +5 -0
  284. package/dist/core/tool-model-gate.d.ts +5 -5
  285. package/dist/core/tool-name-aliases.d.ts +35 -10
  286. package/dist/core/tool-name-aliases.js +15 -0
  287. package/dist/core/tool-name-list.d.ts +30 -0
  288. package/dist/core/tool-name-list.js +55 -0
  289. package/dist/core/tool-name-readings.d.ts +1 -9
  290. package/dist/core/tool-name-readings.js +1 -3
  291. package/dist/core/tool-policy.d.ts +195 -85
  292. package/dist/core/tool-policy.js +165 -381
  293. package/dist/core/tool-registry.d.ts +44 -1
  294. package/dist/core/tool-registry.js +26 -0
  295. package/dist/core/tool-roster.d.ts +19 -1
  296. package/dist/core/tool-roster.js +21 -2
  297. package/dist/core/tool-spec-members.d.ts +45 -0
  298. package/dist/core/tool-spec-members.js +169 -0
  299. package/dist/core/tool-spec.d.ts +46 -8
  300. package/dist/core/tools.d.ts +6 -2
  301. package/dist/core/tools.js +8 -4
  302. package/dist/core/untrusted-egress.js +29 -26
  303. package/dist/core/untrusted-text.d.ts +13 -10
  304. package/dist/core/untrusted-text.js +6 -44
  305. package/dist/core/workflow-journal-store.d.ts +4 -1
  306. package/dist/core/write-protect.d.ts +65 -29
  307. package/dist/core/write-protect.js +235 -177
  308. package/dist/engine/compaction/compaction.d.ts +2 -2
  309. package/dist/engine/execution-env/node-execution-env.d.ts +5 -23
  310. package/dist/engine/execution-env/node-execution-env.js +16 -38
  311. package/dist/engine/execution-env/symlink-chain.d.ts +23 -0
  312. package/dist/engine/execution-env/symlink-chain.js +32 -0
  313. package/dist/engine/harness/types.d.ts +7 -0
  314. package/dist/engine/llm/tool-turns.d.ts +3 -0
  315. package/dist/engine/llm/tool-turns.js +1 -0
  316. package/dist/engine/llm/types.d.ts +59 -23
  317. package/dist/engine/loop/agent-loop.js +16 -2
  318. package/dist/engine/session/memory-repo.js +11 -3
  319. package/dist/engine/session/repo-utils.d.ts +8 -0
  320. package/dist/engine/session/repo-utils.js +13 -0
  321. package/dist/index.d.ts +20 -23
  322. package/dist/index.js +17 -20
  323. package/dist/internal/harness.d.ts +1 -1
  324. package/dist/internal/harness.js +1 -1
  325. package/dist/internal/llm.d.ts +2 -2
  326. package/dist/internal/llm.js +1 -1
  327. package/dist/orchestration/governance-baseline-validity.js +1 -1
  328. package/dist/orchestration/run-spec.js +3 -3
  329. package/dist/orchestration/run-workflow-tool.d.ts +16 -35
  330. package/dist/orchestration/run-workflow-tool.js +38 -78
  331. package/dist/orchestration/workflow-governance.d.ts +21 -25
  332. package/dist/orchestration/workflow-governance.js +38 -78
  333. package/dist/orchestration/workflow-primitives.d.ts +7 -22
  334. package/dist/orchestration/workflow-primitives.js +5 -12
  335. package/dist/orchestration/workflow-types.d.ts +1 -1
  336. package/dist/orchestration/workflow.d.ts +61 -11
  337. package/dist/orchestration/workflow.js +191 -119
  338. package/dist/prompt-assembly/types.d.ts +1 -1
  339. package/dist/scenarios/full-body.d.ts +1 -1
  340. package/dist/shell/lex.d.ts +0 -21
  341. package/dist/shell/lex.js +278 -70
  342. package/dist/shell/shell-words.d.ts +35 -0
  343. package/dist/shell/shell-words.js +65 -0
  344. package/dist/stores/file/checkpoint-store.d.ts +5 -5
  345. package/dist/stores/file/checkpoint-store.js +5 -2
  346. package/dist/stores/file/index.d.ts +0 -8
  347. package/dist/stores/file/index.js +0 -12
  348. package/dist/stores/file/session-store.d.ts +3 -0
  349. package/dist/stores/file/session-store.js +44 -19
  350. package/dist/tools/artifact/artifact-tool.js +2 -0
  351. package/dist/tools/fs/bash-program-position.d.ts +17 -3
  352. package/dist/tools/fs/bash-program-position.js +25 -10
  353. package/dist/tools/fs/bash-readonly-classifier.d.ts +1 -1
  354. package/dist/tools/fs/bash-readonly-classifier.js +8 -7
  355. package/dist/tools/fs/containment-face.d.ts +4 -0
  356. package/dist/tools/fs/containment-face.js +3 -0
  357. package/dist/tools/fs/fs-shared.d.ts +10 -0
  358. package/dist/tools/fs/fs-shared.js +18 -0
  359. package/dist/tools/fs/fs-write.js +4 -2
  360. package/dist/tools/fs/index.d.ts +3 -2
  361. package/dist/tools/fs/index.js +2 -2
  362. package/dist/tools/fs/program-read-model.d.ts +99 -23
  363. package/dist/tools/fs/program-read-model.js +129 -55
  364. package/dist/tools/fs/program-read-model.rows.d.ts +0 -14
  365. package/dist/tools/fs/program-read-model.rows.js +18 -10
  366. package/dist/tools/fs/read-deny-home.d.ts +35 -30
  367. package/dist/tools/fs/read-deny-home.js +45 -38
  368. package/dist/tools/fs/read-deny.d.ts +35 -27
  369. package/dist/tools/fs/read-deny.js +126 -92
  370. package/dist/tools/fs/removal-targets.d.ts +56 -23
  371. package/dist/tools/fs/removal-targets.js +74 -87
  372. package/dist/tools/fs/safety.d.ts +29 -22
  373. package/dist/tools/fs/safety.js +17 -11
  374. package/dist/tools/fs/search.js +10 -8
  375. package/dist/tools/fs/shell-read-argv.d.ts +4 -7
  376. package/dist/tools/fs/shell-read-argv.js +6 -8
  377. package/dist/tools/fs/shell-read-bindings.d.ts +203 -46
  378. package/dist/tools/fs/shell-read-bindings.js +488 -144
  379. package/dist/tools/fs/shell-read-builtins.d.ts +35 -0
  380. package/dist/tools/fs/shell-read-builtins.js +43 -0
  381. package/dist/tools/fs/shell-read-check.d.ts +15 -1
  382. package/dist/tools/fs/shell-read-check.js +51 -42
  383. package/dist/tools/fs/shell-read-establish.js +9 -10
  384. package/dist/tools/fs/shell-read-functions.d.ts +22 -0
  385. package/dist/tools/fs/shell-read-functions.js +29 -0
  386. package/dist/tools/fs/shell-read-judge.d.ts +48 -18
  387. package/dist/tools/fs/shell-read-judge.js +33 -4
  388. package/dist/tools/fs/shell-read-plan.d.ts +13 -20
  389. package/dist/tools/fs/shell-read-plan.js +200 -194
  390. package/dist/tools/fs/shell-read-start.d.ts +80 -0
  391. package/dist/tools/fs/shell-read-start.js +99 -0
  392. package/dist/tools/fs/shell-read-word.d.ts +35 -6
  393. package/dist/tools/fs/shell-read-word.js +89 -9
  394. package/dist/tools/fs/shell-read-workdir.d.ts +156 -0
  395. package/dist/tools/fs/shell-read-workdir.js +281 -0
  396. package/dist/tools/fs/shell-read-write-targets.d.ts +5 -2
  397. package/dist/tools/fs/shell-read-write-targets.js +14 -5
  398. package/dist/tools/fs/shell-reentry-text.d.ts +26 -26
  399. package/dist/tools/fs/shell-reentry-text.js +31 -34
  400. package/dist/tools/task-list.d.ts +1 -2
  401. package/dist/tools/web.js +1 -1
  402. package/package.json +4 -1
  403. package/test/export-surface.snapshot.json +107 -143
  404. package/wire-changes/core@7.48.0.json +252 -0
  405. package/wire-changes/core@7.49.0.json +4765 -0
  406. package/dist/agents/teacher.d.ts +0 -159
  407. package/dist/agents/teacher.js +0 -577
  408. package/dist/agents/team.d.ts +0 -226
  409. package/dist/agents/team.js +0 -257
  410. package/dist/core/strategy-store.d.ts +0 -238
  411. package/dist/core/strategy-store.js +0 -253
  412. package/dist/orchestration/builtin-workflows.d.ts +0 -133
  413. package/dist/orchestration/builtin-workflows.js +0 -159
  414. package/dist/scenarios/env.d.ts +0 -40
  415. package/dist/scenarios/env.js +0 -39
  416. package/dist/scenarios/scenario-registry.d.ts +0 -110
  417. package/dist/scenarios/scenario-registry.js +0 -140
  418. package/dist/scenarios/teacher-quickstart.d.ts +0 -40
  419. package/dist/scenarios/teacher-quickstart.js +0 -12
  420. package/dist/stores/cc/lockfile.d.ts +0 -10
  421. package/dist/stores/cc/lockfile.js +0 -98
  422. package/dist/stores/cc/mailbox-store.d.ts +0 -20
  423. package/dist/stores/cc/mailbox-store.js +0 -255
  424. package/dist/stores/cc/roster-adapter.d.ts +0 -12
  425. package/dist/stores/cc/roster-adapter.js +0 -117
  426. package/dist/stores/cc/sidecar-transcript.d.ts +0 -97
  427. package/dist/stores/cc/sidecar-transcript.js +0 -264
  428. package/dist/stores/cc/task-list-store.d.ts +0 -2
  429. package/dist/stores/cc/task-list-store.js +0 -125
  430. package/dist/stores/file/strategy-store.d.ts +0 -97
  431. package/dist/stores/file/strategy-store.js +0 -341
@@ -15,51 +15,54 @@ export declare function declaredReadDenyHomes(env: Pick<ExecutionEnv, "homeDir">
15
15
  * gave no answer, or where the declared home's own probe did not answer (ask again later). */
16
16
  export declare function readDenyHomesOf(env: Pick<ExecutionEnv, "homeDir" | "canonicalPath">, signal?: AbortSignal): Promise<string[]>;
17
17
  /**
18
- * Where the home-anchored rows of a table LEAD beyond the home's own spellings, keyed by the row's pattern — the
19
- * `linked` argument of `compileReadDeny`. For each row, its LITERAL HEAD (`readDenyRunHead`: the run's segments before
20
- * the first one carrying `*`) is spelled under each home and resolved the way the read faces mint their keys
21
- * (`canonicalizeTarget`: the longest existing prefix resolved, the rest rejoined); a location that differs from every
22
- * home's own spelling of the head is where one of the head's segments is a link, and the row is placed there too.
23
- * · a head that resolves to its own spelling under a home adds nothing (the row is already placed there);
18
+ * Where a table's deny rows LEAD past the places their own runs anchor them, keyed by the row's pattern — the `linked`
19
+ * argument of `compileReadDeny`. ONE constructor for every anchor ({@link ReadDenyRowAnchor}): the rows the anchor
20
+ * places, each row's LITERAL HEAD ({@link literalHeadOf}) spelled under each of the anchor's places and resolved the way the
21
+ * read faces mint their keys (`canonicalizeTarget`: the longest existing prefix resolved, the rest rejoined); a location
22
+ * that differs from the spellings the row is already anchored at is where one of the head's segments is a link (`~/.sema`
23
+ * into a dotfiles directory, `/app` a link to `/data/app`), and the row is placed there too.
24
+ * · a head that resolves to its own spelling at an anchored place adds nothing (the row is already placed there);
24
25
  * · a head under a spelling that is no directory (a segment of it is a file, a symlink to a file, a device node or a
25
26
  * socket — the environment answers `not_directory` for the head) has nothing below it: an answer that adds nothing;
26
27
  * · any other head that cannot be resolved (an unanswered or refused probe — a directory the probe may not enter — a
27
- * probe that throws) adds nothing, and the answer is not WHOLE (`whole: false`): the row stays placed at the home's
28
- * spellings until the mount places again;
29
- * · a row whose head is empty (`~/.sema.*`) has no location to resolve and adds nothing;
28
+ * probe that throws) adds nothing, and the answer is not WHOLE (`whole: false`): the row stays at the places its run
29
+ * anchors until the mount places again;
30
30
  * · the heads are resolved together, so one placement waits at most one probe bound — or, with `deadline` (an absolute
31
31
  * time), each head until then: a head still unresolved at the deadline is a head that did not answer;
32
32
  * · read per placement — a link created afterwards is followed from the next placement on.
33
33
  */
34
- export declare function readDenyHomeLinksOf(env: ExecutionEnv, entries: readonly {
34
+ export declare function readDenyLinksOf(env: ExecutionEnv, entries: readonly {
35
35
  readonly pattern: string;
36
36
  readonly caseSensitive?: boolean;
37
- }[], homes: readonly string[], signal?: AbortSignal, deadline?: number): Promise<{
37
+ }[], anchor: ReadDenyRowAnchor, signal?: AbortSignal, deadline?: number): Promise<{
38
38
  readonly linked: Map<string, string[]>;
39
39
  readonly whole: boolean;
40
40
  }>;
41
41
  /**
42
- * Where the rows that open with the configuration directory's name (`~/.sema/…`, {@link agentConfigDirTail}) lead when
43
- * the host declares the directory's root (`RunnerDeps.agentConfigDir`) — the same `linked` answer
44
- * {@link readDenyHomeLinksOf} gives, for the same rows: the row's literal head below the directory name is spelled under
45
- * each spelling of the root and resolved the way the read faces mint their keys. A row is not anchored at the root by
46
- * its own run (it is anchored at the homes), so every location here — the spelling itself and where it leads — is one the
47
- * row is placed at in addition; the home spelling stays placed. The row's name in every refusal is unchanged.
48
- * · a row whose run does not open with the directory's name (`~/.sema.*`, the external tools' files) adds nothing;
49
- * · a row whose head ends at the directory name (`~/.sema/*.json`, `~/.sema`) is placed at the root itself, the rest of
50
- * its run matched below it.
42
+ * Which rows one placement reads, and where their heads are spelled:
43
+ * · `home` — the home-anchored rows (`~/…`), under each home; the row's run anchors it there;
44
+ * · `root` — the ROOTED rows (`/app/config-lkg.json`, {@link isRootedReadDenyPattern}), under the filesystem root; the run
45
+ * anchors it there. A root is no home: read whether or not a home answered;
46
+ * · `unanchored` — the rows that open with the configuration directory's name (`~/.sema/…`, {@link agentConfigDirTail})
47
+ * under each spelling of the root the host declares for that directory (`RunnerDeps.agentConfigDir`): the head BELOW
48
+ * the directory name, a head that ends at it (`~/.sema/*.json`, `~/.sema`) the root itself. The row's run does not
49
+ * anchor it there (it is anchored at the homes), so every location — the spelling itself and where it leads — is one
50
+ * the row is placed at in addition; the row's name in every refusal is unchanged.
51
+ * A home or rooted row whose head is empty (`~/.sema.*`, `/*.json`) has no location to resolve and adds nothing.
51
52
  */
52
- export declare function readDenyConfigRootLinksOf(env: ExecutionEnv, entries: readonly {
53
- readonly pattern: string;
54
- readonly caseSensitive?: boolean;
55
- }[], roots: readonly string[], signal?: AbortSignal, deadline?: number): Promise<{
56
- readonly linked: Map<string, string[]>;
57
- readonly whole: boolean;
58
- }>;
53
+ export type ReadDenyRowAnchor = {
54
+ readonly at: "home";
55
+ readonly homes: readonly string[];
56
+ } | {
57
+ readonly at: "root";
58
+ } | {
59
+ readonly at: "unanchored";
60
+ readonly roots: readonly string[];
61
+ };
59
62
  /** Where an absolute location LEADS in one environment — resolved the way the read and write faces mint their keys
60
63
  * (`canonicalizeTarget`: the longest existing prefix resolved, the rest rejoined). `undefined` when the environment
61
64
  * does not answer (a refused or failed probe, one that throws). The one resolution a deny row's placement reads: a
62
- * home-anchored row's head ({@link readDenyHomeLinksOf}) and a rule row's head ({@link whereItsAnsweredPrefixLeads}). */
65
+ * deny row's head ({@link readDenyLinksOf}) and a rule row's head ({@link whereItsAnsweredPrefixLeads}). */
63
66
  export declare function whereItLeads(env: ExecutionEnv, at: string, family?: PathFamily, signal?: AbortSignal): Promise<string | undefined>;
64
67
  /** {@link whereItLeads} with a floor: where the environment does not answer for `at` (a probe that fails), the longest
65
68
  * prefix it does answer for is resolved and the rest rejoined — a rule row's head below a base that resolves is never
@@ -133,12 +136,14 @@ export declare function carryHomeViews<T extends object>(judge: T, source: HomeV
133
136
  * · the HOME SET — `homes` when the mount carries a list (the account is not asked and no home is added), else the
134
137
  * declared home and the account lookup's answer ({@link declaredReadDenyHomes}); every home of the set is anchored at
135
138
  * its spelling and, where the environment answered one, its canonical spelling — one rule for both forms;
136
- * · the DECLARED home's canonical spelling under the tree's gate bound, and its rows' heads ({@link readDenyHomeLinksOf}):
139
+ * · the DECLARED home's canonical spelling under the tree's gate bound, and its rows' heads ({@link readDenyLinksOf}):
137
140
  * a declared home, or a head under it, that did not answer leaves the placement not WHOLE — and an account lookup
138
141
  * with no answer, or a declared home that did not answer, places nothing: the rows are held anywhere (`compile([])`)
139
142
  * rather than at a spelling that may miss the home's canonical one;
140
143
  * · each AUXILIARY home (see the module head) read once under {@link AUXILIARY_HOME_PROBE_MS} — its spellings, its
141
- * chain, its rows' heads — at the same time; whatever of it did not answer costs that home alone and never `whole`.
144
+ * chain, its rows' heads — at the same time; whatever of it did not answer costs that home alone and never `whole`;
145
+ * · the ROOTED rows' heads ({@link readDenyLinksOf}), read whether or not a home answered: a head that did not answer
146
+ * leaves the placement not WHOLE, and a placement that held the rows anywhere still places them.
142
147
  * `compile` is the mount's own compile; the rows' patterns are read off its compile at no home. */
143
148
  export declare function placeReadDenyAtHome(env: ExecutionEnv, compile: (homes: readonly string[], linked?: ReadonlyMap<string, readonly string[]>) => ReadDenyMatcher, homes?: readonly string[], signal?: AbortSignal, configRoot?: string): Promise<{
144
149
  readonly matcher: PlacedReadDenyMatcher;
@@ -1,9 +1,10 @@
1
1
  import { userInfo } from "node:os";
2
- import { canonicalizeTarget, isAbsolutePathForm, joinForFamily, normalizeAbsPathLexically, pathFamilyOf } from "./safety.js";
2
+ import { canonicalizeTarget, isAbsoluteForFamily, joinForFamily, normalizeAbsPathLexically, pathFamilyOf } from "./safety.js";
3
3
  import { DEFAULT_GATE_AWAIT_TIMEOUT_MS, withGateTimeout } from "../../core/gate-bounded-await.js";
4
4
  import { thrownText } from "../../core/thrown-value.js";
5
5
  import { agentConfigDirTail } from "../../core/agent-config-dir.js";
6
- import { readDenyPatternRun, readDenyRunHead } from "./read-deny.js";
6
+ import { validatePath } from "../../core/effective-path-target.js";
7
+ import { isRootedReadDenyPattern, readDenyPatternRun, readDenyRunHead } from "./read-deny.js";
7
8
  export const AUXILIARY_HOME_PROBE_MS = 2_000;
8
9
  const said = new Set();
9
10
  function sayOnce(kind, line) {
@@ -36,8 +37,9 @@ function valueText(v) {
36
37
  function accountHomeOf() {
37
38
  try {
38
39
  const home = userInfo().homedir;
39
- if (typeof home === "string" && isAbsolutePathForm(home))
40
- return { state: "home", home };
40
+ const valid = validatePath(home, { intent: "validate-coordinate" });
41
+ if (valid !== undefined)
42
+ return { state: "home", home: valid };
41
43
  sayOnce("bad_value", `read-deny homes: the account home lookup answered ${valueText(home)}, not an absolute path — home-anchored read-deny rows are placed under the environment's declared home only.`);
42
44
  return { state: "none" };
43
45
  }
@@ -49,8 +51,7 @@ function accountHomeOf() {
49
51
  }
50
52
  }
51
53
  function declaredHomeOf(env) {
52
- const home = env.homeDir;
53
- return home !== undefined && isAbsolutePathForm(home) ? home : undefined;
54
+ return validatePath(env.homeDir, { intent: "validate-coordinate" });
54
55
  }
55
56
  function declaredReadDenyHomesAnswered(env) {
56
57
  const home = declaredHomeOf(env);
@@ -105,39 +106,43 @@ function sayAuxiliary(what, subject = "auxiliary") {
105
106
  }
106
107
  sayOnce("auxiliary", `read-deny homes: a home beside the environment's declared home did not answer its probes within ${AUXILIARY_HOME_PROBE_MS} ms (${what}) — its home-anchored read-deny rows sit at its spelling only, and a path through an alias of it is judged as spelled, until the next placement.`);
107
108
  }
108
- export async function readDenyHomeLinksOf(env, entries, homes, signal, deadline) {
109
- const rows = [];
110
- for (const { pattern, caseSensitive } of entries) {
111
- const { homeAnchored, run } = readDenyPatternRun(pattern);
112
- if (!homeAnchored)
113
- continue;
114
- const head = run.split("/").filter(Boolean).slice(0, readDenyRunHead(run)).join("/");
115
- if (head.length === 0)
116
- continue;
117
- const spelled = homes.map((home) => normalizeAbsPathLexically(joinForFamily(pathFamilyOf({ root: home }), home, head)));
118
- rows.push({ pattern, caseSensitive: caseSensitive === true, spelled, anchored: spelled });
119
- }
120
- return await linkedLocationsOf(env, rows, signal, deadline);
109
+ export async function readDenyLinksOf(env, entries, anchor, signal, deadline) {
110
+ return await linkedLocationsOf(env, anchoredRowsOf(entries, anchor), signal, deadline);
121
111
  }
122
- export async function readDenyConfigRootLinksOf(env, entries, roots, signal, deadline) {
123
- return await linkedLocationsOf(env, configRootRowsOf(entries, roots), signal, deadline);
112
+ const ROOT = "/";
113
+ function literalHeadOf(run) {
114
+ return run.split("/").filter(Boolean).slice(0, readDenyRunHead(run)).join("/");
124
115
  }
125
- function configRootRowsOf(entries, roots) {
116
+ function anchoredRowsOf(entries, anchor) {
117
+ const places = anchor.at === "home" ? anchor.homes : anchor.at === "root" ? [ROOT] : anchor.roots;
126
118
  const rows = [];
127
119
  for (const { pattern, caseSensitive } of entries) {
128
- const { homeAnchored, run } = readDenyPatternRun(pattern);
129
- const tail = homeAnchored ? agentConfigDirTail(run, caseSensitive === true) : undefined;
130
- if (tail === undefined)
120
+ const head = rowHeadOf(pattern, caseSensitive === true, anchor);
121
+ if (head === undefined)
131
122
  continue;
132
- const head = tail.split("/").filter(Boolean).slice(0, readDenyRunHead(tail)).join("/");
133
- const spelled = roots.map((root) => normalizeAbsPathLexically(head.length === 0 ? root : joinForFamily(pathFamilyOf({ root }), root, head)));
134
- rows.push({ pattern, caseSensitive: caseSensitive === true, spelled, anchored: [] });
123
+ const spelled = places.map((place) => normalizeAbsPathLexically(head.length === 0 ? place : joinForFamily(pathFamilyOf({ root: place }), place, head)));
124
+ rows.push({ pattern, caseSensitive: caseSensitive === true, spelled, anchored: anchor.at === "unanchored" ? [] : spelled });
135
125
  }
136
126
  return rows;
137
127
  }
128
+ function rowHeadOf(pattern, caseSensitive, anchor) {
129
+ if (anchor.at === "root") {
130
+ const head = isRootedReadDenyPattern(pattern) ? literalHeadOf(pattern) : "";
131
+ return head.length > 0 ? head : undefined;
132
+ }
133
+ const { homeAnchored, run } = readDenyPatternRun(pattern);
134
+ if (!homeAnchored)
135
+ return undefined;
136
+ if (anchor.at === "unanchored") {
137
+ const tail = agentConfigDirTail(run, caseSensitive);
138
+ return tail === undefined ? undefined : literalHeadOf(tail);
139
+ }
140
+ const head = literalHeadOf(run);
141
+ return head.length > 0 ? head : undefined;
142
+ }
138
143
  function configRootSpelledLinks(entries, roots) {
139
144
  const out = new Map();
140
- for (const { pattern, spelled } of configRootRowsOf(entries, roots))
145
+ for (const { pattern, spelled } of anchoredRowsOf(entries, { at: "unanchored", roots }))
141
146
  out.set(pattern, [...new Set(spelled)]);
142
147
  return out;
143
148
  }
@@ -242,9 +247,7 @@ async function readAuxiliaryHome(env, home, opts, signal) {
242
247
  typeof identity === "function" ? chainAbove(env, identity, spelled.canonical, signal, deadline) : Promise.resolve({ ancestors: [], whole: true }),
243
248
  opts.entries === undefined
244
249
  ? Promise.resolve({ linked: new Map(), whole: true })
245
- : opts.configRoot === true
246
- ? readDenyConfigRootLinksOf(env, opts.entries, place, signal, deadline)
247
- : readDenyHomeLinksOf(env, opts.entries, place, signal, deadline),
250
+ : readDenyLinksOf(env, opts.entries, opts.configRoot === true ? { at: "unanchored", roots: place } : { at: "home", homes: place }, signal, deadline),
248
251
  ]);
249
252
  reading = { place, chain, linked: heads.linked, answered: chain.whole && heads.whole };
250
253
  }
@@ -320,7 +323,7 @@ function homeViewSourceOver(env, auxiliary) {
320
323
  };
321
324
  return {
322
325
  async of(path, opts) {
323
- if (typeof identity !== "function" || (declared === undefined && auxiliary.length === 0) || !isAbsolutePathForm(path))
326
+ if (typeof identity !== "function" || (declared === undefined && auxiliary.length === 0) || !isAbsoluteForFamily("own", path))
324
327
  return undefined;
325
328
  const spelled = normalizeAbsPathLexically(path);
326
329
  const view = await viewOf(spelled, opts?.leaf === "file");
@@ -348,7 +351,7 @@ export function sayPlacementLost() {
348
351
  }
349
352
  function readAuxiliaryHomes(env, homes, opts, signal) {
350
353
  const declared = declaredHomeOf(env);
351
- return [...new Set(homes.filter((h) => isAbsolutePathForm(h) && !isDeclared(declared, h)))].map((home) => readAuxiliaryHome(env, home, opts, signal));
354
+ return [...new Set(homes.filter((h) => isAbsoluteForFamily("own", h) && !isDeclared(declared, h)))].map((home) => readAuxiliaryHome(env, home, opts, signal));
352
355
  }
353
356
  export function homeViewsAt(env, homes) {
354
357
  return homeViewSourceOver(env, readAuxiliaryHomes(env, homes, {}));
@@ -363,8 +366,12 @@ export async function placeReadDenyAtHome(env, compile, homes, signal, configRoo
363
366
  const entries = compile([]).entries;
364
367
  const declared = declaredHomeOf(env);
365
368
  const relocated = configRoot === undefined ? undefined : readAuxiliaryHome(env, configRoot, { entries, configRoot: true }, signal);
369
+ const rooted = readDenyLinksOf(env, entries, { at: "root" }, signal);
366
370
  const heldAnywhere = async (whole) => {
367
- const linked = (await relocated)?.linked ?? new Map();
371
+ const linked = new Map();
372
+ for (const map of [(await relocated)?.linked, (await rooted).linked])
373
+ for (const [pattern, locations] of map ?? [])
374
+ linked.set(pattern, locations);
368
375
  return placementOf(carryHomeViews(linked.size === 0 ? compile([]) : compile([], linked), homeViewSourceOver(env, relocated === undefined ? [] : [relocated])), [], linked, whole);
369
376
  };
370
377
  const listed = homes === undefined ? declaredReadDenyHomesAnswered(env) : { homes, whole: true };
@@ -379,15 +386,15 @@ export async function placeReadDenyAtHome(env, compile, homes, signal, configRoo
379
386
  declaredAt = [...new Set([...own, ...ownSpellings.spellings])];
380
387
  }
381
388
  const auxiliary = readAuxiliaryHomes(env, listed.homes, { entries }, signal);
382
- const [heads, readings, root] = await Promise.all([readDenyHomeLinksOf(env, entries, declaredAt, signal), Promise.all(auxiliary), relocated]);
389
+ const [heads, readings, root, rootedHeads] = await Promise.all([readDenyLinksOf(env, entries, { at: "home", homes: declaredAt }, signal), Promise.all(auxiliary), relocated, rooted]);
383
390
  const at = [...new Set([...declaredAt, ...readings.flatMap((r) => r.place)])];
384
391
  const linked = new Map();
385
- for (const map of [heads.linked, ...readings.map((r) => r.linked), ...(root === undefined ? [] : [root.linked])]) {
392
+ for (const map of [heads.linked, ...readings.map((r) => r.linked), ...(root === undefined ? [] : [root.linked]), rootedHeads.linked]) {
386
393
  for (const [pattern, locations] of map)
387
394
  linked.set(pattern, [...new Set([...(linked.get(pattern) ?? []), ...locations])]);
388
395
  }
389
396
  const matcher = linked.size === 0 ? compile(at) : compile(at, linked);
390
- return placementOf(carryHomeViews(matcher, homeViewSourceOver(env, relocated === undefined ? auxiliary : [...auxiliary, relocated])), at, linked, heads.whole);
397
+ return placementOf(carryHomeViews(matcher, homeViewSourceOver(env, relocated === undefined ? auxiliary : [...auxiliary, relocated])), at, linked, heads.whole && rootedHeads.whole);
391
398
  }
392
399
  export function readDenyPlacedLater(unplaced, place) {
393
400
  let current = unplaced;
@@ -1,3 +1,4 @@
1
+ import { type PathGuardFold, type PathGuardRow, type PathRowsHit, type TargetViews } from "../../core/path-guard-rows.js";
1
2
  /**
2
3
  * One deny entry: a `/`-separated run of path SEGMENTS. `*` matches any run of non-separator
3
4
  * characters within one segment and is the ONLY metacharacter (everything else is literal). The run
@@ -5,7 +6,10 @@
5
6
  * unless the pattern opens with the HOME word ({@link READ_DENY_HOME_WORD}): `~/<run>` matches only where
6
7
  * the run starts right below the execution environment's home directory (`~/.sema/settings.json` is the
7
8
  * home's file, never a project's `.sema/settings.json`). Only a FIRST segment that is exactly `~` is the
8
- * word; `~user` and a `~` further along are literal segments.
9
+ * word; `~user` and a `~` further along are literal segments. A pattern that opens with `/` (and is not home-anchored)
10
+ * is ROOTED, the same kind of anchor with the filesystem root as its place: `/app/config-lkg.json` names the file
11
+ * at exactly that location, never a project's `app/config-lkg.json` — the run must start at the first segment of an
12
+ * absolute path (a path that is not absolute is not placed, and the row does not judge it).
9
13
  * String shorthand ≡ `{ pattern }`. Matching is ASCII-case-insensitive by default (a case-insensitive
10
14
  * filesystem serves `.SSH` and `.ssh` as the same directory); `caseSensitive: true` opts a single
11
15
  * entry out. Unicode normalization (NFC/NFD) and volume-level case semantics are NOT modeled (v1
@@ -83,28 +87,12 @@ export type PathRowReach = {
83
87
  export interface JudgedPathRow extends PathRuleDenyRow {
84
88
  readonly reach?: (absolutePath: string) => PathRowReach;
85
89
  }
86
- /** A call's target as a judgment reads it: the absolute spellings of its views (lexical, canonical, the leaf chain's hops —
87
- * any order the caller holds), or `unreadable` when the call names a target this reading cannot locate. */
88
- export interface TargetViews {
89
- readonly spellings: readonly string[];
90
- readonly unreadable?: string;
91
- }
92
- /** What {@link pathRowsReach} found: the row, the view it met there (absent on an unreadable hold), and — when nothing was
93
- * reached and some row could not be judged — the reason of the first such row. */
94
- export interface PathRowsHit<R> {
95
- readonly row: R;
96
- readonly view?: string;
97
- readonly unreadable?: string;
98
- }
99
90
  /**
100
- * THE one judgment of path rule rows over a call's target, for the gate's rule lanes and the tool's deny table alike: rows
101
- * outer, views inner — the first row (in the caller's order) that some view reaches is the answer, so the rule a refusal
102
- * names does not depend on which view happened to meet it. `tighten` (deny / ask): any view reaching the row reaches it; a
103
- * row that cannot be judged (or a target that cannot be read) is held and answered only when no row reaches. `allow`: a
104
- * row admits the call only when it admits EVERY view (a link out of an allowed directory is not admitted through its
105
- * spelling); an unreadable target is admitted by nothing.
91
+ * Rule rows judged by THE one judgment ({@link judgePathRows}): each rule row read as a guarded row whose reach over a view
92
+ * is the rule's own reach over the view's spelling (never exemptible — a rule says exactly where it reaches). Same rows
93
+ * outer, views inner, same tighten / allow law as every other row; the hit names the rule row itself.
106
94
  */
107
- export declare function pathRowsReach<R extends JudgedPathRow>(rows: readonly R[], views: TargetViews, direction: "tighten" | "allow"): PathRowsHit<R> | undefined;
95
+ export declare function judgeRuleRows<R extends JudgedPathRow>(rows: readonly R[], views: TargetViews, direction: "tighten" | "allow"): PathRowsHit<R> | undefined;
108
96
  /** The locations a row is also judged at (each leading part of its HEAD: the anchor's children down to the head itself,
109
97
  * a share's root for a UNC head) — what a leg resolves once, for every row whose head it holds. */
110
98
  export declare function ruleHeadParts(rows: readonly Pick<PathRuleDenyRow, "head">[]): string[];
@@ -126,10 +114,23 @@ export declare function rowsWhereTheyLead<R extends JudgedPathRow>(rows: readonl
126
114
  export declare function locationLeadsTo(path: string, leads: ReadonlyMap<string, string | undefined>): string | undefined;
127
115
  /** {@link rowsWhereTheyLead} with each part resolved by `leadsTo` (the leg's resolution; each part once). */
128
116
  export declare function withRuleRowsWhereTheyLead<R extends JudgedPathRow>(rows: readonly R[], leadsTo: (head: string) => Promise<string | undefined>): Promise<R[]>;
117
+ /** A rule row as a row of the one table: its name is the rule text, its reach the rule's own over a view's spelling. */
118
+ export declare function ruleGuardRow<R extends JudgedPathRow>(rule: R): PathGuardRow & {
119
+ readonly rule: R;
120
+ };
121
+ /** A compiled segment-glob row as a row of the one table (`faces`, `polarity`, `exemptible` and `origin` are the table's). */
122
+ export declare function segmentGuardRow(pat: CompiledSegmentPattern, columns: {
123
+ readonly faces: readonly DenyFace[];
124
+ readonly polarity: "deny" | "ask";
125
+ readonly exemptible: boolean;
126
+ readonly fold: PathGuardFold;
127
+ readonly origin: PathGuardRow["origin"];
128
+ readonly tier?: string;
129
+ }): PathGuardRow;
129
130
  /**
130
131
  * The WRITE face of the deny table: the rule rows whose faces include `write` — the judge the shell station reads for a
131
132
  * command's write targets (a redirection, `tee`, `sed -i`, `cp` / `mv` / `touch` / `mkdir` / `rm` operands). Same row
132
- * type, same judgment ({@link pathRowsReach}) as the read face's rule rows; a hit names the row by its rule text.
133
+ * type, same judgment ({@link judgePathRows}) as the read face's rows; a hit names the row by its rule text.
133
134
  */
134
135
  export interface WriteDenyMatcher {
135
136
  /** Which face this judge is — the write tools' path resolution reads it to word and code the refusal as a write. */
@@ -384,8 +385,9 @@ export interface CompiledSegmentPattern {
384
385
  /** The segment lists of the directories the run is ANCHORED at (folded as the pattern folds): the run must start
385
386
  * right after one of them. Absent = the run matches anywhere. */
386
387
  anchors?: readonly (readonly string[])[];
387
- /** Judged in a ROOTED view only: an extra location of a home-anchored row (where its literal head leads). A view that
388
- * is not rooted cannot be placed and is covered by the row's own run, held anywhere. */
388
+ /** Judged in a ROOTED view only: an extra location of a home-anchored row (where its literal head leads), or a row that is
389
+ * itself rooted (anchored at the filesystem root, {@link ReadDenyEntry}). A view that is not rooted cannot be placed: a
390
+ * home-anchored row's own run is held anywhere in it (the row cannot be placed, so it holds wider); these two judge it not. */
389
391
  rootedOnly?: true;
390
392
  }
391
393
  /**
@@ -408,6 +410,12 @@ export declare function compileSegmentPattern(raw: string, fold: "none" | "ascii
408
410
  export declare function matchSegmentPatterns(path: string, compiled: readonly CompiledSegmentPattern[], opts?: {
409
411
  readonly aliasResolved?: boolean;
410
412
  }): string | null;
413
+ /** One entry's refusal under the deny list's entry law ({@link normalizeEntry}, the compiler's own), or `undefined` when the
414
+ * entry is lawful — the law read without compiling, for a door that judges a list before anything folds it. */
415
+ export declare function readDenyEntryProblem(entry: unknown, layer: string): string | undefined;
416
+ /** Is a canonical pattern ROOTED — placed at the filesystem root ({@link ReadDenyEntry})? Only {@link canonicalReadDenyPattern}
417
+ * puts a leading `/` on a canonical pattern, so the text is the whole answer. */
418
+ export declare function isRootedReadDenyPattern(canonical: string): boolean;
411
419
  /**
412
420
  * the PURE validation/canonicality predicate over a PERSISTED deny entry (checkpoint v9
413
421
  * face section), for the resume pre-CAS ladder: it must refuse BEFORE the approval CAS everything
@@ -437,9 +445,9 @@ export declare function checkedReadDenyHomes(homes: unknown, seat?: string): rea
437
445
  * spellings only — any other shape refuses loudly, naming `readDenyHomes`. EMPTY = the environment declares no
438
446
  * home: a home-anchored entry then matches its run anywhere — a row that cannot be placed holds wider, never narrower.
439
447
  *
440
- * `linked` — where a home-anchored row's LITERAL HEAD ({@link readDenyRunHead}) really leads, keyed by the row's
441
- * pattern: the canonical locations a mount resolved (`readDenyHomeLinksOf`, read-deny-home.ts) where one of the
442
- * head's segments is a link (`~/.sema` linked into a dotfiles directory). The row is placed at each location too —
448
+ * `linked` — where a home-anchored or a rooted row's LITERAL HEAD ({@link readDenyRunHead}) really leads, keyed by the row's
449
+ * pattern: the canonical locations a mount resolved (`readDenyLinksOf`, read-deny-home.ts) where
450
+ * one of the head's segments is a link (`~/.sema` linked into a dotfiles directory; `/app` a link to `/data/app`). The row is placed at each location too —
443
451
  * the same row, the same name in every refusal — with the rest of its run matched below it. The read faces judge
444
452
  * canonical keys, so every spelling that reaches the linked file meets the row there. Absolute locations only.
445
453
  */