@sema-agent/core 7.56.0 → 7.58.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 +926 -0
- package/LICENSE +1 -1
- package/dist/agents/org-delivery-gate.js +3 -4
- package/dist/agents/peer-held-queue.d.ts +69 -49
- package/dist/agents/peer-held-queue.js +255 -106
- package/dist/agents/peer-session-drain.js +63 -43
- package/dist/agents/send-message-tool.js +3 -2
- package/dist/agents/subagent-steps.js +2 -4
- package/dist/agents/subagent.js +8 -8
- package/dist/brain/anthropic.js +16 -8
- package/dist/brain/open-responses.js +10 -8
- package/dist/brain/openai.js +11 -9
- package/dist/brain/provider-dialect.d.ts +3 -2
- package/dist/brain/provider-dialect.js +2 -2
- package/dist/brain/request-params.d.ts +6 -0
- package/dist/brain/request-params.js +14 -1
- package/dist/brain/route-adjudicator.js +2 -1
- package/dist/brain/stream-engine.d.ts +9 -0
- package/dist/brain/stream-engine.js +24 -10
- package/dist/brain/stream-shared.d.ts +5 -4
- package/dist/brain/stream-shared.js +4 -4
- package/dist/core/a2a.d.ts +2 -1
- package/dist/core/a2a.js +23 -10
- package/dist/core/allow-entry.d.ts +5 -11
- package/dist/core/allow-entry.js +19 -26
- package/dist/core/approval-object.d.ts +21 -5
- package/dist/core/approval-object.js +44 -17
- package/dist/core/ask-origin.d.ts +23 -4
- package/dist/core/ask-origin.js +5 -1
- package/dist/core/auto-compaction.d.ts +75 -6
- package/dist/core/auto-compaction.js +43 -27
- package/dist/core/auto-mode-directive.d.ts +29 -5
- package/dist/core/auto-mode-directive.js +38 -8
- package/dist/core/background-agent-store.d.ts +6 -2
- package/dist/core/background-agent-store.js +1 -1
- package/dist/core/checkpoint-requirements.d.ts +13 -1
- package/dist/core/checkpoint-requirements.js +4 -0
- package/dist/core/checkpoint-store.d.ts +44 -40
- package/dist/core/checkpoint-store.js +32 -14
- package/dist/core/cross-boundary-taint.js +4 -2
- package/dist/core/engine-notice.d.ts +4 -3
- package/dist/core/engine-notice.js +6 -0
- package/dist/core/file-history-store.d.ts +14 -8
- package/dist/core/file-history-store.js +14 -4
- package/dist/core/fs-write-gate-policy.d.ts +4 -2
- package/dist/core/fs-write-gate-policy.js +7 -3
- package/dist/core/gate-fold.js +6 -3
- package/dist/core/gate-lanes.js +13 -5
- package/dist/core/git-worktree-env.d.ts +53 -11
- package/dist/core/git-worktree-env.js +96 -12
- package/dist/core/hooks.d.ts +6 -3
- package/dist/core/hooks.js +12 -5
- package/dist/core/human-input-projection.d.ts +1 -0
- package/dist/core/human-input-projection.js +3 -0
- package/dist/core/locked-config.d.ts +15 -1
- package/dist/core/locked-config.js +38 -2
- package/dist/core/mailbox-store.d.ts +62 -1
- package/dist/core/mailbox-store.js +59 -0
- package/dist/core/mcp-call-meta.d.ts +66 -0
- package/dist/core/mcp-call-meta.js +103 -0
- package/dist/core/mcp-connection-pool.d.ts +3 -1
- package/dist/core/mcp-connection-pool.js +3 -1
- package/dist/core/mcp-failure.d.ts +7 -1
- package/dist/core/mcp-failure.js +10 -0
- package/dist/core/mcp-name-judge.d.ts +46 -0
- package/dist/core/mcp-name-judge.js +61 -0
- package/dist/core/mcp-probe.d.ts +5 -1
- package/dist/core/mcp-probe.js +3 -6
- package/dist/core/mcp-server-link.d.ts +5 -2
- package/dist/core/mcp-server-spec.d.ts +46 -18
- package/dist/core/mcp-server-spec.js +1 -18
- package/dist/core/mcp.d.ts +6 -14
- package/dist/core/mcp.js +85 -65
- package/dist/core/memory-engine/consolidation-driver.js +4 -3
- package/dist/core/memory-engine/distiller.js +26 -17
- package/dist/core/memory-engine/layout.js +5 -2
- package/dist/core/memory-engine/scope-contract.d.ts +45 -4
- package/dist/core/memory-engine/scope-contract.js +80 -11
- package/dist/core/mode-policy.d.ts +8 -5
- package/dist/core/mode-policy.js +5 -4
- package/dist/core/mods/host.js +1 -1
- package/dist/core/mods/kernel/dispatch.d.ts +3 -0
- package/dist/core/mods/kernel/dispatch.js +10 -8
- package/dist/core/mods/kernel/events.d.ts +5 -1
- package/dist/core/mods/kernel/events.js +1 -1
- package/dist/core/mods/kernel/registration.d.ts +5 -1
- package/dist/core/mods/kernel/site-rules.d.ts +3 -0
- package/dist/core/mods/kernel/site-rules.js +10 -0
- package/dist/core/mods/package.d.ts +23 -0
- package/dist/core/mods/package.js +118 -0
- package/dist/core/mods/stations.d.ts +2 -2
- package/dist/core/mods/stations.js +1 -1
- package/dist/core/mods/tool-call.d.ts +5 -1
- package/dist/core/mods/tool-call.js +12 -3
- package/dist/core/park-selfcheck.js +2 -0
- package/dist/core/path-guard-rows.d.ts +20 -0
- package/dist/core/path-guard-rows.js +11 -0
- package/dist/core/peer-seat.d.ts +186 -0
- package/dist/core/peer-seat.js +307 -0
- package/dist/core/permission-rule-consent.d.ts +5 -3
- package/dist/core/permission-rule-consent.js +20 -15
- package/dist/core/permission-rule-model.d.ts +43 -2
- package/dist/core/permission-rule-model.js +52 -8
- package/dist/core/permission-rule-org.js +1 -1
- package/dist/core/present-plan-tool.d.ts +10 -1
- package/dist/core/present-plan-tool.js +46 -2
- package/dist/core/protocol-http-auth.d.ts +56 -31
- package/dist/core/protocol-http-auth.js +71 -42
- package/dist/core/protocol-naming.d.ts +20 -0
- package/dist/core/protocol-naming.js +20 -3
- package/dist/core/read-only-shell.d.ts +20 -5
- package/dist/core/read-only-shell.js +29 -14
- package/dist/core/redaction-marks.d.ts +16 -0
- package/dist/core/redaction-marks.js +16 -0
- package/dist/core/redaction-passes.js +8 -9
- package/dist/core/remote-env.d.ts +37 -1
- package/dist/core/remote-env.js +11 -0
- package/dist/core/resume-startup-cause.d.ts +24 -2
- package/dist/core/resume-startup-cause.js +20 -1
- package/dist/core/retention.d.ts +41 -15
- package/dist/core/retention.js +59 -12
- package/dist/core/rewrite-rejudge.d.ts +37 -0
- package/dist/core/rewrite-rejudge.js +40 -0
- package/dist/core/roles.js +50 -7
- package/dist/core/run-origin.d.ts +40 -0
- package/dist/core/run-origin.js +37 -0
- package/dist/core/runner/advertised-writable-dirs.d.ts +57 -38
- package/dist/core/runner/advertised-writable-dirs.js +126 -0
- package/dist/core/runner/compact-session.d.ts +10 -0
- package/dist/core/runner/compact-session.js +202 -0
- package/dist/core/runner/compaction-call-options.d.ts +2 -2
- package/dist/core/runner/compaction-restate.d.ts +15 -6
- package/dist/core/runner/compaction-restate.js +28 -2
- package/dist/core/runner/compaction-seams.d.ts +21 -1
- package/dist/core/runner/compaction-seams.js +11 -8
- package/dist/core/runner/contracts.d.ts +36 -21
- package/dist/core/runner/derived-route-fallback.d.ts +13 -0
- package/dist/core/runner/derived-route-fallback.js +6 -0
- package/dist/core/runner/env-capability-census.d.ts +3 -2
- package/dist/core/runner/env-capability-census.js +9 -3
- package/dist/core/runner/gate-exit.d.ts +18 -4
- package/dist/core/runner/gate-exit.js +5 -1
- package/dist/core/runner/permission-rule-lanes.d.ts +7 -7
- package/dist/core/runner/permission-rule-lanes.js +17 -11
- package/dist/core/runner/prepare-acquire-reconcile.d.ts +3 -0
- package/dist/core/runner/prepare-acquire-reconcile.js +2 -1
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +2 -0
- package/dist/core/runner/prepare-caps-and-workflow.js +1 -1
- package/dist/core/runner/prepare-config-doors.d.ts +14 -5
- package/dist/core/runner/prepare-config-doors.js +16 -13
- package/dist/core/runner/prepare-delegation-surface.d.ts +4 -0
- package/dist/core/runner/prepare-delegation-surface.js +15 -18
- package/dist/core/runner/prepare-gate-stations.js +1 -1
- package/dist/core/runner/prepare-hands-readface.d.ts +10 -4
- package/dist/core/runner/prepare-hands-readface.js +6 -1
- package/dist/core/runner/prepare-memory.d.ts +3 -0
- package/dist/core/runner/prepare-memory.js +19 -23
- package/dist/core/runner/prepare-park-ask.d.ts +2 -0
- package/dist/core/runner/prepare-park-ask.js +2 -2
- package/dist/core/runner/prepare-policy-chain.d.ts +4 -4
- package/dist/core/runner/prepare-policy-chain.js +4 -6
- package/dist/core/runner/prepare-protocol-tools.d.ts +4 -2
- package/dist/core/runner/prepare-protocol-tools.js +3 -3
- package/dist/core/runner/prepare-suspend-saga.d.ts +2 -0
- package/dist/core/runner/prepare-suspend-saga.js +2 -1
- package/dist/core/runner/prepare-task.d.ts +4 -1
- package/dist/core/runner/prepare-task.js +46 -37
- package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +13 -0
- package/dist/core/runner/prepare-tool-disclosure-mount.js +13 -7
- package/dist/core/runner/prepare-wiring-manifest.d.ts +1 -0
- package/dist/core/runner/prepare-wiring-manifest.js +2 -2
- package/dist/core/runner/prepare-workspace-restore.d.ts +3 -0
- package/dist/core/runner/prepare-workspace-restore.js +4 -4
- package/dist/core/runner/resume-admission.js +1 -1
- package/dist/core/runner/resume-checkpoint-screen.js +2 -0
- package/dist/core/runner/rewind-files.d.ts +2 -5
- package/dist/core/runner/rewind-files.js +9 -51
- package/dist/core/runner/run-harness-handlers.d.ts +3 -4
- package/dist/core/runner/run-harness-handlers.js +1 -8
- package/dist/core/runner/run-identity-wiring.js +1 -0
- package/dist/core/runner/run-leg.js +15 -22
- package/dist/core/runner/run-notification-lane.d.ts +2 -0
- package/dist/core/runner/run-notification-lane.js +5 -2
- package/dist/core/runner/run-recovery-lanes.js +3 -4
- package/dist/core/runner/run-settle-and-teardown.js +5 -11
- package/dist/core/runner/run-terminal-adoption.js +3 -4
- package/dist/core/runner/run-turn-boundary.js +3 -5
- package/dist/core/runner/runtask.d.ts +8 -1
- package/dist/core/runner/runtask.js +28 -34
- package/dist/core/runner/send-message-continuation.js +1 -1
- package/dist/core/runner/session-verb-doors.d.ts +28 -0
- package/dist/core/runner/session-verb-doors.js +48 -0
- package/dist/core/runner/session-write-ledger.d.ts +30 -0
- package/dist/core/runner/session-write-ledger.js +101 -0
- package/dist/core/runner/stream-settle-backstop.js +11 -14
- package/dist/core/runner/sub-agent-deny-lists.d.ts +25 -3
- package/dist/core/runner/sub-agent-deny-lists.js +21 -10
- package/dist/core/runner/teardown-bounded.d.ts +1 -0
- package/dist/core/runner/teardown-bounded.js +1 -0
- package/dist/core/runner/terminal-account.js +3 -3
- package/dist/core/runner/tool-end-body.js +1 -0
- package/dist/core/runner/tool-occurrence.d.ts +4 -1
- package/dist/core/runner/tool-occurrence.js +2 -1
- package/dist/core/runner/write-protection-station.d.ts +8 -2
- package/dist/core/runner/write-protection-station.js +2 -0
- package/dist/core/runner-deps.d.ts +4 -4
- package/dist/core/secret-env.d.ts +4 -0
- package/dist/core/secret-env.js +3 -0
- package/dist/core/sensitive-path-policy.js +6 -7
- package/dist/core/session-log-transfer.d.ts +24 -0
- package/dist/core/session-log-transfer.js +166 -0
- package/dist/core/session-policy-store.d.ts +7 -2
- package/dist/core/session-policy-store.js +1 -1
- package/dist/core/session-store.d.ts +84 -19
- package/dist/core/session-store.js +162 -24
- package/dist/core/session.d.ts +92 -1
- package/dist/core/shell-read-silence.js +1 -0
- package/dist/core/shell-wrapper-projection.d.ts +1 -1
- package/dist/core/steer-replay.d.ts +4 -2
- package/dist/core/steer-replay.js +2 -1
- package/dist/core/store-contracts/background-agent-store-contract.js +1 -0
- package/dist/core/store-contracts/checkpoint-store-contract.js +19 -1
- package/dist/core/store-contracts/file-history-store-contract.js +9 -0
- package/dist/core/store-contracts/mailbox-store-contract.js +49 -1
- package/dist/core/store-contracts/session-repo-contract.js +112 -5
- package/dist/core/store-contracts/session-store-contract.d.ts +4 -1
- package/dist/core/store-contracts/session-store-contract.js +236 -2
- package/dist/core/task-event.d.ts +68 -8
- package/dist/core/task-registry-agent.d.ts +8 -4
- package/dist/core/task-registry-agent.js +14 -8
- package/dist/core/task-registry-shared.d.ts +36 -6
- package/dist/core/task-registry-shared.js +11 -0
- package/dist/core/task-registry.d.ts +1 -1
- package/dist/core/task-registry.js +1 -1
- package/dist/core/task-spec.d.ts +37 -0
- package/dist/core/task-stream.d.ts +2 -1
- package/dist/core/terminal-cause.d.ts +1 -1
- package/dist/core/tool-catalog-entries.d.ts +6 -0
- package/dist/core/tool-catalog-entries.js +2 -0
- package/dist/core/tool-name-aliases.d.ts +32 -2
- package/dist/core/tool-name-aliases.js +23 -0
- package/dist/core/tool-name-readings.d.ts +4 -0
- package/dist/core/tool-name-readings.js +1 -0
- package/dist/core/tool-policy.d.ts +10 -6
- package/dist/core/tool-policy.js +4 -7
- package/dist/core/tool-result-store.d.ts +17 -10
- package/dist/core/tool-result-store.js +3 -1
- package/dist/core/trace.d.ts +4 -1
- package/dist/core/trace.js +2 -1
- package/dist/core/types.d.ts +1 -1
- package/dist/core/untrusted-egress.d.ts +18 -0
- package/dist/core/untrusted-egress.js +82 -12
- package/dist/core/wiring-manifest.d.ts +12 -3
- package/dist/core/wiring-manifest.js +4 -3
- package/dist/core/workspace-snapshot.d.ts +44 -0
- package/dist/core/workspace-snapshot.js +34 -0
- package/dist/core/write-protect.d.ts +43 -3
- package/dist/core/write-protect.js +43 -16
- package/dist/engine/execution-env/node-execution-env.js +15 -11
- package/dist/engine/execution-env/symlink-chain.d.ts +7 -5
- package/dist/engine/harness/agent-harness.d.ts +12 -5
- package/dist/engine/harness/agent-harness.js +13 -2
- package/dist/engine/harness/types.d.ts +48 -7
- package/dist/engine/harness/types.js +5 -1
- package/dist/engine/llm/types.d.ts +12 -3
- package/dist/engine/llm/types.js +1 -1
- package/dist/engine/loop/agent-loop.d.ts +1 -4
- package/dist/engine/loop/agent-loop.js +26 -4
- package/dist/engine/session/import-validate.js +3 -0
- package/dist/engine/session/memory-repo.d.ts +17 -9
- package/dist/engine/session/memory-repo.js +44 -34
- package/dist/engine/session/repo-utils.d.ts +22 -4
- package/dist/engine/session/repo-utils.js +49 -1
- package/dist/engine/session/storage-base.d.ts +10 -1
- package/dist/engine/session/storage-base.js +7 -1
- package/dist/index.d.ts +23 -11
- package/dist/index.js +15 -6
- package/dist/internal/harness-types.d.ts +1 -1
- package/dist/internal/harness.d.ts +4 -3
- package/dist/internal/harness.js +3 -2
- package/dist/stores/file/checkpoint-store.d.ts +0 -4
- package/dist/stores/file/checkpoint-store.js +0 -1
- package/dist/stores/file/file-history-store.js +12 -4
- package/dist/stores/file/index.d.ts +4 -1
- package/dist/stores/file/index.js +4 -1
- package/dist/stores/file/mailbox-store.d.ts +2 -1
- package/dist/stores/file/mailbox-store.js +26 -1
- package/dist/stores/file/session-store.d.ts +15 -8
- package/dist/stores/file/session-store.js +28 -13
- package/dist/tools/fs/bash-readonly-classifier.d.ts +15 -19
- package/dist/tools/fs/bash-readonly-classifier.js +5 -10
- package/dist/tools/fs/fs-bash.js +10 -3
- package/dist/tools/fs/fs-write.d.ts +6 -3
- package/dist/tools/fs/fs-write.js +8 -7
- package/dist/tools/fs/index.d.ts +3 -0
- package/dist/tools/fs/index.js +1 -1
- package/dist/tools/fs/pattern-kill-guard.d.ts +3 -2
- package/dist/tools/fs/pattern-kill-guard.js +68 -36
- package/dist/tools/fs/safety.js +40 -8
- package/dist/tools/fs/search.js +6 -24
- package/dist/tools/fs/shell-read-check.d.ts +18 -1
- package/dist/tools/fs/shell-read-check.js +66 -16
- package/dist/tools/fs/shell-read-establish.js +2 -1
- package/dist/tools/fs/shell-read-identity.d.ts +12 -9
- package/dist/tools/fs/shell-read-identity.js +10 -5
- package/dist/tools/fs/shell-read-judge.d.ts +10 -1
- package/dist/tools/web.js +9 -7
- package/dist/tools/worktree.d.ts +42 -15
- package/dist/tools/worktree.js +60 -32
- package/package.json +4 -2
- package/test/export-surface.snapshot.json +141 -3
- package/wire-changes/core-stores-sql@7.57.0.json +29 -0
- package/wire-changes/core-stores-sql@7.58.0.json +29 -0
- package/wire-changes/core@7.57.0.json +1487 -0
- package/wire-changes/core@7.58.0.json +2188 -0
- package/wire-changes/mods-kernel@7.57.0.json +29 -0
- package/wire-changes/mods-kernel@7.58.0.json +81 -0
- package/wire-changes/primitives@7.57.0.json +245 -0
- package/wire-changes/primitives@7.58.0.json +29 -0
|
@@ -6,6 +6,7 @@ import { CROSS_BOUNDARY_POSTURES } from "../cross-boundary-taint.js";
|
|
|
6
6
|
import { compileHostFloor } from "../host-floor.js";
|
|
7
7
|
import { assertNoRetiredRunnerDeps } from "./retired-runner-deps.js";
|
|
8
8
|
import { recordedModeSeed, resolveCheckpointStore } from "../checkpoint-store.js";
|
|
9
|
+
import { runOriginOfLeg, screenRecordedRunOrigin } from "../run-origin.js";
|
|
9
10
|
import { assertCheckpointStoreJudgesHolder, assertHolderValue } from "../checkpoint-generation.js";
|
|
10
11
|
import { asResumeConfigRefusal, refusePermissionModeDoors } from "../mode-policy.js";
|
|
11
12
|
import { resolveOutputStyleFrame } from "../output-style.js";
|
|
@@ -16,7 +17,7 @@ import { screenHandsBandOptions } from "../hands-band-screen.js";
|
|
|
16
17
|
import { assertAutoConsolidationWirable } from "./memory-consolidation-driver.js";
|
|
17
18
|
import { isModelPriced, malformedPricingField, modelCostToPricing } from "../pricing.js";
|
|
18
19
|
import { ENTER_AS_IS, preflightLockedConfig } from "../locked-config.js";
|
|
19
|
-
import {
|
|
20
|
+
import { assertRetentionWords } from "../retention.js";
|
|
20
21
|
import { resolveModel, resolveTaskModel, roleModelIfSet, screenRoleMap } from "../roles.js";
|
|
21
22
|
import { resolveSkillListingBudget } from "../skill-listing-budget.js";
|
|
22
23
|
import { describeRejectedValue } from "../tool-search-setting.js";
|
|
@@ -54,6 +55,9 @@ const RETIRED_TASK_LIMIT_KEYS = {
|
|
|
54
55
|
callCapByDeadline: "(retired — no replacement)",
|
|
55
56
|
gracefulFinalize: "(retired — the approach notice is the only end-of-budget prompt)",
|
|
56
57
|
};
|
|
58
|
+
export function resolveCompactionModel(spec, deps, seat) {
|
|
59
|
+
return spec.compactionModel !== undefined ? resolveModel(spec.compactionModel, deps.models, seat) : roleModelIfSet("summarize", spec, deps);
|
|
60
|
+
}
|
|
57
61
|
export function limitConfigError(code, message) {
|
|
58
62
|
const e = new Error(message);
|
|
59
63
|
e.code = code;
|
|
@@ -182,6 +186,7 @@ export function configValueDoors(input, enter = ENTER_AS_IS) {
|
|
|
182
186
|
const { spec, deps, resumeLeg, sessions, holder } = input;
|
|
183
187
|
enter("deps", () => assertNoRetiredRunnerDeps(deps));
|
|
184
188
|
enter("taskConfig", () => assertPrincipalValue(spec.principal));
|
|
189
|
+
const runOrigin = enter("taskConfig", () => runOriginOfLeg(spec.runOrigin, input.resumedRow));
|
|
185
190
|
enter("taskConfig", () => assertPeerPresenceValue(spec.peerPresence));
|
|
186
191
|
enter("taskConfig", () => assertRestoreGatedToolsValue(spec.restoreGatedTools));
|
|
187
192
|
const microCompactKnob = enter("deps", () => resolveMicroCompactKnob(deps.microCompact));
|
|
@@ -325,7 +330,7 @@ export function configValueDoors(input, enter = ENTER_AS_IS) {
|
|
|
325
330
|
enter(checkpointStoreSeat(spec), () => assertCheckpointStoreJudgesHolder(checkpointStoreSeat(spec) === "taskConfig" ? "TaskSpec.checkpointStore" : "RunnerDeps.checkpointStore", checkpointStore, holder));
|
|
326
331
|
const taskStore = checkpointStoreSeat(spec) === "taskConfig" ? checkpointStore : undefined;
|
|
327
332
|
const retention = { policy: deps.retentionPolicy, locked: lockedPreflight.lockedKeys.has("retentionPolicy") };
|
|
328
|
-
enter("deps", () =>
|
|
333
|
+
enter("deps", () => assertRetentionWords({
|
|
329
334
|
...retention,
|
|
330
335
|
stores: [
|
|
331
336
|
{ name: "sessionStore", store: sessions },
|
|
@@ -334,10 +339,10 @@ export function configValueDoors(input, enter = ENTER_AS_IS) {
|
|
|
334
339
|
],
|
|
335
340
|
}));
|
|
336
341
|
if (taskStore !== undefined)
|
|
337
|
-
enter("taskConfig", () =>
|
|
338
|
-
return { toolFaceLists, promptHost, promptBinding, promptLean, lockedPreflight, skillListingSeats, skills, projectMemory, microCompactKnob, memoryDelegationEvidence, memoryProvenance, memoryCapturePolicy, usageWindows, brainCallGuardrailMs, crossBoundaryPosture, advisorTool, hostFloor };
|
|
342
|
+
enter("taskConfig", () => assertRetentionWords({ ...retention, stores: [{ name: "checkpointStore", store: taskStore }] }));
|
|
343
|
+
return { toolFaceLists, promptHost, promptBinding, promptLean, lockedPreflight, skillListingSeats, skills, projectMemory, microCompactKnob, memoryDelegationEvidence, memoryProvenance, memoryCapturePolicy, usageWindows, brainCallGuardrailMs, crossBoundaryPosture, advisorTool, hostFloor, runOrigin };
|
|
339
344
|
}
|
|
340
|
-
export function refuseResumeDoors(config,
|
|
345
|
+
export function refuseResumeDoors(config, recorded, deps, sessions, holder) {
|
|
341
346
|
asResumeConfigRefusal("taskConfig", () => {
|
|
342
347
|
refusePermissionModeDoors(config);
|
|
343
348
|
resolveOutputStyleFrame(config.outputStyle);
|
|
@@ -347,8 +352,8 @@ export function refuseResumeDoors(config, recordedGate, deps, sessions, holder)
|
|
|
347
352
|
assertToolBoundaryLegs(config.tools);
|
|
348
353
|
assertToolCardDeclarations(config.tools);
|
|
349
354
|
});
|
|
350
|
-
const { lockedPreflight, skills } = configValueDoors({ spec: config, deps, resumeLeg: true, sessions, holder }, asResumeConfigRefusal);
|
|
351
|
-
asResumeConfigRefusal("inheritedGate", () => void recordedModeSeed(
|
|
355
|
+
const { lockedPreflight, skills } = configValueDoors({ spec: config, deps, resumeLeg: true, sessions, holder, ...(recorded !== undefined ? { resumedRow: { recorded: recorded.runOrigin } } : {}) }, asResumeConfigRefusal);
|
|
356
|
+
asResumeConfigRefusal("inheritedGate", () => void recordedModeSeed(recorded?.inheritedGate));
|
|
352
357
|
return { ...config, ...(config.mcp !== undefined ? { mcp: lockedPreflight.mcp ?? [] } : {}), ...(config.a2a !== undefined ? { a2a: lockedPreflight.a2a ?? [] } : {}), skills };
|
|
353
358
|
}
|
|
354
359
|
export function prepareConfigDoors(input) {
|
|
@@ -356,9 +361,9 @@ export function prepareConfigDoors(input) {
|
|
|
356
361
|
assertToolBoundaryLegs(input.spec.tools);
|
|
357
362
|
assertToolCardDeclarations(input.spec.tools);
|
|
358
363
|
let spec = input.spec;
|
|
359
|
-
const { toolFaceLists, promptHost, promptBinding, promptLean, lockedPreflight, skillListingSeats, skills, projectMemory, microCompactKnob, memoryDelegationEvidence, memoryProvenance, memoryCapturePolicy, usageWindows, brainCallGuardrailMs, crossBoundaryPosture, advisorTool, hostFloor } = configValueDoors({ spec, deps, resumeLeg: resume !== undefined, sessions, holder: internals?.holder });
|
|
364
|
+
const { toolFaceLists, promptHost, promptBinding, promptLean, lockedPreflight, skillListingSeats, skills, projectMemory, microCompactKnob, memoryDelegationEvidence, memoryProvenance, memoryCapturePolicy, usageWindows, brainCallGuardrailMs, crossBoundaryPosture, advisorTool, hostFloor, runOrigin } = configValueDoors({ spec, deps, resumeLeg: resume !== undefined, sessions, holder: internals?.holder, ...(resume !== undefined ? { resumedRow: { recorded: screenRecordedRunOrigin(resume.seed.runOrigin), ...(resume.opening !== undefined ? { opening: resume.opening } : {}) } } : {}) });
|
|
360
365
|
const doorRead = (value) => ({ value, enumerable: value !== undefined, writable: false, configurable: false });
|
|
361
|
-
spec = Object.create(Object.getPrototypeOf(spec), { ...Object.getOwnPropertyDescriptors(spec), skills: doorRead(skills), projectMemory: doorRead(projectMemory) });
|
|
366
|
+
spec = Object.create(Object.getPrototypeOf(spec), { ...Object.getOwnPropertyDescriptors(spec), skills: doorRead(skills), projectMemory: doorRead(projectMemory), runOrigin: doorRead(runOrigin) });
|
|
362
367
|
const resolvedInteractionPosture = spec.interactionPosture ?? internals?.parentInteractionPosture ?? deps.interactionPosture;
|
|
363
368
|
const askSeat = resolveAskSeat(spec, deps);
|
|
364
369
|
{
|
|
@@ -482,9 +487,7 @@ export function prepareConfigDoors(input) {
|
|
|
482
487
|
discardedEnvRaw: gateDecision.discardedEnvRaw,
|
|
483
488
|
});
|
|
484
489
|
const thinking = spec.thinking ?? resolvedRole.thinking ?? model.defaultThinking;
|
|
485
|
-
const compModel = spec.compactionModel
|
|
486
|
-
? resolveModel(spec.compactionModel, deps.models, "TaskSpec.compactionModel")
|
|
487
|
-
: roleModelIfSet("summarize", spec, deps);
|
|
490
|
+
const compModel = resolveCompactionModel(spec, deps, "TaskSpec.compactionModel");
|
|
488
491
|
return {
|
|
489
492
|
spec,
|
|
490
493
|
toolFaceLists,
|
|
@@ -504,7 +507,7 @@ export function prepareConfigDoors(input) {
|
|
|
504
507
|
memoryDelegationEvidence,
|
|
505
508
|
skillListingBudget,
|
|
506
509
|
memoryProvenance,
|
|
507
|
-
memoryCapturePolicy, crossBoundaryPosture, advisorTool, hostFloor,
|
|
510
|
+
memoryCapturePolicy, crossBoundaryPosture, advisorTool, hostFloor, runOrigin,
|
|
508
511
|
usageWindows,
|
|
509
512
|
brainCallGuardrailRef,
|
|
510
513
|
brainCallGuardrailMs,
|
|
@@ -116,6 +116,10 @@ export interface PrepareDelegationSurfaceInput {
|
|
|
116
116
|
workspaceStateSettle: {
|
|
117
117
|
restoredWorktreeDir?: string;
|
|
118
118
|
} | undefined;
|
|
119
|
+
/** borrowed-mutable — the leg's write-location seat (prepare-task mints it empty, before any write-root reader is built, and
|
|
120
|
+
* reads it through its one reader `currentCheckoutOf`). The worktree mount seeds `current` here and hands THIS object to
|
|
121
|
+
* the tools — a copy would strand their writes from every write-root reader. */
|
|
122
|
+
worktreeSeat: WorktreeSessionRef;
|
|
119
123
|
}
|
|
120
124
|
export interface PrepareDelegationSurfaceResult {
|
|
121
125
|
/** owned — whether the background/workflow door is open (TaskOutput / TaskStop / AgentTranscript ride it). */
|
|
@@ -13,7 +13,7 @@ import { deliverEngineNotice } from "../types.js";
|
|
|
13
13
|
import { RosterBuilder } from "../tool-roster.js";
|
|
14
14
|
import { sendMessageContinuationSeats } from "./send-message-continuation.js";
|
|
15
15
|
export function prepareDelegationSurface(input) {
|
|
16
|
-
const { spec, deps, internals, resume, sessionId, hostTaskId, taskScope, taskRootFinal, taskRootCanonical, executionEnv, runnerSelf, backgroundTaskToolsActive, workflowToolsActive, peerLaneActive, peerSendMessageBuiltIn, peerLaneRefs, sessionBox, roster, axisExplicitNegatives, envHandToolNames, toolFaceSnapshot, firstPartyOffload, offloadStore, subagentRetain, enrichSpecToolCtx, checkpointSeat, handsCwdRef, wsSnapshot, rebaseWsPath, rebaseRestoredPath, workspaceStateSettle } = input;
|
|
16
|
+
const { spec, deps, internals, resume, sessionId, hostTaskId, taskScope, taskRootFinal, taskRootCanonical, executionEnv, runnerSelf, backgroundTaskToolsActive, workflowToolsActive, peerLaneActive, peerSendMessageBuiltIn, peerLaneRefs, sessionBox, roster, axisExplicitNegatives, envHandToolNames, toolFaceSnapshot, firstPartyOffload, offloadStore, subagentRetain, enrichSpecToolCtx, checkpointSeat, handsCwdRef, wsSnapshot, rebaseWsPath, rebaseRestoredPath, workspaceStateSettle, worktreeSeat } = input;
|
|
17
17
|
let worktreeSessionRef;
|
|
18
18
|
const delegationSurfaceActive = backgroundTaskToolsActive || workflowToolsActive;
|
|
19
19
|
const leaves = valveLeaves(spec, toolFaceSnapshot.selector);
|
|
@@ -104,25 +104,22 @@ export function prepareDelegationSurface(input) {
|
|
|
104
104
|
})), { source: "builtin", mountedBy: "backgroundTasks" });
|
|
105
105
|
}
|
|
106
106
|
if (handsCwdRef !== undefined) {
|
|
107
|
-
worktreeSessionRef =
|
|
108
|
-
|
|
107
|
+
worktreeSessionRef = worktreeSeat;
|
|
108
|
+
const seeded = resume?.seed.activeWorktree
|
|
109
|
+
? {
|
|
110
|
+
...resume.seed.activeWorktree,
|
|
111
|
+
worktreeDir: rebaseRestoredPath(resume.seed.activeWorktree.worktreeDir),
|
|
112
|
+
originalCwd: rebaseRestoredPath(resume.seed.activeWorktree.originalCwd),
|
|
113
|
+
}
|
|
114
|
+
: wsSnapshot?.activeWorktree !== undefined
|
|
109
115
|
? {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
originalCwd: rebaseRestoredPath(resume.seed.activeWorktree.originalCwd),
|
|
114
|
-
},
|
|
116
|
+
...wsSnapshot.activeWorktree,
|
|
117
|
+
worktreeDir: rebaseWsPath(wsSnapshot.activeWorktree.worktreeDir),
|
|
118
|
+
originalCwd: rebaseWsPath(wsSnapshot.activeWorktree.originalCwd),
|
|
115
119
|
}
|
|
116
|
-
:
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
...wsSnapshot.activeWorktree,
|
|
120
|
-
worktreeDir: rebaseWsPath(wsSnapshot.activeWorktree.worktreeDir),
|
|
121
|
-
originalCwd: rebaseWsPath(wsSnapshot.activeWorktree.originalCwd),
|
|
122
|
-
},
|
|
123
|
-
}
|
|
124
|
-
: {}),
|
|
125
|
-
};
|
|
120
|
+
: undefined;
|
|
121
|
+
if (seeded !== undefined)
|
|
122
|
+
worktreeSessionRef.current = seeded;
|
|
126
123
|
if (workspaceStateSettle !== undefined)
|
|
127
124
|
workspaceStateSettle.restoredWorktreeDir = worktreeSessionRef.current?.worktreeDir;
|
|
128
125
|
roster.mountAll(createWorktreeTools(executionEnv, { repoRoot: taskRootFinal, cwdRef: handsCwdRef, session: worktreeSessionRef }).map((t) => (envHandToolNames.add(t.name), firstPartyOffload(t))), { source: "builtin", mountedBy: "hands" });
|
|
@@ -223,7 +223,7 @@ export function prepareGateStations(input) {
|
|
|
223
223
|
for (const defect of screened.defects)
|
|
224
224
|
deps.onError?.(new Error(defect), { phase: "config", sessionId });
|
|
225
225
|
if (screened.gate !== undefined)
|
|
226
|
-
toolOccurrences.gateRound(e.toolCallId, screened.gate, result.finalInput);
|
|
226
|
+
toolOccurrences.gateRound(e.toolCallId, screened.gate, result.finalInput, result.rewrite);
|
|
227
227
|
if (result.block) {
|
|
228
228
|
const haltRemaining = maybeHumanRejectionHalt({
|
|
229
229
|
gate: screened.gate,
|
|
@@ -2,7 +2,7 @@ import { type BeforeWriteHook, type CwdRef, type PathRuleDenyRow, type Containme
|
|
|
2
2
|
import { type ReadFileState } from "../../tools/fs/safety.js";
|
|
3
3
|
import { type PathTablesFacade, type PersonPathRows, type ReadRootsSeat } from "./person-path-rows.js";
|
|
4
4
|
import type { HeadLeads } from "../path-rule-binding.js";
|
|
5
|
-
import { type ShellReadAdmission, type ShellReadCheck } from "../../tools/fs/shell-read-check.js";
|
|
5
|
+
import { type ShellReadAdmission, type ShellReadCheck, type ShellReadLandings } from "../../tools/fs/shell-read-check.js";
|
|
6
6
|
import type { ShellReadBoundary } from "../../tools/fs/shell-read-judge.js";
|
|
7
7
|
import type { RunnerDeps, ShellGateDoctrine, TaskSpec } from "../types.js";
|
|
8
8
|
import type { Model } from "../../internal/llm.js";
|
|
@@ -36,6 +36,10 @@ export interface PrepareHandsReadFaceInput {
|
|
|
36
36
|
* resolver at the driver's root receiving point ({@link import("./task-root-canonical.js").resolveTaskRootCanonical}):
|
|
37
37
|
* taken as an input, never re-canonicalized here, so the fence and the root notice cannot disagree. */
|
|
38
38
|
taskRootCanonical: string;
|
|
39
|
+
/** borrowed-readonly — the leg's ONE write-location reader (prepare-task's `currentCheckoutOf` over the worktree seat): the
|
|
40
|
+
* primary WRITE root of the structured write tools and of the shell's write targets, read per call — it is the task root
|
|
41
|
+
* until EnterWorktree switches it, and moves back on ExitWorktree. The READ roots never read it. */
|
|
42
|
+
writeLocation: () => string;
|
|
39
43
|
/** borrowed-readonly — B-4's checkpoint-path rebaser (T7): identity unless a divergent restore
|
|
40
44
|
* armed it; applied to the readFileState seed keys and the handsCwd seed. */
|
|
41
45
|
rebaseRestoredPath: (p: string) => string;
|
|
@@ -86,9 +90,9 @@ export interface PrepareHandsReadFaceInput {
|
|
|
86
90
|
* (the Read tool's document-degradation fork). */
|
|
87
91
|
model: Model;
|
|
88
92
|
/** borrowed-readonly — the task-spec seats this phase reads, as a Pick over the SAME spec object
|
|
89
|
-
* (R-4). `tools` feeds only the band shadow check; `envFacts` only the advertised scratchpad;
|
|
90
|
-
* `retainBackgroundProcesses` only the band's retain lane (Bash's lifetime sentence + row stamp). */
|
|
91
|
-
spec: Pick<TaskSpec, "additionalDirectories" | "additionalReadDirectories" | "envFacts" | "handsReadOnly" | "readDenyPatterns" | "readFace" | "writeFace" | "oneShot" | "resumeAt" | "retainBackgroundProcesses" | "sessionId" | "tools" | "excludeAllTools">;
|
|
93
|
+
* (R-4). `tools` feeds only the band shadow check; `envFacts` only the advertised scratchpad; `planFile` only the
|
|
94
|
+
* advertised session plan file; `retainBackgroundProcesses` only the band's retain lane (Bash's lifetime sentence + row stamp). */
|
|
95
|
+
spec: Pick<TaskSpec, "additionalDirectories" | "additionalReadDirectories" | "envFacts" | "planFile" | "handsReadOnly" | "readDenyPatterns" | "readFace" | "writeFace" | "oneShot" | "resumeAt" | "retainBackgroundProcesses" | "sessionId" | "tools" | "excludeAllTools">;
|
|
92
96
|
/** borrowed-readonly — the deployment seats this phase reads, as a Pick over the SAME deps
|
|
93
97
|
* object (R-4: `deps.onError?.()` keeps its receiver; a new deps read must widen this Pick).
|
|
94
98
|
* `readDenyBuiltinTiers`/`readDenyBuiltinExclude` are SNAPSHOTTED before the first await that
|
|
@@ -215,6 +219,8 @@ export interface PrepareHandsReadFaceResult {
|
|
|
215
219
|
/** owned — the same station's pre-spawn ADMISSION, published for the P11 face that spawns a shell command
|
|
216
220
|
* and mounts LATER than the band (`Monitor`): the SAME function the band's shell faces got. ⇔ a real shell. */
|
|
217
221
|
shellReadAdmission: ShellReadAdmission | undefined;
|
|
222
|
+
/** owned — the same station's landings of a judged call (`ShellReadStation.landings`): the park binds them, the resumed leg's execution station compares. ⇔ a real shell. */
|
|
223
|
+
shellReadLandings: ShellReadLandings | undefined;
|
|
218
224
|
/** owned — the file read station's admission (`FileReadStation.admitted`) the band's read tools got, for the read tools mounted later (LSP). */
|
|
219
225
|
readAdmission: ((toolCallId: string | undefined, canonicalKey: string) => boolean) | undefined;
|
|
220
226
|
/** write-back (D-3 hold) — the run's RESOLVED read face where hands mount; undefined ⇔ no hands
|
|
@@ -86,6 +86,7 @@ export function resolveHandsLessReadFace(input) {
|
|
|
86
86
|
shellReadCheck: undefined,
|
|
87
87
|
shellReadStationArmed: false,
|
|
88
88
|
shellReadAdmission: undefined,
|
|
89
|
+
shellReadLandings: undefined,
|
|
89
90
|
readAdmission: undefined,
|
|
90
91
|
resolvedReadFace: undefined,
|
|
91
92
|
resolvedWriteFace: undefined,
|
|
@@ -171,6 +172,8 @@ export async function prepareHandsMount(input) {
|
|
|
171
172
|
if (advertisedWritableDirs !== undefined) {
|
|
172
173
|
if (spec.envFacts?.scratchpadDir)
|
|
173
174
|
await advertisedWritableDirs.admit({ path: spec.envFacts.scratchpadDir, advertiser: "scratchpad", materializeMarker: ".sema-scratchpad" });
|
|
175
|
+
if (spec.planFile !== undefined)
|
|
176
|
+
await advertisedWritableDirs.admitPlanFile(spec.planFile);
|
|
174
177
|
additionalRootsCanonical.push(...advertisedWritableDirs.roots);
|
|
175
178
|
}
|
|
176
179
|
for (const a of [additionalRootsCanonical, additionalReadRootsCanonical])
|
|
@@ -293,7 +296,7 @@ export async function prepareHandsMount(input) {
|
|
|
293
296
|
...denySeat,
|
|
294
297
|
...writeDenySeat,
|
|
295
298
|
...(input.personRows.unreadFor(toolCallId) ? { unreadPartitions: true } : {}),
|
|
296
|
-
writeRoots: [
|
|
299
|
+
writeRoots: [input.writeLocation(), ...additionalRootsCanonical],
|
|
297
300
|
...(resolvedWriteFace !== undefined ? { writeFace: resolvedWriteFace.inForce() } : {}),
|
|
298
301
|
...((judge) => (judge !== undefined ? { writeTargetJudge: judge } : {}))(input.writeTargetJudge?.()),
|
|
299
302
|
...(resolvedReadFace !== undefined ? { face: resolvedReadFace } : {}),
|
|
@@ -333,6 +336,7 @@ export async function prepareHandsMount(input) {
|
|
|
333
336
|
}
|
|
334
337
|
const band = createHandsToolkit(executionEnv, readFileState, rootCanonical, {
|
|
335
338
|
...(additionalRootsCanonical.length > 0 ? { additionalRoots: additionalRootsCanonical } : {}),
|
|
339
|
+
writeRoot: input.writeLocation,
|
|
336
340
|
readDenyHomes: carryReadFace([], { readDeny: tables.readDeny, writeDeny: tables.writeDeny, readRoots }),
|
|
337
341
|
readFace: liveReadFace,
|
|
338
342
|
writeFaceLive: resolvedWriteFace.inForce,
|
|
@@ -411,6 +415,7 @@ export async function prepareHandsMount(input) {
|
|
|
411
415
|
shellReadCheck: onPinnedRead(input.personRows, [...(shellReadStation !== undefined ? [{ check: shellReadStation.check, tools: shellReadTools }] : []), ...(fileReadStation !== undefined ? [fileReadStation] : [])]),
|
|
412
416
|
shellReadStationArmed: shellReadStation !== undefined,
|
|
413
417
|
shellReadAdmission: shellReadStation?.admit,
|
|
418
|
+
shellReadLandings: shellReadStation?.landings,
|
|
414
419
|
readAdmission: fileReadStation?.admitted,
|
|
415
420
|
resolvedReadFace,
|
|
416
421
|
resolvedWriteFace,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { BeforeWriteHook, EffectiveMemoryScopes, RunnerDeps, TaskSpec, ToolSpec } from "../types.js";
|
|
2
2
|
import { type CaptureEntitlementInput, type MemoryCapturePosture } from "./memory-capture-optout.js";
|
|
3
|
+
import { type SessionProjectVerdict } from "../memory-engine/scope-contract.js";
|
|
3
4
|
import type { Prepared } from "./contracts.js";
|
|
4
5
|
import type { AdvertisedWritableDirs } from "./advertised-writable-dirs.js";
|
|
5
6
|
export interface PrepareMemoryInput {
|
|
@@ -18,6 +19,8 @@ export interface PrepareMemoryInput {
|
|
|
18
19
|
/** borrowed-readonly — the resolved task root: the containment boundary every derived memory dir
|
|
19
20
|
* is checked against, and the repo-root fallback when `deps.rootPath` is unset. */
|
|
20
21
|
taskRootPath: string;
|
|
22
|
+
/** borrowed-readonly — the leg's ONE project verdict (`resolveSessionProject`, read here, never re-resolved). */
|
|
23
|
+
sessionProject: SessionProjectVerdict;
|
|
21
24
|
/**
|
|
22
25
|
* borrowed-readonly — #181-F5: whether a tool NAMED `Write` (the tool the CC `# Memory` instruction names) is on the
|
|
23
26
|
* ASSEMBLED roster this run, not excluded, AND can actually REACH the host-side memory root:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isAbsolute, sep } from "node:path";
|
|
2
2
|
import { deliverEngineNotice } from "../types.js";
|
|
3
3
|
import { admitMemoryScopes } from "../memory-admission.js";
|
|
4
|
-
import { adoptLegacyRepoDirs, canonicalize, deriveRepoControlPlaneDir, deriveProjectControlDir, deriveProjectMemoryDir, deriveRepoMemoryDir, drainMemoryAnnouncements, effectiveControlRootOf, enqueueMemoryAnnouncement, isContainedIn, lookupProjectIdHint, recordProjectIdHint, resolveMemoryEngineRoot } from "../memory-engine/layout.js";
|
|
4
|
+
import { adoptLegacyRepoDirs, canonicalize, deriveRepoControlPlaneDir, deriveProjectControlDir, deriveProjectMemoryDir, deriveRepoKey, deriveRepoMemoryDir, drainMemoryAnnouncements, effectiveControlRootOf, enqueueMemoryAnnouncement, isContainedIn, lookupProjectIdHint, recordProjectIdHint, resolveMemoryEngineRoot } from "../memory-engine/layout.js";
|
|
5
5
|
import { classifyScopePlanes, derivePersonalControlDir, derivePersonalMemoryDir, mergeHarvestReports, mergeInjections, needsDualRoots, parsedProjectPlane } from "../memory-engine/dual-root.js";
|
|
6
6
|
import { memoryProjectScopeAbsentNotice, normalizeMemorySpec } from "../memory.js";
|
|
7
7
|
import { deriveSupersededSet } from "../memory-engine/consolidation.js";
|
|
@@ -11,7 +11,7 @@ import { adjudicateCaptureOptOut, captureOptOutDeniedError, captureOptOutUnpersi
|
|
|
11
11
|
import { readSessionCaptureOptOut } from "../memory-engine/layout.js";
|
|
12
12
|
import { sessionIncarnationResolver } from "../memory-engine/session-incarnation.js";
|
|
13
13
|
import { createMemoryEngineTools } from "../memory-engine/tools.js";
|
|
14
|
-
import { assertScopeContractPlacement, parseScopeKey
|
|
14
|
+
import { assertScopeContractPlacement, parseScopeKey } from "../memory-engine/scope-contract.js";
|
|
15
15
|
import { FileMemoryEngineBackend } from "../memory-engine/file-backend.js";
|
|
16
16
|
import { writableRootOf } from "../memory-engine/types.js";
|
|
17
17
|
import { catalogText } from "../../prompt-assembly/catalog/index.js";
|
|
@@ -112,19 +112,24 @@ export async function prepareMemory(input) {
|
|
|
112
112
|
const consumesProjectIdentity = [...memorySpec.scopes, ...(memorySpec.writeScope !== null ? [memorySpec.writeScope] : [])]
|
|
113
113
|
.map(parseScopeKey)
|
|
114
114
|
.some((k) => k.kind === "proj" || k.kind === "userproj");
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
catch (err) {
|
|
120
|
-
if (consumesProjectIdentity)
|
|
121
|
-
throw err;
|
|
122
|
-
deps.onError?.(asThrownError(err), { phase: "config", sessionId });
|
|
123
|
-
}
|
|
115
|
+
if (input.sessionProject.markerFault !== undefined && consumesProjectIdentity)
|
|
116
|
+
throw input.sessionProject.markerFault;
|
|
117
|
+
const marker = input.sessionProject.project?.source === "marker" ? { projectId: input.sessionProject.project.id } : undefined;
|
|
118
|
+
const verdictOnPartitionRoot = deriveRepoKey(input.sessionProject.root) === deriveRepoKey(repoRoot);
|
|
124
119
|
if (marker) {
|
|
125
120
|
identityKey = marker.projectId;
|
|
126
|
-
|
|
127
|
-
|
|
121
|
+
if (memorySpec.writeScope !== null) {
|
|
122
|
+
const w = parseScopeKey(memorySpec.writeScope);
|
|
123
|
+
if ((w.kind === "proj" || w.kind === "userproj") && w.projectId !== marker.projectId) {
|
|
124
|
+
const e = new Error(`memory scope contract v2: writeScope ${memorySpec.writeScope} targets projectId ${w.projectId}, ` +
|
|
125
|
+
`but this checkout's marker (.sema/project) declares ${marker.projectId} — refusing a mis-addressed write.`);
|
|
126
|
+
e.code = "config.memory_project_identity";
|
|
127
|
+
throw e;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
const firstSwitch = verdictOnPartitionRoot && lookupProjectIdHint(engineRoot, repoRoot) !== marker.projectId;
|
|
131
|
+
if (verdictOnPartitionRoot)
|
|
132
|
+
recordProjectIdHint(engineRoot, repoRoot, marker.projectId);
|
|
128
133
|
if (firstSwitch) {
|
|
129
134
|
try {
|
|
130
135
|
const oldCtl = deriveRepoControlPlaneDir(engineRoot, repoRoot);
|
|
@@ -136,17 +141,8 @@ export async function prepareMemory(input) {
|
|
|
136
141
|
catch {
|
|
137
142
|
}
|
|
138
143
|
}
|
|
139
|
-
if (memorySpec.writeScope !== null) {
|
|
140
|
-
const w = parseScopeKey(memorySpec.writeScope);
|
|
141
|
-
if ((w.kind === "proj" || w.kind === "userproj") && w.projectId !== marker.projectId) {
|
|
142
|
-
const e = new Error(`memory scope contract v2: writeScope ${memorySpec.writeScope} targets projectId ${w.projectId}, ` +
|
|
143
|
-
`but this checkout's marker (.sema/project) declares ${marker.projectId} — refusing a mis-addressed write.`);
|
|
144
|
-
e.code = "config.memory_project_identity";
|
|
145
|
-
throw e;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
144
|
}
|
|
149
|
-
else {
|
|
145
|
+
else if (verdictOnPartitionRoot) {
|
|
150
146
|
const hint = lookupProjectIdHint(engineRoot, repoRoot);
|
|
151
147
|
if (hint !== undefined) {
|
|
152
148
|
deps.onError?.(new Error(`memory project marker missing but recoverable: ${repoRoot} previously carried projectId ${hint} ` +
|
|
@@ -102,6 +102,8 @@ export interface PrepareParkAskInput {
|
|
|
102
102
|
handsRoot: string | undefined;
|
|
103
103
|
/** borrowed-readonly — the live gate's target-reading stamp ({@link import("./prepare-ask-lane.js").PrepareAskLaneInput.stampCallTarget}). */
|
|
104
104
|
stampCallTarget: CallTargetStamp | undefined;
|
|
105
|
+
/** borrowed-readonly — where the leg's shell read station found a judged call's reads land (the approval object's targets). */
|
|
106
|
+
shellReadLandings: import("../../tools/fs/shell-read-check.js").ShellReadLandings | undefined;
|
|
105
107
|
/** borrowed-readonly — the SAME seat the live gate stamps from ({@link import("./prepare-ask-lane.js").PrepareAskLaneInput.advertisedWritableDirs}): a parked call's projection re-adjudication asks one question about one call, so it must ask it against the same admitted list. Read at park time, not written here. */
|
|
106
108
|
advertisedWritableDirs: Pick<AdvertisedWritableDirs, "roots"> | undefined;
|
|
107
109
|
/** borrowed-readonly — the leg's ONE exempt root, the SAME list the live gate stamps ({@link import("./prepare-ask-lane.js").PrepareAskLaneInput.exemptRoots}). */
|
|
@@ -29,7 +29,7 @@ const wordlessDemand = (toolName) => {
|
|
|
29
29
|
throw new Error(`a real-approval demand for "${toolName}" reached the park with no origin word — the origin stamp precedes every park`);
|
|
30
30
|
};
|
|
31
31
|
export function prepareParkAsk(input) {
|
|
32
|
-
const { askLane, saga, spec, deps, sessionId, checkpointStore, checkpointScope, toolRosterDeltas, parkLaneArmed, contentAskRoutable, liveQuestionFace, mountedQuestionTool, contentAskBindings, lateStrandedAnswers, discloseStrandedAnswers, onAsk, runtimeCaps, inheritedUnavailableAsks, basePolicyForResumeEdit, budgetSnapshot, handsCwdRef, handsRoot, stampCallTarget, advertisedWritableDirs, exemptRoots, offloadStore, ownedEnv, incompleteSuspendAdapter, session, sessions, suspendChainBase, maxSuspends, remoteEnvFailures, shellGatedTools, irreversibilityTier, toolMarkSources, effectiveShellGate, durableApproval, priorLedger, liveSpendRef, resourceTotal, ruleOffersOf, grantBindingOf, now, humanReviewRef, abortController, harness, pausedRef } = input;
|
|
32
|
+
const { askLane, saga, spec, deps, sessionId, checkpointStore, checkpointScope, toolRosterDeltas, parkLaneArmed, contentAskRoutable, liveQuestionFace, mountedQuestionTool, contentAskBindings, lateStrandedAnswers, discloseStrandedAnswers, onAsk, runtimeCaps, inheritedUnavailableAsks, basePolicyForResumeEdit, budgetSnapshot, handsCwdRef, handsRoot, stampCallTarget, shellReadLandings, advertisedWritableDirs, exemptRoots, offloadStore, ownedEnv, incompleteSuspendAdapter, session, sessions, suspendChainBase, maxSuspends, remoteEnvFailures, shellGatedTools, irreversibilityTier, toolMarkSources, effectiveShellGate, durableApproval, priorLedger, liveSpendRef, resourceTotal, ruleOffersOf, grantBindingOf, now, humanReviewRef, abortController, harness, pausedRef } = input;
|
|
33
33
|
if (askLane === undefined || saga === undefined)
|
|
34
34
|
return { parkAsk: undefined };
|
|
35
35
|
const { composedCallSignal, approvalPreviewOf } = askLane;
|
|
@@ -311,7 +311,7 @@ export function prepareParkAsk(input) {
|
|
|
311
311
|
toolCallId: req.toolCallId,
|
|
312
312
|
toolName: req.toolName,
|
|
313
313
|
...parkedToolIdentity(toolRosterDeltas.current, req.toolName), ...parkedToolFace(toolRosterDeltas.current, req),
|
|
314
|
-
...
|
|
314
|
+
...(licenseCovers(parkedHash, req.args) ? approvalTargetsOf(callTargetReadingOf(req), shellReadLandings?.(req.toolCallId)) : {}),
|
|
315
315
|
args: parkedArgs,
|
|
316
316
|
...(() => {
|
|
317
317
|
const p = approvalPreviewOf(req.toolName, parkedArgs);
|
|
@@ -66,9 +66,11 @@ export interface PreparePolicyChainInput {
|
|
|
66
66
|
hostTaskId: string;
|
|
67
67
|
/** borrowed-readonly — the FINAL task root (path rules resolve against it; the lanes' and the offers' root). */
|
|
68
68
|
taskRootFinal: string;
|
|
69
|
-
/** borrowed-readonly — the leg's canonical write roots beyond
|
|
70
|
-
* dirs): the `acceptEdits` mode gate allows writes inside the
|
|
69
|
+
/** borrowed-readonly — the leg's canonical write roots beyond its write location (`additionalDirectories` + advertised writable
|
|
70
|
+
* dirs): the `acceptEdits` mode gate allows writes inside the write location and these, and asks outside them all. */
|
|
71
71
|
additionalRootsCanonical: readonly string[];
|
|
72
|
+
/** borrowed-readonly — the leg's ONE write-location reader (`writeLocationOf`), read per call by the `acceptEdits` gate. */
|
|
73
|
+
writeLocation: () => string;
|
|
72
74
|
/** borrowed-readonly — the run's resolved env (path rules resolve in it; the sandbox declaration is read off it). */
|
|
73
75
|
executionEnv: ExecutionEnv;
|
|
74
76
|
/** borrowed-readonly — the frozen preflight as installed on this leg: `toolPolicy` (the caller slot) and
|
|
@@ -166,8 +168,6 @@ export interface PreparePolicyChainInput {
|
|
|
166
168
|
/** borrowed-readonly — the leg's live permission-mode seat: the mode gate policy layer and the inherited stations' arbitration
|
|
167
169
|
* read `current` per call. */
|
|
168
170
|
permissionMode: PermissionModeController;
|
|
169
|
-
/** borrowed-readonly — the task's scratchpad directory (the mode write gate's one exemption), or undefined. */
|
|
170
|
-
scratchpadDir: string | undefined;
|
|
171
171
|
/** borrowed-readonly — the leg's live roster seat; the mode write gate reads `current` per call. */ toolRosterDeltas: NonNullable<ModeGateSeats["roster"]>;
|
|
172
172
|
/** borrowed-readonly — the run's ONE typed stop for a denial-limit bound (the fallback settlements call it). */
|
|
173
173
|
stopForDenialLimit: StopForDenialLimit;
|
|
@@ -10,7 +10,7 @@ import { isIsolated } from "../remote-env.js";
|
|
|
10
10
|
import { deliverEngineNotice } from "../engine-notice.js";
|
|
11
11
|
import { earlierGrammarNotice } from "../session-policy-store.js";
|
|
12
12
|
import { attest, attestationOf, checkToolPolicyProjection, combinePolicies, createTranscriptIntegrityPolicy, createUnverifiableDeletePolicy, durableParkOptInDeclared, isLiveApproverSeat, mergeAttestation, refuseOutOfContractDecision, resolveAsk, toolPolicyNameSets, withAttestation, wrapToolPolicy } from "../tool-policy.js";
|
|
13
|
-
import { judgeRuleToolName, mountedToolNames } from "../tool-name-aliases.js";
|
|
13
|
+
import { judgeRuleToolName, mountedToolNames, nearMissSpellingOf } from "../tool-name-aliases.js";
|
|
14
14
|
import { approvalCardMemberOf } from "../tool-roster.js";
|
|
15
15
|
import { NAMESPACED_NAME_SHAPES } from "../protocol-table.js";
|
|
16
16
|
import { emitTrace } from "../trace.js";
|
|
@@ -18,7 +18,7 @@ import { skillGrantBindingMembers } from "../skill-grant.js";
|
|
|
18
18
|
import { SKILL_TOOL_NAME } from "./synthetic-tools.js";
|
|
19
19
|
import { delegationPoolReading } from "./sub-agent-deny-lists.js";
|
|
20
20
|
import { valveLeaves } from "../../agents/tool-filter.js";
|
|
21
|
-
import { autoStrippedRule, cardDisclosureOf,
|
|
21
|
+
import { autoStrippedRule, cardDisclosureOf, rootFacingToolNames } from "../allow-entry.js";
|
|
22
22
|
import { arbitrateByMode, askClassMembersOf, askFaceOf, askMandateMember } from "../ask-origin.js";
|
|
23
23
|
import { createModeGatePolicy, mountedToolDeclaresReadOnly } from "../mode-policy.js";
|
|
24
24
|
const ancestorFacts = (ask) => ({ ...(ask ?? {}), ancestorResolved: true });
|
|
@@ -32,7 +32,7 @@ import { policyThrowLine, reportPolicyThrow } from "./policy-throw.js";
|
|
|
32
32
|
import { heldBy, heldValues, seatOf, wireOf } from "../tool-name-readings.js";
|
|
33
33
|
import { hostFloorPolicy } from "../host-floor.js";
|
|
34
34
|
export async function preparePolicyChain(input) {
|
|
35
|
-
const { spec, deps, internals, sessionId, runId, hostTaskId, taskRootFinal, additionalRootsCanonical, executionEnv, lockedPreflight, pathRuleAnchors, headLeads, tools, harnessTools, selector, toolEffects, egressTools, irreversibilityTier, axisExplicitNegatives, shellGatedTools, toolMarkSources, envHandToolNames, handsCwdRef, readDenyMatcher, personRows, questionToolMounted, runtimeCaps, inheritedAncestorRules, ancestorSessionRulesRef, inheritedParentConstraints, seedInheritedGate, skillGrants, skillSpecs, allowedToolTables, frozenOnAsk, hookEnvSource, notifyOwnHookCrash, modBus, ownModChain, autoModeDecider, readFace, permissionMode,
|
|
35
|
+
const { spec, deps, internals, sessionId, runId, hostTaskId, taskRootFinal, additionalRootsCanonical, writeLocation, executionEnv, lockedPreflight, pathRuleAnchors, headLeads, tools, harnessTools, selector, toolEffects, egressTools, irreversibilityTier, axisExplicitNegatives, shellGatedTools, toolMarkSources, envHandToolNames, handsCwdRef, readDenyMatcher, personRows, questionToolMounted, runtimeCaps, inheritedAncestorRules, ancestorSessionRulesRef, inheritedParentConstraints, seedInheritedGate, skillGrants, skillSpecs, allowedToolTables, frozenOnAsk, hookEnvSource, notifyOwnHookCrash, modBus, ownModChain, autoModeDecider, readFace, permissionMode, toolRosterDeltas, stopForDenialLimit, delegation, abortController, now, ownSessionRulesRef, hostFloor } = input;
|
|
36
36
|
const ancestorArbitrations = new Map();
|
|
37
37
|
const arbitrateInherited = (ask, toolCallId, judged) => {
|
|
38
38
|
const verdict = arbitrateByMode(permissionMode.current, judged.classification, { origin: judged.origin, ...askMandateMember(ancestorFacts(judged.ask.action === "ask" ? judged.ask : undefined)) });
|
|
@@ -216,8 +216,6 @@ export async function preparePolicyChain(input) {
|
|
|
216
216
|
const missing = [];
|
|
217
217
|
if (store === undefined)
|
|
218
218
|
missing.push("a wired CheckpointStore");
|
|
219
|
-
else if (store.redecision?.reopen !== true)
|
|
220
|
-
missing.push("a CheckpointStore that DECLARES redecision.reopen (declaration, never duck-typing)");
|
|
221
219
|
if (spec.durableApproval === undefined && runtimeCaps?.forceDurableGate !== true)
|
|
222
220
|
missing.push("a durable park (spec.durableApproval, or the forceDurableGate entitlement)");
|
|
223
221
|
if (missing.length === 0)
|
|
@@ -611,7 +609,7 @@ export async function preparePolicyChain(input) {
|
|
|
611
609
|
}
|
|
612
610
|
return d;
|
|
613
611
|
}));
|
|
614
|
-
const modeGateLayer = createModeGatePolicy(permissionMode, { env: executionEnv, rootPath: taskRootFinal, acceptDirs: [
|
|
612
|
+
const modeGateLayer = createModeGatePolicy(permissionMode, { env: executionEnv, rootPath: taskRootFinal, acceptDirs: () => [writeLocation(), ...additionalRootsCanonical], roster: toolRosterDeltas, readOnlyDeclared: (name) => mountedToolDeclaresReadOnly(tools, name) });
|
|
615
613
|
const policyLayers = [...narrowingLayers, ...instrumentedChain, ...(rewriteCapableChain.length > 0 ? narrowingLayers : [])];
|
|
616
614
|
const integrityGuardLayers = [createTranscriptIntegrityPolicy(), createUnverifiableDeletePolicy({ removalSeat: { env: executionEnv, additionalRoots: () => additionalRootsCanonical } })];
|
|
617
615
|
const guardedPolicyLayers = [...integrityGuardLayers, ...policyLayers, modeGateLayer];
|
|
@@ -44,8 +44,8 @@ export interface PrepareProtocolToolsInput {
|
|
|
44
44
|
spec: Pick<TaskSpec, "principal" | "tools" | "excludeAllTools" | "signal">;
|
|
45
45
|
/** borrowed-readonly — the deployment seats the materializers and their operator faces read: `onElicit`
|
|
46
46
|
* and `mcpImageResizer` ride into the MCP intake; `onError` takes the A2A warnings (no ledger — a peer is
|
|
47
|
-
* re-read every prepare); `mcpRevocations` + `onNotice` make the revocation wiring. */
|
|
48
|
-
deps: Pick<RunnerDeps, "onElicit" | "mcpImageResizer" | "onError" | "mcpRevocations" | "onNotice">;
|
|
47
|
+
* re-read every prepare); `mcpRevocations` + `onNotice` make the revocation wiring; `peerSeat` answers what each MCP / A2A request carries. */
|
|
48
|
+
deps: Pick<RunnerDeps, "onElicit" | "mcpImageResizer" | "onError" | "mcpRevocations" | "onNotice" | "peerSeat">;
|
|
49
49
|
/** borrowed-readonly — the leg's mods bus: its `prompt.section` station disposes of each server's instructions at the dial. */
|
|
50
50
|
modBus: LegModBus;
|
|
51
51
|
/** borrowed-readonly — the run tree's MCP connection pool (the leg leases its connections from it) and whether THIS leg created it
|
|
@@ -59,6 +59,8 @@ export interface PrepareProtocolToolsInput {
|
|
|
59
59
|
/** borrowed-mutable — the reminder-disclosure counters: the MCP intake's bounding writes them here, and
|
|
60
60
|
* the run loop's attachment lanes keep writing the same object (`Prepared.reminderDisclosureCounts`). */
|
|
61
61
|
reminderDisclosureCounts: Prepared["reminderDisclosureCounts"];
|
|
62
|
+
/** borrowed-readonly — the leg's request-meta seat: every minted MCP tool reads what stands for its call, and the leg's session id (`_meta`). */
|
|
63
|
+
mcpRequestMeta: import("../mcp-call-meta.js").McpLegMetaReader;
|
|
62
64
|
/** borrowed-readonly — the run's invocation id (the revocation probe-failure notice names it). */
|
|
63
65
|
runId: string;
|
|
64
66
|
/** borrowed-readonly — the acquired session id (operator-line context). */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Type } from "typebox";
|
|
2
|
-
import {
|
|
2
|
+
import { materializeLegMcpTools } from "../mcp.js";
|
|
3
3
|
import { applyMcpRosterDelta, commitMcpRosterChanges, redialMcpServer, rosterHolding, settledOnRoster } from "./mcp-redial.js";
|
|
4
4
|
import { valveLeaves, valveLeavesPeer } from "../../agents/tool-filter.js";
|
|
5
5
|
import { resourceFacesLeft } from "../mounted-mcp.js";
|
|
@@ -30,7 +30,7 @@ export async function prepareProtocolTools(input) {
|
|
|
30
30
|
const leaves = valveLeaves(spec, toolFaceSnapshot.selector);
|
|
31
31
|
const resourcesReached = resourceFacesLeft(leaves);
|
|
32
32
|
const mcp = lockedPreflight.mcp?.length
|
|
33
|
-
? await
|
|
33
|
+
? await materializeLegMcpTools(input.mcpRequestMeta, lockedPreflight.mcp, spec.principal, deps.onElicit, deps.mcpImageResizer, { reminderMark, counts: reminderDisclosureCounts }, mcpRevocationWiring(deps, runId), mcpPool === undefined ? undefined : { pool: mcpPool.pool, ownsPool: mcpPool.owned }, sectionDisposerOf(input.modBus, abortController.signal), (entry) => resourcesReached || serverReached(mintNamespacePrefix(MCP_NAMESPACE, entry.name)), AbortSignal.any([abortController.signal, ...(spec.signal !== undefined ? [spec.signal] : [])]), hostFloor, deps.peerSeat)
|
|
34
34
|
:
|
|
35
35
|
{ tools: [], toolAxes: [], warnings: [], serverInstructions: [], instructionsDelta: { pendingAdds: [], pendingRemovals: [] }, droppedTools: [], statuses: [], refresh: async () => [], reconnect: async (server) => ({ server, prefix: mintNamespacePrefix(MCP_NAMESPACE, server), outcome: "not_declared", reason: "this task declared no MCP servers", toolCount: 0, added: [], removed: [] }), dispose: async () => { } };
|
|
36
36
|
if (lockedPreflight.mcp?.length)
|
|
@@ -167,7 +167,7 @@ export async function prepareProtocolTools(input) {
|
|
|
167
167
|
foldProtocolAxes(mcp.toolAxes, "MCP");
|
|
168
168
|
const a2aDeclared = lockedPreflight.a2a;
|
|
169
169
|
const a2a = a2aDeclared
|
|
170
|
-
? await materializeA2aTools(a2aDeclared, spec.principal, abortController.signal, hostFloor)
|
|
170
|
+
? await materializeA2aTools(a2aDeclared, spec.principal, abortController.signal, hostFloor, deps.peerSeat)
|
|
171
171
|
: { tools: [], toolAxes: [], warnings: [], statuses: [], refresh: async () => [], dispose: async () => { } };
|
|
172
172
|
if (a2aDeclared)
|
|
173
173
|
rollback.push(function a2aDispose() { return a2a.dispose(); });
|
|
@@ -169,6 +169,8 @@ export interface PrepareSuspendSagaInput {
|
|
|
169
169
|
placementRootResolved: string;
|
|
170
170
|
/** borrowed-readonly — this leg's checkpoint scope (the driver's one `checkpointScopeOf` derivation; the row's `legScope` stamp). */
|
|
171
171
|
checkpointScope: string;
|
|
172
|
+
/** borrowed-readonly — the config doors' one reading of the leg's run origin (the row's `runOrigin` stamp; absent ⇒ the host said nothing). */
|
|
173
|
+
runOrigin: SerializedCheckpointState["runOrigin"];
|
|
172
174
|
/** borrowed-readonly — the tool-selector layers this leg was spawned under (the live seat, else the resumed row's), the row's `toolCeiling` stamp. */
|
|
173
175
|
toolCeiling: readonly import("../tool-face.js").ToolSelectorLayer[] | undefined;
|
|
174
176
|
/** borrowed-readonly — the spawning run's judgment of this leg's own lists, while it is bound to them (`boundToolListsJudgment`), the row's `toolListsJudged` stamp. */
|
|
@@ -82,7 +82,7 @@ function stampPlacementRootSessionId(placementRootResolved) {
|
|
|
82
82
|
return placementValueOrAbsent(placementRootResolved);
|
|
83
83
|
}
|
|
84
84
|
export function prepareSuspendSaga(input) {
|
|
85
|
-
const { gateMachineryActive, abortController, harness, checkpointStore, deps, sessionId, hostTaskId, taskScope, liveSpendRef, resume, nestedStats, internals, activeTools, outputRef, readFileStateForCheckpoint, faceCheckpointSection, writeFaceCheckpointSection, skillGrantCheckpointSection, skillScopesCheckpointSection, reminderMark, handsCwdRef, handsRoot, handsHome, worktreeSessionRef, undeliveredContinuationRef, inheritedParentConstraints, seedInheritedGate, ancestorRulesNow, inheritedShellGate, permissionMode, inheritedAdmittedOrgScopes, inheritedPathRuleAnchors, inheritedPathRuleInstallations, ownOrgVerdictRef, orgGovernedProvenance, announcedListingsRef, gitStatusRef, hookIdentity, placementRootResolved, checkpointScope, toolCeiling, toolListsJudged, ownToolLists, externalContentTargetActive, crossBoundary, remoteEnvFailures, memoryEngineSession, suspendLoopRef, ownedEnv, incompleteSuspendAdapter } = input;
|
|
85
|
+
const { gateMachineryActive, abortController, harness, checkpointStore, deps, sessionId, hostTaskId, taskScope, liveSpendRef, resume, nestedStats, internals, activeTools, outputRef, readFileStateForCheckpoint, faceCheckpointSection, writeFaceCheckpointSection, skillGrantCheckpointSection, skillScopesCheckpointSection, reminderMark, handsCwdRef, handsRoot, handsHome, worktreeSessionRef, undeliveredContinuationRef, inheritedParentConstraints, seedInheritedGate, ancestorRulesNow, inheritedShellGate, permissionMode, inheritedAdmittedOrgScopes, inheritedPathRuleAnchors, inheritedPathRuleInstallations, ownOrgVerdictRef, orgGovernedProvenance, announcedListingsRef, gitStatusRef, hookIdentity, placementRootResolved, checkpointScope, runOrigin, toolCeiling, toolListsJudged, ownToolLists, externalContentTargetActive, crossBoundary, remoteEnvFailures, memoryEngineSession, suspendLoopRef, ownedEnv, incompleteSuspendAdapter } = input;
|
|
86
86
|
if (!gateMachineryActive)
|
|
87
87
|
return { saga: undefined };
|
|
88
88
|
const taskAccess = { owner: hostTaskId, scope: taskScope, sessionId };
|
|
@@ -178,6 +178,7 @@ export function prepareSuspendSaga(input) {
|
|
|
178
178
|
placementRootSessionId: stampPlacementRootSessionId(placementRootResolved),
|
|
179
179
|
externalContentTarget: externalContentTargetActive ? true : undefined,
|
|
180
180
|
legScope: checkpointScope,
|
|
181
|
+
runOrigin,
|
|
181
182
|
toolCeiling: toolCeiling !== undefined ? toolCeiling.map((l) => ({ ...(l.allow !== undefined ? { allow: persistedToolNameList(l.allow, "allowed") } : {}), deny: persistedToolNameList(l.deny, "denied") })) : undefined,
|
|
182
183
|
toolListsJudged,
|
|
183
184
|
ownToolLists: ownToolLists !== undefined ? { toolName: ownToolLists.toolName, ...(ownToolLists.definition !== undefined ? { definition: ownToolLists.definition } : {}), lists: ownToolLists.lists } : undefined,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { SessionStore } from "../session.js";
|
|
2
2
|
export { runGuardChain, type GuardChainArgs, type GuardChainOutcome } from "./prepare-context-lane.js";
|
|
3
|
+
import type { LegWrites } from "./session-write-ledger.js";
|
|
3
4
|
export { gatedCallIdOf, USAGE_WINDOW_REAP_MARGIN_MS } from "./park-commit.js";
|
|
4
5
|
export { batchContextAt } from "./prepare-park-ask.js";
|
|
5
6
|
export { compensateUnparkedPause } from "./prepare-suspend-saga.js";
|
|
@@ -115,7 +116,9 @@ runIdSink?: {
|
|
|
115
116
|
runId?: string;
|
|
116
117
|
},
|
|
117
118
|
/** The Runner's lock on this leg's session, handed only when the spec named none: taken the moment the store mints the id. */
|
|
118
|
-
holdSessionLock?: (sessionId: string) => Promise<void
|
|
119
|
+
holdSessionLock?: (sessionId: string) => Promise<void>,
|
|
120
|
+
/** This leg's view of the Runner's session write ledger (`session-write-ledger.ts`): the acquired storage writes through it. */
|
|
121
|
+
legWrites?: LegWrites): Promise<Prepared>;
|
|
119
122
|
/** The entry IS the contract the notification lane's seat names ({@link PrepareTaskFn}, contracts.ts):
|
|
120
123
|
* a signature change reds HERE, at the declaration, as `false` failing the `true` bound. IDENTITY, not assignability:
|
|
121
124
|
* the parameter tuple (arity, optionality, each type) and the return type must be the SAME type in both directions —
|