@sema-agent/core 7.60.0 → 7.61.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +605 -0
- package/README.md +2 -2
- package/dist/agents/agent-transcript-tool.d.ts +2 -2
- package/dist/agents/agent-transcript-tool.js +1 -1
- package/dist/agents/cascade.d.ts +61 -10
- package/dist/agents/cascade.js +60 -20
- package/dist/agents/composition-allowance.d.ts +53 -0
- package/dist/agents/composition-allowance.js +49 -0
- package/dist/agents/composition-placement.d.ts +29 -0
- package/dist/agents/composition-placement.js +24 -0
- package/dist/agents/cumulative-stats.d.ts +4 -0
- package/dist/agents/cumulative-stats.js +3 -0
- package/dist/agents/inherited-tool-pool.d.ts +5 -3
- package/dist/agents/inherited-tool-pool.js +2 -2
- package/dist/agents/list-agents-tool.d.ts +1 -1
- package/dist/agents/peer-notice-route.d.ts +1 -1
- package/dist/agents/peer-notice-route.js +4 -3
- package/dist/agents/peer-notices.d.ts +4 -4
- package/dist/agents/peer-notices.js +8 -4
- package/dist/agents/peer-session-drain.d.ts +8 -1
- package/dist/agents/peer-session-drain.js +36 -7
- package/dist/agents/repair-loop.js +16 -6
- package/dist/agents/retain-ledger.js +3 -1
- package/dist/agents/roster-store.d.ts +1 -1
- package/dist/agents/roster-store.js +7 -4
- package/dist/agents/send-message-tool.d.ts +8 -10
- package/dist/agents/send-message-tool.js +43 -23
- package/dist/agents/subagent-completion-gate.d.ts +35 -0
- package/dist/agents/subagent-completion-gate.js +62 -0
- package/dist/agents/subagent-steps.d.ts +7 -6
- package/dist/agents/subagent.d.ts +30 -40
- package/dist/agents/subagent.js +187 -196
- package/dist/agents/suspend-guard.d.ts +9 -0
- package/dist/agents/suspend-guard.js +4 -0
- package/dist/agents/verify.d.ts +41 -14
- package/dist/agents/verify.js +37 -27
- package/dist/brain/anthropic.js +1 -0
- package/dist/brain/errors.d.ts +7 -1
- package/dist/brain/errors.js +6 -0
- package/dist/brain/failover.js +2 -1
- package/dist/brain/open-responses.js +1 -0
- package/dist/brain/openai.js +1 -0
- package/dist/brain/provider-dialect.d.ts +10 -0
- package/dist/brain/provider-dialect.js +13 -2
- package/dist/brain/stream-engine.d.ts +3 -0
- package/dist/brain/stream-engine.js +4 -0
- package/dist/core/agent-state.d.ts +1 -1
- package/dist/core/allow-entry.d.ts +59 -23
- package/dist/core/allow-entry.js +131 -38
- package/dist/core/ask-origin.d.ts +79 -0
- package/dist/core/ask-origin.js +76 -0
- package/dist/core/ask-question.d.ts +19 -13
- package/dist/core/ask-question.js +8 -2
- package/dist/core/auto-compaction.d.ts +2 -0
- package/dist/core/auto-compaction.js +2 -1
- package/dist/core/auto-mode.js +3 -5
- package/dist/core/background-agent-store.d.ts +7 -5
- package/dist/core/background-agent-store.js +12 -11
- package/dist/core/checkpoint-requirements.d.ts +24 -3
- package/dist/core/checkpoint-requirements.js +9 -1
- package/dist/core/checkpoint-store.d.ts +78 -19
- package/dist/core/checkpoint-store.js +8 -4
- package/dist/core/child-clamp-seats.d.ts +3 -2
- package/dist/core/child-clamp-seats.js +4 -3
- package/dist/core/closest-name.d.ts +13 -0
- package/dist/core/closest-name.js +35 -0
- package/dist/core/context-settings.js +3 -5
- package/dist/core/cross-boundary-taint.d.ts +1 -1
- package/dist/core/decision-receipt.d.ts +14 -1
- package/dist/core/decision-receipt.js +6 -3
- package/dist/core/delegation-frames.d.ts +13 -9
- package/dist/core/effective-path-target.js +2 -3
- package/dist/core/engine-attestation.d.ts +11 -1
- package/dist/core/engine-attestation.js +2 -0
- package/dist/core/engine-notice.d.ts +49 -18
- package/dist/core/file-history-retention.d.ts +8 -0
- package/dist/core/file-history-retention.js +14 -11
- package/dist/core/file-history-store.d.ts +31 -1
- package/dist/core/file-history-store.js +31 -2
- package/dist/core/frame-settlement.d.ts +10 -0
- package/dist/core/frame-settlement.js +6 -1
- package/dist/core/fs-write-gate-policy.d.ts +3 -3
- package/dist/core/fs-write-gate-policy.js +8 -7
- package/dist/core/gate-fold.js +2 -1
- package/dist/core/gate-lanes.js +7 -4
- package/dist/core/gate-outcome.d.ts +40 -1
- package/dist/core/gate-outcome.js +10 -0
- package/dist/core/git-worktree-env.d.ts +7 -3
- package/dist/core/git-worktree-env.js +16 -13
- package/dist/core/governance-codes.d.ts +12 -4
- package/dist/core/governance-codes.js +16 -4
- package/dist/core/hooks.d.ts +12 -4
- package/dist/core/hooks.js +11 -4
- package/dist/core/host-floor.js +3 -5
- package/dist/core/image-admission.d.ts +48 -8
- package/dist/core/image-admission.js +35 -4
- package/dist/core/input-author.d.ts +36 -0
- package/dist/core/input-author.js +39 -0
- package/dist/core/leg-identity.d.ts +62 -0
- package/dist/core/leg-identity.js +18 -0
- package/dist/core/locked-config.d.ts +2 -1
- package/dist/core/locked-config.js +5 -3
- package/dist/core/lsp.d.ts +5 -3
- package/dist/core/lsp.js +3 -2
- package/dist/core/mailbox-store.d.ts +85 -10
- package/dist/core/mailbox-store.js +31 -10
- package/dist/core/mcp-connection-pool.d.ts +6 -20
- package/dist/core/mcp-connection-pool.js +10 -28
- package/dist/core/mcp-failure.d.ts +76 -15
- package/dist/core/mcp-failure.js +60 -33
- package/dist/core/mcp-host-seat.d.ts +92 -53
- package/dist/core/mcp-host-seat.js +220 -46
- package/dist/core/mcp-probe.js +2 -2
- package/dist/core/mcp-server-link.d.ts +18 -6
- package/dist/core/mcp-server-link.js +19 -4
- package/dist/core/mcp-server-spec.d.ts +2 -1
- package/dist/core/mcp-session-end.d.ts +1 -2
- package/dist/core/mcp-session-end.js +1 -1
- package/dist/core/mcp.d.ts +6 -49
- package/dist/core/mcp.js +115 -111
- package/dist/core/media-byte-cap.d.ts +21 -46
- package/dist/core/media-byte-cap.js +55 -55
- package/dist/core/member-group.d.ts +7 -0
- package/dist/core/member-group.js +35 -0
- package/dist/core/memory-engine/consolidation.d.ts +1 -1
- package/dist/core/memory-engine/consolidation.js +7 -1
- package/dist/core/memory-engine/dual-root.d.ts +31 -0
- package/dist/core/memory-engine/dual-root.js +59 -11
- package/dist/core/memory-engine/engine.js +27 -24
- package/dist/core/memory-engine/file-backend.d.ts +13 -0
- package/dist/core/memory-engine/file-backend.js +35 -15
- package/dist/core/memory-engine/layout.d.ts +3 -0
- package/dist/core/memory-engine/layout.js +13 -3
- package/dist/core/memory-engine/memory-deployment.d.ts +110 -0
- package/dist/core/memory-engine/memory-deployment.js +182 -0
- package/dist/core/memory-engine/sync-client.d.ts +39 -18
- package/dist/core/memory-engine/sync-client.js +72 -14
- package/dist/core/memory-engine/sync-report.d.ts +7 -4
- package/dist/core/memory-engine/sync.d.ts +9 -1
- package/dist/core/mode-policy.d.ts +8 -8
- package/dist/core/mode-policy.js +7 -5
- package/dist/core/mods/agent-stations.d.ts +39 -4
- package/dist/core/mods/agent-stations.js +59 -10
- package/dist/core/mods/dollar.d.ts +62 -0
- package/dist/core/mods/extension-call.d.ts +15 -1
- package/dist/core/mods/extension-call.js +7 -2
- package/dist/core/mods/kernel/dispatch.d.ts +4 -3
- package/dist/core/mods/kernel/dispatch.js +4 -4
- package/dist/core/mods/kernel/events.d.ts +4 -1
- package/dist/core/mods/kernel/events.js +6 -6
- package/dist/core/mods/kernel/registration.d.ts +3 -0
- package/dist/core/mods/kernel/registration.js +5 -0
- package/dist/core/mods/kernel/site-rules.d.ts +6 -3
- package/dist/core/mods/kernel/site-rules.js +10 -2
- package/dist/core/mods/session-append.d.ts +115 -0
- package/dist/core/mods/session-append.js +311 -0
- package/dist/core/mods/session-compact.d.ts +48 -0
- package/dist/core/mods/session-compact.js +194 -0
- package/dist/core/mods/session-receive.d.ts +93 -0
- package/dist/core/mods/session-receive.js +141 -0
- package/dist/core/mods/session-send.d.ts +72 -0
- package/dist/core/mods/session-send.js +88 -0
- package/dist/core/mods/stations.d.ts +38 -16
- package/dist/core/mods/stations.js +25 -11
- package/dist/core/mods/tool-call.d.ts +2 -0
- package/dist/core/mods/tool-call.js +4 -4
- package/dist/core/output-style.js +3 -4
- package/dist/core/own-property-receipt.d.ts +61 -2
- package/dist/core/own-property-receipt.js +42 -2
- package/dist/core/park-selfcheck.js +4 -2
- package/dist/core/path-identity.d.ts +11 -0
- package/dist/core/path-identity.js +4 -0
- package/dist/core/path-rule-binding.d.ts +3 -1
- package/dist/core/path-rule-binding.js +3 -1
- package/dist/core/peer-seat.d.ts +3 -3
- package/dist/core/peer-seat.js +20 -8
- package/dist/core/permission-rule-consent.d.ts +21 -5
- package/dist/core/permission-rule-consent.js +21 -1
- package/dist/core/permission-rule-model.d.ts +34 -11
- package/dist/core/permission-rule-model.js +47 -10
- package/dist/core/permission-rule-org.d.ts +1 -1
- package/dist/core/permission-rule-provider.js +4 -1
- package/dist/core/permission-rules.d.ts +4 -0
- package/dist/core/permission-rules.js +11 -16
- package/dist/core/remote-env.d.ts +74 -26
- package/dist/core/remote-env.js +20 -0
- package/dist/core/retention-policy.d.ts +24 -23
- package/dist/core/retention-policy.js +36 -2
- package/dist/core/retention.d.ts +4 -1
- package/dist/core/retired-keys.d.ts +4 -4
- package/dist/core/row-admission.d.ts +10 -0
- package/dist/core/row-admission.js +5 -0
- package/dist/core/runner/advisor-instructions.d.ts +2 -1
- package/dist/core/runner/advisor-instructions.js +2 -1
- package/dist/core/runner/announce-once-ledger.d.ts +4 -4
- package/dist/core/runner/assemble-result.d.ts +13 -3
- package/dist/core/runner/assemble-result.js +12 -7
- package/dist/core/runner/caller-roster.d.ts +12 -9
- package/dist/core/runner/caller-roster.js +5 -2
- package/dist/core/runner/checkpoint-scope.d.ts +16 -1
- package/dist/core/runner/checkpoint-scope.js +21 -0
- package/dist/core/runner/compact-session.js +14 -2
- package/dist/core/runner/compaction-call-options.d.ts +1 -1
- package/dist/core/runner/compaction-restate.d.ts +2 -2
- package/dist/core/runner/compaction-restate.js +4 -3
- package/dist/core/runner/construction-doors.d.ts +2 -2
- package/dist/core/runner/construction-doors.js +2 -2
- package/dist/core/runner/contracts.d.ts +98 -26
- package/dist/core/runner/cross-boundary-lane.d.ts +1 -1
- package/dist/core/runner/decide-continuation.d.ts +4 -2
- package/dist/core/runner/decide-continuation.js +7 -4
- package/dist/core/runner/denial-limit-arms.d.ts +15 -21
- package/dist/core/runner/denial-limit-arms.js +17 -10
- package/dist/core/runner/expire-settle.d.ts +44 -0
- package/dist/core/runner/expire-settle.js +55 -0
- package/dist/core/runner/git-status-frame.d.ts +3 -3
- package/dist/core/runner/git-status-frame.js +2 -1
- package/dist/core/runner/halt-attribution.d.ts +2 -1
- package/dist/core/runner/halt-attribution.js +2 -1
- package/dist/core/runner/local-claims.d.ts +17 -0
- package/dist/core/runner/local-claims.js +18 -0
- package/dist/core/runner/media-removed-seat.d.ts +46 -0
- package/dist/core/runner/media-removed-seat.js +88 -0
- package/dist/core/runner/park-commit.d.ts +2 -2
- package/dist/core/runner/permission-rule-lanes.d.ts +5 -1
- package/dist/core/runner/permission-rule-lanes.js +28 -9
- package/dist/core/runner/person-path-rows.js +1 -1
- package/dist/core/runner/placement-fence.d.ts +26 -0
- package/dist/core/runner/placement-fence.js +38 -0
- package/dist/core/runner/prepare-ask-lane.d.ts +6 -12
- package/dist/core/runner/prepare-ask-lane.js +4 -4
- package/dist/core/runner/prepare-boundary-parks.d.ts +4 -1
- package/dist/core/runner/prepare-boundary-parks.js +2 -2
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +2 -0
- package/dist/core/runner/prepare-caps-and-workflow.js +1 -0
- package/dist/core/runner/prepare-config-doors.js +16 -17
- package/dist/core/runner/prepare-context-lane.d.ts +6 -2
- package/dist/core/runner/prepare-context-lane.js +13 -13
- package/dist/core/runner/prepare-delegation-surface.d.ts +9 -9
- package/dist/core/runner/prepare-delegation-surface.js +4 -5
- package/dist/core/runner/prepare-execution-env.d.ts +5 -2
- package/dist/core/runner/prepare-execution-env.js +7 -4
- package/dist/core/runner/prepare-gate-stations.d.ts +19 -14
- package/dist/core/runner/prepare-gate-stations.js +6 -4
- package/dist/core/runner/prepare-hands-readface.d.ts +5 -5
- package/dist/core/runner/prepare-hands-readface.js +4 -4
- package/dist/core/runner/prepare-inherited-gate.d.ts +6 -0
- package/dist/core/runner/prepare-inherited-gate.js +3 -0
- package/dist/core/runner/prepare-lsp.d.ts +3 -0
- package/dist/core/runner/prepare-lsp.js +2 -2
- package/dist/core/runner/prepare-park-ask.d.ts +5 -2
- package/dist/core/runner/prepare-park-ask.js +4 -5
- package/dist/core/runner/prepare-policy-chain.d.ts +10 -21
- package/dist/core/runner/prepare-policy-chain.js +16 -25
- package/dist/core/runner/prepare-project-context.d.ts +2 -2
- package/dist/core/runner/prepare-prompt-inputs.d.ts +5 -4
- package/dist/core/runner/prepare-prompt-inputs.js +3 -2
- package/dist/core/runner/prepare-question-face.d.ts +6 -4
- package/dist/core/runner/prepare-question-face.js +2 -2
- package/dist/core/runner/prepare-run-refs.d.ts +3 -0
- package/dist/core/runner/prepare-run-refs.js +2 -2
- package/dist/core/runner/prepare-suspend-saga.d.ts +11 -7
- package/dist/core/runner/prepare-suspend-saga.js +17 -7
- package/dist/core/runner/prepare-task.d.ts +1 -1
- package/dist/core/runner/prepare-task.js +56 -28
- package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +6 -0
- package/dist/core/runner/prepare-tool-disclosure-mount.js +3 -1
- package/dist/core/runner/prepare-wiring-manifest.d.ts +3 -0
- package/dist/core/runner/prepare-wiring-manifest.js +2 -1
- package/dist/core/runner/prepare-workspace-restore.d.ts +5 -0
- package/dist/core/runner/prepare-workspace-restore.js +10 -6
- package/dist/core/runner/read-root-grant.d.ts +1 -1
- package/dist/core/runner/read-root-grant.js +2 -1
- package/dist/core/runner/resume-admission.d.ts +5 -3
- package/dist/core/runner/resume-admission.js +17 -3
- package/dist/core/runner/resume-apply.js +3 -1
- package/dist/core/runner/resume-claim.d.ts +8 -3
- package/dist/core/runner/resume-claim.js +28 -12
- package/dist/core/runner/resume-internals-and-config.d.ts +2 -2
- package/dist/core/runner/resume-internals-and-config.js +10 -1
- package/dist/core/runner/resume-preflight.d.ts +3 -2
- package/dist/core/runner/resume-preflight.js +13 -26
- package/dist/core/runner/retired-runner-deps.js +2 -0
- package/dist/core/runner/run-git-lane.js +2 -1
- package/dist/core/runner/run-harness-handlers.js +2 -2
- package/dist/core/runner/run-identity-wiring.d.ts +2 -2
- package/dist/core/runner/run-identity-wiring.js +14 -5
- package/dist/core/runner/run-leg.d.ts +3 -3
- package/dist/core/runner/run-leg.js +40 -29
- package/dist/core/runner/run-notification-lane.js +20 -2
- package/dist/core/runner/run-recovery-lanes.js +3 -2
- package/dist/core/runner/run-settle-and-teardown.js +9 -7
- package/dist/core/runner/run-telemetry-and-budget-seats.d.ts +1 -1
- package/dist/core/runner/run-terminal-adoption.d.ts +1 -1
- package/dist/core/runner/run-terminal-adoption.js +26 -17
- package/dist/core/runner/run-turn-boundary.js +27 -14
- package/dist/core/runner/runtask.d.ts +18 -3
- package/dist/core/runner/runtask.js +27 -11
- package/dist/core/runner/session-rule-policy.d.ts +1 -1
- package/dist/core/runner/session-rule-policy.js +6 -1
- package/dist/core/runner/shell-env-withheld.d.ts +1 -1
- package/dist/core/runner/stream-halt-verbs.d.ts +1 -14
- package/dist/core/runner/stream-halt-verbs.js +4 -3
- package/dist/core/runner/stream-reap.d.ts +7 -6
- package/dist/core/runner/stream-reap.js +13 -16
- package/dist/core/runner/stream-settle-backstop.d.ts +3 -2
- package/dist/core/runner/stream-settle-backstop.js +5 -3
- package/dist/core/runner/stream-steer-verb.d.ts +5 -2
- package/dist/core/runner/stream-steer-verb.js +8 -7
- package/dist/core/runner/terminal-account.d.ts +11 -1
- package/dist/core/runner/terminal-account.js +20 -0
- package/dist/core/runner/terminal-projection.d.ts +8 -2
- package/dist/core/runner/terminal-projection.js +2 -2
- package/dist/core/runner/tool-disclosure.d.ts +3 -0
- package/dist/core/runner/tool-disclosure.js +5 -2
- package/dist/core/runner/tool-end-body.d.ts +3 -3
- package/dist/core/runner/tool-end-body.js +1 -1
- package/dist/core/runner/tool-output-projection.d.ts +3 -3
- package/dist/core/runner/tool-output-projection.js +7 -6
- package/dist/core/runner/tool-table-view.d.ts +56 -0
- package/dist/core/runner/tool-table-view.js +51 -0
- package/dist/core/runner/turn-attachments.d.ts +3 -2
- package/dist/core/runner/turn-attachments.js +1 -1
- package/dist/core/runner/void-verifier-pause.d.ts +33 -0
- package/dist/core/runner/void-verifier-pause.js +41 -0
- package/dist/core/runner-deps.d.ts +24 -25
- package/dist/core/secret-env.d.ts +11 -11
- package/dist/core/secret-env.js +8 -9
- package/dist/core/session-log-transfer.js +9 -10
- package/dist/core/session-policy-store.d.ts +1 -1
- package/dist/core/session-policy-store.js +5 -2
- package/dist/core/session-reconcile.d.ts +3 -2
- package/dist/core/session-reconcile.js +7 -4
- package/dist/core/session-store.d.ts +2 -0
- package/dist/core/session-store.js +5 -7
- package/dist/core/session.d.ts +2 -1
- package/dist/core/shell-confinement.d.ts +37 -0
- package/dist/core/shell-confinement.js +56 -0
- package/dist/core/skill-grant.js +1 -1
- package/dist/core/store-contracts/checkpoint-store-contract.d.ts +2 -2
- package/dist/core/store-contracts/checkpoint-store-contract.js +15 -2
- package/dist/core/store-contracts/file-history-store-contract.d.ts +5 -2
- package/dist/core/store-contracts/file-history-store-contract.js +25 -1
- package/dist/core/store-contracts/mailbox-store-contract.d.ts +12 -5
- package/dist/core/store-contracts/mailbox-store-contract.js +156 -9
- package/dist/core/store-contracts/tool-result-store-contract.d.ts +1 -1
- package/dist/core/store-contracts/tool-result-store-contract.js +30 -0
- package/dist/core/task-event.d.ts +17 -8
- package/dist/core/task-limits.d.ts +5 -0
- package/dist/core/task-notification.d.ts +89 -12
- package/dist/core/task-notification.js +87 -13
- package/dist/core/task-registry-agent.d.ts +5 -43
- package/dist/core/task-registry-agent.js +24 -51
- package/dist/core/task-registry-monitor.d.ts +1 -1
- package/dist/core/task-registry-monitor.js +15 -60
- package/dist/core/task-registry-shared.d.ts +15 -112
- package/dist/core/task-registry-shared.js +3 -41
- package/dist/core/task-registry-workflow.js +4 -21
- package/dist/core/task-registry.d.ts +19 -60
- package/dist/core/task-registry.js +19 -106
- package/dist/core/task-result.d.ts +24 -7
- package/dist/core/task-spec-members.d.ts +39 -0
- package/dist/core/task-spec-members.js +92 -0
- package/dist/core/task-spec.d.ts +10 -10
- package/dist/core/task-tool-shape.d.ts +7 -57
- package/dist/core/task-tool-shape.js +7 -66
- package/dist/core/terminal-cause.d.ts +30 -0
- package/dist/core/terminal-cause.js +1 -0
- package/dist/core/tool-catalog-entries.js +2 -5
- package/dist/core/tool-check-reading.js +16 -10
- package/dist/core/tool-conformance.js +1 -2
- package/dist/core/tool-errors.d.ts +6 -3
- package/dist/core/tool-errors.js +2 -0
- package/dist/core/tool-face-reader.js +3 -2
- package/dist/core/tool-face.d.ts +2 -3
- package/dist/core/tool-name-aliases.d.ts +5 -29
- package/dist/core/tool-name-aliases.js +9 -5
- package/dist/core/tool-name-readings.d.ts +14 -3
- package/dist/core/tool-name-readings.js +2 -0
- package/dist/core/tool-policy.d.ts +108 -18
- package/dist/core/tool-policy.js +84 -14
- package/dist/core/tool-result-store.d.ts +23 -0
- package/dist/core/tool-result-store.js +3 -2
- package/dist/core/tool-spec.d.ts +19 -6
- package/dist/core/trace.d.ts +18 -1
- package/dist/core/user-attachment.js +26 -21
- package/dist/core/workflow-journal-store.d.ts +1 -1
- package/dist/core/workflow-run-store.d.ts +2 -0
- package/dist/core/workflow-run-store.js +6 -5
- package/dist/core/workflow-settled-run.d.ts +5 -0
- package/dist/core/workflow-settled-run.js +7 -0
- package/dist/engine/execution-env/node-execution-env.d.ts +34 -9
- package/dist/engine/execution-env/node-execution-env.js +213 -21
- package/dist/engine/harness/agent-harness.d.ts +65 -18
- package/dist/engine/harness/agent-harness.js +90 -23
- package/dist/engine/harness/messages.d.ts +4 -3
- package/dist/engine/harness/messages.js +2 -2
- package/dist/engine/harness/types.d.ts +41 -7
- package/dist/engine/llm/media-removed.d.ts +14 -0
- package/dist/engine/llm/media-removed.js +9 -0
- package/dist/engine/llm/rejected-images.d.ts +35 -25
- package/dist/engine/llm/rejected-images.js +59 -10
- package/dist/engine/llm/types.d.ts +24 -3
- package/dist/engine/llm/types.js +7 -3
- package/dist/engine/loop/agent-loop.d.ts +6 -1
- package/dist/engine/loop/agent-loop.js +20 -11
- package/dist/engine/loop/types.d.ts +12 -3
- package/dist/engine/session/import-validate.js +7 -0
- package/dist/fixtures/index.d.ts +7 -5
- package/dist/fixtures/index.js +5 -3
- package/dist/index.d.ts +21 -11
- package/dist/index.js +15 -7
- package/dist/internal/harness-types.d.ts +2 -0
- package/dist/internal/llm.d.ts +2 -1
- package/dist/internal/llm.js +1 -0
- package/dist/orchestration/goal.d.ts +6 -2
- package/dist/orchestration/goal.js +6 -3
- package/dist/orchestration/run-workflow-tool.d.ts +11 -17
- package/dist/orchestration/run-workflow-tool.js +19 -42
- package/dist/orchestration/workflow-governance.d.ts +1 -1
- package/dist/orchestration/workflow-types.d.ts +2 -2
- package/dist/orchestration/workflow.d.ts +4 -0
- package/dist/orchestration/workflow.js +8 -5
- package/dist/stores/file/background-agent-store.js +18 -15
- package/dist/stores/file/checkpoint-store.js +7 -4
- package/dist/stores/file/file-history-store.js +3 -2
- package/dist/stores/file/index.d.ts +5 -3
- package/dist/stores/file/index.js +23 -8
- package/dist/stores/file/ledger-tuning.d.ts +23 -0
- package/dist/stores/file/ledger-tuning.js +21 -0
- package/dist/stores/file/mailbox-store.js +42 -22
- package/dist/stores/file/memory-store.js +3 -2
- package/dist/stores/file/permission-rule-adopt.js +24 -21
- package/dist/stores/file/permission-rule-store.js +6 -3
- package/dist/stores/file/session-policy-store.js +3 -2
- package/dist/stores/file/session-store.d.ts +16 -3
- package/dist/stores/file/session-store.js +21 -20
- package/dist/stores/file/tool-result-store.d.ts +11 -0
- package/dist/stores/file/tool-result-store.js +57 -3
- package/dist/stores/file/usage-window-store.js +3 -2
- package/dist/stores/file/workflow-journal-store.d.ts +0 -2
- package/dist/stores/file/workflow-journal-store.js +3 -18
- package/dist/stores/file/workflow-run-store.d.ts +1 -1
- package/dist/stores/file/workflow-run-store.js +15 -10
- package/dist/tools/fs/dead-cwd.d.ts +5 -5
- package/dist/tools/fs/dead-cwd.js +4 -11
- package/dist/tools/fs/fs-bash-background-text.d.ts +6 -0
- package/dist/tools/fs/fs-bash-background-text.js +6 -0
- package/dist/tools/fs/fs-bash.d.ts +3 -18
- package/dist/tools/fs/fs-bash.js +37 -124
- package/dist/tools/fs/fs-pdf.js +8 -6
- package/dist/tools/fs/fs-read.js +2 -2
- package/dist/tools/fs/fs-shared.d.ts +28 -3
- package/dist/tools/fs/fs-shared.js +15 -0
- package/dist/tools/fs/index.d.ts +1 -1
- package/dist/tools/fs/index.js +4 -14
- package/dist/tools/fs/pdf.d.ts +4 -4
- package/dist/tools/fs/pdf.js +6 -6
- package/dist/tools/fs/read-deny-home.js +8 -1
- package/dist/tools/fs/read-deny.d.ts +26 -2
- package/dist/tools/fs/read-deny.js +9 -2
- package/dist/tools/fs/read-floor.d.ts +13 -5
- package/dist/tools/fs/read-floor.js +206 -2
- package/dist/tools/fs/search.d.ts +3 -2
- package/dist/tools/fs/search.js +6 -6
- package/dist/tools/fs/shell-read-establish.js +3 -1
- package/dist/tools/fs/shell-read-identity.d.ts +3 -1
- package/dist/tools/fs/shell-read-identity.js +4 -2
- package/dist/tools/fs/shell-read-judge.d.ts +7 -1
- package/dist/tools/fs/shell-read-judge.js +1 -1
- package/dist/tools/monitor.d.ts +8 -7
- package/dist/tools/monitor.js +12 -10
- package/dist/tools/worktree.d.ts +5 -1
- package/dist/tools/worktree.js +20 -17
- package/package.json +6 -3
- package/test/export-surface.snapshot.json +92 -10
- package/wire-changes/core-stores-sql@7.61.0.json +480 -0
- package/wire-changes/core@7.61.0.json +4405 -0
- package/wire-changes/mods-kernel@7.61.0.json +65 -0
- package/wire-changes/primitives@7.61.0.json +30 -0
- package/dist/core/runner/image-removed-seat.d.ts +0 -12
- package/dist/core/runner/image-removed-seat.js +0 -19
|
@@ -8,6 +8,8 @@ import { directoryPinOf } from "./dual-root.js";
|
|
|
8
8
|
import { landingPathOf } from "./layout.js";
|
|
9
9
|
import { egressText } from "../untrusted-egress.js";
|
|
10
10
|
import { REDACTION_MARKS } from "../redaction-marks.js";
|
|
11
|
+
const DROP_THE_CURSOR = "drop the cursor to accept re-convergence from an empty baseline — entries changed on both sides are reported as conflicts, " +
|
|
12
|
+
"and entries deleted on one side since the last round come back from the other side";
|
|
11
13
|
const REFUSAL_ROWS = {
|
|
12
14
|
scope: {
|
|
13
15
|
why: "a cursor is the baseline of one (scope, peer) partition",
|
|
@@ -18,8 +20,17 @@ const REFUSAL_ROWS = {
|
|
|
18
20
|
outs: (want) => [
|
|
19
21
|
"re-bind — run this layer over a transport that reaches the peer the cursor was taken against, or, " +
|
|
20
22
|
`only when this transport reaches that same peer under a new identity, set the cursor's peer to ${quoted(want)}`,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
DROP_THE_CURSOR,
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
incarnation: {
|
|
27
|
+
why: "the peer holds another state than the one the baseline was taken against and refused the round before writing, so nothing " +
|
|
28
|
+
"was written on either side — run on that baseline, an entry the peer lacks would land here as a delete and an older copy as a rollback",
|
|
29
|
+
outs: (want) => [
|
|
30
|
+
"re-bind — run this layer against the state the baseline was taken against, or, only when the cursor carries no incarnation " +
|
|
31
|
+
`(it was written before cursors carried one) and this peer holds that same state, set the cursor's peerIncarnation to ${quoted(want)}; ` +
|
|
32
|
+
"a cursor that carries another incarnation is never re-bound to this one",
|
|
33
|
+
DROP_THE_CURSOR,
|
|
23
34
|
],
|
|
24
35
|
},
|
|
25
36
|
store: {
|
|
@@ -50,7 +61,7 @@ function syncRefusal(on, head, want) {
|
|
|
50
61
|
}
|
|
51
62
|
else {
|
|
52
63
|
e.code = "config.memory_sync_cursor_mismatch";
|
|
53
|
-
e.detail = Object.freeze({ axis: on.axis, found: on.found });
|
|
64
|
+
e.detail = Object.freeze({ axis: on.axis, found: on.found, want: carriesCredential(want) ? REDACTION_MARKS.credentials : want });
|
|
54
65
|
}
|
|
55
66
|
e.outs = outs;
|
|
56
67
|
MINTED_REFUSALS.add(e);
|
|
@@ -69,18 +80,23 @@ function syncStoreOf(backend) {
|
|
|
69
80
|
const root = landingPathOf(pin);
|
|
70
81
|
return { root, identity: `file:${root}` };
|
|
71
82
|
}
|
|
83
|
+
function cursorRefusal(axis, got, want) {
|
|
84
|
+
const found = got === undefined ? "absent" : "other";
|
|
85
|
+
const head = found === "absent" ? `cursor has no ${axis} binding` : `cursor is for ${axis} ${quoted(got)}`;
|
|
86
|
+
return syncRefusal({ axis, found }, `${head}; this round's ${axis} is ${quoted(want)}`, want);
|
|
87
|
+
}
|
|
72
88
|
function refuseForeignCursor(cursor, scope, peer, store) {
|
|
73
89
|
const axis = [["scope", cursor.scope, scope], ["peer", cursor.peer, peer], ["store", cursor.store, store]];
|
|
74
90
|
for (const [name, got, want] of axis) {
|
|
75
|
-
if (got
|
|
76
|
-
|
|
77
|
-
const found = got === undefined ? "absent" : "other";
|
|
78
|
-
const head = found === "absent" ? `cursor has no ${name} binding` : `cursor is for ${name} ${quoted(got)}`;
|
|
79
|
-
throw syncRefusal({ axis: name, found }, `${head}; this round's ${name} is ${quoted(want)}`, want);
|
|
91
|
+
if (got !== want)
|
|
92
|
+
throw cursorRefusal(name, got, want);
|
|
80
93
|
}
|
|
81
94
|
}
|
|
95
|
+
function servesClaim(claim, baselineEmpty, incarnation) {
|
|
96
|
+
return claim !== undefined ? claim === incarnation : baselineEmpty;
|
|
97
|
+
}
|
|
82
98
|
function memorySyncPath(scope) {
|
|
83
|
-
return `/
|
|
99
|
+
return `/v2/memory/sync/${encodeURIComponent(scope)}`;
|
|
84
100
|
}
|
|
85
101
|
function baselineStub(id, rev, scope) {
|
|
86
102
|
return { id, rev, scope, slug: `sync-baseline-stub/${id}`, frontmatter: {}, body: "" };
|
|
@@ -93,9 +109,26 @@ function quoted(v) {
|
|
|
93
109
|
return JSON.stringify(typeof v);
|
|
94
110
|
return carriesCredential(v) ? REDACTION_MARKS.credentials : JSON.stringify(v);
|
|
95
111
|
}
|
|
112
|
+
const isAsciiLetter = (c) => (c >= 65 && c <= 90) || (c >= 97 && c <= 122);
|
|
113
|
+
const isSchemeChar = (c) => isAsciiLetter(c) || (c >= 48 && c <= 57) || c === 43 || c === 45 || c === 46;
|
|
114
|
+
const SPECIAL_SCHEMES = new Set(["ftp", "file", "http", "https", "ws", "wss"]);
|
|
96
115
|
export function carriesCredential(peer) {
|
|
97
116
|
if (egressText("same-principal", peer) !== peer)
|
|
98
117
|
return true;
|
|
118
|
+
for (let mark = peer.indexOf("://"); mark !== -1; mark = peer.indexOf("://", mark + 3)) {
|
|
119
|
+
let from = mark;
|
|
120
|
+
while (from > 0 && isSchemeChar(peer.charCodeAt(from - 1)))
|
|
121
|
+
from--;
|
|
122
|
+
while (from < mark && !isAsciiLetter(peer.charCodeAt(from)))
|
|
123
|
+
from++;
|
|
124
|
+
if (from === mark)
|
|
125
|
+
continue;
|
|
126
|
+
const rest = peer.slice(mark + 3);
|
|
127
|
+
const end = rest.search(SPECIAL_SCHEMES.has(peer.slice(from, mark).toLowerCase()) ? /[\s/\\?#]/ : /[\s/?#]/);
|
|
128
|
+
const authority = end === -1 ? rest : rest.slice(0, end);
|
|
129
|
+
if (authority.lastIndexOf("@") > 0)
|
|
130
|
+
return true;
|
|
131
|
+
}
|
|
99
132
|
try {
|
|
100
133
|
const url = new URL(peer);
|
|
101
134
|
return url.username !== "" || url.password !== "";
|
|
@@ -104,13 +137,24 @@ export function carriesCredential(peer) {
|
|
|
104
137
|
return false;
|
|
105
138
|
}
|
|
106
139
|
}
|
|
107
|
-
|
|
140
|
+
const isIncarnation = (v) => namesSomething(v) && !carriesCredential(v);
|
|
141
|
+
function parseMemorySyncResponse(raw, scope, peer, claim, baselineEmpty) {
|
|
108
142
|
const fail = (why) => {
|
|
109
143
|
throw new Error(egressText("same-principal", `memory sync: transport response is not a valid sync response (${why})`));
|
|
110
144
|
};
|
|
111
145
|
if (!isRecord(raw))
|
|
112
146
|
fail("body must be a JSON object { applied, conflicts, serverEntries, serverDeletes, cursor }");
|
|
113
147
|
const b = raw;
|
|
148
|
+
if (Object.prototype.hasOwnProperty.call(b, "refused")) {
|
|
149
|
+
if (b["refused"] !== "baseline_incarnation")
|
|
150
|
+
fail(`refused must be "baseline_incarnation" — the one refusal a peer answers a sync with`);
|
|
151
|
+
const incarnation = b["incarnation"];
|
|
152
|
+
if (!isIncarnation(incarnation))
|
|
153
|
+
fail("a refusal's incarnation must be a non-empty string that holds no credential");
|
|
154
|
+
if (servesClaim(claim, baselineEmpty, incarnation))
|
|
155
|
+
fail(`the peer refused a sync its incarnation ${quoted(incarnation)} serves`);
|
|
156
|
+
throw cursorRefusal("incarnation", claim, incarnation);
|
|
157
|
+
}
|
|
114
158
|
const applied = [];
|
|
115
159
|
if (!Array.isArray(b["applied"]))
|
|
116
160
|
fail("applied must be an array");
|
|
@@ -266,10 +310,18 @@ function parseMemorySyncResponse(raw, scope, peer) {
|
|
|
266
310
|
}
|
|
267
311
|
const cur = b["cursor"];
|
|
268
312
|
if (!isRecord(cur))
|
|
269
|
-
fail("cursor must be an object { peer, baseRevs, updatedAtMs }");
|
|
313
|
+
fail("cursor must be an object { peer, incarnation, baseRevs, updatedAtMs }");
|
|
270
314
|
const curRec = cur;
|
|
271
315
|
if (curRec["peer"] !== peer)
|
|
272
316
|
fail(`cursor.peer ${quoted(curRec["peer"])} does not match the requested peer ${quoted(peer)}`);
|
|
317
|
+
const incarnation = curRec["incarnation"];
|
|
318
|
+
if (!isIncarnation(incarnation))
|
|
319
|
+
fail("cursor.incarnation must be a non-empty string that holds no credential — the incarnation of the state that answered");
|
|
320
|
+
if (!servesClaim(claim, baselineEmpty, incarnation)) {
|
|
321
|
+
fail(claim !== undefined
|
|
322
|
+
? `cursor.incarnation ${quoted(incarnation)} does not match the requested peerIncarnation ${quoted(claim)}`
|
|
323
|
+
: `the request carried a non-empty baseline and no peerIncarnation, which a peer answers only by refusing it — not with a result under ${quoted(incarnation)}`);
|
|
324
|
+
}
|
|
273
325
|
if (!isRecord(curRec["baseRevs"]))
|
|
274
326
|
fail("cursor.baseRevs must be an object mapping id → rev");
|
|
275
327
|
const baseRevs = {};
|
|
@@ -289,7 +341,7 @@ function parseMemorySyncResponse(raw, scope, peer) {
|
|
|
289
341
|
conflicts,
|
|
290
342
|
serverEntries,
|
|
291
343
|
serverDeletes,
|
|
292
|
-
cursor: { peer, baseRevs, updatedAtMs: updatedAtMs },
|
|
344
|
+
cursor: { peer, incarnation: incarnation, baseRevs, updatedAtMs: updatedAtMs },
|
|
293
345
|
...(pullTruncatedRaw === true ? { pullTruncated: true } : {}),
|
|
294
346
|
};
|
|
295
347
|
}
|
|
@@ -307,6 +359,11 @@ export async function syncMemoryScope(opts) {
|
|
|
307
359
|
const { root: storeRoot, identity: store } = syncStoreOf(backend);
|
|
308
360
|
if (cursor !== undefined)
|
|
309
361
|
refuseForeignCursor(cursor, scope, peer, store);
|
|
362
|
+
const claimed = cursor === undefined ? undefined : cursor.peerIncarnation;
|
|
363
|
+
if (claimed !== undefined && !isIncarnation(claimed)) {
|
|
364
|
+
throw new Error(`memory sync: cursor.peerIncarnation must be a non-empty string that holds no credential when present — it is the incarnation a peer answered a sync with, carried back verbatim`);
|
|
365
|
+
}
|
|
366
|
+
const claim = claimed;
|
|
310
367
|
for (const [name, v] of [["maxPushEntries", opts.maxPushEntries], ["maxPullEntries", opts.maxPullEntries], ["maxEntryBytes", opts.maxEntryBytes]]) {
|
|
311
368
|
if (v !== undefined && (!Number.isSafeInteger(v) || v < 1)) {
|
|
312
369
|
throw new Error(`memory sync: ${name} must be a positive integer (>= 1) when set, got ${String(v)}`);
|
|
@@ -348,12 +405,13 @@ export async function syncMemoryScope(opts) {
|
|
|
348
405
|
}
|
|
349
406
|
const request = {
|
|
350
407
|
peer,
|
|
408
|
+
...(claim !== undefined ? { peerIncarnation: claim } : {}),
|
|
351
409
|
baseRevs,
|
|
352
410
|
entries: pushEntries,
|
|
353
411
|
deletes: plan.deleteRemote.map((d) => d.id),
|
|
354
412
|
...(opts.maxPullEntries !== undefined ? { pull: { limit: opts.maxPullEntries } } : {}),
|
|
355
413
|
};
|
|
356
|
-
const resp = parseMemorySyncResponse(await transport.post(memorySyncPath(scope), request), scope, peer);
|
|
414
|
+
const resp = parseMemorySyncResponse(await transport.post(memorySyncPath(scope), request), scope, peer, claim, Object.keys(baseRevs).length === 0);
|
|
357
415
|
const conflicts = [...pushGateConflicts, ...resp.conflicts.map((c) => ({ side: "server", ...c }))];
|
|
358
416
|
const rejected = new Set();
|
|
359
417
|
const localIds = new Set(local.map((e) => e.id));
|
|
@@ -482,7 +540,7 @@ export async function syncMemoryScope(opts) {
|
|
|
482
540
|
nextBaseRevs[op.id] = landedRev;
|
|
483
541
|
}
|
|
484
542
|
}
|
|
485
|
-
nextCursor = { scope, peer, store, baseRevs: nextBaseRevs, updatedAtMs: now() };
|
|
543
|
+
nextCursor = { scope, peer, peerIncarnation: resp.cursor.incarnation, store, baseRevs: nextBaseRevs, updatedAtMs: now() };
|
|
486
544
|
}
|
|
487
545
|
return {
|
|
488
546
|
ok: cursorAdvanced && conflicts.length === 0,
|
|
@@ -22,11 +22,14 @@ export type MemorySyncLayerReport = {
|
|
|
22
22
|
} | {
|
|
23
23
|
readonly outcome: "refused";
|
|
24
24
|
readonly code: "config.memory_sync_cursor_mismatch" | "config.memory_sync_store";
|
|
25
|
-
/** Present on a cursor refusal: the axis it was refused on
|
|
26
|
-
* (`absent`) or another one (`other`)
|
|
25
|
+
/** Present on a cursor refusal: the axis it was refused on, whether the cursor carried no binding there
|
|
26
|
+
* (`absent`) or another one (`other`), and this call's value on it (`want`: the scope, the transport's peer,
|
|
27
|
+
* the local store's identity, or the incarnation of the peer state that answered — as the sentence shows it: one
|
|
28
|
+
* that holds a credential is the credentials mark alone). */
|
|
27
29
|
readonly detail?: {
|
|
28
|
-
readonly axis: "scope" | "peer" | "store";
|
|
30
|
+
readonly axis: "scope" | "peer" | "store" | "incarnation";
|
|
29
31
|
readonly found: "absent" | "other";
|
|
32
|
+
readonly want: string;
|
|
30
33
|
};
|
|
31
34
|
/** The two ways out the sentence names — both the host's to take, the engine takes neither. */
|
|
32
35
|
readonly outs: readonly [string, string];
|
|
@@ -90,7 +93,7 @@ export declare function memorySyncReportOf(round: {
|
|
|
90
93
|
})): MemorySyncRoundReport;
|
|
91
94
|
/**
|
|
92
95
|
* What of a session's memory does not travel with it: every scope of the report's read set that did not arrive whole,
|
|
93
|
-
* once, with why — `refused` (the sync, or its layer, was refused
|
|
96
|
+
* once, with why — `refused` (the sync, or its layer's last call, was refused and wrote nothing on either side), `failed`, `incomplete`,
|
|
94
97
|
* `not_replicated` (no layer was run for it), or `not_read_at_destination` (its layer synced, and the destination's
|
|
95
98
|
* read set, when given, does not hold it). A scope absent from the result travelled. Keys are compared as written. A
|
|
96
99
|
* report that is not one this engine's `memorySyncReportOf` could have minted (a layer with no scope, outside the read
|
|
@@ -11,13 +11,21 @@ export interface MemorySyncCursor {
|
|
|
11
11
|
/** The identity of the PEER the baseline was taken against (`MemorySyncTransport.peer`); a round over
|
|
12
12
|
* another peer refuses the cursor. One cursor per peer. */
|
|
13
13
|
peer: string;
|
|
14
|
+
/** WHICH STATE of that peer the baseline was taken against: the opaque incarnation the peer answered the last
|
|
15
|
+
* completed sync with (`MemorySyncResponseBody.cursor.incarnation`). Every later sync carries it back as its
|
|
16
|
+
* claim (`MemorySyncRequestBody.peerIncarnation`), and the peer — the side holding that state — compares the claim
|
|
17
|
+
* with its own before it writes anything, refusing when they differ or when the baseline is not empty and no
|
|
18
|
+
* claim is made (a cursor written before cursors carried this member). The same address can answer from another
|
|
19
|
+
* state (a rebuilt or restored center): the address says where the sync goes, this says which state answers it.
|
|
20
|
+
* Persist it verbatim; the engine never mints, derives or compares it. */
|
|
21
|
+
peerIncarnation: string;
|
|
14
22
|
/** The LOCAL store the baseline was taken against (minted by `memorySyncStoreOf`, sync-client.ts).
|
|
15
23
|
* A sync over any other store refuses the cursor: the baseline describes another store's
|
|
16
24
|
* entries, and an id it holds that this store lacks would be pushed as a delete. Persist it
|
|
17
25
|
* verbatim with the rest of the cursor; the host rebinds it (this member set to the new store's
|
|
18
26
|
* identity) only when the new store holds the entries the baseline was taken over. */
|
|
19
27
|
store: string;
|
|
20
|
-
/** id → rev at the last completed sync
|
|
28
|
+
/** id → rev at the last completed sync with this peer (in the state {@link peerIncarnation} names). */
|
|
21
29
|
baseRevs: Record<string, string>;
|
|
22
30
|
/** Caller-injected clock (never Date.now inside the engine — clock-injection precedent). */
|
|
23
31
|
updatedAtMs: number;
|
|
@@ -166,15 +166,15 @@ export declare function modeRequestAfterResume(seat: PermissionMode | undefined,
|
|
|
166
166
|
readonly decision?: string;
|
|
167
167
|
} | undefined): PermissionMode | undefined;
|
|
168
168
|
/**
|
|
169
|
-
* The permission MODE's door —
|
|
170
|
-
* absence (a mode a caller believes it declared must not silently run as another): a
|
|
171
|
-
* (`config.spec_retired_key` — `autoModeRequested` / `approverPosture` are one key now); a `permissionMode` outside
|
|
169
|
+
* The permission MODE's door — two refusals in the pre-first-await stretch, each by name and never a fold back to
|
|
170
|
+
* absence (a mode a caller believes it declared must not silently run as another): a `permissionMode` outside
|
|
172
171
|
* the closed set (`config.permission_mode_invalid`); a `shellGate` value other than the floor word `"always"`
|
|
173
|
-
* (`config.shell_gate_value_retired` — `"off"` / `"classify"` were a doctrine the mode arbitration replaced).
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
172
|
+
* (`config.shell_gate_value_retired` — `"off"` / `"classify"` were a doctrine the mode arbitration replaced). A RETIRED
|
|
173
|
+
* mode key (`autoModeRequested` / `approverPosture` — one key now) is refused by the spec's one read (`readCallerSpec`,
|
|
174
|
+
* `config.spec_retired_key`), before this door. The value it screened is the value it RETURNS — the mode seat reads this
|
|
175
|
+
* snapshot, never the spec again. The ONE function both entrances call: prepare (the run's read of its spec, before the
|
|
176
|
+
* config doors rebind it, in its pre-first-await stretch) and the resume ladder's admission rung (the re-supplied
|
|
177
|
+
* config's read, before the claim) — a resume prepare would refuse is refused before it consumes the row.
|
|
178
178
|
*/
|
|
179
179
|
export declare function refusePermissionModeDoors(spec: Pick<TaskSpec, "permissionMode" | "shellGate">): PermissionMode | undefined;
|
|
180
180
|
/** The resume's ONE refusal channel for a door prepare would refuse at: runs `screen` (prepare's own function, which throws prepare's sentence and code) and
|
package/dist/core/mode-policy.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { createFsWriteGatePolicy } from "./fs-write-gate-policy.js";
|
|
2
2
|
import { isProtectedWrite } from "./tool-registry.js";
|
|
3
3
|
import { answeredFor } from "./tool-policy.js";
|
|
4
|
+
import { attest } from "./engine-attestation.js";
|
|
4
5
|
import { rosterEntryNamed, toolCallFaceOf } from "./tool-roster.js";
|
|
5
6
|
import { wireOf } from "./tool-name-readings.js";
|
|
6
7
|
import { clampPermissionMode, isPermissionMode, PERMISSION_MODES } from "./ask-origin.js";
|
|
7
8
|
import { argvOf, lexShellText } from "../shell/lex.js";
|
|
8
9
|
import { COMMAND_RULE_TOOL } from "./permission-rule-model.js";
|
|
9
10
|
import { createSafeNotifier } from "./safe-notify.js";
|
|
10
|
-
import { assertNoRetiredKeys, RETIRED_TASK_SPEC_KEYS } from "./retired-keys.js";
|
|
11
11
|
import { CheckpointError, isCheckpointConfigRefusalCode } from "./checkpoint-store.js";
|
|
12
12
|
export const PERMISSION_MODE_FOLD_REASONS = Object.freeze(["operator_deny", "face_absent", "inherited_ceiling"]);
|
|
13
13
|
export const ACCEPT_EDITS_FILE_COMMANDS = Object.freeze(["mkdir", "touch", "rm", "rmdir", "mv", "cp", "sed"]);
|
|
@@ -74,13 +74,16 @@ export function modeQuestionReaches(mode, roster, toolName, seat) {
|
|
|
74
74
|
const call = { toolName, args: {}, toolCallId: "", ...(face !== undefined ? { face } : {}) };
|
|
75
75
|
return policy.writeGate === "plan" ? planRefusesWrite(call, roster) : isProtectedWrite(call);
|
|
76
76
|
}
|
|
77
|
-
const planAsk = (message
|
|
77
|
+
const planAsk = (message, call, generic) => {
|
|
78
|
+
const asked = { action: "ask", message, decisionReason: "mode" };
|
|
79
|
+
return generic ? attest(asked, call, { genericQuestion: message }) : asked;
|
|
80
|
+
};
|
|
78
81
|
export function createModeGatePolicy(modeRef, seats) {
|
|
79
82
|
const askGate = createFsWriteGatePolicy({ env: seats.env, rootPath: seats.rootPath, defaultWrite: "ask" });
|
|
80
83
|
const acceptSeat = seats.acceptDirs;
|
|
81
84
|
const acceptDirs = typeof acceptSeat === "function" ? acceptSeat : acceptSeat !== undefined && acceptSeat.length > 0 ? [...acceptSeat] : [seats.rootPath];
|
|
82
85
|
const acceptRootGate = createFsWriteGatePolicy({ env: seats.env, rootPath: seats.rootPath, acceptDirs, defaultWrite: "ask" });
|
|
83
|
-
const planGate = createFsWriteGatePolicy({ env: seats.env, rootPath: seats.rootPath, defaultWrite: "ask", defaultAsk: (path, note) => planAsk(`Cannot write to ${path} while in plan mode.${note ?? ""}
|
|
86
|
+
const planGate = createFsWriteGatePolicy({ env: seats.env, rootPath: seats.rootPath, defaultWrite: "ask", defaultAsk: (path, note, call) => planAsk(`Cannot write to ${path} while in plan mode.${note ?? ""}`, call, note === undefined) });
|
|
84
87
|
return {
|
|
85
88
|
async check(req, signal) {
|
|
86
89
|
const gate = modePolicyOf(modeRef.current).writeGate;
|
|
@@ -90,7 +93,7 @@ export function createModeGatePolicy(modeRef, seats) {
|
|
|
90
93
|
if (!planRefusesWrite(req, seats.roster?.current, seats.readOnlyDeclared))
|
|
91
94
|
return { action: "allow" };
|
|
92
95
|
if (!isProtectedWrite(req))
|
|
93
|
-
return planAsk(`Cannot call ${req.toolName} while in plan mode
|
|
96
|
+
return planAsk(`Cannot call ${req.toolName} while in plan mode.`, req, true);
|
|
94
97
|
return planGate.check(req, signal);
|
|
95
98
|
}
|
|
96
99
|
return (gate === "ask" ? askGate : acceptRootGate).check(req, signal);
|
|
@@ -104,7 +107,6 @@ export function modeRequestAfterResume(seat, recorded, outcome) {
|
|
|
104
107
|
return seat !== undefined && seat !== "plan" ? seat : recorded.prePlanMode;
|
|
105
108
|
}
|
|
106
109
|
export function refusePermissionModeDoors(spec) {
|
|
107
|
-
assertNoRetiredKeys(spec, RETIRED_TASK_SPEC_KEYS, "TaskSpec");
|
|
108
110
|
const mode = spec.permissionMode;
|
|
109
111
|
if (mode !== undefined && !isPermissionMode(mode)) {
|
|
110
112
|
const e = new Error(`permissionMode must be one of ${PERMISSION_MODES.map((w) => JSON.stringify(w)).join(", ")} when present (got ${JSON.stringify(mode)}) — omit it for the default mode; an unrecognized word is refused rather than read as any mode.`);
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { type ModCallEntry } from "./kernel/index.js";
|
|
1
2
|
import type { HookInvocationIdentity } from "../hooks.js";
|
|
2
3
|
import type { PermissionMode } from "../ask-origin.js";
|
|
3
4
|
import { type LegModBus } from "./stations.js";
|
|
5
|
+
import { type ToolCallEntryInput } from "./tool-call.js";
|
|
4
6
|
/** One agent type as the model is offered it. */
|
|
5
7
|
export interface OfferedAgent {
|
|
6
8
|
readonly name: string;
|
|
@@ -8,15 +10,19 @@ export interface OfferedAgent {
|
|
|
8
10
|
}
|
|
9
11
|
/**
|
|
10
12
|
* The offered set — the ONE reading of "which agent types is the model offered": each type the chain does not answer
|
|
11
|
-
* `{ isOffered: false }`, in the order given.
|
|
12
|
-
* itself could not raise offers the type (an observation of the offer is never what hides it).
|
|
13
|
+
* `{ isOffered: false }`, in the order given. A seat nothing hears ({@link seatHears}), no dispatch: the types as given.
|
|
14
|
+
* A dispatch the engine itself could not raise offers the type (an observation of the offer is never what hides it).
|
|
13
15
|
*/
|
|
14
|
-
export declare function offeredAgents<A extends OfferedAgent>(
|
|
16
|
+
export declare function offeredAgents<A extends OfferedAgent>(seat: {
|
|
17
|
+
readonly bus: LegModBus;
|
|
18
|
+
} | undefined, agents: readonly A[], signal: AbortSignal | undefined): Promise<readonly A[]>;
|
|
15
19
|
/** A rendered agent listing read through the offered set: the same listing when every type is offered, else a copy with the
|
|
16
20
|
* types the chain hid left out — what a listing frame renders, commits and mirrors. */
|
|
17
21
|
export declare function offeredAgentListing<L extends {
|
|
18
22
|
readonly entries: readonly OfferedAgent[];
|
|
19
|
-
}>(
|
|
23
|
+
}>(seat: {
|
|
24
|
+
readonly bus: LegModBus;
|
|
25
|
+
} | undefined, listing: L | undefined, signal: AbortSignal | undefined): Promise<L | undefined>;
|
|
20
26
|
/** What the delegation decided about the subagent it is about to start, as `agent.spawn` names it. */
|
|
21
27
|
export interface AgentSpawnFacts {
|
|
22
28
|
/** The delegation call this spawn belongs to. */
|
|
@@ -45,6 +51,17 @@ export type AgentSpawnVerdict = {
|
|
|
45
51
|
readonly by: string;
|
|
46
52
|
readonly reason: string;
|
|
47
53
|
};
|
|
54
|
+
/** The model a started subagent is named by: the one the delegation settled, `inherit` when the child's own prepare decides —
|
|
55
|
+
* what `agent.spawn`'s bottom comes up as and what `$.agent.spawn` answers. */
|
|
56
|
+
export declare function spawnedModel(model: string | undefined): string;
|
|
57
|
+
/** The extension's own spawn a delegation call is ({@link AgentStations.extensionSpawn}): who asked, and the one write of "started". */
|
|
58
|
+
export interface ExtensionSpawn {
|
|
59
|
+
/** The registration that called `$.agent.spawn`. */
|
|
60
|
+
readonly by: string;
|
|
61
|
+
/** The subagent was let run under `agentId` — its registry task id, which is its leg's task id and so its events' `agentId`;
|
|
62
|
+
* `model` is the one the delegation settled (`undefined` ⇒ the child's prepare decides). Written once. */
|
|
63
|
+
launched(agentId: string, model: string | undefined): void;
|
|
64
|
+
}
|
|
48
65
|
/** The delegating leg's two agent stations, as its delegation tools read them (a Runner-filled seat, never a model argument). */
|
|
49
66
|
export interface AgentStations {
|
|
50
67
|
/** Whether a handler hangs on the event — a caller with nothing to raise reads none (no await on its path). */
|
|
@@ -53,6 +70,10 @@ export interface AgentStations {
|
|
|
53
70
|
offered<A extends OfferedAgent>(agents: readonly A[], signal: AbortSignal | undefined): Promise<readonly A[]>;
|
|
54
71
|
/** Raise `agent.spawn` (no handler ⇒ nothing raised: the subagent may start). */
|
|
55
72
|
spawn(facts: AgentSpawnFacts, signal: AbortSignal | undefined): Promise<AgentSpawnVerdict>;
|
|
73
|
+
/** The extension's own call (`$.agent.spawn`) the delegation call `toolCallId` is, on this leg — undefined for any other call
|
|
74
|
+
* (the model's, or a tool's an extension called with `$.tool.call` that runs the delegation in its body). The one reading of
|
|
75
|
+
* "an extension asked for this spawn": read once per call. */
|
|
76
|
+
extensionSpawn(toolCallId: string | undefined): ExtensionSpawn | undefined;
|
|
56
77
|
}
|
|
57
78
|
export interface AgentStationsInput {
|
|
58
79
|
readonly bus: LegModBus;
|
|
@@ -63,3 +84,17 @@ export interface AgentStationsInput {
|
|
|
63
84
|
}
|
|
64
85
|
/** The leg's agent stations over its bus. */
|
|
65
86
|
export declare function createAgentStations(input: AgentStationsInput): AgentStations;
|
|
87
|
+
/** What `$.agent.spawn`'s host entry runs a spawn on: the leg's harness (the loop's pipeline under the running prompt), the
|
|
88
|
+
* names its live roster mounts, and the tools as the caller handed them (a delegation tool is known by its `execute`). */
|
|
89
|
+
export interface AgentSpawnEntryInput extends Pick<ToolCallEntryInput, "bus" | "harness" | "specOf"> {
|
|
90
|
+
/** The names the leg's live roster mounts. */
|
|
91
|
+
readonly mounted: () => readonly string[];
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* `$.agent.spawn`'s host entry (see the module header): the leg's one delegation tool, run through the loop's per-call pipeline as
|
|
95
|
+
* the caller's call. It answers off the call's record: started ⇒ `{ model, agentId }` (whatever the post-execution stations did to
|
|
96
|
+
* the result); not started and refused or failed ⇒ `{ deny: <the result's text> }`; not started with no error (an extension answered
|
|
97
|
+
* the call in place of its body) ⇒ `{ model }`, no `agentId`. It throws on an empty prompt, and when the leg mounts no delegation
|
|
98
|
+
* tool or more than one (it names them; it never picks).
|
|
99
|
+
*/
|
|
100
|
+
export declare function createAgentSpawnEntry(input: AgentSpawnEntryInput): ModCallEntry;
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
1
2
|
import { ENGINE_ORIGIN } from "./kernel/index.js";
|
|
2
3
|
import { isPlainRecord } from "./kernel/receive.js";
|
|
3
4
|
import { NEXT_IN_FLIGHT } from "./kernel/site-rules.js";
|
|
4
5
|
import { describeThrown } from "../tool-policy.js";
|
|
5
6
|
import { extensionWords } from "../untrusted-egress.js";
|
|
6
|
-
import {
|
|
7
|
+
import { declaredDelegationNameOf } from "../delegation-name.js";
|
|
8
|
+
import { failedHandlerClause, seatHears } from "./stations.js";
|
|
9
|
+
import { agentIdOf } from "../leg-identity.js";
|
|
10
|
+
import { extensionCallOf, noteExtensionCallLaunched, runExtensionCall } from "./extension-call.js";
|
|
11
|
+
import { resultText } from "./tool-call.js";
|
|
7
12
|
const ENGINE_PROVIDER = Object.freeze({ plugin: ENGINE_ORIGIN.plugin, tier: ENGINE_ORIGIN.tier });
|
|
8
13
|
const OFFERED = Object.freeze({ isOffered: true });
|
|
9
14
|
function offerAnswer(answer) {
|
|
@@ -11,14 +16,14 @@ function offerAnswer(answer) {
|
|
|
11
16
|
return "agent.offer takes next(e) or { isOffered: <boolean> }";
|
|
12
17
|
return undefined;
|
|
13
18
|
}
|
|
14
|
-
export async function offeredAgents(
|
|
15
|
-
if (
|
|
19
|
+
export async function offeredAgents(seat, agents, signal) {
|
|
20
|
+
if (agents.length === 0 || !seatHears(seat, "agent.offer"))
|
|
16
21
|
return agents;
|
|
17
22
|
const out = [];
|
|
18
23
|
for (const a of agents) {
|
|
19
24
|
let outcome;
|
|
20
25
|
try {
|
|
21
|
-
outcome = await bus.dispatch("agent.offer", { agent: a.name, description: a.description, provider: ENGINE_PROVIDER }, { bottom: () => OFFERED, checkAnswer: offerAnswer, ...(signal !== undefined ? { signal } : {}) });
|
|
26
|
+
outcome = await seat.bus.dispatch("agent.offer", { agent: a.name, description: a.description, provider: ENGINE_PROVIDER }, { bottom: () => OFFERED, checkAnswer: offerAnswer, ...(signal !== undefined ? { signal } : {}) });
|
|
22
27
|
}
|
|
23
28
|
catch {
|
|
24
29
|
out.push(a);
|
|
@@ -30,22 +35,31 @@ export async function offeredAgents(bus, agents, signal) {
|
|
|
30
35
|
}
|
|
31
36
|
return out;
|
|
32
37
|
}
|
|
33
|
-
export async function offeredAgentListing(
|
|
38
|
+
export async function offeredAgentListing(seat, listing, signal) {
|
|
34
39
|
if (listing === undefined)
|
|
35
40
|
return undefined;
|
|
36
|
-
const entries = await offeredAgents(
|
|
41
|
+
const entries = await offeredAgents(seat, listing.entries, signal);
|
|
37
42
|
return entries === listing.entries || entries.length === listing.entries.length ? listing : { ...listing, entries };
|
|
38
43
|
}
|
|
44
|
+
export function spawnedModel(model) {
|
|
45
|
+
return model ?? "inherit";
|
|
46
|
+
}
|
|
39
47
|
const GO = Object.freeze({ go: true });
|
|
40
48
|
const FORM = "agent.spawn takes next(e) or { deny: <reason> } (every member is pinned: a spawn is refused, never rewritten)";
|
|
41
49
|
const denyOf = (a) => isPlainRecord(a) && Object.keys(a).length === 1 && typeof a["deny"] === "string" && a["deny"] !== "" ? a["deny"] : undefined;
|
|
42
50
|
const RANKS = Object.freeze({ of: (a) => (denyOf(a) !== undefined ? 1 : 0), top: 1 });
|
|
43
51
|
export function createAgentStations(input) {
|
|
44
52
|
return {
|
|
45
|
-
listens: (event) => input
|
|
46
|
-
offered: (agents, signal) => offeredAgents(input
|
|
53
|
+
listens: (event) => seatHears(input, event),
|
|
54
|
+
offered: (agents, signal) => offeredAgents(input, agents, signal),
|
|
55
|
+
extensionSpawn: (toolCallId) => {
|
|
56
|
+
const call = toolCallId !== undefined ? extensionCallOf(input.bus, toolCallId) : undefined;
|
|
57
|
+
if (call === undefined || call.door !== "agent.spawn" || toolCallId === undefined)
|
|
58
|
+
return undefined;
|
|
59
|
+
return { by: call.caller.origin.plugin, launched: (agentId, model) => noteExtensionCallLaunched(input.bus, toolCallId, { agentId, model: spawnedModel(model) }) };
|
|
60
|
+
},
|
|
47
61
|
spawn: async (facts, signal) => {
|
|
48
|
-
if (!input
|
|
62
|
+
if (!seatHears(input, "agent.spawn"))
|
|
49
63
|
return GO;
|
|
50
64
|
const parentAgentId = agentIdOf(input.identity);
|
|
51
65
|
const permissionMode = input.permissionMode();
|
|
@@ -67,7 +81,7 @@ export function createAgentStations(input) {
|
|
|
67
81
|
...(facts.cwd !== undefined ? { cwd: facts.cwd } : {}),
|
|
68
82
|
...(facts.workflow === true ? { workflow: true } : {}),
|
|
69
83
|
};
|
|
70
|
-
const started = Object.freeze({ model: facts.model
|
|
84
|
+
const started = Object.freeze({ model: spawnedModel(facts.model) });
|
|
71
85
|
const checkAnswer = (a, _e, _by, below, ran) => {
|
|
72
86
|
if (a === started)
|
|
73
87
|
return undefined;
|
|
@@ -103,3 +117,38 @@ export function createAgentStations(input) {
|
|
|
103
117
|
},
|
|
104
118
|
};
|
|
105
119
|
}
|
|
120
|
+
const DESCRIPTION_WORDS = 5;
|
|
121
|
+
function delegationInput(args, prompt) {
|
|
122
|
+
return {
|
|
123
|
+
prompt,
|
|
124
|
+
description: args["description"] ?? prompt.split(/\s+/).slice(0, DESCRIPTION_WORDS).join(" "),
|
|
125
|
+
run_in_background: true,
|
|
126
|
+
...(args["model"] !== undefined ? { model: args["model"] } : {}),
|
|
127
|
+
...(args["subagentType"] !== undefined ? { subagent_type: args["subagentType"] } : {}),
|
|
128
|
+
...(args["name"] !== undefined ? { name: args["name"] } : {}),
|
|
129
|
+
...(args["cwd"] !== undefined ? { cwd: args["cwd"] } : {}),
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
export function createAgentSpawnEntry(input) {
|
|
133
|
+
return async (args, ctx) => {
|
|
134
|
+
const by = ctx.origin.plugin;
|
|
135
|
+
const prompt = args["prompt"];
|
|
136
|
+
if (typeof prompt !== "string" || prompt.trim() === "")
|
|
137
|
+
throw new TypeError(`${by}: $.agent.spawn takes { prompt, ... } (a non-empty prompt)`);
|
|
138
|
+
const tools = input.mounted().filter((name) => declaredDelegationNameOf(input.specOf(name)) !== undefined);
|
|
139
|
+
const tool = tools[0];
|
|
140
|
+
if (tool === undefined)
|
|
141
|
+
throw new TypeError(`${by}: $.agent.spawn: this run mounts no delegation tool`);
|
|
142
|
+
if (tools.length > 1)
|
|
143
|
+
throw new TypeError(`${by}: $.agent.spawn: this run mounts ${tools.length} delegation tools (${tools.map((n) => `"${extensionWords(n, 80)}"`).join(", ")}) and a spawn names none of them`);
|
|
144
|
+
const toolCallId = `ext-${randomUUID()}`;
|
|
145
|
+
return runExtensionCall(input.bus, toolCallId, "agent.spawn", ctx, async (call) => {
|
|
146
|
+
const finalized = await input.harness.callTool({ type: "toolCall", id: toolCallId, name: tool, arguments: delegationInput(args, prompt) }, ctx.signal, () => undefined);
|
|
147
|
+
if (call.launched !== undefined)
|
|
148
|
+
return Object.freeze({ model: call.launched.model, agentId: call.launched.agentId });
|
|
149
|
+
if (call.denied || finalized.isError)
|
|
150
|
+
return Object.freeze({ deny: resultText(finalized.result.content) || "no subagent was started" });
|
|
151
|
+
return Object.freeze({ model: spawnedModel(typeof args["model"] === "string" ? args["model"] : undefined) });
|
|
152
|
+
});
|
|
153
|
+
};
|
|
154
|
+
}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { ExecutionEnv } from "../../internal/harness-types.js";
|
|
7
7
|
import type { Context, Message, Usage } from "../../internal/llm.js";
|
|
8
|
+
import type { CompactOutcome } from "../task-event.js";
|
|
8
9
|
import type { ModDollarBase, ModMethodBottoms } from "./kernel/index.js";
|
|
9
10
|
/** `$.process.run`'s default command timeout (CC). */
|
|
10
11
|
export declare const PROCESS_RUN_DEFAULT_TIMEOUT_MS = 30000;
|
|
@@ -91,6 +92,29 @@ export interface EngineDollar extends ModDollarBase {
|
|
|
91
92
|
root(): Promise<string>;
|
|
92
93
|
model(): Promise<string>;
|
|
93
94
|
messages(): Promise<readonly Message[]>;
|
|
95
|
+
/** `$.session.append({ message: { role: "user", content }, agentId? })`: an extension's own note, admitted at the
|
|
96
|
+
* `session.append` station (`session-append.ts`). */
|
|
97
|
+
append(args: {
|
|
98
|
+
readonly message: {
|
|
99
|
+
readonly role: "user";
|
|
100
|
+
readonly content: string | readonly {
|
|
101
|
+
readonly type: "text";
|
|
102
|
+
readonly text: string;
|
|
103
|
+
}[];
|
|
104
|
+
};
|
|
105
|
+
readonly agentId?: string;
|
|
106
|
+
}): Promise<SessionAppendAnswer>;
|
|
107
|
+
/** `$.session.send({ to, text })`: the leg's SendMessage, run as the caller's own call and raised once at the
|
|
108
|
+
* `session.send` station (`session-send.ts`). */
|
|
109
|
+
send(args: {
|
|
110
|
+
readonly to: string;
|
|
111
|
+
readonly text: string;
|
|
112
|
+
}): Promise<SessionSendAnswer>;
|
|
113
|
+
/** `$.session.compact({ instructions? })`: a manual compaction pass at the turn boundary, in place — from a handler of
|
|
114
|
+
* `turn.complete` only (`session-compact.ts`). */
|
|
115
|
+
compact(args?: {
|
|
116
|
+
readonly instructions?: string;
|
|
117
|
+
}): Promise<SessionCompactAnswer>;
|
|
94
118
|
};
|
|
95
119
|
readonly clock: {
|
|
96
120
|
now(): Promise<number>;
|
|
@@ -107,8 +131,26 @@ export interface EngineDollar extends ModDollarBase {
|
|
|
107
131
|
};
|
|
108
132
|
readonly agent: {
|
|
109
133
|
list(): Promise<readonly string[]>;
|
|
134
|
+
/** `$.agent.spawn({ prompt, ... })`: the delegation tool's own pipeline as the caller's call, the subagent in the background
|
|
135
|
+
* (`createAgentSpawnEntry`, `agent-stations.ts`). */
|
|
136
|
+
spawn(args: {
|
|
137
|
+
readonly prompt: string;
|
|
138
|
+
readonly description?: string;
|
|
139
|
+
readonly subagentType?: string;
|
|
140
|
+
readonly model?: string;
|
|
141
|
+
readonly name?: string;
|
|
142
|
+
readonly cwd?: string;
|
|
143
|
+
}): Promise<AgentSpawnAnswer>;
|
|
110
144
|
};
|
|
111
145
|
}
|
|
146
|
+
/** What `$.agent.spawn` answers: the subagent started (`agentId`, the id its events carry; `model`, as `agent.spawn`'s bottom
|
|
147
|
+
* names it), none started because an extension answered the call in place of its body (`model` alone), or the refusal. */
|
|
148
|
+
export type AgentSpawnAnswer = {
|
|
149
|
+
readonly model: string;
|
|
150
|
+
readonly agentId?: string;
|
|
151
|
+
} | {
|
|
152
|
+
readonly deny: string;
|
|
153
|
+
};
|
|
112
154
|
/** What `$.tool.call` answers — `tool.call`'s own forms: the frozen view of the call's result, or the refusal (returned, not thrown). */
|
|
113
155
|
export type ToolCallAnswer = {
|
|
114
156
|
readonly result: {
|
|
@@ -118,5 +160,25 @@ export type ToolCallAnswer = {
|
|
|
118
160
|
} | {
|
|
119
161
|
readonly deny: string;
|
|
120
162
|
};
|
|
163
|
+
/** What `$.session.append` answers — `session.append`'s own forms: the note as kept (a frozen view), or the refusal (returned, not thrown). */
|
|
164
|
+
export type SessionAppendAnswer = {
|
|
165
|
+
readonly message: {
|
|
166
|
+
readonly role: "user";
|
|
167
|
+
readonly content: string | readonly object[];
|
|
168
|
+
};
|
|
169
|
+
} | {
|
|
170
|
+
readonly deny: string;
|
|
171
|
+
};
|
|
172
|
+
/** What `$.session.send` answers — `session.send`'s own forms: delivered, or not and why (returned, not thrown). */
|
|
173
|
+
export type SessionSendAnswer = {
|
|
174
|
+
readonly isDelivered: true;
|
|
175
|
+
} | {
|
|
176
|
+
readonly isDelivered: false;
|
|
177
|
+
readonly reason: string;
|
|
178
|
+
};
|
|
179
|
+
/** What `$.session.compact` answers: the in-place pass's outcome (a call it refuses throws, its reason on the report sink too). */
|
|
180
|
+
export interface SessionCompactAnswer {
|
|
181
|
+
readonly outcome: CompactOutcome;
|
|
182
|
+
}
|
|
121
183
|
/** The chain bottoms of the wave-one method events over a runner's seat view. */
|
|
122
184
|
export declare function engineMethodBottoms(view: ModSeatView): ModMethodBottoms;
|