@sema-agent/core 7.67.2 → 7.68.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 +1533 -0
- package/README.md +18 -9
- package/README.zh-CN.md +16 -8
- package/dist/agents/agent-definition.d.ts +1 -1
- package/dist/agents/agent-definition.js +4 -1
- package/dist/agents/cascade.d.ts +2 -2
- package/dist/agents/cascade.js +3 -1
- package/dist/agents/cumulative-stats.d.ts +2 -1
- package/dist/agents/cumulative-stats.js +4 -1
- package/dist/agents/list-agents-tool.d.ts +30 -0
- package/dist/agents/list-agents-tool.js +45 -3
- package/dist/agents/peer-admission.d.ts +2 -2
- package/dist/agents/peer-session-drain.d.ts +2 -0
- package/dist/agents/peer-session-drain.js +1 -0
- package/dist/agents/repair-loop.js +3 -1
- package/dist/agents/retain-ledger.d.ts +61 -8
- package/dist/agents/retain-ledger.js +25 -3
- package/dist/agents/roster-store.d.ts +4 -2
- package/dist/agents/send-message-tool.d.ts +1 -1
- package/dist/agents/send-message-tool.js +20 -15
- package/dist/agents/subagent-steps.js +2 -10
- package/dist/agents/subagent.d.ts +3 -0
- package/dist/agents/subagent.js +106 -76
- package/dist/agents/tool-filter.d.ts +20 -11
- package/dist/agents/tool-filter.js +8 -4
- package/dist/agents/verify.d.ts +3 -1
- package/dist/agents/verify.js +2 -0
- package/dist/brain/anthropic.js +4 -4
- package/dist/brain/errors.d.ts +20 -0
- package/dist/brain/errors.js +114 -0
- package/dist/brain/open-responses.js +3 -1
- package/dist/brain/openai.js +3 -1
- package/dist/brain/provider-message.d.ts +5 -3
- package/dist/brain/provider-message.js +35 -8
- package/dist/brain/reasoning-request.d.ts +73 -19
- package/dist/brain/reasoning-request.js +164 -72
- package/dist/brain/reasoning-stamp.d.ts +26 -0
- package/dist/brain/reasoning-stamp.js +10 -0
- package/dist/brain/reasoning.d.ts +95 -162
- package/dist/brain/reasoning.js +31 -86
- package/dist/brain/route-adjudicator.d.ts +9 -7
- package/dist/brain/route-adjudicator.js +12 -10
- package/dist/brain/status-sink.d.ts +19 -64
- package/dist/brain/status-sink.js +5 -21
- package/dist/brain/stream-engine.d.ts +11 -2
- package/dist/brain/stream-engine.js +10 -0
- package/dist/core/a2a.d.ts +17 -5
- package/dist/core/a2a.js +11 -3
- package/dist/core/allow-entry.d.ts +35 -15
- package/dist/core/allow-entry.js +47 -60
- package/dist/core/ask-headline.d.ts +68 -0
- package/dist/core/ask-headline.js +23 -0
- package/dist/core/ask-origin.d.ts +36 -8
- package/dist/core/ask-origin.js +17 -10
- package/dist/core/ask-question.d.ts +34 -7
- package/dist/core/ask-question.js +10 -1
- package/dist/core/ask-unresolvable-notice.d.ts +7 -0
- package/dist/core/ask-unresolvable-notice.js +9 -3
- package/dist/core/auto-strip.d.ts +53 -0
- package/dist/core/auto-strip.js +76 -0
- package/dist/core/background-agent-store.d.ts +45 -5
- package/dist/core/background-agent-store.js +69 -15
- package/dist/core/background-shell.d.ts +2 -2
- package/dist/core/caller-text.js +2 -2
- package/dist/core/canonical-json.d.ts +13 -0
- package/dist/core/canonical-json.js +7 -0
- package/dist/core/checkpoint-features.d.ts +66 -20
- package/dist/core/checkpoint-features.js +12 -1
- package/dist/core/checkpoint-generation.d.ts +1 -1
- package/dist/core/checkpoint-queries.d.ts +1 -1
- package/dist/core/checkpoint-queries.js +4 -1
- package/dist/core/checkpoint-requirements.d.ts +25 -1
- package/dist/core/checkpoint-requirements.js +5 -1
- package/dist/core/checkpoint-row-verdict.d.ts +1 -0
- package/dist/core/checkpoint-row-verdict.js +4 -0
- package/dist/core/checkpoint-store.d.ts +66 -38
- package/dist/core/checkpoint-store.js +15 -6
- package/dist/core/child-clamp-seats.d.ts +6 -0
- package/dist/core/child-clamp-seats.js +1 -0
- package/dist/core/config-refusal-codes.d.ts +1 -1
- package/dist/core/config-refusal-codes.js +1 -0
- package/dist/core/delegation-frames.d.ts +9 -12
- package/dist/core/delegation-frames.js +9 -8
- package/dist/core/engine-capabilities.d.ts +21 -8
- package/dist/core/engine-capabilities.js +1 -1
- package/dist/core/engine-notice.d.ts +147 -34
- package/dist/core/engine-notice.js +27 -16
- package/dist/core/engine-storage-backend.d.ts +2 -1
- package/dist/core/env-budget.js +3 -3
- package/dist/core/env-knob-announce.d.ts +10 -10
- package/dist/core/env-knob-announce.js +3 -6
- package/dist/core/file-history-store.d.ts +29 -4
- package/dist/core/file-history-store.js +13 -0
- package/dist/core/frame-settlement.d.ts +2 -1
- package/dist/core/gate-fold.js +1 -1
- package/dist/core/gate-lanes.js +56 -49
- package/dist/core/governance-codes.d.ts +39 -3
- package/dist/core/governance-codes.js +61 -3
- package/dist/core/hooks.d.ts +29 -11
- package/dist/core/hooks.js +5 -2
- package/dist/core/human-input-projection.js +3 -3
- package/dist/core/input-author.d.ts +17 -3
- package/dist/core/input-author.js +15 -3
- package/dist/core/leg-identity.d.ts +10 -28
- package/dist/core/leg-identity.js +1 -21
- package/dist/core/lsp.d.ts +18 -13
- package/dist/core/lsp.js +30 -22
- package/dist/core/mailbox-store.d.ts +1 -1
- package/dist/core/mailbox-store.js +4 -4
- package/dist/core/mcp-connection-pool.d.ts +93 -4
- package/dist/core/mcp-connection-pool.js +104 -1
- package/dist/core/mcp-failure.d.ts +38 -12
- package/dist/core/mcp-failure.js +9 -13
- package/dist/core/mcp-probe.d.ts +4 -3
- package/dist/core/mcp-server-link.d.ts +4 -2
- package/dist/core/mcp-server-link.js +4 -5
- package/dist/core/mcp-server-spec.d.ts +3 -3
- package/dist/core/mcp-server-unavailable-notice.d.ts +22 -8
- package/dist/core/mcp-server-unavailable-notice.js +18 -4
- package/dist/core/mcp.d.ts +40 -6
- package/dist/core/mcp.js +39 -13
- package/dist/core/memory-engine/content-origin.js +2 -2
- package/dist/core/memory-engine/control-objects.d.ts +2 -4
- package/dist/core/memory-engine/control-objects.js +2 -10
- package/dist/core/memory-engine/delegation-settlement.js +6 -1
- package/dist/core/memory-engine/dual-root.js +3 -0
- package/dist/core/memory-engine/engine.d.ts +6 -4
- package/dist/core/memory-engine/engine.js +32 -29
- package/dist/core/memory-engine/file-backend.d.ts +20 -5
- package/dist/core/memory-engine/file-backend.js +21 -31
- package/dist/core/memory-engine/frontmatter.d.ts +2 -0
- package/dist/core/memory-engine/frontmatter.js +4 -0
- package/dist/core/memory-engine/layout.d.ts +114 -20
- package/dist/core/memory-engine/layout.js +340 -22
- package/dist/core/memory-engine/memory-deployment.d.ts +7 -5
- package/dist/core/memory-engine/mount-failed-notice.d.ts +19 -7
- package/dist/core/memory-engine/mount-failed-notice.js +43 -10
- package/dist/core/memory-engine/sync-client.js +4 -5
- package/dist/core/model-fallbacks.d.ts +5 -1
- package/dist/core/model-fallbacks.js +3 -3
- package/dist/core/model-receipt.d.ts +2 -1
- package/dist/core/model-receipt.js +12 -1
- package/dist/core/mods/kernel/dispatch.d.ts +2 -2
- package/dist/core/mods/kernel/dispatch.js +14 -6
- package/dist/core/mods/kernel/events.d.ts +8 -5
- package/dist/core/mods/kernel/events.js +2 -2
- package/dist/core/mods/kernel/index.d.ts +1 -1
- package/dist/core/mods/kernel/registration.d.ts +9 -0
- package/dist/core/mods/package.js +1 -1
- package/dist/core/mods/session-append.d.ts +4 -2
- package/dist/core/mods/session-append.js +3 -0
- package/dist/core/mods/stations.d.ts +7 -11
- package/dist/core/mods/stations.js +4 -7
- package/dist/core/mods/tool-call.d.ts +10 -8
- package/dist/core/mods/tool-call.js +15 -18
- package/dist/core/mounted-mcp.d.ts +0 -4
- package/dist/core/mounted-mcp.js +1 -1
- package/dist/core/park-noun.d.ts +24 -0
- package/dist/core/park-noun.js +21 -0
- package/dist/core/park-resumability.d.ts +60 -0
- package/dist/core/park-resumability.js +30 -0
- package/dist/core/permission-rule-provider.d.ts +24 -2
- package/dist/core/permission-rule-provider.js +11 -8
- package/dist/core/permission-rule-store.d.ts +8 -1
- package/dist/core/permission-rule-store.js +2 -3
- package/dist/core/permission-rules.d.ts +2 -1
- package/dist/core/permission-rules.js +8 -4
- package/dist/core/persisted-rule-arms.d.ts +3 -0
- package/dist/core/persisted-rule-arms.js +2 -1
- package/dist/core/present-plan-tool.d.ts +47 -3
- package/dist/core/present-plan-tool.js +62 -4
- package/dist/core/principal-name.d.ts +1 -1
- package/dist/core/principal-name.js +5 -5
- package/dist/core/process-identity.js +10 -5
- package/dist/core/protocol-http-auth.d.ts +30 -9
- package/dist/core/protocol-http-auth.js +113 -59
- package/dist/core/read-only-shell.js +9 -5
- package/dist/core/redaction-marks.d.ts +4 -26
- package/dist/core/redaction-marks.js +9 -21
- package/dist/core/remote-env.d.ts +43 -16
- package/dist/core/remote-env.js +1 -1
- package/dist/core/request-copy-projection.d.ts +1 -1
- package/dist/core/request-copy-projection.js +40 -50
- package/dist/core/resume-config-judge.js +1 -1
- package/dist/core/resume-startup-cause.d.ts +35 -18
- package/dist/core/resume-startup-cause.js +13 -10
- package/dist/core/retention.d.ts +167 -25
- package/dist/core/retention.js +100 -20
- package/dist/core/roles.d.ts +6 -0
- package/dist/core/roles.js +11 -5
- package/dist/core/rule-lane-reads.d.ts +3 -0
- package/dist/core/rule-lane-reads.js +5 -1
- package/dist/core/rule-store-fault.d.ts +70 -0
- package/dist/core/rule-store-fault.js +102 -0
- package/dist/core/runner/advertised-writable-dirs.js +16 -31
- package/dist/core/runner/announce-once-ledger.d.ts +19 -2
- package/dist/core/runner/announce-once-ledger.js +24 -2
- package/dist/core/runner/assemble-result.d.ts +6 -0
- package/dist/core/runner/assemble-result.js +1 -1
- package/dist/core/runner/auto-strip-notice.d.ts +36 -0
- package/dist/core/runner/auto-strip-notice.js +59 -0
- package/dist/core/runner/branch-window.d.ts +3 -0
- package/dist/core/runner/branch-window.js +37 -0
- package/dist/core/runner/caller-roster.d.ts +8 -3
- package/dist/core/runner/capability-withheld-seat.js +3 -9
- package/dist/core/runner/clock-and-limits.d.ts +22 -1
- package/dist/core/runner/clock-and-limits.js +30 -0
- package/dist/core/runner/contracts.d.ts +58 -35
- package/dist/core/runner/credential-refusal-seat.d.ts +2 -0
- package/dist/core/runner/credential-refusal-seat.js +47 -0
- package/dist/core/runner/cross-boundary-lane.js +6 -4
- package/dist/core/runner/decide-continuation.js +1 -1
- package/dist/core/runner/file-history-restore.d.ts +53 -2
- package/dist/core/runner/file-history-restore.js +29 -10
- package/dist/core/runner/forward-sink.d.ts +14 -1
- package/dist/core/runner/forward-sink.js +14 -12
- package/dist/core/runner/gate-exit.d.ts +8 -7
- package/dist/core/runner/gate-exit.js +13 -13
- package/dist/core/runner/git-status-frame.js +2 -4
- package/dist/core/runner/initial-run-state.js +1 -1
- package/dist/core/runner/main-call-account.d.ts +3 -1
- package/dist/core/runner/main-call-account.js +5 -3
- package/dist/core/runner/mcp-redial.d.ts +2 -5
- package/dist/core/runner/mcp-redial.js +2 -2
- package/dist/core/runner/nested-memory-content.d.ts +7 -1
- package/dist/core/runner/nested-memory-content.js +73 -13
- package/dist/core/runner/nested-memory-lane.d.ts +44 -19
- package/dist/core/runner/nested-memory-lane.js +152 -76
- package/dist/core/runner/park-commit.js +3 -1
- package/dist/core/runner/permission-rule-lanes.d.ts +8 -2
- package/dist/core/runner/permission-rule-lanes.js +29 -3
- package/dist/core/runner/person-path-rows.d.ts +3 -11
- package/dist/core/runner/person-path-rows.js +21 -24
- package/dist/core/runner/prepare-acquire-reconcile.js +3 -1
- package/dist/core/runner/prepare-artifact.d.ts +1 -1
- package/dist/core/runner/prepare-artifact.js +20 -14
- package/dist/core/runner/prepare-ask-lane.d.ts +9 -6
- package/dist/core/runner/prepare-ask-lane.js +6 -5
- package/dist/core/runner/prepare-boundary-parks.d.ts +7 -1
- package/dist/core/runner/prepare-boundary-parks.js +27 -24
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +5 -2
- package/dist/core/runner/prepare-caps-and-workflow.js +4 -3
- package/dist/core/runner/prepare-config-doors.d.ts +9 -24
- package/dist/core/runner/prepare-config-doors.js +58 -41
- package/dist/core/runner/prepare-context-lane.d.ts +2 -2
- package/dist/core/runner/prepare-context-lane.js +3 -5
- package/dist/core/runner/prepare-defer-classify.d.ts +1 -1
- package/dist/core/runner/prepare-defer-classify.js +1 -1
- package/dist/core/runner/prepare-delegation-surface.d.ts +2 -2
- package/dist/core/runner/prepare-delegation-surface.js +3 -2
- package/dist/core/runner/prepare-file-history.d.ts +62 -26
- package/dist/core/runner/prepare-file-history.js +117 -46
- package/dist/core/runner/prepare-gate-stations.d.ts +4 -0
- package/dist/core/runner/prepare-gate-stations.js +6 -5
- package/dist/core/runner/prepare-hands-readface.d.ts +9 -4
- package/dist/core/runner/prepare-hands-readface.js +8 -4
- package/dist/core/runner/prepare-inherited-gate.d.ts +11 -4
- package/dist/core/runner/prepare-inherited-gate.js +6 -6
- package/dist/core/runner/prepare-listings.d.ts +1 -1
- package/dist/core/runner/prepare-listings.js +1 -1
- package/dist/core/runner/prepare-memory.js +2 -2
- package/dist/core/runner/prepare-offload-wrappers.d.ts +1 -1
- package/dist/core/runner/prepare-offload-wrappers.js +1 -1
- package/dist/core/runner/prepare-park-ask.d.ts +10 -3
- package/dist/core/runner/prepare-park-ask.js +7 -9
- package/dist/core/runner/prepare-policy-chain.d.ts +18 -9
- package/dist/core/runner/prepare-policy-chain.js +18 -13
- package/dist/core/runner/prepare-project-context.d.ts +1 -1
- package/dist/core/runner/prepare-project-context.js +5 -3
- package/dist/core/runner/prepare-prompt-assembly.js +2 -1
- package/dist/core/runner/prepare-prompt-inputs.d.ts +2 -2
- package/dist/core/runner/prepare-prompt-inputs.js +1 -1
- package/dist/core/runner/prepare-protocol-tools.d.ts +4 -5
- package/dist/core/runner/prepare-protocol-tools.js +7 -7
- package/dist/core/runner/prepare-question-face.d.ts +4 -2
- package/dist/core/runner/prepare-run-refs.d.ts +7 -2
- package/dist/core/runner/prepare-run-refs.js +8 -7
- package/dist/core/runner/prepare-safety-scan.d.ts +4 -3
- package/dist/core/runner/prepare-suspend-saga.d.ts +3 -7
- package/dist/core/runner/prepare-suspend-saga.js +4 -3
- package/dist/core/runner/prepare-task.js +66 -53
- package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +3 -2
- package/dist/core/runner/prepare-tool-disclosure-mount.js +2 -1
- package/dist/core/runner/prepare-turn-wiring.d.ts +3 -1
- package/dist/core/runner/prepare-turn-wiring.js +1 -1
- package/dist/core/runner/prepare-wiring-manifest.d.ts +9 -4
- package/dist/core/runner/prepare-wiring-manifest.js +14 -6
- package/dist/core/runner/prepare-workspace-restore.d.ts +4 -4
- package/dist/core/runner/prepare-workspace-restore.js +15 -6
- package/dist/core/runner/remote-env-retry.d.ts +3 -3
- package/dist/core/runner/restore-seat.d.ts +41 -0
- package/dist/core/runner/restore-seat.js +38 -0
- package/dist/core/runner/resume-admission.js +1 -1
- package/dist/core/runner/resume-apply.js +4 -3
- package/dist/core/runner/resume-checkpoint-screen.js +2 -1
- package/dist/core/runner/resume-internals-and-config.js +2 -1
- package/dist/core/runner/resume-preflight.js +2 -1
- package/dist/core/runner/rewind-files.js +22 -6
- package/dist/core/runner/rule-store-unreadable-notice.d.ts +8 -0
- package/dist/core/runner/rule-store-unreadable-notice.js +11 -0
- package/dist/core/runner/run-brain-sinks.d.ts +3 -6
- package/dist/core/runner/run-brain-sinks.js +6 -6
- package/dist/core/runner/run-compaction-machinery.d.ts +2 -2
- package/dist/core/runner/run-git-lane.d.ts +2 -0
- package/dist/core/runner/run-git-lane.js +2 -1
- package/dist/core/runner/run-harness-handlers.js +5 -4
- package/dist/core/runner/run-identity-wiring.js +20 -12
- package/dist/core/runner/run-leg.js +31 -72
- package/dist/core/runner/run-notification-lane.d.ts +3 -0
- package/dist/core/runner/run-notification-lane.js +2 -4
- package/dist/core/runner/run-reasoning-seat.d.ts +5 -6
- package/dist/core/runner/run-reasoning-seat.js +13 -18
- package/dist/core/runner/run-settle-and-teardown.js +13 -9
- package/dist/core/runner/run-terminal-adoption.js +4 -8
- package/dist/core/runner/run-turn-boundary.js +6 -3
- package/dist/core/runner/runtask.d.ts +9 -4
- package/dist/core/runner/runtask.js +29 -22
- package/dist/core/runner/session-rule-policy.d.ts +11 -1
- package/dist/core/runner/shell-env-withheld.js +2 -7
- package/dist/core/runner/side-call-account.d.ts +5 -6
- package/dist/core/runner/side-call-account.js +2 -2
- package/dist/core/runner/stream-lifecycle-verbs.d.ts +3 -0
- package/dist/core/runner/stream-lifecycle-verbs.js +5 -3
- package/dist/core/runner/stream-settle-backstop.js +4 -6
- package/dist/core/runner/stream-steer-verb.d.ts +1 -1
- package/dist/core/runner/stream-steer-verb.js +4 -4
- package/dist/core/runner/sub-agent-deny-lists.d.ts +8 -3
- package/dist/core/runner/sub-agent-deny-lists.js +7 -4
- package/dist/core/runner/teardown-bounded.d.ts +7 -0
- package/dist/core/runner/teardown-bounded.js +7 -0
- package/dist/core/runner/terminal-account.js +41 -13
- package/dist/core/runner/terminal-projection.d.ts +1 -5
- package/dist/core/runner/tool-end-body.d.ts +9 -3
- package/dist/core/runner/tool-end-body.js +6 -3
- package/dist/core/runner/tool-output-projection.d.ts +13 -4
- package/dist/core/runner/tool-output-projection.js +10 -14
- package/dist/core/runner/turn-attachments.d.ts +3 -2
- package/dist/core/runner/turn-attachments.js +12 -5
- package/dist/core/runner-deps.d.ts +6 -6
- package/dist/core/runtime-caps.d.ts +2 -1
- package/dist/core/secret-env.d.ts +20 -3
- package/dist/core/secret-env.js +13 -15
- package/dist/core/session-checkout.d.ts +115 -15
- package/dist/core/session-checkout.js +435 -136
- package/dist/core/session-policy-store.js +21 -3
- package/dist/core/session-reconcile.js +1 -0
- package/dist/core/session-store.js +2 -0
- package/dist/core/session.d.ts +11 -1
- package/dist/core/shell-run-candidates.d.ts +1 -0
- package/dist/core/shell-run-candidates.js +1 -1
- package/dist/core/shutdown-debug.d.ts +6 -5
- package/dist/core/shutdown-debug.js +5 -1
- package/dist/core/skill-grant.js +4 -1
- package/dist/core/skills-directory.js +5 -3
- package/dist/core/spec-contract.d.ts +1 -1
- package/dist/core/store-contracts/checkpoint-store-contract.js +2 -7
- package/dist/core/store-contracts/file-history-store-contract.js +26 -2
- package/dist/core/store-contracts/session-deletion-cascade-contract.js +130 -14
- package/dist/core/store-contracts/task-list-store-contract.d.ts +2 -1
- package/dist/core/store-contracts/task-list-store-contract.js +28 -1
- package/dist/core/task-event.d.ts +48 -27
- package/dist/core/task-notification.d.ts +15 -9
- package/dist/core/task-notification.js +12 -0
- package/dist/core/task-registry-agent.d.ts +24 -22
- package/dist/core/task-registry-agent.js +65 -46
- package/dist/core/task-registry-shared.d.ts +17 -5
- package/dist/core/task-registry.d.ts +17 -6
- package/dist/core/task-registry.js +6 -1
- package/dist/core/task-result.d.ts +71 -25
- package/dist/core/task-spec-members.d.ts +0 -1
- package/dist/core/task-spec-members.js +1 -1
- package/dist/core/task-spec.d.ts +60 -52
- package/dist/core/task-stream.d.ts +45 -12
- package/dist/core/terminal-cause.d.ts +45 -8
- package/dist/core/terminal-cause.js +5 -0
- package/dist/core/tool-card-bound.d.ts +32 -0
- package/dist/core/tool-card-bound.js +33 -0
- package/dist/core/tool-catalog-entries.d.ts +9 -0
- package/dist/core/tool-catalog-entries.js +48 -0
- package/dist/core/tool-errors.d.ts +4 -3
- package/dist/core/tool-face.d.ts +3 -3
- package/dist/core/tool-mount-facts.d.ts +3 -2
- package/dist/core/tool-mount-facts.js +1 -1
- package/dist/core/tool-mount-static.js +7 -5
- package/dist/core/tool-policy.d.ts +21 -19
- package/dist/core/tool-policy.js +5 -6
- package/dist/core/tool-registry.d.ts +3 -1
- package/dist/core/tool-registry.js +15 -1
- package/dist/core/tool-result-store.d.ts +9 -3
- package/dist/core/tool-result-store.js +14 -1
- package/dist/core/tool-roster.d.ts +6 -0
- package/dist/core/tool-roster.js +18 -0
- package/dist/core/tool-spec.d.ts +17 -8
- package/dist/core/trace.d.ts +35 -31
- package/dist/core/types.d.ts +2 -2
- package/dist/core/untrusted-egress.d.ts +19 -7
- package/dist/core/untrusted-egress.js +26 -7
- package/dist/core/untrusted-text.d.ts +6 -18
- package/dist/core/untrusted-text.js +11 -4
- package/dist/core/user-attachment.d.ts +9 -6
- package/dist/core/user-attachment.js +12 -10
- package/dist/core/user-row-origin.d.ts +44 -25
- package/dist/core/user-row-origin.js +30 -20
- package/dist/core/wiring-manifest.d.ts +26 -7
- package/dist/core/wiring-manifest.js +14 -11
- package/dist/core/workspace-snapshot.d.ts +3 -1
- package/dist/core/workspace-snapshot.js +1 -0
- package/dist/engine/execution-env/node-execution-env.d.ts +23 -16
- package/dist/engine/execution-env/node-execution-env.js +127 -67
- package/dist/engine/harness/agent-harness.d.ts +4 -5
- package/dist/engine/harness/agent-harness.js +2 -7
- package/dist/engine/harness/types.d.ts +51 -19
- package/dist/engine/harness/types.js +28 -1
- package/dist/engine/llm/types.d.ts +26 -14
- package/dist/engine/llm/types.js +2 -2
- package/dist/engine/loop/agent-loop.d.ts +2 -2
- package/dist/engine/loop/agent-loop.js +51 -275
- package/dist/engine/loop/types.d.ts +0 -18
- package/dist/engine/session/import-validate.d.ts +3 -0
- package/dist/engine/session/import-validate.js +34 -2
- package/dist/engine/session/repo-utils.d.ts +42 -4
- package/dist/engine/session/repo-utils.js +33 -5
- package/dist/engine/session/session.d.ts +41 -14
- package/dist/engine/session/session.js +96 -25
- package/dist/index.d.ts +21 -16
- package/dist/index.js +16 -10
- package/dist/orchestration/run-spec.d.ts +1 -1
- package/dist/orchestration/run-workflow-tool.d.ts +12 -9
- package/dist/orchestration/run-workflow-tool.js +15 -19
- package/dist/orchestration/workflow-governance.js +13 -21
- package/dist/orchestration/workflow-observe.d.ts +4 -3
- package/dist/orchestration/workflow-primitives.d.ts +1 -1
- package/dist/orchestration/workflow-record-artifact.d.ts +14 -0
- package/dist/orchestration/workflow-record-artifact.js +32 -0
- package/dist/orchestration/workflow-script-store.d.ts +9 -0
- package/dist/orchestration/workflow-script-store.js +20 -1
- package/dist/orchestration/workflow-types.d.ts +33 -3
- package/dist/orchestration/workflow.d.ts +24 -14
- package/dist/orchestration/workflow.js +52 -23
- package/dist/prompt-assembly/artifact.js +4 -8
- package/dist/prompt-assembly/catalog/engine.d.ts +263 -0
- package/dist/prompt-assembly/catalog/engine.js +30 -0
- package/dist/prompt-assembly/catalog/index.d.ts +1 -1
- package/dist/prompt-assembly/catalog/index.js +2 -2
- package/dist/prompt-assembly/catalog/locales/zh-Hans/engine.d.ts +1 -1
- package/dist/prompt-assembly/catalog/locales/zh-Hans/engine.js +29 -0
- package/dist/prompt-assembly/epoch.js +6 -8
- package/dist/prompt-assembly/turn-snapshot.js +8 -9
- package/dist/stores/file/background-agent-store.js +5 -6
- package/dist/stores/file/checkpoint-store.d.ts +0 -4
- package/dist/stores/file/checkpoint-store.js +7 -3
- package/dist/stores/file/file-history-store.d.ts +8 -0
- package/dist/stores/file/file-history-store.js +72 -0
- package/dist/stores/file/fs-atomic.js +17 -12
- package/dist/stores/file/index.js +11 -5
- package/dist/stores/file/mailbox-store.js +13 -4
- package/dist/stores/file/permission-rule-store.js +14 -13
- package/dist/stores/file/shared-ledger.d.ts +4 -0
- package/dist/stores/file/shared-ledger.js +4 -0
- package/dist/stores/file/task-list-store.js +12 -3
- package/dist/stores/file/workflow-run-store.js +1 -0
- package/dist/tools/fs/bash-program-position.d.ts +4 -2
- package/dist/tools/fs/bash-program-position.js +1 -1
- package/dist/tools/fs/bash-readonly-classifier.js +1 -1
- package/dist/tools/fs/bound-open.d.ts +97 -0
- package/dist/tools/fs/bound-open.js +103 -0
- package/dist/tools/fs/containment-face.d.ts +2 -2
- package/dist/tools/fs/fs-pdf.d.ts +7 -1
- package/dist/tools/fs/fs-pdf.js +31 -23
- package/dist/tools/fs/fs-read.d.ts +24 -17
- package/dist/tools/fs/fs-read.js +84 -53
- package/dist/tools/fs/fs-shared.d.ts +14 -12
- package/dist/tools/fs/fs-shared.js +5 -4
- package/dist/tools/fs/fs-write.d.ts +2 -2
- package/dist/tools/fs/fs-write.js +20 -12
- package/dist/tools/fs/index.d.ts +4 -4
- package/dist/tools/fs/index.js +2 -2
- package/dist/tools/fs/notebook.d.ts +1 -1
- package/dist/tools/fs/pdf.d.ts +12 -3
- package/dist/tools/fs/pdf.js +22 -9
- package/dist/tools/fs/read-deny-home.d.ts +3 -2
- package/dist/tools/fs/read-deny-home.js +8 -11
- package/dist/tools/fs/safety.d.ts +3 -2
- package/dist/tools/fs/shell-read-check.js +10 -9
- package/dist/tools/monitor.d.ts +6 -5
- package/dist/tools/task-list.d.ts +16 -6
- package/dist/tools/task-list.js +4 -0
- package/dist/tools/web.d.ts +9 -1
- package/dist/tools/web.js +8 -3
- package/dist/tools/worktree.d.ts +7 -5
- package/dist/tools/worktree.js +4 -3
- package/package.json +4 -3
- package/test/export-surface.snapshot.json +93 -7
- package/wire-changes/core-stores-sql@7.67.3.json +39 -0
- package/wire-changes/core-stores-sql@7.68.0.json +39 -0
- package/wire-changes/core@7.67.3.json +65 -0
- package/wire-changes/core@7.68.0.json +4257 -0
- package/wire-changes/mods-kernel@7.67.3.json +39 -0
- package/wire-changes/mods-kernel@7.68.0.json +129 -0
- package/wire-changes/primitives@7.67.3.json +39 -0
- package/wire-changes/primitives@7.68.0.json +253 -0
- package/wire-changes/wiki-gate@7.67.3.json +39 -0
- package/wire-changes/wiki-gate@7.68.0.json +39 -0
- package/dist/core/runner/credential-origin-seat.d.ts +0 -2
- package/dist/core/runner/credential-origin-seat.js +0 -20
|
@@ -6,6 +6,7 @@ import { PATH_RULE_FACES, READ_RULE_TOOL, eligiblePersisted, noticeRuleText } fr
|
|
|
6
6
|
import { bindPathRules, persistedRowAnchors, projectScopeIdentity } from "../path-rule-binding.js";
|
|
7
7
|
import { DEFAULT_GATE_AWAIT_TIMEOUT_MS, gateWaitFailureOf, withGateTimeout } from "../gate-bounded-await.js";
|
|
8
8
|
import { thrownText } from "../thrown-value.js";
|
|
9
|
+
import { ruleStoreFaultReasonOf, ruleStoreSourcesWord } from "../rule-store-fault.js";
|
|
9
10
|
import { inlineUntrusted } from "../untrusted-text.js";
|
|
10
11
|
import { deliverEngineNotice } from "../engine-notice.js";
|
|
11
12
|
import { compileReadDeny, compileWriteDeny, readDenySeat, rowsWhereTheyLead } from "../../tools/fs/read-deny.js";
|
|
@@ -83,16 +84,17 @@ export function createPersonPathRows(cfg) {
|
|
|
83
84
|
cfg.onDisclosure(line);
|
|
84
85
|
cfg.onRowsDropped(view.droppedRows);
|
|
85
86
|
if (holdsPersonRows && view.unreadable !== undefined)
|
|
86
|
-
announce(at, view.unreadable, view
|
|
87
|
+
announce(at, view.unreadable, faultsOfView(view));
|
|
87
88
|
land(outcomeOf(view));
|
|
88
89
|
}, answer);
|
|
89
90
|
const read = withGateTimeout(raw, PERSON_READ_BOUND_MS, cfg.signal, "personRules").then((view) => readOf(outcomeOf(view)), (err) => {
|
|
90
91
|
const failure = gateWaitFailureOf(err);
|
|
91
92
|
const cut = failure === "aborted";
|
|
92
|
-
const
|
|
93
|
+
const faults = [{ sources: sourcesOf(partitions), reason: failure === "timeout" ? "no_answer" : ruleStoreFaultReasonOf(err) }];
|
|
94
|
+
const outcome = { seq, failed: new Set(partitions), why: thrownText(err), ...(cut ? { cut: true } : { faults }) };
|
|
93
95
|
land(outcome);
|
|
94
96
|
if (holdsPersonRows && !cut)
|
|
95
|
-
announce(at, outcome.why);
|
|
97
|
+
announce(at, outcome.why, faults);
|
|
96
98
|
if (failure === "timeout" && seq > (silent?.seq ?? 0))
|
|
97
99
|
silent = { seq, read };
|
|
98
100
|
return readOf(outcome);
|
|
@@ -116,14 +118,26 @@ export function createPersonPathRows(cfg) {
|
|
|
116
118
|
cfg.onDisclosure(message);
|
|
117
119
|
cfg.onDefect?.(new Error(message));
|
|
118
120
|
};
|
|
121
|
+
const sourcesOf = (ps) => {
|
|
122
|
+
const set = new Set(ps);
|
|
123
|
+
return [...(set.has("durable") ? ["user", "project"] : []), ...(set.has("session") ? ["session"] : [])];
|
|
124
|
+
};
|
|
125
|
+
const faultsOfView = (view) => {
|
|
126
|
+
if (view.unreadable === undefined)
|
|
127
|
+
return undefined;
|
|
128
|
+
const named = view.unreadableSources ?? [];
|
|
129
|
+
return view.unreadableFaults ?? [{ sources: named.length > 0 ? named : sourcesOf(failedOf(view)), reason: "unclassified" }];
|
|
130
|
+
};
|
|
119
131
|
const readOf = (o) => {
|
|
120
132
|
const rules = partitions.flatMap((p) => lawed(p, o.view !== undefined && !o.failed.has(p) ? o.view.rules.filter((r) => partitionOf(r.source) === p) : undefined));
|
|
121
133
|
const unreadable = o.view !== undefined ? o.view.unreadable : (o.why ?? "the store did not answer");
|
|
122
|
-
|
|
134
|
+
const faults = o.view !== undefined ? faultsOfView(o.view) : o.faults;
|
|
135
|
+
return { rules, ...(o.view !== undefined ? { org: o.view.org } : {}), ...(unreadable !== undefined ? { unreadable } : {}), ...(faults !== undefined ? { unreadableFaults: faults } : {}) };
|
|
123
136
|
};
|
|
124
|
-
const announce = (at, why,
|
|
125
|
-
|
|
126
|
-
cfg.
|
|
137
|
+
const announce = (at, why, faults) => {
|
|
138
|
+
const sources = (faults ?? []).flatMap((f) => f.sources);
|
|
139
|
+
cfg.onDisclosure(`the person's persisted rules could not be read (${at === "prepare" ? "when the run started" : "for a call"}${sources.length > 0 ? `; ${ruleStoreSourcesWord(sources)} rows` : ""}): their allow rows take no part until a read succeeds, the deny and ask rows of the run's last successful read still apply — ${why}`);
|
|
140
|
+
cfg.onUnread(at, faults ?? []);
|
|
127
141
|
};
|
|
128
142
|
const tableRowsOf = async (rules) => {
|
|
129
143
|
if (rules.length === 0)
|
|
@@ -393,23 +407,6 @@ function scopeKey(rule) {
|
|
|
393
407
|
const scope = rule?.scope;
|
|
394
408
|
return scope === undefined ? "" : scope.kind === "project" ? `project:${scope.root}` : scope.kind;
|
|
395
409
|
}
|
|
396
|
-
function sourcesWord(sources) {
|
|
397
|
-
return sources.length <= 1 ? sources.join("") : `${sources.slice(0, -1).join(", ")} and ${sources[sources.length - 1]}`;
|
|
398
|
-
}
|
|
399
|
-
export function ruleStoreUnreadableNotice(onNotice, ids) {
|
|
400
|
-
let sent = false;
|
|
401
|
-
return (at, sources) => {
|
|
402
|
-
if (sent)
|
|
403
|
-
return;
|
|
404
|
-
sent = true;
|
|
405
|
-
const which = sources !== undefined && sources.length > 0 ? `your persisted permission rules from the ${sourcesWord(sources)} sources` : "your persisted permission rules";
|
|
406
|
-
deliverEngineNotice(onNotice, {
|
|
407
|
-
code: "permission.rule_store_unavailable",
|
|
408
|
-
message: `${which} could not be read ${at === "prepare" ? "when this run started" : "for a call on this run"}. Until a read of them succeeds, none of their allow rows (Read directory rows included) applies, while the deny and ask rows most recently read from them this run still apply — a deny row you removed since that read keeps refusing until then. While they cannot be read, every call is asked about rather than allowed, whatever its tool (rules nobody can read may name any), until a read of them succeeds. Every later check reads them again.`,
|
|
409
|
-
detail: { at, sessionId: ids.sessionId, runId: ids.runId },
|
|
410
|
-
});
|
|
411
|
-
};
|
|
412
|
-
}
|
|
413
410
|
export function ruleRowsDroppedNotice(onNotice, ids) {
|
|
414
411
|
let sent = false;
|
|
415
412
|
return (rows) => {
|
|
@@ -8,6 +8,7 @@ import { detectConflicts, settleBranchWriteBack } from "./branch-writeback.js";
|
|
|
8
8
|
import { settleTeardownLeg } from "./teardown-bounded.js";
|
|
9
9
|
import { writesThroughLeg } from "./session-write-ledger.js";
|
|
10
10
|
import { replayLossLeg } from "./lineage-reroot-view.js";
|
|
11
|
+
import { refuseBranchOutsideWindow } from "./branch-window.js";
|
|
11
12
|
const RECONCILE_MAX_RETRIES = 3;
|
|
12
13
|
export async function prepareAcquireReconcile(input) {
|
|
13
14
|
const { sessions, spec, resume, wakeEffects } = input;
|
|
@@ -101,7 +102,8 @@ export async function prepareAcquireReconcile(input) {
|
|
|
101
102
|
throw e;
|
|
102
103
|
}
|
|
103
104
|
}
|
|
104
|
-
const storage = session.getStorage(), leafBefore = await storage.getLeafId(),
|
|
105
|
+
const storage = session.getStorage(), leafBefore = await storage.getLeafId(), landing = spec.resumeAtMode === "before" ? entry.parentId : entry.type === "message" && entry.message.role === "user" ? lastAttachmentFrameOf(await session.getEntries(), spec.resumeAt) : spec.resumeAt;
|
|
106
|
+
const leafSet = await refuseBranchOutsideWindow(acquired.session.getStorage(), landing, spec.resumeAt, acquired.sessionId);
|
|
105
107
|
await storage.setLeafId(leafSet);
|
|
106
108
|
own.ids = new Set();
|
|
107
109
|
branch = { storage, leafBefore, leafSet, own };
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* `config.artifact_host_invalid` (operator audience) so a bad wiring can never read as "no hosting"; a
|
|
5
5
|
* valid seat mounts ONE `Artifact` tool assembled from the declaration, on the same optional band the LSP
|
|
6
6
|
* seat uses. The tool's local-file read goes through the run's fs fence (root containment, read-deny, read
|
|
7
|
-
* face) exactly as `Read` does, then reads the bytes once from the
|
|
7
|
+
* face) exactly as `Read` does, then reads the bytes once from the object at the judged key, as `Read` does. A local stub's store
|
|
8
8
|
* (`capabilities.storageDir`) must lie OUTSIDE every root the run may write or read — a ledger the model can
|
|
9
9
|
* edit or read through the fs tools is not a trust boundary — judged by {@link rootAdmittingArtifactStore} at
|
|
10
10
|
* every point a root is admitted: here over the prepare-time roots (a store that overlaps one refuses the mount,
|
|
@@ -7,6 +7,7 @@ import { defineTool } from "../tools.js";
|
|
|
7
7
|
import { inlineUntrusted } from "../untrusted-text.js";
|
|
8
8
|
import { physicalPathOfExisting } from "../physical-path.js";
|
|
9
9
|
import { resolveKey, rootAdmittingArtifactStore, violationDetails, violationText } from "../../tools/fs/safety.js";
|
|
10
|
+
import { readObjectAt, readWithin, sameKeyAgain } from "../../tools/fs/bound-open.js";
|
|
10
11
|
import { createArtifactTool } from "../../tools/artifact/artifact-tool.js";
|
|
11
12
|
import { thrownText } from "../thrown-value.js";
|
|
12
13
|
export function prepareArtifact(input) {
|
|
@@ -45,22 +46,27 @@ export function prepareArtifact(input) {
|
|
|
45
46
|
if (rootCanonical === undefined)
|
|
46
47
|
return { ok: false, reason: "refused", text: "Error (Artifact): this task has no filesystem root, so a local file cannot be published." };
|
|
47
48
|
await additionalRootsCanonical.ready(signal);
|
|
48
|
-
const
|
|
49
|
+
const cwd = handsCwdRef?.current;
|
|
50
|
+
const judge = (s) => resolveKey(executionEnv, rootCanonical, path, s, cwd, additionalRootsCanonical, undefined, readDenyMatcher, resolvedReadFace);
|
|
51
|
+
const rk = await judge(signal);
|
|
49
52
|
if (!rk.ok)
|
|
50
53
|
return { ok: false, reason: "refused", text: violationText("Artifact", rk.violation), details: violationDetails(rk.violation) };
|
|
51
|
-
const
|
|
52
|
-
if (!
|
|
53
|
-
return { ok: false, reason: "refused", text: `Error (Artifact): cannot stat ${inlineUntrusted(path, 200)} (${inlineUntrusted(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
return { ok:
|
|
63
|
-
|
|
54
|
+
const opened = await readObjectAt(executionEnv, rk.key, sameKeyAgain((s) => judge(s ?? signal), rk.key), signal);
|
|
55
|
+
if (!opened.ok)
|
|
56
|
+
return { ok: false, reason: "refused", text: `Error (Artifact): cannot ${opened.step === "open" ? "read" : "stat"} ${inlineUntrusted(path, 200)} (${inlineUntrusted(opened.error.code, 40)}).` };
|
|
57
|
+
try {
|
|
58
|
+
if (opened.value.kind !== "file")
|
|
59
|
+
return { ok: false, reason: "not_a_file", kind: opened.value.kind };
|
|
60
|
+
const r = await readWithin(opened.value, maxBytes, signal);
|
|
61
|
+
if (r.kind === "over")
|
|
62
|
+
return { ok: false, reason: "too_large", size: r.size, limit: maxBytes, judgedOn: r.on === "size" ? "metadata" : "bytes" };
|
|
63
|
+
if (r.kind === "failed")
|
|
64
|
+
return { ok: false, reason: "refused", text: `Error (Artifact): cannot read ${inlineUntrusted(path, 200)} (${inlineUntrusted(r.error.code, 40)}).` };
|
|
65
|
+
return { ok: true, key: rk.key, bytes: r.bytes };
|
|
66
|
+
}
|
|
67
|
+
finally {
|
|
68
|
+
await opened.value.close();
|
|
69
|
+
}
|
|
64
70
|
};
|
|
65
71
|
const onAsk = wrapApprover(approver, (inner) => (req, signal) => toolOccurrences.whileAwaitingUser(req.toolCallId, () => inner(req, signal)));
|
|
66
72
|
const artifactSpec = createArtifactTool({ host, capabilities: verdict.capabilities, runId, taskId, sessionId, ...(agentName !== undefined ? { agentName } : {}), readLocalFile, ...(onAsk !== undefined ? { onAsk } : {}), permissionMode: () => permissionMode.current, ...(deps.onNotice !== undefined ? { onNotice: deps.onNotice } : {}) });
|
|
@@ -3,17 +3,20 @@ import type { AgentTool } from "../../internal/harness.js";
|
|
|
3
3
|
import type { AdvertisedWritableDirs } from "./advertised-writable-dirs.js";
|
|
4
4
|
import type { AutoModeDenialTracker } from "../auto-mode.js";
|
|
5
5
|
import { type LegModBus } from "../mods/stations.js";
|
|
6
|
+
import { type ApprovalParkNotResumable } from "../park-resumability.js";
|
|
6
7
|
import { type AskSourceIdentity, type OnAsk, type ToolCallRequest, type ToolPolicy } from "../tool-policy.js";
|
|
7
8
|
import { type DeferredAsk, type MarkerChannel } from "./deferred-ask.js";
|
|
8
9
|
import type { RunnerDeps } from "../types.js";
|
|
9
10
|
import type { CwdRef } from "../../tools/fs/fs-shared.js";
|
|
10
11
|
import type { AskLane, Prepared } from "./contracts.js";
|
|
12
|
+
import { type CallRiskAxes } from "../ask-origin.js";
|
|
11
13
|
import { type ToolRosterDeltaSeat } from "../tool-roster.js";
|
|
12
14
|
import { type ExistingTargetSeat } from "../existing-target.js";
|
|
13
15
|
import { type GrantBindingOf } from "../skill-grant-binding.js";
|
|
14
16
|
import { consumeInheritedAskGrant } from "./inherited-ask-grants.js";
|
|
15
17
|
import { type GrantReadRoot } from "./read-root-grant.js";
|
|
16
18
|
import type { ApprovalWordsSeat } from "../approval-words.js";
|
|
19
|
+
import type { EngineText } from "../../prompt-assembly/engine-text.js";
|
|
17
20
|
import type { createRuleOffersOf } from "./permission-rule-lanes.js";
|
|
18
21
|
export interface PrepareAskLaneInput {
|
|
19
22
|
/** borrowed-readonly — the wiring-manifest phase's ONE activation predicate; false ⇒ this phase builds nothing and
|
|
@@ -71,10 +74,7 @@ export interface PrepareAskLaneInput {
|
|
|
71
74
|
askSource: AskSourceIdentity;
|
|
72
75
|
/** borrowed-readonly — the policy-chain phase's per-tool risk-axes projection (`riskAxes` on the ask). */
|
|
73
76
|
riskAxesOf: (call: Pick<ToolCallRequest, "toolName" | "face">) => {
|
|
74
|
-
riskAxes?:
|
|
75
|
-
irreversible?: boolean;
|
|
76
|
-
egress?: boolean;
|
|
77
|
-
};
|
|
77
|
+
riskAxes?: CallRiskAxes;
|
|
78
78
|
};
|
|
79
79
|
/** borrowed-mutable — the auto-mode denial tracker's live seat (undefined until an arming). Writer here: the carry mint
|
|
80
80
|
* arms the auto-deny window on it iff the seat about to be called is live (the tracker's one writer). */
|
|
@@ -106,8 +106,11 @@ export interface PrepareAskLaneInput {
|
|
|
106
106
|
/** borrowed-readonly — the run's card-target source, filled once the run's served-read judge exists; `current` is read
|
|
107
107
|
* per ask. Empty (hands-less) ⇒ a card in scope says `withheld` / `unavailable`. */
|
|
108
108
|
existingTargetSeat: ExistingTargetSeat;
|
|
109
|
-
/** borrowed-readonly — the driver's refusal fact `forcedGateNotResumable
|
|
110
|
-
|
|
109
|
+
/** borrowed-readonly — the driver's refusal fact `forcedGateNotResumable` (the leg fact's source word where it binds): `resolveAskBound`
|
|
110
|
+
* refuses every ask unconsulted, and the refusal names that source's way out. */
|
|
111
|
+
forcedGateNotResumable: ApprovalParkNotResumable | false | undefined;
|
|
112
|
+
/** borrowed-readonly — the run's engine text reading (its locale): the card's headline is minted in it. */
|
|
113
|
+
engineText: EngineText;
|
|
111
114
|
}
|
|
112
115
|
export interface PrepareAskLaneResult {
|
|
113
116
|
/** owned — the lane, or undefined exactly when `gateMachineryActive` is false (then the suspend saga, the boundary
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { askFallbackMessage, cardDisclosureOf } from "../allow-entry.js";
|
|
2
2
|
import { APPROVAL_DISPLAY_MAX_CHARS, sanitizeApprovalDisplay } from "../approval-display.js";
|
|
3
3
|
import { primaryActivityArg } from "../arg-summary.js";
|
|
4
|
-
import {
|
|
4
|
+
import { observePermissionDenied } from "../mods/stations.js";
|
|
5
|
+
import { notResumableRefusal } from "../park-resumability.js";
|
|
5
6
|
import { callFactsSeat, attest, attestationOf, isAnsweringSeat, resolveAskFor } from "../tool-policy.js";
|
|
6
7
|
import { exactBoundInputHashOf } from "../canonical-json.js";
|
|
7
8
|
import { mintCheckpointId } from "../checkpoint-store.js";
|
|
@@ -21,7 +22,7 @@ import { settleReadRootGrant } from "./read-root-grant.js";
|
|
|
21
22
|
function createDenyObserverNotifier(bus, signal) {
|
|
22
23
|
if (bus === undefined || !bus.hasHandlers("classic.PermissionDenied"))
|
|
23
24
|
return undefined;
|
|
24
|
-
return (payload) =>
|
|
25
|
+
return (payload) => observePermissionDenied({ legBus: bus, payload, signal });
|
|
25
26
|
}
|
|
26
27
|
function resolveApprovalPreview(tools, toolName, args) {
|
|
27
28
|
const t = toolNameIndex([...survivorsByName(tools).values()])(toolName);
|
|
@@ -44,7 +45,7 @@ function resolveApprovalPreview(tools, toolName, args) {
|
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
47
|
export function prepareAskLane(input) {
|
|
47
|
-
const { gateMachineryActive, abortController, effectivePolicy, budgetSnapshot, handsCwdRef, handsRoot, stampCallTarget, advertisedWritableDirs, exemptRoots, tools, inheritedUnavailableAsks, deferredAskIdentities, inheritedAskGrants, onAsk, humanReviewRef, now, ruleOffersOf, grantBindingOf, askSource, riskAxesOf, autoModeDenialTracking, hostTaskId, deps, sessionId, runId, grantReadRoot, approvalWords, modBus, notifyOwnHookCrash, toolRosterDeltas, existingTargetSeat, forcedGateNotResumable } = input;
|
|
48
|
+
const { gateMachineryActive, abortController, effectivePolicy, budgetSnapshot, handsCwdRef, handsRoot, stampCallTarget, advertisedWritableDirs, exemptRoots, tools, inheritedUnavailableAsks, deferredAskIdentities, inheritedAskGrants, onAsk, humanReviewRef, now, ruleOffersOf, grantBindingOf, askSource, riskAxesOf, autoModeDenialTracking, hostTaskId, deps, sessionId, runId, grantReadRoot, approvalWords, modBus, notifyOwnHookCrash, toolRosterDeltas, existingTargetSeat, forcedGateNotResumable, engineText } = input;
|
|
48
49
|
if (!gateMachineryActive)
|
|
49
50
|
return { askLane: undefined };
|
|
50
51
|
const composedCallSignal = (callSignal) => composeCallSignal(abortController.signal, callSignal);
|
|
@@ -83,7 +84,7 @@ export function prepareAskLane(input) {
|
|
|
83
84
|
: attest(intercepted, req, { settlement, inputDigest: exactBoundInputHashOf(req.toolName, req.args) });
|
|
84
85
|
}
|
|
85
86
|
if (forcedGateNotResumable) {
|
|
86
|
-
const message = `approval for "${req.toolName}" is mandated to wait durably for this principal (forceDurableGate),
|
|
87
|
+
const message = notResumableRefusal(`approval for "${req.toolName}" is mandated to wait durably for this principal (forceDurableGate)`, forcedGateNotResumable, "call");
|
|
87
88
|
const members = { settlement: { kind: "no_approver", who: { party: "none" }, when: now() }, unresolvableCause: "mandate_unreconstructible", inputDigest: exactBoundInputHashOf(req.toolName, req.args) };
|
|
88
89
|
const asked = decision.action === "ask" ? { ...(decision.origin !== undefined ? { origin: decision.origin } : {}), ...(decision.classes !== undefined ? { classes: decision.classes } : {}) } : {};
|
|
89
90
|
return attest({ action: "deny", message, decisionReason: "mode" }, req, { ...members, ...asked });
|
|
@@ -118,7 +119,7 @@ export function prepareAskLane(input) {
|
|
|
118
119
|
...(decision.action === "ask" && decision.probeCause !== undefined ? { probeCause: decision.probeCause } : {}),
|
|
119
120
|
...(decision.action === "ask" && decision.probeReadRootCandidate !== undefined ? { readRootCandidate: decision.probeReadRootCandidate } : {}),
|
|
120
121
|
...(decision.action === "ask" && decision.ruleEvidence !== undefined ? { ruleEvidence: decision.ruleEvidence } : {}),
|
|
121
|
-
}, onAsk, composedCallSignal(callSignal), lateAskSettlementObserver({ toolName: req.toolName, toolCallId: req.toolCallId, sessionId, runId, taskId: hostTaskId, onNotice: deps.onNotice, onError: deps.onError }), decision, approverDefectAnnouncer({ toolName: req.toolName, toolCallId: req.toolCallId, sessionId, runId, taskId: hostTaskId, onNotice: deps.onNotice }), approvalWords);
|
|
122
|
+
}, onAsk, composedCallSignal(callSignal), lateAskSettlementObserver({ toolName: req.toolName, toolCallId: req.toolCallId, sessionId, runId, taskId: hostTaskId, onNotice: deps.onNotice, onError: deps.onError }), decision, approverDefectAnnouncer({ toolName: req.toolName, toolCallId: req.toolCallId, sessionId, runId, taskId: hostTaskId, onNotice: deps.onNotice }), approvalWords, engineText);
|
|
122
123
|
const waitMs = Math.max(0, now() - t0);
|
|
123
124
|
const granting = settleReadRootGrant(resolved.readRootGrant, grantReadRoot, { toolName: req.toolName, toolCallId: req.toolCallId, sessionId, runId, taskId: hostTaskId, onNotice: deps.onNotice, signal: composedCallSignal(callSignal) });
|
|
124
125
|
if (granting !== undefined)
|
|
@@ -20,6 +20,8 @@ import { type CheckpointStore } from "../checkpoint-store.js";
|
|
|
20
20
|
import type { SessionStore } from "../session.js";
|
|
21
21
|
import type { RunnerDeps, TaskSpec } from "../types.js";
|
|
22
22
|
import type { AskSourceIdentity } from "../tool-policy.js";
|
|
23
|
+
import type { ApprovalParkNotResumable } from "../park-resumability.js";
|
|
24
|
+
import type { RosterSpec } from "./caller-roster.js";
|
|
23
25
|
import type { Prepared, SuspendSaga } from "./contracts.js";
|
|
24
26
|
export interface PrepareBoundaryParksInput {
|
|
25
27
|
/** borrowed-readonly — the suspend saga's eight seats (the serializer, the commit saga, the loop cap, the env split, the
|
|
@@ -29,10 +31,14 @@ export interface PrepareBoundaryParksInput {
|
|
|
29
31
|
/** borrowed-readonly — the REBOUND spec. Read: `resourceSuspend` (the slice scope/ttl/maxSlices), `retainBackgroundProcesses`
|
|
30
32
|
* (the park-only sweep gate), `durableApproval` (the review pause's ttl), `principal` / `isolationScope` (the rows' identity and partition records).
|
|
31
33
|
* Never mutated. */
|
|
32
|
-
spec: Pick<TaskSpec, "resourceSuspend" | "retainBackgroundProcesses" | "
|
|
34
|
+
spec: Pick<TaskSpec, "resourceSuspend" | "retainBackgroundProcesses" | "principal" | "isolationScope"> & Pick<RosterSpec, "durableApproval">;
|
|
33
35
|
/** borrowed-readonly — the leg's checkpoint store, or undefined (then the review lane is absent and the resource mint
|
|
34
36
|
* answers false). */
|
|
35
37
|
checkpointStore: CheckpointStore | undefined;
|
|
38
|
+
/** borrowed-readonly — the driver's one leg fact (`approvalParkNotResumableOf`): a leg nobody resumes exposes no `plan_review` lane (a
|
|
39
|
+
* plan approval is a decision park), and a resource row of a leg whose host declared it cannot resume decision parks records that word (`false`), so
|
|
40
|
+
* a resume keeps it. (The `lane` source reaches the resource lanes through the suspend gaps: no lane is exposed.) */
|
|
41
|
+
approvalParkNotResumable: ApprovalParkNotResumable | undefined;
|
|
36
42
|
/** borrowed-readonly — this leg's checkpoint scope (the driver's one `checkpointScopeOf` derivation): the `plan_review`
|
|
37
43
|
* row's scope, and the resource row's when the caller declared no slice scope of its own. */
|
|
38
44
|
checkpointScope: string;
|
|
@@ -4,11 +4,14 @@ import { defaultTaskRegistry } from "../task-registry.js";
|
|
|
4
4
|
import { DEFAULT_RESOURCE_TTL_MS, humanReviewSnapshot, publishCommittedSuspend, sanitizedTtlMs, USAGE_WINDOW_REAP_MARGIN_MS } from "./park-commit.js";
|
|
5
5
|
import { remoteEnvFailureNote } from "./remote-env-retry.js";
|
|
6
6
|
import { isolationScopeRecordOf } from "../isolation-scope.js";
|
|
7
|
+
import { CLAMP_SET } from "../child-clamp-seats.js";
|
|
8
|
+
import { textContentHashOf } from "../canonical-json.js";
|
|
9
|
+
import { reviewWithdrawalClause } from "../present-plan-tool.js";
|
|
7
10
|
export function prepareBoundaryParks(input) {
|
|
8
|
-
const { saga, spec, checkpointStore, checkpointScope, abortController, harness, session, sessions, sessionId, askSource, deps, priorLedger, maxSlices, maxSuspends, resourceTotal, priorSuspendCount, suspendChainBase, humanReviewRef, liveSpendRef, now, pausedRef, remoteEnvFailures, resourceSuspendEligible, durableSuspendInfraReady, suspendTargetGap } = input;
|
|
11
|
+
const { saga, spec, checkpointStore, checkpointScope, approvalParkNotResumable, abortController, harness, session, sessions, sessionId, askSource, deps, priorLedger, maxSlices, maxSuspends, resourceTotal, priorSuspendCount, suspendChainBase, humanReviewRef, liveSpendRef, now, pausedRef, remoteEnvFailures, resourceSuspendEligible, durableSuspendInfraReady, suspendTargetGap } = input;
|
|
9
12
|
if (saga === undefined)
|
|
10
13
|
return { suspendForResource: undefined, suspendForPlatformLimit: undefined, suspendForReview: undefined };
|
|
11
|
-
const { inFlightSpendMicroUsd, serializeCheckpointState, commitSuspendSaga, suspendLoopCapHit, suspendableEnv, parkOnlyRemoteEnv, parkOnlyHandle
|
|
14
|
+
const { inFlightSpendMicroUsd, serializeCheckpointState, commitSuspendSaga, suspendLoopCapHit, suspendableEnv, parkOnlyRemoteEnv, parkOnlyHandle } = saga;
|
|
12
15
|
const mintResourceSuspend = async (reason, sliceSpend, hint) => {
|
|
13
16
|
const rs = spec.resourceSuspend;
|
|
14
17
|
if (!checkpointStore)
|
|
@@ -47,7 +50,6 @@ export function prepareBoundaryParks(input) {
|
|
|
47
50
|
const cp = {
|
|
48
51
|
token,
|
|
49
52
|
checkpointId: mintCheckpointId(),
|
|
50
|
-
...syncChildBlock,
|
|
51
53
|
scope,
|
|
52
54
|
sessionId,
|
|
53
55
|
leafId,
|
|
@@ -60,7 +62,7 @@ export function prepareBoundaryParks(input) {
|
|
|
60
62
|
suspendCount: priorSuspendCount,
|
|
61
63
|
humanReview: humanReviewSnapshot(humanReviewRef),
|
|
62
64
|
resourceLedger: resourceLedgerOut,
|
|
63
|
-
...(spec.durableApproval !== undefined ? { durableApproval: { ...spec.durableApproval } } : {}),
|
|
65
|
+
...(spec.durableApproval !== undefined ? { durableApproval: { ...spec.durableApproval } } : approvalParkNotResumable === "host" ? { durableApproval: CLAMP_SET.durableApproval.value } : {}),
|
|
64
66
|
...(spec.principal ? { principal: spec.principal } : {}),
|
|
65
67
|
...isolationScopeRecordOf(spec),
|
|
66
68
|
};
|
|
@@ -81,31 +83,29 @@ export function prepareBoundaryParks(input) {
|
|
|
81
83
|
};
|
|
82
84
|
const suspendForResource = resourceSuspendEligible ? mintResourceSuspend : undefined;
|
|
83
85
|
const suspendForPlatformLimit = durableSuspendInfraReady ? mintResourceSuspend : undefined;
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
+
const parkSkipped = (why) => {
|
|
87
|
+
try {
|
|
88
|
+
deps.onError?.(new Error(`plan_review park skipped: ${why} (the plan-review request was dropped; the run continues without pausing)`), { phase: "config", sessionId });
|
|
89
|
+
}
|
|
90
|
+
catch {
|
|
91
|
+
}
|
|
92
|
+
return false;
|
|
93
|
+
};
|
|
94
|
+
const suspendForReview = checkpointStore && approvalParkNotResumable === undefined
|
|
95
|
+
? async ({ reason, requestedByCallId, presented, withdrawn }) => {
|
|
86
96
|
if (!checkpointStore)
|
|
87
97
|
return false;
|
|
88
98
|
if (abortController.signal.aborted)
|
|
89
99
|
return false;
|
|
90
|
-
if (suspendTargetGap !== undefined)
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
catch {
|
|
95
|
-
}
|
|
96
|
-
return false;
|
|
97
|
-
}
|
|
100
|
+
if (suspendTargetGap !== undefined)
|
|
101
|
+
return parkSkipped(`the per-task execution env ${suspendTargetGap}, so its workspace could not be restored on resume`);
|
|
102
|
+
if (withdrawn !== undefined)
|
|
103
|
+
return parkSkipped(reviewWithdrawalClause(withdrawn));
|
|
98
104
|
if (suspendLoopCapHit(suspendChainBase(), maxSuspends, " for a plan_review (likely a resume/restart loop)."))
|
|
99
105
|
return false;
|
|
100
106
|
const leafId = await session.getLeafId();
|
|
101
|
-
if (!leafId)
|
|
102
|
-
|
|
103
|
-
deps.onError?.(new Error("plan_review park skipped: no committed session leaf (the plan-review request was dropped; the run continues without pausing)"), { phase: "config", sessionId });
|
|
104
|
-
}
|
|
105
|
-
catch {
|
|
106
|
-
}
|
|
107
|
-
return false;
|
|
108
|
-
}
|
|
107
|
+
if (!leafId)
|
|
108
|
+
return parkSkipped("no committed session leaf");
|
|
109
109
|
if (abortController.signal.aborted)
|
|
110
110
|
return false;
|
|
111
111
|
let remoteHandle;
|
|
@@ -133,12 +133,15 @@ export function prepareBoundaryParks(input) {
|
|
|
133
133
|
const cp = {
|
|
134
134
|
token,
|
|
135
135
|
checkpointId: mintCheckpointId(),
|
|
136
|
-
...syncChildBlock,
|
|
137
136
|
scope,
|
|
138
137
|
sessionId,
|
|
139
138
|
leafId,
|
|
140
139
|
gate,
|
|
141
|
-
pendingAction: {
|
|
140
|
+
pendingAction: {
|
|
141
|
+
kind: "plan_review",
|
|
142
|
+
...(requestedByCallId !== undefined && requestedByCallId !== "" ? { requestedByCallId } : {}),
|
|
143
|
+
...(presented !== undefined ? { planContentHash: textContentHashOf(presented) } : {}),
|
|
144
|
+
},
|
|
142
145
|
state: serializeCheckpointState(remoteHandle, inFlightSpendMicroUsd()),
|
|
143
146
|
status: "pending",
|
|
144
147
|
createdAt: mintedAt,
|
|
@@ -40,6 +40,7 @@ import { type BlockedRef } from "./synthetic-tools.js";
|
|
|
40
40
|
import type { ToolMountFacts } from "../tool-mount-facts.js";
|
|
41
41
|
import { RosterBuilder } from "../tool-roster.js";
|
|
42
42
|
import type { ParentSpecSeat } from "../parent-spec-seat.js";
|
|
43
|
+
import type { ApprovalParkNotResumable } from "../park-resumability.js";
|
|
43
44
|
import { type RosterSpec } from "./caller-roster.js";
|
|
44
45
|
export interface PrepareCapsAndWorkflowInput {
|
|
45
46
|
/** borrowed-readonly — the REBOUND spec, whole: the roster map reads `tools`; the mounts read `enableBlockedReport`,
|
|
@@ -63,6 +64,8 @@ export interface PrepareCapsAndWorkflowInput {
|
|
|
63
64
|
/** borrowed-readonly — the tree's owner seat, which the Workflow mount hands to its children (by reference). */ delegationOwner: import("./delegation-owner.js").DelegationOwnerSeat;
|
|
64
65
|
/** borrowed-readonly — the acquired session; the classifier leg rebuilds its transcript window from `buildContext`. */
|
|
65
66
|
session: Pick<StoredSession, "buildContext">;
|
|
67
|
+
/** borrowed-readonly — the run tree's MCP pool, which the Workflow mount hands to every agent it spawns (absent: none to hand). */
|
|
68
|
+
mcpPool?: import("../mcp-connection-pool.js").McpConnectionPool;
|
|
66
69
|
/** borrowed-readonly — the acquired session id (operator-line context, the refusal codes' phase record). */
|
|
67
70
|
sessionId: string;
|
|
68
71
|
/** borrowed-readonly — the run's invocation id (the classifier route pre-flight's notice names it). */
|
|
@@ -144,8 +147,8 @@ export interface PrepareCapsAndWorkflowInput {
|
|
|
144
147
|
peerLaneActive: boolean;
|
|
145
148
|
/** borrowed-readonly — the leg's effective delegation fact (`effectiveDelegationFacts`): the classifier window shows its user lane as the launching agent's. */
|
|
146
149
|
delegated: boolean; /** borrowed-readonly — the leg's checkpoint scope (a forced root's synthesized opt-in's). */
|
|
147
|
-
checkpointScope: string; /** borrowed-readonly — the driver's one leg fact (`approvalParkNotResumableOf`): with the scope, the EFFECTIVE opt-in the workflow mount forwards. */
|
|
148
|
-
approvalParkNotResumable:
|
|
150
|
+
checkpointScope: string; /** borrowed-readonly — the driver's one leg fact (`approvalParkNotResumableOf`): with the scope, the EFFECTIVE opt-in the workflow mount forwards; and whether a plan approval can park on this leg (the plan pair's seat). */
|
|
151
|
+
approvalParkNotResumable: ApprovalParkNotResumable | undefined;
|
|
149
152
|
/** borrowed-mutable — `Prepared.sideCallBookRef`: written by the run body (never here); the classifier books each of its replies through it. */
|
|
150
153
|
sideCallBookRef: Prepared["sideCallBookRef"];
|
|
151
154
|
/** borrowed-readonly — whether the BUILT-IN SendMessage is on this face (the lane rule's second term). */
|
|
@@ -122,8 +122,8 @@ function autoModeArmReasonOf(intent, facePresent, caps, capsFaulted) {
|
|
|
122
122
|
export async function prepareCapsAndWorkflow(input) {
|
|
123
123
|
const { spec, deps, parentSpecSeat, checkpointSeat, internals, session, sessionId, runId, hostTaskId, taskScope, taskRootFinal, delegationCwd, model, thinking, lockedPreflight, toolEffects, toolFaceSnapshot, promptLean, resolvedInteractionPosture, harnessRef, askSeat, runClampSource, forwardEvent, inheritedGateForChildren, enrichSpecToolCtx, maybeOffload, taskArtifacts, requestReview, enterPlanMode, permissionMode, readDenyEntries, peerLaneActive, peerSendMessageBuiltIn, runnerSelf, delegated, checkpointScope, approvalParkNotResumable, sideCallBookRef } = input;
|
|
124
124
|
const roster = new RosterBuilder(toolEffects);
|
|
125
|
-
roster.mounts.bindLeg({ leaves: valveLeaves(
|
|
126
|
-
roster.mounts.know({ ...input.mountFacts, "spec.planFile": input.planFileSource !== undefined, "seat.checkpoint": checkpointStoreOfSeat(checkpointSeat) !== undefined });
|
|
125
|
+
roster.mounts.bindLeg({ leaves: valveLeaves(toolFaceSnapshot.selector), declared: spec.tools ?? [] });
|
|
126
|
+
roster.mounts.know({ ...input.mountFacts, "spec.planFile": input.planFileSource !== undefined, "seat.checkpoint": checkpointStoreOfSeat(checkpointSeat) !== undefined && approvalParkNotResumable === undefined });
|
|
127
127
|
for (const t of spec.tools ?? []) {
|
|
128
128
|
const mounted = mountCallerTool(t);
|
|
129
129
|
if (roster.mounts.judgeMember("caller", mounted))
|
|
@@ -322,6 +322,7 @@ export async function prepareCapsAndWorkflow(input) {
|
|
|
322
322
|
scriptRunner: deps.workflowScriptRunner,
|
|
323
323
|
governanceBaseline: deps.workflowGovernanceBaseline,
|
|
324
324
|
parentToolCeiling: toolFaceSnapshot.selector.layers,
|
|
325
|
+
...(input.mcpPool !== undefined ? { parentMcpPool: input.mcpPool } : {}),
|
|
325
326
|
parentDeferTools: toolFaceSnapshot.defer,
|
|
326
327
|
parentAlwaysLoadTools: toolFaceSnapshot.alwaysLoad,
|
|
327
328
|
...(toolFaceSnapshot.restoreGated !== undefined ? { parentRestoreGatedTools: toolFaceSnapshot.restoreGated } : {}),
|
|
@@ -353,7 +354,7 @@ export async function prepareCapsAndWorkflow(input) {
|
|
|
353
354
|
},
|
|
354
355
|
...(spec.getApiKeyAndHeaders !== undefined ? { parentGetApiKeyAndHeaders: spec.getApiKeyAndHeaders } : {}),
|
|
355
356
|
...(askSeat.value !== undefined ? { parentOnAsk: askSeat.value } : {}),
|
|
356
|
-
...((own) => (own !== undefined ? {
|
|
357
|
+
...((own) => (own !== undefined ? { parentDurableApprovalForChildren: { ...own } } : {}))(effectiveDurableApprovalOf({ declared: spec.durableApproval, forceDurableGate: runtimeCaps?.forceDurableGate === true, approvalParkNotResumable, scope: checkpointScope })),
|
|
357
358
|
...(internals?.workflowParkedResume !== undefined
|
|
358
359
|
? { parkedResume: (resumeFromRunId) => {
|
|
359
360
|
const mine = internals.workflowParkedResume.filter((d) => d.runId === resumeFromRunId).map(({ runId: _r, ...rest }) => rest);
|
|
@@ -1,23 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PrepareTask's config-doors phase: the synchronous stretch from the
|
|
3
|
-
* tool-face snapshot freeze through model/thinking/compaction-model resolution. The inputs are
|
|
4
|
-
* exactly the fields of {@link PrepareConfigDoorsInput} (the original extraction slice — spec, deps,
|
|
5
|
-
* sessions, the resume/internals seats); the outputs are the fields of
|
|
6
|
-
* {@link PrepareConfigDoorsResult}, each one a value the slice defined and later phases consume —
|
|
7
|
-
* re-verified as the complete "defined inside, consumed outside" closure at extraction time.
|
|
8
|
-
*
|
|
9
|
-
* ⚠️ SYNCHRONOUS FUNCTION, SYNCHRONOUS CALL — a hard constraint, not a style choice. This phase and
|
|
10
|
-
* the safety scan after it run BEFORE prepareTask's first await (`sessions.acquire`), so a caller
|
|
11
|
-
* has no microtask window in which to mutate `spec.tools`/the face arrays between the snapshots,
|
|
12
|
-
* the doors and the scan. An `async` wrapper — even with a zero-await body — would hand the caller
|
|
13
|
-
* exactly that window (the driver's `await` yields one microtask). Pinned by the `prepare-task-phase-pins` microtask-latch tests.
|
|
14
|
-
*
|
|
15
|
-
* Throws pass through unchanged: every `config.*` / `resume_at.*` refusal here is a DELIBERATE
|
|
16
|
-
* at-the-door rejection (a throw before acquisition needs no cleanup), and the
|
|
17
|
-
* interaction-posture door's `deps.onError` disclosure (call order and payload) is part of the
|
|
18
|
-
* contract. The per-task agents rebind returns a REBOUND spec (shallow copy, only `tools`
|
|
19
|
-
* replaced) — the caller's object is never mutated; the safety scan must receive the rebound one.
|
|
20
|
-
*/
|
|
21
1
|
import { type BrainCallGuardrailRef } from "../../brain/timeout.js";
|
|
22
2
|
import type { Model } from "../../internal/llm.js";
|
|
23
3
|
import type { ThinkingLevel } from "../../internal/harness.js";
|
|
@@ -35,7 +15,7 @@ import { type AskSeat } from "../wiring-manifest.js";
|
|
|
35
15
|
import type { PrepareResume, RunInternals, ToolFaceLists } from "./contracts.js";
|
|
36
16
|
import { resolveHost } from "../../prompt-assembly/select.js";
|
|
37
17
|
import type { PromptTraitName, RenderedLocale } from "../../prompt-assembly/catalog/schema.js";
|
|
38
|
-
import { type RosterSpec } from "./caller-roster.js";
|
|
18
|
+
import { type CallerRosterSpec, type RosterSpec } from "./caller-roster.js";
|
|
39
19
|
import { type ScreenedNestedMemory } from "./nested-memory-lane.js";
|
|
40
20
|
/**
|
|
41
21
|
* The model a compaction pass summarizes on: the explicit `compactionModel` wins (resolved at `seat`, the word a
|
|
@@ -154,7 +134,7 @@ export declare function resolvePromptTraits(model: Model, promptLean: boolean |
|
|
|
154
134
|
export interface PrepareConfigDoorsInput {
|
|
155
135
|
/** borrowed-readonly — the snapshot spec (its roster is faces). NEVER mutated here: the per-task agents rebind returns a
|
|
156
136
|
* SHALLOW COPY on {@link PrepareConfigDoorsResult.spec} (only `tools` replaced, each rebuilt entry through the snapshot). */
|
|
157
|
-
spec:
|
|
137
|
+
spec: CallerRosterSpec;
|
|
158
138
|
/** borrowed-readonly — deployment seats. Read for: the two containment-face value screens, locked-config preflight,
|
|
159
139
|
* retention door, interaction-posture door (incl. `deps.onError` disclosure), usage windows,
|
|
160
140
|
* brain-call guardrail default, model/role maps. */
|
|
@@ -259,6 +239,9 @@ export interface PrepareConfigDoorsResult {
|
|
|
259
239
|
/** owned — the instruction-file family (`NESTED_MEMORY_LANE.declaration`) as its door read it, once; absent ⇒ undeclared. */
|
|
260
240
|
nestedMemory: ScreenedNestedMemory | undefined;
|
|
261
241
|
runOrigin: RunOrigin | undefined;
|
|
242
|
+
/** owned — the host declared this leg's decision parks cannot be resumed (`TaskSpec.durableApproval: false`), read ONCE here: the rebound
|
|
243
|
+
* spec carries the opt-in alone, and this word is the `host` source of the leg's one fact (`approvalParkNotResumableOf`). */
|
|
244
|
+
hostApprovalParksNotResumable: boolean;
|
|
262
245
|
}
|
|
263
246
|
/** The microCompact knob door (坏值响亮度默认律, the sibling knob doors' form:
|
|
264
247
|
* interactionPosture / toolModelGate / staleToolResultOffload). Placement is load-bearing:
|
|
@@ -283,7 +266,7 @@ export declare const checkpointStoreSeat: (spec: {
|
|
|
283
266
|
export declare function assertResumeConfigRecord(config: unknown): void;
|
|
284
267
|
/** The spec the value doors read: a prepare's (its roster is faces) or a resume's re-supplied config (no objective, no session id). */
|
|
285
268
|
type ValueDoorSpec = Omit<TaskSpec, "tools" | "objective" | "sessionId" | "userAttachments"> & Partial<Pick<TaskSpec, "objective" | "sessionId" | "userAttachments">>;
|
|
286
|
-
type ConfigValueDoorsResult = Pick<PrepareConfigDoorsResult, "toolFaceLists" | "promptHost" | "promptBinding" | "promptLocale" | "lockedPreflight" | "microCompactKnob" | "memoryDelegationEvidence" | "memoryProvenance" | "memoryCapturePolicy" | "usageWindows" | "brainCallGuardrailMs" | "crossBoundaryPosture" | "advisorTool" | "promptLean" | "hostFloor" | "runOrigin" | "nestedMemory"> & {
|
|
269
|
+
type ConfigValueDoorsResult = Pick<PrepareConfigDoorsResult, "toolFaceLists" | "promptHost" | "promptBinding" | "promptLocale" | "lockedPreflight" | "microCompactKnob" | "memoryDelegationEvidence" | "memoryProvenance" | "memoryCapturePolicy" | "usageWindows" | "brainCallGuardrailMs" | "crossBoundaryPosture" | "advisorTool" | "promptLean" | "hostFloor" | "runOrigin" | "nestedMemory" | "resolvedInteractionPosture"> & {
|
|
287
270
|
skillListingSeats: {
|
|
288
271
|
fraction: unknown;
|
|
289
272
|
maxDescChars: unknown;
|
|
@@ -309,6 +292,8 @@ export declare function configValueDoors(input: {
|
|
|
309
292
|
holder?: string | undefined;
|
|
310
293
|
resumedRow?: Parameters<typeof runOriginOfLeg>[1];
|
|
311
294
|
receivedPeers?: ReceivedPeerDeclarations;
|
|
295
|
+
parentInteractionPosture?: RunInternals["parentInteractionPosture"];
|
|
296
|
+
discloseInteractionPosture?: (err: Error) => void;
|
|
312
297
|
}, enter?: ConfigDoorEntry): ConfigValueDoorsResult;
|
|
313
298
|
/**
|
|
314
299
|
* The doors a RESUMED leg's prepare refuses at, run as one screen BEFORE the claim — prepare's own functions, so a refusal carries
|
|
@@ -324,6 +309,6 @@ export declare function configValueDoors(input: {
|
|
|
324
309
|
* corrected resume redeems the same token. A throw that is none of prepare's codes leaves as it was thrown. Returns the config the
|
|
325
310
|
* leg is handed: the caller's, its MCP servers and A2A peers the lock layer's judged copies of the lists THIS resume handed (read once, dialed as judged; the row records none).
|
|
326
311
|
*/
|
|
327
|
-
export declare function refuseResumeDoors<C extends ValueDoorSpec & Pick<TaskSpec, "userAttachments">>(config: C, deps: RunnerDeps, sessions: SessionStore,
|
|
312
|
+
export declare function refuseResumeDoors<C extends ValueDoorSpec & Pick<TaskSpec, "userAttachments">>(config: C, deps: RunnerDeps, sessions: SessionStore, internals?: Pick<RunInternals, "holder" | "parentInteractionPosture">): C;
|
|
328
313
|
export declare function prepareConfigDoors(input: PrepareConfigDoorsInput): PrepareConfigDoorsResult;
|
|
329
314
|
export {};
|