@maiaos/node 0.1.0-canary.44938d4.manual.1
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/README.md +517 -0
- package/dist/admin-monitor/application-projection.d.ts +27 -0
- package/dist/admin-monitor/application-projection.d.ts.map +1 -0
- package/dist/admin-monitor/application-projection.js +299 -0
- package/dist/admin-monitor/application-projection.js.map +1 -0
- package/dist/admin-monitor/application-reads.d.ts +20 -0
- package/dist/admin-monitor/application-reads.d.ts.map +1 -0
- package/dist/admin-monitor/application-reads.js +82 -0
- package/dist/admin-monitor/application-reads.js.map +1 -0
- package/dist/admin-monitor/assets.d.ts +7 -0
- package/dist/admin-monitor/assets.d.ts.map +1 -0
- package/dist/admin-monitor/assets.js +506 -0
- package/dist/admin-monitor/assets.js.map +1 -0
- package/dist/admin-monitor/housekeeping.d.ts +12 -0
- package/dist/admin-monitor/housekeeping.d.ts.map +1 -0
- package/dist/admin-monitor/housekeeping.js +59 -0
- package/dist/admin-monitor/housekeeping.js.map +1 -0
- package/dist/admin-monitor/http.d.ts +22 -0
- package/dist/admin-monitor/http.d.ts.map +1 -0
- package/dist/admin-monitor/http.js +219 -0
- package/dist/admin-monitor/http.js.map +1 -0
- package/dist/admin-monitor/listener.d.ts +9 -0
- package/dist/admin-monitor/listener.d.ts.map +1 -0
- package/dist/admin-monitor/listener.js +118 -0
- package/dist/admin-monitor/listener.js.map +1 -0
- package/dist/admin-monitor/model.d.ts +71 -0
- package/dist/admin-monitor/model.d.ts.map +1 -0
- package/dist/admin-monitor/model.js +31 -0
- package/dist/admin-monitor/model.js.map +1 -0
- package/dist/admin-monitor/projection.d.ts +10 -0
- package/dist/admin-monitor/projection.d.ts.map +1 -0
- package/dist/admin-monitor/projection.js +48 -0
- package/dist/admin-monitor/projection.js.map +1 -0
- package/dist/admin-monitor/routes.d.ts +13 -0
- package/dist/admin-monitor/routes.d.ts.map +1 -0
- package/dist/admin-monitor/routes.js +290 -0
- package/dist/admin-monitor/routes.js.map +1 -0
- package/dist/admin-monitor/service.d.ts +5 -0
- package/dist/admin-monitor/service.d.ts.map +1 -0
- package/dist/admin-monitor/service.js +155 -0
- package/dist/admin-monitor/service.js.map +1 -0
- package/dist/application/control-request.d.ts +38 -0
- package/dist/application/control-request.d.ts.map +1 -0
- package/dist/application/control-request.js +164 -0
- package/dist/application/control-request.js.map +1 -0
- package/dist/application/run-desktop-node.d.ts +18 -0
- package/dist/application/run-desktop-node.d.ts.map +1 -0
- package/dist/application/run-desktop-node.js +482 -0
- package/dist/application/run-desktop-node.js.map +1 -0
- package/dist/bin/maia-node.NOTICES.txt +100 -0
- package/dist/bin/maia-node.cdx.json +273 -0
- package/dist/bin/maia-node.d.ts +3 -0
- package/dist/bin/maia-node.d.ts.map +1 -0
- package/dist/bin/maia-node.meta.json +1 -0
- package/dist/bin/maia-node.mjs +4546 -0
- package/dist/bin/maia-node.mjs.map +6 -0
- package/dist/bin/maia-node.release.json +90 -0
- package/dist/bin/maia-process-host-darwin-arm64 +0 -0
- package/dist/bin/maia-process-host-darwin-arm64.build.json +59 -0
- package/dist/command-receipt/storage/codec.d.ts +16 -0
- package/dist/command-receipt/storage/codec.d.ts.map +1 -0
- package/dist/command-receipt/storage/codec.js +51 -0
- package/dist/command-receipt/storage/codec.js.map +1 -0
- package/dist/command-receipt/storage/cursor.d.ts +7 -0
- package/dist/command-receipt/storage/cursor.d.ts.map +1 -0
- package/dist/command-receipt/storage/cursor.js +62 -0
- package/dist/command-receipt/storage/cursor.js.map +1 -0
- package/dist/command-receipt/storage/list.d.ts +28 -0
- package/dist/command-receipt/storage/list.d.ts.map +1 -0
- package/dist/command-receipt/storage/list.js +113 -0
- package/dist/command-receipt/storage/list.js.map +1 -0
- package/dist/configuration/document-role.d.ts +4 -0
- package/dist/configuration/document-role.d.ts.map +1 -0
- package/dist/configuration/document-role.js +10 -0
- package/dist/configuration/document-role.js.map +1 -0
- package/dist/configuration/filesystem.d.ts +27 -0
- package/dist/configuration/filesystem.d.ts.map +1 -0
- package/dist/configuration/filesystem.js +227 -0
- package/dist/configuration/filesystem.js.map +1 -0
- package/dist/configuration/model.d.ts +68 -0
- package/dist/configuration/model.d.ts.map +1 -0
- package/dist/configuration/model.js +2 -0
- package/dist/configuration/model.js.map +1 -0
- package/dist/configuration/parser.d.ts +49 -0
- package/dist/configuration/parser.d.ts.map +1 -0
- package/dist/configuration/parser.js +35 -0
- package/dist/configuration/parser.js.map +1 -0
- package/dist/configuration/policy.d.ts +15 -0
- package/dist/configuration/policy.d.ts.map +1 -0
- package/dist/configuration/policy.js +15 -0
- package/dist/configuration/policy.js.map +1 -0
- package/dist/configuration/resolver.d.ts +15 -0
- package/dist/configuration/resolver.d.ts.map +1 -0
- package/dist/configuration/resolver.js +260 -0
- package/dist/configuration/resolver.js.map +1 -0
- package/dist/configuration/writer-child.d.ts +2 -0
- package/dist/configuration/writer-child.d.ts.map +1 -0
- package/dist/configuration/writer-child.js +32 -0
- package/dist/configuration/writer-child.js.map +1 -0
- package/dist/configuration/writer.d.ts +15 -0
- package/dist/configuration/writer.d.ts.map +1 -0
- package/dist/configuration/writer.js +789 -0
- package/dist/configuration/writer.js.map +1 -0
- package/dist/execution/application.d.ts +135 -0
- package/dist/execution/application.d.ts.map +1 -0
- package/dist/execution/application.js +14 -0
- package/dist/execution/application.js.map +1 -0
- package/dist/execution/database-operations.d.ts +15 -0
- package/dist/execution/database-operations.d.ts.map +1 -0
- package/dist/execution/database-operations.js +9 -0
- package/dist/execution/database-operations.js.map +1 -0
- package/dist/execution/request-digest.d.ts +3 -0
- package/dist/execution/request-digest.d.ts.map +1 -0
- package/dist/execution/request-digest.js +22 -0
- package/dist/execution/request-digest.js.map +1 -0
- package/dist/execution/service.d.ts +14 -0
- package/dist/execution/service.d.ts.map +1 -0
- package/dist/execution/service.js +19 -0
- package/dist/execution/service.js.map +1 -0
- package/dist/execution/storage.d.ts +20 -0
- package/dist/execution/storage.d.ts.map +1 -0
- package/dist/execution/storage.js +349 -0
- package/dist/execution/storage.js.map +1 -0
- package/dist/harness/application/requests.d.ts +304 -0
- package/dist/harness/application/requests.d.ts.map +1 -0
- package/dist/harness/application/requests.js +45 -0
- package/dist/harness/application/requests.js.map +1 -0
- package/dist/harness/codex/lifecycle.d.ts +39 -0
- package/dist/harness/codex/lifecycle.d.ts.map +1 -0
- package/dist/harness/codex/lifecycle.js +55 -0
- package/dist/harness/codex/lifecycle.js.map +1 -0
- package/dist/harness/codex/observability.d.ts +6 -0
- package/dist/harness/codex/observability.d.ts.map +1 -0
- package/dist/harness/codex/observability.js +58 -0
- package/dist/harness/codex/observability.js.map +1 -0
- package/dist/harness/codex/policy.d.ts +15 -0
- package/dist/harness/codex/policy.d.ts.map +1 -0
- package/dist/harness/codex/policy.js +15 -0
- package/dist/harness/codex/policy.js.map +1 -0
- package/dist/harness/codex/probe.d.ts +173 -0
- package/dist/harness/codex/probe.d.ts.map +1 -0
- package/dist/harness/codex/probe.js +134 -0
- package/dist/harness/codex/probe.js.map +1 -0
- package/dist/harness/codex/protocol.d.ts +15 -0
- package/dist/harness/codex/protocol.d.ts.map +1 -0
- package/dist/harness/codex/protocol.js +52 -0
- package/dist/harness/codex/protocol.js.map +1 -0
- package/dist/harness/codex/service.d.ts +196 -0
- package/dist/harness/codex/service.d.ts.map +1 -0
- package/dist/harness/codex/service.js +141 -0
- package/dist/harness/codex/service.js.map +1 -0
- package/dist/harness/codex/session-lifecycle.d.ts +40 -0
- package/dist/harness/codex/session-lifecycle.d.ts.map +1 -0
- package/dist/harness/codex/session-lifecycle.js +39 -0
- package/dist/harness/codex/session-lifecycle.js.map +1 -0
- package/dist/harness/codex/session-observability.d.ts +7 -0
- package/dist/harness/codex/session-observability.d.ts.map +1 -0
- package/dist/harness/codex/session-observability.js +39 -0
- package/dist/harness/codex/session-observability.js.map +1 -0
- package/dist/harness/codex/session-protocol.d.ts +92 -0
- package/dist/harness/codex/session-protocol.d.ts.map +1 -0
- package/dist/harness/codex/session-protocol.js +475 -0
- package/dist/harness/codex/session-protocol.js.map +1 -0
- package/dist/harness/codex/session-service.d.ts +59 -0
- package/dist/harness/codex/session-service.d.ts.map +1 -0
- package/dist/harness/codex/session-service.js +340 -0
- package/dist/harness/codex/session-service.js.map +1 -0
- package/dist/harness/codex/session-transport.d.ts +22 -0
- package/dist/harness/codex/session-transport.d.ts.map +1 -0
- package/dist/harness/codex/session-transport.js +152 -0
- package/dist/harness/codex/session-transport.js.map +1 -0
- package/dist/harness/codex/transport.d.ts +104 -0
- package/dist/harness/codex/transport.d.ts.map +1 -0
- package/dist/harness/codex/transport.js +645 -0
- package/dist/harness/codex/transport.js.map +1 -0
- package/dist/harness/codex/turn/lifecycle.d.ts +40 -0
- package/dist/harness/codex/turn/lifecycle.d.ts.map +1 -0
- package/dist/harness/codex/turn/lifecycle.js +43 -0
- package/dist/harness/codex/turn/lifecycle.js.map +1 -0
- package/dist/harness/codex/turn/observability.d.ts +8 -0
- package/dist/harness/codex/turn/observability.d.ts.map +1 -0
- package/dist/harness/codex/turn/observability.js +63 -0
- package/dist/harness/codex/turn/observability.js.map +1 -0
- package/dist/harness/codex/turn/transport.d.ts +21 -0
- package/dist/harness/codex/turn/transport.d.ts.map +1 -0
- package/dist/harness/codex/turn/transport.js +387 -0
- package/dist/harness/codex/turn/transport.js.map +1 -0
- package/dist/harness/installed/catalog.d.ts +30 -0
- package/dist/harness/installed/catalog.d.ts.map +1 -0
- package/dist/harness/installed/catalog.js +29 -0
- package/dist/harness/installed/catalog.js.map +1 -0
- package/dist/harness/installed/policy.d.ts +23 -0
- package/dist/harness/installed/policy.d.ts.map +1 -0
- package/dist/harness/installed/policy.js +29 -0
- package/dist/harness/installed/policy.js.map +1 -0
- package/dist/harness/installed/resolver.d.ts +39 -0
- package/dist/harness/installed/resolver.d.ts.map +1 -0
- package/dist/harness/installed/resolver.js +93 -0
- package/dist/harness/installed/resolver.js.map +1 -0
- package/dist/harness/installed/scan.d.ts +61 -0
- package/dist/harness/installed/scan.d.ts.map +1 -0
- package/dist/harness/installed/scan.js +327 -0
- package/dist/harness/installed/scan.js.map +1 -0
- package/dist/harness/installed/service.d.ts +99 -0
- package/dist/harness/installed/service.d.ts.map +1 -0
- package/dist/harness/installed/service.js +206 -0
- package/dist/harness/installed/service.js.map +1 -0
- package/dist/harness/pi-rpc/artifact.d.ts +57 -0
- package/dist/harness/pi-rpc/artifact.d.ts.map +1 -0
- package/dist/harness/pi-rpc/artifact.js +431 -0
- package/dist/harness/pi-rpc/artifact.js.map +1 -0
- package/dist/harness/pi-rpc/authorization/authorization-store.d.ts +41 -0
- package/dist/harness/pi-rpc/authorization/authorization-store.d.ts.map +1 -0
- package/dist/harness/pi-rpc/authorization/authorization-store.js +235 -0
- package/dist/harness/pi-rpc/authorization/authorization-store.js.map +1 -0
- package/dist/harness/pi-rpc/authorization/database.d.ts +99 -0
- package/dist/harness/pi-rpc/authorization/database.d.ts.map +1 -0
- package/dist/harness/pi-rpc/authorization/database.js +94 -0
- package/dist/harness/pi-rpc/authorization/database.js.map +1 -0
- package/dist/harness/pi-rpc/authorization/index.d.ts +7 -0
- package/dist/harness/pi-rpc/authorization/index.d.ts.map +1 -0
- package/dist/harness/pi-rpc/authorization/index.js +6 -0
- package/dist/harness/pi-rpc/authorization/index.js.map +1 -0
- package/dist/harness/pi-rpc/authorization/permit-compaction-store.d.ts +3 -0
- package/dist/harness/pi-rpc/authorization/permit-compaction-store.d.ts.map +1 -0
- package/dist/harness/pi-rpc/authorization/permit-compaction-store.js +61 -0
- package/dist/harness/pi-rpc/authorization/permit-compaction-store.js.map +1 -0
- package/dist/harness/pi-rpc/authorization/permit-store.d.ts +38 -0
- package/dist/harness/pi-rpc/authorization/permit-store.d.ts.map +1 -0
- package/dist/harness/pi-rpc/authorization/permit-store.js +310 -0
- package/dist/harness/pi-rpc/authorization/permit-store.js.map +1 -0
- package/dist/harness/pi-rpc/authorization/plan-store.d.ts +14 -0
- package/dist/harness/pi-rpc/authorization/plan-store.d.ts.map +1 -0
- package/dist/harness/pi-rpc/authorization/plan-store.js +205 -0
- package/dist/harness/pi-rpc/authorization/plan-store.js.map +1 -0
- package/dist/harness/pi-rpc/authorization/policy.d.ts +18 -0
- package/dist/harness/pi-rpc/authorization/policy.d.ts.map +1 -0
- package/dist/harness/pi-rpc/authorization/policy.js +131 -0
- package/dist/harness/pi-rpc/authorization/policy.js.map +1 -0
- package/dist/harness/pi-rpc/authorization/projection.d.ts +7 -0
- package/dist/harness/pi-rpc/authorization/projection.d.ts.map +1 -0
- package/dist/harness/pi-rpc/authorization/projection.js +195 -0
- package/dist/harness/pi-rpc/authorization/projection.js.map +1 -0
- package/dist/harness/pi-rpc/authorization/recovery-store.d.ts +3 -0
- package/dist/harness/pi-rpc/authorization/recovery-store.d.ts.map +1 -0
- package/dist/harness/pi-rpc/authorization/recovery-store.js +63 -0
- package/dist/harness/pi-rpc/authorization/recovery-store.js.map +1 -0
- package/dist/harness/pi-rpc/authorization/replay-store.d.ts +11 -0
- package/dist/harness/pi-rpc/authorization/replay-store.d.ts.map +1 -0
- package/dist/harness/pi-rpc/authorization/replay-store.js +60 -0
- package/dist/harness/pi-rpc/authorization/replay-store.js.map +1 -0
- package/dist/harness/pi-rpc/authorization/types.d.ts +117 -0
- package/dist/harness/pi-rpc/authorization/types.d.ts.map +1 -0
- package/dist/harness/pi-rpc/authorization/types.js +3 -0
- package/dist/harness/pi-rpc/authorization/types.js.map +1 -0
- package/dist/harness/pi-rpc/contract.d.ts +86 -0
- package/dist/harness/pi-rpc/contract.d.ts.map +1 -0
- package/dist/harness/pi-rpc/contract.js +206 -0
- package/dist/harness/pi-rpc/contract.js.map +1 -0
- package/dist/harness/pi-rpc/conversation.d.ts +129 -0
- package/dist/harness/pi-rpc/conversation.d.ts.map +1 -0
- package/dist/harness/pi-rpc/conversation.js +885 -0
- package/dist/harness/pi-rpc/conversation.js.map +1 -0
- package/dist/harness/pi-rpc/jsonl.d.ts +16 -0
- package/dist/harness/pi-rpc/jsonl.d.ts.map +1 -0
- package/dist/harness/pi-rpc/jsonl.js +115 -0
- package/dist/harness/pi-rpc/jsonl.js.map +1 -0
- package/dist/harness/pi-rpc/managed-process.d.ts +13 -0
- package/dist/harness/pi-rpc/managed-process.d.ts.map +1 -0
- package/dist/harness/pi-rpc/managed-process.js +64 -0
- package/dist/harness/pi-rpc/managed-process.js.map +1 -0
- package/dist/harness/pi-rpc/manifest-order.d.ts +7 -0
- package/dist/harness/pi-rpc/manifest-order.d.ts.map +1 -0
- package/dist/harness/pi-rpc/manifest-order.js +11 -0
- package/dist/harness/pi-rpc/manifest-order.js.map +1 -0
- package/dist/harness/pi-rpc/probe.d.ts +18 -0
- package/dist/harness/pi-rpc/probe.d.ts.map +1 -0
- package/dist/harness/pi-rpc/probe.js +168 -0
- package/dist/harness/pi-rpc/probe.js.map +1 -0
- package/dist/harness/pi-rpc/runtime-probe.d.ts +93 -0
- package/dist/harness/pi-rpc/runtime-probe.d.ts.map +1 -0
- package/dist/harness/pi-rpc/runtime-probe.js +381 -0
- package/dist/harness/pi-rpc/runtime-probe.js.map +1 -0
- package/dist/harness/pi-rpc/session-launch.d.ts +46 -0
- package/dist/harness/pi-rpc/session-launch.d.ts.map +1 -0
- package/dist/harness/pi-rpc/session-launch.js +547 -0
- package/dist/harness/pi-rpc/session-launch.js.map +1 -0
- package/dist/harness/pi-rpc/session-service.d.ts +71 -0
- package/dist/harness/pi-rpc/session-service.d.ts.map +1 -0
- package/dist/harness/pi-rpc/session-service.js +336 -0
- package/dist/harness/pi-rpc/session-service.js.map +1 -0
- package/dist/index.d.ts +49 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +173 -0
- package/dist/index.js.map +1 -0
- package/dist/integration-authorization/application.d.ts +56 -0
- package/dist/integration-authorization/application.d.ts.map +1 -0
- package/dist/integration-authorization/application.js +185 -0
- package/dist/integration-authorization/application.js.map +1 -0
- package/dist/integration-authorization/pi-rpc-application.d.ts +46 -0
- package/dist/integration-authorization/pi-rpc-application.d.ts.map +1 -0
- package/dist/integration-authorization/pi-rpc-application.js +201 -0
- package/dist/integration-authorization/pi-rpc-application.js.map +1 -0
- package/dist/integration-authorization/pi-rpc-requests.d.ts +10 -0
- package/dist/integration-authorization/pi-rpc-requests.d.ts.map +1 -0
- package/dist/integration-authorization/pi-rpc-requests.js +221 -0
- package/dist/integration-authorization/pi-rpc-requests.js.map +1 -0
- package/dist/integration-authorization/requests.d.ts +10 -0
- package/dist/integration-authorization/requests.d.ts.map +1 -0
- package/dist/integration-authorization/requests.js +208 -0
- package/dist/integration-authorization/requests.js.map +1 -0
- package/dist/invocation-context/application.d.ts +34 -0
- package/dist/invocation-context/application.d.ts.map +1 -0
- package/dist/invocation-context/application.js +14 -0
- package/dist/invocation-context/application.js.map +1 -0
- package/dist/invocation-context/resolver.d.ts +6 -0
- package/dist/invocation-context/resolver.d.ts.map +1 -0
- package/dist/invocation-context/resolver.js +15 -0
- package/dist/invocation-context/resolver.js.map +1 -0
- package/dist/lifecycle/node-machine.d.ts +45 -0
- package/dist/lifecycle/node-machine.d.ts.map +1 -0
- package/dist/lifecycle/node-machine.js +64 -0
- package/dist/lifecycle/node-machine.js.map +1 -0
- package/dist/orchestration/application.d.ts +10 -0
- package/dist/orchestration/application.d.ts.map +1 -0
- package/dist/orchestration/application.js +97 -0
- package/dist/orchestration/application.js.map +1 -0
- package/dist/orchestration/lifecycle.d.ts +98 -0
- package/dist/orchestration/lifecycle.d.ts.map +1 -0
- package/dist/orchestration/lifecycle.js +118 -0
- package/dist/orchestration/lifecycle.js.map +1 -0
- package/dist/orchestration/mutations.d.ts +28 -0
- package/dist/orchestration/mutations.d.ts.map +1 -0
- package/dist/orchestration/mutations.js +562 -0
- package/dist/orchestration/mutations.js.map +1 -0
- package/dist/orchestration/storage.d.ts +200 -0
- package/dist/orchestration/storage.d.ts.map +1 -0
- package/dist/orchestration/storage.js +1214 -0
- package/dist/orchestration/storage.js.map +1 -0
- package/dist/project-workspace/application/requests.d.ts +44 -0
- package/dist/project-workspace/application/requests.d.ts.map +1 -0
- package/dist/project-workspace/application/requests.js +92 -0
- package/dist/project-workspace/application/requests.js.map +1 -0
- package/dist/project-workspace/repository/inspector.d.ts +47 -0
- package/dist/project-workspace/repository/inspector.d.ts.map +1 -0
- package/dist/project-workspace/repository/inspector.js +311 -0
- package/dist/project-workspace/repository/inspector.js.map +1 -0
- package/dist/project-workspace/storage/request-digest.d.ts +11 -0
- package/dist/project-workspace/storage/request-digest.d.ts.map +1 -0
- package/dist/project-workspace/storage/request-digest.js +21 -0
- package/dist/project-workspace/storage/request-digest.js.map +1 -0
- package/dist/project-workspace/storage/store.d.ts +34 -0
- package/dist/project-workspace/storage/store.d.ts.map +1 -0
- package/dist/project-workspace/storage/store.js +603 -0
- package/dist/project-workspace/storage/store.js.map +1 -0
- package/dist/runtime/connection-descriptor.d.ts +19 -0
- package/dist/runtime/connection-descriptor.d.ts.map +1 -0
- package/dist/runtime/connection-descriptor.js +136 -0
- package/dist/runtime/connection-descriptor.js.map +1 -0
- package/dist/runtime/errors.d.ts +21 -0
- package/dist/runtime/errors.d.ts.map +1 -0
- package/dist/runtime/errors.js +48 -0
- package/dist/runtime/errors.js.map +1 -0
- package/dist/runtime/framing.d.ts +9 -0
- package/dist/runtime/framing.d.ts.map +1 -0
- package/dist/runtime/framing.js +48 -0
- package/dist/runtime/framing.js.map +1 -0
- package/dist/runtime/instance-lock.d.ts +54 -0
- package/dist/runtime/instance-lock.d.ts.map +1 -0
- package/dist/runtime/instance-lock.js +566 -0
- package/dist/runtime/instance-lock.js.map +1 -0
- package/dist/runtime/local-credential.d.ts +16 -0
- package/dist/runtime/local-credential.d.ts.map +1 -0
- package/dist/runtime/local-credential.js +66 -0
- package/dist/runtime/local-credential.js.map +1 -0
- package/dist/runtime/local-server-channels.d.ts +11 -0
- package/dist/runtime/local-server-channels.d.ts.map +1 -0
- package/dist/runtime/local-server-channels.js +21 -0
- package/dist/runtime/local-server-channels.js.map +1 -0
- package/dist/runtime/local-server-listener.d.ts +12 -0
- package/dist/runtime/local-server-listener.d.ts.map +1 -0
- package/dist/runtime/local-server-listener.js +41 -0
- package/dist/runtime/local-server-listener.js.map +1 -0
- package/dist/runtime/local-server.d.ts +27 -0
- package/dist/runtime/local-server.d.ts.map +1 -0
- package/dist/runtime/local-server.js +639 -0
- package/dist/runtime/local-server.js.map +1 -0
- package/dist/runtime/observability.d.ts +21 -0
- package/dist/runtime/observability.d.ts.map +1 -0
- package/dist/runtime/observability.js +164 -0
- package/dist/runtime/observability.js.map +1 -0
- package/dist/runtime/process/owned-tree.d.ts +24 -0
- package/dist/runtime/process/owned-tree.d.ts.map +1 -0
- package/dist/runtime/process/owned-tree.js +228 -0
- package/dist/runtime/process/owned-tree.js.map +1 -0
- package/dist/runtime/process/resource/cleanup.d.ts +13 -0
- package/dist/runtime/process/resource/cleanup.d.ts.map +1 -0
- package/dist/runtime/process/resource/cleanup.js +196 -0
- package/dist/runtime/process/resource/cleanup.js.map +1 -0
- package/dist/runtime/process/resource/contract.d.ts +382 -0
- package/dist/runtime/process/resource/contract.d.ts.map +1 -0
- package/dist/runtime/process/resource/contract.js +2 -0
- package/dist/runtime/process/resource/contract.js.map +1 -0
- package/dist/runtime/process/resource/darwin-native-host-bootstrap.d.ts +7 -0
- package/dist/runtime/process/resource/darwin-native-host-bootstrap.d.ts.map +1 -0
- package/dist/runtime/process/resource/darwin-native-host-bootstrap.js +196 -0
- package/dist/runtime/process/resource/darwin-native-host-bootstrap.js.map +1 -0
- package/dist/runtime/process/resource/darwin-source-candidate-layer.d.ts +16 -0
- package/dist/runtime/process/resource/darwin-source-candidate-layer.d.ts.map +1 -0
- package/dist/runtime/process/resource/darwin-source-candidate-layer.js +51 -0
- package/dist/runtime/process/resource/darwin-source-candidate-layer.js.map +1 -0
- package/dist/runtime/process/resource/darwin-vouch-policy.d.ts +44 -0
- package/dist/runtime/process/resource/darwin-vouch-policy.d.ts.map +1 -0
- package/dist/runtime/process/resource/darwin-vouch-policy.js +253 -0
- package/dist/runtime/process/resource/darwin-vouch-policy.js.map +1 -0
- package/dist/runtime/process/resource/health.d.ts +45 -0
- package/dist/runtime/process/resource/health.d.ts.map +1 -0
- package/dist/runtime/process/resource/health.js +197 -0
- package/dist/runtime/process/resource/health.js.map +1 -0
- package/dist/runtime/process/resource/host-frame.d.ts +39 -0
- package/dist/runtime/process/resource/host-frame.d.ts.map +1 -0
- package/dist/runtime/process/resource/host-frame.js +266 -0
- package/dist/runtime/process/resource/host-frame.js.map +1 -0
- package/dist/runtime/process/resource/host-launch.d.ts +11 -0
- package/dist/runtime/process/resource/host-launch.d.ts.map +1 -0
- package/dist/runtime/process/resource/host-launch.js +296 -0
- package/dist/runtime/process/resource/host-launch.js.map +1 -0
- package/dist/runtime/process/resource/host-lifecycle.d.ts +91 -0
- package/dist/runtime/process/resource/host-lifecycle.d.ts.map +1 -0
- package/dist/runtime/process/resource/host-lifecycle.js +96 -0
- package/dist/runtime/process/resource/host-lifecycle.js.map +1 -0
- package/dist/runtime/process/resource/host-message.d.ts +15 -0
- package/dist/runtime/process/resource/host-message.d.ts.map +1 -0
- package/dist/runtime/process/resource/host-message.js +538 -0
- package/dist/runtime/process/resource/host-message.js.map +1 -0
- package/dist/runtime/process/resource/host-protocol-contract.d.ts +222 -0
- package/dist/runtime/process/resource/host-protocol-contract.d.ts.map +1 -0
- package/dist/runtime/process/resource/host-protocol-contract.js +69 -0
- package/dist/runtime/process/resource/host-protocol-contract.js.map +1 -0
- package/dist/runtime/process/resource/host-protocol-sequence.d.ts +14 -0
- package/dist/runtime/process/resource/host-protocol-sequence.d.ts.map +1 -0
- package/dist/runtime/process/resource/host-protocol-sequence.js +304 -0
- package/dist/runtime/process/resource/host-protocol-sequence.js.map +1 -0
- package/dist/runtime/process/resource/host-protocol.d.ts +5 -0
- package/dist/runtime/process/resource/host-protocol.d.ts.map +1 -0
- package/dist/runtime/process/resource/host-protocol.js +5 -0
- package/dist/runtime/process/resource/host-protocol.js.map +1 -0
- package/dist/runtime/process/resource/host-snapshot.d.ts +11 -0
- package/dist/runtime/process/resource/host-snapshot.d.ts.map +1 -0
- package/dist/runtime/process/resource/host-snapshot.js +239 -0
- package/dist/runtime/process/resource/host-snapshot.js.map +1 -0
- package/dist/runtime/process/resource/integration-authorization/authorization-store.d.ts +48 -0
- package/dist/runtime/process/resource/integration-authorization/authorization-store.d.ts.map +1 -0
- package/dist/runtime/process/resource/integration-authorization/authorization-store.js +269 -0
- package/dist/runtime/process/resource/integration-authorization/authorization-store.js.map +1 -0
- package/dist/runtime/process/resource/integration-authorization/database.d.ts +10 -0
- package/dist/runtime/process/resource/integration-authorization/database.d.ts.map +1 -0
- package/dist/runtime/process/resource/integration-authorization/database.js +98 -0
- package/dist/runtime/process/resource/integration-authorization/database.js.map +1 -0
- package/dist/runtime/process/resource/integration-authorization/index.d.ts +7 -0
- package/dist/runtime/process/resource/integration-authorization/index.d.ts.map +1 -0
- package/dist/runtime/process/resource/integration-authorization/index.js +6 -0
- package/dist/runtime/process/resource/integration-authorization/index.js.map +1 -0
- package/dist/runtime/process/resource/integration-authorization/permit-compaction-store.d.ts +3 -0
- package/dist/runtime/process/resource/integration-authorization/permit-compaction-store.d.ts.map +1 -0
- package/dist/runtime/process/resource/integration-authorization/permit-compaction-store.js +87 -0
- package/dist/runtime/process/resource/integration-authorization/permit-compaction-store.js.map +1 -0
- package/dist/runtime/process/resource/integration-authorization/permit-store.d.ts +44 -0
- package/dist/runtime/process/resource/integration-authorization/permit-store.d.ts.map +1 -0
- package/dist/runtime/process/resource/integration-authorization/permit-store.js +486 -0
- package/dist/runtime/process/resource/integration-authorization/permit-store.js.map +1 -0
- package/dist/runtime/process/resource/integration-authorization/plan-integrity.d.ts +21 -0
- package/dist/runtime/process/resource/integration-authorization/plan-integrity.d.ts.map +1 -0
- package/dist/runtime/process/resource/integration-authorization/plan-integrity.js +172 -0
- package/dist/runtime/process/resource/integration-authorization/plan-integrity.js.map +1 -0
- package/dist/runtime/process/resource/integration-authorization/plan-payload.d.ts +31 -0
- package/dist/runtime/process/resource/integration-authorization/plan-payload.d.ts.map +1 -0
- package/dist/runtime/process/resource/integration-authorization/plan-payload.js +15 -0
- package/dist/runtime/process/resource/integration-authorization/plan-payload.js.map +1 -0
- package/dist/runtime/process/resource/integration-authorization/plan-store.d.ts +11 -0
- package/dist/runtime/process/resource/integration-authorization/plan-store.d.ts.map +1 -0
- package/dist/runtime/process/resource/integration-authorization/plan-store.js +124 -0
- package/dist/runtime/process/resource/integration-authorization/plan-store.js.map +1 -0
- package/dist/runtime/process/resource/integration-authorization/policy.d.ts +37 -0
- package/dist/runtime/process/resource/integration-authorization/policy.d.ts.map +1 -0
- package/dist/runtime/process/resource/integration-authorization/policy.js +141 -0
- package/dist/runtime/process/resource/integration-authorization/policy.js.map +1 -0
- package/dist/runtime/process/resource/integration-authorization/projection.d.ts +5 -0
- package/dist/runtime/process/resource/integration-authorization/projection.d.ts.map +1 -0
- package/dist/runtime/process/resource/integration-authorization/projection.js +56 -0
- package/dist/runtime/process/resource/integration-authorization/projection.js.map +1 -0
- package/dist/runtime/process/resource/integration-authorization/replay-store.d.ts +9 -0
- package/dist/runtime/process/resource/integration-authorization/replay-store.d.ts.map +1 -0
- package/dist/runtime/process/resource/integration-authorization/replay-store.js +55 -0
- package/dist/runtime/process/resource/integration-authorization/replay-store.js.map +1 -0
- package/dist/runtime/process/resource/integration-authorization/types.d.ts +152 -0
- package/dist/runtime/process/resource/integration-authorization/types.d.ts.map +1 -0
- package/dist/runtime/process/resource/integration-authorization/types.js +3 -0
- package/dist/runtime/process/resource/integration-authorization/types.js.map +1 -0
- package/dist/runtime/process/resource/integration-authorization-manager.d.ts +9 -0
- package/dist/runtime/process/resource/integration-authorization-manager.d.ts.map +1 -0
- package/dist/runtime/process/resource/integration-authorization-manager.js +353 -0
- package/dist/runtime/process/resource/integration-authorization-manager.js.map +1 -0
- package/dist/runtime/process/resource/integration-authorization-storage.d.ts +2 -0
- package/dist/runtime/process/resource/integration-authorization-storage.d.ts.map +1 -0
- package/dist/runtime/process/resource/integration-authorization-storage.js +2 -0
- package/dist/runtime/process/resource/integration-authorization-storage.js.map +1 -0
- package/dist/runtime/process/resource/internal-spawn.d.ts +27 -0
- package/dist/runtime/process/resource/internal-spawn.d.ts.map +1 -0
- package/dist/runtime/process/resource/internal-spawn.js +7 -0
- package/dist/runtime/process/resource/internal-spawn.js.map +1 -0
- package/dist/runtime/process/resource/launch-authority.d.ts +5 -0
- package/dist/runtime/process/resource/launch-authority.d.ts.map +1 -0
- package/dist/runtime/process/resource/launch-authority.js +37 -0
- package/dist/runtime/process/resource/launch-authority.js.map +1 -0
- package/dist/runtime/process/resource/launch-gate.d.ts +19 -0
- package/dist/runtime/process/resource/launch-gate.d.ts.map +1 -0
- package/dist/runtime/process/resource/launch-gate.js +16 -0
- package/dist/runtime/process/resource/launch-gate.js.map +1 -0
- package/dist/runtime/process/resource/linux-process-identity.d.ts +13 -0
- package/dist/runtime/process/resource/linux-process-identity.d.ts.map +1 -0
- package/dist/runtime/process/resource/linux-process-identity.js +40 -0
- package/dist/runtime/process/resource/linux-process-identity.js.map +1 -0
- package/dist/runtime/process/resource/managed-tree.d.ts +28 -0
- package/dist/runtime/process/resource/managed-tree.d.ts.map +1 -0
- package/dist/runtime/process/resource/managed-tree.js +79 -0
- package/dist/runtime/process/resource/managed-tree.js.map +1 -0
- package/dist/runtime/process/resource/native-host-adapter.d.ts +17 -0
- package/dist/runtime/process/resource/native-host-adapter.d.ts.map +1 -0
- package/dist/runtime/process/resource/native-host-adapter.js +169 -0
- package/dist/runtime/process/resource/native-host-adapter.js.map +1 -0
- package/dist/runtime/process/resource/native-host-artifact.d.ts +28 -0
- package/dist/runtime/process/resource/native-host-artifact.d.ts.map +1 -0
- package/dist/runtime/process/resource/native-host-artifact.js +110 -0
- package/dist/runtime/process/resource/native-host-artifact.js.map +1 -0
- package/dist/runtime/process/resource/native-host-bootstrap.d.ts +29 -0
- package/dist/runtime/process/resource/native-host-bootstrap.d.ts.map +1 -0
- package/dist/runtime/process/resource/native-host-bootstrap.js +2 -0
- package/dist/runtime/process/resource/native-host-bootstrap.js.map +1 -0
- package/dist/runtime/process/resource/native-host-capability.d.ts +5 -0
- package/dist/runtime/process/resource/native-host-capability.d.ts.map +1 -0
- package/dist/runtime/process/resource/native-host-capability.js +86 -0
- package/dist/runtime/process/resource/native-host-capability.js.map +1 -0
- package/dist/runtime/process/resource/native-host-connection.d.ts +82 -0
- package/dist/runtime/process/resource/native-host-connection.d.ts.map +1 -0
- package/dist/runtime/process/resource/native-host-connection.js +448 -0
- package/dist/runtime/process/resource/native-host-connection.js.map +1 -0
- package/dist/runtime/process/resource/native-host-contract.d.ts +47 -0
- package/dist/runtime/process/resource/native-host-contract.d.ts.map +1 -0
- package/dist/runtime/process/resource/native-host-contract.js +2 -0
- package/dist/runtime/process/resource/native-host-contract.js.map +1 -0
- package/dist/runtime/process/resource/native-host-frame-parser.d.ts +22 -0
- package/dist/runtime/process/resource/native-host-frame-parser.d.ts.map +1 -0
- package/dist/runtime/process/resource/native-host-frame-parser.js +110 -0
- package/dist/runtime/process/resource/native-host-frame-parser.js.map +1 -0
- package/dist/runtime/process/resource/native-host-output.d.ts +16 -0
- package/dist/runtime/process/resource/native-host-output.d.ts.map +1 -0
- package/dist/runtime/process/resource/native-host-output.js +94 -0
- package/dist/runtime/process/resource/native-host-output.js.map +1 -0
- package/dist/runtime/process/resource/native-host-projection.d.ts +20 -0
- package/dist/runtime/process/resource/native-host-projection.d.ts.map +1 -0
- package/dist/runtime/process/resource/native-host-projection.js +74 -0
- package/dist/runtime/process/resource/native-host-projection.js.map +1 -0
- package/dist/runtime/process/resource/native-host-release-identity.d.ts +19 -0
- package/dist/runtime/process/resource/native-host-release-identity.d.ts.map +1 -0
- package/dist/runtime/process/resource/native-host-release-identity.js +56 -0
- package/dist/runtime/process/resource/native-host-release-identity.js.map +1 -0
- package/dist/runtime/process/resource/native-host-state.d.ts +38 -0
- package/dist/runtime/process/resource/native-host-state.d.ts.map +1 -0
- package/dist/runtime/process/resource/native-host-state.js +303 -0
- package/dist/runtime/process/resource/native-host-state.js.map +1 -0
- package/dist/runtime/process/resource/native-manager.d.ts +11 -0
- package/dist/runtime/process/resource/native-manager.d.ts.map +1 -0
- package/dist/runtime/process/resource/native-manager.js +646 -0
- package/dist/runtime/process/resource/native-manager.js.map +1 -0
- package/dist/runtime/process/resource/pi-rpc-launch-authority.d.ts +8 -0
- package/dist/runtime/process/resource/pi-rpc-launch-authority.d.ts.map +1 -0
- package/dist/runtime/process/resource/pi-rpc-launch-authority.js +158 -0
- package/dist/runtime/process/resource/pi-rpc-launch-authority.js.map +1 -0
- package/dist/runtime/process/resource/policy.d.ts +53 -0
- package/dist/runtime/process/resource/policy.d.ts.map +1 -0
- package/dist/runtime/process/resource/policy.js +501 -0
- package/dist/runtime/process/resource/policy.js.map +1 -0
- package/dist/runtime/process/resource/process-identity.d.ts +29 -0
- package/dist/runtime/process/resource/process-identity.d.ts.map +1 -0
- package/dist/runtime/process/resource/process-identity.js +199 -0
- package/dist/runtime/process/resource/process-identity.js.map +1 -0
- package/dist/runtime/process/resource/ps-snapshot.d.ts +12 -0
- package/dist/runtime/process/resource/ps-snapshot.d.ts.map +1 -0
- package/dist/runtime/process/resource/ps-snapshot.js +77 -0
- package/dist/runtime/process/resource/ps-snapshot.js.map +1 -0
- package/dist/runtime/process/resource/sampler.d.ts +18 -0
- package/dist/runtime/process/resource/sampler.d.ts.map +1 -0
- package/dist/runtime/process/resource/sampler.js +19 -0
- package/dist/runtime/process/resource/sampler.js.map +1 -0
- package/dist/runtime/process/resource/sampling.d.ts +23 -0
- package/dist/runtime/process/resource/sampling.d.ts.map +1 -0
- package/dist/runtime/process/resource/sampling.js +131 -0
- package/dist/runtime/process/resource/sampling.js.map +1 -0
- package/dist/runtime/process/resource/service.d.ts +15 -0
- package/dist/runtime/process/resource/service.d.ts.map +1 -0
- package/dist/runtime/process/resource/service.js +39 -0
- package/dist/runtime/process/resource/service.js.map +1 -0
- package/dist/runtime/process/resource/snapshot.d.ts +24 -0
- package/dist/runtime/process/resource/snapshot.d.ts.map +1 -0
- package/dist/runtime/process/resource/snapshot.js +149 -0
- package/dist/runtime/process/resource/snapshot.js.map +1 -0
- package/dist/runtime/process/resource/telemetry.d.ts +9 -0
- package/dist/runtime/process/resource/telemetry.d.ts.map +1 -0
- package/dist/runtime/process/resource/telemetry.js +51 -0
- package/dist/runtime/process/resource/telemetry.js.map +1 -0
- package/dist/runtime/process/resource/test-runtime-layer.d.ts +25 -0
- package/dist/runtime/process/resource/test-runtime-layer.d.ts.map +1 -0
- package/dist/runtime/process/resource/test-runtime-layer.js +296 -0
- package/dist/runtime/process/resource/test-runtime-layer.js.map +1 -0
- package/dist/runtime/process/resource/testing.d.ts +18 -0
- package/dist/runtime/process/resource/testing.d.ts.map +1 -0
- package/dist/runtime/process/resource/testing.js +216 -0
- package/dist/runtime/process/resource/testing.js.map +1 -0
- package/dist/runtime/profile-paths.d.ts +27 -0
- package/dist/runtime/profile-paths.d.ts.map +1 -0
- package/dist/runtime/profile-paths.js +111 -0
- package/dist/runtime/profile-paths.js.map +1 -0
- package/dist/runtime/startup/testing/benchmark-evidence.d.ts +45 -0
- package/dist/runtime/startup/testing/benchmark-evidence.d.ts.map +1 -0
- package/dist/runtime/startup/testing/benchmark-evidence.js +261 -0
- package/dist/runtime/startup/testing/benchmark-evidence.js.map +1 -0
- package/dist/session/application/activation.d.ts +22 -0
- package/dist/session/application/activation.d.ts.map +1 -0
- package/dist/session/application/activation.js +202 -0
- package/dist/session/application/activation.js.map +1 -0
- package/dist/session/application/requests.d.ts +25 -0
- package/dist/session/application/requests.d.ts.map +1 -0
- package/dist/session/application/requests.js +76 -0
- package/dist/session/application/requests.js.map +1 -0
- package/dist/session/application/testing/activation-barrier.d.ts +8 -0
- package/dist/session/application/testing/activation-barrier.d.ts.map +1 -0
- package/dist/session/application/testing/activation-barrier.js +55 -0
- package/dist/session/application/testing/activation-barrier.js.map +1 -0
- package/dist/session/runtime/admission.d.ts +8 -0
- package/dist/session/runtime/admission.d.ts.map +1 -0
- package/dist/session/runtime/admission.js +22 -0
- package/dist/session/runtime/admission.js.map +1 -0
- package/dist/session/runtime/policy.d.ts +5 -0
- package/dist/session/runtime/policy.d.ts.map +1 -0
- package/dist/session/runtime/policy.js +5 -0
- package/dist/session/runtime/policy.js.map +1 -0
- package/dist/session/storage/activation-command.d.ts +12 -0
- package/dist/session/storage/activation-command.d.ts.map +1 -0
- package/dist/session/storage/activation-command.js +146 -0
- package/dist/session/storage/activation-command.js.map +1 -0
- package/dist/session/storage/activation-mutations.d.ts +25 -0
- package/dist/session/storage/activation-mutations.d.ts.map +1 -0
- package/dist/session/storage/activation-mutations.js +34 -0
- package/dist/session/storage/activation-mutations.js.map +1 -0
- package/dist/session/storage/activation-record.d.ts +28 -0
- package/dist/session/storage/activation-record.d.ts.map +1 -0
- package/dist/session/storage/activation-record.js +109 -0
- package/dist/session/storage/activation-record.js.map +1 -0
- package/dist/session/storage/activation-state.d.ts +18 -0
- package/dist/session/storage/activation-state.d.ts.map +1 -0
- package/dist/session/storage/activation-state.js +173 -0
- package/dist/session/storage/activation-state.js.map +1 -0
- package/dist/session/storage/activation.d.ts +4 -0
- package/dist/session/storage/activation.d.ts.map +1 -0
- package/dist/session/storage/activation.js +4 -0
- package/dist/session/storage/activation.js.map +1 -0
- package/dist/session/storage/create.d.ts +12 -0
- package/dist/session/storage/create.d.ts.map +1 -0
- package/dist/session/storage/create.js +115 -0
- package/dist/session/storage/create.js.map +1 -0
- package/dist/session/storage/events.d.ts +4 -0
- package/dist/session/storage/events.d.ts.map +1 -0
- package/dist/session/storage/events.js +119 -0
- package/dist/session/storage/events.js.map +1 -0
- package/dist/session/storage/queries.d.ts +5 -0
- package/dist/session/storage/queries.d.ts.map +1 -0
- package/dist/session/storage/queries.js +24 -0
- package/dist/session/storage/queries.js.map +1 -0
- package/dist/session/storage/request-digest.d.ts +4 -0
- package/dist/session/storage/request-digest.d.ts.map +1 -0
- package/dist/session/storage/request-digest.js +19 -0
- package/dist/session/storage/request-digest.js.map +1 -0
- package/dist/session/storage/runtime-profile.d.ts +15 -0
- package/dist/session/storage/runtime-profile.d.ts.map +1 -0
- package/dist/session/storage/runtime-profile.js +4 -0
- package/dist/session/storage/runtime-profile.js.map +1 -0
- package/dist/session/storage/session-record.d.ts +25 -0
- package/dist/session/storage/session-record.d.ts.map +1 -0
- package/dist/session/storage/session-record.js +53 -0
- package/dist/session/storage/session-record.js.map +1 -0
- package/dist/session/storage/testing/database.d.ts +13 -0
- package/dist/session/storage/testing/database.d.ts.map +1 -0
- package/dist/session/storage/testing/database.js +63 -0
- package/dist/session/storage/testing/database.js.map +1 -0
- package/dist/session/testing/activation-waiter.d.ts +7 -0
- package/dist/session/testing/activation-waiter.d.ts.map +1 -0
- package/dist/session/testing/activation-waiter.js +38 -0
- package/dist/session/testing/activation-waiter.js.map +1 -0
- package/dist/session/testing/built-session-bounded-capture.d.ts +15 -0
- package/dist/session/testing/built-session-bounded-capture.d.ts.map +1 -0
- package/dist/session/testing/built-session-bounded-capture.js +136 -0
- package/dist/session/testing/built-session-bounded-capture.js.map +1 -0
- package/dist/session/testing/built-session-cli-supervisor.d.ts +36 -0
- package/dist/session/testing/built-session-cli-supervisor.d.ts.map +1 -0
- package/dist/session/testing/built-session-cli-supervisor.js +52 -0
- package/dist/session/testing/built-session-cli-supervisor.js.map +1 -0
- package/dist/session/testing/built-session-execution-authenticator.d.ts +11 -0
- package/dist/session/testing/built-session-execution-authenticator.d.ts.map +1 -0
- package/dist/session/testing/built-session-execution-authenticator.js +33 -0
- package/dist/session/testing/built-session-execution-authenticator.js.map +1 -0
- package/dist/session/testing/built-session-execution-authority.d.ts +12 -0
- package/dist/session/testing/built-session-execution-authority.d.ts.map +1 -0
- package/dist/session/testing/built-session-execution-authority.js +1242 -0
- package/dist/session/testing/built-session-execution-authority.js.map +1 -0
- package/dist/session/testing/built-session-execution-budget.d.ts +29 -0
- package/dist/session/testing/built-session-execution-budget.d.ts.map +1 -0
- package/dist/session/testing/built-session-execution-budget.js +72 -0
- package/dist/session/testing/built-session-execution-budget.js.map +1 -0
- package/dist/session/testing/built-session-execution-contract.d.ts +64 -0
- package/dist/session/testing/built-session-execution-contract.d.ts.map +1 -0
- package/dist/session/testing/built-session-execution-contract.js +4 -0
- package/dist/session/testing/built-session-execution-contract.js.map +1 -0
- package/dist/session/testing/built-session-execution-failure.d.ts +32 -0
- package/dist/session/testing/built-session-execution-failure.d.ts.map +1 -0
- package/dist/session/testing/built-session-execution-failure.js +51 -0
- package/dist/session/testing/built-session-execution-failure.js.map +1 -0
- package/dist/session/testing/built-session-execution-handle.d.ts +29 -0
- package/dist/session/testing/built-session-execution-handle.d.ts.map +1 -0
- package/dist/session/testing/built-session-execution-handle.js +37 -0
- package/dist/session/testing/built-session-execution-handle.js.map +1 -0
- package/dist/session/testing/built-session-execution-input.d.ts +94 -0
- package/dist/session/testing/built-session-execution-input.d.ts.map +1 -0
- package/dist/session/testing/built-session-execution-input.js +356 -0
- package/dist/session/testing/built-session-execution-input.js.map +1 -0
- package/dist/session/testing/built-session-execution-lifecycle.d.ts +36 -0
- package/dist/session/testing/built-session-execution-lifecycle.d.ts.map +1 -0
- package/dist/session/testing/built-session-execution-lifecycle.js +143 -0
- package/dist/session/testing/built-session-execution-lifecycle.js.map +1 -0
- package/dist/session/testing/built-session-execution-policy.d.ts +67 -0
- package/dist/session/testing/built-session-execution-policy.d.ts.map +1 -0
- package/dist/session/testing/built-session-execution-policy.js +110 -0
- package/dist/session/testing/built-session-execution-policy.js.map +1 -0
- package/dist/session/testing/built-session-execution-private-types.d.ts +137 -0
- package/dist/session/testing/built-session-execution-private-types.d.ts.map +1 -0
- package/dist/session/testing/built-session-execution-private-types.js +2 -0
- package/dist/session/testing/built-session-execution-private-types.js.map +1 -0
- package/dist/session/testing/built-session-execution-projection.d.ts +177 -0
- package/dist/session/testing/built-session-execution-projection.d.ts.map +1 -0
- package/dist/session/testing/built-session-execution-projection.js +226 -0
- package/dist/session/testing/built-session-execution-projection.js.map +1 -0
- package/dist/session/testing/built-session-execution-provider.d.ts +36 -0
- package/dist/session/testing/built-session-execution-provider.d.ts.map +1 -0
- package/dist/session/testing/built-session-execution-provider.js +2 -0
- package/dist/session/testing/built-session-execution-provider.js.map +1 -0
- package/dist/session/testing/built-session-execution-receipt.d.ts +331 -0
- package/dist/session/testing/built-session-execution-receipt.d.ts.map +1 -0
- package/dist/session/testing/built-session-execution-receipt.js +243 -0
- package/dist/session/testing/built-session-execution-receipt.js.map +1 -0
- package/dist/session/testing/built-session-execution-record.d.ts +15 -0
- package/dist/session/testing/built-session-execution-record.d.ts.map +1 -0
- package/dist/session/testing/built-session-execution-record.js +27 -0
- package/dist/session/testing/built-session-execution-record.js.map +1 -0
- package/dist/session/testing/built-session-execution-snapshot.d.ts +83 -0
- package/dist/session/testing/built-session-execution-snapshot.d.ts.map +1 -0
- package/dist/session/testing/built-session-execution-snapshot.js +5 -0
- package/dist/session/testing/built-session-execution-snapshot.js.map +1 -0
- package/dist/session/testing/built-session-node.d.ts +110 -0
- package/dist/session/testing/built-session-node.d.ts.map +1 -0
- package/dist/session/testing/built-session-node.js +715 -0
- package/dist/session/testing/built-session-node.js.map +1 -0
- package/dist/session/testing/built-session-structural-gate.d.ts +40 -0
- package/dist/session/testing/built-session-structural-gate.d.ts.map +1 -0
- package/dist/session/testing/built-session-structural-gate.js +207 -0
- package/dist/session/testing/built-session-structural-gate.js.map +1 -0
- package/dist/session/testing/built-session-temporary-lifecycle.d.ts +35 -0
- package/dist/session/testing/built-session-temporary-lifecycle.d.ts.map +1 -0
- package/dist/session/testing/built-session-temporary-lifecycle.js +314 -0
- package/dist/session/testing/built-session-temporary-lifecycle.js.map +1 -0
- package/dist/session/testing/git-repository.d.ts +2 -0
- package/dist/session/testing/git-repository.d.ts.map +1 -0
- package/dist/session/testing/git-repository.js +29 -0
- package/dist/session/testing/git-repository.js.map +1 -0
- package/dist/session/testing/session-fixture.d.ts +7 -0
- package/dist/session/testing/session-fixture.d.ts.map +1 -0
- package/dist/session/testing/session-fixture.js +53 -0
- package/dist/session/testing/session-fixture.js.map +1 -0
- package/dist/session/turn/application/requests.d.ts +24 -0
- package/dist/session/turn/application/requests.d.ts.map +1 -0
- package/dist/session/turn/application/requests.js +164 -0
- package/dist/session/turn/application/requests.js.map +1 -0
- package/dist/session/turn/application/source-candidate-authority.d.ts +5 -0
- package/dist/session/turn/application/source-candidate-authority.d.ts.map +1 -0
- package/dist/session/turn/application/source-candidate-authority.js +4 -0
- package/dist/session/turn/application/source-candidate-authority.js.map +1 -0
- package/dist/session/turn/storage/interrupt.d.ts +74 -0
- package/dist/session/turn/storage/interrupt.d.ts.map +1 -0
- package/dist/session/turn/storage/interrupt.js +757 -0
- package/dist/session/turn/storage/interrupt.js.map +1 -0
- package/dist/session/turn/storage/lifecycle.d.ts +29 -0
- package/dist/session/turn/storage/lifecycle.d.ts.map +1 -0
- package/dist/session/turn/storage/lifecycle.js +310 -0
- package/dist/session/turn/storage/lifecycle.js.map +1 -0
- package/dist/session/turn/storage/queries.d.ts +4 -0
- package/dist/session/turn/storage/queries.d.ts.map +1 -0
- package/dist/session/turn/storage/queries.js +7 -0
- package/dist/session/turn/storage/queries.js.map +1 -0
- package/dist/session/turn/storage/record.d.ts +28 -0
- package/dist/session/turn/storage/record.d.ts.map +1 -0
- package/dist/session/turn/storage/record.js +84 -0
- package/dist/session/turn/storage/record.js.map +1 -0
- package/dist/session/turn/storage/request-digest.d.ts +8 -0
- package/dist/session/turn/storage/request-digest.d.ts.map +1 -0
- package/dist/session/turn/storage/request-digest.js +20 -0
- package/dist/session/turn/storage/request-digest.js.map +1 -0
- package/dist/session/turn/storage/send.d.ts +12 -0
- package/dist/session/turn/storage/send.d.ts.map +1 -0
- package/dist/session/turn/storage/send.js +149 -0
- package/dist/session/turn/storage/send.js.map +1 -0
- package/dist/storage/database-files.d.ts +6 -0
- package/dist/storage/database-files.d.ts.map +1 -0
- package/dist/storage/database-files.js +146 -0
- package/dist/storage/database-files.js.map +1 -0
- package/dist/storage/integration-authorization-operations.d.ts +7 -0
- package/dist/storage/integration-authorization-operations.d.ts.map +1 -0
- package/dist/storage/integration-authorization-operations.js +134 -0
- package/dist/storage/integration-authorization-operations.js.map +1 -0
- package/dist/storage/journal.d.ts +108 -0
- package/dist/storage/journal.d.ts.map +1 -0
- package/dist/storage/journal.js +459 -0
- package/dist/storage/journal.js.map +1 -0
- package/dist/storage/migration-eleven.d.ts +2 -0
- package/dist/storage/migration-eleven.d.ts.map +1 -0
- package/dist/storage/migration-eleven.js +298 -0
- package/dist/storage/migration-eleven.js.map +1 -0
- package/dist/storage/migration-fourteen.d.ts +2 -0
- package/dist/storage/migration-fourteen.d.ts.map +1 -0
- package/dist/storage/migration-fourteen.js +316 -0
- package/dist/storage/migration-fourteen.js.map +1 -0
- package/dist/storage/migration-nine.d.ts +2 -0
- package/dist/storage/migration-nine.d.ts.map +1 -0
- package/dist/storage/migration-nine.js +1224 -0
- package/dist/storage/migration-nine.js.map +1 -0
- package/dist/storage/migration-ten.d.ts +2 -0
- package/dist/storage/migration-ten.d.ts.map +1 -0
- package/dist/storage/migration-ten.js +14 -0
- package/dist/storage/migration-ten.js.map +1 -0
- package/dist/storage/migration-thirteen.d.ts +2 -0
- package/dist/storage/migration-thirteen.d.ts.map +1 -0
- package/dist/storage/migration-thirteen.js +380 -0
- package/dist/storage/migration-thirteen.js.map +1 -0
- package/dist/storage/migration-twelve.d.ts +2 -0
- package/dist/storage/migration-twelve.d.ts.map +1 -0
- package/dist/storage/migration-twelve.js +85 -0
- package/dist/storage/migration-twelve.js.map +1 -0
- package/dist/storage/migrations.d.ts +20 -0
- package/dist/storage/migrations.d.ts.map +1 -0
- package/dist/storage/migrations.js +909 -0
- package/dist/storage/migrations.js.map +1 -0
- package/dist/storage/node-database.d.ts +282 -0
- package/dist/storage/node-database.d.ts.map +1 -0
- package/dist/storage/node-database.js +448 -0
- package/dist/storage/node-database.js.map +1 -0
- package/dist/storage/pi-rpc-authorization-operations.d.ts +91 -0
- package/dist/storage/pi-rpc-authorization-operations.d.ts.map +1 -0
- package/dist/storage/pi-rpc-authorization-operations.js +136 -0
- package/dist/storage/pi-rpc-authorization-operations.js.map +1 -0
- package/dist/storage/policy.d.ts +8 -0
- package/dist/storage/policy.d.ts.map +1 -0
- package/dist/storage/policy.js +8 -0
- package/dist/storage/policy.js.map +1 -0
- package/dist/storage/sqlite-integer.d.ts +3 -0
- package/dist/storage/sqlite-integer.d.ts.map +1 -0
- package/dist/storage/sqlite-integer.js +25 -0
- package/dist/storage/sqlite-integer.js.map +1 -0
- package/dist/storage/store-effect.d.ts +5 -0
- package/dist/storage/store-effect.d.ts.map +1 -0
- package/dist/storage/store-effect.js +15 -0
- package/dist/storage/store-effect.js.map +1 -0
- package/dist/terminal/application/live-requests.d.ts +18 -0
- package/dist/terminal/application/live-requests.d.ts.map +1 -0
- package/dist/terminal/application/live-requests.js +24 -0
- package/dist/terminal/application/live-requests.js.map +1 -0
- package/dist/terminal/application/requests.d.ts +10 -0
- package/dist/terminal/application/requests.d.ts.map +1 -0
- package/dist/terminal/application/requests.js +50 -0
- package/dist/terminal/application/requests.js.map +1 -0
- package/dist/terminal/live-launch.d.ts +16 -0
- package/dist/terminal/live-launch.d.ts.map +1 -0
- package/dist/terminal/live-launch.js +213 -0
- package/dist/terminal/live-launch.js.map +1 -0
- package/dist/terminal/live-lifecycle.d.ts +104 -0
- package/dist/terminal/live-lifecycle.d.ts.map +1 -0
- package/dist/terminal/live-lifecycle.js +185 -0
- package/dist/terminal/live-lifecycle.js.map +1 -0
- package/dist/terminal/live-native-control.d.ts +7 -0
- package/dist/terminal/live-native-control.d.ts.map +1 -0
- package/dist/terminal/live-native-control.js +233 -0
- package/dist/terminal/live-native-control.js.map +1 -0
- package/dist/terminal/live-runtime-state.d.ts +69 -0
- package/dist/terminal/live-runtime-state.d.ts.map +1 -0
- package/dist/terminal/live-runtime-state.js +75 -0
- package/dist/terminal/live-runtime-state.js.map +1 -0
- package/dist/terminal/live-service.d.ts +29 -0
- package/dist/terminal/live-service.d.ts.map +1 -0
- package/dist/terminal/live-service.js +79 -0
- package/dist/terminal/live-service.js.map +1 -0
- package/dist/terminal/live-supervision.d.ts +19 -0
- package/dist/terminal/live-supervision.d.ts.map +1 -0
- package/dist/terminal/live-supervision.js +78 -0
- package/dist/terminal/live-supervision.js.map +1 -0
- package/dist/terminal/storage/create.d.ts +23 -0
- package/dist/terminal/storage/create.d.ts.map +1 -0
- package/dist/terminal/storage/create.js +151 -0
- package/dist/terminal/storage/create.js.map +1 -0
- package/dist/terminal/storage/events.d.ts +4 -0
- package/dist/terminal/storage/events.d.ts.map +1 -0
- package/dist/terminal/storage/events.js +151 -0
- package/dist/terminal/storage/events.js.map +1 -0
- package/dist/terminal/storage/live-command-shared.d.ts +39 -0
- package/dist/terminal/storage/live-command-shared.d.ts.map +1 -0
- package/dist/terminal/storage/live-command-shared.js +142 -0
- package/dist/terminal/storage/live-command-shared.js.map +1 -0
- package/dist/terminal/storage/live-commands.d.ts +7 -0
- package/dist/terminal/storage/live-commands.d.ts.map +1 -0
- package/dist/terminal/storage/live-commands.js +7 -0
- package/dist/terminal/storage/live-commands.js.map +1 -0
- package/dist/terminal/storage/live-controller-commands.d.ts +4 -0
- package/dist/terminal/storage/live-controller-commands.d.ts.map +1 -0
- package/dist/terminal/storage/live-controller-commands.js +4 -0
- package/dist/terminal/storage/live-controller-commands.js.map +1 -0
- package/dist/terminal/storage/live-controller-lease.d.ts +17 -0
- package/dist/terminal/storage/live-controller-lease.d.ts.map +1 -0
- package/dist/terminal/storage/live-controller-lease.js +316 -0
- package/dist/terminal/storage/live-controller-lease.js.map +1 -0
- package/dist/terminal/storage/live-controller-policy.d.ts +44 -0
- package/dist/terminal/storage/live-controller-policy.d.ts.map +1 -0
- package/dist/terminal/storage/live-controller-policy.js +135 -0
- package/dist/terminal/storage/live-controller-policy.js.map +1 -0
- package/dist/terminal/storage/live-controller-request.d.ts +15 -0
- package/dist/terminal/storage/live-controller-request.d.ts.map +1 -0
- package/dist/terminal/storage/live-controller-request.js +166 -0
- package/dist/terminal/storage/live-controller-request.js.map +1 -0
- package/dist/terminal/storage/live-controller-shared.d.ts +40 -0
- package/dist/terminal/storage/live-controller-shared.d.ts.map +1 -0
- package/dist/terminal/storage/live-controller-shared.js +74 -0
- package/dist/terminal/storage/live-controller-shared.js.map +1 -0
- package/dist/terminal/storage/live-create-commands.d.ts +21 -0
- package/dist/terminal/storage/live-create-commands.d.ts.map +1 -0
- package/dist/terminal/storage/live-create-commands.js +227 -0
- package/dist/terminal/storage/live-create-commands.js.map +1 -0
- package/dist/terminal/storage/live-launch-context.d.ts +17 -0
- package/dist/terminal/storage/live-launch-context.d.ts.map +1 -0
- package/dist/terminal/storage/live-launch-context.js +44 -0
- package/dist/terminal/storage/live-launch-context.js.map +1 -0
- package/dist/terminal/storage/live-mutations.d.ts +65 -0
- package/dist/terminal/storage/live-mutations.d.ts.map +1 -0
- package/dist/terminal/storage/live-mutations.js +291 -0
- package/dist/terminal/storage/live-mutations.js.map +1 -0
- package/dist/terminal/storage/live-native-commands.d.ts +77 -0
- package/dist/terminal/storage/live-native-commands.d.ts.map +1 -0
- package/dist/terminal/storage/live-native-commands.js +728 -0
- package/dist/terminal/storage/live-native-commands.js.map +1 -0
- package/dist/terminal/storage/live-process-settlement.d.ts +30 -0
- package/dist/terminal/storage/live-process-settlement.d.ts.map +1 -0
- package/dist/terminal/storage/live-process-settlement.js +159 -0
- package/dist/terminal/storage/live-process-settlement.js.map +1 -0
- package/dist/terminal/storage/live-record.d.ts +36 -0
- package/dist/terminal/storage/live-record.d.ts.map +1 -0
- package/dist/terminal/storage/live-record.js +153 -0
- package/dist/terminal/storage/live-record.js.map +1 -0
- package/dist/terminal/storage/live-recovery.d.ts +6 -0
- package/dist/terminal/storage/live-recovery.d.ts.map +1 -0
- package/dist/terminal/storage/live-recovery.js +539 -0
- package/dist/terminal/storage/live-recovery.js.map +1 -0
- package/dist/terminal/storage/live-retention.d.ts +46 -0
- package/dist/terminal/storage/live-retention.d.ts.map +1 -0
- package/dist/terminal/storage/live-retention.js +362 -0
- package/dist/terminal/storage/live-retention.js.map +1 -0
- package/dist/terminal/storage/queries.d.ts +6 -0
- package/dist/terminal/storage/queries.d.ts.map +1 -0
- package/dist/terminal/storage/queries.js +85 -0
- package/dist/terminal/storage/queries.js.map +1 -0
- package/dist/terminal/storage/record.d.ts +29 -0
- package/dist/terminal/storage/record.d.ts.map +1 -0
- package/dist/terminal/storage/record.js +87 -0
- package/dist/terminal/storage/record.js.map +1 -0
- package/dist/terminal/storage/request-digest.d.ts +3 -0
- package/dist/terminal/storage/request-digest.d.ts.map +1 -0
- package/dist/terminal/storage/request-digest.js +10 -0
- package/dist/terminal/storage/request-digest.js.map +1 -0
- package/dist/terminal/storage/sqlite-counter.d.ts +4 -0
- package/dist/terminal/storage/sqlite-counter.d.ts.map +1 -0
- package/dist/terminal/storage/sqlite-counter.js +15 -0
- package/dist/terminal/storage/sqlite-counter.js.map +1 -0
- package/package.json +70 -0
|
@@ -0,0 +1,789 @@
|
|
|
1
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
2
|
+
import { constants } from "node:fs";
|
|
3
|
+
import { chmod, lstat, mkdir, open, opendir, realpath, rename, rmdir, unlink, } from "node:fs/promises";
|
|
4
|
+
import { dirname, join } from "node:path";
|
|
5
|
+
import { configProfileNameSchema, MAIA_CONFIG_VERSION } from "@maiaos/protocol";
|
|
6
|
+
import { DateTime, Effect, Schema } from "effect";
|
|
7
|
+
import { asNodeRuntimeError, makeNodeRuntimeError, NodeRuntimeError, } from "../runtime/errors.js";
|
|
8
|
+
import { acquireProcessOwnedLock, } from "../runtime/instance-lock.js";
|
|
9
|
+
import { verifyConfigurationDocumentRole, } from "./document-role.js";
|
|
10
|
+
import { discoverUserConfigurationRoot, preparePrivateConfigurationDirectory, prepareUserConfigurationRoot, readConfigurationFile, readConfigurationFileHandle, sameConfigurationFile, sameConfigurationFileSnapshot, } from "./filesystem.js";
|
|
11
|
+
import { parseConfigurationDocument } from "./parser.js";
|
|
12
|
+
import { configurationPolicy } from "./policy.js";
|
|
13
|
+
const BACKUP_DOCUMENT_NAME = "document.jsonc";
|
|
14
|
+
const BACKUP_PROVENANCE_NAME = "provenance.json";
|
|
15
|
+
const BACKUP_CLAIM_PREFIX = ".claim-";
|
|
16
|
+
const TEMPORARY_FILE_PREFIX = ".maia-config-write-";
|
|
17
|
+
const WRITE_LOCK_NAME = ".configuration-write.lock";
|
|
18
|
+
const digestPattern = /^[a-f0-9]{64}$/u;
|
|
19
|
+
const backupIdPattern = /^\d{8}T\d{9}Z-[a-f0-9]{64}-[a-f0-9]{32}$/u;
|
|
20
|
+
const backupClaimPattern = /^\.claim-[a-f0-9]{32}$/u;
|
|
21
|
+
const backupCreatedAtPattern = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/u;
|
|
22
|
+
const configurationRelativePathPattern = /^(?:config\.jsonc|profiles\/([A-Za-z0-9][A-Za-z0-9._-]{0,63})\.jsonc)$/u;
|
|
23
|
+
const temporaryFilePattern = /^\.maia-config-write-[a-f0-9]{32}\.tmp$/u;
|
|
24
|
+
const openReadFlags = constants.O_RDONLY |
|
|
25
|
+
(process.platform === "win32" ? 0 : constants.O_NOFOLLOW);
|
|
26
|
+
const backupManifestSchema = Schema.Struct({
|
|
27
|
+
bytes: Schema.Int.check(Schema.isGreaterThan(0), Schema.isLessThanOrEqualTo(configurationPolicy.maximumFileBytes)),
|
|
28
|
+
createdAt: Schema.String.check(Schema.isPattern(backupCreatedAtPattern)),
|
|
29
|
+
digest: Schema.String.check(Schema.isPattern(digestPattern)),
|
|
30
|
+
relativePath: Schema.String.check(Schema.isPattern(configurationRelativePathPattern)),
|
|
31
|
+
version: Schema.Literal(MAIA_CONFIG_VERSION),
|
|
32
|
+
});
|
|
33
|
+
const decodeBackupManifest = Schema.decodeUnknownSync(Schema.fromJsonString(backupManifestSchema), { onExcessProperty: "error" });
|
|
34
|
+
const isNodeErrorCode = (error, code) => error instanceof Error && "code" in error && error.code === code;
|
|
35
|
+
const digestBytes = (contents) => createHash("sha256").update(contents).digest("hex");
|
|
36
|
+
const compactUuid = () => randomUUID().replaceAll("-", "");
|
|
37
|
+
const formatBackupTimestamp = (createdAt) => createdAt.replaceAll(/[-:.]/gu, "");
|
|
38
|
+
const destinationDetails = (destination) => {
|
|
39
|
+
if (destination.kind === "base") {
|
|
40
|
+
return { relativePath: "config.jsonc", role: "user-base" };
|
|
41
|
+
}
|
|
42
|
+
const profile = configProfileNameSchema.safeParse(destination.profile);
|
|
43
|
+
if (!profile.success) {
|
|
44
|
+
throw makeNodeRuntimeError("configuration_invalid", "The Maia configuration destination profile is invalid.");
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
relativePath: `profiles/${profile.data}.jsonc`,
|
|
48
|
+
role: "user-profile",
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
const validateExpectedDigest = (digest) => {
|
|
52
|
+
if (digest !== undefined &&
|
|
53
|
+
(digest.length !== 64 || !digestPattern.test(digest))) {
|
|
54
|
+
throw makeNodeRuntimeError("configuration_invalid", "The expected Maia configuration digest is invalid.");
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
const prepareContents = (text, role) => {
|
|
58
|
+
if (text.length > configurationPolicy.maximumFileBytes ||
|
|
59
|
+
Buffer.byteLength(text, "utf8") > configurationPolicy.maximumFileBytes) {
|
|
60
|
+
throw makeNodeRuntimeError("configuration_invalid", "The Maia configuration contents exceed their byte limit.");
|
|
61
|
+
}
|
|
62
|
+
const bytes = Buffer.from(text, "utf8");
|
|
63
|
+
if (new TextDecoder("utf-8", { fatal: true }).decode(bytes) !== text) {
|
|
64
|
+
throw makeNodeRuntimeError("configuration_invalid", "The Maia configuration contents exceed their bounds or are not valid UTF-8.");
|
|
65
|
+
}
|
|
66
|
+
const document = parseConfigurationDocument(text);
|
|
67
|
+
verifyConfigurationDocumentRole(document, role);
|
|
68
|
+
return { bytes, digest: digestBytes(bytes), text };
|
|
69
|
+
};
|
|
70
|
+
const toWriteError = (error, code = "configuration_write_failed", message = "The Maia configuration could not be written safely.") => asNodeRuntimeError(error, code, message);
|
|
71
|
+
const toRecoveryError = (error, message) => error instanceof NodeRuntimeError &&
|
|
72
|
+
error.code === "configuration_recovery_required"
|
|
73
|
+
? error
|
|
74
|
+
: makeNodeRuntimeError("configuration_recovery_required", message);
|
|
75
|
+
const ensureExpectedState = (current, expectedDigest) => {
|
|
76
|
+
const matches = expectedDigest === undefined
|
|
77
|
+
? current === undefined
|
|
78
|
+
: current?.digest === expectedDigest;
|
|
79
|
+
if (!matches) {
|
|
80
|
+
throw makeNodeRuntimeError("configuration_conflict", "The Maia configuration changed after it was read.", true);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
const ensureOwnedPrivateFile = (metadata) => {
|
|
84
|
+
const owned = typeof process.getuid !== "function" || metadata.uid === process.getuid();
|
|
85
|
+
const privateMode = process.platform === "win32" || (metadata.mode & 0o077) === 0;
|
|
86
|
+
if (!metadata.isFile() ||
|
|
87
|
+
metadata.isSymbolicLink() ||
|
|
88
|
+
metadata.nlink !== 1 ||
|
|
89
|
+
!owned ||
|
|
90
|
+
!privateMode) {
|
|
91
|
+
throw makeNodeRuntimeError("configuration_recovery_required", "A Maia configuration recovery file is unsafe.");
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
const ensureOwnedPrivateDirectory = async (path) => {
|
|
95
|
+
const metadata = await lstat(path);
|
|
96
|
+
const owned = typeof process.getuid !== "function" || metadata.uid === process.getuid();
|
|
97
|
+
const privateMode = process.platform === "win32" || (metadata.mode & 0o077) === 0;
|
|
98
|
+
if (!metadata.isDirectory() ||
|
|
99
|
+
metadata.isSymbolicLink() ||
|
|
100
|
+
!owned ||
|
|
101
|
+
!privateMode ||
|
|
102
|
+
(await realpath(path)) !== path) {
|
|
103
|
+
throw makeNodeRuntimeError("configuration_recovery_required", "A Maia configuration recovery directory is unsafe.");
|
|
104
|
+
}
|
|
105
|
+
return metadata;
|
|
106
|
+
};
|
|
107
|
+
const ensureFileWithinBounds = (metadata, maximumBytes) => {
|
|
108
|
+
ensureOwnedPrivateFile(metadata);
|
|
109
|
+
if (metadata.size > maximumBytes) {
|
|
110
|
+
throw makeNodeRuntimeError("configuration_recovery_required", "A Maia configuration recovery file exceeds its byte limit.");
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
const verifyStableFileRead = (read) => {
|
|
114
|
+
if (read.contents.byteLength > read.maximumBytes ||
|
|
115
|
+
read.canonical !== read.path ||
|
|
116
|
+
!sameConfigurationFileSnapshot(read.before, read.after) ||
|
|
117
|
+
!sameConfigurationFileSnapshot(read.before, read.current)) {
|
|
118
|
+
throw makeNodeRuntimeError("configuration_recovery_required", "A Maia configuration recovery file changed while it was read.");
|
|
119
|
+
}
|
|
120
|
+
return read.contents;
|
|
121
|
+
};
|
|
122
|
+
const readBoundedRecoveryContents = async (handle, maximumBytes) => {
|
|
123
|
+
try {
|
|
124
|
+
return await readConfigurationFileHandle(handle, maximumBytes);
|
|
125
|
+
}
|
|
126
|
+
catch (error) {
|
|
127
|
+
throw toRecoveryError(error, "A Maia configuration recovery file exceeds its byte limit.");
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
const readBoundedOwnedFile = async (path, maximumBytes) => {
|
|
131
|
+
const handle = await open(path, openReadFlags);
|
|
132
|
+
try {
|
|
133
|
+
const before = await handle.stat();
|
|
134
|
+
ensureFileWithinBounds(before, maximumBytes);
|
|
135
|
+
const contents = await readBoundedRecoveryContents(handle, maximumBytes);
|
|
136
|
+
const [after, current, canonical] = await Promise.all([
|
|
137
|
+
handle.stat(),
|
|
138
|
+
lstat(path),
|
|
139
|
+
realpath(path),
|
|
140
|
+
]);
|
|
141
|
+
return verifyStableFileRead({
|
|
142
|
+
after,
|
|
143
|
+
before,
|
|
144
|
+
canonical,
|
|
145
|
+
contents,
|
|
146
|
+
current,
|
|
147
|
+
maximumBytes,
|
|
148
|
+
path,
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
finally {
|
|
152
|
+
await handle.close();
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
const writeExclusiveAndSync = async (path, contents) => {
|
|
156
|
+
const flags = constants.O_WRONLY |
|
|
157
|
+
constants.O_CREAT |
|
|
158
|
+
constants.O_EXCL |
|
|
159
|
+
(process.platform === "win32" ? 0 : constants.O_NOFOLLOW);
|
|
160
|
+
const handle = await open(path, flags, 0o600);
|
|
161
|
+
let complete = false;
|
|
162
|
+
try {
|
|
163
|
+
await handle.writeFile(contents);
|
|
164
|
+
if (process.platform !== "win32")
|
|
165
|
+
await handle.chmod(0o600);
|
|
166
|
+
await handle.sync();
|
|
167
|
+
ensureOwnedPrivateFile(await handle.stat());
|
|
168
|
+
complete = true;
|
|
169
|
+
}
|
|
170
|
+
finally {
|
|
171
|
+
try {
|
|
172
|
+
await handle.close();
|
|
173
|
+
}
|
|
174
|
+
finally {
|
|
175
|
+
if (!complete) {
|
|
176
|
+
await unlink(path).catch((error) => {
|
|
177
|
+
if (!isNodeErrorCode(error, "ENOENT"))
|
|
178
|
+
throw error;
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
const syncDirectory = async (path) => {
|
|
185
|
+
if (process.platform === "win32")
|
|
186
|
+
return;
|
|
187
|
+
const handle = await open(path, constants.O_RDONLY);
|
|
188
|
+
try {
|
|
189
|
+
await handle.sync();
|
|
190
|
+
}
|
|
191
|
+
finally {
|
|
192
|
+
await handle.close();
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
const closeDirectory = async (directory) => {
|
|
196
|
+
try {
|
|
197
|
+
await directory.close();
|
|
198
|
+
}
|
|
199
|
+
catch (error) {
|
|
200
|
+
if (!isNodeErrorCode(error, "ERR_DIR_CLOSED"))
|
|
201
|
+
throw error;
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
const readDirectoryNames = async (directory, maximum, names = []) => {
|
|
205
|
+
if (names.length > maximum)
|
|
206
|
+
return names;
|
|
207
|
+
const entry = await directory.read();
|
|
208
|
+
return entry === null
|
|
209
|
+
? names
|
|
210
|
+
: readDirectoryNames(directory, maximum, [...names, entry.name]);
|
|
211
|
+
};
|
|
212
|
+
const readBoundedDirectoryNames = async (path, maximum) => {
|
|
213
|
+
const before = await ensureOwnedPrivateDirectory(path);
|
|
214
|
+
const directory = await opendir(path, { bufferSize: 1 });
|
|
215
|
+
let names;
|
|
216
|
+
try {
|
|
217
|
+
names = await readDirectoryNames(directory, maximum);
|
|
218
|
+
}
|
|
219
|
+
finally {
|
|
220
|
+
await closeDirectory(directory);
|
|
221
|
+
}
|
|
222
|
+
const after = await ensureOwnedPrivateDirectory(path);
|
|
223
|
+
if (!sameConfigurationFile(before, after) || names.length > maximum) {
|
|
224
|
+
throw makeNodeRuntimeError("configuration_recovery_required", "The Maia configuration backup directory exceeds its entry limit or changed during inspection.");
|
|
225
|
+
}
|
|
226
|
+
return names;
|
|
227
|
+
};
|
|
228
|
+
const removeKnownEntries = async (directoryPath, entries) => {
|
|
229
|
+
await Promise.all(entries.map(async (entry) => {
|
|
230
|
+
const path = join(directoryPath, entry);
|
|
231
|
+
ensureOwnedPrivateFile(await lstat(path));
|
|
232
|
+
await unlink(path);
|
|
233
|
+
}));
|
|
234
|
+
};
|
|
235
|
+
const verifyKnownEntries = (entries, allowedEntries) => {
|
|
236
|
+
if (entries.some((entry) => !allowedEntries.includes(entry))) {
|
|
237
|
+
throw makeNodeRuntimeError("configuration_recovery_required", "A Maia configuration recovery directory contains unexpected entries.");
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
const removeKnownDirectory = async (directoryPath, allowedEntries) => {
|
|
241
|
+
const generation = await ensureOwnedPrivateDirectory(directoryPath);
|
|
242
|
+
const entries = await readBoundedDirectoryNames(directoryPath, allowedEntries.length + 1);
|
|
243
|
+
verifyKnownEntries(entries, allowedEntries);
|
|
244
|
+
await removeKnownEntries(directoryPath, entries);
|
|
245
|
+
if (!sameConfigurationFile(generation, await ensureOwnedPrivateDirectory(directoryPath))) {
|
|
246
|
+
throw makeNodeRuntimeError("configuration_recovery_required", "A Maia configuration recovery directory changed during cleanup.");
|
|
247
|
+
}
|
|
248
|
+
await rmdir(directoryPath);
|
|
249
|
+
};
|
|
250
|
+
const cleanBackupClaims = async (backupRoot, names) => {
|
|
251
|
+
const claims = names.filter((entry) => entry.startsWith("."));
|
|
252
|
+
if (claims.some((name) => !backupClaimPattern.test(name))) {
|
|
253
|
+
throw makeNodeRuntimeError("configuration_recovery_required", "The Maia configuration backup directory contains an unknown recovery artifact.");
|
|
254
|
+
}
|
|
255
|
+
await Promise.all(claims.map((name) => removeKnownDirectory(join(backupRoot.path, name), [
|
|
256
|
+
BACKUP_DOCUMENT_NAME,
|
|
257
|
+
BACKUP_PROVENANCE_NAME,
|
|
258
|
+
])));
|
|
259
|
+
};
|
|
260
|
+
const decodeManifestBytes = (manifestBytes) => {
|
|
261
|
+
let text;
|
|
262
|
+
try {
|
|
263
|
+
text = new TextDecoder("utf-8", { fatal: true }).decode(manifestBytes);
|
|
264
|
+
}
|
|
265
|
+
catch (error) {
|
|
266
|
+
throw toWriteError(error, "configuration_recovery_required", "A Maia configuration backup manifest is not valid UTF-8.");
|
|
267
|
+
}
|
|
268
|
+
let manifest;
|
|
269
|
+
try {
|
|
270
|
+
manifest = decodeBackupManifest(text);
|
|
271
|
+
}
|
|
272
|
+
catch (error) {
|
|
273
|
+
throw toWriteError(error, "configuration_recovery_required", "A Maia configuration backup manifest is invalid.");
|
|
274
|
+
}
|
|
275
|
+
return manifest;
|
|
276
|
+
};
|
|
277
|
+
const readManifest = async (backupPath) => {
|
|
278
|
+
const manifestBytes = await readBoundedOwnedFile(join(backupPath, BACKUP_PROVENANCE_NAME), configurationPolicy.maximumManifestBytes);
|
|
279
|
+
const manifest = decodeManifestBytes(manifestBytes);
|
|
280
|
+
const documentMetadata = await lstat(join(backupPath, BACKUP_DOCUMENT_NAME));
|
|
281
|
+
ensureOwnedPrivateFile(documentMetadata);
|
|
282
|
+
if (documentMetadata.size !== manifest.bytes) {
|
|
283
|
+
throw makeNodeRuntimeError("configuration_recovery_required", "A Maia configuration backup size does not match its manifest.");
|
|
284
|
+
}
|
|
285
|
+
return {
|
|
286
|
+
manifest,
|
|
287
|
+
storedBytes: manifestBytes.byteLength + documentMetadata.size,
|
|
288
|
+
};
|
|
289
|
+
};
|
|
290
|
+
const validateBackupEntries = async (directoryPath) => {
|
|
291
|
+
await ensureOwnedPrivateDirectory(directoryPath);
|
|
292
|
+
const entries = await readBoundedDirectoryNames(directoryPath, 2);
|
|
293
|
+
if (entries.length !== 2 ||
|
|
294
|
+
!entries.includes(BACKUP_DOCUMENT_NAME) ||
|
|
295
|
+
!entries.includes(BACKUP_PROVENANCE_NAME)) {
|
|
296
|
+
throw makeNodeRuntimeError("configuration_recovery_required", "A Maia configuration backup is incomplete.");
|
|
297
|
+
}
|
|
298
|
+
};
|
|
299
|
+
const verifyBackupIdentity = (id, manifest) => {
|
|
300
|
+
if (id.slice(20, 84) !== manifest.digest ||
|
|
301
|
+
formatBackupTimestamp(manifest.createdAt) !== id.slice(0, 19)) {
|
|
302
|
+
throw makeNodeRuntimeError("configuration_recovery_required", "A Maia configuration backup identity is inconsistent.");
|
|
303
|
+
}
|
|
304
|
+
};
|
|
305
|
+
const inspectBackup = async (backupRoot, id) => {
|
|
306
|
+
if (!backupIdPattern.test(id)) {
|
|
307
|
+
throw makeNodeRuntimeError("configuration_recovery_required", "The Maia configuration backup directory contains an unknown entry.");
|
|
308
|
+
}
|
|
309
|
+
const directoryPath = join(backupRoot.path, id);
|
|
310
|
+
await validateBackupEntries(directoryPath);
|
|
311
|
+
const inspected = await readManifest(directoryPath);
|
|
312
|
+
verifyBackupIdentity(id, inspected.manifest);
|
|
313
|
+
return {
|
|
314
|
+
...inspected.manifest,
|
|
315
|
+
directoryPath,
|
|
316
|
+
id,
|
|
317
|
+
storedBytes: inspected.storedBytes,
|
|
318
|
+
};
|
|
319
|
+
};
|
|
320
|
+
const inspectBackups = async (backupRoot) => {
|
|
321
|
+
const initialNames = await readBoundedDirectoryNames(backupRoot.path, configurationPolicy.maximumBackupDirectoryEntries);
|
|
322
|
+
await cleanBackupClaims(backupRoot, initialNames);
|
|
323
|
+
const names = initialNames.filter((name) => !name.startsWith("."));
|
|
324
|
+
const backups = await Promise.all(names.map((id) => inspectBackup(backupRoot, id)));
|
|
325
|
+
return backups.toSorted((left, right) => left.createdAt.localeCompare(right.createdAt));
|
|
326
|
+
};
|
|
327
|
+
const prepareBackupRoot = async (root) => {
|
|
328
|
+
const backups = await preparePrivateConfigurationDirectory(root, join(root.path, "backups"));
|
|
329
|
+
return preparePrivateConfigurationDirectory(backups, join(backups.path, "config"));
|
|
330
|
+
};
|
|
331
|
+
const makeBackupId = (createdAt, digest) => `${formatBackupTimestamp(createdAt)}-${digest}-${compactUuid()}`;
|
|
332
|
+
const persistBackupClaim = async (claim) => {
|
|
333
|
+
const writes = await Promise.allSettled([
|
|
334
|
+
writeExclusiveAndSync(join(claim.claimPath, BACKUP_DOCUMENT_NAME), Buffer.from(claim.previous.text, "utf8")),
|
|
335
|
+
writeExclusiveAndSync(join(claim.claimPath, BACKUP_PROVENANCE_NAME), claim.manifestBytes),
|
|
336
|
+
]);
|
|
337
|
+
const failed = writes.find((write) => write.status === "rejected");
|
|
338
|
+
if (failed?.status === "rejected")
|
|
339
|
+
throw failed.reason;
|
|
340
|
+
await syncDirectory(claim.claimPath);
|
|
341
|
+
await rename(claim.claimPath, claim.destinationPath);
|
|
342
|
+
};
|
|
343
|
+
const removeBackupClaim = async (claimPath) => {
|
|
344
|
+
try {
|
|
345
|
+
await removeKnownDirectory(claimPath, [
|
|
346
|
+
BACKUP_DOCUMENT_NAME,
|
|
347
|
+
BACKUP_PROVENANCE_NAME,
|
|
348
|
+
]);
|
|
349
|
+
}
|
|
350
|
+
catch (error) {
|
|
351
|
+
if (!isNodeErrorCode(error, "ENOENT")) {
|
|
352
|
+
throw makeNodeRuntimeError("configuration_recovery_required", "A failed Maia configuration backup requires recovery.");
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
};
|
|
356
|
+
const makeBackupManifest = (input) => ({
|
|
357
|
+
bytes: input.previous.bytes,
|
|
358
|
+
createdAt: input.createdAt,
|
|
359
|
+
digest: input.previous.digest,
|
|
360
|
+
relativePath: input.relativePath,
|
|
361
|
+
version: MAIA_CONFIG_VERSION,
|
|
362
|
+
});
|
|
363
|
+
const prepareBackupClaim = async (input, id) => {
|
|
364
|
+
const claimPath = join(input.backupRoot.path, `${BACKUP_CLAIM_PREFIX}${compactUuid()}`);
|
|
365
|
+
await mkdir(claimPath, { mode: 0o700 });
|
|
366
|
+
if (process.platform !== "win32")
|
|
367
|
+
await chmod(claimPath, 0o700);
|
|
368
|
+
await ensureOwnedPrivateDirectory(claimPath);
|
|
369
|
+
const manifestBytes = Buffer.from(`${JSON.stringify(makeBackupManifest(input))}\n`, "utf8");
|
|
370
|
+
return {
|
|
371
|
+
claimPath,
|
|
372
|
+
destinationPath: join(input.backupRoot.path, id),
|
|
373
|
+
manifestBytes,
|
|
374
|
+
previous: input.previous,
|
|
375
|
+
};
|
|
376
|
+
};
|
|
377
|
+
const createBackup = async (input) => {
|
|
378
|
+
const id = makeBackupId(input.createdAt, input.previous.digest);
|
|
379
|
+
const claim = await prepareBackupClaim(input, id);
|
|
380
|
+
try {
|
|
381
|
+
await persistBackupClaim(claim);
|
|
382
|
+
await syncDirectory(input.backupRoot.path);
|
|
383
|
+
}
|
|
384
|
+
catch (error) {
|
|
385
|
+
await removeBackupClaim(claim.claimPath);
|
|
386
|
+
throw error;
|
|
387
|
+
}
|
|
388
|
+
return {
|
|
389
|
+
...makeBackupManifest(input),
|
|
390
|
+
directoryPath: claim.destinationPath,
|
|
391
|
+
id,
|
|
392
|
+
storedBytes: input.previous.bytes + claim.manifestBytes.byteLength,
|
|
393
|
+
};
|
|
394
|
+
};
|
|
395
|
+
const selectObsoleteBackups = (backups) => {
|
|
396
|
+
const totalBytes = backups.reduce((total, backup) => total + backup.storedBytes, 0);
|
|
397
|
+
const select = (remaining, bytes, obsolete = []) => {
|
|
398
|
+
const oldest = remaining[0];
|
|
399
|
+
if (oldest === undefined ||
|
|
400
|
+
(remaining.length <= configurationPolicy.maximumBackups &&
|
|
401
|
+
bytes <= configurationPolicy.maximumBackupBytes)) {
|
|
402
|
+
return obsolete;
|
|
403
|
+
}
|
|
404
|
+
return select(remaining.slice(1), bytes - oldest.storedBytes, [
|
|
405
|
+
...obsolete,
|
|
406
|
+
oldest,
|
|
407
|
+
]);
|
|
408
|
+
};
|
|
409
|
+
return select(backups, totalBytes);
|
|
410
|
+
};
|
|
411
|
+
const removeBackup = (backup) => removeKnownDirectory(backup.directoryPath, [
|
|
412
|
+
BACKUP_DOCUMENT_NAME,
|
|
413
|
+
BACKUP_PROVENANCE_NAME,
|
|
414
|
+
]);
|
|
415
|
+
const readCurrent = async (root, relativePath, role) => {
|
|
416
|
+
let current;
|
|
417
|
+
try {
|
|
418
|
+
current = await readConfigurationFile({
|
|
419
|
+
...root,
|
|
420
|
+
filePath: join(root.path, relativePath),
|
|
421
|
+
optional: true,
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
catch (error) {
|
|
425
|
+
throw toWriteError(error, "configuration_invalid", "The Maia configuration destination is unsafe.");
|
|
426
|
+
}
|
|
427
|
+
if (current !== undefined) {
|
|
428
|
+
verifyConfigurationDocumentRole(parseConfigurationDocument(current.text), role);
|
|
429
|
+
}
|
|
430
|
+
return current;
|
|
431
|
+
};
|
|
432
|
+
const prepareDestinationDirectory = async (root, relativePath) => {
|
|
433
|
+
const path = dirname(join(root.path, relativePath));
|
|
434
|
+
return path === root.path
|
|
435
|
+
? root
|
|
436
|
+
: preparePrivateConfigurationDirectory(root, path);
|
|
437
|
+
};
|
|
438
|
+
const runHook = async (hooks, phase) => {
|
|
439
|
+
await hooks.afterPhase?.(phase);
|
|
440
|
+
};
|
|
441
|
+
const removeTemporaryFile = async (path) => {
|
|
442
|
+
try {
|
|
443
|
+
const metadata = await lstat(path);
|
|
444
|
+
ensureOwnedPrivateFile(metadata);
|
|
445
|
+
await unlink(path);
|
|
446
|
+
}
|
|
447
|
+
catch (error) {
|
|
448
|
+
if (!isNodeErrorCode(error, "ENOENT"))
|
|
449
|
+
throw error;
|
|
450
|
+
}
|
|
451
|
+
};
|
|
452
|
+
const cleanTemporaryFiles = async (directory) => {
|
|
453
|
+
const entries = await readBoundedDirectoryNames(directory.path, configurationPolicy.maximumWritableDirectoryEntries);
|
|
454
|
+
const temporaryFiles = entries.filter((name) => name.startsWith(TEMPORARY_FILE_PREFIX));
|
|
455
|
+
if (temporaryFiles.some((entry) => !temporaryFilePattern.test(entry))) {
|
|
456
|
+
throw makeNodeRuntimeError("configuration_recovery_required", "The Maia configuration directory contains an unknown write artifact.");
|
|
457
|
+
}
|
|
458
|
+
await Promise.all(temporaryFiles.map((entry) => removeTemporaryFile(join(directory.path, entry))));
|
|
459
|
+
};
|
|
460
|
+
const restorePreviousContents = async (context) => {
|
|
461
|
+
if (context.previous === undefined) {
|
|
462
|
+
await unlink(context.destinationPath);
|
|
463
|
+
return;
|
|
464
|
+
}
|
|
465
|
+
const rollbackPath = join(dirname(context.destinationPath), `${TEMPORARY_FILE_PREFIX}${compactUuid()}.tmp`);
|
|
466
|
+
try {
|
|
467
|
+
await writeExclusiveAndSync(rollbackPath, Buffer.from(context.previous.text, "utf8"));
|
|
468
|
+
await rename(rollbackPath, context.destinationPath);
|
|
469
|
+
}
|
|
470
|
+
finally {
|
|
471
|
+
await removeTemporaryFile(rollbackPath);
|
|
472
|
+
}
|
|
473
|
+
};
|
|
474
|
+
const verifyPreviousRestored = async (context) => {
|
|
475
|
+
const restored = await readConfigurationFile({
|
|
476
|
+
...context.root,
|
|
477
|
+
filePath: context.destinationPath,
|
|
478
|
+
optional: true,
|
|
479
|
+
});
|
|
480
|
+
if (restored?.digest !== context.previous?.digest) {
|
|
481
|
+
throw makeNodeRuntimeError("configuration_recovery_required", "The previous Maia configuration could not be restored.");
|
|
482
|
+
}
|
|
483
|
+
};
|
|
484
|
+
const rollbackReplacement = async (context) => {
|
|
485
|
+
const current = await readConfigurationFile({
|
|
486
|
+
...context.root,
|
|
487
|
+
filePath: context.destinationPath,
|
|
488
|
+
optional: true,
|
|
489
|
+
});
|
|
490
|
+
if (current?.digest !== context.intended.digest) {
|
|
491
|
+
throw makeNodeRuntimeError("configuration_recovery_required", "The Maia configuration changed while a failed commit was being recovered.");
|
|
492
|
+
}
|
|
493
|
+
await restorePreviousContents(context);
|
|
494
|
+
await syncDirectory(dirname(context.destinationPath));
|
|
495
|
+
await verifyPreviousRestored(context);
|
|
496
|
+
};
|
|
497
|
+
const verifyCommittedReplacement = async (context, hooks) => {
|
|
498
|
+
const verified = await readConfigurationFile({
|
|
499
|
+
...context.root,
|
|
500
|
+
filePath: context.destinationPath,
|
|
501
|
+
optional: false,
|
|
502
|
+
});
|
|
503
|
+
if (verified?.digest !== context.intended.digest) {
|
|
504
|
+
throw makeNodeRuntimeError("configuration_write_failed", "The committed Maia configuration did not verify.");
|
|
505
|
+
}
|
|
506
|
+
parseConfigurationDocument(verified.text);
|
|
507
|
+
await runHook(hooks, "replacement_verified");
|
|
508
|
+
};
|
|
509
|
+
const recheckBeforeReplacement = async (context) => {
|
|
510
|
+
const immediatelyBefore = await readCurrent(context.root, context.relativePath, context.relativePath === "config.jsonc" ? "user-base" : "user-profile");
|
|
511
|
+
ensureExpectedState(immediatelyBefore, context.previous?.digest);
|
|
512
|
+
};
|
|
513
|
+
const recoverCommitFailure = async (context, error) => {
|
|
514
|
+
try {
|
|
515
|
+
await rollbackReplacement(context);
|
|
516
|
+
}
|
|
517
|
+
catch (rollbackError) {
|
|
518
|
+
return toRecoveryError(rollbackError, "The Maia configuration commit failed and could not be rolled back safely.");
|
|
519
|
+
}
|
|
520
|
+
return toWriteError(error);
|
|
521
|
+
};
|
|
522
|
+
const replaceDestination = async (context, temporaryPath) => {
|
|
523
|
+
try {
|
|
524
|
+
await rename(temporaryPath, context.destinationPath);
|
|
525
|
+
}
|
|
526
|
+
catch (error) {
|
|
527
|
+
let current;
|
|
528
|
+
try {
|
|
529
|
+
current = await readConfigurationFile({
|
|
530
|
+
...context.root,
|
|
531
|
+
filePath: context.destinationPath,
|
|
532
|
+
optional: true,
|
|
533
|
+
});
|
|
534
|
+
}
|
|
535
|
+
catch (inspectionError) {
|
|
536
|
+
throw toRecoveryError(inspectionError, "The Maia configuration replacement outcome could not be verified.");
|
|
537
|
+
}
|
|
538
|
+
if (current?.digest === context.intended.digest)
|
|
539
|
+
return;
|
|
540
|
+
if (current?.digest === context.previous?.digest)
|
|
541
|
+
throw error;
|
|
542
|
+
throw makeNodeRuntimeError("configuration_recovery_required", "The Maia configuration replacement has an unknown outcome.");
|
|
543
|
+
}
|
|
544
|
+
};
|
|
545
|
+
const performReplacement = async (context, hooks, temporaryPath) => {
|
|
546
|
+
let destinationReplaced = false;
|
|
547
|
+
try {
|
|
548
|
+
await writeExclusiveAndSync(temporaryPath, context.intended.bytes);
|
|
549
|
+
await runHook(hooks, "temporary_file_synced");
|
|
550
|
+
await recheckBeforeReplacement(context);
|
|
551
|
+
await replaceDestination(context, temporaryPath);
|
|
552
|
+
destinationReplaced = true;
|
|
553
|
+
await syncDirectory(dirname(context.destinationPath));
|
|
554
|
+
await runHook(hooks, "destination_replaced");
|
|
555
|
+
await verifyCommittedReplacement(context, hooks);
|
|
556
|
+
return;
|
|
557
|
+
}
|
|
558
|
+
catch (error) {
|
|
559
|
+
return destinationReplaced
|
|
560
|
+
? recoverCommitFailure(context, error)
|
|
561
|
+
: toWriteError(error);
|
|
562
|
+
}
|
|
563
|
+
};
|
|
564
|
+
const commitReplacement = async (context, hooks) => {
|
|
565
|
+
const temporaryPath = join(dirname(context.destinationPath), `${TEMPORARY_FILE_PREFIX}${compactUuid()}.tmp`);
|
|
566
|
+
const failure = await performReplacement(context, hooks, temporaryPath);
|
|
567
|
+
try {
|
|
568
|
+
await removeTemporaryFile(temporaryPath);
|
|
569
|
+
}
|
|
570
|
+
catch (cleanupError) {
|
|
571
|
+
throw toRecoveryError(cleanupError, "A Maia configuration temporary artifact requires recovery.");
|
|
572
|
+
}
|
|
573
|
+
if (failure !== undefined)
|
|
574
|
+
throw failure;
|
|
575
|
+
};
|
|
576
|
+
const makeLockMetadata = (startedAt) => ({
|
|
577
|
+
instanceId: compactUuid(),
|
|
578
|
+
pid: process.pid,
|
|
579
|
+
startedAt,
|
|
580
|
+
});
|
|
581
|
+
const acquireWriteLock = (root, startedAt) => acquireProcessOwnedLock(join(root.path, WRITE_LOCK_NAME), makeLockMetadata(startedAt)).pipe(Effect.mapError((error) => {
|
|
582
|
+
if (error.code === "already_running") {
|
|
583
|
+
return makeNodeRuntimeError("configuration_conflict", "Another Maia configuration writer owns this user root.", true);
|
|
584
|
+
}
|
|
585
|
+
if (error.code === "path_invalid") {
|
|
586
|
+
return toRecoveryError(error, "The Maia configuration write lock could not be acquired safely.");
|
|
587
|
+
}
|
|
588
|
+
return toWriteError(error, "configuration_write_failed", "The Maia configuration write lock could not be acquired safely.");
|
|
589
|
+
}));
|
|
590
|
+
const releaseWriteLock = (resource) => resource.release.pipe(Effect.mapError((error) => toRecoveryError(error, "The Maia configuration write completed but its lock could not be released safely.")));
|
|
591
|
+
const prepareWrite = (input) => {
|
|
592
|
+
validateExpectedDigest(input.expectedDigest);
|
|
593
|
+
const destination = destinationDetails(input.destination);
|
|
594
|
+
return {
|
|
595
|
+
...(input.expectedDigest === undefined
|
|
596
|
+
? {}
|
|
597
|
+
: { expectedDigest: input.expectedDigest }),
|
|
598
|
+
intended: prepareContents(input.contents, destination.role),
|
|
599
|
+
...destination,
|
|
600
|
+
};
|
|
601
|
+
};
|
|
602
|
+
const ensureBackupCapacity = (backups) => {
|
|
603
|
+
if (backups.length >= configurationPolicy.maximumBackupDirectoryEntries) {
|
|
604
|
+
throw makeNodeRuntimeError("configuration_recovery_required", "The Maia configuration backup directory has no safe commit capacity.");
|
|
605
|
+
}
|
|
606
|
+
};
|
|
607
|
+
const prepareWriteBackup = async (input, previous) => {
|
|
608
|
+
if (previous === undefined)
|
|
609
|
+
return {};
|
|
610
|
+
const root = await prepareBackupRoot(input.root);
|
|
611
|
+
ensureBackupCapacity(await inspectBackups(root));
|
|
612
|
+
const backup = await createBackup({
|
|
613
|
+
backupRoot: root,
|
|
614
|
+
createdAt: input.committedAt,
|
|
615
|
+
previous,
|
|
616
|
+
relativePath: input.write.relativePath,
|
|
617
|
+
});
|
|
618
|
+
try {
|
|
619
|
+
await runHook(input.hooks, "backup_persisted");
|
|
620
|
+
}
|
|
621
|
+
catch (error) {
|
|
622
|
+
await removeFailedBackup(backup);
|
|
623
|
+
throw error;
|
|
624
|
+
}
|
|
625
|
+
return { backup, root };
|
|
626
|
+
};
|
|
627
|
+
const removeFailedBackup = async (backup) => {
|
|
628
|
+
try {
|
|
629
|
+
await removeBackup(backup);
|
|
630
|
+
}
|
|
631
|
+
catch (error) {
|
|
632
|
+
throw toRecoveryError(error, "A failed Maia configuration commit left a backup requiring recovery.");
|
|
633
|
+
}
|
|
634
|
+
};
|
|
635
|
+
const pruneBackups = async (root) => {
|
|
636
|
+
try {
|
|
637
|
+
const backups = await inspectBackups(root);
|
|
638
|
+
const obsolete = selectObsoleteBackups(backups);
|
|
639
|
+
if (obsolete.length === 0)
|
|
640
|
+
return;
|
|
641
|
+
await Promise.all(obsolete.map(removeBackup));
|
|
642
|
+
await syncDirectory(root.path);
|
|
643
|
+
}
|
|
644
|
+
catch (error) {
|
|
645
|
+
throw toRecoveryError(error, "The Maia configuration was committed but backup retention requires recovery.");
|
|
646
|
+
}
|
|
647
|
+
};
|
|
648
|
+
const makeWriteReceipt = (input, previous, backup) => ({
|
|
649
|
+
...(backup === undefined ? {} : { backupId: backup.id }),
|
|
650
|
+
bytes: input.write.intended.bytes.byteLength,
|
|
651
|
+
committedAt: input.committedAt,
|
|
652
|
+
digest: input.write.intended.digest,
|
|
653
|
+
...(previous === undefined ? {} : { previousDigest: previous.digest }),
|
|
654
|
+
relativePath: input.write.relativePath,
|
|
655
|
+
version: MAIA_CONFIG_VERSION,
|
|
656
|
+
});
|
|
657
|
+
const makeCommitContext = (input, previous) => ({
|
|
658
|
+
destinationPath: join(input.root.path, input.write.relativePath),
|
|
659
|
+
intended: input.write.intended,
|
|
660
|
+
...(previous === undefined ? {} : { previous }),
|
|
661
|
+
relativePath: input.write.relativePath,
|
|
662
|
+
root: input.root,
|
|
663
|
+
});
|
|
664
|
+
const commitWithBackupCleanup = async (context, hooks, backup) => {
|
|
665
|
+
try {
|
|
666
|
+
await commitReplacement(context, hooks);
|
|
667
|
+
}
|
|
668
|
+
catch (error) {
|
|
669
|
+
if (backup !== undefined &&
|
|
670
|
+
!(error instanceof NodeRuntimeError &&
|
|
671
|
+
error.code === "configuration_recovery_required")) {
|
|
672
|
+
await removeFailedBackup(backup);
|
|
673
|
+
}
|
|
674
|
+
throw error;
|
|
675
|
+
}
|
|
676
|
+
};
|
|
677
|
+
const performWrite = async (input) => {
|
|
678
|
+
const destinationDirectory = await prepareDestinationDirectory(input.root, input.write.relativePath);
|
|
679
|
+
await cleanTemporaryFiles(destinationDirectory);
|
|
680
|
+
const previous = await readCurrent(input.root, input.write.relativePath, input.write.role);
|
|
681
|
+
ensureExpectedState(previous, input.write.expectedDigest);
|
|
682
|
+
const preparedBackup = await prepareWriteBackup(input, previous);
|
|
683
|
+
await commitWithBackupCleanup(makeCommitContext(input, previous), input.hooks, preparedBackup.backup);
|
|
684
|
+
if (preparedBackup.root !== undefined)
|
|
685
|
+
await pruneBackups(preparedBackup.root);
|
|
686
|
+
return makeWriteReceipt(input, previous, preparedBackup.backup);
|
|
687
|
+
};
|
|
688
|
+
const writeWithHooks = Effect.fn("NodeConfiguration.writeUser")(function* (input, hooks = {}) {
|
|
689
|
+
const write = yield* Effect.try({
|
|
690
|
+
catch: (error) => toWriteError(error, "configuration_invalid"),
|
|
691
|
+
try: () => prepareWrite(input),
|
|
692
|
+
});
|
|
693
|
+
const startedAt = DateTime.formatIso(yield* DateTime.now);
|
|
694
|
+
const root = yield* Effect.tryPromise({
|
|
695
|
+
catch: (error) => toWriteError(error, "configuration_invalid", "The Maia user configuration root could not be prepared safely."),
|
|
696
|
+
try: () => prepareUserConfigurationRoot(input.canonicalUserRoot),
|
|
697
|
+
});
|
|
698
|
+
return yield* Effect.acquireUseRelease(acquireWriteLock(root, startedAt), () => Effect.tryPromise({
|
|
699
|
+
catch: toWriteError,
|
|
700
|
+
try: () => performWrite({ committedAt: startedAt, hooks, root, write }),
|
|
701
|
+
}).pipe(Effect.uninterruptible), releaseWriteLock);
|
|
702
|
+
});
|
|
703
|
+
export const writeUserConfiguration = (input) => writeWithHooks(input);
|
|
704
|
+
const readBackupDocument = async (backup) => {
|
|
705
|
+
const contents = await readBoundedOwnedFile(join(backup.directoryPath, BACKUP_DOCUMENT_NAME), configurationPolicy.maximumFileBytes);
|
|
706
|
+
if (contents.byteLength !== backup.bytes ||
|
|
707
|
+
digestBytes(contents) !== backup.digest) {
|
|
708
|
+
throw makeNodeRuntimeError("configuration_recovery_required", "A Maia configuration backup does not match its recorded digest.");
|
|
709
|
+
}
|
|
710
|
+
try {
|
|
711
|
+
return new TextDecoder("utf-8", { fatal: true }).decode(contents);
|
|
712
|
+
}
|
|
713
|
+
catch (error) {
|
|
714
|
+
throw toWriteError(error, "configuration_recovery_required", "A Maia configuration backup is not valid UTF-8.");
|
|
715
|
+
}
|
|
716
|
+
};
|
|
717
|
+
const destinationFromRelativePath = (relativePath) => {
|
|
718
|
+
if (relativePath === "config.jsonc")
|
|
719
|
+
return { kind: "base" };
|
|
720
|
+
const match = configurationRelativePathPattern.exec(relativePath);
|
|
721
|
+
const profile = match?.[1];
|
|
722
|
+
if (profile === undefined) {
|
|
723
|
+
throw makeNodeRuntimeError("configuration_recovery_required", "A Maia configuration backup has an unsupported destination.");
|
|
724
|
+
}
|
|
725
|
+
return { kind: "profile", profile };
|
|
726
|
+
};
|
|
727
|
+
const validateRestoreInput = (input) => {
|
|
728
|
+
if (!backupIdPattern.test(input.backupId)) {
|
|
729
|
+
throw makeNodeRuntimeError("configuration_invalid", "The Maia configuration backup identifier is invalid.");
|
|
730
|
+
}
|
|
731
|
+
validateExpectedDigest(input.expectedDigest);
|
|
732
|
+
};
|
|
733
|
+
const discoverRequiredUserRoot = async (canonicalUserRoot) => {
|
|
734
|
+
const discovered = await discoverUserConfigurationRoot(canonicalUserRoot, []);
|
|
735
|
+
if (discovered === undefined) {
|
|
736
|
+
throw makeNodeRuntimeError("configuration_invalid", "The Maia user configuration root does not exist.");
|
|
737
|
+
}
|
|
738
|
+
return discovered;
|
|
739
|
+
};
|
|
740
|
+
const openRequiredUserRoot = (canonicalUserRoot) => Effect.tryPromise({
|
|
741
|
+
catch: (error) => toWriteError(error, "configuration_invalid", "The Maia user configuration root could not be opened safely."),
|
|
742
|
+
try: () => discoverRequiredUserRoot(canonicalUserRoot),
|
|
743
|
+
});
|
|
744
|
+
const requireBackup = (backups, id) => {
|
|
745
|
+
const backup = backups.find((candidate) => candidate.id === id);
|
|
746
|
+
if (backup === undefined) {
|
|
747
|
+
throw makeNodeRuntimeError("configuration_invalid", "The requested Maia configuration backup does not exist.");
|
|
748
|
+
}
|
|
749
|
+
return backup;
|
|
750
|
+
};
|
|
751
|
+
const restoreUnderLock = async (restore) => {
|
|
752
|
+
const backupRoot = await prepareBackupRoot(restore.root);
|
|
753
|
+
const backup = requireBackup(await inspectBackups(backupRoot), restore.input.backupId);
|
|
754
|
+
const contents = await readBackupDocument(backup);
|
|
755
|
+
const destination = destinationFromRelativePath(backup.relativePath);
|
|
756
|
+
const write = prepareWrite({
|
|
757
|
+
canonicalUserRoot: restore.root.path,
|
|
758
|
+
contents,
|
|
759
|
+
destination,
|
|
760
|
+
...(restore.input.expectedDigest === undefined
|
|
761
|
+
? {}
|
|
762
|
+
: { expectedDigest: restore.input.expectedDigest }),
|
|
763
|
+
});
|
|
764
|
+
return performWrite({
|
|
765
|
+
committedAt: restore.startedAt,
|
|
766
|
+
hooks: {},
|
|
767
|
+
root: restore.root,
|
|
768
|
+
write,
|
|
769
|
+
});
|
|
770
|
+
};
|
|
771
|
+
export const restoreUserConfiguration = Effect.fn("NodeConfiguration.restoreUser")(function* (input) {
|
|
772
|
+
yield* Effect.try({
|
|
773
|
+
catch: (error) => toWriteError(error, "configuration_invalid"),
|
|
774
|
+
try: () => {
|
|
775
|
+
validateRestoreInput(input);
|
|
776
|
+
},
|
|
777
|
+
});
|
|
778
|
+
const startedAt = DateTime.formatIso(yield* DateTime.now);
|
|
779
|
+
const root = yield* openRequiredUserRoot(input.canonicalUserRoot);
|
|
780
|
+
return yield* Effect.acquireUseRelease(acquireWriteLock(root, startedAt), () => Effect.tryPromise({
|
|
781
|
+
catch: toWriteError,
|
|
782
|
+
try: () => restoreUnderLock({ input, root, startedAt }),
|
|
783
|
+
}).pipe(Effect.uninterruptible), releaseWriteLock);
|
|
784
|
+
});
|
|
785
|
+
export const configurationWriterInternals = {
|
|
786
|
+
backupIdPattern,
|
|
787
|
+
writeWithHooks,
|
|
788
|
+
};
|
|
789
|
+
//# sourceMappingURL=writer.js.map
|