openmeld 0.3.212 → 0.3.213

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 (75) hide show
  1. package/dist/{add-me-membership-BwPpVKtA.js → add-me-membership-GbaxKxz-.js} +2 -2
  2. package/dist/{add-me-membership-BwPpVKtA.js.map → add-me-membership-GbaxKxz-.js.map} +1 -1
  3. package/dist/{agents-Y-UJ74By.js → agents-BNoz9DA5.js} +6 -6
  4. package/dist/{agents-Y-UJ74By.js.map → agents-BNoz9DA5.js.map} +1 -1
  5. package/dist/{api-client-foundation-CrQN8_-N.js → api-client-foundation-TEBOwWl1.js} +1 -1
  6. package/dist/{api-client-foundation-DjbtuE52.js → api-client-foundation-km8Ol1P4.js} +3 -3
  7. package/dist/{api-client-foundation-DjbtuE52.js.map → api-client-foundation-km8Ol1P4.js.map} +1 -1
  8. package/dist/auth-session-D6UDl3r3.js +4 -0
  9. package/dist/{auth-session-Dqz9X4F0.js → auth-session-DgHvRt5i.js} +61 -4
  10. package/dist/auth-session-DgHvRt5i.js.map +1 -0
  11. package/dist/{command-jgHbP21v.js → command-Dsa8gaFe.js} +10 -10
  12. package/dist/{command-jgHbP21v.js.map → command-Dsa8gaFe.js.map} +1 -1
  13. package/dist/computer-connection-D8tX14R_.js +120 -0
  14. package/dist/computer-connection-D8tX14R_.js.map +1 -0
  15. package/dist/{computer-connection-review-CzSpaHE0.js → computer-connection-review-CjOXBWiV.js} +6 -6
  16. package/dist/{computer-connection-review-CzSpaHE0.js.map → computer-connection-review-CjOXBWiV.js.map} +1 -1
  17. package/dist/{computer-disconnect-DNM7jvda.js → computer-disconnect-k6UVCsVF.js} +8 -8
  18. package/dist/{computer-disconnect-DNM7jvda.js.map → computer-disconnect-k6UVCsVF.js.map} +1 -1
  19. package/dist/{computer-setup-continuation-BqdhIAjT.js → computer-setup-continuation-DhY_sJis.js} +4 -4
  20. package/dist/{computer-setup-continuation-BqdhIAjT.js.map → computer-setup-continuation-DhY_sJis.js.map} +1 -1
  21. package/dist/{control-plane-PxntAyDq.js → control-plane-Bpu7g9Av.js} +2 -2
  22. package/dist/{control-plane-PxntAyDq.js.map → control-plane-Bpu7g9Av.js.map} +1 -1
  23. package/dist/{daemon-service-runtime-CWTlAhZY.js → daemon-service-runtime-CY6wdBe1.js} +94 -13
  24. package/dist/daemon-service-runtime-CY6wdBe1.js.map +1 -0
  25. package/dist/{daemon-service-update-coordinator-DcjOzGu1.js → daemon-service-update-coordinator-BcbbIDzC.js} +350 -164
  26. package/dist/daemon-service-update-coordinator-BcbbIDzC.js.map +1 -0
  27. package/dist/{dist--pb6JxqG.js → dist-Bsz_wafH.js} +1 -1
  28. package/dist/{dist-jsWwS864.js → dist-CAx_kxvt.js} +71 -32
  29. package/dist/dist-CAx_kxvt.js.map +1 -0
  30. package/dist/{elapsed-time-iFOSSUJo.js → elapsed-time-Do3uIV__.js} +8 -6
  31. package/dist/{elapsed-time-iFOSSUJo.js.map → elapsed-time-Do3uIV__.js.map} +1 -1
  32. package/dist/{installation-inventory-B0cbVLun.js → installation-inventory-C92AkQkA.js} +3 -3
  33. package/dist/{installation-inventory-B0cbVLun.js.map → installation-inventory-C92AkQkA.js.map} +1 -1
  34. package/dist/{local-components-H3SkJMC1.js → local-components-B6SCXZf9.js} +10 -2
  35. package/dist/local-components-B6SCXZf9.js.map +1 -0
  36. package/dist/{openmeld-B4gQCCex.js → openmeld-I4pLxQsY.js} +34 -23
  37. package/dist/openmeld-I4pLxQsY.js.map +1 -0
  38. package/dist/{openmeld-maintenance-worker-DtY_H7Bv.js → openmeld-maintenance-worker-D5VAO9GD.js} +5 -5
  39. package/dist/{openmeld-maintenance-worker-DtY_H7Bv.js.map → openmeld-maintenance-worker-D5VAO9GD.js.map} +1 -1
  40. package/dist/{openmeld-tools-update-join-DS_EIL5q.js → openmeld-tools-update-join-DsQdgYNw.js} +6 -4
  41. package/dist/{openmeld-tools-update-join-DS_EIL5q.js.map → openmeld-tools-update-join-DsQdgYNw.js.map} +1 -1
  42. package/dist/{openmeld-tools-update-process-frame-CbZPpc7D.js → openmeld-tools-update-process-frame-0X-t0Kjv.js} +2 -2
  43. package/dist/{openmeld-tools-update-process-frame-CbZPpc7D.js.map → openmeld-tools-update-process-frame-0X-t0Kjv.js.map} +1 -1
  44. package/dist/{openmeld-tools-update-process-frame-CcPLrSsw.js → openmeld-tools-update-process-frame-DX1Dc8VI.js} +1 -1
  45. package/dist/openmeld.js +4 -4
  46. package/dist/{prepare-session-executor-CWKqfuse.js → prepare-session-executor-BEzlM0hJ.js} +171 -18
  47. package/dist/prepare-session-executor-BEzlM0hJ.js.map +1 -0
  48. package/dist/{runtime-transport-BQAmcHwF.js → runtime-transport-DxISZdzf.js} +22 -5
  49. package/dist/runtime-transport-DxISZdzf.js.map +1 -0
  50. package/dist/{service-CTG3_X0o.js → service-Cev-7yAJ.js} +239 -50
  51. package/dist/service-Cev-7yAJ.js.map +1 -0
  52. package/dist/{service-account-authorization-Dq4LcAVa.js → service-account-authorization-AbowIr6n.js} +3 -3
  53. package/dist/{service-account-authorization-Dq4LcAVa.js.map → service-account-authorization-AbowIr6n.js.map} +1 -1
  54. package/dist/{service-account-control-BTR_X7QM.js → service-account-control-BV_tBiio.js} +6 -6
  55. package/dist/{service-account-control-BTR_X7QM.js.map → service-account-control-BV_tBiio.js.map} +1 -1
  56. package/dist/{service-control-capabilities-ChRe8hkw.js → service-control-capabilities-BGXPenm1.js} +1 -1
  57. package/dist/{service-control-capabilities-C5SxnBg2.js → service-control-capabilities-DUudAKoj.js} +2 -2
  58. package/dist/{service-control-capabilities-C5SxnBg2.js.map → service-control-capabilities-DUudAKoj.js.map} +1 -1
  59. package/dist/{upgrade-DAVEeo8B.js → upgrade-9h70HCQP.js} +10 -7
  60. package/dist/{upgrade-DAVEeo8B.js.map → upgrade-9h70HCQP.js.map} +1 -1
  61. package/dist/upgrade-CXgHeEKK.js +4 -0
  62. package/package.json +2 -2
  63. package/dist/auth-session-Dqz9X4F0.js.map +0 -1
  64. package/dist/auth-session-bRzDGlXy.js +0 -4
  65. package/dist/computer-connection-DvqsgYls.js +0 -81
  66. package/dist/computer-connection-DvqsgYls.js.map +0 -1
  67. package/dist/daemon-service-runtime-CWTlAhZY.js.map +0 -1
  68. package/dist/daemon-service-update-coordinator-DcjOzGu1.js.map +0 -1
  69. package/dist/dist-jsWwS864.js.map +0 -1
  70. package/dist/local-components-H3SkJMC1.js.map +0 -1
  71. package/dist/openmeld-B4gQCCex.js.map +0 -1
  72. package/dist/prepare-session-executor-CWKqfuse.js.map +0 -1
  73. package/dist/runtime-transport-BQAmcHwF.js.map +0 -1
  74. package/dist/service-CTG3_X0o.js.map +0 -1
  75. package/dist/upgrade-DKXu-1wO.js +0 -4
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { a as isOpenMeldOrphanedLockError, d as runWithHeldLock, i as isOpenMeldLockError, t as acquireLock } from "./lock-Dxp6o_t_.js";
4
- import { Bn as resolveSkillsAgentRegistry, Tt as readOpenMeldToolsMaintenancePolicy, kt as prepareDaemonServiceUpdateWorkerCarrier, n as scheduleDaemonServiceUpdate, t as runPendingDaemonServiceUpdate, wt as readPendingOpenMeldToolsUpdateAttempt, xt as createOpenMeldToolsUpdateCoordinator } from "./daemon-service-update-coordinator-DcjOzGu1.js";
5
- import { b as withSkillsInstallLock, f as ensureLocalSkills, h as downloadOfficialSkillUpdate, l as installSkillsToTargets, s as resolveTrackedInstallTargets } from "./installation-inventory-B0cbVLun.js";
6
- import { Vt as readDaemonServiceContract, g as assertDaemonMaintenanceInstallationOwnership, it as completePendingDaemonServiceUpdate, nt as OPENMELD_VERSION, st as readPendingDaemonServiceUpdate, yt as configureDaemonMaintenanceEnvironment } from "./daemon-service-runtime-CWTlAhZY.js";
4
+ import { Bn as resolveSkillsAgentRegistry, Tt as readOpenMeldToolsMaintenancePolicy, kt as prepareDaemonServiceUpdateWorkerCarrier, n as scheduleDaemonServiceUpdate, t as runPendingDaemonServiceUpdate, wt as readPendingOpenMeldToolsUpdateAttempt, xt as createOpenMeldToolsUpdateCoordinator } from "./daemon-service-update-coordinator-BcbbIDzC.js";
5
+ import { b as withSkillsInstallLock, f as ensureLocalSkills, h as downloadOfficialSkillUpdate, l as installSkillsToTargets, s as resolveTrackedInstallTargets } from "./installation-inventory-C92AkQkA.js";
6
+ import { Vt as readDaemonServiceContract, g as assertDaemonMaintenanceInstallationOwnership, it as completePendingDaemonServiceUpdate, nt as OPENMELD_VERSION, st as readPendingDaemonServiceUpdate, yt as configureDaemonMaintenanceEnvironment } from "./daemon-service-runtime-CY6wdBe1.js";
7
7
  import { g as getConfiguredSkillsConfig } from "./base-url-C6sHRNGu.js";
8
8
  import { W as withDaemonServiceReconcileLock } from "./daemon-state-C37ZtIZK.js";
9
9
  import { S as resolveDaemonServiceManager, v as readDaemonServiceStartupPolicyCurrent } from "./daemon-service-manager-GiMCiTmu.js";
@@ -70,7 +70,7 @@ async function runMaintenancePass() {
70
70
  }
71
71
  const result = await runPendingDaemonServiceUpdate();
