@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
package/README.md
CHANGED
|
@@ -44,7 +44,7 @@ const res = await runner.runTask({ objective: "...", model: "main" });
|
|
|
44
44
|
- **Memory engine.** Scoped long-term memory with a pluggable `MemoryBackend`
|
|
45
45
|
(file-backed or Postgres), plus automatic in-context compaction that keeps long runs inside the
|
|
46
46
|
model's context window without losing the thread.
|
|
47
|
-
- **Multi-agent.** Sub-agent delegation,
|
|
47
|
+
- **Multi-agent.** Sub-agent delegation, deterministic `runWorkflow`
|
|
48
48
|
orchestration with durable journals, and opt-in observer agents that monitor and steer a run.
|
|
49
49
|
- **Streaming first.** Every task emits a typed `TaskEvent` stream (reasoning deltas, text deltas,
|
|
50
50
|
tool lifecycle, progress, diagnostics), ready to pipe into SSE via `createTaskServer`.
|
|
@@ -110,7 +110,7 @@ token-by-token, or expose the runner over HTTP + SSE — the
|
|
|
110
110
|
| [04 – Tools and MCP](docs/sdk/04-tools-and-mcp.md) | `defineTool`, the SQL tool, issue-tracker tools, MCP integration |
|
|
111
111
|
| [05 – Streaming and the HTTP Server](docs/sdk/05-streaming-and-http-server.md) | The `TaskEvent` protocol, SSE, `createTaskServer` |
|
|
112
112
|
| [06 – Sessions, Memory, and Compaction](docs/sdk/06-sessions-memory-and-compaction.md) | Session stores, automatic compaction, long-term memory backends |
|
|
113
|
-
| [07 – Multi-Agent](docs/sdk/07-multi-agent.md) | Sub-
|
|
113
|
+
| [07 – Multi-Agent](docs/sdk/07-multi-agent.md) | Sub-agent delegation, multi-perspective discussion via sub-agents, cross-session peer messaging |
|
|
114
114
|
| [08 – Workflows](docs/sdk/08-workflows.md) | Deterministic `runWorkflow` orchestration and observability |
|
|
115
115
|
| [09 – Security and Policies](docs/sdk/09-security-and-policies.md) | Tool policies, approvals, shell gating, human-in-the-loop supervision |
|
|
116
116
|
| [10 – Extension Points](docs/sdk/10-extension-points.md) | Custom brains, session stores, execution environments, Postgres adapters |
|
package/dist/agents/cascade.d.ts
CHANGED
|
@@ -8,15 +8,12 @@ import type { ModelRef, TaskResult, TaskSpec, TaskStatus } from "../core/types.j
|
|
|
8
8
|
*
|
|
9
9
|
* APPLICABILITY: cascade only helps when the gate is **decidable** (a schema check, a verifier model, a
|
|
10
10
|
* concrete assertion). Open-ended "completeness" tasks (find every bug, writing quality) have no oracle —
|
|
11
|
-
* the gate keeps passing the first plausible cheap answer and escalation idles. Those want breadth
|
|
12
|
-
*
|
|
11
|
+
* the gate keeps passing the first plausible cheap answer and escalation idles. Those want breadth
|
|
12
|
+
* (several independent agents and a judge), not a depth ladder.
|
|
13
13
|
*
|
|
14
14
|
* Cost note (design/27 §2): each rung is an independent COLD `runTask` — every escalation repays the
|
|
15
15
|
* full input cost. Cascade wins when (a) the cheap rung usually passes and (b) the prompt isn't so large
|
|
16
16
|
* that the restart tax dominates. It is NOT always cheaper than running the strongest model directly.
|
|
17
|
-
*
|
|
18
|
-
* Boundary vs teacher mode: teacher injects advice and continues the SAME session (recovery); cascade
|
|
19
|
-
* does independent re-runs on a model ladder (breadth). Orthogonal, not merged.
|
|
20
17
|
*/
|
|
21
18
|
/** A gate's verdict: a bare boolean, or `{ pass, diagnostics }` to attach reasoning to `attempts[]`. */
|
|
22
19
|
export type GateVerdict = boolean | {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { terminalProjection } from "../core/runner/terminal-projection.js";
|
|
2
|
+
import type { TerminalCause } from "../core/types.js";
|
|
3
|
+
/**
|
|
4
|
+
* A child run's failure words are its provider's or tool's own text and can carry a credential. Every parent-facing reader of them
|
|
5
|
+
* takes them from here, so they are secret-redacted with `redactSecrets` — the definition `workflow_run.error` uses — once per
|
|
6
|
+
* source shape, before any field bound can clip a token in half, and no face redacts for itself:
|
|
7
|
+
* - {@link childTerminalFace}: a settled child's cause, projected (the report's `error:` line, the card, the task row, the
|
|
8
|
+
* notification's summary and digest);
|
|
9
|
+
* - {@link childThrownText}: the text of a rejected run;
|
|
10
|
+
* - {@link childRejection}: a rejected run's thrown value itself, for the foreground lane, where the tool loop writes the
|
|
11
|
+
* parent's tool result from the thrown value's `message`.
|
|
12
|
+
*/
|
|
13
|
+
export declare const childTerminalFace: (terminal: TerminalCause) => ReturnType<typeof terminalProjection>;
|
|
14
|
+
export declare const childThrownText: (err: unknown) => string;
|
|
15
|
+
/**
|
|
16
|
+
* The thrown value of a rejected child run, re-minted with the redacted sentence: same prototype and own members (`code`,
|
|
17
|
+
* `details`, `errorKind`, `cause`) — only `message` changes. The copy's `stack` is its own, captured here: the original's
|
|
18
|
+
* first line carries the message, so it is not carried over. A value with nothing to redact is returned as it is.
|
|
19
|
+
*/
|
|
20
|
+
export declare const childRejection: (err: unknown) => unknown;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { terminalProjection } from "../core/runner/terminal-projection.js";
|
|
2
|
+
import { thrownText } from "../core/thrown-value.js";
|
|
3
|
+
import { redactSecrets } from "../core/untrusted-egress.js";
|
|
4
|
+
export const childTerminalFace = (terminal) => {
|
|
5
|
+
const face = terminalProjection(terminal);
|
|
6
|
+
return typeof face.errorMessage === "string" ? { ...face, errorMessage: redactSecrets(face.errorMessage) } : face;
|
|
7
|
+
};
|
|
8
|
+
export const childThrownText = (err) => redactSecrets(thrownText(err));
|
|
9
|
+
export const childRejection = (err) => {
|
|
10
|
+
const text = thrownText(err);
|
|
11
|
+
const clean = childThrownText(err);
|
|
12
|
+
if (clean === text)
|
|
13
|
+
return err;
|
|
14
|
+
if (typeof err !== "object" || err === null)
|
|
15
|
+
return clean;
|
|
16
|
+
try {
|
|
17
|
+
const copy = new Error(clean);
|
|
18
|
+
Object.setPrototypeOf(copy, Object.getPrototypeOf(err));
|
|
19
|
+
for (const key of Reflect.ownKeys(err)) {
|
|
20
|
+
if (key !== "message" && key !== "stack")
|
|
21
|
+
Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(err, key));
|
|
22
|
+
}
|
|
23
|
+
return copy;
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return new Error(clean);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
@@ -38,15 +38,23 @@ export declare function normalizePeerName(name: string): string;
|
|
|
38
38
|
/** The box-address prefixes of design/385 (`session.<id>` per-session box, `principal.<…>` the
|
|
39
39
|
* cross-principal inbox family). Reserved: a NAME may never spell an address. */
|
|
40
40
|
export declare const PEER_ADDRESS_PREFIXES: readonly string[];
|
|
41
|
+
/** The names that already address a fixed party — CC 2.1.296 `fD` (cli296.js:238093) reads `main`
|
|
42
|
+
* (`Og`: the conversation that spawned the run), `team-lead` (`ca`), `user` (`mxe`) and `system`
|
|
43
|
+
* (`adt`) off the NORMALIZED key, so every spelling that normalizes to one of them is the name.
|
|
44
|
+
* The frames a run speaks (`from`, `teammate_id`, a stop attribution) already carry these four
|
|
45
|
+
* words as parties; a spawn named one of them would speak as that party. */
|
|
46
|
+
export declare const RESERVED_AGENT_NAMES: readonly string[];
|
|
41
47
|
/**
|
|
42
48
|
* design/385 §2.2 namespace protection (CC `qd` in spirit): a candidate spawn/session name is refused
|
|
43
49
|
* when its normalized key would shadow an explicit address — a reserved box prefix, a transport
|
|
44
|
-
* scheme (`uds:` / `bridge:` / `did:`), a socket path, an `@`-bearing team form,
|
|
45
|
-
*
|
|
50
|
+
* scheme (`uds:` / `bridge:` / `did:`), a socket path, an `@`-bearing team form, the `*` broadcast
|
|
51
|
+
* token, one of the {@link RESERVED_AGENT_NAMES} (`reserved_name`) or the shape of an agent id
|
|
52
|
+
* (`agent_id_shape`). Returns the reason, or `undefined` when the name is admissible. Registration-side
|
|
46
53
|
* check (loud refusal at write time); the resolution ladder ranks explicit addresses first regardless.
|
|
54
|
+
* The spawn face (the Agent tool's `name`) refuses on every reason this returns.
|
|
47
55
|
*
|
|
48
56
|
* The socket-path arm is judged on the RAW name AND on its normalized key (CC `QHe` runs its
|
|
49
57
|
* classifier over both): a name that is a socket path in either spelling is refused, since the
|
|
50
58
|
* resolution ladder would read the raw spelling as an address.
|
|
51
59
|
*/
|
|
52
|
-
export declare function reservedPeerNameReason(name: string): "empty" | "address_prefix" | "transport_scheme" | "socket_path" | "at_sign" | "wildcard" | undefined;
|
|
60
|
+
export declare function reservedPeerNameReason(name: string): "empty" | "address_prefix" | "transport_scheme" | "socket_path" | "at_sign" | "wildcard" | "reserved_name" | "agent_id_shape" | undefined;
|
|
@@ -46,6 +46,8 @@ const NAMED_PIPE_RE = /^[\\/]{2}[.?][\\/]pipe[\\/]/i;
|
|
|
46
46
|
function isSocketPathSpelling(text) {
|
|
47
47
|
return SOCKET_PATH_RE.test(text) || NAMED_PIPE_RE.test(text);
|
|
48
48
|
}
|
|
49
|
+
export const RESERVED_AGENT_NAMES = Object.freeze(["main", "team-lead", "user", "system"]);
|
|
50
|
+
const AGENT_ID_SHAPE_RE = /^a(?:[\w-]{1,63}-)?[0-9a-f]{16}$/;
|
|
49
51
|
export function reservedPeerNameReason(name) {
|
|
50
52
|
const key = normalizePeerName(name);
|
|
51
53
|
if (key === "")
|
|
@@ -60,5 +62,9 @@ export function reservedPeerNameReason(name) {
|
|
|
60
62
|
return "transport_scheme";
|
|
61
63
|
if (isSocketPathSpelling(name) || isSocketPathSpelling(key))
|
|
62
64
|
return "socket_path";
|
|
65
|
+
if (RESERVED_AGENT_NAMES.includes(key))
|
|
66
|
+
return "reserved_name";
|
|
67
|
+
if (AGENT_ID_SHAPE_RE.test(key))
|
|
68
|
+
return "agent_id_shape";
|
|
63
69
|
return undefined;
|
|
64
70
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import type { TaskResult } from "../core/types.js";
|
|
2
2
|
/**
|
|
3
3
|
* Shared CUMULATIVE-STATS constructor for the multi-leg agent compositions (cascade rungs, repair-loop
|
|
4
|
-
* attempts,
|
|
5
|
-
*
|
|
4
|
+
* attempts, verify legs). Each runs `runner.runTask` MORE THAN ONCE and must report the OPERATION's totals,
|
|
5
|
+
* not the last leg's.
|
|
6
6
|
*
|
|
7
7
|
* The invariant this exists to hold in ONE place: **every field the accumulator tracks is OVERRIDDEN over
|
|
8
8
|
* the base stats**. A field left un-overridden silently leaks the LAST leg's value dressed up as a
|
|
9
9
|
* cumulative total (the cascade R1-m5 / R3 trap; repair-loop shipped exactly that hole on `humanReview`).
|
|
10
|
-
*
|
|
11
|
-
*
|
|
10
|
+
* Independent copies of this literal is how that hole survived in one copy while the others were fixed —
|
|
11
|
+
* hence one constructor.
|
|
12
12
|
*
|
|
13
|
-
* OWN and NESTED stay DISJOINT (the cascade R-5
|
|
13
|
+
* OWN and NESTED stay DISJOINT (the cascade R-5 convention): a consumer adds
|
|
14
14
|
* `stats.X + stats.nested.X` for the true total; nested cost is never folded into `costMicroUsd`.
|
|
15
15
|
*/
|
|
16
16
|
/** Cumulative delegated-subagent (nested) totals, summed across every leg. */
|
|
@@ -47,14 +47,11 @@ export interface CumulativeStatsAccumulator {
|
|
|
47
47
|
cacheWriteTokens: number;
|
|
48
48
|
cacheWriteTokensLong: number;
|
|
49
49
|
/**
|
|
50
|
-
* Cumulative own LLM cost (micro-USD)
|
|
51
|
-
* zero case on purpose and this constructor does not adjudicate: cascade/repair-loop publish a plain `0`
|
|
52
|
-
* (a run happened, it cost nothing measurable), teacher collapses `0` to `undefined` (the RB-368
|
|
53
|
-
* "unpriced spend is absent, not free" posture). Unifying the two is a BEHAVIOR change, not a refactor.
|
|
50
|
+
* Cumulative own LLM cost (micro-USD): a plain `0` when every leg was priced and cost nothing measurable.
|
|
54
51
|
*
|
|
55
52
|
* Ignored entirely when {@link anyLegUnpriced} is set — see there.
|
|
56
53
|
*/
|
|
57
|
-
costMicroUsd: number
|
|
54
|
+
costMicroUsd: number;
|
|
58
55
|
/**
|
|
59
56
|
* TRUE when ANY contributing leg published no `costMicroUsd`, i.e. it ran on a model with neither a
|
|
60
57
|
* `RunnerDeps.pricing` entry nor a `Model.cost` declaration (`stats.costMicroUsd` is contractually
|
|
@@ -100,11 +97,11 @@ export interface CumulativeStatsTracker {
|
|
|
100
97
|
* Create a {@link CumulativeStatsTracker}.
|
|
101
98
|
*
|
|
102
99
|
* {@link buildCumulativeStats} made the OUTPUT literal single-source, but the INPUT fold stayed copied:
|
|
103
|
-
* cascade / repair-loop
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
100
|
+
* cascade / repair-loop each hand-maintain the same dozen `+=` lines, so a new stats field still has to be
|
|
101
|
+
* remembered in three places — the same duplication one level down from the hole this module exists to
|
|
102
|
+
* close. New call sites take this factory instead. Migrating the two originals onto it is a separate change
|
|
103
|
+
* (their folds are equivalent to this one today, but rewriting shipped compositions is not part of a
|
|
104
|
+
* cost-accounting bug fix).
|
|
108
105
|
*
|
|
109
106
|
* OWN and NESTED stay DISJOINT here too: `add` never folds a leg's `nested.*` into the own totals.
|
|
110
107
|
*/
|
|
@@ -59,7 +59,7 @@ export function createCumulativeStatsTracker() {
|
|
|
59
59
|
acc.outputTokens += s.outputTokens ?? 0;
|
|
60
60
|
acc.cacheWriteTokens += s.cacheWriteTokens ?? 0;
|
|
61
61
|
acc.cacheWriteTokensLong += s.cacheWriteTokensLong ?? 0;
|
|
62
|
-
acc.costMicroUsd
|
|
62
|
+
acc.costMicroUsd += s.costMicroUsd ?? 0;
|
|
63
63
|
if (s.costMicroUsd === undefined)
|
|
64
64
|
acc.anyLegUnpriced = true;
|
|
65
65
|
if (s.costBreakdown) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isToolContentOrigin } from "../core/memory-engine/content-origin.js";
|
|
2
2
|
import { inlineUntrusted } from "../core/untrusted-text.js";
|
|
3
|
-
import { readToolNameList, valueTypeLabel } from "
|
|
3
|
+
import { readToolNameList, valueTypeLabel } from "../core/tool-name-list.js";
|
|
4
4
|
export const EXTRA_TOOL_NAMES_CODE = "config.extra_tool_names";
|
|
5
5
|
export function extraToolNamesError(message, reason) {
|
|
6
6
|
const e = new Error(message);
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import type { ToolSpec } from "../core/types.js";
|
|
1
|
+
import type { McpServerSpec, ToolSpec } from "../core/types.js";
|
|
2
|
+
import type { ToolSelector } from "../core/tool-face.js";
|
|
3
|
+
import type { MountedMcp } from "../core/mounted-mcp.js";
|
|
2
4
|
/**
|
|
3
5
|
* What a delegated child inherits when its delegation tool has no explicit pool (`SubagentToolOptions.inheritedTools`):
|
|
4
|
-
* the parent surface, narrowed at spawn by two laws. The mint of the parent bound
|
|
5
|
-
* reads live here, so the law has one home.
|
|
6
|
+
* the parent surface, narrowed at spawn by two laws, and the parent's MCP declarations. The mint of the parent bound
|
|
7
|
+
* ({@link callerToolMembership}) and the reads live here, so the law has one home. Which of these tools the child may USE is
|
|
8
|
+
* not decided here: its own prepare runs its selector over everything it is handed and mounts.
|
|
6
9
|
*/
|
|
7
|
-
/** The team task-list family
|
|
8
|
-
*
|
|
10
|
+
/** The team task-list family (pool-borne; the catalog marks it a teammate's protocol UNDER the ceiling — a named child holds the ones its
|
|
11
|
+
* spawner may use). */
|
|
9
12
|
export declare const TEAM_TASK_LIST_TOOL_NAMES: readonly string[];
|
|
10
|
-
/** The run's `mountsCallerTool` seat: membership BY IDENTITY in `spec.tools` as the caller handed it (
|
|
11
|
-
* array
|
|
12
|
-
export declare function callerToolMembership(tools: readonly
|
|
13
|
+
/** The run's `mountsCallerTool` seat: membership BY IDENTITY in `spec.tools` as the caller handed it (the roster snapshot's
|
|
14
|
+
* copy of the array — the one read of the slot; nothing is read off the entries, so no entry can make the mint throw). */
|
|
15
|
+
export declare function callerToolMembership(tools: readonly unknown[] | undefined): (tool: ToolSpec) => boolean;
|
|
13
16
|
/**
|
|
14
17
|
* The inherited pool for one spawn.
|
|
15
18
|
* · ⊆ parent: an entry survives only when the spawning run mounts THAT instance — a same-named replacement (a host's
|
|
@@ -20,9 +23,10 @@ export declare function callerToolMembership(tools: readonly ToolSpec[] | undefi
|
|
|
20
23
|
*/
|
|
21
24
|
export declare function inheritedChildPool(surface: readonly ToolSpec[], mountsCallerTool: ((tool: ToolSpec) => boolean) | undefined, anonymousBackground: boolean): ToolSpec[];
|
|
22
25
|
/**
|
|
23
|
-
* The
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
26
|
+
* The MCP servers a delegated child is declared: each server its spawning run declares, exactly as declared, when the child's
|
|
27
|
+
* selector can admit a tool of it ({@link ToolSelector.admitsPeer} — read off the lists, never off what the server lists now).
|
|
28
|
+
* A server the selector can never reach is not declared, so it is never dialled or leased for this child. The child connects
|
|
29
|
+
* from these (through the run tree's pool) and its own selector decides, at intake and on every refresh and re-dial, which of
|
|
30
|
+
* the server's tools mount.
|
|
27
31
|
*/
|
|
28
|
-
export declare function
|
|
32
|
+
export declare function inheritedMcpDeclarations(mounted: MountedMcp, selector: ToolSelector): McpServerSpec[];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { mintNamespacePrefix } from "../core/protocol-naming.js";
|
|
2
|
+
import { MCP_NAMESPACE } from "../core/protocol-table.js";
|
|
2
3
|
import { TASK_CREATE_TOOL_NAME, TASK_GET_TOOL_NAME, TASK_LIST_TOOL_NAME, TASK_UPDATE_TOOL_NAME } from "../core/tool-catalog-entries.js";
|
|
3
4
|
export const TEAM_TASK_LIST_TOOL_NAMES = Object.freeze([TASK_CREATE_TOOL_NAME, TASK_GET_TOOL_NAME, TASK_LIST_TOOL_NAME, TASK_UPDATE_TOOL_NAME]);
|
|
4
5
|
export function callerToolMembership(tools) {
|
|
@@ -10,6 +11,6 @@ export function inheritedChildPool(surface, mountsCallerTool, anonymousBackgroun
|
|
|
10
11
|
return [];
|
|
11
12
|
return surface.filter((t) => mountsCallerTool(t) && !(anonymousBackground && TEAM_TASK_LIST_TOOL_NAMES.includes(t.name)));
|
|
12
13
|
}
|
|
13
|
-
export function
|
|
14
|
-
return
|
|
14
|
+
export function inheritedMcpDeclarations(mounted, selector) {
|
|
15
|
+
return mounted.servers.filter((m) => selector.admitsPeer(mintNamespacePrefix(MCP_NAMESPACE, m.server.name))).map((m) => m.server);
|
|
15
16
|
}
|
|
@@ -2,6 +2,7 @@ import { type MailboxCrossProcessVerdict, type MailboxStore } from "../core/mail
|
|
|
2
2
|
import { type SessionBoxBinding, type SystemInjectionPriority, type TaskNotificationPayload } from "../core/task-notification.js";
|
|
3
3
|
import { type FrameSettlement } from "../core/frame-settlement.js";
|
|
4
4
|
import { type EngineNotice, type RunnerDeps } from "../core/types.js";
|
|
5
|
+
import type { ToolSelector } from "../core/tool-face.js";
|
|
5
6
|
import { type PermissionModeClass } from "./cross-session-envelope.js";
|
|
6
7
|
import { type CrossSessionInboundSettingLayers } from "./cross-session-judge.js";
|
|
7
8
|
import { type PeerLaneConfig } from "./peer-admission.js";
|
|
@@ -214,13 +215,13 @@ export declare function peerLaneSendMessageSeats(args: {
|
|
|
214
215
|
}): Pick<SendMessageToolOptions, "peerDirectory" | "peerSelfSession" | "peerListingMounted">;
|
|
215
216
|
/**
|
|
216
217
|
* design/385 §5.1 — THE ListAgents mount predicate, single source: the built-in mounts only when the
|
|
217
|
-
*
|
|
218
|
+
* leg's selector admits it and no caller tool owns either spelling (`ListAgents` / `ListPeers`) as its
|
|
218
219
|
* name OR as an alias. Every reader of "is ListAgents on this roster?" — the mount itself and the
|
|
219
220
|
* SendMessage face's listing phrase — calls this one predicate, so a face can never name a tool the
|
|
220
221
|
* roster does not carry (a second, inline copy of the rule drifted on exactly the alias arms).
|
|
221
222
|
*/
|
|
222
223
|
export declare function listAgentsMountable(face: {
|
|
223
|
-
|
|
224
|
+
selector: Pick<ToolSelector, "admits">;
|
|
224
225
|
specTools: ReadonlyArray<{
|
|
225
226
|
name: string;
|
|
226
227
|
aliases?: readonly string[];
|
|
@@ -684,12 +684,13 @@ export function peerLaneSendMessageSeats(args) {
|
|
|
684
684
|
};
|
|
685
685
|
}
|
|
686
686
|
export function listAgentsMountable(face) {
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
687
|
+
return face.selector.admits({ name: LIST_AGENTS_TOOL_NAME, aliases: [LIST_AGENTS_TOOL_ALIAS] }) && listAgentsNameFree(face.specTools);
|
|
688
|
+
}
|
|
689
|
+
function listAgentsNameFree(specTools) {
|
|
690
|
+
return !specTools.some((t) => t.name === LIST_AGENTS_TOOL_NAME || t.name === LIST_AGENTS_TOOL_ALIAS || t.aliases?.includes(LIST_AGENTS_TOOL_NAME) || t.aliases?.includes(LIST_AGENTS_TOOL_ALIAS));
|
|
690
691
|
}
|
|
691
692
|
export function mountListAgents(args) {
|
|
692
|
-
if (!
|
|
693
|
+
if (!listAgentsNameFree(args.specTools))
|
|
693
694
|
return undefined;
|
|
694
695
|
args.toolEffects.set(LIST_AGENTS_TOOL_NAME, "read");
|
|
695
696
|
args.toolEffects.set(LIST_AGENTS_TOOL_ALIAS, "read");
|
|
@@ -18,6 +18,7 @@ import { appendHopToken, judgePeerAdmission, peerAxisToken, resolvePeerLaneConfi
|
|
|
18
18
|
import { toolFace } from "../core/tool-catalog-entries.js";
|
|
19
19
|
import { thrownText } from "../core/thrown-value.js";
|
|
20
20
|
import { assertNoRetiredKeys } from "../core/retired-keys.js";
|
|
21
|
+
import { clampValuesOf } from "../core/child-clamp-seats.js";
|
|
21
22
|
import { resolveSubagentTranscriptTier } from "../core/wiring-manifest.js";
|
|
22
23
|
export const SEND_MESSAGE_TOOL_NAME = "SendMessage";
|
|
23
24
|
let uplinkSeqGlobal = Date.now();
|
|
@@ -1035,16 +1036,8 @@ export function createSendMessageTool(opts) {
|
|
|
1035
1036
|
...(opts.notify ? { currentParentNotify: opts.notify } : {}),
|
|
1036
1037
|
...(ctx.onQuestion !== undefined && row.sessionScoped !== true ? { currentOnQuestion: ctx.onQuestion } : {}),
|
|
1037
1038
|
currentClamps: {
|
|
1038
|
-
...(ctx.
|
|
1039
|
-
...(ctx.readFace === "roots" ? { readFaceRoots: true } : {}),
|
|
1040
|
-
...(ctx.writeFace === "roots" ? { writeFaceRoots: true } : {}),
|
|
1041
|
-
...(ctx.readDenyPatterns !== undefined ? { readDenyPatterns: ctx.readDenyPatterns } : {}),
|
|
1042
|
-
...(ctx.interactiveTools === false ? { interactiveTools: false } : {}),
|
|
1043
|
-
...(ctx.approvalReach === "none" ? { approvalReach: "none" } : {}),
|
|
1044
|
-
...(ctx.oneShot === true ? { oneShot: true } : {}),
|
|
1045
|
-
...(ctx.memoryPersistenceCapable === false ? { memoryPersistenceCapable: false } : {}),
|
|
1039
|
+
...clampValuesOf(ctx, ctx.parentSpecSeat),
|
|
1046
1040
|
...(ctx.parentSpecSeat?.memoryOff === true ? { memoryOff: true } : {}),
|
|
1047
|
-
...(ctx.parentSpecSeat?.fileHistory === "disabled" ? { fileHistory: "disabled" } : {}),
|
|
1048
1041
|
},
|
|
1049
1042
|
...(ctx.autoModeReview !== undefined ? { currentAutoModeReview: ctx.autoModeReview } : {}),
|
|
1050
1043
|
});
|
|
@@ -397,19 +397,6 @@ export interface SubagentSteerHandle {
|
|
|
397
397
|
* must not be guessable by untrusted content — the old `steer-a<seq>` global counter let injected text
|
|
398
398
|
* pre-claim "[steer-aN]" and self-declare correlation; the same fix applies to the new resume markers. */
|
|
399
399
|
export declare function markerFragment(): string;
|
|
400
|
-
/**
|
|
401
|
-
* design/122 D2 — build the `resume` verb for one delegation (closure over the ledger + delegation runner —
|
|
402
|
-
* NEVER the parent tool ctx / spec builder, r1-m5). Validation order: TTL sweep (MAJOR-1) → disposed?
|
|
403
|
-
* (MAJOR-3) → retained/evicted? → still running? → cap → SYNCHRONOUS claim (MAJOR-2: `running = true`
|
|
404
|
-
* before any await; rolled back on pre-launch failure) → session exists AND non-empty (r1-m1).
|
|
405
|
-
* Then: fenced revive prompt (unpredictable marker) →
|
|
406
|
-
* `runTaskStream` on the FROZEN spawn snapshot + `requireExistingSession` (spec is tighten-only: the caller
|
|
407
|
-
* contributes ONLY `content`) → ledger `activeRun` bookkeeping → completion announced through
|
|
408
|
-
* `deps.notify` (no sink ⇒ silent). Which lane
|
|
409
|
-
* that is depends on the mount: the background Agent lane wires the deployment-level background-notify
|
|
410
|
-
* sink, while the SendMessage mount wires the SENDING run's own notification injector — there the
|
|
411
|
-
* completion notice lands in the sender's live injection queue at its next turn boundary.
|
|
412
|
-
*/
|
|
413
400
|
export declare function createSubagentResume(deps: {
|
|
414
401
|
ledger: SubagentRetainLedger | undefined;
|
|
415
402
|
parentToolCallId: string;
|
|
@@ -441,18 +428,11 @@ export declare function createSubagentResume(deps: {
|
|
|
441
428
|
* read-only / hard-headless / one-shot run and still act with the spawn turn's capabilities — the
|
|
442
429
|
* resumer driving actions it could not perform itself. The fold is a union of restrictions (either
|
|
443
430
|
* side saying "restricted" wins), never a relaxation: a snapshot clamp is not lifted by a resumer
|
|
444
|
-
* that lacks it. Absent ⇒ the snapshot governs alone (prior behavior).
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
approvalReach?: "none";
|
|
449
|
-
oneShot?: true;
|
|
450
|
-
memoryPersistenceCapable?: false;
|
|
431
|
+
* that lacks it. Absent ⇒ the snapshot governs alone (prior behavior). The seats are the clamp table's rows
|
|
432
|
+
* (`ClampValues`: only restricting values), plus the memory-off fact — a rewrite of the `memory` declaration,
|
|
433
|
+
* not a value seat. */
|
|
434
|
+
currentClamps?: import("../core/child-clamp-seats.js").ClampValues & {
|
|
451
435
|
memoryOff?: true;
|
|
452
|
-
fileHistory?: "disabled";
|
|
453
|
-
readFaceRoots?: true;
|
|
454
|
-
writeFaceRoots?: true;
|
|
455
|
-
readDenyPatterns?: readonly import("../tools/fs/read-deny.js").ReadDenyEntry[];
|
|
456
436
|
};
|
|
457
437
|
/** The RESUMING caller's own handback-review seat (its trusted `ToolExecuteContext.autoModeReview`),
|
|
458
438
|
* same turn-bound reasoning as `currentOnQuestion` above: a resumed cycle is a completion like any
|
|
@@ -704,13 +684,14 @@ export interface SubagentToolOptions {
|
|
|
704
684
|
inheritedTools?: ToolSpec[];
|
|
705
685
|
/**
|
|
706
686
|
* Tool-level allowlist (design/38 1A), used when NO `agent` is selected (a selected agent definition's
|
|
707
|
-
* own `allowTools`/`denyTools` REPLACE these). When set, the child
|
|
708
|
-
*
|
|
709
|
-
*
|
|
710
|
-
*
|
|
687
|
+
* own `allowTools`/`denyTools` REPLACE these). When set, the child may use only what it names, out of everything its run would
|
|
688
|
+
* mount (its pool, the hands, the engine's own tools, the MCP tools it inherits) — the child's own selector layer, under the
|
|
689
|
+
* spawning run's selector (`["*"]` = no allowlist of its own). Omit for everything the parent could use. Allowlist is the
|
|
690
|
+
* security-recommended shape. The nested delegation tool is one of the tools it governs: a child gets one only while under
|
|
691
|
+
* `maxDepth` AND when these lists admit the delegation tool's name.
|
|
711
692
|
*/
|
|
712
693
|
allowTools?: string[];
|
|
713
|
-
/** Tool-level denylist (design/38 1A), used when no `agent` is selected:
|
|
694
|
+
/** Tool-level denylist (design/38 1A), used when no `agent` is selected: the denied half of the child's own selector layer (a deny wins). */
|
|
714
695
|
denyTools?: string[];
|
|
715
696
|
/** System prompt / persona for the child. Default (1.259.0, CC 198 parity): the LEAN
|
|
716
697
|
* {@link SUBAGENT_PROMPT} (agent persona + return contract), NOT the full default constitution role
|