@timurproko/a1 0.1.8-dev.21b95d6 → 0.1.8-dev.226
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 +107 -67
- package/bin/cli.js +28 -10
- package/bin/guardian.js +4 -1
- package/bin/module-identity.js +69 -35
- package/bin/pi-tui.d.ts +6 -0
- package/bin/pi-tui.js +28 -0
- package/bin/release-cleanup.js +8 -0
- package/bin/supervisor.js +1 -1
- package/bin/sync-pi-tui-proxy.js +97 -0
- package/bin/ui.js +25 -6
- package/bin/warmup.js +18 -0
- package/dist/cli/capabilities.d.ts +6 -0
- package/dist/{src/cli → cli}/capabilities.js +1 -1
- package/dist/{src/cli → cli}/dispatch.d.ts +6 -0
- package/dist/cli/dispatch.js +202 -0
- package/dist/{src/cli → cli}/packages.d.ts +10 -2
- package/dist/{src/cli → cli}/packages.js +24 -20
- package/dist/{src/cli → cli}/version-stats.d.ts +6 -0
- package/dist/cli/version-stats.js +112 -0
- package/dist/composition/agent-engine-bridge.d.ts +3 -0
- package/dist/composition/agent-engine-bridge.js +108 -0
- package/dist/composition/index.d.ts +3 -0
- package/dist/composition/index.js +3 -0
- package/dist/composition/owned-ui.d.ts +28 -0
- package/dist/composition/owned-ui.js +64 -0
- package/dist/composition/process.d.ts +16 -0
- package/dist/composition/process.js +45 -0
- package/dist/composition/settings-route-host.d.ts +8 -0
- package/dist/composition/settings-route-host.js +75 -0
- package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/capability-ports.d.ts +2 -2
- package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/domain-validation.js +22 -4
- package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/domain.d.ts +17 -0
- package/dist/{src/foundation/owned-ui-contracts → contracts/owned-ui}/model.d.ts +36 -0
- package/dist/{src/foundation/owned-ui-contracts → contracts/owned-ui}/validation.js +25 -0
- package/dist/{src/features → features}/launch/development-launch.js +11 -3
- package/dist/{src/features → features}/launch/index.d.ts +0 -1
- package/dist/{src/features → features}/launch/index.js +0 -1
- package/dist/{src/features → features}/launch/intent.d.ts +3 -2
- package/dist/features/launch/intent.js +3 -0
- package/dist/{src/features → features}/launch/prepare-launch.d.ts +0 -2
- package/dist/{src/features → features}/launch/prepare-launch.js +2 -9
- package/dist/{src/features → features}/launch/profile-paths.d.ts +1 -2
- package/dist/{src/features → features}/launch/profile-paths.js +2 -8
- package/dist/{src/features → features}/launch/runtime-selection.d.ts +2 -5
- package/dist/{src/features → features}/owned-ui/customization.d.ts +3 -1
- package/dist/{src/features → features}/owned-ui/customization.js +3 -1
- package/dist/{src/features → features}/owned-ui/diagnostics.d.ts +2 -1
- package/dist/{src/features → features}/owned-ui/diagnostics.js +1 -0
- package/dist/{src/features → features}/owned-ui/index.d.ts +1 -0
- package/dist/{src/features → features}/owned-ui/index.js +1 -0
- package/dist/features/owned-ui/project-trust-prompt.d.ts +25 -0
- package/dist/features/owned-ui/project-trust-prompt.js +149 -0
- package/dist/{src/features → features}/owned-ui/run.d.ts +2 -2
- package/dist/{src/features → features}/owned-ui/run.js +2 -0
- package/dist/{src/features → features}/owned-ui/settings-app.d.ts +3 -3
- package/dist/{src/features → features}/owned-ui/settings-app.js +103 -54
- package/dist/{src/features → features}/workspace/capabilities.d.ts +1 -1
- package/dist/{src/features → features}/workspace/reducer.d.ts +2 -1
- package/dist/{src/features → features}/workspace/reducer.js +2 -1
- package/dist/{src/features → features}/workspace/router.d.ts +2 -1
- package/dist/{src/features → features}/workspace/router.js +1 -0
- package/dist/{src/features → features}/workspace/store.d.ts +2 -1
- package/dist/{src/features → features}/workspace/store.js +1 -0
- package/dist/{src/foundation → foundation}/launch-guardian/main.js +10 -2
- package/dist/{src/foundation → foundation}/lifecycle/model.d.ts +1 -1
- package/dist/{src/foundation → foundation}/lifecycle/model.js +1 -1
- package/dist/foundation/lifecycle/paths.d.ts +28 -0
- package/dist/{src/foundation → foundation}/lifecycle/paths.js +21 -0
- package/dist/{src/foundation → foundation}/native-host-protocol/codec.d.ts +2 -0
- package/dist/{src/foundation → foundation}/native-host-protocol/codec.js +2 -0
- package/dist/{src/foundation → foundation}/native-host-protocol/messages.d.ts +1 -1
- package/dist/{src/foundation → foundation}/native-host-protocol/messages.js +1 -1
- package/dist/{src/foundation → foundation}/process-containment/linux-process-inspector.d.ts +1 -0
- package/dist/{src/foundation → foundation}/process-containment/linux-process-inspector.js +1 -0
- package/dist/{src/foundation → foundation}/process-containment/native-guardian-containment.d.ts +1 -0
- package/dist/{src/foundation → foundation}/process-containment/native-guardian-containment.js +1 -0
- package/dist/{src/foundation → foundation}/process-containment/windows-process-inspector.d.ts +1 -0
- package/dist/{src/foundation → foundation}/process-containment/windows-process-inspector.js +1 -0
- package/dist/{src/foundation → foundation}/protocol/client.d.ts +1 -0
- package/dist/{src/foundation → foundation}/protocol/client.js +1 -0
- package/dist/{src/foundation → foundation}/protocol/messages.d.ts +1 -0
- package/dist/{src/foundation → foundation}/protocol/messages.js +1 -0
- package/dist/{src/foundation → foundation}/release/bootstrap.d.ts +14 -4
- package/dist/{src/foundation → foundation}/release/bootstrap.js +66 -13
- package/dist/foundation/release/cohort-state.d.ts +156 -0
- package/dist/foundation/release/cohort-state.js +471 -0
- package/dist/foundation/release/dependency-layer.d.ts +78 -0
- package/dist/foundation/release/dependency-layer.js +487 -0
- package/dist/foundation/release/endpoints.d.ts +20 -0
- package/dist/foundation/release/endpoints.js +50 -0
- package/dist/{src/foundation → foundation}/release/index.d.ts +3 -0
- package/dist/{src/foundation → foundation}/release/index.js +3 -0
- package/dist/foundation/release/release-gc.d.ts +71 -0
- package/dist/foundation/release/release-gc.js +734 -0
- package/dist/{src/foundation → foundation}/release/release-store.d.ts +3 -1
- package/dist/{src/foundation → foundation}/release/release-store.js +60 -10
- package/dist/{src/foundation → foundation}/release/release.d.ts +4 -1
- package/dist/{src/foundation → foundation}/release/release.js +10 -3
- package/dist/{src/foundation → foundation}/release/update-transaction.d.ts +1 -0
- package/dist/{src/foundation → foundation}/release/update-transaction.js +1 -0
- package/dist/{src/foundation → foundation}/release/update.d.ts +19 -3
- package/dist/{src/foundation → foundation}/release/update.js +114 -54
- package/dist/foundation/release/warmup.d.ts +3 -0
- package/dist/foundation/release/warmup.js +35 -0
- package/dist/foundation/startup/index.d.ts +1 -0
- package/dist/foundation/startup/index.js +1 -0
- package/dist/foundation/startup/startup-runtime.d.ts +36 -0
- package/dist/foundation/startup/startup-runtime.js +140 -0
- package/dist/{src/foundation → foundation}/storage/control-store.d.ts +2 -1
- package/dist/{src/foundation → foundation}/storage/control-store.js +39 -4
- package/dist/{src/foundation → foundation}/structured-agent-runtime/backpressure.d.ts +2 -1
- package/dist/{src/foundation → foundation}/structured-agent-runtime/backpressure.js +2 -1
- package/dist/{src/foundation → foundation}/structured-agent-runtime/commands.d.ts +2 -1
- package/dist/{src/foundation → foundation}/structured-agent-runtime/commands.js +2 -1
- package/dist/{src/foundation → foundation}/structured-agent-runtime/handshake.d.ts +1 -1
- package/dist/{src/foundation → foundation}/structured-agent-runtime/handshake.js +1 -1
- package/dist/{src/foundation → foundation}/structured-agent-runtime/reconnection.d.ts +2 -1
- package/dist/{src/foundation → foundation}/structured-agent-runtime/reconnection.js +2 -1
- package/dist/{src/foundation → foundation}/structured-agent-runtime/state.d.ts +2 -1
- package/dist/{src/foundation → foundation}/structured-agent-runtime/state.js +2 -1
- package/dist/foundation/supervision/index.d.ts +3 -0
- package/dist/foundation/supervision/index.js +3 -0
- package/dist/{src/foundation → foundation}/supervision/main.js +11 -5
- package/dist/foundation/supervision/paths.d.ts +1 -0
- package/dist/foundation/supervision/paths.js +1 -0
- package/dist/{src/foundation → foundation}/supervision/server.d.ts +19 -1
- package/dist/{src/foundation → foundation}/supervision/server.js +51 -2
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/components.d.ts +1 -1
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/conformance.d.ts +1 -0
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/conformance.js +3 -2
- package/dist/integrations/pi/components/owned-editor-ux.d.ts +55 -0
- package/dist/integrations/pi/components/owned-editor-ux.js +778 -0
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-components.d.ts +1 -0
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-components.js +1 -0
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-editor-autocomplete.js +54 -6
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-extension-ui.d.ts +1 -1
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-footer-status.d.ts +3 -3
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-footer-status.js +32 -17
- package/dist/integrations/pi/components/shell-presenters-info.d.ts +36 -0
- package/dist/integrations/pi/components/shell-presenters-info.js +78 -0
- package/dist/integrations/pi/components/shell-presenters-transcript.d.ts +25 -0
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-presenters-transcript.js +92 -131
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-selectors-dialogs.d.ts +1 -1
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-shared-facade.d.ts +52 -8
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-shared-facade.js +4 -2
- package/dist/integrations/pi/components/submitted-prompt-adapter.d.ts +13 -0
- package/dist/integrations/pi/components/submitted-prompt-adapter.js +27 -0
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/adjacent/core/keybindings.d.ts +10 -2
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/adjacent/core/keybindings.js +36 -3
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/session-footer.d.ts +1 -1
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/adapter.d.ts +22 -4
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/adapter.js +289 -68
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/conformance.d.ts +2 -0
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/conformance.js +4 -2
- package/dist/integrations/pi/engine/http-dispatcher.d.ts +4 -0
- package/dist/integrations/pi/engine/http-dispatcher.js +25 -0
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/index.d.ts +3 -0
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/index.js +3 -0
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/model-auth-integration.d.ts +2 -1
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/model-auth-integration.js +1 -0
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/package-integration.d.ts +1 -1
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/package-integration.js +2 -2
- package/dist/integrations/pi/engine/project-trust-preflight.d.ts +22 -0
- package/dist/integrations/pi/engine/project-trust-preflight.js +50 -0
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/resource-extension-integration.d.ts +2 -1
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/resource-extension-integration.js +1 -0
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/runtime-integration.d.ts +16 -1
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/runtime-integration.js +39 -4
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/session-integration.d.ts +4 -2
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/session-integration.js +19 -4
- package/dist/integrations/pi/engine/settings-effects.d.ts +66 -0
- package/dist/integrations/pi/engine/settings-effects.js +249 -0
- package/dist/integrations/pi/engine/settings-integration.d.ts +43 -0
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/settings-integration.js +102 -108
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/workflow-controllers.d.ts +3 -2
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/workflow-controllers.js +1 -0
- package/dist/integrations/pi/session-ui/clipboard-image.d.ts +11 -0
- package/dist/integrations/pi/session-ui/clipboard-image.js +29 -0
- package/dist/{src/foundation/pi-owned-ui-integration → integrations/pi/session-ui}/index.d.ts +1 -0
- package/dist/{src/foundation/pi-owned-ui-integration → integrations/pi/session-ui}/index.js +1 -0
- package/dist/integrations/pi/session-ui/prompt-chips.d.ts +23 -0
- package/dist/integrations/pi/session-ui/prompt-chips.js +246 -0
- package/dist/integrations/pi/session-ui/route-host.d.ts +5 -0
- package/dist/integrations/pi/session-ui/session-shell-root.d.ts +137 -0
- package/dist/integrations/pi/session-ui/session-shell-root.js +1106 -0
- package/dist/integrations/pi/session-ui/session-shell.d.ts +55 -0
- package/dist/{src/foundation/pi-owned-ui-integration → integrations/pi/session-ui}/session-shell.js +415 -775
- package/dist/integrations/pi/session-ui/session-viewport-controller.d.ts +44 -0
- package/dist/integrations/pi/session-ui/session-viewport-controller.js +434 -0
- package/dist/integrations/pi/session-ui/stream-presentation-coalescer.d.ts +29 -0
- package/dist/integrations/pi/session-ui/stream-presentation-coalescer.js +79 -0
- package/dist/integrations/pi/session-ui/system-clipboard.d.ts +20 -0
- package/dist/integrations/pi/session-ui/system-clipboard.js +130 -0
- package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/adapter.d.ts +8 -1
- package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/adapter.js +216 -9
- package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/contracts.d.ts +29 -6
- package/dist/integrations/pi/tui-runtime/damage-aware-terminal.d.ts +63 -0
- package/dist/integrations/pi/tui-runtime/damage-aware-terminal.js +240 -0
- package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/index.d.ts +2 -0
- package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/index.js +2 -0
- package/dist/integrations/pi/tui-runtime/input-presentation-coordinator.d.ts +39 -0
- package/dist/integrations/pi/tui-runtime/input-presentation-coordinator.js +139 -0
- package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/presentation-adapter.d.ts +1 -1
- package/dist/native/darwin-arm64/manifest.json +1 -1
- package/dist/native/linux-x64/manifest.json +3 -3
- package/dist/native/linux-x64/process-guardian +0 -0
- package/dist/native/win32-x64/manifest.json +3 -3
- package/dist/native/win32-x64/process-guardian.exe +0 -0
- package/dist/{src/product-identity.d.ts → product-identity.d.ts} +3 -3
- package/dist/{src/product-identity.js → product-identity.js} +7 -5
- package/dist/{src/product-identity.json → product-identity.json} +11 -6
- package/dist/runtime-payload-inventory.json +122328 -0
- package/dist/{src/foundation/ui-apps → ui/apps}/contracts.d.ts +23 -1
- package/dist/{src/foundation/ui-apps → ui/apps}/host.d.ts +1 -1
- package/dist/{src/foundation/ui-apps → ui/apps}/host.js +14 -10
- package/dist/{src/foundation/ui-apps → ui/apps}/registry.d.ts +1 -0
- package/dist/{src/foundation/ui-apps → ui/apps}/registry.js +1 -0
- package/dist/{src/foundation/ui-components → ui/components}/dialog-panel.js +5 -3
- package/dist/{src/foundation/ui-components → ui/components}/frame.d.ts +1 -0
- package/dist/{src/foundation/ui-components → ui/components}/frame.js +1 -0
- package/dist/{src/foundation/ui-components → ui/components}/index.d.ts +4 -0
- package/dist/{src/foundation/ui-components → ui/components}/index.js +4 -0
- package/dist/{src/foundation/ui-components → ui/components}/line-input.d.ts +1 -6
- package/dist/{src/foundation/ui-components → ui/components}/line-input.js +4 -9
- package/dist/{src/foundation/ui-components → ui/components}/list-view.d.ts +0 -6
- package/dist/{src/foundation/ui-components → ui/components}/list-view.js +14 -7
- package/dist/{src/foundation/ui-components → ui/components}/mouse.d.ts +10 -0
- package/dist/{src/foundation/ui-components → ui/components}/mouse.js +23 -0
- package/dist/ui/components/progress-status.d.ts +2 -0
- package/dist/ui/components/progress-status.js +4 -0
- package/dist/ui/components/prompt-row.d.ts +14 -0
- package/dist/ui/components/prompt-row.js +20 -0
- package/dist/{src/foundation/ui-components → ui/components}/scrollbar.d.ts +26 -0
- package/dist/{src/foundation/ui-components → ui/components}/scrollbar.js +35 -0
- package/dist/{src/foundation/ui-components → ui/components}/shortcuts.d.ts +1 -0
- package/dist/{src/foundation/ui-components → ui/components}/shortcuts.js +1 -0
- package/dist/ui/components/spans.d.ts +25 -0
- package/dist/ui/components/spans.js +257 -0
- package/dist/ui/components/submitted-prompt.d.ts +23 -0
- package/dist/ui/components/submitted-prompt.js +50 -0
- package/dist/{src/foundation/ui-components → ui/components}/surface.d.ts +0 -5
- package/dist/{src/foundation/ui-components → ui/components}/surface.js +1 -5
- package/dist/ui/components/text-selection.d.ts +62 -0
- package/dist/ui/components/text-selection.js +235 -0
- package/dist/{src/foundation/ui-components → ui/components}/text.d.ts +14 -0
- package/dist/{src/foundation/ui-components → ui/components}/text.js +66 -4
- package/dist/ui/components/transcript-viewport.d.ts +146 -0
- package/dist/ui/components/transcript-viewport.js +629 -0
- package/dist/{src/foundation/owned-ui-settings → ui/settings}/declarations.d.ts +8 -1
- package/dist/{src/foundation/owned-ui-settings → ui/settings}/declarations.js +33 -5
- package/dist/{src/foundation/owned-ui-settings → ui/settings}/migrations.d.ts +1 -1
- package/dist/{src/foundation/owned-ui-settings → ui/settings}/migrations.js +21 -2
- package/dist/{src/foundation/owned-ui-settings → ui/settings}/sections.d.ts +6 -19
- package/dist/{src/foundation/owned-ui-settings → ui/settings}/sections.js +32 -23
- package/dist/{src/foundation/owned-ui-settings → ui/settings}/session.d.ts +9 -17
- package/dist/{src/foundation/owned-ui-settings → ui/settings}/session.js +65 -55
- package/dist/{src/foundation/owned-ui-settings → ui/settings}/store.d.ts +1 -0
- package/dist/{src/foundation/owned-ui-settings → ui/settings}/store.js +2 -1
- package/docs/architecture/boundaries.md +9 -9
- package/docs/architecture/code-documentation.md +77 -0
- package/docs/architecture/project-structure.md +67 -30
- package/docs/architecture/resource-and-data-policy.md +1 -1
- package/docs/architecture/toolchain.md +10 -10
- package/docs/architecture/ui-reference-provenance.md +34 -5
- package/docs/ci-release-runbook.md +186 -79
- package/docs/features/launch-profiles.md +10 -19
- package/docs/manual-launch-instance-acceptance.md +12 -35
- package/docs/manual-owned-ui-checkpoint.md +78 -0
- package/docs/manual-pi-boundary-candidate.md +4 -5
- package/docs/manual-terminal-colour-check.md +4 -3
- package/docs/repository-governance-live-acceptance.md +77 -0
- package/package.json +37 -27
- package/dist/src/cli/capabilities.d.ts +0 -15
- package/dist/src/cli/dispatch.js +0 -177
- package/dist/src/cli/version-stats.js +0 -72
- package/dist/src/composition/index.d.ts +0 -48
- package/dist/src/composition/index.js +0 -258
- package/dist/src/features/launch/intent.js +0 -4
- package/dist/src/features/launch/profiles.d.ts +0 -12
- package/dist/src/features/launch/profiles.js +0 -26
- package/dist/src/foundation/lifecycle/paths.d.ts +0 -10
- package/dist/src/foundation/pi-component-adapter/shell-presenters-transcript.d.ts +0 -57
- package/dist/src/foundation/pi-engine-adapter/settings-integration.d.ts +0 -55
- package/dist/src/foundation/pi-owned-ui-integration/route-host.d.ts +0 -29
- package/dist/src/foundation/pi-owned-ui-integration/session-shell.d.ts +0 -112
- package/dist/src/foundation/release/cohort-state.d.ts +0 -70
- package/dist/src/foundation/release/cohort-state.js +0 -202
- package/dist/src/foundation/release/release-gc.d.ts +0 -5
- package/dist/src/foundation/release/release-gc.js +0 -16
- package/dist/src/foundation/supervision/index.d.ts +0 -3
- package/dist/src/foundation/supervision/index.js +0 -3
- package/dist/src/foundation/supervision/paths.d.ts +0 -1
- package/dist/src/foundation/supervision/paths.js +0 -1
- package/dist/src/foundation/ui-components/spans.d.ts +0 -7
- package/dist/src/foundation/ui-components/spans.js +0 -59
- package/docs/manual-transparent-checkpoint.md +0 -53
- /package/dist/{src/cli → cli}/index.d.ts +0 -0
- /package/dist/{src/cli → cli}/index.js +0 -0
- /package/dist/{src/cli → cli}/version.d.ts +0 -0
- /package/dist/{src/cli → cli}/version.js +0 -0
- /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/capability-ports.js +0 -0
- /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/domain-validation.d.ts +0 -0
- /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/domain.js +0 -0
- /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/index.d.ts +0 -0
- /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/index.js +0 -0
- /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/model.d.ts +0 -0
- /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/model.js +0 -0
- /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/package-ports.d.ts +0 -0
- /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/package-ports.js +0 -0
- /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/ports.d.ts +0 -0
- /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/ports.js +0 -0
- /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/serialization.d.ts +0 -0
- /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/serialization.js +0 -0
- /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/validation.d.ts +0 -0
- /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/validation.js +0 -0
- /package/dist/{src/foundation/owned-ui-contracts → contracts/owned-ui}/extension-ui.d.ts +0 -0
- /package/dist/{src/foundation/owned-ui-contracts → contracts/owned-ui}/extension-ui.js +0 -0
- /package/dist/{src/foundation/owned-ui-contracts → contracts/owned-ui}/index.d.ts +0 -0
- /package/dist/{src/foundation/owned-ui-contracts → contracts/owned-ui}/index.js +0 -0
- /package/dist/{src/foundation/owned-ui-contracts → contracts/owned-ui}/model.js +0 -0
- /package/dist/{src/foundation/owned-ui-contracts → contracts/owned-ui}/validation.d.ts +0 -0
- /package/dist/{src/foundation/presentation-contracts → contracts/presentation}/index.d.ts +0 -0
- /package/dist/{src/foundation/presentation-contracts → contracts/presentation}/index.js +0 -0
- /package/dist/{src/foundation/workspace-contracts → contracts/workspace}/index.d.ts +0 -0
- /package/dist/{src/foundation/workspace-contracts → contracts/workspace}/index.js +0 -0
- /package/dist/{src/foundation/workspace-contracts → contracts/workspace}/model.d.ts +0 -0
- /package/dist/{src/foundation/workspace-contracts → contracts/workspace}/model.js +0 -0
- /package/dist/{src/foundation/workspace-contracts → contracts/workspace}/validation.d.ts +0 -0
- /package/dist/{src/foundation/workspace-contracts → contracts/workspace}/validation.js +0 -0
- /package/dist/{src/features → features}/launch/development-launch.d.ts +0 -0
- /package/dist/{src/features → features}/launch/initialize-profile.d.ts +0 -0
- /package/dist/{src/features → features}/launch/initialize-profile.js +0 -0
- /package/dist/{src/features → features}/launch/runtime-selection.js +0 -0
- /package/dist/{src/features → features}/workspace/capabilities.js +0 -0
- /package/dist/{src/features → features}/workspace/index.d.ts +0 -0
- /package/dist/{src/features → features}/workspace/index.js +0 -0
- /package/dist/{src/features → features}/workspace/presentation.d.ts +0 -0
- /package/dist/{src/features → features}/workspace/presentation.js +0 -0
- /package/dist/{src/features → features}/workspace/reconciliation.d.ts +0 -0
- /package/dist/{src/features → features}/workspace/reconciliation.js +0 -0
- /package/dist/{src/foundation → foundation}/launch-guardian/index.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/launch-guardian/index.js +0 -0
- /package/dist/{src/foundation → foundation}/launch-guardian/main.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/lifecycle/commands.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/lifecycle/commands.js +0 -0
- /package/dist/{src/foundation → foundation}/lifecycle/index.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/lifecycle/index.js +0 -0
- /package/dist/{src/foundation → foundation}/lifecycle/launch-instance.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/lifecycle/launch-instance.js +0 -0
- /package/dist/{src/foundation → foundation}/native-host-protocol/evidence.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/native-host-protocol/evidence.js +0 -0
- /package/dist/{src/foundation → foundation}/native-host-protocol/index.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/native-host-protocol/index.js +0 -0
- /package/dist/{src/foundation → foundation}/native-host-protocol/proof-gate.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/native-host-protocol/proof-gate.js +0 -0
- /package/dist/{src/foundation → foundation}/process-containment/artifact.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/process-containment/artifact.js +0 -0
- /package/dist/{src/foundation → foundation}/process-containment/contracts.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/process-containment/contracts.js +0 -0
- /package/dist/{src/foundation → foundation}/process-containment/index.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/process-containment/index.js +0 -0
- /package/dist/{src/foundation → foundation}/protocol/index.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/protocol/index.js +0 -0
- /package/dist/{src/foundation → foundation}/release/cohort-selection.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/release/cohort-selection.js +0 -0
- /package/dist/{src/foundation → foundation}/release/concurrency.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/release/concurrency.js +0 -0
- /package/dist/{src/foundation → foundation}/release/process-cleanup.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/release/process-cleanup.js +0 -0
- /package/dist/{src/foundation → foundation}/release/stable-release.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/release/stable-release.js +0 -0
- /package/dist/{src/foundation → foundation}/storage/index.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/storage/index.js +0 -0
- /package/dist/{src/foundation → foundation}/structured-agent-runtime/index.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/structured-agent-runtime/index.js +0 -0
- /package/dist/{src/foundation → foundation}/supervision/main.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/components.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/index.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/index.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/resources/builtin-themes.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/resources/builtin-themes.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-editor-autocomplete.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-extension-ui.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-selectors-dialogs.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/theme.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/theme.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/countdown-timer.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/countdown-timer.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/custom-entry.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/custom-entry.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/daxnuts.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/daxnuts.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/earendil-announcement.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/earendil-announcement.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/extension-editor.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/extension-editor.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/first-time-setup.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/first-time-setup.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/markdown-transform.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/markdown-transform.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/mermaid.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/mermaid.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/owned-editor.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/owned-editor.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/scoped-models-selector.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/scoped-models-selector.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/session-footer.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/session-selector-search.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/session-selector-search.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/session-selector.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/session-selector.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/skill-invocation-message.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/skill-invocation-message.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/status-indicator.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/status-indicator.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/tree-selector.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/tree-selector.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/trust-selector.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/trust-selector.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/external-editor.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/external-editor.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/model-search.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/model-search.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/theme/theme-controller.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/theme/theme-controller.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/theme/theme.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/theme/theme.js +0 -0
- /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/pi-settings-metadata.json +0 -0
- /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/public-main-entry.d.ts +0 -0
- /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/public-main-entry.js +0 -0
- /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/workflows.d.ts +0 -0
- /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/workflows.js +0 -0
- /package/dist/{src/foundation/pi-owned-ui-integration → integrations/pi/session-ui}/route-host.js +0 -0
- /package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/conformance.d.ts +0 -0
- /package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/conformance.js +0 -0
- /package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/contracts.js +0 -0
- /package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/presentation-adapter.js +0 -0
- /package/dist/{src/foundation/ui-apps → ui/apps}/contracts.js +0 -0
- /package/dist/{src/foundation/ui-apps → ui/apps}/index.d.ts +0 -0
- /package/dist/{src/foundation/ui-apps → ui/apps}/index.js +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/dialog-panel.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/label.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/label.js +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/list-block.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/list-block.js +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/pane.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/pane.js +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/revision.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/revision.js +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/status-line.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/status-line.js +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/stepper.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/stepper.js +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/theme.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/theme.js +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/value-menu.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/value-menu.js +0 -0
- /package/dist/{src/foundation/owned-ui-settings → ui/settings}/index.d.ts +0 -0
- /package/dist/{src/foundation/owned-ui-settings → ui/settings}/index.js +0 -0
- /package/dist/{src/foundation/owned-ui-settings → ui/settings}/resolution.d.ts +0 -0
- /package/dist/{src/foundation/owned-ui-settings → ui/settings}/resolution.js +0 -0
package/bin/ui.js
CHANGED
|
@@ -1,24 +1,43 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
+
const startup = await import("../dist/foundation/startup/index.js");
|
|
4
|
+
startup.enableEnvironmentCompileCache(process.env);
|
|
5
|
+
await startup.markStartupPhase(process.env, "ui-entry");
|
|
3
6
|
const { assertSinglePiTuiModuleAtLaunch } = await import("./module-identity.js");
|
|
4
7
|
const { fileURLToPath } = await import("node:url");
|
|
5
8
|
|
|
6
|
-
//
|
|
9
|
+
// Compatibility: before the composition loads pinned Pi's terminal stack: confirm A1 and Pi
|
|
7
10
|
// resolve it to the same copy, so extensions and the owned UI share one module
|
|
8
11
|
// identity (see bin/module-identity.js for the full story). Nothing is repaired
|
|
9
12
|
// here — A1's package manifest decides which copy wins, and this only reports
|
|
10
13
|
// when that stopped being true.
|
|
11
14
|
assertSinglePiTuiModuleAtLaunch(fileURLToPath(new URL("..", import.meta.url)), message => process.stderr.write(message));
|
|
12
15
|
|
|
13
|
-
const { runSelectedInteractiveRuntime } = await import("../dist/
|
|
16
|
+
const { runSelectedInteractiveRuntime } = await import("../dist/features/launch/index.js");
|
|
17
|
+
|
|
18
|
+
const launchArgs = process.argv.slice(2);
|
|
19
|
+
let sessionPath;
|
|
20
|
+
if (launchArgs.length > 0) {
|
|
21
|
+
if (launchArgs.length !== 2 || launchArgs[0] !== "--session" || launchArgs[1].trim().length === 0) {
|
|
22
|
+
throw new Error("Usage: a1 [--session <session-file>]");
|
|
23
|
+
}
|
|
24
|
+
sessionPath = launchArgs[1];
|
|
25
|
+
}
|
|
14
26
|
|
|
15
27
|
runSelectedInteractiveRuntime(process.env.A1_LAUNCH_PROFILE ?? "a1", {
|
|
16
28
|
ownedUi: async (profileId, ownedSurfaces) => {
|
|
17
|
-
const [{ runOwnedUi }, { composeOwnedUi }] = await Promise.all([
|
|
18
|
-
import("../dist/
|
|
19
|
-
import("../dist/
|
|
29
|
+
const [{ createConsoleProjectTrustPrompt, runOwnedUi }, { composeOwnedUi }] = await Promise.all([
|
|
30
|
+
import("../dist/features/owned-ui/index.js"),
|
|
31
|
+
import("../dist/composition/index.js"),
|
|
20
32
|
]);
|
|
21
|
-
|
|
33
|
+
await startup.markStartupPhase(process.env, "ui-modules-loaded");
|
|
34
|
+
const { application, settings } = await composeOwnedUi({
|
|
35
|
+
cwd: process.cwd(),
|
|
36
|
+
profileId,
|
|
37
|
+
ownedSurfaces,
|
|
38
|
+
projectTrustPrompt: createConsoleProjectTrustPrompt(),
|
|
39
|
+
...(sessionPath === undefined ? {} : { sessionPath }),
|
|
40
|
+
});
|
|
22
41
|
return await runOwnedUi({ application, ...(settings === null ? {} : { settings }) });
|
|
23
42
|
},
|
|
24
43
|
}).then(
|
package/bin/warmup.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const startup = await import("../dist/foundation/startup/index.js");
|
|
4
|
+
startup.assertImmutableWarmupEnvironment(process.env);
|
|
5
|
+
startup.enableEnvironmentCompileCache(process.env);
|
|
6
|
+
|
|
7
|
+
// Security: this entry imports but never composes, so it creates no terminal, profile/session
|
|
8
|
+
// path, trust callback, executable resource loader, extension runner, or network client.
|
|
9
|
+
const [composition, engine, components, runtime] = await Promise.all([
|
|
10
|
+
import("../dist/composition/index.js"),
|
|
11
|
+
import("../dist/integrations/pi/engine/index.js"),
|
|
12
|
+
import("../dist/integrations/pi/components/index.js"),
|
|
13
|
+
import("../dist/integrations/pi/tui-runtime/index.js"),
|
|
14
|
+
]);
|
|
15
|
+
if (typeof composition.composeOwnedUi !== "function" || typeof engine.createPiEngineAdapter !== "function"
|
|
16
|
+
|| typeof components.applyConfiguredPiTheme !== "function" || typeof runtime.createPiTerminalBridge !== "function") {
|
|
17
|
+
throw new Error("immutable startup graph is incomplete");
|
|
18
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** The Pi comparison launch is a prerelease development instrument, not product. */
|
|
2
|
+
export interface CliCapabilities {
|
|
3
|
+
readonly developmentComparison: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare function cliCapabilities(version: string): CliCapabilities;
|
|
6
|
+
export declare function isPrereleaseVersion(version: string): boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { prerelease } from "semver";
|
|
2
2
|
export function cliCapabilities(version) {
|
|
3
|
-
return Object.freeze({
|
|
3
|
+
return Object.freeze({ developmentComparison: isPrereleaseVersion(version) });
|
|
4
4
|
}
|
|
5
5
|
export function isPrereleaseVersion(version) {
|
|
6
6
|
return (prerelease(version)?.length ?? 0) > 0;
|
|
@@ -9,11 +9,17 @@ export interface CliHandlers {
|
|
|
9
9
|
readonly packages: (request: PackageCommandRequest) => Promise<number>;
|
|
10
10
|
}
|
|
11
11
|
export interface CliOutput {
|
|
12
|
+
readonly stdout: (message: string) => void;
|
|
12
13
|
readonly stderr: (message: string) => void;
|
|
13
14
|
}
|
|
14
15
|
export declare function cliUsage(capabilities: CliCapabilities): string;
|
|
16
|
+
export declare function cliHelp(capabilities: CliCapabilities): string;
|
|
15
17
|
export declare function dispatchCli(arguments_: readonly string[], handlers: CliHandlers, output: CliOutput, capabilities: CliCapabilities): Promise<number>;
|
|
16
18
|
export type CliCommand = {
|
|
19
|
+
readonly kind: "noop";
|
|
20
|
+
} | {
|
|
21
|
+
readonly kind: "help";
|
|
22
|
+
} | {
|
|
17
23
|
readonly kind: "launch";
|
|
18
24
|
readonly profileId: LaunchProfileId;
|
|
19
25
|
} | {
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { interactiveLaunchIntent } from "../features/launch/index.js";
|
|
2
|
+
import { PRODUCT_TEXT } from "../product-identity.js";
|
|
3
|
+
export function cliUsage(capabilities) {
|
|
4
|
+
return PRODUCT_TEXT.usage([
|
|
5
|
+
"",
|
|
6
|
+
...(capabilities.developmentComparison ? ["pi"] : []),
|
|
7
|
+
"--help",
|
|
8
|
+
"-h",
|
|
9
|
+
"--version",
|
|
10
|
+
"-v",
|
|
11
|
+
"update",
|
|
12
|
+
"update --develop [preview-or-version]",
|
|
13
|
+
"update --models",
|
|
14
|
+
"pi install <source>",
|
|
15
|
+
"pi remove <source>",
|
|
16
|
+
"pi uninstall <source>",
|
|
17
|
+
"pi list",
|
|
18
|
+
"pi update --extensions",
|
|
19
|
+
"pi update --models",
|
|
20
|
+
"pi update <source>",
|
|
21
|
+
]);
|
|
22
|
+
}
|
|
23
|
+
export function cliHelp(capabilities) {
|
|
24
|
+
const command = PRODUCT_TEXT.commandName;
|
|
25
|
+
return [
|
|
26
|
+
"Common:",
|
|
27
|
+
` ${command}`,
|
|
28
|
+
...(capabilities.developmentComparison ? [` ${command} pi`] : []),
|
|
29
|
+
` ${command} --help`,
|
|
30
|
+
` ${command} -h`,
|
|
31
|
+
` ${command} --version`,
|
|
32
|
+
` ${command} -v`,
|
|
33
|
+
"",
|
|
34
|
+
"Update:",
|
|
35
|
+
` ${command} update`,
|
|
36
|
+
` ${command} update --develop [preview-or-version]`,
|
|
37
|
+
` ${command} update --models`,
|
|
38
|
+
"",
|
|
39
|
+
"Pi-compatible packages:",
|
|
40
|
+
` ${command} pi install <source>`,
|
|
41
|
+
` ${command} pi remove <source>`,
|
|
42
|
+
` ${command} pi uninstall <source>`,
|
|
43
|
+
` ${command} pi list`,
|
|
44
|
+
` ${command} pi update --extensions`,
|
|
45
|
+
` ${command} pi update --models`,
|
|
46
|
+
` ${command} pi update <source>`,
|
|
47
|
+
"",
|
|
48
|
+
].join("\n");
|
|
49
|
+
}
|
|
50
|
+
const PROFILE_WORDS = new Set(["pi"]);
|
|
51
|
+
export async function dispatchCli(arguments_, handlers, output, capabilities) {
|
|
52
|
+
const command = parseCliCommand(arguments_, capabilities);
|
|
53
|
+
if (command.kind === "noop")
|
|
54
|
+
return 0;
|
|
55
|
+
if (command.kind === "help") {
|
|
56
|
+
output.stdout(cliHelp(capabilities));
|
|
57
|
+
return 0;
|
|
58
|
+
}
|
|
59
|
+
if (command.kind === "error") {
|
|
60
|
+
output.stderr(`${command.message}\n`);
|
|
61
|
+
return 2;
|
|
62
|
+
}
|
|
63
|
+
if (command.kind === "launch")
|
|
64
|
+
return await handlers.launch(interactiveLaunchIntent(command.profileId));
|
|
65
|
+
if (command.kind === "version")
|
|
66
|
+
return await handlers.version();
|
|
67
|
+
if (command.kind === "packages")
|
|
68
|
+
return await handlers.packages(command.request);
|
|
69
|
+
return await handlers.update(command.channel, command.target);
|
|
70
|
+
}
|
|
71
|
+
export function parseCliCommand(arguments_, capabilities) {
|
|
72
|
+
if (arguments_.length === 0)
|
|
73
|
+
return { kind: "launch", profileId: "a1" };
|
|
74
|
+
const [command, ...rest] = arguments_;
|
|
75
|
+
if (command === "--help" || command === "-h")
|
|
76
|
+
return withoutArguments(rest, { kind: "help" });
|
|
77
|
+
if (command === "--version" || command === "-v")
|
|
78
|
+
return withoutArguments(rest, { kind: "version" });
|
|
79
|
+
if (command === "pi") {
|
|
80
|
+
if (rest.length > 0)
|
|
81
|
+
return parsePiPackageCommand(rest);
|
|
82
|
+
return capabilities.developmentComparison ? { kind: "launch", profileId: "pi" } : { kind: "noop" };
|
|
83
|
+
}
|
|
84
|
+
if (command === "update")
|
|
85
|
+
return parseUpdate(rest);
|
|
86
|
+
if (command?.startsWith("update:"))
|
|
87
|
+
return { kind: "noop" };
|
|
88
|
+
// Rationale: unsupported and reserved command spaces are deliberately quiet. Help is
|
|
89
|
+
// explicit, and a typo must never start an interactive or maintenance path.
|
|
90
|
+
return { kind: "noop" };
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Stable update is the empty form. `--develop` selects the moving development
|
|
94
|
+
* head or one immutable numbered preview, while model refresh remains a separate
|
|
95
|
+
* operation that cannot be combined with either update channel.
|
|
96
|
+
*/
|
|
97
|
+
function parseUpdate(rest) {
|
|
98
|
+
if (rest.length === 0)
|
|
99
|
+
return { kind: "update", channel: "stable" };
|
|
100
|
+
const [selector, ...values] = rest;
|
|
101
|
+
// Compatibility: removed notation is unsupported rather than deprecated.
|
|
102
|
+
if (selector === "self")
|
|
103
|
+
return { kind: "noop" };
|
|
104
|
+
if (selector === "--develop") {
|
|
105
|
+
if (values.length === 0)
|
|
106
|
+
return { kind: "update", channel: "next" };
|
|
107
|
+
if (values.length > 1)
|
|
108
|
+
return updateGrammarError("--develop accepts at most one preview number or version.");
|
|
109
|
+
const [target] = values;
|
|
110
|
+
if (target === undefined || !isDevelopmentTarget(target)) {
|
|
111
|
+
return updateGrammarError(`--develop received an unusable preview: ${target ?? ""}`);
|
|
112
|
+
}
|
|
113
|
+
return { kind: "update", channel: "next", target };
|
|
114
|
+
}
|
|
115
|
+
if (selector === "--models") {
|
|
116
|
+
if (values.length > 0)
|
|
117
|
+
return updateGrammarError("--models cannot be combined with another update selector.");
|
|
118
|
+
return { kind: "packages", request: { verb: "refresh-models", source: null } };
|
|
119
|
+
}
|
|
120
|
+
if (selector === "pi")
|
|
121
|
+
return pinnedPiUpdateError();
|
|
122
|
+
if (selector !== undefined && selector.startsWith("-"))
|
|
123
|
+
return unknownOption(selector, "update");
|
|
124
|
+
// Rationale: positional update targets are reserved for a future A1-native plugin model.
|
|
125
|
+
return { kind: "noop" };
|
|
126
|
+
}
|
|
127
|
+
function isDevelopmentTarget(target) {
|
|
128
|
+
return /^[1-9]\d*$/.test(target) || /^\d+\.\d+\.\d+-dev\.[1-9]\d*$/.test(target);
|
|
129
|
+
}
|
|
130
|
+
function updateGrammarError(detail) {
|
|
131
|
+
return { kind: "error", message: PRODUCT_TEXT.diagnostic(`could not parse update: ${detail}`) };
|
|
132
|
+
}
|
|
133
|
+
function parsePiPackageCommand(arguments_) {
|
|
134
|
+
const [verb, ...rest] = arguments_;
|
|
135
|
+
if (verb === "install" || verb === "remove" || verb === "uninstall") {
|
|
136
|
+
return parseSourceCommand(verb === "install" ? "install" : "remove", rest);
|
|
137
|
+
}
|
|
138
|
+
if (verb === "list")
|
|
139
|
+
return withoutArguments(rest, { kind: "packages", request: { verb: "list", source: null } });
|
|
140
|
+
if (verb === "update")
|
|
141
|
+
return parsePiPackageUpdate(rest);
|
|
142
|
+
return { kind: "noop" };
|
|
143
|
+
}
|
|
144
|
+
function parsePiPackageUpdate(rest) {
|
|
145
|
+
if (rest.length === 0)
|
|
146
|
+
return pinnedPiUpdateError();
|
|
147
|
+
if (rest.length > 1)
|
|
148
|
+
return { kind: "error", message: PRODUCT_TEXT.diagnostic("pi update accepts one target.") };
|
|
149
|
+
const [target] = rest;
|
|
150
|
+
if (target === "--extensions")
|
|
151
|
+
return { kind: "packages", request: { verb: "update", source: null } };
|
|
152
|
+
if (target === "--models")
|
|
153
|
+
return { kind: "packages", request: { verb: "refresh-models", source: null } };
|
|
154
|
+
if (target === "--self" || target === "--all" || target === "self" || target === "pi")
|
|
155
|
+
return pinnedPiUpdateError();
|
|
156
|
+
if (target === undefined || target.startsWith("-"))
|
|
157
|
+
return unknownOption(target ?? "", "pi update");
|
|
158
|
+
return { kind: "packages", request: { verb: "update", source: target } };
|
|
159
|
+
}
|
|
160
|
+
function pinnedPiUpdateError() {
|
|
161
|
+
return {
|
|
162
|
+
kind: "error",
|
|
163
|
+
message: [
|
|
164
|
+
PRODUCT_TEXT.diagnostic("pins its certified Pi runtime and cannot update it independently."),
|
|
165
|
+
"Use:",
|
|
166
|
+
` ${PRODUCT_TEXT.commandName} update Update A1`,
|
|
167
|
+
` ${PRODUCT_TEXT.commandName} pi update --extensions Update Pi-compatible packages`,
|
|
168
|
+
` ${PRODUCT_TEXT.commandName} pi update --models Refresh model catalogs`,
|
|
169
|
+
].join("\n"),
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
function parseSourceCommand(verb, rest) {
|
|
173
|
+
const flag = rest.find(argument => argument.startsWith("-"));
|
|
174
|
+
if (flag !== undefined)
|
|
175
|
+
return unknownOption(flag, `pi ${verb}`);
|
|
176
|
+
if (rest.length === 0)
|
|
177
|
+
return { kind: "error", message: PRODUCT_TEXT.diagnostic(`${verb} requires a package source.`) };
|
|
178
|
+
if (rest.length > 1)
|
|
179
|
+
return { kind: "error", message: PRODUCT_TEXT.diagnostic(`${verb} accepts one package source.`) };
|
|
180
|
+
const [source] = rest;
|
|
181
|
+
if (source === undefined)
|
|
182
|
+
return { kind: "error", message: PRODUCT_TEXT.diagnostic(`${verb} requires a package source.`) };
|
|
183
|
+
if (PROFILE_WORDS.has(source))
|
|
184
|
+
return profileRejection(verb);
|
|
185
|
+
return { kind: "packages", request: { verb, source } };
|
|
186
|
+
}
|
|
187
|
+
function withoutArguments(rest, command) {
|
|
188
|
+
if (rest.length === 0)
|
|
189
|
+
return command;
|
|
190
|
+
return { kind: "error", message: PRODUCT_TEXT.diagnostic("commands do not accept additional arguments.") };
|
|
191
|
+
}
|
|
192
|
+
function profileRejection(verb) {
|
|
193
|
+
return {
|
|
194
|
+
kind: "error",
|
|
195
|
+
message: PRODUCT_TEXT.diagnostic(`manages packages in its own profile, so ${verb} takes no profile; Pi manages Pi's own profile.`),
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
function unknownOption(option, verb) {
|
|
199
|
+
if (option.startsWith("--profile"))
|
|
200
|
+
return profileRejection(verb);
|
|
201
|
+
return { kind: "error", message: PRODUCT_TEXT.diagnostic(`received an unknown option for ${verb}: ${option}`) };
|
|
202
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { initializeProductProfile } from "../features/launch/index.js";
|
|
2
|
-
import type { AgentPackageOutcome, AgentPackagesPort, AgentPackagesPortInput } from "../
|
|
2
|
+
import type { AgentPackageOutcome, AgentPackagesPort, AgentPackagesPortInput } from "../contracts/agent-engine/index.js";
|
|
3
3
|
/**
|
|
4
4
|
* Package commands manage A1's own profile and nothing else, so no request carries
|
|
5
5
|
* a profile: `update` with no source means every installed package, and refreshing
|
|
@@ -11,6 +11,12 @@ export interface PackageCommandRequest {
|
|
|
11
11
|
readonly verb: PackageCommandVerb;
|
|
12
12
|
readonly source: string | null;
|
|
13
13
|
}
|
|
14
|
+
export interface PackageCommandStyle {
|
|
15
|
+
readonly dim: (message: string) => string;
|
|
16
|
+
readonly bold: (message: string) => string;
|
|
17
|
+
readonly green: (message: string) => string;
|
|
18
|
+
readonly red: (message: string) => string;
|
|
19
|
+
}
|
|
14
20
|
export interface PackageCommandEnvironment {
|
|
15
21
|
readonly createPort: (input: AgentPackagesPortInput) => AgentPackagesPort;
|
|
16
22
|
readonly cwd?: string;
|
|
@@ -18,6 +24,8 @@ export interface PackageCommandEnvironment {
|
|
|
18
24
|
readonly stdout?: (message: string) => void;
|
|
19
25
|
readonly stderr?: (message: string) => void;
|
|
20
26
|
readonly initializeProfile?: typeof initializeProductProfile;
|
|
27
|
+
/** Defaults to Chalk's terminal-aware styles; injectable for transcript tests. */
|
|
28
|
+
readonly style?: PackageCommandStyle;
|
|
21
29
|
}
|
|
22
30
|
export declare function runPackageCommand(request: PackageCommandRequest, environment: PackageCommandEnvironment): Promise<number>;
|
|
23
|
-
export declare function renderPackageOutcome(outcome: AgentPackageOutcome, profileRoot: string): string;
|
|
31
|
+
export declare function renderPackageOutcome(outcome: AgentPackageOutcome, profileRoot: string, style?: PackageCommandStyle): string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
1
2
|
import { configurationRootForProfile, initializeProductProfile, resolveLaunchProfilePaths } from "../features/launch/index.js";
|
|
2
3
|
import { PRODUCT_TEXT } from "../product-identity.js";
|
|
3
4
|
export async function runPackageCommand(request, environment) {
|
|
@@ -5,6 +6,7 @@ export async function runPackageCommand(request, environment) {
|
|
|
5
6
|
const stderr = environment.stderr ?? (message => process.stderr.write(message));
|
|
6
7
|
const cwd = environment.cwd ?? process.cwd();
|
|
7
8
|
const processEnvironment = environment.environment ?? process.env;
|
|
9
|
+
const style = environment.style ?? chalk;
|
|
8
10
|
const paths = resolveLaunchProfilePaths({ environment: processEnvironment });
|
|
9
11
|
const profileRoot = configurationRootForProfile("a1", paths);
|
|
10
12
|
if (profileRoot === null)
|
|
@@ -19,10 +21,10 @@ export async function runPackageCommand(request, environment) {
|
|
|
19
21
|
const port = environment.createPort({
|
|
20
22
|
profileRoot,
|
|
21
23
|
cwd,
|
|
22
|
-
onProgress: progress => stdout(`${progress.message}\n`),
|
|
24
|
+
onProgress: progress => stdout(`${style.dim(progress.message)}\n`),
|
|
23
25
|
});
|
|
24
26
|
const outcome = await runVerb(port, request);
|
|
25
|
-
const rendered = renderPackageOutcome(outcome, profileRoot);
|
|
27
|
+
const rendered = renderPackageOutcome(outcome, profileRoot, style);
|
|
26
28
|
(outcome.status === "completed" ? stdout : stderr)(rendered);
|
|
27
29
|
return outcome.status === "completed" ? 0 : 1;
|
|
28
30
|
}
|
|
@@ -37,38 +39,40 @@ async function runVerb(port, request) {
|
|
|
37
39
|
throw new Error(PRODUCT_TEXT.diagnostic(`requires a source for ${request.verb}`));
|
|
38
40
|
return request.verb === "install" ? await port.install(request.source) : await port.remove(request.source);
|
|
39
41
|
}
|
|
40
|
-
export function renderPackageOutcome(outcome, profileRoot) {
|
|
41
|
-
|
|
42
|
+
export function renderPackageOutcome(outcome, profileRoot, style = chalk) {
|
|
43
|
+
// Compatibility: model refresh remains an A1 top-level command. The `a1 pi` compatibility
|
|
44
|
+
// transcript applies to package operations only.
|
|
45
|
+
if (outcome.operation === "refresh-models") {
|
|
46
|
+
if (outcome.status === "failed") {
|
|
47
|
+
return `${PRODUCT_TEXT.diagnostic(`could not ${describeOperation(outcome.operation)}: ${outcome.detail ?? "unknown failure"}`)}\n`;
|
|
48
|
+
}
|
|
49
|
+
return `${PRODUCT_TEXT.displayName} refreshed the model catalogs in ${profileRoot}.\n`;
|
|
50
|
+
}
|
|
42
51
|
if (outcome.status === "failed") {
|
|
43
|
-
return `${
|
|
52
|
+
return `${style.red(`Error: ${outcome.detail ?? "Unknown package command error"}`)}\n`;
|
|
44
53
|
}
|
|
45
54
|
if (outcome.status === "not-found") {
|
|
46
|
-
return `${
|
|
55
|
+
return `${style.red(`No matching package found for ${outcome.source ?? "that source"}`)}\n`;
|
|
47
56
|
}
|
|
48
57
|
switch (outcome.operation) {
|
|
49
58
|
case "install":
|
|
50
|
-
return `${
|
|
51
|
-
+ `Restart ${PRODUCT_TEXT.commandName} for a running session to load it.\n`;
|
|
59
|
+
return `${style.green(`Installed ${outcome.source}`)}\n`;
|
|
52
60
|
case "remove":
|
|
53
|
-
return `${
|
|
61
|
+
return `${style.green(`Removed ${outcome.source}`)}\n`;
|
|
54
62
|
case "update":
|
|
55
|
-
return outcome.source === null
|
|
56
|
-
? `${name} updated the packages in ${profileRoot}.\n`
|
|
57
|
-
: `${name} updated ${outcome.source}.\n`;
|
|
58
|
-
case "refresh-models":
|
|
59
|
-
return `${name} refreshed the model catalogs in ${profileRoot}.\n`;
|
|
63
|
+
return `${style.green(outcome.source === null ? "Updated packages" : `Updated ${outcome.source}`)}\n`;
|
|
60
64
|
case "list":
|
|
61
|
-
return renderPackageList(outcome,
|
|
65
|
+
return renderPackageList(outcome, style);
|
|
62
66
|
}
|
|
63
67
|
}
|
|
64
|
-
function renderPackageList(outcome,
|
|
68
|
+
function renderPackageList(outcome, style) {
|
|
65
69
|
if (outcome.packages.length === 0)
|
|
66
|
-
return `${
|
|
67
|
-
const lines = [
|
|
70
|
+
return `${style.dim("No packages installed.")}\n`;
|
|
71
|
+
const lines = [style.bold("User packages:")];
|
|
68
72
|
for (const entry of outcome.packages) {
|
|
69
|
-
lines.push(` ${entry.source}${entry.filtered ? " (
|
|
73
|
+
lines.push(` ${entry.source}${entry.filtered ? " (filtered)" : ""}`);
|
|
70
74
|
if (entry.installedPath !== null)
|
|
71
|
-
lines.push(` ${entry.installedPath}`);
|
|
75
|
+
lines.push(style.dim(` ${entry.installedPath}`));
|
|
72
76
|
}
|
|
73
77
|
return `${lines.join("\n")}\n`;
|
|
74
78
|
}
|
|
@@ -3,6 +3,11 @@ interface VersionProcessResult {
|
|
|
3
3
|
readonly stdout: string;
|
|
4
4
|
}
|
|
5
5
|
type VersionProcessRunner = (command: string, arguments_: readonly string[]) => Promise<VersionProcessResult>;
|
|
6
|
+
type RegistryFetcher = (url: string) => Promise<{
|
|
7
|
+
readonly ok: boolean;
|
|
8
|
+
readonly status: number;
|
|
9
|
+
text(): Promise<string>;
|
|
10
|
+
}>;
|
|
6
11
|
interface VersionOutput {
|
|
7
12
|
stdout(message: string): void;
|
|
8
13
|
stderr(message: string): void;
|
|
@@ -11,6 +16,7 @@ export interface VersionStatsOptions {
|
|
|
11
16
|
readonly packageRoot: string;
|
|
12
17
|
readonly output?: VersionOutput;
|
|
13
18
|
readonly runner?: VersionProcessRunner;
|
|
19
|
+
readonly fetcher?: RegistryFetcher;
|
|
14
20
|
}
|
|
15
21
|
export declare function runVersionStats(options: VersionStatsOptions): Promise<number>;
|
|
16
22
|
export {};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
3
|
+
import { resolve } from "node:path";
|
|
4
|
+
import crossSpawn from "cross-spawn";
|
|
5
|
+
import { prerelease, valid as validSemver } from "semver";
|
|
6
|
+
import { PRODUCT_TEXT } from "../product-identity.js";
|
|
7
|
+
const defaultOutput = {
|
|
8
|
+
stdout(message) { process.stdout.write(message); },
|
|
9
|
+
stderr(message) { process.stderr.write(message); },
|
|
10
|
+
};
|
|
11
|
+
export async function runVersionStats(options) {
|
|
12
|
+
const output = options.output ?? defaultOutput;
|
|
13
|
+
const runner = options.runner ?? createVersionProcessRunner();
|
|
14
|
+
let installed;
|
|
15
|
+
try {
|
|
16
|
+
const manifest = JSON.parse(await readFile(resolve(options.packageRoot, "package.json"), "utf8"));
|
|
17
|
+
installed = parseVersion(manifest.version, "installed package");
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
output.stderr(`${PRODUCT_TEXT.diagnostic(`could not read its installed version: ${message(error)}`)}\n`);
|
|
21
|
+
return 1;
|
|
22
|
+
}
|
|
23
|
+
// Compatibility: match Pi's release behavior: stable builds print only their installed version.
|
|
24
|
+
// Development builds retain channel visibility for preview comparison and updates.
|
|
25
|
+
if (prerelease(installed) === null) {
|
|
26
|
+
output.stdout(`${installed}\n`);
|
|
27
|
+
return 0;
|
|
28
|
+
}
|
|
29
|
+
const remote = await queryDistTags(runner, options.fetcher ?? defaultRegistryFetcher);
|
|
30
|
+
output.stdout(`Current: ${installed}\nDevelop: ${remote.develop ?? "unavailable"}\nRelease: ${remote.release ?? "unavailable"}\n`);
|
|
31
|
+
if (remote.error)
|
|
32
|
+
output.stderr(`${PRODUCT_TEXT.diagnostic(`could not resolve npm dist-tags: ${remote.error}`)}\n`);
|
|
33
|
+
return 0;
|
|
34
|
+
}
|
|
35
|
+
// Rationale: npm view respects the user's .npmrc registry and proxy, so it stays primary; the direct
|
|
36
|
+
// registry fetch below covers npm CLI versions whose --json output shape we cannot parse.
|
|
37
|
+
async function queryDistTags(runner, fetcher) {
|
|
38
|
+
const fromNpm = await queryDistTagsViaNpm(runner);
|
|
39
|
+
if (fromNpm.error === null)
|
|
40
|
+
return fromNpm;
|
|
41
|
+
const fromRegistry = await queryDistTagsViaRegistry(fetcher);
|
|
42
|
+
if (fromRegistry.error === null)
|
|
43
|
+
return fromRegistry;
|
|
44
|
+
return unavailable(`${fromNpm.error}; registry fallback failed: ${fromRegistry.error}`);
|
|
45
|
+
}
|
|
46
|
+
async function queryDistTagsViaNpm(runner) {
|
|
47
|
+
let result;
|
|
48
|
+
try {
|
|
49
|
+
result = await runner("npm", ["view", PRODUCT_TEXT.packageName, "dist-tags", "--json"]);
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
return unavailable(message(error));
|
|
53
|
+
}
|
|
54
|
+
if (result.code !== 0)
|
|
55
|
+
return unavailable(`npm exited with status ${result.code ?? "unknown"}`);
|
|
56
|
+
try {
|
|
57
|
+
const parsed = JSON.parse(result.stdout);
|
|
58
|
+
// Compatibility: npm 12 wraps `npm view <pkg> dist-tags --json` output in a one-element array; older npm returns the bare object.
|
|
59
|
+
const metadata = Array.isArray(parsed) && parsed.length === 1 ? parsed[0] : parsed;
|
|
60
|
+
return parseDistTags(metadata, "npm");
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
return unavailable(message(error));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
async function queryDistTagsViaRegistry(fetcher) {
|
|
67
|
+
try {
|
|
68
|
+
const response = await fetcher(`https://registry.npmjs.org/-/package/${encodeURIComponent(PRODUCT_TEXT.packageName)}/dist-tags`);
|
|
69
|
+
if (!response.ok)
|
|
70
|
+
return unavailable(`registry responded with status ${response.status}`);
|
|
71
|
+
return parseDistTags(JSON.parse(await response.text()), "registry");
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
return unavailable(message(error));
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
function parseDistTags(metadata, source) {
|
|
78
|
+
if (typeof metadata !== "object" || metadata === null || Array.isArray(metadata)) {
|
|
79
|
+
return unavailable(`${source} returned a non-object dist-tags value`);
|
|
80
|
+
}
|
|
81
|
+
try {
|
|
82
|
+
const tags = metadata;
|
|
83
|
+
const release = parseVersion(tags.latest, `${source} latest`);
|
|
84
|
+
const develop = tags.next === undefined ? null : parseVersion(tags.next, `${source} development channel`);
|
|
85
|
+
return { release, develop, error: null };
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
return unavailable(message(error));
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function unavailable(error) {
|
|
92
|
+
return { release: null, develop: null, error };
|
|
93
|
+
}
|
|
94
|
+
const defaultRegistryFetcher = async (url) => await fetch(url, { headers: { accept: "application/json" }, signal: AbortSignal.timeout(10_000) });
|
|
95
|
+
function createVersionProcessRunner() {
|
|
96
|
+
return async (command, arguments_) => await new Promise((resolvePromise, rejectPromise) => {
|
|
97
|
+
const child = process.platform === "win32"
|
|
98
|
+
? crossSpawn(command, [...arguments_], { stdio: ["ignore", "pipe", "ignore"] })
|
|
99
|
+
: spawn(command, [...arguments_], { stdio: ["ignore", "pipe", "ignore"] });
|
|
100
|
+
const stdout = [];
|
|
101
|
+
child.stdout?.on("data", chunk => stdout.push(Buffer.from(chunk)));
|
|
102
|
+
child.once("error", rejectPromise);
|
|
103
|
+
child.once("close", code => resolvePromise({ code, stdout: Buffer.concat(stdout).toString("utf8") }));
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
function parseVersion(value, source) {
|
|
107
|
+
const parsed = typeof value === "string" ? validSemver(value) : null;
|
|
108
|
+
if (!parsed)
|
|
109
|
+
throw new Error(`${source} did not provide a valid semantic version`);
|
|
110
|
+
return parsed;
|
|
111
|
+
}
|
|
112
|
+
function message(error) { return error instanceof Error ? error.message : String(error); }
|