@sema-agent/core 7.33.8 → 7.35.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 (228) hide show
  1. package/CHANGELOG.md +462 -3
  2. package/dist/agents/cross-session-judge.d.ts +16 -7
  3. package/dist/agents/cross-session-judge.js +18 -15
  4. package/dist/agents/peer-session-drain.d.ts +4 -0
  5. package/dist/agents/peer-session-drain.js +5 -2
  6. package/dist/agents/repair-loop.d.ts +1 -1
  7. package/dist/agents/subagent.d.ts +3 -0
  8. package/dist/agents/subagent.js +12 -3
  9. package/dist/brain/anthropic.js +1 -0
  10. package/dist/brain/errors.d.ts +23 -1
  11. package/dist/brain/errors.js +19 -2
  12. package/dist/brain/open-responses.js +1 -0
  13. package/dist/brain/openai.js +1 -0
  14. package/dist/brain/status-sink.d.ts +7 -1
  15. package/dist/brain/stream-engine.d.ts +3 -0
  16. package/dist/brain/stream-engine.js +2 -1
  17. package/dist/brain/stream-shared.d.ts +3 -1
  18. package/dist/brain/stream-shared.js +16 -4
  19. package/dist/core/a2a.d.ts +3 -1
  20. package/dist/core/a2a.js +1 -1
  21. package/dist/core/ask-origin.d.ts +379 -154
  22. package/dist/core/ask-origin.js +224 -45
  23. package/dist/core/ask-question.js +2 -1
  24. package/dist/core/ask-unresolvable-notice.d.ts +5 -2
  25. package/dist/core/ask-unresolvable-notice.js +4 -3
  26. package/dist/core/auto-mode-arming.d.ts +17 -4
  27. package/dist/core/auto-mode-arming.js +31 -6
  28. package/dist/core/auto-mode-defaults.d.ts +16 -7
  29. package/dist/core/auto-mode-defaults.js +2 -1
  30. package/dist/core/auto-mode-directive.d.ts +18 -30
  31. package/dist/core/auto-mode-directive.js +9 -18
  32. package/dist/core/auto-mode-prompt.d.ts +62 -1
  33. package/dist/core/auto-mode-prompt.js +42 -4
  34. package/dist/core/auto-mode-rebuild.d.ts +2 -1
  35. package/dist/core/auto-mode-rebuild.js +1 -0
  36. package/dist/core/auto-mode.d.ts +32 -3
  37. package/dist/core/auto-mode.js +80 -41
  38. package/dist/core/checkpoint-store.d.ts +54 -35
  39. package/dist/core/checkpoint-store.js +58 -3
  40. package/dist/core/child-clamp-seats.js +1 -0
  41. package/dist/core/classifier-unavailable-arm.d.ts +57 -0
  42. package/dist/core/classifier-unavailable-arm.js +17 -0
  43. package/dist/core/effective-path-target.d.ts +12 -0
  44. package/dist/core/effective-path-target.js +18 -7
  45. package/dist/core/engine-notice.d.ts +53 -2
  46. package/dist/core/fs-write-gate-policy.d.ts +5 -1
  47. package/dist/core/fs-write-gate-policy.js +4 -1
  48. package/dist/core/gate-fold.js +19 -3
  49. package/dist/core/gate-lanes.js +116 -50
  50. package/dist/core/gate-outcome.d.ts +40 -7
  51. package/dist/core/gate-outcome.js +26 -4
  52. package/dist/core/governance-codes.d.ts +18 -2
  53. package/dist/core/governance-codes.js +23 -1
  54. package/dist/core/hooks.d.ts +53 -29
  55. package/dist/core/hooks.js +1 -3
  56. package/dist/core/mcp.js +1 -1
  57. package/dist/core/message-utils.d.ts +2 -1
  58. package/dist/core/message-utils.js +2 -1
  59. package/dist/core/mode-policy.d.ts +185 -0
  60. package/dist/core/mode-policy.js +184 -0
  61. package/dist/core/oracle-isolation.d.ts +3 -3
  62. package/dist/core/permission-rule-model.d.ts +20 -3
  63. package/dist/core/permission-rule-model.js +40 -3
  64. package/dist/core/permission-rule-provider.d.ts +22 -11
  65. package/dist/core/permission-rule-provider.js +17 -7
  66. package/dist/core/permission-rules.d.ts +23 -1
  67. package/dist/core/permission-rules.js +56 -9
  68. package/dist/core/persisted-rule-arms.d.ts +14 -10
  69. package/dist/core/persisted-rule-arms.js +13 -6
  70. package/dist/core/present-plan-tool.d.ts +1 -1
  71. package/dist/core/present-plan-tool.js +3 -3
  72. package/dist/core/read-only-shell.d.ts +19 -19
  73. package/dist/core/read-only-shell.js +38 -12
  74. package/dist/core/retired-keys.d.ts +9 -3
  75. package/dist/core/retired-keys.js +5 -1
  76. package/dist/core/runner/active-skill-scope.js +5 -4
  77. package/dist/core/runner/assemble-result.js +2 -2
  78. package/dist/core/runner/classifier-ladder.d.ts +43 -1
  79. package/dist/core/runner/classifier-ladder.js +29 -0
  80. package/dist/core/runner/contracts.d.ts +62 -38
  81. package/dist/core/runner/denial-limit-arms.d.ts +35 -7
  82. package/dist/core/runner/denial-limit-arms.js +15 -9
  83. package/dist/core/runner/env-capability-census.js +1 -1
  84. package/dist/core/runner/file-history-request.d.ts +26 -0
  85. package/dist/core/runner/file-history-request.js +90 -0
  86. package/dist/core/runner/gate-exit.d.ts +30 -4
  87. package/dist/core/runner/gate-exit.js +28 -7
  88. package/dist/core/runner/permission-rule-lanes.d.ts +11 -6
  89. package/dist/core/runner/permission-rule-lanes.js +55 -48
  90. package/dist/core/runner/persisted-path-rows.d.ts +64 -0
  91. package/dist/core/runner/persisted-path-rows.js +89 -0
  92. package/dist/core/runner/prepare-artifact.d.ts +5 -1
  93. package/dist/core/runner/prepare-artifact.js +9 -3
  94. package/dist/core/runner/prepare-ask-lane.d.ts +6 -4
  95. package/dist/core/runner/prepare-ask-lane.js +3 -3
  96. package/dist/core/runner/prepare-caps-and-workflow.d.ts +39 -13
  97. package/dist/core/runner/prepare-caps-and-workflow.js +58 -29
  98. package/dist/core/runner/prepare-file-history.d.ts +9 -3
  99. package/dist/core/runner/prepare-file-history.js +4 -90
  100. package/dist/core/runner/prepare-gate-stations.d.ts +37 -9
  101. package/dist/core/runner/prepare-gate-stations.js +46 -29
  102. package/dist/core/runner/prepare-hands-readface.d.ts +40 -17
  103. package/dist/core/runner/prepare-hands-readface.js +64 -53
  104. package/dist/core/runner/prepare-inherited-gate.d.ts +30 -23
  105. package/dist/core/runner/prepare-inherited-gate.js +45 -25
  106. package/dist/core/runner/prepare-park-ask.d.ts +6 -4
  107. package/dist/core/runner/prepare-park-ask.js +7 -5
  108. package/dist/core/runner/prepare-policy-chain.d.ts +25 -4
  109. package/dist/core/runner/prepare-policy-chain.js +203 -180
  110. package/dist/core/runner/prepare-protocol-tools.d.ts +28 -0
  111. package/dist/core/runner/prepare-protocol-tools.js +13 -3
  112. package/dist/core/runner/prepare-run-refs.d.ts +6 -6
  113. package/dist/core/runner/prepare-run-refs.js +9 -4
  114. package/dist/core/runner/prepare-safety-scan.d.ts +5 -0
  115. package/dist/core/runner/prepare-safety-scan.js +19 -3
  116. package/dist/core/runner/prepare-suspend-saga.d.ts +5 -5
  117. package/dist/core/runner/prepare-suspend-saga.js +6 -6
  118. package/dist/core/runner/prepare-task.js +56 -24
  119. package/dist/core/runner/prepare-wiring-manifest.d.ts +10 -6
  120. package/dist/core/runner/prepare-wiring-manifest.js +5 -3
  121. package/dist/core/runner/read-root-grant.d.ts +9 -0
  122. package/dist/core/runner/read-root-grant.js +12 -0
  123. package/dist/core/runner/retired-runner-deps.js +1 -0
  124. package/dist/core/runner/run-brain-sinks.js +3 -1
  125. package/dist/core/runner/run-identity-wiring.js +1 -1
  126. package/dist/core/runner/run-leg.js +29 -18
  127. package/dist/core/runner/run-notification-lane.d.ts +3 -0
  128. package/dist/core/runner/run-notification-lane.js +3 -1
  129. package/dist/core/runner/run-telemetry-and-budget-seats.d.ts +2 -2
  130. package/dist/core/runner/run-telemetry-and-budget-seats.js +1 -1
  131. package/dist/core/runner/run-turn-boundary.js +1 -1
  132. package/dist/core/runner/runtask.d.ts +1 -0
  133. package/dist/core/runner/runtask.js +8 -11
  134. package/dist/core/runner/session-mode-seats.d.ts +48 -0
  135. package/dist/core/runner/session-mode-seats.js +73 -0
  136. package/dist/core/runner/session-rule-policy.js +3 -2
  137. package/dist/core/runner/stream-mode-verb.d.ts +27 -0
  138. package/dist/core/runner/stream-mode-verb.js +19 -0
  139. package/dist/core/runner/turn-attachments.d.ts +3 -3
  140. package/dist/core/runner/turn-attachments.js +1 -1
  141. package/dist/core/runner/write-protection-station.d.ts +7 -1
  142. package/dist/core/runner/write-protection-station.js +6 -3
  143. package/dist/core/runner-deps.d.ts +31 -34
  144. package/dist/core/runtime-caps.d.ts +12 -3
  145. package/dist/core/safety-axis-vocab.d.ts +2 -2
  146. package/dist/core/safety-axis-vocab.js +1 -1
  147. package/dist/core/secret-env.d.ts +30 -58
  148. package/dist/core/secret-env.js +149 -586
  149. package/dist/core/sensitive-path-policy.d.ts +4 -2
  150. package/dist/core/sensitive-path-policy.js +41 -31
  151. package/dist/core/store-contracts/checkpoint-store-contract.js +2 -1
  152. package/dist/core/task-event.d.ts +1 -1
  153. package/dist/core/task-result.d.ts +1 -1
  154. package/dist/core/task-spec.d.ts +41 -89
  155. package/dist/core/task-stream.d.ts +16 -0
  156. package/dist/core/terminal-cause.js +1 -0
  157. package/dist/core/tighten-task-spec.d.ts +2 -2
  158. package/dist/core/tighten-task-spec.js +12 -14
  159. package/dist/core/tool-catalog-entries.js +4 -3
  160. package/dist/core/tool-policy.d.ts +84 -30
  161. package/dist/core/tool-policy.js +76 -16
  162. package/dist/core/tool-registry.d.ts +38 -0
  163. package/dist/core/tool-registry.js +25 -1
  164. package/dist/core/tool-roster.d.ts +17 -2
  165. package/dist/core/tool-roster.js +11 -1
  166. package/dist/core/tool-spec.d.ts +8 -9
  167. package/dist/core/trace.d.ts +18 -6
  168. package/dist/core/types.d.ts +2 -1
  169. package/dist/core/wiring-manifest.d.ts +31 -5
  170. package/dist/core/wiring-manifest.js +28 -1
  171. package/dist/core/write-protect.d.ts +11 -1
  172. package/dist/core/write-protect.js +26 -15
  173. package/dist/engine/execution-env/node-execution-env.d.ts +6 -1
  174. package/dist/engine/execution-env/node-execution-env.js +16 -3
  175. package/dist/engine/harness/agent-harness.js +2 -1
  176. package/dist/engine/harness/types.d.ts +6 -7
  177. package/dist/engine/llm/types.d.ts +2 -4
  178. package/dist/engine/loop/types.d.ts +7 -0
  179. package/dist/engine/lsp/node-lsp-manager.js +1 -1
  180. package/dist/index.d.ts +18 -8
  181. package/dist/index.js +15 -6
  182. package/dist/orchestration/workflow-governance.js +1 -1
  183. package/dist/orchestration/workflow-primitives.d.ts +1 -1
  184. package/dist/orchestration/workflow-size-guideline.js +2 -2
  185. package/dist/stores/file/index.d.ts +5 -3
  186. package/dist/stores/file/session-store.d.ts +8 -2
  187. package/dist/stores/file/session-store.js +5 -5
  188. package/dist/tools/artifact/artifact-tool.d.ts +17 -0
  189. package/dist/tools/artifact/artifact-tool.js +16 -1
  190. package/dist/tools/fs/bash-readonly-classifier.d.ts +28 -7
  191. package/dist/tools/fs/bash-readonly-classifier.js +88 -0
  192. package/dist/tools/fs/containment-face.d.ts +9 -3
  193. package/dist/tools/fs/containment-face.js +2 -0
  194. package/dist/tools/fs/file-read-check.d.ts +50 -0
  195. package/dist/tools/fs/file-read-check.js +79 -0
  196. package/dist/tools/fs/fs-bash.d.ts +3 -3
  197. package/dist/tools/fs/fs-read.d.ts +1 -0
  198. package/dist/tools/fs/fs-search-tools.d.ts +2 -2
  199. package/dist/tools/fs/fs-search-tools.js +4 -4
  200. package/dist/tools/fs/fs-shared.js +20 -6
  201. package/dist/tools/fs/fs-write.d.ts +4 -3
  202. package/dist/tools/fs/fs-write.js +9 -9
  203. package/dist/tools/fs/index.d.ts +39 -3
  204. package/dist/tools/fs/index.js +38 -15
  205. package/dist/tools/fs/read-deny-home.d.ts +93 -0
  206. package/dist/tools/fs/read-deny-home.js +225 -0
  207. package/dist/tools/fs/read-deny.d.ts +176 -34
  208. package/dist/tools/fs/read-deny.js +268 -61
  209. package/dist/tools/fs/safety.d.ts +6 -1
  210. package/dist/tools/fs/safety.js +18 -5
  211. package/dist/tools/fs/search.d.ts +3 -0
  212. package/dist/tools/fs/search.js +47 -9
  213. package/dist/tools/fs/shell-read-check.d.ts +52 -13
  214. package/dist/tools/fs/shell-read-check.js +199 -20
  215. package/dist/tools/fs/shell-read-establish.d.ts +7 -3
  216. package/dist/tools/fs/shell-read-establish.js +134 -21
  217. package/dist/tools/fs/shell-read-identity.d.ts +7 -0
  218. package/dist/tools/fs/shell-read-identity.js +21 -0
  219. package/dist/tools/fs/shell-read-judge.d.ts +92 -32
  220. package/dist/tools/fs/shell-read-judge.js +43 -18
  221. package/dist/tools/fs/shell-read-plan.d.ts +4 -0
  222. package/dist/tools/fs/shell-read-plan.js +26 -4
  223. package/dist/tools/fs/shell-read-write-targets.d.ts +73 -0
  224. package/dist/tools/fs/shell-read-write-targets.js +173 -0
  225. package/package.json +1 -1
  226. package/test/export-surface.snapshot.json +117 -11
  227. package/wire-changes/core@7.34.0.json +2621 -0
  228. package/wire-changes/core@7.35.0.json +584 -0
