@timurproko/a1 0.1.8-dev.112 → 0.1.8-dev.121
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/bin/cli.js +7 -7
- package/bin/guardian.js +1 -1
- package/bin/supervisor.js +1 -1
- package/bin/ui.js +3 -3
- package/dist/{src/cli → cli}/packages.d.ts +1 -1
- package/dist/composition/agent-engine-bridge.d.ts +3 -0
- package/dist/composition/agent-engine-bridge.js +108 -0
- package/dist/composition/index.d.ts +3 -0
- package/dist/composition/index.js +3 -0
- package/dist/composition/owned-ui.d.ts +25 -0
- package/dist/composition/owned-ui.js +40 -0
- package/dist/composition/process.d.ts +16 -0
- package/dist/composition/process.js +45 -0
- package/dist/composition/settings-route-host.d.ts +8 -0
- package/dist/composition/settings-route-host.js +73 -0
- package/dist/{src/features → features}/owned-ui/customization.d.ts +1 -1
- package/dist/{src/features → features}/owned-ui/customization.js +1 -1
- package/dist/{src/features → features}/owned-ui/diagnostics.d.ts +1 -1
- package/dist/{src/features → features}/owned-ui/run.d.ts +2 -2
- package/dist/{src/features → features}/owned-ui/settings-app.d.ts +3 -3
- package/dist/{src/features → features}/owned-ui/settings-app.js +1 -1
- package/dist/{src/features → features}/workspace/capabilities.d.ts +1 -1
- package/dist/{src/features → features}/workspace/reducer.d.ts +1 -1
- package/dist/{src/features → features}/workspace/reducer.js +1 -1
- package/dist/{src/features → features}/workspace/router.d.ts +1 -1
- package/dist/{src/features → features}/workspace/store.d.ts +1 -1
- package/dist/{src/foundation → foundation}/launch-guardian/main.js +8 -2
- package/dist/foundation/lifecycle/paths.d.ts +28 -0
- package/dist/{src/foundation → foundation}/lifecycle/paths.js +21 -0
- package/dist/{src/foundation → foundation}/native-host-protocol/messages.d.ts +1 -1
- package/dist/{src/foundation → foundation}/native-host-protocol/messages.js +1 -1
- package/dist/{src/foundation → foundation}/release/bootstrap.js +42 -10
- package/dist/foundation/release/endpoints.d.ts +20 -0
- package/dist/foundation/release/endpoints.js +50 -0
- package/dist/{src/foundation → foundation}/release/index.d.ts +1 -0
- package/dist/{src/foundation → foundation}/release/index.js +1 -0
- package/dist/{src/foundation → foundation}/release/release-gc.d.ts +4 -1
- package/dist/{src/foundation → foundation}/release/release-gc.js +9 -1
- package/dist/{src/foundation → foundation}/release/update.d.ts +8 -0
- package/dist/{src/foundation → foundation}/release/update.js +60 -22
- package/dist/{src/foundation → foundation}/storage/control-store.d.ts +1 -1
- package/dist/{src/foundation → foundation}/storage/control-store.js +1 -1
- package/dist/{src/foundation → foundation}/structured-agent-runtime/backpressure.d.ts +1 -1
- package/dist/{src/foundation → foundation}/structured-agent-runtime/backpressure.js +1 -1
- package/dist/{src/foundation → foundation}/structured-agent-runtime/commands.d.ts +1 -1
- package/dist/{src/foundation → foundation}/structured-agent-runtime/commands.js +1 -1
- package/dist/{src/foundation → foundation}/structured-agent-runtime/handshake.d.ts +1 -1
- package/dist/{src/foundation → foundation}/structured-agent-runtime/handshake.js +1 -1
- package/dist/{src/foundation → foundation}/structured-agent-runtime/reconnection.d.ts +1 -1
- package/dist/{src/foundation → foundation}/structured-agent-runtime/reconnection.js +1 -1
- package/dist/{src/foundation → foundation}/structured-agent-runtime/state.d.ts +1 -1
- package/dist/{src/foundation → foundation}/structured-agent-runtime/state.js +1 -1
- package/dist/foundation/supervision/index.d.ts +3 -0
- package/dist/foundation/supervision/index.js +3 -0
- package/dist/{src/foundation → foundation}/supervision/main.js +11 -5
- package/dist/foundation/supervision/paths.d.ts +1 -0
- package/dist/foundation/supervision/paths.js +1 -0
- package/dist/{src/foundation → foundation}/supervision/server.d.ts +18 -1
- package/dist/{src/foundation → foundation}/supervision/server.js +52 -1
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/components.d.ts +1 -1
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/conformance.js +2 -2
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-extension-ui.d.ts +1 -1
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-footer-status.d.ts +1 -1
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-presenters-transcript.d.ts +1 -1
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-presenters-transcript.js +1 -1
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-selectors-dialogs.d.ts +1 -1
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-shared-facade.d.ts +1 -1
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/session-footer.d.ts +1 -1
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/adapter.d.ts +2 -2
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/adapter.js +59 -6
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/conformance.js +2 -2
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/model-auth-integration.d.ts +1 -1
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/package-integration.d.ts +1 -1
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/package-integration.js +1 -1
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/resource-extension-integration.d.ts +1 -1
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/session-integration.d.ts +1 -1
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/session-integration.js +1 -1
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/settings-integration.d.ts +1 -1
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/workflow-controllers.d.ts +1 -1
- package/dist/{src/foundation/pi-owned-ui-integration → integrations/pi/owned-ui}/route-host.d.ts +1 -1
- package/dist/{src/foundation/pi-owned-ui-integration/session-shell.d.ts → integrations/pi/owned-ui/session-shell-root.d.ts} +7 -46
- package/dist/integrations/pi/owned-ui/session-shell-root.js +722 -0
- package/dist/integrations/pi/owned-ui/session-shell.d.ts +46 -0
- package/dist/{src/foundation/pi-owned-ui-integration → integrations/pi/owned-ui}/session-shell.js +6 -720
- package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/presentation-adapter.d.ts +1 -1
- package/dist/native/darwin-arm64/manifest.json +1 -1
- package/dist/native/linux-x64/manifest.json +1 -1
- package/dist/native/win32-x64/manifest.json +2 -2
- package/dist/native/win32-x64/process-guardian.exe +0 -0
- package/dist/{src/foundation/ui-apps → ui/apps}/contracts.d.ts +1 -1
- package/dist/{src/foundation/ui-apps → ui/apps}/host.d.ts +1 -1
- package/dist/{src/foundation/ui-apps → ui/apps}/host.js +1 -1
- package/dist/{src/foundation/owned-ui-settings → ui/settings}/session.d.ts +1 -1
- package/docs/architecture/boundaries.md +8 -8
- package/docs/architecture/project-structure.md +52 -29
- package/docs/architecture/toolchain.md +4 -4
- package/docs/ci-release-runbook.md +1 -1
- package/docs/features/launch-profiles.md +6 -8
- package/docs/manual-owned-ui-checkpoint.md +52 -0
- package/docs/manual-terminal-colour-check.md +1 -1
- package/package.json +23 -23
- package/dist/src/composition/index.d.ts +0 -48
- package/dist/src/composition/index.js +0 -258
- package/dist/src/foundation/lifecycle/paths.d.ts +0 -10
- package/dist/src/foundation/supervision/index.d.ts +0 -3
- package/dist/src/foundation/supervision/index.js +0 -3
- package/dist/src/foundation/supervision/paths.d.ts +0 -1
- package/dist/src/foundation/supervision/paths.js +0 -1
- package/docs/manual-transparent-checkpoint.md +0 -53
- /package/dist/{src/cli → cli}/capabilities.d.ts +0 -0
- /package/dist/{src/cli → cli}/capabilities.js +0 -0
- /package/dist/{src/cli → cli}/dispatch.d.ts +0 -0
- /package/dist/{src/cli → cli}/dispatch.js +0 -0
- /package/dist/{src/cli → cli}/index.d.ts +0 -0
- /package/dist/{src/cli → cli}/index.js +0 -0
- /package/dist/{src/cli → cli}/packages.js +0 -0
- /package/dist/{src/cli → cli}/version-stats.d.ts +0 -0
- /package/dist/{src/cli → cli}/version-stats.js +0 -0
- /package/dist/{src/cli → cli}/version.d.ts +0 -0
- /package/dist/{src/cli → cli}/version.js +0 -0
- /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/capability-ports.d.ts +0 -0
- /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/capability-ports.js +0 -0
- /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/domain-validation.d.ts +0 -0
- /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/domain-validation.js +0 -0
- /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/domain.d.ts +0 -0
- /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/domain.js +0 -0
- /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/index.d.ts +0 -0
- /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/index.js +0 -0
- /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/model.d.ts +0 -0
- /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/model.js +0 -0
- /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/package-ports.d.ts +0 -0
- /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/package-ports.js +0 -0
- /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/ports.d.ts +0 -0
- /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/ports.js +0 -0
- /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/serialization.d.ts +0 -0
- /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/serialization.js +0 -0
- /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/validation.d.ts +0 -0
- /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/validation.js +0 -0
- /package/dist/{src/foundation/owned-ui-contracts → contracts/owned-ui}/extension-ui.d.ts +0 -0
- /package/dist/{src/foundation/owned-ui-contracts → contracts/owned-ui}/extension-ui.js +0 -0
- /package/dist/{src/foundation/owned-ui-contracts → contracts/owned-ui}/index.d.ts +0 -0
- /package/dist/{src/foundation/owned-ui-contracts → contracts/owned-ui}/index.js +0 -0
- /package/dist/{src/foundation/owned-ui-contracts → contracts/owned-ui}/model.d.ts +0 -0
- /package/dist/{src/foundation/owned-ui-contracts → contracts/owned-ui}/model.js +0 -0
- /package/dist/{src/foundation/owned-ui-contracts → contracts/owned-ui}/validation.d.ts +0 -0
- /package/dist/{src/foundation/owned-ui-contracts → contracts/owned-ui}/validation.js +0 -0
- /package/dist/{src/foundation/presentation-contracts → contracts/presentation}/index.d.ts +0 -0
- /package/dist/{src/foundation/presentation-contracts → contracts/presentation}/index.js +0 -0
- /package/dist/{src/foundation/workspace-contracts → contracts/workspace}/index.d.ts +0 -0
- /package/dist/{src/foundation/workspace-contracts → contracts/workspace}/index.js +0 -0
- /package/dist/{src/foundation/workspace-contracts → contracts/workspace}/model.d.ts +0 -0
- /package/dist/{src/foundation/workspace-contracts → contracts/workspace}/model.js +0 -0
- /package/dist/{src/foundation/workspace-contracts → contracts/workspace}/validation.d.ts +0 -0
- /package/dist/{src/foundation/workspace-contracts → contracts/workspace}/validation.js +0 -0
- /package/dist/{src/features → features}/launch/development-launch.d.ts +0 -0
- /package/dist/{src/features → features}/launch/development-launch.js +0 -0
- /package/dist/{src/features → features}/launch/index.d.ts +0 -0
- /package/dist/{src/features → features}/launch/index.js +0 -0
- /package/dist/{src/features → features}/launch/initialize-profile.d.ts +0 -0
- /package/dist/{src/features → features}/launch/initialize-profile.js +0 -0
- /package/dist/{src/features → features}/launch/intent.d.ts +0 -0
- /package/dist/{src/features → features}/launch/intent.js +0 -0
- /package/dist/{src/features → features}/launch/prepare-launch.d.ts +0 -0
- /package/dist/{src/features → features}/launch/prepare-launch.js +0 -0
- /package/dist/{src/features → features}/launch/profile-paths.d.ts +0 -0
- /package/dist/{src/features → features}/launch/profile-paths.js +0 -0
- /package/dist/{src/features → features}/launch/profiles.d.ts +0 -0
- /package/dist/{src/features → features}/launch/profiles.js +0 -0
- /package/dist/{src/features → features}/launch/runtime-selection.d.ts +0 -0
- /package/dist/{src/features → features}/launch/runtime-selection.js +0 -0
- /package/dist/{src/features → features}/owned-ui/diagnostics.js +0 -0
- /package/dist/{src/features → features}/owned-ui/index.d.ts +0 -0
- /package/dist/{src/features → features}/owned-ui/index.js +0 -0
- /package/dist/{src/features → features}/owned-ui/run.js +0 -0
- /package/dist/{src/features → features}/workspace/capabilities.js +0 -0
- /package/dist/{src/features → features}/workspace/index.d.ts +0 -0
- /package/dist/{src/features → features}/workspace/index.js +0 -0
- /package/dist/{src/features → features}/workspace/presentation.d.ts +0 -0
- /package/dist/{src/features → features}/workspace/presentation.js +0 -0
- /package/dist/{src/features → features}/workspace/reconciliation.d.ts +0 -0
- /package/dist/{src/features → features}/workspace/reconciliation.js +0 -0
- /package/dist/{src/features → features}/workspace/router.js +0 -0
- /package/dist/{src/features → features}/workspace/store.js +0 -0
- /package/dist/{src/foundation → foundation}/launch-guardian/index.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/launch-guardian/index.js +0 -0
- /package/dist/{src/foundation → foundation}/launch-guardian/main.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/lifecycle/commands.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/lifecycle/commands.js +0 -0
- /package/dist/{src/foundation → foundation}/lifecycle/index.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/lifecycle/index.js +0 -0
- /package/dist/{src/foundation → foundation}/lifecycle/launch-instance.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/lifecycle/launch-instance.js +0 -0
- /package/dist/{src/foundation → foundation}/lifecycle/model.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/lifecycle/model.js +0 -0
- /package/dist/{src/foundation → foundation}/native-host-protocol/codec.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/native-host-protocol/codec.js +0 -0
- /package/dist/{src/foundation → foundation}/native-host-protocol/evidence.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/native-host-protocol/evidence.js +0 -0
- /package/dist/{src/foundation → foundation}/native-host-protocol/index.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/native-host-protocol/index.js +0 -0
- /package/dist/{src/foundation → foundation}/native-host-protocol/proof-gate.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/native-host-protocol/proof-gate.js +0 -0
- /package/dist/{src/foundation → foundation}/process-containment/artifact.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/process-containment/artifact.js +0 -0
- /package/dist/{src/foundation → foundation}/process-containment/contracts.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/process-containment/contracts.js +0 -0
- /package/dist/{src/foundation → foundation}/process-containment/index.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/process-containment/index.js +0 -0
- /package/dist/{src/foundation → foundation}/process-containment/linux-process-inspector.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/process-containment/linux-process-inspector.js +0 -0
- /package/dist/{src/foundation → foundation}/process-containment/native-guardian-containment.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/process-containment/native-guardian-containment.js +0 -0
- /package/dist/{src/foundation → foundation}/process-containment/windows-process-inspector.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/process-containment/windows-process-inspector.js +0 -0
- /package/dist/{src/foundation → foundation}/protocol/client.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/protocol/client.js +0 -0
- /package/dist/{src/foundation → foundation}/protocol/index.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/protocol/index.js +0 -0
- /package/dist/{src/foundation → foundation}/protocol/messages.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/protocol/messages.js +0 -0
- /package/dist/{src/foundation → foundation}/release/bootstrap.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/release/cohort-selection.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/release/cohort-selection.js +0 -0
- /package/dist/{src/foundation → foundation}/release/cohort-state.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/release/cohort-state.js +0 -0
- /package/dist/{src/foundation → foundation}/release/concurrency.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/release/concurrency.js +0 -0
- /package/dist/{src/foundation → foundation}/release/process-cleanup.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/release/process-cleanup.js +0 -0
- /package/dist/{src/foundation → foundation}/release/release-store.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/release/release-store.js +0 -0
- /package/dist/{src/foundation → foundation}/release/release.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/release/release.js +0 -0
- /package/dist/{src/foundation → foundation}/release/stable-release.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/release/stable-release.js +0 -0
- /package/dist/{src/foundation → foundation}/release/update-transaction.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/release/update-transaction.js +0 -0
- /package/dist/{src/foundation → foundation}/storage/index.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/storage/index.js +0 -0
- /package/dist/{src/foundation → foundation}/structured-agent-runtime/index.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/structured-agent-runtime/index.js +0 -0
- /package/dist/{src/foundation → foundation}/supervision/main.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/components.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/conformance.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/index.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/index.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/resources/builtin-themes.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/resources/builtin-themes.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-components.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-components.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-editor-autocomplete.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-editor-autocomplete.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-extension-ui.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-footer-status.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-selectors-dialogs.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-shared-facade.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/theme.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/theme.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/adjacent/core/keybindings.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/adjacent/core/keybindings.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/countdown-timer.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/countdown-timer.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/custom-entry.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/custom-entry.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/daxnuts.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/daxnuts.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/earendil-announcement.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/earendil-announcement.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/extension-editor.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/extension-editor.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/first-time-setup.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/first-time-setup.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/markdown-transform.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/markdown-transform.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/mermaid.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/mermaid.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/owned-editor.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/owned-editor.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/scoped-models-selector.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/scoped-models-selector.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/session-footer.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/session-selector-search.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/session-selector-search.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/session-selector.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/session-selector.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/skill-invocation-message.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/skill-invocation-message.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/status-indicator.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/status-indicator.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/tree-selector.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/tree-selector.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/trust-selector.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/trust-selector.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/external-editor.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/external-editor.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/model-search.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/model-search.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/theme/theme-controller.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/theme/theme-controller.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/theme/theme.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/theme/theme.js +0 -0
- /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/conformance.d.ts +0 -0
- /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/index.d.ts +0 -0
- /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/index.js +0 -0
- /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/model-auth-integration.js +0 -0
- /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/pi-settings-metadata.json +0 -0
- /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/public-main-entry.d.ts +0 -0
- /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/public-main-entry.js +0 -0
- /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/resource-extension-integration.js +0 -0
- /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/runtime-integration.d.ts +0 -0
- /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/runtime-integration.js +0 -0
- /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/settings-integration.js +0 -0
- /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/workflow-controllers.js +0 -0
- /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/workflows.d.ts +0 -0
- /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/workflows.js +0 -0
- /package/dist/{src/foundation/pi-owned-ui-integration → integrations/pi/owned-ui}/index.d.ts +0 -0
- /package/dist/{src/foundation/pi-owned-ui-integration → integrations/pi/owned-ui}/index.js +0 -0
- /package/dist/{src/foundation/pi-owned-ui-integration → integrations/pi/owned-ui}/route-host.js +0 -0
- /package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/adapter.d.ts +0 -0
- /package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/adapter.js +0 -0
- /package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/conformance.d.ts +0 -0
- /package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/conformance.js +0 -0
- /package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/contracts.d.ts +0 -0
- /package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/contracts.js +0 -0
- /package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/index.d.ts +0 -0
- /package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/index.js +0 -0
- /package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/presentation-adapter.js +0 -0
- /package/dist/{src/product-identity.d.ts → product-identity.d.ts} +0 -0
- /package/dist/{src/product-identity.js → product-identity.js} +0 -0
- /package/dist/{src/product-identity.json → product-identity.json} +0 -0
- /package/dist/{src/foundation/ui-apps → ui/apps}/contracts.js +0 -0
- /package/dist/{src/foundation/ui-apps → ui/apps}/index.d.ts +0 -0
- /package/dist/{src/foundation/ui-apps → ui/apps}/index.js +0 -0
- /package/dist/{src/foundation/ui-apps → ui/apps}/registry.d.ts +0 -0
- /package/dist/{src/foundation/ui-apps → ui/apps}/registry.js +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/dialog-panel.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/dialog-panel.js +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/frame.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/frame.js +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/index.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/index.js +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/label.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/label.js +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/line-input.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/line-input.js +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/list-block.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/list-block.js +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/list-view.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/list-view.js +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/mouse.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/mouse.js +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/pane.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/pane.js +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/revision.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/revision.js +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/scrollbar.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/scrollbar.js +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/shortcuts.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/shortcuts.js +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/spans.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/spans.js +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/status-line.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/status-line.js +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/stepper.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/stepper.js +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/surface.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/surface.js +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/text.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/text.js +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/theme.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/theme.js +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/value-menu.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/value-menu.js +0 -0
- /package/dist/{src/foundation/owned-ui-settings → ui/settings}/declarations.d.ts +0 -0
- /package/dist/{src/foundation/owned-ui-settings → ui/settings}/declarations.js +0 -0
- /package/dist/{src/foundation/owned-ui-settings → ui/settings}/index.d.ts +0 -0
- /package/dist/{src/foundation/owned-ui-settings → ui/settings}/index.js +0 -0
- /package/dist/{src/foundation/owned-ui-settings → ui/settings}/migrations.d.ts +0 -0
- /package/dist/{src/foundation/owned-ui-settings → ui/settings}/migrations.js +0 -0
- /package/dist/{src/foundation/owned-ui-settings → ui/settings}/resolution.d.ts +0 -0
- /package/dist/{src/foundation/owned-ui-settings → ui/settings}/resolution.js +0 -0
- /package/dist/{src/foundation/owned-ui-settings → ui/settings}/sections.d.ts +0 -0
- /package/dist/{src/foundation/owned-ui-settings → ui/settings}/sections.js +0 -0
- /package/dist/{src/foundation/owned-ui-settings → ui/settings}/session.js +0 -0
- /package/dist/{src/foundation/owned-ui-settings → ui/settings}/store.d.ts +0 -0
- /package/dist/{src/foundation/owned-ui-settings → ui/settings}/store.js +0 -0
|
@@ -5,9 +5,10 @@ import { platform } from "node:os";
|
|
|
5
5
|
import { resolve } from "node:path";
|
|
6
6
|
import { selectCohortLaunch } from "./cohort-selection.js";
|
|
7
7
|
import { CohortStateStore } from "./cohort-state.js";
|
|
8
|
-
import { assertLaunchProfileId, resolveProductPaths } from "../lifecycle/index.js";
|
|
8
|
+
import { assertLaunchProfileId, resolveCohortEndpoint, resolveProductPaths } from "../lifecycle/index.js";
|
|
9
9
|
import { encodeFrame, LineFrameDecoder } from "../protocol/index.js";
|
|
10
10
|
import { cleanupProvenIdleOwner, processIsAlive } from "./process-cleanup.js";
|
|
11
|
+
import { sweepDeadEndpoints } from "./endpoints.js";
|
|
11
12
|
import { consumeMaterializationProof, materializeRelease, readCertifiedReleaseManifest, readMaterializedRelease, resolveReleaseEntryPoint, verifyMaterializedRelease } from "./release-store.js";
|
|
12
13
|
import { PRODUCT_IDENTITY, PRODUCT_TEXT } from "../../product-identity.js";
|
|
13
14
|
export async function runBootstrap(options) {
|
|
@@ -20,7 +21,27 @@ export async function runBootstrap(options) {
|
|
|
20
21
|
await mkdir(paths.runtimeDir, { recursive: true, mode: 0o700 });
|
|
21
22
|
const stateStore = new CohortStateStore(paths.dataDir);
|
|
22
23
|
let state = await stateStore.read();
|
|
23
|
-
|
|
24
|
+
// Records left by cohorts whose processes are gone say nothing about ownership, and there
|
|
25
|
+
// can now be several of them. Clearing them first keeps the decision below about what is
|
|
26
|
+
// actually running.
|
|
27
|
+
await sweepDeadEndpoints(paths).catch(() => []);
|
|
28
|
+
// Each cohort keeps its own endpoint, so a launch looks for the endpoint of the release it
|
|
29
|
+
// is about to run rather than for the one endpoint the runtime directory used to have.
|
|
30
|
+
const activeReleaseId = state.references.active;
|
|
31
|
+
let endpointPaths = activeReleaseId === null
|
|
32
|
+
? { endpoint: paths.endpoint, endpointMetadataPath: paths.endpointMetadataPath }
|
|
33
|
+
: resolveCohortEndpoint(paths, activeReleaseId, environment);
|
|
34
|
+
let endpoint = await readEndpointMetadata(endpointPaths.endpointMetadataPath);
|
|
35
|
+
if (endpoint === null) {
|
|
36
|
+
// A release that predates cohort-scoped endpoints published one endpoint for the whole
|
|
37
|
+
// runtime directory. Recognizing it is what lets a session started by that release keep
|
|
38
|
+
// working through the first launch that knows about cohorts.
|
|
39
|
+
const legacy = await readEndpointMetadata(paths.endpointMetadataPath);
|
|
40
|
+
if (legacy !== null) {
|
|
41
|
+
endpoint = legacy;
|
|
42
|
+
endpointPaths = { endpoint: paths.endpoint, endpointMetadataPath: paths.endpointMetadataPath };
|
|
43
|
+
}
|
|
44
|
+
}
|
|
24
45
|
let probe = endpoint ? await probeOwnership(endpoint) : "dead";
|
|
25
46
|
const installedVersion = await readInstalledVersion(options.packageRoot);
|
|
26
47
|
const activeId = state.references.active;
|
|
@@ -35,10 +56,11 @@ export async function runBootstrap(options) {
|
|
|
35
56
|
}
|
|
36
57
|
if (endpoint === null || probe === "dead") {
|
|
37
58
|
if (endpoint)
|
|
38
|
-
await removeEndpointArtifacts(
|
|
59
|
+
await removeEndpointArtifacts(endpointPaths.endpointMetadataPath, endpointPaths.endpoint);
|
|
39
60
|
const retained = await readMaterializedRelease(active.releaseRoot);
|
|
61
|
+
const retainedPaths = resolveCohortEndpoint(paths, retained.releaseId, environment);
|
|
40
62
|
await startSupervisor(retained, environment);
|
|
41
|
-
await waitForVerifiedEndpoint(
|
|
63
|
+
await waitForVerifiedEndpoint(retainedPaths.endpointMetadataPath, retained, 8_000);
|
|
42
64
|
return await launchUi(retained, environment);
|
|
43
65
|
}
|
|
44
66
|
}
|
|
@@ -51,7 +73,17 @@ export async function runBootstrap(options) {
|
|
|
51
73
|
await stateStore.activate(candidate.releaseId);
|
|
52
74
|
state = await stateStore.read();
|
|
53
75
|
}
|
|
54
|
-
endpoint
|
|
76
|
+
// The candidate's own endpoint decides whether this launch attaches or starts a supervisor.
|
|
77
|
+
// A cohort other than this one is not in the way: it listens somewhere else.
|
|
78
|
+
endpointPaths = resolveCohortEndpoint(paths, candidate.releaseId, environment);
|
|
79
|
+
endpoint = await readEndpointMetadata(endpointPaths.endpointMetadataPath);
|
|
80
|
+
if (endpoint === null) {
|
|
81
|
+
const legacy = await readEndpointMetadata(paths.endpointMetadataPath);
|
|
82
|
+
if (legacy !== null) {
|
|
83
|
+
endpoint = legacy;
|
|
84
|
+
endpointPaths = { endpoint: paths.endpoint, endpointMetadataPath: paths.endpointMetadataPath };
|
|
85
|
+
}
|
|
86
|
+
}
|
|
55
87
|
probe = endpoint ? await probeOwnership(endpoint) : "dead";
|
|
56
88
|
let decision = selectCohortLaunch(candidate, state, endpoint, probe);
|
|
57
89
|
if (decision.action === "blocked") {
|
|
@@ -64,11 +96,11 @@ export async function runBootstrap(options) {
|
|
|
64
96
|
await writeFile(resolve(paths.dataDir, `cleanup-${Date.now()}.json`), JSON.stringify(diagnostics, null, 2));
|
|
65
97
|
if (!diagnostics.terminated)
|
|
66
98
|
throw new Error(`could not safely clean stale ${PRODUCT_TEXT.displayName} supervisor ${endpoint.pid}`);
|
|
67
|
-
await removeEndpointArtifacts(
|
|
99
|
+
await removeEndpointArtifacts(endpointPaths.endpointMetadataPath, endpointPaths.endpoint);
|
|
68
100
|
decision = selectCohortLaunch(candidate, await stateStore.read(), null, "dead");
|
|
69
101
|
}
|
|
70
102
|
else if (endpoint && probe === "dead") {
|
|
71
|
-
await removeEndpointArtifacts(
|
|
103
|
+
await removeEndpointArtifacts(endpointPaths.endpointMetadataPath, endpointPaths.endpoint);
|
|
72
104
|
}
|
|
73
105
|
if (decision.action === "launch-retained-ui") {
|
|
74
106
|
const retained = await verifyMaterializedRelease(decision.releaseRoot, undefined, resolve(paths.dataDir, "releases"));
|
|
@@ -94,7 +126,7 @@ export async function runBootstrap(options) {
|
|
|
94
126
|
output.write(`${PRODUCT_TEXT.diagnostic("could not complete bounded idle cohort shutdown; the candidate remains pending.")}\n`);
|
|
95
127
|
return 1;
|
|
96
128
|
}
|
|
97
|
-
await removeEndpointArtifacts(
|
|
129
|
+
await removeEndpointArtifacts(endpointPaths.endpointMetadataPath, endpointPaths.endpoint);
|
|
98
130
|
await stateStore.activate(candidate.releaseId);
|
|
99
131
|
decision = { action: "activate-candidate", releaseId: candidate.releaseId, releaseRoot: candidate.releaseRoot, reason: "idle cohort released ownership" };
|
|
100
132
|
}
|
|
@@ -113,7 +145,7 @@ export async function runBootstrap(options) {
|
|
|
113
145
|
selected = await readMaterializedRelease(decision.releaseRoot);
|
|
114
146
|
}
|
|
115
147
|
await startSupervisor(selected, environment);
|
|
116
|
-
await waitForVerifiedEndpoint(paths.endpointMetadataPath, selected, 8_000);
|
|
148
|
+
await waitForVerifiedEndpoint(resolveCohortEndpoint(paths, selected.releaseId, environment).endpointMetadataPath, selected, 8_000);
|
|
117
149
|
return await launchUi(selected, environment);
|
|
118
150
|
}
|
|
119
151
|
async function readInstalledVersion(packageRoot) {
|
|
@@ -274,7 +306,7 @@ async function activatePendingAfterBlockerExit(candidate, stateStore, paths, env
|
|
|
274
306
|
await removeEndpointArtifacts(paths.endpointMetadataPath, paths.endpoint);
|
|
275
307
|
await stateStore.activate(candidate.releaseId);
|
|
276
308
|
await startSupervisor(candidate, environment);
|
|
277
|
-
await waitForVerifiedEndpoint(paths.endpointMetadataPath, candidate, 8_000);
|
|
309
|
+
await waitForVerifiedEndpoint(resolveCohortEndpoint(paths, candidate.releaseId, environment).endpointMetadataPath, candidate, 8_000);
|
|
278
310
|
}
|
|
279
311
|
export async function releaseVerifiedIdleOwner(metadata, dataDir, operations = {}) {
|
|
280
312
|
try {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { SupervisorEndpointMetadata } from "./cohort-state.js";
|
|
2
|
+
import type { CohortEndpointPaths, ProductPaths } from "../lifecycle/index.js";
|
|
3
|
+
export interface RecordedEndpoint {
|
|
4
|
+
readonly metadata: SupervisorEndpointMetadata;
|
|
5
|
+
readonly paths: CohortEndpointPaths;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Every endpoint recorded under this runtime directory: one per cohort, plus the single
|
|
9
|
+
* endpoint published by releases that predate cohort-scoped identity. More than one can be
|
|
10
|
+
* live at a time, and each is validated on its own identity rather than by being the only one.
|
|
11
|
+
*/
|
|
12
|
+
export declare function listRecordedEndpoints(paths: ProductPaths): Promise<readonly RecordedEndpoint[]>;
|
|
13
|
+
/**
|
|
14
|
+
* Removes the records of cohorts whose processes are gone. A record left by a cohort that
|
|
15
|
+
* exited without cleaning up is not evidence of ownership, and a later launch should not have
|
|
16
|
+
* to reason about it. Returns the release ids whose records were removed.
|
|
17
|
+
*/
|
|
18
|
+
export declare function sweepDeadEndpoints(paths: ProductPaths): Promise<readonly string[]>;
|
|
19
|
+
/** The releases that a live cohort is running from, and so must be retained. */
|
|
20
|
+
export declare function liveReleaseIds(paths: ProductPaths): Promise<readonly string[]>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { readdir } from "node:fs/promises";
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
|
+
import { readEndpointMetadata, removeEndpointArtifacts } from "./bootstrap.js";
|
|
4
|
+
import { processIsAlive } from "./process-cleanup.js";
|
|
5
|
+
/**
|
|
6
|
+
* Every endpoint recorded under this runtime directory: one per cohort, plus the single
|
|
7
|
+
* endpoint published by releases that predate cohort-scoped identity. More than one can be
|
|
8
|
+
* live at a time, and each is validated on its own identity rather than by being the only one.
|
|
9
|
+
*/
|
|
10
|
+
export async function listRecordedEndpoints(paths) {
|
|
11
|
+
const recorded = [];
|
|
12
|
+
const legacy = await readEndpointMetadata(paths.endpointMetadataPath);
|
|
13
|
+
if (legacy) {
|
|
14
|
+
recorded.push({ metadata: legacy, paths: { endpoint: paths.endpoint, endpointMetadataPath: paths.endpointMetadataPath } });
|
|
15
|
+
}
|
|
16
|
+
const names = await readdir(paths.endpointsDir).catch(() => []);
|
|
17
|
+
for (const name of names) {
|
|
18
|
+
if (!name.endsWith(".json"))
|
|
19
|
+
continue;
|
|
20
|
+
const endpointMetadataPath = resolve(paths.endpointsDir, name);
|
|
21
|
+
const metadata = await readEndpointMetadata(endpointMetadataPath);
|
|
22
|
+
if (metadata)
|
|
23
|
+
recorded.push({ metadata, paths: { endpoint: metadata.endpoint, endpointMetadataPath } });
|
|
24
|
+
}
|
|
25
|
+
return recorded;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Removes the records of cohorts whose processes are gone. A record left by a cohort that
|
|
29
|
+
* exited without cleaning up is not evidence of ownership, and a later launch should not have
|
|
30
|
+
* to reason about it. Returns the release ids whose records were removed.
|
|
31
|
+
*/
|
|
32
|
+
export async function sweepDeadEndpoints(paths) {
|
|
33
|
+
const swept = [];
|
|
34
|
+
for (const recorded of await listRecordedEndpoints(paths)) {
|
|
35
|
+
if (processIsAlive(recorded.metadata.pid))
|
|
36
|
+
continue;
|
|
37
|
+
await removeEndpointArtifacts(recorded.paths.endpointMetadataPath, recorded.paths.endpoint);
|
|
38
|
+
swept.push(recorded.metadata.releaseId);
|
|
39
|
+
}
|
|
40
|
+
return swept;
|
|
41
|
+
}
|
|
42
|
+
/** The releases that a live cohort is running from, and so must be retained. */
|
|
43
|
+
export async function liveReleaseIds(paths) {
|
|
44
|
+
const live = [];
|
|
45
|
+
for (const recorded of await listRecordedEndpoints(paths)) {
|
|
46
|
+
if (processIsAlive(recorded.metadata.pid))
|
|
47
|
+
live.push(recorded.metadata.releaseId);
|
|
48
|
+
}
|
|
49
|
+
return live;
|
|
50
|
+
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { CohortStateStore } from "./cohort-state.js";
|
|
2
|
+
import type { ProductPaths } from "../lifecycle/index.js";
|
|
2
3
|
/** Remove only a release that has no active, pending, approval, rollback,
|
|
3
4
|
* retention, process, agent, or migration reference. State is detached first;
|
|
4
5
|
* a filesystem failure can leave a safe orphan but never a dangling selector. */
|
|
5
|
-
export declare function collectRelease(store: CohortStateStore, dataDir: string, releaseId: string, externalReferences: readonly string[]
|
|
6
|
+
export declare function collectRelease(store: CohortStateStore, dataDir: string, releaseId: string, externalReferences: readonly string[],
|
|
7
|
+
/** Where endpoints are recorded, so a release a live cohort runs from is retained. */
|
|
8
|
+
paths?: ProductPaths): Promise<void>;
|
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
import { rm } from "node:fs/promises";
|
|
2
2
|
import { resolve } from "node:path";
|
|
3
3
|
import { CohortStateStore } from "./cohort-state.js";
|
|
4
|
+
import { liveReleaseIds } from "./endpoints.js";
|
|
4
5
|
import { verifyMaterializedRelease } from "./release-store.js";
|
|
5
6
|
/** Remove only a release that has no active, pending, approval, rollback,
|
|
6
7
|
* retention, process, agent, or migration reference. State is detached first;
|
|
7
8
|
* a filesystem failure can leave a safe orphan but never a dangling selector. */
|
|
8
|
-
export async function collectRelease(store, dataDir, releaseId, externalReferences
|
|
9
|
+
export async function collectRelease(store, dataDir, releaseId, externalReferences,
|
|
10
|
+
/** Where endpoints are recorded, so a release a live cohort runs from is retained. */
|
|
11
|
+
paths) {
|
|
9
12
|
const state = await store.read();
|
|
10
13
|
const release = state.releases[releaseId];
|
|
11
14
|
if (!release)
|
|
12
15
|
throw new Error(`unknown release ${releaseId}`);
|
|
16
|
+
// A superseded cohort keeps working until its last session leaves, and it runs from this
|
|
17
|
+
// content while it does. Collecting it would pull the release out from under live work.
|
|
18
|
+
if (paths && (await liveReleaseIds(paths)).includes(releaseId)) {
|
|
19
|
+
throw new Error(`release ${releaseId} is still running a live cohort`);
|
|
20
|
+
}
|
|
13
21
|
await verifyMaterializedRelease(release.releaseRoot, undefined, resolve(dataDir, "releases"));
|
|
14
22
|
await store.removeUnreferencedRelease(releaseId, externalReferences);
|
|
15
23
|
await rm(release.releaseRoot, { recursive: true, force: false });
|
|
@@ -77,6 +77,14 @@ export interface UpdateTransactionJournal {
|
|
|
77
77
|
clearCompleted(): Promise<void>;
|
|
78
78
|
}
|
|
79
79
|
export declare function createNpmProcessRunner(platform?: NodeJS.Platform): UpdateProcessRunner;
|
|
80
|
+
export type UpdateOwnershipAction = "clean-dead-record" | "leave-running" | "end-session";
|
|
81
|
+
/**
|
|
82
|
+
* What an update does about the owner it found. A cohort running from retained immutable
|
|
83
|
+
* content keeps its work: the installation replaces files it does not read, and it listens on
|
|
84
|
+
* its own endpoint. A cohort running from the mutable installation is the one exception,
|
|
85
|
+
* because that installation is exactly what is about to be replaced under it.
|
|
86
|
+
*/
|
|
87
|
+
export declare function planUpdateOwnership(ownership: "live-verified" | "dead", runsFromRetainedRelease: boolean): UpdateOwnershipAction;
|
|
80
88
|
export declare function createUpdateLifecycleCoordinator(environment?: NodeJS.ProcessEnv, fileSystem?: UpdateFileSystem, output?: UpdateOutput): UpdateLifecycleCoordinator;
|
|
81
89
|
export declare function runSelfUpdate(options: SelfUpdateOptions): Promise<number>;
|
|
82
90
|
export declare function assertUpdatePerformanceBudget(evidence: UpdatePerformanceEvidence, maximumPostNpmDurationMs?: number): void;
|
|
@@ -6,7 +6,7 @@ import crossSpawn from "cross-spawn";
|
|
|
6
6
|
import { valid as validSemver } from "semver";
|
|
7
7
|
import { PRODUCT_IDENTITY, PRODUCT_TEXT } from "../../product-identity.js";
|
|
8
8
|
import { certifyMaterializedRelease, probeOwnership, readEndpointMetadata, removeEndpointArtifacts, startSupervisor, waitForProcessExit, waitForVerifiedEndpoint, } from "./bootstrap.js";
|
|
9
|
-
import { resolveProductPaths } from "../lifecycle/index.js";
|
|
9
|
+
import { resolveCohortEndpoint, resolveProductPaths } from "../lifecycle/index.js";
|
|
10
10
|
import { encodeFrame, LineFrameDecoder } from "../protocol/index.js";
|
|
11
11
|
import { CohortStateStore } from "./cohort-state.js";
|
|
12
12
|
import { cleanupVerifiedOwner, processIsAlive } from "./process-cleanup.js";
|
|
@@ -47,6 +47,33 @@ export function createNpmProcessRunner(platform = process.platform) {
|
|
|
47
47
|
} });
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* What an update does about the owner it found. A cohort running from retained immutable
|
|
52
|
+
* content keeps its work: the installation replaces files it does not read, and it listens on
|
|
53
|
+
* its own endpoint. A cohort running from the mutable installation is the one exception,
|
|
54
|
+
* because that installation is exactly what is about to be replaced under it.
|
|
55
|
+
*/
|
|
56
|
+
export function planUpdateOwnership(ownership, runsFromRetainedRelease) {
|
|
57
|
+
if (ownership === "dead")
|
|
58
|
+
return "clean-dead-record";
|
|
59
|
+
return runsFromRetainedRelease ? "leave-running" : "end-session";
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* The endpoint of the active cohort, together with where it is recorded, so a caller that
|
|
63
|
+
* finds it can also clean it up. A release that predates cohort-scoped endpoints published
|
|
64
|
+
* one endpoint for the runtime directory, and that one is recognized too.
|
|
65
|
+
*/
|
|
66
|
+
async function readActiveEndpoint(paths, activeReleaseId, environment) {
|
|
67
|
+
if (activeReleaseId !== null) {
|
|
68
|
+
const cohort = resolveCohortEndpoint(paths, activeReleaseId, environment);
|
|
69
|
+
const metadata = await readEndpointMetadata(cohort.endpointMetadataPath);
|
|
70
|
+
if (metadata)
|
|
71
|
+
return { metadata, paths: cohort };
|
|
72
|
+
}
|
|
73
|
+
const legacyPaths = { endpoint: paths.endpoint, endpointMetadataPath: paths.endpointMetadataPath };
|
|
74
|
+
const legacy = await readEndpointMetadata(legacyPaths.endpointMetadataPath);
|
|
75
|
+
return legacy ? { metadata: legacy, paths: legacyPaths } : null;
|
|
76
|
+
}
|
|
50
77
|
export function createUpdateLifecycleCoordinator(environment = process.env, fileSystem = defaultFileSystem, output = defaultOutput) {
|
|
51
78
|
const paths = resolveProductPaths(environment);
|
|
52
79
|
const stateStore = new CohortStateStore(paths.dataDir);
|
|
@@ -56,45 +83,54 @@ export function createUpdateLifecycleCoordinator(environment = process.env, file
|
|
|
56
83
|
const activeId = state.references.active;
|
|
57
84
|
if (!activeId || state.releases[activeId]?.packageVersion !== targetVersion)
|
|
58
85
|
return false;
|
|
59
|
-
const endpoint = await
|
|
60
|
-
return endpoint?.releaseId === activeId && await probeOwnership(endpoint) === "live-verified";
|
|
86
|
+
const endpoint = await readActiveEndpoint(paths, activeId, environment);
|
|
87
|
+
return endpoint?.metadata.releaseId === activeId && await probeOwnership(endpoint.metadata) === "live-verified";
|
|
61
88
|
},
|
|
62
89
|
async shutdownVerifiedOwners(targetVersion) {
|
|
63
90
|
const state = await stateStore.read();
|
|
64
|
-
const
|
|
65
|
-
const
|
|
66
|
-
|
|
91
|
+
const activeId = state.references.active;
|
|
92
|
+
const priorActiveVersion = activeId ? state.releases[activeId]?.packageVersion ?? null : null;
|
|
93
|
+
const owner = await readActiveEndpoint(paths, activeId, environment);
|
|
94
|
+
if (!owner)
|
|
67
95
|
return { priorActiveVersion };
|
|
96
|
+
const endpoint = owner.metadata;
|
|
68
97
|
const ownership = await probeOwnership(endpoint);
|
|
69
98
|
if (ownership !== "live-verified" && ownership !== "dead") {
|
|
70
99
|
throw new Error(PRODUCT_TEXT.diagnostic(`refused update shutdown because supervisor ownership is ${ownership}`));
|
|
71
100
|
}
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
101
|
+
const plan = planUpdateOwnership(ownership, await canonicalImmutableRoot(paths.dataDir, endpoint.releaseRoot));
|
|
102
|
+
if (plan === "clean-dead-record") {
|
|
103
|
+
await removeEndpointArtifacts(owner.paths.endpointMetadataPath, owner.paths.endpoint);
|
|
104
|
+
return { priorActiveVersion };
|
|
105
|
+
}
|
|
106
|
+
if (plan === "leave-running") {
|
|
107
|
+
const running = endpoint.ownership.liveInstanceIds.length;
|
|
108
|
+
if (running > 0) {
|
|
109
|
+
output.stdout(`${PRODUCT_TEXT.commandName} update: leaving ${running === 1 ? "one session" : `${running} sessions`} running on ${endpoint.releaseId}\n`);
|
|
110
|
+
}
|
|
111
|
+
return { priorActiveVersion };
|
|
112
|
+
}
|
|
113
|
+
// Say whose work is ending before it ends.
|
|
114
|
+
const live = endpoint.ownership.liveInstanceIds.length;
|
|
115
|
+
if (live > 0) {
|
|
116
|
+
output.stderr(`${PRODUCT_TEXT.diagnostic(`ending ${live === 1 ? "one session" : `${live} sessions`} that run from the installation being replaced; a session started by an installed release would have been left alone.`)}\n`);
|
|
117
|
+
}
|
|
118
|
+
const identity = await requestUpdateShutdown(endpoint, targetVersion, 2_000);
|
|
77
119
|
if (!identity.accepted && processIsAlive(endpoint.pid)) {
|
|
78
120
|
// Explicit update consent permits bounded cleanup of an authenticated
|
|
79
121
|
// older owner that predates the update-shutdown message.
|
|
80
|
-
const cleanup = await cleanupVerifiedOwner(endpoint, {
|
|
81
|
-
allowLiveInstances: true,
|
|
82
|
-
reason: legacyMutableInstall ? "legacy-mutable-install" : "explicit-update",
|
|
83
|
-
});
|
|
122
|
+
const cleanup = await cleanupVerifiedOwner(endpoint, { allowLiveInstances: true, reason: "legacy-mutable-install" });
|
|
84
123
|
if (!cleanup.terminated)
|
|
85
124
|
throw new Error(`verified ${PRODUCT_TEXT.displayName} owner ${endpoint.pid} rejected shutdown and could not be terminated: ${identity.reason}`);
|
|
86
125
|
}
|
|
87
126
|
else if (identity.accepted) {
|
|
88
127
|
await waitForProcessExit(endpoint.pid, 3_000).catch(async () => {
|
|
89
|
-
const cleanup = await cleanupVerifiedOwner(endpoint, {
|
|
90
|
-
allowLiveInstances: true,
|
|
91
|
-
reason: legacyMutableInstall ? "legacy-mutable-install" : "explicit-update",
|
|
92
|
-
});
|
|
128
|
+
const cleanup = await cleanupVerifiedOwner(endpoint, { allowLiveInstances: true, reason: "legacy-mutable-install" });
|
|
93
129
|
if (!cleanup.terminated)
|
|
94
130
|
throw new Error(`verified ${PRODUCT_TEXT.displayName} owner ${endpoint.pid} did not terminate`);
|
|
95
131
|
});
|
|
96
132
|
}
|
|
97
|
-
await removeEndpointArtifacts(paths.endpointMetadataPath, paths.endpoint);
|
|
133
|
+
await removeEndpointArtifacts(owner.paths.endpointMetadataPath, owner.paths.endpoint);
|
|
98
134
|
return { priorActiveVersion };
|
|
99
135
|
},
|
|
100
136
|
async verifyPackageUnlocked(packageRoot) {
|
|
@@ -137,7 +173,7 @@ export function createUpdateLifecycleCoordinator(environment = process.env, file
|
|
|
137
173
|
await stateStore.activate(candidate.releaseId);
|
|
138
174
|
await phase("active-reference-committed");
|
|
139
175
|
await startSupervisor(candidate, environment);
|
|
140
|
-
await waitForVerifiedEndpoint(paths.endpointMetadataPath, candidate, 8_000);
|
|
176
|
+
await waitForVerifiedEndpoint(resolveCohortEndpoint(paths, candidate.releaseId, environment).endpointMetadataPath, candidate, 8_000);
|
|
141
177
|
},
|
|
142
178
|
};
|
|
143
179
|
}
|
|
@@ -491,8 +527,10 @@ async function rollbackPriorCohort(dataDir, environment, priorReleaseId) {
|
|
|
491
527
|
}
|
|
492
528
|
const release = await readMaterializedRelease(prior.releaseRoot);
|
|
493
529
|
const paths = resolveProductPaths(environment);
|
|
530
|
+
// Rollback re-points the active reference and starts the prior cohort on its own endpoint;
|
|
531
|
+
// a cohort that survived the update keeps serving the work it already had.
|
|
494
532
|
await startSupervisor(release, environment);
|
|
495
|
-
await waitForVerifiedEndpoint(paths.endpointMetadataPath, release, 8_000);
|
|
533
|
+
await waitForVerifiedEndpoint(resolveCohortEndpoint(paths, release.releaseId, environment).endpointMetadataPath, release, 8_000);
|
|
496
534
|
return "rolled back";
|
|
497
535
|
}
|
|
498
536
|
function phaseBefore(current, target) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DatabaseSync } from "node:sqlite";
|
|
2
|
-
import type { ManagedAgentDescriptor, PaneId, AgentRecoveryAuthority, RecoveryReferenceId, TerminalSessionLaunch, TerminalTopologySnapshot } from "
|
|
2
|
+
import type { ManagedAgentDescriptor, PaneId, AgentRecoveryAuthority, RecoveryReferenceId, TerminalSessionLaunch, TerminalTopologySnapshot } from "../../contracts/workspace/index.js";
|
|
3
3
|
import type { LaunchInstance, LaunchInstanceId, LaunchInstanceOutcome, NativeProcessIdentity, ProcessContainmentIdentity } from "../lifecycle/index.js";
|
|
4
4
|
export declare const DEFAULT_WORKSPACE_ID = "workspace-default";
|
|
5
5
|
export interface WorkspaceAgentPresentation {
|
|
@@ -2,7 +2,7 @@ import { DatabaseSync } from "node:sqlite";
|
|
|
2
2
|
import { mkdirSync } from "node:fs";
|
|
3
3
|
import { dirname } from "node:path";
|
|
4
4
|
import { PRODUCT_IDENTITY } from "../../product-identity.js";
|
|
5
|
-
import { assertManagedAgentDescriptor, assertRecoveryAuthority, assertTerminalSessionLaunch, assertTerminalTopologySnapshot, } from "
|
|
5
|
+
import { assertManagedAgentDescriptor, assertRecoveryAuthority, assertTerminalSessionLaunch, assertTerminalTopologySnapshot, } from "../../contracts/workspace/index.js";
|
|
6
6
|
import { assertLaunchInstance, assertLaunchInstanceOutcome, assertNativeProcessIdentity, assertProcessContainmentIdentity, } from "../lifecycle/index.js";
|
|
7
7
|
export const DEFAULT_WORKSPACE_ID = "workspace-default";
|
|
8
8
|
const INITIAL_WORKSPACE_ID = DEFAULT_WORKSPACE_ID;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type StructuredCapabilityContract } from "
|
|
1
|
+
import { type StructuredCapabilityContract } from "../../contracts/workspace/index.js";
|
|
2
2
|
export type StructuredBackpressureResource = "events" | "commands" | "snapshots" | "attachments" | "reconnect-replay";
|
|
3
3
|
export type StructuredBackpressureAction = "none" | "reject-payload" | "pause-adapter" | "reject-request" | "disconnect-adapter";
|
|
4
4
|
export interface StructuredResourceLease {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type StructuredCapabilityContract, type WorkspaceCommand } from "
|
|
1
|
+
import { type StructuredCapabilityContract, type WorkspaceCommand } from "../../contracts/workspace/index.js";
|
|
2
2
|
export type StructuredCommandRequest = Extract<WorkspaceCommand, {
|
|
3
3
|
readonly type: "structured-command";
|
|
4
4
|
}>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { assertStructuredCapability, assertWorkspaceCommand, } from "
|
|
1
|
+
import { assertStructuredCapability, assertWorkspaceCommand, } from "../../contracts/workspace/index.js";
|
|
2
2
|
export class StructuredCommandTracker {
|
|
3
3
|
agentId;
|
|
4
4
|
#capability;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AdapterId, type StructuredCapabilityContract, type StructuredFlowLimits } from "
|
|
1
|
+
import { type AdapterId, type StructuredCapabilityContract, type StructuredFlowLimits } from "../../contracts/workspace/index.js";
|
|
2
2
|
export declare const STRUCTURED_ADAPTER_ENVELOPE: string;
|
|
3
3
|
export declare const STRUCTURED_ADAPTER_ENVELOPE_REVISION: 1;
|
|
4
4
|
export declare const REQUIRED_STRUCTURED_FEATURES: readonly ["identity.adapter.v1", "commands.correlated.v1", "events.typed.v1", "flow-control.limits.v1"];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WORKSPACE_CONTRACT_VERSION, assertStructuredCapability, } from "
|
|
1
|
+
import { WORKSPACE_CONTRACT_VERSION, assertStructuredCapability, } from "../../contracts/workspace/index.js";
|
|
2
2
|
import { PRODUCT_IDENTITY, PRODUCT_TEXT } from "../../product-identity.js";
|
|
3
3
|
export const STRUCTURED_ADAPTER_ENVELOPE = PRODUCT_IDENTITY.protocol.structuredAgentSchema;
|
|
4
4
|
export const STRUCTURED_ADAPTER_ENVELOPE_REVISION = 1;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AgentRecoveryAuthority, type StructuredAgentSnapshot, type StructuredCapabilityContract, type StructuredRecoveryAuthority } from "
|
|
1
|
+
import { type AgentRecoveryAuthority, type StructuredAgentSnapshot, type StructuredCapabilityContract, type StructuredRecoveryAuthority } from "../../contracts/workspace/index.js";
|
|
2
2
|
import { StructuredEventReducer, type StructuredRuntimeView } from "./state.js";
|
|
3
3
|
export interface StructuredResumeProof {
|
|
4
4
|
readonly protocolVersion: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WORKSPACE_CONTRACT_VERSION, assertRecoveryAuthority, assertStructuredAgentSnapshot, assertStructuredCapability, } from "
|
|
1
|
+
import { WORKSPACE_CONTRACT_VERSION, assertRecoveryAuthority, assertStructuredAgentSnapshot, assertStructuredCapability, } from "../../contracts/workspace/index.js";
|
|
2
2
|
import { StructuredEventReducer } from "./state.js";
|
|
3
3
|
export class StructuredReconnectionManager {
|
|
4
4
|
#capability;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type StructuredAgentSnapshot, type StructuredCapabilityContract, type WorkspaceEvent } from "
|
|
1
|
+
import { type StructuredAgentSnapshot, type StructuredCapabilityContract, type WorkspaceEvent } from "../../contracts/workspace/index.js";
|
|
2
2
|
export type StructuredAgentEvent = Extract<WorkspaceEvent, {
|
|
3
3
|
readonly type: "structured-event";
|
|
4
4
|
}>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { assertStructuredAgentSnapshot, assertStructuredCapability, assertWorkspaceEvent, } from "
|
|
1
|
+
import { assertStructuredAgentSnapshot, assertStructuredCapability, assertWorkspaceEvent, } from "../../contracts/workspace/index.js";
|
|
2
2
|
export class StructuredEventReducer {
|
|
3
3
|
agentId;
|
|
4
4
|
#capability;
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
2
|
import { appendFileSync, mkdirSync } from "node:fs";
|
|
3
3
|
import { resolve } from "node:path";
|
|
4
|
-
import { assertImmutableExecutionRoot, readCertifiedReleaseManifest } from "../release/index.js";
|
|
4
|
+
import { assertImmutableExecutionRoot, CohortStateStore, readCertifiedReleaseManifest } from "../release/index.js";
|
|
5
5
|
import { ControlStore } from "../storage/index.js";
|
|
6
|
-
import { resolveProductPaths } from "./paths.js";
|
|
6
|
+
import { resolveCohortEndpoint, resolveProductPaths } from "./paths.js";
|
|
7
7
|
import { SupervisorServer } from "./server.js";
|
|
8
8
|
import { PRODUCT_IDENTITY, PRODUCT_TEXT } from "../../product-identity.js";
|
|
9
9
|
export async function runSupervisor() {
|
|
10
|
-
const
|
|
11
|
-
mkdirSync(
|
|
10
|
+
const productPaths = resolveProductPaths();
|
|
11
|
+
mkdirSync(productPaths.runtimeDir, { recursive: true, mode: 0o700 });
|
|
12
|
+
mkdirSync(productPaths.endpointsDir, { recursive: true, mode: 0o700 });
|
|
13
|
+
let paths = productPaths;
|
|
12
14
|
const log = (message) => appendFileSync(paths.supervisorLogPath, `${new Date().toISOString()} ${message}\n`);
|
|
13
15
|
const releaseRoot = process.env[PRODUCT_IDENTITY.environment.releaseRoot];
|
|
14
16
|
const releaseId = process.env[PRODUCT_IDENTITY.environment.releaseId];
|
|
@@ -17,9 +19,13 @@ export async function runSupervisor() {
|
|
|
17
19
|
throw new Error(PRODUCT_TEXT.diagnostic("supervisor must be launched from a verified immutable release"));
|
|
18
20
|
const release = await readCertifiedReleaseManifest({ releaseRoot, releaseId, contentDigest }, resolve(paths.dataDir, "releases"));
|
|
19
21
|
await assertImmutableExecutionRoot(release, paths.dataDir);
|
|
22
|
+
// One endpoint per cohort: a superseded cohort keeps serving what it already has while the
|
|
23
|
+
// installed release listens on its own address.
|
|
24
|
+
paths = { ...productPaths, ...resolveCohortEndpoint(productPaths, release.releaseId) };
|
|
20
25
|
const bootNonce = randomUUID();
|
|
21
26
|
const store = new ControlStore(paths.databasePath, bootNonce);
|
|
22
|
-
const
|
|
27
|
+
const cohortState = new CohortStateStore(paths.dataDir);
|
|
28
|
+
const server = new SupervisorServer(store, paths, release, bootNonce, undefined, undefined, undefined, async () => (await cohortState.read()).references.active);
|
|
23
29
|
await server.listen();
|
|
24
30
|
log(`supervisor ${server.id} listening at ${paths.endpoint} (pid ${process.pid})`);
|
|
25
31
|
let closing = false;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { resolveCohortEndpoint, resolveProductPaths, type CohortEndpointPaths, type ProductPaths, } from "../lifecycle/index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { resolveCohortEndpoint, resolveProductPaths, } from "../lifecycle/index.js";
|
|
@@ -9,14 +9,31 @@ export declare class SupervisorServer {
|
|
|
9
9
|
readonly terminateProcess: (code: number) => void;
|
|
10
10
|
readonly reconciliationDeadlineMs: number;
|
|
11
11
|
readonly shutdownDeadlineMs: number;
|
|
12
|
+
/**
|
|
13
|
+
* Which release new sessions start on. A cohort that is no longer that release keeps
|
|
14
|
+
* serving the instances it already has, takes no new ones, and exits when its last one
|
|
15
|
+
* leaves. Absent, this supervisor never considers itself superseded.
|
|
16
|
+
*/
|
|
17
|
+
readonly readActiveReleaseId: (() => Promise<string | null>) | null;
|
|
18
|
+
readonly supersededPollMs: number;
|
|
12
19
|
readonly id: `${string}-${string}-${string}-${string}-${string}`;
|
|
13
20
|
readonly bootNonce: string;
|
|
14
21
|
readonly pidStartIdentity: string;
|
|
15
22
|
readonly startedAt: string;
|
|
16
23
|
readonly paths: ProductPaths;
|
|
17
|
-
constructor(store: ControlStore, paths: ProductPaths | undefined, release: MaterializedRelease, bootNonce?: string, terminateProcess?: (code: number) => void, reconciliationDeadlineMs?: number, shutdownDeadlineMs?: number
|
|
24
|
+
constructor(store: ControlStore, paths: ProductPaths | undefined, release: MaterializedRelease, bootNonce?: string, terminateProcess?: (code: number) => void, reconciliationDeadlineMs?: number, shutdownDeadlineMs?: number,
|
|
25
|
+
/**
|
|
26
|
+
* Which release new sessions start on. A cohort that is no longer that release keeps
|
|
27
|
+
* serving the instances it already has, takes no new ones, and exits when its last one
|
|
28
|
+
* leaves. Absent, this supervisor never considers itself superseded.
|
|
29
|
+
*/
|
|
30
|
+
readActiveReleaseId?: (() => Promise<string | null>) | null, supersededPollMs?: number);
|
|
18
31
|
snapshot(): SupervisorSnapshot;
|
|
19
32
|
listen(): Promise<void>;
|
|
33
|
+
/** Whether new sessions start on some other release. */
|
|
34
|
+
get superseded(): boolean;
|
|
35
|
+
/** Leaves, taking this cohort's own endpoint artifacts with it. */
|
|
36
|
+
retire(): Promise<void>;
|
|
20
37
|
close(stopAgents?: boolean): Promise<void>;
|
|
21
38
|
closeForReleaseReplacement(stopAgents: boolean): Promise<void>;
|
|
22
39
|
}
|