@sema-agent/core 7.54.1 → 7.56.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 (621) hide show
  1. package/CHANGELOG.md +950 -0
  2. package/dist/agents/agent-transcript-tool.js +2 -1
  3. package/dist/agents/builtin-agents.d.ts +12 -14
  4. package/dist/agents/cascade.js +1 -1
  5. package/dist/agents/cc-peer-directory.d.ts +36 -0
  6. package/dist/agents/cc-peer-directory.js +139 -0
  7. package/dist/agents/cc-peer-wire.d.ts +105 -0
  8. package/dist/agents/cc-peer-wire.js +98 -0
  9. package/dist/agents/cc-uds-peer-channel.d.ts +40 -0
  10. package/dist/agents/cc-uds-peer-channel.js +457 -0
  11. package/dist/agents/child-model-seat.d.ts +0 -11
  12. package/dist/agents/child-model-seat.js +0 -3
  13. package/dist/agents/cross-session-envelope.d.ts +4 -1
  14. package/dist/agents/cross-session-envelope.js +8 -1
  15. package/dist/agents/cross-session-judge.d.ts +2 -2
  16. package/dist/agents/list-agents-tool.d.ts +3 -1
  17. package/dist/agents/list-agents-tool.js +9 -8
  18. package/dist/agents/observer.d.ts +4 -5
  19. package/dist/agents/observer.js +2 -1
  20. package/dist/agents/peer-admission.d.ts +6 -0
  21. package/dist/agents/peer-admission.js +4 -1
  22. package/dist/agents/peer-directory.d.ts +65 -13
  23. package/dist/agents/peer-directory.js +90 -25
  24. package/dist/agents/peer-notices.d.ts +1 -1
  25. package/dist/agents/peer-session-drain.d.ts +3 -1
  26. package/dist/agents/peer-session-drain.js +3 -2
  27. package/dist/agents/read-inbox-tool.js +2 -1
  28. package/dist/agents/repair-loop.js +2 -2
  29. package/dist/agents/retain-ledger.d.ts +1 -1
  30. package/dist/agents/roster-store.d.ts +1 -1
  31. package/dist/agents/send-message-tool.d.ts +10 -0
  32. package/dist/agents/send-message-tool.js +37 -8
  33. package/dist/agents/subagent.d.ts +39 -82
  34. package/dist/agents/subagent.js +109 -106
  35. package/dist/agents/tool-filter.d.ts +31 -46
  36. package/dist/agents/tool-filter.js +13 -33
  37. package/dist/agents/verify.d.ts +6 -5
  38. package/dist/agents/verify.js +3 -3
  39. package/dist/brain/anthropic.js +43 -81
  40. package/dist/brain/errors.d.ts +15 -0
  41. package/dist/brain/errors.js +10 -0
  42. package/dist/brain/media-degrade.d.ts +18 -7
  43. package/dist/brain/media-degrade.js +13 -2
  44. package/dist/brain/model-capability.d.ts +37 -0
  45. package/dist/brain/model-capability.js +34 -0
  46. package/dist/brain/model-presets.d.ts +6 -12
  47. package/dist/brain/model-presets.js +1 -6
  48. package/dist/brain/open-responses.js +27 -35
  49. package/dist/brain/openai.js +30 -98
  50. package/dist/brain/provider-dialect.d.ts +39 -3
  51. package/dist/brain/provider-dialect.js +28 -0
  52. package/dist/brain/reasoning-request.d.ts +96 -0
  53. package/dist/brain/reasoning-request.js +174 -0
  54. package/dist/brain/reasoning.d.ts +12 -12
  55. package/dist/brain/reasoning.js +4 -3
  56. package/dist/brain/request-params.d.ts +62 -9
  57. package/dist/brain/request-params.js +42 -7
  58. package/dist/brain/retry.d.ts +1 -1
  59. package/dist/brain/route-adjudicator.d.ts +15 -0
  60. package/dist/brain/route-adjudicator.js +15 -0
  61. package/dist/brain/status-sink.d.ts +20 -0
  62. package/dist/brain/status-sink.js +7 -0
  63. package/dist/brain/stream-engine.js +6 -5
  64. package/dist/brain/stream-shared.d.ts +1 -1
  65. package/dist/core/a2a.d.ts +2 -1
  66. package/dist/core/a2a.js +19 -13
  67. package/dist/core/advisor-verdict.d.ts +120 -0
  68. package/dist/core/advisor-verdict.js +92 -0
  69. package/dist/core/agent-definition.d.ts +17 -8
  70. package/dist/core/allow-entry.d.ts +69 -36
  71. package/dist/core/allow-entry.js +81 -52
  72. package/dist/core/allow-rule-shadow.d.ts +10 -3
  73. package/dist/core/approval-object.d.ts +2 -1
  74. package/dist/core/approval-object.js +6 -6
  75. package/dist/core/ask-origin.d.ts +127 -29
  76. package/dist/core/ask-origin.js +87 -25
  77. package/dist/core/ask-question.d.ts +51 -8
  78. package/dist/core/ask-question.js +12 -7
  79. package/dist/core/ask-unresolvable-notice.d.ts +8 -3
  80. package/dist/core/ask-unresolvable-notice.js +16 -2
  81. package/dist/core/auto-compaction.d.ts +11 -8
  82. package/dist/core/auto-compaction.js +4 -2
  83. package/dist/core/auto-mode-arming.d.ts +2 -2
  84. package/dist/core/auto-mode-defaults.d.ts +8 -8
  85. package/dist/core/auto-mode-prompt-assets.d.ts +3 -3
  86. package/dist/core/auto-mode-prompt.d.ts +1 -1
  87. package/dist/core/auto-mode.d.ts +17 -9
  88. package/dist/core/auto-mode.js +9 -6
  89. package/dist/core/background-agent-store.d.ts +3 -3
  90. package/dist/core/canonical-json.d.ts +1 -1
  91. package/dist/core/canonical-json.js +2 -2
  92. package/dist/core/checkpoint-generation.d.ts +53 -0
  93. package/dist/core/checkpoint-generation.js +35 -0
  94. package/dist/core/checkpoint-queries.d.ts +180 -0
  95. package/dist/core/checkpoint-queries.js +272 -0
  96. package/dist/core/checkpoint-requirements.d.ts +19 -4
  97. package/dist/core/checkpoint-requirements.js +8 -14
  98. package/dist/core/checkpoint-store.d.ts +165 -72
  99. package/dist/core/checkpoint-store.js +79 -82
  100. package/dist/core/child-clamp-seats.d.ts +6 -0
  101. package/dist/core/child-clamp-seats.js +3 -16
  102. package/dist/core/compliance.d.ts +2 -2
  103. package/dist/core/context-edit.d.ts +6 -7
  104. package/dist/core/cross-boundary-taint.d.ts +11 -4
  105. package/dist/core/cross-boundary-taint.js +3 -3
  106. package/dist/core/decision-receipt.d.ts +37 -3
  107. package/dist/core/decision-receipt.js +19 -19
  108. package/dist/core/delegation-not-started.d.ts +6 -0
  109. package/dist/core/delegation-not-started.js +17 -0
  110. package/dist/core/effective-path-target.d.ts +1 -1
  111. package/dist/core/engine-attestation.d.ts +93 -0
  112. package/dist/core/engine-attestation.js +70 -0
  113. package/dist/core/engine-capabilities.d.ts +4 -1
  114. package/dist/core/engine-capabilities.js +1 -1
  115. package/dist/core/engine-notice.d.ts +45 -12
  116. package/dist/core/exec-output-tail.d.ts +1 -1
  117. package/dist/core/file-history-retention.d.ts +1 -1
  118. package/dist/core/file-history-store.d.ts +147 -21
  119. package/dist/core/file-history-store.js +58 -32
  120. package/dist/core/gate-fold.d.ts +1 -1
  121. package/dist/core/gate-fold.js +24 -11
  122. package/dist/core/gate-lanes.js +81 -68
  123. package/dist/core/gate-outcome.d.ts +40 -6
  124. package/dist/core/gate-outcome.js +56 -0
  125. package/dist/core/governance-codes.d.ts +17 -3
  126. package/dist/core/governance-codes.js +16 -0
  127. package/dist/core/hands-band.d.ts +1 -1
  128. package/dist/core/hooks.d.ts +21 -20
  129. package/dist/core/hooks.js +3 -1
  130. package/dist/core/host-floor.d.ts +128 -0
  131. package/dist/core/host-floor.js +206 -0
  132. package/dist/core/host-target.d.ts +84 -0
  133. package/dist/core/host-target.js +92 -0
  134. package/dist/core/image-downsample.d.ts +1 -1
  135. package/dist/core/lsp-diagnostics.d.ts +4 -4
  136. package/dist/core/lsp.d.ts +3 -3
  137. package/dist/core/mailbox-store.d.ts +4 -0
  138. package/dist/core/mcp-connection-pool.d.ts +18 -2
  139. package/dist/core/mcp-connection-pool.js +53 -6
  140. package/dist/core/mcp-failure.d.ts +23 -4
  141. package/dist/core/mcp-failure.js +26 -11
  142. package/dist/core/mcp-listing-drift.d.ts +10 -0
  143. package/dist/core/mcp-listing-drift.js +6 -0
  144. package/dist/core/mcp-server-link.d.ts +173 -0
  145. package/dist/core/mcp-server-link.js +127 -0
  146. package/dist/core/mcp-server-spec.d.ts +4 -2
  147. package/dist/core/mcp-session-end.d.ts +26 -0
  148. package/dist/core/mcp-session-end.js +29 -0
  149. package/dist/core/mcp-startup-request.d.ts +17 -0
  150. package/dist/core/mcp-startup-request.js +17 -0
  151. package/dist/core/mcp.d.ts +17 -13
  152. package/dist/core/mcp.js +240 -189
  153. package/dist/core/media-byte-cap.d.ts +1 -1
  154. package/dist/core/memory-engine/delegation-settlement.js +15 -24
  155. package/dist/core/memory-engine/engine.d.ts +9 -9
  156. package/dist/core/memory-engine/engine.js +4 -4
  157. package/dist/core/memory-engine/layout.d.ts +60 -8
  158. package/dist/core/memory-engine/layout.js +65 -6
  159. package/dist/core/memory-engine/provenance-wording.d.ts +1 -1
  160. package/dist/core/memory-engine/tools.js +4 -1
  161. package/dist/core/mode-policy.d.ts +1 -1
  162. package/dist/core/model-seat.d.ts +10 -3
  163. package/dist/core/mods/classic-events.d.ts +67 -0
  164. package/dist/core/mods/classic-events.js +1 -0
  165. package/dist/core/mods/dollar.d.ts +13 -0
  166. package/dist/core/mods/extension-call.d.ts +31 -0
  167. package/dist/core/mods/extension-call.js +43 -0
  168. package/dist/core/mods/kernel/dispatch.d.ts +20 -3
  169. package/dist/core/mods/kernel/dispatch.js +140 -69
  170. package/dist/core/mods/kernel/events.d.ts +47 -11
  171. package/dist/core/mods/kernel/events.js +66 -42
  172. package/dist/core/mods/kernel/index.d.ts +4 -4
  173. package/dist/core/mods/kernel/index.js +2 -2
  174. package/dist/core/mods/kernel/receive.d.ts +39 -5
  175. package/dist/core/mods/kernel/receive.js +290 -17
  176. package/dist/core/mods/kernel/registration.d.ts +33 -2
  177. package/dist/core/mods/kernel/registration.js +6 -7
  178. package/dist/core/mods/kernel/site-rules.d.ts +44 -16
  179. package/dist/core/mods/kernel/site-rules.js +24 -42
  180. package/dist/core/mods/spec-seats.d.ts +69 -0
  181. package/dist/core/mods/spec-seats.js +114 -0
  182. package/dist/core/mods/stations.d.ts +28 -8
  183. package/dist/core/mods/stations.js +29 -13
  184. package/dist/core/mods/tool-call.d.ts +79 -0
  185. package/dist/core/mods/tool-call.js +152 -0
  186. package/dist/core/namespaced-rule-name.d.ts +44 -24
  187. package/dist/core/namespaced-rule-name.js +50 -43
  188. package/dist/core/output-style.d.ts +1 -1
  189. package/dist/core/param-rule-reach.d.ts +15 -0
  190. package/dist/core/param-rule-reach.js +30 -0
  191. package/dist/core/parent-spec-seat.d.ts +13 -1
  192. package/dist/core/parent-spec-seat.js +6 -0
  193. package/dist/core/park-selfcheck.js +1 -0
  194. package/dist/core/pause-registry.d.ts +16 -5
  195. package/dist/core/pause-registry.js +6 -2
  196. package/dist/core/peer-channel.d.ts +70 -0
  197. package/dist/core/peer-channel.js +1 -0
  198. package/dist/core/permission-rule-consent.d.ts +30 -5
  199. package/dist/core/permission-rule-consent.js +147 -50
  200. package/dist/core/permission-rule-model.d.ts +245 -65
  201. package/dist/core/permission-rule-model.js +421 -107
  202. package/dist/core/permission-rule-org.d.ts +6 -2
  203. package/dist/core/permission-rule-org.js +7 -3
  204. package/dist/core/permission-rule-provider.d.ts +6 -2
  205. package/dist/core/permission-rule-provider.js +41 -11
  206. package/dist/core/permission-rule-store.d.ts +22 -26
  207. package/dist/core/permission-rule-store.js +12 -6
  208. package/dist/core/permission-rule-sync.d.ts +11 -2
  209. package/dist/core/permission-rule-sync.js +11 -3
  210. package/dist/core/permission-rule-syntax.d.ts +5 -4
  211. package/dist/core/permission-rule-syntax.js +2 -2
  212. package/dist/core/permission-rules.d.ts +53 -15
  213. package/dist/core/permission-rules.js +125 -100
  214. package/dist/core/persisted-rule-arms.d.ts +6 -4
  215. package/dist/core/persisted-rule-arms.js +10 -12
  216. package/dist/core/present-plan-tool.js +3 -1
  217. package/dist/core/principal-name.d.ts +20 -0
  218. package/dist/core/principal-name.js +22 -0
  219. package/dist/core/prompt-section-seat.js +4 -6
  220. package/dist/core/protocol-http-auth.d.ts +26 -5
  221. package/dist/core/protocol-http-auth.js +137 -4
  222. package/dist/core/protocol-naming.d.ts +2 -2
  223. package/dist/core/read-only-shell-table.d.ts +1 -1
  224. package/dist/core/read-only-shell.d.ts +1 -1
  225. package/dist/core/retired-keys.d.ts +16 -0
  226. package/dist/core/retired-keys.js +16 -4
  227. package/dist/core/rewrite-rejudge.d.ts +60 -0
  228. package/dist/core/rewrite-rejudge.js +36 -0
  229. package/dist/core/roles.d.ts +34 -3
  230. package/dist/core/roles.js +66 -53
  231. package/dist/core/rule-lane-reads.d.ts +20 -15
  232. package/dist/core/rule-lane-reads.js +45 -17
  233. package/dist/core/rule-offer-read.d.ts +53 -0
  234. package/dist/core/rule-offer-read.js +146 -0
  235. package/dist/core/rule-owner.d.ts +46 -0
  236. package/dist/core/rule-owner.js +29 -0
  237. package/dist/core/runner/advisor-instructions.d.ts +70 -0
  238. package/dist/core/runner/advisor-instructions.js +61 -0
  239. package/dist/core/runner/advisor-tool.d.ts +33 -0
  240. package/dist/core/runner/advisor-tool.js +112 -0
  241. package/dist/core/runner/announce-once-ledger.d.ts +18 -26
  242. package/dist/core/runner/announce-once-ledger.js +19 -46
  243. package/dist/core/runner/approval-feedback.js +6 -3
  244. package/dist/core/runner/assemble-result.d.ts +2 -1
  245. package/dist/core/runner/assemble-result.js +1 -1
  246. package/dist/core/runner/call-hook-stations.d.ts +3 -2
  247. package/dist/core/runner/caller-roster.d.ts +21 -2
  248. package/dist/core/runner/caller-roster.js +38 -0
  249. package/dist/core/runner/capability-withheld-seat.d.ts +5 -0
  250. package/dist/core/runner/capability-withheld-seat.js +24 -0
  251. package/dist/core/runner/classifier-ladder.d.ts +33 -13
  252. package/dist/core/runner/classifier-ladder.js +15 -14
  253. package/dist/core/runner/compaction-restate.d.ts +10 -6
  254. package/dist/core/runner/compaction-restate.js +9 -3
  255. package/dist/core/runner/construction-doors.js +3 -0
  256. package/dist/core/runner/contracts.d.ts +40 -33
  257. package/dist/core/runner/conversation-segment.d.ts +28 -0
  258. package/dist/core/runner/conversation-segment.js +42 -0
  259. package/dist/core/runner/cross-boundary-lane.d.ts +21 -16
  260. package/dist/core/runner/cross-boundary-lane.js +58 -34
  261. package/dist/core/runner/decide-continuation.d.ts +7 -4
  262. package/dist/core/runner/decide-continuation.js +2 -2
  263. package/dist/core/runner/denial-limit-arms.d.ts +4 -4
  264. package/dist/core/runner/denial-limit-arms.js +1 -1
  265. package/dist/core/runner/derived-route-fallback.d.ts +24 -24
  266. package/dist/core/runner/derived-route-fallback.js +9 -7
  267. package/dist/core/runner/file-history-request.d.ts +18 -0
  268. package/dist/core/runner/file-history-request.js +21 -13
  269. package/dist/core/runner/file-history-restore.d.ts +45 -0
  270. package/dist/core/runner/file-history-restore.js +46 -0
  271. package/dist/core/runner/gate-exit.d.ts +9 -3
  272. package/dist/core/runner/gate-exit.js +11 -5
  273. package/dist/core/runner/image.d.ts +7 -17
  274. package/dist/core/runner/image.js +9 -60
  275. package/dist/core/runner/initial-run-state.js +1 -1
  276. package/dist/core/runner/permission-rule-lanes.d.ts +6 -6
  277. package/dist/core/runner/permission-rule-lanes.js +38 -15
  278. package/dist/core/runner/person-path-rows.d.ts +12 -9
  279. package/dist/core/runner/person-path-rows.js +19 -8
  280. package/dist/core/runner/prepare-advisor.d.ts +63 -0
  281. package/dist/core/runner/prepare-advisor.js +77 -0
  282. package/dist/core/runner/prepare-ask-lane.d.ts +2 -2
  283. package/dist/core/runner/prepare-ask-lane.js +5 -2
  284. package/dist/core/runner/prepare-caps-and-workflow.d.ts +4 -6
  285. package/dist/core/runner/prepare-caps-and-workflow.js +5 -4
  286. package/dist/core/runner/prepare-config-doors.d.ts +31 -38
  287. package/dist/core/runner/prepare-config-doors.js +57 -34
  288. package/dist/core/runner/prepare-defer-classify.d.ts +4 -3
  289. package/dist/core/runner/prepare-defer-classify.js +7 -8
  290. package/dist/core/runner/prepare-delegation-surface.d.ts +2 -2
  291. package/dist/core/runner/prepare-delegation-surface.js +1 -1
  292. package/dist/core/runner/prepare-file-history.d.ts +48 -8
  293. package/dist/core/runner/prepare-file-history.js +41 -73
  294. package/dist/core/runner/prepare-gate-stations.d.ts +2 -5
  295. package/dist/core/runner/prepare-gate-stations.js +12 -8
  296. package/dist/core/runner/prepare-hands-readface.d.ts +2 -8
  297. package/dist/core/runner/prepare-hands-readface.js +15 -14
  298. package/dist/core/runner/prepare-inherited-gate.d.ts +11 -7
  299. package/dist/core/runner/prepare-inherited-gate.js +8 -6
  300. package/dist/core/runner/prepare-memory-engine-session.js +1 -1
  301. package/dist/core/runner/prepare-park-ask.js +12 -12
  302. package/dist/core/runner/prepare-policy-chain.d.ts +7 -4
  303. package/dist/core/runner/prepare-policy-chain.js +68 -81
  304. package/dist/core/runner/prepare-project-context.d.ts +5 -2
  305. package/dist/core/runner/prepare-project-context.js +6 -3
  306. package/dist/core/runner/prepare-prompt-assembly.d.ts +5 -7
  307. package/dist/core/runner/prepare-prompt-assembly.js +10 -8
  308. package/dist/core/runner/prepare-prompt-inputs.d.ts +11 -9
  309. package/dist/core/runner/prepare-prompt-inputs.js +4 -6
  310. package/dist/core/runner/prepare-protocol-tools.d.ts +4 -2
  311. package/dist/core/runner/prepare-protocol-tools.js +5 -4
  312. package/dist/core/runner/prepare-safety-scan.d.ts +9 -12
  313. package/dist/core/runner/prepare-safety-scan.js +8 -23
  314. package/dist/core/runner/prepare-suspend-saga.d.ts +2 -0
  315. package/dist/core/runner/prepare-suspend-saga.js +5 -6
  316. package/dist/core/runner/prepare-task.d.ts +1 -1
  317. package/dist/core/runner/prepare-task.js +41 -35
  318. package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +7 -4
  319. package/dist/core/runner/prepare-tool-disclosure-mount.js +24 -18
  320. package/dist/core/runner/prepare-turn-wiring.d.ts +0 -4
  321. package/dist/core/runner/prepare-turn-wiring.js +2 -7
  322. package/dist/core/runner/prepare-wiring-manifest.d.ts +11 -4
  323. package/dist/core/runner/prepare-wiring-manifest.js +3 -3
  324. package/dist/core/runner/resume-admission.js +1 -1
  325. package/dist/core/runner/resume-apply.js +11 -12
  326. package/dist/core/runner/resume-checkpoint-screen.js +3 -0
  327. package/dist/core/runner/resume-claim.d.ts +4 -2
  328. package/dist/core/runner/resume-claim.js +15 -8
  329. package/dist/core/runner/resume-policy-outcome.js +1 -1
  330. package/dist/core/runner/retired-runner-deps.js +2 -1
  331. package/dist/core/runner/rewind-files.d.ts +15 -0
  332. package/dist/core/runner/rewind-files.js +132 -0
  333. package/dist/core/runner/run-attachment-seats.js +2 -2
  334. package/dist/core/runner/run-brain-sinks.d.ts +4 -1
  335. package/dist/core/runner/run-brain-sinks.js +4 -2
  336. package/dist/core/runner/run-compaction-machinery.d.ts +1 -1
  337. package/dist/core/runner/run-compaction-machinery.js +2 -12
  338. package/dist/core/runner/run-git-lane.d.ts +1 -0
  339. package/dist/core/runner/run-harness-handlers.js +14 -7
  340. package/dist/core/runner/run-leg.d.ts +1 -1
  341. package/dist/core/runner/run-leg.js +43 -18
  342. package/dist/core/runner/run-settle-and-teardown.js +3 -2
  343. package/dist/core/runner/run-telemetry-and-budget-seats.js +1 -1
  344. package/dist/core/runner/run-turn-boundary.d.ts +1 -0
  345. package/dist/core/runner/run-turn-boundary.js +15 -22
  346. package/dist/core/runner/runtask.d.ts +3 -0
  347. package/dist/core/runner/runtask.js +8 -9
  348. package/dist/core/runner/session-read-file-states.d.ts +15 -0
  349. package/dist/core/runner/session-read-file-states.js +28 -0
  350. package/dist/core/runner/session-rule-policy.d.ts +22 -21
  351. package/dist/core/runner/session-rule-policy.js +17 -31
  352. package/dist/core/runner/shell-env-withheld.d.ts +33 -0
  353. package/dist/core/runner/shell-env-withheld.js +51 -0
  354. package/dist/core/runner/side-call-account.d.ts +32 -8
  355. package/dist/core/runner/side-call-account.js +23 -1
  356. package/dist/core/runner/skills-seat.js +6 -2
  357. package/dist/core/runner/stream-settle-backstop.js +1 -1
  358. package/dist/core/runner/strict-output-schema.d.ts +1 -1
  359. package/dist/core/runner/sub-agent-deny-lists.js +4 -6
  360. package/dist/core/runner/synthetic-tools.d.ts +16 -13
  361. package/dist/core/runner/synthetic-tools.js +8 -3
  362. package/dist/core/runner/tool-disclosure.d.ts +10 -12
  363. package/dist/core/runner/tool-disclosure.js +3 -4
  364. package/dist/core/runner/tool-end-body.d.ts +1 -1
  365. package/dist/core/runner/tool-end-body.js +10 -9
  366. package/dist/core/runner/tool-face-overlay.d.ts +2 -1
  367. package/dist/core/runner/tool-face-overlay.js +17 -1
  368. package/dist/core/runner/tool-not-executed.d.ts +5 -0
  369. package/dist/core/runner/tool-not-executed.js +11 -0
  370. package/dist/core/runner/tool-occurrence.d.ts +8 -0
  371. package/dist/core/runner/tool-occurrence.js +7 -0
  372. package/dist/core/runner/tool-progress-lane.d.ts +2 -2
  373. package/dist/core/runner/tool-turn-repair-seat.d.ts +3 -2
  374. package/dist/core/runner/turn-attachments.d.ts +91 -80
  375. package/dist/core/runner/turn-attachments.js +62 -37
  376. package/dist/core/runner-deps.d.ts +42 -42
  377. package/dist/core/runtime-caps.d.ts +4 -4
  378. package/dist/core/safety-axis-vocab.d.ts +6 -4
  379. package/dist/core/safety-axis-vocab.js +6 -5
  380. package/dist/core/safety-merge-corpus.js +26 -2
  381. package/dist/core/same-plain-value.d.ts +40 -0
  382. package/dist/core/same-plain-value.js +49 -0
  383. package/dist/core/scheduler.d.ts +1 -1
  384. package/dist/core/secret-env.d.ts +26 -3
  385. package/dist/core/secret-env.js +44 -8
  386. package/dist/core/select-model.js +3 -3
  387. package/dist/core/sensitive-path-policy.d.ts +1 -1
  388. package/dist/core/sensitive-path-policy.js +1 -1
  389. package/dist/core/session-policy-store.d.ts +102 -35
  390. package/dist/core/session-policy-store.js +210 -48
  391. package/dist/core/session-reconcile.d.ts +2 -2
  392. package/dist/core/session-store.d.ts +106 -37
  393. package/dist/core/session-store.js +165 -91
  394. package/dist/core/session.d.ts +101 -57
  395. package/dist/core/session.js +53 -0
  396. package/dist/core/shared-memory/tools.js +3 -1
  397. package/dist/core/shared-memory/types.d.ts +1 -1
  398. package/dist/core/shell-read-silence.d.ts +11 -12
  399. package/dist/core/shell-read-silence.js +9 -5
  400. package/dist/core/shell-run-candidates.js +3 -1
  401. package/dist/core/shell-wrapper-projection.js +1 -1
  402. package/dist/core/shell-wrapper-table.d.ts +14 -7
  403. package/dist/core/shell-wrapper-table.js +5 -4
  404. package/dist/core/side-query.d.ts +10 -0
  405. package/dist/core/side-query.js +15 -1
  406. package/dist/core/skill-grant.d.ts +7 -2
  407. package/dist/core/skill-grant.js +5 -0
  408. package/dist/core/skills-directory.js +6 -2
  409. package/dist/core/store-contracts/checkpoint-store-contract.d.ts +11 -1
  410. package/dist/core/store-contracts/checkpoint-store-contract.js +168 -3
  411. package/dist/core/store-contracts/file-history-store-contract.js +74 -4
  412. package/dist/core/store-contracts/peer-directory-contract.d.ts +7 -2
  413. package/dist/core/store-contracts/peer-directory-contract.js +14 -2
  414. package/dist/core/store-contracts/session-policy-store-contract.d.ts +7 -0
  415. package/dist/core/store-contracts/session-policy-store-contract.js +130 -0
  416. package/dist/core/store-contracts/session-repo-contract.js +176 -0
  417. package/dist/core/store-contracts/session-store-contract.d.ts +6 -8
  418. package/dist/core/store-contracts/session-store-contract.js +361 -51
  419. package/dist/core/store-contracts/workflow-journal-store-contract.js +26 -1
  420. package/dist/core/stub-env.d.ts +2 -0
  421. package/dist/core/stub-env.js +1 -0
  422. package/dist/core/surrogate-safe-slice.d.ts +3 -3
  423. package/dist/core/synthetic-read-verdict.js +3 -3
  424. package/dist/core/task-event.d.ts +42 -8
  425. package/dist/core/task-notification.d.ts +19 -15
  426. package/dist/core/task-registry-agent.d.ts +4 -4
  427. package/dist/core/task-registry-shared.d.ts +4 -4
  428. package/dist/core/task-registry-shared.js +1 -0
  429. package/dist/core/task-registry.d.ts +13 -4
  430. package/dist/core/task-registry.js +14 -2
  431. package/dist/core/task-result.d.ts +21 -3
  432. package/dist/core/task-spec.d.ts +69 -64
  433. package/dist/core/task-stream.d.ts +6 -6
  434. package/dist/core/task-tool-shape.d.ts +4 -4
  435. package/dist/core/tighten-task-spec.d.ts +1 -1
  436. package/dist/core/tighten-task-spec.js +2 -1
  437. package/dist/core/tool-catalog-entries.d.ts +36 -2
  438. package/dist/core/tool-catalog-entries.js +69 -43
  439. package/dist/core/tool-check-reading.d.ts +11 -0
  440. package/dist/core/tool-check-reading.js +11 -6
  441. package/dist/core/tool-conformance.js +1 -0
  442. package/dist/core/tool-errors.d.ts +2 -2
  443. package/dist/core/tool-face-reader.js +5 -3
  444. package/dist/core/tool-face.d.ts +21 -2
  445. package/dist/core/tool-face.js +1 -1
  446. package/dist/core/tool-model-gate.d.ts +5 -5
  447. package/dist/core/tool-name-aliases.d.ts +29 -8
  448. package/dist/core/tool-name-aliases.js +22 -4
  449. package/dist/core/tool-name-readings.d.ts +10 -43
  450. package/dist/core/tool-name-readings.js +2 -11
  451. package/dist/core/tool-policy.d.ts +85 -196
  452. package/dist/core/tool-policy.js +150 -175
  453. package/dist/core/tool-registry.d.ts +14 -7
  454. package/dist/core/tool-registry.js +17 -7
  455. package/dist/core/tool-result-store.js +5 -1
  456. package/dist/core/tool-roster.d.ts +57 -33
  457. package/dist/core/tool-roster.js +56 -68
  458. package/dist/core/tool-spec-members.js +8 -3
  459. package/dist/core/tool-spec.d.ts +53 -31
  460. package/dist/core/tools.js +51 -10
  461. package/dist/core/trace.d.ts +6 -2
  462. package/dist/core/types.d.ts +1 -1
  463. package/dist/core/untrusted-egress.d.ts +1 -1
  464. package/dist/core/untrusted-text.d.ts +1 -1
  465. package/dist/core/user-attachment.d.ts +8 -1
  466. package/dist/core/user-attachment.js +64 -4
  467. package/dist/core/warm-resume.d.ts +1 -1
  468. package/dist/core/wiring-manifest.d.ts +58 -0
  469. package/dist/core/wiring-manifest.js +14 -5
  470. package/dist/core/workflow-journal-store.d.ts +62 -0
  471. package/dist/core/workflow-journal-store.js +78 -2
  472. package/dist/core/workflow-run-store.d.ts +6 -0
  473. package/dist/core/workflow-run-store.js +2 -0
  474. package/dist/engine/compaction/compaction.d.ts +9 -9
  475. package/dist/engine/compaction/compaction.js +3 -2
  476. package/dist/engine/execution-env/node-execution-env.d.ts +26 -8
  477. package/dist/engine/execution-env/node-execution-env.js +54 -24
  478. package/dist/engine/harness/agent-harness.d.ts +39 -9
  479. package/dist/engine/harness/agent-harness.js +87 -33
  480. package/dist/engine/harness/types.d.ts +58 -9
  481. package/dist/engine/harness/types.js +12 -1
  482. package/dist/engine/llm/types.d.ts +36 -19
  483. package/dist/engine/llm/validation.d.ts +4 -1
  484. package/dist/engine/llm/validation.js +13 -1
  485. package/dist/engine/loop/agent-loop.d.ts +23 -1
  486. package/dist/engine/loop/agent-loop.js +26 -34
  487. package/dist/engine/loop/types.d.ts +31 -19
  488. package/dist/engine/lsp/node-lsp-manager.d.ts +2 -2
  489. package/dist/engine/session/memory-repo.d.ts +18 -12
  490. package/dist/engine/session/memory-repo.js +24 -9
  491. package/dist/engine/session/parent-chain-guard.d.ts +3 -2
  492. package/dist/engine/session/parent-chain-guard.js +1 -1
  493. package/dist/engine/session/repo-utils.d.ts +32 -3
  494. package/dist/engine/session/repo-utils.js +50 -5
  495. package/dist/index.d.ts +47 -23
  496. package/dist/index.js +35 -17
  497. package/dist/internal/harness-types.d.ts +1 -1
  498. package/dist/internal/harness.d.ts +3 -3
  499. package/dist/internal/harness.js +2 -2
  500. package/dist/internal/llm.d.ts +2 -2
  501. package/dist/internal/llm.js +1 -1
  502. package/dist/orchestration/goal.js +2 -2
  503. package/dist/orchestration/run-workflow-tool.d.ts +8 -6
  504. package/dist/orchestration/run-workflow-tool.js +10 -6
  505. package/dist/orchestration/workflow-size-guideline.d.ts +4 -4
  506. package/dist/orchestration/workflow-types.d.ts +18 -0
  507. package/dist/orchestration/workflow-types.js +6 -0
  508. package/dist/orchestration/workflow.d.ts +5 -13
  509. package/dist/orchestration/workflow.js +57 -49
  510. package/dist/prompt-assembly/artifact.d.ts +2 -2
  511. package/dist/prompt-assembly/artifact.js +5 -3
  512. package/dist/prompt-assembly/assemble.d.ts +3 -2
  513. package/dist/prompt-assembly/assemble.js +1 -1
  514. package/dist/prompt-assembly/catalog/schema.d.ts +43 -12
  515. package/dist/prompt-assembly/catalog/schema.js +34 -2
  516. package/dist/prompt-assembly/catalog/sections.js +0 -1
  517. package/dist/prompt-assembly/composer.d.ts +3 -1
  518. package/dist/prompt-assembly/composer.js +1 -1
  519. package/dist/prompt-assembly/event-registry.js +2 -0
  520. package/dist/prompt-assembly/overlay.js +3 -3
  521. package/dist/prompt-assembly/renderers.d.ts +1 -1
  522. package/dist/prompt-assembly/renderers.js +0 -3
  523. package/dist/prompt-assembly/role-base.d.ts +15 -0
  524. package/dist/prompt-assembly/role-base.js +9 -0
  525. package/dist/prompt-assembly/select.d.ts +39 -14
  526. package/dist/prompt-assembly/select.js +47 -16
  527. package/dist/prompt-assembly/sugar.d.ts +17 -11
  528. package/dist/prompt-assembly/sugar.js +8 -3
  529. package/dist/prompt-assembly/tool-catalog.d.ts +39 -2
  530. package/dist/prompt-assembly/tool-catalog.js +117 -4
  531. package/dist/prompt-assembly/turn-snapshot.d.ts +4 -10
  532. package/dist/prompt-assembly/turn-snapshot.js +0 -3
  533. package/dist/prompt-assembly/types.d.ts +0 -7
  534. package/dist/prompts/default.d.ts +14 -14
  535. package/dist/scenarios/full-body.d.ts +15 -15
  536. package/dist/scenarios/full-body.js +4 -3
  537. package/dist/shell/lex.js +10 -1
  538. package/dist/stores/file/adoption/adopt.d.ts +4 -3
  539. package/dist/stores/file/adoption/adopt.js +27 -33
  540. package/dist/stores/file/adoption/marker.d.ts +6 -13
  541. package/dist/stores/file/adoption/marker.js +9 -17
  542. package/dist/stores/file/checkpoint-store.d.ts +24 -0
  543. package/dist/stores/file/checkpoint-store.js +45 -7
  544. package/dist/stores/file/file-history-store.d.ts +20 -19
  545. package/dist/stores/file/file-history-store.js +157 -141
  546. package/dist/stores/file/fs-atomic.d.ts +15 -0
  547. package/dist/stores/file/fs-atomic.js +89 -14
  548. package/dist/stores/file/index.d.ts +1 -1
  549. package/dist/stores/file/index.js +2 -1
  550. package/dist/stores/file/mailbox-store.d.ts +3 -0
  551. package/dist/stores/file/mailbox-store.js +3 -1
  552. package/dist/stores/file/permission-rule-adopt.d.ts +1 -1
  553. package/dist/stores/file/permission-rule-adopt.js +18 -18
  554. package/dist/stores/file/permission-rule-store.d.ts +18 -2
  555. package/dist/stores/file/permission-rule-store.js +31 -18
  556. package/dist/stores/file/session-policy-store.d.ts +3 -3
  557. package/dist/stores/file/session-store.d.ts +54 -16
  558. package/dist/stores/file/session-store.js +114 -85
  559. package/dist/stores/file/workflow-journal-store.d.ts +10 -4
  560. package/dist/stores/file/workflow-journal-store.js +28 -13
  561. package/dist/tools/artifact/artifact-text.d.ts +1 -1
  562. package/dist/tools/artifact/artifact-tool.js +5 -3
  563. package/dist/tools/fs/bash-program-position.d.ts +19 -2
  564. package/dist/tools/fs/bash-program-position.js +56 -9
  565. package/dist/tools/fs/bash-readonly-classifier.d.ts +3 -3
  566. package/dist/tools/fs/fs-bash.d.ts +2 -2
  567. package/dist/tools/fs/fs-bash.js +8 -6
  568. package/dist/tools/fs/fs-glob.d.ts +86 -0
  569. package/dist/tools/fs/fs-glob.js +226 -0
  570. package/dist/tools/fs/fs-read.js +14 -14
  571. package/dist/tools/fs/fs-search-tools.js +7 -7
  572. package/dist/tools/fs/fs-shared.d.ts +8 -8
  573. package/dist/tools/fs/gh-rate-limit.d.ts +1 -1
  574. package/dist/tools/fs/notebook.d.ts +2 -2
  575. package/dist/tools/fs/pattern-kill-guard.d.ts +22 -0
  576. package/dist/tools/fs/pattern-kill-guard.js +397 -0
  577. package/dist/tools/fs/pdf.d.ts +9 -6
  578. package/dist/tools/fs/pdf.js +3 -3
  579. package/dist/tools/fs/program-read-model.d.ts +57 -7
  580. package/dist/tools/fs/program-read-model.js +11 -1
  581. package/dist/tools/fs/program-read-model.rows.js +78 -21
  582. package/dist/tools/fs/read-deny-home.js +3 -2
  583. package/dist/tools/fs/read-deny.d.ts +29 -7
  584. package/dist/tools/fs/read-deny.js +63 -22
  585. package/dist/tools/fs/removal-targets.d.ts +18 -8
  586. package/dist/tools/fs/removal-targets.js +47 -20
  587. package/dist/tools/fs/safety.d.ts +9 -9
  588. package/dist/tools/fs/search.d.ts +16 -6
  589. package/dist/tools/fs/search.js +20 -26
  590. package/dist/tools/fs/shell-read-argv.js +89 -12
  591. package/dist/tools/fs/shell-read-bindings.d.ts +31 -0
  592. package/dist/tools/fs/shell-read-bindings.js +41 -0
  593. package/dist/tools/fs/shell-read-check.js +12 -20
  594. package/dist/tools/fs/shell-read-environment.d.ts +5 -1
  595. package/dist/tools/fs/shell-read-environment.js +3 -2
  596. package/dist/tools/fs/shell-read-establish.d.ts +15 -0
  597. package/dist/tools/fs/shell-read-establish.js +19 -20
  598. package/dist/tools/fs/shell-read-judge.d.ts +4 -0
  599. package/dist/tools/fs/shell-read-judge.js +5 -2
  600. package/dist/tools/fs/shell-read-plan.js +24 -16
  601. package/dist/tools/fs/shell-read-start.d.ts +6 -1
  602. package/dist/tools/fs/shell-read-write-targets.d.ts +5 -1
  603. package/dist/tools/fs/shell-read-write-targets.js +2 -3
  604. package/dist/tools/fs/shell-reentry-text.d.ts +9 -0
  605. package/dist/tools/fs/shell-reentry-text.js +40 -2
  606. package/dist/tools/loop-tick.d.ts +2 -2
  607. package/dist/tools/scheduler-tools.js +5 -1
  608. package/dist/tools/task-list.d.ts +7 -7
  609. package/dist/tools/task-list.js +5 -1
  610. package/dist/tools/todo.js +65 -64
  611. package/dist/tools/web.d.ts +20 -15
  612. package/dist/tools/web.js +55 -69
  613. package/dist/tools/worktree.d.ts +3 -3
  614. package/dist/tools/worktree.js +3 -1
  615. package/package.json +1 -1
  616. package/test/export-surface.snapshot.json +5894 -5638
  617. package/wire-changes/core@7.55.0.json +3318 -0
  618. package/wire-changes/core@7.56.0.json +3891 -0
  619. package/wire-changes/mods-kernel@7.56.0.json +303 -0
  620. package/dist/core/store-contracts/session-store-incarnation-contract.d.ts +0 -39
  621. package/dist/core/store-contracts/session-store-incarnation-contract.js +0 -95
