@sema-agent/core 7.59.0 → 7.61.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 +1169 -0
- package/README.md +2 -2
- 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 +4 -3
- package/dist/agents/agent-transcript-tool.js +4 -2
- package/dist/agents/cascade.d.ts +61 -10
- package/dist/agents/cascade.js +60 -20
- package/dist/agents/child-model-seat.js +6 -3
- package/dist/agents/composition-allowance.d.ts +53 -0
- package/dist/agents/composition-allowance.js +49 -0
- package/dist/agents/composition-placement.d.ts +29 -0
- package/dist/agents/composition-placement.js +24 -0
- package/dist/agents/cumulative-stats.d.ts +4 -0
- package/dist/agents/cumulative-stats.js +3 -1
- package/dist/agents/inherited-tool-pool.d.ts +28 -1
- package/dist/agents/inherited-tool-pool.js +22 -0
- package/dist/agents/list-agents-tool.d.ts +1 -1
- package/dist/agents/peer-notice-route.d.ts +1 -1
- package/dist/agents/peer-notice-route.js +4 -3
- package/dist/agents/peer-notices.d.ts +4 -4
- package/dist/agents/peer-notices.js +8 -4
- package/dist/agents/peer-session-drain.d.ts +8 -1
- package/dist/agents/peer-session-drain.js +36 -7
- package/dist/agents/repair-loop.js +16 -6
- package/dist/agents/retain-ledger.d.ts +11 -1
- package/dist/agents/retain-ledger.js +16 -3
- package/dist/agents/roster-store.d.ts +2 -2
- package/dist/agents/roster-store.js +8 -3
- package/dist/agents/send-message-tool.d.ts +14 -27
- package/dist/agents/send-message-tool.js +47 -54
- package/dist/agents/subagent-completion-gate.d.ts +35 -0
- package/dist/agents/subagent-completion-gate.js +62 -0
- package/dist/agents/subagent-steps.d.ts +7 -6
- package/dist/agents/subagent.d.ts +52 -28
- package/dist/agents/subagent.js +276 -246
- package/dist/agents/suspend-guard.d.ts +9 -0
- package/dist/agents/suspend-guard.js +4 -0
- package/dist/agents/tool-filter.d.ts +1 -3
- package/dist/agents/tool-filter.js +4 -12
- package/dist/agents/verify.d.ts +41 -14
- package/dist/agents/verify.js +37 -27
- package/dist/bench/metrics.d.ts +3 -5
- package/dist/bench/metrics.js +0 -1
- package/dist/brain/anthropic.js +1 -0
- package/dist/brain/degrading.js +3 -1
- package/dist/brain/errors.d.ts +7 -1
- package/dist/brain/errors.js +6 -0
- package/dist/brain/failover.js +2 -1
- package/dist/brain/open-responses.js +1 -0
- package/dist/brain/openai.js +1 -0
- package/dist/brain/provider-dialect.d.ts +10 -0
- package/dist/brain/provider-dialect.js +13 -2
- package/dist/brain/route-adjudicator.js +3 -1
- package/dist/brain/status-sink.d.ts +7 -1
- package/dist/brain/status-sink.js +6 -0
- package/dist/brain/stream-engine.d.ts +3 -0
- package/dist/brain/stream-engine.js +4 -0
- package/dist/brain/timeout.d.ts +3 -1
- package/dist/brain/timeout.js +18 -5
- package/dist/core/a2a.d.ts +15 -5
- package/dist/core/a2a.js +34 -19
- package/dist/core/agent-definition.d.ts +20 -0
- package/dist/core/agent-state.d.ts +1 -1
- package/dist/core/allow-entry.d.ts +61 -23
- package/dist/core/allow-entry.js +134 -39
- package/dist/core/artifact-host.d.ts +0 -2
- package/dist/core/artifact-host.js +0 -1
- package/dist/core/ask-origin.d.ts +79 -0
- package/dist/core/ask-origin.js +76 -0
- package/dist/core/ask-question.d.ts +19 -13
- package/dist/core/ask-question.js +8 -2
- package/dist/core/auto-compaction.d.ts +2 -0
- package/dist/core/auto-compaction.js +2 -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 +66 -17
- package/dist/core/background-agent-store.d.ts +17 -6
- package/dist/core/background-agent-store.js +15 -13
- package/dist/core/background-shell.d.ts +12 -1
- package/dist/core/background-shell.js +12 -0
- package/dist/core/checkpoint-requirements.d.ts +24 -3
- package/dist/core/checkpoint-requirements.js +9 -1
- package/dist/core/checkpoint-store.d.ts +86 -32
- package/dist/core/checkpoint-store.js +10 -5
- package/dist/core/child-clamp-seats.d.ts +3 -2
- package/dist/core/child-clamp-seats.js +4 -3
- package/dist/core/closest-name.d.ts +13 -0
- package/dist/core/closest-name.js +35 -0
- package/dist/core/compliance.d.ts +1 -1
- package/dist/core/context-settings.js +3 -5
- 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 +5 -6
- package/dist/core/decision-receipt.d.ts +14 -1
- package/dist/core/decision-receipt.js +6 -3
- package/dist/core/delegation-frames.d.ts +13 -9
- package/dist/core/effective-path-target.js +2 -3
- package/dist/core/engine-attestation.d.ts +11 -1
- package/dist/core/engine-attestation.js +2 -0
- package/dist/core/engine-notice.d.ts +106 -32
- package/dist/core/file-history-retention.d.ts +8 -0
- package/dist/core/file-history-retention.js +14 -11
- package/dist/core/file-history-store.d.ts +31 -1
- package/dist/core/file-history-store.js +31 -2
- package/dist/core/frame-settlement.d.ts +15 -0
- package/dist/core/frame-settlement.js +10 -1
- package/dist/core/fs-write-gate-policy.d.ts +3 -3
- package/dist/core/fs-write-gate-policy.js +8 -7
- package/dist/core/gate-fold.js +9 -6
- package/dist/core/gate-lanes.js +46 -12
- package/dist/core/gate-outcome.d.ts +40 -1
- package/dist/core/gate-outcome.js +10 -0
- package/dist/core/git-worktree-env.d.ts +7 -3
- package/dist/core/git-worktree-env.js +16 -13
- package/dist/core/governance-codes.d.ts +19 -3
- package/dist/core/governance-codes.js +27 -3
- package/dist/core/hands-band-screen.js +0 -1
- package/dist/core/hands-band.d.ts +0 -3
- package/dist/core/hooks.d.ts +51 -60
- package/dist/core/hooks.js +131 -78
- package/dist/core/host-floor.js +3 -5
- package/dist/core/image-admission.d.ts +145 -52
- package/dist/core/image-admission.js +202 -47
- package/dist/core/image-downsample.d.ts +36 -69
- package/dist/core/image-downsample.js +111 -73
- package/dist/core/input-author.d.ts +36 -0
- package/dist/core/input-author.js +39 -0
- package/dist/core/integer-option.d.ts +21 -0
- package/dist/core/integer-option.js +13 -0
- package/dist/core/leg-identity.d.ts +62 -0
- package/dist/core/leg-identity.js +18 -0
- package/dist/core/locked-config.d.ts +55 -3
- package/dist/core/locked-config.js +84 -51
- package/dist/core/lsp.d.ts +5 -3
- package/dist/core/lsp.js +3 -2
- package/dist/core/mailbox-store.d.ts +85 -10
- package/dist/core/mailbox-store.js +31 -10
- package/dist/core/mcp-call-meta.d.ts +2 -2
- package/dist/core/mcp-call-meta.js +9 -10
- package/dist/core/mcp-connection-pool.d.ts +6 -20
- package/dist/core/mcp-connection-pool.js +10 -28
- package/dist/core/mcp-failure.d.ts +83 -16
- package/dist/core/mcp-failure.js +67 -30
- package/dist/core/mcp-host-seat.d.ts +131 -0
- package/dist/core/mcp-host-seat.js +305 -0
- package/dist/core/mcp-probe.d.ts +7 -2
- package/dist/core/mcp-probe.js +9 -4
- package/dist/core/mcp-server-link.d.ts +18 -6
- package/dist/core/mcp-server-link.js +19 -4
- package/dist/core/mcp-server-spec.d.ts +39 -9
- package/dist/core/mcp-server-spec.js +55 -21
- package/dist/core/mcp-session-end.d.ts +1 -2
- package/dist/core/mcp-session-end.js +1 -1
- package/dist/core/mcp.d.ts +23 -55
- package/dist/core/mcp.js +172 -156
- package/dist/core/media-byte-cap.d.ts +21 -46
- package/dist/core/media-byte-cap.js +55 -55
- package/dist/core/member-group.d.ts +7 -0
- package/dist/core/member-group.js +35 -0
- package/dist/core/memory-admission.d.ts +23 -6
- package/dist/core/memory-admission.js +19 -9
- package/dist/core/memory-engine/consolidation.d.ts +1 -1
- package/dist/core/memory-engine/consolidation.js +7 -1
- 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/dual-root.d.ts +31 -0
- package/dist/core/memory-engine/dual-root.js +59 -11
- package/dist/core/memory-engine/engine.js +27 -24
- package/dist/core/memory-engine/file-backend.d.ts +13 -0
- package/dist/core/memory-engine/file-backend.js +35 -15
- package/dist/core/memory-engine/index.d.ts +2 -1
- package/dist/core/memory-engine/index.js +2 -1
- package/dist/core/memory-engine/layout.d.ts +3 -0
- package/dist/core/memory-engine/layout.js +13 -3
- package/dist/core/memory-engine/memory-deployment.d.ts +110 -0
- package/dist/core/memory-engine/memory-deployment.js +182 -0
- 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 +68 -13
- package/dist/core/memory-engine/sync-client.js +147 -18
- package/dist/core/memory-engine/sync-report.d.ts +106 -0
- package/dist/core/memory-engine/sync-report.js +119 -0
- package/dist/core/memory-engine/sync.d.ts +13 -3
- package/dist/core/mode-policy.d.ts +15 -7
- package/dist/core/mode-policy.js +18 -6
- 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 +100 -0
- package/dist/core/mods/agent-stations.js +154 -0
- package/dist/core/mods/dollar.d.ts +62 -0
- package/dist/core/mods/extension-call.d.ts +15 -1
- package/dist/core/mods/extension-call.js +7 -2
- package/dist/core/mods/kernel/dispatch.d.ts +9 -4
- package/dist/core/mods/kernel/dispatch.js +8 -8
- package/dist/core/mods/kernel/events.d.ts +13 -4
- package/dist/core/mods/kernel/events.js +14 -10
- 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 +3 -0
- package/dist/core/mods/kernel/registration.js +5 -0
- package/dist/core/mods/kernel/site-rules.d.ts +6 -3
- package/dist/core/mods/kernel/site-rules.js +10 -2
- package/dist/core/mods/lifecycle-stations.d.ts +41 -0
- package/dist/core/mods/lifecycle-stations.js +35 -0
- package/dist/core/mods/session-append.d.ts +115 -0
- package/dist/core/mods/session-append.js +311 -0
- package/dist/core/mods/session-compact.d.ts +48 -0
- package/dist/core/mods/session-compact.js +194 -0
- package/dist/core/mods/session-receive.d.ts +93 -0
- package/dist/core/mods/session-receive.js +141 -0
- package/dist/core/mods/session-send.d.ts +72 -0
- package/dist/core/mods/session-send.js +88 -0
- package/dist/core/mods/stations.d.ts +89 -75
- package/dist/core/mods/stations.js +57 -53
- package/dist/core/mods/tool-call.d.ts +12 -4
- package/dist/core/mods/tool-call.js +32 -16
- 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/output-style.js +3 -4
- package/dist/core/own-property-receipt.d.ts +62 -0
- package/dist/core/own-property-receipt.js +43 -0
- package/dist/core/park-selfcheck.js +12 -10
- package/dist/core/path-identity.d.ts +11 -0
- package/dist/core/path-identity.js +4 -0
- package/dist/core/path-rule-binding.d.ts +3 -1
- package/dist/core/path-rule-binding.js +3 -1
- package/dist/core/peer-seat.d.ts +66 -11
- package/dist/core/peer-seat.js +199 -42
- package/dist/core/permission-rule-consent.d.ts +21 -26
- package/dist/core/permission-rule-consent.js +22 -3
- package/dist/core/permission-rule-model.d.ts +38 -13
- package/dist/core/permission-rule-model.js +54 -16
- package/dist/core/permission-rule-org.d.ts +1 -1
- package/dist/core/permission-rule-provider.js +4 -1
- package/dist/core/permission-rules.d.ts +4 -0
- package/dist/core/permission-rules.js +11 -16
- 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 +218 -122
- package/dist/core/remote-env.js +133 -14
- package/dist/core/retention-policy.d.ts +24 -23
- package/dist/core/retention-policy.js +36 -2
- package/dist/core/retention.d.ts +4 -1
- package/dist/core/retention.js +37 -12
- package/dist/core/retired-keys.d.ts +8 -3
- package/dist/core/retired-keys.js +4 -1
- package/dist/core/rewrite-rejudge.d.ts +12 -5
- package/dist/core/rewrite-rejudge.js +9 -5
- package/dist/core/roles.d.ts +37 -3
- package/dist/core/roles.js +126 -78
- package/dist/core/row-admission.d.ts +10 -0
- package/dist/core/row-admission.js +5 -0
- package/dist/core/rule-owner.d.ts +3 -0
- package/dist/core/runner/advisor-instructions.d.ts +2 -1
- package/dist/core/runner/advisor-instructions.js +2 -1
- package/dist/core/runner/announce-once-ledger.d.ts +4 -4
- package/dist/core/runner/assemble-result.d.ts +13 -8
- package/dist/core/runner/assemble-result.js +12 -8
- package/dist/core/runner/call-hook-stations.d.ts +17 -10
- package/dist/core/runner/call-hook-stations.js +21 -10
- package/dist/core/runner/caller-roster.d.ts +12 -9
- package/dist/core/runner/caller-roster.js +5 -2
- package/dist/core/runner/checkpoint-scope.d.ts +16 -1
- package/dist/core/runner/checkpoint-scope.js +21 -0
- 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/compact-session.js +14 -2
- package/dist/core/runner/compaction-call-options.d.ts +1 -1
- package/dist/core/runner/compaction-restate.d.ts +2 -2
- package/dist/core/runner/compaction-restate.js +4 -3
- package/dist/core/runner/construction-doors.d.ts +2 -2
- package/dist/core/runner/construction-doors.js +7 -2
- package/dist/core/runner/contracts.d.ts +158 -65
- package/dist/core/runner/cross-boundary-lane.d.ts +4 -6
- package/dist/core/runner/cross-boundary-lane.js +11 -2
- package/dist/core/runner/decide-continuation.d.ts +4 -2
- package/dist/core/runner/decide-continuation.js +7 -4
- package/dist/core/runner/denial-limit-arms.d.ts +15 -21
- package/dist/core/runner/denial-limit-arms.js +17 -10
- 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/expire-settle.d.ts +44 -0
- package/dist/core/runner/expire-settle.js +55 -0
- 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 +75 -7
- package/dist/core/runner/gate-exit.js +20 -1
- package/dist/core/runner/git-status-frame.d.ts +5 -2
- package/dist/core/runner/git-status-frame.js +4 -4
- package/dist/core/runner/halt-attribution.d.ts +2 -1
- package/dist/core/runner/halt-attribution.js +2 -1
- 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/local-claims.d.ts +17 -0
- package/dist/core/runner/local-claims.js +18 -0
- package/dist/core/runner/media-removed-seat.d.ts +46 -0
- package/dist/core/runner/media-removed-seat.js +88 -0
- package/dist/core/runner/memory-consolidation-driver.js +4 -4
- package/dist/core/runner/park-commit.d.ts +2 -2
- package/dist/core/runner/permission-rule-lanes.d.ts +5 -1
- package/dist/core/runner/permission-rule-lanes.js +29 -10
- package/dist/core/runner/person-path-rows.js +1 -1
- package/dist/core/runner/placement-fence.d.ts +26 -0
- package/dist/core/runner/placement-fence.js +38 -0
- package/dist/core/runner/prepare-ask-lane.d.ts +6 -12
- package/dist/core/runner/prepare-ask-lane.js +4 -4
- package/dist/core/runner/prepare-boundary-parks.d.ts +6 -3
- package/dist/core/runner/prepare-boundary-parks.js +4 -4
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +6 -0
- package/dist/core/runner/prepare-caps-and-workflow.js +5 -3
- package/dist/core/runner/prepare-config-doors.d.ts +6 -1
- package/dist/core/runner/prepare-config-doors.js +30 -26
- package/dist/core/runner/prepare-context-lane.d.ts +6 -2
- package/dist/core/runner/prepare-context-lane.js +13 -13
- package/dist/core/runner/prepare-delegation-surface.d.ts +13 -11
- package/dist/core/runner/prepare-delegation-surface.js +7 -8
- package/dist/core/runner/prepare-execution-env.d.ts +5 -2
- package/dist/core/runner/prepare-execution-env.js +7 -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 +23 -17
- package/dist/core/runner/prepare-gate-stations.js +10 -7
- package/dist/core/runner/prepare-hands-readface.d.ts +8 -6
- package/dist/core/runner/prepare-hands-readface.js +19 -11
- package/dist/core/runner/prepare-inherited-gate.d.ts +11 -4
- package/dist/core/runner/prepare-inherited-gate.js +12 -5
- package/dist/core/runner/prepare-lsp.d.ts +3 -0
- package/dist/core/runner/prepare-lsp.js +2 -2
- 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 +2 -2
- package/dist/core/runner/prepare-park-ask.d.ts +8 -7
- package/dist/core/runner/prepare-park-ask.js +6 -12
- package/dist/core/runner/prepare-policy-chain.d.ts +15 -25
- package/dist/core/runner/prepare-policy-chain.js +131 -128
- package/dist/core/runner/prepare-project-context.d.ts +2 -2
- package/dist/core/runner/prepare-project-context.js +8 -5
- package/dist/core/runner/prepare-prompt-inputs.d.ts +4 -0
- package/dist/core/runner/prepare-prompt-inputs.js +4 -2
- package/dist/core/runner/prepare-protocol-tools.d.ts +5 -3
- package/dist/core/runner/prepare-protocol-tools.js +9 -2
- package/dist/core/runner/prepare-question-face.d.ts +6 -4
- package/dist/core/runner/prepare-question-face.js +2 -2
- package/dist/core/runner/prepare-run-refs.d.ts +3 -0
- package/dist/core/runner/prepare-run-refs.js +2 -2
- package/dist/core/runner/prepare-suspend-saga.d.ts +11 -9
- package/dist/core/runner/prepare-suspend-saga.js +21 -13
- package/dist/core/runner/prepare-task.d.ts +1 -1
- package/dist/core/runner/prepare-task.js +84 -42
- package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +6 -0
- package/dist/core/runner/prepare-tool-disclosure-mount.js +3 -1
- 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 +7 -3
- package/dist/core/runner/prepare-wiring-manifest.js +34 -19
- package/dist/core/runner/prepare-workspace-restore.d.ts +5 -0
- package/dist/core/runner/prepare-workspace-restore.js +12 -8
- package/dist/core/runner/read-root-grant.d.ts +1 -1
- package/dist/core/runner/read-root-grant.js +2 -1
- package/dist/core/runner/resume-admission.d.ts +5 -3
- package/dist/core/runner/resume-admission.js +17 -3
- package/dist/core/runner/resume-apply.js +3 -1
- package/dist/core/runner/resume-checkpoint-screen.js +4 -4
- package/dist/core/runner/resume-claim.d.ts +8 -3
- package/dist/core/runner/resume-claim.js +28 -12
- package/dist/core/runner/resume-internals-and-config.d.ts +2 -2
- package/dist/core/runner/resume-internals-and-config.js +10 -1
- package/dist/core/runner/resume-preflight.d.ts +3 -2
- package/dist/core/runner/resume-preflight.js +13 -26
- package/dist/core/runner/retired-runner-deps.js +6 -1
- package/dist/core/runner/run-attachment-seats.js +3 -3
- package/dist/core/runner/run-brain-sinks.js +1 -0
- package/dist/core/runner/run-git-lane.d.ts +3 -1
- package/dist/core/runner/run-git-lane.js +3 -2
- package/dist/core/runner/run-harness-handlers.d.ts +3 -1
- package/dist/core/runner/run-harness-handlers.js +5 -3
- package/dist/core/runner/run-identity-wiring.d.ts +2 -2
- package/dist/core/runner/run-identity-wiring.js +15 -6
- package/dist/core/runner/run-leg.d.ts +3 -3
- package/dist/core/runner/run-leg.js +65 -56
- package/dist/core/runner/run-notification-lane.d.ts +3 -1
- package/dist/core/runner/run-notification-lane.js +36 -12
- package/dist/core/runner/run-recovery-lanes.js +3 -2
- package/dist/core/runner/run-settle-and-teardown.js +14 -8
- package/dist/core/runner/run-stop-and-final-verify.d.ts +4 -0
- package/dist/core/runner/run-stop-and-final-verify.js +12 -4
- package/dist/core/runner/run-telemetry-and-budget-seats.d.ts +1 -1
- package/dist/core/runner/run-terminal-adoption.d.ts +1 -1
- package/dist/core/runner/run-terminal-adoption.js +26 -17
- package/dist/core/runner/run-turn-boundary.js +37 -19
- package/dist/core/runner/runtask.d.ts +25 -7
- package/dist/core/runner/runtask.js +46 -22
- package/dist/core/runner/session-rule-policy.d.ts +1 -1
- package/dist/core/runner/session-rule-policy.js +6 -1
- package/dist/core/runner/shell-env-withheld.d.ts +1 -1
- package/dist/core/runner/skills-seat.js +2 -2
- package/dist/core/runner/stream-halt-verbs.d.ts +1 -14
- package/dist/core/runner/stream-halt-verbs.js +4 -3
- package/dist/core/runner/stream-reap.d.ts +7 -6
- package/dist/core/runner/stream-reap.js +13 -16
- package/dist/core/runner/stream-settle-backstop.d.ts +3 -2
- package/dist/core/runner/stream-settle-backstop.js +5 -3
- package/dist/core/runner/stream-steer-verb.d.ts +5 -2
- package/dist/core/runner/stream-steer-verb.js +8 -7
- package/dist/core/runner/sub-agent-deny-lists.js +10 -7
- package/dist/core/runner/synthetic-tools.js +2 -2
- package/dist/core/runner/terminal-account.d.ts +11 -1
- package/dist/core/runner/terminal-account.js +20 -0
- package/dist/core/runner/terminal-projection.d.ts +8 -2
- package/dist/core/runner/terminal-projection.js +2 -2
- package/dist/core/runner/tool-disclosure.d.ts +3 -0
- package/dist/core/runner/tool-disclosure.js +5 -4
- package/dist/core/runner/tool-end-body.d.ts +3 -3
- package/dist/core/runner/tool-end-body.js +1 -1
- 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-output-projection.d.ts +3 -3
- package/dist/core/runner/tool-output-projection.js +7 -6
- 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/tool-table-view.d.ts +56 -0
- package/dist/core/runner/tool-table-view.js +51 -0
- package/dist/core/runner/turn-attachments.d.ts +6 -7
- package/dist/core/runner/turn-attachments.js +4 -17
- package/dist/core/runner/void-verifier-pause.d.ts +33 -0
- package/dist/core/runner/void-verifier-pause.js +41 -0
- package/dist/core/runner-deps.d.ts +55 -43
- package/dist/core/secret-env.d.ts +14 -13
- package/dist/core/secret-env.js +8 -9
- package/dist/core/session-log-transfer.js +9 -10
- package/dist/core/session-policy-store.d.ts +10 -3
- package/dist/core/session-policy-store.js +21 -3
- package/dist/core/session-reconcile.d.ts +3 -2
- package/dist/core/session-reconcile.js +7 -4
- package/dist/core/session-store.d.ts +5 -2
- package/dist/core/session-store.js +53 -16
- package/dist/core/session.d.ts +2 -1
- package/dist/core/shell-confinement.d.ts +37 -0
- package/dist/core/shell-confinement.js +56 -0
- package/dist/core/skill-grant.d.ts +9 -0
- package/dist/core/skill-grant.js +18 -0
- package/dist/core/store-contracts/checkpoint-store-contract.d.ts +2 -2
- package/dist/core/store-contracts/checkpoint-store-contract.js +15 -2
- package/dist/core/store-contracts/file-history-store-contract.d.ts +5 -2
- package/dist/core/store-contracts/file-history-store-contract.js +25 -1
- package/dist/core/store-contracts/mailbox-store-contract.d.ts +12 -5
- package/dist/core/store-contracts/mailbox-store-contract.js +156 -9
- package/dist/core/store-contracts/tool-result-store-contract.d.ts +1 -1
- package/dist/core/store-contracts/tool-result-store-contract.js +67 -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/task-event.d.ts +35 -10
- package/dist/core/task-limits.d.ts +5 -0
- package/dist/core/task-notification.d.ts +172 -12
- package/dist/core/task-notification.js +209 -12
- package/dist/core/task-registry-agent.d.ts +23 -55
- package/dist/core/task-registry-agent.js +41 -56
- package/dist/core/task-registry-monitor.d.ts +8 -1
- package/dist/core/task-registry-monitor.js +43 -61
- package/dist/core/task-registry-shared.d.ts +52 -114
- package/dist/core/task-registry-shared.js +24 -48
- package/dist/core/task-registry-workflow.js +5 -22
- package/dist/core/task-registry.d.ts +64 -90
- package/dist/core/task-registry.js +73 -119
- package/dist/core/task-result.d.ts +27 -19
- package/dist/core/task-spec-members.d.ts +39 -0
- package/dist/core/task-spec-members.js +92 -0
- package/dist/core/task-spec.d.ts +13 -16
- package/dist/core/task-stream.d.ts +1 -1
- package/dist/core/task-tool-shape.d.ts +7 -57
- package/dist/core/task-tool-shape.js +7 -66
- package/dist/core/terminal-cause.d.ts +30 -0
- package/dist/core/terminal-cause.js +1 -0
- package/dist/core/tool-catalog-entries.js +3 -6
- package/dist/core/tool-check-reading.js +16 -10
- package/dist/core/tool-conformance.js +1 -2
- package/dist/core/tool-errors.d.ts +6 -3
- package/dist/core/tool-errors.js +2 -0
- package/dist/core/tool-face-reader.d.ts +7 -6
- package/dist/core/tool-face-reader.js +6 -4
- package/dist/core/tool-face.d.ts +2 -3
- package/dist/core/tool-name-aliases.d.ts +23 -28
- package/dist/core/tool-name-aliases.js +63 -7
- package/dist/core/tool-name-readings.d.ts +14 -3
- package/dist/core/tool-name-readings.js +2 -0
- package/dist/core/tool-policy.d.ts +113 -22
- package/dist/core/tool-policy.js +85 -15
- 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 +111 -5
- package/dist/core/tool-result-store.js +52 -12
- package/dist/core/tool-spec.d.ts +39 -10
- package/dist/core/trace.d.ts +18 -2
- package/dist/core/types.d.ts +3 -3
- package/dist/core/types.js +1 -1
- package/dist/core/untrusted-text.js +1 -1
- package/dist/core/user-attachment.d.ts +10 -5
- package/dist/core/user-attachment.js +40 -27
- package/dist/core/workflow-journal-store.d.ts +1 -1
- package/dist/core/workflow-run-store.d.ts +2 -0
- package/dist/core/workflow-run-store.js +6 -5
- package/dist/core/workflow-settled-run.d.ts +5 -0
- package/dist/core/workflow-settled-run.js +7 -0
- package/dist/engine/execution-env/node-execution-env.d.ts +37 -7
- package/dist/engine/execution-env/node-execution-env.js +224 -21
- package/dist/engine/harness/agent-harness.d.ts +66 -19
- package/dist/engine/harness/agent-harness.js +98 -27
- package/dist/engine/harness/messages.d.ts +4 -3
- package/dist/engine/harness/messages.js +2 -2
- package/dist/engine/harness/types.d.ts +151 -34
- package/dist/engine/llm/media-removed.d.ts +14 -0
- package/dist/engine/llm/media-removed.js +9 -0
- package/dist/engine/llm/rejected-images.d.ts +35 -25
- package/dist/engine/llm/rejected-images.js +59 -10
- package/dist/engine/llm/types.d.ts +24 -3
- package/dist/engine/llm/types.js +7 -3
- package/dist/engine/loop/agent-loop.d.ts +18 -13
- package/dist/engine/loop/agent-loop.js +173 -32
- package/dist/engine/loop/types.d.ts +21 -5
- 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/import-validate.js +7 -0
- package/dist/fixtures/index.d.ts +7 -5
- package/dist/fixtures/index.js +5 -3
- package/dist/index.d.ts +41 -23
- package/dist/index.js +29 -16
- package/dist/internal/harness-types.d.ts +3 -1
- package/dist/internal/llm.d.ts +2 -1
- package/dist/internal/llm.js +1 -0
- package/dist/orchestration/goal.d.ts +6 -2
- package/dist/orchestration/goal.js +6 -3
- package/dist/orchestration/run-workflow-tool.d.ts +20 -20
- package/dist/orchestration/run-workflow-tool.js +63 -56
- package/dist/orchestration/workflow-governance.d.ts +1 -1
- package/dist/orchestration/workflow-governance.js +2 -1
- package/dist/orchestration/workflow-types.d.ts +2 -2
- package/dist/orchestration/workflow.d.ts +8 -0
- package/dist/orchestration/workflow.js +33 -9
- package/dist/prompts/default.d.ts +1 -10
- package/dist/prompts/default.js +0 -2
- package/dist/stores/file/background-agent-store.d.ts +1 -1
- package/dist/stores/file/background-agent-store.js +19 -14
- package/dist/stores/file/checkpoint-store.d.ts +127 -2
- package/dist/stores/file/checkpoint-store.js +24 -16
- package/dist/stores/file/file-history-store.d.ts +1 -1
- package/dist/stores/file/file-history-store.js +4 -1
- package/dist/stores/file/index.d.ts +9 -6
- package/dist/stores/file/index.js +33 -9
- package/dist/stores/file/ledger-tuning.d.ts +23 -0
- package/dist/stores/file/ledger-tuning.js +21 -0
- package/dist/stores/file/mailbox-store.d.ts +1 -1
- package/dist/stores/file/mailbox-store.js +43 -21
- package/dist/stores/file/memory-store.d.ts +1 -1
- package/dist/stores/file/memory-store.js +4 -1
- package/dist/stores/file/permission-rule-adopt.js +24 -21
- package/dist/stores/file/permission-rule-store.js +6 -3
- package/dist/stores/file/session-policy-store.d.ts +1 -1
- package/dist/stores/file/session-policy-store.js +4 -1
- package/dist/stores/file/session-store.d.ts +17 -4
- package/dist/stores/file/session-store.js +22 -19
- 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 +31 -2
- package/dist/stores/file/tool-result-store.js +129 -7
- package/dist/stores/file/usage-window-store.d.ts +1 -1
- package/dist/stores/file/usage-window-store.js +4 -1
- package/dist/stores/file/workflow-journal-store.d.ts +1 -13
- package/dist/stores/file/workflow-journal-store.js +4 -18
- package/dist/stores/file/workflow-run-store.d.ts +1 -1
- package/dist/stores/file/workflow-run-store.js +15 -10
- package/dist/tools/fs/containment-face.d.ts +5 -0
- package/dist/tools/fs/dead-cwd.d.ts +5 -5
- package/dist/tools/fs/dead-cwd.js +4 -11
- 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 +13 -0
- package/dist/tools/fs/fs-bash-background-text.js +7 -0
- package/dist/tools/fs/fs-bash.d.ts +11 -22
- package/dist/tools/fs/fs-bash.js +58 -154
- package/dist/tools/fs/fs-pdf.d.ts +2 -2
- package/dist/tools/fs/fs-pdf.js +34 -27
- 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 +39 -16
- package/dist/tools/fs/fs-shared.js +25 -6
- package/dist/tools/fs/fs-write.js +5 -5
- package/dist/tools/fs/index.d.ts +15 -9
- package/dist/tools/fs/index.js +12 -18
- package/dist/tools/fs/pdf.d.ts +4 -4
- package/dist/tools/fs/pdf.js +6 -6
- package/dist/tools/fs/read-deny-home.js +8 -1
- package/dist/tools/fs/read-deny.d.ts +26 -2
- package/dist/tools/fs/read-deny.js +9 -2
- package/dist/tools/fs/read-floor.d.ts +57 -6
- package/dist/tools/fs/read-floor.js +241 -2
- 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 +6 -5
- package/dist/tools/fs/search.js +10 -10
- package/dist/tools/fs/shell-read-establish.js +3 -1
- package/dist/tools/fs/shell-read-identity.d.ts +3 -1
- package/dist/tools/fs/shell-read-identity.js +4 -2
- package/dist/tools/fs/shell-read-judge.d.ts +7 -1
- package/dist/tools/fs/shell-read-judge.js +1 -1
- package/dist/tools/monitor.d.ts +12 -10
- package/dist/tools/monitor.js +22 -13
- package/dist/tools/scheduler-tools.js +42 -4
- package/dist/tools/web.d.ts +0 -10
- package/dist/tools/web.js +1 -4
- package/dist/tools/worktree.d.ts +5 -1
- package/dist/tools/worktree.js +20 -17
- package/package.json +8 -3
- package/test/export-surface.snapshot.json +166 -30
- package/wire-changes/core-stores-sql@7.60.0.json +30 -0
- package/wire-changes/core-stores-sql@7.61.0.json +480 -0
- package/wire-changes/core@7.60.0.json +3274 -0
- package/wire-changes/core@7.61.0.json +4405 -0
- package/wire-changes/mods-kernel@7.60.0.json +62 -0
- package/wire-changes/mods-kernel@7.61.0.json +65 -0
- package/wire-changes/primitives@7.60.0.json +30 -0
- package/wire-changes/primitives@7.61.0.json +30 -0
- package/dist/core/runner/image-removed-seat.d.ts +0 -12
- package/dist/core/runner/image-removed-seat.js +0 -19
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { createPreToolUseScreening, formatHookFeedback } from "../hooks.js";
|
|
2
2
|
import { classicEventBase, dispatchClassic, stringMembersAnswer, stringMembersOf } from "../mods/stations.js";
|
|
3
3
|
import { policyCannotAnswer } from "../real-approval.js";
|
|
4
|
+
import { decisionText } from "../tool-policy.js";
|
|
4
5
|
import { rosterToolName } from "../tool-roster.js";
|
|
5
6
|
import { wireOf } from "../tool-name-readings.js";
|
|
6
|
-
import { noteHostRewrite } from "../frame-settlement.js";
|
|
7
|
+
import { noteHostRewrite, settleWithheldResult } from "../frame-settlement.js";
|
|
8
|
+
import { extensionWords } from "../untrusted-egress.js";
|
|
7
9
|
function postToolUseAnswer(answer) {
|
|
8
10
|
const strings = stringMembersAnswer("classic.PostToolUse", ["additionalContext"])(answer);
|
|
9
11
|
if (strings !== undefined || typeof answer !== "object" || answer === null)
|
|
@@ -21,8 +23,8 @@ function isContentBlock(c) {
|
|
|
21
23
|
return typeof c === "object" && c !== null && typeof Reflect.get(c, "type") === "string";
|
|
22
24
|
}
|
|
23
25
|
export function createToolResultStation(input) {
|
|
24
|
-
const { modBus, blockedToolCalls, toolRosterDeltas, preToolContexts, abortController, spec, handsCwdRef, hookEnvFace, hookIdentity, permissionMode, reminderMark, frameSettlement } = input;
|
|
25
|
-
const toolResultStationArmed = modBus.hasHandlers("classic.PostToolUse") || modBus.hasHandlers("classic.PreToolUse") || modBus.hasHandlers("classic.PostToolUseFailure");
|
|
26
|
+
const { modBus, blockedToolCalls, toolRosterDeltas, preToolContexts, inheritedScreens, abortController, spec, handsCwdRef, hookEnvFace, hookIdentity, permissionMode, reminderMark, frameSettlement } = input;
|
|
27
|
+
const toolResultStationArmed = modBus.hasHandlers("classic.PostToolUse") || modBus.hasHandlers("classic.PreToolUse") || modBus.hasHandlers("classic.PostToolUseFailure") || inheritedScreens;
|
|
26
28
|
if (toolResultStationArmed) {
|
|
27
29
|
return async (e) => {
|
|
28
30
|
if (blockedToolCalls.delete(e.toolCallId)) {
|
|
@@ -30,6 +32,7 @@ export function createToolResultStation(input) {
|
|
|
30
32
|
}
|
|
31
33
|
let content = e.content;
|
|
32
34
|
let changed = false;
|
|
35
|
+
let withheld = false;
|
|
33
36
|
const post = { toolName: rosterToolName(toolRosterDeltas.current, e.toolName) };
|
|
34
37
|
const callFacts = (tool) => ({
|
|
35
38
|
...classicEventBase(hookIdentity, permissionMode.observed),
|
|
@@ -65,7 +68,13 @@ export function createToolResultStation(input) {
|
|
|
65
68
|
}
|
|
66
69
|
}
|
|
67
70
|
else if (modBus.hasHandlers("classic.PostToolUse")) {
|
|
68
|
-
const outcome = await dispatchClassic(modBus, "classic.PostToolUse", { ...callFacts(wireOf("hook.postToolUse", post)), output: { content: e.content, details: e.details, isError: e.isError } }, { signal: abortController.signal, checkAnswer: postToolUseAnswer }).catch(() =>
|
|
71
|
+
const outcome = await dispatchClassic(modBus, "classic.PostToolUse", { ...callFacts(wireOf("hook.postToolUse", post)), output: { content: e.content, details: e.details, isError: e.isError } }, { signal: abortController.signal, checkAnswer: postToolUseAnswer }).catch(() => ({ kind: "rejected" }));
|
|
72
|
+
if (outcome?.kind === "failed" || outcome?.kind === "rejected") {
|
|
73
|
+
content = [{ type: "text", text: formatHookFeedback(`the result of this call to "${extensionWords(post.toolName, 80)}" could not be given to the classic.PostToolUse extensions that check it: a hook that checks this result could not hand back its answer, so the result is withheld — the call ran (fail-closed)`, reminderMark) }];
|
|
74
|
+
withheld = true;
|
|
75
|
+
changed = true;
|
|
76
|
+
settleWithheldResult(frameSettlement, e.toolCallId, content);
|
|
77
|
+
}
|
|
69
78
|
const answer = outcome?.kind === "answered" ? outcome.answer : undefined;
|
|
70
79
|
const updatedOutput = updatedOutputOf(answer);
|
|
71
80
|
const patch = stringMembersOf(answer, ["additionalContext"]);
|
|
@@ -85,7 +94,7 @@ export function createToolResultStation(input) {
|
|
|
85
94
|
content = [...content, ...pre.map((t) => ({ type: "text", text: formatHookFeedback(t, reminderMark) }))];
|
|
86
95
|
changed = true;
|
|
87
96
|
}
|
|
88
|
-
return changed ? { content } : undefined;
|
|
97
|
+
return changed ? { content, ...(withheld ? { details: {}, isError: true } : {}) } : undefined;
|
|
89
98
|
};
|
|
90
99
|
}
|
|
91
100
|
return undefined;
|
|
@@ -105,20 +114,22 @@ export function createApprovedCallScreen(input) {
|
|
|
105
114
|
abortSignal: abortController.signal,
|
|
106
115
|
});
|
|
107
116
|
if (screening === undefined)
|
|
108
|
-
return {
|
|
117
|
+
return { admit: () => undefined };
|
|
109
118
|
const subject = `this call to "${toolName}"`;
|
|
110
119
|
const screened = await screening.screen(args, subject);
|
|
111
120
|
if (screened.kind === "refused")
|
|
112
121
|
return { refused: screened.reason, ...(screened.extension !== undefined ? { extension: screened.extension } : {}) };
|
|
122
|
+
if (screened.kind === "settled")
|
|
123
|
+
return { refused: decisionText(screened.deny) ?? `${subject} was refused` };
|
|
113
124
|
const r = screened.answer;
|
|
114
125
|
if (r?.action === "deny")
|
|
115
126
|
return { refused: screening.deniedReason(r), ...(screened.answeredBy !== undefined ? { extension: screened.answeredBy } : {}) };
|
|
116
127
|
if (r !== undefined && policyCannotAnswer(r, decidedBy))
|
|
117
128
|
return { refused: `a PreToolUse hook requires a person's approval for ${subject}, and this approval was the deployment's policy — not executed` };
|
|
118
|
-
const
|
|
119
|
-
return {
|
|
120
|
-
if (
|
|
121
|
-
preToolContexts.set(toolCallId, [
|
|
129
|
+
const contexts = screened.contexts;
|
|
130
|
+
return { admit: () => {
|
|
131
|
+
if (contexts.length > 0)
|
|
132
|
+
preToolContexts.set(toolCallId, [...contexts]);
|
|
122
133
|
} };
|
|
123
134
|
};
|
|
124
135
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The caller roster's ONE snapshot (#1167). A run's tool roster is the
|
|
3
|
-
*
|
|
4
|
-
* rebinds onto a private copy of the spec whose `tools` is an own, fixed
|
|
5
|
-
* FACES, each member read once (an omitted roster stays omitted, a value that is
|
|
6
|
-
*
|
|
2
|
+
* The caller roster's ONE snapshot (#1167). A run's tool roster is the array the run's one read of the caller's spec took for
|
|
3
|
+
* `tools` (`readCallerSpec`, at the run's entrance), its entries as they stand when prepare starts — before its first await — and
|
|
4
|
+
* nothing later, down to each entry's members: the driver rebinds onto a private copy of the spec whose `tools` is an own, fixed
|
|
5
|
+
* data property — a frozen array of frozen entry FACES, each member read once (an omitted roster stays omitted, a value that is
|
|
6
|
+
* no array stays as read). The safety scan, the mount, the listings and every other phase read those faces,
|
|
7
7
|
* so no phase can read the caller's objects a second time after a caller microtask had the chance to change them —
|
|
8
8
|
* not the array (a push, a reassignment of `spec.tools`) and not an entry (a name, an effect or egress mark, a schema,
|
|
9
9
|
* the `execute` function swapped in place, a getter or a Proxy answering differently on a later read).
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
*/
|
|
33
33
|
import type { AgentTool } from "../../internal/harness.js";
|
|
34
34
|
import type { TaskSpec } from "../types.js";
|
|
35
|
+
import { type CallerSpecRead } from "../task-spec-members.js";
|
|
35
36
|
import type { ToolSpec } from "../tool-spec.js";
|
|
36
37
|
import type { ToolDeclarationCode } from "../governance-codes.js";
|
|
37
38
|
import { type ToolCtxEnricher } from "../tools.js";
|
|
@@ -85,12 +86,14 @@ export declare function rosterFaceOf(t: unknown, index: number): RosterFace;
|
|
|
85
86
|
* run mounts is built from the face around the rebound `execute` ({@link mountedProduct}). `undefined` when the entry is
|
|
86
87
|
* not a product's face (the mount's ToolSpec arm takes it). */
|
|
87
88
|
export declare function rebindProductEntry(entry: object, enrich: ToolCtxEnricher): AgentTool | undefined;
|
|
88
|
-
/** Take the snapshot and rebind onto a private spec copy carrying it. The
|
|
89
|
-
*
|
|
90
|
-
* `tools`
|
|
91
|
-
|
|
89
|
+
/** Take the snapshot and rebind onto a private spec copy carrying it. The spec is taken through its one read
|
|
90
|
+
* (`readCallerSpec` — the read the run took at its entrance, answered again for its snapshot): the read's snapshot is plain
|
|
91
|
+
* own data, so the copy is that snapshot with `tools` replaced by its own frozen array of faces when the request carried one.
|
|
92
|
+
* The caller's own object is kept for {@link refuseLateRosterChanges} only; the read's refusal is handed back for prepare's door. */
|
|
93
|
+
export declare function snapshotCallerRoster(handedSpec: TaskSpec): {
|
|
92
94
|
spec: RosterSpec;
|
|
93
95
|
roster: CallerRosterSnapshot;
|
|
96
|
+
refusal: CallerSpecRead["refusal"];
|
|
94
97
|
};
|
|
95
98
|
/** Refuse the run when the caller's `spec.tools` no longer holds exactly the objects the snapshot read, in order. */
|
|
96
99
|
export declare function refuseLateRosterChanges(roster: CallerRosterSnapshot): void;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { readCallerSpec } from "../task-spec-members.js";
|
|
1
2
|
import { TOOL_SPEC_MEMBERS, frozenExtra, frozenMember, newCopyState } from "../tool-spec-members.js";
|
|
2
3
|
import { RETIRED_TOOL_SPEC_KEYS, retiredKeyOf, retiredKeyRefusal } from "../retired-keys.js";
|
|
3
4
|
import { isDefineToolProduct, rebindDefineToolCtx } from "../tools.js";
|
|
@@ -223,14 +224,16 @@ export function rebindProductEntry(entry, enrich) {
|
|
|
223
224
|
refuseProductDrift(entry, rebound);
|
|
224
225
|
return mountedProduct(entry, rebound);
|
|
225
226
|
}
|
|
226
|
-
export function snapshotCallerRoster(
|
|
227
|
+
export function snapshotCallerRoster(handedSpec) {
|
|
228
|
+
const read = readCallerSpec(handedSpec);
|
|
229
|
+
const { spec } = read;
|
|
227
230
|
const tools = spec.tools;
|
|
228
231
|
const descriptors = Object.getOwnPropertyDescriptors(spec);
|
|
229
232
|
const handed = Array.isArray(tools) ? Object.freeze([...tools]) : undefined;
|
|
230
233
|
const slot = handed !== undefined ? Object.freeze(handed.map((t, i) => rosterFaceOf(t, i))) : tools;
|
|
231
234
|
descriptors.tools = { value: slot, enumerable: slot !== undefined, writable: false, configurable: false };
|
|
232
235
|
const copy = Object.create(Object.getPrototypeOf(spec), descriptors);
|
|
233
|
-
return { spec: copy, roster: { caller:
|
|
236
|
+
return { spec: copy, roster: { caller: read.caller, handed: tools === undefined ? Object.freeze([]) : handed }, refusal: read.refusal };
|
|
234
237
|
}
|
|
235
238
|
export function refuseLateRosterChanges(roster) {
|
|
236
239
|
const { handed } = roster;
|
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
* The durable-suspend checkpoint ROW-IDENTITY vocabulary — the default isolation scope, the ONE derivation of a row's
|
|
3
3
|
* scope, and the ONE reading of the placement fields' empty string — moved whole out of the orchestrator so the
|
|
4
4
|
* park-lane phases (the suspend stamp), the driver (the leg's scope, derived once and handed to every mint lane; the
|
|
5
|
-
* restore fold) and runtask (the resume rung) reach DOWN for the same names. Pure: a constant
|
|
5
|
+
* restore fold) and runtask (the resume rung) reach DOWN for the same names. Pure: a constant, two string functions, the
|
|
6
|
+
* composition-leg record's reading (with its entry's closed set) and comparison, and the row id's restore.
|
|
6
7
|
*/
|
|
8
|
+
import type { CompositionLeg, RunInternals } from "./contracts.js";
|
|
7
9
|
/** The multi-tenant scope used when a durable suspend fires for an IRREVERSIBLE tool in an
|
|
8
10
|
* unattended deployment that did NOT opt into `durableApproval` (so there is no caller-supplied scope). The
|
|
9
11
|
* checkpoint carries this scope; resume reads it back from the checkpoint (`cp.scope`), so it is
|
|
@@ -42,3 +44,16 @@ export declare function checkpointScopeOf(spec: {
|
|
|
42
44
|
* loudly on the factory path, and normalizing it away would silently repair what should be loud.
|
|
43
45
|
*/
|
|
44
46
|
export declare function placementValueOrAbsent(value: string | undefined): string | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* The ONE reading of a composition leg's identity ({@link CompositionLeg}) — the record its three readers share: the driver
|
|
49
|
+
* resolves the leg's value once at prepare through it (the live member, else the row's), the suspend stamp writes what it
|
|
50
|
+
* resolved, and the resume rung compares a live value with the row's through {@link sameCompositionLeg}. A plain copy of the
|
|
51
|
+
* three members, so what the row records is data the leg's caller cannot rewrite afterwards; absent stays absent. An `entry`
|
|
52
|
+
* outside the closed set is refused here (`config.invalid_argument`, `detail.field`), so no reader takes it and no card records it.
|
|
53
|
+
*/
|
|
54
|
+
export declare function compositionLegRecord(leg: CompositionLeg | undefined): CompositionLeg | undefined;
|
|
55
|
+
/** Whether two composition-leg records name the same leg of the same composition for the same host session. */
|
|
56
|
+
export declare function sameCompositionLeg(a: CompositionLeg, b: CompositionLeg): boolean;
|
|
57
|
+
/** The row a resumed leg runs as ({@link RunInternals.rowTaskId}): the live seat when handed, else the parked row's record —
|
|
58
|
+
* folded into internals so the mint at prepare, the resume screen and the throw backstop read one value. */
|
|
59
|
+
export declare function restoreRowTaskId(internals: RunInternals | undefined, recorded: string | undefined): RunInternals | undefined;
|
|
@@ -5,3 +5,24 @@ export function checkpointScopeOf(spec, seat) {
|
|
|
5
5
|
export function placementValueOrAbsent(value) {
|
|
6
6
|
return value || undefined;
|
|
7
7
|
}
|
|
8
|
+
const COMPOSITION_ENTRIES = { cascade: true, verify: true };
|
|
9
|
+
export function compositionLegRecord(leg) {
|
|
10
|
+
if (leg === undefined)
|
|
11
|
+
return undefined;
|
|
12
|
+
const entry = leg.entry;
|
|
13
|
+
if (typeof entry !== "string" || !Object.hasOwn(COMPOSITION_ENTRIES, entry)) {
|
|
14
|
+
const e = new Error(`compositionLeg.entry must name a composition entry (${Object.keys(COMPOSITION_ENTRIES).join(" / ")}; got ${typeof entry === "string" ? "another word" : typeof entry}) — an identity no entry minted is refused, never recorded on a card.`);
|
|
15
|
+
e.code = "config.invalid_argument";
|
|
16
|
+
e.detail = { field: "compositionLeg.entry" };
|
|
17
|
+
throw e;
|
|
18
|
+
}
|
|
19
|
+
return { entry: entry, leg: leg.leg, hostSessionId: leg.hostSessionId };
|
|
20
|
+
}
|
|
21
|
+
export function sameCompositionLeg(a, b) {
|
|
22
|
+
return a.entry === b.entry && a.leg === b.leg && a.hostSessionId === b.hostSessionId;
|
|
23
|
+
}
|
|
24
|
+
export function restoreRowTaskId(internals, recorded) {
|
|
25
|
+
if (internals?.rowTaskId !== undefined || recorded === undefined)
|
|
26
|
+
return internals;
|
|
27
|
+
return { ...(internals ?? {}), rowTaskId: recorded };
|
|
28
|
+
}
|
|
@@ -30,8 +30,9 @@ export declare function deploymentCanRerootChild(deps: Pick<RunnerDeps, "executi
|
|
|
30
30
|
*/
|
|
31
31
|
export declare function childPlacementOf(env: Pick<ExecutionEnv, "canonicalPath">, childRoot: string, asked: string | undefined, callerRoot: string): Promise<ChildPlacement>;
|
|
32
32
|
/** A delegated leg's placement: the place asked for is the hint (a minted worktree, an explicit cwd, the caller's own cwd)
|
|
33
|
-
* — or, for a worktree the factory mints itself (`isolation`), that worktree on the caller's host
|
|
34
|
-
* is another namespace). A leg no delegation caller
|
|
33
|
+
* — or, for a worktree the factory mints itself (`isolation`), that worktree on the caller's host when the environment's
|
|
34
|
+
* paths are the host's (`pathsAreHostLocal`; any other environment's is another namespace). A leg no delegation caller
|
|
35
|
+
* placed (no `callerRoot`) has no placement and reads nothing. */
|
|
35
36
|
export declare function childPlacementOnLeg(env: ExecutionEnv, internals: Pick<RunInternals, "isolation" | "parentCwd"> & {
|
|
36
37
|
readonly callerRoot: string;
|
|
37
38
|
}, root: string): Promise<ChildPlacement>;
|
|
@@ -66,7 +67,7 @@ export type ChainInstallationGap = "absent" | "misaligned" | "invalid";
|
|
|
66
67
|
* installing those entries anywhere else (the chain's top leg, this leg) would move what they protect. Entries whose rules
|
|
67
68
|
* do not depend on it, and installed entries, never need a record.
|
|
68
69
|
*/
|
|
69
|
-
export declare function chainInstallationGaps(chain: readonly ToolPolicy[], installations: ChainInstallations, rebase: (p: string) => string): Array<{
|
|
70
|
+
export declare function chainInstallationGaps(chain: readonly (ToolPolicy | undefined)[], installations: ChainInstallations, rebase: (p: string) => string): Array<{
|
|
70
71
|
readonly position: number;
|
|
71
72
|
readonly gap: ChainInstallationGap;
|
|
72
73
|
}>;
|
|
@@ -90,7 +91,7 @@ export declare function chainPolicyOnLeg(cfg: {
|
|
|
90
91
|
leg: PathRuleBases;
|
|
91
92
|
chainTop: PathRuleBases;
|
|
92
93
|
placement: ChildPlacement | undefined;
|
|
93
|
-
chain: readonly ToolPolicy[];
|
|
94
|
+
chain: readonly (ToolPolicy | undefined)[];
|
|
94
95
|
installations: ChainInstallations;
|
|
95
96
|
rebase: (p: string) => string;
|
|
96
97
|
}): {
|
|
@@ -98,13 +99,11 @@ export declare function chainPolicyOnLeg(cfg: {
|
|
|
98
99
|
chained: (policy: ToolPolicy, position: number) => ToolPolicy;
|
|
99
100
|
};
|
|
100
101
|
/** The installation record of a chain entry (its root and home), `null` for an entry with no path rules installed. */
|
|
101
|
-
export declare function installationRecordOf(policy: ToolPolicy): {
|
|
102
|
+
export declare function installationRecordOf(policy: ToolPolicy | undefined): {
|
|
102
103
|
readonly root: string;
|
|
103
104
|
readonly home?: string;
|
|
104
105
|
} | null;
|
|
105
106
|
/** What a leg hands its children about anchors (data half): the chain's top leg's anchors — the person's global / session
|
|
106
107
|
* rows and every `~/` row anchor there — and where each entry handed down was installed, position for position (a chain
|
|
107
108
|
* re-supplied uninstalled is installed there again; absent when no entry is an installation). */
|
|
108
|
-
export declare function chainAnchorRecords(chainTop: PathRuleBases, chain:
|
|
109
|
-
readonly policy: ToolPolicy;
|
|
110
|
-
}[]): Pick<InheritedGate, "pathRuleAnchors" | "pathRuleInstallations">;
|
|
109
|
+
export declare function chainAnchorRecords(chainTop: PathRuleBases, chain: NonNullable<InheritedGate["parentConstraints"]>): Pick<InheritedGate, "pathRuleAnchors" | "pathRuleInstallations">;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { pathsAreHostLocal } from "../remote-env.js";
|
|
2
2
|
import { validatePath } from "../effective-path-target.js";
|
|
3
3
|
import { installPolicyAnchors, installationAnchorsOf, installedFrom } from "../path-rule-binding.js";
|
|
4
4
|
import { CheckpointError } from "../checkpoint-store.js";
|
|
@@ -23,7 +23,7 @@ export async function childPlacementOf(env, childRoot, asked, callerRoot) {
|
|
|
23
23
|
return root === tree || root.startsWith(tree.endsWith(sep) ? tree : tree + sep) ? "caller_tree" : "elsewhere";
|
|
24
24
|
}
|
|
25
25
|
export function childPlacementOnLeg(env, internals, root) {
|
|
26
|
-
const asked = internals.isolation === "worktree" ? (
|
|
26
|
+
const asked = internals.isolation === "worktree" ? (pathsAreHostLocal(env) ? root : undefined) : internals.parentCwd;
|
|
27
27
|
return childPlacementOf(env, root, asked, internals.callerRoot);
|
|
28
28
|
}
|
|
29
29
|
export function worktreeNotHonored(cwd) {
|
|
@@ -64,7 +64,7 @@ function recordedInstallation(installations, chainLength, position, rebase) {
|
|
|
64
64
|
}
|
|
65
65
|
export function chainInstallationGaps(chain, installations, rebase) {
|
|
66
66
|
return chain.flatMap((policy, position) => {
|
|
67
|
-
if (!dependsOnInstallation(policy))
|
|
67
|
+
if (policy === undefined || !dependsOnInstallation(policy))
|
|
68
68
|
return [];
|
|
69
69
|
const r = recordedInstallation(installations, chain.length, position, rebase);
|
|
70
70
|
return typeof r === "string" ? [{ position, gap: r }] : [];
|
|
@@ -90,18 +90,18 @@ export function chainPolicyOnLeg(cfg) {
|
|
|
90
90
|
const own = (policy) => {
|
|
91
91
|
if (policy === undefined)
|
|
92
92
|
return undefined;
|
|
93
|
-
const position = cfg.placement === "elsewhere" ? -1 : cfg.chain.findIndex((c) => (installedFrom(c) ?? c) === (installedFrom(policy) ?? policy));
|
|
93
|
+
const position = cfg.placement === "elsewhere" ? -1 : cfg.chain.findIndex((c) => c !== undefined && (installedFrom(c) ?? c) === (installedFrom(policy) ?? policy));
|
|
94
94
|
return position >= 0 ? chained(cfg.chain[position], position) : installPolicyAnchors(policy, cfg.leg);
|
|
95
95
|
};
|
|
96
96
|
return { own, chained };
|
|
97
97
|
}
|
|
98
98
|
export function installationRecordOf(policy) {
|
|
99
|
-
const a = installationAnchorsOf(policy);
|
|
99
|
+
const a = policy !== undefined ? installationAnchorsOf(policy) : undefined;
|
|
100
100
|
return a?.root === undefined ? null : { root: a.root, ...(a.home !== undefined ? { home: a.home } : {}) };
|
|
101
101
|
}
|
|
102
102
|
export function chainAnchorRecords(chainTop, chain) {
|
|
103
103
|
return {
|
|
104
104
|
...(chainTop.root !== undefined ? { pathRuleAnchors: { root: chainTop.root, ...(chainTop.home !== undefined ? { home: chainTop.home } : {}) } } : {}),
|
|
105
|
-
...(chain.some((pc) =>
|
|
105
|
+
...(chain.some((pc) => installationRecordOf(pc.policy) !== null) ? { pathRuleInstallations: chain.map((pc) => installationRecordOf(pc.policy)) } : {}),
|
|
106
106
|
};
|
|
107
107
|
}
|
|
@@ -25,6 +25,10 @@
|
|
|
25
25
|
* ② THE LADDER — here, AFTER a call. Trigger: the rung produced no RULING. Effect: the next rung is asked.
|
|
26
26
|
* Record: `GateDisposition.classifier.fallback` on every classification this run's own gate decided (an
|
|
27
27
|
* inherited-ancestor chain carries the form and no attribution) + the throttled `classifier.fallback`.
|
|
28
|
+
* The ladder has ONE terminating law: a rung whose dispatch ended on the provider's rate limit on
|
|
29
|
+
* `rateLimitBreakAfter` classifications in a row is not asked again this run (the decider's retirement,
|
|
30
|
+
* `auto-mode.ts`) — the walk starts behind it, and `classifier.seat_rate_limited` says so once. It is the
|
|
31
|
+
* ladder's own end-of-the-line for a rung, not a second retry beside the brain's backoff.
|
|
28
32
|
*
|
|
29
33
|
* They FOLD rather than stack: after a ① SWAP the seat and the main model are the same route, so
|
|
30
34
|
* {@link classifierLadderRungs} returns ONE rung and ② cannot fire in the same run (and under `"none"`, where
|
|
@@ -277,12 +281,16 @@ export declare function classifierReplyAsksAgain(reply: AssistantMessage): boole
|
|
|
277
281
|
* and the decider maps the throw to `unavailable` (`error`), as it maps every leg failure; the sibling
|
|
278
282
|
* side-channel legs (compaction, consolidation) already read an error stop this way. The cap-cut form
|
|
279
283
|
* (`errorKind: "length_empty"`) is not a failure: it is the empty-at-cap reply the re-ask owns.
|
|
284
|
+
*
|
|
285
|
+
* A failure whose provider status was a 429 (`apiErrorStatus`, stamped by the brain on the terminal of a call whose own
|
|
286
|
+
* backoff ladder ran out) carries `AUTO_MODE_RUNG_RATE_LIMITED_CODE`: the one fact the decider's retirement count reads.
|
|
287
|
+
* Nothing else about the failure changes — it is still the leg failure the decider maps to `unavailable` / `error`.
|
|
280
288
|
*/
|
|
281
289
|
export declare function classifierReplyFailure(reply: AssistantMessage): Error | undefined;
|
|
282
290
|
/**
|
|
283
291
|
* The per-decision READ of a classification, as one seat: the `auto_mode.classified` trace frame (wall time,
|
|
284
|
-
* verdict, cause), the ladder's throttled `classifier.fallback` disclosure
|
|
285
|
-
* `classifier.contract_broken` streak. All are observers — a throwing sink never reaches the gate (the decider
|
|
292
|
+
* verdict, cause), the ladder's throttled `classifier.fallback` disclosure, the per-model
|
|
293
|
+
* `classifier.contract_broken` streak and the decider's one `classifier.seat_rate_limited` report. All are observers — a throwing sink never reaches the gate (the decider
|
|
286
294
|
* swallows it), and none changes a verdict.
|
|
287
295
|
*
|
|
288
296
|
* The frame's `model` is the model the classification RAN ON, which is what the field has always meant (its
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { sameRouteIdentity } from "../../brain/route-adjudicator.js";
|
|
2
2
|
import { lowestReasoningSeat } from "../../brain/reasoning-request.js";
|
|
3
3
|
import { AUTO_MODE_CLASSIFIER_CONTRACT_BROKEN_AFTER, AUTO_MODE_CLASSIFIER_LOW_REASONING_BUDGET_TOKENS, AUTO_MODE_CLASSIFIER_MAX_TOKENS, AUTO_MODE_CLASSIFIER_THINK_BUDGET_TOKENS } from "../auto-mode-defaults.js";
|
|
4
|
-
import { autoModeClassifierFallbackOf, parseAutoModeResponse } from "../auto-mode.js";
|
|
4
|
+
import { AUTO_MODE_RUNG_RATE_LIMITED_CODE, autoModeClassifierFallbackOf, parseAutoModeResponse } from "../auto-mode.js";
|
|
5
5
|
import { classifierUnavailableDispositionOf } from "../classifier-unavailable-arm.js";
|
|
6
|
-
import { DEFAULT_TIER_ORDER,
|
|
6
|
+
import { catalogModel, DEFAULT_TIER_ORDER, isReceivedCatalog, receiveModelCatalog, receiveRoleMap, resolveTaskModel, roleSpecNamesModel } from "../roles.js";
|
|
7
7
|
import { emitTrace } from "../trace.js";
|
|
8
8
|
import { deliverEngineNotice } from "../types.js";
|
|
9
9
|
export function classifierLadderRungs(knob, classifier, main) {
|
|
@@ -22,7 +22,8 @@ function sameRouteQuietly(a, b) {
|
|
|
22
22
|
export const CLASSIFIER_ROLE_DEFAULT_REASONS = Object.freeze(["tier_below_main", "tier_table", "role_fallback", "main_only", "role_unresolvable"]);
|
|
23
23
|
export function classifierSeatModel(args) {
|
|
24
24
|
const { main } = args;
|
|
25
|
-
const
|
|
25
|
+
const normalized = normalizeSeatDeps(args.deps);
|
|
26
|
+
const deps = { ...normalized, roles: receiveRoleMap(normalized.roles, "RunnerDeps.roles") };
|
|
26
27
|
if (roleSpecNamesModel(deps.roles?.classifier)) {
|
|
27
28
|
try {
|
|
28
29
|
return { model: resolveTaskModel({ modelRole: "classifier" }, deps).model };
|
|
@@ -45,20 +46,28 @@ export function classifierSeatModel(args) {
|
|
|
45
46
|
}
|
|
46
47
|
}
|
|
47
48
|
export function normalizeSeatDeps(deps) {
|
|
48
|
-
if (deps.tiers === undefined)
|
|
49
|
+
if (deps.tiers === undefined || isReceivedCatalog(deps.models))
|
|
49
50
|
return deps;
|
|
50
51
|
try {
|
|
51
|
-
return { ...deps,
|
|
52
|
+
return { ...deps, ...receiveModelCatalog(deps.models, deps.tiers, "RunnerDeps") };
|
|
52
53
|
}
|
|
53
54
|
catch {
|
|
54
55
|
return deps;
|
|
55
56
|
}
|
|
56
57
|
}
|
|
58
|
+
function tierModelQuietly(deps, tier) {
|
|
59
|
+
try {
|
|
60
|
+
return catalogModel(tier, deps.models, `tiers.${tier}`);
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
57
66
|
export function tierIndexOf(deps, model) {
|
|
58
67
|
if (deps.tiers === undefined || Object.keys(deps.tiers).length === 0 || deps.models === undefined)
|
|
59
68
|
return undefined;
|
|
60
69
|
for (let i = DEFAULT_TIER_ORDER.length - 1; i >= 0; i--) {
|
|
61
|
-
const m = deps
|
|
70
|
+
const m = tierModelQuietly(deps, DEFAULT_TIER_ORDER[i]);
|
|
62
71
|
if (m !== undefined && sameRouteQuietly(m, model))
|
|
63
72
|
return i;
|
|
64
73
|
}
|
|
@@ -68,7 +77,7 @@ function tierBelowMain(deps, main) {
|
|
|
68
77
|
const mainTier = tierIndexOf(deps, main);
|
|
69
78
|
if (mainTier === undefined)
|
|
70
79
|
return undefined;
|
|
71
|
-
const bound = DEFAULT_TIER_ORDER.map((tier) => deps
|
|
80
|
+
const bound = DEFAULT_TIER_ORDER.map((tier) => tierModelQuietly(deps, tier));
|
|
72
81
|
for (let i = mainTier + 1; i < bound.length; i++) {
|
|
73
82
|
const m = bound[i];
|
|
74
83
|
if (m !== undefined && !sameRouteQuietly(m, main))
|
|
@@ -191,6 +200,23 @@ function classifierContractAnnouncer(args) {
|
|
|
191
200
|
streak.delete(`${landed}:${record.modelUsed}`);
|
|
192
201
|
};
|
|
193
202
|
}
|
|
203
|
+
function announceRateLimitBreak(args, brk) {
|
|
204
|
+
deliverEngineNotice(args.onNotice, {
|
|
205
|
+
code: "classifier.seat_rate_limited",
|
|
206
|
+
message: `the auto-mode classifier model "${brk.model}" was rate limited (HTTP 429) on ${brk.consecutive} consecutive classifications — ` +
|
|
207
|
+
`for the rest of this run it is not asked again, and every gated call is judged on "${brk.to}" without waiting for it. ` +
|
|
208
|
+
"Raise that model's rate limit at its gateway, or name a different `classifier` role; RunnerDeps.autoMode.rateLimitBreakAfter sets how many in a row it takes.",
|
|
209
|
+
detail: {
|
|
210
|
+
model: brk.model,
|
|
211
|
+
to: brk.to,
|
|
212
|
+
rung: brk.rung,
|
|
213
|
+
consecutive: brk.consecutive,
|
|
214
|
+
...(args.sessionId !== undefined ? { sessionId: args.sessionId } : {}),
|
|
215
|
+
...(args.runId !== undefined ? { runId: args.runId } : {}),
|
|
216
|
+
},
|
|
217
|
+
...(args.sessionId !== undefined ? { sessionId: args.sessionId } : {}),
|
|
218
|
+
});
|
|
219
|
+
}
|
|
194
220
|
export const CLASSIFIER_OFF_SEAT = { reasoning: "off", maxTokens: AUTO_MODE_CLASSIFIER_MAX_TOKENS };
|
|
195
221
|
export const CLASSIFIER_LOW_SEAT = { reasoning: "low", maxTokens: AUTO_MODE_CLASSIFIER_MAX_TOKENS + AUTO_MODE_CLASSIFIER_LOW_REASONING_BUDGET_TOKENS };
|
|
196
222
|
export const CLASSIFIER_THINK_SEAT = { reasoning: "low", maxTokens: AUTO_MODE_CLASSIFIER_MAX_TOKENS + AUTO_MODE_CLASSIFIER_THINK_BUDGET_TOKENS };
|
|
@@ -236,7 +262,10 @@ export function classifierReplyFailure(reply) {
|
|
|
236
262
|
return new Error("the auto-mode classifier request was aborted");
|
|
237
263
|
if (reply.stopReason !== "error" || reply.errorKind === "length_empty")
|
|
238
264
|
return undefined;
|
|
239
|
-
|
|
265
|
+
const failure = new Error(`the auto-mode classifier request failed: ${reply.errorMessage ?? "the model leg reported an error with no message"}`);
|
|
266
|
+
if (reply.apiErrorStatus === 429)
|
|
267
|
+
failure.code = AUTO_MODE_RUNG_RATE_LIMITED_CODE;
|
|
268
|
+
return failure;
|
|
240
269
|
}
|
|
241
270
|
export function classifierRoundObserver(args) {
|
|
242
271
|
const announceFallback = classifierFallbackAnnouncer(args);
|
|
@@ -256,5 +285,7 @@ export function classifierRoundObserver(args) {
|
|
|
256
285
|
}));
|
|
257
286
|
announceFallback(info.classifier);
|
|
258
287
|
countContract(info);
|
|
288
|
+
for (const brk of info.rateLimitBreaks ?? [])
|
|
289
|
+
announceRateLimitBreak(args, brk);
|
|
259
290
|
};
|
|
260
291
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { convertToLlm, uuidv7 } from "../../internal/harness.js";
|
|
2
2
|
import { compactionFailureReason, compactionPassReport, DEFAULT_COMPACTION_INSTRUCTIONS, isCompactionManualCancel, manualCompactOutcomeOf, maybeCompact, mintCompactedEvent } from "../auto-compaction.js";
|
|
3
3
|
import { contextOverlayFor } from "../context-settings.js";
|
|
4
|
+
import { createRowSeat } from "../mods/session-append.js";
|
|
5
|
+
import { createCompactStation } from "../mods/session-compact.js";
|
|
4
6
|
import { admitLegMods, legFacadeSeats } from "../mods/stations.js";
|
|
5
7
|
import { malformedPricingField } from "../pricing.js";
|
|
6
8
|
import { resolveTaskModel } from "../roles.js";
|
|
@@ -72,11 +74,16 @@ async function compactOnSession(req, deps, session, resolved, named, legMods) {
|
|
|
72
74
|
const branch = await session.getBranch();
|
|
73
75
|
const contextMessages = convertToLlm((await session.buildContext()).messages);
|
|
74
76
|
bindSessionFacade(legMods, { deps, req, model: resolved.model, messages: contextMessages, book });
|
|
77
|
+
const rowSeat = createRowSeat();
|
|
78
|
+
rowSeat.bind({ bus: legMods.bus, identity: undefined, report: legMods.report });
|
|
79
|
+
const compactStation = createCompactStation();
|
|
80
|
+
compactStation.bind({ bus: legMods.bus, identity: undefined, report: legMods.report });
|
|
75
81
|
const overlay = contextOverlayFor(deps.contextSettings, resolved.modelRef, deps);
|
|
76
82
|
const activeTools = compactionActivationSnapshot(branch);
|
|
77
83
|
const thinking = resolved.thinking ?? resolved.model.defaultThinking;
|
|
78
|
-
const comp = await
|
|
84
|
+
const comp = await compactStation.compact({
|
|
79
85
|
session,
|
|
86
|
+
admitRows: rowSeat.admitRows,
|
|
80
87
|
model: resolved.model,
|
|
81
88
|
...(overlay !== undefined ? { contextOverlay: overlay } : {}),
|
|
82
89
|
...(compactionModel !== undefined ? { compactionModel } : {}),
|
|
@@ -93,7 +100,7 @@ async function compactOnSession(req, deps, session, resolved, named, legMods) {
|
|
|
93
100
|
...summaryProviderOptions({ deps }, 0),
|
|
94
101
|
...compactionHookOptions({ deps }, { modBus: legMods.bus, hookIdentity: undefined, sessionId }, "manual", req.signal),
|
|
95
102
|
onStarted: passReport.onStarted,
|
|
96
|
-
});
|
|
103
|
+
}, maybeCompact, req.instructions !== undefined ? { instructions: req.instructions } : undefined);
|
|
97
104
|
const outcome = manualCompactOutcomeOf(comp);
|
|
98
105
|
if (comp.compacted) {
|
|
99
106
|
events.push(mintCompactedEvent(comp, "manual", ident()));
|
|
@@ -131,6 +138,7 @@ function bindSessionFacade(legMods, input) {
|
|
|
131
138
|
sessionId: input.req.sessionId,
|
|
132
139
|
model: input.model,
|
|
133
140
|
executionEnv: { exec: () => unavailable("process.run") },
|
|
141
|
+
readFloor: () => undefined,
|
|
134
142
|
taskRoot: "",
|
|
135
143
|
cwdRef: undefined,
|
|
136
144
|
lastBrainContext: () => ({ messages: input.messages }),
|
|
@@ -138,6 +146,10 @@ function bindSessionFacade(legMods, input) {
|
|
|
138
146
|
agentListing: undefined,
|
|
139
147
|
book: (answeredBy, reply) => input.book("mod", answeredBy, reply),
|
|
140
148
|
toolCall: () => unavailable("tool.call"),
|
|
149
|
+
agentSpawn: () => unavailable("agent.spawn"),
|
|
150
|
+
sessionAppend: () => unavailable("session.append"),
|
|
151
|
+
sessionSend: () => unavailable("session.send"),
|
|
152
|
+
sessionCompact: () => unavailable("session.compact"),
|
|
141
153
|
});
|
|
142
154
|
legMods.bindFacade({
|
|
143
155
|
...seats,
|
|
@@ -140,7 +140,7 @@ writtenRefs: Set<string>): Promise<Context>;
|
|
|
140
140
|
/**
|
|
141
141
|
* MF-18 修② — fidelity disclosure: the summary INPUT was clipped to the compaction model's
|
|
142
142
|
* window. Fires pre-call, so the disclosure survives a failed attempt. All three lanes emit the SAME
|
|
143
|
-
* frame; the end-of-task lane passes `spec.tracer ?? deps.tracer` /
|
|
143
|
+
* frame; the end-of-task lane passes `spec.tracer ?? deps.tracer` / the leg's minted task id
|
|
144
144
|
* explicitly because `RunState.telemetry` (which holds exactly those two resolved values) is not in
|
|
145
145
|
* scope inside `finish()`.
|
|
146
146
|
*/
|
|
@@ -35,7 +35,7 @@ export declare function postureRestateOption(prepared: Prepared): Pick<MaybeComp
|
|
|
35
35
|
* of every engine frame written at a boundary, the git frame's re-assert and the compaction itself: the run continues
|
|
36
36
|
* and the failure is reported, `onError` phase `degraded`). Never throws.
|
|
37
37
|
*/
|
|
38
|
-
export declare function appendOwedPosture(prepared: Pick<Prepared, "approvalPosture" | "toolRoster" | "hookIdentity" | "advertisedWritableDirs" | "session" | "reminderMark" | "postureFrameRef" | "batchHaltRef" | "frameReceipts">, ask: "always" | "on_change"): Promise<void>;
|
|
38
|
+
export declare function appendOwedPosture(prepared: Pick<Prepared, "approvalPosture" | "toolRoster" | "hookIdentity" | "advertisedWritableDirs" | "session" | "admitRows" | "reminderMark" | "postureFrameRef" | "batchHaltRef" | "frameReceipts">, ask: "always" | "on_change"): Promise<void>;
|
|
39
39
|
/** The declared output style's frame as one engine-marked reminder — the one spelling every site that states it directly
|
|
40
40
|
* (a resumed leg's continuation, a boundary a queued input continues) mints. */
|
|
41
41
|
export declare function mintOutputStyleReminder(prepared: Pick<Prepared, "outputStyleFrame" | "reminderMark">): string | undefined;
|
|
@@ -49,7 +49,7 @@ export declare function frameCarried(ledger: Prepared["frameReceipts"], source:
|
|
|
49
49
|
* carries it ({@link frameCarried}). Both frames keep the posture's halt rule. The guarantee is read synchronously, at
|
|
50
50
|
* the call, before any await — a boundary with nothing queued returns the posture's own promise.
|
|
51
51
|
*/
|
|
52
|
-
export declare function appendBoundaryFrames(prepared: Pick<Prepared, "approvalPosture" | "toolRoster" | "hookIdentity" | "advertisedWritableDirs" | "session" | "reminderMark" | "postureFrameRef" | "batchHaltRef" | "outputStyleFrame" | "harness" | "frameReceipts">, turnOwesRequest: boolean): Promise<void>;
|
|
52
|
+
export declare function appendBoundaryFrames(prepared: Pick<Prepared, "approvalPosture" | "toolRoster" | "hookIdentity" | "advertisedWritableDirs" | "session" | "admitRows" | "reminderMark" | "postureFrameRef" | "batchHaltRef" | "outputStyleFrame" | "harness" | "frameReceipts">, turnOwesRequest: boolean): Promise<void>;
|
|
53
53
|
/**
|
|
54
54
|
* The session plan file's post-compaction reference (the reference's `plan_file_reference`, CC 2.1.309 `Tmr` (cli309.js:265943)): a compaction
|
|
55
55
|
* summarizes away the turns that wrote the plan, so a leg whose run admitted a plan file that holds a plan is told where
|
|
@@ -6,6 +6,7 @@ import { thrownText } from "../thrown-value.js";
|
|
|
6
6
|
import { rosterEntryNamed } from "../tool-roster.js";
|
|
7
7
|
import { delimitUntrusted, sanitizeUntrustedText } from "../untrusted-text.js";
|
|
8
8
|
import { appendAdvisorRestate } from "./advisor-instructions.js";
|
|
9
|
+
import { appendAdmittedRow } from "../row-admission.js";
|
|
9
10
|
import { gitRestateOption } from "./git-leg-delivery.js";
|
|
10
11
|
import { attachmentEnvelopeTags } from "./turn-attachments.js";
|
|
11
12
|
export function postureFactsOf(prepared) {
|
|
@@ -63,7 +64,7 @@ export async function appendOwedPosture(prepared, ask) {
|
|
|
63
64
|
if (prepared.batchHaltRef.current !== undefined)
|
|
64
65
|
return unwritten();
|
|
65
66
|
try {
|
|
66
|
-
await prepared.session
|
|
67
|
+
await appendAdmittedRow(prepared.admitRows, prepared.session, { role: "user", content: [{ type: "text", text }], timestamp: Date.now(), engineMinted: true });
|
|
67
68
|
ref.unwritten = undefined;
|
|
68
69
|
}
|
|
69
70
|
catch (err) {
|
|
@@ -83,7 +84,7 @@ async function appendOutputStyleRestate(prepared) {
|
|
|
83
84
|
if (text === undefined)
|
|
84
85
|
return;
|
|
85
86
|
try {
|
|
86
|
-
await prepared.session
|
|
87
|
+
await appendAdmittedRow(prepared.admitRows, prepared.session, { role: "user", content: [{ type: "text", text }], timestamp: Date.now(), engineMinted: true });
|
|
87
88
|
}
|
|
88
89
|
catch (err) {
|
|
89
90
|
try {
|
|
@@ -113,7 +114,7 @@ export function planFileRestateOption(prepared) {
|
|
|
113
114
|
return;
|
|
114
115
|
const body = `A plan file exists from plan mode at: ${planFileShown(planFile.spelled)}\n\nPlan contents:\n\n${delimitUntrusted("plan", read.text)}\n\nIf this plan is relevant to the current work and not already complete, continue working on it.`;
|
|
115
116
|
try {
|
|
116
|
-
await prepared.session
|
|
117
|
+
await appendAdmittedRow(prepared.admitRows, prepared.session, { role: "user", content: [{ type: "text", text: mintSystemReminder(body, prepared.reminderMark) }], timestamp: Date.now(), engineMinted: true });
|
|
117
118
|
}
|
|
118
119
|
catch (err) {
|
|
119
120
|
try {
|
|
@@ -6,6 +6,6 @@ import type { RunnerDeps } from "../types.js";
|
|
|
6
6
|
* would supply is never read, so an object with another prototype is refused rather than wired without that seat. The seats
|
|
7
7
|
* whose VALUE is screened at construction and never again are judged on the copy: the declared configuration root must be the
|
|
8
8
|
* absolute path of an existing directory — a root that names no directory guards nothing, so it is refused rather than read as
|
|
9
|
-
* absent; the media budget must be
|
|
10
|
-
* the request
|
|
9
|
+
* absent; the request media budget must be one the trim can keep media under — a bad value is refused rather than read as a
|
|
10
|
+
* default or as "no budget" by the request trim and the `tool_end.output` projection. */
|
|
11
11
|
export declare function retainRunnerDeps(deps: RunnerDeps): RunnerDeps;
|
|
@@ -1,23 +1,28 @@
|
|
|
1
1
|
import { checkedAgentConfigDir } from "../agent-config-dir.js";
|
|
2
|
-
import {
|
|
2
|
+
import { checkedRequestMediaBudget } from "../image-admission.js";
|
|
3
|
+
import { checkedImageProcessorSeat } from "../image-downsample.js";
|
|
3
4
|
import { receiptRefusal, receiveOwnProperties, refuseProxy } from "../own-property-receipt.js";
|
|
4
5
|
import { assertNoRetiredRunnerDeps } from "./retired-runner-deps.js";
|
|
5
6
|
import { copyReadDenySeat, READ_DENY_DEPLOYMENT_SEATS } from "../read-face-seats.js";
|
|
6
7
|
import { receiveHostFloor } from "../host-floor.js";
|
|
7
8
|
import { holdOwnCredentialValues } from "../secret-env.js";
|
|
9
|
+
import { receivePeerSeat } from "../peer-seat.js";
|
|
8
10
|
export function retainRunnerDeps(deps) {
|
|
9
11
|
const words = { subject: "RunnerDeps", unit: "seat", moment: "at new Runner" };
|
|
10
12
|
refuseProxy(deps, words);
|
|
11
13
|
assertNoRetiredRunnerDeps(deps);
|
|
12
14
|
const retained = receiveOwnProperties(deps, words);
|
|
13
15
|
checkedAgentConfigDir(retained.agentConfigDir, "RunnerDeps.agentConfigDir");
|
|
14
|
-
|
|
16
|
+
checkedRequestMediaBudget(retained.mediaBudgetBase64Chars, "RunnerDeps.mediaBudgetBase64Chars");
|
|
17
|
+
checkedImageProcessorSeat(retained.imageProcessor, "RunnerDeps.imageProcessor");
|
|
15
18
|
for (const seat of READ_DENY_DEPLOYMENT_SEATS) {
|
|
16
19
|
if (Object.hasOwn(retained, seat))
|
|
17
20
|
Object.defineProperty(retained, seat, { value: copyReadDenySeat(Reflect.get(retained, seat)), enumerable: true, writable: true, configurable: true });
|
|
18
21
|
}
|
|
19
22
|
if (Object.hasOwn(retained, "hostFloor"))
|
|
20
23
|
Object.defineProperty(retained, "hostFloor", { value: receiveHostFloor(Reflect.get(retained, "hostFloor")), enumerable: true, writable: true, configurable: true });
|
|
24
|
+
if (Object.hasOwn(retained, "peerSeat"))
|
|
25
|
+
Object.defineProperty(retained, "peerSeat", { value: receivePeerSeat(Reflect.get(retained, "peerSeat"), "RunnerDeps.peerSeat"), enumerable: true, writable: true, configurable: true });
|
|
21
26
|
let consolidationKey;
|
|
22
27
|
try {
|
|
23
28
|
const chat = retained.memoryConsolidationDriver?.chat;
|