@agimon-ai/po 0.0.0-alpha.21 → 0.0.0-alpha.210
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/LICENSE +97 -8
- package/README.md +37 -722
- package/dist/apiContracts.cjs.map +1 -1
- package/dist/apiContracts.d.mts +2 -2
- package/dist/bin/cli.cjs +12 -7
- package/dist/bin/cli.cjs.map +1 -1
- package/dist/bin/cli.mjs +12 -7
- package/dist/bin/cli.mjs.map +1 -1
- package/dist/bin/poRunner.cjs +24 -7
- package/dist/bin/poRunner.cjs.map +1 -1
- package/dist/bin/poRunner.d.mts +8 -0
- package/dist/bin/poRunner.d.mts.map +1 -1
- package/dist/bin/poRunner.mjs +24 -7
- package/dist/bin/poRunner.mjs.map +1 -1
- package/dist/bin/serve.cjs +28 -17
- package/dist/bin/serve.cjs.map +1 -1
- package/dist/bin/serve.mjs +28 -17
- package/dist/bin/serve.mjs.map +1 -1
- package/dist/builders/cli/extensionAssembler/index.cjs +53 -40
- package/dist/builders/cli/extensionAssembler/index.cjs.map +1 -1
- package/dist/builders/cli/extensionAssembler/index.d.mts +11 -6
- package/dist/builders/cli/extensionAssembler/index.d.mts.map +1 -1
- package/dist/builders/cli/extensionAssembler/index.mjs +53 -41
- package/dist/builders/cli/extensionAssembler/index.mjs.map +1 -1
- package/dist/catalog/index.json +662 -105
- package/dist/cli.cjs +9 -14
- package/dist/cli.d.mts +1 -3
- package/dist/cli.mjs +1 -3
- package/dist/commands.cjs +13 -15
- package/dist/commands.d.mts +1 -2
- package/dist/commands.mjs +1 -2
- package/dist/config.cjs +9 -14
- package/dist/config.d.mts +3 -2
- package/dist/config.mjs +3 -2
- package/dist/extensions/server.cjs +30 -23
- package/dist/extensions/server.cjs.map +1 -1
- package/dist/extensions/server.d.mts.map +1 -1
- package/dist/extensions/server.mjs +31 -24
- package/dist/extensions/server.mjs.map +1 -1
- package/dist/harnessContext.cjs +0 -1
- package/dist/harnessContext.d.mts +2 -2
- package/dist/harnessContext.mjs +1 -1
- package/dist/harnessState.cjs +2 -1
- package/dist/help.cjs +9 -11
- package/dist/help.d.mts +1 -2
- package/dist/help.mjs +1 -2
- package/dist/index.cjs +40 -67
- package/dist/index.d.mts +7 -16
- package/dist/index.mjs +7 -14
- package/dist/matrixOptions.cjs +10 -5
- package/dist/matrixOptions.d.mts +2 -2
- package/dist/matrixOptions.mjs +1 -1
- package/dist/package.cjs +11 -0
- package/dist/package.cjs.map +1 -0
- package/dist/package.mjs +6 -0
- package/dist/package.mjs.map +1 -0
- package/dist/projectTrust.cjs +3 -0
- package/dist/projectTrust.d.mts +2 -2
- package/dist/projectTrust.mjs +1 -1
- package/dist/repository.cjs +1 -0
- package/dist/repository.d.mts +2 -2
- package/dist/repository.mjs +1 -1
- package/dist/services.cjs +5 -20
- package/dist/services.d.mts +3 -8
- package/dist/services.mjs +3 -8
- package/dist/shared.cjs +4 -17
- package/dist/shared.d.mts +2 -2
- package/dist/shared.mjs +1 -1
- package/dist/src/bin/agentDirectory.cjs +19 -15
- package/dist/src/bin/agentDirectory.cjs.map +1 -1
- package/dist/src/bin/agentDirectory.mjs +16 -13
- package/dist/src/bin/agentDirectory.mjs.map +1 -1
- package/dist/src/builders/apiContractExport/index.cjs +23 -22
- package/dist/src/builders/apiContractExport/index.cjs.map +1 -1
- package/dist/src/builders/apiContractExport/index.mjs +22 -21
- package/dist/src/builders/apiContractExport/index.mjs.map +1 -1
- package/dist/src/builders/cli/entryResolution.cjs +2 -2
- package/dist/src/builders/cli/entryResolution.cjs.map +1 -1
- package/dist/src/builders/cli/entryResolution.mjs +1 -1
- package/dist/src/builders/cli/entryResolution.mjs.map +1 -1
- package/dist/src/builders/cli/harnessContext.cjs +38 -43
- package/dist/src/builders/cli/harnessContext.cjs.map +1 -1
- package/dist/src/builders/cli/harnessContext.d.mts +11 -10
- package/dist/src/builders/cli/harnessContext.d.mts.map +1 -1
- package/dist/src/builders/cli/harnessContext.mjs +37 -41
- package/dist/src/builders/cli/harnessContext.mjs.map +1 -1
- package/dist/src/builders/cli/sessionComposition.cjs +23 -12
- package/dist/src/builders/cli/sessionComposition.cjs.map +1 -1
- package/dist/src/builders/cli/sessionComposition.mjs +23 -12
- package/dist/src/builders/cli/sessionComposition.mjs.map +1 -1
- package/dist/src/builders/isolate/compile.cjs +226 -0
- package/dist/src/builders/isolate/compile.cjs.map +1 -0
- package/dist/src/builders/isolate/compile.mjs +222 -0
- package/dist/src/builders/isolate/compile.mjs.map +1 -0
- package/dist/src/builders/isolate/index.cjs +195 -0
- package/dist/src/builders/isolate/index.cjs.map +1 -0
- package/dist/src/builders/isolate/index.mjs +192 -0
- package/dist/src/builders/isolate/index.mjs.map +1 -0
- package/dist/src/builders/isolate/membrane.cjs +198 -0
- package/dist/src/builders/isolate/membrane.cjs.map +1 -0
- package/dist/src/builders/isolate/membrane.mjs +198 -0
- package/dist/src/builders/isolate/membrane.mjs.map +1 -0
- package/dist/src/builders/isolate/names.cjs +10 -0
- package/dist/src/builders/isolate/names.cjs.map +1 -0
- package/dist/src/builders/isolate/names.mjs +9 -0
- package/dist/src/builders/isolate/names.mjs.map +1 -0
- package/dist/src/builders/native/index.cjs +229 -67
- package/dist/src/builders/native/index.cjs.map +1 -1
- package/dist/src/builders/native/index.d.mts +4 -2
- package/dist/src/builders/native/index.d.mts.map +1 -1
- package/dist/src/builders/native/index.mjs +229 -68
- package/dist/src/builders/native/index.mjs.map +1 -1
- package/dist/src/builders/npm/index.cjs +76 -0
- package/dist/src/builders/npm/index.cjs.map +1 -0
- package/dist/src/builders/npm/index.mjs +73 -0
- package/dist/src/builders/npm/index.mjs.map +1 -0
- package/dist/src/builders/server/backgroundSync.cjs +62 -39
- package/dist/src/builders/server/backgroundSync.cjs.map +1 -1
- package/dist/src/builders/server/backgroundSync.mjs +62 -38
- package/dist/src/builders/server/backgroundSync.mjs.map +1 -1
- package/dist/src/builders/server/bundlerService.cjs +165 -35
- package/dist/src/builders/server/bundlerService.cjs.map +1 -1
- package/dist/src/builders/server/bundlerService.mjs +164 -36
- package/dist/src/builders/server/bundlerService.mjs.map +1 -1
- package/dist/src/builders/server/capabilities.cjs +103 -0
- package/dist/src/builders/server/capabilities.cjs.map +1 -0
- package/dist/src/builders/server/capabilities.mjs +101 -0
- package/dist/src/builders/server/capabilities.mjs.map +1 -0
- package/dist/src/builders/server/computerUseBinding.cjs +62 -10
- package/dist/src/builders/server/computerUseBinding.cjs.map +1 -1
- package/dist/src/builders/server/computerUseBinding.mjs +60 -8
- package/dist/src/builders/server/computerUseBinding.mjs.map +1 -1
- package/dist/src/builders/server/computerUseRecordings.cjs +152 -51
- package/dist/src/builders/server/computerUseRecordings.cjs.map +1 -1
- package/dist/src/builders/server/computerUseRecordings.mjs +158 -59
- package/dist/src/builders/server/computerUseRecordings.mjs.map +1 -1
- package/dist/src/builders/server/containedSessions.cjs +152 -0
- package/dist/src/builders/server/containedSessions.cjs.map +1 -0
- package/dist/src/builders/server/containedSessions.mjs +146 -0
- package/dist/src/builders/server/containedSessions.mjs.map +1 -0
- package/dist/src/builders/server/defaultWorkspace.cjs +46 -11
- package/dist/src/builders/server/defaultWorkspace.cjs.map +1 -1
- package/dist/src/builders/server/defaultWorkspace.mjs +42 -10
- package/dist/src/builders/server/defaultWorkspace.mjs.map +1 -1
- package/dist/src/builders/server/electronBinding.cjs +82 -0
- package/dist/src/builders/server/electronBinding.cjs.map +1 -0
- package/dist/src/builders/server/electronBinding.mjs +82 -0
- package/dist/src/builders/server/electronBinding.mjs.map +1 -0
- package/dist/src/builders/server/federation.cjs +364 -0
- package/dist/src/builders/server/federation.cjs.map +1 -0
- package/dist/src/builders/server/federation.mjs +363 -0
- package/dist/src/builders/server/federation.mjs.map +1 -0
- package/dist/src/builders/server/hostDisplayName.cjs +14 -0
- package/dist/src/builders/server/hostDisplayName.cjs.map +1 -0
- package/dist/src/builders/server/hostDisplayName.mjs +14 -0
- package/dist/src/builders/server/hostDisplayName.mjs.map +1 -0
- package/dist/src/builders/server/hostModelGateway.cjs +41 -0
- package/dist/src/builders/server/hostModelGateway.cjs.map +1 -0
- package/dist/src/builders/server/hostModelGateway.mjs +39 -0
- package/dist/src/builders/server/hostModelGateway.mjs.map +1 -0
- package/dist/src/builders/server/hostTeam.cjs +188 -0
- package/dist/src/builders/server/hostTeam.cjs.map +1 -0
- package/dist/src/builders/server/hostTeam.mjs +180 -0
- package/dist/src/builders/server/hostTeam.mjs.map +1 -0
- package/dist/src/builders/server/idleRestart.cjs +185 -40
- package/dist/src/builders/server/idleRestart.cjs.map +1 -1
- package/dist/src/builders/server/idleRestart.mjs +176 -39
- package/dist/src/builders/server/idleRestart.mjs.map +1 -1
- package/dist/src/builders/server/index.cjs +33 -19
- package/dist/src/builders/server/index.cjs.map +1 -1
- package/dist/src/builders/server/index.mjs +33 -18
- package/dist/src/builders/server/index.mjs.map +1 -1
- package/dist/src/builders/server/liveActivityPush.cjs +202 -0
- package/dist/src/builders/server/liveActivityPush.cjs.map +1 -0
- package/dist/src/builders/server/liveActivityPush.mjs +202 -0
- package/dist/src/builders/server/liveActivityPush.mjs.map +1 -0
- package/dist/src/builders/server/logSink.cjs +12 -10
- package/dist/src/builders/server/logSink.cjs.map +1 -1
- package/dist/src/builders/server/logSink.mjs +12 -10
- package/dist/src/builders/server/logSink.mjs.map +1 -1
- package/dist/src/builders/server/mcpApp.cjs +27 -20
- package/dist/src/builders/server/mcpApp.cjs.map +1 -1
- package/dist/src/builders/server/mcpApp.mjs +25 -18
- package/dist/src/builders/server/mcpApp.mjs.map +1 -1
- package/dist/src/builders/server/mcpAppBuild.cjs +61 -41
- package/dist/src/builders/server/mcpAppBuild.cjs.map +1 -1
- package/dist/src/builders/server/mcpAppBuild.d.mts +3 -6
- package/dist/src/builders/server/mcpAppBuild.d.mts.map +1 -1
- package/dist/src/builders/server/mcpAppBuild.mjs +61 -40
- package/dist/src/builders/server/mcpAppBuild.mjs.map +1 -1
- package/dist/src/builders/server/mcpBundle.cjs +20 -16
- package/dist/src/builders/server/mcpBundle.cjs.map +1 -1
- package/dist/src/builders/server/mcpBundle.d.mts +2 -1
- package/dist/src/builders/server/mcpBundle.d.mts.map +1 -1
- package/dist/src/builders/server/mcpBundle.mjs +20 -15
- package/dist/src/builders/server/mcpBundle.mjs.map +1 -1
- package/dist/src/builders/server/nativePush.cjs +229 -0
- package/dist/src/builders/server/nativePush.cjs.map +1 -0
- package/dist/src/builders/server/nativePush.mjs +228 -0
- package/dist/src/builders/server/nativePush.mjs.map +1 -0
- package/dist/src/builders/server/network.cjs +887 -0
- package/dist/src/builders/server/network.cjs.map +1 -0
- package/dist/src/builders/server/network.mjs +886 -0
- package/dist/src/builders/server/network.mjs.map +1 -0
- package/dist/src/builders/server/networkGateway.cjs +123 -0
- package/dist/src/builders/server/networkGateway.cjs.map +1 -0
- package/dist/src/builders/server/networkGateway.mjs +123 -0
- package/dist/src/builders/server/networkGateway.mjs.map +1 -0
- package/dist/src/builders/server/networkRelay.cjs +83 -0
- package/dist/src/builders/server/networkRelay.cjs.map +1 -0
- package/dist/src/builders/server/networkRelay.mjs +81 -0
- package/dist/src/builders/server/networkRelay.mjs.map +1 -0
- package/dist/src/builders/server/orgPluginLibraryBinding.cjs +72 -0
- package/dist/src/builders/server/orgPluginLibraryBinding.cjs.map +1 -0
- package/dist/src/builders/server/orgPluginLibraryBinding.mjs +72 -0
- package/dist/src/builders/server/orgPluginLibraryBinding.mjs.map +1 -0
- package/dist/src/builders/server/packageReloadCheck.cjs +46 -2
- package/dist/src/builders/server/packageReloadCheck.cjs.map +1 -1
- package/dist/src/builders/server/packageReloadCheck.mjs +46 -3
- package/dist/src/builders/server/packageReloadCheck.mjs.map +1 -1
- package/dist/src/builders/server/packageUrl.cjs +161 -58
- package/dist/src/builders/server/packageUrl.cjs.map +1 -1
- package/dist/src/builders/server/packageUrl.mjs +162 -58
- package/dist/src/builders/server/packageUrl.mjs.map +1 -1
- package/dist/src/builders/server/privateRelay.cjs +309 -0
- package/dist/src/builders/server/privateRelay.cjs.map +1 -0
- package/dist/src/builders/server/privateRelay.mjs +305 -0
- package/dist/src/builders/server/privateRelay.mjs.map +1 -0
- package/dist/src/builders/server/privateRelayCarrier.cjs +316 -0
- package/dist/src/builders/server/privateRelayCarrier.cjs.map +1 -0
- package/dist/src/builders/server/privateRelayCarrier.mjs +309 -0
- package/dist/src/builders/server/privateRelayCarrier.mjs.map +1 -0
- package/dist/src/builders/server/runtime.cjs +2731 -485
- package/dist/src/builders/server/runtime.cjs.map +1 -1
- package/dist/src/builders/server/runtime.mjs +2741 -499
- package/dist/src/builders/server/runtime.mjs.map +1 -1
- package/dist/src/builders/server/runtimeResources.cjs +37 -0
- package/dist/src/builders/server/runtimeResources.cjs.map +1 -1
- package/dist/src/builders/server/runtimeResources.mjs +38 -2
- package/dist/src/builders/server/runtimeResources.mjs.map +1 -1
- package/dist/src/builders/server/sandboxRouter.cjs +815 -0
- package/dist/src/builders/server/sandboxRouter.cjs.map +1 -0
- package/dist/src/builders/server/sandboxRouter.mjs +811 -0
- package/dist/src/builders/server/sandboxRouter.mjs.map +1 -0
- package/dist/src/builders/server/sandboxSessionHandoff.cjs +298 -0
- package/dist/src/builders/server/sandboxSessionHandoff.cjs.map +1 -0
- package/dist/src/builders/server/sandboxSessionHandoff.mjs +287 -0
- package/dist/src/builders/server/sandboxSessionHandoff.mjs.map +1 -0
- package/dist/src/builders/server/scopeReloadController.cjs +80 -0
- package/dist/src/builders/server/scopeReloadController.cjs.map +1 -0
- package/dist/src/builders/server/scopeReloadController.mjs +80 -0
- package/dist/src/builders/server/scopeReloadController.mjs.map +1 -0
- package/dist/src/builders/server/selectionStatus.cjs +2 -2
- package/dist/src/builders/server/selectionStatus.cjs.map +1 -1
- package/dist/src/builders/server/selectionStatus.mjs +2 -2
- package/dist/src/builders/server/selectionStatus.mjs.map +1 -1
- package/dist/src/builders/server/sessionArguments.cjs +65 -7
- package/dist/src/builders/server/sessionArguments.cjs.map +1 -1
- package/dist/src/builders/server/sessionArguments.mjs +64 -8
- package/dist/src/builders/server/sessionArguments.mjs.map +1 -1
- package/dist/src/builders/server/sessionRemoval.cjs +233 -0
- package/dist/src/builders/server/sessionRemoval.cjs.map +1 -0
- package/dist/src/builders/server/sessionRemoval.mjs +224 -0
- package/dist/src/builders/server/sessionRemoval.mjs.map +1 -0
- package/dist/src/builders/server/sessionSummaries.cjs +32 -0
- package/dist/src/builders/server/sessionSummaries.cjs.map +1 -0
- package/dist/src/builders/server/sessionSummaries.mjs +31 -0
- package/dist/src/builders/server/sessionSummaries.mjs.map +1 -0
- package/dist/src/builders/server/shutdown.cjs +23 -0
- package/dist/src/builders/server/shutdown.cjs.map +1 -1
- package/dist/src/builders/server/shutdown.mjs +21 -1
- package/dist/src/builders/server/shutdown.mjs.map +1 -1
- package/dist/src/builders/server/shutdownStack.cjs +44 -0
- package/dist/src/builders/server/shutdownStack.cjs.map +1 -0
- package/dist/src/builders/server/shutdownStack.mjs +43 -0
- package/dist/src/builders/server/shutdownStack.mjs.map +1 -0
- package/dist/src/builders/server/toolBoundaryHold.cjs +55 -0
- package/dist/src/builders/server/toolBoundaryHold.cjs.map +1 -0
- package/dist/src/builders/server/toolBoundaryHold.mjs +55 -0
- package/dist/src/builders/server/toolBoundaryHold.mjs.map +1 -0
- package/dist/src/builders/server/watcherService.cjs +55 -28
- package/dist/src/builders/server/watcherService.cjs.map +1 -1
- package/dist/src/builders/server/watcherService.mjs +55 -27
- package/dist/src/builders/server/watcherService.mjs.map +1 -1
- package/dist/src/builders/server/webTemplateDecision.cjs +7 -3
- package/dist/src/builders/server/webTemplateDecision.cjs.map +1 -1
- package/dist/src/builders/server/webTemplateDecision.mjs +7 -3
- package/dist/src/builders/server/webTemplateDecision.mjs.map +1 -1
- package/dist/src/builders/server/workspaceAdmission.cjs +96 -0
- package/dist/src/builders/server/workspaceAdmission.cjs.map +1 -0
- package/dist/src/builders/server/workspaceAdmission.mjs +90 -0
- package/dist/src/builders/server/workspaceAdmission.mjs.map +1 -0
- package/dist/src/builders/server/workspaceCheckout.cjs +16 -7
- package/dist/src/builders/server/workspaceCheckout.cjs.map +1 -1
- package/dist/src/builders/server/workspaceCheckout.mjs +16 -7
- package/dist/src/builders/server/workspaceCheckout.mjs.map +1 -1
- package/dist/src/builders/web/bundle.cjs +16 -14
- package/dist/src/builders/web/bundle.cjs.map +1 -1
- package/dist/src/builders/web/bundle.d.mts +3 -0
- package/dist/src/builders/web/bundle.d.mts.map +1 -1
- package/dist/src/builders/web/bundle.mjs +15 -13
- package/dist/src/builders/web/bundle.mjs.map +1 -1
- package/dist/src/builders/web/index.cjs +77 -59
- package/dist/src/builders/web/index.cjs.map +1 -1
- package/dist/src/builders/web/index.d.mts +19 -14
- package/dist/src/builders/web/index.d.mts.map +1 -1
- package/dist/src/builders/web/index.mjs +76 -58
- package/dist/src/builders/web/index.mjs.map +1 -1
- package/dist/src/builders/web/webPluginGenerate.cjs +84 -45
- package/dist/src/builders/web/webPluginGenerate.cjs.map +1 -1
- package/dist/src/builders/web/webPluginGenerate.d.mts +13 -4
- package/dist/src/builders/web/webPluginGenerate.d.mts.map +1 -1
- package/dist/src/builders/web/webPluginGenerate.mjs +82 -44
- package/dist/src/builders/web/webPluginGenerate.mjs.map +1 -1
- package/dist/src/builders/web/webPluginManifest.cjs +24 -17
- package/dist/src/builders/web/webPluginManifest.cjs.map +1 -1
- package/dist/src/builders/web/webPluginManifest.d.mts +11 -23
- package/dist/src/builders/web/webPluginManifest.d.mts.map +1 -1
- package/dist/src/builders/web/webPluginManifest.mjs +23 -16
- package/dist/src/builders/web/webPluginManifest.mjs.map +1 -1
- package/dist/src/builders/web/webPluginScan.cjs +11 -8
- package/dist/src/builders/web/webPluginScan.cjs.map +1 -1
- package/dist/src/builders/web/webPluginScan.d.mts +1 -1
- package/dist/src/builders/web/webPluginScan.d.mts.map +1 -1
- package/dist/src/builders/web/webPluginScan.mjs +10 -7
- package/dist/src/builders/web/webPluginScan.mjs.map +1 -1
- package/dist/src/builders/web/webPluginVite.cjs +5 -5
- package/dist/src/builders/web/webPluginVite.cjs.map +1 -1
- package/dist/src/builders/web/webPluginVite.d.mts +1 -1
- package/dist/src/builders/web/webPluginVite.d.mts.map +1 -1
- package/dist/src/builders/web/webPluginVite.mjs +3 -3
- package/dist/src/builders/web/webPluginVite.mjs.map +1 -1
- package/dist/src/cli/cliApp.cjs +18 -19
- package/dist/src/cli/cliApp.cjs.map +1 -1
- package/dist/src/cli/cliApp.d.mts +1 -1
- package/dist/src/cli/cliApp.d.mts.map +1 -1
- package/dist/src/cli/cliApp.mjs +18 -19
- package/dist/src/cli/cliApp.mjs.map +1 -1
- package/dist/src/cli/commands/api-export/index.cjs +14 -13
- package/dist/src/cli/commands/api-export/index.cjs.map +1 -1
- package/dist/src/cli/commands/api-export/index.mjs +13 -12
- package/dist/src/cli/commands/api-export/index.mjs.map +1 -1
- package/dist/src/cli/commands/doctor/help.cjs +4 -3
- package/dist/src/cli/commands/doctor/help.cjs.map +1 -1
- package/dist/src/cli/commands/doctor/help.d.mts.map +1 -1
- package/dist/src/cli/commands/doctor/help.mjs +4 -3
- package/dist/src/cli/commands/doctor/help.mjs.map +1 -1
- package/dist/src/cli/commands/doctor/index.cjs +30 -17
- package/dist/src/cli/commands/doctor/index.cjs.map +1 -1
- package/dist/src/cli/commands/doctor/index.d.mts +4 -4
- package/dist/src/cli/commands/doctor/index.d.mts.map +1 -1
- package/dist/src/cli/commands/doctor/index.mjs +28 -15
- package/dist/src/cli/commands/doctor/index.mjs.map +1 -1
- package/dist/src/cli/commands/emit-mcp/index.cjs +3 -2
- package/dist/src/cli/commands/emit-mcp/index.cjs.map +1 -1
- package/dist/src/cli/commands/emit-mcp/index.d.mts.map +1 -1
- package/dist/src/cli/commands/emit-mcp/index.mjs +3 -2
- package/dist/src/cli/commands/emit-mcp/index.mjs.map +1 -1
- package/dist/src/cli/commands/explain/index.cjs +53 -38
- package/dist/src/cli/commands/explain/index.cjs.map +1 -1
- package/dist/src/cli/commands/explain/index.d.mts +3 -4
- package/dist/src/cli/commands/explain/index.d.mts.map +1 -1
- package/dist/src/cli/commands/explain/index.mjs +52 -37
- package/dist/src/cli/commands/explain/index.mjs.map +1 -1
- package/dist/src/cli/commands/init/help.cjs +3 -2
- package/dist/src/cli/commands/init/help.cjs.map +1 -1
- package/dist/src/cli/commands/init/help.d.mts.map +1 -1
- package/dist/src/cli/commands/init/help.mjs +3 -2
- package/dist/src/cli/commands/init/help.mjs.map +1 -1
- package/dist/src/cli/commands/init/index.cjs +17 -12
- package/dist/src/cli/commands/init/index.cjs.map +1 -1
- package/dist/src/cli/commands/init/index.d.mts.map +1 -1
- package/dist/src/cli/commands/init/index.mjs +16 -11
- package/dist/src/cli/commands/init/index.mjs.map +1 -1
- package/dist/src/cli/commands/init/presenter.cjs +29 -21
- package/dist/src/cli/commands/init/presenter.cjs.map +1 -1
- package/dist/src/cli/commands/init/presenter.mjs +29 -21
- package/dist/src/cli/commands/init/presenter.mjs.map +1 -1
- package/dist/src/cli/commands/sync/help.cjs +7 -3
- package/dist/src/cli/commands/sync/help.cjs.map +1 -1
- package/dist/src/cli/commands/sync/help.d.mts.map +1 -1
- package/dist/src/cli/commands/sync/help.mjs +7 -3
- package/dist/src/cli/commands/sync/help.mjs.map +1 -1
- package/dist/src/cli/commands/sync/index.cjs +72 -40
- package/dist/src/cli/commands/sync/index.cjs.map +1 -1
- package/dist/src/cli/commands/sync/index.d.mts.map +1 -1
- package/dist/src/cli/commands/sync/index.mjs +69 -37
- package/dist/src/cli/commands/sync/index.mjs.map +1 -1
- package/dist/src/cli/commands/sync/presenter.cjs +10 -1
- package/dist/src/cli/commands/sync/presenter.cjs.map +1 -1
- package/dist/src/cli/commands/sync/presenter.d.mts +0 -9
- package/dist/src/cli/commands/sync/presenter.d.mts.map +1 -1
- package/dist/src/cli/commands/sync/presenter.mjs +10 -1
- package/dist/src/cli/commands/sync/presenter.mjs.map +1 -1
- package/dist/src/cli/commands/web/index.cjs +7 -6
- package/dist/src/cli/commands/web/index.cjs.map +1 -1
- package/dist/src/cli/commands/web/index.mjs +6 -5
- package/dist/src/cli/commands/web/index.mjs.map +1 -1
- package/dist/src/cli/harnessOptions.cjs +15 -24
- package/dist/src/cli/harnessOptions.cjs.map +1 -1
- package/dist/src/cli/harnessOptions.d.mts +2 -2
- package/dist/src/cli/harnessOptions.d.mts.map +1 -1
- package/dist/src/cli/harnessOptions.mjs +14 -22
- package/dist/src/cli/harnessOptions.mjs.map +1 -1
- package/dist/src/cli/help.cjs +20 -26
- package/dist/src/cli/help.cjs.map +1 -1
- package/dist/src/cli/help.d.mts +1 -2
- package/dist/src/cli/help.d.mts.map +1 -1
- package/dist/src/cli/help.mjs +15 -20
- package/dist/src/cli/help.mjs.map +1 -1
- package/dist/src/cli/locale.cjs +25 -0
- package/dist/src/cli/locale.cjs.map +1 -0
- package/dist/src/cli/locale.mjs +22 -0
- package/dist/src/cli/locale.mjs.map +1 -0
- package/dist/src/cli/matrixOptions.cjs +85 -37
- package/dist/src/cli/matrixOptions.cjs.map +1 -1
- package/dist/src/cli/matrixOptions.d.mts +22 -16
- package/dist/src/cli/matrixOptions.d.mts.map +1 -1
- package/dist/src/cli/matrixOptions.mjs +76 -33
- package/dist/src/cli/matrixOptions.mjs.map +1 -1
- package/dist/src/cli/options.cjs +51 -128
- package/dist/src/cli/options.cjs.map +1 -1
- package/dist/src/cli/options.d.mts +1 -1
- package/dist/src/cli/options.d.mts.map +1 -1
- package/dist/src/cli/options.mjs +53 -130
- package/dist/src/cli/options.mjs.map +1 -1
- package/dist/src/cli/router.cjs +0 -1
- package/dist/src/cli/router.cjs.map +1 -1
- package/dist/src/cli/router.d.mts +1 -1
- package/dist/src/cli/router.mjs +0 -1
- package/dist/src/cli/router.mjs.map +1 -1
- package/dist/src/cli/server/options.cjs +37 -7
- package/dist/src/cli/server/options.cjs.map +1 -1
- package/dist/src/cli/server/options.mjs +37 -7
- package/dist/src/cli/server/options.mjs.map +1 -1
- package/dist/src/cli/server/processGuards.cjs +22 -15
- package/dist/src/cli/server/processGuards.cjs.map +1 -1
- package/dist/src/cli/server/processGuards.mjs +21 -14
- package/dist/src/cli/server/processGuards.mjs.map +1 -1
- package/dist/src/cli/server/restartPolicy.cjs +38 -0
- package/dist/src/cli/server/restartPolicy.cjs.map +1 -0
- package/dist/src/cli/server/restartPolicy.d.mts +21 -0
- package/dist/src/cli/server/restartPolicy.d.mts.map +1 -0
- package/dist/src/cli/server/restartPolicy.mjs +36 -0
- package/dist/src/cli/server/restartPolicy.mjs.map +1 -0
- package/dist/src/cli/server/run.cjs +12 -11
- package/dist/src/cli/server/run.cjs.map +1 -1
- package/dist/src/cli/server/run.mjs +11 -10
- package/dist/src/cli/server/run.mjs.map +1 -1
- package/dist/src/cli/server/supervise.cjs +89 -0
- package/dist/src/cli/server/supervise.cjs.map +1 -0
- package/dist/src/cli/server/supervise.mjs +89 -0
- package/dist/src/cli/server/supervise.mjs.map +1 -0
- package/dist/src/composition/harnessState/index.cjs +2 -1
- package/dist/src/composition/harnessState/index.cjs.map +1 -1
- package/dist/src/composition/harnessState/index.d.mts +2 -1
- package/dist/src/composition/harnessState/index.d.mts.map +1 -1
- package/dist/src/composition/harnessState/index.mjs +2 -1
- package/dist/src/composition/harnessState/index.mjs.map +1 -1
- package/dist/src/composition/layerPackageInstaller/index.cjs +293 -86
- package/dist/src/composition/layerPackageInstaller/index.cjs.map +1 -1
- package/dist/src/composition/layerPackageInstaller/index.d.mts +25 -2
- package/dist/src/composition/layerPackageInstaller/index.d.mts.map +1 -1
- package/dist/src/composition/layerPackageInstaller/index.mjs +295 -94
- package/dist/src/composition/layerPackageInstaller/index.mjs.map +1 -1
- package/dist/src/composition/marketplaceCatalog/index.cjs +136 -0
- package/dist/src/composition/marketplaceCatalog/index.cjs.map +1 -0
- package/dist/src/composition/marketplaceCatalog/index.mjs +132 -0
- package/dist/src/composition/marketplaceCatalog/index.mjs.map +1 -0
- package/dist/src/composition/orgPluginActivation/index.cjs +179 -0
- package/dist/src/composition/orgPluginActivation/index.cjs.map +1 -0
- package/dist/src/composition/orgPluginActivation/index.mjs +177 -0
- package/dist/src/composition/orgPluginActivation/index.mjs.map +1 -0
- package/dist/src/composition/orgPluginLibrary/index.cjs +205 -0
- package/dist/src/composition/orgPluginLibrary/index.cjs.map +1 -0
- package/dist/src/composition/orgPluginLibrary/index.mjs +200 -0
- package/dist/src/composition/orgPluginLibrary/index.mjs.map +1 -0
- package/dist/src/composition/pluginMarketplace/index.cjs +304 -0
- package/dist/src/composition/pluginMarketplace/index.cjs.map +1 -0
- package/dist/src/composition/pluginMarketplace/index.mjs +302 -0
- package/dist/src/composition/pluginMarketplace/index.mjs.map +1 -0
- package/dist/src/composition/poHomeMigration/index.cjs +46 -26
- package/dist/src/composition/poHomeMigration/index.cjs.map +1 -1
- package/dist/src/composition/poHomeMigration/index.d.mts.map +1 -1
- package/dist/src/composition/poHomeMigration/index.mjs +45 -25
- package/dist/src/composition/poHomeMigration/index.mjs.map +1 -1
- package/dist/src/composition/projectTrust/index.cjs +40 -3
- package/dist/src/composition/projectTrust/index.cjs.map +1 -1
- package/dist/src/composition/projectTrust/index.d.mts +8 -0
- package/dist/src/composition/projectTrust/index.d.mts.map +1 -1
- package/dist/src/composition/projectTrust/index.mjs +33 -2
- package/dist/src/composition/projectTrust/index.mjs.map +1 -1
- package/dist/src/composition/repository/index.cjs +29 -12
- package/dist/src/composition/repository/index.cjs.map +1 -1
- package/dist/src/composition/repository/index.d.mts +10 -3
- package/dist/src/composition/repository/index.d.mts.map +1 -1
- package/dist/src/composition/repository/index.mjs +29 -13
- package/dist/src/composition/repository/index.mjs.map +1 -1
- package/dist/src/composition/syncPrune/index.cjs +23 -16
- package/dist/src/composition/syncPrune/index.cjs.map +1 -1
- package/dist/src/composition/syncPrune/index.d.mts.map +1 -1
- package/dist/src/composition/syncPrune/index.mjs +22 -15
- package/dist/src/composition/syncPrune/index.mjs.map +1 -1
- package/dist/src/composition/syncService/index.cjs +441 -194
- package/dist/src/composition/syncService/index.cjs.map +1 -1
- package/dist/src/composition/syncService/index.d.mts +4 -1
- package/dist/src/composition/syncService/index.d.mts.map +1 -1
- package/dist/src/composition/syncService/index.mjs +440 -196
- package/dist/src/composition/syncService/index.mjs.map +1 -1
- package/dist/src/composition/syncService/localBuilds.cjs +41 -37
- package/dist/src/composition/syncService/localBuilds.cjs.map +1 -1
- package/dist/src/composition/syncService/localBuilds.mjs +40 -37
- package/dist/src/composition/syncService/localBuilds.mjs.map +1 -1
- package/dist/src/composition/transitionLayers.cjs.map +1 -1
- package/dist/src/composition/transitionLayers.d.mts +3 -3
- package/dist/src/composition/transitionLayers.d.mts.map +1 -1
- package/dist/src/composition/transitionLayers.mjs.map +1 -1
- package/dist/src/composition/types/harness.d.mts +4 -9
- package/dist/src/composition/types/harness.d.mts.map +1 -1
- package/dist/src/extensions/setupDiagnostics.cjs +8 -8
- package/dist/src/extensions/setupDiagnostics.cjs.map +1 -1
- package/dist/src/extensions/setupDiagnostics.mjs +8 -8
- package/dist/src/extensions/setupDiagnostics.mjs.map +1 -1
- package/dist/webBuilder.cjs +1 -0
- package/dist/webBuilder.d.mts +2 -2
- package/dist/webBuilder.mjs +2 -2
- package/docs/server/api-export.md +9 -9
- package/docs/server/api.md +22 -125
- package/docs/server/getting-started.md +21 -85
- package/docs/server/index.md +13 -58
- package/docs/server/ipc.md +26 -72
- package/docs/server/lifecycle.md +18 -91
- package/docs/server/security.md +20 -80
- package/package.json +47 -67
- package/src/prompts/po-author-extension/SKILL.md +2 -2
- package/src/prompts/po-author-extension/references/extension-contract.md +4 -6
- package/dist/antigravity.cjs +0 -5
- package/dist/antigravity.d.mts +0 -2
- package/dist/antigravity.mjs +0 -1
- package/dist/codex.cjs +0 -8
- package/dist/codex.d.mts +0 -2
- package/dist/codex.mjs +0 -1
- package/dist/compatibility.cjs +0 -27
- package/dist/compatibility.d.mts +0 -6
- package/dist/compatibility.mjs +0 -6
- package/dist/compatibilityCommand.cjs +0 -4
- package/dist/compatibilityCommand.d.mts +0 -2
- package/dist/compatibilityCommand.mjs +0 -1
- package/dist/compatibilityContext.cjs +0 -3
- package/dist/compatibilityContext.d.mts +0 -2
- package/dist/compatibilityContext.mjs +0 -1
- package/dist/compatibilityOptions.cjs +0 -5
- package/dist/compatibilityOptions.d.mts +0 -2
- package/dist/compatibilityOptions.mjs +0 -1
- package/dist/process.cjs +0 -12
- package/dist/process.d.mts +0 -2
- package/dist/process.mjs +0 -1
- package/dist/src/builders/hooks/index.cjs +0 -238
- package/dist/src/builders/hooks/index.cjs.map +0 -1
- package/dist/src/builders/hooks/index.mjs +0 -231
- package/dist/src/builders/hooks/index.mjs.map +0 -1
- package/dist/src/cli/commands/compat/context.cjs +0 -115
- package/dist/src/cli/commands/compat/context.cjs.map +0 -1
- package/dist/src/cli/commands/compat/context.d.mts +0 -22
- package/dist/src/cli/commands/compat/context.d.mts.map +0 -1
- package/dist/src/cli/commands/compat/context.mjs +0 -110
- package/dist/src/cli/commands/compat/context.mjs.map +0 -1
- package/dist/src/cli/commands/compat/help.cjs +0 -26
- package/dist/src/cli/commands/compat/help.cjs.map +0 -1
- package/dist/src/cli/commands/compat/help.d.mts +0 -4
- package/dist/src/cli/commands/compat/help.d.mts.map +0 -1
- package/dist/src/cli/commands/compat/help.mjs +0 -25
- package/dist/src/cli/commands/compat/help.mjs.map +0 -1
- package/dist/src/cli/commands/compat/index.cjs +0 -73
- package/dist/src/cli/commands/compat/index.cjs.map +0 -1
- package/dist/src/cli/commands/compat/index.d.mts +0 -14
- package/dist/src/cli/commands/compat/index.d.mts.map +0 -1
- package/dist/src/cli/commands/compat/index.mjs +0 -70
- package/dist/src/cli/commands/compat/index.mjs.map +0 -1
- package/dist/src/cli/commands/compat/options.cjs +0 -88
- package/dist/src/cli/commands/compat/options.cjs.map +0 -1
- package/dist/src/cli/commands/compat/options.d.mts +0 -15
- package/dist/src/cli/commands/compat/options.d.mts.map +0 -1
- package/dist/src/cli/commands/compat/options.mjs +0 -86
- package/dist/src/cli/commands/compat/options.mjs.map +0 -1
- package/dist/src/cli/commands/compat/providers/antigravity.cjs +0 -294
- package/dist/src/cli/commands/compat/providers/antigravity.cjs.map +0 -1
- package/dist/src/cli/commands/compat/providers/antigravity.d.mts +0 -9
- package/dist/src/cli/commands/compat/providers/antigravity.d.mts.map +0 -1
- package/dist/src/cli/commands/compat/providers/antigravity.mjs +0 -289
- package/dist/src/cli/commands/compat/providers/antigravity.mjs.map +0 -1
- package/dist/src/cli/commands/compat/providers/codex.cjs +0 -178
- package/dist/src/cli/commands/compat/providers/codex.cjs.map +0 -1
- package/dist/src/cli/commands/compat/providers/codex.d.mts +0 -17
- package/dist/src/cli/commands/compat/providers/codex.d.mts.map +0 -1
- package/dist/src/cli/commands/compat/providers/codex.mjs +0 -170
- package/dist/src/cli/commands/compat/providers/codex.mjs.map +0 -1
- package/dist/src/cli/commands/compat/providers/index.cjs +0 -65
- package/dist/src/cli/commands/compat/providers/index.cjs.map +0 -1
- package/dist/src/cli/commands/compat/providers/index.d.mts +0 -15
- package/dist/src/cli/commands/compat/providers/index.d.mts.map +0 -1
- package/dist/src/cli/commands/compat/providers/index.mjs +0 -45
- package/dist/src/cli/commands/compat/providers/index.mjs.map +0 -1
- package/dist/src/cli/commands/compat/providers/process.cjs +0 -172
- package/dist/src/cli/commands/compat/providers/process.cjs.map +0 -1
- package/dist/src/cli/commands/compat/providers/process.d.mts +0 -33
- package/dist/src/cli/commands/compat/providers/process.d.mts.map +0 -1
- package/dist/src/cli/commands/compat/providers/process.mjs +0 -159
- package/dist/src/cli/commands/compat/providers/process.mjs.map +0 -1
- package/dist/src/cli/commands/compat/providers/shared.cjs +0 -76
- package/dist/src/cli/commands/compat/providers/shared.cjs.map +0 -1
- package/dist/src/cli/commands/compat/providers/shared.d.mts +0 -40
- package/dist/src/cli/commands/compat/providers/shared.d.mts.map +0 -1
- package/dist/src/cli/commands/compat/providers/shared.mjs +0 -61
- package/dist/src/cli/commands/compat/providers/shared.mjs.map +0 -1
- package/dist/src/cli/commands/compat/types.d.mts +0 -31
- package/dist/src/cli/commands/compat/types.d.mts.map +0 -1
- package/dist/src/cli/commands/init/constants.cjs +0 -11
- package/dist/src/cli/commands/init/constants.cjs.map +0 -1
- package/dist/src/cli/commands/init/constants.mjs +0 -11
- package/dist/src/cli/commands/init/constants.mjs.map +0 -1
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { poPackageRoot } from "../../builders/cli/entryResolution.mjs";
|
|
2
2
|
import { createLayerResolvers } from "../../../builders/cli/extensionAssembler/index.mjs";
|
|
3
|
-
import fs from "node:fs";
|
|
4
|
-
import path from "node:path";
|
|
5
|
-
import { writeFileAtomic } from "@agimon-ai/po-core/runtimeJson";
|
|
6
3
|
import os from "node:os";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
4
|
+
import { formatMessage } from "@agimon-ai/po-core/locale";
|
|
5
|
+
import { poHomeDirectory, poRuntimeDirectory } from "@agimon-ai/po-core/runtimePiSettings";
|
|
6
|
+
import path from "node:path";
|
|
7
|
+
import fs from "node:fs/promises";
|
|
8
|
+
import { createNodePlatform } from "@agimon-ai/po-core/nodePlatform";
|
|
9
|
+
import { BACKGROUND_CONTEXT, getOrThrow, readTextIfExists, writeFileAtomic } from "@agimon-ai/po-core/platform";
|
|
10
|
+
import { isLocalPackageSpecifier } from "@agimon-ai/po-config/presets";
|
|
11
|
+
import { checkoutPackageRoot, consumerPackageEntry, splitPackageSpecifier } from "@agimon-ai/po-core/moduleResolution";
|
|
9
12
|
import crypto from "node:crypto";
|
|
10
13
|
import zlib from "node:zlib";
|
|
11
14
|
import { installRuntimePackages, resolveNewest } from "@agimon-ai/po-core/runtimePackages";
|
|
12
|
-
import {
|
|
15
|
+
import { fetchVerifiedPluginArchive, verifiedArchiveFiles } from "@agimon-ai/po-core/verifiedArchive";
|
|
13
16
|
//#region src/composition/layerPackageInstaller/index.ts
|
|
14
17
|
const NPM_SOURCE_PREFIX = "npm:";
|
|
15
18
|
const FILE_SPECIFIER_PREFIX = "file:";
|
|
@@ -29,6 +32,9 @@ const BUNDLED_CATALOG_SEGMENTS = [
|
|
|
29
32
|
"catalog",
|
|
30
33
|
"index.json"
|
|
31
34
|
];
|
|
35
|
+
/** The catalogue a checkout build writes beside `dist`, where a rebuild does not wipe it. Never published. */
|
|
36
|
+
const CHECKOUT_CATALOG_FILE = "catalog.json";
|
|
37
|
+
const NO_CURATED_CATALOG = "This CLI has no curated release catalog.";
|
|
32
38
|
/** upm error codes that mean the registry could not be reached, so the store may still answer. */
|
|
33
39
|
const NETWORK_FAILURE_CODES = /* @__PURE__ */ new Set([
|
|
34
40
|
"ENETWORK",
|
|
@@ -45,7 +51,7 @@ function overridePackageName(selector) {
|
|
|
45
51
|
* cannot carry these fixes in their own manifests.
|
|
46
52
|
*/
|
|
47
53
|
const SAFE_TRANSITIVE_OVERRIDES = {
|
|
48
|
-
"@earendil-works/pi-codemode": "1.
|
|
54
|
+
"@earendil-works/pi-codemode": "1.6.1",
|
|
49
55
|
"@hono/node-server@2.0.0 - 2.0.9": "^2.0.10",
|
|
50
56
|
"@opentelemetry/core@2.0.0 - 2.7.999": "2.8.0",
|
|
51
57
|
"brace-expansion@1.0.0 - 1.1.20": "^1.1.21",
|
|
@@ -58,16 +64,16 @@ const SAFE_TRANSITIVE_OVERRIDES = {
|
|
|
58
64
|
"undici@7.0.0 - 7.29.0": "^7.29.1"
|
|
59
65
|
};
|
|
60
66
|
const SAFE_TRANSITIVE_PACKAGE_NAMES = new Set(Object.keys(SAFE_TRANSITIVE_OVERRIDES).map(overridePackageName));
|
|
61
|
-
function isRecord
|
|
67
|
+
function isRecord(value) {
|
|
62
68
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
63
69
|
}
|
|
64
70
|
function recordValue(value) {
|
|
65
|
-
return isRecord
|
|
71
|
+
return isRecord(value) ? { ...value } : {};
|
|
66
72
|
}
|
|
67
73
|
function withoutConflictingTransitiveOverrides(value) {
|
|
68
74
|
const overrides = recordValue(value);
|
|
69
75
|
for (const [selector, replacement] of Object.entries(overrides)) if (SAFE_TRANSITIVE_PACKAGE_NAMES.has(overridePackageName(selector))) delete overrides[selector];
|
|
70
|
-
else if (isRecord
|
|
76
|
+
else if (isRecord(replacement)) overrides[selector] = withoutConflictingTransitiveOverrides(replacement);
|
|
71
77
|
return overrides;
|
|
72
78
|
}
|
|
73
79
|
/** Earlier versions overrode catalog packages with relative `file:` targets; any other override is not Po's. */
|
|
@@ -94,8 +100,11 @@ function resolvePackageEntries(resolvers, specifier) {
|
|
|
94
100
|
const entry = resolvers.optionalPackageEntry(specifier);
|
|
95
101
|
return entry ? [entry] : void 0;
|
|
96
102
|
}
|
|
97
|
-
function readRuntimeManifest(manifestPath) {
|
|
98
|
-
const current =
|
|
103
|
+
async function readRuntimeManifest(manifestPath) {
|
|
104
|
+
const current = await fs.readFile(manifestPath, "utf8").catch((error) => {
|
|
105
|
+
if (error.code === "ENOENT") return void 0;
|
|
106
|
+
throw error;
|
|
107
|
+
});
|
|
99
108
|
if (current === void 0) return {
|
|
100
109
|
current,
|
|
101
110
|
manifest: {
|
|
@@ -104,17 +113,16 @@ function readRuntimeManifest(manifestPath) {
|
|
|
104
113
|
}
|
|
105
114
|
};
|
|
106
115
|
const parsed = JSON.parse(current);
|
|
107
|
-
if (!isRecord
|
|
116
|
+
if (!isRecord(parsed)) throw new Error(`Po runtime package manifest at ${manifestPath} must be a JSON object.`);
|
|
108
117
|
return {
|
|
109
118
|
current,
|
|
110
119
|
manifest: parsed
|
|
111
120
|
};
|
|
112
121
|
}
|
|
113
122
|
/** Names the runtime manifest already declares: what earlier runs, from any root, installed there. */
|
|
114
|
-
function declaredRuntimePackages(runtimeDirectory) {
|
|
123
|
+
async function declaredRuntimePackages(runtimeDirectory) {
|
|
115
124
|
const manifestPath = path.join(runtimeDirectory, PACKAGE_MANIFEST);
|
|
116
|
-
|
|
117
|
-
return new Set(Object.keys(recordValue(readRuntimeManifest(manifestPath).manifest.dependencies)));
|
|
125
|
+
return new Set(Object.keys(recordValue((await readRuntimeManifest(manifestPath)).manifest.dependencies)));
|
|
118
126
|
}
|
|
119
127
|
/**
|
|
120
128
|
* Adds a package set and the patched transitive policy to the shared runtime manifest.
|
|
@@ -126,14 +134,16 @@ function declaredRuntimePackages(runtimeDirectory) {
|
|
|
126
134
|
* `pnpm.overrides` are written; upm reads both.
|
|
127
135
|
* With `exact`, declared names outside `sources` are dropped instead of kept.
|
|
128
136
|
*/
|
|
129
|
-
function ensureManagedPackageManifest(runtimeDirectory, sources, targets = /* @__PURE__ */ new Map(), catalogWorkspaces = {}, exact = false) {
|
|
137
|
+
async function ensureManagedPackageManifest(runtimeDirectory, sources, targets = /* @__PURE__ */ new Map(), catalogWorkspaces = {}, exact = false, preserveWorkspaces = false) {
|
|
130
138
|
const manifestPath = path.join(runtimeDirectory, PACKAGE_MANIFEST);
|
|
131
|
-
const { current, manifest } = readRuntimeManifest(manifestPath);
|
|
139
|
+
const { current, manifest } = await readRuntimeManifest(manifestPath);
|
|
132
140
|
const declared = recordValue(manifest.dependencies);
|
|
133
141
|
const sourceNames = new Set(sources.map(packageName));
|
|
134
142
|
const dependencies = exact ? Object.fromEntries(Object.entries(declared).filter(([name]) => sourceNames.has(name))) : declared;
|
|
135
143
|
for (const [name, declared] of Object.entries(dependencies)) if (Object.hasOwn(catalogWorkspaces, name)) dependencies[name] = CATALOG_WORKSPACE_TARGET;
|
|
136
|
-
else if (typeof declared === "string" && (declared.startsWith(FILE_SPECIFIER_PREFIX) || declared.startsWith(WORKSPACE_SPECIFIER_PREFIX)))
|
|
144
|
+
else if (typeof declared === "string" && (declared.startsWith(FILE_SPECIFIER_PREFIX) || declared.startsWith(WORKSPACE_SPECIFIER_PREFIX))) {
|
|
145
|
+
if (!preserveWorkspaces) dependencies[name] = UNPINNED_PACKAGE_RANGE;
|
|
146
|
+
}
|
|
137
147
|
for (const source of sources) {
|
|
138
148
|
const name = packageName(source);
|
|
139
149
|
const target = targets.get(name);
|
|
@@ -141,7 +151,12 @@ function ensureManagedPackageManifest(runtimeDirectory, sources, targets = /* @_
|
|
|
141
151
|
else if (!Object.hasOwn(dependencies, name)) dependencies[name] = UNPINNED_PACKAGE_RANGE;
|
|
142
152
|
}
|
|
143
153
|
manifest.dependencies = dependencies;
|
|
144
|
-
const
|
|
154
|
+
const keptWorkspaces = [];
|
|
155
|
+
if (preserveWorkspaces) for (const relative of stringList(manifest.workspaces) ?? []) {
|
|
156
|
+
const previous = await readRuntimeManifest(path.join(runtimeDirectory, relative, PACKAGE_MANIFEST));
|
|
157
|
+
if (typeof previous.manifest.name === "string" && !Object.hasOwn(catalogWorkspaces, previous.manifest.name)) keptWorkspaces.push(relative);
|
|
158
|
+
}
|
|
159
|
+
const workspaces = [.../* @__PURE__ */ new Set([...keptWorkspaces, ...Object.values(catalogWorkspaces)])].sort();
|
|
145
160
|
if (workspaces.length > 0) manifest.workspaces = workspaces;
|
|
146
161
|
else delete manifest.workspaces;
|
|
147
162
|
manifest.overrides = {
|
|
@@ -156,8 +171,8 @@ function ensureManagedPackageManifest(runtimeDirectory, sources, targets = /* @_
|
|
|
156
171
|
manifest.pnpm = pnpm;
|
|
157
172
|
const serialized = `${JSON.stringify(manifest, null, 2)}\n`;
|
|
158
173
|
if (serialized === current) return false;
|
|
159
|
-
fs.
|
|
160
|
-
writeFileAtomic(manifestPath, serialized);
|
|
174
|
+
await fs.mkdir(runtimeDirectory, { recursive: true });
|
|
175
|
+
await writeFileAtomic(createNodePlatform().env(runtimeDirectory), manifestPath, serialized, BACKGROUND_CONTEXT);
|
|
161
176
|
return true;
|
|
162
177
|
}
|
|
163
178
|
/** Finds required npm packages selected by defaults and active layers that Po cannot resolve. */
|
|
@@ -165,9 +180,12 @@ function missingLayerPackageSpecifiers(config, layers, resolvers) {
|
|
|
165
180
|
return configuredPackageSpecifiers(config, layers).filter((specifier) => resolvePackageEntries(resolvers, specifier) === void 0);
|
|
166
181
|
}
|
|
167
182
|
/** Whether `root`'s own node_modules chain holds the package, walked the way Node looks it up from `root`. */
|
|
168
|
-
function ownsPackage(name, root) {
|
|
183
|
+
async function ownsPackage(name, root) {
|
|
169
184
|
for (let directory = path.resolve(root);; directory = path.dirname(directory)) {
|
|
170
|
-
if (fs.
|
|
185
|
+
if (await fs.access(path.join(directory, NODE_MODULES, name, PACKAGE_MANIFEST)).then(() => true, (error) => {
|
|
186
|
+
if (error.code === "ENOENT") return false;
|
|
187
|
+
throw error;
|
|
188
|
+
})) return true;
|
|
171
189
|
if (path.dirname(directory) === directory) return false;
|
|
172
190
|
}
|
|
173
191
|
}
|
|
@@ -177,8 +195,10 @@ function ownsPackage(name, root) {
|
|
|
177
195
|
* already or not yet. Sync declares exactly these, over every root, in the runtime manifest; a
|
|
178
196
|
* name the runtime already provides still counts, or the next exact manifest would drop it.
|
|
179
197
|
*/
|
|
180
|
-
function runtimeLayerPackageSpecifiers(config, layers, root) {
|
|
181
|
-
|
|
198
|
+
async function runtimeLayerPackageSpecifiers(config, layers, root) {
|
|
199
|
+
const specifiers = configuredPackageSpecifiers(config, layers);
|
|
200
|
+
const owned = await Promise.all(specifiers.map((specifier) => ownsPackage(splitPackageSpecifier(specifier).name, root)));
|
|
201
|
+
return specifiers.filter((_specifier, index) => !owned[index]);
|
|
182
202
|
}
|
|
183
203
|
function packageName(source) {
|
|
184
204
|
const specifier = source.startsWith(NPM_SOURCE_PREFIX) ? source.slice(4) : source;
|
|
@@ -210,19 +230,23 @@ function defaultBundledCatalogPath() {
|
|
|
210
230
|
* The first catalogue present: `PO_PACKAGE_CATALOG` (desktop's archives), then the one
|
|
211
231
|
* a release bundles into the CLI. With neither, the runtime installs only what roots name.
|
|
212
232
|
*/
|
|
213
|
-
function packageCatalogPath(environment) {
|
|
233
|
+
async function packageCatalogPath(environment) {
|
|
214
234
|
const configured = environment[PACKAGE_CATALOG_ENV]?.trim();
|
|
215
235
|
if (configured) return configured;
|
|
216
236
|
const bundledCatalogPath = defaultBundledCatalogPath();
|
|
217
|
-
|
|
237
|
+
if (bundledCatalogPath === void 0) return void 0;
|
|
238
|
+
return fs.access(bundledCatalogPath).then(() => bundledCatalogPath, (error) => {
|
|
239
|
+
if (error.code === "ENOENT") return void 0;
|
|
240
|
+
throw error;
|
|
241
|
+
});
|
|
218
242
|
}
|
|
219
|
-
function readPackageCatalog(manifestPath) {
|
|
243
|
+
async function readPackageCatalog(manifestPath) {
|
|
220
244
|
if (!manifestPath) return EMPTY_CATALOG;
|
|
221
|
-
const parsed = JSON.parse(fs.
|
|
222
|
-
if (!isRecord
|
|
245
|
+
const parsed = JSON.parse(await fs.readFile(manifestPath, "utf8"));
|
|
246
|
+
if (!isRecord(parsed) || parsed.version !== 1 || !isRecord(parsed.packages)) throw new Error(`Unsupported Po package catalog: ${manifestPath}`);
|
|
223
247
|
const packages = /* @__PURE__ */ new Map();
|
|
224
248
|
for (const [name, value] of Object.entries(parsed.packages)) {
|
|
225
|
-
if (!isRecord
|
|
249
|
+
if (!isRecord(value) || !Array.isArray(value.dependencies) || value.archive !== void 0 && typeof value.archive !== "string" || value.version !== void 0 && typeof value.version !== "string" || value.archive === void 0 && value.version === void 0) throw new Error(`Invalid package entry for ${name} in ${manifestPath}`);
|
|
226
250
|
const dependencies = stringList(value.dependencies);
|
|
227
251
|
if (!dependencies) throw new Error(`Invalid dependencies for ${name} in ${manifestPath}`);
|
|
228
252
|
const version = typeof value.version === "string" ? value.version : void 0;
|
|
@@ -234,7 +258,10 @@ function readPackageCatalog(manifestPath) {
|
|
|
234
258
|
continue;
|
|
235
259
|
}
|
|
236
260
|
const archive = path.resolve(path.dirname(manifestPath), value.archive);
|
|
237
|
-
|
|
261
|
+
await fs.access(archive).catch((error) => {
|
|
262
|
+
if (error.code === "ENOENT") throw new Error(`Po package catalog archive is missing: ${archive}`);
|
|
263
|
+
throw error;
|
|
264
|
+
});
|
|
238
265
|
packages.set(name, {
|
|
239
266
|
archive,
|
|
240
267
|
version,
|
|
@@ -250,12 +277,18 @@ function readPackageCatalog(manifestPath) {
|
|
|
250
277
|
install
|
|
251
278
|
};
|
|
252
279
|
}
|
|
280
|
+
/** All distribution catalog names, or undefined when no authoritative catalog is available. */
|
|
281
|
+
async function catalogPackageNames(environment) {
|
|
282
|
+
const catalogPath = await packageCatalogPath(environment);
|
|
283
|
+
if (catalogPath === void 0) return void 0;
|
|
284
|
+
return new Set((await readPackageCatalog(catalogPath)).packages.keys());
|
|
285
|
+
}
|
|
253
286
|
/**
|
|
254
287
|
* The catalogue's `install` list as exact `name@version` specifiers for
|
|
255
288
|
* `EnsureLayerPackagesOptions.specifiers`; empty when no catalogue is present.
|
|
256
289
|
*/
|
|
257
|
-
function catalogInstallSpecifiers(environment = process.env) {
|
|
258
|
-
const catalog = readPackageCatalog(packageCatalogPath(environment));
|
|
290
|
+
async function catalogInstallSpecifiers(environment = process.env) {
|
|
291
|
+
const catalog = await readPackageCatalog(await packageCatalogPath(environment));
|
|
259
292
|
return catalog.install.map((name) => {
|
|
260
293
|
const version = catalog.packages.get(name)?.version;
|
|
261
294
|
return version ? `${name}@${version}` : name;
|
|
@@ -266,19 +299,19 @@ function catalogInstallSpecifiers(environment = process.env) {
|
|
|
266
299
|
* resolves a bare name (its own node_modules, then the shared runtime). The global web build
|
|
267
300
|
* covers them, so every first-party plugin has a slot; a name not installed yet is left out.
|
|
268
301
|
*/
|
|
269
|
-
function catalogPackageRoots(globalRoot, environment = process.env) {
|
|
302
|
+
async function catalogPackageRoots(globalRoot, environment = process.env) {
|
|
270
303
|
const roots = [];
|
|
271
|
-
for (const name of readPackageCatalog(packageCatalogPath(environment)).install) {
|
|
304
|
+
for (const name of (await readPackageCatalog(await packageCatalogPath(environment))).install) {
|
|
272
305
|
const manifest = consumerPackageEntry(`${name}/${PACKAGE_MANIFEST}`, globalRoot, environment);
|
|
273
|
-
if (manifest !== void 0) roots.push(path.dirname(fs.
|
|
306
|
+
if (manifest !== void 0) roots.push(path.dirname(await fs.realpath(manifest)));
|
|
274
307
|
}
|
|
275
308
|
return roots;
|
|
276
309
|
}
|
|
277
310
|
/** SHA-256 of the catalogue file in use, or `none` when no catalogue is present. */
|
|
278
|
-
function packageCatalogHash(environment = process.env) {
|
|
279
|
-
const catalogPath = packageCatalogPath(environment);
|
|
311
|
+
async function packageCatalogHash(environment = process.env) {
|
|
312
|
+
const catalogPath = await packageCatalogPath(environment);
|
|
280
313
|
if (!catalogPath) return "none";
|
|
281
|
-
return crypto.createHash("sha256").update(fs.
|
|
314
|
+
return crypto.createHash("sha256").update(await fs.readFile(catalogPath)).digest("hex");
|
|
282
315
|
}
|
|
283
316
|
/** Exact target per catalogue name: its staged workspace for an archive, else its registry version. */
|
|
284
317
|
function catalogTargets(catalog) {
|
|
@@ -321,8 +354,8 @@ function paxPath(data) {
|
|
|
321
354
|
* directory (`package/`) as npm does. Only files and directories are written: npm package
|
|
322
355
|
* archives carry no links, and an entry that would land outside `destination` is refused.
|
|
323
356
|
*/
|
|
324
|
-
function extractPackageArchive(archive, destination) {
|
|
325
|
-
const data = zlib.gunzipSync(fs.
|
|
357
|
+
async function extractPackageArchive(archive, destination) {
|
|
358
|
+
const data = zlib.gunzipSync(await fs.readFile(archive));
|
|
326
359
|
let offset = 0;
|
|
327
360
|
let nextPath;
|
|
328
361
|
while (offset + TAR_BLOCK_SIZE <= data.length) {
|
|
@@ -346,12 +379,12 @@ function extractPackageArchive(archive, destination) {
|
|
|
346
379
|
const target = path.resolve(destination, relative);
|
|
347
380
|
if (!target.startsWith(`${destination}${path.sep}`)) throw new Error(`Po package catalog archive ${archive} has an entry outside the package: ${name}`);
|
|
348
381
|
if (type === "5") {
|
|
349
|
-
fs.
|
|
382
|
+
await fs.mkdir(target, { recursive: true });
|
|
350
383
|
continue;
|
|
351
384
|
}
|
|
352
|
-
fs.
|
|
385
|
+
await fs.mkdir(path.dirname(target), { recursive: true });
|
|
353
386
|
const executable = (tarNumber(header, 100, 8) & TAR_EXECUTABLE_BITS) !== 0;
|
|
354
|
-
fs.
|
|
387
|
+
await fs.writeFile(target, body, { mode: executable ? 493 : 420 });
|
|
355
388
|
}
|
|
356
389
|
}
|
|
357
390
|
/** Dependency fields of a staged manifest that may name another catalogue package. */
|
|
@@ -371,40 +404,49 @@ const STAGED_DEPENDENCY_FIELDS = [
|
|
|
371
404
|
* workspace would otherwise install, are dropped. The hash covers the archive bytes and the
|
|
372
405
|
* catalogue's archive names, everything that rewrite reads, so a staged directory is reused.
|
|
373
406
|
*/
|
|
374
|
-
function stageCatalogArchive(runtimeDirectory, archive, archiveNames) {
|
|
375
|
-
const hash = crypto.createHash("sha256").update(fs.
|
|
407
|
+
async function stageCatalogArchive(runtimeDirectory, archive, archiveNames, nonce = "") {
|
|
408
|
+
const hash = crypto.createHash("sha256").update(await fs.readFile(archive)).update(`\0${[...archiveNames].sort().join("\n")}`).update(nonce).digest("hex");
|
|
376
409
|
const relative = `${CATALOG_STAGING_DIRECTORY}/${hash}`;
|
|
377
410
|
const directory = path.join(runtimeDirectory, CATALOG_STAGING_DIRECTORY, hash);
|
|
378
411
|
const stagedManifest = path.join(directory, PACKAGE_MANIFEST);
|
|
379
|
-
|
|
412
|
+
const existing = await fs.readFile(stagedManifest, "utf8").catch((error) => {
|
|
413
|
+
if (error.code === "ENOENT") return void 0;
|
|
414
|
+
throw error;
|
|
415
|
+
});
|
|
416
|
+
if (existing === void 0) {
|
|
380
417
|
const temporary = `${directory}.${String(process.pid)}.${crypto.randomUUID()}.tmp`;
|
|
381
418
|
try {
|
|
382
|
-
extractPackageArchive(archive, temporary);
|
|
419
|
+
await extractPackageArchive(archive, temporary);
|
|
383
420
|
const manifestPath = path.join(temporary, PACKAGE_MANIFEST);
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
421
|
+
const bytes = await fs.readFile(manifestPath, "utf8").catch((error) => {
|
|
422
|
+
if (error.code === "ENOENT") throw new Error(`Po package catalog archive has no package.json: ${archive}`);
|
|
423
|
+
throw error;
|
|
424
|
+
});
|
|
425
|
+
const manifest = JSON.parse(bytes);
|
|
426
|
+
if (!isRecord(manifest)) throw new Error(`Po package catalog archive has an invalid package.json: ${archive}`);
|
|
387
427
|
delete manifest.devDependencies;
|
|
388
428
|
for (const field of STAGED_DEPENDENCY_FIELDS) {
|
|
389
|
-
if (!isRecord
|
|
429
|
+
if (!isRecord(manifest[field])) continue;
|
|
390
430
|
const declared = { ...manifest[field] };
|
|
391
431
|
for (const name of Object.keys(declared)) if (archiveNames.has(name)) declared[name] = CATALOG_WORKSPACE_TARGET;
|
|
392
432
|
manifest[field] = declared;
|
|
393
433
|
}
|
|
394
|
-
fs.
|
|
434
|
+
await fs.writeFile(manifestPath, `${JSON.stringify(manifest, null, 2)}\n`);
|
|
395
435
|
try {
|
|
396
|
-
fs.
|
|
436
|
+
await fs.rename(temporary, directory);
|
|
397
437
|
} catch (error) {
|
|
398
|
-
|
|
438
|
+
await fs.access(stagedManifest).catch(() => {
|
|
439
|
+
throw error;
|
|
440
|
+
});
|
|
399
441
|
}
|
|
400
442
|
} finally {
|
|
401
|
-
fs.
|
|
443
|
+
await fs.rm(temporary, {
|
|
402
444
|
recursive: true,
|
|
403
445
|
force: true
|
|
404
446
|
});
|
|
405
447
|
}
|
|
406
448
|
}
|
|
407
|
-
const staged = recordValue(JSON.parse(fs.
|
|
449
|
+
const staged = recordValue(JSON.parse(existing ?? await fs.readFile(stagedManifest, "utf8")));
|
|
408
450
|
return {
|
|
409
451
|
relative,
|
|
410
452
|
dependencies: STAGED_DEPENDENCY_FIELDS.flatMap((field) => Object.keys(recordValue(staged[field]))).filter((name) => archiveNames.has(name))
|
|
@@ -415,14 +457,14 @@ function stageCatalogArchive(runtimeDirectory, archive, archiveNames) {
|
|
|
415
457
|
* name in turn, since a staged manifest's `workspace:*` needs that workspace present. The
|
|
416
458
|
* result, name to staged directory, feeds `ensureManagedPackageManifest`.
|
|
417
459
|
*/
|
|
418
|
-
function stageCatalogArchives(runtimeDirectory, catalog, names) {
|
|
460
|
+
async function stageCatalogArchives(runtimeDirectory, catalog, names) {
|
|
419
461
|
const archiveNames = new Set([...catalog.packages].flatMap(([name, entry]) => entry.archive === void 0 ? [] : [name]));
|
|
420
462
|
const staged = {};
|
|
421
463
|
const pending = [...names].filter((name) => archiveNames.has(name));
|
|
422
464
|
while (pending.length > 0) {
|
|
423
465
|
const name = pending.shift();
|
|
424
466
|
if (Object.hasOwn(staged, name)) continue;
|
|
425
|
-
const { relative, dependencies } = stageCatalogArchive(runtimeDirectory, catalog.packages.get(name).archive, archiveNames);
|
|
467
|
+
const { relative, dependencies } = await stageCatalogArchive(runtimeDirectory, catalog.packages.get(name).archive, archiveNames, catalog.packages.get(name).stagingNonce);
|
|
426
468
|
staged[name] = relative;
|
|
427
469
|
pending.push(...dependencies);
|
|
428
470
|
}
|
|
@@ -433,18 +475,21 @@ function stageCatalogArchives(runtimeDirectory, catalog, names) {
|
|
|
433
475
|
* folder names. An install never calls this: a running server imports from these folders (its
|
|
434
476
|
* `.po-snapshots` live there), so sync prunes them under the same gate as the runtime store.
|
|
435
477
|
*/
|
|
436
|
-
function pruneStagedCatalogArchives(runtimeDirectory) {
|
|
478
|
+
async function pruneStagedCatalogArchives(runtimeDirectory) {
|
|
437
479
|
const stagingDirectory = path.join(runtimeDirectory, CATALOG_STAGING_DIRECTORY);
|
|
438
|
-
|
|
439
|
-
|
|
480
|
+
const entries = await fs.readdir(stagingDirectory).catch((error) => {
|
|
481
|
+
if (error.code === "ENOENT") return [];
|
|
482
|
+
throw error;
|
|
483
|
+
});
|
|
484
|
+
const { manifest } = await readRuntimeManifest(path.join(runtimeDirectory, PACKAGE_MANIFEST));
|
|
440
485
|
const kept = new Set((stringList(manifest.workspaces) ?? []).map((relative) => path.basename(relative)));
|
|
441
|
-
return
|
|
442
|
-
fs.
|
|
486
|
+
return Promise.all(entries.filter((entry) => !kept.has(entry)).map(async (entry) => {
|
|
487
|
+
await fs.rm(path.join(stagingDirectory, entry), {
|
|
443
488
|
recursive: true,
|
|
444
489
|
force: true
|
|
445
490
|
});
|
|
446
491
|
return entry;
|
|
447
|
-
});
|
|
492
|
+
}));
|
|
448
493
|
}
|
|
449
494
|
/** Splits `name@version` (scoped or not); the version is absent for a bare name or subpath. */
|
|
450
495
|
function splitVersionedSpecifier(specifier) {
|
|
@@ -465,16 +510,13 @@ function npmSources(specifiers, catalog, targets, includeCatalogDependencies = f
|
|
|
465
510
|
return `${NPM_SOURCE_PREFIX}${name}${target ? `@${target}` : ""}`;
|
|
466
511
|
});
|
|
467
512
|
}
|
|
468
|
-
|
|
469
|
-
return `${count} ${noun}${count === 1 ? "" : "s"}`;
|
|
470
|
-
}
|
|
513
|
+
const englishProgress = (_key, fallback, vars) => formatMessage(fallback, vars);
|
|
471
514
|
/** Version of a package inside the shared runtime, absent when Po did not install it there. */
|
|
472
|
-
function managedPackageVersion(runtimeDirectory, name) {
|
|
515
|
+
async function managedPackageVersion(runtimeDirectory, name) {
|
|
473
516
|
const manifestPath = path.join(runtimeDirectory, NODE_MODULES, name, PACKAGE_MANIFEST);
|
|
474
|
-
if (!fs.existsSync(manifestPath)) return void 0;
|
|
475
517
|
try {
|
|
476
|
-
const parsed = JSON.parse(fs.
|
|
477
|
-
return isRecord
|
|
518
|
+
const parsed = JSON.parse(await fs.readFile(manifestPath, "utf8"));
|
|
519
|
+
return isRecord(parsed) && typeof parsed.version === "string" ? parsed.version : void 0;
|
|
478
520
|
} catch {
|
|
479
521
|
return;
|
|
480
522
|
}
|
|
@@ -486,13 +528,13 @@ function errorCode(error) {
|
|
|
486
528
|
* Installs the runtime, and when the registry cannot be reached installs it again offline:
|
|
487
529
|
* an unchanged lockfile whose packages the store already holds needs no network.
|
|
488
530
|
*/
|
|
489
|
-
async function installWithOfflineRetry(install, options, onProgress) {
|
|
531
|
+
async function installWithOfflineRetry(install, options, onProgress, t = englishProgress) {
|
|
490
532
|
try {
|
|
491
533
|
await install(options);
|
|
492
534
|
} catch (error) {
|
|
493
535
|
const code = errorCode(error);
|
|
494
536
|
if (typeof code !== "string" || !NETWORK_FAILURE_CODES.has(code)) throw error;
|
|
495
|
-
onProgress?.(
|
|
537
|
+
onProgress?.(t("cli.sync.install.registryOffline", "the registry is unreachable ({code}); installing offline from the store", { code }));
|
|
496
538
|
try {
|
|
497
539
|
await install({
|
|
498
540
|
...options,
|
|
@@ -511,11 +553,11 @@ async function installWithOfflineRetry(install, options, onProgress) {
|
|
|
511
553
|
* repository's own modules is not sync's to move, and a package that is not
|
|
512
554
|
* installed yet is already covered by the missing-package path.
|
|
513
555
|
*/
|
|
514
|
-
async function resolveUpdates(runtimeDirectory, sources, publishedVersion, onProgress) {
|
|
515
|
-
const managed = sources.map((source) => ({
|
|
556
|
+
async function resolveUpdates(runtimeDirectory, sources, publishedVersion, onProgress, t = englishProgress) {
|
|
557
|
+
const managed = (await Promise.all(sources.map(async (source) => ({
|
|
516
558
|
name: packageName(source),
|
|
517
|
-
from: managedPackageVersion(runtimeDirectory, packageName(source))
|
|
518
|
-
})).filter((entry) => entry.from !== void 0);
|
|
559
|
+
from: await managedPackageVersion(runtimeDirectory, packageName(source))
|
|
560
|
+
})))).filter((entry) => entry.from !== void 0);
|
|
519
561
|
const checked = await Promise.all(managed.map(async (entry) => {
|
|
520
562
|
try {
|
|
521
563
|
return {
|
|
@@ -534,7 +576,11 @@ async function resolveUpdates(runtimeDirectory, sources, publishedVersion, onPro
|
|
|
534
576
|
for (const entry of checked) {
|
|
535
577
|
if (entry.to === void 0) {
|
|
536
578
|
unchecked.push(entry.name);
|
|
537
|
-
onProgress?.(
|
|
579
|
+
onProgress?.(t("cli.sync.install.keptVersion", "kept {name} {version}: {reason}", {
|
|
580
|
+
name: entry.name,
|
|
581
|
+
version: entry.from,
|
|
582
|
+
reason: entry.failure ?? t("cli.sync.install.noPublishedVersion", "no published version")
|
|
583
|
+
}));
|
|
538
584
|
continue;
|
|
539
585
|
}
|
|
540
586
|
if (entry.to === entry.from) continue;
|
|
@@ -568,11 +614,12 @@ async function ensureLayerPackages(options, dependencies = {}) {
|
|
|
568
614
|
const homeDirectory = environment.HOME ?? os.homedir();
|
|
569
615
|
const poHome = poHomeDirectory(homeDirectory, environment);
|
|
570
616
|
const runtimeDirectory = poRuntimeDirectory(homeDirectory, environment);
|
|
617
|
+
const npmrcFiles = [path.join(options.repoRoot, ".npmrc")];
|
|
571
618
|
const resolvers = dependencies.resolvers ?? createLayerResolvers(options.repoRoot, environment);
|
|
572
|
-
const external = (specifier) =>
|
|
619
|
+
const external = (specifier) => checkoutPackageRoot(packageName(specifier), environment) === void 0;
|
|
573
620
|
const configured = configuredPackageSpecifiers(options.config, options.layers).filter(external);
|
|
574
621
|
const missing = configured.filter((specifier) => resolvePackageEntries(resolvers, specifier) === void 0);
|
|
575
|
-
const declared = declaredRuntimePackages(runtimeDirectory);
|
|
622
|
+
const declared = await declaredRuntimePackages(runtimeDirectory);
|
|
576
623
|
const managed = configured.filter((specifier) => missing.includes(specifier) || declared.has(splitPackageSpecifier(specifier).name));
|
|
577
624
|
const requested = (options.specifiers ?? []).filter(external).map(splitVersionedSpecifier);
|
|
578
625
|
if (managed.length === 0 && requested.length === 0 && options.exactManifest !== true) return {
|
|
@@ -580,15 +627,16 @@ async function ensureLayerPackages(options, dependencies = {}) {
|
|
|
580
627
|
updated: [],
|
|
581
628
|
unchecked: []
|
|
582
629
|
};
|
|
583
|
-
const catalog = readPackageCatalog(packageCatalogPath(environment));
|
|
630
|
+
const catalog = dependencies.catalog ?? await readPackageCatalog(await packageCatalogPath(environment));
|
|
584
631
|
const pins = catalogTargets(catalog);
|
|
585
632
|
for (const { name, version } of requested) if (version !== void 0 && catalog.packages.get(name)?.archive === void 0) pins.set(name, version);
|
|
586
|
-
const requestedMissing =
|
|
587
|
-
|
|
633
|
+
const requestedMissing = [];
|
|
634
|
+
for (const { name, version } of requested) {
|
|
635
|
+
const installed = await managedPackageVersion(runtimeDirectory, name);
|
|
588
636
|
const entry = catalog.packages.get(name);
|
|
589
637
|
const expected = entry?.archive === void 0 ? version : entry.version;
|
|
590
|
-
|
|
591
|
-
}
|
|
638
|
+
if (installed === void 0 || expected !== void 0 && installed !== expected) requestedMissing.push(name);
|
|
639
|
+
}
|
|
592
640
|
const missingSources = npmSources([...missing, ...requestedMissing], catalog, pins);
|
|
593
641
|
const sources = npmSources([...managed, ...requested.map(({ name }) => name)], catalog, pins, true).filter(external);
|
|
594
642
|
const missingCount = missing.length + requestedMissing.length;
|
|
@@ -596,8 +644,10 @@ async function ensureLayerPackages(options, dependencies = {}) {
|
|
|
596
644
|
const registrySources = sources.filter((source) => !fixedNames.has(packageName(source)));
|
|
597
645
|
const { updated, unchecked } = options.refresh ? await resolveUpdates(runtimeDirectory, registrySources, dependencies.publishedVersion ?? ((name) => resolveNewest(name, {
|
|
598
646
|
dir: runtimeDirectory,
|
|
599
|
-
poHome
|
|
600
|
-
|
|
647
|
+
poHome,
|
|
648
|
+
npmrcFiles,
|
|
649
|
+
environment
|
|
650
|
+
})), options.onProgress, options.translateProgress) : {
|
|
601
651
|
updated: [],
|
|
602
652
|
unchecked: []
|
|
603
653
|
};
|
|
@@ -606,22 +656,26 @@ async function ensureLayerPackages(options, dependencies = {}) {
|
|
|
606
656
|
return target ? [[packageName(source), target]] : [];
|
|
607
657
|
}));
|
|
608
658
|
for (const update of updated) targets.set(update.name, update.to);
|
|
609
|
-
const manifestChanged = ensureManagedPackageManifest(runtimeDirectory, sources, targets, stageCatalogArchives(runtimeDirectory, catalog, /* @__PURE__ */ new Set([...sources.map(packageName), ...options.exactManifest === true ? [] : declared])), options.exactManifest === true);
|
|
659
|
+
const manifestChanged = await ensureManagedPackageManifest(runtimeDirectory, sources, targets, await stageCatalogArchives(runtimeDirectory, catalog, /* @__PURE__ */ new Set([...sources.map(packageName), ...options.exactManifest === true ? [] : declared])), options.exactManifest === true, options.preserveWorkspaces === true);
|
|
610
660
|
if (missingCount === 0 && !manifestChanged) return {
|
|
611
661
|
installed: [],
|
|
612
662
|
updated: [],
|
|
613
663
|
unchecked
|
|
614
664
|
};
|
|
615
|
-
|
|
665
|
+
const t = options.translateProgress ?? englishProgress;
|
|
666
|
+
const updates = updated.length;
|
|
667
|
+
options.onProgress?.(updates > 0 ? updates === 1 ? t("cli.sync.install.updateOne", "installing {count} update", { count: updates }) : t("cli.sync.install.updateMany", "installing {count} updates", { count: updates }) : missingCount > 0 ? missingCount === 1 ? t("cli.sync.install.missingOne", "installing {count} missing package", { count: missingCount }) : t("cli.sync.install.missingMany", "installing {count} missing packages", { count: missingCount }) : t("cli.sync.install.manifest", "installing the package manifest"));
|
|
616
668
|
try {
|
|
617
669
|
await installWithOfflineRetry(dependencies.install ?? installRuntimePackages, {
|
|
618
670
|
dir: runtimeDirectory,
|
|
619
671
|
poHome,
|
|
672
|
+
npmrcFiles,
|
|
673
|
+
environment,
|
|
620
674
|
preferOffline: options.refresh !== true,
|
|
621
675
|
log: (message, level) => {
|
|
622
676
|
if (level === "warn") options.onProgress?.(message);
|
|
623
677
|
}
|
|
624
|
-
}, options.onProgress);
|
|
678
|
+
}, options.onProgress, t);
|
|
625
679
|
} catch (error) {
|
|
626
680
|
throw new Error(`Failed to reconcile Po layer package(s): ${(manifestChanged ? sources : missingSources).join(", ")}: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
627
681
|
}
|
|
@@ -633,7 +687,154 @@ async function ensureLayerPackages(options, dependencies = {}) {
|
|
|
633
687
|
unchecked
|
|
634
688
|
};
|
|
635
689
|
}
|
|
690
|
+
/** One selector per name in the shared runtime. Caller holds the sync lock throughout. */
|
|
691
|
+
async function ensureRuntimeImportPackage(name, version, options) {
|
|
692
|
+
const environment = {
|
|
693
|
+
...options.environment,
|
|
694
|
+
HOME: options.homeDirectory
|
|
695
|
+
};
|
|
696
|
+
const poHome = poHomeDirectory(options.homeDirectory, environment);
|
|
697
|
+
const directory = poRuntimeDirectory(options.homeDirectory, environment);
|
|
698
|
+
const manifestPath = path.join(directory, PACKAGE_MANIFEST);
|
|
699
|
+
const { manifest } = await readRuntimeManifest(manifestPath);
|
|
700
|
+
const declared = recordValue(manifest.dependencies);
|
|
701
|
+
const imports = recordValue(manifest.poCodemodeDependencies);
|
|
702
|
+
const imported = recordValue(imports[name]);
|
|
703
|
+
const catalog = await readPackageCatalog(await packageCatalogPath(environment));
|
|
704
|
+
if (catalog.packages.has(name) || Object.hasOwn(declared, name) && declared[name] !== imported.selector) throw new Error(`Cannot import ${name}: Po manages this runtime dependency (${JSON.stringify(declared[name] ?? "catalogue")}).`);
|
|
705
|
+
if (Object.hasOwn(imports, name) && imported.selector !== version) throw new Error(`Cannot import ${name}@${version}: the hub already uses ${name}@${String(imported.selector)}.`);
|
|
706
|
+
const installed = await managedPackageVersion(directory, name);
|
|
707
|
+
if (declared[name] === version && installed !== void 0 && imported.resolved === installed) return;
|
|
708
|
+
manifest.poCodemodeDependencies = {
|
|
709
|
+
...imports,
|
|
710
|
+
[name]: { selector: version }
|
|
711
|
+
};
|
|
712
|
+
await writeFileAtomic(createNodePlatform().env(directory), manifestPath, `${JSON.stringify(manifest, null, 2)}\n`, BACKGROUND_CONTEXT);
|
|
713
|
+
const pins = /* @__PURE__ */ new Map([[name, version]]);
|
|
714
|
+
const sources = npmSources([`${name}@${version}`], catalog, pins, true);
|
|
715
|
+
await ensureManagedPackageManifest(directory, sources, pins, await stageCatalogArchives(directory, catalog, /* @__PURE__ */ new Set([...sources.map(packageName), ...Object.keys(declared)])));
|
|
716
|
+
await installWithOfflineRetry(installRuntimePackages, {
|
|
717
|
+
dir: directory,
|
|
718
|
+
poHome,
|
|
719
|
+
environment,
|
|
720
|
+
preferOffline: true
|
|
721
|
+
}, void 0);
|
|
722
|
+
const resolved = await managedPackageVersion(directory, name);
|
|
723
|
+
if (resolved === void 0) throw new Error(`Runtime import ${name}@${version} was not installed.`);
|
|
724
|
+
const reconciled = (await readRuntimeManifest(manifestPath)).manifest;
|
|
725
|
+
reconciled.poCodemodeDependencies = {
|
|
726
|
+
...recordValue(reconciled.poCodemodeDependencies),
|
|
727
|
+
[name]: {
|
|
728
|
+
selector: version,
|
|
729
|
+
resolved
|
|
730
|
+
}
|
|
731
|
+
};
|
|
732
|
+
await writeFileAtomic(createNodePlatform().env(directory), manifestPath, `${JSON.stringify(reconciled, null, 2)}\n`, BACKGROUND_CONTEXT);
|
|
733
|
+
}
|
|
734
|
+
/**
|
|
735
|
+
* Only the CLI's own catalog is authoritative for marketplace installs: the one a release
|
|
736
|
+
* bundles, else the one a checkout build writes at the package root.
|
|
737
|
+
*/
|
|
738
|
+
async function readCuratedCatalog(fs, packageRoot) {
|
|
739
|
+
let root = packageRoot;
|
|
740
|
+
try {
|
|
741
|
+
root ??= poPackageRoot();
|
|
742
|
+
} catch (error) {
|
|
743
|
+
throw new Error(NO_CURATED_CATALOG, { cause: error });
|
|
744
|
+
}
|
|
745
|
+
const text = await readTextIfExists(fs, path.join(root, ...BUNDLED_CATALOG_SEGMENTS), BACKGROUND_CONTEXT) ?? await readTextIfExists(fs, path.join(root, CHECKOUT_CATALOG_FILE), BACKGROUND_CONTEXT);
|
|
746
|
+
if (text === void 0) throw new Error(NO_CURATED_CATALOG);
|
|
747
|
+
return JSON.parse(text);
|
|
748
|
+
}
|
|
749
|
+
/** Capture before ensureLayerPackages changes the shared manifest or lockfile. Caller holds withSyncLock. */
|
|
750
|
+
async function stageRuntimeManifest(fs, directory) {
|
|
751
|
+
const files = await Promise.all(["package.json", "upm.lock"].map(async (name) => {
|
|
752
|
+
const file = path.join(directory, name);
|
|
753
|
+
return {
|
|
754
|
+
file,
|
|
755
|
+
text: await readTextIfExists(fs, file, BACKGROUND_CONTEXT)
|
|
756
|
+
};
|
|
757
|
+
}));
|
|
758
|
+
return async () => {
|
|
759
|
+
for (const { file, text } of files) if (text === void 0) getOrThrow(await fs.remove(file, { force: true }, BACKGROUND_CONTEXT));
|
|
760
|
+
else await writeFileAtomic(fs, file, text, BACKGROUND_CONTEXT);
|
|
761
|
+
};
|
|
762
|
+
}
|
|
763
|
+
/** Shared verified extraction seam. It never installs dependencies or imports package code. */
|
|
764
|
+
async function stageCuratedArchive(options, directory, pin, bytes, archiveNames) {
|
|
765
|
+
const hash = crypto.createHash("sha256").update(bytes).digest("hex");
|
|
766
|
+
if (pin.privateArchive) {
|
|
767
|
+
if (hash !== pin.privateArchive.sha256) throw new Error("Organization plugin archive digest mismatch.");
|
|
768
|
+
const compiledWasm = pin.privateArchive.compiledWasm;
|
|
769
|
+
await verifiedArchiveFiles(bytes, pin.integrity, compiledWasm?.length ? { compiledWasm: {
|
|
770
|
+
paths: compiledWasm,
|
|
771
|
+
fileBytes: 33554432
|
|
772
|
+
} } : void 0);
|
|
773
|
+
}
|
|
774
|
+
const archive = path.join(directory, pin.privateArchive ? "org-library" : "marketplace", `${hash}.tgz`);
|
|
775
|
+
getOrThrow(await options.fs.createDir(path.dirname(archive), { recursive: true }, BACKGROUND_CONTEXT));
|
|
776
|
+
await writeFileAtomic(options.fs, archive, bytes, BACKGROUND_CONTEXT);
|
|
777
|
+
const stagingNonce = pin.registry !== void 0 || pin.privateArchive !== void 0 ? crypto.randomUUID() : void 0;
|
|
778
|
+
const staged = await stageCatalogArchive(directory, archive, archiveNames, stagingNonce);
|
|
779
|
+
const manifest = JSON.parse(getOrThrow(await options.fs.readTextFile(path.join(directory, staged.relative, PACKAGE_MANIFEST), BACKGROUND_CONTEXT)));
|
|
780
|
+
if (manifest.name !== pin.name || manifest.version !== pin.version) throw new Error(`Catalog target mismatch for ${pin.name}@${pin.version}.`);
|
|
781
|
+
return {
|
|
782
|
+
directory: path.join(directory, staged.relative),
|
|
783
|
+
entry: {
|
|
784
|
+
archive,
|
|
785
|
+
version: pin.version,
|
|
786
|
+
dependencies: [],
|
|
787
|
+
stagingNonce
|
|
788
|
+
}
|
|
789
|
+
};
|
|
790
|
+
}
|
|
791
|
+
/** Private host-admitted bytes only, with no registry, package manager, or executable verification. */
|
|
792
|
+
async function stagePrivateOrgPackage(options) {
|
|
793
|
+
if (options.pin.registry !== void 0) throw new Error("Private archives cannot select a registry.");
|
|
794
|
+
return (await stageCuratedArchive(options, poRuntimeDirectory(options.homeDirectory, options.environment), options.pin, await options.pin.privateArchive.read(), /* @__PURE__ */ new Set([options.pin.name]))).directory;
|
|
795
|
+
}
|
|
796
|
+
/** Verify bytes before extraction or upm sees them. Registry URLs are derived, never catalog or client URLs. */
|
|
797
|
+
async function installCuratedPackages(options) {
|
|
798
|
+
const environment = {
|
|
799
|
+
...options.environment,
|
|
800
|
+
HOME: options.homeDirectory,
|
|
801
|
+
PO_HOME: poHomeDirectory(options.homeDirectory, options.environment)
|
|
802
|
+
};
|
|
803
|
+
const directory = poRuntimeDirectory(options.homeDirectory, environment);
|
|
804
|
+
options.signal.throwIfAborted();
|
|
805
|
+
const declared = await declaredRuntimePackages(directory);
|
|
806
|
+
if ((await Promise.all(options.packages.map(async ({ name, version, registry, privateArchive }) => registry === void 0 && privateArchive === void 0 && (checkoutPackageRoot(name, environment) !== void 0 || declared.has(name) && await managedPackageVersion(directory, name) === version)))).every(Boolean)) return;
|
|
807
|
+
const packages = /* @__PURE__ */ new Map();
|
|
808
|
+
for (const pin of options.packages) {
|
|
809
|
+
options.signal.throwIfAborted();
|
|
810
|
+
const bytes = pin.privateArchive ? await pin.privateArchive.read() : (await fetchVerifiedPluginArchive({
|
|
811
|
+
...pin,
|
|
812
|
+
registry: pin.registry ?? "https://registry.npmjs.org",
|
|
813
|
+
fetch: options.fetch,
|
|
814
|
+
signal: options.signal
|
|
815
|
+
})).bytes;
|
|
816
|
+
options.signal.throwIfAborted();
|
|
817
|
+
const staged = await stageCuratedArchive(options, directory, pin, bytes, new Set(options.packages.map(({ name }) => name)));
|
|
818
|
+
packages.set(pin.name, staged.entry);
|
|
819
|
+
}
|
|
820
|
+
options.signal.throwIfAborted();
|
|
821
|
+
await ensureLayerPackages({
|
|
822
|
+
repoRoot: options.repoRoot,
|
|
823
|
+
environment,
|
|
824
|
+
config: {
|
|
825
|
+
defaultPreset: "marketplace",
|
|
826
|
+
preset: {},
|
|
827
|
+
layers: {}
|
|
828
|
+
},
|
|
829
|
+
layers: [],
|
|
830
|
+
preserveWorkspaces: true,
|
|
831
|
+
specifiers: options.packages.map(({ name, version }) => `${name}@${version}`)
|
|
832
|
+
}, { catalog: {
|
|
833
|
+
packages,
|
|
834
|
+
install: []
|
|
835
|
+
} });
|
|
836
|
+
}
|
|
636
837
|
//#endregion
|
|
637
|
-
export { SAFE_TRANSITIVE_OVERRIDES, catalogInstallSpecifiers, catalogPackageRoots, ensureLayerPackages, ensureManagedPackageManifest, missingLayerPackageSpecifiers, packageCatalogHash, pruneStagedCatalogArchives, runtimeLayerPackageSpecifiers };
|
|
838
|
+
export { SAFE_TRANSITIVE_OVERRIDES, catalogInstallSpecifiers, catalogPackageNames, catalogPackageRoots, ensureLayerPackages, ensureManagedPackageManifest, ensureRuntimeImportPackage, installCuratedPackages, missingLayerPackageSpecifiers, packageCatalogHash, pruneStagedCatalogArchives, readCuratedCatalog, runtimeLayerPackageSpecifiers, stagePrivateOrgPackage, stageRuntimeManifest };
|
|
638
839
|
|
|
639
840
|
//# sourceMappingURL=index.mjs.map
|