@@ -59,6 +59,9 @@ export type ArgRole =
59
59
  /** The program expands `{a,b}` sets and `[a-z]` / `[1-9]` ranges in the value itself before it opens anything
60
60
  * (curl's URL glob), unless the invocation carries an option marked {@link OptionSpec.literalValues}. */
61
61
  readonly programGlob?: true;
62
+ /** The program substitutes its own environment into the value (valgrind's `%q{NAME}`): a value carrying such a substitution
63
+ * names a place the text does not settle. */
64
+ readonly programEnv?: true;
62
65
  /** A writing effect: the seats the program writes the path at (absent: where it lands). */
63
66
  readonly seats?: readonly WriteSeat[];
64
67
  /** A writing effect the program does NOT itself perform at every seat: the seats it does write (`[]`: none — a
@@ -177,13 +180,27 @@ export interface OptionSpec {
177
180
  * reads the station cannot establish ({@link deliversOperands}); the list file itself is a read like any other and meets the deny
178
181
  * rows as itself. */
179
182
  readonly delivers?: "operands";
180
- /** The option's value is a PLACE the program's walk works in or compares (`tar -C DIR`, `diff --from-file=DIR`): a root of a
183
+ /** The option's value is a PLACE the program's walk works in or compares (`diff --from-file=DIR`): a root of a
181
184
  * recursive form, whichever way the value is spelled. Absent: a path value is a file the program READS (a config, ignore or
182
185
  * exclusion file, an archive, a pattern file) or an entry it examines — judged as itself, never a root, so it does not count
183
186
  * as the root the walk was given (`rg --ignore-file ig pat` walks `.`). A list the operands come from ({@link delivers}) is a
184
187
  * root of a recursive form too, in either spelling: the program works on what the list names, not on the working directory
185
188
  * (and, the names not being in the text, the segment is not vouched: {@link deliversOperands}). */
