@sema-agent/core 7.61.0 → 7.63.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 +840 -0
- package/dist/agents/cascade.d.ts +11 -3
- package/dist/agents/cascade.js +1 -1
- package/dist/agents/peer-held-queue.d.ts +27 -4
- package/dist/agents/peer-held-queue.js +81 -36
- package/dist/agents/peer-session-drain.js +13 -3
- package/dist/agents/subagent-transcript-placement.d.ts +23 -0
- package/dist/agents/subagent-transcript-placement.js +14 -0
- package/dist/agents/subagent.d.ts +6 -1
- package/dist/agents/subagent.js +143 -58
- package/dist/agents/suspend-guard.d.ts +38 -16
- package/dist/agents/suspend-guard.js +9 -4
- package/dist/agents/verify.js +4 -3
- package/dist/brain/route-adjudicator.js +9 -4
- package/dist/core/approval-object.js +1 -1
- package/dist/core/arg-summary.js +1 -1
- package/dist/core/ask-question.d.ts +2 -2
- package/dist/core/canonical-json.d.ts +23 -13
- package/dist/core/canonical-json.js +4 -4
- package/dist/core/checkpoint-features.d.ts +722 -0
- package/dist/core/checkpoint-features.js +98 -0
- package/dist/core/checkpoint-queries.d.ts +47 -4
- package/dist/core/checkpoint-queries.js +36 -16
- package/dist/core/checkpoint-requirements.d.ts +12 -5
- package/dist/core/checkpoint-requirements.js +11 -5
- package/dist/core/checkpoint-row-verdict.d.ts +110 -0
- package/dist/core/checkpoint-row-verdict.js +245 -0
- package/dist/core/checkpoint-store.d.ts +76 -753
- package/dist/core/checkpoint-store.js +83 -144
- package/dist/core/compliance.d.ts +6 -2
- package/dist/core/compliance.js +3 -3
- package/dist/core/engine-attestation.d.ts +1 -1
- package/dist/core/engine-notice.d.ts +38 -7
- package/dist/core/engine-notice.js +9 -2
- package/dist/core/gate-fold.js +2 -2
- 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 +16 -3
- package/dist/core/hooks.d.ts +13 -0
- package/dist/core/human-input-projection.d.ts +1 -0
- package/dist/core/human-input-projection.js +3 -0
- package/dist/core/image-admission.d.ts +1 -1
- package/dist/core/locked-config.d.ts +2 -2
- package/dist/core/mcp-host-seat.js +6 -1
- package/dist/core/memory-engine/consolidation-driver.d.ts +33 -18
- package/dist/core/memory-engine/consolidation-driver.js +99 -98
- package/dist/core/memory-engine/consolidation.d.ts +73 -10
- package/dist/core/memory-engine/consolidation.js +167 -11
- 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 +37 -35
- package/dist/core/memory-engine/delegation-settlement.js +53 -59
- package/dist/core/memory-engine/dual-root.d.ts +12 -6
- package/dist/core/memory-engine/dual-root.js +9 -5
- package/dist/core/memory-engine/engine.d.ts +98 -35
- package/dist/core/memory-engine/engine.js +477 -380
- 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 +29 -3
- package/dist/core/memory-engine/file-backend.js +66 -35
- package/dist/core/memory-engine/index.d.ts +7 -7
- package/dist/core/memory-engine/index.js +6 -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 +121 -45
- package/dist/core/memory-engine/layout.js +252 -102
- package/dist/core/memory-engine/memory-backend-contract.d.ts +19 -1
- package/dist/core/memory-engine/memory-backend-contract.js +320 -0
- package/dist/core/memory-engine/memory-deployment.d.ts +31 -8
- package/dist/core/memory-engine/memory-deployment.js +26 -12
- 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 +3 -1
- package/dist/core/memory-engine/session-write-home.js +1 -1
- 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 +118 -19
- package/dist/core/memory-engine/types.js +1 -0
- package/dist/core/memory-vector.d.ts +1 -1
- package/dist/core/memory.d.ts +10 -10
- package/dist/core/memory.js +15 -6
- package/dist/core/mode-policy.js +1 -1
- package/dist/core/mods/classic-events.d.ts +9 -1
- package/dist/core/mods/dollar.d.ts +32 -1
- package/dist/core/mods/dollar.js +13 -1
- package/dist/core/mods/kernel/events.d.ts +11 -3
- package/dist/core/mods/kernel/events.js +13 -10
- package/dist/core/mods/lifecycle-stations.d.ts +36 -4
- package/dist/core/mods/lifecycle-stations.js +44 -9
- package/dist/core/mods/session-append.d.ts +4 -1
- package/dist/core/mods/session-append.js +7 -0
- package/dist/core/mods/session-receive.js +12 -15
- package/dist/core/mods/stations.d.ts +70 -6
- package/dist/core/mods/stations.js +144 -1
- package/dist/core/own-property-receipt.d.ts +7 -0
- package/dist/core/own-property-receipt.js +3 -0
- 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/permission-rule-consent.d.ts +10 -3
- package/dist/core/permission-rule-consent.js +37 -24
- package/dist/core/permission-rule-store.d.ts +35 -1
- package/dist/core/permission-rule-store.js +27 -8
- package/dist/core/read-only-shell.js +3 -2
- package/dist/core/read-root-candidate.js +1 -1
- package/dist/core/redaction-marks.d.ts +8 -0
- package/dist/core/redaction-marks.js +6 -0
- package/dist/core/remote-env.d.ts +12 -1
- package/dist/core/remote-env.js +3 -0
- package/dist/core/resume-startup-cause.d.ts +5 -4
- package/dist/core/runner/child-tree.d.ts +29 -3
- package/dist/core/runner/child-tree.js +39 -16
- package/dist/core/runner/compact-session.js +5 -2
- package/dist/core/runner/contracts.d.ts +36 -17
- package/dist/core/runner/delegation-owner.d.ts +43 -0
- package/dist/core/runner/delegation-owner.js +59 -0
- package/dist/core/runner/gate-exit.js +2 -2
- package/dist/core/runner/inherited-ask-grants.js +1 -1
- package/dist/core/runner/lineage-reroot-view.d.ts +56 -0
- package/dist/core/runner/lineage-reroot-view.js +108 -0
- package/dist/core/runner/memory-consolidation-driver.d.ts +6 -3
- package/dist/core/runner/memory-consolidation-driver.js +4 -4
- 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/permission-rule-lanes.d.ts +2 -1
- package/dist/core/runner/permission-rule-lanes.js +2 -2
- package/dist/core/runner/person-path-rows.d.ts +23 -3
- package/dist/core/runner/person-path-rows.js +31 -4
- package/dist/core/runner/placement-fence.d.ts +12 -0
- package/dist/core/runner/placement-fence.js +20 -6
- package/dist/core/runner/prepare-acquire-reconcile.d.ts +4 -1
- package/dist/core/runner/prepare-acquire-reconcile.js +7 -2
- package/dist/core/runner/prepare-ask-lane.js +2 -2
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +5 -1
- package/dist/core/runner/prepare-caps-and-workflow.js +6 -3
- package/dist/core/runner/prepare-config-doors.d.ts +6 -6
- package/dist/core/runner/prepare-config-doors.js +3 -4
- package/dist/core/runner/prepare-execution-env.js +17 -6
- package/dist/core/runner/prepare-hands-readface.d.ts +3 -2
- package/dist/core/runner/prepare-hands-readface.js +32 -10
- package/dist/core/runner/prepare-inherited-gate.d.ts +12 -8
- package/dist/core/runner/prepare-inherited-gate.js +14 -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 +3 -2
- package/dist/core/runner/prepare-memory.js +28 -20
- package/dist/core/runner/prepare-park-ask.js +4 -3
- package/dist/core/runner/prepare-task.js +22 -16
- package/dist/core/runner/prepare-workspace-restore.js +3 -6
- package/dist/core/runner/resume-admission.d.ts +3 -3
- package/dist/core/runner/resume-admission.js +6 -3
- package/dist/core/runner/resume-apply.d.ts +4 -0
- package/dist/core/runner/resume-apply.js +11 -4
- package/dist/core/runner/resume-checkpoint-screen.d.ts +9 -0
- package/dist/core/runner/resume-checkpoint-screen.js +4 -84
- package/dist/core/runner/run-git-lane.d.ts +2 -0
- package/dist/core/runner/run-git-lane.js +4 -1
- package/dist/core/runner/run-harness-handlers.d.ts +2 -0
- package/dist/core/runner/run-harness-handlers.js +3 -2
- package/dist/core/runner/run-leg.js +25 -8
- package/dist/core/runner/run-settle-and-teardown.js +6 -4
- package/dist/core/runner/run-stop-and-final-verify.js +2 -1
- package/dist/core/runner/run-turn-boundary.js +7 -4
- package/dist/core/runner/runtask.js +6 -6
- package/dist/core/runner/steering-preview.d.ts +9 -0
- package/dist/core/runner/steering-preview.js +5 -0
- package/dist/core/runner/stream-steer-verb.js +8 -0
- package/dist/core/runner/terminal-account.js +1 -1
- package/dist/core/runner/tool-face-overlay.js +2 -0
- package/dist/core/runner/turn-attachments.d.ts +5 -0
- package/dist/core/runner/turn-attachments.js +1 -1
- package/dist/core/runner-deps.d.ts +8 -4
- package/dist/core/secret-env.d.ts +9 -6
- package/dist/core/secret-env.js +41 -22
- package/dist/core/session-checkout.d.ts +108 -0
- package/dist/core/session-checkout.js +485 -0
- package/dist/core/session-store.d.ts +13 -5
- package/dist/core/session-store.js +28 -4
- package/dist/core/session.d.ts +29 -5
- package/dist/core/session.js +3 -0
- package/dist/core/store-contracts/checkpoint-store-contract.d.ts +6 -12
- package/dist/core/store-contracts/checkpoint-store-contract.js +73 -6
- package/dist/core/store-contracts/session-store-contract.js +61 -8
- package/dist/core/task-event.d.ts +28 -1
- package/dist/core/task-notification.d.ts +9 -1
- package/dist/core/task-notification.js +8 -1
- package/dist/core/task-registry-agent.d.ts +40 -8
- package/dist/core/task-registry-agent.js +57 -24
- package/dist/core/task-registry-shared.d.ts +33 -11
- package/dist/core/task-registry-workflow.js +4 -3
- package/dist/core/task-registry.d.ts +27 -10
- package/dist/core/task-registry.js +19 -13
- package/dist/core/task-result.d.ts +5 -5
- package/dist/core/task-spec-members.js +1 -1
- package/dist/core/task-spec.d.ts +21 -1
- package/dist/core/terminal-cause.d.ts +6 -6
- package/dist/core/tool-face.d.ts +6 -2
- package/dist/core/tool-face.js +1 -1
- package/dist/core/tool-policy.d.ts +16 -13
- package/dist/core/tool-policy.js +11 -10
- package/dist/core/tool-roster.d.ts +4 -4
- package/dist/core/tool-spec.d.ts +42 -19
- package/dist/core/types.d.ts +2 -2
- package/dist/core/types.js +1 -1
- package/dist/core/untrusted-egress.d.ts +15 -4
- package/dist/core/untrusted-egress.js +23 -22
- package/dist/core/workspace-snapshot.d.ts +3 -1
- package/dist/core/workspace-snapshot.js +1 -0
- package/dist/engine/execution-env/node-execution-env.d.ts +3 -0
- package/dist/engine/execution-env/node-execution-env.js +12 -5
- package/dist/engine/harness/types.d.ts +77 -1
- package/dist/engine/harness/types.js +108 -0
- package/dist/engine/session/import-validate.js +6 -1
- package/dist/engine/session/parent-chain-guard.d.ts +3 -3
- package/dist/engine/session/parent-chain-guard.js +1 -1
- package/dist/engine/session/path-to-root.d.ts +18 -3
- package/dist/engine/session/path-to-root.js +15 -1
- package/dist/engine/session/repo-utils.d.ts +12 -1
- package/dist/engine/session/repo-utils.js +41 -0
- package/dist/engine/session/session.d.ts +24 -1
- package/dist/engine/session/session.js +46 -2
- package/dist/engine/session/storage-base.d.ts +20 -0
- package/dist/engine/session/storage-base.js +28 -9
- package/dist/index.d.ts +16 -12
- package/dist/index.js +11 -8
- package/dist/internal/harness-types.d.ts +1 -1
- package/dist/internal/harness.d.ts +4 -3
- package/dist/internal/harness.js +3 -2
- package/dist/orchestration/run-workflow-tool.d.ts +7 -1
- package/dist/orchestration/run-workflow-tool.js +28 -11
- package/dist/orchestration/workflow-governance.d.ts +1 -1
- package/dist/orchestration/workflow.d.ts +6 -0
- package/dist/orchestration/workflow.js +5 -8
- package/dist/stores/file/checkpoint-store.d.ts +2 -0
- package/dist/stores/file/checkpoint-store.js +7 -6
- package/dist/stores/file/fs-atomic.d.ts +0 -22
- package/dist/stores/file/fs-atomic.js +0 -17
- package/dist/stores/file/index.d.ts +2 -9
- package/dist/stores/file/index.js +2 -4
- package/dist/stores/file/session-store.d.ts +13 -7
- package/dist/stores/file/session-store.js +42 -18
- package/dist/tools/fs/bash-program-position.d.ts +3 -2
- package/dist/tools/fs/bash-program-position.js +10 -10
- 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 +13 -1
- package/dist/tools/fs/read-deny.js +10 -2
- package/dist/tools/fs/removal-targets.js +5 -5
- 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 +11 -2
- package/dist/tools/fs/shell-read-argv.js +45 -29
- package/dist/tools/fs/shell-read-bindings.d.ts +20 -2
- package/dist/tools/fs/shell-read-bindings.js +153 -69
- 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.js +29 -11
- package/dist/tools/fs/shell-read-establish.js +43 -22
- package/dist/tools/fs/shell-read-functions.js +2 -2
- 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-object-path.d.ts +59 -0
- package/dist/tools/fs/shell-read-object-path.js +119 -0
- package/dist/tools/fs/shell-read-plan.d.ts +18 -0
- package/dist/tools/fs/shell-read-plan.js +217 -104
- package/dist/tools/fs/shell-read-start.d.ts +76 -13
- package/dist/tools/fs/shell-read-start.js +97 -17
- 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 +54 -14
- package/dist/tools/fs/shell-read-workdir.js +103 -19
- 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 +93 -43
- package/wire-changes/core-stores-sql@7.62.0.json +30 -0
- package/wire-changes/core-stores-sql@7.63.0.json +30 -0
- package/wire-changes/core@7.62.0.json +2181 -0
- package/wire-changes/core@7.63.0.json +3523 -0
- package/wire-changes/mods-kernel@7.62.0.json +42 -0
- package/wire-changes/mods-kernel@7.63.0.json +30 -0
- package/wire-changes/primitives@7.62.0.json +30 -0
- package/wire-changes/primitives@7.63.0.json +445 -0
- package/dist/core/consolidate-scope.d.ts +0 -93
- package/dist/core/consolidate-scope.js +0 -98
- 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
- package/dist/core/runner/memory-consolidation.d.ts +0 -109
- package/dist/core/runner/memory-consolidation.js +0 -251
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
import { randomBytes, randomUUID } from "node:crypto";
|
|
2
2
|
import { uuidv7 } from "../internal/harness.js";
|
|
3
|
-
import {
|
|
3
|
+
import { PROBE_REASON_MAX, inlineUntrusted, sanitizeUntrustedText } from "./untrusted-text.js";
|
|
4
|
+
import { CheckpointError, checkpointVersionOf, isPlainRecord, normalizeProbeCause, safeDataValue } from "./checkpoint-features.js";
|
|
5
|
+
import { boundedThrownName, judgeCheckpointRow, retiredSteerSeatRefusal, UNREADABLE_ROW_VERDICT } from "./checkpoint-row-verdict.js";
|
|
4
6
|
import { carriesBidiControls } from "./tool-policy.js";
|
|
5
7
|
import { agentIdOf, legTaskIdOf } from "./leg-identity.js";
|
|
6
8
|
import { isAutoModeFallbackCause, readDenialLimitFallback } from "./auto-mode.js";
|
|
7
|
-
import { isAskOrigin,
|
|
9
|
+
import { isAskOrigin, isPersistedRuleMandate } from "./ask-origin.js";
|
|
8
10
|
import { isRunOrigin, RUN_ORIGINS } from "./run-origin.js";
|
|
9
11
|
import { describeRejectedValue } from "./tool-search-setting.js";
|
|
10
12
|
import { readBoundBinding } from "./skill-grant-binding.js";
|
|
11
13
|
import { checkpointExecutionRecorded, executionRecordDisposition, ExecutionOutcomeConflictError, } from "./checkpoint-execution-record.js";
|
|
12
14
|
import { checkpointHolderMatches, checkpointOccMatches, checkpointRevOf } from "./checkpoint-generation.js";
|
|
13
|
-
import { parkedApprovalCardOf } from "./pause-registry.js";
|
|
14
|
-
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";
|
|
15
17
|
import { renderUntrustedCommandText, stripFormatCharacters } from "./permission-rule-model.js";
|
|
16
18
|
import { egressText } from "./untrusted-egress.js";
|
|
17
19
|
import { steerReplayRefusal } from "./steer-replay.js";
|
|
18
20
|
import { readRetentionDeclaration } from "./retention.js";
|
|
19
|
-
import { optionKeys, receiveOptions } from "./own-property-receipt.js";
|
|
21
|
+
import { memberPresent, optionKeys, receiveOptions } from "./own-property-receipt.js";
|
|
22
|
+
export { BINDING_CHECKPOINT_VERSION, CHECKPOINT_CONFIG_REFUSAL_CODES, CHECKPOINT_FEATURES, CheckpointError, checkpointVersionOf, CURRENT_CHECKPOINT_VERSION, encodeAtFidelity, F012_CHECKPOINT_VERSION, FACE_CHECKPOINT_VERSION, isCheckpointConfigRefusalCode, isPlainRecord, MAX_SUPPORTED_CHECKPOINT_VERSION, normalizeProbeCause, ORG_ADMISSION_CHECKPOINT_VERSION, REAL_APPROVAL_CHECKPOINT_VERSION, RESOURCE_CHECKPOINT_VERSION, safeDataValue, TOKEN_CHECKPOINT_VERSION, } from "./checkpoint-features.js";
|
|
20
23
|
export function mintCheckpointToken() {
|
|
21
24
|
return randomBytes(16).toString("hex");
|
|
22
25
|
}
|
|
@@ -24,37 +27,6 @@ export function mintCheckpointId() {
|
|
|
24
27
|
return `cp_${randomUUID()}`;
|
|
25
28
|
}
|
|
26
29
|
export { PROBE_REASON_MAX } from "./untrusted-text.js";
|
|
27
|
-
const PROBE_CAUSE_MAX_SHOWN = 8;
|
|
28
|
-
export function normalizeProbeCause(value) {
|
|
29
|
-
if (!isPlainRecord(value))
|
|
30
|
-
return undefined;
|
|
31
|
-
const code = safeDataValue(value, "code");
|
|
32
|
-
if (typeof code !== "string" || code.trim().length === 0)
|
|
33
|
-
return undefined;
|
|
34
|
-
const family = (raw) => {
|
|
35
|
-
if (!isPlainRecord(raw))
|
|
36
|
-
return undefined;
|
|
37
|
-
const shownRaw = safeDataValue(raw, "shown");
|
|
38
|
-
if (!Array.isArray(shownRaw))
|
|
39
|
-
return undefined;
|
|
40
|
-
const shown = shownRaw
|
|
41
|
-
.filter((p) => typeof p === "string")
|
|
42
|
-
.slice(0, PROBE_CAUSE_MAX_SHOWN)
|
|
43
|
-
.map((p) => inlineUntrusted(p, PROBE_CAUSE_PATH_MAX));
|
|
44
|
-
const totalRaw = safeDataValue(raw, "total");
|
|
45
|
-
const total = typeof totalRaw === "number" && Number.isFinite(totalRaw) ? Math.max(0, Math.floor(totalRaw)) : shown.length;
|
|
46
|
-
return { shown, total: Math.max(total, shown.length) };
|
|
47
|
-
};
|
|
48
|
-
const roots = family(safeDataValue(value, "roots"));
|
|
49
|
-
if (roots === undefined)
|
|
50
|
-
return undefined;
|
|
51
|
-
const further = family(safeDataValue(value, "further"));
|
|
52
|
-
return {
|
|
53
|
-
code: inlineUntrusted(code, PROBE_REASON_MAX),
|
|
54
|
-
roots,
|
|
55
|
-
...(further !== undefined && further.total > 0 ? { further } : {}),
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
30
|
export function riskSeverity(axes) {
|
|
59
31
|
return readRiskAxes(axes).tier;
|
|
60
32
|
}
|
|
@@ -84,26 +56,6 @@ export const MAX_PENDING_STEER_CHARS = 16_000;
|
|
|
84
56
|
export const PENDING_STEER_QUEUE_BYTE_BUDGET_BYTES = 48_000;
|
|
85
57
|
export const MAX_PENDING_STEER_ENTRIES = Math.floor(PENDING_STEER_QUEUE_BYTE_BUDGET_BYTES / MAX_PENDING_STEER_CHARS);
|
|
86
58
|
export const PENDING_STEER_FROZEN_FIELDS = Object.freeze(["text", "trusted", "actor", "seq", "inputId", "priority", "runOrigin"]);
|
|
87
|
-
export function isPlainRecord(x) {
|
|
88
|
-
try {
|
|
89
|
-
if (x === null || typeof x !== "object" || Array.isArray(x))
|
|
90
|
-
return false;
|
|
91
|
-
const p = Object.getPrototypeOf(x);
|
|
92
|
-
return p === Object.prototype || p === null;
|
|
93
|
-
}
|
|
94
|
-
catch {
|
|
95
|
-
return false;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
export function safeDataValue(obj, key) {
|
|
99
|
-
try {
|
|
100
|
-
const d = Object.getOwnPropertyDescriptor(obj, key);
|
|
101
|
-
return d && "value" in d ? d.value : undefined;
|
|
102
|
-
}
|
|
103
|
-
catch {
|
|
104
|
-
return undefined;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
59
|
function safeKeys(obj) {
|
|
108
60
|
try {
|
|
109
61
|
return Object.keys(obj);
|
|
@@ -197,29 +149,6 @@ export function realApprovalOrgFact(bit) {
|
|
|
197
149
|
return bit.org;
|
|
198
150
|
return bit.origin === "org_rule" ? "rule" : bit.origin === "org_unavailable" ? "unavailable" : undefined;
|
|
199
151
|
}
|
|
200
|
-
export const CHECKPOINT_FEATURES = {
|
|
201
|
-
baseline: { version: 1, introduced: "design/49", writes: "the row itself" },
|
|
202
|
-
resource: { version: 2, introduced: "design/74", writes: "resourceLedger; gate/pendingAction kind resource_limit" },
|
|
203
|
-
binding: { version: 3, introduced: "design/80", writes: "pendingAction.boundCallId + boundInputHash on a tool_approval; a plan_review carries the stamp only" },
|
|
204
|
-
token: { version: 5, introduced: "design/164", writes: "resourceLedger.totalTokens" },
|
|
205
|
-
orgAdmission: { version: 6, introduced: "org-admission", writes: "inheritedGate.admittedOrgScopes / ownAdmittedOrgScopes / ownAdmittedOrgWriteScope / orgAdmissionGoverned" },
|
|
206
|
-
f012: { version: 7, introduced: "F-012", writes: "inheritedGate.constraintChain + constraintDigest together; delegationProvenance" },
|
|
207
|
-
realApproval: { version: 8, introduced: "#130/#120", writes: "gate.realApproval (a well-formed bit) + pendingAction.requiresRealApproval; from v9: readFace.realApproval = true beside it" },
|
|
208
|
-
face: { version: 9, introduced: "design/199", writes: "state.readFace { face, denyEntries? } for a non-default posture; realApproval: true only at the mint whose gate carries the bit (a hands-less re-park never carries the seed's marker forward)" },
|
|
209
|
-
requirements: { version: 10, introduced: "#1320", writes: "requires (the row's words) + requirementsDigest (the row digest), both derived from its content (checkpoint-requirements.ts)" },
|
|
210
|
-
};
|
|
211
|
-
export const CURRENT_CHECKPOINT_VERSION = CHECKPOINT_FEATURES.baseline.version;
|
|
212
|
-
export const RESOURCE_CHECKPOINT_VERSION = CHECKPOINT_FEATURES.resource.version;
|
|
213
|
-
export const BINDING_CHECKPOINT_VERSION = CHECKPOINT_FEATURES.binding.version;
|
|
214
|
-
export const TOKEN_CHECKPOINT_VERSION = CHECKPOINT_FEATURES.token.version;
|
|
215
|
-
export const ORG_ADMISSION_CHECKPOINT_VERSION = CHECKPOINT_FEATURES.orgAdmission.version;
|
|
216
|
-
export const F012_CHECKPOINT_VERSION = CHECKPOINT_FEATURES.f012.version;
|
|
217
|
-
export const REAL_APPROVAL_CHECKPOINT_VERSION = CHECKPOINT_FEATURES.realApproval.version;
|
|
218
|
-
export const FACE_CHECKPOINT_VERSION = CHECKPOINT_FEATURES.face.version;
|
|
219
|
-
export const MAX_SUPPORTED_CHECKPOINT_VERSION = CHECKPOINT_FEATURES.requirements.version;
|
|
220
|
-
export function checkpointVersionOf(cp) {
|
|
221
|
-
return cp.version ?? 0;
|
|
222
|
-
}
|
|
223
152
|
function finiteBound(v) {
|
|
224
153
|
return v !== undefined && Number.isFinite(v) ? v : undefined;
|
|
225
154
|
}
|
|
@@ -282,13 +211,56 @@ export function planReviewRequesterOf(pendingAction) {
|
|
|
282
211
|
const id = pendingAction.requestedByCallId;
|
|
283
212
|
return typeof id === "string" && id !== "" ? id : undefined;
|
|
284
213
|
}
|
|
285
|
-
export function summarizeCheckpoint(cp, disclose) {
|
|
214
|
+
export function summarizeCheckpoint(cp, disclose, verdict) {
|
|
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) {
|
|
286
257
|
const facts = checkpointIndexFacts(cp);
|
|
258
|
+
const rowName = `checkpoint ${JSON.stringify(cp.checkpointId ?? null)} of session ${JSON.stringify(cp.sessionId)}`;
|
|
287
259
|
const descriptor = facts.riskDescriptor;
|
|
288
260
|
const axes = descriptor === null ? undefined : readRiskAxes(descriptor?.axes);
|
|
289
261
|
const severity = axes?.tier;
|
|
290
262
|
if (axes?.problem !== undefined) {
|
|
291
|
-
disclose?.(
|
|
263
|
+
disclose?.(`${rowName}: the risk descriptor's axes are ${axes.problem} — ${severity === undefined ? "the summary carries no severity" : `the summary's severity ${severity} is read from the valid marks`}`);
|
|
292
264
|
}
|
|
293
265
|
const cardReading = parkedApprovalCardOf(cp.gate);
|
|
294
266
|
const tool = cp.pendingAction.kind === "tool_approval" ? cp.pendingAction : undefined;
|
|
@@ -305,19 +277,32 @@ export function summarizeCheckpoint(cp, disclose) {
|
|
|
305
277
|
toolInput = undefined;
|
|
306
278
|
}
|
|
307
279
|
}
|
|
280
|
+
const shownPreview = tool?.preview;
|
|
308
281
|
const hasBidi = tool !== undefined &&
|
|
309
282
|
(facts.hasBidiControls === true ||
|
|
310
|
-
carriesBidiControls([toolInput,
|
|
283
|
+
carriesBidiControls([toolInput, shownPreview], { maxNodes: BIDI_BACKFILL_MAX_NODES, maxChars: BIDI_BACKFILL_MAX_CHARS }));
|
|
311
284
|
const agentId = agentIdOf({ taskId: legTaskIdOf({}, cp.state, cp.sessionId), isDelegatedChild: cp.state.isDelegatedChild === true });
|
|
285
|
+
const preview = (() => {
|
|
286
|
+
if (shownPreview === undefined)
|
|
287
|
+
return {};
|
|
288
|
+
try {
|
|
289
|
+
return { copy: structuredClone(shownPreview) };
|
|
290
|
+
}
|
|
291
|
+
catch {
|
|
292
|
+
disclose?.(`${rowName}: its approval preview is not a value a summary can copy — the summary carries no preview`);
|
|
293
|
+
return {};
|
|
294
|
+
}
|
|
295
|
+
})();
|
|
312
296
|
return {
|
|
313
297
|
token: facts.token,
|
|
298
|
+
rowVerdict,
|
|
314
299
|
...(cp.checkpointId !== undefined ? { checkpointId: cp.checkpointId } : {}),
|
|
315
300
|
sessionId: facts.sessionId,
|
|
316
301
|
scope: facts.scope,
|
|
317
302
|
gateKind: facts.gateKind,
|
|
318
303
|
...(severity !== undefined ? { severity } : {}),
|
|
319
304
|
...(cp.resourceLedger !== undefined ? { spentMicroUsd: cp.resourceLedger.spentMicroUsd } : {}),
|
|
320
|
-
...(facts.deadline
|
|
305
|
+
...(isFiniteMember(facts.deadline) ? { deadline: facts.deadline } : {}),
|
|
321
306
|
createdAt: facts.createdAt,
|
|
322
307
|
...(cp.sourceSessionId !== undefined ? { sourceSessionId: cp.sourceSessionId } : {}),
|
|
323
308
|
...(agentId !== undefined ? { agentId } : {}),
|
|
@@ -331,7 +316,7 @@ export function summarizeCheckpoint(cp, disclose) {
|
|
|
331
316
|
? { restoreMode: cp.state.workspaceHandle.restoreMode === "park_only" ? "park_only" : "snapshot" }
|
|
332
317
|
: {}),
|
|
333
318
|
...((runOrigin) => (isRunOrigin(runOrigin) ? { runOrigin } : {}))(cp.state.runOrigin),
|
|
334
|
-
...(
|
|
319
|
+
...("copy" in preview ? { preview: preview.copy } : {}),
|
|
335
320
|
...(tool?.previewWithheld === "oversize" || tool?.previewWithheld === "unavailable" ? { previewWithheld: tool.previewWithheld } : {}),
|
|
336
321
|
...(tool?.requiresRealApproval === true ? { requiresRealApproval: true } : {}),
|
|
337
322
|
...(tool?.mandated === true ? { mandated: true } : {}),
|
|
@@ -350,17 +335,13 @@ export function summarizeCheckpoint(cp, disclose) {
|
|
|
350
335
|
...(hasBidi ? { hasBidiControls: true } : {}),
|
|
351
336
|
};
|
|
352
337
|
}
|
|
353
|
-
export
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
constructor(code, message, detail) {
|
|
359
|
-
super(message);
|
|
360
|
-
this.code = code;
|
|
361
|
-
this.detail = detail;
|
|
362
|
-
this.name = "CheckpointError";
|
|
338
|
+
export function summarizeStoredCheckpoint(cp, memo, disclose) {
|
|
339
|
+
let verdict = memo.get(cp);
|
|
340
|
+
if (verdict === undefined) {
|
|
341
|
+
verdict = judgeCheckpointRow(cp);
|
|
342
|
+
memo.set(cp, verdict);
|
|
363
343
|
}
|
|
344
|
+
return summarizeCheckpoint(cp, disclose, verdict);
|
|
364
345
|
}
|
|
365
346
|
export function resolveDeclaredFidelity(store, storeName) {
|
|
366
347
|
const declared = store?.fidelity;
|
|
@@ -373,17 +354,6 @@ export function resolveDeclaredFidelity(store, storeName) {
|
|
|
373
354
|
e.code = "config.store_fidelity_invalid";
|
|
374
355
|
throw e;
|
|
375
356
|
}
|
|
376
|
-
export function encodeAtFidelity(fidelity, value) {
|
|
377
|
-
if (fidelity === "structured-clone")
|
|
378
|
-
return { ok: true, value };
|
|
379
|
-
try {
|
|
380
|
-
const encoded = JSON.stringify(value);
|
|
381
|
-
return { ok: true, value: encoded === undefined ? undefined : JSON.parse(encoded) };
|
|
382
|
-
}
|
|
383
|
-
catch (err) {
|
|
384
|
-
return { ok: false, cause: err };
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
357
|
export function resolveCheckpointStore(spec, deps) {
|
|
388
358
|
if (Object.is(spec.checkpointStore, null))
|
|
389
359
|
throw retiredCheckpointStoreNull();
|
|
@@ -542,9 +512,9 @@ function captureActorAssertion(actor) {
|
|
|
542
512
|
return { id, hostAsserted, ...(issuer !== undefined ? { issuer } : {}) };
|
|
543
513
|
}
|
|
544
514
|
export function readPendingSteerQueue(state) {
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
515
|
+
const retired = retiredSteerSeatRefusal(state);
|
|
516
|
+
if (retired !== undefined)
|
|
517
|
+
throw retired;
|
|
548
518
|
return [...(state.pendingSteerQueue ?? [])].sort((a, b) => a.seq - b.seq);
|
|
549
519
|
}
|
|
550
520
|
export function judgeParkedSteerRepeat(queue, entry) {
|
|
@@ -584,6 +554,7 @@ export class InMemoryCheckpointStore {
|
|
|
584
554
|
fidelity = "structured-clone";
|
|
585
555
|
execution = { outcome: true };
|
|
586
556
|
cps = new Map();
|
|
557
|
+
rowVerdicts = new WeakMap();
|
|
587
558
|
fault = null;
|
|
588
559
|
disclose;
|
|
589
560
|
holderIsCurrent;
|
|
@@ -617,7 +588,7 @@ export class InMemoryCheckpointStore {
|
|
|
617
588
|
current: {
|
|
618
589
|
status: cp.status,
|
|
619
590
|
rev: checkpointRevOf(cp),
|
|
620
|
-
...(cp
|
|
591
|
+
...(memberPresent(cp, "resolvedOutcome") ? { resolvedOutcome: structuredClone(cp.resolvedOutcome) } : {}),
|
|
621
592
|
},
|
|
622
593
|
};
|
|
623
594
|
}
|
|
@@ -638,7 +609,7 @@ export class InMemoryCheckpointStore {
|
|
|
638
609
|
cp.rev = checkpointRevOf(cp) + 1;
|
|
639
610
|
if (winnerClone)
|
|
640
611
|
cp.resolvedOutcome = winnerClone;
|
|
641
|
-
cp.reopenReason
|
|
612
|
+
delete cp.reopenReason;
|
|
642
613
|
return { claimed: true };
|
|
643
614
|
}
|
|
644
615
|
claimExpireCore(token, scope) {
|
|
@@ -729,7 +700,7 @@ export class InMemoryCheckpointStore {
|
|
|
729
700
|
const out = [];
|
|
730
701
|
for (const cp of this.cps.values()) {
|
|
731
702
|
if (cp.scope === scope && cp.status === "pending")
|
|
732
|
-
out.push(
|
|
703
|
+
out.push(summarizeStoredCheckpoint(cp, this.rowVerdicts, this.disclose));
|
|
733
704
|
}
|
|
734
705
|
return out;
|
|
735
706
|
}
|
|
@@ -741,7 +712,7 @@ export class InMemoryCheckpointStore {
|
|
|
741
712
|
return [...out];
|
|
742
713
|
}
|
|
743
714
|
async listOverdue(query) {
|
|
744
|
-
return selectOverduePage(this.cps.entries(), readCheckpointOverdueQuery(query), (cp) =>
|
|
715
|
+
return selectOverduePage(this.cps.entries(), readCheckpointOverdueQuery(query), (cp) => summarizeStoredCheckpoint(cp, this.rowVerdicts, this.disclose), this.disclose);
|
|
745
716
|
}
|
|
746
717
|
async listBySession(query) {
|
|
747
718
|
return selectSessionPage(this.cps.entries(), readCheckpointSessionQuery(query), (cp) => structuredClone(cp), this.disclose);
|
|
@@ -753,35 +724,3 @@ export class InMemoryCheckpointStore {
|
|
|
753
724
|
return this.cps.size;
|
|
754
725
|
}
|
|
755
726
|
}
|
|
756
|
-
const RETIRED_MODE_SEED_MEMBERS = Object.freeze([
|
|
757
|
-
["autoModeRequested", () => true],
|
|
758
|
-
["approverPosture", () => true],
|
|
759
|
-
["shellGate", (v) => v !== "always"],
|
|
760
|
-
]);
|
|
761
|
-
export function refuseRetiredModeSeed(state) {
|
|
762
|
-
const gate = state.inheritedGate;
|
|
763
|
-
if (gate === undefined)
|
|
764
|
-
return;
|
|
765
|
-
for (const [key, retired] of RETIRED_MODE_SEED_MEMBERS) {
|
|
766
|
-
const value = gate[key];
|
|
767
|
-
if (value === undefined || !retired(value))
|
|
768
|
-
continue;
|
|
769
|
-
const shown = typeof value === "string" ? JSON.stringify(value.slice(0, 40)) : typeof value === "boolean" ? String(value) : typeof value;
|
|
770
|
-
throw new CheckpointError("checkpoint.unsupported_version", `this checkpoint's inheritedGate carries the retired mode-seed member \`${key}\` (${shown}), written before 7.34.0 and read by no engine since 7.39.0 — resume it once on an engine at 7.38.x or earlier (which reads it into \`permissionMode\`), or expire the row (\`CheckpointStore.expire\`); nothing was consumed`, { reason: "seat_retired" });
|
|
771
|
-
}
|
|
772
|
-
}
|
|
773
|
-
export function recordedModeSeed(gate) {
|
|
774
|
-
if (gate === undefined)
|
|
775
|
-
return {};
|
|
776
|
-
const refusal = (message) => {
|
|
777
|
-
const e = new Error(message);
|
|
778
|
-
e.code = "config.permission_mode_invalid";
|
|
779
|
-
return e;
|
|
780
|
-
};
|
|
781
|
-
const { permissionMode, prePlanMode, shellGate } = gate;
|
|
782
|
-
if (permissionMode !== undefined && !isPermissionMode(permissionMode))
|
|
783
|
-
throw refusal(`the checkpoint row's inheritedGate.permissionMode is ${JSON.stringify(permissionMode)}, not a permission mode — the row cannot be resumed under a mode this engine does not know`);
|
|
784
|
-
if (prePlanMode !== undefined && (!isPermissionMode(prePlanMode) || prePlanMode === "plan"))
|
|
785
|
-
throw refusal(`the checkpoint row's inheritedGate.prePlanMode is ${JSON.stringify(prePlanMode)}, not a permission mode a plan can return to`);
|
|
786
|
-
return { ...(permissionMode !== undefined ? { permissionMode } : {}), ...(prePlanMode !== undefined ? { prePlanMode } : {}), ...(shellGate !== undefined ? { shellGate } : {}) };
|
|
787
|
-
}
|
|
@@ -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) {
|
|
@@ -30,7 +30,7 @@ export interface EngineAttestation {
|
|
|
30
30
|
readonly origin?: AskOrigin;
|
|
31
31
|
/** The settled ask's class set (`ASK_CLASSES` order), when the minting station held one. */
|
|
32
32
|
readonly classes?: readonly AskClass[];
|
|
33
|
-
/** `exactBoundInputHashOf` of the arguments the settlement licenses (an approver's edit, the snapshot shown, or the asked
|
|
33
|
+
/** `exactBoundInputHashOf` of the call's tool with the arguments the settlement licenses (an approver's edit, the snapshot shown, or the asked
|
|
34
34
|
* args); absent when they have none (outside the bindable domain) — such a record licenses no bytes. */
|
|
35
35
|
readonly inputDigest?: string;
|
|
36
36
|
/** The FORM of a classifier round that did not rule (a classifier deny's cause). */
|
|
@@ -117,6 +117,18 @@ export interface EngineNotice {
|
|
|
117
117
|
* replace itself would mint for this target, under a pid that is gone, plain files with one name. A running writer's staged
|
|
118
118
|
* file is never touched. Audience `operator`. `detail: { count }` — how many, no names. Seat-only (an environment with no
|
|
119
119
|
* `onNotice` seat says nothing). ONCE PER WRITE THAT REMOVED ANY.
|
|
120
|
+
* - `"session.lineage_rerooted"` — the session this run continues has a log whose replay dropped records it could not read, and this
|
|
121
|
+
* says what the run lost. Two forms, told apart by `detail.break`: `true` — the branch the run reads broke at a parent the log does
|
|
122
|
+
* not hold, and the run continues from the entry that names that parent (the branch ends there, as a bounded window ends at its floor)
|
|
123
|
+
* instead of failing; `false` — the branch is whole (the log's last records were unreadable and its head fell back to the last one
|
|
124
|
+
* still readable, or the damage sat off the branch) and the run continues from `leaf`. A break the replay cannot account for (it
|
|
125
|
+
* dropped nothing) is refused `corrupt_session`, never re-rooted. Audience `user`. `detail: { break, recordsDropped, recordsTotal, leaf,
|
|
126
|
+
* entriesOnPath, sessionId, runId }` and, when `break` is `true`, `{ missingParentId, rootedAt, entriesCut }` — the replay's count
|
|
127
|
+
* (records, not entries), the entry the run continues from (`null` = nothing of the log is readable), the branch's length, the parent
|
|
128
|
+
* not in the log, the entry the branch starts at, and how many entries the log holds that do not descend from `rootedAt` (the history
|
|
129
|
+
* above the break and its side branches). Counts and entry ids only, never a record's words. ONCE PER PREPARED LEG for a whole branch,
|
|
130
|
+
* once per break for a broken one (and then the whole-branch form is not said), at the first read that met it — said when the acquire
|
|
131
|
+
* has settled on the attempt that holds, so an attempt that lost a write race and was run again is not described.
|
|
120
132
|
* - `"workflow.governance_key_stripped"` (#235) — the fields of an LLM-authored workflow `agent(spec)`
|
|
121
133
|
* that did NOT cross the governed default-deny whitelist: an unrecognized/control-plane field, or a
|
|
122
134
|
* `readFace` value that is not the containment-tightening one. The spawn PROCEEDS on the deployment
|
|
@@ -531,8 +543,8 @@ export interface EngineNotice {
|
|
|
531
543
|
* such as `EMPTY`, fewer than eight characters, one character repeated): it is used as given, but a variable holding
|
|
532
544
|
* the same string is not withheld from a spawned child. Once per PROCESS per value
|
|
533
545
|
* ({@link import("./secret-env.js").holdOwnCredentialValues}); `detail: { reason }` — the kind, never the value. Delivered
|
|
534
|
-
* to `RunnerDeps.onNotice` from the `new Runner` receipt; the intakes with no
|
|
535
|
-
* a request's route reading, a peer's dial, a directly built distiller seat)
|
|
546
|
+
* to `RunnerDeps.onNotice` from the `new Runner` receipt; the intakes with no seat in hand (a brain's construction,
|
|
547
|
+
* a request's route reading, a peer's dial, a directly built distiller seat) go to the default seat ({@link setDefaultEngineNoticeSeat}), else `console.warn`.
|
|
536
548
|
* - `"config.cross_boundary_posture_undeclared"` — a run whose tree executes on a target device (armed) on a deployment that
|
|
537
549
|
* configured no `RunnerDeps.crossBoundaryPosture`: the permissive `"single_user"` reading is in force. Once per run;
|
|
538
550
|
* `detail: { sessionId, runId, taint }` — `taint` lists the tree's taint bits
|
|
@@ -849,6 +861,21 @@ export interface EngineNotice {
|
|
|
849
861
|
* three families AND `"memory.harvest_quarantined"` when they derive from the same harvest
|
|
850
862
|
* report — that sharing is the contract (one report, several distinct facts): dedup on
|
|
851
863
|
* `(code, detail.reportId)`; a repeat with the same pair is a replay, a new pair is a new fact.
|
|
864
|
+
* - `"memory.harvest_refused"` (#2424) — the boundary harvest was refused wholesale by an incident
|
|
865
|
+
* (the deletion fuse, a vanished write root, a control plane that could not be read or written):
|
|
866
|
+
* what the session did to memory — what it said it remembered or forgot — did not take effect.
|
|
867
|
+
* Minted by the runner at the harvest seat, one notice per refused harvest report;
|
|
868
|
+
* `detail: { kind, committed, reportId?, sessionId? }` (`kind` = `HarvestReport.incident.kind`,
|
|
869
|
+
* `committed` = the report's applied patch count, 0 unless a dual-root merge carries the other
|
|
870
|
+
* plane's). The wording is engine-owned per kind: the control-plane kind does not relay its error
|
|
871
|
+
* text (it can name any scope's rows — the host's to read, in `onError` and the report).
|
|
872
|
+
* - `"memory.harvest_conflict"` (#2424) — the harvest committed, but the store did not take some of
|
|
873
|
+
* the session's changes: a per-id CAS miss (another writer committed a newer version first — the
|
|
874
|
+
* only case worded as concurrency) or the store's own refusal of the patch; those entries keep
|
|
875
|
+
* their stored version (a conflicted deletion leaves the entry in place). One notice per harvest
|
|
876
|
+
* with at least one conflict; `detail: { count, conflicts: [{ op, id, concurrent }], reportId?,
|
|
877
|
+
* sessionId? }` (first 20 rows; `concurrent` true ⇔ the CAS arm). Shares `detail.reportId` with
|
|
878
|
+
* the harvest's other notices — dedup on `(code, detail.reportId)`.
|
|
852
879
|
* - `"memory.delegation_static_mark_waived"` (design/324, #324 ruling ①) — the deployment set
|
|
853
880
|
* {@link RunnerDeps.memoryDelegationEvidence} to `"attested-only"` and a delegation call whose
|
|
854
881
|
* STATIC tool-face verdict would have marked this session's memory polluted (attestation
|
|
@@ -1040,6 +1067,9 @@ export interface EngineNotice {
|
|
|
1040
1067
|
* is the one sentence naming the caller-side change that would have let the call run, as the tool text carries it (for arguments
|
|
1041
1068
|
* 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
|
|
1042
1069
|
* work is the session user's own; the operator hears it through the sink like every code.
|
|
1070
|
+
* - `"delegation.resume_lane_missing"` (#3334) — a parked agent resumed by a lane-less drive in a process holding no park of it:
|
|
1071
|
+
* its completion takes the mount's sink, settling no waiting submission elsewhere; the resume proceeds. Once per drive, at
|
|
1072
|
+
* the consume, to the process default seat. `detail: { taskId, rootSessionId? }`. Audience `"operator"`.
|
|
1043
1073
|
*
|
|
1044
1074
|
* - `"memory.consolidation_recommended"` (design/339 §2.2/§6.2) — the engine-minted per-scope
|
|
1045
1075
|
* session count crossed the consolidation thresholds (time gate open ∧ enough distinct
|
|
@@ -1067,7 +1097,7 @@ export interface EngineNotice {
|
|
|
1067
1097
|
* throw rendered twice keeps one id, two refusals sharing a code/scope/message get two. Omitted
|
|
1068
1098
|
* (never fabricated) when the caller composes the line with no error in hand.
|
|
1069
1099
|
*
|
|
1070
|
-
* The
|
|
1100
|
+
* The four SERVER-minted rows ({@link NOTICE_MINTER} `"server"`) — catalogued so their audience and detail shape
|
|
1071
1101
|
* are read here like every other row; this engine never mints them. A server forwards them through the same sink.
|
|
1072
1102
|
* - `"permission.entry_mode_clamped"` — the permission mode the caller requested was clamped by the deployment's
|
|
1073
1103
|
* entry floor BEFORE the run reached this engine (the server's own clamp, through this package's
|
|
@@ -1080,9 +1110,6 @@ export interface EngineNotice {
|
|
|
1080
1110
|
* session's previous run injected (a file added, removed or renamed). Audience `"user"`; `detail: { previous,
|
|
1081
1111
|
* current, sessionId }` — `previous` / `current` are chain-member relative paths, `null` = that run had none.
|
|
1082
1112
|
* No `runId`. Once per run.
|
|
1083
|
-
* - `"session.records_skipped"` — the session's store skipped records it could not read when it opened the
|
|
1084
|
-
* session; the run continues on the history that remains. Audience `"user"`; `detail: { dropped, entriesKept,
|
|
1085
|
-
* sessionId }` — two observed counts, not to be combined. No `runId`. Once per open that skipped.
|
|
1086
1113
|
* - `"memory.layer_locked_legacy"` — a memory layer an older engine left without its owner-write bit was found at
|
|
1087
1114
|
* boot; deletes in it will fail until the operator restores the bit. Audience `"operator"`; `detail: { layers,
|
|
1088
1115
|
* remedy }` — layer directory names and the one command. No session. Once per boot.
|
|
@@ -1120,6 +1147,9 @@ export interface EngineNotice {
|
|
|
1120
1147
|
* Optional and absent for process/config-scoped codes. */
|
|
1121
1148
|
sessionId?: string;
|
|
1122
1149
|
}
|
|
1150
|
+
/** Install the process's default notice seat, for what the engine says where no seat is in hand (a brain's construction, a route reading, a peer's dial): a second call replaces it,
|
|
1151
|
+
* `undefined` removes it (such notices then print on `console.warn`), a seat a station holds always wins, anything but a function or `undefined` is refused (`config.invalid_argument`). */
|
|
1152
|
+
export declare function setDefaultEngineNoticeSeat(seat: ((notice: EngineNotice) => void) | undefined): void;
|
|
1123
1153
|
/** Test seam (mirrors `__resetBashTimeoutAnnouncements`): never called by production code. */
|
|
1124
1154
|
export declare function __resetMalformedNoticeSeatAnnouncement(): void;
|
|
1125
1155
|
/**
|
|
@@ -1139,7 +1169,8 @@ export declare function __resetMalformedNoticeSeatAnnouncement(): void;
|
|
|
1139
1169
|
* · a PRESENT NON-function seat is a bad deployment value, and #123 (loud-bad-value law) forbids
|
|
1140
1170
|
* folding it to silence: the notice itself falls back to `console.warn` (no line is lost), and the
|
|
1141
1171
|
* seat defect — the one fact every fallback would otherwise repeat — is announced once per process.
|
|
1142
|
-
* · an ABSENT seat
|
|
1172
|
+
* · an ABSENT seat goes to the default seat a host installed ({@link setDefaultEngineNoticeSeat}; a function seat as above, and
|
|
1173
|
+
* a present seat — non-function included — never falls through to it), else prints the historic `console.warn` line verbatim.
|
|
1143
1174
|
*/
|
|
1144
1175
|
export declare function deliverEngineNotice(onNotice: ((notice: EngineNotice) => void) | undefined, notice: EngineNotice): void;
|
|
1145
1176
|
/**
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { egressAccount, egressText } from "./untrusted-egress.js";
|
|
2
|
+
let defaultNoticeSeat;
|
|
3
|
+
export function setDefaultEngineNoticeSeat(seat) {
|
|
4
|
+
if (seat !== undefined && typeof seat !== "function")
|
|
5
|
+
throw Object.assign(new Error(`setDefaultEngineNoticeSeat: the seat must be a function, or undefined to remove it (got ${seat === null ? "null" : typeof seat})`), { code: "config.invalid_argument" });
|
|
6
|
+
defaultNoticeSeat = seat;
|
|
7
|
+
}
|
|
2
8
|
let malformedNoticeSeatAnnounced = false;
|
|
3
9
|
export function __resetMalformedNoticeSeatAnnouncement() {
|
|
4
10
|
malformedNoticeSeatAnnounced = false;
|
|
@@ -12,9 +18,10 @@ export function deliverEngineNotice(onNotice, notice) {
|
|
|
12
18
|
if (notice.sessionId === undefined && typeof notice.detail?.["sessionId"] === "string") {
|
|
13
19
|
notice = { ...notice, sessionId: notice.detail["sessionId"] };
|
|
14
20
|
}
|
|
15
|
-
|
|
21
|
+
const seat = onNotice === undefined ? defaultNoticeSeat : onNotice;
|
|
22
|
+
if (typeof seat === "function") {
|
|
16
23
|
try {
|
|
17
|
-
const r =
|
|
24
|
+
const r = seat(notice);
|
|
18
25
|
if (typeof r?.then === "function") {
|
|
19
26
|
r.then(undefined, () => {
|
|
20
27
|
});
|
package/dist/core/gate-fold.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { inlineUntrusted } from "./untrusted-text.js";
|
|
1
|
+
import { inlineUntrusted, PROBE_REASON_MAX } from "./untrusted-text.js";
|
|
2
2
|
import { markTightenMessage } from "./safety-axis-vocab.js";
|
|
3
|
-
import {
|
|
3
|
+
import { normalizeProbeCause } from "./checkpoint-features.js";
|
|
4
4
|
import { normalizeReadRootCandidate } from "./read-root-candidate.js";
|
|
5
5
|
import { engineFailClosedExit, hookDenyExit, settledScreenExit, takeInheritedScreen } from "./runner/gate-exit.js";
|
|
6
6
|
import { noteRewrite, POLICY_AUTHOR, readRejudge, screenRewrite } from "./rewrite-rejudge.js";
|