@sema-agent/core 7.66.0 → 7.67.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 +3498 -0
- package/LICENSE +2 -1
- package/dist/agents/agent-definition.js +2 -1
- package/dist/agents/agent-transcript-tool.d.ts +1 -1
- package/dist/agents/agent-transcript-tool.js +4 -3
- package/dist/agents/builtin-agents.d.ts +10 -7
- package/dist/agents/builtin-agents.js +1 -0
- package/dist/agents/cascade.d.ts +24 -11
- package/dist/agents/cascade.js +21 -9
- package/dist/agents/child-failure.d.ts +30 -0
- package/dist/agents/child-failure.js +25 -1
- package/dist/agents/composition-placement.d.ts +6 -2
- package/dist/agents/composition-placement.js +7 -3
- package/dist/agents/cross-session-envelope.d.ts +10 -1
- package/dist/agents/cross-session-envelope.js +6 -2
- package/dist/agents/cross-session-judge.d.ts +7 -1
- package/dist/agents/cross-session-judge.js +1 -0
- package/dist/agents/cumulative-stats.d.ts +36 -2
- package/dist/agents/cumulative-stats.js +44 -9
- package/dist/agents/delegation-registry-seat.js +2 -3
- package/dist/agents/inherited-tool-pool.d.ts +9 -4
- package/dist/agents/inherited-tool-pool.js +7 -1
- package/dist/agents/leg-label.d.ts +28 -0
- package/dist/agents/leg-label.js +9 -0
- package/dist/agents/list-agents-tool.d.ts +1 -1
- package/dist/agents/list-agents-tool.js +4 -4
- package/dist/agents/org-delivery-gate.d.ts +129 -23
- package/dist/agents/org-delivery-gate.js +41 -20
- package/dist/agents/peer-held-queue.d.ts +15 -10
- package/dist/agents/peer-held-queue.js +47 -19
- package/dist/agents/peer-notice-route.js +2 -2
- package/dist/agents/peer-notices.d.ts +13 -2
- package/dist/agents/peer-notices.js +12 -2
- package/dist/agents/peer-session-drain.d.ts +65 -15
- package/dist/agents/peer-session-drain.js +198 -41
- package/dist/agents/read-inbox-tool.d.ts +3 -2
- package/dist/agents/read-inbox-tool.js +7 -5
- package/dist/agents/repair-loop.js +20 -16
- package/dist/agents/retain-ledger.d.ts +1 -1
- package/dist/agents/retain-ledger.js +2 -4
- package/dist/agents/root-session-lane.d.ts +27 -0
- package/dist/agents/root-session-lane.js +57 -0
- package/dist/agents/roster-store.js +1 -2
- package/dist/agents/send-message-tool.js +6 -4
- package/dist/agents/subagent.d.ts +20 -4
- package/dist/agents/subagent.js +218 -183
- package/dist/agents/tool-filter.d.ts +3 -10
- package/dist/agents/tool-filter.js +0 -13
- package/dist/agents/verifier-independence.d.ts +31 -0
- package/dist/agents/verifier-independence.js +23 -0
- package/dist/agents/verify.d.ts +23 -11
- package/dist/agents/verify.js +28 -12
- package/dist/agents/yield-adoption.d.ts +24 -0
- package/dist/agents/yield-adoption.js +84 -0
- package/dist/bench/metrics.d.ts +2 -2
- package/dist/brain/anthropic.d.ts +4 -2
- package/dist/brain/anthropic.js +49 -35
- package/dist/brain/brain-faces.d.ts +11 -0
- package/dist/brain/brain-faces.js +6 -0
- package/dist/brain/cache-retention.d.ts +2 -0
- package/dist/brain/cache-retention.js +9 -0
- package/dist/brain/circuit-breaker.js +51 -26
- package/dist/brain/errors.d.ts +15 -1
- package/dist/brain/errors.js +8 -0
- package/dist/brain/failover.d.ts +6 -0
- package/dist/brain/failover.js +52 -37
- package/dist/brain/media-degrade.d.ts +5 -0
- package/dist/brain/media-degrade.js +4 -0
- package/dist/brain/model-capability.d.ts +2 -1
- package/dist/brain/model-lane.d.ts +145 -0
- package/dist/brain/model-lane.js +444 -0
- package/dist/brain/open-responses.js +19 -22
- package/dist/brain/openai.js +23 -22
- package/dist/brain/provider-message.d.ts +9 -0
- package/dist/brain/provider-message.js +18 -0
- package/dist/brain/reasoning-request.d.ts +9 -7
- package/dist/brain/reasoning-request.js +9 -10
- package/dist/brain/reasoning.d.ts +47 -13
- package/dist/brain/reasoning.js +20 -10
- package/dist/brain/route-adjudicator.d.ts +8 -2
- package/dist/brain/route-adjudicator.js +35 -1
- package/dist/brain/route-conformance.js +17 -0
- package/dist/brain/routing.d.ts +2 -0
- package/dist/brain/routing.js +19 -8
- package/dist/brain/status-sink.d.ts +5 -4
- package/dist/brain/status-sink.js +2 -2
- package/dist/brain/stream-engine.js +8 -2
- package/dist/brain/stream-shared.d.ts +12 -0
- package/dist/brain/stream-shared.js +18 -0
- package/dist/brain/timeout.d.ts +28 -0
- package/dist/brain/timeout.js +13 -4
- package/dist/brain/tool-schema-projection.d.ts +2 -0
- package/dist/brain/tool-schema-projection.js +108 -0
- package/dist/brain/usage-reading.d.ts +49 -0
- package/dist/brain/usage-reading.js +44 -0
- package/dist/brain/usage-reasoning.d.ts +38 -0
- package/dist/brain/usage-reasoning.js +9 -0
- package/dist/config/catalog.d.ts +3 -0
- package/dist/config/catalog.js +18 -9
- package/dist/core/a2a.d.ts +22 -4
- package/dist/core/a2a.js +191 -50
- package/dist/core/agent-definition.d.ts +3 -1
- package/dist/core/agent-state.d.ts +29 -16
- package/dist/core/agent-state.js +36 -9
- package/dist/core/allow-entry.d.ts +12 -3
- package/dist/core/allow-entry.js +10 -3
- package/dist/core/approval-display.d.ts +18 -0
- package/dist/core/approval-display.js +26 -0
- package/dist/core/approval-object.js +2 -2
- package/dist/core/approval-route.d.ts +16 -0
- package/dist/core/approval-route.js +5 -0
- package/dist/core/approval-words.d.ts +43 -0
- package/dist/core/approval-words.js +37 -0
- package/dist/core/ask-origin.d.ts +37 -10
- package/dist/core/ask-origin.js +19 -7
- package/dist/core/ask-question.d.ts +36 -8
- package/dist/core/ask-question.js +24 -9
- package/dist/core/ask-unresolvable-notice.d.ts +3 -2
- package/dist/core/ask-unresolvable-notice.js +3 -2
- package/dist/core/attachment-source.d.ts +50 -0
- package/dist/core/attachment-source.js +46 -0
- package/dist/core/auto-compaction.d.ts +151 -40
- package/dist/core/auto-compaction.js +115 -50
- package/dist/core/auto-mode.d.ts +5 -0
- package/dist/core/auto-mode.js +11 -4
- package/dist/core/background-agent-store.d.ts +151 -23
- package/dist/core/background-agent-store.js +201 -61
- package/dist/core/background-shell.d.ts +4 -1
- package/dist/core/background-shell.js +1 -0
- package/dist/core/cache-break-detector.d.ts +49 -25
- package/dist/core/cache-break-detector.js +99 -44
- package/dist/core/caller-text.d.ts +28 -0
- package/dist/core/caller-text.js +12 -0
- package/dist/core/canonical-json.d.ts +5 -0
- package/dist/core/canonical-json.js +7 -0
- package/dist/core/checkpoint-features.d.ts +80 -9
- package/dist/core/checkpoint-features.js +1 -1
- package/dist/core/checkpoint-generation.d.ts +8 -1
- package/dist/core/checkpoint-generation.js +3 -0
- package/dist/core/checkpoint-queries.d.ts +47 -14
- package/dist/core/checkpoint-queries.js +63 -30
- package/dist/core/checkpoint-requirements.d.ts +36 -3
- package/dist/core/checkpoint-requirements.js +11 -1
- package/dist/core/checkpoint-row-verdict.d.ts +0 -2
- package/dist/core/checkpoint-row-verdict.js +5 -8
- package/dist/core/checkpoint-store.d.ts +166 -41
- package/dist/core/checkpoint-store.js +96 -15
- package/dist/core/child-clamp-seats.d.ts +10 -2
- package/dist/core/child-clamp-seats.js +2 -2
- package/dist/core/classifier-unavailable-arm.d.ts +11 -9
- package/dist/core/classifier-unavailable-arm.js +4 -2
- package/dist/core/command-sandbox-dispatch.d.ts +13 -0
- package/dist/core/command-sandbox-dispatch.js +8 -0
- package/dist/core/command-sandbox.d.ts +231 -0
- package/dist/core/command-sandbox.js +344 -0
- package/dist/core/completion-id.d.ts +21 -0
- package/dist/core/completion-id.js +14 -0
- package/dist/core/config-refusal-codes.d.ts +22 -0
- package/dist/core/config-refusal-codes.js +196 -0
- package/dist/core/context-edit.d.ts +26 -0
- package/dist/core/context-edit.js +4 -2
- package/dist/core/context-guard.d.ts +80 -7
- package/dist/core/context-guard.js +126 -25
- package/dist/core/context-settings.d.ts +32 -0
- package/dist/core/context-settings.js +41 -3
- package/dist/core/contract-faces.d.ts +22 -0
- package/dist/core/contract-faces.js +1 -0
- package/dist/core/credential-echo.d.ts +2 -2
- package/dist/core/credential-echo.js +2 -2
- package/dist/core/cross-boundary-taint.d.ts +10 -8
- package/dist/core/decision-receipt.d.ts +3 -2
- package/dist/core/decision-receipt.js +1 -1
- package/dist/core/definition-entry-grammar.d.ts +42 -0
- package/dist/core/definition-entry-grammar.js +15 -0
- package/dist/core/engine-attestation.d.ts +19 -4
- package/dist/core/engine-attestation.js +4 -0
- package/dist/core/engine-capabilities.d.ts +8 -1
- package/dist/core/engine-capabilities.js +1 -1
- package/dist/core/engine-contracts/open-face-contract.d.ts +39 -0
- package/dist/core/engine-contracts/open-face-contract.js +57 -0
- package/dist/core/engine-notice.d.ts +161 -33
- package/dist/core/exclusive-temp.d.ts +25 -0
- package/dist/core/exclusive-temp.js +19 -0
- package/dist/core/existing-target.d.ts +112 -0
- package/dist/core/existing-target.js +88 -0
- package/dist/core/file-history-store.d.ts +14 -6
- package/dist/core/gate-lanes.js +8 -3
- package/dist/core/gate-outcome.d.ts +2 -1
- package/dist/core/git-worktree-env.d.ts +92 -1
- package/dist/core/git-worktree-env.js +87 -6
- package/dist/core/governance-codes.d.ts +49 -8
- package/dist/core/governance-codes.js +59 -8
- package/dist/core/hands-band.d.ts +10 -6
- package/dist/core/hooks.d.ts +60 -6
- package/dist/core/hooks.js +10 -2
- package/dist/core/host-floor.d.ts +24 -8
- package/dist/core/host-floor.js +45 -16
- package/dist/core/human-input-projection.d.ts +7 -0
- package/dist/core/human-input-projection.js +11 -3
- package/dist/core/image-admission.d.ts +16 -4
- package/dist/core/image-admission.js +29 -17
- package/dist/core/input-author.d.ts +43 -1
- package/dist/core/input-author.js +19 -0
- package/dist/core/isolation-scope.d.ts +41 -0
- package/dist/core/isolation-scope.js +10 -0
- package/dist/core/json-schema-seats.d.ts +11 -0
- package/dist/core/json-schema-seats.js +5 -0
- package/dist/core/leg-identity.d.ts +53 -5
- package/dist/core/leg-identity.js +32 -1
- package/dist/core/locked-config.d.ts +33 -38
- package/dist/core/locked-config.js +21 -3
- package/dist/core/lsp.js +2 -1
- package/dist/core/mailbox-store.d.ts +111 -18
- package/dist/core/mailbox-store.js +101 -13
- package/dist/core/mcp-call-meta.js +1 -1
- package/dist/core/mcp-connection-pool.d.ts +8 -2
- package/dist/core/mcp-connection-pool.js +3 -1
- package/dist/core/mcp-failure.d.ts +6 -1
- package/dist/core/mcp-failure.js +10 -0
- package/dist/core/mcp-host-read.d.ts +293 -0
- package/dist/core/mcp-host-read.js +428 -0
- package/dist/core/mcp-server-link.d.ts +28 -6
- package/dist/core/mcp-server-link.js +35 -7
- package/dist/core/mcp-server-spec.d.ts +22 -29
- package/dist/core/mcp-server-spec.js +7 -14
- package/dist/core/mcp-server-unavailable-notice.d.ts +32 -0
- package/dist/core/mcp-server-unavailable-notice.js +15 -0
- package/dist/core/mcp-session-end.d.ts +5 -2
- package/dist/core/mcp-session-end.js +7 -2
- package/dist/core/mcp-tool-meta.d.ts +6 -0
- package/dist/core/mcp-tool-meta.js +1 -0
- package/dist/core/mcp.d.ts +54 -19
- package/dist/core/mcp.js +194 -241
- package/dist/core/memory-engine/committed-shadow-read.d.ts +16 -0
- package/dist/core/memory-engine/committed-shadow-read.js +21 -0
- package/dist/core/memory-engine/consolidation-driver.js +2 -1
- package/dist/core/memory-engine/consolidation.d.ts +3 -3
- package/dist/core/memory-engine/control-objects.d.ts +4 -3
- package/dist/core/memory-engine/control-objects.js +6 -4
- package/dist/core/memory-engine/delegation-settlement.d.ts +127 -25
- package/dist/core/memory-engine/delegation-settlement.js +145 -18
- package/dist/core/memory-engine/distiller.d.ts +2 -1
- package/dist/core/memory-engine/distiller.js +10 -5
- package/dist/core/memory-engine/dual-root.js +2 -2
- package/dist/core/memory-engine/engine.d.ts +127 -33
- package/dist/core/memory-engine/engine.js +774 -323
- package/dist/core/memory-engine/entry-scan.d.ts +3 -0
- package/dist/core/memory-engine/entry-scan.js +8 -0
- package/dist/core/memory-engine/export-bundle.d.ts +4 -0
- package/dist/core/memory-engine/export-bundle.js +2 -0
- package/dist/core/memory-engine/file-backend.d.ts +62 -17
- package/dist/core/memory-engine/file-backend.js +155 -99
- package/dist/core/memory-engine/index.d.ts +1 -1
- package/dist/core/memory-engine/index.js +1 -1
- package/dist/core/memory-engine/layer-observations.d.ts +7 -1
- package/dist/core/memory-engine/layer-observations.js +6 -0
- package/dist/core/memory-engine/layout.d.ts +88 -26
- package/dist/core/memory-engine/layout.js +105 -29
- package/dist/core/memory-engine/memory-deployment.js +4 -4
- package/dist/core/memory-engine/mount-failed-notice.d.ts +24 -0
- package/dist/core/memory-engine/mount-failed-notice.js +22 -0
- package/dist/core/memory-engine/origin-clearance.d.ts +15 -1
- package/dist/core/memory-engine/origin-clearance.js +30 -10
- package/dist/core/memory-engine/scan.js +1 -1
- package/dist/core/memory-engine/scope-contract.js +4 -3
- package/dist/core/memory-engine/session-write-home.js +13 -1
- package/dist/core/memory-engine/sync-client.d.ts +1 -1
- package/dist/core/memory-engine/sync-client.js +3 -1
- package/dist/core/memory-engine/tools.d.ts +5 -4
- package/dist/core/memory-engine/tools.js +1 -1
- package/dist/core/memory-engine/types.d.ts +18 -1
- package/dist/core/memory-engine/types.js +1 -0
- package/dist/core/memory.d.ts +1 -1
- package/dist/core/memory.js +2 -6
- package/dist/core/mode-policy.d.ts +8 -1
- package/dist/core/mode-policy.js +6 -2
- package/dist/core/model-fallbacks.d.ts +103 -0
- package/dist/core/model-fallbacks.js +79 -0
- package/dist/core/model-receipt.d.ts +15 -3
- package/dist/core/model-receipt.js +22 -1
- package/dist/core/model-seat.d.ts +1 -1
- package/dist/core/mods/classic-events.d.ts +5 -1
- package/dist/core/mods/dollar.d.ts +47 -2
- package/dist/core/mods/dollar.js +28 -5
- package/dist/core/mods/kernel/budget.d.ts +6 -0
- package/dist/core/mods/kernel/budget.js +6 -0
- package/dist/core/mods/kernel/dispatch.d.ts +23 -2
- package/dist/core/mods/kernel/dispatch.js +104 -15
- package/dist/core/mods/kernel/events.d.ts +18 -1
- package/dist/core/mods/kernel/events.js +7 -6
- package/dist/core/mods/kernel/index.d.ts +2 -2
- package/dist/core/mods/kernel/index.js +1 -1
- package/dist/core/mods/kernel/receive.d.ts +2 -1
- package/dist/core/mods/lifecycle-stations.d.ts +13 -4
- package/dist/core/mods/lifecycle-stations.js +8 -3
- package/dist/core/mods/message-display.d.ts +81 -0
- package/dist/core/mods/message-display.js +369 -0
- package/dist/core/mods/prompt-submit.d.ts +1 -1
- package/dist/core/mods/prompt-submit.js +5 -2
- package/dist/core/mods/session-append.d.ts +2 -2
- package/dist/core/mods/session-append.js +2 -1
- package/dist/core/mods/session-compact.js +2 -2
- package/dist/core/mods/stations.d.ts +48 -18
- package/dist/core/mods/stations.js +100 -19
- package/dist/core/mods/stop-answers.d.ts +23 -0
- package/dist/core/mods/stop-answers.js +20 -0
- package/dist/core/mounted-mcp.d.ts +48 -8
- package/dist/core/mounted-mcp.js +82 -16
- package/dist/core/namespaced-rule-name.js +2 -1
- package/dist/core/own-property-receipt.js +3 -5
- package/dist/core/parent-spec-seat.d.ts +20 -1
- package/dist/core/parent-spec-seat.js +13 -3
- package/dist/core/park-selfcheck.js +1 -0
- package/dist/core/path-identity.js +2 -1
- package/dist/core/peer-seat.d.ts +21 -7
- package/dist/core/peer-seat.js +25 -16
- package/dist/core/permission-rule-consent.js +15 -5
- package/dist/core/permission-rule-model.d.ts +4 -2
- package/dist/core/permission-rule-model.js +43 -23
- package/dist/core/permission-rule-store.d.ts +31 -16
- package/dist/core/permission-rule-store.js +27 -18
- package/dist/core/present-plan-tool.d.ts +6 -1
- package/dist/core/present-plan-tool.js +11 -3
- package/dist/core/pricing.d.ts +8 -6
- package/dist/core/pricing.js +1 -1
- package/dist/core/principal-name.d.ts +13 -0
- package/dist/core/principal-name.js +9 -2
- package/dist/core/process-identity.d.ts +140 -0
- package/dist/core/process-identity.js +215 -0
- package/dist/core/protocol-http-auth.d.ts +28 -6
- package/dist/core/protocol-http-auth.js +22 -5
- package/dist/core/protocol-naming.d.ts +7 -0
- package/dist/core/protocol-naming.js +12 -2
- package/dist/core/protocol-revocation.d.ts +72 -0
- package/dist/core/protocol-revocation.js +98 -0
- package/dist/core/protocol-table.d.ts +4 -4
- package/dist/core/protocol-table.js +3 -2
- package/dist/core/push-queue.d.ts +35 -2
- package/dist/core/push-queue.js +60 -4
- package/dist/core/read-only-shell.d.ts +19 -0
- package/dist/core/read-only-shell.js +38 -11
- package/dist/core/real-approval.d.ts +26 -0
- package/dist/core/real-approval.js +15 -0
- package/dist/core/redaction-marks.d.ts +6 -2
- package/dist/core/redaction-marks.js +3 -0
- package/dist/core/reminder-mint.d.ts +6 -0
- package/dist/core/reminder-mint.js +9 -8
- package/dist/core/remote-env.d.ts +31 -15
- package/dist/core/remote-env.js +29 -0
- package/dist/core/request-copy-projection.d.ts +51 -0
- package/dist/core/request-copy-projection.js +410 -0
- package/dist/core/resume-config-judge.d.ts +69 -0
- package/dist/core/resume-config-judge.js +78 -0
- package/dist/core/resume-startup-cause.d.ts +14 -4
- package/dist/core/resume-startup-cause.js +12 -2
- package/dist/core/retention-policy.js +2 -1
- package/dist/core/retention.d.ts +119 -24
- package/dist/core/retention.js +60 -16
- package/dist/core/retired-keys.d.ts +0 -10
- package/dist/core/retired-keys.js +2 -3
- package/dist/core/roles.d.ts +6 -0
- package/dist/core/roles.js +65 -4
- package/dist/core/row-shape.d.ts +149 -0
- package/dist/core/row-shape.js +184 -0
- package/dist/core/runner/advertised-writable-dirs.js +10 -9
- package/dist/core/runner/advisor-instructions.d.ts +11 -27
- package/dist/core/runner/advisor-instructions.js +18 -20
- package/dist/core/runner/advisor-tool.js +1 -0
- package/dist/core/runner/announce-once-ledger.js +4 -1
- package/dist/core/runner/approval-feedback.d.ts +17 -8
- package/dist/core/runner/approval-feedback.js +18 -13
- package/dist/core/runner/approver-defect-announcer.d.ts +17 -0
- package/dist/core/runner/approver-defect-announcer.js +22 -0
- package/dist/core/runner/assemble-result.d.ts +29 -14
- package/dist/core/runner/assemble-result.js +16 -25
- package/dist/core/runner/cache-hit-account.d.ts +77 -0
- package/dist/core/runner/cache-hit-account.js +46 -0
- package/dist/core/runner/call-hook-stations.d.ts +3 -2
- package/dist/core/runner/call-hook-stations.js +5 -4
- package/dist/core/runner/changed-files-scan.d.ts +43 -0
- package/dist/core/runner/changed-files-scan.js +34 -0
- package/dist/core/runner/checkpoint-scope.d.ts +33 -9
- package/dist/core/runner/checkpoint-scope.js +27 -1
- package/dist/core/runner/classifier-ladder.d.ts +2 -2
- package/dist/core/runner/classifier-ladder.js +18 -9
- package/dist/core/runner/clock-and-limits.d.ts +15 -4
- package/dist/core/runner/clock-and-limits.js +19 -1
- package/dist/core/runner/compact-session.js +84 -14
- package/dist/core/runner/compaction-call-options.d.ts +2 -29
- package/dist/core/runner/compaction-call-options.js +2 -9
- package/dist/core/runner/compaction-restate.d.ts +18 -2
- package/dist/core/runner/compaction-restate.js +36 -2
- package/dist/core/runner/construction-doors.js +8 -0
- package/dist/core/runner/context-room.d.ts +55 -0
- package/dist/core/runner/context-room.js +71 -0
- package/dist/core/runner/contracts.d.ts +313 -205
- package/dist/core/runner/conversation-segment.d.ts +49 -14
- package/dist/core/runner/conversation-segment.js +92 -19
- package/dist/core/runner/cross-boundary-lane.d.ts +4 -0
- package/dist/core/runner/cross-boundary-lane.js +9 -6
- package/dist/core/runner/decide-continuation.js +1 -1
- package/dist/core/runner/deferred-ask.d.ts +62 -0
- package/dist/core/runner/deferred-ask.js +44 -0
- package/dist/core/runner/delegation-owner.d.ts +19 -0
- package/dist/core/runner/delegation-owner.js +27 -1
- package/dist/core/runner/denial-limit-arms.d.ts +10 -6
- package/dist/core/runner/denial-limit-arms.js +13 -7
- package/dist/core/runner/env-capability-census.d.ts +1 -1
- package/dist/core/runner/file-history-request.js +2 -1
- package/dist/core/runner/file-history-restore.d.ts +16 -2
- package/dist/core/runner/file-history-restore.js +9 -1
- package/dist/core/runner/gate-exit.d.ts +18 -5
- package/dist/core/runner/gate-exit.js +26 -15
- package/dist/core/runner/git-status-frame.d.ts +26 -8
- package/dist/core/runner/git-status-frame.js +14 -9
- package/dist/core/runner/halt-attribution.d.ts +29 -12
- package/dist/core/runner/halt-attribution.js +38 -11
- package/dist/core/runner/image.js +3 -2
- package/dist/core/runner/initial-run-state.d.ts +1 -1
- package/dist/core/runner/initial-run-state.js +4 -4
- package/dist/core/runner/language-frame.d.ts +66 -0
- package/dist/core/runner/language-frame.js +76 -0
- package/dist/core/runner/leg-frame.d.ts +81 -0
- package/dist/core/runner/leg-frame.js +68 -0
- package/dist/core/runner/main-call-account.d.ts +34 -0
- package/dist/core/runner/main-call-account.js +50 -0
- package/dist/core/runner/mcp-redial.d.ts +9 -7
- package/dist/core/runner/mcp-redial.js +20 -21
- package/dist/core/runner/memory-consolidation-driver.d.ts +2 -0
- package/dist/core/runner/memory-consolidation-driver.js +5 -3
- package/dist/core/runner/messages-omitted-seat.d.ts +2 -0
- package/dist/core/runner/messages-omitted-seat.js +21 -0
- package/dist/core/runner/model-fallback-seat.d.ts +20 -0
- package/dist/core/runner/model-fallback-seat.js +43 -0
- package/dist/core/runner/model-lane-seat.d.ts +12 -0
- package/dist/core/runner/model-lane-seat.js +35 -0
- package/dist/core/runner/nested-memory-content.d.ts +33 -0
- package/dist/core/runner/nested-memory-content.js +171 -0
- package/dist/core/runner/nested-memory-lane.d.ts +181 -0
- package/dist/core/runner/nested-memory-lane.js +673 -0
- package/dist/core/runner/park-commit.d.ts +7 -0
- package/dist/core/runner/park-commit.js +3 -0
- package/dist/core/runner/prepare-advisor.d.ts +7 -9
- package/dist/core/runner/prepare-advisor.js +11 -5
- package/dist/core/runner/prepare-artifact.d.ts +1 -1
- package/dist/core/runner/prepare-artifact.js +8 -3
- package/dist/core/runner/prepare-ask-lane.d.ts +21 -3
- package/dist/core/runner/prepare-ask-lane.js +32 -28
- package/dist/core/runner/prepare-boundary-parks.d.ts +2 -2
- package/dist/core/runner/prepare-boundary-parks.js +21 -17
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +10 -2
- package/dist/core/runner/prepare-caps-and-workflow.js +24 -18
- package/dist/core/runner/prepare-config-doors.d.ts +51 -5
- package/dist/core/runner/prepare-config-doors.js +73 -73
- package/dist/core/runner/prepare-context-lane.d.ts +68 -3
- package/dist/core/runner/prepare-context-lane.js +137 -27
- package/dist/core/runner/prepare-defer-classify.d.ts +0 -4
- package/dist/core/runner/prepare-defer-classify.js +9 -13
- package/dist/core/runner/prepare-delegation-surface.d.ts +8 -8
- package/dist/core/runner/prepare-delegation-surface.js +72 -64
- package/dist/core/runner/prepare-execution-env.js +1 -9
- package/dist/core/runner/prepare-file-history.d.ts +3 -2
- package/dist/core/runner/prepare-file-history.js +11 -4
- package/dist/core/runner/prepare-gate-stations.d.ts +21 -11
- package/dist/core/runner/prepare-gate-stations.js +13 -13
- package/dist/core/runner/prepare-hands-readface.d.ts +23 -6
- package/dist/core/runner/prepare-hands-readface.js +18 -12
- package/dist/core/runner/prepare-inherited-gate.d.ts +12 -5
- package/dist/core/runner/prepare-inherited-gate.js +14 -10
- package/dist/core/runner/prepare-lsp.js +2 -1
- package/dist/core/runner/prepare-memory-engine-session.js +30 -10
- package/dist/core/runner/prepare-memory.d.ts +4 -0
- package/dist/core/runner/prepare-memory.js +38 -16
- package/dist/core/runner/prepare-offload-wrappers.d.ts +3 -16
- package/dist/core/runner/prepare-offload-wrappers.js +6 -5
- package/dist/core/runner/prepare-park-ask.d.ts +13 -3
- package/dist/core/runner/prepare-park-ask.js +25 -19
- package/dist/core/runner/prepare-policy-chain.d.ts +17 -3
- package/dist/core/runner/prepare-policy-chain.js +144 -120
- package/dist/core/runner/prepare-project-context.d.ts +15 -53
- package/dist/core/runner/prepare-project-context.js +20 -83
- package/dist/core/runner/prepare-prompt-assembly.d.ts +7 -1
- package/dist/core/runner/prepare-prompt-assembly.js +9 -7
- package/dist/core/runner/prepare-prompt-inputs.d.ts +9 -3
- package/dist/core/runner/prepare-prompt-inputs.js +5 -3
- package/dist/core/runner/prepare-protocol-tools.d.ts +9 -4
- package/dist/core/runner/prepare-protocol-tools.js +46 -27
- package/dist/core/runner/prepare-question-face.d.ts +7 -6
- package/dist/core/runner/prepare-question-face.js +7 -6
- package/dist/core/runner/prepare-suspend-saga.d.ts +3 -0
- package/dist/core/runner/prepare-suspend-saga.js +1 -1
- package/dist/core/runner/prepare-task.d.ts +3 -3
- package/dist/core/runner/prepare-task.js +113 -61
- package/dist/core/runner/prepare-tool-disclosure-mount.js +6 -5
- package/dist/core/runner/prepare-turn-wiring.d.ts +33 -7
- package/dist/core/runner/prepare-turn-wiring.js +53 -17
- package/dist/core/runner/prepare-wiring-manifest.d.ts +42 -5
- package/dist/core/runner/prepare-wiring-manifest.js +81 -42
- package/dist/core/runner/prepare-workspace-restore.js +3 -2
- package/dist/core/runner/read-root-grant.js +2 -1
- package/dist/core/runner/reply-pricing.d.ts +31 -18
- package/dist/core/runner/reply-pricing.js +10 -15
- package/dist/core/runner/resume-admission.js +10 -15
- package/dist/core/runner/resume-apply.js +20 -9
- package/dist/core/runner/resume-checkpoint-screen.js +2 -4
- package/dist/core/runner/resume-internals-and-config.d.ts +12 -9
- package/dist/core/runner/resume-internals-and-config.js +37 -9
- package/dist/core/runner/resume-preflight.js +3 -3
- package/dist/core/runner/retired-runner-deps.js +3 -0
- package/dist/core/runner/rewind-files.js +6 -6
- package/dist/core/runner/run-attachment-seats.d.ts +1 -3
- package/dist/core/runner/run-attachment-seats.js +1 -6
- package/dist/core/runner/run-brain-sinks.d.ts +4 -7
- package/dist/core/runner/run-brain-sinks.js +7 -10
- package/dist/core/runner/run-clock-and-content.d.ts +8 -5
- package/dist/core/runner/run-clock-and-content.js +18 -3
- package/dist/core/runner/run-compaction-machinery.d.ts +8 -4
- package/dist/core/runner/run-compaction-machinery.js +4 -19
- package/dist/core/runner/run-git-lane.d.ts +8 -3
- package/dist/core/runner/run-git-lane.js +5 -3
- package/dist/core/runner/run-harness-handlers.d.ts +4 -1
- package/dist/core/runner/run-harness-handlers.js +70 -45
- package/dist/core/runner/run-identity-wiring.d.ts +6 -0
- package/dist/core/runner/run-identity-wiring.js +17 -8
- package/dist/core/runner/run-leg.d.ts +5 -2
- package/dist/core/runner/run-leg.js +156 -71
- package/dist/core/runner/run-notification-lane.d.ts +1 -1
- package/dist/core/runner/run-notification-lane.js +22 -10
- package/dist/core/runner/run-recovery-lanes.js +8 -6
- package/dist/core/runner/run-settle-and-teardown.d.ts +4 -0
- package/dist/core/runner/run-settle-and-teardown.js +77 -26
- package/dist/core/runner/run-stop-and-final-verify.js +46 -12
- package/dist/core/runner/run-telemetry-and-budget-seats.js +13 -28
- package/dist/core/runner/run-terminal-adoption.d.ts +2 -2
- package/dist/core/runner/run-terminal-adoption.js +14 -9
- package/dist/core/runner/run-tool-mount-facts.js +5 -9
- package/dist/core/runner/run-turn-boundary.d.ts +3 -2
- package/dist/core/runner/run-turn-boundary.js +112 -106
- package/dist/core/runner/runtask.d.ts +28 -8
- package/dist/core/runner/runtask.js +132 -41
- package/dist/core/runner/session-file-state-replay.d.ts +5 -3
- package/dist/core/runner/session-file-state-replay.js +10 -3
- package/dist/core/runner/session-rule-policy.d.ts +3 -3
- package/dist/core/runner/session-verb-doors.d.ts +18 -3
- package/dist/core/runner/session-verb-doors.js +38 -6
- package/dist/core/runner/shell-env-withheld.d.ts +8 -5
- package/dist/core/runner/shell-env-withheld.js +4 -4
- package/dist/core/runner/side-call-account.d.ts +12 -8
- package/dist/core/runner/side-call-account.js +24 -15
- package/dist/core/runner/stream-halt-verbs.js +1 -0
- package/dist/core/runner/stream-mode-verb.js +2 -1
- package/dist/core/runner/stream-settle-backstop.js +4 -1
- package/dist/core/runner/stream-steer-verb.js +35 -19
- package/dist/core/runner/sub-agent-deny-lists.d.ts +47 -11
- package/dist/core/runner/sub-agent-deny-lists.js +140 -39
- package/dist/core/runner/teardown-bounded.d.ts +6 -0
- package/dist/core/runner/teardown-bounded.js +12 -7
- package/dist/core/runner/terminal-account.d.ts +2 -0
- package/dist/core/runner/terminal-account.js +6 -1
- package/dist/core/runner/tool-disclosure.js +2 -1
- package/dist/core/runner/tool-end-body.js +3 -1
- package/dist/core/runner/tool-face-overlay.d.ts +1 -1
- package/dist/core/runner/tool-face-overlay.js +1 -1
- package/dist/core/runner/tool-occurrence.d.ts +34 -9
- package/dist/core/runner/tool-occurrence.js +32 -21
- package/dist/core/runner/tool-progress-lane.d.ts +20 -5
- package/dist/core/runner/tool-progress-lane.js +27 -5
- package/dist/core/runner/tool-result-media-seat.d.ts +15 -4
- package/dist/core/runner/tool-result-media-seat.js +17 -1
- package/dist/core/runner/tool-table-view.js +1 -1
- package/dist/core/runner/turn-attachments.d.ts +44 -71
- package/dist/core/runner/turn-attachments.js +52 -104
- package/dist/core/runner/usage-accounting.d.ts +3 -2
- package/dist/core/runner/usage-accounting.js +3 -2
- package/dist/core/runner/void-verifier-pause.js +1 -1
- package/dist/core/runner-deps.d.ts +42 -158
- package/dist/core/runtime-caps.d.ts +16 -4
- package/dist/core/secret-env.d.ts +20 -3
- package/dist/core/secret-env.js +46 -23
- package/dist/core/sensitive-path-policy.d.ts +8 -0
- package/dist/core/sensitive-path-policy.js +10 -2
- package/dist/core/session-checkout.d.ts +32 -27
- package/dist/core/session-checkout.js +109 -61
- package/dist/core/session-log-transfer.js +2 -1
- package/dist/core/session-policy-store.d.ts +24 -11
- package/dist/core/session-policy-store.js +11 -2
- package/dist/core/session-store.d.ts +16 -2
- package/dist/core/session-store.js +43 -17
- package/dist/core/session.d.ts +31 -3
- package/dist/core/session.js +33 -2
- package/dist/core/shell-run-candidates.d.ts +20 -8
- package/dist/core/shell-run-candidates.js +44 -21
- package/dist/core/side-query.d.ts +17 -5
- package/dist/core/side-query.js +17 -14
- package/dist/core/skill-grant.js +2 -3
- package/dist/core/skills-directory.js +3 -66
- package/dist/core/snapshot-frame-seat.d.ts +8 -0
- package/dist/core/snapshot-frame-seat.js +24 -0
- package/dist/core/steer-replay.d.ts +19 -3
- package/dist/core/steer-replay.js +8 -1
- package/dist/core/store-contracts/background-agent-store-contract.d.ts +17 -2
- package/dist/core/store-contracts/background-agent-store-contract.js +131 -2
- package/dist/core/store-contracts/checkpoint-store-contract.js +63 -1
- package/dist/core/store-contracts/mailbox-store-contract.d.ts +15 -2
- package/dist/core/store-contracts/mailbox-store-contract.js +213 -3
- package/dist/core/store-contracts/permission-rule-write-contract.js +24 -0
- package/dist/core/store-contracts/session-deletion-cascade-contract.d.ts +15 -0
- package/dist/core/store-contracts/session-deletion-cascade-contract.js +288 -0
- package/dist/core/store-contracts/session-policy-store-contract.js +57 -36
- package/dist/core/store-contracts/session-repo-contract.js +130 -5
- package/dist/core/store-contracts/session-store-contract.d.ts +1 -1
- package/dist/core/store-contracts/session-store-contract.js +17 -0
- package/dist/core/store-contracts/task-list-store-contract.d.ts +32 -0
- package/dist/core/store-contracts/task-list-store-contract.js +240 -0
- package/dist/core/store-contracts/tool-result-store-contract.d.ts +1 -1
- package/dist/core/store-contracts/tool-result-store-contract.js +41 -0
- package/dist/core/stub-env.d.ts +2 -2
- package/dist/core/stub-env.js +1 -0
- package/dist/core/synthetic-read-verdict.d.ts +38 -28
- package/dist/core/synthetic-read-verdict.js +19 -28
- package/dist/core/task-event.d.ts +171 -19
- package/dist/core/task-intake.d.ts +26 -0
- package/dist/core/task-intake.js +31 -0
- package/dist/core/task-limits.d.ts +8 -6
- package/dist/core/task-notification.d.ts +88 -8
- package/dist/core/task-notification.js +45 -5
- package/dist/core/task-registry-agent.d.ts +24 -7
- package/dist/core/task-registry-agent.js +51 -28
- package/dist/core/task-registry-monitor.js +16 -14
- package/dist/core/task-registry-shared.d.ts +177 -35
- package/dist/core/task-registry-shared.js +44 -17
- package/dist/core/task-registry-workflow.js +8 -5
- package/dist/core/task-registry-yield.d.ts +32 -0
- package/dist/core/task-registry-yield.js +85 -0
- package/dist/core/task-registry.d.ts +88 -10
- package/dist/core/task-registry.js +124 -33
- package/dist/core/task-result.d.ts +115 -31
- package/dist/core/task-spec-members.d.ts +140 -1
- package/dist/core/task-spec-members.js +23 -8
- package/dist/core/task-spec.d.ts +181 -51
- package/dist/core/task-spec.js +1 -1
- package/dist/core/task-stream.d.ts +12 -2
- package/dist/core/terminal-cause.d.ts +12 -4
- package/dist/core/thrown-value.d.ts +49 -7
- package/dist/core/thrown-value.js +38 -2
- package/dist/core/tool-catalog-entries.js +13 -3
- package/dist/core/tool-data-door.d.ts +7 -0
- package/dist/core/tool-data-door.js +13 -0
- package/dist/core/tool-face-lists.d.ts +25 -0
- package/dist/core/tool-face-lists.js +38 -0
- package/dist/core/tool-face-reader.d.ts +0 -10
- package/dist/core/tool-face-reader.js +5 -3
- package/dist/core/tool-list-grammar.d.ts +103 -0
- package/dist/core/tool-list-grammar.js +130 -0
- package/dist/core/tool-mount-facts.d.ts +47 -0
- package/dist/core/tool-mount-facts.js +50 -0
- package/dist/core/tool-mount-plan.d.ts +196 -0
- package/dist/core/tool-mount-plan.js +404 -0
- package/dist/core/tool-mount-static.d.ts +12 -0
- package/dist/core/tool-mount-static.js +174 -0
- package/dist/core/tool-name-aliases.d.ts +60 -2
- package/dist/core/tool-name-aliases.js +22 -2
- package/dist/core/tool-name-list.d.ts +3 -0
- package/dist/core/tool-name-readings.d.ts +4 -0
- package/dist/core/tool-name-readings.js +1 -0
- package/dist/core/tool-policy.d.ts +246 -51
- package/dist/core/tool-policy.js +165 -71
- package/dist/core/tool-registry.d.ts +4 -11
- package/dist/core/tool-registry.js +0 -3
- package/dist/core/tool-result-bytes.d.ts +94 -0
- package/dist/core/tool-result-bytes.js +34 -0
- package/dist/core/tool-result-store.d.ts +97 -13
- package/dist/core/tool-result-store.js +52 -4
- package/dist/core/tool-roster.d.ts +71 -10
- package/dist/core/tool-roster.js +71 -21
- package/dist/core/tool-search-setting.d.ts +7 -9
- package/dist/core/tool-search-setting.js +23 -7
- package/dist/core/tool-spec.d.ts +32 -2
- package/dist/core/tools.js +6 -20
- package/dist/core/trace.d.ts +63 -11
- package/dist/core/trace.js +19 -0
- package/dist/core/types.d.ts +8 -6
- package/dist/core/types.js +3 -1
- package/dist/core/unmatched-tool-names.d.ts +37 -0
- package/dist/core/unmatched-tool-names.js +18 -0
- package/dist/core/untrusted-egress.d.ts +16 -5
- package/dist/core/untrusted-egress.js +202 -32
- package/dist/core/untrusted-text.d.ts +29 -8
- package/dist/core/untrusted-text.js +6 -3
- package/dist/core/user-attachment.d.ts +129 -35
- package/dist/core/user-attachment.js +124 -57
- package/dist/core/user-row-origin.d.ts +63 -0
- package/dist/core/user-row-origin.js +61 -0
- package/dist/core/wiring-manifest.d.ts +161 -39
- package/dist/core/wiring-manifest.js +42 -6
- package/dist/core/workflow-run-store-contract.d.ts +11 -1
- package/dist/core/workflow-run-store-contract.js +60 -7
- package/dist/core/workflow-run-store.d.ts +61 -12
- package/dist/core/workflow-run-store.js +100 -15
- package/dist/core/workspace-snapshot.d.ts +10 -14
- package/dist/core/workspace-snapshot.js +3 -22
- package/dist/core/write-protect.d.ts +3 -5
- package/dist/core/write-protect.js +2 -4
- package/dist/engine/compaction/compaction.d.ts +3 -0
- package/dist/engine/compaction/compaction.js +4 -3
- package/dist/engine/execution-env/node-execution-env.d.ts +15 -4
- package/dist/engine/execution-env/node-execution-env.js +80 -27
- package/dist/engine/harness/agent-harness.d.ts +143 -27
- package/dist/engine/harness/agent-harness.js +162 -74
- package/dist/engine/harness/types.d.ts +84 -13
- package/dist/engine/harness/types.js +21 -1
- package/dist/engine/llm/tool-turns.d.ts +4 -0
- package/dist/engine/llm/tool-turns.js +7 -2
- package/dist/engine/llm/types.d.ts +111 -24
- package/dist/engine/llm/types.js +69 -5
- package/dist/engine/llm/validation.js +2 -1
- package/dist/engine/loop/agent-loop.d.ts +39 -6
- package/dist/engine/loop/agent-loop.js +172 -82
- package/dist/engine/loop/types.d.ts +43 -4
- package/dist/engine/lsp/node-lsp-manager.d.ts +5 -3
- package/dist/engine/lsp/node-lsp-manager.js +14 -10
- package/dist/engine/session/import-validate.js +9 -0
- package/dist/engine/session/memory-repo.d.ts +8 -1
- package/dist/engine/session/memory-repo.js +20 -12
- package/dist/engine/session/repo-utils.d.ts +10 -0
- package/dist/engine/session/repo-utils.js +11 -5
- package/dist/engine/session/row-cells.d.ts +32 -0
- package/dist/engine/session/row-cells.js +25 -0
- package/dist/index.d.ts +63 -34
- package/dist/index.js +44 -21
- package/dist/internal/harness.d.ts +8 -6
- package/dist/internal/harness.js +6 -4
- package/dist/internal/llm.d.ts +2 -2
- package/dist/internal/llm.js +1 -1
- package/dist/orchestration/governance-baseline-validity.d.ts +7 -0
- package/dist/orchestration/governance-baseline-validity.js +33 -9
- package/dist/orchestration/run-workflow-tool.d.ts +2 -0
- package/dist/orchestration/run-workflow-tool.js +25 -12
- package/dist/orchestration/workflow-governance.d.ts +19 -4
- package/dist/orchestration/workflow-governance.js +30 -9
- package/dist/orchestration/workflow-primitives.d.ts +4 -1
- package/dist/orchestration/workflow-primitives.js +2 -2
- package/dist/orchestration/workflow-script-runner.d.ts +1 -1
- package/dist/orchestration/workflow-size-guideline.d.ts +1 -1
- package/dist/orchestration/workflow-types.d.ts +21 -12
- package/dist/orchestration/workflow-types.js +15 -4
- package/dist/orchestration/workflow.d.ts +37 -7
- package/dist/orchestration/workflow.js +81 -35
- package/dist/prompt-assembly/artifact-store.js +6 -9
- package/dist/prompt-assembly/assemble.d.ts +4 -10
- package/dist/prompt-assembly/assemble.js +1 -3
- package/dist/prompt-assembly/catalog/constitution.d.ts +0 -20
- package/dist/prompt-assembly/catalog/constitution.js +2 -0
- package/dist/prompt-assembly/catalog/core-behavior.js +5 -3
- package/dist/prompt-assembly/catalog/engine.d.ts +108 -0
- package/dist/prompt-assembly/catalog/engine.js +19 -0
- package/dist/prompt-assembly/catalog/environment.d.ts +276 -0
- package/dist/prompt-assembly/catalog/environment.js +61 -0
- package/dist/prompt-assembly/catalog/index.d.ts +9 -2
- package/dist/prompt-assembly/catalog/index.js +73 -2
- package/dist/prompt-assembly/catalog/locales/index.d.ts +16 -0
- package/dist/prompt-assembly/catalog/locales/index.js +22 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/constitution.d.ts +7 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/constitution.js +124 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/core-behavior.d.ts +6 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/core-behavior.js +120 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/cowork.d.ts +8 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/cowork.js +442 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/engine.d.ts +7 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/engine.js +15 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/environment.d.ts +7 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/environment.js +50 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/modes.d.ts +7 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/modes.js +163 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/role.d.ts +7 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/role.js +148 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/team.d.ts +6 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/team.js +246 -0
- package/dist/prompt-assembly/catalog/role.js +3 -6
- package/dist/prompt-assembly/catalog/schema.d.ts +23 -1
- package/dist/prompt-assembly/catalog/schema.js +2 -0
- package/dist/prompt-assembly/composer.d.ts +6 -11
- package/dist/prompt-assembly/composer.js +7 -7
- package/dist/prompt-assembly/engine-text.d.ts +9 -0
- package/dist/prompt-assembly/engine-text.js +33 -0
- package/dist/prompt-assembly/event-registry.js +3 -3
- package/dist/prompt-assembly/explain.d.ts +1 -0
- package/dist/prompt-assembly/explain.js +1 -1
- package/dist/prompt-assembly/locale-review.d.ts +13 -0
- package/dist/prompt-assembly/locale-review.js +19 -0
- package/dist/prompt-assembly/overlay.d.ts +7 -3
- package/dist/prompt-assembly/overlay.js +27 -5
- package/dist/prompt-assembly/renderers.d.ts +4 -4
- package/dist/prompt-assembly/renderers.js +26 -17
- package/dist/prompt-assembly/role-base.d.ts +1 -1
- package/dist/prompt-assembly/select.d.ts +26 -5
- package/dist/prompt-assembly/select.js +25 -2
- package/dist/prompt-assembly/slots.d.ts +19 -0
- package/dist/prompt-assembly/slots.js +16 -0
- package/dist/prompt-assembly/sugar.d.ts +4 -7
- package/dist/prompt-assembly/sugar.js +1 -2
- package/dist/prompt-assembly/tool-catalog.d.ts +5 -1
- package/dist/prompt-assembly/tool-catalog.js +5 -1
- package/dist/prompt-assembly/turn-snapshot.d.ts +38 -10
- package/dist/prompt-assembly/turn-snapshot.js +43 -13
- package/dist/prompt-assembly/types.d.ts +3 -0
- package/dist/prompts/cowork.d.ts +6 -25
- package/dist/prompts/cowork.js +10 -12
- package/dist/prompts/default.d.ts +10 -32
- package/dist/prompts/default.js +37 -63
- package/dist/shell/lex.d.ts +39 -13
- package/dist/shell/lex.js +70 -30
- package/dist/stores/file/background-agent-store.d.ts +5 -0
- package/dist/stores/file/background-agent-store.js +35 -61
- package/dist/stores/file/checkpoint-store.d.ts +5 -3
- package/dist/stores/file/checkpoint-store.js +8 -10
- package/dist/stores/file/fs-atomic.d.ts +27 -70
- package/dist/stores/file/fs-atomic.js +52 -148
- package/dist/stores/file/index.d.ts +12 -0
- package/dist/stores/file/index.js +27 -2
- package/dist/stores/file/mailbox-store.d.ts +10 -1
- package/dist/stores/file/mailbox-store.js +40 -12
- package/dist/stores/file/permission-rule-adopt.js +5 -2
- package/dist/stores/file/permission-rule-store.d.ts +81 -20
- package/dist/stores/file/permission-rule-store.js +126 -33
- package/dist/stores/file/session-policy-store.d.ts +2 -2
- package/dist/stores/file/session-store.d.ts +21 -2
- package/dist/stores/file/session-store.js +27 -14
- package/dist/stores/file/task-list-store.js +23 -25
- package/dist/stores/file/tool-result-store.d.ts +45 -7
- package/dist/stores/file/tool-result-store.js +99 -36
- package/dist/stores/file/workflow-run-store.d.ts +1 -0
- package/dist/stores/file/workflow-run-store.js +14 -11
- package/dist/tools/artifact/artifact-tool.js +2 -0
- package/dist/tools/artifact/local-stub.js +6 -6
- package/dist/tools/fs/bash-program-position.d.ts +1 -2
- package/dist/tools/fs/bash-readonly-classifier.d.ts +35 -0
- package/dist/tools/fs/bash-readonly-classifier.js +50 -12
- package/dist/tools/fs/env-error-detail.d.ts +1 -0
- package/dist/tools/fs/env-error-detail.js +7 -0
- package/dist/tools/fs/fs-bash.d.ts +24 -6
- package/dist/tools/fs/fs-bash.js +73 -25
- package/dist/tools/fs/fs-pdf.js +6 -4
- package/dist/tools/fs/fs-read.d.ts +76 -31
- package/dist/tools/fs/fs-read.js +159 -79
- package/dist/tools/fs/fs-search-tools.d.ts +1 -1
- package/dist/tools/fs/fs-search-tools.js +3 -1
- package/dist/tools/fs/fs-shared.d.ts +59 -63
- package/dist/tools/fs/fs-shared.js +31 -18
- package/dist/tools/fs/fs-write.d.ts +13 -0
- package/dist/tools/fs/fs-write.js +69 -13
- package/dist/tools/fs/index.d.ts +19 -1
- package/dist/tools/fs/index.js +10 -2
- package/dist/tools/fs/pdf.js +10 -9
- package/dist/tools/fs/read-deny.js +4 -10
- package/dist/tools/fs/read-floor.d.ts +5 -4
- package/dist/tools/fs/removal-targets.d.ts +11 -5
- package/dist/tools/fs/removal-targets.js +62 -32
- package/dist/tools/fs/safety.d.ts +26 -19
- package/dist/tools/fs/safety.js +13 -8
- package/dist/tools/fs/search.d.ts +1 -1
- package/dist/tools/fs/shell-read-argv.js +1 -0
- package/dist/tools/fs/shell-read-bindings.d.ts +128 -26
- package/dist/tools/fs/shell-read-bindings.js +667 -139
- package/dist/tools/fs/shell-read-check.js +1 -1
- package/dist/tools/fs/shell-read-judge.d.ts +4 -1
- package/dist/tools/fs/shell-read-judge.js +5 -1
- package/dist/tools/fs/shell-read-plan.d.ts +4 -0
- package/dist/tools/fs/shell-read-plan.js +21 -19
- package/dist/tools/fs/shell-read-sourced.d.ts +4 -3
- package/dist/tools/fs/shell-read-sourced.js +18 -1
- package/dist/tools/fs/shell-read-start.d.ts +6 -6
- package/dist/tools/fs/shell-read-start.js +1 -6
- package/dist/tools/fs/shell-read-word.d.ts +4 -2
- package/dist/tools/fs/shell-read-word.js +7 -6
- package/dist/tools/fs/shell-read-workdir.d.ts +1 -1
- package/dist/tools/fs/shell-reentry-text.d.ts +24 -9
- package/dist/tools/fs/shell-reentry-text.js +50 -20
- package/dist/tools/monitor.d.ts +4 -0
- package/dist/tools/monitor.js +14 -4
- package/dist/tools/scheduler-tools.d.ts +5 -2
- package/dist/tools/scheduler-tools.js +8 -6
- package/dist/tools/task-list.d.ts +49 -20
- package/dist/tools/task-list.js +115 -35
- package/dist/tools/web.d.ts +13 -3
- package/dist/tools/web.js +17 -6
- package/dist/tools/worktree.d.ts +3 -2
- package/dist/tools/worktree.js +24 -25
- package/package.json +10 -3
- package/test/export-surface.snapshot.json +330 -32
- package/wire-changes/core-stores-sql@7.66.1.json +30 -0
- package/wire-changes/core-stores-sql@7.67.0.json +39 -0
- package/wire-changes/core@7.66.1.json +46 -0
- package/wire-changes/core@7.67.0.json +12578 -0
- package/wire-changes/mods-kernel@7.66.1.json +30 -0
- package/wire-changes/mods-kernel@7.67.0.json +167 -0
- package/wire-changes/primitives@7.66.1.json +30 -0
- package/wire-changes/primitives@7.67.0.json +325 -0
- package/wire-changes/wiki-gate@7.67.0.json +1636 -0
- package/dist/brain/degrading.d.ts +0 -93
- package/dist/brain/degrading.js +0 -189
- package/dist/core/tool-conformance.d.ts +0 -20
- package/dist/core/tool-conformance.js +0 -37
package/dist/config/catalog.js
CHANGED
|
@@ -5,14 +5,16 @@ export function describeConfigCatalog() {
|
|
|
5
5
|
{
|
|
6
6
|
key: "limits.maxTurns",
|
|
7
7
|
recommended: null,
|
|
8
|
+
default: null,
|
|
8
9
|
unit: "turns",
|
|
9
10
|
kind: "budget",
|
|
10
|
-
summary: "Per-slice turn ceiling. Unset = unbounded (
|
|
11
|
+
summary: "Per-slice turn ceiling. Unset = unbounded (the engine carries no default turn net): a task that needs a turn bound states one. 0 = the explicit unbounded sentinel.",
|
|
11
12
|
precedence: "spec.limits.maxTurns > unset",
|
|
12
13
|
},
|
|
13
14
|
{
|
|
14
15
|
key: "limits.maxWalltimeMs",
|
|
15
16
|
recommended: null,
|
|
17
|
+
default: null,
|
|
16
18
|
unit: "ms",
|
|
17
19
|
kind: "budget",
|
|
18
20
|
summary: "Per-slice ACTIVE wall-clock window for the task (suspended time does not count; a resume opens a fresh window). Unset = unbounded, which is the recommendation — bound work by tokens, not by time.",
|
|
@@ -29,6 +31,7 @@ export function describeConfigCatalog() {
|
|
|
29
31
|
{
|
|
30
32
|
key: "limits.maxCostUsd",
|
|
31
33
|
recommended: null,
|
|
34
|
+
default: null,
|
|
32
35
|
unit: "usd",
|
|
33
36
|
kind: "budget",
|
|
34
37
|
summary: "Per-slice spend ceiling (hard-cancels the in-flight stream by default when crossed). Unset = unbounded.",
|
|
@@ -37,6 +40,7 @@ export function describeConfigCatalog() {
|
|
|
37
40
|
{
|
|
38
41
|
key: "limits.maxTokens",
|
|
39
42
|
recommended: null,
|
|
43
|
+
default: null,
|
|
40
44
|
unit: "tokens",
|
|
41
45
|
kind: "budget",
|
|
42
46
|
summary: "Per-slice token budget — the PRIMARY axis. Unset = unbounded.",
|
|
@@ -46,12 +50,13 @@ export function describeConfigCatalog() {
|
|
|
46
50
|
key: "limits.approachNotice",
|
|
47
51
|
recommended: null,
|
|
48
52
|
kind: "behavior",
|
|
49
|
-
summary: "Advisory limit-approach
|
|
53
|
+
summary: "Advisory limit-approach sentence carried at the end of each model request once the tightest armed axis passes ~80% (converge) or ~95% (deliver now); never written to the transcript; the turn axis counts only from maxTurns 4. Unset = ON whenever an axis is armed; false = off; { at } overrides the thresholds.",
|
|
50
54
|
precedence: "spec.limits.approachNotice > on-when-any-axis-armed",
|
|
51
55
|
},
|
|
52
56
|
{
|
|
53
57
|
key: "budget.totalTokens",
|
|
54
58
|
recommended: null,
|
|
59
|
+
default: null,
|
|
55
60
|
unit: "tokens",
|
|
56
61
|
kind: "budget",
|
|
57
62
|
summary: "Cross-slice token allocation for resource-suspend tasks. First slice only; later slices read the frozen ledger. Unset = per-slice windows only.",
|
|
@@ -60,6 +65,7 @@ export function describeConfigCatalog() {
|
|
|
60
65
|
{
|
|
61
66
|
key: "delegation.retainTtlMs",
|
|
62
67
|
recommended: RETAIN_DEFAULT_TTL_MS,
|
|
68
|
+
default: RETAIN_DEFAULT_TTL_MS,
|
|
63
69
|
unit: "ms",
|
|
64
70
|
kind: "retention",
|
|
65
71
|
summary: "Retained child session TTL (settled-at based) within the parent run's retain ledger.",
|
|
@@ -68,6 +74,7 @@ export function describeConfigCatalog() {
|
|
|
68
74
|
{
|
|
69
75
|
key: "delegation.retainMax",
|
|
70
76
|
recommended: RETAIN_DEFAULT_MAX,
|
|
77
|
+
default: RETAIN_DEFAULT_MAX,
|
|
71
78
|
unit: "count",
|
|
72
79
|
kind: "retention",
|
|
73
80
|
summary: "Max retained children per parent run (oldest settled idle evicted beyond it).",
|
|
@@ -76,6 +83,7 @@ export function describeConfigCatalog() {
|
|
|
76
83
|
{
|
|
77
84
|
key: "session.idleTtlDays",
|
|
78
85
|
recommended: SESSION_DEFAULT_TTL_DAYS,
|
|
86
|
+
default: SESSION_DEFAULT_TTL_DAYS,
|
|
79
87
|
unit: "days",
|
|
80
88
|
kind: "retention",
|
|
81
89
|
summary: "Idle TTL before a cached session is evicted from the session store.",
|
|
@@ -89,20 +97,21 @@ const MAX_DECLARATION_CHARS = 200;
|
|
|
89
97
|
const sanitizeDeclarationText = (s) => s.replace(/[\u0000-\u0008\u000b-\u001f\u007f]/g, "").slice(0, MAX_DECLARATION_CHARS);
|
|
90
98
|
export function resolveEffectiveConfig(spec, ctx) {
|
|
91
99
|
const l = spec.limits;
|
|
92
|
-
const
|
|
100
|
+
const defaults = new Map(describeConfigCatalog().knobs.flatMap((k) => (k.default !== undefined ? [[k.key, k.default]] : [])));
|
|
101
|
+
const pick = (key, specVal) => specVal !== undefined ? { key, value: specVal, provenance: "spec" } : { key, value: defaults.get(key) ?? null, provenance: "default" };
|
|
93
102
|
const maxOutputTokens = l?.maxOutputTokens !== undefined
|
|
94
103
|
? { key: "limits.maxOutputTokens", value: l.maxOutputTokens, provenance: "spec" }
|
|
95
104
|
: ctx?.modelMaxTokens !== undefined
|
|
96
105
|
? { key: "limits.maxOutputTokens", value: ctx.modelMaxTokens, provenance: "derived" }
|
|
97
106
|
: { key: "limits.maxOutputTokens", value: null, provenance: "default" };
|
|
98
107
|
const fields = [
|
|
99
|
-
pick("limits.maxTurns", l?.maxTurns
|
|
100
|
-
pick("limits.maxWalltimeMs", l?.maxWalltimeMs
|
|
108
|
+
pick("limits.maxTurns", l?.maxTurns),
|
|
109
|
+
pick("limits.maxWalltimeMs", l?.maxWalltimeMs),
|
|
101
110
|
maxOutputTokens,
|
|
102
|
-
pick("limits.maxCostUsd", l?.maxCostUsd
|
|
103
|
-
pick("limits.maxTokens", l?.maxTokens
|
|
104
|
-
pick("budget.totalTokens", spec.resourceSuspend?.totalTokens
|
|
105
|
-
pick("budget.totalBudgetUsd", spec.resourceSuspend?.totalBudgetUsd
|
|
111
|
+
pick("limits.maxCostUsd", l?.maxCostUsd),
|
|
112
|
+
pick("limits.maxTokens", l?.maxTokens),
|
|
113
|
+
pick("budget.totalTokens", spec.resourceSuspend?.totalTokens),
|
|
114
|
+
pick("budget.totalBudgetUsd", spec.resourceSuspend?.totalBudgetUsd),
|
|
106
115
|
];
|
|
107
116
|
for (const d of (spec.configOverrides ?? []).slice(0, MAX_OVERRIDE_DECLARATIONS)) {
|
|
108
117
|
fields.push({
|
package/dist/core/a2a.d.ts
CHANGED
|
@@ -2,9 +2,10 @@ import type { AgentTool } from "../internal/harness-types.js";
|
|
|
2
2
|
import { type CredentialEchoSite } from "./credential-echo.js";
|
|
3
3
|
import { type PeerSeat } from "./peer-seat.js";
|
|
4
4
|
import { type HostFloor } from "./host-floor.js";
|
|
5
|
+
import { type ProtocolRevocationLedger, type RevocationProbe } from "./protocol-revocation.js";
|
|
5
6
|
import { type McpFailureFields } from "./mcp-failure.js";
|
|
6
7
|
import type { A2aServerSpec, ToolEffect } from "./types.js";
|
|
7
|
-
/** The hard per-skill description bound (ruled 2026-08-03: ~2KiB). */
|
|
8
|
+
/** The hard per-skill description bound (ruled 2026-08-03: ~2KiB), counted in code points — the unit every cut in the description is made in. */
|
|
8
9
|
export declare const A2A_SKILL_DESCRIPTION_MAX_CHARS = 2048;
|
|
9
10
|
/**
|
|
10
11
|
* The safety axes carried alongside one materialized A2A tool, for `prepare-task` to fold into the SAME
|
|
@@ -56,12 +57,16 @@ export interface A2aRefreshResult extends Partial<McpFailureFields> {
|
|
|
56
57
|
/** The peer's namespaced-name prefix — the consumer's SPLICE DOMAIN for a wholesale swap (the same
|
|
57
58
|
* self-healing prefix domain the MCP refresh receipt hands out). Present on every entry. */
|
|
58
59
|
prefix: string;
|
|
59
|
-
|
|
60
|
+
/** `revoked`: the revocation ledger answered the peer revoked, so its card was not asked for and its tools stay as they were. */
|
|
61
|
+
status: "refreshed" | "failed" | "disposed" | "revoked";
|
|
60
62
|
toolCount: number;
|
|
61
63
|
added: string[];
|
|
62
64
|
removed: string[];
|
|
63
65
|
tools?: AgentTool[];
|
|
64
66
|
axes?: A2aToolAxis[];
|
|
67
|
+
/** On a `refreshed` entry whose peer was mounted from its public card although the card offers an extended one: the same warning
|
|
68
|
+
* {@link MaterializedA2a.warnings} carries at the first mount (`a2a.extended_card_unavailable`). Present only when there is one. */
|
|
69
|
+
warnings?: Error[];
|
|
65
70
|
error?: string;
|
|
66
71
|
}
|
|
67
72
|
/**
|
|
@@ -76,7 +81,14 @@ export interface MaterializedA2a {
|
|
|
76
81
|
tools: AgentTool[];
|
|
77
82
|
toolAxes: A2aToolAxis[];
|
|
78
83
|
/** One entry per peer that could not be materialized and was SKIPPED (fail-open, design/29): the task
|
|
79
|
-
* runs with the healthy peers' tools.
|
|
84
|
+
* runs with the healthy peers' tools — `code: "a2a.peer_unavailable"`, the refusal as its `cause`. A peer that DID mount adds one
|
|
85
|
+
* entry when its public card offers an authenticated extended card that could not be used: it is mounted from the public card —
|
|
86
|
+
* `code: "a2a.extended_card_unavailable"`, `reason` one of `no_credentials` (a send to the endpoint would carry nothing — no seat piece, no principal — or the
|
|
87
|
+
* seat did not furnish it, so the extended card was not asked for), `http_<status>` (the peer answered that status), `malformed` (it answered 2xx with something
|
|
88
|
+
* that is not a card: not JSON, not a JSON-RPC response, an error member, a result that is not an object) or `unreachable` (no
|
|
89
|
+
* answer: a transport failure, the deadline, or a send the hop judge or the endpoint judge did not make), the failure as its
|
|
90
|
+
* `cause` when there is one. A peer whose card does not offer one has no entry. The Runner forwards these to
|
|
91
|
+
* `onError(phase:"a2a")`. */
|
|
80
92
|
warnings: Error[];
|
|
81
93
|
/** One entry per DECLARED peer, in declaration order, ready or failed — the declaration as this materialization read it once. */
|
|
82
94
|
statuses: A2aPeerStatus[];
|
|
@@ -108,4 +120,10 @@ export declare class A2aRpcError extends Error {
|
|
|
108
120
|
* `allSettled` keeps it fail-open: one unreachable peer is a skipped peer with a warning, never a task
|
|
109
121
|
* that cannot start.
|
|
110
122
|
*/
|
|
111
|
-
export declare function materializeA2aTools(specs: readonly A2aServerSpec[], principal?: string, signal?: AbortSignal, hostFloor?: HostFloor, given?: PeerSeat, onCredentialEchoed?: (peer: string, where: CredentialEchoSite) => void
|
|
123
|
+
export declare function materializeA2aTools(specs: readonly A2aServerSpec[], principal?: string, signal?: AbortSignal, hostFloor?: HostFloor, given?: PeerSeat, onCredentialEchoed?: (peer: string, where: CredentialEchoSite) => void, // once per peer: its card echoed the credentials its sends carried (the runner's notice)
|
|
124
|
+
revocations?: ProtocolRevocationLedger & {
|
|
125
|
+
onProbeFailure?: (error: unknown) => void;
|
|
126
|
+
}): Promise<MaterializedA2a>;
|
|
127
|
+
/** The runner's materialization of one leg's peers (not index-exported): the seat as the runner received it, and the leg's ONE revocation
|
|
128
|
+
* probe — the one its MCP materialization asks too (a broken ledger is told once per leg). */
|
|
129
|
+
export declare function materializeLegA2aTools(revocations: RevocationProbe | undefined, specs: readonly A2aServerSpec[], principal: string | undefined, signal: AbortSignal | undefined, hostFloor: HostFloor | undefined, peerSeat: PeerSeat | undefined, onCredentialEchoed: ((peer: string, where: CredentialEchoSite) => void) | undefined): Promise<MaterializedA2a>;
|
package/dist/core/a2a.js
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
2
|
import { Type } from "typebox";
|
|
3
3
|
import { A2A_TASK_STATES } from "./a2a-task-state.js";
|
|
4
|
-
import { assertEndpointBound, carriesDeclaredHeaders, resolveProtocolHttpHeaders, underDeclaredHeaders } from "./protocol-http-auth.js";
|
|
4
|
+
import { assertEndpointBound, carriesDeclaredHeaders, eraseSentCredentials, resolveProtocolHttpHeaders, underDeclaredHeaders } from "./protocol-http-auth.js";
|
|
5
5
|
import { carrierEcho, echoAnnouncer, erasedEcho, nameEchoes } from "./credential-echo.js";
|
|
6
|
-
import { PeerCarrier, carriedHttpHeaders, peerSeatMissing, receivePeerSeat } from "./peer-seat.js";
|
|
6
|
+
import { NO_PIECES, PeerCarrier, PeerSeatFailure, carriedHttpHeaders, peerSeatMissing, receivePeerSeat } from "./peer-seat.js";
|
|
7
7
|
import { fetchFollowing, hopRefusal, HOST_FLOOR_REFUSED_CODE } from "./host-floor.js";
|
|
8
|
+
import { ProtocolRevokedRefusal, REVOKED_PEER_CODES, libraryRevocationProbe } from "./protocol-revocation.js";
|
|
9
|
+
import { revokedCallResult } from "./mcp-server-link.js";
|
|
8
10
|
import { classifyMcpFailure, describeHttpTransportFailure, failureFields } from "./mcp-failure.js";
|
|
9
11
|
import { findNamespacePrefixCollision, mintNamespacePrefix, mintNamespacedToolName } from "./protocol-naming.js";
|
|
10
12
|
import { A2A_NAMESPACE } from "./protocol-table.js";
|
|
11
13
|
import { judgeEntryToolAxes, refusedDeclarer, snapshotDeclaredEntry } from "./locked-config.js";
|
|
12
|
-
import { delimitUntrusted, inlineUntrusted } from "./untrusted-text.js";
|
|
13
|
-
import { thrownText } from "./thrown-value.js";
|
|
14
|
+
import { INLINE_TRUNCATION_MARK_CODEPOINTS, delimitUntrusted, inlineUntrusted } from "./untrusted-text.js";
|
|
15
|
+
import { codedRefusal, thrownText } from "./thrown-value.js";
|
|
14
16
|
import { boundaryFlowFace } from "./cross-boundary-taint.js";
|
|
15
17
|
const A2A_REQUEST_TIMEOUT_MS = 30_000;
|
|
16
18
|
const A2A_CARD_TIMEOUT_MS = 10_000;
|
|
@@ -21,17 +23,30 @@ const A2A_POLL_MAX_DELAY_MS = 5_000;
|
|
|
21
23
|
const A2A_POLL_BACKOFF_FACTOR = 2;
|
|
22
24
|
const A2A_RESPONSE_MAX_BYTES = 8 * 1024 * 1024;
|
|
23
25
|
const A2A_SKILL_NAME_MAX_CHARS = 200;
|
|
24
|
-
const A2A_SKILL_TEXT_MAX_CHARS = 1_200;
|
|
25
26
|
const A2A_SKILL_TAGS_MAX_CHARS = 240;
|
|
26
27
|
const A2A_SKILL_EXAMPLES_MAX_CHARS = 320;
|
|
27
28
|
export const A2A_SKILL_DESCRIPTION_MAX_CHARS = 2_048;
|
|
29
|
+
const A2A_PEER_SKILLS_MAX = 128;
|
|
28
30
|
const A2A_CARD_NAME_MAX_CHARS = 160;
|
|
29
31
|
const A2A_CARD_DESCRIPTION_MAX_CHARS = 240;
|
|
30
32
|
const A2A_ID_MAX_CHARS = 160;
|
|
33
|
+
const SKILL_HEAD_BEFORE_PEER = 'Ask the remote agent "';
|
|
34
|
+
const SKILL_HEAD_BETWEEN = '" to perform its "';
|
|
35
|
+
const SKILL_HEAD_AFTER_TITLE = '" skill.';
|
|
36
|
+
const SKILL_TAGS_LABEL = "Tags: ";
|
|
37
|
+
const SKILL_EXAMPLES_LABEL = "Examples: ";
|
|
38
|
+
const SKILL_TAIL = "The agent acts on its own side; its reply is returned as untrusted external data.";
|
|
39
|
+
const SKILL_DESCRIPTION_LINES_MAX = 5;
|
|
40
|
+
const SKILL_SKELETON_CHARS = SKILL_HEAD_BEFORE_PEER.length + SKILL_HEAD_BETWEEN.length + SKILL_HEAD_AFTER_TITLE.length + SKILL_TAGS_LABEL.length + SKILL_EXAMPLES_LABEL.length + SKILL_TAIL.length + (SKILL_DESCRIPTION_LINES_MAX - 1);
|
|
41
|
+
const cutReads = (width) => width + INLINE_TRUNCATION_MARK_CODEPOINTS;
|
|
42
|
+
const A2A_SKILL_TEXT_MAX_CHARS = A2A_SKILL_DESCRIPTION_MAX_CHARS -
|
|
43
|
+
(SKILL_SKELETON_CHARS + cutReads(A2A_ID_MAX_CHARS) + cutReads(A2A_SKILL_NAME_MAX_CHARS) + cutReads(A2A_SKILL_TAGS_MAX_CHARS) + cutReads(A2A_SKILL_EXAMPLES_MAX_CHARS)) -
|
|
44
|
+
INLINE_TRUNCATION_MARK_CODEPOINTS;
|
|
31
45
|
const A2A_RESULT_BODY_MAX_CHARS = 100_000;
|
|
32
46
|
const A2A_ERROR_TEXT_MAX_CHARS = 240;
|
|
33
47
|
const A2A_RESULT_FENCE_REASON = "the peer is an agent acting on its own, so its output is worker text, not tool data";
|
|
34
48
|
const A2A_CARD_PATHS = ["/.well-known/agent-card.json", "/.well-known/agent.json"];
|
|
49
|
+
const A2A_EXTENDED_CARD_METHOD = "agent/getAuthenticatedExtendedCard";
|
|
35
50
|
const A2A_PROTOCOL_VERSION = "1.0";
|
|
36
51
|
const A2A_JSONRPC_TRANSPORT = "JSONRPC";
|
|
37
52
|
const A2A_ERROR_CODE_NAMES = new Map([
|
|
@@ -83,6 +98,14 @@ function safeId(v) {
|
|
|
83
98
|
return undefined;
|
|
84
99
|
return inlineUntrusted(s, A2A_ID_MAX_CHARS);
|
|
85
100
|
}
|
|
101
|
+
function peerHopRefusal(t, url) {
|
|
102
|
+
if (t.revocations?.({ protocol: "a2a", peer: t.peer }) === true)
|
|
103
|
+
return { reason: "the peer was revoked by the operator", code: REVOKED_PEER_CODES.a2a };
|
|
104
|
+
return hopRefusal(url, t.floor, false);
|
|
105
|
+
}
|
|
106
|
+
function carriedBy(t, pieces) {
|
|
107
|
+
return carriedHttpHeaders(A2A_NAMESPACE.id, t.carrier, pieces, t.principalHeader, t.principal);
|
|
108
|
+
}
|
|
86
109
|
const A2A_MAX_REDIRECTS = 20;
|
|
87
110
|
function withRequestDeadline(outer, timeoutMs) {
|
|
88
111
|
const controller = new AbortController();
|
|
@@ -153,7 +176,11 @@ async function requestJson(t, what, init) {
|
|
|
153
176
|
const deadline = withRequestDeadline(init.signal, init.timeoutMs);
|
|
154
177
|
const peerLabel = inlineUntrusted(t.peer, A2A_ID_MAX_CHARS);
|
|
155
178
|
const pieces = await t.carrier.next(init.signal, init.url);
|
|
156
|
-
const carried =
|
|
179
|
+
const carried = carriedBy(t, pieces);
|
|
180
|
+
if (init.needsCarried === true && !carriesDeclaredHeaders(carried === undefined ? undefined : { ...carried })) {
|
|
181
|
+
deadline.dispose();
|
|
182
|
+
throw new A2aNothingCarried(`a2a: ${what} on peer "${peerLabel}" is not sent — nothing this peer's sends carry (the peer seat's pieces, the principal header) would authenticate it for this destination`);
|
|
183
|
+
}
|
|
157
184
|
assertEndpointBound(A2A_NAMESPACE.id, t.peer, init.url, t.declared, carried === undefined ? undefined : { ...carried });
|
|
158
185
|
try {
|
|
159
186
|
const followed = await fetchFollowing(doFetch, new URL(init.url), {
|
|
@@ -161,9 +188,13 @@ async function requestJson(t, what, init) {
|
|
|
161
188
|
headers: underDeclaredHeaders({ accept: "application/json", "a2a-version": A2A_PROTOCOL_VERSION, ...(init.body !== undefined ? { "content-type": "application/json" } : {}) }, carried === undefined ? undefined : { ...carried }),
|
|
162
189
|
...(init.body !== undefined ? { body: init.body } : {}),
|
|
163
190
|
signal: deadline.signal,
|
|
164
|
-
}, { refusal: (url) =>
|
|
165
|
-
if (followed.kind === "refused")
|
|
166
|
-
throw
|
|
191
|
+
}, { refusal: (url) => peerHopRefusal(t, url), follows: () => !carriesDeclaredHeaders(carried === undefined ? undefined : { ...carried }), maxRedirects: A2A_MAX_REDIRECTS });
|
|
192
|
+
if (followed.kind === "refused" && followed.code === REVOKED_PEER_CODES.a2a)
|
|
193
|
+
throw new ProtocolRevokedRefusal({ protocol: "a2a", peer: t.peer }, followed.afterSentHop);
|
|
194
|
+
if (followed.kind === "refused") {
|
|
195
|
+
const reason = eraseSentCredentials(followed.reason, Object.values(carried ?? {}));
|
|
196
|
+
throw codedRefusal(HOST_FLOOR_REFUSED_CODE, `a2a: ${what} on peer "${peerLabel}" is not sent — ${reason}`);
|
|
197
|
+
}
|
|
167
198
|
if (followed.kind === "too_many")
|
|
168
199
|
throw new Error(`a2a: ${what} on peer "${peerLabel}" was redirected more than ${A2A_MAX_REDIRECTS} times`);
|
|
169
200
|
const res = followed.res;
|
|
@@ -188,36 +219,46 @@ async function requestJson(t, what, init) {
|
|
|
188
219
|
deadline.dispose();
|
|
189
220
|
}
|
|
190
221
|
}
|
|
191
|
-
|
|
222
|
+
class A2aNothingCarried extends Error {
|
|
223
|
+
}
|
|
224
|
+
class A2aBadAnswer extends Error {
|
|
225
|
+
status;
|
|
226
|
+
constructor(message, status, options) {
|
|
227
|
+
super(message, options);
|
|
228
|
+
this.status = status;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
async function jsonRpc(t, method, params, signal, timeoutMs = A2A_REQUEST_TIMEOUT_MS, needsCarried = false) {
|
|
192
232
|
const peerLabel = inlineUntrusted(t.peer, A2A_ID_MAX_CHARS);
|
|
193
233
|
const { status, text } = await requestJson(t, method, {
|
|
194
234
|
method: "POST",
|
|
195
235
|
url: t.endpoint,
|
|
196
|
-
body: JSON.stringify({ jsonrpc: "2.0", id: randomUUID(), method, params }),
|
|
236
|
+
body: JSON.stringify({ jsonrpc: "2.0", id: randomUUID(), method, ...(params !== undefined ? { params } : {}) }),
|
|
197
237
|
timeoutMs,
|
|
238
|
+
...(needsCarried ? { needsCarried } : {}),
|
|
198
239
|
...(signal !== undefined ? { signal } : {}),
|
|
199
240
|
});
|
|
200
241
|
if (status < 200 || status >= 300) {
|
|
201
|
-
throw new
|
|
242
|
+
throw new A2aBadAnswer(`a2a: peer "${peerLabel}" answered ${status} to ${method} instead of a JSON-RPC response`, status);
|
|
202
243
|
}
|
|
203
244
|
let parsed;
|
|
204
245
|
try {
|
|
205
246
|
parsed = JSON.parse(text);
|
|
206
247
|
}
|
|
207
248
|
catch (err) {
|
|
208
|
-
throw new
|
|
249
|
+
throw new A2aBadAnswer(`a2a: peer "${peerLabel}" answered ${method} with a body that is not JSON`, undefined, { cause: err });
|
|
209
250
|
}
|
|
210
251
|
const envelope = asRecord(parsed);
|
|
211
252
|
if (envelope === undefined) {
|
|
212
|
-
throw new
|
|
253
|
+
throw new A2aBadAnswer(`a2a: peer "${peerLabel}" answered ${method} with a JSON value that is not a JSON-RPC envelope`);
|
|
213
254
|
}
|
|
214
255
|
const errorMember = asRecord(envelope["error"]);
|
|
215
256
|
if (errorMember !== undefined) {
|
|
216
257
|
const code = errorMember["code"];
|
|
217
|
-
throw new A2aRpcError(t.peer, method, typeof code === "number" ? code : -32603, asString(errorMember["message"]) ?? "(no message)");
|
|
258
|
+
throw new A2aRpcError(t.peer, method, typeof code === "number" ? code : -32603, eraseSentCredentials(asString(errorMember["message"]) ?? "(no message)", [...t.carrier.credentials, ...t.carrier.sent]));
|
|
218
259
|
}
|
|
219
260
|
if (!("result" in envelope)) {
|
|
220
|
-
throw new
|
|
261
|
+
throw new A2aBadAnswer(`a2a: peer "${peerLabel}" answered ${method} with neither a result nor an error member`);
|
|
221
262
|
}
|
|
222
263
|
return envelope["result"];
|
|
223
264
|
}
|
|
@@ -291,15 +332,46 @@ function readCard(peer, body, fallbackUrl, echo) {
|
|
|
291
332
|
if (card === undefined) {
|
|
292
333
|
throw new Error(`a2a: peer "${inlineUntrusted(peer, A2A_ID_MAX_CHARS)}" served an agent card that is not a JSON object`);
|
|
293
334
|
}
|
|
335
|
+
const skills = readSkills(peer, card, echo);
|
|
336
|
+
const name = asString(card["name"]);
|
|
337
|
+
const nameHolds = name !== undefined && nameEchoes(name, echo, "agent_card");
|
|
338
|
+
const description = erasedEcho(asString(card["description"]), echo, "agent_card");
|
|
339
|
+
return {
|
|
340
|
+
...(name !== undefined && !nameHolds ? { name: inlineUntrusted(name, A2A_CARD_NAME_MAX_CHARS) } : {}),
|
|
341
|
+
...(description !== undefined ? { description: inlineUntrusted(description, A2A_CARD_DESCRIPTION_MAX_CHARS) } : {}),
|
|
342
|
+
endpoint: negotiateEndpoint(peer, card, fallbackUrl, echo),
|
|
343
|
+
skills,
|
|
344
|
+
extendedCard: card["supportsAuthenticatedExtendedCard"] === true,
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
function assertSkillCount(peer, count, whose) {
|
|
348
|
+
if (count <= A2A_PEER_SKILLS_MAX)
|
|
349
|
+
return;
|
|
350
|
+
throw new A2aBadAnswer(`a2a: peer "${inlineUntrusted(peer, A2A_ID_MAX_CHARS)}": ${whose} ${count} skills — this client mounts at most ${A2A_PEER_SKILLS_MAX} per peer and refuses the card rather than cut the list`);
|
|
351
|
+
}
|
|
352
|
+
function readSkills(peer, card, echo) {
|
|
353
|
+
const listed = card["skills"];
|
|
354
|
+
const entries = listed === undefined ? [] : asArray(listed);
|
|
355
|
+
if (entries === undefined) {
|
|
356
|
+
throw new A2aBadAnswer(`a2a: peer "${inlineUntrusted(peer, A2A_ID_MAX_CHARS)}": its card's skills are not a list (${listed === null ? "null" : typeof listed})`);
|
|
357
|
+
}
|
|
358
|
+
assertSkillCount(peer, entries.length, "its card lists");
|
|
294
359
|
const text = (raw) => erasedEcho(raw, echo, "agent_card");
|
|
295
360
|
const skills = [];
|
|
296
|
-
|
|
361
|
+
const named = new Set();
|
|
362
|
+
for (const [index, entry] of entries.entries()) {
|
|
297
363
|
const rec = asRecord(entry);
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
364
|
+
const id = rec === undefined ? undefined : asString(rec["id"]);
|
|
365
|
+
if (rec === undefined || id === undefined || id === "") {
|
|
366
|
+
const why = rec === undefined ? "it is not an object" : id === undefined ? "it has no string id" : "its id is empty";
|
|
367
|
+
throw new A2aBadAnswer(`a2a: peer "${inlineUntrusted(peer, A2A_ID_MAX_CHARS)}": its card's skills list holds an entry that names no skill (entry ${index + 1}: ${why}) — an id names the skill a peer offers, and this client refuses the card rather than mount part of what it says`);
|
|
368
|
+
}
|
|
369
|
+
if (nameEchoes(id, echo, "agent_card"))
|
|
302
370
|
continue;
|
|
371
|
+
if (named.has(id)) {
|
|
372
|
+
throw new A2aBadAnswer(`a2a: peer "${inlineUntrusted(peer, A2A_ID_MAX_CHARS)}": its card lists the id "${inlineUntrusted(id, A2A_SKILL_NAME_MAX_CHARS)}" more than once among its skills — ids on a card are unique, and this client refuses the card rather than choose between the entries`);
|
|
373
|
+
}
|
|
374
|
+
named.add(id);
|
|
303
375
|
const tags = (asArray(rec["tags"]) ?? []).filter((v) => typeof v === "string").map((v) => text(v));
|
|
304
376
|
const examples = (asArray(rec["examples"]) ?? []).filter((v) => typeof v === "string").map((v) => text(v));
|
|
305
377
|
const name = text(asString(rec["name"]));
|
|
@@ -312,15 +384,7 @@ function readCard(peer, body, fallbackUrl, echo) {
|
|
|
312
384
|
...(examples.length > 0 ? { examples } : {}),
|
|
313
385
|
});
|
|
314
386
|
}
|
|
315
|
-
|
|
316
|
-
const nameHolds = name !== undefined && nameEchoes(name, echo, "agent_card");
|
|
317
|
-
const description = text(asString(card["description"]));
|
|
318
|
-
return {
|
|
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),
|
|
322
|
-
skills,
|
|
323
|
-
};
|
|
387
|
+
return skills;
|
|
324
388
|
}
|
|
325
389
|
function a2aToolParameters() {
|
|
326
390
|
return Type.Object({
|
|
@@ -331,15 +395,15 @@ function a2aToolParameters() {
|
|
|
331
395
|
}
|
|
332
396
|
function skillDescription(peerLabel, skill) {
|
|
333
397
|
const lines = [];
|
|
334
|
-
const title = skill.name
|
|
335
|
-
lines.push(
|
|
398
|
+
const title = inlineUntrusted(skill.name ?? skill.id, A2A_SKILL_NAME_MAX_CHARS);
|
|
399
|
+
lines.push(`${SKILL_HEAD_BEFORE_PEER}${peerLabel}${SKILL_HEAD_BETWEEN}${title}${SKILL_HEAD_AFTER_TITLE}`);
|
|
336
400
|
if (skill.description !== undefined)
|
|
337
401
|
lines.push(inlineUntrusted(skill.description, A2A_SKILL_TEXT_MAX_CHARS));
|
|
338
402
|
if (skill.tags !== undefined)
|
|
339
|
-
lines.push(
|
|
403
|
+
lines.push(`${SKILL_TAGS_LABEL}${inlineUntrusted(skill.tags.join(", "), A2A_SKILL_TAGS_MAX_CHARS)}`);
|
|
340
404
|
if (skill.examples !== undefined)
|
|
341
|
-
lines.push(
|
|
342
|
-
lines.push(
|
|
405
|
+
lines.push(`${SKILL_EXAMPLES_LABEL}${inlineUntrusted(skill.examples.join(" | "), A2A_SKILL_EXAMPLES_MAX_CHARS)}`);
|
|
406
|
+
lines.push(SKILL_TAIL);
|
|
343
407
|
return lines.join("\n");
|
|
344
408
|
}
|
|
345
409
|
function a2aAxisFor(name, override) {
|
|
@@ -430,6 +494,21 @@ function continuationLine(taskId, contextId) {
|
|
|
430
494
|
keys.push(`contextId ${contextId}`);
|
|
431
495
|
return keys.length > 0 ? ` Continue it by calling this tool again with ${keys.join(" and ")}.` : "";
|
|
432
496
|
}
|
|
497
|
+
function unknownOutcomeLine(taskId, contextId) {
|
|
498
|
+
const keys = [];
|
|
499
|
+
if (taskId !== undefined)
|
|
500
|
+
keys.push(`taskId ${taskId}`);
|
|
501
|
+
if (contextId !== undefined)
|
|
502
|
+
keys.push(`contextId ${contextId}`);
|
|
503
|
+
return ` Do not send the request again — it may already be done or still running, and this tool has no read-only way to ask after it${keys.length > 0 ? ` (${keys.join(" and ")})` : ""}.`;
|
|
504
|
+
}
|
|
505
|
+
function skillCallWhat(skillId) {
|
|
506
|
+
return `The call to skill ${inlineUntrusted(skillId, A2A_ID_MAX_CHARS)}`;
|
|
507
|
+
}
|
|
508
|
+
function revokedSkillCall(refusal, skillId, accepted) {
|
|
509
|
+
const answer = revokedCallResult(refusal, skillCallWhat(skillId), accepted);
|
|
510
|
+
return { ...answer, details: { type: "a2a", ...answer.details } };
|
|
511
|
+
}
|
|
433
512
|
function delay(ms, signal) {
|
|
434
513
|
return new Promise((resolve) => {
|
|
435
514
|
const timer = setTimeout(() => {
|
|
@@ -458,7 +537,7 @@ async function awaitTaskOutcome(t, peerLabel, skillId, firstTask, signal) {
|
|
|
458
537
|
let pollDelayMs = A2A_POLL_FIRST_DELAY_MS;
|
|
459
538
|
for (;;) {
|
|
460
539
|
if ("unrecognized" in observed) {
|
|
461
|
-
throw new Error(`a2a: peer "${peerLabel}" reported task state ${JSON.stringify(inlineUntrusted(observed.unrecognized, A2A_ID_MAX_CHARS))} for skill "${inlineUntrusted(skillId, A2A_ID_MAX_CHARS)}", which is not a state this client knows. The outcome is UNKNOWN.${
|
|
540
|
+
throw new Error(`a2a: peer "${peerLabel}" reported task state ${JSON.stringify(inlineUntrusted(observed.unrecognized, A2A_ID_MAX_CHARS))} for skill "${inlineUntrusted(skillId, A2A_ID_MAX_CHARS)}", which is not a state this client knows. The outcome is UNKNOWN.${unknownOutcomeLine(safeId(task["id"]), safeId(task["contextId"]))}`);
|
|
462
541
|
}
|
|
463
542
|
const state = observed.state;
|
|
464
543
|
const taskId = safeId(task["id"]);
|
|
@@ -491,20 +570,23 @@ async function awaitTaskOutcome(t, peerLabel, skillId, firstTask, signal) {
|
|
|
491
570
|
}
|
|
492
571
|
const now = Date.now();
|
|
493
572
|
if (now - startedAt >= A2A_CALL_TOTAL_TIMEOUT_MS) {
|
|
494
|
-
throw new Error(`a2a: the remote agent "${peerLabel}" was still ${state} after ${Math.round((now - startedAt) / 1000)}s (ceiling ${A2A_CALL_TOTAL_TIMEOUT_MS}ms). The client stopped waiting; the agent is still acting, so treat the outcome as UNKNOWN.${
|
|
573
|
+
throw new Error(`a2a: the remote agent "${peerLabel}" was still ${state} after ${Math.round((now - startedAt) / 1000)}s (ceiling ${A2A_CALL_TOTAL_TIMEOUT_MS}ms). The client stopped waiting; the agent is still acting, so treat the outcome as UNKNOWN.${unknownOutcomeLine(taskId, contextId)}`);
|
|
495
574
|
}
|
|
496
575
|
if (now - idleSince >= A2A_STATE_IDLE_TIMEOUT_MS) {
|
|
497
|
-
throw new Error(`a2a: the remote agent "${peerLabel}" answered every poll but never left state ${state} for ${A2A_STATE_IDLE_TIMEOUT_MS}ms. The client stopped waiting; treat the outcome as UNKNOWN.${
|
|
576
|
+
throw new Error(`a2a: the remote agent "${peerLabel}" answered every poll but never left state ${state} for ${A2A_STATE_IDLE_TIMEOUT_MS}ms. The client stopped waiting; treat the outcome as UNKNOWN.${unknownOutcomeLine(taskId, contextId)}`);
|
|
498
577
|
}
|
|
499
578
|
await delay(pollDelayMs, signal);
|
|
500
579
|
if (signal?.aborted === true)
|
|
501
|
-
throw new Error(`a2a: the call to "${peerLabel}" was aborted while waiting for the remote agent.${
|
|
580
|
+
throw new Error(`a2a: the call to "${peerLabel}" was aborted while waiting for the remote agent.${unknownOutcomeLine(taskId, contextId)}`);
|
|
502
581
|
pollDelayMs = Math.min(pollDelayMs * A2A_POLL_BACKOFF_FACTOR, A2A_POLL_MAX_DELAY_MS);
|
|
503
582
|
const rawId = asString(task["id"]);
|
|
504
583
|
if (rawId === undefined) {
|
|
505
584
|
throw new Error(`a2a: the remote agent "${peerLabel}" returned a non-terminal task with no id, so it cannot be polled. The outcome is UNKNOWN.`);
|
|
506
585
|
}
|
|
507
|
-
const
|
|
586
|
+
const asked = await jsonRpc(t, "tasks/get", { id: rawId }, signal).catch((err) => (err instanceof ProtocolRevokedRefusal ? err : Promise.reject(err)));
|
|
587
|
+
if (asked instanceof ProtocolRevokedRefusal)
|
|
588
|
+
return revokedSkillCall(asked, skillId, { taskId });
|
|
589
|
+
const polled = asRecord(asked);
|
|
508
590
|
if (polled === undefined) {
|
|
509
591
|
throw new Error(`a2a: peer "${peerLabel}" answered tasks/get with something that is not a task object`);
|
|
510
592
|
}
|
|
@@ -545,7 +627,9 @@ function buildSkillTool(spec, t, skill, lifecycle) {
|
|
|
545
627
|
...(contextId !== undefined && contextId !== "" ? { contextId } : {}),
|
|
546
628
|
},
|
|
547
629
|
configuration: { blocking: true },
|
|
548
|
-
}, signal);
|
|
630
|
+
}, signal).catch((err) => (err instanceof ProtocolRevokedRefusal ? err : Promise.reject(err)));
|
|
631
|
+
if (result instanceof ProtocolRevokedRefusal)
|
|
632
|
+
return revokedSkillCall(result, skill.id);
|
|
549
633
|
const answer = asRecord(result);
|
|
550
634
|
if (answer === undefined) {
|
|
551
635
|
throw new Error(`a2a: peer "${peerLabel}" answered message/send with something that is not a protocol object`);
|
|
@@ -566,6 +650,51 @@ function buildSkillTool(spec, t, skill, lifecycle) {
|
|
|
566
650
|
},
|
|
567
651
|
};
|
|
568
652
|
}
|
|
653
|
+
function extendedCardReasonOf(err) {
|
|
654
|
+
if (err instanceof A2aNothingCarried || err instanceof PeerSeatFailure)
|
|
655
|
+
return "no_credentials";
|
|
656
|
+
if (err instanceof A2aBadAnswer)
|
|
657
|
+
return err.status !== undefined ? `http_${err.status}` : "malformed";
|
|
658
|
+
if (err instanceof A2aRpcError)
|
|
659
|
+
return "malformed";
|
|
660
|
+
return "unreachable";
|
|
661
|
+
}
|
|
662
|
+
function readFailure(err, detail) {
|
|
663
|
+
const code = err?.code;
|
|
664
|
+
return Object.assign(new Error(detail), { name: err instanceof Error ? err.name : "Error", ...(typeof code === "string" || typeof code === "number" ? { code } : {}) });
|
|
665
|
+
}
|
|
666
|
+
function extendedCardWarning(peer, reason, detail, cause) {
|
|
667
|
+
const warning = new Error(`a2a: peer "${inlineUntrusted(peer, A2A_ID_MAX_CHARS)}" is mounted from its public agent card — its authenticated extended card is unavailable (${reason}): ${detail}`, cause !== undefined ? { cause } : undefined);
|
|
668
|
+
warning.code = "a2a.extended_card_unavailable";
|
|
669
|
+
warning.reason = reason;
|
|
670
|
+
return warning;
|
|
671
|
+
}
|
|
672
|
+
function mergeSkillsById(base, extended) {
|
|
673
|
+
const named = new Map();
|
|
674
|
+
for (const skill of extended)
|
|
675
|
+
named.set(skill.id, skill);
|
|
676
|
+
const held = new Set(base.map((skill) => skill.id));
|
|
677
|
+
return [...base.map((skill) => named.get(skill.id) ?? skill), ...[...named.values()].filter((skill) => !held.has(skill.id))];
|
|
678
|
+
}
|
|
679
|
+
async function mergeExtendedCard(t, card, echo, signal) {
|
|
680
|
+
if (!card.extendedCard)
|
|
681
|
+
return { skills: card.skills, warnings: [] };
|
|
682
|
+
try {
|
|
683
|
+
const answered = asRecord(await jsonRpc(t, A2A_EXTENDED_CARD_METHOD, undefined, signal, A2A_CARD_TIMEOUT_MS, true));
|
|
684
|
+
if (answered === undefined) {
|
|
685
|
+
throw new A2aBadAnswer(`a2a: peer "${inlineUntrusted(t.peer, A2A_ID_MAX_CHARS)}" answered ${A2A_EXTENDED_CARD_METHOD} with a result that is not a JSON object`);
|
|
686
|
+
}
|
|
687
|
+
const merged = mergeSkillsById(card.skills, readSkills(t.peer, answered, echo));
|
|
688
|
+
assertSkillCount(t.peer, merged.length, "its extended card brings it to");
|
|
689
|
+
return { skills: merged, warnings: [] };
|
|
690
|
+
}
|
|
691
|
+
catch (err) {
|
|
692
|
+
if (signal?.aborted === true || err instanceof ProtocolRevokedRefusal)
|
|
693
|
+
throw err;
|
|
694
|
+
const detail = inlineUntrusted(thrownText(err), A2A_ERROR_TEXT_MAX_CHARS);
|
|
695
|
+
return { skills: card.skills, warnings: [extendedCardWarning(t.peer, extendedCardReasonOf(err), detail, readFailure(err, detail))] };
|
|
696
|
+
}
|
|
697
|
+
}
|
|
569
698
|
function declaredPeerOf(declared, index) {
|
|
570
699
|
let snapshot;
|
|
571
700
|
try {
|
|
@@ -577,7 +706,7 @@ function declaredPeerOf(declared, index) {
|
|
|
577
706
|
const judged = judgeEntryToolAxes(snapshot, "a2a");
|
|
578
707
|
return judged.ok ? { spec: judged.entry } : { spec: snapshot, refusal: judged.error };
|
|
579
708
|
}
|
|
580
|
-
async function materializePeer(peer, principal, lifecycle, signal, floor, seat, announceEcho) {
|
|
709
|
+
async function materializePeer(peer, principal, lifecycle, signal, floor, seat, announceEcho, revocations) {
|
|
581
710
|
if ("refusal" in peer)
|
|
582
711
|
throw peer.refusal;
|
|
583
712
|
const { spec } = peer;
|
|
@@ -589,14 +718,17 @@ async function materializePeer(peer, principal, lifecycle, signal, floor, seat,
|
|
|
589
718
|
const declared = spec.cardUrl === undefined ? [spec.url] : [spec.url, spec.cardUrl];
|
|
590
719
|
const identity = { protocol: "a2a", peer: spec.name, url: spec.url, ...(spec.cardUrl !== undefined ? { cardUrl: spec.cardUrl } : {}), destination: spec.url, ...(spec.credentials !== undefined ? { credentials: spec.credentials } : {}) };
|
|
591
720
|
const carrier = new PeerCarrier(seat, identity, principal, "a2a", spec.principalHeader !== undefined);
|
|
592
|
-
const asks = { carrier, principalHeader: spec.principalHeader, principal, declared, floor };
|
|
721
|
+
const asks = { carrier, principalHeader: spec.principalHeader, principal, declared, floor, revocations };
|
|
593
722
|
const discovery = { peer: spec.name, endpoint: spec.url, ...asks };
|
|
594
|
-
const
|
|
595
|
-
|
|
723
|
+
const echo = carrierEcho(carrier, (where) => announceEcho(spec.name, where));
|
|
724
|
+
const card = readCard(spec.name, await discoverCardBody(spec, discovery, signal), spec.url, echo);
|
|
725
|
+
const carriedAtCard = carriedBy(discovery, carrier.last ?? NO_PIECES);
|
|
726
|
+
assertEndpointBound(A2A_NAMESPACE.id, spec.name, card.endpoint, declared, carriedAtCard === undefined ? undefined : { ...carriedAtCard });
|
|
596
727
|
const transport = { peer: spec.name, endpoint: card.endpoint, ...asks };
|
|
728
|
+
const mounted = await mergeExtendedCard(transport, card, echo, signal);
|
|
597
729
|
const tools = [];
|
|
598
730
|
const skillAxes = [];
|
|
599
|
-
for (const skill of
|
|
731
|
+
for (const skill of mounted.skills) {
|
|
600
732
|
if (spec.allowSkills !== undefined && !spec.allowSkills.includes(skill.id))
|
|
601
733
|
continue;
|
|
602
734
|
const declared = declaredAxes?.[skill.id];
|
|
@@ -615,6 +747,7 @@ async function materializePeer(peer, principal, lifecycle, signal, floor, seat,
|
|
|
615
747
|
endpoint: card.endpoint,
|
|
616
748
|
toolNames: tools.map((tool) => tool.name),
|
|
617
749
|
},
|
|
750
|
+
warnings: mounted.warnings,
|
|
618
751
|
};
|
|
619
752
|
}
|
|
620
753
|
function asPeerWarning(spec, err) {
|
|
@@ -623,8 +756,10 @@ function asPeerWarning(spec, err) {
|
|
|
623
756
|
warning.code = "a2a.peer_unavailable";
|
|
624
757
|
return warning;
|
|
625
758
|
}
|
|
626
|
-
export async function materializeA2aTools(specs, principal, signal, hostFloor, given, onCredentialEchoed) {
|
|
627
|
-
|
|
759
|
+
export async function materializeA2aTools(specs, principal, signal, hostFloor, given, onCredentialEchoed, revocations) {
|
|
760
|
+
return materializeLegA2aTools(libraryRevocationProbe(revocations, "materializeA2aTools revocations"), specs, principal, signal, hostFloor, receivePeerSeat(given, "materializeA2aTools peerSeat"), onCredentialEchoed);
|
|
761
|
+
}
|
|
762
|
+
export async function materializeLegA2aTools(revocations, specs, principal, signal, hostFloor, peerSeat, onCredentialEchoed) {
|
|
628
763
|
const peers = specs.map((spec, index) => declaredPeerOf(spec, index));
|
|
629
764
|
if (peers.length > 0) {
|
|
630
765
|
const collision = findNamespacePrefixCollision(A2A_NAMESPACE, peers.map((p) => p.spec.name));
|
|
@@ -643,7 +778,7 @@ export async function materializeA2aTools(specs, principal, signal, hostFloor, g
|
|
|
643
778
|
const warnings = [];
|
|
644
779
|
const statuses = [];
|
|
645
780
|
const announceEcho = echoAnnouncer(onCredentialEchoed);
|
|
646
|
-
const settled = await Promise.allSettled(peers.map((peer) => materializePeer(peer, principal, lifecycle, signal, hostFloor, peerSeat, announceEcho)));
|
|
781
|
+
const settled = await Promise.allSettled(peers.map((peer) => materializePeer(peer, principal, lifecycle, signal, hostFloor, peerSeat, announceEcho, revocations)));
|
|
647
782
|
for (let i = 0; i < peers.length; i++) {
|
|
648
783
|
const spec = peers[i].spec;
|
|
649
784
|
const outcome = settled[i];
|
|
@@ -651,6 +786,7 @@ export async function materializeA2aTools(specs, principal, signal, hostFloor, g
|
|
|
651
786
|
tools.push(...outcome.value.tools);
|
|
652
787
|
toolAxes.push(...outcome.value.axes);
|
|
653
788
|
statuses.push(outcome.value.status);
|
|
789
|
+
warnings.push(...outcome.value.warnings);
|
|
654
790
|
}
|
|
655
791
|
else {
|
|
656
792
|
warnings.push(asPeerWarning(spec, outcome.reason));
|
|
@@ -678,7 +814,7 @@ export async function materializeA2aTools(specs, principal, signal, hostFloor, g
|
|
|
678
814
|
}
|
|
679
815
|
const previous = statuses.find((s) => s.name === spec.name)?.toolNames ?? [];
|
|
680
816
|
try {
|
|
681
|
-
const fresh = await materializePeer(target, principal, lifecycle, signal, hostFloor, peerSeat, announceEcho);
|
|
817
|
+
const fresh = await materializePeer(target, principal, lifecycle, signal, hostFloor, peerSeat, announceEcho, revocations);
|
|
682
818
|
const names = fresh.tools.map((t) => t.name);
|
|
683
819
|
results.push({
|
|
684
820
|
peer: spec.name,
|
|
@@ -689,12 +825,17 @@ export async function materializeA2aTools(specs, principal, signal, hostFloor, g
|
|
|
689
825
|
removed: previous.filter((n) => !names.includes(n)),
|
|
690
826
|
tools: fresh.tools,
|
|
691
827
|
axes: fresh.axes,
|
|
828
|
+
...(fresh.warnings.length > 0 ? { warnings: fresh.warnings } : {}),
|
|
692
829
|
});
|
|
693
830
|
const at = statuses.findIndex((s) => s.name === spec.name);
|
|
694
831
|
if (at >= 0)
|
|
695
832
|
statuses[at] = fresh.status;
|
|
696
833
|
}
|
|
697
834
|
catch (err) {
|
|
835
|
+
if (err instanceof ProtocolRevokedRefusal) {
|
|
836
|
+
results.push({ peer: spec.name, prefix, status: "revoked", toolCount: previous.length, added: [], removed: [], error: "peer revoked by the operator — the refresh did not contact it" });
|
|
837
|
+
continue;
|
|
838
|
+
}
|
|
698
839
|
results.push({
|
|
699
840
|
peer: spec.name,
|
|
700
841
|
prefix,
|
|
@@ -184,7 +184,9 @@ export interface SkillSpec {
|
|
|
184
184
|
* active) to the end of that run. A host compiles a frontmatter `hooks:` table into one such registration; the engine
|
|
185
185
|
* reads no hook grammar. Each hangs `classic.*` events only (any other event refuses the prepare, `config.mods_invalid`).
|
|
186
186
|
* They are admitted with the leg's other registrations at its prepare (so a skill never activated still counts as a hook
|
|
187
|
-
* the leg may run) and stay the leg's own: a delegated child neither dispatches them nor is screened by them.
|
|
187
|
+
* the leg may run) and stay the leg's own: a delegated child neither dispatches them nor is screened by them. The two halves of
|
|
188
|
+
* a skill's frontmatter go different ways at a delegation: a child captures the `allowed-tools` / `disallowed-tools` rows its
|
|
189
|
+
* parent holds at the spawn ({@link allowedTools}, {@link disallowedTools}) and keeps them until it ends — rows go down, hooks stay.
|
|
188
190
|
*/
|
|
189
191
|
mods?: readonly import("./mods/classic-events.js").EngineModRegistration[];
|
|
190
192
|
}
|