@sema-agent/core 7.55.0 → 7.57.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 +1054 -0
- package/LICENSE +1 -1
- package/dist/agents/cascade.js +1 -1
- package/dist/agents/cc-peer-directory.js +1 -0
- package/dist/agents/child-model-seat.d.ts +0 -11
- package/dist/agents/child-model-seat.js +0 -3
- package/dist/agents/list-agents-tool.d.ts +3 -1
- package/dist/agents/list-agents-tool.js +7 -7
- package/dist/agents/org-delivery-gate.js +3 -4
- package/dist/agents/peer-directory.d.ts +22 -4
- package/dist/agents/peer-directory.js +24 -2
- package/dist/agents/peer-held-queue.d.ts +69 -49
- package/dist/agents/peer-held-queue.js +255 -106
- package/dist/agents/peer-session-drain.js +65 -45
- package/dist/agents/repair-loop.js +2 -2
- package/dist/agents/send-message-tool.js +7 -6
- package/dist/agents/subagent.d.ts +6 -4
- package/dist/agents/subagent.js +72 -68
- package/dist/agents/tool-filter.d.ts +7 -5
- package/dist/agents/tool-filter.js +12 -9
- package/dist/agents/verify.d.ts +3 -2
- package/dist/agents/verify.js +3 -3
- package/dist/brain/anthropic.js +45 -80
- package/dist/brain/media-degrade.d.ts +18 -7
- package/dist/brain/media-degrade.js +13 -2
- package/dist/brain/model-capability.d.ts +37 -0
- package/dist/brain/model-capability.js +34 -0
- package/dist/brain/model-presets.d.ts +2 -8
- package/dist/brain/model-presets.js +1 -6
- package/dist/brain/open-responses.js +23 -34
- package/dist/brain/openai.js +25 -96
- package/dist/brain/provider-dialect.d.ts +3 -2
- package/dist/brain/provider-dialect.js +2 -2
- package/dist/brain/reasoning-request.d.ts +96 -0
- package/dist/brain/reasoning-request.js +174 -0
- package/dist/brain/reasoning.d.ts +11 -11
- package/dist/brain/reasoning.js +4 -3
- package/dist/brain/request-params.d.ts +13 -4
- package/dist/brain/request-params.js +21 -5
- package/dist/brain/status-sink.d.ts +20 -0
- package/dist/brain/status-sink.js +7 -0
- package/dist/brain/stream-engine.d.ts +9 -0
- package/dist/brain/stream-engine.js +24 -10
- package/dist/brain/stream-shared.d.ts +5 -4
- package/dist/brain/stream-shared.js +4 -4
- package/dist/core/a2a.d.ts +2 -1
- package/dist/core/a2a.js +19 -13
- package/dist/core/agent-definition.d.ts +10 -0
- package/dist/core/allow-entry.d.ts +23 -23
- package/dist/core/allow-entry.js +42 -46
- package/dist/core/allow-rule-shadow.d.ts +3 -3
- package/dist/core/approval-object.d.ts +21 -5
- package/dist/core/approval-object.js +44 -17
- package/dist/core/ask-origin.d.ts +66 -20
- package/dist/core/ask-origin.js +63 -23
- package/dist/core/ask-question.d.ts +51 -8
- package/dist/core/ask-question.js +3 -4
- package/dist/core/ask-unresolvable-notice.d.ts +8 -3
- package/dist/core/ask-unresolvable-notice.js +16 -2
- package/dist/core/auto-compaction.d.ts +71 -6
- package/dist/core/auto-compaction.js +42 -26
- package/dist/core/background-agent-store.d.ts +6 -2
- package/dist/core/background-agent-store.js +1 -1
- package/dist/core/checkpoint-generation.d.ts +53 -0
- package/dist/core/checkpoint-generation.js +35 -0
- package/dist/core/checkpoint-queries.d.ts +180 -0
- package/dist/core/checkpoint-queries.js +272 -0
- package/dist/core/checkpoint-requirements.d.ts +19 -1
- package/dist/core/checkpoint-requirements.js +6 -0
- package/dist/core/checkpoint-store.d.ts +105 -53
- package/dist/core/checkpoint-store.js +43 -20
- package/dist/core/cross-boundary-taint.d.ts +6 -5
- package/dist/core/cross-boundary-taint.js +5 -5
- package/dist/core/decision-receipt.d.ts +37 -3
- package/dist/core/decision-receipt.js +17 -17
- package/dist/core/delegation-not-started.d.ts +6 -0
- package/dist/core/delegation-not-started.js +17 -0
- package/dist/core/engine-attestation.d.ts +93 -0
- package/dist/core/engine-attestation.js +70 -0
- package/dist/core/engine-capabilities.d.ts +4 -1
- package/dist/core/engine-capabilities.js +1 -1
- package/dist/core/engine-notice.d.ts +32 -12
- package/dist/core/engine-notice.js +6 -0
- package/dist/core/file-history-store.d.ts +104 -22
- package/dist/core/file-history-store.js +37 -19
- package/dist/core/gate-fold.d.ts +1 -1
- package/dist/core/gate-fold.js +22 -10
- package/dist/core/gate-lanes.js +73 -65
- package/dist/core/gate-outcome.d.ts +26 -5
- package/dist/core/gate-outcome.js +26 -0
- package/dist/core/governance-codes.d.ts +5 -1
- package/dist/core/governance-codes.js +6 -0
- package/dist/core/hooks.d.ts +19 -18
- package/dist/core/hooks.js +3 -1
- package/dist/core/host-floor.d.ts +128 -0
- package/dist/core/host-floor.js +206 -0
- package/dist/core/host-target.d.ts +38 -3
- package/dist/core/host-target.js +38 -5
- package/dist/core/mailbox-store.d.ts +62 -1
- package/dist/core/mailbox-store.js +59 -0
- package/dist/core/mcp-name-judge.d.ts +46 -0
- package/dist/core/mcp-name-judge.js +61 -0
- package/dist/core/mcp-probe.d.ts +1 -1
- package/dist/core/mcp-probe.js +2 -5
- package/dist/core/mcp.d.ts +5 -1
- package/dist/core/mcp.js +70 -64
- package/dist/core/memory-engine/consolidation-driver.js +4 -3
- package/dist/core/memory-engine/delegation-settlement.js +15 -24
- package/dist/core/memory-engine/distiller.js +26 -17
- package/dist/core/memory-engine/engine.js +4 -4
- package/dist/core/memory-engine/layout.d.ts +60 -8
- package/dist/core/memory-engine/layout.js +70 -8
- package/dist/core/model-seat.d.ts +10 -3
- package/dist/core/mods/classic-events.d.ts +67 -0
- package/dist/core/mods/classic-events.js +1 -0
- package/dist/core/mods/dollar.d.ts +13 -0
- package/dist/core/mods/extension-call.d.ts +31 -0
- package/dist/core/mods/extension-call.js +43 -0
- package/dist/core/mods/kernel/dispatch.d.ts +20 -3
- package/dist/core/mods/kernel/dispatch.js +140 -69
- package/dist/core/mods/kernel/events.d.ts +47 -11
- package/dist/core/mods/kernel/events.js +66 -42
- package/dist/core/mods/kernel/index.d.ts +4 -4
- package/dist/core/mods/kernel/index.js +2 -2
- package/dist/core/mods/kernel/receive.d.ts +39 -5
- package/dist/core/mods/kernel/receive.js +290 -17
- package/dist/core/mods/kernel/registration.d.ts +33 -2
- package/dist/core/mods/kernel/registration.js +6 -7
- package/dist/core/mods/kernel/site-rules.d.ts +44 -16
- package/dist/core/mods/kernel/site-rules.js +24 -42
- package/dist/core/mods/spec-seats.d.ts +69 -0
- package/dist/core/mods/spec-seats.js +114 -0
- package/dist/core/mods/stations.d.ts +28 -8
- package/dist/core/mods/stations.js +29 -13
- package/dist/core/mods/tool-call.d.ts +79 -0
- package/dist/core/mods/tool-call.js +152 -0
- package/dist/core/namespaced-rule-name.d.ts +32 -38
- package/dist/core/namespaced-rule-name.js +29 -36
- package/dist/core/parent-spec-seat.d.ts +6 -1
- package/dist/core/parent-spec-seat.js +2 -0
- package/dist/core/park-selfcheck.js +3 -0
- package/dist/core/permission-rule-consent.d.ts +24 -3
- package/dist/core/permission-rule-consent.js +136 -41
- package/dist/core/permission-rule-model.d.ts +57 -5
- package/dist/core/permission-rule-model.js +90 -31
- package/dist/core/permission-rule-org.d.ts +6 -2
- package/dist/core/permission-rule-org.js +8 -4
- package/dist/core/permission-rule-provider.d.ts +5 -2
- package/dist/core/permission-rule-provider.js +41 -11
- package/dist/core/permission-rule-store.d.ts +3 -2
- package/dist/core/permission-rule-store.js +11 -2
- package/dist/core/permission-rule-sync.js +3 -2
- package/dist/core/permission-rule-syntax.d.ts +5 -4
- package/dist/core/permission-rule-syntax.js +2 -2
- package/dist/core/permission-rules.d.ts +4 -4
- package/dist/core/permission-rules.js +11 -20
- package/dist/core/persisted-rule-arms.d.ts +2 -2
- package/dist/core/persisted-rule-arms.js +10 -12
- package/dist/core/principal-name.d.ts +20 -0
- package/dist/core/principal-name.js +22 -0
- package/dist/core/prompt-section-seat.js +4 -6
- package/dist/core/protocol-http-auth.d.ts +40 -5
- package/dist/core/protocol-http-auth.js +168 -4
- package/dist/core/protocol-naming.d.ts +20 -0
- package/dist/core/protocol-naming.js +20 -3
- package/dist/core/read-only-shell.d.ts +20 -5
- package/dist/core/read-only-shell.js +29 -14
- package/dist/core/remote-env.d.ts +37 -1
- package/dist/core/remote-env.js +11 -0
- package/dist/core/resume-startup-cause.d.ts +24 -2
- package/dist/core/resume-startup-cause.js +20 -1
- package/dist/core/retired-keys.d.ts +16 -0
- package/dist/core/retired-keys.js +16 -4
- package/dist/core/rewrite-rejudge.d.ts +60 -0
- package/dist/core/rewrite-rejudge.js +36 -0
- package/dist/core/roles.d.ts +28 -1
- package/dist/core/roles.js +81 -26
- package/dist/core/rule-lane-reads.d.ts +20 -15
- package/dist/core/rule-lane-reads.js +45 -17
- package/dist/core/rule-owner.d.ts +3 -3
- package/dist/core/rule-owner.js +3 -2
- package/dist/core/runner/announce-once-ledger.d.ts +14 -0
- package/dist/core/runner/announce-once-ledger.js +5 -0
- package/dist/core/runner/assemble-result.d.ts +1 -0
- package/dist/core/runner/assemble-result.js +1 -1
- package/dist/core/runner/call-hook-stations.d.ts +3 -2
- package/dist/core/runner/caller-roster.d.ts +16 -4
- package/dist/core/runner/caller-roster.js +33 -6
- package/dist/core/runner/capability-withheld-seat.d.ts +5 -0
- package/dist/core/runner/capability-withheld-seat.js +24 -0
- package/dist/core/runner/classifier-ladder.d.ts +7 -9
- package/dist/core/runner/classifier-ladder.js +3 -3
- package/dist/core/runner/compact-session.d.ts +10 -0
- package/dist/core/runner/compact-session.js +202 -0
- package/dist/core/runner/compaction-call-options.d.ts +2 -2
- package/dist/core/runner/compaction-seams.d.ts +21 -1
- package/dist/core/runner/compaction-seams.js +11 -8
- package/dist/core/runner/construction-doors.js +3 -0
- package/dist/core/runner/contracts.d.ts +50 -40
- package/dist/core/runner/cross-boundary-lane.d.ts +17 -13
- package/dist/core/runner/cross-boundary-lane.js +40 -27
- package/dist/core/runner/denial-limit-arms.d.ts +2 -2
- package/dist/core/runner/denial-limit-arms.js +1 -1
- package/dist/core/runner/derived-route-fallback.d.ts +13 -0
- package/dist/core/runner/derived-route-fallback.js +6 -0
- package/dist/core/runner/env-capability-census.d.ts +3 -2
- package/dist/core/runner/env-capability-census.js +9 -3
- package/dist/core/runner/file-history-request.d.ts +18 -0
- package/dist/core/runner/file-history-request.js +21 -13
- package/dist/core/runner/file-history-restore.d.ts +45 -0
- package/dist/core/runner/file-history-restore.js +46 -0
- package/dist/core/runner/gate-exit.d.ts +3 -3
- package/dist/core/runner/gate-exit.js +4 -3
- package/dist/core/runner/image.d.ts +7 -17
- package/dist/core/runner/image.js +9 -60
- package/dist/core/runner/permission-rule-lanes.d.ts +11 -11
- package/dist/core/runner/permission-rule-lanes.js +39 -17
- package/dist/core/runner/person-path-rows.d.ts +12 -9
- package/dist/core/runner/person-path-rows.js +18 -7
- package/dist/core/runner/prepare-acquire-reconcile.d.ts +3 -0
- package/dist/core/runner/prepare-acquire-reconcile.js +2 -1
- package/dist/core/runner/prepare-ask-lane.d.ts +2 -2
- package/dist/core/runner/prepare-ask-lane.js +5 -2
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +4 -6
- package/dist/core/runner/prepare-caps-and-workflow.js +4 -3
- package/dist/core/runner/prepare-config-doors.d.ts +35 -38
- package/dist/core/runner/prepare-config-doors.js +46 -28
- package/dist/core/runner/prepare-defer-classify.d.ts +4 -3
- package/dist/core/runner/prepare-defer-classify.js +7 -8
- package/dist/core/runner/prepare-file-history.d.ts +48 -8
- package/dist/core/runner/prepare-file-history.js +7 -39
- package/dist/core/runner/prepare-gate-stations.d.ts +1 -1
- package/dist/core/runner/prepare-gate-stations.js +10 -1
- package/dist/core/runner/prepare-hands-readface.d.ts +5 -9
- package/dist/core/runner/prepare-hands-readface.js +17 -14
- package/dist/core/runner/prepare-inherited-gate.d.ts +6 -3
- package/dist/core/runner/prepare-inherited-gate.js +5 -3
- package/dist/core/runner/prepare-memory-engine-session.js +1 -1
- package/dist/core/runner/prepare-park-ask.d.ts +2 -0
- package/dist/core/runner/prepare-park-ask.js +7 -7
- package/dist/core/runner/prepare-policy-chain.d.ts +6 -3
- package/dist/core/runner/prepare-policy-chain.js +67 -76
- package/dist/core/runner/prepare-prompt-assembly.d.ts +5 -7
- package/dist/core/runner/prepare-prompt-assembly.js +10 -8
- package/dist/core/runner/prepare-prompt-inputs.d.ts +11 -9
- package/dist/core/runner/prepare-prompt-inputs.js +3 -5
- package/dist/core/runner/prepare-protocol-tools.d.ts +2 -0
- package/dist/core/runner/prepare-protocol-tools.js +3 -3
- package/dist/core/runner/prepare-safety-scan.d.ts +1 -1
- package/dist/core/runner/prepare-safety-scan.js +0 -17
- package/dist/core/runner/prepare-suspend-saga.d.ts +2 -0
- package/dist/core/runner/prepare-suspend-saga.js +5 -6
- package/dist/core/runner/prepare-task.d.ts +5 -2
- package/dist/core/runner/prepare-task.js +48 -43
- package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +20 -4
- package/dist/core/runner/prepare-tool-disclosure-mount.js +33 -23
- package/dist/core/runner/prepare-turn-wiring.d.ts +0 -4
- package/dist/core/runner/prepare-turn-wiring.js +2 -7
- package/dist/core/runner/prepare-wiring-manifest.d.ts +6 -2
- package/dist/core/runner/prepare-wiring-manifest.js +3 -3
- package/dist/core/runner/resume-admission.js +1 -1
- package/dist/core/runner/resume-apply.js +11 -12
- package/dist/core/runner/resume-checkpoint-screen.js +3 -0
- package/dist/core/runner/resume-claim.d.ts +4 -2
- package/dist/core/runner/resume-claim.js +15 -8
- package/dist/core/runner/retired-runner-deps.js +1 -0
- package/dist/core/runner/rewind-files.d.ts +12 -0
- package/dist/core/runner/rewind-files.js +90 -0
- package/dist/core/runner/run-attachment-seats.js +2 -1
- package/dist/core/runner/run-brain-sinks.d.ts +4 -1
- package/dist/core/runner/run-brain-sinks.js +4 -2
- package/dist/core/runner/run-harness-handlers.js +12 -4
- package/dist/core/runner/run-leg.d.ts +1 -1
- package/dist/core/runner/run-leg.js +40 -39
- package/dist/core/runner/run-notification-lane.d.ts +2 -0
- package/dist/core/runner/run-notification-lane.js +2 -2
- package/dist/core/runner/run-recovery-lanes.js +3 -4
- package/dist/core/runner/run-settle-and-teardown.js +7 -12
- package/dist/core/runner/run-terminal-adoption.js +3 -4
- package/dist/core/runner/run-turn-boundary.js +4 -15
- package/dist/core/runner/runtask.d.ts +10 -0
- package/dist/core/runner/runtask.js +35 -42
- package/dist/core/runner/send-message-continuation.js +1 -1
- package/dist/core/runner/session-read-file-states.d.ts +15 -0
- package/dist/core/runner/session-read-file-states.js +28 -0
- package/dist/core/runner/session-rule-policy.js +4 -3
- package/dist/core/runner/session-verb-doors.d.ts +28 -0
- package/dist/core/runner/session-verb-doors.js +48 -0
- package/dist/core/runner/session-write-ledger.d.ts +30 -0
- package/dist/core/runner/session-write-ledger.js +101 -0
- package/dist/core/runner/shell-env-withheld.d.ts +33 -0
- package/dist/core/runner/shell-env-withheld.js +51 -0
- package/dist/core/runner/skills-seat.js +6 -2
- package/dist/core/runner/stream-settle-backstop.js +12 -15
- package/dist/core/runner/sub-agent-deny-lists.d.ts +25 -3
- package/dist/core/runner/sub-agent-deny-lists.js +25 -17
- package/dist/core/runner/synthetic-tools.d.ts +6 -0
- package/dist/core/runner/synthetic-tools.js +4 -1
- package/dist/core/runner/teardown-bounded.d.ts +1 -0
- package/dist/core/runner/teardown-bounded.js +1 -0
- package/dist/core/runner/tool-disclosure.d.ts +10 -12
- package/dist/core/runner/tool-disclosure.js +1 -3
- package/dist/core/runner/tool-end-body.d.ts +1 -1
- package/dist/core/runner/tool-end-body.js +10 -9
- package/dist/core/runner/tool-not-executed.d.ts +5 -0
- package/dist/core/runner/tool-not-executed.js +11 -0
- package/dist/core/runner/tool-occurrence.d.ts +8 -0
- package/dist/core/runner/tool-occurrence.js +7 -0
- package/dist/core/runner/turn-attachments.d.ts +33 -15
- package/dist/core/runner/turn-attachments.js +62 -37
- package/dist/core/runner-deps.d.ts +7 -7
- package/dist/core/safety-axis-vocab.d.ts +6 -4
- package/dist/core/safety-axis-vocab.js +6 -5
- package/dist/core/safety-merge-corpus.js +11 -3
- package/dist/core/secret-env.d.ts +30 -3
- package/dist/core/secret-env.js +47 -8
- package/dist/core/select-model.js +3 -3
- package/dist/core/session-policy-store.d.ts +32 -15
- package/dist/core/session-policy-store.js +156 -36
- package/dist/core/session-store.d.ts +29 -10
- package/dist/core/session-store.js +51 -19
- package/dist/core/session.d.ts +82 -16
- package/dist/core/session.js +53 -0
- package/dist/core/shell-read-silence.d.ts +11 -12
- package/dist/core/shell-read-silence.js +9 -5
- package/dist/core/shell-run-candidates.js +3 -1
- package/dist/core/shell-wrapper-projection.d.ts +1 -1
- package/dist/core/shell-wrapper-projection.js +1 -1
- package/dist/core/shell-wrapper-table.d.ts +14 -7
- package/dist/core/shell-wrapper-table.js +5 -4
- package/dist/core/side-query.js +10 -1
- package/dist/core/skill-grant.d.ts +7 -2
- package/dist/core/skill-grant.js +5 -0
- package/dist/core/skills-directory.js +6 -2
- package/dist/core/store-contracts/background-agent-store-contract.js +1 -0
- package/dist/core/store-contracts/checkpoint-store-contract.d.ts +11 -1
- package/dist/core/store-contracts/checkpoint-store-contract.js +141 -2
- package/dist/core/store-contracts/file-history-store-contract.js +40 -1
- package/dist/core/store-contracts/mailbox-store-contract.js +49 -1
- package/dist/core/store-contracts/peer-directory-contract.d.ts +7 -2
- package/dist/core/store-contracts/peer-directory-contract.js +14 -2
- package/dist/core/store-contracts/session-repo-contract.js +51 -0
- package/dist/core/store-contracts/session-store-contract.d.ts +2 -1
- package/dist/core/store-contracts/session-store-contract.js +150 -14
- package/dist/core/stub-env.d.ts +2 -0
- package/dist/core/stub-env.js +1 -0
- package/dist/core/synthetic-read-verdict.js +3 -3
- package/dist/core/task-event.d.ts +32 -4
- package/dist/core/task-notification.d.ts +16 -12
- package/dist/core/task-registry-agent.d.ts +8 -4
- package/dist/core/task-registry-agent.js +14 -8
- package/dist/core/task-registry-shared.d.ts +35 -6
- package/dist/core/task-registry-shared.js +11 -0
- package/dist/core/task-registry.d.ts +10 -1
- package/dist/core/task-registry.js +12 -2
- package/dist/core/task-result.d.ts +18 -0
- package/dist/core/task-spec.d.ts +18 -13
- package/dist/core/tighten-task-spec.js +2 -1
- package/dist/core/tool-catalog-entries.d.ts +23 -0
- package/dist/core/tool-catalog-entries.js +14 -2
- package/dist/core/tool-check-reading.d.ts +11 -0
- package/dist/core/tool-check-reading.js +11 -6
- package/dist/core/tool-model-gate.d.ts +2 -2
- package/dist/core/tool-name-aliases.d.ts +48 -18
- package/dist/core/tool-name-aliases.js +36 -19
- package/dist/core/tool-name-readings.d.ts +6 -32
- package/dist/core/tool-name-readings.js +2 -9
- package/dist/core/tool-policy.d.ts +78 -204
- package/dist/core/tool-policy.js +152 -204
- package/dist/core/tool-result-store.js +3 -0
- package/dist/core/tool-roster.d.ts +14 -19
- package/dist/core/tool-roster.js +11 -44
- package/dist/core/tool-spec-members.js +7 -2
- package/dist/core/tool-spec.d.ts +19 -11
- package/dist/core/tools.js +49 -9
- package/dist/core/trace.d.ts +6 -3
- package/dist/core/trace.js +2 -1
- package/dist/core/types.d.ts +1 -1
- package/dist/core/untrusted-egress.d.ts +20 -0
- package/dist/core/untrusted-egress.js +77 -3
- package/dist/core/user-attachment.d.ts +8 -1
- package/dist/core/user-attachment.js +64 -4
- package/dist/core/wiring-manifest.d.ts +9 -0
- package/dist/core/wiring-manifest.js +1 -0
- package/dist/core/workflow-journal-store.js +1 -1
- package/dist/engine/compaction/compaction.js +3 -2
- package/dist/engine/execution-env/node-execution-env.d.ts +7 -3
- package/dist/engine/execution-env/node-execution-env.js +11 -2
- package/dist/engine/harness/agent-harness.d.ts +32 -6
- package/dist/engine/harness/agent-harness.js +65 -9
- package/dist/engine/harness/types.d.ts +29 -2
- package/dist/engine/llm/types.d.ts +28 -11
- package/dist/engine/loop/agent-loop.d.ts +23 -4
- package/dist/engine/loop/agent-loop.js +42 -30
- package/dist/engine/loop/types.d.ts +16 -6
- package/dist/engine/session/memory-repo.d.ts +9 -2
- package/dist/engine/session/memory-repo.js +11 -1
- package/dist/engine/session/repo-utils.d.ts +6 -5
- package/dist/engine/session/repo-utils.js +14 -6
- package/dist/index.d.ts +34 -17
- package/dist/index.js +22 -11
- package/dist/internal/harness-types.d.ts +1 -1
- package/dist/internal/harness.d.ts +2 -1
- package/dist/internal/harness.js +1 -0
- package/dist/internal/llm.d.ts +1 -1
- package/dist/orchestration/run-workflow-tool.d.ts +6 -4
- package/dist/orchestration/run-workflow-tool.js +5 -3
- package/dist/orchestration/workflow.d.ts +3 -0
- package/dist/orchestration/workflow.js +36 -18
- package/dist/primitives/credential-ref.d.ts +89 -0
- package/dist/primitives/credential-ref.js +125 -0
- package/dist/primitives/index.d.ts +2 -0
- package/dist/primitives/index.js +1 -0
- package/dist/prompt-assembly/artifact.d.ts +2 -2
- package/dist/prompt-assembly/artifact.js +5 -3
- package/dist/prompt-assembly/assemble.d.ts +3 -2
- package/dist/prompt-assembly/assemble.js +1 -1
- package/dist/prompt-assembly/catalog/schema.d.ts +43 -12
- package/dist/prompt-assembly/catalog/schema.js +34 -2
- package/dist/prompt-assembly/catalog/sections.js +0 -1
- package/dist/prompt-assembly/composer.d.ts +3 -1
- package/dist/prompt-assembly/composer.js +1 -1
- package/dist/prompt-assembly/event-registry.js +1 -0
- package/dist/prompt-assembly/overlay.js +3 -3
- package/dist/prompt-assembly/renderers.d.ts +1 -1
- package/dist/prompt-assembly/renderers.js +0 -3
- package/dist/prompt-assembly/role-base.d.ts +15 -0
- package/dist/prompt-assembly/role-base.js +9 -0
- package/dist/prompt-assembly/select.d.ts +39 -14
- package/dist/prompt-assembly/select.js +47 -16
- package/dist/prompt-assembly/sugar.d.ts +17 -11
- package/dist/prompt-assembly/sugar.js +8 -3
- package/dist/prompt-assembly/tool-catalog.d.ts +37 -3
- package/dist/prompt-assembly/tool-catalog.js +114 -4
- package/dist/prompt-assembly/turn-snapshot.d.ts +4 -10
- package/dist/prompt-assembly/turn-snapshot.js +0 -3
- package/dist/prompt-assembly/types.d.ts +0 -7
- package/dist/scenarios/full-body.d.ts +11 -11
- package/dist/scenarios/full-body.js +4 -3
- package/dist/shell/lex.js +10 -1
- package/dist/stores/file/adoption/adopt.js +4 -3
- package/dist/stores/file/adoption/marker.js +3 -2
- package/dist/stores/file/checkpoint-store.d.ts +21 -4
- package/dist/stores/file/checkpoint-store.js +38 -7
- package/dist/stores/file/file-history-store.js +18 -11
- package/dist/stores/file/index.js +2 -1
- package/dist/stores/file/mailbox-store.d.ts +2 -1
- package/dist/stores/file/mailbox-store.js +26 -1
- package/dist/stores/file/permission-rule-adopt.js +4 -3
- package/dist/stores/file/permission-rule-store.js +11 -5
- package/dist/stores/file/session-store.d.ts +29 -6
- package/dist/stores/file/session-store.js +42 -50
- package/dist/tools/artifact/artifact-tool.js +3 -2
- package/dist/tools/fs/bash-program-position.d.ts +19 -2
- package/dist/tools/fs/bash-program-position.js +56 -9
- package/dist/tools/fs/bash-readonly-classifier.d.ts +15 -19
- package/dist/tools/fs/bash-readonly-classifier.js +5 -10
- package/dist/tools/fs/fs-bash.js +15 -8
- package/dist/tools/fs/fs-glob.d.ts +86 -0
- package/dist/tools/fs/fs-glob.js +226 -0
- package/dist/tools/fs/fs-read.js +14 -14
- package/dist/tools/fs/fs-search-tools.js +7 -7
- package/dist/tools/fs/pattern-kill-guard.d.ts +23 -0
- package/dist/tools/fs/pattern-kill-guard.js +429 -0
- package/dist/tools/fs/pdf.d.ts +9 -6
- package/dist/tools/fs/pdf.js +3 -3
- package/dist/tools/fs/program-read-model.d.ts +57 -7
- package/dist/tools/fs/program-read-model.js +11 -1
- package/dist/tools/fs/program-read-model.rows.js +78 -21
- package/dist/tools/fs/read-deny-home.js +3 -2
- package/dist/tools/fs/removal-targets.d.ts +17 -7
- package/dist/tools/fs/removal-targets.js +47 -20
- package/dist/tools/fs/search.d.ts +10 -0
- package/dist/tools/fs/search.js +20 -26
- package/dist/tools/fs/shell-read-argv.js +89 -12
- package/dist/tools/fs/shell-read-bindings.d.ts +31 -0
- package/dist/tools/fs/shell-read-bindings.js +41 -0
- package/dist/tools/fs/shell-read-check.d.ts +10 -0
- package/dist/tools/fs/shell-read-check.js +13 -20
- package/dist/tools/fs/shell-read-environment.d.ts +5 -1
- package/dist/tools/fs/shell-read-environment.js +3 -2
- package/dist/tools/fs/shell-read-establish.d.ts +15 -0
- package/dist/tools/fs/shell-read-establish.js +19 -20
- package/dist/tools/fs/shell-read-identity.d.ts +12 -9
- package/dist/tools/fs/shell-read-identity.js +9 -4
- package/dist/tools/fs/shell-read-plan.js +24 -16
- package/dist/tools/fs/shell-read-start.d.ts +6 -1
- package/dist/tools/fs/shell-read-write-targets.d.ts +5 -1
- package/dist/tools/fs/shell-read-write-targets.js +2 -3
- package/dist/tools/fs/shell-reentry-text.d.ts +9 -0
- package/dist/tools/fs/shell-reentry-text.js +40 -2
- package/dist/tools/todo.js +63 -63
- package/dist/tools/web.d.ts +19 -14
- package/dist/tools/web.js +46 -61
- package/package.json +1 -1
- package/test/export-surface.snapshot.json +221 -7
- package/wire-changes/core-stores-sql@7.57.0.json +29 -0
- package/wire-changes/core@7.56.0.json +3891 -0
- package/wire-changes/core@7.57.0.json +1487 -0
- package/wire-changes/mods-kernel@7.56.0.json +303 -0
- package/wire-changes/mods-kernel@7.57.0.json +29 -0
- package/wire-changes/primitives@7.57.0.json +245 -0
|
@@ -5,25 +5,134 @@ export function isPlainRecord(v) {
|
|
|
5
5
|
const proto = Object.getPrototypeOf(v);
|
|
6
6
|
return proto === Object.prototype || proto === null;
|
|
7
7
|
}
|
|
8
|
+
function isIndexName(k) {
|
|
9
|
+
const n = Number(k);
|
|
10
|
+
return String(n >>> 0) === k && n !== 4_294_967_295;
|
|
11
|
+
}
|
|
8
12
|
function isOrdinaryArray(v) {
|
|
9
13
|
return Array.isArray(v) && Object.getPrototypeOf(v) === Array.prototype;
|
|
10
14
|
}
|
|
15
|
+
const DATE_TO_JSON = Date.prototype.toJSON;
|
|
16
|
+
const DATE_TIME = Date.prototype.getTime;
|
|
17
|
+
const DATE_ISO = Date.prototype.toISOString;
|
|
18
|
+
const TYPED_ARRAY_PROTO = Object.getPrototypeOf(Uint8Array.prototype);
|
|
19
|
+
const TYPED_ARRAY_NAME = Object.getOwnPropertyDescriptor(TYPED_ARRAY_PROTO, Symbol.toStringTag).get;
|
|
20
|
+
const TYPED_ARRAY_LENGTH = Object.getOwnPropertyDescriptor(TYPED_ARRAY_PROTO, "length").get;
|
|
21
|
+
const TYPED_ARRAY_SET = TYPED_ARRAY_PROTO.set;
|
|
22
|
+
const FLOAT64_ARRAY = Float64Array;
|
|
23
|
+
const ARRAY = Array;
|
|
24
|
+
const ARRAY_PROTOTYPE = Array.prototype;
|
|
25
|
+
const ARRAY_SLICE = Array.prototype.slice;
|
|
26
|
+
const OBJECT_PROTOTYPE = Object.prototype;
|
|
27
|
+
const HAS_OWN = Object.hasOwn;
|
|
28
|
+
const OWN_KEYS_ENUMERABLE = Object.keys;
|
|
29
|
+
const SET_PROTOTYPE = Object.setPrototypeOf;
|
|
30
|
+
const DEFINE = Reflect.defineProperty;
|
|
31
|
+
export function dataMember(value) {
|
|
32
|
+
const d = Object.create(null);
|
|
33
|
+
d.value = value;
|
|
34
|
+
d.writable = true;
|
|
35
|
+
d.enumerable = true;
|
|
36
|
+
d.configurable = true;
|
|
37
|
+
return d;
|
|
38
|
+
}
|
|
39
|
+
export function appendOwn(list, value) {
|
|
40
|
+
DEFINE(list, list.length, dataMember(value));
|
|
41
|
+
}
|
|
42
|
+
function listOnNoPrototype(list = []) {
|
|
43
|
+
return SET_PROTOTYPE(list, null);
|
|
44
|
+
}
|
|
45
|
+
const recordOnNoPrototype = () => Object.create(null);
|
|
46
|
+
function typedArrayIndices(v, name, length) {
|
|
47
|
+
const out = recordOnNoPrototype();
|
|
48
|
+
if (name === "BigInt64Array" || name === "BigUint64Array")
|
|
49
|
+
return out;
|
|
50
|
+
const copy = new FLOAT64_ARRAY(length);
|
|
51
|
+
Reflect.apply(TYPED_ARRAY_SET, copy, [v]);
|
|
52
|
+
for (let i = 0; i < length; i++)
|
|
53
|
+
out[i] = copy[i];
|
|
54
|
+
return out;
|
|
55
|
+
}
|
|
56
|
+
function readOwnMember(v, key, cell) {
|
|
57
|
+
try {
|
|
58
|
+
cell.value = v[key];
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const NO_MEMBERS = Object.freeze(Object.create(null));
|
|
66
|
+
const NO_KEYS = Object.freeze([]);
|
|
67
|
+
function denseList(v, length) {
|
|
68
|
+
let holes = 0;
|
|
69
|
+
for (let i = 0; i < length; i++)
|
|
70
|
+
if (!HAS_OWN(v, i) && ++holes > 64 && holes * 2 > i + 1)
|
|
71
|
+
return false;
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
11
74
|
export function receive(value, mode, held) {
|
|
12
75
|
const seen = new Map();
|
|
13
|
-
const path =
|
|
76
|
+
const path = listOnNoPrototype();
|
|
77
|
+
const pathTo = (below) => {
|
|
78
|
+
const names = Reflect.apply(ARRAY_SLICE, path, []);
|
|
79
|
+
if (below !== undefined)
|
|
80
|
+
appendOwn(names, below);
|
|
81
|
+
return Object.freeze(names);
|
|
82
|
+
};
|
|
14
83
|
const open = new Set();
|
|
15
84
|
const heights = new Map();
|
|
16
85
|
const faults = [];
|
|
17
86
|
const refusedAt = new Map();
|
|
18
|
-
const stack =
|
|
87
|
+
const stack = listOnNoPrototype();
|
|
19
88
|
const refusals = new Set();
|
|
20
89
|
const refuse = (kind) => {
|
|
21
|
-
const fault = Object.freeze({ kind, path:
|
|
90
|
+
const fault = Object.freeze({ kind, path: pathTo() });
|
|
22
91
|
refusals.add(fault);
|
|
23
92
|
throw fault;
|
|
24
93
|
};
|
|
25
|
-
const faultOf = (err) => typeof err === "object" && err !== null && refusals.has(err) ? err : Object.freeze({ kind: "uncopyable", path:
|
|
26
|
-
const
|
|
94
|
+
const faultOf = (err) => typeof err === "object" && err !== null && refusals.has(err) ? err : Object.freeze({ kind: "uncopyable", path: pathTo() });
|
|
95
|
+
const clones = new Map();
|
|
96
|
+
const leafOf = (v) => {
|
|
97
|
+
if (!clones.has(v)) {
|
|
98
|
+
let own = v;
|
|
99
|
+
try {
|
|
100
|
+
if (typeof v !== "function")
|
|
101
|
+
own = structuredClone(v);
|
|
102
|
+
}
|
|
103
|
+
catch {
|
|
104
|
+
}
|
|
105
|
+
clones.set(v, own);
|
|
106
|
+
}
|
|
107
|
+
return clones.get(v);
|
|
108
|
+
};
|
|
109
|
+
const other = (v, kind) => {
|
|
110
|
+
if (mode.others !== "as-is")
|
|
111
|
+
return refuse(kind);
|
|
112
|
+
return mode.leaves !== undefined && kind === "not-data" && v !== null && (typeof v === "object" || typeof v === "function") ? leafOf(v) : v;
|
|
113
|
+
};
|
|
114
|
+
const wireForm = (v) => {
|
|
115
|
+
for (let o = v; o !== null; o = Object.getPrototypeOf(o)) {
|
|
116
|
+
if (o !== v && mode.isProxy?.(o) === true)
|
|
117
|
+
return refuse("proxy");
|
|
118
|
+
const d = Object.getOwnPropertyDescriptor(o, "toJSON");
|
|
119
|
+
if (d === undefined)
|
|
120
|
+
continue;
|
|
121
|
+
if (!Object.hasOwn(d, "value"))
|
|
122
|
+
return refuse("not-data");
|
|
123
|
+
if (typeof d.value !== "function")
|
|
124
|
+
return v;
|
|
125
|
+
if (d.value !== DATE_TO_JSON)
|
|
126
|
+
return refuse("not-data");
|
|
127
|
+
try {
|
|
128
|
+
return Number.isFinite(Reflect.apply(DATE_TIME, v, [])) ? Reflect.apply(DATE_ISO, v, []) : null;
|
|
129
|
+
}
|
|
130
|
+
catch {
|
|
131
|
+
return refuse("not-data");
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return v;
|
|
135
|
+
};
|
|
27
136
|
const refuseContainer = (v, kind) => {
|
|
28
137
|
if (mode.contain === true) {
|
|
29
138
|
refusedAt.set(v, kind);
|
|
@@ -74,12 +183,44 @@ export function receive(value, mode, held) {
|
|
|
74
183
|
return other(v, "too-deep");
|
|
75
184
|
if (mode.isProxy?.(v) === true)
|
|
76
185
|
return refuse("proxy");
|
|
186
|
+
if (mode.wire === true) {
|
|
187
|
+
const form = wireForm(v);
|
|
188
|
+
if (form !== v)
|
|
189
|
+
return form;
|
|
190
|
+
const name = Reflect.apply(TYPED_ARRAY_NAME, v, []);
|
|
191
|
+
if (typeof name === "string") {
|
|
192
|
+
const length = Reflect.apply(TYPED_ARRAY_LENGTH, v, []);
|
|
193
|
+
let out;
|
|
194
|
+
try {
|
|
195
|
+
out = typedArrayIndices(v, name, length);
|
|
196
|
+
}
|
|
197
|
+
catch {
|
|
198
|
+
out = recordOnNoPrototype();
|
|
199
|
+
}
|
|
200
|
+
const captured = Object.create(null);
|
|
201
|
+
const names = Object.keys(v);
|
|
202
|
+
let first = names.length;
|
|
203
|
+
while (first > 0 && !isIndexName(names[first - 1]))
|
|
204
|
+
first--;
|
|
205
|
+
for (const k of names.slice(first)) {
|
|
206
|
+
const d = Object.getOwnPropertyDescriptor(v, k);
|
|
207
|
+
if (d !== undefined)
|
|
208
|
+
captured[k] = d;
|
|
209
|
+
}
|
|
210
|
+
seen.set(v, out);
|
|
211
|
+
open.add(v);
|
|
212
|
+
stack[stack.length] = { v, out, list: false, proto: Object.getPrototypeOf(v), captured, keys: Object.keys(captured), level, next: 0, height: 1, key: "", member: undefined };
|
|
213
|
+
return out;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
77
216
|
const list = isOrdinaryArray(v) || (mode.others === "copy" && Array.isArray(v));
|
|
78
217
|
if (!list && !isPlainRecord(v) && mode.others !== "copy")
|
|
79
218
|
return other(v, "not-data");
|
|
219
|
+
if (mode.wire === true && (!list || denseList(v, v.length)))
|
|
220
|
+
return readInOnePass(v, list, level);
|
|
80
221
|
const proto = Object.getPrototypeOf(v);
|
|
81
222
|
const captured = Object.getOwnPropertyDescriptors(v);
|
|
82
|
-
const out = list ?
|
|
223
|
+
const out = list ? listOnNoPrototype() : recordOnNoPrototype();
|
|
83
224
|
seen.set(v, out);
|
|
84
225
|
open.add(v);
|
|
85
226
|
if (mode.accessors === "refuse") {
|
|
@@ -87,15 +228,64 @@ export function receive(value, mode, held) {
|
|
|
87
228
|
if (symbols.length > 0 && mode.contain !== true)
|
|
88
229
|
refuseContainer(v, "hidden");
|
|
89
230
|
for (const s of symbols)
|
|
90
|
-
faults
|
|
231
|
+
appendOwn(faults, Object.freeze({ kind: "hidden", path: pathTo(String(s)) }));
|
|
91
232
|
}
|
|
92
|
-
|
|
233
|
+
const names = Object.getOwnPropertyNames(captured);
|
|
234
|
+
const keys = mode.wire !== true ? names : names.filter((k) => (list ? isIndexName(k) : captured[k].enumerable === true));
|
|
235
|
+
stack[stack.length] = { v, out, list, proto, captured, keys, level, next: 0, height: 1, key: "", member: undefined };
|
|
93
236
|
return out;
|
|
94
237
|
};
|
|
238
|
+
const readInOnePass = (v, list, level) => {
|
|
239
|
+
const names = list ? undefined : OWN_KEYS_ENUMERABLE(v);
|
|
240
|
+
const count = list ? v.length : names.length;
|
|
241
|
+
const out = (list ? listOnNoPrototype(new ARRAY(count)) : recordOnNoPrototype());
|
|
242
|
+
seen.set(v, out);
|
|
243
|
+
open.add(v);
|
|
244
|
+
const f = { v, out, list, proto: Object.getPrototypeOf(v), captured: NO_MEMBERS, keys: NO_KEYS, live: { names, count, pending: undefined }, level, next: 0, height: 1, key: "", member: undefined };
|
|
245
|
+
f.live.pending = primitivesUpToAnObject(f);
|
|
246
|
+
if (f.live.pending === undefined)
|
|
247
|
+
return finish(f);
|
|
248
|
+
stack[stack.length] = f;
|
|
249
|
+
return out;
|
|
250
|
+
};
|
|
251
|
+
const read = { value: undefined };
|
|
252
|
+
const primitivesUpToAnObject = (f) => {
|
|
253
|
+
const { names, count } = f.live;
|
|
254
|
+
const v = f.v;
|
|
255
|
+
const into = f.out;
|
|
256
|
+
while (f.next < count) {
|
|
257
|
+
const key = names === undefined ? f.next : names[f.next];
|
|
258
|
+
f.next++;
|
|
259
|
+
if (!HAS_OWN(v, key))
|
|
260
|
+
continue;
|
|
261
|
+
if (!readOwnMember(v, key, read)) {
|
|
262
|
+
memberLeftOut(String(key), "getter-threw");
|
|
263
|
+
continue;
|
|
264
|
+
}
|
|
265
|
+
const member = read.value;
|
|
266
|
+
read.value = undefined;
|
|
267
|
+
if (member === null || member === undefined || typeof member === "string" || typeof member === "number" || typeof member === "boolean")
|
|
268
|
+
into[key] = member;
|
|
269
|
+
else if (typeof member === "object") {
|
|
270
|
+
into[key] = undefined;
|
|
271
|
+
return { key: String(key), member };
|
|
272
|
+
}
|
|
273
|
+
else
|
|
274
|
+
memberLeftOut(String(key), "not-data");
|
|
275
|
+
}
|
|
276
|
+
return undefined;
|
|
277
|
+
};
|
|
278
|
+
const memberLeftOut = (key, kind) => {
|
|
279
|
+
if (mode.contain !== true) {
|
|
280
|
+
path[path.length] = key;
|
|
281
|
+
refuse(kind);
|
|
282
|
+
}
|
|
283
|
+
appendOwn(faults, Object.freeze({ kind, path: pathTo(key) }));
|
|
284
|
+
};
|
|
95
285
|
const land = (f, key, copy, member) => {
|
|
96
286
|
if (measured && typeof member === "object" && member !== null)
|
|
97
287
|
f.height = Math.max(f.height, heightOf(member) + 1);
|
|
98
|
-
|
|
288
|
+
f.out[key] = copy;
|
|
99
289
|
path.length = f.level;
|
|
100
290
|
};
|
|
101
291
|
const finish = (f) => {
|
|
@@ -107,6 +297,7 @@ export function receive(value, mode, held) {
|
|
|
107
297
|
if (typeof length === "number")
|
|
108
298
|
f.out.length = length;
|
|
109
299
|
}
|
|
300
|
+
SET_PROTOTYPE(f.out, Array.isArray(f.out) ? ARRAY_PROTOTYPE : OBJECT_PROTOTYPE);
|
|
110
301
|
if (mode.freeze === true)
|
|
111
302
|
Object.freeze(f.out);
|
|
112
303
|
open.delete(f.v);
|
|
@@ -123,13 +314,34 @@ export function receive(value, mode, held) {
|
|
|
123
314
|
}
|
|
124
315
|
for (;;) {
|
|
125
316
|
const f = stack[stack.length - 1];
|
|
126
|
-
|
|
127
|
-
|
|
317
|
+
let key;
|
|
318
|
+
let captured;
|
|
319
|
+
let member;
|
|
320
|
+
if (f.live !== undefined) {
|
|
321
|
+
let next = f.live.pending;
|
|
322
|
+
f.live.pending = undefined;
|
|
323
|
+
if (next === undefined) {
|
|
324
|
+
try {
|
|
325
|
+
next = primitivesUpToAnObject(f);
|
|
326
|
+
}
|
|
327
|
+
catch (err) {
|
|
328
|
+
return { ok: false, fault: faultOf(err) };
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
if (next !== undefined)
|
|
332
|
+
({ key, member } = next);
|
|
333
|
+
}
|
|
334
|
+
else if (f.next < f.keys.length) {
|
|
335
|
+
key = f.keys[f.next++];
|
|
128
336
|
if (f.list && key === "length")
|
|
129
337
|
continue;
|
|
130
|
-
|
|
338
|
+
captured = f.captured[key];
|
|
339
|
+
}
|
|
340
|
+
if (key !== undefined) {
|
|
341
|
+
path[path.length] = key;
|
|
131
342
|
try {
|
|
132
|
-
|
|
343
|
+
if (captured !== undefined)
|
|
344
|
+
member = memberOf(f.v, captured);
|
|
133
345
|
const frames = stack.length;
|
|
134
346
|
const copy = meet(member, f.level + 1);
|
|
135
347
|
if (stack.length > frames) {
|
|
@@ -142,7 +354,8 @@ export function receive(value, mode, held) {
|
|
|
142
354
|
catch (err) {
|
|
143
355
|
if (mode.contain !== true)
|
|
144
356
|
return { ok: false, fault: faultOf(err) };
|
|
145
|
-
faults
|
|
357
|
+
appendOwn(faults, faultOf(err));
|
|
358
|
+
delete f.out[key];
|
|
146
359
|
path.length = f.level;
|
|
147
360
|
}
|
|
148
361
|
continue;
|
|
@@ -152,15 +365,16 @@ export function receive(value, mode, held) {
|
|
|
152
365
|
copy = finish(f);
|
|
153
366
|
}
|
|
154
367
|
catch (err) {
|
|
155
|
-
stack.
|
|
368
|
+
stack.length -= 1;
|
|
156
369
|
const holder = stack[stack.length - 1];
|
|
157
370
|
if (mode.contain !== true || holder === undefined)
|
|
158
371
|
return { ok: false, fault: faultOf(err) };
|
|
159
|
-
faults
|
|
372
|
+
appendOwn(faults, faultOf(err));
|
|
373
|
+
delete holder.out[holder.key];
|
|
160
374
|
path.length = holder.level;
|
|
161
375
|
continue;
|
|
162
376
|
}
|
|
163
|
-
stack.
|
|
377
|
+
stack.length -= 1;
|
|
164
378
|
const holder = stack[stack.length - 1];
|
|
165
379
|
if (holder === undefined)
|
|
166
380
|
return received(copy);
|
|
@@ -191,3 +405,62 @@ export function describeFault(fault) {
|
|
|
191
405
|
return `a value that could not be copied whole${at}`;
|
|
192
406
|
}
|
|
193
407
|
}
|
|
408
|
+
export function sealedObjects(roots) {
|
|
409
|
+
const holders = new WeakMap();
|
|
410
|
+
const met = new Set();
|
|
411
|
+
const unsealed = [];
|
|
412
|
+
const stack = [...roots];
|
|
413
|
+
while (stack.length > 0) {
|
|
414
|
+
const v = stack.pop();
|
|
415
|
+
if (typeof v !== "object" || v === null || met.has(v))
|
|
416
|
+
continue;
|
|
417
|
+
met.add(v);
|
|
418
|
+
const container = isPlainRecord(v) || (Array.isArray(v) && Object.getPrototypeOf(v) === Array.prototype);
|
|
419
|
+
if (!container) {
|
|
420
|
+
unsealed.push(v);
|
|
421
|
+
continue;
|
|
422
|
+
}
|
|
423
|
+
if (!Object.isFrozen(v))
|
|
424
|
+
unsealed.push(v);
|
|
425
|
+
const descriptors = Object.getOwnPropertyDescriptors(v);
|
|
426
|
+
if (Object.getOwnPropertySymbols(descriptors).length > 0)
|
|
427
|
+
unsealed.push(v);
|
|
428
|
+
for (const k of Object.getOwnPropertyNames(descriptors)) {
|
|
429
|
+
if (Array.isArray(v) && k === "length")
|
|
430
|
+
continue;
|
|
431
|
+
const d = descriptors[k];
|
|
432
|
+
if (!Object.hasOwn(d, "value") || d.enumerable !== true) {
|
|
433
|
+
unsealed.push(v);
|
|
434
|
+
continue;
|
|
435
|
+
}
|
|
436
|
+
const m = d.value;
|
|
437
|
+
if (typeof m === "bigint" || typeof m === "symbol" || typeof m === "function")
|
|
438
|
+
unsealed.push(v);
|
|
439
|
+
else if (typeof m === "object" && m !== null) {
|
|
440
|
+
const by = holders.get(m);
|
|
441
|
+
if (by === undefined)
|
|
442
|
+
holders.set(m, [v]);
|
|
443
|
+
else
|
|
444
|
+
by.push(v);
|
|
445
|
+
stack.push(m);
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
return withoutUnsealed(met, unsealed, holders);
|
|
450
|
+
}
|
|
451
|
+
function withoutUnsealed(objects, unsealed, holders) {
|
|
452
|
+
const bad = new Set();
|
|
453
|
+
while (unsealed.length > 0) {
|
|
454
|
+
const v = unsealed.pop();
|
|
455
|
+
if (bad.has(v))
|
|
456
|
+
continue;
|
|
457
|
+
bad.add(v);
|
|
458
|
+
for (const h of holders.get(v) ?? [])
|
|
459
|
+
unsealed.push(h);
|
|
460
|
+
}
|
|
461
|
+
const sealed = new Set();
|
|
462
|
+
for (const v of objects)
|
|
463
|
+
if (!bad.has(v))
|
|
464
|
+
sealed.add(v);
|
|
465
|
+
return sealed;
|
|
466
|
+
}
|
|
@@ -11,9 +11,9 @@ export declare const MODS_INVALID_CODE = "config.mods_invalid";
|
|
|
11
11
|
export declare const MODS_REGISTRATION_REFUSED_CODE = "mods.registration_refused";
|
|
12
12
|
/** What a registration declares it will touch — the upper bound the kernel holds it to. */
|
|
13
13
|
export interface ModUses {
|
|
14
|
-
/** Events it hangs handlers on (names or `<prefix
|
|
14
|
+
/** Events it hangs handlers on (names or `<prefix>.*`, of its bus's side). */
|
|
15
15
|
readonly events: readonly string[];
|
|
16
|
-
/** `$`
|
|
16
|
+
/** The `$` members it calls — methods and callable events (names or `<prefix>.*`, of its bus's side). */
|
|
17
17
|
readonly calls: readonly string[];
|
|
18
18
|
}
|
|
19
19
|
/** Who raised a dispatch: a registration (through its `$`), or the engine (`{plugin: "engine", tier: "core"}`). */
|
|
@@ -69,11 +69,42 @@ export interface ModHandlerOptions<D extends ModDollarBase = ModDollarBase> {
|
|
|
69
69
|
/** Watch only: a detached `e`, outside the chain, its answer refused and disclosed. */
|
|
70
70
|
readonly observe?: boolean;
|
|
71
71
|
}
|
|
72
|
+
/** One event's `e` and answer form, as an event map pairs them. */
|
|
73
|
+
export interface ModEventPair {
|
|
74
|
+
readonly e: object;
|
|
75
|
+
readonly answer: unknown;
|
|
76
|
+
}
|
|
77
|
+
/** A side's typing of its events: each event name with its `e` and its answer form (the engine's is `ClassicEventMap`). */
|
|
78
|
+
export type ModEventMap = {
|
|
79
|
+
readonly [name: string]: ModEventPair;
|
|
80
|
+
};
|
|
81
|
+
/** `next` as a handler of a mapped event sees it: it takes that event's `e` and resolves with its answer form. */
|
|
82
|
+
export interface ModTypedNext<P extends ModEventPair> {
|
|
83
|
+
(e: P["e"]): Promise<P["answer"]>;
|
|
84
|
+
to(e: P["e"], tier: ModTier): Promise<P["answer"]>;
|
|
85
|
+
readonly origin: ModOrigin;
|
|
86
|
+
readonly signal: AbortSignal;
|
|
87
|
+
readonly trace: readonly ModTraceEntry[];
|
|
88
|
+
readonly budget: ModBudgetReading;
|
|
89
|
+
readonly error?: ModCaughtError;
|
|
90
|
+
readonly called?: boolean;
|
|
91
|
+
}
|
|
92
|
+
/** A handler of a mapped event: its `e` and its answer typed by the map. */
|
|
93
|
+
export type ModTypedHandler<D extends ModDollarBase, P extends ModEventPair> = ($: D, e: P["e"], next: ModTypedNext<P>) => P["answer"] | Promise<P["answer"]>;
|
|
72
94
|
/** `on(pattern, handler, options?)` or `on(pattern, matcher, handler, options?)`. */
|
|
73
95
|
export interface On<D extends ModDollarBase = ModDollarBase> {
|
|
74
96
|
(pattern: string, handler: ModHandler<D>, options?: ModHandlerOptions<D>): void;
|
|
75
97
|
(pattern: string, matcher: ModMatcher, handler: ModHandler<D>, options?: ModHandlerOptions<D>): void;
|
|
76
98
|
}
|
|
99
|
+
/** {@link On} given its side's event map `M`: a pattern that is one of the map's names types its handler by that event;
|
|
100
|
+
* any other pattern (a `<prefix>.*`, a name the map does not pair) takes the untyped handler. A side types its own
|
|
101
|
+
* registrations by declaring `register(on: MappedOn<D, M>, options)` — they stay registrations of the kernel's form. */
|
|
102
|
+
export interface MappedOn<D extends ModDollarBase, M extends ModEventMap> {
|
|
103
|
+
<K extends keyof M & string>(pattern: K, handler: ModTypedHandler<D, M[K]>, options?: ModHandlerOptions<D>): void;
|
|
104
|
+
<K extends keyof M & string>(pattern: K, matcher: ModMatcher, handler: ModTypedHandler<D, M[K]>, options?: ModHandlerOptions<D>): void;
|
|
105
|
+
(pattern: string, handler: ModHandler<D>, options?: ModHandlerOptions<D>): void;
|
|
106
|
+
(pattern: string, matcher: ModMatcher, handler: ModHandler<D>, options?: ModHandlerOptions<D>): void;
|
|
107
|
+
}
|
|
77
108
|
export interface ModRegistration<D extends ModDollarBase = ModDollarBase> {
|
|
78
109
|
/** Unique in the run; names the registration everywhere (origin, trace, disclosures, admission). */
|
|
79
110
|
readonly name: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { describe,
|
|
1
|
+
import { describe, expandOnSide, MOD_SEATS, SEAT_TIER_TABLE, } from "./events.js";
|
|
2
2
|
import { resolveModBudgetMs } from "./budget.js";
|
|
3
3
|
export const MODS_INVALID_CODE = "config.mods_invalid";
|
|
4
4
|
export const MODS_REGISTRATION_REFUSED_CODE = "mods.registration_refused";
|
|
@@ -44,13 +44,12 @@ function screenOne(item, seat, side, report) {
|
|
|
44
44
|
throw modsInvalid(`${name}: provenance is ${describe(item.provenance)}; it is a label (a string)`);
|
|
45
45
|
const eventsBound = new Set();
|
|
46
46
|
for (const p of uses.events)
|
|
47
|
-
for (const n of namesOf(p, name, "uses.events"))
|
|
47
|
+
for (const n of namesOf(p, name, "uses.events", side))
|
|
48
48
|
eventsBound.add(n);
|
|
49
49
|
const callsBound = new Set();
|
|
50
50
|
for (const c of uses.calls)
|
|
51
|
-
for (const n of namesOf(c, name, "uses.calls"))
|
|
52
|
-
|
|
53
|
-
callsBound.add(n);
|
|
51
|
+
for (const n of namesOf(c, name, "uses.calls", side))
|
|
52
|
+
callsBound.add(n);
|
|
54
53
|
return {
|
|
55
54
|
registration: item,
|
|
56
55
|
name,
|
|
@@ -94,8 +93,8 @@ function stringList(v, name, field) {
|
|
|
94
93
|
}
|
|
95
94
|
return Object.freeze(out);
|
|
96
95
|
}
|
|
97
|
-
function namesOf(pattern, name, field) {
|
|
98
|
-
const expanded =
|
|
96
|
+
function namesOf(pattern, name, field, side) {
|
|
97
|
+
const expanded = expandOnSide(pattern, side);
|
|
99
98
|
if ("refusal" in expanded)
|
|
100
99
|
throw modsInvalid(`${name}: ${field}: ${expanded.refusal}`);
|
|
101
100
|
return expanded.names;
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* failure column like a crash but never reported as one (no code crashed).
|
|
5
5
|
*/
|
|
6
6
|
import { type ModSeat, type ModTier } from "./events.js";
|
|
7
|
+
export { sealedObjects } from "./receive.js";
|
|
7
8
|
/** The host's Proxy probe (this folder cannot recognise a Proxy on its own): with one, a handler's Proxy is refused
|
|
8
9
|
* before any of its traps runs; without one, it is read like any object. */
|
|
9
10
|
export type ProxyProbe = (value: object) => boolean;
|
|
@@ -42,10 +43,24 @@ export interface ModAnswerer {
|
|
|
42
43
|
export declare const NEXT_IN_FLIGHT: Readonly<{
|
|
43
44
|
inFlight: true;
|
|
44
45
|
}>;
|
|
46
|
+
/** What a dispatch records of its own run, as a station's answer check reads it. */
|
|
47
|
+
export interface ModDispatchRun {
|
|
48
|
+
/** Whether the chain's bottom (the core of the event — on an effect event, the effect) has started in this dispatch. */
|
|
49
|
+
readonly bottomStarted: boolean;
|
|
50
|
+
}
|
|
45
51
|
/** The station's own reading of an answer: undefined when it is one the station takes, else why not. `below` is every
|
|
46
52
|
* answer the handler's `next` resolved with, plus `NEXT_IN_FLIGHT` while its `next` is still in flight —
|
|
47
|
-
* empty when it never called `next`. */
|
|
48
|
-
export type ModAnswerCheck = (answer: unknown, e: ModEventPayload, by: ModAnswerer, below: readonly unknown[]) => string | undefined;
|
|
53
|
+
* empty when it never called `next`. `run` is what the dispatch records of its run when the answer is read. */
|
|
54
|
+
export type ModAnswerCheck = (answer: unknown, e: ModEventPayload, by: ModAnswerer, below: readonly unknown[], run: ModDispatchRun) => string | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* A refusing event's ranking of its answers by how much they refuse: `of(answer)` is 0 for an answer that passes the
|
|
57
|
+
* event on as it stands and higher for one that refuses more; `top` is the rank of an outright refusal. The seat-trust
|
|
58
|
+
* law reads it: an answer from a less trusted seat never stands over a stricter one a more trusted seat gave below it.
|
|
59
|
+
*/
|
|
60
|
+
export interface ModAnswerRanks {
|
|
61
|
+
readonly of: (answer: unknown) => number;
|
|
62
|
+
readonly top: number;
|
|
63
|
+
}
|
|
49
64
|
/** A matcher: top-level fields of `e` that must equal these values exactly. */
|
|
50
65
|
export type ModMatcher = Readonly<Record<string, string | number | boolean>>;
|
|
51
66
|
/** Why a pinned key of what a handler handed on is not taken: it holds another value, or it is a copy the comparison
|
|
@@ -93,7 +108,7 @@ export declare function pinnedHandOn(pinned: readonly string[], held: ModEventPa
|
|
|
93
108
|
readonly violation: string;
|
|
94
109
|
};
|
|
95
110
|
/** Why a handler's answer breaks the site, or undefined. No answer at all is never an answer. */
|
|
96
|
-
export declare function answerViolation(answer: unknown, check: ModAnswerCheck | undefined, e: ModEventPayload, by: ModAnswerer, below: readonly unknown[]): string | undefined;
|
|
111
|
+
export declare function answerViolation(answer: unknown, check: ModAnswerCheck | undefined, e: ModEventPayload, by: ModAnswerer, below: readonly unknown[], run: ModDispatchRun): string | undefined;
|
|
97
112
|
/**
|
|
98
113
|
* A `$` method's answer form: `{ value }` (the call's result) or `{ deny }` (the call throws). A `{ deny }` given after
|
|
99
114
|
* the handler's `next` was answered with something that is not a deny — or while that `next` is still running — breaks
|
|
@@ -124,15 +139,28 @@ export declare function receiveEvent(e: unknown): {
|
|
|
124
139
|
readonly refusal: string;
|
|
125
140
|
};
|
|
126
141
|
/**
|
|
127
|
-
* The bottom's answer as it starts up the chain
|
|
128
|
-
*
|
|
129
|
-
*
|
|
142
|
+
* The bottom's answer as it starts up the chain — a seat's value handed to the handlers above it — received by the one
|
|
143
|
+
* receipt as data, frozen all the way down, so no handler can turn what its `next` answered into something else (a deny
|
|
144
|
+
* in place of a result that already ran, a member planted in a seat's value the caller then reads): a mutation attempt
|
|
145
|
+
* throws, and the handler's failure is reported like any other. A value sealed already (frozen data all the way down —
|
|
146
|
+
* an engine sentinel, a station's view) is itself; any other plain container is copied, every level frozen; an object of
|
|
147
|
+
* another kind (an engine object, not data) is handed as it is. A value the receipt refuses (an accessor, a Proxy) is the
|
|
148
|
+
* bottom's own fault: thrown.
|
|
149
|
+
*/
|
|
150
|
+
export declare function answerUpward(v: unknown, isProxy?: ProxyProbe): unknown;
|
|
151
|
+
/** The objects an answer may hold as themselves: an object the bus already holds (`has`), never walked by the receipt. */
|
|
152
|
+
export interface ModHeldObjects {
|
|
153
|
+
has(value: object): boolean;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* A handler's answer, received as DATA — the one place an answer becomes what the station reads: a primitive, or an
|
|
157
|
+
* ordinary record or array copied whole and frozen (no accessor runs, held to {@link MODS_VALUE_DEPTH}), every value in
|
|
158
|
+
* it data too. A function, an object of another kind (a class instance, a `Map`), a symbol, a bigint or a cycle the
|
|
159
|
+
* handler built refuses the answer — a violation of the site — so what a station checks is what it reads, however often
|
|
160
|
+
* it reads it. An object the bus already holds (`held`: the dispatch's own event, and what the handler's `next` answered)
|
|
161
|
+
* is kept as itself, never walked.
|
|
130
162
|
*/
|
|
131
|
-
export declare function
|
|
132
|
-
/** A handler's answer, received by the same receipt held to {@link MODS_VALUE_DEPTH} (an answer need not be a record; a
|
|
133
|
-
* primitive is itself); an object of the dispatch's own event in it (`engines`, {@link engineObjectsOnce}) is kept as
|
|
134
|
-
* itself, never walked. */
|
|
135
|
-
export declare function receiveAnswer(answer: unknown, engines: ReadonlySet<object>, isProxy?: ProxyProbe): {
|
|
163
|
+
export declare function receiveAnswer(answer: unknown, held: ModHeldObjects, isProxy?: ProxyProbe): {
|
|
136
164
|
readonly answer: unknown;
|
|
137
165
|
} | {
|
|
138
166
|
readonly refusal: string;
|
|
@@ -140,10 +168,10 @@ export declare function receiveAnswer(answer: unknown, engines: ReadonlySet<obje
|
|
|
140
168
|
/**
|
|
141
169
|
* A copy for an observe handler, made by the one receipt (its own stack, so no depth of the event decides whether an
|
|
142
170
|
* observer runs — the event it observes was received at any depth too): every data container (a plain object, an
|
|
143
|
-
* ordinary array) detached at any depth
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
171
|
+
* ordinary array) detached at any depth, and every other object the copy holds — a tool result's `Map`, `Date` or typed
|
|
172
|
+
* array — detached by the receipt's leaf law (a structured clone of that object alone; one the clone refuses — a
|
|
173
|
+
* function, a handle, a class instance holding one — handed as is). The engine's own event holds data properties only,
|
|
174
|
+
* so the copy is whole; a receipt that could not make it (a Proxy whose trap throws, on a bus given no probe) is the
|
|
175
|
+
* observer's failure, reported like any other.
|
|
148
176
|
*/
|
|
149
177
|
export declare function detachedCopy(e: ModEventPayload): Record<string, unknown>;
|