openmeld 0.3.221 → 0.3.223
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/dist/{add-me-membership-DpckwGof.js → add-me-membership-AWArQHSP.js} +2 -2
- package/dist/{add-me-membership-DpckwGof.js.map → add-me-membership-AWArQHSP.js.map} +1 -1
- package/dist/{agents-2TzCubpV.js → agents-PsEPfW3B.js} +12 -12
- package/dist/{agents-2TzCubpV.js.map → agents-PsEPfW3B.js.map} +1 -1
- package/dist/{api-client-foundation-CGImd4c8.js → api-client-foundation-CbbeqtJY.js} +1 -1
- package/dist/{api-client-foundation-D-Cb6EVg.js → api-client-foundation-D2lqqEZK.js} +3 -3
- package/dist/{api-client-foundation-D-Cb6EVg.js.map → api-client-foundation-D2lqqEZK.js.map} +1 -1
- package/dist/auth-session-8GEdTCmT.js +4 -0
- package/dist/{auth-session-CDhQANWx.js → auth-session-BDEv3tou.js} +8 -8
- package/dist/auth-session-BDEv3tou.js.map +1 -0
- package/dist/{base-url-CMBApK1J.js → base-url-DXrUiSMI.js} +1 -1
- package/dist/{base-url-D7uE_xTo.js → base-url-DvjOkKPs.js} +2 -2
- package/dist/{base-url-D7uE_xTo.js.map → base-url-DvjOkKPs.js.map} +1 -1
- package/dist/{channel-D5ABuavH.js → channel-CDXD7Bfv.js} +4 -4
- package/dist/{channel-D5ABuavH.js.map → channel-CDXD7Bfv.js.map} +1 -1
- package/dist/{cli-binary-manifest-DiUulkp0.js → cli-binary-manifest-CT5X05lk.js} +30 -4
- package/dist/cli-binary-manifest-CT5X05lk.js.map +1 -0
- package/dist/{command-MlrjQYq5.js → command-CUNcwWww.js} +22 -165
- package/dist/command-CUNcwWww.js.map +1 -0
- package/dist/{computer-connection-DYnof5Xw.js → computer-connection-NCM-EnCu.js} +2 -2
- package/dist/{computer-connection-DYnof5Xw.js.map → computer-connection-NCM-EnCu.js.map} +1 -1
- package/dist/{computer-connection-review-mO6vn3C3.js → computer-connection-review-DATbh3kD.js} +6 -6
- package/dist/{computer-connection-review-mO6vn3C3.js.map → computer-connection-review-DATbh3kD.js.map} +1 -1
- package/dist/{computer-disconnect-CLtQwKDS.js → computer-disconnect-Cd1YvKu7.js} +10 -10
- package/dist/{computer-disconnect-CLtQwKDS.js.map → computer-disconnect-Cd1YvKu7.js.map} +1 -1
- package/dist/{computer-setup-continuation-PVwPXc5i.js → computer-setup-continuation-TU09jiWA.js} +4 -4
- package/dist/{computer-setup-continuation-PVwPXc5i.js.map → computer-setup-continuation-TU09jiWA.js.map} +1 -1
- package/dist/context-BUmQsG9U.js +162 -0
- package/dist/context-BUmQsG9U.js.map +1 -0
- package/dist/{control-plane-BDS63N7Y.js → control-plane-rTE2rHZ5.js} +4 -2
- package/dist/control-plane-rTE2rHZ5.js.map +1 -0
- package/dist/{daemon-device-id-YnLMx1kN.js → daemon-device-id-BOqTgR9G.js} +344 -36
- package/dist/daemon-device-id-BOqTgR9G.js.map +1 -0
- package/dist/{daemon-frame-transport-D-4StENt.js → daemon-frame-transport-C3SOtG8a.js} +519 -12
- package/dist/daemon-frame-transport-C3SOtG8a.js.map +1 -0
- package/dist/{daemon-lifecycle-journal-DcrVY0xb.js → daemon-lifecycle-journal-D4uZ-Ykq.js} +10 -10
- package/dist/daemon-lifecycle-journal-D4uZ-Ykq.js.map +1 -0
- package/dist/{daemon-runtime-lease-BUr4qsLo.js → daemon-runtime-lease-1LMeZ6IS.js} +2 -2
- package/dist/{daemon-runtime-lease-BUr4qsLo.js.map → daemon-runtime-lease-1LMeZ6IS.js.map} +1 -1
- package/dist/{daemon-runtime-lease-C9X8xV_F.js → daemon-runtime-lease-Bz0ucJj3.js} +1 -1
- package/dist/{daemon-service-contract-BpOBMGX0.js → daemon-service-contract-GLmAxsq-.js} +4 -4
- package/dist/{daemon-service-contract-BpOBMGX0.js.map → daemon-service-contract-GLmAxsq-.js.map} +1 -1
- package/dist/{daemon-service-manager-HL4VKbIU.js → daemon-service-manager-C8RUCMDo.js} +9 -7
- package/dist/daemon-service-manager-C8RUCMDo.js.map +1 -0
- package/dist/{daemon-service-manager-B-QrDe5p.js → daemon-service-manager-CU-79a4z.js} +1 -1
- package/dist/{daemon-service-runtime-Kr6Bs2J2.js → daemon-service-runtime-BEfMD5jb.js} +397 -51
- package/dist/daemon-service-runtime-BEfMD5jb.js.map +1 -0
- package/dist/{daemon-service-update-coordinator-RJO997me.js → daemon-service-update-coordinator-uQW-Ib66.js} +48 -33
- package/dist/daemon-service-update-coordinator-uQW-Ib66.js.map +1 -0
- package/dist/{daemon-state-B44aq2nm.js → daemon-state-Ca0WK5x0.js} +3 -3
- package/dist/{daemon-state-B44aq2nm.js.map → daemon-state-Ca0WK5x0.js.map} +1 -1
- package/dist/{dist-BewA9srP.js → dist-B0OGOBKB.js} +81 -15
- package/dist/dist-B0OGOBKB.js.map +1 -0
- package/dist/dist-BMJ6nTd6.js +4 -0
- package/dist/{dist-ChS52b_E.js → dist-CkSuMZyq.js} +16 -12
- package/dist/dist-CkSuMZyq.js.map +1 -0
- package/dist/{elapsed-time-Cw6b9rYy.js → elapsed-time-DmXBSBLX.js} +6 -6
- package/dist/{elapsed-time-Cw6b9rYy.js.map → elapsed-time-DmXBSBLX.js.map} +1 -1
- package/dist/{entry-BE8uqbkD.js → entry-DbA--kpf.js} +12 -12
- package/dist/{entry-BE8uqbkD.js.map → entry-DbA--kpf.js.map} +1 -1
- package/dist/{installation-inventory-Dwn8FoKT.js → installation-inventory-B50K5Nme.js} +5 -5
- package/dist/{installation-inventory-Dwn8FoKT.js.map → installation-inventory-B50K5Nme.js.map} +1 -1
- package/dist/{installer-CsQ4vNjT.js → installer-BSByDtli.js} +2 -2
- package/dist/{installer-CsQ4vNjT.js.map → installer-BSByDtli.js.map} +1 -1
- package/dist/io-DT66typ4.js +16 -0
- package/dist/io-DT66typ4.js.map +1 -0
- package/dist/{local-components-B6SCXZf9.js → local-components-DleLEzSU.js} +2 -1
- package/dist/local-components-DleLEzSU.js.map +1 -0
- package/dist/{lock-Bsl_ElWy.js → lock-iue1J2xy.js} +8 -5
- package/dist/lock-iue1J2xy.js.map +1 -0
- package/dist/{cli-space-api-B2l1xMPn.js → meta-api-C4_z3Ins.js} +203 -19
- package/dist/meta-api-C4_z3Ins.js.map +1 -0
- package/dist/{openmeld-Tkp17vPg.js → openmeld-BloctT8R.js} +101 -1026
- package/dist/openmeld-BloctT8R.js.map +1 -0
- package/dist/openmeld-dev.js +1 -1
- package/dist/{openmeld-environment-target-B6HqY0_a.js → openmeld-environment-target-BBn5Ko6p.js} +3 -3
- package/dist/{openmeld-environment-target-B6HqY0_a.js.map → openmeld-environment-target-BBn5Ko6p.js.map} +1 -1
- package/dist/{openmeld-maintenance-worker-C1J_ISOh.js → openmeld-maintenance-worker-BgA89k58.js} +15 -14
- package/dist/openmeld-maintenance-worker-BgA89k58.js.map +1 -0
- package/dist/{openmeld-tools-update-join-ZLpRTHO3.js → openmeld-tools-update-join-B4sRZFfU.js} +4 -4
- package/dist/{openmeld-tools-update-join-ZLpRTHO3.js.map → openmeld-tools-update-join-B4sRZFfU.js.map} +1 -1
- package/dist/{openmeld-tools-update-process-frame-B-XB4dmO.js → openmeld-tools-update-process-frame-BtFKp70p.js} +2 -2
- package/dist/{openmeld-tools-update-process-frame-B-XB4dmO.js.map → openmeld-tools-update-process-frame-BtFKp70p.js.map} +1 -1
- package/dist/{openmeld-tools-update-process-frame-j-RXwFsK.js → openmeld-tools-update-process-frame-DbEZ3fEh.js} +1 -1
- package/dist/openmeld.js +9 -5
- package/dist/openmeld.js.map +1 -1
- package/dist/{prepare-provider-runtime-CD5ZI-ct.js → prepare-provider-runtime-L84g7H_Q.js} +3395 -1346
- package/dist/prepare-provider-runtime-L84g7H_Q.js.map +1 -0
- package/dist/{prepare-session-executor-C2nNM2yb.js → prepare-session-executor-uQHhdNg8.js} +29 -28
- package/dist/prepare-session-executor-uQHhdNg8.js.map +1 -0
- package/dist/{presenter-BcxiQyJg.js → presenter-MJ5YgsOT.js} +3 -13
- package/dist/presenter-MJ5YgsOT.js.map +1 -0
- package/dist/{process-channel-B2BU2X7x.js → process-channel-D71P1C32.js} +2 -2
- package/dist/{process-channel-B2BU2X7x.js.map → process-channel-D71P1C32.js.map} +1 -1
- package/dist/process-environment-BWSFeUu6.js +49 -0
- package/dist/process-environment-BWSFeUu6.js.map +1 -0
- package/dist/process-identity-BQLdaZdB.js +190 -0
- package/dist/process-identity-BQLdaZdB.js.map +1 -0
- package/dist/process-launch-B0pHlkV_.js +173 -0
- package/dist/process-launch-B0pHlkV_.js.map +1 -0
- package/dist/{published-production-safety-dp-fOmmB.js → published-production-safety-C40hKrBA.js} +2 -2
- package/dist/{published-production-safety-dp-fOmmB.js.map → published-production-safety-C40hKrBA.js.map} +1 -1
- package/dist/{runtime-DMYoB5_x.js → runtime-Pwc12DeY.js} +155 -702
- package/dist/runtime-Pwc12DeY.js.map +1 -0
- package/dist/{runtime-agent-controller-reporting-submission-DGm8O4q_.js → runtime-agent-controller-reporting-submission-AmSxt3Z1.js} +11 -10
- package/dist/{runtime-agent-controller-reporting-submission-DGm8O4q_.js.map → runtime-agent-controller-reporting-submission-AmSxt3Z1.js.map} +1 -1
- package/dist/{runtime-reporting-health-state-BWZgy4pF.js → runtime-reporting-health-state-DwlV1Fsv.js} +2210 -60
- package/dist/runtime-reporting-health-state-DwlV1Fsv.js.map +1 -0
- package/dist/{runtime-transport-0F5E6So6.js → runtime-transport-CivtwW1A.js} +104 -15
- package/dist/runtime-transport-CivtwW1A.js.map +1 -0
- package/dist/{service-C72KhNft.js → service-DYid1j4Y.js} +124 -548
- package/dist/service-DYid1j4Y.js.map +1 -0
- package/dist/{service-account-admission-Dy2W3n3_.js → service-account-admission-BfdJ-kKR.js} +18 -10
- package/dist/service-account-admission-BfdJ-kKR.js.map +1 -0
- package/dist/{service-account-authorization-DAPQy2yP.js → service-account-authorization-Cx6KEfvI.js} +6 -6
- package/dist/{service-account-authorization-DAPQy2yP.js.map → service-account-authorization-Cx6KEfvI.js.map} +1 -1
- package/dist/{service-account-control-DZjUR3I_.js → service-account-control-NTVNuQbb.js} +16 -16
- package/dist/service-account-control-NTVNuQbb.js.map +1 -0
- package/dist/{service-control-capabilities-Y4CGrchz.js → service-control-capabilities-CkKw-5l7.js} +1 -1
- package/dist/{service-control-capabilities-C2MF5FUD.js → service-control-capabilities-D0qUygFh.js} +19 -15
- package/dist/service-control-capabilities-D0qUygFh.js.map +1 -0
- package/dist/{service-control-carrier-capability-DDNyE5cB.js → service-control-carrier-capability-gMk5gMKU.js} +11 -4
- package/dist/service-control-carrier-capability-gMk5gMKU.js.map +1 -0
- package/dist/{state-CK1WXIsI.js → state-CZHAuQRD.js} +4 -4
- package/dist/{state-CK1WXIsI.js.map → state-CZHAuQRD.js.map} +1 -1
- package/dist/upgrade-DBdUgOXy.js +4 -0
- package/dist/{upgrade-BTIKVek7.js → upgrade-ym-rbiAR.js} +52 -32
- package/dist/upgrade-ym-rbiAR.js.map +1 -0
- package/dist/windows/openmeld-windows-process.exe +0 -0
- package/dist/windows-artifact-DJ9DKjfc.js +16 -0
- package/dist/windows-artifact-DJ9DKjfc.js.map +1 -0
- package/dist/windows-task-command-COu_6Ke3.js +74 -0
- package/dist/windows-task-command-COu_6Ke3.js.map +1 -0
- package/dist/windows-task-entry-CtRpUbiK.js +50 -0
- package/dist/windows-task-entry-CtRpUbiK.js.map +1 -0
- package/dist/{windows-user-task-Bx2yYnOM.js → windows-user-task-B8NcRg_u.js} +1 -1
- package/dist/{windows-user-task-CRGbKggi.js → windows-user-task-Io5QuEVR.js} +108 -51
- package/dist/windows-user-task-Io5QuEVR.js.map +1 -0
- package/package.json +11 -11
- package/skills/openmeld-cli/playbooks/space-ops.md +9 -3
- package/skills/openmeld-cli/references/commands.md +0 -1
- package/dist/auth-session-CDhQANWx.js.map +0 -1
- package/dist/auth-session-DsBkEFct.js +0 -4
- package/dist/cli-binary-manifest-DiUulkp0.js.map +0 -1
- package/dist/cli-space-api-B2l1xMPn.js.map +0 -1
- package/dist/command-MlrjQYq5.js.map +0 -1
- package/dist/context-D9Ebb5wl.js +0 -473
- package/dist/context-D9Ebb5wl.js.map +0 -1
- package/dist/control-plane-BDS63N7Y.js.map +0 -1
- package/dist/daemon-device-id-YnLMx1kN.js.map +0 -1
- package/dist/daemon-frame-transport-D-4StENt.js.map +0 -1
- package/dist/daemon-lifecycle-journal-DcrVY0xb.js.map +0 -1
- package/dist/daemon-service-manager-HL4VKbIU.js.map +0 -1
- package/dist/daemon-service-runtime-Kr6Bs2J2.js.map +0 -1
- package/dist/daemon-service-update-coordinator-RJO997me.js.map +0 -1
- package/dist/dist-B6VsppM7.js +0 -4
- package/dist/dist-BewA9srP.js.map +0 -1
- package/dist/dist-ChS52b_E.js.map +0 -1
- package/dist/local-components-B6SCXZf9.js.map +0 -1
- package/dist/lock-Bsl_ElWy.js.map +0 -1
- package/dist/openmeld-Tkp17vPg.js.map +0 -1
- package/dist/openmeld-maintenance-worker-C1J_ISOh.js.map +0 -1
- package/dist/prepare-provider-runtime-CD5ZI-ct.js.map +0 -1
- package/dist/prepare-session-executor-C2nNM2yb.js.map +0 -1
- package/dist/presenter-BcxiQyJg.js.map +0 -1
- package/dist/process-identity-CNus0e6E.js +0 -146
- package/dist/process-identity-CNus0e6E.js.map +0 -1
- package/dist/runtime-DMYoB5_x.js.map +0 -1
- package/dist/runtime-reporting-health-state-BWZgy4pF.js.map +0 -1
- package/dist/runtime-transport-0F5E6So6.js.map +0 -1
- package/dist/service-C72KhNft.js.map +0 -1
- package/dist/service-account-admission-Dy2W3n3_.js.map +0 -1
- package/dist/service-account-control-DZjUR3I_.js.map +0 -1
- package/dist/service-control-capabilities-C2MF5FUD.js.map +0 -1
- package/dist/service-control-carrier-capability-DDNyE5cB.js.map +0 -1
- package/dist/upgrade-BTIKVek7.js.map +0 -1
- package/dist/upgrade-DTB0ZmxI.js +0 -4
- package/dist/windows-user-task-CRGbKggi.js.map +0 -1
|
@@ -1,30 +1,50 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { $ as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import { $ as openMeldManagedVersionBinaryPath, A as OPENMELD_HOME_ENV_KEY, Q as openMeldManagedBinaryPath, X as openMeldBinDir, Z as openMeldManagedBinaryName, a as isOpenMeldOrphanedLockError, d as runWithHeldLock, et as openMeldManagedVersionDir, ft as resolveOpenMeldServiceScope, i as isOpenMeldLockError, lt as resolveOpenMeldEnvPreset, nt as openMeldVersionsDir, t as acquireLock, ut as resolveOpenMeldRootDir } from "./lock-iue1J2xy.js";
|
|
4
|
+
import { i as windowsPublisherNameSchema, n as WINDOWS_PROCESS_HELPER_FILENAME, r as windowsManagedCliInstallationSchema } from "./windows-artifact-DJ9DKjfc.js";
|
|
5
|
+
import { a as cliBinaryServiceReleaseSchema, n as OPENMELD_MACOS_CLI_SIGNING_REQUIREMENT, o as resolveCliBinaryPlatform, r as cliBinaryDeltaPatchSchema, t as OPENMELD_MACOS_CLI_SIGNING_IDENTITY } from "./cli-binary-manifest-CT5X05lk.js";
|
|
6
|
+
import { b as openMeldToolsUpdateOperationPhaseSchema, w as openMeldToolsUpdateRequestSourceSchema } from "./local-components-DleLEzSU.js";
|
|
7
|
+
import { r as readDaemonRuntimeLease } from "./daemon-runtime-lease-1LMeZ6IS.js";
|
|
8
|
+
import { l as resolveWindowsPowerShellPath, o as powerShellEncodedArguments, s as pruneWindowsBinaryBundle } from "./process-identity-BQLdaZdB.js";
|
|
9
|
+
import { n as normalizeCommandEnvironment } from "./process-environment-BWSFeUu6.js";
|
|
8
10
|
import { n as resolveOpenMeldDistribution, t as isBinaryDistribution } from "./distribution-BDQT2ilb.js";
|
|
9
|
-
import { A as getDaemonStatus, C as daemonServiceStableBinaryExecutablePath, D as daemonStatePath, E as daemonServiceUpdateWorkerBinaryExecutablePath, T as daemonServiceStableLauncherPath, U as uninstallDaemon, _ as daemonRuntimeStateRootPath, a as DAEMON_SERVICE_RUNTIME_MODE_ENV, b as daemonServiceLegacyExecutableWrapperPath, g as daemonRuntimeServiceManagerPath, h as daemonRuntimeRootPath, i as DAEMON_SERVICE_RUNTIME_DETACHED_ENV, k as getDaemonRuntimeStatus, l as clearDaemonServiceRuntimeState, n as DAEMON_SERVICE_RUNTIME_AUTO_START_ENV, p as daemonRuntimeBundlesPath, r as DAEMON_SERVICE_RUNTIME_CONTROLLER_ENV, s as DAEMON_SERVICE_RUNTIME_SYSTEM_SERVICE_ENV, t as DAEMON_HEARTBEAT_STALE_MS, v as daemonServiceActiveBundleStatePath, w as daemonServiceStableExecutableWrapperPath, x as daemonServiceRecognizedExecutablePaths$1, y as daemonServiceExecutableWrapperPaths$1 } from "./daemon-state-
|
|
10
|
-
import { t as assertNoPublishedProductionMutationDuringTests } from "./published-production-safety-
|
|
11
|
-
import { i as readDaemonServiceContract } from "./daemon-service-contract-
|
|
12
|
-
import { d as compareSemver, l as OPENMELD_VERSION, t as emitDaemonLifecycleEvent, v as package_default } from "./daemon-lifecycle-journal-
|
|
11
|
+
import { A as getDaemonStatus, C as daemonServiceStableBinaryExecutablePath, D as daemonStatePath, E as daemonServiceUpdateWorkerBinaryExecutablePath, T as daemonServiceStableLauncherPath, U as uninstallDaemon, _ as daemonRuntimeStateRootPath, a as DAEMON_SERVICE_RUNTIME_MODE_ENV, b as daemonServiceLegacyExecutableWrapperPath, g as daemonRuntimeServiceManagerPath, h as daemonRuntimeRootPath, i as DAEMON_SERVICE_RUNTIME_DETACHED_ENV, k as getDaemonRuntimeStatus, l as clearDaemonServiceRuntimeState, n as DAEMON_SERVICE_RUNTIME_AUTO_START_ENV, p as daemonRuntimeBundlesPath, r as DAEMON_SERVICE_RUNTIME_CONTROLLER_ENV, s as DAEMON_SERVICE_RUNTIME_SYSTEM_SERVICE_ENV, t as DAEMON_HEARTBEAT_STALE_MS, v as daemonServiceActiveBundleStatePath, w as daemonServiceStableExecutableWrapperPath, x as daemonServiceRecognizedExecutablePaths$1, y as daemonServiceExecutableWrapperPaths$1 } from "./daemon-state-Ca0WK5x0.js";
|
|
12
|
+
import { t as assertNoPublishedProductionMutationDuringTests } from "./published-production-safety-C40hKrBA.js";
|
|
13
|
+
import { i as readDaemonServiceContract } from "./daemon-service-contract-GLmAxsq-.js";
|
|
14
|
+
import { d as compareSemver, l as OPENMELD_VERSION, t as emitDaemonLifecycleEvent, v as package_default } from "./daemon-lifecycle-journal-D4uZ-Ykq.js";
|
|
15
|
+
import { a as expectedBinaryServiceFingerprint, c as verifyWindowsServiceSubsystem, l as windowsMaintenanceBinaryPath, o as hashBinaryServiceBundle, s as prepareWindowsMaintenanceBinary } from "./windows-user-task-Io5QuEVR.js";
|
|
13
16
|
import { t as sleep } from "./dist-BLuEEVHh.js";
|
|
14
|
-
import { E as resolveDaemonServiceIdentity, S as resolveDaemonServiceManager } from "./daemon-service-manager-
|
|
17
|
+
import { E as resolveDaemonServiceIdentity, S as resolveDaemonServiceManager } from "./daemon-service-manager-C8RUCMDo.js";
|
|
15
18
|
import { createRequire } from "node:module";
|
|
16
|
-
import { createHash } from "node:crypto";
|
|
19
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
17
20
|
import { homedir } from "node:os";
|
|
18
|
-
import path, { basename, dirname, isAbsolute, join, relative, sep } from "node:path";
|
|
19
|
-
import { access, chmod, copyFile, cp, lstat, mkdir, readFile, readdir, readlink, realpath, rename, rm, stat, symlink, writeFile } from "node:fs/promises";
|
|
21
|
+
import path, { basename, dirname, isAbsolute, join, relative, sep, win32 } from "node:path";
|
|
22
|
+
import { access, chmod, copyFile, cp, lstat, mkdir, mkdtemp, readFile, readdir, readlink, realpath, rename, rm, stat, symlink, writeFile } from "node:fs/promises";
|
|
20
23
|
import * as z$1 from "zod/v4";
|
|
21
|
-
import { constants } from "node:fs";
|
|
24
|
+
import { constants, createReadStream } from "node:fs";
|
|
22
25
|
import process$1 from "node:process";
|
|
23
26
|
import { execFile, spawn } from "node:child_process";
|
|
24
|
-
import { setTimeout as setTimeout$1 } from "node:timers/promises";
|
|
25
|
-
import { fileURLToPath } from "node:url";
|
|
26
27
|
import { promisify } from "node:util";
|
|
28
|
+
import { fileURLToPath } from "node:url";
|
|
29
|
+
import { setTimeout as setTimeout$1 } from "node:timers/promises";
|
|
27
30
|
import { gunzipSync } from "node:zlib";
|
|
31
|
+
//#region ../../packages/schemas/dist/schemas/daemon/cli-install-self.js
|
|
32
|
+
const cliInstallSelfResultSchema = z$1.strictObject({
|
|
33
|
+
schemaVersion: z$1.literal(1),
|
|
34
|
+
type: z$1.literal("cli.install_self"),
|
|
35
|
+
result: z$1.enum([
|
|
36
|
+
"installed",
|
|
37
|
+
"noop_same_version",
|
|
38
|
+
"noop_newer_present"
|
|
39
|
+
]),
|
|
40
|
+
version: z$1.string().min(1),
|
|
41
|
+
platform: z$1.string().min(1),
|
|
42
|
+
managedBinaryPath: z$1.string().min(1),
|
|
43
|
+
currentPointerPath: z$1.string().min(1),
|
|
44
|
+
previousVersion: z$1.string().nullable(),
|
|
45
|
+
forced: z$1.boolean()
|
|
46
|
+
});
|
|
47
|
+
//#endregion
|
|
28
48
|
//#region ../../packages/schemas/dist/schemas/daemon/service-update-job.js
|
|
29
49
|
const OPENMELD_DAEMON_SERVICE_UPDATE_JOB_SCHEMA = "openmeld-daemon-service-update-job-v2";
|
|
30
50
|
const daemonServiceUpdatePreparedBundleSchema = z$1.strictObject({
|
|
@@ -163,6 +183,51 @@ function verifyBytes(input) {
|
|
|
163
183
|
if (actualSha256 !== input.expectedSha256.toLowerCase()) throw new Error(`${input.label} sha256 mismatch: expected ${input.expectedSha256.toLowerCase()}, received ${actualSha256}`);
|
|
164
184
|
}
|
|
165
185
|
//#endregion
|
|
186
|
+
//#region ../../runtime/local-service/src/windows-artifact-script.ts
|
|
187
|
+
const WINDOWS_ARTIFACT_SIGNATURE_FUNCTION = String.raw`
|
|
188
|
+
function Assert-OpenMeldArtifactSignature([string]$Path, [string]$Publisher) {
|
|
189
|
+
Import-Module -Name (Join-Path $PSHOME 'Modules\Microsoft.PowerShell.Security\Microsoft.PowerShell.Security.psd1') -ErrorAction Stop
|
|
190
|
+
$path = [IO.Path]::GetFullPath($Path)
|
|
191
|
+
$signature = Microsoft.PowerShell.Security\Get-AuthenticodeSignature -LiteralPath $path -ErrorAction Stop
|
|
192
|
+
if ($signature.Status -ne [Management.Automation.SignatureStatus]::Valid -or !$signature.SignerCertificate -or $signature.Path -ine $path) { throw 'OpenMeld update signature is not valid for this file.' }
|
|
193
|
+
$certificate = $signature.SignerCertificate
|
|
194
|
+
$matches = if ($Publisher.Contains('=')) { $certificate.Subject -ceq $Publisher } else { $certificate.GetNameInfo([Security.Cryptography.X509Certificates.X509NameType]::SimpleName, $false) -ceq $Publisher }
|
|
195
|
+
if (!$matches) { throw 'OpenMeld update publisher does not match this installation.' }
|
|
196
|
+
}
|
|
197
|
+
`;
|
|
198
|
+
//#endregion
|
|
199
|
+
//#region ../../runtime/local-service/src/windows-artifact-signature.ts
|
|
200
|
+
const SIGNATURE_VERIFIED = "OPENMELD_AUTHENTICODE_VERIFIED";
|
|
201
|
+
const VERIFY_SCRIPT = `
|
|
202
|
+
$ErrorActionPreference = 'Stop'
|
|
203
|
+
$ProgressPreference = 'SilentlyContinue'
|
|
204
|
+
[Console]::OutputEncoding = New-Object Text.UTF8Encoding($false)
|
|
205
|
+
${WINDOWS_ARTIFACT_SIGNATURE_FUNCTION}
|
|
206
|
+
$r = ConvertFrom-Json ([Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($env:OPENMELD_SIGNATURE_REQUEST)))
|
|
207
|
+
Assert-OpenMeldArtifactSignature $r.path $r.publisherName
|
|
208
|
+
[Console]::Out.Write('OPENMELD_AUTHENTICODE_VERIFIED')
|
|
209
|
+
`;
|
|
210
|
+
/** Shared artifact verifier: every missing/failed/ambiguous OS result rejects. */
|
|
211
|
+
async function verifyWindowsArtifactSignature(path, publisherName, execute = promisify(execFile)) {
|
|
212
|
+
const publisher = windowsPublisherNameSchema.parse(publisherName);
|
|
213
|
+
if (!win32.isAbsolute(path) || path.includes("\0")) throw new Error("OpenMeld signature verification requires an absolute Windows file path.");
|
|
214
|
+
const env = normalizeCommandEnvironment(process.env, "win32");
|
|
215
|
+
for (const key of Object.keys(env)) if (key.toUpperCase() === "PSMODULEPATH") delete env[key];
|
|
216
|
+
const result = await execute(resolveWindowsPowerShellPath(env), powerShellEncodedArguments(VERIFY_SCRIPT), {
|
|
217
|
+
env: {
|
|
218
|
+
...env,
|
|
219
|
+
OPENMELD_SIGNATURE_REQUEST: Buffer.from(JSON.stringify({
|
|
220
|
+
path,
|
|
221
|
+
publisherName: publisher
|
|
222
|
+
})).toString("base64")
|
|
223
|
+
},
|
|
224
|
+
windowsHide: true,
|
|
225
|
+
timeout: 3e4,
|
|
226
|
+
maxBuffer: 16384
|
|
227
|
+
});
|
|
228
|
+
if (result.stderr.trim() || result.stdout.trim() !== SIGNATURE_VERIFIED) throw new Error("Windows could not verify the OpenMeld update signature.");
|
|
229
|
+
}
|
|
230
|
+
//#endregion
|
|
166
231
|
//#region ../../runtime/local-service/src/cli-binary-update-artifact.ts
|
|
167
232
|
const HARDENED_RUNTIME_FLAG_RE = /flags=.*runtime/iu;
|
|
168
233
|
const RETRY_AFTER_SECONDS_RE = /^\d+$/u;
|
|
@@ -249,14 +314,59 @@ async function downloadCliBinaryUpdateArtifact(input) {
|
|
|
249
314
|
recovery
|
|
250
315
|
});
|
|
251
316
|
}
|
|
317
|
+
/** Prepare the Windows companion in the caller's disposable artifact directory. */
|
|
318
|
+
function allowUnsignedWindowsInternalPreview(env = process.env) {
|
|
319
|
+
return env.OPENMELD_ENV_PRESET === "prod" && env.OPENMELD_WINDOWS_INTERNAL_PREVIEW === "1" && env.OPENMELD_CLI_BINARY_MANIFEST_URL === "https://openmeld.ai/cli/manifest.json?channel=windows-preview";
|
|
320
|
+
}
|
|
321
|
+
function assertWindowsPreviewPolicy(windows, allowed) {
|
|
322
|
+
if ("mode" in windows && !allowed) throw integrityError("Unsigned Windows artifacts require the explicit OpenMeld internal preview channel");
|
|
323
|
+
}
|
|
324
|
+
async function prepareCliBinaryProcessHelper(input) {
|
|
325
|
+
const windows = input.release.windows;
|
|
326
|
+
if (!windows) {
|
|
327
|
+
if (process.platform === "win32") throw integrityError("Windows CLI artifacts must declare their process helper");
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
if (process.platform !== "win32") throw integrityError("Windows artifact preparation requires Windows");
|
|
331
|
+
assertWindowsPreviewPolicy(windows, input.allowUnsignedPreview === true);
|
|
332
|
+
if (new URL(windows.processHelper.url).origin !== new URL(input.release.url).origin) throw integrityError("Windows process helper returned an unexpected download location");
|
|
333
|
+
const bytes = await downloadCliBinaryUpdateArtifact({
|
|
334
|
+
downloadPolicy: input.downloadPolicy,
|
|
335
|
+
fetchImpl: input.fetchImpl,
|
|
336
|
+
release: windows.processHelper,
|
|
337
|
+
plan: resolveFullCliBinaryUpdatePlan(windows.processHelper),
|
|
338
|
+
onDeltaFallback: () => {}
|
|
339
|
+
});
|
|
340
|
+
const helperPath = join(dirname(input.artifactPath), WINDOWS_PROCESS_HELPER_FILENAME);
|
|
341
|
+
await writeFile(helperPath, bytes, {
|
|
342
|
+
mode: 448,
|
|
343
|
+
flag: "wx"
|
|
344
|
+
});
|
|
345
|
+
if (!("mode" in windows)) await verifyWindowsArtifactSignature(helperPath, windows.publisherName);
|
|
346
|
+
}
|
|
252
347
|
async function verifyCliBinaryCodeSignature(input) {
|
|
348
|
+
if (process.platform === "win32") {
|
|
349
|
+
if (!input.release.windows) throw integrityError("Windows CLI artifacts must declare their publisher and process helper");
|
|
350
|
+
await verifyWindowsCliBinaryCodeSignature({
|
|
351
|
+
allowUnsignedPreview: input.allowUnsignedPreview,
|
|
352
|
+
artifactPath: input.artifactPath,
|
|
353
|
+
windows: input.release.windows
|
|
354
|
+
});
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
if (input.release.windows) throw integrityError("signed Windows artifact verification requires Windows");
|
|
253
358
|
const { codeIdentifier, teamIdentifier } = input.release;
|
|
254
|
-
if (!(codeIdentifier && teamIdentifier))
|
|
359
|
+
if (!(codeIdentifier && teamIdentifier)) {
|
|
360
|
+
if (process.platform !== "darwin" || input.allowUnsignedForDevelopment) return;
|
|
361
|
+
throw integrityError("binary manifest is missing a verified signing identity");
|
|
362
|
+
}
|
|
363
|
+
if (codeIdentifier !== OPENMELD_MACOS_CLI_SIGNING_IDENTITY.codeIdentifier || teamIdentifier !== OPENMELD_MACOS_CLI_SIGNING_IDENTITY.teamIdentifier) throw integrityError("binary manifest has an unexpected signing identity");
|
|
255
364
|
if (process.platform !== "darwin") throw integrityError("signed OpenMeld CLI verification requires macOS");
|
|
256
365
|
const verification = await input.runCommand("/usr/bin/codesign", [
|
|
257
366
|
"--verify",
|
|
258
367
|
"--strict",
|
|
259
368
|
"--verbose=2",
|
|
369
|
+
`-R=${OPENMELD_MACOS_CLI_SIGNING_REQUIREMENT}`,
|
|
260
370
|
input.artifactPath
|
|
261
371
|
]);
|
|
262
372
|
if (verification.code !== 0) throw integrityError(`binary code signature verification failed: ${commandFailureDetails(verification)}`);
|
|
@@ -267,14 +377,20 @@ async function verifyCliBinaryCodeSignature(input) {
|
|
|
267
377
|
]);
|
|
268
378
|
if (inspection.code !== 0) throw integrityError(`binary code signature inspection failed: ${commandFailureDetails(inspection)}`);
|
|
269
379
|
const details = `${inspection.stdout}\n${inspection.stderr}`;
|
|
270
|
-
for (const expected of [
|
|
271
|
-
|
|
272
|
-
`TeamIdentifier=${teamIdentifier}`,
|
|
273
|
-
"Authority=Developer ID Application:"
|
|
274
|
-
]) if (!details.includes(expected)) throw integrityError(`binary code signature is missing expected identity: ${expected}`);
|
|
380
|
+
for (const expected of [`Identifier=${codeIdentifier}`, `TeamIdentifier=${teamIdentifier}`]) if (!details.split("\n").some((line) => line.trim() === expected)) throw integrityError(`binary code signature has the wrong identity: ${expected}`);
|
|
381
|
+
if (!details.includes("Authority=Developer ID Application:")) throw integrityError("binary code signature is missing a Developer ID authority");
|
|
275
382
|
if (!HARDENED_RUNTIME_FLAG_RE.test(details)) throw integrityError("binary code signature is missing the hardened runtime");
|
|
276
383
|
if (!SIGNING_TIMESTAMP_RE.test(details)) throw integrityError("binary code signature is missing a trusted timestamp");
|
|
277
384
|
}
|
|
385
|
+
async function verifyWindowsCliBinaryCodeSignature(input) {
|
|
386
|
+
assertWindowsPreviewPolicy(input.windows, input.allowUnsignedPreview === true);
|
|
387
|
+
if ("mode" in input.windows) return;
|
|
388
|
+
try {
|
|
389
|
+
await verifyWindowsArtifactSignature(input.artifactPath, input.windows.publisherName);
|
|
390
|
+
} catch (error) {
|
|
391
|
+
throw integrityError(`Windows artifact signature verification failed: ${toError(error).message}`);
|
|
392
|
+
}
|
|
393
|
+
}
|
|
278
394
|
async function downloadCliBinaryDelta(input) {
|
|
279
395
|
const patchBytes = await downloadBinaryBytesWithRecovery({
|
|
280
396
|
attemptCeiling: input.attemptCeiling,
|
|
@@ -601,7 +717,7 @@ function daemonServiceUpdateWorkerNpmEntryPath(pathInput = {}) {
|
|
|
601
717
|
}
|
|
602
718
|
async function hasIndependentMaintenanceRegistration(pathInput = {}, platform = process$1.platform, expectedDefinition) {
|
|
603
719
|
if (platform === "win32") {
|
|
604
|
-
const { runWindowsUserTask, readWindowsTaskAction } = await import("./windows-user-task-
|
|
720
|
+
const { runWindowsUserTask, readWindowsTaskAction } = await import("./windows-user-task-B8NcRg_u.js");
|
|
605
721
|
const task = await runWindowsUserTask({
|
|
606
722
|
name: resolveDaemonServiceUpdateWorkerIdentity(pathInput).windowsServiceName,
|
|
607
723
|
legacyScript: resolveDaemonServiceUpdateWorkerWindowsScriptPath(pathInput),
|
|
@@ -612,7 +728,7 @@ async function hasIndependentMaintenanceRegistration(pathInput = {}, platform =
|
|
|
612
728
|
const registration = await readDaemonServiceUpdateWorkerRegistration(pathInput, platform);
|
|
613
729
|
if (!registration?.includes("openmeld-independent-maintenance-v1")) return false;
|
|
614
730
|
if (expectedDefinition !== void 0 && registration !== expectedDefinition) return false;
|
|
615
|
-
const { parseDaemonServiceEnvironmentFromDefinition } = await import("./daemon-service-manager-
|
|
731
|
+
const { parseDaemonServiceEnvironmentFromDefinition } = await import("./daemon-service-manager-CU-79a4z.js");
|
|
616
732
|
return resolveOpenMeldRootDir({ env: parseDaemonServiceEnvironmentFromDefinition({
|
|
617
733
|
controller: platform === "darwin" ? "launchd" : "systemd",
|
|
618
734
|
definition: registration
|
|
@@ -686,6 +802,19 @@ function resolveDaemonServiceUpdateWorkerRegistrationPath(pathInput, platform) {
|
|
|
686
802
|
return null;
|
|
687
803
|
}
|
|
688
804
|
async function readDaemonServiceUpdateWorkerRegistration(pathInput, platform) {
|
|
805
|
+
if (platform === "win32") {
|
|
806
|
+
const { runWindowsUserTask, readWindowsTaskAction } = await import("./windows-user-task-B8NcRg_u.js");
|
|
807
|
+
const task = await runWindowsUserTask({
|
|
808
|
+
name: resolveDaemonServiceUpdateWorkerIdentity(pathInput).windowsServiceName,
|
|
809
|
+
legacyScript: resolveDaemonServiceUpdateWorkerWindowsScriptPath(pathInput),
|
|
810
|
+
operation: "status"
|
|
811
|
+
});
|
|
812
|
+
if (task.actionArguments) {
|
|
813
|
+
const action = readWindowsTaskAction(task.actionArguments);
|
|
814
|
+
return [action.executable, ...action.args].join("\n");
|
|
815
|
+
}
|
|
816
|
+
if (!task.legacy) return null;
|
|
817
|
+
}
|
|
689
818
|
const registrationPath = resolveDaemonServiceUpdateWorkerRegistrationPath(pathInput, platform);
|
|
690
819
|
if (registrationPath === null) return null;
|
|
691
820
|
return await readFile(registrationPath, "utf8").catch((error) => {
|
|
@@ -705,7 +834,7 @@ function resolveBundledServiceRelease() {
|
|
|
705
834
|
if (selection === void 0) return;
|
|
706
835
|
const parsed = cliBinaryServiceReleaseSchema.safeParse(selection);
|
|
707
836
|
if (!parsed.success) throw new Error("The installed CLI contains invalid Service release metadata.");
|
|
708
|
-
const platform =
|
|
837
|
+
const platform = resolveCliBinaryPlatform(process.platform, process.arch);
|
|
709
838
|
const artifact = parsed.data.platforms[platform];
|
|
710
839
|
if (!artifact) throw new Error(`The installed CLI has no Service artifact for ${platform}.`);
|
|
711
840
|
return {
|
|
@@ -845,10 +974,14 @@ async function pruneManagedVersions(input) {
|
|
|
845
974
|
rollbackVersion ??= [...usableManagedVersions].filter((version) => compareSemver(version, input.currentVersion) < 0).sort((left, right) => compareSemver(right, left))[0] ?? null;
|
|
846
975
|
if (rollbackVersion) retainedVersions.add(rollbackVersion);
|
|
847
976
|
for (const protectedVersion of input.protectedVersions ?? []) if (usableManagedVersions.has(protectedVersion)) retainedVersions.add(protectedVersion);
|
|
848
|
-
|
|
977
|
+
for (const version of managedVersions) {
|
|
978
|
+
if (retainedVersions.has(version)) continue;
|
|
979
|
+
if (process.platform === "win32") await pruneWindowsBinaryBundle(path.join(versionsDir, version));
|
|
980
|
+
else await rm(path.join(versionsDir, version), { recursive: true });
|
|
981
|
+
}
|
|
849
982
|
}
|
|
850
983
|
async function isUsableManagedVersion(version, versionsDir) {
|
|
851
|
-
const target = path.join(versionsDir, version,
|
|
984
|
+
const target = path.join(versionsDir, version, openMeldManagedBinaryName());
|
|
852
985
|
if (!(await stat(target).catch((error) => {
|
|
853
986
|
if (getErrorCode$1(error) === "ENOENT") return null;
|
|
854
987
|
throw error;
|
|
@@ -862,13 +995,145 @@ function getErrorCode$1(error) {
|
|
|
862
995
|
return error && typeof error === "object" && "code" in error ? String(error.code) : null;
|
|
863
996
|
}
|
|
864
997
|
//#endregion
|
|
998
|
+
//#region src/local-components/windows-managed-install.ts
|
|
999
|
+
const INSTALLATION_RECORD = "cli-installation.json";
|
|
1000
|
+
const CLI_FILENAME = "openmeld.exe";
|
|
1001
|
+
const RETIRED_LAUNCHER = /^\.retired-launcher-[a-f0-9-]{36}\.exe$/u;
|
|
1002
|
+
const STAGING_VERSION = /^\.install-[A-Za-z0-9]{6}$/u;
|
|
1003
|
+
async function readWindowsManagedCliVersion(root) {
|
|
1004
|
+
const serialized = await readFile(join(root, "bin", INSTALLATION_RECORD), "utf8").catch((error) => {
|
|
1005
|
+
if (hasCode(error, "ENOENT")) return null;
|
|
1006
|
+
throw error;
|
|
1007
|
+
});
|
|
1008
|
+
if (serialized === null) return null;
|
|
1009
|
+
const parsed = windowsManagedCliInstallationSchema.safeParse(JSON.parse(serialized));
|
|
1010
|
+
if (!parsed.success) throw new Error("The managed Windows CLI installation record is invalid. No version was selected.");
|
|
1011
|
+
return parsed.data.version;
|
|
1012
|
+
}
|
|
1013
|
+
/** Publish the complete immutable directory, never overwrite an in-use image. */
|
|
1014
|
+
async function placeWindowsManagedVersion(input) {
|
|
1015
|
+
const { version } = windowsManagedCliInstallationSchema.parse({
|
|
1016
|
+
schemaVersion: 1,
|
|
1017
|
+
version: input.version
|
|
1018
|
+
});
|
|
1019
|
+
const versions = join(input.root, "versions");
|
|
1020
|
+
const destination = join(versions, version);
|
|
1021
|
+
const sources = [{
|
|
1022
|
+
source: input.sourceBinary,
|
|
1023
|
+
name: CLI_FILENAME
|
|
1024
|
+
}, {
|
|
1025
|
+
source: join(dirname(input.sourceBinary), WINDOWS_PROCESS_HELPER_FILENAME),
|
|
1026
|
+
name: WINDOWS_PROCESS_HELPER_FILENAME
|
|
1027
|
+
}];
|
|
1028
|
+
if (await entryExists(destination)) {
|
|
1029
|
+
for (const { source, name } of sources) if (!await sameFileBytes(source, join(destination, name))) throw new Error(`The installed Windows CLI ${version} differs from the selected artifact. Published versions are immutable; acquire a new release instead of overwriting this installation.`);
|
|
1030
|
+
return;
|
|
1031
|
+
}
|
|
1032
|
+
await mkdir(versions, { recursive: true });
|
|
1033
|
+
for (const entry of await readdir(versions, { withFileTypes: true })) if (entry.isDirectory() && STAGING_VERSION.test(entry.name)) await rm(join(versions, entry.name), { recursive: true });
|
|
1034
|
+
const staging = await mkdtemp(join(versions, ".install-"));
|
|
1035
|
+
try {
|
|
1036
|
+
for (const { source, name } of sources) await copyFile(source, join(staging, name));
|
|
1037
|
+
await rename(staging, destination);
|
|
1038
|
+
} finally {
|
|
1039
|
+
await rm(staging, {
|
|
1040
|
+
recursive: true,
|
|
1041
|
+
force: true
|
|
1042
|
+
});
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
/** The caller holds the shared managed-install lock. Record replacement is the commit. */
|
|
1046
|
+
async function activateWindowsManagedCli(root, version) {
|
|
1047
|
+
const record = windowsManagedCliInstallationSchema.parse({
|
|
1048
|
+
schemaVersion: 1,
|
|
1049
|
+
version
|
|
1050
|
+
});
|
|
1051
|
+
await reconcileWindowsManagedLauncher(root, version);
|
|
1052
|
+
const destination = join(root, "bin", INSTALLATION_RECORD);
|
|
1053
|
+
const temporary = `${destination}.${randomUUID()}.tmp`;
|
|
1054
|
+
try {
|
|
1055
|
+
await writeFile(temporary, `${JSON.stringify(record)}\n`, {
|
|
1056
|
+
flag: "wx",
|
|
1057
|
+
mode: 384
|
|
1058
|
+
});
|
|
1059
|
+
await rename(temporary, destination);
|
|
1060
|
+
} finally {
|
|
1061
|
+
await rm(temporary, { force: true });
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
/**
|
|
1065
|
+
* Repair from the authoritative version record. An interrupted launcher swap
|
|
1066
|
+
* can leave bin/openmeld.exe absent; install/maintenance restore it from the
|
|
1067
|
+
* immutable version without changing account data or selecting another version.
|
|
1068
|
+
*/
|
|
1069
|
+
async function reconcileWindowsManagedLauncher(root, version) {
|
|
1070
|
+
windowsManagedCliInstallationSchema.parse({
|
|
1071
|
+
schemaVersion: 1,
|
|
1072
|
+
version
|
|
1073
|
+
});
|
|
1074
|
+
const source = join(root, "versions", version, WINDOWS_PROCESS_HELPER_FILENAME);
|
|
1075
|
+
const bin = join(root, "bin");
|
|
1076
|
+
const launcher = join(bin, CLI_FILENAME);
|
|
1077
|
+
await mkdir(bin, { recursive: true });
|
|
1078
|
+
for (const entry of await readdir(bin, { withFileTypes: true })) if (entry.isFile() && RETIRED_LAUNCHER.test(entry.name)) await removeRetiredLauncher(join(bin, entry.name));
|
|
1079
|
+
if (await sameFileBytes(source, launcher)) return;
|
|
1080
|
+
const temporary = join(bin, `.launcher-${randomUUID()}.tmp`);
|
|
1081
|
+
const retired = join(bin, `.retired-launcher-${randomUUID()}.exe`);
|
|
1082
|
+
await copyFile(source, temporary);
|
|
1083
|
+
let movedPrevious = false;
|
|
1084
|
+
try {
|
|
1085
|
+
if (await entryExists(launcher)) {
|
|
1086
|
+
await rename(launcher, retired);
|
|
1087
|
+
movedPrevious = true;
|
|
1088
|
+
}
|
|
1089
|
+
try {
|
|
1090
|
+
await rename(temporary, launcher);
|
|
1091
|
+
} catch (error) {
|
|
1092
|
+
if (movedPrevious) await rename(retired, launcher);
|
|
1093
|
+
throw error;
|
|
1094
|
+
}
|
|
1095
|
+
if (movedPrevious) await removeRetiredLauncher(retired);
|
|
1096
|
+
} finally {
|
|
1097
|
+
await rm(temporary, { force: true });
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
async function removeRetiredLauncher(file) {
|
|
1101
|
+
await rm(file).catch((error) => {
|
|
1102
|
+
if (hasCode(error, "EPERM") || hasCode(error, "EBUSY")) return;
|
|
1103
|
+
throw error;
|
|
1104
|
+
});
|
|
1105
|
+
}
|
|
1106
|
+
async function entryExists(file) {
|
|
1107
|
+
return await lstat(file).then(() => true, (error) => {
|
|
1108
|
+
if (hasCode(error, "ENOENT")) return false;
|
|
1109
|
+
throw error;
|
|
1110
|
+
});
|
|
1111
|
+
}
|
|
1112
|
+
async function sameFileBytes(left, right) {
|
|
1113
|
+
const [leftStat, rightStat] = await Promise.all([lstat(left), lstat(right).catch((error) => {
|
|
1114
|
+
if (hasCode(error, "ENOENT")) return null;
|
|
1115
|
+
throw error;
|
|
1116
|
+
})]);
|
|
1117
|
+
if (!(leftStat.isFile() && rightStat?.isFile()) || leftStat.size !== rightStat.size) return false;
|
|
1118
|
+
const hash = async (file) => {
|
|
1119
|
+
const digest = createHash("sha256");
|
|
1120
|
+
for await (const chunk of createReadStream(file)) digest.update(chunk);
|
|
1121
|
+
return digest.digest("hex");
|
|
1122
|
+
};
|
|
1123
|
+
const [leftHash, rightHash] = await Promise.all([hash(left), hash(right)]);
|
|
1124
|
+
return leftHash === rightHash;
|
|
1125
|
+
}
|
|
1126
|
+
function hasCode(error, code) {
|
|
1127
|
+
return error !== null && typeof error === "object" && "code" in error && error.code === code;
|
|
1128
|
+
}
|
|
1129
|
+
//#endregion
|
|
865
1130
|
//#region src/local-components/managed-install.ts
|
|
866
1131
|
const MANAGED_INSTALL_LOCK_PROFILE = "managed-cli";
|
|
867
1132
|
const MANAGED_INSTALL_LOCK_KEY = "install";
|
|
868
1133
|
const MANAGED_INSTALL_LOCK_RETRY_DELAY_MS = 100;
|
|
869
1134
|
const MANAGED_INSTALL_LOCK_TIMEOUT_MS = 3e4;
|
|
870
1135
|
function resolveCliPlatformToken() {
|
|
871
|
-
return
|
|
1136
|
+
return resolveCliBinaryPlatform(process$1.platform, process$1.arch);
|
|
872
1137
|
}
|
|
873
1138
|
function resolveCliSelfVersion() {
|
|
874
1139
|
return OPENMELD_VERSION;
|
|
@@ -884,6 +1149,7 @@ async function isUsableManagedBinary(target) {
|
|
|
884
1149
|
});
|
|
885
1150
|
}
|
|
886
1151
|
async function readCurrentPointerVersion(pathInput = {}) {
|
|
1152
|
+
if (process$1.platform === "win32") return await readWindowsManagedCliVersion(resolveOpenMeldRootDir(pathInput));
|
|
887
1153
|
const pointerPath = openMeldManagedBinaryPath(pathInput);
|
|
888
1154
|
const target = await readlink(pointerPath).catch((error) => {
|
|
889
1155
|
if (isErrorWithCode(error, "ENOENT") || isErrorWithCode(error, "EINVAL")) return null;
|
|
@@ -894,16 +1160,23 @@ async function readCurrentPointerVersion(pathInput = {}) {
|
|
|
894
1160
|
const version = path.basename(path.dirname(resolved));
|
|
895
1161
|
return version.length > 0 && path.resolve(resolved) === openMeldManagedVersionBinaryPath(version, pathInput) ? version : null;
|
|
896
1162
|
}
|
|
897
|
-
async function readManagedCliInstallation() {
|
|
898
|
-
const version = await readCurrentPointerVersion();
|
|
1163
|
+
async function readManagedCliInstallation(pathInput = {}) {
|
|
1164
|
+
const version = await readCurrentPointerVersion(pathInput);
|
|
899
1165
|
if (!version) return null;
|
|
900
|
-
const binaryPath = openMeldManagedVersionBinaryPath(version);
|
|
1166
|
+
const binaryPath = openMeldManagedVersionBinaryPath(version, pathInput);
|
|
901
1167
|
if (!await isUsableManagedBinary(binaryPath)) return null;
|
|
902
1168
|
return {
|
|
903
1169
|
version,
|
|
904
1170
|
binaryPath
|
|
905
1171
|
};
|
|
906
1172
|
}
|
|
1173
|
+
async function reconcileManagedCliLauncher() {
|
|
1174
|
+
if (process$1.platform !== "win32") return;
|
|
1175
|
+
await withManagedInstallTransaction(async () => {
|
|
1176
|
+
const version = await readCurrentPointerVersion();
|
|
1177
|
+
if (version) await reconcileWindowsManagedLauncher(resolveOpenMeldRootDir(), version);
|
|
1178
|
+
});
|
|
1179
|
+
}
|
|
907
1180
|
/**
|
|
908
1181
|
* Install the currently-running binary (process.execPath) into the managed
|
|
909
1182
|
* layout and point bin/openmeld at it. Idempotent with semver arbitration:
|
|
@@ -957,6 +1230,7 @@ async function pruneManagedInstallVersions(input) {
|
|
|
957
1230
|
}, pathInput);
|
|
958
1231
|
}
|
|
959
1232
|
async function performManagedInstallLocked(input) {
|
|
1233
|
+
assertNoPublishedProductionMutationDuringTests({}, "managed CLI installation");
|
|
960
1234
|
const force = input?.force ?? false;
|
|
961
1235
|
const version = resolveCliSelfVersion();
|
|
962
1236
|
const platform = resolveCliPlatformToken();
|
|
@@ -975,6 +1249,7 @@ async function performManagedInstallLocked(input) {
|
|
|
975
1249
|
if (previousVersion !== null) {
|
|
976
1250
|
const comparison = compareSemver(version, previousVersion);
|
|
977
1251
|
if (!force && comparison === 0 && await isUsableManagedBinary(managedBinaryPath)) {
|
|
1252
|
+
if (process$1.platform === "win32") await reconcileWindowsManagedLauncher(resolveOpenMeldRootDir(), previousVersion);
|
|
978
1253
|
await pruneManagedVersions({
|
|
979
1254
|
currentVersion: previousVersion,
|
|
980
1255
|
protectedVersions
|
|
@@ -985,6 +1260,7 @@ async function performManagedInstallLocked(input) {
|
|
|
985
1260
|
};
|
|
986
1261
|
}
|
|
987
1262
|
if (comparison < 0 && !force) {
|
|
1263
|
+
if (process$1.platform === "win32") await reconcileWindowsManagedLauncher(resolveOpenMeldRootDir(), previousVersion);
|
|
988
1264
|
if (!await isUsableManagedBinary(managedBinaryPath)) await placeVersionedBinary(input?.sourceBinaryPath ?? process$1.execPath, version, managedBinaryPath);
|
|
989
1265
|
await pruneManagedVersions({
|
|
990
1266
|
currentVersion: previousVersion,
|
|
@@ -1020,6 +1296,14 @@ async function readManagedInstallProtectedVersions(pathInput = {}) {
|
|
|
1020
1296
|
return protectedVersions;
|
|
1021
1297
|
}
|
|
1022
1298
|
async function placeVersionedBinary(sourceBinary, version, managedBinaryPath) {
|
|
1299
|
+
if (process$1.platform === "win32") {
|
|
1300
|
+
await placeWindowsManagedVersion({
|
|
1301
|
+
root: resolveOpenMeldRootDir(),
|
|
1302
|
+
version,
|
|
1303
|
+
sourceBinary
|
|
1304
|
+
});
|
|
1305
|
+
return;
|
|
1306
|
+
}
|
|
1023
1307
|
await mkdir(openMeldManagedVersionDir(version), { recursive: true });
|
|
1024
1308
|
const tmpPath = `${managedBinaryPath}.tmp-${process$1.pid}-${Date.now()}`;
|
|
1025
1309
|
await rm(tmpPath, { force: true }).catch(() => void 0);
|
|
@@ -1032,6 +1316,10 @@ async function placeVersionedBinary(sourceBinary, version, managedBinaryPath) {
|
|
|
1032
1316
|
await rename(tmpPath, managedBinaryPath);
|
|
1033
1317
|
}
|
|
1034
1318
|
async function swapCurrentPointer(currentPointerPath, managedBinaryPath) {
|
|
1319
|
+
if (process$1.platform === "win32") {
|
|
1320
|
+
await activateWindowsManagedCli(resolveOpenMeldRootDir(), path.basename(path.dirname(managedBinaryPath)));
|
|
1321
|
+
return;
|
|
1322
|
+
}
|
|
1035
1323
|
await mkdir(openMeldBinDir(), { recursive: true });
|
|
1036
1324
|
const relativeTarget = path.relative(path.dirname(currentPointerPath), managedBinaryPath);
|
|
1037
1325
|
const tmpPath = `${currentPointerPath}.tmp-${process$1.pid}-${Date.now()}`;
|
|
@@ -1040,7 +1328,7 @@ async function swapCurrentPointer(currentPointerPath, managedBinaryPath) {
|
|
|
1040
1328
|
await rename(tmpPath, currentPointerPath);
|
|
1041
1329
|
}
|
|
1042
1330
|
function buildInstallSelfJsonPayload(outcome) {
|
|
1043
|
-
return {
|
|
1331
|
+
return cliInstallSelfResultSchema.parse({
|
|
1044
1332
|
schemaVersion: 1,
|
|
1045
1333
|
type: "cli.install_self",
|
|
1046
1334
|
result: outcome.result,
|
|
@@ -1050,7 +1338,7 @@ function buildInstallSelfJsonPayload(outcome) {
|
|
|
1050
1338
|
currentPointerPath: outcome.currentPointerPath,
|
|
1051
1339
|
previousVersion: outcome.previousVersion,
|
|
1052
1340
|
forced: outcome.forced
|
|
1053
|
-
};
|
|
1341
|
+
});
|
|
1054
1342
|
}
|
|
1055
1343
|
function isErrorWithCode(error, code) {
|
|
1056
1344
|
return error instanceof Error && "code" in error && error.code === code;
|
|
@@ -1166,6 +1454,7 @@ function hasBundleContentDrift(input) {
|
|
|
1166
1454
|
const DAEMON_ACTIVE_BUNDLE_SCHEMA = "openmeld-daemon-active-bundle-v2";
|
|
1167
1455
|
const DAEMON_ACTIVE_BUNDLE_LEGACY_SCHEMA = "openmeld-daemon-active-bundle-v1";
|
|
1168
1456
|
const DAEMON_CLI_ENTRY_NAMES = ["openmeld-dev.js", "openmeld.js"];
|
|
1457
|
+
const WINDOWS_MAINTENANCE_BUNDLE_PATTERN = /^maintenance-[0-9a-f]{64}$/u;
|
|
1169
1458
|
const DAEMON_BUNDLE_SOURCE_KIND_WORKSPACE = "workspace";
|
|
1170
1459
|
const DAEMON_BUNDLE_SOURCE_KIND_PACKAGE_INSTALL = "package_install";
|
|
1171
1460
|
const DAEMON_BUNDLE_SOURCE_KIND_NPX_CACHE = "npx_cache";
|
|
@@ -1274,7 +1563,7 @@ async function resolveAlignedDaemonActiveBundleEntryPath(input = {}) {
|
|
|
1274
1563
|
async function resolveInstalledDaemonBundleFingerprint(state, pathInput = {}) {
|
|
1275
1564
|
if (state?.bundleFormat === "binary_v1") {
|
|
1276
1565
|
const entryPath = await resolveDaemonBundleEntryPathFromState(state, pathInput);
|
|
1277
|
-
return entryPath ? await
|
|
1566
|
+
return entryPath ? await hashBinaryServiceBundle(entryPath) : null;
|
|
1278
1567
|
}
|
|
1279
1568
|
if (state?.bundleFormat === "self_contained_v1") {
|
|
1280
1569
|
const bundleRootPath = resolveDaemonBundleRootPath(state.bundleId, pathInput);
|
|
@@ -1288,6 +1577,7 @@ async function resolveInstalledDaemonBundleFingerprint(state, pathInput = {}) {
|
|
|
1288
1577
|
async function resolveDaemonBundleEntryPathFromState(state, pathInput = {}) {
|
|
1289
1578
|
if (!state) return null;
|
|
1290
1579
|
if (state.bundleFormat === "binary_v1") {
|
|
1580
|
+
if (process$1.platform === "win32") return await pathExists(state.sourceEntryScriptPath) ? state.sourceEntryScriptPath : null;
|
|
1291
1581
|
const stableExecutablePath = daemonServiceBinaryExecutablePath(pathInput);
|
|
1292
1582
|
if (await pathExists(stableExecutablePath)) return stableExecutablePath;
|
|
1293
1583
|
return await pathExists(state.sourceEntryScriptPath) ? state.sourceEntryScriptPath : null;
|
|
@@ -1366,14 +1656,15 @@ async function prepareBinaryDaemonServiceBundle(input) {
|
|
|
1366
1656
|
const { daemonVersion } = input;
|
|
1367
1657
|
const bundledRelease = resolveBundledServiceRelease();
|
|
1368
1658
|
const binaryRelease = input.binaryRelease ?? (bundledRelease?.version === daemonVersion ? bundledRelease : void 0);
|
|
1369
|
-
if (daemonVersion !== resolveCliSelfVersion()) {
|
|
1659
|
+
if (process$1.platform === "win32" || daemonVersion !== resolveCliSelfVersion()) {
|
|
1370
1660
|
const active = await readDaemonActiveBundleState();
|
|
1371
|
-
if (active?.bundleFormat === "binary_v1" && active.daemonVersion === daemonVersion && active.sourceDistFingerprint && (!binaryRelease || binaryRelease
|
|
1661
|
+
if (active?.bundleFormat === "binary_v1" && active.daemonVersion === daemonVersion && active.sourceDistFingerprint && (!binaryRelease || expectedBinaryServiceFingerprint(binaryRelease) === active.sourceDistFingerprint) && await pathExists(active.sourceEntryScriptPath) && await hashBinaryServiceBundle(active.sourceEntryScriptPath) === active.sourceDistFingerprint) return active;
|
|
1372
1662
|
}
|
|
1373
1663
|
if (binaryRelease) return await prepareSelectedBinaryDaemonServiceBundle({
|
|
1374
1664
|
daemonVersion,
|
|
1375
1665
|
release: binaryRelease
|
|
1376
1666
|
});
|
|
1667
|
+
if (process$1.platform === "win32") throw new Error("OpenMeld needs the selected Windows background Service artifact. The console CLI cannot replace it.");
|
|
1377
1668
|
if (daemonVersion !== resolveCliSelfVersion()) throw new Error(`Cannot prepare OpenMeld Service ${daemonVersion} from CLI ${resolveCliSelfVersion()}. Acquire the selected Service release before preparing the update.`);
|
|
1378
1669
|
const outcome = await performManagedInstall();
|
|
1379
1670
|
const managedBinaryPath = outcome.managedBinaryPath;
|
|
@@ -1405,7 +1696,10 @@ async function prepareSelectedBinaryDaemonServiceBundle(input) {
|
|
|
1405
1696
|
if (input.release.version !== input.daemonVersion) throw new Error("The selected Service artifact does not match the update target.");
|
|
1406
1697
|
const bundleId = createBundleId(input.daemonVersion);
|
|
1407
1698
|
const bundleRootPath = resolveDaemonBundleRootPath(bundleId);
|
|
1408
|
-
const
|
|
1699
|
+
const windows = input.release.platform.startsWith("windows-");
|
|
1700
|
+
if (process$1.platform === "win32" && input.release.platform !== "windows-x64") throw new Error("The selected Service release is not a Windows x64 artifact.");
|
|
1701
|
+
const executableName = windows ? "openmeld.exe" : "openmeld";
|
|
1702
|
+
const executablePath = join(bundleRootPath, executableName);
|
|
1409
1703
|
const onDeltaFallback = (error) => {
|
|
1410
1704
|
console.warn("[openmeld.service.artifact_delta_fallback]", error.message);
|
|
1411
1705
|
};
|
|
@@ -1426,7 +1720,9 @@ async function prepareSelectedBinaryDaemonServiceBundle(input) {
|
|
|
1426
1720
|
try {
|
|
1427
1721
|
await writeFile(executablePath, bytes, { mode: 493 });
|
|
1428
1722
|
await verifyCliBinaryCodeSignature({
|
|
1723
|
+
allowUnsignedPreview: allowUnsignedWindowsInternalPreview(),
|
|
1429
1724
|
artifactPath: executablePath,
|
|
1725
|
+
allowUnsignedForDevelopment: resolveOpenMeldEnvPreset() === "dev-local",
|
|
1430
1726
|
release: input.release,
|
|
1431
1727
|
runCommand: async (command, args) => {
|
|
1432
1728
|
const result = await promisify(execFile)(command, args, { encoding: "utf8" });
|
|
@@ -1437,6 +1733,15 @@ async function prepareSelectedBinaryDaemonServiceBundle(input) {
|
|
|
1437
1733
|
};
|
|
1438
1734
|
}
|
|
1439
1735
|
});
|
|
1736
|
+
await prepareCliBinaryProcessHelper({
|
|
1737
|
+
allowUnsignedPreview: allowUnsignedWindowsInternalPreview(),
|
|
1738
|
+
artifactPath: executablePath,
|
|
1739
|
+
release: input.release,
|
|
1740
|
+
downloadPolicy: DEFAULT_CLI_BINARY_DOWNLOAD_POLICY,
|
|
1741
|
+
fetchImpl: fetch
|
|
1742
|
+
});
|
|
1743
|
+
if (windows) await verifyWindowsServiceSubsystem(executablePath);
|
|
1744
|
+
if (await hashBinaryServiceBundle(executablePath, windows) !== expectedBinaryServiceFingerprint(input.release)) throw new Error("The prepared Service bundle does not match the selected release.");
|
|
1440
1745
|
} catch (error) {
|
|
1441
1746
|
await rm(bundleRootPath, {
|
|
1442
1747
|
recursive: true,
|
|
@@ -1450,12 +1755,12 @@ async function prepareSelectedBinaryDaemonServiceBundle(input) {
|
|
|
1450
1755
|
schema: DAEMON_ACTIVE_BUNDLE_SCHEMA,
|
|
1451
1756
|
bundleId,
|
|
1452
1757
|
daemonVersion: input.daemonVersion,
|
|
1453
|
-
entryScriptRelativePath:
|
|
1758
|
+
entryScriptRelativePath: executableName,
|
|
1454
1759
|
bundleFormat: "binary_v1",
|
|
1455
1760
|
sourceEntryScriptPath: executablePath,
|
|
1456
1761
|
sourcePackageRootPath: bundleRootPath,
|
|
1457
1762
|
sourceDistRootPath: bundleRootPath,
|
|
1458
|
-
sourceDistFingerprint: input.release
|
|
1763
|
+
sourceDistFingerprint: expectedBinaryServiceFingerprint(input.release),
|
|
1459
1764
|
sourceKind: DAEMON_BUNDLE_SOURCE_KIND_PACKAGE_INSTALL,
|
|
1460
1765
|
createdAt: now,
|
|
1461
1766
|
updatedAt: now
|
|
@@ -1541,6 +1846,13 @@ async function ensureDaemonServiceStableBinaryExecutable(pathInput = {}) {
|
|
|
1541
1846
|
}
|
|
1542
1847
|
async function ensureDaemonServiceUpdateWorkerBinaryExecutable(preparedBundle, pathInput = {}) {
|
|
1543
1848
|
if (preparedBundle.bundleFormat !== "binary_v1") throw new Error("OpenMeld cannot prepare the update worker binary without a binary Service bundle.");
|
|
1849
|
+
if (process$1.platform === "win32") return await runAuditedServiceManagerCarrierMutation({
|
|
1850
|
+
distribution: "binary",
|
|
1851
|
+
operation: "prepare_windows_maintenance_bundle",
|
|
1852
|
+
pathInput,
|
|
1853
|
+
targetPath: windowsMaintenanceBinaryPath(preparedBundle, pathInput),
|
|
1854
|
+
run: async () => await prepareWindowsMaintenanceBinary(preparedBundle, pathInput)
|
|
1855
|
+
});
|
|
1544
1856
|
return await ensureVerifiedBinaryCarrier({
|
|
1545
1857
|
bundle: preparedBundle,
|
|
1546
1858
|
operationName: "update_worker_binary",
|
|
@@ -1549,6 +1861,20 @@ async function ensureDaemonServiceUpdateWorkerBinaryExecutable(preparedBundle, p
|
|
|
1549
1861
|
});
|
|
1550
1862
|
}
|
|
1551
1863
|
async function clearDaemonServiceUpdateWorkerBinaryExecutable(pathInput = {}) {
|
|
1864
|
+
if (process$1.platform === "win32") {
|
|
1865
|
+
for (const bundleId of await readDirectoryNames(daemonRuntimeBundlesPath(pathInput))) {
|
|
1866
|
+
if (!WINDOWS_MAINTENANCE_BUNDLE_PATTERN.test(bundleId)) continue;
|
|
1867
|
+
const targetPath = resolveDaemonBundleRootPath(bundleId, pathInput);
|
|
1868
|
+
await runAuditedServiceManagerCarrierMutation({
|
|
1869
|
+
distribution: "binary",
|
|
1870
|
+
operation: "remove_windows_maintenance_bundle",
|
|
1871
|
+
pathInput,
|
|
1872
|
+
targetPath,
|
|
1873
|
+
run: async () => await pruneWindowsBinaryBundle(targetPath)
|
|
1874
|
+
});
|
|
1875
|
+
}
|
|
1876
|
+
return;
|
|
1877
|
+
}
|
|
1552
1878
|
const targetPath = daemonServiceUpdateWorkerBinaryPath(pathInput);
|
|
1553
1879
|
await runAuditedServiceManagerCarrierMutation({
|
|
1554
1880
|
distribution: "binary",
|
|
@@ -1714,16 +2040,19 @@ async function cleanupInactiveDaemonServiceBundles(input = {}) {
|
|
|
1714
2040
|
...serviceContract?.bundleId ? [serviceContract.bundleId] : [],
|
|
1715
2041
|
...runtimeLease?.bundleId ? [runtimeLease.bundleId] : [],
|
|
1716
2042
|
...registeredWorkerBundleIds,
|
|
1717
|
-
...pendingUpdate?.preparedBundle.bundleFormat
|
|
2043
|
+
...pendingUpdate?.preparedBundle.bundleFormat !== "legacy_linked_v1" && pendingUpdate ? [pendingUpdate.preparedBundle.bundleId] : [],
|
|
1718
2044
|
...input.retainBundleIds ?? []
|
|
1719
2045
|
]);
|
|
1720
2046
|
const bundleEntries = await readDirectoryNames(daemonRuntimeBundlesPath());
|
|
1721
|
-
|
|
1722
|
-
|
|
2047
|
+
for (const bundleId of bundleEntries) {
|
|
2048
|
+
if (retain.has(bundleId)) continue;
|
|
2049
|
+
const directory = resolveDaemonBundleRootPath(bundleId);
|
|
2050
|
+
if (process$1.platform === "win32") await pruneWindowsBinaryBundle(directory);
|
|
2051
|
+
else await rm(directory, {
|
|
1723
2052
|
recursive: true,
|
|
1724
2053
|
force: true
|
|
1725
2054
|
});
|
|
1726
|
-
}
|
|
2055
|
+
}
|
|
1727
2056
|
}
|
|
1728
2057
|
async function resolveDaemonBundleSourceProvenance(explicitPath) {
|
|
1729
2058
|
const sourceEntryScriptPath = await resolveCliScriptPath(explicitPath);
|
|
@@ -2321,7 +2650,7 @@ function getErrorCode(error) {
|
|
|
2321
2650
|
}
|
|
2322
2651
|
//#endregion
|
|
2323
2652
|
//#region src/local-service/lifecycle/daemon-managed-binary-path.ts
|
|
2324
|
-
const
|
|
2653
|
+
const MANAGED_BINARY_NAMES = ["openmeld.exe", "openmeld"];
|
|
2325
2654
|
const PATH_BOUNDARY_PATTERN = /[\s"'<>]/u;
|
|
2326
2655
|
const TRAILING_SLASHES_PATTERN = /\/+$/u;
|
|
2327
2656
|
const VERSION_SEGMENT_BOUNDARY_PATTERN = /[\s"'<>/]/u;
|
|
@@ -2340,7 +2669,7 @@ function resolveOpenMeldManagedVersionBinaryRootPath(value) {
|
|
|
2340
2669
|
const binaryName = segments.pop();
|
|
2341
2670
|
const versionSegment = segments.pop();
|
|
2342
2671
|
const versionsDirectory = segments.pop();
|
|
2343
|
-
if (binaryName
|
|
2672
|
+
if (!MANAGED_BINARY_NAMES.includes(binaryName ?? "") || versionsDirectory !== "versions" || !versionSegment || !isValidManagedVersionSegment(versionSegment)) return null;
|
|
2344
2673
|
const rootPath = segments.join("/");
|
|
2345
2674
|
if (rootPath.length > 0) return rootPath;
|
|
2346
2675
|
return normalizedPath.startsWith("/") ? "/" : null;
|
|
@@ -2351,7 +2680,7 @@ function isManagedVersionBinaryPath(normalizedPath, pathInput) {
|
|
|
2351
2680
|
const segments = normalizedPath.slice(versionsRoot.length).split("/");
|
|
2352
2681
|
const versionSegment = segments[0] ?? "";
|
|
2353
2682
|
const binaryName = segments[1] ?? "";
|
|
2354
|
-
return segments.length === 2 && versionSegment.length > 0 && binaryName
|
|
2683
|
+
return segments.length === 2 && versionSegment.length > 0 && MANAGED_BINARY_NAMES.includes(binaryName);
|
|
2355
2684
|
}
|
|
2356
2685
|
function containsManagedVersionBinaryPath(normalizedValue, pathInput) {
|
|
2357
2686
|
const versionsRoot = normalizeVersionsRoot(pathInput);
|
|
@@ -2362,8 +2691,8 @@ function containsManagedVersionBinaryPath(normalizedValue, pathInput) {
|
|
|
2362
2691
|
const versionSeparatorIndex = afterRoot.indexOf("/");
|
|
2363
2692
|
if (isPathBoundary(before) && versionSeparatorIndex > 0 && isValidManagedVersionSegment(afterRoot.slice(0, versionSeparatorIndex))) {
|
|
2364
2693
|
const afterVersion = afterRoot.slice(versionSeparatorIndex + 1);
|
|
2365
|
-
if (afterVersion.startsWith(
|
|
2366
|
-
if (isPathBoundary(afterVersion[
|
|
2694
|
+
for (const binaryName of MANAGED_BINARY_NAMES) if (afterVersion.startsWith(binaryName)) {
|
|
2695
|
+
if (isPathBoundary(afterVersion[binaryName.length] ?? "")) return true;
|
|
2367
2696
|
}
|
|
2368
2697
|
}
|
|
2369
2698
|
index = normalizedValue.indexOf(versionsRoot, index + 1);
|
|
@@ -2715,11 +3044,28 @@ function collapseLauncherWrapperProcesses(processes) {
|
|
|
2715
3044
|
return collapsedProcesses;
|
|
2716
3045
|
}
|
|
2717
3046
|
async function listWindowsProcesses() {
|
|
2718
|
-
const
|
|
3047
|
+
const script = `
|
|
3048
|
+
$ErrorActionPreference='Stop'
|
|
3049
|
+
$ProgressPreference='SilentlyContinue'
|
|
3050
|
+
[Console]::OutputEncoding = New-Object System.Text.UTF8Encoding($false)
|
|
3051
|
+
[Console]::Error.WriteLine('openmeld.inventory.query_started')
|
|
3052
|
+
$rows = @(Get-CimInstance Win32_Process -Property ProcessId,ParentProcessId,CommandLine | Select-Object ProcessId,ParentProcessId,CommandLine)
|
|
3053
|
+
[Console]::Error.WriteLine('openmeld.inventory.query_completed')
|
|
3054
|
+
ConvertTo-Json -InputObject $rows -Compress
|
|
3055
|
+
`;
|
|
3056
|
+
const startedAt = Date.now();
|
|
3057
|
+
const { stdout: output } = await promisify(execFile)(resolveWindowsPowerShellPath(), powerShellEncodedArguments(script), {
|
|
2719
3058
|
encoding: "utf8",
|
|
2720
3059
|
windowsHide: true,
|
|
2721
3060
|
timeout: 1e4,
|
|
2722
3061
|
maxBuffer: 8 * 1024 * 1024
|
|
3062
|
+
}).catch((error) => {
|
|
3063
|
+
const failure = error;
|
|
3064
|
+
const evidence = typeof failure.stderr === "string" ? failure.stderr : "";
|
|
3065
|
+
let phase = "powershell_start";
|
|
3066
|
+
if (evidence.includes("openmeld.inventory.query_completed")) phase = "output";
|
|
3067
|
+
else if (evidence.includes("openmeld.inventory.query_started")) phase = "query";
|
|
3068
|
+
throw new Error(`Windows process inventory failed after ${Date.now() - startedAt}ms (phase=${phase}, code=${String(failure.code ?? "unknown")}, signal=${String(failure.signal ?? "none")}, killed=${String(failure.killed ?? false)}).`, { cause: error });
|
|
2723
3069
|
});
|
|
2724
3070
|
return parseWindowsProcessInventory(output);
|
|
2725
3071
|
}
|
|
@@ -3091,6 +3437,6 @@ async function readObservedRuntimeState() {
|
|
|
3091
3437
|
});
|
|
3092
3438
|
}
|
|
3093
3439
|
//#endregion
|
|
3094
|
-
export {
|
|
3440
|
+
export { readPendingDaemonServiceUpdate as $, prepareDaemonServiceBundle as A, resolveDaemonServiceArtifact as B, daemonServiceExecutableWrapperPath as C, ensureDaemonServiceStableBinaryExecutable as D, discardPreparedDaemonServiceBundle as E, restoreDaemonActiveBundleStateSnapshot as F, readManagedCliInstallation as G, buildInstallSelfJsonPayload as H, runAuditedServiceManagerCarrierMutation as I, withManagedInstallTransaction as J, reconcileManagedCliLauncher as K, verifyDaemonActiveBundleIntegrity as L, resolveAlignedDaemonActiveBundleEntryPath as M, resolveDaemonBundleEntryPathFromState as N, ensureDaemonServiceUpdateWorkerBinaryExecutable as O, resolveInstalledDaemonBundleFingerprint as P, readLastDaemonServiceUpdate as Q, writeDaemonServiceExecutableWrapper as R, daemonServiceBinaryExecutablePath as S, daemonServiceUpdateWorkerBinaryPath as T, performManagedInstall as U, collectLocalOperationFailure as V, pruneManagedInstallVersions as W, completePendingDaemonServiceUpdate as X, DAEMON_SERVICE_UPDATE_JOB_SCHEMA as Y, persistPendingDaemonServiceUpdate as Z, matchesExpectedDaemonServiceManagerDefinition as _, resolveDaemonRuntimeState as a, resolveDaemonServiceUpdateWorkerIdentity as at, cleanupInactiveDaemonServiceBundles as b, resolveObservedDaemonRuntimeStatus as c, resolveDaemonServiceUpdateWorkerSystemdTimerUnitPath as ct, inspectLegacySharedDaemonService as d, DEFAULT_CLI_BINARY_DOWNLOAD_POLICY as dt, resolveBundledServiceRelease as et, listDaemonOwnedProcesses as f, allowUnsignedWindowsInternalPreview as ft, assertDaemonMaintenanceInstallationOwnership as g, verifyCliBinaryCodeSignature as gt, resolveDaemonBundleIdFromEntryPath as h, resolveCliBinaryUpdatePlan as ht, readCurrentObservedDaemonRuntimeStatus as i, hasIndependentMaintenanceRegistration as it, readDaemonActiveBundleState as j, isDaemonBundleSourceAllowedForLane as k, resolveObservedRuntimeCommandEntryPath as l, resolveDaemonServiceUpdateWorkerSystemdUnitPath as lt, normalizeDaemonCommandPath as m, prepareCliBinaryProcessHelper as mt, getEffectiveDaemonRuntimeStatus as n, configureDaemonMaintenanceEnvironment as nt, resolveDaemonServiceManagerForRuntimeState as o, resolveDaemonServiceUpdateWorkerLaunchdPlistPath as ot, extractDaemonCommandEntryPath as p, downloadCliBinaryUpdateArtifact as pt, resolveCliSelfVersion as q, readCurrentDaemonRuntimeContext as r, daemonServiceUpdateWorkerNpmEntryPath as rt, waitForDaemonSystemServiceToStop as s, resolveDaemonServiceUpdateWorkerSystemdPathUnitPath as st, clearDaemonRuntimeStateIfDefinitelyStopped as t, INDEPENDENT_MAINTENANCE_REGISTRATION as tt, cleanupLegacySharedDaemonServiceState as u, resolveDaemonServiceUpdateWorkerWindowsScriptPath as ut, isOpenMeldManagedBinaryPath as v, daemonServiceLauncherPath as w, clearDaemonServiceUpdateWorkerBinaryExecutable as x, activateDaemonServiceBundle as y, writeDaemonServiceLauncher as z };
|
|
3095
3441
|
|
|
3096
|
-
//# sourceMappingURL=daemon-service-runtime-
|
|
3442
|
+
//# sourceMappingURL=daemon-service-runtime-BEfMD5jb.js.map
|