@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,46 +0,0 @@
|
|
|
1
|
-
import type { LaunchProfileId, NativeProcessIdentity } from "./model.js";
|
|
2
|
-
export type LaunchInstanceId = string;
|
|
3
|
-
export type LaunchInstanceState = "requested" | "active" | "stopping" | "completed" | "interrupted";
|
|
4
|
-
export type LaunchInstanceShutdownPolicy = "terminate-tree-on-close";
|
|
5
|
-
export type LaunchInstanceStopReason = "owner-disconnect" | "supervisor-disconnect" | "user-request" | "update";
|
|
6
|
-
export interface ProcessContainmentIdentity {
|
|
7
|
-
readonly provider: string;
|
|
8
|
-
readonly token: string;
|
|
9
|
-
}
|
|
10
|
-
export type LaunchInstanceOutcome = {
|
|
11
|
-
readonly kind: "exited";
|
|
12
|
-
readonly exitCode: number;
|
|
13
|
-
} | {
|
|
14
|
-
readonly kind: "signaled";
|
|
15
|
-
readonly signal: string;
|
|
16
|
-
} | {
|
|
17
|
-
readonly kind: "stopped";
|
|
18
|
-
readonly reason: LaunchInstanceStopReason;
|
|
19
|
-
} | {
|
|
20
|
-
readonly kind: "spawn-error" | "guardian-error" | "cleanup-error";
|
|
21
|
-
readonly message: string;
|
|
22
|
-
readonly code: string | null;
|
|
23
|
-
} | {
|
|
24
|
-
readonly kind: "interrupted";
|
|
25
|
-
readonly reason: "owner-disconnect" | "supervisor-disconnect" | "guardian-exit" | "legacy-migration";
|
|
26
|
-
readonly message: string;
|
|
27
|
-
};
|
|
28
|
-
export interface LaunchInstance {
|
|
29
|
-
readonly id: LaunchInstanceId;
|
|
30
|
-
readonly ownerClientId: string;
|
|
31
|
-
readonly profileId: LaunchProfileId;
|
|
32
|
-
readonly state: LaunchInstanceState;
|
|
33
|
-
readonly shutdownPolicy: LaunchInstanceShutdownPolicy;
|
|
34
|
-
readonly guardianIdentity: NativeProcessIdentity;
|
|
35
|
-
readonly rootIdentity: NativeProcessIdentity | null;
|
|
36
|
-
readonly containmentIdentity: ProcessContainmentIdentity | null;
|
|
37
|
-
readonly createdAt: string;
|
|
38
|
-
readonly activatedAt: string | null;
|
|
39
|
-
readonly stoppingAt: string | null;
|
|
40
|
-
readonly completedAt: string | null;
|
|
41
|
-
readonly outcome: LaunchInstanceOutcome | null;
|
|
42
|
-
}
|
|
43
|
-
export declare function assertLaunchInstance(instance: LaunchInstance): void;
|
|
44
|
-
export declare function assertLaunchInstanceTransition(previous: LaunchInstance, next: LaunchInstance): void;
|
|
45
|
-
export declare function assertProcessContainmentIdentity(identity: ProcessContainmentIdentity): void;
|
|
46
|
-
export declare function assertLaunchInstanceOutcome(outcome: LaunchInstanceOutcome): void;
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import { assertLaunchProfileId, assertNativeProcessIdentity } from "./model.js";
|
|
2
|
-
const ALLOWED_TRANSITIONS = {
|
|
3
|
-
requested: ["active", "completed", "interrupted"],
|
|
4
|
-
active: ["stopping", "completed", "interrupted"],
|
|
5
|
-
stopping: ["completed", "interrupted"],
|
|
6
|
-
completed: [],
|
|
7
|
-
interrupted: [],
|
|
8
|
-
};
|
|
9
|
-
export function assertLaunchInstance(instance) {
|
|
10
|
-
assertIdentifier(instance.id, "launch instance identity");
|
|
11
|
-
assertIdentifier(instance.ownerClientId, "launch instance owner identity");
|
|
12
|
-
assertLaunchProfileId(instance.profileId);
|
|
13
|
-
if (!(instance.state in ALLOWED_TRANSITIONS))
|
|
14
|
-
throw new TypeError(`invalid launch instance state: ${String(instance.state)}`);
|
|
15
|
-
if (instance.shutdownPolicy !== "terminate-tree-on-close")
|
|
16
|
-
throw new TypeError("launch instance shutdown policy must terminate its process tree on close");
|
|
17
|
-
assertNativeProcessIdentity(instance.guardianIdentity);
|
|
18
|
-
if (instance.rootIdentity !== null)
|
|
19
|
-
assertNativeProcessIdentity(instance.rootIdentity);
|
|
20
|
-
if (instance.containmentIdentity !== null)
|
|
21
|
-
assertProcessContainmentIdentity(instance.containmentIdentity);
|
|
22
|
-
assertTimestamp(instance.createdAt, "launch instance creation time");
|
|
23
|
-
assertOptionalTimestamp(instance.activatedAt, "launch instance activation time");
|
|
24
|
-
assertOptionalTimestamp(instance.stoppingAt, "launch instance stopping time");
|
|
25
|
-
assertOptionalTimestamp(instance.completedAt, "launch instance completion time");
|
|
26
|
-
if (instance.outcome !== null)
|
|
27
|
-
assertLaunchInstanceOutcome(instance.outcome);
|
|
28
|
-
if (instance.state === "requested") {
|
|
29
|
-
if (instance.rootIdentity !== null || instance.containmentIdentity !== null || instance.activatedAt !== null) {
|
|
30
|
-
throw new TypeError("requested launch instance cannot have active runtime ownership");
|
|
31
|
-
}
|
|
32
|
-
if (instance.stoppingAt !== null || instance.completedAt !== null || instance.outcome !== null) {
|
|
33
|
-
throw new TypeError("requested launch instance cannot have stopping or terminal state");
|
|
34
|
-
}
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
if (instance.state === "active" || instance.state === "stopping") {
|
|
38
|
-
if (instance.rootIdentity === null || instance.containmentIdentity === null || instance.activatedAt === null) {
|
|
39
|
-
throw new TypeError(`${instance.state} launch instance requires root and containment ownership`);
|
|
40
|
-
}
|
|
41
|
-
if (instance.completedAt !== null || instance.outcome !== null)
|
|
42
|
-
throw new TypeError(`${instance.state} launch instance cannot have a terminal outcome`);
|
|
43
|
-
if (instance.state === "active" && instance.stoppingAt !== null)
|
|
44
|
-
throw new TypeError("active launch instance cannot have a stopping time");
|
|
45
|
-
if (instance.state === "stopping" && instance.stoppingAt === null)
|
|
46
|
-
throw new TypeError("stopping launch instance requires a stopping time");
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
if (instance.completedAt === null || instance.outcome === null)
|
|
50
|
-
throw new TypeError("terminal launch instance requires completion time and outcome");
|
|
51
|
-
if (instance.state === "completed" && instance.outcome.kind === "interrupted")
|
|
52
|
-
throw new TypeError("completed launch instance cannot carry an interrupted outcome");
|
|
53
|
-
if (instance.state === "interrupted" && instance.outcome.kind !== "interrupted" && instance.outcome.kind !== "cleanup-error") {
|
|
54
|
-
throw new TypeError("interrupted launch instance requires an interrupted or cleanup-error outcome");
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
export function assertLaunchInstanceTransition(previous, next) {
|
|
58
|
-
assertLaunchInstance(previous);
|
|
59
|
-
assertLaunchInstance(next);
|
|
60
|
-
if (previous.id !== next.id || previous.ownerClientId !== next.ownerClientId || previous.profileId !== next.profileId) {
|
|
61
|
-
throw new TypeError("launch instance identity and ownership are immutable");
|
|
62
|
-
}
|
|
63
|
-
if (previous.shutdownPolicy !== next.shutdownPolicy
|
|
64
|
-
|| !sameProcessIdentity(previous.guardianIdentity, next.guardianIdentity)
|
|
65
|
-
|| previous.createdAt !== next.createdAt) {
|
|
66
|
-
throw new TypeError("launch instance guardian, policy, and creation identity are immutable");
|
|
67
|
-
}
|
|
68
|
-
const allowedTransitions = ALLOWED_TRANSITIONS[previous.state];
|
|
69
|
-
if (!allowedTransitions.includes(next.state)) {
|
|
70
|
-
throw new TypeError(`invalid launch instance transition: ${previous.state} -> ${next.state}`);
|
|
71
|
-
}
|
|
72
|
-
if (previous.rootIdentity !== null && !sameProcessIdentity(previous.rootIdentity, next.rootIdentity)) {
|
|
73
|
-
throw new TypeError("launch instance root identity is immutable after activation");
|
|
74
|
-
}
|
|
75
|
-
if (previous.containmentIdentity !== null && !sameContainmentIdentity(previous.containmentIdentity, next.containmentIdentity)) {
|
|
76
|
-
throw new TypeError("launch instance containment identity is immutable after activation");
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
export function assertProcessContainmentIdentity(identity) {
|
|
80
|
-
assertIdentifier(identity.provider, "process containment provider");
|
|
81
|
-
assertIdentifier(identity.token, "process containment token");
|
|
82
|
-
}
|
|
83
|
-
export function assertLaunchInstanceOutcome(outcome) {
|
|
84
|
-
if (outcome.kind === "exited") {
|
|
85
|
-
if (!Number.isSafeInteger(outcome.exitCode))
|
|
86
|
-
throw new TypeError("launch instance exit code must be a safe integer");
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
if (outcome.kind === "signaled") {
|
|
90
|
-
assertIdentifier(outcome.signal, "launch instance signal");
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
if (outcome.kind === "stopped") {
|
|
94
|
-
if (!["owner-disconnect", "supervisor-disconnect", "user-request", "update"].includes(outcome.reason)) {
|
|
95
|
-
throw new TypeError("invalid launch instance stop reason");
|
|
96
|
-
}
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
if (outcome.kind === "interrupted") {
|
|
100
|
-
if (!["owner-disconnect", "supervisor-disconnect", "guardian-exit", "legacy-migration"].includes(outcome.reason)) {
|
|
101
|
-
throw new TypeError("invalid launch instance interruption reason");
|
|
102
|
-
}
|
|
103
|
-
assertDiagnostic(outcome.message, "launch instance interruption message");
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
if (outcome.kind !== "spawn-error" && outcome.kind !== "guardian-error" && outcome.kind !== "cleanup-error") {
|
|
107
|
-
throw new TypeError(`invalid launch instance outcome: ${String(outcome.kind)}`);
|
|
108
|
-
}
|
|
109
|
-
assertDiagnostic(outcome.message, "launch instance failure message");
|
|
110
|
-
if (outcome.code !== null)
|
|
111
|
-
assertIdentifier(outcome.code, "launch instance failure code");
|
|
112
|
-
}
|
|
113
|
-
function sameProcessIdentity(left, right) {
|
|
114
|
-
return right !== null && left.pid === right.pid && left.startIdentity === right.startIdentity;
|
|
115
|
-
}
|
|
116
|
-
function sameContainmentIdentity(left, right) {
|
|
117
|
-
return right !== null && left.provider === right.provider && left.token === right.token;
|
|
118
|
-
}
|
|
119
|
-
function assertIdentifier(value, name) {
|
|
120
|
-
if (!value || value.length > 512 || value.includes("\0"))
|
|
121
|
-
throw new TypeError(`${name} must be non-empty, bounded, and contain no null byte`);
|
|
122
|
-
}
|
|
123
|
-
function assertDiagnostic(value, name) {
|
|
124
|
-
if (!value || value.length > 4_096 || value.includes("\0"))
|
|
125
|
-
throw new TypeError(`${name} must be non-empty, bounded, and contain no null byte`);
|
|
126
|
-
}
|
|
127
|
-
function assertTimestamp(value, name) {
|
|
128
|
-
if (!value || !Number.isFinite(Date.parse(value)))
|
|
129
|
-
throw new TypeError(`${name} must be a valid timestamp`);
|
|
130
|
-
}
|
|
131
|
-
function assertOptionalTimestamp(value, name) {
|
|
132
|
-
if (value !== null)
|
|
133
|
-
assertTimestamp(value, name);
|
|
134
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { existsSync } from "node:fs";
|
|
2
|
-
import { createRequire } from "node:module";
|
|
3
|
-
import { resolve } from "node:path";
|
|
4
|
-
import { fileURLToPath } from "node:url";
|
|
5
|
-
import { PRODUCT_IDENTITY } from "../../product-identity.js";
|
|
6
|
-
let backend;
|
|
7
|
-
/** No PID-file fallback: only the platform descriptor can prove upgraded-writer exclusion. */
|
|
8
|
-
export function tryAcquireClaimGate(path) {
|
|
9
|
-
if (backend === undefined) {
|
|
10
|
-
const require = createRequire(import.meta.url);
|
|
11
|
-
// Security: resolve only this release's addon, never a binary supplied by tool cwd.
|
|
12
|
-
const own = resolve(fileURLToPath(new URL("../../../", import.meta.url)), "dist", "native", `${process.platform}-${process.arch}`, `${PRODUCT_IDENTITY.artifacts.terminalHostAddon}.node`);
|
|
13
|
-
const override = process.env[PRODUCT_IDENTITY.environment.developmentInstanceId]
|
|
14
|
-
? process.env[PRODUCT_IDENTITY.environment.terminalHostPath] : undefined;
|
|
15
|
-
for (const candidate of override ? [override, own] : [own]) {
|
|
16
|
-
if (!existsSync(candidate))
|
|
17
|
-
continue;
|
|
18
|
-
try {
|
|
19
|
-
const loaded = require(candidate);
|
|
20
|
-
if (typeof loaded.SessionLock?.tryAcquireGate === "function") {
|
|
21
|
-
backend = loaded.SessionLock;
|
|
22
|
-
break;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
catch { /* Compatibility: an unusable addon is unavailable, not contended. */ }
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
if (backend === undefined)
|
|
29
|
-
throw Object.assign(new Error("native worktree coordination is unavailable; repair or update this A1 installation and retry"), {
|
|
30
|
-
code: "worktree-coordination-unavailable",
|
|
31
|
-
});
|
|
32
|
-
try {
|
|
33
|
-
const handle = backend.tryAcquireGate(path);
|
|
34
|
-
return handle.acquired ? handle : null;
|
|
35
|
-
}
|
|
36
|
-
catch (cause) {
|
|
37
|
-
throw Object.assign(new Error("cannot access the worktree mutation gate; check A1 data-directory permissions and filesystem availability", { cause }), {
|
|
38
|
-
code: "worktree-coordination-io",
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
declare const STARTUP_SCHEMA = "a1-supervisor-startup-v1";
|
|
2
|
-
export interface SupervisorStartupAttemptIdentity {
|
|
3
|
-
readonly attemptId: string;
|
|
4
|
-
readonly releaseId: string;
|
|
5
|
-
readonly resultPath: string;
|
|
6
|
-
}
|
|
7
|
-
export type SupervisorStartupResult = {
|
|
8
|
-
readonly schema: typeof STARTUP_SCHEMA;
|
|
9
|
-
readonly attemptId: string;
|
|
10
|
-
readonly releaseId: string;
|
|
11
|
-
readonly outcome: "ready";
|
|
12
|
-
readonly pid: number;
|
|
13
|
-
} | {
|
|
14
|
-
readonly schema: typeof STARTUP_SCHEMA;
|
|
15
|
-
readonly attemptId: string;
|
|
16
|
-
readonly releaseId: string;
|
|
17
|
-
readonly outcome: "failure";
|
|
18
|
-
readonly stage: string;
|
|
19
|
-
readonly code: string | null;
|
|
20
|
-
readonly message: string;
|
|
21
|
-
};
|
|
22
|
-
/** Create one unguessable startup result authority under the protected runtime root. */
|
|
23
|
-
export declare function createSupervisorStartupAttempt(runtimeDir: string, releaseId: string): Promise<SupervisorStartupAttemptIdentity>;
|
|
24
|
-
export declare function supervisorStartupResultPath(runtimeDir: string, attemptId: string): string;
|
|
25
|
-
/** Atomically publish the bounded result for one detached supervisor startup attempt. */
|
|
26
|
-
export declare function publishSupervisorStartupResult(path: string, result: SupervisorStartupResult): Promise<void>;
|
|
27
|
-
export declare function readSupervisorStartupResult(path: string, attemptId: string, releaseId: string): Promise<SupervisorStartupResult | null>;
|
|
28
|
-
export declare function supervisorStartupFailure(error: unknown, attemptId: string, releaseId: string, stage: string): SupervisorStartupResult;
|
|
29
|
-
export declare function supervisorStartupReady(attemptId: string, releaseId: string): SupervisorStartupResult;
|
|
30
|
-
export {};
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { randomUUID } from "node:crypto";
|
|
2
|
-
import { mkdir, readFile, readdir, rename, rm, stat, writeFile } from "node:fs/promises";
|
|
3
|
-
import { resolve } from "node:path";
|
|
4
|
-
const STARTUP_SCHEMA = "a1-supervisor-startup-v1";
|
|
5
|
-
const MAX_RESULT_BYTES = 8 * 1024;
|
|
6
|
-
const MAX_MESSAGE_LENGTH = 1_024;
|
|
7
|
-
const MAX_RETAINED_RESULTS = 16;
|
|
8
|
-
const MAX_RESULT_AGE_MS = 7 * 24 * 60 * 60 * 1_000;
|
|
9
|
-
const ATTEMPT_PATTERN = /^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/;
|
|
10
|
-
/** Create one unguessable startup result authority under the protected runtime root. */
|
|
11
|
-
export async function createSupervisorStartupAttempt(runtimeDir, releaseId) {
|
|
12
|
-
const attemptId = randomUUID();
|
|
13
|
-
const directory = resolve(runtimeDir, "supervisor-startup");
|
|
14
|
-
await mkdir(directory, { recursive: true, mode: 0o700 });
|
|
15
|
-
await pruneSupervisorStartupResults(directory);
|
|
16
|
-
return { attemptId, releaseId, resultPath: supervisorStartupResultPath(runtimeDir, attemptId) };
|
|
17
|
-
}
|
|
18
|
-
export function supervisorStartupResultPath(runtimeDir, attemptId) {
|
|
19
|
-
if (!ATTEMPT_PATTERN.test(attemptId))
|
|
20
|
-
throw new TypeError("supervisor startup attempt identity is invalid");
|
|
21
|
-
return resolve(runtimeDir, "supervisor-startup", `${attemptId}.json`);
|
|
22
|
-
}
|
|
23
|
-
/** Atomically publish the bounded result for one detached supervisor startup attempt. */
|
|
24
|
-
export async function publishSupervisorStartupResult(path, result) {
|
|
25
|
-
validateSupervisorStartupResult(result, result.attemptId, result.releaseId);
|
|
26
|
-
const body = `${JSON.stringify(result)}\n`;
|
|
27
|
-
if (Buffer.byteLength(body) > MAX_RESULT_BYTES)
|
|
28
|
-
throw new Error("supervisor startup result exceeds its size bound");
|
|
29
|
-
const temporary = `${path}.${process.pid}.tmp`;
|
|
30
|
-
await writeFile(temporary, body, { encoding: "utf8", mode: 0o600 });
|
|
31
|
-
await rename(temporary, path);
|
|
32
|
-
}
|
|
33
|
-
export async function readSupervisorStartupResult(path, attemptId, releaseId) {
|
|
34
|
-
let metadata;
|
|
35
|
-
try {
|
|
36
|
-
metadata = await stat(path);
|
|
37
|
-
}
|
|
38
|
-
catch (error) {
|
|
39
|
-
if (isNodeError(error, "ENOENT"))
|
|
40
|
-
return null;
|
|
41
|
-
throw error;
|
|
42
|
-
}
|
|
43
|
-
if (!metadata.isFile() || metadata.size > MAX_RESULT_BYTES)
|
|
44
|
-
throw new Error("supervisor startup result is invalid or oversized");
|
|
45
|
-
const value = JSON.parse(await readFile(path, "utf8"));
|
|
46
|
-
return validateSupervisorStartupResult(value, attemptId, releaseId);
|
|
47
|
-
}
|
|
48
|
-
export function supervisorStartupFailure(error, attemptId, releaseId, stage) {
|
|
49
|
-
const source = error instanceof Error ? error : new Error(String(error));
|
|
50
|
-
return {
|
|
51
|
-
schema: STARTUP_SCHEMA,
|
|
52
|
-
attemptId,
|
|
53
|
-
releaseId,
|
|
54
|
-
outcome: "failure",
|
|
55
|
-
stage: boundedToken(stage, "unknown"),
|
|
56
|
-
code: "code" in source && typeof source.code === "string" ? boundedToken(source.code, "UNKNOWN") : null,
|
|
57
|
-
message: sanitizeMessage(source.message),
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
export function supervisorStartupReady(attemptId, releaseId) {
|
|
61
|
-
return { schema: STARTUP_SCHEMA, attemptId, releaseId, outcome: "ready", pid: process.pid };
|
|
62
|
-
}
|
|
63
|
-
async function pruneSupervisorStartupResults(directory) {
|
|
64
|
-
const now = Date.now();
|
|
65
|
-
const entries = await readdir(directory, { withFileTypes: true });
|
|
66
|
-
const files = (await Promise.all(entries.filter(entry => entry.isFile() && entry.name.endsWith(".json")).map(async (entry) => {
|
|
67
|
-
const path = resolve(directory, entry.name);
|
|
68
|
-
const metadata = await stat(path).catch(() => null);
|
|
69
|
-
return metadata ? { path, modified: metadata.mtimeMs } : null;
|
|
70
|
-
}))).filter((file) => file !== null);
|
|
71
|
-
files.sort((left, right) => right.modified - left.modified);
|
|
72
|
-
await Promise.all(files.flatMap((file, index) => index >= MAX_RETAINED_RESULTS - 1 || now - file.modified > MAX_RESULT_AGE_MS
|
|
73
|
-
? [rm(file.path, { force: true })]
|
|
74
|
-
: []));
|
|
75
|
-
}
|
|
76
|
-
function validateSupervisorStartupResult(value, attemptId, releaseId) {
|
|
77
|
-
if (!value || typeof value !== "object")
|
|
78
|
-
throw new Error("supervisor startup result is malformed");
|
|
79
|
-
const result = value;
|
|
80
|
-
if (result.schema !== STARTUP_SCHEMA || result.attemptId !== attemptId || result.releaseId !== releaseId) {
|
|
81
|
-
throw new Error("supervisor startup result does not match the selected attempt and release");
|
|
82
|
-
}
|
|
83
|
-
if (result.outcome === "ready" && Number.isSafeInteger(result.pid) && Number(result.pid) > 0)
|
|
84
|
-
return result;
|
|
85
|
-
if (result.outcome === "failure" && typeof result.stage === "string" && result.stage.length > 0 && result.stage.length <= 128
|
|
86
|
-
&& (result.code === null || typeof result.code === "string") && typeof result.message === "string" && result.message.length <= MAX_MESSAGE_LENGTH) {
|
|
87
|
-
return result;
|
|
88
|
-
}
|
|
89
|
-
throw new Error("supervisor startup result is malformed");
|
|
90
|
-
}
|
|
91
|
-
function sanitizeMessage(message) {
|
|
92
|
-
let value = message.replace(/[\u0000-\u001f\u007f]+/g, " ").replace(/:\/\/[^\s/@:]+:[^\s/@]+@/g, "://<redacted>@");
|
|
93
|
-
for (const [name, secret] of Object.entries(process.env)) {
|
|
94
|
-
if (!secret || secret.length < 4 || !/(?:TOKEN|SECRET|PASSWORD|COOKIE|CREDENTIAL|AUTH)/i.test(name))
|
|
95
|
-
continue;
|
|
96
|
-
value = value.split(secret).join("<redacted>");
|
|
97
|
-
}
|
|
98
|
-
return value.trim().slice(0, MAX_MESSAGE_LENGTH) || "supervisor startup failed";
|
|
99
|
-
}
|
|
100
|
-
function boundedToken(value, fallback) {
|
|
101
|
-
const normalized = value.replace(/[^A-Za-z0-9_.:-]/g, "-").slice(0, 128);
|
|
102
|
-
return normalized || fallback;
|
|
103
|
-
}
|
|
104
|
-
function isNodeError(error, code) {
|
|
105
|
-
return error instanceof Error && "code" in error && error.code === code;
|
|
106
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { NativeProcessIdentity, ProcessContainmentIdentity } from "../lifecycle/index.js";
|
|
2
|
-
import { type ProcessGuardianAddon } from "./addon.js";
|
|
3
|
-
import type { ContainedProcessHandle, ContainedSpawnOptions, ProcessContainment } from "./contracts.js";
|
|
4
|
-
/** Owns one native containment object in the launch guardian's Node process. */
|
|
5
|
-
export declare class AddonContainment implements ProcessContainment {
|
|
6
|
-
#private;
|
|
7
|
-
readonly instanceId: string;
|
|
8
|
-
readonly addonPath: string;
|
|
9
|
-
readonly exitNoticePath: string | null;
|
|
10
|
-
readonly addon: ProcessGuardianAddon;
|
|
11
|
-
private readonly platform;
|
|
12
|
-
constructor(instanceId: string, addonPath: string, exitNoticePath?: string | null, addon?: ProcessGuardianAddon, platform?: NodeJS.Platform);
|
|
13
|
-
get identity(): ProcessContainmentIdentity;
|
|
14
|
-
spawn(executable: string, arguments_: readonly string[], options: ContainedSpawnOptions): Promise<ContainedProcessHandle>;
|
|
15
|
-
contains(identity: NativeProcessIdentity): Promise<boolean>;
|
|
16
|
-
stop(force: boolean): Promise<void>;
|
|
17
|
-
waitForEmpty(timeoutMs: number): Promise<boolean>;
|
|
18
|
-
close(): Promise<void>;
|
|
19
|
-
}
|
|
20
|
-
export declare function resolveProcessGuardianPath(releaseRoot: string, environment?: NodeJS.ProcessEnv, platform?: NodeJS.Platform, architecture?: string): string;
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import { constants } from "node:os";
|
|
2
|
-
import { mkdir, rm } from "node:fs/promises";
|
|
3
|
-
import { dirname, resolve } from "node:path";
|
|
4
|
-
import { PRODUCT_IDENTITY } from "../../product-identity.js";
|
|
5
|
-
import { loadProcessGuardianAddon } from "./addon.js";
|
|
6
|
-
/** Owns one native containment object in the launch guardian's Node process. */
|
|
7
|
-
export class AddonContainment {
|
|
8
|
-
#identity;
|
|
9
|
-
#rootIdentity = null;
|
|
10
|
-
#runtime = null;
|
|
11
|
-
#outcome = null;
|
|
12
|
-
#settled = false;
|
|
13
|
-
instanceId;
|
|
14
|
-
addonPath;
|
|
15
|
-
exitNoticePath;
|
|
16
|
-
addon;
|
|
17
|
-
platform;
|
|
18
|
-
constructor(instanceId, addonPath, exitNoticePath = null, addon = loadProcessGuardianAddon(addonPath), platform = process.platform) {
|
|
19
|
-
this.instanceId = instanceId;
|
|
20
|
-
this.addonPath = addonPath;
|
|
21
|
-
this.exitNoticePath = exitNoticePath;
|
|
22
|
-
this.addon = addon;
|
|
23
|
-
this.platform = platform;
|
|
24
|
-
this.#identity = { provider: "native-addon-pending", token: instanceId };
|
|
25
|
-
}
|
|
26
|
-
get identity() {
|
|
27
|
-
return this.#identity;
|
|
28
|
-
}
|
|
29
|
-
async spawn(executable, arguments_, options) {
|
|
30
|
-
if (this.#runtime)
|
|
31
|
-
throw new Error("process containment already has a root runtime");
|
|
32
|
-
if (this.exitNoticePath) {
|
|
33
|
-
await mkdir(dirname(this.exitNoticePath), { recursive: true, mode: 0o700 });
|
|
34
|
-
await rm(this.exitNoticePath, { force: true });
|
|
35
|
-
}
|
|
36
|
-
const runtime = this.addon.spawnContained({
|
|
37
|
-
executable,
|
|
38
|
-
arguments: [...arguments_],
|
|
39
|
-
cwd: options.cwd,
|
|
40
|
-
environment: {
|
|
41
|
-
...options.environment,
|
|
42
|
-
...(options.terminalType ? { TERM: options.terminalType } : {}),
|
|
43
|
-
...(this.exitNoticePath ? { [PRODUCT_IDENTITY.environment.exitNoticePath]: this.exitNoticePath } : {}),
|
|
44
|
-
},
|
|
45
|
-
instanceId: this.instanceId,
|
|
46
|
-
});
|
|
47
|
-
assertRuntime(runtime);
|
|
48
|
-
this.#runtime = runtime;
|
|
49
|
-
this.#rootIdentity = { pid: runtime.pid, startIdentity: runtime.startIdentity };
|
|
50
|
-
this.#identity = { provider: runtime.containmentProvider, token: runtime.containmentToken };
|
|
51
|
-
const outcome = runtime.wait().then(exitCode => outcomeFromExitCode(exitCode, this.platform), error => ({
|
|
52
|
-
kind: "guardian-error",
|
|
53
|
-
message: errorMessage(error),
|
|
54
|
-
code: errorCode(error),
|
|
55
|
-
})).finally(() => { this.#settled = true; });
|
|
56
|
-
this.#outcome = outcome;
|
|
57
|
-
return {
|
|
58
|
-
identity: this.#rootIdentity,
|
|
59
|
-
outcome,
|
|
60
|
-
...(runtime.processGroup === null ? {} : { processGroup: runtime.processGroup }),
|
|
61
|
-
...(runtime.foregroundGroup === null ? {} : { foregroundGroup: runtime.foregroundGroup }),
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
async contains(identity) {
|
|
65
|
-
return this.#rootIdentity !== null
|
|
66
|
-
&& identity.pid === this.#rootIdentity.pid
|
|
67
|
-
&& identity.startIdentity === this.#rootIdentity.startIdentity;
|
|
68
|
-
}
|
|
69
|
-
async stop(force) {
|
|
70
|
-
const runtime = this.#runtime;
|
|
71
|
-
if (!runtime || this.#settled)
|
|
72
|
-
return;
|
|
73
|
-
try {
|
|
74
|
-
if (force)
|
|
75
|
-
runtime.terminate(137);
|
|
76
|
-
else if (this.platform === "win32")
|
|
77
|
-
process.kill(runtime.pid, "SIGTERM");
|
|
78
|
-
else
|
|
79
|
-
runtime.stop();
|
|
80
|
-
}
|
|
81
|
-
catch (error) {
|
|
82
|
-
if (errorCode(error) !== "ESRCH")
|
|
83
|
-
throw error;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
async waitForEmpty(timeoutMs) {
|
|
87
|
-
if (this.#settled || !this.#outcome)
|
|
88
|
-
return true;
|
|
89
|
-
return await Promise.race([
|
|
90
|
-
this.#outcome.then(() => true),
|
|
91
|
-
new Promise(resolvePromise => {
|
|
92
|
-
const timer = setTimeout(() => resolvePromise(false), timeoutMs);
|
|
93
|
-
timer.unref();
|
|
94
|
-
}),
|
|
95
|
-
]);
|
|
96
|
-
}
|
|
97
|
-
async close() {
|
|
98
|
-
const runtime = this.#runtime;
|
|
99
|
-
if (!runtime)
|
|
100
|
-
return;
|
|
101
|
-
runtime.close();
|
|
102
|
-
await this.waitForEmpty(1_500);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
export function resolveProcessGuardianPath(releaseRoot, environment = process.env, platform = process.platform, architecture = process.arch) {
|
|
106
|
-
const override = environment[PRODUCT_IDENTITY.environment.processGuardianPath]?.trim();
|
|
107
|
-
if (override)
|
|
108
|
-
return resolve(override);
|
|
109
|
-
return resolve(releaseRoot, "dist", "native", `${platform}-${architecture}`, `${PRODUCT_IDENTITY.artifacts.processGuardianAddon}.node`);
|
|
110
|
-
}
|
|
111
|
-
function assertRuntime(runtime) {
|
|
112
|
-
if (!Number.isSafeInteger(runtime.pid) || runtime.pid <= 0
|
|
113
|
-
|| typeof runtime.startIdentity !== "string" || runtime.startIdentity.length === 0
|
|
114
|
-
|| typeof runtime.containmentProvider !== "string" || runtime.containmentProvider.length === 0
|
|
115
|
-
|| typeof runtime.containmentToken !== "string" || runtime.containmentToken.length === 0
|
|
116
|
-
|| (runtime.processGroup !== null && (!Number.isSafeInteger(runtime.processGroup) || runtime.processGroup <= 0))
|
|
117
|
-
|| (runtime.foregroundGroup !== null && (!Number.isSafeInteger(runtime.foregroundGroup) || runtime.foregroundGroup <= 0))) {
|
|
118
|
-
runtime.close();
|
|
119
|
-
throw Object.assign(new Error("process guardian addon returned invalid containment identity"), { code: "CONTAINMENT_ARTIFACT_INCOMPATIBLE" });
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
function outcomeFromExitCode(exitCode, platform) {
|
|
123
|
-
if (!Number.isSafeInteger(exitCode) || exitCode < 0 || exitCode > 255) {
|
|
124
|
-
return { kind: "guardian-error", message: "process guardian addon returned an invalid exit code", code: "CONTAINMENT_OUTCOME_INVALID" };
|
|
125
|
-
}
|
|
126
|
-
if (platform !== "win32" && exitCode >= 128) {
|
|
127
|
-
const signalNumber = exitCode - 128;
|
|
128
|
-
const signal = Object.entries(constants.signals).find(([, value]) => value === signalNumber)?.[0];
|
|
129
|
-
if (signal)
|
|
130
|
-
return { kind: "signaled", signal };
|
|
131
|
-
}
|
|
132
|
-
return { kind: "exited", exitCode };
|
|
133
|
-
}
|
|
134
|
-
function errorCode(error) {
|
|
135
|
-
return error instanceof Error && "code" in error && typeof error.code === "string" ? error.code : null;
|
|
136
|
-
}
|
|
137
|
-
function errorMessage(error) {
|
|
138
|
-
return error instanceof Error ? error.message : String(error);
|
|
139
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { NativeProcessIdentity } from "../lifecycle/index.js";
|
|
2
|
-
import type { ProcessGuardianAddon } from "./addon.js";
|
|
3
|
-
import type { NativeProcessInspector } from "./contracts.js";
|
|
4
|
-
/** Verifies native process identity through the process-guardian addon's bounded inspection call. */
|
|
5
|
-
export declare class AddonProcessInspector implements NativeProcessInspector {
|
|
6
|
-
readonly addon: Pick<ProcessGuardianAddon, "inspectProcessStart">;
|
|
7
|
-
readonly identityPrefix: string;
|
|
8
|
-
constructor(addon: Pick<ProcessGuardianAddon, "inspectProcessStart">, identityPrefix: string);
|
|
9
|
-
observe(pid: number): Promise<NativeProcessIdentity | null>;
|
|
10
|
-
matches(identity: NativeProcessIdentity): Promise<boolean>;
|
|
11
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/** Verifies native process identity through the process-guardian addon's bounded inspection call. */
|
|
2
|
-
export class AddonProcessInspector {
|
|
3
|
-
addon;
|
|
4
|
-
identityPrefix;
|
|
5
|
-
constructor(addon, identityPrefix) {
|
|
6
|
-
if (!identityPrefix || identityPrefix.includes("\0"))
|
|
7
|
-
throw new TypeError("process identity prefix is invalid");
|
|
8
|
-
this.addon = addon;
|
|
9
|
-
this.identityPrefix = identityPrefix;
|
|
10
|
-
}
|
|
11
|
-
async observe(pid) {
|
|
12
|
-
if (!Number.isSafeInteger(pid) || pid <= 0)
|
|
13
|
-
throw new TypeError("inspected PID must be a positive safe integer");
|
|
14
|
-
let startIdentity;
|
|
15
|
-
try {
|
|
16
|
-
startIdentity = this.addon.inspectProcessStart(pid);
|
|
17
|
-
}
|
|
18
|
-
catch (error) {
|
|
19
|
-
throw Object.assign(new Error(`cannot inspect native process identity: ${errorMessage(error)}`), { code: "PROCESS_INSPECTION_FAILED" });
|
|
20
|
-
}
|
|
21
|
-
if (startIdentity === null)
|
|
22
|
-
return null;
|
|
23
|
-
if (typeof startIdentity !== "string" || startIdentity.length === 0 || startIdentity.length > 512
|
|
24
|
-
|| startIdentity.includes("\0") || !startIdentity.startsWith(this.identityPrefix)) {
|
|
25
|
-
throw Object.assign(new Error("process guardian returned mismatched identity data"), { code: "PROCESS_INSPECTION_INVALID" });
|
|
26
|
-
}
|
|
27
|
-
return { pid, startIdentity };
|
|
28
|
-
}
|
|
29
|
-
async matches(identity) {
|
|
30
|
-
const observed = await this.observe(identity.pid);
|
|
31
|
-
return observed !== null && observed.startIdentity === identity.startIdentity;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
function errorMessage(error) {
|
|
35
|
-
return error instanceof Error ? error.message : String(error);
|
|
36
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
export interface ProcessGuardianVersion {
|
|
2
|
-
readonly crateVersion: string;
|
|
3
|
-
readonly protocolVersion: 2;
|
|
4
|
-
readonly target: string;
|
|
5
|
-
}
|
|
6
|
-
export interface ProcessGuardianRuntime {
|
|
7
|
-
readonly pid: number;
|
|
8
|
-
readonly startIdentity: string;
|
|
9
|
-
readonly containmentProvider: string;
|
|
10
|
-
readonly containmentToken: string;
|
|
11
|
-
readonly processGroup: number | null;
|
|
12
|
-
readonly foregroundGroup: number | null;
|
|
13
|
-
wait(): Promise<number>;
|
|
14
|
-
terminate(code: number): void;
|
|
15
|
-
stop(): void;
|
|
16
|
-
close(): void;
|
|
17
|
-
}
|
|
18
|
-
export interface SpawnContainedOptions {
|
|
19
|
-
readonly executable: string;
|
|
20
|
-
readonly arguments: readonly string[];
|
|
21
|
-
readonly cwd: string;
|
|
22
|
-
readonly environment: Readonly<Record<string, string>>;
|
|
23
|
-
readonly instanceId: string;
|
|
24
|
-
}
|
|
25
|
-
export interface ProcessGuardianAddon {
|
|
26
|
-
version(): ProcessGuardianVersion;
|
|
27
|
-
inspectProcessStart(pid: number): string | null;
|
|
28
|
-
/** Additive capability; older retained addons remain usable for containment, not recovery gates. */
|
|
29
|
-
tryAcquireProcessGate?(path: string): {
|
|
30
|
-
readonly acquired: boolean;
|
|
31
|
-
release(): void;
|
|
32
|
-
};
|
|
33
|
-
captureTerminalModes(): string;
|
|
34
|
-
restoreTerminalModes(encoded: string): void;
|
|
35
|
-
deliverExitNotice(path: string, encodedModes: string): void;
|
|
36
|
-
spawnContained(options: SpawnContainedOptions): ProcessGuardianRuntime;
|
|
37
|
-
spawnWatcher(options: {
|
|
38
|
-
readonly executable: string;
|
|
39
|
-
readonly arguments: readonly string[];
|
|
40
|
-
}): number;
|
|
41
|
-
waitForProcessExit(pid: number): Promise<void>;
|
|
42
|
-
stopProcessGroup(processGroup: number): void;
|
|
43
|
-
restoreForegroundGroup(processGroup: number): void;
|
|
44
|
-
ignoreConsoleControl(): void;
|
|
45
|
-
}
|
|
46
|
-
/** Loads one verified Node-API guardian instance per exact addon path. */
|
|
47
|
-
export declare function loadProcessGuardianAddon(path: string): ProcessGuardianAddon;
|