186
189
  readonly walks?: true;
190
+ /** The option's value is the directory the program changes into before it opens the OPERANDS written after it (`tar -C DIR`,
191
+ * both GNU tar and bsdtar): an ordered base — each relative operand after it resolves against it, a second one resolves
192
+ * against the first, the operands before it and every option value (the archive, a list, an exclusion file) against the
193
+ * working directory. The value itself is a place the program names, no root of the walk. */
194
+ readonly rebases?: true;
195
+ /** The option's value is a `KEY=VALUE` setting the program keeps, and the value of a key this table names is a command line the
196
+ * program hands to a shell LATER (`git -c core.pager=…`, `git -c 'alias.x=!…'`): a code body of the program ({@link CodeBody}
197
+ * `option-values`). `valueFrom: "environment"`: the setting's VALUE is the content of the environment variable the word names
198
+ * (`git --config-env=core.pager=VAR`) — text the command does not spell. The table is read off the program's own
199
+ * documentation, never off the command. */
200
+ readonly runsLater?: {
201
+ readonly keys: readonly LaterRunKey[];
202
+ readonly valueFrom?: "environment";
203
+ };
187
204
  /** The option's value bounds the program's output, in bytes or in lines (`head -c` / `head -n`). */
188
205
  readonly bounds?: "bytes" | "lines";
