@sema-agent/core 7.54.1 → 7.56.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 +950 -0
- package/dist/agents/agent-transcript-tool.js +2 -1
- package/dist/agents/builtin-agents.d.ts +12 -14
- package/dist/agents/cascade.js +1 -1
- package/dist/agents/cc-peer-directory.d.ts +36 -0
- package/dist/agents/cc-peer-directory.js +139 -0
- package/dist/agents/cc-peer-wire.d.ts +105 -0
- package/dist/agents/cc-peer-wire.js +98 -0
- package/dist/agents/cc-uds-peer-channel.d.ts +40 -0
- package/dist/agents/cc-uds-peer-channel.js +457 -0
- package/dist/agents/child-model-seat.d.ts +0 -11
- package/dist/agents/child-model-seat.js +0 -3
- package/dist/agents/cross-session-envelope.d.ts +4 -1
- package/dist/agents/cross-session-envelope.js +8 -1
- package/dist/agents/cross-session-judge.d.ts +2 -2
- package/dist/agents/list-agents-tool.d.ts +3 -1
- package/dist/agents/list-agents-tool.js +9 -8
- package/dist/agents/observer.d.ts +4 -5
- package/dist/agents/observer.js +2 -1
- package/dist/agents/peer-admission.d.ts +6 -0
- package/dist/agents/peer-admission.js +4 -1
- package/dist/agents/peer-directory.d.ts +65 -13
- package/dist/agents/peer-directory.js +90 -25
- package/dist/agents/peer-notices.d.ts +1 -1
- package/dist/agents/peer-session-drain.d.ts +3 -1
- package/dist/agents/peer-session-drain.js +3 -2
- package/dist/agents/read-inbox-tool.js +2 -1
- package/dist/agents/repair-loop.js +2 -2
- package/dist/agents/retain-ledger.d.ts +1 -1
- package/dist/agents/roster-store.d.ts +1 -1
- package/dist/agents/send-message-tool.d.ts +10 -0
- package/dist/agents/send-message-tool.js +37 -8
- package/dist/agents/subagent.d.ts +39 -82
- package/dist/agents/subagent.js +109 -106
- package/dist/agents/tool-filter.d.ts +31 -46
- package/dist/agents/tool-filter.js +13 -33
- package/dist/agents/verify.d.ts +6 -5
- package/dist/agents/verify.js +3 -3
- package/dist/brain/anthropic.js +43 -81
- package/dist/brain/errors.d.ts +15 -0
- package/dist/brain/errors.js +10 -0
- package/dist/brain/media-degrade.d.ts +18 -7
- package/dist/brain/media-degrade.js +13 -2
- package/dist/brain/model-capability.d.ts +37 -0
- package/dist/brain/model-capability.js +34 -0
- package/dist/brain/model-presets.d.ts +6 -12
- package/dist/brain/model-presets.js +1 -6
- package/dist/brain/open-responses.js +27 -35
- package/dist/brain/openai.js +30 -98
- package/dist/brain/provider-dialect.d.ts +39 -3
- package/dist/brain/provider-dialect.js +28 -0
- package/dist/brain/reasoning-request.d.ts +96 -0
- package/dist/brain/reasoning-request.js +174 -0
- package/dist/brain/reasoning.d.ts +12 -12
- package/dist/brain/reasoning.js +4 -3
- package/dist/brain/request-params.d.ts +62 -9
- package/dist/brain/request-params.js +42 -7
- package/dist/brain/retry.d.ts +1 -1
- package/dist/brain/route-adjudicator.d.ts +15 -0
- package/dist/brain/route-adjudicator.js +15 -0
- package/dist/brain/status-sink.d.ts +20 -0
- package/dist/brain/status-sink.js +7 -0
- package/dist/brain/stream-engine.js +6 -5
- package/dist/brain/stream-shared.d.ts +1 -1
- package/dist/core/a2a.d.ts +2 -1
- package/dist/core/a2a.js +19 -13
- package/dist/core/advisor-verdict.d.ts +120 -0
- package/dist/core/advisor-verdict.js +92 -0
- package/dist/core/agent-definition.d.ts +17 -8
- package/dist/core/allow-entry.d.ts +69 -36
- package/dist/core/allow-entry.js +81 -52
- package/dist/core/allow-rule-shadow.d.ts +10 -3
- package/dist/core/approval-object.d.ts +2 -1
- package/dist/core/approval-object.js +6 -6
- package/dist/core/ask-origin.d.ts +127 -29
- package/dist/core/ask-origin.js +87 -25
- package/dist/core/ask-question.d.ts +51 -8
- package/dist/core/ask-question.js +12 -7
- package/dist/core/ask-unresolvable-notice.d.ts +8 -3
- package/dist/core/ask-unresolvable-notice.js +16 -2
- package/dist/core/auto-compaction.d.ts +11 -8
- package/dist/core/auto-compaction.js +4 -2
- package/dist/core/auto-mode-arming.d.ts +2 -2
- package/dist/core/auto-mode-defaults.d.ts +8 -8
- package/dist/core/auto-mode-prompt-assets.d.ts +3 -3
- package/dist/core/auto-mode-prompt.d.ts +1 -1
- package/dist/core/auto-mode.d.ts +17 -9
- package/dist/core/auto-mode.js +9 -6
- package/dist/core/background-agent-store.d.ts +3 -3
- package/dist/core/canonical-json.d.ts +1 -1
- package/dist/core/canonical-json.js +2 -2
- package/dist/core/checkpoint-generation.d.ts +53 -0
- package/dist/core/checkpoint-generation.js +35 -0
- package/dist/core/checkpoint-queries.d.ts +180 -0
- package/dist/core/checkpoint-queries.js +272 -0
- package/dist/core/checkpoint-requirements.d.ts +19 -4
- package/dist/core/checkpoint-requirements.js +8 -14
- package/dist/core/checkpoint-store.d.ts +165 -72
- package/dist/core/checkpoint-store.js +79 -82
- package/dist/core/child-clamp-seats.d.ts +6 -0
- package/dist/core/child-clamp-seats.js +3 -16
- package/dist/core/compliance.d.ts +2 -2
- package/dist/core/context-edit.d.ts +6 -7
- package/dist/core/cross-boundary-taint.d.ts +11 -4
- package/dist/core/cross-boundary-taint.js +3 -3
- package/dist/core/decision-receipt.d.ts +37 -3
- package/dist/core/decision-receipt.js +19 -19
- package/dist/core/delegation-not-started.d.ts +6 -0
- package/dist/core/delegation-not-started.js +17 -0
- package/dist/core/effective-path-target.d.ts +1 -1
- package/dist/core/engine-attestation.d.ts +93 -0
- package/dist/core/engine-attestation.js +70 -0
- package/dist/core/engine-capabilities.d.ts +4 -1
- package/dist/core/engine-capabilities.js +1 -1
- package/dist/core/engine-notice.d.ts +45 -12
- package/dist/core/exec-output-tail.d.ts +1 -1
- package/dist/core/file-history-retention.d.ts +1 -1
- package/dist/core/file-history-store.d.ts +147 -21
- package/dist/core/file-history-store.js +58 -32
- package/dist/core/gate-fold.d.ts +1 -1
- package/dist/core/gate-fold.js +24 -11
- package/dist/core/gate-lanes.js +81 -68
- package/dist/core/gate-outcome.d.ts +40 -6
- package/dist/core/gate-outcome.js +56 -0
- package/dist/core/governance-codes.d.ts +17 -3
- package/dist/core/governance-codes.js +16 -0
- package/dist/core/hands-band.d.ts +1 -1
- package/dist/core/hooks.d.ts +21 -20
- package/dist/core/hooks.js +3 -1
- package/dist/core/host-floor.d.ts +128 -0
- package/dist/core/host-floor.js +206 -0
- package/dist/core/host-target.d.ts +84 -0
- package/dist/core/host-target.js +92 -0
- package/dist/core/image-downsample.d.ts +1 -1
- package/dist/core/lsp-diagnostics.d.ts +4 -4
- package/dist/core/lsp.d.ts +3 -3
- package/dist/core/mailbox-store.d.ts +4 -0
- package/dist/core/mcp-connection-pool.d.ts +18 -2
- package/dist/core/mcp-connection-pool.js +53 -6
- package/dist/core/mcp-failure.d.ts +23 -4
- package/dist/core/mcp-failure.js +26 -11
- package/dist/core/mcp-listing-drift.d.ts +10 -0
- package/dist/core/mcp-listing-drift.js +6 -0
- package/dist/core/mcp-server-link.d.ts +173 -0
- package/dist/core/mcp-server-link.js +127 -0
- package/dist/core/mcp-server-spec.d.ts +4 -2
- package/dist/core/mcp-session-end.d.ts +26 -0
- package/dist/core/mcp-session-end.js +29 -0
- package/dist/core/mcp-startup-request.d.ts +17 -0
- package/dist/core/mcp-startup-request.js +17 -0
- package/dist/core/mcp.d.ts +17 -13
- package/dist/core/mcp.js +240 -189
- package/dist/core/media-byte-cap.d.ts +1 -1
- package/dist/core/memory-engine/delegation-settlement.js +15 -24
- package/dist/core/memory-engine/engine.d.ts +9 -9
- package/dist/core/memory-engine/engine.js +4 -4
- package/dist/core/memory-engine/layout.d.ts +60 -8
- package/dist/core/memory-engine/layout.js +65 -6
- package/dist/core/memory-engine/provenance-wording.d.ts +1 -1
- package/dist/core/memory-engine/tools.js +4 -1
- package/dist/core/mode-policy.d.ts +1 -1
- package/dist/core/model-seat.d.ts +10 -3
- package/dist/core/mods/classic-events.d.ts +67 -0
- package/dist/core/mods/classic-events.js +1 -0
- package/dist/core/mods/dollar.d.ts +13 -0
- package/dist/core/mods/extension-call.d.ts +31 -0
- package/dist/core/mods/extension-call.js +43 -0
- package/dist/core/mods/kernel/dispatch.d.ts +20 -3
- package/dist/core/mods/kernel/dispatch.js +140 -69
- package/dist/core/mods/kernel/events.d.ts +47 -11
- package/dist/core/mods/kernel/events.js +66 -42
- package/dist/core/mods/kernel/index.d.ts +4 -4
- package/dist/core/mods/kernel/index.js +2 -2
- package/dist/core/mods/kernel/receive.d.ts +39 -5
- package/dist/core/mods/kernel/receive.js +290 -17
- package/dist/core/mods/kernel/registration.d.ts +33 -2
- package/dist/core/mods/kernel/registration.js +6 -7
- package/dist/core/mods/kernel/site-rules.d.ts +44 -16
- package/dist/core/mods/kernel/site-rules.js +24 -42
- package/dist/core/mods/spec-seats.d.ts +69 -0
- package/dist/core/mods/spec-seats.js +114 -0
- package/dist/core/mods/stations.d.ts +28 -8
- package/dist/core/mods/stations.js +29 -13
- package/dist/core/mods/tool-call.d.ts +79 -0
- package/dist/core/mods/tool-call.js +152 -0
- package/dist/core/namespaced-rule-name.d.ts +44 -24
- package/dist/core/namespaced-rule-name.js +50 -43
- package/dist/core/output-style.d.ts +1 -1
- package/dist/core/param-rule-reach.d.ts +15 -0
- package/dist/core/param-rule-reach.js +30 -0
- package/dist/core/parent-spec-seat.d.ts +13 -1
- package/dist/core/parent-spec-seat.js +6 -0
- package/dist/core/park-selfcheck.js +1 -0
- package/dist/core/pause-registry.d.ts +16 -5
- package/dist/core/pause-registry.js +6 -2
- package/dist/core/peer-channel.d.ts +70 -0
- package/dist/core/peer-channel.js +1 -0
- package/dist/core/permission-rule-consent.d.ts +30 -5
- package/dist/core/permission-rule-consent.js +147 -50
- package/dist/core/permission-rule-model.d.ts +245 -65
- package/dist/core/permission-rule-model.js +421 -107
- package/dist/core/permission-rule-org.d.ts +6 -2
- package/dist/core/permission-rule-org.js +7 -3
- package/dist/core/permission-rule-provider.d.ts +6 -2
- package/dist/core/permission-rule-provider.js +41 -11
- package/dist/core/permission-rule-store.d.ts +22 -26
- package/dist/core/permission-rule-store.js +12 -6
- package/dist/core/permission-rule-sync.d.ts +11 -2
- package/dist/core/permission-rule-sync.js +11 -3
- package/dist/core/permission-rule-syntax.d.ts +5 -4
- package/dist/core/permission-rule-syntax.js +2 -2
- package/dist/core/permission-rules.d.ts +53 -15
- package/dist/core/permission-rules.js +125 -100
- package/dist/core/persisted-rule-arms.d.ts +6 -4
- package/dist/core/persisted-rule-arms.js +10 -12
- package/dist/core/present-plan-tool.js +3 -1
- package/dist/core/principal-name.d.ts +20 -0
- package/dist/core/principal-name.js +22 -0
- package/dist/core/prompt-section-seat.js +4 -6
- package/dist/core/protocol-http-auth.d.ts +26 -5
- package/dist/core/protocol-http-auth.js +137 -4
- package/dist/core/protocol-naming.d.ts +2 -2
- package/dist/core/read-only-shell-table.d.ts +1 -1
- package/dist/core/read-only-shell.d.ts +1 -1
- package/dist/core/retired-keys.d.ts +16 -0
- package/dist/core/retired-keys.js +16 -4
- package/dist/core/rewrite-rejudge.d.ts +60 -0
- package/dist/core/rewrite-rejudge.js +36 -0
- package/dist/core/roles.d.ts +34 -3
- package/dist/core/roles.js +66 -53
- package/dist/core/rule-lane-reads.d.ts +20 -15
- package/dist/core/rule-lane-reads.js +45 -17
- package/dist/core/rule-offer-read.d.ts +53 -0
- package/dist/core/rule-offer-read.js +146 -0
- package/dist/core/rule-owner.d.ts +46 -0
- package/dist/core/rule-owner.js +29 -0
- package/dist/core/runner/advisor-instructions.d.ts +70 -0
- package/dist/core/runner/advisor-instructions.js +61 -0
- package/dist/core/runner/advisor-tool.d.ts +33 -0
- package/dist/core/runner/advisor-tool.js +112 -0
- package/dist/core/runner/announce-once-ledger.d.ts +18 -26
- package/dist/core/runner/announce-once-ledger.js +19 -46
- package/dist/core/runner/approval-feedback.js +6 -3
- package/dist/core/runner/assemble-result.d.ts +2 -1
- package/dist/core/runner/assemble-result.js +1 -1
- package/dist/core/runner/call-hook-stations.d.ts +3 -2
- package/dist/core/runner/caller-roster.d.ts +21 -2
- package/dist/core/runner/caller-roster.js +38 -0
- package/dist/core/runner/capability-withheld-seat.d.ts +5 -0
- package/dist/core/runner/capability-withheld-seat.js +24 -0
- package/dist/core/runner/classifier-ladder.d.ts +33 -13
- package/dist/core/runner/classifier-ladder.js +15 -14
- package/dist/core/runner/compaction-restate.d.ts +10 -6
- package/dist/core/runner/compaction-restate.js +9 -3
- package/dist/core/runner/construction-doors.js +3 -0
- package/dist/core/runner/contracts.d.ts +40 -33
- package/dist/core/runner/conversation-segment.d.ts +28 -0
- package/dist/core/runner/conversation-segment.js +42 -0
- package/dist/core/runner/cross-boundary-lane.d.ts +21 -16
- package/dist/core/runner/cross-boundary-lane.js +58 -34
- package/dist/core/runner/decide-continuation.d.ts +7 -4
- package/dist/core/runner/decide-continuation.js +2 -2
- package/dist/core/runner/denial-limit-arms.d.ts +4 -4
- package/dist/core/runner/denial-limit-arms.js +1 -1
- package/dist/core/runner/derived-route-fallback.d.ts +24 -24
- package/dist/core/runner/derived-route-fallback.js +9 -7
- package/dist/core/runner/file-history-request.d.ts +18 -0
- package/dist/core/runner/file-history-request.js +21 -13
- package/dist/core/runner/file-history-restore.d.ts +45 -0
- package/dist/core/runner/file-history-restore.js +46 -0
- package/dist/core/runner/gate-exit.d.ts +9 -3
- package/dist/core/runner/gate-exit.js +11 -5
- package/dist/core/runner/image.d.ts +7 -17
- package/dist/core/runner/image.js +9 -60
- package/dist/core/runner/initial-run-state.js +1 -1
- package/dist/core/runner/permission-rule-lanes.d.ts +6 -6
- package/dist/core/runner/permission-rule-lanes.js +38 -15
- package/dist/core/runner/person-path-rows.d.ts +12 -9
- package/dist/core/runner/person-path-rows.js +19 -8
- package/dist/core/runner/prepare-advisor.d.ts +63 -0
- package/dist/core/runner/prepare-advisor.js +77 -0
- package/dist/core/runner/prepare-ask-lane.d.ts +2 -2
- package/dist/core/runner/prepare-ask-lane.js +5 -2
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +4 -6
- package/dist/core/runner/prepare-caps-and-workflow.js +5 -4
- package/dist/core/runner/prepare-config-doors.d.ts +31 -38
- package/dist/core/runner/prepare-config-doors.js +57 -34
- package/dist/core/runner/prepare-defer-classify.d.ts +4 -3
- package/dist/core/runner/prepare-defer-classify.js +7 -8
- package/dist/core/runner/prepare-delegation-surface.d.ts +2 -2
- package/dist/core/runner/prepare-delegation-surface.js +1 -1
- package/dist/core/runner/prepare-file-history.d.ts +48 -8
- package/dist/core/runner/prepare-file-history.js +41 -73
- package/dist/core/runner/prepare-gate-stations.d.ts +2 -5
- package/dist/core/runner/prepare-gate-stations.js +12 -8
- package/dist/core/runner/prepare-hands-readface.d.ts +2 -8
- package/dist/core/runner/prepare-hands-readface.js +15 -14
- package/dist/core/runner/prepare-inherited-gate.d.ts +11 -7
- package/dist/core/runner/prepare-inherited-gate.js +8 -6
- package/dist/core/runner/prepare-memory-engine-session.js +1 -1
- package/dist/core/runner/prepare-park-ask.js +12 -12
- package/dist/core/runner/prepare-policy-chain.d.ts +7 -4
- package/dist/core/runner/prepare-policy-chain.js +68 -81
- package/dist/core/runner/prepare-project-context.d.ts +5 -2
- package/dist/core/runner/prepare-project-context.js +6 -3
- package/dist/core/runner/prepare-prompt-assembly.d.ts +5 -7
- package/dist/core/runner/prepare-prompt-assembly.js +10 -8
- package/dist/core/runner/prepare-prompt-inputs.d.ts +11 -9
- package/dist/core/runner/prepare-prompt-inputs.js +4 -6
- package/dist/core/runner/prepare-protocol-tools.d.ts +4 -2
- package/dist/core/runner/prepare-protocol-tools.js +5 -4
- package/dist/core/runner/prepare-safety-scan.d.ts +9 -12
- package/dist/core/runner/prepare-safety-scan.js +8 -23
- package/dist/core/runner/prepare-suspend-saga.d.ts +2 -0
- package/dist/core/runner/prepare-suspend-saga.js +5 -6
- package/dist/core/runner/prepare-task.d.ts +1 -1
- package/dist/core/runner/prepare-task.js +41 -35
- package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +7 -4
- package/dist/core/runner/prepare-tool-disclosure-mount.js +24 -18
- package/dist/core/runner/prepare-turn-wiring.d.ts +0 -4
- package/dist/core/runner/prepare-turn-wiring.js +2 -7
- package/dist/core/runner/prepare-wiring-manifest.d.ts +11 -4
- package/dist/core/runner/prepare-wiring-manifest.js +3 -3
- package/dist/core/runner/resume-admission.js +1 -1
- package/dist/core/runner/resume-apply.js +11 -12
- package/dist/core/runner/resume-checkpoint-screen.js +3 -0
- package/dist/core/runner/resume-claim.d.ts +4 -2
- package/dist/core/runner/resume-claim.js +15 -8
- package/dist/core/runner/resume-policy-outcome.js +1 -1
- package/dist/core/runner/retired-runner-deps.js +2 -1
- package/dist/core/runner/rewind-files.d.ts +15 -0
- package/dist/core/runner/rewind-files.js +132 -0
- package/dist/core/runner/run-attachment-seats.js +2 -2
- package/dist/core/runner/run-brain-sinks.d.ts +4 -1
- package/dist/core/runner/run-brain-sinks.js +4 -2
- package/dist/core/runner/run-compaction-machinery.d.ts +1 -1
- package/dist/core/runner/run-compaction-machinery.js +2 -12
- package/dist/core/runner/run-git-lane.d.ts +1 -0
- package/dist/core/runner/run-harness-handlers.js +14 -7
- package/dist/core/runner/run-leg.d.ts +1 -1
- package/dist/core/runner/run-leg.js +43 -18
- package/dist/core/runner/run-settle-and-teardown.js +3 -2
- package/dist/core/runner/run-telemetry-and-budget-seats.js +1 -1
- package/dist/core/runner/run-turn-boundary.d.ts +1 -0
- package/dist/core/runner/run-turn-boundary.js +15 -22
- package/dist/core/runner/runtask.d.ts +3 -0
- package/dist/core/runner/runtask.js +8 -9
- package/dist/core/runner/session-read-file-states.d.ts +15 -0
- package/dist/core/runner/session-read-file-states.js +28 -0
- package/dist/core/runner/session-rule-policy.d.ts +22 -21
- package/dist/core/runner/session-rule-policy.js +17 -31
- package/dist/core/runner/shell-env-withheld.d.ts +33 -0
- package/dist/core/runner/shell-env-withheld.js +51 -0
- package/dist/core/runner/side-call-account.d.ts +32 -8
- package/dist/core/runner/side-call-account.js +23 -1
- package/dist/core/runner/skills-seat.js +6 -2
- package/dist/core/runner/stream-settle-backstop.js +1 -1
- package/dist/core/runner/strict-output-schema.d.ts +1 -1
- package/dist/core/runner/sub-agent-deny-lists.js +4 -6
- package/dist/core/runner/synthetic-tools.d.ts +16 -13
- package/dist/core/runner/synthetic-tools.js +8 -3
- package/dist/core/runner/tool-disclosure.d.ts +10 -12
- package/dist/core/runner/tool-disclosure.js +3 -4
- package/dist/core/runner/tool-end-body.d.ts +1 -1
- package/dist/core/runner/tool-end-body.js +10 -9
- package/dist/core/runner/tool-face-overlay.d.ts +2 -1
- package/dist/core/runner/tool-face-overlay.js +17 -1
- package/dist/core/runner/tool-not-executed.d.ts +5 -0
- package/dist/core/runner/tool-not-executed.js +11 -0
- package/dist/core/runner/tool-occurrence.d.ts +8 -0
- package/dist/core/runner/tool-occurrence.js +7 -0
- package/dist/core/runner/tool-progress-lane.d.ts +2 -2
- package/dist/core/runner/tool-turn-repair-seat.d.ts +3 -2
- package/dist/core/runner/turn-attachments.d.ts +91 -80
- package/dist/core/runner/turn-attachments.js +62 -37
- package/dist/core/runner-deps.d.ts +42 -42
- package/dist/core/runtime-caps.d.ts +4 -4
- package/dist/core/safety-axis-vocab.d.ts +6 -4
- package/dist/core/safety-axis-vocab.js +6 -5
- package/dist/core/safety-merge-corpus.js +26 -2
- package/dist/core/same-plain-value.d.ts +40 -0
- package/dist/core/same-plain-value.js +49 -0
- package/dist/core/scheduler.d.ts +1 -1
- package/dist/core/secret-env.d.ts +26 -3
- package/dist/core/secret-env.js +44 -8
- package/dist/core/select-model.js +3 -3
- package/dist/core/sensitive-path-policy.d.ts +1 -1
- package/dist/core/sensitive-path-policy.js +1 -1
- package/dist/core/session-policy-store.d.ts +102 -35
- package/dist/core/session-policy-store.js +210 -48
- package/dist/core/session-reconcile.d.ts +2 -2
- package/dist/core/session-store.d.ts +106 -37
- package/dist/core/session-store.js +165 -91
- package/dist/core/session.d.ts +101 -57
- package/dist/core/session.js +53 -0
- package/dist/core/shared-memory/tools.js +3 -1
- package/dist/core/shared-memory/types.d.ts +1 -1
- package/dist/core/shell-read-silence.d.ts +11 -12
- package/dist/core/shell-read-silence.js +9 -5
- package/dist/core/shell-run-candidates.js +3 -1
- package/dist/core/shell-wrapper-projection.js +1 -1
- package/dist/core/shell-wrapper-table.d.ts +14 -7
- package/dist/core/shell-wrapper-table.js +5 -4
- package/dist/core/side-query.d.ts +10 -0
- package/dist/core/side-query.js +15 -1
- package/dist/core/skill-grant.d.ts +7 -2
- package/dist/core/skill-grant.js +5 -0
- package/dist/core/skills-directory.js +6 -2
- package/dist/core/store-contracts/checkpoint-store-contract.d.ts +11 -1
- package/dist/core/store-contracts/checkpoint-store-contract.js +168 -3
- package/dist/core/store-contracts/file-history-store-contract.js +74 -4
- package/dist/core/store-contracts/peer-directory-contract.d.ts +7 -2
- package/dist/core/store-contracts/peer-directory-contract.js +14 -2
- package/dist/core/store-contracts/session-policy-store-contract.d.ts +7 -0
- package/dist/core/store-contracts/session-policy-store-contract.js +130 -0
- package/dist/core/store-contracts/session-repo-contract.js +176 -0
- package/dist/core/store-contracts/session-store-contract.d.ts +6 -8
- package/dist/core/store-contracts/session-store-contract.js +361 -51
- package/dist/core/store-contracts/workflow-journal-store-contract.js +26 -1
- package/dist/core/stub-env.d.ts +2 -0
- package/dist/core/stub-env.js +1 -0
- package/dist/core/surrogate-safe-slice.d.ts +3 -3
- package/dist/core/synthetic-read-verdict.js +3 -3
- package/dist/core/task-event.d.ts +42 -8
- package/dist/core/task-notification.d.ts +19 -15
- package/dist/core/task-registry-agent.d.ts +4 -4
- package/dist/core/task-registry-shared.d.ts +4 -4
- package/dist/core/task-registry-shared.js +1 -0
- package/dist/core/task-registry.d.ts +13 -4
- package/dist/core/task-registry.js +14 -2
- package/dist/core/task-result.d.ts +21 -3
- package/dist/core/task-spec.d.ts +69 -64
- package/dist/core/task-stream.d.ts +6 -6
- package/dist/core/task-tool-shape.d.ts +4 -4
- package/dist/core/tighten-task-spec.d.ts +1 -1
- package/dist/core/tighten-task-spec.js +2 -1
- package/dist/core/tool-catalog-entries.d.ts +36 -2
- package/dist/core/tool-catalog-entries.js +69 -43
- package/dist/core/tool-check-reading.d.ts +11 -0
- package/dist/core/tool-check-reading.js +11 -6
- package/dist/core/tool-conformance.js +1 -0
- package/dist/core/tool-errors.d.ts +2 -2
- package/dist/core/tool-face-reader.js +5 -3
- package/dist/core/tool-face.d.ts +21 -2
- package/dist/core/tool-face.js +1 -1
- package/dist/core/tool-model-gate.d.ts +5 -5
- package/dist/core/tool-name-aliases.d.ts +29 -8
- package/dist/core/tool-name-aliases.js +22 -4
- package/dist/core/tool-name-readings.d.ts +10 -43
- package/dist/core/tool-name-readings.js +2 -11
- package/dist/core/tool-policy.d.ts +85 -196
- package/dist/core/tool-policy.js +150 -175
- package/dist/core/tool-registry.d.ts +14 -7
- package/dist/core/tool-registry.js +17 -7
- package/dist/core/tool-result-store.js +5 -1
- package/dist/core/tool-roster.d.ts +57 -33
- package/dist/core/tool-roster.js +56 -68
- package/dist/core/tool-spec-members.js +8 -3
- package/dist/core/tool-spec.d.ts +53 -31
- package/dist/core/tools.js +51 -10
- package/dist/core/trace.d.ts +6 -2
- package/dist/core/types.d.ts +1 -1
- package/dist/core/untrusted-egress.d.ts +1 -1
- package/dist/core/untrusted-text.d.ts +1 -1
- package/dist/core/user-attachment.d.ts +8 -1
- package/dist/core/user-attachment.js +64 -4
- package/dist/core/warm-resume.d.ts +1 -1
- package/dist/core/wiring-manifest.d.ts +58 -0
- package/dist/core/wiring-manifest.js +14 -5
- package/dist/core/workflow-journal-store.d.ts +62 -0
- package/dist/core/workflow-journal-store.js +78 -2
- package/dist/core/workflow-run-store.d.ts +6 -0
- package/dist/core/workflow-run-store.js +2 -0
- package/dist/engine/compaction/compaction.d.ts +9 -9
- package/dist/engine/compaction/compaction.js +3 -2
- package/dist/engine/execution-env/node-execution-env.d.ts +26 -8
- package/dist/engine/execution-env/node-execution-env.js +54 -24
- package/dist/engine/harness/agent-harness.d.ts +39 -9
- package/dist/engine/harness/agent-harness.js +87 -33
- package/dist/engine/harness/types.d.ts +58 -9
- package/dist/engine/harness/types.js +12 -1
- package/dist/engine/llm/types.d.ts +36 -19
- package/dist/engine/llm/validation.d.ts +4 -1
- package/dist/engine/llm/validation.js +13 -1
- package/dist/engine/loop/agent-loop.d.ts +23 -1
- package/dist/engine/loop/agent-loop.js +26 -34
- package/dist/engine/loop/types.d.ts +31 -19
- package/dist/engine/lsp/node-lsp-manager.d.ts +2 -2
- package/dist/engine/session/memory-repo.d.ts +18 -12
- package/dist/engine/session/memory-repo.js +24 -9
- package/dist/engine/session/parent-chain-guard.d.ts +3 -2
- package/dist/engine/session/parent-chain-guard.js +1 -1
- package/dist/engine/session/repo-utils.d.ts +32 -3
- package/dist/engine/session/repo-utils.js +50 -5
- package/dist/index.d.ts +47 -23
- package/dist/index.js +35 -17
- package/dist/internal/harness-types.d.ts +1 -1
- package/dist/internal/harness.d.ts +3 -3
- package/dist/internal/harness.js +2 -2
- package/dist/internal/llm.d.ts +2 -2
- package/dist/internal/llm.js +1 -1
- package/dist/orchestration/goal.js +2 -2
- package/dist/orchestration/run-workflow-tool.d.ts +8 -6
- package/dist/orchestration/run-workflow-tool.js +10 -6
- package/dist/orchestration/workflow-size-guideline.d.ts +4 -4
- package/dist/orchestration/workflow-types.d.ts +18 -0
- package/dist/orchestration/workflow-types.js +6 -0
- package/dist/orchestration/workflow.d.ts +5 -13
- package/dist/orchestration/workflow.js +57 -49
- package/dist/prompt-assembly/artifact.d.ts +2 -2
- package/dist/prompt-assembly/artifact.js +5 -3
- package/dist/prompt-assembly/assemble.d.ts +3 -2
- package/dist/prompt-assembly/assemble.js +1 -1
- package/dist/prompt-assembly/catalog/schema.d.ts +43 -12
- package/dist/prompt-assembly/catalog/schema.js +34 -2
- package/dist/prompt-assembly/catalog/sections.js +0 -1
- package/dist/prompt-assembly/composer.d.ts +3 -1
- package/dist/prompt-assembly/composer.js +1 -1
- package/dist/prompt-assembly/event-registry.js +2 -0
- package/dist/prompt-assembly/overlay.js +3 -3
- package/dist/prompt-assembly/renderers.d.ts +1 -1
- package/dist/prompt-assembly/renderers.js +0 -3
- package/dist/prompt-assembly/role-base.d.ts +15 -0
- package/dist/prompt-assembly/role-base.js +9 -0
- package/dist/prompt-assembly/select.d.ts +39 -14
- package/dist/prompt-assembly/select.js +47 -16
- package/dist/prompt-assembly/sugar.d.ts +17 -11
- package/dist/prompt-assembly/sugar.js +8 -3
- package/dist/prompt-assembly/tool-catalog.d.ts +39 -2
- package/dist/prompt-assembly/tool-catalog.js +117 -4
- package/dist/prompt-assembly/turn-snapshot.d.ts +4 -10
- package/dist/prompt-assembly/turn-snapshot.js +0 -3
- package/dist/prompt-assembly/types.d.ts +0 -7
- package/dist/prompts/default.d.ts +14 -14
- package/dist/scenarios/full-body.d.ts +15 -15
- package/dist/scenarios/full-body.js +4 -3
- package/dist/shell/lex.js +10 -1
- package/dist/stores/file/adoption/adopt.d.ts +4 -3
- package/dist/stores/file/adoption/adopt.js +27 -33
- package/dist/stores/file/adoption/marker.d.ts +6 -13
- package/dist/stores/file/adoption/marker.js +9 -17
- package/dist/stores/file/checkpoint-store.d.ts +24 -0
- package/dist/stores/file/checkpoint-store.js +45 -7
- package/dist/stores/file/file-history-store.d.ts +20 -19
- package/dist/stores/file/file-history-store.js +157 -141
- package/dist/stores/file/fs-atomic.d.ts +15 -0
- package/dist/stores/file/fs-atomic.js +89 -14
- package/dist/stores/file/index.d.ts +1 -1
- package/dist/stores/file/index.js +2 -1
- package/dist/stores/file/mailbox-store.d.ts +3 -0
- package/dist/stores/file/mailbox-store.js +3 -1
- package/dist/stores/file/permission-rule-adopt.d.ts +1 -1
- package/dist/stores/file/permission-rule-adopt.js +18 -18
- package/dist/stores/file/permission-rule-store.d.ts +18 -2
- package/dist/stores/file/permission-rule-store.js +31 -18
- package/dist/stores/file/session-policy-store.d.ts +3 -3
- package/dist/stores/file/session-store.d.ts +54 -16
- package/dist/stores/file/session-store.js +114 -85
- package/dist/stores/file/workflow-journal-store.d.ts +10 -4
- package/dist/stores/file/workflow-journal-store.js +28 -13
- package/dist/tools/artifact/artifact-text.d.ts +1 -1
- package/dist/tools/artifact/artifact-tool.js +5 -3
- package/dist/tools/fs/bash-program-position.d.ts +19 -2
- package/dist/tools/fs/bash-program-position.js +56 -9
- package/dist/tools/fs/bash-readonly-classifier.d.ts +3 -3
- package/dist/tools/fs/fs-bash.d.ts +2 -2
- package/dist/tools/fs/fs-bash.js +8 -6
- package/dist/tools/fs/fs-glob.d.ts +86 -0
- package/dist/tools/fs/fs-glob.js +226 -0
- package/dist/tools/fs/fs-read.js +14 -14
- package/dist/tools/fs/fs-search-tools.js +7 -7
- package/dist/tools/fs/fs-shared.d.ts +8 -8
- package/dist/tools/fs/gh-rate-limit.d.ts +1 -1
- package/dist/tools/fs/notebook.d.ts +2 -2
- package/dist/tools/fs/pattern-kill-guard.d.ts +22 -0
- package/dist/tools/fs/pattern-kill-guard.js +397 -0
- package/dist/tools/fs/pdf.d.ts +9 -6
- package/dist/tools/fs/pdf.js +3 -3
- package/dist/tools/fs/program-read-model.d.ts +57 -7
- package/dist/tools/fs/program-read-model.js +11 -1
- package/dist/tools/fs/program-read-model.rows.js +78 -21
- package/dist/tools/fs/read-deny-home.js +3 -2
- package/dist/tools/fs/read-deny.d.ts +29 -7
- package/dist/tools/fs/read-deny.js +63 -22
- package/dist/tools/fs/removal-targets.d.ts +18 -8
- package/dist/tools/fs/removal-targets.js +47 -20
- package/dist/tools/fs/safety.d.ts +9 -9
- package/dist/tools/fs/search.d.ts +16 -6
- package/dist/tools/fs/search.js +20 -26
- package/dist/tools/fs/shell-read-argv.js +89 -12
- package/dist/tools/fs/shell-read-bindings.d.ts +31 -0
- package/dist/tools/fs/shell-read-bindings.js +41 -0
- package/dist/tools/fs/shell-read-check.js +12 -20
- package/dist/tools/fs/shell-read-environment.d.ts +5 -1
- package/dist/tools/fs/shell-read-environment.js +3 -2
- package/dist/tools/fs/shell-read-establish.d.ts +15 -0
- package/dist/tools/fs/shell-read-establish.js +19 -20
- package/dist/tools/fs/shell-read-judge.d.ts +4 -0
- package/dist/tools/fs/shell-read-judge.js +5 -2
- package/dist/tools/fs/shell-read-plan.js +24 -16
- package/dist/tools/fs/shell-read-start.d.ts +6 -1
- package/dist/tools/fs/shell-read-write-targets.d.ts +5 -1
- package/dist/tools/fs/shell-read-write-targets.js +2 -3
- package/dist/tools/fs/shell-reentry-text.d.ts +9 -0
- package/dist/tools/fs/shell-reentry-text.js +40 -2
- package/dist/tools/loop-tick.d.ts +2 -2
- package/dist/tools/scheduler-tools.js +5 -1
- package/dist/tools/task-list.d.ts +7 -7
- package/dist/tools/task-list.js +5 -1
- package/dist/tools/todo.js +65 -64
- package/dist/tools/web.d.ts +20 -15
- package/dist/tools/web.js +55 -69
- package/dist/tools/worktree.d.ts +3 -3
- package/dist/tools/worktree.js +3 -1
- package/package.json +1 -1
- package/test/export-surface.snapshot.json +5894 -5638
- package/wire-changes/core@7.55.0.json +3318 -0
- package/wire-changes/core@7.56.0.json +3891 -0
- package/wire-changes/mods-kernel@7.56.0.json +303 -0
- package/dist/core/store-contracts/session-store-incarnation-contract.d.ts +0 -39
- package/dist/core/store-contracts/session-store-incarnation-contract.js +0 -95
|
@@ -17,7 +17,7 @@ export declare const SUBAGENT_DELIVERY_NOTES: string;
|
|
|
17
17
|
/**
|
|
18
18
|
* Memory **safety** rules — a STANDALONE prompt asset, NOT injected by core. The flag-driven injection
|
|
19
19
|
* (`memoryEnabled`/`consolidationEnabled` → a `memory.safety` constitution block) was retired in
|
|
20
|
-
* RB-482 #16 along with both flags; the engine now injects the
|
|
20
|
+
* RB-482 #16 along with both flags; the engine now injects the `# Memory` instruction via
|
|
21
21
|
* the memory engine's `injection.block` instead. A deployment composing its own prompt is responsible
|
|
22
22
|
* for including this block, and should treat it as non-suppressible: it carries the load-bearing
|
|
23
23
|
* constraints (declarative-fact-not-command + the no-secrets rule + the
|
|
@@ -71,8 +71,8 @@ export declare const EXECUTION_ENVIRONMENT_OPEN_READS: string;
|
|
|
71
71
|
/** The isolated-worktree notice, composed only when the task really runs in an isolated git worktree. */
|
|
72
72
|
export declare const WORKTREE_NOTICE: string;
|
|
73
73
|
/**
|
|
74
|
-
* RB-314 —
|
|
75
|
-
* {@link buildEnvironmentContext}), which is exactly where
|
|
74
|
+
* RB-314 — Rides the variable `# Environment` tail (see
|
|
75
|
+
* {@link buildEnvironmentContext}), which is exactly where the reference emits it: both env-block assemblers
|
|
76
76
|
* (@596927 `IMy`, @596976 `OMy`) push `worktree ? atp : null` directly after the isolated-copy
|
|
77
77
|
* directive. Deliberately NOT folded into {@link WORKTREE_NOTICE}: that block is composed only for
|
|
78
78
|
* `isolation: "worktree"` spawns, while the hazard belongs to ANY run whose cwd is a linked worktree
|
|
@@ -120,7 +120,7 @@ export interface EnvironmentFacts {
|
|
|
120
120
|
/** design/99 §E14 — the working tree's toplevel (`git rev-parse --show-toplevel`). Lets the agent/shell know
|
|
121
121
|
* it may be in a linked worktree rather than the main checkout. */
|
|
122
122
|
gitWorktreeRoot?: string;
|
|
123
|
-
/** design/119
|
|
123
|
+
/** design/119: cwd is a LINKED git worktree (git-dir ≠ git-common-dir) — an isolated copy. */
|
|
124
124
|
isLinkedWorktree?: boolean;
|
|
125
125
|
/** design/119 (CC --add-dir parity): extra directories the file tools may access (canonical). */
|
|
126
126
|
additionalDirectories?: readonly string[];
|
|
@@ -164,7 +164,7 @@ export interface EnvironmentFacts {
|
|
|
164
164
|
/** A1 — outbound-network posture; `none` renders an explicit downloads-will-fail caveat (TB
|
|
165
165
|
* autopsy 2026-07-05: agents burned budget retrying downloads in a no-egress sandbox). */
|
|
166
166
|
sandboxEgress?: "none" | "allowlist" | "full";
|
|
167
|
-
/** H4
|
|
167
|
+
/** H4 — the pre-rendered {@link buildGitSnapshot} block. env-tail
|
|
168
168
|
* migration (#254 shape): NO LONGER RENDERED by {@link buildEnvironmentContext} — the snapshot is
|
|
169
169
|
* the turn-dynamic git view and rides the `git_status` frame (re-sent only when the rendered view
|
|
170
170
|
* changes); the field remains as a structured data carrier for callers that assembled it. */
|
|
@@ -185,17 +185,17 @@ export interface EnvironmentFacts {
|
|
|
185
185
|
* it twice could drift). Renders ONE neutral declarative line; absent ⇒ nothing renders.
|
|
186
186
|
*/
|
|
187
187
|
externalContentTarget?: boolean;
|
|
188
|
-
/**
|
|
188
|
+
/** Scratchpad port — the
|
|
189
189
|
* session-scoped temp directory the agent should use instead of `/tmp` (parallel tasks/multi-tenant
|
|
190
190
|
* deployments clobber each other's `/tmp`; project checkouts collect stray temp files without it).
|
|
191
191
|
* DEPLOYMENT-supplied, and only injected when set — the deployment MUST have created (or be about to
|
|
192
|
-
* create) the directory; core renders the
|
|
192
|
+
* create) the directory; core renders the section with this path interpolated (§6.3:
|
|
193
193
|
* never advertise a directory the task doesn't have). */
|
|
194
194
|
scratchpadDir?: string;
|
|
195
195
|
}
|
|
196
196
|
/**
|
|
197
|
-
*
|
|
198
|
-
* path parameterized for the deployment. Wording
|
|
197
|
+
* The `# Scratchpad Directory` section with the
|
|
198
|
+
* path parameterized for the deployment. Wording as in the reference — including the closing permission-prompts
|
|
199
199
|
* sentence, which holds for sema too (an approval-gated deployment normally allowlists its own scratchpad) —
|
|
200
200
|
* PLUS one sema-added ephemerality sentence (ruled 2026-08-05): sema deployments run under durable suspend /
|
|
201
201
|
* multi-replica serving where the scratchpad is a local-disk copy that does NOT survive a cross-replica
|
|
@@ -204,22 +204,22 @@ export interface EnvironmentFacts {
|
|
|
204
204
|
* in a directory that can vanish mid-task. Volatility magnitude only — no serving-layer mechanism names.
|
|
205
205
|
*/
|
|
206
206
|
export declare function buildScratchpadSection(scratchpadDir: string): string;
|
|
207
|
-
/**
|
|
207
|
+
/** The git status truncation bound (chars) for {@link buildGitSnapshot}. */
|
|
208
208
|
export declare const GIT_STATUS_MAX_CHARS = 2000;
|
|
209
|
-
/** The
|
|
209
|
+
/** The first paragraph of the git snapshot. Kept as a
|
|
210
210
|
* named constant so the git-status FRAME renderer (the snapshot's carrier since the env-tail
|
|
211
211
|
* migration) can swap exactly this paragraph for its own update-semantics preamble — under the
|
|
212
212
|
* frame protocol the snapshot IS re-sent when the visible view changes, so the "will not update"
|
|
213
213
|
* claim would be false there. {@link buildGitSnapshot} itself still renders it byte-exact. */
|
|
214
214
|
export declare const GIT_SNAPSHOT_CC_PREAMBLE = "This is the git status at the start of the conversation. Note that this status is a snapshot in time, and will not update during the conversation.";
|
|
215
215
|
/**
|
|
216
|
-
* H4 — the
|
|
217
|
-
*
|
|
216
|
+
* H4 — the ENV git snapshot block (B1/B2).
|
|
217
|
+
* Pure renderer — the Runner gathers the raw values through the
|
|
218
218
|
* ExecutionEnv seam (remote = the container's repo) and calls this once per prepareTask (a durable
|
|
219
219
|
* resume re-prepares → re-snapshots, CC new-session 同型). env-tail migration (#254 shape): the
|
|
220
220
|
* rendered block now feeds the `git_status` TURN FRAME (src/core/runner/git-status-frame.ts, which
|
|
221
221
|
* swaps the {@link GIT_SNAPSHOT_CC_PREAMBLE} for an update-semantics preamble) instead of the
|
|
222
|
-
* `# Environment` system-prompt section — the template body itself
|
|
222
|
+
* `# Environment` system-prompt section — the template body itself is unchanged.
|
|
223
223
|
*
|
|
224
224
|
* Sanitization (deliberate CC deviation — CC injects raw): status/log/branch/user are REPO-controlled
|
|
225
225
|
* text (filenames, commit subjects, an untrusted clone's config) landing in the TRUSTED prompt region →
|
|
@@ -10,9 +10,9 @@ import type { ToolSpec, RoleSpec } from "../core/types.js";
|
|
|
10
10
|
* `prepareTask` when the trusted assembler wires those deps/flags. This bundle is only the caller-composed factories.
|
|
11
11
|
*/
|
|
12
12
|
export interface CodeToolsConfig {
|
|
13
|
-
/** web_fetch
|
|
14
|
-
* `
|
|
15
|
-
*
|
|
13
|
+
/** web_fetch's factory options (fetch seam, byte / time caps, summarizer). Which hosts it may reach is NOT one of them: that is the
|
|
14
|
+
* deployment's host floor (`RunnerDeps.hostFloor`, every structured egress, read from the run on every hop) — a MULTI-TENANT
|
|
15
|
+
* deployment declares one there; the private-network floor applies regardless. */
|
|
16
16
|
webFetch?: WebFetchConfig;
|
|
17
17
|
/** WebSearch backend (BRAIN/model-service leg). Absent ⇒ WebSearch is not assembled (core ships no backend). */
|
|
18
18
|
webSearch?: WebSearchConfig;
|
|
@@ -20,14 +20,14 @@ export interface CodeToolsConfig {
|
|
|
20
20
|
* surface as the leader's own instances (one `TaskListStore`), bounded by what the spawning run mounts and trimmed
|
|
21
21
|
* by the spawn tier (`SubagentToolOptions.inheritedTools`). Tools composed BESIDE the bundle are not inherited: a
|
|
22
22
|
* host hands those per spawn through `subagent.extraTools`, behind its own gates.
|
|
23
|
-
* 合车复审修③: when this
|
|
24
|
-
* `
|
|
23
|
+
* 合车复审修③: when this names NO role base (neither `promptRole` nor `systemPrompt`), the assembler defaults it
|
|
24
|
+
* to `promptRole: "code"` — a code-scenario child holds Bash/Write side-effect tools, so it keeps the code
|
|
25
25
|
* constitution (snapshot-before-mutate / destructive-op care / git discipline) instead of falling to the
|
|
26
26
|
* lean SUBAGENT_PROMPT (the G1 default, which is the right upstream-anchor shape only for bare
|
|
27
|
-
* general-purpose delegation). Pass an explicit `systemPrompt` here to override. */
|
|
27
|
+
* general-purpose delegation). Pass an explicit `promptRole` / `systemPrompt` here to override. */
|
|
28
28
|
subagent?: SubagentToolOptions;
|
|
29
29
|
/**
|
|
30
|
-
* TodoWrite (CONTEXT leg). Default true, BUT mutually exclusive with the task-list family (
|
|
30
|
+
* TodoWrite (CONTEXT leg). Default true, BUT mutually exclusive with the task-list family (
|
|
31
31
|
* parity: TodoWrite is enabled only when the task list is off). With `taskList` on (the default),
|
|
32
32
|
* TodoWrite is NOT mounted even when `todoWrite: true` is set explicitly — the exclusion gate wins;
|
|
33
33
|
* pass `taskList: false` to get TodoWrite back. `todoWrite: false` always drops it.
|
|
@@ -36,8 +36,8 @@ export interface CodeToolsConfig {
|
|
|
36
36
|
*/
|
|
37
37
|
todoWrite?: boolean;
|
|
38
38
|
/**
|
|
39
|
-
* design/119 →
|
|
40
|
-
* TaskList — stable ids, status transitions, dependencies). Default TRUE (
|
|
39
|
+
* design/119 → B3: the structured task-list family (TaskCreate/TaskGet/TaskUpdate/
|
|
40
|
+
* TaskList — stable ids, status transitions, dependencies). Default TRUE (the task
|
|
41
41
|
* list is on unless explicitly disabled, and TodoWrite is its off-state fallback — the two families
|
|
42
42
|
* are mutually exclusive, never co-mounted). Only an explicit `taskList: false` reverts to the
|
|
43
43
|
* TodoWrite shape.
|
|
@@ -47,7 +47,7 @@ export interface CodeToolsConfig {
|
|
|
47
47
|
*/
|
|
48
48
|
taskList?: boolean;
|
|
49
49
|
/**
|
|
50
|
-
* design/147 §6 D2 (
|
|
50
|
+
* design/147 §6 D2 (shared team task list): a shared {@link TaskListStore} for the
|
|
51
51
|
* task-list family. Mount the SAME instance into each teammate's bundle to share one team task
|
|
52
52
|
* list (the `owner` claim semantics come alive); absent ⇒ the private per-run list (unchanged
|
|
53
53
|
* default). Ignored when `taskList: false`. This bundle's own Agent children share it by inheritance.
|
|
@@ -58,15 +58,15 @@ export interface CodeToolsConfig {
|
|
|
58
58
|
* Single-source bundle of the `code` scenario's `spec.tools`-class tools, so each deployment doesn't re-wire it
|
|
59
59
|
* (the single-source discipline: a scenario is data — a named bundle).
|
|
60
60
|
* Profile-as-data — the engine iterates `spec.tools` branch-free; nothing keys off the scenario name. A trusted
|
|
61
|
-
* assembler (service) calls this, sets `
|
|
61
|
+
* assembler (service) calls this, sets `promptRole = "code"` (or `roles.default = CODE_ROLE`) +
|
|
62
62
|
* `enablePlanMode:true`, and wires the deps seams (executionEnv/onQuestion/lspManager/skillSpecs/memoryStore/
|
|
63
63
|
* selfOrchestration) — that is what makes a run the `code` scenario. Returns ONLY the caller-composed tools.
|
|
64
64
|
*/
|
|
65
65
|
export declare function assembleCodeTools(cfg?: CodeToolsConfig): ToolSpec[];
|
|
66
66
|
/**
|
|
67
|
-
* RoleSpec preset for the `code` scenario's coding role
|
|
68
|
-
* `
|
|
69
|
-
* sensible floor; the assembler/SDK can raise it (effort→thinking) per request. The global
|
|
70
|
-
* stays neutral.
|
|
67
|
+
* RoleSpec preset for the `code` scenario's coding role: the catalog's coding role base by word (`promptRole:
|
|
68
|
+
* "code"`), the role-base decision's second source — it applies when the task names no role base of its own.
|
|
69
|
+
* `thinking:"high"` is a sensible floor; the assembler/SDK can raise it (effort→thinking) per request. The global
|
|
70
|
+
* DEFAULT_SYSTEM_PROMPT stays neutral.
|
|
71
71
|
*/
|
|
72
72
|
export declare const CODE_ROLE: RoleSpec;
|
|
@@ -2,7 +2,7 @@ import { webFetchToolSpec, createWebSearchTool } from "../tools/web.js";
|
|
|
2
2
|
import { createTodoWriteTool } from "../tools/todo.js";
|
|
3
3
|
import { createTaskListTools } from "../tools/task-list.js";
|
|
4
4
|
import { createSubagentTool } from "../agents/subagent.js";
|
|
5
|
-
import {
|
|
5
|
+
import { namesRoleBase } from "../prompt-assembly/role-base.js";
|
|
6
6
|
export function assembleCodeTools(cfg = {}) {
|
|
7
7
|
const web = [webFetchToolSpec(cfg.webFetch ?? {})];
|
|
8
8
|
if (cfg.webSearch)
|
|
@@ -19,13 +19,14 @@ export function assembleCodeTools(cfg = {}) {
|
|
|
19
19
|
}
|
|
20
20
|
const tools = [...web];
|
|
21
21
|
if (cfg.subagent) {
|
|
22
|
+
const roleBase = namesRoleBase(cfg.subagent) ? {} : { promptRole: "code" };
|
|
22
23
|
tools.push(createSubagentTool({
|
|
23
24
|
...cfg.subagent,
|
|
24
|
-
|
|
25
|
+
...roleBase,
|
|
25
26
|
inheritedTools: cfg.subagent.inheritedTools ?? [...web, ...scaffolds],
|
|
26
27
|
}));
|
|
27
28
|
}
|
|
28
29
|
tools.push(...scaffolds);
|
|
29
30
|
return tools;
|
|
30
31
|
}
|
|
31
|
-
export const CODE_ROLE = {
|
|
32
|
+
export const CODE_ROLE = { promptRole: "code", thinking: "high" };
|
package/dist/shell/lex.js
CHANGED
|
@@ -1169,6 +1169,7 @@ function scan(source, connectorsAreText, segments, level, list) {
|
|
|
1169
1169
|
let assignmentSeen = false;
|
|
1170
1170
|
let subscriptsClosed = false;
|
|
1171
1171
|
let commandWord;
|
|
1172
|
+
let arithParens = 0;
|
|
1172
1173
|
let w = new WordBuilder();
|
|
1173
1174
|
const next = (j) => past(source, j + 1);
|
|
1174
1175
|
const quotedBy = () => (inSingle || inDouble ? regionBy : undefined);
|
|
@@ -1503,7 +1504,7 @@ function scan(source, connectorsAreText, segments, level, list) {
|
|
|
1503
1504
|
take(ch, i);
|
|
1504
1505
|
continue;
|
|
1505
1506
|
}
|
|
1506
|
-
if (ch === "#" && !w.started) {
|
|
1507
|
+
if (ch === "#" && !w.started && arithParens === 0) {
|
|
1507
1508
|
const nl = source.indexOf("\n", i);
|
|
1508
1509
|
i = nl < 0 ? source.length : nl - 1;
|
|
1509
1510
|
continue;
|
|
@@ -1531,6 +1532,14 @@ function scan(source, connectorsAreText, segments, level, list) {
|
|
|
1531
1532
|
const r = endWord() ?? operandOwed(i);
|
|
1532
1533
|
if (r !== undefined)
|
|
1533
1534
|
return r;
|
|
1535
|
+
if (ch === "(") {
|
|
1536
|
+
if (arithParens > 0)
|
|
1537
|
+
arithParens++;
|
|
1538
|
+
else if (split && source[next(i)] === "(")
|
|
1539
|
+
arithParens = 1;
|
|
1540
|
+
}
|
|
1541
|
+
else if (arithParens > 0)
|
|
1542
|
+
arithParens--;
|
|
1534
1543
|
current().tokens.push({ kind: "group", op: ch });
|
|
1535
1544
|
resetPosition();
|
|
1536
1545
|
continue;
|
|
@@ -56,7 +56,8 @@
|
|
|
56
56
|
* file half ships the freeze face, the acceptance face and the rebind legs.
|
|
57
57
|
*/
|
|
58
58
|
import type { PermissionRuleSyncTransport } from "../../../core/permission-rule-sync.js";
|
|
59
|
-
import { type AdoptionReceipt, type
|
|
59
|
+
import { type AdoptionReceipt, type AffectedDeploymentConfig } from "./marker.js";
|
|
60
|
+
import { type RuleOwner } from "../../../core/rule-owner.js";
|
|
60
61
|
/** The per-leg context handed to a carriage leg: rows the far side REFUSES go here — preserved and
|
|
61
62
|
* disclosed, never deleted (design/183 §7.2). Quarantining never fails the leg. */
|
|
62
63
|
export interface AdoptionCarriageLegContext {
|
|
@@ -79,7 +80,7 @@ export interface AdoptionCarriageLeg {
|
|
|
79
80
|
export interface AdoptLocalDataRootOptions {
|
|
80
81
|
/** The data root (the directory `FileStorageBackend` and the independent file stores build over). */
|
|
81
82
|
root: string;
|
|
82
|
-
from:
|
|
83
|
+
from: RuleOwner;
|
|
83
84
|
toPrincipal: string;
|
|
84
85
|
/** The claim REFERENCE for the new identity's credentials (minted by the server; design/183 §4.3).
|
|
85
86
|
* A reference, never the credential bytes — the marker file is a plain-text sidecar. */
|
|
@@ -141,7 +142,7 @@ export type AdoptionStatus = {
|
|
|
141
142
|
state: "none";
|
|
142
143
|
} | {
|
|
143
144
|
state: "in-flight";
|
|
144
|
-
from:
|
|
145
|
+
from: RuleOwner;
|
|
145
146
|
toPrincipal: string;
|
|
146
147
|
phase: 2 | 3 | 4 | 5;
|
|
147
148
|
} | {
|
|
@@ -7,6 +7,8 @@ import { SESSION_POLICY_MARK_SUFFIX, attributeSessionPolicyRow, judgeSessionPoli
|
|
|
7
7
|
import { SessionPolicyError } from "../../../core/session-policy-store.js";
|
|
8
8
|
import { thrownText } from "../../../core/thrown-value.js";
|
|
9
9
|
import { AdoptionError, NOT_MIGRATED_BY_DESIGN, readRootAdoptionFile, writeRootAdoptionFile, } from "./marker.js";
|
|
10
|
+
import { readRuleOwner, ruleOwnerText, sameRuleOwner } from "../../../core/rule-owner.js";
|
|
11
|
+
import { principalNameOf } from "../../../core/principal-name.js";
|
|
10
12
|
const CONFIG_ACCOUNT_FILE = "adoption-configs.json";
|
|
11
13
|
function baselineConfigs(toPrincipal) {
|
|
12
14
|
return [
|
|
@@ -282,12 +284,6 @@ const ZERO_ACTION_STORES = [
|
|
|
282
284
|
];
|
|
283
285
|
const SESSION_POLICY_LEG = "session-policy";
|
|
284
286
|
const CARRIAGE_BIT_PREFIX = "carriage:";
|
|
285
|
-
function sameSource(a, b) {
|
|
286
|
-
return a.kind === "principal" ? b.kind === "principal" && a.principal === b.principal : b.kind === "local-owner";
|
|
287
|
-
}
|
|
288
|
-
function sourceText(o) {
|
|
289
|
-
return o.kind === "principal" ? `principal "${o.principal}"` : "the local owner";
|
|
290
|
-
}
|
|
291
287
|
function receiptFromTerminal(root, adopted) {
|
|
292
288
|
const account = readConfigAccountEvidence(root);
|
|
293
289
|
const accountBinds = account !== undefined && account.adoptionId === adopted.immutableReport.adoptionId;
|
|
@@ -325,33 +321,34 @@ function answerFromExisting(root, existing, from, toPrincipal) {
|
|
|
325
321
|
if (existing === undefined)
|
|
326
322
|
return undefined;
|
|
327
323
|
if ("adopted" in existing) {
|
|
328
|
-
if (existing.adopted.toPrincipal === toPrincipal &&
|
|
324
|
+
if (existing.adopted.toPrincipal === toPrincipal && sameRuleOwner(existing.adopted.from, from)) {
|
|
329
325
|
return receiptFromTerminal(root, existing.adopted);
|
|
330
326
|
}
|
|
331
|
-
throw new AdoptionError("adoption_retarget", `this data root already carries a completed adoption (${
|
|
327
|
+
throw new AdoptionError("adoption_retarget", `this data root already carries a completed adoption (${ruleOwnerText(existing.adopted.from)} → "${existing.adopted.toPrincipal}") — ` +
|
|
332
328
|
`a second adoption of the same root is a multi-tenant transfer, not a shape this protocol supports`);
|
|
333
329
|
}
|
|
334
|
-
if (existing.marker.toPrincipal !== toPrincipal || !
|
|
330
|
+
if (existing.marker.toPrincipal !== toPrincipal || !sameRuleOwner(existing.marker.from, from)) {
|
|
335
331
|
throw new AdoptionError("adoption_in_flight_mismatch", `an adoption toward "${existing.marker.toPrincipal}" is already in flight in this data root (phase ${existing.marker.phase}) — ` +
|
|
336
332
|
`refusing to start a different one (resume the original, or repair the marker by hand)`);
|
|
337
333
|
}
|
|
338
334
|
return undefined;
|
|
339
335
|
}
|
|
340
336
|
export async function adoptLocalDataRoot(opts) {
|
|
341
|
-
if (
|
|
342
|
-
throw new AdoptionError("adoption_bad_request", "adoptLocalDataRoot requires the adopting principal — adoption is the act of giving this data root an identity");
|
|
337
|
+
if (principalNameOf(opts.toPrincipal) === undefined) {
|
|
338
|
+
throw new AdoptionError("adoption_bad_request", "adoptLocalDataRoot requires the adopting principal, a principal name — adoption is the act of giving this data root an identity");
|
|
343
339
|
}
|
|
344
|
-
|
|
345
|
-
|
|
340
|
+
const from = readRuleOwner(opts.from);
|
|
341
|
+
if (from === undefined) {
|
|
342
|
+
throw new AdoptionError("adoption_bad_request", "the adoption source must be the local-owner kind or a principal owner whose principal is a principal name — local-single-user identity is the local-owner kind, never a blank string");
|
|
346
343
|
}
|
|
347
|
-
if (
|
|
344
|
+
if (from.kind === "principal" && from.principal === opts.toPrincipal) {
|
|
348
345
|
throw new AdoptionError("adoption_bad_request", `the data root already belongs to "${opts.toPrincipal}" — there is nothing to adopt`);
|
|
349
346
|
}
|
|
350
347
|
if (typeof opts.credentials.ref !== "string" || opts.credentials.ref === "") {
|
|
351
348
|
throw new AdoptionError("adoption_bad_request", "the credentials claim ref must be a non-empty reference (the claim is what makes the new identity redeemable)");
|
|
352
349
|
}
|
|
353
|
-
if (opts.
|
|
354
|
-
throw new AdoptionError("adoption_bad_request", "adoptLocalDataRoot requires
|
|
350
|
+
if (opts.credentials === null || typeof opts.credentials !== "object") {
|
|
351
|
+
throw new AdoptionError("adoption_bad_request", "adoptLocalDataRoot requires a `credentials` object");
|
|
355
352
|
}
|
|
356
353
|
if (opts.additionalConfigs !== undefined && !Array.isArray(opts.additionalConfigs)) {
|
|
357
354
|
throw new AdoptionError("adoption_bad_request", "additionalConfigs must be an array when supplied");
|
|
@@ -368,9 +365,6 @@ export async function adoptLocalDataRoot(opts) {
|
|
|
368
365
|
if (opts.onError !== undefined && typeof opts.onError !== "function") {
|
|
369
366
|
throw new AdoptionError("adoption_bad_request", "`onError` must be callable when supplied");
|
|
370
367
|
}
|
|
371
|
-
if (opts.from.kind !== "local-owner" && opts.from.kind !== "principal") {
|
|
372
|
-
throw new AdoptionError("adoption_bad_request", "the adoption source must be the local-owner kind or a named principal");
|
|
373
|
-
}
|
|
374
368
|
if (opts.credentials.issuedBy !== "server") {
|
|
375
369
|
throw new AdoptionError("adoption_bad_request", `the credentials claim must be server-issued (got issuedBy: ${JSON.stringify(opts.credentials.issuedBy)}) — the server mints the new identity`);
|
|
376
370
|
}
|
|
@@ -402,7 +396,7 @@ export async function adoptLocalDataRoot(opts) {
|
|
|
402
396
|
}
|
|
403
397
|
}
|
|
404
398
|
ensureDir(opts.root);
|
|
405
|
-
const pre = answerFromExisting(opts.root, readRootAdoptionFile(opts.root),
|
|
399
|
+
const pre = answerFromExisting(opts.root, readRootAdoptionFile(opts.root), from, opts.toPrincipal);
|
|
406
400
|
if (pre !== undefined) {
|
|
407
401
|
const account = readConfigAccountEvidence(opts.root);
|
|
408
402
|
if (account !== undefined && account.adoptionId === pre.immutableReport.adoptionId)
|
|
@@ -425,7 +419,7 @@ export async function adoptLocalDataRoot(opts) {
|
|
|
425
419
|
}
|
|
426
420
|
try {
|
|
427
421
|
const existing = readRootAdoptionFile(opts.root);
|
|
428
|
-
const answered = answerFromExisting(opts.root, existing,
|
|
422
|
+
const answered = answerFromExisting(opts.root, existing, from, opts.toPrincipal);
|
|
429
423
|
if (answered !== undefined) {
|
|
430
424
|
rebuildConfigAccountIfUnbound(opts.root, answered.immutableReport);
|
|
431
425
|
return receiptFromTerminal(opts.root, {
|
|
@@ -481,7 +475,7 @@ export async function adoptLocalDataRoot(opts) {
|
|
|
481
475
|
`They would never run, and reporting them as done would be a lie; post-adoption carriage rides each store's normal channel.`);
|
|
482
476
|
}
|
|
483
477
|
if (plan !== existing.marker.plan) {
|
|
484
|
-
publishMarker(opts.root, adoptionId,
|
|
478
|
+
publishMarker(opts.root, adoptionId, from, opts.toPrincipal, phase, plan, legBits);
|
|
485
479
|
}
|
|
486
480
|
const accountInFlight = readConfigAccount(opts.root);
|
|
487
481
|
if (accountInFlight === undefined || accountInFlight.adoptionId !== adoptionId) {
|
|
@@ -496,7 +490,7 @@ export async function adoptLocalDataRoot(opts) {
|
|
|
496
490
|
legBits = {};
|
|
497
491
|
plan = { ...(offeredRulesDir !== undefined ? { rulesDir: offeredRulesDir } : {}), carriage: offeredCarriage, credentialsRef: opts.credentials.ref };
|
|
498
492
|
upsertConfigAccount(opts.root, adoptionId, opts.toPrincipal, opts.additionalConfigs ?? []);
|
|
499
|
-
publishMarker(opts.root, adoptionId,
|
|
493
|
+
publishMarker(opts.root, adoptionId, from, opts.toPrincipal, 2, plan, legBits);
|
|
500
494
|
}
|
|
501
495
|
const legs = [];
|
|
502
496
|
if (phase < 3) {
|
|
@@ -505,7 +499,7 @@ export async function adoptLocalDataRoot(opts) {
|
|
|
505
499
|
try {
|
|
506
500
|
nested = await adoptFilePermissionRuleStore({
|
|
507
501
|
dir: opts.rules.dir,
|
|
508
|
-
from
|
|
502
|
+
from,
|
|
509
503
|
toPrincipal: opts.toPrincipal,
|
|
510
504
|
transport: opts.rules.transport,
|
|
511
505
|
...(opts.now !== undefined ? { now: opts.now } : {}),
|
|
@@ -526,15 +520,15 @@ export async function adoptLocalDataRoot(opts) {
|
|
|
526
520
|
}
|
|
527
521
|
}
|
|
528
522
|
if (legBits[SESSION_POLICY_LEG]?.done !== true) {
|
|
529
|
-
const rows = rewriteSessionPolicyRows(opts.root,
|
|
523
|
+
const rows = rewriteSessionPolicyRows(opts.root, from.kind === "principal" ? from.principal : null, opts.toPrincipal);
|
|
530
524
|
legBits = { ...legBits, [SESSION_POLICY_LEG]: { done: true, rows } };
|
|
531
|
-
publishMarker(opts.root, adoptionId,
|
|
525
|
+
publishMarker(opts.root, adoptionId, from, opts.toPrincipal, 2, plan, legBits);
|
|
532
526
|
}
|
|
533
|
-
publishMarker(opts.root, adoptionId,
|
|
527
|
+
publishMarker(opts.root, adoptionId, from, opts.toPrincipal, 3, plan, legBits);
|
|
534
528
|
phase = 3;
|
|
535
529
|
}
|
|
536
530
|
if (phase < 4) {
|
|
537
|
-
publishMarker(opts.root, adoptionId,
|
|
531
|
+
publishMarker(opts.root, adoptionId, from, opts.toPrincipal, 4, plan, legBits);
|
|
538
532
|
phase = 4;
|
|
539
533
|
}
|
|
540
534
|
if (phase < 5) {
|
|
@@ -575,9 +569,9 @@ export async function adoptLocalDataRoot(opts) {
|
|
|
575
569
|
...(quarantined > 0 ? { quarantined } : {}),
|
|
576
570
|
},
|
|
577
571
|
};
|
|
578
|
-
publishMarker(opts.root, adoptionId,
|
|
572
|
+
publishMarker(opts.root, adoptionId, from, opts.toPrincipal, 4, plan, legBits);
|
|
579
573
|
}
|
|
580
|
-
publishMarker(opts.root, adoptionId,
|
|
574
|
+
publishMarker(opts.root, adoptionId, from, opts.toPrincipal, 5, plan, legBits);
|
|
581
575
|
phase = 5;
|
|
582
576
|
}
|
|
583
577
|
if (plan.rulesDir !== undefined)
|
|
@@ -609,7 +603,7 @@ export async function adoptLocalDataRoot(opts) {
|
|
|
609
603
|
}
|
|
610
604
|
const immutableReport = {
|
|
611
605
|
adoptionId,
|
|
612
|
-
from
|
|
606
|
+
from,
|
|
613
607
|
toPrincipal: opts.toPrincipal,
|
|
614
608
|
atMs,
|
|
615
609
|
credentials: opts.credentials,
|
|
@@ -619,9 +613,9 @@ export async function adoptLocalDataRoot(opts) {
|
|
|
619
613
|
};
|
|
620
614
|
writeRootAdoptionFile(opts.root, {
|
|
621
615
|
schemaVersion: 1,
|
|
622
|
-
adopted: { from
|
|
616
|
+
adopted: { from, toPrincipal: opts.toPrincipal, atMs: immutableReport.atMs, immutableReport },
|
|
623
617
|
});
|
|
624
|
-
return receiptFromTerminal(opts.root, { from
|
|
618
|
+
return receiptFromTerminal(opts.root, { from, toPrincipal: opts.toPrincipal, atMs: immutableReport.atMs, immutableReport });
|
|
625
619
|
}
|
|
626
620
|
finally {
|
|
627
621
|
adoptionLock.release();
|
|
@@ -14,17 +14,10 @@
|
|
|
14
14
|
* with the same (from → toPrincipal) short-circuits to the recorded receipt) and it carries the
|
|
15
15
|
* IMMUTABLE report — the byte-stable half of every receipt.
|
|
16
16
|
*
|
|
17
|
-
* This module is deliberately tiny and dependency-light (node:fs
|
|
18
|
-
* file store imports the gate from here, so it must never grow an import back into a store.
|
|
17
|
+
* This module is deliberately tiny and dependency-light (node:fs, the atomic-write primitive, the import-free owner
|
|
18
|
+
* reading): every file store imports the gate from here, so it must never grow an import back into a store.
|
|
19
19
|
*/
|
|
20
|
-
|
|
21
|
-
* (design/182): local-single-user identity is a STRUCTURAL ABSENCE, never a sentinel string. */
|
|
22
|
-
export type AdoptionSource = {
|
|
23
|
-
kind: "local-owner";
|
|
24
|
-
} | {
|
|
25
|
-
kind: "principal";
|
|
26
|
-
principal: string;
|
|
27
|
-
};
|
|
20
|
+
import { type RuleOwner } from "../../../core/rule-owner.js";
|
|
28
21
|
/** Typed refusal codes (design/183 §7.3): every adoption refusal is discriminable — from `not_found`,
|
|
29
22
|
* from a broken deployment, and from each other. */
|
|
30
23
|
export type AdoptionErrorCode =
|
|
@@ -81,7 +74,7 @@ export interface AdoptionLegReport {
|
|
|
81
74
|
export interface AdoptionReport {
|
|
82
75
|
/** Minted at phase ② — the binding anchor config-witness receipts must carry. */
|
|
83
76
|
adoptionId: string;
|
|
84
|
-
from:
|
|
77
|
+
from: RuleOwner;
|
|
85
78
|
toPrincipal: string;
|
|
86
79
|
atMs: number;
|
|
87
80
|
/** The claim REFERENCE for the new identity's credentials — never the credentials themselves (the
|
|
@@ -120,7 +113,7 @@ export type RootAdoptionFile = {
|
|
|
120
113
|
schemaVersion: 1;
|
|
121
114
|
marker: {
|
|
122
115
|
adoptionId: string;
|
|
123
|
-
from:
|
|
116
|
+
from: RuleOwner;
|
|
124
117
|
toPrincipal: string;
|
|
125
118
|
phase: 2 | 3 | 4 | 5;
|
|
126
119
|
/** The migration plan recorded at phase ② and grown MONOTONICALLY across resumes — what a
|
|
@@ -147,7 +140,7 @@ export type RootAdoptionFile = {
|
|
|
147
140
|
} | {
|
|
148
141
|
schemaVersion: 1;
|
|
149
142
|
adopted: {
|
|
150
|
-
from:
|
|
143
|
+
from: RuleOwner;
|
|
151
144
|
toPrincipal: string;
|
|
152
145
|
atMs: number;
|
|
153
146
|
immutableReport: AdoptionReport;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { readFileSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
+
import { readRuleOwner, sameRuleOwner } from "../../../core/rule-owner.js";
|
|
4
|
+
import { principalNameOf } from "../../../core/principal-name.js";
|
|
3
5
|
import { atomicWriteFile, ensureDir } from "../fs-atomic.js";
|
|
4
6
|
export class AdoptionError extends Error {
|
|
5
7
|
code;
|
|
@@ -26,14 +28,6 @@ export const BASELINE_CONFIG_IDENTITIES = [
|
|
|
26
28
|
{ deployment: "env", key: "REQUIRE_PRINCIPAL" },
|
|
27
29
|
{ deployment: "core-decl", key: "localOwnerRules" },
|
|
28
30
|
];
|
|
29
|
-
function isSource(v) {
|
|
30
|
-
if (v === null || typeof v !== "object")
|
|
31
|
-
return false;
|
|
32
|
-
const s = v;
|
|
33
|
-
if (s.kind === "local-owner")
|
|
34
|
-
return true;
|
|
35
|
-
return s.kind === "principal" && typeof s.principal === "string" && s.principal !== "";
|
|
36
|
-
}
|
|
37
31
|
function isRootAdoptionFileShape(v) {
|
|
38
32
|
if (v === null || typeof v !== "object")
|
|
39
33
|
return false;
|
|
@@ -45,8 +39,8 @@ function isRootAdoptionFileShape(v) {
|
|
|
45
39
|
if (m === null ||
|
|
46
40
|
typeof m !== "object" ||
|
|
47
41
|
typeof m.adoptionId !== "string" ||
|
|
48
|
-
|
|
49
|
-
|
|
42
|
+
readRuleOwner(m.from) === undefined ||
|
|
43
|
+
principalNameOf(m.toPrincipal) === undefined ||
|
|
50
44
|
typeof m.phase !== "number" ||
|
|
51
45
|
![2, 3, 4, 5].includes(m.phase)) {
|
|
52
46
|
return false;
|
|
@@ -91,21 +85,19 @@ function isRootAdoptionFileShape(v) {
|
|
|
91
85
|
}
|
|
92
86
|
if ("adopted" in f && !("marker" in f)) {
|
|
93
87
|
const a = f.adopted;
|
|
88
|
+
const from = readRuleOwner(a?.from);
|
|
94
89
|
if (a === null ||
|
|
95
90
|
typeof a !== "object" ||
|
|
96
|
-
|
|
97
|
-
|
|
91
|
+
from === undefined ||
|
|
92
|
+
principalNameOf(a.toPrincipal) === undefined ||
|
|
98
93
|
typeof a.atMs !== "number" ||
|
|
99
94
|
a.immutableReport === null ||
|
|
100
95
|
typeof a.immutableReport !== "object") {
|
|
101
96
|
return false;
|
|
102
97
|
}
|
|
103
98
|
const r = a.immutableReport;
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
? a.from.kind === "local-owner"
|
|
107
|
-
: a.from.kind === "principal" &&
|
|
108
|
-
r.from.principal === a.from.principal);
|
|
99
|
+
const reportFrom = readRuleOwner(r.from);
|
|
100
|
+
const sameFrom = reportFrom !== undefined && sameRuleOwner(reportFrom, from);
|
|
109
101
|
const okCount = (n) => n === undefined || (typeof n === "number" && Number.isSafeInteger(n) && n >= 0);
|
|
110
102
|
const configIds = new Set();
|
|
111
103
|
const configsOk = Array.isArray(r.affectedDeploymentConfigs) &&
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { type ExecutionOutcomeRecordWord } from "../../core/checkpoint-execution-record.js";
|
|
2
|
+
import { type HolderJudge } from "../../core/checkpoint-generation.js";
|
|
2
3
|
import { type Checkpoint, type PendingSteerInput, type CheckpointFaultMode, type CheckpointStore, type CheckpointSummary, type CheckpointToken, type ReopenReason, type ResolveExpectation, type ResumeOutcome } from "../../core/checkpoint-store.js";
|
|
3
4
|
import type { GateOutcome } from "../../core/gate-outcome.js";
|
|
5
|
+
import { type CheckpointDeleteGuard, type CheckpointOverdueCursor, type CheckpointOverdueQuery, type CheckpointPage, type CheckpointRowRead, type CheckpointSessionCursor, type CheckpointSessionQuery } from "../../core/checkpoint-queries.js";
|
|
4
6
|
import { type CorruptReadInfo } from "./corrupt-read-sink.js";
|
|
5
7
|
export interface FileCheckpointStoreOptions {
|
|
6
8
|
/** This store's half of {@link import("./shared-ledger.js").LedgerPaths.onCorruptRead}. */
|
|
@@ -11,6 +13,13 @@ export interface FileCheckpointStoreOptions {
|
|
|
11
13
|
fsync?: boolean;
|
|
12
14
|
/** Compact the ledger into a snapshot once it exceeds this many events (then truncate). Default 1000. */
|
|
13
15
|
compactEvery?: number;
|
|
16
|
+
/** The session head read (a session store's `headOf`) {@link FileCheckpointStore.deleteSessionCheckpoints} judges its guard by;
|
|
17
|
+
* without it the store has no `deleteSessionCheckpoints` member. */
|
|
18
|
+
sessionHeadOf?: (sessionId: string) => Promise<{
|
|
19
|
+
readonly owner: string | null;
|
|
20
|
+
} | undefined>;
|
|
21
|
+
/** The judge of a resolve's claim holder ({@link HolderJudge}); with it the store declares `fence = { holder: true }`. */
|
|
22
|
+
holderIsCurrent?: HolderJudge;
|
|
14
23
|
}
|
|
15
24
|
export declare class FileCheckpointStore implements CheckpointStore {
|
|
16
25
|
/** design/173 §2.3 — honest declaration on the restart-survival axis the vocabulary claims: rows
|
|
@@ -34,6 +43,11 @@ export declare class FileCheckpointStore implements CheckpointStore {
|
|
|
34
43
|
readonly execution: {
|
|
35
44
|
readonly outcome: true;
|
|
36
45
|
};
|
|
46
|
+
/** Declared exactly when the store was built with a `holderIsCurrent` judge. */
|
|
47
|
+
readonly fence?: {
|
|
48
|
+
readonly holder: true;
|
|
49
|
+
};
|
|
50
|
+
private readonly holderIsCurrent;
|
|
37
51
|
private readonly fsyncEnabled;
|
|
38
52
|
private readonly compactEvery;
|
|
39
53
|
/** RB-134: the directory's ONE authority (map + token mutex + append log), joined not rebuilt. */
|
|
@@ -42,6 +56,11 @@ export declare class FileCheckpointStore implements CheckpointStore {
|
|
|
42
56
|
private get cps();
|
|
43
57
|
/** One-shot crash fault (mirrors `InMemoryCheckpointStore.testInjectFault`). */
|
|
44
58
|
private fault;
|
|
59
|
+
/** The guarded {@link FileCheckpointStoreOptions.onCorruptRead} seat (the ledger's replay and this store's projection share it). */
|
|
60
|
+
private readonly discloseCorrupt;
|
|
61
|
+
private readonly ledgerPath;
|
|
62
|
+
/** Present exactly when the store was built with a session head read (`FileCheckpointStoreOptions.sessionHeadOf`). */
|
|
63
|
+
readonly deleteSessionCheckpoints?: (sessionId: string, guard: CheckpointDeleteGuard) => Promise<number>;
|
|
45
64
|
constructor(root: string, opts?: FileCheckpointStoreOptions);
|
|
46
65
|
/** Serialize an op behind any in-flight op on the same token (the in-process per-token async mutex). */
|
|
47
66
|
private withLock;
|
|
@@ -66,6 +85,11 @@ export declare class FileCheckpointStore implements CheckpointStore {
|
|
|
66
85
|
reap(scope: string, cutoff: number): Promise<number>;
|
|
67
86
|
listByScope(scope: string): Promise<CheckpointSummary[]>;
|
|
68
87
|
listScopes(): Promise<string[]>;
|
|
88
|
+
/** The listing faces' disclosure: a row read past a damage is reported through the corrupt-read seat, named by its non-secret
|
|
89
|
+
* identity (never its token). */
|
|
90
|
+
private listingDisclose;
|
|
91
|
+
listOverdue(query: CheckpointOverdueQuery): Promise<CheckpointPage<CheckpointSummary, CheckpointOverdueCursor>>;
|
|
92
|
+
listBySession(query: CheckpointSessionQuery): Promise<CheckpointPage<CheckpointRowRead, CheckpointSessionCursor>>;
|
|
69
93
|
/** Force a compaction now (test/inspection). The snapshot rewrite + RB-167 closeForSwap swap that
|
|
70
94
|
* makes `replay` read the full state from the snapshot alone is the base's {@link LedgerCore.compact}. */
|
|
71
95
|
compactNow(): void;
|