@sema-agent/core 7.15.0 → 7.16.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 (119) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/dist/core/governance-codes.js +2 -0
  3. package/dist/core/memory-engine/delegation-settlement.d.ts +37 -12
  4. package/dist/core/memory-engine/delegation-settlement.js +128 -39
  5. package/dist/core/memory-engine/engine.d.ts +9 -8
  6. package/dist/core/memory-engine/engine.js +115 -120
  7. package/dist/core/memory-engine/file-backend.d.ts +17 -5
  8. package/dist/core/memory-engine/file-backend.js +78 -34
  9. package/dist/core/memory-engine/index.d.ts +2 -2
  10. package/dist/core/memory-engine/index.js +2 -2
  11. package/dist/core/memory-engine/layout.d.ts +152 -54
  12. package/dist/core/memory-engine/layout.js +441 -104
  13. package/dist/core/memory-engine/types.d.ts +8 -3
  14. package/dist/core/memory-engine/types.js +5 -0
  15. package/dist/core/runner/abort-race.d.ts +3 -3
  16. package/dist/core/runner/active-skill-scope.d.ts +2 -2
  17. package/dist/core/runner/assemble-result.d.ts +29 -29
  18. package/dist/core/runner/checkpoint-scope.d.ts +4 -4
  19. package/dist/core/runner/clock-and-limits.d.ts +3 -3
  20. package/dist/core/runner/compaction-call-options.d.ts +11 -11
  21. package/dist/core/runner/compaction-knobs.d.ts +4 -4
  22. package/dist/core/runner/compaction-seams.d.ts +5 -5
  23. package/dist/core/runner/contracts.d.ts +222 -224
  24. package/dist/core/runner/decide-continuation.d.ts +6 -6
  25. package/dist/core/runner/denial-limit-arms.d.ts +8 -8
  26. package/dist/core/runner/derived-route-fallback.d.ts +2 -2
  27. package/dist/core/runner/gate-exit.d.ts +6 -6
  28. package/dist/core/runner/git-status-frame.d.ts +7 -7
  29. package/dist/core/runner/inherited-ask-grants.d.ts +6 -6
  30. package/dist/core/runner/memory-capture-optout.d.ts +1 -1
  31. package/dist/core/runner/memory-consolidation-driver.d.ts +4 -4
  32. package/dist/core/runner/memory-consolidation.d.ts +6 -6
  33. package/dist/core/runner/park-commit.d.ts +6 -6
  34. package/dist/core/runner/permission-rule-lanes.d.ts +19 -19
  35. package/dist/core/runner/prepare-acquire-reconcile.d.ts +4 -4
  36. package/dist/core/runner/prepare-ask-lane.d.ts +3 -3
  37. package/dist/core/runner/prepare-boundary-parks.d.ts +3 -3
  38. package/dist/core/runner/prepare-caps-and-workflow.d.ts +5 -5
  39. package/dist/core/runner/prepare-config-doors.d.ts +21 -21
  40. package/dist/core/runner/prepare-context-lane.d.ts +6 -6
  41. package/dist/core/runner/prepare-defer-classify.d.ts +2 -2
  42. package/dist/core/runner/prepare-delegation-surface.d.ts +1 -1
  43. package/dist/core/runner/prepare-file-history.d.ts +2 -2
  44. package/dist/core/runner/prepare-gate-stations.d.ts +5 -5
  45. package/dist/core/runner/prepare-hands-readface.d.ts +33 -33
  46. package/dist/core/runner/prepare-inherited-gate.d.ts +4 -4
  47. package/dist/core/runner/prepare-listings.d.ts +3 -3
  48. package/dist/core/runner/prepare-lsp.d.ts +3 -3
  49. package/dist/core/runner/prepare-memory-engine-session.d.ts +5 -5
  50. package/dist/core/runner/prepare-memory.js +6 -7
  51. package/dist/core/runner/prepare-offload-wrappers.d.ts +2 -2
  52. package/dist/core/runner/prepare-park-ask.d.ts +6 -6
  53. package/dist/core/runner/prepare-policy-chain.d.ts +4 -4
  54. package/dist/core/runner/prepare-prompt-inputs.d.ts +5 -5
  55. package/dist/core/runner/prepare-protocol-tools.d.ts +1 -1
  56. package/dist/core/runner/prepare-question-face.d.ts +4 -4
  57. package/dist/core/runner/prepare-run-refs.d.ts +11 -11
  58. package/dist/core/runner/prepare-safety-scan.d.ts +1 -1
  59. package/dist/core/runner/prepare-suspend-saga.d.ts +4 -4
  60. package/dist/core/runner/prepare-task.d.ts +12 -12
  61. package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +2 -3
  62. package/dist/core/runner/prepare-wiring-manifest.d.ts +4 -4
  63. package/dist/core/runner/prepare-workspace-restore.d.ts +1 -1
  64. package/dist/core/runner/remote-env-retry.d.ts +3 -3
  65. package/dist/core/runner/resume-admission.d.ts +1 -1
  66. package/dist/core/runner/resume-claim.d.ts +1 -1
  67. package/dist/core/runner/resume-internals-and-config.d.ts +1 -1
  68. package/dist/core/runner/resume-policy-outcome.d.ts +1 -1
  69. package/dist/core/runner/resume-preflight.d.ts +1 -1
  70. package/dist/core/runner/resume-review-outcome.d.ts +1 -1
  71. package/dist/core/runner/run-brain-sinks.d.ts +1 -1
  72. package/dist/core/runner/run-clock-and-content.d.ts +4 -4
  73. package/dist/core/runner/run-compaction-machinery.d.ts +3 -3
  74. package/dist/core/runner/run-git-lane.d.ts +1 -1
  75. package/dist/core/runner/run-harness-handlers.d.ts +2 -2
  76. package/dist/core/runner/run-identity-wiring.d.ts +4 -4
  77. package/dist/core/runner/run-leg.d.ts +3 -3
  78. package/dist/core/runner/run-notification-lane.d.ts +2 -2
  79. package/dist/core/runner/run-reasoning-seat.d.ts +2 -2
  80. package/dist/core/runner/run-settle-and-teardown.d.ts +4 -4
  81. package/dist/core/runner/run-telemetry-and-budget-seats.d.ts +2 -2
  82. package/dist/core/runner/run-terminal-adoption.d.ts +5 -5
  83. package/dist/core/runner/runtask.d.ts +14 -14
  84. package/dist/core/runner/session-file-state-replay.d.ts +3 -3
  85. package/dist/core/runner/session-rule-policy.d.ts +2 -2
  86. package/dist/core/runner/steer-admission.d.ts +2 -2
  87. package/dist/core/runner/stream-halt-verbs.d.ts +1 -1
  88. package/dist/core/runner/stream-reap.d.ts +1 -1
  89. package/dist/core/runner/synthetic-tools.d.ts +8 -8
  90. package/dist/core/runner/teardown-bounded.d.ts +2 -2
  91. package/dist/core/runner/tool-defer-gate.d.ts +1 -1
  92. package/dist/core/runner/tool-disclosure.d.ts +33 -33
  93. package/dist/core/runner/tool-end-body.d.ts +3 -3
  94. package/dist/core/runner/tool-face-overlay.d.ts +2 -2
  95. package/dist/core/runner/tool-output-projection.d.ts +2 -2
  96. package/dist/core/runner/turn-attachments.d.ts +53 -53
  97. package/dist/core/runner/usage-accounting.d.ts +4 -4
  98. package/dist/core/runner/workspace-path.d.ts +1 -1
  99. package/dist/engine/llm/types.d.ts +1 -1
  100. package/dist/index.d.ts +2 -2
  101. package/dist/index.js +2 -2
  102. package/dist/tools/fs/bash-readonly-classifier.d.ts +40 -40
  103. package/dist/tools/fs/encoding.d.ts +31 -40
  104. package/dist/tools/fs/fs-bash.d.ts +35 -35
  105. package/dist/tools/fs/fs-pdf.d.ts +8 -8
  106. package/dist/tools/fs/fs-search-tools.d.ts +4 -4
  107. package/dist/tools/fs/fs-shared.d.ts +144 -158
  108. package/dist/tools/fs/fs-write.d.ts +8 -8
  109. package/dist/tools/fs/gh-rate-limit.d.ts +13 -14
  110. package/dist/tools/fs/index.d.ts +74 -78
  111. package/dist/tools/fs/notebook.d.ts +24 -25
  112. package/dist/tools/fs/pdf.d.ts +3 -3
  113. package/dist/tools/fs/read-deny.d.ts +22 -22
  114. package/dist/tools/fs/read-face.d.ts +21 -24
  115. package/dist/tools/fs/repo-map.d.ts +8 -8
  116. package/dist/tools/fs/safety.d.ts +116 -129
  117. package/dist/tools/fs/search.d.ts +63 -71
  118. package/package.json +5 -2
  119. package/test/export-surface.snapshot.json +5 -1
