openmeld 0.3.212 → 0.3.214

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.
Files changed (109) hide show
  1. package/dist/{add-me-membership-BwPpVKtA.js → add-me-membership-BaqG9F5c.js} +2 -2
  2. package/dist/{add-me-membership-BwPpVKtA.js.map → add-me-membership-BaqG9F5c.js.map} +1 -1
  3. package/dist/{agents-Y-UJ74By.js → agents-y9C8FCyv.js} +8 -8
  4. package/dist/{agents-Y-UJ74By.js.map → agents-y9C8FCyv.js.map} +1 -1
  5. package/dist/{api-client-foundation-CrQN8_-N.js → api-client-foundation-BYnU1pbS.js} +1 -1
  6. package/dist/{api-client-foundation-DjbtuE52.js → api-client-foundation-CKRP7Ymg.js} +3 -3
  7. package/dist/{api-client-foundation-DjbtuE52.js.map → api-client-foundation-CKRP7Ymg.js.map} +1 -1
  8. package/dist/auth-session-BWKfXWxl.js +4 -0
  9. package/dist/{auth-session-Dqz9X4F0.js → auth-session-gaLjWIKR.js} +67 -8
  10. package/dist/auth-session-gaLjWIKR.js.map +1 -0
  11. package/dist/{base-url-C6sHRNGu.js → base-url-BczddvzH.js} +2 -2
  12. package/dist/{base-url-C6sHRNGu.js.map → base-url-BczddvzH.js.map} +1 -1
  13. package/dist/{base-url-BE3pFiOZ.js → base-url-CfyKRz89.js} +1 -1
  14. package/dist/{command-jgHbP21v.js → command-C72QNhjP.js} +13 -13
  15. package/dist/{command-jgHbP21v.js.map → command-C72QNhjP.js.map} +1 -1
  16. package/dist/computer-connection-Dv9kex7h.js +120 -0
  17. package/dist/computer-connection-Dv9kex7h.js.map +1 -0
  18. package/dist/{computer-connection-review-CzSpaHE0.js → computer-connection-review-_ZLPsdE_.js} +6 -6
  19. package/dist/{computer-connection-review-CzSpaHE0.js.map → computer-connection-review-_ZLPsdE_.js.map} +1 -1
  20. package/dist/{computer-disconnect-DNM7jvda.js → computer-disconnect-BJ-Tl-7q.js} +9 -9
  21. package/dist/{computer-disconnect-DNM7jvda.js.map → computer-disconnect-BJ-Tl-7q.js.map} +1 -1
  22. package/dist/{computer-setup-continuation-BqdhIAjT.js → computer-setup-continuation-CN383Vvy.js} +4 -4
  23. package/dist/{computer-setup-continuation-BqdhIAjT.js.map → computer-setup-continuation-CN383Vvy.js.map} +1 -1
  24. package/dist/{control-plane-PxntAyDq.js → control-plane-Bpu7g9Av.js} +2 -2
  25. package/dist/{control-plane-PxntAyDq.js.map → control-plane-Bpu7g9Av.js.map} +1 -1
  26. package/dist/{daemon-runtime-lease-Dd4hdHNo.js → daemon-runtime-lease-CIzOT1zx.js} +2 -2
  27. package/dist/{daemon-runtime-lease-Dd4hdHNo.js.map → daemon-runtime-lease-CIzOT1zx.js.map} +1 -1
  28. package/dist/{daemon-runtime-lease-y3n1K0-C.js → daemon-runtime-lease-_M6hW8Mg.js} +1 -1
  29. package/dist/{daemon-service-manager-GiMCiTmu.js → daemon-service-manager-DxS5eH_N.js} +4 -4
  30. package/dist/{daemon-service-manager-GiMCiTmu.js.map → daemon-service-manager-DxS5eH_N.js.map} +1 -1
  31. package/dist/{daemon-service-manager-Bh0LoLed.js → daemon-service-manager-fPpyIyrU.js} +1 -1
  32. package/dist/{daemon-service-runtime-CWTlAhZY.js → daemon-service-runtime-CGT3yVOs.js} +113 -26
  33. package/dist/daemon-service-runtime-CGT3yVOs.js.map +1 -0
  34. package/dist/{daemon-service-update-coordinator-DcjOzGu1.js → daemon-service-update-coordinator--xLHNqDT.js} +966 -210
  35. package/dist/daemon-service-update-coordinator--xLHNqDT.js.map +1 -0
  36. package/dist/{daemon-state-C37ZtIZK.js → daemon-state-CoAZLwpi.js} +3 -3
  37. package/dist/{daemon-state-C37ZtIZK.js.map → daemon-state-CoAZLwpi.js.map} +1 -1
  38. package/dist/dist-CABuqfdH.js +4 -0
  39. package/dist/{dist-jsWwS864.js → dist-Dj3TOx03.js} +548 -223
  40. package/dist/dist-Dj3TOx03.js.map +1 -0
  41. package/dist/distribution-BDQT2ilb.js +20 -0
  42. package/dist/distribution-BDQT2ilb.js.map +1 -0
  43. package/dist/{elapsed-time-iFOSSUJo.js → elapsed-time-CCFWbCC8.js} +9 -7
  44. package/dist/{elapsed-time-iFOSSUJo.js.map → elapsed-time-CCFWbCC8.js.map} +1 -1
  45. package/dist/{installation-inventory-B0cbVLun.js → installation-inventory-C4WKcVEj.js} +6 -6
  46. package/dist/{installation-inventory-B0cbVLun.js.map → installation-inventory-C4WKcVEj.js.map} +1 -1
  47. package/dist/{local-components-H3SkJMC1.js → local-components-B6SCXZf9.js} +10 -2
  48. package/dist/local-components-B6SCXZf9.js.map +1 -0
  49. package/dist/{lock-Dxp6o_t_.js → lock-CAt9uTnZ.js} +5 -48
  50. package/dist/lock-CAt9uTnZ.js.map +1 -0
  51. package/dist/{openmeld-B4gQCCex.js → openmeld-DpV9lAF-.js} +325 -190
  52. package/dist/openmeld-DpV9lAF-.js.map +1 -0
  53. package/dist/openmeld-dev.js +1 -1
  54. package/dist/{openmeld-environment-target-NtJYJe1D.js → openmeld-environment-target-BWI2adGw.js} +3 -3
  55. package/dist/{openmeld-environment-target-NtJYJe1D.js.map → openmeld-environment-target-BWI2adGw.js.map} +1 -1
  56. package/dist/{openmeld-maintenance-worker-DtY_H7Bv.js → openmeld-maintenance-worker-Blfu_oOo.js} +9 -9
  57. package/dist/{openmeld-maintenance-worker-DtY_H7Bv.js.map → openmeld-maintenance-worker-Blfu_oOo.js.map} +1 -1
  58. package/dist/{openmeld-tools-update-join-DS_EIL5q.js → openmeld-tools-update-join-BpLwmowQ.js} +6 -4
  59. package/dist/{openmeld-tools-update-join-DS_EIL5q.js.map → openmeld-tools-update-join-BpLwmowQ.js.map} +1 -1
  60. package/dist/{openmeld-tools-update-process-frame-CbZPpc7D.js → openmeld-tools-update-process-frame-0X-t0Kjv.js} +2 -2
  61. package/dist/{openmeld-tools-update-process-frame-CbZPpc7D.js.map → openmeld-tools-update-process-frame-0X-t0Kjv.js.map} +1 -1
  62. package/dist/{openmeld-tools-update-process-frame-CcPLrSsw.js → openmeld-tools-update-process-frame-DX1Dc8VI.js} +1 -1
  63. package/dist/openmeld.js +4 -4
  64. package/dist/{prepare-session-executor-CWKqfuse.js → prepare-session-executor-Cfm3EvXl.js} +176 -23
  65. package/dist/prepare-session-executor-Cfm3EvXl.js.map +1 -0
  66. package/dist/process-identity-Clby123a.js +145 -0
  67. package/dist/process-identity-Clby123a.js.map +1 -0
  68. package/dist/{runtime-transport-BQAmcHwF.js → runtime-transport-D8G8sANa.js} +113 -10
  69. package/dist/runtime-transport-D8G8sANa.js.map +1 -0
  70. package/dist/{service-CTG3_X0o.js → service-Cl_Ge6oJ.js} +949 -75
  71. package/dist/service-Cl_Ge6oJ.js.map +1 -0
  72. package/dist/{distribution-DY2fBeSW.js → service-account-admission-Dy2W3n3_.js} +9 -19
  73. package/dist/service-account-admission-Dy2W3n3_.js.map +1 -0
  74. package/dist/{service-account-authorization-Dq4LcAVa.js → service-account-authorization-4oZuo8sT.js} +6 -6
  75. package/dist/{service-account-authorization-Dq4LcAVa.js.map → service-account-authorization-4oZuo8sT.js.map} +1 -1
  76. package/dist/{service-account-control-BTR_X7QM.js → service-account-control-CTXv3924.js} +11 -12
  77. package/dist/service-account-control-CTXv3924.js.map +1 -0
  78. package/dist/{service-control-capabilities-ChRe8hkw.js → service-control-capabilities-B-vCQoBV.js} +1 -1
  79. package/dist/service-control-capabilities-ptf0u8n5.js +70 -0
  80. package/dist/service-control-capabilities-ptf0u8n5.js.map +1 -0
  81. package/dist/service-control-carrier-capability-hvpD7hGf.js +24 -0
  82. package/dist/service-control-carrier-capability-hvpD7hGf.js.map +1 -0
  83. package/dist/upgrade-EWdIdoHm.js +4 -0
  84. package/dist/{upgrade-DAVEeo8B.js → upgrade-vuPM1iX3.js} +12 -9
  85. package/dist/{upgrade-DAVEeo8B.js.map → upgrade-vuPM1iX3.js.map} +1 -1
  86. package/dist/{windows-user-task-DxPN7TzK.js → windows-user-task-FdycoSb4.js} +1 -1
  87. package/dist/{windows-user-task-DqJWtlAm.js → windows-user-task-i0oHCBc0.js} +49 -19
  88. package/dist/windows-user-task-i0oHCBc0.js.map +1 -0
  89. package/package.json +2 -2
  90. package/dist/auth-session-Dqz9X4F0.js.map +0 -1
  91. package/dist/auth-session-bRzDGlXy.js +0 -4
  92. package/dist/computer-connection-DvqsgYls.js +0 -81
  93. package/dist/computer-connection-DvqsgYls.js.map +0 -1
  94. package/dist/daemon-service-runtime-CWTlAhZY.js.map +0 -1
  95. package/dist/daemon-service-update-coordinator-DcjOzGu1.js.map +0 -1
  96. package/dist/dist--pb6JxqG.js +0 -4
  97. package/dist/dist-jsWwS864.js.map +0 -1
  98. package/dist/distribution-DY2fBeSW.js.map +0 -1
  99. package/dist/local-components-H3SkJMC1.js.map +0 -1
  100. package/dist/lock-Dxp6o_t_.js.map +0 -1
  101. package/dist/openmeld-B4gQCCex.js.map +0 -1
  102. package/dist/prepare-session-executor-CWKqfuse.js.map +0 -1
  103. package/dist/runtime-transport-BQAmcHwF.js.map +0 -1
  104. package/dist/service-CTG3_X0o.js.map +0 -1
  105. package/dist/service-account-control-BTR_X7QM.js.map +0 -1
  106. package/dist/service-control-capabilities-C5SxnBg2.js +0 -54
  107. package/dist/service-control-capabilities-C5SxnBg2.js.map +0 -1
  108. package/dist/upgrade-DKXu-1wO.js +0 -4
  109. package/dist/windows-user-task-DqJWtlAm.js.map +0 -1
