@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
|
@@ -2,29 +2,31 @@ const require_runtime = require("../../../_virtual/_rolldown/runtime.cjs");
|
|
|
2
2
|
const require_packageUrl = require("../server/packageUrl.cjs");
|
|
3
3
|
const require_webPluginManifest = require("./webPluginManifest.cjs");
|
|
4
4
|
const require_webPluginScan = require("./webPluginScan.cjs");
|
|
5
|
-
let
|
|
6
|
-
node_fs = require_runtime.__toESM(node_fs, 1);
|
|
5
|
+
let node_module = require("node:module");
|
|
7
6
|
let node_path = require("node:path");
|
|
8
7
|
node_path = require_runtime.__toESM(node_path, 1);
|
|
9
|
-
let
|
|
10
|
-
|
|
8
|
+
let node_fs_promises = require("node:fs/promises");
|
|
9
|
+
node_fs_promises = require_runtime.__toESM(node_fs_promises, 1);
|
|
10
|
+
let _agimon_ai_po_core_nodePlatform = require("@agimon-ai/po-core/nodePlatform");
|
|
11
|
+
let _agimon_ai_po_core_platform = require("@agimon-ai/po-core/platform");
|
|
11
12
|
let node_crypto = require("node:crypto");
|
|
12
13
|
node_crypto = require_runtime.__toESM(node_crypto, 1);
|
|
14
|
+
let node_child_process = require("node:child_process");
|
|
13
15
|
//#region src/builders/web/index.ts
|
|
14
16
|
const WEB_PACKAGE = "@agimon-ai/po-web";
|
|
15
17
|
const WEB_PACKAGE_ROOT_ENV = "PO_WEB_PACKAGE_ROOT";
|
|
16
|
-
/** The package roots a set of compositions activates,
|
|
17
|
-
function compositionPackageRoots(compositions) {
|
|
18
|
-
|
|
18
|
+
/** The package roots a set of compositions activates, without blocking a live host. */
|
|
19
|
+
async function compositionPackageRoots(compositions, files = (0, _agimon_ai_po_core_nodePlatform.createNodePlatform)().env(process.cwd())) {
|
|
20
|
+
const roots = await Promise.all(compositions.flatMap((composition) => composition.packageEntries).map((entry) => packageRootOf(entry, files)));
|
|
21
|
+
return [...new Set(roots.filter((root) => root !== void 0))];
|
|
19
22
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
let dir = node_path.default.dirname(entryPath);
|
|
23
|
+
async function packageRootOf(entryPath, files = (0, _agimon_ai_po_core_nodePlatform.createNodePlatform)().env(process.cwd())) {
|
|
24
|
+
let directory = node_path.default.dirname(entryPath);
|
|
23
25
|
for (;;) {
|
|
24
|
-
if (
|
|
25
|
-
const parent = node_path.default.dirname(
|
|
26
|
-
if (parent ===
|
|
27
|
-
|
|
26
|
+
if (await (0, _agimon_ai_po_core_platform.pathExists)(files, node_path.default.join(directory, "package.json"), _agimon_ai_po_core_platform.BACKGROUND_CONTEXT)) return directory;
|
|
27
|
+
const parent = node_path.default.dirname(directory);
|
|
28
|
+
if (parent === directory) return void 0;
|
|
29
|
+
directory = parent;
|
|
28
30
|
}
|
|
29
31
|
}
|
|
30
32
|
function resolveWebPackageRoot(repoRoot, environment) {
|
|
@@ -41,11 +43,11 @@ function resolveWebPackageRoot(repoRoot, environment) {
|
|
|
41
43
|
}
|
|
42
44
|
}
|
|
43
45
|
/** The installed po-web host version the global web build would use, or `none` when it is not installed. */
|
|
44
|
-
function webHostVersion(poHome, environment = process.env) {
|
|
46
|
+
async function webHostVersion(poHome, environment = process.env, files = (0, _agimon_ai_po_core_nodePlatform.createNodePlatform)().env(poHome)) {
|
|
45
47
|
const webRoot = resolveWebPackageRoot(poHome, environment);
|
|
46
48
|
if (webRoot === void 0) return "none";
|
|
47
49
|
try {
|
|
48
|
-
const manifest = JSON.parse(
|
|
50
|
+
const manifest = JSON.parse((0, _agimon_ai_po_core_platform.getOrThrow)(await files.readTextFile(node_path.default.join(webRoot, "package.json"), _agimon_ai_po_core_platform.BACKGROUND_CONTEXT)));
|
|
49
51
|
return typeof manifest.version === "string" ? manifest.version : "unversioned";
|
|
50
52
|
} catch (error) {
|
|
51
53
|
return `unreadable:${error instanceof Error ? error.message : String(error)}`;
|
|
@@ -55,6 +57,27 @@ function webHostVersion(poHome, environment = process.env) {
|
|
|
55
57
|
const GLOBAL_BUILD_FORMAT = "global-web-5";
|
|
56
58
|
/** The record every keyed global build writes last, so a key directory holding it is complete. */
|
|
57
59
|
const BUILD_RECORD = "build.json";
|
|
60
|
+
/** Po packages the host shell bundles, the Po members of the bundle's shared runtimes. */
|
|
61
|
+
const HOST_SHELL_PACKAGES = [
|
|
62
|
+
"@agimon-ai/po-core",
|
|
63
|
+
"@agimon-ai/po-web-dashboard",
|
|
64
|
+
"@agimon-ai/po-web-components",
|
|
65
|
+
"@agimon-ai/po-web-security"
|
|
66
|
+
];
|
|
67
|
+
/** Catalog owners baked into the shell, independent of the active optional plugins. */
|
|
68
|
+
async function webShellLocaleRoots(poHome, environment, files) {
|
|
69
|
+
const root = resolveWebPackageRoot(poHome, environment);
|
|
70
|
+
if (root === void 0 || !await (0, _agimon_ai_po_core_platform.pathExists)(files, node_path.default.join(root, "package.json"), _agimon_ai_po_core_platform.BACKGROUND_CONTEXT)) return [];
|
|
71
|
+
const require$1 = (0, node_module.createRequire)(node_path.default.join(root, "package.json"));
|
|
72
|
+
return [root, ...[...HOST_SHELL_PACKAGES, "@agimon-ai/po-identity"].flatMap((name) => {
|
|
73
|
+
try {
|
|
74
|
+
return [node_path.default.dirname(require$1.resolve(`${name}/package.json`))];
|
|
75
|
+
} catch (error) {
|
|
76
|
+
if (error.code !== "MODULE_NOT_FOUND") throw error;
|
|
77
|
+
return [];
|
|
78
|
+
}
|
|
79
|
+
})];
|
|
80
|
+
}
|
|
58
81
|
const BUILD_CHILD_SCRIPT = `
|
|
59
82
|
const [bundleUrl, request] = process.argv.slice(1);
|
|
60
83
|
try {
|
|
@@ -77,11 +100,11 @@ try {
|
|
|
77
100
|
* plus the whole top-level folder of the client entry and of each declared export, so an
|
|
78
101
|
* edited import or a rebuilt dist chunk changes the key, not only the entry file.
|
|
79
102
|
*/
|
|
80
|
-
function packageSignature(packageDir, entries) {
|
|
103
|
+
async function packageSignature(packageDir, entries, files) {
|
|
81
104
|
try {
|
|
82
|
-
const
|
|
83
|
-
for (const entry of entries) for (const file of require_packageUrl.snapshotFiles(packageDir, entry))
|
|
84
|
-
return require_packageUrl.statSignature(packageDir, [...
|
|
105
|
+
const selected = /* @__PURE__ */ new Set();
|
|
106
|
+
for (const entry of entries) for (const file of await require_packageUrl.snapshotFiles(packageDir, entry, files)) selected.add(file);
|
|
107
|
+
return await require_packageUrl.statSignature(packageDir, [...selected].sort(), files);
|
|
85
108
|
} catch (error) {
|
|
86
109
|
return `unreadable:${error instanceof Error ? error.message : String(error)}`;
|
|
87
110
|
}
|
|
@@ -91,9 +114,16 @@ function packageSignature(packageDir, entries) {
|
|
|
91
114
|
* plugin package's file signature. A changed source or dist file or a changed plugin set
|
|
92
115
|
* yields a new key; roots that declare no plugin do not take part.
|
|
93
116
|
*/
|
|
94
|
-
function globalBuildKey(format, hostRoot, plugins) {
|
|
117
|
+
async function globalBuildKey(format, hostRoot, plugins, files = (0, _agimon_ai_po_core_nodePlatform.createNodePlatform)().env(process.cwd())) {
|
|
95
118
|
const hash = node_crypto.default.createHash("sha256").update(format);
|
|
96
|
-
if (hostRoot !== void 0)
|
|
119
|
+
if (hostRoot !== void 0) {
|
|
120
|
+
hash.update(`host:${hostRoot}:${(0, _agimon_ai_po_core_platform.getOrThrow)(await files.readTextFile(node_path.default.join(hostRoot, "package.json"), _agimon_ai_po_core_platform.BACKGROUND_CONTEXT))}`);
|
|
121
|
+
hash.update(`\0host-files:${await packageSignature(hostRoot, [node_path.default.join(hostRoot, "src", "web", "index.html")], files)}`);
|
|
122
|
+
for (const name of HOST_SHELL_PACKAGES) {
|
|
123
|
+
const packageDir = node_path.default.join(hostRoot, "node_modules", ...name.split("/"));
|
|
124
|
+
hash.update(`\0shell:${name}\0${await packageSignature(packageDir, [node_path.default.join(packageDir, "dist")], files)}`);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
97
127
|
const entries = /* @__PURE__ */ new Map();
|
|
98
128
|
for (const plugin of [...plugins].sort((a, b) => require_webPluginManifest.compareCodeUnits(a.pluginId, b.pluginId))) {
|
|
99
129
|
hash.update(`\0${plugin.pluginId}:${plugin.packageDir}:${plugin.client.entry}`);
|
|
@@ -101,7 +131,7 @@ function globalBuildKey(format, hostRoot, plugins) {
|
|
|
101
131
|
list.push(node_path.default.join(plugin.packageDir, plugin.client.entry));
|
|
102
132
|
entries.set(plugin.packageDir, list);
|
|
103
133
|
}
|
|
104
|
-
for (const packageDir of [...entries.keys()].sort()) hash.update(`\0${packageDir}\0${packageSignature(packageDir, entries.get(packageDir) ?? [])}`);
|
|
134
|
+
for (const packageDir of [...entries.keys()].sort()) hash.update(`\0${packageDir}\0${await packageSignature(packageDir, entries.get(packageDir) ?? [], files)}`);
|
|
105
135
|
return hash.digest("hex").slice(0, 32);
|
|
106
136
|
}
|
|
107
137
|
function bundleModuleUrl() {
|
|
@@ -135,17 +165,17 @@ function runBuildProcess(request, environment, onNotice) {
|
|
|
135
165
|
});
|
|
136
166
|
}
|
|
137
167
|
/** A key directory's parsed build record, or undefined when the build is not there (yet). */
|
|
138
|
-
function readBuildJson(directory) {
|
|
168
|
+
async function readBuildJson(directory, files = (0, _agimon_ai_po_core_nodePlatform.createNodePlatform)().env(directory)) {
|
|
139
169
|
try {
|
|
140
|
-
return JSON.parse(
|
|
170
|
+
return JSON.parse((0, _agimon_ai_po_core_platform.getOrThrow)(await files.readTextFile(node_path.default.join(directory, BUILD_RECORD), _agimon_ai_po_core_platform.BACKGROUND_CONTEXT)));
|
|
141
171
|
} catch (error) {
|
|
142
|
-
if (error.code === "
|
|
172
|
+
if (error.code === "not_found") return void 0;
|
|
143
173
|
throw error;
|
|
144
174
|
}
|
|
145
175
|
}
|
|
146
|
-
function readBuildRecord(directory) {
|
|
147
|
-
const record = readBuildJson(directory);
|
|
148
|
-
if (record === void 0) return void 0;
|
|
176
|
+
async function readBuildRecord(directory, files) {
|
|
177
|
+
const record = await readBuildJson(directory, files);
|
|
178
|
+
if (record === void 0 || !Array.isArray(record.plugins) || record.plugins.some((plugin) => typeof plugin.slot !== "string")) return void 0;
|
|
149
179
|
return {
|
|
150
180
|
...record,
|
|
151
181
|
webDirectory: node_path.default.join(directory, "web"),
|
|
@@ -156,23 +186,25 @@ function webBuildsRoot(poHome) {
|
|
|
156
186
|
return node_path.default.join(poHome, "build", "web");
|
|
157
187
|
}
|
|
158
188
|
/** The complete global web build of one key, or undefined when it is not there. Never builds. */
|
|
159
|
-
function readGlobalWebBuildRecord(poHome, key) {
|
|
160
|
-
return readBuildRecord(node_path.default.join(webBuildsRoot(poHome), key));
|
|
189
|
+
async function readGlobalWebBuildRecord(poHome, key, files) {
|
|
190
|
+
return readBuildRecord(node_path.default.join(webBuildsRoot(poHome), key), files);
|
|
161
191
|
}
|
|
162
192
|
/**
|
|
163
193
|
* The key of the most recently written complete global web build, for a server that starts
|
|
164
194
|
* before sync ever wrote a pointer. Temporary build folders start with a dot and are skipped.
|
|
165
195
|
*/
|
|
166
|
-
function newestGlobalWebBuildKey(poHome) {
|
|
196
|
+
async function newestGlobalWebBuildKey(poHome, files = (0, _agimon_ai_po_core_nodePlatform.createNodePlatform)().env(poHome)) {
|
|
167
197
|
const root = webBuildsRoot(poHome);
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
198
|
+
const listed = await files.listDir(root, _agimon_ai_po_core_platform.BACKGROUND_CONTEXT);
|
|
199
|
+
if (!listed.ok && listed.error.code === "not_found") return void 0;
|
|
200
|
+
return (await Promise.all((0, _agimon_ai_po_core_platform.getOrThrow)(listed).filter((entry) => entry.kind === "directory" && !entry.name.startsWith(".")).map(async (entry) => {
|
|
201
|
+
const info = await files.fileInfo(node_path.default.join(root, entry.name, BUILD_RECORD), _agimon_ai_po_core_platform.BACKGROUND_CONTEXT);
|
|
202
|
+
if (!info.ok && info.error.code === "not_found") return void 0;
|
|
203
|
+
return {
|
|
204
|
+
name: entry.name,
|
|
205
|
+
modified: (0, _agimon_ai_po_core_platform.getOrThrow)(info).mtimeMs
|
|
206
|
+
};
|
|
207
|
+
}))).filter((entry) => entry !== void 0).sort((left, right) => right.modified - left.modified)[0]?.name;
|
|
176
208
|
}
|
|
177
209
|
/**
|
|
178
210
|
* Builds into a temporary sibling of `directory`, writes the build record last, and renames
|
|
@@ -180,18 +212,18 @@ function newestGlobalWebBuildKey(poHome) {
|
|
|
180
212
|
* process that finished the same key is fine: its bytes are identical.
|
|
181
213
|
*/
|
|
182
214
|
async function buildKeyDirectory(buildsRoot, key, directory, build) {
|
|
183
|
-
|
|
184
|
-
const temporary =
|
|
215
|
+
await node_fs_promises.default.mkdir(buildsRoot, { recursive: true });
|
|
216
|
+
const temporary = await node_fs_promises.default.mkdtemp(node_path.default.join(buildsRoot, `.${key}-`));
|
|
185
217
|
try {
|
|
186
218
|
const record = await build(temporary);
|
|
187
|
-
|
|
219
|
+
await node_fs_promises.default.writeFile(node_path.default.join(temporary, BUILD_RECORD), `${JSON.stringify(record, null, 2)}\n`);
|
|
188
220
|
try {
|
|
189
|
-
|
|
221
|
+
await node_fs_promises.default.rename(temporary, directory);
|
|
190
222
|
} catch (error) {
|
|
191
|
-
if (readBuildJson(directory) === void 0) throw error;
|
|
223
|
+
if (await readBuildJson(directory) === void 0) throw error;
|
|
192
224
|
}
|
|
193
225
|
} finally {
|
|
194
|
-
|
|
226
|
+
await node_fs_promises.default.rm(temporary, {
|
|
195
227
|
recursive: true,
|
|
196
228
|
force: true
|
|
197
229
|
});
|
|
@@ -211,17 +243,17 @@ async function singleFlightBuild(key, run) {
|
|
|
211
243
|
}
|
|
212
244
|
}
|
|
213
245
|
/** The build key for these plugin roots and where its build lives, without building anything. */
|
|
214
|
-
function resolveGlobalWebBuild(input) {
|
|
246
|
+
async function resolveGlobalWebBuild(input) {
|
|
215
247
|
const environment = input.environment ?? process.env;
|
|
216
248
|
const webRoot = (input.resolveWebRoot ?? resolveWebPackageRoot)(input.poHome, environment);
|
|
217
|
-
if (webRoot === void 0 || !
|
|
249
|
+
if (webRoot === void 0 || !await (0, _agimon_ai_po_core_platform.pathExists)(input.files ?? (0, _agimon_ai_po_core_nodePlatform.createNodePlatform)().env(input.poHome), node_path.default.join(webRoot, "package.json"), _agimon_ai_po_core_platform.BACKGROUND_CONTEXT)) return {
|
|
218
250
|
status: "skipped",
|
|
219
251
|
reason: `${WEB_PACKAGE} is not installed; no web composition is published`
|
|
220
252
|
};
|
|
221
253
|
const pluginRoots = [...new Set(input.pluginRoots.map((root) => node_path.default.resolve(root)))].sort();
|
|
222
254
|
let key;
|
|
223
255
|
try {
|
|
224
|
-
key = globalBuildKey(GLOBAL_BUILD_FORMAT, webRoot, require_webPluginScan.scanWebPlugins(webRoot, pluginRoots, input.onNotice ?? (() => {})));
|
|
256
|
+
key = await globalBuildKey(GLOBAL_BUILD_FORMAT, webRoot, await require_webPluginScan.scanWebPlugins(webRoot, pluginRoots, input.onNotice ?? (() => {})), input.files);
|
|
225
257
|
} catch (error) {
|
|
226
258
|
return {
|
|
227
259
|
status: "failed",
|
|
@@ -239,21 +271,21 @@ function resolveGlobalWebBuild(input) {
|
|
|
239
271
|
};
|
|
240
272
|
}
|
|
241
273
|
/** Whether the global build for these plugin roots exists, for a check that must not build. */
|
|
242
|
-
function readGlobalWebBuildStatus(input) {
|
|
243
|
-
const resolved = resolveGlobalWebBuild(input);
|
|
274
|
+
async function readGlobalWebBuildStatus(input) {
|
|
275
|
+
const resolved = await resolveGlobalWebBuild(input);
|
|
244
276
|
if (resolved.status !== "resolved") return resolved;
|
|
245
277
|
return {
|
|
246
|
-
status: readBuildRecord(resolved.directory) === void 0 ? "missing" : "current",
|
|
278
|
+
status: await readBuildRecord(resolved.directory, input.files) === void 0 ? "missing" : "current",
|
|
247
279
|
key: resolved.key
|
|
248
280
|
};
|
|
249
281
|
}
|
|
250
282
|
async function ensureGlobalWebBuild(input) {
|
|
251
283
|
const environment = input.environment ?? process.env;
|
|
252
284
|
const notice = input.onNotice ?? (() => {});
|
|
253
|
-
const resolved = resolveGlobalWebBuild(input);
|
|
285
|
+
const resolved = await resolveGlobalWebBuild(input);
|
|
254
286
|
if (resolved.status !== "resolved") return resolved;
|
|
255
287
|
const { webRoot, pluginRoots, key, buildsRoot, directory } = resolved;
|
|
256
|
-
const existing = readBuildRecord(directory);
|
|
288
|
+
const existing = await readBuildRecord(directory, input.files);
|
|
257
289
|
if (existing !== void 0) return {
|
|
258
290
|
status: "cached",
|
|
259
291
|
build: existing
|
|
@@ -274,7 +306,7 @@ async function ensureGlobalWebBuild(input) {
|
|
|
274
306
|
baseStyle: output.baseStyle
|
|
275
307
|
};
|
|
276
308
|
});
|
|
277
|
-
const build = readBuildRecord(directory);
|
|
309
|
+
const build = await readBuildRecord(directory, input.files);
|
|
278
310
|
if (build === void 0) throw new Error(`The web build '${key}' was not recorded.`);
|
|
279
311
|
return {
|
|
280
312
|
status: "built",
|
|
@@ -305,20 +337,20 @@ function mountWebPluginIds(build, packageRoots) {
|
|
|
305
337
|
}
|
|
306
338
|
/** The slots a mount runs: one copy per pluginId, the first in build order. */
|
|
307
339
|
function mountWebPluginSlots(build, packageRoots) {
|
|
308
|
-
return mountPluginCopies(build, packageRoots).map(
|
|
340
|
+
return mountPluginCopies(build, packageRoots).map((plugin) => plugin.slot);
|
|
309
341
|
}
|
|
310
342
|
/**
|
|
311
343
|
* The package roots among `packageRoots` that declare a web plugin the build has no slot for:
|
|
312
344
|
* a package that was not synced yet, or was left out of the build. Their names, else their roots.
|
|
313
345
|
*/
|
|
314
|
-
function unslottedWebPackages(build, packageRoots) {
|
|
346
|
+
async function unslottedWebPackages(build, packageRoots, files = (0, _agimon_ai_po_core_nodePlatform.createNodePlatform)().env(process.cwd())) {
|
|
315
347
|
const slotted = new Set(build.plugins.map((plugin) => node_path.default.resolve(plugin.packageDir)));
|
|
316
348
|
const missing = [];
|
|
317
349
|
for (const root of new Set(packageRoots.map((entry) => node_path.default.resolve(entry)))) {
|
|
318
350
|
if (slotted.has(root)) continue;
|
|
319
351
|
let manifest;
|
|
320
352
|
try {
|
|
321
|
-
manifest = JSON.parse(
|
|
353
|
+
manifest = JSON.parse((0, _agimon_ai_po_core_platform.getOrThrow)(await files.readTextFile(node_path.default.join(root, "package.json"), _agimon_ai_po_core_platform.BACKGROUND_CONTEXT)));
|
|
322
354
|
} catch {
|
|
323
355
|
continue;
|
|
324
356
|
}
|
|
@@ -333,7 +365,7 @@ function duplicatePluginCopies(build, packageRoots) {
|
|
|
333
365
|
const slotsById = /* @__PURE__ */ new Map();
|
|
334
366
|
for (const plugin of build.plugins) {
|
|
335
367
|
if (!plugin.isHost && !roots.has(node_path.default.resolve(plugin.packageDir))) continue;
|
|
336
|
-
const slot =
|
|
368
|
+
const slot = plugin.slot;
|
|
337
369
|
const slots = slotsById.get(plugin.pluginId) ?? [];
|
|
338
370
|
if (!slots.includes(slot)) slots.push(slot);
|
|
339
371
|
slotsById.set(plugin.pluginId, slots);
|
|
@@ -357,5 +389,6 @@ exports.readGlobalWebBuildStatus = readGlobalWebBuildStatus;
|
|
|
357
389
|
exports.singleFlightBuild = singleFlightBuild;
|
|
358
390
|
exports.unslottedWebPackages = unslottedWebPackages;
|
|
359
391
|
exports.webHostVersion = webHostVersion;
|
|
392
|
+
exports.webShellLocaleRoots = webShellLocaleRoots;
|
|
360
393
|
|
|
361
394
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["path","fs","createRequire","snapshotFiles","statSignature","crypto","compareCodeUnits","scanWebPlugins","pluginSlot"],"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,WAAuC;CACnE,IAAI,MAAMA,UAAAA,QAAK,QAAQ,SAAS;CAChC,SAAS;EACP,IAAIC,QAAAA,QAAG,WAAWD,UAAAA,QAAK,KAAK,KAAK,cAAc,CAAC,GAAG,OAAO;EAC1D,MAAM,SAASA,UAAAA,QAAK,QAAQ,GAAG;EAC/B,IAAI,WAAW,KAAK,OAAO,KAAA;EAC3B,MAAM;CACR;AACF;AAEA,SAAS,sBAAsB,UAAkB,aAAoD;CACnG,MAAM,WAAW,YAAY;CAC7B,IAAI,aAAa,KAAA,KAAa,aAAa,IAAI,OAAOA,UAAAA,QAAK,QAAQ,QAAQ;CAC3E,IAAI;EACF,OAAOA,UAAAA,QAAK,SAAA,GAAQE,YAAAA,cAAAA,CAAcF,UAAAA,QAAK,KAAK,UAAU,cAAc,C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":["createNodePlatform","path","pathExists","BACKGROUND_CONTEXT","createRequire","getOrThrow","require","snapshotFiles","statSignature","crypto","compareCodeUnits","fsp","scanWebPlugins"],"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,SAAA,GAAoBA,gCAAAA,mBAAAA,CAAmB,CAAC,CAAC,IAAI,QAAQ,IAAI,CAAC,GACvC;CACnB,MAAM,QAAQ,MAAM,QAAQ,IA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M,UAAU,MAAM,SAAS;EAClC,IAAI,CAAC,OAAO,UAAU,CAAC,MAAM,IAAIA,UAAAA,QAAK,QAAQ,OAAO,UAAU,CAAC,GAAG;EACnE,MAAM,OAAO,OAAO;EACpB,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,21 +1,24 @@
|
|
|
1
1
|
import { DeclaredWebPlugin } from "./webPluginManifest.mjs";
|
|
2
|
+
import { FileSystem } from "@agimon-ai/po-core/platform";
|
|
2
3
|
import { GlobalWebBuild, GlobalWebBuildPlugin } from "@agimon-ai/po-core/webCompositions";
|
|
3
4
|
//#region src/builders/web/index.d.ts
|
|
4
|
-
/** The package roots a set of compositions activates,
|
|
5
|
+
/** The package roots a set of compositions activates, without blocking a live host. */
|
|
5
6
|
export declare function compositionPackageRoots(compositions: readonly {
|
|
6
7
|
packageEntries: readonly string[];
|
|
7
|
-
}[]): string[]
|
|
8
|
-
|
|
9
|
-
export declare function packageRootOf(entryPath: string): string | undefined;
|
|
8
|
+
}[], files?: FileSystem): Promise<string[]>;
|
|
9
|
+
export declare function packageRootOf(entryPath: string, files?: FileSystem): Promise<string | undefined>;
|
|
10
10
|
/** The installed po-web host version the global web build would use, or `none` when it is not installed. */
|
|
11
|
-
export declare function webHostVersion(poHome: string, environment?: NodeJS.ProcessEnv): string
|
|
11
|
+
export declare function webHostVersion(poHome: string, environment?: NodeJS.ProcessEnv, files?: FileSystem): Promise<string>;
|
|
12
12
|
/** The record every keyed global build writes last, so a key directory holding it is complete. */
|
|
13
13
|
export declare const BUILD_RECORD = "build.json";
|
|
14
|
+
/** Catalog owners baked into the shell, independent of the active optional plugins. */
|
|
15
|
+
export declare function webShellLocaleRoots(poHome: string, environment: NodeJS.ProcessEnv, files: FileSystem): Promise<string[]>;
|
|
14
16
|
/** One build's record: the publishable build, whose plugins carry each copy's package and slot closure. */
|
|
15
17
|
export type GlobalWebBuildRecord = GlobalWebBuild;
|
|
16
18
|
export interface GlobalWebBuildInput {
|
|
17
19
|
/** Po's global home; builds land in `<home>/build/web/<key>/`. */
|
|
18
20
|
poHome: string;
|
|
21
|
+
files?: FileSystem;
|
|
19
22
|
/** The union of every scope's package roots; roots without a poWeb block are ignored. */
|
|
20
23
|
pluginRoots: readonly string[];
|
|
21
24
|
environment?: NodeJS.ProcessEnv;
|
|
@@ -51,16 +54,16 @@ export type GlobalWebBuildResult = {
|
|
|
51
54
|
* plugin package's file signature. A changed source or dist file or a changed plugin set
|
|
52
55
|
* yields a new key; roots that declare no plugin do not take part.
|
|
53
56
|
*/
|
|
54
|
-
export declare function globalBuildKey(format: string, hostRoot: string | undefined, plugins: readonly DeclaredWebPlugin[]): string
|
|
57
|
+
export declare function globalBuildKey(format: string, hostRoot: string | undefined, plugins: readonly DeclaredWebPlugin[], files?: FileSystem): Promise<string>;
|
|
55
58
|
/** A key directory's parsed build record, or undefined when the build is not there (yet). */
|
|
56
|
-
export declare function readBuildJson<T>(directory: string): T | undefined
|
|
59
|
+
export declare function readBuildJson<T>(directory: string, files?: FileSystem): Promise<T | undefined>;
|
|
57
60
|
/** The complete global web build of one key, or undefined when it is not there. Never builds. */
|
|
58
|
-
export declare function readGlobalWebBuildRecord(poHome: string, key: string): GlobalWebBuildRecord | undefined
|
|
61
|
+
export declare function readGlobalWebBuildRecord(poHome: string, key: string, files?: FileSystem): Promise<GlobalWebBuildRecord | undefined>;
|
|
59
62
|
/**
|
|
60
63
|
* The key of the most recently written complete global web build, for a server that starts
|
|
61
64
|
* before sync ever wrote a pointer. Temporary build folders start with a dot and are skipped.
|
|
62
65
|
*/
|
|
63
|
-
export declare function newestGlobalWebBuildKey(poHome: string): string | undefined
|
|
66
|
+
export declare function newestGlobalWebBuildKey(poHome: string, files?: FileSystem): Promise<string | undefined>;
|
|
64
67
|
/**
|
|
65
68
|
* Builds into a temporary sibling of `directory`, writes the build record last, and renames
|
|
66
69
|
* the result into place, so a key directory is always complete. Losing the rename to another
|
|
@@ -70,7 +73,7 @@ export declare function buildKeyDirectory(buildsRoot: string, key: string, direc
|
|
|
70
73
|
/** Joins a build of the same key that is already running in this process instead of starting another. */
|
|
71
74
|
export declare function singleFlightBuild<T>(key: string, run: () => Promise<T>): Promise<T>;
|
|
72
75
|
/** Whether the global build for these plugin roots exists, for a check that must not build. */
|
|
73
|
-
export declare function readGlobalWebBuildStatus(input: GlobalWebBuildInput): {
|
|
76
|
+
export declare function readGlobalWebBuildStatus(input: GlobalWebBuildInput): Promise<{
|
|
74
77
|
status: 'current' | 'missing';
|
|
75
78
|
key: string;
|
|
76
79
|
} | {
|
|
@@ -79,7 +82,7 @@ export declare function readGlobalWebBuildStatus(input: GlobalWebBuildInput): {
|
|
|
79
82
|
} | {
|
|
80
83
|
status: 'failed';
|
|
81
84
|
reason: string;
|
|
82
|
-
}
|
|
85
|
+
}>;
|
|
83
86
|
export declare function ensureGlobalWebBuild(input: GlobalWebBuildInput): Promise<GlobalWebBuildResult>;
|
|
84
87
|
type MountPluginRecord = {
|
|
85
88
|
pluginId: string;
|
|
@@ -92,7 +95,9 @@ export declare function mountWebPluginIds(build: {
|
|
|
92
95
|
}, packageRoots: readonly string[]): string[];
|
|
93
96
|
/** The slots a mount runs: one copy per pluginId, the first in build order. */
|
|
94
97
|
export declare function mountWebPluginSlots(build: {
|
|
95
|
-
plugins: readonly MountPluginRecord
|
|
98
|
+
plugins: readonly (MountPluginRecord & {
|
|
99
|
+
slot: string;
|
|
100
|
+
})[];
|
|
96
101
|
}, packageRoots: readonly string[]): string[];
|
|
97
102
|
/**
|
|
98
103
|
* The package roots among `packageRoots` that declare a web plugin the build has no slot for:
|
|
@@ -100,10 +105,12 @@ export declare function mountWebPluginSlots(build: {
|
|
|
100
105
|
*/
|
|
101
106
|
export declare function unslottedWebPackages(build: {
|
|
102
107
|
plugins: readonly MountPluginRecord[];
|
|
103
|
-
}, packageRoots: readonly string[]): string[]
|
|
108
|
+
}, packageRoots: readonly string[], files?: FileSystem): Promise<string[]>;
|
|
104
109
|
/** The pluginIds with more than one installed copy among the host and these roots, each with its slots in build order. */
|
|
105
110
|
export declare function duplicatePluginCopies(build: {
|
|
106
|
-
plugins: readonly MountPluginRecord
|
|
111
|
+
plugins: readonly (MountPluginRecord & {
|
|
112
|
+
slot: string;
|
|
113
|
+
})[];
|
|
107
114
|
}, packageRoots: readonly string[]): Map<string, string[]>;
|
|
108
115
|
//#endregion
|
|
109
116
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../../src/builders/web/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../../src/builders/web/index.ts"],"mappings":";;;;;wBAkBsB,wBACpB;EAAyB;KACzB,QAAO,aACN;wBAOmB,cACpB,mBACA,QAAO,aACN;;wBAyBmB,eACpB,gBACA,cAAa,OAAO,YACpB,QAAO,aACN;;qBAgBU;;wBAUS,oBACpB,gBACA,aAAa,OAAO,YACpB,OAAO,aACN;;YAoCS,uBAAuB;iBAElB;;EAEf;EACA,QAAQ;;EAER;EACA,cAAc,OAAO;EACrB,YAAY;;EAEZ,YAAY;IAAW;IAAkB;IAAuB;QAAqB,QAAQ;;EAE7F,kBAAkB,kBAAkB,aAAa,OAAO;;UAGhD;EACR;EACA;EACA,SAAS;EACT,cAAc;EACd;;YAGU;EACN;EAA4B,OAAO;;EACnC;EAAmB;;EACnB;EAAkB;;;;;;;wBAuBF,eACpB,gBACA,8BACA,kBAAkB,qBAClB,QAAO,aACN;;wBAiEmB,cAAc,GAClC,mBACA,QAAO,aACN,QAAQ;;wBA2BW,yBACpB,gBACA,aACA,QAAQ,aACP,QAAQ;;;;;wBAQW,wBACpB,gBACA,QAAO,aACN;;;;;;wBAqBmB,kBACpB,oBACA,aACA,mBACA,QAAQ,sBAAsB,kBAC7B;;wBAmBmB,kBAAkB,GAAG,aAAa,WAAW,QAAQ,KAAK,QAAQ;;wBAsDlE,yBACpB,OAAO,sBACN;EACG;EAA+B;;EAC/B;EAAmB;;EACnB;EAAkB;;wBAUF,qBAAqB,OAAO,sBAAsB,QAAQ;KA6B3E;EAAsB;EAAkB;EAAoB;;;wBAkBjD,kBACd;EAAS,kBAAkB;GAC3B;;wBAMc,oBACd;EAAS,mBAAmB;IAAsB;;GAClD;;;;;wBASoB,qBACpB;EAAS,kBAAkB;GAC3B,iCACA,QAAO,aACN;;wBAqBa,sBACd;EAAS,mBAAmB;IAAsB;;GAClD,kCACC"}
|