@timurproko/a1 0.2.7-dev.1249 → 0.2.7-dev.1255
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -36
- package/bin/cli.js +2 -17
- package/bin/ui.js +10 -51
- package/dist/app/session-shell/clipboard-diagnostics.d.ts +2 -2
- package/dist/app/session-shell/clipboard-image.d.ts +0 -1
- package/dist/app/session-shell/clipboard-image.js +1 -1
- package/dist/app/session-shell/dialog-coordinator.d.ts +6 -5
- package/dist/app/session-shell/dialog-coordinator.js +3 -4
- package/dist/app/session-shell/dock-chrome.d.ts +11 -6
- package/dist/app/session-shell/dock-chrome.js +5 -8
- package/dist/app/session-shell/editor-hyperlink-budget.d.ts +0 -2
- package/dist/app/session-shell/editor-hyperlink-budget.js +1 -1
- package/dist/app/session-shell/exit-notice.d.ts +3 -3
- package/dist/app/session-shell/exit-notice.js +10 -10
- package/dist/app/session-shell/extension-surface.d.ts +8 -7
- package/dist/app/session-shell/helper-pool.d.ts +3 -4
- package/dist/app/session-shell/helper-pool.js +1 -1
- package/dist/app/session-shell/image-preparation-client.d.ts +4 -3
- package/dist/app/session-shell/image-preparation.d.ts +0 -2
- package/dist/app/session-shell/image-preparation.js +2 -2
- package/dist/app/session-shell/image-source.d.ts +2 -3
- package/dist/app/session-shell/image-source.js +2 -2
- package/dist/app/session-shell/input-surface-switch.d.ts +9 -7
- package/dist/app/session-shell/input-surface-switch.js +1 -2
- package/dist/app/session-shell/login-interaction.d.ts +5 -4
- package/dist/app/session-shell/login-interaction.js +2 -3
- package/dist/app/session-shell/paste-executor.d.ts +4 -8
- package/dist/app/session-shell/paste-executor.js +2 -2
- package/dist/app/session-shell/paste-protocol.d.ts +2 -2
- package/dist/app/session-shell/path-chip-presentation.d.ts +0 -5
- package/dist/app/session-shell/path-chip-presentation.js +3 -3
- package/dist/app/session-shell/prompt-chips.d.ts +8 -7
- package/dist/app/session-shell/prompt-history-controller.d.ts +3 -3
- package/dist/app/session-shell/prompt-submission.d.ts +7 -6
- package/dist/app/session-shell/prompt-submission.js +7 -28
- package/dist/app/session-shell/quit-outro-effects.d.ts +3 -3
- package/dist/app/session-shell/quit-outro-effects.js +1 -4
- package/dist/app/session-shell/quit-outro.d.ts +9 -12
- package/dist/app/session-shell/quit-outro.js +11 -11
- package/dist/app/session-shell/response-copy-protocol.d.ts +3 -2
- package/dist/app/session-shell/response-copy-transport.d.ts +2 -14
- package/dist/app/session-shell/response-copy-transport.js +2 -3
- package/dist/app/session-shell/session-lifecycle.d.ts +3 -3
- package/dist/app/session-shell/session-lifecycle.js +2 -4
- package/dist/app/session-shell/session-shell-root.d.ts +74 -120
- package/dist/app/session-shell/session-shell-root.js +82 -115
- package/dist/app/session-shell/session-shell.d.ts +13 -16
- package/dist/app/session-shell/session-shell.js +149 -314
- package/dist/app/session-shell/session-viewport-controller.d.ts +7 -6
- package/dist/app/session-shell/session-viewport-controller.js +5 -8
- package/dist/app/session-shell/settings-bindings.d.ts +24 -2
- package/dist/app/session-shell/settings-bindings.js +24 -0
- package/dist/app/session-shell/share-operation.d.ts +3 -3
- package/dist/app/session-shell/share-operation.js +4 -6
- package/dist/app/session-shell/shell-clipboard.d.ts +59 -0
- package/dist/app/session-shell/shell-clipboard.js +119 -0
- package/dist/app/session-shell/shell-editor-factory.d.ts +8 -4
- package/dist/app/session-shell/shell-editor-factory.js +13 -15
- package/dist/app/session-shell/shell-host.d.ts +16 -17
- package/dist/app/session-shell/shell-host.js +20 -37
- package/dist/app/session-shell/shell-layout.d.ts +2 -2
- package/dist/app/session-shell/shell-prompt-suggestions.d.ts +26 -0
- package/dist/app/session-shell/shell-prompt-suggestions.js +48 -0
- package/dist/app/session-shell/suggestion-surface.d.ts +1 -6
- package/dist/app/session-shell/suggestion-surface.js +1 -1
- package/dist/app/session-shell/system-clipboard.d.ts +2 -14
- package/dist/app/session-shell/system-clipboard.js +2 -7
- package/dist/app/session-shell/transcript-document.d.ts +12 -10
- package/dist/app/session-shell/transcript-document.js +15 -41
- package/dist/app/session-shell/viewport-layout.d.ts +2 -2
- package/dist/app/session-shell/workflow-output.d.ts +5 -3
- package/dist/app/session-shell/workflow-output.js +13 -15
- package/dist/app/session-shell/workflow-router.d.ts +1 -3
- package/dist/app/session-shell/workflow-router.js +1 -4
- package/dist/cli/dispatch.d.ts +1 -11
- package/dist/cli/dispatch.js +5 -92
- package/dist/cli/package-messages.d.ts +0 -1
- package/dist/cli/package-messages.js +1 -1
- package/dist/cli/session-context.d.ts +1 -1
- package/dist/cli/session-context.js +5 -7
- package/dist/cli/uninstall.d.ts +4 -7
- package/dist/cli/uninstall.js +6 -35
- package/dist/cli/version-stats.js +4 -7
- package/dist/composition/owned-settings.d.ts +2 -2
- package/dist/composition/owned-settings.js +0 -4
- package/dist/composition/owned-ui.d.ts +3 -25
- package/dist/composition/owned-ui.js +37 -113
- package/dist/composition/reference-selection-options.d.ts +1 -1
- package/dist/composition/reference-selection-options.js +1 -1
- package/dist/composition/release-update-observation.d.ts +4 -4
- package/dist/composition/release-update-observation.js +17 -47
- package/dist/composition/session-backend.d.ts +0 -1
- package/dist/composition/session-runtime-registry.d.ts +5 -4
- package/dist/composition/settings-route-host.d.ts +0 -7
- package/dist/composition/settings-route-host.js +7 -20
- package/dist/composition/settings-search-input.d.ts +2 -1
- package/dist/composition/startup-route.d.ts +2 -3
- package/dist/composition/startup-route.js +2 -3
- package/dist/contracts/owned-ui/extension-ui.d.ts +2 -1
- package/dist/contracts/owned-ui/index.d.ts +2 -1
- package/dist/contracts/owned-ui/model.d.ts +0 -3
- package/dist/contracts/owned-ui/session-presenters.d.ts +3 -0
- package/dist/contracts/owned-ui/session-workflows.d.ts +1 -4
- package/dist/contracts/owned-ui/shell-components.d.ts +543 -0
- package/dist/contracts/presentation/component.d.ts +17 -0
- package/dist/contracts/presentation/component.js +8 -0
- package/dist/contracts/presentation/index.d.ts +6 -15
- package/dist/contracts/presentation/index.js +2 -0
- package/dist/contracts/presentation/terminal.d.ts +290 -0
- package/dist/contracts/presentation/theme.d.ts +46 -0
- package/dist/features/launch/development-launch.js +1 -2
- package/dist/features/launch/index.d.ts +1 -1
- package/dist/features/launch/intent.d.ts +1 -3
- package/dist/features/launch/intent.js +2 -4
- package/dist/features/launch/runtime-selection.d.ts +2 -2
- package/dist/features/launch/runtime-selection.js +2 -2
- package/dist/features/launch/session-context.d.ts +2 -2
- package/dist/features/owned-ui/project-trust-prompt.d.ts +2 -2
- package/dist/features/owned-ui/project-trust-prompt.js +1 -1
- package/dist/features/owned-ui/reference-screen-app.d.ts +0 -2
- package/dist/features/owned-ui/reference-screen-app.js +2 -9
- package/dist/features/owned-ui/release-note-state.d.ts +2 -1
- package/dist/features/owned-ui/settings-app.d.ts +0 -6
- package/dist/features/owned-ui/settings-app.js +42 -254
- package/dist/features/owned-ui/settings-edits.d.ts +31 -0
- package/dist/features/owned-ui/settings-edits.js +139 -0
- package/dist/features/owned-ui/settings-scroll-rail.d.ts +29 -0
- package/dist/features/owned-ui/settings-scroll-rail.js +79 -0
- package/dist/features/owned-ui/settings-search-input.d.ts +2 -1
- package/dist/features/prompt-history/service.d.ts +3 -2
- package/dist/foundation/launch-context/index.d.ts +0 -12
- package/dist/foundation/launch-context/index.js +0 -26
- package/dist/foundation/lifecycle/claim-gate.d.ts +9 -0
- package/dist/foundation/lifecycle/claim-gate.js +37 -0
- package/dist/foundation/lifecycle/index.d.ts +5 -9
- package/dist/foundation/lifecycle/index.js +3 -4
- package/dist/foundation/lifecycle/model.d.ts +2 -59
- package/dist/foundation/lifecycle/model.js +0 -35
- package/dist/foundation/lifecycle/paths.d.ts +0 -24
- package/dist/foundation/lifecycle/paths.js +0 -40
- package/dist/foundation/lifecycle/process-liveness.d.ts +8 -0
- package/dist/foundation/lifecycle/process-liveness.js +18 -0
- package/dist/foundation/lifecycle/session-claim-lock.d.ts +1 -1
- package/dist/foundation/lifecycle/session-claim-lock.js +2 -2
- package/dist/foundation/lifecycle/session-repository-context.d.ts +6 -6
- package/dist/foundation/lifecycle/session-repository-context.js +2 -3
- package/dist/foundation/release/automatic-update.d.ts +6 -17
- package/dist/foundation/release/automatic-update.js +23 -44
- package/dist/foundation/release/bootstrap.d.ts +2 -25
- package/dist/foundation/release/bootstrap.js +37 -348
- package/dist/foundation/release/dependency-certification.d.ts +1 -2
- package/dist/foundation/release/dependency-certification.js +1 -1
- package/dist/foundation/release/early-accent.d.ts +2 -2
- package/dist/foundation/release/early-accent.js +1 -1
- package/dist/foundation/release/index.d.ts +10 -17
- package/dist/foundation/release/index.js +7 -11
- package/dist/foundation/release/latest-release.d.ts +3 -19
- package/dist/foundation/release/latest-release.js +11 -12
- package/dist/foundation/release/ordinary-launch-selection.d.ts +1 -1
- package/dist/foundation/release/ordinary-launch-selection.js +1 -1
- package/dist/foundation/release/process-liveness.d.ts +2 -0
- package/dist/foundation/release/process-liveness.js +12 -0
- package/dist/foundation/release/release-gc.d.ts +13 -10
- package/dist/foundation/release/release-gc.js +37 -101
- package/dist/foundation/release/{cohort-state.d.ts → release-state.d.ts} +44 -69
- package/dist/foundation/release/{cohort-state.js → release-state.js} +38 -70
- package/dist/foundation/release/release-store.d.ts +2 -2
- package/dist/foundation/release/release-store.js +2 -2
- package/dist/foundation/release/restart-certification.js +1 -1
- package/dist/foundation/release/update-activation.d.ts +2 -9
- package/dist/foundation/release/update-activation.js +30 -45
- package/dist/foundation/release/update-execution-lease.d.ts +2 -3
- package/dist/foundation/release/update-execution-lease.js +2 -2
- package/dist/foundation/release/update-launch.d.ts +2 -4
- package/dist/foundation/release/update-launch.js +0 -7
- package/dist/foundation/release/update-recovery.js +1 -1
- package/dist/foundation/release/update-transaction.d.ts +1 -1
- package/dist/foundation/release/update-transaction.js +5 -2
- package/dist/foundation/release/update.d.ts +2 -12
- package/dist/foundation/release/update.js +37 -214
- package/dist/foundation/session-writer-lock/index.d.ts +14 -6
- package/dist/foundation/session-writer-lock/index.js +48 -103
- package/dist/foundation/startup/startup-budget.d.ts +5 -5
- package/dist/foundation/startup/startup-budget.js +2 -2
- package/dist/foundation/startup/startup-runtime.d.ts +1 -1
- package/dist/foundation/terminal-cleanup/exit-notice.d.ts +6 -0
- package/dist/foundation/terminal-cleanup/exit-notice.js +36 -0
- package/dist/foundation/terminal-cleanup/index.d.ts +2 -1
- package/dist/foundation/terminal-cleanup/index.js +2 -1
- package/dist/foundation/terminal-cleanup/terminal-reset.d.ts +0 -5
- package/dist/foundation/terminal-cleanup/terminal-reset.js +0 -5
- package/dist/integrations/pi/components/editor-interaction.d.ts +4 -12
- package/dist/integrations/pi/components/index.d.ts +15 -9
- package/dist/integrations/pi/components/index.js +9 -5
- package/dist/integrations/pi/components/lazy-selectors.d.ts +2 -10
- package/dist/integrations/pi/components/lazy-selectors.js +1 -1
- package/dist/integrations/pi/components/modal-frame.d.ts +5 -22
- package/dist/integrations/pi/components/modal-frame.js +3 -23
- package/dist/integrations/pi/components/owned-editor-ux.d.ts +4 -3
- package/dist/integrations/pi/components/prompt-input-port.d.ts +2 -19
- package/dist/integrations/pi/components/resources/builtin-themes.d.ts +2 -1
- package/dist/integrations/pi/components/shell-editor-autocomplete.d.ts +3 -2
- package/dist/integrations/pi/components/shell-editor-autocomplete.js +1 -4
- package/dist/integrations/pi/components/shell-footer-status.d.ts +3 -3
- package/dist/integrations/pi/components/shell-footer-status.js +5 -4
- package/dist/integrations/pi/components/shell-hotkey-sections.js +1 -1
- package/dist/integrations/pi/components/shell-presenters-info.d.ts +6 -8
- package/dist/integrations/pi/components/shell-presenters-info.js +6 -19
- package/dist/integrations/pi/components/shell-presenters-transcript.d.ts +1 -1
- package/dist/integrations/pi/components/shell-presenters-transcript.js +1 -1
- package/dist/integrations/pi/components/shell-session-info-reference.d.ts +2 -1
- package/dist/integrations/pi/components/shell-shared-facade.d.ts +33 -229
- package/dist/integrations/pi/components/shell-shared-facade.js +8 -1
- package/dist/integrations/pi/components/skills-command.d.ts +1 -9
- package/dist/integrations/pi/components/skills-command.js +5 -5
- package/dist/integrations/pi/components/submitted-prompt-adapter.d.ts +2 -5
- package/dist/integrations/pi/components/submitted-prompt-adapter.js +2 -16
- package/dist/integrations/pi/components/theme.d.ts +9 -2
- package/dist/integrations/pi/components/theme.js +17 -2
- package/dist/integrations/pi/components/thinking-selector-dialog.d.ts +2 -1
- package/dist/integrations/pi/components/upstream/adjacent/core/keybindings.d.ts +2 -2
- package/dist/integrations/pi/components/upstream/components/session-footer.d.ts +1 -2
- package/dist/integrations/pi/components/upstream/components/session-footer.js +6 -8
- package/dist/integrations/pi/engine/adapter.d.ts +3 -6
- package/dist/integrations/pi/engine/adapter.js +4 -28
- package/dist/integrations/pi/engine/changelog.d.ts +2 -2
- package/dist/integrations/pi/engine/changelog.js +3 -3
- package/dist/integrations/pi/engine/compaction-progress.d.ts +2 -3
- package/dist/integrations/pi/engine/compaction-progress.js +1 -1
- package/dist/integrations/pi/engine/conformance.d.ts +2 -1
- package/dist/integrations/pi/engine/default-model-setting.d.ts +0 -2
- package/dist/integrations/pi/engine/default-model-setting.js +1 -2
- package/dist/integrations/pi/engine/diagnostics-state.d.ts +0 -1
- package/dist/integrations/pi/engine/diagnostics-state.js +0 -14
- package/dist/integrations/pi/engine/event-delivery.d.ts +2 -1
- package/dist/integrations/pi/engine/extension-ui-binding.d.ts +2 -1
- package/dist/integrations/pi/engine/host.js +2 -2
- package/dist/integrations/pi/engine/message-values.d.ts +0 -1
- package/dist/integrations/pi/engine/message-values.js +1 -1
- package/dist/integrations/pi/engine/pending-delivery.d.ts +0 -4
- package/dist/integrations/pi/engine/pending-delivery.js +3 -3
- package/dist/integrations/pi/engine/ports.d.ts +7 -1
- package/dist/integrations/pi/engine/ports.js +4 -0
- package/dist/integrations/pi/engine/project-trust-preflight.d.ts +2 -1
- package/dist/integrations/pi/engine/prompt-suggestions.d.ts +3 -3
- package/dist/integrations/pi/engine/prompt-suggestions.js +0 -40
- package/dist/integrations/pi/engine/provider-authentication.d.ts +1 -1
- package/dist/integrations/pi/engine/public-main-entry.d.ts +1 -5
- package/dist/integrations/pi/engine/public-main-entry.js +1 -1
- package/dist/integrations/pi/engine/repository-pr-rest.d.ts +1 -9
- package/dist/integrations/pi/engine/repository-pr-rest.js +2 -2
- package/dist/integrations/pi/engine/repository-pr.d.ts +1 -3
- package/dist/integrations/pi/engine/repository-pr.js +1 -1
- package/dist/integrations/pi/engine/resource-catalog.d.ts +2 -1
- package/dist/integrations/pi/engine/session-integration.d.ts +1 -1
- package/dist/integrations/pi/engine/session-runtime.d.ts +4 -3
- package/dist/integrations/pi/engine/session-runtime.js +0 -2
- package/dist/integrations/pi/engine/settings-bridge.d.ts +0 -2
- package/dist/integrations/pi/engine/settings-bridge.js +1 -1
- package/dist/integrations/pi/engine/settings-port.d.ts +3 -2
- package/dist/integrations/pi/engine/transcript-projection.d.ts +2 -1
- package/dist/integrations/pi/engine/workflow-contexts.d.ts +1 -1
- package/dist/integrations/pi/engine/workflow-runner.d.ts +1 -1
- package/dist/integrations/pi/engine/workflow-runner.js +1 -1
- package/dist/integrations/pi/engine/workflow-support.d.ts +0 -6
- package/dist/integrations/pi/engine/workflow-support.js +4 -18
- package/dist/integrations/pi/engine/workflows.d.ts +5 -5
- package/dist/integrations/pi/session-presenters/components.d.ts +3 -0
- package/dist/integrations/pi/session-presenters/components.js +75 -0
- package/dist/integrations/pi/session-presenters/index.d.ts +1 -0
- package/dist/integrations/pi/session-presenters/index.js +1 -0
- package/dist/integrations/pi/session-presenters/presentation.d.ts +3 -0
- package/dist/integrations/pi/session-presenters/presentation.js +10 -0
- package/dist/integrations/pi/session-presenters/presenters.d.ts +2 -1
- package/dist/integrations/pi/session-presenters/presenters.js +3 -1
- package/dist/integrations/pi/tui-runtime/adapter.d.ts +2 -2
- package/dist/integrations/pi/tui-runtime/adapter.js +23 -32
- package/dist/integrations/pi/tui-runtime/contracts.d.ts +22 -166
- package/dist/integrations/pi/tui-runtime/damage-aware-terminal.d.ts +5 -40
- package/dist/integrations/pi/tui-runtime/index.d.ts +1 -0
- package/dist/integrations/pi/tui-runtime/index.js +1 -0
- package/dist/integrations/pi/tui-runtime/input-presentation-coordinator.d.ts +4 -6
- package/dist/integrations/pi/tui-runtime/overlay-geometry.d.ts +2 -8
- package/dist/integrations/pi/tui-runtime/overlay-geometry.js +3 -9
- package/dist/integrations/pi/tui-runtime/runtime-factory.d.ts +3 -0
- package/dist/integrations/pi/tui-runtime/runtime-factory.js +11 -0
- package/dist/product-identity.d.ts +4 -6
- package/dist/product-identity.js +6 -11
- package/dist/product-identity.json +1 -40
- package/dist/runtime-payload-inventory.json +0 -3
- package/dist/ui/components/index.d.ts +4 -4
- package/dist/ui/components/index.js +2 -2
- package/dist/ui/components/selection-copy.d.ts +0 -1
- package/dist/ui/components/selection-copy.js +0 -12
- package/dist/ui/components/submitted-prompt.d.ts +3 -13
- package/dist/ui/components/submitted-prompt.js +8 -41
- package/dist/ui/components/theme.d.ts +4 -19
- package/dist/ui/components/theme.js +6 -0
- package/dist/ui/components/transcript-viewport.d.ts +1 -3
- package/dist/ui/components/transcript-viewport.js +1 -4
- package/dist/ui/settings/declarations.d.ts +2 -97
- package/dist/ui/settings/declarations.js +2 -78
- package/dist/ui/settings/early-accent.js +1 -1
- package/dist/ui/settings/index.d.ts +3 -5
- package/dist/ui/settings/index.js +2 -3
- package/dist/ui/settings/manager.d.ts +0 -4
- package/dist/ui/settings/manager.js +6 -62
- package/dist/ui/settings/resolution.d.ts +6 -18
- package/dist/ui/settings/resolution.js +4 -103
- package/dist/ui/settings/sections.d.ts +0 -4
- package/dist/ui/settings/sections.js +1 -1
- package/docs/architecture/boundaries.md +23 -40
- package/docs/architecture/code-documentation.md +2 -2
- package/docs/architecture/internal-naming.md +11 -17
- package/docs/architecture/project-structure.md +13 -16
- package/docs/architecture/resource-and-data-policy.md +16 -31
- package/docs/architecture/toolchain.md +14 -19
- package/docs/architecture/ui-reference-provenance.md +2 -2
- package/docs/ci-release-runbook.md +5 -5
- package/docs/features/launch-profiles.md +11 -17
- package/docs/features/prompt-history.md +10 -11
- package/docs/local-worktree-cleanup.md +28 -1
- package/docs/manual-owned-ui-checkpoint.md +0 -1
- package/docs/validation.md +5 -11
- package/docs/worktree-link-recovery.md +6 -6
- package/package.json +7 -20
- package/bin/guardian.js +0 -42
- package/bin/supervisor.js +0 -7
- package/bin/tab-launch-context.d.ts +0 -27
- package/bin/tab-launch-context.js +0 -94
- package/dist/app/session-shell/resident-tab-coordinator.d.ts +0 -38
- package/dist/app/session-shell/resident-tab-coordinator.js +0 -77
- package/dist/cli/tabs-request.d.ts +0 -7
- package/dist/cli/tabs.d.ts +0 -14
- package/dist/cli/tabs.js +0 -151
- package/dist/composition/resident-tab-bridge.d.ts +0 -41
- package/dist/composition/resident-tab-bridge.js +0 -209
- package/dist/composition/utility-tab.d.ts +0 -28
- package/dist/composition/utility-tab.js +0 -244
- package/dist/features/owned-ui/plus-menu-dialog.d.ts +0 -28
- package/dist/features/owned-ui/plus-menu-dialog.js +0 -89
- package/dist/features/resident-tab/auto-name.d.ts +0 -11
- package/dist/features/resident-tab/auto-name.js +0 -44
- package/dist/features/resident-tab/index.d.ts +0 -5
- package/dist/features/resident-tab/index.js +0 -7
- package/dist/features/resident-tab/shortcut-bindings-file.d.ts +0 -8
- package/dist/features/resident-tab/shortcut-bindings-file.js +0 -40
- package/dist/features/resident-tab/shortcut-declarations.d.ts +0 -13
- package/dist/features/resident-tab/shortcut-declarations.js +0 -26
- package/dist/features/resident-tab/shortcut-projection.d.ts +0 -29
- package/dist/features/resident-tab/shortcut-projection.js +0 -64
- package/dist/features/resident-tab/status-deriver.d.ts +0 -10
- package/dist/features/resident-tab/status-deriver.js +0 -12
- package/dist/foundation/launch-guardian/exit-watcher.d.ts +0 -14
- package/dist/foundation/launch-guardian/exit-watcher.js +0 -103
- package/dist/foundation/launch-guardian/index.d.ts +0 -2
- package/dist/foundation/launch-guardian/index.js +0 -1
- package/dist/foundation/launch-guardian/main.d.ts +0 -39
- package/dist/foundation/launch-guardian/main.js +0 -232
- package/dist/foundation/lifecycle/commands.d.ts +0 -40
- package/dist/foundation/lifecycle/launch-instance.d.ts +0 -46
- package/dist/foundation/lifecycle/launch-instance.js +0 -134
- package/dist/foundation/lifecycle/native-claim-gate.d.ts +0 -5
- package/dist/foundation/lifecycle/native-claim-gate.js +0 -41
- package/dist/foundation/lifecycle/supervisor-startup.d.ts +0 -30
- package/dist/foundation/lifecycle/supervisor-startup.js +0 -106
- package/dist/foundation/process-containment/addon-containment.d.ts +0 -20
- package/dist/foundation/process-containment/addon-containment.js +0 -139
- package/dist/foundation/process-containment/addon-process-inspector.d.ts +0 -11
- package/dist/foundation/process-containment/addon-process-inspector.js +0 -36
- package/dist/foundation/process-containment/addon.d.ts +0 -47
- package/dist/foundation/process-containment/addon.js +0 -57
- package/dist/foundation/process-containment/artifact.d.ts +0 -1
- package/dist/foundation/process-containment/artifact.js +0 -35
- package/dist/foundation/process-containment/contracts.d.ts +0 -33
- package/dist/foundation/process-containment/contracts.js +0 -35
- package/dist/foundation/process-containment/index.d.ts +0 -9
- package/dist/foundation/process-containment/index.js +0 -7
- package/dist/foundation/process-containment/linux-process-inspector.d.ts +0 -7
- package/dist/foundation/process-containment/linux-process-inspector.js +0 -27
- package/dist/foundation/process-containment/native-process-inspector.d.ts +0 -4
- package/dist/foundation/process-containment/native-process-inspector.js +0 -21
- package/dist/foundation/protocol/client.d.ts +0 -18
- package/dist/foundation/protocol/client.js +0 -130
- package/dist/foundation/protocol/index.d.ts +0 -3
- package/dist/foundation/protocol/index.js +0 -2
- package/dist/foundation/protocol/messages.d.ts +0 -90
- package/dist/foundation/protocol/messages.js +0 -100
- package/dist/foundation/release/cohort-selection.d.ts +0 -33
- package/dist/foundation/release/cohort-selection.js +0 -67
- package/dist/foundation/release/endpoint-lock.d.ts +0 -2
- package/dist/foundation/release/endpoint-lock.js +0 -37
- package/dist/foundation/release/endpoint-recovery.d.ts +0 -10
- package/dist/foundation/release/endpoint-recovery.js +0 -45
- package/dist/foundation/release/endpoints.d.ts +0 -32
- package/dist/foundation/release/endpoints.js +0 -152
- package/dist/foundation/release/prepared-update-activation.d.ts +0 -3
- package/dist/foundation/release/prepared-update-activation.js +0 -27
- package/dist/foundation/release/process-cleanup.d.ts +0 -14
- package/dist/foundation/release/process-cleanup.js +0 -76
- package/dist/foundation/release/supervisor-identity.d.ts +0 -15
- package/dist/foundation/release/supervisor-identity.js +0 -63
- package/dist/foundation/resident-tabs/boot-identity.d.ts +0 -6
- package/dist/foundation/resident-tabs/boot-identity.js +0 -16
- package/dist/foundation/resident-tabs/bounded-host-command.d.ts +0 -20
- package/dist/foundation/resident-tabs/bounded-host-command.js +0 -62
- package/dist/foundation/resident-tabs/bridge-client.d.ts +0 -73
- package/dist/foundation/resident-tabs/bridge-client.js +0 -327
- package/dist/foundation/resident-tabs/continuity.d.ts +0 -12
- package/dist/foundation/resident-tabs/continuity.js +0 -63
- package/dist/foundation/resident-tabs/doctor.d.ts +0 -28
- package/dist/foundation/resident-tabs/doctor.js +0 -166
- package/dist/foundation/resident-tabs/draft-checkpoint.d.ts +0 -27
- package/dist/foundation/resident-tabs/draft-checkpoint.js +0 -145
- package/dist/foundation/resident-tabs/ensure-terminal-host.d.ts +0 -36
- package/dist/foundation/resident-tabs/ensure-terminal-host.js +0 -151
- package/dist/foundation/resident-tabs/fault-injection.d.ts +0 -8
- package/dist/foundation/resident-tabs/fault-injection.js +0 -26
- package/dist/foundation/resident-tabs/fixture-control.d.ts +0 -7
- package/dist/foundation/resident-tabs/fixture-control.js +0 -35
- package/dist/foundation/resident-tabs/host-entry.js +0 -17
- package/dist/foundation/resident-tabs/index.d.ts +0 -15
- package/dist/foundation/resident-tabs/index.js +0 -10
- package/dist/foundation/resident-tabs/maintenance.d.ts +0 -39
- package/dist/foundation/resident-tabs/maintenance.js +0 -75
- package/dist/foundation/resident-tabs/progress-observation-schema.d.ts +0 -34
- package/dist/foundation/resident-tabs/progress-observation-schema.js +0 -1
- package/dist/foundation/resident-tabs/progress-observation.d.ts +0 -4
- package/dist/foundation/resident-tabs/progress-observation.js +0 -150
- package/dist/foundation/resident-tabs/prompt-journal.d.ts +0 -63
- package/dist/foundation/resident-tabs/prompt-journal.js +0 -213
- package/dist/foundation/resident-tabs/protocol.d.ts +0 -12
- package/dist/foundation/resident-tabs/protocol.js +0 -195
- package/dist/foundation/resident-tabs/recovery.d.ts +0 -26
- package/dist/foundation/resident-tabs/recovery.js +0 -205
- package/dist/foundation/resident-tabs/release-holds.d.ts +0 -28
- package/dist/foundation/resident-tabs/release-holds.js +0 -78
- package/dist/foundation/resident-tabs/routes.d.ts +0 -5
- package/dist/foundation/resident-tabs/routes.js +0 -5
- package/dist/foundation/resident-tabs/routing.d.ts +0 -11
- package/dist/foundation/resident-tabs/routing.js +0 -10
- package/dist/foundation/resident-tabs/runtime-control.d.ts +0 -38
- package/dist/foundation/resident-tabs/runtime-control.js +0 -74
- package/dist/foundation/resident-tabs/session-sync.d.ts +0 -14
- package/dist/foundation/resident-tabs/session-sync.js +0 -37
- package/dist/foundation/resident-tabs/settings.d.ts +0 -16
- package/dist/foundation/resident-tabs/settings.js +0 -60
- package/dist/foundation/resident-tabs/terminal-host-artifact.d.ts +0 -14
- package/dist/foundation/resident-tabs/terminal-host-artifact.js +0 -78
- package/dist/foundation/resident-tabs/zip-archive.d.ts +0 -9
- package/dist/foundation/resident-tabs/zip-archive.js +0 -56
- package/dist/foundation/storage/control-store.d.ts +0 -20
- package/dist/foundation/storage/control-store.js +0 -331
- package/dist/foundation/storage/index.d.ts +0 -1
- package/dist/foundation/storage/index.js +0 -1
- package/dist/foundation/supervision/index.d.ts +0 -3
- package/dist/foundation/supervision/index.js +0 -3
- package/dist/foundation/supervision/main.d.ts +0 -1
- package/dist/foundation/supervision/main.js +0 -86
- package/dist/foundation/supervision/paths.d.ts +0 -1
- package/dist/foundation/supervision/paths.js +0 -1
- package/dist/foundation/supervision/server.d.ts +0 -46
- package/dist/foundation/supervision/server.js +0 -611
- package/dist/integrations/pi/components/components.d.ts +0 -4
- package/dist/integrations/pi/components/components.js +0 -48
- package/dist/integrations/pi/components/conformance.d.ts +0 -18
- package/dist/integrations/pi/components/conformance.js +0 -70
- package/dist/integrations/pi/components/shell-components.d.ts +0 -7
- package/dist/integrations/pi/components/shell-components.js +0 -7
- package/dist/integrations/pi/components/upstream/theme/theme-controller.d.ts +0 -33
- package/dist/integrations/pi/components/upstream/theme/theme-controller.js +0 -114
- package/dist/integrations/pi/engine/offline-settings-port.d.ts +0 -23
- package/dist/integrations/pi/engine/offline-settings-port.js +0 -54
- package/dist/native/darwin-arm64/manifest.json +0 -23
- package/dist/native/darwin-arm64/process-guardian.node +0 -0
- package/dist/native/darwin-arm64/terminal-host-THIRD-PARTY-NOTICES.txt +0 -10500
- package/dist/native/darwin-arm64/terminal-host.manifest.json +0 -46
- package/dist/native/darwin-arm64/terminal-host.node +0 -0
- package/dist/native/darwin-x64/manifest.json +0 -23
- package/dist/native/darwin-x64/process-guardian.node +0 -0
- package/dist/native/darwin-x64/terminal-host-THIRD-PARTY-NOTICES.txt +0 -10737
- package/dist/native/darwin-x64/terminal-host.manifest.json +0 -46
- package/dist/native/darwin-x64/terminal-host.node +0 -0
- package/dist/native/linux-x64/manifest.json +0 -23
- package/dist/native/linux-x64/process-guardian.node +0 -0
- package/dist/native/linux-x64/terminal-host-THIRD-PARTY-NOTICES.txt +0 -11226
- package/dist/native/linux-x64/terminal-host.manifest.json +0 -46
- package/dist/native/linux-x64/terminal-host.node +0 -0
- package/dist/native/win32-x64/manifest.json +0 -23
- package/dist/native/win32-x64/process-guardian.node +0 -0
- package/dist/native/win32-x64/terminal-host-THIRD-PARTY-NOTICES.txt +0 -10757
- package/dist/native/win32-x64/terminal-host.manifest.json +0 -46
- package/dist/native/win32-x64/terminal-host.node +0 -0
- package/dist/ui/settings/migrations.d.ts +0 -19
- package/dist/ui/settings/migrations.js +0 -209
- package/dist/ui/settings/progress-palette.generated.d.ts +0 -139
- package/dist/ui/settings/progress-palette.generated.js +0 -139
- package/docs/architecture/evidence/resident-tabs/linux-x64.md +0 -37
- package/docs/architecture/evidence/resident-tabs/macos-arm64.md +0 -36
- package/docs/architecture/evidence/resident-tabs/macos-x64.md +0 -35
- package/docs/architecture/evidence/resident-tabs/windows-x64.md +0 -36
- package/docs/architecture/evidence/terminal-host-spike/manual-one-pane-terminal-host.md +0 -70
- package/docs/architecture/evidence/terminal-host-spike/manual-two-by-two-basic-terminal-host.md +0 -32
- package/docs/architecture/evidence/terminal-host-spike/milestone-baseline.json +0 -115
- package/docs/architecture/evidence/terminal-host-spike/owned-ui-foundation-prerequisite.json +0 -48
- package/docs/architecture/evidence/terminal-host-spike/terminal-host-provenance.json +0 -125
- package/docs/architecture/evidence/terminal-host-spike/terminal-host-task-5-1.json +0 -56
- package/docs/architecture/evidence/terminal-host-spike/terminal-host-task-5-3.json +0 -174
- package/docs/architecture/evidence/terminal-host-spike/terminal-spike-acceptance-record.json +0 -18
- package/docs/architecture/native-fixture-isolation.md +0 -23
- package/docs/architecture/process-guardian-provenance.md +0 -36
- package/docs/architecture/resident-tabs-requirements.md +0 -18
- package/docs/architecture/resident-tabs.md +0 -668
- package/docs/architecture/terminal-host-proof-gate.md +0 -34
- package/docs/architecture/terminal-host-provenance.md +0 -81
- package/docs/architecture/terminal-host-spike-evidence.md +0 -39
- package/docs/launch-recovery.md +0 -23
- package/docs/manual-launch-instance-acceptance.md +0 -43
- package/docs/manual-resident-tabs-acceptance.md +0 -51
- /package/dist/{cli/tabs-request.js → contracts/owned-ui/shell-components.js} +0 -0
- /package/dist/{foundation/release → contracts/presentation}/progress-palette.generated.d.ts +0 -0
- /package/dist/{foundation/release → contracts/presentation}/progress-palette.generated.js +0 -0
- /package/dist/{foundation/lifecycle/commands.js → contracts/presentation/terminal.js} +0 -0
- /package/dist/{foundation/resident-tabs/host-entry.d.ts → contracts/presentation/theme.js} +0 -0
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { createRequire } from "node:module";
|
|
2
|
-
import { resolve } from "node:path";
|
|
3
|
-
const require = createRequire(import.meta.url);
|
|
4
|
-
const cache = new Map();
|
|
5
|
-
/** Loads one verified Node-API guardian instance per exact addon path. */
|
|
6
|
-
export function loadProcessGuardianAddon(path) {
|
|
7
|
-
if (!path || path.includes("\0"))
|
|
8
|
-
throw new TypeError("process guardian addon path is invalid");
|
|
9
|
-
const exactPath = resolve(path);
|
|
10
|
-
const cached = cache.get(exactPath);
|
|
11
|
-
if (cached)
|
|
12
|
-
return cached;
|
|
13
|
-
let value;
|
|
14
|
-
try {
|
|
15
|
-
value = require(exactPath);
|
|
16
|
-
}
|
|
17
|
-
catch (error) {
|
|
18
|
-
const code = errorCode(error) === "MODULE_NOT_FOUND" || errorCode(error) === "ENOENT"
|
|
19
|
-
? "CONTAINMENT_ARTIFACT_MISSING"
|
|
20
|
-
: "CONTAINMENT_ARTIFACT_INCOMPATIBLE";
|
|
21
|
-
throw diagnosticError(`process guardian addon could not be loaded: ${errorMessage(error)}`, code);
|
|
22
|
-
}
|
|
23
|
-
if (!isProcessGuardianAddon(value)) {
|
|
24
|
-
throw diagnosticError("process guardian addon exports are incompatible", "CONTAINMENT_ARTIFACT_INCOMPATIBLE");
|
|
25
|
-
}
|
|
26
|
-
let report;
|
|
27
|
-
try {
|
|
28
|
-
report = value.version();
|
|
29
|
-
}
|
|
30
|
-
catch (error) {
|
|
31
|
-
throw diagnosticError(`process guardian addon identity failed: ${errorMessage(error)}`, "CONTAINMENT_ARTIFACT_INCOMPATIBLE");
|
|
32
|
-
}
|
|
33
|
-
if (report.protocolVersion !== 2 || typeof report.crateVersion !== "string" || report.crateVersion.length === 0 || typeof report.target !== "string") {
|
|
34
|
-
throw diagnosticError("process guardian addon protocol is incompatible", "CONTAINMENT_ARTIFACT_INCOMPATIBLE");
|
|
35
|
-
}
|
|
36
|
-
cache.set(exactPath, value);
|
|
37
|
-
return value;
|
|
38
|
-
}
|
|
39
|
-
function isProcessGuardianAddon(value) {
|
|
40
|
-
if (typeof value !== "object" || value === null)
|
|
41
|
-
return false;
|
|
42
|
-
const candidate = value;
|
|
43
|
-
return [
|
|
44
|
-
"version", "inspectProcessStart", "captureTerminalModes", "restoreTerminalModes",
|
|
45
|
-
"deliverExitNotice", "spawnContained", "spawnWatcher", "waitForProcessExit",
|
|
46
|
-
"stopProcessGroup", "restoreForegroundGroup", "ignoreConsoleControl",
|
|
47
|
-
].every(name => typeof candidate[name] === "function");
|
|
48
|
-
}
|
|
49
|
-
function diagnosticError(message, code) {
|
|
50
|
-
return Object.assign(new Error(message), { code });
|
|
51
|
-
}
|
|
52
|
-
function errorCode(error) {
|
|
53
|
-
return error instanceof Error && "code" in error && typeof error.code === "string" ? error.code : null;
|
|
54
|
-
}
|
|
55
|
-
function errorMessage(error) {
|
|
56
|
-
return error instanceof Error ? error.message : String(error);
|
|
57
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function verifyProcessGuardianArtifact(addonPath: string, platform?: NodeJS.Platform, architecture?: string): Promise<void>;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { createHash } from "node:crypto";
|
|
2
|
-
import { readFile, stat } from "node:fs/promises";
|
|
3
|
-
import { basename, dirname, resolve } from "node:path";
|
|
4
|
-
export async function verifyProcessGuardianArtifact(addonPath, platform = process.platform, architecture = process.arch) {
|
|
5
|
-
const manifestPath = resolve(dirname(addonPath), "manifest.json");
|
|
6
|
-
let manifest;
|
|
7
|
-
try {
|
|
8
|
-
manifest = JSON.parse(await readFile(manifestPath, "utf8"));
|
|
9
|
-
}
|
|
10
|
-
catch (error) {
|
|
11
|
-
throw artifactError(`process guardian manifest is missing or malformed: ${errorMessage(error)}`, "CONTAINMENT_ARTIFACT_MISSING");
|
|
12
|
-
}
|
|
13
|
-
if (manifest.schema !== "a1-process-guardian-artifact-v2" || manifest.kind !== "node-addon"
|
|
14
|
-
|| manifest.nodeApi !== 9 || manifest.protocolVersion !== 2
|
|
15
|
-
|| manifest.platform !== platform || manifest.architecture !== architecture
|
|
16
|
-
|| manifest.artifact?.filename !== basename(addonPath)) {
|
|
17
|
-
throw artifactError("process guardian manifest is incompatible with this platform or protocol", "CONTAINMENT_ARTIFACT_INCOMPATIBLE");
|
|
18
|
-
}
|
|
19
|
-
if (manifest.capability !== "supported") {
|
|
20
|
-
throw artifactError(`process containment is not certified for ${platform}-${architecture}`, "CONTAINMENT_UNSUPPORTED");
|
|
21
|
-
}
|
|
22
|
-
const [bytes, metadata] = await Promise.all([readFile(addonPath), stat(addonPath)]).catch(error => {
|
|
23
|
-
throw artifactError(`process guardian artifact is unavailable: ${errorMessage(error)}`, "CONTAINMENT_ARTIFACT_MISSING");
|
|
24
|
-
});
|
|
25
|
-
const digest = createHash("sha256").update(bytes).digest("hex");
|
|
26
|
-
if (metadata.size !== manifest.artifact.size || digest !== manifest.artifact.sha256) {
|
|
27
|
-
throw artifactError("process guardian artifact integrity verification failed", "CONTAINMENT_ARTIFACT_TAMPERED");
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
function artifactError(message, code) {
|
|
31
|
-
return Object.assign(new Error(message), { code });
|
|
32
|
-
}
|
|
33
|
-
function errorMessage(error) {
|
|
34
|
-
return error instanceof Error ? error.message : String(error);
|
|
35
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { LaunchInstanceOutcome, LaunchInstanceStopReason, NativeProcessIdentity, ProcessContainmentIdentity } from "../lifecycle/index.js";
|
|
2
|
-
export interface ContainedSpawnOptions {
|
|
3
|
-
readonly cwd: string;
|
|
4
|
-
readonly environment: Readonly<Record<string, string>>;
|
|
5
|
-
readonly terminalType?: string;
|
|
6
|
-
}
|
|
7
|
-
export interface ContainedProcessHandle {
|
|
8
|
-
readonly identity: NativeProcessIdentity;
|
|
9
|
-
readonly outcome: Promise<LaunchInstanceOutcome>;
|
|
10
|
-
readonly processGroup?: number;
|
|
11
|
-
readonly foregroundGroup?: number;
|
|
12
|
-
}
|
|
13
|
-
export interface NativeProcessInspector {
|
|
14
|
-
observe(pid: number): Promise<NativeProcessIdentity | null>;
|
|
15
|
-
matches(identity: NativeProcessIdentity): Promise<boolean>;
|
|
16
|
-
}
|
|
17
|
-
export interface ProcessContainment {
|
|
18
|
-
readonly identity: ProcessContainmentIdentity;
|
|
19
|
-
spawn(executable: string, arguments_: readonly string[], options: ContainedSpawnOptions): Promise<ContainedProcessHandle>;
|
|
20
|
-
contains(identity: NativeProcessIdentity): Promise<boolean>;
|
|
21
|
-
stop(force: boolean): Promise<void>;
|
|
22
|
-
waitForEmpty(timeoutMs: number): Promise<boolean>;
|
|
23
|
-
close(): Promise<void>;
|
|
24
|
-
}
|
|
25
|
-
export interface ProcessContainmentFactory {
|
|
26
|
-
create(instanceId: string): Promise<ProcessContainment>;
|
|
27
|
-
}
|
|
28
|
-
export interface ContainmentCloseResult {
|
|
29
|
-
readonly outcome: LaunchInstanceOutcome;
|
|
30
|
-
readonly graceful: boolean;
|
|
31
|
-
readonly forced: boolean;
|
|
32
|
-
}
|
|
33
|
-
export declare function closeVerifiedContainment(containment: ProcessContainment, inspector: NativeProcessInspector, rootIdentity: NativeProcessIdentity, reason: LaunchInstanceStopReason, deadlineMs?: number): Promise<ContainmentCloseResult>;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
export async function closeVerifiedContainment(containment, inspector, rootIdentity, reason, deadlineMs = 1_500) {
|
|
2
|
-
if (!await ownershipMatches(containment, inspector, rootIdentity)) {
|
|
3
|
-
return ownershipMismatch("refusing graceful cleanup because launch-instance ownership changed");
|
|
4
|
-
}
|
|
5
|
-
await containment.stop(false);
|
|
6
|
-
if (await containment.waitForEmpty(deadlineMs)) {
|
|
7
|
-
return { outcome: { kind: "stopped", reason }, graceful: true, forced: false };
|
|
8
|
-
}
|
|
9
|
-
if (!await ownershipMatches(containment, inspector, rootIdentity)) {
|
|
10
|
-
return ownershipMismatch("refusing forced cleanup because launch-instance ownership changed");
|
|
11
|
-
}
|
|
12
|
-
await containment.stop(true);
|
|
13
|
-
if (await containment.waitForEmpty(deadlineMs)) {
|
|
14
|
-
return { outcome: { kind: "stopped", reason }, graceful: false, forced: true };
|
|
15
|
-
}
|
|
16
|
-
return {
|
|
17
|
-
outcome: {
|
|
18
|
-
kind: "cleanup-error",
|
|
19
|
-
message: "launch-instance process tree did not exit within the bounded cleanup deadline",
|
|
20
|
-
code: "CONTAINMENT_CLEANUP_TIMEOUT",
|
|
21
|
-
},
|
|
22
|
-
graceful: false,
|
|
23
|
-
forced: true,
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
async function ownershipMatches(containment, inspector, rootIdentity) {
|
|
27
|
-
return await inspector.matches(rootIdentity) && await containment.contains(rootIdentity);
|
|
28
|
-
}
|
|
29
|
-
function ownershipMismatch(message) {
|
|
30
|
-
return {
|
|
31
|
-
outcome: { kind: "cleanup-error", message, code: "PROCESS_IDENTITY_MISMATCH" },
|
|
32
|
-
graceful: false,
|
|
33
|
-
forced: false,
|
|
34
|
-
};
|
|
35
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export { loadProcessGuardianAddon } from "./addon.js";
|
|
2
|
-
export type { ProcessGuardianAddon, ProcessGuardianRuntime, ProcessGuardianVersion } from "./addon.js";
|
|
3
|
-
export { AddonContainment, resolveProcessGuardianPath } from "./addon-containment.js";
|
|
4
|
-
export { AddonProcessInspector } from "./addon-process-inspector.js";
|
|
5
|
-
export { verifyProcessGuardianArtifact } from "./artifact.js";
|
|
6
|
-
export { closeVerifiedContainment } from "./contracts.js";
|
|
7
|
-
export type { ContainedProcessHandle, ContainedSpawnOptions, ContainmentCloseResult, NativeProcessInspector, ProcessContainment, ProcessContainmentFactory, } from "./contracts.js";
|
|
8
|
-
export { LinuxNativeProcessInspector } from "./linux-process-inspector.js";
|
|
9
|
-
export { createNativeProcessInspector } from "./native-process-inspector.js";
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { loadProcessGuardianAddon } from "./addon.js";
|
|
2
|
-
export { AddonContainment, resolveProcessGuardianPath } from "./addon-containment.js";
|
|
3
|
-
export { AddonProcessInspector } from "./addon-process-inspector.js";
|
|
4
|
-
export { verifyProcessGuardianArtifact } from "./artifact.js";
|
|
5
|
-
export { closeVerifiedContainment } from "./contracts.js";
|
|
6
|
-
export { LinuxNativeProcessInspector } from "./linux-process-inspector.js";
|
|
7
|
-
export { createNativeProcessInspector } from "./native-process-inspector.js";
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { NativeProcessIdentity } from "../lifecycle/index.js";
|
|
2
|
-
import type { NativeProcessInspector } from "./contracts.js";
|
|
3
|
-
/** Verifies Linux process identity from the PID and kernel start-time field in procfs. */
|
|
4
|
-
export declare class LinuxNativeProcessInspector implements NativeProcessInspector {
|
|
5
|
-
observe(pid: number): Promise<NativeProcessIdentity | null>;
|
|
6
|
-
matches(identity: NativeProcessIdentity): Promise<boolean>;
|
|
7
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { readFile } from "node:fs/promises";
|
|
2
|
-
/** Verifies Linux process identity from the PID and kernel start-time field in procfs. */
|
|
3
|
-
export class LinuxNativeProcessInspector {
|
|
4
|
-
async observe(pid) {
|
|
5
|
-
if (!Number.isSafeInteger(pid) || pid <= 0)
|
|
6
|
-
throw new TypeError("inspected PID must be a positive safe integer");
|
|
7
|
-
let stat;
|
|
8
|
-
try {
|
|
9
|
-
stat = await readFile(`/proc/${pid}/stat`, "utf8");
|
|
10
|
-
}
|
|
11
|
-
catch (error) {
|
|
12
|
-
if (error instanceof Error && "code" in error && error.code === "ENOENT")
|
|
13
|
-
return null;
|
|
14
|
-
throw error;
|
|
15
|
-
}
|
|
16
|
-
const commandEnd = stat.lastIndexOf(")");
|
|
17
|
-
const fields = commandEnd >= 0 ? stat.slice(commandEnd + 1).trim().split(/\s+/) : [];
|
|
18
|
-
const startTicks = fields[19];
|
|
19
|
-
if (!startTicks || !/^\d+$/.test(startTicks))
|
|
20
|
-
throw new Error("process stat has no valid start-time field");
|
|
21
|
-
return { pid, startIdentity: `linux-proc-start:${startTicks}` };
|
|
22
|
-
}
|
|
23
|
-
async matches(identity) {
|
|
24
|
-
const observed = await this.observe(identity.pid);
|
|
25
|
-
return observed !== null && observed.startIdentity === identity.startIdentity;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { ProcessGuardianAddon } from "./addon.js";
|
|
2
|
-
import type { NativeProcessInspector } from "./contracts.js";
|
|
3
|
-
/** Resolve only the platform's exact-process inspector used by cooperative session ownership. */
|
|
4
|
-
export declare function createNativeProcessInspector(environment?: NodeJS.ProcessEnv, platform?: NodeJS.Platform, releaseRoot?: string, loadAddon?: (path: string) => ProcessGuardianAddon): Promise<NativeProcessInspector>;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { PRODUCT_IDENTITY } from "../../product-identity.js";
|
|
2
|
-
/** Resolve only the platform's exact-process inspector used by cooperative session ownership. */
|
|
3
|
-
export async function createNativeProcessInspector(environment = process.env, platform = process.platform, releaseRoot, loadAddon) {
|
|
4
|
-
if (platform === "linux") {
|
|
5
|
-
const { LinuxNativeProcessInspector } = await import("./linux-process-inspector.js");
|
|
6
|
-
return new LinuxNativeProcessInspector();
|
|
7
|
-
}
|
|
8
|
-
if (platform !== "win32" && platform !== "darwin")
|
|
9
|
-
throw new Error(`native process identity is unsupported on ${platform}`);
|
|
10
|
-
if (releaseRoot === undefined && !environment[PRODUCT_IDENTITY.environment.processGuardianPath]) {
|
|
11
|
-
throw new Error("native process identity addon is unavailable");
|
|
12
|
-
}
|
|
13
|
-
const [{ resolveProcessGuardianPath }, { loadProcessGuardianAddon }, { AddonProcessInspector }] = await Promise.all([
|
|
14
|
-
import("./addon-containment.js"),
|
|
15
|
-
import("./addon.js"),
|
|
16
|
-
import("./addon-process-inspector.js"),
|
|
17
|
-
]);
|
|
18
|
-
const addonPath = resolveProcessGuardianPath(releaseRoot ?? process.cwd(), environment, platform);
|
|
19
|
-
const addon = (loadAddon ?? loadProcessGuardianAddon)(addonPath);
|
|
20
|
-
return new AddonProcessInspector(addon, platform === "win32" ? "windows-filetime:" : "darwin-proc-start:");
|
|
21
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from "node:events";
|
|
2
|
-
import type { CommandResult, LaunchInstanceStopIntent, SupervisorCommand, SupervisorSnapshot } from "../lifecycle/index.js";
|
|
3
|
-
interface ClientEvents {
|
|
4
|
-
snapshot: [SupervisorSnapshot];
|
|
5
|
-
stopIntent: [LaunchInstanceStopIntent];
|
|
6
|
-
disconnect: [];
|
|
7
|
-
}
|
|
8
|
-
/** Maintains one negotiated supervisor connection and rejects all pending commands on disconnect. */
|
|
9
|
-
export declare class SupervisorClient extends EventEmitter<ClientEvents> {
|
|
10
|
-
#private;
|
|
11
|
-
readonly clientId: `${string}-${string}-${string}-${string}-${string}`;
|
|
12
|
-
readonly releaseId?: string;
|
|
13
|
-
constructor(releaseId?: string);
|
|
14
|
-
connect(endpoint: string, timeoutMs?: number): Promise<SupervisorSnapshot>;
|
|
15
|
-
command(command: SupervisorCommand): Promise<CommandResult>;
|
|
16
|
-
close(): void;
|
|
17
|
-
}
|
|
18
|
-
export {};
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from "node:events";
|
|
2
|
-
import { connect } from "node:net";
|
|
3
|
-
import { randomUUID } from "node:crypto";
|
|
4
|
-
import { CONTROL_ENVELOPE, CONTROL_ENVELOPE_REVISION, encodeFrame, LineFrameDecoder, localControlHello, negotiateControlFeatures } from "./messages.js";
|
|
5
|
-
/** Maintains one negotiated supervisor connection and rejects all pending commands on disconnect. */
|
|
6
|
-
export class SupervisorClient extends EventEmitter {
|
|
7
|
-
clientId = randomUUID();
|
|
8
|
-
releaseId;
|
|
9
|
-
constructor(releaseId) {
|
|
10
|
-
super();
|
|
11
|
-
if (releaseId !== undefined)
|
|
12
|
-
this.releaseId = releaseId;
|
|
13
|
-
}
|
|
14
|
-
#socket = null;
|
|
15
|
-
#pending = new Map();
|
|
16
|
-
async connect(endpoint, timeoutMs = 5_000) {
|
|
17
|
-
if (this.#socket)
|
|
18
|
-
throw new Error("client is already connected");
|
|
19
|
-
const deadline = Date.now() + timeoutMs;
|
|
20
|
-
let lastError = null;
|
|
21
|
-
while (Date.now() < deadline) {
|
|
22
|
-
try {
|
|
23
|
-
return await this.#connectOnce(endpoint, Math.max(1, deadline - Date.now()));
|
|
24
|
-
}
|
|
25
|
-
catch (error) {
|
|
26
|
-
lastError = error instanceof Error ? error : new Error(String(error));
|
|
27
|
-
if (!isTransientEndpointError(lastError))
|
|
28
|
-
throw lastError;
|
|
29
|
-
await new Promise(resolve => setTimeout(resolve, Math.min(40, Math.max(1, deadline - Date.now()))));
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
throw new Error(`supervisor endpoint ${endpoint} remained unavailable for ${timeoutMs}ms`, { cause: lastError ?? undefined });
|
|
33
|
-
}
|
|
34
|
-
#connectOnce(endpoint, timeoutMs) {
|
|
35
|
-
const socket = connect(endpoint);
|
|
36
|
-
this.#socket = socket;
|
|
37
|
-
socket.setNoDelay(true);
|
|
38
|
-
const decoder = new LineFrameDecoder();
|
|
39
|
-
return new Promise((resolve, reject) => {
|
|
40
|
-
let welcomed = false;
|
|
41
|
-
const timeout = setTimeout(() => {
|
|
42
|
-
const error = transientError(`supervisor connection timed out after ${timeoutMs}ms`, "ETIMEDOUT");
|
|
43
|
-
fail(error);
|
|
44
|
-
socket.destroy();
|
|
45
|
-
}, timeoutMs);
|
|
46
|
-
const fail = (error) => {
|
|
47
|
-
clearTimeout(timeout);
|
|
48
|
-
if (!welcomed)
|
|
49
|
-
reject(error);
|
|
50
|
-
};
|
|
51
|
-
socket.once("error", fail);
|
|
52
|
-
socket.on("close", () => {
|
|
53
|
-
if (this.#socket === socket)
|
|
54
|
-
this.#socket = null;
|
|
55
|
-
if (!welcomed) {
|
|
56
|
-
fail(transientError("supervisor disconnected before completing its handshake", "ECONNRESET"));
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
for (const pending of this.#pending.values())
|
|
60
|
-
pending.reject(new Error("supervisor disconnected"));
|
|
61
|
-
this.#pending.clear();
|
|
62
|
-
this.emit("disconnect");
|
|
63
|
-
});
|
|
64
|
-
socket.on("data", chunk => {
|
|
65
|
-
try {
|
|
66
|
-
for (const value of decoder.push(chunk)) {
|
|
67
|
-
const message = value;
|
|
68
|
-
if (message.type === "server-hello" && message.snapshot) {
|
|
69
|
-
const hello = message;
|
|
70
|
-
if (hello.envelope !== CONTROL_ENVELOPE || hello.envelopeRevision !== CONTROL_ENVELOPE_REVISION || !Array.isArray(hello.requiredFeatures) || !Array.isArray(hello.optionalFeatures) || typeof hello.contractDigest !== "string") {
|
|
71
|
-
fail(new Error("supervisor returned an invalid control handshake"));
|
|
72
|
-
socket.destroy();
|
|
73
|
-
continue;
|
|
74
|
-
}
|
|
75
|
-
const negotiation = negotiateControlFeatures(localControlHello(this.releaseId), hello);
|
|
76
|
-
if (!negotiation.ok) {
|
|
77
|
-
fail(new Error(negotiation.diagnostic));
|
|
78
|
-
socket.destroy();
|
|
79
|
-
continue;
|
|
80
|
-
}
|
|
81
|
-
welcomed = true;
|
|
82
|
-
clearTimeout(timeout);
|
|
83
|
-
resolve(message.snapshot);
|
|
84
|
-
}
|
|
85
|
-
else if (message.type === "snapshot" && message.snapshot) {
|
|
86
|
-
this.emit("snapshot", message.snapshot);
|
|
87
|
-
}
|
|
88
|
-
else if (message.type === "command-result" && message.result) {
|
|
89
|
-
const pending = this.#pending.get(message.result.requestId);
|
|
90
|
-
if (pending) {
|
|
91
|
-
this.#pending.delete(message.result.requestId);
|
|
92
|
-
pending.resolve(message.result);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
else if (message.type === "stop-launch-instance" && message.instanceId && message.requestId && message.reason) {
|
|
96
|
-
this.emit("stopIntent", message);
|
|
97
|
-
}
|
|
98
|
-
else if (message.type === "protocol-error") {
|
|
99
|
-
fail(new Error(message.message ?? "protocol error"));
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
catch (error) {
|
|
104
|
-
fail(error instanceof Error ? error : new Error(String(error)));
|
|
105
|
-
socket.destroy();
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
socket.once("connect", () => socket.write(encodeFrame({ type: "client-hello", clientId: this.clientId, ...localControlHello(this.releaseId) })));
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
command(command) {
|
|
112
|
-
if (!this.#socket)
|
|
113
|
-
return Promise.reject(new Error("supervisor is not connected"));
|
|
114
|
-
return new Promise((resolve, reject) => {
|
|
115
|
-
this.#pending.set(command.requestId, { resolve, reject });
|
|
116
|
-
this.#socket?.write(encodeFrame({ type: "command", command }));
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
close() {
|
|
120
|
-
this.#socket?.end();
|
|
121
|
-
this.#socket = null;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
function isTransientEndpointError(error) {
|
|
125
|
-
const code = "code" in error ? String(error.code) : "";
|
|
126
|
-
return ["ENOENT", "ECONNREFUSED", "ECONNRESET", "EPIPE", "ETIMEDOUT"].includes(code);
|
|
127
|
-
}
|
|
128
|
-
function transientError(message, code) {
|
|
129
|
-
return Object.assign(new Error(message), { code });
|
|
130
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export { SupervisorClient } from "./client.js";
|
|
2
|
-
export { CONTROL_ENVELOPE, CONTROL_ENVELOPE_REVISION, GENERATED_CONTRACT_DIGEST, LineFrameDecoder, MAX_CONTROL_FRAME_BYTES, OPTIONAL_CONTROL_FEATURES, REQUIRED_CONTROL_FEATURES, encodeFrame, isCommandMessage, isControlHello, localControlHello, negotiateControlFeatures, } from "./messages.js";
|
|
3
|
-
export type { ClientMessage, ControlFeature, ControlHello, ControlNegotiation, ServerMessage } from "./messages.js";
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export { SupervisorClient } from "./client.js";
|
|
2
|
-
export { CONTROL_ENVELOPE, CONTROL_ENVELOPE_REVISION, GENERATED_CONTRACT_DIGEST, LineFrameDecoder, MAX_CONTROL_FRAME_BYTES, OPTIONAL_CONTROL_FEATURES, REQUIRED_CONTROL_FEATURES, encodeFrame, isCommandMessage, isControlHello, localControlHello, negotiateControlFeatures, } from "./messages.js";
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import type { CommandResult, LaunchInstanceStopIntent, SupervisorCommand, SupervisorSnapshot } from "../lifecycle/index.js";
|
|
2
|
-
export declare const CONTROL_ENVELOPE: string;
|
|
3
|
-
export declare const CONTROL_ENVELOPE_REVISION: 1;
|
|
4
|
-
export declare const REQUIRED_CONTROL_FEATURES: readonly ["handshake.features.v1", "snapshot.revision.v1", "commands.request-identity.v1", "generation.lifecycle.v1", "launch.instance-lifecycle.v1"];
|
|
5
|
-
export declare const OPTIONAL_CONTROL_FEATURES: readonly ["messages.unknown-additive-ignore.v1", "snapshot.resynchronize.v1"];
|
|
6
|
-
export type ControlFeature = string;
|
|
7
|
-
export declare const GENERATED_CONTRACT_DIGEST: string;
|
|
8
|
-
export declare const MAX_CONTROL_FRAME_BYTES: number;
|
|
9
|
-
export interface ControlHello {
|
|
10
|
-
readonly envelope: typeof CONTROL_ENVELOPE;
|
|
11
|
-
readonly envelopeRevision: typeof CONTROL_ENVELOPE_REVISION;
|
|
12
|
-
readonly requiredFeatures: readonly ControlFeature[];
|
|
13
|
-
readonly optionalFeatures: readonly ControlFeature[];
|
|
14
|
-
readonly contractDigest: string;
|
|
15
|
-
readonly releaseId?: string;
|
|
16
|
-
}
|
|
17
|
-
export type ClientMessage = {
|
|
18
|
-
readonly type: "identity-probe";
|
|
19
|
-
} | {
|
|
20
|
-
readonly type: "release-idle-ownership";
|
|
21
|
-
readonly bootNonce: string;
|
|
22
|
-
readonly candidateReleaseId: string;
|
|
23
|
-
} | {
|
|
24
|
-
readonly type: "release-update-ownership";
|
|
25
|
-
readonly bootNonce: string;
|
|
26
|
-
readonly targetVersion: string;
|
|
27
|
-
} | ({
|
|
28
|
-
readonly type: "client-hello";
|
|
29
|
-
readonly clientId: string;
|
|
30
|
-
} & ControlHello) | {
|
|
31
|
-
readonly type: "command";
|
|
32
|
-
readonly command: SupervisorCommand;
|
|
33
|
-
};
|
|
34
|
-
export type ServerMessage = {
|
|
35
|
-
readonly type: "identity";
|
|
36
|
-
readonly supervisorId: string;
|
|
37
|
-
readonly bootNonce: string;
|
|
38
|
-
readonly pidStartIdentity: string;
|
|
39
|
-
readonly releaseId: string;
|
|
40
|
-
} | {
|
|
41
|
-
readonly type: "release-ownership-result";
|
|
42
|
-
readonly released: boolean;
|
|
43
|
-
readonly reason: string;
|
|
44
|
-
readonly liveInstanceIds: readonly string[];
|
|
45
|
-
} | {
|
|
46
|
-
readonly type: "release-update-result";
|
|
47
|
-
readonly accepted: boolean;
|
|
48
|
-
readonly reason: string;
|
|
49
|
-
readonly liveInstanceIds: readonly string[];
|
|
50
|
-
} | ({
|
|
51
|
-
readonly type: "server-hello";
|
|
52
|
-
readonly supervisorId: string;
|
|
53
|
-
readonly bootNonce: string;
|
|
54
|
-
readonly pidStartIdentity: string;
|
|
55
|
-
readonly negotiatedFeatures: readonly string[];
|
|
56
|
-
readonly snapshot: SupervisorSnapshot;
|
|
57
|
-
} & ControlHello) | {
|
|
58
|
-
readonly type: "snapshot";
|
|
59
|
-
readonly snapshot: SupervisorSnapshot;
|
|
60
|
-
} | {
|
|
61
|
-
readonly type: "command-result";
|
|
62
|
-
readonly result: CommandResult;
|
|
63
|
-
} | LaunchInstanceStopIntent | {
|
|
64
|
-
readonly type: "protocol-error";
|
|
65
|
-
readonly code: string;
|
|
66
|
-
readonly message: string;
|
|
67
|
-
readonly diagnostics?: unknown;
|
|
68
|
-
};
|
|
69
|
-
export interface ControlNegotiation {
|
|
70
|
-
readonly ok: boolean;
|
|
71
|
-
readonly negotiatedFeatures: readonly string[];
|
|
72
|
-
readonly missingFromClient: readonly string[];
|
|
73
|
-
readonly missingFromServer: readonly string[];
|
|
74
|
-
readonly diagnostic: string;
|
|
75
|
-
}
|
|
76
|
-
export declare function localControlHello(releaseId?: string): ControlHello;
|
|
77
|
-
export declare function negotiateControlFeatures(client: ControlHello, server?: ControlHello): ControlNegotiation;
|
|
78
|
-
export declare function encodeFrame(message: ClientMessage | ServerMessage | Readonly<Record<string, unknown>>): string;
|
|
79
|
-
/** Incrementally decodes size-bounded newline-delimited control frames from arbitrary chunks. */
|
|
80
|
-
export declare class LineFrameDecoder {
|
|
81
|
-
#private;
|
|
82
|
-
push(chunk: Buffer | string): unknown[];
|
|
83
|
-
}
|
|
84
|
-
export declare function isControlHello(value: unknown): value is {
|
|
85
|
-
readonly type: "client-hello";
|
|
86
|
-
readonly clientId: string;
|
|
87
|
-
} & ControlHello;
|
|
88
|
-
export declare function isCommandMessage(value: unknown): value is Extract<ClientMessage, {
|
|
89
|
-
type: "command";
|
|
90
|
-
}>;
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { createHash } from "node:crypto";
|
|
2
|
-
import { PRODUCT_IDENTITY } from "../../product-identity.js";
|
|
3
|
-
export const CONTROL_ENVELOPE = PRODUCT_IDENTITY.protocol.controlEnvelope;
|
|
4
|
-
export const CONTROL_ENVELOPE_REVISION = 1;
|
|
5
|
-
export const REQUIRED_CONTROL_FEATURES = [
|
|
6
|
-
"handshake.features.v1",
|
|
7
|
-
"snapshot.revision.v1",
|
|
8
|
-
"commands.request-identity.v1",
|
|
9
|
-
"generation.lifecycle.v1",
|
|
10
|
-
"launch.instance-lifecycle.v1",
|
|
11
|
-
];
|
|
12
|
-
export const OPTIONAL_CONTROL_FEATURES = [
|
|
13
|
-
"messages.unknown-additive-ignore.v1",
|
|
14
|
-
"snapshot.resynchronize.v1",
|
|
15
|
-
];
|
|
16
|
-
export const GENERATED_CONTRACT_DIGEST = createHash("sha256").update(JSON.stringify({
|
|
17
|
-
envelope: CONTROL_ENVELOPE,
|
|
18
|
-
revision: CONTROL_ENVELOPE_REVISION,
|
|
19
|
-
required: [...REQUIRED_CONTROL_FEATURES].sort(),
|
|
20
|
-
optional: [...OPTIONAL_CONTROL_FEATURES].sort(),
|
|
21
|
-
})).digest("hex");
|
|
22
|
-
export const MAX_CONTROL_FRAME_BYTES = 4 * 1024 * 1024;
|
|
23
|
-
export function localControlHello(releaseId) {
|
|
24
|
-
return {
|
|
25
|
-
envelope: CONTROL_ENVELOPE,
|
|
26
|
-
envelopeRevision: CONTROL_ENVELOPE_REVISION,
|
|
27
|
-
requiredFeatures: REQUIRED_CONTROL_FEATURES,
|
|
28
|
-
optionalFeatures: OPTIONAL_CONTROL_FEATURES,
|
|
29
|
-
contractDigest: GENERATED_CONTRACT_DIGEST,
|
|
30
|
-
...(releaseId ? { releaseId } : {}),
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
export function negotiateControlFeatures(client, server = localControlHello()) {
|
|
34
|
-
if (client.envelope !== server.envelope || client.envelopeRevision !== server.envelopeRevision) {
|
|
35
|
-
return {
|
|
36
|
-
ok: false,
|
|
37
|
-
negotiatedFeatures: [],
|
|
38
|
-
missingFromClient: [],
|
|
39
|
-
missingFromServer: [],
|
|
40
|
-
diagnostic: `control envelope mismatch: client ${client.envelope}/${client.envelopeRevision}; server ${server.envelope}/${server.envelopeRevision}`,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
const clientFeatures = new Set([...client.requiredFeatures, ...client.optionalFeatures]);
|
|
44
|
-
const serverFeatures = new Set([...server.requiredFeatures, ...server.optionalFeatures]);
|
|
45
|
-
const missingFromClient = server.requiredFeatures.filter(feature => !clientFeatures.has(feature));
|
|
46
|
-
const missingFromServer = client.requiredFeatures.filter(feature => !serverFeatures.has(feature));
|
|
47
|
-
const negotiatedFeatures = [...clientFeatures].filter(feature => serverFeatures.has(feature)).sort();
|
|
48
|
-
return {
|
|
49
|
-
ok: missingFromClient.length === 0 && missingFromServer.length === 0,
|
|
50
|
-
negotiatedFeatures,
|
|
51
|
-
missingFromClient,
|
|
52
|
-
missingFromServer,
|
|
53
|
-
diagnostic: missingFromClient.length === 0 && missingFromServer.length === 0
|
|
54
|
-
? `control features negotiated (${negotiatedFeatures.join(", ")}); contract client=${client.contractDigest} server=${server.contractDigest}`
|
|
55
|
-
: `required control features unavailable; client missing [${missingFromClient.join(", ")}], server missing [${missingFromServer.join(", ")}]; contract client=${client.contractDigest} server=${server.contractDigest}`,
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
export function encodeFrame(message) {
|
|
59
|
-
return `${JSON.stringify(message)}\n`;
|
|
60
|
-
}
|
|
61
|
-
/** Incrementally decodes size-bounded newline-delimited control frames from arbitrary chunks. */
|
|
62
|
-
export class LineFrameDecoder {
|
|
63
|
-
#buffer = "";
|
|
64
|
-
push(chunk) {
|
|
65
|
-
this.#buffer += typeof chunk === "string" ? chunk : chunk.toString("utf8");
|
|
66
|
-
if (Buffer.byteLength(this.#buffer, "utf8") > MAX_CONTROL_FRAME_BYTES) {
|
|
67
|
-
this.#buffer = "";
|
|
68
|
-
throw new Error("control frame exceeds maximum size");
|
|
69
|
-
}
|
|
70
|
-
const messages = [];
|
|
71
|
-
let newline = this.#buffer.indexOf("\n");
|
|
72
|
-
while (newline >= 0) {
|
|
73
|
-
const line = this.#buffer.slice(0, newline);
|
|
74
|
-
this.#buffer = this.#buffer.slice(newline + 1);
|
|
75
|
-
if (line.length > 0)
|
|
76
|
-
messages.push(JSON.parse(line));
|
|
77
|
-
newline = this.#buffer.indexOf("\n");
|
|
78
|
-
}
|
|
79
|
-
return messages;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
export function isControlHello(value) {
|
|
83
|
-
if (!isRecord(value) || value.type !== "client-hello" || typeof value.clientId !== "string")
|
|
84
|
-
return false;
|
|
85
|
-
return value.envelope === CONTROL_ENVELOPE
|
|
86
|
-
&& value.envelopeRevision === CONTROL_ENVELOPE_REVISION
|
|
87
|
-
&& isStringArray(value.requiredFeatures)
|
|
88
|
-
&& isStringArray(value.optionalFeatures)
|
|
89
|
-
&& typeof value.contractDigest === "string"
|
|
90
|
-
&& (value.releaseId === undefined || typeof value.releaseId === "string");
|
|
91
|
-
}
|
|
92
|
-
export function isCommandMessage(value) {
|
|
93
|
-
return isRecord(value) && value.type === "command" && isRecord(value.command) && typeof value.command.type === "string";
|
|
94
|
-
}
|
|
95
|
-
function isRecord(value) {
|
|
96
|
-
return typeof value === "object" && value !== null;
|
|
97
|
-
}
|
|
98
|
-
function isStringArray(value) {
|
|
99
|
-
return Array.isArray(value) && value.every(item => typeof item === "string" && item.length > 0);
|
|
100
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { CohortState, SupervisorEndpointMetadata } from "./cohort-state.js";
|
|
2
|
-
import type { MaterializedRelease } from "./release-store.js";
|
|
3
|
-
export type OwnershipProbe = "live-verified" | "dead" | "unresponsive" | "identity-mismatch";
|
|
4
|
-
export type CohortLaunchDecision = {
|
|
5
|
-
readonly action: "launch-retained-ui";
|
|
6
|
-
readonly releaseId: string;
|
|
7
|
-
readonly releaseRoot: string;
|
|
8
|
-
readonly reason: string;
|
|
9
|
-
readonly recordPending: boolean;
|
|
10
|
-
} | {
|
|
11
|
-
readonly action: "activate-candidate";
|
|
12
|
-
readonly releaseId: string;
|
|
13
|
-
readonly releaseRoot: string;
|
|
14
|
-
readonly reason: string;
|
|
15
|
-
} | {
|
|
16
|
-
readonly action: "replace-idle-cohort";
|
|
17
|
-
readonly releaseId: string;
|
|
18
|
-
readonly releaseRoot: string;
|
|
19
|
-
readonly reason: string;
|
|
20
|
-
readonly pid: number;
|
|
21
|
-
} | {
|
|
22
|
-
readonly action: "start-active";
|
|
23
|
-
readonly releaseId: string;
|
|
24
|
-
readonly releaseRoot: string;
|
|
25
|
-
readonly reason: string;
|
|
26
|
-
} | {
|
|
27
|
-
readonly action: "blocked";
|
|
28
|
-
readonly releaseId: string;
|
|
29
|
-
readonly releaseRoot: string;
|
|
30
|
-
readonly reason: string;
|
|
31
|
-
readonly pid: number | null;
|
|
32
|
-
};
|
|
33
|
-
export declare function selectCohortLaunch(candidate: MaterializedRelease, state: CohortState, endpoint: SupervisorEndpointMetadata | null, probe: OwnershipProbe): CohortLaunchDecision;
|