@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
|
@@ -6,20 +6,25 @@ const require_index$2 = require("../layerPackageInstaller/index.cjs");
|
|
|
6
6
|
const require_sessionComposition = require("../../builders/cli/sessionComposition.cjs");
|
|
7
7
|
const require_mcpAppBuild = require("../../builders/server/mcpAppBuild.cjs");
|
|
8
8
|
const require_mcpBundle = require("../../builders/server/mcpBundle.cjs");
|
|
9
|
-
const require_index$3 = require("../
|
|
9
|
+
const require_index$3 = require("../projectTrust/index.cjs");
|
|
10
|
+
const require_index$4 = require("../syncPrune/index.cjs");
|
|
10
11
|
const require_localBuilds = require("./localBuilds.cjs");
|
|
11
|
-
let
|
|
12
|
-
node_fs = require_runtime.__toESM(node_fs, 1);
|
|
12
|
+
let _agimon_ai_po_core_locale = require("@agimon-ai/po-core/locale");
|
|
13
13
|
let node_path = require("node:path");
|
|
14
14
|
node_path = require_runtime.__toESM(node_path, 1);
|
|
15
|
-
let
|
|
16
|
-
let
|
|
15
|
+
let _agimon_ai_po_config_sync = require("@agimon-ai/po-config/sync");
|
|
16
|
+
let node_fs_promises = require("node:fs/promises");
|
|
17
|
+
node_fs_promises = require_runtime.__toESM(node_fs_promises, 1);
|
|
17
18
|
let _agimon_ai_po_config_config = require("@agimon-ai/po-config/config");
|
|
18
|
-
let
|
|
19
|
+
let _agimon_ai_po_core_nodePlatform = require("@agimon-ai/po-core/nodePlatform");
|
|
19
20
|
let _agimon_ai_po_core_piSettings = require("@agimon-ai/po-core/piSettings");
|
|
21
|
+
let _agimon_ai_po_core_platform = require("@agimon-ai/po-core/platform");
|
|
22
|
+
let node_fs = require("node:fs");
|
|
23
|
+
let _agimon_ai_po_config_presets = require("@agimon-ai/po-config/presets");
|
|
20
24
|
let _agimon_ai_po_core_moduleResolution = require("@agimon-ai/po-core/moduleResolution");
|
|
21
25
|
let node_crypto = require("node:crypto");
|
|
22
26
|
node_crypto = require_runtime.__toESM(node_crypto, 1);
|
|
27
|
+
let node_timers_promises = require("node:timers/promises");
|
|
23
28
|
let _agimon_ai_po_core_history = require("@agimon-ai/po-core/history");
|
|
24
29
|
//#region src/composition/syncService/index.ts
|
|
25
30
|
/**
|
|
@@ -44,15 +49,16 @@ const RERUN_FILE = ".sync.rerun";
|
|
|
44
49
|
const POINTER_FILE = "current.json";
|
|
45
50
|
const LAST_ATTEMPT_FILE = "last-attempt.json";
|
|
46
51
|
const MCP_APP_FILE = "index.html";
|
|
47
|
-
const HOOK_EMITTER = node_path.default.join("tools", "harness", "emit-hooks.mjs");
|
|
48
52
|
const ROOTS_LABEL = "roots";
|
|
49
53
|
const PACKAGES_LABEL = "packages";
|
|
50
54
|
const WEB_LABEL = "web";
|
|
51
55
|
const NATIVE_LABEL = "native";
|
|
52
56
|
const MCP_LABEL = "mcp app";
|
|
57
|
+
const ARTIFACT_BUILDS_SKIPPED = "skipped (--skip-artifact-builds)";
|
|
58
|
+
const NATIVE_DEFERRED = "deferred until a native client connects";
|
|
53
59
|
const PRUNE_LABEL = "prune";
|
|
54
|
-
const HOOKS_LABEL = "hooks";
|
|
55
60
|
const LOCAL_LABEL = "local";
|
|
61
|
+
const LOCAL_NOT_TRUSTED = "not built: workspace not trusted";
|
|
56
62
|
const BYTES_PER_MEGABYTE = 1048576;
|
|
57
63
|
/** A lock file younger than this that cannot be parsed is still being written by its owner. */
|
|
58
64
|
const UNREADABLE_LOCK_GRACE_MS = 1e4;
|
|
@@ -79,7 +85,7 @@ const DEFAULT_DEPS = {
|
|
|
79
85
|
buildWeb: require_index.ensureGlobalWebBuild,
|
|
80
86
|
buildNative: require_index$1.ensureGlobalNativeBuild,
|
|
81
87
|
bundleMcpApp: require_mcpAppBuild.ensureMcpAppBuild,
|
|
82
|
-
prune: require_index$
|
|
88
|
+
prune: require_index$4.pruneAfterSync,
|
|
83
89
|
isAlive: processIsAlive,
|
|
84
90
|
pid: process.pid,
|
|
85
91
|
now: () => /* @__PURE__ */ new Date()
|
|
@@ -94,26 +100,46 @@ function syncLockPath(globalRoot) {
|
|
|
94
100
|
function syncRerunPath(globalRoot) {
|
|
95
101
|
return node_path.default.join(globalRoot, BUILD_DIRECTORY, RERUN_FILE);
|
|
96
102
|
}
|
|
97
|
-
function pluralize(count, noun) {
|
|
98
|
-
return `${String(count)} ${noun}${count === 1 ? "" : "s"}`;
|
|
99
|
-
}
|
|
100
103
|
function errorMessage(error) {
|
|
101
104
|
return error instanceof Error ? error.message : String(error);
|
|
102
105
|
}
|
|
103
|
-
|
|
106
|
+
const englishMessage = (_key, fallback, vars) => (0, _agimon_ai_po_core_locale.formatMessage)(fallback, vars);
|
|
107
|
+
function errorText(options) {
|
|
108
|
+
return (key, fallback, vars) => {
|
|
109
|
+
const raw = englishMessage(key, fallback, vars);
|
|
110
|
+
if (options.onErrorPresentation && options.translateProgress) options.onErrorPresentation(raw, options.translateProgress(key, fallback, vars));
|
|
111
|
+
return raw;
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
function packageSummary(result, t = englishMessage) {
|
|
104
115
|
const parts = [];
|
|
105
|
-
if (result.updated.length > 0)
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
116
|
+
if (result.updated.length > 0) {
|
|
117
|
+
const count = result.updated.length;
|
|
118
|
+
parts.push(count === 1 ? t("cli.sync.updatedOne", "updated {count} package", { count }) : t("cli.sync.updatedMany", "updated {count} packages", { count }));
|
|
119
|
+
}
|
|
120
|
+
if (result.installed.length > 0) {
|
|
121
|
+
const count = result.installed.length;
|
|
122
|
+
parts.push(count === 1 ? t("cli.sync.installedOne", "installed {count} missing package", { count }) : t("cli.sync.installedMany", "installed {count} missing packages", { count }));
|
|
123
|
+
}
|
|
124
|
+
if (parts.length === 0) parts.push(t("cli.sync.alreadyCurrent", "already up to date"));
|
|
125
|
+
if (result.unchecked.length > 0) {
|
|
126
|
+
const count = result.unchecked.length;
|
|
127
|
+
parts.push(count === 1 ? t("cli.sync.uncheckedOne", "{count} package left unchecked", { count }) : t("cli.sync.uncheckedMany", "{count} packages left unchecked", { count }));
|
|
128
|
+
}
|
|
109
129
|
return parts.join(", ");
|
|
110
130
|
}
|
|
111
|
-
function
|
|
131
|
+
function artifactSummary(artifact, t, skipped) {
|
|
132
|
+
if (artifact.status === "skipped") return skipped ?? artifact.reason;
|
|
133
|
+
const status = artifact.status === "built" ? t("cli.sync.built", "built") : t("cli.sync.cached", "cached");
|
|
134
|
+
return `${artifact.key} (${status})`;
|
|
135
|
+
}
|
|
136
|
+
/** Human presentation only. The service report and JSON events retain their stable raw fields. */
|
|
137
|
+
function formatSyncResult(result, t = englishMessage) {
|
|
112
138
|
return [
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
...result.native === void 0 ? [] : [
|
|
116
|
-
...result.mcpApp === void 0 ? [] : [
|
|
139
|
+
t("cli.sync.result.packages", "packages: {summary}", { summary: packageSummary(result.packages, t) }),
|
|
140
|
+
t("cli.sync.result.web", "web: {summary}", { summary: artifactSummary(result.web, t) }),
|
|
141
|
+
...result.native === void 0 ? [] : [t("cli.sync.result.native", "native: {summary}", { summary: artifactSummary(result.native, t) })],
|
|
142
|
+
...result.mcpApp === void 0 ? [] : [t("cli.sync.result.mcp", "mcp app: {summary}", { summary: result.mcpApp })],
|
|
117
143
|
""
|
|
118
144
|
].join("\n");
|
|
119
145
|
}
|
|
@@ -144,12 +170,15 @@ function composeRoots(roots, homeDirectory, environment) {
|
|
|
144
170
|
}));
|
|
145
171
|
}
|
|
146
172
|
/** Each root's composition package roots; a root that cannot be composed is left out with a notice. */
|
|
147
|
-
function packageRootsByRoot(composed, onNotice) {
|
|
148
|
-
return new Map([...composed].map(([root, compositions]) => {
|
|
149
|
-
if (!(compositions instanceof Error)) return [root, require_index.compositionPackageRoots(compositions)];
|
|
150
|
-
onNotice(
|
|
173
|
+
async function packageRootsByRoot(composed, onNotice, t) {
|
|
174
|
+
return new Map(await Promise.all([...composed].map(async ([root, compositions]) => {
|
|
175
|
+
if (!(compositions instanceof Error)) return [root, await require_index.compositionPackageRoots(compositions)];
|
|
176
|
+
onNotice(t("cli.sync.progress.webLeftOut", "'{root}' is left out of the web build: {reason}", {
|
|
177
|
+
root,
|
|
178
|
+
reason: compositions.message
|
|
179
|
+
}));
|
|
151
180
|
return [root, []];
|
|
152
|
-
}));
|
|
181
|
+
})));
|
|
153
182
|
}
|
|
154
183
|
/** The selectors a lenient composition left out, each once with the first diagnostic that explains it. */
|
|
155
184
|
function skippedSelections(compositions) {
|
|
@@ -165,8 +194,8 @@ function skippedSelections(compositions) {
|
|
|
165
194
|
* first-party plugin has a slot whether or not a config names it yet, then each root's own
|
|
166
195
|
* composition package roots. Sync builds with these and the server derives the same key.
|
|
167
196
|
*/
|
|
168
|
-
function webPluginRootsOf(globalRoot, rootPackageRoots, environment) {
|
|
169
|
-
return [...require_index$2.catalogPackageRoots(globalRoot, environment), ...[...rootPackageRoots.values()].flat()];
|
|
197
|
+
async function webPluginRootsOf(globalRoot, rootPackageRoots, environment) {
|
|
198
|
+
return [...await require_index$2.catalogPackageRoots(globalRoot, environment), ...[...rootPackageRoots.values()].flat()];
|
|
170
199
|
}
|
|
171
200
|
/**
|
|
172
201
|
* Every package root the global web build covers: the catalogue packages, the global root,
|
|
@@ -174,78 +203,202 @@ function webPluginRootsOf(globalRoot, rootPackageRoots, environment) {
|
|
|
174
203
|
* opens it. A root whose configuration cannot be read is left out with a notice, as sync
|
|
175
204
|
* leaves it out of the build when it cannot compose it.
|
|
176
205
|
*/
|
|
177
|
-
function globalWebPluginRoots(targetRoot, homeDirectory, environment, onNotice) {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
206
|
+
async function globalWebPluginRoots(targetRoot, homeDirectory, environment, onNotice, t = englishMessage) {
|
|
207
|
+
return webPluginRootsOf((0, _agimon_ai_po_config_config.globalPoConfigDirectory)(homeDirectory, environment), await packageRootsByRoot(composeRoots(await admittedRoots(targetRoot, homeDirectory, environment, onNotice), homeDirectory, environment), onNotice, t), environment);
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* The Po home, every registered workspace whose folder exists and `targetRoot`, read without
|
|
211
|
+
* registering or removing anything. The server admits `targetRoot` when it opens it, but never
|
|
212
|
+
* serves a sandboxed one on the host.
|
|
213
|
+
*/
|
|
214
|
+
async function admittedRoots(targetRoot, homeDirectory, environment, onNotice) {
|
|
215
|
+
const globalRoot = (0, _agimon_ai_po_config_config.globalPoConfigDirectory)(homeDirectory, environment);
|
|
216
|
+
const records = workspaceRegistry(homeDirectory, environment, onNotice).list();
|
|
217
|
+
const admitted = [];
|
|
218
|
+
for (const workspace of environment.PO_CHECKOUT_PACKAGES !== void 0 ? [] : (0, _agimon_ai_po_core_history.localWorkspaceRecords)(records)) if (await node_fs_promises.default.access(workspace.root).then(() => true, () => false)) admitted.push(workspace.root);
|
|
219
|
+
const sandboxedRoots = new Set(records.filter((record) => record.sandbox !== void 0).map((record) => record.root));
|
|
220
|
+
return [.../* @__PURE__ */ new Set([
|
|
181
221
|
globalRoot,
|
|
182
222
|
...admitted,
|
|
183
223
|
targetRoot
|
|
184
|
-
])]
|
|
224
|
+
])].filter((root) => !sandboxedRoots.has(root));
|
|
185
225
|
}
|
|
186
226
|
/**
|
|
187
|
-
* Registers the repository
|
|
188
|
-
*
|
|
227
|
+
* Registers the repository the way the server admits it, relocating its sibling workspaces
|
|
228
|
+
* together after a move, and returns the workspace root it belongs to. A repository whose workspace
|
|
229
|
+
* runs in a sandbox is left alone, and returns undefined: it is not re-added or renamed, and its
|
|
230
|
+
* marker is neither read nor written, because the marker lives behind the repository's `.git`
|
|
231
|
+
* pointer, which the sandbox can control.
|
|
189
232
|
*/
|
|
190
|
-
function registerRepository(registry, repoRoot, onNotice) {
|
|
191
|
-
const checkoutRoot =
|
|
233
|
+
async function registerRepository(registry, repoRoot, onNotice, t) {
|
|
234
|
+
const checkoutRoot = await node_fs_promises.default.realpath(repoRoot);
|
|
235
|
+
if (registry.list().some((workspace) => workspace.root === checkoutRoot && workspace.sandbox !== void 0)) return void 0;
|
|
192
236
|
const { id, root, moved } = (0, _agimon_ai_po_core_history.identifyWorkspace)({
|
|
193
237
|
records: registry.list(),
|
|
194
238
|
checkoutRoot,
|
|
195
239
|
marker: (0, _agimon_ai_po_core_history.readWorkspaceMarker)(checkoutRoot)
|
|
196
240
|
});
|
|
197
241
|
const record = registry.list().find((workspace) => workspace.id === id);
|
|
198
|
-
if (record
|
|
242
|
+
if (record?.sandbox !== void 0) return void 0;
|
|
243
|
+
if (record === void 0) registry.add({
|
|
199
244
|
id,
|
|
200
|
-
root
|
|
201
|
-
...record?.name === void 0 ? {} : { name: record.name }
|
|
245
|
+
root
|
|
202
246
|
});
|
|
203
|
-
if (moved
|
|
247
|
+
if (moved && record !== void 0) {
|
|
248
|
+
const repositoryId = record.repositoryId ?? record.id;
|
|
249
|
+
for (const sibling of registry.list()) {
|
|
250
|
+
if (sibling.root !== record.root || (sibling.repositoryId ?? sibling.id) !== repositoryId) continue;
|
|
251
|
+
registry.add({
|
|
252
|
+
...sibling,
|
|
253
|
+
root
|
|
254
|
+
});
|
|
255
|
+
onNotice(t("cli.sync.progress.workspaceMoved", "workspace '{id}' moved to '{root}'", {
|
|
256
|
+
id: sibling.id,
|
|
257
|
+
root
|
|
258
|
+
}));
|
|
259
|
+
}
|
|
260
|
+
}
|
|
204
261
|
try {
|
|
205
262
|
if ((0, _agimon_ai_po_core_history.readWorkspaceMarker)(root) === void 0) (0, _agimon_ai_po_core_history.writeWorkspaceMarker)(root, id);
|
|
206
263
|
} catch (error) {
|
|
207
|
-
onNotice(
|
|
264
|
+
onNotice(t("cli.sync.progress.workspaceMarkerFailed", "'{root}' id could not be recorded in its git data: {reason}", {
|
|
265
|
+
root,
|
|
266
|
+
reason: errorMessage(error)
|
|
267
|
+
}));
|
|
208
268
|
}
|
|
209
269
|
return root;
|
|
210
270
|
}
|
|
211
271
|
/**
|
|
212
272
|
* The roots this sync covers: the Po home, every registered workspace whose folder exists,
|
|
213
273
|
* and the repository, registered first. Entries whose folder is gone are removed with a warning.
|
|
274
|
+
* Test mode covers only the Po home and the folder it was given, so another folder opened in the
|
|
275
|
+
* test console never blocks or rebuilds the checkout's sync.
|
|
214
276
|
*/
|
|
215
|
-
function resolveRoots(options, progress) {
|
|
277
|
+
async function resolveRoots(options, progress) {
|
|
278
|
+
const t = options.translateProgress ?? englishMessage;
|
|
216
279
|
const notice = (message) => progress.line(ROOTS_LABEL, message);
|
|
217
280
|
const registry = workspaceRegistry(options.homeDirectory, options.environment, notice);
|
|
218
|
-
const repository = options.repoRoot === void 0 || node_path.default.resolve(options.repoRoot) === node_path.default.resolve(options.globalRoot) ? void 0 : registerRepository(registry, options.repoRoot, notice);
|
|
281
|
+
const repository = options.repoRoot === void 0 || node_path.default.resolve(options.repoRoot) === node_path.default.resolve(options.globalRoot) ? void 0 : await registerRepository(registry, options.repoRoot, notice, t);
|
|
219
282
|
const live = [];
|
|
220
|
-
for (const workspace of registry.list()) {
|
|
221
|
-
if (
|
|
283
|
+
for (const workspace of options.environment.PO_CHECKOUT_PACKAGES !== void 0 ? [] : (0, _agimon_ai_po_core_history.localWorkspaceRecords)(registry.list())) {
|
|
284
|
+
if (await node_fs_promises.default.access(workspace.root).then(() => true, () => false)) {
|
|
222
285
|
live.push(workspace.root);
|
|
223
286
|
continue;
|
|
224
287
|
}
|
|
225
|
-
notice(
|
|
288
|
+
notice(t("cli.sync.progress.workspaceRemoved", "warning: removed workspace '{id}': '{root}' no longer exists", {
|
|
289
|
+
id: workspace.id,
|
|
290
|
+
root: workspace.root
|
|
291
|
+
}));
|
|
226
292
|
registry.remove(workspace.id);
|
|
227
293
|
}
|
|
228
|
-
return
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
294
|
+
return {
|
|
295
|
+
roots: [.../* @__PURE__ */ new Set([
|
|
296
|
+
options.globalRoot,
|
|
297
|
+
...live,
|
|
298
|
+
...repository === void 0 ? [] : [repository]
|
|
299
|
+
])],
|
|
300
|
+
repository
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Each root's presets configuration, parsed once per pass while its `presets.yaml` is unchanged.
|
|
305
|
+
* Scoped to one caller, never module state, so a later pass always reads the files again.
|
|
306
|
+
*/
|
|
307
|
+
function presetsReader(homeDirectory, environment) {
|
|
308
|
+
const parsed = /* @__PURE__ */ new Map();
|
|
309
|
+
return (root) => {
|
|
310
|
+
let mtime = "missing";
|
|
311
|
+
try {
|
|
312
|
+
mtime = String((0, node_fs.statSync)(node_path.default.join(root, ".po", "presets.yaml")).mtimeMs);
|
|
313
|
+
} catch {}
|
|
314
|
+
const key = `${root}\0${mtime}`;
|
|
315
|
+
let config = parsed.get(key);
|
|
316
|
+
if (config === void 0) {
|
|
317
|
+
config = (0, _agimon_ai_po_config_sync.loadPresetsConfigLenient)(root, homeDirectory, environment).config;
|
|
318
|
+
parsed.set(key, config);
|
|
319
|
+
}
|
|
320
|
+
return config;
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
function isWithin(parent, child) {
|
|
324
|
+
const relative = node_path.default.relative(parent, child);
|
|
325
|
+
return relative === "" || !relative.startsWith("..") && !node_path.default.isAbsolute(relative);
|
|
233
326
|
}
|
|
234
327
|
/** Local-path selections and checkout test overrides, stamped and built by the same local build pipeline. */
|
|
235
|
-
function localPackages(config, environment) {
|
|
328
|
+
function localPackages(config, environment, root, globalRoot) {
|
|
236
329
|
const definitions = [...config.default ? [config.default] : [], ...Object.values(config.layers)];
|
|
237
330
|
const packages = /* @__PURE__ */ new Map();
|
|
238
331
|
for (const definition of definitions) for (const configured of definition.packages ?? []) {
|
|
239
332
|
const selector = typeof configured === "string" ? configured : configured.name;
|
|
240
|
-
const
|
|
333
|
+
const local = (0, _agimon_ai_po_config_presets.isLocalPackageSpecifier)(selector);
|
|
334
|
+
const directory = local ? node_path.default.resolve(definition.baseDirectory, selector) : (0, _agimon_ai_po_core_moduleResolution.checkoutPackageRoot)((0, _agimon_ai_po_core_moduleResolution.splitPackageSpecifier)(selector).name, environment);
|
|
241
335
|
if (directory === void 0) continue;
|
|
336
|
+
const workspace = local && !isWithin(node_path.default.resolve(globalRoot), node_path.default.resolve(definition.baseDirectory)) ? root : void 0;
|
|
242
337
|
if (!packages.has(directory)) packages.set(directory, {
|
|
243
338
|
selector,
|
|
244
|
-
directory
|
|
339
|
+
directory,
|
|
340
|
+
...workspace === void 0 ? {} : { workspace }
|
|
245
341
|
});
|
|
246
342
|
}
|
|
247
343
|
return [...packages.values()];
|
|
248
344
|
}
|
|
345
|
+
async function canonical(file) {
|
|
346
|
+
return node_fs_promises.default.realpath(file).catch(() => node_path.default.resolve(file));
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Why sync must not run a local package's build script, or undefined when it may. A workspace's
|
|
350
|
+
* package must stay inside the workspace, symbolic links resolved, and the workspace must be trusted.
|
|
351
|
+
*/
|
|
352
|
+
async function localBuildRefusal(local, trusted) {
|
|
353
|
+
if (local.workspace === void 0) return void 0;
|
|
354
|
+
if (!isWithin(await canonical(local.workspace), await canonical(local.directory))) return `not built: '${local.selector}' resolves outside workspace '${local.workspace}'`;
|
|
355
|
+
return trusted.has(local.workspace) ? void 0 : LOCAL_NOT_TRUSTED;
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* The trusted workspaces, and whether the record must be written. The first read after upgrade
|
|
359
|
+
* finds no record and imports every root that has a package with a local build stamp.
|
|
360
|
+
*/
|
|
361
|
+
async function workspaceTrust(globalRoot, localByRoot) {
|
|
362
|
+
const recorded = await require_index$3.readTrustedWorkspaces(globalRoot);
|
|
363
|
+
if (recorded !== void 0) return {
|
|
364
|
+
trusted: recorded,
|
|
365
|
+
changed: false
|
|
366
|
+
};
|
|
367
|
+
const stamps = await require_localBuilds.readLocalBuildStamps(globalRoot);
|
|
368
|
+
const trusted = /* @__PURE__ */ new Set();
|
|
369
|
+
for (const [root, packages] of localByRoot) if (packages.some((local) => local.workspace !== void 0 && typeof stamps[local.directory] === "string")) trusted.add(root);
|
|
370
|
+
return {
|
|
371
|
+
trusted,
|
|
372
|
+
changed: true
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* What `po sync --check` reports about local packages across every admitted root: trusted ones
|
|
377
|
+
* whose build stamp moved since their last build are stale; refused ones are reported apart.
|
|
378
|
+
*/
|
|
379
|
+
async function localBuildReadiness(targetRoot, homeDirectory, environment) {
|
|
380
|
+
const globalRoot = (0, _agimon_ai_po_config_config.globalPoConfigDirectory)(homeDirectory, environment);
|
|
381
|
+
const presetsOf = presetsReader(homeDirectory, environment);
|
|
382
|
+
const roots = await admittedRoots(targetRoot, homeDirectory, environment, () => void 0);
|
|
383
|
+
const localByRoot = new Map(roots.map((root) => [root, localPackages(presetsOf(root), environment, root, globalRoot)]));
|
|
384
|
+
const { trusted } = await workspaceTrust(globalRoot, localByRoot);
|
|
385
|
+
const stamps = await require_localBuilds.readLocalBuildStamps(globalRoot);
|
|
386
|
+
const stale = [];
|
|
387
|
+
const refused = [];
|
|
388
|
+
for (const [root, packages] of localByRoot) for (const local of packages) {
|
|
389
|
+
const refusal = await localBuildRefusal(local, trusted);
|
|
390
|
+
if (refusal !== void 0) {
|
|
391
|
+
refused.push(`${local.selector} in ${root}: ${refusal}`);
|
|
392
|
+
continue;
|
|
393
|
+
}
|
|
394
|
+
if (typeof (await node_fs_promises.default.readFile(node_path.default.join(local.directory, PACKAGE_MANIFEST), "utf8").then((text) => JSON.parse(text)).catch(() => void 0))?.scripts?.build !== "string") continue;
|
|
395
|
+
if (stamps[local.directory] !== await require_localBuilds.localBuildStamp(local.directory)) stale.push(`local package is not built: ${local.selector} (${local.directory})`);
|
|
396
|
+
}
|
|
397
|
+
return {
|
|
398
|
+
stale,
|
|
399
|
+
refused
|
|
400
|
+
};
|
|
401
|
+
}
|
|
249
402
|
/**
|
|
250
403
|
* SHA-256 over every mode's composition fingerprint, or why the root cannot be composed. The
|
|
251
404
|
* pointer records it per root, so a server can tell a root whose selection changed since the
|
|
@@ -265,9 +418,9 @@ function rootSelectionFingerprint(root, homeDirectory, environment) {
|
|
|
265
418
|
}
|
|
266
419
|
}
|
|
267
420
|
/** The po package version this process runs from, or why it cannot be read. */
|
|
268
|
-
function poPackageVersion() {
|
|
421
|
+
async function poPackageVersion() {
|
|
269
422
|
try {
|
|
270
|
-
const manifest = JSON.parse(
|
|
423
|
+
const manifest = JSON.parse(await node_fs_promises.default.readFile(node_path.default.join(require_entryResolution.poPackageRoot(), PACKAGE_MANIFEST), "utf8"));
|
|
271
424
|
return typeof manifest.version === "string" ? manifest.version : "unversioned";
|
|
272
425
|
} catch (error) {
|
|
273
426
|
return `unreadable:${errorMessage(error)}`;
|
|
@@ -278,22 +431,32 @@ function poPackageVersion() {
|
|
|
278
431
|
* version it builds with. Sync records it in the pointer; a server whose identity differs
|
|
279
432
|
* refuses that pointer's builds and syncs with its own install.
|
|
280
433
|
*/
|
|
281
|
-
function syncHostIdentity(globalRoot, environment) {
|
|
282
|
-
const checkout = environment.
|
|
283
|
-
|
|
434
|
+
async function syncHostIdentity(globalRoot, environment) {
|
|
435
|
+
const checkout = environment.PO_CHECKOUT_PACKAGES ? `+checkout@${node_crypto.default.createHash("sha256").update(JSON.stringify([
|
|
436
|
+
environment.PO_ENVIRONMENT,
|
|
437
|
+
environment.PO_HOME,
|
|
438
|
+
environment.PO_CHECKOUT_PACKAGES
|
|
439
|
+
])).digest("hex")}` : "";
|
|
440
|
+
return `po@${await poPackageVersion()}+po-web@${await require_index.webHostVersion(globalRoot, environment)}${checkout}`;
|
|
284
441
|
}
|
|
285
|
-
/** The fast-exit signature: catalogue
|
|
286
|
-
function syncSignature(options, roots, catalogueHash) {
|
|
442
|
+
/** The fast-exit signature: catalogue, root selections/local stamps, host identity and derived web build. */
|
|
443
|
+
async function syncSignature(options, roots, catalogueHash, presetsOf) {
|
|
287
444
|
const { homeDirectory, environment } = options;
|
|
288
445
|
const value = {
|
|
289
446
|
format: SIGNATURE_FORMAT,
|
|
290
447
|
catalogueHash,
|
|
291
|
-
roots: roots.map((root) => ({
|
|
448
|
+
roots: await Promise.all(roots.map(async (root) => ({
|
|
292
449
|
root,
|
|
293
450
|
selection: rootSelectionFingerprint(root, homeDirectory, environment),
|
|
294
|
-
local: localPackages((
|
|
295
|
-
})),
|
|
296
|
-
host: syncHostIdentity(options.globalRoot, environment)
|
|
451
|
+
local: await Promise.all(localPackages(presetsOf(root), environment, root, options.globalRoot).map(async ({ directory }) => [directory, await require_localBuilds.localBuildStamp(directory)]))
|
|
452
|
+
}))),
|
|
453
|
+
host: await syncHostIdentity(options.globalRoot, environment),
|
|
454
|
+
web: options.skipArtifactBuilds === true ? void 0 : await require_index.readGlobalWebBuildStatus({
|
|
455
|
+
poHome: options.globalRoot,
|
|
456
|
+
pluginRoots: await globalWebPluginRoots(options.globalRoot, homeDirectory, environment, () => void 0),
|
|
457
|
+
environment
|
|
458
|
+
}),
|
|
459
|
+
...options.skipArtifactBuilds === true ? { skipArtifactBuilds: true } : {}
|
|
297
460
|
};
|
|
298
461
|
return node_crypto.default.createHash("sha256").update(JSON.stringify(value)).digest("hex");
|
|
299
462
|
}
|
|
@@ -304,9 +467,9 @@ function syncLastAttemptPath(globalRoot) {
|
|
|
304
467
|
return node_path.default.join(globalRoot, BUILD_DIRECTORY, LAST_ATTEMPT_FILE);
|
|
305
468
|
}
|
|
306
469
|
/** The current pointer, or undefined when sync has not written one yet or it is unreadable. */
|
|
307
|
-
function readSyncPointer(globalRoot) {
|
|
470
|
+
async function readSyncPointer(globalRoot) {
|
|
308
471
|
try {
|
|
309
|
-
const parsed = JSON.parse(
|
|
472
|
+
const parsed = JSON.parse(await node_fs_promises.default.readFile(syncPointerPath(globalRoot), "utf8"));
|
|
310
473
|
return typeof parsed.signature === "string" && typeof parsed.generation === "number" ? parsed : void 0;
|
|
311
474
|
} catch {
|
|
312
475
|
return;
|
|
@@ -321,42 +484,46 @@ function pointerArtifacts(globalRoot, pointer) {
|
|
|
321
484
|
...pointer.mcpKeys.map((key) => node_path.default.join(build, "mcp-app", key, MCP_APP_FILE))
|
|
322
485
|
];
|
|
323
486
|
}
|
|
487
|
+
/** Whether every artifact `pointer` names exists. */
|
|
488
|
+
async function artifactsExist(globalRoot, pointer) {
|
|
489
|
+
return (await Promise.all(pointerArtifacts(globalRoot, pointer).map((file) => node_fs_promises.default.access(file).then(() => true, () => false)))).every(Boolean);
|
|
490
|
+
}
|
|
324
491
|
/** The report of the last sync attempt, successful or not, or undefined when there is none. */
|
|
325
|
-
function readSyncLastAttempt(globalRoot) {
|
|
492
|
+
async function readSyncLastAttempt(globalRoot) {
|
|
326
493
|
try {
|
|
327
|
-
const parsed = JSON.parse(
|
|
494
|
+
const parsed = JSON.parse(await node_fs_promises.default.readFile(syncLastAttemptPath(globalRoot), "utf8"));
|
|
328
495
|
return Array.isArray(parsed.roots) ? parsed : void 0;
|
|
329
496
|
} catch {
|
|
330
497
|
return;
|
|
331
498
|
}
|
|
332
499
|
}
|
|
333
|
-
function writeJsonFile(file, value) {
|
|
334
|
-
(0,
|
|
500
|
+
async function writeJsonFile(file, value) {
|
|
501
|
+
await (0, _agimon_ai_po_core_platform.writeFileAtomic)((0, _agimon_ai_po_core_nodePlatform.createNodePlatform)().env(node_path.default.dirname(file)), file, `${JSON.stringify(value, null, 2)}\n`, _agimon_ai_po_core_platform.BACKGROUND_CONTEXT);
|
|
335
502
|
}
|
|
336
|
-
function readHolder(lockPath) {
|
|
503
|
+
async function readHolder(lockPath) {
|
|
337
504
|
try {
|
|
338
|
-
const parsed = JSON.parse(
|
|
505
|
+
const parsed = JSON.parse(await node_fs_promises.default.readFile(lockPath, "utf8"));
|
|
339
506
|
return typeof parsed.pid === "number" ? parsed : void 0;
|
|
340
507
|
} catch {
|
|
341
508
|
return;
|
|
342
509
|
}
|
|
343
510
|
}
|
|
344
|
-
function lockIsStale(lockPath, deps) {
|
|
345
|
-
const holder = readHolder(lockPath);
|
|
511
|
+
async function lockIsStale(lockPath, deps) {
|
|
512
|
+
const holder = await readHolder(lockPath);
|
|
346
513
|
if (holder !== void 0) return !deps.isAlive(holder.pid);
|
|
347
514
|
try {
|
|
348
|
-
return deps.now().getTime() -
|
|
515
|
+
return deps.now().getTime() - (await node_fs_promises.default.stat(lockPath)).mtimeMs > UNREADABLE_LOCK_GRACE_MS;
|
|
349
516
|
} catch {
|
|
350
517
|
return true;
|
|
351
518
|
}
|
|
352
519
|
}
|
|
353
|
-
function tryCreateLock(lockPath, holder) {
|
|
520
|
+
async function tryCreateLock(lockPath, holder) {
|
|
354
521
|
try {
|
|
355
|
-
const descriptor =
|
|
522
|
+
const descriptor = await node_fs_promises.default.open(lockPath, "wx");
|
|
356
523
|
try {
|
|
357
|
-
|
|
524
|
+
await descriptor.writeFile(JSON.stringify(holder));
|
|
358
525
|
} finally {
|
|
359
|
-
|
|
526
|
+
await descriptor.close();
|
|
360
527
|
}
|
|
361
528
|
return true;
|
|
362
529
|
} catch (error) {
|
|
@@ -370,31 +537,31 @@ function tryCreateLock(lockPath, holder) {
|
|
|
370
537
|
* there: a lock that turns out live is linked back (link never replaces), a stale one is dropped
|
|
371
538
|
* before the exclusive create, which at most one taker wins.
|
|
372
539
|
*/
|
|
373
|
-
function takeOverStaleLock(lockPath, holder, deps) {
|
|
540
|
+
async function takeOverStaleLock(lockPath, holder, deps) {
|
|
374
541
|
const moved = `${lockPath}.${String(deps.pid)}.${node_crypto.default.randomUUID()}.stale`;
|
|
375
542
|
try {
|
|
376
|
-
|
|
543
|
+
await node_fs_promises.default.rename(lockPath, moved);
|
|
377
544
|
} catch (error) {
|
|
378
545
|
if (error.code === NO_SUCH_FILE) return tryCreateLock(lockPath, holder);
|
|
379
546
|
throw error;
|
|
380
547
|
}
|
|
381
548
|
try {
|
|
382
|
-
if (!lockIsStale(moved, deps)) {
|
|
549
|
+
if (!await lockIsStale(moved, deps)) {
|
|
383
550
|
try {
|
|
384
|
-
|
|
551
|
+
await node_fs_promises.default.link(moved, lockPath);
|
|
385
552
|
} catch (error) {
|
|
386
553
|
if (error.code !== ALREADY_EXISTS) throw error;
|
|
387
554
|
}
|
|
388
555
|
return false;
|
|
389
556
|
}
|
|
390
557
|
} finally {
|
|
391
|
-
|
|
558
|
+
await node_fs_promises.default.rm(moved, { force: true });
|
|
392
559
|
}
|
|
393
560
|
return tryCreateLock(lockPath, holder);
|
|
394
561
|
}
|
|
395
562
|
/** Creates the lock, taking over one whose holder is dead. Never inspects other processes beyond `kill(pid, 0)`. */
|
|
396
|
-
function acquireLock(lockPath, origin, deps) {
|
|
397
|
-
|
|
563
|
+
async function acquireLock(lockPath, origin, deps) {
|
|
564
|
+
await node_fs_promises.default.mkdir(node_path.default.dirname(lockPath), { recursive: true });
|
|
398
565
|
const token = node_crypto.default.randomUUID();
|
|
399
566
|
const holder = {
|
|
400
567
|
pid: deps.pid,
|
|
@@ -402,17 +569,17 @@ function acquireLock(lockPath, origin, deps) {
|
|
|
402
569
|
startedAt: deps.now().toISOString(),
|
|
403
570
|
origin
|
|
404
571
|
};
|
|
405
|
-
if (tryCreateLock(lockPath, holder)) return {
|
|
572
|
+
if (await tryCreateLock(lockPath, holder)) return {
|
|
406
573
|
acquired: true,
|
|
407
574
|
token
|
|
408
575
|
};
|
|
409
|
-
if (lockIsStale(lockPath, deps) && takeOverStaleLock(lockPath, holder, deps)) return {
|
|
576
|
+
if (await lockIsStale(lockPath, deps) && await takeOverStaleLock(lockPath, holder, deps)) return {
|
|
410
577
|
acquired: true,
|
|
411
578
|
token
|
|
412
579
|
};
|
|
413
580
|
return {
|
|
414
581
|
acquired: false,
|
|
415
|
-
holder: readHolder(lockPath)
|
|
582
|
+
holder: await readHolder(lockPath)
|
|
416
583
|
};
|
|
417
584
|
}
|
|
418
585
|
/**
|
|
@@ -420,19 +587,44 @@ function acquireLock(lockPath, origin, deps) {
|
|
|
420
587
|
* the busy report to stop with. A takeover that moved a live lock aside can let a third taker
|
|
421
588
|
* create a new one, so a holder checks before each step whose overlap would do harm.
|
|
422
589
|
*/
|
|
423
|
-
function lostLock(lockPath, token, deps) {
|
|
424
|
-
const holder = readHolder(lockPath);
|
|
590
|
+
async function lostLock(lockPath, token, deps, options) {
|
|
591
|
+
const holder = await readHolder(lockPath);
|
|
425
592
|
if (holder?.token === token) return void 0;
|
|
426
|
-
|
|
593
|
+
const by = holder === void 0 ? "another process" : `pid ${String(holder.pid)}`;
|
|
594
|
+
return emptyReport("busy", [errorText(options)("cli.sync.failure.lockLost", "po sync lost its lock to {holder}", { holder: by })], deps);
|
|
427
595
|
}
|
|
428
|
-
function releaseLock(lockPath, token) {
|
|
429
|
-
if (readHolder(lockPath)?.token === token)
|
|
596
|
+
async function releaseLock(lockPath, token) {
|
|
597
|
+
if ((await readHolder(lockPath))?.token === token) await node_fs_promises.default.rm(lockPath, { force: true });
|
|
598
|
+
}
|
|
599
|
+
/** Serializes runtime npm imports with sync, including sync's child process. */
|
|
600
|
+
async function withSyncLock(globalRoot, signal, action) {
|
|
601
|
+
const waiting = AbortSignal.any([AbortSignal.timeout(12e4), ...signal ? [signal] : []]);
|
|
602
|
+
const lockPath = syncLockPath(globalRoot);
|
|
603
|
+
for (;;) {
|
|
604
|
+
waiting.throwIfAborted();
|
|
605
|
+
const lock = await acquireLock(lockPath, "background", DEFAULT_DEPS);
|
|
606
|
+
if (!lock.acquired) {
|
|
607
|
+
await (0, node_timers_promises.setTimeout)(50, void 0, { signal: waiting });
|
|
608
|
+
continue;
|
|
609
|
+
}
|
|
610
|
+
try {
|
|
611
|
+
waiting.throwIfAborted();
|
|
612
|
+
if ((await readHolder(lockPath))?.token !== lock.token) continue;
|
|
613
|
+
return await action();
|
|
614
|
+
} finally {
|
|
615
|
+
await releaseLock(lockPath, lock.token);
|
|
616
|
+
}
|
|
617
|
+
}
|
|
430
618
|
}
|
|
431
619
|
/** Consumes the rerun marker; true when a background run asked for another pass. */
|
|
432
|
-
function takeRerunRequest(rerunPath) {
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
620
|
+
async function takeRerunRequest(rerunPath) {
|
|
621
|
+
try {
|
|
622
|
+
await node_fs_promises.default.unlink(rerunPath);
|
|
623
|
+
return true;
|
|
624
|
+
} catch (error) {
|
|
625
|
+
if (error.code === NO_SUCH_FILE) return false;
|
|
626
|
+
throw error;
|
|
627
|
+
}
|
|
436
628
|
}
|
|
437
629
|
function emptyReport(status, errors, deps) {
|
|
438
630
|
return {
|
|
@@ -475,35 +667,27 @@ function steps(emit) {
|
|
|
475
667
|
* Drops old builds and unreferenced store content once installs and builds are done.
|
|
476
668
|
* Never fatal: a failed prune leaves everything for the next explicit sync.
|
|
477
669
|
*/
|
|
478
|
-
async function pruneStep(progress, prune, input) {
|
|
479
|
-
const done = progress.start(PRUNE_LABEL, "dropping old builds and unused packages");
|
|
670
|
+
async function pruneStep(progress, prune, input, t) {
|
|
671
|
+
const done = progress.start(PRUNE_LABEL, t("cli.sync.progress.pruning", "dropping old builds and unused packages"));
|
|
480
672
|
try {
|
|
481
673
|
const result = await prune(input);
|
|
482
|
-
const runtime = "skipped" in result.runtime ? result.runtime.skipped :
|
|
483
|
-
|
|
674
|
+
const runtime = "skipped" in result.runtime ? result.runtime.skipped : t("cli.sync.progress.bytesReleased", "{size} MB of packages released", { size: (result.runtime.bytes / BYTES_PER_MEGABYTE).toFixed(1) });
|
|
675
|
+
const count = result.builds.length;
|
|
676
|
+
done(count === 1 ? t("cli.sync.progress.prunedOne", "removed {count} old build, {runtime}", {
|
|
677
|
+
count,
|
|
678
|
+
runtime
|
|
679
|
+
}) : t("cli.sync.progress.prunedMany", "removed {count} old builds, {runtime}", {
|
|
680
|
+
count,
|
|
681
|
+
runtime
|
|
682
|
+
}));
|
|
484
683
|
} catch (error) {
|
|
485
|
-
done(
|
|
684
|
+
done(t("cli.sync.progress.pruneFailed", "failed: {reason}", { reason: errorMessage(error) }));
|
|
486
685
|
}
|
|
487
686
|
}
|
|
488
|
-
/** Regenerates the hook files the other frontends read before any harness code runs, in a root that has the emitter. */
|
|
489
|
-
function emitFrontendHooks(root, progress, commands) {
|
|
490
|
-
const emitter = node_path.default.join(root, HOOK_EMITTER);
|
|
491
|
-
if (!node_fs.default.existsSync(emitter)) return;
|
|
492
|
-
commands.push(`${process.execPath} ${emitter} --write`);
|
|
493
|
-
const result = (0, node_child_process.spawnSync)(process.execPath, [emitter, "--write"], {
|
|
494
|
-
cwd: root,
|
|
495
|
-
encoding: "utf8"
|
|
496
|
-
});
|
|
497
|
-
if (result.status === 0) {
|
|
498
|
-
progress.line(HOOKS_LABEL, `regenerated for Claude Code and Codex in '${root}'`);
|
|
499
|
-
return;
|
|
500
|
-
}
|
|
501
|
-
progress.line(HOOKS_LABEL, `emit-hooks failed in '${root}' (${result.stderr?.trim() || `exit ${String(result.status)}`})`);
|
|
502
|
-
}
|
|
503
687
|
/** A path with its symlinks resolved, or as given when it does not exist. */
|
|
504
|
-
function realPath(file) {
|
|
688
|
+
async function realPath(file) {
|
|
505
689
|
try {
|
|
506
|
-
return
|
|
690
|
+
return await node_fs_promises.default.realpath(file);
|
|
507
691
|
} catch {
|
|
508
692
|
return node_path.default.resolve(file);
|
|
509
693
|
}
|
|
@@ -513,16 +697,16 @@ function realPath(file) {
|
|
|
513
697
|
* widget packages' built files, which the signature does not cover, so a rebuilt `dist/` moves
|
|
514
698
|
* the key without moving the signature.
|
|
515
699
|
*/
|
|
516
|
-
function mcpAppsBuilt(globalRoot, roots, homeDirectory, environment) {
|
|
700
|
+
async function mcpAppsBuilt(globalRoot, roots, homeDirectory, environment) {
|
|
517
701
|
for (const compositions of composeRoots(roots, homeDirectory, environment).values()) {
|
|
518
702
|
if (compositions instanceof Error) continue;
|
|
519
703
|
let key;
|
|
520
704
|
try {
|
|
521
|
-
key = require_mcpAppBuild.mcpAppKey(require_mcpBundle.mcpPluginCandidates(compositions));
|
|
705
|
+
key = await require_mcpAppBuild.mcpAppKey(await require_mcpBundle.mcpPluginCandidates(compositions));
|
|
522
706
|
} catch {
|
|
523
707
|
return false;
|
|
524
708
|
}
|
|
525
|
-
if (key !== void 0 && !
|
|
709
|
+
if (key !== void 0 && !await node_fs_promises.default.access(node_path.default.join(globalRoot, BUILD_DIRECTORY, "mcp-app", key, MCP_APP_FILE)).then(() => true, () => false)) return false;
|
|
526
710
|
}
|
|
527
711
|
return true;
|
|
528
712
|
}
|
|
@@ -533,12 +717,17 @@ function mcpAppsBuilt(globalRoot, roots, homeDirectory, environment) {
|
|
|
533
717
|
async function syncOnce(options, deps, emit, lost) {
|
|
534
718
|
const { homeDirectory, environment, globalRoot } = options;
|
|
535
719
|
const progress = steps(emit);
|
|
720
|
+
const t = options.translateProgress ?? englishMessage;
|
|
721
|
+
const failure = (make) => make(errorText(options));
|
|
536
722
|
const commands = [];
|
|
537
|
-
const roots = resolveRoots(options, progress);
|
|
538
|
-
const
|
|
539
|
-
const
|
|
540
|
-
|
|
541
|
-
|
|
723
|
+
const { roots, repository } = await resolveRoots(options, progress);
|
|
724
|
+
const presetsOf = presetsReader(homeDirectory, environment);
|
|
725
|
+
const catalogueHash = await require_index$2.packageCatalogHash(environment);
|
|
726
|
+
const previous = await readSyncPointer(globalRoot);
|
|
727
|
+
const skipBuilds = options.skipArtifactBuilds === true;
|
|
728
|
+
const deferred = new Set(skipBuilds ? [] : options.deferArtifacts ?? []);
|
|
729
|
+
if (previous !== void 0 && (options.origin === "background" || previous.roots.every((root) => root.unsynced.length === 0)) && previous.signature === await syncSignature(options, roots, catalogueHash, presetsOf) && (previous.deferred ?? []).every((kind) => deferred.has(kind)) && await artifactsExist(globalRoot, previous) && (skipBuilds || deferred.has("mcp-app") || await mcpAppsBuilt(globalRoot, roots, homeDirectory, environment))) {
|
|
730
|
+
progress.line(ROOTS_LABEL, t("cli.sync.progress.noChanges", "nothing changed since generation {generation}", { generation: previous.generation }));
|
|
542
731
|
return {
|
|
543
732
|
...emptyReport("noop", [], deps),
|
|
544
733
|
generation: previous.generation,
|
|
@@ -568,17 +757,17 @@ async function syncOnce(options, deps, emit, lost) {
|
|
|
568
757
|
commands
|
|
569
758
|
};
|
|
570
759
|
};
|
|
571
|
-
const lostBeforeInstall = lost();
|
|
760
|
+
const lostBeforeInstall = await lost();
|
|
572
761
|
if (lostBeforeInstall !== void 0) return lostBeforeInstall;
|
|
573
|
-
const packagesDone = progress.start(PACKAGES_LABEL, "checking configured packages for updates");
|
|
762
|
+
const packagesDone = progress.start(PACKAGES_LABEL, t("cli.sync.progress.checkingPackages", "checking configured packages for updates"));
|
|
574
763
|
let packages;
|
|
575
764
|
try {
|
|
576
|
-
const configOf =
|
|
765
|
+
const configOf = presetsOf;
|
|
577
766
|
const globalConfig = configOf(globalRoot);
|
|
578
|
-
const specifiers = new Set(require_index$2.catalogInstallSpecifiers(environment));
|
|
767
|
+
const specifiers = new Set(await require_index$2.catalogInstallSpecifiers(environment));
|
|
579
768
|
for (const root of roots) {
|
|
580
769
|
const config = configOf(root);
|
|
581
|
-
for (const specifier of require_index$2.runtimeLayerPackageSpecifiers(config, Object.keys(config.layers), root)) specifiers.add(specifier);
|
|
770
|
+
for (const specifier of await require_index$2.runtimeLayerPackageSpecifiers(config, Object.keys(config.layers), root)) specifiers.add(specifier);
|
|
582
771
|
}
|
|
583
772
|
packages = await deps.install({
|
|
584
773
|
repoRoot: globalRoot,
|
|
@@ -588,23 +777,38 @@ async function syncOnce(options, deps, emit, lost) {
|
|
|
588
777
|
refresh: options.origin === "cli",
|
|
589
778
|
specifiers: [...specifiers],
|
|
590
779
|
exactManifest: true,
|
|
591
|
-
onProgress: (message) => progress.line(PACKAGES_LABEL, message)
|
|
780
|
+
onProgress: (message) => progress.line(PACKAGES_LABEL, message),
|
|
781
|
+
...options.translateProgress ? { translateProgress: options.translateProgress } : {}
|
|
592
782
|
});
|
|
593
783
|
} catch (error) {
|
|
594
|
-
packagesDone("failed");
|
|
595
|
-
return report("failed", [
|
|
784
|
+
packagesDone(t("cli.sync.progress.failed", "failed"));
|
|
785
|
+
return report("failed", [failure((t) => t("cli.sync.failure.install", "Installing packages failed: {reason}", { reason: errorMessage(error) }))], null, []);
|
|
786
|
+
}
|
|
787
|
+
packagesDone(packageSummary(packages, t));
|
|
788
|
+
const localByRoot = new Map(roots.map((root) => [root, localPackages(presetsOf(root), environment, root, globalRoot)]));
|
|
789
|
+
const trust = await workspaceTrust(globalRoot, localByRoot);
|
|
790
|
+
if (options.origin === "cli" && repository !== void 0 && !trust.trusted.has(repository)) {
|
|
791
|
+
trust.trusted.add(repository);
|
|
792
|
+
trust.changed = true;
|
|
793
|
+
}
|
|
794
|
+
if (trust.changed) await require_index$3.writeTrustedWorkspaces(globalRoot, trust.trusted);
|
|
795
|
+
const localDirectories = [];
|
|
796
|
+
for (const [root, packagesOfRoot] of localByRoot) for (const local of packagesOfRoot) {
|
|
797
|
+
const refusal = await localBuildRefusal(local, trust.trusted);
|
|
798
|
+
if (refusal === void 0) localDirectories.push(local.directory);
|
|
799
|
+
else unsynced.get(root)?.push({
|
|
800
|
+
selector: local.selector,
|
|
801
|
+
reason: refusal
|
|
802
|
+
});
|
|
596
803
|
}
|
|
597
|
-
packagesDone(packageSummary(packages));
|
|
598
|
-
const localByRoot = new Map(roots.map((root) => [root, localPackages((0, _agimon_ai_po_config_majorModes.loadMajorModesConfigLenient)(root, homeDirectory, environment).config, environment)]));
|
|
599
|
-
const localDirectories = [...localByRoot.values()].flat().map(({ directory }) => directory);
|
|
600
804
|
if (localDirectories.length > 0) {
|
|
601
|
-
const localDone = progress.start(LOCAL_LABEL, "building local packages");
|
|
805
|
+
const localDone = progress.start(LOCAL_LABEL, t("cli.sync.progress.buildingLocal", "building local packages"));
|
|
602
806
|
const outcomes = await require_localBuilds.buildLocalPackages({
|
|
603
807
|
globalRoot,
|
|
604
808
|
environment,
|
|
605
809
|
directories: localDirectories,
|
|
606
810
|
onCommand: (command) => commands.push(command),
|
|
607
|
-
onNotice: (
|
|
811
|
+
onNotice: (_message, packageName) => progress.line(LOCAL_LABEL, t("cli.sync.progress.buildingPackage", "building {name}", { name: packageName }))
|
|
608
812
|
});
|
|
609
813
|
let failed = 0;
|
|
610
814
|
for (const [root, packagesOfRoot] of localByRoot) for (const { selector, directory } of packagesOfRoot) {
|
|
@@ -617,7 +821,8 @@ async function syncOnce(options, deps, emit, lost) {
|
|
|
617
821
|
});
|
|
618
822
|
}
|
|
619
823
|
for (const outcome of outcomes.values()) if (outcome.status === "failed") failed += 1;
|
|
620
|
-
|
|
824
|
+
const count = outcomes.size;
|
|
825
|
+
localDone(failed > 0 ? t("cli.sync.progress.localFailed", "{count} failed", { count: failed }) : count === 1 ? t("cli.sync.progress.localReadyOne", "{count} package ready", { count }) : t("cli.sync.progress.localReadyMany", "{count} packages ready", { count }));
|
|
621
826
|
}
|
|
622
827
|
const composed = composeRoots(roots, homeDirectory, environment);
|
|
623
828
|
for (const [root, compositions] of composed) {
|
|
@@ -625,71 +830,91 @@ async function syncOnce(options, deps, emit, lost) {
|
|
|
625
830
|
const entries = unsynced.get(root) ?? [];
|
|
626
831
|
for (const skipped of skippedSelections(compositions)) if (!entries.some((entry) => entry.selector === skipped.selector)) entries.push(skipped);
|
|
627
832
|
}
|
|
628
|
-
const webDone = progress.start(WEB_LABEL, "ensuring the global web build");
|
|
629
|
-
let rootPackageRoots = packageRootsByRoot(composed, (message) => progress.line(WEB_LABEL, message));
|
|
630
|
-
const buildWeb = (packageRoots) => deps.buildWeb({
|
|
833
|
+
const webDone = progress.start(WEB_LABEL, t("cli.sync.progress.buildingWeb", "ensuring the global web build"));
|
|
834
|
+
let rootPackageRoots = await packageRootsByRoot(composed, (message) => progress.line(WEB_LABEL, message), t);
|
|
835
|
+
const buildWeb = async (packageRoots) => deps.buildWeb({
|
|
631
836
|
poHome: globalRoot,
|
|
632
|
-
pluginRoots: webPluginRootsOf(globalRoot, packageRoots, environment),
|
|
837
|
+
pluginRoots: await webPluginRootsOf(globalRoot, packageRoots, environment),
|
|
633
838
|
environment,
|
|
634
839
|
onNotice: (message) => progress.line(WEB_LABEL, message)
|
|
635
840
|
});
|
|
636
|
-
let built =
|
|
841
|
+
let built = skipBuilds ? {
|
|
842
|
+
status: "skipped",
|
|
843
|
+
reason: ARTIFACT_BUILDS_SKIPPED
|
|
844
|
+
} : await buildWeb(rootPackageRoots);
|
|
637
845
|
if (built.status === "failed") {
|
|
638
|
-
const
|
|
639
|
-
const
|
|
846
|
+
const buildFailure = built.reason;
|
|
847
|
+
const local = new Set(await Promise.all(localDirectories.map(realPath)));
|
|
848
|
+
const withoutLocal = /* @__PURE__ */ new Map();
|
|
849
|
+
for (const [root, packageRoots] of rootPackageRoots) {
|
|
850
|
+
const resolved = await Promise.all(packageRoots.map(realPath));
|
|
851
|
+
withoutLocal.set(root, packageRoots.filter((_, index) => !local.has(resolved[index])));
|
|
852
|
+
}
|
|
640
853
|
const leftOut = [...rootPackageRoots].some(([root, packageRoots]) => withoutLocal.get(root)?.length !== packageRoots.length);
|
|
641
854
|
const retried = leftOut ? await buildWeb(withoutLocal) : built;
|
|
642
855
|
if (retried.status === "failed") {
|
|
643
|
-
webDone("failed");
|
|
644
|
-
|
|
645
|
-
|
|
856
|
+
webDone(t("cli.sync.progress.failed", "failed"));
|
|
857
|
+
return report("failed", [leftOut ? failure((t) => t("cli.sync.failure.webRetry", "The global web build failed: {reason}; without local copies: {retry}", {
|
|
858
|
+
reason: buildFailure,
|
|
859
|
+
retry: retried.reason
|
|
860
|
+
})) : failure((t) => t("cli.sync.failure.web", "The global web build failed: {reason}", { reason: buildFailure }))], null, []);
|
|
646
861
|
}
|
|
647
862
|
for (const [root, packagesOfRoot] of localByRoot) {
|
|
648
|
-
const included = new Set((rootPackageRoots.get(root) ?? []).map(realPath));
|
|
863
|
+
const included = new Set(await Promise.all((rootPackageRoots.get(root) ?? []).map(realPath)));
|
|
649
864
|
const entries = unsynced.get(root) ?? [];
|
|
650
|
-
for (const { selector, directory } of packagesOfRoot) if (included.has(realPath(directory)) && !entries.some((entry) => entry.selector === selector)) entries.push({
|
|
865
|
+
for (const { selector, directory } of packagesOfRoot) if (included.has(await realPath(directory)) && !entries.some((entry) => entry.selector === selector)) entries.push({
|
|
651
866
|
selector,
|
|
652
|
-
reason: `left out of the web build, which failed with it: ${
|
|
867
|
+
reason: `left out of the web build, which failed with it: ${buildFailure}`
|
|
653
868
|
});
|
|
654
869
|
}
|
|
655
|
-
progress.line(WEB_LABEL,
|
|
870
|
+
progress.line(WEB_LABEL, t("cli.sync.progress.webRetried", "built without local copies after: {reason}", { reason: built.reason }));
|
|
656
871
|
rootPackageRoots = withoutLocal;
|
|
657
872
|
built = retried;
|
|
658
873
|
}
|
|
659
|
-
const pluginRoots = webPluginRootsOf(globalRoot, rootPackageRoots, environment);
|
|
874
|
+
const pluginRoots = await webPluginRootsOf(globalRoot, rootPackageRoots, environment);
|
|
660
875
|
const web = built.status === "skipped" ? built : {
|
|
661
876
|
status: built.status,
|
|
662
877
|
key: built.build.key
|
|
663
878
|
};
|
|
664
|
-
|
|
879
|
+
const skipped = skipBuilds ? t("cli.sync.progress.skipped", "skipped (--skip-artifact-builds)") : void 0;
|
|
880
|
+
webDone(artifactSummary(web, t, skipped));
|
|
665
881
|
const webKey = web.status === "skipped" ? null : web.key;
|
|
666
|
-
const nativeDone = progress.start(NATIVE_LABEL, "ensuring the global native build");
|
|
667
|
-
const nativeBuilt =
|
|
882
|
+
const nativeDone = progress.start(NATIVE_LABEL, t("cli.sync.progress.buildingNative", "ensuring the global native build"));
|
|
883
|
+
const nativeBuilt = skipBuilds ? {
|
|
884
|
+
status: "skipped",
|
|
885
|
+
reason: ARTIFACT_BUILDS_SKIPPED
|
|
886
|
+
} : deferred.has("native") ? {
|
|
887
|
+
status: "skipped",
|
|
888
|
+
reason: NATIVE_DEFERRED
|
|
889
|
+
} : await deps.buildNative({
|
|
668
890
|
poHome: globalRoot,
|
|
669
891
|
pluginRoots,
|
|
670
892
|
onNotice: (message) => progress.line(NATIVE_LABEL, message)
|
|
671
893
|
});
|
|
672
894
|
if (nativeBuilt.status === "failed") {
|
|
673
|
-
nativeDone("failed");
|
|
674
|
-
return report("failed", [
|
|
895
|
+
nativeDone(t("cli.sync.progress.failed", "failed"));
|
|
896
|
+
return report("failed", [failure((t) => t("cli.sync.failure.native", "The global native build failed: {reason}", { reason: nativeBuilt.reason }))], webKey, []);
|
|
675
897
|
}
|
|
676
898
|
const native = nativeBuilt.status === "skipped" ? nativeBuilt : {
|
|
677
899
|
status: nativeBuilt.status,
|
|
678
900
|
key: nativeBuilt.build.key
|
|
679
901
|
};
|
|
680
|
-
nativeDone(native
|
|
681
|
-
|
|
682
|
-
const mcpDone = progress.start(MCP_LABEL, "ensuring the MCP app build of each root");
|
|
683
|
-
|
|
684
|
-
for (const [root, compositions] of composed) {
|
|
902
|
+
nativeDone(artifactSummary(native, t, skipped ?? (deferred.has("native") ? t("cli.sync.progress.nativeDeferred", "deferred until a native client connects") : void 0)));
|
|
903
|
+
let nativeKey = native.status === "skipped" ? null : native.key;
|
|
904
|
+
const mcpDone = progress.start(MCP_LABEL, t("cli.sync.progress.buildingMcp", "ensuring the MCP app build of each root"));
|
|
905
|
+
let mcpKeys = [];
|
|
906
|
+
for (const [root, compositions] of skipBuilds || deferred.has("mcp-app") ? [] : composed) {
|
|
685
907
|
if (compositions instanceof Error) {
|
|
686
|
-
progress.line(MCP_LABEL,
|
|
908
|
+
progress.line(MCP_LABEL, t("cli.sync.progress.mcpLeftOut", "'{root}' is left out of the MCP app build: {reason}", {
|
|
909
|
+
root,
|
|
910
|
+
reason: compositions.message
|
|
911
|
+
}));
|
|
687
912
|
continue;
|
|
688
913
|
}
|
|
689
914
|
try {
|
|
690
915
|
const app = await deps.bundleMcpApp({
|
|
691
916
|
poHome: globalRoot,
|
|
692
|
-
candidates: require_mcpBundle.mcpPluginCandidates(compositions)
|
|
917
|
+
candidates: await require_mcpBundle.mcpPluginCandidates(compositions)
|
|
693
918
|
});
|
|
694
919
|
if (app !== void 0 && !mcpKeys.includes(app.key)) mcpKeys.push(app.key);
|
|
695
920
|
} catch (error) {
|
|
@@ -699,14 +924,31 @@ async function syncOnce(options, deps, emit, lost) {
|
|
|
699
924
|
});
|
|
700
925
|
}
|
|
701
926
|
}
|
|
702
|
-
mcpDone(mcpKeys.length === 0 ? "no MCP UI widgets" : mcpKeys.join(", "));
|
|
927
|
+
mcpDone(skipped ?? (deferred.has("mcp-app") ? t("cli.sync.progress.mcpDeferred", "deferred until a session needs MCP widgets") : mcpKeys.length === 0 ? t("cli.sync.progress.noMcpWidgets", "no MCP UI widgets") : mcpKeys.join(", ")));
|
|
703
928
|
const mcpApp = mcpKeys.length === 0 ? void 0 : mcpKeys.join(", ");
|
|
704
|
-
|
|
929
|
+
if (deferred.has("native") && previous?.nativeKey) {
|
|
930
|
+
if (await artifactsExist(globalRoot, {
|
|
931
|
+
webKey: null,
|
|
932
|
+
nativeKey: previous.nativeKey,
|
|
933
|
+
mcpKeys: []
|
|
934
|
+
})) nativeKey = previous.nativeKey;
|
|
935
|
+
}
|
|
936
|
+
if (deferred.has("mcp-app") && previous !== void 0) {
|
|
937
|
+
const present = await Promise.all(previous.mcpKeys.map((key) => artifactsExist(globalRoot, {
|
|
938
|
+
webKey: null,
|
|
939
|
+
nativeKey: null,
|
|
940
|
+
mcpKeys: [key]
|
|
941
|
+
})));
|
|
942
|
+
mcpKeys = previous.mcpKeys.filter((_, index) => present[index]);
|
|
943
|
+
}
|
|
944
|
+
const artifacts = pointerArtifacts(globalRoot, {
|
|
705
945
|
webKey,
|
|
706
946
|
nativeKey,
|
|
707
947
|
mcpKeys
|
|
708
|
-
})
|
|
709
|
-
|
|
948
|
+
});
|
|
949
|
+
const present = await Promise.all(artifacts.map((file) => node_fs_promises.default.access(file).then(() => true, () => false)));
|
|
950
|
+
const missing = artifacts.filter((_, index) => !present[index]);
|
|
951
|
+
if (missing.length > 0) return report("failed", [failure((t) => t("cli.sync.failure.missingArtifacts", "Build artifacts are missing: {paths}", { paths: missing.join(", ") }))], webKey, mcpKeys);
|
|
710
952
|
if (built.status !== "skipped") for (const [root, packageRoots] of rootPackageRoots) for (const [pluginId, slots] of require_index.duplicatePluginCopies(built.build, packageRoots)) unsynced.get(root)?.push({
|
|
711
953
|
selector: pluginId,
|
|
712
954
|
reason: `two copies of plugin '${pluginId}' are selected (${slots.join(", ")})`
|
|
@@ -715,7 +957,7 @@ async function syncOnce(options, deps, emit, lost) {
|
|
|
715
957
|
const generation = (previous?.generation ?? 0) + 1;
|
|
716
958
|
const pointer = {
|
|
717
959
|
generation,
|
|
718
|
-
signature: syncSignature(options, roots, catalogueHash),
|
|
960
|
+
signature: await syncSignature(options, roots, catalogueHash, presetsOf),
|
|
719
961
|
catalogueHash,
|
|
720
962
|
webKey,
|
|
721
963
|
nativeKey,
|
|
@@ -723,11 +965,12 @@ async function syncOnce(options, deps, emit, lost) {
|
|
|
723
965
|
roots: succeeded.roots,
|
|
724
966
|
commands,
|
|
725
967
|
fingerprints: Object.fromEntries(roots.map((root) => [root, rootSelectionFingerprint(root, homeDirectory, environment)])),
|
|
726
|
-
host: syncHostIdentity(globalRoot, environment)
|
|
968
|
+
host: await syncHostIdentity(globalRoot, environment),
|
|
969
|
+
...deferred.size === 0 ? {} : { deferred: [...deferred].sort() }
|
|
727
970
|
};
|
|
728
|
-
const lostBeforePointer = lost();
|
|
971
|
+
const lostBeforePointer = await lost();
|
|
729
972
|
if (lostBeforePointer !== void 0) return lostBeforePointer;
|
|
730
|
-
writeJsonFile(syncPointerPath(globalRoot), pointer);
|
|
973
|
+
await writeJsonFile(syncPointerPath(globalRoot), pointer);
|
|
731
974
|
await pruneStep(progress, deps.prune, {
|
|
732
975
|
homeDirectory,
|
|
733
976
|
environment,
|
|
@@ -735,8 +978,7 @@ async function syncOnce(options, deps, emit, lost) {
|
|
|
735
978
|
...webKey === null ? {} : { webKey },
|
|
736
979
|
...nativeKey === null ? {} : { nativeKey },
|
|
737
980
|
...mcpKeys.length === 0 ? {} : { mcpAppKeys: mcpKeys }
|
|
738
|
-
});
|
|
739
|
-
for (const root of /* @__PURE__ */ new Set([...roots, ...options.repoRoot === void 0 ? [] : [realPath(options.repoRoot)]])) emitFrontendHooks(root, progress, commands);
|
|
981
|
+
}, t);
|
|
740
982
|
emit({
|
|
741
983
|
type: "result",
|
|
742
984
|
result: {
|
|
@@ -756,19 +998,20 @@ async function syncOnce(options, deps, emit, lost) {
|
|
|
756
998
|
* reasons. A pass that lost the lock leaves the file to the holder that took it.
|
|
757
999
|
*/
|
|
758
1000
|
async function attempt(options, deps, emit, lost) {
|
|
1001
|
+
const t = errorText(options);
|
|
759
1002
|
let report;
|
|
760
1003
|
try {
|
|
761
1004
|
report = await syncOnce(options, deps, emit, lost);
|
|
762
1005
|
} catch (error) {
|
|
763
|
-
report = emptyReport("failed", [
|
|
1006
|
+
report = emptyReport("failed", [t("cli.sync.failure.sync", "po sync failed: {reason}", { reason: errorMessage(error) })], deps);
|
|
764
1007
|
}
|
|
765
1008
|
if (report.status === "busy") return report;
|
|
766
1009
|
try {
|
|
767
|
-
writeJsonFile(syncLastAttemptPath(options.globalRoot), report);
|
|
1010
|
+
await writeJsonFile(syncLastAttemptPath(options.globalRoot), report);
|
|
768
1011
|
} catch (error) {
|
|
769
1012
|
report = {
|
|
770
1013
|
...report,
|
|
771
|
-
errors: [...report.errors,
|
|
1014
|
+
errors: [...report.errors, t("cli.sync.failure.reportWrite", "last-attempt.json could not be written: {reason}", { reason: errorMessage(error) })]
|
|
772
1015
|
};
|
|
773
1016
|
}
|
|
774
1017
|
return report;
|
|
@@ -789,30 +1032,33 @@ async function runSync(options, overrides = {}) {
|
|
|
789
1032
|
const emit = options.onEvent ?? (() => {});
|
|
790
1033
|
const lockPath = syncLockPath(options.globalRoot);
|
|
791
1034
|
const rerunPath = syncRerunPath(options.globalRoot);
|
|
792
|
-
let lock = acquireLock(lockPath, options.origin, deps);
|
|
1035
|
+
let lock = await acquireLock(lockPath, options.origin, deps);
|
|
793
1036
|
if (!lock.acquired) {
|
|
794
|
-
if (options.origin === "background")
|
|
795
|
-
|
|
1037
|
+
if (options.origin === "background") await node_fs_promises.default.writeFile(rerunPath, deps.now().toISOString());
|
|
1038
|
+
const holder = lock.holder === void 0 ? "another process" : `pid ${String(lock.holder.pid)}`;
|
|
1039
|
+
return emptyReport("busy", [errorText(options)("cli.sync.failure.lockBusy", "po sync is already running ({holder})", { holder })], deps);
|
|
796
1040
|
}
|
|
797
1041
|
for (;;) {
|
|
798
1042
|
const { token } = lock;
|
|
799
|
-
const lost = () => lostLock(lockPath, token, deps);
|
|
1043
|
+
const lost = () => lostLock(lockPath, token, deps, options);
|
|
800
1044
|
let report;
|
|
801
1045
|
try {
|
|
802
|
-
takeRerunRequest(rerunPath);
|
|
1046
|
+
await takeRerunRequest(rerunPath);
|
|
803
1047
|
report = await attempt(options, deps, emit, lost);
|
|
804
|
-
while (report.status !== "busy" && takeRerunRequest(rerunPath)) report = await attempt(options, deps, emit, lost);
|
|
1048
|
+
while (report.status !== "busy" && await takeRerunRequest(rerunPath)) report = await attempt(options, deps, emit, lost);
|
|
805
1049
|
} finally {
|
|
806
|
-
releaseLock(lockPath, token);
|
|
1050
|
+
await releaseLock(lockPath, token);
|
|
807
1051
|
}
|
|
808
|
-
if (report.status === "busy" || !
|
|
809
|
-
lock = acquireLock(lockPath, options.origin, deps);
|
|
1052
|
+
if (report.status === "busy" || !await node_fs_promises.default.access(rerunPath).then(() => true, () => false)) return report;
|
|
1053
|
+
lock = await acquireLock(lockPath, options.origin, deps);
|
|
810
1054
|
if (!lock.acquired) return report;
|
|
811
1055
|
}
|
|
812
1056
|
}
|
|
813
1057
|
//#endregion
|
|
1058
|
+
exports.LOCAL_NOT_TRUSTED = LOCAL_NOT_TRUSTED;
|
|
814
1059
|
exports.formatSyncResult = formatSyncResult;
|
|
815
1060
|
exports.globalWebPluginRoots = globalWebPluginRoots;
|
|
1061
|
+
exports.localBuildReadiness = localBuildReadiness;
|
|
816
1062
|
exports.processIsAlive = processIsAlive;
|
|
817
1063
|
exports.readSyncLastAttempt = readSyncLastAttempt;
|
|
818
1064
|
exports.readSyncPointer = readSyncPointer;
|
|
@@ -824,5 +1070,6 @@ exports.syncLastAttemptPath = syncLastAttemptPath;
|
|
|
824
1070
|
exports.syncLockPath = syncLockPath;
|
|
825
1071
|
exports.syncPointerPath = syncPointerPath;
|
|
826
1072
|
exports.syncRerunPath = syncRerunPath;
|
|
1073
|
+
exports.withSyncLock = withSyncLock;
|
|
827
1074
|
|
|
828
1075
|
//# sourceMappingURL=index.cjs.map
|