@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
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { combinePolicies } from "./tool-policy.js";
|
|
2
2
|
import { clampPermissionMode } from "./ask-origin.js";
|
|
3
|
+
import { CLAMP_SEATS, composeClampSeat, loosensClampSeat } from "./child-clamp-seats.js";
|
|
3
4
|
export class TaskSpecTightenError extends Error {
|
|
4
5
|
constructor(message) {
|
|
5
6
|
super(message);
|
|
@@ -21,34 +22,28 @@ export function tightenTaskSpec(base, overrides) {
|
|
|
21
22
|
merged[field] = [...new Set([...(b ?? []), ...(o ?? [])])];
|
|
22
23
|
}
|
|
23
24
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
{
|
|
26
|
+
const b = base.allowTools;
|
|
27
|
+
const o = overrides.allowTools;
|
|
28
|
+
if (b !== undefined && o !== undefined && !b.includes("*")) {
|
|
29
|
+
const wider = o.filter((entry) => !b.includes(entry));
|
|
30
|
+
if (wider.length > 0)
|
|
31
|
+
throw new TaskSpecTightenError(`tightenTaskSpec: cannot widen allowTools beyond the base list (override names ${JSON.stringify(wider)}; the override may only narrow)`);
|
|
30
32
|
}
|
|
33
|
+
const kept = o ?? b;
|
|
34
|
+
if (kept !== undefined)
|
|
35
|
+
merged.allowTools = [...kept];
|
|
36
|
+
else
|
|
37
|
+
delete merged.allowTools;
|
|
31
38
|
}
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
if (seen.has(key))
|
|
38
|
-
continue;
|
|
39
|
-
seen.add(key);
|
|
40
|
-
union.push(e);
|
|
39
|
+
for (const seat of CLAMP_SEATS) {
|
|
40
|
+
const b = base[seat];
|
|
41
|
+
const o = overrides[seat];
|
|
42
|
+
if (loosensClampSeat(seat, b, o)) {
|
|
43
|
+
throw new TaskSpecTightenError(`tightenTaskSpec: cannot loosen ${seat} from ${JSON.stringify(b)} to ${JSON.stringify(o)} (override may only tighten)`);
|
|
41
44
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
if (base.handsReadOnly === true && overrides.handsReadOnly === false) {
|
|
45
|
-
throw new TaskSpecTightenError("tightenTaskSpec: cannot loosen handsReadOnly from true to false (override may only tighten)");
|
|
46
|
-
}
|
|
47
|
-
if (base.handsReadOnly !== undefined || overrides.handsReadOnly !== undefined) {
|
|
48
|
-
merged.handsReadOnly = base.handsReadOnly === true || overrides.handsReadOnly === true;
|
|
49
|
-
}
|
|
50
|
-
if (base.approvalReach !== undefined || overrides.approvalReach !== undefined) {
|
|
51
|
-
merged.approvalReach = base.approvalReach === "none" || overrides.approvalReach === "none" ? "none" : (overrides.approvalReach ?? base.approvalReach);
|
|
45
|
+
if (b !== undefined || o !== undefined)
|
|
46
|
+
Object.assign(merged, { [seat]: composeClampSeat(seat, b, o) });
|
|
52
47
|
}
|
|
53
48
|
if (base.permissionMode !== undefined && overrides.permissionMode !== undefined) {
|
|
54
49
|
const { effective, clamped } = clampPermissionMode(overrides.permissionMode, base.permissionMode);
|
|
@@ -55,16 +55,14 @@ export declare const TOOL_FACES: Readonly<Record<string, ToolFaceDeclaration>>;
|
|
|
55
55
|
*/
|
|
56
56
|
export declare const ENGINE_BUILTIN_TOOL_NAMES: readonly string[];
|
|
57
57
|
/**
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
58
|
+
* EVERY tool the catalog describes, once per wire name, with the other spellings it answers to — the engine's side of the one
|
|
59
|
+
* universe a delegated child's tool-name lists govern (beside the tools the delegation tool hands it and the protocol tools
|
|
60
|
+
* its spawning run mounts). The spawn reads this set rather than a list of its own: a definition a catalog row adds later is
|
|
61
|
+
* governed the day it lands, whatever band mounts it.
|
|
62
62
|
*/
|
|
63
|
-
export declare const
|
|
63
|
+
export declare const ENGINE_TOOLS: ReadonlyArray<{
|
|
64
64
|
readonly name: string;
|
|
65
65
|
readonly aliases?: readonly string[];
|
|
66
66
|
}>;
|
|
67
|
-
/** The wire names of {@link HAND_TOOLS}. */
|
|
68
|
-
export declare const HAND_TOOL_NAMES: readonly string[];
|
|
69
67
|
/** Is this name one the engine mounts itself ({@link ENGINE_BUILTIN_TOOL_NAMES})? A caller tool, an MCP tool or a skill tool is not. */
|
|
70
68
|
export declare function isEngineBuiltinToolName(name: string): boolean;
|
|
@@ -110,14 +110,14 @@ export const TOOL_CATALOG_ENTRIES = [
|
|
|
110
110
|
{ id: "task-output", name: "TaskOutput", source: "builtin", definedIn: "src/core/task-registry.ts", mountedBy: ["delegation"], cards: ["task-output"], face: { family: "delegate", effect: "read", contract: TASK_OUTPUT_CONTRACT } },
|
|
111
111
|
{ id: "task-stop", name: "TaskStop", source: "builtin", definedIn: "src/core/task-registry.ts", mountedBy: ["delegation"], cards: ["task-stop"], face: { family: "delegate", effect: "write", contract: TASK_STOP_CONTRACT } },
|
|
112
112
|
{ id: "monitor", name: "Monitor", source: "builtin", definedIn: "src/tools/monitor.ts", mountedBy: ["backgroundTasks"], cards: ["monitor-start", "readonly_out_of_root", "read_unestablished"], face: { family: "other", effect: "write", contract: c("core.monitor@1"), ruleFace: shellRuleFace(["command", "description", "timeout_ms", "persistent"]), offloadThresholdChars: 10_000 } },
|
|
113
|
-
{ id: "send-message", name: "SendMessage", source: "builtin", definedIn: "src/agents/send-message-tool.ts", mountedBy: ["delegation", "hostInternals", "peerLane"], cards: ["send-message"], face: { family: "protocol", effect: "write", contract: c("core.send_message@1") } },
|
|
113
|
+
{ id: "send-message", name: "SendMessage", protocol: ["teammate"], source: "builtin", definedIn: "src/agents/send-message-tool.ts", mountedBy: ["delegation", "hostInternals", "peerLane"], cards: ["send-message"], face: { family: "protocol", effect: "write", contract: c("core.send_message@1") } },
|
|
114
114
|
{ id: "agent-transcript", name: "AgentTranscript", source: "builtin", definedIn: "src/agents/agent-transcript-tool.ts", mountedBy: ["delegation"], cards: ["agent-transcript"], face: { family: "delegate", effect: "read", contract: c("core.agent_transcript@1") } },
|
|
115
115
|
{ id: "list-agents", name: "ListAgents", source: "builtin", definedIn: "src/agents/list-agents-tool.ts", mountedBy: ["delegation", "peerLane"], cards: ["list-agents"], face: { family: "protocol", effect: "read", aliases: ["ListPeers"], contract: c("core.list_agents@1") } },
|
|
116
116
|
{ id: "read-inbox", name: "ReadInbox", source: "builtin", definedIn: "src/agents/read-inbox-tool.ts", mountedBy: ["peerLane"], cards: ["read-inbox"], face: { family: "protocol", effect: "read", contract: c("core.read_inbox@1"), offload: false, budgetExempt: true } },
|
|
117
117
|
{ id: "workflow", name: "Workflow", source: "builtin", definedIn: "src/orchestration/run-workflow-tool.ts", mountedBy: ["workflow"], cards: ["workflow-run"], face: { family: "delegate", effect: "write", contract: c("core.workflow@1") } },
|
|
118
|
-
{ id: "report-blocked", name: "ReportBlocked", source: "builtin", definedIn: "src/core/runner/synthetic-tools.ts", mountedBy: ["always"], cards: [], face: { family: "scaffold", effect: "read", contract: c("core.report_blocked@1") } },
|
|
118
|
+
{ id: "report-blocked", name: "ReportBlocked", protocol: ["delegated"], source: "builtin", definedIn: "src/core/runner/synthetic-tools.ts", mountedBy: ["always"], cards: [], face: { family: "scaffold", effect: "read", contract: c("core.report_blocked@1") } },
|
|
119
119
|
{ id: "report-findings", name: "ReportFindings", source: "builtin", definedIn: "src/core/runner/synthetic-tools.ts", mountedBy: ["always"], cards: ["report-findings"], face: { family: "scaffold", effect: "read", contract: c("core.report_findings@1") } },
|
|
120
|
-
{ id: "structured-output", name: "StructuredOutput", source: "synthetic", definedIn: "src/core/runner/synthetic-tools.ts", mountedBy: ["optional"], cards: [], face: { family: "scaffold", effect: "read", contract: c("core.structured_output@1") } },
|
|
120
|
+
{ id: "structured-output", name: "StructuredOutput", protocol: ["structured"], source: "synthetic", definedIn: "src/core/runner/synthetic-tools.ts", mountedBy: ["optional"], cards: [], face: { family: "scaffold", effect: "read", contract: c("core.structured_output@1") } },
|
|
121
121
|
{ id: "skill", name: "Skill", source: "builtin", definedIn: "src/core/runner/synthetic-tools.ts", mountedBy: ["optional"], cards: [], face: { family: "scaffold", effect: "read", contract: c("core.skill@1") } },
|
|
122
122
|
{ id: "read-tool-result", name: "ReadToolResult", source: "builtin", definedIn: "src/core/tool-result-store.ts", mountedBy: ["optional"], cards: [], face: { family: "scaffold", effect: "read", contract: c("core.read_tool_result@1"), budgetExempt: true } },
|
|
123
123
|
{ id: "tool-search", name: "ToolSearch", source: "builtin", definedIn: "src/core/runner/tool-disclosure.ts", mountedBy: ["optional"], cards: ["tool-search"], face: { family: "scaffold", effect: "read", contract: c("core.tool_search@1") } },
|
|
@@ -130,9 +130,9 @@ export const TOOL_CATALOG_ENTRIES = [
|
|
|
130
130
|
{ id: "memory-index", name: "memory_index", source: "builtin", definedIn: "src/core/memory-engine/tools.ts", mountedBy: ["memory"], cards: [], face: { family: "memory", effect: "read", contentOrigin: "local", contract: c("core.memory_index@1", "2"), offload: false } },
|
|
131
131
|
{ id: "memory-list", name: "memory_list", source: "builtin", definedIn: "src/core/shared-memory/tools.ts", mountedBy: ["memory"], cards: [], face: { family: "memory", effect: "read", contract: c("core.memory_list@1"), offload: false } },
|
|
132
132
|
{ id: "memory-read", name: "memory_read", source: "builtin", definedIn: "src/core/shared-memory/tools.ts", mountedBy: ["memory"], cards: [], face: { family: "memory", effect: "read", contract: c("core.memory_read@1"), offload: false } },
|
|
133
|
-
{ id: "cron-create", name: "CronCreate", source: "builtin", definedIn: "src/tools/scheduler-tools.ts", mountedBy: ["scheduler"], cards: ["cron-create"], face: { family: "other", effect: "write", contract: c("core.cron_create@1") } },
|
|
134
|
-
{ id: "cron-delete", name: "CronDelete", source: "builtin", definedIn: "src/tools/scheduler-tools.ts", mountedBy: ["scheduler"], cards: ["cron-delete"], face: { family: "other", effect: "idempotent", contract: c("core.cron_delete@1") } },
|
|
135
|
-
{ id: "cron-list", name: "CronList", source: "builtin", definedIn: "src/tools/scheduler-tools.ts", mountedBy: ["scheduler"], cards: ["cron-list"], face: { family: "other", effect: "read", contract: c("core.cron_list@1") } },
|
|
133
|
+
{ id: "cron-create", name: "CronCreate", protocol: ["teammate"], source: "builtin", definedIn: "src/tools/scheduler-tools.ts", mountedBy: ["scheduler"], cards: ["cron-create"], face: { family: "other", effect: "write", contract: c("core.cron_create@1") } },
|
|
134
|
+
{ id: "cron-delete", name: "CronDelete", protocol: ["teammate"], source: "builtin", definedIn: "src/tools/scheduler-tools.ts", mountedBy: ["scheduler"], cards: ["cron-delete"], face: { family: "other", effect: "idempotent", contract: c("core.cron_delete@1") } },
|
|
135
|
+
{ id: "cron-list", name: "CronList", protocol: ["teammate"], source: "builtin", definedIn: "src/tools/scheduler-tools.ts", mountedBy: ["scheduler"], cards: ["cron-list"], face: { family: "other", effect: "read", contract: c("core.cron_list@1") } },
|
|
136
136
|
{ id: "schedule-wakeup", name: "ScheduleWakeup", source: "builtin", definedIn: "src/tools/scheduler-tools.ts", mountedBy: ["scheduler"], cards: ["schedule-wakeup"], face: { family: "other", effect: "write", contract: c("core.schedule_wakeup@1") } },
|
|
137
137
|
{
|
|
138
138
|
id: "web-fetch", name: "WebFetch", source: "builtin", definedIn: "src/tools/web.ts", mountedBy: ["scenario"], cards: ["web-fetch"],
|
|
@@ -143,13 +143,13 @@ export const TOOL_CATALOG_ENTRIES = [
|
|
|
143
143
|
face: { family: "web", effect: "read", contentOrigin: "external", contract: c("core.web_search@1"), ruleFace: { primaryParams: ["query"] }, renderHints: { summaryParams: ["query"] }, compactable: true },
|
|
144
144
|
},
|
|
145
145
|
{ id: "todo-write", name: TODO_WRITE_TOOL_NAME, source: "builtin", definedIn: "src/tools/todo.ts", mountedBy: ["scenario"], cards: ["todo"], modelGate: "task-scaffold", face: { family: "plan", effect: "idempotent", contract: c("core.todo_write@1") } },
|
|
146
|
-
{ id: "task-create", name: TASK_CREATE_TOOL_NAME, source: "builtin", definedIn: "src/tools/task-list.ts", mountedBy: ["scenario"], cards: ["task"], modelGate: "task-scaffold", face: { family: "plan", effect: "write", contract: c("core.task_create@1") } },
|
|
147
|
-
{ id: "task-get", name: TASK_GET_TOOL_NAME, source: "builtin", definedIn: "src/tools/task-list.ts", mountedBy: ["scenario"], cards: ["task"], modelGate: "task-scaffold", face: { family: "plan", effect: "read", contract: c("core.task_get@1") } },
|
|
148
|
-
{ id: "task-update", name: TASK_UPDATE_TOOL_NAME, source: "builtin", definedIn: "src/tools/task-list.ts", mountedBy: ["scenario"], cards: ["task"], modelGate: "task-scaffold", face: { family: "plan", effect: "idempotent", contract: c("core.task_update@1") } },
|
|
149
|
-
{ id: "task-list", name: TASK_LIST_TOOL_NAME, source: "builtin", definedIn: "src/tools/task-list.ts", mountedBy: ["scenario"], cards: ["task-list"], modelGate: "task-scaffold", face: { family: "plan", effect: "read", contract: c("core.task_list@1") } },
|
|
146
|
+
{ id: "task-create", name: TASK_CREATE_TOOL_NAME, protocol: ["teammate"], protocolUnderCeiling: true, source: "builtin", definedIn: "src/tools/task-list.ts", mountedBy: ["scenario"], cards: ["task"], modelGate: "task-scaffold", face: { family: "plan", effect: "write", contract: c("core.task_create@1") } },
|
|
147
|
+
{ id: "task-get", name: TASK_GET_TOOL_NAME, protocol: ["teammate"], protocolUnderCeiling: true, source: "builtin", definedIn: "src/tools/task-list.ts", mountedBy: ["scenario"], cards: ["task"], modelGate: "task-scaffold", face: { family: "plan", effect: "read", contract: c("core.task_get@1") } },
|
|
148
|
+
{ id: "task-update", name: TASK_UPDATE_TOOL_NAME, protocol: ["teammate"], protocolUnderCeiling: true, source: "builtin", definedIn: "src/tools/task-list.ts", mountedBy: ["scenario"], cards: ["task"], modelGate: "task-scaffold", face: { family: "plan", effect: "idempotent", contract: c("core.task_update@1") } },
|
|
149
|
+
{ id: "task-list", name: TASK_LIST_TOOL_NAME, protocol: ["teammate"], protocolUnderCeiling: true, source: "builtin", definedIn: "src/tools/task-list.ts", mountedBy: ["scenario"], cards: ["task-list"], modelGate: "task-scaffold", face: { family: "plan", effect: "read", contract: c("core.task_list@1") } },
|
|
150
150
|
{ id: "agent", name: "Agent", source: "builtin", definedIn: "src/agents/subagent.ts", mountedBy: ["scenario"], cards: ["agent", "fork"], face: { family: "delegate", contentOrigin: "local", contract: c("core.agent@1") } },
|
|
151
|
-
{ id: "observer-report", name: "ObserverReport", source: "builtin", definedIn: "src/agents/observer.ts", mountedBy: ["scenario"], cards: [], face: { family: "scaffold", effect: "write", contract: c("core.observer_report@1") } },
|
|
152
|
-
{ id: "declare-done", name: "DeclareDone", source: "builtin", definedIn: "src/orchestration/goal.ts", mountedBy: ["scenario"], cards: [], face: { family: "scaffold", effect: "read" } },
|
|
151
|
+
{ id: "observer-report", name: "ObserverReport", protocol: ["observer"], source: "builtin", definedIn: "src/agents/observer.ts", mountedBy: ["scenario"], cards: [], face: { family: "scaffold", effect: "write", contract: c("core.observer_report@1") } },
|
|
152
|
+
{ id: "declare-done", name: "DeclareDone", protocol: ["goal"], source: "builtin", definedIn: "src/orchestration/goal.ts", mountedBy: ["scenario"], cards: [], face: { family: "scaffold", effect: "read" } },
|
|
153
153
|
];
|
|
154
154
|
export const ENGINE_CARDS = Object.freeze({
|
|
155
155
|
mcp: "src/core/mcp.ts",
|
|
@@ -182,11 +182,10 @@ function deepFreeze(value) {
|
|
|
182
182
|
deepFreeze(TOOL_CATALOG_ENTRIES);
|
|
183
183
|
export const TOOL_FACES = Object.freeze(Object.fromEntries(TOOL_CATALOG_ENTRIES.map((e) => [e.id, e.face])));
|
|
184
184
|
export const ENGINE_BUILTIN_TOOL_NAMES = Object.freeze([...new Set(TOOL_CATALOG_ENTRIES.filter((e) => e.source === "builtin").map((e) => e.name))]);
|
|
185
|
-
export const
|
|
186
|
-
const aliases = [...new Set(TOOL_CATALOG_ENTRIES.filter((e) => e.name === name
|
|
185
|
+
export const ENGINE_TOOLS = Object.freeze([...new Set(TOOL_CATALOG_ENTRIES.map((e) => e.name))].map((name) => {
|
|
186
|
+
const aliases = [...new Set(TOOL_CATALOG_ENTRIES.filter((e) => e.name === name).flatMap((e) => e.face.aliases ?? []))];
|
|
187
187
|
return Object.freeze(aliases.length > 0 ? { name, aliases: Object.freeze(aliases) } : { name });
|
|
188
188
|
}));
|
|
189
|
-
export const HAND_TOOL_NAMES = Object.freeze(HAND_TOOLS.map((t) => t.name));
|
|
190
189
|
export function isEngineBuiltinToolName(name) {
|
|
191
190
|
return ENGINE_BUILTIN_TOOL_NAMES.includes(name);
|
|
192
191
|
}
|
package/dist/core/tool-face.d.ts
CHANGED
|
@@ -42,6 +42,12 @@ import type { AssertAllKeysHandled } from "./ask-origin.js";
|
|
|
42
42
|
* mounting the card (design/388 §2.5 boundary ①). */
|
|
43
43
|
export declare const TOOL_APPROVAL_CARDS: readonly ["file-edit", "file-write", "notebook-edit", "shell", "fetch", "plan", "question", "generic"];
|
|
44
44
|
export type ToolApprovalCard = (typeof TOOL_APPROVAL_CARDS)[number];
|
|
45
|
+
/** Membership in the closed set — the one screen a stored or declared card word passes before it is read. */
|
|
46
|
+
export declare function isToolApprovalCard(word: unknown): word is ToolApprovalCard;
|
|
47
|
+
/** The cards only an engine-defined tool owns: a caller or protocol tool cannot declare one, and the card is minted
|
|
48
|
+
* from the engine's own judgment of the call, never from a row's declaration. */
|
|
49
|
+
export declare const RESERVED_APPROVAL_CARDS: readonly ["question", "plan"];
|
|
50
|
+
export type ReservedApprovalCard = (typeof RESERVED_APPROVAL_CARDS)[number];
|
|
45
51
|
/** How a path-targeting tool touches its target. `read` never enters a write-confinement face. */
|
|
46
52
|
export declare const TOOL_PATH_ACCESSES: readonly ["read", "create", "edit"];
|
|
47
53
|
export type ToolPathAccess = (typeof TOOL_PATH_ACCESSES)[number];
|
|
@@ -182,6 +188,7 @@ export interface ToolRenderHints {
|
|
|
182
188
|
activity?: string;
|
|
183
189
|
summaryParams?: readonly string[];
|
|
184
190
|
resultCards?: readonly string[];
|
|
191
|
+
/** The card family this tool asks under; absent reads `generic`. `question` / `plan` are the engine's own tools' cards — a declaration of either is refused. */
|
|
185
192
|
approvalCard?: ToolApprovalCard;
|
|
186
193
|
}
|
|
187
194
|
/**
|
|
@@ -217,6 +224,39 @@ export interface ToolFaceDeclaration {
|
|
|
217
224
|
compactable?: true;
|
|
218
225
|
budgetExempt?: true;
|
|
219
226
|
}
|
|
227
|
+
/**
|
|
228
|
+
* The kinds of leg a run can be, as far as which tools a leg itself relies on: a delegated child (every lane a delegation
|
|
229
|
+
* tool, a workflow or a team spawns), a NAMED delegated child (a teammate), an iteration of a goal loop, an observer sidecar,
|
|
230
|
+
* a run with an output schema (it finishes by submitting through the structured-output tool). A catalog row's
|
|
231
|
+
* {@link ToolCatalogEntry.protocol} names the kinds whose legs carry that tool as part of their protocol.
|
|
232
|
+
*/
|
|
233
|
+
export declare const TOOL_LEG_KINDS: readonly ["delegated", "teammate", "goal", "observer", "structured"];
|
|
234
|
+
export type ToolLegKind = (typeof TOOL_LEG_KINDS)[number];
|
|
235
|
+
/**
|
|
236
|
+
* One layer of a tool selector, as data: an allowed-tools list (absent = no allowlist on this layer) and a denied-tools list,
|
|
237
|
+
* each a frozen copy of the entries a list was written with. A run's own layer is its `allowTools` and `excludeTools`; the
|
|
238
|
+
* layers above it are the ones the run that spawned it was bounded by, plus that run's own.
|
|
239
|
+
*/
|
|
240
|
+
export interface ToolSelectorLayer {
|
|
241
|
+
readonly allow?: readonly string[];
|
|
242
|
+
readonly deny: readonly string[];
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* The compiled tool selector of one run — the one answer to "is this tool available on this run", read at the roster valve
|
|
246
|
+
* and on every later roster change (an MCP refresh or re-dial, the deferred-search lane), and handed down as the ceiling of
|
|
247
|
+
* every run this one spawns (`layers`). A tool is admitted when it is a protocol tool of this run's leg kind, or when every
|
|
248
|
+
* layer admits it: the layer's allowlist (if any) reaches it and its denylist does not.
|
|
249
|
+
*/
|
|
250
|
+
export interface ToolSelector {
|
|
251
|
+
readonly layers: readonly ToolSelectorLayer[];
|
|
252
|
+
admits(tool: {
|
|
253
|
+
readonly name: string;
|
|
254
|
+
readonly aliases?: readonly string[];
|
|
255
|
+
}): boolean;
|
|
256
|
+
/** Can ANY tool of the protocol peer whose minted prefix is `prefix` (`mcp__srv__`) be admitted — read off the lists alone,
|
|
257
|
+
* never off what the peer lists now, so a tool the peer lists later is judged by the same answer. */
|
|
258
|
+
admitsPeer(prefix: string): boolean;
|
|
259
|
+
}
|
|
220
260
|
/**
|
|
221
261
|
* One row of the static tool catalog (design/388 §2.1 "静态目录"). Keyed by DEFINITION identity, not by
|
|
222
262
|
* name: two definitions may share a wire name (the full and the read-only shell both answer to `Bash`),
|
|
@@ -240,6 +280,13 @@ export interface ToolCatalogEntry {
|
|
|
240
280
|
face: ToolFaceDeclaration;
|
|
241
281
|
/** A `modelGate` class the default-bundle assembler stamps on this definition's default arm. */
|
|
242
282
|
modelGate?: string;
|
|
283
|
+
/** The leg kinds whose legs rely on this tool as part of their protocol: on such a leg the tool's availability is not a
|
|
284
|
+
* selector's to decide (an allowlist need not name it), and a denylist that reaches it there is a contradiction the run
|
|
285
|
+
* refuses at prepare. */
|
|
286
|
+
protocol?: readonly ToolLegKind[];
|
|
287
|
+
/** A protocol row the leg shares with the run that spawned it (the team task-list family a teammate shares with its leader): on its
|
|
288
|
+
* leg the leg's OWN lists do not decide it, but the ceiling still does — the leg holds it exactly when its spawner may. */
|
|
289
|
+
protocolUnderCeiling?: true;
|
|
243
290
|
}
|
|
244
291
|
/**
|
|
245
292
|
* The band-membership table over the mount tags: a host derives its hand band as the definitions listed under a
|
package/dist/core/tool-face.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
export const TOOL_FAMILIES = Object.freeze(["shell", "file-read", "file-write", "search", "web", "delegate", "plan", "scaffold", "memory", "protocol", "other"]);
|
|
2
2
|
export const TOOL_MOUNT_TAGS = Object.freeze(["hands", "backgroundTasks", "workflow", "delegation", "hostInternals", "peerLane", "scheduler", "memory", "scenario", "always", "optional"]);
|
|
3
3
|
export const TOOL_APPROVAL_CARDS = Object.freeze(["file-edit", "file-write", "notebook-edit", "shell", "fetch", "plan", "question", "generic"]);
|
|
4
|
+
export function isToolApprovalCard(word) {
|
|
5
|
+
return typeof word === "string" && TOOL_APPROVAL_CARDS.includes(word);
|
|
6
|
+
}
|
|
7
|
+
export const RESERVED_APPROVAL_CARDS = Object.freeze(["question", "plan"]);
|
|
4
8
|
export const TOOL_PATH_ACCESSES = Object.freeze(["read", "create", "edit"]);
|
|
5
9
|
export const TOOL_PATH_BASES = Object.freeze(["cwd", "root"]);
|
|
6
10
|
export const TOOL_PATH_ABSENCES = Object.freeze(["none", "base"]);
|
|
@@ -20,6 +24,7 @@ export const TOOL_KEYS_MAX = 1024;
|
|
|
20
24
|
export const RENDER_HINT_MAX_CHARS = 64;
|
|
21
25
|
export const RENDER_HINT_ACTIVITY_MAX_CHARS = 32;
|
|
22
26
|
export const RENDER_HINT_MAX_LIST = 16;
|
|
27
|
+
export const TOOL_LEG_KINDS = Object.freeze(["delegated", "teammate", "goal", "observer", "structured"]);
|
|
23
28
|
export const MOUNT_TAG_IN_HANDS_BAND = {
|
|
24
29
|
hands: true,
|
|
25
30
|
backgroundTasks: true,
|
|
@@ -76,12 +76,12 @@ export declare function isModelGatedForClass(modelId: string, rule: ToolModelGat
|
|
|
76
76
|
export declare function assertRestoreGatedToolsValue(value: unknown): asserts value is true | readonly string[] | undefined;
|
|
77
77
|
/** Doors-facing decision (built + applied inside `prepareConfigDoors`' synchronous stretch —
|
|
78
78
|
* decision and application share one atomic window, no drift gap). */
|
|
79
|
-
export interface ToolModelGateDecision {
|
|
79
|
+
export interface ToolModelGateDecision<T extends ToolSpec = ToolSpec> {
|
|
80
80
|
/** Present ⇔ at least one entry was removed: the fresh, PRIVATE survivor array `spec.tools` is
|
|
81
81
|
* rebound to (a caller mutating its original live array afterwards can neither re-add a removed
|
|
82
82
|
* entry nor displace anything — there are no indices left to misalign). `undefined` = no
|
|
83
83
|
* removal, the spec is left untouched. */
|
|
84
|
-
survivors:
|
|
84
|
+
survivors: T[] | undefined;
|
|
85
85
|
/** gate-class → removed wire names (sorted, unique) — the removal-notice payload. */
|
|
86
86
|
removedByClass: ReadonlyMap<string, readonly string[]>;
|
|
87
87
|
/** Stamped classes with no row in the merged table — announce-once material (the loud half of
|
|
@@ -116,10 +116,10 @@ export interface ToolModelGateDecision {
|
|
|
116
116
|
* - the exclusion valve (`excludeTools`, applied downstream at the roster splice) ALWAYS wins in
|
|
117
117
|
* the result: no restore channel resurrects an excluded name.
|
|
118
118
|
*/
|
|
119
|
-
export declare function applyToolModelGate(input: {
|
|
120
|
-
tools: ReadonlyArray<
|
|
119
|
+
export declare function applyToolModelGate<T extends ToolSpec>(input: {
|
|
120
|
+
tools: ReadonlyArray<T> | undefined;
|
|
121
121
|
modelId: string;
|
|
122
122
|
depsSeat: unknown;
|
|
123
123
|
restoreGated: true | readonly string[] | undefined;
|
|
124
124
|
envRaw: string | undefined;
|
|
125
|
-
}): ToolModelGateDecision
|
|
125
|
+
}): ToolModelGateDecision<T>;
|
|
@@ -10,8 +10,9 @@ import { type ProtocolNamespace } from "./protocol-table.js";
|
|
|
10
10
|
* rather than carried.
|
|
11
11
|
* - `canonicalToolName` is gone with it: with the mapping cleared it was the identity function, and
|
|
12
12
|
* keeping an identity shim invites the next mapping to grow back silently.
|
|
13
|
-
* - `TOMBSTONED_TOOLS` (per-name re-education
|
|
14
|
-
*
|
|
13
|
+
* - `TOMBSTONED_TOOLS` (a second table of per-name re-education prose) is gone. A CALL to a retired name is
|
|
14
|
+
* told what the one table here says about it ({@link judgeToolNameMiss}): the miss is `expected-absent`
|
|
15
|
+
* with the successor, where any other unknown name stays the generic roster miss.
|
|
15
16
|
*
|
|
16
17
|
* What REMAINS is validation data: {@link RETIRED_TOOL_NAMES} maps every name the engine ever
|
|
17
18
|
* retired to a one-line guidance string, and {@link judgeRuleToolName} is the ONE reading of it a rule's
|
|
@@ -78,8 +79,31 @@ export declare function splitNamespacedName(name: string): {
|
|
|
78
79
|
} | undefined;
|
|
79
80
|
/** See {@link RuleToolNameVerdict}. Pure; the one answer to "is this rule's tool name a name that reaches no tool". */
|
|
80
81
|
export declare function judgeRuleToolName(name: string, roster: ReadonlySet<string>): RuleToolNameVerdict;
|
|
82
|
+
/** The two kinds of tool-name miss — a closed set. `unknown`: the name is none the engine ever mounted (a typo, a
|
|
83
|
+
* guess). `expected-absent`: the name is one the engine RETIRED ({@link RETIRED_TOOL_NAMES}), so its absence is no
|
|
84
|
+
* surprise and the table says what replaced it (CC 2.1.296 spells the same two words for its render-time miss). */
|
|
85
|
+
export declare const TOOL_MISS_KINDS: readonly ["unknown", "expected-absent"];
|
|
86
|
+
declare const UNKNOWN_MISS: "unknown", ABSENT_MISS: "expected-absent";
|
|
87
|
+
/** What {@link judgeToolNameMiss} answers: the kind (a {@link TOOL_MISS_KINDS} word) and, for `expected-absent`, the clause. */
|
|
88
|
+
export type ToolNameMiss = {
|
|
89
|
+
readonly kind: typeof UNKNOWN_MISS;
|
|
90
|
+
} | {
|
|
91
|
+
readonly kind: typeof ABSENT_MISS;
|
|
92
|
+
readonly detail: string;
|
|
93
|
+
readonly successor?: string;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* The answer to "a call named `name` matched nothing in `roster`" — the ONE place a tool-call miss is classified:
|
|
97
|
+
* `expected-absent` (with the model-facing `detail`) for a retired name, `unknown` for everything else. It reads the
|
|
98
|
+
* table through {@link judgeRuleToolName}, so a rule's tool name and a call's tool name are judged by the same reading.
|
|
99
|
+
* The detail is the successor (`renamed "<name>"`) when the table names one AND this run mounts it — a successor the
|
|
100
|
+
* roster lacks (plan mode, no shell) is named as unavailable, never offered as the way forward, and is not returned as
|
|
101
|
+
* `successor` — else the table's own line (`folded into …` / `removed — …`), the grammar in the module header.
|
|
102
|
+
*/
|
|
103
|
+
export declare function judgeToolNameMiss(name: string, roster: ReadonlySet<string>): ToolNameMiss;
|
|
81
104
|
/** The names a run mounts — every tool's primary name and its aliases: the roster {@link judgeRuleToolName} is given. */
|
|
82
105
|
export declare function mountedToolNames(tools: ReadonlyArray<{
|
|
83
106
|
readonly name: string;
|
|
84
107
|
readonly aliases?: readonly string[];
|
|
85
108
|
}>): Set<string>;
|
|
109
|
+
export {};
|
|
@@ -80,6 +80,19 @@ export function judgeRuleToolName(name, roster) {
|
|
|
80
80
|
return carriesNamespaceSeparator(name) ? UNPREFIXED : CURRENT;
|
|
81
81
|
return unmintableSegmentOf(split) ?? CURRENT;
|
|
82
82
|
}
|
|
83
|
+
export const TOOL_MISS_KINDS = Object.freeze(["unknown", "expected-absent"]);
|
|
84
|
+
const [UNKNOWN_MISS, ABSENT_MISS] = TOOL_MISS_KINDS;
|
|
85
|
+
export function judgeToolNameMiss(name, roster) {
|
|
86
|
+
const v = judgeRuleToolName(name, roster);
|
|
87
|
+
if (v.kind !== "retired")
|
|
88
|
+
return { kind: UNKNOWN_MISS };
|
|
89
|
+
const next = v.currentName;
|
|
90
|
+
if (next === undefined)
|
|
91
|
+
return { kind: ABSENT_MISS, detail: v.guidance };
|
|
92
|
+
if (!roster.has(next))
|
|
93
|
+
return { kind: ABSENT_MISS, detail: `renamed to "${next}", which this run does not mount` };
|
|
94
|
+
return { kind: ABSENT_MISS, detail: `renamed to "${next}"`, successor: next };
|
|
95
|
+
}
|
|
83
96
|
export function mountedToolNames(tools) {
|
|
84
97
|
return new Set(tools.flatMap((t) => [t.name, ...(t.aliases ?? [])]));
|
|
85
98
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one reading and the one snapshot of a host-written tool-name list (an agent definition's allowed-tools or denied-tools list,
|
|
3
|
+
* a tool's alias list, a model-id list). The judge before the run, the spawn-time filter, the memory content-origin face and the
|
|
4
|
+
* roster snapshot all meet a list through here, so a hostile container is answered once and the same way everywhere.
|
|
5
|
+
*/
|
|
6
|
+
/** A fixed label of a host value's TYPE for a sentence that must not print or convert the value (`typeof` and the array test only). */
|
|
7
|
+
export declare function valueTypeLabel(value: unknown): string;
|
|
8
|
+
/**
|
|
9
|
+
* How a tool-name list's VALUE (an agent definition's allowed-tools or denied-tools list) reads as a list. A host that reads its
|
|
10
|
+
* definitions from a file can hand over anything, and a list can be hostile as a container (an accessor or a proxy trap that
|
|
11
|
+
* throws, an overridden iterator, holes): it is read BY INDEX over its length, once, into a dense copy — no iterator of the host
|
|
12
|
+
* runs, a hole reads as `undefined` (an entry that is not a string) — and a value that is not an array, or an array whose read
|
|
13
|
+
* throws, is reported as such and never printed or converted.
|
|
14
|
+
*/
|
|
15
|
+
export type ToolNameListReading = {
|
|
16
|
+
readonly kind: "entries";
|
|
17
|
+
readonly entries: readonly unknown[];
|
|
18
|
+
} | {
|
|
19
|
+
readonly kind: "not_a_list";
|
|
20
|
+
readonly type: string;
|
|
21
|
+
} | {
|
|
22
|
+
readonly kind: "unreadable";
|
|
23
|
+
};
|
|
24
|
+
/** What the mount keeps of a list it could not read: one frozen marker, so the judgment and every later reader meet the same
|
|
25
|
+
* failure and never read the host's container again (a list that throws once and answers afterwards must not pass the second look). */
|
|
26
|
+
export declare const UNREADABLE_LIST: object;
|
|
27
|
+
export declare function readToolNameList(value: unknown): ToolNameListReading;
|
|
28
|
+
/** A tool-name list as the mount keeps it: the dense copy when it reads as a list, the failure marker when it cannot be read, else
|
|
29
|
+
* the value itself (not a list: the judge refuses it, and its type never changes). */
|
|
30
|
+
export declare function snapshotToolNameList(value: unknown): unknown;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export function valueTypeLabel(value) {
|
|
2
|
+
if (value === null)
|
|
3
|
+
return "null";
|
|
4
|
+
switch (typeof value) {
|
|
5
|
+
case "string":
|
|
6
|
+
return "a string";
|
|
7
|
+
case "undefined":
|
|
8
|
+
return "undefined";
|
|
9
|
+
case "number":
|
|
10
|
+
return "a number";
|
|
11
|
+
case "boolean":
|
|
12
|
+
return "a boolean";
|
|
13
|
+
case "bigint":
|
|
14
|
+
return "a bigint";
|
|
15
|
+
case "symbol":
|
|
16
|
+
return "a symbol";
|
|
17
|
+
case "function":
|
|
18
|
+
return "a function";
|
|
19
|
+
default:
|
|
20
|
+
try {
|
|
21
|
+
return Array.isArray(value) ? "an array" : "an object";
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return "an object";
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
const isList = (value) => Array.isArray(value);
|
|
29
|
+
export const UNREADABLE_LIST = Object.freeze({});
|
|
30
|
+
export function readToolNameList(value) {
|
|
31
|
+
if (value === UNREADABLE_LIST)
|
|
32
|
+
return { kind: "unreadable" };
|
|
33
|
+
let list;
|
|
34
|
+
try {
|
|
35
|
+
list = isList(value) ? value : undefined;
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return { kind: "not_a_list", type: "an object" };
|
|
39
|
+
}
|
|
40
|
+
if (list === undefined)
|
|
41
|
+
return { kind: "not_a_list", type: valueTypeLabel(value) };
|
|
42
|
+
try {
|
|
43
|
+
const entries = [];
|
|
44
|
+
for (let i = 0; i < list.length; i++)
|
|
45
|
+
entries.push(list[i]);
|
|
46
|
+
return { kind: "entries", entries };
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
return { kind: "unreadable" };
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
export function snapshotToolNameList(value) {
|
|
53
|
+
const read = readToolNameList(value);
|
|
54
|
+
return read.kind === "entries" ? read.entries : read.kind === "unreadable" ? UNREADABLE_LIST : value;
|
|
55
|
+
}
|
|
@@ -193,10 +193,6 @@ export declare const NAME_READINGS: {
|
|
|
193
193
|
readonly rank: "tier";
|
|
194
194
|
readonly file: string;
|
|
195
195
|
};
|
|
196
|
-
readonly "park.syncFirstRoute": {
|
|
197
|
-
readonly kind: "wire";
|
|
198
|
-
readonly file: string;
|
|
199
|
-
};
|
|
200
196
|
readonly "report.riskAxes": {
|
|
201
197
|
readonly kind: "seat";
|
|
202
198
|
readonly rank: "tier";
|
|
@@ -259,11 +255,7 @@ export declare const NAME_READINGS: {
|
|
|
259
255
|
readonly kind: "wire";
|
|
260
256
|
readonly file: string;
|
|
261
257
|
};
|
|
262
|
-
readonly "
|
|
263
|
-
readonly kind: "wire";
|
|
264
|
-
readonly file: string;
|
|
265
|
-
};
|
|
266
|
-
readonly "resume.contentAskRow": {
|
|
258
|
+
readonly "card.reserved": {
|
|
267
259
|
readonly kind: "wire";
|
|
268
260
|
readonly file: string;
|
|
269
261
|
};
|
|
@@ -49,7 +49,6 @@ export const NAME_READINGS = {
|
|
|
49
49
|
"offer.marks": seat("tier", OFFER),
|
|
50
50
|
"offer.marks.egress": any(OFFER),
|
|
51
51
|
"park.riskDescriptor": seat("tier", PARK),
|
|
52
|
-
"park.syncFirstRoute": wire(PARK),
|
|
53
52
|
"report.riskAxes": seat("tier", CHAIN),
|
|
54
53
|
"report.riskAxes.egress": any(CHAIN),
|
|
55
54
|
"report.riskAxes.negatives": seat("member", CHAIN),
|
|
@@ -65,8 +64,7 @@ export const NAME_READINGS = {
|
|
|
65
64
|
"reconcile.orphanEffect": spelling("src/core/session-reconcile.ts"),
|
|
66
65
|
"inherited.questionFloat": wire(CHAIN),
|
|
67
66
|
"inherited.askFace": wire(CHAIN),
|
|
68
|
-
"
|
|
69
|
-
"resume.contentAskRow": wire("src/core/runner/decide-continuation.ts"),
|
|
67
|
+
"card.reserved": wire("src/core/tool-roster.ts"),
|
|
70
68
|
"resume.editRecheckQuestionSkip": wire("src/core/runner/resume-apply.ts"),
|
|
71
69
|
"resume.questionArgsShown": wire("src/core/runner/run-leg.ts"),
|
|
72
70
|
"budget.exemptResult": wire("src/core/tool-result-budget.ts"),
|