@sema-agent/core 7.51.1 → 7.52.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 +550 -2
- package/dist/agents/agent-transcript-tool.d.ts +1 -1
- package/dist/agents/cascade.js +4 -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/read-inbox-tool.d.ts +1 -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 +5 -0
- package/dist/agents/subagent.js +7 -4
- package/dist/agents/tool-filter.d.ts +40 -13
- package/dist/agents/tool-filter.js +28 -14
- package/dist/bench/metrics.d.ts +1 -0
- package/dist/brain/anthropic.js +16 -12
- package/dist/brain/model-presets.d.ts +4 -5
- package/dist/brain/model-presets.js +4 -4
- 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 +117 -47
- package/dist/brain/route-adjudicator.js +171 -42
- package/dist/brain/route-conformance.js +2 -2
- package/dist/brain/status-sink.d.ts +18 -0
- package/dist/brain/status-sink.js +7 -0
- package/dist/core/allow-entry.d.ts +42 -8
- package/dist/core/allow-entry.js +24 -17
- package/dist/core/auto-compaction.d.ts +23 -20
- package/dist/core/auto-compaction.js +37 -16
- 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 +36 -12
- package/dist/core/checkpoint-store.js +1 -1
- package/dist/core/child-clamp-seats.d.ts +6 -0
- package/dist/core/child-clamp-seats.js +2 -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/engine-capabilities.d.ts +8 -1
- package/dist/core/engine-capabilities.js +1 -1
- package/dist/core/engine-notice.d.ts +36 -19
- package/dist/core/frontmatter-fence.d.ts +10 -0
- package/dist/core/frontmatter-fence.js +6 -0
- package/dist/core/gate-fold.js +5 -23
- package/dist/core/gate-lanes.js +356 -270
- package/dist/core/governance-codes.d.ts +9 -4
- package/dist/core/governance-codes.js +9 -3
- package/dist/core/hooks.d.ts +276 -734
- package/dist/core/hooks.js +97 -192
- 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 +26 -5
- package/dist/core/locked-config.js +31 -6
- 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 +2 -2
- package/dist/core/mcp-server-spec.d.ts +53 -7
- package/dist/core/mcp-server-spec.js +84 -1
- package/dist/core/mcp.d.ts +11 -7
- package/dist/core/mcp.js +27 -9
- 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 +8 -11
- package/dist/core/memory-engine/engine.js +9 -5
- 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 +4 -0
- package/dist/core/mode-policy.js +7 -5
- 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 +701 -0
- package/dist/core/mods/kernel/events.d.ts +242 -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 +65 -0
- package/dist/core/mods/kernel/receive.js +123 -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 +84 -0
- package/dist/core/mods/kernel/site-rules.js +104 -0
- package/dist/core/mods/stations.d.ts +350 -0
- package/dist/core/mods/stations.js +444 -0
- package/dist/core/own-property-receipt.js +11 -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-syntax.d.ts +15 -0
- package/dist/core/permission-rule-syntax.js +24 -16
- package/dist/core/permission-rules.d.ts +7 -1
- package/dist/core/permission-rules.js +26 -15
- 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/retired-keys.d.ts +4 -0
- package/dist/core/retired-keys.js +3 -0
- 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 +85 -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 +8 -2
- package/dist/core/runner/image.js +1 -2
- package/dist/core/runner/inline-image.js +1 -1
- 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/person-path-rows.js +1 -0
- 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 +5 -0
- package/dist/core/runner/prepare-config-doors.js +9 -0
- package/dist/core/runner/prepare-defer-classify.js +3 -4
- 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-inherited-gate.d.ts +8 -12
- package/dist/core/runner/prepare-inherited-gate.js +8 -21
- package/dist/core/runner/prepare-memory-engine-session.js +1 -1
- package/dist/core/runner/prepare-park-ask.js +10 -14
- package/dist/core/runner/prepare-policy-chain.d.ts +18 -16
- package/dist/core/runner/prepare-policy-chain.js +98 -101
- package/dist/core/runner/prepare-project-context.js +7 -10
- package/dist/core/runner/prepare-prompt-assembly.d.ts +45 -40
- package/dist/core/runner/prepare-prompt-assembly.js +134 -101
- package/dist/core/runner/prepare-prompt-inputs.d.ts +18 -19
- package/dist/core/runner/prepare-prompt-inputs.js +5 -7
- package/dist/core/runner/prepare-protocol-tools.d.ts +6 -4
- package/dist/core/runner/prepare-protocol-tools.js +2 -2
- 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 +33 -15
- 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 +5 -6
- package/dist/core/runner/prepare-wiring-manifest.js +7 -7
- 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-preflight.js +38 -16
- package/dist/core/runner/retired-runner-deps.js +3 -1
- 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 +62 -84
- 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 +11 -10
- 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 +33 -22
- package/dist/core/runner/run-tool-mount-facts.js +5 -3
- package/dist/core/runner/run-turn-boundary.js +23 -34
- package/dist/core/runner/runtask.d.ts +6 -7
- package/dist/core/runner/runtask.js +14 -72
- package/dist/core/runner/session-rule-policy.d.ts +6 -4
- package/dist/core/runner/session-rule-policy.js +17 -10
- 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/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 +121 -22
- package/dist/core/runner/sub-agent-deny-lists.js +228 -71
- 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 +20 -28
- package/dist/core/safety-merge-corpus.js +18 -2
- package/dist/core/secret-env.d.ts +93 -20
- package/dist/core/secret-env.js +192 -38
- package/dist/core/session-policy-store.d.ts +93 -17
- package/dist/core/session-policy-store.js +178 -25
- 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/task-event.d.ts +13 -3
- 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 +59 -18
- package/dist/core/tool-policy.js +77 -12
- 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 -1
- package/dist/core/types.js +1 -0
- 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/user-attachment.d.ts +12 -2
- package/dist/core/user-attachment.js +17 -2
- package/dist/core/wiring-manifest.d.ts +14 -13
- 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 +3 -3
- package/dist/engine/harness/types.d.ts +17 -16
- package/dist/engine/harness/types.js +7 -1
- package/dist/engine/llm/types.d.ts +12 -7
- package/dist/engine/loop/agent-loop.js +1 -1
- package/dist/engine/loop/types.d.ts +1 -1
- 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 +24 -17
- package/dist/index.js +15 -12
- package/dist/internal/harness.d.ts +1 -1
- package/dist/internal/harness.js +1 -1
- 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 +37 -56
- package/dist/prompt-assembly/artifact-store.js +31 -49
- package/dist/prompt-assembly/artifact.d.ts +89 -76
- package/dist/prompt-assembly/artifact.js +167 -146
- package/dist/prompt-assembly/assemble.d.ts +34 -29
- package/dist/prompt-assembly/assemble.js +33 -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 +59 -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 +124 -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 +24 -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 +127 -0
- package/dist/prompt-assembly/overlay.js +301 -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 +56 -0
- package/dist/prompt-assembly/select.js +69 -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 -500
- package/dist/prompts/default.js +20 -285
- package/dist/prompts/supervisor.d.ts +6 -71
- package/dist/prompts/supervisor.js +6 -117
- package/dist/stores/file/session-policy-store.d.ts +3 -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 +256 -99
- package/wire-changes/core@7.51.1.json +5 -5
- package/wire-changes/core@7.51.2.json +293 -0
- package/wire-changes/core@7.52.0.json +5859 -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
|
@@ -36,7 +36,9 @@ import type { CacheBreakDetector, ToolFingerprintInput } from "../cache-break-de
|
|
|
36
36
|
import type { Checkpoint, CheckpointState, CheckpointStore, CheckpointToken, PendingSteerEntry, PlatformLimitReason, ReopenReason, ResourceLedger, ResourceLimitReason, ResumeOutcome, SerializedCheckpointState } from "../checkpoint-store.js";
|
|
37
37
|
import type { ExecutionOutcomeRecordWord } from "../checkpoint-execution-record.js";
|
|
38
38
|
import type { ClearedProjectionLedger, MicroCompactMachine, OccurrenceIndex } from "../context-edit.js";
|
|
39
|
-
import type {
|
|
39
|
+
import type { ModBus } from "../mods/kernel/index.js";
|
|
40
|
+
import type { LegModBus, LegMods, ModChainLink } from "../mods/stations.js";
|
|
41
|
+
import type { HookInvocationIdentity, OrgGateVerdict, PermissionDeniedPayload, PostToolBatchCall, ToolGateInput } from "../hooks.js";
|
|
40
42
|
import type { MaterializedMcp } from "../mcp.js";
|
|
41
43
|
import type { MemoryEngine } from "../memory-engine/engine.js";
|
|
42
44
|
import type { ResolvedSkillListingBudget } from "../skill-listing-budget.js";
|
|
@@ -62,6 +64,7 @@ import type { SessionReadFileStates } from "./session-read-file-states.js";
|
|
|
62
64
|
import type { LegModeCeiling, SessionModeSeats } from "./session-mode-seats.js";
|
|
63
65
|
import type { BlockedRef, OutputRef, SkillListingEntry } from "./synthetic-tools.js";
|
|
64
66
|
import type { createAttachmentState, WriteFamily } from "./turn-attachments.js";
|
|
67
|
+
import type { SideCallBook } from "./side-call-account.js";
|
|
65
68
|
import type { cacheFamilyOf } from "./usage-accounting.js";
|
|
66
69
|
/**
|
|
67
70
|
* The frozen task-start copies of the caller's tool-face control arrays, as the config-doors phase takes them (synchronously,
|
|
@@ -99,6 +102,14 @@ export interface ToolFaceSnapshot {
|
|
|
99
102
|
*/
|
|
100
103
|
export interface AnnounceOnceSink {
|
|
101
104
|
onError: NonNullable<RunnerDeps["onError"]>;
|
|
105
|
+
/**
|
|
106
|
+
* The same operator sink for a fact about the DEPLOYMENT rather than the conversation (a built-in tool pair that
|
|
107
|
+
* declines to mount because of the deployment's own selector or roster): deduplicated per RUNNER by
|
|
108
|
+
* `(code, text)` instead of per session, because a serving layer that opens a fresh session per request would
|
|
109
|
+
* otherwise repeat a standing configuration fact on every request. Independent of the session record — it
|
|
110
|
+
* writes nothing to the transcript. Same signature as `RunnerDeps.onError`.
|
|
111
|
+
*/
|
|
112
|
+
onErrorOncePerRunner: NonNullable<RunnerDeps["onError"]>;
|
|
102
113
|
}
|
|
103
114
|
/** Static per-tool irreversibility tier, resolved at prepare time by the safety scan. */
|
|
104
115
|
export type IrreversibilityTier = Map<string, "never" | "maybe" | "always">;
|
|
@@ -524,6 +535,8 @@ export interface Prepared {
|
|
|
524
535
|
* leg always knows its identity.
|
|
525
536
|
*/
|
|
526
537
|
hookIdentity: HookInvocationIdentity;
|
|
538
|
+
/** The leg's mods bus: one per leg, admitted at this leg's prepare (both seats, `plugin.register` run once for this leg). Every classic station raises its event on it; its `records` are the manifest's `mods[]`. */
|
|
539
|
+
modBus: ModBus;
|
|
527
540
|
/**
|
|
528
541
|
* This session's DURABLE box, present iff this leg mounted the session-box drain (a top-level leg
|
|
529
542
|
* over a cross-process-safe mailbox with a grammatical session id). The notification lane binds it
|
|
@@ -566,38 +579,18 @@ export interface Prepared {
|
|
|
566
579
|
peerBoundaryRound?: (o: {
|
|
567
580
|
continues: boolean;
|
|
568
581
|
}) => Promise<void>;
|
|
569
|
-
/**
|
|
570
|
-
* The per-invocation TIME BOUND every hook seat of this leg runs under (`Hooks.timeoutMs`, already
|
|
571
|
-
* validated — a garbage value was refused to the default and disclosed ONCE, here, rather than on
|
|
572
|
-
* every tool call). Published for the same reason `hookIdentity` is: the seats live in two files, and
|
|
573
|
-
* a number each station re-derived would be two answers to one wiring question — including two
|
|
574
|
-
* chances to re-refuse the same bad value.
|
|
575
|
-
*/
|
|
576
|
-
hookTimeoutMs: number;
|
|
582
|
+
/** The composition manifest (v3) the `prompt.assembled` frame reports (`trace.ts`, the same member types). */
|
|
577
583
|
promptManifest: {
|
|
578
|
-
|
|
584
|
+
identity: import("../trace.js").PromptManifestIdentity;
|
|
585
|
+
selectors: import("../trace.js").PromptManifestSelectors;
|
|
579
586
|
blocks: Array<{
|
|
580
587
|
id: string;
|
|
581
588
|
chars: number;
|
|
582
589
|
hash: string;
|
|
583
590
|
}>;
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
* `stableBlocks` lane, owner "deployment") as an UNSALTED full sha256 of the section text —
|
|
588
|
-
* the center-publish ↔ manifest end-to-end reconciliation anchor. Core-native sections (env
|
|
589
|
-
* facts, memory tail, user role text) stay salted-only: a plain hash of a short guessable
|
|
590
|
-
* block is a dictionary-preimage surface for trace readers ([E]). */
|
|
591
|
-
sections?: Array<{
|
|
592
|
-
id: string;
|
|
593
|
-
slot: string;
|
|
594
|
-
carrier: string;
|
|
595
|
-
cadence: string;
|
|
596
|
-
cacheClass: string;
|
|
597
|
-
chars: number;
|
|
598
|
-
hash: string;
|
|
599
|
-
contentHash?: string;
|
|
600
|
-
}>;
|
|
591
|
+
sections: import("../trace.js").PromptManifestSection[];
|
|
592
|
+
/** Each overlay the composition superseded; absent when none was. */
|
|
593
|
+
superseded?: import("../../prompt-assembly/overlay.js").SupersededOverlay[];
|
|
601
594
|
/** S2 (additive): the mounted tools plane — contract identity, durable-replay aliases,
|
|
602
595
|
* presentation-invariant shape digest and full wire digest per tool (initial mount face). */
|
|
603
596
|
tools?: ToolManifestRow[];
|
|
@@ -615,26 +608,18 @@ export interface Prepared {
|
|
|
615
608
|
* seat chose it. Absent when nothing is deferred (there is no disclosure to describe). */
|
|
616
609
|
toolDisclosure?: ToolDisclosureManifest;
|
|
617
610
|
};
|
|
618
|
-
/** This run's
|
|
619
|
-
*
|
|
620
|
-
*
|
|
621
|
-
|
|
611
|
+
/** This run's prompt identity inputs and its pinned center layer's provenance, threaded to every compaction-boundary
|
|
612
|
+
* epoch selection so a boundary restates the same identity the prepare-time record names. Replaced by a committed
|
|
613
|
+
* compaction-boundary center change. */
|
|
614
|
+
promptIdentity: import("../../prompt-assembly/epoch.js").RunPromptIdentity;
|
|
622
615
|
/** The LIVE nine-element identity face (refreshed by deferred materialization and
|
|
623
616
|
* the deferred-materialization adoption swap); the manifest holds the prepare-time initial copy. */
|
|
624
617
|
turnSnapshot?: import("../../prompt-assembly/turn-snapshot.js").TurnPromptSnapshot;
|
|
625
|
-
/** The compaction-boundary center-
|
|
626
|
-
*
|
|
627
|
-
*
|
|
628
|
-
*
|
|
629
|
-
|
|
630
|
-
centerCompactionCandidate?: () => {
|
|
631
|
-
centerArtifactDigest?: string;
|
|
632
|
-
sourceRevision?: string;
|
|
633
|
-
clear?: true;
|
|
634
|
-
declaredSections: import("../../prompt-assembly/epoch.js").EpochDeclaredSections;
|
|
635
|
-
overheadTokensAfter: number;
|
|
636
|
-
apply: (committedArtifactDigest?: string) => void;
|
|
637
|
-
} | undefined;
|
|
618
|
+
/** The compaction-boundary center-layer seam (undefined = no source wired, or a child run — a child composes its
|
|
619
|
+
* parent's layer). Returns the maybeCompact `centerAdoption` fragment or undefined; `apply` runs post-CAS only
|
|
620
|
+
* (auto-compaction owns the ordering). Both `promptIdentity` and `promptOverheadTokens` on THIS object are mutated by
|
|
621
|
+
* a successful change (read them at call time, never capture early). */
|
|
622
|
+
centerCompactionCandidate?: () => NonNullable<import("../auto-compaction.js").MaybeCompactOptions["centerAdoption"]> | undefined;
|
|
638
623
|
/** Deferred-tool disclosure: the monotonic set of activated deferred-tool names. Empty
|
|
639
624
|
* (and no `tool_search` injected) when nothing is deferred. Mutated by BOTH disclosure lanes across
|
|
640
625
|
* the run — the injected `tool_search` and the direct-call placeholder lane (default ON) —
|
|
@@ -924,6 +909,12 @@ export interface Prepared {
|
|
|
924
909
|
walltimeMs: number;
|
|
925
910
|
};
|
|
926
911
|
};
|
|
912
|
+
/** The cell the run body binds with the leg's side-call door once `stats` exists; a lane built at prepare (the
|
|
913
|
+
* permission classifier) books its replies through it. A lane that books before the run body bound it is an
|
|
914
|
+
* engine defect and throws. */
|
|
915
|
+
sideCallBookRef: {
|
|
916
|
+
book?: SideCallBook;
|
|
917
|
+
};
|
|
927
918
|
/** The per-task human-review accumulator (synchronous `resolveAsk` waits this leg + the carried
|
|
928
919
|
* prior-leg burden seeded from the resumed checkpoint). The run loop ADDS the durable-resume latency
|
|
929
920
|
* (`now() − cp.suspendedAt`) on a resume, then surfaces it as `stats.humanReview` at assembly (omitted when
|
|
@@ -1323,6 +1314,9 @@ export interface PrepareResume {
|
|
|
1323
1314
|
/** The decision this resume carries (the gate word and, for a review, approve / edit / reject) — read by the mode seed
|
|
1324
1315
|
* (`modeRequestAfterResume`: an approved or edited `plan_review` exits a recorded plan to its pre-plan word). Absent on a prepare that resumes nothing. */
|
|
1325
1316
|
outcome?: ResumeRun["outcome"];
|
|
1317
|
+
/** The leg's mods bus, when the resume entrance already admitted it (a wake message's screen raises
|
|
1318
|
+
* `classic.UserPromptSubmit` before this leg prepares): prepare adopts it instead of admitting a second time. */
|
|
1319
|
+
legMods?: LegMods;
|
|
1326
1320
|
/** How many times this task already suspended (the resumed checkpoint's
|
|
1327
1321
|
* `suspendCount`). The next suspend mints `priorSuspendCount + 1`; past `maxSuspends` it fails
|
|
1328
1322
|
* (`suspend.loop`) instead of re-suspending. Absent/0 ⇒ no prior suspends. */
|
|
@@ -1544,24 +1538,23 @@ export interface InheritedGate extends InheritedAutoModeFace {
|
|
|
1544
1538
|
};
|
|
1545
1539
|
};
|
|
1546
1540
|
/**
|
|
1547
|
-
* Set
|
|
1548
|
-
*
|
|
1549
|
-
*
|
|
1550
|
-
*
|
|
1551
|
-
*
|
|
1552
|
-
*
|
|
1553
|
-
*
|
|
1554
|
-
* face already on the chain, and a descendant substitutes a pass-through for the entry naming the
|
|
1555
|
-
* very callback its own gate will run. A per-task face (`TaskSpec.hooks`) is a different function in
|
|
1556
|
-
* the descendant (or absent), so it folds and travels.
|
|
1541
|
+
* Set by the constraint mint's caller on an entry whose `policy` is the folded form of an ancestor's
|
|
1542
|
+
* `classic.PreToolUse` chain (`createPreToolUseConstraintPolicy`): the chain that leg's admission MOUNTED, as the
|
|
1543
|
+
* entry declares it. It is read for ONE thing — a declaration that this entry carries a chain: beside a policy the
|
|
1544
|
+
* mint did not make, a declared judging `tool.check` handler is refused (`config.mods_invalid`; the guard has no bus to
|
|
1545
|
+
* be raised on), and such an entry is never treated as a caller policy (it licenses no ask grant). It is NEVER the
|
|
1546
|
+
* entry's identity: the chain an entry stands for is read off the bus its policy was minted over (that bus's admission
|
|
1547
|
+
* recorded it), so a host may hand any list here (`[]` included, or none) without moving what is judged.
|
|
1557
1548
|
*
|
|
1558
|
-
*
|
|
1559
|
-
*
|
|
1560
|
-
*
|
|
1561
|
-
*
|
|
1562
|
-
*
|
|
1549
|
+
* The identity (`sameInstallation`) is that chain plus the context the entry's questions are settled in — the frozen
|
|
1550
|
+
* approver, the two durable mandates, the environment, the classifier instance — and it is the CONSERVATIVE test:
|
|
1551
|
+
* two chains over the same registrations in a different order, or a re-built registration object, compare unequal,
|
|
1552
|
+
* and a bus no engine admission mounted is no leg's installation. Chain assembly does not re-append a leg already on
|
|
1553
|
+
* the chain; a descendant's own gate stands in for an entry only when that identity holds under no mandate (the
|
|
1554
|
+
* pass-through of its `classic.PreToolUse`, the skip of its `tool.check`); any other entry is judged on both events
|
|
1555
|
+
* under its own context — judged twice rather than skipped, never toward a missed one.
|
|
1563
1556
|
*/
|
|
1564
|
-
|
|
1557
|
+
mods?: readonly ModChainLink[];
|
|
1565
1558
|
/**
|
|
1566
1559
|
* The environment this screening face was installed against — the source of the `HookEnvCapabilities`
|
|
1567
1560
|
* handed to it, compared BY REFERENCE, `undefined` when the installation had no env face. Part of the
|
|
@@ -1646,14 +1639,21 @@ export interface RunInternals {
|
|
|
1646
1639
|
*/
|
|
1647
1640
|
toolCeiling?: readonly import("../tool-face.js").ToolSelectorLayer[];
|
|
1648
1641
|
/** Set by the delegation lane when the spawning run's prepare judged this leg's own tool lists (its spec's `allowTools` /
|
|
1649
|
-
* `excludeTools` — a definition's or the delegation tool's)
|
|
1650
|
-
* bound to exactly those lists. A prepare whose own lists digest to it does not judge them again
|
|
1651
|
-
*
|
|
1652
|
-
* workflow agent, a team member, a host's direct `runTask`), or lists that digest differently ⇒ the leg judges its own lists. */
|
|
1642
|
+
* `excludeTools` — a definition's or the delegation tool's) against a pool it could list: their digest (`toolListsDigest`), the
|
|
1643
|
+
* evidence bound to exactly those lists. A prepare whose own lists digest to it does not judge them again, and its rows record it
|
|
1644
|
+
* (`CheckpointState.toolListsJudged`) so a resume that hands no internals keeps the judgment. Absent (a delegation tool whose pool
|
|
1645
|
+
* cannot be listed, a workflow agent, a team member, a host's direct `runTask`), or lists that digest differently ⇒ the leg judges its own lists. */
|
|
1653
1646
|
toolListsJudged?: string;
|
|
1654
|
-
/** Set by the delegation lane: whose lists this leg's own are
|
|
1655
|
-
*
|
|
1656
|
-
|
|
1647
|
+
/** Set by the delegation lane: whose lists this leg's own are — the delegation tool that spawned it (its declared name, its mounted one), the
|
|
1648
|
+
* agent definition it was spawned as (absent ⇒ the tool's tool-level list) and `lists`, the digest of exactly the lists it wrote. A refusal
|
|
1649
|
+
* at the leg's prepare names that list (`delegationListWhere`), and the tool's name is a name of this leg's lineage: its own lists are
|
|
1650
|
+
* asked of a universe that carries it. Held only for the lists it wrote ({@link boundOwnToolLists}): other lists are the host's own
|
|
1651
|
+
* `TaskSpec` seats. Absent ⇒ no delegation tool behind the leg's own `TaskSpec` seats. */
|
|
1652
|
+
ownToolLists?: {
|
|
1653
|
+
readonly toolName: string;
|
|
1654
|
+
readonly definition?: string;
|
|
1655
|
+
readonly lists: string;
|
|
1656
|
+
};
|
|
1657
1657
|
/** Set only on an observer sidecar's legs: the leg kind whose protocol is the observer's report tool. */
|
|
1658
1658
|
observerLeg?: true;
|
|
1659
1659
|
/** The live repair bundle from a `runRepairLoop` attempt in flight (attemptCount>0). Serialized onto a
|
|
@@ -2647,6 +2647,8 @@ export interface ResumeRun {
|
|
|
2647
2647
|
* §4.3-3 reserves for the cross-process parked leg). Present only when a wake message passed a
|
|
2648
2648
|
* screen that supplied context. */
|
|
2649
2649
|
wakeMessageHookContext?: string;
|
|
2650
|
+
/** The resumed leg's bus when the wake-message screen admitted it before the claim — prepare adopts it. */
|
|
2651
|
+
legMods?: LegMods;
|
|
2650
2652
|
/** Compensation hook: called iff the resumed run fails with `resume.env_failed` (post-CAS
|
|
2651
2653
|
* workspace `resumeVM` failed) OR `resume.tool_unavailable` (P-7: the approved tool vanished) — in both
|
|
2652
2654
|
* the CAS already consumed the checkpoint but the pending action never ran. `resumeStream` supplies a
|
|
@@ -2695,11 +2697,12 @@ export interface SuspendReap {
|
|
|
2695
2697
|
export interface TurnBoundaryDeps {
|
|
2696
2698
|
spec: TaskSpec;
|
|
2697
2699
|
queue: PushQueue<TaskEvent>;
|
|
2698
|
-
/** The run loop's own latch — read for `userHalted` (the
|
|
2699
|
-
*
|
|
2700
|
-
*
|
|
2700
|
+
/** The run loop's own latch — read for `userHalted` (the `TaskStream.halt()` verb sets the harness stop latch directly,
|
|
2701
|
+
* not through the ctx primitive `Prepared.stopRequestedRef` mirrors: a halted boundary has no next request either, so
|
|
2702
|
+
* the bundle is not collected there) and for `callerStop`, the gate the boundary's compaction pass admits on and carries. */
|
|
2701
2703
|
loopLatch: {
|
|
2702
2704
|
readonly userHalted: boolean;
|
|
2705
|
+
readonly callerStop: import("./caller-stop-gate.js").CallerStopGate;
|
|
2703
2706
|
};
|
|
2704
2707
|
manualCompactRef: {
|
|
2705
2708
|
requested: boolean;
|
|
@@ -2722,9 +2725,8 @@ export interface TurnBoundaryDeps {
|
|
|
2722
2725
|
parentToolCallId?: string;
|
|
2723
2726
|
sourceTaskId?: string;
|
|
2724
2727
|
};
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
}, ctx?: import("../hooks.js").PostToolBatchContext) => PostToolBatchResult | undefined | Promise<PostToolBatchResult | undefined>) | undefined;
|
|
2728
|
+
/** Whether a handler hangs on `classic.PostToolBatch` (the batch is collected only then). */
|
|
2729
|
+
postToolBatchArmed: boolean;
|
|
2728
2730
|
batchArgs: Map<string, unknown> | undefined;
|
|
2729
2731
|
compactionBrain: Brain;
|
|
2730
2732
|
withinTaskCompaction: () => boolean;
|
|
@@ -2784,9 +2786,8 @@ export interface HarnessHandlersDeps {
|
|
|
2784
2786
|
toolProgress: ToolProgressLane;
|
|
2785
2787
|
writeFamilyOf: (name: string) => WriteFamily | undefined;
|
|
2786
2788
|
toolLabels: Map<string, string>;
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
}, ctx?: import("../hooks.js").PostToolBatchContext) => PostToolBatchResult | undefined | Promise<PostToolBatchResult | undefined>) | undefined;
|
|
2789
|
+
/** Whether a handler hangs on `classic.PostToolBatch` (the batch is collected only then). */
|
|
2790
|
+
postToolBatchArmed: boolean;
|
|
2790
2791
|
batchArgs: Map<string, unknown> | undefined;
|
|
2791
2792
|
runnerHooks: {
|
|
2792
2793
|
onError: RunnerDeps["onError"];
|
|
@@ -2841,10 +2842,9 @@ export interface RunnerSelfSeat {
|
|
|
2841
2842
|
* against the catalog in force): prepare hands its leg a call-time reader over it, because this is the one seat a
|
|
2842
2843
|
* running leg re-reads (geometry, not route — see `context-settings.ts`). */
|
|
2843
2844
|
contextOverlayOf?(ref: import("../model-seat.js").ModelRef | undefined): import("../context-settings.js").ContextWindowOverlay | undefined;
|
|
2844
|
-
/** The deployment-level gating baseline (deps toolPolicy
|
|
2845
|
+
/** The deployment-level gating baseline (deps toolPolicy) as a delegate wrapper — for assemblers that compose with it. */
|
|
2845
2846
|
readonly gateBaseline: {
|
|
2846
2847
|
toolPolicy?: RunnerDeps["toolPolicy"];
|
|
2847
|
-
hooks?: RunnerDeps["hooks"];
|
|
2848
2848
|
};
|
|
2849
2849
|
/** Whether a child task THIS runner runs can be placed in a tree other than the caller's (an explicit cwd, a worktree):
|
|
2850
2850
|
* true only when its deps carry an `executionEnvFactory` (live read — `swapDeps` replaces the deps). The delegation tool asks
|
|
@@ -2883,10 +2883,10 @@ export type PrepareTaskFn = (spec: TaskSpec, deps: RunnerDeps, sessions: Session
|
|
|
2883
2883
|
*/
|
|
2884
2884
|
export interface InstallingPhaseResult {
|
|
2885
2885
|
}
|
|
2886
|
-
/** The live-task handle `runLocked` publishes once the harness exists: the harness + abort
|
|
2887
|
-
*
|
|
2888
|
-
*
|
|
2889
|
-
* engine-minted run id, and the
|
|
2886
|
+
/** The live-task handle `runLocked` publishes once the harness exists: the harness + abort controller, the loop latch
|
|
2887
|
+
* (`ended` flips when the single `harness.prompt` settles; `userInterrupted` / `userHalted` are the interrupt and halt
|
|
2888
|
+
* verbs' attribution seats; `callerStop` is the run's caller-stop gate the three stop verbs trip), the run's reminder
|
|
2889
|
+
* mark, its session and engine-minted run id, and the bus + identity envelope the steer entrance screen runs on. */
|
|
2890
2890
|
export interface LiveHandle {
|
|
2891
2891
|
harness: AgentHarness;
|
|
2892
2892
|
abortController: AbortController;
|
|
@@ -2894,13 +2894,15 @@ export interface LiveHandle {
|
|
|
2894
2894
|
ended: boolean;
|
|
2895
2895
|
userInterrupted: boolean;
|
|
2896
2896
|
userHalted: boolean;
|
|
2897
|
+
callerStop: import("./caller-stop-gate.js").CallerStopGate;
|
|
2897
2898
|
};
|
|
2898
2899
|
reminderMark: string;
|
|
2899
2900
|
sessionId: string;
|
|
2900
2901
|
/** The run body's engine-minted run id, so the stream-layer verbs can name the run their disclosures are about. */
|
|
2901
2902
|
runId: string;
|
|
2902
|
-
hookTimeoutMs: number;
|
|
2903
2903
|
hookIdentity: HookInvocationIdentity;
|
|
2904
|
+
/** The leg's mods bus (the steer entrance raises `classic.UserPromptSubmit` on it). */
|
|
2905
|
+
modBus: LegModBus;
|
|
2904
2906
|
/** The leg's live permission-mode seat (`TaskStream.setPermissionMode` steers it). */
|
|
2905
2907
|
permissionMode: PermissionModeController;
|
|
2906
2908
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { runWithCredentialOriginRefusals } from "../../brain/status-sink.js";
|
|
2
|
+
import { deliverEngineNotice } from "../engine-notice.js";
|
|
3
|
+
export function createCredentialOriginRefusalScope({ onNotice, sessionId, runId }) {
|
|
4
|
+
const announced = new Set();
|
|
5
|
+
return (fn) => runWithCredentialOriginRefusals(({ modelId, boundOrigin, requestOrigin }) => {
|
|
6
|
+
const key = `${modelId}\u0000${boundOrigin}\u0000${requestOrigin}`;
|
|
7
|
+
if (announced.has(key))
|
|
8
|
+
return;
|
|
9
|
+
announced.add(key);
|
|
10
|
+
deliverEngineNotice(onNotice, {
|
|
11
|
+
code: "route.credential_origin_mismatch",
|
|
12
|
+
message: `A request for model "${modelId}" was not sent: the model's own credential belongs to ${boundOrigin}, the host it was ` +
|
|
13
|
+
`first sent to, and this request was going to ${requestOrigin}. A credential does not follow its model to another host — ` +
|
|
14
|
+
`the deployment has to give the model a credential for ${requestOrigin} (or point it back at ${boundOrigin}). ` +
|
|
15
|
+
`Said once per run for this model and these two hosts.`,
|
|
16
|
+
detail: { modelId, boundOrigin, requestOrigin, sessionId, runId },
|
|
17
|
+
});
|
|
18
|
+
}, fn);
|
|
19
|
+
}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { NoticeSeatInput } from "./notice-seat-input.js";
|
|
2
2
|
/** Where the announcement goes and whom it is attributed to — the same triple as the sibling `route.*` seats. */
|
|
3
|
-
export
|
|
4
|
-
onNotice: ((notice: EngineNotice) => void) | undefined;
|
|
5
|
-
sessionId: string;
|
|
6
|
-
runId: string;
|
|
7
|
-
}
|
|
3
|
+
export type ExtraBodyDroppedSeatInput = NoticeSeatInput;
|
|
8
4
|
export declare function createExtraBodyDroppedScope({ onNotice, sessionId, runId }: ExtraBodyDroppedSeatInput): <T>(fn: () => Promise<T>) => Promise<T>;
|
|
@@ -26,7 +26,7 @@ import type { AutoModeClassifierRound } from "../auto-mode.js";
|
|
|
26
26
|
import { type Arbitration, type AskClassification, type AskFace, type AskOrigin, type AskOriginFacts } from "../ask-origin.js";
|
|
27
27
|
import { type PermissionResult, type ResolvedAsk, type ToolCallRequest } from "../tool-policy.js";
|
|
28
28
|
import type { SafeNotifier } from "../safe-notify.js";
|
|
29
|
-
import type {
|
|
29
|
+
import type { PermissionDeniedPayload, PreToolUseResult, ToolGateInput, ToolGateResult } from "../hooks.js";
|
|
30
30
|
/** The ask a gate pass settled, as the gate captured it at its resolution site: the settlement the
|
|
31
31
|
* resolver composed and the origin word the ask carried. Both or neither (invariant I1). `licensed` is the engine record's
|
|
32
32
|
* digest of the bytes the settlement licensed: the allow exit keeps a settlement only for the bytes that run. */
|
|
@@ -126,32 +126,31 @@ export declare function cloneObserverInput(input: unknown): unknown;
|
|
|
126
126
|
* freeze the call's input under the tool.
|
|
127
127
|
*/
|
|
128
128
|
export declare function frozenInputSnapshot(input: unknown): unknown;
|
|
129
|
+
/** What one `classic.PreToolUse` screening came to: an answer the receipt took (`undefined` = no opinion), or the
|
|
130
|
+
* engine's fail-closed refusal of the call with its sentence (a handler that failed or broke the site's contract,
|
|
131
|
+
* or a cancel). */
|
|
132
|
+
/** A screen's outcome; an answer names the registration whose answer the chain returned (`answeredBy`, absent when no
|
|
133
|
+
* handler spoke). */
|
|
134
|
+
export type PreToolUseScreen = {
|
|
135
|
+
readonly kind: "answered";
|
|
136
|
+
readonly answer: PreToolUseResult | undefined;
|
|
137
|
+
readonly answeredBy?: string;
|
|
138
|
+
} | {
|
|
139
|
+
readonly kind: "refused";
|
|
140
|
+
readonly reason: string;
|
|
141
|
+
};
|
|
129
142
|
/**
|
|
130
|
-
* The PreToolUse screening face as the gate's stations see it —
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
* a `preToolUse` face is wired.
|
|
143
|
+
* The PreToolUse screening face as the gate's stations see it — `classic.PreToolUse` raised on the leg's bus, the
|
|
144
|
+
* per-screening e, the answer receipt and the fail-closed sentences behind one method, so the approved-edit re-screen
|
|
145
|
+
* in the lanes runs the SAME screening the phase-1 pass ran. Present on the pass exactly when a handler hangs on the
|
|
146
|
+
* event (an observe handler runs inside the screening too; it never decides).
|
|
135
147
|
*/
|
|
136
148
|
export interface PreToolUseScreening {
|
|
137
|
-
/**
|
|
138
|
-
*
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
* seat runner's own; a wrapper that screened the answer inside a second `async` cost one more tick there. An
|
|
142
|
-
* expired seat is reported, not thrown; a crashing face rejects. */
|
|
143
|
-
screen(args: unknown): Promise<HookSeatOutcome<PreToolUseResult | undefined>>;
|
|
144
|
-
/** The result screen over an answered seat's value: an out-of-contract decision becomes the ordinary hook deny. */
|
|
145
|
-
screened(answer: PreToolUseResult | undefined): PreToolUseResult | undefined;
|
|
146
|
-
/** The model-facing text for a face that THREW while screening `subject`. */
|
|
147
|
-
crashReason(subject: string, err: unknown): string;
|
|
148
|
-
/** The model-facing text for a face that never ANSWERED while screening `subject` (the timeout arm also
|
|
149
|
-
* reports on the deployment lane; a task-abort expiry does not). */
|
|
150
|
-
unansweredReason(subject: string, cause: "timeout" | "aborted"): Promise<string>;
|
|
151
|
-
/** The model-facing text for the face's OWN deny of this call (unwrapped; every exit wraps it with the leg's mark). */
|
|
149
|
+
/** Raise `classic.PreToolUse` over `args`; `subject` names what is screened in a fail-closed sentence. What the gate
|
|
150
|
+
* does after the screen answers runs in the screen's own continuation. */
|
|
151
|
+
screen(args: unknown, subject: string): Promise<PreToolUseScreen>;
|
|
152
|
+
/** The model-facing text for the screen's OWN deny of this call (unwrapped; every exit wraps it with the leg's mark). */
|
|
152
153
|
deniedReason(answer: PreToolUseResult): string;
|
|
153
|
-
/** The model-facing text for an answer the decision receipt refused (an ENGINE fail-closed, not the face's deny). */
|
|
154
|
-
refusedReason(answer: PreToolUseResult): string;
|
|
155
154
|
}
|
|
156
155
|
/** The FACE a pass's questions are put on ({@link askFaceOf} of the call's wire name) — the one reading of it the
|
|
157
156
|
* write-protection tighten (the fold) and every class derivation (the lanes) make. */
|
|
@@ -198,9 +197,9 @@ export interface GatePass {
|
|
|
198
197
|
readonly ledger: SettlementLedger;
|
|
199
198
|
/** borrowed-readonly — the ONE emission seat of the deny observer for this pass, bounded and contained like
|
|
200
199
|
* every other seat (the hook machinery owns the seat runner; the exits call this). */
|
|
201
|
-
readonly notifyPermissionDenied: (payload:
|
|
202
|
-
/** borrowed-readonly — the PreToolUse screening face ({@link PreToolUseScreening}), or undefined when no
|
|
203
|
-
* `
|
|
200
|
+
readonly notifyPermissionDenied: (payload: PermissionDeniedPayload) => Promise<void>;
|
|
201
|
+
/** borrowed-readonly — the PreToolUse screening face ({@link PreToolUseScreening}), or undefined when no handler hangs
|
|
202
|
+
* on `classic.PreToolUse` (the edit chain then re-screens nothing). */
|
|
204
203
|
readonly screening: PreToolUseScreening | undefined;
|
|
205
204
|
/** borrowed-readonly — the station group that runs AFTER the fold (the lanes: org layer, rule lane, classifier,
|
|
206
205
|
* parks, resolution, edit chain, and the exit they end in), handed the pass by the fold's LAST station on the
|
|
@@ -212,14 +211,14 @@ export interface GatePass {
|
|
|
212
211
|
* behind the policy's answer could not land in between. Returns the gate result (a park's suspension or the
|
|
213
212
|
* exit's record). Writer: the dispatch (`runToolGate`, which wires `runGateLanes`). Reader: the fold's tail. */
|
|
214
213
|
readonly afterFold: (pass: GatePass) => Promise<ToolGateResult>;
|
|
215
|
-
/** borrowed-mutable — the FINAL args
|
|
216
|
-
*
|
|
214
|
+
/** borrowed-mutable — the FINAL args, always the pass's own immutable value (`ownArgs`): the model's input as taken at
|
|
215
|
+
* the entry, rewritten by the phase-1 hook, by the policy rewrite on the ask path and by the exits' rewrite fold.
|
|
217
216
|
* Writers: the dispatch (phase 1), the lanes, the exits. */
|
|
218
217
|
currentInput: unknown;
|
|
219
|
-
/** borrowed-mutable — the adjudication request. Minted over the
|
|
218
|
+
/** borrowed-mutable — the adjudication request. Minted over the pass's args so the record is whole from
|
|
220
219
|
* the first station, and RE-MINTED by the adjudication station over the FINAL post-screen args (the
|
|
221
|
-
* pre-existing `const req` site); `args` is re-pointed at the policy rewrite on the ask path
|
|
222
|
-
*
|
|
220
|
+
* pre-existing `const req` site); `args` is re-pointed at the policy rewrite on the ask path. Writers: the
|
|
221
|
+
* fold (mint), the lanes (`args`). */
|
|
223
222
|
req: ToolCallRequest;
|
|
224
223
|
/** borrowed-mutable — the PreToolUse `additionalContext` collected for this call (pushed into; the binding
|
|
225
224
|
* is fixed). Writers: the dispatch (phase 1), the lanes (sandbox admission note, the edit re-screen). */
|
|
@@ -231,10 +230,14 @@ export interface GatePass {
|
|
|
231
230
|
hookAsk: Extract<PermissionResult, {
|
|
232
231
|
action: "ask";
|
|
233
232
|
}> | undefined;
|
|
234
|
-
/** borrowed-mutable — the phase-1
|
|
235
|
-
* speaks only while no policy rewrote the arguments after the
|
|
236
|
-
* lanes' allow layer (its one reader). */
|
|
237
|
-
|
|
233
|
+
/** borrowed-mutable — the phase-1 screen answered its own `allow` (the exact word), naming the registration that answered
|
|
234
|
+
* it: the allow layer's hook member (its `entries`), which speaks only while no policy rewrote the arguments after the
|
|
235
|
+
* screen saw them. Writer: the dispatch (phase 1). Reader: the lanes' allow layer (its one reader). */
|
|
236
|
+
hookAllowedBy?: readonly string[];
|
|
237
|
+
/** borrowed-mutable — `tool.check` was raised in this pass's first adjudication, which raises it once: set by the
|
|
238
|
+
* raise in front of the ask branch, read by the raise behind the read-only arm (it then raises nothing). Writer and
|
|
239
|
+
* reader: the lanes. */
|
|
240
|
+
toolCheckRaised?: true;
|
|
238
241
|
/** borrowed-mutable — set by a park attempt that FAILED (see `ParkAttemptFailed`). Read at the single deny
|
|
239
242
|
* exit — whatever the fallback chain then decides to say, it says it knowing the park was tried first.
|
|
240
243
|
* Writers: the three park sites. */
|
|
@@ -335,8 +338,16 @@ export interface GatePass {
|
|
|
335
338
|
* deployment's only evidence of a broken hook is a tool that mysteriously stops working.
|
|
336
339
|
*/
|
|
337
340
|
export declare function engineFailClosedExit(pass: GatePass, reason: string): Promise<ToolGateResult>;
|
|
341
|
+
/** The refusal sentence for args the gate could not take into its own copy (`ownArgs` refused them), naming what. */
|
|
342
|
+
export declare const unownedArgsMessage: (subject: string, reason: string) => string;
|
|
343
|
+
/**
|
|
344
|
+
* The model's args could not be taken into the pass's own copy (a function, a shared buffer, a typed array): nobody judged
|
|
345
|
+
* them, so nothing may run them. The single deny exit (the observer fires), in the policy layer's word — the value is the
|
|
346
|
+
* deployment's own (a host driving the gate; the runner's calls are always clonable).
|
|
347
|
+
*/
|
|
348
|
+
export declare function unownedArgsExit(pass: GatePass, reason: string): Promise<ToolGateResult>;
|
|
338
349
|
/** The hook's OWN deny in phase 1. A PreToolUse hook deny does NOT fire `permissionDenied`
|
|
339
|
-
* (the exclusion recorded on `
|
|
350
|
+
* (the exclusion recorded on `PermissionDeniedPayload`) — this return stays observer-free. */
|
|
340
351
|
export declare function hookDenyExit(pass: GatePass, deniedReason: string): ToolGateResult;
|
|
341
352
|
/**
|
|
342
353
|
* The exit of the adjudicate chain — the pass has a standing `deny` or `allow` (every ask was resolved or
|
|
@@ -190,6 +190,12 @@ export async function engineFailClosedExit(pass, reason) {
|
|
|
190
190
|
await notifyPermissionDenied({ toolName, input: cloneObserverInput(finalInput), toolCallId, reason, gate, ...(input.identity !== undefined ? { identity: input.identity } : {}) });
|
|
191
191
|
return { block: true, reason: formatHookFeedback(reason, input.reminderMark), gate, finalInput, preToolContext: pass.preToolContext };
|
|
192
192
|
}
|
|
193
|
+
export const unownedArgsMessage = (subject, reason) => `${subject} could not be taken into the gate's own copy (${reason}) — denied fail-closed`;
|
|
194
|
+
export async function unownedArgsExit(pass, reason) {
|
|
195
|
+
pass.decision = { action: "deny", message: unownedArgsMessage(`the arguments of "${pass.toolName}"`, reason) };
|
|
196
|
+
pass.deniedBy = "policy";
|
|
197
|
+
return await exitGate(pass);
|
|
198
|
+
}
|
|
193
199
|
export function hookDenyExit(pass, deniedReason) {
|
|
194
200
|
const { input } = pass;
|
|
195
201
|
return {
|
|
@@ -211,7 +217,7 @@ function unresolvableCauseOfSettlement(gate) {
|
|
|
211
217
|
return undefined;
|
|
212
218
|
}
|
|
213
219
|
export async function exitGate(pass) {
|
|
214
|
-
const { input,
|
|
220
|
+
const { input, toolName, toolCallId, ledger, notifyPermissionDenied } = pass;
|
|
215
221
|
if (pass.decision.action === "deny") {
|
|
216
222
|
if (pass.decision.updatedInput !== undefined) {
|
|
217
223
|
pass.currentInput = pass.decision.updatedInput;
|
|
@@ -265,7 +271,7 @@ export async function exitGate(pass) {
|
|
|
265
271
|
const release = pass.arbitration?.kind === "released" ? pass.arbitration : (() => { if (ledger.settled !== undefined)
|
|
266
272
|
return undefined; const a = pass.arbitration === undefined ? input.ancestorArbitrationOf?.(toolCallId) : undefined; return a?.kind === "released" ? a : undefined; })();
|
|
267
273
|
return {
|
|
268
|
-
updatedInput: pass.currentInput
|
|
274
|
+
updatedInput: pass.currentInput,
|
|
269
275
|
gate: mintGateOutcome({ ...(ledger.settled !== undefined ? { settled: ledger.settled } : {}), ...(pass.classifierRound !== undefined ? { classifier: pass.classifierRound } : {}), ...(release !== undefined ? { released: releaseRecordOf(release) } : {}) }),
|
|
270
276
|
finalInput: frozenInputSnapshot(pass.currentInput),
|
|
271
277
|
preToolContext: pass.preToolContext,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { isIP } from "node:net";
|
|
2
|
-
import { imageMagicMatches } from "
|
|
3
|
-
import { ADMITTED_IMAGE_MIME_TYPES } from "../../tools/fs/image-admission.js";
|
|
2
|
+
import { ADMITTED_IMAGE_MIME_TYPES, imageMagicMatches } from "../image-admission.js";
|
|
4
3
|
import { admitInlineImage } from "./inline-image.js";
|
|
5
4
|
function sniffImageMime(bytes) {
|
|
6
5
|
return ADMITTED_IMAGE_MIME_TYPES.find((mime) => imageMagicMatches(bytes, mime));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { admitImageBytes, ADMITTED_IMAGE_MIME_TYPES } from "
|
|
1
|
+
import { admitImageBytes, ADMITTED_IMAGE_MIME_TYPES } from "../image-admission.js";
|
|
2
2
|
import { MCP_IMAGE_MAX_BASE64 } from "../image-downsample.js";
|
|
3
3
|
function inlineImageRefusal(detail) {
|
|
4
4
|
const e = new Error(`TaskSpec.images: ${detail}`);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The input a once-per-run NOTICE SEAT takes: the run's notice sink and the two ids a notice is attributed to. One shape, defined
|
|
3
|
+
* once, below every seat that takes it (the extra-body strip account, the per-model credential-origin refusal account) — a seat
|
|
4
|
+
* importing a sibling seat's type was a sideways edge on a stratum that allows none.
|
|
5
|
+
*/
|
|
6
|
+
import type { EngineNotice } from "../engine-notice.js";
|
|
7
|
+
export interface NoticeSeatInput {
|
|
8
|
+
onNotice: ((notice: EngineNotice) => void) | undefined;
|
|
9
|
+
sessionId: string;
|
|
10
|
+
runId: string;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -258,6 +258,7 @@ export function createPersonPathRows(cfg) {
|
|
|
258
258
|
matchPath: (path, opts) => judging().readDeny.matchPath(path, opts),
|
|
259
259
|
matchTarget: (canonicalKey, lexicalView, opts) => judging().readDeny.matchTarget(canonicalKey, lexicalView, opts),
|
|
260
260
|
unexcludableUnder: (scope) => judging().readDeny.unexcludableUnder?.(scope) ?? false,
|
|
261
|
+
rowUnderRoot: (scope) => judging().readDeny.rowUnderRoot?.(scope) ?? null,
|
|
261
262
|
rowAtOrBelow: (path) => judging().readDeny.rowAtOrBelow?.(path) ?? null,
|
|
262
263
|
forCall: (id) => tablesFor(id).readDeny,
|
|
263
264
|
});
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { StoredSession, isSessionConflict } from "../session.js";
|
|
2
|
+
import { SessionError } from "../../internal/harness.js";
|
|
3
|
+
import { readMember } from "../thrown-value.js";
|
|
2
4
|
import { userAttachmentOf } from "../../internal/llm.js";
|
|
3
5
|
import { lastAttachmentFrameOf } from "../user-attachment.js";
|
|
4
6
|
import { reconcileInterruptedSession } from "../session-reconcile.js";
|
|
@@ -33,7 +35,9 @@ export async function prepareAcquireReconcile(input) {
|
|
|
33
35
|
}
|
|
34
36
|
try {
|
|
35
37
|
if (resume) {
|
|
36
|
-
await session.getStorage().setLeafId(resume.leafId)
|
|
38
|
+
await session.getStorage().setLeafId(resume.leafId).catch((cut) => {
|
|
39
|
+
throw readMember(cut, "code") === "not_found" ? new SessionError("invalid_session", `session "${spec.sessionId}" no longer holds the entry its checkpoint was cut at ("${resume.leafId}")`, cut) : cut;
|
|
40
|
+
});
|
|
37
41
|
}
|
|
38
42
|
else if (spec.resumeAt !== undefined) {
|
|
39
43
|
const entry = await session.getEntry(spec.resumeAt);
|
|
@@ -2,7 +2,7 @@ import type { CallTargetStamp } from "../effective-path-target.js";
|
|
|
2
2
|
import type { AgentTool } from "../../internal/harness.js";
|
|
3
3
|
import type { AdvertisedWritableDirs } from "./advertised-writable-dirs.js";
|
|
4
4
|
import type { AutoModeDenialTracker } from "../auto-mode.js";
|
|
5
|
-
import { type
|
|
5
|
+
import { type LegModBus } from "../mods/stations.js";
|
|
6
6
|
import { type OnAsk, type ToolCallRequest, type ToolPolicy } from "../tool-policy.js";
|
|
7
7
|
import type { RunnerDeps, TaskSpec } from "../types.js";
|
|
8
8
|
import type { CwdRef } from "../../tools/fs/fs-shared.js";
|
|
@@ -89,12 +89,10 @@ export interface PrepareAskLaneInput {
|
|
|
89
89
|
sessionId: string;
|
|
90
90
|
/** borrowed-readonly — the run's invocation id (the observer's tag). */
|
|
91
91
|
runId: string;
|
|
92
|
-
/** borrowed-readonly — the
|
|
93
|
-
|
|
94
|
-
/** borrowed-readonly — the
|
|
95
|
-
|
|
96
|
-
/** borrowed-readonly — the own hook-failure lane (`onError`, phase `hook`, swallow-guarded): the deny observer's report sink,
|
|
97
|
-
* the gate's crashing-PreToolUse sink and the adjudicate seat's report of a policy chain that threw. */
|
|
92
|
+
/** borrowed-readonly — the leg's mods bus (the deny observer raises `classic.PermissionDenied` on it). */
|
|
93
|
+
modBus: LegModBus;
|
|
94
|
+
/** borrowed-readonly — the leg's own failure lane (`onError`, phase `hook`, swallow-guarded): the adjudicate seat's report
|
|
95
|
+
* of a policy chain that threw. */
|
|
98
96
|
notifyOwnHookCrash: (err: unknown) => void;
|
|
99
97
|
/** borrowed-readonly — the hands phase's in-flight read-root widening (an approver's accepted `readRootGrant`), or undefined (hands-less). */
|
|
100
98
|
grantReadRoot: GrantReadRoot | undefined;
|