@@ -1,15 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { $ as openMeldBinDir, N as OPENMELD_HOME_ENV_KEY, a as isOpenMeldOrphanedLockError, d as runWithHeldLock, dt as resolveOpenMeldEnvPreset, et as openMeldManagedBinaryPath, ft as resolveOpenMeldRootDir, i as isOpenMeldLockError, it as openMeldVersionsDir, mt as resolveOpenMeldServiceScope, nt as openMeldManagedVersionDir, rt as openMeldRootDir, t as acquireLock, tt as openMeldManagedVersionBinaryPath, v as resolveCliContextId } from "./lock-Dxp6o_t_.js";
3
+ import { $ as openMeldManagedVersionDir, A as OPENMELD_HOME_ENV_KEY, Q as openMeldManagedVersionBinaryPath, X as openMeldBinDir, Z as openMeldManagedBinaryPath, a as isOpenMeldOrphanedLockError, ct as resolveOpenMeldEnvPreset, d as runWithHeldLock, dt as resolveOpenMeldServiceScope, et as openMeldRootDir, i as isOpenMeldLockError, lt as resolveOpenMeldRootDir, t as acquireLock, tt as openMeldVersionsDir, v as resolveCliContextId } from "./lock-CAt9uTnZ.js";
4
4
  import { n as cliBinaryManifestSchema, r as cliBinaryServiceReleaseSchema, t as cliBinaryDeltaPatchSchema } from "./cli-binary-manifest-DiUulkp0.js";