72
72
  if (result?.phase === "updated") {
73
- const { finishComputerSetupAfterBackgroundUpdate, recoverComputerSetupAfterBackgroundUpdate } = await import("./computer-setup-continuation-BqdhIAjT.js");
73
+ const { finishComputerSetupAfterBackgroundUpdate, recoverComputerSetupAfterBackgroundUpdate } = await import("./computer-setup-continuation-DhY_sJis.js");
74
74
  await prepareDaemonServiceUpdateWorkerCarrier(result);
75
75
  await finishComputerSetupAfterBackgroundUpdate();
76
76
  await withDaemonServiceReconcileLock(async () => {
@@ -99,4 +99,4 @@ async function reconcileCurrentServiceStartupPolicy(updatesCurrent) {
99
99
  //#endregion
100
100
  export { runOpenMeldMaintenanceWorker };
101
101
 
102
- //# sourceMappingURL=openmeld-maintenance-worker-DtY_H7Bv.js.map
102
+ //# sourceMappingURL=openmeld-maintenance-worker-D5VAO9GD.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"openmeld-maintenance-worker-DtY_H7Bv.js","names":[],"sources":["../src/skills/maintenance.ts","../src/local-service/maintenance/openmeld-maintenance-worker.ts"],"sourcesContent":["import { getConfiguredSkillsConfig } from \"../config/runtime-config\";\nimport { resolveSkillsAgentRegistry } from \"./agents\";\nimport { resolveTrackedInstallTargets } from \"./installation-inventory\";\nimport { installSkillsToTargets, withSkillsInstallLock } from \"./installer\";\nimport { downloadOfficialSkillUpdate } from \"./official-release\";\nimport { ensureLocalSkills } from \"./store\";\n\nexport async function maintainOfficialCliSkill(): Promise<void> {\n const outcome = await downloadOfficialSkillUpdate().catch(\n (error: unknown) => {\n process.stderr.write(\n `[openmeld] Skill download deferred: ${error instanceof Error ? error.message : String(error)}\\n`\n );\n return \"deferred\" as const;\n }\n );\n if (outcome === \"lane_isolated\") {\n return;\n }\n await withSkillsInstallLock(async () => {\n const localSkills = await ensureLocalSkills();\n const skillsConfig = await getConfiguredSkillsConfig();\n const targets = await resolveTrackedInstallTargets({\n skillsConfig,\n registry: resolveSkillsAgentRegistry(skillsConfig),\n localSkills,\n onlyOpenMeldInstalledTargets: false,\n });\n const results = await installSkillsToTargets({\n skills: localSkills,\n targets,\n });\n const failures = results.filter((result) => result.status === \"failed\");\n if (failures.length) {\n throw new Error(\n failures\n .map((result) => `${result.targetId}: ${result.reason}`)\n .join(\"; \")\n );\n }\n });\n}\n","import { readDaemonServiceContract } from \"../../config/daemon-service-contract\";\nimport { configureDaemonMaintenanceEnvironment } from \"../../config/daemon-service-update-worker-registration\";\nimport { withDaemonServiceReconcileLock } from \"../../config/daemon-state\";\nimport {\n acquireLock,\n isOpenMeldLockError,\n isOpenMeldOrphanedLockError,\n runWithHeldLock,\n} from \"../../config/lock\";\nimport { OPENMELD_VERSION } from \"../../runtime/version\";\nimport { maintainOfficialCliSkill } from \"../../skills/maintenance\";\nimport {\n readDaemonServiceStartupPolicyCurrent,\n resolveDaemonServiceManager,\n} from \"../lifecycle/daemon-service-manager\";\nimport { assertDaemonMaintenanceInstallationOwnership } from \"../lifecycle/daemon-service-manager-command-match\";\nimport {\n runPendingDaemonServiceUpdate,\n scheduleDaemonServiceUpdate,\n} from \"../lifecycle/daemon-service-update-coordinator\";\nimport {\n completePendingDaemonServiceUpdate,\n readPendingDaemonServiceUpdate,\n} from \"../lifecycle/daemon-service-update-state\";\nimport { prepareDaemonServiceUpdateWorkerCarrier } from \"../lifecycle/daemon-service-update-worker-manager\";\nimport { readOpenMeldToolsMaintenancePolicy } from \"./openmeld-tools-maintenance-policy\";\nimport { readPendingOpenMeldToolsUpdateAttempt } from \"./openmeld-tools-update-attempt-state\";\nimport { createOpenMeldToolsUpdateCoordinator } from \"./openmeld-tools-update-coordinator\";\n\n// The OS owns this process. It is also the sole executor of persisted download\n// attempts; Service requests only publish an attempt and wake this worker.\nexport async function runOpenMeldMaintenanceWorker(): Promise<void> {\n configureDaemonMaintenanceEnvironment(process.env);\n await runMaintenanceWithLock();\n}\n\nasync function runMaintenanceWithLock(): Promise<boolean> {\n try {\n const lock = await acquireLock({\n openMeldProfileId: \"__system__\",\n key: \"maintenance-worker\",\n });\n return await runWithHeldLock({\n lock,\n run: runMaintenancePass,\n releaseContext: { component: \"maintenance_worker\" },\n });\n } catch (error) {\n // Setup/repair may still own the lifecycle lock when the OS first runs us.\n // Leave its state intact; the existing OS trigger will run another pass.\n if (isOpenMeldLockError(error) && !isOpenMeldOrphanedLockError(error)) {\n return false;\n }\n throw error;\n }\n}\n\nasync function runMaintenancePass(): Promise<boolean> {\n const pendingJob = await readPendingDaemonServiceUpdate();\n const pendingAttempt = await readPendingOpenMeldToolsUpdateAttempt();\n if (!(pendingJob || pendingAttempt)) {\n const contract = await readDaemonServiceContract();\n if (!contract || contract.desiredState !== \"background\") {\n return false;\n }\n }\n await assertDaemonMaintenanceInstallationOwnership();\n if ((await readOpenMeldToolsMaintenancePolicy()).automaticUpdatesEnabled) {\n try {\n await maintainOfficialCliSkill();\n } catch (error) {\n process.stderr.write(\n `[openmeld] Skill maintenance deferred: ${error instanceof Error ? error.message : String(error)}\\n`\n );\n }\n }\n const coordinator = createOpenMeldToolsUpdateCoordinator();\n if (!pendingJob) {\n if (pendingAttempt) {\n await coordinator.resumePendingUpdate();\n } else {\n const update = await coordinator.requestUpdate({\n requestSource: \"automatic\",\n });\n await reconcileCurrentServiceStartupPolicy(update.status === \"current\");\n }\n await coordinator.waitForIdle();\n }\n const result = await runPendingDaemonServiceUpdate();\n if (result?.phase === \"updated\") {\n const {\n finishComputerSetupAfterBackgroundUpdate,\n recoverComputerSetupAfterBackgroundUpdate,\n } = await import(\"../../commands/computer-setup-continuation\");\n // Only a verified replacement may replace the working recovery carrier.\n await prepareDaemonServiceUpdateWorkerCarrier(result);\n await finishComputerSetupAfterBackgroundUpdate();\n await withDaemonServiceReconcileLock(async () => {\n const current = await readPendingDaemonServiceUpdate();\n if (\n current?.jobId === result.jobId &&\n current.phase === \"updated\" &&\n current.targetVersion === result.targetVersion\n ) {\n await completePendingDaemonServiceUpdate(current);\n }\n });\n await recoverComputerSetupAfterBackgroundUpdate();\n return true;\n }\n if (result?.phase === \"restored\" || result?.phase === \"needs_help\") {\n process.exitCode = 1;\n }\n return false;\n}\n\nasync function reconcileCurrentServiceStartupPolicy(\n updatesCurrent: boolean\n): Promise<void> {\n if (!updatesCurrent) {\n return;\n }\n const contract = await readDaemonServiceContract();\n // An older recovery worker must not apply its policy to a newer Service,\n // and maintenance must preserve an explicit user stop.\n if (\n contract?.desiredState !== \"background\" ||\n contract.daemonVersion !== OPENMELD_VERSION\n ) {\n return;\n }\n const manager = await resolveDaemonServiceManager();\n if (\n (await readDaemonServiceStartupPolicyCurrent({\n controller: manager?.controller ?? null,\n status: (await manager?.status()) ?? null,\n })) === false\n ) {\n await scheduleDaemonServiceUpdate({\n targetVersion: contract.daemonVersion,\n urgency: \"available\",\n });\n }\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"openmeld-maintenance-worker-D5VAO9GD.js","names":[],"sources":["../src/skills/maintenance.ts","../src/local-service/maintenance/openmeld-maintenance-worker.ts"],"sourcesContent":["import { getConfiguredSkillsConfig } from \"../config/runtime-config\";\nimport { resolveSkillsAgentRegistry } from \"./agents\";\nimport { resolveTrackedInstallTargets } from \"./installation-inventory\";\nimport { installSkillsToTargets, withSkillsInstallLock } from \"./installer\";\nimport { downloadOfficialSkillUpdate } from \"./official-release\";\nimport { ensureLocalSkills } from \"./store\";\n\nexport async function maintainOfficialCliSkill(): Promise<void> {\n const outcome = await downloadOfficialSkillUpdate().catch(\n (error: unknown) => {\n process.stderr.write(\n `[openmeld] Skill download deferred: ${error instanceof Error ? error.message : String(error)}\\n`\n );\n return \"deferred\" as const;\n }\n );\n if (outcome === \"lane_isolated\") {\n return;\n }\n await withSkillsInstallLock(async () => {\n const localSkills = await ensureLocalSkills();\n const skillsConfig = await getConfiguredSkillsConfig();\n const targets = await resolveTrackedInstallTargets({\n skillsConfig,\n registry: resolveSkillsAgentRegistry(skillsConfig),\n localSkills,\n onlyOpenMeldInstalledTargets: false,\n });\n const results = await installSkillsToTargets({\n skills: localSkills,\n targets,\n });\n const failures = results.filter((result) => result.status === \"failed\");\n if (failures.length) {\n throw new Error(\n failures\n .map((result) => `${result.targetId}: ${result.reason}`)\n .join(\"; \")\n );\n }\n });\n}\n","import { readDaemonServiceContract } from \"../../config/daemon-service-contract\";\nimport { configureDaemonMaintenanceEnvironment } from \"../../config/daemon-service-update-worker-registration\";\nimport { withDaemonServiceReconcileLock } from \"../../config/daemon-state\";\nimport {\n acquireLock,\n isOpenMeldLockError,\n isOpenMeldOrphanedLockError,\n runWithHeldLock,\n} from \"../../config/lock\";\nimport { OPENMELD_VERSION } from \"../../runtime/version\";\nimport { maintainOfficialCliSkill } from \"../../skills/maintenance\";\nimport {\n readDaemonServiceStartupPolicyCurrent,\n resolveDaemonServiceManager,\n} from \"../lifecycle/daemon-service-manager\";\nimport { assertDaemonMaintenanceInstallationOwnership } from \"../lifecycle/daemon-service-manager-command-match\";\nimport {\n runPendingDaemonServiceUpdate,\n scheduleDaemonServiceUpdate,\n} from \"../lifecycle/daemon-service-update-coordinator\";\nimport {\n completePendingDaemonServiceUpdate,\n readPendingDaemonServiceUpdate,\n} from \"../lifecycle/daemon-service-update-state\";\nimport { prepareDaemonServiceUpdateWorkerCarrier } from \"../lifecycle/daemon-service-update-worker-manager\";\nimport { readOpenMeldToolsMaintenancePolicy } from \"./openmeld-tools-maintenance-policy\";\nimport { readPendingOpenMeldToolsUpdateAttempt } from \"./openmeld-tools-update-attempt-state\";\nimport { createOpenMeldToolsUpdateCoordinator } from \"./openmeld-tools-update-coordinator\";\n\n// The OS owns this process. It is also the sole executor of persisted download\n// attempts; Service requests only publish an attempt and wake this worker.\nexport async function runOpenMeldMaintenanceWorker(): Promise<void> {\n configureDaemonMaintenanceEnvironment(process.env);\n await runMaintenanceWithLock();\n}\n\nasync function runMaintenanceWithLock(): Promise<boolean> {\n try {\n const lock = await acquireLock({\n openMeldProfileId: \"__system__\",\n key: \"maintenance-worker\",\n });\n return await runWithHeldLock({\n lock,\n run: runMaintenancePass,\n releaseContext: { component: \"maintenance_worker\" },\n });\n } catch (error) {\n // Setup/repair may still own the lifecycle lock when the OS first runs us.\n // Leave its state intact; the existing OS trigger will run another pass.\n if (isOpenMeldLockError(error) && !isOpenMeldOrphanedLockError(error)) {\n return false;\n }\n throw error;\n }\n}\n\nasync function runMaintenancePass(): Promise<boolean> {\n const pendingJob = await readPendingDaemonServiceUpdate();\n const pendingAttempt = await readPendingOpenMeldToolsUpdateAttempt();\n if (!(pendingJob || pendingAttempt)) {\n const contract = await readDaemonServiceContract();\n if (!contract || contract.desiredState !== \"background\") {\n return false;\n }\n }\n await assertDaemonMaintenanceInstallationOwnership();\n if ((await readOpenMeldToolsMaintenancePolicy()).automaticUpdatesEnabled) {\n try {\n await maintainOfficialCliSkill();\n } catch (error) {\n process.stderr.write(\n `[openmeld] Skill maintenance deferred: ${error instanceof Error ? error.message : String(error)}\\n`\n );\n }\n }\n const coordinator = createOpenMeldToolsUpdateCoordinator();\n if (!pendingJob) {\n if (pendingAttempt) {\n await coordinator.resumePendingUpdate();\n } else {\n const update = await coordinator.requestUpdate({\n requestSource: \"automatic\",\n });\n await reconcileCurrentServiceStartupPolicy(update.status === \"current\");\n }\n await coordinator.waitForIdle();\n }\n const result = await runPendingDaemonServiceUpdate();\n if (result?.phase === \"updated\") {\n const {\n finishComputerSetupAfterBackgroundUpdate,\n recoverComputerSetupAfterBackgroundUpdate,\n } = await import(\"../../commands/computer-setup-continuation\");\n // Only a verified replacement may replace the working recovery carrier.\n await prepareDaemonServiceUpdateWorkerCarrier(result);\n await finishComputerSetupAfterBackgroundUpdate();\n await withDaemonServiceReconcileLock(async () => {\n const current = await readPendingDaemonServiceUpdate();\n if (\n current?.jobId === result.jobId &&\n current.phase === \"updated\" &&\n current.targetVersion === result.targetVersion\n ) {\n await completePendingDaemonServiceUpdate(current);\n }\n });\n await recoverComputerSetupAfterBackgroundUpdate();\n return true;\n }\n if (result?.phase === \"restored\" || result?.phase === \"needs_help\") {\n process.exitCode = 1;\n }\n return false;\n}\n\nasync function reconcileCurrentServiceStartupPolicy(\n updatesCurrent: boolean\n): Promise<void> {\n if (!updatesCurrent) {\n return;\n }\n const contract = await readDaemonServiceContract();\n // An older recovery worker must not apply its policy to a newer Service,\n // and maintenance must preserve an explicit user stop.\n if (\n contract?.desiredState !== \"background\" ||\n contract.daemonVersion !== OPENMELD_VERSION\n ) {\n return;\n }\n const manager = await resolveDaemonServiceManager();\n if (\n (await readDaemonServiceStartupPolicyCurrent({\n controller: manager?.controller ?? null,\n status: (await manager?.status()) ?? null,\n })) === false\n ) {\n await scheduleDaemonServiceUpdate({\n targetVersion: contract.daemonVersion,\n urgency: \"available\",\n });\n }\n}\n"],"mappings":"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"}
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { wt as readPendingOpenMeldToolsUpdateAttempt } from "./daemon-service-update-coordinator-DcjOzGu1.js";
4
- import { st as readPendingDaemonServiceUpdate } from "./daemon-service-runtime-CWTlAhZY.js";
5
- import { m as resolveOpenMeldToolsUpdateOperation } from "./elapsed-time-iFOSSUJo.js";
3
+ import { wt as readPendingOpenMeldToolsUpdateAttempt } from "./daemon-service-update-coordinator-BcbbIDzC.js";
4
+ import { st as readPendingDaemonServiceUpdate } from "./daemon-service-runtime-CY6wdBe1.js";
5
+ import { m as resolveOpenMeldToolsUpdateOperation } from "./elapsed-time-Do3uIV__.js";
6
6
  import { setTimeout } from "node:timers/promises";
7
7
  //#region src/local-service/maintenance/openmeld-tools-update-join.ts
8
8
  const DEFAULT_UPDATE_JOIN_POLL_INTERVAL_MS = 500;
@@ -29,6 +29,8 @@ async function resolveExternalOpenMeldToolsUpdate(input = {}) {
29
29
  phase: serviceJob.phase,
30
30
  requestSource: serviceJob.requestSource,
31
31
  requestedAt: serviceJob.requestedAt,
32
+ ...serviceJob.targetCliVersion ? { targetCliVersion: serviceJob.targetCliVersion } : {},
33
+ ...serviceJob.targetServiceVersion ? { targetServiceVersion: serviceJob.targetServiceVersion } : {},
32
34
  targetVersion: serviceJob.targetVersion,
33
35
  updatedAt: serviceJob.updatedAt,
34
36
  urgency: serviceJob.urgency
@@ -51,4 +53,4 @@ async function waitForExternalOpenMeldToolsUpdate(input = {}) {
51
53
  //#endregion
52
54
  export { waitForExternalOpenMeldToolsUpdate as n, waitForOpenMeldToolsUpdateCompletion as r, resolveExternalOpenMeldToolsUpdate as t };
53
55
 
54
- //# sourceMappingURL=openmeld-tools-update-join-DS_EIL5q.js.map
56
+ //# sourceMappingURL=openmeld-tools-update-join-DsQdgYNw.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"openmeld-tools-update-join-DS_EIL5q.js","names":["sleep"],"sources":["../src/local-service/maintenance/openmeld-tools-update-join.ts"],"sourcesContent":["import { setTimeout as sleep } from \"node:timers/promises\";\nimport type { OpenMeldToolsUpdateOperation } from \"@openmeld/schemas/types\";\nimport type { OpenMeldPathResolutionInput } from \"../../config/paths\";\nimport { readPendingDaemonServiceUpdate } from \"../lifecycle/daemon-service-update-state\";\nimport { readPendingOpenMeldToolsUpdateAttempt } from \"./openmeld-tools-update-attempt-state\";\nimport { resolveOpenMeldToolsUpdateOperation } from \"./openmeld-tools-update-operation\";\n\nconst DEFAULT_UPDATE_JOIN_POLL_INTERVAL_MS = 500;\n\n// This is an observer of the existing durable operation, never an updater.\n// The OS-owned worker continues even if this caller exits while waiting.\nexport async function waitForOpenMeldToolsUpdateCompletion(\n input: {\n operationId?: string;\n pollIntervalMs?: number;\n onWaiting?: (\n operation: OpenMeldToolsUpdateOperation\n ) => Promise<void> | void;\n } = {}\n): Promise<OpenMeldToolsUpdateOperation | null> {\n let operationId = input.operationId ?? null;\n await waitForExternalOpenMeldToolsUpdate({\n completedServiceUpdateIsIdle: true,\n pollIntervalMs: input.pollIntervalMs,\n onWaiting: async (operation) => {\n if (operationId !== null && operationId !== operation.operationId) {\n throw new Error(\n `OpenMeld update ${operationId} was replaced before its completion could be verified.`\n );\n }\n operationId = operation.operationId;\n await input.onWaiting?.(operation);\n },\n });\n const completed = await resolveOpenMeldToolsUpdateOperation();\n if (\n operationId !== null &&\n (completed?.operationId !== operationId || completed.phase !== \"updated\")\n ) {\n throw new Error(\n `OpenMeld update ${operationId} did not finish successfully (${completed?.phase ?? \"completion evidence unavailable\"}).`\n );\n }\n return completed;\n}\n\nexport async function resolveExternalOpenMeldToolsUpdate(\n input: OpenMeldPathResolutionInput & {\n currentOperationId?: string | null;\n completedServiceUpdateIsIdle?: boolean;\n } = {}\n): Promise<OpenMeldToolsUpdateOperation | null> {\n // The coordinator persists the Service job before discarding the tools\n // attempt. Reading in this order prevents observers from seeing a false idle\n // gap while ownership moves from the CLI download to the Service worker.\n const toolsAttempt = await readPendingOpenMeldToolsUpdateAttempt(input);\n const serviceJob = await readPendingDaemonServiceUpdate(input);\n if (\n serviceJob &&\n serviceJob.jobId !== (input.currentOperationId ?? null) &&\n !(input.completedServiceUpdateIsIdle && serviceJob.phase === \"updated\")\n ) {\n return {\n operationId: serviceJob.jobId,\n phase: serviceJob.phase,\n requestSource: serviceJob.requestSource,\n requestedAt: serviceJob.requestedAt,\n targetVersion: serviceJob.targetVersion,\n updatedAt: serviceJob.updatedAt,\n urgency: serviceJob.urgency,\n };\n }\n if (\n toolsAttempt &&\n toolsAttempt.operation.operationId !== (input.currentOperationId ?? null)\n ) {\n return toolsAttempt.operation;\n }\n return null;\n}\n\nexport async function waitForExternalOpenMeldToolsUpdate(\n input: OpenMeldPathResolutionInput & {\n currentOperationId?: string | null;\n completedServiceUpdateIsIdle?: boolean;\n onWaiting?: (\n operation: OpenMeldToolsUpdateOperation\n ) => Promise<void> | void;\n pollIntervalMs?: number;\n } = {}\n): Promise<void> {\n let reportedOperationId: string | null = null;\n while (true) {\n const operation = await resolveExternalOpenMeldToolsUpdate(input);\n if (!operation) {\n return;\n }\n if (reportedOperationId !== operation.operationId) {\n reportedOperationId = operation.operationId;\n await input.onWaiting?.(operation);\n }\n await sleep(\n Math.max(1, input.pollIntervalMs ?? DEFAULT_UPDATE_JOIN_POLL_INTERVAL_MS)\n );\n }\n}\n"],"mappings":";;;;;;;AAOA,MAAM,uCAAuC;AAI7C,eAAsB,qCACpB,QAMI,CAAC,GACyC;CAC9C,IAAI,cAAc,MAAM,eAAe;CACvC,MAAM,mCAAmC;EACvC,8BAA8B;EAC9B,gBAAgB,MAAM;EACtB,WAAW,OAAO,cAAc;GAC9B,IAAI,gBAAgB,QAAQ,gBAAgB,UAAU,aACpD,MAAM,IAAI,MACR,mBAAmB,YAAY,uDACjC;GAEF,cAAc,UAAU;GACxB,MAAM,MAAM,YAAY,SAAS;EACnC;CACF,CAAC;CACD,MAAM,YAAY,MAAM,oCAAoC;CAC5D,IACE,gBAAgB,SACf,WAAW,gBAAgB,eAAe,UAAU,UAAU,YAE/D,MAAM,IAAI,MACR,mBAAmB,YAAY,gCAAgC,WAAW,SAAS,kCAAkC,GACvH;CAEF,OAAO;AACT;AAEA,eAAsB,mCACpB,QAGI,CAAC,GACyC;CAI9C,MAAM,eAAe,MAAM,sCAAsC,KAAK;CACtE,MAAM,aAAa,MAAM,+BAA+B,KAAK;CAC7D,IACE,cACA,WAAW,WAAW,MAAM,sBAAsB,SAClD,EAAE,MAAM,gCAAgC,WAAW,UAAU,YAE7D,OAAO;EACL,aAAa,WAAW;EACxB,OAAO,WAAW;EAClB,eAAe,WAAW;EAC1B,aAAa,WAAW;EACxB,eAAe,WAAW;EAC1B,WAAW,WAAW;EACtB,SAAS,WAAW;CACtB;CAEF,IACE,gBACA,aAAa,UAAU,iBAAiB,MAAM,sBAAsB,OAEpE,OAAO,aAAa;CAEtB,OAAO;AACT;AAEA,eAAsB,mCACpB,QAOI,CAAC,GACU;CACf,IAAI,sBAAqC;CACzC,OAAO,MAAM;EACX,MAAM,YAAY,MAAM,mCAAmC,KAAK;EAChE,IAAI,CAAC,WACH;EAEF,IAAI,wBAAwB,UAAU,aAAa;GACjD,sBAAsB,UAAU;GAChC,MAAM,MAAM,YAAY,SAAS;EACnC;EACA,MAAMA,WACJ,KAAK,IAAI,GAAG,MAAM,kBAAkB,oCAAoC,CAC1E;CACF;AACF"}
1
+ {"version":3,"file":"openmeld-tools-update-join-DsQdgYNw.js","names":["sleep"],"sources":["../src/local-service/maintenance/openmeld-tools-update-join.ts"],"sourcesContent":["import { setTimeout as sleep } from \"node:timers/promises\";\nimport type { OpenMeldToolsUpdateOperation } from \"@openmeld/schemas/types\";\nimport type { OpenMeldPathResolutionInput } from \"../../config/paths\";\nimport { readPendingDaemonServiceUpdate } from \"../lifecycle/daemon-service-update-state\";\nimport { readPendingOpenMeldToolsUpdateAttempt } from \"./openmeld-tools-update-attempt-state\";\nimport { resolveOpenMeldToolsUpdateOperation } from \"./openmeld-tools-update-operation\";\n\nconst DEFAULT_UPDATE_JOIN_POLL_INTERVAL_MS = 500;\n\n// This is an observer of the existing durable operation, never an updater.\n// The OS-owned worker continues even if this caller exits while waiting.\nexport async function waitForOpenMeldToolsUpdateCompletion(\n input: {\n operationId?: string;\n pollIntervalMs?: number;\n onWaiting?: (\n operation: OpenMeldToolsUpdateOperation\n ) => Promise<void> | void;\n } = {}\n): Promise<OpenMeldToolsUpdateOperation | null> {\n let operationId = input.operationId ?? null;\n await waitForExternalOpenMeldToolsUpdate({\n completedServiceUpdateIsIdle: true,\n pollIntervalMs: input.pollIntervalMs,\n onWaiting: async (operation) => {\n if (operationId !== null && operationId !== operation.operationId) {\n throw new Error(\n `OpenMeld update ${operationId} was replaced before its completion could be verified.`\n );\n }\n operationId = operation.operationId;\n await input.onWaiting?.(operation);\n },\n });\n const completed = await resolveOpenMeldToolsUpdateOperation();\n if (\n operationId !== null &&\n (completed?.operationId !== operationId || completed.phase !== \"updated\")\n ) {\n throw new Error(\n `OpenMeld update ${operationId} did not finish successfully (${completed?.phase ?? \"completion evidence unavailable\"}).`\n );\n }\n return completed;\n}\n\nexport async function resolveExternalOpenMeldToolsUpdate(\n input: OpenMeldPathResolutionInput & {\n currentOperationId?: string | null;\n completedServiceUpdateIsIdle?: boolean;\n } = {}\n): Promise<OpenMeldToolsUpdateOperation | null> {\n // The coordinator persists the Service job before discarding the tools\n // attempt. Reading in this order prevents observers from seeing a false idle\n // gap while ownership moves from the CLI download to the Service worker.\n const toolsAttempt = await readPendingOpenMeldToolsUpdateAttempt(input);\n const serviceJob = await readPendingDaemonServiceUpdate(input);\n if (\n serviceJob &&\n serviceJob.jobId !== (input.currentOperationId ?? null) &&\n !(input.completedServiceUpdateIsIdle && serviceJob.phase === \"updated\")\n ) {\n return {\n operationId: serviceJob.jobId,\n phase: serviceJob.phase,\n requestSource: serviceJob.requestSource,\n requestedAt: serviceJob.requestedAt,\n ...(serviceJob.targetCliVersion\n ? { targetCliVersion: serviceJob.targetCliVersion }\n : {}),\n ...(serviceJob.targetServiceVersion\n ? { targetServiceVersion: serviceJob.targetServiceVersion }\n : {}),\n targetVersion: serviceJob.targetVersion,\n updatedAt: serviceJob.updatedAt,\n urgency: serviceJob.urgency,\n };\n }\n if (\n toolsAttempt &&\n toolsAttempt.operation.operationId !== (input.currentOperationId ?? null)\n ) {\n return toolsAttempt.operation;\n }\n return null;\n}\n\nexport async function waitForExternalOpenMeldToolsUpdate(\n input: OpenMeldPathResolutionInput & {\n currentOperationId?: string | null;\n completedServiceUpdateIsIdle?: boolean;\n onWaiting?: (\n operation: OpenMeldToolsUpdateOperation\n ) => Promise<void> | void;\n pollIntervalMs?: number;\n } = {}\n): Promise<void> {\n let reportedOperationId: string | null = null;\n while (true) {\n const operation = await resolveExternalOpenMeldToolsUpdate(input);\n if (!operation) {\n return;\n }\n if (reportedOperationId !== operation.operationId) {\n reportedOperationId = operation.operationId;\n await input.onWaiting?.(operation);\n }\n await sleep(\n Math.max(1, input.pollIntervalMs ?? DEFAULT_UPDATE_JOIN_POLL_INTERVAL_MS)\n );\n }\n}\n"],"mappings":";;;;;;;AAOA,MAAM,uCAAuC;AAI7C,eAAsB,qCACpB,QAMI,CAAC,GACyC;CAC9C,IAAI,cAAc,MAAM,eAAe;CACvC,MAAM,mCAAmC;EACvC,8BAA8B;EAC9B,gBAAgB,MAAM;EACtB,WAAW,OAAO,cAAc;GAC9B,IAAI,gBAAgB,QAAQ,gBAAgB,UAAU,aACpD,MAAM,IAAI,MACR,mBAAmB,YAAY,uDACjC;GAEF,cAAc,UAAU;GACxB,MAAM,MAAM,YAAY,SAAS;EACnC;CACF,CAAC;CACD,MAAM,YAAY,MAAM,oCAAoC;CAC5D,IACE,gBAAgB,SACf,WAAW,gBAAgB,eAAe,UAAU,UAAU,YAE/D,MAAM,IAAI,MACR,mBAAmB,YAAY,gCAAgC,WAAW,SAAS,kCAAkC,GACvH;CAEF,OAAO;AACT;AAEA,eAAsB,mCACpB,QAGI,CAAC,GACyC;CAI9C,MAAM,eAAe,MAAM,sCAAsC,KAAK;CACtE,MAAM,aAAa,MAAM,+BAA+B,KAAK;CAC7D,IACE,cACA,WAAW,WAAW,MAAM,sBAAsB,SAClD,EAAE,MAAM,gCAAgC,WAAW,UAAU,YAE7D,OAAO;EACL,aAAa,WAAW;EACxB,OAAO,WAAW;EAClB,eAAe,WAAW;EAC1B,aAAa,WAAW;EACxB,GAAI,WAAW,mBACX,EAAE,kBAAkB,WAAW,iBAAiB,IAChD,CAAC;EACL,GAAI,WAAW,uBACX,EAAE,sBAAsB,WAAW,qBAAqB,IACxD,CAAC;EACL,eAAe,WAAW;EAC1B,WAAW,WAAW;EACtB,SAAS,WAAW;CACtB;CAEF,IACE,gBACA,aAAa,UAAU,iBAAiB,MAAM,sBAAsB,OAEpE,OAAO,aAAa;CAEtB,OAAO;AACT;AAEA,eAAsB,mCACpB,QAOI,CAAC,GACU;CACf,IAAI,sBAAqC;CACzC,OAAO,MAAM;EACX,MAAM,YAAY,MAAM,mCAAmC,KAAK;EAChE,IAAI,CAAC,WACH;EAEF,IAAI,wBAAwB,UAAU,aAAa;GACjD,sBAAsB,UAAU;GAChC,MAAM,MAAM,YAAY,SAAS;EACnC;EACA,MAAMA,WACJ,KAAK,IAAI,GAAG,MAAM,kBAAkB,oCAAoC,CAC1E;CACF;AACF"}
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { S as openMeldToolsUpdateProcessFailureFrameSchema, t as OPEN_MELD_TOOLS_UPDATE_FAILURE_DETAIL_MAX_CHARS, y as openMeldToolsUpdateFailureCodeSchema } from "./local-components-H3SkJMC1.js";
3
+ import { S as openMeldToolsUpdateProcessFailureFrameSchema, t as OPEN_MELD_TOOLS_UPDATE_FAILURE_DETAIL_MAX_CHARS, y as openMeldToolsUpdateFailureCodeSchema } from "./local-components-B6SCXZf9.js";
4
4
  import { n as toErrorMessage } from "./dist-o3UL1EGQ.js";
5
5
  //#region src/local-service/maintenance/openmeld-tools-update-failure.ts
6
6
  const PERSISTED_FAILURE_PREFIX = "openmeld.tools.update.failure=";
@@ -90,4 +90,4 @@ function truncateText(value, maxChars, side = "head") {
90
90
  //#endregion
91
91
  export { encodePersistedOpenMeldToolsUpdateFailure as a, withOpenMeldToolsUpdateFailure as c, OpenMeldToolsUpdateFailureError as i, emitOpenMeldToolsUpdateFailureFrame as n, resolveOpenMeldToolsUpdateFailure as o, parseOpenMeldToolsUpdateFailureFrame as r, resolvePersistedOpenMeldToolsUpdateFailure as s, appendBoundedOpenMeldToolsUpdateProcessOutput as t };
92
92
 
93
- //# sourceMappingURL=openmeld-tools-update-process-frame-CbZPpc7D.js.map
93
+ //# sourceMappingURL=openmeld-tools-update-process-frame-0X-t0Kjv.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"openmeld-tools-update-process-frame-CbZPpc7D.js","names":["LINE_SPLIT_RE"],"sources":["../src/local-service/maintenance/openmeld-tools-update-failure.ts","../src/local-service/maintenance/openmeld-tools-update-process-frame.ts"],"sourcesContent":["import { openMeldToolsUpdateFailureCodeSchema } from \"@openmeld/schemas\";\nimport type { OpenMeldToolsUpdateFailureCode } from \"@openmeld/schemas/types\";\nimport { toErrorMessage } from \"@openmeld/utils\";\n\nconst PERSISTED_FAILURE_PREFIX = \"openmeld.tools.update.failure=\";\nconst INTERNAL_FAILURE_PREFIX = \"openmeld.tools.update.\";\nconst LINE_SPLIT_RE = /\\r?\\n/u;\n\nexport class OpenMeldToolsUpdateFailureError extends Error {\n readonly failureCode: OpenMeldToolsUpdateFailureCode;\n\n constructor(input: {\n cause?: unknown;\n failureCode: OpenMeldToolsUpdateFailureCode;\n message: string;\n }) {\n super(\n input.message,\n input.cause === undefined ? undefined : { cause: input.cause }\n );\n this.name = \"OpenMeldToolsUpdateFailureError\";\n this.failureCode = openMeldToolsUpdateFailureCodeSchema.parse(\n input.failureCode\n );\n }\n}\n\nexport function withOpenMeldToolsUpdateFailure(\n error: unknown,\n fallbackCode: OpenMeldToolsUpdateFailureCode\n): OpenMeldToolsUpdateFailureError {\n const existing = resolveOpenMeldToolsUpdateFailure(error);\n if (error instanceof OpenMeldToolsUpdateFailureError && existing) {\n return error;\n }\n return new OpenMeldToolsUpdateFailureError({\n cause: error,\n failureCode: existing ?? fallbackCode,\n message: toErrorMessage(error),\n });\n}\n\nexport function resolveOpenMeldToolsUpdateFailure(\n error: unknown\n): OpenMeldToolsUpdateFailureCode | null {\n const seen = new Set<unknown>();\n let current: unknown = error;\n while (current && typeof current === \"object\" && !seen.has(current)) {\n seen.add(current);\n const direct = openMeldToolsUpdateFailureCodeSchema.safeParse(\n (current as { failureCode?: unknown }).failureCode\n );\n if (direct.success) {\n return direct.data;\n }\n const internalCode = (current as { code?: unknown }).code;\n if (typeof internalCode === \"string\") {\n const parsed = openMeldToolsUpdateFailureCodeSchema.safeParse(\n internalCode.startsWith(INTERNAL_FAILURE_PREFIX)\n ? `cli.update.${internalCode.slice(INTERNAL_FAILURE_PREFIX.length)}`\n : internalCode\n );\n if (parsed.success) {\n return parsed.data;\n }\n }\n current = (current as { cause?: unknown }).cause;\n }\n return null;\n}\n\nexport function encodePersistedOpenMeldToolsUpdateFailure(input: {\n detail: string;\n failureCode: OpenMeldToolsUpdateFailureCode;\n}): string {\n const failureCode = openMeldToolsUpdateFailureCodeSchema.parse(\n input.failureCode\n );\n const detail = input.detail.trim();\n return `${PERSISTED_FAILURE_PREFIX}${failureCode}${\n detail ? `\\n${detail}` : \"\"\n }`;\n}\n\nexport function resolvePersistedOpenMeldToolsUpdateFailure(\n errorMessage: string | null\n): OpenMeldToolsUpdateFailureCode | null {\n if (!errorMessage?.startsWith(PERSISTED_FAILURE_PREFIX)) {\n return null;\n }\n const firstLine = errorMessage.split(LINE_SPLIT_RE, 1)[0] ?? \"\";\n const parsed = openMeldToolsUpdateFailureCodeSchema.safeParse(\n firstLine.slice(PERSISTED_FAILURE_PREFIX.length)\n );\n return parsed.success ? parsed.data : null;\n}\n","import {\n OPEN_MELD_TOOLS_UPDATE_FAILURE_DETAIL_MAX_CHARS,\n openMeldToolsUpdateProcessFailureFrameSchema,\n} from \"@openmeld/schemas\";\nimport type {\n OpenMeldToolsUpdateFailureCode,\n OpenMeldToolsUpdateProcessFailureFrame,\n} from \"@openmeld/schemas/types\";\nimport { toErrorMessage } from \"@openmeld/utils\";\nimport { resolveOpenMeldToolsUpdateFailure } from \"./openmeld-tools-update-failure\";\n\nconst FAILURE_FRAME_OUTPUT_MAX_CHARS = 64 * 1024;\nconst LINE_SPLIT_RE = /\\r?\\n/u;\n\nexport type OpenMeldToolsUpdateProcessFailure = {\n detail: string;\n failureCode: OpenMeldToolsUpdateFailureCode;\n};\n\nexport function emitOpenMeldToolsUpdateFailureFrame(error: unknown): void {\n const detail = truncateText(\n toErrorMessage(error),\n OPEN_MELD_TOOLS_UPDATE_FAILURE_DETAIL_MAX_CHARS\n );\n const frame: OpenMeldToolsUpdateProcessFailureFrame =\n openMeldToolsUpdateProcessFailureFrameSchema.parse({\n detail: detail || \"OpenMeld update process failed.\",\n failureCode:\n resolveOpenMeldToolsUpdateFailure(error) ?? \"cli.update.failed\",\n schema: \"openmeld-tools-update-process-failure-v1\",\n v: 1,\n });\n // The leading newline keeps the frame parseable even when prior presenter\n // output ended mid-line.\n process.stdout.write(`\\n${JSON.stringify(frame)}\\n`);\n}\n\nexport function appendBoundedOpenMeldToolsUpdateProcessOutput(\n current: string,\n chunk: string\n): string {\n return truncateText(\n `${current}${chunk}`,\n FAILURE_FRAME_OUTPUT_MAX_CHARS,\n \"tail\"\n );\n}\n\nexport function parseOpenMeldToolsUpdateFailureFrame(\n output: string\n): OpenMeldToolsUpdateProcessFailure | null {\n const lines = output.split(LINE_SPLIT_RE);\n for (let index = lines.length - 1; index >= 0; index -= 1) {\n const line = lines[index]?.trim();\n if (!line?.startsWith(\"{\")) {\n continue;\n }\n try {\n const parsed = openMeldToolsUpdateProcessFailureFrameSchema.safeParse(\n JSON.parse(line) as unknown\n );\n if (parsed.success) {\n return {\n detail: parsed.data.detail,\n failureCode: parsed.data.failureCode,\n };\n }\n } catch {\n // Other agent-view output and truncated lines are not update frames.\n }\n }\n return null;\n}\n\nfunction truncateText(\n value: string,\n maxChars: number,\n side: \"head\" | \"tail\" = \"head\"\n): string {\n if (value.length <= maxChars) {\n return value;\n }\n if (side === \"tail\") {\n return value.slice(-maxChars);\n }\n const suffix = \"…\";\n return value.slice(0, Math.max(0, maxChars - suffix.length)) + suffix;\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"openmeld-tools-update-process-frame-0X-t0Kjv.js","names":["LINE_SPLIT_RE"],"sources":["../src/local-service/maintenance/openmeld-tools-update-failure.ts","../src/local-service/maintenance/openmeld-tools-update-process-frame.ts"],"sourcesContent":["import { openMeldToolsUpdateFailureCodeSchema } from \"@openmeld/schemas\";\nimport type { OpenMeldToolsUpdateFailureCode } from \"@openmeld/schemas/types\";\nimport { toErrorMessage } from \"@openmeld/utils\";\n\nconst PERSISTED_FAILURE_PREFIX = \"openmeld.tools.update.failure=\";\nconst INTERNAL_FAILURE_PREFIX = \"openmeld.tools.update.\";\nconst LINE_SPLIT_RE = /\\r?\\n/u;\n\nexport class OpenMeldToolsUpdateFailureError extends Error {\n readonly failureCode: OpenMeldToolsUpdateFailureCode;\n\n constructor(input: {\n cause?: unknown;\n failureCode: OpenMeldToolsUpdateFailureCode;\n message: string;\n }) {\n super(\n input.message,\n input.cause === undefined ? undefined : { cause: input.cause }\n );\n this.name = \"OpenMeldToolsUpdateFailureError\";\n this.failureCode = openMeldToolsUpdateFailureCodeSchema.parse(\n input.failureCode\n );\n }\n}\n\nexport function withOpenMeldToolsUpdateFailure(\n error: unknown,\n fallbackCode: OpenMeldToolsUpdateFailureCode\n): OpenMeldToolsUpdateFailureError {\n const existing = resolveOpenMeldToolsUpdateFailure(error);\n if (error instanceof OpenMeldToolsUpdateFailureError && existing) {\n return error;\n }\n return new OpenMeldToolsUpdateFailureError({\n cause: error,\n failureCode: existing ?? fallbackCode,\n message: toErrorMessage(error),\n });\n}\n\nexport function resolveOpenMeldToolsUpdateFailure(\n error: unknown\n): OpenMeldToolsUpdateFailureCode | null {\n const seen = new Set<unknown>();\n let current: unknown = error;\n while (current && typeof current === \"object\" && !seen.has(current)) {\n seen.add(current);\n const direct = openMeldToolsUpdateFailureCodeSchema.safeParse(\n (current as { failureCode?: unknown }).failureCode\n );\n if (direct.success) {\n return direct.data;\n }\n const internalCode = (current as { code?: unknown }).code;\n if (typeof internalCode === \"string\") {\n const parsed = openMeldToolsUpdateFailureCodeSchema.safeParse(\n internalCode.startsWith(INTERNAL_FAILURE_PREFIX)\n ? `cli.update.${internalCode.slice(INTERNAL_FAILURE_PREFIX.length)}`\n : internalCode\n );\n if (parsed.success) {\n return parsed.data;\n }\n }\n current = (current as { cause?: unknown }).cause;\n }\n return null;\n}\n\nexport function encodePersistedOpenMeldToolsUpdateFailure(input: {\n detail: string;\n failureCode: OpenMeldToolsUpdateFailureCode;\n}): string {\n const failureCode = openMeldToolsUpdateFailureCodeSchema.parse(\n input.failureCode\n );\n const detail = input.detail.trim();\n return `${PERSISTED_FAILURE_PREFIX}${failureCode}${\n detail ? `\\n${detail}` : \"\"\n }`;\n}\n\nexport function resolvePersistedOpenMeldToolsUpdateFailure(\n errorMessage: string | null\n): OpenMeldToolsUpdateFailureCode | null {\n if (!errorMessage?.startsWith(PERSISTED_FAILURE_PREFIX)) {\n return null;\n }\n const firstLine = errorMessage.split(LINE_SPLIT_RE, 1)[0] ?? \"\";\n const parsed = openMeldToolsUpdateFailureCodeSchema.safeParse(\n firstLine.slice(PERSISTED_FAILURE_PREFIX.length)\n );\n return parsed.success ? parsed.data : null;\n}\n","import {\n OPEN_MELD_TOOLS_UPDATE_FAILURE_DETAIL_MAX_CHARS,\n openMeldToolsUpdateProcessFailureFrameSchema,\n} from \"@openmeld/schemas\";\nimport type {\n OpenMeldToolsUpdateFailureCode,\n OpenMeldToolsUpdateProcessFailureFrame,\n} from \"@openmeld/schemas/types\";\nimport { toErrorMessage } from \"@openmeld/utils\";\nimport { resolveOpenMeldToolsUpdateFailure } from \"./openmeld-tools-update-failure\";\n\nconst FAILURE_FRAME_OUTPUT_MAX_CHARS = 64 * 1024;\nconst LINE_SPLIT_RE = /\\r?\\n/u;\n\nexport type OpenMeldToolsUpdateProcessFailure = {\n detail: string;\n failureCode: OpenMeldToolsUpdateFailureCode;\n};\n\nexport function emitOpenMeldToolsUpdateFailureFrame(error: unknown): void {\n const detail = truncateText(\n toErrorMessage(error),\n OPEN_MELD_TOOLS_UPDATE_FAILURE_DETAIL_MAX_CHARS\n );\n const frame: OpenMeldToolsUpdateProcessFailureFrame =\n openMeldToolsUpdateProcessFailureFrameSchema.parse({\n detail: detail || \"OpenMeld update process failed.\",\n failureCode:\n resolveOpenMeldToolsUpdateFailure(error) ?? \"cli.update.failed\",\n schema: \"openmeld-tools-update-process-failure-v1\",\n v: 1,\n });\n // The leading newline keeps the frame parseable even when prior presenter\n // output ended mid-line.\n process.stdout.write(`\\n${JSON.stringify(frame)}\\n`);\n}\n\nexport function appendBoundedOpenMeldToolsUpdateProcessOutput(\n current: string,\n chunk: string\n): string {\n return truncateText(\n `${current}${chunk}`,\n FAILURE_FRAME_OUTPUT_MAX_CHARS,\n \"tail\"\n );\n}\n\nexport function parseOpenMeldToolsUpdateFailureFrame(\n output: string\n): OpenMeldToolsUpdateProcessFailure | null {\n const lines = output.split(LINE_SPLIT_RE);\n for (let index = lines.length - 1; index >= 0; index -= 1) {\n const line = lines[index]?.trim();\n if (!line?.startsWith(\"{\")) {\n continue;\n }\n try {\n const parsed = openMeldToolsUpdateProcessFailureFrameSchema.safeParse(\n JSON.parse(line) as unknown\n );\n if (parsed.success) {\n return {\n detail: parsed.data.detail,\n failureCode: parsed.data.failureCode,\n };\n }\n } catch {\n // Other agent-view output and truncated lines are not update frames.\n }\n }\n return null;\n}\n\nfunction truncateText(\n value: string,\n maxChars: number,\n side: \"head\" | \"tail\" = \"head\"\n): string {\n if (value.length <= maxChars) {\n return value;\n }\n if (side === \"tail\") {\n return value.slice(-maxChars);\n }\n const suffix = \"…\";\n return value.slice(0, Math.max(0, maxChars - suffix.length)) + suffix;\n}\n"],"mappings":"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"}
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { n as emitOpenMeldToolsUpdateFailureFrame } from "./openmeld-tools-update-process-frame-CbZPpc7D.js";
3
+ import { n as emitOpenMeldToolsUpdateFailureFrame } from "./openmeld-tools-update-process-frame-0X-t0Kjv.js";
4
4
  export { emitOpenMeldToolsUpdateFailureFrame };
package/dist/openmeld.js CHANGED
@@ -3,24 +3,24 @@
3
3
  //#region src/openmeld-entry.ts
4
4
  const args = process.argv.slice(2);
5
5
  if (args.length === 2 && args[0] === "service" && args[1] === "update-worker") try {
6
- const { runOpenMeldMaintenanceWorker } = await import("./openmeld-maintenance-worker-DtY_H7Bv.js");
6
+ const { runOpenMeldMaintenanceWorker } = await import("./openmeld-maintenance-worker-D5VAO9GD.js");
7
7
  await runOpenMeldMaintenanceWorker();
8
8
  } catch (error) {
9
9
  console.error("[openmeld.maintenance.failed]", error);
10
10
  process.exitCode = 1;
11
11
  }
12
12
  else if (args.length === 1 && (args[0] === "maintenance-upgrade" || args[0] === "maintenance-align-service")) try {
13
- const { runMaintenanceUpgrade } = await import("./upgrade-DKXu-1wO.js");
13
+ const { runMaintenanceUpgrade } = await import("./upgrade-CXgHeEKK.js");
14
14
  await runMaintenanceUpgrade(args[0] === "maintenance-align-service");
15
15
  } catch (error) {
16
16
  try {
17
- const { emitOpenMeldToolsUpdateFailureFrame } = await import("./openmeld-tools-update-process-frame-CcPLrSsw.js");
17
+ const { emitOpenMeldToolsUpdateFailureFrame } = await import("./openmeld-tools-update-process-frame-DX1Dc8VI.js");
18
18
  emitOpenMeldToolsUpdateFailureFrame(error);
19
19
  } catch {}
20
20
  console.error("[openmeld.maintenance.upgrade_failed]", error);
21
21
  process.exitCode = 1;
22
22
  }
23
- else await import("./openmeld-B4gQCCex.js");
23
+ else await import("./openmeld-I4pLxQsY.js");
24
24
  //#endregion
25
25
  export {};
26
26
 
@@ -1,21 +1,22 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { A as isLocalMachineFailureError, T as LocalMachineFailureError, _t as skillsDir, rt as openMeldRootDir } from "./lock-Dxp6o_t_.js";
4
- import { zt as createCurrentDeviceApi } from "./dist-jsWwS864.js";
5
- import { $i as buildLocalAgentCatalogFromReadiness, $t as resolveCurrentDaemonExpectedVersion, Bn as resolveSkillsAgentRegistry, Bt as toStartBackgroundHelperExecutionCompatibility, Dn as reconcileNewRunnableBuiltinAgentsForSetup, J as getSetupFlowCopy, Ra as resolveRuntimeContext, Rn as canManageRegistryAgentSkillTargets, St as readOpenMeldToolsUpdateContextFromEnv, Ya as resolveOpenMeldProfile, Zn as notifyDaemonRouteCatalogChanged, jt as inspectDaemonServiceInventory, n as scheduleDaemonServiceUpdate, si as buildAgentControllerRef, zn as detectInstalledSkillsAgents, zt as resolveDaemonRuntimeContractCompatibility } from "./daemon-service-update-coordinator-DcjOzGu1.js";
6
- import { at as prepareSessionStreamServerFrameSchema, b as recordInterruptedComputerAuthSessionRecoveryFailure, c as completeInterruptedComputerAuthSessionRecovery, ct as prepareStepDiagnosticsBundleSchema, d as getAuthSessionState, dt as redactPrepareStepDiagnosticsValue, h as markInterruptedComputerAuthSessionRecovery, lt as redactPrepareStepDiagnosticsBundle, ot as prepareSessionWithTokenResponseSchema, p as getInterruptedComputerAuthSessionRecovery, rt as prepareSessionResponseSchema, st as prepareSetupBootstrapWriteSchema, tt as PREPARE_STEP_DIAGNOSTICS_MAX_CHARS, ut as redactPrepareStepDiagnosticsText } from "./auth-session-Dqz9X4F0.js";
7
- import { a as mergeTargetsByDir, b as withSkillsInstallLock, c as summarizeSkillState, d as resolveSkillsInstallStates, f as ensureLocalSkills, i as filterTargetsWithInstalledOpenMeldSkills, l as installSkillsToTargets, m as readOpenMeldSkillMarker, n as collectSkillsReadinessSnapshot, o as persistDetectedInstallStateFromCheck, p as isOpenMeldManagedSkillDir, r as compareInstallRecords, s as resolveTrackedInstallTargets, t as buildAgentTargets } from "./installation-inventory-B0cbVLun.js";
8
- import { $n as runInteractivePrompt, D as createDelayedSpinner, Jn as renderInfoCard, L as readDaemonIncidentLogTail, M as buildHumanErrorCopy, N as renderHumanErrorCard, Qn as isReturnKeypress, Yn as renderTextInfoCard, Zn as promptTextEntry, ar as extractAuthApiErrorMessage, cr as resolveDeviceAuthClientId, dt as collectLocalAgentControllerInventory, fn as connectWebSocket, ft as resolveLocalAgentControllerBlockerReasonCodes, lr as resolveDeviceTokenExpiresAt, mt as resolveLocalAgentControllerReportDecision, or as fetchAuthUserSnapshot, pt as resolveLocalAgentControllerLaunchability, sr as requestDeviceToken, t as bestEffortStopCurrentLaneDaemonService, ur as revokeAuthAccessToken, ut as submitRuntimeAgentControllerReports } from "./service-CTG3_X0o.js";
9
- import { G as readRecentDaemonLifecycleEvents, Ht as upsertDaemonServiceContract, Vt as readDaemonServiceContract, Y as collectLocalOperationFailure, i as readCurrentObservedDaemonRuntimeStatus, lt as compareSemver, nt as OPENMELD_VERSION, st as readPendingDaemonServiceUpdate } from "./daemon-service-runtime-CWTlAhZY.js";
10
- import { At as getCliVersionInfo, Bt as buildAgentOverviewFromContract, C as createSkillsActionGuideError, Et as getSkillsTargetSelectionRequiredArguments, Gt as createPresenter, Kt as sanitizeTerminalDisplayText, Ot as validateSkillsTargetSelectionInput, Tt as getSkillsTargetSelectionOptionalArguments, Wt as formatAgentOverviewPayload, Xt as outLine, g as canUseInteractivePrompts, ht as getCommandEntryContract, n as resolveElapsedTimeMs, t as formatElapsedTime, wt as buildSkillsTargetSelectionExamples } from "./elapsed-time-iFOSSUJo.js";
4
+ import { zt as createCurrentDeviceApi } from "./dist-CAx_kxvt.js";
5
+ import { $t as resolveCurrentDaemonExpectedVersion, Bn as resolveSkillsAgentRegistry, Bt as toStartBackgroundHelperExecutionCompatibility, Dn as reconcileNewRunnableBuiltinAgentsForSetup, J as getSetupFlowCopy, Rn as canManageRegistryAgentSkillTargets, St as readOpenMeldToolsUpdateContextFromEnv, Xa as resolveOpenMeldProfile, Zn as notifyDaemonRouteCatalogChanged, ea as buildLocalAgentCatalogFromReadiness, jt as inspectDaemonServiceInventory, n as scheduleDaemonServiceUpdate, si as buildAgentControllerRef, za as resolveRuntimeContext, zn as detectInstalledSkillsAgents, zt as resolveDaemonRuntimeContractCompatibility } from "./daemon-service-update-coordinator-BcbbIDzC.js";
6
+ import { at as prepareSessionStreamServerFrameSchema, b as recordInterruptedComputerAuthSessionRecoveryFailure, c as completeInterruptedComputerAuthSessionRecovery, ct as prepareStepDiagnosticsBundleSchema, d as getAuthSessionState, dt as redactPrepareStepDiagnosticsValue, h as markInterruptedComputerAuthSessionRecovery, lt as redactPrepareStepDiagnosticsBundle, ot as prepareSessionWithTokenResponseSchema, p as getInterruptedComputerAuthSessionRecovery, rt as prepareSessionResponseSchema, st as prepareSetupBootstrapWriteSchema, tt as PREPARE_STEP_DIAGNOSTICS_MAX_CHARS, ut as redactPrepareStepDiagnosticsText } from "./auth-session-DgHvRt5i.js";
7
+ import { T as resolveOpenMeldToolsUpdateTargetVersions } from "./local-components-B6SCXZf9.js";
8
+ import { a as mergeTargetsByDir, b as withSkillsInstallLock, c as summarizeSkillState, d as resolveSkillsInstallStates, f as ensureLocalSkills, i as filterTargetsWithInstalledOpenMeldSkills, l as installSkillsToTargets, m as readOpenMeldSkillMarker, n as collectSkillsReadinessSnapshot, o as persistDetectedInstallStateFromCheck, p as isOpenMeldManagedSkillDir, r as compareInstallRecords, s as resolveTrackedInstallTargets, t as buildAgentTargets } from "./installation-inventory-C92AkQkA.js";
9
+ import { $n as runInteractivePrompt, D as createDelayedSpinner, Jn as renderInfoCard, L as readDaemonIncidentLogTail, M as buildHumanErrorCopy, N as renderHumanErrorCard, Qn as isReturnKeypress, Yn as renderTextInfoCard, Zn as promptTextEntry, ar as extractAuthApiErrorMessage, cr as resolveDeviceAuthClientId, dt as collectLocalAgentControllerInventory, fn as connectWebSocket, ft as resolveLocalAgentControllerBlockerReasonCodes, lr as resolveDeviceTokenExpiresAt, mt as resolveLocalAgentControllerReportDecision, or as fetchAuthUserSnapshot, pt as resolveLocalAgentControllerLaunchability, sr as requestDeviceToken, t as bestEffortStopCurrentLaneDaemonService, ur as revokeAuthAccessToken, ut as submitRuntimeAgentControllerReports } from "./service-Cev-7yAJ.js";
10
+ import { G as readRecentDaemonLifecycleEvents, Ht as upsertDaemonServiceContract, Vt as readDaemonServiceContract, Y as collectLocalOperationFailure, i as readCurrentObservedDaemonRuntimeStatus, lt as compareSemver, nt as OPENMELD_VERSION, st as readPendingDaemonServiceUpdate } from "./daemon-service-runtime-CY6wdBe1.js";
11
+ import { At as getCliVersionInfo, Bt as buildAgentOverviewFromContract, C as createSkillsActionGuideError, Et as getSkillsTargetSelectionRequiredArguments, Gt as createPresenter, Kt as sanitizeTerminalDisplayText, Ot as validateSkillsTargetSelectionInput, Tt as getSkillsTargetSelectionOptionalArguments, Wt as formatAgentOverviewPayload, Xt as outLine, g as canUseInteractivePrompts, ht as getCommandEntryContract, n as resolveElapsedTimeMs, t as formatElapsedTime, wt as buildSkillsTargetSelectionExamples } from "./elapsed-time-Do3uIV__.js";
11
12
  import { S as setConfiguredSkillsConfig, T as updateConfiguredSkillsConfig, g as getConfiguredSkillsConfig, y as resolveRuntimeSkillsCustomTargetId } from "./base-url-C6sHRNGu.js";
12
13
  import { A as getDaemonStatus } from "./daemon-state-C37ZtIZK.js";
13
14
  import { S as resolveDaemonServiceManager, _ as readDaemonServiceJobCrashExitCode, d as isDaemonServiceJobNeverSpawned } from "./daemon-service-manager-GiMCiTmu.js";
14
15
  import { a as formatOpenMeldCliCommand, c as formatOpenMeldCliTextBlock, i as formatInlineOpenMeldCliCommands, r as resolveAuthBaseUrl } from "./openmeld-environment-target-NtJYJe1D.js";
15
16
  import { t as sleep } from "./dist-o3UL1EGQ.js";
16
- import { d as buildOpenMeldRequestContextFromProfile, n as fetchSpaceRequestWithTimeout, t as createCliApiClientFoundation } from "./api-client-foundation-DjbtuE52.js";
17
- import { n as waitForExternalOpenMeldToolsUpdate, r as waitForOpenMeldToolsUpdateCompletion, t as resolveExternalOpenMeldToolsUpdate } from "./openmeld-tools-update-join-DS_EIL5q.js";
18
- import { C as resolveGatewayWebOrigin, T as runDaemonServiceParticipationGate, _ as promptSearchSelect, f as runAgentsRepair, h as promptSearchMultiselect, l as runAgentsEnable, x as computeRetryDelayMs } from "./agents-Y-UJ74By.js";
17
+ import { d as buildOpenMeldRequestContextFromProfile, n as fetchSpaceRequestWithTimeout, t as createCliApiClientFoundation } from "./api-client-foundation-km8Ol1P4.js";
18
+ import { n as waitForExternalOpenMeldToolsUpdate, r as waitForOpenMeldToolsUpdateCompletion, t as resolveExternalOpenMeldToolsUpdate } from "./openmeld-tools-update-join-DsQdgYNw.js";
19
+ import { C as resolveGatewayWebOrigin, T as runDaemonServiceParticipationGate, _ as promptSearchSelect, f as runAgentsRepair, h as promptSearchMultiselect, l as runAgentsEnable, x as computeRetryDelayMs } from "./agents-BNoz9DA5.js";
19
20
  import os, { hostname, release } from "node:os";
20
21
  import { basename, dirname, isAbsolute, join, relative, resolve } from "node:path";
21
22
  import { lstat, readFile, readlink, rm, stat } from "node:fs/promises";
@@ -134,9 +135,26 @@ function normalizeOptionalString$1(value) {
134
135
  //#region src/commands/computer-auth-handoff-recovery.ts
135
136
  const UNUSED_SETUP_SESSION_CLEANUP_SUFFIX = " OpenMeld also could not revoke the unused setup session.";
136
137
  async function recoverInterruptedComputerAuthHandoff(input) {
138
+ try {
139
+ return await runInterruptedComputerAuthHandoffRecovery(input);
140
+ } catch (error) {
141
+ emitComputerAuthHandoffRecoveryProgress(input, {
142
+ code: "setup.computer_handoff_recovery.failed",
143
+ state: "failed",
144
+ text: error instanceof Error && error.message.trim() ? error.message : "The previous computer connection could not be restored."
145
+ });
146
+ throw error;
147
+ }
148
+ }
149
+ async function runInterruptedComputerAuthHandoffRecovery(input) {
137
150
  await waitForOpenMeldToolsUpdateBeforeComputerHandoff(input);
138
151
  const recovery = await getInterruptedComputerAuthSessionRecovery();
139
152
  if (!recovery) return "none";
153
+ emitComputerAuthHandoffRecoveryProgress(input, {
154
+ code: "setup.computer_handoff_recovery.started",
155
+ state: "active",
156
+ text: "Restoring the previous computer connection."
157
+ });
140
158
  const previousOwnerUserId = normalizeOptionalString(recovery.previousSession?.user?.id);
141
159
  if (!recovery.serviceReconciled) {
142
160
  const stopped = await stopCurrentLaneDaemonServiceAfterToolsUpdate(input);
@@ -207,6 +225,11 @@ async function recoverInterruptedComputerAuthHandoff(input) {
207
225
  transitionId: recovery.id
208
226
  });
209
227
  emitUnusedSetupSessionCleanupWarning(input.presenter, revoked.error);
228
+ emitComputerAuthHandoffRecoveryProgress(input, {
229
+ code: "setup.computer_handoff_recovery.deferred",
230
+ state: "failed",
231
+ text: "The previous computer connection has not been fully restored."
232
+ });
210
233
  return "deferred";
211
234
  }
212
235
  await markInterruptedComputerAuthSessionRecovery({
@@ -214,7 +237,29 @@ async function recoverInterruptedComputerAuthHandoff(input) {
214
237
  phase: "remote_session"
215
238
  });
216
239
  }
217
- return await completeInterruptedComputerAuthSessionRecovery(recovery.id) ? "completed" : "deferred";
240
+ const completed = await completeInterruptedComputerAuthSessionRecovery(recovery.id);
241
+ emitComputerAuthHandoffRecoveryProgress(input, {
242
+ code: completed ? "setup.computer_handoff_recovery.completed" : "setup.computer_handoff_recovery.deferred",
243
+ state: completed ? "completed" : "failed",
244
+ text: completed ? "Restored the previous computer connection." : "The previous computer connection has not been fully restored."
245
+ });
246
+ return completed ? "completed" : "deferred";
247
+ }
248
+ function emitComputerAuthHandoffRecoveryProgress(input, progress) {
249
+ input.presenter.line({
250
+ code: progress.code,
251
+ text: progress.text,
252
+ data: {
253
+ phase: "restoring",
254
+ state: progress.state
255
+ }
256
+ });
257
+ try {
258
+ input.onProgress?.({
259
+ ...progress,
260
+ phase: "restoring"
261
+ });
262
+ } catch {}
218
263
  }
219
264
  async function stopCurrentLaneDaemonServiceAfterToolsUpdate(input) {
220
265
  let stopped = await bestEffortStopCurrentLaneDaemonService({ runtime: input.runtime });
@@ -3637,8 +3682,10 @@ function shouldForceSetupServiceRefresh() {
3637
3682
  function resolveSetupServiceUpdateTruth(input) {
3638
3683
  const operation = input.operation;
3639
3684
  if (!operation) return { status: "ready" };
3685
+ const target = resolveOpenMeldToolsUpdateTargetVersions(operation);
3686
+ const currentInstallationSatisfiesTarget = input.currentServiceVerified === true && input.installedServiceVersion !== null && compareSemver(input.currentCliVersion, target.cliVersion) >= 0 && compareSemver(input.installedServiceVersion, target.serviceVersion) >= 0;
3640
3687
  if (operation.phase === "restored" || operation.phase === "needs_help") {
3641
- if (input.currentServiceVerified && input.installedServiceVersion === input.currentCliVersion && compareSemver(input.currentCliVersion, operation.targetVersion) >= 0) return { status: "ready" };
3688
+ if (currentInstallationSatisfiesTarget) return { status: "ready" };
3642
3689
  return {
3643
3690
  message: "OpenMeld Service update failed. Run `openmeld service update`.",
3644
3691
  status: "failed"
@@ -3648,8 +3695,7 @@ function resolveSetupServiceUpdateTruth(input) {
3648
3695
  message: "OpenMeld Service is updating in the background. Setup will continue automatically when it finishes.",
3649
3696
  status: "updating"
3650
3697
  };
3651
- if (input.currentServiceVerified && input.installedServiceVersion === input.currentCliVersion && compareSemver(input.currentCliVersion, operation.targetVersion) > 0) return { status: "ready" };
3652
- if (input.currentServiceVerified && input.currentCliVersion === operation.targetVersion && input.installedServiceVersion === operation.targetVersion) return { status: "ready" };
3698
+ if (currentInstallationSatisfiesTarget) return { status: "ready" };
3653
3699
  return {
3654
3700
  message: "OpenMeld Service update could not be verified. Run `openmeld service update`.",
3655
3701
  status: "verifying"
@@ -3659,7 +3705,7 @@ async function assertSetupServiceUpdateComplete(input = {}) {
3659
3705
  const operation = await waitForOpenMeldToolsUpdateCompletion(input);
3660
3706
  if (!operation) return;
3661
3707
  const inventory = await inspectDaemonServiceInventory({
3662
- expectedVersion: OPENMELD_VERSION,
3708
+ expectedVersion: await resolveCurrentDaemonExpectedVersion(resolveOpenMeldToolsUpdateTargetVersions(operation).serviceVersion),
3663
3709
  intent: "status_cleanup"
3664
3710
  });
3665
3711
  const truth = resolveSetupServiceUpdateTruth({
@@ -3800,6 +3846,7 @@ async function runPrepareSessionExecutorOnce(input) {
3800
3846
  emitHumanSection(input.input, "OpenMeld setup");
3801
3847
  const connectionProgress = startPrepareProgressStep(input.input, {
3802
3848
  code: "prepare.session.progress.connect_terminal",
3849
+ phase: "connecting_service",
3803
3850
  text: "Connecting Terminal to OpenMeld Web..."
3804
3851
  });
3805
3852
  let stream = null;
@@ -3809,6 +3856,7 @@ async function runPrepareSessionExecutorOnce(input) {
3809
3856
  opaqueToken: input.input.startSession,
3810
3857
  prepareSessionId: input.initial.prepareSessionId
3811
3858
  });
3859
+ input.input.connectedStream = stream;
3812
3860
  const connected = await waitForSnapshotWithProgress({
3813
3861
  input: input.input,
3814
3862
  stream,
@@ -4024,6 +4072,7 @@ async function reportLocalAgentCatalogForSelection(input) {
4024
4072
  emitHumanSection(input.input, "Local agents");
4025
4073
  const progress = startPrepareProgressStep(input.input, {
4026
4074
  code: "prepare.session.progress.local_agents",
4075
+ phase: "confirming",
4027
4076
  text: "Checking local agents..."
4028
4077
  });
4029
4078
  const reconciliation = input.input.localAgentSelection ? null : await reconcileNewRunnableBuiltinAgentsForSetup();
@@ -4142,6 +4191,7 @@ async function executeSelectedAgentPreparation(input) {
4142
4191
  async function runTerminalStep(input) {
4143
4192
  const progress = startPrepareProgressStep(input.input, {
4144
4193
  code: `prepare.session.progress.${input.stepId}`,
4194
+ phase: resolveTerminalStepProgressPhase(input.stepId),
4145
4195
  text: input.message
4146
4196
  });
4147
4197
  const stepStartRevision = input.snapshot.sessionRevision;
@@ -4766,6 +4816,7 @@ async function waitForSnapshotWithProgress(input) {
4766
4816
  }
4767
4817
  progress = startPrepareProgressStep(input.input, {
4768
4818
  code: "prepare.session.waiting",
4819
+ phase: "connecting_service",
4769
4820
  text: input.waitingMessage
4770
4821
  });
4771
4822
  progressStartedByWait = true;
@@ -4814,6 +4865,10 @@ async function connectPrepareSessionStream(input) {
4814
4865
  let closedError = null;
4815
4866
  let stateWriteSent = false;
4816
4867
  let pendingStepWriteFallbackFrame = null;
4868
+ let supportsConnectionProgress = false;
4869
+ const progressOperationId = crypto.randomUUID();
4870
+ const progressStartedAt = (/* @__PURE__ */ new Date()).toISOString();
4871
+ let progressSequence = 0;
4817
4872
  const assertStreamOpen = () => {
4818
4873
  if (closedError) throw closedError;
4819
4874
  };
@@ -4850,6 +4905,10 @@ async function connectPrepareSessionStream(input) {
4850
4905
  handleServerErrorFrame(frame.payload);
4851
4906
  return;
4852
4907
  }
4908
+ if (frame.type === "server.capabilities") {
4909
+ supportsConnectionProgress = frame.payload.connectionProgress === 1;
4910
+ return;
4911
+ }
4853
4912
  if (frame.type !== "snapshot" && frame.type !== "snapshot_changed") return;
4854
4913
  pendingStepWriteFallbackFrame = null;
4855
4914
  const snapshot = frame.payload.snapshot;
@@ -4920,6 +4979,29 @@ async function connectPrepareSessionStream(input) {
4920
4979
  }
4921
4980
  });
4922
4981
  },
4982
+ writeConnectionProgress: (progress) => {
4983
+ if (!supportsConnectionProgress) return;
4984
+ const snapshot = latestSnapshot;
4985
+ const connectionEpoch = snapshot?.terminalConnection.connectionEpoch;
4986
+ if (!(snapshot && connectionEpoch)) return;
4987
+ sendFrame({
4988
+ type: "terminal.connection_progress.write",
4989
+ payload: {
4990
+ schemaVersion: 1,
4991
+ operationId: progressOperationId,
4992
+ attemptId: progressOperationId,
4993
+ prepareSessionId: snapshot.prepareSessionId,
4994
+ connectionEpoch,
4995
+ sequence: progressSequence++,
4996
+ startedAt: progressStartedAt,
4997
+ observedAt: (/* @__PURE__ */ new Date()).toISOString(),
4998
+ phase: progress.phase,
4999
+ state: progress.state,
5000
+ code: progress.code,
5001
+ ...progress.detail ? { detail: progress.detail.slice(0, 512) } : {}
5002
+ }
5003
+ });
5004
+ },
4923
5005
  writeTerminalLocalAgentCatalog: (catalog) => {
4924
5006
  if (!latestSnapshot) throw new Error("Setup session snapshot is not available yet.");
4925
5007
  stateWriteSent = true;
@@ -5005,6 +5087,12 @@ function emitHumanSection(input, title) {
5005
5087
  });
5006
5088
  }
5007
5089
  function emitPrepareProgressLine(input, progress) {
5090
+ writeConnectionProgressObservation(input, {
5091
+ code: progress.code ?? `prepare.session.progress.${progress.state}`,
5092
+ phase: progress.phase ?? "confirming",
5093
+ state: progress.state === "success" ? "completed" : "active",
5094
+ text: progress.text
5095
+ });
5008
5096
  createPrepareProgressReporter(input).line({
5009
5097
  code: progress.code ?? `prepare.session.progress.${progress.state}`,
5010
5098
  data: progress.data,
@@ -5012,18 +5100,83 @@ function emitPrepareProgressLine(input, progress) {
5012
5100
  text: progress.text
5013
5101
  });
5014
5102
  }
5015
- function emitPrepareProgressDetail(input, text, code) {
5103
+ function emitPrepareProgressDetail(input, text, code, phase = "confirming") {
5104
+ writeConnectionProgressObservation(input, {
5105
+ code: code ?? "prepare.session.progress.detail",
5106
+ phase,
5107
+ state: "active",
5108
+ text
5109
+ });
5016
5110
  createPrepareProgressReporter(input).detail({
5017
5111
  code: code ?? "prepare.session.progress.detail",
5018
5112
  text
5019
5113
  });
5020
5114
  }
5021
5115
  function startPrepareProgressStep(input, progress) {
5022
- return createPrepareProgressReporter(input).startStep({
5116
+ writeConnectionProgressObservation(input, {
5117
+ code: progress.code,
5118
+ phase: progress.phase,
5119
+ state: "active",
5120
+ text: progress.text
5121
+ });
5122
+ const handle = createPrepareProgressReporter(input).startStep({
5023
5123
  code: progress.code,
5024
5124
  data: progress.data,
5025
5125
  text: progress.text
5026
5126
  });
5127
+ return {
5128
+ cancel: handle.cancel,
5129
+ complete: (message) => {
5130
+ handle.complete(message);
5131
+ writeConnectionProgressObservation(input, {
5132
+ code: `${progress.code}.completed`,
5133
+ phase: progress.phase,
5134
+ state: "completed",
5135
+ text: message ?? progress.text
5136
+ });
5137
+ },
5138
+ detail: (detail) => {
5139
+ handle.detail(detail);
5140
+ writeConnectionProgressObservation(input, {
5141
+ code: detail.code ?? `${progress.code}.detail`,
5142
+ phase: progress.phase,
5143
+ state: "active",
5144
+ text: detail.text
5145
+ });
5146
+ },
5147
+ fail: (message) => {
5148
+ handle.fail(message);
5149
+ writeConnectionProgressObservation(input, {
5150
+ code: `${progress.code}.failed`,
5151
+ phase: "needs_attention",
5152
+ state: "failed",
5153
+ text: message ?? progress.text
5154
+ });
5155
+ }
5156
+ };
5157
+ }
5158
+ function writeConnectionProgressObservation(input, progress) {
5159
+ try {
5160
+ input.connectedStream?.writeConnectionProgress?.({
5161
+ code: progress.code,
5162
+ detail: progress.text,
5163
+ phase: progress.phase,
5164
+ state: progress.state
5165
+ });
5166
+ } catch {}
5167
+ }
5168
+ function resolveTerminalStepProgressPhase(stepId) {
5169
+ switch (stepId) {
5170
+ case "computer":
5171
+ case "connect_terminal":
5172
+ case "refresh_service": return "connecting_service";
5173
+ case "choose_local_agents":
5174
+ case "prepare_selected_agents":
5175
+ case "report_runtime":
5176
+ case "verify_setup": return "confirming";
5177
+ case "ready": return "connected";
5178
+ default: return "connecting_service";
5179
+ }
5027
5180
  }
5028
5181
  function createPrepareProgressReporter(input) {
5029
5182
  return createSetupProgressReporter({
@@ -5095,4 +5248,4 @@ function errorFromPrepareSessionServerError(input) {
5095
5248
  //#endregion
5096
5249
  export { mintPrepareSessionReconnectToken as A, buildNoLocalAgentsNoticeLines as C, recoverInterruptedComputerAuthHandoff as D, formatComputerAuthCleanupFailureSuffix as E, exchangeComputerAuthorizationGrant as O, buildLocalAgentsGuideUrl as S, emitUnusedSetupSessionCleanupWarning as T, runStartLocalAgentsEnable as _, assertSetupServiceUpdateComplete as a, submitSelectedAgentControllerReports as b, collectObservedDeviceMetadata as c, collectStartLocalReadiness as d, runSkillsCheck as f, runSkillsUpdate as g, runSkillsUninstall as h, runPrepareSessionExecutor as i, writePrepareSessionSetupBootstrapResult as j, revokePreparedAuthSession as k, createSetupProgressReporter as l, runSkillsInstall as m, reportPrepareHandoffStopped as n, shouldForceSetupServiceRefresh as o, runSkillsEnsure as p, resolvePrepareSessionForHandoff as r, syncLocalSetupCurrentDeviceTargetFromServiceContract as s, connectPrepareSessionStream as t, resolveControllingTerminalSession as u, isCliOutputHandledError as v, confirmContinueWithoutLocalAgents as w, appendLocalAgentsGuideUrl as x, assertSelectedAgentControllerReportSubmissionsAccepted as y };
5097
5250
 
5098
- //# sourceMappingURL=prepare-session-executor-CWKqfuse.js.map
5251
+ //# sourceMappingURL=prepare-session-executor-BEzlM0hJ.js.map