@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,6 +2,8 @@ import { createHash, randomBytes } from "node:crypto";
|
|
|
2
2
|
import { appendFileSync, closeSync, existsSync, fsyncSync, openSync, readdirSync, readFileSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { thrownText } from "../../core/thrown-value.js";
|
|
5
|
+
import { readUnreadableDeleteId } from "../../core/session.js";
|
|
6
|
+
import { readFileHistoryScope } from "../../engine/session/repo-utils.js";
|
|
5
7
|
import { applyFileRestoreViaEnv, boundaryPublishVerdict, worldStillMatchesMint, annulProofFailure, captureFileBackupViaEnv, modeProvenDifferent, previewFileDelta, describeTrackKey, fileHistoryExportDigest, caughtFault, DAMAGED_RECORD, resolveTrackKey, trackKeyOf, validateFileHistoryExport, } from "../../core/file-history-store.js";
|
|
6
8
|
import { fileHistoryBoundariesToKeep, resolveFileHistoryRetention } from "../../core/file-history-retention.js";
|
|
7
9
|
import { atomicWriteFile, ensureDir, sanitizePathComponent, sanitizeScope, writeThenLink } from "./fs-atomic.js";
|
|
@@ -970,6 +972,76 @@ export class FileFileHistoryStore {
|
|
|
970
972
|
throw new Error(`file history scope "${scope}" is erased but its blobs are not: ${kept}`);
|
|
971
973
|
return removed;
|
|
972
974
|
}
|
|
975
|
+
async deleteUnreadableSessionHistory(sessionId) {
|
|
976
|
+
const id = readUnreadableDeleteId("FileHistoryStore.deleteUnreadableSessionHistory", sessionId);
|
|
977
|
+
const owned = new Set([...this.writers.keys()].filter((scope) => readFileHistoryScope(scope)?.sessionId === id));
|
|
978
|
+
for (const scope of this.scopeNamesOnDisk())
|
|
979
|
+
if (readFileHistoryScope(scope)?.sessionId === id)
|
|
980
|
+
owned.add(scope);
|
|
981
|
+
const busy = [...owned].find((scope) => this.writers.has(scope));
|
|
982
|
+
if (busy !== undefined)
|
|
983
|
+
return this.deleteBySession(busy);
|
|
984
|
+
let removed = 0;
|
|
985
|
+
for (const scope of owned)
|
|
986
|
+
removed += await this.deleteBySession(scope);
|
|
987
|
+
if (owned.size === 0) {
|
|
988
|
+
const kept = this.collectBlobs();
|
|
989
|
+
if (kept !== undefined)
|
|
990
|
+
throw new Error(`file history of session "${id}" holds no scope, but the blobs are not collected: ${kept}`);
|
|
991
|
+
}
|
|
992
|
+
return removed;
|
|
993
|
+
}
|
|
994
|
+
scopeNamesOnDisk() {
|
|
995
|
+
let names;
|
|
996
|
+
try {
|
|
997
|
+
names = readdirSync(this.scopesDir);
|
|
998
|
+
}
|
|
999
|
+
catch (err) {
|
|
1000
|
+
if (err.code === "ENOENT")
|
|
1001
|
+
return [];
|
|
1002
|
+
throw new Error(`file history scope root ${this.scopesDir} could not be read (${err.code ?? thrownText(err)}) — no scope was erased`);
|
|
1003
|
+
}
|
|
1004
|
+
const out = [];
|
|
1005
|
+
for (const name of names) {
|
|
1006
|
+
if (name.includes("."))
|
|
1007
|
+
continue;
|
|
1008
|
+
const sdir = join(this.scopesDir, name);
|
|
1009
|
+
const unjudged = (why) => new Error(`file history scope directory ${sdir} names no scope this store can read (${why}) — no scope was erased`);
|
|
1010
|
+
try {
|
|
1011
|
+
if (!statSync(sdir).isDirectory())
|
|
1012
|
+
continue;
|
|
1013
|
+
}
|
|
1014
|
+
catch (err) {
|
|
1015
|
+
if (err.code === "ENOENT")
|
|
1016
|
+
continue;
|
|
1017
|
+
throw unjudged(err.code ?? thrownText(err));
|
|
1018
|
+
}
|
|
1019
|
+
let scope;
|
|
1020
|
+
try {
|
|
1021
|
+
scope = parseJsonRecord(readFileSync(join(sdir, "tracked.json"), "utf8"))?.scope;
|
|
1022
|
+
}
|
|
1023
|
+
catch (err) {
|
|
1024
|
+
if (err.code !== "ENOENT")
|
|
1025
|
+
throw unjudged(err.code ?? thrownText(err));
|
|
1026
|
+
let committed;
|
|
1027
|
+
try {
|
|
1028
|
+
committed = readdirSync(join(sdir, "boundaries"));
|
|
1029
|
+
}
|
|
1030
|
+
catch (cause) {
|
|
1031
|
+
if (cause.code === "ENOENT")
|
|
1032
|
+
continue;
|
|
1033
|
+
throw unjudged(cause.code ?? thrownText(cause));
|
|
1034
|
+
}
|
|
1035
|
+
if (committed.length === 0)
|
|
1036
|
+
continue;
|
|
1037
|
+
throw unjudged("its tracked set is missing beside a boundary");
|
|
1038
|
+
}
|
|
1039
|
+
if (typeof scope !== "string" || sanitizeScope(scope) !== name)
|
|
1040
|
+
throw unjudged(`its tracked set records ${typeof scope === "string" ? "another directory's scope" : "no scope"}`);
|
|
1041
|
+
out.push(scope);
|
|
1042
|
+
}
|
|
1043
|
+
return out;
|
|
1044
|
+
}
|
|
973
1045
|
collectBlobs() {
|
|
974
1046
|
const live = new Set();
|
|
975
1047
|
let complete = true;
|
|
@@ -8,6 +8,7 @@ import { physicalPathOf, physicalPathOfExisting } from "../../core/physical-path
|
|
|
8
8
|
import { processCensus, processFingerprint, uncheckableProcessText, } from "../../core/process-identity.js";
|
|
9
9
|
export { processFingerprint, isProcessLive } from "../../core/process-identity.js";
|
|
10
10
|
import { thrownText } from "../../core/thrown-value.js";
|
|
11
|
+
import { deliverEngineNotice } from "../../core/engine-notice.js";
|
|
11
12
|
const SAFE_COMPONENT = /^[A-Za-z0-9_.-]+$/;
|
|
12
13
|
export function sanitizePathComponent(raw) {
|
|
13
14
|
if (raw === "" || raw === "." || raw === ".." || !SAFE_COMPONENT.test(raw)) {
|
|
@@ -412,12 +413,12 @@ function repairJsonlTail(path) {
|
|
|
412
413
|
}
|
|
413
414
|
if (segment.unjudgeable) {
|
|
414
415
|
appendFileSync(path, "\n");
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
}
|
|
416
|
+
deliverEngineNotice(undefined, {
|
|
417
|
+
code: "store.tail_segment_unjudged",
|
|
418
|
+
message: `[sema] file store: a tail segment larger than the judgeable bound (${JSONL_TAIL_SEGMENT_LIMIT} bytes) was ended as a line, not judged — ` +
|
|
419
|
+
`${path}. Its bytes are untouched; a reader meets it as an ordinary line.`,
|
|
420
|
+
detail: { path },
|
|
421
|
+
});
|
|
421
422
|
return;
|
|
422
423
|
}
|
|
423
424
|
if (segment.bytes.length === 0)
|
|
@@ -692,12 +693,16 @@ export function acquireStoreDirLock(dir, opts) {
|
|
|
692
693
|
heldStoreDirLocks.delete(key);
|
|
693
694
|
return;
|
|
694
695
|
}
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
`
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
696
|
+
deliverEngineNotice(undefined, {
|
|
697
|
+
code: "store.lock_retained",
|
|
698
|
+
message: `[sema] file store: the ${opts.label} directory fence at ${lockPath} could not be handed back — the ` +
|
|
699
|
+
`removal could not be proven, so a lock file naming this live process (pid ${process.pid}) may still ` +
|
|
700
|
+
`be there. While it is, another process opening that directory is refused by name; the next open of ` +
|
|
701
|
+
`it in THIS process finishes the cleanup or refuses by name. After this process exits the file is ` +
|
|
702
|
+
`reclaimed as a stale lock ONLY if it is readable and its directory writable — otherwise it has to ` +
|
|
703
|
+
`be removed by hand.`,
|
|
704
|
+
detail: { lock: "directory_fence", path: lockPath, pid: process.pid },
|
|
705
|
+
});
|
|
701
706
|
},
|
|
702
707
|
};
|
|
703
708
|
};
|
|
@@ -17,6 +17,7 @@ import { FileFileHistoryStore } from "./file-history-store.js";
|
|
|
17
17
|
import { readMountedToolNames } from "../../core/session-policy-store.js";
|
|
18
18
|
import { optionKeys, receiptRefusal, receiveMembers, receiveOptions, refuseStrayMembers } from "../../core/own-property-receipt.js";
|
|
19
19
|
import { describeRejectedValue } from "../../core/tool-search-setting.js";
|
|
20
|
+
import { deliverEngineNotice } from "../../core/engine-notice.js";
|
|
20
21
|
import { receiveFileHistoryRetention } from "../../core/file-history-retention.js";
|
|
21
22
|
import { readRetentionDeclaration } from "../../core/retention.js";
|
|
22
23
|
function nestedOptions(value, member, keys) {
|
|
@@ -137,11 +138,16 @@ export class FileStorageBackend {
|
|
|
137
138
|
}
|
|
138
139
|
}
|
|
139
140
|
discloseRetainedBootLock() {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
`
|
|
144
|
-
|
|
141
|
+
const lockPath = join(this.root, "LOCK");
|
|
142
|
+
deliverEngineNotice(undefined, {
|
|
143
|
+
code: "store.lock_retained",
|
|
144
|
+
message: `[sema] file store: this backend could not hand back its boot lock at ${lockPath} — the ` +
|
|
145
|
+
`removal could not be proven, so a lock file naming this live process (pid ${process.pid}) may still be ` +
|
|
146
|
+
`there. While it is, another process opening this data root is refused by name; a later open of this root ` +
|
|
147
|
+
`in THIS process finishes the cleanup or refuses by name. After this process exits the file is reclaimed ` +
|
|
148
|
+
`as a stale lock ONLY if it is readable and its directory writable — otherwise it has to be removed by hand.`,
|
|
149
|
+
detail: { lock: "boot", path: lockPath, pid: process.pid },
|
|
150
|
+
});
|
|
145
151
|
}
|
|
146
152
|
async dispose() {
|
|
147
153
|
try {
|
|
@@ -11,6 +11,7 @@ import { physicalPathOf } from "../../core/physical-path.js";
|
|
|
11
11
|
import { assertAdoptionBootGate } from "./adoption/marker.js";
|
|
12
12
|
import { optionKeys, receiveOptions } from "../../core/own-property-receipt.js";
|
|
13
13
|
import { readLedgerTuning } from "./ledger-tuning.js";
|
|
14
|
+
import { deliverEngineNotice } from "../../core/engine-notice.js";
|
|
14
15
|
function diskMarkOf(path) {
|
|
15
16
|
try {
|
|
16
17
|
const st = statSync(path);
|
|
@@ -144,8 +145,12 @@ export async function acquireMailboxBoxLock(lockPath, waitMs) {
|
|
|
144
145
|
now = readLockOwner(lockPath);
|
|
145
146
|
if (now === "unobservable") {
|
|
146
147
|
abandonedLockNonces.add(mine.nonce);
|
|
147
|
-
|
|
148
|
-
|
|
148
|
+
deliverEngineNotice(undefined, {
|
|
149
|
+
code: "store.lock_retained",
|
|
150
|
+
message: `[sema] file mailbox: the box lock ${lockPath} could not be read back at release (a read fault); it is kept and still names this live process (pid ${process.pid}). ` +
|
|
151
|
+
`This process reclaims it at its next use of the box; another process waits on it and times out naming this pid until then.`,
|
|
152
|
+
detail: { lock: "mailbox", path: lockPath, pid: process.pid },
|
|
153
|
+
});
|
|
149
154
|
return;
|
|
150
155
|
}
|
|
151
156
|
if (now === undefined || now === "unreadable" || now.nonce !== mine.nonce) {
|
|
@@ -168,8 +173,12 @@ export async function acquireMailboxBoxLock(lockPath, waitMs) {
|
|
|
168
173
|
}
|
|
169
174
|
catch {
|
|
170
175
|
abandonedLockNonces.add(mine.nonce);
|
|
171
|
-
|
|
172
|
-
|
|
176
|
+
deliverEngineNotice(undefined, {
|
|
177
|
+
code: "store.lock_retained",
|
|
178
|
+
message: `[sema] file mailbox: the box lock ${lockPath} could not be handed back (${first.message}); it still names this live process (pid ${process.pid}). ` +
|
|
179
|
+
`This process reclaims it at its next use of the box; another process waits on it and times out naming this pid until then.`,
|
|
180
|
+
detail: { lock: "mailbox", path: lockPath, pid: process.pid },
|
|
181
|
+
});
|
|
173
182
|
}
|
|
174
183
|
}
|
|
175
184
|
};
|
|
@@ -8,7 +8,7 @@ import { principalNameFault, principalNameOf, readPrincipal } from "../../core/p
|
|
|
8
8
|
import { PERMISSION_RULES_DAMAGED_BUCKET_CODE, PERMISSION_RULES_LATER_GRAMMAR_CODE, PERMISSION_RULES_UNREADABLE_BUCKET_CODE, PERMISSION_RULE_WRITER, applySyncJoin, applyTombstones, assertDeleteDeltaCarriesNoAdd, assertRedemptionNotQuarantined, assertWriteDeltaScopeDurable, foldDelta, unknownRuleWriteDeltaError, } from "../../core/permission-rule-store.js";
|
|
9
9
|
import { sameOrgPolicyContent } from "../../core/permission-rule-org.js";
|
|
10
10
|
import { SESSION_RULES_GRAMMAR, readRuleGrammarStamp } from "../../core/session-policy-store.js";
|
|
11
|
-
import { canonicalize } from "../../core/canonical-json.js";
|
|
11
|
+
import { canonicalize, textContentHashOf } from "../../core/canonical-json.js";
|
|
12
12
|
import { BootLock, FileStoreLockError, uncheckableOwnerClause } from "./fs-atomic.js";
|
|
13
13
|
import { assertAdoptionBootGate } from "./adoption/marker.js";
|
|
14
14
|
import { CONFIG_RECEIPT_MODE, optionKeys, receiptRefusal, receiveMembers, receiveOptions } from "../../core/own-property-receipt.js";
|
|
@@ -59,7 +59,7 @@ function judgeRuleAdoptionFile(dir) {
|
|
|
59
59
|
catch (err) {
|
|
60
60
|
if (err?.code === "ENOENT")
|
|
61
61
|
return { marker: undefined };
|
|
62
|
-
return { corrupt: `could not be read (${err?.code ?? err?.name ?? "unknown"})`, detail: thrownText(err) };
|
|
62
|
+
return { corrupt: `could not be read (${err?.code ?? err?.name ?? "unknown"})`, detail: thrownText(err), readFailure: err };
|
|
63
63
|
}
|
|
64
64
|
let parsed;
|
|
65
65
|
try {
|
|
@@ -135,34 +135,34 @@ function atomicPublish(dir, file, payload) {
|
|
|
135
135
|
}
|
|
136
136
|
const EMPTY_READ = { rules: [], tombstones: [], rev: 0 };
|
|
137
137
|
function checksumOf(body) {
|
|
138
|
-
return
|
|
138
|
+
return textContentHashOf(canonicalize(body));
|
|
139
139
|
}
|
|
140
140
|
function unsafeDirFault(dir, vetting) {
|
|
141
141
|
mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
142
142
|
const st = lstatSync(dir);
|
|
143
143
|
if (st.isSymbolicLink() || !st.isDirectory())
|
|
144
|
-
return "is a symlink or not a directory";
|
|
144
|
+
return { text: "is a symlink or not a directory" };
|
|
145
145
|
if (typeof process.getuid === "function" && st.uid !== process.getuid())
|
|
146
|
-
return "is owned by another user";
|
|
146
|
+
return { text: "is owned by another user", unsafe: "owner" };
|
|
147
147
|
if (!posixModeBitsMeaningful(vetting?.platform)) {
|
|
148
148
|
vetting?.modeBitsUnjudged?.(dir);
|
|
149
149
|
return undefined;
|
|
150
150
|
}
|
|
151
151
|
if ((st.mode & 0o022) !== 0)
|
|
152
|
-
return `is writable by group or others (mode ${(st.mode & 0o777).toString(8)}) — anyone who can write there can grant themselves permissions
|
|
152
|
+
return { text: `is writable by group or others (mode ${(st.mode & 0o777).toString(8)}) — anyone who can write there can grant themselves permissions`, unsafe: "permissions" };
|
|
153
153
|
return undefined;
|
|
154
154
|
}
|
|
155
155
|
function assertSafeDir(dir) {
|
|
156
156
|
const fault = unsafeDirFault(dir);
|
|
157
157
|
if (fault !== undefined)
|
|
158
|
-
throw new Error(`permission-rule store directory ${dir} ${fault}; refusing to use it`);
|
|
158
|
+
throw new Error(`permission-rule store directory ${dir} ${fault.text}; refusing to use it`);
|
|
159
159
|
}
|
|
160
160
|
function refusalText(onError, sentence, location) {
|
|
161
161
|
discloseTo(onError, `${sentence} (at ${location})`);
|
|
162
162
|
return `${sentence}. The location is reported to the store's error disclosure (onError), not in this message.`;
|
|
163
163
|
}
|
|
164
164
|
function unreadableError(r, sentence = r.unreadable) {
|
|
165
|
-
return Object.assign(new Error(sentence), { code: r.code, ...(r.errno !== undefined ? { errno: r.errno } : {}) });
|
|
165
|
+
return Object.assign(new Error(sentence), { code: r.code, ...(r.errno !== undefined ? { errno: r.errno } : {}), ...(r.unsafe !== undefined ? { unsafe: r.unsafe } : {}) });
|
|
166
166
|
}
|
|
167
167
|
function errnoOf(err) {
|
|
168
168
|
const code = err?.code;
|
|
@@ -195,7 +195,7 @@ function assertSafeDirAtRequest(dir, onError, act, vetting) {
|
|
|
195
195
|
throw unreadableError(systemFaultRefusal(onError, err, `the permission-rule store directory could not be examined (${err?.code ?? err?.name ?? "unknown"}); refusing to ${act} it`, `${dir}: ${thrownText(err)}`));
|
|
196
196
|
}
|
|
197
197
|
if (fault !== undefined)
|
|
198
|
-
throw unreadableError({ unreadable: refusalText(onError, `the permission-rule store directory ${fault}; refusing to ${act} it`, dir), code: PERMISSION_RULES_DAMAGED_BUCKET_CODE });
|
|
198
|
+
throw unreadableError({ unreadable: refusalText(onError, `the permission-rule store directory ${fault.text}; refusing to ${act} it`, dir), code: PERMISSION_RULES_DAMAGED_BUCKET_CODE, ...(fault.unsafe !== undefined ? { unsafe: fault.unsafe } : {}) });
|
|
199
199
|
}
|
|
200
200
|
function writerLockRefusal(err, onError) {
|
|
201
201
|
let sentence;
|
|
@@ -251,7 +251,7 @@ class FileDurableRulePartition {
|
|
|
251
251
|
try {
|
|
252
252
|
const dirFault = unsafeDirFault(this.dir, this.vetting);
|
|
253
253
|
if (dirFault !== undefined)
|
|
254
|
-
return unreadable(`the permission-rule store directory ${dirFault}; loading zero rules`, this.dir);
|
|
254
|
+
return { ...unreadable(`the permission-rule store directory ${dirFault.text}; loading zero rules`, this.dir), ...(dirFault.unsafe !== undefined ? { unsafe: dirFault.unsafe } : {}) };
|
|
255
255
|
const st = lstatSync(this.file);
|
|
256
256
|
if (st.isSymbolicLink() || !st.isFile())
|
|
257
257
|
return unreadable(`${bucket} is a symlink or not a regular file; refusing to load any rule from it`);
|
|
@@ -562,7 +562,8 @@ export class FileDurableRulePartitionProvider {
|
|
|
562
562
|
const judged = judgeRuleAdoptionFile(this.dir);
|
|
563
563
|
if ("corrupt" in judged) {
|
|
564
564
|
const location = `${join(this.dir, ADOPTION_FILE)}${judged.detail !== undefined ? `: ${judged.detail}` : ""}`;
|
|
565
|
-
|
|
565
|
+
const sentence = `the permission-rule store's adoption marker ${judged.corrupt}; refusing to resolve whose bucket this is until it is repaired`;
|
|
566
|
+
throw unreadableError("readFailure" in judged ? systemFaultRefusal(this.onError, judged.readFailure, sentence, location) : { unreadable: refusalText(this.onError, sentence, location), code: PERMISSION_RULES_DAMAGED_BUCKET_CODE });
|
|
566
567
|
}
|
|
567
568
|
return judged.marker;
|
|
568
569
|
}
|
|
@@ -653,7 +654,7 @@ export class FileDurableRulePartitionProvider {
|
|
|
653
654
|
throw faulted(err, "examined");
|
|
654
655
|
}
|
|
655
656
|
if (dirFault !== undefined) {
|
|
656
|
-
throw unreadableError({ unreadable: refusalText(this.onError, `the permission-rule store directory ${dirFault}; refusing to list its buckets`, this.dir), code: PERMISSION_RULES_DAMAGED_BUCKET_CODE });
|
|
657
|
+
throw unreadableError({ unreadable: refusalText(this.onError, `the permission-rule store directory ${dirFault.text}; refusing to list its buckets`, this.dir), code: PERMISSION_RULES_DAMAGED_BUCKET_CODE, ...(dirFault.unsafe !== undefined ? { unsafe: dirFault.unsafe } : {}) });
|
|
657
658
|
}
|
|
658
659
|
const adoption = this.adoptionMarker();
|
|
659
660
|
const rec = adoption === undefined ? undefined : "adopted" in adoption ? adoption.adopted : adoption.marker;
|
|
@@ -707,7 +708,7 @@ class FileOrgRuleStatePersistence {
|
|
|
707
708
|
return refuse(`the permission-rule store directory ${ioFault(err)}`, `${this.dir}: ${thrownText(err)}`);
|
|
708
709
|
}
|
|
709
710
|
if (dirFault !== undefined)
|
|
710
|
-
return refuse(`the permission-rule store directory ${dirFault}`, this.dir);
|
|
711
|
+
return refuse(`the permission-rule store directory ${dirFault.text}`, this.dir);
|
|
711
712
|
const unreadable = (err) => {
|
|
712
713
|
if (err?.code === "ENOENT")
|
|
713
714
|
return undefined;
|
|
@@ -175,6 +175,10 @@ export declare class LedgerCore<Row, Ev> {
|
|
|
175
175
|
* second process, so it is refused at the same door rather than trusted to caller discipline.
|
|
176
176
|
*/
|
|
177
177
|
compact(): void;
|
|
178
|
+
/** A deletion verb ends here so the deleted rows' earlier events leave the disk: with any event pending the directory is compacted
|
|
179
|
+
* now, and a failure throws (bytes still on disk = not deleted). The next call ending here compacts again — the repeat, for the run
|
|
180
|
+
* and checkpoint deletions that select by session; the store's next `delete` of any row, for the background-agent store. */
|
|
181
|
+
settleErasure(): void;
|
|
178
182
|
/** Drop one instance's share. The LAST holder evicts the authority — identity-checked, so a stale
|
|
179
183
|
* holder can never revoke a REBUILT entry — retires it (see {@link compact}) and closes the append fd. */
|
|
180
184
|
release(): void;
|
|
@@ -99,6 +99,10 @@ export class LedgerCore {
|
|
|
99
99
|
atomicWriteFile(this.paths.tmpDir, this.paths.ledgerPath, "");
|
|
100
100
|
this.events = 0;
|
|
101
101
|
}
|
|
102
|
+
settleErasure() {
|
|
103
|
+
if (this.events > 0)
|
|
104
|
+
this.compact();
|
|
105
|
+
}
|
|
102
106
|
release() {
|
|
103
107
|
this.refs -= 1;
|
|
104
108
|
if (this.refs > 0)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { join, resolve } from "node:path";
|
|
2
|
-
import { readFileSync } from "node:fs";
|
|
3
|
-
import { admitTaskListItem, listStoredTaskListEntry, readStoredTaskListItem } from "../../tools/task-list.js";
|
|
2
|
+
import { readFileSync, unlinkSync } from "node:fs";
|
|
3
|
+
import { admitTaskListItem, compareTaskIds, listStoredTaskListEntry, readStoredTaskListItem } from "../../tools/task-list.js";
|
|
4
4
|
import { canonicalStoreKey, atomicWriteFile, ensureDir } from "./fs-atomic.js";
|
|
5
5
|
import { assertAdoptionBootGate } from "./adoption/marker.js";
|
|
6
6
|
import { guardCorruptSink } from "./corrupt-read-sink.js";
|
|
@@ -60,7 +60,7 @@ export function createFileTaskListStore(root, opts) {
|
|
|
60
60
|
return snap(readStoredTaskListItem(doc.tasks[id], id, discloseEntry));
|
|
61
61
|
};
|
|
62
62
|
const discloseEntry = (reason) => disclose?.({ kind: "file", path, reason });
|
|
63
|
-
const listOf = (doc) => Object.entries(doc.tasks).map(([id, t]) => {
|
|
63
|
+
const listOf = (doc) => Object.entries(doc.tasks).sort(([a], [b]) => compareTaskIds(a, b)).map(([id, t]) => {
|
|
64
64
|
const entry = listStoredTaskListEntry(t, id, discloseEntry);
|
|
65
65
|
return "rowVerdict" in entry ? entry : snap(entry);
|
|
66
66
|
});
|
|
@@ -110,6 +110,15 @@ export function createFileTaskListStore(root, opts) {
|
|
|
110
110
|
save(doc);
|
|
111
111
|
return id;
|
|
112
112
|
}),
|
|
113
|
+
drop: () => locked(() => {
|
|
114
|
+
try {
|
|
115
|
+
unlinkSync(path);
|
|
116
|
+
}
|
|
117
|
+
catch (err) {
|
|
118
|
+
if (err.code !== "ENOENT")
|
|
119
|
+
throw err;
|
|
120
|
+
}
|
|
121
|
+
}),
|
|
113
122
|
mutate: (fn) => lockedOn(() => fn(raw)),
|
|
114
123
|
};
|
|
115
124
|
}
|
|
@@ -10,8 +10,10 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import { SHELL_CONTROL_PREFIXES, type LexedWord } from "../../shell/lex.js";
|
|
12
12
|
/** The verdict every unresolvable / out-of-root / unbounded finding ends on. The findings differ in what
|
|
13
|
-
* they found; the consequence is one consequence, and a copy that drifts reads as a second rule.
|
|
14
|
-
|
|
13
|
+
* they found; the consequence is one consequence, and a copy that drifts reads as a second rule. It says what
|
|
14
|
+
* happens to the call in words true on every face that reads it — the approval card, a refusal, the read-only seat's own
|
|
15
|
+
* refusal — rather than what one face does next: it is not let through on its own. */
|
|
16
|
+
export declare const NOT_AUTO_ALLOWED = "\u2014 so it is not allowed through automatically";
|
|
15
17
|
/** argv[0] as the program bash will resolve it: `/usr/bin/cat` and `cat` are one name. */
|
|
16
18
|
export declare function programBasename(word: string): string;
|
|
17
19
|
/** A launcher's own `NAME=value` operand (`env`, `sudo`): any `=`-bearing non-option word, read DEQUOTED — the launcher's
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SHELL_CONTROL_PREFIXES, argvOf, lexShellText } from "../../shell/lex.js";
|
|
2
2
|
import { shellWordsOf } from "../../shell/shell-words.js";
|
|
3
3
|
import { BLOCK_WORD_NAMES, feedsArgvFromStdin, launcherOptionMovesBase, launcherOptionQueries, launcherOptionStep, launcherRunsShell, programRow, selectedOptions, streamDefaultProgram } from "./program-read-model.js";
|
|
4
|
-
export const NOT_AUTO_ALLOWED = "— not
|
|
4
|
+
export const NOT_AUTO_ALLOWED = "— so it is not allowed through automatically";
|
|
5
5
|
export function programBasename(word) {
|
|
6
6
|
return word.includes("/") ? (word.split("/").pop() ?? word) : word;
|
|
7
7
|
}
|
|
@@ -98,7 +98,7 @@ export function parseLeadingCommandName(command, options) {
|
|
|
98
98
|
return { name: first };
|
|
99
99
|
}
|
|
100
100
|
export function readOnlyRefusalSentence(cause) {
|
|
101
|
-
return cause.kind === "unlisted" ? `command "${cause.program}" is not
|
|
101
|
+
return cause.kind === "unlisted" ? `command "${cause.program}" is not on the list of read-only commands` : `option "${cause.option}" is not one of the read-only options of "${cause.program}"`;
|
|
102
102
|
}
|
|
103
103
|
export function unlistedReaderSentence(program) {
|
|
104
104
|
return readOnlyRefusalSentence({ kind: "unlisted", program });
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import type { ExecutionEnv } from "../../internal/harness-types.js";
|
|
2
|
+
import { FileError, type BoundFileObject, type Result } from "../../internal/harness.js";
|
|
3
|
+
/**
|
|
4
|
+
* What binding a read to a judged key came to — the ONE reading of an environment's `openBound` answer, shared by every
|
|
5
|
+
* reader that judges an object and then reads that same object (the file reader behind a user attachment, the plan file's
|
|
6
|
+
* reader, the LSP session's read gate and its target facts):
|
|
7
|
+
*
|
|
8
|
+
* - `bound` — the object, opened at the key; the reader reads only from it and closes it.
|
|
9
|
+
* - `unbindable` — this environment cannot bind a read on this target: it has no `openBound`, or it answers `not_supported`.
|
|
10
|
+
* The two are one fact, the method's absence on the target, and every reader treats it as absence (its own no-binding
|
|
11
|
+
* disposition).
|
|
12
|
+
* - `refused` — the environment answered, and the answer is no (`precondition_failed`, `not_found`, `invalid`, any other
|
|
13
|
+
* code): the object is not there to read, or is not the one that was judged. No code but `not_supported` ever falls
|
|
14
|
+
* back to the no-binding disposition. An answer outside the contract is this too, with the code `unknown`: a member that
|
|
15
|
+
* is not a function (an adapter without types may hold `null`) or that cannot be read, a call that throws or rejects, a
|
|
16
|
+
* value that is no result (no `ok`, an `ok` without an object, a failure without a code). No reader meets an exception
|
|
17
|
+
* from the reading, and the object was not shown to be the judged one.
|
|
18
|
+
*/
|
|
19
|
+
export type BoundOpening = {
|
|
20
|
+
readonly kind: "bound";
|
|
21
|
+
readonly object: BoundFileObject;
|
|
22
|
+
} | {
|
|
23
|
+
readonly kind: "unbindable";
|
|
24
|
+
} | {
|
|
25
|
+
readonly kind: "refused";
|
|
26
|
+
readonly error: FileError;
|
|
27
|
+
};
|
|
28
|
+
/** Open the object at `key` through `env.openBound` and read the answer as a {@link BoundOpening}; it never throws. */
|
|
29
|
+
export declare function openBoundAt(env: Pick<ExecutionEnv, "openBound">, key: string, signal?: AbortSignal): Promise<BoundOpening>;
|
|
30
|
+
/** What a reader reads: the bound object, or — where the environment cannot bind — the one by-name simulation of it
|
|
31
|
+
* ({@link simulatedObjectAt}). Either way the reader takes its kind, size and bytes from it and closes it. `byName` is
|
|
32
|
+
* present on the simulation only: the key it reads by name and its judgment asked again (the look and the reader's
|
|
33
|
+
* re-judgment it takes before every answer) — a program that must read the object starts on the key by name only after
|
|
34
|
+
* `check` answers, right before the start. A held object has no `byName`: a program reads its bytes. */
|
|
35
|
+
export type ReadObject = Pick<BoundFileObject, "kind" | "size" | "readBytes" | "close"> & {
|
|
36
|
+
readonly byName?: {
|
|
37
|
+
readonly key: string;
|
|
38
|
+
check(signal?: AbortSignal): Promise<Result<void, FileError>>;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
/** The reader's own judgment of its target, asked again after a by-name read: true ⇔ the name still lands on the key. */
|
|
42
|
+
export type Rejudgment = (signal?: AbortSignal) => Promise<boolean>;
|
|
43
|
+
/** A reader's judgment as its {@link Rejudgment}: `judge` resolves the reader's path now; it still lands when it answers
|
|
44
|
+
* `key` again. A throw is a no. */
|
|
45
|
+
export declare function sameKeyAgain(judge: (signal?: AbortSignal) => Promise<{
|
|
46
|
+
readonly ok: boolean;
|
|
47
|
+
readonly key?: string;
|
|
48
|
+
}>, key: string): Rejudgment;
|
|
49
|
+
/** A read object's whole content within `max` bytes: `over` when it is larger than `max` — by its size before the read
|
|
50
|
+
* (`size`), or by the read refusing it as over its cap (`invalid`) with its size after (`read`: grown past `max` while it
|
|
51
|
+
* was read); `failed` for every other failure, its own code kept (`aborted`, `precondition_failed`, …). The read asks for
|
|
52
|
+
* `max` bytes and the object takes at most one byte more to tell a larger file; a file that grew after the read ended is
|
|
53
|
+
* read as it was. */
|
|
54
|
+
export declare function readWithin(object: ReadObject, max: number, signal?: AbortSignal): Promise<{
|
|
55
|
+
readonly kind: "bytes";
|
|
56
|
+
readonly bytes: Uint8Array;
|
|
57
|
+
} | {
|
|
58
|
+
readonly kind: "over";
|
|
59
|
+
readonly size: number;
|
|
60
|
+
readonly on: "size" | "read";
|
|
61
|
+
} | {
|
|
62
|
+
readonly kind: "failed";
|
|
63
|
+
readonly error: FileError;
|
|
64
|
+
}>;
|
|
65
|
+
/** What {@link readObjectAt} answered: the object, or the step that gave none — `open`: the environment's bound open was
|
|
66
|
+
* refused (the file may well be there; it could not be opened, so the failure is a failed READ and says its reason as every
|
|
67
|
+
* read failure does); `look`: the by-name simulation's look at the leaf failed (the object's kind and size could not be taken,
|
|
68
|
+
* so the failure is a failed STAT). A reader says which one it was — a refused opening is never told as a failed stat. */
|
|
69
|
+
export type ReadObjectAnswer = {
|
|
70
|
+
ok: true;
|
|
71
|
+
value: ReadObject;
|
|
72
|
+
} | {
|
|
73
|
+
ok: false;
|
|
74
|
+
error: FileError;
|
|
75
|
+
step: "open" | "look";
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* The object a reader reads whose no-binding disposition is to read by name — the model's own reads and the reads made for
|
|
79
|
+
* it (a person's path attachment is not one: it reads only a bound object, `openBoundAt`). Passing `rejudge` is that
|
|
80
|
+
* declaration. `bound` ⇒ the bound object; `unbindable` ⇒ {@link simulatedObjectAt}; `refused` ⇒ the refusal. A carrier that opened
|
|
81
|
+
* before it judged hands its answer to {@link objectOfOpening}, the same reading, with no second open.
|
|
82
|
+
*/
|
|
83
|
+
export declare function readObjectAt(env: Pick<ExecutionEnv, "openBound" | "fileInfo" | "readBinaryFile">, key: string, rejudge: Rejudgment, signal?: AbortSignal): Promise<ReadObjectAnswer>;
|
|
84
|
+
export declare function objectOfOpening(env: Pick<ExecutionEnv, "fileInfo" | "readBinaryFile">, key: string, rejudge: Rejudgment, opening: BoundOpening, signal?: AbortSignal): Promise<ReadObjectAnswer>;
|
|
85
|
+
/**
|
|
86
|
+
* The one by-name simulation of a bound object at a judged `key` (judge → read → judge again): every answer it gives comes
|
|
87
|
+
* from a look at the leaf without following a link (`fileInfo`) followed by the reader's own judgment asked again
|
|
88
|
+
* (`rejudge`) — a link at the leaf is refused as the bound open refuses it (`precondition_failed`), anything the look does not
|
|
89
|
+
* call a regular file or a directory keeps the look's answer, and a judgment that no longer lands on the key is
|
|
90
|
+
* `precondition_failed`. The kind is the first look's; the size a fresh look's. The bytes are ONE bounded read of the key
|
|
91
|
+
* (`readBinaryFile(key, signal, max + 1)` — never more than `max + 1` bytes taken; the environment's bounded read opens
|
|
92
|
+
* without blocking and reads only a regular file), and only then the look and the judgment again: another object or a link
|
|
93
|
+
* found there drops the bytes. A swap that lands and reverts entirely between a look and the read is the window every
|
|
94
|
+
* unbound read shares (KL-1503-b). A cancelled signal answers `aborted`. Nothing is held; `close` releases nothing. `byName`
|
|
95
|
+
* offers the same look and judgment to a program that reads the key by name, asked right before it starts.
|
|
96
|
+
*/
|
|
97
|
+
export declare function simulatedObjectAt(env: Pick<ExecutionEnv, "fileInfo" | "readBinaryFile">, key: string, rejudge: Rejudgment, signal?: AbortSignal): Promise<Result<ReadObject, FileError>>;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { FileError, err, ok } from "../../internal/harness.js";
|
|
2
|
+
import { thrownText } from "../../core/thrown-value.js";
|
|
3
|
+
import { envErrorDetail } from "./env-error-detail.js";
|
|
4
|
+
export async function openBoundAt(env, key, signal) {
|
|
5
|
+
try {
|
|
6
|
+
const open = env.openBound;
|
|
7
|
+
if (open === undefined)
|
|
8
|
+
return { kind: "unbindable" };
|
|
9
|
+
const opened = await open.call(env, key, signal);
|
|
10
|
+
if (opened.ok === true) {
|
|
11
|
+
if (typeof opened.value !== "object" || opened.value === null)
|
|
12
|
+
throw new TypeError("it answered ok without an object");
|
|
13
|
+
return { kind: "bound", object: opened.value };
|
|
14
|
+
}
|
|
15
|
+
if (opened.ok !== false || typeof opened.error?.code !== "string")
|
|
16
|
+
throw new TypeError("it answered no result");
|
|
17
|
+
return opened.error.code === "not_supported" ? { kind: "unbindable" } : { kind: "refused", error: opened.error };
|
|
18
|
+
}
|
|
19
|
+
catch (thrown) {
|
|
20
|
+
return { kind: "refused", error: new FileError("unknown", `openBound gave no answer: ${envErrorDetail(thrownText(thrown))}`, key) };
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export function sameKeyAgain(judge, key) {
|
|
24
|
+
return async (signal) => {
|
|
25
|
+
const again = await judge(signal).catch(() => undefined);
|
|
26
|
+
return again?.ok === true && again.key === key;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export async function readWithin(object, max, signal) {
|
|
30
|
+
const before = await object.size();
|
|
31
|
+
if (!before.ok)
|
|
32
|
+
return { kind: "failed", error: before.error };
|
|
33
|
+
if (before.value > max)
|
|
34
|
+
return { kind: "over", size: before.value, on: "size" };
|
|
35
|
+
const read = await object.readBytes(max, signal);
|
|
36
|
+
if (read.ok)
|
|
37
|
+
return { kind: "bytes", bytes: read.value };
|
|
38
|
+
if (read.error.code !== "invalid")
|
|
39
|
+
return { kind: "failed", error: read.error };
|
|
40
|
+
const after = await object.size();
|
|
41
|
+
return after.ok && after.value > max ? { kind: "over", size: after.value, on: "read" } : { kind: "failed", error: read.error };
|
|
42
|
+
}
|
|
43
|
+
export async function readObjectAt(env, key, rejudge, signal) {
|
|
44
|
+
return objectOfOpening(env, key, rejudge, await openBoundAt(env, key, signal), signal);
|
|
45
|
+
}
|
|
46
|
+
export async function objectOfOpening(env, key, rejudge, opening, signal) {
|
|
47
|
+
if (opening.kind === "bound")
|
|
48
|
+
return { ok: true, value: opening.object };
|
|
49
|
+
if (opening.kind === "refused")
|
|
50
|
+
return { ok: false, error: opening.error, step: "open" };
|
|
51
|
+
const simulated = await simulatedObjectAt(env, key, rejudge, signal);
|
|
52
|
+
return simulated.ok ? simulated : { ok: false, error: simulated.error, step: "look" };
|
|
53
|
+
}
|
|
54
|
+
export async function simulatedObjectAt(env, key, rejudge, signal) {
|
|
55
|
+
const changed = () => new FileError("precondition_failed", "The file changed while it was read by name (a link or another object took its place), so it was not read through", key);
|
|
56
|
+
const judged = async (s) => {
|
|
57
|
+
const look = await env.fileInfo(key, s);
|
|
58
|
+
if (!look.ok)
|
|
59
|
+
return look;
|
|
60
|
+
if (look.value.kind === "symlink")
|
|
61
|
+
return err(new FileError("precondition_failed", "A link stands on the path now, so it is not the object that was checked", key));
|
|
62
|
+
const stillTheKey = await rejudge(s);
|
|
63
|
+
if (s?.aborted === true)
|
|
64
|
+
return err(new FileError("aborted", "aborted", key));
|
|
65
|
+
return stillTheKey ? ok({ kind: look.value.kind, size: look.value.size }) : err(changed());
|
|
66
|
+
};
|
|
67
|
+
const first = await judged(signal);
|
|
68
|
+
if (!first.ok)
|
|
69
|
+
return first;
|
|
70
|
+
const kind = first.value.kind;
|
|
71
|
+
return ok({
|
|
72
|
+
kind,
|
|
73
|
+
size: async () => {
|
|
74
|
+
const now = await judged(signal);
|
|
75
|
+
if (!now.ok)
|
|
76
|
+
return now;
|
|
77
|
+
return now.value.kind === kind ? ok(now.value.size) : err(changed());
|
|
78
|
+
},
|
|
79
|
+
readBytes: async (max, readSignal) => {
|
|
80
|
+
if (kind !== "file")
|
|
81
|
+
return err(new FileError("is_directory", "The object is a directory", key));
|
|
82
|
+
const read = await env.readBinaryFile(key, readSignal, max + 1);
|
|
83
|
+
if (!read.ok)
|
|
84
|
+
return read;
|
|
85
|
+
if (read.value.byteLength > max)
|
|
86
|
+
return err(new FileError("invalid", `The file is over the ${max}-byte read cap (${read.value.byteLength} bytes or more); it was not read`, key));
|
|
87
|
+
const after = await judged(readSignal);
|
|
88
|
+
if (!after.ok)
|
|
89
|
+
return after;
|
|
90
|
+
return after.value.kind === "file" ? read : err(changed());
|
|
91
|
+
},
|
|
92
|
+
byName: {
|
|
93
|
+
key,
|
|
94
|
+
check: async (s) => {
|
|
95
|
+
const now = await judged(s);
|
|
96
|
+
if (!now.ok)
|
|
97
|
+
return now;
|
|
98
|
+
return now.value.kind === kind ? ok(undefined) : err(changed());
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
close: async () => { },
|
|
102
|
+
});
|
|
103
|
+
}
|
|
@@ -93,8 +93,8 @@ export declare function resolveContainmentFace(i: ContainmentFaceInputs): Contai
|
|
|
93
93
|
* Both stations deliver THIS object through their own `deliverEngineNotice` call (prepare-task with
|
|
94
94
|
* the `RunnerDeps.onNotice` seat, once per notice sink — the sink, not the deps object, because the
|
|
95
95
|
* Runner rebuilds its deps; `createHandsToolkit` with its band-local `HandsToolkitOptions.onNotice`
|
|
96
|
-
* seat — toolkit creation is itself the one-per-mount boot moment, and an absent seat
|
|
97
|
-
* same line
|
|
96
|
+
* seat — toolkit creation is itself the one-per-mount boot moment, and an absent seat hands it to the
|
|
97
|
+
* process's default seat, else prints the same line). Built here, import-free, so the message can never fork between
|
|
98
98
|
* the stations OR between the two faces.
|
|
99
99
|
*/
|
|
100
100
|
export declare function deploymentFaceClampNotice(kind: ContainmentFaceKind): {
|