@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
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { types } from "node:util";
|
|
1
2
|
import { resolveBrainCallGuardrailMs } from "../../brain/timeout.js";
|
|
2
3
|
import { assertContainmentFaceValue } from "../../tools/fs/index.js";
|
|
3
4
|
import { MICRO_COMPACT_MACHINES } from "../context-edit.js";
|
|
@@ -19,7 +20,7 @@ import { assertAutoConsolidationWirable } from "./memory-consolidation-driver.js
|
|
|
19
20
|
import { isModelPriced, malformedPricingField, modelCostToPricing } from "../pricing.js";
|
|
20
21
|
import { ENTER_AS_IS, preflightLockedConfig } from "../locked-config.js";
|
|
21
22
|
import { assertRetentionWords } from "../retention.js";
|
|
22
|
-
import { resolveModel, resolveTaskModel, roleModelIfSet, screenRoleMap } from "../roles.js";
|
|
23
|
+
import { resolveModel, resolveTaskModel, roleModelIfSet, screenModelRole, screenRoleMap } from "../roles.js";
|
|
23
24
|
import { resolveSkillListingBudget } from "../skill-listing-budget.js";
|
|
24
25
|
import { describeRejectedValue } from "../tool-search-setting.js";
|
|
25
26
|
import { compactionSeatsDefect } from "../context-settings.js";
|
|
@@ -28,7 +29,7 @@ import { applyToolModelGate } from "../tool-model-gate.js";
|
|
|
28
29
|
import { readToolFaceLists } from "../tool-face-lists.js";
|
|
29
30
|
import { TASK_WAKE_SOURCES } from "../task-spec.js";
|
|
30
31
|
import { resolveUsageWindows } from "../usage-window-store.js";
|
|
31
|
-
import { deriveAskEffective, resolveAskSeat, resolveQuestionSeam, screenApprovalReach } from "../wiring-manifest.js";
|
|
32
|
+
import { deriveAskEffective, resolveAskSeat, resolveQuestionSeam, screenApprovalReach, screenInteractionPostureWord } from "../wiring-manifest.js";
|
|
32
33
|
import { effectiveTraitsOf, readModelPromptTraits, resolveHost, resolvePromptLean, resolvePromptLocale } from "../../prompt-assembly/select.js";
|
|
33
34
|
import { assertNoRetiredKeys, RETIRED_MODEL_KEYS } from "../retired-keys.js";
|
|
34
35
|
import { resolvePromptBinding } from "../../prompt-assembly/overlay.js";
|
|
@@ -36,7 +37,7 @@ import { assertPeerPresenceValue } from "../../agents/peer-directory.js";
|
|
|
36
37
|
import { snapshotDefinitionLists } from "../../agents/agent-definition.js";
|
|
37
38
|
import { mcpUnavailableOn, TOTAL_TOKENS_REMINDER_MODES } from "./turn-attachments.js";
|
|
38
39
|
import { refuseRetiredMember, rosterFaceOf } from "./caller-roster.js";
|
|
39
|
-
import { assertToolBoundaryLegs } from "../tool-roster.js";
|
|
40
|
+
import { assertToolBoundaryLegs, rosterMountsDelegation } from "../tool-roster.js";
|
|
40
41
|
import { assertToolCardDeclarations } from "../../prompt-assembly/tool-catalog.js";
|
|
41
42
|
import { refuseRenamedDelegationMounts } from "./sub-agent-deny-lists.js";
|
|
42
43
|
import { readDeclaredCheckpointScope } from "./checkpoint-scope.js";
|
|
@@ -88,7 +89,7 @@ export function assertCheckpointScopesFollowIsolationScope(spec) {
|
|
|
88
89
|
if (own === undefined)
|
|
89
90
|
return;
|
|
90
91
|
const declared = [
|
|
91
|
-
["durableApproval.scope", spec.durableApproval?.scope],
|
|
92
|
+
["durableApproval.scope", spec.durableApproval === false ? undefined : spec.durableApproval?.scope],
|
|
92
93
|
["resourceSuspend.scope", spec.resourceSuspend?.scope],
|
|
93
94
|
];
|
|
94
95
|
for (const [field, value] of declared) {
|
|
@@ -206,6 +207,34 @@ export function assertResumeConfigRecord(config) {
|
|
|
206
207
|
throw limitConfigError("config.invalid_argument", `the resume's taskConfig must be an object — the TaskSpec the run suspended with (got ${config === null ? "null" : Array.isArray(config) ? "an array" : typeof config})`);
|
|
207
208
|
}
|
|
208
209
|
}
|
|
210
|
+
function interactionPostureDoor(enter, spec, inherited, deps, disclose) {
|
|
211
|
+
const disclosed = (door) => {
|
|
212
|
+
try {
|
|
213
|
+
return door();
|
|
214
|
+
}
|
|
215
|
+
catch (e) {
|
|
216
|
+
if (e instanceof Error)
|
|
217
|
+
disclose?.(e);
|
|
218
|
+
throw e;
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
const posture = enter(spec.interactionPosture !== undefined ? "taskConfig" : "deps", () => disclosed(() => screenInteractionPostureWord(spec.interactionPosture ?? inherited ?? deps.interactionPosture)));
|
|
222
|
+
if (posture === "interactive" && spec.interactiveTools === false) {
|
|
223
|
+
enter("taskConfig", () => disclosed(() => {
|
|
224
|
+
const e = new Error(`interaction posture "interactive" declared together with interactiveTools: false — the hard-headless ` +
|
|
225
|
+
`clamp removes the AskUserQuestion mount, so no content question can ever reach the human this posture ` +
|
|
226
|
+
`promises. Drop one of the two declarations.`);
|
|
227
|
+
e.code = "config.interaction_posture";
|
|
228
|
+
throw e;
|
|
229
|
+
}));
|
|
230
|
+
}
|
|
231
|
+
return posture;
|
|
232
|
+
}
|
|
233
|
+
function agentsWithoutDelegationMount() {
|
|
234
|
+
const e = new Error(`TaskSpec.agents was provided but no delegation tool (createSubagentTool) is mounted in spec.tools — the per-task agents could never be offered. Mount the delegation tool, or drop spec.agents.`);
|
|
235
|
+
e.code = "config.agents.no_delegation_tool";
|
|
236
|
+
return e;
|
|
237
|
+
}
|
|
209
238
|
export function configValueDoors(input, enter = ENTER_AS_IS) {
|
|
210
239
|
const { spec, resumeLeg, sessions, holder } = input;
|
|
211
240
|
let deps = input.deps;
|
|
@@ -325,7 +354,7 @@ export function configValueDoors(input, enter = ENTER_AS_IS) {
|
|
|
325
354
|
assertFiniteNonNegativeWhenPresent(rsus[key], `resourceSuspend.${key}`, "config.limit_invalid", "an unevaluable allocation is not an allocation, and a NaN here blinds even the validated per-slice window.");
|
|
326
355
|
}
|
|
327
356
|
});
|
|
328
|
-
if (spec.durableApproval !== undefined)
|
|
357
|
+
if (spec.durableApproval !== undefined && spec.durableApproval !== false)
|
|
329
358
|
enter("taskConfig", () => assertDurableApprovalDeclaration(spec.durableApproval));
|
|
330
359
|
enter("taskConfig", () => assertCheckpointScopesFollowIsolationScope(spec));
|
|
331
360
|
const usageWindows = enter("deps", () => resolveUsageWindows(deps.usageWindows));
|
|
@@ -346,9 +375,11 @@ export function configValueDoors(input, enter = ENTER_AS_IS) {
|
|
|
346
375
|
}));
|
|
347
376
|
if (taskStore !== undefined)
|
|
348
377
|
enter("taskConfig", () => assertRetentionWords({ ...retention, stores: [{ name: "checkpointStore", store: taskStore }] }));
|
|
349
|
-
|
|
378
|
+
const resolvedInteractionPosture = interactionPostureDoor(enter, spec, input.parentInteractionPosture, deps, input.discloseInteractionPosture);
|
|
379
|
+
enter("taskConfig", () => screenModelRole(spec.modelRole));
|
|
380
|
+
return { toolFaceLists, promptHost, promptBinding, promptLocale, promptLean, lockedPreflight, skillListingSeats, skills, projectMemory, microCompactKnob, memoryDelegationEvidence, memoryProvenance, memoryCapturePolicy, usageWindows, brainCallGuardrailMs, crossBoundaryPosture, advisorTool, hostFloor, runOrigin, nestedMemory, deploymentRoles, taskRoles, resolvedInteractionPosture };
|
|
350
381
|
}
|
|
351
|
-
export function refuseResumeDoors(config, deps, sessions,
|
|
382
|
+
export function refuseResumeDoors(config, deps, sessions, internals) {
|
|
352
383
|
asResumeConfigRefusal("taskConfig", () => {
|
|
353
384
|
refusePermissionModeDoors(config);
|
|
354
385
|
resolveOutputStyleFrame(config.outputStyle);
|
|
@@ -358,49 +389,37 @@ export function refuseResumeDoors(config, deps, sessions, holder) {
|
|
|
358
389
|
screenUserAttachments(config.userAttachments, { resumeLeg: true });
|
|
359
390
|
assertToolBoundaryLegs(config.tools);
|
|
360
391
|
assertToolCardDeclarations(config.tools);
|
|
392
|
+
const agents = config.agents;
|
|
393
|
+
if (Array.isArray(agents) && !types.isProxy(agents) && agents.length > 0 && rosterMountsDelegation(config.tools) === false)
|
|
394
|
+
throw agentsWithoutDelegationMount();
|
|
361
395
|
});
|
|
362
|
-
const { lockedPreflight, skills } = configValueDoors({ spec: config, deps, resumeLeg: true, sessions, holder, resumedRow: { recorded: undefined } }, asResumeConfigRefusal);
|
|
396
|
+
const { lockedPreflight, skills } = configValueDoors({ spec: config, deps, resumeLeg: true, sessions, holder: internals?.holder, parentInteractionPosture: internals?.parentInteractionPosture, resumedRow: { recorded: undefined } }, asResumeConfigRefusal);
|
|
363
397
|
return { ...config, ...(config.mcp !== undefined ? { mcp: lockedPreflight.mcp ?? [] } : {}), ...(config.a2a !== undefined ? { a2a: lockedPreflight.a2a ?? [] } : {}), skills };
|
|
364
398
|
}
|
|
365
399
|
export function prepareConfigDoors(input) {
|
|
366
400
|
const { sessions, resume, internals } = input;
|
|
367
401
|
assertToolBoundaryLegs(input.spec.tools);
|
|
368
402
|
assertToolCardDeclarations(input.spec.tools);
|
|
369
|
-
|
|
370
|
-
const
|
|
403
|
+
const callerSpec = input.spec;
|
|
404
|
+
const discloseInteractionPostureRefusal = (err) => {
|
|
405
|
+
try {
|
|
406
|
+
input.deps.onError?.(err, { phase: "config", sessionId: callerSpec.sessionId ?? "(pre-session)", classification: "interaction-posture-refused" });
|
|
407
|
+
}
|
|
408
|
+
catch {
|
|
409
|
+
}
|
|
410
|
+
};
|
|
411
|
+
const { toolFaceLists, promptHost, promptBinding, promptLocale, promptLean, lockedPreflight, skillListingSeats, skills, projectMemory, microCompactKnob, memoryDelegationEvidence, memoryProvenance, memoryCapturePolicy, usageWindows, brainCallGuardrailMs, crossBoundaryPosture, advisorTool, hostFloor, runOrigin, nestedMemory, deploymentRoles, taskRoles, resolvedInteractionPosture } = configValueDoors({ spec: callerSpec, deps: input.deps, resumeLeg: resume !== undefined, sessions, holder: internals?.holder, parentInteractionPosture: internals?.parentInteractionPosture, discloseInteractionPosture: discloseInteractionPostureRefusal, ...(internals?.receivedPeers !== undefined ? { receivedPeers: internals.receivedPeers } : {}), ...(resume !== undefined ? { resumedRow: { recorded: screenRecordedRunOrigin(resume.seed.runOrigin), ...(resume.opening !== undefined ? { opening: resume.opening } : {}) } } : {}) });
|
|
371
412
|
const doorRead = (value) => ({ value, enumerable: value !== undefined, writable: false, configurable: false });
|
|
372
413
|
const deps = deploymentRoles !== undefined ? { ...input.deps, roles: deploymentRoles } : input.deps;
|
|
373
|
-
|
|
374
|
-
const
|
|
414
|
+
const declaredDurableApproval = callerSpec.durableApproval;
|
|
415
|
+
const hostApprovalParksNotResumable = declaredDurableApproval === false;
|
|
416
|
+
let spec = Object.create(Object.getPrototypeOf(callerSpec), { ...Object.getOwnPropertyDescriptors(callerSpec), skills: doorRead(skills), projectMemory: doorRead(projectMemory), runOrigin: doorRead(runOrigin), durableApproval: doorRead(hostApprovalParksNotResumable ? undefined : declaredDurableApproval), ...(taskRoles !== undefined ? { roles: doorRead(taskRoles) } : {}) });
|
|
375
417
|
const askSeat = resolveAskSeat(spec, deps);
|
|
376
418
|
{
|
|
377
|
-
|
|
378
|
-
const discloseInteractionPostureRefusal = (err) => {
|
|
379
|
-
try {
|
|
380
|
-
deps.onError?.(err, { phase: "config", sessionId: spec.sessionId ?? "(pre-session)", classification: "interaction-posture-refused" });
|
|
381
|
-
}
|
|
382
|
-
catch {
|
|
383
|
-
}
|
|
384
|
-
};
|
|
385
|
-
if (interactionPosture !== undefined && interactionPosture !== "interactive" && interactionPosture !== "headless") {
|
|
386
|
-
const e = new Error(`interactionPosture ${JSON.stringify(interactionPosture)} is not a recognized posture ("interactive" | "headless") — ` +
|
|
387
|
-
`an unevaluable declaration is refused loudly, never folded to either posture.`);
|
|
388
|
-
e.code = "config.interaction_posture";
|
|
389
|
-
discloseInteractionPostureRefusal(e);
|
|
390
|
-
throw e;
|
|
391
|
-
}
|
|
392
|
-
if (interactionPosture === "interactive") {
|
|
419
|
+
if (resolvedInteractionPosture === "interactive") {
|
|
393
420
|
const humanReachable = deriveAskEffective(askSeat.form, "unresolved") === "human_reachable";
|
|
394
421
|
const questionDoor = resolveQuestionSeam(spec, deps);
|
|
395
422
|
const strippedByEngine = internals?.questionFaceStripped === true;
|
|
396
|
-
if (spec.interactiveTools === false) {
|
|
397
|
-
const e = new Error(`interaction posture "interactive" declared together with interactiveTools: false — the hard-headless ` +
|
|
398
|
-
`clamp removes the AskUserQuestion mount, so no content question can ever reach the human this posture ` +
|
|
399
|
-
`promises. Drop one of the two declarations.`);
|
|
400
|
-
e.code = "config.interaction_posture";
|
|
401
|
-
discloseInteractionPostureRefusal(e);
|
|
402
|
-
throw e;
|
|
403
|
-
}
|
|
404
423
|
if (!humanReachable || !(questionDoor.wired || strippedByEngine)) {
|
|
405
424
|
const missing = [];
|
|
406
425
|
if (!humanReachable) {
|
|
@@ -423,11 +442,8 @@ export function prepareConfigDoors(input) {
|
|
|
423
442
|
const mountedRoster = spec.tools;
|
|
424
443
|
if (spec.agents !== undefined && spec.agents.length > 0) {
|
|
425
444
|
const pool = spec.tools ?? [];
|
|
426
|
-
if (!pool.some((t) => typeof t.withAgents === "function"))
|
|
427
|
-
|
|
428
|
-
e.code = "config.agents.no_delegation_tool";
|
|
429
|
-
throw e;
|
|
430
|
-
}
|
|
445
|
+
if (!pool.some((t) => typeof t.withAgents === "function"))
|
|
446
|
+
throw agentsWithoutDelegationMount();
|
|
431
447
|
const perTask = spec.agents.map(snapshotDefinitionLists);
|
|
432
448
|
spec = {
|
|
433
449
|
...spec,
|
|
@@ -520,5 +536,6 @@ export function prepareConfigDoors(input) {
|
|
|
520
536
|
usageWindows,
|
|
521
537
|
brainCallGuardrailRef,
|
|
522
538
|
brainCallGuardrailMs,
|
|
539
|
+
hostApprovalParksNotResumable,
|
|
523
540
|
};
|
|
524
541
|
}
|
|
@@ -134,8 +134,8 @@ export declare function createRequestCopies(seat: {
|
|
|
134
134
|
}): RequestCopies;
|
|
135
135
|
/**
|
|
136
136
|
* The stale-result clear's savings as the request sends them: the structural savings, less what the projection had
|
|
137
|
-
* already taken off the cleared results (a repeated
|
|
138
|
-
* back on the others (the next
|
|
137
|
+
* already taken off the cleared results (a repeated attachment frame is one sentence on the request) and less what the
|
|
138
|
+
* clear puts back on the others (the next frame of a cleared chain head carries the contents now).
|
|
139
139
|
*/
|
|
140
140
|
export declare function clearNetSavingsFor(view: readonly AgentMessage[], cpt: number, copies?: RequestCopies): (cleared: readonly number[], structural: number) => number;
|
|
141
141
|
export interface PrepareContextLaneResult {
|
|
@@ -26,13 +26,11 @@ export function createRequestCopies(seat) {
|
|
|
26
26
|
const rendered = new Map();
|
|
27
27
|
law.messages.forEach((m, i) => {
|
|
28
28
|
const r = sentLaw[i];
|
|
29
|
-
if (r === m)
|
|
30
|
-
return;
|
|
31
29
|
const parts = law.folds.get(m);
|
|
32
|
-
if (parts
|
|
33
|
-
rendered.set(m, r);
|
|
34
|
-
else
|
|
30
|
+
if (parts !== undefined)
|
|
35
31
|
parts.forEach((p, k) => rendered.set(p, k === 0 ? r : undefined));
|
|
32
|
+
else if (r !== m)
|
|
33
|
+
rendered.set(m, r);
|
|
36
34
|
});
|
|
37
35
|
const asSent = (m) => (rendered.has(m) ? rendered.get(m) : m);
|
|
38
36
|
const sizeOf = (m) => {
|
|
@@ -7,7 +7,7 @@ import type { AnnounceOnceSink, ToolFaceSnapshot } from "./contracts.js";
|
|
|
7
7
|
import { RosterBuilder } from "../tool-roster.js";
|
|
8
8
|
export interface PrepareDeferClassifyInput {
|
|
9
9
|
/** borrowed-readonly — the REBOUND spec (`spec′`); only `tools` is read (names for the full-schema filter, specs for the `defer` declarations). */
|
|
10
|
-
spec: Pick<TaskSpec, "tools"
|
|
10
|
+
spec: Pick<TaskSpec, "tools">;
|
|
11
11
|
/** borrowed-readonly — deps; `deferMode` (candidate widening) and `toolSearch` (rule ②'s gate) are the only seats read. */
|
|
12
12
|
deps: Pick<RunnerDeps, "deferMode" | "toolSearch">;
|
|
13
13
|
/** borrowed-mutable — the shared mount array (later refs alias it; in-place contract, never
|
|
@@ -19,7 +19,7 @@ export function prepareDeferClassify(input) {
|
|
|
19
19
|
const { spec, deps, roster, toolFaceSnapshot, promptTraits, model, mcp, a2a, sharedMemoryPairMounted, memoryEnginePairMounted, memoryRecallSegment, onceLedger, sessionId } = input;
|
|
20
20
|
const tools = roster.tools;
|
|
21
21
|
let memoryBlock = input.memoryBlock;
|
|
22
|
-
const leaves = valveLeaves(
|
|
22
|
+
const leaves = valveLeaves(toolFaceSnapshot.selector);
|
|
23
23
|
roster.unmountWhere((t) => !leaves(t));
|
|
24
24
|
for (let i = 0; i < tools.length; i++) {
|
|
25
25
|
const t = tools[i];
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
*/
|
|
19
19
|
import type { AgentTool, ExecutionEnv, WorkspaceState } from "../../internal/harness.js";
|
|
20
20
|
import { type PeerLaneRefs } from "../../agents/peer-session-drain.js";
|
|
21
|
-
import type
|
|
21
|
+
import { type SubagentRetainLedger } from "../../agents/retain-ledger.js";
|
|
22
22
|
import type { ShellReadAdmission } from "../../tools/fs/shell-read-check.js";
|
|
23
23
|
import type { ReadFloorSeat } from "../../tools/fs/read-floor.js";
|
|
24
24
|
import type { CommandSandboxSeat } from "../command-sandbox.js";
|
|
@@ -32,7 +32,7 @@ export interface PrepareDelegationSurfaceInput {
|
|
|
32
32
|
/** borrowed-readonly — the REBOUND spec. Read: `tools` (the shadow checks and the revival spawner's delegation-tool
|
|
33
33
|
* lookup), `retainBackgroundProcesses` (the Monitor receipt), `handsReadOnly` is NOT read here (the hands mount
|
|
34
34
|
* decided the surface). Never mutated. */
|
|
35
|
-
spec: Pick<TaskSpec, "tools" | "retainBackgroundProcesses" | "
|
|
35
|
+
spec: Pick<TaskSpec, "tools" | "retainBackgroundProcesses" | "oneShot">;
|
|
36
36
|
/** borrowed-readonly — the deployment seats the mounts read: `workflowRunStore` / `backgroundAgentStore` / `mailboxStore` (the
|
|
37
37
|
* read/kill faces and the tier-3 revival seams), `rosterStore`, `peerLane`, `peerDirectory`, `peerChannel`, `onNotice`,
|
|
38
38
|
* `onBackgroundChildEvent`, `tracer`. */
|
|
@@ -4,6 +4,7 @@ import { listAgentsMountable, mountListAgents, peerDrainLanesOf, peerLaneSendMes
|
|
|
4
4
|
import { resolvePeerLaneConfig } from "../../agents/peer-admission.js";
|
|
5
5
|
import { createReadInboxTool, READ_INBOX_TOOL_NAME } from "../../agents/read-inbox-tool.js";
|
|
6
6
|
import { valveLeaves } from "../../agents/tool-filter.js";
|
|
7
|
+
import { getSessionRetainLedger } from "../../agents/retain-ledger.js";
|
|
7
8
|
import { createMonitorTool } from "../../tools/monitor.js";
|
|
8
9
|
import { createWorktreeTools } from "../../tools/worktree.js";
|
|
9
10
|
import { createTaskStopTool, defaultTaskRegistry } from "../task-registry.js";
|
|
@@ -16,7 +17,7 @@ export function prepareDelegationSurface(input) {
|
|
|
16
17
|
const { spec, deps, internals, resume, sessionId, sessionAddress, hostTaskId, taskScope, taskRootFinal, taskRootCanonical, executionEnv, runnerSelf, peerLaneActive, peerLaneRefs, sessionBox, roster, axisExplicitNegatives, envHandToolNames, toolFaceSnapshot, firstPartyOffload, offloadStore, toolResultBytes, taskArtifacts, subagentRetain, enrichSpecToolCtx, checkpointSeat, handsCwdRef, wsSnapshot, rebaseWsPath, rebaseRestoredPath, workspaceStateSettle, worktreeSeat } = input;
|
|
17
18
|
let worktreeSessionRef;
|
|
18
19
|
const delegationSurfaceActive = roster.mounts.holds("task-stop");
|
|
19
|
-
const leaves = valveLeaves(
|
|
20
|
+
const leaves = valveLeaves(toolFaceSnapshot.selector);
|
|
20
21
|
let sendMessageTier;
|
|
21
22
|
if (roster.mounts.judge("task-stop")) {
|
|
22
23
|
roster.mountAll([
|
|
@@ -91,7 +92,7 @@ export function prepareDelegationSurface(input) {
|
|
|
91
92
|
roster.mount(firstPartyOffload(createReadInboxTool({ pull: () => peerLaneRefs.pull, ...covers })), { source: "builtin", mountedBy: "peerLane" });
|
|
92
93
|
}
|
|
93
94
|
if (roster.mounts.judge("list-agents")) {
|
|
94
|
-
const listAgents = mountListAgents({ ...(peerLaneActive ? { peerDirectory: deps.peerDirectory } : {}), freshWindowMs: resolvePeerLaneConfig(deps.peerLane, deps.onNotice).listingFreshWindowMs, sessionId, scope: taskScope, hostTaskId, ...(internals?.parentTaskId !== undefined ? { parentTaskId: internals.parentTaskId } : {}), ...(internals?.parentSessionId !== undefined ? { parentSessionId: internals.parentSessionId } : {}), registry: defaultTaskRegistry, ...(deps.rosterStore !== undefined ? { roster: deps.rosterStore } : {}), ...(sendMessageTier !== undefined ? { continuationTier: sendMessageTier } : {}), ...(checkpointSeat !== undefined ? { readSeats: { checkpointSeat } } : {}), specTools: spec.tools ?? [] });
|
|
95
|
+
const listAgents = mountListAgents({ ...(peerLaneActive ? { peerDirectory: deps.peerDirectory } : {}), freshWindowMs: resolvePeerLaneConfig(deps.peerLane, deps.onNotice).listingFreshWindowMs, sessionId, scope: taskScope, hostTaskId, ...(internals?.parentTaskId !== undefined ? { parentTaskId: internals.parentTaskId } : {}), ...(internals?.parentSessionId !== undefined ? { parentSessionId: internals.parentSessionId } : {}), registry: defaultTaskRegistry, ...(deps.rosterStore !== undefined ? { roster: deps.rosterStore } : {}), ...(sendMessageTier !== undefined ? { continuationTier: sendMessageTier } : {}), ...(checkpointSeat !== undefined ? { readSeats: { checkpointSeat } } : {}), specTools: spec.tools ?? [], retainLedgers: () => ({ session: sessionId !== undefined ? getSessionRetainLedger(sessionId) : undefined, run: subagentRetain, sibling: internals?.parentRetainLedger }) });
|
|
95
96
|
if (listAgents !== undefined)
|
|
96
97
|
roster.mount(firstPartyOffload(listAgents), { source: "builtin", mountedBy: "peerLane" });
|
|
97
98
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* policy), the `trackFileEdit` hook the hands band calls before every mutation lane, and the turn-start
|
|
7
7
|
* boundary seat runtask drives.
|
|
8
8
|
*
|
|
9
|
-
* Runs INSIDE the driver's prepare try-block, after the
|
|
9
|
+
* Runs INSIDE the driver's prepare try-block, after the session's checkout is read (`sessionRoot`) and the
|
|
10
10
|
* env is resolved: every refusal here throws through to the driver's prepare-throw catch (a minted
|
|
11
11
|
* ownedEnv is destroyed there, a resumeAt branch written back, the session view forgotten). The phase acquires
|
|
12
12
|
* no resource of its own — the two seats it returns are closures over the store the deployment owns.
|
|
@@ -22,11 +22,12 @@
|
|
|
22
22
|
* operation as the one this phase runs.
|
|
23
23
|
*/
|
|
24
24
|
import type { ExecutionEnv } from "../../internal/harness.js";
|
|
25
|
-
import type { StoredSession } from "../../engine/session/session.js";
|
|
26
25
|
import type { RunnerDeps, TaskResult, TaskSpec, TrackFileEditHook } from "../types.js";
|
|
27
26
|
import type { FileHistoryStore } from "../file-history-store.js";
|
|
28
27
|
import type { FileHistoryBoundarySeat, RunInternals } from "./contracts.js";
|
|
29
28
|
import type { FileHistoryRequest } from "./file-history-request.js";
|
|
29
|
+
import { type OwnLogReader } from "./file-history-restore.js";
|
|
30
|
+
import type { SessionRootRead } from "../session-checkout.js";
|
|
30
31
|
export interface PrepareFileHistoryInput {
|
|
31
32
|
/** borrowed-readonly — the deployment seats this phase reads: the first-touch failure policy, the history
|
|
32
33
|
* store and its capture switch (all validated HERE, once), the incident sink, the notice seat (the person's half of a
|
|
@@ -37,25 +38,41 @@ export interface PrepareFileHistoryInput {
|
|
|
37
38
|
/** borrowed-readonly — the request door's resolution ({@link resolveFileHistoryRequest}), judged before the session was
|
|
38
39
|
* acquired: every refusal the request and the deployment's seats decide on their own has already thrown. */
|
|
39
40
|
request: FileHistoryRequest;
|
|
40
|
-
/** borrowed-readonly — the trusted lineage a delegating parent handed this run (absent for a root run
|
|
41
|
+
/** borrowed-readonly — the trusted lineage a delegating parent handed this run and the caller's root (both absent for a root run
|
|
41
42
|
* and for a host's own fork), read for the recording-scope decision only; and the Runner's session
|
|
42
43
|
* read-state seats, whose restore channel the restore writes the paths it moved into. */
|
|
43
|
-
internals: Pick<RunInternals, "fileHistoryLineage" | "sessionReadStates"> | undefined;
|
|
44
|
+
internals: Pick<RunInternals, "fileHistoryLineage" | "callerRoot" | "sessionReadStates"> | undefined;
|
|
44
45
|
/** borrowed-readonly — the run's resolved env (owned or static or the stub); every history verb runs
|
|
45
46
|
* against ITS filesystem ops. Never rebound or destroyed here. */
|
|
46
47
|
executionEnv: ExecutionEnv;
|
|
47
|
-
/** borrowed-readonly — the
|
|
48
|
-
|
|
48
|
+
/** borrowed-readonly — the SESSION's root, where its history is keyed (`OpenedSessionCheckout.sessionRoot`; a `null` leg's reads the session's tree); read only when the leg records or restores. */
|
|
49
|
+
sessionRoot: () => Promise<SessionRootRead>;
|
|
50
|
+
/** borrowed-readonly — where a fork's source keyed its history (`recordedRootOf` over this session's copy of it); read by the fork carry only. */
|
|
51
|
+
forkSourceRoot: (origin: string) => Promise<string | undefined>;
|
|
49
52
|
/** borrowed-readonly — the "real fs env" fact (`ownedEnv !== undefined || deps.executionEnv !== undefined`). */
|
|
50
53
|
handsEnabled: boolean;
|
|
51
|
-
/** borrowed-readonly — the acquired session id: the
|
|
54
|
+
/** borrowed-readonly — the acquired session id: the session key of the restore, the read-state channel and every sentence. */
|
|
52
55
|
sessionId: string;
|
|
53
|
-
/** borrowed-readonly — the acquired session, read for the
|
|
54
|
-
session:
|
|
56
|
+
/** borrowed-readonly — the acquired session, read for the log's own entries (`getEntry`, the rewind target's membership); never written here. */
|
|
57
|
+
session: OwnLogReader;
|
|
58
|
+
/** borrowed-readonly — whether this session is a fork that works in a tree of its own (`forkHasOwnTree`, judged once by the driver
|
|
59
|
+
* over the row it read): such a run records no file history and restores none ({@link announceForkCheckoutUnrecorded}). */
|
|
60
|
+
forkWithOwnTree: boolean;
|
|
61
|
+
/** borrowed-readonly — the acquired session's row as the driver read it once: its occupant (the run's OWN history scope is
|
|
62
|
+
* `fileHistoryScopeOf(sessionId, own)`) and its fork lineage. Absent for a run with no store (it names no scope, so the driver made no read for it); a read that threw leaves the run with no history scope of its own. */
|
|
63
|
+
row?: LegRowRead;
|
|
55
64
|
/** borrowed-readonly — the run's abort controller (driver-minted); only its `signal` is read, composed
|
|
56
65
|
* with `spec.signal` for the restore. */
|
|
57
66
|
abortController: AbortController;
|
|
58
67
|
}
|
|
68
|
+
/** The acquired session's row cells, read once (`getMetadata`): its own occupant (`own`), its fork lineage (`origin`, and the occupant
|
|
69
|
+
* of it the fork was cut from, `originIncarnation`), or `fault` when the read threw. */
|
|
70
|
+
export interface LegRowRead {
|
|
71
|
+
origin?: string;
|
|
72
|
+
originIncarnation?: string;
|
|
73
|
+
own?: string;
|
|
74
|
+
fault: boolean;
|
|
75
|
+
}
|
|
59
76
|
export interface PrepareFileHistoryResult {
|
|
60
77
|
/** borrowed-readonly — the hook the hands band calls before every mutation lane; `undefined` when the
|
|
61
78
|
* run does not record (no store, capture turned off by any layer, or no real fs env). */
|
|
@@ -70,9 +87,9 @@ export interface PrepareFileHistoryResult {
|
|
|
70
87
|
fileHistoryEnabled: boolean;
|
|
71
88
|
/** borrowed-readonly — the manifest's word: `"on"` iff live, else `"disabled"` (whichever layer or missing half). */
|
|
72
89
|
fileHistoryFact: "on" | "disabled";
|
|
73
|
-
/** borrowed-readonly — the scope this run's first-touch records land in (own session, or the root
|
|
74
|
-
* session's for a same-tree delegated child). */
|
|
75
|
-
historyScope: string;
|
|
90
|
+
/** borrowed-readonly — the scope this run's first-touch records land in (own session's, or the root
|
|
91
|
+
* session's for a same-tree delegated child); `undefined` when the run has none (no store, its row read threw, or the address was refused). */
|
|
92
|
+
historyScope: string | undefined;
|
|
76
93
|
/** borrowed-readonly — the canonical history root every history verb keys against. */
|
|
77
94
|
historyRoot: string;
|
|
78
95
|
/** borrowed-readonly — the filesystem identity of the env (the lineage's second tree coordinate). */
|
|
@@ -80,16 +97,33 @@ export interface PrepareFileHistoryResult {
|
|
|
80
97
|
}
|
|
81
98
|
export declare function prepareFileHistory(input: PrepareFileHistoryInput): Promise<PrepareFileHistoryResult>;
|
|
82
99
|
/**
|
|
83
|
-
*
|
|
84
|
-
*
|
|
100
|
+
* The fourth liveness word: a fork that works in a tree of its own records no file history (`forkHasOwnTree`), said to the operator
|
|
101
|
+
* through the driver's once-per-session ledger (`onceOnError`) — unless a layer declared capture off, a decision the other words keep
|
|
102
|
+
* silent about too. Advisory: a throwing sink does not fail the run.
|
|
103
|
+
*/
|
|
104
|
+
export declare function announceForkCheckoutUnrecorded(onceOnError: NonNullable<RunnerDeps["onError"]>, request: Pick<FileHistoryRequest, "captureOff" | "declaredOff">, sessionId: string): void;
|
|
105
|
+
/**
|
|
106
|
+
* Carry a forked session's file history from its source's history address into the fork's own scope (the seat §5 names). The source
|
|
107
|
+
* address is the fork row's lineage cell read whole — `fileHistoryScopeOf(forkedFrom, forkedFromIncarnation)`, the occupant the fork was
|
|
108
|
+
* cut from — so no row of the source is read and an id that changed hands since is never consulted: the address names the occupant, not
|
|
109
|
+
* whoever holds the id now. A fork row that names no occupant of its source (`forkedFromIncarnation` not a token) has no source address —
|
|
110
|
+
* half an address is no address, the same reading as a run whose own occupant cannot be read — and carries nothing, said once; so does a
|
|
111
|
+
* source whose id {@link fileHistoryScopeOf} refuses an address.
|
|
112
|
+
* The source's records carry no root — they are joined back on the fork's: they are carried only when the source keyed them against the fork's
|
|
113
|
+
* own root (`roots`, both canonical; either unknown is not the same root), and otherwise nothing is carried, said once.
|
|
114
|
+
* Never throws and never fails the turn: a store that cannot carry, or a fork with no source to carry from, leaves the fork with an empty
|
|
85
115
|
* history, which is DEGRADED (a pre-fork boundary is not restorable from the new session) and not
|
|
86
116
|
* wrong (nothing is silently mis-restored — the restore seat answers "no boundary" honestly).
|
|
87
117
|
*/
|
|
88
|
-
export declare function adoptForkedFileHistory(store: FileHistoryStore,
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
118
|
+
export declare function adoptForkedFileHistory(store: FileHistoryStore, lineage: Pick<LegRowRead, "origin" | "originIncarnation">, sessionId: string, ownScope: string, onError: RunnerDeps["onError"], roots: {
|
|
119
|
+
own: () => Promise<string | undefined>;
|
|
120
|
+
source: (origin: string) => Promise<string | undefined>;
|
|
121
|
+
}): Promise<void>;
|
|
122
|
+
/** A rewind on a session whose row could not be read: with no occupant there is no history address to restore from (the run's restore
|
|
123
|
+
* seat and the out-of-run `Runner.rewindFiles` both refuse with it). */
|
|
124
|
+
export declare function unaddressedRewindRefusal(sessionId: string, target: string): Error & {
|
|
125
|
+
code?: string;
|
|
126
|
+
};
|
|
93
127
|
/**
|
|
94
128
|
* The run's two file-history COORDINATES, resolved once where store/env/root meet (module-level per
|
|
95
129
|
* the body ratchet):
|
|
@@ -98,7 +132,7 @@ export declare function adoptForkedFileHistory(store: FileHistoryStore, session:
|
|
|
98
132
|
* symlinked root spelling (macOS /var → /private/var) would otherwise record in-root files as
|
|
99
133
|
* absolute and un-tether them from the root they live in.
|
|
100
134
|
* - `historyScope` — WHICH scope this run's first-touch records land in. A top-level run owns its own
|
|
101
|
-
* (its
|
|
135
|
+
* (`ownScope`: its row's address, `fileHistoryScopeOf`; none when the row read threw or the function refused). A delegated child that was handed a {@link RunInternals.fileHistoryLineage} and
|
|
102
136
|
* runs on the SAME canonical root records into the lineage's scope — the root session's — so the
|
|
103
137
|
* edits a child makes on the user's behalf are part of the ONE history the user rewinds from
|
|
104
138
|
* (before this, a child's first touch minted its baseline in a scope no rewind ever read, and the
|
|
@@ -110,17 +144,19 @@ export declare function adoptForkedFileHistory(store: FileHistoryStore, session:
|
|
|
110
144
|
* both sides minted their keys against, and the FILESYSTEM the env is a view of
|
|
111
145
|
* ({@link fileHistoryFilesystemIdentity}) — a path string alone is not a tree (two per-task
|
|
112
146
|
* sandboxes can both spell `/workspace` and hold unrelated files).
|
|
113
|
-
*
|
|
114
|
-
*
|
|
147
|
+
* The root is the SESSION's (`sessionRootOf`), never the leg's own, so every rewind joins each record back where it was made; a child that
|
|
148
|
+
* stands at its caller's root (`callerRoot`, on the lineage's filesystem) works where its caller works and keys against the caller's
|
|
149
|
+
* history root — the lineage's, which for a caller on a `null` leg is that caller's session root, not where it stands. With no
|
|
150
|
+
* session root given (the run neither records nor restores) nothing is coordinated: own scope, no root, no filesystem identity.
|
|
115
151
|
*/
|
|
116
|
-
export declare function resolveFileHistoryCoordinates
|
|
152
|
+
export declare function resolveFileHistoryCoordinates<S extends string | undefined>(env: ExecutionEnv, sessionRoot: string | undefined, lineage: RunInternals["fileHistoryLineage"], ownScope: S, callerRoot?: string): Promise<{
|
|
117
153
|
historyRoot: string;
|
|
118
|
-
historyScope: string;
|
|
154
|
+
historyScope: string | S;
|
|
119
155
|
historyFs: string;
|
|
120
156
|
}>;
|
|
121
157
|
/** The ONE reading of {@link RunInternals.fileHistoryLineage} (see {@link resolveFileHistoryCoordinates}):
|
|
122
|
-
* the lineage's scope iff BOTH tree coordinates match; otherwise the run's own
|
|
123
|
-
export declare function resolveFileHistoryScope(lineage: RunInternals["fileHistoryLineage"], historyRoot: string, historyFs: string,
|
|
158
|
+
* the lineage's scope iff BOTH tree coordinates match; otherwise the run's own scope. */
|
|
159
|
+
export declare function resolveFileHistoryScope<S extends string | undefined>(lineage: RunInternals["fileHistoryLineage"], historyRoot: string, historyFs: string, ownScope: S): string | S;
|
|
124
160
|
/**
|
|
125
161
|
* WHICH filesystem an env is a view of — the second coordinate of tree identity for the file-history
|
|
126
162
|
* lineage, read from what the env's MINTER states rather than inferred from a path:
|