@timurproko/a1 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +68 -0
- package/bin/addone-supervisor.js +7 -0
- package/bin/addone-ui.js +20 -0
- package/bin/addone.js +26 -0
- package/dist/src/cli/dispatch.d.ts +26 -0
- package/dist/src/cli/dispatch.d.ts.map +1 -0
- package/dist/src/cli/dispatch.js +35 -0
- package/dist/src/cli/dispatch.js.map +1 -0
- package/dist/src/cli/index.d.ts +4 -0
- package/dist/src/cli/index.d.ts.map +1 -0
- package/dist/src/cli/index.js +4 -0
- package/dist/src/cli/index.js.map +1 -0
- package/dist/src/cli/version-stats.d.ts +17 -0
- package/dist/src/cli/version-stats.d.ts.map +1 -0
- package/dist/src/cli/version-stats.js +68 -0
- package/dist/src/cli/version-stats.js.map +1 -0
- package/dist/src/cli/version.d.ts +3 -0
- package/dist/src/cli/version.d.ts.map +1 -0
- package/dist/src/cli/version.js +23 -0
- package/dist/src/cli/version.js.map +1 -0
- package/dist/src/features/launch/development-launch.d.ts +9 -0
- package/dist/src/features/launch/development-launch.d.ts.map +1 -0
- package/dist/src/features/launch/development-launch.js +27 -0
- package/dist/src/features/launch/development-launch.js.map +1 -0
- package/dist/src/features/launch/index.d.ts +8 -0
- package/dist/src/features/launch/index.d.ts.map +1 -0
- package/dist/src/features/launch/index.js +8 -0
- package/dist/src/features/launch/index.js.map +1 -0
- package/dist/src/features/launch/initialize-profile.d.ts +7 -0
- package/dist/src/features/launch/initialize-profile.d.ts.map +1 -0
- package/dist/src/features/launch/initialize-profile.js +59 -0
- package/dist/src/features/launch/initialize-profile.js.map +1 -0
- package/dist/src/features/launch/intent.d.ts +8 -0
- package/dist/src/features/launch/intent.d.ts.map +1 -0
- package/dist/src/features/launch/intent.js +5 -0
- package/dist/src/features/launch/intent.js.map +1 -0
- package/dist/src/features/launch/prepare-launch.d.ts +14 -0
- package/dist/src/features/launch/prepare-launch.d.ts.map +1 -0
- package/dist/src/features/launch/prepare-launch.js +22 -0
- package/dist/src/features/launch/prepare-launch.js.map +1 -0
- package/dist/src/features/launch/profile-paths.d.ts +16 -0
- package/dist/src/features/launch/profile-paths.d.ts.map +1 -0
- package/dist/src/features/launch/profile-paths.js +30 -0
- package/dist/src/features/launch/profile-paths.js.map +1 -0
- package/dist/src/features/launch/profiles.d.ts +13 -0
- package/dist/src/features/launch/profiles.d.ts.map +1 -0
- package/dist/src/features/launch/profiles.js +27 -0
- package/dist/src/features/launch/profiles.js.map +1 -0
- package/dist/src/features/launch/runtime-selection.d.ts +15 -0
- package/dist/src/features/launch/runtime-selection.d.ts.map +1 -0
- package/dist/src/features/launch/runtime-selection.js +14 -0
- package/dist/src/features/launch/runtime-selection.js.map +1 -0
- package/dist/src/features/owned-ui/customization.d.ts +36 -0
- package/dist/src/features/owned-ui/customization.d.ts.map +1 -0
- package/dist/src/features/owned-ui/customization.js +110 -0
- package/dist/src/features/owned-ui/customization.js.map +1 -0
- package/dist/src/features/owned-ui/diagnostics.d.ts +34 -0
- package/dist/src/features/owned-ui/diagnostics.d.ts.map +1 -0
- package/dist/src/features/owned-ui/diagnostics.js +95 -0
- package/dist/src/features/owned-ui/diagnostics.js.map +1 -0
- package/dist/src/features/owned-ui/index.d.ts +5 -0
- package/dist/src/features/owned-ui/index.d.ts.map +1 -0
- package/dist/src/features/owned-ui/index.js +5 -0
- package/dist/src/features/owned-ui/index.js.map +1 -0
- package/dist/src/features/owned-ui/pi-session-shell.d.ts +97 -0
- package/dist/src/features/owned-ui/pi-session-shell.d.ts.map +1 -0
- package/dist/src/features/owned-ui/pi-session-shell.js +1437 -0
- package/dist/src/features/owned-ui/pi-session-shell.js.map +1 -0
- package/dist/src/features/owned-ui/run.d.ts +9 -0
- package/dist/src/features/owned-ui/run.d.ts.map +1 -0
- package/dist/src/features/owned-ui/run.js +21 -0
- package/dist/src/features/owned-ui/run.js.map +1 -0
- package/dist/src/features/workspace/capabilities.d.ts +32 -0
- package/dist/src/features/workspace/capabilities.d.ts.map +1 -0
- package/dist/src/features/workspace/capabilities.js +76 -0
- package/dist/src/features/workspace/capabilities.js.map +1 -0
- package/dist/src/features/workspace/index.d.ts +7 -0
- package/dist/src/features/workspace/index.d.ts.map +1 -0
- package/dist/src/features/workspace/index.js +7 -0
- package/dist/src/features/workspace/index.js.map +1 -0
- package/dist/src/features/workspace/presentation.d.ts +31 -0
- package/dist/src/features/workspace/presentation.d.ts.map +1 -0
- package/dist/src/features/workspace/presentation.js +69 -0
- package/dist/src/features/workspace/presentation.js.map +1 -0
- package/dist/src/features/workspace/reconciliation.d.ts +16 -0
- package/dist/src/features/workspace/reconciliation.d.ts.map +1 -0
- package/dist/src/features/workspace/reconciliation.js +83 -0
- package/dist/src/features/workspace/reconciliation.js.map +1 -0
- package/dist/src/features/workspace/reducer.d.ts +43 -0
- package/dist/src/features/workspace/reducer.d.ts.map +1 -0
- package/dist/src/features/workspace/reducer.js +214 -0
- package/dist/src/features/workspace/reducer.js.map +1 -0
- package/dist/src/features/workspace/router.d.ts +32 -0
- package/dist/src/features/workspace/router.d.ts.map +1 -0
- package/dist/src/features/workspace/router.js +125 -0
- package/dist/src/features/workspace/router.js.map +1 -0
- package/dist/src/features/workspace/store.d.ts +18 -0
- package/dist/src/features/workspace/store.d.ts.map +1 -0
- package/dist/src/features/workspace/store.js +55 -0
- package/dist/src/features/workspace/store.js.map +1 -0
- package/dist/src/foundation/lifecycle/index.d.ts +3 -0
- package/dist/src/foundation/lifecycle/index.d.ts.map +1 -0
- package/dist/src/foundation/lifecycle/index.js +3 -0
- package/dist/src/foundation/lifecycle/index.js.map +1 -0
- package/dist/src/foundation/lifecycle/model.d.ts +101 -0
- package/dist/src/foundation/lifecycle/model.d.ts.map +1 -0
- package/dist/src/foundation/lifecycle/model.js +40 -0
- package/dist/src/foundation/lifecycle/model.js.map +1 -0
- package/dist/src/foundation/lifecycle/paths.d.ts +11 -0
- package/dist/src/foundation/lifecycle/paths.d.ts.map +1 -0
- package/dist/src/foundation/lifecycle/paths.js +26 -0
- package/dist/src/foundation/lifecycle/paths.js.map +1 -0
- package/dist/src/foundation/native-host-protocol/codec.d.ts +12 -0
- package/dist/src/foundation/native-host-protocol/codec.d.ts.map +1 -0
- package/dist/src/foundation/native-host-protocol/codec.js +57 -0
- package/dist/src/foundation/native-host-protocol/codec.js.map +1 -0
- package/dist/src/foundation/native-host-protocol/evidence.d.ts +68 -0
- package/dist/src/foundation/native-host-protocol/evidence.d.ts.map +1 -0
- package/dist/src/foundation/native-host-protocol/evidence.js +141 -0
- package/dist/src/foundation/native-host-protocol/evidence.js.map +1 -0
- package/dist/src/foundation/native-host-protocol/index.d.ts +5 -0
- package/dist/src/foundation/native-host-protocol/index.d.ts.map +1 -0
- package/dist/src/foundation/native-host-protocol/index.js +5 -0
- package/dist/src/foundation/native-host-protocol/index.js.map +1 -0
- package/dist/src/foundation/native-host-protocol/messages.d.ts +57 -0
- package/dist/src/foundation/native-host-protocol/messages.d.ts.map +1 -0
- package/dist/src/foundation/native-host-protocol/messages.js +149 -0
- package/dist/src/foundation/native-host-protocol/messages.js.map +1 -0
- package/dist/src/foundation/native-host-protocol/proof-gate.d.ts +14 -0
- package/dist/src/foundation/native-host-protocol/proof-gate.d.ts.map +1 -0
- package/dist/src/foundation/native-host-protocol/proof-gate.js +34 -0
- package/dist/src/foundation/native-host-protocol/proof-gate.js.map +1 -0
- package/dist/src/foundation/owned-ui-contracts/extension-ui.d.ts +303 -0
- package/dist/src/foundation/owned-ui-contracts/extension-ui.d.ts.map +1 -0
- package/dist/src/foundation/owned-ui-contracts/extension-ui.js +69 -0
- package/dist/src/foundation/owned-ui-contracts/extension-ui.js.map +1 -0
- package/dist/src/foundation/owned-ui-contracts/index.d.ts +4 -0
- package/dist/src/foundation/owned-ui-contracts/index.d.ts.map +1 -0
- package/dist/src/foundation/owned-ui-contracts/index.js +4 -0
- package/dist/src/foundation/owned-ui-contracts/index.js.map +1 -0
- package/dist/src/foundation/owned-ui-contracts/model.d.ts +242 -0
- package/dist/src/foundation/owned-ui-contracts/model.d.ts.map +1 -0
- package/dist/src/foundation/owned-ui-contracts/model.js +2 -0
- package/dist/src/foundation/owned-ui-contracts/model.js.map +1 -0
- package/dist/src/foundation/owned-ui-contracts/validation.d.ts +12 -0
- package/dist/src/foundation/owned-ui-contracts/validation.d.ts.map +1 -0
- package/dist/src/foundation/owned-ui-contracts/validation.js +396 -0
- package/dist/src/foundation/owned-ui-contracts/validation.js.map +1 -0
- package/dist/src/foundation/pi-component-adapter/components.d.ts +5 -0
- package/dist/src/foundation/pi-component-adapter/components.d.ts.map +1 -0
- package/dist/src/foundation/pi-component-adapter/components.js +65 -0
- package/dist/src/foundation/pi-component-adapter/components.js.map +1 -0
- package/dist/src/foundation/pi-component-adapter/conformance.d.ts +17 -0
- package/dist/src/foundation/pi-component-adapter/conformance.d.ts.map +1 -0
- package/dist/src/foundation/pi-component-adapter/conformance.js +63 -0
- package/dist/src/foundation/pi-component-adapter/conformance.js.map +1 -0
- package/dist/src/foundation/pi-component-adapter/index.d.ts +13 -0
- package/dist/src/foundation/pi-component-adapter/index.d.ts.map +1 -0
- package/dist/src/foundation/pi-component-adapter/index.js +13 -0
- package/dist/src/foundation/pi-component-adapter/index.js.map +1 -0
- package/dist/src/foundation/pi-component-adapter/shell-components.d.ts +7 -0
- package/dist/src/foundation/pi-component-adapter/shell-components.d.ts.map +1 -0
- package/dist/src/foundation/pi-component-adapter/shell-components.js +7 -0
- package/dist/src/foundation/pi-component-adapter/shell-components.js.map +1 -0
- package/dist/src/foundation/pi-component-adapter/shell-editor-autocomplete.d.ts +12 -0
- package/dist/src/foundation/pi-component-adapter/shell-editor-autocomplete.d.ts.map +1 -0
- package/dist/src/foundation/pi-component-adapter/shell-editor-autocomplete.js +165 -0
- package/dist/src/foundation/pi-component-adapter/shell-editor-autocomplete.js.map +1 -0
- package/dist/src/foundation/pi-component-adapter/shell-extension-ui.d.ts +36 -0
- package/dist/src/foundation/pi-component-adapter/shell-extension-ui.d.ts.map +1 -0
- package/dist/src/foundation/pi-component-adapter/shell-extension-ui.js +280 -0
- package/dist/src/foundation/pi-component-adapter/shell-extension-ui.js.map +1 -0
- package/dist/src/foundation/pi-component-adapter/shell-footer-status.d.ts +8 -0
- package/dist/src/foundation/pi-component-adapter/shell-footer-status.d.ts.map +1 -0
- package/dist/src/foundation/pi-component-adapter/shell-footer-status.js +246 -0
- package/dist/src/foundation/pi-component-adapter/shell-footer-status.js.map +1 -0
- package/dist/src/foundation/pi-component-adapter/shell-presenters-transcript.d.ts +43 -0
- package/dist/src/foundation/pi-component-adapter/shell-presenters-transcript.d.ts.map +1 -0
- package/dist/src/foundation/pi-component-adapter/shell-presenters-transcript.js +397 -0
- package/dist/src/foundation/pi-component-adapter/shell-presenters-transcript.js.map +1 -0
- package/dist/src/foundation/pi-component-adapter/shell-selectors-dialogs.d.ts +106 -0
- package/dist/src/foundation/pi-component-adapter/shell-selectors-dialogs.d.ts.map +1 -0
- package/dist/src/foundation/pi-component-adapter/shell-selectors-dialogs.js +234 -0
- package/dist/src/foundation/pi-component-adapter/shell-selectors-dialogs.js.map +1 -0
- package/dist/src/foundation/pi-component-adapter/shell-shared-facade.d.ts +117 -0
- package/dist/src/foundation/pi-component-adapter/shell-shared-facade.d.ts.map +1 -0
- package/dist/src/foundation/pi-component-adapter/shell-shared-facade.js +88 -0
- package/dist/src/foundation/pi-component-adapter/shell-shared-facade.js.map +1 -0
- package/dist/src/foundation/pi-component-adapter/theme.d.ts +2 -0
- package/dist/src/foundation/pi-component-adapter/theme.d.ts.map +1 -0
- package/dist/src/foundation/pi-component-adapter/theme.js +2 -0
- package/dist/src/foundation/pi-component-adapter/theme.js.map +1 -0
- package/dist/src/foundation/pi-component-adapter/upstream/adjacent/core/keybindings.d.ts +423 -0
- package/dist/src/foundation/pi-component-adapter/upstream/adjacent/core/keybindings.d.ts.map +1 -0
- package/dist/src/foundation/pi-component-adapter/upstream/adjacent/core/keybindings.js +297 -0
- package/dist/src/foundation/pi-component-adapter/upstream/adjacent/core/keybindings.js.map +1 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/countdown-timer.d.ts +11 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/countdown-timer.d.ts.map +1 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/countdown-timer.js +30 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/countdown-timer.js.map +1 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/custom-entry.d.ts +18 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/custom-entry.d.ts.map +1 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/custom-entry.js +52 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/custom-entry.js.map +1 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/daxnuts.d.ts +23 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/daxnuts.d.ts.map +1 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/daxnuts.js +143 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/daxnuts.js.map +1 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/earendil-announcement.d.ts +5 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/earendil-announcement.d.ts.map +1 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/earendil-announcement.js +43 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/earendil-announcement.js.map +1 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/extension-editor.d.ts +18 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/extension-editor.d.ts.map +1 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/extension-editor.js +82 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/extension-editor.js.map +1 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/first-time-setup.d.ts +25 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/first-time-setup.d.ts.map +1 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/first-time-setup.js +106 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/first-time-setup.js.map +1 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/markdown-transform.d.ts +3 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/markdown-transform.d.ts.map +1 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/markdown-transform.js +19 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/markdown-transform.js.map +1 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/mermaid.d.ts +10 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/mermaid.d.ts.map +1 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/mermaid.js +78 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/mermaid.js.map +1 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/scoped-models-selector.d.ts +56 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/scoped-models-selector.d.ts.map +1 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/scoped-models-selector.js +343 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/scoped-models-selector.js.map +1 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/session-selector-search.d.ts +23 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/session-selector-search.d.ts.map +1 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/session-selector-search.js +160 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/session-selector-search.js.map +1 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/session-selector.d.ts +96 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/session-selector.d.ts.map +1 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/session-selector.js +890 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/session-selector.js.map +1 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/skill-invocation-message.d.ts +20 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/skill-invocation-message.d.ts.map +1 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/skill-invocation-message.js +45 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/skill-invocation-message.js.map +1 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/status-indicator.d.ts +31 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/status-indicator.d.ts.map +1 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/status-indicator.js +60 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/status-indicator.js.map +1 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/tree-selector.d.ts +99 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/tree-selector.d.ts.map +1 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/tree-selector.js +1273 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/tree-selector.js.map +1 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/trust-selector.d.ts +34 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/trust-selector.d.ts.map +1 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/trust-selector.js +77 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/trust-selector.js.map +1 -0
- package/dist/src/foundation/pi-component-adapter/upstream/external-editor.d.ts +10 -0
- package/dist/src/foundation/pi-component-adapter/upstream/external-editor.d.ts.map +1 -0
- package/dist/src/foundation/pi-component-adapter/upstream/external-editor.js +40 -0
- package/dist/src/foundation/pi-component-adapter/upstream/external-editor.js.map +1 -0
- package/dist/src/foundation/pi-component-adapter/upstream/model-search.d.ts +16 -0
- package/dist/src/foundation/pi-component-adapter/upstream/model-search.d.ts.map +1 -0
- package/dist/src/foundation/pi-component-adapter/upstream/model-search.js +15 -0
- package/dist/src/foundation/pi-component-adapter/upstream/model-search.js.map +1 -0
- package/dist/src/foundation/pi-component-adapter/upstream/theme/theme-controller.d.ts +26 -0
- package/dist/src/foundation/pi-component-adapter/upstream/theme/theme-controller.d.ts.map +1 -0
- package/dist/src/foundation/pi-component-adapter/upstream/theme/theme-controller.js +118 -0
- package/dist/src/foundation/pi-component-adapter/upstream/theme/theme-controller.js.map +1 -0
- package/dist/src/foundation/pi-component-adapter/upstream/theme/theme.d.ts +54 -0
- package/dist/src/foundation/pi-component-adapter/upstream/theme/theme.d.ts.map +1 -0
- package/dist/src/foundation/pi-component-adapter/upstream/theme/theme.js +311 -0
- package/dist/src/foundation/pi-component-adapter/upstream/theme/theme.js.map +1 -0
- package/dist/src/foundation/pi-engine-adapter/adapter.d.ts +343 -0
- package/dist/src/foundation/pi-engine-adapter/adapter.d.ts.map +1 -0
- package/dist/src/foundation/pi-engine-adapter/adapter.js +2365 -0
- package/dist/src/foundation/pi-engine-adapter/adapter.js.map +1 -0
- package/dist/src/foundation/pi-engine-adapter/conformance.d.ts +14 -0
- package/dist/src/foundation/pi-engine-adapter/conformance.d.ts.map +1 -0
- package/dist/src/foundation/pi-engine-adapter/conformance.js +85 -0
- package/dist/src/foundation/pi-engine-adapter/conformance.js.map +1 -0
- package/dist/src/foundation/pi-engine-adapter/index.d.ts +4 -0
- package/dist/src/foundation/pi-engine-adapter/index.d.ts.map +1 -0
- package/dist/src/foundation/pi-engine-adapter/index.js +4 -0
- package/dist/src/foundation/pi-engine-adapter/index.js.map +1 -0
- package/dist/src/foundation/pi-engine-adapter/workflows.d.ts +165 -0
- package/dist/src/foundation/pi-engine-adapter/workflows.d.ts.map +1 -0
- package/dist/src/foundation/pi-engine-adapter/workflows.js +61 -0
- package/dist/src/foundation/pi-engine-adapter/workflows.js.map +1 -0
- package/dist/src/foundation/pi-tui-runtime-adapter/adapter.d.ts +34 -0
- package/dist/src/foundation/pi-tui-runtime-adapter/adapter.d.ts.map +1 -0
- package/dist/src/foundation/pi-tui-runtime-adapter/adapter.js +485 -0
- package/dist/src/foundation/pi-tui-runtime-adapter/adapter.js.map +1 -0
- package/dist/src/foundation/pi-tui-runtime-adapter/conformance.d.ts +14 -0
- package/dist/src/foundation/pi-tui-runtime-adapter/conformance.d.ts.map +1 -0
- package/dist/src/foundation/pi-tui-runtime-adapter/conformance.js +132 -0
- package/dist/src/foundation/pi-tui-runtime-adapter/conformance.js.map +1 -0
- package/dist/src/foundation/pi-tui-runtime-adapter/contracts.d.ts +122 -0
- package/dist/src/foundation/pi-tui-runtime-adapter/contracts.d.ts.map +1 -0
- package/dist/src/foundation/pi-tui-runtime-adapter/contracts.js +2 -0
- package/dist/src/foundation/pi-tui-runtime-adapter/contracts.js.map +1 -0
- package/dist/src/foundation/pi-tui-runtime-adapter/index.d.ts +4 -0
- package/dist/src/foundation/pi-tui-runtime-adapter/index.d.ts.map +1 -0
- package/dist/src/foundation/pi-tui-runtime-adapter/index.js +4 -0
- package/dist/src/foundation/pi-tui-runtime-adapter/index.js.map +1 -0
- package/dist/src/foundation/protocol/client.d.ts +17 -0
- package/dist/src/foundation/protocol/client.d.ts.map +1 -0
- package/dist/src/foundation/protocol/client.js +127 -0
- package/dist/src/foundation/protocol/client.js.map +1 -0
- package/dist/src/foundation/protocol/index.d.ts +3 -0
- package/dist/src/foundation/protocol/index.d.ts.map +1 -0
- package/dist/src/foundation/protocol/index.js +3 -0
- package/dist/src/foundation/protocol/index.js.map +1 -0
- package/dist/src/foundation/protocol/messages.d.ts +90 -0
- package/dist/src/foundation/protocol/messages.d.ts.map +1 -0
- package/dist/src/foundation/protocol/messages.js +99 -0
- package/dist/src/foundation/protocol/messages.js.map +1 -0
- package/dist/src/foundation/release/bootstrap.d.ts +30 -0
- package/dist/src/foundation/release/bootstrap.d.ts.map +1 -0
- package/dist/src/foundation/release/bootstrap.js +283 -0
- package/dist/src/foundation/release/bootstrap.js.map +1 -0
- package/dist/src/foundation/release/cohort-selection.d.ts +40 -0
- package/dist/src/foundation/release/cohort-selection.d.ts.map +1 -0
- package/dist/src/foundation/release/cohort-selection.js +76 -0
- package/dist/src/foundation/release/cohort-selection.js.map +1 -0
- package/dist/src/foundation/release/cohort-state.d.ts +68 -0
- package/dist/src/foundation/release/cohort-state.d.ts.map +1 -0
- package/dist/src/foundation/release/cohort-state.js +201 -0
- package/dist/src/foundation/release/cohort-state.js.map +1 -0
- package/dist/src/foundation/release/development-preview-release.d.ts +49 -0
- package/dist/src/foundation/release/development-preview-release.d.ts.map +1 -0
- package/dist/src/foundation/release/development-preview-release.js +113 -0
- package/dist/src/foundation/release/development-preview-release.js.map +1 -0
- package/dist/src/foundation/release/index.d.ts +12 -0
- package/dist/src/foundation/release/index.d.ts.map +1 -0
- package/dist/src/foundation/release/index.js +12 -0
- package/dist/src/foundation/release/index.js.map +1 -0
- package/dist/src/foundation/release/process-cleanup.d.ts +15 -0
- package/dist/src/foundation/release/process-cleanup.d.ts.map +1 -0
- package/dist/src/foundation/release/process-cleanup.js +67 -0
- package/dist/src/foundation/release/process-cleanup.js.map +1 -0
- package/dist/src/foundation/release/release-gc.d.ts +6 -0
- package/dist/src/foundation/release/release-gc.d.ts.map +1 -0
- package/dist/src/foundation/release/release-gc.js +17 -0
- package/dist/src/foundation/release/release-gc.js.map +1 -0
- package/dist/src/foundation/release/release-store.d.ts +11 -0
- package/dist/src/foundation/release/release-store.d.ts.map +1 -0
- package/dist/src/foundation/release/release-store.js +115 -0
- package/dist/src/foundation/release/release-store.js.map +1 -0
- package/dist/src/foundation/release/release.d.ts +24 -0
- package/dist/src/foundation/release/release.d.ts.map +1 -0
- package/dist/src/foundation/release/release.js +151 -0
- package/dist/src/foundation/release/release.js.map +1 -0
- package/dist/src/foundation/release/stable-release.d.ts +30 -0
- package/dist/src/foundation/release/stable-release.d.ts.map +1 -0
- package/dist/src/foundation/release/stable-release.js +38 -0
- package/dist/src/foundation/release/stable-release.js.map +1 -0
- package/dist/src/foundation/release/update-transaction.d.ts +31 -0
- package/dist/src/foundation/release/update-transaction.d.ts.map +1 -0
- package/dist/src/foundation/release/update-transaction.js +88 -0
- package/dist/src/foundation/release/update-transaction.js.map +1 -0
- package/dist/src/foundation/release/update.d.ts +55 -0
- package/dist/src/foundation/release/update.d.ts.map +1 -0
- package/dist/src/foundation/release/update.js +316 -0
- package/dist/src/foundation/release/update.js.map +1 -0
- package/dist/src/foundation/storage/control-store.d.ts +61 -0
- package/dist/src/foundation/storage/control-store.d.ts.map +1 -0
- package/dist/src/foundation/storage/control-store.js +459 -0
- package/dist/src/foundation/storage/control-store.js.map +1 -0
- package/dist/src/foundation/storage/index.d.ts +2 -0
- package/dist/src/foundation/storage/index.d.ts.map +1 -0
- package/dist/src/foundation/storage/index.js +2 -0
- package/dist/src/foundation/storage/index.js.map +1 -0
- package/dist/src/foundation/structured-agent-runtime/backpressure.d.ts +47 -0
- package/dist/src/foundation/structured-agent-runtime/backpressure.d.ts.map +1 -0
- package/dist/src/foundation/structured-agent-runtime/backpressure.js +119 -0
- package/dist/src/foundation/structured-agent-runtime/backpressure.js.map +1 -0
- package/dist/src/foundation/structured-agent-runtime/commands.d.ts +53 -0
- package/dist/src/foundation/structured-agent-runtime/commands.d.ts.map +1 -0
- package/dist/src/foundation/structured-agent-runtime/commands.js +165 -0
- package/dist/src/foundation/structured-agent-runtime/commands.js.map +1 -0
- package/dist/src/foundation/structured-agent-runtime/handshake.d.ts +42 -0
- package/dist/src/foundation/structured-agent-runtime/handshake.d.ts.map +1 -0
- package/dist/src/foundation/structured-agent-runtime/handshake.js +151 -0
- package/dist/src/foundation/structured-agent-runtime/handshake.js.map +1 -0
- package/dist/src/foundation/structured-agent-runtime/index.d.ts +6 -0
- package/dist/src/foundation/structured-agent-runtime/index.d.ts.map +1 -0
- package/dist/src/foundation/structured-agent-runtime/index.js +6 -0
- package/dist/src/foundation/structured-agent-runtime/index.js.map +1 -0
- package/dist/src/foundation/structured-agent-runtime/reconnection.d.ts +38 -0
- package/dist/src/foundation/structured-agent-runtime/reconnection.d.ts.map +1 -0
- package/dist/src/foundation/structured-agent-runtime/reconnection.js +130 -0
- package/dist/src/foundation/structured-agent-runtime/reconnection.js.map +1 -0
- package/dist/src/foundation/structured-agent-runtime/state.d.ts +57 -0
- package/dist/src/foundation/structured-agent-runtime/state.d.ts.map +1 -0
- package/dist/src/foundation/structured-agent-runtime/state.js +119 -0
- package/dist/src/foundation/structured-agent-runtime/state.js.map +1 -0
- package/dist/src/foundation/supervision/index.d.ts +4 -0
- package/dist/src/foundation/supervision/index.d.ts.map +1 -0
- package/dist/src/foundation/supervision/index.js +4 -0
- package/dist/src/foundation/supervision/index.js.map +1 -0
- package/dist/src/foundation/supervision/main.d.ts +2 -0
- package/dist/src/foundation/supervision/main.d.ts.map +1 -0
- package/dist/src/foundation/supervision/main.js +40 -0
- package/dist/src/foundation/supervision/main.js.map +1 -0
- package/dist/src/foundation/supervision/paths.d.ts +2 -0
- package/dist/src/foundation/supervision/paths.d.ts.map +1 -0
- package/dist/src/foundation/supervision/paths.js +2 -0
- package/dist/src/foundation/supervision/paths.js.map +1 -0
- package/dist/src/foundation/supervision/server.d.ts +21 -0
- package/dist/src/foundation/supervision/server.d.ts.map +1 -0
- package/dist/src/foundation/supervision/server.js +283 -0
- package/dist/src/foundation/supervision/server.js.map +1 -0
- package/dist/src/foundation/transparent-terminal/command-resolution.d.ts +14 -0
- package/dist/src/foundation/transparent-terminal/command-resolution.d.ts.map +1 -0
- package/dist/src/foundation/transparent-terminal/command-resolution.js +70 -0
- package/dist/src/foundation/transparent-terminal/command-resolution.js.map +1 -0
- package/dist/src/foundation/transparent-terminal/foreground-broker.d.ts +33 -0
- package/dist/src/foundation/transparent-terminal/foreground-broker.d.ts.map +1 -0
- package/dist/src/foundation/transparent-terminal/foreground-broker.js +88 -0
- package/dist/src/foundation/transparent-terminal/foreground-broker.js.map +1 -0
- package/dist/src/foundation/transparent-terminal/index.d.ts +4 -0
- package/dist/src/foundation/transparent-terminal/index.d.ts.map +1 -0
- package/dist/src/foundation/transparent-terminal/index.js +4 -0
- package/dist/src/foundation/transparent-terminal/index.js.map +1 -0
- package/dist/src/foundation/transparent-terminal/main.d.ts +10 -0
- package/dist/src/foundation/transparent-terminal/main.d.ts.map +1 -0
- package/dist/src/foundation/transparent-terminal/main.js +107 -0
- package/dist/src/foundation/transparent-terminal/main.js.map +1 -0
- package/dist/src/foundation/transparent-terminal/native-launcher.d.ts +26 -0
- package/dist/src/foundation/transparent-terminal/native-launcher.d.ts.map +1 -0
- package/dist/src/foundation/transparent-terminal/native-launcher.js +147 -0
- package/dist/src/foundation/transparent-terminal/native-launcher.js.map +1 -0
- package/dist/src/foundation/workspace-contracts/index.d.ts +3 -0
- package/dist/src/foundation/workspace-contracts/index.d.ts.map +1 -0
- package/dist/src/foundation/workspace-contracts/index.js +3 -0
- package/dist/src/foundation/workspace-contracts/index.js.map +1 -0
- package/dist/src/foundation/workspace-contracts/model.d.ts +249 -0
- package/dist/src/foundation/workspace-contracts/model.d.ts.map +1 -0
- package/dist/src/foundation/workspace-contracts/model.js +3 -0
- package/dist/src/foundation/workspace-contracts/model.js.map +1 -0
- package/dist/src/foundation/workspace-contracts/validation.d.ts +14 -0
- package/dist/src/foundation/workspace-contracts/validation.d.ts.map +1 -0
- package/dist/src/foundation/workspace-contracts/validation.js +336 -0
- package/dist/src/foundation/workspace-contracts/validation.js.map +1 -0
- package/docs/architecture/boundaries.md +46 -0
- package/docs/architecture/project-structure.md +81 -0
- package/docs/architecture/resource-and-data-policy.md +55 -0
- package/docs/architecture/terminal-host-proof-gate.md +32 -0
- package/docs/architecture/terminal-host-provenance.md +69 -0
- package/docs/architecture/terminal-host-spike-evidence.md +39 -0
- package/docs/architecture/toolchain.md +66 -0
- package/docs/features/launch-profiles.md +50 -0
- package/docs/manual-transparent-checkpoint.md +53 -0
- package/package.json +73 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type AddOneReleaseIdentity } from "./release.js";
|
|
2
|
+
export declare const RELEASE_MANIFEST = ".addone-release.json";
|
|
3
|
+
export interface MaterializedRelease extends AddOneReleaseIdentity {
|
|
4
|
+
readonly releaseRoot: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function materializeRelease(packageRoot: string, dataDir: string): Promise<MaterializedRelease>;
|
|
7
|
+
export declare function readMaterializedRelease(releaseRoot: string): Promise<MaterializedRelease>;
|
|
8
|
+
export declare function verifyMaterializedRelease(releaseRoot: string, expected?: AddOneReleaseIdentity, selectedStoreRoot?: string): Promise<MaterializedRelease>;
|
|
9
|
+
export declare function assertImmutableExecutionRoot(release: MaterializedRelease, dataDir: string): Promise<void>;
|
|
10
|
+
export declare function resolveReleaseEntryPoint(release: MaterializedRelease, entryPoint: string): Promise<string>;
|
|
11
|
+
//# sourceMappingURL=release-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"release-store.d.ts","sourceRoot":"","sources":["../../../../src/foundation/release/release-store.ts"],"names":[],"mappings":"AAGA,OAAO,EAA6D,KAAK,qBAAqB,EAA4B,MAAM,cAAc,CAAC;AAE/I,eAAO,MAAM,gBAAgB,yBAAyB,CAAC;AAEvD,MAAM,WAAW,mBAAoB,SAAQ,qBAAqB;IAChE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,wBAAsB,kBAAkB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CA0B3G;AAED,wBAAsB,uBAAuB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAI/F;AAED,wBAAsB,yBAAyB,CAC7C,WAAW,EAAE,MAAM,EACnB,QAAQ,CAAC,EAAE,qBAAqB,EAChC,iBAAiB,CAAC,EAAE,MAAM,GACzB,OAAO,CAAC,mBAAmB,CAAC,CAgB9B;AAED,wBAAsB,4BAA4B,CAAC,OAAO,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAK/G;AAED,wBAAsB,wBAAwB,CAAC,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAOhH"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
2
|
+
import { chmod, copyFile, lstat, mkdir, readFile, realpath, rename, rm, writeFile } from "node:fs/promises";
|
|
3
|
+
import { dirname, isAbsolute, relative, resolve, sep } from "node:path";
|
|
4
|
+
import { ADDONE_PACKAGE_NAME, deriveReleaseIdentity, resolveWithin } from "./release.js";
|
|
5
|
+
export const RELEASE_MANIFEST = ".addone-release.json";
|
|
6
|
+
export async function materializeRelease(packageRoot, dataDir) {
|
|
7
|
+
const identity = await deriveReleaseIdentity(packageRoot);
|
|
8
|
+
const storeRoot = resolve(dataDir, "releases");
|
|
9
|
+
await mkdir(storeRoot, { recursive: true, mode: 0o700 });
|
|
10
|
+
const releaseRoot = resolveWithin(storeRoot, identity.releaseId);
|
|
11
|
+
const existing = await lstat(releaseRoot).catch(() => null);
|
|
12
|
+
if (existing)
|
|
13
|
+
return await verifyMaterializedRelease(releaseRoot, identity);
|
|
14
|
+
const candidate = resolveWithin(storeRoot, `.candidate-${identity.releaseId}-${randomUUID()}`);
|
|
15
|
+
await mkdir(candidate, { recursive: false, mode: 0o700 });
|
|
16
|
+
try {
|
|
17
|
+
for (const file of identity.files) {
|
|
18
|
+
const source = resolveWithin(identity.packageRoot, file.path);
|
|
19
|
+
const destination = resolveWithin(candidate, file.path);
|
|
20
|
+
await mkdir(dirname(destination), { recursive: true, mode: 0o700 });
|
|
21
|
+
await copyFile(source, destination);
|
|
22
|
+
await chmod(destination, file.executable ? 0o500 : 0o400);
|
|
23
|
+
}
|
|
24
|
+
await writeFile(resolve(candidate, RELEASE_MANIFEST), JSON.stringify(identity, null, 2), { mode: 0o400, flag: "wx" });
|
|
25
|
+
await verifyMaterializedRelease(candidate, identity);
|
|
26
|
+
await rename(candidate, releaseRoot);
|
|
27
|
+
return await verifyMaterializedRelease(releaseRoot, identity);
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
await rm(candidate, { recursive: true, force: true });
|
|
31
|
+
throw error;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export async function readMaterializedRelease(releaseRoot) {
|
|
35
|
+
const canonical = await realpath(releaseRoot);
|
|
36
|
+
const manifest = JSON.parse(await readFile(resolve(canonical, RELEASE_MANIFEST), "utf8"));
|
|
37
|
+
return await verifyMaterializedRelease(canonical, manifest);
|
|
38
|
+
}
|
|
39
|
+
export async function verifyMaterializedRelease(releaseRoot, expected, selectedStoreRoot) {
|
|
40
|
+
const canonical = await realpath(releaseRoot);
|
|
41
|
+
if (selectedStoreRoot)
|
|
42
|
+
assertContained(await realpath(selectedStoreRoot), canonical, "release root is outside the selected release store");
|
|
43
|
+
const manifestPath = resolveWithin(canonical, RELEASE_MANIFEST);
|
|
44
|
+
const manifest = JSON.parse(await readFile(manifestPath, "utf8"));
|
|
45
|
+
validateManifest(manifest);
|
|
46
|
+
if (expected && (manifest.releaseId !== expected.releaseId || manifest.contentDigest !== expected.contentDigest)) {
|
|
47
|
+
throw new Error(`release identity mismatch for ${canonical}`);
|
|
48
|
+
}
|
|
49
|
+
if (canonical.split(sep).at(-1) !== manifest.releaseId && !canonical.split(sep).at(-1)?.startsWith(`.candidate-${manifest.releaseId}-`)) {
|
|
50
|
+
throw new Error(`release directory does not match identity ${manifest.releaseId}`);
|
|
51
|
+
}
|
|
52
|
+
for (const file of manifest.files)
|
|
53
|
+
await verifyFile(canonical, file);
|
|
54
|
+
const recomputed = digestManifestFiles(manifest.files);
|
|
55
|
+
if (recomputed !== manifest.contentDigest)
|
|
56
|
+
throw new Error(`release content digest mismatch for ${manifest.releaseId}`);
|
|
57
|
+
return { ...manifest, releaseRoot: canonical };
|
|
58
|
+
}
|
|
59
|
+
export async function assertImmutableExecutionRoot(release, dataDir) {
|
|
60
|
+
await verifyMaterializedRelease(release.releaseRoot, release, resolve(dataDir, "releases"));
|
|
61
|
+
if (!process.env.ADDONE_RELEASE_ROOT)
|
|
62
|
+
throw new Error("persistent AddOne process has no immutable release root");
|
|
63
|
+
const selected = await realpath(process.env.ADDONE_RELEASE_ROOT);
|
|
64
|
+
if (selected !== release.releaseRoot)
|
|
65
|
+
throw new Error("persistent AddOne process selected a different immutable release root");
|
|
66
|
+
}
|
|
67
|
+
export async function resolveReleaseEntryPoint(release, entryPoint) {
|
|
68
|
+
const normalized = entryPoint.split("\\").join("/").replace(/^\.\//, "");
|
|
69
|
+
if (!release.files.some(file => file.path === normalized))
|
|
70
|
+
throw new Error(`entry point is not in the verified release manifest: ${entryPoint}`);
|
|
71
|
+
const path = resolveWithin(release.releaseRoot, normalized);
|
|
72
|
+
const canonical = await realpath(path);
|
|
73
|
+
assertContained(release.releaseRoot, canonical, "entry point resolves outside the selected release root");
|
|
74
|
+
return canonical;
|
|
75
|
+
}
|
|
76
|
+
async function verifyFile(root, file) {
|
|
77
|
+
const path = resolveWithin(root, file.path);
|
|
78
|
+
const metadata = await lstat(path).catch(() => null);
|
|
79
|
+
if (!metadata?.isFile() || metadata.isSymbolicLink())
|
|
80
|
+
throw new Error(`release candidate is incomplete: ${file.path}`);
|
|
81
|
+
if (metadata.size !== file.bytes)
|
|
82
|
+
throw new Error(`release file size mismatch: ${file.path}`);
|
|
83
|
+
const digest = createHash("sha256").update(await readFile(path)).digest("hex");
|
|
84
|
+
if (digest !== file.sha256)
|
|
85
|
+
throw new Error(`release file digest mismatch: ${file.path}`);
|
|
86
|
+
}
|
|
87
|
+
function validateManifest(value) {
|
|
88
|
+
if (value.packageName !== ADDONE_PACKAGE_NAME || typeof value.packageVersion !== "string")
|
|
89
|
+
throw new Error("invalid AddOne release manifest metadata");
|
|
90
|
+
if (!/^[a-f0-9]{64}$/.test(value.contentDigest) || !/^[0-9A-Za-z.+_-]+-[a-f0-9]{20}$/.test(value.releaseId))
|
|
91
|
+
throw new Error("invalid AddOne release identity");
|
|
92
|
+
if (!Array.isArray(value.files) || value.files.length === 0)
|
|
93
|
+
throw new Error("release manifest contains no files");
|
|
94
|
+
for (const file of value.files) {
|
|
95
|
+
if (typeof file.path !== "string" || file.path.length === 0 || file.path.includes("\\") || file.path.startsWith("/") || file.path.split("/").includes("..")) {
|
|
96
|
+
throw new Error(`invalid release manifest path: ${String(file.path)}`);
|
|
97
|
+
}
|
|
98
|
+
if (!Number.isSafeInteger(file.bytes) || file.bytes < 0 || !/^[a-f0-9]{64}$/.test(file.sha256))
|
|
99
|
+
throw new Error(`invalid release manifest file identity: ${file.path}`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
function digestManifestFiles(files) {
|
|
103
|
+
const digest = createHash("sha256");
|
|
104
|
+
for (const file of [...files].sort((left, right) => left.path < right.path ? -1 : left.path > right.path ? 1 : 0)) {
|
|
105
|
+
digest.update(`${file.path}\0${file.bytes}\0${file.sha256}\0${file.executable ? 1 : 0}\n`);
|
|
106
|
+
}
|
|
107
|
+
return digest.digest("hex");
|
|
108
|
+
}
|
|
109
|
+
function assertContained(parent, child, message) {
|
|
110
|
+
const fromParent = relative(parent, child);
|
|
111
|
+
if (fromParent === "" || (!fromParent.startsWith(`..${sep}`) && fromParent !== ".." && !isAbsolute(fromParent)))
|
|
112
|
+
return;
|
|
113
|
+
throw new Error(`${message}: ${child}`);
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=release-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"release-store.js","sourceRoot":"","sources":["../../../../src/foundation/release/release-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC5G,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,aAAa,EAAwD,MAAM,cAAc,CA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AAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAC7F,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC;AAED,SAAS,eAAe,CAAC,MAAc,EAAE,KAAa,EAAE,OAAe;IACrE,MAAM,UAAU,GAAG,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC3C,IAAI,UAAU,KAAK,EAAE,IAAI,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC,KAAK,GAAG,EAAE,CAAC,IAAI,UAAU,KAAK,IAAI,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;QAAE,OAAO;IACxH,MAAM,IAAI,KAAK,CAAC,GAAG,OAAO,KAAK,KAAK,EAAE,CAAC,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const ADDONE_PACKAGE_NAME = "@timurproko/a1";
|
|
2
|
+
export interface ReleaseFileIdentity {
|
|
3
|
+
readonly path: string;
|
|
4
|
+
readonly bytes: number;
|
|
5
|
+
readonly sha256: string;
|
|
6
|
+
readonly executable: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface AddOneReleaseIdentity {
|
|
9
|
+
readonly packageName: typeof ADDONE_PACKAGE_NAME;
|
|
10
|
+
readonly packageVersion: string;
|
|
11
|
+
readonly contentDigest: string;
|
|
12
|
+
readonly releaseId: string;
|
|
13
|
+
readonly packageRoot: string;
|
|
14
|
+
readonly files: readonly ReleaseFileIdentity[];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Derive AddOne execution identity only from installed distribution metadata and
|
|
18
|
+
* bytes. The version remains display metadata; the digest selects executable
|
|
19
|
+
* content.
|
|
20
|
+
*/
|
|
21
|
+
export declare function deriveReleaseIdentity(packageRoot: string): Promise<AddOneReleaseIdentity>;
|
|
22
|
+
export declare function resolveWithin(root: string, candidate: string): string;
|
|
23
|
+
export declare function packageRootFromModule(moduleUrl: string): string;
|
|
24
|
+
//# sourceMappingURL=release.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"release.d.ts","sourceRoot":"","sources":["../../../../src/foundation/release/release.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,mBAAmB,mBAAmB,CAAC;AAEpD,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;CAC9B;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,WAAW,EAAE,OAAO,mBAAmB,CAAC;IACjD,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,SAAS,mBAAmB,EAAE,CAAC;CAChD;AAUD;;;;GAIG;AACH,wBAAsB,qBAAqB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAwC/F;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAMrE;AA8ED,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAS/D"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { lstat, readFile, readdir, realpath } from "node:fs/promises";
|
|
3
|
+
import { basename, dirname, isAbsolute, relative, resolve, sep } from "node:path";
|
|
4
|
+
export const ADDONE_PACKAGE_NAME = "@timurproko/a1";
|
|
5
|
+
/**
|
|
6
|
+
* Derive AddOne execution identity only from installed distribution metadata and
|
|
7
|
+
* bytes. The version remains display metadata; the digest selects executable
|
|
8
|
+
* content.
|
|
9
|
+
*/
|
|
10
|
+
export async function deriveReleaseIdentity(packageRoot) {
|
|
11
|
+
const canonicalRoot = await realpath(packageRoot);
|
|
12
|
+
const manifestPath = resolve(canonicalRoot, "package.json");
|
|
13
|
+
const manifest = JSON.parse(await readFile(manifestPath, "utf8"));
|
|
14
|
+
if (manifest.name !== ADDONE_PACKAGE_NAME)
|
|
15
|
+
throw new Error(`unexpected AddOne package name: ${String(manifest.name)}`);
|
|
16
|
+
if (typeof manifest.version !== "string" || manifest.version.length === 0)
|
|
17
|
+
throw new Error("AddOne package metadata has no version");
|
|
18
|
+
const roots = distributionRoots(manifest);
|
|
19
|
+
const paths = new Set(["package.json"]);
|
|
20
|
+
for (const root of roots) {
|
|
21
|
+
const absolute = resolveWithin(canonicalRoot, root);
|
|
22
|
+
await collectFiles(canonicalRoot, absolute, paths);
|
|
23
|
+
}
|
|
24
|
+
await collectDependencyClosure(canonicalRoot, canonicalRoot, manifest, paths, new Set());
|
|
25
|
+
const files = [];
|
|
26
|
+
for (const path of [...paths].sort()) {
|
|
27
|
+
const absolute = resolveWithin(canonicalRoot, path);
|
|
28
|
+
const metadata = await lstat(absolute);
|
|
29
|
+
if (!metadata.isFile())
|
|
30
|
+
throw new Error(`release payload is not a regular file: ${path}`);
|
|
31
|
+
const bytes = await readFile(absolute);
|
|
32
|
+
files.push({
|
|
33
|
+
path: normalizeRelative(path),
|
|
34
|
+
bytes: bytes.length,
|
|
35
|
+
sha256: createHash("sha256").update(bytes).digest("hex"),
|
|
36
|
+
executable: (metadata.mode & 0o111) !== 0,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
const digest = createHash("sha256");
|
|
40
|
+
for (const file of files)
|
|
41
|
+
digest.update(`${file.path}\0${file.bytes}\0${file.sha256}\0${file.executable ? 1 : 0}\n`);
|
|
42
|
+
const contentDigest = digest.digest("hex");
|
|
43
|
+
return {
|
|
44
|
+
packageName: ADDONE_PACKAGE_NAME,
|
|
45
|
+
packageVersion: manifest.version,
|
|
46
|
+
contentDigest,
|
|
47
|
+
releaseId: `${manifest.version}-${contentDigest.slice(0, 20)}`,
|
|
48
|
+
packageRoot: canonicalRoot,
|
|
49
|
+
files,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
export function resolveWithin(root, candidate) {
|
|
53
|
+
if (candidate.includes("\0"))
|
|
54
|
+
throw new Error("release path contains a null byte");
|
|
55
|
+
const absolute = resolve(root, candidate);
|
|
56
|
+
const fromRoot = relative(root, absolute);
|
|
57
|
+
if (fromRoot === "" || (!isAbsolute(fromRoot) && fromRoot !== ".." && !fromRoot.startsWith(`..${sep}`)))
|
|
58
|
+
return absolute;
|
|
59
|
+
throw new Error(`release path escapes selected root: ${candidate}`);
|
|
60
|
+
}
|
|
61
|
+
function distributionRoots(manifest) {
|
|
62
|
+
if (!Array.isArray(manifest.files))
|
|
63
|
+
throw new Error("AddOne package metadata has no distribution files list");
|
|
64
|
+
const roots = manifest.files.map(value => {
|
|
65
|
+
if (typeof value !== "string" || value.length === 0)
|
|
66
|
+
throw new Error("AddOne distribution file entry is invalid");
|
|
67
|
+
const normalized = normalizeRelative(value);
|
|
68
|
+
if (normalized === "package.json")
|
|
69
|
+
return normalized;
|
|
70
|
+
if (isAbsolute(value) || normalized === ".." || normalized.startsWith("../"))
|
|
71
|
+
throw new Error(`AddOne distribution path escapes package root: ${value}`);
|
|
72
|
+
return normalized;
|
|
73
|
+
});
|
|
74
|
+
return [...new Set(roots)];
|
|
75
|
+
}
|
|
76
|
+
async function collectFiles(root, path, output, skipNodeModules = false) {
|
|
77
|
+
const metadata = await lstat(path);
|
|
78
|
+
const relativePath = normalizeRelative(relative(root, path));
|
|
79
|
+
if (metadata.isSymbolicLink())
|
|
80
|
+
throw new Error(`release payload contains a symbolic link: ${relativePath}`);
|
|
81
|
+
if (metadata.isFile()) {
|
|
82
|
+
output.add(relativePath);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
if (!metadata.isDirectory())
|
|
86
|
+
throw new Error(`release payload contains an unsupported entry: ${relativePath}`);
|
|
87
|
+
for (const entry of await readdir(path)) {
|
|
88
|
+
if (entry === ".bin" || (skipNodeModules && entry === "node_modules"))
|
|
89
|
+
continue;
|
|
90
|
+
await collectFiles(root, resolve(path, entry), output, skipNodeModules);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
async function collectDependencyClosure(root, requesterRoot, manifest, output, visited) {
|
|
94
|
+
const required = dependencyNames(manifest.dependencies);
|
|
95
|
+
const optional = new Set(dependencyNames(manifest.optionalDependencies));
|
|
96
|
+
for (const name of [...new Set([...required, ...optional])].sort()) {
|
|
97
|
+
const packagePath = await findInstalledDependency(root, requesterRoot, name);
|
|
98
|
+
if (!packagePath) {
|
|
99
|
+
if (optional.has(name))
|
|
100
|
+
continue;
|
|
101
|
+
throw new Error(`installed AddOne dependency is missing: ${name}`);
|
|
102
|
+
}
|
|
103
|
+
if (visited.has(packagePath))
|
|
104
|
+
continue;
|
|
105
|
+
visited.add(packagePath);
|
|
106
|
+
await collectFiles(root, packagePath, output, true);
|
|
107
|
+
const dependencyManifest = JSON.parse(await readFile(resolve(packagePath, "package.json"), "utf8"));
|
|
108
|
+
await collectDependencyClosure(root, packagePath, dependencyManifest, output, visited);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
async function findInstalledDependency(root, requesterRoot, name) {
|
|
112
|
+
let directory = requesterRoot;
|
|
113
|
+
while (true) {
|
|
114
|
+
const candidate = resolve(directory, "node_modules", name);
|
|
115
|
+
const fromRoot = relative(root, candidate);
|
|
116
|
+
if (fromRoot !== ".." && !fromRoot.startsWith(`..${sep}`) && !isAbsolute(fromRoot)) {
|
|
117
|
+
const metadata = await lstat(candidate).catch(() => null);
|
|
118
|
+
if (metadata?.isDirectory() && !metadata.isSymbolicLink())
|
|
119
|
+
return candidate;
|
|
120
|
+
}
|
|
121
|
+
if (directory === root)
|
|
122
|
+
return null;
|
|
123
|
+
const parent = dirname(directory);
|
|
124
|
+
if (parent === directory || relative(root, parent).startsWith(".."))
|
|
125
|
+
return null;
|
|
126
|
+
directory = parent;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
function dependencyNames(value) {
|
|
130
|
+
if (value === undefined)
|
|
131
|
+
return [];
|
|
132
|
+
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
133
|
+
throw new Error("AddOne dependency metadata is invalid");
|
|
134
|
+
return Object.keys(value);
|
|
135
|
+
}
|
|
136
|
+
function normalizeRelative(path) {
|
|
137
|
+
return path.split(sep).join("/").replace(/^\.\//, "");
|
|
138
|
+
}
|
|
139
|
+
export function packageRootFromModule(moduleUrl) {
|
|
140
|
+
const url = new URL(moduleUrl);
|
|
141
|
+
if (url.protocol !== "file:")
|
|
142
|
+
throw new Error(`AddOne module URL must be a file URL: ${moduleUrl}`);
|
|
143
|
+
let directory = dirname(url.pathname.replace(/^\/(.:)/, "$1"));
|
|
144
|
+
while (basename(directory) !== "") {
|
|
145
|
+
if (basename(directory) === "dist")
|
|
146
|
+
return dirname(directory);
|
|
147
|
+
directory = dirname(directory);
|
|
148
|
+
}
|
|
149
|
+
throw new Error("could not derive AddOne package root from module URL");
|
|
150
|
+
}
|
|
151
|
+
//# sourceMappingURL=release.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"release.js","sourceRoot":"","sources":["../../../../src/foundation/release/release.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAElF,MAAM,CAAC,MAAM,mBAAmB,GAAG,gBAAgB,CAA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AAS,CAAC,KAAK,EAAE,EAAE,CAAC;QAClC,IAAI,QAAQ,CAAC,SAAS,CAAC,KAAK,MAAM;YAAE,OAAO,OAAO,CAAC,SAAS,CAAC,CAAC;QAC9D,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;IACjC,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;AAC1E,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface StableReleaseEvidenceInput {
|
|
2
|
+
readonly packageName: string;
|
|
3
|
+
readonly version: string;
|
|
4
|
+
readonly commit: string;
|
|
5
|
+
readonly tag: string;
|
|
6
|
+
readonly tarball: string;
|
|
7
|
+
readonly integrity: string;
|
|
8
|
+
readonly shasum: string;
|
|
9
|
+
readonly recordedAt: string;
|
|
10
|
+
}
|
|
11
|
+
export interface StableReleaseEvidence extends StableReleaseEvidenceInput {
|
|
12
|
+
readonly schema: "addone-stable-release-v1";
|
|
13
|
+
readonly channel: "latest";
|
|
14
|
+
}
|
|
15
|
+
export interface StableRegistryState {
|
|
16
|
+
readonly packageName: string | null;
|
|
17
|
+
readonly version: string | null;
|
|
18
|
+
readonly latest: string | null;
|
|
19
|
+
readonly integrity: string | null;
|
|
20
|
+
readonly shasum: string | null;
|
|
21
|
+
readonly bins: readonly string[];
|
|
22
|
+
}
|
|
23
|
+
export interface StableRegistryVerificationOptions {
|
|
24
|
+
readonly attempts?: number;
|
|
25
|
+
readonly delayMs?: number;
|
|
26
|
+
readonly delay?: (milliseconds: number) => Promise<void>;
|
|
27
|
+
}
|
|
28
|
+
export declare function createStableReleaseEvidence(input: StableReleaseEvidenceInput): StableReleaseEvidence;
|
|
29
|
+
export declare function verifyStableRegistry(expected: StableReleaseEvidence, observe: () => Promise<StableRegistryState>, options?: StableRegistryVerificationOptions): Promise<void>;
|
|
30
|
+
//# sourceMappingURL=stable-release.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stable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GAAG,qBAAqB,CAOpG;AAED,wBAAsB,oBAAoB,CACxC,QAAQ,EAAE,qBAAqB,EAC/B,OAAO,EAAE,MAAM,OAAO,CAAC,mBAAmB,CAAC,EAC3C,OAAO,GAAE,iCAAsC,GAC9C,OAAO,CAAC,IAAI,CAAC,CAkBf"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { prerelease, valid } from "semver";
|
|
2
|
+
import { ADDONE_PACKAGE_NAME } from "./release.js";
|
|
3
|
+
export function createStableReleaseEvidence(input) {
|
|
4
|
+
if (input.packageName !== ADDONE_PACKAGE_NAME)
|
|
5
|
+
throw new Error(`unexpected stable package: ${input.packageName}`);
|
|
6
|
+
if (valid(input.version) === null || prerelease(input.version) !== null)
|
|
7
|
+
throw new Error(`stable release requires an exact stable version: ${input.version}`);
|
|
8
|
+
if (input.tag !== `v${input.version}`)
|
|
9
|
+
throw new Error(`stable tag ${input.tag} does not match v${input.version}`);
|
|
10
|
+
if (!/^sha512-[A-Za-z0-9+/]+={0,2}$/.test(input.integrity))
|
|
11
|
+
throw new Error("stable release integrity is malformed");
|
|
12
|
+
if (!/^[a-f0-9]{40}$/.test(input.shasum))
|
|
13
|
+
throw new Error("stable release shasum is malformed");
|
|
14
|
+
return { schema: "addone-stable-release-v1", channel: "latest", ...input };
|
|
15
|
+
}
|
|
16
|
+
export async function verifyStableRegistry(expected, observe, options = {}) {
|
|
17
|
+
const attempts = options.attempts ?? 12;
|
|
18
|
+
const delayMs = options.delayMs ?? 2_000;
|
|
19
|
+
const delay = options.delay ?? (async (milliseconds) => await new Promise(resolve => setTimeout(resolve, milliseconds)));
|
|
20
|
+
if (!Number.isInteger(attempts) || attempts < 1)
|
|
21
|
+
throw new Error(`invalid registry verification attempts: ${attempts}`);
|
|
22
|
+
let state = null;
|
|
23
|
+
for (let attempt = 1; attempt <= attempts; attempt += 1) {
|
|
24
|
+
state = await observe();
|
|
25
|
+
if (state.packageName === expected.packageName
|
|
26
|
+
&& state.version === expected.version
|
|
27
|
+
&& state.latest === expected.version
|
|
28
|
+
&& state.integrity === expected.integrity
|
|
29
|
+
&& state.shasum === expected.shasum
|
|
30
|
+
&& state.bins.length === 1
|
|
31
|
+
&& state.bins[0] === "a1")
|
|
32
|
+
return;
|
|
33
|
+
if (attempt < attempts)
|
|
34
|
+
await delay(delayMs);
|
|
35
|
+
}
|
|
36
|
+
throw new Error(`npm latest did not match accepted ${expected.packageName}@${expected.version} after ${attempts} attempts: ${JSON.stringify(state)}`);
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=stable-release.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stable-release.js","sourceRoot":"","sources":["../../../../src/foundation/release/stable-release.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAiCnD,MAAM,UAAU,2BAA2B,CAAC,KAAiC;IAC3E,IAAI,KAAK,CAAC,WAAW,KAAK,mBAAmB;QAAE,MAAM,IAAI,KAAK,CAAC,8BAA8B,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC;IAClH,IAAI,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,IAAI,IAAI,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,oDAAoD,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IAC9J,IAAI,KAAK,CAAC,GAAG,KAAK,IAAI,KAAK,CAAC,OAAO,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,cAAc,KAAK,CAAC,GAAG,oBAAoB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IACnH,IAAI,CAAC,+BAA+B,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;IACrH,IAAI,CAA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AC;eACvB,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI;YAAE,OAAO;QACpC,IAAI,OAAO,GAAG,QAAQ;YAAE,MAAM,KAAK,CAAC,OAAO,CAAC,CAAC;IAC/C,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,qCAAqC,QAAQ,CAAC,WAAW,IAAI,QAAQ,CAAC,OAAO,UAAU,QAAQ,cAAc,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AACxJ,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { UpdateChannel } from "./update.js";
|
|
2
|
+
export type UpdateTransactionPhase = "shutdown-intent" | "ownership-released" | "package-installed" | "materialized" | "certified" | "active-reference-committed" | "supervisor-verified";
|
|
3
|
+
export interface UpdateTransaction {
|
|
4
|
+
readonly schemaVersion: 1;
|
|
5
|
+
readonly transactionId: string;
|
|
6
|
+
readonly channel: UpdateChannel;
|
|
7
|
+
readonly targetVersion: string;
|
|
8
|
+
readonly packageRoot: string;
|
|
9
|
+
readonly priorActiveReleaseId: string | null;
|
|
10
|
+
readonly phase: UpdateTransactionPhase;
|
|
11
|
+
readonly status: "active" | "completed" | "rolled-back" | "failed";
|
|
12
|
+
readonly error: string | null;
|
|
13
|
+
readonly startedAt: string;
|
|
14
|
+
readonly updatedAt: string;
|
|
15
|
+
}
|
|
16
|
+
export declare class UpdateTransactionStore {
|
|
17
|
+
#private;
|
|
18
|
+
readonly path: string;
|
|
19
|
+
constructor(dataDir: string);
|
|
20
|
+
read(): Promise<UpdateTransaction | null>;
|
|
21
|
+
begin(input: {
|
|
22
|
+
channel: UpdateChannel;
|
|
23
|
+
targetVersion: string;
|
|
24
|
+
packageRoot: string;
|
|
25
|
+
priorActiveReleaseId: string | null;
|
|
26
|
+
}): Promise<UpdateTransaction>;
|
|
27
|
+
advance(phase: UpdateTransactionPhase): Promise<UpdateTransaction>;
|
|
28
|
+
finish(status: "completed" | "rolled-back" | "failed", error?: string | null): Promise<UpdateTransaction>;
|
|
29
|
+
clearCompleted(): Promise<void>;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=update-transaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-transaction.d.ts","sourceRoot":"","sources":["../../../../src/foundation/release/update-transaction.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,MAAM,MAAM,sBAAsB,GAC9B,iBAAiB,GACjB,oBAAoB,GACpB,mBAAmB,GACnB,cAAc,GACd,WAAW,GACX,4BAA4B,GAC5B,qBAAqB,CAAC;AAE1B,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,aAAa,EAAE,CAAC,CAAC;IAC1B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;IAChC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7C,QAAQ,CAAC,KAAK,EAAE,sBAAsB,CAAC;IACvC,QAAQ,CAAC,MAAM,EAAE,QAAQ,GAAG,WAAW,GAAG,aAAa,GAAG,QAAQ,CAAC;IACnE,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED,qBAAa,sBAAsB;;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBACV,OAAO,EAAE,MAAM;IAErB,IAAI,IAAI,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAWzC,KAAK,CAAC,KAAK,EAAE;QAAE,OAAO,EAAE,aAAa,CAAC;QAAC,aAAa,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAqBrJ,OAAO,CAAC,KAAK,EAAE,sBAAsB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAMlE,MAAM,CAAC,MAAM,EAAE,WAAW,GAAG,aAAa,GAAG,QAAQ,EAAE,KAAK,GAAE,MAAM,GAAG,IAAW,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAM/G,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;CAyBtC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { mkdir, open, readFile, rename, rm } from "node:fs/promises";
|
|
3
|
+
import { dirname, resolve } from "node:path";
|
|
4
|
+
export class UpdateTransactionStore {
|
|
5
|
+
path;
|
|
6
|
+
constructor(dataDir) { this.path = resolve(dataDir, "update-transaction.json"); }
|
|
7
|
+
async read() {
|
|
8
|
+
try {
|
|
9
|
+
const value = JSON.parse(await readFile(this.path, "utf8"));
|
|
10
|
+
validate(value);
|
|
11
|
+
return value;
|
|
12
|
+
}
|
|
13
|
+
catch (error) {
|
|
14
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT")
|
|
15
|
+
return null;
|
|
16
|
+
throw error;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
async begin(input) {
|
|
20
|
+
const current = await this.read();
|
|
21
|
+
if (current?.status === "active") {
|
|
22
|
+
if (current.targetVersion !== input.targetVersion || current.channel !== input.channel) {
|
|
23
|
+
throw new Error(`unfinished AddOne update ${current.transactionId} targets ${current.targetVersion}; reconcile it before starting ${input.targetVersion}`);
|
|
24
|
+
}
|
|
25
|
+
return current;
|
|
26
|
+
}
|
|
27
|
+
const now = new Date().toISOString();
|
|
28
|
+
return await this.#write({
|
|
29
|
+
schemaVersion: 1,
|
|
30
|
+
transactionId: randomUUID(),
|
|
31
|
+
...input,
|
|
32
|
+
phase: "shutdown-intent",
|
|
33
|
+
status: "active",
|
|
34
|
+
error: null,
|
|
35
|
+
startedAt: now,
|
|
36
|
+
updatedAt: now,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
async advance(phase) {
|
|
40
|
+
const current = await this.#requiredActive();
|
|
41
|
+
if (phaseOrder(phase) < phaseOrder(current.phase))
|
|
42
|
+
return current;
|
|
43
|
+
return await this.#write({ ...current, phase, updatedAt: new Date().toISOString() });
|
|
44
|
+
}
|
|
45
|
+
async finish(status, error = null) {
|
|
46
|
+
const current = await this.read();
|
|
47
|
+
if (!current)
|
|
48
|
+
throw new Error("no AddOne update transaction is recorded");
|
|
49
|
+
return await this.#write({ ...current, status, error, updatedAt: new Date().toISOString() });
|
|
50
|
+
}
|
|
51
|
+
async clearCompleted() {
|
|
52
|
+
const current = await this.read();
|
|
53
|
+
if (current && current.status !== "active")
|
|
54
|
+
await rm(this.path, { force: true });
|
|
55
|
+
}
|
|
56
|
+
async #requiredActive() {
|
|
57
|
+
const current = await this.read();
|
|
58
|
+
if (!current || current.status !== "active")
|
|
59
|
+
throw new Error("no active AddOne update transaction is recorded");
|
|
60
|
+
return current;
|
|
61
|
+
}
|
|
62
|
+
async #write(value) {
|
|
63
|
+
validate(value);
|
|
64
|
+
await mkdir(dirname(this.path), { recursive: true, mode: 0o700 });
|
|
65
|
+
const temporary = `${this.path}.${process.pid}.${randomUUID()}.tmp`;
|
|
66
|
+
const file = await open(temporary, "wx", 0o600);
|
|
67
|
+
try {
|
|
68
|
+
await file.writeFile(JSON.stringify(value, null, 2));
|
|
69
|
+
await file.sync();
|
|
70
|
+
}
|
|
71
|
+
finally {
|
|
72
|
+
await file.close();
|
|
73
|
+
}
|
|
74
|
+
await rename(temporary, this.path);
|
|
75
|
+
return value;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
function phaseOrder(phase) {
|
|
79
|
+
return ["shutdown-intent", "ownership-released", "package-installed", "materialized", "certified", "active-reference-committed", "supervisor-verified"].indexOf(phase);
|
|
80
|
+
}
|
|
81
|
+
function validate(value) {
|
|
82
|
+
if (value.schemaVersion !== 1 || typeof value.transactionId !== "string" || !["stable", "next"].includes(value.channel)
|
|
83
|
+
|| typeof value.targetVersion !== "string" || typeof value.packageRoot !== "string" || typeof value.startedAt !== "string"
|
|
84
|
+
|| typeof value.updatedAt !== "string" || phaseOrder(value.phase) < 0 || !["active", "completed", "rolled-back", "failed"].includes(value.status)) {
|
|
85
|
+
throw new Error("invalid AddOne update transaction journal");
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=update-transaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-transaction.js","sourceRoot":"","sources":["../../../../src/foundation/release/update-transaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA0B7C,MAAM,OAAO,sBAAsB;IACxB,IAAI,CAAS;IACtB,YAAY,OAAe,IAAI,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,OAAO,EAAE,yBAAyB,CAAC,CAAC,CAAC,CAAC;IAEzF,KAAK,CAAC,IAAI;QACR,IAAI,CAAC;YACH,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAsB,CAAC;YACjF,QAAQ,CAAC,KAAK,CAAC,CAAC;YAChB,OAAO,KAAK,CAAC;QACf,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,KAAK,IAAI,MAAM,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ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export declare const ADDONE_PACKAGE = "@timurproko/a1";
|
|
3
|
+
export type UpdateChannel = "stable" | "next";
|
|
4
|
+
export interface ProcessRequest {
|
|
5
|
+
captureStdout: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface ProcessResult {
|
|
8
|
+
code: number | null;
|
|
9
|
+
stdout: string;
|
|
10
|
+
}
|
|
11
|
+
export type UpdateProcessRunner = (command: string, arguments_: readonly string[], request: ProcessRequest) => Promise<ProcessResult>;
|
|
12
|
+
export interface UpdateFileSystem {
|
|
13
|
+
readFile(path: string): Promise<string>;
|
|
14
|
+
realpath(path: string): Promise<string>;
|
|
15
|
+
access?(path: string): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
export interface UpdateOutput {
|
|
18
|
+
stdout(message: string): void;
|
|
19
|
+
stderr(message: string): void;
|
|
20
|
+
}
|
|
21
|
+
export interface SelfUpdateOptions {
|
|
22
|
+
packageRoot: string;
|
|
23
|
+
channel?: UpdateChannel;
|
|
24
|
+
environment?: NodeJS.ProcessEnv;
|
|
25
|
+
fileSystem?: UpdateFileSystem;
|
|
26
|
+
output?: UpdateOutput;
|
|
27
|
+
runner?: UpdateProcessRunner;
|
|
28
|
+
lifecycle?: UpdateLifecycleCoordinator;
|
|
29
|
+
transactionStore?: UpdateTransactionJournal;
|
|
30
|
+
}
|
|
31
|
+
export interface UpdateLifecycleCoordinator {
|
|
32
|
+
targetIsActive(targetVersion: string): Promise<boolean>;
|
|
33
|
+
shutdownVerifiedOwners(targetVersion: string): Promise<{
|
|
34
|
+
priorActiveVersion: string | null;
|
|
35
|
+
}>;
|
|
36
|
+
verifyPackageUnlocked(packageRoot: string): Promise<void>;
|
|
37
|
+
activateInstalled(packageRoot: string, targetVersion: string, phase: (phase: UpdateTransactionPhase) => Promise<void>): Promise<void>;
|
|
38
|
+
}
|
|
39
|
+
export interface UpdateTransactionJournal {
|
|
40
|
+
readonly path: string;
|
|
41
|
+
read(): Promise<UpdateTransaction | null>;
|
|
42
|
+
begin(input: {
|
|
43
|
+
channel: UpdateChannel;
|
|
44
|
+
targetVersion: string;
|
|
45
|
+
packageRoot: string;
|
|
46
|
+
priorActiveReleaseId: string | null;
|
|
47
|
+
}): Promise<UpdateTransaction>;
|
|
48
|
+
advance(phase: UpdateTransactionPhase): Promise<UpdateTransaction>;
|
|
49
|
+
finish(status: "completed" | "rolled-back" | "failed", error?: string | null): Promise<UpdateTransaction>;
|
|
50
|
+
clearCompleted(): Promise<void>;
|
|
51
|
+
}
|
|
52
|
+
export declare function createNpmProcessRunner(platform?: NodeJS.Platform): UpdateProcessRunner;
|
|
53
|
+
export declare function createUpdateLifecycleCoordinator(environment?: NodeJS.ProcessEnv, fileSystem?: UpdateFileSystem): UpdateLifecycleCoordinator;
|
|
54
|
+
export declare function runSelfUpdate(options: SelfUpdateOptions): Promise<number>;
|
|
55
|
+
//# sourceMappingURL=update.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../../src/foundation/release/update.ts"],"names":[],"mappings":"AAoBA,OAAO,EAA0B,KAAK,iBAAiB,EAAE,KAAK,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEtH,eAAO,MAAM,cAAc,mBAAmB,CAAC;AAC/C,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,MAAM,CAAC;AAG9C,MAAM,WAAW,cAAc;IAAG,aAAa,EAAE,OAAO,CAAA;CAAE;AAC1D,MAAM,WAAW,aAAa;IAAG,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE;AACtE,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,MAAM,EAAE,EAAE,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;AACtI,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAA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