189
206
  /** The option's value is what the row's LAST operand would otherwise be (`cp -t <dir>`), so every operand is an
@@ -192,6 +209,10 @@ export interface OptionSpec {
192
209
  /** An enum option: selecting the value (case-folded, any unambiguous prefix of it) makes the operands roots of a
193
210
  * tree walk (`grep -d recurse`). */
194
211
  readonly selectsWhenValue?: string;
212
+ /** Given exactly this value, the option RUNS what the program holds at once, whatever else is selected — as an
213
+ * `effect: "executes"` option does (`fc -e -`: no editor, the stored line runs even beside `-l`); any other value is
214
+ * read by the option's role alone (`fc -e vi -l` only lists). */
215
+ readonly executesWhenValue?: string;
195
216
  /** This option delivers what the row's first positional would otherwise be (grep's `-e`, sed's `-f`, an
196
217
  * interpreter's `-c`), so the first operand is an ordinary operand after it. */
197
218
  readonly fillsSlot?: true;
@@ -217,6 +238,18 @@ export interface OptionSpec {
217
238
  * the names, `declare -p`; names functions, `-f`; or a bash it runs on refuses the switch, bash 3.2's `declare -g`). */
218
239
  readonly assigns?: DeclaredAttribute;
219
240
  }
241
+ /** One key of {@link OptionSpec.runsLater}: `key` the setting's name, case-folded, `*` standing for any run of characters (a
242
+ * subsection, a variable name); `bang` — only a value led by `!` is a command line (the text after the `!`), any other value
243
+ * names something the program resolves itself; `prefixed` — a value led by `!` is a shell snippet (the text after it), one led
244
+ * by `/` the command as written, any other value is run with this text in front of it (git's credential helpers: `git
245
+ * credential-<value>`); `orBoolean` — a boolean value (`true` / `false` / `yes` / `no` / `on` / `off` / `1` / `0`, or empty)
246
+ * switches a behaviour and is no command line. */
247
+ export interface LaterRunKey {
248
+ readonly key: string;
249
+ readonly bang?: true;
250
+ readonly prefixed?: string;
251
+ readonly orBoolean?: true;
252
+ }
220
253
  /** What a declaration builtin does to the names it binds ({@link OptionSpec.assigns}). */
