@sema-agent/core 7.67.2 → 7.68.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 +1533 -0
- package/README.md +18 -9
- package/README.zh-CN.md +16 -8
- package/dist/agents/agent-definition.d.ts +1 -1
- package/dist/agents/agent-definition.js +4 -1
- package/dist/agents/cascade.d.ts +2 -2
- package/dist/agents/cascade.js +3 -1
- package/dist/agents/cumulative-stats.d.ts +2 -1
- package/dist/agents/cumulative-stats.js +4 -1
- package/dist/agents/list-agents-tool.d.ts +30 -0
- package/dist/agents/list-agents-tool.js +45 -3
- package/dist/agents/peer-admission.d.ts +2 -2
- package/dist/agents/peer-session-drain.d.ts +2 -0
- package/dist/agents/peer-session-drain.js +1 -0
- package/dist/agents/repair-loop.js +3 -1
- package/dist/agents/retain-ledger.d.ts +61 -8
- package/dist/agents/retain-ledger.js +25 -3
- package/dist/agents/roster-store.d.ts +4 -2
- package/dist/agents/send-message-tool.d.ts +1 -1
- package/dist/agents/send-message-tool.js +20 -15
- package/dist/agents/subagent-steps.js +2 -10
- package/dist/agents/subagent.d.ts +3 -0
- package/dist/agents/subagent.js +106 -76
- package/dist/agents/tool-filter.d.ts +20 -11
- package/dist/agents/tool-filter.js +8 -4
- package/dist/agents/verify.d.ts +3 -1
- package/dist/agents/verify.js +2 -0
- package/dist/brain/anthropic.js +4 -4
- package/dist/brain/errors.d.ts +20 -0
- package/dist/brain/errors.js +114 -0
- package/dist/brain/open-responses.js +3 -1
- package/dist/brain/openai.js +3 -1
- package/dist/brain/provider-message.d.ts +5 -3
- package/dist/brain/provider-message.js +35 -8
- package/dist/brain/reasoning-request.d.ts +73 -19
- package/dist/brain/reasoning-request.js +164 -72
- package/dist/brain/reasoning-stamp.d.ts +26 -0
- package/dist/brain/reasoning-stamp.js +10 -0
- package/dist/brain/reasoning.d.ts +95 -162
- package/dist/brain/reasoning.js +31 -86
- package/dist/brain/route-adjudicator.d.ts +9 -7
- package/dist/brain/route-adjudicator.js +12 -10
- package/dist/brain/status-sink.d.ts +19 -64
- package/dist/brain/status-sink.js +5 -21
- package/dist/brain/stream-engine.d.ts +11 -2
- package/dist/brain/stream-engine.js +10 -0
- package/dist/core/a2a.d.ts +17 -5
- package/dist/core/a2a.js +11 -3
- package/dist/core/allow-entry.d.ts +35 -15
- package/dist/core/allow-entry.js +47 -60
- package/dist/core/ask-headline.d.ts +68 -0
- package/dist/core/ask-headline.js +23 -0
- package/dist/core/ask-origin.d.ts +36 -8
- package/dist/core/ask-origin.js +17 -10
- package/dist/core/ask-question.d.ts +34 -7
- package/dist/core/ask-question.js +10 -1
- package/dist/core/ask-unresolvable-notice.d.ts +7 -0
- package/dist/core/ask-unresolvable-notice.js +9 -3
- package/dist/core/auto-strip.d.ts +53 -0
- package/dist/core/auto-strip.js +76 -0
- package/dist/core/background-agent-store.d.ts +45 -5
- package/dist/core/background-agent-store.js +69 -15
- package/dist/core/background-shell.d.ts +2 -2
- package/dist/core/caller-text.js +2 -2
- package/dist/core/canonical-json.d.ts +13 -0
- package/dist/core/canonical-json.js +7 -0
- package/dist/core/checkpoint-features.d.ts +66 -20
- package/dist/core/checkpoint-features.js +12 -1
- package/dist/core/checkpoint-generation.d.ts +1 -1
- package/dist/core/checkpoint-queries.d.ts +1 -1
- package/dist/core/checkpoint-queries.js +4 -1
- package/dist/core/checkpoint-requirements.d.ts +25 -1
- package/dist/core/checkpoint-requirements.js +5 -1
- package/dist/core/checkpoint-row-verdict.d.ts +1 -0
- package/dist/core/checkpoint-row-verdict.js +4 -0
- package/dist/core/checkpoint-store.d.ts +66 -38
- package/dist/core/checkpoint-store.js +15 -6
- package/dist/core/child-clamp-seats.d.ts +6 -0
- package/dist/core/child-clamp-seats.js +1 -0
- package/dist/core/config-refusal-codes.d.ts +1 -1
- package/dist/core/config-refusal-codes.js +1 -0
- package/dist/core/delegation-frames.d.ts +9 -12
- package/dist/core/delegation-frames.js +9 -8
- package/dist/core/engine-capabilities.d.ts +21 -8
- package/dist/core/engine-capabilities.js +1 -1
- package/dist/core/engine-notice.d.ts +147 -34
- package/dist/core/engine-notice.js +27 -16
- package/dist/core/engine-storage-backend.d.ts +2 -1
- package/dist/core/env-budget.js +3 -3
- package/dist/core/env-knob-announce.d.ts +10 -10
- package/dist/core/env-knob-announce.js +3 -6
- package/dist/core/file-history-store.d.ts +29 -4
- package/dist/core/file-history-store.js +13 -0
- package/dist/core/frame-settlement.d.ts +2 -1
- package/dist/core/gate-fold.js +1 -1
- package/dist/core/gate-lanes.js +56 -49
- package/dist/core/governance-codes.d.ts +39 -3
- package/dist/core/governance-codes.js +61 -3
- package/dist/core/hooks.d.ts +29 -11
- package/dist/core/hooks.js +5 -2
- package/dist/core/human-input-projection.js +3 -3
- package/dist/core/input-author.d.ts +17 -3
- package/dist/core/input-author.js +15 -3
- package/dist/core/leg-identity.d.ts +10 -28
- package/dist/core/leg-identity.js +1 -21
- package/dist/core/lsp.d.ts +18 -13
- package/dist/core/lsp.js +30 -22
- package/dist/core/mailbox-store.d.ts +1 -1
- package/dist/core/mailbox-store.js +4 -4
- package/dist/core/mcp-connection-pool.d.ts +93 -4
- package/dist/core/mcp-connection-pool.js +104 -1
- package/dist/core/mcp-failure.d.ts +38 -12
- package/dist/core/mcp-failure.js +9 -13
- package/dist/core/mcp-probe.d.ts +4 -3
- package/dist/core/mcp-server-link.d.ts +4 -2
- package/dist/core/mcp-server-link.js +4 -5
- package/dist/core/mcp-server-spec.d.ts +3 -3
- package/dist/core/mcp-server-unavailable-notice.d.ts +22 -8
- package/dist/core/mcp-server-unavailable-notice.js +18 -4
- package/dist/core/mcp.d.ts +40 -6
- package/dist/core/mcp.js +39 -13
- package/dist/core/memory-engine/content-origin.js +2 -2
- package/dist/core/memory-engine/control-objects.d.ts +2 -4
- package/dist/core/memory-engine/control-objects.js +2 -10
- package/dist/core/memory-engine/delegation-settlement.js +6 -1
- package/dist/core/memory-engine/dual-root.js +3 -0
- package/dist/core/memory-engine/engine.d.ts +6 -4
- package/dist/core/memory-engine/engine.js +32 -29
- package/dist/core/memory-engine/file-backend.d.ts +20 -5
- package/dist/core/memory-engine/file-backend.js +21 -31
- package/dist/core/memory-engine/frontmatter.d.ts +2 -0
- package/dist/core/memory-engine/frontmatter.js +4 -0
- package/dist/core/memory-engine/layout.d.ts +114 -20
- package/dist/core/memory-engine/layout.js +340 -22
- package/dist/core/memory-engine/memory-deployment.d.ts +7 -5
- package/dist/core/memory-engine/mount-failed-notice.d.ts +19 -7
- package/dist/core/memory-engine/mount-failed-notice.js +43 -10
- package/dist/core/memory-engine/sync-client.js +4 -5
- package/dist/core/model-fallbacks.d.ts +5 -1
- package/dist/core/model-fallbacks.js +3 -3
- package/dist/core/model-receipt.d.ts +2 -1
- package/dist/core/model-receipt.js +12 -1
- package/dist/core/mods/kernel/dispatch.d.ts +2 -2
- package/dist/core/mods/kernel/dispatch.js +14 -6
- package/dist/core/mods/kernel/events.d.ts +8 -5
- package/dist/core/mods/kernel/events.js +2 -2
- package/dist/core/mods/kernel/index.d.ts +1 -1
- package/dist/core/mods/kernel/registration.d.ts +9 -0
- package/dist/core/mods/package.js +1 -1
- package/dist/core/mods/session-append.d.ts +4 -2
- package/dist/core/mods/session-append.js +3 -0
- package/dist/core/mods/stations.d.ts +7 -11
- package/dist/core/mods/stations.js +4 -7
- package/dist/core/mods/tool-call.d.ts +10 -8
- package/dist/core/mods/tool-call.js +15 -18
- package/dist/core/mounted-mcp.d.ts +0 -4
- package/dist/core/mounted-mcp.js +1 -1
- package/dist/core/park-noun.d.ts +24 -0
- package/dist/core/park-noun.js +21 -0
- package/dist/core/park-resumability.d.ts +60 -0
- package/dist/core/park-resumability.js +30 -0
- package/dist/core/permission-rule-provider.d.ts +24 -2
- package/dist/core/permission-rule-provider.js +11 -8
- package/dist/core/permission-rule-store.d.ts +8 -1
- package/dist/core/permission-rule-store.js +2 -3
- package/dist/core/permission-rules.d.ts +2 -1
- package/dist/core/permission-rules.js +8 -4
- package/dist/core/persisted-rule-arms.d.ts +3 -0
- package/dist/core/persisted-rule-arms.js +2 -1
- package/dist/core/present-plan-tool.d.ts +47 -3
- package/dist/core/present-plan-tool.js +62 -4
- package/dist/core/principal-name.d.ts +1 -1
- package/dist/core/principal-name.js +5 -5
- package/dist/core/process-identity.js +10 -5
- package/dist/core/protocol-http-auth.d.ts +30 -9
- package/dist/core/protocol-http-auth.js +113 -59
- package/dist/core/read-only-shell.js +9 -5
- package/dist/core/redaction-marks.d.ts +4 -26
- package/dist/core/redaction-marks.js +9 -21
- package/dist/core/remote-env.d.ts +43 -16
- package/dist/core/remote-env.js +1 -1
- package/dist/core/request-copy-projection.d.ts +1 -1
- package/dist/core/request-copy-projection.js +40 -50
- package/dist/core/resume-config-judge.js +1 -1
- package/dist/core/resume-startup-cause.d.ts +35 -18
- package/dist/core/resume-startup-cause.js +13 -10
- package/dist/core/retention.d.ts +167 -25
- package/dist/core/retention.js +100 -20
- package/dist/core/roles.d.ts +6 -0
- package/dist/core/roles.js +11 -5
- package/dist/core/rule-lane-reads.d.ts +3 -0
- package/dist/core/rule-lane-reads.js +5 -1
- package/dist/core/rule-store-fault.d.ts +70 -0
- package/dist/core/rule-store-fault.js +102 -0
- package/dist/core/runner/advertised-writable-dirs.js +16 -31
- package/dist/core/runner/announce-once-ledger.d.ts +19 -2
- package/dist/core/runner/announce-once-ledger.js +24 -2
- package/dist/core/runner/assemble-result.d.ts +6 -0
- package/dist/core/runner/assemble-result.js +1 -1
- package/dist/core/runner/auto-strip-notice.d.ts +36 -0
- package/dist/core/runner/auto-strip-notice.js +59 -0
- package/dist/core/runner/branch-window.d.ts +3 -0
- package/dist/core/runner/branch-window.js +37 -0
- package/dist/core/runner/caller-roster.d.ts +8 -3
- package/dist/core/runner/capability-withheld-seat.js +3 -9
- package/dist/core/runner/clock-and-limits.d.ts +22 -1
- package/dist/core/runner/clock-and-limits.js +30 -0
- package/dist/core/runner/contracts.d.ts +58 -35
- package/dist/core/runner/credential-refusal-seat.d.ts +2 -0
- package/dist/core/runner/credential-refusal-seat.js +47 -0
- package/dist/core/runner/cross-boundary-lane.js +6 -4
- package/dist/core/runner/decide-continuation.js +1 -1
- package/dist/core/runner/file-history-restore.d.ts +53 -2
- package/dist/core/runner/file-history-restore.js +29 -10
- package/dist/core/runner/forward-sink.d.ts +14 -1
- package/dist/core/runner/forward-sink.js +14 -12
- package/dist/core/runner/gate-exit.d.ts +8 -7
- package/dist/core/runner/gate-exit.js +13 -13
- package/dist/core/runner/git-status-frame.js +2 -4
- package/dist/core/runner/initial-run-state.js +1 -1
- package/dist/core/runner/main-call-account.d.ts +3 -1
- package/dist/core/runner/main-call-account.js +5 -3
- package/dist/core/runner/mcp-redial.d.ts +2 -5
- package/dist/core/runner/mcp-redial.js +2 -2
- package/dist/core/runner/nested-memory-content.d.ts +7 -1
- package/dist/core/runner/nested-memory-content.js +73 -13
- package/dist/core/runner/nested-memory-lane.d.ts +44 -19
- package/dist/core/runner/nested-memory-lane.js +152 -76
- package/dist/core/runner/park-commit.js +3 -1
- package/dist/core/runner/permission-rule-lanes.d.ts +8 -2
- package/dist/core/runner/permission-rule-lanes.js +29 -3
- package/dist/core/runner/person-path-rows.d.ts +3 -11
- package/dist/core/runner/person-path-rows.js +21 -24
- package/dist/core/runner/prepare-acquire-reconcile.js +3 -1
- package/dist/core/runner/prepare-artifact.d.ts +1 -1
- package/dist/core/runner/prepare-artifact.js +20 -14
- package/dist/core/runner/prepare-ask-lane.d.ts +9 -6
- package/dist/core/runner/prepare-ask-lane.js +6 -5
- package/dist/core/runner/prepare-boundary-parks.d.ts +7 -1
- package/dist/core/runner/prepare-boundary-parks.js +27 -24
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +5 -2
- package/dist/core/runner/prepare-caps-and-workflow.js +4 -3
- package/dist/core/runner/prepare-config-doors.d.ts +9 -24
- package/dist/core/runner/prepare-config-doors.js +58 -41
- package/dist/core/runner/prepare-context-lane.d.ts +2 -2
- package/dist/core/runner/prepare-context-lane.js +3 -5
- package/dist/core/runner/prepare-defer-classify.d.ts +1 -1
- package/dist/core/runner/prepare-defer-classify.js +1 -1
- package/dist/core/runner/prepare-delegation-surface.d.ts +2 -2
- package/dist/core/runner/prepare-delegation-surface.js +3 -2
- package/dist/core/runner/prepare-file-history.d.ts +62 -26
- package/dist/core/runner/prepare-file-history.js +117 -46
- package/dist/core/runner/prepare-gate-stations.d.ts +4 -0
- package/dist/core/runner/prepare-gate-stations.js +6 -5
- package/dist/core/runner/prepare-hands-readface.d.ts +9 -4
- package/dist/core/runner/prepare-hands-readface.js +8 -4
- package/dist/core/runner/prepare-inherited-gate.d.ts +11 -4
- package/dist/core/runner/prepare-inherited-gate.js +6 -6
- package/dist/core/runner/prepare-listings.d.ts +1 -1
- package/dist/core/runner/prepare-listings.js +1 -1
- package/dist/core/runner/prepare-memory.js +2 -2
- package/dist/core/runner/prepare-offload-wrappers.d.ts +1 -1
- package/dist/core/runner/prepare-offload-wrappers.js +1 -1
- package/dist/core/runner/prepare-park-ask.d.ts +10 -3
- package/dist/core/runner/prepare-park-ask.js +7 -9
- package/dist/core/runner/prepare-policy-chain.d.ts +18 -9
- package/dist/core/runner/prepare-policy-chain.js +18 -13
- package/dist/core/runner/prepare-project-context.d.ts +1 -1
- package/dist/core/runner/prepare-project-context.js +5 -3
- package/dist/core/runner/prepare-prompt-assembly.js +2 -1
- package/dist/core/runner/prepare-prompt-inputs.d.ts +2 -2
- package/dist/core/runner/prepare-prompt-inputs.js +1 -1
- package/dist/core/runner/prepare-protocol-tools.d.ts +4 -5
- package/dist/core/runner/prepare-protocol-tools.js +7 -7
- package/dist/core/runner/prepare-question-face.d.ts +4 -2
- package/dist/core/runner/prepare-run-refs.d.ts +7 -2
- package/dist/core/runner/prepare-run-refs.js +8 -7
- package/dist/core/runner/prepare-safety-scan.d.ts +4 -3
- package/dist/core/runner/prepare-suspend-saga.d.ts +3 -7
- package/dist/core/runner/prepare-suspend-saga.js +4 -3
- package/dist/core/runner/prepare-task.js +66 -53
- package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +3 -2
- package/dist/core/runner/prepare-tool-disclosure-mount.js +2 -1
- package/dist/core/runner/prepare-turn-wiring.d.ts +3 -1
- package/dist/core/runner/prepare-turn-wiring.js +1 -1
- package/dist/core/runner/prepare-wiring-manifest.d.ts +9 -4
- package/dist/core/runner/prepare-wiring-manifest.js +14 -6
- package/dist/core/runner/prepare-workspace-restore.d.ts +4 -4
- package/dist/core/runner/prepare-workspace-restore.js +15 -6
- package/dist/core/runner/remote-env-retry.d.ts +3 -3
- package/dist/core/runner/restore-seat.d.ts +41 -0
- package/dist/core/runner/restore-seat.js +38 -0
- package/dist/core/runner/resume-admission.js +1 -1
- package/dist/core/runner/resume-apply.js +4 -3
- package/dist/core/runner/resume-checkpoint-screen.js +2 -1
- package/dist/core/runner/resume-internals-and-config.js +2 -1
- package/dist/core/runner/resume-preflight.js +2 -1
- package/dist/core/runner/rewind-files.js +22 -6
- package/dist/core/runner/rule-store-unreadable-notice.d.ts +8 -0
- package/dist/core/runner/rule-store-unreadable-notice.js +11 -0
- package/dist/core/runner/run-brain-sinks.d.ts +3 -6
- package/dist/core/runner/run-brain-sinks.js +6 -6
- package/dist/core/runner/run-compaction-machinery.d.ts +2 -2
- package/dist/core/runner/run-git-lane.d.ts +2 -0
- package/dist/core/runner/run-git-lane.js +2 -1
- package/dist/core/runner/run-harness-handlers.js +5 -4
- package/dist/core/runner/run-identity-wiring.js +20 -12
- package/dist/core/runner/run-leg.js +31 -72
- package/dist/core/runner/run-notification-lane.d.ts +3 -0
- package/dist/core/runner/run-notification-lane.js +2 -4
- package/dist/core/runner/run-reasoning-seat.d.ts +5 -6
- package/dist/core/runner/run-reasoning-seat.js +13 -18
- package/dist/core/runner/run-settle-and-teardown.js +13 -9
- package/dist/core/runner/run-terminal-adoption.js +4 -8
- package/dist/core/runner/run-turn-boundary.js +6 -3
- package/dist/core/runner/runtask.d.ts +9 -4
- package/dist/core/runner/runtask.js +29 -22
- package/dist/core/runner/session-rule-policy.d.ts +11 -1
- package/dist/core/runner/shell-env-withheld.js +2 -7
- package/dist/core/runner/side-call-account.d.ts +5 -6
- package/dist/core/runner/side-call-account.js +2 -2
- package/dist/core/runner/stream-lifecycle-verbs.d.ts +3 -0
- package/dist/core/runner/stream-lifecycle-verbs.js +5 -3
- package/dist/core/runner/stream-settle-backstop.js +4 -6
- package/dist/core/runner/stream-steer-verb.d.ts +1 -1
- package/dist/core/runner/stream-steer-verb.js +4 -4
- package/dist/core/runner/sub-agent-deny-lists.d.ts +8 -3
- package/dist/core/runner/sub-agent-deny-lists.js +7 -4
- package/dist/core/runner/teardown-bounded.d.ts +7 -0
- package/dist/core/runner/teardown-bounded.js +7 -0
- package/dist/core/runner/terminal-account.js +41 -13
- package/dist/core/runner/terminal-projection.d.ts +1 -5
- package/dist/core/runner/tool-end-body.d.ts +9 -3
- package/dist/core/runner/tool-end-body.js +6 -3
- package/dist/core/runner/tool-output-projection.d.ts +13 -4
- package/dist/core/runner/tool-output-projection.js +10 -14
- package/dist/core/runner/turn-attachments.d.ts +3 -2
- package/dist/core/runner/turn-attachments.js +12 -5
- package/dist/core/runner-deps.d.ts +6 -6
- package/dist/core/runtime-caps.d.ts +2 -1
- package/dist/core/secret-env.d.ts +20 -3
- package/dist/core/secret-env.js +13 -15
- package/dist/core/session-checkout.d.ts +115 -15
- package/dist/core/session-checkout.js +435 -136
- package/dist/core/session-policy-store.js +21 -3
- package/dist/core/session-reconcile.js +1 -0
- package/dist/core/session-store.js +2 -0
- package/dist/core/session.d.ts +11 -1
- package/dist/core/shell-run-candidates.d.ts +1 -0
- package/dist/core/shell-run-candidates.js +1 -1
- package/dist/core/shutdown-debug.d.ts +6 -5
- package/dist/core/shutdown-debug.js +5 -1
- package/dist/core/skill-grant.js +4 -1
- package/dist/core/skills-directory.js +5 -3
- package/dist/core/spec-contract.d.ts +1 -1
- package/dist/core/store-contracts/checkpoint-store-contract.js +2 -7
- package/dist/core/store-contracts/file-history-store-contract.js +26 -2
- package/dist/core/store-contracts/session-deletion-cascade-contract.js +130 -14
- package/dist/core/store-contracts/task-list-store-contract.d.ts +2 -1
- package/dist/core/store-contracts/task-list-store-contract.js +28 -1
- package/dist/core/task-event.d.ts +48 -27
- package/dist/core/task-notification.d.ts +15 -9
- package/dist/core/task-notification.js +12 -0
- package/dist/core/task-registry-agent.d.ts +24 -22
- package/dist/core/task-registry-agent.js +65 -46
- package/dist/core/task-registry-shared.d.ts +17 -5
- package/dist/core/task-registry.d.ts +17 -6
- package/dist/core/task-registry.js +6 -1
- package/dist/core/task-result.d.ts +71 -25
- package/dist/core/task-spec-members.d.ts +0 -1
- package/dist/core/task-spec-members.js +1 -1
- package/dist/core/task-spec.d.ts +60 -52
- package/dist/core/task-stream.d.ts +45 -12
- package/dist/core/terminal-cause.d.ts +45 -8
- package/dist/core/terminal-cause.js +5 -0
- package/dist/core/tool-card-bound.d.ts +32 -0
- package/dist/core/tool-card-bound.js +33 -0
- package/dist/core/tool-catalog-entries.d.ts +9 -0
- package/dist/core/tool-catalog-entries.js +48 -0
- package/dist/core/tool-errors.d.ts +4 -3
- package/dist/core/tool-face.d.ts +3 -3
- package/dist/core/tool-mount-facts.d.ts +3 -2
- package/dist/core/tool-mount-facts.js +1 -1
- package/dist/core/tool-mount-static.js +7 -5
- package/dist/core/tool-policy.d.ts +21 -19
- package/dist/core/tool-policy.js +5 -6
- package/dist/core/tool-registry.d.ts +3 -1
- package/dist/core/tool-registry.js +15 -1
- package/dist/core/tool-result-store.d.ts +9 -3
- package/dist/core/tool-result-store.js +14 -1
- package/dist/core/tool-roster.d.ts +6 -0
- package/dist/core/tool-roster.js +18 -0
- package/dist/core/tool-spec.d.ts +17 -8
- package/dist/core/trace.d.ts +35 -31
- package/dist/core/types.d.ts +2 -2
- package/dist/core/untrusted-egress.d.ts +19 -7
- package/dist/core/untrusted-egress.js +26 -7
- package/dist/core/untrusted-text.d.ts +6 -18
- package/dist/core/untrusted-text.js +11 -4
- package/dist/core/user-attachment.d.ts +9 -6
- package/dist/core/user-attachment.js +12 -10
- package/dist/core/user-row-origin.d.ts +44 -25
- package/dist/core/user-row-origin.js +30 -20
- package/dist/core/wiring-manifest.d.ts +26 -7
- package/dist/core/wiring-manifest.js +14 -11
- package/dist/core/workspace-snapshot.d.ts +3 -1
- package/dist/core/workspace-snapshot.js +1 -0
- package/dist/engine/execution-env/node-execution-env.d.ts +23 -16
- package/dist/engine/execution-env/node-execution-env.js +127 -67
- package/dist/engine/harness/agent-harness.d.ts +4 -5
- package/dist/engine/harness/agent-harness.js +2 -7
- package/dist/engine/harness/types.d.ts +51 -19
- package/dist/engine/harness/types.js +28 -1
- package/dist/engine/llm/types.d.ts +26 -14
- package/dist/engine/llm/types.js +2 -2
- package/dist/engine/loop/agent-loop.d.ts +2 -2
- package/dist/engine/loop/agent-loop.js +51 -275
- package/dist/engine/loop/types.d.ts +0 -18
- package/dist/engine/session/import-validate.d.ts +3 -0
- package/dist/engine/session/import-validate.js +34 -2
- package/dist/engine/session/repo-utils.d.ts +42 -4
- package/dist/engine/session/repo-utils.js +33 -5
- package/dist/engine/session/session.d.ts +41 -14
- package/dist/engine/session/session.js +96 -25
- package/dist/index.d.ts +21 -16
- package/dist/index.js +16 -10
- package/dist/orchestration/run-spec.d.ts +1 -1
- package/dist/orchestration/run-workflow-tool.d.ts +12 -9
- package/dist/orchestration/run-workflow-tool.js +15 -19
- package/dist/orchestration/workflow-governance.js +13 -21
- package/dist/orchestration/workflow-observe.d.ts +4 -3
- package/dist/orchestration/workflow-primitives.d.ts +1 -1
- package/dist/orchestration/workflow-record-artifact.d.ts +14 -0
- package/dist/orchestration/workflow-record-artifact.js +32 -0
- package/dist/orchestration/workflow-script-store.d.ts +9 -0
- package/dist/orchestration/workflow-script-store.js +20 -1
- package/dist/orchestration/workflow-types.d.ts +33 -3
- package/dist/orchestration/workflow.d.ts +24 -14
- package/dist/orchestration/workflow.js +52 -23
- package/dist/prompt-assembly/artifact.js +4 -8
- package/dist/prompt-assembly/catalog/engine.d.ts +263 -0
- package/dist/prompt-assembly/catalog/engine.js +30 -0
- package/dist/prompt-assembly/catalog/index.d.ts +1 -1
- package/dist/prompt-assembly/catalog/index.js +2 -2
- package/dist/prompt-assembly/catalog/locales/zh-Hans/engine.d.ts +1 -1
- package/dist/prompt-assembly/catalog/locales/zh-Hans/engine.js +29 -0
- package/dist/prompt-assembly/epoch.js +6 -8
- package/dist/prompt-assembly/turn-snapshot.js +8 -9
- package/dist/stores/file/background-agent-store.js +5 -6
- package/dist/stores/file/checkpoint-store.d.ts +0 -4
- package/dist/stores/file/checkpoint-store.js +7 -3
- package/dist/stores/file/file-history-store.d.ts +8 -0
- package/dist/stores/file/file-history-store.js +72 -0
- package/dist/stores/file/fs-atomic.js +17 -12
- package/dist/stores/file/index.js +11 -5
- package/dist/stores/file/mailbox-store.js +13 -4
- package/dist/stores/file/permission-rule-store.js +14 -13
- package/dist/stores/file/shared-ledger.d.ts +4 -0
- package/dist/stores/file/shared-ledger.js +4 -0
- package/dist/stores/file/task-list-store.js +12 -3
- package/dist/stores/file/workflow-run-store.js +1 -0
- package/dist/tools/fs/bash-program-position.d.ts +4 -2
- package/dist/tools/fs/bash-program-position.js +1 -1
- package/dist/tools/fs/bash-readonly-classifier.js +1 -1
- package/dist/tools/fs/bound-open.d.ts +97 -0
- package/dist/tools/fs/bound-open.js +103 -0
- package/dist/tools/fs/containment-face.d.ts +2 -2
- package/dist/tools/fs/fs-pdf.d.ts +7 -1
- package/dist/tools/fs/fs-pdf.js +31 -23
- package/dist/tools/fs/fs-read.d.ts +24 -17
- package/dist/tools/fs/fs-read.js +84 -53
- package/dist/tools/fs/fs-shared.d.ts +14 -12
- package/dist/tools/fs/fs-shared.js +5 -4
- package/dist/tools/fs/fs-write.d.ts +2 -2
- package/dist/tools/fs/fs-write.js +20 -12
- package/dist/tools/fs/index.d.ts +4 -4
- package/dist/tools/fs/index.js +2 -2
- package/dist/tools/fs/notebook.d.ts +1 -1
- package/dist/tools/fs/pdf.d.ts +12 -3
- package/dist/tools/fs/pdf.js +22 -9
- package/dist/tools/fs/read-deny-home.d.ts +3 -2
- package/dist/tools/fs/read-deny-home.js +8 -11
- package/dist/tools/fs/safety.d.ts +3 -2
- package/dist/tools/fs/shell-read-check.js +10 -9
- package/dist/tools/monitor.d.ts +6 -5
- package/dist/tools/task-list.d.ts +16 -6
- package/dist/tools/task-list.js +4 -0
- package/dist/tools/web.d.ts +9 -1
- package/dist/tools/web.js +8 -3
- package/dist/tools/worktree.d.ts +7 -5
- package/dist/tools/worktree.js +4 -3
- package/package.json +4 -3
- package/test/export-surface.snapshot.json +93 -7
- package/wire-changes/core-stores-sql@7.67.3.json +39 -0
- package/wire-changes/core-stores-sql@7.68.0.json +39 -0
- package/wire-changes/core@7.67.3.json +65 -0
- package/wire-changes/core@7.68.0.json +4257 -0
- package/wire-changes/mods-kernel@7.67.3.json +39 -0
- package/wire-changes/mods-kernel@7.68.0.json +129 -0
- package/wire-changes/primitives@7.67.3.json +39 -0
- package/wire-changes/primitives@7.68.0.json +253 -0
- package/wire-changes/wiki-gate@7.67.3.json +39 -0
- package/wire-changes/wiki-gate@7.68.0.json +39 -0
- package/dist/core/runner/credential-origin-seat.d.ts +0 -2
- package/dist/core/runner/credential-origin-seat.js +0 -20
|
@@ -2,16 +2,16 @@ import { constants as fsConstants, fstatSync, lstatSync, mkdirSync, readdirSync,
|
|
|
2
2
|
import { createHash, randomUUID } from "node:crypto";
|
|
3
3
|
import { dirname, join, relative } from "node:path";
|
|
4
4
|
import { canonicalJsonStringify } from "../canonical-json.js";
|
|
5
|
-
import { openExclusiveTemp } from "../exclusive-temp.js";
|
|
5
|
+
import { PRIVATE_FILE_MODE, openExclusiveTemp } from "../exclusive-temp.js";
|
|
6
6
|
import { jaccardDistance, termSet } from "../memory-vector.js";
|
|
7
7
|
import { MAX_MEMORY_BYTES } from "../memory.js";
|
|
8
8
|
import { inlineUntrusted } from "../untrusted-text.js";
|
|
9
|
-
import { ambiguousOriginRepresentation, committedDistilledOf, committedOriginOf, computeEntryRev, distilledEquals, entryFromFile, isValidEntryId, originEquals, parseEntryFile, serializeEntryFile } from "./frontmatter.js";
|
|
9
|
+
import { ambiguousOriginRepresentation, committedDistilledOf, committedOriginOf, computeEntryRev, distilledEquals, entryFromFile, isValidEntryId, originEquals, parseEntryFile, revOfText, serializeEntryFile } from "./frontmatter.js";
|
|
10
10
|
import { convertV1SidecarKeys } from "./delegation-settlement.js";
|
|
11
11
|
import { eraseOriginClearanceCustody } from "./origin-clearance.js";
|
|
12
12
|
import { layerObservationLookup, observedDivergenceNotice } from "./layer-observations.js";
|
|
13
13
|
import { DEFAULT_MAX_ENTRY_DEPTH, MEMORY_INDEX_FILENAME, carriesEntry, scanEntryFiles } from "./entry-scan.js";
|
|
14
|
-
import { ControlPlaneCorruptError, CURSORS_FILE, STRICT_CONTROL_PLANE_LEDGERS, fileGovernanceDocOf, importReceiptName, appendChallengeEvents, atomicWriteFileSync, clearContainedPath, eraseQuarantineCopies, captureAndClearLineageForEntries, adoptRootScopeLayout, anchorStoreRoot, effectiveControlRootOf, ensureDirExists, LEDGER_FILE, sayAnnounceFailure, enqueueMemoryAnnouncement, importLatchTxnId, importLineageCommitted, importSessionPollution, isContainedIn, lockedStrictUpdate, readStrictSidecar, permissionRemedyOf, withPermissionRemedy, lineageContributionsOfSession, listSessionPollution, readChallengeEvents, readLineageRecord, registerScope, registeredScopes, releaseImportLatch, layoutNeedsAdoption, scopeDirFor, scopeDirName, scopeRegistryShape, stageImportLatch, landsOutsideStore, storeActRefusal,
|
|
14
|
+
import { ControlPlaneCorruptError, CURSORS_FILE, STRICT_CONTROL_PLANE_LEDGERS, fileGovernanceDocOf, importReceiptName, appendChallengeEvents, atomicWriteFileSync, clearContainedPath, restoreContainedBaseline, eraseQuarantineCopies, captureAndClearLineageForEntries, adoptRootScopeLayout, anchorStoreRoot, effectiveControlRootOf, ensureDirExists, LEDGER_FILE, sayAnnounceFailure, enqueueMemoryAnnouncement, importLatchTxnId, importLineageCommitted, importSessionPollution, isContainedIn, lockedStrictUpdate, readStoreIdentity, readStrictSidecar, STORE_IDENTITY_FILE, permissionRemedyOf, withPermissionRemedy, lineageContributionsOfSession, listSessionPollution, readChallengeEvents, readLineageRecord, registerScope, registeredScopes, releaseImportLatch, layoutNeedsAdoption, scopeDirFor, scopeDirName, scopeRegistryShape, stageImportLatch, landsOutsideStore, storeActRefusal, storeRootReanchoredRefusal, writeAllSync, STORE_JOURNAL_FILE, ERASURE_SWEEP_RECORD_FILE, ERASURE_SWEEP_RECORD_WHAT, coerceErasureSweepRecord, erasureSweepOwedAt, erasureSweepRecordPathOf, STORE_TXN_LOCK_DIR, TXN_LOCK_STALE_MS, acquireStoreTxnLock, assertStoreTxnLockOwnership, renewStoreTxnLock, tryStoreTxnLock, } from "./layout.js";
|
|
15
15
|
import { screenInboundEntries } from "./data-plane.js";
|
|
16
16
|
import { CONSOLIDATION_DRIVER_PLANS_DIR, CONSOLIDATION_PLANS_DIR, fileGovernanceStore, standingControlObjectsOf } from "./consolidation.js";
|
|
17
17
|
import { captureIntoFileQuarantine, fileControlObjectFaultCode, getFileControlObject, probeControlPlaneLinks, standingFileControlObjectNames } from "./control-objects.js";
|
|
@@ -19,6 +19,7 @@ import { canonicalExpectedScopes, expectedScopesInvalid, firstOutsideExpectedSco
|
|
|
19
19
|
import { scanMemoryFileName, scanMemoryWrite } from "./scan.js";
|
|
20
20
|
import { admittingLandings, cutPerLanding, LandingsNeedAdmission, requireLandingsAdmitted } from "./landing-admission.js";
|
|
21
21
|
import { thrownText } from "../thrown-value.js";
|
|
22
|
+
import { deliverEngineNotice } from "../engine-notice.js";
|
|
22
23
|
import { optionKeys, receiveOptions } from "../own-property-receipt.js";
|
|
23
24
|
export { DEFAULT_MAX_ENTRY_DEPTH, MEMORY_INDEX_FILENAME, scanEntryFiles } from "./entry-scan.js";
|
|
24
25
|
export const ERASURE_CARRIER_CLASSES = Object.freeze(["projection", "shadow", "indexLine", "quarantineCopy", "clearanceCustody", "planArchive", "planWorkbook", "evidenceBinding", "backendDerived"]);
|
|
@@ -175,7 +176,6 @@ const LEDGER_SCHEMA_VERSION = 2;
|
|
|
175
176
|
const TRANSFERS_FILE = "transfers.jsonl";
|
|
176
177
|
const CHAIN_DEGRADED_FILE = "transfers.chain-degraded.json";
|
|
177
178
|
const SHADOW_DIR = "shadow";
|
|
178
|
-
const STORE_IDENTITY_FILE = "store-identity.json";
|
|
179
179
|
function rowsRev(rows, id) {
|
|
180
180
|
return rows[id]?.rev;
|
|
181
181
|
}
|
|
@@ -624,6 +624,7 @@ export class FileMemoryEngineBackend {
|
|
|
624
624
|
exportFaceProbe;
|
|
625
625
|
deletedIdsDigest;
|
|
626
626
|
inboundFindings = [];
|
|
627
|
+
inboundRestoreWithheld = [];
|
|
627
628
|
batchScan;
|
|
628
629
|
constructor(dir, opts = {}) {
|
|
629
630
|
const o = receiveOptions(opts, "FileMemoryEngineBackend", FILE_MEMORY_ENGINE_BACKEND_OPTION_KEYS);
|
|
@@ -706,6 +707,11 @@ export class FileMemoryEngineBackend {
|
|
|
706
707
|
this.inboundFindings = [];
|
|
707
708
|
return out;
|
|
708
709
|
}
|
|
710
|
+
drainInboundRestoreWithheld() {
|
|
711
|
+
const out = this.inboundRestoreWithheld;
|
|
712
|
+
this.inboundRestoreWithheld = [];
|
|
713
|
+
return out;
|
|
714
|
+
}
|
|
709
715
|
readCommittedShadow(id) {
|
|
710
716
|
const path = join(this.controlPlaneRoot, LEDGER_FILE);
|
|
711
717
|
const raw = readControlFileOrAbsent(path, "committed-rev ledger");
|
|
@@ -815,7 +821,7 @@ export class FileMemoryEngineBackend {
|
|
|
815
821
|
const text = `memory store notice names no single scope, so it was kept off every session's memory notices: ${items.join(" | ")}`;
|
|
816
822
|
const sink = this.onIncident;
|
|
817
823
|
if (sink === undefined) {
|
|
818
|
-
|
|
824
|
+
deliverEngineNotice(undefined, { code: "memory.notice_unscoped", message: `[sema] ${text}`, detail: { stage: "store notice" } });
|
|
819
825
|
return;
|
|
820
826
|
}
|
|
821
827
|
try {
|
|
@@ -1470,7 +1476,7 @@ export class FileMemoryEngineBackend {
|
|
|
1470
1476
|
assertRootAnchored(expected) {
|
|
1471
1477
|
const root = anchorStoreRoot(this.directoryRoot, this.controlPlaneRoot, { onIncident: this.onIncident, now: this.now });
|
|
1472
1478
|
if (expected !== undefined && expected !== root)
|
|
1473
|
-
throw
|
|
1479
|
+
throw storeRootReanchoredRefusal(this.directoryRoot, { controlDir: this.controlPlaneRoot, recorded: root, now: expected });
|
|
1474
1480
|
return root;
|
|
1475
1481
|
}
|
|
1476
1482
|
sweepStagedFiles() {
|
|
@@ -1509,12 +1515,10 @@ export class FileMemoryEngineBackend {
|
|
|
1509
1515
|
const shadowText = committed !== undefined ? this.shadowBytes(entryId) : undefined;
|
|
1510
1516
|
let restoredShadow = false;
|
|
1511
1517
|
if (shadowText !== undefined) {
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
catch {
|
|
1517
|
-
}
|
|
1518
|
+
const put = restoreContainedBaseline(absPath, shadowText, q.leftOnPlane, PRIVATE_FILE_MODE);
|
|
1519
|
+
restoredShadow = put === "written";
|
|
1520
|
+
if (put === "kept")
|
|
1521
|
+
this.inboundRestoreWithheld.push({ path: finding.path, entryId, rev: revOfText(shadowText, entryId) });
|
|
1518
1522
|
}
|
|
1519
1523
|
if (q.detail !== undefined || (!q.removed && !restoredShadow)) {
|
|
1520
1524
|
const contained = q.removed || restoredShadow;
|
|
@@ -3135,23 +3139,9 @@ export class FileMemoryEngineBackend {
|
|
|
3135
3139
|
static EXPORT_INCOMPLETE = "memory.export_incomplete";
|
|
3136
3140
|
storeIdentityLocked() {
|
|
3137
3141
|
const path = join(this.controlPlaneRoot, STORE_IDENTITY_FILE);
|
|
3138
|
-
const
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
parsed = JSON.parse(raw);
|
|
3142
|
-
}
|
|
3143
|
-
catch {
|
|
3144
|
-
throw new ControlPlaneCorruptError(`store identity is unparseable: ${path}`);
|
|
3145
|
-
}
|
|
3146
|
-
const rec = parsed;
|
|
3147
|
-
if (!rec || typeof rec !== "object" || rec.v !== 1 || typeof rec.storeId !== "string" || rec.storeId.length === 0) {
|
|
3148
|
-
throw new ControlPlaneCorruptError(`store identity has the wrong shape: ${path}`);
|
|
3149
|
-
}
|
|
3150
|
-
return rec.storeId;
|
|
3151
|
-
};
|
|
3152
|
-
const raw = readControlFileOrAbsent(path, "store identity");
|
|
3153
|
-
if (raw !== undefined)
|
|
3154
|
-
return parse(raw);
|
|
3142
|
+
const recorded = readStoreIdentity(this.controlPlaneRoot);
|
|
3143
|
+
if (recorded !== undefined)
|
|
3144
|
+
return recorded;
|
|
3155
3145
|
const storeId = randomUUID();
|
|
3156
3146
|
let fd;
|
|
3157
3147
|
try {
|
|
@@ -3159,10 +3149,10 @@ export class FileMemoryEngineBackend {
|
|
|
3159
3149
|
}
|
|
3160
3150
|
catch (err) {
|
|
3161
3151
|
if (err.code === "EEXIST") {
|
|
3162
|
-
const again =
|
|
3152
|
+
const again = readStoreIdentity(this.controlPlaneRoot);
|
|
3163
3153
|
if (again === undefined)
|
|
3164
3154
|
throw new ControlPlaneCorruptError(`store identity vanished between its EEXIST and the re-read: ${path}`);
|
|
3165
|
-
return
|
|
3155
|
+
return again;
|
|
3166
3156
|
}
|
|
3167
3157
|
throw err;
|
|
3168
3158
|
}
|
|
@@ -138,5 +138,7 @@ export declare function distilledEquals(a: MemoryEntryDistilled | undefined, b:
|
|
|
138
138
|
* (already-copied) frontmatter; returns true ⇔ anything was stripped.
|
|
139
139
|
*/
|
|
140
140
|
export declare function stripModelWrittenDistilled(fm: MemoryEntryFrontmatter): boolean;
|
|
141
|
+
/** The rev of a file's text under the entry id `id` (the rev {@link entryFromFile} gives that text). */
|
|
142
|
+
export declare function revOfText(text: string, id: string): string;
|
|
141
143
|
/** Parse a file's text directly into a full MemoryEntry (id must already be present/decided). */
|
|
142
144
|
export declare function entryFromFile(text: string, id: string, slug: string, scope: string): MemoryEntry;
|
|
@@ -442,6 +442,10 @@ export function stripModelWrittenDistilled(fm) {
|
|
|
442
442
|
}
|
|
443
443
|
return stripped;
|
|
444
444
|
}
|
|
445
|
+
export function revOfText(text, id) {
|
|
446
|
+
const parsed = parseEntryFile(text);
|
|
447
|
+
return computeEntryRev({ id, frontmatter: parsed.frontmatter, body: parsed.body });
|
|
448
|
+
}
|
|
445
449
|
export function entryFromFile(text, id, slug, scope) {
|
|
446
450
|
const parsed = parseEntryFile(text);
|
|
447
451
|
const entry = { id, slug, frontmatter: parsed.frontmatter, body: parsed.body, rev: "", scope };
|
|
@@ -99,7 +99,15 @@ export declare function lookupProjectIdHint(configRoot: string, repoRoot: string
|
|
|
99
99
|
* in-repo, the control plane still lives here (model-invisible, not injected, not in-repo) — and
|
|
100
100
|
* keyed RESOLVE-ONLY, because the key input is a directory the model's file channel may be able to
|
|
101
101
|
* replace: see {@link deriveDirKey} for why canonicalizing it is a redirect handle.
|
|
102
|
-
* The repo-partition face has its own sibling mint, {@link deriveRepoControlPlaneDir}.
|
|
102
|
+
* The repo-partition face has its own sibling mint, {@link deriveRepoControlPlaneDir}.
|
|
103
|
+
*
|
|
104
|
+
* @contract memory.control_plane.key — the control plane of a directory-pinned memory store is `<config root>/<key>/.engine`, the
|
|
105
|
+
* key being the memory directory's absolute path, slugged: one formula for every build, so every build that opens a directory
|
|
106
|
+
* opens the same plane. An engine root moved by its operator carries its planes along, each still keyed by the path its directory
|
|
107
|
+
* had; the open of a directory under the root finds the plane that travelled with it and moves it onto the key its path has now
|
|
108
|
+
* ({@link adoptPlaneMovedWithRoot}), where its root anchor judges the open as for any moved store. None found ⇒ a new plane, said
|
|
109
|
+
* once when the directory already holds memory (`memory.control_plane_new_over_memory`); more than one ⇒ refused
|
|
110
|
+
* (`memory.control_plane_split`). */
|
|
103
111
|
export declare function deriveControlPlaneDir(configRoot: string, key: string): string;
|
|
104
112
|
/** B3 — the REPO-partition control plane: the sibling of {@link deriveRepoMemoryDir} under the SAME
|
|
105
113
|
* canonical repo key. Paired on purpose: {@link adoptLegacyRepoDirs} adopts the repo partition as ONE
|
|
@@ -113,7 +121,11 @@ export declare function deriveRepoControlPlaneDir(configRoot: string, repoRoot:
|
|
|
113
121
|
* store's root anchor is read from is the plane it was written to. A backend that pins its own control
|
|
114
122
|
* plane (`pinnedBy.controlPlaneRoot` — the file backend) wins, else the explicit `controlDir`, else the
|
|
115
123
|
* derivation off the config root ({@link deriveControlPlaneDir}) — preceded by the one-shot move of a plane
|
|
116
|
-
* minted under the canonical key ({@link adoptCanonicalKeyedControlDir}), which is why that arm is not pure.
|
|
124
|
+
* minted under the canonical key ({@link adoptCanonicalKeyedControlDir}), which is why that arm is not pure. Both the
|
|
125
|
+
* explicit arm and the derived one look for the plane that travelled with a moved engine root ({@link adoptPlaneMovedWithRoot})
|
|
126
|
+
* when the plane they answer IS the derivation for `dir` — the explicit `controlDir` recomputed from its own config root and
|
|
127
|
+
* compared, never read from its name — so a host that pins the derivation it computed (a service's local file engine) is
|
|
128
|
+
* served like the default.
|
|
117
129
|
*/
|
|
118
130
|
export declare function effectiveControlRootOf(dir: string, opts?: {
|
|
119
131
|
controlDir?: string;
|
|
@@ -279,9 +291,9 @@ export declare const canonicalize: typeof physicalPathOfExisting;
|
|
|
279
291
|
/** True iff `child` (canonicalized) is `root` or inside it. */
|
|
280
292
|
export declare function isContainedIn(root: string, child: string): boolean;
|
|
281
293
|
/** The codes the store's physical form refuses an act with — the whole family, one closed set: {@link TARGET_OUTSIDE_STORE},
|
|
282
|
-
* {@link SCOPE_HOME_NOT_DIRECTORY}, {@link CONTROL_PLANE_LINKS_UNSUPPORTED}, {@link CONTROL_PLANE_STRAYS}
|
|
283
|
-
* `detail` ({@link StoreFormRefusalDetail}). */
|
|
284
|
-
export declare const STORE_FORM_REFUSAL_CODES: readonly ["memory.target_outside_store", "memory.scope_home_not_directory", "memory.control_plane_links_unsupported", "memory.control_plane_strays", "memory.store_root_sensitive"];
|
|
294
|
+
* {@link SCOPE_HOME_NOT_DIRECTORY}, {@link CONTROL_PLANE_LINKS_UNSUPPORTED}, {@link CONTROL_PLANE_STRAYS}, {@link STORE_ROOT_SENSITIVE} and
|
|
295
|
+
* {@link CONTROL_PLANE_SPLIT}. Each is a plain `Error` carrying `code` and a `detail` ({@link StoreFormRefusalDetail}). */
|
|
296
|
+
export declare const STORE_FORM_REFUSAL_CODES: readonly ["memory.target_outside_store", "memory.scope_home_not_directory", "memory.control_plane_links_unsupported", "memory.control_plane_strays", "memory.store_root_sensitive", "memory.control_plane_split"];
|
|
285
297
|
export type StoreFormRefusalCode = (typeof STORE_FORM_REFUSAL_CODES)[number];
|
|
286
298
|
/** The code an act on a store path is refused with when it would land outside the store ({@link landsOutsideStore}). */
|
|
287
299
|
export declare const TARGET_OUTSIDE_STORE = "memory.target_outside_store";
|
|
@@ -297,6 +309,10 @@ export declare const CONTROL_PLANE_STRAYS = "memory.control_plane_strays";
|
|
|
297
309
|
/** The code a store root (or the control plane beside it) that lies inside a path the write guard protects is refused with, before anything is
|
|
298
310
|
* created there ({@link assertStoreRootsNotSensitive}): a library written under `~/.ssh` is a library an escalation vector holds. */
|
|
299
311
|
export declare const STORE_ROOT_SENSITIVE = "memory.store_root_sensitive";
|
|
312
|
+
/** The code an open is refused with when the store's control plane stands in more than one place since its engine root moved
|
|
313
|
+
* ({@link controlPlaneSplitRefusal}): more than one plane travelled for it, or the one that travelled and the one at its key now
|
|
314
|
+
* both hold a record of one name with different contents. */
|
|
315
|
+
export declare const CONTROL_PLANE_SPLIT = "memory.control_plane_split";
|
|
300
316
|
/** What a scope home can be besides a real directory (an `lstat` verdict). */
|
|
301
317
|
export declare const SCOPE_HOME_FORMS: readonly ["symlink", "file", "other"];
|
|
302
318
|
export type ScopeHomeForm = (typeof SCOPE_HOME_FORMS)[number];
|
|
@@ -307,16 +323,26 @@ declare const SCOPE_HOME_FORM_PHRASE: {
|
|
|
307
323
|
readonly other: "a special file";
|
|
308
324
|
};
|
|
309
325
|
export type HomeFormPhraseCoversEveryForm = AssertAllKeysHandled<Exclude<ScopeHomeForm, keyof typeof SCOPE_HOME_FORM_PHRASE>>;
|
|
326
|
+
/** Why a {@link TARGET_OUTSIDE_STORE} refusal refused — one word per seat, given where the refusal is minted: `act_outside`, an act's
|
|
327
|
+
* target resolves outside the store ({@link storeActRefusal}); `root_moved`, the store root resolves to another directory than the one
|
|
328
|
+
* its anchor records ({@link storeRootMovedRefusal}); `root_gone`, nothing stands at the root the anchor records
|
|
329
|
+
* ({@link storeRootAbsentRefusal}); `root_reanchored`, the store was re-anchored after the session acting on it opened it
|
|
330
|
+
* ({@link storeRootReanchoredRefusal}). */
|
|
331
|
+
export declare const TARGET_OUTSIDE_STORE_REASONS: readonly ["act_outside", "root_moved", "root_gone", "root_reanchored"];
|
|
332
|
+
export type TargetOutsideStoreReason = (typeof TARGET_OUTSIDE_STORE_REASONS)[number];
|
|
310
333
|
/** What a store-form refusal carries beside its sentence. Host paths live here and never in the sentence (on
|
|
311
334
|
* {@link CONTROL_PLANE_LINKS_UNSUPPORTED}, `path` is the control plane);
|
|
312
|
-
* `form` is present on {@link SCOPE_HOME_NOT_DIRECTORY} only; `
|
|
313
|
-
*
|
|
314
|
-
*
|
|
315
|
-
*
|
|
335
|
+
* `form` is present on {@link SCOPE_HOME_NOT_DIRECTORY} only; `outsideReason` is present on every {@link TARGET_OUTSIDE_STORE}
|
|
336
|
+
* refusal and only there, and says which of its cases it is ({@link TARGET_OUTSIDE_STORE_REASONS}); `controlDir`, `recorded` and `now`
|
|
337
|
+
* are data on every one of those but `act_outside`: the control plane whose root anchor refused (the `controlDir` to hand
|
|
338
|
+
* {@link reanchorMemoryStoreRoot}), the physical root the anchor records (spelled as the anchor records it: what a caller hands back
|
|
339
|
+
* as the re-anchor's `expectedFrom`), and where the root resolves now (for `root_reanchored`, the root the session opened);
|
|
340
|
+
* `row` and `of` are present on {@link STORE_ROOT_SENSITIVE} only: the table row the root lands on
|
|
316
341
|
* (a pattern of the write guard's list, as written) and which root it is (`path` is that root's spelling). */
|
|
317
342
|
export type StoreFormRefusalDetail = {
|
|
318
343
|
readonly path: string;
|
|
319
344
|
readonly form?: ScopeHomeForm;
|
|
345
|
+
readonly outsideReason?: TargetOutsideStoreReason;
|
|
320
346
|
readonly controlDir?: string;
|
|
321
347
|
readonly recorded?: string;
|
|
322
348
|
readonly now?: string;
|
|
@@ -333,17 +359,39 @@ export type StoreFormRefusal = Error & {
|
|
|
333
359
|
code: StoreFormRefusalCode;
|
|
334
360
|
detail: StoreFormRefusalDetail;
|
|
335
361
|
};
|
|
362
|
+
/** A store-form refusal as read off a thrown value: its code, and for {@link TARGET_OUTSIDE_STORE} the case its seat named. */
|
|
363
|
+
export type StoreFormRefusalReading = {
|
|
364
|
+
readonly code: Exclude<StoreFormRefusalCode, typeof TARGET_OUTSIDE_STORE>;
|
|
365
|
+
} | {
|
|
366
|
+
readonly code: typeof TARGET_OUTSIDE_STORE;
|
|
367
|
+
readonly outsideReason: TargetOutsideStoreReason;
|
|
368
|
+
};
|
|
369
|
+
/** The one reading of the family off a thrown value, beside its one mint (a hostile accessor reads as absent): a member's code, with —
|
|
370
|
+
* for {@link TARGET_OUTSIDE_STORE} — its `detail.outsideReason`, which every seat of that code gives; `undefined` for any other value,
|
|
371
|
+
* that code without one of its words included (no seat of the family makes it). */
|
|
372
|
+
export declare function storeFormRefusalReadingOf(thrown: unknown): StoreFormRefusalReading | undefined;
|
|
336
373
|
/** Seat 1 — an act the store's physical form refuses: `act` names what was refused (no path), `path` is the
|
|
337
374
|
* target whose directory resolves outside the store ({@link landsOutsideStore}). */
|
|
338
375
|
export declare function storeActRefusal(act: string, path: string): StoreFormRefusal;
|
|
339
376
|
/** Seat 2 — the store root no longer resolves to the physical root its control plane's anchor records
|
|
340
|
-
* ({@link anchorStoreRoot}); `path` is the root's spelling. The remedy names its
|
|
341
|
-
* `detail`
|
|
377
|
+
* ({@link anchorStoreRoot}) and the store holds memory; `path` is the root's spelling. The remedy names its
|
|
378
|
+
* arguments by what they are — never by a `detail` key, which a caller handed the sentence alone does not have —
|
|
379
|
+
* so the sentence stays path-free and says the step a person takes. */
|
|
342
380
|
export declare function storeRootMovedRefusal(path: string, anchor: {
|
|
343
381
|
controlDir: string;
|
|
344
382
|
recorded: string;
|
|
345
383
|
now: string;
|
|
346
384
|
}): StoreFormRefusal;
|
|
385
|
+
/** Seat 2, re-anchored under a session: the store's anchor records another root than the one the session acting on it opened (for the
|
|
386
|
+
* file backend's commit, the root its caller says the session opened) — the store was re-anchored since
|
|
387
|
+
* ({@link reanchorMemoryStoreRoot}), so the session names a tree the store no longer has. The sentence states that mismatch, not the
|
|
388
|
+
* history behind it; the remedy is a new session (it opens the store where it is anchored now) and the store itself needs nothing.
|
|
389
|
+
* `recorded` is the anchored root, `now` the root the session opened. */
|
|
390
|
+
export declare function storeRootReanchoredRefusal(path: string, anchor: {
|
|
391
|
+
controlDir: string;
|
|
392
|
+
recorded: string;
|
|
393
|
+
now: string;
|
|
394
|
+
}): StoreFormRefusal;
|
|
347
395
|
/** Seat 2, the root gone: the anchored root no longer exists while its control plane holds a store's account
|
|
348
396
|
* ({@link anchorStoreRoot}). A missing root lands where it would be created — the recorded one — so only
|
|
349
397
|
* its absence tells a store moved away (or deleted) from one never opened; the root is not re-created. */
|
|
@@ -368,6 +416,14 @@ export declare function controlPlaneStraysRefusal(path: string, strays: {
|
|
|
368
416
|
readonly docs: readonly string[];
|
|
369
417
|
readonly objects: Readonly<Record<string, number>>;
|
|
370
418
|
}): StoreFormRefusal;
|
|
419
|
+
/** Seat 7 — the control plane of the store at `path` stands in more than one place under the memory engine root since the root moved
|
|
420
|
+
* ({@link adoptPlaneMovedWithRoot}): `planes` names the key directories; `documents` is empty when more than one plane travelled for
|
|
421
|
+
* the store, else it names the records (paths under a plane) the plane at the store's key now and the one that travelled both hold
|
|
422
|
+
* with different contents. The sentence names key directories and records, never a host path or a `detail` member. */
|
|
423
|
+
export declare function controlPlaneSplitRefusal(path: string, split: {
|
|
424
|
+
readonly planes: readonly string[];
|
|
425
|
+
readonly documents: readonly string[];
|
|
426
|
+
}): StoreFormRefusal;
|
|
371
427
|
/** Where an act at `p` lands: the physical path of its normalized spelling (the spelling a child path
|
|
372
428
|
* joined under it carries), a MISSING tail rejoined under the deepest existing directory (what the act
|
|
373
429
|
* creates) — a dangling link on that tail followed to where it points (what the act would create through
|
|
@@ -426,9 +482,13 @@ export interface AnchorStoreRootOptions {
|
|
|
426
482
|
* THE store-root check, run by every opener (a file backend's construction, an engine's mount) and at the
|
|
427
483
|
* head of every face that acts on the store: where the root `dir` physically resolves NOW, against the
|
|
428
484
|
* anchor its control plane records. Equal ⇒ the anchored root, the one every act at a store path is judged
|
|
429
|
-
* against. Unequal ⇒ {@link storeRootMovedRefusal}; equal but the root gone while the control plane holds a
|
|
485
|
+
* against. Unequal ⇒ {@link storeRootMovedRefusal} while the mount holds a record; equal but the root gone while the control plane holds a
|
|
430
486
|
* store ⇒ {@link storeRootAbsentRefusal} — both thrown before anything in the store is written or the root is
|
|
431
|
-
* created (only the anchor answers where the root is; a `mkdir` in its place does not).
|
|
487
|
+
* created (only the anchor answers where the root is; a `mkdir` in its place does not). Unequal over a mount that holds no
|
|
488
|
+
* record (an open's or a read's residue: the anchor, the registry, empty directories — the root of an engine root moved by
|
|
489
|
+
* its operator, say) while nothing stands any more at the root the anchor records (the store moved away whole; a root
|
|
490
|
+
* re-pointed while its old directory stands is refused as before) ⇒ nothing is guarded, so the root is recorded where it resolves now, under the anchor's lock, and
|
|
491
|
+
* `memory.root_anchor_rerecorded` says which root the anchor had named. No anchor ⇒ {@link absentAnchorReading}, decided under the anchor's lock (a racing opener
|
|
432
492
|
* that recorded it first is judged against): a control plane holding nothing creates the root and records
|
|
433
493
|
* it; one already holding a store backfills it and discloses `memory.root_anchor_backfilled` (its root may
|
|
434
494
|
* already have been re-pointed — undecidable, said). Nothing is kept between calls: the anchor is read every
|
|
@@ -528,10 +588,17 @@ export declare function erasureSweepOwedAt(file: ErasureSweepRecordFile, storeRo
|
|
|
528
588
|
* is refused while the control plane owes anything at the recorded root ({@link rootBoundObligationOf}: a
|
|
529
589
|
* committed transaction pending recovery — its journal names paths under the recorded root and is replayed
|
|
530
590
|
* there first, never carried over). Every live holder judges against the new anchor at its next face.
|
|
591
|
+
* `opts.expectedFrom` is the root the caller confirmed the store moved from — a refusal's `detail.recorded`, handed back as it
|
|
592
|
+
* came: compared character for character, under the anchor's lock and before the re-anchor writes, with the physical root the
|
|
593
|
+
* anchor records; another root, or an anchor that is absent or cannot be read, refuses (`config.memory_reanchor`) and records
|
|
594
|
+
* nothing, so the store a person confirmed is the store re-anchored. Finding the control plane comes first and is an open's own step
|
|
595
|
+
* either way (a plane that travelled with a moved root is brought to its key, {@link effectiveControlRootOf}), so the anchor compared is
|
|
596
|
+
* the one every opener reads. Without it, a damaged anchor is replaced like any other.
|
|
531
597
|
* Discloses `memory.root_reanchored` on `opts.onIncident`.
|
|
532
598
|
*/
|
|
533
599
|
export declare function reanchorMemoryStoreRoot(dir: string, opts?: {
|
|
534
600
|
controlDir?: string;
|
|
601
|
+
expectedFrom?: string;
|
|
535
602
|
onIncident?: MemoryPartitionIncidentSink;
|
|
536
603
|
}): Promise<StoreRootReanchor>;
|
|
537
604
|
/** The one remedy every surfaced permission refusal carries — `undefined` unless `err` is a write
|
|
@@ -654,7 +721,7 @@ export declare function dropStagingSecondNames(seat: string, opened: {
|
|
|
654
721
|
/**
|
|
655
722
|
* The ONE way a committed baseline goes back after {@link clearContainedPath} emptied its seat —
|
|
656
723
|
* the inverse half of that function, beside it so the removal word and its readers stay in one module.
|
|
657
|
-
*
|
|
724
|
+
* Every containment arm calls it — the engine's and the backend's inbound gate — and
|
|
658
725
|
* the rule is ONE sentence: THE RESTORE MAY ONLY OVERWRITE WHAT THE CONTAINMENT ITSELF LEFT AT THE PATH.
|
|
659
726
|
* The removal's own account of what it left (`leftOnPlane` — nothing, our tombstone, or the suspect
|
|
660
727
|
* bytes) is re-read and compared immediately before the write, through a read that refuses a link, a
|
|
@@ -667,8 +734,11 @@ export declare function dropStagingSecondNames(seat: string, opened: {
|
|
|
667
734
|
* Declining never weakens containment. Where the suspect bytes were removed they are already in
|
|
668
735
|
* quarantine; where they were NOT, the only way the comparison fails is that somebody replaced them —
|
|
669
736
|
* which took them off the plane as surely as the removal would have.
|
|
737
|
+
*
|
|
738
|
+
* `mode` is the bits a freed path is created with — the caller's own projection mode; a file the
|
|
739
|
+
* containment left in place keeps its own.
|
|
670
740
|
*/
|
|
671
|
-
export declare function restoreContainedBaseline(path: string, committed: string, leftOnPlane: string | undefined): "written" | "kept" | "failed";
|
|
741
|
+
export declare function restoreContainedBaseline(path: string, committed: string, leftOnPlane: string | undefined, mode?: number): "written" | "kept" | "failed";
|
|
672
742
|
/** What keeping one suspect file's copy came to: the name its copy is kept under among the governance store's
|
|
673
743
|
* `quarantine` objects, or why no copy could be kept. */
|
|
674
744
|
export type QuarantineCapture = {
|
|
@@ -773,13 +843,23 @@ export declare const LINK_PROBE_PREFIX = ".link-probe-";
|
|
|
773
843
|
* and the store's transaction lock) rename a crashed holder's lock to it before removing it. One spelling for both
|
|
774
844
|
* steals and for {@link STORE_OPEN_ARTIFACTS}. */
|
|
775
845
|
export declare const LOCK_TOMB_INFIX = ".stale-";
|
|
846
|
+
/** The control-plane file holding a File store's durable identity (`{ v: 1, storeId }`) — minted exclusively on the
|
|
847
|
+
* first READ that needs one, the export faces (the snapshot composite and the governance slice): a bundle names the
|
|
848
|
+
* store it came from, an empty one too. One spelling for the mint, for {@link readStoreIdentity} and for
|
|
849
|
+
* {@link STORE_OPEN_ARTIFACTS}. */
|
|
850
|
+
export declare const STORE_IDENTITY_FILE = "store-identity.json";
|
|
851
|
+
/** The store identity recorded in `controlDir`, or `undefined` when nothing stands there. A file that cannot be read, is
|
|
852
|
+
* not JSON or is out of shape throws {@link ControlPlaneCorruptError} (a bad identity is never read as "none" — that
|
|
853
|
+
* would mint a second one). The one reader of the file: the export faces and the store-set census read it alike. */
|
|
854
|
+
export declare function readStoreIdentity(controlDir: string): string | undefined;
|
|
776
855
|
/**
|
|
777
856
|
* The named artifacts of a File store's mount — the files an OPEN or a READ of the store may leave there, by place
|
|
778
857
|
* and exact name (or fixed prefix); the list the contract `memory.deployment.store_set` names. Opening anchors the
|
|
779
858
|
* root (the anchor, written through a temporary file under its lock) and tries one hard link between two dot-files at
|
|
780
859
|
* the control plane's top level, removed before the open answers (#3512); a read registers the scope it reads (the
|
|
781
860
|
* registry and its commit journal, under the registry's lock); a refused request or a recovery takes the store's
|
|
782
|
-
* transaction lock; a lock found stale is stolen through a tombstone;
|
|
861
|
+
* transaction lock; a lock found stale is stolen through a tombstone; an export mints the store's identity on its first
|
|
862
|
+
* need ({@link STORE_IDENTITY_FILE}); a registration of two labels that differ only
|
|
783
863
|
* in letter case probes the volume with a dot-file at the memory directory's top level — on any volume, folding or not,
|
|
784
864
|
* and only while the process holds no verdict for that directory's identity (`dirCaseFolds`).
|
|
785
865
|
* - control plane, top level, a file: one of `files`, or a name starting with one of `filePrefixes`;
|
|
@@ -787,8 +867,9 @@ export declare const LOCK_TOMB_INFIX = ".stale-";
|
|
|
787
867
|
* - memory directory, top level, a file: a name starting with one of `memoryFilePrefixes`.
|
|
788
868
|
* Nothing is matched at another depth or by another pattern: a record's name may begin with these spellings (a
|
|
789
869
|
* capture opt-out record is named after its session id, and `.tmp-x` is a session id), so a pattern below the top
|
|
790
|
-
* level would hide it. The anchor, the registry and its journal are artifacts as an open or a read
|
|
791
|
-
* ({@link namedArtifactFault}). The list is a promise a host's assertions read: a change to it
|
|
870
|
+
* level would hide it. The anchor, the registry and its journal and the identity are artifacts as an open or a read
|
|
871
|
+
* leaves them, whole ({@link namedArtifactFault}). The list is a promise a host's assertions read: a change to it
|
|
872
|
+
* carries its reason with it.
|
|
792
873
|
*/
|
|
793
874
|
export declare const STORE_OPEN_ARTIFACTS: Readonly<{
|
|
794
875
|
files: readonly string[];
|
|
@@ -806,8 +887,8 @@ export declare function isStoreOpenArtifact(where: "control" | "memory", rel: re
|
|
|
806
887
|
* least one file that is not named (a ledger, an evidence row, an entry, a capture record). A directory that cannot
|
|
807
888
|
* be read — any failure but absence; a link that leads nowhere, at it or above it, is no absence — counts as holding
|
|
808
889
|
* one: a store may be there, and opening it says what is; so does a named artifact that stands but cannot be read as
|
|
809
|
-
* what it is (the root anchor, the scope registry or its journal that is a link, not a regular
|
|
810
|
-
* JSON or out of shape — an open or a read leaves them whole; see {@link namedArtifactFault}). Read from the disk at each call. This answers "does a store live on this mount"; whether a root must stay guarded
|
|
890
|
+
* what it is (the root anchor, the scope registry or its journal, the store identity that is a link, not a regular
|
|
891
|
+
* file, unreadable, not JSON or out of shape — an open or a read leaves them whole; see {@link namedArtifactFault}). Read from the disk at each call. This answers "does a store live on this mount"; whether a root must stay guarded
|
|
811
892
|
* by its anchor is {@link controlPlaneHoldsStore}'s question.
|
|
812
893
|
*/
|
|
813
894
|
export declare function storeHoldsRecord(memoryDir: string, controlDir: string): boolean;
|
|
@@ -1276,6 +1357,19 @@ export declare function reconcileLineage(docs: MemoryGovernanceDocs): Promise<{
|
|
|
1276
1357
|
* is {@link releaseImportLatch}'s hard precondition and the idempotent re-import's short-circuit
|
|
1277
1358
|
* credential. */
|
|
1278
1359
|
export declare const IMPORT_RECEIPTS_DIR = "import-receipts";
|
|
1360
|
+
/** Where the File store keeps each kind of control object: a directory under its control plane (`control-objects.ts` keeps the objects;
|
|
1361
|
+
* a plane that travelled with a moved root is merged by these names, {@link isOneTimeRecord}). */
|
|
1362
|
+
export declare const FILE_CONTROL_OBJECT_DIRS: Readonly<{
|
|
1363
|
+
pollution: string;
|
|
1364
|
+
"import-receipt": string;
|
|
1365
|
+
quarantine: string;
|
|
1366
|
+
hold: string;
|
|
1367
|
+
"clearance-custody": string;
|
|
1368
|
+
capture: string;
|
|
1369
|
+
}>;
|
|
1370
|
+
/** Where a File store stages an object's bytes before publishing them under the object's name. Never a kind's
|
|
1371
|
+
* directory: a listing of a kind answers published names only. */
|
|
1372
|
+
export declare const CONTROL_OBJECT_STAGE_DIR = ".control-object-stage";
|
|
1279
1373
|
/** The lineage txn id of a bundle import's synthetic latch (ONE latch per bundle — a re-import of
|
|
1280
1374
|
* the same bundle re-stages the same txn id, which is what makes the latch idempotent). */
|
|
1281
1375
|
export declare function importLatchTxnId(bundleHash: string): string;
|