@sema-agent/core 7.48.0 → 7.49.1

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 (421) hide show
  1. package/CHANGELOG.md +457 -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 +38 -31
  51. package/dist/core/arg-summary.d.ts +21 -28
  52. package/dist/core/arg-summary.js +235 -88
  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 +94 -65
  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 +43 -11
  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 +21 -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.d.ts +4 -0
  101. package/dist/core/mcp.js +70 -43
  102. package/dist/core/memory-engine/content-origin.js +2 -14
  103. package/dist/core/memory-engine/engine.d.ts +32 -22
  104. package/dist/core/memory-engine/engine.js +103 -55
  105. package/dist/core/memory-engine/file-backend.d.ts +13 -30
  106. package/dist/core/memory-engine/file-backend.js +37 -252
  107. package/dist/core/memory-engine/index.d.ts +1 -1
  108. package/dist/core/memory-engine/index.js +1 -1
  109. package/dist/core/memory-engine/layout.d.ts +139 -9
  110. package/dist/core/memory-engine/layout.js +350 -7
  111. package/dist/core/memory-engine/scope-contract.d.ts +10 -0
  112. package/dist/core/memory-engine/scope-contract.js +8 -0
  113. package/dist/core/memory-engine/session-incarnation.d.ts +14 -4
  114. package/dist/core/memory-engine/session-incarnation.js +5 -2
  115. package/dist/core/memory-engine/types.d.ts +10 -1
  116. package/dist/core/memory.js +5 -17
  117. package/dist/core/model-seat.d.ts +4 -4
  118. package/dist/core/model-seat.js +1 -1
  119. package/dist/core/mounted-mcp.d.ts +57 -0
  120. package/dist/core/mounted-mcp.js +19 -0
  121. package/dist/core/namespaced-rule-name.d.ts +29 -0
  122. package/dist/core/namespaced-rule-name.js +52 -0
  123. package/dist/core/park-selfcheck.d.ts +1 -1
  124. package/dist/core/park-selfcheck.js +16 -6
  125. package/dist/core/path-guard-rows.d.ts +99 -0
  126. package/dist/core/path-guard-rows.js +45 -0
  127. package/dist/core/path-identity.d.ts +22 -16
  128. package/dist/core/path-identity.js +10 -10
  129. package/dist/core/path-rule-binding.d.ts +2 -1
  130. package/dist/core/path-rule-binding.js +3 -1
  131. package/dist/core/pause-registry.d.ts +16 -2
  132. package/dist/core/pause-registry.js +6 -0
  133. package/dist/core/permission-rule-consent.js +0 -7
  134. package/dist/core/permission-rule-model.d.ts +68 -24
  135. package/dist/core/permission-rule-model.js +105 -24
  136. package/dist/core/permission-rule-store.js +2 -2
  137. package/dist/core/permission-rules.d.ts +3 -30
  138. package/dist/core/permission-rules.js +4 -54
  139. package/dist/core/read-root-candidate.d.ts +1 -3
  140. package/dist/core/read-root-candidate.js +4 -15
  141. package/dist/core/real-approval.d.ts +4 -3
  142. package/dist/core/retired-keys.d.ts +13 -0
  143. package/dist/core/retired-keys.js +14 -0
  144. package/dist/core/roles.d.ts +2 -3
  145. package/dist/core/roles.js +15 -6
  146. package/dist/core/runner/assemble-result.d.ts +0 -7
  147. package/dist/core/runner/assemble-result.js +19 -31
  148. package/dist/core/runner/caller-roster.d.ts +78 -0
  149. package/dist/core/runner/caller-roster.js +219 -0
  150. package/dist/core/runner/checkpoint-scope.d.ts +16 -16
  151. package/dist/core/runner/checkpoint-scope.js +2 -2
  152. package/dist/core/runner/child-tree.js +2 -2
  153. package/dist/core/runner/contracts.d.ts +68 -35
  154. package/dist/core/runner/decide-continuation.d.ts +51 -3
  155. package/dist/core/runner/decide-continuation.js +76 -21
  156. package/dist/core/runner/denial-limit-arms.d.ts +17 -5
  157. package/dist/core/runner/denial-limit-arms.js +11 -9
  158. package/dist/core/runner/extra-body-dropped-seat.d.ts +8 -0
  159. package/dist/core/runner/extra-body-dropped-seat.js +22 -0
  160. package/dist/core/runner/finish-reason-seat.d.ts +9 -0
  161. package/dist/core/runner/finish-reason-seat.js +40 -0
  162. package/dist/core/runner/gate-exit.d.ts +44 -32
  163. package/dist/core/runner/gate-exit.js +112 -25
  164. package/dist/core/runner/inherited-ask-grants.js +6 -4
  165. package/dist/core/runner/mcp-redial.d.ts +3 -3
  166. package/dist/core/runner/mcp-redial.js +3 -4
  167. package/dist/core/runner/permission-rule-lanes.d.ts +1 -2
  168. package/dist/core/runner/permission-rule-lanes.js +5 -4
  169. package/dist/core/runner/prepare-artifact.d.ts +4 -0
  170. package/dist/core/runner/prepare-artifact.js +2 -1
  171. package/dist/core/runner/prepare-ask-lane.d.ts +2 -0
  172. package/dist/core/runner/prepare-ask-lane.js +12 -6
  173. package/dist/core/runner/prepare-boundary-parks.d.ts +5 -8
  174. package/dist/core/runner/prepare-boundary-parks.js +4 -7
  175. package/dist/core/runner/prepare-caps-and-workflow.d.ts +11 -15
  176. package/dist/core/runner/prepare-caps-and-workflow.js +19 -27
  177. package/dist/core/runner/prepare-config-doors.d.ts +9 -9
  178. package/dist/core/runner/prepare-config-doors.js +10 -5
  179. package/dist/core/runner/prepare-defer-classify.d.ts +2 -2
  180. package/dist/core/runner/prepare-defer-classify.js +5 -3
  181. package/dist/core/runner/prepare-delegation-surface.d.ts +1 -1
  182. package/dist/core/runner/prepare-delegation-surface.js +3 -3
  183. package/dist/core/runner/prepare-gate-stations.d.ts +4 -4
  184. package/dist/core/runner/prepare-gate-stations.js +9 -7
  185. package/dist/core/runner/prepare-hands-readface.d.ts +7 -7
  186. package/dist/core/runner/prepare-hands-readface.js +7 -7
  187. package/dist/core/runner/prepare-inherited-gate.d.ts +7 -6
  188. package/dist/core/runner/prepare-inherited-gate.js +14 -15
  189. package/dist/core/runner/prepare-listings.d.ts +7 -24
  190. package/dist/core/runner/prepare-listings.js +4 -5
  191. package/dist/core/runner/prepare-memory-engine-session.d.ts +2 -0
  192. package/dist/core/runner/prepare-memory-engine-session.js +4 -3
  193. package/dist/core/runner/prepare-memory.d.ts +6 -0
  194. package/dist/core/runner/prepare-memory.js +13 -13
  195. package/dist/core/runner/prepare-offload-wrappers.d.ts +5 -0
  196. package/dist/core/runner/prepare-offload-wrappers.js +3 -3
  197. package/dist/core/runner/prepare-park-ask.d.ts +7 -8
  198. package/dist/core/runner/prepare-park-ask.js +17 -10
  199. package/dist/core/runner/prepare-policy-chain.js +24 -44
  200. package/dist/core/runner/prepare-project-context.d.ts +1 -1
  201. package/dist/core/runner/prepare-project-context.js +3 -4
  202. package/dist/core/runner/prepare-protocol-tools.d.ts +9 -3
  203. package/dist/core/runner/prepare-protocol-tools.js +3 -4
  204. package/dist/core/runner/prepare-run-refs.d.ts +3 -0
  205. package/dist/core/runner/prepare-run-refs.js +2 -1
  206. package/dist/core/runner/prepare-safety-scan.d.ts +4 -8
  207. package/dist/core/runner/prepare-safety-scan.js +1 -2
  208. package/dist/core/runner/prepare-suspend-saga.d.ts +7 -1
  209. package/dist/core/runner/prepare-suspend-saga.js +28 -12
  210. package/dist/core/runner/prepare-task.d.ts +1 -1
  211. package/dist/core/runner/prepare-task.js +67 -56
  212. package/dist/core/runner/prepare-wiring-manifest.d.ts +11 -10
  213. package/dist/core/runner/prepare-wiring-manifest.js +5 -8
  214. package/dist/core/runner/resume-apply.js +7 -14
  215. package/dist/core/runner/resume-checkpoint-screen.js +11 -4
  216. package/dist/core/runner/resume-internals-and-config.js +2 -2
  217. package/dist/core/runner/resume-policy-outcome.js +5 -32
  218. package/dist/core/runner/resume-review-outcome.js +4 -1
  219. package/dist/core/runner/retired-runner-deps.d.ts +6 -0
  220. package/dist/core/runner/retired-runner-deps.js +10 -1
  221. package/dist/core/runner/run-brain-sinks.d.ts +4 -0
  222. package/dist/core/runner/run-brain-sinks.js +5 -2
  223. package/dist/core/runner/run-harness-handlers.js +29 -36
  224. package/dist/core/runner/run-leg.d.ts +0 -2
  225. package/dist/core/runner/run-leg.js +32 -33
  226. package/dist/core/runner/run-terminal-adoption.js +4 -3
  227. package/dist/core/runner/runtask.js +8 -8
  228. package/dist/core/runner/session-rule-policy.js +5 -5
  229. package/dist/core/runner/stream-settle-backstop.js +7 -4
  230. package/dist/core/runner/sub-agent-deny-lists.d.ts +51 -12
  231. package/dist/core/runner/sub-agent-deny-lists.js +111 -80
  232. package/dist/core/runner/terminal-account.d.ts +48 -0
  233. package/dist/core/runner/terminal-account.js +186 -0
  234. package/dist/core/runner/tool-end-body.d.ts +54 -17
  235. package/dist/core/runner/tool-end-body.js +27 -2
  236. package/dist/core/runner/tool-face-overlay.d.ts +3 -1
  237. package/dist/core/runner/tool-face-overlay.js +6 -4
  238. package/dist/core/runner/tool-occurrence.d.ts +106 -0
  239. package/dist/core/runner/tool-occurrence.js +123 -0
  240. package/dist/core/runner/tool-progress-lane.d.ts +16 -8
  241. package/dist/core/runner/tool-progress-lane.js +25 -34
  242. package/dist/core/runner/tool-turn-repair-seat.d.ts +28 -4
  243. package/dist/core/runner/tool-turn-repair-seat.js +36 -13
  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/secret-env.d.ts +16 -5
  249. package/dist/core/secret-env.js +23 -63
  250. package/dist/core/sensitive-path-policy.d.ts +19 -18
  251. package/dist/core/sensitive-path-policy.js +73 -49
  252. package/dist/core/session-reconcile.d.ts +3 -0
  253. package/dist/core/session-reconcile.js +5 -4
  254. package/dist/core/session-store.d.ts +5 -0
  255. package/dist/core/session-store.js +12 -0
  256. package/dist/core/session.d.ts +13 -0
  257. package/dist/core/shared-memory/normalize.d.ts +17 -4
  258. package/dist/core/shared-memory/normalize.js +7 -7
  259. package/dist/core/shell-lexer.js +5 -4
  260. package/dist/core/shell-wrapper-projection.js +1 -1
  261. package/dist/core/skill-grant.js +1 -1
  262. package/dist/core/store-contracts/checkpoint-store-contract.js +13 -0
  263. package/dist/core/store-contracts/mailbox-store-contract.d.ts +7 -14
  264. package/dist/core/store-contracts/session-store-incarnation-contract.d.ts +27 -0
  265. package/dist/core/store-contracts/session-store-incarnation-contract.js +92 -0
  266. package/dist/core/stub-env.d.ts +2 -0
  267. package/dist/core/stub-env.js +1 -0
  268. package/dist/core/synthetic-read-verdict.js +2 -2
  269. package/dist/core/task-event.d.ts +59 -5
  270. package/dist/core/task-result.d.ts +1 -1
  271. package/dist/core/task-spec.d.ts +42 -9
  272. package/dist/core/terminal-cause.d.ts +94 -11
  273. package/dist/core/tighten-task-spec.d.ts +5 -4
  274. package/dist/core/tighten-task-spec.js +20 -25
  275. package/dist/core/tool-catalog-entries.d.ts +5 -7
  276. package/dist/core/tool-catalog-entries.js +14 -15
  277. package/dist/core/tool-face.d.ts +47 -0
  278. package/dist/core/tool-face.js +5 -0
  279. package/dist/core/tool-model-gate.d.ts +5 -5
  280. package/dist/core/tool-name-aliases.d.ts +26 -2
  281. package/dist/core/tool-name-aliases.js +13 -0
  282. package/dist/core/tool-name-list.d.ts +30 -0
  283. package/dist/core/tool-name-list.js +55 -0
  284. package/dist/core/tool-name-readings.d.ts +1 -9
  285. package/dist/core/tool-name-readings.js +1 -3
  286. package/dist/core/tool-policy.d.ts +195 -85
  287. package/dist/core/tool-policy.js +165 -380
  288. package/dist/core/tool-registry.d.ts +44 -1
  289. package/dist/core/tool-registry.js +26 -0
  290. package/dist/core/tool-roster.d.ts +19 -1
  291. package/dist/core/tool-roster.js +21 -2
  292. package/dist/core/tool-spec-members.d.ts +45 -0
  293. package/dist/core/tool-spec-members.js +169 -0
  294. package/dist/core/tool-spec.d.ts +46 -8
  295. package/dist/core/tools.d.ts +6 -2
  296. package/dist/core/tools.js +8 -4
  297. package/dist/core/untrusted-egress.js +29 -26
  298. package/dist/core/untrusted-text.d.ts +13 -10
  299. package/dist/core/untrusted-text.js +6 -44
  300. package/dist/core/workflow-journal-store.d.ts +4 -1
  301. package/dist/core/write-protect.d.ts +65 -29
  302. package/dist/core/write-protect.js +235 -177
  303. package/dist/engine/compaction/compaction.d.ts +2 -2
  304. package/dist/engine/execution-env/node-execution-env.d.ts +5 -23
  305. package/dist/engine/execution-env/node-execution-env.js +16 -38
  306. package/dist/engine/execution-env/symlink-chain.d.ts +23 -0
  307. package/dist/engine/execution-env/symlink-chain.js +32 -0
  308. package/dist/engine/harness/types.d.ts +7 -0
  309. package/dist/engine/llm/tool-turns.d.ts +3 -0
  310. package/dist/engine/llm/tool-turns.js +1 -0
  311. package/dist/engine/llm/types.d.ts +59 -23
  312. package/dist/engine/loop/agent-loop.js +16 -2
  313. package/dist/engine/session/memory-repo.js +11 -3
  314. package/dist/engine/session/repo-utils.d.ts +8 -0
  315. package/dist/engine/session/repo-utils.js +13 -0
  316. package/dist/index.d.ts +20 -23
  317. package/dist/index.js +17 -20
  318. package/dist/internal/harness.d.ts +1 -1
  319. package/dist/internal/harness.js +1 -1
  320. package/dist/internal/llm.d.ts +2 -2
  321. package/dist/internal/llm.js +1 -1
  322. package/dist/orchestration/governance-baseline-validity.js +1 -1
  323. package/dist/orchestration/run-spec.js +3 -3
  324. package/dist/orchestration/run-workflow-tool.d.ts +16 -35
  325. package/dist/orchestration/run-workflow-tool.js +38 -78
  326. package/dist/orchestration/workflow-governance.d.ts +21 -25
  327. package/dist/orchestration/workflow-governance.js +38 -78
  328. package/dist/orchestration/workflow-primitives.d.ts +7 -22
  329. package/dist/orchestration/workflow-primitives.js +5 -12
  330. package/dist/orchestration/workflow-types.d.ts +1 -1
  331. package/dist/orchestration/workflow.d.ts +61 -11
  332. package/dist/orchestration/workflow.js +189 -117
  333. package/dist/scenarios/full-body.d.ts +1 -1
  334. package/dist/shell/lex.d.ts +0 -21
  335. package/dist/shell/lex.js +250 -68
  336. package/dist/shell/shell-words.d.ts +35 -0
  337. package/dist/shell/shell-words.js +65 -0
  338. package/dist/stores/file/checkpoint-store.d.ts +5 -5
  339. package/dist/stores/file/checkpoint-store.js +5 -2
  340. package/dist/stores/file/index.d.ts +0 -8
  341. package/dist/stores/file/index.js +0 -12
  342. package/dist/stores/file/session-store.d.ts +3 -0
  343. package/dist/stores/file/session-store.js +44 -19
  344. package/dist/tools/artifact/artifact-tool.js +2 -0
  345. package/dist/tools/fs/bash-program-position.d.ts +12 -4
  346. package/dist/tools/fs/bash-program-position.js +32 -9
  347. package/dist/tools/fs/bash-readonly-classifier.d.ts +1 -1
  348. package/dist/tools/fs/bash-readonly-classifier.js +8 -7
  349. package/dist/tools/fs/containment-face.d.ts +4 -0
  350. package/dist/tools/fs/containment-face.js +3 -0
  351. package/dist/tools/fs/fs-shared.d.ts +10 -0
  352. package/dist/tools/fs/fs-shared.js +18 -0
  353. package/dist/tools/fs/fs-write.js +4 -2
  354. package/dist/tools/fs/index.d.ts +1 -1
  355. package/dist/tools/fs/program-read-model.d.ts +46 -20
  356. package/dist/tools/fs/program-read-model.js +50 -20
  357. package/dist/tools/fs/program-read-model.rows.d.ts +0 -14
  358. package/dist/tools/fs/program-read-model.rows.js +16 -15
  359. package/dist/tools/fs/read-deny-home.d.ts +33 -47
  360. package/dist/tools/fs/read-deny-home.js +35 -49
  361. package/dist/tools/fs/read-deny.d.ts +23 -22
  362. package/dist/tools/fs/read-deny.js +114 -89
  363. package/dist/tools/fs/removal-targets.d.ts +56 -23
  364. package/dist/tools/fs/removal-targets.js +65 -87
  365. package/dist/tools/fs/safety.d.ts +29 -22
  366. package/dist/tools/fs/safety.js +17 -11
  367. package/dist/tools/fs/search.js +10 -8
  368. package/dist/tools/fs/shell-read-argv.js +1 -1
  369. package/dist/tools/fs/shell-read-bindings.d.ts +169 -37
  370. package/dist/tools/fs/shell-read-bindings.js +324 -86
  371. package/dist/tools/fs/shell-read-builtins.d.ts +35 -0
  372. package/dist/tools/fs/shell-read-builtins.js +43 -0
  373. package/dist/tools/fs/shell-read-check.d.ts +15 -1
  374. package/dist/tools/fs/shell-read-check.js +67 -43
  375. package/dist/tools/fs/shell-read-establish.js +6 -6
  376. package/dist/tools/fs/shell-read-functions.d.ts +22 -0
  377. package/dist/tools/fs/shell-read-functions.js +29 -0
  378. package/dist/tools/fs/shell-read-judge.d.ts +51 -18
  379. package/dist/tools/fs/shell-read-judge.js +40 -4
  380. package/dist/tools/fs/shell-read-plan.d.ts +12 -6
  381. package/dist/tools/fs/shell-read-plan.js +118 -113
  382. package/dist/tools/fs/shell-read-start.d.ts +29 -6
  383. package/dist/tools/fs/shell-read-start.js +16 -9
  384. package/dist/tools/fs/shell-read-word.js +4 -0
  385. package/dist/tools/fs/shell-read-workdir.d.ts +156 -0
  386. package/dist/tools/fs/shell-read-workdir.js +281 -0
  387. package/dist/tools/fs/shell-read-write-targets.d.ts +5 -2
  388. package/dist/tools/fs/shell-read-write-targets.js +14 -5
  389. package/dist/tools/fs/shell-reentry-text.d.ts +4 -6
  390. package/dist/tools/fs/shell-reentry-text.js +3 -11
  391. package/dist/tools/task-list.d.ts +1 -2
  392. package/dist/tools/web.js +1 -1
  393. package/package.json +4 -1
  394. package/test/export-surface.snapshot.json +107 -143
  395. package/wire-changes/core@7.49.0.json +4765 -0
  396. package/dist/agents/teacher.d.ts +0 -159
  397. package/dist/agents/teacher.js +0 -577
  398. package/dist/agents/team.d.ts +0 -226
  399. package/dist/agents/team.js +0 -257
  400. package/dist/core/strategy-store.d.ts +0 -238
  401. package/dist/core/strategy-store.js +0 -253
  402. package/dist/orchestration/builtin-workflows.d.ts +0 -133
  403. package/dist/orchestration/builtin-workflows.js +0 -159
  404. package/dist/scenarios/env.d.ts +0 -40
  405. package/dist/scenarios/env.js +0 -39
  406. package/dist/scenarios/scenario-registry.d.ts +0 -110
  407. package/dist/scenarios/scenario-registry.js +0 -140
  408. package/dist/scenarios/teacher-quickstart.d.ts +0 -40
  409. package/dist/scenarios/teacher-quickstart.js +0 -12
  410. package/dist/stores/cc/lockfile.d.ts +0 -10
  411. package/dist/stores/cc/lockfile.js +0 -98
  412. package/dist/stores/cc/mailbox-store.d.ts +0 -20
  413. package/dist/stores/cc/mailbox-store.js +0 -255
  414. package/dist/stores/cc/roster-adapter.d.ts +0 -12
  415. package/dist/stores/cc/roster-adapter.js +0 -117
  416. package/dist/stores/cc/sidecar-transcript.d.ts +0 -97
  417. package/dist/stores/cc/sidecar-transcript.js +0 -264
  418. package/dist/stores/cc/task-list-store.d.ts +0 -2
  419. package/dist/stores/cc/task-list-store.js +0 -125
  420. package/dist/stores/file/strategy-store.d.ts +0 -97
  421. package/dist/stores/file/strategy-store.js +0 -341
