@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
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { PreToolUseResult } from "./hooks.js";
|
|
2
|
+
import type { PermissionResult } from "./tool-policy.js";
|
|
3
|
+
import type { PreToolUseScreening } from "./runner/gate-exit.js";
|
|
4
|
+
/** What a judge did with the bytes it was handed: kept them (`as_is`), or handed back another form. */
|
|
5
|
+
export type RejudgeReading = {
|
|
6
|
+
readonly kind: "as_is";
|
|
7
|
+
} | {
|
|
8
|
+
readonly kind: "rewritten";
|
|
9
|
+
readonly form: unknown;
|
|
10
|
+
};
|
|
11
|
+
/** Do `a` and `b` read as the same bytes for the call `req` — each as the tool reads it? */
|
|
12
|
+
export declare function sameBytes(req: {
|
|
13
|
+
readonly face?: object | undefined;
|
|
14
|
+
}, a: unknown, b: unknown): boolean;
|
|
15
|
+
/** The one reading of a judge's answer about the bytes it was handed (`given`): its `updatedInput` is a rewrite only when it
|
|
16
|
+
* reads as other bytes; the form is returned as the tool reads it. */
|
|
17
|
+
export declare function readRejudge(req: {
|
|
18
|
+
readonly face?: object | undefined;
|
|
19
|
+
}, given: unknown, answer: {
|
|
20
|
+
readonly updatedInput?: unknown;
|
|
21
|
+
} | undefined): RejudgeReading;
|
|
22
|
+
/** What the PreToolUse screening said on its one second look at bytes rewritten after it judged: its verdict on them
|
|
23
|
+
* (`stands` — no opinion, an allow, an ask; never a rewrite), or a refusal — the hook's own deny, or the engine's
|
|
24
|
+
* (the screening failed, or it handed back yet another form). */
|
|
25
|
+
export type ScreeningRejudge = {
|
|
26
|
+
readonly kind: "stands";
|
|
27
|
+
readonly answer: PreToolUseResult | undefined;
|
|
28
|
+
readonly answeredBy?: string;
|
|
29
|
+
} | {
|
|
30
|
+
readonly kind: "refused";
|
|
31
|
+
readonly reason: string;
|
|
32
|
+
readonly by: "hook" | "engine";
|
|
33
|
+
};
|
|
34
|
+
/** The screening's second look at rewritten `bytes` (the gate's fold after a policy rewrite; the approved-edit pass). */
|
|
35
|
+
export declare function screenRewrite(screening: PreToolUseScreening, req: {
|
|
36
|
+
readonly face?: object | undefined;
|
|
37
|
+
readonly toolName: string;
|
|
38
|
+
}, bytes: unknown, subject: string): Promise<ScreeningRejudge>;
|
|
39
|
+
/**
|
|
40
|
+
* A person's edit the restriction chain accepts only in another form: that form, as the tool reads it. Machine-readable, so
|
|
41
|
+
* a surface can offer "approve this form" — approving it as it stands runs exactly these bytes (they are the chain's own
|
|
42
|
+
* answer, so re-judging them changes nothing). Present on the approval request of the question that puts the form to the person,
|
|
43
|
+
* on a durable resume's refusal (`detail.editRewritten`), and on a refusal's details where nobody is left to ask.
|
|
44
|
+
*/
|
|
45
|
+
export interface EditRewritten {
|
|
46
|
+
readonly acceptableForm: unknown;
|
|
47
|
+
}
|
|
48
|
+
/** The question that puts a person's edit back to them, over the pass's standing verdict on the form: an allow becomes
|
|
49
|
+
* this question; an ask keeps its own words after the outlet sentence (and every member it carries). It goes to the
|
|
50
|
+
* approver whose edit it answers; its classes are the pass's, read by the one ladder like any of its questions. */
|
|
51
|
+
export declare function outletAsk(standing: Exclude<PermissionResult, {
|
|
52
|
+
action: "deny";
|
|
53
|
+
}>, toolName: string, form: unknown): Extract<PermissionResult, {
|
|
54
|
+
action: "ask";
|
|
55
|
+
}>;
|
|
56
|
+
/** The one sentence of a person's edit that a judge accepts only rewritten; each lane adds its outlet (approve the form shown /
|
|
57
|
+
* decide again with it / re-issue the call). */
|
|
58
|
+
export declare function editRewrittenSentence(toolName: string): string;
|
|
59
|
+
/** The one sentence of a rewrite a judge would rewrite again on its one second look. */
|
|
60
|
+
export declare function rewriteChasedSentence(toolName: string): string;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { canonicalize } from "./canonical-json.js";
|
|
2
|
+
import { argsAsTheToolReads } from "./effective-path-target.js";
|
|
3
|
+
export function sameBytes(req, a, b) {
|
|
4
|
+
return a === b || canonicalize(argsAsTheToolReads(req, a)) === canonicalize(argsAsTheToolReads(req, b));
|
|
5
|
+
}
|
|
6
|
+
export function readRejudge(req, given, answer) {
|
|
7
|
+
const rewrite = answer?.updatedInput;
|
|
8
|
+
return rewrite === undefined || sameBytes(req, given, rewrite) ? { kind: "as_is" } : { kind: "rewritten", form: argsAsTheToolReads(req, rewrite) };
|
|
9
|
+
}
|
|
10
|
+
export async function screenRewrite(screening, req, bytes, subject) {
|
|
11
|
+
const screened = await screening.screen(bytes, subject);
|
|
12
|
+
if (screened.kind === "refused")
|
|
13
|
+
return { kind: "refused", reason: screened.reason, by: "engine" };
|
|
14
|
+
const r = screened.answer;
|
|
15
|
+
if (r?.action === "deny")
|
|
16
|
+
return { kind: "refused", reason: screening.deniedReason(r), by: "hook" };
|
|
17
|
+
if (readRejudge(req, bytes, r).kind === "rewritten")
|
|
18
|
+
return { kind: "refused", reason: rewriteChasedSentence(req.toolName), by: "engine" };
|
|
19
|
+
if (r === undefined)
|
|
20
|
+
return { kind: "stands", answer: undefined, ...(screened.answeredBy !== undefined ? { answeredBy: screened.answeredBy } : {}) };
|
|
21
|
+
const { updatedInput: _sameBytes, ...answer } = r;
|
|
22
|
+
return { kind: "stands", answer, ...(screened.answeredBy !== undefined ? { answeredBy: screened.answeredBy } : {}) };
|
|
23
|
+
}
|
|
24
|
+
export function outletAsk(standing, toolName, form) {
|
|
25
|
+
const editRewritten = { acceptableForm: form };
|
|
26
|
+
const sentence = `${editRewrittenSentence(toolName)}, shown here — approve that form as it stands, or edit again`;
|
|
27
|
+
if (standing.action === "allow")
|
|
28
|
+
return { action: "ask", message: sentence, editRewritten };
|
|
29
|
+
return { ...standing, message: standing.message !== undefined ? `${sentence}\n${standing.message}` : sentence, editRewritten };
|
|
30
|
+
}
|
|
31
|
+
export function editRewrittenSentence(toolName) {
|
|
32
|
+
return `the edit to "${toolName}" was not run as written: the restriction chain accepts it only in a rewritten form (acceptableForm)`;
|
|
33
|
+
}
|
|
34
|
+
export function rewriteChasedSentence(toolName) {
|
|
35
|
+
return `the arguments of "${toolName}" were rewritten, and a judge that saw them before the rewrite asks for yet another form — denied fail-closed (a rewrite is judged once, never chased)`;
|
|
36
|
+
}
|
package/dist/core/roles.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { ThinkingLevel } from "../internal/harness-types.js";
|
|
2
2
|
import type { Model } from "../internal/llm.js";
|
|
3
|
+
import type { HostRole } from "../prompt-assembly/catalog/schema.js";
|
|
4
|
+
import { type RoleBaseDeclaration } from "../prompt-assembly/role-base.js";
|
|
3
5
|
import { type ModelRef, type ModelRole, type ModelRoles, type RoleSpec } from "./types.js";
|
|
4
6
|
export type { ModelRole, RoleSpec, ModelRoles } from "./types.js";
|
|
5
7
|
export { MODEL_ROLES } from "./types.js";
|
|
@@ -106,6 +108,16 @@ export declare const ROLE_TIER_DEFAULTS: Readonly<Partial<Record<ModelRole, stri
|
|
|
106
108
|
* preset-only role does not disable the relative pick. One reader, the same parts {@link specParts} reads.
|
|
107
109
|
*/
|
|
108
110
|
export declare function roleSpecNamesModel(spec: RoleSpec | undefined): boolean;
|
|
111
|
+
/** Merge two role maps, field-aware per role (task `over` wins). Every key and every value of both maps is judged first: a value that is no binding
|
|
112
|
+
* (`null`, a number, a boolean, a word the catalog does not hold) is refused at its own seat before the merge reads it (the merge would otherwise read a
|
|
113
|
+
* number as a record, or let a task's bad value vanish into the base); a list or a function written at a role seat still reads as an empty record (#2223 ⑦). */
|
|
114
|
+
/**
|
|
115
|
+
* One role map's door — every key a role word, every entry a binding whose parts are each in their domain (its role word
|
|
116
|
+
* included) and whose named model has a binding's shape. `field` names the map (`RunnerDeps.roles` / `TaskSpec.roles`).
|
|
117
|
+
* Every entry is judged, read or not: a resume's screen calls it before the claim, and the merge below calls it on both
|
|
118
|
+
* maps, so an entry no task of this leg selects still refuses loudly.
|
|
119
|
+
*/
|
|
120
|
+
export declare function screenRoleMap(roles: ModelRoles | undefined, field: "RunnerDeps.roles" | "TaskSpec.roles"): void;
|
|
109
121
|
export interface ResolvedRole {
|
|
110
122
|
model: Model;
|
|
111
123
|
/**
|
|
@@ -123,9 +135,24 @@ export interface ResolvedRole {
|
|
|
123
135
|
modelRef: ModelRef;
|
|
124
136
|
/** The effective thinking level: explicit `spec.thinking` wins, else the role's default. */
|
|
125
137
|
thinking?: ThinkingLevel;
|
|
126
|
-
/** The requested role's
|
|
138
|
+
/** The requested role's role-base statement, if it made one (independent of model fallback): its word (the host role
|
|
139
|
+
* and the catalog variant it selects) and its text (which replaces that base) — the second source of the role-base
|
|
140
|
+
* decision, after the task's own (`src/prompt-assembly/role-base.ts`). */
|
|
141
|
+
promptRole?: HostRole;
|
|
127
142
|
systemPrompt?: string;
|
|
128
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* The requested role's role-base statement as the task path reads it — the chain-head role over the merged maps, its
|
|
146
|
+
* word and its text whole (the role-base decision's second source, `src/prompt-assembly/role-base.ts`); `undefined` ⇒
|
|
147
|
+
* the preset names none. For a station that must write the preset onto a child's own seat before prepare (the
|
|
148
|
+
* workflow lane's persona frame) — it reads exactly what prepare will, and refuses what prepare would.
|
|
149
|
+
*/
|
|
150
|
+
export declare function presetRoleBaseOf(spec: {
|
|
151
|
+
modelRole?: ModelRole;
|
|
152
|
+
roles?: ModelRoles;
|
|
153
|
+
}, deps: {
|
|
154
|
+
roles?: ModelRoles;
|
|
155
|
+
}): RoleBaseDeclaration | undefined;
|
|
129
156
|
/**
|
|
130
157
|
* Resolve the model (and default thinking) for a task. Explicit `spec.model` wins; otherwise walk the
|
|
131
158
|
* `modelRole`'s fallback chain over the merged roles (task overrides runner) and use the first role
|
package/dist/core/roles.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { selectModel } from "./select-model.js";
|
|
2
|
+
import { namesRoleBase } from "../prompt-assembly/role-base.js";
|
|
3
|
+
import { readPromptRole } from "../prompt-assembly/select.js";
|
|
4
|
+
import { readMember } from "./thrown-value.js";
|
|
2
5
|
import { MODEL_ROLES } from "./types.js";
|
|
3
6
|
export { MODEL_ROLES } from "./types.js";
|
|
4
7
|
function catalogModel(ref, models) {
|
|
@@ -11,13 +14,36 @@ function modelBindingRefusal(field, reason, message) {
|
|
|
11
14
|
e.detail = { field, reason };
|
|
12
15
|
return e;
|
|
13
16
|
}
|
|
17
|
+
const ROLE_RECORD_KEYS = new Set(["model", "select", "thinking", "promptRole", "systemPrompt"]);
|
|
18
|
+
function isModelShaped(s) {
|
|
19
|
+
try {
|
|
20
|
+
if (typeof s === "function" || isList(s)) {
|
|
21
|
+
Reflect.ownKeys(s);
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
if (Reflect.ownKeys(s).some((k) => typeof k !== "string" || !ROLE_RECORD_KEYS.has(k)))
|
|
25
|
+
return true;
|
|
26
|
+
return readMember(s, "id") !== undefined || readMember(s, "api") !== undefined;
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
14
32
|
function isBindingObject(value) {
|
|
15
33
|
return (typeof value === "object" && value !== null) || typeof value === "function";
|
|
16
34
|
}
|
|
17
35
|
function bindingShown(value) {
|
|
18
36
|
if (typeof value === "string")
|
|
19
37
|
return JSON.stringify(value.length > 80 ? `${value.slice(0, 80)}…` : value);
|
|
20
|
-
return value === null ? "null" :
|
|
38
|
+
return value === null ? "null" : isList(value) ? "a list" : `a ${typeof value}`;
|
|
39
|
+
}
|
|
40
|
+
function isList(value) {
|
|
41
|
+
try {
|
|
42
|
+
return Array.isArray(value);
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
21
47
|
}
|
|
22
48
|
function unknownModelRefRefusal(ref, seat) {
|
|
23
49
|
return modelBindingRefusal(seat, "unknown_model_ref", `Unknown model ref ${bindingShown(ref)} in ${seat}. Provide it in RunnerDeps.models or pass a Model object.`);
|
|
@@ -28,6 +54,7 @@ function modelOfBinding(value, models, seat, binds) {
|
|
|
28
54
|
const held = catalogModel(value, models);
|
|
29
55
|
if (held === undefined)
|
|
30
56
|
throw unknownModelRefRefusal(value, seat);
|
|
57
|
+
assertModelObject(held, seat, `${bindingShown(value)} (a catalog entry)`);
|
|
31
58
|
return held;
|
|
32
59
|
}
|
|
33
60
|
return value;
|
|
@@ -35,9 +62,19 @@ function modelOfBinding(value, models, seat, binds) {
|
|
|
35
62
|
function assertModelBindingShape(value, seat, binds) {
|
|
36
63
|
if (typeof value === "string")
|
|
37
64
|
return;
|
|
38
|
-
if (typeof value !== "object" || value === null ||
|
|
65
|
+
if (typeof value !== "object" || value === null || isList(value)) {
|
|
39
66
|
throw modelBindingRefusal(seat, "not_a_model_ref", `${seat} is ${bindingShown(value)}, not a model reference — ${binds}.`);
|
|
40
67
|
}
|
|
68
|
+
assertModelObject(value, seat, "a Model object", binds === ROLE_BINDS ? " At a role seat an object with a key beyond model / select / thinking / promptRole / systemPrompt is read as a Model, not as a role record." : "");
|
|
69
|
+
}
|
|
70
|
+
function assertModelObject(value, seat, what, note = "") {
|
|
71
|
+
const id = readMember(value, "id");
|
|
72
|
+
const api = readMember(value, "api");
|
|
73
|
+
const [member, got] = typeof id !== "string" || id === "" ? ["id", id] : typeof api !== "string" ? ["api", api] : [undefined, undefined];
|
|
74
|
+
if (member === undefined)
|
|
75
|
+
return;
|
|
76
|
+
const shown = got === undefined ? "absent" : bindingShown(got);
|
|
77
|
+
throw modelBindingRefusal(seat, "not_a_model_ref", `${seat} is ${what} whose \`${member}\` is ${shown} — a Model carries a non-empty string \`id\` and a string \`api\`.${note}`);
|
|
41
78
|
}
|
|
42
79
|
const ROLE_BINDS = "a role binds a catalog model name or a Model object";
|
|
43
80
|
const roleModelSeat = (named, seat) => (typeof named === "string" ? seat : `${seat}.model`);
|
|
@@ -156,7 +193,10 @@ function roleTierModel(role, models) {
|
|
|
156
193
|
if (!models || !models[TIERS_ACTIVE])
|
|
157
194
|
return undefined;
|
|
158
195
|
const tier = ROLE_TIER_DEFAULTS[role];
|
|
159
|
-
|
|
196
|
+
const m = tier !== undefined ? models[tier] : undefined;
|
|
197
|
+
if (m)
|
|
198
|
+
assertModelObject(m, `tiers.${String(tier)}`, "the catalog entry the tier word names");
|
|
199
|
+
return m;
|
|
160
200
|
}
|
|
161
201
|
const FALLBACK = {
|
|
162
202
|
default: [],
|
|
@@ -176,11 +216,11 @@ function specParts(s, seat = "a role seat") {
|
|
|
176
216
|
if (!isBindingObject(s)) {
|
|
177
217
|
throw modelBindingRefusal(seat, "not_a_model_ref", `${seat} is ${bindingShown(s)}, not a model reference — a role binds a catalog model name, a Model object or a { model, select, thinking, systemPrompt } record.`);
|
|
178
218
|
}
|
|
179
|
-
if (
|
|
219
|
+
if (isModelShaped(s)) {
|
|
180
220
|
return { model: s };
|
|
181
221
|
}
|
|
182
222
|
const cfg = s;
|
|
183
|
-
return { model: cfg.model, select: cfg.select, thinking: cfg.thinking, systemPrompt: cfg.systemPrompt };
|
|
223
|
+
return { model: cfg.model, select: cfg.select, thinking: cfg.thinking, promptRole: readPromptRole(`${seat}.promptRole`, cfg.promptRole), systemPrompt: cfg.systemPrompt };
|
|
184
224
|
}
|
|
185
225
|
export function roleSpecNamesModel(spec) {
|
|
186
226
|
const parts = specParts(spec);
|
|
@@ -190,7 +230,7 @@ function toConfig(s) {
|
|
|
190
230
|
if (s === undefined) {
|
|
191
231
|
return undefined;
|
|
192
232
|
}
|
|
193
|
-
if (typeof s === "string" || (
|
|
233
|
+
if (typeof s === "string" || isModelShaped(s)) {
|
|
194
234
|
return { model: s };
|
|
195
235
|
}
|
|
196
236
|
return s;
|
|
@@ -203,11 +243,13 @@ function mergeRoleSpec(base, over) {
|
|
|
203
243
|
if (!b)
|
|
204
244
|
return over;
|
|
205
245
|
const overHasSource = o.model !== undefined || o.select !== undefined;
|
|
246
|
+
const roleBase = namesRoleBase(o) ? o : b;
|
|
206
247
|
return {
|
|
207
248
|
model: overHasSource ? o.model : b.model,
|
|
208
249
|
select: overHasSource ? o.select : b.select,
|
|
209
250
|
thinking: o.thinking ?? b.thinking,
|
|
210
|
-
|
|
251
|
+
promptRole: roleBase.promptRole,
|
|
252
|
+
systemPrompt: roleBase.systemPrompt,
|
|
211
253
|
};
|
|
212
254
|
}
|
|
213
255
|
function assertKnownRole(word, field, ofKey = false) {
|
|
@@ -216,19 +258,19 @@ function assertKnownRole(word, field, ofKey = false) {
|
|
|
216
258
|
const shown = typeof word === "string" ? JSON.stringify(word).slice(0, 80) : `<${word === null ? "null" : typeof word}>`;
|
|
217
259
|
throw modelBindingRefusal(field, "unknown_role_word", `${ofKey ? `${field} key` : field} names the model role ${shown}, which is not one of ${MODEL_ROLES.join(" / ")} — a word outside the vocabulary binds nothing and resolves nothing; bind the model on one of these roles, or name it on TaskSpec.model`);
|
|
218
260
|
}
|
|
219
|
-
function
|
|
220
|
-
for (const key of Object.keys(
|
|
221
|
-
assertKnownRole(key,
|
|
222
|
-
for (const key of Object.
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
const named = specParts(value, seat).model;
|
|
228
|
-
if (named !== undefined)
|
|
229
|
-
assertModelBindingShape(named, roleModelSeat(named, seat), ROLE_BINDS);
|
|
230
|
-
}
|
|
261
|
+
export function screenRoleMap(roles, field) {
|
|
262
|
+
for (const key of Object.keys(roles ?? {}))
|
|
263
|
+
assertKnownRole(key, field, true);
|
|
264
|
+
for (const [key, value] of Object.entries(roles ?? {})) {
|
|
265
|
+
const seat = `roles.${key}`;
|
|
266
|
+
const named = specParts(value, seat).model;
|
|
267
|
+
if (named !== undefined)
|
|
268
|
+
assertModelBindingShape(named, roleModelSeat(named, seat), ROLE_BINDS);
|
|
231
269
|
}
|
|
270
|
+
}
|
|
271
|
+
function mergeRoles(base, over) {
|
|
272
|
+
screenRoleMap(base, "RunnerDeps.roles");
|
|
273
|
+
screenRoleMap(over, "TaskSpec.roles");
|
|
232
274
|
const out = { ...base };
|
|
233
275
|
for (const role of Object.keys(over ?? {})) {
|
|
234
276
|
out[role] = mergeRoleSpec(base?.[role], over?.[role]);
|
|
@@ -244,32 +286,45 @@ function partsModel(parts, models, seat = "a role seat") {
|
|
|
244
286
|
if (needs != null && !Array.isArray(needs)) {
|
|
245
287
|
throw modelBindingRefusal(`${seat}.select`, "not_a_model_ref", `${seat}.select.needs is ${bindingShown(needs)}, not a list of capabilities (vision / reasoning).`);
|
|
246
288
|
}
|
|
247
|
-
const held = models != null && typeof models === "object" ? Object.
|
|
248
|
-
|
|
289
|
+
const held = models != null && typeof models === "object" ? Object.entries(models).filter(([, m]) => Boolean(m)) : [];
|
|
290
|
+
for (const [key, m] of held)
|
|
291
|
+
assertModelObject(m, `${seat}.select`, `the catalog entry ${bindingShown(key)} the criteria read`);
|
|
292
|
+
const picked = selectModel(held.map(([, m]) => m), parts.select);
|
|
293
|
+
if (picked !== undefined)
|
|
294
|
+
assertModelObject(picked, `${seat}.select`, "the catalog entry the criteria pick");
|
|
295
|
+
return picked;
|
|
249
296
|
}
|
|
250
297
|
return undefined;
|
|
251
298
|
}
|
|
252
|
-
|
|
299
|
+
function chainHead(spec, deps) {
|
|
253
300
|
const start = spec.modelRole === undefined ? "default" : spec.modelRole;
|
|
254
301
|
assertKnownRole(start, "modelRole");
|
|
302
|
+
const merged = mergeRoles(deps.roles, spec.roles);
|
|
303
|
+
return { start, merged, startParts: specParts(merged[start], `roles.${start}`) };
|
|
304
|
+
}
|
|
305
|
+
export function presetRoleBaseOf(spec, deps) {
|
|
306
|
+
const { promptRole, systemPrompt } = chainHead(spec, deps).startParts;
|
|
307
|
+
return namesRoleBase({ promptRole, systemPrompt }) ? { ...(promptRole !== undefined ? { promptRole } : {}), ...(systemPrompt !== undefined ? { systemPrompt } : {}) } : undefined;
|
|
308
|
+
}
|
|
309
|
+
export function resolveTaskModel(spec, deps) {
|
|
310
|
+
const { start, merged, startParts } = chainHead(spec, deps);
|
|
255
311
|
if (spec.model !== undefined) {
|
|
256
|
-
const startParts = specParts(mergeRoles(deps.roles, spec.roles)[start], `roles.${start}`);
|
|
257
312
|
return {
|
|
258
313
|
model: resolveModel(spec.model, deps.models, "TaskSpec.model"),
|
|
259
314
|
modelRef: spec.model,
|
|
260
315
|
thinking: spec.thinking ?? startParts.thinking,
|
|
316
|
+
promptRole: startParts.promptRole,
|
|
261
317
|
systemPrompt: startParts.systemPrompt,
|
|
262
318
|
};
|
|
263
319
|
}
|
|
264
|
-
const
|
|
265
|
-
const startSystemPrompt = specParts(merged[start], `roles.${start}`).systemPrompt;
|
|
320
|
+
const { promptRole: startPromptRole, systemPrompt: startSystemPrompt } = startParts;
|
|
266
321
|
for (const role of [start, ...FALLBACK[start]]) {
|
|
267
322
|
const parts = specParts(merged[role], `roles.${role}`);
|
|
268
323
|
const fromParts = partsModel(parts, deps.models, `roles.${role}`);
|
|
269
324
|
const model = fromParts ?? roleTierModel(role, deps.models);
|
|
270
325
|
if (model) {
|
|
271
326
|
const modelRef = fromParts !== undefined ? (parts.model ?? model) : (ROLE_TIER_DEFAULTS[role] ?? model);
|
|
272
|
-
return { model, modelRef, thinking: spec.thinking ?? parts.thinking, systemPrompt: startSystemPrompt };
|
|
327
|
+
return { model, modelRef, thinking: spec.thinking ?? parts.thinking, promptRole: startPromptRole, systemPrompt: startSystemPrompt };
|
|
273
328
|
}
|
|
274
329
|
}
|
|
275
330
|
throw new Error(`No model for role "${start}": set TaskSpec.model, or configure RunnerDeps.roles / TaskSpec.roles["${start}"] (or a "default" role). A "select" RoleSpec also fails here if no catalog model matches.`);
|
|
@@ -34,16 +34,20 @@ export declare function normalizeOrgGateVerdict(answer: unknown, unreadable: str
|
|
|
34
34
|
/**
|
|
35
35
|
* Normalize the accepted {@link ToolGateInput.persistedRules} answers into one reading.
|
|
36
36
|
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
37
|
+
* Four readings, and the lane's own words pick them. `{}` = the lane SAID no rule speaks: the `undefined` answer
|
|
38
|
+
* (the store was read and holds nothing for this call) or a coverage answer (design/375 §5.2②, whose decision
|
|
39
|
+
* meaning is "no rule"). `{ hit }` = a match: a `behavior` of the closed set and a NON-EMPTY `rules` whose members each
|
|
40
|
+
* carry a text (design/375). `{ unreadable: true }` = the lane said it could not read its source (the store form).
|
|
41
|
+
* `{ unreadable: true, reason }` = the lane could not read the call against its rows (its own call form), OR the lane
|
|
42
|
+
* answered something this seam cannot read — `null`, a string or number, an object that is none of the shapes above, a
|
|
43
|
+
* `behavior` outside the closed set or absent, `rules` absent / not an array / empty, a member that is not a record or
|
|
44
|
+
* whose `rule` is not a string, a carrier that is not a plain object. The last arm is the one that matters: an answer the
|
|
45
|
+
* lane gave and nobody can read may be a DENY or an ASK row that did not survive the seam, and reading it as "no rule"
|
|
46
|
+
* would let the person's standing "never run this" fail silently — so it is read as the unreadable word (a
|
|
47
|
+
* real-approval ask no mode releases; headless, a refusal), the same word the org lane's unreadable answer takes.
|
|
48
|
+
* All-or-nothing across the set for the same reason: a set with one unreadable member is a different (smaller) claim than
|
|
49
|
+
* the lane made, and a decision must not stand on a claim nobody made. Per-member DOTS stay individually optional
|
|
50
|
+
* (identity lost ⇒ `"not_reported"`, exactly the single-rule contract).
|
|
47
51
|
*
|
|
48
52
|
* The hit's dots are COPIED, not aliased. The array travels onto an ask that may sit in front of a
|
|
49
53
|
* person for a long time; a lane that retains and mutates its own array would otherwise change what the
|
|
@@ -68,11 +72,12 @@ export declare function readOrgRuleLane(org: {
|
|
|
68
72
|
}, req: ToolCallRequest, signal: AbortSignal | undefined, timeoutMs?: number): Promise<OrgGateVerdict>;
|
|
69
73
|
/**
|
|
70
74
|
* The persisted-rule lane's one read for one call — every consumer's (the live gate, the synthetic-Read
|
|
71
|
-
* judge), normalized once. A lane that throws
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
* closed in the arms the same way, as the call form. Absent lane
|
|
75
|
+
* judge), normalized once. A lane that throws or hangs past the dependency timeout is a lane that could not answer: a row
|
|
76
|
+
* nobody could read may forbid the call, so for the DECISION it fails closed (`applyPersistedTightening` reads `{ unreadable }`
|
|
77
|
+
* without a reason as the store form: a real-approval ask), and for the RECORD it is `"unavailable"`. A lane that ANSWERS
|
|
78
|
+
* something this seam cannot read, and a call the lane could not read against the rows, are `unreadable` with a `reason`
|
|
79
|
+
* (the normalizer's words, naming the field): they fail closed in the arms the same way, as the call form. Absent lane,
|
|
80
|
+
* or the lane's own `undefined` ⇒ the clean negative.
|
|
76
81
|
*/
|
|
77
82
|
export declare function readPersistedRuleLane(lane: {
|
|
78
83
|
adjudicate: (req: ToolCallRequest) => PersistedRuleAnswer | Promise<PersistedRuleAnswer>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describeThrown } from "./tool-policy.js";
|
|
2
2
|
import { ORG_ADJUDICATION_TIMEOUT_MS, settleOrgVerdictWithin } from "./permission-rule-org.js";
|
|
3
|
-
import { isRuleBehavior } from "./permission-rule-model.js";
|
|
3
|
+
import { isRuleBehavior, RULE_BEHAVIORS } from "./permission-rule-model.js";
|
|
4
4
|
function isPlainOwnRecord(x) {
|
|
5
5
|
try {
|
|
6
6
|
if (x === null || typeof x !== "object" || Array.isArray(x))
|
|
@@ -21,6 +21,15 @@ function ownDataValue(obj, key) {
|
|
|
21
21
|
return undefined;
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
+
function bearsOwn(obj, key) {
|
|
25
|
+
try {
|
|
26
|
+
const d = Object.getOwnPropertyDescriptor(obj, key);
|
|
27
|
+
return d !== undefined && (!("value" in d) || d.value !== undefined);
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
24
33
|
export function normalizeOrgGateVerdict(answer, unreadable) {
|
|
25
34
|
const clean = (v) => Object.assign(Object.create(null), v);
|
|
26
35
|
const readable = (x) => {
|
|
@@ -94,16 +103,24 @@ function copiedUsableDots(dots) {
|
|
|
94
103
|
const usable = copied?.every((d) => typeof d.actor === "string" && typeof d.counter === "number" && Number.isFinite(d.counter)) === true && copied.length > 0;
|
|
95
104
|
return usable ? { dots: copied } : {};
|
|
96
105
|
}
|
|
106
|
+
function unreadableAnswer(where) {
|
|
107
|
+
return { unreadable: true, reason: `the host's persisted-rule lane, persistedRules.adjudicate, answered what this gate cannot read: ${where}` };
|
|
108
|
+
}
|
|
97
109
|
export function normalizePersistedRuleHit(hit) {
|
|
98
|
-
if (
|
|
110
|
+
if (hit === undefined)
|
|
99
111
|
return {};
|
|
112
|
+
if (!isPlainOwnRecord(hit))
|
|
113
|
+
return unreadableAnswer(hit === null ? "the answer is `null` — a lane with no rule for the call answers `undefined`" : "the answer is not a plain object");
|
|
100
114
|
if (ownDataValue(hit, "unreadable") === true) {
|
|
101
115
|
const reason = ownDataValue(hit, "reason");
|
|
102
116
|
return typeof reason === "string" ? { unreadable: true, reason } : { unreadable: true };
|
|
103
117
|
}
|
|
104
118
|
const rulesRaw = ownDataValue(hit, "rules");
|
|
105
|
-
|
|
119
|
+
const behavior = ownDataValue(hit, "behavior");
|
|
120
|
+
if (!bearsOwn(hit, "rules") && !bearsOwn(hit, "behavior") && !bearsOwn(hit, "unreadable")) {
|
|
106
121
|
const coverageRaw = ownDataValue(hit, "segmentCoverage");
|
|
122
|
+
if (coverageRaw === undefined)
|
|
123
|
+
return unreadableAnswer("it names no `behavior`, no `rules`, no `unreadable` report and no `segmentCoverage` table");
|
|
107
124
|
let rows;
|
|
108
125
|
try {
|
|
109
126
|
if (Array.isArray(coverageRaw)) {
|
|
@@ -120,27 +137,38 @@ export function normalizePersistedRuleHit(hit) {
|
|
|
120
137
|
}
|
|
121
138
|
return rows !== undefined && rows.length > 0 ? { coverage: rows.map((r) => ({ segment: r.segment, covered: r.covered })) } : {};
|
|
122
139
|
}
|
|
123
|
-
|
|
140
|
+
if (!isRuleBehavior(behavior))
|
|
141
|
+
return unreadableAnswer(`\`behavior\` is not one of ${RULE_BEHAVIORS.join(" / ")}`);
|
|
142
|
+
const members = [];
|
|
143
|
+
let problem;
|
|
124
144
|
try {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
145
|
+
const count = Array.isArray(rulesRaw) ? rulesRaw.length : undefined;
|
|
146
|
+
if (!Array.isArray(rulesRaw))
|
|
147
|
+
problem = rulesRaw === undefined ? "`rules` is absent or not an own data property" : "`rules` is not an array";
|
|
148
|
+
else if (count === 0)
|
|
149
|
+
problem = "`rules` is empty — a hit names at least one rule";
|
|
150
|
+
else if (typeof count !== "number" || !Number.isSafeInteger(count) || count < 0)
|
|
151
|
+
problem = "`rules` has no readable length";
|
|
152
|
+
else {
|
|
153
|
+
for (let i = 0; i < count && problem === undefined; i++) {
|
|
128
154
|
const m = rulesRaw[i];
|
|
129
|
-
|
|
155
|
+
if (!isPlainOwnRecord(m))
|
|
156
|
+
problem = `\`rules[${i}]\` is not a plain object`;
|
|
157
|
+
else {
|
|
158
|
+
const rule = ownDataValue(m, "rule");
|
|
159
|
+
if (typeof rule !== "string")
|
|
160
|
+
problem = `\`rules[${i}].rule\` is not a string`;
|
|
161
|
+
else
|
|
162
|
+
members.push({ rule, dots: ownDataValue(m, "dots") });
|
|
163
|
+
}
|
|
130
164
|
}
|
|
131
|
-
members = walked;
|
|
132
165
|
}
|
|
133
166
|
}
|
|
134
167
|
catch {
|
|
135
|
-
|
|
168
|
+
problem = "`rules` could not be read (a throwing element or a revoked proxy)";
|
|
136
169
|
}
|
|
137
|
-
if (
|
|
138
|
-
return
|
|
139
|
-
if (!members.every((m) => typeof m.rule === "string"))
|
|
140
|
-
return {};
|
|
141
|
-
const behavior = ownDataValue(hit, "behavior");
|
|
142
|
-
if (!isRuleBehavior(behavior))
|
|
143
|
-
return {};
|
|
170
|
+
if (problem !== undefined)
|
|
171
|
+
return unreadableAnswer(problem);
|
|
144
172
|
const denial = behavior === "deny" ? copiedDenial(ownDataValue(hit, "denial"), members.map((m) => m.rule)) : undefined;
|
|
145
173
|
return { hit: { behavior, rules: members.map((m) => ({ rule: m.rule, ...copiedUsableDots(m.dots) })), ...(denial !== undefined ? { denial } : {}) } };
|
|
146
174
|
}
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* The faces that read an owner out of data — the two adoption markers read back from disk, the two adoption entries'
|
|
6
6
|
* source, a stored approval record's identity and the consent entries' `owner` option — read it through
|
|
7
7
|
* {@link readRuleOwner}, so the source an adoption entry writes into its marker is one that marker's reader reads back.
|
|
8
|
-
* Its
|
|
9
|
-
* loads, depends on this module and is kept free of the rule store's own imports.
|
|
8
|
+
* Its run-time imports are the two import-free judges — the record judge and the principal-name judge — because the root
|
|
9
|
+
* adoption marker reader, which every file store loads, depends on this module and is kept free of the rule store's own imports.
|
|
10
10
|
*/
|
|
11
11
|
import type { AssertAllKeysHandled } from "./ask-origin.js";
|
|
12
12
|
/**
|
|
@@ -36,7 +36,7 @@ export declare function sameRuleOwner(a: RuleOwner, b: RuleOwner): boolean;
|
|
|
36
36
|
/**
|
|
37
37
|
* Read an owner from a value the engine did not just build, or `undefined` when it is not one: not a plain record (an
|
|
38
38
|
* object whose prototype is `Object.prototype` or none, so no member comes from a prototype it was given), a `kind`
|
|
39
|
-
* outside {@link RULE_OWNER_KINDS}, or a `principal` arm whose name is not a
|
|
39
|
+
* outside {@link RULE_OWNER_KINDS}, or a `principal` arm whose name is not a principal name ({@link principalNameOf}: an
|
|
40
40
|
* identity-less bucket is the `local-owner` kind, never a blank name). Fail-closed: a caller treats `undefined` as
|
|
41
41
|
* "owns nothing" or refuses — never as either arm. The answer is a fresh object holding only the members the type
|
|
42
42
|
* declares; `kind` and `principal` are each read once.
|
package/dist/core/rule-owner.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isPlainRecord } from "./mods/kernel/receive.js";
|
|
2
|
+
import { principalNameOf } from "./principal-name.js";
|
|
2
3
|
export const RULE_OWNER_KINDS = Object.freeze(["principal", "local-owner"]);
|
|
3
4
|
export function sameRuleOwner(a, b) {
|
|
4
5
|
return a.kind === "principal" ? b.kind === "principal" && a.principal === b.principal : b.kind === "local-owner";
|
|
@@ -14,8 +15,8 @@ export function readRuleOwner(raw) {
|
|
|
14
15
|
case "local-owner":
|
|
15
16
|
return { kind: "local-owner" };
|
|
16
17
|
case "principal": {
|
|
17
|
-
const principal = raw.principal;
|
|
18
|
-
return
|
|
18
|
+
const principal = principalNameOf(raw.principal);
|
|
19
|
+
return principal === undefined ? undefined : { kind: "principal", principal };
|
|
19
20
|
}
|
|
20
21
|
default: {
|
|
21
22
|
const unhandled = word;
|
|
@@ -68,6 +68,20 @@ export declare function flushOwedAnnouncedSnapshot(prepared: {
|
|
|
68
68
|
announcedListingsRef: AnnouncedListingSnapshotInput;
|
|
69
69
|
session: Pick<AnnounceOnceSession, "appendAnnouncedListing">;
|
|
70
70
|
}): Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* The one commit of a delivered `mcp_unavailable` frame — the receipt of the message that carried it (a leg's first request), run
|
|
73
|
+
* inside the `message_end` walk: the delivered pairs leave the pending list and join the session's told-failure record, whose
|
|
74
|
+
* snapshot write is parked for the next serialization point. The next prepare on the session announces only what the record lacks.
|
|
75
|
+
*/
|
|
76
|
+
export declare function settleMcpUnavailable(prepared: {
|
|
77
|
+
readonly mcpUnavailable?: {
|
|
78
|
+
pending: AnnouncedMcpFailure[];
|
|
79
|
+
};
|
|
80
|
+
readonly announcedListingsRef: AnnouncedListingSnapshotInput;
|
|
81
|
+
readonly frameReceipts: {
|
|
82
|
+
listingSnapshotOwed: boolean;
|
|
83
|
+
};
|
|
84
|
+
}, delivered: ReadonlyArray<AnnouncedMcpFailure>): void;
|
|
71
85
|
/** The run-local ledger — see the module header for the two commit disciplines it serves. */
|
|
72
86
|
export interface AnnounceOnceLedger {
|
|
73
87
|
/** The nearest announced snapshot on the branch as read at prepare (undefined = pre-entry
|
|
@@ -47,6 +47,11 @@ export async function flushOwedAnnouncedSnapshot(prepared) {
|
|
|
47
47
|
return;
|
|
48
48
|
await prepared.session.appendAnnouncedListing(prepared.announcedListingsRef).catch(() => undefined);
|
|
49
49
|
}
|
|
50
|
+
export function settleMcpUnavailable(prepared, delivered) {
|
|
51
|
+
prepared.mcpUnavailable?.pending.splice(0, delivered.length);
|
|
52
|
+
prepared.announcedListingsRef.mcpFailed = [...(prepared.announcedListingsRef.mcpFailed ?? []), ...delivered];
|
|
53
|
+
prepared.frameReceipts.listingSnapshotOwed = true;
|
|
54
|
+
}
|
|
50
55
|
export async function loadAnnounceOnceLedger(session, checkpointMirror, onError) {
|
|
51
56
|
let recovered = true;
|
|
52
57
|
const entry = await session.getAnnouncedListing().catch(() => {
|
|
@@ -148,6 +148,7 @@ export interface ResultFlags {
|
|
|
148
148
|
* ended for its own reason first) leaves this empty: the original terminal stands and the seat is
|
|
149
149
|
* NOT signed (the settle lane mints `task.halt_unconsumed` for it). */
|
|
150
150
|
haltConsumption?: HaltConsumption;
|
|
151
|
+
answerEntryIds?: readonly string[];
|
|
151
152
|
/** Call ids of answered-but-never-collected questions, echoed on
|
|
152
153
|
* `TaskResult.strandedHumanAnswers`. Pure pass-through; empty/absent ⇒ the field is omitted. The
|
|
153
154
|
* optional `onError` alert is NOT the disclosure — this mandatory result face is. */
|
|
@@ -178,5 +178,5 @@ export function assembleResult(spec, sessionId, final, stats, flags) {
|
|
|
178
178
|
if (flags.unpricedSpend)
|
|
179
179
|
delete publicStats.costMicroUsd;
|
|
180
180
|
const stampHaltedByUser = haltConsumed(flags.haltConsumption);
|
|
181
|
-
return { taskId, ...(flags.runId !== undefined ? { runId: flags.runId } : {}), sessionId, terminal, ...(flags.model !== undefined ? { model: flags.model } : {}), ...(responseModel !== undefined ? { responseModel } : {}), result: result.trim(), salvagedOutput, ...(apiFailure !== undefined ? { apiFailure } : {}), ...(retryAfterMs !== undefined ? { retryAfterMs } : {}), ...(flags.rewindNotes !== undefined && flags.rewindNotes.length > 0 ? { rewindNotes: flags.rewindNotes } : {}), ...(flags.editedFiles !== undefined && flags.editedFiles.length > 0 ? { editedFiles: flags.editedFiles } : {}), ...(flags.haltedOnUserRejection === true ? { haltedOnUserRejection: true } : {}), ...(stampHaltedByUser ? { haltedByUser: true } : {}), ...(flags.remoteEnvFailures !== undefined && flags.remoteEnvFailures.length > 0 ? { remoteEnvFailures: [...flags.remoteEnvFailures] } : {}), ...(flags.strandedHumanAnswers !== undefined && flags.strandedHumanAnswers.length > 0 ? { strandedHumanAnswers: flags.strandedHumanAnswers } : {}), ...(flags.effectiveReadFace !== undefined ? { effectiveReadFace: flags.effectiveReadFace } : {}), ...(flags.effectiveWriteFace !== undefined ? { effectiveWriteFace: flags.effectiveWriteFace } : {}), ...(flags.effectiveReadDenyPatterns !== undefined && flags.effectiveReadDenyPatterns.length > 0 ? { effectiveReadDenyPatterns: flags.effectiveReadDenyPatterns } : {}), ...(flags.effectiveMemoryScopes !== undefined ? { effectiveMemoryScopes: flags.effectiveMemoryScopes } : {}), ...(flags.effectiveReasoning !== undefined ? { effectiveReasoning: flags.effectiveReasoning } : {}), ...(flags.compaction !== undefined ? { compaction: flags.compaction } : {}), stats: publicStats };
|
|
181
|
+
return { taskId, ...(flags.runId !== undefined ? { runId: flags.runId } : {}), sessionId, terminal, ...(flags.model !== undefined ? { model: flags.model } : {}), ...(responseModel !== undefined ? { responseModel } : {}), result: result.trim(), ...(flags.answerEntryIds !== undefined ? { resultEntryIds: [...flags.answerEntryIds] } : {}), salvagedOutput, ...(apiFailure !== undefined ? { apiFailure } : {}), ...(retryAfterMs !== undefined ? { retryAfterMs } : {}), ...(flags.rewindNotes !== undefined && flags.rewindNotes.length > 0 ? { rewindNotes: flags.rewindNotes } : {}), ...(flags.editedFiles !== undefined && flags.editedFiles.length > 0 ? { editedFiles: flags.editedFiles } : {}), ...(flags.haltedOnUserRejection === true ? { haltedOnUserRejection: true } : {}), ...(stampHaltedByUser ? { haltedByUser: true } : {}), ...(flags.remoteEnvFailures !== undefined && flags.remoteEnvFailures.length > 0 ? { remoteEnvFailures: [...flags.remoteEnvFailures] } : {}), ...(flags.strandedHumanAnswers !== undefined && flags.strandedHumanAnswers.length > 0 ? { strandedHumanAnswers: flags.strandedHumanAnswers } : {}), ...(flags.effectiveReadFace !== undefined ? { effectiveReadFace: flags.effectiveReadFace } : {}), ...(flags.effectiveWriteFace !== undefined ? { effectiveWriteFace: flags.effectiveWriteFace } : {}), ...(flags.effectiveReadDenyPatterns !== undefined && flags.effectiveReadDenyPatterns.length > 0 ? { effectiveReadDenyPatterns: flags.effectiveReadDenyPatterns } : {}), ...(flags.effectiveMemoryScopes !== undefined ? { effectiveMemoryScopes: flags.effectiveMemoryScopes } : {}), ...(flags.effectiveReasoning !== undefined ? { effectiveReasoning: flags.effectiveReasoning } : {}), ...(flags.compaction !== undefined ? { compaction: flags.compaction } : {}), stats: publicStats };
|
|
182
182
|
}
|
|
@@ -89,8 +89,9 @@ export interface ApprovedCallScreenInput {
|
|
|
89
89
|
* the call (the decide is the upper bound; the screen can only narrow): a deny, a failed or cancelled screening, or a
|
|
90
90
|
* refused answer refuses the call in the live gate's own sentences; an ask is the question the decide already answered —
|
|
91
91
|
* unless it demands a person and the decide was the deployment's policy (the one predicate every resume station holds a
|
|
92
|
-
* decide against); a rewrite
|
|
93
|
-
*
|
|
92
|
+
* decide against); a rewrite comes back as the args — what executes when the decide carried no edit, a refusal of the edit
|
|
93
|
+
* when it did (a person's bytes are the ceiling, rewrite-rejudge.ts); context rides the result. Undefined when no handler hangs
|
|
94
|
+
* on `classic.PreToolUse`.
|
|
94
95
|
*/
|
|
95
96
|
export declare function createApprovedCallScreen(input: ApprovedCallScreenInput): ApprovedCallScreen | undefined;
|
|
96
97
|
/**
|