@sema-agent/core 7.58.0 → 7.60.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1340 -0
- package/README.md +6 -4
- package/dist/agents/agent-definition.d.ts +7 -0
- package/dist/agents/agent-definition.js +12 -0
- package/dist/agents/agent-transcript-tool.d.ts +2 -1
- package/dist/agents/agent-transcript-tool.js +3 -1
- package/dist/agents/cc-peer-directory.js +8 -8
- package/dist/agents/child-model-seat.d.ts +4 -2
- package/dist/agents/child-model-seat.js +9 -4
- package/dist/agents/cumulative-stats.js +0 -1
- package/dist/agents/inherited-tool-pool.d.ts +26 -1
- package/dist/agents/inherited-tool-pool.js +22 -0
- package/dist/agents/peer-directory.d.ts +9 -0
- package/dist/agents/peer-directory.js +6 -2
- package/dist/agents/retain-ledger.d.ts +11 -1
- package/dist/agents/retain-ledger.js +13 -2
- package/dist/agents/roster-store.d.ts +1 -1
- package/dist/agents/roster-store.js +3 -1
- package/dist/agents/send-message-tool.d.ts +8 -19
- package/dist/agents/send-message-tool.js +32 -50
- package/dist/agents/subagent.d.ts +51 -17
- package/dist/agents/subagent.js +150 -112
- package/dist/agents/tool-filter.d.ts +1 -3
- package/dist/agents/tool-filter.js +4 -12
- package/dist/bench/metrics.d.ts +3 -5
- package/dist/bench/metrics.js +0 -1
- package/dist/brain/anthropic.js +161 -45
- package/dist/brain/degrading.js +3 -1
- package/dist/brain/errors.d.ts +9 -3
- package/dist/brain/errors.js +7 -1
- package/dist/brain/failover.js +2 -1
- package/dist/brain/open-responses.js +3 -3
- package/dist/brain/openai.js +103 -53
- package/dist/brain/provider-dialect.d.ts +11 -0
- package/dist/brain/provider-dialect.js +5 -2
- package/dist/brain/reasoning-request.js +5 -4
- package/dist/brain/reasoning.d.ts +19 -0
- package/dist/brain/reasoning.js +17 -2
- package/dist/brain/request-route.d.ts +4 -1
- package/dist/brain/request-route.js +4 -1
- package/dist/brain/route-adjudicator.d.ts +84 -18
- package/dist/brain/route-adjudicator.js +90 -22
- package/dist/brain/route-conformance.js +1 -1
- package/dist/brain/status-sink.d.ts +7 -1
- package/dist/brain/status-sink.js +6 -0
- package/dist/brain/stream-engine.js +84 -49
- package/dist/brain/stream-shared.d.ts +30 -0
- package/dist/brain/stream-shared.js +34 -1
- package/dist/brain/timeout.d.ts +65 -6
- package/dist/brain/timeout.js +111 -11
- package/dist/core/a2a.d.ts +15 -5
- package/dist/core/a2a.js +34 -19
- package/dist/core/account-row.d.ts +61 -0
- package/dist/core/account-row.js +51 -0
- package/dist/core/advisor-verdict.d.ts +2 -1
- package/dist/core/advisor-verdict.js +1 -1
- package/dist/core/agent-definition.d.ts +20 -0
- package/dist/core/allow-entry.d.ts +20 -6
- package/dist/core/allow-entry.js +17 -7
- package/dist/core/approval-object.d.ts +29 -15
- package/dist/core/approval-object.js +47 -19
- package/dist/core/artifact-host.d.ts +0 -2
- package/dist/core/artifact-host.js +0 -1
- package/dist/core/auto-compaction.js +1 -1
- package/dist/core/auto-mode-defaults.d.ts +8 -0
- package/dist/core/auto-mode-defaults.js +1 -0
- package/dist/core/auto-mode-rebuild.d.ts +2 -1
- package/dist/core/auto-mode.d.ts +39 -4
- package/dist/core/auto-mode.js +63 -12
- package/dist/core/background-agent-store.d.ts +26 -4
- package/dist/core/background-agent-store.js +3 -2
- package/dist/core/background-shell.d.ts +12 -1
- package/dist/core/background-shell.js +12 -0
- package/dist/core/checkpoint-requirements.d.ts +13 -1
- package/dist/core/checkpoint-requirements.js +3 -1
- package/dist/core/checkpoint-store.d.ts +66 -25
- package/dist/core/checkpoint-store.js +22 -9
- package/dist/core/child-clamp-seats.d.ts +29 -0
- package/dist/core/child-clamp-seats.js +56 -1
- package/dist/core/compliance.d.ts +3 -3
- package/dist/core/compliance.js +1 -1
- package/dist/core/credential-echo.d.ts +52 -0
- package/dist/core/credential-echo.js +65 -0
- package/dist/core/credential-vocabulary.d.ts +13 -3
- package/dist/core/credential-vocabulary.js +12 -4
- package/dist/core/cross-boundary-taint.d.ts +4 -5
- package/dist/core/effective-path-target.d.ts +8 -2
- package/dist/core/effective-path-target.js +8 -3
- package/dist/core/engine-notice.d.ts +156 -23
- package/dist/core/engine-notice.js +19 -5
- package/dist/core/frame-settlement.d.ts +5 -0
- package/dist/core/frame-settlement.js +4 -0
- package/dist/core/gate-fold.js +8 -6
- package/dist/core/gate-lanes.js +47 -12
- package/dist/core/gate-outcome.d.ts +32 -3
- package/dist/core/gate-outcome.js +19 -1
- package/dist/core/governance-codes.d.ts +17 -1
- package/dist/core/governance-codes.js +25 -0
- package/dist/core/hands-band-screen.js +0 -1
- package/dist/core/hands-band.d.ts +0 -3
- package/dist/core/hooks.d.ts +70 -59
- package/dist/core/hooks.js +125 -80
- package/dist/core/image-admission.d.ts +106 -52
- package/dist/core/image-admission.js +184 -56
- package/dist/core/image-downsample.d.ts +36 -69
- package/dist/core/image-downsample.js +111 -73
- package/dist/core/integer-option.d.ts +21 -0
- package/dist/core/integer-option.js +13 -0
- package/dist/core/locked-config.d.ts +59 -5
- package/dist/core/locked-config.js +82 -50
- package/dist/core/mailbox-store.d.ts +45 -1
- package/dist/core/mailbox-store.js +53 -9
- package/dist/core/mcp-call-meta.d.ts +2 -2
- package/dist/core/mcp-call-meta.js +9 -10
- package/dist/core/mcp-failure.d.ts +122 -20
- package/dist/core/mcp-failure.js +73 -5
- package/dist/core/mcp-host-seat.d.ts +92 -0
- package/dist/core/mcp-host-seat.js +131 -0
- package/dist/core/mcp-probe.d.ts +7 -2
- package/dist/core/mcp-probe.js +7 -2
- package/dist/core/mcp-server-link.d.ts +22 -1
- package/dist/core/mcp-server-link.js +25 -1
- package/dist/core/mcp-server-spec.d.ts +38 -9
- package/dist/core/mcp-server-spec.js +55 -21
- package/dist/core/mcp.d.ts +27 -12
- package/dist/core/mcp.js +105 -76
- package/dist/core/memory-admission.d.ts +23 -6
- package/dist/core/memory-admission.js +19 -9
- package/dist/core/memory-engine/consolidation-driver.d.ts +2 -4
- package/dist/core/memory-engine/consolidation-driver.js +3 -3
- package/dist/core/memory-engine/consolidation.d.ts +4 -0
- package/dist/core/memory-engine/consolidation.js +1 -0
- package/dist/core/memory-engine/content-origin.d.ts +13 -0
- package/dist/core/memory-engine/content-origin.js +21 -3
- package/dist/core/memory-engine/delegation-settlement.js +5 -12
- package/dist/core/memory-engine/distiller.js +2 -2
- package/dist/core/memory-engine/dual-root.d.ts +50 -1
- package/dist/core/memory-engine/dual-root.js +44 -1
- package/dist/core/memory-engine/engine.d.ts +67 -14
- package/dist/core/memory-engine/engine.js +384 -212
- package/dist/core/memory-engine/export-bundle.d.ts +23 -0
- package/dist/core/memory-engine/export-bundle.js +23 -4
- package/dist/core/memory-engine/file-backend.d.ts +128 -55
- package/dist/core/memory-engine/file-backend.js +290 -117
- package/dist/core/memory-engine/index.d.ts +3 -2
- package/dist/core/memory-engine/index.js +2 -1
- package/dist/core/memory-engine/layout.d.ts +59 -11
- package/dist/core/memory-engine/layout.js +190 -40
- package/dist/core/memory-engine/memory-backend-contract.d.ts +1 -1
- package/dist/core/memory-engine/memory-backend-contract.js +39 -2
- package/dist/core/memory-engine/scope-contract.d.ts +13 -3
- package/dist/core/memory-engine/scope-contract.js +2 -2
- package/dist/core/memory-engine/sync-client.d.ts +51 -9
- package/dist/core/memory-engine/sync-client.js +107 -13
- package/dist/core/memory-engine/sync-report.d.ts +103 -0
- package/dist/core/memory-engine/sync-report.js +119 -0
- package/dist/core/memory-engine/sync.d.ts +8 -1
- package/dist/core/memory-engine/types.d.ts +6 -0
- package/dist/core/mode-policy.d.ts +9 -1
- package/dist/core/mode-policy.js +11 -1
- package/dist/core/model-receipt.d.ts +39 -0
- package/dist/core/model-receipt.js +139 -0
- package/dist/core/mods/agent-stations.d.ts +65 -0
- package/dist/core/mods/agent-stations.js +105 -0
- package/dist/core/mods/classic-events.d.ts +5 -1
- package/dist/core/mods/kernel/dispatch.d.ts +5 -1
- package/dist/core/mods/kernel/dispatch.js +6 -5
- package/dist/core/mods/kernel/events.d.ts +11 -4
- package/dist/core/mods/kernel/events.js +11 -7
- package/dist/core/mods/kernel/receive.d.ts +5 -0
- package/dist/core/mods/kernel/receive.js +10 -0
- package/dist/core/mods/kernel/registration.d.ts +4 -0
- package/dist/core/mods/kernel/registration.js +3 -0
- package/dist/core/mods/lifecycle-stations.d.ts +41 -0
- package/dist/core/mods/lifecycle-stations.js +35 -0
- package/dist/core/mods/stations.d.ts +73 -60
- package/dist/core/mods/stations.js +64 -40
- package/dist/core/mods/tool-call.d.ts +10 -4
- package/dist/core/mods/tool-call.js +28 -12
- package/dist/core/mounted-mcp.d.ts +5 -0
- package/dist/core/mounted-mcp.js +2 -2
- package/dist/core/namespaced-rule-name.d.ts +7 -1
- package/dist/core/namespaced-rule-name.js +13 -2
- package/dist/core/oracle-isolation.js +1 -1
- package/dist/core/own-property-receipt.d.ts +3 -0
- package/dist/core/own-property-receipt.js +3 -0
- package/dist/core/parent-spec-seat.d.ts +8 -3
- package/dist/core/parent-spec-seat.js +2 -0
- package/dist/core/park-selfcheck.js +14 -8
- package/dist/core/peer-seat.d.ts +133 -16
- package/dist/core/peer-seat.js +319 -42
- package/dist/core/permission-rule-consent.d.ts +0 -21
- package/dist/core/permission-rule-consent.js +11 -6
- package/dist/core/permission-rule-model.d.ts +20 -2
- package/dist/core/permission-rule-model.js +8 -7
- package/dist/core/present-plan-tool.d.ts +11 -3
- package/dist/core/present-plan-tool.js +2 -2
- package/dist/core/protocol-http-auth.d.ts +14 -2
- package/dist/core/protocol-http-auth.js +16 -7
- package/dist/core/read-face-seats.d.ts +7 -5
- package/dist/core/read-face-seats.js +4 -1
- package/dist/core/redaction-marks.d.ts +4 -3
- package/dist/core/redaction-marks.js +2 -2
- package/dist/core/remote-env.d.ts +146 -98
- package/dist/core/remote-env.js +113 -14
- package/dist/core/resume-startup-cause.js +1 -0
- package/dist/core/retention.js +37 -12
- package/dist/core/retired-keys.d.ts +6 -1
- package/dist/core/retired-keys.js +4 -1
- package/dist/core/rewrite-rejudge.d.ts +13 -5
- package/dist/core/rewrite-rejudge.js +9 -5
- package/dist/core/roles.d.ts +69 -3
- package/dist/core/roles.js +167 -80
- package/dist/core/rule-owner.d.ts +3 -0
- package/dist/core/runner/announce-once-ledger.d.ts +5 -4
- package/dist/core/runner/announce-once-ledger.js +4 -2
- package/dist/core/runner/assemble-result.d.ts +0 -5
- package/dist/core/runner/assemble-result.js +0 -1
- package/dist/core/runner/call-hook-stations.d.ts +17 -10
- package/dist/core/runner/call-hook-stations.js +23 -12
- package/dist/core/runner/child-tree.d.ts +7 -8
- package/dist/core/runner/child-tree.js +6 -6
- package/dist/core/runner/classifier-ladder.d.ts +10 -2
- package/dist/core/runner/classifier-ladder.js +39 -8
- package/dist/core/runner/construction-doors.js +5 -0
- package/dist/core/runner/contracts.d.ts +82 -57
- package/dist/core/runner/credential-origin-seat.js +4 -3
- package/dist/core/runner/cross-boundary-lane.d.ts +3 -5
- package/dist/core/runner/cross-boundary-lane.js +11 -2
- package/dist/core/runner/cwd-alignment-probe.d.ts +20 -0
- package/dist/core/runner/cwd-alignment-probe.js +21 -0
- package/dist/core/runner/decide-continuation.d.ts +2 -2
- package/dist/core/runner/env-capability-census.d.ts +15 -20
- package/dist/core/runner/env-capability-census.js +25 -34
- package/dist/core/runner/file-history-request.d.ts +2 -2
- package/dist/core/runner/file-history-request.js +0 -8
- package/dist/core/runner/gate-exit.d.ts +87 -11
- package/dist/core/runner/gate-exit.js +30 -8
- package/dist/core/runner/git-status-frame.d.ts +5 -2
- package/dist/core/runner/git-status-frame.js +3 -4
- package/dist/core/runner/image-removed-seat.d.ts +12 -0
- package/dist/core/runner/image-removed-seat.js +19 -0
- package/dist/core/runner/image.d.ts +7 -2
- package/dist/core/runner/image.js +14 -8
- package/dist/core/runner/inline-image.d.ts +10 -8
- package/dist/core/runner/inline-image.js +11 -9
- package/dist/core/runner/memory-consolidation-driver.js +5 -5
- package/dist/core/runner/park-commit.d.ts +1 -1
- package/dist/core/runner/park-commit.js +3 -0
- package/dist/core/runner/permission-rule-lanes.js +1 -1
- package/dist/core/runner/prepare-ask-lane.d.ts +1 -1
- package/dist/core/runner/prepare-ask-lane.js +2 -1
- package/dist/core/runner/prepare-boundary-parks.d.ts +2 -2
- package/dist/core/runner/prepare-boundary-parks.js +5 -5
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +7 -5
- package/dist/core/runner/prepare-caps-and-workflow.js +6 -3
- package/dist/core/runner/prepare-config-doors.d.ts +6 -1
- package/dist/core/runner/prepare-config-doors.js +16 -9
- package/dist/core/runner/prepare-context-lane.js +2 -0
- package/dist/core/runner/prepare-delegation-surface.d.ts +9 -3
- package/dist/core/runner/prepare-delegation-surface.js +5 -4
- package/dist/core/runner/prepare-file-history.d.ts +10 -12
- package/dist/core/runner/prepare-file-history.js +3 -12
- package/dist/core/runner/prepare-gate-stations.d.ts +4 -3
- package/dist/core/runner/prepare-gate-stations.js +4 -3
- package/dist/core/runner/prepare-hands-readface.d.ts +7 -1
- package/dist/core/runner/prepare-hands-readface.js +19 -6
- package/dist/core/runner/prepare-inherited-gate.d.ts +6 -7
- package/dist/core/runner/prepare-inherited-gate.js +22 -31
- package/dist/core/runner/prepare-memory-engine-session.js +1 -1
- package/dist/core/runner/prepare-memory.d.ts +2 -2
- package/dist/core/runner/prepare-memory.js +12 -19
- package/dist/core/runner/prepare-park-ask.d.ts +4 -6
- package/dist/core/runner/prepare-park-ask.js +5 -9
- package/dist/core/runner/prepare-policy-chain.d.ts +8 -7
- package/dist/core/runner/prepare-policy-chain.js +136 -121
- package/dist/core/runner/prepare-project-context.d.ts +2 -2
- package/dist/core/runner/prepare-project-context.js +10 -7
- package/dist/core/runner/prepare-prompt-inputs.d.ts +5 -2
- package/dist/core/runner/prepare-prompt-inputs.js +10 -20
- package/dist/core/runner/prepare-protocol-tools.d.ts +5 -3
- package/dist/core/runner/prepare-protocol-tools.js +17 -2
- package/dist/core/runner/prepare-run-refs.d.ts +2 -3
- package/dist/core/runner/prepare-run-refs.js +4 -1
- package/dist/core/runner/prepare-suspend-saga.d.ts +0 -2
- package/dist/core/runner/prepare-suspend-saga.js +5 -7
- package/dist/core/runner/prepare-task.js +44 -28
- package/dist/core/runner/prepare-turn-wiring.d.ts +2 -0
- package/dist/core/runner/prepare-turn-wiring.js +7 -2
- package/dist/core/runner/prepare-wiring-manifest.d.ts +5 -4
- package/dist/core/runner/prepare-wiring-manifest.js +34 -19
- package/dist/core/runner/prepare-workspace-restore.js +3 -3
- package/dist/core/runner/reply-pricing.d.ts +30 -0
- package/dist/core/runner/reply-pricing.js +19 -0
- package/dist/core/runner/resume-admission.js +4 -2
- package/dist/core/runner/resume-apply.js +6 -1
- package/dist/core/runner/resume-checkpoint-screen.js +4 -4
- package/dist/core/runner/resume-policy-outcome.js +5 -5
- package/dist/core/runner/retired-runner-deps.js +4 -1
- package/dist/core/runner/role-seat-defaulted.d.ts +44 -0
- package/dist/core/runner/role-seat-defaulted.js +40 -0
- package/dist/core/runner/run-attachment-seats.js +3 -3
- package/dist/core/runner/run-brain-sinks.js +3 -0
- package/dist/core/runner/run-git-lane.d.ts +3 -1
- package/dist/core/runner/run-git-lane.js +1 -1
- package/dist/core/runner/run-harness-handlers.d.ts +3 -1
- package/dist/core/runner/run-harness-handlers.js +3 -1
- package/dist/core/runner/run-identity-wiring.d.ts +2 -5
- package/dist/core/runner/run-identity-wiring.js +6 -5
- package/dist/core/runner/run-leg.d.ts +2 -0
- package/dist/core/runner/run-leg.js +63 -56
- package/dist/core/runner/run-notification-lane.d.ts +3 -1
- package/dist/core/runner/run-notification-lane.js +16 -10
- package/dist/core/runner/run-settle-and-teardown.js +5 -1
- package/dist/core/runner/run-stop-and-final-verify.d.ts +4 -0
- package/dist/core/runner/run-stop-and-final-verify.js +14 -6
- package/dist/core/runner/run-terminal-adoption.d.ts +2 -5
- package/dist/core/runner/run-terminal-adoption.js +9 -3
- package/dist/core/runner/run-turn-boundary.js +89 -77
- package/dist/core/runner/runtask.d.ts +8 -5
- package/dist/core/runner/runtask.js +21 -13
- package/dist/core/runner/side-call-account.d.ts +1 -1
- package/dist/core/runner/side-call-account.js +3 -18
- package/dist/core/runner/skills-seat.js +2 -2
- package/dist/core/runner/sub-agent-deny-lists.d.ts +24 -0
- package/dist/core/runner/sub-agent-deny-lists.js +20 -7
- package/dist/core/runner/synthetic-tools.js +2 -2
- package/dist/core/runner/tool-disclosure.js +0 -2
- package/dist/core/runner/tool-end-body.js +2 -2
- package/dist/core/runner/tool-face-overlay.d.ts +1 -1
- package/dist/core/runner/tool-face-overlay.js +26 -19
- package/dist/core/runner/tool-occurrence.d.ts +1 -1
- package/dist/core/runner/tool-occurrence.js +2 -2
- package/dist/core/runner/tool-result-media-seat.d.ts +9 -1
- package/dist/core/runner/tool-result-media-seat.js +17 -1
- package/dist/core/runner/turn-attachments.d.ts +29 -27
- package/dist/core/runner/turn-attachments.js +27 -42
- package/dist/core/runner-deps.d.ts +32 -19
- package/dist/core/secret-env.d.ts +35 -4
- package/dist/core/secret-env.js +65 -3
- package/dist/core/sensitive-path-policy.js +3 -3
- package/dist/core/session-policy-store.d.ts +12 -3
- package/dist/core/session-policy-store.js +29 -10
- package/dist/core/session-store.d.ts +5 -7
- package/dist/core/session-store.js +50 -11
- package/dist/core/side-query.d.ts +11 -1
- package/dist/core/side-query.js +9 -0
- package/dist/core/skill-grant-binding.d.ts +31 -2
- package/dist/core/skill-grant-binding.js +31 -1
- package/dist/core/skill-grant.d.ts +17 -5
- package/dist/core/skill-grant.js +24 -6
- package/dist/core/store-contracts/background-agent-store-contract.js +27 -0
- package/dist/core/store-contracts/checkpoint-store-contract.js +3 -2
- package/dist/core/store-contracts/mailbox-store-contract.js +31 -1
- package/dist/core/store-contracts/tool-result-store-contract.d.ts +1 -1
- package/dist/core/store-contracts/tool-result-store-contract.js +37 -0
- package/dist/core/stub-env.d.ts +5 -5
- package/dist/core/stub-env.js +11 -1
- package/dist/core/swappable-deps.d.ts +17 -43
- package/dist/core/swappable-deps.js +15 -5
- package/dist/core/synthetic-read-verdict.d.ts +1 -1
- package/dist/core/synthetic-read-verdict.js +2 -1
- package/dist/core/task-event.d.ts +50 -10
- package/dist/core/task-notification.d.ts +88 -5
- package/dist/core/task-notification.js +146 -17
- package/dist/core/task-registry-agent.d.ts +18 -12
- package/dist/core/task-registry-agent.js +19 -6
- package/dist/core/task-registry-monitor.d.ts +7 -0
- package/dist/core/task-registry-monitor.js +28 -1
- package/dist/core/task-registry-shared.d.ts +43 -3
- package/dist/core/task-registry-shared.js +21 -7
- package/dist/core/task-registry-workflow.js +1 -1
- package/dist/core/task-registry.d.ts +50 -35
- package/dist/core/task-registry.js +64 -23
- package/dist/core/task-result.d.ts +3 -12
- package/dist/core/task-spec.d.ts +15 -7
- package/dist/core/task-stream.d.ts +1 -1
- package/dist/core/terminal-cause.d.ts +10 -0
- package/dist/core/tool-catalog-entries.js +1 -1
- package/dist/core/tool-check-reading.d.ts +1 -0
- package/dist/core/tool-check-reading.js +3 -3
- package/dist/core/tool-face-reader.d.ts +7 -6
- package/dist/core/tool-face-reader.js +4 -3
- package/dist/core/tool-name-aliases.d.ts +19 -0
- package/dist/core/tool-name-aliases.js +54 -2
- package/dist/core/tool-policy.d.ts +21 -4
- package/dist/core/tool-policy.js +1 -1
- package/dist/core/tool-registry.d.ts +5 -5
- package/dist/core/tool-registry.js +2 -2
- package/dist/core/tool-result-store.d.ts +88 -5
- package/dist/core/tool-result-store.js +51 -12
- package/dist/core/tool-roster.d.ts +112 -5
- package/dist/core/tool-roster.js +42 -1
- package/dist/core/tool-spec.d.ts +23 -5
- package/dist/core/trace.d.ts +0 -1
- package/dist/core/types.d.ts +5 -5
- package/dist/core/types.js +2 -2
- package/dist/core/untrusted-text.js +1 -1
- package/dist/core/user-attachment.d.ts +10 -5
- package/dist/core/user-attachment.js +15 -7
- package/dist/core/wiring-manifest.d.ts +6 -3
- package/dist/engine/compaction/compaction.js +29 -3
- package/dist/engine/execution-env/node-execution-env.d.ts +11 -5
- package/dist/engine/execution-env/node-execution-env.js +21 -13
- package/dist/engine/harness/agent-harness.d.ts +26 -3
- package/dist/engine/harness/agent-harness.js +49 -16
- package/dist/engine/harness/messages.d.ts +3 -1
- package/dist/engine/harness/messages.js +3 -2
- package/dist/engine/harness/types.d.ts +119 -28
- package/dist/engine/llm/rejected-images.d.ts +46 -0
- package/dist/engine/llm/rejected-images.js +54 -0
- package/dist/engine/llm/tool-turns.d.ts +2 -1
- package/dist/engine/llm/types.d.ts +18 -7
- package/dist/engine/loop/agent-loop.d.ts +20 -12
- package/dist/engine/loop/agent-loop.js +205 -36
- package/dist/engine/loop/types.d.ts +12 -3
- package/dist/engine/lsp/node-lsp-manager.d.ts +3 -3
- package/dist/engine/lsp/node-lsp-manager.js +32 -13
- package/dist/engine/session/path-to-root.d.ts +38 -0
- package/dist/engine/session/path-to-root.js +39 -0
- package/dist/engine/session/storage-base.js +4 -21
- package/dist/index.d.ts +35 -21
- package/dist/index.js +26 -17
- package/dist/internal/harness-types.d.ts +1 -1
- package/dist/internal/harness.d.ts +1 -0
- package/dist/internal/llm.d.ts +1 -0
- package/dist/orchestration/run-workflow-tool.d.ts +9 -3
- package/dist/orchestration/run-workflow-tool.js +59 -29
- package/dist/orchestration/workflow-governance.d.ts +1 -1
- package/dist/orchestration/workflow-governance.js +2 -1
- package/dist/orchestration/workflow-observe.d.ts +17 -1
- package/dist/orchestration/workflow-observe.js +20 -0
- package/dist/orchestration/workflow-types.d.ts +32 -7
- package/dist/orchestration/workflow.d.ts +4 -0
- package/dist/orchestration/workflow.js +762 -491
- package/dist/prompts/default.d.ts +1 -10
- package/dist/prompts/default.js +0 -2
- package/dist/shell/counting-pass.d.ts +50 -0
- package/dist/shell/counting-pass.js +502 -0
- package/dist/shell/lex.d.ts +4 -2
- package/dist/shell/lex.js +93 -34
- package/dist/shell/shell-words.d.ts +1 -1
- package/dist/shell/shell-words.js +7 -6
- package/dist/stores/file/background-agent-store.d.ts +1 -1
- package/dist/stores/file/background-agent-store.js +3 -1
- package/dist/stores/file/checkpoint-store.d.ts +127 -2
- package/dist/stores/file/checkpoint-store.js +19 -14
- package/dist/stores/file/file-history-store.d.ts +1 -1
- package/dist/stores/file/file-history-store.js +3 -1
- package/dist/stores/file/index.d.ts +4 -3
- package/dist/stores/file/index.js +17 -8
- package/dist/stores/file/mailbox-store.d.ts +1 -1
- package/dist/stores/file/mailbox-store.js +9 -11
- package/dist/stores/file/memory-store.d.ts +1 -1
- package/dist/stores/file/memory-store.js +3 -1
- package/dist/stores/file/session-policy-store.d.ts +1 -1
- package/dist/stores/file/session-policy-store.js +3 -1
- package/dist/stores/file/session-store.d.ts +1 -1
- package/dist/stores/file/session-store.js +3 -1
- package/dist/stores/file/shared-ledger.d.ts +26 -0
- package/dist/stores/file/shared-ledger.js +38 -9
- package/dist/stores/file/tool-result-store.d.ts +20 -2
- package/dist/stores/file/tool-result-store.js +74 -6
- package/dist/stores/file/usage-window-store.d.ts +1 -1
- package/dist/stores/file/usage-window-store.js +3 -1
- package/dist/stores/file/workflow-journal-store.d.ts +1 -11
- package/dist/stores/file/workflow-journal-store.js +3 -2
- package/dist/tools/fs/containment-face.d.ts +5 -0
- package/dist/tools/fs/encoding.d.ts +13 -4
- package/dist/tools/fs/encoding.js +17 -2
- package/dist/tools/fs/fs-bash-background-text.d.ts +7 -0
- package/dist/tools/fs/fs-bash-background-text.js +1 -0
- package/dist/tools/fs/fs-bash.d.ts +14 -4
- package/dist/tools/fs/fs-bash.js +29 -35
- package/dist/tools/fs/fs-pdf.d.ts +2 -2
- package/dist/tools/fs/fs-pdf.js +26 -21
- package/dist/tools/fs/fs-read.d.ts +5 -4
- package/dist/tools/fs/fs-read.js +35 -18
- package/dist/tools/fs/fs-search-tools.js +4 -1
- package/dist/tools/fs/fs-shared.d.ts +11 -13
- package/dist/tools/fs/fs-shared.js +11 -7
- package/dist/tools/fs/fs-write.js +5 -5
- package/dist/tools/fs/index.d.ts +14 -8
- package/dist/tools/fs/index.js +13 -5
- package/dist/tools/fs/program-read-model.d.ts +13 -0
- package/dist/tools/fs/program-read-model.js +15 -0
- package/dist/tools/fs/program-read-model.rows.js +1 -1
- package/dist/tools/fs/read-deny.d.ts +13 -10
- package/dist/tools/fs/read-deny.js +25 -5
- package/dist/tools/fs/read-floor.d.ts +62 -0
- package/dist/tools/fs/read-floor.js +58 -0
- package/dist/tools/fs/removal-targets.d.ts +9 -4
- package/dist/tools/fs/removal-targets.js +17 -9
- package/dist/tools/fs/search.d.ts +3 -3
- package/dist/tools/fs/search.js +4 -4
- package/dist/tools/fs/shell-read-check.d.ts +1 -1
- package/dist/tools/fs/shell-read-check.js +2 -1
- package/dist/tools/fs/shell-read-judge.d.ts +16 -8
- package/dist/tools/fs/shell-read-judge.js +10 -6
- package/dist/tools/fs/shell-read-plan.d.ts +6 -1
- package/dist/tools/fs/shell-read-plan.js +22 -15
- package/dist/tools/fs/shell-read-start.js +1 -0
- package/dist/tools/fs/shell-reentry-text.d.ts +15 -1
- package/dist/tools/fs/shell-reentry-text.js +25 -3
- package/dist/tools/monitor.d.ts +9 -4
- package/dist/tools/monitor.js +17 -8
- package/dist/tools/scheduler-tools.js +42 -4
- package/dist/tools/web.d.ts +0 -10
- package/dist/tools/web.js +1 -4
- package/package.json +5 -2
- package/test/export-surface.snapshot.json +161 -21
- package/wire-changes/core-stores-sql@7.59.0.json +29 -0
- package/wire-changes/core-stores-sql@7.60.0.json +30 -0
- package/wire-changes/core@7.59.0.json +2459 -0
- package/wire-changes/core@7.60.0.json +3274 -0
- package/wire-changes/mods-kernel@7.59.0.json +29 -0
- package/wire-changes/mods-kernel@7.60.0.json +62 -0
- package/wire-changes/primitives@7.59.0.json +29 -0
- package/wire-changes/primitives@7.60.0.json +30 -0
package/dist/core/a2a.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { AgentTool } from "../internal/harness-types.js";
|
|
2
|
+
import { type CredentialEchoSite } from "./credential-echo.js";
|
|
2
3
|
import { type PeerSeat } from "./peer-seat.js";
|
|
3
4
|
import { type HostFloor } from "./host-floor.js";
|
|
5
|
+
import { type McpFailureFields } from "./mcp-failure.js";
|
|
4
6
|
import type { A2aServerSpec, ToolEffect } from "./types.js";
|
|
5
7
|
/** The hard per-skill description bound (ruled 2026-08-03: ~2KiB). */
|
|
6
8
|
export declare const A2A_SKILL_DESCRIPTION_MAX_CHARS = 2048;
|
|
@@ -28,8 +30,15 @@ export interface A2aToolAxis {
|
|
|
28
30
|
}
|
|
29
31
|
/** design/99 §E9 equivalent for A2A — a per-peer projection of THIS materialization. A2A holds no
|
|
30
32
|
* connection (every call is its own HTTPS request), so `ready` means "the card was fetched and its
|
|
31
|
-
* skills were mounted at prepare time", never "the peer is alive right now".
|
|
32
|
-
|
|
33
|
+
* skills were mounted at prepare time", never "the peer is alive right now".
|
|
34
|
+
*
|
|
35
|
+
* A `failed` row carries the SAME failure record an MCP server's failed status carries ({@link McpFailureFields}: `errorCode`, one of
|
|
36
|
+
* `MCP_FAILURE_KINDS`; `delivered`; `authorization` for `unauthorized`), so a consumer keys on one vocabulary for both protocols. The
|
|
37
|
+
* members are present iff the row records a failure that was thrown. A peer seat that did not furnish a send reads
|
|
38
|
+
* `credential_unavailable` (`unauthorized` when it answered that the principal is not authorized); an error the A2A client itself raises
|
|
39
|
+
* for a non-2xx status or a JSON-RPC error carries no structure the classifier reads and reads `unknown` — `error` is the text to show,
|
|
40
|
+
* never the field to key on. */
|
|
41
|
+
export interface A2aPeerStatus extends Partial<McpFailureFields> {
|
|
33
42
|
name: string;
|
|
34
43
|
status: "ready" | "failed";
|
|
35
44
|
/** The card's self-declared name, neutralized + bounded (it rides consumer-rendered lines). */
|
|
@@ -40,8 +49,9 @@ export interface A2aPeerStatus {
|
|
|
40
49
|
toolNames?: string[];
|
|
41
50
|
error?: string;
|
|
42
51
|
}
|
|
43
|
-
/** One per-peer entry of {@link MaterializedA2a.refresh}.
|
|
44
|
-
|
|
52
|
+
/** One per-peer entry of {@link MaterializedA2a.refresh}. A `failed` entry whose refresh threw carries the failure record
|
|
53
|
+
* ({@link A2aPeerStatus}); the entry for a name no peer is declared under (nothing was attempted) carries none. */
|
|
54
|
+
export interface A2aRefreshResult extends Partial<McpFailureFields> {
|
|
45
55
|
peer: string;
|
|
46
56
|
/** The peer's namespaced-name prefix — the consumer's SPLICE DOMAIN for a wholesale swap (the same
|
|
47
57
|
* self-healing prefix domain the MCP refresh receipt hands out). Present on every entry. */
|
|
@@ -98,4 +108,4 @@ export declare class A2aRpcError extends Error {
|
|
|
98
108
|
* `allSettled` keeps it fail-open: one unreachable peer is a skipped peer with a warning, never a task
|
|
99
109
|
* that cannot start.
|
|
100
110
|
*/
|
|
101
|
-
export declare function materializeA2aTools(specs: readonly A2aServerSpec[], principal?: string, signal?: AbortSignal, hostFloor?: HostFloor,
|
|
111
|
+
export declare function materializeA2aTools(specs: readonly A2aServerSpec[], principal?: string, signal?: AbortSignal, hostFloor?: HostFloor, given?: PeerSeat, onCredentialEchoed?: (peer: string, where: CredentialEchoSite) => void): Promise<MaterializedA2a>;
|
package/dist/core/a2a.js
CHANGED
|
@@ -2,9 +2,10 @@ import { randomUUID } from "node:crypto";
|
|
|
2
2
|
import { Type } from "typebox";
|
|
3
3
|
import { A2A_TASK_STATES } from "./a2a-task-state.js";
|
|
4
4
|
import { assertEndpointBound, carriesDeclaredHeaders, resolveProtocolHttpHeaders, underDeclaredHeaders } from "./protocol-http-auth.js";
|
|
5
|
-
import {
|
|
5
|
+
import { carrierEcho, echoAnnouncer, erasedEcho, nameEchoes } from "./credential-echo.js";
|
|
6
|
+
import { PeerCarrier, carriedHttpHeaders, peerSeatMissing, receivePeerSeat } from "./peer-seat.js";
|
|
6
7
|
import { fetchFollowing, hopRefusal, HOST_FLOOR_REFUSED_CODE } from "./host-floor.js";
|
|
7
|
-
import { describeHttpTransportFailure } from "./mcp-failure.js";
|
|
8
|
+
import { classifyMcpFailure, describeHttpTransportFailure, failureFields } from "./mcp-failure.js";
|
|
8
9
|
import { findNamespacePrefixCollision, mintNamespacePrefix, mintNamespacedToolName } from "./protocol-naming.js";
|
|
9
10
|
import { A2A_NAMESPACE } from "./protocol-table.js";
|
|
10
11
|
import { judgeEntryToolAxes, refusedDeclarer, snapshotDeclaredEntry } from "./locked-config.js";
|
|
@@ -49,6 +50,9 @@ const A2A_ERROR_CODE_NAMES = new Map([
|
|
|
49
50
|
const A2A_TERMINAL_STATES = new Set(["completed", "canceled", "failed", "rejected"]);
|
|
50
51
|
const A2A_CALLER_TURN_STATES = new Set(["input-required", "auth-required"]);
|
|
51
52
|
const A2A_STATE_SET = new Set(A2A_TASK_STATES);
|
|
53
|
+
function peerFailureFields(err) {
|
|
54
|
+
return failureFields(classifyMcpFailure(err, { phase: "connect", transport: "http" }));
|
|
55
|
+
}
|
|
52
56
|
export class A2aRpcError extends Error {
|
|
53
57
|
code;
|
|
54
58
|
constructor(peer, method, code, message) {
|
|
@@ -250,7 +254,7 @@ async function discoverCardBody(spec, t, signal) {
|
|
|
250
254
|
}
|
|
251
255
|
throw new Error(`a2a: peer "${peerLabel}" published no agent card — none of ${tried.join(", ")} answered`);
|
|
252
256
|
}
|
|
253
|
-
function negotiateEndpoint(peer, card, fallbackUrl) {
|
|
257
|
+
function negotiateEndpoint(peer, card, fallbackUrl, echo) {
|
|
254
258
|
const offered = [];
|
|
255
259
|
const primaryUrl = asString(card["url"]) ?? fallbackUrl;
|
|
256
260
|
offered.push({ url: primaryUrl, transport: asString(card["preferredTransport"]) ?? A2A_JSONRPC_TRANSPORT });
|
|
@@ -266,6 +270,8 @@ function negotiateEndpoint(peer, card, fallbackUrl) {
|
|
|
266
270
|
for (const candidate of offered) {
|
|
267
271
|
if (candidate.transport.toUpperCase() !== A2A_JSONRPC_TRANSPORT)
|
|
268
272
|
continue;
|
|
273
|
+
if (candidate.url !== fallbackUrl && nameEchoes(candidate.url, echo, "agent_card"))
|
|
274
|
+
continue;
|
|
269
275
|
let absolute;
|
|
270
276
|
try {
|
|
271
277
|
absolute = new URL(candidate.url, fallbackUrl);
|
|
@@ -277,36 +283,42 @@ function negotiateEndpoint(peer, card, fallbackUrl) {
|
|
|
277
283
|
continue;
|
|
278
284
|
return absolute.toString();
|
|
279
285
|
}
|
|
280
|
-
const names = offered.map((o) => inlineUntrusted(o.transport, 40)).join(", ");
|
|
286
|
+
const names = offered.map((o) => inlineUntrusted(erasedEcho(o.transport, echo, "agent_card"), 40)).join(", ");
|
|
281
287
|
throw new Error(`a2a: peer "${inlineUntrusted(peer, A2A_ID_MAX_CHARS)}" advertises no ${A2A_JSONRPC_TRANSPORT} interface (offered: ${names || "none"}) — this client speaks ${A2A_JSONRPC_TRANSPORT} only`);
|
|
282
288
|
}
|
|
283
|
-
function readCard(peer, body, fallbackUrl) {
|
|
289
|
+
function readCard(peer, body, fallbackUrl, echo) {
|
|
284
290
|
const card = asRecord(body);
|
|
285
291
|
if (card === undefined) {
|
|
286
292
|
throw new Error(`a2a: peer "${inlineUntrusted(peer, A2A_ID_MAX_CHARS)}" served an agent card that is not a JSON object`);
|
|
287
293
|
}
|
|
294
|
+
const text = (raw) => erasedEcho(raw, echo, "agent_card");
|
|
288
295
|
const skills = [];
|
|
289
296
|
for (const entry of asArray(card["skills"]) ?? []) {
|
|
290
297
|
const rec = asRecord(entry);
|
|
291
298
|
if (rec === undefined)
|
|
292
299
|
continue;
|
|
293
300
|
const id = asString(rec["id"]);
|
|
294
|
-
if (id === undefined || id === "")
|
|
301
|
+
if (id === undefined || id === "" || nameEchoes(id, echo, "agent_card"))
|
|
295
302
|
continue;
|
|
296
|
-
const tags = (asArray(rec["tags"]) ?? []).filter((v) => typeof v === "string");
|
|
297
|
-
const examples = (asArray(rec["examples"]) ?? []).filter((v) => typeof v === "string");
|
|
303
|
+
const tags = (asArray(rec["tags"]) ?? []).filter((v) => typeof v === "string").map((v) => text(v));
|
|
304
|
+
const examples = (asArray(rec["examples"]) ?? []).filter((v) => typeof v === "string").map((v) => text(v));
|
|
305
|
+
const name = text(asString(rec["name"]));
|
|
306
|
+
const description = text(asString(rec["description"]));
|
|
298
307
|
skills.push({
|
|
299
308
|
id,
|
|
300
|
-
...(
|
|
301
|
-
...(
|
|
309
|
+
...(name !== undefined ? { name } : {}),
|
|
310
|
+
...(description !== undefined ? { description } : {}),
|
|
302
311
|
...(tags.length > 0 ? { tags } : {}),
|
|
303
312
|
...(examples.length > 0 ? { examples } : {}),
|
|
304
313
|
});
|
|
305
314
|
}
|
|
315
|
+
const name = asString(card["name"]);
|
|
316
|
+
const nameHolds = name !== undefined && nameEchoes(name, echo, "agent_card");
|
|
317
|
+
const description = text(asString(card["description"]));
|
|
306
318
|
return {
|
|
307
|
-
...(
|
|
308
|
-
...(
|
|
309
|
-
endpoint: negotiateEndpoint(peer, card, fallbackUrl),
|
|
319
|
+
...(name !== undefined && !nameHolds ? { name: inlineUntrusted(name, A2A_CARD_NAME_MAX_CHARS) } : {}),
|
|
320
|
+
...(description !== undefined ? { description: inlineUntrusted(description, A2A_CARD_DESCRIPTION_MAX_CHARS) } : {}),
|
|
321
|
+
endpoint: negotiateEndpoint(peer, card, fallbackUrl, echo),
|
|
310
322
|
skills,
|
|
311
323
|
};
|
|
312
324
|
}
|
|
@@ -565,7 +577,7 @@ function declaredPeerOf(declared, index) {
|
|
|
565
577
|
const judged = judgeEntryToolAxes(snapshot, "a2a");
|
|
566
578
|
return judged.ok ? { spec: judged.entry } : { spec: snapshot, refusal: judged.error };
|
|
567
579
|
}
|
|
568
|
-
async function materializePeer(peer, principal, lifecycle, signal, floor, seat) {
|
|
580
|
+
async function materializePeer(peer, principal, lifecycle, signal, floor, seat, announceEcho) {
|
|
569
581
|
if ("refusal" in peer)
|
|
570
582
|
throw peer.refusal;
|
|
571
583
|
const { spec } = peer;
|
|
@@ -579,7 +591,7 @@ async function materializePeer(peer, principal, lifecycle, signal, floor, seat)
|
|
|
579
591
|
const carrier = new PeerCarrier(seat, identity, principal, "a2a", spec.principalHeader !== undefined);
|
|
580
592
|
const asks = { carrier, principalHeader: spec.principalHeader, principal, declared, floor };
|
|
581
593
|
const discovery = { peer: spec.name, endpoint: spec.url, ...asks };
|
|
582
|
-
const card = readCard(spec.name, await discoverCardBody(spec, discovery, signal), spec.url);
|
|
594
|
+
const card = readCard(spec.name, await discoverCardBody(spec, discovery, signal), spec.url, carrierEcho(carrier, (where) => announceEcho(spec.name, where)));
|
|
583
595
|
assertEndpointBound(A2A_NAMESPACE.id, spec.name, card.endpoint, declared, carrier.last?.headers === undefined ? undefined : { ...carrier.last.headers });
|
|
584
596
|
const transport = { peer: spec.name, endpoint: card.endpoint, ...asks };
|
|
585
597
|
const tools = [];
|
|
@@ -611,7 +623,8 @@ function asPeerWarning(spec, err) {
|
|
|
611
623
|
warning.code = "a2a.peer_unavailable";
|
|
612
624
|
return warning;
|
|
613
625
|
}
|
|
614
|
-
export async function materializeA2aTools(specs, principal, signal, hostFloor,
|
|
626
|
+
export async function materializeA2aTools(specs, principal, signal, hostFloor, given, onCredentialEchoed) {
|
|
627
|
+
const peerSeat = receivePeerSeat(given, "materializeA2aTools peerSeat");
|
|
615
628
|
const peers = specs.map((spec, index) => declaredPeerOf(spec, index));
|
|
616
629
|
if (peers.length > 0) {
|
|
617
630
|
const collision = findNamespacePrefixCollision(A2A_NAMESPACE, peers.map((p) => p.spec.name));
|
|
@@ -629,7 +642,8 @@ export async function materializeA2aTools(specs, principal, signal, hostFloor, p
|
|
|
629
642
|
const toolAxes = [];
|
|
630
643
|
const warnings = [];
|
|
631
644
|
const statuses = [];
|
|
632
|
-
const
|
|
645
|
+
const announceEcho = echoAnnouncer(onCredentialEchoed);
|
|
646
|
+
const settled = await Promise.allSettled(peers.map((peer) => materializePeer(peer, principal, lifecycle, signal, hostFloor, peerSeat, announceEcho)));
|
|
633
647
|
for (let i = 0; i < peers.length; i++) {
|
|
634
648
|
const spec = peers[i].spec;
|
|
635
649
|
const outcome = settled[i];
|
|
@@ -640,7 +654,7 @@ export async function materializeA2aTools(specs, principal, signal, hostFloor, p
|
|
|
640
654
|
}
|
|
641
655
|
else {
|
|
642
656
|
warnings.push(asPeerWarning(spec, outcome.reason));
|
|
643
|
-
statuses.push({ name: spec.name, status: "failed", error: inlineUntrusted(thrownText(outcome.reason), A2A_ERROR_TEXT_MAX_CHARS) });
|
|
657
|
+
statuses.push({ name: spec.name, status: "failed", ...peerFailureFields(outcome.reason), error: inlineUntrusted(thrownText(outcome.reason), A2A_ERROR_TEXT_MAX_CHARS) });
|
|
644
658
|
}
|
|
645
659
|
}
|
|
646
660
|
return {
|
|
@@ -664,7 +678,7 @@ export async function materializeA2aTools(specs, principal, signal, hostFloor, p
|
|
|
664
678
|
}
|
|
665
679
|
const previous = statuses.find((s) => s.name === spec.name)?.toolNames ?? [];
|
|
666
680
|
try {
|
|
667
|
-
const fresh = await materializePeer(target, principal, lifecycle, signal, hostFloor, peerSeat);
|
|
681
|
+
const fresh = await materializePeer(target, principal, lifecycle, signal, hostFloor, peerSeat, announceEcho);
|
|
668
682
|
const names = fresh.tools.map((t) => t.name);
|
|
669
683
|
results.push({
|
|
670
684
|
peer: spec.name,
|
|
@@ -688,6 +702,7 @@ export async function materializeA2aTools(specs, principal, signal, hostFloor, p
|
|
|
688
702
|
toolCount: previous.length,
|
|
689
703
|
added: [],
|
|
690
704
|
removed: [],
|
|
705
|
+
...peerFailureFields(err),
|
|
691
706
|
error: inlineUntrusted(thrownText(err), A2A_ERROR_TEXT_MAX_CHARS),
|
|
692
707
|
});
|
|
693
708
|
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The engine's account LINE and its one reading. A host that keeps a session's spend (a result frame's total, a `/cost`
|
|
3
|
+
* view, a server's session aggregate) keeps the engine-priced lines it is handed — one per finished run, one per side query — and
|
|
4
|
+
* reads them back through {@link foldAccount}; no host re-sums, re-prices, or decides for itself what an unpriced line means.
|
|
5
|
+
*
|
|
6
|
+
* What the engine owns: the pricing (`priceReply`, the arithmetic every run lane already uses) and the line's shape. What it
|
|
7
|
+
* does not own: where lines are kept — persistence is the host's, so "a resumed session includes its history" is the fold of
|
|
8
|
+
* the history lines the host supplies plus this run's line.
|
|
9
|
+
*/
|
|
10
|
+
import type { TaskResult } from "./task-result.js";
|
|
11
|
+
/** Who caused a line of the account: a run (the user's turns and everything the run's own agent caused — its compaction,
|
|
12
|
+
* classifier, mods, advisor and delegated sub-agents are INSIDE the run's line) or a side query (`Runner.sideQuery`, the one-shot
|
|
13
|
+
* utility call that belongs to no run). A closed set: the fold's `byOrigin` is total over it by its type. */
|
|
14
|
+
export declare const ACCOUNT_ORIGINS: readonly ["run", "side_query"];
|
|
15
|
+
export type AccountOrigin = (typeof ACCOUNT_ORIGINS)[number];
|
|
16
|
+
/** One priced line. `costMicroUsd` is integer micro-USD and ABSENT when any spend in the line was unpriced — unknown, never a
|
|
17
|
+
* fabricated 0 (the run's `stats.costMicroUsd` law); `usageMissing` marks figures that are a lower bound because a reply
|
|
18
|
+
* reported no usage. */
|
|
19
|
+
export interface AccountRow {
|
|
20
|
+
origin: AccountOrigin;
|
|
21
|
+
tokens: number;
|
|
22
|
+
costMicroUsd?: number;
|
|
23
|
+
usageMissing?: true;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The line a finished run contributes: its own usage plus its delegated sub-agents' (`stats.nested`) — the fully reconciled
|
|
27
|
+
* spend of the run. Unknown stays unknown: a run whose own or delegated spend was unpriced yields a line without a cost.
|
|
28
|
+
*
|
|
29
|
+
* The line is exactly what the result's `stats` says, so it is exact for a run that did not durably resume and that no
|
|
30
|
+
* background delegate outlived. `stats` itself is not one interval across a durable resume chain — a leg's own usage is per leg
|
|
31
|
+
* (a `resource_limit` chain's folds the earlier slices in), its delegated usage is cumulative over the chain, and an unknown
|
|
32
|
+
* mark does not survive the chain or the delegation rollup — so the lines of ONE chain are not additive, and spend a background
|
|
33
|
+
* delegate books after the result settled is in no line. Spend the engine books after the result — the prompt-suggestion pass,
|
|
34
|
+
* memory consolidation — is on its own face. The reading that has none of these gaps is an account the engine keeps, minted where
|
|
35
|
+
* each interval is known.
|
|
36
|
+
*/
|
|
37
|
+
export declare function accountRowOfResult(result: {
|
|
38
|
+
readonly stats: Pick<TaskResult["stats"], "tokens" | "costMicroUsd" | "usageMissing" | "nested">;
|
|
39
|
+
}): AccountRow;
|
|
40
|
+
/** A fold of lines: how many, their tokens, their cost (absent as soon as any one line's cost is unknown), and whether any
|
|
41
|
+
* figure is a lower bound. An empty fold is a known zero. */
|
|
42
|
+
export interface AccountTotal {
|
|
43
|
+
rows: number;
|
|
44
|
+
tokens: number;
|
|
45
|
+
costMicroUsd?: number;
|
|
46
|
+
usageMissing?: true;
|
|
47
|
+
}
|
|
48
|
+
/** The session's account: the total over every line, and the same fold per origin. */
|
|
49
|
+
export interface SessionAccount extends AccountTotal {
|
|
50
|
+
byOrigin: Record<AccountOrigin, AccountTotal>;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* THE reading of a session's account: fold the lines a host holds — history lines it persisted, this run's line, side-query lines —
|
|
54
|
+
* into one total and one total per origin. A line whose cost is unknown makes every total that contains it unknown (cost
|
|
55
|
+
* absent), because a sum that skipped it would present a lower bound as the whole. A malformed line (origin outside the closed set,
|
|
56
|
+
* a negative or non-finite number, a cost spelled as anything but an absent key) is refused loudly rather than summed.
|
|
57
|
+
*
|
|
58
|
+
* Which total a field shows is the host's mapping, stated once so the hosts agree: a run result frame's `total_cost_usd` is
|
|
59
|
+
* `byOrigin.run` (the run lines, history included, side queries not in it); a session's cumulative figure is the whole fold.
|
|
60
|
+
*/
|
|
61
|
+
export declare function foldAccount(rows: Iterable<AccountRow>): SessionAccount;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export const ACCOUNT_ORIGINS = Object.freeze(["run", "side_query"]);
|
|
2
|
+
export function accountRowOfResult(result) {
|
|
3
|
+
const { tokens, costMicroUsd, usageMissing, nested } = result.stats;
|
|
4
|
+
const known = costMicroUsd !== undefined && (nested === undefined || nested.costMicroUsd !== undefined);
|
|
5
|
+
return {
|
|
6
|
+
origin: "run",
|
|
7
|
+
tokens: tokens + (nested?.tokens ?? 0),
|
|
8
|
+
...(known ? { costMicroUsd: costMicroUsd + (nested?.costMicroUsd ?? 0) } : {}),
|
|
9
|
+
...(usageMissing === true ? { usageMissing: true } : {}),
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
function addRow(total, row) {
|
|
13
|
+
total.rows += 1;
|
|
14
|
+
total.tokens += row.tokens;
|
|
15
|
+
total.costMicroUsd = total.costMicroUsd === undefined || row.costMicroUsd === undefined ? undefined : total.costMicroUsd + row.costMicroUsd;
|
|
16
|
+
if (row.usageMissing === true)
|
|
17
|
+
total.usageMissing = true;
|
|
18
|
+
}
|
|
19
|
+
function settled(total) {
|
|
20
|
+
const { costMicroUsd, ...rest } = total;
|
|
21
|
+
return { ...rest, ...(costMicroUsd !== undefined ? { costMicroUsd } : {}) };
|
|
22
|
+
}
|
|
23
|
+
function checkedRow(row, index) {
|
|
24
|
+
const bad = (why) => {
|
|
25
|
+
throw new TypeError(`foldAccount: row ${index} ${why}`);
|
|
26
|
+
};
|
|
27
|
+
if (typeof row !== "object" || row === null)
|
|
28
|
+
return bad("is not an object");
|
|
29
|
+
const { origin, tokens, costMicroUsd, usageMissing } = row;
|
|
30
|
+
if (!ACCOUNT_ORIGINS.includes(origin))
|
|
31
|
+
bad(`has origin ${JSON.stringify(origin)}, outside ${JSON.stringify(ACCOUNT_ORIGINS)}`);
|
|
32
|
+
if (typeof tokens !== "number" || !Number.isFinite(tokens) || tokens < 0)
|
|
33
|
+
bad("has tokens that are not a finite non-negative number");
|
|
34
|
+
if (costMicroUsd !== undefined && (typeof costMicroUsd !== "number" || !Number.isInteger(costMicroUsd) || costMicroUsd < 0))
|
|
35
|
+
bad("has costMicroUsd that is not a non-negative integer of micro-USD (an unknown cost is an absent key; a USD figure is not micro-USD)");
|
|
36
|
+
if (usageMissing !== undefined && usageMissing !== true)
|
|
37
|
+
bad("has usageMissing other than true (an absent key is the only other reading)");
|
|
38
|
+
return { origin: origin, tokens: tokens, ...(costMicroUsd !== undefined ? { costMicroUsd: costMicroUsd } : {}), ...(usageMissing === true ? { usageMissing: true } : {}) };
|
|
39
|
+
}
|
|
40
|
+
export function foldAccount(rows) {
|
|
41
|
+
const empty = () => ({ rows: 0, tokens: 0, costMicroUsd: 0 });
|
|
42
|
+
const byOrigin = { run: empty(), side_query: empty() };
|
|
43
|
+
const all = empty();
|
|
44
|
+
let index = 0;
|
|
45
|
+
for (const raw of rows) {
|
|
46
|
+
const row = checkedRow(raw, index++);
|
|
47
|
+
addRow(byOrigin[row.origin], row);
|
|
48
|
+
addRow(all, row);
|
|
49
|
+
}
|
|
50
|
+
return { ...settled(all), byOrigin: { run: settled(byOrigin.run), side_query: settled(byOrigin.side_query) } };
|
|
51
|
+
}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* The closed sets the answers are spelled in live beside them.
|
|
7
7
|
*/
|
|
8
8
|
import type { SessionTreeEntry } from "../internal/harness-types.js";
|
|
9
|
+
import type { AssistantMessage } from "../internal/llm.js";
|
|
9
10
|
import { type BrainErrorCode } from "../brain/errors.js";
|
|
10
11
|
import type { AssertAllKeysHandled } from "./ask-origin.js";
|
|
11
12
|
import type { EngineNotice, Model, ModelRef, RunnerDeps } from "./types.js";
|
|
@@ -86,7 +87,7 @@ export type HoldCausesCoverEveryBrainCode = AssertAllKeysHandled<Exclude<BrainEr
|
|
|
86
87
|
/** What a failed advisor request said about itself — the fields the hold reads and the card carries. */
|
|
87
88
|
export interface AdvisorFailure {
|
|
88
89
|
readonly code?: BrainErrorCode;
|
|
89
|
-
readonly errorKind?: "
|
|
90
|
+
readonly errorKind?: AssistantMessage["errorKind"];
|
|
90
91
|
readonly inputTooLongRuledOut?: true;
|
|
91
92
|
}
|
|
92
93
|
/** Whether this failure switches the advisor off for the conversation ({@link ADVISOR_HOLD_CAUSES}). */
|
|
@@ -62,7 +62,7 @@ export function advisorFailureHolds(f) {
|
|
|
62
62
|
const row = ADVISOR_HOLD_CAUSES[f.code];
|
|
63
63
|
return row === "hold" || (row === "hold_unless_window" && f.errorKind !== "input_too_long" && f.inputTooLongRuledOut === true);
|
|
64
64
|
}
|
|
65
|
-
const ERROR_KINDS = new Set(["input_too_long", "degenerate", "length_empty"]);
|
|
65
|
+
const ERROR_KINDS = new Set(["input_too_long", "degenerate", "length_empty", "image_unprocessable"]);
|
|
66
66
|
export function advisorHoldOf(entries) {
|
|
67
67
|
for (let i = entries.length - 1; i >= 0; i--) {
|
|
68
68
|
const e = entries[i];
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import type { ThinkingLevel } from "../internal/harness.js";
|
|
7
7
|
import type { ModelRef } from "./model-seat.js";
|
|
8
8
|
import type { TaskSpec } from "./task-spec.js";
|
|
9
|
+
import type { McpServerSpec } from "./mcp-server-spec.js";
|
|
9
10
|
/**
|
|
10
11
|
* A declarative, reusable named sub-agent (design/38 1B). Hand a set to {@link createSubagentTool} and the
|
|
11
12
|
* model picks one (by `whenToUse`) to delegate to; the chosen definition's config builds the child task.
|
|
@@ -42,6 +43,25 @@ export interface AgentDefinition {
|
|
|
42
43
|
* invocable via the `skill` tool. Deployment-trusted, same trust tier as `systemPrompt`.
|
|
43
44
|
*/
|
|
44
45
|
skills?: SkillSpec[];
|
|
46
|
+
/**
|
|
47
|
+
* The MCP servers this agent connects to when it runs — declarations in exactly the {@link TaskSpec.mcp} form, judged by the
|
|
48
|
+
* door that judges a task's own list (the same refusal, code and sentence) where the definition is received — the delegation
|
|
49
|
+
* tool's assembly, the {@link TaskSpec.agents} door, a workflow's `agentType` fold — and again at the leg's own prepare (an
|
|
50
|
+
* `mcp` configuration lock or a compliance deny of MCP servers refuses the leg there). They are declared on the leg spawned as
|
|
51
|
+
* this agent alone: its children inherit them as they inherit any server their spawner declares, and the spawning run never
|
|
52
|
+
* mounts them. Three rules decide what the leg holds:
|
|
53
|
+
* - the leg is declared the servers it inherits from the spawning run first (none when the delegation tool has a pool of its
|
|
54
|
+
* own), then each of these whose tool namespace (`mcp__<server>__`) none of those holds — a name the spawning run already
|
|
55
|
+
* declares for the leg names the spawning run's server; two of these under one namespace refuse the leg's mount, as a task's pair does;
|
|
56
|
+
* - this definition's own {@link allowTools}, when it has one, admits every tool of each server declared here (its own
|
|
57
|
+
* {@link denyTools} still wins), so an agent restricted to a few tools still holds the servers it brought;
|
|
58
|
+
* - every layer above the leg (the spawning run's tool lists and the ones it inherits) still decides, as for any tool of the
|
|
59
|
+
* leg: a server the leg's valve leaves nothing of — no tool of its namespace, no cross-server resource reader — is not dialled
|
|
60
|
+
* (the leg's wiring manifest reads it `skipped`).
|
|
61
|
+
* A server reference by name alone (another configuration's server) has no form here: a definition that should hold a server
|
|
62
|
+
* its spawning run declares names it in {@link allowTools} (`mcp__<server>`). Deployment-trusted, like {@link systemPrompt}.
|
|
63
|
+
*/
|
|
64
|
+
mcp?: McpServerSpec[];
|
|
45
65
|
/**
|
|
46
66
|
* F7 (per-agent `background`, OR-ed into
|
|
47
67
|
* the background predicate, GA/ungated): `true` = this agent ALWAYS launches on the background lane
|
|
@@ -22,6 +22,8 @@ export interface AllowEntryInertDetail {
|
|
|
22
22
|
readonly verdict?: Exclude<RuleToolNameVerdict["kind"], "current">;
|
|
23
23
|
readonly guidance?: string;
|
|
24
24
|
readonly currentName?: string;
|
|
25
|
+
/** `tool_name` / `unmintable_segment` only: the refusal is the ALLOW-side ambiguity of an MCP name ({@link peerReadingsOf}), not a segment the mint never produces. */
|
|
26
|
+
readonly ambiguous?: true;
|
|
25
27
|
readonly valueType?: string;
|
|
26
28
|
/** Where the spelling of a `near_miss` comes from, when the station that read it reads more than the run's roster
|
|
27
29
|
* ({@link NearMissCarrier}); absent ⇒ the roster the run mounts. A sentence only — never a field of a wire detail. */
|
|
@@ -123,13 +125,23 @@ export declare const AUTO_STRIPPED_PROGRAMS: readonly ["python", "python3", "pyt
|
|
|
123
125
|
* Does auto mode strip this allow entry for this call (see the module doc)? Read for every rule-shaped member — a list
|
|
124
126
|
* entry, and a person's stored row through {@link autoStrippedRule}; a hook's allow is not an entry and is never stripped.
|
|
125
127
|
* A stripped entry takes no part in the match (the reference removes it before matching), so it neither clears nor is
|
|
126
|
-
* disclosed.
|
|
128
|
+
* disclosed. `allShell`: the leg declared `TaskSpec.classifyAllShell` — every shell command rule stands down, whatever it
|
|
129
|
+
* names, and no entry of any kind clears a call that answers to the shell (the reference suspends every shell allow rule
|
|
130
|
+
* under that setting without reading its content; a path rule a shell-face tool's declared target reaches is one here).
|
|
127
131
|
*/
|
|
128
|
-
export declare function autoStripped(compiled: CompiledAllowEntry, call: ToolCallRequest | undefined): boolean;
|
|
129
|
-
/**
|
|
132
|
+
export declare function autoStripped(compiled: CompiledAllowEntry, call: ToolCallRequest | undefined, allShell: boolean): boolean;
|
|
133
|
+
/** THE strip as every allow member reads it, per call: only in `auto`, and then {@link autoStripped} under the leg's
|
|
134
|
+
* `classifyAllShell` declaration. The one place the mode is compared for the strip. */
|
|
135
|
+
export declare function strippedInAuto(compiled: CompiledAllowEntry, call: ToolCallRequest | undefined, mode: PermissionMode | undefined, allShell: boolean): boolean;
|
|
136
|
+
/** {@link strippedInAuto} over a person's stored ALLOW row, read as its list twin ({@link entryOfRow}): a row is stripped exactly when
|
|
130
137
|
* the entry spelling the same rule is (a deny / ask row never is; a row no grammar reads has no twin and is not stripped here — the
|
|
131
138
|
* lane reads no allow it cannot parse). */
|
|
132
|
-
export declare function autoStrippedRule(rule: PersistedRule, call: ToolCallRequest): boolean;
|
|
139
|
+
export declare function autoStrippedRule(rule: PersistedRule, call: ToolCallRequest, mode: PermissionMode | undefined, allShell: boolean): boolean;
|
|
140
|
+
/** Does the leg's spec declare that every shell entry is the classifier's in `auto` — the one reading of
|
|
141
|
+
* `TaskSpec.classifyAllShell` (its value is screened at the door: present ⇒ a boolean). */
|
|
142
|
+
export declare function classifiesAllShell(spec: {
|
|
143
|
+
readonly classifyAllShell?: boolean;
|
|
144
|
+
}): boolean;
|
|
133
145
|
/** One row a list matcher reads. */
|
|
134
146
|
export interface AllowEntryRow {
|
|
135
147
|
readonly behavior: "allow" | "deny";
|
|
@@ -138,12 +150,14 @@ export interface AllowEntryRow {
|
|
|
138
150
|
}
|
|
139
151
|
/** The facts a list's content row is judged under: the leg's root and session (which rows apply), the live working
|
|
140
152
|
* directory (where a command's `cd` lands), and the ANCHORS of the list's path rows — the leg the list was installed
|
|
141
|
-
* on (its root and environment home): a path row of a list never moves with a `cd`.
|
|
153
|
+
* on (its root and environment home): a path row of a list never moves with a `cd`. `classifyAllShell`: the leg's
|
|
154
|
+
* declaration ({@link classifiesAllShell}) the auto strip reads ({@link strippedInAuto}); absent ⇒ the leg declared nothing. */
|
|
142
155
|
export interface AllowEntryJudgeContext {
|
|
143
156
|
readonly root: string | undefined;
|
|
144
157
|
readonly sessionId: string | undefined;
|
|
145
158
|
readonly liveCwd: () => string | undefined;
|
|
146
159
|
readonly anchors: PathRuleBases;
|
|
160
|
+
readonly classifyAllShell?: boolean;
|
|
147
161
|
}
|
|
148
162
|
/** For a list whose allow rows admitted no call ({@link judgeAllowEntries}): the first segment of the call's command no command
|
|
149
163
|
* row covers under `posture` — the word a refusal names; `undefined` when the call carries no command or no single segment is
|
|
@@ -165,7 +179,7 @@ export declare function uncoveredCommandSegment(rows: readonly AllowEntryRow[],
|
|
|
165
179
|
*/
|
|
166
180
|
export declare function judgeAllowEntries<R extends AllowEntryRow>(rows: readonly R[], req: ToolCallRequest, behavior: "allow" | "deny", ctx: AllowEntryJudgeContext, posture?: AdmissionPosture): readonly R[] | undefined;
|
|
167
181
|
/** The allow rows of a list, as the allow layer reads them in `mode`: the strip applied BEFORE the match (in `auto`). */
|
|
168
|
-
export declare function allowingRows<R extends AllowEntryRow>(rows: readonly R[], req: ToolCallRequest, mode: PermissionMode | undefined): readonly R[];
|
|
182
|
+
export declare function allowingRows<R extends AllowEntryRow>(rows: readonly R[], req: ToolCallRequest, mode: PermissionMode | undefined, allShell: boolean): readonly R[];
|
|
169
183
|
/** The two sources {@link AllowEntryTable} holds (a skill's list is the skill table's). */
|
|
170
184
|
export type AllowEntrySource = "request" | "deployment";
|
|
171
185
|
/** What spoke for a call: the entries it stands on, as the list spells them, and — for entries of the list the run received —
|
package/dist/core/allow-entry.js
CHANGED
|
@@ -127,30 +127,35 @@ function shellRuleContent(rule) {
|
|
|
127
127
|
const body = "reject" in split ? rule.command : (split.segments[split.segments.length - 1] ?? rule.command).trim();
|
|
128
128
|
return rule.match === "prefix" ? `${body}:*` : rule.match === "wildcard" ? `${body} *` : body;
|
|
129
129
|
}
|
|
130
|
-
export function autoStripped(compiled, call) {
|
|
130
|
+
export function autoStripped(compiled, call, allShell) {
|
|
131
131
|
switch (compiled.kind) {
|
|
132
132
|
case "shell":
|
|
133
133
|
return true;
|
|
134
134
|
case "tool":
|
|
135
135
|
return call !== undefined && answersTo(call, isShellFaceToolName);
|
|
136
136
|
case "command":
|
|
137
|
+
if (allShell)
|
|
138
|
+
return true;
|
|
137
139
|
return compiled.rule.match === "pattern" ? commandPatternMayRun(compiled.rule.command, AUTO_STRIPPED_PROGRAMS) : shellContentStripped(shellRuleContent(compiled.rule));
|
|
138
140
|
case "covering":
|
|
139
141
|
case "path":
|
|
140
142
|
case "name":
|
|
141
143
|
case "domain":
|
|
142
|
-
return
|
|
144
|
+
return allShell && call !== undefined && answersTo(call, isShellFaceToolName);
|
|
143
145
|
default: {
|
|
144
146
|
const exhaustive = compiled;
|
|
145
147
|
return exhaustive;
|
|
146
148
|
}
|
|
147
149
|
}
|
|
148
150
|
}
|
|
149
|
-
export function
|
|
151
|
+
export function strippedInAuto(compiled, call, mode, allShell) {
|
|
152
|
+
return mode === "auto" && autoStripped(compiled, call, allShell);
|
|
153
|
+
}
|
|
154
|
+
export function autoStrippedRule(rule, call, mode, allShell) {
|
|
150
155
|
if (rule.behavior !== "allow")
|
|
151
156
|
return false;
|
|
152
157
|
const entry = entryOfRow(rule);
|
|
153
|
-
return entry !== undefined &&
|
|
158
|
+
return entry !== undefined && strippedInAuto(entry, call, mode, allShell);
|
|
154
159
|
}
|
|
155
160
|
function entryOfRow(rule) {
|
|
156
161
|
if (rule.match === "tool")
|
|
@@ -158,6 +163,9 @@ function entryOfRow(rule) {
|
|
|
158
163
|
const grammar = ruleToolGrammarOf(rule.tool);
|
|
159
164
|
return grammar === undefined ? undefined : { kind: grammar, rule };
|
|
160
165
|
}
|
|
166
|
+
export function classifiesAllShell(spec) {
|
|
167
|
+
return spec.classifyAllShell === true;
|
|
168
|
+
}
|
|
161
169
|
const NO_LEADS = new Map();
|
|
162
170
|
function nameRowReaches(compiled, req) {
|
|
163
171
|
if (compiled.kind === "tool" || compiled.kind === "shell")
|
|
@@ -234,8 +242,8 @@ export function judgeAllowEntries(rows, req, behavior, ctx, posture = "grant") {
|
|
|
234
242
|
}
|
|
235
243
|
return undefined;
|
|
236
244
|
}
|
|
237
|
-
export function allowingRows(rows, req, mode) {
|
|
238
|
-
return
|
|
245
|
+
export function allowingRows(rows, req, mode, allShell) {
|
|
246
|
+
return rows.filter((r) => !strippedInAuto(r.compiled, req, mode, allShell));
|
|
239
247
|
}
|
|
240
248
|
export class AllowEntryTable {
|
|
241
249
|
held = [];
|
|
@@ -270,7 +278,7 @@ export class AllowEntryTable {
|
|
|
270
278
|
lane(ctx) {
|
|
271
279
|
return {
|
|
272
280
|
allowing: (req, mode) => {
|
|
273
|
-
const hit = judgeAllowEntries(allowingRows(this.held, req, mode), req, "allow", ctx);
|
|
281
|
+
const hit = judgeAllowEntries(allowingRows(this.held, req, mode, ctx.classifyAllShell === true), req, "allow", ctx);
|
|
274
282
|
if (hit === undefined)
|
|
275
283
|
return undefined;
|
|
276
284
|
const entries = hit.map((r) => r.entry);
|
|
@@ -466,6 +474,8 @@ export function inertEntryPhrase(e) {
|
|
|
466
474
|
case "unprefixed_namespace":
|
|
467
475
|
return 'tool_name: a "__" name with no protocol prefix';
|
|
468
476
|
case "unmintable_segment":
|
|
477
|
+
if (e.ambiguous === true && e.guidance !== undefined)
|
|
478
|
+
return `tool_name: ${e.guidance}${spelling !== undefined ? ` Write "${spelling}"` : ""}`;
|
|
469
479
|
return `tool_name: a namespaced name with a segment the engine never mints${spelling !== undefined ? `, write "${spelling}"` : ""}`;
|
|
470
480
|
default: {
|
|
471
481
|
const exhaustive = e.verdict;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { PendingAction } from "./checkpoint-store.js";
|
|
2
|
-
import type
|
|
2
|
+
import { type CallTargetReading } from "./effective-path-target.js";
|
|
3
3
|
import { type SkillGrantSource } from "./skill-grant.js";
|
|
4
4
|
import type { ReadLanding } from "../tools/fs/shell-read-identity.js";
|
|
5
5
|
import type { ToolCallPathTarget, ToolFamily, ToolHostTarget } from "./tool-face.js";
|
|
6
|
-
import { type ToolRosterEntry } from "./tool-roster.js";
|
|
6
|
+
import { type RosterFaceMember, type RosterIdentityCarrier, type ToolRosterEntry } from "./tool-roster.js";
|
|
7
|
+
import type { AssertAllKeysHandled } from "./ask-origin.js";
|
|
7
8
|
type ParkedApproval = Extract<PendingAction, {
|
|
8
9
|
kind: "tool_approval";
|
|
9
10
|
}>;
|
|
@@ -26,19 +27,25 @@ export type ApprovalTargets = {
|
|
|
26
27
|
export type ApprovalTargetReads = {
|
|
27
28
|
readonly [candidate: string]: string;
|
|
28
29
|
};
|
|
29
|
-
/** The tool member
|
|
30
|
+
/** The tool member of a row, read WHOLE: the identity the roster row carried (its four members and the mount site), its face and
|
|
31
|
+
* its declaration's digest, as the park minted them off that row ({@link ROSTER_APPROVAL_BINDING}). The optional members are
|
|
32
|
+
* absent exactly when the roster row had none (no path target, no URL slot, not the engine's mount). */
|
|
30
33
|
export interface ApprovalTool {
|
|
31
|
-
readonly capabilityId
|
|
32
|
-
readonly contractId
|
|
33
|
-
readonly shapeDigest
|
|
34
|
-
readonly implementationRevision
|
|
35
|
-
readonly
|
|
34
|
+
readonly capabilityId: string;
|
|
35
|
+
readonly contractId: string;
|
|
36
|
+
readonly shapeDigest: string;
|
|
37
|
+
readonly implementationRevision: string;
|
|
38
|
+
readonly engineMounted?: true;
|
|
39
|
+
readonly family: ToolFamily;
|
|
36
40
|
readonly pathTarget?: ToolCallPathTarget;
|
|
37
41
|
readonly hostTarget?: ToolHostTarget;
|
|
42
|
+
readonly declarationDigest: string;
|
|
38
43
|
}
|
|
39
44
|
export interface ApprovalObject {
|
|
40
|
-
/**
|
|
41
|
-
readonly tool
|
|
45
|
+
/** The tool member, or the members a whole one would carry that the row lacks or carries out of their shape. */
|
|
46
|
+
readonly tool: ApprovalTool | {
|
|
47
|
+
readonly missing: readonly string[];
|
|
48
|
+
};
|
|
42
49
|
/** The row's two target members as stored — read, validated, by the judge. */
|
|
43
50
|
readonly targets?: unknown;
|
|
44
51
|
readonly targetReads?: unknown;
|
|
@@ -70,9 +77,9 @@ export type ApprovalDisposition = "refuse_pending" | "reopen" | "veto";
|
|
|
70
77
|
export interface ApprovalMismatch {
|
|
71
78
|
readonly member: ApprovalMember;
|
|
72
79
|
readonly disposition: ApprovalDisposition;
|
|
73
|
-
/** The machine word: the reopen codes, `resume.target_moved` on a moved face or target (the vetoed call's
|
|
74
|
-
* `tool_end.errorCode`); absent on a grants veto. */
|
|
75
|
-
readonly code?: "resume.tool_unavailable" | "resume.tool_contract_mismatch" | "resume.target_moved" | "checkpoint.invalid_outcome";
|
|
80
|
+
/** The machine word: the reopen codes, `resume.target_moved` on a moved face, declaration or target (the vetoed call's
|
|
81
|
+
* `tool_end.errorCode`), the claim's refusal codes; absent on a grants veto. */
|
|
82
|
+
readonly code?: "resume.tool_unavailable" | "resume.tool_contract_mismatch" | "resume.target_moved" | "checkpoint.invalid_outcome" | "checkpoint.unsupported_version";
|
|
76
83
|
readonly message: string;
|
|
77
84
|
}
|
|
78
85
|
/** What the station holds of the live call. */
|
|
@@ -92,10 +99,17 @@ export interface LiveApprovalObject {
|
|
|
92
99
|
* person approved bytes whose target the row never recorded, and the targets member is not judged. */
|
|
93
100
|
readonly decided?: unknown;
|
|
94
101
|
}
|
|
102
|
+
declare const IDENTITY_MEMBERS: readonly ["capabilityId", "contractId", "shapeDigest", "implementationRevision", "engineMounted"];
|
|
103
|
+
declare const FACE_MEMBERS: readonly ["family", "pathTarget", "hostTarget"];
|
|
104
|
+
/** The two lists the judge compares are exactly the classification's (`ROSTER_APPROVAL_BINDING`): an identity carrier or a face
|
|
105
|
+
* member the table adds or drops is a compile error here until the judge reads it so (a roster key moved between classes while the
|
|
106
|
+
* carrier set stays the same — `name` beside `capabilityId` — is not). */
|
|
107
|
+
export type IdentityMembersAreTheTables = AssertAllKeysHandled<Exclude<RosterIdentityCarrier, (typeof IDENTITY_MEMBERS)[number]> | Exclude<(typeof IDENTITY_MEMBERS)[number], RosterIdentityCarrier>>;
|
|
108
|
+
export type FaceMembersAreTheTables = AssertAllKeysHandled<Exclude<RosterFaceMember, (typeof FACE_MEMBERS)[number]> | Exclude<(typeof FACE_MEMBERS)[number], RosterFaceMember>>;
|
|
95
109
|
/**
|
|
96
110
|
* THE judge of a parked approval at one station: `"match"`, or the first member the table names for the station that
|
|
97
|
-
* the live call does not match, with its disposition. Absence is read per member: a tool member
|
|
98
|
-
*
|
|
111
|
+
* the live call does not match, with its disposition. Absence is read per member: a tool member is whole or binds no tool
|
|
112
|
+
* (refused before the claim, never read by name or by default); a grants
|
|
99
113
|
* member is judged whenever the call would activate a skill (a row with no digest cannot cover one); a targets member
|
|
100
114
|
* is judged unless the decision rewrote the bytes to ones the row's binding does not cover, and one that is not a whole
|
|
101
115
|
* role → location record is damage.
|