@@ -204,12 +204,11 @@ export interface RunnerDeps {
204
204
  */
205
205
  readDenyPatterns?: readonly import("../tools/fs/read-deny.js").ReadDenyEntry[];
206
206
  /**
207
- * The deployment's built-in deny-table TIER selection — the ON/OFF switch for the whole built-in
208
- * table, OFF unless this seat says otherwise. EXACTLY the listed tiers of
209
- * {@link import("../tools/fs/read-deny.js").READ_FACE_BUILTIN_DENY_TABLE} are active (`[]` = none —
210
- * explicit and legal); ABSENT = {@link import("../tools/fs/read-deny.js").READ_DENY_DEFAULT_TIERS},
211
- * which is EMPTY: an unconfigured deployment activates no built-in row, so nothing from that table
212
- * refuses a read or demotes a shell one. A leg's active tiers are REPORTED on its wiring manifest
207
+ * The deployment's built-in deny-table TIER selection — the switch for the built-in table. EXACTLY the
208
+ * listed tiers of {@link import("../tools/fs/read-deny.js").READ_FACE_BUILTIN_DENY_TABLE} are active (`[]` =
209
+ * none — explicit and legal: nothing from that table refuses a read); ABSENT =
210
+ * {@link import("../tools/fs/read-deny.js").READ_DENY_DEFAULT_TIERS} (`credentials` and the home-anchored
211
+ * `agent-config`). A leg's active tiers are REPORTED on its wiring manifest
213
212
  * ({@link import("./wiring-manifest.js").WiringManifest.readDeny}). Composes with
214
213
  * {@link readDenyBuiltinExclude} (tiers first, then row removal); never touches the additions
215
214
  * seats or the write faces. Unknown tier names refuse loudly at prepare (#123). DEPLOYMENT seat
@@ -633,9 +632,9 @@ export interface RunnerDeps {
633
632
  * `autoMode` (the per-principal deny bit of the user-enabled auto mode), `allowMemoryOptOut` (may this
634
633
  * principal declare a capture opt-out), and `forceDurableGate` (forces a run onto the durable-approval
635
634
  * path so a policy `ask` suspends to the wire — where a checkpoint store is wired; a store-less leg
636
- * announces `config.durable_gate_unavailable`). `allowUltracode` is a shell/UX concern (reasoning-tier,
637
- * not a core primitive); `allowBypassPermissions` is enforced at the service settings-resolution layer
638
- * (the engine sees only a resolved policy, never a "this allow came from bypass" signal).
635
+ * announces `config.durable_gate_unavailable`), and `bypassPermissions` (the deny bit of the
636
+ * `bypassPermissions` mode — a denied request folds to `default`, announced). `allowUltracode` is a shell/UX
637
+ * concern (reasoning-tier, not a core primitive).
639
638
  */
640
639
  runtimeCapsResolver?: (principal: string | undefined) => RuntimeCaps | undefined | Promise<RuntimeCaps | undefined>;
641
640
  /**
@@ -705,7 +704,7 @@ export interface RunnerDeps {
705
704
  /**
706
705
  * design/143 批2b — the auto-mode classifier's DEPLOYMENT assembly face. This is the
707
706
  * CAPABILITY arm of the three-arm arming: a run arms auto mode only when the task carries the
708
- * auto-mode INTENT ({@link TaskSpec.autoModeRequested}, or the same bit inherited on the chain by an
707
+ * auto-mode INTENT (`TaskSpec.permissionMode: "auto"`, or the mode inherited on the chain by an
709
708
  * engine-spawned child) AND this face is present AND the per-principal DENY bit is not set
710
709
  * ({@link RuntimeCaps.autoMode}` !== false` — absent is not a denial).
711
710
  *
@@ -717,6 +716,14 @@ export interface RunnerDeps {
717
716
  * `summarize → default`; tier default `flash`) via the brain's simple-completion pipe — same
718
717
  * lane as compaction/consolidation, no tools, no session writes.
719
718
  */
719
+ /**
720
+ * The deployment's A2A peer switches. `isolatePeers: true` makes every A2A peer skill's egress default an
721
+ * OPERATOR mandate: its ask is `operator_forced` (kept under `bypassPermissions`, not settled by `dontAsk`)
722
+ * instead of the releasable `tool_marks_a2a`. Absent ⇒ the default (a permission mode may release it, disclosed).
723
+ */
724
+ a2a?: {
725
+ isolatePeers?: true;
726
+ };
720
727
  autoMode?: {
721
728
  /** Rule overrides for the four permissions sections (omitted section = CC defaults verbatim). */
722
729
  rules?: import("./auto-mode-prompt.js").AutoModeRules;
@@ -726,9 +733,15 @@ export interface RunnerDeps {
726
733
  sessionContext?: readonly string[];
727
734
  /** Transcript-window bounds for the classify prompt (defaults: 40 entries / 2000 chars each). */
728
735
  window?: import("./auto-mode-prompt.js").AutoModeWindowOptions;
729
- /** Classify round-trip cap, ms (default 15_000) — ONE ladder rung (see `classifierFallback`), not the
730
- * whole classification. A rung past the cap did not rule: the walk moves to the next candidate, and with
731
- * none left the call is DENIED with a sentence that says so. The next call is classified afresh. */
736
+ /** Classify round-trip cap, ms — ONE ladder rung (see `classifierFallback`), not the whole classification;
737
+ * default `AUTO_MODE_DEFAULT_TIMEOUT_MS` (180 000, sized for a self-hosted gateway's queue + prefill; worst
738
+ * case two rungs = 360 s). A rung past the cap did not rule: the walk moves to the next candidate; with none
739
+ * left the classification is `unavailable` — the call goes on to a person where the leg has an approval seat
740
+ * (a live approver or a durable park), and is DENIED with a sentence that says so where it has none; the
741
+ * user hears it either way (`classifier.unavailable`). The next call is classified afresh. A present value
742
+ * that is not a number of milliseconds in [1, 2147483647] is REFUSED loudly at every leg's prepare while this face
743
+ * is present, whatever mode the leg starts in (`config.auto_mode_timeout_invalid`) — never clamped, never read as the
744
+ * default; there is no OFF. */
732
745
  timeoutMs?: number;
733
746
  /**
734
747
  * What a classification does when the classifier SEAT does not rule (the leg threw / rejected, the cap
@@ -744,8 +757,8 @@ export interface RunnerDeps {
744
757
  * (worst case two `timeoutMs` caps); `"none"` buys that back for the deny.
745
758
  *
746
759
  * A value outside the closed set ({@link import("./auto-mode.js").AUTO_MODE_CLASSIFIER_FALLBACKS}) is
747
- * REFUSED loudly at prepare (`config.auto_mode_classifier_fallback_invalid`) — never clamped, never read
748
- * as the default.
760
+ * REFUSED loudly at every leg's prepare while this face is present, whatever mode the leg starts in
761
+ * (`config.auto_mode_classifier_fallback_invalid`) — never clamped, never read as the default.
749
762
  */
750
763
  classifierFallback?: import("./auto-mode.js").AutoModeClassifierFallback;
751
764
  /**
@@ -764,8 +777,9 @@ export interface RunnerDeps {
764
777
  * the run STOPS with `TaskResult.errorCode = "classifier.denial_limit"` (a notice of the same
765
778
  * code is minted).
766
779
  *
767
- * Every member optional (defaults 3 / 20 / 120_000). A present member with a bad value is refused
768
- * loudly at prepare — never clamped, never silently read as the default.
780
+ * Every member optional (defaults 3 / 20 / 120_000). A present member with a bad value, a member that is
781
+ * not one of the three, or a value that is not a record, is refused loudly at every leg's prepare while this face is present, whatever mode the
782
+ * leg starts in (`config.auto_mode_denial_limit_invalid`) — never clamped, never silently read as the default.
769
783
  * See {@link import("./auto-mode.js").AutoModeDenialLimitOptions}.
770
784
  */
771
785
  denialLimit?: import("./auto-mode.js").AutoModeDenialLimitOptions;
@@ -1354,23 +1368,6 @@ export interface RunnerDeps {
1354
1368
  * deployment wires the factory.
1355
1369
  */
1356
1370
  executionEnvFactory?: import("./remote-env.js").ExecutionEnvFactory;
1357
- /**
1358
- * design/77 §1 Gate-1 (oracleIsolation) — a **DISTINCT** trusted control-plane factory that mints the
1359
- * ISOLATED grader env an out-of-process oracle grades in (the 4th auto-promote gate). It is a SIBLING of
1360
- * {@link executionEnvFactory}, never the same env: the worker runs in `executionEnvFactory`'s env, the
1361
- * grader in `graderEnvFactory`'s — so a worker can't corrupt the env that judges it. It inherits the exact
1362
- * same trust contract: `TaskSpec` deliberately has NO env field (design/44 §7 Q4), so an untrusted caller
1363
- * can never inject/swap a grader env and grade itself; only the trusted deployment wires this factory. The
1364
- * RESERVED SEAM, stated plainly (ruled 2026-08-04, field-liveness review): the engine has NO call
1365
- * site for this factory today — nothing mints, wraps, or asserts through it yet. The intended wirer
1366
- * is the hardened-grader path a deployment builds on its remote-env side (the k8s pod-spec-patch
1367
- * seam is the documented server-side half); when that live runner lands, the env it mints is to be
1368
- * wrapped in a {@link import("./oracle-isolation.js").GraderEnv} and asserted via
1369
- * {@link import("./oracle-isolation.js").assertOracleIsolation} before any positive oracle verdict.
1370
- * **Auto-promote stays mandate-OFF until the four gates are implemented + verified end-to-end** (design/77
1371
- * §7); this seam only makes auto-accept implementable — it does not turn it on.
1372
- */
1373
- graderEnvFactory?: import("./remote-env.js").ExecutionEnvFactory;
1374
1371
  /**
1375
1372
  * Containment root for the file tools (design/44 §4 invariant 7): every path must resolve within it,
1376
1373
  * else the tool rejects (`PathNotInRoot`). Default `process.cwd()`. A defense-in-depth guard rail at the
@@ -81,8 +81,8 @@ export interface WorkflowGovernanceBaseline {
81
81
  * · GRANT-shaped, `=== true` opts in / absent is OFF: {@link allowObservers};
82
82
  * · FORCE-shaped, `true` mandates / absent is the caller's opt-in default: {@link forceDurableGate}
83
83
  * (binds only where a checkpoint store is wired; announced `config.durable_gate_unavailable` where none is).
84
- * These six are the caps the ENGINE enforces; `allowUltracode`/`allowBypassPermissions` are shell-UX /
85
- * service-settings-layer concerns (see {@link RunnerDeps.runtimeCapsResolver}).
84
+ * These seven are the caps the ENGINE enforces — {@link bypassPermissions} is the seventh, the deny bit of the
85
+ * `bypassPermissions` mode; `allowUltracode` stays a shell-UX concern (see {@link RunnerDeps.runtimeCapsResolver}).
86
86
  */
87
87
  /**
88
88
  * #692 C-d — WHICH plane's ratchet denied auto mode, when the resolver knows: the three settings sources
@@ -135,7 +135,7 @@ export interface RuntimeCaps {
135
135
  /**
136
136
  * The per-principal auto-mode DENY bit (CC 2.1.250 polarity — the mirror of the settings-plane
137
137
  * `permissions.disableAutoMode` ratchet: an organization may only take auto mode AWAY; it is the
138
- * USER who turns it on, at the task's intent seat {@link TaskSpec.autoModeRequested}).
138
+ * USER who turns it on, by requesting the mode at {@link TaskSpec.permissionMode}).
139
139
  *
140
140
  * **POLARITY: `=== false` DENIES; ABSENT IS NOT A DENIAL.** This is the family's deny-shaped
141
141
  * member (like {@link allowWorkflows} / {@link allowFork}), NOT a grant-shaped one like
@@ -157,6 +157,15 @@ export interface RuntimeCaps {
157
157
  * manifest) — a source named for a denial that did not happen is a marshalling error, never a fact.
158
158
  */
159
159
  autoModeDenySource?: AutoModeDenySource;
160
+ /**
161
+ * The per-principal `bypassPermissions` DENY bit — the engine seat of the settings-plane
162
+ * `permissions.disableBypassPermissionsMode: "disable"` ratchet. **`=== false` DENIES; ABSENT IS NOT A DENIAL**
163
+ * (the family's deny shape, like {@link autoMode}). A task that requests `bypassPermissions` on a leg whose
164
+ * caps carry `false` runs in `default` instead, announced once (`config.permission_mode_unavailable`,
165
+ * `by: "operator_deny"`) and reported on `wiring_manifest.permissionMode` — a mode declaration is folded, never
166
+ * a 4xx. A steer into `bypassPermissions` on such a leg folds the same way.
167
+ */
168
+ bypassPermissions?: boolean;
160
169
  /**
161
170
  * design/383 §3.1 — may this principal declare a session memory-capture OPT-OUT
162
171
  * (`TaskSpec.memory.capture: "off"` / the Runner flip verb)? `false` = the deployment REQUIRES
@@ -25,8 +25,8 @@ export declare const SAFETY_AXIS_VOCABULARY: {
25
25
  readonly safetyAxis: readonly ["egress", "irreversible", "shell"];
26
26
  /** `RiskDescriptor.severity` — ToolEmu-style tier (5 = most severe), the inbox triage key (checkpoint-store.ts:85). */
27
27
  readonly severity: readonly [1, 2, 3, 4, 5];
28
- /** `TaskSpec.shellGate` (declared in core/types.ts) — deployment shell-command gate rank, `off` < `classify` < `always`. */
29
- readonly shellGate: readonly ["off", "classify", "always"];
28
+ /** `TaskSpec.shellGate` (declared in core/types.ts) — the operator's shell floor; one value (`always`). */
29
+ readonly shellGate: readonly ["always"];
30
30
  /** `ToolPolicy` decision — per-tool adjudication; `deny` short-circuits the `deny > ask > allow` fold (tool-policy.ts). */
31
31
  readonly permissionDecision: readonly ["allow", "ask", "deny"];
32
32
  };
@@ -4,7 +4,7 @@ export const SAFETY_AXIS_VOCABULARY = {
4
4
  irreversibility: ["never", "maybe", "always"],
5
5
  safetyAxis: ["egress", "irreversible", "shell"],
6
6
  severity: [1, 2, 3, 4, 5],
7
- shellGate: ["off", "classify", "always"],
7
+ shellGate: ["always"],
8
8
  permissionDecision: ["allow", "ask", "deny"],
9
9
  };
10
10
  const _toolEffectExhaustive = true;
@@ -1,77 +1,50 @@
1
1
  /**
2
- * Canonical "local-spawn shell secret-env protection" (sema D1) — FIRST-PARTY, vendor-independent.
2
+ * The environment a spawned child inherits: which of this process's variables it must not see.
3
3
  *
4
- * When the engine (or a downstream host/exec adapter) spawns a local shell whose commands the MODEL chooses (no human at the keyboard), the child's
5
- * inherited env MUST be fail-closed: a model-chosen `printenv DEEPSEEK_API_KEY` via the `bash` tool would
6
- * otherwise exfiltrate the orchestrator's brain key / git token / DB creds (the gate authorizes WHICH tool runs,
7
- * NOT isolation). The `scrub` policy drops secret-pattern keys (keeps PATH/build/locale → low breakage).
8
- *
9
- * This lives in `src/core/` — NOT `src/vendor/` — on purpose. It is OUR security invariant (D1 is a first-party
10
- * edit, not openclaw upstream), shared by the (currently-vendored) {@link NodeExecutionEnv} AND a downstream
11
- * adapter (service host adapter). Keeping the single source of the secret PATTERN here means:
12
- * 1. A consumer imports it instead of mirroring a regex that would silently DRIFT when the pattern is extended.
13
- * 2. The public export points at a STABLE first-party path that SURVIVES the planned de-vendoring refactor —
14
- * when NodeExecutionEnv is naturalized out of `src/vendor/`, this module does not move and nothing rebinds.
15
- *
16
- * The `inheritEnv` THREE-STATE policy (`"all"` opt-out / `"scrub"` default / `string[]` allowlist) is read ONCE, by
17
- * {@link inheritedHostEnv}, for every engine spawn site that takes it (the tool shell, a `runSpec` oracle gate). A
18
- * downstream adapter composes its own child env; only the secret PATTERN is shared with it.
4
+ * A child the engine spawns may run what the MODEL chose (a tool shell, a gate over model-written code, a language
5
+ * server). Under the `"scrub"` policy (the default) it inherits every variable but those the judgment below names —
6
+ * deleted whole, never rewritten; `"all"` and a `string[]` allow list are the caller's explicit alternatives
7
+ * ({@link inheritedHostEnv}). One judgment per variable ({@link classifySecretEnvEntry}), the first rule that answers:
8
+ * 1. exempt — git's environment config and the proxy variables, handed on as written ({@link isExemptEnvName});
9
+ * 2. `exact-name` — a known credential name ({@link CREDENTIAL_ENV_NAMES});
10
+ * 3. `prefix-rule` — the OpenTelemetry settings ({@link OTEL_ENV_RE});
11
+ * 4. `namespace-rule` — a credential word as any segment of a name in the engine's own `SEMA_` namespace;
12
+ * 5. `name-rule` — a credential-shaped name ({@link nameIsCredentialShaped}) off {@link NON_SECRET_ENV_EXACT_NAMES};
13
+ * 6. `value-rule` — a value that carries a credential ({@link valueCarriesCredential}).
14
+ * {@link isSecretEnvKey} and {@link scrubSecretEnv} both answer with this one judgment. The exempt families, the
15
+ * credential names, the name shape and the value predicate follow the reference implementation's subprocess-env scrub
16
+ * as written, three ways stricter: plural `TOKENS` is a credential word unless a count word touches it, the GitHub
17
+ * token names are not held back from the name shape, and the name shape always runs.
19
18
  */
20
19
  import type { RedactionConfidence, RedactionSource } from "./arg-summary.js";
21
20
  import { type EngineNotice } from "./engine-notice.js";
22
- /** One git config entry as git reads it from the environment. A half is undefined when its source lacks it (a member
23
- * missing from its index group). */
24
- interface GitConfigEntry {
25
- readonly key?: string;
26
- readonly value?: string;
27
- }
28
- export declare function readGitConfigParameters(text: string): GitConfigEntry[] | undefined;
29
- /** Which rule classified a key as secret-shaped — the env arm's `kind` vocabulary. */
30
- export type SecretEnvFindingKind = "suffix-rule" | "namespace-rule" | "exact-name" | "family-rule";
31
- /** One env entry the `scrub` policy withheld — dropped, or, for a member of git's config record, handed on holding a
32
- * placeholder half: the key (the VALUE is never carried — this record is meant to be loggable), the rule that
33
- * classified it, how strong that claim is, and the minting module. */
21
+ /** Which rule withheld an entry. */
22
+ export type SecretEnvFindingKind = "exact-name" | "name-rule" | "namespace-rule" | "prefix-rule" | "value-rule";
23
+ /** One env entry the `"scrub"` policy withheld (deleted): its name — never its value, so the record is loggable —, the
24
+ * rule that withheld it, how strong that claim is, and the minting module. */
34
25
  export interface SecretEnvFinding {
35
26
  key: string;
36
27
  kind: SecretEnvFindingKind;
37
28
  confidence: RedactionConfidence;
38
29
  source: RedactionSource;
39
30
  }
40
- /** What the two exact-name lists say about a name, before any shape rule is consulted. */
41
- export type ExactEnvNameVerdict = "credential" | "exempt" | "unknown";
42
- /** The exact-name arm of the classification, taking both lists as arguments. The credential list is read
43
- * FIRST: an exemption can never take a name away from it, so a name landing on both lists resolves to the
44
- * credential reading — the fail-closed direction (a wrongly-exempted name leaks; a wrongly-dropped one
45
- * does not). Module-level export (not part of the package surface): the two real lists are disjoint, so
46
- * only a controlled collision can tell this precedence from an inverted one. */
47
- export declare function classifyExactEnvName(key: string, credentialNames: ReadonlySet<string>, exemptNames: ReadonlySet<string>): ExactEnvNameVerdict;
48
- /** Is `key` a secret-pattern env var (one the fail-closed `scrub` policy drops before spawning a shell)? Pass the
49
- * entry's `value` — and the environment it sits in as `env`, and the child's `platform` — to get exactly the scrub's
50
- * answer for that entry: a git config member is judged with its index group, which only the environment holds; without
51
- * a value the name alone decides (a `GIT_CONFIG_KEY_<i>` then reads as secret — the name cannot clear itself).
52
- * `platform` is as for {@link scrubSecretEnv}. */
53
- export declare function isSecretEnvKey(key: string, value?: string, env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform): boolean;
54
- /** Drop every secret-pattern key (see {@link isSecretEnvKey}) from an env object — the fail-closed `scrub`
55
- * policy. git's indexed record is withheld entry by entry and never renumbered ({@link readGitEnvConfigRecord}): a
56
- * withheld entry git reads keeps its names, each holding its half of the placeholder entry `sema.withheld` (key) / an
57
- * empty string (value), so `GIT_CONFIG_COUNT` and every other index reach the child as the host wrote them. `findings`
58
- * is an OPTIONAL caller-owned collector: pass an array to learn which entries were withheld (by name) and why, read it
59
- * back after the call. A finding's name is absent from the result unless it is such a record member, which is present
60
- * holding the placeholder half. `platform` is the platform the child runs on — where git reads this environment:
61
- * Windows reads env names case-insensitively, so there any spelling of a record member is that member; elsewhere git
62
- * looks up the capitalised names only and every other spelling is judged on its own, apart from the record. It defaults
63
- * to this process's own platform, the answer for a child spawned on this host; a host whose child runs elsewhere (a
64
- * remote or sandboxed execution environment) passes that environment's platform. */
65
- export declare function scrubSecretEnv(env: NodeJS.ProcessEnv, findings?: SecretEnvFinding[], platform?: NodeJS.Platform): NodeJS.ProcessEnv;
31
+ /** Does the `"scrub"` policy withhold `key`? With `value`, exactly the answer {@link scrubSecretEnv} gives for that
32
+ * entry; without it, the answer for its name alone (the value rule then has nothing to read). */
33
+ export declare function isSecretEnvKey(key: string, value?: string): boolean;
34
+ /** The `"scrub"` policy: `env` without every entry {@link isSecretEnvKey} withholds, the rest as written. `findings` is
35
+ * an optional caller-owned collector: each withheld entry is pushed onto it (name, rule, confidence), none of them
36
+ * present in the result. `env` itself is not modified. */
37
+ export declare function scrubSecretEnv(env: NodeJS.ProcessEnv, findings?: SecretEnvFinding[]): NodeJS.ProcessEnv;
66
38
  /** How much of this process's environment a child spawned on this host inherits — the `inheritEnv` value. */
67
39
  export type InheritEnvPolicy = "all" | "scrub" | string[];
68
40
  /**
69
41
  * The environment a child spawned ON THIS HOST inherits, by an {@link InheritEnvPolicy}: `"scrub"` (and absent) is
70
- * this process's environment through {@link scrubSecretEnv} for this platform; `"all"` is this process's environment
42
+ * this process's environment through {@link scrubSecretEnv}; `"all"` is this process's environment
71
43
  * verbatim (the explicit opt-out); a `string[]` is exactly the named variables that are set, verbatim — a strict allow
72
44
  * list, so a name it leaves out (`PATH` included) is not inherited. `findings` collects what the scrub withheld, and
73
- * only the `"scrub"` arm adds to it. Any other value reads as `"scrub"`: a spawn site that must refuse a malformed
74
- * policy asks {@link inheritEnvPolicyProblem} first.
45
+ * only the `"scrub"` arm adds to it. Any other value reads as `"scrub"`; both spawn sites that take a policy — the
46
+ * tool shell's `NodeExecutionEnv` (at construction) and the oracle gate (per gate) — refuse a malformed one through
47
+ * {@link inheritEnvPolicyProblem} before it gets here.
75
48
  */
76
49
  export declare function inheritedHostEnv(policy: InheritEnvPolicy | undefined, findings?: SecretEnvFinding[]): NodeJS.ProcessEnv;
77
50
  /** Why `value` is not an {@link InheritEnvPolicy} (absent counts as one — the scrub), or `undefined` when it is. */
@@ -86,4 +59,3 @@ export declare function __resetSecretEnvScrubNoticeAnnouncement(): void;
86
59
  * findings array is a no-op.
87
60
  */
88
61
  export declare function announceSecretEnvScrub(onNotice: ((notice: EngineNotice) => void) | undefined, findings: readonly SecretEnvFinding[]): void;
89
- export {};