@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,18 +1,23 @@
|
|
|
1
1
|
import type { PausedCause, TaskResult, TerminalCause } from "../core/types.js";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* run their work as *nested* `runTask`s, and none of them can drive a resume from the inside. If a nested
|
|
6
|
-
* task pauses on a durable gate, the orchestrator must **fail fast** — not silently treat it as an
|
|
7
|
-
* ordinary failure (which would escalate/re-run side effects) and not release its pinned session (which
|
|
8
|
-
* would orphan the checkpoint). It maps `paused → failed` with the code `"unexpected.suspended"` (an
|
|
9
|
-
* approval / resource pause) or `"unexpected.needs_review"` (a review pause) and **carries the pause's own
|
|
10
|
-
* cause on the failed terminal's `nestedPause` seat** so the top-level caller can still resume.
|
|
3
|
+
* The **nested durable-pause boundary** — the one place that says which orchestrators map a pause they meet and how a host
|
|
4
|
+
* continues it; the other places that mention it point here.
|
|
11
5
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
6
|
+
* An orchestrator that runs its work as *nested* `runTask`s cannot answer a durable gate (an approval, a resource slice, a platform
|
|
7
|
+
* park, a dry-run or plan review) from the inside. The cascade (`runCascade` / `resumeCascade`) and the verification gate
|
|
8
|
+
* (`runWithVerification` / `resumeWithVerification`) therefore **stop** at such a pause — no escalation or re-run (side effects), and
|
|
9
|
+
* no release of the pinned session (the checkpoint still references it) — and hand it back through {@link mapNestedSuspend}: a
|
|
10
|
+
* `failed` terminal with the code `"unexpected.suspended"` (an approval / resource / platform pause) or `"unexpected.needs_review"`
|
|
11
|
+
* (a review pause), **the pause's own cause on the failed terminal's `nestedPause` seat**, and a sentence that names the entry that
|
|
12
|
+
* continues it. That entry is the orchestrator's own: `resumeCascade` for a cascade, `resumeWithVerification` for a verification
|
|
13
|
+
* gate. Once the pause is decided, the host calls it with `nestedPause.token` and the decision.
|
|
14
|
+
*
|
|
15
|
+
* The other orchestrators do not map: the repair loop hands the paused terminal back as is, a workflow parks the run, and a
|
|
16
|
+
* subagent reports `suspended.awaiting_approval`.
|
|
17
|
+
*
|
|
18
|
+
* The structural prevention is upstream — an orchestrator should run nested tasks under a **non-durable** approval policy (e.g. the
|
|
19
|
+
* verifier already forces `handsReadOnly` + headless auto-deny) so a suspension cannot arise. This mapping is the defense-in-depth:
|
|
20
|
+
* a deployment that wires durable suspend into a nested orchestrator gets a surfaced pause, not silent errors.
|
|
16
21
|
*/
|
|
17
22
|
export declare const UNEXPECTED_SUSPENDED = "unexpected.suspended";
|
|
18
23
|
/** design/80 D-B: the review durable-pause family (dry-run `needs_review` AND `plan_review`) hits the SAME
|
|
@@ -22,9 +27,9 @@ export declare const UNEXPECTED_NEEDS_REVIEW = "unexpected.needs_review";
|
|
|
22
27
|
/**
|
|
23
28
|
* design/80 D-B: the durable-pause hard boundary covers EVERY `paused` cause — an approval gate, a resource
|
|
24
29
|
* slice, a dry-run review, a `plan_review` plan-gate. All of them persist a checkpoint + PIN their session,
|
|
25
|
-
* and
|
|
26
|
-
* pinned session (releasing it orphans the checkpoint). A type guard, so the caller reads the
|
|
27
|
-
* off the narrowed cause.
|
|
30
|
+
* and the decision that resumes them comes from outside the orchestrator — so it must surface the pause and
|
|
31
|
+
* NOT release the pinned session (releasing it orphans the checkpoint). A type guard, so the caller reads the
|
|
32
|
+
* token/gate off the narrowed cause.
|
|
28
33
|
*/
|
|
29
34
|
export declare function isDurablePause(terminal: TerminalCause): terminal is PausedCause;
|
|
30
35
|
/** A result whose terminal is known to be a pause — what {@link isDurablePause} narrows a result's
|
|
@@ -43,13 +48,30 @@ export declare function resumeNeverStarted(result: TaskResult): boolean;
|
|
|
43
48
|
* status word is projected from; read here by the orchestrators that name the family in their own faces.
|
|
44
49
|
*/
|
|
45
50
|
export declare function pauseFamily(t: PausedCause): "suspended" | "needs_review";
|
|
51
|
+
/**
|
|
52
|
+
* The entry that continues what {@link mapNestedSuspend} hands back, as the orchestrator that calls it names it. The entry is the
|
|
53
|
+
* caller's to give — the mint does not look at who is calling — and a union, so a new mapper has to name its own to compile.
|
|
54
|
+
*/
|
|
55
|
+
export interface NestedResumeEntry {
|
|
56
|
+
/** The orchestrator's resume entry, by its exported name. */
|
|
57
|
+
readonly door: "resumeCascade" | "resumeWithVerification";
|
|
58
|
+
/**
|
|
59
|
+
* Only for an entry that takes the parked leg: where the host gets it. `"card"` — the parked card records it
|
|
60
|
+
* (`CheckpointState.compositionLeg`); `"caller"` — the leg was dispatched with none (the task spec named no session and no leg was
|
|
61
|
+
* handed in), so the card records none and the host supplies the leg itself. Absent — the entry takes no leg.
|
|
62
|
+
*/
|
|
63
|
+
readonly legFrom?: "card" | "caller";
|
|
64
|
+
}
|
|
46
65
|
/**
|
|
47
66
|
* If `result` durably paused, return it mapped to a `failed` result whose terminal carries the pause on
|
|
48
67
|
* `nestedPause`; otherwise return it unchanged. The orchestrator should also **stop** (not escalate/re-run)
|
|
49
68
|
* and **not release** the session when this maps a pause — the checkpoint still references that session.
|
|
50
69
|
*
|
|
70
|
+
* `resume` names the entry that continues the pause; the sentence of the failed terminal is one template with that entry (and, for
|
|
71
|
+
* an entry that takes the parked leg, where the host gets the leg) as its slots.
|
|
72
|
+
*
|
|
51
73
|
* The mapped result keeps the parked leg's `sessionId` — the parked row's own `Checkpoint.sessionId`. A composition's legs do
|
|
52
74
|
* not run in the caller's session, so a host links the row to its run by the row's `CheckpointState.compositionLeg`, never by
|
|
53
75
|
* assuming the row sits in the session it submitted.
|
|
54
76
|
*/
|
|
55
|
-
export declare function mapNestedSuspend(result: TaskResult): TaskResult;
|
|
77
|
+
export declare function mapNestedSuspend(result: TaskResult, resume: NestedResumeEntry): TaskResult;
|
|
@@ -11,16 +11,21 @@ export function resumeNeverStarted(result) {
|
|
|
11
11
|
export function pauseFamily(t) {
|
|
12
12
|
return PAUSE_REGISTRY[t.gate.kind].taskStatus;
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
const LEG_CLAUSE = {
|
|
15
|
+
card: ", and the leg its parked card records (CheckpointState.compositionLeg)",
|
|
16
|
+
caller: ", and the parked leg — this run's card records none because the task spec named no session, so you supply it yourself",
|
|
17
|
+
};
|
|
18
|
+
export function mapNestedSuspend(result, resume) {
|
|
15
19
|
const t = result.terminal;
|
|
16
20
|
if (!isDurablePause(t)) {
|
|
17
21
|
return result;
|
|
18
22
|
}
|
|
19
23
|
const word = pauseFamily(t);
|
|
20
24
|
const code = word === "needs_review" ? UNEXPECTED_NEEDS_REVIEW : UNEXPECTED_SUSPENDED;
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
const legClause = resume.legFrom === undefined ? "" : LEG_CLAUSE[resume.legFrom];
|
|
26
|
+
const message = `a nested task durably paused ("${word}") on a HITL gate and the orchestrator stopped there, keeping the parked leg's session: ` +
|
|
27
|
+
`once the pause is decided, continue it with ${resume.door}, handing it this pause's token (nestedPause.token) and the decision${legClause}; ` +
|
|
28
|
+
"or run the orchestrated task under a non-durable policy so it auto-adjudicates instead of pausing.";
|
|
24
29
|
return {
|
|
25
30
|
...result,
|
|
26
31
|
terminal: { kind: "failed", code, message, nestedPause: t },
|
package/dist/agents/verify.js
CHANGED
|
@@ -91,6 +91,7 @@ function withLegIdentity(internals, leg, caller) {
|
|
|
91
91
|
return { ...internals, onWiringManifest: (manifest) => (caller ?? internals).onWiringManifest?.(manifest, identity) };
|
|
92
92
|
}
|
|
93
93
|
const IMPL_LEG = { kind: "impl", round: 0 };
|
|
94
|
+
const GATE_RESUME_ENTRY = { door: "resumeWithVerification" };
|
|
94
95
|
function fixObjective(findings) {
|
|
95
96
|
const list = findings.length
|
|
96
97
|
? findings.map((f) => `- ${sanitizeUntrustedText(f)}`).join("\n")
|
|
@@ -279,7 +280,7 @@ async function verifyCompletedPlaced(runner, result, specBase, objective, config
|
|
|
279
280
|
spend += (current.stats.costMicroUsd ?? 0) + (current.stats.nested?.costMicroUsd ?? 0);
|
|
280
281
|
implAccount.add(current.stats);
|
|
281
282
|
if (isDurablePause(current.terminal)) {
|
|
282
|
-
return { ...mapNestedSuspend(carryFrozenPosture(withImplAccount(current))), verification: outcome };
|
|
283
|
+
return { ...mapNestedSuspend(carryFrozenPosture(withImplAccount(current)), GATE_RESUME_ENTRY), verification: outcome };
|
|
283
284
|
}
|
|
284
285
|
if (current.terminal.kind !== "completed")
|
|
285
286
|
break;
|
|
@@ -291,7 +292,7 @@ export async function runWithVerification(runner, implSpec, config = {}, interna
|
|
|
291
292
|
const placement = compositionPlacement(internals);
|
|
292
293
|
const result = await runner.runTask(implSpec, withLegIdentity(placement.firstLeg, IMPL_LEG, internals));
|
|
293
294
|
if (isDurablePause(result.terminal)) {
|
|
294
|
-
return { ...mapNestedSuspend(result), verification: { verdict: "unverified", unverifiedReason: pauseFamily(result.terminal), rounds: 0, findings: [] } };
|
|
295
|
+
return { ...mapNestedSuspend(result, GATE_RESUME_ENTRY), verification: { verdict: "unverified", unverifiedReason: pauseFamily(result.terminal), rounds: 0, findings: [] } };
|
|
295
296
|
}
|
|
296
297
|
refuseUnhonorableInternals(internals, "before_leg");
|
|
297
298
|
return verifyCompletedPlaced(runner, result, implSpec, implSpec.objective, config, internals, placement);
|
|
@@ -301,7 +302,7 @@ export async function resumeWithVerification(runner, token, outcome, taskConfig,
|
|
|
301
302
|
const placement = compositionPlacement(internals);
|
|
302
303
|
const result = await runner.resume(token, outcome, taskConfig, withLegIdentity(placement.firstLeg, IMPL_LEG, internals));
|
|
303
304
|
if (isDurablePause(result.terminal)) {
|
|
304
|
-
return { ...mapNestedSuspend(result), verification: { verdict: "unverified", unverifiedReason: pauseFamily(result.terminal), rounds: 0, findings: [] } };
|
|
305
|
+
return { ...mapNestedSuspend(result, GATE_RESUME_ENTRY), verification: { verdict: "unverified", unverifiedReason: pauseFamily(result.terminal), rounds: 0, findings: [] } };
|
|
305
306
|
}
|
|
306
307
|
refuseUnhonorableInternals(internals, "before_leg");
|
|
307
308
|
return verifyCompletedPlaced(runner, result, taskConfig, objective, config, internals, placement);
|
|
@@ -5,9 +5,9 @@ import { receiptRefusal, receiveOwnProperties } from "../core/own-property-recei
|
|
|
5
5
|
import { credentialHeaderValues, holdOwnCredentialValues, isBlankCredential, isCredentialHeaderName, isSchemedCredentialHeader } from "../core/secret-env.js";
|
|
6
6
|
import { deliverEngineNotice } from "../core/engine-notice.js";
|
|
7
7
|
import { uuidv7 } from "../engine/session/uuid.js";
|
|
8
|
-
import { REDACTION_MARKS } from "../core/redaction-marks.js";
|
|
9
|
-
import {
|
|
10
|
-
const REDACTED_VALUE =
|
|
8
|
+
import { REDACTION_MARKS, WITHHELD_VALUE_MARK } from "../core/redaction-marks.js";
|
|
9
|
+
import { CREDENTIAL_VOCABULARY } from "@sema-agent/primitives";
|
|
10
|
+
const REDACTED_VALUE = WITHHELD_VALUE_MARK;
|
|
11
11
|
const REDACTED_CREDENTIALS = REDACTION_MARKS.credentials;
|
|
12
12
|
function servableParse(raw) {
|
|
13
13
|
let u;
|
|
@@ -181,7 +181,12 @@ export function joinRequestUrl(root, suffix) {
|
|
|
181
181
|
}
|
|
182
182
|
return composed;
|
|
183
183
|
}
|
|
184
|
-
const AUTHORITY_USERINFO =
|
|
184
|
+
const AUTHORITY_USERINFO = (() => {
|
|
185
|
+
const row = CREDENTIAL_VOCABULARY.values.find((r) => r.id === "url-userinfo");
|
|
186
|
+
if (row === undefined)
|
|
187
|
+
throw new Error('route-adjudicator: the credential vocabulary has no "url-userinfo" row');
|
|
188
|
+
return new RegExp(row.match.source, row.match.flags);
|
|
189
|
+
})();
|
|
185
190
|
export function stripUrlCredentials(text) {
|
|
186
191
|
return text.replace(AUTHORITY_USERINFO, `$1${REDACTED_CREDENTIALS}@`);
|
|
187
192
|
}
|
|
@@ -81,7 +81,7 @@ function judgeTool(row, live, station) {
|
|
|
81
81
|
return { member: "tool", disposition: "veto", code: "resume.target_moved", message: vetoed(row.toolName, "the tool's declaration (what it does, reaches and trusts: its effect, egress, irreversibility, content origin, boundary legs, rule face or model gate) changed after the approval") };
|
|
82
82
|
}
|
|
83
83
|
function judgeTargets(row, live) {
|
|
84
|
-
if ((row.targets === undefined && row.targetReads === undefined) || ("decided" in live && !licenseCovers(row.boundInputHash, live.decided)))
|
|
84
|
+
if ((row.targets === undefined && row.targetReads === undefined) || ("decided" in live && !licenseCovers(row.boundInputHash, row.toolName, live.decided)))
|
|
85
85
|
return undefined;
|
|
86
86
|
const why = landedElsewhere(row.targets, row.targetReads, live);
|
|
87
87
|
return why === undefined ? undefined : { member: "targets", disposition: "veto", code: "resume.target_moved", message: vetoed(row.toolName, why) };
|
package/dist/core/arg-summary.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readProgramPosition } from "../tools/fs/bash-program-position.js";
|
|
2
2
|
import { argvOf, lexShell } from "../shell/lex.js";
|
|
3
|
-
import { isSensitiveRecordKey } from "
|
|
3
|
+
import { isSensitiveRecordKey } from "@sema-agent/primitives";
|
|
4
4
|
import { egressText } from "./untrusted-egress.js";
|
|
5
5
|
const ACTIVITY_ARG_MAX = 80;
|
|
6
6
|
function truncCodePoints(s) {
|
|
@@ -77,8 +77,8 @@ export interface AskQuestionRequest {
|
|
|
77
77
|
* question. `readonly` + same caveat as `principal`. */
|
|
78
78
|
readonly agentId?: string;
|
|
79
79
|
/**
|
|
80
|
-
* The canonical hash of the tool
|
|
81
|
-
* engine's one `
|
|
80
|
+
* The canonical hash of the tool call this question was built from — the call's tool and its arguments, as computed by
|
|
81
|
+
* the engine's one call binding `exactBoundInputHashOf` (the same digest the durable park binds its checkpoint to, so the
|
|
82
82
|
* two lanes are reconcilable against each other). Present only when the engine routed the question
|
|
83
83
|
* — a directly-mounted tool calling its own face carries none.
|
|
84
84
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ReceiptFault } from "./mods/kernel/receive.js";
|
|
2
2
|
/**
|
|
3
3
|
* design/80 D-1 §2 (slice 1a.2) — the engine-only **vetted canonical serializer** used to mint a stable,
|
|
4
|
-
* opaque {@link
|
|
4
|
+
* opaque {@link exactBoundInputHashOf | boundInputHash} over a pending tool call: its tool's name and its arguments.
|
|
5
5
|
*
|
|
6
6
|
* ## Why a bespoke serializer (and why engine-ONLY)
|
|
7
7
|
* The package's only runtime deps are typebox + the MCP SDK — there is no canonical/stable JSON serializer,
|
|
@@ -19,7 +19,9 @@ import { type ReceiptFault } from "./mods/kernel/receive.js";
|
|
|
19
19
|
* ## Canonical form
|
|
20
20
|
* A total function (never throws) that emits a **type-tagged, length-prefixed** string so distinct values of
|
|
21
21
|
* distinct types can never collide (`number 1` ≠ `string "1"` ≠ `boolean`, and `{"a":"b"}` ≠ `{"ab":""}`):
|
|
22
|
-
* - `null` → `N`, `undefined` → `U
|
|
22
|
+
* - `null` → `N`, `undefined` → `U`, at any depth: `{a:undefined}` and `{}` are two forms — the form a workflow call's journal
|
|
23
|
+
* key, the rewrite judge, a file rule store's checksum, a wiring fingerprint and every other digest of a value taken here
|
|
24
|
+
* read; a call's approval binding digests the arguments' JSON form ({@link exactBoundInputHashOf})
|
|
23
25
|
* - boolean → `b1` / `b0`
|
|
24
26
|
* - number → `n:<canonical>`; finite via `String(x)` (shortest round-trippable, deterministic per value);
|
|
25
27
|
* `-0` normalized to `0`; `NaN`/`±Infinity` get explicit distinct tokens (never collapsed to `null`)
|
|
@@ -55,18 +57,26 @@ export declare function canonicalize(value: unknown, standsAt?: number): string;
|
|
|
55
57
|
* constant (the checkpoint row digest) refuses on it. */
|
|
56
58
|
export declare const UNCANONICALIZABLE = "<uncanonicalizable>";
|
|
57
59
|
/**
|
|
58
|
-
* design/80 D-1 §2 —
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
60
|
+
* design/80 D-1 §2 — a SHA-256 (hex) over {@link canonicalize}: the engine's one digest of a value. A call's binding is this digest
|
|
61
|
+
* over `{ tool, input }` ({@link exactBoundInputHashOf}); the other digests the engine takes of a value (a Skill card's lists, a
|
|
62
|
+
* tool's declaration, a question batch) are this digest over that value. The hex digest is fixed-length and opaque — exactly
|
|
63
|
+
* what the operator sees / the D-G signer signs.
|
|
62
64
|
*/
|
|
63
65
|
export declare function boundInputHashOf(value: unknown): string;
|
|
64
66
|
/**
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
67
|
+
* THE digest an approval binds a CALL by: SHA-256 (hex) over the canonical form of the one record `{ tool, input }` — the tool's name as the
|
|
68
|
+
* call spells it and the arguments in their JSON form ({@link capturedJsonOf}: a record member holding `undefined` absent), one
|
|
69
|
+
* digest for the call in memory and after a durable store's JSON round trip — when an approval can be bound to the arguments
|
|
70
|
+
* ({@link bindableValueOf}), else `undefined`.
|
|
71
|
+
* Every binding of a call mints through it and every comparison of one reads it: the park row's `boundInputHash`, the live ask's
|
|
72
|
+
* and the routed question's reconciliation hash, and an answer's licensed bytes (`inputDigest`, compared by `licenseCovers`) — so
|
|
73
|
+
* one approval covers one tool over one set of bytes, and a call of another tool over the same bytes under the same call id is
|
|
74
|
+
* another question. The name is read as given (no alias or case is resolved: the row, the ask and the record each carry the
|
|
75
|
+
* call's own `toolName`). The record only HOLDS the two members (it is canonicalized at depth −1, {@link canonicalize}), so the
|
|
76
|
+
* arguments count their containers as when digested alone and the form is exact over the whole bindable domain; key order is
|
|
77
|
+
* the serializer's own (sorted), so the two members cannot be permuted.
|
|
68
78
|
*/
|
|
69
|
-
export declare function exactBoundInputHashOf(
|
|
79
|
+
export declare function exactBoundInputHashOf(tool: string, input: unknown): string | undefined;
|
|
70
80
|
/**
|
|
71
81
|
* Why a value is outside the bindable domain: its top is not the payload's shape, a refusal of the receipt it is read by, or one of
|
|
72
82
|
* JSON's own five — a number that is not finite, a hole in a list, a named member on a list, an `undefined` list element, one
|
|
@@ -78,8 +88,8 @@ export type BindingFault = ReceiptFault | {
|
|
|
78
88
|
};
|
|
79
89
|
/**
|
|
80
90
|
* THE judge of the BINDABLE domain — the values an approval can be bound to, and so the only values with an exact digest: plain
|
|
81
|
-
* JSON data (records, dense lists, strings, finite numbers, booleans, `null`; a record member
|
|
82
|
-
*
|
|
91
|
+
* JSON data (records, dense lists, strings, finite numbers, booleans, `null`; a record member holding `undefined` is legal and
|
|
92
|
+
* kept on the copy as given) under a top of the payload's own shape (`top`: a call's arguments are a RECORD — the default, and the
|
|
83
93
|
* only shape an exact digest is taken of; a question's answers are a LIST), a tree (no object met twice), at most 256 levels of
|
|
84
94
|
* containers. Read by the engine's one receipt of a caller's value in {@link BINDING_RECEIPT} (nothing of the caller's runs: a
|
|
85
95
|
* getter, a hidden or symbol-keyed member, a Proxy, a function, a symbol, a bigint, a Map / Set / Date / binary or any other kind
|
|
@@ -96,7 +106,7 @@ export declare function bindableValueOf(value: unknown, top?: BindingTop): {
|
|
|
96
106
|
export type BindingTop = "record" | "list";
|
|
97
107
|
/** THE capture of a caller-supplied payload the engine persists and later compares (a durable decide's edit — a record —, a
|
|
98
108
|
* question's answers — a list): the judge's receipt ({@link bindableValueOf}) kept in the form a durable store's JSON round trip
|
|
99
|
-
* hands back ({@link jsonFormOf}). */
|
|
109
|
+
* hands back ({@link jsonFormOf}) — the form a call's binding digests ({@link exactBoundInputHashOf}). */
|
|
100
110
|
export declare function capturedJsonOf(value: unknown, top?: BindingTop): {
|
|
101
111
|
readonly ok: true;
|
|
102
112
|
readonly value: unknown;
|
|
@@ -13,11 +13,11 @@ export const UNCANONICALIZABLE = "<uncanonicalizable>";
|
|
|
13
13
|
export function boundInputHashOf(value) {
|
|
14
14
|
return createHash("sha256").update(canonicalize(value), "utf8").digest("hex");
|
|
15
15
|
}
|
|
16
|
-
export function exactBoundInputHashOf(
|
|
17
|
-
const
|
|
18
|
-
if (!
|
|
16
|
+
export function exactBoundInputHashOf(tool, input) {
|
|
17
|
+
const captured = capturedJsonOf(input);
|
|
18
|
+
if (!captured.ok)
|
|
19
19
|
return undefined;
|
|
20
|
-
const form = canonicalize(
|
|
20
|
+
const form = canonicalize({ tool, input: captured.value }, -1);
|
|
21
21
|
return form === UNCANONICALIZABLE ? undefined : createHash("sha256").update(form, "utf8").digest("hex");
|
|
22
22
|
}
|
|
23
23
|
export function bindableValueOf(value, top = "record") {
|