@sema-agent/core 7.66.0 → 7.67.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 +3498 -0
- package/LICENSE +2 -1
- package/dist/agents/agent-definition.js +2 -1
- package/dist/agents/agent-transcript-tool.d.ts +1 -1
- package/dist/agents/agent-transcript-tool.js +4 -3
- package/dist/agents/builtin-agents.d.ts +10 -7
- package/dist/agents/builtin-agents.js +1 -0
- package/dist/agents/cascade.d.ts +24 -11
- package/dist/agents/cascade.js +21 -9
- package/dist/agents/child-failure.d.ts +30 -0
- package/dist/agents/child-failure.js +25 -1
- package/dist/agents/composition-placement.d.ts +6 -2
- package/dist/agents/composition-placement.js +7 -3
- package/dist/agents/cross-session-envelope.d.ts +10 -1
- package/dist/agents/cross-session-envelope.js +6 -2
- package/dist/agents/cross-session-judge.d.ts +7 -1
- package/dist/agents/cross-session-judge.js +1 -0
- package/dist/agents/cumulative-stats.d.ts +36 -2
- package/dist/agents/cumulative-stats.js +44 -9
- package/dist/agents/delegation-registry-seat.js +2 -3
- package/dist/agents/inherited-tool-pool.d.ts +9 -4
- package/dist/agents/inherited-tool-pool.js +7 -1
- package/dist/agents/leg-label.d.ts +28 -0
- package/dist/agents/leg-label.js +9 -0
- package/dist/agents/list-agents-tool.d.ts +1 -1
- package/dist/agents/list-agents-tool.js +4 -4
- package/dist/agents/org-delivery-gate.d.ts +129 -23
- package/dist/agents/org-delivery-gate.js +41 -20
- package/dist/agents/peer-held-queue.d.ts +15 -10
- package/dist/agents/peer-held-queue.js +47 -19
- package/dist/agents/peer-notice-route.js +2 -2
- package/dist/agents/peer-notices.d.ts +13 -2
- package/dist/agents/peer-notices.js +12 -2
- package/dist/agents/peer-session-drain.d.ts +65 -15
- package/dist/agents/peer-session-drain.js +198 -41
- package/dist/agents/read-inbox-tool.d.ts +3 -2
- package/dist/agents/read-inbox-tool.js +7 -5
- package/dist/agents/repair-loop.js +20 -16
- package/dist/agents/retain-ledger.d.ts +1 -1
- package/dist/agents/retain-ledger.js +2 -4
- package/dist/agents/root-session-lane.d.ts +27 -0
- package/dist/agents/root-session-lane.js +57 -0
- package/dist/agents/roster-store.js +1 -2
- package/dist/agents/send-message-tool.js +6 -4
- package/dist/agents/subagent.d.ts +20 -4
- package/dist/agents/subagent.js +218 -183
- package/dist/agents/tool-filter.d.ts +3 -10
- package/dist/agents/tool-filter.js +0 -13
- package/dist/agents/verifier-independence.d.ts +31 -0
- package/dist/agents/verifier-independence.js +23 -0
- package/dist/agents/verify.d.ts +23 -11
- package/dist/agents/verify.js +28 -12
- package/dist/agents/yield-adoption.d.ts +24 -0
- package/dist/agents/yield-adoption.js +84 -0
- package/dist/bench/metrics.d.ts +2 -2
- package/dist/brain/anthropic.d.ts +4 -2
- package/dist/brain/anthropic.js +49 -35
- package/dist/brain/brain-faces.d.ts +11 -0
- package/dist/brain/brain-faces.js +6 -0
- package/dist/brain/cache-retention.d.ts +2 -0
- package/dist/brain/cache-retention.js +9 -0
- package/dist/brain/circuit-breaker.js +51 -26
- package/dist/brain/errors.d.ts +15 -1
- package/dist/brain/errors.js +8 -0
- package/dist/brain/failover.d.ts +6 -0
- package/dist/brain/failover.js +52 -37
- package/dist/brain/media-degrade.d.ts +5 -0
- package/dist/brain/media-degrade.js +4 -0
- package/dist/brain/model-capability.d.ts +2 -1
- package/dist/brain/model-lane.d.ts +145 -0
- package/dist/brain/model-lane.js +444 -0
- package/dist/brain/open-responses.js +19 -22
- package/dist/brain/openai.js +23 -22
- package/dist/brain/provider-message.d.ts +9 -0
- package/dist/brain/provider-message.js +18 -0
- package/dist/brain/reasoning-request.d.ts +9 -7
- package/dist/brain/reasoning-request.js +9 -10
- package/dist/brain/reasoning.d.ts +47 -13
- package/dist/brain/reasoning.js +20 -10
- package/dist/brain/route-adjudicator.d.ts +8 -2
- package/dist/brain/route-adjudicator.js +35 -1
- package/dist/brain/route-conformance.js +17 -0
- package/dist/brain/routing.d.ts +2 -0
- package/dist/brain/routing.js +19 -8
- package/dist/brain/status-sink.d.ts +5 -4
- package/dist/brain/status-sink.js +2 -2
- package/dist/brain/stream-engine.js +8 -2
- package/dist/brain/stream-shared.d.ts +12 -0
- package/dist/brain/stream-shared.js +18 -0
- package/dist/brain/timeout.d.ts +28 -0
- package/dist/brain/timeout.js +13 -4
- package/dist/brain/tool-schema-projection.d.ts +2 -0
- package/dist/brain/tool-schema-projection.js +108 -0
- package/dist/brain/usage-reading.d.ts +49 -0
- package/dist/brain/usage-reading.js +44 -0
- package/dist/brain/usage-reasoning.d.ts +38 -0
- package/dist/brain/usage-reasoning.js +9 -0
- package/dist/config/catalog.d.ts +3 -0
- package/dist/config/catalog.js +18 -9
- package/dist/core/a2a.d.ts +22 -4
- package/dist/core/a2a.js +191 -50
- package/dist/core/agent-definition.d.ts +3 -1
- package/dist/core/agent-state.d.ts +29 -16
- package/dist/core/agent-state.js +36 -9
- package/dist/core/allow-entry.d.ts +12 -3
- package/dist/core/allow-entry.js +10 -3
- package/dist/core/approval-display.d.ts +18 -0
- package/dist/core/approval-display.js +26 -0
- package/dist/core/approval-object.js +2 -2
- package/dist/core/approval-route.d.ts +16 -0
- package/dist/core/approval-route.js +5 -0
- package/dist/core/approval-words.d.ts +43 -0
- package/dist/core/approval-words.js +37 -0
- package/dist/core/ask-origin.d.ts +37 -10
- package/dist/core/ask-origin.js +19 -7
- package/dist/core/ask-question.d.ts +36 -8
- package/dist/core/ask-question.js +24 -9
- package/dist/core/ask-unresolvable-notice.d.ts +3 -2
- package/dist/core/ask-unresolvable-notice.js +3 -2
- package/dist/core/attachment-source.d.ts +50 -0
- package/dist/core/attachment-source.js +46 -0
- package/dist/core/auto-compaction.d.ts +151 -40
- package/dist/core/auto-compaction.js +115 -50
- package/dist/core/auto-mode.d.ts +5 -0
- package/dist/core/auto-mode.js +11 -4
- package/dist/core/background-agent-store.d.ts +151 -23
- package/dist/core/background-agent-store.js +201 -61
- package/dist/core/background-shell.d.ts +4 -1
- package/dist/core/background-shell.js +1 -0
- package/dist/core/cache-break-detector.d.ts +49 -25
- package/dist/core/cache-break-detector.js +99 -44
- package/dist/core/caller-text.d.ts +28 -0
- package/dist/core/caller-text.js +12 -0
- package/dist/core/canonical-json.d.ts +5 -0
- package/dist/core/canonical-json.js +7 -0
- package/dist/core/checkpoint-features.d.ts +80 -9
- package/dist/core/checkpoint-features.js +1 -1
- package/dist/core/checkpoint-generation.d.ts +8 -1
- package/dist/core/checkpoint-generation.js +3 -0
- package/dist/core/checkpoint-queries.d.ts +47 -14
- package/dist/core/checkpoint-queries.js +63 -30
- package/dist/core/checkpoint-requirements.d.ts +36 -3
- package/dist/core/checkpoint-requirements.js +11 -1
- package/dist/core/checkpoint-row-verdict.d.ts +0 -2
- package/dist/core/checkpoint-row-verdict.js +5 -8
- package/dist/core/checkpoint-store.d.ts +166 -41
- package/dist/core/checkpoint-store.js +96 -15
- package/dist/core/child-clamp-seats.d.ts +10 -2
- package/dist/core/child-clamp-seats.js +2 -2
- package/dist/core/classifier-unavailable-arm.d.ts +11 -9
- package/dist/core/classifier-unavailable-arm.js +4 -2
- package/dist/core/command-sandbox-dispatch.d.ts +13 -0
- package/dist/core/command-sandbox-dispatch.js +8 -0
- package/dist/core/command-sandbox.d.ts +231 -0
- package/dist/core/command-sandbox.js +344 -0
- package/dist/core/completion-id.d.ts +21 -0
- package/dist/core/completion-id.js +14 -0
- package/dist/core/config-refusal-codes.d.ts +22 -0
- package/dist/core/config-refusal-codes.js +196 -0
- package/dist/core/context-edit.d.ts +26 -0
- package/dist/core/context-edit.js +4 -2
- package/dist/core/context-guard.d.ts +80 -7
- package/dist/core/context-guard.js +126 -25
- package/dist/core/context-settings.d.ts +32 -0
- package/dist/core/context-settings.js +41 -3
- package/dist/core/contract-faces.d.ts +22 -0
- package/dist/core/contract-faces.js +1 -0
- package/dist/core/credential-echo.d.ts +2 -2
- package/dist/core/credential-echo.js +2 -2
- package/dist/core/cross-boundary-taint.d.ts +10 -8
- package/dist/core/decision-receipt.d.ts +3 -2
- package/dist/core/decision-receipt.js +1 -1
- package/dist/core/definition-entry-grammar.d.ts +42 -0
- package/dist/core/definition-entry-grammar.js +15 -0
- package/dist/core/engine-attestation.d.ts +19 -4
- package/dist/core/engine-attestation.js +4 -0
- package/dist/core/engine-capabilities.d.ts +8 -1
- package/dist/core/engine-capabilities.js +1 -1
- package/dist/core/engine-contracts/open-face-contract.d.ts +39 -0
- package/dist/core/engine-contracts/open-face-contract.js +57 -0
- package/dist/core/engine-notice.d.ts +161 -33
- package/dist/core/exclusive-temp.d.ts +25 -0
- package/dist/core/exclusive-temp.js +19 -0
- package/dist/core/existing-target.d.ts +112 -0
- package/dist/core/existing-target.js +88 -0
- package/dist/core/file-history-store.d.ts +14 -6
- package/dist/core/gate-lanes.js +8 -3
- package/dist/core/gate-outcome.d.ts +2 -1
- package/dist/core/git-worktree-env.d.ts +92 -1
- package/dist/core/git-worktree-env.js +87 -6
- package/dist/core/governance-codes.d.ts +49 -8
- package/dist/core/governance-codes.js +59 -8
- package/dist/core/hands-band.d.ts +10 -6
- package/dist/core/hooks.d.ts +60 -6
- package/dist/core/hooks.js +10 -2
- package/dist/core/host-floor.d.ts +24 -8
- package/dist/core/host-floor.js +45 -16
- package/dist/core/human-input-projection.d.ts +7 -0
- package/dist/core/human-input-projection.js +11 -3
- package/dist/core/image-admission.d.ts +16 -4
- package/dist/core/image-admission.js +29 -17
- package/dist/core/input-author.d.ts +43 -1
- package/dist/core/input-author.js +19 -0
- package/dist/core/isolation-scope.d.ts +41 -0
- package/dist/core/isolation-scope.js +10 -0
- package/dist/core/json-schema-seats.d.ts +11 -0
- package/dist/core/json-schema-seats.js +5 -0
- package/dist/core/leg-identity.d.ts +53 -5
- package/dist/core/leg-identity.js +32 -1
- package/dist/core/locked-config.d.ts +33 -38
- package/dist/core/locked-config.js +21 -3
- package/dist/core/lsp.js +2 -1
- package/dist/core/mailbox-store.d.ts +111 -18
- package/dist/core/mailbox-store.js +101 -13
- package/dist/core/mcp-call-meta.js +1 -1
- package/dist/core/mcp-connection-pool.d.ts +8 -2
- package/dist/core/mcp-connection-pool.js +3 -1
- package/dist/core/mcp-failure.d.ts +6 -1
- package/dist/core/mcp-failure.js +10 -0
- package/dist/core/mcp-host-read.d.ts +293 -0
- package/dist/core/mcp-host-read.js +428 -0
- package/dist/core/mcp-server-link.d.ts +28 -6
- package/dist/core/mcp-server-link.js +35 -7
- package/dist/core/mcp-server-spec.d.ts +22 -29
- package/dist/core/mcp-server-spec.js +7 -14
- package/dist/core/mcp-server-unavailable-notice.d.ts +32 -0
- package/dist/core/mcp-server-unavailable-notice.js +15 -0
- package/dist/core/mcp-session-end.d.ts +5 -2
- package/dist/core/mcp-session-end.js +7 -2
- package/dist/core/mcp-tool-meta.d.ts +6 -0
- package/dist/core/mcp-tool-meta.js +1 -0
- package/dist/core/mcp.d.ts +54 -19
- package/dist/core/mcp.js +194 -241
- package/dist/core/memory-engine/committed-shadow-read.d.ts +16 -0
- package/dist/core/memory-engine/committed-shadow-read.js +21 -0
- package/dist/core/memory-engine/consolidation-driver.js +2 -1
- package/dist/core/memory-engine/consolidation.d.ts +3 -3
- package/dist/core/memory-engine/control-objects.d.ts +4 -3
- package/dist/core/memory-engine/control-objects.js +6 -4
- package/dist/core/memory-engine/delegation-settlement.d.ts +127 -25
- package/dist/core/memory-engine/delegation-settlement.js +145 -18
- package/dist/core/memory-engine/distiller.d.ts +2 -1
- package/dist/core/memory-engine/distiller.js +10 -5
- package/dist/core/memory-engine/dual-root.js +2 -2
- package/dist/core/memory-engine/engine.d.ts +127 -33
- package/dist/core/memory-engine/engine.js +774 -323
- package/dist/core/memory-engine/entry-scan.d.ts +3 -0
- package/dist/core/memory-engine/entry-scan.js +8 -0
- package/dist/core/memory-engine/export-bundle.d.ts +4 -0
- package/dist/core/memory-engine/export-bundle.js +2 -0
- package/dist/core/memory-engine/file-backend.d.ts +62 -17
- package/dist/core/memory-engine/file-backend.js +155 -99
- package/dist/core/memory-engine/index.d.ts +1 -1
- package/dist/core/memory-engine/index.js +1 -1
- package/dist/core/memory-engine/layer-observations.d.ts +7 -1
- package/dist/core/memory-engine/layer-observations.js +6 -0
- package/dist/core/memory-engine/layout.d.ts +88 -26
- package/dist/core/memory-engine/layout.js +105 -29
- package/dist/core/memory-engine/memory-deployment.js +4 -4
- package/dist/core/memory-engine/mount-failed-notice.d.ts +24 -0
- package/dist/core/memory-engine/mount-failed-notice.js +22 -0
- package/dist/core/memory-engine/origin-clearance.d.ts +15 -1
- package/dist/core/memory-engine/origin-clearance.js +30 -10
- package/dist/core/memory-engine/scan.js +1 -1
- package/dist/core/memory-engine/scope-contract.js +4 -3
- package/dist/core/memory-engine/session-write-home.js +13 -1
- package/dist/core/memory-engine/sync-client.d.ts +1 -1
- package/dist/core/memory-engine/sync-client.js +3 -1
- package/dist/core/memory-engine/tools.d.ts +5 -4
- package/dist/core/memory-engine/tools.js +1 -1
- package/dist/core/memory-engine/types.d.ts +18 -1
- package/dist/core/memory-engine/types.js +1 -0
- package/dist/core/memory.d.ts +1 -1
- package/dist/core/memory.js +2 -6
- package/dist/core/mode-policy.d.ts +8 -1
- package/dist/core/mode-policy.js +6 -2
- package/dist/core/model-fallbacks.d.ts +103 -0
- package/dist/core/model-fallbacks.js +79 -0
- package/dist/core/model-receipt.d.ts +15 -3
- package/dist/core/model-receipt.js +22 -1
- package/dist/core/model-seat.d.ts +1 -1
- package/dist/core/mods/classic-events.d.ts +5 -1
- package/dist/core/mods/dollar.d.ts +47 -2
- package/dist/core/mods/dollar.js +28 -5
- package/dist/core/mods/kernel/budget.d.ts +6 -0
- package/dist/core/mods/kernel/budget.js +6 -0
- package/dist/core/mods/kernel/dispatch.d.ts +23 -2
- package/dist/core/mods/kernel/dispatch.js +104 -15
- package/dist/core/mods/kernel/events.d.ts +18 -1
- package/dist/core/mods/kernel/events.js +7 -6
- package/dist/core/mods/kernel/index.d.ts +2 -2
- package/dist/core/mods/kernel/index.js +1 -1
- package/dist/core/mods/kernel/receive.d.ts +2 -1
- package/dist/core/mods/lifecycle-stations.d.ts +13 -4
- package/dist/core/mods/lifecycle-stations.js +8 -3
- package/dist/core/mods/message-display.d.ts +81 -0
- package/dist/core/mods/message-display.js +369 -0
- package/dist/core/mods/prompt-submit.d.ts +1 -1
- package/dist/core/mods/prompt-submit.js +5 -2
- package/dist/core/mods/session-append.d.ts +2 -2
- package/dist/core/mods/session-append.js +2 -1
- package/dist/core/mods/session-compact.js +2 -2
- package/dist/core/mods/stations.d.ts +48 -18
- package/dist/core/mods/stations.js +100 -19
- package/dist/core/mods/stop-answers.d.ts +23 -0
- package/dist/core/mods/stop-answers.js +20 -0
- package/dist/core/mounted-mcp.d.ts +48 -8
- package/dist/core/mounted-mcp.js +82 -16
- package/dist/core/namespaced-rule-name.js +2 -1
- package/dist/core/own-property-receipt.js +3 -5
- package/dist/core/parent-spec-seat.d.ts +20 -1
- package/dist/core/parent-spec-seat.js +13 -3
- package/dist/core/park-selfcheck.js +1 -0
- package/dist/core/path-identity.js +2 -1
- package/dist/core/peer-seat.d.ts +21 -7
- package/dist/core/peer-seat.js +25 -16
- package/dist/core/permission-rule-consent.js +15 -5
- package/dist/core/permission-rule-model.d.ts +4 -2
- package/dist/core/permission-rule-model.js +43 -23
- package/dist/core/permission-rule-store.d.ts +31 -16
- package/dist/core/permission-rule-store.js +27 -18
- package/dist/core/present-plan-tool.d.ts +6 -1
- package/dist/core/present-plan-tool.js +11 -3
- package/dist/core/pricing.d.ts +8 -6
- package/dist/core/pricing.js +1 -1
- package/dist/core/principal-name.d.ts +13 -0
- package/dist/core/principal-name.js +9 -2
- package/dist/core/process-identity.d.ts +140 -0
- package/dist/core/process-identity.js +215 -0
- package/dist/core/protocol-http-auth.d.ts +28 -6
- package/dist/core/protocol-http-auth.js +22 -5
- package/dist/core/protocol-naming.d.ts +7 -0
- package/dist/core/protocol-naming.js +12 -2
- package/dist/core/protocol-revocation.d.ts +72 -0
- package/dist/core/protocol-revocation.js +98 -0
- package/dist/core/protocol-table.d.ts +4 -4
- package/dist/core/protocol-table.js +3 -2
- package/dist/core/push-queue.d.ts +35 -2
- package/dist/core/push-queue.js +60 -4
- package/dist/core/read-only-shell.d.ts +19 -0
- package/dist/core/read-only-shell.js +38 -11
- package/dist/core/real-approval.d.ts +26 -0
- package/dist/core/real-approval.js +15 -0
- package/dist/core/redaction-marks.d.ts +6 -2
- package/dist/core/redaction-marks.js +3 -0
- package/dist/core/reminder-mint.d.ts +6 -0
- package/dist/core/reminder-mint.js +9 -8
- package/dist/core/remote-env.d.ts +31 -15
- package/dist/core/remote-env.js +29 -0
- package/dist/core/request-copy-projection.d.ts +51 -0
- package/dist/core/request-copy-projection.js +410 -0
- package/dist/core/resume-config-judge.d.ts +69 -0
- package/dist/core/resume-config-judge.js +78 -0
- package/dist/core/resume-startup-cause.d.ts +14 -4
- package/dist/core/resume-startup-cause.js +12 -2
- package/dist/core/retention-policy.js +2 -1
- package/dist/core/retention.d.ts +119 -24
- package/dist/core/retention.js +60 -16
- package/dist/core/retired-keys.d.ts +0 -10
- package/dist/core/retired-keys.js +2 -3
- package/dist/core/roles.d.ts +6 -0
- package/dist/core/roles.js +65 -4
- package/dist/core/row-shape.d.ts +149 -0
- package/dist/core/row-shape.js +184 -0
- package/dist/core/runner/advertised-writable-dirs.js +10 -9
- package/dist/core/runner/advisor-instructions.d.ts +11 -27
- package/dist/core/runner/advisor-instructions.js +18 -20
- package/dist/core/runner/advisor-tool.js +1 -0
- package/dist/core/runner/announce-once-ledger.js +4 -1
- package/dist/core/runner/approval-feedback.d.ts +17 -8
- package/dist/core/runner/approval-feedback.js +18 -13
- package/dist/core/runner/approver-defect-announcer.d.ts +17 -0
- package/dist/core/runner/approver-defect-announcer.js +22 -0
- package/dist/core/runner/assemble-result.d.ts +29 -14
- package/dist/core/runner/assemble-result.js +16 -25
- package/dist/core/runner/cache-hit-account.d.ts +77 -0
- package/dist/core/runner/cache-hit-account.js +46 -0
- package/dist/core/runner/call-hook-stations.d.ts +3 -2
- package/dist/core/runner/call-hook-stations.js +5 -4
- package/dist/core/runner/changed-files-scan.d.ts +43 -0
- package/dist/core/runner/changed-files-scan.js +34 -0
- package/dist/core/runner/checkpoint-scope.d.ts +33 -9
- package/dist/core/runner/checkpoint-scope.js +27 -1
- package/dist/core/runner/classifier-ladder.d.ts +2 -2
- package/dist/core/runner/classifier-ladder.js +18 -9
- package/dist/core/runner/clock-and-limits.d.ts +15 -4
- package/dist/core/runner/clock-and-limits.js +19 -1
- package/dist/core/runner/compact-session.js +84 -14
- package/dist/core/runner/compaction-call-options.d.ts +2 -29
- package/dist/core/runner/compaction-call-options.js +2 -9
- package/dist/core/runner/compaction-restate.d.ts +18 -2
- package/dist/core/runner/compaction-restate.js +36 -2
- package/dist/core/runner/construction-doors.js +8 -0
- package/dist/core/runner/context-room.d.ts +55 -0
- package/dist/core/runner/context-room.js +71 -0
- package/dist/core/runner/contracts.d.ts +313 -205
- package/dist/core/runner/conversation-segment.d.ts +49 -14
- package/dist/core/runner/conversation-segment.js +92 -19
- package/dist/core/runner/cross-boundary-lane.d.ts +4 -0
- package/dist/core/runner/cross-boundary-lane.js +9 -6
- package/dist/core/runner/decide-continuation.js +1 -1
- package/dist/core/runner/deferred-ask.d.ts +62 -0
- package/dist/core/runner/deferred-ask.js +44 -0
- package/dist/core/runner/delegation-owner.d.ts +19 -0
- package/dist/core/runner/delegation-owner.js +27 -1
- package/dist/core/runner/denial-limit-arms.d.ts +10 -6
- package/dist/core/runner/denial-limit-arms.js +13 -7
- package/dist/core/runner/env-capability-census.d.ts +1 -1
- package/dist/core/runner/file-history-request.js +2 -1
- package/dist/core/runner/file-history-restore.d.ts +16 -2
- package/dist/core/runner/file-history-restore.js +9 -1
- package/dist/core/runner/gate-exit.d.ts +18 -5
- package/dist/core/runner/gate-exit.js +26 -15
- package/dist/core/runner/git-status-frame.d.ts +26 -8
- package/dist/core/runner/git-status-frame.js +14 -9
- package/dist/core/runner/halt-attribution.d.ts +29 -12
- package/dist/core/runner/halt-attribution.js +38 -11
- package/dist/core/runner/image.js +3 -2
- package/dist/core/runner/initial-run-state.d.ts +1 -1
- package/dist/core/runner/initial-run-state.js +4 -4
- package/dist/core/runner/language-frame.d.ts +66 -0
- package/dist/core/runner/language-frame.js +76 -0
- package/dist/core/runner/leg-frame.d.ts +81 -0
- package/dist/core/runner/leg-frame.js +68 -0
- package/dist/core/runner/main-call-account.d.ts +34 -0
- package/dist/core/runner/main-call-account.js +50 -0
- package/dist/core/runner/mcp-redial.d.ts +9 -7
- package/dist/core/runner/mcp-redial.js +20 -21
- package/dist/core/runner/memory-consolidation-driver.d.ts +2 -0
- package/dist/core/runner/memory-consolidation-driver.js +5 -3
- package/dist/core/runner/messages-omitted-seat.d.ts +2 -0
- package/dist/core/runner/messages-omitted-seat.js +21 -0
- package/dist/core/runner/model-fallback-seat.d.ts +20 -0
- package/dist/core/runner/model-fallback-seat.js +43 -0
- package/dist/core/runner/model-lane-seat.d.ts +12 -0
- package/dist/core/runner/model-lane-seat.js +35 -0
- package/dist/core/runner/nested-memory-content.d.ts +33 -0
- package/dist/core/runner/nested-memory-content.js +171 -0
- package/dist/core/runner/nested-memory-lane.d.ts +181 -0
- package/dist/core/runner/nested-memory-lane.js +673 -0
- package/dist/core/runner/park-commit.d.ts +7 -0
- package/dist/core/runner/park-commit.js +3 -0
- package/dist/core/runner/prepare-advisor.d.ts +7 -9
- package/dist/core/runner/prepare-advisor.js +11 -5
- package/dist/core/runner/prepare-artifact.d.ts +1 -1
- package/dist/core/runner/prepare-artifact.js +8 -3
- package/dist/core/runner/prepare-ask-lane.d.ts +21 -3
- package/dist/core/runner/prepare-ask-lane.js +32 -28
- package/dist/core/runner/prepare-boundary-parks.d.ts +2 -2
- package/dist/core/runner/prepare-boundary-parks.js +21 -17
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +10 -2
- package/dist/core/runner/prepare-caps-and-workflow.js +24 -18
- package/dist/core/runner/prepare-config-doors.d.ts +51 -5
- package/dist/core/runner/prepare-config-doors.js +73 -73
- package/dist/core/runner/prepare-context-lane.d.ts +68 -3
- package/dist/core/runner/prepare-context-lane.js +137 -27
- package/dist/core/runner/prepare-defer-classify.d.ts +0 -4
- package/dist/core/runner/prepare-defer-classify.js +9 -13
- package/dist/core/runner/prepare-delegation-surface.d.ts +8 -8
- package/dist/core/runner/prepare-delegation-surface.js +72 -64
- package/dist/core/runner/prepare-execution-env.js +1 -9
- package/dist/core/runner/prepare-file-history.d.ts +3 -2
- package/dist/core/runner/prepare-file-history.js +11 -4
- package/dist/core/runner/prepare-gate-stations.d.ts +21 -11
- package/dist/core/runner/prepare-gate-stations.js +13 -13
- package/dist/core/runner/prepare-hands-readface.d.ts +23 -6
- package/dist/core/runner/prepare-hands-readface.js +18 -12
- package/dist/core/runner/prepare-inherited-gate.d.ts +12 -5
- package/dist/core/runner/prepare-inherited-gate.js +14 -10
- package/dist/core/runner/prepare-lsp.js +2 -1
- package/dist/core/runner/prepare-memory-engine-session.js +30 -10
- package/dist/core/runner/prepare-memory.d.ts +4 -0
- package/dist/core/runner/prepare-memory.js +38 -16
- package/dist/core/runner/prepare-offload-wrappers.d.ts +3 -16
- package/dist/core/runner/prepare-offload-wrappers.js +6 -5
- package/dist/core/runner/prepare-park-ask.d.ts +13 -3
- package/dist/core/runner/prepare-park-ask.js +25 -19
- package/dist/core/runner/prepare-policy-chain.d.ts +17 -3
- package/dist/core/runner/prepare-policy-chain.js +144 -120
- package/dist/core/runner/prepare-project-context.d.ts +15 -53
- package/dist/core/runner/prepare-project-context.js +20 -83
- package/dist/core/runner/prepare-prompt-assembly.d.ts +7 -1
- package/dist/core/runner/prepare-prompt-assembly.js +9 -7
- package/dist/core/runner/prepare-prompt-inputs.d.ts +9 -3
- package/dist/core/runner/prepare-prompt-inputs.js +5 -3
- package/dist/core/runner/prepare-protocol-tools.d.ts +9 -4
- package/dist/core/runner/prepare-protocol-tools.js +46 -27
- package/dist/core/runner/prepare-question-face.d.ts +7 -6
- package/dist/core/runner/prepare-question-face.js +7 -6
- package/dist/core/runner/prepare-suspend-saga.d.ts +3 -0
- package/dist/core/runner/prepare-suspend-saga.js +1 -1
- package/dist/core/runner/prepare-task.d.ts +3 -3
- package/dist/core/runner/prepare-task.js +113 -61
- package/dist/core/runner/prepare-tool-disclosure-mount.js +6 -5
- package/dist/core/runner/prepare-turn-wiring.d.ts +33 -7
- package/dist/core/runner/prepare-turn-wiring.js +53 -17
- package/dist/core/runner/prepare-wiring-manifest.d.ts +42 -5
- package/dist/core/runner/prepare-wiring-manifest.js +81 -42
- package/dist/core/runner/prepare-workspace-restore.js +3 -2
- package/dist/core/runner/read-root-grant.js +2 -1
- package/dist/core/runner/reply-pricing.d.ts +31 -18
- package/dist/core/runner/reply-pricing.js +10 -15
- package/dist/core/runner/resume-admission.js +10 -15
- package/dist/core/runner/resume-apply.js +20 -9
- package/dist/core/runner/resume-checkpoint-screen.js +2 -4
- package/dist/core/runner/resume-internals-and-config.d.ts +12 -9
- package/dist/core/runner/resume-internals-and-config.js +37 -9
- package/dist/core/runner/resume-preflight.js +3 -3
- package/dist/core/runner/retired-runner-deps.js +3 -0
- package/dist/core/runner/rewind-files.js +6 -6
- package/dist/core/runner/run-attachment-seats.d.ts +1 -3
- package/dist/core/runner/run-attachment-seats.js +1 -6
- package/dist/core/runner/run-brain-sinks.d.ts +4 -7
- package/dist/core/runner/run-brain-sinks.js +7 -10
- package/dist/core/runner/run-clock-and-content.d.ts +8 -5
- package/dist/core/runner/run-clock-and-content.js +18 -3
- package/dist/core/runner/run-compaction-machinery.d.ts +8 -4
- package/dist/core/runner/run-compaction-machinery.js +4 -19
- package/dist/core/runner/run-git-lane.d.ts +8 -3
- package/dist/core/runner/run-git-lane.js +5 -3
- package/dist/core/runner/run-harness-handlers.d.ts +4 -1
- package/dist/core/runner/run-harness-handlers.js +70 -45
- package/dist/core/runner/run-identity-wiring.d.ts +6 -0
- package/dist/core/runner/run-identity-wiring.js +17 -8
- package/dist/core/runner/run-leg.d.ts +5 -2
- package/dist/core/runner/run-leg.js +156 -71
- package/dist/core/runner/run-notification-lane.d.ts +1 -1
- package/dist/core/runner/run-notification-lane.js +22 -10
- package/dist/core/runner/run-recovery-lanes.js +8 -6
- package/dist/core/runner/run-settle-and-teardown.d.ts +4 -0
- package/dist/core/runner/run-settle-and-teardown.js +77 -26
- package/dist/core/runner/run-stop-and-final-verify.js +46 -12
- package/dist/core/runner/run-telemetry-and-budget-seats.js +13 -28
- package/dist/core/runner/run-terminal-adoption.d.ts +2 -2
- package/dist/core/runner/run-terminal-adoption.js +14 -9
- package/dist/core/runner/run-tool-mount-facts.js +5 -9
- package/dist/core/runner/run-turn-boundary.d.ts +3 -2
- package/dist/core/runner/run-turn-boundary.js +112 -106
- package/dist/core/runner/runtask.d.ts +28 -8
- package/dist/core/runner/runtask.js +132 -41
- package/dist/core/runner/session-file-state-replay.d.ts +5 -3
- package/dist/core/runner/session-file-state-replay.js +10 -3
- package/dist/core/runner/session-rule-policy.d.ts +3 -3
- package/dist/core/runner/session-verb-doors.d.ts +18 -3
- package/dist/core/runner/session-verb-doors.js +38 -6
- package/dist/core/runner/shell-env-withheld.d.ts +8 -5
- package/dist/core/runner/shell-env-withheld.js +4 -4
- package/dist/core/runner/side-call-account.d.ts +12 -8
- package/dist/core/runner/side-call-account.js +24 -15
- package/dist/core/runner/stream-halt-verbs.js +1 -0
- package/dist/core/runner/stream-mode-verb.js +2 -1
- package/dist/core/runner/stream-settle-backstop.js +4 -1
- package/dist/core/runner/stream-steer-verb.js +35 -19
- package/dist/core/runner/sub-agent-deny-lists.d.ts +47 -11
- package/dist/core/runner/sub-agent-deny-lists.js +140 -39
- package/dist/core/runner/teardown-bounded.d.ts +6 -0
- package/dist/core/runner/teardown-bounded.js +12 -7
- package/dist/core/runner/terminal-account.d.ts +2 -0
- package/dist/core/runner/terminal-account.js +6 -1
- package/dist/core/runner/tool-disclosure.js +2 -1
- package/dist/core/runner/tool-end-body.js +3 -1
- package/dist/core/runner/tool-face-overlay.d.ts +1 -1
- package/dist/core/runner/tool-face-overlay.js +1 -1
- package/dist/core/runner/tool-occurrence.d.ts +34 -9
- package/dist/core/runner/tool-occurrence.js +32 -21
- package/dist/core/runner/tool-progress-lane.d.ts +20 -5
- package/dist/core/runner/tool-progress-lane.js +27 -5
- package/dist/core/runner/tool-result-media-seat.d.ts +15 -4
- package/dist/core/runner/tool-result-media-seat.js +17 -1
- package/dist/core/runner/tool-table-view.js +1 -1
- package/dist/core/runner/turn-attachments.d.ts +44 -71
- package/dist/core/runner/turn-attachments.js +52 -104
- package/dist/core/runner/usage-accounting.d.ts +3 -2
- package/dist/core/runner/usage-accounting.js +3 -2
- package/dist/core/runner/void-verifier-pause.js +1 -1
- package/dist/core/runner-deps.d.ts +42 -158
- package/dist/core/runtime-caps.d.ts +16 -4
- package/dist/core/secret-env.d.ts +20 -3
- package/dist/core/secret-env.js +46 -23
- package/dist/core/sensitive-path-policy.d.ts +8 -0
- package/dist/core/sensitive-path-policy.js +10 -2
- package/dist/core/session-checkout.d.ts +32 -27
- package/dist/core/session-checkout.js +109 -61
- package/dist/core/session-log-transfer.js +2 -1
- package/dist/core/session-policy-store.d.ts +24 -11
- package/dist/core/session-policy-store.js +11 -2
- package/dist/core/session-store.d.ts +16 -2
- package/dist/core/session-store.js +43 -17
- package/dist/core/session.d.ts +31 -3
- package/dist/core/session.js +33 -2
- package/dist/core/shell-run-candidates.d.ts +20 -8
- package/dist/core/shell-run-candidates.js +44 -21
- package/dist/core/side-query.d.ts +17 -5
- package/dist/core/side-query.js +17 -14
- package/dist/core/skill-grant.js +2 -3
- package/dist/core/skills-directory.js +3 -66
- package/dist/core/snapshot-frame-seat.d.ts +8 -0
- package/dist/core/snapshot-frame-seat.js +24 -0
- package/dist/core/steer-replay.d.ts +19 -3
- package/dist/core/steer-replay.js +8 -1
- package/dist/core/store-contracts/background-agent-store-contract.d.ts +17 -2
- package/dist/core/store-contracts/background-agent-store-contract.js +131 -2
- package/dist/core/store-contracts/checkpoint-store-contract.js +63 -1
- package/dist/core/store-contracts/mailbox-store-contract.d.ts +15 -2
- package/dist/core/store-contracts/mailbox-store-contract.js +213 -3
- package/dist/core/store-contracts/permission-rule-write-contract.js +24 -0
- package/dist/core/store-contracts/session-deletion-cascade-contract.d.ts +15 -0
- package/dist/core/store-contracts/session-deletion-cascade-contract.js +288 -0
- package/dist/core/store-contracts/session-policy-store-contract.js +57 -36
- package/dist/core/store-contracts/session-repo-contract.js +130 -5
- package/dist/core/store-contracts/session-store-contract.d.ts +1 -1
- package/dist/core/store-contracts/session-store-contract.js +17 -0
- package/dist/core/store-contracts/task-list-store-contract.d.ts +32 -0
- package/dist/core/store-contracts/task-list-store-contract.js +240 -0
- package/dist/core/store-contracts/tool-result-store-contract.d.ts +1 -1
- package/dist/core/store-contracts/tool-result-store-contract.js +41 -0
- package/dist/core/stub-env.d.ts +2 -2
- package/dist/core/stub-env.js +1 -0
- package/dist/core/synthetic-read-verdict.d.ts +38 -28
- package/dist/core/synthetic-read-verdict.js +19 -28
- package/dist/core/task-event.d.ts +171 -19
- package/dist/core/task-intake.d.ts +26 -0
- package/dist/core/task-intake.js +31 -0
- package/dist/core/task-limits.d.ts +8 -6
- package/dist/core/task-notification.d.ts +88 -8
- package/dist/core/task-notification.js +45 -5
- package/dist/core/task-registry-agent.d.ts +24 -7
- package/dist/core/task-registry-agent.js +51 -28
- package/dist/core/task-registry-monitor.js +16 -14
- package/dist/core/task-registry-shared.d.ts +177 -35
- package/dist/core/task-registry-shared.js +44 -17
- package/dist/core/task-registry-workflow.js +8 -5
- package/dist/core/task-registry-yield.d.ts +32 -0
- package/dist/core/task-registry-yield.js +85 -0
- package/dist/core/task-registry.d.ts +88 -10
- package/dist/core/task-registry.js +124 -33
- package/dist/core/task-result.d.ts +115 -31
- package/dist/core/task-spec-members.d.ts +140 -1
- package/dist/core/task-spec-members.js +23 -8
- package/dist/core/task-spec.d.ts +181 -51
- package/dist/core/task-spec.js +1 -1
- package/dist/core/task-stream.d.ts +12 -2
- package/dist/core/terminal-cause.d.ts +12 -4
- package/dist/core/thrown-value.d.ts +49 -7
- package/dist/core/thrown-value.js +38 -2
- package/dist/core/tool-catalog-entries.js +13 -3
- package/dist/core/tool-data-door.d.ts +7 -0
- package/dist/core/tool-data-door.js +13 -0
- package/dist/core/tool-face-lists.d.ts +25 -0
- package/dist/core/tool-face-lists.js +38 -0
- package/dist/core/tool-face-reader.d.ts +0 -10
- package/dist/core/tool-face-reader.js +5 -3
- package/dist/core/tool-list-grammar.d.ts +103 -0
- package/dist/core/tool-list-grammar.js +130 -0
- package/dist/core/tool-mount-facts.d.ts +47 -0
- package/dist/core/tool-mount-facts.js +50 -0
- package/dist/core/tool-mount-plan.d.ts +196 -0
- package/dist/core/tool-mount-plan.js +404 -0
- package/dist/core/tool-mount-static.d.ts +12 -0
- package/dist/core/tool-mount-static.js +174 -0
- package/dist/core/tool-name-aliases.d.ts +60 -2
- package/dist/core/tool-name-aliases.js +22 -2
- package/dist/core/tool-name-list.d.ts +3 -0
- package/dist/core/tool-name-readings.d.ts +4 -0
- package/dist/core/tool-name-readings.js +1 -0
- package/dist/core/tool-policy.d.ts +246 -51
- package/dist/core/tool-policy.js +165 -71
- package/dist/core/tool-registry.d.ts +4 -11
- package/dist/core/tool-registry.js +0 -3
- package/dist/core/tool-result-bytes.d.ts +94 -0
- package/dist/core/tool-result-bytes.js +34 -0
- package/dist/core/tool-result-store.d.ts +97 -13
- package/dist/core/tool-result-store.js +52 -4
- package/dist/core/tool-roster.d.ts +71 -10
- package/dist/core/tool-roster.js +71 -21
- package/dist/core/tool-search-setting.d.ts +7 -9
- package/dist/core/tool-search-setting.js +23 -7
- package/dist/core/tool-spec.d.ts +32 -2
- package/dist/core/tools.js +6 -20
- package/dist/core/trace.d.ts +63 -11
- package/dist/core/trace.js +19 -0
- package/dist/core/types.d.ts +8 -6
- package/dist/core/types.js +3 -1
- package/dist/core/unmatched-tool-names.d.ts +37 -0
- package/dist/core/unmatched-tool-names.js +18 -0
- package/dist/core/untrusted-egress.d.ts +16 -5
- package/dist/core/untrusted-egress.js +202 -32
- package/dist/core/untrusted-text.d.ts +29 -8
- package/dist/core/untrusted-text.js +6 -3
- package/dist/core/user-attachment.d.ts +129 -35
- package/dist/core/user-attachment.js +124 -57
- package/dist/core/user-row-origin.d.ts +63 -0
- package/dist/core/user-row-origin.js +61 -0
- package/dist/core/wiring-manifest.d.ts +161 -39
- package/dist/core/wiring-manifest.js +42 -6
- package/dist/core/workflow-run-store-contract.d.ts +11 -1
- package/dist/core/workflow-run-store-contract.js +60 -7
- package/dist/core/workflow-run-store.d.ts +61 -12
- package/dist/core/workflow-run-store.js +100 -15
- package/dist/core/workspace-snapshot.d.ts +10 -14
- package/dist/core/workspace-snapshot.js +3 -22
- package/dist/core/write-protect.d.ts +3 -5
- package/dist/core/write-protect.js +2 -4
- package/dist/engine/compaction/compaction.d.ts +3 -0
- package/dist/engine/compaction/compaction.js +4 -3
- package/dist/engine/execution-env/node-execution-env.d.ts +15 -4
- package/dist/engine/execution-env/node-execution-env.js +80 -27
- package/dist/engine/harness/agent-harness.d.ts +143 -27
- package/dist/engine/harness/agent-harness.js +162 -74
- package/dist/engine/harness/types.d.ts +84 -13
- package/dist/engine/harness/types.js +21 -1
- package/dist/engine/llm/tool-turns.d.ts +4 -0
- package/dist/engine/llm/tool-turns.js +7 -2
- package/dist/engine/llm/types.d.ts +111 -24
- package/dist/engine/llm/types.js +69 -5
- package/dist/engine/llm/validation.js +2 -1
- package/dist/engine/loop/agent-loop.d.ts +39 -6
- package/dist/engine/loop/agent-loop.js +172 -82
- package/dist/engine/loop/types.d.ts +43 -4
- package/dist/engine/lsp/node-lsp-manager.d.ts +5 -3
- package/dist/engine/lsp/node-lsp-manager.js +14 -10
- package/dist/engine/session/import-validate.js +9 -0
- package/dist/engine/session/memory-repo.d.ts +8 -1
- package/dist/engine/session/memory-repo.js +20 -12
- package/dist/engine/session/repo-utils.d.ts +10 -0
- package/dist/engine/session/repo-utils.js +11 -5
- package/dist/engine/session/row-cells.d.ts +32 -0
- package/dist/engine/session/row-cells.js +25 -0
- package/dist/index.d.ts +63 -34
- package/dist/index.js +44 -21
- package/dist/internal/harness.d.ts +8 -6
- package/dist/internal/harness.js +6 -4
- package/dist/internal/llm.d.ts +2 -2
- package/dist/internal/llm.js +1 -1
- package/dist/orchestration/governance-baseline-validity.d.ts +7 -0
- package/dist/orchestration/governance-baseline-validity.js +33 -9
- package/dist/orchestration/run-workflow-tool.d.ts +2 -0
- package/dist/orchestration/run-workflow-tool.js +25 -12
- package/dist/orchestration/workflow-governance.d.ts +19 -4
- package/dist/orchestration/workflow-governance.js +30 -9
- package/dist/orchestration/workflow-primitives.d.ts +4 -1
- package/dist/orchestration/workflow-primitives.js +2 -2
- package/dist/orchestration/workflow-script-runner.d.ts +1 -1
- package/dist/orchestration/workflow-size-guideline.d.ts +1 -1
- package/dist/orchestration/workflow-types.d.ts +21 -12
- package/dist/orchestration/workflow-types.js +15 -4
- package/dist/orchestration/workflow.d.ts +37 -7
- package/dist/orchestration/workflow.js +81 -35
- package/dist/prompt-assembly/artifact-store.js +6 -9
- package/dist/prompt-assembly/assemble.d.ts +4 -10
- package/dist/prompt-assembly/assemble.js +1 -3
- package/dist/prompt-assembly/catalog/constitution.d.ts +0 -20
- package/dist/prompt-assembly/catalog/constitution.js +2 -0
- package/dist/prompt-assembly/catalog/core-behavior.js +5 -3
- package/dist/prompt-assembly/catalog/engine.d.ts +108 -0
- package/dist/prompt-assembly/catalog/engine.js +19 -0
- package/dist/prompt-assembly/catalog/environment.d.ts +276 -0
- package/dist/prompt-assembly/catalog/environment.js +61 -0
- package/dist/prompt-assembly/catalog/index.d.ts +9 -2
- package/dist/prompt-assembly/catalog/index.js +73 -2
- package/dist/prompt-assembly/catalog/locales/index.d.ts +16 -0
- package/dist/prompt-assembly/catalog/locales/index.js +22 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/constitution.d.ts +7 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/constitution.js +124 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/core-behavior.d.ts +6 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/core-behavior.js +120 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/cowork.d.ts +8 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/cowork.js +442 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/engine.d.ts +7 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/engine.js +15 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/environment.d.ts +7 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/environment.js +50 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/modes.d.ts +7 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/modes.js +163 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/role.d.ts +7 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/role.js +148 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/team.d.ts +6 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/team.js +246 -0
- package/dist/prompt-assembly/catalog/role.js +3 -6
- package/dist/prompt-assembly/catalog/schema.d.ts +23 -1
- package/dist/prompt-assembly/catalog/schema.js +2 -0
- package/dist/prompt-assembly/composer.d.ts +6 -11
- package/dist/prompt-assembly/composer.js +7 -7
- package/dist/prompt-assembly/engine-text.d.ts +9 -0
- package/dist/prompt-assembly/engine-text.js +33 -0
- package/dist/prompt-assembly/event-registry.js +3 -3
- package/dist/prompt-assembly/explain.d.ts +1 -0
- package/dist/prompt-assembly/explain.js +1 -1
- package/dist/prompt-assembly/locale-review.d.ts +13 -0
- package/dist/prompt-assembly/locale-review.js +19 -0
- package/dist/prompt-assembly/overlay.d.ts +7 -3
- package/dist/prompt-assembly/overlay.js +27 -5
- package/dist/prompt-assembly/renderers.d.ts +4 -4
- package/dist/prompt-assembly/renderers.js +26 -17
- package/dist/prompt-assembly/role-base.d.ts +1 -1
- package/dist/prompt-assembly/select.d.ts +26 -5
- package/dist/prompt-assembly/select.js +25 -2
- package/dist/prompt-assembly/slots.d.ts +19 -0
- package/dist/prompt-assembly/slots.js +16 -0
- package/dist/prompt-assembly/sugar.d.ts +4 -7
- package/dist/prompt-assembly/sugar.js +1 -2
- package/dist/prompt-assembly/tool-catalog.d.ts +5 -1
- package/dist/prompt-assembly/tool-catalog.js +5 -1
- package/dist/prompt-assembly/turn-snapshot.d.ts +38 -10
- package/dist/prompt-assembly/turn-snapshot.js +43 -13
- package/dist/prompt-assembly/types.d.ts +3 -0
- package/dist/prompts/cowork.d.ts +6 -25
- package/dist/prompts/cowork.js +10 -12
- package/dist/prompts/default.d.ts +10 -32
- package/dist/prompts/default.js +37 -63
- package/dist/shell/lex.d.ts +39 -13
- package/dist/shell/lex.js +70 -30
- package/dist/stores/file/background-agent-store.d.ts +5 -0
- package/dist/stores/file/background-agent-store.js +35 -61
- package/dist/stores/file/checkpoint-store.d.ts +5 -3
- package/dist/stores/file/checkpoint-store.js +8 -10
- package/dist/stores/file/fs-atomic.d.ts +27 -70
- package/dist/stores/file/fs-atomic.js +52 -148
- package/dist/stores/file/index.d.ts +12 -0
- package/dist/stores/file/index.js +27 -2
- package/dist/stores/file/mailbox-store.d.ts +10 -1
- package/dist/stores/file/mailbox-store.js +40 -12
- package/dist/stores/file/permission-rule-adopt.js +5 -2
- package/dist/stores/file/permission-rule-store.d.ts +81 -20
- package/dist/stores/file/permission-rule-store.js +126 -33
- package/dist/stores/file/session-policy-store.d.ts +2 -2
- package/dist/stores/file/session-store.d.ts +21 -2
- package/dist/stores/file/session-store.js +27 -14
- package/dist/stores/file/task-list-store.js +23 -25
- package/dist/stores/file/tool-result-store.d.ts +45 -7
- package/dist/stores/file/tool-result-store.js +99 -36
- package/dist/stores/file/workflow-run-store.d.ts +1 -0
- package/dist/stores/file/workflow-run-store.js +14 -11
- package/dist/tools/artifact/artifact-tool.js +2 -0
- package/dist/tools/artifact/local-stub.js +6 -6
- package/dist/tools/fs/bash-program-position.d.ts +1 -2
- package/dist/tools/fs/bash-readonly-classifier.d.ts +35 -0
- package/dist/tools/fs/bash-readonly-classifier.js +50 -12
- package/dist/tools/fs/env-error-detail.d.ts +1 -0
- package/dist/tools/fs/env-error-detail.js +7 -0
- package/dist/tools/fs/fs-bash.d.ts +24 -6
- package/dist/tools/fs/fs-bash.js +73 -25
- package/dist/tools/fs/fs-pdf.js +6 -4
- package/dist/tools/fs/fs-read.d.ts +76 -31
- package/dist/tools/fs/fs-read.js +159 -79
- package/dist/tools/fs/fs-search-tools.d.ts +1 -1
- package/dist/tools/fs/fs-search-tools.js +3 -1
- package/dist/tools/fs/fs-shared.d.ts +59 -63
- package/dist/tools/fs/fs-shared.js +31 -18
- package/dist/tools/fs/fs-write.d.ts +13 -0
- package/dist/tools/fs/fs-write.js +69 -13
- package/dist/tools/fs/index.d.ts +19 -1
- package/dist/tools/fs/index.js +10 -2
- package/dist/tools/fs/pdf.js +10 -9
- package/dist/tools/fs/read-deny.js +4 -10
- package/dist/tools/fs/read-floor.d.ts +5 -4
- package/dist/tools/fs/removal-targets.d.ts +11 -5
- package/dist/tools/fs/removal-targets.js +62 -32
- package/dist/tools/fs/safety.d.ts +26 -19
- package/dist/tools/fs/safety.js +13 -8
- package/dist/tools/fs/search.d.ts +1 -1
- package/dist/tools/fs/shell-read-argv.js +1 -0
- package/dist/tools/fs/shell-read-bindings.d.ts +128 -26
- package/dist/tools/fs/shell-read-bindings.js +667 -139
- package/dist/tools/fs/shell-read-check.js +1 -1
- package/dist/tools/fs/shell-read-judge.d.ts +4 -1
- package/dist/tools/fs/shell-read-judge.js +5 -1
- package/dist/tools/fs/shell-read-plan.d.ts +4 -0
- package/dist/tools/fs/shell-read-plan.js +21 -19
- package/dist/tools/fs/shell-read-sourced.d.ts +4 -3
- package/dist/tools/fs/shell-read-sourced.js +18 -1
- package/dist/tools/fs/shell-read-start.d.ts +6 -6
- package/dist/tools/fs/shell-read-start.js +1 -6
- package/dist/tools/fs/shell-read-word.d.ts +4 -2
- package/dist/tools/fs/shell-read-word.js +7 -6
- package/dist/tools/fs/shell-read-workdir.d.ts +1 -1
- package/dist/tools/fs/shell-reentry-text.d.ts +24 -9
- package/dist/tools/fs/shell-reentry-text.js +50 -20
- package/dist/tools/monitor.d.ts +4 -0
- package/dist/tools/monitor.js +14 -4
- package/dist/tools/scheduler-tools.d.ts +5 -2
- package/dist/tools/scheduler-tools.js +8 -6
- package/dist/tools/task-list.d.ts +49 -20
- package/dist/tools/task-list.js +115 -35
- package/dist/tools/web.d.ts +13 -3
- package/dist/tools/web.js +17 -6
- package/dist/tools/worktree.d.ts +3 -2
- package/dist/tools/worktree.js +24 -25
- package/package.json +10 -3
- package/test/export-surface.snapshot.json +330 -32
- package/wire-changes/core-stores-sql@7.66.1.json +30 -0
- package/wire-changes/core-stores-sql@7.67.0.json +39 -0
- package/wire-changes/core@7.66.1.json +46 -0
- package/wire-changes/core@7.67.0.json +12578 -0
- package/wire-changes/mods-kernel@7.66.1.json +30 -0
- package/wire-changes/mods-kernel@7.67.0.json +167 -0
- package/wire-changes/primitives@7.66.1.json +30 -0
- package/wire-changes/primitives@7.67.0.json +325 -0
- package/wire-changes/wiki-gate@7.67.0.json +1636 -0
- package/dist/brain/degrading.d.ts +0 -93
- package/dist/brain/degrading.js +0 -189
- package/dist/core/tool-conformance.d.ts +0 -20
- package/dist/core/tool-conformance.js +0 -37
|
@@ -133,17 +133,32 @@ interface DirVetting {
|
|
|
133
133
|
readonly platform?: NodeJS.Platform;
|
|
134
134
|
/** Said when the group/other-writable judgment was NOT made because the platform reports no permission bits. */
|
|
135
135
|
readonly modeBitsUnjudged?: (dir: string) => void;
|
|
136
|
+
/** `true` the first time this host meets the case-variant bucket name at `location`, `false` after: a refusal of one is disclosed once. */
|
|
137
|
+
readonly caseVariantFirstMet?: (location: string) => boolean;
|
|
136
138
|
}
|
|
137
|
-
/**
|
|
139
|
+
/** Where a bucket handle came from, as its write face reads it at every write. */
|
|
140
|
+
interface BucketHandleOrigin {
|
|
141
|
+
/** `full` — an owner door's handle ({@link FileDurableRulePartitionProvider.forPrincipal} / `forLocalOwner`): every write arm. `retire-only` —
|
|
142
|
+
* a listed bucket's handle ({@link FileDurableRulePartitionProvider.listBucketOwners}): it reads as every handle reads, and writes only
|
|
143
|
+
* the retirement of rows (a `tighten-delete`, and the `nextDot` its tombstone takes); it never creates a bucket. */
|
|
144
|
+
readonly posture: "full" | "retire-only";
|
|
145
|
+
/** Judged under the writer lock before every write: the directory still lets this handle write its file — the adoption marker does not
|
|
146
|
+
* name the file as the handle's door forbids (an owner door: as the source; a listed bucket: as the source or the target). */
|
|
147
|
+
readonly stillOpens: () => boolean;
|
|
148
|
+
}
|
|
149
|
+
/** One owner's rule file. */
|
|
138
150
|
declare class FileDurableRulePartition implements WritableDurableRulePartition {
|
|
139
151
|
private readonly dir;
|
|
140
152
|
private readonly file;
|
|
141
153
|
private readonly acquireWriteLock;
|
|
154
|
+
private readonly origin;
|
|
142
155
|
private readonly onError?;
|
|
143
156
|
private readonly vetting?;
|
|
144
157
|
readonly durability: StoreDurability;
|
|
145
158
|
readonly fidelity: StoreFidelity;
|
|
146
|
-
|
|
159
|
+
/** The bucket's file name, as the directory must spell its entry for the file to be read as this bucket. */
|
|
160
|
+
private readonly name;
|
|
161
|
+
constructor(dir: string, file: string, acquireWriteLock: () => void, origin: BucketHandleOrigin, onError?: ((message: string) => void) | undefined, vetting?: DirVetting | undefined);
|
|
147
162
|
/** Read and validate. Any refusal answers with an empty set AND says so — never a silent empty store. The answer's
|
|
148
163
|
* sentence names no location ({@link refusalText}); the disclosure that accompanies it does. */
|
|
149
164
|
private read;
|
|
@@ -179,6 +194,13 @@ declare class FileDurableRulePartition implements WritableDurableRulePartition {
|
|
|
179
194
|
* went wrong. Reads already answer zero rules for the same condition, so the lane stays fail-closed
|
|
180
195
|
* while a person looks at the file. A bucket a newer engine wrote is one of these: writing it in this
|
|
181
196
|
* engine's grammar would stamp rows this engine cannot read with a grammar that claims it can.
|
|
197
|
+
*
|
|
198
|
+
* Every write first holds the writer lock (taken again after a `dispose()`, refused while an adoption holds it) and, under it, asks
|
|
199
|
+
* the handle's origin whether the directory still lets it write this file. A handle opened before an adoption of its bucket began
|
|
200
|
+
* would otherwise write the retired source back into being: read past the flip it is a grave nothing reads, and while an adoption
|
|
201
|
+
* rests between its rename and its flip the readers read the revived source — the new row alone, every row the bucket held before
|
|
202
|
+
* (its denies too) gone from the view. A listed bucket's handle never creates its file: one that is gone refuses as a read that
|
|
203
|
+
* failed ({@link PERMISSION_RULES_UNREADABLE_BUCKET_CODE}, `errno` `ENOENT`), and the next census lists what is there.
|
|
182
204
|
*/
|
|
183
205
|
private current;
|
|
184
206
|
/**
|
|
@@ -199,6 +221,28 @@ declare class FileDurableRulePartition implements WritableDurableRulePartition {
|
|
|
199
221
|
get [PERMISSION_RULE_WRITER](): PermissionRuleWriter;
|
|
200
222
|
private readonly writer;
|
|
201
223
|
}
|
|
224
|
+
/** A bucket the directory cannot name, as the census classifies it: its id (the file name without `.json`) and the host's name for it. */
|
|
225
|
+
interface UnnamedBucket {
|
|
226
|
+
readonly bucketId: string;
|
|
227
|
+
readonly knownAs?: string;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* The census of a store directory from its entry names, the adoption record and the host's known names — a pure classification
|
|
231
|
+
* ({@link FileDurableRulePartitionProvider.listBucketOwners} reads the directory and hands each unnamed bucket its handle):
|
|
232
|
+
* - an entry spelled like a bucket in another letter case refuses the whole census (`caseVariant`, the first such name in sorted order);
|
|
233
|
+
* - `owners`: `local-owner` when its file is present, then the marker's target and its principal source when their files are present;
|
|
234
|
+
* - `unnamed`: every other digest-named entry, ascending by `bucketId`, each once; `knownAs` is the host's name whose digest names it —
|
|
235
|
+
* a label that never moves an entry out of the list.
|
|
236
|
+
*/
|
|
237
|
+
export declare function bucketCensusOf(names: Iterable<string>, rec: {
|
|
238
|
+
readonly from: RuleOwner;
|
|
239
|
+
readonly toPrincipal: string;
|
|
240
|
+
} | undefined, knownOwners: readonly string[]): {
|
|
241
|
+
readonly owners: readonly RuleOwner[];
|
|
242
|
+
readonly unnamed: readonly UnnamedBucket[];
|
|
243
|
+
} | {
|
|
244
|
+
readonly caseVariant: string;
|
|
245
|
+
};
|
|
202
246
|
/**
|
|
203
247
|
* The file-backed provider. One file per principal, named by a digest of the principal so no identity
|
|
204
248
|
* string ever becomes a path component.
|
|
@@ -234,11 +278,18 @@ export declare class FileDurableRulePartitionProvider implements DurableRulePart
|
|
|
234
278
|
* this provider's writer lock — an install is a write. */
|
|
235
279
|
/** {@link judgeRuleAdoptionFile} at request time (owner resolution runs on every read), in {@link refusalText}'s voice. */
|
|
236
280
|
private adoptionMarker;
|
|
281
|
+
/** The bucket files the adoption marker names ({@link adoptionBucketFiles}), read now; `undefined` without a marker. */
|
|
282
|
+
private markerFiles;
|
|
283
|
+
/** A handle's origin ({@link BucketHandleOrigin}) over the bucket file `name`: an owner door's handle may not write the file the marker
|
|
284
|
+
* names as its source; a listed bucket's handle may write neither file the marker names. */
|
|
285
|
+
private originOf;
|
|
237
286
|
orgStatePersistence(): OrgRuleStatePersistence;
|
|
238
287
|
private fileOrgPersistence;
|
|
239
288
|
/** Take the writer lock, once, on first use of a write face. Reading never calls this. */
|
|
240
289
|
private acquireWriteLock;
|
|
241
290
|
forPrincipal(principal: string | undefined): DurableRulePartition;
|
|
291
|
+
/** An owner door's handle over the bucket file `name`. */
|
|
292
|
+
private ownerPartition;
|
|
242
293
|
/** The read-only resolution of an adoption SOURCE: post-flip (phase ≥ 4 / terminal) always the
|
|
243
294
|
* target; pre-flip, whichever path currently holds the bytes (source first — it is the pre-flip
|
|
244
295
|
* truth when both somehow exist, which the resume path refuses loudly anyway). */
|
|
@@ -252,26 +303,32 @@ export declare class FileDurableRulePartitionProvider implements DurableRulePart
|
|
|
252
303
|
*/
|
|
253
304
|
forLocalOwner(): DurableRulePartition;
|
|
254
305
|
/**
|
|
255
|
-
*
|
|
256
|
-
*
|
|
257
|
-
* not skipped. Names only: no rule, tombstone or revision is read, and no bucket file is opened.
|
|
306
|
+
* Every bucket in this directory, once — the one listing a host that must visit every bucket (a one-time migration over the rules
|
|
307
|
+
* of every owner) reads. Names only: no rule, tombstone or revision is read, and no bucket file is opened.
|
|
258
308
|
*
|
|
259
|
-
* A bucket's file is named by a one-way digest of its owner (`principalRuleFileName`) and holds no owner name, so the
|
|
260
|
-
*
|
|
261
|
-
* the adoption marker names (the adopted principal, and a principal source) when their bucket file is present
|
|
262
|
-
* the renamed bucket is the adopted principal's
|
|
263
|
-
*
|
|
264
|
-
*
|
|
265
|
-
*
|
|
309
|
+
* A bucket's file is named by a one-way digest of its owner (`principalRuleFileName`) and holds no owner name, so the directory
|
|
310
|
+
* names an owner only by what it records, and `owners` is those: `local-owner` when the local-owner bucket file is present, then the
|
|
311
|
+
* principals the adoption marker names (the adopted principal, and a principal source) when their bucket file is present — after an
|
|
312
|
+
* adoption the renamed bucket is the adopted principal's whether or not any approval record named it. A host reads them through
|
|
313
|
+
* {@link forPrincipal} / {@link forLocalOwner} like any owner it knows.
|
|
314
|
+
*
|
|
315
|
+
* `unnamedBuckets` is every other bucket — present, digest-named, named by no adoption marker — ascending by `bucketId` (its file
|
|
316
|
+
* name without `.json`: an opaque key to report and compare, never parsed and never handed back), each once. Its `partition` is the
|
|
317
|
+
* list's own handle on that bucket, the only door to a bucket nobody can name: it does no I/O until it is used, reads as every
|
|
318
|
+
* handle reads, and writes only the retirement of rows — `nextDot` and an `apply` of a `tighten-delete`; every other write, and
|
|
319
|
+
* `readRaw`, refuses `config.invalid_argument`. It never creates its file: a bucket gone since the listing refuses the write
|
|
320
|
+
* {@link PERMISSION_RULES_UNREADABLE_BUCKET_CODE} with `errno` `ENOENT`; a bucket an adoption has since come to name refuses it too
|
|
321
|
+
* (no code — the next listing has it under `owners`).
|
|
266
322
|
*
|
|
267
323
|
* A host may know owners the directory does not record (a File store beside this one derives some from its own import records):
|
|
268
|
-
* `opts.knownOwners` hands those principal names over, and
|
|
269
|
-
* {@link principalRuleFileName}
|
|
270
|
-
*
|
|
271
|
-
*
|
|
272
|
-
*
|
|
273
|
-
*
|
|
274
|
-
* (`
|
|
324
|
+
* `opts.knownOwners` hands those principal names over, and an unnamed bucket the one digest names for one of them
|
|
325
|
+
* ({@link principalRuleFileName} — the host never computes a bucket name) carries it as `knownAs`, a label that never moves the
|
|
326
|
+
* bucket out of the list. `opts` is a plain object with that one member and a list of principal names ({@link principalNameOf}) —
|
|
327
|
+
* anything else refuses (`config.invalid_argument`) before the directory is looked at, rather than being read as "no known owners".
|
|
328
|
+
*
|
|
329
|
+
* Only a file whose name is spelled exactly as a bucket's is one: an entry spelled like a bucket in another letter case
|
|
330
|
+
* (`<HEX>.json`, `Local-Owner.json`) refuses the whole listing with {@link PERMISSION_RULES_DAMAGED_BUCKET_CODE}, its location
|
|
331
|
+
* disclosed once — a volume that ignores letter case would open it for its owner, and a census that skipped it would not be whole.
|
|
275
332
|
*
|
|
276
333
|
* Reading takes no lock and writes nothing. A directory this engine refuses to use refuses with
|
|
277
334
|
* {@link PERMISSION_RULES_DAMAGED_BUCKET_CODE}, as the read faces refuse it; a listing that failed to read refuses with
|
|
@@ -283,7 +340,11 @@ export declare class FileDurableRulePartitionProvider implements DurableRulePart
|
|
|
283
340
|
readonly knownOwners?: readonly string[];
|
|
284
341
|
}): {
|
|
285
342
|
readonly owners: readonly RuleOwner[];
|
|
286
|
-
readonly unnamedBuckets:
|
|
343
|
+
readonly unnamedBuckets: readonly {
|
|
344
|
+
readonly bucketId: string;
|
|
345
|
+
readonly knownAs?: string;
|
|
346
|
+
readonly partition: DurableRulePartition;
|
|
347
|
+
}[];
|
|
287
348
|
};
|
|
288
349
|
/** Release the writer lock. A long-lived deployment holds it for its lifetime; a test or a short-lived
|
|
289
350
|
* tool releases so the next holder is not told a live process owns the directory. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { closeSync, constants as FS, existsSync, fsyncSync, lstatSync, mkdirSync, openSync, readdirSync, readFileSync, renameSync, unlinkSync, writeFileSync } from "node:fs";
|
|
2
|
-
import { join } from "node:path";
|
|
2
|
+
import { basename, join } from "node:path";
|
|
3
3
|
import { createHash, randomBytes } from "node:crypto";
|
|
4
4
|
import { isRuleBehavior } from "../../core/permission-rule-model.js";
|
|
5
5
|
import { posixModeBitsMeaningful } from "../../core/posix-mode-face.js";
|
|
@@ -9,7 +9,7 @@ import { PERMISSION_RULES_DAMAGED_BUCKET_CODE, PERMISSION_RULES_LATER_GRAMMAR_CO
|
|
|
9
9
|
import { sameOrgPolicyContent } from "../../core/permission-rule-org.js";
|
|
10
10
|
import { SESSION_RULES_GRAMMAR, readRuleGrammarStamp } from "../../core/session-policy-store.js";
|
|
11
11
|
import { canonicalize } from "../../core/canonical-json.js";
|
|
12
|
-
import { BootLock, FileStoreLockError } from "./fs-atomic.js";
|
|
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";
|
|
15
15
|
import { describeFault, receive } from "../../core/mods/kernel/receive.js";
|
|
@@ -33,6 +33,23 @@ export class OrgRevisionRefusal extends Error {
|
|
|
33
33
|
}
|
|
34
34
|
const LOCAL_OWNER_FILE = "local-owner.json";
|
|
35
35
|
const HASHED_BUCKET_FILE = /^[0-9a-f]{64}\.json$/;
|
|
36
|
+
function isBucketFileName(name) {
|
|
37
|
+
return name === LOCAL_OWNER_FILE || HASHED_BUCKET_FILE.test(name);
|
|
38
|
+
}
|
|
39
|
+
function foldCase(s) {
|
|
40
|
+
return s.toUpperCase().toLowerCase();
|
|
41
|
+
}
|
|
42
|
+
function isCaseVariantBucketName(name) {
|
|
43
|
+
return !isBucketFileName(name) && isBucketFileName(foldCase(name));
|
|
44
|
+
}
|
|
45
|
+
const CASE_VARIANT_FAULT = "is named like a permission-rule bucket in another letter case — only a file spelled exactly as a bucket's name is one; rename it to lower case, or remove it";
|
|
46
|
+
function entrySpelling(dir, name) {
|
|
47
|
+
const entries = readdirSync(dir);
|
|
48
|
+
if (entries.includes(name))
|
|
49
|
+
return name;
|
|
50
|
+
const folded = foldCase(name);
|
|
51
|
+
return entries.find((entry) => foldCase(entry) === folded);
|
|
52
|
+
}
|
|
36
53
|
const ADOPTION_FILE = "PERMISSION-RULES-ADOPTION.json";
|
|
37
54
|
function judgeRuleAdoptionFile(dir) {
|
|
38
55
|
let raw;
|
|
@@ -165,6 +182,10 @@ function discloseTo(onError, message) {
|
|
|
165
182
|
catch {
|
|
166
183
|
}
|
|
167
184
|
}
|
|
185
|
+
function caseVariantRefusal(onError, vetting, sentence, location) {
|
|
186
|
+
const sink = vetting?.caseVariantFirstMet?.(location) === false ? undefined : onError;
|
|
187
|
+
return { unreadable: refusalText(sink, sentence, location), code: PERMISSION_RULES_DAMAGED_BUCKET_CODE };
|
|
188
|
+
}
|
|
168
189
|
function assertSafeDirAtRequest(dir, onError, act, vetting) {
|
|
169
190
|
let fault;
|
|
170
191
|
try {
|
|
@@ -179,9 +200,14 @@ function assertSafeDirAtRequest(dir, onError, act, vetting) {
|
|
|
179
200
|
function writerLockRefusal(err, onError) {
|
|
180
201
|
let sentence;
|
|
181
202
|
switch (err.code) {
|
|
182
|
-
case "store.dir_in_use":
|
|
183
|
-
|
|
203
|
+
case "store.dir_in_use": {
|
|
204
|
+
const unchecked = uncheckableOwnerClause(err);
|
|
205
|
+
sentence =
|
|
206
|
+
unchecked !== undefined
|
|
207
|
+
? `the permission-rule store's writer lock is held and ${unchecked} — refusing to interleave writes with it`
|
|
208
|
+
: `another live process${err.ownerPid !== undefined ? ` (pid ${err.ownerPid})` : ""} holds the permission-rule store's writer lock — refusing to interleave writes with it; write through that process, or stop it`;
|
|
184
209
|
break;
|
|
210
|
+
}
|
|
185
211
|
case "store.dir_claiming":
|
|
186
212
|
sentence = "another process is reclaiming the permission-rule store's writer lock from a crashed owner — retry";
|
|
187
213
|
break;
|
|
@@ -193,22 +219,29 @@ function writerLockRefusal(err, onError) {
|
|
|
193
219
|
sentence = `the permission-rule store's writer lock refused (${String(unhandled)})`;
|
|
194
220
|
}
|
|
195
221
|
}
|
|
196
|
-
return new FileStoreLockError(err.code, refusalText(onError, sentence, `${err.lockPath}: ${err.message}`), err.lockPath, err.ownerPid);
|
|
222
|
+
return new FileStoreLockError(err.code, refusalText(onError, sentence, `${err.lockPath}: ${err.message}`), err.lockPath, err.ownerPid, err.ownerUncheckable);
|
|
223
|
+
}
|
|
224
|
+
function retireOnlyRefusal(rest) {
|
|
225
|
+
return receiptRefusal(`a listed permission-rule bucket's handle only retires rows (a tighten-delete, and the nextDot its tombstone takes) — ${rest}`);
|
|
197
226
|
}
|
|
198
227
|
class FileDurableRulePartition {
|
|
199
228
|
dir;
|
|
200
229
|
file;
|
|
201
230
|
acquireWriteLock;
|
|
231
|
+
origin;
|
|
202
232
|
onError;
|
|
203
233
|
vetting;
|
|
204
234
|
durability = "durable";
|
|
205
235
|
fidelity = "json";
|
|
206
|
-
|
|
236
|
+
name;
|
|
237
|
+
constructor(dir, file, acquireWriteLock, origin, onError, vetting) {
|
|
207
238
|
this.dir = dir;
|
|
208
239
|
this.file = file;
|
|
209
240
|
this.acquireWriteLock = acquireWriteLock;
|
|
241
|
+
this.origin = origin;
|
|
210
242
|
this.onError = onError;
|
|
211
243
|
this.vetting = vetting;
|
|
244
|
+
this.name = basename(file);
|
|
212
245
|
}
|
|
213
246
|
read() {
|
|
214
247
|
const bucket = "this owner's permission-rule bucket";
|
|
@@ -222,6 +255,11 @@ class FileDurableRulePartition {
|
|
|
222
255
|
const st = lstatSync(this.file);
|
|
223
256
|
if (st.isSymbolicLink() || !st.isFile())
|
|
224
257
|
return unreadable(`${bucket} is a symlink or not a regular file; refusing to load any rule from it`);
|
|
258
|
+
const spelled = entrySpelling(this.dir, this.name);
|
|
259
|
+
if (spelled === undefined)
|
|
260
|
+
return { absent: true };
|
|
261
|
+
if (spelled !== this.name)
|
|
262
|
+
return caseVariantRefusal(this.onError, this.vetting, `the file ${bucket} would open ${CASE_VARIANT_FAULT}; loading zero rules`, join(this.dir, spelled));
|
|
225
263
|
raw = readFileSync(this.file, "utf8");
|
|
226
264
|
}
|
|
227
265
|
catch (err) {
|
|
@@ -306,11 +344,18 @@ class FileDurableRulePartition {
|
|
|
306
344
|
return "file" in r ? this.screenDurableRows(r.file).quarantined : [];
|
|
307
345
|
}
|
|
308
346
|
current() {
|
|
347
|
+
this.acquireWriteLock();
|
|
348
|
+
if (!this.origin.stillOpens()) {
|
|
349
|
+
throw new Error("this permission-rule bucket is no longer this handle's to write — an adoption names its file; open it again through its owner");
|
|
350
|
+
}
|
|
309
351
|
const r = this.read();
|
|
310
352
|
if ("unreadable" in r) {
|
|
311
353
|
throw unreadableError(r, `refusing to write the permission-rule store while it cannot be read: ${r.unreadable}`);
|
|
312
354
|
}
|
|
313
355
|
if ("absent" in r) {
|
|
356
|
+
if (this.origin.posture === "retire-only") {
|
|
357
|
+
throw unreadableError({ unreadable: refusalText(this.onError, "this listed permission-rule bucket is no longer there (ENOENT); refusing to write it — list the store directory again", this.file), code: PERMISSION_RULES_UNREADABLE_BUCKET_CODE, errno: "ENOENT" });
|
|
358
|
+
}
|
|
314
359
|
return { schemaVersion: 4, actor: `file-${randomBytes(6).toString("hex")}`, counter: 0, rev: 0, rules: [], tombstones: [] };
|
|
315
360
|
}
|
|
316
361
|
return {
|
|
@@ -349,6 +394,8 @@ class FileDurableRulePartition {
|
|
|
349
394
|
return dot;
|
|
350
395
|
}),
|
|
351
396
|
readRaw: async () => this.serialize(() => {
|
|
397
|
+
if (this.origin.posture === "retire-only")
|
|
398
|
+
throw retireOnlyRefusal("its raw sync state is read through its owner");
|
|
352
399
|
const cur = this.current();
|
|
353
400
|
const screened = this.screenDurableRows(cur);
|
|
354
401
|
return {
|
|
@@ -363,8 +410,12 @@ class FileDurableRulePartition {
|
|
|
363
410
|
}),
|
|
364
411
|
apply: async (delta, opts) => this.serialize(() => {
|
|
365
412
|
delta = structuredClone(delta);
|
|
413
|
+
const { expectedRev } = opts;
|
|
414
|
+
if (this.origin.posture === "retire-only" && delta?.kind !== "tighten-delete") {
|
|
415
|
+
throw retireOnlyRefusal("every other write goes through its owner");
|
|
416
|
+
}
|
|
366
417
|
const cur = this.current();
|
|
367
|
-
if (cur.rev !==
|
|
418
|
+
if (cur.rev !== expectedRev)
|
|
368
419
|
return { conflict: true, rev: cur.rev };
|
|
369
420
|
let next;
|
|
370
421
|
switch (delta.kind) {
|
|
@@ -442,12 +493,41 @@ function receiveKnownOwners(opts) {
|
|
|
442
493
|
const element = Object.hasOwn(list, index) ? list[index] : undefined;
|
|
443
494
|
const name = principalNameOf(element);
|
|
444
495
|
if (name === undefined) {
|
|
445
|
-
throw receiptRefusal(`listBucketOwners options.knownOwners[${index}] is not a principal name (got ${principalNameFault(element)}); refused rather than skipped — a skipped name would
|
|
496
|
+
throw receiptRefusal(`listBucketOwners options.knownOwners[${index}] is not a principal name (got ${principalNameFault(element)}); refused rather than skipped — a skipped name would leave its bucket unlabelled`);
|
|
446
497
|
}
|
|
447
498
|
names.add(name);
|
|
448
499
|
}
|
|
449
500
|
return [...names];
|
|
450
501
|
}
|
|
502
|
+
function adoptionBucketFiles(rec) {
|
|
503
|
+
return { source: rec.from.kind === "local-owner" ? LOCAL_OWNER_FILE : principalRuleFileName(rec.from.principal), target: principalRuleFileName(rec.toPrincipal) };
|
|
504
|
+
}
|
|
505
|
+
export function bucketCensusOf(names, rec, knownOwners) {
|
|
506
|
+
const present = new Set(names);
|
|
507
|
+
const [variant] = [...present].filter(isCaseVariantBucketName).sort();
|
|
508
|
+
if (variant !== undefined)
|
|
509
|
+
return { caseVariant: variant };
|
|
510
|
+
const owners = [];
|
|
511
|
+
if (present.has(LOCAL_OWNER_FILE))
|
|
512
|
+
owners.push({ kind: "local-owner" });
|
|
513
|
+
let named;
|
|
514
|
+
if (rec !== undefined) {
|
|
515
|
+
named = adoptionBucketFiles(rec);
|
|
516
|
+
if (present.has(named.target))
|
|
517
|
+
owners.push({ kind: "principal", principal: rec.toPrincipal });
|
|
518
|
+
if (rec.from.kind === "principal" && named.source !== named.target && present.has(named.source))
|
|
519
|
+
owners.push({ kind: "principal", principal: rec.from.principal });
|
|
520
|
+
}
|
|
521
|
+
const knownFiles = [];
|
|
522
|
+
for (const principal of knownOwners)
|
|
523
|
+
knownFiles.push({ file: principalRuleFileName(principal), principal });
|
|
524
|
+
const unnamed = [];
|
|
525
|
+
for (const name of [...present].filter((n) => HASHED_BUCKET_FILE.test(n) && n !== named?.source && n !== named?.target).sort()) {
|
|
526
|
+
const knownAs = knownFiles.find((known) => known.file === name)?.principal;
|
|
527
|
+
unnamed.push({ bucketId: name.slice(0, -".json".length), ...(knownAs !== undefined ? { knownAs } : {}) });
|
|
528
|
+
}
|
|
529
|
+
return { owners, unnamed };
|
|
530
|
+
}
|
|
451
531
|
export class FileDurableRulePartitionProvider {
|
|
452
532
|
dir;
|
|
453
533
|
onError;
|
|
@@ -461,6 +541,7 @@ export class FileDurableRulePartitionProvider {
|
|
|
461
541
|
if (options.dataRoot !== undefined)
|
|
462
542
|
assertAdoptionBootGate(options.dataRoot, "FileDurableRulePartitionProvider");
|
|
463
543
|
let said = false;
|
|
544
|
+
const caseVariantsMet = new Set();
|
|
464
545
|
this.vetting = {
|
|
465
546
|
platform: options.platform,
|
|
466
547
|
modeBitsUnjudged: (where) => {
|
|
@@ -469,6 +550,12 @@ export class FileDurableRulePartitionProvider {
|
|
|
469
550
|
said = true;
|
|
470
551
|
discloseTo(this.onError, `the permission-rule store directory is not checked for being writable by other accounts: this platform reports no POSIX permission bits, so who else can write there is not verified here (at ${where})`);
|
|
471
552
|
},
|
|
553
|
+
caseVariantFirstMet: (location) => {
|
|
554
|
+
if (caseVariantsMet.has(location))
|
|
555
|
+
return false;
|
|
556
|
+
caseVariantsMet.add(location);
|
|
557
|
+
return true;
|
|
558
|
+
},
|
|
472
559
|
};
|
|
473
560
|
}
|
|
474
561
|
adoptionMarker() {
|
|
@@ -479,6 +566,19 @@ export class FileDurableRulePartitionProvider {
|
|
|
479
566
|
}
|
|
480
567
|
return judged.marker;
|
|
481
568
|
}
|
|
569
|
+
markerFiles() {
|
|
570
|
+
const adoption = this.adoptionMarker();
|
|
571
|
+
return adoption === undefined ? undefined : adoptionBucketFiles("adopted" in adoption ? adoption.adopted : adoption.marker);
|
|
572
|
+
}
|
|
573
|
+
originOf(name, door) {
|
|
574
|
+
return {
|
|
575
|
+
posture: door === "owner" ? "full" : "retire-only",
|
|
576
|
+
stillOpens: () => {
|
|
577
|
+
const named = this.markerFiles();
|
|
578
|
+
return named === undefined || (named.source !== name && (door === "owner" || named.target !== name));
|
|
579
|
+
},
|
|
580
|
+
};
|
|
581
|
+
}
|
|
482
582
|
orgStatePersistence() {
|
|
483
583
|
return this.fileOrgPersistence();
|
|
484
584
|
}
|
|
@@ -515,11 +615,14 @@ export class FileDurableRulePartitionProvider {
|
|
|
515
615
|
return this.readOnlySourceView(principalRuleFileName(name), principalRuleFileName(rec.toPrincipal), "adopted" in adoption || adoption.marker.phase >= 4);
|
|
516
616
|
}
|
|
517
617
|
}
|
|
518
|
-
return
|
|
618
|
+
return this.ownerPartition(principalRuleFileName(name));
|
|
619
|
+
}
|
|
620
|
+
ownerPartition(name) {
|
|
621
|
+
return new FileDurableRulePartition(this.dir, join(this.dir, name), this.acquireWriteLock, this.originOf(name, "owner"), this.onError, this.vetting);
|
|
519
622
|
}
|
|
520
623
|
readOnlySourceView(sourceName, targetName, flipped) {
|
|
521
624
|
const pick = flipped ? targetName : existsSync(join(this.dir, sourceName)) ? sourceName : targetName;
|
|
522
|
-
return readOnlyRuleStoreView(
|
|
625
|
+
return readOnlyRuleStoreView(this.ownerPartition(pick));
|
|
523
626
|
}
|
|
524
627
|
forLocalOwner() {
|
|
525
628
|
const adoption = this.adoptionMarker();
|
|
@@ -529,7 +632,7 @@ export class FileDurableRulePartitionProvider {
|
|
|
529
632
|
return this.readOnlySourceView(LOCAL_OWNER_FILE, principalRuleFileName(rec.toPrincipal), "adopted" in adoption || adoption.marker.phase >= 4);
|
|
530
633
|
}
|
|
531
634
|
}
|
|
532
|
-
return
|
|
635
|
+
return this.ownerPartition(LOCAL_OWNER_FILE);
|
|
533
636
|
}
|
|
534
637
|
listBucketOwners(opts) {
|
|
535
638
|
const knownOwners = receiveKnownOwners(opts);
|
|
@@ -539,7 +642,7 @@ export class FileDurableRulePartitionProvider {
|
|
|
539
642
|
}
|
|
540
643
|
catch (err) {
|
|
541
644
|
if (err?.code === "ENOENT")
|
|
542
|
-
return Object.freeze({ owners: Object.freeze([]), unnamedBuckets:
|
|
645
|
+
return Object.freeze({ owners: Object.freeze([]), unnamedBuckets: Object.freeze([]) });
|
|
543
646
|
throw faulted(err, "examined");
|
|
544
647
|
}
|
|
545
648
|
let dirFault;
|
|
@@ -556,31 +659,21 @@ export class FileDurableRulePartitionProvider {
|
|
|
556
659
|
const rec = adoption === undefined ? undefined : "adopted" in adoption ? adoption.adopted : adoption.marker;
|
|
557
660
|
let names;
|
|
558
661
|
try {
|
|
559
|
-
names =
|
|
662
|
+
names = readdirSync(this.dir);
|
|
560
663
|
}
|
|
561
664
|
catch (err) {
|
|
562
665
|
throw faulted(err, "listed");
|
|
563
666
|
}
|
|
564
|
-
const
|
|
565
|
-
if (
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
const
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
if (!names.has(file))
|
|
575
|
-
continue;
|
|
576
|
-
claimed.add(file);
|
|
577
|
-
owners.push({ kind: "principal", principal });
|
|
578
|
-
}
|
|
579
|
-
let unnamedBuckets = 0;
|
|
580
|
-
for (const name of names)
|
|
581
|
-
if (HASHED_BUCKET_FILE.test(name) && !claimed.has(name))
|
|
582
|
-
unnamedBuckets++;
|
|
583
|
-
return Object.freeze({ owners: Object.freeze(owners), unnamedBuckets });
|
|
667
|
+
const census = bucketCensusOf(names, rec, knownOwners);
|
|
668
|
+
if ("caseVariant" in census) {
|
|
669
|
+
throw unreadableError(caseVariantRefusal(this.onError, this.vetting, `a file in the permission-rule store directory ${CASE_VARIANT_FAULT}; refusing to list its buckets`, join(this.dir, census.caseVariant)));
|
|
670
|
+
}
|
|
671
|
+
const unnamedBuckets = census.unnamed.map(({ bucketId, knownAs }) => {
|
|
672
|
+
const file = `${bucketId}.json`;
|
|
673
|
+
const partition = new FileDurableRulePartition(this.dir, join(this.dir, file), this.acquireWriteLock, this.originOf(file, "listed"), this.onError, this.vetting);
|
|
674
|
+
return Object.freeze({ bucketId, ...(knownAs !== undefined ? { knownAs } : {}), partition });
|
|
675
|
+
});
|
|
676
|
+
return Object.freeze({ owners: Object.freeze([...census.owners]), unnamedBuckets: Object.freeze(unnamedBuckets) });
|
|
584
677
|
}
|
|
585
678
|
dispose() {
|
|
586
679
|
this.lock?.release();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type PutRulesOptions, type SessionPolicyStoreOptions, type
|
|
1
|
+
import { type PutRulesOptions, type SessionPolicyStoreOptions, type SessionPolicyStore, type SessionRulesInGrammar, type SessionRulesRecord, type StoredSessionRules } from "../../core/session-policy-store.js";
|
|
2
2
|
/**
|
|
3
3
|
* design/99 §E6 — file-backed {@link SessionPolicyStore} for the local (TOC) backend: one JSON row file per
|
|
4
4
|
* `(sessionId, principal)`, plus — once that key has ever been stamped — a second, tiny file beside it holding
|
|
@@ -196,7 +196,7 @@ export declare class FileSessionPolicyStore implements SessionPolicyStore {
|
|
|
196
196
|
* ABSENCE (ENOENT — also a row unlinked under a sweep, an honest absence). Every face reads a row through here. */
|
|
197
197
|
private readRowFile;
|
|
198
198
|
getRules(sessionId: string, principal?: string): Promise<StoredSessionRules | null>;
|
|
199
|
-
putRules(sessionId: string, principal: string | undefined, rules:
|
|
199
|
+
putRules(sessionId: string, principal: string | undefined, rules: SessionRulesInGrammar, opts?: PutRulesOptions): Promise<StoredSessionRules>;
|
|
200
200
|
listBySession(sessionId: string): Promise<SessionRulesRecord[]>;
|
|
201
201
|
deleteBySession(sessionId: string): Promise<void>;
|
|
202
202
|
/** Erase ONE row this session owns: the number must outlive it, so it is folded into the key's mark BEFORE the
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Session, SessionCreateOptions, SessionForkOptions, SessionHead, SessionMetadata, SessionPlacementRecord, SessionRepo, SessionRow, SessionRowExpectation, SessionRowRead, SessionTreeEntry } from "../../internal/harness.js";
|
|
2
|
-
import type
|
|
1
|
+
import type { Session, SessionCreateOptions, SessionForkOptions, SessionHead, SessionMetadata, SessionPlacementRecord, SessionRepo, SessionRepoRowCells, SessionRow, SessionRowExpectation, SessionRowRead, SessionTreeEntry } from "../../internal/harness.js";
|
|
2
|
+
import { type PlacedSessionRow } from "../../core/session.js";
|
|
3
3
|
import { type CorruptReadInfo } from "./corrupt-read-sink.js";
|
|
4
4
|
export interface FileSessionRepoOptions {
|
|
5
5
|
/**
|
|
@@ -24,6 +24,15 @@ export interface FileSessionRepoOptions {
|
|
|
24
24
|
onCorruptRead?: (info: CorruptReadInfo & {
|
|
25
25
|
sessionId?: string;
|
|
26
26
|
}) => void;
|
|
27
|
+
/**
|
|
28
|
+
* Who holds the rows' occupant cells ({@link SessionRepoRowCells}). Absent / `"engine"`: this repo — a row's header records its
|
|
29
|
+
* `incarnation` (and a fork's `forkedFromIncarnation`) and every read hands them out. `"host"`: the host's own store — a content repo:
|
|
30
|
+
* no header this repo writes holds either cell, no read hands either out (a header an engine-mode write laid down is read without
|
|
31
|
+
* them, and a cell there that names nobody is not disclosed), the shared authority over a file is judged by the file alone, and a
|
|
32
|
+
* conditional write by the owner and the log. The host's session store then puts the occupant on the metadata its sessions answer
|
|
33
|
+
* and on its head read; `TtlSessionStore` refuses a repo of this mode.
|
|
34
|
+
*/
|
|
35
|
+
rowCells?: SessionRepoRowCells;
|
|
27
36
|
}
|
|
28
37
|
export declare class FileSessionRepo implements SessionRepo {
|
|
29
38
|
private readonly dir;
|
|
@@ -33,6 +42,8 @@ export declare class FileSessionRepo implements SessionRepo {
|
|
|
33
42
|
* `dispose()` walks it and releases each holder share; the weak value is what makes the identity
|
|
34
43
|
* check on the way out possible without pinning a storage the table itself only holds weakly. */
|
|
35
44
|
private readonly joined;
|
|
45
|
+
/** {@link FileSessionRepoOptions.rowCells}, read once. */
|
|
46
|
+
readonly rowCells: SessionRepoRowCells;
|
|
36
47
|
constructor(root: string, options?: FileSessionRepoOptions);
|
|
37
48
|
/** The one delivery point for {@link FileSessionRepoOptions.onCorruptRead}'s whole-file level; `sessionId` when the file is one session's log. */
|
|
38
49
|
private disclose;
|
|
@@ -60,6 +71,8 @@ export declare class FileSessionRepo implements SessionRepo {
|
|
|
60
71
|
* whose placement cell is no placement tuple ({@link readPlacementCell}): the placement is the cell that says which lane the row lives
|
|
61
72
|
* in, so every reader of the row, of any other cell, goes through its judge. The other cells are each read by their own reader
|
|
62
73
|
* ({@link headerOf} for the whole header, `placementOf` for the placement tuple alone): a reader of one cell does not answer for the others.
|
|
74
|
+
* The header is read as this repo holds a row ({@link heldRowCells}): every reader of a cell reads it here, so in `"host"` mode no reader
|
|
75
|
+
* sees an occupant cell an engine-mode write left behind.
|
|
63
76
|
*/
|
|
64
77
|
private metaLineOf;
|
|
65
78
|
/**
|
|
@@ -141,6 +154,12 @@ export declare class FileSessionRepo implements SessionRepo {
|
|
|
141
154
|
* refuse that row; this probe is not one of them). `undefined` = missing file OR unplaced; a log with no header record rejects. */
|
|
142
155
|
placementOf(sessionId: string): Promise<SessionPlacementRecord | undefined>;
|
|
143
156
|
delete(metadata: SessionMetadata, expect?: SessionRowExpectation): Promise<void>;
|
|
157
|
+
/** {@link SessionRepo.deleteUnreadable}: the head read and the removal are one synchronous step (no await between them, so no write of
|
|
158
|
+
* this process lands in between; another process is kept off the root by its boot lock) — a row that reads in this step, or no row,
|
|
159
|
+
* is never removed. */
|
|
160
|
+
deleteUnreadable(sessionId: string): Promise<boolean>;
|
|
161
|
+
/** The one removal tail of every deletion here: the shared authority evicted, then the file removed — a failure loud. */
|
|
162
|
+
private removeRow;
|
|
144
163
|
fork(sourceMetadata: SessionMetadata, options?: SessionForkOptions & SessionCreateOptions): Promise<Session>;
|
|
145
164
|
/** 2c session-sync (the FILE half): the FULL oldest-first log for export. The file backend
|
|
146
165
|
* has NO F3 floor — `read` returns EVERY persisted entry (`id`/`parentId` verbatim) — so this is the complete
|