@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
|
@@ -14,7 +14,7 @@ import { screenSwappableDeps } from "../swappable-deps.js";
|
|
|
14
14
|
import { runSideQuery } from "../side-query.js";
|
|
15
15
|
import { PushQueue } from "../push-queue.js";
|
|
16
16
|
import { TtlSessionStore } from "../session-store.js";
|
|
17
|
-
import { errorCodeOf } from "./
|
|
17
|
+
import { errorCodeOf } from "./terminal-account.js";
|
|
18
18
|
import { effectiveDelegationFacts, prepareTask } from "./prepare-task.js";
|
|
19
19
|
import { SessionReadFileStates } from "./session-read-file-states.js";
|
|
20
20
|
import { SessionModeSeats } from "./session-mode-seats.js";
|
|
@@ -25,7 +25,7 @@ import { PendingSessionNotifications } from "../task-notification.js";
|
|
|
25
25
|
import { ToolDetachHub } from "../tool-detach.js";
|
|
26
26
|
import { assertContextSettingsValue, assertContextSettingsWords, contextOverlayFor } from "../context-settings.js";
|
|
27
27
|
import { createRunState } from "./initial-run-state.js";
|
|
28
|
-
import {
|
|
28
|
+
import { emitSettled, reconciledEnd } from "./tool-end-body.js";
|
|
29
29
|
import { answerFaceForRedeemedCall } from "./decide-continuation.js";
|
|
30
30
|
import { createTurnBoundary } from "./run-turn-boundary.js";
|
|
31
31
|
import { createHarnessHandlers } from "./run-harness-handlers.js";
|
|
@@ -463,12 +463,12 @@ export class Runner {
|
|
|
463
463
|
const { todoToolMounted, taskToolsMounted, writeFamilyOf, toolStartAt, startedToolCallIds } = runToolMountFacts({ spec, prepared, rs });
|
|
464
464
|
const { observeReasoningWireFacts, reasoningResolution } = runReasoningSeat({ prepared, rs, taskIdRef });
|
|
465
465
|
const { effectiveTimeoutMs, walltimeMonotonicDeadline, timeout, pushContent, ownCommittedTailRef, emitCommitted } = runClockAndContent({ spec, prepared, queue, internals, rs, ident, parentToolCallId, startedToolCallIds });
|
|
466
|
-
const toolProgress = createToolProgressLane(pushContent, ident);
|
|
466
|
+
const toolProgress = createToolProgressLane(pushContent, ident, prepared.toolOccurrences);
|
|
467
467
|
prepared.toolProgressRef.current = toolProgress;
|
|
468
|
-
const { subagentName, withBrainSinks } = runBrainSinks({ queue, internals, rs, ident, parentToolCallId, observeReasoningWireFacts });
|
|
468
|
+
const { subagentName, withBrainSinks, withExtraBodyDroppedSink } = runBrainSinks({ queue, internals, rs, ident, parentToolCallId, observeReasoningWireFacts, notice: { onNotice: this.deps.onNotice, sessionId: prepared.sessionId, runId: prepared.runId } });
|
|
469
469
|
const toolLabels = new Map(prepared.tools.flatMap((t) => (t.label !== undefined && t.label !== t.name ? [[t.name, t.label]] : [])));
|
|
470
470
|
for (const orphan of prepared.wakeRecovered) {
|
|
471
|
-
|
|
471
|
+
emitSettled(prepared.toolOccurrences, { toolCallId: orphan.toolCallId, spelledName: orphan.toolName, ...(toolLabels.has(orphan.toolName) ? { label: toolLabels.get(orphan.toolName) } : {}), args: orphan.args }, reconciledEnd(orphan), { push: (f) => queue.push({ ...f, ...ident() }), structured: prepared.structuredProjector });
|
|
472
472
|
emitCommitted(orphan.entryId, "toolResult", orphan.toolCallId);
|
|
473
473
|
}
|
|
474
474
|
const postToolBatchHook = (spec.hooks ?? this.deps.hooks)?.postToolBatch;
|
|
@@ -504,8 +504,8 @@ export class Runner {
|
|
|
504
504
|
},
|
|
505
505
|
});
|
|
506
506
|
const { flushGitMirror, unsubGitRetry, unsubBoundary, unsub } = runGitLane({ prepared, queue, rs, ident, onMessageUpdate, onMessageEnd, onToolStart, onToolEnd, onTurnEnd, onTurnBoundary, runner: this.depsSeat });
|
|
507
|
-
return runLeg({
|
|
508
|
-
spec, queue, prepared, resume, rs,
|
|
507
|
+
return withExtraBodyDroppedSink(() => runLeg({
|
|
508
|
+
spec, queue, prepared, resume, rs, entryActor, effectiveTimeoutMs, timeout, pushContent, ident, emitCommitted, writeFamilyOf, startedToolCallIds,
|
|
509
509
|
announceWorkspaceMove, withBrainSinks, flushGitMirror, loopLatch, notificationLane, unsubscribeTaskNotifications, unsubGitRetry, unsubBoundary, unsub,
|
|
510
510
|
runner: this.depsSeat,
|
|
511
511
|
next: ({ final, threw, abortedLive, userInterruptedLive, strandedHumanAnswers }) => runTerminalAdoption({
|
|
@@ -517,7 +517,7 @@ export class Runner {
|
|
|
517
517
|
setResult, onSuggestions, onSuspend, runner: this.depsSeat, sessions: this.sessions,
|
|
518
518
|
}),
|
|
519
519
|
}),
|
|
520
|
-
});
|
|
520
|
+
}));
|
|
521
521
|
},
|
|
522
522
|
});
|
|
523
523
|
},
|
|
@@ -7,6 +7,8 @@ import { ruleDenialSentence } from "../rule-denial-sentence.js";
|
|
|
7
7
|
import { DEFAULT_GATE_AWAIT_TIMEOUT_MS, gateWaitFailureOf, withGateTimeout } from "../gate-bounded-await.js";
|
|
8
8
|
import { declaredPathTargetOf, isProtectedWrite, pathConfinableWriteToolNames } from "../tool-registry.js";
|
|
9
9
|
import { pathTargetBaseOf } from "../effective-path-target.js";
|
|
10
|
+
import { judgePathRows } from "../path-guard-rows.js";
|
|
11
|
+
import { domainRow } from "../fs-write-gate-policy.js";
|
|
10
12
|
export const PATH_CONFINABLE_WRITE_TOOLS = pathConfinableWriteToolNames();
|
|
11
13
|
export function isWithin(root, p) {
|
|
12
14
|
if (!root)
|
|
@@ -165,17 +167,15 @@ export function createSessionRulePolicy(rules, opts) {
|
|
|
165
167
|
return deny(req.toolName, "the call has no resolvable path to confine, while the rule confines writes to allowDirs");
|
|
166
168
|
}
|
|
167
169
|
const canon = await canonicalizeTarget(env, path, signal, pathFamilyOf({ root: rootPath, cwd: req.cwd ?? env.cwd }), pathTargetBaseOf(declared, { root: rootPath, cwd: req.cwd }));
|
|
168
|
-
if (!canon.ok) {
|
|
169
|
-
return deny(req.toolName, `the real target of the write to ${JSON.stringify(path)} could not be resolved against the session-rule allowDirs`);
|
|
170
|
-
}
|
|
171
170
|
const roots = [];
|
|
172
171
|
for (const raw of allowDirs) {
|
|
173
172
|
const r = await canonicalizeTarget(env, raw, signal, pathFamilyOf({ root: rootPath ?? env.cwd }), rootPath);
|
|
174
173
|
if (r.ok)
|
|
175
174
|
roots.push(r.key);
|
|
176
175
|
}
|
|
177
|
-
|
|
178
|
-
|
|
176
|
+
const views = canon.ok ? { views: [{ path: canon.key, kind: "canonical" }] } : { views: [], unreadable: canon.message };
|
|
177
|
+
if (judgePathRows([domainRow("session", roots)], views, "allow") === undefined) {
|
|
178
|
+
return deny(req.toolName, canon.ok ? `the write to ${JSON.stringify(path)} is outside the session-rule allowDirs (${allowDirs.join(", ")})` : `the real target of the write to ${JSON.stringify(path)} could not be resolved against the session-rule allowDirs`);
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
181
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { errorCodeOf } from "./
|
|
1
|
+
import { errorCodeOf, thrownFailureOf } from "./terminal-account.js";
|
|
2
2
|
import { resumeDecisionWasNegative } from "./decide-continuation.js";
|
|
3
3
|
import { drainForwardedFramesBeforeDone, forwardsSubagentEvents } from "./prepare-run-refs.js";
|
|
4
4
|
import { hasDestroy } from "../remote-env.js";
|
|
@@ -10,7 +10,7 @@ import { asThrownError, readMember, thrownText } from "../thrown-value.js";
|
|
|
10
10
|
export function streamSettleBackstop(input) {
|
|
11
11
|
const { spec, resume, queue, taskIdRef, entryTracer, runStartedAt, live, runner, sessions, locallyClaimedTokens, parentConstraintRegistry, suspendedEnvReaps } = input;
|
|
12
12
|
const onRunRejected = async (err) => {
|
|
13
|
-
let code =
|
|
13
|
+
let { code, message, detail } = thrownFailureOf(err, thrownText(err));
|
|
14
14
|
const reopenReason = code === "resume.tool_unavailable" || code === "resume.tool_contract_mismatch" ? "tool_unavailable" : "env_failed";
|
|
15
15
|
const reopenable = resume !== undefined && resume.pendingActionStarted !== true && reopenReason !== undefined && !(resumeDecisionWasNegative(resume) && resume.decisionDelivered === true);
|
|
16
16
|
let reopenCommitted = false;
|
|
@@ -29,7 +29,10 @@ export function streamSettleBackstop(input) {
|
|
|
29
29
|
err = Object.assign(new Error(definitive
|
|
30
30
|
? `${reopenMsg} (original resume failure: ${original.message})`
|
|
31
31
|
: `checkpoint reopen threw mid-flight — state UNKNOWN, confirm via the checkpoint store before retrying: ${reopenMsg} (original resume failure: ${original.message})`, { cause: original }), { code: "checkpoint.reopen_failed" });
|
|
32
|
-
|
|
32
|
+
const replacement = thrownFailureOf(err, thrownText(err));
|
|
33
|
+
code = replacement.code;
|
|
34
|
+
message = replacement.message;
|
|
35
|
+
detail = replacement.detail;
|
|
33
36
|
}
|
|
34
37
|
}
|
|
35
38
|
if (resume)
|
|
@@ -69,7 +72,7 @@ export function streamSettleBackstop(input) {
|
|
|
69
72
|
taskId: taskIdRef.current ?? "unknown",
|
|
70
73
|
sessionId: taskIdRef.sessionId ?? "unknown",
|
|
71
74
|
...(taskIdRef.runId !== undefined ? { runId: taskIdRef.runId } : {}),
|
|
72
|
-
terminal: { kind: "failed", ...(code !== undefined ? { code } : {}), message:
|
|
75
|
+
terminal: { kind: "failed", ...(code !== undefined ? { code } : {}), message, ...(detail !== undefined ? { detail } : {}) },
|
|
73
76
|
result: "",
|
|
74
77
|
...(remoteEnvFailure !== undefined ? { remoteEnvFailures: remoteEnvFailure } : {}),
|
|
75
78
|
...(taskIdRef.effectiveMemoryScopes !== undefined ? { effectiveMemoryScopes: taskIdRef.effectiveMemoryScopes } : {}),
|
|
@@ -1,15 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* (
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
2
|
+
* THE judgment of every tool-name list one prepared task receives — the run's own selector lists (`TaskSpec.allowTools` /
|
|
3
|
+
* `TaskSpec.excludeTools`, unless the delegation lane spawned it — its spawning run judged them where they were mounted), the definitions it
|
|
4
|
+
* carries (`TaskSpec.agents`), and the definitions and tool-level lists a mounted delegation tool carries (the `authored` faces
|
|
5
|
+
* — the engine's built-ins are not judged; only a tool a deployment mounted (depth 0) publishes them). One rule for both sides:
|
|
6
|
+
* a value that is not a list, an entry that is not a string, a spelling that can name no tool, a stale name and a name the
|
|
7
|
+
* universe does not carry are REFUSED; a list whose universe the engine cannot list (a delegation tool that injects tools per
|
|
8
|
+
* spawn with no declared roster) turns the refusals that need a universe into host notices. And one contradiction, judged on
|
|
9
|
+
* every leg: a denylist (the run's own or one of its ceiling) that reaches a tool the leg's kind relies on (the catalog's
|
|
10
|
+
* protocol column) is refused — neither a silently ignored deny nor a silently crippled leg.
|
|
9
11
|
*
|
|
10
|
-
*
|
|
12
|
+
* Universe = the task's assembled roster before the valve, every tool the catalog describes, every mounted delegation tool's
|
|
13
|
+
* pool and the caller's own tools (names and aliases), and the protocol peers the task declares (a namespaced spelling under a
|
|
14
|
+
* declared peer names a tool of it — the peer's tool list is runtime data, so the peer is what is checked).
|
|
15
|
+
*
|
|
16
|
+
* Throws `config.tool_face_control` for the run's own lists and the protocol contradiction, `config.agent.unknown_tool` for a
|
|
17
|
+
* definition's or a delegation tool's lists — synchronous, like the phase that calls it.
|
|
11
18
|
*/
|
|
12
19
|
import type { AgentTool } from "../../internal/harness.js";
|
|
20
|
+
import { type ProtocolId } from "../protocol-table.js";
|
|
21
|
+
import type { ToolLegKind, ToolSelectorLayer } from "../tool-face.js";
|
|
13
22
|
import type { TaskSpec } from "../types.js";
|
|
14
23
|
import type { AnnounceOnceSink } from "./contracts.js";
|
|
15
24
|
/**
|
|
@@ -19,14 +28,44 @@ import type { AnnounceOnceSink } from "./contracts.js";
|
|
|
19
28
|
* need the leg's roster and a sink; the leg's own policy-name audit is what reads them.
|
|
20
29
|
*/
|
|
21
30
|
export declare function deniedToolNamesOf(where: string, value: unknown): string[];
|
|
22
|
-
|
|
23
|
-
|
|
31
|
+
/**
|
|
32
|
+
* The upstream judgment of a run's own lists, when it holds: the evidence digest the spawning run handed down (live) or the resumed row
|
|
33
|
+
* recorded, returned only when it equals the digest of the lists this prepare read — the evidence is bound to the lists it was minted
|
|
34
|
+
* for, so a resume that hands different lists is judged again. The value returned is what this leg's rows record.
|
|
35
|
+
*/
|
|
36
|
+
export declare function boundToolListsJudgment(evidence: string | undefined, own: {
|
|
37
|
+
readonly allow: readonly string[] | undefined;
|
|
38
|
+
readonly exclude: readonly string[] | undefined;
|
|
39
|
+
}): string | undefined;
|
|
40
|
+
export interface RunToolListsInput {
|
|
41
|
+
/** borrowed-readonly — the REBOUND spec: `agents` (the task's definitions) and `tools` (the caller's tools and the mounted delegation tools). */
|
|
24
42
|
spec: Pick<TaskSpec, "agents" | "tools">;
|
|
25
|
-
/** borrowed-readonly — the
|
|
43
|
+
/** borrowed-readonly — the assembled mount array BEFORE the selector's valve (names + aliases = the roster half of the universe). */
|
|
26
44
|
tools: ReadonlyArray<AgentTool>;
|
|
45
|
+
/** borrowed-readonly — the peers the task declares, per protocol of the protocol table (its MCP servers, its A2A peers): a namespaced
|
|
46
|
+
* spelling under one names a tool of it, whether or not the peer answered with any tool. */
|
|
47
|
+
declaredPeers: {
|
|
48
|
+
readonly [P in ProtocolId]: ReadonlyArray<{
|
|
49
|
+
readonly name: string;
|
|
50
|
+
}> | undefined;
|
|
51
|
+
};
|
|
52
|
+
/** borrowed-readonly — the run's own lists (the selector's own layer), as the doors froze them. */
|
|
53
|
+
own: {
|
|
54
|
+
readonly allow: readonly string[] | undefined;
|
|
55
|
+
readonly exclude: readonly string[] | undefined;
|
|
56
|
+
};
|
|
57
|
+
/** borrowed-readonly — every layer of the run's selector (the ceiling, then its own) and the kinds of leg it is. */
|
|
58
|
+
layers: readonly ToolSelectorLayer[];
|
|
59
|
+
legs: readonly ToolLegKind[];
|
|
60
|
+
/** True ⇔ the spawning run's prepare judged exactly these own lists where they were mounted — the evidence digest it handed down
|
|
61
|
+
* (live, or recorded on the resumed row) equals the digest of the lists this prepare read ({@link boundToolListsJudgment}). */
|
|
62
|
+
judgedUpstream: boolean;
|
|
63
|
+
/** Whose lists the run's own are, when the run that spawned it wrote them ({@link delegationListWhere}); absent ⇒ the run's own
|
|
64
|
+
* `TaskSpec` seats. */
|
|
65
|
+
ownWhere: string | undefined;
|
|
27
66
|
/** borrowed-readonly — the once-per-session ledger whose operator sink carries the notices. */
|
|
28
67
|
onceLedger: Pick<AnnounceOnceSink, "onError">;
|
|
29
68
|
/** borrowed-readonly — the acquired session's id (operator-line context). */
|
|
30
69
|
sessionId: string;
|
|
31
70
|
}
|
|
32
|
-
export declare function
|
|
71
|
+
export declare function judgeRunToolLists(input: RunToolListsInput): void;
|
|
@@ -1,88 +1,91 @@
|
|
|
1
|
-
import { notAListSentence, notAStringSentence,
|
|
1
|
+
import { deniedProtocolTools, delegationListWhere, listReaches, notAListSentence, toolListsDigest, notAStringSentence, readAllowedToolList, readDeniedEntry, readDeniedToolList } from "../../agents/tool-filter.js";
|
|
2
|
+
import { readToolNameList, valueTypeLabel } from "../tool-name-list.js";
|
|
2
3
|
import { compileAllowList, inertEntryPhrase, renderListEntry } from "../allow-entry.js";
|
|
3
4
|
import { inlineUntrusted } from "../untrusted-text.js";
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
import { ENGINE_TOOLS } from "../tool-catalog-entries.js";
|
|
6
|
+
import { mintNamespacePrefix } from "../protocol-naming.js";
|
|
7
|
+
import { PROTOCOL_TABLE, protocolOf } from "../protocol-table.js";
|
|
8
|
+
import { splitNamespacedName } from "../tool-name-aliases.js";
|
|
9
|
+
const DENY_LIST_NAMES_ONLY = "To block by path or command, write a deny rule in the caller's permission policy: a tool-name list only takes tool names (it narrows which tools are mounted).";
|
|
10
|
+
function universeCarries(reach, entry, universe) {
|
|
11
|
+
for (const name of universe.known)
|
|
12
|
+
if (listReaches(reach, { name }))
|
|
13
|
+
return true;
|
|
14
|
+
const split = splitNamespacedName(entry);
|
|
15
|
+
if (split === undefined || split.peer === "")
|
|
16
|
+
return false;
|
|
17
|
+
return universe.peers.has(mintNamespacePrefix(split.ns, split.peer));
|
|
18
|
+
}
|
|
19
|
+
function refused(message, code, reason) {
|
|
6
20
|
const e = new Error(message);
|
|
7
|
-
e.code =
|
|
21
|
+
e.code = code;
|
|
22
|
+
e.detail = { reason };
|
|
8
23
|
return e;
|
|
9
24
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
function refusalNotAString(where, side, index, type) {
|
|
14
|
-
return refused(notAStringSentence(where, side, index, type));
|
|
15
|
-
}
|
|
16
|
-
function refusalNotAList(where, side, list) {
|
|
17
|
-
return refused(notAListSentence(where, side, list));
|
|
18
|
-
}
|
|
19
|
-
export function deniedToolNamesOf(where, value) {
|
|
20
|
-
const list = readToolNameList(value);
|
|
21
|
-
if (list.kind !== "entries")
|
|
22
|
-
throw refusalNotAList(where, "denied", list);
|
|
23
|
-
return list.entries.map((entry, index) => {
|
|
24
|
-
if (entry === "*")
|
|
25
|
-
return entry;
|
|
26
|
-
const read = readDeniedEntry(entry);
|
|
27
|
-
if (read.kind === "not_a_string")
|
|
28
|
-
throw refusalNotAString(where, "denied", index, read.type);
|
|
29
|
-
const flaw = compileAllowList([read.name], "deny").inert[0];
|
|
30
|
-
if (flaw !== undefined && flaw.reason === "grammar")
|
|
31
|
-
throw refusal(where, { ...flaw, entry: read.name });
|
|
32
|
-
return read.name;
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
function judgeDeniedToolNames(where, value, universe, advise) {
|
|
25
|
+
const LIST_WORD = { allowed: "allowed tools", denied: "denied tools" };
|
|
26
|
+
function judgeToolNameList(where, side, value, universe, advise, code) {
|
|
36
27
|
if (value === undefined || value === null)
|
|
37
28
|
return;
|
|
38
29
|
const list = readToolNameList(value);
|
|
39
30
|
if (list.kind !== "entries")
|
|
40
|
-
throw
|
|
31
|
+
throw refused(notAListSentence(where, side, list), code, "not_a_list");
|
|
41
32
|
let index = -1;
|
|
42
33
|
for (const entry of list.entries) {
|
|
43
34
|
index += 1;
|
|
44
|
-
if (entry
|
|
45
|
-
|
|
35
|
+
if (typeof entry !== "string")
|
|
36
|
+
throw refused(notAStringSentence(where, side, index, valueTypeLabel(entry)), code, "not_a_string");
|
|
37
|
+
if (entry === "*") {
|
|
38
|
+
if (side === "allowed")
|
|
39
|
+
continue;
|
|
40
|
+
throw refused(`${where} declares "*" in its ${LIST_WORD[side]}: a denied list has no wildcard — the entry would hide nothing. To give the agent no tools, write an empty allowed list.`, code, "unsupported_pattern");
|
|
41
|
+
}
|
|
46
42
|
const read = readDeniedEntry(entry);
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
43
|
+
const name = side === "denied" && read.kind === "name" ? read.name : entry;
|
|
44
|
+
const content = side === "denied" && read.kind === "name" && read.content;
|
|
45
|
+
const reach = side === "denied" ? readDeniedToolList([entry]) : (readAllowedToolList([entry]) ?? readDeniedToolList([]));
|
|
46
|
+
const split = splitNamespacedName(name);
|
|
47
|
+
if (split !== undefined && split.peer === "*" && split.tool === undefined) {
|
|
48
|
+
if (side === "denied")
|
|
49
|
+
continue;
|
|
50
|
+
throw refused(`${where} declares ${renderListEntry(entry)} in its ${LIST_WORD[side]}: an allowed list has no protocol-wide form — name a peer (\`${split.ns.prefix}<peer>\`) or its tools.`, code, "unsupported_pattern");
|
|
51
|
+
}
|
|
52
|
+
const { inert } = compileAllowList([name], "deny", universe.known);
|
|
53
|
+
const flaw = inert[0] === undefined ? undefined : { ...inert[0], entry };
|
|
53
54
|
const stale = flaw !== undefined && (flaw.reason === "tool_name" || flaw.reason === "near_miss");
|
|
54
|
-
if (flaw !== undefined && (flaw.reason === "grammar" || (stale && universe.complete)))
|
|
55
|
-
throw
|
|
56
|
-
|
|
55
|
+
if (flaw !== undefined && (flaw.reason === "grammar" || (stale && universe.complete))) {
|
|
56
|
+
throw refused(`${where} declares tool ${inertEntryPhrase(flaw)} in its ${LIST_WORD[side]}, but no tool of that spelling exists in this deployment — fix the entry or mount the tool.${flaw.reason === "grammar" ? ` ${DENY_LIST_NAMES_ONLY}` : ""}`, code, "unknown_name");
|
|
57
|
+
}
|
|
58
|
+
if (flaw === undefined && universeCarries(reach, name, universe)) {
|
|
57
59
|
if (content)
|
|
58
|
-
advise(new Error(`${where} declares ${renderListEntry(
|
|
60
|
+
advise(new Error(`${where} declares ${renderListEntry(entry)} in its denied tools: this list reads tool names, not content, so the whole tool "${inlineUntrusted(name, 80)}" is denied. ${DENY_LIST_NAMES_ONLY}`));
|
|
59
61
|
continue;
|
|
60
62
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
(
|
|
63
|
+
const phrase = flaw !== undefined ? inertEntryPhrase(flaw) : renderListEntry(entry);
|
|
64
|
+
if (universe.complete)
|
|
65
|
+
throw refused(`${where} declares tool ${phrase} in its ${LIST_WORD[side]}, a name no tool of this deployment answers to — fix the entry or mount the tool.`, code, "unknown_name");
|
|
66
|
+
advise(new Error(`${where} declares tool ${phrase} in its ${LIST_WORD[side]}, a name no listed tool answers to — a delegation tool this task mounts injects tools the engine cannot enumerate (extraTools), so the name cannot be checked here.`));
|
|
64
67
|
}
|
|
65
68
|
}
|
|
66
|
-
function
|
|
67
|
-
if (value === undefined || value === null)
|
|
68
|
-
return;
|
|
69
|
+
export function deniedToolNamesOf(where, value) {
|
|
69
70
|
const list = readToolNameList(value);
|
|
70
71
|
if (list.kind !== "entries")
|
|
71
|
-
throw
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
if (
|
|
77
|
-
throw
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
advise(new Error(`${where} allows tool(s) ${unknownNames.map(renderListEntry).join(", ")} not present in this task's assembled roster — likely a typo (the entry would be item-filtered at spawn; the agent stays usable). Advisory only: the delegation pool can differ from this roster, so a tool mounted only on the delegation tool or produced by per-spawn extraTools makes this spurious.`));
|
|
72
|
+
throw refused(notAListSentence(where, "denied", list), "config.agent.unknown_tool", "not_a_list");
|
|
73
|
+
return list.entries.map((entry, index) => {
|
|
74
|
+
if (entry === "*")
|
|
75
|
+
return entry;
|
|
76
|
+
const read = readDeniedEntry(entry);
|
|
77
|
+
if (read.kind === "not_a_string")
|
|
78
|
+
throw refused(notAStringSentence(where, "denied", index, read.type), "config.agent.unknown_tool", "not_a_string");
|
|
79
|
+
const flaw = compileAllowList([read.name], "deny").inert[0];
|
|
80
|
+
if (flaw !== undefined && flaw.reason === "grammar")
|
|
81
|
+
throw refused(`${where} declares tool ${inertEntryPhrase({ ...flaw, entry: read.name })} in its denied tools, but no tool of that spelling exists in this deployment — fix the entry or mount the tool. ${DENY_LIST_NAMES_ONLY}`, "config.agent.unknown_tool", "unknown_name");
|
|
82
|
+
return read.name;
|
|
83
|
+
});
|
|
84
84
|
}
|
|
85
|
-
export function
|
|
85
|
+
export function boundToolListsJudgment(evidence, own) {
|
|
86
|
+
return evidence !== undefined && evidence === toolListsDigest(own.allow, own.exclude) ? evidence : undefined;
|
|
87
|
+
}
|
|
88
|
+
export function judgeRunToolLists(input) {
|
|
86
89
|
const { spec, tools, onceLedger, sessionId } = input;
|
|
87
90
|
const advise = (err) => {
|
|
88
91
|
try {
|
|
@@ -91,31 +94,59 @@ export function auditSubAgentToolLists(input) {
|
|
|
91
94
|
catch {
|
|
92
95
|
}
|
|
93
96
|
};
|
|
97
|
+
const denied = deniedProtocolTools(input.layers, input.legs);
|
|
98
|
+
if (denied.length > 0) {
|
|
99
|
+
const names = [...new Set(denied.map((h) => `"${h.name}"`))];
|
|
100
|
+
const one = names.length === 1;
|
|
101
|
+
const deniedBy = (own, whose) => {
|
|
102
|
+
const hits = denied.filter((h) => h.own === own).map((h) => `"${h.name}"`);
|
|
103
|
+
return hits.length > 0 ? [`${whose} denies ${one ? "it" : hits.join(", ")}`] : [];
|
|
104
|
+
};
|
|
105
|
+
const by = [...deniedBy(true, input.ownWhere ?? "this run's own excludeTools"), ...deniedBy(false, "an inherited list (the spawning run's excludeTools, or one it inherits)")];
|
|
106
|
+
throw refused(`This kind of leg (${input.legs.join(", ")}) relies on ${names.join(", ")}, but ${by.join(" and ")} — the leg cannot work without ${one ? "it" : "them"}. Remove the entry from the list that names it.`, "config.tool_face_control", "protocol_denied");
|
|
107
|
+
}
|
|
94
108
|
const delegationTools = (spec.tools ?? []).filter((t) => t.agentToolFaces !== undefined);
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
109
|
+
const known = new Set();
|
|
110
|
+
const add = (t) => {
|
|
111
|
+
known.add(t.name);
|
|
112
|
+
for (const a of t.aliases ?? [])
|
|
113
|
+
known.add(a);
|
|
114
|
+
};
|
|
115
|
+
for (const t of tools)
|
|
116
|
+
add(t);
|
|
117
|
+
for (const t of ENGINE_TOOLS)
|
|
118
|
+
add(t);
|
|
119
|
+
for (const t of spec.tools ?? [])
|
|
120
|
+
add(t);
|
|
100
121
|
for (const t of delegationTools)
|
|
101
122
|
for (const p of t.agentToolPool ?? [])
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
123
|
+
add(p);
|
|
124
|
+
const peers = new Set(PROTOCOL_TABLE.flatMap((ns) => (input.declaredPeers[ns.id] ?? []).map((p) => mintNamespacePrefix(ns, p.name))));
|
|
125
|
+
for (const name of known) {
|
|
126
|
+
const ns = protocolOf(name);
|
|
127
|
+
const split = ns !== undefined ? splitNamespacedName(name) : undefined;
|
|
128
|
+
if (split !== undefined && split.peer !== "")
|
|
129
|
+
peers.add(mintNamespacePrefix(split.ns, split.peer));
|
|
130
|
+
}
|
|
131
|
+
const universe = { known, peers, complete: delegationTools.every((t) => t.agentToolPool !== undefined) };
|
|
132
|
+
if (!input.judgedUpstream) {
|
|
133
|
+
judgeToolNameList(input.ownWhere ?? "TaskSpec.allowTools", "allowed", input.own.allow, { ...universe, complete: true }, advise, "config.tool_face_control");
|
|
134
|
+
judgeToolNameList(input.ownWhere ?? "TaskSpec.excludeTools", "denied", input.own.exclude, { ...universe, complete: true }, advise, "config.tool_face_control");
|
|
135
|
+
}
|
|
136
|
+
for (const def of spec.agents ?? []) {
|
|
137
|
+
judgeToolNameList(`TaskSpec.agents: agent "${def.name}"`, "allowed", def.allowTools, universe, advise, "config.agent.unknown_tool");
|
|
138
|
+
judgeToolNameList(`TaskSpec.agents: agent "${def.name}"`, "denied", def.denyTools, universe, advise, "config.agent.unknown_tool");
|
|
108
139
|
}
|
|
109
|
-
const replaced = new Set(
|
|
140
|
+
const replaced = new Set((spec.agents ?? []).map((d) => d.name));
|
|
110
141
|
for (const t of delegationTools) {
|
|
111
142
|
for (const face of t.agentToolFaces ?? []) {
|
|
112
143
|
if (face.authored === true && !replaced.has(face.name)) {
|
|
113
|
-
const faceWhere =
|
|
114
|
-
|
|
115
|
-
|
|
144
|
+
const faceWhere = delegationListWhere(t.name, face.name);
|
|
145
|
+
judgeToolNameList(faceWhere, "allowed", face.allowTools, universe, advise, "config.agent.unknown_tool");
|
|
146
|
+
judgeToolNameList(faceWhere, "denied", face.denyTools, universe, advise, "config.agent.unknown_tool");
|
|
116
147
|
}
|
|
117
148
|
}
|
|
118
|
-
|
|
119
|
-
|
|
149
|
+
judgeToolNameList(delegationListWhere(t.name, undefined), "allowed", t.agentToolLevelAllowTools, universe, advise, "config.agent.unknown_tool");
|
|
150
|
+
judgeToolNameList(delegationListWhere(t.name, undefined), "denied", t.agentToolLevelDenyTools, universe, advise, "config.agent.unknown_tool");
|
|
120
151
|
}
|
|
121
152
|
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The terminal's accounts — `terminal.detail` and its members — each read off the ONE seat its fact was minted on, and
|
|
3
|
+
* admitted as a value this engine did not necessarily build (a host Brain mints the final message too; a host throws
|
|
4
|
+
* the error): every member read once, words admitted only from their closed sets, a malformed member absent rather than
|
|
5
|
+
* repaired. Nothing here re-derives a fact from a sentence. The arbitration of WHICH account a terminal carries is
|
|
6
|
+
* `assemble-result.ts`'s (`terminalCauseOf`); this module only reads.
|
|
7
|
+
*/
|
|
8
|
+
import { type AssistantMessage, type ModelOutputInvalid } from "../../internal/llm.js";
|
|
9
|
+
import { type RequestRoute } from "../../brain/request-route.js";
|
|
10
|
+
import type { TerminalCause } from "../types.js";
|
|
11
|
+
import type { TerminalFailureDetail } from "../terminal-cause.js";
|
|
12
|
+
type ProviderRejected = Extract<TerminalFailureDetail, {
|
|
13
|
+
kind: "provider_rejected";
|
|
14
|
+
}>;
|
|
15
|
+
/** The terminal message's provider-condition verdict, as the refusal account carries it: each member read once and
|
|
16
|
+
* admitted only as a word of its closed set (a host Brain mints this message too); the reset instant only beside a
|
|
17
|
+
* condition. Absent members stay absent. */
|
|
18
|
+
export declare function providerVerdictOf(final: AssistantMessage): Pick<ProviderRejected, "providerCondition" | "providerConditionSource" | "providerResetAtMs">;
|
|
19
|
+
/** The terminal message's request route (`apiErrorRoute`), admitted as a shape some request carries
|
|
20
|
+
* (`ROUTE_CREDENTIAL_PAIRING`); anything else is no route. */
|
|
21
|
+
export declare function requestRouteOfMessage(final: AssistantMessage): RequestRoute | undefined;
|
|
22
|
+
/** The terminal message's dropped-calls account (`modelOutputInvalid`): `cause` admitted from its closed set (else no
|
|
23
|
+
* account); `outputLimit` only beside `truncated`, only with a boolean `capStop`, its counts only as non-negative
|
|
24
|
+
* integers — an unreadable limit leaves the cause standing without it. */
|
|
25
|
+
export declare function modelOutputInvalidOfMessage(final: AssistantMessage): ModelOutputInvalid | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Extract a machine-readable code from a thrown error (e.g. `SessionError.code`, a Node error code).
|
|
28
|
+
* Walks the `cause` chain because the harness wraps lower-level errors (e.g. a `SessionError("conflict")`
|
|
29
|
+
* append failure surfaces as an `AgentHarnessError("unknown")` whose cause is the real one) — so we
|
|
30
|
+
* prefer the first specific code over a generic `"unknown"` wrapper.
|
|
31
|
+
*/
|
|
32
|
+
export declare function errorCodeOf(err: unknown): string | undefined;
|
|
33
|
+
/** A thrown failure's terminal account — its code ({@link errorCodeOf}), its sentence (the seat's own describing of the
|
|
34
|
+
* thrown value, `text`, through the secret word list: a throw's message is the thrower's text, and a credential in it
|
|
35
|
+
* must not reach the result any more than one in its `detail`), and, when the coded link's throw site stated a
|
|
36
|
+
* structured `detail`, the `coded` account of it. One reading for every seat that turns a throw into a `failed`
|
|
37
|
+
* terminal (the run's arbitration in `assemble-result.ts` and the stream lane's settle backstop). */
|
|
38
|
+
export declare function thrownFailureOf(err: unknown, text: string): {
|
|
39
|
+
code?: string;
|
|
40
|
+
message: string;
|
|
41
|
+
detail?: TerminalFailureDetail;
|
|
42
|
+
};
|
|
43
|
+
/** The completion's one account: the final turn ended on a provider word the brain does not read (the turn was kept
|
|
44
|
+
* and the run announced the word) — stated beside the completion, in the echo shape the brain carried it in. */
|
|
45
|
+
export declare function completedTerminalOf(final: AssistantMessage | undefined): Extract<TerminalCause, {
|
|
46
|
+
kind: "completed";
|
|
47
|
+
}>;
|
|
48
|
+
export {};
|