@sema-agent/core 7.62.0 → 7.64.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 +936 -0
- package/dist/agents/cc-peer-directory.js +1 -0
- package/dist/agents/cc-peer-wire.d.ts +4 -0
- package/dist/agents/cc-peer-wire.js +1 -0
- package/dist/agents/cc-uds-peer-channel.js +5 -0
- package/dist/agents/cross-session-judge.d.ts +3 -1
- package/dist/agents/cross-session-judge.js +4 -1
- package/dist/agents/peer-directory.d.ts +8 -0
- package/dist/agents/peer-directory.js +4 -0
- package/dist/agents/peer-held-queue.d.ts +9 -3
- package/dist/agents/peer-held-queue.js +12 -9
- package/dist/agents/peer-idle.d.ts +20 -1
- package/dist/agents/peer-idle.js +23 -12
- package/dist/agents/peer-notice-route.d.ts +16 -5
- package/dist/agents/peer-notice-route.js +11 -9
- package/dist/agents/peer-notices.d.ts +25 -8
- package/dist/agents/peer-notices.js +6 -1
- package/dist/agents/peer-session-drain.d.ts +32 -6
- package/dist/agents/peer-session-drain.js +100 -26
- package/dist/agents/send-message-tool.d.ts +7 -0
- package/dist/agents/send-message-tool.js +18 -6
- package/dist/agents/subagent-transcript-placement.d.ts +23 -0
- package/dist/agents/subagent-transcript-placement.js +14 -0
- package/dist/agents/subagent.js +102 -54
- package/dist/brain/route-adjudicator.js +9 -4
- package/dist/core/allow-entry.d.ts +4 -0
- package/dist/core/approval-object.js +1 -1
- package/dist/core/arg-summary.js +1 -1
- package/dist/core/ask-origin.d.ts +1 -1
- package/dist/core/ask-origin.js +2 -2
- package/dist/core/ask-question.d.ts +2 -2
- package/dist/core/ask-unresolvable-notice.d.ts +13 -4
- package/dist/core/ask-unresolvable-notice.js +10 -3
- package/dist/core/auto-compaction.d.ts +7 -5
- package/dist/core/background-agent-store.d.ts +7 -0
- package/dist/core/background-agent-store.js +3 -0
- package/dist/core/canonical-json.d.ts +23 -13
- package/dist/core/canonical-json.js +4 -4
- package/dist/core/checkpoint-queries.d.ts +50 -4
- package/dist/core/checkpoint-queries.js +42 -17
- package/dist/core/checkpoint-requirements.d.ts +3 -3
- package/dist/core/checkpoint-requirements.js +2 -1
- package/dist/core/checkpoint-row-verdict.d.ts +15 -4
- package/dist/core/checkpoint-row-verdict.js +22 -2
- package/dist/core/checkpoint-store.d.ts +28 -11
- package/dist/core/checkpoint-store.js +45 -4
- package/dist/core/compliance.d.ts +6 -2
- package/dist/core/compliance.js +3 -3
- package/dist/core/context-settings.d.ts +40 -9
- package/dist/core/context-settings.js +32 -10
- package/dist/core/engine-attestation.d.ts +27 -7
- package/dist/core/engine-attestation.js +5 -1
- package/dist/core/engine-notice.d.ts +43 -5
- package/dist/core/extension-requester.d.ts +9 -0
- package/dist/core/extension-requester.js +7 -0
- package/dist/core/file-history-store.d.ts +28 -0
- package/dist/core/file-history-store.js +48 -5
- package/dist/core/fs-write-gate-policy.js +1 -1
- package/dist/core/gate-fold.js +2 -0
- package/dist/core/gate-lanes.js +2 -0
- package/dist/core/gate-outcome.d.ts +39 -2
- package/dist/core/gate-outcome.js +20 -1
- package/dist/core/git-worktree-env.d.ts +62 -3
- package/dist/core/git-worktree-env.js +91 -30
- package/dist/core/governance-codes.d.ts +9 -3
- package/dist/core/governance-codes.js +17 -3
- package/dist/core/leg-identity.d.ts +19 -1
- package/dist/core/leg-identity.js +12 -0
- package/dist/core/mailbox-store.d.ts +39 -4
- package/dist/core/mailbox-store.js +14 -2
- package/dist/core/memory-engine/consolidation-driver.d.ts +32 -17
- package/dist/core/memory-engine/consolidation-driver.js +99 -98
- package/dist/core/memory-engine/consolidation.d.ts +74 -10
- package/dist/core/memory-engine/consolidation.js +183 -11
- package/dist/core/memory-engine/control-objects.d.ts +25 -0
- package/dist/core/memory-engine/control-objects.js +151 -0
- package/dist/core/memory-engine/control-plane-adoption.d.ts +48 -0
- package/dist/core/memory-engine/control-plane-adoption.js +159 -0
- package/dist/core/memory-engine/data-plane.d.ts +8 -4
- package/dist/core/memory-engine/data-plane.js +11 -6
- package/dist/core/memory-engine/delegation-settlement.d.ts +58 -40
- package/dist/core/memory-engine/delegation-settlement.js +270 -85
- package/dist/core/memory-engine/dual-root.d.ts +12 -6
- package/dist/core/memory-engine/dual-root.js +11 -7
- package/dist/core/memory-engine/engine.d.ts +136 -58
- package/dist/core/memory-engine/engine.js +491 -394
- package/dist/core/memory-engine/entry-scan.d.ts +8 -0
- package/dist/core/memory-engine/entry-scan.js +3 -0
- package/dist/core/memory-engine/file-backend.d.ts +62 -60
- package/dist/core/memory-engine/file-backend.js +122 -198
- package/dist/core/memory-engine/index.d.ts +8 -7
- package/dist/core/memory-engine/index.js +7 -6
- package/dist/core/memory-engine/landing-admission.d.ts +5 -3
- package/dist/core/memory-engine/landing-admission.js +3 -3
- package/dist/core/memory-engine/layout.d.ts +127 -46
- package/dist/core/memory-engine/layout.js +264 -109
- package/dist/core/memory-engine/memory-backend-contract.d.ts +26 -1
- package/dist/core/memory-engine/memory-backend-contract.js +476 -0
- package/dist/core/memory-engine/memory-deployment.d.ts +42 -11
- package/dist/core/memory-engine/memory-deployment.js +54 -15
- package/dist/core/memory-engine/origin-clearance.d.ts +12 -3
- package/dist/core/memory-engine/origin-clearance.js +68 -9
- package/dist/core/memory-engine/scope-contract.d.ts +52 -11
- package/dist/core/memory-engine/scope-contract.js +68 -19
- package/dist/core/memory-engine/session-write-home.d.ts +37 -2
- package/dist/core/memory-engine/session-write-home.js +38 -11
- package/dist/core/memory-engine/sync-client.d.ts +3 -1
- package/dist/core/memory-engine/sync-client.js +7 -0
- package/dist/core/memory-engine/sync-report.d.ts +3 -2
- package/dist/core/memory-engine/sync-report.js +6 -2
- package/dist/core/memory-engine/tools.d.ts +2 -2
- package/dist/core/memory-engine/tools.js +10 -10
- package/dist/core/memory-engine/types.d.ts +155 -19
- package/dist/core/memory-engine/types.js +2 -0
- package/dist/core/memory.js +15 -6
- package/dist/core/mode-policy.js +3 -3
- package/dist/core/mods/agent-stations.d.ts +18 -0
- package/dist/core/mods/agent-stations.js +8 -6
- package/dist/core/mods/extension-call.d.ts +4 -0
- package/dist/core/mods/extension-call.js +8 -0
- package/dist/core/mods/stations.d.ts +20 -1
- package/dist/core/mods/stations.js +21 -2
- package/dist/core/mods/tool-call.js +3 -4
- package/dist/core/parent-spec-seat.d.ts +2 -2
- package/dist/core/park-selfcheck.js +2 -2
- package/dist/core/pause-registry.d.ts +2 -0
- package/dist/core/pause-registry.js +3 -0
- package/dist/core/peer-channel.d.ts +5 -0
- package/dist/core/permission-rule-consent.d.ts +26 -8
- package/dist/core/permission-rule-consent.js +76 -36
- package/dist/core/permission-rule-store.d.ts +72 -13
- package/dist/core/permission-rule-store.js +29 -8
- package/dist/core/read-only-shell.js +3 -2
- package/dist/core/redaction-marks.d.ts +8 -0
- package/dist/core/redaction-marks.js +6 -0
- package/dist/core/refusal-echo.d.ts +20 -0
- package/dist/core/refusal-echo.js +33 -0
- package/dist/core/remote-env.d.ts +12 -1
- package/dist/core/remote-env.js +3 -0
- package/dist/core/retention.d.ts +180 -10
- package/dist/core/retention.js +45 -0
- package/dist/core/retired-keys.d.ts +5 -0
- package/dist/core/retired-keys.js +3 -0
- package/dist/core/rule-offer-read.d.ts +0 -4
- package/dist/core/rule-offer-read.js +2 -18
- package/dist/core/runner/child-tree.d.ts +29 -3
- package/dist/core/runner/child-tree.js +39 -16
- package/dist/core/runner/classifier-ladder.d.ts +7 -1
- package/dist/core/runner/classifier-ladder.js +4 -2
- package/dist/core/runner/compact-session.js +10 -7
- package/dist/core/runner/compaction-call-options.d.ts +7 -7
- package/dist/core/runner/compaction-call-options.js +3 -2
- package/dist/core/runner/contracts.d.ts +39 -11
- package/dist/core/runner/delegation-owner.d.ts +10 -3
- package/dist/core/runner/delegation-owner.js +4 -1
- package/dist/core/runner/gate-exit.d.ts +6 -0
- package/dist/core/runner/gate-exit.js +13 -4
- package/dist/core/runner/inherited-ask-grants.js +1 -1
- package/dist/core/runner/memory-consolidation-driver.d.ts +10 -5
- package/dist/core/runner/memory-consolidation-driver.js +12 -9
- package/dist/core/runner/memory-consolidation-write-judge.d.ts +2 -1
- package/dist/core/runner/memory-consolidation-write-judge.js +3 -2
- package/dist/core/runner/person-path-rows.d.ts +8 -3
- package/dist/core/runner/person-path-rows.js +5 -1
- package/dist/core/runner/placement-fence.d.ts +12 -0
- package/dist/core/runner/placement-fence.js +20 -6
- package/dist/core/runner/prepare-ask-lane.js +5 -5
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +7 -2
- package/dist/core/runner/prepare-caps-and-workflow.js +7 -4
- package/dist/core/runner/prepare-config-doors.js +4 -0
- package/dist/core/runner/prepare-delegation-surface.d.ts +3 -0
- package/dist/core/runner/prepare-delegation-surface.js +2 -2
- package/dist/core/runner/prepare-execution-env.js +17 -6
- package/dist/core/runner/prepare-gate-stations.d.ts +5 -0
- package/dist/core/runner/prepare-gate-stations.js +5 -5
- package/dist/core/runner/prepare-hands-readface.d.ts +2 -1
- package/dist/core/runner/prepare-hands-readface.js +5 -4
- package/dist/core/runner/prepare-inherited-gate.d.ts +13 -9
- package/dist/core/runner/prepare-inherited-gate.js +12 -6
- package/dist/core/runner/prepare-memory-engine-session.d.ts +2 -4
- package/dist/core/runner/prepare-memory-engine-session.js +4 -4
- package/dist/core/runner/prepare-memory.d.ts +7 -2
- package/dist/core/runner/prepare-memory.js +41 -39
- package/dist/core/runner/prepare-park-ask.js +4 -3
- package/dist/core/runner/prepare-policy-chain.js +7 -7
- package/dist/core/runner/prepare-prompt-inputs.js +1 -1
- package/dist/core/runner/prepare-task.js +26 -18
- package/dist/core/runner/prepare-wiring-manifest.d.ts +3 -1
- package/dist/core/runner/prepare-wiring-manifest.js +3 -2
- package/dist/core/runner/prepare-workspace-restore.js +3 -6
- package/dist/core/runner/resume-admission.d.ts +2 -2
- package/dist/core/runner/resume-admission.js +2 -23
- package/dist/core/runner/role-resolution-table.d.ts +98 -0
- package/dist/core/runner/role-resolution-table.js +62 -0
- package/dist/core/runner/run-compaction-machinery.js +2 -2
- package/dist/core/runner/run-identity-wiring.js +12 -9
- package/dist/core/runner/run-leg.js +9 -5
- package/dist/core/runner/run-notification-lane.js +22 -22
- package/dist/core/runner/run-recovery-lanes.js +3 -3
- package/dist/core/runner/run-settle-and-teardown.js +3 -2
- package/dist/core/runner/run-terminal-adoption.js +1 -1
- package/dist/core/runner/run-turn-boundary.js +14 -15
- package/dist/core/runner/runtask.js +1 -1
- package/dist/core/runner/terminal-account.js +1 -1
- package/dist/core/runner/tool-occurrence.d.ts +4 -2
- package/dist/core/runner/tool-occurrence.js +2 -2
- package/dist/core/runner-deps.d.ts +7 -3
- package/dist/core/secret-env.d.ts +1 -1
- package/dist/core/secret-env.js +4 -4
- package/dist/core/session-checkout.d.ts +168 -0
- package/dist/core/session-checkout.js +579 -0
- package/dist/core/session-store.d.ts +12 -4
- package/dist/core/session-store.js +23 -3
- package/dist/core/session.d.ts +16 -2
- package/dist/core/session.js +3 -0
- package/dist/core/shell-read-silence.js +8 -0
- package/dist/core/store-contracts/checkpoint-store-contract.d.ts +0 -12
- package/dist/core/store-contracts/checkpoint-store-contract.js +6 -7
- package/dist/core/store-contracts/peer-directory-contract.js +8 -1
- package/dist/core/store-contracts/session-store-contract.js +39 -0
- package/dist/core/task-event.d.ts +30 -5
- package/dist/core/task-notification.d.ts +119 -32
- package/dist/core/task-notification.js +186 -100
- package/dist/core/task-registry-agent.d.ts +25 -2
- package/dist/core/task-registry-agent.js +56 -22
- package/dist/core/task-registry-shared.d.ts +33 -11
- package/dist/core/task-registry.d.ts +33 -9
- package/dist/core/task-registry.js +36 -18
- package/dist/core/task-spec-members.js +1 -1
- package/dist/core/task-spec.d.ts +27 -2
- package/dist/core/tool-errors.d.ts +14 -6
- package/dist/core/tool-errors.js +1 -1
- package/dist/core/tool-policy.d.ts +32 -13
- package/dist/core/tool-policy.js +27 -17
- package/dist/core/tool-result-store.d.ts +20 -0
- package/dist/core/tool-spec.d.ts +42 -19
- package/dist/core/trace.d.ts +3 -2
- package/dist/core/types.d.ts +1 -1
- package/dist/core/untrusted-egress.d.ts +15 -4
- package/dist/core/untrusted-egress.js +23 -22
- package/dist/core/workflow-journal-store.d.ts +11 -0
- package/dist/core/workflow-journal-store.js +7 -0
- package/dist/core/workflow-run-store.d.ts +9 -0
- package/dist/core/workflow-run-store.js +6 -0
- package/dist/core/workspace-snapshot.d.ts +3 -1
- package/dist/core/workspace-snapshot.js +1 -0
- package/dist/engine/compaction/compaction.d.ts +2 -1
- package/dist/engine/harness/types.d.ts +67 -1
- package/dist/engine/harness/types.js +108 -0
- package/dist/engine/session/import-validate.js +6 -1
- package/dist/engine/session/session.d.ts +30 -1
- package/dist/engine/session/session.js +48 -1
- package/dist/index.d.ts +12 -7
- package/dist/index.js +12 -7
- package/dist/internal/harness-types.d.ts +1 -1
- package/dist/orchestration/run-workflow-tool.d.ts +8 -1
- package/dist/orchestration/run-workflow-tool.js +8 -0
- package/dist/orchestration/workflow-types.d.ts +2 -1
- package/dist/orchestration/workflow.d.ts +6 -0
- package/dist/orchestration/workflow.js +5 -2
- package/dist/stores/file/checkpoint-store.d.ts +6 -0
- package/dist/stores/file/checkpoint-store.js +4 -1
- package/dist/stores/file/file-history-store.d.ts +13 -0
- package/dist/stores/file/file-history-store.js +75 -13
- package/dist/stores/file/index.d.ts +11 -1
- package/dist/stores/file/index.js +7 -11
- package/dist/stores/file/permission-rule-store.d.ts +23 -0
- package/dist/stores/file/permission-rule-store.js +75 -7
- package/dist/stores/file/session-store.js +2 -1
- package/dist/stores/file/tool-result-store.d.ts +14 -0
- package/dist/stores/file/tool-result-store.js +39 -2
- package/dist/stores/file/workflow-journal-store.d.ts +4 -0
- package/dist/stores/file/workflow-journal-store.js +17 -0
- package/dist/stores/file/workflow-run-store.d.ts +3 -0
- package/dist/stores/file/workflow-run-store.js +15 -0
- package/dist/tools/fs/bash-program-position.js +3 -3
- package/dist/tools/fs/program-read-model.d.ts +34 -10
- package/dist/tools/fs/program-read-model.js +37 -7
- package/dist/tools/fs/program-read-model.rows.js +13 -2
- package/dist/tools/fs/read-deny.d.ts +28 -3
- package/dist/tools/fs/read-deny.js +18 -2
- package/dist/tools/fs/removal-targets.js +3 -3
- package/dist/tools/fs/safety.d.ts +2 -0
- package/dist/tools/fs/safety.js +1 -1
- package/dist/tools/fs/shell-read-argv.d.ts +8 -1
- package/dist/tools/fs/shell-read-argv.js +34 -29
- package/dist/tools/fs/shell-read-bindings.d.ts +2 -0
- package/dist/tools/fs/shell-read-bindings.js +5 -1
- package/dist/tools/fs/shell-read-brace.d.ts +18 -0
- package/dist/tools/fs/shell-read-brace.js +79 -0
- package/dist/tools/fs/shell-read-check.d.ts +8 -2
- package/dist/tools/fs/shell-read-check.js +16 -14
- package/dist/tools/fs/shell-read-establish.js +23 -16
- package/dist/tools/fs/shell-read-judge.d.ts +11 -0
- package/dist/tools/fs/shell-read-judge.js +3 -3
- package/dist/tools/fs/shell-read-plan.d.ts +10 -0
- package/dist/tools/fs/shell-read-plan.js +189 -93
- package/dist/tools/fs/shell-read-start.d.ts +19 -9
- package/dist/tools/fs/shell-read-start.js +20 -12
- package/dist/tools/fs/shell-read-word.d.ts +10 -0
- package/dist/tools/fs/shell-read-word.js +9 -5
- package/dist/tools/fs/shell-read-workdir.d.ts +26 -7
- package/dist/tools/fs/shell-read-workdir.js +73 -12
- package/dist/tools/fs/shell-read-write-targets.js +13 -8
- package/dist/tools/worktree.d.ts +3 -2
- package/dist/tools/worktree.js +7 -35
- package/package.json +3 -2
- package/test/export-surface.snapshot.json +135 -11
- package/wire-changes/core-stores-sql@7.63.0.json +30 -0
- package/wire-changes/core-stores-sql@7.64.0.json +30 -0
- package/wire-changes/core@7.63.0.json +3523 -0
- package/wire-changes/core@7.64.0.json +2653 -0
- package/wire-changes/mods-kernel@7.63.0.json +30 -0
- package/wire-changes/mods-kernel@7.64.0.json +30 -0
- package/wire-changes/primitives@7.63.0.json +445 -0
- package/wire-changes/primitives@7.64.0.json +30 -0
- package/dist/core/credential-vocabulary.d.ts +0 -176
- package/dist/core/credential-vocabulary.js +0 -190
- package/dist/core/redaction-passes.d.ts +0 -82
- package/dist/core/redaction-passes.js +0 -377
|
@@ -553,10 +553,10 @@ export type ResumeOutcome = {
|
|
|
553
553
|
*/
|
|
554
554
|
boundCallId: string;
|
|
555
555
|
/**
|
|
556
|
-
* design/80 D-1 §2 (slice 1a.2): the **server-minted opaque** hash of the pending tool call
|
|
556
|
+
* design/80 D-1 §2 (slice 1a.2): the **server-minted opaque** hash of the pending tool call — its tool and the input
|
|
557
557
|
* that the human actually saw/approved (`PendingAction.tool_approval.boundInputHash`, computed by the
|
|
558
|
-
* engine at suspend-mint via {@link import("./canonical-json.js").
|
|
559
|
-
* `args`). The caller echoes it VERBATIM — it is opaque; the SDK/service NEVER re-canonicalize args
|
|
558
|
+
* engine at suspend-mint via {@link import("./canonical-json.js").exactBoundInputHashOf} over the call's `toolName` and
|
|
559
|
+
* post-hook `args`). The caller echoes it VERBATIM — it is opaque; the SDK/service NEVER re-canonicalize args
|
|
560
560
|
* (a second runtime's serialization could diverge → false mismatch → fail-closed a
|
|
561
561
|
* legitimate approval). The resume verifies it by **string equality** against the checkpoint's
|
|
562
562
|
* persisted value (`checkpoint.invalid_outcome`, fail-closed, pre-CAS) — closing the TOCTOU "same call
|
|
@@ -844,9 +844,9 @@ export type PendingAction = {
|
|
|
844
844
|
* list of well-formed entries; a row parked before it reads ABSENT. Display metadata — no gate, CAS or resume path reads it. */
|
|
845
845
|
askReasons?: readonly import("./ask-origin.js").AskReason[];
|
|
846
846
|
/**
|
|
847
|
-
* design/80 D-1 §2 (slice 1a.2): the server-minted **opaque** boundInputHash of {@link args} — a
|
|
848
|
-
*
|
|
849
|
-
*
|
|
847
|
+
* design/80 D-1 §2 (slice 1a.2): the server-minted **opaque** boundInputHash of {@link toolName} with {@link args} — a SHA-256 (hex)
|
|
848
|
+
* via {@link import("./canonical-json.js").exactBoundInputHashOf}, computed ONCE here at suspend-mint and persisted on the row, which says
|
|
849
|
+
* so with its `tool_binding` requirement word (a row that does not is refused `requirements_damaged`). The operator sees it (surfaced on the pending record) and
|
|
850
850
|
* echoes it back as {@link ResumeOutcome} `boundInputHash`; the resume verifies opaque string equality
|
|
851
851
|
* against THIS value (never re-serializing the args — see the field's doc). Absent only on a legacy
|
|
852
852
|
* pre-1a.2 checkpoint (deserialized without it), in which case the resume skips the hash check.
|
|
@@ -1903,7 +1903,12 @@ export interface CheckpointSummary {
|
|
|
1903
1903
|
/** ALWAYS present — the row's own answer to whether anything in it keeps THIS engine from resuming it
|
|
1904
1904
|
* ({@link CheckpointRowVerdict}; `judgeCheckpointRow`): the verdict the resume throws at its first rung, so a row this engine
|
|
1905
1905
|
* refuses is not listed as an approvable card. `ok` is not "the resume will run": a deployment fact, a resume input or the
|
|
1906
|
-
* decision can still refuse it at the resume. Engine text and closed words only — no row content.
|
|
1906
|
+
* decision can still refuse it at the resume. Engine text and closed words only — no row content.
|
|
1907
|
+
*
|
|
1908
|
+
* **A ROW THE PROJECTION CANNOT READ** (a record the row lacks or holds as something else, a member that throws when read) is
|
|
1909
|
+
* still ONE row of the listing, never a failed page: its `rowVerdict` is never `ok` (the judge's verdict, else `damaged` /
|
|
1910
|
+
* `requirements_damaged`), it carries `token`, `sessionId` and `scope`, and — each only when it reads — `gateKind`, `createdAt`
|
|
1911
|
+
* and `deadline`; it carries no other member. A consumer renders such a row by its `rowVerdict`. */
|
|
1907
1912
|
rowVerdict: CheckpointRowVerdict;
|
|
1908
1913
|
/** Non-secret stable identity ({@link Checkpoint.checkpointId}) — absent on legacy rows. */
|
|
1909
1914
|
checkpointId?: string;
|
|
@@ -1911,8 +1916,9 @@ export interface CheckpointSummary {
|
|
|
1911
1916
|
sessionId: string;
|
|
1912
1917
|
/** The multi-tenant scope this checkpoint lives in ({@link Checkpoint.scope}) — always equal to the query's. */
|
|
1913
1918
|
scope: string;
|
|
1914
|
-
/** The gate's discriminant ({@link CheckpointGate}.kind): which kind of pause this is.
|
|
1915
|
-
|
|
1919
|
+
/** The gate's discriminant ({@link CheckpointGate}.kind): which kind of pause this is. Present on every row the projection reads;
|
|
1920
|
+
* OMITTED only on a row whose gate does not read (see {@link rowVerdict}), whose verdict is then not `ok`. */
|
|
1921
|
+
gateKind?: CheckpointGate["kind"];
|
|
1916
1922
|
/** The deterministic risk tier (1..5) when the gate carries a {@link RiskDescriptor} (the `human` /
|
|
1917
1923
|
* `irreversible_ask` approval escalations), derived via {@link riskSeverity} from the descriptor's axes —
|
|
1918
1924
|
* the SAME value as `gate.riskDescriptor.severity`, recomputed from the single source helper rather than
|
|
@@ -1925,7 +1931,8 @@ export interface CheckpointSummary {
|
|
|
1925
1931
|
* present whenever the checkpoint carries a {@link Checkpoint.resourceLedger} (every resource_limit suspend,
|
|
1926
1932
|
* and every approval suspend on the D-E-core budget-read path); `undefined` when no ledger is attached. */
|
|
1927
1933
|
spentMicroUsd?: number;
|
|
1928
|
-
/** The awaiting-human SLA / abandonment deadline ({@link Checkpoint.deadline}, epoch ms) when present
|
|
1934
|
+
/** The awaiting-human SLA / abandonment deadline ({@link Checkpoint.deadline}, epoch ms) when it is present and a finite number
|
|
1935
|
+
* (a stored value that is not one — a `NaN` a JSON round trip left, a value of another type — is left off, not echoed). */
|
|
1929
1936
|
deadline?: number;
|
|
1930
1937
|
/** design S1d (source-tag): the issuing worker's session id ({@link Checkpoint.sourceSessionId}) — projected so
|
|
1931
1938
|
* a supervisor inbox attributes each pending checkpoint to its worker in ONE `listByScope` call (no N+1
|
|
@@ -1957,7 +1964,11 @@ export interface CheckpointSummary {
|
|
|
1957
1964
|
* {@link toolCallId} absence-shape note applies). It names the call that PRESENTED the plan, not a call the pause
|
|
1958
1965
|
* gates: `toolCallId` stays omitted on a plan_review row. */
|
|
1959
1966
|
requestedByCallId?: string;
|
|
1960
|
-
/** The pending tool's name ({@link PendingAction} `tool_approval.toolName`) when this is an approval suspend
|
|
1967
|
+
/** The pending tool's name ({@link PendingAction} `tool_approval.toolName`) when this is an approval suspend — the very name
|
|
1968
|
+
* the row's `boundInputHash` was minted over (`exactBoundInputHashOf(toolName, args)`), as the row records it (an alias call
|
|
1969
|
+
* records the tool's own name). With {@link toolCallId} it is the listing's half of the approval binding: two parks of one
|
|
1970
|
+
* call id over the same arguments by two tools list two names and hold two hashes. The hash itself stays on the drilled-in
|
|
1971
|
+
* row, opaque, echoed and never re-derived by a host.
|
|
1961
1972
|
* OMITTED (not `null`) for a non-`tool_approval` pendingAction — see {@link toolCallId}'s absence-shape note. */
|
|
1962
1973
|
toolName?: string;
|
|
1963
1974
|
/** Which approval card the pending call renders under — the gate's {@link CheckpointGate} `approvalCard` echoed when
|
|
@@ -2106,6 +2117,10 @@ export interface CheckpointSummary {
|
|
|
2106
2117
|
* calls it again. A store hands it its own seat. `verdict` is a store's memo of this row's `judgeCheckpointRow` under this
|
|
2107
2118
|
* engine (an in-tree store keeps it by the stored row object, so a replaced row is judged again; an external store by the stored
|
|
2108
2119
|
* blob's sha256 plus the engine build, `CONTRACT_KIT_ENGINE_VERSION`); absent, the row is judged now. The resume never reads it.
|
|
2120
|
+
*
|
|
2121
|
+
* TOTAL, as the judge is: a row this projection cannot read (a record it lacks or holds as something else, a member that throws
|
|
2122
|
+
* when read) is answered, never thrown — as the row's identity alone ({@link CheckpointSummary.rowVerdict}'s unreadable form), with
|
|
2123
|
+
* a verdict that is not `ok` and one sentence to `disclose`. One damaged row never fails the page that lists it.
|
|
2109
2124
|
*/
|
|
2110
2125
|
export declare function summarizeCheckpoint(cp: Checkpoint, disclose?: (sentence: string) => void, verdict?: CheckpointRowVerdict): CheckpointSummary;
|
|
2111
2126
|
/**
|
|
@@ -2465,6 +2480,8 @@ export interface CheckpointStore {
|
|
|
2465
2480
|
* the once-only resolve. The PENDING predicate is byte-for-byte the {@link resolve} CAS's (`scope === scope &&
|
|
2466
2481
|
* status === 'pending'`), so the list reflects exactly the rows that are still resumable. Order is unspecified
|
|
2467
2482
|
* (the inbox sorts by `severity`/`deadline` itself). An empty scope returns `[]`. Required: every store answers it.
|
|
2483
|
+
* A row whose summary cannot be read is one row of the answer in its unreadable form ({@link CheckpointSummary.rowVerdict}),
|
|
2484
|
+
* never a failed page: the rows beside it are listed as they would be without it.
|
|
2468
2485
|
*/
|
|
2469
2486
|
listByScope(scope: string): Promise<CheckpointSummary[]>;
|
|
2470
2487
|
/**
|
|
@@ -2,7 +2,7 @@ import { randomBytes, randomUUID } from "node:crypto";
|
|
|
2
2
|
import { uuidv7 } from "../internal/harness.js";
|
|
3
3
|
import { PROBE_REASON_MAX, inlineUntrusted, sanitizeUntrustedText } from "./untrusted-text.js";
|
|
4
4
|
import { CheckpointError, checkpointVersionOf, isPlainRecord, normalizeProbeCause, safeDataValue } from "./checkpoint-features.js";
|
|
5
|
-
import { judgeCheckpointRow, retiredSteerSeatRefusal } from "./checkpoint-row-verdict.js";
|
|
5
|
+
import { boundedThrownName, judgeCheckpointRow, retiredSteerSeatRefusal, UNREADABLE_ROW_VERDICT } from "./checkpoint-row-verdict.js";
|
|
6
6
|
import { carriesBidiControls } from "./tool-policy.js";
|
|
7
7
|
import { agentIdOf, legTaskIdOf } from "./leg-identity.js";
|
|
8
8
|
import { isAutoModeFallbackCause, readDenialLimitFallback } from "./auto-mode.js";
|
|
@@ -12,8 +12,8 @@ import { describeRejectedValue } from "./tool-search-setting.js";
|
|
|
12
12
|
import { readBoundBinding } from "./skill-grant-binding.js";
|
|
13
13
|
import { checkpointExecutionRecorded, executionRecordDisposition, ExecutionOutcomeConflictError, } from "./checkpoint-execution-record.js";
|
|
14
14
|
import { checkpointHolderMatches, checkpointOccMatches, checkpointRevOf } from "./checkpoint-generation.js";
|
|
15
|
-
import { parkedApprovalCardOf } from "./pause-registry.js";
|
|
16
|
-
import { checkpointDeadlinePassed, deleteSessionRowsAtStart, readCheckpointOverdueQuery, readCheckpointSessionQuery, selectOverduePage, selectSessionPage } from "./checkpoint-queries.js";
|
|
15
|
+
import { isGateKind, parkedApprovalCardOf } from "./pause-registry.js";
|
|
16
|
+
import { checkpointDeadlinePassed, deleteSessionRowsAtStart, readCheckpointOverdueQuery, readCheckpointSessionQuery, rowMemberProblem, selectOverduePage, selectSessionPage } from "./checkpoint-queries.js";
|
|
17
17
|
import { renderUntrustedCommandText, stripFormatCharacters } from "./permission-rule-model.js";
|
|
18
18
|
import { egressText } from "./untrusted-egress.js";
|
|
19
19
|
import { steerReplayRefusal } from "./steer-replay.js";
|
|
@@ -213,6 +213,47 @@ export function planReviewRequesterOf(pendingAction) {
|
|
|
213
213
|
}
|
|
214
214
|
export function summarizeCheckpoint(cp, disclose, verdict) {
|
|
215
215
|
const rowVerdict = verdict ?? judgeCheckpointRow(cp);
|
|
216
|
+
let why;
|
|
217
|
+
try {
|
|
218
|
+
const problem = rowMemberProblem(cp);
|
|
219
|
+
if (problem === undefined)
|
|
220
|
+
return projectCheckpoint(cp, rowVerdict, disclose);
|
|
221
|
+
why = problem.problem;
|
|
222
|
+
}
|
|
223
|
+
catch (e) {
|
|
224
|
+
why = boundedThrownName(e);
|
|
225
|
+
}
|
|
226
|
+
return unreadableSummary(cp, rowVerdict, disclose, why);
|
|
227
|
+
}
|
|
228
|
+
const isFiniteMember = (v) => typeof v === "number" && Number.isFinite(v);
|
|
229
|
+
function unreadableSummary(cp, judged, disclose, why) {
|
|
230
|
+
const read = (member) => {
|
|
231
|
+
try {
|
|
232
|
+
return member();
|
|
233
|
+
}
|
|
234
|
+
catch {
|
|
235
|
+
return undefined;
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
const token = read(() => cp.token);
|
|
239
|
+
const sessionId = read(() => cp.sessionId);
|
|
240
|
+
const scope = read(() => cp.scope);
|
|
241
|
+
const gateKind = read(() => cp.gate.kind);
|
|
242
|
+
const createdAt = read(() => cp.createdAt);
|
|
243
|
+
const deadline = read(() => cp.deadline);
|
|
244
|
+
const checkpointId = read(() => cp.checkpointId);
|
|
245
|
+
disclose?.(`checkpoint ${typeof checkpointId === "string" ? JSON.stringify(checkpointId) : "null"} of session ${typeof sessionId === "string" ? JSON.stringify(sessionId) : "(unreadable)"}: its summary could not be projected (${why}) — it is listed as unreadable, with the members that could be read`);
|
|
246
|
+
return {
|
|
247
|
+
token: (typeof token === "string" ? token : ""),
|
|
248
|
+
rowVerdict: judged.kind === "ok" ? UNREADABLE_ROW_VERDICT : judged,
|
|
249
|
+
sessionId: typeof sessionId === "string" ? sessionId : "",
|
|
250
|
+
scope: typeof scope === "string" ? scope : "",
|
|
251
|
+
...(isGateKind(gateKind) ? { gateKind } : {}),
|
|
252
|
+
...(isFiniteMember(createdAt) ? { createdAt } : {}),
|
|
253
|
+
...(isFiniteMember(deadline) ? { deadline } : {}),
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
function projectCheckpoint(cp, rowVerdict, disclose) {
|
|
216
257
|
const facts = checkpointIndexFacts(cp);
|
|
217
258
|
const rowName = `checkpoint ${JSON.stringify(cp.checkpointId ?? null)} of session ${JSON.stringify(cp.sessionId)}`;
|
|
218
259
|
const descriptor = facts.riskDescriptor;
|
|
@@ -261,7 +302,7 @@ export function summarizeCheckpoint(cp, disclose, verdict) {
|
|
|
261
302
|
gateKind: facts.gateKind,
|
|
262
303
|
...(severity !== undefined ? { severity } : {}),
|
|
263
304
|
...(cp.resourceLedger !== undefined ? { spentMicroUsd: cp.resourceLedger.spentMicroUsd } : {}),
|
|
264
|
-
...(facts.deadline
|
|
305
|
+
...(isFiniteMember(facts.deadline) ? { deadline: facts.deadline } : {}),
|
|
265
306
|
createdAt: facts.createdAt,
|
|
266
307
|
...(cp.sourceSessionId !== undefined ? { sourceSessionId: cp.sourceSessionId } : {}),
|
|
267
308
|
...(agentId !== undefined ? { agentId } : {}),
|
|
@@ -2,10 +2,13 @@
|
|
|
2
2
|
export type ComplianceProfile = "hipaa" | "zdr";
|
|
3
3
|
/** Closed capability set the ENGINE can veto end-to-end (see the module header for the entry-point
|
|
4
4
|
* map — a capability is admitted here only with its full interception story). */
|
|
5
|
-
export type ComplianceCapability = "mcp_servers" | "workflows" | "web_fetch" | "org_memory_mount" | "a2a_peers";
|
|
5
|
+
export type ComplianceCapability = "mcp_servers" | "workflows" | "web_fetch" | "org_memory_mount" | "a2a_peers" | "memory_consolidation";
|
|
6
6
|
/** Every member of {@link ComplianceCapability} — the fail-closed "deny everything managed" set used
|
|
7
7
|
* when the posture resolver itself fails. `satisfies` keeps it in lockstep with the union. */
|
|
8
|
-
export declare const COMPLIANCE_CAPABILITIES: readonly ["mcp_servers", "workflows", "web_fetch", "org_memory_mount", "a2a_peers"];
|
|
8
|
+
export declare const COMPLIANCE_CAPABILITIES: readonly ["mcp_servers", "workflows", "web_fetch", "org_memory_mount", "a2a_peers", "memory_consolidation"];
|
|
9
|
+
/** The deployment's posture seat: the posture that applies to `principal` (`undefined` = no principal — the deployment's
|
|
10
|
+
* own posture). The shape of `RunnerDeps.compliancePostureResolver` and of a consolidation run's `compliance.postureOf`. */
|
|
11
|
+
export type CompliancePostureSeat = (principal: string | undefined) => CompliancePosture | undefined | Promise<CompliancePosture | undefined>;
|
|
9
12
|
/**
|
|
10
13
|
* A principal's resolved compliance posture, supplied by the trusted deployment resolver. The
|
|
11
14
|
* effective deny set is `BUILTIN_COMPLIANCE_DENIES[profile] ∪ additionalDenies` — supply can only
|
|
@@ -21,6 +24,7 @@ export interface CompliancePosture {
|
|
|
21
24
|
* capabilities this engine manages: hipaa denies `allow_web_fetch` ⇒ `web_fetch`. (CC's
|
|
22
25
|
* `allow_memory_sync` row maps onto the org-memory plane and joins this table together with the
|
|
23
26
|
* memory-admission seam; CC has no MCP/workflow rows — those stay reachable via `additionalDenies`.)
|
|
27
|
+
* Both floors carry `memory_consolidation`: a consolidation run archives the model's input and output verbatim.
|
|
24
28
|
*/
|
|
25
29
|
export declare const BUILTIN_COMPLIANCE_DENIES: Record<ComplianceProfile, readonly ComplianceCapability[]>;
|
|
26
30
|
/**
|
package/dist/core/compliance.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { describeRejectedValue } from "./tool-search-setting.js";
|
|
2
|
-
export const COMPLIANCE_CAPABILITIES = Object.freeze(["mcp_servers", "workflows", "web_fetch", "org_memory_mount", "a2a_peers"]);
|
|
2
|
+
export const COMPLIANCE_CAPABILITIES = Object.freeze(["mcp_servers", "workflows", "web_fetch", "org_memory_mount", "a2a_peers", "memory_consolidation"]);
|
|
3
3
|
export const BUILTIN_COMPLIANCE_DENIES = {
|
|
4
|
-
hipaa: ["web_fetch", "org_memory_mount"],
|
|
5
|
-
zdr: ["org_memory_mount"],
|
|
4
|
+
hipaa: ["web_fetch", "org_memory_mount", "memory_consolidation"],
|
|
5
|
+
zdr: ["org_memory_mount", "memory_consolidation"],
|
|
6
6
|
};
|
|
7
7
|
const PROFILES = ["hipaa", "zdr"];
|
|
8
8
|
function codedError(code, message) {
|
|
@@ -29,17 +29,34 @@ import type { ModelRef } from "./model-seat.js";
|
|
|
29
29
|
* · `autoCompactTokens` — the trigger-side window (dual-window semantics: lowers the compaction trigger and
|
|
30
30
|
* the context-editing frontier without touching the physical request budget). Clamped to the physical
|
|
31
31
|
* window by the one resolver, exactly as a model-card declaration is.
|
|
32
|
-
* · `
|
|
33
|
-
*
|
|
34
|
-
* one gate, inside `maybeCompact`, fed by one settings assembly). A request that states its own
|
|
35
|
-
* `compaction.enabled` outranks it: the request is the author, this seat is the deployment's default —
|
|
36
|
-
* the same "the spec's own value wins, the deployment fills an unset one" law every other seat follows.
|
|
32
|
+
* · `autoCompact` / `manualCompact` — the deployment's twins of the task's two compaction seats, each with its
|
|
33
|
+
* seat's reach and each the default for its own seat only ({@link compactionEnabled}).
|
|
37
34
|
*/
|
|
38
35
|
export interface ContextWindowOverlay {
|
|
39
36
|
readonly contextTokens?: number;
|
|
40
37
|
readonly autoCompactTokens?: number;
|
|
41
|
-
readonly
|
|
38
|
+
readonly autoCompact?: boolean;
|
|
39
|
+
readonly manualCompact?: boolean;
|
|
42
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* The two compaction seats, one per kind of pass — which pass reads which seat is {@link compactionEnabled}'s
|
|
43
|
+
* contract. A task's `compaction`, a `Runner.compactSession` request's `compaction` (which takes `manualCompact`
|
|
44
|
+
* only — a pass outside a run is a requested one) and a deployment's overlay carry them, and every one of those
|
|
45
|
+
* doors judges them with {@link compactionSeatsDefect}.
|
|
46
|
+
*/
|
|
47
|
+
declare const COMPACTION_SEATS: readonly ["autoCompact", "manualCompact"];
|
|
48
|
+
export type CompactionSeat = (typeof COMPACTION_SEATS)[number];
|
|
49
|
+
/**
|
|
50
|
+
* The seats' ONE judgment, for every bag that carries them (a task's `compaction`, a `Runner.compactSession` request's
|
|
51
|
+
* `compaction`, a deployment overlay): the retired single seat `enabled` is refused by name with the sentence that names
|
|
52
|
+
* the two ({@link RETIRED_COMPACTION_SEAT_KEYS}; never read as either), then a seat present (a defined value) that is not
|
|
53
|
+
* a boolean. `subject` is the bag in the door's own words (`TaskSpec.compaction`, `compaction`,
|
|
54
|
+
* `RunnerDeps: contextSettings["w"]`). Answers which and the sentence; each door throws it with its own code.
|
|
55
|
+
*/
|
|
56
|
+
export declare function compactionSeatsDefect(bag: object, subject: string): {
|
|
57
|
+
readonly kind: "retired" | "value";
|
|
58
|
+
readonly sentence: string;
|
|
59
|
+
} | undefined;
|
|
43
60
|
/**
|
|
44
61
|
* The seat: catalog word → overlay. Words absent from the table are "nothing declared".
|
|
45
62
|
*
|
|
@@ -84,9 +101,22 @@ export declare function assertContextSettingsWords<T extends ContextSettings | u
|
|
|
84
101
|
* moments an operator can get it wrong.
|
|
85
102
|
*/
|
|
86
103
|
export declare function assertContextSettingsValue(v: unknown, where: string): ContextSettings | undefined;
|
|
87
|
-
/**
|
|
88
|
-
*
|
|
89
|
-
|
|
104
|
+
/**
|
|
105
|
+
* Is THIS seat on for a pass?
|
|
106
|
+
*
|
|
107
|
+
* @contract compaction.two_seats — every compaction pass asks exactly one seat, through this function, and the seat
|
|
108
|
+
* is fixed by who starts the pass. `autoCompact` holds the three lanes the engine starts by itself: the turn-boundary
|
|
109
|
+
* pass at the window threshold (with the trim-pressure pass it forces), the recovery pass (a provider's
|
|
110
|
+
* prompt-too-long rejection, the request guard's compaction arm) and the end-of-task summary. `manualCompact` holds
|
|
111
|
+
* the passes a caller asks for: `TaskStream.compact`, an extension's `$.session.compact` and `Runner.compactSession`.
|
|
112
|
+
* One law per seat: the request's own value for the seat is the author, the deployment overlay's twin of the same seat
|
|
113
|
+
* fills an unset one, nothing declared means ON — and switching one seat off never switches off the other. With
|
|
114
|
+
* `autoCompact` off no recovery pass runs: a request the provider rejects as too long is neither summarized nor
|
|
115
|
+
* retried, and the rejection ends the run as the terminal failure it is (the provider's code and sentence), never a
|
|
116
|
+
* silent retry. With `manualCompact` off a requested pass is answered `"disabled"` with its `compaction_outcome` frame
|
|
117
|
+
* (`trigger: "manual"`) and no model call, and the boundary goes on with its own pass.
|
|
118
|
+
*/
|
|
119
|
+
export declare function compactionEnabled(seat: CompactionSeat, requested: Readonly<Partial<Record<CompactionSeat, boolean>>> | undefined, overlay: ContextWindowOverlay | undefined): boolean;
|
|
90
120
|
/**
|
|
91
121
|
* The overlay's view of a model's PHYSICAL window — the model card's chain with the deployment's live
|
|
92
122
|
* declaration CLAMPED over it. The single expression `guardBudget` and `resolveTriggerWindow` share.
|
|
@@ -101,3 +131,4 @@ export declare function compactionEnabled(specEnabled: boolean | undefined, over
|
|
|
101
131
|
* number there is.
|
|
102
132
|
*/
|
|
103
133
|
export declare function physicalWindowOf(model: Model, overlay: ContextWindowOverlay | undefined): number;
|
|
134
|
+
export {};
|
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
import { tierAliasVia } from "./roles.js";
|
|
2
2
|
import { optionKeys, receiveMembers } from "./own-property-receipt.js";
|
|
3
|
-
|
|
3
|
+
import { RETIRED_COMPACTION_SEAT_KEYS, retiredKeyOf, retiredKeyRefusal } from "./retired-keys.js";
|
|
4
|
+
import { describeRejectedValue } from "./tool-search-setting.js";
|
|
5
|
+
const OVERLAY_KEYS = optionKeys()({ contextTokens: 0, autoCompactTokens: 0, autoCompact: 0, manualCompact: 0 });
|
|
6
|
+
const OVERLAY_READ_NAMES = Object.freeze([...OVERLAY_KEYS, ...Object.keys(RETIRED_COMPACTION_SEAT_KEYS)]);
|
|
7
|
+
const COMPACTION_SEATS = Object.freeze(["autoCompact", "manualCompact"]);
|
|
8
|
+
const SEAT_REACH = Object.freeze({
|
|
9
|
+
autoCompact: "false switches off the passes the engine starts by itself",
|
|
10
|
+
manualCompact: "false refuses the passes a caller asks for",
|
|
11
|
+
});
|
|
12
|
+
export function compactionSeatsDefect(bag, subject) {
|
|
13
|
+
const retired = retiredKeyOf(bag, RETIRED_COMPACTION_SEAT_KEYS);
|
|
14
|
+
if (retired !== undefined)
|
|
15
|
+
return { kind: "retired", sentence: retiredKeyRefusal(retired, subject).message };
|
|
16
|
+
for (const seat of COMPACTION_SEATS) {
|
|
17
|
+
const value = Reflect.get(bag, seat);
|
|
18
|
+
if (value !== undefined && typeof value !== "boolean") {
|
|
19
|
+
return { kind: "value", sentence: `${subject}.${seat} must be a boolean when given (got ${describeRejectedValue(value)}) — ${SEAT_REACH[seat]}; omit it for the default (on)` };
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
4
24
|
export function contextOverlayFor(settings, ref, catalog) {
|
|
5
25
|
if (settings === undefined || typeof ref !== "string")
|
|
6
26
|
return undefined;
|
|
@@ -21,33 +41,35 @@ export function assertContextSettingsValue(v, where) {
|
|
|
21
41
|
if (v === undefined)
|
|
22
42
|
return undefined;
|
|
23
43
|
if (v === null || typeof v !== "object" || Array.isArray(v)) {
|
|
24
|
-
throw new Error(`${where}: contextSettings must be a plain Record<string, {contextTokens?, autoCompactTokens?,
|
|
44
|
+
throw new Error(`${where}: contextSettings must be a plain Record<string, {contextTokens?, autoCompactTokens?, autoCompact?, manualCompact?}> (got ${v === null ? "null" : Array.isArray(v) ? "array" : typeof v})`);
|
|
25
45
|
}
|
|
26
46
|
const out = {};
|
|
27
47
|
for (const [word, raw] of Object.entries(v)) {
|
|
28
48
|
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) {
|
|
29
49
|
throw new Error(`${where}: contextSettings[${JSON.stringify(word)}] must be a plain object (got ${raw === null ? "null" : Array.isArray(raw) ? "array" : typeof raw})`);
|
|
30
50
|
}
|
|
31
|
-
const
|
|
51
|
+
const subject = `${where}: contextSettings[${JSON.stringify(word)}]`;
|
|
52
|
+
const o = receiveMembers(raw, { subject, unit: "member", moment: "when the overlay is read" }, OVERLAY_READ_NAMES, (_, unknown) => new Error(`${subject} carries ${unknown.map((k) => JSON.stringify(String(k))).join(", ")} — this seat declares window geometry and the compaction seats only (contextTokens | autoCompactTokens | autoCompact | manualCompact); routing, pricing and fencing stay on the model card`));
|
|
32
53
|
for (const k of ["contextTokens", "autoCompactTokens"]) {
|
|
33
54
|
const n = o[k];
|
|
34
55
|
if (n !== undefined && (typeof n !== "number" || !Number.isFinite(n) || n <= 0)) {
|
|
35
|
-
throw new Error(`${
|
|
56
|
+
throw new Error(`${subject}.${k} must be a positive finite number (got ${JSON.stringify(n)}) — an unusable window is a configuration defect, not a request to fall back to the model's own`);
|
|
36
57
|
}
|
|
37
58
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
59
|
+
const seatDefect = compactionSeatsDefect(o, subject);
|
|
60
|
+
if (seatDefect !== undefined)
|
|
61
|
+
throw new Error(seatDefect.sentence);
|
|
41
62
|
out[word] = Object.freeze({
|
|
42
63
|
...(o.contextTokens !== undefined ? { contextTokens: o.contextTokens } : {}),
|
|
43
64
|
...(o.autoCompactTokens !== undefined ? { autoCompactTokens: o.autoCompactTokens } : {}),
|
|
44
|
-
...(o.
|
|
65
|
+
...(o.autoCompact !== undefined ? { autoCompact: o.autoCompact } : {}),
|
|
66
|
+
...(o.manualCompact !== undefined ? { manualCompact: o.manualCompact } : {}),
|
|
45
67
|
});
|
|
46
68
|
}
|
|
47
69
|
return Object.freeze(out);
|
|
48
70
|
}
|
|
49
|
-
export function compactionEnabled(
|
|
50
|
-
return
|
|
71
|
+
export function compactionEnabled(seat, requested, overlay) {
|
|
72
|
+
return requested?.[seat] ?? overlay?.[seat] ?? true;
|
|
51
73
|
}
|
|
52
74
|
export function physicalWindowOf(model, overlay) {
|
|
53
75
|
const card = model.contextTokens ?? model.contextWindow;
|
|
@@ -21,6 +21,17 @@ import type { AutoModeClassifierRound } from "./auto-mode.js";
|
|
|
21
21
|
import type { AskUnresolvableCause } from "./ask-unresolvable-notice.js";
|
|
22
22
|
import type { PathDenialEvidence } from "../tools/fs/safety.js";
|
|
23
23
|
import type { AskGuard } from "./tool-policy.js";
|
|
24
|
+
import type { RefusalEcho } from "./refusal-echo.js";
|
|
25
|
+
/** The engine's own account of a sentence it composed for a decision's `message`: the sentence (`text`); whether it is the
|
|
26
|
+
* engine's generic question for the call, naming no asker's reason (`generic` — a write gate's default question, the plan
|
|
27
|
+
* mode's); and the literals it quotes, in the order it quotes them (`echoed`, the refusal list's own form). The station that
|
|
28
|
+
* composed the sentence is its only writer, and freezes each listed literal itself. Read through {@link engineSentenceOf} alone,
|
|
29
|
+
* which answers only while the decision's `message` IS `text`. */
|
|
30
|
+
export interface EngineSentence {
|
|
31
|
+
readonly text: string;
|
|
32
|
+
readonly generic?: true;
|
|
33
|
+
readonly echoed?: readonly RefusalEcho[];
|
|
34
|
+
}
|
|
24
35
|
export interface EngineAttestation {
|
|
25
36
|
readonly toolCallId: string;
|
|
26
37
|
readonly toolName: string;
|
|
@@ -30,7 +41,7 @@ export interface EngineAttestation {
|
|
|
30
41
|
readonly origin?: AskOrigin;
|
|
31
42
|
/** The settled ask's class set (`ASK_CLASSES` order), when the minting station held one. */
|
|
32
43
|
readonly classes?: readonly AskClass[];
|
|
33
|
-
/** `exactBoundInputHashOf` of the arguments the settlement licenses (an approver's edit, the snapshot shown, or the asked
|
|
44
|
+
/** `exactBoundInputHashOf` of the call's tool with the arguments the settlement licenses (an approver's edit, the snapshot shown, or the asked
|
|
34
45
|
* args); absent when they have none (outside the bindable domain) — such a record licenses no bytes. */
|
|
35
46
|
readonly inputDigest?: string;
|
|
36
47
|
/** The FORM of a classifier round that did not rule (a classifier deny's cause). */
|
|
@@ -56,12 +67,13 @@ export interface EngineAttestation {
|
|
|
56
67
|
/** A seat refused the call's arguments because no approval can be bound to them: the refusal's sentence, carried by the
|
|
57
68
|
* refusal itself — the gate's deny exit reads it (the remedy it gives) instead of judging again. */
|
|
58
69
|
readonly bindingRefusal?: string;
|
|
59
|
-
/** The engine's own
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* that spread the
|
|
63
|
-
* sentence, for that sentence
|
|
64
|
-
|
|
70
|
+
/** The engine's own account of the decision's `message` ({@link EngineSentence}): the sentence a station composed, whether it
|
|
71
|
+
* is the engine's generic question (the chain's entry mint, {@link import("./ask-origin.js").chainAskReasonsOf}, writes no
|
|
72
|
+
* entry for one), and the literals it quotes. Valid only while the decision's `message` is still that sentence — a later
|
|
73
|
+
* layer that spread the decision and put its own words in `message` keeps them, and the account then reads as absent.
|
|
74
|
+
* Written only by the station that composed the sentence, for that sentence (the write gate's and the plan mode's questions;
|
|
75
|
+
* the ask resolver's refusal that quotes one of them); a composer cannot state it (an unbranded record is refused). */
|
|
76
|
+
readonly sentence?: EngineSentence;
|
|
65
77
|
/** The askers a station read off this ask where it first received it, before it narrated the sentence (an inherited station
|
|
66
78
|
* floating an ancestor's ask back into this leg's fold: its mark frames, its denial-limit fallback's sentence). The chain's
|
|
67
79
|
* entry mint takes these instead of the sentence; empty = the station read no asker. Written only by that float. */
|
|
@@ -83,6 +95,14 @@ export declare function attestationOf(d: unknown, call: {
|
|
|
83
95
|
toolCallId: string;
|
|
84
96
|
toolName: string;
|
|
85
97
|
}): EngineAttestation | undefined;
|
|
98
|
+
/** THE read of the engine's account of `d`'s sentence for `call` ({@link EngineAttestation.sentence}): present only while `d`'s
|
|
99
|
+
* `message` is that sentence, byte for byte — a layer that rewrote the message, appended to it or put its own words over it
|
|
100
|
+
* carries the record along (a spread keeps it) but no longer carries its account. `message` is read as every reader of the
|
|
101
|
+
* decision's text reads it. */
|
|
102
|
+
export declare function engineSentenceOf(d: unknown, call: {
|
|
103
|
+
toolCallId: string;
|
|
104
|
+
toolName: string;
|
|
105
|
+
}): EngineSentence | undefined;
|
|
86
106
|
/**
|
|
87
107
|
* Combine two records for `call`, member GROUP by group: the later record's group stands where it has one, the earlier's
|
|
88
108
|
* fills a group the later lacks. A record not bound to `call` contributes nothing. `answer` scope is the veto's merge: the
|
|
@@ -10,7 +10,7 @@ const ATTESTATION_GROUP_OF = {
|
|
|
10
10
|
guards: "guards",
|
|
11
11
|
pathDenial: "pathDenial",
|
|
12
12
|
bindingRefusal: "bindingRefusal",
|
|
13
|
-
|
|
13
|
+
sentence: "sentence",
|
|
14
14
|
receivedAskReasons: "receivedAskReasons",
|
|
15
15
|
};
|
|
16
16
|
const ATTESTATION_MEMBERS = Object.keys(ATTESTATION_GROUP_OF);
|
|
@@ -41,6 +41,10 @@ export function attestationOf(d, call) {
|
|
|
41
41
|
return undefined;
|
|
42
42
|
return boundTo(Object.getOwnPropertyDescriptor(d, "attestation")?.value, call);
|
|
43
43
|
}
|
|
44
|
+
export function engineSentenceOf(d, call) {
|
|
45
|
+
const sentence = attestationOf(d, call)?.sentence;
|
|
46
|
+
return sentence !== undefined && d.message === sentence.text ? sentence : undefined;
|
|
47
|
+
}
|
|
44
48
|
export function mergeAttestation(call, earlier, later, scope = "all") {
|
|
45
49
|
const a = boundTo(earlier, call);
|
|
46
50
|
const b = boundTo(later, call);
|
|
@@ -637,7 +637,8 @@ export interface EngineNotice {
|
|
|
637
637
|
* alone must not mistake a stranded follow-up for a stranded steer — same split as the settled
|
|
638
638
|
* frame's two count keys). They are NOT redelivered (a steer aimed at a finished run must not
|
|
639
639
|
* fire at the next one — unlike ENGINE notes, which pend per session); the loud half of the
|
|
640
|
-
* #257 contract's "accepted = enqueued, not consumed" sentence;
|
|
640
|
+
* #257 contract's "accepted = enqueued, not consumed" sentence; what a host that re-sends one reads back is
|
|
641
|
+
* `notice.user_input_undrained.handoff` ({@link undrainedUserInputNotices});
|
|
641
642
|
* The words a person wrote on an approval card (a durable `policy_ask` allow's `feedback`) that did not reach the
|
|
642
643
|
* model are counted in the SAME account under the steer code — one more row of that family, `detail.kind:
|
|
643
644
|
* "approval_feedback"` (absent on every other row) — when the message carrying them never committed and the row did not come back
|
|
@@ -861,6 +862,21 @@ export interface EngineNotice {
|
|
|
861
862
|
* three families AND `"memory.harvest_quarantined"` when they derive from the same harvest
|
|
862
863
|
* report — that sharing is the contract (one report, several distinct facts): dedup on
|
|
863
864
|
* `(code, detail.reportId)`; a repeat with the same pair is a replay, a new pair is a new fact.
|
|
865
|
+
* - `"memory.harvest_refused"` (#2424) — the boundary harvest was refused wholesale by an incident
|
|
866
|
+
* (the deletion fuse, a vanished write root, a control plane that could not be read or written):
|
|
867
|
+
* what the session did to memory — what it said it remembered or forgot — did not take effect.
|
|
868
|
+
* Minted by the runner at the harvest seat, one notice per refused harvest report;
|
|
869
|
+
* `detail: { kind, committed, reportId?, sessionId? }` (`kind` = `HarvestReport.incident.kind`,
|
|
870
|
+
* `committed` = the report's applied patch count, 0 unless a dual-root merge carries the other
|
|
871
|
+
* plane's). The wording is engine-owned per kind: the control-plane kind does not relay its error
|
|
872
|
+
* text (it can name any scope's rows — the host's to read, in `onError` and the report).
|
|
873
|
+
* - `"memory.harvest_conflict"` (#2424) — the harvest committed, but the store did not take some of
|
|
874
|
+
* the session's changes: a per-id CAS miss (another writer committed a newer version first — the
|
|
875
|
+
* only case worded as concurrency) or the store's own refusal of the patch; those entries keep
|
|
876
|
+
* their stored version (a conflicted deletion leaves the entry in place). One notice per harvest
|
|
877
|
+
* with at least one conflict; `detail: { count, conflicts: [{ op, id, concurrent }], reportId?,
|
|
878
|
+
* sessionId? }` (first 20 rows; `concurrent` true ⇔ the CAS arm). Shares `detail.reportId` with
|
|
879
|
+
* the harvest's other notices — dedup on `(code, detail.reportId)`.
|
|
864
880
|
* - `"memory.delegation_static_mark_waived"` (design/324, #324 ruling ①) — the deployment set
|
|
865
881
|
* {@link RunnerDeps.memoryDelegationEvidence} to `"attested-only"` and a delegation call whose
|
|
866
882
|
* STATIC tool-face verdict would have marked this session's memory polluted (attestation
|
|
@@ -1052,6 +1068,17 @@ export interface EngineNotice {
|
|
|
1052
1068
|
* is the one sentence naming the caller-side change that would have let the call run, as the tool text carries it (for arguments
|
|
1053
1069
|
* no approval can be bound to, the binding's own sentence: the remedy's approver half would not let them run). Audience `"user"`: the refused
|
|
1054
1070
|
* work is the session user's own; the operator hears it through the sink like every code.
|
|
1071
|
+
* - `"delegation.resume_lane_missing"` (#3334) — a parked agent resumed by a lane-less drive in a process holding no park of it:
|
|
1072
|
+
* its completion takes the mount's sink, settling no waiting submission elsewhere; the resume proceeds. Once per drive, at
|
|
1073
|
+
* the consume, to the process default seat. `detail: { taskId, rootSessionId? }`. Audience `"operator"`.
|
|
1074
|
+
* - `"delegation.delivery_discarded"` (#3431) — a frame (a background task's completion, a monitor event, a child's message)
|
|
1075
|
+
* addressed to an earlier occupant of a session id — the id deleted and created again, by another principal or the same
|
|
1076
|
+
* one — was discarded instead of delivered to the occupant the id holds now. Once per frame, by the Runner's per-session
|
|
1077
|
+
* notification store (`PendingSessionNotifications`), the one place the occupant comparison answers "another".
|
|
1078
|
+
* `detail: { taskId, taskType, sessionId, path, addressed, current }` — `path` = the seat the frame would have reached
|
|
1079
|
+
* under the current occupant (`"live"` its running conversation, `"box"` its durable box, `"drain"` its next run's
|
|
1080
|
+
* turn-open delivery); `addressed` / `current` = whether each side's occupant carried a token (`"known"` / `"unknown"`),
|
|
1081
|
+
* never the token. The frame's text never rides it. Audience `"operator"`.
|
|
1055
1082
|
*
|
|
1056
1083
|
* - `"memory.consolidation_recommended"` (design/339 §2.2/§6.2) — the engine-minted per-scope
|
|
1057
1084
|
* session count crossed the consolidation thresholds (time gate open ∧ enough distinct
|
|
@@ -1079,7 +1106,7 @@ export interface EngineNotice {
|
|
|
1079
1106
|
* throw rendered twice keeps one id, two refusals sharing a code/scope/message get two. Omitted
|
|
1080
1107
|
* (never fabricated) when the caller composes the line with no error in hand.
|
|
1081
1108
|
*
|
|
1082
|
-
* The
|
|
1109
|
+
* The four SERVER-minted rows ({@link NOTICE_MINTER} `"server"`) — catalogued so their audience and detail shape
|
|
1083
1110
|
* are read here like every other row; this engine never mints them. A server forwards them through the same sink.
|
|
1084
1111
|
* - `"permission.entry_mode_clamped"` — the permission mode the caller requested was clamped by the deployment's
|
|
1085
1112
|
* entry floor BEFORE the run reached this engine (the server's own clamp, through this package's
|
|
@@ -1092,9 +1119,6 @@ export interface EngineNotice {
|
|
|
1092
1119
|
* session's previous run injected (a file added, removed or renamed). Audience `"user"`; `detail: { previous,
|
|
1093
1120
|
* current, sessionId }` — `previous` / `current` are chain-member relative paths, `null` = that run had none.
|
|
1094
1121
|
* No `runId`. Once per run.
|
|
1095
|
-
* - `"session.records_skipped"` — the session's store skipped records it could not read when it opened the
|
|
1096
|
-
* session; the run continues on the history that remains. Audience `"user"`; `detail: { dropped, entriesKept,
|
|
1097
|
-
* sessionId }` — two observed counts, not to be combined. No `runId`. Once per open that skipped.
|
|
1098
1122
|
* - `"memory.layer_locked_legacy"` — a memory layer an older engine left without its owner-write bit was found at
|
|
1099
1123
|
* boot; deletes in it will fail until the operator restores the bit. Audience `"operator"`; `detail: { layers,
|
|
1100
1124
|
* remedy }` — layer directory names and the one command. No session. Once per boot.
|
|
@@ -1349,6 +1373,20 @@ export declare function parentLegIds(internals: {
|
|
|
1349
1373
|
* no `runId`: the account is per run and nothing carries the parent's. Only the DIRECT parent hears: a grandchild's
|
|
1350
1374
|
* row reaches its parent's session (the middle leg), not the root's. A parent that is no addressee — null, no or an empty session, or the leg's own session (which already
|
|
1351
1375
|
* hears the row) — gets no copy, and the call never throws on it.
|
|
1376
|
+
*
|
|
1377
|
+
* @contract notice.user_input_undrained.handoff — a row's `detail.inputIds` names exactly the unread inputs it counts (present
|
|
1378
|
+
* when the list covers the count; a row of approval words carries none): each input's `inputId` — the one its caller handed the
|
|
1379
|
+
* steer verb (or the parked-steer append, `CheckpointStore.setPendingSteer`), else the one the engine minted at acceptance. An
|
|
1380
|
+
* input parked on a checkpoint keeps its id (the entry freezes it), so a resume's `applied` frame and a resumed leg's row name the
|
|
1381
|
+
* same one. A minted id is published only on the input's `human_input` frames, which carry no text, and neither call returns it —
|
|
1382
|
+
* so it is no key a caller can tie back to its own call: a host that means to re-send sends every steer with its own `inputId`,
|
|
1383
|
+
* and the row hands its ids back. The engine keeps no state across runs and never carries an unread input to a later run itself (a durable park is the one
|
|
1384
|
+
* carrier: the resume delivers it with no row — or, when the deployment's prompt screen withholds it on redelivery, tells it by
|
|
1385
|
+
* `steering.parked_input_blocked` under the same `detail.inputId`, not by this row). A host that re-sends an input under the same
|
|
1386
|
+
* `inputId` to a later run gets that run's own answer — read (its `applied` frame, no row) or not read (a row of that run, the
|
|
1387
|
+
* same id, that run's `runId`) — so the leg's own rows naming one `inputId` count the runs that ended with it unread (a parent's
|
|
1388
|
+
* copy, the row carrying `childSessionId`, repeats its child's row and is not another time). The row's sentence states the
|
|
1389
|
+
* engine's part only ("NOT redelivered" by the engine); whether to re-send, and what the person is shown, is the host's.
|
|
1352
1390
|
*/
|
|
1353
1391
|
export declare function undrainedUserInputNotices(counts: {
|
|
1354
1392
|
steer: number;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one reading of who an extension-started agent row says started it. The row carries `requestedBy?: ExtensionRequester`
|
|
3
|
+
* (`{ kind: "extension", name }`): written once, by the registration that creates the row, from the extension's own `$.agent.spawn`
|
|
4
|
+
* call; absent on every other row — the model's own spawn, the host's, and every row an earlier release wrote. Rows come back from a
|
|
5
|
+
* store the engine did not just write, so every reader takes the member through this function: a value that is not exactly an
|
|
6
|
+
* extension's requester (another `kind`, a blank or non-string name) is no requester — never a half-read one.
|
|
7
|
+
*/
|
|
8
|
+
import type { ExtensionRequester } from "./task-event.js";
|
|
9
|
+
export declare function readExtensionRequester(raw: unknown): ExtensionRequester | undefined;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export function readExtensionRequester(raw) {
|
|
2
|
+
if (typeof raw !== "object" || raw === null || Array.isArray(raw))
|
|
3
|
+
return undefined;
|
|
4
|
+
const kind = raw.kind;
|
|
5
|
+
const name = raw.name;
|
|
6
|
+
return kind === "extension" && typeof name === "string" && name.trim() !== "" ? Object.freeze({ kind: "extension", name }) : undefined;
|
|
7
|
+
}
|