@agimon-ai/po 0.0.0-alpha.21 → 0.0.0-alpha.211
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/locales/vi.cjs +218 -0
- package/dist/locales/vi.cjs.map +1 -0
- package/dist/locales/vi.mjs +213 -0
- package/dist/locales/vi.mjs.map +1 -0
- package/dist/locales/zh-CN.cjs +218 -0
- package/dist/locales/zh-CN.cjs.map +1 -0
- package/dist/locales/zh-CN.mjs +213 -0
- package/dist/locales/zh-CN.mjs.map +1 -0
- 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 +58 -19
- package/dist/src/builders/server/index.cjs.map +1 -1
- package/dist/src/builders/server/index.mjs +57 -19
- 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 +2750 -486
- package/dist/src/builders/server/runtime.cjs.map +1 -1
- package/dist/src/builders/server/runtime.mjs +2760 -500
- 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 +92 -59
- package/dist/src/builders/web/index.cjs.map +1 -1
- package/dist/src/builders/web/index.d.mts +21 -14
- package/dist/src/builders/web/index.d.mts.map +1 -1
- package/dist/src/builders/web/index.mjs +91 -59
- 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 +30 -0
- package/dist/src/cli/locale.cjs.map +1 -0
- package/dist/src/cli/locale.mjs +27 -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 +2 -0
- package/dist/webBuilder.d.mts +3 -3
- package/dist/webBuilder.mjs +3 -3
- 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/locales/vi.json +208 -0
- package/locales/zh-CN.json +208 -0
- package/package.json +52 -69
- 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,26 +1,28 @@
|
|
|
1
1
|
import { snapshotFiles, statSignature } from "../server/packageUrl.mjs";
|
|
2
|
-
import { compareCodeUnits
|
|
2
|
+
import { compareCodeUnits } from "./webPluginManifest.mjs";
|
|
3
3
|
import { scanWebPlugins } from "./webPluginScan.mjs";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
|
-
import fs from "node:fs";
|
|
6
5
|
import path from "node:path";
|
|
7
|
-
import
|
|
6
|
+
import fs from "node:fs/promises";
|
|
7
|
+
import { createNodePlatform } from "@agimon-ai/po-core/nodePlatform";
|
|
8
|
+
import { BACKGROUND_CONTEXT, getOrThrow, pathExists } from "@agimon-ai/po-core/platform";
|
|
8
9
|
import crypto from "node:crypto";
|
|
10
|
+
import { execFile } from "node:child_process";
|
|
9
11
|
//#region src/builders/web/index.ts
|
|
10
12
|
const WEB_PACKAGE = "@agimon-ai/po-web";
|
|
11
13
|
const WEB_PACKAGE_ROOT_ENV = "PO_WEB_PACKAGE_ROOT";
|
|
12
|
-
/** The package roots a set of compositions activates,
|
|
13
|
-
function compositionPackageRoots(compositions) {
|
|
14
|
-
|
|
14
|
+
/** The package roots a set of compositions activates, without blocking a live host. */
|
|
15
|
+
async function compositionPackageRoots(compositions, files = createNodePlatform().env(process.cwd())) {
|
|
16
|
+
const roots = await Promise.all(compositions.flatMap((composition) => composition.packageEntries).map((entry) => packageRootOf(entry, files)));
|
|
17
|
+
return [...new Set(roots.filter((root) => root !== void 0))];
|
|
15
18
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
let dir = path.dirname(entryPath);
|
|
19
|
+
async function packageRootOf(entryPath, files = createNodePlatform().env(process.cwd())) {
|
|
20
|
+
let directory = path.dirname(entryPath);
|
|
19
21
|
for (;;) {
|
|
20
|
-
if (
|
|
21
|
-
const parent = path.dirname(
|
|
22
|
-
if (parent ===
|
|
23
|
-
|
|
22
|
+
if (await pathExists(files, path.join(directory, "package.json"), BACKGROUND_CONTEXT)) return directory;
|
|
23
|
+
const parent = path.dirname(directory);
|
|
24
|
+
if (parent === directory) return void 0;
|
|
25
|
+
directory = parent;
|
|
24
26
|
}
|
|
25
27
|
}
|
|
26
28
|
function resolveWebPackageRoot(repoRoot, environment) {
|
|
@@ -37,11 +39,11 @@ function resolveWebPackageRoot(repoRoot, environment) {
|
|
|
37
39
|
}
|
|
38
40
|
}
|
|
39
41
|
/** The installed po-web host version the global web build would use, or `none` when it is not installed. */
|
|
40
|
-
function webHostVersion(poHome, environment = process.env) {
|
|
42
|
+
async function webHostVersion(poHome, environment = process.env, files = createNodePlatform().env(poHome)) {
|
|
41
43
|
const webRoot = resolveWebPackageRoot(poHome, environment);
|
|
42
44
|
if (webRoot === void 0) return "none";
|
|
43
45
|
try {
|
|
44
|
-
const manifest = JSON.parse(
|
|
46
|
+
const manifest = JSON.parse(getOrThrow(await files.readTextFile(path.join(webRoot, "package.json"), BACKGROUND_CONTEXT)));
|
|
45
47
|
return typeof manifest.version === "string" ? manifest.version : "unversioned";
|
|
46
48
|
} catch (error) {
|
|
47
49
|
return `unreadable:${error instanceof Error ? error.message : String(error)}`;
|
|
@@ -51,6 +53,27 @@ function webHostVersion(poHome, environment = process.env) {
|
|
|
51
53
|
const GLOBAL_BUILD_FORMAT = "global-web-5";
|
|
52
54
|
/** The record every keyed global build writes last, so a key directory holding it is complete. */
|
|
53
55
|
const BUILD_RECORD = "build.json";
|
|
56
|
+
/** Po packages the host shell bundles, the Po members of the bundle's shared runtimes. */
|
|
57
|
+
const HOST_SHELL_PACKAGES = [
|
|
58
|
+
"@agimon-ai/po-core",
|
|
59
|
+
"@agimon-ai/po-web-dashboard",
|
|
60
|
+
"@agimon-ai/po-web-components",
|
|
61
|
+
"@agimon-ai/po-web-security"
|
|
62
|
+
];
|
|
63
|
+
/** Catalog owners baked into the shell, independent of the active optional plugins. */
|
|
64
|
+
async function webShellLocaleRoots(poHome, environment, files) {
|
|
65
|
+
const root = resolveWebPackageRoot(poHome, environment);
|
|
66
|
+
if (root === void 0 || !await pathExists(files, path.join(root, "package.json"), BACKGROUND_CONTEXT)) return [];
|
|
67
|
+
const require = createRequire(path.join(root, "package.json"));
|
|
68
|
+
return [root, ...[...HOST_SHELL_PACKAGES, "@agimon-ai/po-identity"].flatMap((name) => {
|
|
69
|
+
try {
|
|
70
|
+
return [path.dirname(require.resolve(`${name}/package.json`))];
|
|
71
|
+
} catch (error) {
|
|
72
|
+
if (error.code !== "MODULE_NOT_FOUND") throw error;
|
|
73
|
+
return [];
|
|
74
|
+
}
|
|
75
|
+
})];
|
|
76
|
+
}
|
|
54
77
|
const BUILD_CHILD_SCRIPT = `
|
|
55
78
|
const [bundleUrl, request] = process.argv.slice(1);
|
|
56
79
|
try {
|
|
@@ -73,11 +96,11 @@ try {
|
|
|
73
96
|
* plus the whole top-level folder of the client entry and of each declared export, so an
|
|
74
97
|
* edited import or a rebuilt dist chunk changes the key, not only the entry file.
|
|
75
98
|
*/
|
|
76
|
-
function packageSignature(packageDir, entries) {
|
|
99
|
+
async function packageSignature(packageDir, entries, files) {
|
|
77
100
|
try {
|
|
78
|
-
const
|
|
79
|
-
for (const entry of entries) for (const file of snapshotFiles(packageDir, entry))
|
|
80
|
-
return statSignature(packageDir, [...
|
|
101
|
+
const selected = /* @__PURE__ */ new Set();
|
|
102
|
+
for (const entry of entries) for (const file of await snapshotFiles(packageDir, entry, files)) selected.add(file);
|
|
103
|
+
return await statSignature(packageDir, [...selected].sort(), files);
|
|
81
104
|
} catch (error) {
|
|
82
105
|
return `unreadable:${error instanceof Error ? error.message : String(error)}`;
|
|
83
106
|
}
|
|
@@ -87,9 +110,16 @@ function packageSignature(packageDir, entries) {
|
|
|
87
110
|
* plugin package's file signature. A changed source or dist file or a changed plugin set
|
|
88
111
|
* yields a new key; roots that declare no plugin do not take part.
|
|
89
112
|
*/
|
|
90
|
-
function globalBuildKey(format, hostRoot, plugins) {
|
|
113
|
+
async function globalBuildKey(format, hostRoot, plugins, files = createNodePlatform().env(process.cwd())) {
|
|
91
114
|
const hash = crypto.createHash("sha256").update(format);
|
|
92
|
-
if (hostRoot !== void 0)
|
|
115
|
+
if (hostRoot !== void 0) {
|
|
116
|
+
hash.update(`host:${hostRoot}:${getOrThrow(await files.readTextFile(path.join(hostRoot, "package.json"), BACKGROUND_CONTEXT))}`);
|
|
117
|
+
hash.update(`\0host-files:${await packageSignature(hostRoot, [path.join(hostRoot, "src", "web", "index.html")], files)}`);
|
|
118
|
+
for (const name of HOST_SHELL_PACKAGES) {
|
|
119
|
+
const packageDir = path.join(hostRoot, "node_modules", ...name.split("/"));
|
|
120
|
+
hash.update(`\0shell:${name}\0${await packageSignature(packageDir, [path.join(packageDir, "dist")], files)}`);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
93
123
|
const entries = /* @__PURE__ */ new Map();
|
|
94
124
|
for (const plugin of [...plugins].sort((a, b) => compareCodeUnits(a.pluginId, b.pluginId))) {
|
|
95
125
|
hash.update(`\0${plugin.pluginId}:${plugin.packageDir}:${plugin.client.entry}`);
|
|
@@ -97,7 +127,7 @@ function globalBuildKey(format, hostRoot, plugins) {
|
|
|
97
127
|
list.push(path.join(plugin.packageDir, plugin.client.entry));
|
|
98
128
|
entries.set(plugin.packageDir, list);
|
|
99
129
|
}
|
|
100
|
-
for (const packageDir of [...entries.keys()].sort()) hash.update(`\0${packageDir}\0${packageSignature(packageDir, entries.get(packageDir) ?? [])}`);
|
|
130
|
+
for (const packageDir of [...entries.keys()].sort()) hash.update(`\0${packageDir}\0${await packageSignature(packageDir, entries.get(packageDir) ?? [], files)}`);
|
|
101
131
|
return hash.digest("hex").slice(0, 32);
|
|
102
132
|
}
|
|
103
133
|
function bundleModuleUrl() {
|
|
@@ -131,17 +161,17 @@ function runBuildProcess(request, environment, onNotice) {
|
|
|
131
161
|
});
|
|
132
162
|
}
|
|
133
163
|
/** A key directory's parsed build record, or undefined when the build is not there (yet). */
|
|
134
|
-
function readBuildJson(directory) {
|
|
164
|
+
async function readBuildJson(directory, files = createNodePlatform().env(directory)) {
|
|
135
165
|
try {
|
|
136
|
-
return JSON.parse(
|
|
166
|
+
return JSON.parse(getOrThrow(await files.readTextFile(path.join(directory, BUILD_RECORD), BACKGROUND_CONTEXT)));
|
|
137
167
|
} catch (error) {
|
|
138
|
-
if (error.code === "
|
|
168
|
+
if (error.code === "not_found") return void 0;
|
|
139
169
|
throw error;
|
|
140
170
|
}
|
|
141
171
|
}
|
|
142
|
-
function readBuildRecord(directory) {
|
|
143
|
-
const record = readBuildJson(directory);
|
|
144
|
-
if (record === void 0) return void 0;
|
|
172
|
+
async function readBuildRecord(directory, files) {
|
|
173
|
+
const record = await readBuildJson(directory, files);
|
|
174
|
+
if (record === void 0 || !Array.isArray(record.plugins) || record.plugins.some((plugin) => typeof plugin.slot !== "string")) return void 0;
|
|
145
175
|
return {
|
|
146
176
|
...record,
|
|
147
177
|
webDirectory: path.join(directory, "web"),
|
|
@@ -152,23 +182,25 @@ function webBuildsRoot(poHome) {
|
|
|
152
182
|
return path.join(poHome, "build", "web");
|
|
153
183
|
}
|
|
154
184
|
/** The complete global web build of one key, or undefined when it is not there. Never builds. */
|
|
155
|
-
function readGlobalWebBuildRecord(poHome, key) {
|
|
156
|
-
return readBuildRecord(path.join(webBuildsRoot(poHome), key));
|
|
185
|
+
async function readGlobalWebBuildRecord(poHome, key, files) {
|
|
186
|
+
return readBuildRecord(path.join(webBuildsRoot(poHome), key), files);
|
|
157
187
|
}
|
|
158
188
|
/**
|
|
159
189
|
* The key of the most recently written complete global web build, for a server that starts
|
|
160
190
|
* before sync ever wrote a pointer. Temporary build folders start with a dot and are skipped.
|
|
161
191
|
*/
|
|
162
|
-
function newestGlobalWebBuildKey(poHome) {
|
|
192
|
+
async function newestGlobalWebBuildKey(poHome, files = createNodePlatform().env(poHome)) {
|
|
163
193
|
const root = webBuildsRoot(poHome);
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
194
|
+
const listed = await files.listDir(root, BACKGROUND_CONTEXT);
|
|
195
|
+
if (!listed.ok && listed.error.code === "not_found") return void 0;
|
|
196
|
+
return (await Promise.all(getOrThrow(listed).filter((entry) => entry.kind === "directory" && !entry.name.startsWith(".")).map(async (entry) => {
|
|
197
|
+
const info = await files.fileInfo(path.join(root, entry.name, BUILD_RECORD), BACKGROUND_CONTEXT);
|
|
198
|
+
if (!info.ok && info.error.code === "not_found") return void 0;
|
|
199
|
+
return {
|
|
200
|
+
name: entry.name,
|
|
201
|
+
modified: getOrThrow(info).mtimeMs
|
|
202
|
+
};
|
|
203
|
+
}))).filter((entry) => entry !== void 0).sort((left, right) => right.modified - left.modified)[0]?.name;
|
|
172
204
|
}
|
|
173
205
|
/**
|
|
174
206
|
* Builds into a temporary sibling of `directory`, writes the build record last, and renames
|
|
@@ -176,18 +208,18 @@ function newestGlobalWebBuildKey(poHome) {
|
|
|
176
208
|
* process that finished the same key is fine: its bytes are identical.
|
|
177
209
|
*/
|
|
178
210
|
async function buildKeyDirectory(buildsRoot, key, directory, build) {
|
|
179
|
-
fs.
|
|
180
|
-
const temporary = fs.
|
|
211
|
+
await fs.mkdir(buildsRoot, { recursive: true });
|
|
212
|
+
const temporary = await fs.mkdtemp(path.join(buildsRoot, `.${key}-`));
|
|
181
213
|
try {
|
|
182
214
|
const record = await build(temporary);
|
|
183
|
-
fs.
|
|
215
|
+
await fs.writeFile(path.join(temporary, BUILD_RECORD), `${JSON.stringify(record, null, 2)}\n`);
|
|
184
216
|
try {
|
|
185
|
-
fs.
|
|
217
|
+
await fs.rename(temporary, directory);
|
|
186
218
|
} catch (error) {
|
|
187
|
-
if (readBuildJson(directory) === void 0) throw error;
|
|
219
|
+
if (await readBuildJson(directory) === void 0) throw error;
|
|
188
220
|
}
|
|
189
221
|
} finally {
|
|
190
|
-
fs.
|
|
222
|
+
await fs.rm(temporary, {
|
|
191
223
|
recursive: true,
|
|
192
224
|
force: true
|
|
193
225
|
});
|
|
@@ -207,17 +239,17 @@ async function singleFlightBuild(key, run) {
|
|
|
207
239
|
}
|
|
208
240
|
}
|
|
209
241
|
/** The build key for these plugin roots and where its build lives, without building anything. */
|
|
210
|
-
function resolveGlobalWebBuild(input) {
|
|
242
|
+
async function resolveGlobalWebBuild(input) {
|
|
211
243
|
const environment = input.environment ?? process.env;
|
|
212
244
|
const webRoot = (input.resolveWebRoot ?? resolveWebPackageRoot)(input.poHome, environment);
|
|
213
|
-
if (webRoot === void 0 || !
|
|
245
|
+
if (webRoot === void 0 || !await pathExists(input.files ?? createNodePlatform().env(input.poHome), path.join(webRoot, "package.json"), BACKGROUND_CONTEXT)) return {
|
|
214
246
|
status: "skipped",
|
|
215
247
|
reason: `${WEB_PACKAGE} is not installed; no web composition is published`
|
|
216
248
|
};
|
|
217
249
|
const pluginRoots = [...new Set(input.pluginRoots.map((root) => path.resolve(root)))].sort();
|
|
218
250
|
let key;
|
|
219
251
|
try {
|
|
220
|
-
key = globalBuildKey(GLOBAL_BUILD_FORMAT, webRoot, scanWebPlugins(webRoot, pluginRoots, input.onNotice ?? (() => {})));
|
|
252
|
+
key = await globalBuildKey(GLOBAL_BUILD_FORMAT, webRoot, await scanWebPlugins(webRoot, pluginRoots, input.onNotice ?? (() => {})), input.files);
|
|
221
253
|
} catch (error) {
|
|
222
254
|
return {
|
|
223
255
|
status: "failed",
|
|
@@ -235,21 +267,21 @@ function resolveGlobalWebBuild(input) {
|
|
|
235
267
|
};
|
|
236
268
|
}
|
|
237
269
|
/** Whether the global build for these plugin roots exists, for a check that must not build. */
|
|
238
|
-
function readGlobalWebBuildStatus(input) {
|
|
239
|
-
const resolved = resolveGlobalWebBuild(input);
|
|
270
|
+
async function readGlobalWebBuildStatus(input) {
|
|
271
|
+
const resolved = await resolveGlobalWebBuild(input);
|
|
240
272
|
if (resolved.status !== "resolved") return resolved;
|
|
241
273
|
return {
|
|
242
|
-
status: readBuildRecord(resolved.directory) === void 0 ? "missing" : "current",
|
|
274
|
+
status: await readBuildRecord(resolved.directory, input.files) === void 0 ? "missing" : "current",
|
|
243
275
|
key: resolved.key
|
|
244
276
|
};
|
|
245
277
|
}
|
|
246
278
|
async function ensureGlobalWebBuild(input) {
|
|
247
279
|
const environment = input.environment ?? process.env;
|
|
248
280
|
const notice = input.onNotice ?? (() => {});
|
|
249
|
-
const resolved = resolveGlobalWebBuild(input);
|
|
281
|
+
const resolved = await resolveGlobalWebBuild(input);
|
|
250
282
|
if (resolved.status !== "resolved") return resolved;
|
|
251
283
|
const { webRoot, pluginRoots, key, buildsRoot, directory } = resolved;
|
|
252
|
-
const existing = readBuildRecord(directory);
|
|
284
|
+
const existing = await readBuildRecord(directory, input.files);
|
|
253
285
|
if (existing !== void 0) return {
|
|
254
286
|
status: "cached",
|
|
255
287
|
build: existing
|
|
@@ -270,7 +302,7 @@ async function ensureGlobalWebBuild(input) {
|
|
|
270
302
|
baseStyle: output.baseStyle
|
|
271
303
|
};
|
|
272
304
|
});
|
|
273
|
-
const build = readBuildRecord(directory);
|
|
305
|
+
const build = await readBuildRecord(directory, input.files);
|
|
274
306
|
if (build === void 0) throw new Error(`The web build '${key}' was not recorded.`);
|
|
275
307
|
return {
|
|
276
308
|
status: "built",
|
|
@@ -301,20 +333,20 @@ function mountWebPluginIds(build, packageRoots) {
|
|
|
301
333
|
}
|
|
302
334
|
/** The slots a mount runs: one copy per pluginId, the first in build order. */
|
|
303
335
|
function mountWebPluginSlots(build, packageRoots) {
|
|
304
|
-
return mountPluginCopies(build, packageRoots).map(
|
|
336
|
+
return mountPluginCopies(build, packageRoots).map((plugin) => plugin.slot);
|
|
305
337
|
}
|
|
306
338
|
/**
|
|
307
339
|
* The package roots among `packageRoots` that declare a web plugin the build has no slot for:
|
|
308
340
|
* a package that was not synced yet, or was left out of the build. Their names, else their roots.
|
|
309
341
|
*/
|
|
310
|
-
function unslottedWebPackages(build, packageRoots) {
|
|
342
|
+
async function unslottedWebPackages(build, packageRoots, files = createNodePlatform().env(process.cwd())) {
|
|
311
343
|
const slotted = new Set(build.plugins.map((plugin) => path.resolve(plugin.packageDir)));
|
|
312
344
|
const missing = [];
|
|
313
345
|
for (const root of new Set(packageRoots.map((entry) => path.resolve(entry)))) {
|
|
314
346
|
if (slotted.has(root)) continue;
|
|
315
347
|
let manifest;
|
|
316
348
|
try {
|
|
317
|
-
manifest = JSON.parse(
|
|
349
|
+
manifest = JSON.parse(getOrThrow(await files.readTextFile(path.join(root, "package.json"), BACKGROUND_CONTEXT)));
|
|
318
350
|
} catch {
|
|
319
351
|
continue;
|
|
320
352
|
}
|
|
@@ -329,7 +361,7 @@ function duplicatePluginCopies(build, packageRoots) {
|
|
|
329
361
|
const slotsById = /* @__PURE__ */ new Map();
|
|
330
362
|
for (const plugin of build.plugins) {
|
|
331
363
|
if (!plugin.isHost && !roots.has(path.resolve(plugin.packageDir))) continue;
|
|
332
|
-
const slot =
|
|
364
|
+
const slot = plugin.slot;
|
|
333
365
|
const slots = slotsById.get(plugin.pluginId) ?? [];
|
|
334
366
|
if (!slots.includes(slot)) slots.push(slot);
|
|
335
367
|
slotsById.set(plugin.pluginId, slots);
|
|
@@ -337,6 +369,6 @@ function duplicatePluginCopies(build, packageRoots) {
|
|
|
337
369
|
return new Map([...slotsById].filter(([, slots]) => slots.length > 1));
|
|
338
370
|
}
|
|
339
371
|
//#endregion
|
|
340
|
-
export { BUILD_RECORD, buildKeyDirectory, compositionPackageRoots, duplicatePluginCopies, ensureGlobalWebBuild, globalBuildKey, mountWebPluginIds, mountWebPluginSlots, newestGlobalWebBuildKey, packageRootOf, readBuildJson, readGlobalWebBuildRecord, readGlobalWebBuildStatus, singleFlightBuild, unslottedWebPackages, webHostVersion };
|
|
372
|
+
export { BUILD_RECORD, buildKeyDirectory, compositionPackageRoots, duplicatePluginCopies, ensureGlobalWebBuild, globalBuildKey, mountWebPluginIds, mountWebPluginSlots, newestGlobalWebBuildKey, packageRootOf, readBuildJson, readGlobalWebBuildRecord, readGlobalWebBuildStatus, singleFlightBuild, unslottedWebPackages, webHostVersion, webShellLocaleRoots };
|
|
341
373
|
|
|
342
374
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/builders/web/index.ts"],"sourcesContent":["import { execFile } from 'node:child_process';\nimport crypto from 'node:crypto';\nimport fs from 'node:fs';\nimport { createRequire } from 'node:module';\nimport path from 'node:path';\n\nimport type { GlobalWebBuild, GlobalWebBuildPlugin } from '@agimon-ai/po-core/webCompositions';\n\nimport { snapshotFiles, statSignature } from '../server/packageUrl';\nimport { compareCodeUnits, type DeclaredWebPlugin, pluginSlot } from './webPluginManifest';\nimport { scanWebPlugins } from './webPluginScan';\n\nconst WEB_PACKAGE = '@agimon-ai/po-web';\nconst WEB_PACKAGE_ROOT_ENV = 'PO_WEB_PACKAGE_ROOT';\n\n/** The package roots a set of compositions activates, each once. */\nexport function compositionPackageRoots(compositions: readonly { packageEntries: readonly string[] }[]): string[] {\n return [\n ...new Set(\n compositions\n .flatMap((composition) => composition.packageEntries)\n .map(packageRootOf)\n .filter((root): root is string => root !== undefined),\n ),\n ];\n}\n\n/** Walks from a resolved module path up to the directory owning its package.json. */\nexport function packageRootOf(entryPath: string): string | undefined {\n let dir = path.dirname(entryPath);\n for (;;) {\n if (fs.existsSync(path.join(dir, 'package.json'))) return dir;\n const parent = path.dirname(dir);\n if (parent === dir) return undefined;\n dir = parent;\n }\n}\n\nfunction resolveWebPackageRoot(repoRoot: string, environment: NodeJS.ProcessEnv): string | undefined {\n const override = environment[WEB_PACKAGE_ROOT_ENV];\n if (override !== undefined && override !== '') return path.resolve(override);\n try {\n return path.dirname(createRequire(path.join(repoRoot, 'package.json')).resolve(`${WEB_PACKAGE}/package.json`));\n } catch {\n try {\n return path.dirname(createRequire(import.meta.url).resolve(`${WEB_PACKAGE}/package.json`));\n } catch {\n return undefined;\n }\n }\n}\n\n/** The installed po-web host version the global web build would use, or `none` when it is not installed. */\nexport function webHostVersion(poHome: string, environment: NodeJS.ProcessEnv = process.env): string {\n const webRoot = resolveWebPackageRoot(poHome, environment);\n if (webRoot === undefined) return 'none';\n try {\n const manifest = JSON.parse(fs.readFileSync(path.join(webRoot, 'package.json'), 'utf8')) as { version?: unknown };\n return typeof manifest.version === 'string' ? manifest.version : 'unversioned';\n } catch (error) {\n return `unreadable:${error instanceof Error ? error.message : String(error)}`;\n }\n}\n\n/** Bumped whenever the build's output layout changes, so an old layout is never reused. */\nconst GLOBAL_BUILD_FORMAT = 'global-web-5';\n/** The record every keyed global build writes last, so a key directory holding it is complete. */\nexport const BUILD_RECORD = 'build.json';\nconst BUILD_CHILD_SCRIPT = `\nconst [bundleUrl, request] = process.argv.slice(1);\ntry {\n const { bundleCockpitWeb } = await import(bundleUrl);\n const { hostRoot, pluginRoots, outDir } = JSON.parse(request);\n const result = await bundleCockpitWeb({\n hostRoot,\n pluginRoots,\n outDir,\n onNotice: (message) => process.stderr.write(message + '\\\\n'),\n });\n process.stdout.write(JSON.stringify(result));\n} catch (error) {\n process.stderr.write(error instanceof Error ? (error.stack ?? error.message) : String(error));\n process.exitCode = 1;\n}\n`;\n\n/** One build's record: the publishable build, whose plugins carry each copy's package and slot closure. */\nexport type GlobalWebBuildRecord = GlobalWebBuild;\n\nexport interface GlobalWebBuildInput {\n /** Po's global home; builds land in `<home>/build/web/<key>/`. */\n poHome: string;\n /** The union of every scope's package roots; roots without a poWeb block are ignored. */\n pluginRoots: readonly string[];\n environment?: NodeJS.ProcessEnv;\n onNotice?: (message: string) => void;\n /** Test seam over the child-process build. */\n runBuild?: (request: { hostRoot: string; pluginRoots: string[]; outDir: string }) => Promise<BuildOutput>;\n /** Test seam over package resolution. */\n resolveWebRoot?: (repoRoot: string, environment: NodeJS.ProcessEnv) => string | undefined;\n}\n\ninterface BuildOutput {\n assetsDir: string;\n pluginsDir: string;\n plugins: GlobalWebBuildPlugin[];\n pluginStyles: Record<string, string>;\n baseStyle: string;\n}\n\nexport type GlobalWebBuildResult =\n | { status: 'built' | 'cached'; build: GlobalWebBuildRecord }\n | { status: 'skipped'; reason: string }\n | { status: 'failed'; reason: string };\n\n/**\n * The size+mtime signature of every file a plugin package hands the build: its manifest\n * plus the whole top-level folder of the client entry and of each declared export, so an\n * edited import or a rebuilt dist chunk changes the key, not only the entry file.\n */\nfunction packageSignature(packageDir: string, entries: readonly string[]): string {\n try {\n const files = new Set<string>();\n for (const entry of entries) for (const file of snapshotFiles(packageDir, entry)) files.add(file);\n return statSignature(packageDir, [...files].sort());\n } catch (error) {\n // A declared export that is not built yet must not block the build; it only weakens the key.\n return `unreadable:${error instanceof Error ? error.message : String(error)}`;\n }\n}\n\n/**\n * The content key of a build: the format, the host package when there is one, then every\n * plugin package's file signature. A changed source or dist file or a changed plugin set\n * yields a new key; roots that declare no plugin do not take part.\n */\nexport function globalBuildKey(\n format: string,\n hostRoot: string | undefined,\n plugins: readonly DeclaredWebPlugin[],\n): string {\n const hash = crypto.createHash('sha256').update(format);\n if (hostRoot !== undefined)\n hash.update(`host:${hostRoot}:${fs.readFileSync(path.join(hostRoot, 'package.json'), 'utf8')}`);\n const entries = new Map<string, string[]>();\n for (const plugin of [...plugins].sort((a, b) => compareCodeUnits(a.pluginId, b.pluginId))) {\n hash.update(`\\0${plugin.pluginId}:${plugin.packageDir}:${plugin.client.entry}`);\n const list = entries.get(plugin.packageDir) ?? [];\n list.push(path.join(plugin.packageDir, plugin.client.entry));\n entries.set(plugin.packageDir, list);\n }\n for (const packageDir of [...entries.keys()].sort())\n hash.update(`\\0${packageDir}\\0${packageSignature(packageDir, entries.get(packageDir) ?? [])}`);\n return hash.digest('hex').slice(0, 32);\n}\n\nfunction bundleModuleUrl(): string {\n const extension = import.meta.url.endsWith('.ts') ? 'ts' : 'mjs';\n return new URL(`./bundle.${extension}`, import.meta.url).href;\n}\n\n/** Runs Vite in a child process so its module graph and caches never stay in the server heap. */\nfunction runBuildProcess(\n request: { hostRoot: string; pluginRoots: string[]; outDir: string },\n environment: NodeJS.ProcessEnv,\n onNotice: (message: string) => void,\n): Promise<BuildOutput> {\n const args = [\n ...process.execArgv,\n '--input-type=module',\n '--eval',\n BUILD_CHILD_SCRIPT,\n bundleModuleUrl(),\n JSON.stringify(request),\n ];\n return new Promise((resolve, reject) => {\n execFile(\n process.execPath,\n args,\n { cwd: request.hostRoot, env: environment, encoding: 'utf8', maxBuffer: 64 * 1024 * 1024 },\n (error, stdout, stderr) => {\n if (error) {\n reject(new Error(`${stderr || stdout}`.trim() || `Web build exited with code ${String(error.code ?? 1)}`));\n return;\n }\n for (const line of stderr.split('\\n')) if (line.trim()) onNotice(line.trim());\n resolve(JSON.parse(stdout) as BuildOutput);\n },\n );\n });\n}\n\n/** A key directory's parsed build record, or undefined when the build is not there (yet). */\nexport function readBuildJson<T>(directory: string): T | undefined {\n try {\n return JSON.parse(fs.readFileSync(path.join(directory, BUILD_RECORD), 'utf8')) as T;\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === 'ENOENT') return undefined;\n throw error;\n }\n}\n\nfunction readBuildRecord(directory: string): GlobalWebBuildRecord | undefined {\n const record = readBuildJson<Omit<GlobalWebBuildRecord, 'webDirectory' | 'pluginsDirectory'>>(directory);\n if (record === undefined) return undefined;\n return { ...record, webDirectory: path.join(directory, 'web'), pluginsDirectory: path.join(directory, 'plugins') };\n}\n\nfunction webBuildsRoot(poHome: string): string {\n return path.join(poHome, 'build', 'web');\n}\n\n/** The complete global web build of one key, or undefined when it is not there. Never builds. */\nexport function readGlobalWebBuildRecord(poHome: string, key: string): GlobalWebBuildRecord | undefined {\n return readBuildRecord(path.join(webBuildsRoot(poHome), key));\n}\n\n/**\n * The key of the most recently written complete global web build, for a server that starts\n * before sync ever wrote a pointer. Temporary build folders start with a dot and are skipped.\n */\nexport function newestGlobalWebBuildKey(poHome: string): string | undefined {\n const root = webBuildsRoot(poHome);\n if (!fs.existsSync(root)) return undefined;\n return fs\n .readdirSync(root, { withFileTypes: true })\n .filter((entry) => entry.isDirectory() && !entry.name.startsWith('.'))\n .map((entry) => ({ name: entry.name, file: path.join(root, entry.name, BUILD_RECORD) }))\n .filter((entry) => fs.existsSync(entry.file))\n .map((entry) => ({ name: entry.name, modified: fs.statSync(entry.file).mtimeMs }))\n .sort((left, right) => right.modified - left.modified)[0]?.name;\n}\n\n/**\n * Builds into a temporary sibling of `directory`, writes the build record last, and renames\n * the result into place, so a key directory is always complete. Losing the rename to another\n * process that finished the same key is fine: its bytes are identical.\n */\nexport async function buildKeyDirectory(\n buildsRoot: string,\n key: string,\n directory: string,\n build: (temporary: string) => Promise<object>,\n): Promise<void> {\n fs.mkdirSync(buildsRoot, { recursive: true });\n const temporary = fs.mkdtempSync(path.join(buildsRoot, `.${key}-`));\n try {\n const record = await build(temporary);\n fs.writeFileSync(path.join(temporary, BUILD_RECORD), `${JSON.stringify(record, null, 2)}\\n`);\n try {\n fs.renameSync(temporary, directory);\n } catch (error) {\n if (readBuildJson(directory) === undefined) throw error;\n }\n } finally {\n fs.rmSync(temporary, { recursive: true, force: true });\n }\n}\n\nconst pendingBuilds = new Map<string, Promise<unknown>>();\n\n/** Joins a build of the same key that is already running in this process instead of starting another. */\nexport async function singleFlightBuild<T>(key: string, run: () => Promise<T>): Promise<T> {\n const pending = pendingBuilds.get(key);\n if (pending !== undefined) return pending as Promise<T>;\n const started = run();\n pendingBuilds.set(key, started);\n try {\n return await started;\n } finally {\n pendingBuilds.delete(key);\n }\n}\n\n/**\n * Ensures the one global web build for the given plugin roots exists and returns it.\n *\n * The output is `<home>/build/web/<key>/`, built in a temporary directory and renamed into\n * place, so a key directory is always complete; an existing key builds nothing. Each\n * plugin shares one content-hashed Tailwind stylesheet with the shell and fallback template.\n */\ntype ResolvedGlobalWebBuild =\n | { status: 'resolved'; webRoot: string; pluginRoots: string[]; key: string; buildsRoot: string; directory: string }\n | { status: 'skipped'; reason: string }\n | { status: 'failed'; reason: string };\n\n/** The build key for these plugin roots and where its build lives, without building anything. */\nfunction resolveGlobalWebBuild(input: GlobalWebBuildInput): ResolvedGlobalWebBuild {\n const environment = input.environment ?? process.env;\n const webRoot = (input.resolveWebRoot ?? resolveWebPackageRoot)(input.poHome, environment);\n if (webRoot === undefined || !fs.existsSync(path.join(webRoot, 'package.json')))\n return { status: 'skipped', reason: `${WEB_PACKAGE} is not installed; no web composition is published` };\n const pluginRoots = [...new Set(input.pluginRoots.map((root) => path.resolve(root)))].sort();\n let key: string;\n try {\n key = globalBuildKey(\n GLOBAL_BUILD_FORMAT,\n webRoot,\n scanWebPlugins(webRoot, pluginRoots, input.onNotice ?? ((): void => {})),\n );\n } catch (error) {\n return { status: 'failed', reason: error instanceof Error ? error.message : String(error) };\n }\n const buildsRoot = path.join(input.poHome, 'build', 'web');\n return { status: 'resolved', webRoot, pluginRoots, key, buildsRoot, directory: path.join(buildsRoot, key) };\n}\n\n/** Whether the global build for these plugin roots exists, for a check that must not build. */\nexport function readGlobalWebBuildStatus(\n input: GlobalWebBuildInput,\n):\n | { status: 'current' | 'missing'; key: string }\n | { status: 'skipped'; reason: string }\n | { status: 'failed'; reason: string } {\n const resolved = resolveGlobalWebBuild(input);\n if (resolved.status !== 'resolved') return resolved;\n return { status: readBuildRecord(resolved.directory) === undefined ? 'missing' : 'current', key: resolved.key };\n}\n\nexport async function ensureGlobalWebBuild(input: GlobalWebBuildInput): Promise<GlobalWebBuildResult> {\n const environment = input.environment ?? process.env;\n const notice = input.onNotice ?? ((): void => {});\n const resolved = resolveGlobalWebBuild(input);\n if (resolved.status !== 'resolved') return resolved;\n const { webRoot, pluginRoots, key, buildsRoot, directory } = resolved;\n const existing = readBuildRecord(directory);\n if (existing !== undefined) return { status: 'cached', build: existing };\n return singleFlightBuild(key, async (): Promise<GlobalWebBuildResult> => {\n try {\n await buildKeyDirectory(buildsRoot, key, directory, async (temporary) => {\n const request = { hostRoot: webRoot, pluginRoots, outDir: temporary };\n const output = await (input.runBuild ?? ((value) => runBuildProcess(value, environment, notice)))(request);\n return {\n key,\n plugins: output.plugins,\n pluginStyles: output.pluginStyles,\n baseStyle: output.baseStyle,\n };\n });\n const build = readBuildRecord(directory);\n if (build === undefined) throw new Error(`The web build '${key}' was not recorded.`);\n return { status: 'built', build };\n } catch (error) {\n return { status: 'failed', reason: error instanceof Error ? error.message : String(error) };\n }\n });\n}\n\ntype MountPluginRecord = { pluginId: string; packageDir: string; isHost: boolean };\n\n/** The plugin copies a mount runs, host plugins plus its own roots', at most one per pluginId (first wins). */\nfunction mountPluginCopies(\n build: { plugins: readonly MountPluginRecord[] },\n packageRoots: readonly string[],\n): MountPluginRecord[] {\n const roots = new Set(packageRoots.map((root) => path.resolve(root)));\n const seen = new Set<string>();\n return build.plugins.filter((plugin) => {\n if (!plugin.isHost && !roots.has(path.resolve(plugin.packageDir))) return false;\n if (seen.has(plugin.pluginId)) return false;\n seen.add(plugin.pluginId);\n return true;\n });\n}\n\n/** The `pluginId` values a mount runs: the host's plugins plus those of its own package roots, deduplicated. */\nexport function mountWebPluginIds(\n build: { plugins: readonly MountPluginRecord[] },\n packageRoots: readonly string[],\n): string[] {\n return mountPluginCopies(build, packageRoots).map((plugin) => plugin.pluginId);\n}\n\n/** The slots a mount runs: one copy per pluginId, the first in build order. */\nexport function mountWebPluginSlots(\n build: { plugins: readonly MountPluginRecord[] },\n packageRoots: readonly string[],\n): string[] {\n return mountPluginCopies(build, packageRoots).map(pluginSlot);\n}\n\n/**\n * The package roots among `packageRoots` that declare a web plugin the build has no slot for:\n * a package that was not synced yet, or was left out of the build. Their names, else their roots.\n */\nexport function unslottedWebPackages(\n build: { plugins: readonly MountPluginRecord[] },\n packageRoots: readonly string[],\n): string[] {\n const slotted = new Set(build.plugins.map((plugin) => path.resolve(plugin.packageDir)));\n const missing: string[] = [];\n for (const root of new Set(packageRoots.map((entry) => path.resolve(entry)))) {\n if (slotted.has(root)) continue;\n let manifest: { name?: unknown; poWeb?: unknown };\n try {\n manifest = JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf8')) as typeof manifest;\n } catch {\n // Unreadable manifests are reported by the build's own scan, not as a missing slot.\n continue;\n }\n if (manifest.poWeb === undefined) continue;\n missing.push(typeof manifest.name === 'string' ? manifest.name : root);\n }\n return missing;\n}\n\n/** The pluginIds with more than one installed copy among the host and these roots, each with its slots in build order. */\nexport function duplicatePluginCopies(\n build: { plugins: readonly MountPluginRecord[] },\n packageRoots: readonly string[],\n): Map<string, string[]> {\n const roots = new Set(packageRoots.map((root) => path.resolve(root)));\n const slotsById = new Map<string, string[]>();\n for (const plugin of build.plugins) {\n if (!plugin.isHost && !roots.has(path.resolve(plugin.packageDir))) continue;\n const slot = pluginSlot(plugin);\n const slots = slotsById.get(plugin.pluginId) ?? [];\n if (!slots.includes(slot)) slots.push(slot);\n slotsById.set(plugin.pluginId, slots);\n }\n return new Map([...slotsById].filter(([, slots]) => slots.length > 1));\n}\n"],"mappings":";;;;;;;;;AAYA,MAAM,cAAc;AACpB,MAAM,uBAAuB;;AAG7B,SAAgB,wBAAwB,cAA0E;CAChH,OAAO,CACL,GAAG,IAAI,IACL,aACG,SAAS,gBAAgB,YAAY,cAAc,CAAC,CACpD,IAAI,aAAa,CAAC,CAClB,QAAQ,SAAyB,SAAS,KAAA,CAAS,CACxD,CACF;AACF;;AAGA,SAAgB,cAAc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d,OACA,cACU;CACV,MAAM,UAAU,IAAI,IAAI,MAAM,QAAQ,KAAK,WAAW,KAAK,QAAQ,OAAO,UAAU,CAAC,CAAC;CACtF,MAAM,UAAoB,CAAC;CAC3B,KAAK,MAAM,QAAQ,IAAI,IAAI,aAAa,KAAK,UAAU,KAAK,QAAQ,KAAK,CAAC,CAAC,GAAG;EAC5E,IAAI,QAAQ,IAAI,IAAI,GAAG;EACvB,IAAI;EACJ,IAAI;GACF,WAAW,KAAK,MAAM,GAAG,aAAa,KAAK,KAAK,MAAM,cAAc,GAAG,MAAM,CAAC;EAChF,QAAQ;GAEN;EACF;EACA,IAAI,SAAS,UAAU,KAAA,GAAW;EAClC,QAAQ,KAAK,OAAO,SAAS,SAAS,WAAW,SAAS,OAAO,IAAI;CACvE;CACA,OAAO;AACT;;AAGA,SAAgB,sBACd,OACA,cACuB;CACvB,MAAM,QAAQ,IAAI,IAAI,aAAa,KAAK,SAAS,KAAK,QAAQ,IAAI,CAAC,CAAC;CACpE,MAAM,4BAAY,IAAI,IAAsB;CAC5C,KAAK,MAAM,UAAU,MAAM,SAAS;EAClC,IAAI,CAAC,OAAO,UAAU,CAAC,MAAM,IAAI,KAAK,QAAQ,OAAO,UAAU,CAAC,GAAG;EACnE,MAAM,OAAO,WAAW,MAAM;EAC9B,MAAM,QAAQ,UAAU,IAAI,OAAO,QAAQ,KAAK,CAAC;EACjD,IAAI,CAAC,MAAM,SAAS,IAAI,GAAG,MAAM,KAAK,IAAI;EAC1C,UAAU,IAAI,OAAO,UAAU,KAAK;CACtC;CACA,OAAO,IAAI,IAAI,CAAC,GAAG,SAAS,CAAC,CAAC,QAAQ,GAAG,WAAW,MAAM,SAAS,CAAC,CAAC;AACvE"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["fsp"],"sources":["../../../../src/builders/web/index.ts"],"sourcesContent":["import { execFile } from 'node:child_process';\nimport crypto from 'node:crypto';\nimport fsp from 'node:fs/promises';\nimport { createRequire } from 'node:module';\nimport path from 'node:path';\n\nimport { createNodePlatform } from '@agimon-ai/po-core/nodePlatform';\nimport { BACKGROUND_CONTEXT, type FileSystem, getOrThrow, pathExists } from '@agimon-ai/po-core/platform';\nimport type { GlobalWebBuild, GlobalWebBuildPlugin } from '@agimon-ai/po-core/webCompositions';\n\nimport { snapshotFiles, statSignature } from '../server/packageUrl';\nimport { compareCodeUnits, type DeclaredWebPlugin } from './webPluginManifest';\nimport { scanWebPlugins } from './webPluginScan';\n\nconst WEB_PACKAGE = '@agimon-ai/po-web';\nconst WEB_PACKAGE_ROOT_ENV = 'PO_WEB_PACKAGE_ROOT';\n\n/** The package roots a set of compositions activates, without blocking a live host. */\nexport async function compositionPackageRoots(\n compositions: readonly { packageEntries: readonly string[] }[],\n files: FileSystem = createNodePlatform().env(process.cwd()),\n): Promise<string[]> {\n const roots = await Promise.all(\n compositions.flatMap((composition) => composition.packageEntries).map((entry) => packageRootOf(entry, files)),\n );\n return [...new Set(roots.filter((root) => root !== undefined))];\n}\n\nexport async function packageRootOf(\n entryPath: string,\n files: FileSystem = createNodePlatform().env(process.cwd()),\n): Promise<string | undefined> {\n let directory = path.dirname(entryPath);\n for (;;) {\n if (await pathExists(files, path.join(directory, 'package.json'), BACKGROUND_CONTEXT)) return directory;\n const parent = path.dirname(directory);\n if (parent === directory) return undefined;\n directory = parent;\n }\n}\n\nfunction resolveWebPackageRoot(repoRoot: string, environment: NodeJS.ProcessEnv): string | undefined {\n const override = environment[WEB_PACKAGE_ROOT_ENV];\n if (override !== undefined && override !== '') return path.resolve(override);\n try {\n return path.dirname(createRequire(path.join(repoRoot, 'package.json')).resolve(`${WEB_PACKAGE}/package.json`));\n } catch {\n try {\n return path.dirname(createRequire(import.meta.url).resolve(`${WEB_PACKAGE}/package.json`));\n } catch {\n return undefined;\n }\n }\n}\n\n/** The installed po-web host version the global web build would use, or `none` when it is not installed. */\nexport async function webHostVersion(\n poHome: string,\n environment: NodeJS.ProcessEnv = process.env,\n files: FileSystem = createNodePlatform().env(poHome),\n): Promise<string> {\n const webRoot = resolveWebPackageRoot(poHome, environment);\n if (webRoot === undefined) return 'none';\n try {\n const manifest = JSON.parse(\n getOrThrow(await files.readTextFile(path.join(webRoot, 'package.json'), BACKGROUND_CONTEXT)),\n ) as { version?: unknown };\n return typeof manifest.version === 'string' ? manifest.version : 'unversioned';\n } catch (error) {\n return `unreadable:${error instanceof Error ? error.message : String(error)}`;\n }\n}\n\n/** Bumped whenever the build's output layout changes, so an old layout is never reused. */\nconst GLOBAL_BUILD_FORMAT = 'global-web-5';\n/** The record every keyed global build writes last, so a key directory holding it is complete. */\nexport const BUILD_RECORD = 'build.json';\n/** Po packages the host shell bundles, the Po members of the bundle's shared runtimes. */\nconst HOST_SHELL_PACKAGES = [\n '@agimon-ai/po-core',\n '@agimon-ai/po-web-dashboard',\n '@agimon-ai/po-web-components',\n '@agimon-ai/po-web-security',\n];\n\n/** Catalog owners baked into the shell, independent of the active optional plugins. */\nexport async function webShellLocaleRoots(\n poHome: string,\n environment: NodeJS.ProcessEnv,\n files: FileSystem,\n): Promise<string[]> {\n const root = resolveWebPackageRoot(poHome, environment);\n if (root === undefined || !(await pathExists(files, path.join(root, 'package.json'), BACKGROUND_CONTEXT))) return [];\n const require = createRequire(path.join(root, 'package.json'));\n return [\n root,\n ...[...HOST_SHELL_PACKAGES, '@agimon-ai/po-identity'].flatMap((name) => {\n try {\n return [path.dirname(require.resolve(`${name}/package.json`))];\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== 'MODULE_NOT_FOUND') throw error;\n return [];\n }\n }),\n ];\n}\n\nconst BUILD_CHILD_SCRIPT = `\nconst [bundleUrl, request] = process.argv.slice(1);\ntry {\n const { bundleCockpitWeb } = await import(bundleUrl);\n const { hostRoot, pluginRoots, outDir } = JSON.parse(request);\n const result = await bundleCockpitWeb({\n hostRoot,\n pluginRoots,\n outDir,\n onNotice: (message) => process.stderr.write(message + '\\\\n'),\n });\n process.stdout.write(JSON.stringify(result));\n} catch (error) {\n process.stderr.write(error instanceof Error ? (error.stack ?? error.message) : String(error));\n process.exitCode = 1;\n}\n`;\n\n/** One build's record: the publishable build, whose plugins carry each copy's package and slot closure. */\nexport type GlobalWebBuildRecord = GlobalWebBuild;\n\nexport interface GlobalWebBuildInput {\n /** Po's global home; builds land in `<home>/build/web/<key>/`. */\n poHome: string;\n files?: FileSystem;\n /** The union of every scope's package roots; roots without a poWeb block are ignored. */\n pluginRoots: readonly string[];\n environment?: NodeJS.ProcessEnv;\n onNotice?: (message: string) => void;\n /** Test seam over the child-process build. */\n runBuild?: (request: { hostRoot: string; pluginRoots: string[]; outDir: string }) => Promise<BuildOutput>;\n /** Test seam over package resolution. */\n resolveWebRoot?: (repoRoot: string, environment: NodeJS.ProcessEnv) => string | undefined;\n}\n\ninterface BuildOutput {\n assetsDir: string;\n pluginsDir: string;\n plugins: GlobalWebBuildPlugin[];\n pluginStyles: Record<string, string>;\n baseStyle: string;\n}\n\nexport type GlobalWebBuildResult =\n | { status: 'built' | 'cached'; build: GlobalWebBuildRecord }\n | { status: 'skipped'; reason: string }\n | { status: 'failed'; reason: string };\n\n/**\n * The size+mtime signature of every file a plugin package hands the build: its manifest\n * plus the whole top-level folder of the client entry and of each declared export, so an\n * edited import or a rebuilt dist chunk changes the key, not only the entry file.\n */\nasync function packageSignature(packageDir: string, entries: readonly string[], files: FileSystem): Promise<string> {\n try {\n const selected = new Set<string>();\n for (const entry of entries) for (const file of await snapshotFiles(packageDir, entry, files)) selected.add(file);\n return await statSignature(packageDir, [...selected].sort(), files);\n } catch (error) {\n // A declared export that is not built yet must not block the build; it only weakens the key.\n return `unreadable:${error instanceof Error ? error.message : String(error)}`;\n }\n}\n\n/**\n * The content key of a build: the format, the host package when there is one, then every\n * plugin package's file signature. A changed source or dist file or a changed plugin set\n * yields a new key; roots that declare no plugin do not take part.\n */\nexport async function globalBuildKey(\n format: string,\n hostRoot: string | undefined,\n plugins: readonly DeclaredWebPlugin[],\n files: FileSystem = createNodePlatform().env(process.cwd()),\n): Promise<string> {\n const hash = crypto.createHash('sha256').update(format);\n if (hostRoot !== undefined) {\n hash.update(\n `host:${hostRoot}:${getOrThrow(await files.readTextFile(path.join(hostRoot, 'package.json'), BACKGROUND_CONTEXT))}`,\n );\n hash.update(\n `\\0host-files:${await packageSignature(hostRoot, [path.join(hostRoot, 'src', 'web', 'index.html')], files)}`,\n );\n // The shell bundles these from the host's own node_modules. A checkout rebuilds them in place without touching\n // the host manifest, so their built files key the build too; a missing one only weakens the key.\n for (const name of HOST_SHELL_PACKAGES) {\n const packageDir = path.join(hostRoot, 'node_modules', ...name.split('/'));\n hash.update(`\\0shell:${name}\\0${await packageSignature(packageDir, [path.join(packageDir, 'dist')], files)}`);\n }\n }\n const entries = new Map<string, string[]>();\n for (const plugin of [...plugins].sort((a, b) => compareCodeUnits(a.pluginId, b.pluginId))) {\n hash.update(`\\0${plugin.pluginId}:${plugin.packageDir}:${plugin.client.entry}`);\n const list = entries.get(plugin.packageDir) ?? [];\n list.push(path.join(plugin.packageDir, plugin.client.entry));\n entries.set(plugin.packageDir, list);\n }\n for (const packageDir of [...entries.keys()].sort())\n hash.update(`\\0${packageDir}\\0${await packageSignature(packageDir, entries.get(packageDir) ?? [], files)}`);\n return hash.digest('hex').slice(0, 32);\n}\n\nfunction bundleModuleUrl(): string {\n const extension = import.meta.url.endsWith('.ts') ? 'ts' : 'mjs';\n return new URL(`./bundle.${extension}`, import.meta.url).href;\n}\n\n/** Runs Vite in a child process so its module graph and caches never stay in the server heap. */\nfunction runBuildProcess(\n request: { hostRoot: string; pluginRoots: string[]; outDir: string },\n environment: NodeJS.ProcessEnv,\n onNotice: (message: string) => void,\n): Promise<BuildOutput> {\n const args = [\n ...process.execArgv,\n '--input-type=module',\n '--eval',\n BUILD_CHILD_SCRIPT,\n bundleModuleUrl(),\n JSON.stringify(request),\n ];\n return new Promise((resolve, reject) => {\n execFile(\n process.execPath,\n args,\n { cwd: request.hostRoot, env: environment, encoding: 'utf8', maxBuffer: 64 * 1024 * 1024 },\n (error, stdout, stderr) => {\n if (error) {\n reject(new Error(`${stderr || stdout}`.trim() || `Web build exited with code ${String(error.code ?? 1)}`));\n return;\n }\n for (const line of stderr.split('\\n')) if (line.trim()) onNotice(line.trim());\n resolve(JSON.parse(stdout) as BuildOutput);\n },\n );\n });\n}\n\n/** A key directory's parsed build record, or undefined when the build is not there (yet). */\nexport async function readBuildJson<T>(\n directory: string,\n files: FileSystem = createNodePlatform().env(directory),\n): Promise<T | undefined> {\n try {\n return JSON.parse(\n getOrThrow(await files.readTextFile(path.join(directory, BUILD_RECORD), BACKGROUND_CONTEXT)),\n ) as T;\n } catch (error) {\n if ((error as { code?: string }).code === 'not_found') return undefined;\n throw error;\n }\n}\n\nasync function readBuildRecord(directory: string, files?: FileSystem): Promise<GlobalWebBuildRecord | undefined> {\n const record = await readBuildJson<Omit<GlobalWebBuildRecord, 'webDirectory' | 'pluginsDirectory'>>(directory, files);\n if (\n record === undefined ||\n !Array.isArray(record.plugins) ||\n record.plugins.some((plugin) => typeof plugin.slot !== 'string')\n )\n return undefined;\n return { ...record, webDirectory: path.join(directory, 'web'), pluginsDirectory: path.join(directory, 'plugins') };\n}\n\nfunction webBuildsRoot(poHome: string): string {\n return path.join(poHome, 'build', 'web');\n}\n\n/** The complete global web build of one key, or undefined when it is not there. Never builds. */\nexport async function readGlobalWebBuildRecord(\n poHome: string,\n key: string,\n files?: FileSystem,\n): Promise<GlobalWebBuildRecord | undefined> {\n return readBuildRecord(path.join(webBuildsRoot(poHome), key), files);\n}\n\n/**\n * The key of the most recently written complete global web build, for a server that starts\n * before sync ever wrote a pointer. Temporary build folders start with a dot and are skipped.\n */\nexport async function newestGlobalWebBuildKey(\n poHome: string,\n files: FileSystem = createNodePlatform().env(poHome),\n): Promise<string | undefined> {\n const root = webBuildsRoot(poHome);\n const listed = await files.listDir(root, BACKGROUND_CONTEXT);\n if (!listed.ok && listed.error.code === 'not_found') return undefined;\n const records = await Promise.all(\n getOrThrow(listed)\n .filter((entry) => entry.kind === 'directory' && !entry.name.startsWith('.'))\n .map(async (entry) => {\n const info = await files.fileInfo(path.join(root, entry.name, BUILD_RECORD), BACKGROUND_CONTEXT);\n if (!info.ok && info.error.code === 'not_found') return undefined;\n return { name: entry.name, modified: getOrThrow(info).mtimeMs };\n }),\n );\n return records.filter((entry) => entry !== undefined).sort((left, right) => right.modified - left.modified)[0]?.name;\n}\n\n/**\n * Builds into a temporary sibling of `directory`, writes the build record last, and renames\n * the result into place, so a key directory is always complete. Losing the rename to another\n * process that finished the same key is fine: its bytes are identical.\n */\nexport async function buildKeyDirectory(\n buildsRoot: string,\n key: string,\n directory: string,\n build: (temporary: string) => Promise<object>,\n): Promise<void> {\n await fsp.mkdir(buildsRoot, { recursive: true });\n const temporary = await fsp.mkdtemp(path.join(buildsRoot, `.${key}-`));\n try {\n const record = await build(temporary);\n await fsp.writeFile(path.join(temporary, BUILD_RECORD), `${JSON.stringify(record, null, 2)}\\n`);\n try {\n await fsp.rename(temporary, directory);\n } catch (error) {\n if ((await readBuildJson(directory)) === undefined) throw error;\n }\n } finally {\n await fsp.rm(temporary, { recursive: true, force: true });\n }\n}\n\nconst pendingBuilds = new Map<string, Promise<unknown>>();\n\n/** Joins a build of the same key that is already running in this process instead of starting another. */\nexport async function singleFlightBuild<T>(key: string, run: () => Promise<T>): Promise<T> {\n const pending = pendingBuilds.get(key);\n if (pending !== undefined) return pending as Promise<T>;\n const started = run();\n pendingBuilds.set(key, started);\n try {\n return await started;\n } finally {\n pendingBuilds.delete(key);\n }\n}\n\n/**\n * Ensures the one global web build for the given plugin roots exists and returns it.\n *\n * The output is `<home>/build/web/<key>/`, built in a temporary directory and renamed into\n * place, so a key directory is always complete; an existing key builds nothing. Each\n * plugin shares one content-hashed Tailwind stylesheet with the shell and fallback template.\n */\ntype ResolvedGlobalWebBuild =\n | { status: 'resolved'; webRoot: string; pluginRoots: string[]; key: string; buildsRoot: string; directory: string }\n | { status: 'skipped'; reason: string }\n | { status: 'failed'; reason: string };\n\n/** The build key for these plugin roots and where its build lives, without building anything. */\nasync function resolveGlobalWebBuild(input: GlobalWebBuildInput): Promise<ResolvedGlobalWebBuild> {\n const environment = input.environment ?? process.env;\n const webRoot = (input.resolveWebRoot ?? resolveWebPackageRoot)(input.poHome, environment);\n if (\n webRoot === undefined ||\n !(await pathExists(\n input.files ?? createNodePlatform().env(input.poHome),\n path.join(webRoot, 'package.json'),\n BACKGROUND_CONTEXT,\n ))\n )\n return { status: 'skipped', reason: `${WEB_PACKAGE} is not installed; no web composition is published` };\n const pluginRoots = [...new Set(input.pluginRoots.map((root) => path.resolve(root)))].sort();\n let key: string;\n try {\n key = await globalBuildKey(\n GLOBAL_BUILD_FORMAT,\n webRoot,\n await scanWebPlugins(webRoot, pluginRoots, input.onNotice ?? ((): void => {})),\n input.files,\n );\n } catch (error) {\n return { status: 'failed', reason: error instanceof Error ? error.message : String(error) };\n }\n const buildsRoot = path.join(input.poHome, 'build', 'web');\n return { status: 'resolved', webRoot, pluginRoots, key, buildsRoot, directory: path.join(buildsRoot, key) };\n}\n\n/** Whether the global build for these plugin roots exists, for a check that must not build. */\nexport async function readGlobalWebBuildStatus(\n input: GlobalWebBuildInput,\n): Promise<\n | { status: 'current' | 'missing'; key: string }\n | { status: 'skipped'; reason: string }\n | { status: 'failed'; reason: string }\n> {\n const resolved = await resolveGlobalWebBuild(input);\n if (resolved.status !== 'resolved') return resolved;\n return {\n status: (await readBuildRecord(resolved.directory, input.files)) === undefined ? 'missing' : 'current',\n key: resolved.key,\n };\n}\n\nexport async function ensureGlobalWebBuild(input: GlobalWebBuildInput): Promise<GlobalWebBuildResult> {\n const environment = input.environment ?? process.env;\n const notice = input.onNotice ?? ((): void => {});\n const resolved = await resolveGlobalWebBuild(input);\n if (resolved.status !== 'resolved') return resolved;\n const { webRoot, pluginRoots, key, buildsRoot, directory } = resolved;\n const existing = await readBuildRecord(directory, input.files);\n if (existing !== undefined) return { status: 'cached', build: existing };\n return singleFlightBuild(key, async (): Promise<GlobalWebBuildResult> => {\n try {\n await buildKeyDirectory(buildsRoot, key, directory, async (temporary) => {\n const request = { hostRoot: webRoot, pluginRoots, outDir: temporary };\n const output = await (input.runBuild ?? ((value) => runBuildProcess(value, environment, notice)))(request);\n return {\n key,\n plugins: output.plugins,\n pluginStyles: output.pluginStyles,\n baseStyle: output.baseStyle,\n };\n });\n const build = await readBuildRecord(directory, input.files);\n if (build === undefined) throw new Error(`The web build '${key}' was not recorded.`);\n return { status: 'built', build };\n } catch (error) {\n return { status: 'failed', reason: error instanceof Error ? error.message : String(error) };\n }\n });\n}\n\ntype MountPluginRecord = { pluginId: string; packageDir: string; isHost: boolean };\n\n/** The plugin copies a mount runs, host plugins plus its own roots', at most one per pluginId (first wins). */\nfunction mountPluginCopies<T extends MountPluginRecord>(\n build: { plugins: readonly T[] },\n packageRoots: readonly string[],\n): T[] {\n const roots = new Set(packageRoots.map((root) => path.resolve(root)));\n const seen = new Set<string>();\n return build.plugins.filter((plugin) => {\n if (!plugin.isHost && !roots.has(path.resolve(plugin.packageDir))) return false;\n if (seen.has(plugin.pluginId)) return false;\n seen.add(plugin.pluginId);\n return true;\n });\n}\n\n/** The `pluginId` values a mount runs: the host's plugins plus those of its own package roots, deduplicated. */\nexport function mountWebPluginIds(\n build: { plugins: readonly MountPluginRecord[] },\n packageRoots: readonly string[],\n): string[] {\n return mountPluginCopies(build, packageRoots).map((plugin) => plugin.pluginId);\n}\n\n/** The slots a mount runs: one copy per pluginId, the first in build order. */\nexport function mountWebPluginSlots(\n build: { plugins: readonly (MountPluginRecord & { slot: string })[] },\n packageRoots: readonly string[],\n): string[] {\n return mountPluginCopies(build, packageRoots).map((plugin) => plugin.slot);\n}\n\n/**\n * The package roots among `packageRoots` that declare a web plugin the build has no slot for:\n * a package that was not synced yet, or was left out of the build. Their names, else their roots.\n */\nexport async function unslottedWebPackages(\n build: { plugins: readonly MountPluginRecord[] },\n packageRoots: readonly string[],\n files: FileSystem = createNodePlatform().env(process.cwd()),\n): Promise<string[]> {\n const slotted = new Set(build.plugins.map((plugin) => path.resolve(plugin.packageDir)));\n const missing: string[] = [];\n for (const root of new Set(packageRoots.map((entry) => path.resolve(entry)))) {\n if (slotted.has(root)) continue;\n let manifest: { name?: unknown; poWeb?: unknown };\n try {\n manifest = JSON.parse(\n getOrThrow(await files.readTextFile(path.join(root, 'package.json'), BACKGROUND_CONTEXT)),\n ) as typeof manifest;\n } catch {\n // Unreadable manifests are reported by the build's own scan, not as a missing slot.\n continue;\n }\n if (manifest.poWeb === undefined) continue;\n missing.push(typeof manifest.name === 'string' ? manifest.name : root);\n }\n return missing;\n}\n\n/** The pluginIds with more than one installed copy among the host and these roots, each with its slots in build order. */\nexport function duplicatePluginCopies(\n build: { plugins: readonly (MountPluginRecord & { slot: string })[] },\n packageRoots: readonly string[],\n): Map<string, string[]> {\n const roots = new Set(packageRoots.map((root) => path.resolve(root)));\n const slotsById = new Map<string, string[]>();\n for (const plugin of build.plugins) {\n if (!plugin.isHost && !roots.has(path.resolve(plugin.packageDir))) continue;\n const slot = plugin.slot;\n const slots = slotsById.get(plugin.pluginId) ?? [];\n if (!slots.includes(slot)) slots.push(slot);\n slotsById.set(plugin.pluginId, slots);\n }\n return new Map([...slotsById].filter(([, slots]) => slots.length > 1));\n}\n"],"mappings":";;;;;;;;;;;AAcA,MAAM,cAAc;AACpB,MAAM,uBAAuB;;AAG7B,eAAsB,wBACpB,cACA,QAAoB,mBAAmB,CAAC,CAAC,IAAI,QAAQ,IAAI,CAAC,GACvC;CACnB,MAAM,QAAQ,MAAM,QAAQ,IAC1B,aAAa,SAAS,gBAAgB,YAAY,cAAc,CAAC,CAAC,KAAK,UAAU,cAAc,OAAO,KAAK,CAAC,CAC9G;CACA,OAAO,CAAC,GAAG,IAAI,IAAI,MAAM,QAAQ,SAAS,SAAS,KAAA,CAAS,CAAC,CAAC;AAChE;AAEA,eAAsB,cACpB,WACA,QAAoB,mBAAmB,CAAC,CAAC,IAAI,QAAQ,IAAI,C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