@sema-agent/core 7.66.1 → 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 +3483 -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 +11 -3
- package/dist/core/runner/prepare-park-ask.js +23 -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 +6 -5
- 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.67.0.json +39 -0
- package/wire-changes/core@7.67.0.json +12578 -0
- package/wire-changes/mods-kernel@7.67.0.json +167 -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
|
@@ -74,6 +74,7 @@ export const NON_GOVERNANCE_MEMORY_CODES = new Set([
|
|
|
74
74
|
"memory.settlement_resolve_unknown",
|
|
75
75
|
"memory.session_account_resolve_unattributed",
|
|
76
76
|
"memory.session_account_resolve_unknown",
|
|
77
|
+
"memory.session_account_resolve_stale",
|
|
77
78
|
"memory.hold_resolve_unattributed",
|
|
78
79
|
"memory.hold_resolve_invalid",
|
|
79
80
|
"memory.hold_resolve_unknown",
|
|
@@ -91,11 +92,13 @@ export const NON_GOVERNANCE_MEMORY_CODES = new Set([
|
|
|
91
92
|
"memory.capture_opted_out",
|
|
92
93
|
"memory.capture_optout_unpersisted",
|
|
93
94
|
"memory.capture_optout_unavailable",
|
|
95
|
+
"memory.mount_failed",
|
|
94
96
|
"memory.capture_optout_sweep_failed",
|
|
95
97
|
"memory.target_outside_store",
|
|
96
98
|
"memory.scope_home_not_directory",
|
|
97
99
|
"memory.control_plane_links_unsupported",
|
|
98
100
|
"memory.control_plane_strays",
|
|
101
|
+
"memory.store_root_sensitive",
|
|
99
102
|
"memory.root_anchor_backfilled",
|
|
100
103
|
"memory.root_reanchored",
|
|
101
104
|
]);
|
|
@@ -148,6 +151,8 @@ export const ENGINE_NOTICE_CODES = Object.freeze([
|
|
|
148
151
|
"config.execution_env_capability_invalid",
|
|
149
152
|
"config.read_deny_floor_unkept",
|
|
150
153
|
"config.read_floor_confinement_unavailable",
|
|
154
|
+
"config.inherit_env_declared_late",
|
|
155
|
+
"config.command_sandbox_unavailable",
|
|
151
156
|
"config.tool_card_undeclared",
|
|
152
157
|
"config.tool_face_undeclared",
|
|
153
158
|
"config.tool_face_invalid",
|
|
@@ -167,8 +172,12 @@ export const ENGINE_NOTICE_CODES = Object.freeze([
|
|
|
167
172
|
"permission.rule_row_dropped",
|
|
168
173
|
"config.session_rules_earlier_grammar",
|
|
169
174
|
"config.legacy_tool_name",
|
|
175
|
+
"config.toolpolicy.unmatched_names",
|
|
176
|
+
"config.agent.unknown_tool",
|
|
170
177
|
"permission.allowed_tool_not_granted",
|
|
171
178
|
"mods.registration_refused",
|
|
179
|
+
"mods.display_withheld",
|
|
180
|
+
"mods.stop_ended",
|
|
172
181
|
"peer.inbound_disposition",
|
|
173
182
|
"peer.held_settled",
|
|
174
183
|
"peer.idle_subscription",
|
|
@@ -184,9 +193,10 @@ export const ENGINE_NOTICE_CODES = Object.freeze([
|
|
|
184
193
|
"delegation.resume_lane_missing",
|
|
185
194
|
"delegation.delivery_discarded",
|
|
186
195
|
"mcp.injection_dropped",
|
|
187
|
-
"
|
|
196
|
+
"protocol.revocation_probe_failed",
|
|
188
197
|
"mcp.server_redialed",
|
|
189
198
|
"mcp.authorization_required",
|
|
199
|
+
"mcp.server_unavailable",
|
|
190
200
|
"mcp.credential_echoed",
|
|
191
201
|
"workflow.governance_key_stripped",
|
|
192
202
|
"workflow.agent_option_ignored",
|
|
@@ -220,9 +230,12 @@ export const ENGINE_NOTICE_CODES = Object.freeze([
|
|
|
220
230
|
"route.extra_body_reserved_dropped",
|
|
221
231
|
"model.capability_downgraded",
|
|
222
232
|
"model.role_defaulted",
|
|
233
|
+
"model.fallback",
|
|
223
234
|
"context.tool_turn_repaired",
|
|
224
235
|
"context.media_removed",
|
|
225
236
|
"context.tool_schema_removed",
|
|
237
|
+
"context.messages_omitted",
|
|
238
|
+
"instructions.withheld",
|
|
226
239
|
"task.user_steer_undrained",
|
|
227
240
|
"task.user_followup_undrained",
|
|
228
241
|
"steering.parked_input_blocked",
|
|
@@ -233,20 +246,26 @@ export const ENGINE_NOTICE_CODES = Object.freeze([
|
|
|
233
246
|
"task.tool_turn_incomplete",
|
|
234
247
|
"approval.read_root_granted",
|
|
235
248
|
"approval.read_root_grant_rejected",
|
|
249
|
+
"approval.approver_defect",
|
|
236
250
|
"memory.capture_opted_out",
|
|
237
251
|
"memory.capture_optout_unpersisted",
|
|
252
|
+
"memory.mount_failed",
|
|
238
253
|
"skills.listing_truncated",
|
|
239
254
|
"agents.listing_truncated",
|
|
240
255
|
"tool_result.offload_put_failed",
|
|
241
256
|
"tool_result.media_refused",
|
|
257
|
+
"tool_result.media_persisted",
|
|
242
258
|
"config.image_processor_unavailable",
|
|
243
259
|
"fs.staging_file_left",
|
|
244
260
|
"fs.staging_file_swept",
|
|
245
261
|
"session.lineage_rerooted",
|
|
246
|
-
"
|
|
262
|
+
"rewind.boundary_unrecorded",
|
|
263
|
+
"verify.verifier_is_implementer",
|
|
247
264
|
"memory.layer_locked_legacy",
|
|
248
265
|
"server.model_unreachable",
|
|
249
266
|
"permission.entry_mode_clamped",
|
|
267
|
+
"model.context_window_assumed",
|
|
268
|
+
"config.store_ephemeral",
|
|
250
269
|
]);
|
|
251
270
|
const NOTICE_AUDIENCE_TABLE = {
|
|
252
271
|
"memory.session_polluted": "user",
|
|
@@ -276,6 +295,7 @@ const NOTICE_AUDIENCE_TABLE = {
|
|
|
276
295
|
"route.credential_origin_mismatch": "user",
|
|
277
296
|
"approval.read_root_granted": "user",
|
|
278
297
|
"approval.read_root_grant_rejected": "user",
|
|
298
|
+
"approval.approver_defect": "operator",
|
|
279
299
|
"config.durable_gate_unavailable": "user",
|
|
280
300
|
"config.permission_mode_unavailable": "user",
|
|
281
301
|
"permission.ask_released_by_mode": "user",
|
|
@@ -284,10 +304,15 @@ const NOTICE_AUDIENCE_TABLE = {
|
|
|
284
304
|
"permission.rule_row_dropped": "user",
|
|
285
305
|
"config.session_rules_earlier_grammar": "user",
|
|
286
306
|
"config.legacy_tool_name": "user",
|
|
307
|
+
"config.toolpolicy.unmatched_names": "user",
|
|
308
|
+
"config.agent.unknown_tool": "user",
|
|
287
309
|
"permission.allowed_tool_not_granted": "user",
|
|
288
310
|
"mods.registration_refused": "user",
|
|
311
|
+
"mods.display_withheld": "user",
|
|
312
|
+
"mods.stop_ended": "user",
|
|
289
313
|
"memory.capture_opted_out": "user",
|
|
290
314
|
"memory.capture_optout_unpersisted": "user",
|
|
315
|
+
"memory.mount_failed": "user",
|
|
291
316
|
"memory.consolidation_withheld": "operator",
|
|
292
317
|
"delegation.ask_unresolvable": "user",
|
|
293
318
|
"inherit_env.names_withheld": "user",
|
|
@@ -309,8 +334,10 @@ const NOTICE_AUDIENCE_TABLE = {
|
|
|
309
334
|
"config.write_protection_target_view_absent": "operator",
|
|
310
335
|
"config.path_view_unresolved": "operator",
|
|
311
336
|
"config.execution_env_capability_invalid": "operator",
|
|
312
|
-
"config.read_deny_floor_unkept": "
|
|
337
|
+
"config.read_deny_floor_unkept": "user",
|
|
313
338
|
"config.read_floor_confinement_unavailable": "operator",
|
|
339
|
+
"config.inherit_env_declared_late": "operator",
|
|
340
|
+
"config.command_sandbox_unavailable": "user",
|
|
314
341
|
"config.tool_card_undeclared": "operator",
|
|
315
342
|
"config.tool_face_undeclared": "operator",
|
|
316
343
|
"config.tool_face_invalid": "operator",
|
|
@@ -328,9 +355,10 @@ const NOTICE_AUDIENCE_TABLE = {
|
|
|
328
355
|
"delegation.delivery_discarded": "operator",
|
|
329
356
|
"checkpoint.execution_outcome_unrecorded": "operator",
|
|
330
357
|
"mcp.injection_dropped": "user",
|
|
331
|
-
"
|
|
358
|
+
"protocol.revocation_probe_failed": "operator",
|
|
332
359
|
"mcp.server_redialed": "operator",
|
|
333
360
|
"mcp.authorization_required": "user",
|
|
361
|
+
"mcp.server_unavailable": "user",
|
|
334
362
|
"mcp.credential_echoed": "operator",
|
|
335
363
|
"workflow.governance_key_stripped": "operator",
|
|
336
364
|
"workflow.agent_option_ignored": "operator",
|
|
@@ -351,23 +379,30 @@ const NOTICE_AUDIENCE_TABLE = {
|
|
|
351
379
|
"route.tool_call_id_folded": "operator",
|
|
352
380
|
"route.extra_body_reserved_dropped": "operator",
|
|
353
381
|
"model.capability_downgraded": "user",
|
|
354
|
-
"model.role_defaulted": "
|
|
382
|
+
"model.role_defaulted": "user",
|
|
383
|
+
"model.fallback": "user",
|
|
355
384
|
"context.tool_turn_repaired": "operator",
|
|
356
385
|
"context.media_removed": "user",
|
|
357
386
|
"context.tool_schema_removed": "user",
|
|
387
|
+
"context.messages_omitted": "user",
|
|
388
|
+
"instructions.withheld": "user",
|
|
358
389
|
"skills.listing_truncated": "operator",
|
|
359
390
|
"agents.listing_truncated": "operator",
|
|
360
391
|
"tool_result.offload_put_failed": "operator",
|
|
361
392
|
"tool_result.media_refused": "operator",
|
|
393
|
+
"tool_result.media_persisted": "operator",
|
|
362
394
|
"config.image_processor_unavailable": "operator",
|
|
363
395
|
"fs.staging_file_left": "operator",
|
|
364
396
|
"fs.staging_file_swept": "operator",
|
|
365
397
|
"session.lineage_rerooted": "user",
|
|
398
|
+
"rewind.boundary_unrecorded": "user",
|
|
399
|
+
"verify.verifier_is_implementer": "user",
|
|
366
400
|
"config.forward_sink_failed": "operator",
|
|
367
|
-
"instructions.source_changed": "user",
|
|
368
401
|
"server.model_unreachable": "user",
|
|
369
402
|
"permission.entry_mode_clamped": "user",
|
|
403
|
+
"model.context_window_assumed": "user",
|
|
370
404
|
"memory.layer_locked_legacy": "operator",
|
|
405
|
+
"config.store_ephemeral": "user",
|
|
371
406
|
};
|
|
372
407
|
export const NOTICE_AUDIENCE = NOTICE_AUDIENCE_TABLE;
|
|
373
408
|
export function noticeAudienceOf(code) {
|
|
@@ -394,6 +429,8 @@ const NOTICE_MINTER_TABLE = {
|
|
|
394
429
|
"config.execution_env_capability_invalid": "engine",
|
|
395
430
|
"config.read_deny_floor_unkept": "engine",
|
|
396
431
|
"config.read_floor_confinement_unavailable": "engine",
|
|
432
|
+
"config.inherit_env_declared_late": "engine",
|
|
433
|
+
"config.command_sandbox_unavailable": "engine",
|
|
397
434
|
"config.tool_card_undeclared": "engine",
|
|
398
435
|
"config.tool_face_undeclared": "engine",
|
|
399
436
|
"config.tool_face_invalid": "engine",
|
|
@@ -413,8 +450,12 @@ const NOTICE_MINTER_TABLE = {
|
|
|
413
450
|
"permission.rule_row_dropped": "engine",
|
|
414
451
|
"config.session_rules_earlier_grammar": "engine",
|
|
415
452
|
"config.legacy_tool_name": "engine",
|
|
453
|
+
"config.toolpolicy.unmatched_names": "engine",
|
|
454
|
+
"config.agent.unknown_tool": "engine",
|
|
416
455
|
"permission.allowed_tool_not_granted": "engine",
|
|
417
456
|
"mods.registration_refused": "engine",
|
|
457
|
+
"mods.display_withheld": "engine",
|
|
458
|
+
"mods.stop_ended": "engine",
|
|
418
459
|
"peer.inbound_disposition": "engine",
|
|
419
460
|
"peer.held_settled": "engine",
|
|
420
461
|
"peer.idle_subscription": "engine",
|
|
@@ -430,9 +471,10 @@ const NOTICE_MINTER_TABLE = {
|
|
|
430
471
|
"delegation.resume_lane_missing": "engine",
|
|
431
472
|
"delegation.delivery_discarded": "engine",
|
|
432
473
|
"mcp.injection_dropped": "engine",
|
|
433
|
-
"
|
|
474
|
+
"protocol.revocation_probe_failed": "engine",
|
|
434
475
|
"mcp.server_redialed": "engine",
|
|
435
476
|
"mcp.authorization_required": "engine",
|
|
477
|
+
"mcp.server_unavailable": "engine",
|
|
436
478
|
"mcp.credential_echoed": "engine",
|
|
437
479
|
"workflow.governance_key_stripped": "engine",
|
|
438
480
|
"workflow.agent_option_ignored": "engine",
|
|
@@ -466,9 +508,12 @@ const NOTICE_MINTER_TABLE = {
|
|
|
466
508
|
"route.extra_body_reserved_dropped": "engine",
|
|
467
509
|
"model.capability_downgraded": "engine",
|
|
468
510
|
"model.role_defaulted": "engine",
|
|
511
|
+
"model.fallback": "engine",
|
|
469
512
|
"context.tool_turn_repaired": "engine",
|
|
470
513
|
"context.media_removed": "engine",
|
|
471
514
|
"context.tool_schema_removed": "engine",
|
|
515
|
+
"context.messages_omitted": "engine",
|
|
516
|
+
"instructions.withheld": "engine",
|
|
472
517
|
"task.user_steer_undrained": "engine",
|
|
473
518
|
"task.user_followup_undrained": "engine",
|
|
474
519
|
"steering.parked_input_blocked": "engine",
|
|
@@ -479,19 +524,25 @@ const NOTICE_MINTER_TABLE = {
|
|
|
479
524
|
"task.tool_turn_incomplete": "engine",
|
|
480
525
|
"approval.read_root_granted": "engine",
|
|
481
526
|
"approval.read_root_grant_rejected": "engine",
|
|
527
|
+
"approval.approver_defect": "engine",
|
|
482
528
|
"memory.capture_opted_out": "engine",
|
|
483
529
|
"memory.capture_optout_unpersisted": "engine",
|
|
530
|
+
"memory.mount_failed": "engine",
|
|
484
531
|
"skills.listing_truncated": "engine",
|
|
485
532
|
"agents.listing_truncated": "engine",
|
|
486
533
|
"tool_result.offload_put_failed": "engine",
|
|
487
534
|
"tool_result.media_refused": "engine",
|
|
535
|
+
"tool_result.media_persisted": "engine",
|
|
488
536
|
"config.image_processor_unavailable": "engine",
|
|
489
537
|
"fs.staging_file_left": "engine",
|
|
490
538
|
"fs.staging_file_swept": "engine",
|
|
491
539
|
"session.lineage_rerooted": "engine",
|
|
492
|
-
"
|
|
540
|
+
"rewind.boundary_unrecorded": "engine",
|
|
541
|
+
"verify.verifier_is_implementer": "engine",
|
|
493
542
|
"memory.layer_locked_legacy": "server",
|
|
494
543
|
"server.model_unreachable": "server",
|
|
495
544
|
"permission.entry_mode_clamped": "server",
|
|
545
|
+
"model.context_window_assumed": "server",
|
|
546
|
+
"config.store_ephemeral": "server",
|
|
496
547
|
};
|
|
497
548
|
export const NOTICE_MINTER = Object.freeze(NOTICE_MINTER_TABLE);
|
|
@@ -2,18 +2,22 @@
|
|
|
2
2
|
* design/138 S2-C — the hands band's write-time CONTENT hook (single source; `src/tools/fs` re-exports
|
|
3
3
|
* these so its import surface is unchanged — moved here by design/141 件2 because `RunnerDeps.hands`
|
|
4
4
|
* carries the deployment-composable half of the hook). Called before EVERY `env.writeFile` in
|
|
5
|
-
* Write/Edit/NotebookEdit with the resolved containment key and the exact final
|
|
5
|
+
* Write/Edit/NotebookEdit/SaveToolResult with the resolved containment key and the exact final content; `{ ok:false }`
|
|
6
6
|
* fails the tool with a structured error and NOTHING is written. A THROWING hook fails CLOSED.
|
|
7
7
|
*/
|
|
8
8
|
export interface BeforeWriteRequest {
|
|
9
|
-
tool:
|
|
9
|
+
tool: HandsWriteTool;
|
|
10
10
|
/** The model-supplied path argument (for the error-message coordinate the model knows). */
|
|
11
11
|
path: string;
|
|
12
12
|
/** The resolved canonical containment key — what the hook should judge. */
|
|
13
13
|
key: string;
|
|
14
|
-
/** The FINAL full
|
|
15
|
-
|
|
14
|
+
/** The FINAL full content about to be written: text (Write; Edit/NotebookEdit after application), or the bytes a tool result
|
|
15
|
+
* kept (SaveToolResult) — the bytes themselves, so a gate that judges content judges what lands. */
|
|
16
|
+
content: string | Uint8Array;
|
|
16
17
|
}
|
|
18
|
+
/** The tools whose writes pass the hands band's three hooks — the one closed set {@link BeforeWriteRequest},
|
|
19
|
+
* {@link TrackEditRequest} and {@link FileEditedNotice} name. */
|
|
20
|
+
export type HandsWriteTool = "Write" | "Edit" | "NotebookEdit" | "SaveToolResult";
|
|
17
21
|
export type BeforeWriteResult = {
|
|
18
22
|
ok: true;
|
|
19
23
|
} | {
|
|
@@ -35,7 +39,7 @@ export type BeforeWriteHook = (req: BeforeWriteRequest) => BeforeWriteResult | u
|
|
|
35
39
|
* behavior (no history store wired).
|
|
36
40
|
*/
|
|
37
41
|
export interface TrackEditRequest {
|
|
38
|
-
tool:
|
|
42
|
+
tool: HandsWriteTool;
|
|
39
43
|
/** The model-supplied path argument (for the error-message coordinate the model knows). */
|
|
40
44
|
path: string;
|
|
41
45
|
/** The resolved canonical containment key — the identity the history record is keyed on. */
|
|
@@ -85,7 +89,7 @@ export type TrackFileEditHook = (req: TrackEditRequest) => Promise<TrackEditResu
|
|
|
85
89
|
* answer, nor delay one.
|
|
86
90
|
*/
|
|
87
91
|
export interface FileEditedNotice {
|
|
88
|
-
tool:
|
|
92
|
+
tool: HandsWriteTool;
|
|
89
93
|
/** The model-supplied path argument — the SAME coordinate the delegated-child projection's
|
|
90
94
|
* `SubagentEditedFile.path` carries, so the two seats can be read side by side. */
|
|
91
95
|
path: string;
|
package/dist/core/hooks.d.ts
CHANGED
|
@@ -121,9 +121,12 @@ export interface UserPromptSubmitEvent extends ClassicEventBase {
|
|
|
121
121
|
* (a wake resume's message, screened pre-claim), `"parked_redelivery"` (a parked steer re-screened on the CURRENT
|
|
122
122
|
* process when any resume kind that drains parked steers redelivers it). ⚠️ DOUBLE ARRIVAL IS CONTRACTUAL: one input
|
|
123
123
|
* can arrive twice (screened live as `"steer"`, parked, re-screened as `"parked_redelivery"`) — idempotency is the
|
|
124
|
-
* handler's, keyed on {@link inputId}. `"followUp"` is a RESERVED spelling: no entrance carries it yet.
|
|
124
|
+
* handler's, keyed on {@link inputId}. `"followUp"` is a RESERVED spelling: no entrance carries it yet. `"system"` names an
|
|
125
|
+
* input whose sender said it wrote the text itself (the steer verb's `source: "system"`, a shell's own injection), at
|
|
126
|
+
* whichever entrance it is screened — live, parked redelivery, or a wake's message — so a deployment that exempts such
|
|
127
|
+
* inputs branches on this one value; its double arrival is `"system"` twice, keyed on {@link inputId} like the others.
|
|
125
128
|
*/
|
|
126
|
-
readonly source: "objective" | "steer" | "resume_message" | "followUp" | "parked_redelivery";
|
|
129
|
+
readonly source: "objective" | "steer" | "resume_message" | "followUp" | "parked_redelivery" | "system";
|
|
127
130
|
/**
|
|
128
131
|
* The screened input's correlation id — present on every entrance but the objective (no id exists there; nothing is
|
|
129
132
|
* fabricated): the steer's effective id, the parked entry's stored id, or the wake message's id (the caller's, else
|
|
@@ -171,7 +174,7 @@ export interface SubagentStartResult {
|
|
|
171
174
|
/**
|
|
172
175
|
* `classic.Stop`'s `e` — raised when the agent WOULD OTHERWISE END its run (no more tool calls, steering and follow-up
|
|
173
176
|
* queues dry). Answer: {@link StopHookResult}; `{ block }` pushes back (the reason is injected and the run continues one
|
|
174
|
-
* more turn). Guardrails (CC-exact): consecutive push-backs are capped (default 8 — the loop then overrides and ends with
|
|
177
|
+
* more turn), `{ end }` closes the stop point. Guardrails (CC-exact): consecutive push-backs are capped (default 8 — the loop then overrides and ends with
|
|
175
178
|
* a warning); `stopHookActive` is true while the run is already continuing because of one. `maxTurns` outranks it.
|
|
176
179
|
*/
|
|
177
180
|
export interface StopEvent extends ClassicEventBase {
|
|
@@ -205,6 +208,36 @@ export interface StopFailureEvent extends ClassicEventBase {
|
|
|
205
208
|
/** Turns completed when the failure ended the run. */
|
|
206
209
|
readonly turns: number;
|
|
207
210
|
}
|
|
211
|
+
/**
|
|
212
|
+
* `classic.MessageDisplay`'s `e` — raised on a top-level leg once per WINDOW of an assistant message's streamed text: what has
|
|
213
|
+
* settled since the previous window (to the last sentence end or line end, whichever is later; a text block's close is a hard
|
|
214
|
+
* edge), and at the message's end exactly once a `final` window holding what is left (possibly nothing). A message that streamed
|
|
215
|
+
* no text raises none; a message whose text arrives whole (an answer given before the model was asked) raises one, its `final`
|
|
216
|
+
* window, at its end. Pinned: `messageId`, `turn`, `index`, `final`, `agentId`. Answer: {@link MessageDisplayResult}. The
|
|
217
|
+
* windows of a message, joined in `index` order, are its streamed text; the stored message and what the model sees are not the
|
|
218
|
+
* display and are never changed by it.
|
|
219
|
+
*/
|
|
220
|
+
export interface MessageDisplayEvent extends ClassicEventBase {
|
|
221
|
+
/** The message's own id, the same on each of its windows (minted when it starts streaming). */
|
|
222
|
+
readonly messageId: string;
|
|
223
|
+
/** The model turn the message belongs to (the leg's turns that closed before it, plus one). */
|
|
224
|
+
readonly turn: number;
|
|
225
|
+
/** The window's place in the message, from 0. */
|
|
226
|
+
readonly index: number;
|
|
227
|
+
/** The message's last window — exactly once per message. */
|
|
228
|
+
readonly final: boolean;
|
|
229
|
+
/** The window's text, as it streamed. */
|
|
230
|
+
readonly delta: string;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* A `classic.MessageDisplay` answer: `displayContent` replaces what this window shows (`""` shows nothing of it); absent, the
|
|
234
|
+
* window shows its `delta`. A text held back from one window is shown by answering it in a later one (the `final` window is
|
|
235
|
+
* always raised for a message that streamed text). Nothing else is read: an answer with any other member is refused, and a refused
|
|
236
|
+
* answer — like a handler that throws or is late — is skipped, and the window shows what the others left of it (the model's text).
|
|
237
|
+
*/
|
|
238
|
+
export interface MessageDisplayResult {
|
|
239
|
+
readonly displayContent?: string;
|
|
240
|
+
}
|
|
208
241
|
/** `classic.SessionStart`'s `e` — raised once per leg, in the bottom of `session.start` (the leg is prepared, its first model
|
|
209
242
|
* request not yet made). Observe-only. */
|
|
210
243
|
export interface SessionStartEvent extends ClassicEventBase {
|
|
@@ -324,8 +357,20 @@ export interface PostCompactContext {
|
|
|
324
357
|
* this pass's `compacted` frame carries. Absent ⇒ the post measurement failed. */
|
|
325
358
|
freedTokens?: number;
|
|
326
359
|
}
|
|
327
|
-
/**
|
|
360
|
+
/**
|
|
361
|
+
* A Stop hook result: push the run back from ending with a model-readable reason (`block`, `additionalContext`), or ask
|
|
362
|
+
* that this stop point end (`end`). Each seat is judged in its own pass; the seat-level rule and the fold are
|
|
363
|
+
* `mergeStopAnswers` (stop-answers.ts).
|
|
364
|
+
*/
|
|
328
365
|
export interface StopHookResult {
|
|
366
|
+
/**
|
|
367
|
+
* Ask that this stop point end: the run does not continue for this answer, and the reason (empty allowed) is shown to
|
|
368
|
+
* the user in the `mods.stop_ended` notice, never to the model. `end` wins over the answer's other members — a `block`
|
|
369
|
+
* or an `additionalContext` written beside it is dropped. It closes this stop point only: a continuation owed for
|
|
370
|
+
* another reason (a one-shot submission's undelivered background results, the engine's own verification push-back) is
|
|
371
|
+
* not cancelled, and the next natural stop point asks again. A non-string `end` is an answer the station refuses.
|
|
372
|
+
*/
|
|
373
|
+
end?: string;
|
|
329
374
|
/** When set, the run does NOT end: this reason is injected (as a `<system-reminder>`) and the
|
|
330
375
|
* model gets another turn to address it. */
|
|
331
376
|
block?: string;
|
|
@@ -1404,12 +1449,19 @@ export interface AskCarry {
|
|
|
1404
1449
|
/** The surviving ask's askers' entries ({@link import("./tool-policy.js").AskRequest.askReasons}), for the row's twin — the
|
|
1405
1450
|
* same value the synchronous card carries. */
|
|
1406
1451
|
readonly askReasons?: readonly import("./ask-origin.js").AskReason[];
|
|
1452
|
+
/** The card's question as the synchronous card shows it ({@link import("./tool-policy.js").AskRequest.message}: the
|
|
1453
|
+
* decision's sentence, or the shared fallback, with the allow-shadow account rendered onto it), for the row's twin. */
|
|
1454
|
+
readonly cardMessage?: string;
|
|
1455
|
+
/** The written ask rule the card stands for ({@link import("./tool-policy.js").AskRequest.matchedAskRule}), off the same
|
|
1456
|
+
* disclosure mint as {@link cardMessage}, for the row's twin. */
|
|
1457
|
+
readonly cardAskRule?: string;
|
|
1407
1458
|
}
|
|
1408
1459
|
/** What a durable row persists of an {@link AskCarry}: the fallback member COPIED (the row never aliases
|
|
1409
1460
|
* the gate's object; its window is already `0` — the gate's carry mint is the one writer of that
|
|
1410
1461
|
* number), the origin word only when it is a member of the closed set, the class pair and the askers' entries only when
|
|
1411
|
-
* well-formed, as fresh copies
|
|
1412
|
-
* the
|
|
1462
|
+
* well-formed, as fresh copies, the card's question through the approval-display reading (sanitized, size-bounded) and
|
|
1463
|
+
* the written ask rule as written (a non-empty string or nothing) — the carry is typed, but the row is the boundary a
|
|
1464
|
+
* host reads back through, the same screen the summary applies to the word. */
|
|
1413
1465
|
export declare function askCarryRowMembers(carry: AskCarry | undefined): {
|
|
1414
1466
|
denialLimitFallback?: import("./auto-mode.js").DenialLimitFallback;
|
|
1415
1467
|
classifierNoRuling?: import("./auto-mode.js").AutoModeFallbackCause;
|
|
@@ -1417,6 +1469,8 @@ export declare function askCarryRowMembers(carry: AskCarry | undefined): {
|
|
|
1417
1469
|
askClass?: import("./ask-origin.js").AskClass;
|
|
1418
1470
|
classes?: readonly import("./ask-origin.js").AskClass[];
|
|
1419
1471
|
askReasons?: readonly import("./ask-origin.js").AskReason[];
|
|
1472
|
+
cardMessage?: string;
|
|
1473
|
+
cardAskRule?: string;
|
|
1420
1474
|
};
|
|
1421
1475
|
/**
|
|
1422
1476
|
* The design/37 **two-phase tool gate** — the single chokepoint that makes the load-bearing invariant
|
package/dist/core/hooks.js
CHANGED
|
@@ -10,6 +10,7 @@ export { normalizeOrgGateVerdict, normalizePersistedRuleHit } from "./rule-lane-
|
|
|
10
10
|
import { hookAskReasonOf, isAskOrigin, receiveAskReasons, screenAskClassMembers } from "./ask-origin.js";
|
|
11
11
|
import { isAutoModeFallbackCause } from "./auto-mode.js";
|
|
12
12
|
import { inlineUntrusted } from "./untrusted-text.js";
|
|
13
|
+
import { approvalMessageOf } from "./approval-display.js";
|
|
13
14
|
export { formatHookFeedback } from "./reminder-mint.js";
|
|
14
15
|
import { createSafeNotifier } from "./safe-notify.js";
|
|
15
16
|
import { wireOf } from "./tool-name-readings.js";
|
|
@@ -215,12 +216,15 @@ export function createPreToolUseScreening(input, readSettled = (decision) => ({
|
|
|
215
216
|
}
|
|
216
217
|
allowedBy.delete(i);
|
|
217
218
|
floated.delete(i);
|
|
218
|
-
|
|
219
|
+
const call = Object.freeze({ toolName, toolCallId, args: bytes, ...(as.face !== undefined ? { face: as.face } : {}) });
|
|
220
|
+
const standing = verdict?.action !== "ask" ? seat.installation.standing?.(call) : undefined;
|
|
221
|
+
if (standing !== undefined)
|
|
222
|
+
floated.set(i, standing);
|
|
223
|
+
else if (verdict?.action === "allow" && r.answeredBy !== undefined)
|
|
219
224
|
allowedBy.set(i, r.answeredBy);
|
|
220
225
|
if (verdict?.action !== "ask")
|
|
221
226
|
return undefined;
|
|
222
227
|
const ask = { action: "ask", message: decisionText(verdict) ?? `approval required for "${toolName}" (an inherited PreToolUse hook)`, decisionReason: "hook", ...(verdict.requiresRealApproval === true ? { requiresRealApproval: true } : {}), ...(verdict.askReasons !== undefined ? { askReasons: verdict.askReasons } : {}) };
|
|
223
|
-
const call = Object.freeze({ toolName, toolCallId, args: bytes, ...(as.face !== undefined ? { face: as.face } : {}) });
|
|
224
228
|
const settled = readSettled(await seat.installation.settle(ask, call, signal));
|
|
225
229
|
if (settled.decision.action === "deny")
|
|
226
230
|
return settledScreen(settled, judgedOf());
|
|
@@ -247,12 +251,16 @@ export function askCarryRowMembers(carry) {
|
|
|
247
251
|
const why = carry.classifierNoRuling;
|
|
248
252
|
const classed = screenAskClassMembers(carry.askClass, carry.classes);
|
|
249
253
|
const askReasons = receiveAskReasons(carry.askReasons);
|
|
254
|
+
const cardMessage = approvalMessageOf(carry.cardMessage);
|
|
255
|
+
const rule = carry.cardAskRule;
|
|
250
256
|
return {
|
|
251
257
|
...(carry.denialLimitFallback !== undefined ? { denialLimitFallback: { ...carry.denialLimitFallback } } : {}),
|
|
252
258
|
...(isAutoModeFallbackCause(why) ? { classifierNoRuling: why } : {}),
|
|
253
259
|
...(isAskOrigin(origin) ? { origin } : {}),
|
|
254
260
|
...(classed !== undefined ? classed : {}),
|
|
255
261
|
...(askReasons !== undefined ? { askReasons } : {}),
|
|
262
|
+
...(cardMessage !== undefined ? { cardMessage } : {}),
|
|
263
|
+
...(typeof rule === "string" && rule.length > 0 ? { cardAskRule: rule } : {}),
|
|
256
264
|
};
|
|
257
265
|
}
|
|
258
266
|
export async function runToolGate(input) {
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
import { type HostReading } from "./host-target.js";
|
|
2
2
|
import type { ToolPolicy } from "./tool-policy.js";
|
|
3
3
|
/**
|
|
4
|
-
* Is this host
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
4
|
+
* Is this host the machine itself — `localhost`, 127/8, `::1`, or an IPv4-mapped (`::ffff:`) literal of 127/8? The ONE loopback reading:
|
|
5
|
+
* the private-network floor's ({@link isPrivateHost}) and the plain-http exemption of a protocol send's pieces
|
|
6
|
+
* (`assertEndpointBound`, protocol-http-auth.ts). Reads the LITERAL host as `URL` normalizes it (no DNS: a name other than `localhost`
|
|
7
|
+
* is not loopback, whatever it resolves to). `0.0.0.0` and `::` (unspecified) are not, and neither is a NAT64 literal (`64:ff9b::/96`):
|
|
8
|
+
* it is sent to a translator, another machine, whatever v4 address it embeds (the floor still reads it private).
|
|
9
|
+
*/
|
|
10
|
+
export declare function isLoopbackHost(host: string): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Is this host obviously internal — loopback ({@link isLoopbackHost}) / private ranges / link-local incl. cloud metadata / CGNAT /
|
|
13
|
+
* IPv6 ULA, site-local, unspecified, IPv4-mapped, NAT64? Classifies with `net.isIP` rather than a string-prefix regex (a prefix regex
|
|
14
|
+
* both under-matches — `::ffff:`, NAT64, CGNAT, `::` — and over-matches any DNS name starting `fc`/`fd`). Numeric IPv4 forms
|
|
15
|
+
* (decimal/octal/hex) are normalized to dotted-decimal by `URL` before this is called. Checks the LITERAL host: it does NOT resolve
|
|
16
|
+
* DNS, so a name that resolves to a private address is not caught here (a connection-layer concern).
|
|
9
17
|
*/
|
|
10
18
|
export declare function isPrivateHost(host: string): boolean;
|
|
11
19
|
/**
|
|
@@ -86,10 +94,15 @@ export declare const HOST_FLOOR_REFUSED_CODE = "config.host_floor_refused";
|
|
|
86
94
|
export declare function peerRequestRefusal(what: string, url: URL, floor: HostFloor | undefined): (Error & {
|
|
87
95
|
code: string;
|
|
88
96
|
}) | undefined;
|
|
97
|
+
/** A hop judge's refusal: its sentence, or its sentence and the code the request is refused with when that is not the host floor's. */
|
|
98
|
+
export type HopRefused = string | {
|
|
99
|
+
readonly reason: string;
|
|
100
|
+
readonly code: string;
|
|
101
|
+
};
|
|
89
102
|
/** How a transport follows redirects: its hop judge, whether it takes a judged redirect, and its hop budget. */
|
|
90
103
|
export interface FollowLaw {
|
|
91
|
-
/** The hop judge (each transport binds {@link hopRefusal} to its floor and its private-network posture). */
|
|
92
|
-
readonly refusal: (url: URL) =>
|
|
104
|
+
/** The hop judge (each transport binds {@link hopRefusal} to its floor and its private-network posture; A2A asks the revocation ledger first). */
|
|
105
|
+
readonly refusal: (url: URL) => HopRefused | undefined;
|
|
93
106
|
/** Whether a redirect the judge admitted is followed (else it is handed back as `unfollowed`). */
|
|
94
107
|
readonly follows: (from: URL, to: URL) => boolean;
|
|
95
108
|
/** Redirects followed at most (the request after the last one is refused as `too_many`). */
|
|
@@ -97,13 +110,16 @@ export interface FollowLaw {
|
|
|
97
110
|
/** Every hop's response, 3xx included, as it arrives. */
|
|
98
111
|
readonly onResponse?: (res: Response) => void;
|
|
99
112
|
}
|
|
100
|
-
/** One request's outcome under a {@link FollowLaw}.
|
|
113
|
+
/** One request's outcome under a {@link FollowLaw}. A `refused` outcome says whether an earlier hop of the request was already sent
|
|
114
|
+
* (`afterSentHop`: the refusal stopped a redirect, not the request — what that earlier hop did is the peer's). */
|
|
101
115
|
export type FollowOutcome = {
|
|
102
116
|
readonly kind: "answered";
|
|
103
117
|
readonly res: Response;
|
|
104
118
|
} | {
|
|
105
119
|
readonly kind: "refused";
|
|
106
120
|
readonly reason: string;
|
|
121
|
+
readonly code?: string;
|
|
122
|
+
readonly afterSentHop: boolean;
|
|
107
123
|
} | {
|
|
108
124
|
readonly kind: "unfollowed";
|
|
109
125
|
readonly res: Response;
|
package/dist/core/host-floor.js
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
import { isIP } from "node:net";
|
|
2
2
|
import { HOST_UNREADABLE_SENTENCE, callHostTargetOf, hostOfUrl, hostPatternAdmits, readHostPattern, spelledHostPattern } from "./host-target.js";
|
|
3
3
|
import { inlineUntrusted } from "./untrusted-text.js";
|
|
4
|
+
import { callerText } from "./caller-text.js";
|
|
5
|
+
import { codedRefusal } from "./thrown-value.js";
|
|
4
6
|
import { describeFault, isPlainRecord, receive } from "./mods/kernel/receive.js";
|
|
5
7
|
import { DECLARATION_RECEIPT_MODE, optionKeys, refuseStrayMembers } from "./own-property-receipt.js";
|
|
6
|
-
function
|
|
8
|
+
function v4Octets(ip) {
|
|
7
9
|
const o = ip.split(".").map(Number);
|
|
8
|
-
|
|
10
|
+
return o.length === 4 && o.every((n) => Number.isInteger(n) && n >= 0 && n <= 255) ? o : undefined;
|
|
11
|
+
}
|
|
12
|
+
const isLoopbackV4 = (ip) => v4Octets(ip)?.[0] === 127;
|
|
13
|
+
function isPrivateV4(ip) {
|
|
14
|
+
const o = v4Octets(ip);
|
|
15
|
+
if (o === undefined)
|
|
9
16
|
return true;
|
|
10
17
|
const [a = -1, b = -1] = o;
|
|
11
|
-
return (
|
|
18
|
+
return (isLoopbackV4(ip) ||
|
|
12
19
|
a === 10 ||
|
|
13
20
|
a === 0 ||
|
|
14
21
|
(a === 172 && b >= 16 && b <= 31) ||
|
|
@@ -28,14 +35,33 @@ function embeddedV4(h) {
|
|
|
28
35
|
const [, hi, lo] = m ?? [];
|
|
29
36
|
return hi !== undefined && lo !== undefined ? fromHex(hi, lo) : undefined;
|
|
30
37
|
}
|
|
31
|
-
|
|
32
|
-
|
|
38
|
+
function literalHost(host) {
|
|
39
|
+
return host
|
|
33
40
|
.replace(/^\[|\]$/g, "")
|
|
34
41
|
.replace(/\.+$/, "")
|
|
35
42
|
.toLowerCase();
|
|
43
|
+
}
|
|
44
|
+
export function isLoopbackHost(host) {
|
|
45
|
+
const h = literalHost(host);
|
|
36
46
|
if (h === "localhost")
|
|
37
47
|
return true;
|
|
38
48
|
const fam = isIP(h);
|
|
49
|
+
if (fam === 4)
|
|
50
|
+
return isLoopbackV4(h);
|
|
51
|
+
if (fam !== 6)
|
|
52
|
+
return false;
|
|
53
|
+
if (h === "::1")
|
|
54
|
+
return true;
|
|
55
|
+
if (!h.startsWith("::ffff:"))
|
|
56
|
+
return false;
|
|
57
|
+
const v4 = embeddedV4(h);
|
|
58
|
+
return v4 !== undefined && isLoopbackV4(v4);
|
|
59
|
+
}
|
|
60
|
+
export function isPrivateHost(host) {
|
|
61
|
+
if (isLoopbackHost(host))
|
|
62
|
+
return true;
|
|
63
|
+
const h = literalHost(host);
|
|
64
|
+
const fam = isIP(h);
|
|
39
65
|
if (fam === 0)
|
|
40
66
|
return false;
|
|
41
67
|
if (fam === 4)
|
|
@@ -43,7 +69,7 @@ export function isPrivateHost(host) {
|
|
|
43
69
|
const v4 = embeddedV4(h);
|
|
44
70
|
if (v4)
|
|
45
71
|
return isPrivateV4(v4);
|
|
46
|
-
if (h === "::
|
|
72
|
+
if (h === "::")
|
|
47
73
|
return true;
|
|
48
74
|
return /^fe[89ab]/.test(h) || /^f[cd]/.test(h) || /^fe[c-f]/.test(h);
|
|
49
75
|
}
|
|
@@ -70,7 +96,7 @@ function readEntries(value, member) {
|
|
|
70
96
|
: read.problem === "below_address" ? "names hosts below an address, which has none"
|
|
71
97
|
: read.problem === "empty_label" ? "names a host with an empty label (a leading or doubled dot) — write the host itself, and every host below a domain as `*.<domain>`"
|
|
72
98
|
: "is more or less than a host (a scheme, a port, a path, credentials or whitespace)";
|
|
73
|
-
throw floorInvalid(`.${member}[${i}]
|
|
99
|
+
throw floorInvalid(`.${member}[${i}] ${callerText(entry)} ${why}`);
|
|
74
100
|
}
|
|
75
101
|
patterns.push(read.pattern);
|
|
76
102
|
}
|
|
@@ -95,13 +121,13 @@ export function compileHostFloor(declared) {
|
|
|
95
121
|
return undefined;
|
|
96
122
|
if (!isPlainRecord(value))
|
|
97
123
|
throw floorInvalid(`must be a record { deny?, only? } (got ${value === null ? "null" : Array.isArray(value) ? "a list" : typeof value})`);
|
|
98
|
-
refuseStrayMembers(value, { subject: "RunnerDeps.hostFloor", unit: "member", moment: "when the floor is compiled" }, FLOOR_KEYS, (_, [stray]) => floorInvalid(`has a member
|
|
124
|
+
refuseStrayMembers(value, { subject: "RunnerDeps.hostFloor", unit: "member", moment: "when the floor is compiled" }, FLOOR_KEYS, (_, [stray]) => floorInvalid(`has a member ${callerText(stray)} — its members are \`deny\` and \`only\``));
|
|
99
125
|
const deny = readEntries(value.deny, "deny") ?? [];
|
|
100
126
|
const only = readEntries(value.only, "only");
|
|
101
|
-
for (const o of only ?? []) {
|
|
102
|
-
const
|
|
103
|
-
if (
|
|
104
|
-
throw floorInvalid(`.only
|
|
127
|
+
for (const [oi, o] of (only ?? []).entries()) {
|
|
128
|
+
const di = deny.findIndex((candidate) => covers(candidate, o));
|
|
129
|
+
if (di !== -1)
|
|
130
|
+
throw floorInvalid(`.only[${oi}] is wholly denied by .deny[${di}] — it could never admit a host`);
|
|
105
131
|
}
|
|
106
132
|
const reach = (host) => deny.some((d) => hostPatternAdmits(d, host)) ? "denied" : only !== undefined && !only.some((o) => hostPatternAdmits(o, host)) ? "outside_only" : "admitted";
|
|
107
133
|
return Object.freeze({
|
|
@@ -146,7 +172,10 @@ export function hopRefusal(url, floor, privateFloor) {
|
|
|
146
172
|
export const HOST_FLOOR_REFUSED_CODE = "config.host_floor_refused";
|
|
147
173
|
export function peerRequestRefusal(what, url, floor) {
|
|
148
174
|
const reason = hopRefusal(url, floor, false);
|
|
149
|
-
return reason === undefined ? undefined :
|
|
175
|
+
return reason === undefined ? undefined : codedRefusal(HOST_FLOOR_REFUSED_CODE, `${what} is not contacted — ${reason}`);
|
|
176
|
+
}
|
|
177
|
+
function refusedHop(refused, afterSentHop) {
|
|
178
|
+
return typeof refused === "string" ? { kind: "refused", reason: refused, afterSentHop } : { kind: "refused", reason: refused.reason, code: refused.code, afterSentHop };
|
|
150
179
|
}
|
|
151
180
|
const REDIRECT_STATUSES = new Set([301, 302, 303, 307, 308]);
|
|
152
181
|
function release(res) {
|
|
@@ -167,7 +196,7 @@ export async function fetchFollowing(doFetch, start, init, law) {
|
|
|
167
196
|
for (let hop = 0; hop <= law.maxRedirects; hop++) {
|
|
168
197
|
const refused = law.refusal(current);
|
|
169
198
|
if (refused !== undefined)
|
|
170
|
-
return
|
|
199
|
+
return refusedHop(refused, hop > 0);
|
|
171
200
|
const res = await doFetch(current.toString(), {
|
|
172
201
|
method: hopInit.method,
|
|
173
202
|
headers: hopInit.headers,
|
|
@@ -187,12 +216,12 @@ export async function fetchFollowing(doFetch, start, init, law) {
|
|
|
187
216
|
}
|
|
188
217
|
catch {
|
|
189
218
|
release(res);
|
|
190
|
-
return { kind: "refused", reason: `invalid redirect Location: ${inlineUntrusted(location, 200)}
|
|
219
|
+
return { kind: "refused", reason: `invalid redirect Location: ${inlineUntrusted(location, 200)}`, afterSentHop: true };
|
|
191
220
|
}
|
|
192
221
|
const nextRefused = law.refusal(next);
|
|
193
222
|
if (nextRefused !== undefined) {
|
|
194
223
|
release(res);
|
|
195
|
-
return
|
|
224
|
+
return refusedHop(nextRefused, true);
|
|
196
225
|
}
|
|
197
226
|
if (!law.follows(current, next))
|
|
198
227
|
return { kind: "unfollowed", res, from: current, to: next };
|