@sema-agent/core 7.14.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.
- package/CHANGELOG.md +59 -0
- package/dist/core/ask-origin.d.ts +2 -2
- package/dist/core/checkpoint-store.d.ts +14 -15
- package/dist/core/governance-codes.js +2 -0
- package/dist/core/hooks.d.ts +4 -3
- package/dist/core/memory-engine/delegation-settlement.d.ts +37 -12
- package/dist/core/memory-engine/delegation-settlement.js +128 -39
- package/dist/core/memory-engine/engine.d.ts +9 -8
- package/dist/core/memory-engine/engine.js +115 -120
- package/dist/core/memory-engine/file-backend.d.ts +17 -5
- package/dist/core/memory-engine/file-backend.js +78 -34
- package/dist/core/memory-engine/index.d.ts +2 -2
- package/dist/core/memory-engine/index.js +2 -2
- package/dist/core/memory-engine/layout.d.ts +152 -54
- package/dist/core/memory-engine/layout.js +441 -104
- package/dist/core/memory-engine/types.d.ts +8 -3
- package/dist/core/memory-engine/types.js +5 -0
- package/dist/core/runner/abort-race.d.ts +3 -3
- package/dist/core/runner/active-skill-scope.d.ts +2 -2
- package/dist/core/runner/assemble-result.d.ts +29 -29
- package/dist/core/runner/checkpoint-scope.d.ts +4 -4
- package/dist/core/runner/clock-and-limits.d.ts +3 -3
- package/dist/core/runner/compaction-call-options.d.ts +11 -11
- package/dist/core/runner/compaction-knobs.d.ts +4 -4
- package/dist/core/runner/compaction-seams.d.ts +5 -5
- package/dist/core/runner/contracts.d.ts +224 -226
- package/dist/core/runner/decide-continuation.d.ts +6 -6
- package/dist/core/runner/denial-limit-arms.d.ts +8 -8
- package/dist/core/runner/derived-route-fallback.d.ts +2 -2
- package/dist/core/runner/gate-exit.d.ts +6 -6
- package/dist/core/runner/git-status-frame.d.ts +7 -7
- package/dist/core/runner/inherited-ask-grants.d.ts +6 -6
- package/dist/core/runner/memory-capture-optout.d.ts +1 -1
- package/dist/core/runner/memory-consolidation-driver.d.ts +4 -4
- package/dist/core/runner/memory-consolidation.d.ts +6 -6
- package/dist/core/runner/park-commit.d.ts +6 -6
- package/dist/core/runner/permission-rule-lanes.d.ts +22 -20
- package/dist/core/runner/permission-rule-lanes.js +1 -1
- package/dist/core/runner/prepare-acquire-reconcile.d.ts +4 -4
- package/dist/core/runner/prepare-ask-lane.d.ts +3 -3
- package/dist/core/runner/prepare-boundary-parks.d.ts +3 -3
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +5 -5
- package/dist/core/runner/prepare-config-doors.d.ts +21 -21
- package/dist/core/runner/prepare-context-lane.d.ts +6 -6
- package/dist/core/runner/prepare-defer-classify.d.ts +3 -3
- package/dist/core/runner/prepare-defer-classify.js +12 -10
- package/dist/core/runner/prepare-delegation-surface.d.ts +1 -1
- package/dist/core/runner/prepare-file-history.d.ts +2 -2
- package/dist/core/runner/prepare-gate-stations.d.ts +8 -9
- package/dist/core/runner/prepare-gate-stations.js +2 -2
- package/dist/core/runner/prepare-hands-readface.d.ts +41 -41
- package/dist/core/runner/prepare-hands-readface.js +27 -29
- package/dist/core/runner/prepare-inherited-gate.d.ts +6 -6
- package/dist/core/runner/prepare-listings.d.ts +3 -3
- package/dist/core/runner/prepare-lsp.d.ts +3 -3
- package/dist/core/runner/prepare-memory-engine-session.d.ts +5 -5
- package/dist/core/runner/prepare-memory.js +6 -7
- package/dist/core/runner/prepare-offload-wrappers.d.ts +2 -2
- package/dist/core/runner/prepare-park-ask.d.ts +11 -12
- package/dist/core/runner/prepare-park-ask.js +3 -3
- package/dist/core/runner/prepare-policy-chain.d.ts +6 -6
- package/dist/core/runner/prepare-policy-chain.js +2 -2
- package/dist/core/runner/prepare-prompt-inputs.d.ts +5 -5
- package/dist/core/runner/prepare-protocol-tools.d.ts +1 -1
- package/dist/core/runner/prepare-question-face.d.ts +4 -4
- package/dist/core/runner/prepare-run-refs.d.ts +11 -11
- package/dist/core/runner/prepare-safety-scan.d.ts +1 -1
- package/dist/core/runner/prepare-suspend-saga.d.ts +4 -4
- package/dist/core/runner/prepare-task.d.ts +12 -12
- package/dist/core/runner/prepare-task.js +5 -7
- package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +2 -3
- package/dist/core/runner/prepare-wiring-manifest.d.ts +4 -4
- package/dist/core/runner/prepare-workspace-restore.d.ts +1 -1
- package/dist/core/runner/remote-env-retry.d.ts +3 -3
- package/dist/core/runner/resume-admission.d.ts +1 -1
- package/dist/core/runner/resume-claim.d.ts +1 -1
- package/dist/core/runner/resume-internals-and-config.d.ts +1 -1
- package/dist/core/runner/resume-policy-outcome.d.ts +1 -1
- package/dist/core/runner/resume-preflight.d.ts +1 -1
- package/dist/core/runner/resume-review-outcome.d.ts +1 -1
- package/dist/core/runner/run-brain-sinks.d.ts +1 -1
- package/dist/core/runner/run-clock-and-content.d.ts +4 -4
- package/dist/core/runner/run-compaction-machinery.d.ts +3 -3
- package/dist/core/runner/run-git-lane.d.ts +1 -1
- package/dist/core/runner/run-harness-handlers.d.ts +2 -2
- package/dist/core/runner/run-identity-wiring.d.ts +4 -4
- package/dist/core/runner/run-leg.d.ts +3 -3
- package/dist/core/runner/run-notification-lane.d.ts +2 -2
- package/dist/core/runner/run-reasoning-seat.d.ts +2 -2
- package/dist/core/runner/run-settle-and-teardown.d.ts +4 -4
- package/dist/core/runner/run-telemetry-and-budget-seats.d.ts +2 -2
- package/dist/core/runner/run-terminal-adoption.d.ts +5 -5
- package/dist/core/runner/runtask.d.ts +14 -14
- package/dist/core/runner/session-file-state-replay.d.ts +3 -3
- package/dist/core/runner/session-rule-policy.d.ts +2 -2
- package/dist/core/runner/steer-admission.d.ts +2 -2
- package/dist/core/runner/stream-halt-verbs.d.ts +1 -1
- package/dist/core/runner/stream-reap.d.ts +1 -1
- package/dist/core/runner/synthetic-tools.d.ts +8 -8
- package/dist/core/runner/teardown-bounded.d.ts +2 -2
- package/dist/core/runner/tool-defer-gate.d.ts +86 -0
- package/dist/core/runner/tool-defer-gate.js +57 -0
- package/dist/core/runner/tool-disclosure.d.ts +33 -69
- package/dist/core/runner/tool-disclosure.js +0 -43
- package/dist/core/runner/tool-end-body.d.ts +3 -3
- package/dist/core/runner/tool-face-overlay.d.ts +2 -2
- package/dist/core/runner/tool-output-projection.d.ts +2 -2
- package/dist/core/runner/turn-attachments.d.ts +53 -53
- package/dist/core/runner/usage-accounting.d.ts +4 -4
- package/dist/core/runner/workspace-path.d.ts +1 -1
- package/dist/core/runner-deps.d.ts +16 -9
- package/dist/core/task-spec.d.ts +8 -2
- package/dist/core/tool-spec.d.ts +7 -4
- package/dist/core/types.d.ts +1 -1
- package/dist/engine/llm/types.d.ts +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +3 -3
- package/dist/tools/fs/bash-readonly-classifier.d.ts +40 -40
- package/dist/tools/fs/encoding.d.ts +31 -40
- package/dist/tools/fs/fs-bash.d.ts +76 -35
- package/dist/tools/fs/fs-bash.js +86 -29
- package/dist/tools/fs/fs-pdf.d.ts +8 -8
- package/dist/tools/fs/fs-search-tools.d.ts +4 -4
- package/dist/tools/fs/fs-shared.d.ts +144 -158
- package/dist/tools/fs/fs-write.d.ts +8 -8
- package/dist/tools/fs/gh-rate-limit.d.ts +13 -14
- package/dist/tools/fs/index.d.ts +74 -78
- package/dist/tools/fs/notebook.d.ts +24 -25
- package/dist/tools/fs/pdf.d.ts +3 -3
- package/dist/tools/fs/read-deny.d.ts +22 -22
- package/dist/tools/fs/read-face.d.ts +21 -24
- package/dist/tools/fs/repo-map.d.ts +8 -8
- package/dist/tools/fs/safety.d.ts +116 -129
- package/dist/tools/fs/search.d.ts +63 -71
- package/package.json +5 -2
- package/test/export-surface.snapshot.json +9 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
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
|
|
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
|
|
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
|
-
*
|
|
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
|
|
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}
|
|
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 (
|
|
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
|
-
/**
|
|
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
|
-
*
|
|
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 (
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
-
* (
|
|
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
|
|
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
|
-
* (
|
|
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
|
-
*
|
|
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
|
|
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 (
|
|
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
|
|
166
|
+
/** owned — the mitigations half of the decision point (model-family fact). */
|
|
167
167
|
fableMitigations: boolean;
|
|
168
|
-
/** owned, frozen —
|
|
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
|
|
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
|
|
185
|
+
* branch (the read-once posture). */
|
|
186
186
|
memoryDelegationEvidence: "static-face" | "attested-only";
|
|
187
|
-
/** owned — the NORMALIZED memory-provenance mode
|
|
188
|
-
|
|
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
|
|
192
|
-
* screened (
|
|
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
|
-
/**
|
|
206
|
-
* interactionPosture / toolModelGate / staleToolResultOffload). Placement is load-bearing
|
|
207
|
-
*
|
|
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
|
-
*
|
|
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
|
|
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
|
|
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 —
|
|
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
|
-
*
|
|
110
|
-
*
|
|
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
|
-
*
|
|
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,11 +24,11 @@ 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
|
|
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";
|
|
31
|
-
/** borrowed-readonly — the resolved model (the
|
|
31
|
+
/** borrowed-readonly — the resolved model (the deferral gate's threshold reads its context window). */
|
|
32
32
|
model: Model;
|
|
33
33
|
/** borrowed-readonly — the materialized MCP roster; only `tools` is read (protocol names for the
|
|
34
34
|
* remote-roster arm; `mcpAlwaysLoad` self-declarations, losing to an explicit operator defer). */
|
|
@@ -3,10 +3,12 @@ import { FULL_SHELL_CONTRACT_ID } from "../../tools/fs/index.js";
|
|
|
3
3
|
import { ASK_USER_QUESTION_TOOL_NAME } from "../ask-question.js";
|
|
4
4
|
import { MEMORY_ENGINE_TOOL_NAMES } from "../memory-engine/tools.js";
|
|
5
5
|
import { SHARED_MEMORY_TOOL_NAMES } from "../shared-memory/types.js";
|
|
6
|
-
import {
|
|
6
|
+
import { protocolOf } from "../protocol-table.js";
|
|
7
|
+
import { classifyDeferred } from "./tool-defer-gate.js";
|
|
8
|
+
import { TOOL_SEARCH_NAME } from "./tool-disclosure.js";
|
|
7
9
|
import { RosterBuilder } from "../tool-roster.js";
|
|
8
|
-
function explicitlyDeferredMemoryTrio(mounted, roster,
|
|
9
|
-
return mounted ? MEMORY_ENGINE_TOOL_NAMES.filter((n) => roster.some((t) => t.name === n) && (
|
|
10
|
+
function explicitlyDeferredMemoryTrio(mounted, roster, callerDeferNames) {
|
|
11
|
+
return mounted ? MEMORY_ENGINE_TOOL_NAMES.filter((n) => roster.some((t) => t.name === n) && (callerDeferNames ?? []).includes(n)) : [];
|
|
10
12
|
}
|
|
11
13
|
function memoryGroupRetractionSet(builtinDeferPairNames, engineTrioInPlay) {
|
|
12
14
|
return new Set([...builtinDeferPairNames, ...(engineTrioInPlay ? MEMORY_ENGINE_TOOL_NAMES : [])]);
|
|
@@ -39,29 +41,29 @@ export function prepareDeferClassify(input) {
|
|
|
39
41
|
roster.replaceAt(i, { ...t, description: t.descriptionClassic });
|
|
40
42
|
}
|
|
41
43
|
}
|
|
42
|
-
const
|
|
43
|
-
const protocolToolNames = [...mcp.tools.map((t) => t.name), ...a2a.tools.map((t) => t.name)];
|
|
44
|
+
const protocolToolNames = [...mcp.tools, ...a2a.tools].filter((t) => protocolOf(t.name) !== undefined).map((t) => t.name);
|
|
44
45
|
const mcpAlwaysLoadNames = mcp.tools
|
|
45
46
|
.filter((t) => t.mcpAlwaysLoad === true && !(toolFaceSnapshot.defer ?? []).includes(t.name))
|
|
46
47
|
.map((t) => t.name);
|
|
47
48
|
const classifyDeferredOverFace = (face, builtinDeferNames) => {
|
|
49
|
+
const mounted = new Set(face.map((t) => t.name));
|
|
48
50
|
const deferredSet = classifyDeferred({
|
|
49
51
|
specs: spec.tools ?? [],
|
|
50
52
|
protocolToolNames,
|
|
51
|
-
fullTools: face
|
|
53
|
+
fullTools: face,
|
|
52
54
|
deferMode: deps.deferMode,
|
|
53
55
|
model,
|
|
54
|
-
|
|
56
|
+
callerDeferNames: (toolFaceSnapshot.defer ?? []).filter((n) => mounted.has(n)),
|
|
57
|
+
builtinDeferNames: builtinDeferNames.filter((n) => mounted.has(n)),
|
|
55
58
|
alwaysLoadNames: [
|
|
56
59
|
ASK_USER_QUESTION_TOOL_NAME,
|
|
57
60
|
...(toolFaceSnapshot.alwaysLoad ?? []),
|
|
58
61
|
...mcpAlwaysLoadNames,
|
|
59
62
|
],
|
|
60
63
|
});
|
|
61
|
-
for (const n of [...deferredSet])
|
|
62
|
-
if (!
|
|
64
|
+
for (const n of [...deferredSet])
|
|
65
|
+
if (!mounted.has(n))
|
|
63
66
|
deferredSet.delete(n);
|
|
64
|
-
}
|
|
65
67
|
return deferredSet;
|
|
66
68
|
};
|
|
67
69
|
const sharedMemoryPair = sharedMemoryPairMounted ? SHARED_MEMORY_TOOL_NAMES.filter((n) => tools.some((t) => t.name === n)) : [];
|
|
@@ -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
|
|
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
|
-
*
|
|
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
|
|
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
|
-
*
|
|
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
|
|
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
|
|
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
|
|
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 (
|
|
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. */
|
|
@@ -130,10 +130,9 @@ export interface PrepareGateStationsInput {
|
|
|
130
130
|
abortController: {
|
|
131
131
|
readonly signal: AbortSignal;
|
|
132
132
|
};
|
|
133
|
-
/** borrowed-readonly —
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
shellGatedMonitor: boolean;
|
|
133
|
+
/** borrowed-readonly — the shell-seat provenance set: the shell-running tools whose tier is the engine's shell seat's, not a
|
|
134
|
+
* deployment mark (the gate's `shellGated` attribution is the gated tool's membership). */
|
|
135
|
+
shellGatedTools: ReadonlySet<string>;
|
|
137
136
|
/** borrowed-readonly — the auto-mode decider, or undefined (the classifier lane the gate routes a surviving ask through). */
|
|
138
137
|
autoModeDecider: AutoModeDecider | undefined;
|
|
139
138
|
/** borrowed-readonly — the auto-mode denial tracker, or undefined (handed to the gate beside the decider). */
|
|
@@ -42,7 +42,7 @@ function maybeHumanRejectionHalt(input) {
|
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
44
|
export function prepareGateStations(input) {
|
|
45
|
-
const { askLane, parkAsk, tools, toolRosterDeltas, toolEffects, deps, toolCallGateArmedRef, effectivePolicy, hooks, egressTools, irreversibleTools, spec, complianceDenies, harness, blockedToolCalls, inheritedAskGrants, inheritedUnavailableAsks, foldAskClasses, ancestorSandboxAdmissions, preToolContexts, gateOutcomes, batchHaltRef, blockedTracked, hookIdentity, reminderMark, planModeRef, hostTaskId, sessionId, ownGatePreToolUse, hookTimeoutMs, handsCwdRef, hookEnvFace, irreversibilityTier, reversibilityProbes, abortController,
|
|
45
|
+
const { askLane, parkAsk, tools, toolRosterDeltas, toolEffects, deps, toolCallGateArmedRef, effectivePolicy, hooks, egressTools, irreversibleTools, spec, complianceDenies, harness, blockedToolCalls, inheritedAskGrants, inheritedUnavailableAsks, foldAskClasses, ancestorSandboxAdmissions, preToolContexts, gateOutcomes, batchHaltRef, blockedTracked, hookIdentity, reminderMark, planModeRef, hostTaskId, sessionId, ownGatePreToolUse, hookTimeoutMs, handsCwdRef, hookEnvFace, irreversibilityTier, reversibilityProbes, abortController, shellGatedTools, autoModeDecider, autoModeDenialTracking, stopForDenialLimit, permissionRuleLane, permissionRuleOrgLane, questionToolMounted, sandboxAdmissionArmed, sandboxBoundaryCapable, emitSandboxAdmitted, delegation, notifyOwnHookCrash } = input;
|
|
46
46
|
if (askLane !== undefined && parkAsk !== undefined) {
|
|
47
47
|
const { adjudicate, resolveAskBound, notifyPermissionDenied, notifyHookError } = askLane;
|
|
48
48
|
const { resolveContentAsk, suspendAsk } = parkAsk;
|
|
@@ -119,7 +119,7 @@ export function prepareGateStations(input) {
|
|
|
119
119
|
abortSignal: abortController.signal,
|
|
120
120
|
...(notifyPermissionDenied ? { permissionDenied: notifyPermissionDenied } : {}),
|
|
121
121
|
onHookError: notifyHookError,
|
|
122
|
-
shellGated:
|
|
122
|
+
shellGated: shellGatedTools.has(e.toolName),
|
|
123
123
|
...(autoModeDecider ? { autoMode: { decider: autoModeDecider, ...(autoModeDenialTracking !== undefined ? { denialTracking: autoModeDenialTracking } : {}) } } : {}),
|
|
124
124
|
onHeadlessDenialLimit: stopForDenialLimit,
|
|
125
125
|
onAskUnresolvable: (info) => deliverEngineNotice(deps.onNotice, askUnresolvableNotice({ sessionId, ...info })),
|