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