@@ -1,15 +1,15 @@
1
1
  /**
2
- * design/390 §1.2 M19 (boundary parks) — prepareTask's three BOUNDARY-FAMILY park lanes, verbatim from the driver's
2
+ * PrepareTask's three BOUNDARY-FAMILY park lanes, verbatim from the driver's
3
3
  * gate-machinery block: the ONE resource mint (`mintResourceSuspend`) behind the task-axis `suspendForResource` (exposed
4
4
  * under the caller's `resourceSuspend` opt-in) and the infrastructure `suspendForPlatformLimit` (exposed on durable infra
5
5
  * alone), and the `plan_review` mint behind `suspendForReview` (exposed with a checkpoint store). Every mint reuses the
6
6
  * suspend saga's serializer, commit saga, loop cap and env split — this phase adds no second copy of any of them. The
7
- * interface is the dependency list the segment had implicitly (design/238 R-1); the three lanes used to be forward-declared
7
+ * interface is the dependency list the segment had implicitly; the three lanes used to be forward-declared
8
8
  * `let`s at task scope, assigned inside the block, so the driver's Prepared could expose them — they are this phase's
9
9
  * Result now, and the driver binds them as consts.
10
10
  *
11
11
  * SYNCHRONOUS FUNCTION, SYNCHRONOUS CALL: the stretch has no await of its own (the mints run at a turn boundary), so the
12
- * phase adds no yield between the suspend saga before it and the park closure after it (design/390 §1.5). Read-stability
12
+ * phase adds no yield between the suspend saga before it and the park closure after it. Read-stability
13
13
  * of the host handles for the call: {@link RunInternals} (`@contract prepare.deps-read-stable`).
14
14
  *
15
15
  * The lanes exist exactly when the saga does (the ask lane's presence law) — an absent saga answers three absent lanes,
@@ -1,12 +1,12 @@
1
1
  /**
2
- * design/390 §1.2 M4 — prepareTask's CAPS-AND-WORKFLOW phase, verbatim from the driver: the caller-tool roster
2
+ * PrepareTask's CAPS-AND-WORKFLOW phase, verbatim from the driver: the caller-tool roster
3
3
  * map (the defineTool-product branch and the rich-ctx wrap through the large-result wrapper), the ReportBlocked /
4
4
  * ReportFindings / plan-pair mounts, the per-principal runtime caps resolve with its fail-closed degrade and value
5
5
  * screen, the compliance posture veto with its two refusal codes, the fork verdict and the observers grant, the
6
6
  * auto-mode arming (classifier model, lane rule, decider + denial tracker + persisted recipe) with its manifest
7
7
  * reason, the self-orchestration gate with its governance note, and the Workflow mount with its size-guideline
8
8
  * seat. The three arming helpers and the parent-capture-state join moved with the segment (only this phase calls
9
- * them). The interface is the dependency list the segment had implicitly (design/238 R-1).
9
+ * them). The interface is the dependency list the segment had implicitly.
10
10
  *
11
11
  * ASYNC PHASE: the segment awaits the two resolvers, the classifier route pre-flight and the Workflow factory,
12
12
  * exactly where the driver awaited them; the roster map and the synthetic mounts before the first of those awaits
@@ -14,7 +14,7 @@
14
14
  * (`@contract prepare.deps-read-stable`).
15
15
  *
16
16
  * THE ROSTER IS MINTED HERE (`tools`): every later phase that mounts pushes into this same array — the writer table
17
- * lives on {@link Prepared.tools} (design/238 R-3). LATE-BOUND SEATS: the Workflow mount's call-time getters read
17
+ * lives on {@link Prepared.tools}. LATE-BOUND SEATS: the Workflow mount's call-time getters read
18
18
  * three facts later stations resolve (the memory session, the center adoption, the hands mount's deny additions);
19
19
  * each enters as a getter on the Input and is read exactly where the driver's getter read the variable.
20
20
  */
@@ -130,7 +130,7 @@ export interface PrepareCapsAndWorkflowInput {
130
130
  }>;
131
131
  }
