@sema-agent/core 7.51.2 → 7.53.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 +698 -2
- package/README.md +3 -1
- package/dist/agents/agent-transcript-tool.d.ts +1 -1
- package/dist/agents/cascade.js +4 -0
- package/dist/agents/cross-session-envelope.d.ts +8 -0
- package/dist/agents/cross-session-envelope.js +6 -0
- package/dist/agents/cross-session-judge.d.ts +21 -1
- package/dist/agents/cross-session-judge.js +8 -0
- package/dist/agents/cross-session-ref.d.ts +5 -0
- package/dist/agents/cross-session-ref.js +1 -0
- package/dist/agents/cumulative-stats.d.ts +3 -0
- package/dist/agents/cumulative-stats.js +3 -0
- package/dist/agents/list-agents-tool.d.ts +1 -1
- package/dist/agents/org-delivery-gate.d.ts +122 -0
- package/dist/agents/org-delivery-gate.js +69 -0
- package/dist/agents/peer-held-queue.d.ts +9 -4
- package/dist/agents/peer-held-queue.js +6 -5
- package/dist/agents/peer-session-drain.d.ts +35 -5
- package/dist/agents/peer-session-drain.js +271 -180
- package/dist/agents/read-inbox-tool.d.ts +8 -1
- package/dist/agents/read-inbox-tool.js +5 -1
- package/dist/agents/repair-loop.js +4 -0
- package/dist/agents/send-message-tool.d.ts +11 -16
- package/dist/agents/send-message-tool.js +11 -13
- package/dist/agents/subagent.d.ts +3 -0
- package/dist/agents/subagent.js +105 -76
- package/dist/agents/tool-filter.d.ts +58 -13
- package/dist/agents/tool-filter.js +34 -14
- package/dist/bench/metrics.d.ts +1 -0
- package/dist/brain/anthropic.d.ts +6 -1
- package/dist/brain/anthropic.js +17 -13
- package/dist/brain/model-presets.d.ts +4 -5
- package/dist/brain/model-presets.js +6 -5
- package/dist/brain/open-responses.js +16 -12
- package/dist/brain/openai.js +16 -12
- package/dist/brain/request-params.d.ts +12 -33
- package/dist/brain/request-params.js +5 -2
- package/dist/brain/request-route.d.ts +9 -8
- package/dist/brain/request-route.js +1 -0
- package/dist/brain/route-adjudicator.d.ts +123 -47
- package/dist/brain/route-adjudicator.js +171 -42
- package/dist/brain/route-conformance.js +2 -2
- package/dist/brain/routing.d.ts +24 -1
- package/dist/brain/routing.js +54 -19
- package/dist/brain/status-sink.d.ts +18 -0
- package/dist/brain/status-sink.js +7 -0
- package/dist/brain/timeout.js +5 -4
- package/dist/core/a2a.d.ts +5 -2
- package/dist/core/a2a.js +30 -13
- package/dist/core/allow-entry.d.ts +42 -9
- package/dist/core/allow-entry.js +25 -18
- package/dist/core/auto-compaction.d.ts +80 -20
- package/dist/core/auto-compaction.js +65 -18
- package/dist/core/auto-promote.d.ts +2 -1
- package/dist/core/auto-promote.js +2 -2
- package/dist/core/caller-tool-name.d.ts +9 -0
- package/dist/core/caller-tool-name.js +13 -0
- package/dist/core/checkpoint-requirements.d.ts +7 -1
- package/dist/core/checkpoint-requirements.js +2 -0
- package/dist/core/checkpoint-store.d.ts +57 -24
- package/dist/core/checkpoint-store.js +3 -3
- package/dist/core/child-clamp-seats.d.ts +6 -0
- package/dist/core/child-clamp-seats.js +2 -1
- package/dist/core/compliance.js +3 -1
- package/dist/core/credential-vocabulary.d.ts +33 -8
- package/dist/core/credential-vocabulary.js +32 -7
- package/dist/core/decision-receipt.d.ts +2 -2
- package/dist/core/delegation-frames.d.ts +9 -2
- package/dist/core/delegation-name.d.ts +18 -0
- package/dist/core/delegation-name.js +47 -0
- package/dist/core/effective-path-target.d.ts +25 -6
- package/dist/core/effective-path-target.js +24 -2
- package/dist/core/engine-capabilities.d.ts +8 -1
- package/dist/core/engine-capabilities.js +1 -1
- package/dist/core/engine-notice.d.ts +49 -21
- package/dist/core/frontmatter-fence.d.ts +10 -0
- package/dist/core/frontmatter-fence.js +6 -0
- package/dist/core/gate-fold.js +8 -25
- package/dist/core/gate-lanes.js +358 -274
- package/dist/core/gate-outcome.d.ts +11 -6
- package/dist/core/governance-codes.d.ts +11 -4
- package/dist/core/governance-codes.js +12 -3
- package/dist/core/hands-band-screen.d.ts +7 -0
- package/dist/core/hands-band-screen.js +32 -0
- package/dist/core/hooks.d.ts +283 -739
- package/dist/core/hooks.js +100 -193
- package/dist/{tools/fs → core}/image-admission.d.ts +21 -3
- package/dist/{tools/fs → core}/image-admission.js +24 -6
- package/dist/core/locked-config.d.ts +84 -32
- package/dist/core/locked-config.js +128 -42
- package/dist/core/mcp-connection-pool.d.ts +4 -1
- package/dist/core/mcp-connection-pool.js +7 -2
- package/dist/core/mcp-probe.d.ts +12 -9
- package/dist/core/mcp-probe.js +3 -3
- package/dist/core/mcp-server-spec.d.ts +104 -10
- package/dist/core/mcp-server-spec.js +183 -33
- package/dist/core/mcp.d.ts +31 -20
- package/dist/core/mcp.js +66 -56
- package/dist/core/memory-engine/data-plane.js +5 -1
- package/dist/core/memory-engine/distiller.js +16 -2
- package/dist/core/memory-engine/engine.d.ts +22 -30
- package/dist/core/memory-engine/engine.js +16 -10
- package/dist/core/memory-engine/frontmatter.d.ts +6 -0
- package/dist/core/memory-engine/frontmatter.js +19 -16
- package/dist/core/memory.d.ts +2 -2
- package/dist/core/mode-policy.d.ts +5 -16
- package/dist/core/mode-policy.js +7 -19
- package/dist/core/model-seat.d.ts +4 -1
- package/dist/core/mods/dollar.d.ts +109 -0
- package/dist/core/mods/dollar.js +154 -0
- package/dist/core/mods/host.d.ts +23 -0
- package/dist/core/mods/host.js +21 -0
- package/dist/core/mods/kernel/budget.d.ts +43 -0
- package/dist/core/mods/kernel/budget.js +83 -0
- package/dist/core/mods/kernel/dispatch.d.ts +100 -0
- package/dist/core/mods/kernel/dispatch.js +699 -0
- package/dist/core/mods/kernel/events.d.ts +245 -0
- package/dist/core/mods/kernel/events.js +210 -0
- package/dist/core/mods/kernel/index.d.ts +6 -0
- package/dist/core/mods/kernel/index.js +5 -0
- package/dist/core/mods/kernel/receive.d.ts +94 -0
- package/dist/core/mods/kernel/receive.js +188 -0
- package/dist/core/mods/kernel/registration.d.ts +131 -0
- package/dist/core/mods/kernel/registration.js +102 -0
- package/dist/core/mods/kernel/site-rules.d.ts +149 -0
- package/dist/core/mods/kernel/site-rules.js +296 -0
- package/dist/core/mods/stations.d.ts +344 -0
- package/dist/core/mods/stations.js +437 -0
- package/dist/core/mounted-mcp.d.ts +57 -0
- package/dist/core/mounted-mcp.js +71 -2
- package/dist/core/own-property-receipt.d.ts +13 -0
- package/dist/core/own-property-receipt.js +13 -23
- package/dist/core/parent-spec-seat.d.ts +18 -7
- package/dist/core/parent-spec-seat.js +6 -2
- package/dist/core/path-identity.js +2 -1
- package/dist/core/permission-rule-model.d.ts +58 -9
- package/dist/core/permission-rule-model.js +81 -7
- package/dist/core/permission-rule-org.d.ts +163 -33
- package/dist/core/permission-rule-org.js +205 -71
- package/dist/core/permission-rule-syntax.d.ts +15 -0
- package/dist/core/permission-rule-syntax.js +24 -16
- package/dist/core/permission-rules.d.ts +14 -2
- package/dist/core/permission-rules.js +63 -23
- package/dist/core/prompt-section-seat.d.ts +15 -27
- package/dist/core/prompt-section-seat.js +73 -40
- package/dist/core/protocol-http-auth.d.ts +3 -1
- package/dist/core/protocol-http-auth.js +2 -0
- package/dist/core/reminder-mint.d.ts +2 -2
- package/dist/core/remote-env.d.ts +24 -12
- package/dist/core/remote-env.js +1 -0
- package/dist/core/resume-startup-cause.d.ts +16 -1
- package/dist/core/resume-startup-cause.js +4 -1
- package/dist/core/retention.js +7 -2
- package/dist/core/retired-keys.d.ts +12 -2
- package/dist/core/retired-keys.js +15 -1
- package/dist/core/roles.js +60 -10
- package/dist/core/rule-lane-reads.js +1 -1
- package/dist/core/runner/announce-once-ledger.d.ts +31 -1
- package/dist/core/runner/announce-once-ledger.js +22 -0
- package/dist/core/runner/assemble-result.d.ts +9 -0
- package/dist/core/runner/assemble-result.js +3 -1
- package/dist/core/runner/call-hook-stations.d.ts +23 -27
- package/dist/core/runner/call-hook-stations.js +58 -42
- package/dist/core/runner/caller-stop-gate.d.ts +25 -0
- package/dist/core/runner/caller-stop-gate.js +7 -0
- package/dist/core/runner/compaction-seams.d.ts +8 -22
- package/dist/core/runner/compaction-seams.js +28 -53
- package/dist/core/runner/construction-doors.js +11 -1
- package/dist/core/runner/contracts.d.ts +86 -83
- package/dist/core/runner/credential-origin-seat.d.ts +2 -0
- package/dist/core/runner/credential-origin-seat.js +19 -0
- package/dist/core/runner/extra-body-dropped-seat.d.ts +2 -6
- package/dist/core/runner/gate-exit.d.ts +47 -36
- package/dist/core/runner/gate-exit.js +12 -5
- package/dist/core/runner/image.js +1 -2
- package/dist/core/runner/inline-image.js +1 -1
- package/dist/core/runner/mcp-redial.d.ts +52 -10
- package/dist/core/runner/mcp-redial.js +38 -9
- package/dist/core/runner/notice-seat-input.d.ts +11 -0
- package/dist/core/runner/notice-seat-input.js +1 -0
- package/dist/core/runner/permission-rule-lanes.d.ts +5 -2
- package/dist/core/runner/permission-rule-lanes.js +22 -10
- package/dist/core/runner/person-path-rows.d.ts +3 -1
- package/dist/core/runner/person-path-rows.js +3 -2
- package/dist/core/runner/prepare-acquire-reconcile.js +5 -1
- package/dist/core/runner/prepare-ask-lane.d.ts +5 -7
- package/dist/core/runner/prepare-ask-lane.js +6 -15
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +4 -2
- package/dist/core/runner/prepare-caps-and-workflow.js +25 -8
- package/dist/core/runner/prepare-config-doors.d.ts +52 -1
- package/dist/core/runner/prepare-config-doors.js +168 -143
- package/dist/core/runner/prepare-defer-classify.js +7 -11
- package/dist/core/runner/prepare-delegation-surface.d.ts +2 -2
- package/dist/core/runner/prepare-delegation-surface.js +7 -5
- package/dist/core/runner/prepare-gate-stations.d.ts +8 -11
- package/dist/core/runner/prepare-gate-stations.js +11 -10
- package/dist/core/runner/prepare-hands-readface.d.ts +1 -1
- package/dist/core/runner/prepare-hands-readface.js +2 -1
- package/dist/core/runner/prepare-inherited-gate.d.ts +8 -12
- package/dist/core/runner/prepare-inherited-gate.js +10 -23
- package/dist/core/runner/prepare-listings.d.ts +1 -1
- package/dist/core/runner/prepare-listings.js +4 -2
- package/dist/core/runner/prepare-memory-engine-session.d.ts +0 -6
- package/dist/core/runner/prepare-memory-engine-session.js +20 -7
- package/dist/core/runner/prepare-memory.d.ts +3 -2
- package/dist/core/runner/prepare-memory.js +6 -2
- package/dist/core/runner/prepare-offload-wrappers.d.ts +4 -4
- package/dist/core/runner/prepare-offload-wrappers.js +2 -1
- package/dist/core/runner/prepare-park-ask.js +10 -14
- package/dist/core/runner/prepare-policy-chain.d.ts +17 -15
- package/dist/core/runner/prepare-policy-chain.js +104 -109
- package/dist/core/runner/prepare-project-context.d.ts +1 -1
- package/dist/core/runner/prepare-project-context.js +11 -12
- package/dist/core/runner/prepare-prompt-assembly.d.ts +45 -40
- package/dist/core/runner/prepare-prompt-assembly.js +138 -101
- package/dist/core/runner/prepare-prompt-inputs.d.ts +28 -23
- package/dist/core/runner/prepare-prompt-inputs.js +11 -10
- package/dist/core/runner/prepare-protocol-tools.d.ts +11 -7
- package/dist/core/runner/prepare-protocol-tools.js +20 -13
- package/dist/core/runner/prepare-question-face.d.ts +4 -2
- package/dist/core/runner/prepare-question-face.js +4 -3
- package/dist/core/runner/prepare-safety-scan.js +6 -10
- package/dist/core/runner/prepare-suspend-saga.d.ts +6 -0
- package/dist/core/runner/prepare-suspend-saga.js +7 -5
- package/dist/core/runner/prepare-task.js +41 -23
- package/dist/core/runner/prepare-turn-wiring.d.ts +13 -15
- package/dist/core/runner/prepare-turn-wiring.js +29 -27
- package/dist/core/runner/prepare-wiring-manifest.d.ts +13 -9
- package/dist/core/runner/prepare-wiring-manifest.js +14 -11
- package/dist/core/runner/resume-admission.d.ts +4 -1
- package/dist/core/runner/resume-admission.js +7 -5
- package/dist/core/runner/resume-apply.d.ts +5 -2
- package/dist/core/runner/resume-apply.js +24 -42
- package/dist/core/runner/resume-checkpoint-screen.d.ts +1 -0
- package/dist/core/runner/resume-checkpoint-screen.js +9 -1
- package/dist/core/runner/resume-internals-and-config.d.ts +3 -3
- package/dist/core/runner/resume-internals-and-config.js +3 -8
- package/dist/core/runner/resume-preflight.js +38 -16
- package/dist/core/runner/retired-runner-deps.d.ts +5 -6
- package/dist/core/runner/retired-runner-deps.js +4 -5
- package/dist/core/runner/run-brain-sinks.d.ts +3 -2
- package/dist/core/runner/run-brain-sinks.js +5 -1
- package/dist/core/runner/run-compaction-machinery.d.ts +7 -1
- package/dist/core/runner/run-compaction-machinery.js +7 -33
- package/dist/core/runner/run-harness-handlers.js +4 -2
- package/dist/core/runner/run-identity-wiring.d.ts +3 -1
- package/dist/core/runner/run-identity-wiring.js +3 -2
- package/dist/core/runner/run-leg.js +103 -95
- package/dist/core/runner/run-notification-lane.js +1 -0
- package/dist/core/runner/run-recovery-lanes.d.ts +3 -0
- package/dist/core/runner/run-recovery-lanes.js +14 -11
- package/dist/core/runner/run-settle-and-teardown.js +9 -28
- package/dist/core/runner/run-stop-and-final-verify.js +18 -25
- package/dist/core/runner/run-terminal-adoption.d.ts +3 -0
- package/dist/core/runner/run-terminal-adoption.js +34 -22
- package/dist/core/runner/run-tool-mount-facts.js +5 -3
- package/dist/core/runner/run-turn-boundary.js +32 -37
- package/dist/core/runner/runtask.d.ts +6 -7
- package/dist/core/runner/runtask.js +15 -73
- package/dist/core/runner/session-rule-policy.d.ts +5 -5
- package/dist/core/runner/session-rule-policy.js +13 -8
- package/dist/core/runner/side-call-account.d.ts +68 -0
- package/dist/core/runner/side-call-account.js +61 -0
- package/dist/core/runner/skills-seat.d.ts +15 -0
- package/dist/core/runner/skills-seat.js +57 -0
- package/dist/core/runner/stream-halt-verbs.js +12 -17
- package/dist/core/runner/stream-lifecycle-verbs.js +8 -5
- package/dist/core/runner/stream-steer-verb.d.ts +1 -1
- package/dist/core/runner/stream-steer-verb.js +20 -38
- package/dist/core/runner/sub-agent-deny-lists.d.ts +124 -23
- package/dist/core/runner/sub-agent-deny-lists.js +230 -71
- package/dist/core/runner/synthetic-tools.d.ts +5 -2
- package/dist/core/runner/synthetic-tools.js +2 -12
- package/dist/core/runner/tool-end-body.d.ts +5 -6
- package/dist/core/runner/tool-end-body.js +6 -4
- package/dist/core/runner/tool-not-executed.d.ts +15 -0
- package/dist/core/runner/tool-not-executed.js +30 -0
- package/dist/core/runner/tool-occurrence.d.ts +8 -7
- package/dist/core/runner/tool-occurrence.js +5 -5
- package/dist/core/runner/tool-result-media-seat.d.ts +1 -1
- package/dist/core/runner-deps.d.ts +43 -36
- package/dist/core/safety-merge-corpus.js +18 -2
- package/dist/core/secret-env.d.ts +88 -20
- package/dist/core/secret-env.js +192 -38
- package/dist/core/session-policy-store.d.ts +71 -16
- package/dist/core/session-policy-store.js +138 -28
- package/dist/core/session-reconcile.d.ts +4 -0
- package/dist/core/session-reconcile.js +2 -1
- package/dist/core/shell-read-silence.js +3 -32
- package/dist/core/side-query.d.ts +5 -3
- package/dist/core/skill-grant.d.ts +3 -2
- package/dist/core/skill-grant.js +17 -9
- package/dist/core/skills-directory.d.ts +31 -11
- package/dist/core/skills-directory.js +655 -104
- package/dist/core/store-contracts/mailbox-store-contract.js +13 -0
- package/dist/core/task-event.d.ts +49 -3
- package/dist/core/task-notification.js +2 -2
- package/dist/core/task-result.d.ts +8 -0
- package/dist/core/task-spec.d.ts +20 -19
- package/dist/core/task-stream.d.ts +14 -4
- package/dist/core/tighten-task-spec.d.ts +4 -3
- package/dist/core/tighten-task-spec.js +2 -4
- package/dist/core/tool-check-reading.d.ts +74 -0
- package/dist/core/tool-check-reading.js +80 -0
- package/dist/core/tool-policy.d.ts +62 -18
- package/dist/core/tool-policy.js +86 -15
- package/dist/core/tool-registry.d.ts +20 -0
- package/dist/core/tool-registry.js +4 -0
- package/dist/core/tool-spec.d.ts +10 -6
- package/dist/core/tools.js +2 -0
- package/dist/core/trace.d.ts +51 -32
- package/dist/core/types.d.ts +2 -2
- package/dist/core/types.js +1 -1
- package/dist/core/unc-spelling.d.ts +10 -0
- package/dist/core/unc-spelling.js +3 -0
- package/dist/core/untrusted-egress.d.ts +8 -0
- package/dist/core/untrusted-egress.js +4 -1
- package/dist/core/untrusted-text.d.ts +16 -0
- package/dist/core/untrusted-text.js +7 -2
- package/dist/core/user-attachment.d.ts +25 -4
- package/dist/core/user-attachment.js +63 -42
- package/dist/core/wiring-manifest.d.ts +18 -15
- package/dist/core/wiring-manifest.js +2 -2
- package/dist/engine/compaction/utils.js +1 -2
- package/dist/engine/execution-env/node-execution-env.d.ts +4 -3
- package/dist/engine/execution-env/symlink-chain.js +1 -1
- package/dist/engine/harness/agent-harness.d.ts +1 -1
- package/dist/engine/harness/agent-harness.js +5 -4
- package/dist/engine/harness/types.d.ts +20 -16
- package/dist/engine/harness/types.js +7 -1
- package/dist/engine/llm/types.d.ts +12 -7
- package/dist/engine/loop/agent-loop.d.ts +12 -1
- package/dist/engine/loop/agent-loop.js +18 -6
- package/dist/engine/loop/types.d.ts +8 -2
- package/dist/engine/lsp/node-lsp-manager.d.ts +2 -2
- package/dist/engine/session/import-validate.js +3 -10
- package/dist/engine/session/session.d.ts +4 -4
- package/dist/engine/session/session.js +4 -4
- package/dist/index.d.ts +33 -23
- package/dist/index.js +23 -15
- package/dist/internal/harness.d.ts +2 -1
- package/dist/internal/harness.js +2 -1
- package/dist/orchestration/goal.d.ts +24 -1
- package/dist/orchestration/goal.js +3 -2
- package/dist/orchestration/run-spec.d.ts +4 -6
- package/dist/orchestration/run-spec.js +39 -63
- package/dist/orchestration/run-workflow-tool.js +1 -2
- package/dist/orchestration/workflow.d.ts +11 -3
- package/dist/orchestration/workflow.js +11 -2
- package/dist/prompt-assembly/artifact-store.d.ts +72 -56
- package/dist/prompt-assembly/artifact-store.js +60 -52
- package/dist/prompt-assembly/artifact.d.ts +90 -76
- package/dist/prompt-assembly/artifact.js +197 -145
- package/dist/prompt-assembly/assemble.d.ts +36 -29
- package/dist/prompt-assembly/assemble.js +34 -220
- package/dist/prompt-assembly/bands.d.ts +20 -0
- package/dist/prompt-assembly/bands.js +18 -0
- package/dist/prompt-assembly/catalog/constitution.d.ts +23 -0
- package/dist/prompt-assembly/catalog/constitution.js +69 -0
- package/dist/prompt-assembly/catalog/core-behavior.d.ts +9 -0
- package/dist/prompt-assembly/catalog/core-behavior.js +85 -0
- package/dist/prompt-assembly/catalog/index.d.ts +11 -0
- package/dist/prompt-assembly/catalog/index.js +60 -0
- package/dist/prompt-assembly/catalog/memory.d.ts +13 -0
- package/dist/prompt-assembly/catalog/memory.js +6 -0
- package/dist/prompt-assembly/catalog/modes.d.ts +15 -0
- package/dist/prompt-assembly/catalog/modes.js +137 -0
- package/dist/prompt-assembly/catalog/role.d.ts +10 -0
- package/dist/prompt-assembly/catalog/role.js +157 -0
- package/dist/prompt-assembly/catalog/schema.d.ts +138 -0
- package/dist/prompt-assembly/catalog/schema.js +25 -0
- package/dist/prompt-assembly/catalog/sections.d.ts +9 -0
- package/dist/prompt-assembly/catalog/sections.js +98 -0
- package/dist/prompt-assembly/catalog/team.d.ts +4 -0
- package/dist/prompt-assembly/catalog/team.js +258 -0
- package/dist/prompt-assembly/composer.d.ts +26 -28
- package/dist/prompt-assembly/composer.js +124 -46
- package/dist/prompt-assembly/epoch.d.ts +89 -79
- package/dist/prompt-assembly/epoch.js +115 -142
- package/dist/prompt-assembly/explain.d.ts +58 -34
- package/dist/prompt-assembly/explain.js +21 -24
- package/dist/prompt-assembly/overlay.d.ts +137 -0
- package/dist/prompt-assembly/overlay.js +339 -0
- package/dist/prompt-assembly/renderers.d.ts +21 -0
- package/dist/prompt-assembly/renderers.js +39 -0
- package/dist/prompt-assembly/section-usage.d.ts +3 -3
- package/dist/prompt-assembly/section-usage.js +1 -1
- package/dist/prompt-assembly/select.d.ts +71 -0
- package/dist/prompt-assembly/select.js +106 -0
- package/dist/prompt-assembly/sugar.d.ts +31 -0
- package/dist/prompt-assembly/sugar.js +20 -0
- package/dist/prompt-assembly/turn-snapshot.d.ts +3 -2
- package/dist/prompt-assembly/types.d.ts +45 -148
- package/dist/prompts/coordinator.d.ts +2 -21
- package/dist/prompts/coordinator.js +3 -255
- package/dist/prompts/cowork.d.ts +27 -16
- package/dist/prompts/cowork.js +2 -23
- package/dist/prompts/default.d.ts +38 -511
- package/dist/prompts/default.js +20 -288
- package/dist/prompts/supervisor.d.ts +6 -71
- package/dist/prompts/supervisor.js +6 -117
- package/dist/stores/file/permission-rule-store.d.ts +1 -1
- package/dist/stores/file/permission-rule-store.js +2 -1
- package/dist/tools/artifact/artifact-tool.js +4 -3
- package/dist/tools/fs/bash-readonly-classifier.d.ts +6 -5
- package/dist/tools/fs/dir-entries.d.ts +4 -2
- package/dist/tools/fs/dir-entries.js +16 -4
- package/dist/tools/fs/fs-bash.d.ts +1 -1
- package/dist/tools/fs/fs-bash.js +22 -11
- package/dist/tools/fs/fs-pdf.js +17 -13
- package/dist/tools/fs/fs-read.js +4 -3
- package/dist/tools/fs/fs-shared.d.ts +1 -10
- package/dist/tools/fs/fs-shared.js +3 -4
- package/dist/tools/fs/fs-write.js +2 -1
- package/dist/tools/fs/notebook.js +1 -1
- package/dist/tools/fs/pdf.d.ts +20 -10
- package/dist/tools/fs/pdf.js +19 -10
- package/dist/tools/fs/program-read-model.d.ts +68 -8
- package/dist/tools/fs/program-read-model.js +112 -33
- package/dist/tools/fs/program-read-model.rows.js +30 -10
- package/dist/tools/fs/read-deny-home.d.ts +25 -9
- package/dist/tools/fs/read-deny-home.js +28 -27
- package/dist/tools/fs/read-deny.d.ts +41 -11
- package/dist/tools/fs/read-deny.js +51 -5
- package/dist/tools/fs/safety.d.ts +4 -26
- package/dist/tools/fs/safety.js +10 -32
- package/dist/tools/fs/search.js +15 -10
- package/dist/tools/fs/shell-read-argv.d.ts +3 -2
- package/dist/tools/fs/shell-read-argv.js +118 -38
- package/dist/tools/fs/shell-read-establish.d.ts +5 -5
- package/dist/tools/fs/shell-read-establish.js +11 -61
- package/dist/tools/fs/shell-read-identity.js +6 -3
- package/dist/tools/fs/shell-read-judge.d.ts +13 -15
- package/dist/tools/fs/shell-read-judge.js +18 -4
- package/dist/tools/fs/shell-read-plan.d.ts +2 -2
- package/dist/tools/web.js +1 -1
- package/package.json +13 -1
- package/test/export-surface.snapshot.json +306 -103
- package/wire-changes/core@7.52.0.json +5859 -0
- package/wire-changes/core@7.53.0.json +1946 -0
- package/dist/core/hook-seats.d.ts +0 -66
- package/dist/core/hook-seats.js +0 -37
- package/dist/prompt-assembly/packs/sema-default.d.ts +0 -2
- package/dist/prompt-assembly/packs/sema-default.js +0 -147
- package/dist/prompts/simple-sections.d.ts +0 -58
- package/dist/prompts/simple-sections.js +0 -43
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { cardDisclosureOf } from "../allow-entry.js";
|
|
2
2
|
import { primaryActivityArg } from "../arg-summary.js";
|
|
3
|
-
import {
|
|
3
|
+
import { classicEventBase, observeClassic } from "../mods/stations.js";
|
|
4
4
|
import { advertisedWritableRootsSeat, exemptRootsSeat, attest, attestationOf, isLiveApproverSeat, resolveAsk } from "../tool-policy.js";
|
|
5
5
|
import { boundInputHashOf } from "../canonical-json.js";
|
|
6
6
|
import { composeCallSignal, raceSettlementAgainstSignal } from "./abort-race.js";
|
|
@@ -10,19 +10,10 @@ import { approvalCardMemberOf } from "../tool-roster.js";
|
|
|
10
10
|
import { gateAskCarry, lateAskSettlementObserver } from "./denial-limit-arms.js";
|
|
11
11
|
import { consumeInheritedAskGrant } from "./inherited-ask-grants.js";
|
|
12
12
|
import { settleReadRootGrant } from "./read-root-grant.js";
|
|
13
|
-
function createDenyObserverNotifier(
|
|
14
|
-
if (
|
|
13
|
+
function createDenyObserverNotifier(bus, signal) {
|
|
14
|
+
if (bus === undefined || !bus.hasHandlers("classic.PermissionDenied"))
|
|
15
15
|
return undefined;
|
|
16
|
-
return
|
|
17
|
-
try {
|
|
18
|
-
const seat = await runHookSeat("permissionDenied", { timeoutMs: hookTimeoutMs, signal }, (sig) => hooks.permissionDenied({ ...payload, signal: sig }));
|
|
19
|
-
if (seat.expired)
|
|
20
|
-
report(hookSeatExpiredError("permissionDenied", hookTimeoutMs, seat.cause, "the deny observation was abandoned; the deny itself is unchanged"));
|
|
21
|
-
}
|
|
22
|
-
catch (err) {
|
|
23
|
-
report(err);
|
|
24
|
-
}
|
|
25
|
-
};
|
|
16
|
+
return (payload) => observeClassic(bus, "classic.PermissionDenied", { ...payload, ...classicEventBase(payload.identity, payload.permissionMode) }, signal);
|
|
26
17
|
}
|
|
27
18
|
const sanitizePreview = (node, depth = 0) => {
|
|
28
19
|
if (depth > 6)
|
|
@@ -61,7 +52,7 @@ function resolveApprovalPreview(tools, toolName, args) {
|
|
|
61
52
|
}
|
|
62
53
|
}
|
|
63
54
|
export function prepareAskLane(input) {
|
|
64
|
-
const { gateMachineryActive, abortController, effectivePolicy, budgetSnapshot, handsCwdRef, handsRoot, stampCallTarget, advertisedWritableDirs, exemptRoots, tools, inheritedUnavailableAsks, inheritedAskGrants, onAsk, humanReviewRef, now, ruleOffersOf, grantBindingOf, askSourceIdentity, riskAxesOf, autoModeDenialTracking, spec, deps, sessionId, runId,
|
|
55
|
+
const { gateMachineryActive, abortController, effectivePolicy, budgetSnapshot, handsCwdRef, handsRoot, stampCallTarget, advertisedWritableDirs, exemptRoots, tools, inheritedUnavailableAsks, inheritedAskGrants, onAsk, humanReviewRef, now, ruleOffersOf, grantBindingOf, askSourceIdentity, riskAxesOf, autoModeDenialTracking, spec, deps, sessionId, runId, grantReadRoot, modBus, notifyOwnHookCrash } = input;
|
|
65
56
|
if (!gateMachineryActive)
|
|
66
57
|
return { askLane: undefined };
|
|
67
58
|
const composedCallSignal = (callSignal) => composeCallSignal(abortController.signal, callSignal);
|
|
@@ -142,6 +133,6 @@ export function prepareAskLane(input) {
|
|
|
142
133
|
}
|
|
143
134
|
return resolved;
|
|
144
135
|
};
|
|
145
|
-
const notifyPermissionDenied = createDenyObserverNotifier(
|
|
136
|
+
const notifyPermissionDenied = createDenyObserverNotifier(modBus, abortController.signal);
|
|
146
137
|
return { askLane: { composedCallSignal, adjudicate, approvalPreviewOf, resolveAskBound, notifyPermissionDenied, notifyHookError: notifyOwnHookCrash } };
|
|
147
138
|
}
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
import type { AgentHarness, AgentTool, ThinkingLevel } from "../../internal/harness.js";
|
|
22
22
|
import type { Model } from "../../internal/llm.js";
|
|
23
23
|
import { forkGovernanceDenial } from "../../agents/subagent.js";
|
|
24
|
-
import type {
|
|
24
|
+
import type { PromptArtifact } from "../../prompt-assembly/artifact.js";
|
|
25
25
|
import { type WorkflowSizeGuideline } from "../../orchestration/workflow-size-guideline.js";
|
|
26
26
|
import { type AutoModeArmingRecipe } from "../auto-mode-arming.js";
|
|
27
27
|
import { type PermissionModeController } from "../mode-policy.js";
|
|
@@ -131,6 +131,8 @@ export interface PrepareCapsAndWorkflowInput {
|
|
|
131
131
|
peerLaneActive: boolean;
|
|
132
132
|
/** borrowed-readonly — the leg's effective delegation fact (`effectiveDelegationFacts`): the classifier window shows its user lane as the launching agent's. */
|
|
133
133
|
delegated: boolean;
|
|
134
|
+
/** borrowed-mutable — `Prepared.sideCallBookRef`: written by the run body (never here); the classifier books each of its replies through it. */
|
|
135
|
+
sideCallBookRef: Prepared["sideCallBookRef"];
|
|
134
136
|
/** borrowed-readonly — whether the BUILT-IN SendMessage is on this face (the lane rule's second term). */
|
|
135
137
|
peerSendMessageBuiltIn: boolean;
|
|
136
138
|
/** borrowed-readonly — the trusted Runner self-reference the Workflow mount executes children through; undefined when
|
|
@@ -140,7 +142,7 @@ export interface PrepareCapsAndWorkflowInput {
|
|
|
140
142
|
memoryEngineSession: () => Prepared["memoryEngineSession"];
|
|
141
143
|
/** borrowed-readonly — LATE-BOUND: the adopted center artifact; the Workflow mount's two center getters read it at THEIR call time. */
|
|
142
144
|
centerAdoption: () => {
|
|
143
|
-
artifact:
|
|
145
|
+
artifact: PromptArtifact;
|
|
144
146
|
sourceRevision?: string;
|
|
145
147
|
} | undefined;
|
|
146
148
|
}
|
|
@@ -117,7 +117,7 @@ function autoModeArmReasonOf(intent, facePresent, caps, capsFaulted) {
|
|
|
117
117
|
return { armed: true, reason: "armed" };
|
|
118
118
|
}
|
|
119
119
|
export async function prepareCapsAndWorkflow(input) {
|
|
120
|
-
const { spec, deps, parentSpecSeat, checkpointSeat, internals, session, sessionId, runId, hostTaskId, taskScope, taskRootFinal, model, thinking, lockedPreflight, toolEffects, toolFaceSnapshot, promptProfile, resolvedInteractionPosture, harnessRef, askSeat, runClampSource, forwardEvent, inheritedGateForChildren, enrichSpecToolCtx, maybeOffload, requestReview, enterPlanMode, permissionMode, readDenyEntries, peerLaneActive, peerSendMessageBuiltIn, runnerSelf, delegated } = input;
|
|
120
|
+
const { spec, deps, parentSpecSeat, checkpointSeat, internals, session, sessionId, runId, hostTaskId, taskScope, taskRootFinal, model, thinking, lockedPreflight, toolEffects, toolFaceSnapshot, promptProfile, resolvedInteractionPosture, harnessRef, askSeat, runClampSource, forwardEvent, inheritedGateForChildren, enrichSpecToolCtx, maybeOffload, requestReview, enterPlanMode, permissionMode, readDenyEntries, peerLaneActive, peerSendMessageBuiltIn, runnerSelf, delegated, sideCallBookRef } = input;
|
|
121
121
|
const roster = new RosterBuilder(toolEffects);
|
|
122
122
|
for (const t of spec.tools ?? []) {
|
|
123
123
|
const mounted = mountCallerTool(t);
|
|
@@ -254,13 +254,30 @@ export async function prepareCapsAndWorkflow(input) {
|
|
|
254
254
|
}
|
|
255
255
|
const classifierAuth = await spec.getApiKeyAndHeaders?.(rungModel);
|
|
256
256
|
const request = async (seat, suffix) => {
|
|
257
|
-
const
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
257
|
+
const book = sideCallBookRef.book;
|
|
258
|
+
if (book === undefined)
|
|
259
|
+
throw new Error("the auto-mode classifier was asked before the run body bound the leg's usage account, which it does before any tool call");
|
|
260
|
+
let replied = false;
|
|
261
|
+
const cut = () => {
|
|
262
|
+
if (!replied)
|
|
263
|
+
book("classifier", rungModel, undefined);
|
|
264
|
+
};
|
|
265
|
+
signal?.addEventListener("abort", cut, { once: true });
|
|
266
|
+
let response;
|
|
267
|
+
try {
|
|
268
|
+
response = await classifierRuntime.completeSimple(rungModel, { systemPrompt: classifierSystemPrompt(), messages: [{ role: "user", content: userPrompt + suffix, timestamp: Date.now() }] }, {
|
|
269
|
+
signal,
|
|
270
|
+
maxRetries: AUTO_MODE_CLASSIFIER_MAX_RETRIES,
|
|
271
|
+
...seat,
|
|
272
|
+
...(classifierAuth?.apiKey !== undefined ? { apiKey: classifierAuth.apiKey } : {}),
|
|
273
|
+
...(classifierAuth?.headers !== undefined ? { headers: classifierAuth.headers } : {}),
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
finally {
|
|
277
|
+
replied = true;
|
|
278
|
+
signal?.removeEventListener("abort", cut);
|
|
279
|
+
}
|
|
280
|
+
book("classifier", rungModel, response);
|
|
264
281
|
const failure = classifierReplyFailure(response);
|
|
265
282
|
if (failure !== undefined)
|
|
266
283
|
throw failure;
|
|
@@ -23,7 +23,8 @@ import { type BrainCallGuardrailRef } from "../../brain/timeout.js";
|
|
|
23
23
|
import type { Model } from "../../internal/llm.js";
|
|
24
24
|
import type { ThinkingLevel } from "../../internal/harness.js";
|
|
25
25
|
import { type MicroCompactMachine } from "../context-edit.js";
|
|
26
|
-
import {
|
|
26
|
+
import { recordedModeSeed } from "../checkpoint-store.js";
|
|
27
|
+
import { type ConfigDoorEntry, type LockedPreflight } from "../locked-config.js";
|
|
27
28
|
import { type ResolvedRole } from "../roles.js";
|
|
28
29
|
import { type ResolvedSkillListingBudget } from "../skill-listing-budget.js";
|
|
29
30
|
import type { SessionStore } from "../session.js";
|
|
@@ -31,6 +32,7 @@ import type { RunnerDeps, TaskLimits, TaskSpec } from "../types.js";
|
|
|
31
32
|
import { type UsageWindow } from "../usage-window-store.js";
|
|
32
33
|
import { type AskSeat } from "../wiring-manifest.js";
|
|
33
34
|
import type { PrepareResume, RunInternals, ToolFaceLists } from "./contracts.js";
|
|
35
|
+
import { resolveHost } from "../../prompt-assembly/select.js";
|
|
34
36
|
import { type RosterSpec } from "./caller-roster.js";
|
|
35
37
|
export declare function limitConfigError(code: string, message: string): Error & {
|
|
36
38
|
code?: string;
|
|
@@ -143,6 +145,10 @@ export interface PrepareConfigDoorsResult {
|
|
|
143
145
|
toolFaceLists: ToolFaceLists;
|
|
144
146
|
/** owned — the profile half of the single decision point (model-independent by contract). */
|
|
145
147
|
promptProfile: "simple" | "classic";
|
|
148
|
+
/** owned — the host selector values (`TaskSpec.promptRole` / `TaskSpec.promptForm`, validated) the assembly selects on. */
|
|
149
|
+
promptHost: ReturnType<typeof resolveHost>;
|
|
150
|
+
/** owned — the run's binding (`TaskSpec.promptBinding`, validated): the selector value every overlay's `when.binding` reads. */
|
|
151
|
+
promptBinding: string | undefined;
|
|
146
152
|
/** owned — the administrator lock snapshot; the rest of prepare reads guarded slots through it. */
|
|
147
153
|
lockedPreflight: LockedPreflight;
|
|
148
154
|
/** owned — the resolved interaction posture (spec > spawning run > deployment); the
|
|
@@ -225,4 +231,49 @@ export declare function resolveMicroCompactKnob(bag: RunnerDeps["microCompact"])
|
|
|
225
231
|
machine: MicroCompactMachine;
|
|
226
232
|
clearOnRejection: boolean;
|
|
227
233
|
};
|
|
234
|
+
/** The seat a checkpoint-store resolution is judged at: the store the task's own config names, else the deployment's. */
|
|
235
|
+
export declare const checkpointStoreSeat: (spec: {
|
|
236
|
+
checkpointStore?: unknown;
|
|
237
|
+
}) => "taskConfig" | "deps";
|
|
238
|
+
/** The first door of a resume: its re-supplied config is a record. A `null`, a primitive or an array where the record is declared is refused by name
|
|
239
|
+
* (`config.invalid_argument`), through the same channel as every door after it, before any of its members is read. */
|
|
240
|
+
export declare function assertResumeConfigRecord(config: unknown): void;
|
|
241
|
+
/** The spec the value doors read: a prepare's (its roster is faces) or a resume's re-supplied config (no objective, no session id). */
|
|
242
|
+
type ValueDoorSpec = Omit<TaskSpec, "tools" | "objective" | "sessionId" | "userAttachments"> & Partial<Pick<TaskSpec, "objective" | "sessionId">>;
|
|
243
|
+
type ConfigValueDoorsResult = Pick<PrepareConfigDoorsResult, "toolFaceLists" | "promptHost" | "promptBinding" | "lockedPreflight" | "microCompactKnob" | "memoryDelegationEvidence" | "memoryProvenance" | "memoryCapturePolicy" | "usageWindows" | "brainCallGuardrailMs"> & {
|
|
244
|
+
skillListingSeats: {
|
|
245
|
+
fraction: unknown;
|
|
246
|
+
maxDescChars: unknown;
|
|
247
|
+
};
|
|
248
|
+
skills: TaskSpec["skills"];
|
|
249
|
+
};
|
|
250
|
+
/**
|
|
251
|
+
* The phase's VALUE doors as ONE function with two callers — each judges a declared value against its own vocabulary, reading only the
|
|
252
|
+
* spec, the deployment's deps, the session store the Runner was constructed over and whether the leg resumes: {@link prepareConfigDoors}
|
|
253
|
+
* enters them as they stand, and a resume's screen before the claim (`refuseResumeDoors`) enters them through the resume's refusal
|
|
254
|
+
* channel, so a resume prepare would refuse here is refused before it consumes the row. `enter(seat, door)` names the input that carries
|
|
255
|
+
* each value; what a door resolves is returned. Every door is total over what a plain-JSON caller can hand it: a `null`, a primitive or an
|
|
256
|
+
* array where a record is declared is refused by its own code, never read through.
|
|
257
|
+
*/
|
|
258
|
+
export declare function configValueDoors(input: {
|
|
259
|
+
spec: ValueDoorSpec;
|
|
260
|
+
deps: RunnerDeps;
|
|
261
|
+
resumeLeg: boolean;
|
|
262
|
+
sessions: SessionStore;
|
|
263
|
+
}, enter?: ConfigDoorEntry): ConfigValueDoorsResult;
|
|
264
|
+
/**
|
|
265
|
+
* The doors a RESUMED leg's prepare refuses at, run as one screen BEFORE the claim — prepare's own functions, so a refusal carries
|
|
266
|
+
* the very sentence and code prepare throws: the mode doors (`refusePermissionModeDoors`), the output-style seat, the approval
|
|
267
|
+
* reach, the skills invoked by name (the part no roster changes), the attachments (a resume sends no new human message, so any
|
|
268
|
+
* entry is refused), this phase's value doors over the config, the deployment's deps and the session store the Runner holds
|
|
269
|
+
* ({@link configValueDoors}, the retention capability door included) and the mode words the row recorded (`recordedModeSeed`).
|
|
270
|
+
* It leaves by the resume's ONE refusal channel (`asResumeConfigRefusal`:
|
|
271
|
+
* `checkpoint.config_refused`, `detail.code` = prepare's code, `detail.field` = `"taskConfig"`, `"deps"` or `"inheritedGate"`)
|
|
272
|
+
* where prepare would end the leg `failed` after the claim — the row consumed on a store without `reopen`, replayed as a system
|
|
273
|
+
* retry on one with it, which a configuration fix cannot reach. Before the claim the row stays `pending` and byte-identical and the
|
|
274
|
+
* corrected resume redeems the same token. A throw that is none of prepare's codes leaves as it was thrown. Returns the config the
|
|
275
|
+
* leg is handed: the caller's, its MCP servers and A2A peers the frozen entries the lock layer judged (read once, dialed as judged).
|
|
276
|
+
*/
|
|
277
|
+
export declare function refuseResumeDoors<C extends ValueDoorSpec & Pick<TaskSpec, "userAttachments">>(config: C, recordedGate: Parameters<typeof recordedModeSeed>[0], deps: RunnerDeps, sessions: SessionStore): C;
|
|
228
278
|
export declare function prepareConfigDoors(input: PrepareConfigDoorsInput): PrepareConfigDoorsResult;
|
|
279
|
+
export {};
|
|
@@ -3,21 +3,30 @@ import { assertContainmentFaceValue } from "../../tools/fs/index.js";
|
|
|
3
3
|
import { MICRO_COMPACT_MACHINES } from "../context-edit.js";
|
|
4
4
|
import { assertAddOnlySeats } from "../child-clamp-seats.js";
|
|
5
5
|
import { assertNoRetiredRunnerDeps } from "./retired-runner-deps.js";
|
|
6
|
-
import { resolveCheckpointStore } from "../checkpoint-store.js";
|
|
6
|
+
import { recordedModeSeed, resolveCheckpointStore } from "../checkpoint-store.js";
|
|
7
|
+
import { asResumeConfigRefusal, refusePermissionModeDoors } from "../mode-policy.js";
|
|
8
|
+
import { resolveOutputStyleFrame } from "../output-style.js";
|
|
9
|
+
import { screenUserAttachments } from "../user-attachment.js";
|
|
10
|
+
import { screenUserInvokedSkills } from "../skill-grant.js";
|
|
11
|
+
import { readSkillsSeat } from "./skills-seat.js";
|
|
12
|
+
import { screenHandsBandOptions } from "../hands-band-screen.js";
|
|
7
13
|
import { assertAutoConsolidationWirable } from "./memory-consolidation-driver.js";
|
|
8
14
|
import { isModelPriced, malformedPricingField, modelCostToPricing } from "../pricing.js";
|
|
9
|
-
import { preflightLockedConfig } from "../locked-config.js";
|
|
15
|
+
import { ENTER_AS_IS, preflightLockedConfig } from "../locked-config.js";
|
|
10
16
|
import { assertRetentionCapability } from "../retention.js";
|
|
11
17
|
import { resolveModel, resolveTaskModel, roleModelIfSet } from "../roles.js";
|
|
12
18
|
import { resolveSkillListingBudget } from "../skill-listing-budget.js";
|
|
13
19
|
import { describeRejectedValue } from "../tool-search-setting.js";
|
|
14
20
|
import { applyToolModelGate, assertRestoreGatedToolsValue, modelIdTail } from "../tool-model-gate.js";
|
|
15
21
|
import { resolveUsageWindows } from "../usage-window-store.js";
|
|
16
|
-
import { deriveAskEffective, resolveAskSeat, resolveQuestionSeam } from "../wiring-manifest.js";
|
|
22
|
+
import { deriveAskEffective, resolveAskSeat, resolveQuestionSeam, screenApprovalReach } from "../wiring-manifest.js";
|
|
23
|
+
import { resolveHost } from "../../prompt-assembly/select.js";
|
|
24
|
+
import { resolvePromptBinding } from "../../prompt-assembly/overlay.js";
|
|
17
25
|
import { assertPeerPresenceValue } from "../../agents/peer-directory.js";
|
|
18
26
|
import { snapshotDefinitionLists } from "../../agents/tool-filter.js";
|
|
19
27
|
import { TOTAL_TOKENS_REMINDER_MODES } from "./turn-attachments.js";
|
|
20
28
|
import { rosterFaceOf } from "./caller-roster.js";
|
|
29
|
+
import { refuseRenamedDelegationMounts } from "./sub-agent-deny-lists.js";
|
|
21
30
|
const TASK_LIMIT_KEY_DICT = {
|
|
22
31
|
maxTokens: true,
|
|
23
32
|
maxCostUsd: true,
|
|
@@ -45,8 +54,8 @@ export function limitConfigError(code, message) {
|
|
|
45
54
|
export function resolveTaskLimits(limits) {
|
|
46
55
|
if (limits === undefined)
|
|
47
56
|
return undefined;
|
|
48
|
-
if (typeof limits !== "object" || Array.isArray(limits)) {
|
|
49
|
-
throw limitConfigError("config.limit_invalid", `TaskSpec.limits must be an object (got ${Array.isArray(limits) ? "an array" : typeof limits})`);
|
|
57
|
+
if (typeof limits !== "object" || limits === null || Array.isArray(limits)) {
|
|
58
|
+
throw limitConfigError("config.limit_invalid", `TaskSpec.limits must be an object (got ${limits === null ? "null" : Array.isArray(limits) ? "an array" : typeof limits})`);
|
|
50
59
|
}
|
|
51
60
|
const raw = limits;
|
|
52
61
|
const legal = TASK_LIMIT_KEYS;
|
|
@@ -63,13 +72,13 @@ export function resolveTaskLimits(limits) {
|
|
|
63
72
|
if (value === undefined)
|
|
64
73
|
continue;
|
|
65
74
|
if (typeof value !== "number" || !Number.isFinite(value) || value < 0) {
|
|
66
|
-
throw limitConfigError("config.limit_invalid", `TaskSpec.limits.${key} must be a finite, non-negative number (got ${
|
|
75
|
+
throw limitConfigError("config.limit_invalid", `TaskSpec.limits.${key} must be a finite, non-negative number (got ${describeRejectedValue(value)}) — an unevaluable ceiling is not a ceiling, and folding it to a default would run the task under a limit nobody chose.`);
|
|
67
76
|
}
|
|
68
77
|
}
|
|
69
78
|
const notice = raw.approachNotice;
|
|
70
79
|
if (notice !== undefined && notice !== false) {
|
|
71
80
|
if (typeof notice !== "object" || notice === null || Array.isArray(notice)) {
|
|
72
|
-
throw limitConfigError("config.limit_invalid", `TaskSpec.limits.approachNotice must be \`false\` or { at?: [first, second] } (got ${
|
|
81
|
+
throw limitConfigError("config.limit_invalid", `TaskSpec.limits.approachNotice must be \`false\` or { at?: [first, second] } (got ${describeRejectedValue(notice)})`);
|
|
73
82
|
}
|
|
74
83
|
const at = notice.at;
|
|
75
84
|
if (at !== undefined) {
|
|
@@ -144,34 +153,51 @@ function resolveClearOnRejection(bag) {
|
|
|
144
153
|
}
|
|
145
154
|
return declared ?? true;
|
|
146
155
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
const
|
|
156
|
+
function deploymentWord(raw, seat, words, absent, code, why) {
|
|
157
|
+
if (raw === undefined)
|
|
158
|
+
return absent;
|
|
159
|
+
const word = words.find((w) => w === raw);
|
|
160
|
+
if (word !== undefined)
|
|
161
|
+
return word;
|
|
162
|
+
const got = typeof raw === "string" ? JSON.stringify(raw.length > 64 ? `${raw.slice(0, 64)}…` : raw) : raw === null ? "null" : Array.isArray(raw) ? "an array" : typeof raw;
|
|
163
|
+
const spelled = words.map((w) => `"${w}"`);
|
|
164
|
+
throw limitConfigError(code, `RunnerDeps.${seat} must be ${spelled.slice(0, -1).join(", ")} or ${spelled.at(-1)} when present (got ${got}) — ${why}`);
|
|
165
|
+
}
|
|
166
|
+
export const checkpointStoreSeat = (spec) => (spec.checkpointStore !== undefined ? "taskConfig" : "deps");
|
|
167
|
+
export function assertResumeConfigRecord(config) {
|
|
168
|
+
if (config === null || typeof config !== "object" || Array.isArray(config)) {
|
|
169
|
+
throw limitConfigError("config.invalid_argument", `the resume's taskConfig must be an object — the TaskSpec the run suspended with (got ${config === null ? "null" : Array.isArray(config) ? "an array" : typeof config})`);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
export function configValueDoors(input, enter = ENTER_AS_IS) {
|
|
173
|
+
const { spec, deps, resumeLeg, sessions } = input;
|
|
174
|
+
enter("deps", () => assertNoRetiredRunnerDeps(deps));
|
|
175
|
+
enter("taskConfig", () => assertPeerPresenceValue(spec.peerPresence));
|
|
176
|
+
enter("taskConfig", () => assertRestoreGatedToolsValue(spec.restoreGatedTools));
|
|
177
|
+
const microCompactKnob = enter("deps", () => resolveMicroCompactKnob(deps.microCompact));
|
|
178
|
+
const toolFaceListRefusal = (message, reason) => {
|
|
179
|
+
const e = new Error(message);
|
|
180
|
+
e.code = "config.tool_face_control";
|
|
181
|
+
e.detail = { reason };
|
|
182
|
+
return e;
|
|
183
|
+
};
|
|
154
184
|
const assertToolNameListValue = (value, seat) => {
|
|
155
185
|
if (value === undefined)
|
|
156
186
|
return;
|
|
157
187
|
if (!Array.isArray(value)) {
|
|
158
|
-
|
|
159
|
-
e.code = "config.tool_face_control";
|
|
160
|
-
throw e;
|
|
188
|
+
throw toolFaceListRefusal(`TaskSpec.${seat} must be an array of tool names or absent (got ${value === null ? "null" : typeof value}) — a garbage list must refuse loudly, never be read as "no ${seat}".`, "not_a_list");
|
|
161
189
|
}
|
|
162
190
|
const entries = value;
|
|
163
191
|
for (const entry of entries) {
|
|
164
192
|
if (typeof entry !== "string") {
|
|
165
|
-
|
|
166
|
-
e.code = "config.tool_face_control";
|
|
167
|
-
throw e;
|
|
193
|
+
throw toolFaceListRefusal(`TaskSpec.${seat} entries must be strings (got ${entry === null ? "null" : typeof entry}).`, "not_a_string");
|
|
168
194
|
}
|
|
169
195
|
}
|
|
170
196
|
};
|
|
171
|
-
assertToolNameListValue(spec.allowTools, "allowTools");
|
|
172
|
-
assertToolNameListValue(spec.excludeTools, "excludeTools");
|
|
173
|
-
assertToolNameListValue(spec.deferTools, "deferTools");
|
|
174
|
-
assertToolNameListValue(spec.alwaysLoadTools, "alwaysLoadTools");
|
|
197
|
+
enter("taskConfig", () => assertToolNameListValue(spec.allowTools, "allowTools"));
|
|
198
|
+
enter("taskConfig", () => assertToolNameListValue(spec.excludeTools, "excludeTools"));
|
|
199
|
+
enter("taskConfig", () => assertToolNameListValue(spec.deferTools, "deferTools"));
|
|
200
|
+
enter("taskConfig", () => assertToolNameListValue(spec.alwaysLoadTools, "alwaysLoadTools"));
|
|
175
201
|
const toolFaceLists = {
|
|
176
202
|
allow: spec.allowTools ? Object.freeze([...spec.allowTools]) : undefined,
|
|
177
203
|
exclude: spec.excludeTools ? Object.freeze([...spec.excludeTools]) : undefined,
|
|
@@ -183,114 +209,131 @@ export function prepareConfigDoors(input) {
|
|
|
183
209
|
? Object.freeze([...spec.restoreGatedTools])
|
|
184
210
|
: undefined,
|
|
185
211
|
};
|
|
186
|
-
const
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
212
|
+
const promptHost = enter("taskConfig", () => resolveHost(spec));
|
|
213
|
+
const promptBinding = enter("taskConfig", () => resolvePromptBinding(spec));
|
|
214
|
+
if (spec.resumeAt !== undefined)
|
|
215
|
+
enter("taskConfig", () => {
|
|
216
|
+
if (resumeLeg) {
|
|
217
|
+
const e = new Error("resumeAt cannot be combined with a durable resume");
|
|
218
|
+
e.code = "resume_at.conflicts_resume";
|
|
219
|
+
throw e;
|
|
220
|
+
}
|
|
221
|
+
if (!spec.sessionId) {
|
|
222
|
+
const e = new Error("resumeAt requires a sessionId (the session to branch)");
|
|
223
|
+
e.code = "resume_at.no_session";
|
|
224
|
+
throw e;
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
enter("taskConfig", () => assertContainmentFaceValue(spec.readFace, "read", "spec"));
|
|
228
|
+
enter("deps", () => assertContainmentFaceValue(deps.readFace, "read", "deps"));
|
|
229
|
+
enter("taskConfig", () => assertContainmentFaceValue(spec.writeFace, "write", "spec"));
|
|
230
|
+
enter("deps", () => assertContainmentFaceValue(deps.writeFace, "write", "deps"));
|
|
231
|
+
enter("taskConfig", () => assertAddOnlySeats(spec));
|
|
232
|
+
const memoryDelegationEvidence = enter("deps", () => deploymentWord(deps.memoryDelegationEvidence, "memoryDelegationEvidence", ["static-face", "attested-only"], "static-face", "config.memory_delegation_evidence", "an unevaluable evidence standard is refused loudly, never folded to either standard."));
|
|
233
|
+
const memoryProvenance = enter("deps", () => deploymentWord(deps.memoryProvenance, "memoryProvenance", ["off", "carry"], "carry", "config.memory_provenance", "an unevaluable provenance mode is refused loudly, never folded to either mode."));
|
|
234
|
+
const memoryCapturePolicy = enter("deps", () => deploymentWord(deps.memoryCapturePolicy, "memoryCapturePolicy", ["open", "governed", "capture-required"], "open", "config.memory_capture_policy", "an unevaluable capture posture is refused loudly, never folded to any posture (the fault arms differ per posture, so a guess would pick a polarity nobody configured)."));
|
|
235
|
+
enter("deps", () => assertAutoConsolidationWirable(deps));
|
|
236
|
+
if (spec.resumeAtMode !== undefined)
|
|
237
|
+
enter("taskConfig", () => {
|
|
238
|
+
if (spec.resumeAt === undefined) {
|
|
239
|
+
const e = new Error(`resumeAtMode ${describeRejectedValue(spec.resumeAtMode)} requires resumeAt (there is no branch target to position against)`);
|
|
240
|
+
e.code = "resume_at.mode_without_target";
|
|
241
|
+
throw e;
|
|
242
|
+
}
|
|
243
|
+
if (spec.resumeAtMode !== "at" && spec.resumeAtMode !== "before") {
|
|
244
|
+
const e = new Error(`resumeAtMode ${describeRejectedValue(spec.resumeAtMode)} is invalid — expected "at" (inclusive branch, the default) or "before" (exclusive branch)`);
|
|
245
|
+
e.code = "resume_at.invalid_mode";
|
|
246
|
+
throw e;
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
if (spec.toolMaterializeStrategy !== undefined && spec.toolMaterializeStrategy !== "swap" && spec.toolMaterializeStrategy !== "static")
|
|
250
|
+
enter("taskConfig", () => {
|
|
251
|
+
const e = new Error(`toolMaterializeStrategy must be "swap" or "static" (got ${JSON.stringify(spec.toolMaterializeStrategy)}).`);
|
|
252
|
+
e.code = "config.tool_materialize_invalid";
|
|
191
253
|
throw e;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
e
|
|
254
|
+
});
|
|
255
|
+
if (spec.memoryPersistenceCapable !== undefined && typeof spec.memoryPersistenceCapable !== "boolean")
|
|
256
|
+
enter("taskConfig", () => {
|
|
257
|
+
const e = new Error(`memoryPersistenceCapable must be a boolean when present (got ${JSON.stringify(spec.memoryPersistenceCapable)}) — a non-boolean would silently read as capable.`);
|
|
258
|
+
e.code = "config.memory_persistence_invalid";
|
|
196
259
|
throw e;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
const memoryDelegationEvidenceRaw = deps.memoryDelegationEvidence;
|
|
205
|
-
if (memoryDelegationEvidenceRaw !== undefined && memoryDelegationEvidenceRaw !== "static-face" && memoryDelegationEvidenceRaw !== "attested-only") {
|
|
206
|
-
const evidence = memoryDelegationEvidenceRaw;
|
|
207
|
-
const got = typeof evidence === "string"
|
|
208
|
-
? JSON.stringify(evidence.length > 64 ? `${evidence.slice(0, 64)}…` : evidence)
|
|
209
|
-
: evidence === null
|
|
210
|
-
? "null"
|
|
211
|
-
: Array.isArray(evidence)
|
|
212
|
-
? "an array"
|
|
213
|
-
: typeof evidence;
|
|
214
|
-
const e = new Error(`RunnerDeps.memoryDelegationEvidence must be "static-face" or "attested-only" when present (got ${got}) — ` +
|
|
215
|
-
`an unevaluable evidence standard is refused loudly, never folded to either standard.`);
|
|
216
|
-
e.code = "config.memory_delegation_evidence";
|
|
217
|
-
throw e;
|
|
218
|
-
}
|
|
219
|
-
const memoryDelegationEvidence = memoryDelegationEvidenceRaw === "attested-only" ? "attested-only" : "static-face";
|
|
220
|
-
const memoryProvenanceRaw = deps.memoryProvenance;
|
|
221
|
-
if (memoryProvenanceRaw !== undefined && memoryProvenanceRaw !== "off" && memoryProvenanceRaw !== "carry") {
|
|
222
|
-
const got = typeof memoryProvenanceRaw === "string"
|
|
223
|
-
? JSON.stringify(memoryProvenanceRaw.length > 64 ? `${memoryProvenanceRaw.slice(0, 64)}…` : memoryProvenanceRaw)
|
|
224
|
-
: memoryProvenanceRaw === null
|
|
225
|
-
? "null"
|
|
226
|
-
: Array.isArray(memoryProvenanceRaw)
|
|
227
|
-
? "an array"
|
|
228
|
-
: typeof memoryProvenanceRaw;
|
|
229
|
-
const e = new Error(`RunnerDeps.memoryProvenance must be "off" or "carry" when present (got ${got}) — ` + `an unevaluable provenance mode is refused loudly, never folded to either mode.`);
|
|
230
|
-
e.code = "config.memory_provenance";
|
|
231
|
-
throw e;
|
|
232
|
-
}
|
|
233
|
-
const memoryProvenance = memoryProvenanceRaw === "off" ? "off" : "carry";
|
|
234
|
-
const memoryCapturePolicyRaw = deps.memoryCapturePolicy;
|
|
235
|
-
if (memoryCapturePolicyRaw !== undefined && memoryCapturePolicyRaw !== "open" && memoryCapturePolicyRaw !== "governed" && memoryCapturePolicyRaw !== "capture-required") {
|
|
236
|
-
const got = typeof memoryCapturePolicyRaw === "string"
|
|
237
|
-
? JSON.stringify(memoryCapturePolicyRaw.length > 64 ? `${memoryCapturePolicyRaw.slice(0, 64)}…` : memoryCapturePolicyRaw)
|
|
238
|
-
: memoryCapturePolicyRaw === null
|
|
239
|
-
? "null"
|
|
240
|
-
: Array.isArray(memoryCapturePolicyRaw)
|
|
241
|
-
? "an array"
|
|
242
|
-
: typeof memoryCapturePolicyRaw;
|
|
243
|
-
const e = new Error(`RunnerDeps.memoryCapturePolicy must be "open", "governed" or "capture-required" when present (got ${got}) — ` +
|
|
244
|
-
`an unevaluable capture posture is refused loudly, never folded to any posture (the fault arms differ per posture, so a guess would pick a polarity nobody configured).`);
|
|
245
|
-
e.code = "config.memory_capture_policy";
|
|
246
|
-
throw e;
|
|
247
|
-
}
|
|
248
|
-
const memoryCapturePolicy = memoryCapturePolicyRaw === "governed" ? "governed" : memoryCapturePolicyRaw === "capture-required" ? "capture-required" : "open";
|
|
249
|
-
assertAutoConsolidationWirable(deps);
|
|
250
|
-
if (spec.resumeAtMode !== undefined) {
|
|
251
|
-
if (spec.resumeAt === undefined) {
|
|
252
|
-
const e = new Error(`resumeAtMode "${spec.resumeAtMode}" requires resumeAt (there is no branch target to position against)`);
|
|
253
|
-
e.code = "resume_at.mode_without_target";
|
|
260
|
+
});
|
|
261
|
+
if (spec.toolMaterializeStrategy === "static" && spec.deferSelfResolve === false)
|
|
262
|
+
enter("taskConfig", () => {
|
|
263
|
+
const e = new Error(`toolMaterializeStrategy "static" cannot be combined with deferSelfResolve: false — with the direct-call ` +
|
|
264
|
+
`lane disabled a placeholder is never swapped and never self-resolves, so no deferred tool could ever be ` +
|
|
265
|
+
`called. Use "swap", or leave deferSelfResolve on.`);
|
|
266
|
+
e.code = "config.tool_materialize_unreachable";
|
|
254
267
|
throw e;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
const e = new Error(`resumeAtMode "${String(spec.resumeAtMode)}" is invalid — expected "at" (inclusive branch, the default) or "before" (exclusive branch)`);
|
|
258
|
-
e.code = "resume_at.invalid_mode";
|
|
259
|
-
throw e;
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
if (spec.toolMaterializeStrategy !== undefined && spec.toolMaterializeStrategy !== "swap" && spec.toolMaterializeStrategy !== "static") {
|
|
263
|
-
const e = new Error(`toolMaterializeStrategy must be "swap" or "static" (got ${JSON.stringify(spec.toolMaterializeStrategy)}).`);
|
|
264
|
-
e.code = "config.tool_materialize_invalid";
|
|
265
|
-
throw e;
|
|
266
|
-
}
|
|
267
|
-
if (spec.memoryPersistenceCapable !== undefined && typeof spec.memoryPersistenceCapable !== "boolean") {
|
|
268
|
-
const e = new Error(`memoryPersistenceCapable must be a boolean when present (got ${JSON.stringify(spec.memoryPersistenceCapable)}) — a non-boolean would silently read as capable.`);
|
|
269
|
-
e.code = "config.memory_persistence_invalid";
|
|
270
|
-
throw e;
|
|
271
|
-
}
|
|
272
|
-
if (spec.toolMaterializeStrategy === "static" && spec.deferSelfResolve === false) {
|
|
273
|
-
const e = new Error(`toolMaterializeStrategy "static" cannot be combined with deferSelfResolve: false — with the direct-call ` +
|
|
274
|
-
`lane disabled a placeholder is never swapped and never self-resolves, so no deferred tool could ever be ` +
|
|
275
|
-
`called. Use "swap", or leave deferSelfResolve on.`);
|
|
276
|
-
e.code = "config.tool_materialize_unreachable";
|
|
277
|
-
throw e;
|
|
278
|
-
}
|
|
279
|
-
if (resume === undefined && spec.objective.trim().length === 0) {
|
|
268
|
+
});
|
|
269
|
+
if (!resumeLeg && (spec.objective ?? "").trim().length === 0) {
|
|
280
270
|
const e = new Error("TaskSpec.objective is empty — a task needs an instruction (an empty user message is rejected by strict model endpoints and would fail every later request of the session).");
|
|
281
271
|
e.code = "config.empty_objective";
|
|
282
272
|
throw e;
|
|
283
273
|
}
|
|
284
|
-
const lockedPreflight = preflightLockedConfig(spec, deps);
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
274
|
+
const lockedPreflight = preflightLockedConfig(spec, deps, enter);
|
|
275
|
+
const declaredSkills = spec.skills;
|
|
276
|
+
const skills = declaredSkills === undefined ? undefined : enter("taskConfig", () => readSkillsSeat(declaredSkills));
|
|
277
|
+
enter("deps", () => screenHandsBandOptions(deps.hands));
|
|
278
|
+
const skillListingSeats = { fraction: spec.skillListingBudgetFraction, maxDescChars: spec.skillListingMaxDescChars };
|
|
279
|
+
enter("taskConfig", () => resolveSkillListingBudget(skillListingSeats));
|
|
280
|
+
enter("taskConfig", () => resolveTaskLimits(spec.limits));
|
|
281
|
+
enter("taskConfig", () => resolveAttachmentsConfig(spec.attachments));
|
|
282
|
+
if (spec.resourceSuspend !== undefined)
|
|
283
|
+
enter("taskConfig", () => {
|
|
284
|
+
const declared = spec.resourceSuspend;
|
|
285
|
+
if (typeof declared !== "object" || declared === null || Array.isArray(declared)) {
|
|
286
|
+
throw limitConfigError("config.limit_invalid", `TaskSpec.resourceSuspend must be an object carrying a non-empty \`scope\` (got ${declared === null ? "null" : Array.isArray(declared) ? "an array" : typeof declared}) — it is the allocation every resource checkpoint is filed under.`);
|
|
287
|
+
}
|
|
288
|
+
const rsus = declared;
|
|
289
|
+
if (typeof rsus.scope !== "string" || rsus.scope === "") {
|
|
290
|
+
throw limitConfigError("config.limit_invalid", `TaskSpec.resourceSuspend.scope must be a non-empty string (got ${describeRejectedValue(rsus.scope)}) — it is the multi-tenant isolation key every resource checkpoint is filed under.`);
|
|
291
|
+
}
|
|
292
|
+
for (const key of ["totalBudgetUsd", "totalTokens", "maxSlices", "ttlMs"]) {
|
|
293
|
+
const value = rsus[key];
|
|
294
|
+
if (value === undefined)
|
|
295
|
+
continue;
|
|
296
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value < 0) {
|
|
297
|
+
throw limitConfigError("config.limit_invalid", `TaskSpec.resourceSuspend.${key} must be a finite, non-negative number (got ${describeRejectedValue(value)}) — an unevaluable allocation is not an allocation, and a NaN here blinds even the validated per-slice window.`);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
const usageWindows = enter("deps", () => resolveUsageWindows(deps.usageWindows));
|
|
302
|
+
const taskGuardrail = spec.limits?.brainCallGuardrailMs;
|
|
303
|
+
const brainCallGuardrailMs = enter(taskGuardrail != null ? "taskConfig" : "deps", () => resolveBrainCallGuardrailMs(taskGuardrail ?? deps.brainCallGuardrailMs));
|
|
304
|
+
const checkpointStore = enter(checkpointStoreSeat(spec), () => resolveCheckpointStore(spec, deps));
|
|
305
|
+
const taskStore = checkpointStoreSeat(spec) === "taskConfig" ? checkpointStore : undefined;
|
|
306
|
+
const retention = { policy: deps.retentionPolicy, locked: lockedPreflight.lockedKeys.has("retentionPolicy") };
|
|
307
|
+
enter("deps", () => assertRetentionCapability({
|
|
308
|
+
...retention,
|
|
288
309
|
stores: [
|
|
289
310
|
{ name: "sessionStore", store: sessions },
|
|
290
|
-
{ name: "checkpointStore", store:
|
|
311
|
+
{ name: "checkpointStore", store: taskStore === undefined ? checkpointStore : undefined },
|
|
291
312
|
{ name: "toolResultStore", store: deps.toolResultStore },
|
|
292
313
|
],
|
|
314
|
+
}));
|
|
315
|
+
if (taskStore !== undefined)
|
|
316
|
+
enter("taskConfig", () => assertRetentionCapability({ ...retention, stores: [{ name: "checkpointStore", store: taskStore }] }));
|
|
317
|
+
return { toolFaceLists, promptHost, promptBinding, lockedPreflight, skillListingSeats, skills, microCompactKnob, memoryDelegationEvidence, memoryProvenance, memoryCapturePolicy, usageWindows, brainCallGuardrailMs };
|
|
318
|
+
}
|
|
319
|
+
export function refuseResumeDoors(config, recordedGate, deps, sessions) {
|
|
320
|
+
asResumeConfigRefusal("taskConfig", () => {
|
|
321
|
+
refusePermissionModeDoors(config);
|
|
322
|
+
resolveOutputStyleFrame(config.outputStyle);
|
|
323
|
+
screenApprovalReach(config.approvalReach);
|
|
324
|
+
screenUserInvokedSkills(config);
|
|
325
|
+
screenUserAttachments(config.userAttachments, { resumeLeg: true });
|
|
293
326
|
});
|
|
327
|
+
const { lockedPreflight, skills } = configValueDoors({ spec: config, deps, resumeLeg: true, sessions }, asResumeConfigRefusal);
|
|
328
|
+
asResumeConfigRefusal("inheritedGate", () => void recordedModeSeed(recordedGate));
|
|
329
|
+
return { ...config, ...(config.mcp !== undefined ? { mcp: lockedPreflight.mcp ?? [] } : {}), ...(config.a2a !== undefined ? { a2a: lockedPreflight.a2a ?? [] } : {}), skills };
|
|
330
|
+
}
|
|
331
|
+
export function prepareConfigDoors(input) {
|
|
332
|
+
const { deps, sessions, resume, internals } = input;
|
|
333
|
+
let spec = input.spec;
|
|
334
|
+
const { toolFaceLists, promptHost, promptBinding, lockedPreflight, skillListingSeats, skills, microCompactKnob, memoryDelegationEvidence, memoryProvenance, memoryCapturePolicy, usageWindows, brainCallGuardrailMs } = configValueDoors({ spec, deps, resumeLeg: resume !== undefined, sessions });
|
|
335
|
+
spec = Object.create(Object.getPrototypeOf(spec), { ...Object.getOwnPropertyDescriptors(spec), skills: { value: skills, enumerable: skills !== undefined, writable: false, configurable: false } });
|
|
336
|
+
const promptProfile = resolveModelPromptTraits({ id: "" }, spec, internals).promptProfile;
|
|
294
337
|
const resolvedInteractionPosture = spec.interactionPosture ?? internals?.parentInteractionPosture ?? deps.interactionPosture;
|
|
295
338
|
const askSeat = resolveAskSeat(spec, deps);
|
|
296
339
|
{
|
|
@@ -339,25 +382,8 @@ export function prepareConfigDoors(input) {
|
|
|
339
382
|
}
|
|
340
383
|
}
|
|
341
384
|
}
|
|
342
|
-
resolveTaskLimits(spec.limits);
|
|
343
|
-
resolveAttachmentsConfig(spec.attachments);
|
|
344
|
-
if (spec.resourceSuspend !== undefined) {
|
|
345
|
-
const rsus = spec.resourceSuspend;
|
|
346
|
-
if (typeof rsus.scope !== "string" || rsus.scope === "") {
|
|
347
|
-
throw limitConfigError("config.limit_invalid", `TaskSpec.resourceSuspend.scope must be a non-empty string (got ${String(rsus.scope)}) — it is the multi-tenant isolation key every resource checkpoint is filed under.`);
|
|
348
|
-
}
|
|
349
|
-
for (const key of ["totalBudgetUsd", "totalTokens", "maxSlices", "ttlMs"]) {
|
|
350
|
-
const value = rsus[key];
|
|
351
|
-
if (value === undefined)
|
|
352
|
-
continue;
|
|
353
|
-
if (typeof value !== "number" || !Number.isFinite(value) || value < 0) {
|
|
354
|
-
throw limitConfigError("config.limit_invalid", `TaskSpec.resourceSuspend.${key} must be a finite, non-negative number (got ${String(value)}) — an unevaluable allocation is not an allocation, and a NaN here blinds even the validated per-slice window.`);
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
const usageWindows = resolveUsageWindows(deps.usageWindows);
|
|
359
385
|
const brainCallGuardrailRef = {};
|
|
360
|
-
const
|
|
386
|
+
const mountedRoster = spec.tools;
|
|
361
387
|
if (spec.agents !== undefined && spec.agents.length > 0) {
|
|
362
388
|
const pool = spec.tools ?? [];
|
|
363
389
|
if (!pool.some((t) => typeof t.withAgents === "function")) {
|
|
@@ -377,6 +403,7 @@ export function prepareConfigDoors(input) {
|
|
|
377
403
|
}),
|
|
378
404
|
};
|
|
379
405
|
}
|
|
406
|
+
refuseRenamedDelegationMounts(mountedRoster, spec.tools);
|
|
380
407
|
const resolvedRoleRaw = resolveTaskModel(spec, deps);
|
|
381
408
|
const resolvedRole = internals?.inheritedModelRef !== undefined ? { ...resolvedRoleRaw, modelRef: internals.inheritedModelRef } : resolvedRoleRaw;
|
|
382
409
|
const model = resolvedRole.model;
|
|
@@ -420,11 +447,7 @@ export function prepareConfigDoors(input) {
|
|
|
420
447
|
if (gateDecision.survivors !== undefined) {
|
|
421
448
|
spec = { ...spec, tools: gateDecision.survivors };
|
|
422
449
|
}
|
|
423
|
-
const skillListingBudget = resolveSkillListingBudget({
|
|
424
|
-
fraction: spec.skillListingBudgetFraction,
|
|
425
|
-
maxDescChars: spec.skillListingMaxDescChars,
|
|
426
|
-
model,
|
|
427
|
-
});
|
|
450
|
+
const skillListingBudget = resolveSkillListingBudget({ ...skillListingSeats, model });
|
|
428
451
|
const modelGate = Object.freeze({
|
|
429
452
|
removedByClass: gateDecision.removedByClass,
|
|
430
453
|
unknownClasses: gateDecision.unknownClasses,
|
|
@@ -438,6 +461,8 @@ export function prepareConfigDoors(input) {
|
|
|
438
461
|
spec,
|
|
439
462
|
toolFaceLists,
|
|
440
463
|
promptProfile,
|
|
464
|
+
promptHost,
|
|
465
|
+
promptBinding,
|
|
441
466
|
lockedPreflight,
|
|
442
467
|
resolvedInteractionPosture,
|
|
443
468
|
askSeat,
|