@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
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { renderTaskNotificationXml } from "../task-notification.js";
|
|
2
|
+
import { describeThrown } from "../tool-policy.js";
|
|
3
|
+
import { extensionWords } from "../untrusted-egress.js";
|
|
4
|
+
import { ENGINE_ORIGIN } from "./kernel/index.js";
|
|
5
|
+
import { isPlainRecord } from "./kernel/receive.js";
|
|
6
|
+
import { classicEventBase, failedHandlerClause, seatHears } from "./stations.js";
|
|
7
|
+
export const SESSION_RECEIVE_ORIGIN_KINDS = Object.freeze(["task", "agent", "peer", "host", "engine"]);
|
|
8
|
+
const ENGINE = Object.freeze({ kind: "engine" });
|
|
9
|
+
export function receiveOriginOf(p) {
|
|
10
|
+
if (p.agentMessage !== undefined)
|
|
11
|
+
return Object.freeze({ kind: "agent", from: p.agentMessage.from });
|
|
12
|
+
if (p.crossSessionMessage !== undefined)
|
|
13
|
+
return Object.freeze({ kind: "peer", from: p.crossSessionMessage.from });
|
|
14
|
+
if (p.crossSessionNotice !== undefined || p.inboxNotice !== undefined)
|
|
15
|
+
return ENGINE;
|
|
16
|
+
if (p.task_type === "external")
|
|
17
|
+
return Object.freeze({ kind: "host", ...(p.source !== undefined ? { from: p.source } : {}) });
|
|
18
|
+
return Object.freeze({ kind: "task", taskType: p.task_type });
|
|
19
|
+
}
|
|
20
|
+
function eventOf(p) {
|
|
21
|
+
return Object.freeze({ taskId: p.task_id, taskType: p.task_type, status: p.status, ...(p.seq !== undefined ? { seq: p.seq } : {}) });
|
|
22
|
+
}
|
|
23
|
+
const FORM = "session.receive takes { text } (a non-blank string) or { consumed: <reason> }";
|
|
24
|
+
function readAnswer(a) {
|
|
25
|
+
if (!isPlainRecord(a))
|
|
26
|
+
return { why: FORM };
|
|
27
|
+
const keys = Object.keys(a);
|
|
28
|
+
if (keys.length === 1 && keys[0] === "consumed") {
|
|
29
|
+
const r = a["consumed"];
|
|
30
|
+
return typeof r === "string" && r.trim() !== "" ? { consumed: r } : { why: "a consumed that is not a reason (a non-empty string)" };
|
|
31
|
+
}
|
|
32
|
+
if (keys.length === 1 && keys[0] === "text") {
|
|
33
|
+
const t = a["text"];
|
|
34
|
+
return typeof t === "string" && t.trim() !== "" ? { text: t } : { why: "a text that is not a non-blank string (consume the frame instead)" };
|
|
35
|
+
}
|
|
36
|
+
return { why: FORM };
|
|
37
|
+
}
|
|
38
|
+
const RANKS = Object.freeze({ of: (a) => (isPlainRecord(a) && Object.hasOwn(a, "consumed") ? 1 : 0), top: 1 });
|
|
39
|
+
export function createReceiveSeat() {
|
|
40
|
+
let bound;
|
|
41
|
+
const consumed = (binding, frame, by, reason) => {
|
|
42
|
+
const verdict = Object.freeze({ kind: "consumed", by, reason });
|
|
43
|
+
binding.report(consumedFrameReport(frame, verdict));
|
|
44
|
+
return verdict;
|
|
45
|
+
};
|
|
46
|
+
const receiveBound = async (binding, payload) => {
|
|
47
|
+
const made = payload.received === undefined ? payload : (({ received: _r, ...rest }) => rest)(payload);
|
|
48
|
+
const text = renderTaskNotificationXml(made);
|
|
49
|
+
const e = { ...classicEventBase(binding.identity), origin: receiveOriginOf(made), event: eventOf(made), text };
|
|
50
|
+
const handOns = [];
|
|
51
|
+
const checkHandOn = (handed, by) => {
|
|
52
|
+
const t = handed["text"];
|
|
53
|
+
if (typeof t !== "string" || t.trim() === "")
|
|
54
|
+
return "next() handed on a text that is not a non-blank string";
|
|
55
|
+
handOns.push({ by: by.plugin, text: t });
|
|
56
|
+
return undefined;
|
|
57
|
+
};
|
|
58
|
+
const bottom = (handed) => Object.freeze({ text: handed["text"] });
|
|
59
|
+
const checkAnswer = (a) => {
|
|
60
|
+
const read = readAnswer(a);
|
|
61
|
+
return "why" in read ? read.why : undefined;
|
|
62
|
+
};
|
|
63
|
+
let outcome;
|
|
64
|
+
try {
|
|
65
|
+
outcome = await binding.bus.dispatch("session.receive", e, { bottom, checkAnswer, checkHandOn, ranks: RANKS, ...(binding.signal !== undefined ? { signal: binding.signal } : {}) });
|
|
66
|
+
}
|
|
67
|
+
catch (err) {
|
|
68
|
+
return consumed(binding, made, ENGINE_ORIGIN.plugin, `the session.receive station could not be raised (${describeThrown(err)}); the frame was not handed over (fail-closed)`);
|
|
69
|
+
}
|
|
70
|
+
if (outcome.kind === "aborted")
|
|
71
|
+
return Object.freeze({ kind: "arrived", payload: made });
|
|
72
|
+
if (outcome.kind === "failed")
|
|
73
|
+
return consumed(binding, made, outcome.registration, `a session.receive extension ${failedHandlerClause(outcome)}; the frame was not handed over (fail-closed)`);
|
|
74
|
+
const read = readAnswer(outcome.answer);
|
|
75
|
+
const by = outcome.answeredBy ?? ENGINE_ORIGIN.plugin;
|
|
76
|
+
if ("consumed" in read)
|
|
77
|
+
return consumed(binding, made, by, read.consumed);
|
|
78
|
+
if ("why" in read)
|
|
79
|
+
return consumed(binding, made, by, `extension "${extensionWords(by, 80)}" answered in a form session.receive does not take (${read.why}); the frame was not handed over (fail-closed)`);
|
|
80
|
+
if (read.text === text)
|
|
81
|
+
return Object.freeze({ kind: "arrived", payload: made });
|
|
82
|
+
const rewrittenBy = [];
|
|
83
|
+
let before = text;
|
|
84
|
+
for (const h of handOns) {
|
|
85
|
+
if (h.text !== before && !rewrittenBy.includes(h.by))
|
|
86
|
+
rewrittenBy.push(h.by);
|
|
87
|
+
before = h.text;
|
|
88
|
+
}
|
|
89
|
+
if (read.text !== before && !rewrittenBy.includes(by))
|
|
90
|
+
rewrittenBy.push(by);
|
|
91
|
+
return Object.freeze({ kind: "arrived", payload: { ...made, received: Object.freeze({ text: read.text, rewrittenBy: Object.freeze(rewrittenBy) }) } });
|
|
92
|
+
};
|
|
93
|
+
return {
|
|
94
|
+
listens: () => seatHears(bound, "session.receive"),
|
|
95
|
+
receive: async (payload) => {
|
|
96
|
+
const binding = bound;
|
|
97
|
+
if (!seatHears(binding, "session.receive"))
|
|
98
|
+
return Object.freeze({ kind: "arrived", payload });
|
|
99
|
+
try {
|
|
100
|
+
return await receiveBound(binding, payload);
|
|
101
|
+
}
|
|
102
|
+
catch (err) {
|
|
103
|
+
return consumed(binding, payload, ENGINE_ORIGIN.plugin, `the session.receive station could not judge the frame (${describeThrown(err)}); it was not handed over (fail-closed)`);
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
bind: (binding) => {
|
|
107
|
+
bound = binding;
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
export function createReceivingChain(seatOf) {
|
|
112
|
+
let tail;
|
|
113
|
+
return {
|
|
114
|
+
pass: (payload, arms) => {
|
|
115
|
+
const seat = seatOf();
|
|
116
|
+
if (!seat.listens())
|
|
117
|
+
return arms.handOver(payload);
|
|
118
|
+
tail = (tail ?? Promise.resolve())
|
|
119
|
+
.then(async () => {
|
|
120
|
+
const verdict = await seat.receive(payload);
|
|
121
|
+
if (verdict.kind === "arrived")
|
|
122
|
+
arms.handOver(verdict.payload);
|
|
123
|
+
else
|
|
124
|
+
arms.consumed?.(verdict);
|
|
125
|
+
})
|
|
126
|
+
.catch((err) => {
|
|
127
|
+
try {
|
|
128
|
+
arms.fault(err);
|
|
129
|
+
}
|
|
130
|
+
catch {
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
},
|
|
134
|
+
get settled() {
|
|
135
|
+
return tail;
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
export function consumedFrameReport(payload, verdict) {
|
|
140
|
+
return new Error(`session.receive: the ${payload.task_type} frame for ${extensionWords(payload.task_id, 80)} (${payload.status}) was not handed to the model — consumed by ${verdict.by === ENGINE_ORIGIN.plugin ? "the engine" : `extension "${extensionWords(verdict.by, 80)}"`}: ${extensionWords(verdict.reason, 300)}`);
|
|
141
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `session.send` station, and `$.session.send`'s host entry.
|
|
3
|
+
*
|
|
4
|
+
* THE RULE. A message the leg sends goes out through SendMessage, and SendMessage raises `session.send` once per message,
|
|
5
|
+
* after its own pre-delivery refusals (an empty address or message, a broadcast, a qualified name, an observer on either
|
|
6
|
+
* end) and before any delivery arm resolves the address — the peer-session arm, the `main` uplink and the agent ladder each
|
|
7
|
+
* resolve it their own way, so the one point before all of them is the point every message passes. A pure idle subscription
|
|
8
|
+
* (no message) raises nothing. With no handler on the event nothing is raised and the send goes on.
|
|
9
|
+
*
|
|
10
|
+
* `e = { origin, to, text, agentId? }` plus the identity envelope; every member is pinned — the address and the text are
|
|
11
|
+
* what the gate judged, so they are what goes (the reference lets a handler rewrite both: `Bu` (cli309.js:255554)).
|
|
12
|
+
* `origin` is `{ kind: "model" }`, or `{ kind: "plugin", name }` for an extension's own `$.session.send`.
|
|
13
|
+
*
|
|
14
|
+
* A handler answers:
|
|
15
|
+
* - `next(e)` — the send goes on: what comes up is the go-ahead (`{ to, text }`), and the answer is that go-ahead;
|
|
16
|
+
* - `{ isDelivered: false, reason }` — only in place of `next`: the message is not sent, and the call says so naming the
|
|
17
|
+
* extension. `{ isDelivered: true }` — a handler claiming it delivered the message itself — is a violation: the engine is
|
|
18
|
+
* the one that delivers (the reference takes it: `qa` (cli309.js:288155)).
|
|
19
|
+
* A failure refuses while the go-ahead has not been given, and once it has the send goes on (the table's column): the
|
|
20
|
+
* station is a go-ahead station, as `agent.spawn` is.
|
|
21
|
+
*
|
|
22
|
+
* `$.session.send({ to, text })` is the event called ({@link createSessionSendEntry}): the leg's SendMessage pipeline — the
|
|
23
|
+
* same entry `$.tool.call` runs, its gate and its stations — run as the caller's call, which raises `session.send` here
|
|
24
|
+
* under the caller's frames. It answers `{ isDelivered: true }` when SendMessage reports the message sent, else
|
|
25
|
+
* `{ isDelivered: false, reason }` (returned, not thrown); a session with no SendMessage mounted answers the latter at once.
|
|
26
|
+
*/
|
|
27
|
+
import type { HookInvocationIdentity } from "../hooks.js";
|
|
28
|
+
import { type ModCallEntry } from "./kernel/index.js";
|
|
29
|
+
import { type LegModBus } from "./stations.js";
|
|
30
|
+
/** Who sends a message: the model (its SendMessage call), or an extension's own `$.session.send`. */
|
|
31
|
+
export declare const SESSION_SEND_ORIGIN_KINDS: readonly ["model", "plugin"];
|
|
32
|
+
export type SessionSendOrigin = {
|
|
33
|
+
readonly kind: "model";
|
|
34
|
+
} | {
|
|
35
|
+
readonly kind: "plugin";
|
|
36
|
+
readonly name: string;
|
|
37
|
+
};
|
|
38
|
+
/** What the station answers SendMessage: go on, or the refusal and who gave it. */
|
|
39
|
+
export type SendVerdict = {
|
|
40
|
+
readonly go: true;
|
|
41
|
+
} | {
|
|
42
|
+
readonly go: false;
|
|
43
|
+
readonly by: string;
|
|
44
|
+
readonly reason: string;
|
|
45
|
+
};
|
|
46
|
+
/** The leg's `session.send` station, as SendMessage reads it (a Runner-filled seat, never a model argument). */
|
|
47
|
+
export interface SendStation {
|
|
48
|
+
/** Whether a handler hangs on `session.send` (none ⇒ SendMessage raises nothing and awaits nothing). */
|
|
49
|
+
listens(): boolean;
|
|
50
|
+
/** Raise `session.send` for one message (no handler ⇒ nothing raised: the send goes on). */
|
|
51
|
+
send(facts: {
|
|
52
|
+
readonly to: string;
|
|
53
|
+
readonly text: string;
|
|
54
|
+
readonly toolCallId: string;
|
|
55
|
+
}, signal: AbortSignal | undefined): Promise<SendVerdict>;
|
|
56
|
+
}
|
|
57
|
+
export interface SendStationInput {
|
|
58
|
+
readonly bus: LegModBus;
|
|
59
|
+
/** The sending leg's identity (its `agentId`). */
|
|
60
|
+
readonly identity: HookInvocationIdentity | undefined;
|
|
61
|
+
}
|
|
62
|
+
/** The leg's `session.send` station over its bus. */
|
|
63
|
+
export declare function createSessionSendStation(input: SendStationInput): SendStation;
|
|
64
|
+
/** What the host entry reaches: the leg's `$.tool.call` entry (its one pipeline for a call of a mounted tool), the name the
|
|
65
|
+
* leg's SendMessage is mounted under, and the leg's mounted tools. */
|
|
66
|
+
export interface SessionSendEntryInput {
|
|
67
|
+
readonly toolCall: ModCallEntry;
|
|
68
|
+
readonly sendToolName: string;
|
|
69
|
+
readonly tools: () => readonly string[];
|
|
70
|
+
}
|
|
71
|
+
/** `$.session.send`'s host entry: the leg's SendMessage, run as the caller's call (the module header). */
|
|
72
|
+
export declare function createSessionSendEntry(input: SessionSendEntryInput): ModCallEntry;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { describeThrown } from "../tool-policy.js";
|
|
2
|
+
import { extensionWords } from "../untrusted-egress.js";
|
|
3
|
+
import { extensionCallOf } from "./extension-call.js";
|
|
4
|
+
import { ENGINE_ORIGIN } from "./kernel/index.js";
|
|
5
|
+
import { isPlainRecord } from "./kernel/receive.js";
|
|
6
|
+
import { NEXT_IN_FLIGHT } from "./kernel/site-rules.js";
|
|
7
|
+
import { classicEventBase, failedHandlerClause, seatHears } from "./stations.js";
|
|
8
|
+
export const SESSION_SEND_ORIGIN_KINDS = Object.freeze(["model", "plugin"]);
|
|
9
|
+
const GO = Object.freeze({ go: true });
|
|
10
|
+
const FORM = "session.send takes next(e) or { isDelivered: false, reason } in place of it";
|
|
11
|
+
function refusalOf(a) {
|
|
12
|
+
if (!isPlainRecord(a) || a["isDelivered"] !== false || Object.keys(a).some((k) => k !== "isDelivered" && k !== "reason"))
|
|
13
|
+
return undefined;
|
|
14
|
+
const r = a["reason"];
|
|
15
|
+
return typeof r === "string" && r.trim() !== "" ? r : undefined;
|
|
16
|
+
}
|
|
17
|
+
const RANKS = Object.freeze({ of: (a) => (refusalOf(a) !== undefined ? 1 : 0), top: 1 });
|
|
18
|
+
export function createSessionSendStation(input) {
|
|
19
|
+
return {
|
|
20
|
+
listens: () => seatHears(input, "session.send"),
|
|
21
|
+
send: async (facts, signal) => {
|
|
22
|
+
if (!seatHears(input, "session.send"))
|
|
23
|
+
return GO;
|
|
24
|
+
const call = extensionCallOf(input.bus, facts.toolCallId);
|
|
25
|
+
const origin = call !== undefined ? Object.freeze({ kind: "plugin", name: call.caller.origin.plugin }) : Object.freeze({ kind: "model" });
|
|
26
|
+
const e = { ...classicEventBase(input.identity), origin, to: facts.to, text: facts.text };
|
|
27
|
+
const started = Object.freeze({ to: facts.to, text: facts.text });
|
|
28
|
+
const checkAnswer = (a, _e, _by, below, ran) => {
|
|
29
|
+
if (a === started)
|
|
30
|
+
return undefined;
|
|
31
|
+
if (isPlainRecord(a) && a["isDelivered"] === true)
|
|
32
|
+
return "a delivery claimed by a handler (isDelivered: true) — the engine delivers the message; next(e) lets it go";
|
|
33
|
+
if (refusalOf(a) === undefined)
|
|
34
|
+
return FORM;
|
|
35
|
+
if (ran.bottomStarted)
|
|
36
|
+
return "a refusal after the message was let go (refuse in place of next)";
|
|
37
|
+
if (below.includes(NEXT_IN_FLIGHT) || below.some((b) => refusalOf(b) === undefined))
|
|
38
|
+
return "a refusal while its next(e) still runs or after it was answered (refuse in place of next)";
|
|
39
|
+
return undefined;
|
|
40
|
+
};
|
|
41
|
+
let outcome;
|
|
42
|
+
try {
|
|
43
|
+
outcome = await input.bus.dispatch("session.send", e, { bottom: () => started, checkAnswer, ranks: RANKS, ...(signal !== undefined ? { signal } : {}) });
|
|
44
|
+
}
|
|
45
|
+
catch (err) {
|
|
46
|
+
return { go: false, by: ENGINE_ORIGIN.plugin, reason: `the session.send station could not be raised (${describeThrown(err)}); the message was not sent (fail-closed)` };
|
|
47
|
+
}
|
|
48
|
+
if (outcome.kind === "aborted")
|
|
49
|
+
return outcome.bottomStarted === true ? GO : { go: false, by: ENGINE_ORIGIN.plugin, reason: "the send was cancelled before the message went" };
|
|
50
|
+
if (outcome.kind === "failed")
|
|
51
|
+
return { go: false, by: outcome.registration, reason: `a session.send extension ${failedHandlerClause(outcome)} before the message went; it was not sent (fail-closed)` };
|
|
52
|
+
if (outcome.answer === started)
|
|
53
|
+
return GO;
|
|
54
|
+
const by = outcome.answeredBy ?? ENGINE_ORIGIN.plugin;
|
|
55
|
+
const reason = refusalOf(outcome.answer);
|
|
56
|
+
return {
|
|
57
|
+
go: false,
|
|
58
|
+
by,
|
|
59
|
+
reason: reason !== undefined ? `extension "${extensionWords(by, 80)}" refused this message before it went: ${extensionWords(reason, 300)}` : `extension "${extensionWords(by, 80)}" answered this message in a form session.send does not take; it was not sent (fail-closed)`,
|
|
60
|
+
};
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
const textOf = (content) => (Array.isArray(content) ? content.map((b) => (isPlainRecord(b) && b["type"] === "text" && typeof b["text"] === "string" ? b["text"] : "")).join("") : "");
|
|
65
|
+
export function createSessionSendEntry(input) {
|
|
66
|
+
return async (args, ctx) => {
|
|
67
|
+
const by = ctx.origin.plugin;
|
|
68
|
+
const refuse = (why) => new TypeError(`${by}: $.session.send: refused: ${why}`);
|
|
69
|
+
const extra = Object.keys(args).find((k) => k !== "to" && k !== "text");
|
|
70
|
+
if (extra !== undefined)
|
|
71
|
+
throw refuse(`takes { to, text }; "${extensionWords(extra, 40)}" is not one`);
|
|
72
|
+
const to = args["to"];
|
|
73
|
+
const text = args["text"];
|
|
74
|
+
if (typeof to !== "string" || to.trim() === "")
|
|
75
|
+
throw refuse("no { to } (a non-empty string)");
|
|
76
|
+
if (typeof text !== "string" || text.trim() === "")
|
|
77
|
+
throw refuse("no { text } (a non-empty string)");
|
|
78
|
+
if (!input.tools().includes(input.sendToolName))
|
|
79
|
+
return Object.freeze({ isDelivered: false, reason: "this session has no SendMessage tool (messaging between sessions and agents is not on here)" });
|
|
80
|
+
const answer = await input.toolCall({ tool: input.sendToolName, to, message: text }, ctx);
|
|
81
|
+
if (isPlainRecord(answer) && typeof answer["deny"] === "string")
|
|
82
|
+
return Object.freeze({ isDelivered: false, reason: answer["deny"] });
|
|
83
|
+
const result = isPlainRecord(answer) && isPlainRecord(answer["result"]) ? answer["result"] : undefined;
|
|
84
|
+
if (result === undefined)
|
|
85
|
+
return Object.freeze({ isDelivered: false, reason: "SendMessage did not answer" });
|
|
86
|
+
return result["isError"] === true ? Object.freeze({ isDelivered: false, reason: textOf(result["content"]) || "the message was not sent" }) : Object.freeze({ isDelivered: true });
|
|
87
|
+
};
|
|
88
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ExecutionEnv } from "../../internal/harness-types.js";
|
|
1
|
+
import type { ExecutionEnv, ReadFloor } from "../../internal/harness-types.js";
|
|
2
2
|
import type { AssistantMessage, Message, Model, Usage } from "../../internal/llm.js";
|
|
3
3
|
import type { CwdRef } from "../../tools/fs/fs-shared.js";
|
|
4
4
|
import { type PermissionResult, type ToolCallRequest } from "../tool-policy.js";
|
|
@@ -7,7 +7,7 @@ import type { ClassicEventMap, ClassicEventName } from "./classic-events.js";
|
|
|
7
7
|
import type { PermissionMode } from "../ask-origin.js";
|
|
8
8
|
import type { RunnerDeps } from "../runner-deps.js";
|
|
9
9
|
import type { TaskSpec } from "../task-spec.js";
|
|
10
|
-
import { type ModAnswerCheck, type ModAnswerRanks, type ModBus, type ModCallEntry, type ModMountedHandler, type ModDispatchOutcome, type ModEventPayload, type ModRegistration } from "./kernel/index.js";
|
|
10
|
+
import { type ModAnswerCheck, type ModAnswerRanks, type ModBus, type ModCallEntry, type ModEventName, type ModMountedHandler, type ModDispatchOutcome, type ModEventPayload, type ModRegistration } from "./kernel/index.js";
|
|
11
11
|
import { type SourcedOverlay } from "../../prompt-assembly/overlay.js";
|
|
12
12
|
import type { BandId } from "../../prompt-assembly/catalog/schema.js";
|
|
13
13
|
import type { ModParticipant } from "./kernel/dispatch.js";
|
|
@@ -24,28 +24,30 @@ export declare const ENGINE_CORE_ANSWER: Readonly<Record<string, never>>;
|
|
|
24
24
|
export declare function engineCore(): Readonly<Record<string, never>>;
|
|
25
25
|
/** The leg's bus seat, as the stations read it. */
|
|
26
26
|
export type LegModBus = Pick<ModBus, "hasHandlers" | "dispatch">;
|
|
27
|
-
/**
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
/** Does a seat raise `event` — bound, and a handler hangs on it? Every station entry reads this first, synchronously. */
|
|
28
|
+
export declare function seatHears<B extends {
|
|
29
|
+
readonly bus: Pick<ModBus, "hasHandlers">;
|
|
30
|
+
}>(binding: B | undefined, event: ModEventName): binding is B;
|
|
31
|
+
/** The `detail` member of a notice a leg raises about itself: the leg's own task id, read from its prepare's one mint ({@link legTaskIdOf}), never from the host's declaration. */
|
|
32
|
+
export declare function legNoticeTaskId(leg: {
|
|
33
|
+
readonly taskId: string;
|
|
34
|
+
}): {
|
|
35
|
+
readonly taskId: string;
|
|
36
|
+
};
|
|
32
37
|
export interface LegEvents {
|
|
33
|
-
/** The person's-prompt screen its objective passes — present when a person wrote the objective. */
|
|
34
|
-
readonly screen?: "classic.UserPromptSubmit";
|
|
35
38
|
/** The event it opens on — present on a delegated leg. */
|
|
36
39
|
readonly start?: "classic.SubagentStart";
|
|
37
40
|
/** The event it raises when it would otherwise end. */
|
|
38
41
|
readonly stop: "classic.Stop" | "classic.SubagentStop";
|
|
39
42
|
}
|
|
40
43
|
/**
|
|
41
|
-
* Both ends of a leg
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* `classic.
|
|
46
|
-
* peer) and is judged at the delegator's gate. Not the leg kind: a resumed leg's kind reads `"resume"` whoever it runs as.
|
|
44
|
+
* Both ends of a leg, from the delegation fact alone (a child resumed from its checkpoint keeps it): a delegated leg opens on
|
|
45
|
+
* `classic.SubagentStart` and ends on `classic.SubagentStop`, any other opens on nothing and ends on `classic.Stop`. Not the leg
|
|
46
|
+
* kind (a resumed leg's kind reads `"resume"` whoever it runs as), and not who wrote the objective: whether an input passes
|
|
47
|
+
* `classic.UserPromptSubmit` is the input's own fact, its author (`countsAsOperator`, input-author.ts) — a delegator's words are
|
|
48
|
+
* judged at the delegator's gate (`classic.PreToolUse` on the delegating call), an operator's resume of a child is screened.
|
|
47
49
|
*/
|
|
48
|
-
export declare function legEventsOf(identity: Pick<HookInvocationIdentity, "isDelegatedChild"> | undefined
|
|
50
|
+
export declare function legEventsOf(identity: Pick<HookInvocationIdentity, "isDelegatedChild"> | undefined): LegEvents;
|
|
49
51
|
/**
|
|
50
52
|
* The args as a judging handler receives them: the gate pass's own immutable value ({@link ownArgs} — the value itself when
|
|
51
53
|
* the gate already took it, which is every call the gate raises an event over), so the bytes a handler judges are the bytes
|
|
@@ -302,6 +304,14 @@ export interface LegFacadeSeats {
|
|
|
302
304
|
agents(): readonly string[];
|
|
303
305
|
/** `$.tool.call`'s host entry (`createToolCallEntry`, `tool-call.ts`). */
|
|
304
306
|
readonly toolCall: ModCallEntry;
|
|
307
|
+
/** `$.agent.spawn`'s host entry (`createAgentSpawnEntry`, `agent-stations.ts`). */
|
|
308
|
+
readonly agentSpawn: ModCallEntry;
|
|
309
|
+
/** `$.session.append`'s host entry (`createSessionAppendEntry`, `session-append.ts`). */
|
|
310
|
+
readonly sessionAppend: ModCallEntry;
|
|
311
|
+
/** `$.session.send`'s host entry (`createSessionSendEntry`, `session-send.ts`). */
|
|
312
|
+
readonly sessionSend: ModCallEntry;
|
|
313
|
+
/** `$.session.compact`'s host entry (`createSessionCompactEntry`, `session-compact.ts`). */
|
|
314
|
+
readonly sessionCompact: ModCallEntry;
|
|
305
315
|
}
|
|
306
316
|
/** The leg's admitted bus, its chain identity (the one its admission recorded, {@link chainOfBus}) and the binding of the
|
|
307
317
|
* facade its `$` reaches. `bus` is the leg bus every station raises on ({@link legBusOf}: an extension's own call's
|
|
@@ -315,6 +325,8 @@ export interface LegMods {
|
|
|
315
325
|
readonly chain: readonly ModChainLink[];
|
|
316
326
|
/** The leg's skill scopes (`SkillSpec.mods`): the grant table opens one on each activation, the park freezes them. */
|
|
317
327
|
readonly skillScopes: SkillScopes;
|
|
328
|
+
/** The leg's report sink (handler failures; a station's own disclosures). */
|
|
329
|
+
readonly report: (err: Error) => void;
|
|
318
330
|
/** Bind the engine facade once the leg is prepared. Until then a `$` call throws, naming the method. */
|
|
319
331
|
bindFacade(seats: LegFacadeSeats): void;
|
|
320
332
|
}
|
|
@@ -340,6 +352,8 @@ export interface LegFacadeInput {
|
|
|
340
352
|
readonly sessionId: string;
|
|
341
353
|
readonly model: Model;
|
|
342
354
|
readonly executionEnv: Pick<ExecutionEnv, "exec">;
|
|
355
|
+
/** The run's byte-floor seat: a mod's `$.process.run` is the run's own start and carries the run's base table. */
|
|
356
|
+
readonly readFloor: (toolCallId: string | undefined) => ReadFloor | undefined;
|
|
343
357
|
readonly taskRoot: string;
|
|
344
358
|
readonly cwdRef: CwdRef | undefined;
|
|
345
359
|
/** The leg's latest model request as recorded at the provider seam (the session's messages as the model last saw them). */
|
|
@@ -361,6 +375,14 @@ export interface LegFacadeInput {
|
|
|
361
375
|
}) => void;
|
|
362
376
|
/** `$.tool.call`'s host entry, over the leg's harness and occurrence table. */
|
|
363
377
|
readonly toolCall: ModCallEntry;
|
|
378
|
+
/** `$.agent.spawn`'s host entry, over the leg's harness and its delegation tool. */
|
|
379
|
+
readonly agentSpawn: ModCallEntry;
|
|
380
|
+
/** `$.session.append`'s host entry, over the leg's admission seat and harness. */
|
|
381
|
+
readonly sessionAppend: ModCallEntry;
|
|
382
|
+
/** `$.session.send`'s host entry, over the leg's `$.tool.call` entry and its SendMessage. */
|
|
383
|
+
readonly sessionSend: ModCallEntry;
|
|
384
|
+
/** `$.session.compact`'s host entry, over the leg's compaction station. */
|
|
385
|
+
readonly sessionCompact: ModCallEntry;
|
|
364
386
|
}
|
|
365
387
|
/** The engine facade's seats over a prepared leg — each one a seat the leg already has (no new capability). */
|
|
366
388
|
export declare function legFacadeSeats(input: LegFacadeInput): LegFacadeSeats;
|
|
@@ -4,6 +4,7 @@ import { brainToRuntime } from "../runtime.js";
|
|
|
4
4
|
import { deliverEngineNotice } from "../engine-notice.js";
|
|
5
5
|
import { extensionWords } from "../untrusted-egress.js";
|
|
6
6
|
import { askApproverIdentity, describeThrown, ownArgs } from "../tool-policy.js";
|
|
7
|
+
import { agentIdOf } from "../leg-identity.js";
|
|
7
8
|
import { admitMods } from "./kernel/index.js";
|
|
8
9
|
import { legBusOf } from "./extension-call.js";
|
|
9
10
|
import { validateOverlay } from "../../prompt-assembly/overlay.js";
|
|
@@ -16,16 +17,16 @@ export const ENGINE_CORE_ANSWER = Object.freeze({});
|
|
|
16
17
|
export function engineCore() {
|
|
17
18
|
return ENGINE_CORE_ANSWER;
|
|
18
19
|
}
|
|
19
|
-
export function
|
|
20
|
-
return
|
|
20
|
+
export function seatHears(binding, event) {
|
|
21
|
+
return binding !== undefined && binding.bus.hasHandlers(event);
|
|
21
22
|
}
|
|
22
|
-
|
|
23
|
+
export function legNoticeTaskId(leg) {
|
|
24
|
+
return { taskId: leg.taskId };
|
|
25
|
+
}
|
|
26
|
+
const TOP_LEVEL_LEG = Object.freeze({ stop: "classic.Stop" });
|
|
23
27
|
const DELEGATED_LEG = Object.freeze({ start: "classic.SubagentStart", stop: "classic.SubagentStop" });
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (identity?.isDelegatedChild !== true)
|
|
27
|
-
return PERSON_LEG;
|
|
28
|
-
return operatorObjective ? OPERATOR_RESUMED_LEG : DELEGATED_LEG;
|
|
28
|
+
export function legEventsOf(identity) {
|
|
29
|
+
return identity?.isDelegatedChild === true ? DELEGATED_LEG : TOP_LEVEL_LEG;
|
|
29
30
|
}
|
|
30
31
|
export function judgedInputOf(args) {
|
|
31
32
|
const owned = ownArgs(args);
|
|
@@ -393,7 +394,13 @@ function lateView() {
|
|
|
393
394
|
};
|
|
394
395
|
return {
|
|
395
396
|
view,
|
|
396
|
-
entries: {
|
|
397
|
+
entries: {
|
|
398
|
+
"tool.call": (args, ctx) => need("tool.call").toolCall(args, ctx),
|
|
399
|
+
"agent.spawn": (args, ctx) => need("agent.spawn").agentSpawn(args, ctx),
|
|
400
|
+
"session.append": (args, ctx) => need("session.append").sessionAppend(args, ctx),
|
|
401
|
+
"session.send": (args, ctx) => need("session.send").sessionSend(args, ctx),
|
|
402
|
+
"session.compact": (args, ctx) => need("session.compact").sessionCompact(args, ctx),
|
|
403
|
+
},
|
|
397
404
|
bind: (s) => {
|
|
398
405
|
seats = s;
|
|
399
406
|
},
|
|
@@ -416,7 +423,7 @@ export async function admitLegMods(input) {
|
|
|
416
423
|
const chain = recordAdmittedChain(bus, seats);
|
|
417
424
|
if (standing !== bus)
|
|
418
425
|
ADMITTED_CHAINS.set(standing, chain);
|
|
419
|
-
return { bus, standing, chain, skillScopes, bindFacade: late.bind };
|
|
426
|
+
return { bus, standing, chain, skillScopes, report, bindFacade: late.bind };
|
|
420
427
|
}
|
|
421
428
|
function replyText(reply) {
|
|
422
429
|
return reply.content.flatMap((c) => (c.type === "text" ? [c.text] : [])).join("");
|
|
@@ -426,7 +433,10 @@ export function legFacadeSeats(input) {
|
|
|
426
433
|
const answeredBy = new Map();
|
|
427
434
|
const byUsage = new WeakMap();
|
|
428
435
|
return {
|
|
429
|
-
exec: (command, options) =>
|
|
436
|
+
exec: (command, options) => {
|
|
437
|
+
const readFloor = input.readFloor(undefined);
|
|
438
|
+
return input.executionEnv.exec(command, { ...options, ...(readFloor !== undefined ? { readFloor } : {}) });
|
|
439
|
+
},
|
|
430
440
|
complete: async (request, signal) => {
|
|
431
441
|
const model = request.model !== undefined ? resolveModel(request.model, input.deps.models) : input.model;
|
|
432
442
|
answeredBy.set(model.id, model);
|
|
@@ -455,6 +465,10 @@ export function legFacadeSeats(input) {
|
|
|
455
465
|
tools: () => [...input.activeTools],
|
|
456
466
|
agents: () => (input.agentListing?.entries ?? []).map((e) => e.name),
|
|
457
467
|
toolCall: input.toolCall,
|
|
468
|
+
agentSpawn: input.agentSpawn,
|
|
469
|
+
sessionAppend: input.sessionAppend,
|
|
470
|
+
sessionSend: input.sessionSend,
|
|
471
|
+
sessionCompact: input.sessionCompact,
|
|
458
472
|
};
|
|
459
473
|
}
|
|
460
474
|
export async function admitModChain(seats, onError) {
|
|
@@ -87,3 +87,5 @@ export declare function extensionCallOverlap(input: {
|
|
|
87
87
|
readonly args: unknown;
|
|
88
88
|
readonly batchSafe: (toolName: string, args: unknown) => boolean;
|
|
89
89
|
}): string | undefined;
|
|
90
|
+
/** A call result's text, as a host entry answers a refusal with it (`{ deny: <the text> }`). */
|
|
91
|
+
export declare const resultText: (content: unknown) => string;
|
|
@@ -143,7 +143,7 @@ export function createToolCallStation(input) {
|
|
|
143
143
|
const AGENT_DOOR = "runs the Agent tool: that is $.agent.spawn";
|
|
144
144
|
const OTHER_DOOR = new Map([
|
|
145
145
|
[toolFace("ask-user-question").contract.contractId, "runs the AskUserQuestion tool, which puts a question to the person: an extension's call does not ask the person"],
|
|
146
|
-
[toolFace("workflow").contract.contractId, "runs the Workflow tool, whose agents run outside the
|
|
146
|
+
[toolFace("workflow").contract.contractId, "runs the Workflow tool, whose agents run outside the tree's bound on agents running at once (RunnerDeps.delegationEntryCaps.maxConcurrent): $.agent.spawn is the door"],
|
|
147
147
|
]);
|
|
148
148
|
export function createToolCallEntry(input) {
|
|
149
149
|
return async (args, ctx) => {
|
|
@@ -152,7 +152,7 @@ export function createToolCallEntry(input) {
|
|
|
152
152
|
if (typeof tool !== "string" || tool === "")
|
|
153
153
|
throw new TypeError(`${by}: $.tool.call takes the event's input: { tool, ...args }`);
|
|
154
154
|
const toolCallId = `ext-${randomUUID()}`;
|
|
155
|
-
return runExtensionCall(input.bus, toolCallId, ctx, async (call) => {
|
|
155
|
+
return runExtensionCall(input.bus, toolCallId, "tool.call", ctx, async (call) => {
|
|
156
156
|
const finalized = await input.harness.callTool({ type: "toolCall", id: toolCallId, name: tool, arguments: { ...callInput } }, ctx.signal, (t) => {
|
|
157
157
|
const contractId = input.faceOf(t.name)?.contractId;
|
|
158
158
|
const door = declaredDelegationNameOf(input.specOf(t.name)) !== undefined ? AGENT_DOOR : contractId !== undefined ? OTHER_DOOR.get(contractId) : undefined;
|
|
@@ -160,7 +160,7 @@ export function createToolCallEntry(input) {
|
|
|
160
160
|
throw new TypeError(`${by}: $.tool.call(${extensionWords(t.name, 80)}) ${door}`);
|
|
161
161
|
});
|
|
162
162
|
if (call.denied)
|
|
163
|
-
return Object.freeze({ deny:
|
|
163
|
+
return Object.freeze({ deny: resultText(finalized.result.content) });
|
|
164
164
|
return viewOf({ ...finalized.result, isError: finalized.isError });
|
|
165
165
|
});
|
|
166
166
|
};
|
|
@@ -174,4 +174,4 @@ export function extensionCallOverlap(input) {
|
|
|
174
174
|
const exclusive = others.find((o) => o.life === "released" && !input.batchSafe(o.wireName ?? o.spelledName, o.finalInput ?? o.args));
|
|
175
175
|
return exclusive === undefined ? undefined : `${name}: an extension's call cannot run beside "${extensionWords(exclusive.wireName ?? exclusive.spelledName, 80)}", which has the run to itself`;
|
|
176
176
|
}
|
|
177
|
-
const
|
|
177
|
+
export const resultText = (content) => (Array.isArray(content) ? content.map((b) => (isPlainRecord(b) && b["type"] === "text" && typeof b["text"] === "string" ? b["text"] : "")).join("") : "");
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { describeRejectedValue } from "./tool-search-setting.js";
|
|
2
2
|
import { inlineUntrusted } from "./untrusted-text.js";
|
|
3
|
+
import { optionKeys, receiveMembers } from "./own-property-receipt.js";
|
|
4
|
+
const OUTPUT_STYLE_KEYS = optionKeys()({ name: 0, turnReminder: 0 });
|
|
3
5
|
export const OUTPUT_STYLE_NAME_MAX = 256;
|
|
4
6
|
const OUTPUT_STYLE_DEFAULT_TURN_REMINDER = "Remember to follow the specific guidelines for this style.";
|
|
5
7
|
export function renderOutputStyle(name, turnReminder) {
|
|
@@ -15,10 +17,7 @@ export function resolveOutputStyleFrame(seat) {
|
|
|
15
17
|
};
|
|
16
18
|
if (seat === null || typeof seat !== "object" || Array.isArray(seat))
|
|
17
19
|
return refuse(`must be an object { name, turnReminder? } (got ${describeRejectedValue(seat)})`);
|
|
18
|
-
const
|
|
19
|
-
if (extra.length > 0)
|
|
20
|
-
return refuse(`carries ${extra.map((k) => JSON.stringify(k)).join(", ")}, which the seat does not read (members: "name", "turnReminder")`);
|
|
21
|
-
const { name, turnReminder } = seat;
|
|
20
|
+
const { name, turnReminder } = receiveMembers(seat, { subject: "TaskSpec.outputStyle", unit: "member", moment: "when the seat is read" }, OUTPUT_STYLE_KEYS, (_, extra) => refuse(`carries ${extra.map((k) => JSON.stringify(String(k))).join(", ")}, which the seat does not read (members: "name", "turnReminder")`));
|
|
22
21
|
if (typeof name !== "string" || name.trim() === "")
|
|
23
22
|
return refuse(`.name must be a non-empty string (got ${describeRejectedValue(name)})`);
|
|
24
23
|
if (name.length > OUTPUT_STYLE_NAME_MAX)
|
|
@@ -27,8 +27,67 @@ export declare const CONFIG_RECEIPT_MODE: ReceiptMode;
|
|
|
27
27
|
* itself, a container nested deeper — a shared one measured where it sits each time it is met), every copied container frozen.
|
|
28
28
|
*/
|
|
29
29
|
export declare const DECLARATION_RECEIPT_MODE: ReceiptMode;
|
|
30
|
+
/** Only {@link optionKeys} mints an {@link OptionKeys}: a hand-written list carries no brand. */
|
|
31
|
+
declare const OPTION_KEYS: unique symbol;
|
|
32
|
+
/**
|
|
33
|
+
* A constructor's options table: the keys of the options interface `T`, exactly. The brand is a function over `keyof T`
|
|
34
|
+
* in both positions, so a table for one interface is not a table for another (a narrower one, an `Omit` of it) in either
|
|
35
|
+
* direction, and a plain string list is not one at all.
|
|
36
|
+
*/
|
|
37
|
+
export type OptionKeys<T> = readonly string[] & {
|
|
38
|
+
readonly [OPTION_KEYS]: (key: keyof T) => keyof T;
|
|
39
|
+
};
|
|
40
|
+
/** The keys of `K` outside `T`, taken arm by arm when `K` is a union (each arm's own keys, not only the keys all arms share). */
|
|
41
|
+
type SurplusKeys<K, T> = K extends unknown ? Exclude<keyof K, keyof T> : never;
|
|
42
|
+
/** The minter {@link optionKeys} hands back: `never` — not callable — for an interface with an index signature, whose keys no
|
|
43
|
+
* table can name. */
|
|
44
|
+
type OptionKeysMinter<T> = string extends keyof T ? never : number extends keyof T ? never : <K extends Record<keyof T, 0>>(table: K & Record<SurplusKeys<K, T>, never>) => OptionKeys<T>;
|
|
45
|
+
/**
|
|
46
|
+
* Mint the options table of interface `T` from a literal naming each of its keys once (`{ fsync: 0, lockWaitMs: 0 }`).
|
|
47
|
+
* Curried so `T` is written and the literal inferred: a key of `T` the literal leaves out does not compile, and neither
|
|
48
|
+
* does a key `T` lacks — whether the literal is fresh, a variable, a spread, or a union whose arms each carry one — since
|
|
49
|
+
* every key outside `T` must be `never`. An interface with an index signature has no table (the minter is not callable).
|
|
50
|
+
*/
|
|
51
|
+
export declare function optionKeys<T extends object>(): OptionKeysMinter<T>;
|
|
30
52
|
/** The OPTIONS DOOR — a constructor's options bag received by the receipt law, absent ⇒ an empty one: every option the constructor reads
|
|
31
|
-
* is read off this copy, once, and the caller's bag is never read again (a store keeps no hold of it). `owner` names the
|
|
32
|
-
|
|
53
|
+
* is read off this frozen copy, once, and the caller's bag is never read again (a store keeps no hold of it). `owner` names the
|
|
54
|
+
* constructor; `keys` is the table of the options it takes ({@link optionKeys}), and an option outside it is refused by name
|
|
55
|
+
* ({@link receiveMembers}). */
|
|
56
|
+
export declare function receiveOptions<T extends object>(given: T | undefined, owner: string, keys: OptionKeys<T>): Readonly<T>;
|
|
33
57
|
/** Read `given` by the receipt law (module note): the plain copy, every own member taken once from its captured descriptor. */
|
|
34
58
|
export declare function receiveOwnProperties<T extends object>(given: T, words: OwnPropertyReceiptWords): T;
|
|
59
|
+
/** How a door whose family has its own code refuses its stray members: the one sentence, and the stray names it names
|
|
60
|
+
* (a symbol as itself), for a refusal that also carries them as data. */
|
|
61
|
+
export type StrayMembersRefusal = (message: string, stray: readonly (string | symbol)[]) => Error;
|
|
62
|
+
/** A record's members outside a door's table: their names (a symbol as itself) and the one sentence that names them. */
|
|
63
|
+
export interface StrayMembers {
|
|
64
|
+
readonly names: readonly (string | symbol)[];
|
|
65
|
+
readonly sentence: string;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* THE NAME JUDGMENT of a door (module note): every own member of `given` that `keys` does not name — a string key,
|
|
69
|
+
* enumerable or not, and a symbol key — with the one sentence that names them all (each with its nearest taken name within
|
|
70
|
+
* two edits, then the members taken); `undefined` when there is none. It reads names only: no getter runs and no value is
|
|
71
|
+
* looked at. On an admitted object (a plain record that is no Proxy, or a copy a receipt made) no caller code runs; a
|
|
72
|
+
* reader whose own law reads the caller's live object judges the names that object answers (a Proxy's own-keys answer
|
|
73
|
+
* included). A reader that answers a sentence instead of throwing takes this; a door that throws takes
|
|
74
|
+
* {@link refuseStrayMembers} or {@link receiveMembers}.
|
|
75
|
+
*/
|
|
76
|
+
export declare function strayMembersOf(given: object, words: OwnPropertyReceiptWords, keys: readonly string[]): StrayMembers | undefined;
|
|
77
|
+
/**
|
|
78
|
+
* THE NAME-ONLY DOOR — the receipt's admission (not a Proxy, a plain record), then {@link strayMembersOf}: every own member
|
|
79
|
+
* `keys` does not name is refused, all of them in one sentence, and no getter runs. For an object the door must judge but
|
|
80
|
+
* not copy (a face whose callbacks are later called with the object itself as `this`); a door that takes a copy takes
|
|
81
|
+
* {@link receiveMembers}, which is this judgment followed by the receipt.
|
|
82
|
+
*/
|
|
83
|
+
export declare function refuseStrayMembers(given: object, words: OwnPropertyReceiptWords, keys: readonly string[], refusal?: StrayMembersRefusal): void;
|
|
84
|
+
/**
|
|
85
|
+
* Read `given` by the receipt law and refuse every own member `keys` does not name (module note): the members a door
|
|
86
|
+
* takes, and nothing else, by one reading. The names are judged ({@link refuseStrayMembers}) before the receipt runs any
|
|
87
|
+
* getter, and nothing of the caller's runs between that judgment and the receipt's one capture, so the names judged are
|
|
88
|
+
* the names read. `refusal` codes the stray-member refusal for a door whose family has its own code (the receipt's own
|
|
89
|
+
* refusals keep `config.invalid_argument`). The copy handed back is frozen: what was judged is what is held, and a
|
|
90
|
+
* callback the door's owner later calls on it (its `this`) cannot change a member.
|
|
91
|
+
*/
|
|
92
|
+
export declare function receiveMembers<T extends object>(given: T, words: OwnPropertyReceiptWords, keys: readonly string[], refusal?: StrayMembersRefusal): Readonly<T>;
|
|
93
|
+
export {};
|