5
- import { a as openMeldDaemonControlPlaneResponseSchema } from "./control-plane-PxntAyDq.js";
6
- import { b as openMeldToolsUpdateOperationPhaseSchema, w as openMeldToolsUpdateRequestSourceSchema } from "./local-components-H3SkJMC1.js";
5
+ import { a as openMeldDaemonControlPlaneResponseSchema } from "./control-plane-Bpu7g9Av.js";
6
+ import { b as openMeldToolsUpdateOperationPhaseSchema, w as openMeldToolsUpdateRequestSourceSchema } from "./local-components-B6SCXZf9.js";
7
7
  import { t as daemonServiceContractSchema } from "./service-contract-CRyDcIIf.js";
8
- import { n as resolveOpenMeldDistribution, t as isBinaryDistribution } from "./distribution-DY2fBeSW.js";
9
- import { r as readDaemonRuntimeLease } from "./daemon-runtime-lease-Dd4hdHNo.js";
8
+ import { r as readDaemonRuntimeLease } from "./daemon-runtime-lease-CIzOT1zx.js";
9
+ import { a as powerShellEncodedArguments, s as resolveWindowsPowerShellPath } from "./process-identity-Clby123a.js";
10
10
  import { n as writeDaemonLocalStateFile, t as readDaemonLocalStateFile } from "./daemon-local-state-file-jOXuXrky.js";