132
132
  export interface PrepareCapsAndWorkflowResult {
133
- /** owned — THE run's roster BUILDER (design/388: the mount array is private to it; `Prepared.tools` is its read face,
133
+ /** owned — THE run's roster BUILDER (the mount array is private to it; `Prepared.tools` is its read face,
134
134
  * whose JSDoc carries the writer table). Minted here from the caller's tools; every later mount goes through its verbs.
135
135
  * Writers here: the caller mounts, then the ReportBlocked, ReportFindings, ExitPlanMode, EnterPlanMode and Workflow mounts. */
136
136
  roster: RosterBuilder;
@@ -150,7 +150,7 @@ export interface PrepareCapsAndWorkflowResult {
150
150
  /** owned — the observers grant (`allowObservers === true`, explicit opt-in). */
151
151
  observersActive: boolean;
152
152
  /** owned — the arming outcome as a closed reason (the manifest's auto-mode face). */
153
- /** #529 / #692 C-d — the leg's auto-mode arming fact (`armed` ⇔ `reason === "armed"`; `deniedSource` only beside a STATED `denied`). */
153
+ /** The leg's auto-mode arming fact (`armed` ⇔ `reason === "armed"`; `deniedSource` only beside a STATED `denied`). */
154
154
  autoModeArmReason: AutoModeArmFact;
155
155
  /** owned — the armed classifier, or undefined when any arming arm failed. */
156
156
  autoModeDecider: AutoModeDecider | undefined;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * design/238 B-1 (P0 相位抽取) — prepareTask's config-doors phase: the synchronous stretch from the
2
+ * PrepareTask's config-doors phase: the synchronous stretch from the
3
3
  * tool-face snapshot freeze through model/thinking/compaction-model resolution. The inputs are
4
4
  * exactly the fields of {@link PrepareConfigDoorsInput} (the original extraction slice — spec, deps,
5
5
  * sessions, the resume/internals seats); the outputs are the fields of
@@ -14,7 +14,7 @@
14
14
  * `prepare-task-phase-pins` microtask-latch tests.
15
15
  *
16
16
  * Throws pass through unchanged: every `config.*` / `resume_at.*` refusal here is a DELIBERATE
17
- * at-the-door rejection (design/99 §E18 — a throw before acquisition needs no cleanup), and the
17
+ * at-the-door rejection (a throw before acquisition needs no cleanup), and the
18
18
  * interaction-posture door's `deps.onError` disclosure (call order and payload) is part of the
19
19
  * contract. The per-task agents rebind returns a REBOUND spec (shallow copy, only `tools`
20
20
  * replaced) — the caller's object is never mutated; the safety scan must receive the rebound one.
@@ -33,7 +33,7 @@ export declare function limitConfigError(code: string, message: string): Error &
33
33
  code?: string;
34
34
  };
35
35
  /**
36
- * design/164 — validate `TaskSpec.limits` at the door and return it unchanged.
36
+ * Validate `TaskSpec.limits` at the door and return it unchanged.
37
37
  *
38
38
  * Two refusals, both fail-loud (the {@link resolveStallTimeoutMs} posture: a bound nobody can evaluate is
39
39
  * not a bound, and folding it to a default would silently run the task under limits nobody chose):
@@ -47,7 +47,7 @@ export declare function limitConfigError(code: string, message: string): Error &
47
47
  */
48
48
  export declare function resolveTaskLimits(limits: TaskLimits | undefined): TaskLimits | undefined;
49
49
  /**
50
- * RB-318 — validate the MODE-VALUED members of `TaskSpec.attachments` at the same door, and return the
50
+ * Validate the MODE-VALUED members of `TaskSpec.attachments` at the same door, and return the
51
51
  * config unchanged. Today that is exactly one member, `totalTokensReminderMode`.
52
52
  *
53
53
  * WHY A DOOR AT ALL (坏值响亮度律): a knob whose bad value silently folds to the default is a knob the
@@ -66,14 +66,14 @@ export declare function resolveTaskLimits(limits: TaskLimits | undefined): TaskL
66
66
  * folded into this lane's change.
67
67
  *
68
68
  * A NON-OBJECT CONTAINER (`attachments: null` off a wire, above all) is neither refused nor crashed on
69
- * (review finding, verified by reading): every consumer reads this config through `attachmentsCfg?.…`,
69
+ * (verified by reading): every consumer reads this config through `attachmentsCfg?.…`,
70
70
  * so a null container already means "no lanes are wired" and the spec RUNS today. An unguarded property
71
71
  * read here — the first cut — turned that running spec into an untyped `TypeError` from inside a door
72
72
  * that promises a typed `config.attachment_invalid`, and refusing it instead would newly reject a spec
73
73
  * that works. There is no container-shape door in this family yet; that is a separate widening, not
74
74
  * something this lane gets to invent on the way past.
75
75
  *
76
- * The bypass is narrowed to values that CANNOT supply attachment fields (round-2 review finding): a
76
+ * The bypass is narrowed to values that CANNOT supply attachment fields: a
77
77
  * plain-JS caller can hand this a FUNCTION carrying `totalTokensReminderMode` as a property, and every
78
78
  * downstream `attachmentsCfg?.…` read would happily find it — so skipping a function here would fold a
79
79
  * typo'd mode to the default through exactly the hole this door exists to close. Functions are
@@ -85,13 +85,13 @@ export declare function resolveAttachmentsConfig(attachments: TaskSpec["attachme
85
85
  * `fable_5_mitigations` capability / claude-mythos-5), ORTHOGONAL to the simple/classic profile.
86
86
  * sema is BYOM, so the id may carry provider prefixes ("anthropic/claude-fable-5",
87
87
  * "openrouter/anthropic/claude-fable-5"): BOUNDARY-AWARE family match on the last path segment
88
- * (统一复审 F3 — raw substring classified "vendor/not-claude-fable-5" and "claude-mythos-50"
88
+ * (raw substring classified "vendor/not-claude-fable-5" and "claude-mythos-50"
89
89
  * as fable), case-normalized. Recognition set = CC's _Nr (startsWith "claude-fable-") + b9e
90
90
  * (mythos-5). R3 system sections fork on the resulting fact.
91
91
  */
92
92
  export declare function isFableFamilyModelId(id: string): boolean;
93
93
  /**
94
- * RB-50 (CC 2.1.220 启示①, 2026-07-25): the SINGLE decision point for the two prompt-shape axes.
94
+ * The SINGLE decision point for the two prompt-shape axes.
95
95
  * Both were resolved in separate places with different mechanisms — `promptProfile` off a TaskSpec field,
96
96
  * `fableMitigations` off a raw model-id prefix test — so "which shape does this task speak" had no one
97
97
  * place to read. CC 2.1.220's counterpart is a model-registry `capabilities` array (one table drives
@@ -139,14 +139,14 @@ export interface PrepareConfigDoorsResult {
139
139
  * later face reads consult (own-task filter, defer classify, delegation ctx). Frozen-immutable ⇒
140
140
  * shared by reference into tool execution ctxs. */
141
141
  toolFaceSnapshot: ToolFaceSnapshot;
142
- /** owned — the profile half of the RB-50 single decision point (model-independent by contract). */
142
+ /** owned — the profile half of the single decision point (model-independent by contract). */
143
143
  promptProfile: "simple" | "classic";
144
144
  /** owned — the administrator lock snapshot; the rest of prepare reads guarded slots through it. */
145
145
  lockedPreflight: LockedPreflight;
146
146
  /** owned — the resolved interaction posture (spec > spawning run > deployment); the
147
147
  * AskUserQuestion mount and the child-ctx injection read this same value. */
148
148
  resolvedInteractionPosture: "interactive" | "headless" | undefined;
149
- /** owned — the validated/resolved microCompact knob (design/374; {@link resolveMicroCompactKnob}
149
+ /** owned — the validated/resolved microCompact knob ({@link resolveMicroCompactKnob}
150
150
  * for the door + placement reasoning). The per-run state builder consumes exactly these values —
151
151
  * the deps bag is never re-read after this door. */
152
152
  microCompactKnob: {
@@ -163,9 +163,9 @@ export interface PrepareConfigDoorsResult {
163
163
  /** owned — the compaction model: explicit wins, else the `summarize` role, else undefined (main
164
164
  * model fallback inside maybeCompact). NOT derivable from {@link resolvedRole}. */
165
165
  compModel: Model | undefined;
166
- /** owned — the mitigations half of the RB-50 decision point (model-family fact). */
166
+ /** owned — the mitigations half of the decision point (model-family fact). */
167
167
  fableMitigations: boolean;
168
- /** owned, frozen — design/277 model-gate DISCLOSURE data (the application itself already
168
+ /** owned, frozen — model-gate DISCLOSURE data (the application itself already
169
169
  * happened on {@link spec}: its `tools` is the survivor rebind when anything was removed).
170
170
  * prepareTask emits the notices from this after the doors return (the onNotice station);
171
171
  * the doors stay side-effect-free on the announcement axis. */
@@ -178,18 +178,18 @@ export interface PrepareConfigDoorsResult {
178
178
  * material; the in-force arm never lands here — it throws at the door). */
179
179
  discardedEnvRaw: string | undefined;
180
180
  };
181
- /** owned — the NORMALIZED per-leg delegation-evidence standard (design/324): the deps seat read
181
+ /** owned — the NORMALIZED per-leg delegation-evidence standard: the deps seat read
182
182
  * ONCE, in this synchronous pre-await stretch, screened, and absent folded to the "static-face"
183
183
  * default. The delegation wrap consumes THIS value, never the live deps object — a deps seat
184
184
  * mutated (or getter-backed) after the door must not present an unscreened value to the mark
185
- * branch (the #245 5.33 read-once posture). */
185
+ * branch (the read-once posture). */
186
186
  memoryDelegationEvidence: "static-face" | "attested-only";
187
- /** owned — the NORMALIZED memory-provenance mode (design/336 §13-3): the deps seat read ONCE in
188
- * the synchronous pre-await stretch, screened (#123), absent folded to the `"carry"` default.
187
+ /** owned — the NORMALIZED memory-provenance mode: the deps seat read ONCE in
188
+ * the synchronous pre-await stretch, screened, absent folded to the `"carry"` default.
189
189
  * The memory phase constructs every engine with THIS value — never a live deps re-read. */
190
190
  memoryProvenance: "off" | "carry";
191
- /** owned — the NORMALIZED memory-capture posture (design/383 §3.1): the deps seat read ONCE,
192
- * screened (#123 — a bad value refuses, never folds), absent folded to `"open"`. The capture
191
+ /** owned — the NORMALIZED memory-capture posture: the deps seat read ONCE,
192
+ * screened (a bad value refuses, never folds), absent folded to `"open"`. The capture
193
193
  * opt-out adjudicator consumes THIS value on every leg (declaration, resume record re-check,
194
194
  * and the flip verb's frozen closure) — never a live deps re-read. */
195
195
  memoryCapturePolicy: "open" | "governed" | "capture-required";
@@ -202,9 +202,9 @@ export interface PrepareConfigDoorsResult {
202
202
  * the resolver's off states). */
203
203
  brainCallGuardrailMs: number | undefined;
204
204
  }
205
- /** design/374 — the microCompact knob door (坏值响亮度默认律, the sibling knob doors' form:
206
- * interactionPosture / toolModelGate / staleToolResultOffload). Placement is load-bearing (review
207
- * r3): it runs in THIS pre-first-await config-doors phase so a malformed declaration refuses
205
+ /** The microCompact knob door (坏值响亮度默认律, the sibling knob doors' form:
206
+ * interactionPosture / toolModelGate / staleToolResultOffload). Placement is load-bearing:
207
+ * it runs in THIS pre-first-await config-doors phase so a malformed declaration refuses
208
208
  * BEFORE any resource-bearing preparation — session acquisition, execution-env creation, the MCP
209
209
  * dial — whose external effects a late refusal's teardown cannot undo. SINGLE READ per seat, and
210
210
  * the CONTAINER is judged first (reviews r1/r2): an accessor-backed bag answering a legal value at
@@ -1,15 +1,15 @@
1
1
  /**
2
- * design/390 §1.2 M21 — prepareTask's CONTEXT-LANE phase, verbatim from the driver: the edit/guard budgets, the
2
+ * PrepareTask's CONTEXT-LANE phase, verbatim from the driver: the edit/guard budgets, the
3
3
  * microCompact machine state with the trigger-window clamp's one loud outlet, the model's chars-per-token coordinate,
4
4
  * and the `context` handler registered on the harness — heal → ledger replay → aggregate tool-result and media caps →
5
5
  * frontier clear → the guard chain (arms A/B/C) → the git-frame guard → the orphan belt → the lossy-projection flag →
6
6
  * the projection seat. The four module-level helpers only this lane called moved with it (the machine-state builder,
7
7
  * the frontier-clear recorder, the observation-buffer flush, the guard chain with its two types). The interface is the
8
- * dependency list the segment had implicitly (design/238 R-1).
8
+ * dependency list the segment had implicitly.
9
9
  *
10
10
  * SYNCHRONOUS FUNCTION, SYNCHRONOUS CALL: the stretch has no await of its own (the handler it registers is async and
11
11
  * runs per provider request), so the phase adds no yield between the gate stations before it and the turn wiring after
12
- * it (design/390 §1.5). Read-stability of the host handles: {@link RunInternals} (`@contract prepare.deps-read-stable`).
12
+ * it. Read-stability of the host handles: {@link RunInternals} (`@contract prepare.deps-read-stable`).
13
13
  *
14
14
  * REGISTRATION SIDE EFFECT, OWNED: this phase registers the ONE `context` handler on the harness; the harness owns the
15
15
  * listener for the run's life (it is never unregistered — the harness is per prepare). No other station registers on
@@ -76,7 +76,7 @@ export declare function prepareContextLane(input: PrepareContextLaneInput): Prep
76
76
  export interface GuardChainArgs {
77
77
  /** The post-frontier view the chain starts from. */
78
78
  edited: AgentMessage[];
79
- /** The pre-cap counterpart view (arm A's clearSource — RB-212 durable composition seat). */
79
+ /** The pre-cap counterpart view (arm A's clearSource — durable composition seat). */
80
80
  replayed: AgentMessage[];
81
81
  index: OccurrenceIndex;
82
82
  microCompact: PreparedMicroCompact;
@@ -106,8 +106,8 @@ export type GuardChainOutcome = {
106
106
  trimDroppedMessages: boolean;
107
107
  };
108
108
  /**
109
- * design/374 slice 3 — the GUARD CHAIN over one request build (D-7 case-ii transfer table),
110
- * module-level per the design/238 body-span bank. design/123 D3: the chain reads the anchored
109
+ * The GUARD CHAIN over one request build (D-7 case-ii transfer table),
110
+ * the chain reads the anchored
111
111
  * coordinate re-estimated on the EDITED array (pre-anchor clears don't lower it — deliberately;
112
112
  * trimToBudget doc). The opt-out machine = the pre-374 backstop order byte-identical
113
113
  * (trim as the ordinary second line); otherwise arm A (blocking machine run, only when the
@@ -15,7 +15,7 @@ export interface PrepareDeferClassifyInput {
15
15
  * shallow copy for the classic-profile description swap (the caller's ToolSpec object is never
16
16
  * mutated); `splice` of a retracted memory group. After this phase: the content-origin wrap
17
17
  * (element replacement with the wrapped object), the disclosure mount, the MCP refresh re-splice. Since
18
- * design/388 every one of those writes is a builder verb (`unmountWhere` / `replaceAt`). */
18
+ * Every one of those writes is a builder verb (`unmountWhere` / `replaceAt`). */
19
19
  roster: RosterBuilder;
20
20
  /** borrowed-readonly — the frozen task-start tool face: `exclude` (the valve), `defer` (operator
21
21
  * defers, exact wire names), `alwaysLoad` (the inline pins). */
@@ -24,7 +24,7 @@ export interface PrepareDeferClassifyInput {
24
24
  * where a shell could be on the roster). */
25
25
  handsEnabled: boolean;
26
26
  /** borrowed-readonly — the spec-time precomputation the invariant checks the post-exclusion roster
27
- * against (design/199 D-6): a mismatch is an engine bug, thrown. */
27
+ * against: a mismatch is an engine bug, thrown. */
28
28
  fullShellReachable: boolean;
29
29
  /** borrowed-readonly — the resolved prompt profile (`classic` swaps in `descriptionClassic`). */
30
30
  promptProfile: "simple" | "classic";
@@ -74,7 +74,7 @@ export interface PrepareDelegationSurfaceInput {
74
74
  * the SendMessage / AgentTranscript mounts activate their ctx-first arms with it. */
75
75
  enrichSpecToolCtx: (ctx: ToolExecuteContext) => ToolExecuteContext;
76
76
  /** borrowed-mutable — the hands mount's tracked-cwd seat: present ⇔ real shell + write hands; the worktree pair's mount
77
- * predicate. Not written by this phase, but the tools it mounts over it ARE its writers (design/238 R-3): EnterWorktree and
77
+ * predicate. Not written by this phase, but the tools it mounts over it ARE its writers: EnterWorktree and
78
78
  * ExitWorktree assign `current` at run time (the hands band's shared cwd then points at the worktree, and back); the
79
79
  * Monitor only reads it. The cell must stay the hands mount's own object — a copy would strand those writes. */
80
80
  handsCwdRef: CwdRef | undefined;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * design/390 §1.2 M2 — prepareTask's file-history phase, verbatim from the driver: the DV-14 first-touch
2
+ * PrepareTask's file-history phase, verbatim from the driver: the DV-14 first-touch
3
3
  * policy door, the `RunnerDeps.fileHistoryStore` bad-value door, the retired `rewindFiles` two-sense
4
4
  * split, the restoreFiles / resumeAt / rewindFilesTo combination gates, the run's history coordinates
5
5
  * (canonical root, recording scope, filesystem identity), the fork carry, the child-scope refusal, the
@@ -84,7 +84,7 @@ export declare function resolveFileHistoryScope(lineage: RunInternals["fileHisto
84
84
  * · a remote workspace names itself through its {@link WorkspaceHandle} (provider + sandbox, and the
85
85
  * device lane's id when stamped) — two runs on one sandbox share a tree, two sandboxes never do;
86
86
  * · an env that DECLARES its paths host-local (`hostLocalPaths: true`), or is the host adapter itself
87
- * (a {@link NodeExecutionEnv}, which the #211 seam names as the host-local default), is the
87
+ * (a {@link NodeExecutionEnv}, which the seam names as the host-local default), is the
88
88
  * control-plane host's filesystem — every such env is one tree;
89
89
  * · anything else — an env declaring `hostLocalPaths: false`, or an undeclared custom adapter — is
90
90
  * attested to nothing, so it is its OWN tree: a per-instance token, which still matches when the
@@ -1,18 +1,18 @@
1
1
  /**
2
- * design/390 §1.2 M20 — prepareTask's two GATE STATIONS, verbatim from the driver: the `tool_call` station (the final-roster
2
+ * PrepareTask's two GATE STATIONS, verbatim from the driver: the `tool_call` station (the final-roster
3
3
  * effect sync, the write-protection judge compiled once per task, the arming predicate, the compliance and plan-mode
4
4
  * short-circuits, the `runToolGate` call with every seat it is handed, the lifecycle sweep, the deferred sandbox-admission
5
5
  * disclosure, the PreToolUse context stash, the settlement sideband write and the bare-human-rejection boundary) and the
6
6
  * `tool_result` station (the PostToolUse / PostToolUseFailure seats and the PreToolUse context drain). The two module-scope
7
7
  * helpers only these stations called moved with them (the settlement screen, the rejection-boundary judgment). The
8
- * interface is the dependency list the stations had implicitly (design/238 R-1).
8
+ * interface is the dependency list the stations had implicitly.
9
9
  *
10
10
  * The stations REGISTER handlers on the harness (the side effect this phase exists for) and report only two observation
11
11
  * seats back; the order they register in — after the file-history boundary lease the driver registers, and in this order
12
12
  * (call before result) — is the order handlers run in.
13
13
  *
14
14
  * SYNCHRONOUS FUNCTION, SYNCHRONOUS CALL: the stretch has no await of its own (the handlers run per tool call / per tool
15
- * result), so the phase adds no yield between the park closure before it and the context lane after it (design/390 §1.5).
15
+ * result), so the phase adds no yield between the park closure before it and the context lane after it.
16
16
  * Read-stability of the host handles for the call: {@link RunInternals} (`@contract prepare.deps-read-stable`).
17
17
  *
18
18
  * The `tool_call` station is built exactly when the ask lane and the park closure are (the same predicate as the whole
@@ -43,14 +43,14 @@ export interface PrepareGateStationsInput {
43
43
  /** borrowed-readonly — the FINAL mount roster: iterated once for the effect sync and the write-protection arming. Never
44
44
  * mutated here. */
45
45
  tools: readonly AgentTool[];
46
- /** borrowed-readonly — the leg's delta seat (design/388): its current roster is the face source for every gated call. */
46
+ /** borrowed-readonly — the leg's delta seat: its current roster is the face source for every gated call. */
47
47
  toolRosterDeltas: ToolRosterDeltaSeat;
48
48
  /** borrowed-mutable — the effect collection. Writer here: the final-roster sync fills MISSING entries from each
49
49
  * first-party tool's declared effect (never overrides a scanned one); the plan-mode deny reads it per call. */
50
50
  toolEffects: Map<string, ToolEffect>;
51
51
  /** borrowed-readonly — the deployment seats these stations read, as a Pick over the SAME `deps` object (receiver
52
52
  * preserved for `deps.onError?.()`): the write-protection table and its data root, the tracer, the error face, and
53
- * the notice sink (#648: the gate's unresolvable-ask exit delivers `delegation.ask_unresolvable` through it). */
53
+ * the notice sink (the gate's unresolvable-ask exit delivers `delegation.ask_unresolvable` through it). */
54
54
  deps: Pick<RunnerDeps, "writeProtectedPaths" | "memoryEngineDir" | "tracer" | "onError" | "onNotice">;
55
55
  /** borrowed-mutable — the protocol-tools phase's arming belt. Writer here: `armed` ← the registration predicate, the
56
56
  * one write; the refresh seam reads it. */
@@ -11,10 +11,10 @@ import { RosterBuilder } from "../tool-roster.js";
11
11
  * Deliberately asymmetric — it resets only the console latch: the WeakSet arm needs no seam
12
12
  * because a test resets it by minting a fresh sink function (identity IS the ledger key), while
13
13
  * the console arm's key is the process itself, which only this seam can refresh. Moved WITH the
14
- * phase (design/238 B-5); prepare-task.ts keeps a re-export so the existing import sites stand. */
14
+ * phase; prepare-task.ts keeps a re-export so the existing import sites stand. */
15
15
  export declare function __resetReadFaceClampAnnouncement(): void;
16
16
  /**
17
- * #483 rung-1 — the Runner's per-session read-file-state seats (CC parity: readFileState is minted
17
+ * The Runner's per-session read-file-state seats (CC parity: readFileState is minted
18
18
  * once per REPL session and mutated across turns; it has NO turn-boundary and NO abort clear site —
19
19
  * its only clears are compaction/fork/subagent-cleanup/dispose). sema's map stays per-task (the §11
20
20
  * ruling-A closure wiring), so the SESSION scope lives here instead: prepare adopts each task's live
@@ -30,17 +30,17 @@ export declare function __resetReadFaceClampAnnouncement(): void;
30
30
  * Bounded: an LRU over sessionIds (insertion-order refresh on read), because the SessionStore's own
31
31
  * eviction is not observable from here — a dropped seat costs one transcript replay, nothing else.
32
32
  * The stored value is the task's LIVE map (object identity), so in-turn mutations — tool write-backs,
33
- * and above all the RB-197 compaction clear — are the seat's truth by construction; a snapshot copy
33
+ * and above all the compaction clear — are the seat's truth by construction; a snapshot copy
34
34
  * here would resurrect summarized-away reads on the next turn.
35
35
  *
36
- * BRANCH BINDING (codex r1+r2, adopted): a sessionId alone does not name a transcript — the same id
36
+ * BRANCH BINDING: a sessionId alone does not name a transcript — the same id
37
37
  * can be rebranched (`resumeAt`), rewound out-of-band, or DELETED and re-created (`release()` + the
38
38
  * default create-on-miss acquire), and the seat's map would then vouch for reads the CURRENT branch
39
39
  * never saw. Each seat therefore records `anchorLeafId` — a leaf on the lineage its task produced —
40
40
  * and inheritance must first prove the CURRENT branch still descends from that anchor
41
41
  * (see {@link sessionSeatAnchorHolds}). The anchor is written twice: at ADOPT (the leaf at prepare;
42
42
  * `null` when the branch was still empty) and SEALED at the task's settle to the task's own tail
43
- * (`reanchor`). A `null` anchor is NEVER inheritable (codex r2: "the branch is non-empty now" proves
43
+ * (`reanchor`). A `null` anchor is NEVER inheritable ("the branch is non-empty now" proves
44
44
  * nothing about WHOSE messages those are — another Runner repopulating a released id, or a session
45
45
  * import, makes a non-empty branch that never contained this seat's reads). An unprovable anchor
46
46
  * falls back to the transcript replay, which reads the current branch by construction — cost, never
@@ -59,14 +59,14 @@ export declare class SessionReadFileStates {
59
59
  * `anchorLeafId` = the session's leaf as read at THIS prepare (null = the branch was empty; a
60
60
  * null-anchored seat is not inheritable until the settle-time {@link reanchor} names a real leaf). */
61
61
  adopt(sessionId: string, state: ReadFileState, anchorLeafId: string | null): void;
62
- /** #483 codex r2 — the settle-time SEAL: re-anchor the seat to the finished task's own tail, so a
62
+ /** The settle-time SEAL: re-anchor the seat to the finished task's own tail, so a
63
63
  * first-task (null-anchor) seat becomes inheritable only through a leaf its task provably wrote.
64
64
  * Identity-guarded: touches the row only while it still holds THIS task's map (a later prepare on
65
65
  * the same session has already replaced the seat and owns its own anchor). */
66
66
  reanchor(sessionId: string, state: ReadFileState, anchorLeafId: string): void;
67
67
  }
68
68
  /**
69
- * #483 (codex r1+r2) — does the session's CURRENT branch still descend from the seat's anchor?
69
+ * Does the session's CURRENT branch still descend from the seat's anchor?
70
70
  * TRUE is the licence to inherit; anything unprovable answers FALSE (the caller then replays the
71
71
  * transcript — the fail-closed direction costs a rebuild, never admits a wrong entry).
72
72
  *
@@ -82,17 +82,17 @@ export declare class SessionReadFileStates {
82
82
  * - a COMPACTION on the walked segment (A-082 idx2): refuses, even though the branch is perfectly
83
83
  * intact. The walked segment is exactly what landed AFTER this seat was anchored, and a
84
84
  * compaction there summarized older Read results OUT of the context the model will be shown —
85
- * the very state RB-197 clears from the live map at the landing site. That clear reaches the seat
85
+ * the very state the compaction clear removes from the live map at the landing site. That clear reaches the seat
86
86
  * only when the SAME Runner did both (the seat IS that map, by object identity); a second Runner
87
87
  * on the shared durable session clears its own map and commits the compaction as an ORDINARY
88
88
  * LINEAR APPEND, which every other test here passes. Inheriting across it would let requireRead
89
89
  * and checkStale both pass on a read whose card the model no longer has — a blind edit from a
90
- * summarized-away recollection, the exact failure the RB-197 clear exists to prevent. Refusing
90
+ * summarized-away recollection, the exact failure the compaction clear exists to prevent. Refusing
91
91
  * costs one transcript replay, and the replay reads the POST-compaction branch by construction,
92
92
  * so the fail-closed direction is also the CORRECT state. A compaction at or ABOVE the anchor is
93
93
  * not on the walked segment and does not refuse: the seat that observed it already carries its
94
94
  * clear (P-483-4), and an ordinary foreign turn with no compaction still inherits (G-483-5) —
95
- * dropping every seat a foreign Runner touched would restore the cross-turn amnesia #483 ended.
95
+ * dropping every seat a foreign Runner touched would restore the cross-turn read-state amnesia this seat-anchor check already ended.
96
96
  */
97
97
  export declare function sessionSeatAnchorHolds(getEntry: (id: string) => Promise<{
98
98
  parentId: string | null;
@@ -118,8 +118,8 @@ export interface PrepareHandsReadFaceInput {
118
118
  * resume; the workspace_state rung is skipped; the face fold goes stricter-wins). */
119
119
  resume: Pick<PrepareResume, "seed"> | undefined;
120
120
  /** borrowed-readonly — the acquired session (B-3 output), as a Pick (相 API 规则件 R-4: receiver
121
- * preserved): `getWorkspaceState` feeds the design/155 continuation rung; `buildContext` feeds
122
- * the transcript replay; `getStorage`/`getEntry` feed the #483 seat-anchor verification (one
121
+ * preserved): `getWorkspaceState` feeds the continuation rung; `buildContext` feeds
122
+ * the transcript replay; `getStorage`/`getEntry` feed the seat-anchor verification (one
123
123
  * leaf read per prepare + a bounded parent walk on the inherit leg only). */
124
124
  session: Pick<StoredSession, "getWorkspaceState" | "buildContext" | "getStorage" | "getEntry">;
125
125
  /** borrowed-readonly — the acquired session's id, for error/notice tags and the band's session
@@ -138,7 +138,7 @@ export interface PrepareHandsReadFaceInput {
138
138
  * (computed in the driver's inherited-gate block); the shellGate fold's doctrine value. */
139
139
  effectiveShellGate: ShellGateDoctrine;
140
140
  /** borrowed-readonly — B-1's frozen task-start face snapshot; only `.exclude` is read here (the
141
- * Monitor-mount honesty bit for the gh rate-limit hint, #181-F6). */
141
+ * Monitor-mount honesty bit for the gh rate-limit hint). */
142
142
  toolFaceSnapshot: ToolFaceSnapshot;
143
143
  /** borrowed-readonly — B-1's resolved main model; read ONLY for its pdf capability profile
144
144
  * (the Read tool's document-degradation fork). */
@@ -149,39 +149,39 @@ export interface PrepareHandsReadFaceInput {
149
149
  /** borrowed-readonly — the deployment seats this phase reads, as a Pick over the SAME deps
150
150
  * object (R-4: `deps.onError?.()` keeps its receiver; a new deps read must widen this Pick).
151
151
  * `readDenyBuiltinTiers`/`readDenyBuiltinExclude` are SNAPSHOTTED before the first await that
152
- * precedes the toolkit compile (#245/#244 — the caller retains these arrays by reference). */
152
+ * precedes the toolkit compile (the caller retains these arrays by reference). */
153
153
  deps: Pick<RunnerDeps, "onError" | "onNotice" | "tracer" | "readDenyPatterns" | "readDenyBuiltinTiers" | "readDenyBuiltinExclude" | "readFace" | "permissionRuleStore" | "hands">;
154
154
  /** borrowed-readonly — the trusted spawn-side seats the band forwards: the finished-command
155
- * notification lane, the mid-flight detach hub, and (#483 rung-1) the Runner's per-session
155
+ * notification lane, the mid-flight detach hub, and the Runner's per-session
156
156
  * read-state seats (absent on a standalone prepare ⇒ the transcript-replay rung covers alone). */
157
157
  internals: Pick<RunInternals, "onTaskNotification" | "detachHub" | "sessionReadStates"> | undefined;
158
- /** borrowed-readonly (A-082 idx7) — ABSOLUTE paths this prepare's design/381 restore wrote, deleted,
158
+ /** borrowed-readonly — ABSOLUTE paths this prepare's restore wrote, deleted,
159
159
  * or failed to write. Every read-state seed above describes the PRE-restore tree, so these keys are
160
160
  * dropped from the map: the engine replaced those bytes itself, and a surviving entry makes the
161
161
  * next refusal blame "the user or a linter" for the engine's own write. Absent (the common case)
162
162
  * when no file restore ran. Fail-closed by construction — dropping a read record only ever
163
163
  * produces refusals. */
164
164
  restoredFilePaths?: readonly string[];
165
- /** borrowed-readonly — (ref cell; the REF itself is never replaced) design/138 S2-C memory write gate:
165
+ /** borrowed-readonly — (ref cell; the REF itself is never replaced) memory write gate:
166
166
  * the band's beforeWrite closure reads `.current` call-time; prepareMemory (driver, BEFORE this phase
167
- * since #691 — the memory root must be known before the toolkit compiles) installs the gate — the one
167
+ * since the memory root must be known before the toolkit compiles) installs the gate — the one
168
168
  * writer; this phase only reads. Declared in the driver because the SAME ref feeds prepareMemory. */
169
169
  memoryWriteGateRef: {
170
170
  current?: BeforeWriteHook;
171
171
  };
172
- /** borrowed-mutable — #691: the advertised-writable-directory seat (see its module header for the one
172
+ /** borrowed-mutable — the advertised-writable-directory seat (see its module header for the one
173
173
  * rule). Present on the hands leg only (a fence exists). The memory phase, which runs BEFORE this one,
174
174
  * has already admitted its write root through it; this phase admits the deployment's scratchpad and
175
175
  * folds `roots` into the write-capable containment allowlist before the toolkit compiles. */
176
176
  advertisedWritableDirs?: AdvertisedWritableDirs;
177
- /** borrowed-readonly — the driver's per-tool offload wrapper (design/158 posture + policy); the
177
+ /** borrowed-readonly — the driver's per-tool offload wrapper (posture + policy); the
178
178
  * band rides through it exactly as caller/MCP tools do. */
179
179
  firstPartyOffload: (tool: AgentTool) => AgentTool;
180
180
  /** borrowed-mutable — the SHARED mount array (§4.4: later refs alias it; identity is the
181
181
  * contract, never map/copy). This phase pushes the hands band IN PLACE (after caller tools /
182
182
  * built-ins / MCP / A2A, before the background-task mounts — T22 order). Mutation owners after
183
183
  * this phase: P11 background/Monitor/worktree pushes, the driver's excludeTools splice, the
184
- * refresh seam's runtime splice/push. Since design/388 the array is builder-private: this phase `mountAll`s the band. */
184
+ * refresh seam's runtime splice/push. The array is builder-private: this phase `mountAll`s the band. */
185
185
  roster: RosterBuilder;
186
186
  /** borrowed-readonly HERE (census divergence #5 vs the design row): this phase only reads
187
187
  * `.has("Bash")`/`.has("Monitor")` for the provenance bits — its mutation owners are B-2/P8/P9
@@ -197,16 +197,16 @@ export interface PrepareHandsReadFaceInput {
197
197
  /** borrowed-mutable — the classify doctrine's probe installs (`.set`, only where the doctrine
198
198
  * owns the seat). Same-object contract as above. */
199
199
  reversibilityProbes: ReversibilityProbes;
200
- /** borrowed-readonly — design/319 (A ticket): the run's reminder provenance mark (minted/adopted
200
+ /** borrowed-readonly — the run's reminder provenance mark (minted/adopted
201
201
  * by the driver's adoption ladder); threaded into the hands band so the fs-side engine mints
202
202
  * (the Read cyber/dedup/offset/empty reminders, the gh rate-limit hint) stamp the same mark the
203
203
  * system-prompt declaration names. */
204
204
  reminderMark: string;
205
- /** borrowed-mutable — design/319 (B ticket): the leg's disclosure trigger counters; the hands
205
+ /** borrowed-mutable — the leg's disclosure trigger counters; the hands
206
206
  * band's Read/notebook/PDF trailer outlets bump keys on it at tool-execute time (the driver owns
207
207
  * the object and folds it into result stats). */
208
208
  reminderDisclosureCounts: import("../reminder-disclosure.js").ReminderDisclosureCounts;
209
- /** borrowed-readonly — design/381: the first-touch history hook prepare built (present iff a fileHistoryStore is
209
+ /** borrowed-readonly — the first-touch history hook prepare built (present iff a fileHistoryStore is
210
210
  * wired and the run mounts a real fs env); threaded to the write band's trackFileEdit seat. */
211
211
  trackFileEdit?: import("../types.js").TrackFileEditHook;
212
212
  /** borrowed-readonly — the mutation lane's LANDED observation seat (the accumulator behind
@@ -233,11 +233,11 @@ export interface PrepareHandsReadFaceResult {
233
233
  path: string;
234
234
  content: string;
235
235
  }>) => Promise<void>) | undefined;
236
- /** owned — design/99 §E13: the per-task logical cwd ref (observable `cd`), minted when a real
236
+ /** owned — the per-task logical cwd ref (observable `cd`), minted when a real
237
237
  * writable shell mounts. The driver stamps it into checkpoints, threads it into worktree tools
238
238
  * and gate cwd reads; tools mutate `.current` at run time. Undefined when no shell / readOnly. */
239
239
  handsCwdRef: CwdRef | undefined;
240
- /** owned — design/155: the settle-side snapshot base (what the cwd/worktree refs were RESTORED
240
+ /** owned — the settle-side snapshot base (what the cwd/worktree refs were RESTORED
241
241
  * to), so runtask's settle write diffs against it. The driver's G4 worktree mount writes
242
242
  * `.restoredWorktreeDir` after this phase — object identity carried. */
243
243
  workspaceStateSettle: {
@@ -246,7 +246,7 @@ export interface PrepareHandsReadFaceResult {
246
246
  restoredWorktreeDir?: string;
247
247
  baselineUnknown?: boolean;
248
248
  } | undefined;
249
- /** owned — design/155: the branch-nearest `workspace_state` entry, fetched ONCE here and shared
249
+ /** owned — the branch-nearest `workspace_state` entry, fetched ONCE here and shared
250
250
  * with the driver's worktree seed (the G4 mount reads `.activeWorktree` through it). */
251
251
  wsSnapshot: WorkspaceState | undefined;
252
252
  /** owned — the wsSnapshot path rebaser (identity when no snapshot / same root); the G4 worktree
@@ -266,7 +266,7 @@ export interface PrepareHandsReadFaceResult {
266
266
  pattern: string;
267
267
  caseSensitive: boolean;
268
268
  }>;
269
- /** write-back (D-3 hold) — the hands-LESS legs' resolved face (#242: the read posture is a
269
+ /** write-back (D-3 hold) — the hands-LESS legs' resolved face (the read posture is a
270
270
  * property of the RUN, not the mount). Driver assigns onto its outer `let`. */
271
271
  handsLessResolvedFace: ReadFace | undefined;
272
272
  /** owned — the canonicalized write-capable extra roots (additionalDirectories + the advertised
@@ -276,10 +276,10 @@ export interface PrepareHandsReadFaceResult {
276
276
  /** owned — the read-only arm of the fence widening (2026-08-05 both-arms ruling); same identity
277
277
  * contract as above. */
278
278
  additionalReadRootsCanonical: string[];
279
- /** owned — RB-159: the canonical containment root, published so the working-file ATTACHMENT
279
+ /** owned — the canonical containment root, published so the working-file ATTACHMENT
280
280
  * reader applies the same containment the hands tools do. Undefined ⇔ hands-less. */
281
281
  attachmentRootCanonical: string | undefined;
282
- /** owned — design/199 件B: the ONE compiled deny judge per prepare (built-ins ∪ deployment ∪
282
+ /** owned — the ONE compiled deny judge per prepare (built-ins ∪ deployment ∪
283
283
  * task additions). Undefined ⇔ hands-less (its consumers only exist with hands). */
284
284
  readDenyMatcher: ReadDenyMatcher | undefined;
285
285
  /** owned — the shell-seat PROVENANCE set: the shell-running tools whose tier the engine's shell seat (read
@@ -288,7 +288,7 @@ export interface PrepareHandsReadFaceResult {
288
288
  * boundary): `shellGatedTools.has(toolName)`. Minted here, never grown afterwards; empty when the seat fold
289
289
  * did not run (no real writable shell). */
290
290
  shellGatedTools: ReadonlySet<string>;
291
- /** owned (design/380 rescan C4) — the ENV-HAND tool names, minted AT THE MOUNT: every tool this
291
+ /** owned — the ENV-HAND tool names, minted AT THE MOUNT: every tool this
292
292
  * phase mounted over the ExecutionEnv (the fs/bash band), later grown by the driver's own env
293
293
  * mounts (Monitor, the worktree pair — the SAME Set identity, mutated at those mount sites).
294
294
  * Consumed by the O9a external-content-target fold: these are the tools whose RESULTS are the
@@ -297,12 +297,12 @@ export interface PrepareHandsReadFaceResult {
297
297
  * misses Monitor/worktree, which are hands — both directions wrong for this consumer). Empty on
298
298
  * a hands-less leg (nothing mounts on the env; the driver's env mounts are hands-gated too). */
299
299
  envHandToolNames: Set<string>;
300
- /** owned (#483 codex r2+r3) — the settle-time SEAT SEAL: re-anchors the session seat to the
300
+ /** owned — the settle-time SEAT SEAL: re-anchors the session seat to the
301
301
  * task's OWN last-committed entry (see {@link SessionReadFileStates.reanchor}). The driver calls
302
302
  * it once at the run's settle (every terminal, suspend included), under the session lock, passing
303
303
  * the last entryId ITS OWN run committed (the message_committed lane) — never a re-read of the
304
304
  * shared session leaf, which a concurrent writer on another Runner could have moved onto a branch
305
- * this task's reads were never on (codex r3). No commits observed ⇒ no-op (the adopt-time anchor
305
+ * this task's reads were never on. No commits observed ⇒ no-op (the adopt-time anchor
306
306
  * stands). Synchronous, never throws. Undefined ⇔ hands-less / no seat channel. */
307
307
  sealReadStateSeat: ((ownCommittedTailEntryId: string | undefined) => void) | undefined;
308
308
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * design/390 §1.2 M3b — prepareTask's INHERITED-GATE phase, verbatim from the driver: the live/seed fold of the
2
+ * PrepareTask's INHERITED-GATE phase, verbatim from the driver: the live/seed fold of the
3
3
  * chain this run inherits (ancestor rules rev-monotonic per (session, principal), shellGate by max rank, the
4
4
  * re-supplied parent constraints with their rebuilt denial trackers, the auto-mode intent, the org-admission
5
5
  * freeze with its tighten-only intersection and the monotonic governed bit), the effective shellGate against the
@@ -8,11 +8,11 @@
8
8
  * FROZEN ask and question seats (spec over deps), the two delegation refs the memory phase binds late, the ONE
9
9
  * child-chain assembly `inheritedGateForChildren`, the caller-tool ctx enrichment `enrichSpecToolCtx` shared by
10
10
  * the roster wrap and the revival spawner, the denial-limit stop seat, and the full-shell reachability predicate.
11
- * The interface is the dependency list the segment had implicitly (design/238 R-1).
11
+ * The interface is the dependency list the segment had implicitly.
12
12
  *
13
13
  * SYNCHRONOUS FUNCTION, SYNCHRONOUS CALL: the stretch has no await (the one `await` in it sits inside the
14
14
  * `hostSessionFork` closure a tool calls later), so the phase adds no yield between the run-refs phase before it
15
- * and the caps phase after it (design/390 §1.5: a stretch with no await is extracted as a sync function).
15
+ * and the caps phase after it (a stretch with no await is extracted as a sync function).
16
16
  *
17
17
  * LATE-BOUND SEATS. The closures minted here run long after this phase returns — at spawn time, at tool-call
18
18
  * time, at suspend time — and several of the facts they read are resolved by LATER stations of the same prepare:
@@ -25,7 +25,7 @@
25
25
  * sat behind a short-circuit). Read-stability of the host handles for the call: {@link RunInternals}
26
26
  * (`@contract prepare.deps-read-stable`).
27
27
  *
28
- * Every cell that leaves here as `borrowed-mutable` carries its writer table on the Result member (design/238 R-3).
28
+ * Every cell that leaves here as `borrowed-mutable` carries its writer table on the Result member.
29
29
  */
30
30
  import type { AgentHarness, ExecutionEnv } from "../../internal/harness.js";
31
31
  import type { SubagentWorktreeIsolation } from "../../agents/subagent.js";
@@ -1,13 +1,13 @@
1
1
  /**
2
- * design/390 M15 — prepareTask's LISTINGS phase: the per-task agent definitions' tool-name audit
2
+ * PrepareTask's LISTINGS phase: the per-task agent definitions' tool-name audit
3
3
  * (deny entries fail loud, allow entries advise), the agent-listing announce face read off the
4
4
  * delegation tool's roster (with its deferred / excluded / removal-to-zero arms), the two listing
5
5
  * opt-out advisories, the announced-listings mirror seeded from the once-per-session ledger, the
6
6
  * deferred roster's ToolSearch ride, and the date_change seam. The body is the driver's stretch moved
7
- * verbatim; the interface is the dependency list it had implicitly (design/238 R-1).
7
+ * verbatim; the interface is the dependency list it had implicitly.
8
8
  *
9
9
  * SYNCHRONOUS FUNCTION, SYNCHRONOUS CALL: the stretch has no await, so the phase adds no yield between
10
- * the disclosure mount before it and the context-lane seats after it (design/390 §1.5 S1: a stretch
10
+ * the disclosure mount before it and the context-lane seats after it (a stretch
11
11
  * with no await is extracted as a sync function — an `async` wrapper would open a microtask window).
12
12
  *
13
13
  * Throws pass through unchanged: `config.agent.unknown_tool` (a deny entry naming a tool this