@@ -29,6 +29,9 @@ export declare const BUILTIN_COMPLIANCE_DENIES: Record<ComplianceProfile, readon
29
29
  * resolver FAULT (deny every managed capability), never as a partially-applied profile.
30
30
  */
31
31
  export declare function resolveComplianceDenies(posture: CompliancePosture): ReadonlySet<ComplianceCapability>;
32
+ /** One deny list member's refusal under the closed capability set, labelled with the list that carried it, or
33
+ * `undefined` when it is a member. */
34
+ export declare function complianceCapabilityProblem(cap: unknown, owner: string): string | undefined;
32
35
  /** The core web-fetch tool face's canonical mounted name (`createWebFetchTool` in tools/web.ts). */
33
36
  export declare const WEB_FETCH_TOOL_NAME = "WebFetch";
34
37
  /**
@@ -16,14 +16,19 @@ export function resolveComplianceDenies(posture) {
16
16
  }
17
17
  const denies = new Set(BUILTIN_COMPLIANCE_DENIES[posture.profile]);
18
18
  for (const cap of posture.additionalDenies ?? []) {
19
- if (!COMPLIANCE_CAPABILITIES.includes(cap)) {
20
- throw codedError("config.compliance_posture", `compliance posture additionalDenies contains "${String(cap)}", not a member of the closed capability set ` +
21
- `(${COMPLIANCE_CAPABILITIES.join(", ")}) — a misspelled deny must never silently not-enforce.`);
22
- }
19
+ const problem = complianceCapabilityProblem(cap, "compliance posture additionalDenies");
20
+ if (problem !== undefined)
21
+ throw codedError("config.compliance_posture", problem);
23
22
  denies.add(cap);
24
23
  }
25
24
  return denies;
26
25
  }
26
+ export function complianceCapabilityProblem(cap, owner) {
27
+ if (COMPLIANCE_CAPABILITIES.some((member) => member === cap))
28
+ return undefined;
29
+ return (`${owner} contains "${String(cap)}", not a member of the closed capability set ` +
30
+ `(${COMPLIANCE_CAPABILITIES.join(", ")}) — a misspelled deny must never silently not-enforce.`);
31
+ }
27
32
  export const WEB_FETCH_TOOL_NAME = "WebFetch";
28
33
  export function complianceCallDenial(denies, toolName) {
29
34
  if (denies.has("web_fetch") && toolName === WEB_FETCH_TOOL_NAME) {
@@ -0,0 +1,140 @@
1
+ /**
2
+ * Where a text holds a credential — answered by ONE table, {@link CREDENTIAL_VOCABULARY}, and the three views read
3
+ * off it:
4
+ * - refuse-write ({@link refuseWriteView}): the rows that carry a `strict` form, in table order. A hit fail-closed
5
+ * rejects a durable write, so a strict form is narrow (vendor-distinctive prefix, long body, word boundary): a
6
+ * wrongly refused ordinary note is that face's head risk.
7
+ * - egress ({@link egressPassGroups}): every row's wide `match`, in table order, grouped into passes. A hit replaces
8
+ * the value in text that is persisted and forwarded, so a wide form is broad: a missed credential is that face's
9
+ * head risk and over-redaction is cheap.
10
+ * - env names ({@link envNameView}): the exact credential names, the credential words by position, the
11
+ * connection-string name shape and the token-prefix value predicate a spawned child's environment is judged by.
12
+ * - record keys ({@link recordKeyView}): the same credential words, read as the name of a member of a structured record
13
+ * (a header name, a config member) rather than of an environment variable.
14
+ *
15
+ * A family's strict and wide forms live on the SAME row, and every text the strict form matches the wide form matches
16
+ * too (machine-judged over the fixture file by `scripts/verify-credential-vocabulary.mjs`): the two faces may differ in
17
+ * floors, never in vocabulary. Detection is shared; each layer renders its own marker.
18
+ *
19
+ * Zero imports by design: this module is the detection definition and moves into its own package as written.
20
+ */
21
+ /** How sure a detection is. */
22
+ export type RedactionConfidence = "high" | "medium" | "low";
23
+ /** Which rule table a finding names as its minter. A closed set: a report's entries can only have been written by
24
+ * the engine's own tables, so "this finding says X" is an engine statement. */
25
+ export type RedactionSource = "arg-summary" | "untrusted-egress" | "secret-env";
26
+ /** One value family: "this run of characters is itself a credential". */
27
+ export interface ValueFamilyRow {
28
+ /** Stable family name, `^[a-z0-9-]+$`; a finding's `family`. The refuse-write label is this id spelled with `_`. */
29
+ readonly id: string;
30
+ /** The finding `kind` this family reports (the coarse class a consumer groups by). */
31
+ readonly kind: string;
32
+ readonly source: RedactionSource;
33
+ readonly confidence: RedactionConfidence;
34
+ /** The wide form (egress), global. A capture group 1, when the form has one, is a label kept verbatim ahead of the
35
+ * marker (`AccountKey=`, `api_key=`). */
36
+ readonly match: RegExp;
37
+ /** The strict form (refuse-write), never global. Present = this family refuses a durable write; absent = it does
38
+ * not (refusing is the tightening, so it is written, never implied). */
39
+ readonly strict?: RegExp;
40
+ /** The egress pass this wide form runs in. Rows naming the same pass sit next to each other and join as ONE
41
+ * alternation, so a token is taken at its leftmost start whichever of them it is (a nested shape is never cut by
42
+ * an earlier family's pass). Absent = a pass of its own. */
43
+ readonly pass?: string;
44
+ }
45
+ /** Where a credential word counts in a name (env names are upper-cased words joined by `_`):
46
+ * - `leading` — at the start of the name or right after `_`;
47
+ * - `plural` — the word plus `S`, in the leading position;
48
+ * - `counted-plural` — a plural, unless a count word (`MAX_TOKENS`) stands right in front of it;
49
+ * - `separated` — only right after `_` (the shell's own `PWD` is none; a record has no such variable, so the record-key
50
+ * view reads it as `leading`);
51
+ * - `embedded` — anywhere (`AUTHTOKEN`, `MYSECRET`).
52
+ * In every position the word must end the name or be followed by `_` or a digit (`KEYBOARD` is no word). */
53
+ export type CredentialWordPosition = "leading" | "plural" | "counted-plural" | "separated" | "embedded";
54
+ /** One credential word: "a name holding this word names a credential". */
55
+ export interface CredentialWordRow {
56
+ readonly word: string;
57
+ readonly position: CredentialWordPosition;
58
+ /** Further words that name the same credential as a record key only, read in this row's position by the record-key
59
+ * view alone (`AUTH` → the `Authorization` header). The env-name view never reads them: a variable named
60
+ * `AUTHORIZATION` is not withheld by its name. */
61
+ readonly recordKeys?: readonly string[];
62
+ }
63
+ /** The URL userinfo rendering every renderer follows: keep the username (an auditor can tell whose account leaked
64
+ * and revoke it) and replace the password, or replace the whole userinfo. */
65
+ export interface VocabularyPolicy {
66
+ readonly urlUserinfo: "keep-username" | "whole";
67
+ }
68
+ export interface CredentialVocabulary {
69
+ /** Value families, in egress pass order. */
70
+ readonly values: readonly ValueFamilyRow[];
71
+ readonly words: readonly CredentialWordRow[];
72
+ /** The words that turn a following counted plural into a number. */
73
+ readonly countWords: readonly string[];
74
+ /** A connection string named as such (`DB_CONN_STR`, `CONNECTION_STRINGS`), case-insensitive. */
75
+ readonly connectionStringName: RegExp;
76
+ /** Credential env names, each also judged under the `INPUT_` prefix (a GitHub Actions input). */
77
+ readonly exactEnvNames: readonly string[];
78
+ /** Credential-shaped names that hold no credential: exact names, never a shape. */
79
+ readonly nonSecretExactNames: readonly string[];
80
+ /** The one name shape that holds no credential whatever words it carries: git's `GIT_CONFIG_KEY_<n…>` names a
81
+ * configuration key (its value sits in `GIT_CONFIG_VALUE_<n>`). Read by every name view, beside the exact names. */
82
+ readonly nonSecretNameShape: RegExp;
83
+ /** A leading vendor prefix that spells a credential word without being one (`AUTH0_`): dropped from a name before the
84
+ * credential words are looked for, in every name view alike. */
85
+ readonly nonCredentialPrefix: RegExp;
86
+ /** A value (or a password-less URL user) opening with a known token prefix. */
87
+ readonly tokenPrefix: RegExp;
88
+ readonly policy: VocabularyPolicy;
89
+ }
90
+ /**
91
+ * The URI scheme, bounded so it cannot backtrack: RFC 3986's scheme production plus `_`, at most 64 characters. An
92
+ * unbounded `\w+` made every `://` pattern quadratic in the longest unbroken word run (one long base64 paste cost
93
+ * seconds of synchronous CPU); the bound makes it linear and redacts no less on any URL.
94
+ */
95
+ export declare const URI_SCHEME_SOURCE: string;
96
+ export declare const CREDENTIAL_VOCABULARY: CredentialVocabulary;
97
+ /** The refuse-write label of a family: its id spelled with `_` (surfaced in the refusal; never the matched value). */
98
+ export declare const refuseLabel: (id: string) => string;
99
+ /** One refuse-write form: the family's label and its strict form. */
100
+ export interface RefuseWriteForm {
101
+ readonly label: string;
102
+ readonly re: RegExp;
103
+ }
104
+ /** The refuse-write view: every row carrying a strict form, in table order (the first hit names the label). */
105
+ export declare function refuseWriteView(vocabulary: CredentialVocabulary): readonly RefuseWriteForm[];
106
+ /** The egress view: the rows in table order, each run of adjacent rows naming the same `pass` as one group. */
107
+ export declare function egressPassGroups(vocabulary: CredentialVocabulary): ReadonlyArray<readonly ValueFamilyRow[]>;
108
+ /** The env-name view: what {@link CREDENTIAL_VOCABULARY} says about variable names and token-prefixed values. */
109
+ export interface EnvNameView {
110
+ /** Upper-cased, `-` read as `_`; each name also under `INPUT_`. */
111
+ readonly exactNames: ReadonlySet<string>;
112
+ readonly nonSecretExactNames: ReadonlySet<string>;
113
+ readonly nonSecretNameShape: RegExp;
114
+ readonly nonCredentialPrefix: RegExp;
115
+ /** A credential word in its position, case-insensitive. */
116
+ readonly credentialWord: RegExp;
117
+ readonly connectionStringName: RegExp;
118
+ /** The counted plurals as a regex source (a plural no count word touches). */
119
+ readonly countedPlural: string;
120
+ readonly tokenPrefix: RegExp;
121
+ }
122
+ export declare function envNameView(vocabulary: CredentialVocabulary): EnvNameView;
123
+ /** `camelCase` / `PascalCase` read as `_`-separated words, `OAuth` and `NextAuth` kept whole. */
124
+ export declare function splitCamelCase(name: string): string;
125
+ /** The record-key view: what {@link CREDENTIAL_VOCABULARY} says about the names of a structured record's members (an HTTP
126
+ * header, a config or detail member) — the credential words of the env-name view, each row's `recordKeys` spellings
127
+ * besides, and a `separated` word standing alone (`pwd`, `pass`: a record has no shell variable of that name). The names
128
+ * the vocabulary declares non-secret stay non-secret here too: one fact, one reading in every view. */
129
+ export interface RecordKeyView {
130
+ /** A credential word in its position, case-insensitive. Applied to a key with `-` read as `_`, as written and
131
+ * camel-split ({@link isSensitiveRecordKey}). */
132
+ readonly credentialWord: RegExp;
133
+ readonly nonSecretExactNames: ReadonlySet<string>;
134
+ readonly nonSecretNameShape: RegExp;
135
+ readonly nonCredentialPrefix: RegExp;
136
+ }
137
+ export declare function recordKeyView(vocabulary: CredentialVocabulary): RecordKeyView;
138
+ /** Does `key`, the name of a record's member (`Proxy-Authorization`, `pwd`, `X_API_KEY`, `clientSecret`), name a credential?
139
+ * Case does not matter, `-` and `_` are one. `view` is the vocabulary's record-key view unless a caller holds another. */
140
+ export declare function isSensitiveRecordKey(key: string, view?: RecordKeyView): boolean;
@@ -0,0 +1,131 @@
1
+ export const URI_SCHEME_SOURCE = String.raw `[A-Za-z][A-Za-z0-9+.\-_]{0,63}`;
2
+ const VENDOR_BODY = "[A-Za-z0-9_-]{8,}";
3
+ export const CREDENTIAL_VOCABULARY = {
4
+ values: [
5
+ { id: "github-token", kind: "prefixed-token", source: "arg-summary", confidence: "high", pass: "vendor-prefixed", match: new RegExp(`(?<![A-Za-z0-9])gh[opsur][-_]${VENDOR_BODY}`, "g"), strict: /\b(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9]{36,}\b/ },
6
+ { id: "github-fine-grained-pat", kind: "prefixed-token", source: "arg-summary", confidence: "high", pass: "vendor-prefixed", match: new RegExp(`(?<![A-Za-z0-9])github_pat[-_]${VENDOR_BODY}`, "g"), strict: /\bgithub_pat_[A-Za-z0-9_]{60,}\b/ },
7
+ { id: "openai-api-key", kind: "prefixed-token", source: "arg-summary", confidence: "high", pass: "vendor-prefixed", match: new RegExp(`(?<![A-Za-z0-9])sk-${VENDOR_BODY}`, "g"), strict: /\bsk-(?:ant-(?:api03-)?|proj-)?[A-Za-z0-9_]{20,}\b/ },
8
+ { id: "stripe-secret-key", kind: "prefixed-token", source: "arg-summary", confidence: "high", pass: "vendor-prefixed", match: new RegExp(`(?<![A-Za-z0-9])(?:sk_|rk[-_])${VENDOR_BODY}`, "g"), strict: /\b[sr]k_(?:live|test)_[A-Za-z0-9]{24,}\b/ },
9
+ { id: "stripe-publishable-key", kind: "prefixed-token", source: "arg-summary", confidence: "high", pass: "vendor-prefixed", match: new RegExp(`(?<![A-Za-z0-9])pk[-_]${VENDOR_BODY}`, "g") },
10
+ { id: "gitlab-pat", kind: "prefixed-token", source: "arg-summary", confidence: "high", pass: "vendor-prefixed", match: /(?<![A-Za-z0-9])glpat-[A-Za-z0-9_-]{20,}/g },
11
+ { id: "google-api-key", kind: "prefixed-token", source: "arg-summary", confidence: "high", match: /(?<![A-Za-z0-9])AIza[A-Za-z0-9_-]{20,}/g, strict: /\bAIza[0-9A-Za-z_-]{35}\b/ },
12
+ { id: "slack-token", kind: "prefixed-token", source: "arg-summary", confidence: "high", match: /(?<![A-Za-z0-9])xox[baprs]-[A-Za-z0-9-]{10,}/g, strict: /\bxox[baprs]-(?:[A-Za-z0-9]+-){1,3}[A-Za-z0-9]{16,}\b/ },
13
+ { id: "aws-access-key-id", kind: "prefixed-token", source: "arg-summary", confidence: "high", match: /(?<![A-Za-z0-9])(?:AKIA|ASIA)[0-9A-Z]{12,}/g, strict: /\bAKIA[0-9A-Z]{16}\b/ },
14
+ { id: "huggingface-token", kind: "prefixed-token", source: "arg-summary", confidence: "high", match: /(?<![A-Za-z0-9])hf_[A-Za-z0-9]{20,}/g, strict: /\bhf_(?=[A-Za-z0-9]*[0-9])[A-Za-z0-9]{20,}\b/ },
15
+ { id: "jwt", kind: "jwt", source: "arg-summary", confidence: "high", match: /(?<![A-Za-z0-9])eyJ[A-Za-z0-9._-]{20,}/g, strict: /\beyJ[A-Za-z0-9_-]+\.eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]{16,}\b/ },
16
+ { id: "private-key", kind: "private-key-block", source: "arg-summary", confidence: "high", match: /-----BEGIN[ A-Z0-9]*PRIVATE KEY(?: BLOCK)?-----[\s\S]*?(?:-----END[ A-Z0-9]*PRIVATE KEY(?: BLOCK)?-----|$)/g, strict: /-----BEGIN (?:[A-Z0-9]+ )*PRIVATE KEY(?: BLOCK)?-----/ },
17
+ { id: "bearer-token", kind: "bearer-token", source: "arg-summary", confidence: "high", match: /(?<![A-Za-z0-9])Bearer\s+[A-Za-z0-9._~+/-]{8,}=*/gi, strict: /\bAuthorization:\s*Bearer\s+(?=[A-Za-z0-9._~+/-]*[0-9])[A-Za-z0-9._~+/-]{20,}=*/ },
18
+ { id: "azure-storage-account-key", kind: "prefixed-token", source: "arg-summary", confidence: "high", match: /(AccountKey=)[A-Za-z0-9+/]{40,}={0,2}/g, strict: /AccountKey=[A-Za-z0-9+/]{40,}={0,2}/ },
19
+ { id: "keyword-value", kind: "keyword-value", source: "arg-summary", confidence: "medium", match: /(?<![A-Za-z0-9])((?:token|secret|key|password|passwd|credential|authorization)["']?\s*[=:]\s*["']?)[^\s"';|&]{4,}/gi },
20
+ { id: "url-userinfo", kind: "url-credentials", source: "untrusted-egress", confidence: "medium", match: new RegExp(String.raw `(${URI_SCHEME_SOURCE}:\/\/)((?:[^/\s"'@]*@)+)`, "gi") },
21
+ { id: "signed-url-param", kind: "signed-url-param", source: "untrusted-egress", confidence: "high", match: /([?&#](?:sig|signature|sas|code)=)[^&\s"'#]+/gi },
22
+ ],
23
+ words: [
24
+ ...["TOKEN", "SECRET", "PASSWORD", "PASSWD", "PASSPHRASE", "KEY"].map((word) => ({ word, position: "leading" })),
25
+ { word: "AUTH", position: "leading", recordKeys: ["AUTHORIZATION"] },
26
+ ...["COOKIE", "PAT", "DSN", "WEBHOOK", "CREDENTIAL", "CREDENTIALS", "CREDS", "APIKEY", "ACCESSKEY", "SECRETKEY", "ACCOUNTKEY", "PRIVATEKEY", "AUTHKEY", "SSHKEY", "SIGNINGKEY", "MASTERKEY", "DEPLOYKEY", "ENCRYPTIONKEY", "PGPASSWORD", "SSHPASS"].map((word) => ({ word, position: "leading" })),
27
+ ...["KEY", "SECRET", "PASSWORD", "CREDENTIAL"].map((word) => ({ word, position: "plural" })),
28
+ { word: "TOKEN", position: "counted-plural" },
29
+ ...["PWD", "PASS", "JWT"].map((word) => ({ word, position: "separated" })),
30
+ ...["TOKEN", "SECRET", "PASSWORD", "PASSWD", "PASSPHRASE"].map((word) => ({ word, position: "embedded" })),
31
+ ],
32
+ countWords: ["MAX", "OUTPUT", "INPUT", "THINKING", "NUM", "TOTAL"],
33
+ connectionStringName: /CONN(ECT(ION)?)?_?STR(ING)?S?(?=$|[_0-9])/i,
34
+ exactEnvNames: [
35
+ "ANTHROPIC_API_KEY", "CLAUDE_CODE_OAUTH_TOKEN", "CLAUDE_CODE_ARTIFACTS_API_TOKEN", "CLAUDE_CODE_MEMORY_API_TOKEN",
36
+ "CLAUDE_CODE_SLACK_TAG_TOKEN", "ANTHROPIC_AUTH_TOKEN", "ANTHROPIC_FOUNDRY_API_KEY", "ANTHROPIC_FOUNDRY_AUTH_TOKEN",
37
+ "ANTHROPIC_AWS_API_KEY", "ANTHROPIC_CUSTOM_HEADERS", "AWS_SECRET_ACCESS_KEY", "AWS_SESSION_TOKEN",
38
+ "AWS_BEARER_TOKEN_BEDROCK", "GOOGLE_APPLICATION_CREDENTIALS", "GOOGLE_GHA_CREDS_PATH", "AZURE_CLIENT_SECRET",
39
+ "IDENTITY_HEADER", "MSI_SECRET", "AZURE_CLIENT_CERTIFICATE_PATH", "AZURE_CLIENT_CERTIFICATE_PASSWORD",
40
+ "AZURE_PASSWORD", "AZURE_FEDERATED_TOKEN_FILE", "AWS_WEB_IDENTITY_TOKEN_FILE",
41
+ "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI", "AWS_CONTAINER_CREDENTIALS_FULL_URI",
42
+ "AWS_CONTAINER_AUTHORIZATION_TOKEN", "AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE", "CLOUDSDK_AUTH_ACCESS_TOKEN",
43
+ "GOOGLE_OAUTH_ACCESS_TOKEN", "CLAUDE_CODE_OAUTH_REFRESH_TOKEN", "HF_TOKEN", "HUGGING_FACE_HUB_TOKEN",
44
+ "HUGGINGFACEHUB_API_TOKEN", "NODE_AUTH_TOKEN", "NUGET_AUTH_TOKEN", "CARGO_REGISTRY_TOKEN", "TWINE_PASSWORD",
45
+ "TWINE_USERNAME", "PYPI_TOKEN", "PYPI_API_TOKEN", "UV_PUBLISH_TOKEN", "UV_PUBLISH_PASSWORD", "UV_PUBLISH_USERNAME",
46
+ "FLIT_PASSWORD", "FLIT_USERNAME", "HATCH_INDEX_AUTH", "HATCH_INDEX_USER", "GEM_HOST_API_KEY", "MATURIN_PYPI_TOKEN",
47
+ "MATURIN_PASSWORD", "MATURIN_USERNAME", "CONAN_LOGIN_USERNAME", "CONAN_PASSWORD", "ANACONDA_API_TOKEN",
48
+ "BINSTAR_API_TOKEN", "VAULT_TOKEN", "VAULT_AUTH_TOKEN", "VAULT_ROLE_ID", "VAULT_SECRET_ID", "CONSUL_HTTP_TOKEN",
49
+ "CONSUL_HTTP_AUTH", "NOMAD_TOKEN", "NOMAD_HTTP_AUTH", "CI_REGISTRY_USER", "CI_DEPLOY_USER", "JF_USER",
50
+ "FASTLANE_SESSION", "MATCH_GIT_BASIC_AUTHORIZATION", "SONAR_TOKEN", "SONARQUBE_SCANNER_PARAMS",
51
+ "SONAR_SCANNER_JSON_PARAMS", "SLACK_WEBHOOK_URL", "SLACK_WEBHOOK", "DISCORD_WEBHOOK", "DISCORD_WEBHOOK_URL",
52
+ "TEAMS_WEBHOOK_URL", "MS_TEAMS_WEBHOOK_URI", "ANTHROPIC_IDENTITY_TOKEN", "ANTHROPIC_IDENTITY_TOKEN_FILE",
53
+ "CLOUDSDK_AUTH_ACCESS_TOKEN_FILE", "CLOUDSDK_AUTH_AUTHORIZATION_TOKEN_FILE", "AZURE_AUTH_LOCATION",
54
+ "ACTIONS_ID_TOKEN_REQUEST_TOKEN", "ACTIONS_ID_TOKEN_REQUEST_URL", "ACTIONS_RUNTIME_TOKEN", "ACTIONS_RUNTIME_URL",
55
+ "ALL_INPUTS", "VSS_NUGET_EXTERNAL_FEED_ENDPOINTS", "ARTIFACTS_CREDENTIALPROVIDER_EXTERNAL_FEED_ENDPOINTS",
56
+ "VSS_NUGET_ACCESSTOKEN", "ARTIFACTS_CREDENTIALPROVIDER_ACCESSTOKEN", "COMPOSER_AUTH", "OVERRIDE_GITHUB_TOKEN",
57
+ "DEFAULT_WORKFLOW_TOKEN", "SSH_SIGNING_KEY",
58
+ ],
59
+ nonSecretExactNames: [
60
+ "PARTITION_KEY", "SORT_KEY", "RANGE_KEY", "IDEMPOTENCY_KEY", "CACHE_KEY", "ROUTING_KEY",
61
+ "DB_FOREIGN_KEYS", "JSON_SORT_KEYS",
62
+ "MAX_NEW_TOKENS", "MAX_COMPLETION_TOKENS", "AIDER_MAP_TOKENS", "AIDER_MAX_CHAT_HISTORY_TOKENS",
63
+ "MAX_BATCH_PREFILL_TOKENS", "MAX_WAITING_TOKENS", "MAX_TOP_N_TOKENS", "RATE_LIMIT_TOKENS",
64
+ "PROMPT_TOKENS", "CONTEXT_TOKENS",
65
+ ],
66
+ nonSecretNameShape: /^GIT_CONFIG_KEY_[0-9][A-Za-z0-9_]*$/,
67
+ nonCredentialPrefix: /^AUTH0_/i,
68
+ tokenPrefix: /^(?:gh[opusr]_|github_pat_|glpat-|xox[abpr]-|sk-|pk-|AKIA|eyJ|ya29\.|npm_)/,
69
+ policy: { urlUserinfo: "keep-username" },
70
+ };
71
+ export const refuseLabel = (id) => id.replaceAll("-", "_");
72
+ export function refuseWriteView(vocabulary) {
73
+ return vocabulary.values.flatMap((row) => (row.strict === undefined ? [] : [{ label: refuseLabel(row.id), re: row.strict }]));
74
+ }
75
+ export function egressPassGroups(vocabulary) {
76
+ const groups = [];
77
+ for (const row of vocabulary.values) {
78
+ const last = groups[groups.length - 1];
79
+ if (row.pass !== undefined && last !== undefined && last[0].pass === row.pass)
80
+ last.push(row);
81
+ else
82
+ groups.push([row]);
83
+ }
84
+ return groups;
85
+ }
86
+ function credentialWordPattern(countWords, rows) {
87
+ const at = (position) => rows.filter((r) => r.position === position).map((r) => r.word);
88
+ const countedPlural = `(?<!(?:^|_)(?:${countWords.join("|")})_)(?:${at("counted-plural").join("|")})S`;
89
+ const [separated, embedded] = [at("separated"), at("embedded")];
90
+ const positions = [
91
+ `(^|_)(${at("leading").join("|")}|(${at("plural").join("|")})S|${countedPlural})`,
92
+ ...(separated.length > 0 ? [`_(${separated.join("|")})`] : []),
93
+ ...(embedded.length > 0 ? [`(${embedded.join("|")})`] : []),
94
+ ];
95
+ return { credentialWord: new RegExp(`(${positions.join("|")})(?=$|[_0-9])`, "i"), countedPlural };
96
+ }
97
+ export function envNameView(vocabulary) {
98
+ const { credentialWord, countedPlural } = credentialWordPattern(vocabulary.countWords, vocabulary.words);
99
+ return {
100
+ exactNames: new Set(vocabulary.exactEnvNames.flatMap((name) => [name, `INPUT_${name}`])),
101
+ nonSecretExactNames: new Set(vocabulary.nonSecretExactNames),
102
+ nonSecretNameShape: vocabulary.nonSecretNameShape,
103
+ nonCredentialPrefix: vocabulary.nonCredentialPrefix,
104
+ credentialWord,
105
+ connectionStringName: vocabulary.connectionStringName,
106
+ countedPlural,
107
+ tokenPrefix: vocabulary.tokenPrefix,
108
+ };
109
+ }
110
+ export function splitCamelCase(name) {
111
+ return ["OAuth", "NextAuth"]
112
+ .reduce((text, word) => text.replaceAll(word, word[0] + word.slice(1).toLowerCase()), name)
113
+ .replace(/([a-z0-9])([A-Z])/g, "$1_$2")
114
+ .replace(/([A-Z])([A-Z][a-z])/g, "$1_$2");
115
+ }
116
+ export function recordKeyView(vocabulary) {
117
+ const rows = vocabulary.words.flatMap((w) => [w.word, ...(w.recordKeys ?? [])].map((word) => ({ word, position: w.position === "separated" ? "leading" : w.position })));
118
+ return {
119
+ credentialWord: credentialWordPattern(vocabulary.countWords, rows).credentialWord,
120
+ nonSecretExactNames: new Set(vocabulary.nonSecretExactNames),
121
+ nonSecretNameShape: vocabulary.nonSecretNameShape,
122
+ nonCredentialPrefix: vocabulary.nonCredentialPrefix,
123
+ };
124
+ }
125
+ const RECORD_KEYS = recordKeyView(CREDENTIAL_VOCABULARY);
126
+ export function isSensitiveRecordKey(key, view = RECORD_KEYS) {
127
+ if (view.nonSecretExactNames.has(key.toUpperCase()) || view.nonSecretNameShape.test(key))
128
+ return false;
129
+ const words = key.replace(view.nonCredentialPrefix, "").replace(/-/g, "_");
130
+ return view.credentialWord.test(words) || view.credentialWord.test(splitCamelCase(words));
131
+ }
@@ -11,7 +11,7 @@ export const refusedOutOfContract = (message) => {
11
11
  export const isEngineRefusal = (d) => typeof d === "object" && d !== null && ENGINE_REFUSALS.has(d);
12
12
  const DECISION_REASONS = Object.freeze(["rule", "mode", "hook", "safety", "classifier", "persisted_rule", "sandbox", "org_rule", "org_unavailable", "read_only", "skill", "deployment_rule", "request_rule"]);
13
13
  const DECISION_ACTIONS = Object.keys({ allow: 0, deny: 0, ask: 0 });
14
- const GUARDS = Object.keys({ dangerous_delete: 0, unverifiable_delete: 0, transcript_write: 0, artifact_shared_read: 0 });
14
+ const GUARDS = Object.keys({ dangerous_delete: 0, unverifiable_delete: 0, unverifiable_shell_text: 0, transcript_write: 0, artifact_shared_read: 0 });
15
15
  const RULE_UNREADABLE_WORDS = Object.keys({ content_deny: 0, content_ask: 0, persisted_call: 0 });
16
16
  const AUTHORED_BY_WORDS = Object.keys({ deployment: 0 });
17
17
  const memberOf = (words) => {
@@ -26,12 +26,12 @@
26
26
  *
27
27
  * A target is seen three ways: its LEXICAL view (the spelling joined to the selected base, `.` / `..` folded —
28
28
  * zero IO), its CANONICAL view (the same spelling resolved by the execution environment: symlinks, aliases of the
29
- * tree, the disk's own case) and the HOPS of its leaf's symlink chain. {@link readPathViews} is the one producer of
29
+ * tree, the disk's own case) and the HOPS of its leaf's symlink chain. {@link readPath} is the one producer of
30
30
  * those views — the tool's own resolution and its deny judgment read it, and so does {@link readCallTarget}, which
31
31
  * a Runner stamp point calls once per adjudicated call and hands to every rule lane as
32
32
  * `ToolCallRequest.targetReading`. Every rule lane reads a call's target through ONE reader, {@link callTargetViewsOf}:
33
33
  * the reading's views when the call carries one, else the call's own lexical view (a bare request). The judgment over
34
- * those views is the deny tables' (`pathRowsReach`): any view a deny or ask row reaches is reached; an allow row admits a
34
+ * those views is every table's (`judgePathRows`, path-guard-rows.ts): any view a deny or ask row reaches is reached; an allow row admits a
35
35
  * call only when it admits every view of the declared reading.
36
36
  *
37
37
  * ## What it does NOT decide
@@ -46,7 +46,7 @@
46
46
  * declaration to read; the day it declares one, it reads the same selector as everything else.
47
47
  */
48
48
  import { canonicalizeTarget, type PathFamily, type PathIdentity, type Win32NamespaceRefusal } from "../tools/fs/safety.js";
49
- import type { TargetViews } from "../tools/fs/read-deny.js";
49
+ import type { TargetViews } from "./path-guard-rows.js";
50
50
  import type { ExecutionEnv } from "../internal/harness-types.js";
51
51
  import type { ToolCallPathTarget } from "./tool-face.js";
52
52
  import { type ToolCallLike } from "./tool-registry.js";
@@ -75,7 +75,7 @@ export declare function pathTargetBaseOf(pt: Pick<ToolCallPathTarget, "base"> |
75
75
  * Lives HERE rather than beside the search engine because two readers need the identical cut: Glob's own
76
76
  * scope resolution and the path fences that must know which directory an absolute pattern really searches.
77
77
  */
78
- export declare function splitAbsoluteGlobPattern(pattern: string, family: PathFamily | undefined): {
78
+ export declare function splitAbsoluteGlobPattern(pattern: string, tree: PathFamily | undefined): {
79
79
  baseDir: string;
80
80
  relativePattern: string;
81
81
  } | {
@@ -91,6 +91,7 @@ export declare function splitAbsoluteGlobPattern(pattern: string, family: PathFa
91
91
  export type PathTargetReading = {
92
92
  readonly kind: "path";
93
93
  readonly identity: PathIdentity;
94
+ readonly family: PathFamily;
94
95
  } | {
95
96
  readonly kind: "unreadable";
96
97
  readonly reason: string;
@@ -126,17 +127,34 @@ export declare function effectivePathSpellingOf(call: ToolCallLike, pt: ToolCall
126
127
  } | {
127
128
  readonly refused: Win32NamespaceRefusal;
128
129
  } | undefined;
130
+ /**
131
+ * THE path prelude: ONE spelling → the identity of the path the TOOL will open it as. Every reading of a spelling passes
132
+ * through here — the target slot's own value, a `patternParam`'s derived base, an empty slot's base, the views of
133
+ * {@link readPath} — in one order: the family ({@link readingFamilyOf}), the namespace screen, the anchor step
134
+ * ({@link anchorSpelling} against `declaredBase` — a relative spelling with no usable base is `unreadable`), the identity.
135
+ * A win-form spelling on a POSIX tree is therefore an ordinary relative name under the DECLARED base — the same file the fs
136
+ * throat opens — and a `/x` on a win tree lands on the base's drive. Nothing is case-folded and `~` is not expanded here:
137
+ * a fold is a judge's, an expansion a reader's.
138
+ */
139
+ export declare function placeSpelling(spelled: string, declaredBase: string | undefined, bases: ToolPathBases): PathTargetReading;
140
+ /** The family one reading is taken in: the tree's (its root, else its cwd), or — for an address no tree places — the
141
+ * spelling's own ({@link familyFor} `"own"`), so a treeless `C:\x` and a treeless `/x` are each an address in their family. */
142
+ export declare function readingFamilyOf(bases: ToolPathBases, spelled: string): PathFamily;
129
143
  /**
130
144
  * ONE reading of a call's path slot as VIEWS. `path`: the LEXICAL view (the spelling joined to the selected base and
131
145
  * folded — a native spelling of the tree's family), the CANONICAL view when the environment answered (absent ⇒ not asked
132
146
  * or no answer: an absent view takes no part in a judgment and is never a refusal) and the HOPS of the leaf's symlink
133
- * chain when the environment declares one. `unreadable` / `refused` read as in {@link PathTargetReading}.
147
+ * chain when the environment declares one. `unread`: a view the environment was ASKED for did not answer (the canonical
148
+ * one, or the hops of a chain the canonical view says was followed) — the allow direction then admits nothing
149
+ * ({@link callTargetViewsOf}: an allow must see every view where a rule names it). `unreadable` / `refused` read as in
150
+ * {@link PathTargetReading}.
134
151
  */
135
152
  export type CallTargetView = {
136
153
  readonly kind: "path";
137
154
  readonly lexical: string;
138
155
  readonly canonical?: string;
139
156
  readonly hops?: readonly string[];
157
+ readonly unread?: true;
140
158
  } | {
141
159
  readonly kind: "unreadable";
142
160
  readonly reason: string;
@@ -159,23 +177,60 @@ export interface CallTargetReading {
159
177
  }
160
178
  /** The environment's answer the canonical view rests on — the throat's own, so the tool keeps reading the refusal it gave. */
161
179
  export type CanonicalAnswer = Awaited<ReturnType<typeof canonicalizeTarget>>;
162
- /** The three views of one spelling as {@link readPathViews} produces them. */
180
+ /** The three views of one spelling as {@link readPath} produces them. */
163
181
  export interface PathViews {
164
182
  readonly lexical: PathTargetReading;
165
- /** `undefined` ⇒ the environment was not asked (none supplied, or a spelling this reading cannot locate). */
183
+ /** `undefined` ⇒ the environment was not asked (the contract's `lexical` views, no environment, no tree, or a spelling
184
+ * this reading cannot locate). */
166
185
  readonly canonical?: CanonicalAnswer;
167
186
  readonly hops: readonly string[];
187
+ /** The hop chain was asked for (a link was followed) and could not be read. */
188
+ readonly hopsUnread?: true;
168
189
  }
190
+ /**
191
+ * The CONTRACT of one path reading — what the caller asks of a spelling, written at the call rather than implied by which
192
+ * helper it happened to call. Two intents:
193
+ *
194
+ * · `"resolve"` ({@link readPath}): the spelling becomes a target. `views`: `"lexical"` — the placed spelling alone
195
+ * ({@link placeSpelling}, zero I/O); `"canonical"` — and the execution environment's answer for where it lands (the
196
+ * throat's own canonicalizer); `"chain"` — and the hops of the leaf's symlink chain wherever a link may be on the way.
197
+ * The base a relative spelling needs is the reading's `base` argument (the tool's declared selection): absent ⇒ the
198
+ * relative spelling is `unreadable`, never guessed; a namespace spelling the tree refuses is `refused` with its word; a
199
+ * chain the environment cannot read is marked `hopsUnread`, never a refusal.
200
+ * · `"validate-coordinate"` / `"validate-grant"` ({@link validatePath}): the value was HANDED to the engine as an address
201
+ * (a configured home, a configuration root, a checkpoint's coordinates, a probe's grant offer) and is checked, never
202
+ * repaired — no base, no tree, its own spelling its family source. A coordinate must be a string fully qualified in its
203
+ * own family; a grant must also be bounded and free of control characters, already in normal form, not a family root,
204
+ * free of a Win32 alias component and outside every device namespace (a repaired directory is a different directory
205
+ * than the one a card would show).
206
+ */
207
+ export type PathContract = {
208
+ readonly intent: "resolve";
209
+ readonly views: "lexical" | "canonical" | "chain";
210
+ } | {
211
+ readonly intent: "validate-coordinate" | "validate-grant";
212
+ };
213
+ /** The display bound on a validated grant (a probe's read-root offer): generous next to a real `PATH_MAX`, tight enough that
214
+ * the seat cannot become an unbounded prose channel onto an approval card. */
215
+ export declare const READ_ROOT_CANDIDATE_DIR_MAX = 1024;
216
+ /**
217
+ * THE validator of a path value the engine was handed ({@link PathContract} `validate-*`): the value itself when it holds
218
+ * under the contract, else `undefined`. Every seat that accepts a configured or recorded address reads it through here, so
219
+ * "is this an address" is answered once — a UNC with no share (`\\x`) is no address in any family.
220
+ */
221
+ export declare function validatePath(value: unknown, contract: Extract<PathContract, {
222
+ readonly intent: "validate-coordinate" | "validate-grant";
223
+ }>): string | undefined;
169
224
  /**
170
225
  * The ONE producer of a target's views: `spelled` against `base` (the base the tool's declaration selected), under the
171
- * tree `bases` names. Lexical through the same resolution {@link effectivePathTargetOf} reads; canonical through the
172
- * throat's own canonicalizer; the hops (when `opts.hops` and the canonical view answered) through the leaf's chain. The
173
- * tool's resolution and deny judgment read this, and so does {@link readCallTarget}; an environment that THROWS
174
- * propagates here (each caller holds its own posture: the tool refuses, the reading leaves the view absent).
175
- */
176
- export declare function readPathViews(env: ExecutionEnv | undefined, spelled: string, base: string | undefined, bases: ToolPathBases, signal?: AbortSignal, opts?: {
177
- readonly hops?: boolean;
178
- }): Promise<PathViews>;
226
+ * tree `bases` names, as far as `contract` asks. Lexical through the one prelude ({@link placeSpelling}); canonical through
227
+ * the throat's own canonicalizer; the hops (when the contract asks for the chain and the canonical view answered) through
228
+ * the leaf's chain. The tool's resolution and deny judgment read this, and so does {@link readCallTarget}; an environment
229
+ * that THROWS propagates here (each caller holds its own posture: the tool refuses, the reading leaves the view absent).
230
+ */
231
+ export declare function readPath(env: ExecutionEnv | undefined, spelled: string, base: string | undefined, bases: ToolPathBases, contract: Extract<PathContract, {
232
+ readonly intent: "resolve";
233
+ }>, signal?: AbortSignal): Promise<PathViews>;
179
234
  /** The identity of an ABSOLUTE spelling under the tree `bases` names — the target side's one prelude (family, namespace
180
235
  * screen, identity) for a path a judge already holds (a canonical key, a hop, a lexical view). `undefined` when the
181
236
  * spelling is not an absolute path of that tree. */
@@ -213,7 +268,9 @@ export declare function callTargetReadingOf(req: {
213
268
  * canonical, the leaf chain's hops), else the call's own lexical view — resolved against the call's `root` / `cwd` when it
214
269
  * carries either, else against `bare` (a host's direct call of a policy: the bases it declared). `undefined` = the call
215
270
  * names no path in this reading (or a spelling the throat refuses — no rule speaks about it); an `unreadable` answer =
216
- * the call names a path this reading cannot locate.
271
+ * the call names a path this reading cannot locate — or, in the allow reading, the target's resolved location is not in
272
+ * hand (no reading, no canonical view, or a view that was asked for and did not answer: `unread`). An allow by path is
273
+ * judged on where the target resolves; its spelling alone never admits it.
217
274
  */
218
275
  export declare function callTargetViewsOf(req: ToolCallLike & {
219
276
  readonly root?: string | undefined;