@sema-agent/core 7.58.0 → 7.59.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 +776 -0
- package/README.md +6 -4
- package/dist/agents/cc-peer-directory.js +8 -8
- package/dist/agents/child-model-seat.d.ts +4 -2
- package/dist/agents/child-model-seat.js +5 -3
- package/dist/agents/peer-directory.d.ts +9 -0
- package/dist/agents/peer-directory.js +6 -2
- package/dist/agents/send-message-tool.js +21 -12
- package/dist/agents/subagent.js +33 -34
- package/dist/brain/anthropic.js +161 -45
- package/dist/brain/errors.d.ts +9 -3
- package/dist/brain/errors.js +7 -1
- package/dist/brain/failover.js +2 -1
- package/dist/brain/open-responses.js +3 -3
- package/dist/brain/openai.js +103 -53
- package/dist/brain/provider-dialect.d.ts +11 -0
- package/dist/brain/provider-dialect.js +5 -2
- package/dist/brain/reasoning-request.js +5 -4
- package/dist/brain/reasoning.d.ts +19 -0
- package/dist/brain/reasoning.js +17 -2
- package/dist/brain/request-route.d.ts +4 -1
- package/dist/brain/request-route.js +4 -1
- package/dist/brain/route-adjudicator.d.ts +84 -18
- package/dist/brain/route-adjudicator.js +87 -21
- package/dist/brain/route-conformance.js +1 -1
- package/dist/brain/stream-engine.js +84 -49
- package/dist/brain/stream-shared.d.ts +30 -0
- package/dist/brain/stream-shared.js +34 -1
- package/dist/brain/timeout.d.ts +62 -5
- package/dist/brain/timeout.js +93 -6
- package/dist/core/account-row.d.ts +61 -0
- package/dist/core/account-row.js +51 -0
- package/dist/core/advisor-verdict.d.ts +2 -1
- package/dist/core/advisor-verdict.js +1 -1
- package/dist/core/allow-entry.d.ts +18 -6
- package/dist/core/allow-entry.js +16 -8
- package/dist/core/approval-object.d.ts +29 -15
- package/dist/core/approval-object.js +47 -19
- package/dist/core/auto-compaction.js +1 -1
- package/dist/core/background-agent-store.d.ts +16 -3
- package/dist/core/checkpoint-requirements.d.ts +13 -1
- package/dist/core/checkpoint-requirements.js +3 -1
- package/dist/core/checkpoint-store.d.ts +58 -12
- package/dist/core/checkpoint-store.js +18 -6
- package/dist/core/child-clamp-seats.d.ts +29 -0
- package/dist/core/child-clamp-seats.js +56 -1
- package/dist/core/compliance.d.ts +2 -2
- package/dist/core/compliance.js +1 -1
- package/dist/core/effective-path-target.d.ts +8 -2
- package/dist/core/effective-path-target.js +8 -3
- package/dist/core/engine-notice.d.ts +98 -8
- package/dist/core/engine-notice.js +19 -5
- package/dist/core/gate-fold.js +1 -1
- package/dist/core/gate-lanes.js +8 -4
- package/dist/core/gate-outcome.d.ts +32 -3
- package/dist/core/gate-outcome.js +19 -1
- package/dist/core/governance-codes.d.ts +9 -1
- package/dist/core/governance-codes.js +13 -0
- package/dist/core/hooks.d.ts +31 -3
- package/dist/core/hooks.js +5 -6
- package/dist/core/image-admission.d.ts +6 -5
- package/dist/core/image-admission.js +18 -14
- package/dist/core/locked-config.d.ts +5 -2
- package/dist/core/locked-config.js +2 -1
- package/dist/core/mailbox-store.d.ts +45 -1
- package/dist/core/mailbox-store.js +53 -9
- package/dist/core/mcp-failure.d.ts +114 -18
- package/dist/core/mcp-failure.js +63 -5
- package/dist/core/mcp-server-link.d.ts +22 -1
- package/dist/core/mcp-server-link.js +25 -1
- package/dist/core/mcp.d.ts +12 -8
- package/dist/core/mcp.js +42 -25
- package/dist/core/memory-engine/consolidation-driver.d.ts +2 -4
- package/dist/core/memory-engine/consolidation-driver.js +3 -3
- package/dist/core/memory-engine/consolidation.d.ts +4 -0
- package/dist/core/memory-engine/consolidation.js +1 -0
- package/dist/core/memory-engine/delegation-settlement.js +5 -12
- package/dist/core/memory-engine/distiller.js +2 -2
- package/dist/core/memory-engine/dual-root.d.ts +50 -1
- package/dist/core/memory-engine/dual-root.js +44 -1
- package/dist/core/memory-engine/engine.d.ts +67 -14
- package/dist/core/memory-engine/engine.js +384 -212
- package/dist/core/memory-engine/export-bundle.d.ts +23 -0
- package/dist/core/memory-engine/export-bundle.js +23 -4
- package/dist/core/memory-engine/file-backend.d.ts +128 -55
- package/dist/core/memory-engine/file-backend.js +290 -117
- package/dist/core/memory-engine/index.d.ts +1 -1
- package/dist/core/memory-engine/layout.d.ts +59 -11
- package/dist/core/memory-engine/layout.js +190 -40
- package/dist/core/memory-engine/memory-backend-contract.d.ts +1 -1
- package/dist/core/memory-engine/memory-backend-contract.js +39 -2
- package/dist/core/memory-engine/sync-client.d.ts +9 -1
- package/dist/core/memory-engine/sync-client.js +31 -8
- package/dist/core/memory-engine/sync.d.ts +5 -0
- package/dist/core/memory-engine/types.d.ts +6 -0
- package/dist/core/mods/classic-events.d.ts +5 -1
- package/dist/core/mods/kernel/dispatch.js +2 -1
- package/dist/core/mods/kernel/events.d.ts +2 -1
- package/dist/core/mods/kernel/events.js +2 -2
- package/dist/core/mods/kernel/registration.d.ts +4 -0
- package/dist/core/mods/kernel/registration.js +3 -0
- package/dist/core/mods/stations.d.ts +31 -10
- package/dist/core/mods/stations.js +44 -10
- package/dist/core/mods/tool-call.js +1 -1
- package/dist/core/parent-spec-seat.d.ts +8 -3
- package/dist/core/parent-spec-seat.js +2 -0
- package/dist/core/park-selfcheck.js +6 -0
- package/dist/core/peer-seat.d.ts +70 -8
- package/dist/core/peer-seat.js +143 -11
- package/dist/core/permission-rule-consent.js +10 -4
- package/dist/core/permission-rule-model.d.ts +16 -0
- package/dist/core/permission-rule-model.js +1 -1
- package/dist/core/present-plan-tool.d.ts +11 -3
- package/dist/core/present-plan-tool.js +2 -2
- package/dist/core/resume-startup-cause.js +1 -0
- package/dist/core/rewrite-rejudge.d.ts +1 -0
- package/dist/core/rewrite-rejudge.js +2 -2
- package/dist/core/roles.d.ts +34 -2
- package/dist/core/roles.js +43 -4
- package/dist/core/runner/announce-once-ledger.d.ts +5 -4
- package/dist/core/runner/announce-once-ledger.js +4 -2
- package/dist/core/runner/call-hook-stations.js +2 -2
- package/dist/core/runner/contracts.d.ts +20 -16
- package/dist/core/runner/credential-origin-seat.js +4 -3
- package/dist/core/runner/cwd-alignment-probe.d.ts +20 -0
- package/dist/core/runner/cwd-alignment-probe.js +21 -0
- package/dist/core/runner/decide-continuation.d.ts +2 -2
- package/dist/core/runner/gate-exit.d.ts +12 -4
- package/dist/core/runner/gate-exit.js +10 -7
- package/dist/core/runner/image-removed-seat.d.ts +12 -0
- package/dist/core/runner/image-removed-seat.js +19 -0
- package/dist/core/runner/inline-image.js +1 -1
- package/dist/core/runner/memory-consolidation-driver.js +3 -3
- package/dist/core/runner/park-commit.d.ts +1 -1
- package/dist/core/runner/park-commit.js +3 -0
- package/dist/core/runner/prepare-ask-lane.d.ts +1 -1
- package/dist/core/runner/prepare-ask-lane.js +2 -1
- package/dist/core/runner/prepare-boundary-parks.js +2 -2
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +3 -5
- package/dist/core/runner/prepare-caps-and-workflow.js +2 -0
- package/dist/core/runner/prepare-config-doors.js +2 -0
- package/dist/core/runner/prepare-context-lane.js +2 -0
- package/dist/core/runner/prepare-delegation-surface.d.ts +4 -0
- package/dist/core/runner/prepare-delegation-surface.js +1 -0
- package/dist/core/runner/prepare-hands-readface.d.ts +4 -0
- package/dist/core/runner/prepare-hands-readface.js +5 -0
- package/dist/core/runner/prepare-inherited-gate.d.ts +1 -3
- package/dist/core/runner/prepare-inherited-gate.js +14 -27
- package/dist/core/runner/prepare-memory.js +10 -17
- package/dist/core/runner/prepare-park-ask.d.ts +1 -1
- package/dist/core/runner/prepare-park-ask.js +2 -1
- package/dist/core/runner/prepare-policy-chain.d.ts +3 -3
- package/dist/core/runner/prepare-policy-chain.js +16 -13
- package/dist/core/runner/prepare-project-context.d.ts +2 -2
- package/dist/core/runner/prepare-project-context.js +2 -2
- package/dist/core/runner/prepare-prompt-inputs.d.ts +1 -1
- package/dist/core/runner/prepare-prompt-inputs.js +8 -19
- package/dist/core/runner/prepare-protocol-tools.js +9 -1
- package/dist/core/runner/prepare-run-refs.d.ts +2 -3
- package/dist/core/runner/prepare-run-refs.js +4 -1
- package/dist/core/runner/prepare-task.js +4 -2
- package/dist/core/runner/prepare-wiring-manifest.d.ts +1 -1
- package/dist/core/runner/prepare-wiring-manifest.js +2 -1
- package/dist/core/runner/reply-pricing.d.ts +30 -0
- package/dist/core/runner/reply-pricing.js +19 -0
- package/dist/core/runner/resume-admission.js +4 -2
- package/dist/core/runner/resume-apply.js +6 -1
- package/dist/core/runner/resume-policy-outcome.js +5 -5
- package/dist/core/runner/role-seat-defaulted.d.ts +44 -0
- package/dist/core/runner/role-seat-defaulted.js +40 -0
- package/dist/core/runner/run-brain-sinks.js +2 -0
- package/dist/core/runner/run-identity-wiring.d.ts +2 -5
- package/dist/core/runner/run-identity-wiring.js +5 -4
- package/dist/core/runner/run-leg.d.ts +2 -0
- package/dist/core/runner/run-leg.js +37 -28
- package/dist/core/runner/run-stop-and-final-verify.js +2 -2
- package/dist/core/runner/run-terminal-adoption.d.ts +2 -5
- package/dist/core/runner/run-terminal-adoption.js +9 -3
- package/dist/core/runner/run-turn-boundary.js +77 -70
- package/dist/core/runner/runtask.d.ts +1 -1
- package/dist/core/runner/runtask.js +2 -2
- package/dist/core/runner/side-call-account.d.ts +1 -1
- package/dist/core/runner/side-call-account.js +3 -18
- package/dist/core/runner/sub-agent-deny-lists.d.ts +24 -0
- package/dist/core/runner/sub-agent-deny-lists.js +10 -0
- package/dist/core/runner/tool-end-body.js +2 -2
- package/dist/core/runner/tool-occurrence.d.ts +1 -1
- package/dist/core/runner/tool-occurrence.js +2 -2
- package/dist/core/runner/turn-attachments.d.ts +26 -22
- package/dist/core/runner/turn-attachments.js +24 -26
- package/dist/core/runner-deps.d.ts +1 -1
- package/dist/core/secret-env.d.ts +32 -2
- package/dist/core/secret-env.js +65 -3
- package/dist/core/sensitive-path-policy.js +3 -3
- package/dist/core/session-policy-store.d.ts +3 -1
- package/dist/core/session-policy-store.js +13 -9
- package/dist/core/session-store.d.ts +2 -5
- package/dist/core/side-query.d.ts +11 -1
- package/dist/core/side-query.js +9 -0
- package/dist/core/skill-grant-binding.d.ts +31 -2
- package/dist/core/skill-grant-binding.js +31 -1
- package/dist/core/skill-grant.d.ts +8 -5
- package/dist/core/skill-grant.js +6 -6
- package/dist/core/store-contracts/background-agent-store-contract.js +27 -0
- package/dist/core/store-contracts/checkpoint-store-contract.js +3 -2
- package/dist/core/store-contracts/mailbox-store-contract.js +31 -1
- package/dist/core/synthetic-read-verdict.js +2 -1
- package/dist/core/task-event.d.ts +32 -8
- package/dist/core/task-notification.js +16 -10
- package/dist/core/task-registry-agent.js +1 -0
- package/dist/core/task-registry-shared.d.ts +5 -0
- package/dist/core/task-spec.d.ts +12 -1
- package/dist/core/terminal-cause.d.ts +10 -0
- package/dist/core/tool-check-reading.d.ts +1 -0
- package/dist/core/tool-check-reading.js +3 -3
- package/dist/core/tool-policy.d.ts +16 -0
- package/dist/core/tool-roster.d.ts +112 -5
- package/dist/core/tool-roster.js +42 -1
- package/dist/core/tool-spec.d.ts +3 -1
- package/dist/core/types.d.ts +2 -2
- package/dist/core/types.js +1 -1
- package/dist/core/user-attachment.js +1 -1
- package/dist/core/wiring-manifest.d.ts +6 -3
- package/dist/engine/compaction/compaction.js +29 -3
- package/dist/engine/execution-env/node-execution-env.d.ts +4 -3
- package/dist/engine/execution-env/node-execution-env.js +9 -12
- package/dist/engine/harness/agent-harness.d.ts +25 -2
- package/dist/engine/harness/agent-harness.js +41 -12
- package/dist/engine/harness/messages.d.ts +3 -1
- package/dist/engine/harness/messages.js +3 -2
- package/dist/engine/harness/types.d.ts +8 -0
- package/dist/engine/llm/rejected-images.d.ts +46 -0
- package/dist/engine/llm/rejected-images.js +54 -0
- package/dist/engine/llm/tool-turns.d.ts +2 -1
- package/dist/engine/llm/types.d.ts +18 -7
- package/dist/engine/loop/agent-loop.d.ts +8 -0
- package/dist/engine/loop/agent-loop.js +52 -15
- package/dist/engine/loop/types.d.ts +3 -1
- package/dist/engine/session/path-to-root.d.ts +38 -0
- package/dist/engine/session/path-to-root.js +39 -0
- package/dist/engine/session/storage-base.js +4 -21
- package/dist/index.d.ts +16 -10
- package/dist/index.js +11 -7
- package/dist/internal/harness-types.d.ts +1 -1
- package/dist/internal/harness.d.ts +1 -0
- package/dist/internal/llm.d.ts +1 -0
- package/dist/orchestration/workflow-observe.d.ts +17 -1
- package/dist/orchestration/workflow-observe.js +20 -0
- package/dist/orchestration/workflow-types.d.ts +32 -7
- package/dist/orchestration/workflow.js +739 -489
- package/dist/shell/counting-pass.d.ts +50 -0
- package/dist/shell/counting-pass.js +502 -0
- package/dist/shell/lex.d.ts +4 -2
- package/dist/shell/lex.js +93 -34
- package/dist/shell/shell-words.d.ts +1 -1
- package/dist/shell/shell-words.js +7 -6
- package/dist/stores/file/mailbox-store.js +6 -10
- package/dist/tools/fs/fs-bash.d.ts +6 -0
- package/dist/tools/fs/fs-bash.js +6 -3
- package/dist/tools/fs/index.js +6 -2
- package/dist/tools/fs/program-read-model.d.ts +13 -0
- package/dist/tools/fs/program-read-model.js +15 -0
- package/dist/tools/fs/program-read-model.rows.js +1 -1
- package/dist/tools/fs/read-deny.d.ts +13 -10
- package/dist/tools/fs/read-deny.js +25 -5
- package/dist/tools/fs/read-floor.d.ts +19 -0
- package/dist/tools/fs/read-floor.js +23 -0
- package/dist/tools/fs/shell-read-check.d.ts +1 -1
- package/dist/tools/fs/shell-read-check.js +2 -1
- package/dist/tools/fs/shell-read-judge.d.ts +16 -8
- package/dist/tools/fs/shell-read-judge.js +10 -6
- package/dist/tools/fs/shell-read-plan.d.ts +6 -1
- package/dist/tools/fs/shell-read-plan.js +22 -15
- package/dist/tools/fs/shell-read-start.js +1 -0
- package/dist/tools/fs/shell-reentry-text.d.ts +15 -1
- package/dist/tools/fs/shell-reentry-text.js +25 -3
- package/dist/tools/monitor.d.ts +4 -0
- package/dist/tools/monitor.js +2 -0
- package/package.json +3 -2
- package/test/export-surface.snapshot.json +87 -1
- package/wire-changes/core-stores-sql@7.59.0.json +29 -0
- package/wire-changes/core@7.59.0.json +2459 -0
- package/wire-changes/mods-kernel@7.59.0.json +29 -0
- package/wire-changes/primitives@7.59.0.json +29 -0
|
@@ -17,7 +17,7 @@ import type { HumanReviewGateRow } from "../task-result.js";
|
|
|
17
17
|
import type { RepairBundle } from "../../agents/repair-loop.js";
|
|
18
18
|
import type { SubagentRetainLedger } from "../../agents/retain-ledger.js";
|
|
19
19
|
import type { BrainCallGuardrailRef } from "../../brain/timeout.js";
|
|
20
|
-
import type { ActiveWorktreeSession, AgentHarness, AgentMessage, AgentTool, AnnouncedListingSnapshotInput,
|
|
20
|
+
import type { ActiveWorktreeSession, AgentHarness, AgentMessage, AgentTool, AnnouncedListingSnapshotInput, ExecutionEnv, ThinkingLevel } from "../../internal/harness.js";
|
|
21
21
|
import type { Model } from "../../internal/llm.js";
|
|
22
22
|
import type { WorkflowSizeGuideline } from "../../orchestration/workflow-size-guideline.js";
|
|
23
23
|
import type { ToolManifestRow } from "../../prompt-assembly/tool-catalog.js";
|
|
@@ -63,7 +63,7 @@ import type { GitStatusLaneRef } from "./git-status-frame.js";
|
|
|
63
63
|
import type { SessionReadFileStates } from "./session-read-file-states.js";
|
|
64
64
|
import type { LegModeCeiling, SessionModeSeats } from "./session-mode-seats.js";
|
|
65
65
|
import type { BlockedRef, OutputRef, SkillListingEntry } from "./synthetic-tools.js";
|
|
66
|
-
import type { createAttachmentState, WriteFamily } from "./turn-attachments.js";
|
|
66
|
+
import type { AttachmentSource, createAttachmentState, WriteFamily } from "./turn-attachments.js";
|
|
67
67
|
import type { SideCallBook } from "./side-call-account.js";
|
|
68
68
|
import type { cacheFamilyOf } from "./usage-accounting.js";
|
|
69
69
|
/**
|
|
@@ -221,20 +221,20 @@ export interface DateAnchorRead {
|
|
|
221
221
|
* One engine frame whose commit waits for the receipt of the message carrying it.
|
|
222
222
|
*
|
|
223
223
|
* @contract frames.commit_on_receipt — an engine-minted frame that rides a user message (the git-status
|
|
224
|
-
* frame,
|
|
225
|
-
*
|
|
226
|
-
*
|
|
227
|
-
*
|
|
228
|
-
*
|
|
229
|
-
*
|
|
230
|
-
* fact the model was recorded as told and was not.
|
|
224
|
+
* frame, a leg's first-request frames, every turn-boundary attachment, a limit-approach notice) is recorded —
|
|
225
|
+
* an announced set or value, a drained pending entry, a once digest, a window's stamp, a latch, its echo and count
|
|
226
|
+
* — ONLY when the run loop's `message_end` walk sees a persisted user entry whose text equals the carrying text it
|
|
227
|
+
* was registered with; every receipt with that text settles on that one entry. Collection records nothing: a
|
|
228
|
+
* message that never reaches the transcript (a pre-append failure, a suppressed or undrained steer, a leg that
|
|
229
|
+
* ends first) leaves the frame unannounced, and the next boundary or leg renders it again. A lost receipt costs a
|
|
230
|
+
* duplicate frame, never a fact the model was recorded as told and was not.
|
|
231
231
|
*/
|
|
232
232
|
export interface FrameReceipt {
|
|
233
233
|
/** The carrying message's exact text (its first text block) — the receipt's match key. */
|
|
234
234
|
text: string;
|
|
235
235
|
/** Which frame this receipt settles. No collector renders a frame whose receipt is still pending (the frame is on
|
|
236
236
|
* its way, not yet in the transcript) — the one reading is `frameCarried` (compaction-restate.ts). */
|
|
237
|
-
source: "git_status" | "
|
|
237
|
+
source: "git_status" | "posture" | "advisor_tool" | "limit_approach" | AttachmentSource;
|
|
238
238
|
/** Runs inside the `message_end` walk (synchronous, never awaited): advances the run-local record
|
|
239
239
|
* and parks any session write for the next serialization point. */
|
|
240
240
|
commit: (entryId: string) => void;
|
|
@@ -472,6 +472,7 @@ export interface Prepared {
|
|
|
472
472
|
decidedBy: HostDecider;
|
|
473
473
|
}) => Promise<{
|
|
474
474
|
readonly refused: string;
|
|
475
|
+
readonly extension?: string;
|
|
475
476
|
} | {
|
|
476
477
|
readonly args: unknown;
|
|
477
478
|
readonly admit: () => void;
|
|
@@ -890,18 +891,17 @@ export interface Prepared {
|
|
|
890
891
|
/** Set by a tool calling `ctx.requestReview()` (the first-party `present_plan` tool, CC
|
|
891
892
|
* ExitPlanMode parity): the run loop honors it at the next CLEAN turn boundary by minting a `plan_review`
|
|
892
893
|
* checkpoint. `{ pending }` is set (with an optional reason) the moment a tool requests review; the boundary
|
|
893
|
-
* reads + clears it. First request in a batch wins (idempotent)
|
|
894
|
+
* reads + clears it. First request in a batch wins (idempotent), and so does its `requestedByCallId` — the
|
|
895
|
+
* engine-bound id of the call that asked, which the mint writes onto the parked row. */
|
|
894
896
|
reviewRequestRef: {
|
|
895
|
-
pending?:
|
|
896
|
-
reason?: string;
|
|
897
|
-
};
|
|
897
|
+
pending?: import("../present-plan-tool.js").ReviewRequest;
|
|
898
898
|
};
|
|
899
899
|
/** Present (≠ undefined) ONLY when a `checkpointStore` is wired (the deployment can pause). The
|
|
900
900
|
* run loop calls it at a CLEAN turn boundary when `reviewRequestRef.pending` is set: it mints a `plan_review`
|
|
901
901
|
* checkpoint (`status:"needs_review"` by its registry row) + pauses the workspace + aborts the loop, reusing
|
|
902
902
|
* the SAME commit saga as the human/resource suspends. Returns true iff it committed a resumable checkpoint;
|
|
903
903
|
* false ⇒ the request could not be honored (caller drops it and continues). */
|
|
904
|
-
suspendForReview?: (reason?: string) => Promise<boolean>;
|
|
904
|
+
suspendForReview?: (reason?: string, requestedByCallId?: string) => Promise<boolean>;
|
|
905
905
|
/** The prior cross-slice {@link ResourceLedger} (from the resumed checkpoint), so the run
|
|
906
906
|
* loop can size this slice's effective budget = `min(maxCostUsd, remaining)`. Undefined on the first slice
|
|
907
907
|
* (or a non-resource task). */
|
|
@@ -1165,7 +1165,7 @@ export interface Prepared {
|
|
|
1165
1165
|
* task whose every MCP tool went missing with its server is exactly the one that must say so. Carried by the leg's first
|
|
1166
1166
|
* request (a fresh leg's first message, a resumed leg's continuation) and drained by that message's receipt (`settleMcpUnavailable`). */
|
|
1167
1167
|
mcpUnavailable?: {
|
|
1168
|
-
pending:
|
|
1168
|
+
pending: import("../mcp-failure.js").McpUnavailableEntry[];
|
|
1169
1169
|
};
|
|
1170
1170
|
/** G1 通告层续批 (CC `agent_listing_delta` parity) — the mounted delegation tool's agent-type roster
|
|
1171
1171
|
* (read off `ToolSpec.agentListing`, filled by createSubagentTool), plus the tool's mounted name for
|
|
@@ -1839,6 +1839,10 @@ export interface RunInternals {
|
|
|
1839
1839
|
* mirroring `insideFork`.
|
|
1840
1840
|
*/
|
|
1841
1841
|
isDelegatedChild?: boolean;
|
|
1842
|
+
/** `true` iff this delegated leg's objective carries an operator's words — minted ONLY by a retained child's resume
|
|
1843
|
+
* through its steer handle (a SendMessage resume is a peer's): it passes `classic.UserPromptSubmit` before the leg
|
|
1844
|
+
* opens on `classic.SubagentStart`. TRUSTED run-scoped channel (NOT a {@link TaskSpec} field). */
|
|
1845
|
+
operatorObjective?: true;
|
|
1842
1846
|
/**
|
|
1843
1847
|
* Subagent transcript persistence — the child transcript session's PLACEMENT declaration, minted
|
|
1844
1848
|
* by the background delegation lane (the trusted spawner: it knows the a* handle, scope and root)
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { KEYLESS_EXIT } from "../../brain/route-adjudicator.js";
|
|
1
2
|
import { runWithCredentialOriginRefusals } from "../../brain/status-sink.js";
|
|
2
3
|
import { deliverEngineNotice } from "../engine-notice.js";
|
|
3
4
|
export function createCredentialOriginRefusalScope({ onNotice, sessionId, runId }) {
|
|
@@ -9,10 +10,10 @@ export function createCredentialOriginRefusalScope({ onNotice, sessionId, runId
|
|
|
9
10
|
announced.add(key);
|
|
10
11
|
deliverEngineNotice(onNotice, {
|
|
11
12
|
code: "route.credential_origin_mismatch",
|
|
12
|
-
message: `A request for model "${modelId}" was not sent: the model's own credential belongs to ${boundOrigin}
|
|
13
|
-
`first sent to, and this request was going to ${requestOrigin}. A credential does not follow its model to another host — ` +
|
|
13
|
+
message: `A request for model "${modelId}" was not sent: the model's own credential belongs to ${boundOrigin} (the host it was ` +
|
|
14
|
+
`first sent to, or the one the deployment rebound it to), and this request was going to ${requestOrigin}. A credential does not follow its model to another host — ` +
|
|
14
15
|
`the deployment has to give the model a credential for ${requestOrigin} (or point it back at ${boundOrigin}). ` +
|
|
15
|
-
`Said once per run for this model and these two hosts.`,
|
|
16
|
+
`If ${requestOrigin} takes no credential, ${KEYLESS_EXIT}. Said once per run for this model and these two hosts.`,
|
|
16
17
|
detail: { modelId, boundOrigin, requestOrigin, sessionId, runId },
|
|
17
18
|
});
|
|
18
19
|
}, fn);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** The shell's answer. `unknown` = the root is not a directory in the shell's view, or its `test` has no `-ef`:
|
|
2
|
+
* no judgment, so no observation. */
|
|
3
|
+
export type CwdAlignmentVerdict = "same" | "differ" | "unknown";
|
|
4
|
+
/**
|
|
5
|
+
* The probe's last sub-command: the shell asks whether its working directory and the task root are one directory
|
|
6
|
+
* (`test . -ef <root>`: the same filesystem object, links followed, spelling and case irrelevant) and prints one
|
|
7
|
+
* line `cwd-alignment:<same|differ|unknown>:<its pwd -P>`. The line carries its own marker, so a banner a login
|
|
8
|
+
* shell prints first moves nothing.
|
|
9
|
+
*/
|
|
10
|
+
export declare function cwdAlignmentProbe(taskRoot: string): string;
|
|
11
|
+
/** The framed answer and the shell's own `pwd -P` reading, found by its marker (the last such line — the probe's
|
|
12
|
+
* last sub-command — wherever earlier output put it); a word outside the closed set reads `unknown`; no framed
|
|
13
|
+
* line at all reads `undefined` (the probe's tail never arrived: nothing to judge). */
|
|
14
|
+
export declare function readCwdAlignment(lines: readonly string[]): {
|
|
15
|
+
verdict: CwdAlignmentVerdict;
|
|
16
|
+
shellPwd: string;
|
|
17
|
+
} | undefined;
|
|
18
|
+
/** The operator-lane sentence for a `differ` verdict: the two readings and the shell's finding, nothing about
|
|
19
|
+
* where an exec or an artifact would land. */
|
|
20
|
+
export declare function cwdMisalignmentMessage(taskRoot: string, shellPwd: string): string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { shellQuote } from "../../tools/fs/search.js";
|
|
2
|
+
const CWD_ALIGNMENT_MARK = "cwd-alignment:";
|
|
3
|
+
export function cwdAlignmentProbe(taskRoot) {
|
|
4
|
+
const root = shellQuote(taskRoot);
|
|
5
|
+
return `(p=$(pwd -P 2>/dev/null || pwd); if test -d ${root} >/dev/null 2>&1; then test . -ef ${root} >/dev/null 2>&1; case $? in 0) v=same;; 1) v=differ;; *) v=unknown;; esac; else v=unknown; fi; printf '%s\\n' "${CWD_ALIGNMENT_MARK}$v:$p")`;
|
|
6
|
+
}
|
|
7
|
+
export function readCwdAlignment(lines) {
|
|
8
|
+
for (let i = lines.length - 1; i >= 0; i--) {
|
|
9
|
+
const line = lines[i] ?? "";
|
|
10
|
+
if (!line.startsWith(CWD_ALIGNMENT_MARK))
|
|
11
|
+
continue;
|
|
12
|
+
const rest = line.slice(CWD_ALIGNMENT_MARK.length);
|
|
13
|
+
const cut = rest.indexOf(":");
|
|
14
|
+
const word = cut < 0 ? rest : rest.slice(0, cut);
|
|
15
|
+
return { verdict: word === "same" || word === "differ" ? word : "unknown", shellPwd: cut < 0 ? "" : rest.slice(cut + 1).trim() };
|
|
16
|
+
}
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
export function cwdMisalignmentMessage(taskRoot, shellPwd) {
|
|
20
|
+
return `execution-env cwd misalignment: a probe run with the task root "${taskRoot}" as its working directory reports pwd "${shellPwd}", and the env's shell found that directory to be a different one from the task root`;
|
|
21
|
+
}
|
|
@@ -131,8 +131,8 @@ export declare function mintDecideRecord(cp: Checkpoint, facts: HostDecisionFact
|
|
|
131
131
|
* row stays `pending` for a well-formed decide, exactly like the other capture-time domain refusals,
|
|
132
132
|
* and BEFORE the hygiene check so no guard ever consults a value outside the domain. The rejected field
|
|
133
133
|
* is named in the message, and in `detail` where the caller hands the closed set's word for the cell
|
|
134
|
-
* (`CheckpointErrorField`: `feedback`
|
|
135
|
-
* wire-surface change of its own).
|
|
134
|
+
* (`CheckpointErrorField`: `feedback` and the approval lane's deny `reason` have one; the other lanes' `reason` and
|
|
135
|
+
* `editedPlan` have none, and widening the set is a wire-surface change of its own).
|
|
136
136
|
*/
|
|
137
137
|
export declare function assertOutcomeText(value: string | undefined, field: "editedPlan" | "reason" | "feedback", detail?: {
|
|
138
138
|
field: CheckpointErrorField;
|
|
@@ -55,6 +55,9 @@ export interface GateExitFacts {
|
|
|
55
55
|
clearedBy?: AllowRuleClearance;
|
|
56
56
|
/** The permission mode REFUSED the surviving ask — only beside `deniedBy: "mode"`. */
|
|
57
57
|
modeRefusal?: ModeRefusal;
|
|
58
|
+
/** The registration whose handler ended the call at the hook layer (its deny answer or its failure) — only beside `deniedBy: "hook"`.
|
|
59
|
+
* As the bus names it: the engine's own origin word is read as no extension at the mint, once. */
|
|
60
|
+
extension?: string;
|
|
58
61
|
}
|
|
59
62
|
/**
|
|
60
63
|
* Mint the outcome. A defect here is an ENGINE defect (a refusing site that did not say who refused, a
|
|
@@ -65,7 +68,7 @@ export interface GateExitFacts {
|
|
|
65
68
|
export declare function mintGateOutcome(facts: GateExitFacts): GateOutcome;
|
|
66
69
|
/** A direct refusal by one layer, with no ask settled — the five short-circuit exits (a hook that threw or
|
|
67
70
|
* never answered, the hook's own deny, the compliance lock, the plan-mode block). */
|
|
68
|
-
export declare function directDeny(deniedBy: Exclude<DeniedBy, "ask_resolution"
|
|
71
|
+
export declare function directDeny(deniedBy: Exclude<DeniedBy, "ask_resolution">, extension?: string): GateOutcome;
|
|
69
72
|
/**
|
|
70
73
|
* The gate's settlement LEDGER for one pass — the one place "which ask did this pass consume" is written,
|
|
71
74
|
* with ONE rule for every read, all through the decision's engine record ({@link attestationOf}):
|
|
@@ -147,7 +150,8 @@ export type PreToolUseScreen = {
|
|
|
147
150
|
readonly rewrittenBy?: readonly string[];
|
|
148
151
|
} | {
|
|
149
152
|
readonly kind: "refused";
|
|
150
|
-
readonly reason: string;
|
|
153
|
+
readonly reason: string; /** the registration the bus names for the failed screening (the mint reads whether it names an extension); absent on a cancel */
|
|
154
|
+
readonly extension?: string;
|
|
151
155
|
};
|
|
152
156
|
/**
|
|
153
157
|
* The PreToolUse screening face as the gate's stations see it — `classic.PreToolUse` raised on the leg's bus, the
|
|
@@ -264,6 +268,10 @@ export interface GatePass {
|
|
|
264
268
|
* that ended as a refusal). The exit mints the outcome from it beside the ledger's `settled`; a refusal
|
|
265
269
|
* that reaches the exit without it is an engine defect and the mint throws. */
|
|
266
270
|
deniedBy: DeniedBy | undefined;
|
|
271
|
+
/** borrowed-mutable — the registration whose handler refused, written by every site that writes `deniedBy: "hook"` (its deny
|
|
272
|
+
* answer, or its failure; absent when the refusal names no extension — the engine's own failed raise, a cancel). Read only
|
|
273
|
+
* beside `deniedBy: "hook"` ({@link DENIED_BY_MAY_NAME_EXTENSION}); the exit mints `GateDisposition.extension` from it. */
|
|
274
|
+
deniedExtension?: string;
|
|
267
275
|
/** borrowed-mutable — a refusing station's STRUCTURED details (the shell read station's refusal card), written
|
|
268
276
|
* beside `deniedBy` by that station alone; the exit puts it on the gate result for the loop's error result.
|
|
269
277
|
* OPTIONAL (the `probeUnanswered` form): the dispatch that builds the pass has nothing to declare here. */
|
|
@@ -362,7 +370,7 @@ export interface GatePass {
|
|
|
362
370
|
* here — an attribution channel whose job is "why was this call denied" must see an engine deny, or the
|
|
363
371
|
* deployment's only evidence of a broken hook is a tool that mysteriously stops working.
|
|
364
372
|
*/
|
|
365
|
-
export declare function engineFailClosedExit(pass: GatePass, reason: string): Promise<ToolGateResult>;
|
|
373
|
+
export declare function engineFailClosedExit(pass: GatePass, reason: string, extension?: string): Promise<ToolGateResult>;
|
|
366
374
|
/** The refusal sentence for args the gate could not take into its own copy (`ownArgs` refused them), naming what. */
|
|
367
375
|
export declare const unownedArgsMessage: (subject: string, reason: string) => string;
|
|
368
376
|
/**
|
|
@@ -388,7 +396,7 @@ export declare function untakenValueExit(pass: GatePass, untaken: {
|
|
|
388
396
|
export declare function unownedArgsExit(pass: GatePass, reason: string): Promise<ToolGateResult>;
|
|
389
397
|
/** The hook's OWN deny in phase 1. A PreToolUse hook deny does NOT fire `permissionDenied`
|
|
390
398
|
* (the exclusion recorded on `PermissionDeniedPayload`) — this return stays observer-free. */
|
|
391
|
-
export declare function hookDenyExit(pass: GatePass, deniedReason: string): ToolGateResult;
|
|
399
|
+
export declare function hookDenyExit(pass: GatePass, deniedReason: string, extension?: string): ToolGateResult;
|
|
392
400
|
/**
|
|
393
401
|
* The exit of the adjudicate chain — the pass has a standing `deny` or `allow` (every ask was resolved or
|
|
394
402
|
* parked before this), and this is where it becomes the gate result and the ONE record of the pass.
|
|
@@ -11,9 +11,11 @@ import { inlineUntrusted } from "../untrusted-text.js";
|
|
|
11
11
|
import { formatHookFeedback } from "../reminder-mint.js";
|
|
12
12
|
import { types } from "node:util";
|
|
13
13
|
import { receive } from "../mods/kernel/receive.js";
|
|
14
|
+
import { namedRegistration } from "../mods/kernel/registration.js";
|
|
14
15
|
import { describeBindingFault, MAX_DEPTH } from "../canonical-json.js";
|
|
15
16
|
export function mintGateOutcome(facts) {
|
|
16
17
|
const settlement = facts.settled !== undefined ? Object.freeze({ ...facts.settled.settlement, who: Object.freeze({ ...facts.settled.settlement.who }) }) : undefined;
|
|
18
|
+
const extension = namedRegistration(facts.extension);
|
|
17
19
|
const attribution = facts.classifier !== undefined ? Object.freeze({ ...facts.classifier, ...(facts.classifier.fallback !== undefined ? { fallback: Object.freeze({ ...facts.classifier.fallback }) } : {}) }) : undefined;
|
|
18
20
|
const outcome = Object.freeze({
|
|
19
21
|
disposition: Object.freeze(facts.deniedBy !== undefined
|
|
@@ -21,6 +23,7 @@ export function mintGateOutcome(facts) {
|
|
|
21
23
|
kind: "denied",
|
|
22
24
|
deniedBy: facts.deniedBy,
|
|
23
25
|
...(facts.cause !== undefined ? { cause: facts.cause } : {}),
|
|
26
|
+
...(extension !== undefined ? { extension } : {}),
|
|
24
27
|
...(attribution !== undefined ? { classifier: attribution } : {}),
|
|
25
28
|
...(facts.modeRefusal !== undefined ? { mode: facts.modeRefusal.mode, askClass: facts.modeRefusal.askClass, classes: Object.freeze([...facts.modeRefusal.classes]) } : {}),
|
|
26
29
|
}
|
|
@@ -41,8 +44,8 @@ function releaseRecordOf(a) {
|
|
|
41
44
|
const { kind: _kind, ...record } = a;
|
|
42
45
|
return record;
|
|
43
46
|
}
|
|
44
|
-
export function directDeny(deniedBy) {
|
|
45
|
-
return mintGateOutcome({ deniedBy });
|
|
47
|
+
export function directDeny(deniedBy, extension) {
|
|
48
|
+
return mintGateOutcome({ deniedBy, ...(extension !== undefined ? { extension } : {}) });
|
|
46
49
|
}
|
|
47
50
|
const SETTLEMENT_IS_HUMAN = {
|
|
48
51
|
human_allowed: true,
|
|
@@ -218,9 +221,9 @@ function withParkFailureCause(reason, parkFailed, nobodyJudged) {
|
|
|
218
221
|
export function passAskFace(pass) {
|
|
219
222
|
return askFaceOf(wireOf("gate.askFace", pass.req));
|
|
220
223
|
}
|
|
221
|
-
export async function engineFailClosedExit(pass, reason) {
|
|
224
|
+
export async function engineFailClosedExit(pass, reason, extension) {
|
|
222
225
|
const { input, toolName, toolCallId, notifyPermissionDenied } = pass;
|
|
223
|
-
const gate = directDeny("hook");
|
|
226
|
+
const gate = directDeny("hook", extension);
|
|
224
227
|
const finalInput = frozenInputSnapshot(pass.currentInput);
|
|
225
228
|
await notifyPermissionDenied({ toolName, input: cloneObserverInput(finalInput), toolCallId, reason, gate, ...(input.identity !== undefined ? { identity: input.identity } : {}) });
|
|
226
229
|
return { block: true, reason: formatHookFeedback(reason, input.reminderMark), gate, finalInput, preToolContext: pass.preToolContext };
|
|
@@ -235,12 +238,12 @@ export async function untakenValueExit(pass, untaken) {
|
|
|
235
238
|
export async function unownedArgsExit(pass, reason) {
|
|
236
239
|
return await untakenValueExit(pass, { value: pass.currentInput, message: unownedArgsMessage(`the arguments of "${pass.toolName}"`, reason), deniedBy: "policy" });
|
|
237
240
|
}
|
|
238
|
-
export function hookDenyExit(pass, deniedReason) {
|
|
241
|
+
export function hookDenyExit(pass, deniedReason, extension) {
|
|
239
242
|
const { input } = pass;
|
|
240
243
|
return {
|
|
241
244
|
block: true,
|
|
242
245
|
reason: formatHookFeedback(deniedReason, input.reminderMark),
|
|
243
|
-
gate: directDeny("hook"),
|
|
246
|
+
gate: directDeny("hook", extension),
|
|
244
247
|
finalInput: frozenInputSnapshot(pass.currentInput),
|
|
245
248
|
preToolContext: pass.preToolContext,
|
|
246
249
|
};
|
|
@@ -269,7 +272,7 @@ export async function exitGate(pass) {
|
|
|
269
272
|
pass.deniedBy = "mode";
|
|
270
273
|
ledger.supersede();
|
|
271
274
|
}
|
|
272
|
-
const gate = mintGateOutcome({ deniedBy: pass.deniedBy, ...(pass.denyCause !== undefined ? { cause: pass.denyCause } : {}), ...(ledger.settled !== undefined ? { settled: ledger.settled } : {}), ...(pass.classifierRound !== undefined ? { classifier: pass.classifierRound } : {}), ...(modeRefusal !== undefined ? { modeRefusal: { mode: modeRefusal.mode, askClass: modeRefusal.askClass, classes: modeRefusal.classes } } : {}) });
|
|
275
|
+
const gate = mintGateOutcome({ deniedBy: pass.deniedBy, ...(pass.deniedBy === "hook" && pass.deniedExtension !== undefined ? { extension: pass.deniedExtension } : {}), ...(pass.denyCause !== undefined ? { cause: pass.denyCause } : {}), ...(ledger.settled !== undefined ? { settled: ledger.settled } : {}), ...(pass.classifierRound !== undefined ? { classifier: pass.classifierRound } : {}), ...(modeRefusal !== undefined ? { modeRefusal: { mode: modeRefusal.mode, askClass: modeRefusal.askClass, classes: modeRefusal.classes } } : {}) });
|
|
273
276
|
const foldCause = attestationOf(pass.decision, { toolCallId, toolName })?.unresolvableCause;
|
|
274
277
|
const unresolvable = foldCause ?? unresolvableCauseOfSettlement(gate);
|
|
275
278
|
const tableSeat = unresolvable !== undefined ? askUnresolvableRemedySeat(unresolvable) : undefined;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The run's account of the images a provider refused (`context.image_removed`, user). The harness's request view
|
|
3
|
+
* removes the images a provider refusal points at (`engine/llm/rejected-images.ts`) and hands this seat the removals
|
|
4
|
+
* the run itself met; every request re-reads the transcript — the live failure, then its record or a rebuilt copy —
|
|
5
|
+
* so the seat announces ONCE PER RUN PER REFUSAL, keyed by the identity all of those share (`refusalAt`).
|
|
6
|
+
*/
|
|
7
|
+
import { type EngineNotice } from "../engine-notice.js";
|
|
8
|
+
import type { RejectedImageRemoval } from "../../internal/llm.js";
|
|
9
|
+
export declare function createImageRemovedSeat(onNotice: ((notice: EngineNotice) => void) | undefined, ids: {
|
|
10
|
+
sessionId: string;
|
|
11
|
+
runId: string;
|
|
12
|
+
}): (removals: readonly RejectedImageRemoval[]) => void;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { deliverEngineNotice } from "../engine-notice.js";
|
|
2
|
+
export function createImageRemovedSeat(onNotice, ids) {
|
|
3
|
+
const announced = new Set();
|
|
4
|
+
return (removals) => {
|
|
5
|
+
for (const { refusalAt, images } of removals) {
|
|
6
|
+
if (announced.has(refusalAt))
|
|
7
|
+
continue;
|
|
8
|
+
announced.add(refusalAt);
|
|
9
|
+
const one = images === 1;
|
|
10
|
+
deliverEngineNotice(onNotice, {
|
|
11
|
+
code: "context.image_removed",
|
|
12
|
+
message: `The model provider could not process ${one ? "an image" : `${images} images`} in this conversation, so ${one ? "it was" : "they were"} removed ` +
|
|
13
|
+
`from what the model sees (each replaced by a line saying so) and the request was sent again without ${one ? "it" : "them"}. ` +
|
|
14
|
+
`The session still holds the original; to show the model this content again, send it in another format.`,
|
|
15
|
+
detail: { images, sessionId: ids.sessionId, runId: ids.runId },
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -17,7 +17,7 @@ export async function admitInlineImage(img) {
|
|
|
17
17
|
case "mime_unsupported":
|
|
18
18
|
throw inlineImageRefusal(`an inline image declares mimeType ${JSON.stringify(mimeType.slice(0, 80))}, which the model API does not accept (accepted: ${ADMITTED_IMAGE_MIME_TYPES.join(", ")}).`);
|
|
19
19
|
case "magic_mismatch":
|
|
20
|
-
throw inlineImageRefusal(`an inline image's bytes do not
|
|
20
|
+
throw inlineImageRefusal(`an inline image's bytes do not open with a valid ${mimeType} header (empty, truncated, mis-declared, not base64, or a variant such as an Apple-optimized PNG that model APIs cannot read) — refused rather than sent.`);
|
|
21
21
|
case "raw_too_large":
|
|
22
22
|
throw inlineImageRefusal(`an inline image is ${admitted.rawBytes} bytes, over the ${admitted.cap}-byte cap.`);
|
|
23
23
|
case "base64_too_large":
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { brainToRuntime } from "../runtime.js";
|
|
2
|
-
import { expandTiers, roleModelIfSet } from "../roles.js";
|
|
2
|
+
import { expandTiers, roleModelIfSet, unheldChainRefusal } from "../roles.js";
|
|
3
3
|
import { isAliasModelId, openAiCompatChatSeat } from "../memory-engine/distiller.js";
|
|
4
4
|
import { runMemoryConsolidationDriver } from "../memory-engine/consolidation-driver.js";
|
|
5
5
|
import { recommendationUnconsumed } from "../memory-engine/consolidation.js";
|
|
@@ -29,7 +29,7 @@ export function resolveMemoryConsolidationDriver(deps) {
|
|
|
29
29
|
const models = expandTiers(deps.models, deps.tiers);
|
|
30
30
|
const resolved = roleModelIfSet("consolidate", {}, { models, roles: deps.roles }) ?? roleModelIfSet("summarize", {}, { models, roles: deps.roles });
|
|
31
31
|
if (resolved === undefined) {
|
|
32
|
-
throw seatRefusal('memory consolidation has no model seat: configure RunnerDeps.memoryConsolidationDriver.chat (an endpoint triple or a chat function), or declare roles.consolidate / roles.summarize (a tier-expanded catalog\'s "flash" binding also satisfies the summarize hop). The chain deliberately does NOT fall back to the default main model — a whole-library distillation must not silently ride the most expensive seat.');
|
|
32
|
+
throw unheldChainRefusal(["consolidate", "summarize"], models, deps.roles) ?? seatRefusal('memory consolidation has no model seat: configure RunnerDeps.memoryConsolidationDriver.chat (an endpoint triple or a chat function), or declare roles.consolidate / roles.summarize (a tier-expanded catalog\'s "flash" binding also satisfies the summarize hop). The chain deliberately does NOT fall back to the default main model — a whole-library distillation must not silently ride the most expensive seat.');
|
|
33
33
|
}
|
|
34
34
|
if (isAliasModelId(resolved.id)) {
|
|
35
35
|
throw seatRefusal(`the resolved consolidation model id ${JSON.stringify(resolved.id)} is an alias spelling — an alias can be re-pointed upstream and would move the run with no trace in the archive; bind an explicit id.`);
|
|
@@ -116,6 +116,6 @@ export function assertAutoConsolidationWirable(deps) {
|
|
|
116
116
|
throw autoRunRefusal("RunnerDeps.autoRunOnRecommendation is true but RunnerDeps.memoryConsolidation is absent — the recommendation that would trigger a run is never minted (consolidation is OFF) and the engine's verbs refuse coded, so the trigger can never fire. An armed-but-unrunnable trigger is refused, never folded to off: wire memoryConsolidation, or leave autoRunOnRecommendation unset.");
|
|
117
117
|
}
|
|
118
118
|
if (!consolidationSeatResolvable(deps)) {
|
|
119
|
-
throw autoRunRefusal("RunnerDeps.autoRunOnRecommendation is true but no consolidation model seat resolves — configure RunnerDeps.memoryConsolidationDriver.chat (an endpoint triple or a chat function), or declare roles.consolidate / roles.summarize. Arming auto-run with no model to run it is refused, never folded to off (a whole-library distillation must not silently ride the default main model).");
|
|
119
|
+
throw unheldChainRefusal(["consolidate", "summarize"], expandTiers(deps.models, deps.tiers), deps.roles) ?? autoRunRefusal("RunnerDeps.autoRunOnRecommendation is true but no consolidation model seat resolves — configure RunnerDeps.memoryConsolidationDriver.chat (an endpoint triple or a chat function), or declare roles.consolidate / roles.summarize. Arming auto-run with no model to run it is refused, never folded to off (a whole-library distillation must not silently ride the default main model).");
|
|
120
120
|
}
|
|
121
121
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* numbers, and the driver keeps reaching down for the marker its harness stamps. Pure: no engine state; the only clock
|
|
7
7
|
* is the caller's.
|
|
8
8
|
*/
|
|
9
|
-
import type
|
|
9
|
+
import { type CheckpointGate, type CheckpointToken, type PendingAction } from "../checkpoint-store.js";
|
|
10
10
|
import type { WorkspaceHandle } from "../remote-env.js";
|
|
11
11
|
import type { Prepared } from "./contracts.js";
|
|
12
12
|
/** Default resource-checkpoint retention (30 days, the spec's
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { planReviewRequesterOf } from "../checkpoint-store.js";
|
|
1
2
|
export const DEFAULT_RESOURCE_TTL_MS = 30 * 24 * 60 * 60 * 1000;
|
|
2
3
|
export const USAGE_WINDOW_REAP_MARGIN_MS = 60 * 60 * 1000;
|
|
3
4
|
export const DEFAULT_UNATTENDED_APPROVAL_TTL_MS = 30 * 24 * 60 * 60 * 1000;
|
|
@@ -16,12 +17,14 @@ export function parkContaminationMarker(refs) {
|
|
|
16
17
|
return { code: "gate.parked", ...(gatedCallId !== undefined ? { gatedCallId } : {}) };
|
|
17
18
|
}
|
|
18
19
|
export function publishCommittedSuspend(refs, token, gate, scope, remoteHandle, checkpointId, pendingAction) {
|
|
20
|
+
const requestedByCallId = pendingAction !== undefined ? planReviewRequesterOf(pendingAction) : undefined;
|
|
19
21
|
const pause = {
|
|
20
22
|
cause: {
|
|
21
23
|
kind: "paused",
|
|
22
24
|
gate,
|
|
23
25
|
token,
|
|
24
26
|
...(checkpointId !== undefined ? { checkpointId } : {}),
|
|
27
|
+
...(requestedByCallId !== undefined ? { requestedByCallId } : {}),
|
|
25
28
|
...(remoteHandle !== undefined ? { restoreMode: remoteHandle.restoreMode === "park_only" ? "park_only" : "snapshot" } : {}),
|
|
26
29
|
},
|
|
27
30
|
scope,
|
|
@@ -7,7 +7,7 @@ import { type OnAsk, type ToolCallRequest, type ToolPolicy } from "../tool-polic
|
|
|
7
7
|
import type { RunnerDeps, TaskSpec } from "../types.js";
|
|
8
8
|
import type { CwdRef } from "../../tools/fs/fs-shared.js";
|
|
9
9
|
import type { AskLane, Prepared } from "./contracts.js";
|
|
10
|
-
import type
|
|
10
|
+
import { type GrantBindingOf } from "../skill-grant-binding.js";
|
|
11
11
|
import { consumeInheritedAskGrant } from "./inherited-ask-grants.js";
|
|
12
12
|
import { type GrantReadRoot } from "./read-root-grant.js";
|
|
13
13
|
import type { createRuleOffersOf } from "./permission-rule-lanes.js";
|
|
@@ -8,6 +8,7 @@ import { failedJudgmentDeny, policyCheckAbortedDeny } from "./policy-throw.js";
|
|
|
8
8
|
import { askMandateMember } from "../ask-origin.js";
|
|
9
9
|
import { approvalCardMemberOf, survivorsByName } from "../tool-roster.js";
|
|
10
10
|
import { toolNameIndex } from "../../internal/llm.js";
|
|
11
|
+
import { requestGrantBinding } from "../skill-grant-binding.js";
|
|
11
12
|
import { gateAskCarry, lateAskSettlementObserver } from "./denial-limit-arms.js";
|
|
12
13
|
import { consumeInheritedAskGrant } from "./inherited-ask-grants.js";
|
|
13
14
|
import { requesterOf } from "../mods/extension-call.js";
|
|
@@ -61,7 +62,7 @@ export function prepareAskLane(input) {
|
|
|
61
62
|
const adjudicate = effectivePolicy
|
|
62
63
|
? async (req, callSignal) => {
|
|
63
64
|
const signal = composedCallSignal(callSignal);
|
|
64
|
-
const stampedReq = () => ({ ...req, budget: budgetSnapshot, ...(handsCwdRef !== undefined ? { cwd: handsCwdRef.current } : {}), ...(handsRoot !== undefined ? { root: handsRoot } : {}), ...advertisedWritableRootsSeat(advertisedWritableDirs), ...exemptRootsSeat(exemptRoots) });
|
|
65
|
+
const stampedReq = () => ({ ...req, budget: budgetSnapshot, ...(handsCwdRef !== undefined ? { cwd: handsCwdRef.current } : {}), ...(handsRoot !== undefined ? { root: handsRoot } : {}), ...advertisedWritableRootsSeat(advertisedWritableDirs), ...exemptRootsSeat(exemptRoots), ...requestGrantBinding(grantBindingOf, req, req.args) });
|
|
65
66
|
const judged = (async () => {
|
|
66
67
|
const withReading = stampCallTarget?.(stampedReq(), signal);
|
|
67
68
|
return withReading === undefined ? effectivePolicy.check(stampedReq(), signal) : effectivePolicy.check(await withReading, signal);
|
|
@@ -78,7 +78,7 @@ export function prepareBoundaryParks(input) {
|
|
|
78
78
|
const suspendForResource = resourceSuspendEligible ? mintResourceSuspend : undefined;
|
|
79
79
|
const suspendForPlatformLimit = durableSuspendInfraReady ? mintResourceSuspend : undefined;
|
|
80
80
|
const suspendForReview = checkpointStore
|
|
81
|
-
? async (reason) => {
|
|
81
|
+
? async (reason, requestedByCallId) => {
|
|
82
82
|
if (!checkpointStore)
|
|
83
83
|
return false;
|
|
84
84
|
if (abortController.signal.aborted)
|
|
@@ -133,7 +133,7 @@ export function prepareBoundaryParks(input) {
|
|
|
133
133
|
sessionId,
|
|
134
134
|
leafId,
|
|
135
135
|
gate,
|
|
136
|
-
pendingAction: { kind: "plan_review" },
|
|
136
|
+
pendingAction: { kind: "plan_review", ...(requestedByCallId !== undefined && requestedByCallId !== "" ? { requestedByCallId } : {}) },
|
|
137
137
|
state: serializeCheckpointState(remoteHandle, inFlightSpendMicroUsd()),
|
|
138
138
|
status: "pending",
|
|
139
139
|
createdAt: mintedAt,
|
|
@@ -75,8 +75,8 @@ export interface PrepareCapsAndWorkflowInput {
|
|
|
75
75
|
model: Model;
|
|
76
76
|
/** borrowed-readonly — the run's resolved thinking level, when one is (the Workflow mount's parentThinking fallback). */
|
|
77
77
|
thinking: ThinkingLevel | undefined;
|
|
78
|
-
/** borrowed-readonly — the frozen preflight; only `mcp` (the compliance veto's mcp_servers conflict
|
|
79
|
-
lockedPreflight: Pick<LockedPreflight, "mcp">;
|
|
78
|
+
/** borrowed-readonly — the frozen preflight; only `mcp` and `a2a` (the compliance veto's mcp_servers / a2a_peers conflict checks). */
|
|
79
|
+
lockedPreflight: Pick<LockedPreflight, "mcp" | "a2a">;
|
|
80
80
|
/** borrowed-mutable — the effect collection (`Prepared.toolEffects`): the safety scan's caller entries, then the mounts' writes. */
|
|
81
81
|
toolEffects: Prepared["toolEffects"];
|
|
82
82
|
/** borrowed-readonly — the frozen tool-face snapshot the Workflow mount forwards (exclude / defer / alwaysLoad / restoreGated). */
|
|
@@ -106,9 +106,7 @@ export interface PrepareCapsAndWorkflowInput {
|
|
|
106
106
|
offloadThresholdChars?: number;
|
|
107
107
|
}) => AgentTool;
|
|
108
108
|
/** borrowed-readonly — the plan-review primitive the ExitPlanMode tool calls. */
|
|
109
|
-
requestReview: (opts?:
|
|
110
|
-
reason?: string;
|
|
111
|
-
}) => void;
|
|
109
|
+
requestReview: (opts?: import("../present-plan-tool.js").ReviewRequest) => void;
|
|
112
110
|
/** borrowed-readonly — the declared session plan file as ExitPlanMode's FILE arm reads it (absent ⇒ the parameter arm). */ planFileSource?: PlanFileSource;
|
|
113
111
|
/** borrowed-readonly — the plan-mode primitive the EnterPlanMode tool calls: a steer of the leg's mode seat into `plan`. */
|
|
114
112
|
enterPlanMode: () => Promise<void>;
|
|
@@ -196,6 +196,8 @@ export async function prepareCapsAndWorkflow(input) {
|
|
|
196
196
|
if (complianceDenies.has("mcp_servers") && lockedPreflight.mcp?.length) {
|
|
197
197
|
complianceRefuse("mcp_servers", "TaskSpec.mcp (MCP server materialization)");
|
|
198
198
|
}
|
|
199
|
+
if (complianceDenies.has("a2a_peers") && lockedPreflight.a2a?.length)
|
|
200
|
+
complianceRefuse("a2a_peers", "TaskSpec.a2a (A2A peer materialization)");
|
|
199
201
|
if (complianceDenies.has("workflows") && spec.selfOrchestration === true) {
|
|
200
202
|
complianceRefuse("workflows", "TaskSpec.selfOrchestration (workflow self-orchestration)");
|
|
201
203
|
}
|
|
@@ -282,6 +282,8 @@ export function configValueDoors(input, enter = ENTER_AS_IS) {
|
|
|
282
282
|
e.code = "config.memory_persistence_invalid";
|
|
283
283
|
throw e;
|
|
284
284
|
});
|
|
285
|
+
if (spec.classifyAllShell !== undefined && typeof spec.classifyAllShell !== "boolean")
|
|
286
|
+
enter("taskConfig", () => { throw limitConfigError("config.invalid_argument", `TaskSpec.classifyAllShell must be a boolean when present (got ${describeRejectedValue(spec.classifyAllShell)}) — true lets no shell allow entry clear a call in auto mode; omit the key for the default.`); });
|
|
285
287
|
if (spec.toolMaterializeStrategy === "static" && spec.deferSelfResolve === false)
|
|
286
288
|
enter("taskConfig", () => {
|
|
287
289
|
const e = new Error(`toolMaterializeStrategy "static" cannot be combined with deferSelfResolve: false — with the direct-call ` +
|
|
@@ -12,6 +12,7 @@ import { applyGitFrameGuard } from "./git-status-frame.js";
|
|
|
12
12
|
import { applyContextShrinkToReadFileState } from "../../tools/fs/index.js";
|
|
13
13
|
import { rosterToolName } from "../tool-roster.js";
|
|
14
14
|
import { createToolTurnRepairSeat } from "./tool-turn-repair-seat.js";
|
|
15
|
+
import { createImageRemovedSeat } from "./image-removed-seat.js";
|
|
15
16
|
export function prepareContextLane(input) {
|
|
16
17
|
const { model, deps, sessionId, runId, hostTaskId, offloadStore, toolRosterDeltas, microCompactKnob, harness, batchHaltRef, gitStatusRef, postureFrameRef, requestLossyRef, trimPressureRef, readFileState } = input;
|
|
17
18
|
const toolNameOf = (recorded) => rosterToolName(toolRosterDeltas.current, recorded);
|
|
@@ -29,6 +30,7 @@ export function prepareContextLane(input) {
|
|
|
29
30
|
requestLossyRef.current = true;
|
|
30
31
|
announceRepairs(repairs);
|
|
31
32
|
};
|
|
33
|
+
harness.onImagesRemoved = createImageRemovedSeat((notice) => deps.onNotice?.(notice), { sessionId, runId });
|
|
32
34
|
harness.on("context", async ({ messages, recheck, signal }) => {
|
|
33
35
|
batchHaltRef.current = undefined;
|
|
34
36
|
const pendingProjectionObservations = [];
|
|
@@ -20,6 +20,7 @@ import type { AgentTool, ExecutionEnv, WorkspaceState } from "../../internal/har
|
|
|
20
20
|
import { type PeerLaneRefs } from "../../agents/peer-session-drain.js";
|
|
21
21
|
import type { SubagentRetainLedger } from "../../agents/retain-ledger.js";
|
|
22
22
|
import type { ShellReadAdmission } from "../../tools/fs/shell-read-check.js";
|
|
23
|
+
import type { ReadFloorSeat } from "../../tools/fs/read-floor.js";
|
|
23
24
|
import { type WorktreeSessionRef } from "../../tools/worktree.js";
|
|
24
25
|
import type { CwdRef } from "../../tools/fs/index.js";
|
|
25
26
|
import { type ToolResultStore } from "../tool-result-store.js";
|
|
@@ -61,6 +62,9 @@ export interface PrepareDelegationSurfaceInput {
|
|
|
61
62
|
backgroundTaskToolsActive: boolean;
|
|
62
63
|
/** borrowed-readonly — this run's shell read station's pre-spawn ADMISSION (declared at the hands phase), for `Monitor`: the only P11 face that spawns a shell command. */
|
|
63
64
|
shellReadAdmission: ShellReadAdmission | undefined;
|
|
65
|
+
/** borrowed-readonly — the byte floor's seat over the run's read-deny table (declared at the hands phase), for `Monitor`:
|
|
66
|
+
* the watched command's start carries the table to the environment, as the band's shell starts do. */
|
|
67
|
+
shellReadFloor: ReadFloorSeat | undefined;
|
|
64
68
|
/** borrowed-readonly — the door's second half: the Workflow tool is on the roster. */
|
|
65
69
|
workflowToolsActive: boolean;
|
|
66
70
|
/** borrowed-readonly — the peer lane's mount verdict for this leg. */
|
|
@@ -93,6 +93,7 @@ export function prepareDelegationSurface(input) {
|
|
|
93
93
|
roster.mount(firstPartyOffload(createMonitorTool(executionEnv, {
|
|
94
94
|
registry: defaultTaskRegistry,
|
|
95
95
|
...(input.shellReadAdmission !== undefined ? { shellReadAdmission: input.shellReadAdmission } : {}),
|
|
96
|
+
...(input.shellReadFloor !== undefined ? { readFloor: input.shellReadFloor } : {}),
|
|
96
97
|
owner: hostTaskId,
|
|
97
98
|
scope: taskScope,
|
|
98
99
|
...(sessionId !== undefined ? { sessionId } : {}),
|
|
@@ -3,6 +3,7 @@ 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
5
|
import { type ShellReadAdmission, type ShellReadCheck, type ShellReadLandings } from "../../tools/fs/shell-read-check.js";
|
|
6
|
+
import { type ReadFloorSeat } from "../../tools/fs/read-floor.js";
|
|
6
7
|
import type { ShellReadBoundary } from "../../tools/fs/shell-read-judge.js";
|
|
7
8
|
import type { RunnerDeps, ShellGateDoctrine, TaskSpec } from "../types.js";
|
|
8
9
|
import type { Model } from "../../internal/llm.js";
|
|
@@ -219,6 +220,9 @@ export interface PrepareHandsReadFaceResult {
|
|
|
219
220
|
/** owned — the same station's pre-spawn ADMISSION, published for the P11 face that spawns a shell command
|
|
220
221
|
* and mounts LATER than the band (`Monitor`): the SAME function the band's shell faces got. ⇔ a real shell. */
|
|
221
222
|
shellReadAdmission: ShellReadAdmission | undefined;
|
|
223
|
+
/** owned — the byte floor's seat over the run's read-deny table (read-floor.ts), for the same LATER face (`Monitor`): the
|
|
224
|
+
* table the band's shell faces carry to the environment on every start. ⇔ a real shell. */
|
|
225
|
+
shellReadFloor: ReadFloorSeat | undefined;
|
|
222
226
|
/** 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
227
|
shellReadLandings: ShellReadLandings | undefined;
|
|
224
228
|
/** owned — the file read station's admission (`FileReadStation.admitted`) the band's read tools got, for the read tools mounted later (LSP). */
|
|
@@ -9,6 +9,7 @@ import { carryReadFace } from "../../tools/fs/read-deny-home.js";
|
|
|
9
9
|
import { EMPTY_READ_ROOTS, afterCallTables, denySeatsOf, onPinnedRead, pathTablesCompile, readRootsOver } from "./person-path-rows.js";
|
|
10
10
|
import { createShellOverflowSpoolFence } from "../../tools/fs/fs-shared.js";
|
|
11
11
|
import { createShellReadStation } from "../../tools/fs/shell-read-check.js";
|
|
12
|
+
import { readFloorSeat } from "../../tools/fs/read-floor.js";
|
|
12
13
|
import { createFileReadStation } from "../../tools/fs/file-read-check.js";
|
|
13
14
|
import { isShellFaceToolName, predictMountedToolNames, readTargetToolNames } from "../tool-registry.js";
|
|
14
15
|
import { normalizeFileText } from "../../tools/fs/encoding.js";
|
|
@@ -86,6 +87,7 @@ export function resolveHandsLessReadFace(input) {
|
|
|
86
87
|
shellReadCheck: undefined,
|
|
87
88
|
shellReadStationArmed: false,
|
|
88
89
|
shellReadAdmission: undefined,
|
|
90
|
+
shellReadFloor: undefined,
|
|
89
91
|
shellReadLandings: undefined,
|
|
90
92
|
readAdmission: undefined,
|
|
91
93
|
resolvedReadFace: undefined,
|
|
@@ -122,6 +124,7 @@ export async function prepareHandsMount(input) {
|
|
|
122
124
|
let rebaseWsPath = (p) => p;
|
|
123
125
|
let backgroundTaskToolsActive = false;
|
|
124
126
|
let shellReadStation;
|
|
127
|
+
let shellReadFloor;
|
|
125
128
|
let shellReadTools = new Set();
|
|
126
129
|
let fileReadStation;
|
|
127
130
|
let resolvedReadFace;
|
|
@@ -311,6 +314,7 @@ export async function prepareHandsMount(input) {
|
|
|
311
314
|
return { roots: [rootCanonical, ...readRoots.forCall(toolCallId)()], cwd: rootCanonical, ...denySeat, ...writeDenySeat, ...(input.personRows.unreadFor(toolCallId) ? { unreadPartitions: true } : {}), alsoInside: spoolFence };
|
|
312
315
|
};
|
|
313
316
|
shellReadTools = new Set(shellFaceHere);
|
|
317
|
+
shellReadFloor = readFloorSeat(tables.readDeny);
|
|
314
318
|
shellReadStation = createShellReadStation({
|
|
315
319
|
env: executionEnv,
|
|
316
320
|
tools: shellReadTools,
|
|
@@ -415,6 +419,7 @@ export async function prepareHandsMount(input) {
|
|
|
415
419
|
shellReadCheck: onPinnedRead(input.personRows, [...(shellReadStation !== undefined ? [{ check: shellReadStation.check, tools: shellReadTools }] : []), ...(fileReadStation !== undefined ? [fileReadStation] : [])]),
|
|
416
420
|
shellReadStationArmed: shellReadStation !== undefined,
|
|
417
421
|
shellReadAdmission: shellReadStation?.admit,
|
|
422
|
+
shellReadFloor,
|
|
418
423
|
shellReadLandings: shellReadStation?.landings,
|
|
419
424
|
readAdmission: fileReadStation?.admitted,
|
|
420
425
|
resolvedReadFace,
|