@sema-agent/core 7.58.0 → 7.60.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1340 -0
- package/README.md +6 -4
- package/dist/agents/agent-definition.d.ts +7 -0
- package/dist/agents/agent-definition.js +12 -0
- package/dist/agents/agent-transcript-tool.d.ts +2 -1
- package/dist/agents/agent-transcript-tool.js +3 -1
- package/dist/agents/cc-peer-directory.js +8 -8
- package/dist/agents/child-model-seat.d.ts +4 -2
- package/dist/agents/child-model-seat.js +9 -4
- package/dist/agents/cumulative-stats.js +0 -1
- package/dist/agents/inherited-tool-pool.d.ts +26 -1
- package/dist/agents/inherited-tool-pool.js +22 -0
- package/dist/agents/peer-directory.d.ts +9 -0
- package/dist/agents/peer-directory.js +6 -2
- package/dist/agents/retain-ledger.d.ts +11 -1
- package/dist/agents/retain-ledger.js +13 -2
- package/dist/agents/roster-store.d.ts +1 -1
- package/dist/agents/roster-store.js +3 -1
- package/dist/agents/send-message-tool.d.ts +8 -19
- package/dist/agents/send-message-tool.js +32 -50
- package/dist/agents/subagent.d.ts +51 -17
- package/dist/agents/subagent.js +150 -112
- package/dist/agents/tool-filter.d.ts +1 -3
- package/dist/agents/tool-filter.js +4 -12
- package/dist/bench/metrics.d.ts +3 -5
- package/dist/bench/metrics.js +0 -1
- package/dist/brain/anthropic.js +161 -45
- package/dist/brain/degrading.js +3 -1
- package/dist/brain/errors.d.ts +9 -3
- package/dist/brain/errors.js +7 -1
- package/dist/brain/failover.js +2 -1
- package/dist/brain/open-responses.js +3 -3
- package/dist/brain/openai.js +103 -53
- package/dist/brain/provider-dialect.d.ts +11 -0
- package/dist/brain/provider-dialect.js +5 -2
- package/dist/brain/reasoning-request.js +5 -4
- package/dist/brain/reasoning.d.ts +19 -0
- package/dist/brain/reasoning.js +17 -2
- package/dist/brain/request-route.d.ts +4 -1
- package/dist/brain/request-route.js +4 -1
- package/dist/brain/route-adjudicator.d.ts +84 -18
- package/dist/brain/route-adjudicator.js +90 -22
- package/dist/brain/route-conformance.js +1 -1
- package/dist/brain/status-sink.d.ts +7 -1
- package/dist/brain/status-sink.js +6 -0
- package/dist/brain/stream-engine.js +84 -49
- package/dist/brain/stream-shared.d.ts +30 -0
- package/dist/brain/stream-shared.js +34 -1
- package/dist/brain/timeout.d.ts +65 -6
- package/dist/brain/timeout.js +111 -11
- package/dist/core/a2a.d.ts +15 -5
- package/dist/core/a2a.js +34 -19
- package/dist/core/account-row.d.ts +61 -0
- package/dist/core/account-row.js +51 -0
- package/dist/core/advisor-verdict.d.ts +2 -1
- package/dist/core/advisor-verdict.js +1 -1
- package/dist/core/agent-definition.d.ts +20 -0
- package/dist/core/allow-entry.d.ts +20 -6
- package/dist/core/allow-entry.js +17 -7
- package/dist/core/approval-object.d.ts +29 -15
- package/dist/core/approval-object.js +47 -19
- package/dist/core/artifact-host.d.ts +0 -2
- package/dist/core/artifact-host.js +0 -1
- package/dist/core/auto-compaction.js +1 -1
- package/dist/core/auto-mode-defaults.d.ts +8 -0
- package/dist/core/auto-mode-defaults.js +1 -0
- package/dist/core/auto-mode-rebuild.d.ts +2 -1
- package/dist/core/auto-mode.d.ts +39 -4
- package/dist/core/auto-mode.js +63 -12
- package/dist/core/background-agent-store.d.ts +26 -4
- package/dist/core/background-agent-store.js +3 -2
- package/dist/core/background-shell.d.ts +12 -1
- package/dist/core/background-shell.js +12 -0
- package/dist/core/checkpoint-requirements.d.ts +13 -1
- package/dist/core/checkpoint-requirements.js +3 -1
- package/dist/core/checkpoint-store.d.ts +66 -25
- package/dist/core/checkpoint-store.js +22 -9
- package/dist/core/child-clamp-seats.d.ts +29 -0
- package/dist/core/child-clamp-seats.js +56 -1
- package/dist/core/compliance.d.ts +3 -3
- package/dist/core/compliance.js +1 -1
- package/dist/core/credential-echo.d.ts +52 -0
- package/dist/core/credential-echo.js +65 -0
- package/dist/core/credential-vocabulary.d.ts +13 -3
- package/dist/core/credential-vocabulary.js +12 -4
- package/dist/core/cross-boundary-taint.d.ts +4 -5
- package/dist/core/effective-path-target.d.ts +8 -2
- package/dist/core/effective-path-target.js +8 -3
- package/dist/core/engine-notice.d.ts +156 -23
- package/dist/core/engine-notice.js +19 -5
- package/dist/core/frame-settlement.d.ts +5 -0
- package/dist/core/frame-settlement.js +4 -0
- package/dist/core/gate-fold.js +8 -6
- package/dist/core/gate-lanes.js +47 -12
- package/dist/core/gate-outcome.d.ts +32 -3
- package/dist/core/gate-outcome.js +19 -1
- package/dist/core/governance-codes.d.ts +17 -1
- package/dist/core/governance-codes.js +25 -0
- package/dist/core/hands-band-screen.js +0 -1
- package/dist/core/hands-band.d.ts +0 -3
- package/dist/core/hooks.d.ts +70 -59
- package/dist/core/hooks.js +125 -80
- package/dist/core/image-admission.d.ts +106 -52
- package/dist/core/image-admission.js +184 -56
- package/dist/core/image-downsample.d.ts +36 -69
- package/dist/core/image-downsample.js +111 -73
- package/dist/core/integer-option.d.ts +21 -0
- package/dist/core/integer-option.js +13 -0
- package/dist/core/locked-config.d.ts +59 -5
- package/dist/core/locked-config.js +82 -50
- package/dist/core/mailbox-store.d.ts +45 -1
- package/dist/core/mailbox-store.js +53 -9
- package/dist/core/mcp-call-meta.d.ts +2 -2
- package/dist/core/mcp-call-meta.js +9 -10
- package/dist/core/mcp-failure.d.ts +122 -20
- package/dist/core/mcp-failure.js +73 -5
- package/dist/core/mcp-host-seat.d.ts +92 -0
- package/dist/core/mcp-host-seat.js +131 -0
- package/dist/core/mcp-probe.d.ts +7 -2
- package/dist/core/mcp-probe.js +7 -2
- package/dist/core/mcp-server-link.d.ts +22 -1
- package/dist/core/mcp-server-link.js +25 -1
- package/dist/core/mcp-server-spec.d.ts +38 -9
- package/dist/core/mcp-server-spec.js +55 -21
- package/dist/core/mcp.d.ts +27 -12
- package/dist/core/mcp.js +105 -76
- package/dist/core/memory-admission.d.ts +23 -6
- package/dist/core/memory-admission.js +19 -9
- package/dist/core/memory-engine/consolidation-driver.d.ts +2 -4
- package/dist/core/memory-engine/consolidation-driver.js +3 -3
- package/dist/core/memory-engine/consolidation.d.ts +4 -0
- package/dist/core/memory-engine/consolidation.js +1 -0
- package/dist/core/memory-engine/content-origin.d.ts +13 -0
- package/dist/core/memory-engine/content-origin.js +21 -3
- package/dist/core/memory-engine/delegation-settlement.js +5 -12
- package/dist/core/memory-engine/distiller.js +2 -2
- package/dist/core/memory-engine/dual-root.d.ts +50 -1
- package/dist/core/memory-engine/dual-root.js +44 -1
- package/dist/core/memory-engine/engine.d.ts +67 -14
- package/dist/core/memory-engine/engine.js +384 -212
- package/dist/core/memory-engine/export-bundle.d.ts +23 -0
- package/dist/core/memory-engine/export-bundle.js +23 -4
- package/dist/core/memory-engine/file-backend.d.ts +128 -55
- package/dist/core/memory-engine/file-backend.js +290 -117
- package/dist/core/memory-engine/index.d.ts +3 -2
- package/dist/core/memory-engine/index.js +2 -1
- package/dist/core/memory-engine/layout.d.ts +59 -11
- package/dist/core/memory-engine/layout.js +190 -40
- package/dist/core/memory-engine/memory-backend-contract.d.ts +1 -1
- package/dist/core/memory-engine/memory-backend-contract.js +39 -2
- package/dist/core/memory-engine/scope-contract.d.ts +13 -3
- package/dist/core/memory-engine/scope-contract.js +2 -2
- package/dist/core/memory-engine/sync-client.d.ts +51 -9
- package/dist/core/memory-engine/sync-client.js +107 -13
- package/dist/core/memory-engine/sync-report.d.ts +103 -0
- package/dist/core/memory-engine/sync-report.js +119 -0
- package/dist/core/memory-engine/sync.d.ts +8 -1
- package/dist/core/memory-engine/types.d.ts +6 -0
- package/dist/core/mode-policy.d.ts +9 -1
- package/dist/core/mode-policy.js +11 -1
- package/dist/core/model-receipt.d.ts +39 -0
- package/dist/core/model-receipt.js +139 -0
- package/dist/core/mods/agent-stations.d.ts +65 -0
- package/dist/core/mods/agent-stations.js +105 -0
- package/dist/core/mods/classic-events.d.ts +5 -1
- package/dist/core/mods/kernel/dispatch.d.ts +5 -1
- package/dist/core/mods/kernel/dispatch.js +6 -5
- package/dist/core/mods/kernel/events.d.ts +11 -4
- package/dist/core/mods/kernel/events.js +11 -7
- package/dist/core/mods/kernel/receive.d.ts +5 -0
- package/dist/core/mods/kernel/receive.js +10 -0
- package/dist/core/mods/kernel/registration.d.ts +4 -0
- package/dist/core/mods/kernel/registration.js +3 -0
- package/dist/core/mods/lifecycle-stations.d.ts +41 -0
- package/dist/core/mods/lifecycle-stations.js +35 -0
- package/dist/core/mods/stations.d.ts +73 -60
- package/dist/core/mods/stations.js +64 -40
- package/dist/core/mods/tool-call.d.ts +10 -4
- package/dist/core/mods/tool-call.js +28 -12
- package/dist/core/mounted-mcp.d.ts +5 -0
- package/dist/core/mounted-mcp.js +2 -2
- package/dist/core/namespaced-rule-name.d.ts +7 -1
- package/dist/core/namespaced-rule-name.js +13 -2
- package/dist/core/oracle-isolation.js +1 -1
- package/dist/core/own-property-receipt.d.ts +3 -0
- package/dist/core/own-property-receipt.js +3 -0
- package/dist/core/parent-spec-seat.d.ts +8 -3
- package/dist/core/parent-spec-seat.js +2 -0
- package/dist/core/park-selfcheck.js +14 -8
- package/dist/core/peer-seat.d.ts +133 -16
- package/dist/core/peer-seat.js +319 -42
- package/dist/core/permission-rule-consent.d.ts +0 -21
- package/dist/core/permission-rule-consent.js +11 -6
- package/dist/core/permission-rule-model.d.ts +20 -2
- package/dist/core/permission-rule-model.js +8 -7
- package/dist/core/present-plan-tool.d.ts +11 -3
- package/dist/core/present-plan-tool.js +2 -2
- package/dist/core/protocol-http-auth.d.ts +14 -2
- package/dist/core/protocol-http-auth.js +16 -7
- package/dist/core/read-face-seats.d.ts +7 -5
- package/dist/core/read-face-seats.js +4 -1
- package/dist/core/redaction-marks.d.ts +4 -3
- package/dist/core/redaction-marks.js +2 -2
- package/dist/core/remote-env.d.ts +146 -98
- package/dist/core/remote-env.js +113 -14
- package/dist/core/resume-startup-cause.js +1 -0
- package/dist/core/retention.js +37 -12
- package/dist/core/retired-keys.d.ts +6 -1
- package/dist/core/retired-keys.js +4 -1
- package/dist/core/rewrite-rejudge.d.ts +13 -5
- package/dist/core/rewrite-rejudge.js +9 -5
- package/dist/core/roles.d.ts +69 -3
- package/dist/core/roles.js +167 -80
- package/dist/core/rule-owner.d.ts +3 -0
- package/dist/core/runner/announce-once-ledger.d.ts +5 -4
- package/dist/core/runner/announce-once-ledger.js +4 -2
- package/dist/core/runner/assemble-result.d.ts +0 -5
- package/dist/core/runner/assemble-result.js +0 -1
- package/dist/core/runner/call-hook-stations.d.ts +17 -10
- package/dist/core/runner/call-hook-stations.js +23 -12
- package/dist/core/runner/child-tree.d.ts +7 -8
- package/dist/core/runner/child-tree.js +6 -6
- package/dist/core/runner/classifier-ladder.d.ts +10 -2
- package/dist/core/runner/classifier-ladder.js +39 -8
- package/dist/core/runner/construction-doors.js +5 -0
- package/dist/core/runner/contracts.d.ts +82 -57
- package/dist/core/runner/credential-origin-seat.js +4 -3
- package/dist/core/runner/cross-boundary-lane.d.ts +3 -5
- package/dist/core/runner/cross-boundary-lane.js +11 -2
- package/dist/core/runner/cwd-alignment-probe.d.ts +20 -0
- package/dist/core/runner/cwd-alignment-probe.js +21 -0
- package/dist/core/runner/decide-continuation.d.ts +2 -2
- package/dist/core/runner/env-capability-census.d.ts +15 -20
- package/dist/core/runner/env-capability-census.js +25 -34
- package/dist/core/runner/file-history-request.d.ts +2 -2
- package/dist/core/runner/file-history-request.js +0 -8
- package/dist/core/runner/gate-exit.d.ts +87 -11
- package/dist/core/runner/gate-exit.js +30 -8
- package/dist/core/runner/git-status-frame.d.ts +5 -2
- package/dist/core/runner/git-status-frame.js +3 -4
- package/dist/core/runner/image-removed-seat.d.ts +12 -0
- package/dist/core/runner/image-removed-seat.js +19 -0
- package/dist/core/runner/image.d.ts +7 -2
- package/dist/core/runner/image.js +14 -8
- package/dist/core/runner/inline-image.d.ts +10 -8
- package/dist/core/runner/inline-image.js +11 -9
- package/dist/core/runner/memory-consolidation-driver.js +5 -5
- package/dist/core/runner/park-commit.d.ts +1 -1
- package/dist/core/runner/park-commit.js +3 -0
- package/dist/core/runner/permission-rule-lanes.js +1 -1
- package/dist/core/runner/prepare-ask-lane.d.ts +1 -1
- package/dist/core/runner/prepare-ask-lane.js +2 -1
- package/dist/core/runner/prepare-boundary-parks.d.ts +2 -2
- package/dist/core/runner/prepare-boundary-parks.js +5 -5
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +7 -5
- package/dist/core/runner/prepare-caps-and-workflow.js +6 -3
- package/dist/core/runner/prepare-config-doors.d.ts +6 -1
- package/dist/core/runner/prepare-config-doors.js +16 -9
- package/dist/core/runner/prepare-context-lane.js +2 -0
- package/dist/core/runner/prepare-delegation-surface.d.ts +9 -3
- package/dist/core/runner/prepare-delegation-surface.js +5 -4
- package/dist/core/runner/prepare-file-history.d.ts +10 -12
- package/dist/core/runner/prepare-file-history.js +3 -12
- package/dist/core/runner/prepare-gate-stations.d.ts +4 -3
- package/dist/core/runner/prepare-gate-stations.js +4 -3
- package/dist/core/runner/prepare-hands-readface.d.ts +7 -1
- package/dist/core/runner/prepare-hands-readface.js +19 -6
- package/dist/core/runner/prepare-inherited-gate.d.ts +6 -7
- package/dist/core/runner/prepare-inherited-gate.js +22 -31
- package/dist/core/runner/prepare-memory-engine-session.js +1 -1
- package/dist/core/runner/prepare-memory.d.ts +2 -2
- package/dist/core/runner/prepare-memory.js +12 -19
- package/dist/core/runner/prepare-park-ask.d.ts +4 -6
- package/dist/core/runner/prepare-park-ask.js +5 -9
- package/dist/core/runner/prepare-policy-chain.d.ts +8 -7
- package/dist/core/runner/prepare-policy-chain.js +136 -121
- package/dist/core/runner/prepare-project-context.d.ts +2 -2
- package/dist/core/runner/prepare-project-context.js +10 -7
- package/dist/core/runner/prepare-prompt-inputs.d.ts +5 -2
- package/dist/core/runner/prepare-prompt-inputs.js +10 -20
- package/dist/core/runner/prepare-protocol-tools.d.ts +5 -3
- package/dist/core/runner/prepare-protocol-tools.js +17 -2
- package/dist/core/runner/prepare-run-refs.d.ts +2 -3
- package/dist/core/runner/prepare-run-refs.js +4 -1
- package/dist/core/runner/prepare-suspend-saga.d.ts +0 -2
- package/dist/core/runner/prepare-suspend-saga.js +5 -7
- package/dist/core/runner/prepare-task.js +44 -28
- package/dist/core/runner/prepare-turn-wiring.d.ts +2 -0
- package/dist/core/runner/prepare-turn-wiring.js +7 -2
- package/dist/core/runner/prepare-wiring-manifest.d.ts +5 -4
- package/dist/core/runner/prepare-wiring-manifest.js +34 -19
- package/dist/core/runner/prepare-workspace-restore.js +3 -3
- package/dist/core/runner/reply-pricing.d.ts +30 -0
- package/dist/core/runner/reply-pricing.js +19 -0
- package/dist/core/runner/resume-admission.js +4 -2
- package/dist/core/runner/resume-apply.js +6 -1
- package/dist/core/runner/resume-checkpoint-screen.js +4 -4
- package/dist/core/runner/resume-policy-outcome.js +5 -5
- package/dist/core/runner/retired-runner-deps.js +4 -1
- package/dist/core/runner/role-seat-defaulted.d.ts +44 -0
- package/dist/core/runner/role-seat-defaulted.js +40 -0
- package/dist/core/runner/run-attachment-seats.js +3 -3
- package/dist/core/runner/run-brain-sinks.js +3 -0
- package/dist/core/runner/run-git-lane.d.ts +3 -1
- package/dist/core/runner/run-git-lane.js +1 -1
- package/dist/core/runner/run-harness-handlers.d.ts +3 -1
- package/dist/core/runner/run-harness-handlers.js +3 -1
- package/dist/core/runner/run-identity-wiring.d.ts +2 -5
- package/dist/core/runner/run-identity-wiring.js +6 -5
- package/dist/core/runner/run-leg.d.ts +2 -0
- package/dist/core/runner/run-leg.js +63 -56
- package/dist/core/runner/run-notification-lane.d.ts +3 -1
- package/dist/core/runner/run-notification-lane.js +16 -10
- package/dist/core/runner/run-settle-and-teardown.js +5 -1
- package/dist/core/runner/run-stop-and-final-verify.d.ts +4 -0
- package/dist/core/runner/run-stop-and-final-verify.js +14 -6
- package/dist/core/runner/run-terminal-adoption.d.ts +2 -5
- package/dist/core/runner/run-terminal-adoption.js +9 -3
- package/dist/core/runner/run-turn-boundary.js +89 -77
- package/dist/core/runner/runtask.d.ts +8 -5
- package/dist/core/runner/runtask.js +21 -13
- package/dist/core/runner/side-call-account.d.ts +1 -1
- package/dist/core/runner/side-call-account.js +3 -18
- package/dist/core/runner/skills-seat.js +2 -2
- package/dist/core/runner/sub-agent-deny-lists.d.ts +24 -0
- package/dist/core/runner/sub-agent-deny-lists.js +20 -7
- package/dist/core/runner/synthetic-tools.js +2 -2
- package/dist/core/runner/tool-disclosure.js +0 -2
- package/dist/core/runner/tool-end-body.js +2 -2
- package/dist/core/runner/tool-face-overlay.d.ts +1 -1
- package/dist/core/runner/tool-face-overlay.js +26 -19
- package/dist/core/runner/tool-occurrence.d.ts +1 -1
- package/dist/core/runner/tool-occurrence.js +2 -2
- package/dist/core/runner/tool-result-media-seat.d.ts +9 -1
- package/dist/core/runner/tool-result-media-seat.js +17 -1
- package/dist/core/runner/turn-attachments.d.ts +29 -27
- package/dist/core/runner/turn-attachments.js +27 -42
- package/dist/core/runner-deps.d.ts +32 -19
- package/dist/core/secret-env.d.ts +35 -4
- package/dist/core/secret-env.js +65 -3
- package/dist/core/sensitive-path-policy.js +3 -3
- package/dist/core/session-policy-store.d.ts +12 -3
- package/dist/core/session-policy-store.js +29 -10
- package/dist/core/session-store.d.ts +5 -7
- package/dist/core/session-store.js +50 -11
- package/dist/core/side-query.d.ts +11 -1
- package/dist/core/side-query.js +9 -0
- package/dist/core/skill-grant-binding.d.ts +31 -2
- package/dist/core/skill-grant-binding.js +31 -1
- package/dist/core/skill-grant.d.ts +17 -5
- package/dist/core/skill-grant.js +24 -6
- package/dist/core/store-contracts/background-agent-store-contract.js +27 -0
- package/dist/core/store-contracts/checkpoint-store-contract.js +3 -2
- package/dist/core/store-contracts/mailbox-store-contract.js +31 -1
- package/dist/core/store-contracts/tool-result-store-contract.d.ts +1 -1
- package/dist/core/store-contracts/tool-result-store-contract.js +37 -0
- package/dist/core/stub-env.d.ts +5 -5
- package/dist/core/stub-env.js +11 -1
- package/dist/core/swappable-deps.d.ts +17 -43
- package/dist/core/swappable-deps.js +15 -5
- package/dist/core/synthetic-read-verdict.d.ts +1 -1
- package/dist/core/synthetic-read-verdict.js +2 -1
- package/dist/core/task-event.d.ts +50 -10
- package/dist/core/task-notification.d.ts +88 -5
- package/dist/core/task-notification.js +146 -17
- package/dist/core/task-registry-agent.d.ts +18 -12
- package/dist/core/task-registry-agent.js +19 -6
- package/dist/core/task-registry-monitor.d.ts +7 -0
- package/dist/core/task-registry-monitor.js +28 -1
- package/dist/core/task-registry-shared.d.ts +43 -3
- package/dist/core/task-registry-shared.js +21 -7
- package/dist/core/task-registry-workflow.js +1 -1
- package/dist/core/task-registry.d.ts +50 -35
- package/dist/core/task-registry.js +64 -23
- package/dist/core/task-result.d.ts +3 -12
- package/dist/core/task-spec.d.ts +15 -7
- package/dist/core/task-stream.d.ts +1 -1
- package/dist/core/terminal-cause.d.ts +10 -0
- package/dist/core/tool-catalog-entries.js +1 -1
- package/dist/core/tool-check-reading.d.ts +1 -0
- package/dist/core/tool-check-reading.js +3 -3
- package/dist/core/tool-face-reader.d.ts +7 -6
- package/dist/core/tool-face-reader.js +4 -3
- package/dist/core/tool-name-aliases.d.ts +19 -0
- package/dist/core/tool-name-aliases.js +54 -2
- package/dist/core/tool-policy.d.ts +21 -4
- package/dist/core/tool-policy.js +1 -1
- package/dist/core/tool-registry.d.ts +5 -5
- package/dist/core/tool-registry.js +2 -2
- package/dist/core/tool-result-store.d.ts +88 -5
- package/dist/core/tool-result-store.js +51 -12
- package/dist/core/tool-roster.d.ts +112 -5
- package/dist/core/tool-roster.js +42 -1
- package/dist/core/tool-spec.d.ts +23 -5
- package/dist/core/trace.d.ts +0 -1
- package/dist/core/types.d.ts +5 -5
- package/dist/core/types.js +2 -2
- package/dist/core/untrusted-text.js +1 -1
- package/dist/core/user-attachment.d.ts +10 -5
- package/dist/core/user-attachment.js +15 -7
- package/dist/core/wiring-manifest.d.ts +6 -3
- package/dist/engine/compaction/compaction.js +29 -3
- package/dist/engine/execution-env/node-execution-env.d.ts +11 -5
- package/dist/engine/execution-env/node-execution-env.js +21 -13
- package/dist/engine/harness/agent-harness.d.ts +26 -3
- package/dist/engine/harness/agent-harness.js +49 -16
- package/dist/engine/harness/messages.d.ts +3 -1
- package/dist/engine/harness/messages.js +3 -2
- package/dist/engine/harness/types.d.ts +119 -28
- package/dist/engine/llm/rejected-images.d.ts +46 -0
- package/dist/engine/llm/rejected-images.js +54 -0
- package/dist/engine/llm/tool-turns.d.ts +2 -1
- package/dist/engine/llm/types.d.ts +18 -7
- package/dist/engine/loop/agent-loop.d.ts +20 -12
- package/dist/engine/loop/agent-loop.js +205 -36
- package/dist/engine/loop/types.d.ts +12 -3
- package/dist/engine/lsp/node-lsp-manager.d.ts +3 -3
- package/dist/engine/lsp/node-lsp-manager.js +32 -13
- package/dist/engine/session/path-to-root.d.ts +38 -0
- package/dist/engine/session/path-to-root.js +39 -0
- package/dist/engine/session/storage-base.js +4 -21
- package/dist/index.d.ts +35 -21
- package/dist/index.js +26 -17
- package/dist/internal/harness-types.d.ts +1 -1
- package/dist/internal/harness.d.ts +1 -0
- package/dist/internal/llm.d.ts +1 -0
- package/dist/orchestration/run-workflow-tool.d.ts +9 -3
- package/dist/orchestration/run-workflow-tool.js +59 -29
- package/dist/orchestration/workflow-governance.d.ts +1 -1
- package/dist/orchestration/workflow-governance.js +2 -1
- package/dist/orchestration/workflow-observe.d.ts +17 -1
- package/dist/orchestration/workflow-observe.js +20 -0
- package/dist/orchestration/workflow-types.d.ts +32 -7
- package/dist/orchestration/workflow.d.ts +4 -0
- package/dist/orchestration/workflow.js +762 -491
- package/dist/prompts/default.d.ts +1 -10
- package/dist/prompts/default.js +0 -2
- package/dist/shell/counting-pass.d.ts +50 -0
- package/dist/shell/counting-pass.js +502 -0
- package/dist/shell/lex.d.ts +4 -2
- package/dist/shell/lex.js +93 -34
- package/dist/shell/shell-words.d.ts +1 -1
- package/dist/shell/shell-words.js +7 -6
- package/dist/stores/file/background-agent-store.d.ts +1 -1
- package/dist/stores/file/background-agent-store.js +3 -1
- package/dist/stores/file/checkpoint-store.d.ts +127 -2
- package/dist/stores/file/checkpoint-store.js +19 -14
- package/dist/stores/file/file-history-store.d.ts +1 -1
- package/dist/stores/file/file-history-store.js +3 -1
- package/dist/stores/file/index.d.ts +4 -3
- package/dist/stores/file/index.js +17 -8
- package/dist/stores/file/mailbox-store.d.ts +1 -1
- package/dist/stores/file/mailbox-store.js +9 -11
- package/dist/stores/file/memory-store.d.ts +1 -1
- package/dist/stores/file/memory-store.js +3 -1
- package/dist/stores/file/session-policy-store.d.ts +1 -1
- package/dist/stores/file/session-policy-store.js +3 -1
- package/dist/stores/file/session-store.d.ts +1 -1
- package/dist/stores/file/session-store.js +3 -1
- package/dist/stores/file/shared-ledger.d.ts +26 -0
- package/dist/stores/file/shared-ledger.js +38 -9
- package/dist/stores/file/tool-result-store.d.ts +20 -2
- package/dist/stores/file/tool-result-store.js +74 -6
- package/dist/stores/file/usage-window-store.d.ts +1 -1
- package/dist/stores/file/usage-window-store.js +3 -1
- package/dist/stores/file/workflow-journal-store.d.ts +1 -11
- package/dist/stores/file/workflow-journal-store.js +3 -2
- package/dist/tools/fs/containment-face.d.ts +5 -0
- package/dist/tools/fs/encoding.d.ts +13 -4
- package/dist/tools/fs/encoding.js +17 -2
- package/dist/tools/fs/fs-bash-background-text.d.ts +7 -0
- package/dist/tools/fs/fs-bash-background-text.js +1 -0
- package/dist/tools/fs/fs-bash.d.ts +14 -4
- package/dist/tools/fs/fs-bash.js +29 -35
- package/dist/tools/fs/fs-pdf.d.ts +2 -2
- package/dist/tools/fs/fs-pdf.js +26 -21
- package/dist/tools/fs/fs-read.d.ts +5 -4
- package/dist/tools/fs/fs-read.js +35 -18
- package/dist/tools/fs/fs-search-tools.js +4 -1
- package/dist/tools/fs/fs-shared.d.ts +11 -13
- package/dist/tools/fs/fs-shared.js +11 -7
- package/dist/tools/fs/fs-write.js +5 -5
- package/dist/tools/fs/index.d.ts +14 -8
- package/dist/tools/fs/index.js +13 -5
- package/dist/tools/fs/program-read-model.d.ts +13 -0
- package/dist/tools/fs/program-read-model.js +15 -0
- package/dist/tools/fs/program-read-model.rows.js +1 -1
- package/dist/tools/fs/read-deny.d.ts +13 -10
- package/dist/tools/fs/read-deny.js +25 -5
- package/dist/tools/fs/read-floor.d.ts +62 -0
- package/dist/tools/fs/read-floor.js +58 -0
- package/dist/tools/fs/removal-targets.d.ts +9 -4
- package/dist/tools/fs/removal-targets.js +17 -9
- package/dist/tools/fs/search.d.ts +3 -3
- package/dist/tools/fs/search.js +4 -4
- package/dist/tools/fs/shell-read-check.d.ts +1 -1
- package/dist/tools/fs/shell-read-check.js +2 -1
- package/dist/tools/fs/shell-read-judge.d.ts +16 -8
- package/dist/tools/fs/shell-read-judge.js +10 -6
- package/dist/tools/fs/shell-read-plan.d.ts +6 -1
- package/dist/tools/fs/shell-read-plan.js +22 -15
- package/dist/tools/fs/shell-read-start.js +1 -0
- package/dist/tools/fs/shell-reentry-text.d.ts +15 -1
- package/dist/tools/fs/shell-reentry-text.js +25 -3
- package/dist/tools/monitor.d.ts +9 -4
- package/dist/tools/monitor.js +17 -8
- package/dist/tools/scheduler-tools.js +42 -4
- package/dist/tools/web.d.ts +0 -10
- package/dist/tools/web.js +1 -4
- package/package.json +5 -2
- package/test/export-surface.snapshot.json +161 -21
- package/wire-changes/core-stores-sql@7.59.0.json +29 -0
- package/wire-changes/core-stores-sql@7.60.0.json +30 -0
- package/wire-changes/core@7.59.0.json +2459 -0
- package/wire-changes/core@7.60.0.json +3274 -0
- package/wire-changes/mods-kernel@7.59.0.json +29 -0
- package/wire-changes/mods-kernel@7.60.0.json +62 -0
- package/wire-changes/primitives@7.59.0.json +29 -0
- package/wire-changes/primitives@7.60.0.json +30 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { targetIsExternal } from "../remote-env.js";
|
|
1
2
|
import { BOUNDARY_LEGS, CROSS_BOUNDARY_RECORD_TYPE, CROSS_BOUNDARY_TAINT_BITS, STRICTEST_CROSS_BOUNDARY_TREE, crossBoundaryObligation, crossBoundaryPostureUndeclaredNotice, crossBoundaryRecordUnwrittenNotice, crossBoundaryRecordData, crossBoundaryTreeCovers, crossBoundaryTreeGoverned, joinCrossBoundaryTree, readCrossBoundaryRecord, } from "../cross-boundary-taint.js";
|
|
2
3
|
import { deliverEngineNotice } from "../engine-notice.js";
|
|
3
4
|
import { policyCannotAnswer } from "../real-approval.js";
|
|
@@ -23,6 +24,14 @@ export function joinedCrossBoundaryTree(handed, report) {
|
|
|
23
24
|
const EVERY_LEG = Object.freeze([...BOUNDARY_LEGS]);
|
|
24
25
|
const ONE_OUTSIDE_READ = Object.freeze([Object.freeze({ legs: Object.freeze(["outside_read"]) })]);
|
|
25
26
|
const bitsOf = (t) => CROSS_BOUNDARY_TAINT_BITS.filter((b) => t[b] === true);
|
|
27
|
+
function obligationReaching(legs, reached, tree) {
|
|
28
|
+
const declared = reached === undefined ? false : targetIsExternal(reached);
|
|
29
|
+
if (declared !== "undeclared")
|
|
30
|
+
return crossBoundaryObligation(legs, declared, tree);
|
|
31
|
+
const onTarget = crossBoundaryObligation(legs, true, tree);
|
|
32
|
+
const offTarget = crossBoundaryObligation(legs, false, tree);
|
|
33
|
+
return Object.freeze({ mandate: onTarget.mandate || offTarget.mandate, record: onTarget.record || offTarget.record });
|
|
34
|
+
}
|
|
26
35
|
function legsOfCall(view, legEnv, token, call, report) {
|
|
27
36
|
const roster = view.roster.current;
|
|
28
37
|
const row = roster !== undefined ? rosterEntryNamed(roster, call.toolName) : undefined;
|
|
@@ -137,7 +146,7 @@ export async function prepareCrossBoundaryLane(input) {
|
|
|
137
146
|
const OBSERVED = Object.freeze({ offTargetReadObserved: true });
|
|
138
147
|
const addedBy = (record) => (record && ref.current.offTargetReadObserved !== true ? OBSERVED : undefined);
|
|
139
148
|
const owedBit = (owed) => {
|
|
140
|
-
const records = (given) => given.some((d) =>
|
|
149
|
+
const records = (given) => given.some((d) => obligationReaching(d.legs, d.env, ref.current).record);
|
|
141
150
|
try {
|
|
142
151
|
return addedBy(records(owed()));
|
|
143
152
|
}
|
|
@@ -166,7 +175,7 @@ export async function prepareCrossBoundaryLane(input) {
|
|
|
166
175
|
const obligationOf = (call, say) => {
|
|
167
176
|
const { legs, env: reached } = legsOfCall(view, env, token, call, say);
|
|
168
177
|
try {
|
|
169
|
-
return
|
|
178
|
+
return obligationReaching(legs, reached, ref.current);
|
|
170
179
|
}
|
|
171
180
|
catch (err) {
|
|
172
181
|
say(`the cross-boundary obligation of "${call.toolName}" could not be read (${thrownText(err)}) — the call reads as every leg, off the target`);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** The shell's answer. `unknown` = the root is not a directory in the shell's view, or its `test` has no `-ef`:
|
|
2
|
+
* no judgment, so no observation. */
|
|
3
|
+
export type CwdAlignmentVerdict = "same" | "differ" | "unknown";
|
|
4
|
+
/**
|
|
5
|
+
* The probe's last sub-command: the shell asks whether its working directory and the task root are one directory
|
|
6
|
+
* (`test . -ef <root>`: the same filesystem object, links followed, spelling and case irrelevant) and prints one
|
|
7
|
+
* line `cwd-alignment:<same|differ|unknown>:<its pwd -P>`. The line carries its own marker, so a banner a login
|
|
8
|
+
* shell prints first moves nothing.
|
|
9
|
+
*/
|
|
10
|
+
export declare function cwdAlignmentProbe(taskRoot: string): string;
|
|
11
|
+
/** The framed answer and the shell's own `pwd -P` reading, found by its marker (the last such line — the probe's
|
|
12
|
+
* last sub-command — wherever earlier output put it); a word outside the closed set reads `unknown`; no framed
|
|
13
|
+
* line at all reads `undefined` (the probe's tail never arrived: nothing to judge). */
|
|
14
|
+
export declare function readCwdAlignment(lines: readonly string[]): {
|
|
15
|
+
verdict: CwdAlignmentVerdict;
|
|
16
|
+
shellPwd: string;
|
|
17
|
+
} | undefined;
|
|
18
|
+
/** The operator-lane sentence for a `differ` verdict: the two readings and the shell's finding, nothing about
|
|
19
|
+
* where an exec or an artifact would land. */
|
|
20
|
+
export declare function cwdMisalignmentMessage(taskRoot: string, shellPwd: string): string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { shellQuote } from "../../tools/fs/search.js";
|
|
2
|
+
const CWD_ALIGNMENT_MARK = "cwd-alignment:";
|
|
3
|
+
export function cwdAlignmentProbe(taskRoot) {
|
|
4
|
+
const root = shellQuote(taskRoot);
|
|
5
|
+
return `(p=$(pwd -P 2>/dev/null || pwd); if test -d ${root} >/dev/null 2>&1; then test . -ef ${root} >/dev/null 2>&1; case $? in 0) v=same;; 1) v=differ;; *) v=unknown;; esac; else v=unknown; fi; printf '%s\\n' "${CWD_ALIGNMENT_MARK}$v:$p")`;
|
|
6
|
+
}
|
|
7
|
+
export function readCwdAlignment(lines) {
|
|
8
|
+
for (let i = lines.length - 1; i >= 0; i--) {
|
|
9
|
+
const line = lines[i] ?? "";
|
|
10
|
+
if (!line.startsWith(CWD_ALIGNMENT_MARK))
|
|
11
|
+
continue;
|
|
12
|
+
const rest = line.slice(CWD_ALIGNMENT_MARK.length);
|
|
13
|
+
const cut = rest.indexOf(":");
|
|
14
|
+
const word = cut < 0 ? rest : rest.slice(0, cut);
|
|
15
|
+
return { verdict: word === "same" || word === "differ" ? word : "unknown", shellPwd: cut < 0 ? "" : rest.slice(cut + 1).trim() };
|
|
16
|
+
}
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
export function cwdMisalignmentMessage(taskRoot, shellPwd) {
|
|
20
|
+
return `execution-env cwd misalignment: a probe run with the task root "${taskRoot}" as its working directory reports pwd "${shellPwd}", and the env's shell found that directory to be a different one from the task root`;
|
|
21
|
+
}
|
|
@@ -131,8 +131,8 @@ export declare function mintDecideRecord(cp: Checkpoint, facts: HostDecisionFact
|
|
|
131
131
|
* row stays `pending` for a well-formed decide, exactly like the other capture-time domain refusals,
|
|
132
132
|
* and BEFORE the hygiene check so no guard ever consults a value outside the domain. The rejected field
|
|
133
133
|
* is named in the message, and in `detail` where the caller hands the closed set's word for the cell
|
|
134
|
-
* (`CheckpointErrorField`: `feedback`
|
|
135
|
-
* wire-surface change of its own).
|
|
134
|
+
* (`CheckpointErrorField`: `feedback` and the approval lane's deny `reason` have one; the other lanes' `reason` and
|
|
135
|
+
* `editedPlan` have none, and widening the set is a wire-surface change of its own).
|
|
136
136
|
*/
|
|
137
137
|
export declare function assertOutcomeText(value: string | undefined, field: "editedPlan" | "reason" | "feedback", detail?: {
|
|
138
138
|
field: CheckpointErrorField;
|
|
@@ -4,30 +4,25 @@ import type { EngineNotice } from "../engine-notice.js";
|
|
|
4
4
|
export interface MalformedCapabilityDeclaration {
|
|
5
5
|
readonly key: string;
|
|
6
6
|
readonly valueType: string;
|
|
7
|
-
/** The shape the seat takes: a `capabilities.*` boolean
|
|
8
|
-
|
|
7
|
+
/** The shape the seat takes: a `capabilities.*` boolean (or the block itself, an object), an optional seam method, or
|
|
8
|
+
* nothing (`absent`: a member of the block that is no capability). */
|
|
9
|
+
readonly expected: "boolean" | "object" | "function" | "absent";
|
|
9
10
|
}
|
|
10
11
|
/**
|
|
11
|
-
* Every
|
|
12
|
+
* Every capability this env does not DECLARE as a boolean: each key of the block that is absent, not a boolean, or
|
|
13
|
+
* cannot be received — or the block itself, when it is present but not an object or cannot be received — and each
|
|
14
|
+
* member the block carries outside the eight keys (a misspelled key leaves the key it meant undeclared).
|
|
12
15
|
*
|
|
13
|
-
* The
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* outside {@link NO_ABSENT_READING} (and announced, alike, for a key inside it) — so one test covers both and
|
|
18
|
-
* the census needs no membership rule at all.
|
|
16
|
+
* The block is judged on its one receipt (`capabilityReceiptOf`), the frozen copy every reader reads. `undefined` is
|
|
17
|
+
* where absence lands — an absent key and an explicit `undefined` are the same word to every reader — and both are
|
|
18
|
+
* announced, as a wrong shape is. An env with no block at all is announced once per key: every reader takes every key's
|
|
19
|
+
* safe side, and the operator learns which.
|
|
19
20
|
*
|
|
20
|
-
* TOTAL by construction: a diagnostic may not be the thing that fails a run. Every read of the adapter
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* could not be had).
|
|
25
|
-
*
|
|
26
|
-
* What a snapshot cannot promise: this is taken once, at admission. An adapter whose capability values
|
|
27
|
-
* CHANGE afterwards can hand a later reader something this census never saw; the declaration is
|
|
28
|
-
* documented as a constant property of the adapter, and a mutable one is outside what any one-time
|
|
29
|
-
* reading covers.
|
|
21
|
+
* TOTAL by construction: a diagnostic may not be the thing that fails a run. Every read of the adapter can throw on a
|
|
22
|
+
* getter or a Proxy trap — the block acquisition, each key, each optional method — and a read that throws is itself a
|
|
23
|
+
* declaration nobody can use, so it is reported rather than raised (`unreadable`, under the key when there is one and
|
|
24
|
+
* under `capabilities` when the block itself could not be had).
|
|
30
25
|
*/
|
|
31
26
|
export declare function malformedCapabilityDeclarations(env: ExecutionEnv): MalformedCapabilityDeclaration[];
|
|
32
|
-
/** Announce each malformed declaration once, to the operator who wired the adapter. */
|
|
27
|
+
/** Announce each undeclared or malformed declaration once, to the operator who wired the adapter. */
|
|
33
28
|
export declare function announceMalformedCapabilities(env: ExecutionEnv, onNotice: ((notice: EngineNotice) => void) | undefined): void;
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CAPABILITY_KEYS, UNDECLARED_CAPABILITY_READING, capabilityReceiptOf } from "../remote-env.js";
|
|
2
2
|
import { deliverEngineNotice } from "../engine-notice.js";
|
|
3
|
-
const BOOLEAN_CAPABILITY_KEYS = ["isolation", "suspendable", "canonicalPathAuthoritative", "sharesProcessTable"];
|
|
4
|
-
const NO_ABSENT_READING = {
|
|
5
|
-
sharesProcessTable: "whether the commands it runs are processes on this engine's own process table has no default, so the Bash tool refuses every pattern kill that needs the question (`pkill`, `killall`, a `kill` fed by `pgrep`; `pkill -P $$`, the shell's own children, runs) on this environment until the adapter declares it — `true` when its commands run on a table that holds the engine (a host lane, or a PID namespace that contains the engine's), `false` only when they run where the engine is not (another machine, a PID namespace that does not contain it)",
|
|
6
|
-
};
|
|
7
3
|
const OPTIONAL_METHOD_KEYS = ["writeFileExclusive", "writeFileGuarded", "setFileMode", "readLink", "canonicalChain", "fileIdentity", "openBound"];
|
|
8
4
|
export function malformedCapabilityDeclarations(env) {
|
|
9
5
|
const out = [];
|
|
@@ -20,41 +16,36 @@ export function malformedCapabilityDeclarations(env) {
|
|
|
20
16
|
continue;
|
|
21
17
|
out.push({ key, valueType: value === null ? "null" : typeof value, expected: "function" });
|
|
22
18
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
if (!isRemoteExecutionEnv(env))
|
|
26
|
-
return out;
|
|
27
|
-
caps = env.capabilities;
|
|
28
|
-
}
|
|
29
|
-
catch {
|
|
30
|
-
out.push({ key: "capabilities", valueType: "unreadable", expected: "boolean" });
|
|
31
|
-
return out;
|
|
32
|
-
}
|
|
33
|
-
for (const key of BOOLEAN_CAPABILITY_KEYS) {
|
|
34
|
-
let value;
|
|
35
|
-
try {
|
|
36
|
-
value = caps[key];
|
|
37
|
-
}
|
|
38
|
-
catch {
|
|
39
|
-
out.push({ key, valueType: "unreadable", expected: "boolean" });
|
|
40
|
-
continue;
|
|
41
|
-
}
|
|
42
|
-
if (typeof value === "boolean" || (value === undefined && NO_ABSENT_READING[key] === undefined))
|
|
43
|
-
continue;
|
|
44
|
-
out.push({ key, valueType: value === null ? "null" : typeof value, expected: "boolean" });
|
|
45
|
-
}
|
|
19
|
+
for (const finding of capabilityReceiptOf(env).findings)
|
|
20
|
+
out.push(finding);
|
|
46
21
|
return out;
|
|
47
22
|
}
|
|
23
|
+
function declaredAs({ key, valueType, expected }) {
|
|
24
|
+
if (expected === "function")
|
|
25
|
+
return `declares ${key} as a ${valueType}, not a function`;
|
|
26
|
+
if (expected === "object")
|
|
27
|
+
return valueType === "unreadable" ? "declares a capabilities block that cannot be read" : `declares capabilities as a ${valueType}, not an object`;
|
|
28
|
+
if (expected === "absent")
|
|
29
|
+
return `declares capabilities.${key}, which is no capability`;
|
|
30
|
+
if (valueType === "undefined")
|
|
31
|
+
return `does not declare capabilities.${key}`;
|
|
32
|
+
if (valueType === "unreadable")
|
|
33
|
+
return `declares capabilities.${key} with a value that cannot be read`;
|
|
34
|
+
return `declares capabilities.${key} as a ${valueType}, not a boolean`;
|
|
35
|
+
}
|
|
48
36
|
export function announceMalformedCapabilities(env, onNotice) {
|
|
49
|
-
for (const
|
|
50
|
-
const
|
|
37
|
+
for (const finding of malformedCapabilityDeclarations(env)) {
|
|
38
|
+
const { key, valueType, expected } = finding;
|
|
39
|
+
const row = expected === "boolean" ? UNDECLARED_CAPABILITY_READING[key] : undefined;
|
|
51
40
|
deliverEngineNotice(onNotice, {
|
|
52
41
|
code: "config.execution_env_capability_invalid",
|
|
53
42
|
message: expected === "function"
|
|
54
|
-
? `The execution environment
|
|
55
|
-
:
|
|
56
|
-
? `The execution environment ${
|
|
57
|
-
:
|
|
43
|
+
? `The execution environment ${declaredAs(finding)}. This seat is declared by being present as a callable method and undeclared by being absent, so every reader takes the absent reading — the reach the adapter meant to declare is silently the old one. Fix the adapter — this is a wiring fault, not a supported way to leave the seat unset.`
|
|
44
|
+
: expected === "absent"
|
|
45
|
+
? `The execution environment ${declaredAs(finding)}: the block holds exactly ${CAPABILITY_KEYS.join(", ")}, so no reader takes this member, and a misspelled key leaves the key it meant undeclared. Fix the adapter — this is a wiring fault, not a supported extension of the block.`
|
|
46
|
+
: expected === "object"
|
|
47
|
+
? `The execution environment ${declaredAs(finding)}. Every capability is required and none can be read, so every reader takes its key's undeclared reading (${CAPABILITY_KEYS.map((k) => `${k} as ${JSON.stringify(UNDECLARED_CAPABILITY_READING[k].reads)}`).join(", ")}). Fix the adapter — this is a wiring fault, not a supported way to leave the capabilities unset.`
|
|
48
|
+
: `The execution environment ${declaredAs(finding)}. Every capability is required and has no default reading, so the engine reads it as ${JSON.stringify(row?.reads)}: ${row?.so}. Fix the adapter — this is a wiring fault, not a supported way to leave the capability unset.`,
|
|
58
49
|
detail: { key, valueType },
|
|
59
50
|
});
|
|
60
51
|
}
|
|
@@ -4,8 +4,8 @@ import type { RunnerDeps, TaskSpec } from "../types.js";
|
|
|
4
4
|
/**
|
|
5
5
|
* The file-history REQUEST door: every refusal the request (`TaskSpec`) and the deployment's own seats decide
|
|
6
6
|
* without the session, the env or the store's contents — the three bad-value doors (`RunnerDeps.onTrackFailure`,
|
|
7
|
-
* `RunnerDeps.fileHistoryStore` / `fileHistoryCapture`, `TaskSpec.fileHistory`), the
|
|
8
|
-
*
|
|
7
|
+
* `RunnerDeps.fileHistoryStore` / `fileHistoryCapture`, `TaskSpec.fileHistory`), the restoreFiles / resumeAt /
|
|
8
|
+
* rewindFilesTo contradictions, and a restore asked of a run that holds no
|
|
9
9
|
* history (`rewind.capture_disabled` / `rewind.store_unconfigured`). SYNCHRONOUS and side-effect free; the driver
|
|
10
10
|
* calls it BEFORE the session is acquired, so a request refused here leaves the session — its leaf included —
|
|
11
11
|
* exactly as it was. What it resolves rides into the file-history phase (`prepareFileHistory`) unchanged.
|
|
@@ -4,14 +4,6 @@ export function resolveFileHistoryRequest(spec, deps) {
|
|
|
4
4
|
const declaredOff = wiredSeat === "disabled" || runDeclaredOff;
|
|
5
5
|
const fileHistoryStore = declaredOff ? undefined : wiredSeat;
|
|
6
6
|
const captureStore = captureOff ? undefined : fileHistoryStore;
|
|
7
|
-
const legacyRewindFiles = spec.rewindFiles;
|
|
8
|
-
if (legacyRewindFiles === true) {
|
|
9
|
-
if (spec.resumeAt !== undefined) {
|
|
10
|
-
const e = new Error(`rewind-files: TaskSpec.rewindFiles is retired (design/381 — rewind now converges the per-edited-file history, not a whole-tree snapshot). This request pairs it with resumeAt, i.e. the RESTORE sense: set restoreFiles: true instead. (The capture sense needs no request anymore — first-touch tracking is on whenever a RunnerDeps.fileHistoryStore is wired and neither RunnerDeps.fileHistoryCapture nor TaskSpec.fileHistory turns it off.)`);
|
|
11
|
-
e.code = "rewind.rewind_files_retired";
|
|
12
|
-
throw e;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
7
|
if (spec.restoreFiles === true && spec.resumeAt === undefined) {
|
|
16
8
|
const e = new Error(`rewind-files: restoreFiles: true needs a resumeAt anchor — restoring files means converging them to a specific prior entry's boundary, and this spec names none. Use resumeAt + restoreFiles to move conversation and files together, or rewindFilesTo alone for a code-only restore.`);
|
|
17
9
|
e.code = "rewind.invalid_spec";
|
|
@@ -55,6 +55,9 @@ export interface GateExitFacts {
|
|
|
55
55
|
clearedBy?: AllowRuleClearance;
|
|
56
56
|
/** The permission mode REFUSED the surviving ask — only beside `deniedBy: "mode"`. */
|
|
57
57
|
modeRefusal?: ModeRefusal;
|
|
58
|
+
/** The registration whose handler ended the call at the hook layer (its deny answer or its failure) — only beside `deniedBy: "hook"`.
|
|
59
|
+
* As the bus names it: the engine's own origin word is read as no extension at the mint, once. */
|
|
60
|
+
extension?: string;
|
|
58
61
|
}
|
|
59
62
|
/**
|
|
60
63
|
* Mint the outcome. A defect here is an ENGINE defect (a refusing site that did not say who refused, a
|
|
@@ -65,7 +68,7 @@ export interface GateExitFacts {
|
|
|
65
68
|
export declare function mintGateOutcome(facts: GateExitFacts): GateOutcome;
|
|
66
69
|
/** A direct refusal by one layer, with no ask settled — the five short-circuit exits (a hook that threw or
|
|
67
70
|
* never answered, the hook's own deny, the compliance lock, the plan-mode block). */
|
|
68
|
-
export declare function directDeny(deniedBy: Exclude<DeniedBy, "ask_resolution"
|
|
71
|
+
export declare function directDeny(deniedBy: Exclude<DeniedBy, "ask_resolution">, extension?: string): GateOutcome;
|
|
69
72
|
/**
|
|
70
73
|
* The gate's settlement LEDGER for one pass — the one place "which ask did this pass consume" is written,
|
|
71
74
|
* with ONE rule for every read, all through the decision's engine record ({@link attestationOf}):
|
|
@@ -137,23 +140,55 @@ export declare function frozenInputSnapshot(input: unknown): unknown;
|
|
|
137
140
|
/** What one `classic.PreToolUse` screening came to: an answer the receipt took (`undefined` = no opinion), or the
|
|
138
141
|
* engine's fail-closed refusal of the call with its sentence (a handler that failed or broke the site's contract,
|
|
139
142
|
* or a cancel). */
|
|
140
|
-
/** A screen's outcome
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
+
/** A screen's outcome over every installation that screens the call (the leg's own bus, then each inherited installation). An
|
|
144
|
+
* answer is the leg's own verdict — or an inherited installation's `deny`, which ends the screen — naming the registration that
|
|
145
|
+
* answered it (`answeredBy`, absent when no handler spoke); its `updatedInput` is the bytes the screen ended on when any
|
|
146
|
+
* installation rewrote, `rewrittenBy` the extensions that authored them (in the order they rewrote). `contexts` are every
|
|
147
|
+
* `additionalContext` line the screen collected, in raise order. `settled`: an inherited installation's question was refused
|
|
148
|
+
* where its installation froze it (`deniedBy` / `cause` as the pass's ledger read the refusal). A refusal — a deny, a failure, a
|
|
149
|
+
* settled refusal — names the bytes its judge judged (`judged`) when a rewrite earlier in the screen made them other bytes than
|
|
150
|
+
* those the screen was given. */
|
|
143
151
|
export type PreToolUseScreen = {
|
|
144
152
|
readonly kind: "answered";
|
|
145
153
|
readonly answer: PreToolUseResult | undefined;
|
|
146
154
|
readonly answeredBy?: string;
|
|
147
155
|
readonly rewrittenBy?: readonly string[];
|
|
156
|
+
readonly contexts: readonly string[];
|
|
157
|
+
readonly inherited?: InheritedScreenRead;
|
|
158
|
+
readonly judged?: unknown;
|
|
148
159
|
} | {
|
|
149
160
|
readonly kind: "refused";
|
|
150
|
-
readonly reason: string;
|
|
161
|
+
readonly reason: string; /** the registration the bus names for the failed screening (the mint reads whether it names an extension); absent on a cancel */
|
|
162
|
+
readonly extension?: string;
|
|
163
|
+
readonly judged?: unknown;
|
|
164
|
+
} | {
|
|
165
|
+
readonly kind: "settled";
|
|
166
|
+
readonly deny: PermissionResult;
|
|
167
|
+
readonly deniedBy: DeniedBy;
|
|
168
|
+
readonly cause?: ClassifierDenyCause;
|
|
169
|
+
readonly judged?: unknown;
|
|
151
170
|
};
|
|
171
|
+
/** What the inherited installations' `classic.PreToolUse` came to beside the leg's own answer (present when one was raised): the
|
|
172
|
+
* registrations whose `allow` is no objection here (the allow layer's `hook` member discloses them; an inherited allow clears
|
|
173
|
+
* nothing of this leg's), the question a settlement floated to this leg's park (the call is marked; it folds as the leg's own
|
|
174
|
+
* hook ask does), and a person's approval of an edit at an installation's question (the gate's approved-edit pass takes it). */
|
|
175
|
+
export interface InheritedScreenRead {
|
|
176
|
+
readonly allowedBy: readonly string[];
|
|
177
|
+
readonly floated?: Extract<PermissionResult, {
|
|
178
|
+
action: "ask";
|
|
179
|
+
}>;
|
|
180
|
+
readonly approved?: Extract<PermissionResult, {
|
|
181
|
+
action: "allow";
|
|
182
|
+
}> & {
|
|
183
|
+
readonly updatedInput: unknown;
|
|
184
|
+
};
|
|
185
|
+
}
|
|
152
186
|
/**
|
|
153
|
-
* The PreToolUse screening face as the gate's stations see it — `classic.PreToolUse` raised on the leg's bus
|
|
154
|
-
* per-screening e, the answer receipt
|
|
155
|
-
*
|
|
156
|
-
*
|
|
187
|
+
* The PreToolUse screening face as the gate's stations see it — `classic.PreToolUse` raised on the leg's bus and then on each
|
|
188
|
+
* inherited installation's, the per-screening e, the answer receipt, the installations' settlements and the fail-closed
|
|
189
|
+
* sentences behind one method, so every re-screen (the fold's second look, the approved-edit pass) runs the SAME screening
|
|
190
|
+
* the phase-1 pass ran. Present on the pass exactly when a handler hangs on the event on one of those buses (an observe
|
|
191
|
+
* handler of the leg's own runs inside the screening too; it never decides).
|
|
157
192
|
*/
|
|
158
193
|
export interface PreToolUseScreening {
|
|
159
194
|
/** Raise `classic.PreToolUse` over `args`; `subject` names what is screened in a fail-closed sentence; `readAs` is the call
|
|
@@ -165,6 +200,31 @@ export interface PreToolUseScreening {
|
|
|
165
200
|
/** The model-facing text for the screen's OWN deny of this call (unwrapped; every exit wraps it with the leg's mark). */
|
|
166
201
|
deniedReason(answer: PreToolUseResult): string;
|
|
167
202
|
}
|
|
203
|
+
/** What the inherited installations said in a screen, taken onto the pass — the one reading for phase 1 and the fold's second
|
|
204
|
+
* look: a floated question folds as the leg's own hook ask does (the call is marked, so no layer of this leg answers it), the
|
|
205
|
+
* allow speakers go to the allow layer's disclosure (the latest screen's reading replaces an earlier one), and a person's
|
|
206
|
+
* approved edit waits for the lanes' approved-edit pass. */
|
|
207
|
+
export declare function takeInheritedScreen(pass: GatePass, read: InheritedScreenRead | undefined): void;
|
|
208
|
+
/** A screen's `settled` outcome: an inherited installation's question refused where its installation froze it, in the layer word
|
|
209
|
+
* and the cause its reader read (`policy` when it read none), over the bytes its judge judged when a rewrite made them others. */
|
|
210
|
+
export declare function settledScreen(read: {
|
|
211
|
+
readonly decision: PermissionResult;
|
|
212
|
+
readonly deniedBy?: DeniedBy;
|
|
213
|
+
readonly cause?: ClassifierDenyCause;
|
|
214
|
+
}, judged: {
|
|
215
|
+
readonly judged?: unknown;
|
|
216
|
+
}): Extract<PreToolUseScreen, {
|
|
217
|
+
kind: "settled";
|
|
218
|
+
}>;
|
|
219
|
+
/** A settled screen taken onto the pass — the one reading for phase 1, the fold's second look and the approved-edit pass's two
|
|
220
|
+
* screens: its layer word and cause are the pass's; the refusal is returned for the site to stand (the decision, or the edit's). */
|
|
221
|
+
export declare function takeSettledScreen(pass: GatePass, settled: Extract<PreToolUseScreen, {
|
|
222
|
+
kind: "settled";
|
|
223
|
+
}>): PermissionResult;
|
|
224
|
+
/** A settled screen ends the pass as the call's settlement: its refusal is the decision, through the single deny exit. */
|
|
225
|
+
export declare function settledScreenExit(pass: GatePass, settled: Extract<PreToolUseScreen, {
|
|
226
|
+
kind: "settled";
|
|
227
|
+
}>): Promise<ToolGateResult>;
|
|
168
228
|
/** The FACE a pass's questions are put on ({@link askFaceOf} of the call's wire name) — the one reading of it the
|
|
169
229
|
* write-protection tighten (the fold) and every class derivation (the lanes) make. */
|
|
170
230
|
export declare function passAskFace(pass: Pick<GatePass, "req">): AskFace;
|
|
@@ -251,6 +311,18 @@ export interface GatePass {
|
|
|
251
311
|
* that answered it: the allow layer's hook member (its `entries`). Writers: the dispatch (phase 1) and the fold's second
|
|
252
312
|
* look after a policy rewrite (rewrite-rejudge.ts), whose answer replaces the first. Reader: the lanes' allow layer. */
|
|
253
313
|
hookAllowedBy?: readonly string[];
|
|
314
|
+
/** borrowed-mutable — the inherited installations whose `classic.PreToolUse` answered `allow` for the bytes that run: no
|
|
315
|
+
* objection, disclosed as the allow layer's `hook` member over a standing ask (never a clear). Writers: the dispatch (phase 1)
|
|
316
|
+
* and the fold's second look (its reading replaces the first). Reader: the lanes' allow layer. */
|
|
317
|
+
inheritedAllowedBy?: readonly string[];
|
|
318
|
+
/** borrowed-mutable — a person at an inherited installation's question approved an EDIT of the call during a screen: the lanes
|
|
319
|
+
* take it into the approved-edit pass after the fold (as a `tool.check` raise's approval is taken). Writers: the dispatch
|
|
320
|
+
* (phase 1) and the fold's second look. Reader: the lanes. */
|
|
321
|
+
screenApproval?: Extract<PermissionResult, {
|
|
322
|
+
action: "allow";
|
|
323
|
+
}> & {
|
|
324
|
+
readonly updatedInput: unknown;
|
|
325
|
+
};
|
|
254
326
|
/** borrowed-mutable — `tool.check` was raised in this pass's first adjudication, which raises it once: set by the
|
|
255
327
|
* raise in front of the ask branch, read by the raise behind the read-only arm (it then raises nothing). Writer and
|
|
256
328
|
* reader: the lanes. */
|
|
@@ -264,6 +336,10 @@ export interface GatePass {
|
|
|
264
336
|
* that ended as a refusal). The exit mints the outcome from it beside the ledger's `settled`; a refusal
|
|
265
337
|
* that reaches the exit without it is an engine defect and the mint throws. */
|
|
266
338
|
deniedBy: DeniedBy | undefined;
|
|
339
|
+
/** borrowed-mutable — the registration whose handler refused, written by every site that writes `deniedBy: "hook"` (its deny
|
|
340
|
+
* answer, or its failure; absent when the refusal names no extension — the engine's own failed raise, a cancel). Read only
|
|
341
|
+
* beside `deniedBy: "hook"` ({@link DENIED_BY_MAY_NAME_EXTENSION}); the exit mints `GateDisposition.extension` from it. */
|
|
342
|
+
deniedExtension?: string;
|
|
267
343
|
/** borrowed-mutable — a refusing station's STRUCTURED details (the shell read station's refusal card), written
|
|
268
344
|
* beside `deniedBy` by that station alone; the exit puts it on the gate result for the loop's error result.
|
|
269
345
|
* OPTIONAL (the `probeUnanswered` form): the dispatch that builds the pass has nothing to declare here. */
|
|
@@ -362,7 +438,7 @@ export interface GatePass {
|
|
|
362
438
|
* here — an attribution channel whose job is "why was this call denied" must see an engine deny, or the
|
|
363
439
|
* deployment's only evidence of a broken hook is a tool that mysteriously stops working.
|
|
364
440
|
*/
|
|
365
|
-
export declare function engineFailClosedExit(pass: GatePass, reason: string): Promise<ToolGateResult>;
|
|
441
|
+
export declare function engineFailClosedExit(pass: GatePass, reason: string, extension?: string): Promise<ToolGateResult>;
|
|
366
442
|
/** The refusal sentence for args the gate could not take into its own copy (`ownArgs` refused them), naming what. */
|
|
367
443
|
export declare const unownedArgsMessage: (subject: string, reason: string) => string;
|
|
368
444
|
/**
|
|
@@ -388,7 +464,7 @@ export declare function untakenValueExit(pass: GatePass, untaken: {
|
|
|
388
464
|
export declare function unownedArgsExit(pass: GatePass, reason: string): Promise<ToolGateResult>;
|
|
389
465
|
/** The hook's OWN deny in phase 1. A PreToolUse hook deny does NOT fire `permissionDenied`
|
|
390
466
|
* (the exclusion recorded on `PermissionDeniedPayload`) — this return stays observer-free. */
|
|
391
|
-
export declare function hookDenyExit(pass: GatePass, deniedReason: string): ToolGateResult;
|
|
467
|
+
export declare function hookDenyExit(pass: GatePass, deniedReason: string, extension?: string): ToolGateResult;
|
|
392
468
|
/**
|
|
393
469
|
* The exit of the adjudicate chain — the pass has a standing `deny` or `allow` (every ask was resolved or
|
|
394
470
|
* parked before this), and this is where it becomes the gate result and the ONE record of the pass.
|
|
@@ -2,7 +2,7 @@ import { screenGateOutcome, SETTLEMENT_IS_REFUSAL } from "../gate-outcome.js";
|
|
|
2
2
|
import { askFaceOf, classifyAsk, headlessApprovalRemedy } from "../ask-origin.js";
|
|
3
3
|
import { wireOf } from "../tool-name-readings.js";
|
|
4
4
|
import { isProtectedWrite } from "../tool-registry.js";
|
|
5
|
-
import { attestationOf, decisionText, licenseCovers } from "../tool-policy.js";
|
|
5
|
+
import { attestationOf, decisionText, foldHookAsk, licenseCovers } from "../tool-policy.js";
|
|
6
6
|
import { pathDenialCardOf } from "../../tools/fs/safety.js";
|
|
7
7
|
import { argsAsTheToolReads } from "../effective-path-target.js";
|
|
8
8
|
import { rewriteRecordOf } from "../rewrite-rejudge.js";
|
|
@@ -11,9 +11,11 @@ import { inlineUntrusted } from "../untrusted-text.js";
|
|
|
11
11
|
import { formatHookFeedback } from "../reminder-mint.js";
|
|
12
12
|
import { types } from "node:util";
|
|
13
13
|
import { receive } from "../mods/kernel/receive.js";
|
|
14
|
+
import { namedRegistration } from "../mods/kernel/registration.js";
|
|
14
15
|
import { describeBindingFault, MAX_DEPTH } from "../canonical-json.js";
|
|
15
16
|
export function mintGateOutcome(facts) {
|
|
16
17
|
const settlement = facts.settled !== undefined ? Object.freeze({ ...facts.settled.settlement, who: Object.freeze({ ...facts.settled.settlement.who }) }) : undefined;
|
|
18
|
+
const extension = namedRegistration(facts.extension);
|
|
17
19
|
const attribution = facts.classifier !== undefined ? Object.freeze({ ...facts.classifier, ...(facts.classifier.fallback !== undefined ? { fallback: Object.freeze({ ...facts.classifier.fallback }) } : {}) }) : undefined;
|
|
18
20
|
const outcome = Object.freeze({
|
|
19
21
|
disposition: Object.freeze(facts.deniedBy !== undefined
|
|
@@ -21,6 +23,7 @@ export function mintGateOutcome(facts) {
|
|
|
21
23
|
kind: "denied",
|
|
22
24
|
deniedBy: facts.deniedBy,
|
|
23
25
|
...(facts.cause !== undefined ? { cause: facts.cause } : {}),
|
|
26
|
+
...(extension !== undefined ? { extension } : {}),
|
|
24
27
|
...(attribution !== undefined ? { classifier: attribution } : {}),
|
|
25
28
|
...(facts.modeRefusal !== undefined ? { mode: facts.modeRefusal.mode, askClass: facts.modeRefusal.askClass, classes: Object.freeze([...facts.modeRefusal.classes]) } : {}),
|
|
26
29
|
}
|
|
@@ -41,8 +44,8 @@ function releaseRecordOf(a) {
|
|
|
41
44
|
const { kind: _kind, ...record } = a;
|
|
42
45
|
return record;
|
|
43
46
|
}
|
|
44
|
-
export function directDeny(deniedBy) {
|
|
45
|
-
return mintGateOutcome({ deniedBy });
|
|
47
|
+
export function directDeny(deniedBy, extension) {
|
|
48
|
+
return mintGateOutcome({ deniedBy, ...(extension !== undefined ? { extension } : {}) });
|
|
46
49
|
}
|
|
47
50
|
const SETTLEMENT_IS_HUMAN = {
|
|
48
51
|
human_allowed: true,
|
|
@@ -215,12 +218,31 @@ function withParkFailureCause(reason, parkFailed, nobodyJudged) {
|
|
|
215
218
|
const note = `${reason} — note: a durable approval park was attempted for this call and could not be minted (${inlineUntrusted(parkFailed, PARK_FAILURE_CAUSE_MAX)})`;
|
|
216
219
|
return nobodyJudged ? `${note}; with nobody to judge the call, that is why it stopped — it can be issued again once its park can be minted.` : `${note}.`;
|
|
217
220
|
}
|
|
221
|
+
export function takeInheritedScreen(pass, read) {
|
|
222
|
+
if (read?.floated !== undefined)
|
|
223
|
+
pass.hookAsk = pass.hookAsk !== undefined ? foldHookAsk(pass.hookAsk, read.floated) : read.floated;
|
|
224
|
+
pass.inheritedAllowedBy = read !== undefined && read.allowedBy.length > 0 ? read.allowedBy : undefined;
|
|
225
|
+
if (read?.approved !== undefined)
|
|
226
|
+
pass.screenApproval = read.approved;
|
|
227
|
+
}
|
|
228
|
+
export function settledScreen(read, judged) {
|
|
229
|
+
return { kind: "settled", deny: read.decision, deniedBy: read.deniedBy ?? "policy", ...(read.cause !== undefined ? { cause: read.cause } : {}), ...judged };
|
|
230
|
+
}
|
|
231
|
+
export function takeSettledScreen(pass, settled) {
|
|
232
|
+
pass.deniedBy = settled.deniedBy;
|
|
233
|
+
pass.denyCause = settled.cause;
|
|
234
|
+
return settled.deny;
|
|
235
|
+
}
|
|
236
|
+
export async function settledScreenExit(pass, settled) {
|
|
237
|
+
pass.decision = takeSettledScreen(pass, settled);
|
|
238
|
+
return await exitGate(pass);
|
|
239
|
+
}
|
|
218
240
|
export function passAskFace(pass) {
|
|
219
241
|
return askFaceOf(wireOf("gate.askFace", pass.req));
|
|
220
242
|
}
|
|
221
|
-
export async function engineFailClosedExit(pass, reason) {
|
|
243
|
+
export async function engineFailClosedExit(pass, reason, extension) {
|
|
222
244
|
const { input, toolName, toolCallId, notifyPermissionDenied } = pass;
|
|
223
|
-
const gate = directDeny("hook");
|
|
245
|
+
const gate = directDeny("hook", extension);
|
|
224
246
|
const finalInput = frozenInputSnapshot(pass.currentInput);
|
|
225
247
|
await notifyPermissionDenied({ toolName, input: cloneObserverInput(finalInput), toolCallId, reason, gate, ...(input.identity !== undefined ? { identity: input.identity } : {}) });
|
|
226
248
|
return { block: true, reason: formatHookFeedback(reason, input.reminderMark), gate, finalInput, preToolContext: pass.preToolContext };
|
|
@@ -235,12 +257,12 @@ export async function untakenValueExit(pass, untaken) {
|
|
|
235
257
|
export async function unownedArgsExit(pass, reason) {
|
|
236
258
|
return await untakenValueExit(pass, { value: pass.currentInput, message: unownedArgsMessage(`the arguments of "${pass.toolName}"`, reason), deniedBy: "policy" });
|
|
237
259
|
}
|
|
238
|
-
export function hookDenyExit(pass, deniedReason) {
|
|
260
|
+
export function hookDenyExit(pass, deniedReason, extension) {
|
|
239
261
|
const { input } = pass;
|
|
240
262
|
return {
|
|
241
263
|
block: true,
|
|
242
264
|
reason: formatHookFeedback(deniedReason, input.reminderMark),
|
|
243
|
-
gate: directDeny("hook"),
|
|
265
|
+
gate: directDeny("hook", extension),
|
|
244
266
|
finalInput: frozenInputSnapshot(pass.currentInput),
|
|
245
267
|
preToolContext: pass.preToolContext,
|
|
246
268
|
};
|
|
@@ -269,7 +291,7 @@ export async function exitGate(pass) {
|
|
|
269
291
|
pass.deniedBy = "mode";
|
|
270
292
|
ledger.supersede();
|
|
271
293
|
}
|
|
272
|
-
const gate = mintGateOutcome({ deniedBy: pass.deniedBy, ...(pass.denyCause !== undefined ? { cause: pass.denyCause } : {}), ...(ledger.settled !== undefined ? { settled: ledger.settled } : {}), ...(pass.classifierRound !== undefined ? { classifier: pass.classifierRound } : {}), ...(modeRefusal !== undefined ? { modeRefusal: { mode: modeRefusal.mode, askClass: modeRefusal.askClass, classes: modeRefusal.classes } } : {}) });
|
|
294
|
+
const gate = mintGateOutcome({ deniedBy: pass.deniedBy, ...(pass.deniedBy === "hook" && pass.deniedExtension !== undefined ? { extension: pass.deniedExtension } : {}), ...(pass.denyCause !== undefined ? { cause: pass.denyCause } : {}), ...(ledger.settled !== undefined ? { settled: ledger.settled } : {}), ...(pass.classifierRound !== undefined ? { classifier: pass.classifierRound } : {}), ...(modeRefusal !== undefined ? { modeRefusal: { mode: modeRefusal.mode, askClass: modeRefusal.askClass, classes: modeRefusal.classes } } : {}) });
|
|
273
295
|
const foldCause = attestationOf(pass.decision, { toolCallId, toolName })?.unresolvableCause;
|
|
274
296
|
const unresolvable = foldCause ?? unresolvableCauseOfSettlement(gate);
|
|
275
297
|
const tableSeat = unresolvable !== undefined ? askUnresolvableRemedySeat(unresolvable) : undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AgentMessage, ExecutionEnv, GitAnnouncementKind, SessionTreeEntry } from "../../internal/harness-types.js";
|
|
1
|
+
import type { AgentMessage, ExecutionEnv, GitAnnouncementKind, ReadFloor, SessionTreeEntry } from "../../internal/harness-types.js";
|
|
2
2
|
/** Bound into the hash domain: bump when the frame's wording/structure changes so the upgraded
|
|
3
3
|
* renderer re-announces on its first leg instead of being suppressed by a pre-upgrade hash. */
|
|
4
4
|
export declare const GIT_STATUS_FRAME_FORMAT_VERSION = 1;
|
|
@@ -155,6 +155,9 @@ export declare function probeGitStatusLane(args: {
|
|
|
155
155
|
};
|
|
156
156
|
handsEnabled: boolean;
|
|
157
157
|
taskRoot: string;
|
|
158
|
+
/** The byte floor of the run's base read-deny table: the snapshot's lines enter the frame the model reads, so its start
|
|
159
|
+
* carries it (`git config` reads what an `include.path` names). */
|
|
160
|
+
readFloor?: ReadFloor;
|
|
158
161
|
onDegrade: (reason: string) => void;
|
|
159
162
|
}): Promise<GitStatusLaneRef>;
|
|
160
163
|
/**
|
|
@@ -189,7 +192,7 @@ export declare function newestEngineGitFrame(branch: SessionTreeEntry[], mark?:
|
|
|
189
192
|
entryId: string;
|
|
190
193
|
positive: boolean;
|
|
191
194
|
} | undefined;
|
|
192
|
-
export declare function stripGitStatusUnits(text: string
|
|
195
|
+
export declare function stripGitStatusUnits(text: string): string;
|
|
193
196
|
/**
|
|
194
197
|
* The readable-absence tombstone question (R2-1), answered by the classifier above: does the
|
|
195
198
|
* branch carry a still-context-visible POSITIVE engine frame as its newest git frame? A newest
|
|
@@ -62,7 +62,7 @@ export function resolveGitStatusFrame(outcome, canonicalRoot, degradedMaterial)
|
|
|
62
62
|
return resolved;
|
|
63
63
|
}
|
|
64
64
|
export async function probeGitStatusLane(args) {
|
|
65
|
-
const { executionEnv, envFacts, handsEnabled, taskRoot, onDegrade } = args;
|
|
65
|
+
const { executionEnv, envFacts, handsEnabled, taskRoot, readFloor, onDegrade } = args;
|
|
66
66
|
const ref = {};
|
|
67
67
|
if (!handsEnabled)
|
|
68
68
|
return ref;
|
|
@@ -75,7 +75,7 @@ export async function probeGitStatusLane(args) {
|
|
|
75
75
|
...(envFacts.gitDirty !== undefined ? { dirty: envFacts.gitDirty } : {}),
|
|
76
76
|
};
|
|
77
77
|
try {
|
|
78
|
-
const snap = await executionEnv.exec(`(m=$(git symbolic-ref --short refs/remotes/origin/HEAD 2>/dev/null); m=\${m#origin/}; for s in "$m" main master; do if [ -n "$s" ] && git show-ref --verify --quiet "refs/remotes/origin/$s"; then echo "$s"; break; fi; done) || true; echo "${SEP}"; (git config user.name 2>/dev/null || true); echo "${SEP}"; gs=$(git --no-optional-locks status --short) || exit 41; printf '%s\\n' "$gs"; echo "${SEP}"; gl=$(git --no-optional-locks log --oneline -n 5) || exit 42; printf '%s\\n' "$gl"`, { cwd: envFacts.cwd, timeout: 10 });
|
|
78
|
+
const snap = await executionEnv.exec(`(m=$(git symbolic-ref --short refs/remotes/origin/HEAD 2>/dev/null); m=\${m#origin/}; for s in "$m" main master; do if [ -n "$s" ] && git show-ref --verify --quiet "refs/remotes/origin/$s"; then echo "$s"; break; fi; done) || true; echo "${SEP}"; (git config user.name 2>/dev/null || true); echo "${SEP}"; gs=$(git --no-optional-locks status --short) || exit 41; printf '%s\\n' "$gs"; echo "${SEP}"; gl=$(git --no-optional-locks log --oneline -n 5) || exit 42; printf '%s\\n' "$gl"`, { cwd: envFacts.cwd, timeout: 10, ...(readFloor !== undefined ? { readFloor } : {}) });
|
|
79
79
|
if (snap.ok && snap.value.exitCode === 0) {
|
|
80
80
|
const parts = snap.value.stdout.split(`${SEP}\n`);
|
|
81
81
|
if (parts.length === 4) {
|
|
@@ -208,8 +208,7 @@ function hasNestedReminderOpenTag(seg) {
|
|
|
208
208
|
}
|
|
209
209
|
return false;
|
|
210
210
|
}
|
|
211
|
-
export function stripGitStatusUnits(text
|
|
212
|
-
void mark;
|
|
211
|
+
export function stripGitStatusUnits(text) {
|
|
213
212
|
const close = "</system-reminder>";
|
|
214
213
|
const findHead = (out, from) => {
|
|
215
214
|
for (let at = out.indexOf("<system-reminder", from); at !== -1; at = out.indexOf("<system-reminder", at + 1)) {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The run's account of the images a provider refused (`context.image_removed`, user). The harness's request view
|
|
3
|
+
* removes the images a provider refusal points at (`engine/llm/rejected-images.ts`) and hands this seat the removals
|
|
4
|
+
* the run itself met; every request re-reads the transcript — the live failure, then its record or a rebuilt copy —
|
|
5
|
+
* so the seat announces ONCE PER RUN PER REFUSAL, keyed by the identity all of those share (`refusalAt`).
|
|
6
|
+
*/
|
|
7
|
+
import { type EngineNotice } from "../engine-notice.js";
|
|
8
|
+
import type { RejectedImageRemoval } from "../../internal/llm.js";
|
|
9
|
+
export declare function createImageRemovedSeat(onNotice: ((notice: EngineNotice) => void) | undefined, ids: {
|
|
10
|
+
sessionId: string;
|
|
11
|
+
runId: string;
|
|
12
|
+
}): (removals: readonly RejectedImageRemoval[]) => void;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { deliverEngineNotice } from "../engine-notice.js";
|
|
2
|
+
export function createImageRemovedSeat(onNotice, ids) {
|
|
3
|
+
const announced = new Set();
|
|
4
|
+
return (removals) => {
|
|
5
|
+
for (const { refusalAt, images } of removals) {
|
|
6
|
+
if (announced.has(refusalAt))
|
|
7
|
+
continue;
|
|
8
|
+
announced.add(refusalAt);
|
|
9
|
+
const one = images === 1;
|
|
10
|
+
deliverEngineNotice(onNotice, {
|
|
11
|
+
code: "context.image_removed",
|
|
12
|
+
message: `The model provider could not process ${one ? "an image" : `${images} images`} in this conversation, so ${one ? "it was" : "they were"} removed ` +
|
|
13
|
+
`from what the model sees (each replaced by a line saying so) and the request was sent again without ${one ? "it" : "them"}. ` +
|
|
14
|
+
`The session still holds the original; to show the model this content again, send it in another format.`,
|
|
15
|
+
detail: { images, sessionId: ids.sessionId, runId: ids.runId },
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
}
|