221
254
  export type DeclaredAttribute = "integer" | "reference" | "transformed" | "frozen" | "unsettled";
222
255
  /** One implementation's option grammar. `any` = every implementation the row was measured on reads it this way. */
@@ -338,11 +371,13 @@ export interface DeliverySpec {
338
371
  readonly stdinWhenUnnamed: boolean;
339
372
  }
340
373
  /** The shell text a re-entry program runs: `-c`'s value, its words joined (`eval`), its non-option words (`parallel`),
341
- * or none (`source FILE` reads a file operand). `stdin: "script"`: where its argv names no text and no script file, it
342
- * runs its STANDARD INPUT (`bash <<EOF`, `… | sh`, `parallel < commands`). */
374
+ * none (`source FILE` reads a file operand), or a line of the shell's own HISTORY list (`fc -s`, `fc -e -`, bare `fc`: no word
375
+ * of the command spells it, so it is a text built when the command runs — unless an option the row marks `banner` makes it
376
+ * print instead, `fc -l`). `stdin: "script"`: where its argv names no text and no script file, it runs its STANDARD INPUT
377
+ * (`bash <<EOF`, `… | sh`, `parallel < commands`). */
343
378
  export type ShellReentry = {
344
379
  readonly kind: "shell";
345
- readonly text: "c-option" | "words" | "non-option-words" | "file-operand";
380
+ readonly text: "c-option" | "words" | "non-option-words" | "file-operand" | "history";
346
381
  readonly stdin?: "script";
347
382
  }
348
383
  /** Its operands arrive on a stream and it execs `defaultProgram` when the chain names none (`xargs`). */
@@ -350,8 +385,9 @@ export type ShellReentry = {
350
385
  readonly kind: "argv";
351
386
  readonly defaultProgram: string;
352
387
  };
353
- /** Where a builtin keeps shell text it runs later: its first operand after the options (`trap`), the values of its
354
- * `NAME=VALUE` operands (`alias`), or the values of its shell-text options (`mapfile -C`). */
388
+ /** Where a program keeps shell text it runs later: its first operand after the options (`trap`), the values of its
389
+ * `NAME=VALUE` operands (`alias`), or the values of its shell-text options (`mapfile -C`) — and of a setting option whose key
390
+ * names a command line ({@link OptionSpec.runsLater}: `git -c core.pager=…`). */
355
391
  export type CodeBody = "first-operand" | "assignment-values" | "option-values";
356
392
  /** How a row is checked against the program: the gate runs the binary, or the row says why it cannot. */
357
393
  export type Witness = "binary" | {
@@ -392,6 +428,10 @@ export interface ProgramRow {
392
428
  /** Modules the interpreter runs by name (`python -m <module>`) whose own argv tail is not argv: the role of every word
393
429
  * after the module name (`timeit` compiles and runs it as program text). */
394
430
  readonly modules?: Readonly<Record<string, ArgRole>>;
431
+ /** Each grammar declares EVERY option its implementation takes (measured): a spelling one does not declare is an option
432
+ * that implementation refuses — getopt reports it and the program runs nothing ({@link rowRefusesArgv}). Absent, an
433
+ * undeclared spelling may be one the row does not model, and no reader concludes anything from it. */
434
+ readonly optionsComplete?: true;
395
435
  readonly witness: Witness;
396
436
  }
397
437
  /** The row bash runs for this basename: the exact key, or — for a row that declares versioned spellings — the name
@@ -518,7 +558,8 @@ export declare function programGlobExpansions(value: string): readonly string[]
518
558
  * the no. A plain path offers itself; an `indirect` one itself and what it names past an `@`; a `header` only a
519
559
  * whole-word `@<file>`; a `form` field spec the files after its `@` / `<`; a `url` the local path of a `file:` URL. A
520
560
  * `programGlob` value offers what each of its expansions offers (`globs: "literal"` = the invocation turned the glob
521
- * off); `undefined` = it expands past {@link PROGRAM_GLOB_MAX}: it names files the reader does not list.
561
+ * off); `undefined` = it expands past {@link PROGRAM_GLOB_MAX}, or it carries a substitution of the program's own environment
562
+ * (`programEnv`): it names files the reader does not list.
522
563
  */
523
564
  export declare function slotValueCandidates(value: string, role: ArgRole, globs?: "expanded" | "literal"): string[] | undefined;
524
565
  /** The paths an object name `<rev>:<path>` ({@link ArgRole} `object-path`) may spell: the text after each `:` (a stage
@@ -677,6 +718,10 @@ interface OptionScan {
677
718
  readonly name: string;
678
719
  }[];
679
720
  readonly operands: readonly number[];
721
+ /** ONE implementation's reading met an option word naming a spelling its grammar does not declare, where that
722
+ * implementation certainly reads the word as an option: before the first operand, or anywhere in a grammar that
723
+ * permutes (`afterFirstOperand: "options"`). Past `--` nothing is an option. */
724
+ readonly undeclared: boolean;
680
725
  }
681
726
  /**
682
727
  * Every option spec an argv selects. A short cluster is read as getopt reads it, scanning left to right: a declared
@@ -698,6 +743,11 @@ export declare function selectedSpellings(row: ProgramRow, args: readonly string
698
743
  * declares (another implementation's) that this one does not? getopt calls it an invalid option: the program runs
699
744
  * nothing. */
700
745
  export declare function implementationRejects(row: ProgramRow, view: ProgramRow, words: readonly string[]): boolean;
746
+ /** Does EVERY implementation of a row whose grammars declare all its options ({@link ProgramRow.optionsComplete}) refuse
747
+ * this argv — an option word it certainly reads as an option names a spelling it does not declare
748
+ * ({@link OptionScan.undeclared})? getopt reports the invalid option and the program runs nothing (`rm -m pytest .`,
749
+ * `rm -rfE .`). One implementation that takes the argv is enough for it to run; a row that is not complete refuses nothing. */
750
+ export declare function rowRefusesArgv(row: ProgramRow, args: readonly string[]): boolean;
701
751
  /** A path role whose effect writes. */