11
- import { A as getDaemonStatus, C as daemonServiceStableBinaryExecutablePath, D as daemonStatePath, E as daemonServiceUpdateWorkerBinaryExecutablePath, N as readDaemonControlPlaneToken, P as readDaemonServiceLifecycleLockMeta, R as resolveDaemonControlPlaneEndpoint, T as daemonServiceStableLauncherPath, U as uninstallDaemon, _ as daemonRuntimeStateRootPath, a as DAEMON_SERVICE_RUNTIME_MODE_ENV, b as daemonServiceLegacyExecutableWrapperPath, f as daemonLifecycleJournalPath, 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-C37ZtIZK.js";
12
- import { A as isTestProcess, D as assertNoPublishedProductionMutationDuringTests, E as resolveDaemonServiceIdentity, S as resolveDaemonServiceManager, k as isPublishedProductionOpenMeldRoot } from "./daemon-service-manager-GiMCiTmu.js";
11
+ import { n as resolveOpenMeldDistribution, t as isBinaryDistribution } from "./distribution-BDQT2ilb.js";
12
+ import { A as getDaemonStatus, C as daemonServiceStableBinaryExecutablePath, D as daemonStatePath, E as daemonServiceUpdateWorkerBinaryExecutablePath, N as readDaemonControlPlaneToken, P as readDaemonServiceLifecycleLockMeta, R as resolveDaemonControlPlaneEndpoint, T as daemonServiceStableLauncherPath, U as uninstallDaemon, _ as daemonRuntimeStateRootPath, a as DAEMON_SERVICE_RUNTIME_MODE_ENV, b as daemonServiceLegacyExecutableWrapperPath, f as daemonLifecycleJournalPath, 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-CoAZLwpi.js";
13
+ import { A as isTestProcess, D as assertNoPublishedProductionMutationDuringTests, E as resolveDaemonServiceIdentity, S as resolveDaemonServiceManager, k as isPublishedProductionOpenMeldRoot } from "./daemon-service-manager-DxS5eH_N.js";
13
14
  import { t as sleep } from "./dist-o3UL1EGQ.js";
14
15
  import { createRequire } from "node:module";
15
16
  import { createHash } from "node:crypto";
@@ -58,6 +59,8 @@ const daemonServiceUpdateJobBodySchema = z$1.strictObject({
58
59
  jobId: z$1.string().min(1),
59
60
  preparedBundle: daemonServiceUpdatePreparedBundleSchema,
60
61
  requestedAt: z$1.iso.datetime({ offset: true }),
62
+ targetCliVersion: z$1.string().min(1).optional(),
63
+ targetServiceVersion: z$1.string().min(1).optional(),
61
64
  targetVersion: z$1.string().min(1),
62
65
  updatedAt: z$1.iso.datetime({ offset: true }),
63
66
  urgency: z$1.enum(["available", "required"])
@@ -307,6 +310,7 @@ async function writeControlPlaneRequest(input) {
307
310
  socket.write(`${JSON.stringify(input.request)}\n`);
308
311
  };
309
312
  const handleData = (chunk) => {
313
+ if (!responseBuffer && chunk.trim().length === 0) return;
310
314
  responseBuffer += chunk;
311
315
  };
312
316
  const handleEnd = () => {
@@ -539,6 +543,7 @@ async function downloadCliBinaryDelta(input) {
539
543
  expectedSizeBytes: input.delta.patchSizeBytes,
540
544
  fetchImpl: input.fetchImpl,
541
545
  label: "binary delta archive",
546
+ onProgress: input.onProgress,
542
547
  recovery: input.recovery,
543
548
  url: input.delta.patchUrl
544
549
  });
@@ -586,6 +591,7 @@ async function downloadFullCliBinaryArtifact(input) {
586
591
  expectedSizeBytes: input.plan.downloadSizeBytes,
587
592
  fetchImpl: input.fetchImpl,
588
593
  label: input.plan.transport === "archive" ? "binary archive" : "binary download",
594
+ onProgress: input.onProgress,
589
595
  recovery: input.recovery,
590
596
  url: input.plan.downloadUrl
591
597
  });
@@ -675,6 +681,11 @@ async function downloadBinaryBytesAttempt(input) {
675
681
  reader = response.body.getReader();
676
682
  const chunks = [];
677
683
  let receivedBytes = 0;
684
+ input.onProgress?.({
685
+ receivedBytes,
686
+ totalBytes: input.expectedSizeBytes,
687
+ transferAttempt: input.recovery.attemptsStarted
688
+ });
678
689
  while (true) {
679
690
  const next = await waitForDownloadProgress(reader.read(), {
680
691
  controller,
@@ -686,6 +697,11 @@ async function downloadBinaryBytesAttempt(input) {
686
697
  lastProgressAtMs = performance.now();
687
698
  receivedBytes += next.value.byteLength;
688
699
  if (receivedBytes > input.expectedSizeBytes) throw integrityError(`${input.label} size exceeded the declared ${input.expectedSizeBytes} bytes while downloading`);
700
+ input.onProgress?.({
701
+ receivedBytes,
702
+ totalBytes: input.expectedSizeBytes,
703
+ transferAttempt: input.recovery.attemptsStarted
704
+ });
689
705
  chunks.push(Buffer.from(next.value));
690
706
  }
691
707
  } catch (error) {
@@ -847,7 +863,7 @@ function daemonServiceUpdateWorkerNpmEntryPath(pathInput = {}) {
847
863
  }
848
864
  async function hasIndependentMaintenanceRegistration(pathInput = {}, platform = process$1.platform, expectedDefinition) {
849
865
  if (platform === "win32") {
850
- const { runWindowsUserTask, readWindowsTaskAction } = await import("./windows-user-task-DxPN7TzK.js");
866
+ const { runWindowsUserTask, readWindowsTaskAction } = await import("./windows-user-task-FdycoSb4.js");
851
867
  const task = await runWindowsUserTask({
852
868
  name: resolveDaemonServiceUpdateWorkerIdentity(pathInput).windowsServiceName,
853
869
  legacyScript: resolveDaemonServiceUpdateWorkerWindowsScriptPath(pathInput),
@@ -858,7 +874,7 @@ async function hasIndependentMaintenanceRegistration(pathInput = {}, platform =
858
874
  const registration = await readDaemonServiceUpdateWorkerRegistration(pathInput, platform);
859
875
  if (!registration?.includes("openmeld-independent-maintenance-v1")) return false;
860
876
  if (expectedDefinition !== void 0 && registration !== expectedDefinition) return false;
861
- const { parseDaemonServiceEnvironmentFromDefinition } = await import("./daemon-service-manager-Bh0LoLed.js");
877
+ const { parseDaemonServiceEnvironmentFromDefinition } = await import("./daemon-service-manager-fPpyIyrU.js");
862
878
  return resolveOpenMeldRootDir({ env: parseDaemonServiceEnvironmentFromDefinition({
863
879
  controller: platform === "darwin" ? "launchd" : "systemd",
864
880
  definition: registration
@@ -947,8 +963,8 @@ function getErrorCode$2(error) {
947
963
  var package_default = {
948
964
  $schema: "https://www.schemastore.org/package.json",
949
965
  name: "openmeld",
950
- version: "0.3.212",
951
- openMeldReleaseDate: "2026-09-16",
966
+ version: "0.3.214",
967
+ openMeldReleaseDate: "2026-09-20",
952
968
  description: "OpenMeld CLI - https://openmeld.ai",
953
969
  license: "MIT",
954
970
  type: "module",
@@ -1305,6 +1321,7 @@ function toErrorMessage(error) {
1305
1321
  }
1306
1322
  //#endregion
1307
1323
  //#region src/local-service/lifecycle/daemon-service-update-state.ts
1324
+ const UPDATE_TARGETS_FILE = "service-update-targets.json";
1308
1325
  const DAEMON_SERVICE_UPDATE_JOB_SCHEMA = OPENMELD_DAEMON_SERVICE_UPDATE_JOB_SCHEMA;
1309
1326
  function daemonServicePendingUpdatePath(pathInput = {}) {
1310
1327
  return join(daemonRuntimeStateRootPath(pathInput), "service-update.json");
@@ -1343,14 +1360,23 @@ async function readDaemonServiceUpdateJob(path) {
1343
1360
  if (raw === null) return null;
1344
1361
  const parsed = storedDaemonServiceUpdateJobSchema.safeParse(JSON.parse(raw));
1345
1362
  if (!parsed.success) throw new Error("OpenMeld Service update state is invalid.");
1346
- if (parsed.data.v === 2) return parsed.data;
1347
- const { status, ...legacyJob } = parsed.data;
1363
+ let job;
1364
+ if (parsed.data.v === 2) job = parsed.data;
1365
+ else {
1366
+ const { status, ...legacyJob } = parsed.data;
1367
+ job = daemonServiceUpdateJobSchema.parse({
1368
+ ...legacyJob,
1369
+ v: 2,
1370
+ schema: DAEMON_SERVICE_UPDATE_JOB_SCHEMA,
1371
+ phase: migrateLegacyPhase(status),
1372
+ requestSource: "cli"
1373
+ });
1374
+ }
1375
+ const targets = await readDaemonServiceUpdateTargets(dirname(path));
1376
+ if (targets?.jobId !== job.jobId) return job;
1348
1377
  return daemonServiceUpdateJobSchema.parse({
1349
- ...legacyJob,
1350
- v: 2,
1351
- schema: DAEMON_SERVICE_UPDATE_JOB_SCHEMA,
1352
- phase: migrateLegacyPhase(status),
1353
- requestSource: "cli"
1378
+ ...job,
1379
+ ...targets
1354
1380
  });
1355
1381
  }
1356
1382
  function migrateLegacyPhase(status) {
@@ -1363,14 +1389,50 @@ function migrateLegacyPhase(status) {
1363
1389
  }
1364
1390
  }
1365
1391
  async function writeUpdateJobAtomically(input) {
1392
+ const { targetCliVersion, targetServiceVersion, ...compatibleJob } = input.job;
1393
+ await writeDaemonServiceUpdateTargets(dirname(input.path), {
1394
+ jobId: input.job.jobId,
1395
+ ...targetCliVersion ? { targetCliVersion } : {},
1396
+ ...targetServiceVersion ? { targetServiceVersion } : {}
1397
+ });
1366
1398
  const temporaryPath = `${input.path}.${String(process.pid)}.tmp`;
1367
1399
  await mkdir(dirname(input.path), { recursive: true });
1368
- await writeFile(temporaryPath, `${JSON.stringify(input.job, null, 2)}\n`, {
1400
+ await writeFile(temporaryPath, `${JSON.stringify(compatibleJob, null, 2)}\n`, {
1369
1401
  encoding: "utf8",
1370
1402
  mode: 384
1371
1403
  });
1372
1404
  await rename(temporaryPath, input.path);
1373
1405
  }
1406
+ async function readDaemonServiceUpdateTargets(stateRoot) {
1407
+ const raw = await readFile(join(stateRoot, UPDATE_TARGETS_FILE), "utf8").catch((error) => {
1408
+ if (error.code === "ENOENT") return null;
1409
+ throw error;
1410
+ });
1411
+ if (raw === null) return null;
1412
+ const value = JSON.parse(raw);
1413
+ const jobId = normalizeTarget(value.jobId);
1414
+ const targetCliVersion = normalizeTarget(value.targetCliVersion);
1415
+ const targetServiceVersion = normalizeTarget(value.targetServiceVersion);
1416
+ if (!jobId) return null;
1417
+ return {
1418
+ jobId,
1419
+ ...targetCliVersion ? { targetCliVersion } : {},
1420
+ ...targetServiceVersion ? { targetServiceVersion } : {}
1421
+ };
1422
+ }
1423
+ async function writeDaemonServiceUpdateTargets(stateRoot, targets) {
1424
+ const path = join(stateRoot, UPDATE_TARGETS_FILE);
1425
+ const temporaryPath = `${path}.${String(process.pid)}.tmp`;
1426
+ await mkdir(stateRoot, { recursive: true });
1427
+ await writeFile(temporaryPath, `${JSON.stringify(targets, null, 2)}\n`, {
1428
+ encoding: "utf8",
1429
+ mode: 384
1430
+ });
1431
+ await rename(temporaryPath, path);
1432
+ }
1433
+ function normalizeTarget(value) {
1434
+ return typeof value === "string" && value.trim() ? value.trim() : null;
1435
+ }
1374
1436
  //#endregion
1375
1437
  //#region src/runtime/version.ts
1376
1438
  /**
@@ -2121,6 +2183,10 @@ async function prepareNodeDaemonServiceBundle(input) {
2121
2183
  const sourceProvenance = await resolveDaemonBundleSourceProvenance(input.cliScriptPath);
2122
2184
  if (!isDaemonBundleSourceAllowedForLane({ sourceKind: sourceProvenance.sourceKind })) throw new Error("OpenMeld Service cannot use repo-local workspace service files in this lane. Repo-local service files are only allowed through `openmeld-dev`.");
2123
2185
  const { sourceEntryScriptPath, sourceDistRootPath, sourcePackageRootPath } = sourceProvenance;
2186
+ if (sourceProvenance.sourceKind !== DAEMON_BUNDLE_SOURCE_KIND_WORKSPACE) {
2187
+ const sourcePackageVersion = await readDaemonSourcePackageVersion(sourcePackageRootPath);
2188
+ if (sourcePackageVersion !== input.daemonVersion) throw new Error(`Cannot prepare OpenMeld Service ${input.daemonVersion} from CLI source ${sourcePackageVersion} at ${sourcePackageRootPath}. Install openmeld@${input.daemonVersion} and rerun \`openmeld setup\`, or use a verified Service artifact for that version.`);
2189
+ }
2124
2190
  const sourceDistFingerprint = await computeDaemonSourceDistFingerprint(sourceDistRootPath);
2125
2191
  const entryScriptRelativePath = basename(sourceEntryScriptPath);
2126
2192
  const now = (/* @__PURE__ */ new Date()).toISOString();
@@ -2549,6 +2615,22 @@ async function resolveDaemonBundleSourceProvenance(explicitPath) {
2549
2615
  sourceKind: inferDaemonBundleSourceKind(sourcePackageRootPath)
2550
2616
  };
2551
2617
  }
2618
+ async function readDaemonSourcePackageVersion(sourcePackageRootPath) {
2619
+ const packageManifestPath = join(sourcePackageRootPath, "package.json");
2620
+ const packageManifestRaw = await readFile(packageManifestPath, "utf8").catch((error) => {
2621
+ if (getErrorCode(error) === "ENOENT") throw new Error(`OpenMeld could not verify the CLI source version because ${packageManifestPath} is missing.`);
2622
+ throw error;
2623
+ });
2624
+ let packageManifest;
2625
+ try {
2626
+ packageManifest = JSON.parse(packageManifestRaw);
2627
+ } catch {
2628
+ throw new Error(`OpenMeld could not verify the CLI source version because ${packageManifestPath} is not valid JSON.`);
2629
+ }
2630
+ const version = packageManifest.name === "openmeld" && typeof packageManifest.version === "string" ? packageManifest.version.trim() : "";
2631
+ if (!version) throw new Error(`OpenMeld could not verify the CLI source version from ${packageManifestPath}.`);
2632
+ return version;
2633
+ }
2552
2634
  async function resolveCliScriptPath(explicitPath) {
2553
2635
  const rawPath = explicitPath ?? process$1.argv[1];
2554
2636
  if (!rawPath) throw new Error("Cannot determine CLI script path for OpenMeld background service bundle.");
@@ -3512,16 +3594,21 @@ function collapseLauncherWrapperProcesses(processes) {
3512
3594
  return collapsedProcesses;
3513
3595
  }
3514
3596
  async function listWindowsProcesses() {
3515
- const output = await runCommand("powershell", [
3516
- "-NoProfile",
3517
- "-Command",
3518
- "Get-CimInstance Win32_Process | Select-Object ProcessId,ParentProcessId,CommandLine | ConvertTo-Json -Compress"
3519
- ]);
3597
+ const { stdout: output } = await promisify(execFile)(resolveWindowsPowerShellPath(), powerShellEncodedArguments("$ErrorActionPreference='Stop'; [Console]::OutputEncoding = New-Object System.Text.UTF8Encoding($false); @(Get-CimInstance Win32_Process | Select-Object ProcessId,ParentProcessId,CommandLine) | ConvertTo-Json -Compress"), {
3598
+ encoding: "utf8",
3599
+ windowsHide: true,
3600
+ timeout: 1e4,
3601
+ maxBuffer: 8 * 1024 * 1024
3602
+ });
3603
+ return parseWindowsProcessInventory(output);
3604
+ }
3605
+ function parseWindowsProcessInventory(output) {
3520
3606
  const parsed = JSON.parse(output);
3607
+ if (!parsed || typeof parsed !== "object") throw new Error("Windows returned an invalid process inventory.");
3521
3608
  const rows = Array.isArray(parsed) ? parsed : [parsed];
3522
3609
  const processes = [];
3523
3610
  for (const row of rows) {
3524
- if (typeof row.ProcessId !== "number" || typeof row.ParentProcessId !== "number" || typeof row.CommandLine !== "string" || row.CommandLine.trim().length === 0) continue;
3611
+ if (!row || typeof row.ProcessId !== "number" || typeof row.ParentProcessId !== "number" || typeof row.CommandLine !== "string" || row.CommandLine.trim().length === 0) continue;
3525
3612
  processes.push({
3526
3613
  pid: row.ProcessId,
3527
3614
  parentPid: row.ParentProcessId,
@@ -3885,4 +3972,4 @@ async function readObservedRuntimeState() {
3885
3972
  //#endregion
3886
3973
  export { readManagedCliInstallation as $, prepareDaemonServiceBundle as A, resolveCliBinaryUpdatePlan as At, resolveDaemonServiceArtifact as B, isUnsafeProductionDeviceId as Bt, daemonServiceExecutableWrapperPath as C, resolveDaemonServiceUpdateWorkerLaunchdPlistPath as Ct, ensureDaemonServiceStableBinaryExecutable as D, resolveDaemonServiceUpdateWorkerWindowsScriptPath as Dt, discardPreparedDaemonServiceBundle as E, resolveDaemonServiceUpdateWorkerSystemdUnitPath as Et, restoreDaemonActiveBundleStateSnapshot as F, requestLocalDaemonShutdown as Ft, readRecentDaemonLifecycleEvents as G, formatDaemonLifecycleOriginSummary as H, upsertDaemonServiceContract as Ht, runAuditedServiceManagerCarrierMutation as I, requestLocalSyncRouteCatalog as It, runWithDaemonLifecycleCommandJournal as J, resolveRecentDaemonSignalStopCause as K, verifyDaemonActiveBundleIntegrity as L, sendLocalDaemonControlPlaneRequest as Lt, resolveAlignedDaemonActiveBundleEntryPath as M, LocalDaemonControlPlaneClientError as Mt, resolveDaemonBundleEntryPathFromState as N, requestLocalAgentActivitySync as Nt, ensureDaemonServiceUpdateWorkerBinaryExecutable as O, DEFAULT_CLI_BINARY_DOWNLOAD_POLICY as Ot, resolveInstalledDaemonBundleFingerprint as P, requestLocalDaemonServiceUpdateReadiness as Pt, pruneManagedInstallVersions as Q, writeDaemonServiceExecutableWrapper as R, clearDaemonServiceContract as Rt, daemonServiceBinaryExecutablePath as S, resolveDaemonServiceUpdateWorkerIdentity as St, daemonServiceUpdateWorkerBinaryPath as T, resolveDaemonServiceUpdateWorkerSystemdTimerUnitPath as Tt, readLatestDaemonLifecycleConnectionStateEvent as U, emitDaemonLifecycleEvent as V, readDaemonServiceContract as Vt, readLatestDaemonLifecycleOriginEvent as W, buildInstallSelfJsonPayload as X, collectLocalOperationFailure as Y, performManagedInstall as Z, matchesExpectedDaemonServiceManagerDefinition as _, package_default as _t, resolveDaemonRuntimeState as a, persistPendingDaemonServiceUpdate as at, cleanupInactiveDaemonServiceBundles as b, daemonServiceUpdateWorkerNpmEntryPath as bt, resolveObservedDaemonRuntimeStatus as c, buildNextVersionState as ct, inspectLegacySharedDaemonService as d, fetchLatestCliBinaryRelease as dt, resolveCliSelfVersion as et, listDaemonOwnedProcesses as f, fetchLatestPackageInfo as ft, assertDaemonMaintenanceInstallationOwnership as g, resolveBundledServiceRelease as gt, resolveDaemonBundleIdFromEntryPath as h, writeVersionState as ht, readCurrentObservedDaemonRuntimeStatus as i, completePendingDaemonServiceUpdate as it, readDaemonActiveBundleState as j, verifyCliBinaryCodeSignature as jt, isDaemonBundleSourceAllowedForLane as k, downloadCliBinaryUpdateArtifact as kt, resolveObservedRuntimeCommandEntryPath as l, compareSemver as lt, normalizeDaemonCommandPath as m, readVersionState as mt, getEffectiveDaemonRuntimeStatus as n, OPENMELD_VERSION as nt, resolveDaemonServiceManagerForRuntimeState as o, readLastDaemonServiceUpdate as ot, extractDaemonCommandEntryPath as p, isPlainReleaseVersion as pt, runDaemonServiceManagerAction as q, readCurrentDaemonRuntimeContext as r, DAEMON_SERVICE_UPDATE_JOB_SCHEMA as rt, waitForDaemonSystemServiceToStop as s, readPendingDaemonServiceUpdate as st, clearDaemonRuntimeStateIfDefinitelyStopped as t, withManagedInstallTransaction as tt, cleanupLegacySharedDaemonServiceState as u, ensureVersionStateReady as ut, isOpenMeldManagedBinaryPath as v, INDEPENDENT_MAINTENANCE_REGISTRATION as vt, daemonServiceLauncherPath as w, resolveDaemonServiceUpdateWorkerSystemdPathUnitPath as wt, clearDaemonServiceUpdateWorkerBinaryExecutable as x, hasIndependentMaintenanceRegistration as xt, activateDaemonServiceBundle as y, configureDaemonMaintenanceEnvironment as yt, writeDaemonServiceLauncher as z, isDaemonServiceContractIdentityReusable as zt };
3887
3974
 
3888
- //# sourceMappingURL=daemon-service-runtime-CWTlAhZY.js.map
3975
+ //# sourceMappingURL=daemon-service-runtime-CGT3yVOs.js.map