@timurproko/a1 0.1.0 → 0.1.1-dev.10
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 +10 -43
- package/bin/{addone.js → cli.js} +2 -2
- package/bin/guardian.js +22 -0
- package/bin/ui.js +20 -0
- package/dist/native/darwin-arm64/manifest.json +20 -0
- package/dist/native/darwin-arm64/process-guardian +0 -0
- package/dist/native/linux-x64/manifest.json +20 -0
- package/dist/native/linux-x64/process-guardian +0 -0
- package/dist/native/win32-x64/manifest.json +20 -0
- package/dist/native/win32-x64/process-guardian.exe +0 -0
- package/dist/src/cli/dispatch.d.ts +4 -5
- package/dist/src/cli/dispatch.js +11 -11
- package/dist/src/cli/index.d.ts +0 -1
- package/dist/src/cli/index.js +0 -1
- package/dist/src/cli/version-stats.d.ts +0 -1
- package/dist/src/cli/version-stats.js +27 -23
- package/dist/src/cli/version.d.ts +1 -2
- package/dist/src/cli/version.js +4 -4
- package/dist/src/composition/index.d.ts +48 -0
- package/dist/src/composition/index.js +258 -0
- package/dist/src/features/launch/development-launch.d.ts +0 -1
- package/dist/src/features/launch/development-launch.js +12 -11
- package/dist/src/features/launch/index.d.ts +0 -1
- package/dist/src/features/launch/index.js +0 -1
- package/dist/src/features/launch/initialize-profile.d.ts +1 -2
- package/dist/src/features/launch/initialize-profile.js +24 -4
- package/dist/src/features/launch/intent.d.ts +0 -1
- package/dist/src/features/launch/intent.js +0 -1
- package/dist/src/features/launch/prepare-launch.d.ts +2 -3
- package/dist/src/features/launch/prepare-launch.js +3 -4
- package/dist/src/features/launch/profile-paths.d.ts +2 -3
- package/dist/src/features/launch/profile-paths.js +9 -8
- package/dist/src/features/launch/profiles.d.ts +3 -4
- package/dist/src/features/launch/profiles.js +7 -8
- package/dist/src/features/launch/runtime-selection.d.ts +13 -9
- package/dist/src/features/launch/runtime-selection.js +6 -7
- package/dist/src/features/owned-ui/customization.d.ts +5 -3
- package/dist/src/features/owned-ui/customization.js +2 -4
- package/dist/src/features/owned-ui/diagnostics.d.ts +0 -1
- package/dist/src/features/owned-ui/diagnostics.js +0 -1
- package/dist/src/features/owned-ui/index.d.ts +1 -2
- package/dist/src/features/owned-ui/index.js +1 -2
- package/dist/src/features/owned-ui/run.d.ts +9 -7
- package/dist/src/features/owned-ui/run.js +9 -15
- package/dist/src/features/owned-ui/settings-app.d.ts +22 -0
- package/dist/src/features/owned-ui/settings-app.js +633 -0
- package/dist/src/features/workspace/capabilities.d.ts +0 -1
- package/dist/src/features/workspace/capabilities.js +0 -1
- package/dist/src/features/workspace/index.d.ts +0 -1
- package/dist/src/features/workspace/index.js +0 -1
- package/dist/src/features/workspace/presentation.d.ts +1 -2
- package/dist/src/features/workspace/presentation.js +5 -4
- package/dist/src/features/workspace/reconciliation.d.ts +0 -1
- package/dist/src/features/workspace/reconciliation.js +0 -1
- package/dist/src/features/workspace/reducer.d.ts +0 -1
- package/dist/src/features/workspace/reducer.js +0 -1
- package/dist/src/features/workspace/router.d.ts +0 -1
- package/dist/src/features/workspace/router.js +0 -1
- package/dist/src/features/workspace/store.d.ts +0 -1
- package/dist/src/features/workspace/store.js +0 -1
- package/dist/src/foundation/agent-engine-contracts/capability-ports.d.ts +95 -0
- package/dist/src/foundation/agent-engine-contracts/capability-ports.js +35 -0
- package/dist/src/foundation/agent-engine-contracts/domain-validation.d.ts +12 -0
- package/dist/src/foundation/agent-engine-contracts/domain-validation.js +89 -0
- package/dist/src/foundation/agent-engine-contracts/domain.d.ts +116 -0
- package/dist/src/foundation/agent-engine-contracts/domain.js +1 -0
- package/dist/src/foundation/agent-engine-contracts/index.d.ts +7 -0
- package/dist/src/foundation/agent-engine-contracts/index.js +7 -0
- package/dist/src/foundation/agent-engine-contracts/model.d.ts +78 -0
- package/dist/src/foundation/agent-engine-contracts/model.js +1 -0
- package/dist/src/foundation/agent-engine-contracts/ports.d.ts +18 -0
- package/dist/src/foundation/agent-engine-contracts/ports.js +1 -0
- package/dist/src/foundation/agent-engine-contracts/serialization.d.ts +7 -0
- package/dist/src/foundation/agent-engine-contracts/serialization.js +58 -0
- package/dist/src/foundation/agent-engine-contracts/validation.d.ts +5 -0
- package/dist/src/foundation/agent-engine-contracts/validation.js +128 -0
- package/dist/src/foundation/launch-guardian/index.d.ts +1 -0
- package/dist/src/foundation/launch-guardian/index.js +1 -0
- package/dist/src/foundation/launch-guardian/main.d.ts +31 -0
- package/dist/src/foundation/launch-guardian/main.js +165 -0
- package/dist/src/foundation/lifecycle/commands.d.ts +40 -0
- package/dist/src/foundation/lifecycle/commands.js +1 -0
- package/dist/src/foundation/lifecycle/index.d.ts +2 -1
- package/dist/src/foundation/lifecycle/index.js +2 -1
- package/dist/src/foundation/lifecycle/launch-instance.d.ts +46 -0
- package/dist/src/foundation/lifecycle/launch-instance.js +134 -0
- package/dist/src/foundation/lifecycle/model.d.ts +7 -44
- package/dist/src/foundation/lifecycle/model.js +3 -3
- package/dist/src/foundation/lifecycle/paths.d.ts +2 -3
- package/dist/src/foundation/lifecycle/paths.js +32 -16
- package/dist/src/foundation/native-host-protocol/codec.d.ts +0 -1
- package/dist/src/foundation/native-host-protocol/codec.js +0 -1
- package/dist/src/foundation/native-host-protocol/evidence.d.ts +2 -3
- package/dist/src/foundation/native-host-protocol/evidence.js +4 -4
- package/dist/src/foundation/native-host-protocol/index.d.ts +0 -1
- package/dist/src/foundation/native-host-protocol/index.js +0 -1
- package/dist/src/foundation/native-host-protocol/messages.d.ts +1 -2
- package/dist/src/foundation/native-host-protocol/messages.js +2 -2
- package/dist/src/foundation/native-host-protocol/proof-gate.d.ts +0 -1
- package/dist/src/foundation/native-host-protocol/proof-gate.js +0 -1
- package/dist/src/foundation/owned-ui-contracts/extension-ui.d.ts +0 -1
- package/dist/src/foundation/owned-ui-contracts/extension-ui.js +0 -1
- package/dist/src/foundation/owned-ui-contracts/index.d.ts +0 -1
- package/dist/src/foundation/owned-ui-contracts/index.js +0 -1
- package/dist/src/foundation/owned-ui-contracts/model.d.ts +0 -1
- package/dist/src/foundation/owned-ui-contracts/model.js +0 -1
- package/dist/src/foundation/owned-ui-contracts/validation.d.ts +0 -1
- package/dist/src/foundation/owned-ui-contracts/validation.js +0 -1
- package/dist/src/foundation/owned-ui-settings/declarations.d.ts +13 -0
- package/dist/src/foundation/owned-ui-settings/declarations.js +39 -0
- package/dist/src/foundation/owned-ui-settings/index.d.ts +6 -0
- package/dist/src/foundation/owned-ui-settings/index.js +6 -0
- package/dist/src/foundation/owned-ui-settings/migrations.d.ts +13 -0
- package/dist/src/foundation/owned-ui-settings/migrations.js +28 -0
- package/dist/src/foundation/owned-ui-settings/resolution.d.ts +45 -0
- package/dist/src/foundation/owned-ui-settings/resolution.js +147 -0
- package/dist/src/foundation/owned-ui-settings/sections.d.ts +70 -0
- package/dist/src/foundation/owned-ui-settings/sections.js +93 -0
- package/dist/src/foundation/owned-ui-settings/session.d.ts +44 -0
- package/dist/src/foundation/owned-ui-settings/session.js +145 -0
- package/dist/src/foundation/owned-ui-settings/store.d.ts +28 -0
- package/dist/src/foundation/owned-ui-settings/store.js +90 -0
- package/dist/src/foundation/pi-component-adapter/components.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/components.js +0 -1
- package/dist/src/foundation/pi-component-adapter/conformance.d.ts +1 -1
- package/dist/src/foundation/pi-component-adapter/conformance.js +10 -4
- package/dist/src/foundation/pi-component-adapter/index.d.ts +1 -1
- package/dist/src/foundation/pi-component-adapter/index.js +1 -1
- package/dist/src/foundation/pi-component-adapter/resources/builtin-themes.d.ts +165 -0
- package/dist/src/foundation/pi-component-adapter/resources/builtin-themes.js +166 -0
- package/dist/src/foundation/pi-component-adapter/shell-components.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/shell-components.js +0 -1
- package/dist/src/foundation/pi-component-adapter/shell-editor-autocomplete.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/shell-editor-autocomplete.js +10 -13
- package/dist/src/foundation/pi-component-adapter/shell-extension-ui.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/shell-extension-ui.js +0 -1
- package/dist/src/foundation/pi-component-adapter/shell-footer-status.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/shell-footer-status.js +5 -62
- package/dist/src/foundation/pi-component-adapter/shell-presenters-transcript.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/shell-presenters-transcript.js +0 -1
- package/dist/src/foundation/pi-component-adapter/shell-selectors-dialogs.d.ts +9 -2
- package/dist/src/foundation/pi-component-adapter/shell-selectors-dialogs.js +10 -9
- package/dist/src/foundation/pi-component-adapter/shell-shared-facade.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/shell-shared-facade.js +0 -1
- package/dist/src/foundation/pi-component-adapter/theme.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/theme.js +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/adjacent/core/keybindings.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/adjacent/core/keybindings.js +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/countdown-timer.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/countdown-timer.js +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/custom-entry.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/custom-entry.js +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/daxnuts.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/daxnuts.js +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/earendil-announcement.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/earendil-announcement.js +3 -27
- package/dist/src/foundation/pi-component-adapter/upstream/components/extension-editor.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/extension-editor.js +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/first-time-setup.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/first-time-setup.js +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/markdown-transform.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/markdown-transform.js +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/mermaid.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/mermaid.js +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/owned-editor.d.ts +18 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/owned-editor.js +55 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/scoped-models-selector.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/scoped-models-selector.js +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/session-footer.d.ts +10 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/session-footer.js +120 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/session-selector-search.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/session-selector-search.js +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/session-selector.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/session-selector.js +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/skill-invocation-message.d.ts +1 -2
- package/dist/src/foundation/pi-component-adapter/upstream/components/skill-invocation-message.js +1 -2
- package/dist/src/foundation/pi-component-adapter/upstream/components/status-indicator.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/status-indicator.js +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/tree-selector.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/tree-selector.js +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/trust-selector.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/trust-selector.js +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/external-editor.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/external-editor.js +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/model-search.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/model-search.js +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/theme/theme-controller.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/theme/theme-controller.js +1 -2
- package/dist/src/foundation/pi-component-adapter/upstream/theme/theme.d.ts +8 -1
- package/dist/src/foundation/pi-component-adapter/upstream/theme/theme.js +30 -15
- package/dist/src/foundation/pi-engine-adapter/adapter.d.ts +19 -205
- package/dist/src/foundation/pi-engine-adapter/adapter.js +156 -181
- package/dist/src/foundation/pi-engine-adapter/conformance.d.ts +24 -1
- package/dist/src/foundation/pi-engine-adapter/conformance.js +60 -15
- package/dist/src/foundation/pi-engine-adapter/index.d.ts +6 -1
- package/dist/src/foundation/pi-engine-adapter/index.js +6 -1
- package/dist/src/foundation/pi-engine-adapter/model-auth-integration.d.ts +30 -0
- package/dist/src/foundation/pi-engine-adapter/model-auth-integration.js +61 -0
- package/dist/src/foundation/pi-engine-adapter/pi-settings-metadata.json +374 -0
- package/dist/src/foundation/pi-engine-adapter/public-main-entry.d.ts +5 -0
- package/dist/src/foundation/pi-engine-adapter/public-main-entry.js +27 -0
- package/dist/src/foundation/pi-engine-adapter/resource-extension-integration.d.ts +31 -0
- package/dist/src/foundation/pi-engine-adapter/resource-extension-integration.js +80 -0
- package/dist/src/foundation/pi-engine-adapter/runtime-integration.d.ts +18 -0
- package/dist/src/foundation/pi-engine-adapter/runtime-integration.js +32 -0
- package/dist/src/foundation/pi-engine-adapter/session-integration.d.ts +43 -0
- package/dist/src/foundation/pi-engine-adapter/session-integration.js +97 -0
- package/dist/src/foundation/pi-engine-adapter/settings-integration.d.ts +55 -0
- package/dist/src/foundation/pi-engine-adapter/settings-integration.js +233 -0
- package/dist/src/foundation/pi-engine-adapter/workflow-controllers.d.ts +20 -0
- package/dist/src/foundation/pi-engine-adapter/workflow-controllers.js +48 -0
- package/dist/src/foundation/pi-engine-adapter/workflows.d.ts +9 -1
- package/dist/src/foundation/pi-engine-adapter/workflows.js +0 -1
- package/dist/src/foundation/pi-owned-ui-integration/index.d.ts +2 -0
- package/dist/src/foundation/pi-owned-ui-integration/index.js +2 -0
- package/dist/src/foundation/pi-owned-ui-integration/route-host.d.ts +29 -0
- package/dist/src/foundation/pi-owned-ui-integration/route-host.js +1 -0
- package/dist/src/{features/owned-ui/pi-session-shell.d.ts → foundation/pi-owned-ui-integration/session-shell.d.ts} +23 -14
- package/dist/src/{features/owned-ui/pi-session-shell.js → foundation/pi-owned-ui-integration/session-shell.js} +130 -61
- package/dist/src/foundation/pi-tui-runtime-adapter/adapter.d.ts +6 -1
- package/dist/src/foundation/pi-tui-runtime-adapter/adapter.js +9 -1
- package/dist/src/foundation/pi-tui-runtime-adapter/conformance.d.ts +8 -4
- package/dist/src/foundation/pi-tui-runtime-adapter/conformance.js +22 -9
- package/dist/src/foundation/pi-tui-runtime-adapter/contracts.d.ts +0 -2
- package/dist/src/foundation/pi-tui-runtime-adapter/contracts.js +1 -2
- package/dist/src/foundation/pi-tui-runtime-adapter/index.d.ts +1 -1
- package/dist/src/foundation/pi-tui-runtime-adapter/index.js +1 -1
- package/dist/src/foundation/pi-tui-runtime-adapter/presentation-adapter.d.ts +4 -0
- package/dist/src/foundation/pi-tui-runtime-adapter/presentation-adapter.js +48 -0
- package/dist/src/foundation/presentation-contracts/index.d.ts +96 -0
- package/dist/src/foundation/presentation-contracts/index.js +38 -0
- package/dist/src/foundation/process-containment/artifact.d.ts +1 -0
- package/dist/src/foundation/process-containment/artifact.js +34 -0
- package/dist/src/foundation/process-containment/contracts.d.ts +31 -0
- package/dist/src/foundation/process-containment/contracts.js +35 -0
- package/dist/src/foundation/process-containment/index.d.ts +5 -0
- package/dist/src/foundation/process-containment/index.js +5 -0
- package/dist/src/foundation/process-containment/linux-process-inspector.d.ts +6 -0
- package/dist/src/foundation/process-containment/linux-process-inspector.js +26 -0
- package/dist/src/foundation/process-containment/native-guardian-containment.d.ts +16 -0
- package/dist/src/foundation/process-containment/native-guardian-containment.js +139 -0
- package/dist/src/foundation/process-containment/windows-process-inspector.d.ts +17 -0
- package/dist/src/foundation/process-containment/windows-process-inspector.js +53 -0
- package/dist/src/foundation/protocol/client.d.ts +2 -2
- package/dist/src/foundation/protocol/client.js +3 -1
- package/dist/src/foundation/protocol/index.d.ts +0 -1
- package/dist/src/foundation/protocol/index.js +0 -1
- package/dist/src/foundation/protocol/messages.d.ts +6 -7
- package/dist/src/foundation/protocol/messages.js +3 -3
- package/dist/src/foundation/release/bootstrap.d.ts +2 -3
- package/dist/src/foundation/release/bootstrap.js +85 -33
- package/dist/src/foundation/release/cohort-selection.d.ts +0 -1
- package/dist/src/foundation/release/cohort-selection.js +3 -4
- package/dist/src/foundation/release/cohort-state.d.ts +6 -4
- package/dist/src/foundation/release/cohort-state.js +5 -4
- package/dist/src/foundation/release/concurrency.d.ts +1 -0
- package/dist/src/foundation/release/concurrency.js +17 -0
- package/dist/src/foundation/release/development-preview-release.d.ts +2 -2
- package/dist/src/foundation/release/development-preview-release.js +3 -2
- package/dist/src/foundation/release/index.d.ts +0 -1
- package/dist/src/foundation/release/index.js +0 -1
- package/dist/src/foundation/release/process-cleanup.d.ts +1 -2
- package/dist/src/foundation/release/process-cleanup.js +2 -3
- package/dist/src/foundation/release/release-gc.d.ts +0 -1
- package/dist/src/foundation/release/release-gc.js +0 -1
- package/dist/src/foundation/release/release-store.d.ts +38 -6
- package/dist/src/foundation/release/release-store.js +103 -43
- package/dist/src/foundation/release/release.d.ts +20 -6
- package/dist/src/foundation/release/release.js +77 -48
- package/dist/src/foundation/release/stable-release.d.ts +2 -2
- package/dist/src/foundation/release/stable-release.js +6 -5
- package/dist/src/foundation/release/update-transaction.d.ts +2 -2
- package/dist/src/foundation/release/update-transaction.js +8 -7
- package/dist/src/foundation/release/update.d.ts +20 -4
- package/dist/src/foundation/release/update.js +152 -36
- package/dist/src/foundation/storage/control-store.d.ts +8 -8
- package/dist/src/foundation/storage/control-store.js +132 -61
- package/dist/src/foundation/storage/index.d.ts +0 -1
- package/dist/src/foundation/storage/index.js +0 -1
- package/dist/src/foundation/structured-agent-runtime/backpressure.d.ts +0 -1
- package/dist/src/foundation/structured-agent-runtime/backpressure.js +0 -1
- package/dist/src/foundation/structured-agent-runtime/commands.d.ts +0 -1
- package/dist/src/foundation/structured-agent-runtime/commands.js +0 -1
- package/dist/src/foundation/structured-agent-runtime/handshake.d.ts +2 -3
- package/dist/src/foundation/structured-agent-runtime/handshake.js +13 -13
- package/dist/src/foundation/structured-agent-runtime/index.d.ts +0 -1
- package/dist/src/foundation/structured-agent-runtime/index.js +0 -1
- package/dist/src/foundation/structured-agent-runtime/reconnection.d.ts +0 -1
- package/dist/src/foundation/structured-agent-runtime/reconnection.js +0 -1
- package/dist/src/foundation/structured-agent-runtime/state.d.ts +0 -1
- package/dist/src/foundation/structured-agent-runtime/state.js +0 -1
- package/dist/src/foundation/supervision/index.d.ts +1 -2
- package/dist/src/foundation/supervision/index.js +1 -2
- package/dist/src/foundation/supervision/main.d.ts +0 -1
- package/dist/src/foundation/supervision/main.js +11 -10
- package/dist/src/foundation/supervision/paths.d.ts +1 -2
- package/dist/src/foundation/supervision/paths.js +1 -2
- package/dist/src/foundation/supervision/server.d.ts +6 -5
- package/dist/src/foundation/supervision/server.js +259 -91
- package/dist/src/foundation/ui-apps/contracts.d.ts +42 -0
- package/dist/src/foundation/ui-apps/contracts.js +12 -0
- package/dist/src/foundation/ui-apps/host.d.ts +42 -0
- package/dist/src/foundation/ui-apps/host.js +152 -0
- package/dist/src/foundation/ui-apps/index.d.ts +3 -0
- package/dist/src/foundation/ui-apps/index.js +3 -0
- package/dist/src/foundation/ui-apps/registry.d.ts +11 -0
- package/dist/src/foundation/ui-apps/registry.js +32 -0
- package/dist/src/foundation/ui-components/dialog-panel.d.ts +36 -0
- package/dist/src/foundation/ui-components/dialog-panel.js +47 -0
- package/dist/src/foundation/ui-components/frame.d.ts +21 -0
- package/dist/src/foundation/ui-components/frame.js +54 -0
- package/dist/src/foundation/ui-components/index.d.ts +18 -0
- package/dist/src/foundation/ui-components/index.js +18 -0
- package/dist/src/foundation/ui-components/label.d.ts +8 -0
- package/dist/src/foundation/ui-components/label.js +36 -0
- package/dist/src/foundation/ui-components/line-input.d.ts +74 -0
- package/dist/src/foundation/ui-components/line-input.js +245 -0
- package/dist/src/foundation/ui-components/list-block.d.ts +66 -0
- package/dist/src/foundation/ui-components/list-block.js +176 -0
- package/dist/src/foundation/ui-components/list-view.d.ts +66 -0
- package/dist/src/foundation/ui-components/list-view.js +76 -0
- package/dist/src/foundation/ui-components/mouse.d.ts +15 -0
- package/dist/src/foundation/ui-components/mouse.js +46 -0
- package/dist/src/foundation/ui-components/pane.d.ts +33 -0
- package/dist/src/foundation/ui-components/pane.js +7 -0
- package/dist/src/foundation/ui-components/revision.d.ts +35 -0
- package/dist/src/foundation/ui-components/revision.js +79 -0
- package/dist/src/foundation/ui-components/scrollbar.d.ts +62 -0
- package/dist/src/foundation/ui-components/scrollbar.js +102 -0
- package/dist/src/foundation/ui-components/shortcuts.d.ts +57 -0
- package/dist/src/foundation/ui-components/shortcuts.js +81 -0
- package/dist/src/foundation/ui-components/spans.d.ts +7 -0
- package/dist/src/foundation/ui-components/spans.js +59 -0
- package/dist/src/foundation/ui-components/status-line.d.ts +16 -0
- package/dist/src/foundation/ui-components/status-line.js +14 -0
- package/dist/src/foundation/ui-components/stepper.d.ts +24 -0
- package/dist/src/foundation/ui-components/stepper.js +33 -0
- package/dist/src/foundation/ui-components/surface.d.ts +20 -0
- package/dist/src/foundation/ui-components/surface.js +38 -0
- package/dist/src/foundation/ui-components/text.d.ts +24 -0
- package/dist/src/foundation/ui-components/text.js +123 -0
- package/dist/src/foundation/ui-components/theme.d.ts +23 -0
- package/dist/src/foundation/ui-components/theme.js +13 -0
- package/dist/src/foundation/ui-components/value-menu.d.ts +41 -0
- package/dist/src/foundation/ui-components/value-menu.js +33 -0
- package/dist/src/foundation/workspace-contracts/index.d.ts +0 -1
- package/dist/src/foundation/workspace-contracts/index.js +0 -1
- package/dist/src/foundation/workspace-contracts/model.d.ts +0 -1
- package/dist/src/foundation/workspace-contracts/model.js +0 -1
- package/dist/src/foundation/workspace-contracts/validation.d.ts +0 -1
- package/dist/src/foundation/workspace-contracts/validation.js +0 -1
- package/dist/src/product-identity.d.ts +37 -0
- package/dist/src/product-identity.js +150 -0
- package/dist/src/product-identity.json +99 -0
- package/docs/architecture/boundaries.md +32 -14
- package/docs/architecture/process-guardian-provenance.md +26 -0
- package/docs/architecture/project-structure.md +2 -2
- package/docs/architecture/resource-and-data-policy.md +1 -1
- package/docs/architecture/terminal-host-proof-gate.md +2 -2
- package/docs/architecture/terminal-host-provenance.md +3 -3
- package/docs/architecture/terminal-host-spike-evidence.md +1 -1
- package/docs/architecture/toolchain.md +40 -8
- package/docs/architecture/ui-reference-provenance.md +50 -0
- package/docs/ci-release-runbook.md +67 -0
- package/docs/features/launch-profiles.md +12 -6
- package/docs/manual-launch-instance-acceptance.md +66 -0
- package/docs/manual-pi-boundary-candidate.md +33 -0
- package/docs/manual-terminal-colour-check.md +55 -0
- package/docs/manual-transparent-checkpoint.md +11 -11
- package/package.json +27 -14
- package/bin/addone-ui.js +0 -20
- package/dist/src/cli/dispatch.d.ts.map +0 -1
- package/dist/src/cli/dispatch.js.map +0 -1
- package/dist/src/cli/index.d.ts.map +0 -1
- package/dist/src/cli/index.js.map +0 -1
- package/dist/src/cli/version-stats.d.ts.map +0 -1
- package/dist/src/cli/version-stats.js.map +0 -1
- package/dist/src/cli/version.d.ts.map +0 -1
- package/dist/src/cli/version.js.map +0 -1
- package/dist/src/features/launch/development-launch.d.ts.map +0 -1
- package/dist/src/features/launch/development-launch.js.map +0 -1
- package/dist/src/features/launch/index.d.ts.map +0 -1
- package/dist/src/features/launch/index.js.map +0 -1
- package/dist/src/features/launch/initialize-profile.d.ts.map +0 -1
- package/dist/src/features/launch/initialize-profile.js.map +0 -1
- package/dist/src/features/launch/intent.d.ts.map +0 -1
- package/dist/src/features/launch/intent.js.map +0 -1
- package/dist/src/features/launch/prepare-launch.d.ts.map +0 -1
- package/dist/src/features/launch/prepare-launch.js.map +0 -1
- package/dist/src/features/launch/profile-paths.d.ts.map +0 -1
- package/dist/src/features/launch/profile-paths.js.map +0 -1
- package/dist/src/features/launch/profiles.d.ts.map +0 -1
- package/dist/src/features/launch/profiles.js.map +0 -1
- package/dist/src/features/launch/runtime-selection.d.ts.map +0 -1
- package/dist/src/features/launch/runtime-selection.js.map +0 -1
- package/dist/src/features/owned-ui/customization.d.ts.map +0 -1
- package/dist/src/features/owned-ui/customization.js.map +0 -1
- package/dist/src/features/owned-ui/diagnostics.d.ts.map +0 -1
- package/dist/src/features/owned-ui/diagnostics.js.map +0 -1
- package/dist/src/features/owned-ui/index.d.ts.map +0 -1
- package/dist/src/features/owned-ui/index.js.map +0 -1
- package/dist/src/features/owned-ui/pi-session-shell.d.ts.map +0 -1
- package/dist/src/features/owned-ui/pi-session-shell.js.map +0 -1
- package/dist/src/features/owned-ui/run.d.ts.map +0 -1
- package/dist/src/features/owned-ui/run.js.map +0 -1
- package/dist/src/features/workspace/capabilities.d.ts.map +0 -1
- package/dist/src/features/workspace/capabilities.js.map +0 -1
- package/dist/src/features/workspace/index.d.ts.map +0 -1
- package/dist/src/features/workspace/index.js.map +0 -1
- package/dist/src/features/workspace/presentation.d.ts.map +0 -1
- package/dist/src/features/workspace/presentation.js.map +0 -1
- package/dist/src/features/workspace/reconciliation.d.ts.map +0 -1
- package/dist/src/features/workspace/reconciliation.js.map +0 -1
- package/dist/src/features/workspace/reducer.d.ts.map +0 -1
- package/dist/src/features/workspace/reducer.js.map +0 -1
- package/dist/src/features/workspace/router.d.ts.map +0 -1
- package/dist/src/features/workspace/router.js.map +0 -1
- package/dist/src/features/workspace/store.d.ts.map +0 -1
- package/dist/src/features/workspace/store.js.map +0 -1
- package/dist/src/foundation/lifecycle/index.d.ts.map +0 -1
- package/dist/src/foundation/lifecycle/index.js.map +0 -1
- package/dist/src/foundation/lifecycle/model.d.ts.map +0 -1
- package/dist/src/foundation/lifecycle/model.js.map +0 -1
- package/dist/src/foundation/lifecycle/paths.d.ts.map +0 -1
- package/dist/src/foundation/lifecycle/paths.js.map +0 -1
- package/dist/src/foundation/native-host-protocol/codec.d.ts.map +0 -1
- package/dist/src/foundation/native-host-protocol/codec.js.map +0 -1
- package/dist/src/foundation/native-host-protocol/evidence.d.ts.map +0 -1
- package/dist/src/foundation/native-host-protocol/evidence.js.map +0 -1
- package/dist/src/foundation/native-host-protocol/index.d.ts.map +0 -1
- package/dist/src/foundation/native-host-protocol/index.js.map +0 -1
- package/dist/src/foundation/native-host-protocol/messages.d.ts.map +0 -1
- package/dist/src/foundation/native-host-protocol/messages.js.map +0 -1
- package/dist/src/foundation/native-host-protocol/proof-gate.d.ts.map +0 -1
- package/dist/src/foundation/native-host-protocol/proof-gate.js.map +0 -1
- package/dist/src/foundation/owned-ui-contracts/extension-ui.d.ts.map +0 -1
- package/dist/src/foundation/owned-ui-contracts/extension-ui.js.map +0 -1
- package/dist/src/foundation/owned-ui-contracts/index.d.ts.map +0 -1
- package/dist/src/foundation/owned-ui-contracts/index.js.map +0 -1
- package/dist/src/foundation/owned-ui-contracts/model.d.ts.map +0 -1
- package/dist/src/foundation/owned-ui-contracts/model.js.map +0 -1
- package/dist/src/foundation/owned-ui-contracts/validation.d.ts.map +0 -1
- package/dist/src/foundation/owned-ui-contracts/validation.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/components.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/components.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/conformance.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/conformance.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/index.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/index.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/shell-components.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/shell-components.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/shell-editor-autocomplete.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/shell-editor-autocomplete.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/shell-extension-ui.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/shell-extension-ui.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/shell-footer-status.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/shell-footer-status.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/shell-presenters-transcript.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/shell-presenters-transcript.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/shell-selectors-dialogs.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/shell-selectors-dialogs.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/shell-shared-facade.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/shell-shared-facade.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/theme.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/theme.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/adjacent/core/keybindings.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/adjacent/core/keybindings.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/countdown-timer.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/countdown-timer.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/custom-entry.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/custom-entry.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/daxnuts.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/daxnuts.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/earendil-announcement.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/earendil-announcement.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/extension-editor.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/extension-editor.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/first-time-setup.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/first-time-setup.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/markdown-transform.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/markdown-transform.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/mermaid.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/mermaid.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/scoped-models-selector.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/scoped-models-selector.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/session-selector-search.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/session-selector-search.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/session-selector.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/session-selector.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/skill-invocation-message.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/skill-invocation-message.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/status-indicator.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/status-indicator.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/tree-selector.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/tree-selector.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/trust-selector.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/trust-selector.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/external-editor.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/external-editor.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/model-search.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/model-search.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/theme/theme-controller.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/theme/theme-controller.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/theme/theme.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/theme/theme.js.map +0 -1
- package/dist/src/foundation/pi-engine-adapter/adapter.d.ts.map +0 -1
- package/dist/src/foundation/pi-engine-adapter/adapter.js.map +0 -1
- package/dist/src/foundation/pi-engine-adapter/conformance.d.ts.map +0 -1
- package/dist/src/foundation/pi-engine-adapter/conformance.js.map +0 -1
- package/dist/src/foundation/pi-engine-adapter/index.d.ts.map +0 -1
- package/dist/src/foundation/pi-engine-adapter/index.js.map +0 -1
- package/dist/src/foundation/pi-engine-adapter/workflows.d.ts.map +0 -1
- package/dist/src/foundation/pi-engine-adapter/workflows.js.map +0 -1
- package/dist/src/foundation/pi-tui-runtime-adapter/adapter.d.ts.map +0 -1
- package/dist/src/foundation/pi-tui-runtime-adapter/adapter.js.map +0 -1
- package/dist/src/foundation/pi-tui-runtime-adapter/conformance.d.ts.map +0 -1
- package/dist/src/foundation/pi-tui-runtime-adapter/conformance.js.map +0 -1
- package/dist/src/foundation/pi-tui-runtime-adapter/contracts.d.ts.map +0 -1
- package/dist/src/foundation/pi-tui-runtime-adapter/contracts.js.map +0 -1
- package/dist/src/foundation/pi-tui-runtime-adapter/index.d.ts.map +0 -1
- package/dist/src/foundation/pi-tui-runtime-adapter/index.js.map +0 -1
- package/dist/src/foundation/protocol/client.d.ts.map +0 -1
- package/dist/src/foundation/protocol/client.js.map +0 -1
- package/dist/src/foundation/protocol/index.d.ts.map +0 -1
- package/dist/src/foundation/protocol/index.js.map +0 -1
- package/dist/src/foundation/protocol/messages.d.ts.map +0 -1
- package/dist/src/foundation/protocol/messages.js.map +0 -1
- package/dist/src/foundation/release/bootstrap.d.ts.map +0 -1
- package/dist/src/foundation/release/bootstrap.js.map +0 -1
- package/dist/src/foundation/release/cohort-selection.d.ts.map +0 -1
- package/dist/src/foundation/release/cohort-selection.js.map +0 -1
- package/dist/src/foundation/release/cohort-state.d.ts.map +0 -1
- package/dist/src/foundation/release/cohort-state.js.map +0 -1
- package/dist/src/foundation/release/development-preview-release.d.ts.map +0 -1
- package/dist/src/foundation/release/development-preview-release.js.map +0 -1
- package/dist/src/foundation/release/index.d.ts.map +0 -1
- package/dist/src/foundation/release/index.js.map +0 -1
- package/dist/src/foundation/release/process-cleanup.d.ts.map +0 -1
- package/dist/src/foundation/release/process-cleanup.js.map +0 -1
- package/dist/src/foundation/release/release-gc.d.ts.map +0 -1
- package/dist/src/foundation/release/release-gc.js.map +0 -1
- package/dist/src/foundation/release/release-store.d.ts.map +0 -1
- package/dist/src/foundation/release/release-store.js.map +0 -1
- package/dist/src/foundation/release/release.d.ts.map +0 -1
- package/dist/src/foundation/release/release.js.map +0 -1
- package/dist/src/foundation/release/stable-release.d.ts.map +0 -1
- package/dist/src/foundation/release/stable-release.js.map +0 -1
- package/dist/src/foundation/release/update-transaction.d.ts.map +0 -1
- package/dist/src/foundation/release/update-transaction.js.map +0 -1
- package/dist/src/foundation/release/update.d.ts.map +0 -1
- package/dist/src/foundation/release/update.js.map +0 -1
- package/dist/src/foundation/storage/control-store.d.ts.map +0 -1
- package/dist/src/foundation/storage/control-store.js.map +0 -1
- package/dist/src/foundation/storage/index.d.ts.map +0 -1
- package/dist/src/foundation/storage/index.js.map +0 -1
- package/dist/src/foundation/structured-agent-runtime/backpressure.d.ts.map +0 -1
- package/dist/src/foundation/structured-agent-runtime/backpressure.js.map +0 -1
- package/dist/src/foundation/structured-agent-runtime/commands.d.ts.map +0 -1
- package/dist/src/foundation/structured-agent-runtime/commands.js.map +0 -1
- package/dist/src/foundation/structured-agent-runtime/handshake.d.ts.map +0 -1
- package/dist/src/foundation/structured-agent-runtime/handshake.js.map +0 -1
- package/dist/src/foundation/structured-agent-runtime/index.d.ts.map +0 -1
- package/dist/src/foundation/structured-agent-runtime/index.js.map +0 -1
- package/dist/src/foundation/structured-agent-runtime/reconnection.d.ts.map +0 -1
- package/dist/src/foundation/structured-agent-runtime/reconnection.js.map +0 -1
- package/dist/src/foundation/structured-agent-runtime/state.d.ts.map +0 -1
- package/dist/src/foundation/structured-agent-runtime/state.js.map +0 -1
- package/dist/src/foundation/supervision/index.d.ts.map +0 -1
- package/dist/src/foundation/supervision/index.js.map +0 -1
- package/dist/src/foundation/supervision/main.d.ts.map +0 -1
- package/dist/src/foundation/supervision/main.js.map +0 -1
- package/dist/src/foundation/supervision/paths.d.ts.map +0 -1
- package/dist/src/foundation/supervision/paths.js.map +0 -1
- package/dist/src/foundation/supervision/server.d.ts.map +0 -1
- package/dist/src/foundation/supervision/server.js.map +0 -1
- package/dist/src/foundation/transparent-terminal/command-resolution.d.ts +0 -14
- package/dist/src/foundation/transparent-terminal/command-resolution.d.ts.map +0 -1
- package/dist/src/foundation/transparent-terminal/command-resolution.js +0 -70
- package/dist/src/foundation/transparent-terminal/command-resolution.js.map +0 -1
- package/dist/src/foundation/transparent-terminal/foreground-broker.d.ts +0 -33
- package/dist/src/foundation/transparent-terminal/foreground-broker.d.ts.map +0 -1
- package/dist/src/foundation/transparent-terminal/foreground-broker.js +0 -88
- package/dist/src/foundation/transparent-terminal/foreground-broker.js.map +0 -1
- package/dist/src/foundation/transparent-terminal/index.d.ts +0 -4
- package/dist/src/foundation/transparent-terminal/index.d.ts.map +0 -1
- package/dist/src/foundation/transparent-terminal/index.js +0 -4
- package/dist/src/foundation/transparent-terminal/index.js.map +0 -1
- package/dist/src/foundation/transparent-terminal/main.d.ts +0 -10
- package/dist/src/foundation/transparent-terminal/main.d.ts.map +0 -1
- package/dist/src/foundation/transparent-terminal/main.js +0 -107
- package/dist/src/foundation/transparent-terminal/main.js.map +0 -1
- package/dist/src/foundation/transparent-terminal/native-launcher.d.ts +0 -26
- package/dist/src/foundation/transparent-terminal/native-launcher.d.ts.map +0 -1
- package/dist/src/foundation/transparent-terminal/native-launcher.js +0 -147
- package/dist/src/foundation/transparent-terminal/native-launcher.js.map +0 -1
- package/dist/src/foundation/workspace-contracts/index.d.ts.map +0 -1
- package/dist/src/foundation/workspace-contracts/index.js.map +0 -1
- package/dist/src/foundation/workspace-contracts/model.d.ts.map +0 -1
- package/dist/src/foundation/workspace-contracts/model.js.map +0 -1
- package/dist/src/foundation/workspace-contracts/validation.d.ts.map +0 -1
- package/dist/src/foundation/workspace-contracts/validation.js.map +0 -1
- /package/bin/{addone-supervisor.js → supervisor.js} +0 -0
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { AGENT_ENGINE_CONTRACT_VERSION, } from "./model.js";
|
|
2
|
+
import { assertAgentMessage } from "./domain-validation.js";
|
|
3
|
+
const COMMANDS = new Set(["prompt", "steer", "follow-up", "abort", "retry", "compact", "bash", "replace-session"]);
|
|
4
|
+
const EVENTS = new Set(["lifecycle", "content", "command-outcome", "snapshot-invalidated", "diagnostic"]);
|
|
5
|
+
const LIFECYCLES = new Set(["starting", "ready", "busy", "stopping", "stopped", "failed"]);
|
|
6
|
+
const OUTCOMES = new Set(["accepted", "completed", "rejected", "failed", "cancelled"]);
|
|
7
|
+
const MAX_TEXT_BYTES = 256 * 1024;
|
|
8
|
+
const MAX_COLLECTION = 10_000;
|
|
9
|
+
export function assertAgentCapabilityContract(value) {
|
|
10
|
+
assertVersion(value.contractVersion);
|
|
11
|
+
assertUniqueEnum(value.commands, COMMANDS, "agent command capabilities");
|
|
12
|
+
assertUniqueEnum(value.events, EVENTS, "agent event capabilities");
|
|
13
|
+
if (typeof value.snapshots?.supported !== "boolean" || !Number.isSafeInteger(value.snapshots.maxBytes) || value.snapshots.maxBytes < 1024) {
|
|
14
|
+
throw new TypeError("agent snapshot capability is invalid");
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export function assertAgentCommand(command, capabilities) {
|
|
18
|
+
assertVersion(command.contractVersion);
|
|
19
|
+
assertId(command.commandId, "agent command id");
|
|
20
|
+
assertId(command.sessionId, "agent command session id");
|
|
21
|
+
if (!COMMANDS.has(command.type))
|
|
22
|
+
throw new TypeError("agent command type is unknown");
|
|
23
|
+
if (capabilities !== undefined) {
|
|
24
|
+
assertAgentCapabilityContract(capabilities);
|
|
25
|
+
if (!capabilities.commands.includes(command.type))
|
|
26
|
+
throw new TypeError(`agent command capability is unavailable: ${command.type}`);
|
|
27
|
+
}
|
|
28
|
+
if (command.type === "prompt" || command.type === "steer" || command.type === "follow-up")
|
|
29
|
+
assertText(command.text, "agent command text");
|
|
30
|
+
if (command.type === "bash")
|
|
31
|
+
assertText(command.command, "agent bash command");
|
|
32
|
+
if (command.type === "replace-session" && command.source.kind === "resume")
|
|
33
|
+
assertText(command.source.sessionPath, "agent resume path");
|
|
34
|
+
}
|
|
35
|
+
export function assertAgentEvent(event, capabilities) {
|
|
36
|
+
assertVersion(event.contractVersion);
|
|
37
|
+
assertId(event.sessionId, "agent event session id");
|
|
38
|
+
assertNonNegative(event.sequence, "agent event sequence");
|
|
39
|
+
if (!EVENTS.has(event.type))
|
|
40
|
+
throw new TypeError("agent event type is unknown");
|
|
41
|
+
if (capabilities !== undefined) {
|
|
42
|
+
assertAgentCapabilityContract(capabilities);
|
|
43
|
+
if (!capabilities.events.includes(event.type))
|
|
44
|
+
throw new TypeError(`agent event capability is unavailable: ${event.type}`);
|
|
45
|
+
}
|
|
46
|
+
switch (event.type) {
|
|
47
|
+
case "lifecycle":
|
|
48
|
+
if (!LIFECYCLES.has(event.lifecycle))
|
|
49
|
+
throw new TypeError("agent lifecycle is invalid");
|
|
50
|
+
if (event.reason !== null)
|
|
51
|
+
assertText(event.reason, "agent lifecycle reason");
|
|
52
|
+
return;
|
|
53
|
+
case "content":
|
|
54
|
+
assertAgentMessage(event.content);
|
|
55
|
+
return;
|
|
56
|
+
case "command-outcome":
|
|
57
|
+
assertId(event.commandId, "agent outcome command id");
|
|
58
|
+
if (!OUTCOMES.has(event.outcome))
|
|
59
|
+
throw new TypeError("agent command outcome is invalid");
|
|
60
|
+
if (event.diagnostic !== null)
|
|
61
|
+
assertText(event.diagnostic, "agent outcome diagnostic");
|
|
62
|
+
return;
|
|
63
|
+
case "snapshot-invalidated":
|
|
64
|
+
assertNonNegative(event.expectedRevision, "agent expected snapshot revision");
|
|
65
|
+
return;
|
|
66
|
+
case "diagnostic":
|
|
67
|
+
assertId(event.code, "agent diagnostic code");
|
|
68
|
+
assertText(event.message, "agent diagnostic message");
|
|
69
|
+
if (typeof event.recoverable !== "boolean")
|
|
70
|
+
throw new TypeError("agent diagnostic recovery flag is invalid");
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
export function assertAgentSnapshot(snapshot) {
|
|
74
|
+
assertVersion(snapshot.contractVersion);
|
|
75
|
+
assertId(snapshot.snapshotId, "agent snapshot id");
|
|
76
|
+
assertId(snapshot.sessionId, "agent snapshot session id");
|
|
77
|
+
assertNonNegative(snapshot.revision, "agent snapshot revision");
|
|
78
|
+
assertNonNegative(snapshot.sequence, "agent snapshot sequence");
|
|
79
|
+
if (!LIFECYCLES.has(snapshot.lifecycle))
|
|
80
|
+
throw new TypeError("agent snapshot lifecycle is invalid");
|
|
81
|
+
assertAgentCapabilityContract(snapshot.capabilities);
|
|
82
|
+
if (!Array.isArray(snapshot.content) || snapshot.content.length > MAX_COLLECTION)
|
|
83
|
+
throw new RangeError("agent snapshot content collection is invalid");
|
|
84
|
+
for (const content of snapshot.content)
|
|
85
|
+
assertAgentEvent({ contractVersion: AGENT_ENGINE_CONTRACT_VERSION, sessionId: snapshot.sessionId, sequence: snapshot.sequence, type: "content", content });
|
|
86
|
+
if (!Array.isArray(snapshot.activeCommandIds) || snapshot.activeCommandIds.length > MAX_COLLECTION)
|
|
87
|
+
throw new RangeError("agent active command collection is invalid");
|
|
88
|
+
const ids = new Set();
|
|
89
|
+
for (const id of snapshot.activeCommandIds) {
|
|
90
|
+
assertId(id, "agent active command id");
|
|
91
|
+
if (ids.has(id))
|
|
92
|
+
throw new TypeError(`duplicate agent active command id: ${id}`);
|
|
93
|
+
ids.add(id);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
function assertVersion(version) {
|
|
97
|
+
if (version !== AGENT_ENGINE_CONTRACT_VERSION)
|
|
98
|
+
throw new TypeError("unsupported agent engine contract version");
|
|
99
|
+
}
|
|
100
|
+
function assertUniqueEnum(values, allowed, label) {
|
|
101
|
+
if (!Array.isArray(values))
|
|
102
|
+
throw new TypeError(`${label} must be an array`);
|
|
103
|
+
const unique = new Set();
|
|
104
|
+
for (const value of values) {
|
|
105
|
+
if (!allowed.has(value))
|
|
106
|
+
throw new TypeError(`${label} contains an unknown value: ${String(value)}`);
|
|
107
|
+
if (unique.has(value))
|
|
108
|
+
throw new TypeError(`${label} contains a duplicate value: ${String(value)}`);
|
|
109
|
+
unique.add(value);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
function assertId(value, label) {
|
|
113
|
+
if (typeof value !== "string" || !/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/.test(value))
|
|
114
|
+
throw new TypeError(`${label} is invalid`);
|
|
115
|
+
}
|
|
116
|
+
function assertText(value, label) {
|
|
117
|
+
if (typeof value !== "string" || value.length === 0)
|
|
118
|
+
throw new TypeError(`${label} is invalid`);
|
|
119
|
+
assertPossiblyEmptyText(value, label);
|
|
120
|
+
}
|
|
121
|
+
function assertPossiblyEmptyText(value, label) {
|
|
122
|
+
if (typeof value !== "string" || Buffer.byteLength(value, "utf8") > MAX_TEXT_BYTES)
|
|
123
|
+
throw new RangeError(`${label} exceeds its byte limit`);
|
|
124
|
+
}
|
|
125
|
+
function assertNonNegative(value, label) {
|
|
126
|
+
if (!Number.isSafeInteger(value) || value < 0)
|
|
127
|
+
throw new TypeError(`${label} is invalid`);
|
|
128
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./main.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./main.js";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { LaunchInstanceStopIntent, LaunchProfileId, SupervisorCommand } from "../lifecycle/index.js";
|
|
2
|
+
import { type NativeProcessInspector, type ProcessContainment } from "../process-containment/index.js";
|
|
3
|
+
interface GuardianControl {
|
|
4
|
+
connect(endpoint: string, timeoutMs?: number): Promise<unknown>;
|
|
5
|
+
command(command: SupervisorCommand): Promise<{
|
|
6
|
+
readonly ok: boolean;
|
|
7
|
+
readonly error?: {
|
|
8
|
+
readonly code: string;
|
|
9
|
+
readonly message: string;
|
|
10
|
+
};
|
|
11
|
+
}>;
|
|
12
|
+
on(event: "stopIntent", listener: (intent: LaunchInstanceStopIntent) => void): unknown;
|
|
13
|
+
on(event: "disconnect", listener: () => void): unknown;
|
|
14
|
+
off(event: "stopIntent", listener: (intent: LaunchInstanceStopIntent) => void): unknown;
|
|
15
|
+
off(event: "disconnect", listener: () => void): unknown;
|
|
16
|
+
close(): void;
|
|
17
|
+
}
|
|
18
|
+
export interface LaunchGuardianOptions {
|
|
19
|
+
readonly profileId: LaunchProfileId;
|
|
20
|
+
readonly releaseRoot: string;
|
|
21
|
+
readonly uiEntry: string;
|
|
22
|
+
readonly environment?: NodeJS.ProcessEnv;
|
|
23
|
+
readonly cwd?: string;
|
|
24
|
+
readonly helperPath?: string;
|
|
25
|
+
readonly inspector?: NativeProcessInspector;
|
|
26
|
+
readonly control?: GuardianControl;
|
|
27
|
+
readonly containment?: ProcessContainment;
|
|
28
|
+
readonly ensureHelper?: (path: string) => Promise<void>;
|
|
29
|
+
}
|
|
30
|
+
export declare function runLaunchGuardian(options: LaunchGuardianOptions): Promise<number>;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { PRODUCT_IDENTITY } from "../../product-identity.js";
|
|
3
|
+
import { resolve } from "node:path";
|
|
4
|
+
import { assertLaunchProfileId } from "../lifecycle/index.js";
|
|
5
|
+
import { closeVerifiedContainment, LinuxNativeProcessInspector, NativeGuardianContainment, resolveProcessGuardianPath, verifyProcessGuardianArtifact, WindowsNativeProcessInspector, } from "../process-containment/index.js";
|
|
6
|
+
import { SupervisorClient } from "../protocol/index.js";
|
|
7
|
+
import { resolveProductPaths } from "../supervision/index.js";
|
|
8
|
+
export async function runLaunchGuardian(options) {
|
|
9
|
+
assertLaunchProfileId(options.profileId);
|
|
10
|
+
const environment = { ...(options.environment ?? process.env) };
|
|
11
|
+
const paths = resolveProductPaths(environment);
|
|
12
|
+
const instanceId = randomUUID();
|
|
13
|
+
const helperPath = options.helperPath ?? resolveProcessGuardianPath(options.releaseRoot, environment);
|
|
14
|
+
const inspector = options.inspector ?? platformInspector(helperPath);
|
|
15
|
+
await (options.ensureHelper ?? verifyProcessGuardianArtifact)(helperPath);
|
|
16
|
+
const guardianIdentity = await inspector.observe(process.pid);
|
|
17
|
+
if (!guardianIdentity)
|
|
18
|
+
throw diagnosticError("launch guardian cannot verify its own native process identity", "PROCESS_IDENTITY_UNAVAILABLE");
|
|
19
|
+
const client = options.control ?? new SupervisorClient(environment[PRODUCT_IDENTITY.environment.releaseId]);
|
|
20
|
+
await client.connect(paths.endpoint);
|
|
21
|
+
const containment = options.containment ?? new NativeGuardianContainment(instanceId, helperPath, resolve(paths.runtimeDir, "launch-instances", `${instanceId}.ready.json`));
|
|
22
|
+
const stop = stopRequests(client, instanceId);
|
|
23
|
+
let rootIdentity = null;
|
|
24
|
+
try {
|
|
25
|
+
await requireAccepted(client, {
|
|
26
|
+
type: "create-launch-instance",
|
|
27
|
+
requestId: randomUUID(),
|
|
28
|
+
instanceId,
|
|
29
|
+
profileId: options.profileId,
|
|
30
|
+
shutdownPolicy: "terminate-tree-on-close",
|
|
31
|
+
guardianIdentity,
|
|
32
|
+
});
|
|
33
|
+
let handle;
|
|
34
|
+
try {
|
|
35
|
+
handle = await containment.spawn(process.execPath, [options.uiEntry], {
|
|
36
|
+
cwd: options.cwd ?? process.cwd(),
|
|
37
|
+
environment: environmentEntries(environment),
|
|
38
|
+
...(environment.TERM ? { terminalType: environment.TERM } : {}),
|
|
39
|
+
});
|
|
40
|
+
rootIdentity = handle.identity;
|
|
41
|
+
await requireAccepted(client, {
|
|
42
|
+
type: "activate-launch-instance",
|
|
43
|
+
requestId: randomUUID(),
|
|
44
|
+
instanceId,
|
|
45
|
+
rootIdentity,
|
|
46
|
+
containmentIdentity: containment.identity,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
const outcome = failureOutcome(error, "guardian-error");
|
|
51
|
+
await completeBestEffort(client, instanceId, "completed", outcome);
|
|
52
|
+
throw error;
|
|
53
|
+
}
|
|
54
|
+
const outcome = await Promise.race([
|
|
55
|
+
handle.outcome,
|
|
56
|
+
stop.requested.then(async (reason) => {
|
|
57
|
+
if (reason !== "supervisor-disconnect") {
|
|
58
|
+
await requireAccepted(client, {
|
|
59
|
+
type: "begin-launch-instance-stop",
|
|
60
|
+
requestId: randomUUID(),
|
|
61
|
+
instanceId,
|
|
62
|
+
reason,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
if (!rootIdentity)
|
|
66
|
+
return failureOutcome(new Error("launch root identity is unavailable"), "cleanup-error");
|
|
67
|
+
const result = await closeVerifiedContainment(containment, inspector, rootIdentity, reason);
|
|
68
|
+
await containment.close();
|
|
69
|
+
if (reason === "supervisor-disconnect" && result.outcome.kind === "stopped") {
|
|
70
|
+
return {
|
|
71
|
+
kind: "interrupted",
|
|
72
|
+
reason,
|
|
73
|
+
message: "supervisor disconnected after local launch-instance containment closed",
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
return result.outcome;
|
|
77
|
+
}),
|
|
78
|
+
]);
|
|
79
|
+
await containment.close();
|
|
80
|
+
if (outcome.kind !== "interrupted" || outcome.reason !== "supervisor-disconnect") {
|
|
81
|
+
await completeBestEffort(client, instanceId, outcome.kind === "interrupted" || outcome.kind === "cleanup-error" ? "interrupted" : "completed", outcome);
|
|
82
|
+
}
|
|
83
|
+
return exitCode(outcome);
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
await containment.close().catch(() => undefined);
|
|
87
|
+
throw error;
|
|
88
|
+
}
|
|
89
|
+
finally {
|
|
90
|
+
stop.dispose();
|
|
91
|
+
client.close();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
function platformInspector(helperPath) {
|
|
95
|
+
if (process.platform === "win32")
|
|
96
|
+
return new WindowsNativeProcessInspector(helperPath);
|
|
97
|
+
if (process.platform === "linux")
|
|
98
|
+
return new LinuxNativeProcessInspector();
|
|
99
|
+
throw diagnosticError(`launch-instance process containment is unsupported on ${process.platform}`, "CONTAINMENT_UNSUPPORTED");
|
|
100
|
+
}
|
|
101
|
+
function stopRequests(client, instanceId) {
|
|
102
|
+
let resolveStop;
|
|
103
|
+
let settled = false;
|
|
104
|
+
const requested = new Promise(resolvePromise => { resolveStop = resolvePromise; });
|
|
105
|
+
const request = (reason) => {
|
|
106
|
+
if (settled)
|
|
107
|
+
return;
|
|
108
|
+
settled = true;
|
|
109
|
+
resolveStop(reason);
|
|
110
|
+
};
|
|
111
|
+
const onStopIntent = (intent) => {
|
|
112
|
+
if (intent.instanceId === instanceId)
|
|
113
|
+
request(intent.reason);
|
|
114
|
+
};
|
|
115
|
+
const onDisconnect = () => request("supervisor-disconnect");
|
|
116
|
+
const onSigterm = () => request("user-request");
|
|
117
|
+
const onSigint = () => undefined;
|
|
118
|
+
client.on("stopIntent", onStopIntent);
|
|
119
|
+
client.on("disconnect", onDisconnect);
|
|
120
|
+
process.once("SIGTERM", onSigterm);
|
|
121
|
+
process.on("SIGINT", onSigint);
|
|
122
|
+
return {
|
|
123
|
+
requested,
|
|
124
|
+
dispose() {
|
|
125
|
+
client.off("stopIntent", onStopIntent);
|
|
126
|
+
client.off("disconnect", onDisconnect);
|
|
127
|
+
process.off("SIGTERM", onSigterm);
|
|
128
|
+
process.off("SIGINT", onSigint);
|
|
129
|
+
},
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
async function requireAccepted(client, command) {
|
|
133
|
+
const result = await client.command(command);
|
|
134
|
+
if (!result.ok)
|
|
135
|
+
throw diagnosticError(result.error?.message ?? `supervisor rejected ${command.type}`, result.error?.code ?? "SUPERVISOR_REJECTED");
|
|
136
|
+
}
|
|
137
|
+
async function completeBestEffort(client, instanceId, terminalState, outcome) {
|
|
138
|
+
await requireAccepted(client, {
|
|
139
|
+
type: "complete-launch-instance",
|
|
140
|
+
requestId: randomUUID(),
|
|
141
|
+
instanceId,
|
|
142
|
+
terminalState,
|
|
143
|
+
outcome,
|
|
144
|
+
}).catch(() => undefined);
|
|
145
|
+
}
|
|
146
|
+
function environmentEntries(environment) {
|
|
147
|
+
return Object.fromEntries(Object.entries(environment).filter((entry) => entry[1] !== undefined));
|
|
148
|
+
}
|
|
149
|
+
function failureOutcome(error, kind) {
|
|
150
|
+
return {
|
|
151
|
+
kind,
|
|
152
|
+
message: error instanceof Error ? error.message : String(error),
|
|
153
|
+
code: error instanceof Error && "code" in error && typeof error.code === "string" ? error.code : null,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
function exitCode(outcome) {
|
|
157
|
+
if (outcome.kind === "exited")
|
|
158
|
+
return outcome.exitCode;
|
|
159
|
+
if (outcome.kind === "stopped")
|
|
160
|
+
return 0;
|
|
161
|
+
return 1;
|
|
162
|
+
}
|
|
163
|
+
function diagnosticError(message, code) {
|
|
164
|
+
return Object.assign(new Error(`A1: ${message}`), { code });
|
|
165
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { LaunchInstanceId, LaunchInstanceOutcome, LaunchInstanceShutdownPolicy, LaunchInstanceStopReason, ProcessContainmentIdentity } from "./launch-instance.js";
|
|
2
|
+
import type { LaunchProfileId, NativeProcessIdentity, RequestId } from "./model.js";
|
|
3
|
+
export type SupervisorCommand = {
|
|
4
|
+
readonly type: "create-launch-instance";
|
|
5
|
+
readonly requestId: RequestId;
|
|
6
|
+
readonly instanceId: LaunchInstanceId;
|
|
7
|
+
readonly profileId: LaunchProfileId;
|
|
8
|
+
readonly shutdownPolicy: LaunchInstanceShutdownPolicy;
|
|
9
|
+
readonly guardianIdentity: NativeProcessIdentity;
|
|
10
|
+
} | {
|
|
11
|
+
readonly type: "activate-launch-instance";
|
|
12
|
+
readonly requestId: RequestId;
|
|
13
|
+
readonly instanceId: LaunchInstanceId;
|
|
14
|
+
readonly rootIdentity: NativeProcessIdentity;
|
|
15
|
+
readonly containmentIdentity: ProcessContainmentIdentity;
|
|
16
|
+
} | {
|
|
17
|
+
readonly type: "begin-launch-instance-stop";
|
|
18
|
+
readonly requestId: RequestId;
|
|
19
|
+
readonly instanceId: LaunchInstanceId;
|
|
20
|
+
readonly reason: LaunchInstanceStopReason;
|
|
21
|
+
} | {
|
|
22
|
+
readonly type: "complete-launch-instance";
|
|
23
|
+
readonly requestId: RequestId;
|
|
24
|
+
readonly instanceId: LaunchInstanceId;
|
|
25
|
+
readonly terminalState: "completed" | "interrupted";
|
|
26
|
+
readonly outcome: LaunchInstanceOutcome;
|
|
27
|
+
} | {
|
|
28
|
+
readonly type: "reconcile-launch-instance";
|
|
29
|
+
readonly requestId: RequestId;
|
|
30
|
+
readonly instanceId: LaunchInstanceId;
|
|
31
|
+
} | {
|
|
32
|
+
readonly type: "resynchronize";
|
|
33
|
+
readonly requestId: RequestId;
|
|
34
|
+
};
|
|
35
|
+
export interface LaunchInstanceStopIntent {
|
|
36
|
+
readonly type: "stop-launch-instance";
|
|
37
|
+
readonly requestId: RequestId;
|
|
38
|
+
readonly instanceId: LaunchInstanceId;
|
|
39
|
+
readonly reason: LaunchInstanceStopReason;
|
|
40
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
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;
|
|
@@ -0,0 +1,134 @@
|
|
|
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,8 +1,7 @@
|
|
|
1
|
-
export type LaunchProfileId = "
|
|
1
|
+
export type LaunchProfileId = "a1" | "pi" | "sandbox";
|
|
2
2
|
export type GenerationId = string;
|
|
3
3
|
export type DriverProfileId = string;
|
|
4
4
|
export type RequestId = string;
|
|
5
|
-
export type ForegroundTerminalLeaseId = string;
|
|
6
5
|
export interface TerminalDimensions {
|
|
7
6
|
readonly columns: number;
|
|
8
7
|
readonly rows: number;
|
|
@@ -42,55 +41,20 @@ export type TransparentTerminalLifecycleOutcome = {
|
|
|
42
41
|
readonly message: string;
|
|
43
42
|
readonly code: string | null;
|
|
44
43
|
};
|
|
45
|
-
export type ForegroundTerminalLeaseState = "requested" | "active" | "released";
|
|
46
|
-
export interface ForegroundTerminalLease {
|
|
47
|
-
readonly id: ForegroundTerminalLeaseId;
|
|
48
|
-
readonly ownerId: string;
|
|
49
|
-
readonly profile: TransparentTerminalLaunchProfile;
|
|
50
|
-
readonly state: ForegroundTerminalLeaseState;
|
|
51
|
-
readonly generationId: GenerationId | null;
|
|
52
|
-
readonly processIdentity: NativeProcessIdentity | null;
|
|
53
|
-
readonly acquiredAt: string;
|
|
54
|
-
readonly heartbeatAt: string | null;
|
|
55
|
-
readonly releasedAt: string | null;
|
|
56
|
-
readonly outcome: TransparentTerminalLifecycleOutcome | null;
|
|
57
|
-
}
|
|
58
44
|
export interface SupervisorSnapshot {
|
|
59
45
|
readonly revision: number;
|
|
46
|
+
readonly activeInstances: readonly {
|
|
47
|
+
readonly id: string;
|
|
48
|
+
readonly profileId: LaunchProfileId;
|
|
49
|
+
readonly state: "requested" | "active" | "stopping";
|
|
50
|
+
}[];
|
|
60
51
|
}
|
|
61
|
-
export type SupervisorCommand = {
|
|
62
|
-
readonly type: "acquire-foreground-terminal-lease";
|
|
63
|
-
readonly requestId: RequestId;
|
|
64
|
-
readonly leaseId: ForegroundTerminalLeaseId;
|
|
65
|
-
readonly ownerId: string;
|
|
66
|
-
readonly profile: TransparentTerminalLaunchProfile;
|
|
67
|
-
} | {
|
|
68
|
-
readonly type: "activate-foreground-terminal-lease";
|
|
69
|
-
readonly requestId: RequestId;
|
|
70
|
-
readonly leaseId: ForegroundTerminalLeaseId;
|
|
71
|
-
readonly generationId: GenerationId;
|
|
72
|
-
readonly processIdentity: NativeProcessIdentity;
|
|
73
|
-
} | {
|
|
74
|
-
readonly type: "heartbeat-foreground-terminal-lease";
|
|
75
|
-
readonly requestId: RequestId;
|
|
76
|
-
readonly leaseId: ForegroundTerminalLeaseId;
|
|
77
|
-
readonly processIdentity: NativeProcessIdentity;
|
|
78
|
-
} | {
|
|
79
|
-
readonly type: "release-foreground-terminal-lease";
|
|
80
|
-
readonly requestId: RequestId;
|
|
81
|
-
readonly leaseId: ForegroundTerminalLeaseId;
|
|
82
|
-
readonly processIdentity: NativeProcessIdentity | null;
|
|
83
|
-
readonly outcome: TransparentTerminalLifecycleOutcome;
|
|
84
|
-
} | {
|
|
85
|
-
readonly type: "resynchronize";
|
|
86
|
-
readonly requestId: RequestId;
|
|
87
|
-
};
|
|
88
52
|
export interface CommandResult {
|
|
89
53
|
readonly requestId: RequestId;
|
|
90
54
|
readonly ok: boolean;
|
|
91
55
|
readonly revision: number;
|
|
92
56
|
readonly error?: {
|
|
93
|
-
readonly code: "invalid-command" | "not-found" | "stale-generation" | "capability-error" | "driver-error";
|
|
57
|
+
readonly code: "invalid-command" | "not-found" | "stale-generation" | "capability-error" | "containment-unsupported" | "ownership-error" | "driver-error";
|
|
94
58
|
readonly message: string;
|
|
95
59
|
};
|
|
96
60
|
}
|
|
@@ -98,4 +62,3 @@ export declare function assertLaunchProfileId(value: unknown): asserts value is
|
|
|
98
62
|
export declare function assertDimensions(dimensions: TerminalDimensions): void;
|
|
99
63
|
export declare function assertTransparentTerminalLaunchProfile(profile: TransparentTerminalLaunchProfile): void;
|
|
100
64
|
export declare function assertNativeProcessIdentity(identity: NativeProcessIdentity): void;
|
|
101
|
-
//# sourceMappingURL=model.d.ts.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { PRODUCT_TEXT } from "../../product-identity.js";
|
|
1
2
|
export function assertLaunchProfileId(value) {
|
|
2
|
-
if (value !== "
|
|
3
|
-
throw new TypeError(`
|
|
3
|
+
if (value !== "a1" && value !== "pi" && value !== "sandbox")
|
|
4
|
+
throw new TypeError(PRODUCT_TEXT.diagnostic(`launch profile is invalid: ${String(value)}`));
|
|
4
5
|
}
|
|
5
6
|
export function assertDimensions(dimensions) {
|
|
6
7
|
if (!Number.isInteger(dimensions.columns) || dimensions.columns < 2 || dimensions.columns > 500) {
|
|
@@ -37,4 +38,3 @@ export function assertNativeProcessIdentity(identity) {
|
|
|
37
38
|
throw new TypeError("invalid native process identity");
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
|
-
//# sourceMappingURL=model.js.map
|