702
752
  export type WritingRole = Extract<ArgRole, {
703
753
  kind: "path";
@@ -404,6 +404,8 @@ export function slotValueCandidates(value, role, globs = "expanded") {
404
404
  return [value];
405
405
  if (role.kind !== "path")
406
406
  return [];
407
+ if (role.programEnv === true && value.includes("%q{"))
408
+ return undefined;
407
409
  if (role.kind === "path" && role.programGlob === true && globs === "expanded") {
408
410
  const values = programGlobExpansions(value);
409
411
  if (values === undefined)
@@ -782,13 +784,16 @@ function scanOptions(row, args, one) {
782
784
  const values = [];
783
785
  const operands = [];
784
786
  const select = (spec, name) => { specs.push(spec); names.push(name); };
787
+ const permutes = row.grammars[0]?.afterFirstOperand === "options";
785
788
  let endOfOptions = false;
789
+ let undeclared = false;
786
790
  for (let k = 0; k < args.length; k++) {
787
791
  const t = args[k];
788
792
  if (endOfOptions) {
789
793
  operands.push(k);
790
794
  continue;
791
795
  }
796
+ const certain = one && (operands.length === 0 || permutes);
792
797
  const traditional = k === 0 || !one ? obsolete.filter((o) => o.signs.includes(t[0] ?? "") && /^.\d+[A-Za-z]*$/.test(t)) : [];
793
798
  if (traditional.length > 0) {
794
799
  for (const o of traditional)
@@ -827,6 +832,7 @@ function scanOptions(row, args, one) {
827
832
  const eq = t.indexOf("=");
828
833
  const exact = longs.get(name);
829
834
  const hits = exact !== undefined ? [[name, exact]] : [...longs].filter(([full, m]) => isLongOptionSpellingOf(name, full, m.abbreviable));
835
+ undeclared ||= certain && hits.length === 0;
830
836
  for (const [full, m] of hits)
831
837
  select(m.spec, `--${full}`);
832
838
  const [full, only] = hits[0] ?? [];
@@ -849,6 +855,7 @@ function scanOptions(row, args, one) {
849
855
  for (let i = 1; i < t.length; i++) {
850
856
  const m = shorts.get(t[i]);
851
857
  if (m === undefined) {
858
+ undeclared ||= certain;
852
859
  if (/[A-Za-z0-9]/.test(t[i]))
853
860
  continue;
854
861
  break;
@@ -864,7 +871,10 @@ function scanOptions(row, args, one) {
864
871
  break;
865
872
  }
866
873
  }
867
- return { specs, names, values, operands };
874
+ return { specs, names, values, operands, undeclared };
875
+ }
876
+ export function rowRefusesArgv(row, args) {
877
+ return row.optionsComplete === true && implementationsOf(row).every((view) => scanOptions(view, args, true).undeclared);
868
878
  }
869
879
  export function writesPath(role) {
870
880
  return role?.kind === "path" && WRITING_EFFECTS.has(role.effect);
@@ -33,6 +33,7 @@ const OBJECT_PATH = { kind: "object-path" };
33
33
  const text = (language) => ({ kind: "program-text", language });
34
34
  const file = (language) => ({ kind: "program-file", language });
35
35
  const WALKS = { walks: true };
36
+ const REBASES = { rebases: true };
36
37
  const SWITCH = { arity: 0 };
37
38
  const QUERY = { arity: 0, mode: "queries" };
38
39
  const val = (value, extra = {}) => ({ arity: 1, ...(value !== undefined ? { value } : {}), ...extra });
@@ -164,8 +165,8 @@ const date = {
164
165
  };
165
166
  const tar = {
166
167
  key: "tar",
167
- grammars: [grammar({ b: val(COUNT), C: val(NAMES, WALKS), f: val(READ), T: val(READ, { delivers: "operands" }), X: val(READ), g: val(), ...switches("adhjJkmOpPStvwWxzZ"), ...switches("cru", { selects: "traversal" }) }, {
168
- "blocking-factor": val(COUNT), directory: val(NAMES, WALKS), exclude: val(NAME_PATTERN), "exclude-from": val(READ), file: val(READ), "files-from": val(READ, { delivers: "operands" }), "strip-components": val(COUNT),
168
+ grammars: [grammar({ b: val(COUNT), C: val(NAMES, REBASES), f: val(READ), T: val(READ, { delivers: "operands" }), X: val(READ), g: val(), ...switches("adhjJkmOpPStvwWxzZ"), ...switches("cru", { selects: "traversal" }) }, {
169
+ "blocking-factor": val(COUNT), directory: val(NAMES, REBASES), exclude: val(NAME_PATTERN), "exclude-from": val(READ), file: val(READ), "files-from": val(READ, { delivers: "operands" }), "strip-components": val(COUNT),
169
170
  ...longSwitches(["absolute-names", "dereference", "extract", "get", "interactive", "keep-old-files", "list", "preserve-permissions", "sparse", "to-stdout", "touch", "verbose", "verify"]), ...BANNERS,
170
171
  ...longSwitches(["append", "create", "update"], { selects: "traversal" }),
171
172
  })],
@@ -176,6 +177,7 @@ const find = {
176
177
  key: "find",
177
178
  grammars: implementations(grammar({ D: val(LABEL), O: val(COUNT), f: val(NAMES), ...switches("HLPdsx") }, BANNERS, {
178
179
  afterFirstOperand: "options",
180
+ acceptsAbbreviations: false,
179
181
  dashWords: {
180
182
  amin: val(COUNT), anewer: val(NAMES), atime: val(COUNT), cmin: val(COUNT), cnewer: val(NAMES), context: val(LABEL),
181
183
  ctime: val(COUNT), fstype: val(LABEL), gid: val(COUNT), group: val(LABEL), ilname: val(NAMES), iname: val(NAME_PATTERN),
@@ -306,7 +308,7 @@ function interpreterGrammar(language, g) {
306
308
  put(s, val(file(language), { fillsSlot: true, ...(g.fileEndsOptions === true ? { endsOptions: true } : {}) }));
307
309
  for (const s of g.longText ?? [])
308
310
  put(s, val(text(language), { fillsSlot: true }));
309
- return { dialect: "any", short, long, dashWords, afterFirstOperand: "either" };
311
+ return { dialect: "any", short, long, dashWords, afterFirstOperand: "either", ...(g.exactLongNames === true ? { acceptsAbbreviations: false } : {}) };
310
312
  }
311
313
  const interpreter = (key, language, g, program, stdinWhenUnnamed, extra = {}, departures) => ({
312
314
  key,
@@ -317,9 +319,9 @@ const interpreter = (key, language, g, program, stdinWhenUnnamed, extra = {}, de
317
319
  witness: BINARY,
318
320
  ...extra,
319
321
  });
320
- const PERL = { text: "eEmM", separated: "I", attached: "iCFxDV", plain: "nplawcsStTUWX", banner: "vVh" };
321
- const RUBY = { text: "e", separated: "IrECKT", attached: "F", plain: "nplawcsSU", banner: "vh" };
322
- const PYTHON = { text: "c", module: "m", separated: "WXQ", plain: "uBEIsSqbdvxOtR", banner: "Vh?", interactive: "i", fileEndsOptions: true };
322
+ const PERL = { text: "eEmM", separated: "I", attached: "iCFxDV", plain: "nplawcsStTUWX", banner: "vVh", exactLongNames: true };
323
+ const RUBY = { text: "e", separated: "IrECKT", attached: "F", plain: "nplawcsSU", banner: "vh", exactLongNames: true };
324
+ const PYTHON = { text: "c", module: "m", separated: "WXQ", plain: "uBEIsSqbdvxOtR", banner: "Vh?", interactive: "i", fileEndsOptions: true, exactLongNames: true };
323
325
  const NODE = {
324
326
  longText: ["--eval", "--print"], text: "ep",
325
327
  longModules: ["--import", "--loader", "--experimental-loader", "--require"],
@@ -327,25 +329,25 @@ const NODE = {
327
329
  longAttached: ["--max-old-space-size"],
328
330
  longNamesProgram: ["--test"],
329
331
  longPlain: ["--inspect", "--inspect-brk", "--no-warnings", "--trace-warnings", "--watch", "--enable-source-maps", "--experimental-modules", "--no-deprecation", "--check"],
330
- modules: "r", plain: "c", banner: "vh", interactive: "i",
332
+ modules: "r", plain: "c", banner: "vh", interactive: "i", exactLongNames: true,
331
333
  };
332
- const PHP = { longText: ["--run", "--process-begin", "--process-code", "--process-end"], text: "rRBE", file: "fF", separated: "dcz", plain: "nqswl", banner: "vhi", interactive: "a" };
334
+ const PHP = { longText: ["--run", "--process-begin", "--process-code", "--process-end"], text: "rRBE", file: "fF", separated: "dcz", plain: "nqswl", banner: "vhi", interactive: "a", exactLongNames: true };
333
335
  const LUA = { text: "e", separated: "l", banner: "vh", interactive: "i" };
334
336
  const EXPECT = { text: "c", separated: "Db", plain: "dN", banner: "vh", interactive: "i" };
335
337
  const AWK = { longText: ["--source"], text: "e", longFile: ["--file", "--exec"], file: "fE", separated: "F", assignment: "v", banner: "V" };
336
338
  const POSIX_AWK = { file: "f", separated: "F", assignment: "v" };
337
339
  const AWK_IMPLEMENTATIONS = { gnu: {}, bsd: { lacks: ["-E", "--file", "--exec", "--source"] } };
338
- const JQ = { longFile: ["--from-file"], file: "f", separated: "L", plain: "nrjcsSaCMRe", banner: "h" };
340
+ const JQ = { longFile: ["--from-file"], file: "f", separated: "L", plain: "nrjcsSaCMRe", banner: "h", exactLongNames: true };
339
341
  const BC = { longText: ["--expression"], text: "e", plain: "lqsw", banner: "vh", interactive: "i" };
340
342
  const DC = { longText: ["--expression"], text: "e", longFile: ["--file"], file: "f", banner: "hV" };
341
- const SQLITE = { longText: ["-cmd"], longSupplemental: ["-init"] };
343
+ const SQLITE = { longText: ["-cmd"], longSupplemental: ["-init"], exactLongNames: true };
342
344
  const PSQL = { longText: ["--command"], text: "c", longFile: ["--file"], file: "f", separated: "hpUdoF", plain: "aeEqtxXwW", banner: "lV?" };
343
345
  const OSASCRIPT = { text: "e", separated: "ls", plain: "i", banner: "h" };
344
346
  const RSCRIPT = { text: "e", banner: "h" };
345
347
  const JULIA = { longText: ["--eval", "--print"], text: "eE", separated: "JLp", plain: "q", banner: "vh", interactive: "i" };
346
348
  const GHCI = { text: "e", separated: "io" };
347
349
  const GROOVY = { text: "e", separated: "Dcl", plain: "n", banner: "vh", interactive: "i" };
348
- const BUN = { longText: ["--eval", "--print"], text: "ep", modules: "r", banner: "vh" };
350
+ const BUN = { longText: ["--eval", "--print"], text: "ep", modules: "r", banner: "vh", exactLongNames: true };
349
351
  const launcher = (key, spec = {}, g, extra = {}) => ({
350
352
  key,
351
353
  grammars: g === undefined ? [] : [g],
@@ -396,6 +398,47 @@ const SU_OPTIONS = {
396
398
  programs: ["-m", "-p", "--preserve-environment"],
397
399
  };
398
400
  const SU = launcherGrammar(SU_OPTIONS, { stepsDashDash: true });
401
+ const VALGRIND_FLAGS = [
402
+ "trace-children", "trace-children-skip", "trace-children-skip-by-arg", "child-silent-after-fork", "vgdb", "vgdb-stop-at", "track-fds", "time-stamp",
403
+ "xml", "xml-user-comment", "demangle", "error-limit", "exit-on-first-error", "error-markers", "show-error-list", "keep-debuginfo", "show-below-main",
404
+ "default-suppressions", "gen-suppressions", "dsymutil", "xtree-memory", "fullpath-after", "allow-mismatched-debuginfo", "smc-check", "read-inline-info",
405
+ "read-var-info", "run-libc-freeres", "run-cxx-freeres", "fair-sched", "sigill-diagnostics", "show-emwarns", "vgdb-shadow-registers", "sim-hints",
406
+ "kernel-variant", "soname-synonyms", "resync-filter", "tool",
407
+ "leak-check", "leak-resolution", "show-leak-kinds", "errors-for-leak-kinds", "leak-check-heuristics", "show-reachable", "show-possibly-lost", "xtree-leak",
408
+ "undef-value-errors", "track-origins", "partial-loads-ok", "expensive-definedness-checks", "workaround-gcc296-bugs", "ignore-ranges", "ignore-range-below-sp",
409
+ "malloc-fill", "free-fill", "keep-stacktraces", "show-mismatched-frees",
410
+ ];
411
+ const VALGRIND_COUNTS = [
412
+ "vgdb-error", "log-fd", "xml-fd", "num-callers", "error-exitcode", "input-fd", "max-stackframe", "main-stacksize", "alignment", "redzone-size",
413
+ "max-threads", "merge-recursive-frames", "num-transtab-sectors", "avg-transtab-entry-size", "valgrind-stacksize", "vgdb-poll",
414
+ "unw-stack-scan-thresh", "unw-stack-scan-frames", "freelist-vol", "freelist-big-blocks",
415
+ ];
416
+ const VALGRIND_OUTPUT_FILES = ["log-file", "xml-file", "xtree-memory-file", "xtree-leak-file", "callgrind-out-file", "cachegrind-out-file", "massif-out-file", "dhat-out-file"];
417
+ const VALGRIND_WRITE = { kind: "path", effect: "write", programEnv: true };
418
+ const VALGRIND_READ = { kind: "path", effect: "read", programEnv: true };
419
+ const VALGRIND = launcherGrammar({
420
+ switches: ["-q", "-v", "-s", "--quiet", "--verbose", "-h", "--help", "--help-debug", "--help-dyn-options", "--version"],
421
+ banners: ["-h", "--help", "--help-debug", "--help-dyn-options", "--version"],
422
+ optional: {
423
+ ...Object.fromEntries(VALGRIND_FLAGS.map((n) => [`--${n}`, LABEL])),
424
+ ...Object.fromEntries(VALGRIND_COUNTS.map((n) => [`--${n}`, COUNT])),
425
+ ...Object.fromEntries(VALGRIND_OUTPUT_FILES.map((n) => [`--${n}`, VALGRIND_WRITE])),
426
+ "--suppressions": VALGRIND_READ,
427
+ },
428
+ }, { acceptsAbbreviations: false, stepsDashDash: true });
429
+ const SETPRIV = launcherGrammar({
430
+ switches: ["--nnp", "--no-new-privs", "--clear-groups", "--keep-groups", "--init-groups", "--reset-env", "-d", "--dump", "-h", "--help", "-V", "--version"],
431
+ banners: ["-d", "--dump", "-h", "--help", "-V", "--version"],
432
+ values: Object.fromEntries(["ambient-caps", "inh-caps", "bounding-set", "ruid", "euid", "rgid", "egid", "reuid", "regid", "groups", "securebits", "pdeathsig", "selinux-label", "apparmor-profile"].map((n) => [`--${n}`, LABEL])),
433
+ }, { stepsDashDash: true });
434
+ const CHROOT_GRAMMARS = implementations(launcherGrammar({ switches: ["--skip-chdir", "--help", "--version"], values: { "--userspec": LABEL, "--groups": LABEL, "-u": LABEL, "-g": LABEL, "-G": LABEL } }, { stepsDashDash: true }), { lacks: ["-u", "-g", "-G"] }, { lacks: ["--skip-chdir", "--help", "--version", "--userspec", "--groups"] });
435
+ const PRLIMIT_RESOURCES = { c: "core", d: "data", e: "nice", f: "fsize", i: "sigpending", l: "memlock", m: "rss", n: "nofile", q: "msgqueue", r: "rtprio", s: "stack", t: "cpu", u: "nproc", v: "as", x: "locks", y: "rttime" };
436
+ const PRLIMIT = launcherGrammar({
437
+ switches: ["--noheadings", "--raw", "--verbose", "-h", "--help", "-V", "--version"],
438
+ banners: ["-h", "--help", "-V", "--version"],
439
+ values: { "-p": COUNT, "--pid": COUNT, "-o": LABEL, "--output": LABEL },
440
+ optional: Object.fromEntries(Object.entries(PRLIMIT_RESOURCES).flatMap(([letter, name]) => [[`-${letter}`, LABEL], [`--${name}`, LABEL]])),
441
+ }, { stepsDashDash: true });
399
442
  const SU_LINUX_ONLY = [...SU_OPTIONS.switches, ...Object.keys(SU_OPTIONS.values), ...SU_OPTIONS.shellText, ...SU_OPTIONS.programs].filter((s) => !["-f", "-l", "-m"].includes(s));
400
443
  const launchers = [
401
444
  { key: "env", grammars: implementations(launcherGrammar({
@@ -427,8 +470,8 @@ const launchers = [
427
470
  launcher("pkexec", { whenNoProgram: "shell" }, launcherGrammar({ switches: ["--disable-internal-agent", "--keep-cwd", "--version", "--help"], values: { "--user": LABEL } }), { witness: PRIVILEGED }),
428
471
  { key: "su", grammars: implementations(SU, { afterFirstOperand: "options" }, { lacks: SU_LINUX_ONLY, afterFirstOperand: "operands" }), launcher: { shellText: "user", asUser: { home: "target", loginWith: ["-l", "--login"] } }, witness: PRIVILEGED },
429
472
  { key: "runuser", grammars: [launcherGrammar({ ...SU_OPTIONS, values: { ...SU_OPTIONS.values, "-u": LABEL, "--user": LABEL } }, { afterFirstOperand: "options", stepsDashDash: true })], launcher: { shellText: "user", programWith: ["-u", "--user"], asUser: { home: "target", loginWith: ["-l", "--login"] } }, witness: PRIVILEGED },
430
- launcher("chroot", { requiredOperands: 1, whenNoProgram: "shell" }, undefined, { witness: PRIVILEGED }),
431
- launcher("setpriv", {}, undefined, { witness: PRIVILEGED }),
473
+ { key: "chroot", grammars: CHROOT_GRAMMARS, launcher: { requiredOperands: 1, whenNoProgram: "shell" }, witness: PRIVILEGED },
474
+ launcher("setpriv", {}, SETPRIV, { witness: PRIVILEGED }),
432
475
  launcher("nohup", {}, grammar({}, BANNERS, { stepsDashDash: true })),
433
476
  { key: "nice", grammars: implementations(grammar({ n: val(COUNT) }, { adjustment: val(COUNT), ...BANNERS }, { stepsDashDash: true }), {}, { lacks: ["--adjustment", "--help", "--version"] }), launcher: { negativeIntegerIsOwnArgument: true }, witness: BINARY },
434
477
  launcher("ionice", {}, launcherGrammar({
@@ -470,7 +513,7 @@ const launchers = [
470
513
  }), { witness: LINUX_NAMESPACE }),
471
514
  launcher("script", { shellText: "joined" }, launcherGrammar({ shellText: ["-c", "--command"] }), { witness: SHELL_TEXT_LAUNCHER }),
472
515
  launcher("numactl", {}, undefined, { witness: LINUX_NAMESPACE }),
473
- launcher("prlimit", {}, undefined, { witness: LINUX_NAMESPACE }),
516
+ launcher("prlimit", {}, PRLIMIT, { witness: LINUX_NAMESPACE }),
474
517
  launcher("systemd-run", {}, undefined, { witness: { declared: "hands the program to a service manager" } }),
475
518
  launcher("strace", {}, launcherGrammar({
476
519
  switches: ["-f", "-c", "-C", "-d", "-D", "-h", "-i", "-k", "-q", "-r", "-t", "-T", "-v", "-V", "-w", "-x", "-y", "-z", "-Z", "-F", "--follow-forks", "--summary-only", "--summary", "--debug", "--help", "--version"],
@@ -486,7 +529,7 @@ const launchers = [
486
529
  banners: ["-V"],
487
530
  values: { "-a": COUNT, "-A": COUNT, "-e": LABEL, "-l": NAMES, "-n": COUNT, "-o": WRITE, "-p": COUNT, "-s": COUNT, "-u": LABEL, "-x": LABEL, "-D": LABEL, "-F": READ, "-w": COUNT, "--align": COUNT, "--config": READ, "--debug": LABEL, "--indent": COUNT, "--library": NAMES, "--output": WRITE, "--string-max": COUNT, "--where": COUNT },
488
531
  }), { witness: LINUX_NAMESPACE }),
489
- launcher("valgrind"),
532
+ launcher("valgrind", {}, VALGRIND),
490
533
  launcher("firejail", { whenNoProgram: "shell" }, undefined, { witness: LINUX_NAMESPACE }),
491
534
  launcher("bwrap", {}, undefined, { witness: LINUX_NAMESPACE }),
492
535
  ];
@@ -507,12 +550,25 @@ const GIT_GREP = {
507
550
  traversal: { discloses: "contents", always: true },
508
551
  };
509
552
  const gitObjectSubcommand = (short = {}, long = {}) => ({ grammar: grammar(short, long), operands: { rest: OBJECT_PATH } });
553
+ const GIT_RUNS_LATER = [
554
+ ...["core.pager", "core.editor", "sequence.editor", "core.sshcommand", "core.gitproxy", "core.askpass", "core.alternaterefscommand",
555
+ "diff.external", "diff.*.command", "diff.*.textconv", "merge.*.driver", "filter.*.clean", "filter.*.smudge", "filter.*.process",
556
+ "difftool.*.cmd", "difftool.*.path", "mergetool.*.cmd", "mergetool.*.path", "interactive.difffilter",
557
+ "gpg.program", "gpg.*.program", "gpg.ssh.defaultkeycommand", "browser.*.cmd", "browser.*.path", "man.*.cmd", "man.*.path",
558
+ "guitool.*.cmd", "instaweb.httpd", "trailer.*.cmd", "trailer.*.command", "uploadpack.packobjectshook", "gc.recentobjectshook",
559
+ "remote.*.receivepack", "remote.*.uploadpack",
560
+ "sendemail.*tocmd", "sendemail.*cccmd", "sendemail.*headercmd", "sendemail.*sendmailcmd", "sendemail.*smtpserver"].map((key) => ({ key })),
561
+ { key: "pager.*", orBoolean: true }, { key: "core.fsmonitor", orBoolean: true },
562
+ { key: "alias.*", bang: true }, { key: "credential.helper", prefixed: "git credential-" }, { key: "credential.*.helper", prefixed: "git credential-" },
563
+ ];
510
564
  const git = {
511
565
  key: "git",
512
- grammars: [grammar({ p: SWITCH, P: SWITCH, C: val(WORKDIR), c: val() }, {
566
+ grammars: [grammar({ p: SWITCH, P: SWITCH, C: val(WORKDIR), c: val(undefined, { runsLater: { keys: GIT_RUNS_LATER } }) }, {
513
567
  ...longSwitches(["paginate", "no-pager", "bare", "no-replace-objects", "literal-pathspecs", "glob-pathspecs", "noglob-pathspecs", "icase-pathspecs", "no-optional-locks"]),
514
- "git-dir": val(WORKDIR), "work-tree": val(WORKDIR), namespace: val(), "config-env": val(), "super-prefix": val(),
515
- })],
568
+ "git-dir": val(WORKDIR), "work-tree": val(WORKDIR), namespace: val(), "config-env": val(undefined, { runsLater: { keys: GIT_RUNS_LATER, valueFrom: "environment" } }), "super-prefix": val(),
569
+ version: { arity: 0, mode: "banner" },
570
+ }, { acceptsAbbreviations: false })],
571
+ body: "option-values",
516
572
  subcommands: {
517
573
  commit: gitSubcommand("apsnvqeioz", "Su", "mFCct", ["message", "file", "template", "pathspec-from-file", "author", "date", "cleanup", "fixup", "squash", "trailer", "reuse-message", "reedit-message"]),
518
574
  tag: gitSubcommand("asfdvle", "n", "mFu", ["message", "file", "local-user", "cleanup", "trailer", "sort", "format", "contains", "no-contains", "points-at", "merged", "no-merged"]),
@@ -562,7 +618,7 @@ const CONTAINER_RUN = {
562
618
  };
563
619
  const containerRuntime = (key) => ({
564
620
  key,
565
- grammars: [grammar({ H: val(LABEL), c: val(LABEL), l: val(LABEL), D: SWITCH }, { host: val(LABEL), context: val(LABEL), "log-level": val(LABEL), config: val(READ), tlscacert: val(READ), tlscert: val(READ), tlskey: val(READ), ...longSwitches(["debug", "tls", "tlsverify"]) })],
621
+ grammars: [grammar({ H: val(LABEL), c: val(LABEL), l: val(LABEL), D: SWITCH }, { host: val(LABEL), context: val(LABEL), "log-level": val(LABEL), config: val(READ), tlscacert: val(READ), tlscert: val(READ), tlskey: val(READ), ...longSwitches(["debug", "tls", "tlsverify"]) }, { acceptsAbbreviations: false })],
566
622
  operands: { assignmentArguments: "not-paths" },
567
623
  subcommands: { run: CONTAINER_RUN, create: CONTAINER_RUN },
568
624
  witness: { declared: "a build tool / container client: what a NAME=value argument means is the build's or the container's" },
@@ -595,8 +651,8 @@ const copyGrammars = (bsdSuffixSwitch, destination) => implementations(grammar({
595
651
  const writerRows = [
596
652
  { key: "mkdir", grammars: [], operands: { rest: CREATED, dash: "file" }, witness: BINARY },
597
653
  { key: "touch", grammars: implementations(grammar({ h: { arity: 0, writesAt: ["landing", "entry"] } }, { "no-dereference": { arity: 0, writesAt: ["landing", "entry"] } }), {}, { lacks: ["--no-dereference"] }), operands: { rest: TOUCHED, dash: "file" }, witness: BINARY },
598
- { key: "rm", grammars: implementations(grammar({ ...switches("rR", { selects: "traversal" }), f: { arity: 0, mode: "forced" } }, { ...longSwitches(["recursive"], { selects: "traversal" }), force: { arity: 0, mode: "forced" } }), {}, { lacks: ["--recursive", "--force"] }), operands: { rest: REMOVED, dash: "file" }, witness: BINARY },
599
- { key: "rmdir", grammars: implementations(grammar({ p: { arity: 0, effect: "writes" } }, { parents: { arity: 0, effect: "writes" } }), {}, { lacks: ["--parents"] }), operands: { rest: REMOVED, dash: "file" }, witness: BINARY },
654
+ { key: "rm", grammars: implementations(grammar({ ...switches("rR", { selects: "traversal" }), f: { arity: 0, mode: "forced" }, ...switches("diIvPWx", { effect: "none" }) }, { ...longSwitches(["recursive"], { selects: "traversal" }), force: { arity: 0, mode: "forced" }, ...longSwitches(["dir", "verbose", "one-file-system", "no-preserve-root", "-presume-input-tty"], { effect: "none" }), interactive: { arity: "attached", value: LABEL, effect: "none" }, "preserve-root": { arity: "attached", value: LABEL, effect: "none" }, ...BANNERS }), { lacks: ["-P", "-W", "-x"] }, { lacks: ["--recursive", "--force", "--dir", "--verbose", "--one-file-system", "--no-preserve-root", "---presume-input-tty", "--interactive", "--preserve-root", "--help", "--version"] }), operands: { rest: REMOVED, dash: "file" }, optionsComplete: true, witness: BINARY },
655
+ { key: "rmdir", grammars: implementations(grammar({ p: { arity: 0, effect: "writes" }, v: { arity: 0, effect: "none" } }, { parents: { arity: 0, effect: "writes" }, ...longSwitches(["verbose", "ignore-fail-on-non-empty"], { effect: "none" }), ...BANNERS }), {}, { lacks: ["--parents", "--verbose", "--ignore-fail-on-non-empty", "--help", "--version"] }), operands: { rest: REMOVED, dash: "file" }, optionsComplete: true, witness: BINARY },
600
656
  { key: "tee", grammars: [], operands: { rest: WRITE_THROUGH, dash: "file" }, witness: BINARY },
601
657
  { key: "cp", grammars: copyGrammars(true, COPY_DESTINATION), operands: { rest: COPY_SOURCE, last: COPY_DESTINATION, dash: "file" }, witness: BINARY },
602
658
  { key: "mv", grammars: copyGrammars(false, MOVE_DESTINATION), operands: { rest: MOVE_SOURCE, last: MOVE_DESTINATION, dash: "file" }, witness: BINARY },
@@ -651,6 +707,7 @@ export const PROGRAM_ROWS = [
651
707
  ...[...shellWordsOf("stack_mover")].map((key) => ({ key, grammars: [], movesBase: "stack", witness: BUILTIN_ONLY })),
652
708
  ...SHELLS.map((s) => shellRow(s, "c-option", BINARY, [SHELL_GRAMMARS[s]], "script")),
653
709
  shellRow("eval", "words", BUILTIN_ONLY), shellRow("source", "file-operand", BUILTIN_ONLY), shellRow(".", "file-operand", BUILTIN_ONLY), shellRow("parallel", "non-option-words", BINARY, [], "script"),
710
+ shellRow("fc", "history", BUILTIN_ONLY, [grammar({ ...switches("nr"), s: { arity: 0, effect: "executes" }, ...switches("l", { mode: "banner" }), e: val(COMMAND, { executesWhenValue: "-" }) }, {}, { afterFirstOperand: "operands" })]),
654
711
  ...codeBodyRows,
655
712
  ...[...shellWordsOf("block")].map((k) => block(k, BLOCK_GRAMMARS[k])),
656
713
  ];
@@ -5,6 +5,7 @@ import { thrownText } from "../../core/thrown-value.js";
5
5
  import { agentConfigDirTail } from "../../core/agent-config-dir.js";
6
6
  import { validatePath } from "../../core/effective-path-target.js";
7
7
  import { readDenyPatternRun, readDenyRowAnchor, readDenyRunHead } from "./read-deny.js";
8
+ import { isAbsence } from "./shell-read-environment.js";
8
9
  export const AUXILIARY_HOME_PROBE_MS = 2_000;
9
10
  const said = new Set();
10
11
  function sayOnce(kind, line) {
@@ -75,7 +76,7 @@ async function homeSpellingsOf(env, home, signal) {
75
76
  const canonical = await env.canonicalPath(home, signal);
76
77
  if (canonical.ok)
77
78
  return { spellings: canonical.value !== home ? [home, canonical.value] : [home], canonical: canonical.value, answered: true };
78
- return { spellings: [home], answered: canonical.error.code === "not_found" || canonical.error.code === "not_directory" };
79
+ return { spellings: [home], answered: isAbsence(canonical.error.code) };
79
80
  }
80
81
  catch {
81
82
  return { spellings: [home], answered: false };
@@ -202,7 +203,7 @@ export async function whereItsAnsweredPrefixLeads(env, at, family = pathFamilyOf
202
203
  }
203
204
  const NO_CHAIN = { ancestors: [], whole: false, unread: [] };
204
205
  const unreadChain = (at) => ({ ancestors: [], whole: false, unread: [at] });
205
- const identityUnread = (id) => id === undefined || (!id.ok && id.error.code !== "not_found" && id.error.code !== "not_directory" && id.error.code !== "not_supported");
206
+ const identityUnread = (id) => id === undefined || (!id.ok && !isAbsence(id.error.code) && id.error.code !== "not_supported");
206
207
  async function chainAbove(env, identity, canonical, signal, deadline) {
207
208
  let own;
208
209
  const ancestors = [];
@@ -115,7 +115,7 @@ export declare function ruleHeadParts(rows: readonly Pick<PathRuleDenyRow, "head
115
115
  * below that part. Every part, not the head alone: a link inside the rule's literal prefix that is re-pointed after the
116
116
  * rows were placed still meets the row through the parts above it. One rule for every row form and every judge (the
117
117
  * gate's lanes and the deny tables): the reference compiles the same "physical twin" of every deny / ask rule's literal
118
- * prefix (cli280.js `ei` 9766583, compiled in `mt` 9767083). `leads` is the leg's resolution of each part (absent or
118
+ * prefix. `leads` is the leg's resolution of each part (absent or
119
119
  * `undefined` = no twin there); a part that only extends its parent's resolution adds no row. A twin is the row's own
120
120
  * kind (it keeps every member but the head), so a judgment reports the rule the twin stands for.
121
121
  */
@@ -416,12 +416,32 @@ export declare function activeReadDenyBuiltinTiers(config?: ReadDenyBuiltinConfi
416
416
  * renders "what COULD be switched on".
417
417
  */
418
418
  export declare const READ_FACE_DEFAULT_DENY_ENTRIES: readonly ReadDenyEntry[];
419
+ /**
420
+ * The fold the "unicode" mode applies — the one a RegExp `i` flag without `u` applies, one UTF-16 code unit at a time: the
421
+ * upper-case mapping when it is a single unit and does not step from a non-ASCII unit down into ASCII (`ı` and `ſ` stay
422
+ * themselves, `ß` stays `ß`). Both sides of a comparison go through it.
423
+ */
424
+ export declare function ignoreCaseFold(s: string): string;
425
+ /** How a compiled pattern compares: `none` byte for byte; `ascii` and `unicode` through the fold of that name, both sides —
426
+ * the pattern's side at compile, the segments' side by whoever tests (once per path: {@link segmentReadingsOf}). */
427
+ export type SegmentFold = "none" | "ascii" | "unicode";
428
+ /** The function that folds a string as each fold folds — the one place that says which function that is (the pattern at compile,
429
+ * a path's segments in the readings, an anchor's segments all read it, at the time they fold). */
430
+ export declare const SEGMENT_FOLDS: Record<SegmentFold, (s: string) => string>;
431
+ /** One compiled segment of a pattern: `*` stands for any run of characters but a separator, every other character for itself. */
432
+ export interface SegmentMatcher {
433
+ /** Does the whole of `segment` match? The segment is folded as the pattern's fold folds ({@link CompiledSegmentPattern.fold}) —
434
+ * by the caller; a segment that holds a separator never matches. */
435
+ test(segment: string): boolean;
436
+ /** The pattern is stars only: it matches every one segment. */
437
+ readonly anything: boolean;
438
+ }
419
439
  /** A compiled segment-run pattern (shared engine — the write guard delegates here too). */
420
440
  export interface CompiledSegmentPattern {
421
441
  raw: string;
422
- segments: RegExp[];
423
- /** Fold BOTH sides through {@link asciiLower} before testing (compile lowered the pattern side). */
424
- foldAscii: boolean;
442
+ segments: SegmentMatcher[];
443
+ /** Fold BOTH sides before testing: compile folded the pattern side; the segments tested are folded the same way. */
444
+ fold: SegmentFold;
425
445
  /** The segment lists of the directories the run is ANCHORED at (folded as the pattern folds): the run must start
426
446
  * right after one of them. Absent = the run matches anywhere. */
427
447
  anchors?: readonly (readonly string[])[];
@@ -437,12 +457,14 @@ export interface CompiledSegmentPattern {
437
457
  * Compile one segment-glob pattern (shared engine). `fold`:
438
458
  * · "none" — byte-exact segments;
439
459
  * · "ascii" — ASCII-case-insensitive (deny-set contract);
440
- * · "unicode" — RegExp `i` flag (the write guard's historical host-keyed behavior — kept for it
441
- * byte-identically; NOT used by the deny set).
460
+ * · "unicode" — the fold a RegExp `i` flag applies, {@link ignoreCaseFold} (the write guard's historical host-keyed
461
+ * behavior — kept for it answer for answer; NOT used by the deny set).
462
+ * The pattern is folded here, once; the segments a row is tested on are folded by whoever tests, once per path
463
+ * ({@link segmentReadingsOf}) — never once per row per test.
442
464
  * Returns null when the pattern reduces to zero segments — the CALLER owns its loud path (the two
443
465
  * consumers refuse with their own surface-specific texts).
444
466
  */
445
- export declare function compileSegmentPattern(raw: string, fold: "none" | "ascii" | "unicode"): CompiledSegmentPattern | null;
467
+ export declare function compileSegmentPattern(raw: string, fold: SegmentFold): CompiledSegmentPattern | null;
446
468
  /**
447
469
  * Does the path contain a compiled pattern as a CONTIGUOUS run of full path segments? (Shared engine:
448
470
  * `.git/hooks` matches `/repo/.git/hooks/pre-commit`; `.ssh` matches any `.ssh` segment.) An ANCHORED pattern