@sema-agent/core 7.47.0 → 7.49.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 +472 -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 +39 -32
- package/dist/core/arg-summary.d.ts +17 -24
- package/dist/core/arg-summary.js +169 -68
- 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 +95 -66
- 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 +32 -7
- 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 +4 -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-server-spec.d.ts +1 -1
- 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/park-commit.d.ts +1 -1
- 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 +27 -34
- 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/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/safety-axis-vocab.d.ts +1 -1
- package/dist/core/safety-merge-corpus.d.ts +1 -1
- 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-policy-store.d.ts +6 -3
- package/dist/core/session-policy-store.js +28 -10
- 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-table.d.ts +2 -2
- package/dist/core/shell-wrapper-table.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 +35 -10
- package/dist/core/tool-name-aliases.js +15 -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 -381
- 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 +191 -119
- package/dist/prompt-assembly/types.d.ts +1 -1
- package/dist/scenarios/full-body.d.ts +1 -1
- package/dist/shell/lex.d.ts +0 -21
- package/dist/shell/lex.js +278 -70
- 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 +17 -3
- package/dist/tools/fs/bash-program-position.js +25 -10
- 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 +3 -2
- package/dist/tools/fs/index.js +2 -2
- package/dist/tools/fs/program-read-model.d.ts +99 -23
- package/dist/tools/fs/program-read-model.js +129 -55
- package/dist/tools/fs/program-read-model.rows.d.ts +0 -14
- package/dist/tools/fs/program-read-model.rows.js +18 -10
- package/dist/tools/fs/read-deny-home.d.ts +35 -30
- package/dist/tools/fs/read-deny-home.js +45 -38
- package/dist/tools/fs/read-deny.d.ts +35 -27
- package/dist/tools/fs/read-deny.js +126 -92
- package/dist/tools/fs/removal-targets.d.ts +56 -23
- package/dist/tools/fs/removal-targets.js +74 -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.d.ts +4 -7
- package/dist/tools/fs/shell-read-argv.js +6 -8
- package/dist/tools/fs/shell-read-bindings.d.ts +203 -46
- package/dist/tools/fs/shell-read-bindings.js +488 -144
- 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 +51 -42
- package/dist/tools/fs/shell-read-establish.js +9 -10
- 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 +48 -18
- package/dist/tools/fs/shell-read-judge.js +33 -4
- package/dist/tools/fs/shell-read-plan.d.ts +13 -20
- package/dist/tools/fs/shell-read-plan.js +200 -194
- package/dist/tools/fs/shell-read-start.d.ts +80 -0
- package/dist/tools/fs/shell-read-start.js +99 -0
- package/dist/tools/fs/shell-read-word.d.ts +35 -6
- package/dist/tools/fs/shell-read-word.js +89 -9
- 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 +26 -26
- package/dist/tools/fs/shell-reentry-text.js +31 -34
- 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.48.0.json +252 -0
- 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,219 @@
|
|
|
1
|
+
import { TOOL_SPEC_MEMBERS, frozenExtra, frozenMember, newCopyState } from "../tool-spec-members.js";
|
|
2
|
+
import { isDefineToolProduct, rebindDefineToolCtx } from "../tools.js";
|
|
3
|
+
function specArmCanConstruct(t) {
|
|
4
|
+
if (typeof t !== "object" || t === null)
|
|
5
|
+
return false;
|
|
6
|
+
const name = Object.getOwnPropertyDescriptor(t, "name");
|
|
7
|
+
const execute = Object.getOwnPropertyDescriptor(t, "execute");
|
|
8
|
+
return name !== undefined && "value" in name && typeof name.value === "string" && name.enumerable === true && execute !== undefined && "value" in execute && typeof execute.value === "function" && execute.enumerable === true;
|
|
9
|
+
}
|
|
10
|
+
const ORIGIN = new WeakMap();
|
|
11
|
+
export function callerEntryOrigin(entry) {
|
|
12
|
+
return ORIGIN.get(entry) ?? entry;
|
|
13
|
+
}
|
|
14
|
+
const PRODUCT_OF = new WeakMap();
|
|
15
|
+
const IS_MEMBER = new Set(TOOL_SPEC_MEMBERS);
|
|
16
|
+
function faceKeys(t) {
|
|
17
|
+
const keys = new Set(Reflect.ownKeys(t).filter((k) => Object.getOwnPropertyDescriptor(t, k)?.enumerable === true));
|
|
18
|
+
for (const name of TOOL_SPEC_MEMBERS)
|
|
19
|
+
keys.add(name);
|
|
20
|
+
return [...keys];
|
|
21
|
+
}
|
|
22
|
+
const BUILDABLE = new WeakSet();
|
|
23
|
+
export function specArmCanBuild(entry) {
|
|
24
|
+
return BUILDABLE.has(entry);
|
|
25
|
+
}
|
|
26
|
+
const entryName = (t) => {
|
|
27
|
+
try {
|
|
28
|
+
const name = t !== null && (typeof t === "object" || typeof t === "function") ? Object.getOwnPropertyDescriptor(t, "name")?.value : undefined;
|
|
29
|
+
return typeof name === "string" ? JSON.stringify(name) : "(no own name)";
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
return "(no readable name)";
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
function refuseUnreadableEntry(index, entry, cause) {
|
|
36
|
+
let said = "";
|
|
37
|
+
try {
|
|
38
|
+
said = cause instanceof Error ? cause.message.slice(0, 120) : "";
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
}
|
|
42
|
+
const e = new Error(`spec.tools[${index}] ${entryName(entry)}: its members could not be read${said === "" ? "" : ` (${said})`} — the run fixes its tool roster by reading each entry once, before its first await, and an entry that cannot be read is not a tool. Pass a tool whose declaration reads without throwing.`);
|
|
43
|
+
e.code = "config.tool_mount_denied";
|
|
44
|
+
throw e;
|
|
45
|
+
}
|
|
46
|
+
export function rosterFaceOf(t, index) {
|
|
47
|
+
if ((typeof t !== "object" && typeof t !== "function") || t === null)
|
|
48
|
+
return t;
|
|
49
|
+
try {
|
|
50
|
+
const product = isDefineToolProduct(t) ? t : undefined;
|
|
51
|
+
const buildable = product === undefined && specArmCanConstruct(t);
|
|
52
|
+
const source = t;
|
|
53
|
+
const face = {};
|
|
54
|
+
const ledger = newCopyState();
|
|
55
|
+
for (const key of faceKeys(source)) {
|
|
56
|
+
const own = Object.prototype.hasOwnProperty.call(source, key);
|
|
57
|
+
const value = source[key];
|
|
58
|
+
if (value === undefined && !own)
|
|
59
|
+
continue;
|
|
60
|
+
let kept;
|
|
61
|
+
if (typeof key === "string" && IS_MEMBER.has(key))
|
|
62
|
+
kept = frozenMember(key, value, ledger);
|
|
63
|
+
else {
|
|
64
|
+
const extra = frozenExtra(String(key), value, ledger);
|
|
65
|
+
if (!extra.kept)
|
|
66
|
+
continue;
|
|
67
|
+
kept = extra.value;
|
|
68
|
+
}
|
|
69
|
+
Object.defineProperty(face, key, { value: kept, enumerable: true, writable: true, configurable: true });
|
|
70
|
+
}
|
|
71
|
+
ORIGIN.set(face, source);
|
|
72
|
+
if (product !== undefined)
|
|
73
|
+
PRODUCT_OF.set(face, product);
|
|
74
|
+
else if (buildable && specArmCanConstruct(face))
|
|
75
|
+
BUILDABLE.add(face);
|
|
76
|
+
return Object.freeze(face);
|
|
77
|
+
}
|
|
78
|
+
catch (cause) {
|
|
79
|
+
return refuseEntry(index, t, cause);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
function refuseEntry(index, entry, cause) {
|
|
83
|
+
let refusal;
|
|
84
|
+
try {
|
|
85
|
+
if (cause instanceof Error && cause.code === "config.tool_mount_denied")
|
|
86
|
+
refusal = cause.message;
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
}
|
|
90
|
+
if (refusal === undefined)
|
|
91
|
+
return refuseUnreadableEntry(index, entry, cause);
|
|
92
|
+
const e = new Error(`spec.tools[${index}] ${entryName(entry)}: ${refusal}`);
|
|
93
|
+
e.code = "config.tool_mount_denied";
|
|
94
|
+
throw e;
|
|
95
|
+
}
|
|
96
|
+
function sameMember(was, now, ledger, depth = 0) {
|
|
97
|
+
if (Object.is(was, now))
|
|
98
|
+
return true;
|
|
99
|
+
if (depth > 64 || typeof was !== "object" || typeof now !== "object" || was === null || now === null)
|
|
100
|
+
return false;
|
|
101
|
+
const met = ledger.pairs.get(was);
|
|
102
|
+
if (met?.has(now) === true)
|
|
103
|
+
return true;
|
|
104
|
+
if (met === undefined)
|
|
105
|
+
ledger.pairs.set(was, new WeakSet([now]));
|
|
106
|
+
else
|
|
107
|
+
met.add(now);
|
|
108
|
+
try {
|
|
109
|
+
if (Array.isArray(was) !== Array.isArray(now))
|
|
110
|
+
return false;
|
|
111
|
+
const a = Reflect.ownKeys(was), b = Reflect.ownKeys(now);
|
|
112
|
+
if (a.length !== b.length)
|
|
113
|
+
return false;
|
|
114
|
+
ledger.steps += a.length + 1;
|
|
115
|
+
if (ledger.steps > COMPARE_STEPS) {
|
|
116
|
+
ledger.over = true;
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
for (const key of a) {
|
|
120
|
+
const x = Object.getOwnPropertyDescriptor(was, key), y = Object.getOwnPropertyDescriptor(now, key);
|
|
121
|
+
if (x === undefined || y === undefined || !("value" in x) || !("value" in y) || !sameMember(x.value, y.value, ledger, depth + 1))
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
catch {
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
const COMPARE_STEPS = 20_000;
|
|
131
|
+
function shown(v) {
|
|
132
|
+
if (v === undefined || typeof v === "boolean" || typeof v === "number")
|
|
133
|
+
return String(v);
|
|
134
|
+
if (typeof v === "string")
|
|
135
|
+
return JSON.stringify(v.length > 60 ? `${v.slice(0, 60)}…` : v);
|
|
136
|
+
try {
|
|
137
|
+
if (Array.isArray(v) && v.length <= 8 && v.every((x) => typeof x === "string"))
|
|
138
|
+
return `[${v.map((x) => shown(x)).join(", ")}]`;
|
|
139
|
+
}
|
|
140
|
+
catch {
|
|
141
|
+
}
|
|
142
|
+
return undefined;
|
|
143
|
+
}
|
|
144
|
+
function refuseProductDrift(face, rebound) {
|
|
145
|
+
const was = face;
|
|
146
|
+
const now = rebound;
|
|
147
|
+
const keys = new Set([...Reflect.ownKeys(face), ...faceKeys(rebound)]);
|
|
148
|
+
keys.delete("execute");
|
|
149
|
+
const driftProblems = [];
|
|
150
|
+
const ledger = { pairs: new WeakMap(), steps: 0, over: false };
|
|
151
|
+
for (const key of keys) {
|
|
152
|
+
let after;
|
|
153
|
+
try {
|
|
154
|
+
after = now[key];
|
|
155
|
+
}
|
|
156
|
+
catch {
|
|
157
|
+
driftProblems.push(`${String(key)} (unreadable)`);
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
if (sameMember(was[key], after, ledger))
|
|
161
|
+
continue;
|
|
162
|
+
const before = shown(was[key]), later = shown(after);
|
|
163
|
+
driftProblems.push(ledger.over ? `${String(key)} (declaration comparison over budget)` : before !== undefined && later !== undefined ? `${String(key)} (${before} → ${later})` : `${String(key)} (differs)`);
|
|
164
|
+
if (ledger.over)
|
|
165
|
+
break;
|
|
166
|
+
}
|
|
167
|
+
if (driftProblems.length === 0)
|
|
168
|
+
return;
|
|
169
|
+
const e = new Error(`defineTool product ${entryName(face)} changed after the run fixed its tool roster (before its first await): ${driftProblems.join(", ")}. The safety scan judged the product as it stood then, so a product that no longer matches is never mounted — not under its new name, not under the old one. Pass the final product before starting the run.`);
|
|
170
|
+
e.code = "config.tool_mount_denied";
|
|
171
|
+
throw e;
|
|
172
|
+
}
|
|
173
|
+
function mountedProduct(face, rebound) {
|
|
174
|
+
const members = {};
|
|
175
|
+
for (const key of Reflect.ownKeys(face))
|
|
176
|
+
members[key] = { value: face[key], enumerable: true };
|
|
177
|
+
members.execute = { value: rebound.execute.bind(rebound), enumerable: true };
|
|
178
|
+
return Object.freeze(Object.create(Object.prototype, members));
|
|
179
|
+
}
|
|
180
|
+
export function rebindProductEntry(entry, enrich) {
|
|
181
|
+
const product = PRODUCT_OF.get(entry);
|
|
182
|
+
if (product === undefined)
|
|
183
|
+
return undefined;
|
|
184
|
+
const rebound = rebindDefineToolCtx(product, enrich);
|
|
185
|
+
refuseProductDrift(entry, rebound);
|
|
186
|
+
return mountedProduct(entry, rebound);
|
|
187
|
+
}
|
|
188
|
+
export function snapshotCallerRoster(spec) {
|
|
189
|
+
const tools = spec.tools;
|
|
190
|
+
const descriptors = Object.getOwnPropertyDescriptors(spec);
|
|
191
|
+
const handed = Array.isArray(tools) ? Object.freeze([...tools]) : undefined;
|
|
192
|
+
const slot = handed !== undefined ? Object.freeze(handed.map((t, i) => rosterFaceOf(t, i))) : tools;
|
|
193
|
+
descriptors.tools = { value: slot, enumerable: slot !== undefined, writable: false, configurable: false };
|
|
194
|
+
const copy = Object.create(Object.getPrototypeOf(spec), descriptors);
|
|
195
|
+
return { spec: copy, roster: { caller: spec, handed: tools === undefined ? Object.freeze([]) : handed } };
|
|
196
|
+
}
|
|
197
|
+
export function refuseLateRosterChanges(roster) {
|
|
198
|
+
const { handed } = roster;
|
|
199
|
+
if (handed === undefined)
|
|
200
|
+
return;
|
|
201
|
+
const current = roster.caller.tools;
|
|
202
|
+
const now = current === undefined ? [] : Array.isArray(current) ? current : throwChanged([`spec.tools (reassigned to a value that is not an array)`]);
|
|
203
|
+
const changed = [];
|
|
204
|
+
for (let i = 0; i < Math.max(now.length, handed.length); i++) {
|
|
205
|
+
if (now[i] === handed[i])
|
|
206
|
+
continue;
|
|
207
|
+
if (i < now.length)
|
|
208
|
+
changed.push(`${entryName(now[i])} (${i < handed.length ? "replaced" : "added"})`);
|
|
209
|
+
else
|
|
210
|
+
changed.push(`${entryName(handed[i])} (removed)`);
|
|
211
|
+
}
|
|
212
|
+
if (changed.length > 0)
|
|
213
|
+
throwChanged(changed);
|
|
214
|
+
}
|
|
215
|
+
function throwChanged(changed) {
|
|
216
|
+
const e = new Error(`spec.tools changed after the run fixed its tool roster: ${changed.join(", ")}. The roster is the one the request carried when the run started (before its first await) — the scan that judges each tool's effect and marks and the mount read that one copy, so a later entry is never mounted. Pass the complete roster before starting the run.`);
|
|
217
|
+
e.code = "config.tool_mount_denied";
|
|
218
|
+
throw e;
|
|
219
|
+
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The durable-suspend checkpoint ROW-IDENTITY vocabulary — the default isolation scope, the ONE derivation of a row's
|
|
3
3
|
* scope, and the ONE reading of the placement fields' empty string — moved whole out of the orchestrator so the
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* string functions.
|
|
4
|
+
* park-lane phases (the suspend stamp), the driver (the leg's scope, derived once and handed to every mint lane; the
|
|
5
|
+
* restore fold) and runtask (the resume rung) reach DOWN for the same names. Pure: a constant and two string functions.
|
|
7
6
|
*/
|
|
8
7
|
/** The multi-tenant scope used when a durable suspend fires for an IRREVERSIBLE tool in an
|
|
9
8
|
* unattended deployment that did NOT opt into `durableApproval` (so there is no caller-supplied scope). The
|
|
@@ -12,26 +11,27 @@
|
|
|
12
11
|
* unattended irreversible suspend auditable as such. */
|
|
13
12
|
export declare const DEFAULT_IRREVERSIBLE_SCOPE = "irreversible";
|
|
14
13
|
/**
|
|
15
|
-
* The SINGLE derivation of a durable-suspend checkpoint's scope
|
|
16
|
-
*
|
|
17
|
-
* that drifted was the exact bug the park tests caught
|
|
18
|
-
* no-ops).
|
|
14
|
+
* The SINGLE derivation of a durable-suspend checkpoint's scope — the LEG's scope, computed once per prepare and
|
|
15
|
+
* read by every mint lane of that leg (approval park, resource and `plan_review` parks, the forceDurableGate
|
|
16
|
+
* synthesis) and by its children; a re-derived copy that drifted was the exact bug the park tests caught (expire
|
|
17
|
+
* against the wrong scope silently no-ops). `seat` is the scope the leg was already given: on a spawn lane the
|
|
18
|
+
* PARENT leg's (`RunInternals.checkpointScope`) — a child's rows land where its parent's do, which the child's own
|
|
19
|
+
* spec cannot say, since the synchronous lane does not carry the parent's `durableApproval` (it would also arm the
|
|
20
|
+
* child's plain asks to park); on a resume that hands no seat, the leg's own recorded scope
|
|
21
|
+
* (`CheckpointState.legScope`), so the resume config cannot move it. The seat moves the scope and nothing else. A
|
|
22
|
+
* root leg's first prepare has no seat.
|
|
19
23
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* where `listByScope("")` reads BOTH their pending approvals — including each summary's `toolInput`
|
|
25
|
-
* preview of the raw arguments — and `reap("")` / `resolve(token, "")` act across both. `durableApproval.
|
|
26
|
-
* scope` is documented as "Multi-tenant isolation key … Required"; a blank string is the absence of an
|
|
27
|
-
* isolation key wearing its clothes, so both halves now fall through to the default isolation scope.
|
|
24
|
+
* `||` on EVERY rung (not `??`): a blank string — a config-centre / env lookup that came back empty is the
|
|
25
|
+
* realistic source — is the absence of an isolation key wearing its clothes. Kept as a literal `""` it would be
|
|
26
|
+
* one bucket for every tenant that hit it: `listByScope("")` reads all their pending approvals (with each
|
|
27
|
+
* summary's `toolInput` preview) and `reap("")` / `resolve(token, "")` act across all of them.
|
|
28
28
|
*/
|
|
29
29
|
export declare function checkpointScopeOf(spec: {
|
|
30
30
|
durableApproval?: {
|
|
31
31
|
scope?: string;
|
|
32
32
|
};
|
|
33
33
|
principal?: string;
|
|
34
|
-
}): string;
|
|
34
|
+
}, seat?: string): string;
|
|
35
35
|
/**
|
|
36
36
|
* The ONE spelling of the placement fields' empty-string discipline: `""` is absence
|
|
37
37
|
* wearing clothes (the resume entry's principal-rung posture), and every placement read that must
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const DEFAULT_IRREVERSIBLE_SCOPE = "irreversible";
|
|
2
|
-
export function checkpointScopeOf(spec) {
|
|
3
|
-
return spec.durableApproval?.scope || spec.principal || DEFAULT_IRREVERSIBLE_SCOPE;
|
|
2
|
+
export function checkpointScopeOf(spec, seat) {
|
|
3
|
+
return seat || spec.durableApproval?.scope || spec.principal || DEFAULT_IRREVERSIBLE_SCOPE;
|
|
4
4
|
}
|
|
5
5
|
export function placementValueOrAbsent(value) {
|
|
6
6
|
return value || undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isRemoteExecutionEnv } from "../remote-env.js";
|
|
2
|
-
import {
|
|
2
|
+
import { validatePath } from "../effective-path-target.js";
|
|
3
3
|
import { installPolicyAnchors, installationAnchorsOf, installedFrom } from "../path-rule-binding.js";
|
|
4
4
|
import { CheckpointError } from "../checkpoint-store.js";
|
|
5
5
|
export function deploymentCanRerootChild(deps) {
|
|
@@ -37,7 +37,7 @@ function recordedAnchors(r, rebase) {
|
|
|
37
37
|
if (typeof v !== "string")
|
|
38
38
|
return undefined;
|
|
39
39
|
const p = rebase(v);
|
|
40
|
-
return
|
|
40
|
+
return validatePath(p, { intent: "validate-coordinate" });
|
|
41
41
|
};
|
|
42
42
|
const [root, home] = [read(r.root), read(r.home)];
|
|
43
43
|
return { ...(root !== undefined ? { root } : {}), ...(home !== undefined ? { home } : {}) };
|
|
@@ -64,15 +64,27 @@ import type { BlockedRef, OutputRef, SkillListingEntry } from "./synthetic-tools
|
|
|
64
64
|
import type { createAttachmentState, WriteFamily } from "./turn-attachments.js";
|
|
65
65
|
import type { cacheFamilyOf } from "./usage-accounting.js";
|
|
66
66
|
/**
|
|
67
|
-
* The frozen task-start
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* is a sideways dependency wearing a type's clothes.
|
|
67
|
+
* The frozen task-start copies of the caller's tool-face control arrays, as the config-doors phase takes them (synchronously,
|
|
68
|
+
* before the first await): the selector's own layer (`allow` / `exclude`) and the disclosure lists. The driver compiles the
|
|
69
|
+
* selector from them once the leg's delegation facts are known ({@link ToolFaceSnapshot}).
|
|
71
70
|
*/
|
|
72
|
-
export interface
|
|
71
|
+
export interface ToolFaceLists {
|
|
72
|
+
allow: readonly string[] | undefined;
|
|
73
73
|
exclude: readonly string[] | undefined;
|
|
74
74
|
defer: readonly string[] | undefined;
|
|
75
75
|
alwaysLoad: readonly string[] | undefined;
|
|
76
|
+
restoreGated: readonly string[] | true | undefined;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* The leg's tool face: its compiled tool selector (the ONE answer to "may this run use this tool" — the roster valve, every
|
|
80
|
+
* "is X available" mount decision, the MCP refresh and re-dial, the deferred-search lane, and the ceiling every child inherits)
|
|
81
|
+
* and the frozen disclosure lists. Named here rather than reached for through a phase's Result — an indexed access into a
|
|
82
|
+
* sibling phase's Result is a sideways dependency wearing a type's clothes.
|
|
83
|
+
*/
|
|
84
|
+
export interface ToolFaceSnapshot {
|
|
85
|
+
selector: import("../tool-face.js").ToolSelector;
|
|
86
|
+
defer: readonly string[] | undefined;
|
|
87
|
+
alwaysLoad: readonly string[] | undefined;
|
|
76
88
|
/** The model-gate restore selector ({@link TaskSpec.restoreGatedTools}), fourth
|
|
77
89
|
* seat of the same frozen task-start snapshot: the gate decision and the delegation carrier
|
|
78
90
|
* read THIS, never the live spec. */
|
|
@@ -326,23 +338,17 @@ export interface Prepared {
|
|
|
326
338
|
* emits; the tool_result-side delete in prepare-task never fires for immediate results). */
|
|
327
339
|
blockedToolCalls: Set<string>;
|
|
328
340
|
/**
|
|
329
|
-
*
|
|
330
|
-
*
|
|
331
|
-
*
|
|
332
|
-
*
|
|
341
|
+
* The leg's tool-call OCCURRENCES (`tool-occurrence.ts`): one record per call attempt, the only holder of what
|
|
342
|
+
* the engine knows about a call in flight — its start frame, its gate rounds (the gate's exit record and any
|
|
343
|
+
* refusal after it), its wait on the person, its heartbeat clocks. Every frame of the call, the heartbeat, the
|
|
344
|
+
* trace row and the resumed leg's execution record read it; a call leaves it when its end frame is minted.
|
|
333
345
|
*
|
|
334
|
-
*
|
|
335
|
-
*
|
|
336
|
-
*
|
|
337
|
-
*
|
|
338
|
-
* It is a sideband and not a field on the tool RESULT because a result is not a trustworthy carrier
|
|
339
|
-
* for this: `details` is arbitrary tool-authored data that post-tool hooks may also replace, so a
|
|
340
|
-
* failing tool could stamp a settlement on itself and tell a consumer's audit view that a person
|
|
341
|
-
* approved something nobody was ever shown. Provenance has to travel on a channel only the
|
|
342
|
-
* adjudicating layer can write. Same reason the entries are keyed by CALL id: the gate adjudicated
|
|
343
|
-
* that exact call, and the frame that reads it is that call's own.
|
|
346
|
+
* An engine-owned seat and not a field on the tool RESULT because a result is not a trustworthy carrier: its
|
|
347
|
+
* `details` is tool-authored and replaceable by post-tool hooks, so provenance read from it would let a failing
|
|
348
|
+
* tool claim a person approved it. Writers: the announcing stations, the gate station, the shell read
|
|
349
|
+
* admission, the resumed leg's belts; the end projection closes the record.
|
|
344
350
|
*/
|
|
345
|
-
|
|
351
|
+
toolOccurrences: import("./tool-occurrence.js").ToolOccurrenceTable;
|
|
346
352
|
/**
|
|
347
353
|
* The parent-thread human-rejection halt fact (see `maybeHumanRejectionHalt`): present from the
|
|
348
354
|
* moment a bare human rejection halts the turn's batch until the run ends or the NEXT provider
|
|
@@ -404,6 +410,8 @@ export interface Prepared {
|
|
|
404
410
|
};
|
|
405
411
|
/** The run's advertised-writable-directory seat (present with hands): `roots` is what the prompt advertised as writable and the fence admitted. Read live wherever a policy is adjudicated off a resumed leg, so the write gate's exemption domain is that same list. */
|
|
406
412
|
advertisedWritableDirs?: Pick<import("./advertised-writable-dirs.js").AdvertisedWritableDirs, "roots">;
|
|
413
|
+
/** The leg's ONE exempt root (its single resolution of `RunnerDeps.memoryEngineDir`), stamped wherever a policy is adjudicated off a resumed leg (`ToolCallRequest.exemptRoots`) — the same list the live gate stamps. */
|
|
414
|
+
exemptRoots: readonly string[];
|
|
407
415
|
/** The ACTIVE EnterWorktree session ref (mounted with the worktree tools; undefined without
|
|
408
416
|
* real write hands). runtask's settle write reads `current` for the workspace-state entry. */
|
|
409
417
|
worktreeSessionRef?: {
|
|
@@ -1608,6 +1616,30 @@ export interface PromptFeatureFlags {
|
|
|
1608
1616
|
* await latch is a separate, pinned guarantee (prepare-task-phase-pins T1).
|
|
1609
1617
|
*/
|
|
1610
1618
|
export interface RunInternals {
|
|
1619
|
+
/**
|
|
1620
|
+
* The MCP connection pool of this leg's run tree (a delegation tool hands its own down to every child that inherits its MCP
|
|
1621
|
+
* mount; the root run creates it). A leg that declares a server leases the connection from it instead of dialling a copy, and
|
|
1622
|
+
* releases the lease when its materialization is disposed — see `mcp-connection-pool.ts`. Trusted, never a TaskSpec field.
|
|
1623
|
+
*/
|
|
1624
|
+
mcpPool?: import("../mcp-connection-pool.js").McpConnectionPool;
|
|
1625
|
+
/**
|
|
1626
|
+
* The tool-selector layers of the run that spawned this leg — its ceiling ({@link ToolFaceSnapshot.selector}`.layers`): this
|
|
1627
|
+
* leg's selector is these layers plus its own `allowTools` / `excludeTools`, so nothing a child names can widen what its
|
|
1628
|
+
* parent could use. Present on every leg an engine lane spawns (an empty list when the parent was unbounded). Trusted, never a
|
|
1629
|
+
* TaskSpec field.
|
|
1630
|
+
*/
|
|
1631
|
+
toolCeiling?: readonly import("../tool-face.js").ToolSelectorLayer[];
|
|
1632
|
+
/** Set by the delegation lane when the spawning run's prepare judged this leg's own tool lists (its spec's `allowTools` /
|
|
1633
|
+
* `excludeTools` — a definition's or the delegation tool's) where they were mounted: their digest (`toolListsDigest`), the evidence
|
|
1634
|
+
* bound to exactly those lists. A prepare whose own lists digest to it does not judge them again against its own, narrower universe,
|
|
1635
|
+
* and its rows record it (`CheckpointState.toolListsJudged`) so a resume that hands no internals keeps the judgment. Absent (a
|
|
1636
|
+
* workflow agent, a team member, a host's direct `runTask`), or lists that digest differently ⇒ the leg judges its own lists. */
|
|
1637
|
+
toolListsJudged?: string;
|
|
1638
|
+
/** Set by the delegation lane: whose lists this leg's own are (`delegationListWhere` — the agent definition it was spawned as, or the
|
|
1639
|
+
* delegation tool's tool-level list), so a refusal at the leg's prepare names the list to fix. Absent ⇒ the leg's own `TaskSpec` seats. */
|
|
1640
|
+
ownToolListsWhere?: string;
|
|
1641
|
+
/** Set only on an observer sidecar's legs: the leg kind whose protocol is the observer's report tool. */
|
|
1642
|
+
observerLeg?: true;
|
|
1611
1643
|
/** The live repair bundle from a `runRepairLoop` attempt in flight (attemptCount>0). Serialized onto a
|
|
1612
1644
|
* checkpoint minted MID-attempt so a resume re-seeds it; undefined for any non-repair run. */
|
|
1613
1645
|
repairBundle?: RepairBundle;
|
|
@@ -1983,15 +2015,19 @@ export interface RunInternals {
|
|
|
1983
2015
|
* to a domain the row is not in — scope is fail-closed on both access predicates, so such a child
|
|
1984
2016
|
* cannot see its own row, its siblings, or the children it spawns. Carrying the domain as its own
|
|
1985
2017
|
* trusted axis keeps `principal` the IDENTITY it is: the identity also keys the durable
|
|
1986
|
-
* approval / checkpoint namespace (`checkpointScopeOf`), the runtime-capability lookup and the
|
|
1987
|
-
* principal header, and a mount's registry scope has no business moving any of those (
|
|
1988
|
-
*
|
|
2018
|
+
* approval / checkpoint namespace of a root leg (`checkpointScopeOf`), the runtime-capability lookup and the
|
|
2019
|
+
* MCP principal header, and a mount's registry scope has no business moving any of those (a child's checkpoint
|
|
2020
|
+
* scope is its own fact — {@link checkpointScope} — and a registry domain is never it).
|
|
1989
2021
|
*
|
|
1990
2022
|
* TRUSTED channel (never a {@link TaskSpec} field, never a model argument), like the parentage axes
|
|
1991
2023
|
* above. When a deployment sets both, they agree by construction: with a principal present the
|
|
1992
2024
|
* delegation tool resolves this axis TO that principal.
|
|
1993
2025
|
*/
|
|
1994
2026
|
registryScope?: string;
|
|
2027
|
+
/** The spawning leg's checkpoint scope, filled by the delegation tool off the parent's ctx seat on every spawn lane (a
|
|
2028
|
+
* resume that hands none fills the rung from the row's `CheckpointState.legScope`): the top rung of `checkpointScopeOf`,
|
|
2029
|
+
* so a child's rows are listed with its parent's. Scope only, never park capability. TRUSTED channel; `""` is absence. */
|
|
2030
|
+
checkpointScope?: string;
|
|
1995
2031
|
/** The spawning run's ADOPTED center artifact, threaded down the
|
|
1996
2032
|
* trusted internals chain so every child in the tree composes the SAME closure (a child must
|
|
1997
2033
|
* never spontaneously adopt the live candidate while its parent runs an older pin — that is the
|
|
@@ -2697,22 +2733,19 @@ export interface TurnBoundaryDeps {
|
|
|
2697
2733
|
export type ToolProgressBody = Omit<Extract<TaskEvent, {
|
|
2698
2734
|
type: "tool_progress";
|
|
2699
2735
|
}>, "type" | "elapsedTimeSeconds" | keyof TaskEventIdentity>;
|
|
2700
|
-
/** The run's TOOL-PROGRESS lane: the ONE mint of `tool_progress` plus the heartbeat
|
|
2701
|
-
*
|
|
2702
|
-
* driver builds it, the harness-handler lane drives
|
|
2703
|
-
*
|
|
2736
|
+
/** The run's TOOL-PROGRESS lane: the ONE mint of `tool_progress` plus the heartbeat over the calls in flight —
|
|
2737
|
+
* the leg's occurrences (`Prepared.toolOccurrences`), read, never a set of its own. Declared on the FLOOR because
|
|
2738
|
+
* both registry-side readers sit above its implementation (the driver builds it, the harness-handler lane drives
|
|
2739
|
+
* it) and the Prepared seat that carries it to the tool band is here too. `createToolProgressLane`
|
|
2740
|
+
* (tool-progress-lane.ts, layer 1) is its one implementation. */
|
|
2704
2741
|
export interface ToolProgressLane {
|
|
2705
2742
|
/** Offer ONE frame — from a tool that observes its own progress (the shell's per-second tick) or from
|
|
2706
2743
|
* the lane's own heartbeat. The lane stamps the elapsed time, DROPS the offer when it would land inside
|
|
2707
2744
|
* the cadence floor, and resets that call's beat clock when it does not. NEVER THROWS: a tool calls this
|
|
2708
2745
|
* from inside an environment output callback, where a throw kills the command it is describing. */
|
|
2709
2746
|
emit(body: ToolProgressBody): void;
|
|
2710
|
-
/**
|
|
2711
|
-
*
|
|
2712
|
-
noteStart(toolCallId: string, toolName: string): void;
|
|
2713
|
-
/** A tool call settled: it leaves the in-flight set. */
|
|
2714
|
-
noteEnd(toolCallId: string): void;
|
|
2715
|
-
/** Drop every in-flight call and disarm the timer (turn end / teardown): no beating into the next turn. */
|
|
2747
|
+
/** The heartbeat stops covering every call in flight and disarms (turn end / teardown): no beating into the next
|
|
2748
|
+
* turn. The occurrences stay — a later end must still know its start went out. */
|
|
2716
2749
|
clear(): void;
|
|
2717
2750
|
}
|
|
2718
2751
|
export interface HarnessHandlersDeps {
|
|
@@ -2750,8 +2783,8 @@ export interface HarnessHandlersDeps {
|
|
|
2750
2783
|
}
|
|
2751
2784
|
/**
|
|
2752
2785
|
* The Runner as the modules it drives and the compositions over it see it — the delegation tools
|
|
2753
|
-
* (Agent / SendMessage / AgentTranscript), the repair, verify
|
|
2754
|
-
* workflow and goal orchestrations, the
|
|
2786
|
+
* (Agent / SendMessage / AgentTranscript), the repair, verify and cascade loops, the
|
|
2787
|
+
* workflow and goal orchestrations, the HTTP server, `warmResume`, and the
|
|
2755
2788
|
* orchestrator's own trusted `runnerSelf` seat. Every one of them used to name the `Runner` CLASS
|
|
2756
2789
|
* through `import type`, which is a type edge from below the runner back up into it — a cycle the
|
|
2757
2790
|
* direction gate could only carry as an exemption, and one that reached the orchestrator through the
|
|
@@ -7,14 +7,18 @@
|
|
|
7
7
|
* · which call a CONTENT-ASK checkpoint parks on, and the one-shot answering face a decide's answer is
|
|
8
8
|
* bound to for the redeemed call;
|
|
9
9
|
* · the capture-time domain checks on a decide's TEXT payloads, and the label a rejected value gets;
|
|
10
|
+
* · WHO decided: the host's decision facts, validated once and minted into the settlement record once, for every
|
|
11
|
+
* decide that records its decider (a tool approval's and a plan pause's);
|
|
10
12
|
* · the continuation prompt itself.
|
|
11
13
|
*
|
|
12
14
|
* Pure over its arguments (the answering face is the one closure, and it closes over its own arguments
|
|
13
15
|
* only). Run-loop machinery (layer 1), named without the `resume-` family prefix: that prefix marks a
|
|
14
16
|
* driven rung of the resume decision ladder, which this is not.
|
|
15
17
|
*/
|
|
18
|
+
import { type AskOrigin } from "../ask-origin.js";
|
|
16
19
|
import { type OnQuestion, type QuestionAnswer } from "../ask-question.js";
|
|
17
|
-
import { type Checkpoint, type ResolvedOutcome } from "../checkpoint-store.js";
|
|
20
|
+
import { type Checkpoint, type ResolvedOutcome, type ResumeOutcome } from "../checkpoint-store.js";
|
|
21
|
+
import { type GateOutcome, type HostDecisionFacts } from "../gate-outcome.js";
|
|
18
22
|
import type { ResumeRun } from "./contracts.js";
|
|
19
23
|
/**
|
|
20
24
|
* Was this resume driven by a NEGATIVE human decision (plan_review/dry_run_review
|
|
@@ -72,6 +76,49 @@ redeemedQuestionsHash: string): OnQuestion;
|
|
|
72
76
|
* the malformed input escaping the very classification the refusal exists to give.
|
|
73
77
|
*/
|
|
74
78
|
export declare function describeSuppliedValue(value: unknown): string;
|
|
79
|
+
/** The decide lane a capture serves — the outcome gate word of an arm that carries the facts (the lane only words the refusals). */
|
|
80
|
+
export type DecideLane = Extract<ResumeOutcome, {
|
|
81
|
+
hostDecision: HostDecisionFacts;
|
|
82
|
+
}>["gate"];
|
|
83
|
+
/** The member every durable decide refuses when a caller supplies it: the settlement record is core's mint. */
|
|
84
|
+
export declare const SUPPLIED_RECORD_KEY: readonly [string, string];
|
|
85
|
+
/** Refuse a decide that carries a key it may not (each with the sentence that says why). Presence is the whole test —
|
|
86
|
+
* no value read here is ever consumed, so a stateful accessor has no seam to open; `Reflect.get` keeps the read
|
|
87
|
+
* dynamic without naming a refused key as a property. */
|
|
88
|
+
export declare function refuseSuppliedKeys(decide: object, keys: ReadonlyArray<readonly [string, string]>): void;
|
|
89
|
+
/** What a decide says it decided, in the lane's own words: `word` is the verdict as the caller spelled it (for the
|
|
90
|
+
* sentence), `allows` whether it is the ALLOW direction (a tool approval's `allow`; a plan pause's `approve` / `edit`). */
|
|
91
|
+
export interface DecideVerdict {
|
|
92
|
+
readonly word: string;
|
|
93
|
+
readonly allows: boolean;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Read and judge the host's decision facts — the ONE validation for every durable decide. `raw` is the caller's
|
|
97
|
+
* `hostDecision`, read ONCE by the lane (this function reads `decidedBy` and `approver` once each, off it).
|
|
98
|
+
* - the facts are REQUIRED: absence (or a non-object) is refused — absence is not a fact about the wait, and core
|
|
99
|
+
* does not guess one;
|
|
100
|
+
* - `decidedBy` is a member of the closed set ({@link isHostDecider}); the sweep's word is the host's SLA sweep and
|
|
101
|
+
* a sweep resolves only rows whose deadline is an SLA resolve-deny (facet `A`, read through `facetOf`) — on any other row
|
|
102
|
+
* the word would file a record of an event that row's contract says cannot happen;
|
|
103
|
+
* - WHO MAY ALLOW the row: not the sweep's word (a wait nobody answered), and not the policy on a row that demands a
|
|
104
|
+
* person (`policyCannotAnswer`, the synchronous seat's rule);
|
|
105
|
+
* - the attribution passes the shared screen (a bounded plain string) — refused rather than dropped.
|
|
106
|
+
*/
|
|
107
|
+
export declare function captureHostDecision(cp: Checkpoint, raw: unknown, lane: DecideLane, verdict: DecideVerdict): HostDecisionFacts;
|
|
108
|
+
/** The origin word of the ask a pending row holds: a tool approval's was stamped on the park by the gate; a plan
|
|
109
|
+
* pause's is its kind (nothing persisted — the row's kind is the whole fact). Undefined for a row that holds no ask. */
|
|
110
|
+
export declare function parkedOriginOf(cp: Checkpoint): AskOrigin | undefined;
|
|
111
|
+
/**
|
|
112
|
+
* THE mint for a durable decide's settlement record — the last pre-CAS station of both decide lanes: the host's
|
|
113
|
+
* facts joined with the row's origin (invariant I1: a settlement names its origin), one record for the row's
|
|
114
|
+
* resolved outcome. `allowed` is the allow direction; the refusal's `note` is the decider's own text (filed on a
|
|
115
|
+
* person's refusal only). A row minted before the origin was persisted carries none, and the record cannot be
|
|
116
|
+
* minted honestly for it: refused by version floor (the row stays pending), never guessed.
|
|
117
|
+
*/
|
|
118
|
+
export declare function mintDecideRecord(cp: Checkpoint, facts: HostDecisionFacts, verdict: {
|
|
119
|
+
readonly allowed: boolean;
|
|
120
|
+
readonly note: string | undefined;
|
|
121
|
+
}): GateOutcome;
|
|
75
122
|
/**
|
|
76
123
|
* Capture-time domain check for a decide outcome's TEXT payloads — the review lanes' `editedPlan` /
|
|
77
124
|
* `reason` and the approval lane's deny `reason`. All are persisted (the recorded winner's payload,
|
|
@@ -92,6 +139,7 @@ export declare function assertOutcomeText(value: string | undefined, field: "edi
|
|
|
92
139
|
* `prompt(text)` (it always appends a user message — there is no "continue from tool results" entry), so
|
|
93
140
|
* resume re-enters via a `<system-reminder>`-wrapped user message that tells the model the gated decision
|
|
94
141
|
* was applied. The "user message wart" is accepted (API-valid, and clearer than a silent continuation).
|
|
95
|
-
* `fullShellReachable` is the resumed leg's own roster fact, read by {@link reorientClause}
|
|
142
|
+
* `fullShellReachable` is the resumed leg's own roster fact, read by {@link reorientClause}; `delegatedChild` is
|
|
143
|
+
* the leg's effective delegation fact, which picks the posture of a person's refusal of a tool use.
|
|
96
144
|
*/
|
|
97
|
-
export declare function resumeContinuation(resume: ResumeRun, mark: string | undefined, fullShellReachable: boolean): string;
|
|
145
|
+
export declare function resumeContinuation(resume: ResumeRun, mark: string | undefined, fullShellReachable: boolean, delegatedChild: boolean): string;
|