@sema-agent/core 7.48.0 → 7.49.1
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 +457 -0
- package/README.md +2 -2
- package/dist/agents/cascade.d.ts +2 -5
- package/dist/agents/child-failure.d.ts +20 -0
- package/dist/agents/child-failure.js +28 -0
- package/dist/agents/cross-session-ref.d.ts +11 -3
- package/dist/agents/cross-session-ref.js +6 -0
- package/dist/agents/cumulative-stats.d.ts +12 -15
- package/dist/agents/cumulative-stats.js +1 -1
- package/dist/agents/extra-tool-names.js +1 -1
- package/dist/agents/inherited-tool-pool.d.ts +17 -13
- package/dist/agents/inherited-tool-pool.js +4 -3
- package/dist/agents/peer-session-drain.d.ts +3 -2
- package/dist/agents/peer-session-drain.js +5 -4
- package/dist/agents/send-message-tool.js +2 -9
- package/dist/agents/subagent.d.ts +10 -29
- package/dist/agents/subagent.js +65 -53
- package/dist/agents/suspend-guard.d.ts +1 -1
- package/dist/agents/tool-filter.d.ts +76 -65
- package/dist/agents/tool-filter.js +122 -92
- package/dist/agents/verify.d.ts +4 -7
- package/dist/agents/verify.js +6 -7
- package/dist/bench/metrics.d.ts +1 -2
- package/dist/brain/anthropic.js +133 -79
- package/dist/brain/errors.d.ts +53 -6
- package/dist/brain/errors.js +22 -2
- package/dist/brain/input-too-long.d.ts +40 -19
- package/dist/brain/input-too-long.js +3 -16
- package/dist/brain/open-responses.js +19 -10
- package/dist/brain/openai.js +123 -32
- package/dist/brain/provider-dialect.d.ts +214 -0
- package/dist/brain/provider-dialect.js +186 -0
- package/dist/brain/request-params.d.ts +27 -8
- package/dist/brain/request-params.js +7 -12
- package/dist/brain/request-route.d.ts +84 -0
- package/dist/brain/request-route.js +41 -0
- package/dist/brain/retry.d.ts +8 -0
- package/dist/brain/retry.js +10 -4
- package/dist/brain/route-adjudicator.d.ts +7 -0
- package/dist/brain/route-adjudicator.js +5 -1
- package/dist/brain/status-sink.d.ts +20 -0
- package/dist/brain/status-sink.js +11 -0
- package/dist/brain/stream-engine.d.ts +52 -1
- package/dist/brain/stream-engine.js +81 -24
- package/dist/brain/stream-shared.d.ts +57 -11
- package/dist/brain/stream-shared.js +28 -2
- package/dist/core/a2a.d.ts +1 -0
- package/dist/core/agent-config-dir.js +3 -2
- package/dist/core/allow-entry.d.ts +21 -12
- package/dist/core/allow-entry.js +38 -31
- package/dist/core/arg-summary.d.ts +21 -28
- package/dist/core/arg-summary.js +235 -88
- package/dist/core/ask-origin.d.ts +42 -24
- package/dist/core/ask-origin.js +18 -13
- package/dist/core/auto-mode-prompt-assets.d.ts +2 -2
- package/dist/core/auto-mode-prompt-assets.js +1 -1
- package/dist/core/auto-mode-prompt.d.ts +11 -1
- package/dist/core/auto-mode-prompt.js +13 -10
- package/dist/core/auto-mode-rebuild.d.ts +7 -0
- package/dist/core/auto-mode-rebuild.js +4 -1
- package/dist/core/canonical-json.d.ts +3 -0
- package/dist/core/canonical-json.js +2 -1
- package/dist/core/checkpoint-requirements.d.ts +892 -0
- package/dist/core/checkpoint-requirements.js +333 -0
- package/dist/core/checkpoint-store.d.ts +94 -65
- package/dist/core/checkpoint-store.js +14 -26
- package/dist/core/child-clamp-seats.d.ts +228 -69
- package/dist/core/child-clamp-seats.js +211 -17
- package/dist/core/classifier-unavailable-arm.d.ts +5 -1
- package/dist/core/classifier-unavailable-arm.js +3 -3
- package/dist/core/compliance.d.ts +3 -0
- package/dist/core/compliance.js +9 -4
- package/dist/core/credential-vocabulary.d.ts +140 -0
- package/dist/core/credential-vocabulary.js +131 -0
- package/dist/core/decision-receipt.js +1 -1
- package/dist/core/effective-path-target.d.ts +73 -16
- package/dist/core/effective-path-target.js +63 -33
- package/dist/core/engine-notice.d.ts +43 -11
- package/dist/core/file-history-store.js +2 -2
- package/dist/core/fs-write-gate-policy.d.ts +4 -0
- package/dist/core/fs-write-gate-policy.js +22 -5
- package/dist/core/gate-bounded-await.d.ts +28 -13
- package/dist/core/gate-bounded-await.js +41 -4
- package/dist/core/gate-fold.d.ts +1 -1
- package/dist/core/gate-fold.js +24 -25
- package/dist/core/gate-lanes.js +16 -15
- package/dist/core/gate-outcome.d.ts +20 -5
- package/dist/core/gate-outcome.js +5 -0
- package/dist/core/governance-codes.d.ts +11 -4
- package/dist/core/governance-codes.js +14 -3
- package/dist/core/hooks.d.ts +21 -0
- package/dist/core/locked-config.d.ts +8 -0
- package/dist/core/locked-config.js +14 -2
- package/dist/core/lsp.js +3 -5
- package/dist/core/mailbox-store.d.ts +3 -4
- package/dist/core/mcp-connection-pool.d.ts +75 -0
- package/dist/core/mcp-connection-pool.js +128 -0
- package/dist/core/mcp-failure.d.ts +2 -1
- package/dist/core/mcp-failure.js +13 -2
- package/dist/core/mcp.d.ts +4 -0
- package/dist/core/mcp.js +70 -43
- package/dist/core/memory-engine/content-origin.js +2 -14
- package/dist/core/memory-engine/engine.d.ts +32 -22
- package/dist/core/memory-engine/engine.js +103 -55
- package/dist/core/memory-engine/file-backend.d.ts +13 -30
- package/dist/core/memory-engine/file-backend.js +37 -252
- package/dist/core/memory-engine/index.d.ts +1 -1
- package/dist/core/memory-engine/index.js +1 -1
- package/dist/core/memory-engine/layout.d.ts +139 -9
- package/dist/core/memory-engine/layout.js +350 -7
- package/dist/core/memory-engine/scope-contract.d.ts +10 -0
- package/dist/core/memory-engine/scope-contract.js +8 -0
- package/dist/core/memory-engine/session-incarnation.d.ts +14 -4
- package/dist/core/memory-engine/session-incarnation.js +5 -2
- package/dist/core/memory-engine/types.d.ts +10 -1
- package/dist/core/memory.js +5 -17
- package/dist/core/model-seat.d.ts +4 -4
- package/dist/core/model-seat.js +1 -1
- package/dist/core/mounted-mcp.d.ts +57 -0
- package/dist/core/mounted-mcp.js +19 -0
- package/dist/core/namespaced-rule-name.d.ts +29 -0
- package/dist/core/namespaced-rule-name.js +52 -0
- package/dist/core/park-selfcheck.d.ts +1 -1
- package/dist/core/park-selfcheck.js +16 -6
- package/dist/core/path-guard-rows.d.ts +99 -0
- package/dist/core/path-guard-rows.js +45 -0
- package/dist/core/path-identity.d.ts +22 -16
- package/dist/core/path-identity.js +10 -10
- package/dist/core/path-rule-binding.d.ts +2 -1
- package/dist/core/path-rule-binding.js +3 -1
- package/dist/core/pause-registry.d.ts +16 -2
- package/dist/core/pause-registry.js +6 -0
- package/dist/core/permission-rule-consent.js +0 -7
- package/dist/core/permission-rule-model.d.ts +68 -24
- package/dist/core/permission-rule-model.js +105 -24
- package/dist/core/permission-rule-store.js +2 -2
- package/dist/core/permission-rules.d.ts +3 -30
- package/dist/core/permission-rules.js +4 -54
- package/dist/core/read-root-candidate.d.ts +1 -3
- package/dist/core/read-root-candidate.js +4 -15
- package/dist/core/real-approval.d.ts +4 -3
- package/dist/core/retired-keys.d.ts +13 -0
- package/dist/core/retired-keys.js +14 -0
- package/dist/core/roles.d.ts +2 -3
- package/dist/core/roles.js +15 -6
- package/dist/core/runner/assemble-result.d.ts +0 -7
- package/dist/core/runner/assemble-result.js +19 -31
- package/dist/core/runner/caller-roster.d.ts +78 -0
- package/dist/core/runner/caller-roster.js +219 -0
- package/dist/core/runner/checkpoint-scope.d.ts +16 -16
- package/dist/core/runner/checkpoint-scope.js +2 -2
- package/dist/core/runner/child-tree.js +2 -2
- package/dist/core/runner/contracts.d.ts +68 -35
- package/dist/core/runner/decide-continuation.d.ts +51 -3
- package/dist/core/runner/decide-continuation.js +76 -21
- package/dist/core/runner/denial-limit-arms.d.ts +17 -5
- package/dist/core/runner/denial-limit-arms.js +11 -9
- package/dist/core/runner/extra-body-dropped-seat.d.ts +8 -0
- package/dist/core/runner/extra-body-dropped-seat.js +22 -0
- package/dist/core/runner/finish-reason-seat.d.ts +9 -0
- package/dist/core/runner/finish-reason-seat.js +40 -0
- package/dist/core/runner/gate-exit.d.ts +44 -32
- package/dist/core/runner/gate-exit.js +112 -25
- package/dist/core/runner/inherited-ask-grants.js +6 -4
- package/dist/core/runner/mcp-redial.d.ts +3 -3
- package/dist/core/runner/mcp-redial.js +3 -4
- package/dist/core/runner/permission-rule-lanes.d.ts +1 -2
- package/dist/core/runner/permission-rule-lanes.js +5 -4
- package/dist/core/runner/prepare-artifact.d.ts +4 -0
- package/dist/core/runner/prepare-artifact.js +2 -1
- package/dist/core/runner/prepare-ask-lane.d.ts +2 -0
- package/dist/core/runner/prepare-ask-lane.js +12 -6
- package/dist/core/runner/prepare-boundary-parks.d.ts +5 -8
- package/dist/core/runner/prepare-boundary-parks.js +4 -7
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +11 -15
- package/dist/core/runner/prepare-caps-and-workflow.js +19 -27
- package/dist/core/runner/prepare-config-doors.d.ts +9 -9
- package/dist/core/runner/prepare-config-doors.js +10 -5
- package/dist/core/runner/prepare-defer-classify.d.ts +2 -2
- package/dist/core/runner/prepare-defer-classify.js +5 -3
- package/dist/core/runner/prepare-delegation-surface.d.ts +1 -1
- package/dist/core/runner/prepare-delegation-surface.js +3 -3
- package/dist/core/runner/prepare-gate-stations.d.ts +4 -4
- package/dist/core/runner/prepare-gate-stations.js +9 -7
- package/dist/core/runner/prepare-hands-readface.d.ts +7 -7
- package/dist/core/runner/prepare-hands-readface.js +7 -7
- package/dist/core/runner/prepare-inherited-gate.d.ts +7 -6
- package/dist/core/runner/prepare-inherited-gate.js +14 -15
- package/dist/core/runner/prepare-listings.d.ts +7 -24
- package/dist/core/runner/prepare-listings.js +4 -5
- package/dist/core/runner/prepare-memory-engine-session.d.ts +2 -0
- package/dist/core/runner/prepare-memory-engine-session.js +4 -3
- package/dist/core/runner/prepare-memory.d.ts +6 -0
- package/dist/core/runner/prepare-memory.js +13 -13
- package/dist/core/runner/prepare-offload-wrappers.d.ts +5 -0
- package/dist/core/runner/prepare-offload-wrappers.js +3 -3
- package/dist/core/runner/prepare-park-ask.d.ts +7 -8
- package/dist/core/runner/prepare-park-ask.js +17 -10
- package/dist/core/runner/prepare-policy-chain.js +24 -44
- package/dist/core/runner/prepare-project-context.d.ts +1 -1
- package/dist/core/runner/prepare-project-context.js +3 -4
- package/dist/core/runner/prepare-protocol-tools.d.ts +9 -3
- package/dist/core/runner/prepare-protocol-tools.js +3 -4
- package/dist/core/runner/prepare-run-refs.d.ts +3 -0
- package/dist/core/runner/prepare-run-refs.js +2 -1
- package/dist/core/runner/prepare-safety-scan.d.ts +4 -8
- package/dist/core/runner/prepare-safety-scan.js +1 -2
- package/dist/core/runner/prepare-suspend-saga.d.ts +7 -1
- package/dist/core/runner/prepare-suspend-saga.js +28 -12
- package/dist/core/runner/prepare-task.d.ts +1 -1
- package/dist/core/runner/prepare-task.js +67 -56
- package/dist/core/runner/prepare-wiring-manifest.d.ts +11 -10
- package/dist/core/runner/prepare-wiring-manifest.js +5 -8
- package/dist/core/runner/resume-apply.js +7 -14
- package/dist/core/runner/resume-checkpoint-screen.js +11 -4
- package/dist/core/runner/resume-internals-and-config.js +2 -2
- package/dist/core/runner/resume-policy-outcome.js +5 -32
- package/dist/core/runner/resume-review-outcome.js +4 -1
- package/dist/core/runner/retired-runner-deps.d.ts +6 -0
- package/dist/core/runner/retired-runner-deps.js +10 -1
- package/dist/core/runner/run-brain-sinks.d.ts +4 -0
- package/dist/core/runner/run-brain-sinks.js +5 -2
- package/dist/core/runner/run-harness-handlers.js +29 -36
- package/dist/core/runner/run-leg.d.ts +0 -2
- package/dist/core/runner/run-leg.js +32 -33
- package/dist/core/runner/run-terminal-adoption.js +4 -3
- package/dist/core/runner/runtask.js +8 -8
- package/dist/core/runner/session-rule-policy.js +5 -5
- package/dist/core/runner/stream-settle-backstop.js +7 -4
- package/dist/core/runner/sub-agent-deny-lists.d.ts +51 -12
- package/dist/core/runner/sub-agent-deny-lists.js +111 -80
- package/dist/core/runner/terminal-account.d.ts +48 -0
- package/dist/core/runner/terminal-account.js +186 -0
- package/dist/core/runner/tool-end-body.d.ts +54 -17
- package/dist/core/runner/tool-end-body.js +27 -2
- package/dist/core/runner/tool-face-overlay.d.ts +3 -1
- package/dist/core/runner/tool-face-overlay.js +6 -4
- package/dist/core/runner/tool-occurrence.d.ts +106 -0
- package/dist/core/runner/tool-occurrence.js +123 -0
- package/dist/core/runner/tool-progress-lane.d.ts +16 -8
- package/dist/core/runner/tool-progress-lane.js +25 -34
- package/dist/core/runner/tool-turn-repair-seat.d.ts +28 -4
- package/dist/core/runner/tool-turn-repair-seat.js +36 -13
- package/dist/core/runner/turn-attachments.d.ts +1 -1
- package/dist/core/runner/write-protection-station.d.ts +21 -9
- package/dist/core/runner/write-protection-station.js +20 -17
- package/dist/core/runner-deps.d.ts +12 -22
- package/dist/core/secret-env.d.ts +16 -5
- package/dist/core/secret-env.js +23 -63
- package/dist/core/sensitive-path-policy.d.ts +19 -18
- package/dist/core/sensitive-path-policy.js +73 -49
- package/dist/core/session-reconcile.d.ts +3 -0
- package/dist/core/session-reconcile.js +5 -4
- package/dist/core/session-store.d.ts +5 -0
- package/dist/core/session-store.js +12 -0
- package/dist/core/session.d.ts +13 -0
- package/dist/core/shared-memory/normalize.d.ts +17 -4
- package/dist/core/shared-memory/normalize.js +7 -7
- package/dist/core/shell-lexer.js +5 -4
- package/dist/core/shell-wrapper-projection.js +1 -1
- package/dist/core/skill-grant.js +1 -1
- package/dist/core/store-contracts/checkpoint-store-contract.js +13 -0
- package/dist/core/store-contracts/mailbox-store-contract.d.ts +7 -14
- package/dist/core/store-contracts/session-store-incarnation-contract.d.ts +27 -0
- package/dist/core/store-contracts/session-store-incarnation-contract.js +92 -0
- package/dist/core/stub-env.d.ts +2 -0
- package/dist/core/stub-env.js +1 -0
- package/dist/core/synthetic-read-verdict.js +2 -2
- package/dist/core/task-event.d.ts +59 -5
- package/dist/core/task-result.d.ts +1 -1
- package/dist/core/task-spec.d.ts +42 -9
- package/dist/core/terminal-cause.d.ts +94 -11
- package/dist/core/tighten-task-spec.d.ts +5 -4
- package/dist/core/tighten-task-spec.js +20 -25
- package/dist/core/tool-catalog-entries.d.ts +5 -7
- package/dist/core/tool-catalog-entries.js +14 -15
- package/dist/core/tool-face.d.ts +47 -0
- package/dist/core/tool-face.js +5 -0
- package/dist/core/tool-model-gate.d.ts +5 -5
- package/dist/core/tool-name-aliases.d.ts +26 -2
- package/dist/core/tool-name-aliases.js +13 -0
- package/dist/core/tool-name-list.d.ts +30 -0
- package/dist/core/tool-name-list.js +55 -0
- package/dist/core/tool-name-readings.d.ts +1 -9
- package/dist/core/tool-name-readings.js +1 -3
- package/dist/core/tool-policy.d.ts +195 -85
- package/dist/core/tool-policy.js +165 -380
- package/dist/core/tool-registry.d.ts +44 -1
- package/dist/core/tool-registry.js +26 -0
- package/dist/core/tool-roster.d.ts +19 -1
- package/dist/core/tool-roster.js +21 -2
- package/dist/core/tool-spec-members.d.ts +45 -0
- package/dist/core/tool-spec-members.js +169 -0
- package/dist/core/tool-spec.d.ts +46 -8
- package/dist/core/tools.d.ts +6 -2
- package/dist/core/tools.js +8 -4
- package/dist/core/untrusted-egress.js +29 -26
- package/dist/core/untrusted-text.d.ts +13 -10
- package/dist/core/untrusted-text.js +6 -44
- package/dist/core/workflow-journal-store.d.ts +4 -1
- package/dist/core/write-protect.d.ts +65 -29
- package/dist/core/write-protect.js +235 -177
- package/dist/engine/compaction/compaction.d.ts +2 -2
- package/dist/engine/execution-env/node-execution-env.d.ts +5 -23
- package/dist/engine/execution-env/node-execution-env.js +16 -38
- package/dist/engine/execution-env/symlink-chain.d.ts +23 -0
- package/dist/engine/execution-env/symlink-chain.js +32 -0
- package/dist/engine/harness/types.d.ts +7 -0
- package/dist/engine/llm/tool-turns.d.ts +3 -0
- package/dist/engine/llm/tool-turns.js +1 -0
- package/dist/engine/llm/types.d.ts +59 -23
- package/dist/engine/loop/agent-loop.js +16 -2
- package/dist/engine/session/memory-repo.js +11 -3
- package/dist/engine/session/repo-utils.d.ts +8 -0
- package/dist/engine/session/repo-utils.js +13 -0
- package/dist/index.d.ts +20 -23
- package/dist/index.js +17 -20
- package/dist/internal/harness.d.ts +1 -1
- package/dist/internal/harness.js +1 -1
- package/dist/internal/llm.d.ts +2 -2
- package/dist/internal/llm.js +1 -1
- package/dist/orchestration/governance-baseline-validity.js +1 -1
- package/dist/orchestration/run-spec.js +3 -3
- package/dist/orchestration/run-workflow-tool.d.ts +16 -35
- package/dist/orchestration/run-workflow-tool.js +38 -78
- package/dist/orchestration/workflow-governance.d.ts +21 -25
- package/dist/orchestration/workflow-governance.js +38 -78
- package/dist/orchestration/workflow-primitives.d.ts +7 -22
- package/dist/orchestration/workflow-primitives.js +5 -12
- package/dist/orchestration/workflow-types.d.ts +1 -1
- package/dist/orchestration/workflow.d.ts +61 -11
- package/dist/orchestration/workflow.js +189 -117
- package/dist/scenarios/full-body.d.ts +1 -1
- package/dist/shell/lex.d.ts +0 -21
- package/dist/shell/lex.js +250 -68
- package/dist/shell/shell-words.d.ts +35 -0
- package/dist/shell/shell-words.js +65 -0
- package/dist/stores/file/checkpoint-store.d.ts +5 -5
- package/dist/stores/file/checkpoint-store.js +5 -2
- package/dist/stores/file/index.d.ts +0 -8
- package/dist/stores/file/index.js +0 -12
- package/dist/stores/file/session-store.d.ts +3 -0
- package/dist/stores/file/session-store.js +44 -19
- package/dist/tools/artifact/artifact-tool.js +2 -0
- package/dist/tools/fs/bash-program-position.d.ts +12 -4
- package/dist/tools/fs/bash-program-position.js +32 -9
- package/dist/tools/fs/bash-readonly-classifier.d.ts +1 -1
- package/dist/tools/fs/bash-readonly-classifier.js +8 -7
- package/dist/tools/fs/containment-face.d.ts +4 -0
- package/dist/tools/fs/containment-face.js +3 -0
- package/dist/tools/fs/fs-shared.d.ts +10 -0
- package/dist/tools/fs/fs-shared.js +18 -0
- package/dist/tools/fs/fs-write.js +4 -2
- package/dist/tools/fs/index.d.ts +1 -1
- package/dist/tools/fs/program-read-model.d.ts +46 -20
- package/dist/tools/fs/program-read-model.js +50 -20
- package/dist/tools/fs/program-read-model.rows.d.ts +0 -14
- package/dist/tools/fs/program-read-model.rows.js +16 -15
- package/dist/tools/fs/read-deny-home.d.ts +33 -47
- package/dist/tools/fs/read-deny-home.js +35 -49
- package/dist/tools/fs/read-deny.d.ts +23 -22
- package/dist/tools/fs/read-deny.js +114 -89
- package/dist/tools/fs/removal-targets.d.ts +56 -23
- package/dist/tools/fs/removal-targets.js +65 -87
- package/dist/tools/fs/safety.d.ts +29 -22
- package/dist/tools/fs/safety.js +17 -11
- package/dist/tools/fs/search.js +10 -8
- package/dist/tools/fs/shell-read-argv.js +1 -1
- package/dist/tools/fs/shell-read-bindings.d.ts +169 -37
- package/dist/tools/fs/shell-read-bindings.js +324 -86
- package/dist/tools/fs/shell-read-builtins.d.ts +35 -0
- package/dist/tools/fs/shell-read-builtins.js +43 -0
- package/dist/tools/fs/shell-read-check.d.ts +15 -1
- package/dist/tools/fs/shell-read-check.js +67 -43
- package/dist/tools/fs/shell-read-establish.js +6 -6
- package/dist/tools/fs/shell-read-functions.d.ts +22 -0
- package/dist/tools/fs/shell-read-functions.js +29 -0
- package/dist/tools/fs/shell-read-judge.d.ts +51 -18
- package/dist/tools/fs/shell-read-judge.js +40 -4
- package/dist/tools/fs/shell-read-plan.d.ts +12 -6
- package/dist/tools/fs/shell-read-plan.js +118 -113
- package/dist/tools/fs/shell-read-start.d.ts +29 -6
- package/dist/tools/fs/shell-read-start.js +16 -9
- package/dist/tools/fs/shell-read-word.js +4 -0
- package/dist/tools/fs/shell-read-workdir.d.ts +156 -0
- package/dist/tools/fs/shell-read-workdir.js +281 -0
- package/dist/tools/fs/shell-read-write-targets.d.ts +5 -2
- package/dist/tools/fs/shell-read-write-targets.js +14 -5
- package/dist/tools/fs/shell-reentry-text.d.ts +4 -6
- package/dist/tools/fs/shell-reentry-text.js +3 -11
- package/dist/tools/task-list.d.ts +1 -2
- package/dist/tools/web.js +1 -1
- package/package.json +4 -1
- package/test/export-surface.snapshot.json +107 -143
- package/wire-changes/core@7.49.0.json +4765 -0
- package/dist/agents/teacher.d.ts +0 -159
- package/dist/agents/teacher.js +0 -577
- package/dist/agents/team.d.ts +0 -226
- package/dist/agents/team.js +0 -257
- package/dist/core/strategy-store.d.ts +0 -238
- package/dist/core/strategy-store.js +0 -253
- package/dist/orchestration/builtin-workflows.d.ts +0 -133
- package/dist/orchestration/builtin-workflows.js +0 -159
- package/dist/scenarios/env.d.ts +0 -40
- package/dist/scenarios/env.js +0 -39
- package/dist/scenarios/scenario-registry.d.ts +0 -110
- package/dist/scenarios/scenario-registry.js +0 -140
- package/dist/scenarios/teacher-quickstart.d.ts +0 -40
- package/dist/scenarios/teacher-quickstart.js +0 -12
- package/dist/stores/cc/lockfile.d.ts +0 -10
- package/dist/stores/cc/lockfile.js +0 -98
- package/dist/stores/cc/mailbox-store.d.ts +0 -20
- package/dist/stores/cc/mailbox-store.js +0 -255
- package/dist/stores/cc/roster-adapter.d.ts +0 -12
- package/dist/stores/cc/roster-adapter.js +0 -117
- package/dist/stores/cc/sidecar-transcript.d.ts +0 -97
- package/dist/stores/cc/sidecar-transcript.js +0 -264
- package/dist/stores/cc/task-list-store.d.ts +0 -2
- package/dist/stores/cc/task-list-store.js +0 -125
- package/dist/stores/file/strategy-store.d.ts +0 -97
- package/dist/stores/file/strategy-store.js +0 -341
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { canonicalize, UNCANONICALIZABLE } from "./canonical-json.js";
|
|
3
|
+
import { CHECKPOINT_FEATURES, checkpointVersionOf, encodeAtFidelity } from "./checkpoint-store.js";
|
|
4
|
+
export const REQUIREMENT_WORDS = Object.freeze([
|
|
5
|
+
"resource",
|
|
6
|
+
"binding",
|
|
7
|
+
"token",
|
|
8
|
+
"orgAdmission",
|
|
9
|
+
"f012",
|
|
10
|
+
"realApproval",
|
|
11
|
+
"face",
|
|
12
|
+
"requirements_digest",
|
|
13
|
+
"org_admission_inherited",
|
|
14
|
+
"org_write_grant",
|
|
15
|
+
"org_governed",
|
|
16
|
+
"delegation_provenance",
|
|
17
|
+
"skill_grants",
|
|
18
|
+
"skill_card_binding",
|
|
19
|
+
"hands_coordinates",
|
|
20
|
+
"hands_home",
|
|
21
|
+
"path_rule_anchors",
|
|
22
|
+
"path_rule_installations",
|
|
23
|
+
"permission_mode",
|
|
24
|
+
"plan_mode_restore",
|
|
25
|
+
"persisted_rule_mandate",
|
|
26
|
+
"deployment_authored",
|
|
27
|
+
"call_names",
|
|
28
|
+
"write_face",
|
|
29
|
+
"denial_limit_fallback",
|
|
30
|
+
"leg_scope",
|
|
31
|
+
"tool_ceiling",
|
|
32
|
+
"tool_lists_judged",
|
|
33
|
+
]);
|
|
34
|
+
export function isRequirementWord(word) {
|
|
35
|
+
return typeof word === "string" && REQUIREMENT_WORDS.includes(word);
|
|
36
|
+
}
|
|
37
|
+
const DECISION_READ = { digest: "decision-read" };
|
|
38
|
+
const STATE_MACHINE = { mutable: "store state-machine member; integrity = CAS contract + kit, see #1580" };
|
|
39
|
+
const FRAME = { ignorable: "the format stamp itself" };
|
|
40
|
+
const SHOWN = { ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts" };
|
|
41
|
+
const RESOURCE_LEDGER_REQUIREMENTS = {
|
|
42
|
+
totalBudgetMicroUsd: DECISION_READ,
|
|
43
|
+
totalTokens: { word: "token" },
|
|
44
|
+
spentMicroUsd: DECISION_READ,
|
|
45
|
+
spentTokens: DECISION_READ,
|
|
46
|
+
spentTurns: SHOWN,
|
|
47
|
+
spentWalltimeMs: SHOWN,
|
|
48
|
+
sliceCount: DECISION_READ,
|
|
49
|
+
};
|
|
50
|
+
export const INHERITED_GATE_REQUIREMENTS = {
|
|
51
|
+
ancestorRules: DECISION_READ,
|
|
52
|
+
shellGate: DECISION_READ,
|
|
53
|
+
permissionMode: { word: "permission_mode" },
|
|
54
|
+
prePlanMode: { word: "plan_mode_restore" },
|
|
55
|
+
admittedOrgScopes: { word: "org_admission_inherited" },
|
|
56
|
+
ownAdmittedOrgScopes: { word: "orgAdmission" },
|
|
57
|
+
ownAdmittedOrgWriteScope: { word: "org_write_grant" },
|
|
58
|
+
orgAdmissionGoverned: { word: "org_governed" },
|
|
59
|
+
pathRuleAnchors: { word: "path_rule_anchors" },
|
|
60
|
+
pathRuleInstallations: { word: "path_rule_installations" },
|
|
61
|
+
requiresParentConstraint: DECISION_READ,
|
|
62
|
+
parentConstraintCount: DECISION_READ,
|
|
63
|
+
constraintChain: { word: "f012" },
|
|
64
|
+
constraintDigest: { word: "f012" },
|
|
65
|
+
};
|
|
66
|
+
export const CHECKPOINT_STATE_REQUIREMENTS = {
|
|
67
|
+
activeTools: DECISION_READ,
|
|
68
|
+
outputRef: DECISION_READ,
|
|
69
|
+
nestedStats: DECISION_READ,
|
|
70
|
+
readFileState: DECISION_READ,
|
|
71
|
+
readFace: { word: "face" },
|
|
72
|
+
writeFace: { word: "write_face" },
|
|
73
|
+
skillGrants: { word: "skill_grants" },
|
|
74
|
+
reminderMark: DECISION_READ,
|
|
75
|
+
repairBundle: DECISION_READ,
|
|
76
|
+
workspaceHandle: DECISION_READ,
|
|
77
|
+
pendingSteerQueue: STATE_MACHINE,
|
|
78
|
+
runningBackgroundTasks: DECISION_READ,
|
|
79
|
+
handsCwd: DECISION_READ,
|
|
80
|
+
handsRoot: { word: "hands_coordinates" },
|
|
81
|
+
handsHome: { word: "hands_home" },
|
|
82
|
+
activeWorktree: DECISION_READ,
|
|
83
|
+
inheritedGate: { members: INHERITED_GATE_REQUIREMENTS },
|
|
84
|
+
announcedListings: SHOWN,
|
|
85
|
+
gitAnnouncement: SHOWN,
|
|
86
|
+
delegationProvenance: { word: "delegation_provenance" },
|
|
87
|
+
isDelegatedChild: DECISION_READ,
|
|
88
|
+
placementRootSessionId: DECISION_READ,
|
|
89
|
+
externalContentTarget: DECISION_READ,
|
|
90
|
+
legScope: { word: "leg_scope" },
|
|
91
|
+
toolCeiling: { word: "tool_ceiling" },
|
|
92
|
+
toolListsJudged: { word: "tool_lists_judged" },
|
|
93
|
+
};
|
|
94
|
+
export const PENDING_ACTION_REQUIREMENTS = {
|
|
95
|
+
tool_approval: {
|
|
96
|
+
kind: { word: "binding" },
|
|
97
|
+
toolCallId: DECISION_READ,
|
|
98
|
+
toolName: DECISION_READ,
|
|
99
|
+
args: DECISION_READ,
|
|
100
|
+
preview: SHOWN,
|
|
101
|
+
previewWithheld: SHOWN,
|
|
102
|
+
ruleOffers: SHOWN,
|
|
103
|
+
ruleOffersAbsence: SHOWN,
|
|
104
|
+
execCwd: DECISION_READ,
|
|
105
|
+
requiresRealApproval: DECISION_READ,
|
|
106
|
+
mandated: { word: "persisted_rule_mandate" },
|
|
107
|
+
authoredBy: { word: "deployment_authored" },
|
|
108
|
+
mandate: DECISION_READ,
|
|
109
|
+
denialLimitFallback: { word: "denial_limit_fallback" },
|
|
110
|
+
classifierNoRuling: DECISION_READ,
|
|
111
|
+
origin: DECISION_READ,
|
|
112
|
+
askClass: DECISION_READ,
|
|
113
|
+
classes: DECISION_READ,
|
|
114
|
+
boundInputHash: DECISION_READ,
|
|
115
|
+
boundGrantDigest: { word: "skill_card_binding" },
|
|
116
|
+
boundGrants: SHOWN,
|
|
117
|
+
capabilityId: DECISION_READ,
|
|
118
|
+
contractId: DECISION_READ,
|
|
119
|
+
shapeDigest: DECISION_READ,
|
|
120
|
+
implementationRevision: DECISION_READ,
|
|
121
|
+
rosterDigest: SHOWN,
|
|
122
|
+
family: DECISION_READ,
|
|
123
|
+
pathTarget: DECISION_READ,
|
|
124
|
+
names: { word: "call_names" },
|
|
125
|
+
hasBidiControls: SHOWN,
|
|
126
|
+
batchToolCallIds: DECISION_READ,
|
|
127
|
+
completedCallIds: SHOWN,
|
|
128
|
+
},
|
|
129
|
+
resource_limit: { kind: DECISION_READ, reason: DECISION_READ },
|
|
130
|
+
review: { kind: DECISION_READ },
|
|
131
|
+
plan_review: { kind: { word: "binding" } },
|
|
132
|
+
task_done: { kind: DECISION_READ },
|
|
133
|
+
};
|
|
134
|
+
export const CHECKPOINT_GATE_REQUIREMENTS = {
|
|
135
|
+
human: { kind: DECISION_READ, reason: DECISION_READ, toolName: DECISION_READ, approvalCard: DECISION_READ, riskDescriptor: SHOWN },
|
|
136
|
+
irreversible_ask: { kind: DECISION_READ, reason: DECISION_READ, toolName: DECISION_READ, approvalCard: DECISION_READ, safetyAxis: SHOWN, realApproval: { word: "realApproval" }, riskDescriptor: SHOWN },
|
|
137
|
+
resource_limit: { kind: { word: "resource" }, reason: DECISION_READ, resumeAfterMs: DECISION_READ },
|
|
138
|
+
needs_review: { kind: DECISION_READ, reason: DECISION_READ },
|
|
139
|
+
plan_review: { kind: DECISION_READ, reason: DECISION_READ },
|
|
140
|
+
task_done: { kind: DECISION_READ },
|
|
141
|
+
};
|
|
142
|
+
export const CHECKPOINT_REQUIREMENTS = {
|
|
143
|
+
token: DECISION_READ,
|
|
144
|
+
checkpointId: SHOWN,
|
|
145
|
+
version: FRAME,
|
|
146
|
+
requires: FRAME,
|
|
147
|
+
requirementsDigest: { word: "requirements_digest" },
|
|
148
|
+
scope: DECISION_READ,
|
|
149
|
+
sessionId: DECISION_READ,
|
|
150
|
+
leafId: DECISION_READ,
|
|
151
|
+
state: { members: CHECKPOINT_STATE_REQUIREMENTS },
|
|
152
|
+
resourceLedger: { members: RESOURCE_LEDGER_REQUIREMENTS },
|
|
153
|
+
deadline: DECISION_READ,
|
|
154
|
+
status: STATE_MACHINE,
|
|
155
|
+
createdAt: DECISION_READ,
|
|
156
|
+
suspendCount: DECISION_READ,
|
|
157
|
+
suspendedAt: SHOWN,
|
|
158
|
+
humanReview: DECISION_READ,
|
|
159
|
+
resolvedOutcome: STATE_MACHINE,
|
|
160
|
+
reopenReason: STATE_MACHINE,
|
|
161
|
+
rev: STATE_MACHINE,
|
|
162
|
+
sourceTaskId: DECISION_READ,
|
|
163
|
+
principal: DECISION_READ,
|
|
164
|
+
durableApproval: DECISION_READ,
|
|
165
|
+
executionOutcome: STATE_MACHINE,
|
|
166
|
+
executionAtMs: { mutable: "the store's time stamp on the execution record: it changes after the mint and decides nothing" },
|
|
167
|
+
gate: { variants: CHECKPOINT_GATE_REQUIREMENTS },
|
|
168
|
+
pendingAction: { variants: PENDING_ACTION_REQUIREMENTS },
|
|
169
|
+
};
|
|
170
|
+
function digestedMembers(record, table, path, out) {
|
|
171
|
+
if (typeof record !== "object" || record === null)
|
|
172
|
+
return;
|
|
173
|
+
for (const [key, cls] of Object.entries(table)) {
|
|
174
|
+
if ("ignorable" in cls || "mutable" in cls)
|
|
175
|
+
continue;
|
|
176
|
+
const value = Reflect.get(record, key);
|
|
177
|
+
if (value === undefined)
|
|
178
|
+
continue;
|
|
179
|
+
const at = path === "" ? key : `${path}.${key}`;
|
|
180
|
+
if ("word" in cls)
|
|
181
|
+
out.push({ path: at, word: cls.word, value });
|
|
182
|
+
else if ("digest" in cls)
|
|
183
|
+
out.push({ path: at, value });
|
|
184
|
+
else if ("members" in cls)
|
|
185
|
+
digestedMembers(value, cls.members, at, out);
|
|
186
|
+
else if ("variants" in cls) {
|
|
187
|
+
const kind = typeof value === "object" && value !== null ? Reflect.get(value, "kind") : undefined;
|
|
188
|
+
const variant = typeof kind === "string" ? Object.entries(cls.variants).find(([k]) => k === kind)?.[1] : undefined;
|
|
189
|
+
if (variant !== undefined)
|
|
190
|
+
digestedMembers(value, variant, at, out);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
const membersOf = (cp) => {
|
|
195
|
+
const out = [];
|
|
196
|
+
digestedMembers(cp, CHECKPOINT_REQUIREMENTS, "", out);
|
|
197
|
+
return out;
|
|
198
|
+
};
|
|
199
|
+
export function checkpointRequirementsFor(cp) {
|
|
200
|
+
return [...new Set(membersOf(cp).flatMap((m) => (m.word !== undefined ? [m.word] : [])))].sort();
|
|
201
|
+
}
|
|
202
|
+
class RowNotEncodable extends Error {
|
|
203
|
+
at;
|
|
204
|
+
constructor(at) {
|
|
205
|
+
super(`${at.path} holds a value the row digest cannot encode (${at.kind})`);
|
|
206
|
+
this.at = at;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
const DIGEST_DEPTH_CAP = 128;
|
|
210
|
+
function digestProjection(value, path, depth, open) {
|
|
211
|
+
if (typeof value === "function")
|
|
212
|
+
throw new RowNotEncodable({ path, kind: "function" });
|
|
213
|
+
if (typeof value === "symbol")
|
|
214
|
+
throw new RowNotEncodable({ path, kind: "symbol" });
|
|
215
|
+
if (typeof value !== "object" || value === null)
|
|
216
|
+
return value;
|
|
217
|
+
if (depth >= DIGEST_DEPTH_CAP)
|
|
218
|
+
throw new RowNotEncodable({ path, kind: "depth" });
|
|
219
|
+
if (open.has(value))
|
|
220
|
+
throw new RowNotEncodable({ path, kind: "cycle" });
|
|
221
|
+
if (ArrayBuffer.isView(value))
|
|
222
|
+
return value;
|
|
223
|
+
open.add(value);
|
|
224
|
+
try {
|
|
225
|
+
if (Array.isArray(value))
|
|
226
|
+
return value.map((el, i) => digestProjection(el, `${path}[${i}]`, depth + 1, open));
|
|
227
|
+
if (value instanceof Map)
|
|
228
|
+
for (const [k, v] of value)
|
|
229
|
+
(digestProjection(k, `${path}<key>`, depth + 1, open), digestProjection(v, `${path}<value>`, depth + 1, open));
|
|
230
|
+
else if (value instanceof Set)
|
|
231
|
+
for (const v of value)
|
|
232
|
+
digestProjection(v, `${path}<member>`, depth + 1, open);
|
|
233
|
+
const plain = Object.prototype.toString.call(value) === "[object Object]";
|
|
234
|
+
const out = Object.create(null);
|
|
235
|
+
for (const key of Object.keys(value)) {
|
|
236
|
+
const v = value[key];
|
|
237
|
+
const projected = digestProjection(v, `${path}.${key}`, depth + 1, open);
|
|
238
|
+
if (plain)
|
|
239
|
+
out[key] = projected;
|
|
240
|
+
}
|
|
241
|
+
return plain ? out : value;
|
|
242
|
+
}
|
|
243
|
+
catch (e) {
|
|
244
|
+
if (e instanceof RowNotEncodable)
|
|
245
|
+
throw e;
|
|
246
|
+
throw new RowNotEncodable({ path, kind: "unreadable" });
|
|
247
|
+
}
|
|
248
|
+
finally {
|
|
249
|
+
open.delete(value);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
export function unencodableIn(value, path) {
|
|
253
|
+
try {
|
|
254
|
+
digestProjection(value, path, 1, new Set());
|
|
255
|
+
return undefined;
|
|
256
|
+
}
|
|
257
|
+
catch (e) {
|
|
258
|
+
if (e instanceof RowNotEncodable)
|
|
259
|
+
return e.at;
|
|
260
|
+
throw e;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
export function requirementsDigestOf(cp) {
|
|
264
|
+
const held = Object.create(null);
|
|
265
|
+
const open = new Set();
|
|
266
|
+
for (const m of membersOf(cp))
|
|
267
|
+
if (m.path !== "requirementsDigest")
|
|
268
|
+
held[m.path] = digestProjection(m.value, m.path, 1, open);
|
|
269
|
+
const canonical = canonicalize(held);
|
|
270
|
+
if (canonical === UNCANONICALIZABLE)
|
|
271
|
+
throw new RowNotEncodable({ path: "(row)", kind: "unreadable" });
|
|
272
|
+
return createHash("sha256").update(canonical, "utf8").digest("hex");
|
|
273
|
+
}
|
|
274
|
+
function digestOrUnencodable(cp) {
|
|
275
|
+
try {
|
|
276
|
+
return { digest: requirementsDigestOf(cp) };
|
|
277
|
+
}
|
|
278
|
+
catch (e) {
|
|
279
|
+
if (e instanceof RowNotEncodable)
|
|
280
|
+
return { at: e.at };
|
|
281
|
+
throw e;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
const unencodableWhy = (at) => `a member a decision reads cannot be encoded: ${at.path} (${at.kind})`;
|
|
285
|
+
export function stampCheckpointRequirements(row, fidelity) {
|
|
286
|
+
const { requirementsDigest: _stale, ...framed } = { ...row, version: CHECKPOINT_FEATURES.requirements.version };
|
|
287
|
+
const stored = encodeAtFidelity(fidelity, framed);
|
|
288
|
+
const held = (stored.ok ? stored.value : framed);
|
|
289
|
+
const got = stored.ok ? digestOrUnencodable(held) : { at: { path: "(row)", kind: "codec" } };
|
|
290
|
+
const digested = "digest" in got ? { ...held, requirementsDigest: got.digest } : held;
|
|
291
|
+
return { ...digested, requires: checkpointRequirementsFor(digested) };
|
|
292
|
+
}
|
|
293
|
+
export function judgeAsStored(cp, fidelity) {
|
|
294
|
+
const stored = encodeAtFidelity(fidelity, cp);
|
|
295
|
+
return stored.ok ? judgeCheckpointRequirements(stored.value) : { kind: "damaged", why: unencodableWhy({ path: "(row)", kind: "codec" }) };
|
|
296
|
+
}
|
|
297
|
+
export function judgeCheckpointRequirements(cp) {
|
|
298
|
+
const version = checkpointVersionOf(cp);
|
|
299
|
+
const declared = Reflect.get(cp, "requires");
|
|
300
|
+
const digest = Reflect.get(cp, "requirementsDigest");
|
|
301
|
+
if (version < CHECKPOINT_FEATURES.requirements.version)
|
|
302
|
+
return declared === undefined && digest === undefined ? { kind: "ok" } : { kind: "damaged", why: `a v${version} row carries a requirement list or digest no release of that version wrote` };
|
|
303
|
+
if (!Array.isArray(declared))
|
|
304
|
+
return { kind: "damaged", why: declared === undefined ? "the v10 row carries no requirement list" : "the requirement list is not a list" };
|
|
305
|
+
const said = [];
|
|
306
|
+
const items = declared;
|
|
307
|
+
for (const word of items) {
|
|
308
|
+
if (typeof word !== "string")
|
|
309
|
+
return { kind: "damaged", why: "the requirement list holds a value that is not a word" };
|
|
310
|
+
said.push(word);
|
|
311
|
+
}
|
|
312
|
+
const lacking = [...new Set(said.filter((w) => !isRequirementWord(w)))].sort();
|
|
313
|
+
if (lacking.length > 0)
|
|
314
|
+
return { kind: "lacking", words: lacking };
|
|
315
|
+
const declaredSet = new Set(said);
|
|
316
|
+
if (!declaredSet.has("requirements_digest")) {
|
|
317
|
+
const got = digestOrUnencodable(cp);
|
|
318
|
+
return { kind: "damaged", why: "at" in got ? unencodableWhy(got.at) : "the v10 row declares no content digest" };
|
|
319
|
+
}
|
|
320
|
+
const carried = checkpointRequirementsFor(cp);
|
|
321
|
+
const undeclared = carried.filter((w) => !declaredSet.has(w));
|
|
322
|
+
const unbacked = [...declaredSet].filter((w) => !carried.includes(w)).sort();
|
|
323
|
+
if (undeclared.length > 0 || unbacked.length > 0) {
|
|
324
|
+
return {
|
|
325
|
+
kind: "damaged",
|
|
326
|
+
why: [unbacked.length > 0 ? `declared but not on the row: ${unbacked.join(", ")}` : "", undeclared.length > 0 ? `on the row but not declared: ${undeclared.join(", ")}` : ""].filter((s) => s !== "").join("; "),
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
const got = digestOrUnencodable(cp);
|
|
330
|
+
if ("at" in got)
|
|
331
|
+
return { kind: "damaged", why: unencodableWhy(got.at) };
|
|
332
|
+
return digest === got.digest ? { kind: "ok" } : { kind: "damaged", why: "the members a decision reads do not match the row's content digest" };
|
|
333
|
+
}
|