@agimon-ai/po 0.0.0-alpha.0
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 +21 -0
- package/README.md +755 -0
- package/assets/banner.png +0 -0
- package/assets/banner.svg +25 -0
- package/assets/favicon.svg +15 -0
- package/assets/logo-light.png +0 -0
- package/assets/logo-light.svg +25 -0
- package/assets/logo.png +0 -0
- package/assets/logo.svg +25 -0
- package/assets/mascot.png +0 -0
- package/assets/mascot.svg +25 -0
- package/dist/_virtual/_rolldown/runtime.cjs +23 -0
- package/dist/antigravity.cjs +5 -0
- package/dist/antigravity.d.mts +2 -0
- package/dist/antigravity.mjs +2 -0
- package/dist/apiContracts.cjs +11 -0
- package/dist/apiContracts.cjs.map +1 -0
- package/dist/apiContracts.d.mts +52 -0
- package/dist/apiContracts.d.mts.map +1 -0
- package/dist/apiContracts.mjs +7 -0
- package/dist/apiContracts.mjs.map +1 -0
- package/dist/baseCommand.cjs +3 -0
- package/dist/baseCommand.d.mts +2 -0
- package/dist/baseCommand.mjs +2 -0
- package/dist/bin/cli.cjs +24 -0
- package/dist/bin/cli.cjs.map +1 -0
- package/dist/bin/cli.d.mts +1 -0
- package/dist/bin/cli.mjs +25 -0
- package/dist/bin/cli.mjs.map +1 -0
- package/dist/bin/doomRunner.cjs +33 -0
- package/dist/bin/doomRunner.cjs.map +1 -0
- package/dist/bin/doomRunner.d.mts +4 -0
- package/dist/bin/doomRunner.d.mts.map +1 -0
- package/dist/bin/doomRunner.mjs +32 -0
- package/dist/bin/doomRunner.mjs.map +1 -0
- package/dist/bin/serve.cjs +30 -0
- package/dist/bin/serve.cjs.map +1 -0
- package/dist/bin/serve.d.mts +1 -0
- package/dist/bin/serve.mjs +31 -0
- package/dist/bin/serve.mjs.map +1 -0
- package/dist/builders/cli/extensionAssembler/index.cjs +342 -0
- package/dist/builders/cli/extensionAssembler/index.cjs.map +1 -0
- package/dist/builders/cli/extensionAssembler/index.d.mts +85 -0
- package/dist/builders/cli/extensionAssembler/index.d.mts.map +1 -0
- package/dist/builders/cli/extensionAssembler/index.mjs +335 -0
- package/dist/builders/cli/extensionAssembler/index.mjs.map +1 -0
- package/dist/catalog/index.json +430 -0
- package/dist/cli.cjs +28 -0
- package/dist/cli.d.mts +11 -0
- package/dist/cli.mjs +11 -0
- package/dist/cliApp.cjs +6 -0
- package/dist/cliApp.d.mts +2 -0
- package/dist/cliApp.mjs +2 -0
- package/dist/codex.cjs +8 -0
- package/dist/codex.d.mts +2 -0
- package/dist/codex.mjs +2 -0
- package/dist/commands.cjs +18 -0
- package/dist/commands.d.mts +9 -0
- package/dist/commands.mjs +9 -0
- package/dist/compatibility.cjs +27 -0
- package/dist/compatibility.d.mts +6 -0
- package/dist/compatibility.mjs +6 -0
- package/dist/compatibilityCommand.cjs +4 -0
- package/dist/compatibilityCommand.d.mts +2 -0
- package/dist/compatibilityCommand.mjs +2 -0
- package/dist/compatibilityContext.cjs +3 -0
- package/dist/compatibilityContext.d.mts +2 -0
- package/dist/compatibilityContext.mjs +2 -0
- package/dist/compatibilityOptions.cjs +5 -0
- package/dist/compatibilityOptions.d.mts +2 -0
- package/dist/compatibilityOptions.mjs +2 -0
- package/dist/config.cjs +163 -0
- package/dist/config.d.mts +7 -0
- package/dist/config.mjs +7 -0
- package/dist/doctorCommand.cjs +5 -0
- package/dist/doctorCommand.d.mts +2 -0
- package/dist/doctorCommand.mjs +2 -0
- package/dist/emitMcpCommand.cjs +4 -0
- package/dist/emitMcpCommand.d.mts +2 -0
- package/dist/emitMcpCommand.mjs +2 -0
- package/dist/explainCommand.cjs +5 -0
- package/dist/explainCommand.d.mts +2 -0
- package/dist/explainCommand.mjs +2 -0
- package/dist/extensions/server.cjs +39 -0
- package/dist/extensions/server.cjs.map +1 -0
- package/dist/extensions/server.d.mts +5 -0
- package/dist/extensions/server.d.mts.map +1 -0
- package/dist/extensions/server.mjs +34 -0
- package/dist/extensions/server.mjs.map +1 -0
- package/dist/harnessContext.cjs +5 -0
- package/dist/harnessContext.d.mts +2 -0
- package/dist/harnessContext.mjs +2 -0
- package/dist/harnessState.cjs +19 -0
- package/dist/harnessState.d.mts +2 -0
- package/dist/harnessState.mjs +2 -0
- package/dist/help.cjs +12 -0
- package/dist/help.d.mts +6 -0
- package/dist/help.mjs +6 -0
- package/dist/index.cjs +306 -0
- package/dist/index.d.mts +40 -0
- package/dist/index.mjs +37 -0
- package/dist/initCommand.cjs +4 -0
- package/dist/initCommand.d.mts +2 -0
- package/dist/initCommand.mjs +2 -0
- package/dist/matrixOptions.cjs +28 -0
- package/dist/matrixOptions.d.mts +2 -0
- package/dist/matrixOptions.mjs +2 -0
- package/dist/matrixSwitcher.cjs +11 -0
- package/dist/matrixSwitcher.d.mts +3 -0
- package/dist/matrixSwitcher.mjs +3 -0
- package/dist/mcpFilter.cjs +9 -0
- package/dist/mcpFilter.d.mts +1 -0
- package/dist/mcpFilter.mjs +2 -0
- package/dist/options.cjs +3 -0
- package/dist/options.d.mts +2 -0
- package/dist/options.mjs +2 -0
- package/dist/process.cjs +12 -0
- package/dist/process.d.mts +2 -0
- package/dist/process.mjs +2 -0
- package/dist/projectTrust.cjs +6 -0
- package/dist/projectTrust.d.mts +2 -0
- package/dist/projectTrust.mjs +2 -0
- package/dist/repository.cjs +5 -0
- package/dist/repository.d.mts +2 -0
- package/dist/repository.mjs +2 -0
- package/dist/resourceCollector.cjs +9 -0
- package/dist/resourceCollector.d.mts +1 -0
- package/dist/resourceCollector.mjs +2 -0
- package/dist/router.cjs +6 -0
- package/dist/router.d.mts +2 -0
- package/dist/router.mjs +2 -0
- package/dist/services.cjs +97 -0
- package/dist/services.d.mts +12 -0
- package/dist/services.mjs +12 -0
- package/dist/shared.cjs +18 -0
- package/dist/shared.d.mts +2 -0
- package/dist/shared.mjs +2 -0
- package/dist/src/bin/agentDirectory.cjs +27 -0
- package/dist/src/bin/agentDirectory.cjs.map +1 -0
- package/dist/src/bin/agentDirectory.mjs +26 -0
- package/dist/src/bin/agentDirectory.mjs.map +1 -0
- package/dist/src/builders/apiContractExport/index.cjs +126 -0
- package/dist/src/builders/apiContractExport/index.cjs.map +1 -0
- package/dist/src/builders/apiContractExport/index.mjs +123 -0
- package/dist/src/builders/apiContractExport/index.mjs.map +1 -0
- package/dist/src/builders/cli/entryResolution.cjs +39 -0
- package/dist/src/builders/cli/entryResolution.cjs.map +1 -0
- package/dist/src/builders/cli/entryResolution.mjs +35 -0
- package/dist/src/builders/cli/entryResolution.mjs.map +1 -0
- package/dist/src/builders/cli/harnessContext.cjs +175 -0
- package/dist/src/builders/cli/harnessContext.cjs.map +1 -0
- package/dist/src/builders/cli/harnessContext.d.mts +48 -0
- package/dist/src/builders/cli/harnessContext.d.mts.map +1 -0
- package/dist/src/builders/cli/harnessContext.mjs +167 -0
- package/dist/src/builders/cli/harnessContext.mjs.map +1 -0
- package/dist/src/builders/cli/sessionComposition.cjs +27 -0
- package/dist/src/builders/cli/sessionComposition.cjs.map +1 -0
- package/dist/src/builders/cli/sessionComposition.mjs +26 -0
- package/dist/src/builders/cli/sessionComposition.mjs.map +1 -0
- package/dist/src/builders/hooks/index.cjs +238 -0
- package/dist/src/builders/hooks/index.cjs.map +1 -0
- package/dist/src/builders/hooks/index.mjs +231 -0
- package/dist/src/builders/hooks/index.mjs.map +1 -0
- package/dist/src/builders/native/index.cjs +176 -0
- package/dist/src/builders/native/index.cjs.map +1 -0
- package/dist/src/builders/native/index.d.mts +36 -0
- package/dist/src/builders/native/index.d.mts.map +1 -0
- package/dist/src/builders/native/index.mjs +170 -0
- package/dist/src/builders/native/index.mjs.map +1 -0
- package/dist/src/builders/server/backgroundSync.cjs +333 -0
- package/dist/src/builders/server/backgroundSync.cjs.map +1 -0
- package/dist/src/builders/server/backgroundSync.mjs +320 -0
- package/dist/src/builders/server/backgroundSync.mjs.map +1 -0
- package/dist/src/builders/server/computerUseBinding.cjs +273 -0
- package/dist/src/builders/server/computerUseBinding.cjs.map +1 -0
- package/dist/src/builders/server/computerUseBinding.mjs +269 -0
- package/dist/src/builders/server/computerUseBinding.mjs.map +1 -0
- package/dist/src/builders/server/computerUseRecordings.cjs +188 -0
- package/dist/src/builders/server/computerUseRecordings.cjs.map +1 -0
- package/dist/src/builders/server/computerUseRecordings.mjs +184 -0
- package/dist/src/builders/server/computerUseRecordings.mjs.map +1 -0
- package/dist/src/builders/server/defaultWorkspace.cjs +38 -0
- package/dist/src/builders/server/defaultWorkspace.cjs.map +1 -0
- package/dist/src/builders/server/defaultWorkspace.mjs +35 -0
- package/dist/src/builders/server/defaultWorkspace.mjs.map +1 -0
- package/dist/src/builders/server/idleRestart.cjs +149 -0
- package/dist/src/builders/server/idleRestart.cjs.map +1 -0
- package/dist/src/builders/server/idleRestart.mjs +136 -0
- package/dist/src/builders/server/idleRestart.mjs.map +1 -0
- package/dist/src/builders/server/index.cjs +63 -0
- package/dist/src/builders/server/index.cjs.map +1 -0
- package/dist/src/builders/server/index.mjs +60 -0
- package/dist/src/builders/server/index.mjs.map +1 -0
- package/dist/src/builders/server/logSink.cjs +57 -0
- package/dist/src/builders/server/logSink.cjs.map +1 -0
- package/dist/src/builders/server/logSink.mjs +57 -0
- package/dist/src/builders/server/logSink.mjs.map +1 -0
- package/dist/src/builders/server/mcpApp.cjs +152 -0
- package/dist/src/builders/server/mcpApp.cjs.map +1 -0
- package/dist/src/builders/server/mcpApp.d.mts +18 -0
- package/dist/src/builders/server/mcpApp.d.mts.map +1 -0
- package/dist/src/builders/server/mcpApp.mjs +147 -0
- package/dist/src/builders/server/mcpApp.mjs.map +1 -0
- package/dist/src/builders/server/mcpAppBuild.cjs +111 -0
- package/dist/src/builders/server/mcpAppBuild.cjs.map +1 -0
- package/dist/src/builders/server/mcpAppBuild.d.mts +24 -0
- package/dist/src/builders/server/mcpAppBuild.d.mts.map +1 -0
- package/dist/src/builders/server/mcpAppBuild.mjs +105 -0
- package/dist/src/builders/server/mcpAppBuild.mjs.map +1 -0
- package/dist/src/builders/server/mcpBundle.cjs +87 -0
- package/dist/src/builders/server/mcpBundle.cjs.map +1 -0
- package/dist/src/builders/server/mcpBundle.d.mts +23 -0
- package/dist/src/builders/server/mcpBundle.d.mts.map +1 -0
- package/dist/src/builders/server/mcpBundle.mjs +84 -0
- package/dist/src/builders/server/mcpBundle.mjs.map +1 -0
- package/dist/src/builders/server/packageReloadCheck.cjs +62 -0
- package/dist/src/builders/server/packageReloadCheck.cjs.map +1 -0
- package/dist/src/builders/server/packageReloadCheck.mjs +61 -0
- package/dist/src/builders/server/packageReloadCheck.mjs.map +1 -0
- package/dist/src/builders/server/packageUrl.cjs +210 -0
- package/dist/src/builders/server/packageUrl.cjs.map +1 -0
- package/dist/src/builders/server/packageUrl.mjs +203 -0
- package/dist/src/builders/server/packageUrl.mjs.map +1 -0
- package/dist/src/builders/server/runtime.cjs +1428 -0
- package/dist/src/builders/server/runtime.cjs.map +1 -0
- package/dist/src/builders/server/runtime.mjs +1420 -0
- package/dist/src/builders/server/runtime.mjs.map +1 -0
- package/dist/src/builders/server/runtimeResources.cjs +72 -0
- package/dist/src/builders/server/runtimeResources.cjs.map +1 -0
- package/dist/src/builders/server/runtimeResources.mjs +71 -0
- package/dist/src/builders/server/runtimeResources.mjs.map +1 -0
- package/dist/src/builders/server/selectionStatus.cjs +12 -0
- package/dist/src/builders/server/selectionStatus.cjs.map +1 -0
- package/dist/src/builders/server/selectionStatus.mjs +12 -0
- package/dist/src/builders/server/selectionStatus.mjs.map +1 -0
- package/dist/src/builders/server/sessionArguments.cjs +63 -0
- package/dist/src/builders/server/sessionArguments.cjs.map +1 -0
- package/dist/src/builders/server/sessionArguments.mjs +62 -0
- package/dist/src/builders/server/sessionArguments.mjs.map +1 -0
- package/dist/src/builders/server/shutdown.cjs +16 -0
- package/dist/src/builders/server/shutdown.cjs.map +1 -0
- package/dist/src/builders/server/shutdown.mjs +16 -0
- package/dist/src/builders/server/shutdown.mjs.map +1 -0
- package/dist/src/builders/server/webTemplateDecision.cjs +34 -0
- package/dist/src/builders/server/webTemplateDecision.cjs.map +1 -0
- package/dist/src/builders/server/webTemplateDecision.mjs +32 -0
- package/dist/src/builders/server/webTemplateDecision.mjs.map +1 -0
- package/dist/src/builders/server/workspaceCheckout.cjs +31 -0
- package/dist/src/builders/server/workspaceCheckout.cjs.map +1 -0
- package/dist/src/builders/server/workspaceCheckout.mjs +29 -0
- package/dist/src/builders/server/workspaceCheckout.mjs.map +1 -0
- package/dist/src/builders/web/bundle.cjs +225 -0
- package/dist/src/builders/web/bundle.cjs.map +1 -0
- package/dist/src/builders/web/bundle.d.mts +65 -0
- package/dist/src/builders/web/bundle.d.mts.map +1 -0
- package/dist/src/builders/web/bundle.mjs +221 -0
- package/dist/src/builders/web/bundle.mjs.map +1 -0
- package/dist/src/builders/web/bundleAssetPolicy.cjs +96 -0
- package/dist/src/builders/web/bundleAssetPolicy.cjs.map +1 -0
- package/dist/src/builders/web/bundleAssetPolicy.d.mts +22 -0
- package/dist/src/builders/web/bundleAssetPolicy.d.mts.map +1 -0
- package/dist/src/builders/web/bundleAssetPolicy.mjs +95 -0
- package/dist/src/builders/web/bundleAssetPolicy.mjs.map +1 -0
- package/dist/src/builders/web/index.cjs +361 -0
- package/dist/src/builders/web/index.cjs.map +1 -0
- package/dist/src/builders/web/index.d.mts +109 -0
- package/dist/src/builders/web/index.d.mts.map +1 -0
- package/dist/src/builders/web/index.mjs +342 -0
- package/dist/src/builders/web/index.mjs.map +1 -0
- package/dist/src/builders/web/webDevRoots.cjs +27 -0
- package/dist/src/builders/web/webDevRoots.cjs.map +1 -0
- package/dist/src/builders/web/webDevRoots.d.mts +22 -0
- package/dist/src/builders/web/webDevRoots.d.mts.map +1 -0
- package/dist/src/builders/web/webDevRoots.mjs +25 -0
- package/dist/src/builders/web/webDevRoots.mjs.map +1 -0
- package/dist/src/builders/web/webPluginGenerate.cjs +188 -0
- package/dist/src/builders/web/webPluginGenerate.cjs.map +1 -0
- package/dist/src/builders/web/webPluginGenerate.d.mts +56 -0
- package/dist/src/builders/web/webPluginGenerate.d.mts.map +1 -0
- package/dist/src/builders/web/webPluginGenerate.mjs +178 -0
- package/dist/src/builders/web/webPluginGenerate.mjs.map +1 -0
- package/dist/src/builders/web/webPluginManifest.cjs +128 -0
- package/dist/src/builders/web/webPluginManifest.cjs.map +1 -0
- package/dist/src/builders/web/webPluginManifest.d.mts +64 -0
- package/dist/src/builders/web/webPluginManifest.d.mts.map +1 -0
- package/dist/src/builders/web/webPluginManifest.mjs +118 -0
- package/dist/src/builders/web/webPluginManifest.mjs.map +1 -0
- package/dist/src/builders/web/webPluginScan.cjs +57 -0
- package/dist/src/builders/web/webPluginScan.cjs.map +1 -0
- package/dist/src/builders/web/webPluginScan.d.mts +19 -0
- package/dist/src/builders/web/webPluginScan.d.mts.map +1 -0
- package/dist/src/builders/web/webPluginScan.mjs +54 -0
- package/dist/src/builders/web/webPluginScan.mjs.map +1 -0
- package/dist/src/builders/web/webPluginVite.cjs +255 -0
- package/dist/src/builders/web/webPluginVite.cjs.map +1 -0
- package/dist/src/builders/web/webPluginVite.d.mts +64 -0
- package/dist/src/builders/web/webPluginVite.d.mts.map +1 -0
- package/dist/src/builders/web/webPluginVite.mjs +242 -0
- package/dist/src/builders/web/webPluginVite.mjs.map +1 -0
- package/dist/src/cli/cliApp.cjs +187 -0
- package/dist/src/cli/cliApp.cjs.map +1 -0
- package/dist/src/cli/cliApp.d.mts +32 -0
- package/dist/src/cli/cliApp.d.mts.map +1 -0
- package/dist/src/cli/cliApp.mjs +184 -0
- package/dist/src/cli/cliApp.mjs.map +1 -0
- package/dist/src/cli/commands/api-export/index.cjs +66 -0
- package/dist/src/cli/commands/api-export/index.cjs.map +1 -0
- package/dist/src/cli/commands/api-export/index.mjs +62 -0
- package/dist/src/cli/commands/api-export/index.mjs.map +1 -0
- package/dist/src/cli/commands/baseCommand.cjs +16 -0
- package/dist/src/cli/commands/baseCommand.cjs.map +1 -0
- package/dist/src/cli/commands/baseCommand.d.mts +24 -0
- package/dist/src/cli/commands/baseCommand.d.mts.map +1 -0
- package/dist/src/cli/commands/baseCommand.mjs +16 -0
- package/dist/src/cli/commands/baseCommand.mjs.map +1 -0
- package/dist/src/cli/commands/compat/context.cjs +115 -0
- package/dist/src/cli/commands/compat/context.cjs.map +1 -0
- package/dist/src/cli/commands/compat/context.d.mts +22 -0
- package/dist/src/cli/commands/compat/context.d.mts.map +1 -0
- package/dist/src/cli/commands/compat/context.mjs +110 -0
- package/dist/src/cli/commands/compat/context.mjs.map +1 -0
- package/dist/src/cli/commands/compat/help.cjs +26 -0
- package/dist/src/cli/commands/compat/help.cjs.map +1 -0
- package/dist/src/cli/commands/compat/help.d.mts +4 -0
- package/dist/src/cli/commands/compat/help.d.mts.map +1 -0
- package/dist/src/cli/commands/compat/help.mjs +25 -0
- package/dist/src/cli/commands/compat/help.mjs.map +1 -0
- package/dist/src/cli/commands/compat/index.cjs +73 -0
- package/dist/src/cli/commands/compat/index.cjs.map +1 -0
- package/dist/src/cli/commands/compat/index.d.mts +14 -0
- package/dist/src/cli/commands/compat/index.d.mts.map +1 -0
- package/dist/src/cli/commands/compat/index.mjs +70 -0
- package/dist/src/cli/commands/compat/index.mjs.map +1 -0
- package/dist/src/cli/commands/compat/options.cjs +88 -0
- package/dist/src/cli/commands/compat/options.cjs.map +1 -0
- package/dist/src/cli/commands/compat/options.d.mts +15 -0
- package/dist/src/cli/commands/compat/options.d.mts.map +1 -0
- package/dist/src/cli/commands/compat/options.mjs +86 -0
- package/dist/src/cli/commands/compat/options.mjs.map +1 -0
- package/dist/src/cli/commands/compat/providers/antigravity.cjs +294 -0
- package/dist/src/cli/commands/compat/providers/antigravity.cjs.map +1 -0
- package/dist/src/cli/commands/compat/providers/antigravity.d.mts +9 -0
- package/dist/src/cli/commands/compat/providers/antigravity.d.mts.map +1 -0
- package/dist/src/cli/commands/compat/providers/antigravity.mjs +289 -0
- package/dist/src/cli/commands/compat/providers/antigravity.mjs.map +1 -0
- package/dist/src/cli/commands/compat/providers/codex.cjs +178 -0
- package/dist/src/cli/commands/compat/providers/codex.cjs.map +1 -0
- package/dist/src/cli/commands/compat/providers/codex.d.mts +17 -0
- package/dist/src/cli/commands/compat/providers/codex.d.mts.map +1 -0
- package/dist/src/cli/commands/compat/providers/codex.mjs +170 -0
- package/dist/src/cli/commands/compat/providers/codex.mjs.map +1 -0
- package/dist/src/cli/commands/compat/providers/index.cjs +65 -0
- package/dist/src/cli/commands/compat/providers/index.cjs.map +1 -0
- package/dist/src/cli/commands/compat/providers/index.d.mts +15 -0
- package/dist/src/cli/commands/compat/providers/index.d.mts.map +1 -0
- package/dist/src/cli/commands/compat/providers/index.mjs +45 -0
- package/dist/src/cli/commands/compat/providers/index.mjs.map +1 -0
- package/dist/src/cli/commands/compat/providers/process.cjs +172 -0
- package/dist/src/cli/commands/compat/providers/process.cjs.map +1 -0
- package/dist/src/cli/commands/compat/providers/process.d.mts +33 -0
- package/dist/src/cli/commands/compat/providers/process.d.mts.map +1 -0
- package/dist/src/cli/commands/compat/providers/process.mjs +159 -0
- package/dist/src/cli/commands/compat/providers/process.mjs.map +1 -0
- package/dist/src/cli/commands/compat/providers/shared.cjs +76 -0
- package/dist/src/cli/commands/compat/providers/shared.cjs.map +1 -0
- package/dist/src/cli/commands/compat/providers/shared.d.mts +40 -0
- package/dist/src/cli/commands/compat/providers/shared.d.mts.map +1 -0
- package/dist/src/cli/commands/compat/providers/shared.mjs +61 -0
- package/dist/src/cli/commands/compat/providers/shared.mjs.map +1 -0
- package/dist/src/cli/commands/compat/types.d.mts +31 -0
- package/dist/src/cli/commands/compat/types.d.mts.map +1 -0
- package/dist/src/cli/commands/doctor/help.cjs +19 -0
- package/dist/src/cli/commands/doctor/help.cjs.map +1 -0
- package/dist/src/cli/commands/doctor/help.d.mts +4 -0
- package/dist/src/cli/commands/doctor/help.d.mts.map +1 -0
- package/dist/src/cli/commands/doctor/help.mjs +19 -0
- package/dist/src/cli/commands/doctor/help.mjs.map +1 -0
- package/dist/src/cli/commands/doctor/index.cjs +118 -0
- package/dist/src/cli/commands/doctor/index.cjs.map +1 -0
- package/dist/src/cli/commands/doctor/index.d.mts +33 -0
- package/dist/src/cli/commands/doctor/index.d.mts.map +1 -0
- package/dist/src/cli/commands/doctor/index.mjs +113 -0
- package/dist/src/cli/commands/doctor/index.mjs.map +1 -0
- package/dist/src/cli/commands/emit-mcp/index.cjs +32 -0
- package/dist/src/cli/commands/emit-mcp/index.cjs.map +1 -0
- package/dist/src/cli/commands/emit-mcp/index.d.mts +19 -0
- package/dist/src/cli/commands/emit-mcp/index.d.mts.map +1 -0
- package/dist/src/cli/commands/emit-mcp/index.mjs +31 -0
- package/dist/src/cli/commands/emit-mcp/index.mjs.map +1 -0
- package/dist/src/cli/commands/explain/index.cjs +155 -0
- package/dist/src/cli/commands/explain/index.cjs.map +1 -0
- package/dist/src/cli/commands/explain/index.d.mts +57 -0
- package/dist/src/cli/commands/explain/index.d.mts.map +1 -0
- package/dist/src/cli/commands/explain/index.mjs +150 -0
- package/dist/src/cli/commands/explain/index.mjs.map +1 -0
- package/dist/src/cli/commands/init/constants.cjs +11 -0
- package/dist/src/cli/commands/init/constants.cjs.map +1 -0
- package/dist/src/cli/commands/init/constants.mjs +11 -0
- package/dist/src/cli/commands/init/constants.mjs.map +1 -0
- package/dist/src/cli/commands/init/help.cjs +17 -0
- package/dist/src/cli/commands/init/help.cjs.map +1 -0
- package/dist/src/cli/commands/init/help.d.mts +4 -0
- package/dist/src/cli/commands/init/help.d.mts.map +1 -0
- package/dist/src/cli/commands/init/help.mjs +17 -0
- package/dist/src/cli/commands/init/help.mjs.map +1 -0
- package/dist/src/cli/commands/init/index.cjs +67 -0
- package/dist/src/cli/commands/init/index.cjs.map +1 -0
- package/dist/src/cli/commands/init/index.d.mts +12 -0
- package/dist/src/cli/commands/init/index.d.mts.map +1 -0
- package/dist/src/cli/commands/init/index.mjs +63 -0
- package/dist/src/cli/commands/init/index.mjs.map +1 -0
- package/dist/src/cli/commands/init/presenter.cjs +140 -0
- package/dist/src/cli/commands/init/presenter.cjs.map +1 -0
- package/dist/src/cli/commands/init/presenter.d.mts +8 -0
- package/dist/src/cli/commands/init/presenter.d.mts.map +1 -0
- package/dist/src/cli/commands/init/presenter.mjs +140 -0
- package/dist/src/cli/commands/init/presenter.mjs.map +1 -0
- package/dist/src/cli/commands/sync/help.cjs +34 -0
- package/dist/src/cli/commands/sync/help.cjs.map +1 -0
- package/dist/src/cli/commands/sync/help.d.mts +4 -0
- package/dist/src/cli/commands/sync/help.d.mts.map +1 -0
- package/dist/src/cli/commands/sync/help.mjs +34 -0
- package/dist/src/cli/commands/sync/help.mjs.map +1 -0
- package/dist/src/cli/commands/sync/index.cjs +215 -0
- package/dist/src/cli/commands/sync/index.cjs.map +1 -0
- package/dist/src/cli/commands/sync/index.d.mts +20 -0
- package/dist/src/cli/commands/sync/index.d.mts.map +1 -0
- package/dist/src/cli/commands/sync/index.mjs +206 -0
- package/dist/src/cli/commands/sync/index.mjs.map +1 -0
- package/dist/src/cli/commands/sync/presenter.cjs +58 -0
- package/dist/src/cli/commands/sync/presenter.cjs.map +1 -0
- package/dist/src/cli/commands/sync/presenter.d.mts +16 -0
- package/dist/src/cli/commands/sync/presenter.d.mts.map +1 -0
- package/dist/src/cli/commands/sync/presenter.mjs +57 -0
- package/dist/src/cli/commands/sync/presenter.mjs.map +1 -0
- package/dist/src/cli/commands/sync/workflow.cjs +16 -0
- package/dist/src/cli/commands/sync/workflow.cjs.map +1 -0
- package/dist/src/cli/commands/sync/workflow.mjs +16 -0
- package/dist/src/cli/commands/sync/workflow.mjs.map +1 -0
- package/dist/src/cli/commands/web/index.cjs +88 -0
- package/dist/src/cli/commands/web/index.cjs.map +1 -0
- package/dist/src/cli/commands/web/index.mjs +85 -0
- package/dist/src/cli/commands/web/index.mjs.map +1 -0
- package/dist/src/cli/harnessOptions.cjs +70 -0
- package/dist/src/cli/harnessOptions.cjs.map +1 -0
- package/dist/src/cli/harnessOptions.d.mts +26 -0
- package/dist/src/cli/harnessOptions.d.mts.map +1 -0
- package/dist/src/cli/harnessOptions.mjs +66 -0
- package/dist/src/cli/harnessOptions.mjs.map +1 -0
- package/dist/src/cli/help.cjs +82 -0
- package/dist/src/cli/help.cjs.map +1 -0
- package/dist/src/cli/help.d.mts +10 -0
- package/dist/src/cli/help.d.mts.map +1 -0
- package/dist/src/cli/help.mjs +78 -0
- package/dist/src/cli/help.mjs.map +1 -0
- package/dist/src/cli/matrixOptions.cjs +178 -0
- package/dist/src/cli/matrixOptions.cjs.map +1 -0
- package/dist/src/cli/matrixOptions.d.mts +90 -0
- package/dist/src/cli/matrixOptions.d.mts.map +1 -0
- package/dist/src/cli/matrixOptions.mjs +151 -0
- package/dist/src/cli/matrixOptions.mjs.map +1 -0
- package/dist/src/cli/options.cjs +281 -0
- package/dist/src/cli/options.cjs.map +1 -0
- package/dist/src/cli/options.d.mts +5 -0
- package/dist/src/cli/options.d.mts.map +1 -0
- package/dist/src/cli/options.mjs +279 -0
- package/dist/src/cli/options.mjs.map +1 -0
- package/dist/src/cli/router.cjs +57 -0
- package/dist/src/cli/router.cjs.map +1 -0
- package/dist/src/cli/router.d.mts +32 -0
- package/dist/src/cli/router.d.mts.map +1 -0
- package/dist/src/cli/router.mjs +54 -0
- package/dist/src/cli/router.mjs.map +1 -0
- package/dist/src/cli/server/options.cjs +71 -0
- package/dist/src/cli/server/options.cjs.map +1 -0
- package/dist/src/cli/server/options.mjs +70 -0
- package/dist/src/cli/server/options.mjs.map +1 -0
- package/dist/src/cli/server/processGuards.cjs +83 -0
- package/dist/src/cli/server/processGuards.cjs.map +1 -0
- package/dist/src/cli/server/processGuards.mjs +79 -0
- package/dist/src/cli/server/processGuards.mjs.map +1 -0
- package/dist/src/cli/server/run.cjs +69 -0
- package/dist/src/cli/server/run.cjs.map +1 -0
- package/dist/src/cli/server/run.mjs +66 -0
- package/dist/src/cli/server/run.mjs.map +1 -0
- package/dist/src/composition/harnessState/index.cjs +48 -0
- package/dist/src/composition/harnessState/index.cjs.map +1 -0
- package/dist/src/composition/harnessState/index.d.mts +19 -0
- package/dist/src/composition/harnessState/index.d.mts.map +1 -0
- package/dist/src/composition/harnessState/index.mjs +34 -0
- package/dist/src/composition/harnessState/index.mjs.map +1 -0
- package/dist/src/composition/layerPackageInstaller/index.cjs +651 -0
- package/dist/src/composition/layerPackageInstaller/index.cjs.map +1 -0
- package/dist/src/composition/layerPackageInstaller/index.d.mts +74 -0
- package/dist/src/composition/layerPackageInstaller/index.d.mts.map +1 -0
- package/dist/src/composition/layerPackageInstaller/index.mjs +637 -0
- package/dist/src/composition/layerPackageInstaller/index.mjs.map +1 -0
- package/dist/src/composition/poHomeMigration/index.cjs +234 -0
- package/dist/src/composition/poHomeMigration/index.cjs.map +1 -0
- package/dist/src/composition/poHomeMigration/index.d.mts +12 -0
- package/dist/src/composition/poHomeMigration/index.d.mts.map +1 -0
- package/dist/src/composition/poHomeMigration/index.mjs +226 -0
- package/dist/src/composition/poHomeMigration/index.mjs.map +1 -0
- package/dist/src/composition/projectTrust/index.cjs +51 -0
- package/dist/src/composition/projectTrust/index.cjs.map +1 -0
- package/dist/src/composition/projectTrust/index.d.mts +22 -0
- package/dist/src/composition/projectTrust/index.d.mts.map +1 -0
- package/dist/src/composition/projectTrust/index.mjs +48 -0
- package/dist/src/composition/projectTrust/index.mjs.map +1 -0
- package/dist/src/composition/repository/index.cjs +68 -0
- package/dist/src/composition/repository/index.cjs.map +1 -0
- package/dist/src/composition/repository/index.d.mts +22 -0
- package/dist/src/composition/repository/index.d.mts.map +1 -0
- package/dist/src/composition/repository/index.mjs +63 -0
- package/dist/src/composition/repository/index.mjs.map +1 -0
- package/dist/src/composition/syncPrune/index.cjs +85 -0
- package/dist/src/composition/syncPrune/index.cjs.map +1 -0
- package/dist/src/composition/syncPrune/index.d.mts +33 -0
- package/dist/src/composition/syncPrune/index.d.mts.map +1 -0
- package/dist/src/composition/syncPrune/index.mjs +82 -0
- package/dist/src/composition/syncPrune/index.mjs.map +1 -0
- package/dist/src/composition/syncService/index.cjs +808 -0
- package/dist/src/composition/syncService/index.cjs.map +1 -0
- package/dist/src/composition/syncService/index.d.mts +65 -0
- package/dist/src/composition/syncService/index.d.mts.map +1 -0
- package/dist/src/composition/syncService/index.mjs +792 -0
- package/dist/src/composition/syncService/index.mjs.map +1 -0
- package/dist/src/composition/syncService/localBuilds.cjs +367 -0
- package/dist/src/composition/syncService/localBuilds.cjs.map +1 -0
- package/dist/src/composition/syncService/localBuilds.mjs +358 -0
- package/dist/src/composition/syncService/localBuilds.mjs.map +1 -0
- package/dist/src/composition/transitionLayers.cjs +17 -0
- package/dist/src/composition/transitionLayers.cjs.map +1 -0
- package/dist/src/composition/transitionLayers.d.mts +6 -0
- package/dist/src/composition/transitionLayers.d.mts.map +1 -0
- package/dist/src/composition/transitionLayers.mjs +16 -0
- package/dist/src/composition/transitionLayers.mjs.map +1 -0
- package/dist/src/composition/types/harness.d.mts +52 -0
- package/dist/src/composition/types/harness.d.mts.map +1 -0
- package/dist/src/extensions/setupDiagnostics.cjs +65 -0
- package/dist/src/extensions/setupDiagnostics.cjs.map +1 -0
- package/dist/src/extensions/setupDiagnostics.mjs +64 -0
- package/dist/src/extensions/setupDiagnostics.mjs.map +1 -0
- package/dist/utils.cjs +4 -0
- package/dist/utils.d.mts +2 -0
- package/dist/utils.mjs +2 -0
- package/dist/webBuilder.cjs +59 -0
- package/dist/webBuilder.d.mts +9 -0
- package/dist/webBuilder.mjs +9 -0
- package/docs/server/api-export.md +86 -0
- package/docs/server/api.md +144 -0
- package/docs/server/getting-started.md +114 -0
- package/docs/server/index.md +67 -0
- package/docs/server/ipc.md +97 -0
- package/docs/server/lifecycle.md +108 -0
- package/docs/server/security.md +101 -0
- package/llms.txt +12 -0
- package/package.json +295 -0
- package/src/prompts/po-author-extension/SKILL.md +35 -0
- package/src/prompts/po-author-extension/references/extension-contract.md +134 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
//#region src/builders/server/sessionArguments.ts
|
|
2
|
+
const SESSION_ID_OPTION = "--session-id";
|
|
3
|
+
const NAME_OPTION = "--name";
|
|
4
|
+
const PROFILE_OPTION = "--profile";
|
|
5
|
+
const DOMAINS_OPTION = "--domains";
|
|
6
|
+
const NO_DOMAINS_OPTION = "--no-domains";
|
|
7
|
+
const MODEL_OPTION = "--model";
|
|
8
|
+
const THINKING_OPTION = "--thinking";
|
|
9
|
+
const APPEND_SYSTEM_PROMPT_OPTION = "--append-system-prompt";
|
|
10
|
+
/** Settles the direct session identity from explicit arguments or caller defaults. */
|
|
11
|
+
function resolveSessionIdentity(agentArgs, fallback) {
|
|
12
|
+
const args = [...agentArgs];
|
|
13
|
+
const identity = { ...fallback };
|
|
14
|
+
for (const [option, key] of [[SESSION_ID_OPTION, "sessionId"], [NAME_OPTION, "sessionName"]]) {
|
|
15
|
+
const index = args.indexOf(option);
|
|
16
|
+
const value = index === -1 ? void 0 : args[index + 1];
|
|
17
|
+
if (value !== void 0 && !value.startsWith("-")) identity[key] = value;
|
|
18
|
+
else args.push(option, identity[key]);
|
|
19
|
+
}
|
|
20
|
+
if (!/^[a-zA-Z0-9_-]+$/u.test(identity.sessionId)) throw new Error("Invalid session id.");
|
|
21
|
+
return {
|
|
22
|
+
agentArgs: args,
|
|
23
|
+
identity
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
const MAJOR_MODE_OPTION = "--major-mode";
|
|
27
|
+
/**
|
|
28
|
+
* The harness arguments for a session a package created with explicit settings.
|
|
29
|
+
*
|
|
30
|
+
* Translating to flags keeps one validation path: the same parser that checks
|
|
31
|
+
* a `po --major-mode ... --model ...` launch checks these. Minor modes have
|
|
32
|
+
* no flag; the caller seeds them into the selection state directly.
|
|
33
|
+
*/
|
|
34
|
+
function sessionSelectionArgs(request) {
|
|
35
|
+
const { selection, model, thinking, appendSystemPrompt } = request;
|
|
36
|
+
const args = [];
|
|
37
|
+
const pinned = [];
|
|
38
|
+
if (selection?.majorMode !== void 0) {
|
|
39
|
+
args.push(MAJOR_MODE_OPTION, selection.majorMode);
|
|
40
|
+
pinned.push("majorMode");
|
|
41
|
+
}
|
|
42
|
+
if (selection?.profile !== void 0) {
|
|
43
|
+
args.push(PROFILE_OPTION, selection.profile);
|
|
44
|
+
pinned.push("profile");
|
|
45
|
+
}
|
|
46
|
+
if (selection?.domains !== void 0) {
|
|
47
|
+
if (selection.domains.length === 0) args.push(NO_DOMAINS_OPTION);
|
|
48
|
+
else args.push(DOMAINS_OPTION, selection.domains.join(","));
|
|
49
|
+
pinned.push("domains");
|
|
50
|
+
}
|
|
51
|
+
if (model !== void 0) args.push(MODEL_OPTION, model);
|
|
52
|
+
if (thinking !== void 0) args.push(THINKING_OPTION, thinking);
|
|
53
|
+
if (appendSystemPrompt !== void 0) args.push(APPEND_SYSTEM_PROMPT_OPTION, appendSystemPrompt);
|
|
54
|
+
return {
|
|
55
|
+
args,
|
|
56
|
+
pinned
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
//#endregion
|
|
60
|
+
export { resolveSessionIdentity, sessionSelectionArgs };
|
|
61
|
+
|
|
62
|
+
//# sourceMappingURL=sessionArguments.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sessionArguments.mjs","names":[],"sources":["../../../../src/builders/server/sessionArguments.ts"],"sourcesContent":["import type { DoomHubSessionCreateRequest } from '@agimon-ai/po-core/hubChannel';\n\nconst SESSION_ID_OPTION = '--session-id';\nconst NAME_OPTION = '--name';\nconst PROFILE_OPTION = '--profile';\nconst DOMAINS_OPTION = '--domains';\nconst NO_DOMAINS_OPTION = '--no-domains';\nconst MODEL_OPTION = '--model';\nconst THINKING_OPTION = '--thinking';\nconst APPEND_SYSTEM_PROMPT_OPTION = '--append-system-prompt';\nexport interface SessionIdentity {\n sessionId: string;\n sessionName: string;\n}\n\n/** Settles the direct session identity from explicit arguments or caller defaults. */\nexport function resolveSessionIdentity(\n agentArgs: readonly string[],\n fallback: SessionIdentity,\n): { agentArgs: string[]; identity: SessionIdentity } {\n const args = [...agentArgs];\n const identity = { ...fallback };\n for (const [option, key] of [\n [SESSION_ID_OPTION, 'sessionId'],\n [NAME_OPTION, 'sessionName'],\n ] as const) {\n const index = args.indexOf(option);\n const value = index === -1 ? undefined : args[index + 1];\n if (value !== undefined && !value.startsWith('-')) identity[key] = value;\n else args.push(option, identity[key]);\n }\n if (!/^[a-zA-Z0-9_-]+$/u.test(identity.sessionId)) throw new Error('Invalid session id.');\n return { agentArgs: args, identity };\n}\n\nconst MAJOR_MODE_OPTION = '--major-mode';\n\n/** Selection axes a request pins, which later inherited defaults must not replace. */\nexport type PinnedSelectionAxis = 'majorMode' | 'domains' | 'profile';\n\n/**\n * The harness arguments for a session a package created with explicit settings.\n *\n * Translating to flags keeps one validation path: the same parser that checks\n * a `po --major-mode ... --model ...` launch checks these. Minor modes have\n * no flag; the caller seeds them into the selection state directly.\n */\nexport function sessionSelectionArgs(\n request: Pick<DoomHubSessionCreateRequest, 'selection' | 'model' | 'thinking' | 'appendSystemPrompt'>,\n): {\n args: string[];\n pinned: PinnedSelectionAxis[];\n} {\n const { selection, model, thinking, appendSystemPrompt } = request;\n const args: string[] = [];\n const pinned: PinnedSelectionAxis[] = [];\n if (selection?.majorMode !== undefined) {\n args.push(MAJOR_MODE_OPTION, selection.majorMode);\n pinned.push('majorMode');\n }\n if (selection?.profile !== undefined) {\n args.push(PROFILE_OPTION, selection.profile);\n pinned.push('profile');\n }\n if (selection?.domains !== undefined) {\n if (selection.domains.length === 0) args.push(NO_DOMAINS_OPTION);\n else args.push(DOMAINS_OPTION, selection.domains.join(','));\n pinned.push('domains');\n }\n if (model !== undefined) args.push(MODEL_OPTION, model);\n if (thinking !== undefined) args.push(THINKING_OPTION, thinking);\n // Unknown to the harness parser, so it reaches Pi, which appends it to the system prompt.\n if (appendSystemPrompt !== undefined) args.push(APPEND_SYSTEM_PROMPT_OPTION, appendSystemPrompt);\n return { args, pinned };\n}\n\n/**\n * The agent arguments with the major mode pinned to a relaunch target.\n *\n * Any prior selection is dropped so repeated switches never accumulate flags.\n * The new pair goes last, the position launcher scripts already use, which\n * also keeps a leading script path intact when the agent runs via node.\n */\nexport function relaunchAgentArgs(args: readonly string[], majorMode: string): string[] {\n const kept: string[] = [];\n let skipValue = false;\n for (const argument of args) {\n if (skipValue) {\n skipValue = false;\n continue;\n }\n if (argument === MAJOR_MODE_OPTION) {\n skipValue = true;\n continue;\n }\n kept.push(argument);\n }\n return [...kept, MAJOR_MODE_OPTION, majorMode];\n}\n"],"mappings":";AAEA,MAAM,oBAAoB;AAC1B,MAAM,cAAc;AACpB,MAAM,iBAAiB;AACvB,MAAM,iBAAiB;AACvB,MAAM,oBAAoB;AAC1B,MAAM,eAAe;AACrB,MAAM,kBAAkB;AACxB,MAAM,8BAA8B;;AAOpC,SAAgB,uBACd,WACA,UACoD;CACpD,MAAM,OAAO,CAAC,GAAG,SAAS;CAC1B,MAAM,WAAW,EAAE,GAAG,SAAS;CAC/B,KAAK,MAAM,CAAC,QAAQ,QAAQ,CAC1B,CAAC,mBAAmB,WAAW,GAC/B,CAAC,aAAa,aAAa,CAC7B,GAAY;EACV,MAAM,QAAQ,KAAK,QAAQ,MAAM;EACjC,MAAM,QAAQ,UAAU,KAAK,KAAA,IAAY,KAAK,QAAQ;EACtD,IAAI,UAAU,KAAA,KAAa,CAAC,MAAM,WAAW,GAAG,GAAG,SAAS,OAAO;OAC9D,KAAK,KAAK,QAAQ,SAAS,IAAI;CACtC;CACA,IAAI,CAAC,oBAAoB,KAAK,SAAS,SAAS,GAAG,MAAM,IAAI,MAAM,qBAAqB;CACxF,OAAO;EAAE,WAAW;EAAM;CAAS;AACrC;AAEA,MAAM,oBAAoB;;;;;;;;AAY1B,SAAgB,qBACd,SAIA;CACA,MAAM,EAAE,WAAW,OAAO,UAAU,uBAAuB;CAC3D,MAAM,OAAiB,CAAC;CACxB,MAAM,SAAgC,CAAC;CACvC,IAAI,WAAW,cAAc,KAAA,GAAW;EACtC,KAAK,KAAK,mBAAmB,UAAU,SAAS;EAChD,OAAO,KAAK,WAAW;CACzB;CACA,IAAI,WAAW,YAAY,KAAA,GAAW;EACpC,KAAK,KAAK,gBAAgB,UAAU,OAAO;EAC3C,OAAO,KAAK,SAAS;CACvB;CACA,IAAI,WAAW,YAAY,KAAA,GAAW;EACpC,IAAI,UAAU,QAAQ,WAAW,GAAG,KAAK,KAAK,iBAAiB;OAC1D,KAAK,KAAK,gBAAgB,UAAU,QAAQ,KAAK,GAAG,CAAC;EAC1D,OAAO,KAAK,SAAS;CACvB;CACA,IAAI,UAAU,KAAA,GAAW,KAAK,KAAK,cAAc,KAAK;CACtD,IAAI,aAAa,KAAA,GAAW,KAAK,KAAK,iBAAiB,QAAQ;CAE/D,IAAI,uBAAuB,KAAA,GAAW,KAAK,KAAK,6BAA6B,kBAAkB;CAC/F,OAAO;EAAE;EAAM;CAAO;AACxB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/builders/server/shutdown.ts
|
|
2
|
+
/** Bound one cleanup phase without hiding its failure or preventing later phases. */
|
|
3
|
+
async function withShutdownDeadline(operation, label, timeoutMs = 2e3) {
|
|
4
|
+
let timer;
|
|
5
|
+
try {
|
|
6
|
+
await Promise.race([Promise.resolve().then(operation), new Promise((_resolve, reject) => {
|
|
7
|
+
timer = setTimeout(() => reject(/* @__PURE__ */ new Error(`${label} exceeded ${timeoutMs}ms`)), timeoutMs);
|
|
8
|
+
})]);
|
|
9
|
+
} finally {
|
|
10
|
+
if (timer !== void 0) clearTimeout(timer);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
exports.withShutdownDeadline = withShutdownDeadline;
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=shutdown.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shutdown.cjs","names":[],"sources":["../../../../src/builders/server/shutdown.ts"],"sourcesContent":["/** Bound one cleanup phase without hiding its failure or preventing later phases. */\nexport async function withShutdownDeadline(operation: () => unknown, label: string, timeoutMs = 2_000): Promise<void> {\n let timer: ReturnType<typeof setTimeout> | undefined;\n try {\n await Promise.race([\n Promise.resolve().then(operation),\n new Promise<never>((_resolve, reject) => {\n timer = setTimeout(() => reject(new Error(`${label} exceeded ${timeoutMs}ms`)), timeoutMs);\n }),\n ]);\n } finally {\n if (timer !== undefined) clearTimeout(timer);\n }\n}\n"],"mappings":";;AACA,eAAsB,qBAAqB,WAA0B,OAAe,YAAY,KAAsB;CACpH,IAAI;CACJ,IAAI;EACF,MAAM,QAAQ,KAAK,CACjB,QAAQ,QAAQ,CAAC,CAAC,KAAK,SAAS,GAChC,IAAI,SAAgB,UAAU,WAAW;GACvC,QAAQ,iBAAiB,uBAAO,IAAI,MAAM,GAAG,MAAM,YAAY,UAAU,GAAG,CAAC,GAAG,SAAS;EAC3F,CAAC,CACH,CAAC;CACH,UAAU;EACR,IAAI,UAAU,KAAA,GAAW,aAAa,KAAK;CAC7C;AACF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/builders/server/shutdown.ts
|
|
2
|
+
/** Bound one cleanup phase without hiding its failure or preventing later phases. */
|
|
3
|
+
async function withShutdownDeadline(operation, label, timeoutMs = 2e3) {
|
|
4
|
+
let timer;
|
|
5
|
+
try {
|
|
6
|
+
await Promise.race([Promise.resolve().then(operation), new Promise((_resolve, reject) => {
|
|
7
|
+
timer = setTimeout(() => reject(/* @__PURE__ */ new Error(`${label} exceeded ${timeoutMs}ms`)), timeoutMs);
|
|
8
|
+
})]);
|
|
9
|
+
} finally {
|
|
10
|
+
if (timer !== void 0) clearTimeout(timer);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { withShutdownDeadline };
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=shutdown.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shutdown.mjs","names":[],"sources":["../../../../src/builders/server/shutdown.ts"],"sourcesContent":["/** Bound one cleanup phase without hiding its failure or preventing later phases. */\nexport async function withShutdownDeadline(operation: () => unknown, label: string, timeoutMs = 2_000): Promise<void> {\n let timer: ReturnType<typeof setTimeout> | undefined;\n try {\n await Promise.race([\n Promise.resolve().then(operation),\n new Promise<never>((_resolve, reject) => {\n timer = setTimeout(() => reject(new Error(`${label} exceeded ${timeoutMs}ms`)), timeoutMs);\n }),\n ]);\n } finally {\n if (timer !== undefined) clearTimeout(timer);\n }\n}\n"],"mappings":";;AACA,eAAsB,qBAAqB,WAA0B,OAAe,YAAY,KAAsB;CACpH,IAAI;CACJ,IAAI;EACF,MAAM,QAAQ,KAAK,CACjB,QAAQ,QAAQ,CAAC,CAAC,KAAK,SAAS,GAChC,IAAI,SAAgB,UAAU,WAAW;GACvC,QAAQ,iBAAiB,uBAAO,IAAI,MAAM,GAAG,MAAM,YAAY,UAAU,GAAG,CAAC,GAAG,SAAS;EAC3F,CAAC,CACH,CAAC;CACH,UAAU;EACR,IAAI,UAAU,KAAA,GAAW,aAAa,KAAK;CAC7C;AACF"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const require_runtime = require("../../../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
let node_path = require("node:path");
|
|
3
|
+
node_path = require_runtime.__toESM(node_path, 1);
|
|
4
|
+
let _agimon_ai_po_config_config = require("@agimon-ai/po-config/config");
|
|
5
|
+
//#region src/builders/server/webTemplateDecision.ts
|
|
6
|
+
/**
|
|
7
|
+
* Resolve presentation from the server launch, never the selected session or workspace.
|
|
8
|
+
* `host` picks the config key: `web.template` for the cockpit, `native.template` for the phone app.
|
|
9
|
+
*/
|
|
10
|
+
function resolveWebTemplateDecision(options) {
|
|
11
|
+
const host = options.host ?? "web";
|
|
12
|
+
const workspace = options.workspaces.find((candidate) => candidate.id === options.launchWorkspaceId) ?? options.workspaces.filter((candidate) => {
|
|
13
|
+
const relative = node_path.default.relative(candidate.root, options.cwd);
|
|
14
|
+
return relative !== ".." && !relative.startsWith(`..${node_path.default.sep}`) && !node_path.default.isAbsolute(relative);
|
|
15
|
+
}).sort((left, right) => right.root.length - left.root.length)[0];
|
|
16
|
+
const mount = workspace === void 0 ? { scope: "global" } : {
|
|
17
|
+
scope: "workspace",
|
|
18
|
+
workspaceId: workspace.id
|
|
19
|
+
};
|
|
20
|
+
try {
|
|
21
|
+
const id = (0, _agimon_ai_po_config_config.loadDoomConfigLayers)(workspace?.root, options.homeDirectory, options.environment).valueAt([host, "template"]);
|
|
22
|
+
return {
|
|
23
|
+
...typeof id === "string" ? { id } : {},
|
|
24
|
+
mount
|
|
25
|
+
};
|
|
26
|
+
} catch (error) {
|
|
27
|
+
options.notice(`${host === "web" ? "Web" : "Native"} template configuration unavailable: ${error instanceof Error ? error.message : String(error)}`);
|
|
28
|
+
return { mount };
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
exports.resolveWebTemplateDecision = resolveWebTemplateDecision;
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=webTemplateDecision.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webTemplateDecision.cjs","names":["path","loadDoomConfigLayers"],"sources":["../../../../src/builders/server/webTemplateDecision.ts"],"sourcesContent":["import path from 'node:path';\n\nimport { loadDoomConfigLayers } from '@agimon-ai/po-config/config';\n\ninterface WebTemplateDecision {\n id?: string;\n mount: { scope: 'global' } | { scope: 'workspace'; workspaceId: string };\n}\n\n/**\n * Resolve presentation from the server launch, never the selected session or workspace.\n * `host` picks the config key: `web.template` for the cockpit, `native.template` for the phone app.\n */\nexport function resolveWebTemplateDecision(options: {\n cwd: string;\n launchWorkspaceId?: string;\n workspaces: readonly { id: string; root: string }[];\n homeDirectory: string;\n environment: NodeJS.ProcessEnv;\n notice: (message: string) => void;\n host?: 'web' | 'native';\n}): WebTemplateDecision {\n const host = options.host ?? 'web';\n // ponytail: without initial admission, a member checkout outside its canonical workspace\n // root falls back to global config. Resolving it must not admit or sync a new workspace.\n const workspace =\n options.workspaces.find((candidate) => candidate.id === options.launchWorkspaceId) ??\n options.workspaces\n .filter((candidate) => {\n const relative = path.relative(candidate.root, options.cwd);\n return relative !== '..' && !relative.startsWith(`..${path.sep}`) && !path.isAbsolute(relative);\n })\n .sort((left, right) => right.root.length - left.root.length)[0];\n const mount: WebTemplateDecision['mount'] =\n workspace === undefined ? { scope: 'global' } : { scope: 'workspace', workspaceId: workspace.id };\n try {\n const id = loadDoomConfigLayers(workspace?.root, options.homeDirectory, options.environment).valueAt([\n host,\n 'template',\n ]);\n return { ...(typeof id === 'string' ? { id } : {}), mount };\n } catch (error) {\n options.notice(\n `${host === 'web' ? 'Web' : 'Native'} template configuration unavailable: ${error instanceof Error ? error.message : String(error)}`,\n );\n return { mount };\n }\n}\n"],"mappings":";;;;;;;;;AAaA,SAAgB,2BAA2B,SAQnB;CACtB,MAAM,OAAO,QAAQ,QAAQ;CAG7B,MAAM,YACJ,QAAQ,WAAW,MAAM,cAAc,UAAU,OAAO,QAAQ,iBAAiB,KACjF,QAAQ,WACL,QAAQ,cAAc;EACrB,MAAM,WAAWA,UAAAA,QAAK,SAAS,UAAU,MAAM,QAAQ,GAAG;EAC1D,OAAO,aAAa,QAAQ,CAAC,SAAS,WAAW,KAAKA,UAAAA,QAAK,KAAK,KAAK,CAACA,UAAAA,QAAK,WAAW,QAAQ;CAChG,CAAC,CAAC,CACD,MAAM,MAAM,UAAU,MAAM,KAAK,SAAS,KAAK,KAAK,MAAM,CAAC,CAAC;CACjE,MAAM,QACJ,cAAc,KAAA,IAAY,EAAE,OAAO,SAAS,IAAI;EAAE,OAAO;EAAa,aAAa,UAAU;CAAG;CAClG,IAAI;EACF,MAAM,MAAA,GAAKC,4BAAAA,qBAAAA,CAAqB,WAAW,MAAM,QAAQ,eAAe,QAAQ,WAAW,CAAC,CAAC,QAAQ,CACnG,MACA,UACF,CAAC;EACD,OAAO;GAAE,GAAI,OAAO,OAAO,WAAW,EAAE,GAAG,IAAI,CAAC;GAAI;EAAM;CAC5D,SAAS,OAAO;EACd,QAAQ,OACN,GAAG,SAAS,QAAQ,QAAQ,SAAS,uCAAuC,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,GACnI;EACA,OAAO,EAAE,MAAM;CACjB;AACF"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { loadDoomConfigLayers } from "@agimon-ai/po-config/config";
|
|
3
|
+
//#region src/builders/server/webTemplateDecision.ts
|
|
4
|
+
/**
|
|
5
|
+
* Resolve presentation from the server launch, never the selected session or workspace.
|
|
6
|
+
* `host` picks the config key: `web.template` for the cockpit, `native.template` for the phone app.
|
|
7
|
+
*/
|
|
8
|
+
function resolveWebTemplateDecision(options) {
|
|
9
|
+
const host = options.host ?? "web";
|
|
10
|
+
const workspace = options.workspaces.find((candidate) => candidate.id === options.launchWorkspaceId) ?? options.workspaces.filter((candidate) => {
|
|
11
|
+
const relative = path.relative(candidate.root, options.cwd);
|
|
12
|
+
return relative !== ".." && !relative.startsWith(`..${path.sep}`) && !path.isAbsolute(relative);
|
|
13
|
+
}).sort((left, right) => right.root.length - left.root.length)[0];
|
|
14
|
+
const mount = workspace === void 0 ? { scope: "global" } : {
|
|
15
|
+
scope: "workspace",
|
|
16
|
+
workspaceId: workspace.id
|
|
17
|
+
};
|
|
18
|
+
try {
|
|
19
|
+
const id = loadDoomConfigLayers(workspace?.root, options.homeDirectory, options.environment).valueAt([host, "template"]);
|
|
20
|
+
return {
|
|
21
|
+
...typeof id === "string" ? { id } : {},
|
|
22
|
+
mount
|
|
23
|
+
};
|
|
24
|
+
} catch (error) {
|
|
25
|
+
options.notice(`${host === "web" ? "Web" : "Native"} template configuration unavailable: ${error instanceof Error ? error.message : String(error)}`);
|
|
26
|
+
return { mount };
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { resolveWebTemplateDecision };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=webTemplateDecision.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webTemplateDecision.mjs","names":[],"sources":["../../../../src/builders/server/webTemplateDecision.ts"],"sourcesContent":["import path from 'node:path';\n\nimport { loadDoomConfigLayers } from '@agimon-ai/po-config/config';\n\ninterface WebTemplateDecision {\n id?: string;\n mount: { scope: 'global' } | { scope: 'workspace'; workspaceId: string };\n}\n\n/**\n * Resolve presentation from the server launch, never the selected session or workspace.\n * `host` picks the config key: `web.template` for the cockpit, `native.template` for the phone app.\n */\nexport function resolveWebTemplateDecision(options: {\n cwd: string;\n launchWorkspaceId?: string;\n workspaces: readonly { id: string; root: string }[];\n homeDirectory: string;\n environment: NodeJS.ProcessEnv;\n notice: (message: string) => void;\n host?: 'web' | 'native';\n}): WebTemplateDecision {\n const host = options.host ?? 'web';\n // ponytail: without initial admission, a member checkout outside its canonical workspace\n // root falls back to global config. Resolving it must not admit or sync a new workspace.\n const workspace =\n options.workspaces.find((candidate) => candidate.id === options.launchWorkspaceId) ??\n options.workspaces\n .filter((candidate) => {\n const relative = path.relative(candidate.root, options.cwd);\n return relative !== '..' && !relative.startsWith(`..${path.sep}`) && !path.isAbsolute(relative);\n })\n .sort((left, right) => right.root.length - left.root.length)[0];\n const mount: WebTemplateDecision['mount'] =\n workspace === undefined ? { scope: 'global' } : { scope: 'workspace', workspaceId: workspace.id };\n try {\n const id = loadDoomConfigLayers(workspace?.root, options.homeDirectory, options.environment).valueAt([\n host,\n 'template',\n ]);\n return { ...(typeof id === 'string' ? { id } : {}), mount };\n } catch (error) {\n options.notice(\n `${host === 'web' ? 'Web' : 'Native'} template configuration unavailable: ${error instanceof Error ? error.message : String(error)}`,\n );\n return { mount };\n }\n}\n"],"mappings":";;;;;;;AAaA,SAAgB,2BAA2B,SAQnB;CACtB,MAAM,OAAO,QAAQ,QAAQ;CAG7B,MAAM,YACJ,QAAQ,WAAW,MAAM,cAAc,UAAU,OAAO,QAAQ,iBAAiB,KACjF,QAAQ,WACL,QAAQ,cAAc;EACrB,MAAM,WAAW,KAAK,SAAS,UAAU,MAAM,QAAQ,GAAG;EAC1D,OAAO,aAAa,QAAQ,CAAC,SAAS,WAAW,KAAK,KAAK,KAAK,KAAK,CAAC,KAAK,WAAW,QAAQ;CAChG,CAAC,CAAC,CACD,MAAM,MAAM,UAAU,MAAM,KAAK,SAAS,KAAK,KAAK,MAAM,CAAC,CAAC;CACjE,MAAM,QACJ,cAAc,KAAA,IAAY,EAAE,OAAO,SAAS,IAAI;EAAE,OAAO;EAAa,aAAa,UAAU;CAAG;CAClG,IAAI;EACF,MAAM,KAAK,qBAAqB,WAAW,MAAM,QAAQ,eAAe,QAAQ,WAAW,CAAC,CAAC,QAAQ,CACnG,MACA,UACF,CAAC;EACD,OAAO;GAAE,GAAI,OAAO,OAAO,WAAW,EAAE,GAAG,IAAI,CAAC;GAAI;EAAM;CAC5D,SAAS,OAAO;EACd,QAAQ,OACN,GAAG,SAAS,QAAQ,QAAQ,SAAS,uCAAuC,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,GACnI;EACA,OAAO,EAAE,MAAM;CACjB;AACF"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const require_runtime = require("../../../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
const require_index = require("../../composition/repository/index.cjs");
|
|
3
|
+
let node_fs = require("node:fs");
|
|
4
|
+
node_fs = require_runtime.__toESM(node_fs, 1);
|
|
5
|
+
let _agimon_ai_po_core_history = require("@agimon-ai/po-core/history");
|
|
6
|
+
//#region src/builders/server/workspaceCheckout.ts
|
|
7
|
+
/**
|
|
8
|
+
* The recorded workspace a directory's checkout belongs to: its root, a
|
|
9
|
+
* subdirectory, or a worktree whose git data names it. Undefined for a
|
|
10
|
+
* directory that is not a checkout of any recorded workspace, or whose
|
|
11
|
+
* workspace root has gone, so a caller never admits a new workspace by accident.
|
|
12
|
+
*/
|
|
13
|
+
function checkoutWorkspaceId(records, cwd) {
|
|
14
|
+
let checkoutRoot;
|
|
15
|
+
try {
|
|
16
|
+
checkoutRoot = node_fs.default.realpathSync(require_index.findRepositoryRoot(cwd));
|
|
17
|
+
} catch {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const identity = (0, _agimon_ai_po_core_history.identifyWorkspace)({
|
|
21
|
+
records,
|
|
22
|
+
checkoutRoot,
|
|
23
|
+
marker: (0, _agimon_ai_po_core_history.readWorkspaceMarker)(checkoutRoot)
|
|
24
|
+
});
|
|
25
|
+
if (identity.moved || !records.some((record) => record.id === identity.id)) return void 0;
|
|
26
|
+
return identity.id;
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
exports.checkoutWorkspaceId = checkoutWorkspaceId;
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=workspaceCheckout.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspaceCheckout.cjs","names":["fs","findRepositoryRoot","identifyWorkspace","readWorkspaceMarker"],"sources":["../../../../src/builders/server/workspaceCheckout.ts"],"sourcesContent":["import fs from 'node:fs';\n\nimport { identifyWorkspace, readWorkspaceMarker } from '@agimon-ai/po-core/history';\n\nimport { findRepositoryRoot } from '../../composition/repository';\n\n/**\n * The recorded workspace a directory's checkout belongs to: its root, a\n * subdirectory, or a worktree whose git data names it. Undefined for a\n * directory that is not a checkout of any recorded workspace, or whose\n * workspace root has gone, so a caller never admits a new workspace by accident.\n */\nexport function checkoutWorkspaceId(records: readonly { id: string; root: string }[], cwd: string): string | undefined {\n let checkoutRoot: string;\n try {\n checkoutRoot = fs.realpathSync(findRepositoryRoot(cwd));\n } catch {\n return undefined;\n }\n const identity = identifyWorkspace({ records, checkoutRoot, marker: readWorkspaceMarker(checkoutRoot) });\n if (identity.moved || !records.some((record) => record.id === identity.id)) return undefined;\n return identity.id;\n}\n"],"mappings":";;;;;;;;;;;;AAYA,SAAgB,oBAAoB,SAAkD,KAAiC;CACrH,IAAI;CACJ,IAAI;EACF,eAAeA,QAAAA,QAAG,aAAaC,cAAAA,mBAAmB,GAAG,CAAC;CACxD,QAAQ;EACN;CACF;CACA,MAAM,YAAA,GAAWC,2BAAAA,kBAAAA,CAAkB;EAAE;EAAS;EAAc,SAAA,GAAQC,2BAAAA,oBAAAA,CAAoB,YAAY;CAAE,CAAC;CACvG,IAAI,SAAS,SAAS,CAAC,QAAQ,MAAM,WAAW,OAAO,OAAO,SAAS,EAAE,GAAG,OAAO,KAAA;CACnF,OAAO,SAAS;AAClB"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { findRepositoryRoot } from "../../composition/repository/index.mjs";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import { identifyWorkspace, readWorkspaceMarker } from "@agimon-ai/po-core/history";
|
|
4
|
+
//#region src/builders/server/workspaceCheckout.ts
|
|
5
|
+
/**
|
|
6
|
+
* The recorded workspace a directory's checkout belongs to: its root, a
|
|
7
|
+
* subdirectory, or a worktree whose git data names it. Undefined for a
|
|
8
|
+
* directory that is not a checkout of any recorded workspace, or whose
|
|
9
|
+
* workspace root has gone, so a caller never admits a new workspace by accident.
|
|
10
|
+
*/
|
|
11
|
+
function checkoutWorkspaceId(records, cwd) {
|
|
12
|
+
let checkoutRoot;
|
|
13
|
+
try {
|
|
14
|
+
checkoutRoot = fs.realpathSync(findRepositoryRoot(cwd));
|
|
15
|
+
} catch {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const identity = identifyWorkspace({
|
|
19
|
+
records,
|
|
20
|
+
checkoutRoot,
|
|
21
|
+
marker: readWorkspaceMarker(checkoutRoot)
|
|
22
|
+
});
|
|
23
|
+
if (identity.moved || !records.some((record) => record.id === identity.id)) return void 0;
|
|
24
|
+
return identity.id;
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { checkoutWorkspaceId };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=workspaceCheckout.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspaceCheckout.mjs","names":[],"sources":["../../../../src/builders/server/workspaceCheckout.ts"],"sourcesContent":["import fs from 'node:fs';\n\nimport { identifyWorkspace, readWorkspaceMarker } from '@agimon-ai/po-core/history';\n\nimport { findRepositoryRoot } from '../../composition/repository';\n\n/**\n * The recorded workspace a directory's checkout belongs to: its root, a\n * subdirectory, or a worktree whose git data names it. Undefined for a\n * directory that is not a checkout of any recorded workspace, or whose\n * workspace root has gone, so a caller never admits a new workspace by accident.\n */\nexport function checkoutWorkspaceId(records: readonly { id: string; root: string }[], cwd: string): string | undefined {\n let checkoutRoot: string;\n try {\n checkoutRoot = fs.realpathSync(findRepositoryRoot(cwd));\n } catch {\n return undefined;\n }\n const identity = identifyWorkspace({ records, checkoutRoot, marker: readWorkspaceMarker(checkoutRoot) });\n if (identity.moved || !records.some((record) => record.id === identity.id)) return undefined;\n return identity.id;\n}\n"],"mappings":";;;;;;;;;;AAYA,SAAgB,oBAAoB,SAAkD,KAAiC;CACrH,IAAI;CACJ,IAAI;EACF,eAAe,GAAG,aAAa,mBAAmB,GAAG,CAAC;CACxD,QAAQ;EACN;CACF;CACA,MAAM,WAAW,kBAAkB;EAAE;EAAS;EAAc,QAAQ,oBAAoB,YAAY;CAAE,CAAC;CACvG,IAAI,SAAS,SAAS,CAAC,QAAQ,MAAM,WAAW,OAAO,OAAO,SAAS,EAAE,GAAG,OAAO,KAAA;CACnF,OAAO,SAAS;AAClB"}
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
const require_runtime = require("../../../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
const require_webPluginScan = require("./webPluginScan.cjs");
|
|
3
|
+
const require_bundleAssetPolicy = require("./bundleAssetPolicy.cjs");
|
|
4
|
+
const require_webDevRoots = require("./webDevRoots.cjs");
|
|
5
|
+
const require_webPluginGenerate = require("./webPluginGenerate.cjs");
|
|
6
|
+
const require_webPluginVite = require("./webPluginVite.cjs");
|
|
7
|
+
let node_fs = require("node:fs");
|
|
8
|
+
node_fs = require_runtime.__toESM(node_fs, 1);
|
|
9
|
+
let node_path = require("node:path");
|
|
10
|
+
node_path = require_runtime.__toESM(node_path, 1);
|
|
11
|
+
//#region src/builders/web/bundle.ts
|
|
12
|
+
/** Shared runtime packages every plugin's client code must resolve to the host copies. */
|
|
13
|
+
const DEDUPED_RUNTIMES = [
|
|
14
|
+
"react",
|
|
15
|
+
"react-dom",
|
|
16
|
+
"@tanstack/store",
|
|
17
|
+
"@tanstack/react-store",
|
|
18
|
+
"@tanstack/react-router",
|
|
19
|
+
"@agimon-ai/po-core",
|
|
20
|
+
"@agimon-ai/po-web-dashboard",
|
|
21
|
+
"@agimon-ai/po-web-components",
|
|
22
|
+
"@agimon-ai/po-web-security",
|
|
23
|
+
"@codemirror/state",
|
|
24
|
+
"@codemirror/view"
|
|
25
|
+
];
|
|
26
|
+
/**
|
|
27
|
+
* The files one manifest entry reaches: `files` follows static and dynamic imports and holds
|
|
28
|
+
* every chunk, asset, and stylesheet on the way; `css` follows static imports only.
|
|
29
|
+
*/
|
|
30
|
+
function manifestClosure(manifest, entryKey) {
|
|
31
|
+
const chunkOf = (key) => {
|
|
32
|
+
const chunk = manifest[key];
|
|
33
|
+
if (chunk === void 0) throw new Error(`The composition manifest has no chunk '${key}'.`);
|
|
34
|
+
return chunk;
|
|
35
|
+
};
|
|
36
|
+
const files = /* @__PURE__ */ new Set();
|
|
37
|
+
const visited = /* @__PURE__ */ new Set();
|
|
38
|
+
const walk = (key) => {
|
|
39
|
+
if (visited.has(key)) return;
|
|
40
|
+
visited.add(key);
|
|
41
|
+
const chunk = chunkOf(key);
|
|
42
|
+
files.add(chunk.file);
|
|
43
|
+
for (const file of [...chunk.css ?? [], ...chunk.assets ?? []]) files.add(file);
|
|
44
|
+
for (const next of [...chunk.imports ?? [], ...chunk.dynamicImports ?? []]) walk(next);
|
|
45
|
+
};
|
|
46
|
+
walk(entryKey);
|
|
47
|
+
const css = /* @__PURE__ */ new Set();
|
|
48
|
+
const staticVisited = /* @__PURE__ */ new Set();
|
|
49
|
+
const walkStatic = (key) => {
|
|
50
|
+
if (staticVisited.has(key)) return;
|
|
51
|
+
staticVisited.add(key);
|
|
52
|
+
const chunk = chunkOf(key);
|
|
53
|
+
for (const file of chunk.css ?? []) css.add(file);
|
|
54
|
+
for (const next of chunk.imports ?? []) walkStatic(next);
|
|
55
|
+
};
|
|
56
|
+
walkStatic(entryKey);
|
|
57
|
+
return {
|
|
58
|
+
entry: chunkOf(entryKey).file,
|
|
59
|
+
files: [...files],
|
|
60
|
+
css: [...css]
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Builds the cockpit SPA against the installed plugin set.
|
|
65
|
+
*
|
|
66
|
+
* This is what `po sync` calls: manifests come from the given package
|
|
67
|
+
* roots (no hardcoded plugin dependencies anywhere), the generated entry
|
|
68
|
+
* modules are aliased over the committed builtin registry, and Vite compiles
|
|
69
|
+
* the host shell and, separately, each plugin's shipped web source into one
|
|
70
|
+
* ES-module composition with an entry per slot, so each plugin and its assets ship once.
|
|
71
|
+
* The roots file beside
|
|
72
|
+
* the bundle lets the dev server serve the same composition with hot reload.
|
|
73
|
+
*/
|
|
74
|
+
async function bundleCockpitWeb(options) {
|
|
75
|
+
const notice = options.onNotice ?? (() => {});
|
|
76
|
+
const hostRoot = options.hostRoot;
|
|
77
|
+
const plugins = require_webPluginScan.scanWebPlugins(hostRoot, options.pluginRoots, notice);
|
|
78
|
+
notice(`bundling the cockpit with ${String(plugins.length)} web plugin(s): ${plugins.map((p) => p.pluginId).join(", ")}`);
|
|
79
|
+
const generatedDir = node_path.default.join(options.outDir, "generated");
|
|
80
|
+
const assetsDir = node_path.default.join(options.outDir, "web");
|
|
81
|
+
const pluginsDir = node_path.default.join(options.outDir, "plugins");
|
|
82
|
+
const generated = require_webPluginGenerate.writeSyncWebPluginModules(plugins, generatedDir, hostRoot);
|
|
83
|
+
const roots = [...new Set(options.pluginRoots.map((root) => node_path.default.resolve(root)))];
|
|
84
|
+
node_fs.default.writeFileSync(node_path.default.join(options.outDir, require_webDevRoots.PLUGIN_ROOTS_FILE), `${JSON.stringify(roots, null, 2)}\n`);
|
|
85
|
+
const { build } = await import("vite");
|
|
86
|
+
const { default: react } = await import("@vitejs/plugin-react");
|
|
87
|
+
const { default: tailwindcss } = await import("@tailwindcss/vite");
|
|
88
|
+
const clientRoot = node_path.default.join(hostRoot, "src", "web");
|
|
89
|
+
await build({
|
|
90
|
+
configFile: false,
|
|
91
|
+
envDir: false,
|
|
92
|
+
logLevel: "warn",
|
|
93
|
+
root: clientRoot,
|
|
94
|
+
plugins: [
|
|
95
|
+
require_webPluginVite.webPluginOverridePlugin(clientRoot, generated.shell),
|
|
96
|
+
react(),
|
|
97
|
+
tailwindcss(),
|
|
98
|
+
require_bundleAssetPolicy.bundleAssetPolicyPlugin()
|
|
99
|
+
],
|
|
100
|
+
resolve: {
|
|
101
|
+
dedupe: [...DEDUPED_RUNTIMES],
|
|
102
|
+
alias: [...require_webPluginVite.webPluginRuntimeAliases(clientRoot), require_webPluginVite.webPluginCssAlias(generated.shell)]
|
|
103
|
+
},
|
|
104
|
+
build: {
|
|
105
|
+
outDir: assetsDir,
|
|
106
|
+
emptyOutDir: true,
|
|
107
|
+
sourcemap: false
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
await build({
|
|
111
|
+
configFile: false,
|
|
112
|
+
envDir: false,
|
|
113
|
+
logLevel: "warn",
|
|
114
|
+
base: "./",
|
|
115
|
+
plugins: [
|
|
116
|
+
require_webPluginVite.webPluginRuntimeFacadePlugin(hostRoot),
|
|
117
|
+
react(),
|
|
118
|
+
tailwindcss()
|
|
119
|
+
],
|
|
120
|
+
resolve: {
|
|
121
|
+
dedupe: [...DEDUPED_RUNTIMES],
|
|
122
|
+
alias: [require_webPluginVite.webPluginCssAlias(generated)]
|
|
123
|
+
},
|
|
124
|
+
build: {
|
|
125
|
+
cssCodeSplit: true,
|
|
126
|
+
modulePreload: false,
|
|
127
|
+
outDir: pluginsDir,
|
|
128
|
+
emptyOutDir: true,
|
|
129
|
+
sourcemap: false,
|
|
130
|
+
assetsInlineLimit: 0,
|
|
131
|
+
manifest: "manifest.json",
|
|
132
|
+
rollupOptions: {
|
|
133
|
+
input: generated.slotEntryPaths,
|
|
134
|
+
preserveEntrySignatures: "exports-only",
|
|
135
|
+
output: {
|
|
136
|
+
format: "es",
|
|
137
|
+
entryFileNames: "slots/[name]-[hash].js",
|
|
138
|
+
chunkFileNames: "chunks/[name]-[hash].js",
|
|
139
|
+
assetFileNames: "assets/[name]-[hash][extname]",
|
|
140
|
+
manualChunks: (id) => require_webPluginVite.isWebPluginFacade(id) ? require_webPluginVite.WEB_PLUGIN_FACADE_CHUNK : void 0
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
const manifest = JSON.parse(node_fs.default.readFileSync(node_path.default.join(pluginsDir, "manifest.json"), "utf8"));
|
|
146
|
+
const manifestRoot = node_fs.default.realpathSync(process.cwd());
|
|
147
|
+
const closures = new Map(plugins.map((plugin) => {
|
|
148
|
+
const entryPath = node_fs.default.realpathSync(generated.slotEntryPaths[plugin.slot]);
|
|
149
|
+
return [plugin.slot, manifestClosure(manifest, node_path.default.relative(manifestRoot, entryPath).split(node_path.default.sep).join("/"))];
|
|
150
|
+
}));
|
|
151
|
+
const styles = require_webPluginGenerate.writeWebPluginStyleEntries(plugins, generatedDir, hostRoot);
|
|
152
|
+
const stylesRoot = node_path.default.dirname(styles.baseEntryPath);
|
|
153
|
+
await build({
|
|
154
|
+
configFile: false,
|
|
155
|
+
envDir: false,
|
|
156
|
+
logLevel: "warn",
|
|
157
|
+
root: stylesRoot,
|
|
158
|
+
base: "./",
|
|
159
|
+
plugins: [tailwindcss()],
|
|
160
|
+
resolve: { alias: [{
|
|
161
|
+
find: /^\.\/webPluginSources\.generated\.css$/,
|
|
162
|
+
replacement: styles.baseSourcesPath
|
|
163
|
+
}] },
|
|
164
|
+
build: {
|
|
165
|
+
cssCodeSplit: true,
|
|
166
|
+
outDir: pluginsDir,
|
|
167
|
+
emptyOutDir: false,
|
|
168
|
+
sourcemap: false,
|
|
169
|
+
assetsInlineLimit: 0,
|
|
170
|
+
manifest: "styles.manifest.json",
|
|
171
|
+
rollupOptions: {
|
|
172
|
+
input: Object.fromEntries([[require_webPluginGenerate.BASE_STYLE_ENTRY, styles.baseEntryPath], ...[...styles.pluginEntryPaths].map(([slot, entry]) => [require_webPluginGenerate.pluginStyleEntryName(slot), entry])]),
|
|
173
|
+
output: { assetFileNames: "assets/[name]-[hash][extname]" }
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
const styleManifest = JSON.parse(node_fs.default.readFileSync(node_path.default.join(pluginsDir, "styles.manifest.json"), "utf8"));
|
|
178
|
+
node_fs.default.rmSync(node_path.default.join(pluginsDir, "styles.manifest.json"));
|
|
179
|
+
const emitted = (entry) => {
|
|
180
|
+
const record = styleManifest[node_path.default.relative(stylesRoot, entry).split(node_path.default.sep).join("/")];
|
|
181
|
+
const file = record?.file?.endsWith(".css") ? record.file : record?.css?.[0];
|
|
182
|
+
if (file === void 0) throw new Error(`The stylesheet entry '${entry}' emitted no CSS file.`);
|
|
183
|
+
return {
|
|
184
|
+
file,
|
|
185
|
+
assets: record?.assets ?? []
|
|
186
|
+
};
|
|
187
|
+
};
|
|
188
|
+
const base = emitted(styles.baseEntryPath);
|
|
189
|
+
const slotStyles = new Map(plugins.map((plugin) => {
|
|
190
|
+
const entry = styles.pluginEntryPaths.get(plugin.slot);
|
|
191
|
+
return [plugin.slot, entry === void 0 ? base : emitted(entry)];
|
|
192
|
+
}));
|
|
193
|
+
const pluginStyles = Object.fromEntries([...slotStyles].map(([slot, style]) => [slot, style.file]));
|
|
194
|
+
node_fs.default.writeFileSync(node_path.default.join(pluginsDir, "index.html"), "<!doctype html>\n<title>Po plugin composition</title>\n");
|
|
195
|
+
return {
|
|
196
|
+
assetsDir,
|
|
197
|
+
pluginsDir,
|
|
198
|
+
pluginIds: plugins.map((plugin) => plugin.pluginId),
|
|
199
|
+
plugins: plugins.map((plugin) => {
|
|
200
|
+
const closure = closures.get(plugin.slot);
|
|
201
|
+
const style = slotStyles.get(plugin.slot);
|
|
202
|
+
if (closure === void 0 || style === void 0) throw new Error(`The slot '${plugin.slot}' emitted no entry.`);
|
|
203
|
+
return {
|
|
204
|
+
pluginId: plugin.pluginId,
|
|
205
|
+
slot: plugin.slot,
|
|
206
|
+
packageDir: plugin.packageDir,
|
|
207
|
+
isHost: plugin.isHost,
|
|
208
|
+
entry: closure.entry,
|
|
209
|
+
files: [.../* @__PURE__ */ new Set([
|
|
210
|
+
...closure.files,
|
|
211
|
+
style.file,
|
|
212
|
+
...style.assets
|
|
213
|
+
])],
|
|
214
|
+
css: closure.css
|
|
215
|
+
};
|
|
216
|
+
}),
|
|
217
|
+
pluginStyles,
|
|
218
|
+
baseStyle: base.file
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
//#endregion
|
|
222
|
+
exports.bundleCockpitWeb = bundleCockpitWeb;
|
|
223
|
+
exports.manifestClosure = manifestClosure;
|
|
224
|
+
|
|
225
|
+
//# sourceMappingURL=bundle.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle.cjs","names":["scanWebPlugins","path","writeSyncWebPluginModules","PLUGIN_ROOTS_FILE","webPluginOverridePlugin","bundleAssetPolicyPlugin","webPluginRuntimeAliases","webPluginCssAlias","webPluginRuntimeFacadePlugin","isWebPluginFacade","WEB_PLUGIN_FACADE_CHUNK","fs","writeWebPluginStyleEntries","BASE_STYLE_ENTRY","pluginStyleEntryName"],"sources":["../../../../src/builders/web/bundle.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\n\nimport { bundleAssetPolicyPlugin } from './bundleAssetPolicy';\nimport { PLUGIN_ROOTS_FILE } from './webDevRoots';\nimport {\n BASE_STYLE_ENTRY,\n pluginStyleEntryName,\n writeSyncWebPluginModules,\n writeWebPluginStyleEntries,\n} from './webPluginGenerate';\nimport { scanWebPlugins } from './webPluginScan';\nimport {\n isWebPluginFacade,\n WEB_PLUGIN_FACADE_CHUNK,\n webPluginCssAlias,\n webPluginOverridePlugin,\n webPluginRuntimeAliases,\n webPluginRuntimeFacadePlugin,\n} from './webPluginVite';\n\n/** Shared runtime packages every plugin's client code must resolve to the host copies. */\nconst DEDUPED_RUNTIMES = [\n 'react',\n 'react-dom',\n '@tanstack/store',\n '@tanstack/react-store',\n '@tanstack/react-router',\n '@agimon-ai/po-core',\n '@agimon-ai/po-web-dashboard',\n '@agimon-ai/po-web-components',\n // The sealed transport is a module singleton whose nonce counters every\n // plugin shares; a second copy would start counting at zero.\n '@agimon-ai/po-web-security',\n // CodeMirror's state and view are singletons in all but name: a document\n // built against one copy is rejected by an editor from the other, and a\n // grammar chunk resolved separately from the editor is exactly how a second\n // copy appears.\n '@codemirror/state',\n '@codemirror/view',\n];\n\nexport interface BundleCockpitWebOptions {\n hostRoot: string;\n /** Package roots to scan for poWeb manifests, usually the installed composition. */\n pluginRoots: readonly string[];\n /** Output directory; receives web/, plugins/, generated/, and pluginRoots.json. */\n outDir: string;\n onNotice?: (message: string) => void;\n}\n\nexport interface BundleCockpitWebResult {\n /** The cockpit shell with the host's own plugins; every other plugin ships in pluginsDir. */\n assetsDir: string;\n /** Standalone session plugin composition artifacts. */\n pluginsDir: string;\n pluginIds: string[];\n /** Every declared plugin copy with its slot and the files its slot entry reaches. */\n plugins: WebPluginBuildRecord[];\n /** One content-hashed stylesheet per slot below pluginsDir; host plugins share the base. */\n pluginStyles: Record<string, string>;\n /** The shell-only stylesheet below pluginsDir. */\n baseStyle: string;\n}\n\n/** One plugin copy in a build: its slot entry and the emitted files that entry can load. */\nexport interface WebPluginBuildRecord {\n pluginId: string;\n slot: string;\n packageDir: string;\n isHost: boolean;\n /** The slot entry module below pluginsDir. */\n entry: string;\n /** Every file the entry reaches through static and dynamic imports, plus the slot stylesheet and its assets. */\n files: string[];\n /** The stylesheets of the entry's static import closure, which a mount loads up front. */\n css: string[];\n}\n\ninterface ManifestChunk {\n file: string;\n imports?: string[];\n dynamicImports?: string[];\n css?: string[];\n assets?: string[];\n}\n\n/**\n * The files one manifest entry reaches: `files` follows static and dynamic imports and holds\n * every chunk, asset, and stylesheet on the way; `css` follows static imports only.\n */\nexport function manifestClosure(\n manifest: Readonly<Record<string, ManifestChunk>>,\n entryKey: string,\n): { entry: string; files: string[]; css: string[] } {\n const chunkOf = (key: string): ManifestChunk => {\n const chunk = manifest[key];\n if (chunk === undefined) throw new Error(`The composition manifest has no chunk '${key}'.`);\n return chunk;\n };\n const files = new Set<string>();\n const visited = new Set<string>();\n const walk = (key: string): void => {\n if (visited.has(key)) return;\n visited.add(key);\n const chunk = chunkOf(key);\n files.add(chunk.file);\n for (const file of [...(chunk.css ?? []), ...(chunk.assets ?? [])]) files.add(file);\n for (const next of [...(chunk.imports ?? []), ...(chunk.dynamicImports ?? [])]) walk(next);\n };\n walk(entryKey);\n const css = new Set<string>();\n const staticVisited = new Set<string>();\n const walkStatic = (key: string): void => {\n if (staticVisited.has(key)) return;\n staticVisited.add(key);\n const chunk = chunkOf(key);\n for (const file of chunk.css ?? []) css.add(file);\n for (const next of chunk.imports ?? []) walkStatic(next);\n };\n walkStatic(entryKey);\n return { entry: chunkOf(entryKey).file, files: [...files], css: [...css] };\n}\n\n/**\n * Builds the cockpit SPA against the installed plugin set.\n *\n * This is what `po sync` calls: manifests come from the given package\n * roots (no hardcoded plugin dependencies anywhere), the generated entry\n * modules are aliased over the committed builtin registry, and Vite compiles\n * the host shell and, separately, each plugin's shipped web source into one\n * ES-module composition with an entry per slot, so each plugin and its assets ship once.\n * The roots file beside\n * the bundle lets the dev server serve the same composition with hot reload.\n */\nexport async function bundleCockpitWeb(options: BundleCockpitWebOptions): Promise<BundleCockpitWebResult> {\n const notice = options.onNotice ?? ((): void => {});\n const hostRoot = options.hostRoot;\n const plugins = scanWebPlugins(hostRoot, options.pluginRoots, notice);\n notice(\n `bundling the cockpit with ${String(plugins.length)} web plugin(s): ${plugins.map((p) => p.pluginId).join(', ')}`,\n );\n\n const generatedDir = path.join(options.outDir, 'generated');\n const assetsDir = path.join(options.outDir, 'web');\n const pluginsDir = path.join(options.outDir, 'plugins');\n const generated = writeSyncWebPluginModules(plugins, generatedDir, hostRoot);\n const roots = [...new Set(options.pluginRoots.map((root) => path.resolve(root)))];\n fs.writeFileSync(path.join(options.outDir, PLUGIN_ROOTS_FILE), `${JSON.stringify(roots, null, 2)}\\n`);\n\n // Vite and its plugins are regular dependencies so this works from an\n // installed package, not only the workspace.\n const { build } = await import('vite');\n const { default: react } = await import('@vitejs/plugin-react');\n const { default: tailwindcss } = await import('@tailwindcss/vite');\n\n const clientRoot = path.join(hostRoot, 'src', 'web');\n\n // The shell carries only the host's own plugins; the rest load from the composition below.\n await build({\n configFile: false,\n envDir: false,\n logLevel: 'warn',\n root: clientRoot,\n plugins: [webPluginOverridePlugin(clientRoot, generated.shell), react(), tailwindcss(), bundleAssetPolicyPlugin()],\n resolve: {\n dedupe: [...DEDUPED_RUNTIMES],\n alias: [...webPluginRuntimeAliases(clientRoot), webPluginCssAlias(generated.shell)],\n },\n build: {\n outDir: assetsDir,\n emptyOutDir: true,\n sourcemap: false,\n },\n });\n\n // One ES-module composition: an entry per slot exporting its webPlugin, shared chunks\n // between them, and the shared runtime modules read from the page through facades.\n await build({\n configFile: false,\n envDir: false,\n logLevel: 'warn',\n base: './',\n plugins: [webPluginRuntimeFacadePlugin(hostRoot), react(), tailwindcss()],\n resolve: {\n dedupe: [...DEDUPED_RUNTIMES],\n alias: [webPluginCssAlias(generated)],\n },\n build: {\n cssCodeSplit: true,\n modulePreload: false,\n outDir: pluginsDir,\n emptyOutDir: true,\n sourcemap: false,\n assetsInlineLimit: 0,\n manifest: 'manifest.json',\n rollupOptions: {\n input: generated.slotEntryPaths,\n // Each slot entry is loaded for its webPlugin export, so it must keep it.\n preserveEntrySignatures: 'exports-only',\n output: {\n format: 'es',\n entryFileNames: 'slots/[name]-[hash].js',\n chunkFileNames: 'chunks/[name]-[hash].js',\n assetFileNames: 'assets/[name]-[hash][extname]',\n manualChunks: (id) => (isWebPluginFacade(id) ? WEB_PLUGIN_FACADE_CHUNK : undefined),\n },\n },\n },\n });\n const manifest = JSON.parse(fs.readFileSync(path.join(pluginsDir, 'manifest.json'), 'utf8')) as Record<\n string,\n ManifestChunk\n >;\n // Manifest keys are the entry sources relative to the build root, which is the working directory.\n const manifestRoot = fs.realpathSync(process.cwd());\n const closures = new Map(\n plugins.map((plugin) => {\n const entryPath = fs.realpathSync(generated.slotEntryPaths[plugin.slot]);\n return [plugin.slot, manifestClosure(manifest, path.relative(manifestRoot, entryPath).split(path.sep).join('/'))];\n }),\n );\n\n // One content-hashed stylesheet per plugin, compiled from its own sources over the shell's.\n const styles = writeWebPluginStyleEntries(plugins, generatedDir, hostRoot);\n const stylesRoot = path.dirname(styles.baseEntryPath);\n await build({\n configFile: false,\n envDir: false,\n logLevel: 'warn',\n root: stylesRoot,\n base: './',\n plugins: [tailwindcss()],\n resolve: {\n alias: [{ find: /^\\.\\/webPluginSources\\.generated\\.css$/, replacement: styles.baseSourcesPath }],\n },\n build: {\n cssCodeSplit: true,\n outDir: pluginsDir,\n emptyOutDir: false,\n sourcemap: false,\n assetsInlineLimit: 0,\n manifest: 'styles.manifest.json',\n rollupOptions: {\n input: Object.fromEntries([\n [BASE_STYLE_ENTRY, styles.baseEntryPath],\n ...[...styles.pluginEntryPaths].map(([slot, entry]) => [pluginStyleEntryName(slot), entry]),\n ]),\n output: { assetFileNames: 'assets/[name]-[hash][extname]' },\n },\n },\n });\n const styleManifest = JSON.parse(fs.readFileSync(path.join(pluginsDir, 'styles.manifest.json'), 'utf8')) as Record<\n string,\n { file?: string; css?: string[]; assets?: string[] }\n >;\n fs.rmSync(path.join(pluginsDir, 'styles.manifest.json'));\n const emitted = (entry: string): { file: string; assets: string[] } => {\n const record = styleManifest[path.relative(stylesRoot, entry).split(path.sep).join('/')];\n const file = record?.file?.endsWith('.css') ? record.file : record?.css?.[0];\n if (file === undefined) throw new Error(`The stylesheet entry '${entry}' emitted no CSS file.`);\n return { file, assets: record?.assets ?? [] };\n };\n const base = emitted(styles.baseEntryPath);\n const slotStyles = new Map(\n plugins.map((plugin) => {\n const entry = styles.pluginEntryPaths.get(plugin.slot);\n return [plugin.slot, entry === undefined ? base : emitted(entry)];\n }),\n );\n const pluginStyles = Object.fromEntries([...slotStyles].map(([slot, style]) => [slot, style.file]));\n fs.writeFileSync(path.join(pluginsDir, 'index.html'), '<!doctype html>\\n<title>Po plugin composition</title>\\n');\n\n return {\n assetsDir,\n pluginsDir,\n pluginIds: plugins.map((plugin) => plugin.pluginId),\n plugins: plugins.map((plugin) => {\n const closure = closures.get(plugin.slot);\n const style = slotStyles.get(plugin.slot);\n if (closure === undefined || style === undefined) throw new Error(`The slot '${plugin.slot}' emitted no entry.`);\n return {\n pluginId: plugin.pluginId,\n slot: plugin.slot,\n packageDir: plugin.packageDir,\n isHost: plugin.isHost,\n entry: closure.entry,\n // The slot's own stylesheet and the fonts it references load with it.\n files: [...new Set([...closure.files, style.file, ...style.assets])],\n css: closure.css,\n };\n }),\n pluginStyles,\n baseStyle: base.file,\n };\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
//#region src/builders/web/bundle.d.ts
|
|
2
|
+
export interface BundleCockpitWebOptions {
|
|
3
|
+
hostRoot: string;
|
|
4
|
+
/** Package roots to scan for poWeb manifests, usually the installed composition. */
|
|
5
|
+
pluginRoots: readonly string[];
|
|
6
|
+
/** Output directory; receives web/, plugins/, generated/, and pluginRoots.json. */
|
|
7
|
+
outDir: string;
|
|
8
|
+
onNotice?: (message: string) => void;
|
|
9
|
+
}
|
|
10
|
+
export interface BundleCockpitWebResult {
|
|
11
|
+
/** The cockpit shell with the host's own plugins; every other plugin ships in pluginsDir. */
|
|
12
|
+
assetsDir: string;
|
|
13
|
+
/** Standalone session plugin composition artifacts. */
|
|
14
|
+
pluginsDir: string;
|
|
15
|
+
pluginIds: string[];
|
|
16
|
+
/** Every declared plugin copy with its slot and the files its slot entry reaches. */
|
|
17
|
+
plugins: WebPluginBuildRecord[];
|
|
18
|
+
/** One content-hashed stylesheet per slot below pluginsDir; host plugins share the base. */
|
|
19
|
+
pluginStyles: Record<string, string>;
|
|
20
|
+
/** The shell-only stylesheet below pluginsDir. */
|
|
21
|
+
baseStyle: string;
|
|
22
|
+
}
|
|
23
|
+
/** One plugin copy in a build: its slot entry and the emitted files that entry can load. */
|
|
24
|
+
export interface WebPluginBuildRecord {
|
|
25
|
+
pluginId: string;
|
|
26
|
+
slot: string;
|
|
27
|
+
packageDir: string;
|
|
28
|
+
isHost: boolean;
|
|
29
|
+
/** The slot entry module below pluginsDir. */
|
|
30
|
+
entry: string;
|
|
31
|
+
/** Every file the entry reaches through static and dynamic imports, plus the slot stylesheet and its assets. */
|
|
32
|
+
files: string[];
|
|
33
|
+
/** The stylesheets of the entry's static import closure, which a mount loads up front. */
|
|
34
|
+
css: string[];
|
|
35
|
+
}
|
|
36
|
+
interface ManifestChunk {
|
|
37
|
+
file: string;
|
|
38
|
+
imports?: string[];
|
|
39
|
+
dynamicImports?: string[];
|
|
40
|
+
css?: string[];
|
|
41
|
+
assets?: string[];
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The files one manifest entry reaches: `files` follows static and dynamic imports and holds
|
|
45
|
+
* every chunk, asset, and stylesheet on the way; `css` follows static imports only.
|
|
46
|
+
*/
|
|
47
|
+
export declare function manifestClosure(manifest: Readonly<Record<string, ManifestChunk>>, entryKey: string): {
|
|
48
|
+
entry: string;
|
|
49
|
+
files: string[];
|
|
50
|
+
css: string[];
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Builds the cockpit SPA against the installed plugin set.
|
|
54
|
+
*
|
|
55
|
+
* This is what `po sync` calls: manifests come from the given package
|
|
56
|
+
* roots (no hardcoded plugin dependencies anywhere), the generated entry
|
|
57
|
+
* modules are aliased over the committed builtin registry, and Vite compiles
|
|
58
|
+
* the host shell and, separately, each plugin's shipped web source into one
|
|
59
|
+
* ES-module composition with an entry per slot, so each plugin and its assets ship once.
|
|
60
|
+
* The roots file beside
|
|
61
|
+
* the bundle lets the dev server serve the same composition with hot reload.
|
|
62
|
+
*/
|
|
63
|
+
export declare function bundleCockpitWeb(options: BundleCockpitWebOptions): Promise<BundleCockpitWebResult>;
|
|
64
|
+
//#endregion
|
|
65
|
+
//# sourceMappingURL=bundle.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle.d.mts","names":[],"sources":["../../../../src/builders/web/bundle.ts"],"mappings":";iBA0CiB;EACf;;EAEA;;EAEA;EACA,YAAY;;iBAGG;;EAEf;;EAEA;EACA;;EAEA,SAAS;;EAET,cAAc;;EAEd;;;iBAIe;EACf;EACA;EACA;EACA;;EAEA;;EAEA;;EAEA;;UAGQ;EACR;EACA;EACA;EACA;EACA;;;;;;wBAOc,gBACd,UAAU,SAAS,eAAe,iBAClC;EACG;EAAe;EAAiB;;;;;;;;;;;;;wBAyCf,iBAAiB,SAAS,0BAA0B,QAAQ"}
|