openmeld 0.3.222 → 0.3.224

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 (177) hide show
  1. package/dist/{add-me-membership-Wc69O6rA.js → add-me-membership-CGISMRPF.js} +2 -2
  2. package/dist/{add-me-membership-Wc69O6rA.js.map → add-me-membership-CGISMRPF.js.map} +1 -1
  3. package/dist/{agents-B8zhQnGw.js → agents-CR7BebgO.js} +12 -12
  4. package/dist/{agents-B8zhQnGw.js.map → agents-CR7BebgO.js.map} +1 -1
  5. package/dist/{api-client-foundation-DTiFoGpI.js → api-client-foundation-CqbIn_de.js} +1 -1
  6. package/dist/{api-client-foundation-DnJ_JYli.js → api-client-foundation-DpVwrgh-.js} +3 -3
  7. package/dist/{api-client-foundation-DnJ_JYli.js.map → api-client-foundation-DpVwrgh-.js.map} +1 -1
  8. package/dist/auth-session-BJfKu74u.js +4 -0
  9. package/dist/{auth-session-nhS8jyux.js → auth-session-uEk_Tx6T.js} +8 -8
  10. package/dist/auth-session-uEk_Tx6T.js.map +1 -0
  11. package/dist/{base-url-CMBApK1J.js → base-url-DXrUiSMI.js} +1 -1
  12. package/dist/{base-url-D7uE_xTo.js → base-url-DvjOkKPs.js} +2 -2
  13. package/dist/{base-url-D7uE_xTo.js.map → base-url-DvjOkKPs.js.map} +1 -1
  14. package/dist/{channel-ggx0o_aG.js → channel-B2fD2_be.js} +4 -4
  15. package/dist/{channel-ggx0o_aG.js.map → channel-B2fD2_be.js.map} +1 -1
  16. package/dist/{cli-binary-manifest-DiUulkp0.js → cli-binary-manifest-CT5X05lk.js} +30 -4
  17. package/dist/cli-binary-manifest-CT5X05lk.js.map +1 -0
  18. package/dist/{command-Bz9x7V2T.js → command-CQ9XRwqf.js} +22 -165
  19. package/dist/command-CQ9XRwqf.js.map +1 -0
  20. package/dist/{computer-connection-M3N6plkj.js → computer-connection-Dm7iTnRK.js} +2 -2
  21. package/dist/{computer-connection-M3N6plkj.js.map → computer-connection-Dm7iTnRK.js.map} +1 -1
  22. package/dist/{computer-connection-review-DY5BK_27.js → computer-connection-review-RHAoddSS.js} +6 -6
  23. package/dist/{computer-connection-review-DY5BK_27.js.map → computer-connection-review-RHAoddSS.js.map} +1 -1
  24. package/dist/{computer-disconnect-DR1WDSPK.js → computer-disconnect-BWRsge_2.js} +10 -10
  25. package/dist/{computer-disconnect-DR1WDSPK.js.map → computer-disconnect-BWRsge_2.js.map} +1 -1
  26. package/dist/{computer-setup-continuation-2gs8z-nB.js → computer-setup-continuation-BOCRH0qq.js} +4 -4
  27. package/dist/{computer-setup-continuation-2gs8z-nB.js.map → computer-setup-continuation-BOCRH0qq.js.map} +1 -1
  28. package/dist/context-Bdh3nAzw.js +162 -0
  29. package/dist/context-Bdh3nAzw.js.map +1 -0
  30. package/dist/{control-plane-e3W6PD2M.js → control-plane-rTE2rHZ5.js} +2 -2
  31. package/dist/{control-plane-e3W6PD2M.js.map → control-plane-rTE2rHZ5.js.map} +1 -1
  32. package/dist/{daemon-device-id-DWO9_QW6.js → daemon-device-id-B1Af2Zmn.js} +344 -36
  33. package/dist/daemon-device-id-B1Af2Zmn.js.map +1 -0
  34. package/dist/{daemon-frame-transport-D2-tazuK.js → daemon-frame-transport-WiB73yhT.js} +519 -12
  35. package/dist/daemon-frame-transport-WiB73yhT.js.map +1 -0
  36. package/dist/{daemon-lifecycle-journal-DyKx1xzm.js → daemon-lifecycle-journal-CDZLWgMj.js} +11 -11
  37. package/dist/daemon-lifecycle-journal-CDZLWgMj.js.map +1 -0
  38. package/dist/{daemon-runtime-lease-BUr4qsLo.js → daemon-runtime-lease-1LMeZ6IS.js} +2 -2
  39. package/dist/{daemon-runtime-lease-BUr4qsLo.js.map → daemon-runtime-lease-1LMeZ6IS.js.map} +1 -1
  40. package/dist/{daemon-runtime-lease-C9X8xV_F.js → daemon-runtime-lease-Bz0ucJj3.js} +1 -1
  41. package/dist/{daemon-service-contract-BpOBMGX0.js → daemon-service-contract-GLmAxsq-.js} +4 -4
  42. package/dist/{daemon-service-contract-BpOBMGX0.js.map → daemon-service-contract-GLmAxsq-.js.map} +1 -1
  43. package/dist/{daemon-service-manager-HL4VKbIU.js → daemon-service-manager-C8RUCMDo.js} +9 -7
  44. package/dist/daemon-service-manager-C8RUCMDo.js.map +1 -0
  45. package/dist/{daemon-service-manager-B-QrDe5p.js → daemon-service-manager-CU-79a4z.js} +1 -1
  46. package/dist/{daemon-service-runtime-bKt0YjC7.js → daemon-service-runtime-CBJtgM4P.js} +397 -51
  47. package/dist/daemon-service-runtime-CBJtgM4P.js.map +1 -0
  48. package/dist/{daemon-service-update-coordinator-D8O1uTtu.js → daemon-service-update-coordinator-0LB_XGVZ.js} +48 -33
  49. package/dist/daemon-service-update-coordinator-0LB_XGVZ.js.map +1 -0
  50. package/dist/{daemon-state-B44aq2nm.js → daemon-state-Ca0WK5x0.js} +3 -3
  51. package/dist/{daemon-state-B44aq2nm.js.map → daemon-state-Ca0WK5x0.js.map} +1 -1
  52. package/dist/{dist-B07ziN_u.js → dist-BeJcIdCZ.js} +25 -17
  53. package/dist/dist-BeJcIdCZ.js.map +1 -0
  54. package/dist/dist-C32frPV2.js +4 -0
  55. package/dist/{dist-B2EauBG6.js → dist-YbTZ-Y-2.js} +16 -12
  56. package/dist/dist-YbTZ-Y-2.js.map +1 -0
  57. package/dist/{elapsed-time-Ooo4IC25.js → elapsed-time-q8lSPcfm.js} +6 -6
  58. package/dist/{elapsed-time-Ooo4IC25.js.map → elapsed-time-q8lSPcfm.js.map} +1 -1
  59. package/dist/{entry-DeIRMCiW.js → entry-CpS6tnIk.js} +12 -12
  60. package/dist/{entry-DeIRMCiW.js.map → entry-CpS6tnIk.js.map} +1 -1
  61. package/dist/{installation-inventory-DThnBEhV.js → installation-inventory-C5FsAvrf.js} +5 -5
  62. package/dist/{installation-inventory-DThnBEhV.js.map → installation-inventory-C5FsAvrf.js.map} +1 -1
  63. package/dist/{installer-D2bWZT88.js → installer-054NLJg6.js} +2 -2
  64. package/dist/{installer-D2bWZT88.js.map → installer-054NLJg6.js.map} +1 -1
  65. package/dist/io-DT66typ4.js +16 -0
  66. package/dist/io-DT66typ4.js.map +1 -0
  67. package/dist/{local-components-B6SCXZf9.js → local-components-DleLEzSU.js} +2 -1
  68. package/dist/local-components-DleLEzSU.js.map +1 -0
  69. package/dist/{lock-Bsl_ElWy.js → lock-iue1J2xy.js} +8 -5
  70. package/dist/lock-iue1J2xy.js.map +1 -0
  71. package/dist/{cli-space-api-CQtKu9Zt.js → meta-api-B1k3mwHN.js} +203 -19
  72. package/dist/meta-api-B1k3mwHN.js.map +1 -0
  73. package/dist/{openmeld-BQy0nMox.js → openmeld-BFO3sfC_.js} +93 -1027
  74. package/dist/openmeld-BFO3sfC_.js.map +1 -0
  75. package/dist/openmeld-dev.js +1 -1
  76. package/dist/{openmeld-environment-target-B6HqY0_a.js → openmeld-environment-target-BBn5Ko6p.js} +3 -3
  77. package/dist/{openmeld-environment-target-B6HqY0_a.js.map → openmeld-environment-target-BBn5Ko6p.js.map} +1 -1
  78. package/dist/{openmeld-maintenance-worker-BSODPHbn.js → openmeld-maintenance-worker-Ce4ehQ-c.js} +15 -14
  79. package/dist/openmeld-maintenance-worker-Ce4ehQ-c.js.map +1 -0
  80. package/dist/{openmeld-tools-update-join-BfY0GnDs.js → openmeld-tools-update-join-D24llJ9L.js} +4 -4
  81. package/dist/{openmeld-tools-update-join-BfY0GnDs.js.map → openmeld-tools-update-join-D24llJ9L.js.map} +1 -1
  82. package/dist/{openmeld-tools-update-process-frame-B-XB4dmO.js → openmeld-tools-update-process-frame-BtFKp70p.js} +2 -2
  83. package/dist/{openmeld-tools-update-process-frame-B-XB4dmO.js.map → openmeld-tools-update-process-frame-BtFKp70p.js.map} +1 -1
  84. package/dist/{openmeld-tools-update-process-frame-j-RXwFsK.js → openmeld-tools-update-process-frame-DbEZ3fEh.js} +1 -1
  85. package/dist/openmeld.js +9 -5
  86. package/dist/openmeld.js.map +1 -1
  87. package/dist/{prepare-provider-runtime-CWZcuMF6.js → prepare-provider-runtime-MB-BxOgt.js} +3342 -1327
  88. package/dist/prepare-provider-runtime-MB-BxOgt.js.map +1 -0
  89. package/dist/{prepare-session-executor-CkDxstsf.js → prepare-session-executor-zvSZ6jqy.js} +29 -28
  90. package/dist/prepare-session-executor-zvSZ6jqy.js.map +1 -0
  91. package/dist/{presenter-BcxiQyJg.js → presenter-MJ5YgsOT.js} +3 -13
  92. package/dist/presenter-MJ5YgsOT.js.map +1 -0
  93. package/dist/{process-channel-BQwtOlRc.js → process-channel-CgbduFCz.js} +2 -2
  94. package/dist/{process-channel-BQwtOlRc.js.map → process-channel-CgbduFCz.js.map} +1 -1
  95. package/dist/process-environment-BWSFeUu6.js +49 -0
  96. package/dist/process-environment-BWSFeUu6.js.map +1 -0
  97. package/dist/process-identity-BQLdaZdB.js +190 -0
  98. package/dist/process-identity-BQLdaZdB.js.map +1 -0
  99. package/dist/process-launch-B0pHlkV_.js +173 -0
  100. package/dist/process-launch-B0pHlkV_.js.map +1 -0
  101. package/dist/{published-production-safety-dp-fOmmB.js → published-production-safety-C40hKrBA.js} +2 -2
  102. package/dist/{published-production-safety-dp-fOmmB.js.map → published-production-safety-C40hKrBA.js.map} +1 -1
  103. package/dist/{runtime-BYaFkkLK.js → runtime-D6jItuQ-.js} +155 -702
  104. package/dist/runtime-D6jItuQ-.js.map +1 -0
  105. package/dist/{runtime-agent-controller-reporting-submission-BUUub9_1.js → runtime-agent-controller-reporting-submission-D9ysbi7R.js} +9 -9
  106. package/dist/{runtime-agent-controller-reporting-submission-BUUub9_1.js.map → runtime-agent-controller-reporting-submission-D9ysbi7R.js.map} +1 -1
  107. package/dist/{runtime-reporting-health-state-BgwfrH7f.js → runtime-reporting-health-state-DA-_vW-n.js} +2210 -60
  108. package/dist/runtime-reporting-health-state-DA-_vW-n.js.map +1 -0
  109. package/dist/{runtime-transport-Cc_RN-PL.js → runtime-transport-YIYHSJPn.js} +99 -14
  110. package/dist/runtime-transport-YIYHSJPn.js.map +1 -0
  111. package/dist/{service-CfO38_a-.js → service-Dz2MsvGr.js} +126 -550
  112. package/dist/service-Dz2MsvGr.js.map +1 -0
  113. package/dist/{service-account-admission-Dy2W3n3_.js → service-account-admission-BfdJ-kKR.js} +18 -10
  114. package/dist/service-account-admission-BfdJ-kKR.js.map +1 -0
  115. package/dist/{service-account-authorization-DKpIpxXo.js → service-account-authorization-DZbUOD29.js} +6 -6
  116. package/dist/{service-account-authorization-DKpIpxXo.js.map → service-account-authorization-DZbUOD29.js.map} +1 -1
  117. package/dist/{service-account-control-CCPQAZzn.js → service-account-control-DCMOKXDT.js} +16 -16
  118. package/dist/service-account-control-DCMOKXDT.js.map +1 -0
  119. package/dist/{service-control-capabilities-C9UHSMPz.js → service-control-capabilities-3_bdeHXu.js} +1 -1
  120. package/dist/{service-control-capabilities-xGylBNoH.js → service-control-capabilities-Bb738e_d.js} +19 -15
  121. package/dist/service-control-capabilities-Bb738e_d.js.map +1 -0
  122. package/dist/{service-control-carrier-capability-DDNyE5cB.js → service-control-carrier-capability-gMk5gMKU.js} +11 -4
  123. package/dist/service-control-carrier-capability-gMk5gMKU.js.map +1 -0
  124. package/dist/{state-CQG3k9eh.js → state-GxF_KAM1.js} +4 -4
  125. package/dist/{state-CQG3k9eh.js.map → state-GxF_KAM1.js.map} +1 -1
  126. package/dist/{upgrade-D5FxGbh1.js → upgrade-DfJwCD5H.js} +52 -32
  127. package/dist/upgrade-DfJwCD5H.js.map +1 -0
  128. package/dist/upgrade-DgmYWeNu.js +4 -0
  129. package/dist/windows/openmeld-windows-process.exe +0 -0
  130. package/dist/windows-artifact-DJ9DKjfc.js +16 -0
  131. package/dist/windows-artifact-DJ9DKjfc.js.map +1 -0
  132. package/dist/windows-task-command-COu_6Ke3.js +74 -0
  133. package/dist/windows-task-command-COu_6Ke3.js.map +1 -0
  134. package/dist/windows-task-entry-CtRpUbiK.js +50 -0
  135. package/dist/windows-task-entry-CtRpUbiK.js.map +1 -0
  136. package/dist/{windows-user-task-Bx2yYnOM.js → windows-user-task-B8NcRg_u.js} +1 -1
  137. package/dist/{windows-user-task-CRGbKggi.js → windows-user-task-Io5QuEVR.js} +108 -51
  138. package/dist/windows-user-task-Io5QuEVR.js.map +1 -0
  139. package/package.json +12 -12
  140. package/skills/openmeld-cli/playbooks/space-ops.md +9 -3
  141. package/skills/openmeld-cli/references/commands.md +0 -1
  142. package/dist/auth-session-D8dbMpaK.js +0 -4
  143. package/dist/auth-session-nhS8jyux.js.map +0 -1
  144. package/dist/cli-binary-manifest-DiUulkp0.js.map +0 -1
  145. package/dist/cli-space-api-CQtKu9Zt.js.map +0 -1
  146. package/dist/command-Bz9x7V2T.js.map +0 -1
  147. package/dist/context-l_31Mn4X.js +0 -473
  148. package/dist/context-l_31Mn4X.js.map +0 -1
  149. package/dist/daemon-device-id-DWO9_QW6.js.map +0 -1
  150. package/dist/daemon-frame-transport-D2-tazuK.js.map +0 -1
  151. package/dist/daemon-lifecycle-journal-DyKx1xzm.js.map +0 -1
  152. package/dist/daemon-service-manager-HL4VKbIU.js.map +0 -1
  153. package/dist/daemon-service-runtime-bKt0YjC7.js.map +0 -1
  154. package/dist/daemon-service-update-coordinator-D8O1uTtu.js.map +0 -1
  155. package/dist/dist-B07ziN_u.js.map +0 -1
  156. package/dist/dist-B2EauBG6.js.map +0 -1
  157. package/dist/dist-DhWI1iyi.js +0 -4
  158. package/dist/local-components-B6SCXZf9.js.map +0 -1
  159. package/dist/lock-Bsl_ElWy.js.map +0 -1
  160. package/dist/openmeld-BQy0nMox.js.map +0 -1
  161. package/dist/openmeld-maintenance-worker-BSODPHbn.js.map +0 -1
  162. package/dist/prepare-provider-runtime-CWZcuMF6.js.map +0 -1
  163. package/dist/prepare-session-executor-CkDxstsf.js.map +0 -1
  164. package/dist/presenter-BcxiQyJg.js.map +0 -1
  165. package/dist/process-identity-CNus0e6E.js +0 -146
  166. package/dist/process-identity-CNus0e6E.js.map +0 -1
  167. package/dist/runtime-BYaFkkLK.js.map +0 -1
  168. package/dist/runtime-reporting-health-state-BgwfrH7f.js.map +0 -1
  169. package/dist/runtime-transport-Cc_RN-PL.js.map +0 -1
  170. package/dist/service-CfO38_a-.js.map +0 -1
  171. package/dist/service-account-admission-Dy2W3n3_.js.map +0 -1
  172. package/dist/service-account-control-CCPQAZzn.js.map +0 -1
  173. package/dist/service-control-capabilities-xGylBNoH.js.map +0 -1
  174. package/dist/service-control-carrier-capability-DDNyE5cB.js.map +0 -1
  175. package/dist/upgrade-D5FxGbh1.js.map +0 -1
  176. package/dist/upgrade-DhFEu0k6.js +0 -4
  177. package/dist/windows-user-task-CRGbKggi.js.map +0 -1
@@ -1,19 +1,19 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { t as isLoopbackHostname } from "./loopback-hostname-DHQPKq8N.js";
4
- import { A as OPENMELD_HOME_ENV_KEY, gt as systemDir, q as normalizeAccountKey } from "./lock-Bsl_ElWy.js";
4
+ import { A as OPENMELD_HOME_ENV_KEY, _ as resolveCliContext, _t as systemDir, g as readCliContextState, h as listCliContextStates, pt as runtimeDir, q as normalizeAccountKey, tt as openMeldRootDir, y as writeCliContextState } from "./lock-iue1J2xy.js";
5
5
  import { n as runtimeAgentControllerConversationIdMappingSpecSchema, o as runtimeStreamingModeSchema, r as runtimeAgentControllerLaunchContractSchema, s as runtimeTransportModeSchema, u as conversationPolicySchema } from "./controller-contract-DAOCaefz.js";
6
- import { $r as ADDITIONAL_HUMAN_PROFILE_CREATION_DISABLED_MESSAGE, Qr as ADDITIONAL_HUMAN_PROFILE_CREATION_DISABLED_CODE, ii as profileErrorResponseSchema, ri as profileCapabilitiesResponseSchema, t as CURRENT_DAEMON_EXECUTION_CONTRACT_EPOCH, ti as authProfileManagedRoleSchema } from "./runtime-transport-Cc_RN-PL.js";
7
- import { $ as RUNTIME_AGENT_CONTROLLER_REPORT_SYNC_RETRY_INTERVAL_MS$1, B as DEFAULT_HEARTBEAT_INTERVAL_MS$1, F as DAEMON_RUNTIME_CONTRACT_EPOCH$1, G as MIN_HEARTBEAT_INTERVAL_MS$1, H as HEARTBEAT_RESPONSE_TIMEOUT_MS$1, I as DAEMON_STREAM_CONNECT_TIMEOUT_MS$1, J as PROVIDER_CONVERSATION_PROOF_SYNC_INTERVAL_MS$1, L as DAEMON_STREAM_KEEPALIVE_INTERVAL_MS$1, N as CATALOG_SYNC_RETRY_INTERVAL_MS$1, P as CATALOG_SYNC_SIGNAL_POLL_INTERVAL_MS$1, Q as RUNTIME_AGENT_CONTROLLER_REPORT_SYNC_INTERVAL_MS$1, R as DAEMON_STREAM_KEEPALIVE_PONG_TIMEOUT_MS$1, U as MAX_HEARTBEAT_INTERVAL_MS$1, X as REGISTER_RESPONSE_TIMEOUT_MS$1, Y as PROVIDER_CONVERSATION_PROOF_SYNC_RETRY_INTERVAL_MS$1, d as getAuthSessionState, et as RUNTIME_STATE_PERSIST_MIN_INTERVAL_MS$1 } from "./auth-session-nhS8jyux.js";
8
- import { E as agentProfileIdSchema, b as skippedDaemonProfileSchema } from "./control-plane-e3W6PD2M.js";
6
+ import { ai as profileCapabilitiesResponseSchema, ei as ADDITIONAL_HUMAN_PROFILE_CREATION_DISABLED_CODE, oi as profileErrorResponseSchema, ri as authProfileManagedRoleSchema, t as CURRENT_DAEMON_EXECUTION_CONTRACT_EPOCH, ti as ADDITIONAL_HUMAN_PROFILE_CREATION_DISABLED_MESSAGE } from "./runtime-transport-YIYHSJPn.js";
7
+ import { $ as RUNTIME_AGENT_CONTROLLER_REPORT_SYNC_RETRY_INTERVAL_MS$1, B as DEFAULT_HEARTBEAT_INTERVAL_MS$1, F as DAEMON_RUNTIME_CONTRACT_EPOCH$1, G as MIN_HEARTBEAT_INTERVAL_MS$1, H as HEARTBEAT_RESPONSE_TIMEOUT_MS$1, I as DAEMON_STREAM_CONNECT_TIMEOUT_MS$1, J as PROVIDER_CONVERSATION_PROOF_SYNC_INTERVAL_MS$1, L as DAEMON_STREAM_KEEPALIVE_INTERVAL_MS$1, N as CATALOG_SYNC_RETRY_INTERVAL_MS$1, P as CATALOG_SYNC_SIGNAL_POLL_INTERVAL_MS$1, Q as RUNTIME_AGENT_CONTROLLER_REPORT_SYNC_INTERVAL_MS$1, R as DAEMON_STREAM_KEEPALIVE_PONG_TIMEOUT_MS$1, U as MAX_HEARTBEAT_INTERVAL_MS$1, X as REGISTER_RESPONSE_TIMEOUT_MS$1, Y as PROVIDER_CONVERSATION_PROOF_SYNC_RETRY_INTERVAL_MS$1, d as getAuthSessionState, et as RUNTIME_STATE_PERSIST_MIN_INTERVAL_MS$1 } from "./auth-session-uEk_Tx6T.js";
8
+ import { E as agentProfileIdSchema, b as skippedDaemonProfileSchema } from "./control-plane-rTE2rHZ5.js";
9
9
  import { r as daemonServiceLaneSchema } from "./service-contract-CRyDcIIf.js";
10
10
  import { n as agentControllerPermissionModeSchema, r as agentControllerCollaborationModeSchema, t as openCodePermissionConfigSchema } from "./open-code-permission-DHFJYc_o.js";
11
- import { h as daemonRuntimeRootPath, m as daemonRuntimeDataPath } from "./daemon-state-B44aq2nm.js";
11
+ import { h as daemonRuntimeRootPath, m as daemonRuntimeDataPath } from "./daemon-state-Ca0WK5x0.js";
12
12
  import { r as formatOpenMeldCliCommands, t as formatInlineOpenMeldCliCommands } from "./cli-entry-command-CR_9QU1i.js";
13
13
  import { n as toErrorMessage$1 } from "./dist-BLuEEVHh.js";
14
14
  import { createHash, randomUUID } from "node:crypto";
15
15
  import { join } from "node:path";
16
- import { mkdir, readFile, rename, rm, writeFile } from "node:fs/promises";
16
+ import { mkdir, readFile, readdir, rename, rm, stat, writeFile } from "node:fs/promises";
17
17
  import * as z$1 from "zod/v4";
18
18
  //#region ../../packages/schemas/dist/schemas/daemon/route-catalog-cache.js
19
19
  const DAEMON_ROUTE_CATALOG_CACHE_SCHEMA_NAME = "openmeld-daemon-route-catalog-cache-v4";
@@ -71,13 +71,13 @@ function resolveOpenMeldAccountContext(input) {
71
71
  key: normalizeAccountKey({}),
72
72
  source: "fallback"
73
73
  };
74
- const normalizedBaseUrl = normalizeOptionalString$2(session.authBaseUrl);
74
+ const normalizedBaseUrl = normalizeOptionalString$4(session.authBaseUrl);
75
75
  const hostKey = resolveHostKey(normalizedBaseUrl);
76
76
  const user = normalizeUser(session.user);
77
77
  const userKey = user?.id ?? user?.email ?? buildSessionScopedUserKey({
78
78
  authBaseUrl: normalizedBaseUrl,
79
- clientId: normalizeOptionalString$2(session.clientId),
80
- createdAt: normalizeOptionalString$2(session.createdAt)
79
+ clientId: normalizeOptionalString$4(session.clientId),
80
+ createdAt: normalizeOptionalString$4(session.createdAt)
81
81
  });
82
82
  return {
83
83
  key: normalizeAccountKey({
@@ -90,7 +90,7 @@ function resolveOpenMeldAccountContext(input) {
90
90
  };
91
91
  }
92
92
  async function resolveCurrentOpenMeldAccountContext() {
93
- const { getAuthSessionMetadata } = await import("./auth-session-D8dbMpaK.js");
93
+ const { getAuthSessionMetadata } = await import("./auth-session-BJfKu74u.js");
94
94
  return resolveOpenMeldAccountContext({ session: await getAuthSessionMetadata().catch(() => null) });
95
95
  }
96
96
  function resolveHostKey(baseUrl) {
@@ -113,9 +113,9 @@ function buildSessionScopedUserKey(input) {
113
113
  function normalizeUser(value) {
114
114
  if (!(value && typeof value === "object")) return null;
115
115
  const record = value;
116
- const id = normalizeOptionalString$2(record.id);
117
- const email = normalizeOptionalString$2(record.email);
118
- const name = normalizeOptionalString$2(record.name);
116
+ const id = normalizeOptionalString$4(record.id);
117
+ const email = normalizeOptionalString$4(record.email);
118
+ const name = normalizeOptionalString$4(record.name);
119
119
  if (!(id || email || name)) return null;
120
120
  return {
121
121
  ...id ? { id } : {},
@@ -123,7 +123,7 @@ function normalizeUser(value) {
123
123
  ...name ? { name } : {}
124
124
  };
125
125
  }
126
- function normalizeOptionalString$2(value) {
126
+ function normalizeOptionalString$4(value) {
127
127
  if (typeof value !== "string") return null;
128
128
  const normalized = value.trim();
129
129
  return normalized.length > 0 ? normalized : null;
@@ -146,9 +146,9 @@ function createAuthenticationError(input) {
146
146
  return new OpenMeldAuthenticationError(resolveAuthenticationGuidance(input));
147
147
  }
148
148
  function resolveAuthenticationGuidance(input) {
149
- const action = normalizeOptionalString$1(input.action);
150
- const authBaseUrl = normalizeOptionalString$1(input.authBaseUrl);
151
- const gatewayUrl = normalizeOptionalString$1(input.gatewayUrl);
149
+ const action = normalizeOptionalString$3(input.action);
150
+ const authBaseUrl = normalizeOptionalString$3(input.authBaseUrl);
151
+ const gatewayUrl = normalizeOptionalString$3(input.gatewayUrl);
152
152
  if (input.reason === "mismatch") return {
153
153
  reason: input.reason,
154
154
  action,
@@ -172,7 +172,7 @@ function resolveAuthenticationGuidance(input) {
172
172
  };
173
173
  }
174
174
  function buildCommandAuthenticationPromptMessage(action) {
175
- const normalizedAction = normalizeOptionalString$1(action);
175
+ const normalizedAction = normalizeOptionalString$3(action);
176
176
  if (!normalizedAction) return "Sign in is required to continue. What do you want to do?";
177
177
  return `Sign in is required before ${normalizedAction}. What do you want to do?`;
178
178
  }
@@ -259,7 +259,7 @@ function resolveAuthenticationGuidanceFromMessage(message) {
259
259
  function extractAuthenticationPromptAction(promptMessage) {
260
260
  const normalizedMessage = String(promptMessage ?? "").trim();
261
261
  if (normalizedMessage.length === 0) return null;
262
- return normalizeOptionalString$1(AUTH_PROMPT_ACTION_RE.exec(normalizedMessage)?.groups?.action);
262
+ return normalizeOptionalString$3(AUTH_PROMPT_ACTION_RE.exec(normalizedMessage)?.groups?.action);
263
263
  }
264
264
  function resolveRequiredAuthenticationGuidance(reason) {
265
265
  switch (reason) {
@@ -339,10 +339,220 @@ function buildAgentAuthenticationNotes(guidance) {
339
339
  if (guidance.gatewayUrl) notes.push(`Current gateway: ${guidance.gatewayUrl}`);
340
340
  return notes;
341
341
  }
342
- function normalizeOptionalString$1(value) {
342
+ function normalizeOptionalString$3(value) {
343
+ const normalized = String(value ?? "").trim();
344
+ return normalized.length > 0 ? normalized : null;
345
+ }
346
+ //#endregion
347
+ //#region src/config/openmeld-profile-selection.ts
348
+ const SESSION_FILE_HASH_LENGTH = 8;
349
+ const SESSION_FILE_MAX_LENGTH = 128;
350
+ const FALLBACK_SELECTION_SESSION_ID = "global-default";
351
+ const FALLBACK_SELECTION_SOURCE = "fallback:no_runtime_session";
352
+ async function setSelectedOpenMeldProfileId(openMeldProfileId) {
353
+ const normalized = normalizeRequiredString(openMeldProfileId, "openMeldProfileId");
354
+ await rm(legacySelectionPath(), { force: true }).catch(() => void 0);
355
+ const cliContext = resolveCliContext();
356
+ if (!cliContext) {
357
+ await writeFallbackSelectionPayload(normalized);
358
+ return {
359
+ persistent: true,
360
+ cliContextSource: FALLBACK_SELECTION_SOURCE
361
+ };
362
+ }
363
+ await writeCliContextState({ selectedOpenMeldProfileId: normalized });
364
+ await rm(selectionPath(cliContext.cliContextId), { force: true }).catch(() => void 0);
365
+ return {
366
+ persistent: true,
367
+ cliContextSource: cliContext.source
368
+ };
369
+ }
370
+ async function getSelectedOpenMeldProfileId() {
371
+ const cliContext = resolveCliContext();
372
+ if (!cliContext) return await readFallbackSelectionPayload();
373
+ const sessionState = await readCliContextState();
374
+ if (sessionState?.selectedOpenMeldProfileId) return sessionState.selectedOpenMeldProfileId;
375
+ const legacySelection = await readLegacySelectionPayload(cliContext.cliContextId);
376
+ if (!legacySelection?.openMeldProfileId) return null;
377
+ await writeCliContextState({
378
+ sessionId: legacySelection.sessionId,
379
+ sessionSource: legacySelection.sessionSource,
380
+ openMeldProfileId: legacySelection.openMeldProfileId
381
+ });
382
+ await rm(selectionPath(cliContext.cliContextId), { force: true }).catch(() => void 0);
383
+ return legacySelection.openMeldProfileId;
384
+ }
385
+ async function clearSelectedOpenMeldProfileId() {
386
+ const cliContext = resolveCliContext();
387
+ if (!cliContext) {
388
+ await rm(fallbackSelectionPath(), { force: true }).catch(() => void 0);
389
+ await rm(legacySelectionPath(), { force: true }).catch(() => void 0);
390
+ return;
391
+ }
392
+ await writeCliContextState({ selectedOpenMeldProfileId: null });
393
+ await rm(selectionPath(cliContext.cliContextId), { force: true });
394
+ await rm(legacySelectionPath(), { force: true }).catch(() => void 0);
395
+ }
396
+ async function clearAllSelectedOpenMeldProfileIds() {
397
+ const sessionStates = await listCliContextStates();
398
+ let clearedSessionSelections = 0;
399
+ const failedSessionIds = [];
400
+ for (const sessionState of sessionStates) {
401
+ if (!sessionState.selectedOpenMeldProfileId) continue;
402
+ try {
403
+ if (await writeCliContextState({
404
+ sessionId: sessionState.sessionId,
405
+ sessionSource: sessionState.cliContextSource,
406
+ selectedOpenMeldProfileId: null
407
+ })) {
408
+ clearedSessionSelections += 1;
409
+ continue;
410
+ }
411
+ } catch {}
412
+ failedSessionIds.push(sessionState.sessionId);
413
+ }
414
+ const removedFallbackSelection = await removeFileIfPresent(fallbackSelectionPath());
415
+ const removedLegacySelectionFile = await removeFileIfPresent(legacySelectionPath());
416
+ const removedLegacySessionSelectionDirectory = await removeDirectoryIfPresent(sessionSelectionDir());
417
+ return {
418
+ clearedSessionSelections,
419
+ failedSessionIds,
420
+ removedFallbackSelection,
421
+ removedLegacySelectionFile,
422
+ removedLegacySessionSelectionDirectory
423
+ };
424
+ }
425
+ async function alignSelectedOpenMeldProfileStorage() {
426
+ let migratedSessionSelections = 0;
427
+ const entryNames = await readdir(sessionSelectionDir()).catch(() => []);
428
+ for (const entryName of entryNames) {
429
+ if (!entryName.endsWith(".selected-profile.json")) continue;
430
+ const raw = await readFile(join(sessionSelectionDir(), entryName), "utf8").catch(() => null);
431
+ if (!raw) continue;
432
+ const parsed = parseLegacySelectionPayload(raw);
433
+ if (!parsed) continue;
434
+ if (await writeCliContextState({
435
+ sessionId: parsed.sessionId,
436
+ sessionSource: parsed.sessionSource,
437
+ selectedOpenMeldProfileId: parsed.openMeldProfileId
438
+ })) migratedSessionSelections += 1;
439
+ }
440
+ const legacyDirectoryExists = entryNames.length > 0;
441
+ if (legacyDirectoryExists) await rm(sessionSelectionDir(), {
442
+ recursive: true,
443
+ force: true
444
+ });
445
+ await migrateLegacyFallbackSelection();
446
+ const removedLegacySelectionFile = await removeLegacySelectionFile();
447
+ return {
448
+ migratedSessionSelections,
449
+ removedLegacyDirectory: legacyDirectoryExists,
450
+ removedLegacySelectionFile
451
+ };
452
+ }
453
+ function selectionPath(sessionId) {
454
+ return join(sessionSelectionDir(), `${toSafeSessionFile(sessionId)}.selected-profile.json`);
455
+ }
456
+ function sessionSelectionDir() {
457
+ return join(runtimeDir(), "selected-openmeld-profiles");
458
+ }
459
+ function legacySelectionPath() {
460
+ return join(openMeldRootDir(), "auth", "selected-profile.json");
461
+ }
462
+ function fallbackSelectionPath() {
463
+ return join(runtimeDir(), "selected-profile-fallback.json");
464
+ }
465
+ async function readLegacySelectionPayload(sessionId) {
466
+ const raw = await readFile(selectionPath(sessionId), "utf8").catch(() => null);
467
+ if (!raw) return null;
468
+ return parseLegacySelectionPayload(raw);
469
+ }
470
+ async function readFallbackSelectionPayload() {
471
+ const raw = await readFile(fallbackSelectionPath(), "utf8").catch(() => null);
472
+ if (!raw) {
473
+ const legacyFallback = await readLegacyFallbackSelection();
474
+ if (!legacyFallback) return null;
475
+ await writeFallbackSelectionPayload(legacyFallback.openMeldProfileId);
476
+ await rm(legacySelectionPath(), { force: true }).catch(() => void 0);
477
+ return legacyFallback.openMeldProfileId;
478
+ }
479
+ return parseLegacySelectionPayload(raw)?.openMeldProfileId ?? null;
480
+ }
481
+ async function writeFallbackSelectionPayload(openMeldProfileId) {
482
+ await mkdir(runtimeDir(), { recursive: true });
483
+ const payload = {
484
+ v: 1,
485
+ sessionId: FALLBACK_SELECTION_SESSION_ID,
486
+ sessionSource: FALLBACK_SELECTION_SOURCE,
487
+ openMeldProfileId,
488
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
489
+ };
490
+ await writeFile(fallbackSelectionPath(), `${JSON.stringify(payload, null, 2)}\n`, "utf8");
491
+ }
492
+ function parseLegacySelectionPayload(raw) {
493
+ try {
494
+ const payload = JSON.parse(raw);
495
+ if (payload.v !== 1) return null;
496
+ const sessionId = normalizeOptionalString$2(payload.sessionId);
497
+ const openMeldProfileId = normalizeOptionalString$2(payload.openMeldProfileId);
498
+ if (!(sessionId && openMeldProfileId)) return null;
499
+ return {
500
+ v: 1,
501
+ sessionId,
502
+ sessionSource: normalizeOptionalString$2(payload.sessionSource) ?? "manual",
503
+ openMeldProfileId,
504
+ updatedAt: normalizeOptionalString$2(payload.updatedAt) ?? (/* @__PURE__ */ new Date(0)).toISOString()
505
+ };
506
+ } catch {
507
+ return null;
508
+ }
509
+ }
510
+ async function readLegacyFallbackSelection() {
511
+ const raw = await readFile(legacySelectionPath(), "utf8").catch(() => null);
512
+ if (!raw) return null;
513
+ const parsed = parseLegacySelectionPayload(raw);
514
+ if (parsed?.sessionSource !== FALLBACK_SELECTION_SOURCE) return null;
515
+ return parsed;
516
+ }
517
+ async function migrateLegacyFallbackSelection() {
518
+ const legacyFallback = await readLegacyFallbackSelection();
519
+ if (!legacyFallback) return;
520
+ if (!await readFile(fallbackSelectionPath(), "utf8").catch(() => null)) await writeFallbackSelectionPayload(legacyFallback.openMeldProfileId);
521
+ }
522
+ async function removeLegacySelectionFile() {
523
+ if (!await readFile(legacySelectionPath(), "utf8").catch(() => null)) return false;
524
+ await rm(legacySelectionPath(), { force: true }).catch(() => void 0);
525
+ return true;
526
+ }
527
+ function toSafeSessionFile(value) {
528
+ const hash = createHash("sha1").update(value, "utf8").digest("hex").slice(0, SESSION_FILE_HASH_LENGTH);
529
+ const safeBaseRaw = value.replace(/[^a-zA-Z0-9._-]+/g, "_");
530
+ const safeBase = safeBaseRaw.length > 0 ? safeBaseRaw : "session";
531
+ const maxBaseLength = Math.max(1, SESSION_FILE_MAX_LENGTH - SESSION_FILE_HASH_LENGTH - 1);
532
+ return `${safeBase.slice(0, maxBaseLength)}-${hash}`;
533
+ }
534
+ function normalizeOptionalString$2(value) {
343
535
  const normalized = String(value ?? "").trim();
344
536
  return normalized.length > 0 ? normalized : null;
345
537
  }
538
+ function normalizeRequiredString(value, field) {
539
+ const normalized = normalizeOptionalString$2(value);
540
+ if (!normalized) throw new Error(`${field} is required`);
541
+ return normalized;
542
+ }
543
+ async function removeFileIfPresent(path) {
544
+ if (await readFile(path, "utf8").catch(() => null) === null) return false;
545
+ await rm(path, { force: true }).catch(() => void 0);
546
+ return true;
547
+ }
548
+ async function removeDirectoryIfPresent(path) {
549
+ if (!(await stat(path).catch(() => null))?.isDirectory()) return false;
550
+ await rm(path, {
551
+ recursive: true,
552
+ force: true
553
+ }).catch(() => void 0);
554
+ return true;
555
+ }
346
556
  //#endregion
347
557
  //#region src/local-service/state/catalog-sync-signal.ts
348
558
  const CATALOG_SYNC_SIGNAL_FILE = "catalog-sync-signal.json";
@@ -432,7 +642,7 @@ var AuthProfilesApiError = class extends Error {
432
642
  this.name = "AuthProfilesApiError";
433
643
  this.status = input.status;
434
644
  this.endpoint = input.endpoint;
435
- this.code = normalizeOptionalString(input.code);
645
+ this.code = normalizeOptionalString$1(input.code);
436
646
  }
437
647
  };
438
648
  function isAuthProfilesApiError(error) {
@@ -458,13 +668,13 @@ async function resolveOpenMeldProfile(input) {
458
668
  method: "POST",
459
669
  path: "/v1/profiles/resolve",
460
670
  body: {
461
- ...normalizeOptionalString(input.openMeldProfileId) ? { openMeldProfileId: normalizeOptionalString(input.openMeldProfileId) } : {},
671
+ ...normalizeOptionalString$1(input.openMeldProfileId) ? { openMeldProfileId: normalizeOptionalString$1(input.openMeldProfileId) } : {},
462
672
  ...input.profileKind ? { profileKind: input.profileKind } : {}
463
673
  }
464
674
  }), "profile"));
465
675
  }
466
676
  async function resolveOpenMeldProfileByIdOrName(input) {
467
- const profileIdentifier = normalizeOptionalString(input.profileIdentifier);
677
+ const profileIdentifier = normalizeOptionalString$1(input.profileIdentifier);
468
678
  if (!profileIdentifier) throw new Error("profile identifier is required");
469
679
  try {
470
680
  return await resolveOpenMeldProfile({
@@ -483,8 +693,8 @@ async function resolveOpenMeldProfileByIdOrName(input) {
483
693
  }
484
694
  }
485
695
  function createOpenMeldAgentProfile(input) {
486
- const profileName = normalizeOptionalString(input.profileName);
487
- const creatorProfileId = normalizeOptionalString(input.creatorProfileId) ?? void 0;
696
+ const profileName = normalizeOptionalString$1(input.profileName);
697
+ const creatorProfileId = normalizeOptionalString$1(input.creatorProfileId) ?? void 0;
488
698
  if (!profileName) throw new Error("profile name is required");
489
699
  return createOpenMeldAgentProfileRequest({
490
700
  profileName,
@@ -492,8 +702,8 @@ function createOpenMeldAgentProfile(input) {
492
702
  });
493
703
  }
494
704
  async function createOpenMeldHumanProfile(input) {
495
- const profileName = normalizeOptionalString(input.profileName);
496
- const creatorProfileId = normalizeOptionalString(input.creatorProfileId) ?? void 0;
705
+ const profileName = normalizeOptionalString$1(input.profileName);
706
+ const creatorProfileId = normalizeOptionalString$1(input.creatorProfileId) ?? void 0;
497
707
  if (!profileName) throw new Error("profile name is required");
498
708
  try {
499
709
  assertAdditionalHumanProfileCreationEnabled(await getOpenMeldProfileCapabilities());
@@ -516,9 +726,9 @@ async function createOpenMeldHumanProfile(input) {
516
726
  return created;
517
727
  }
518
728
  async function updateOpenMeldProfile(input) {
519
- const openMeldProfileId = normalizeOptionalString(input.openMeldProfileId);
729
+ const openMeldProfileId = normalizeOptionalString$1(input.openMeldProfileId);
520
730
  if (!openMeldProfileId) throw new Error("openMeldProfileId is required");
521
- const profileName = normalizeOptionalString(input.profileName);
731
+ const profileName = normalizeOptionalString$1(input.profileName);
522
732
  if (!Boolean(profileName)) throw new Error("profileName is required");
523
733
  const updated = parseOpenMeldProfileItem(readRecordField(await requestOpenMeldProfilesApi({
524
734
  method: "PATCH",
@@ -529,7 +739,7 @@ async function updateOpenMeldProfile(input) {
529
739
  return updated;
530
740
  }
531
741
  async function deleteOpenMeldProfile(input) {
532
- const openMeldProfileId = normalizeOptionalString(input.openMeldProfileId);
742
+ const openMeldProfileId = normalizeOptionalString$1(input.openMeldProfileId);
533
743
  if (!openMeldProfileId) throw new Error("openMeldProfileId is required");
534
744
  const deleted = parseOpenMeldProfileItem(readRecordField(await requestOpenMeldProfilesApi({
535
745
  method: "DELETE",
@@ -716,12 +926,12 @@ function readArrayField(input, field) {
716
926
  return value.filter(isRecord);
717
927
  }
718
928
  function readRequiredStringField(input, field) {
719
- const value = normalizeOptionalString(input[field]);
929
+ const value = normalizeOptionalString$1(input[field]);
720
930
  if (!value) throw new Error(`invalid profile payload: missing ${field}`);
721
931
  return value;
722
932
  }
723
933
  function readOptionalStringField(input, field) {
724
- return normalizeOptionalString(input[field]);
934
+ return normalizeOptionalString$1(input[field]);
725
935
  }
726
936
  function readBooleanField(input, field) {
727
937
  return input[field] === true;
@@ -731,7 +941,7 @@ function readOptionalBooleanField(input, field) {
731
941
  if (typeof value === "boolean") return value;
732
942
  return null;
733
943
  }
734
- function normalizeOptionalString(value) {
944
+ function normalizeOptionalString$1(value) {
735
945
  const normalized = String(value ?? "").trim();
736
946
  return normalized.length > 0 ? normalized : null;
737
947
  }
@@ -757,7 +967,7 @@ async function parseResponseJson(response) {
757
967
  }
758
968
  function extractApiErrorMessage(payload, status) {
759
969
  const record = isRecord(payload) ? payload : {};
760
- const message = normalizeOptionalString(record.message) ?? normalizeOptionalString(record.error_description) ?? normalizeOptionalString(record.error);
970
+ const message = normalizeOptionalString$1(record.message) ?? normalizeOptionalString$1(record.error_description) ?? normalizeOptionalString$1(record.error);
761
971
  if (message) return message;
762
972
  return `request failed with status ${status}`;
763
973
  }
@@ -798,6 +1008,104 @@ function isRecord(value) {
798
1008
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
799
1009
  }
800
1010
  //#endregion
1011
+ //#region src/config/resolve-openmeld-profile.ts
1012
+ const PROFILE_REQUIRED_ERROR_ROOT = "no OpenMeld profile is selected for this terminal session yet";
1013
+ const PROFILE_REQUIRED_ERROR_MESSAGE = `${PROFILE_REQUIRED_ERROR_ROOT}; run \`openmeld start\` to choose one, or pass \`--profile <id>\`.`;
1014
+ const SERVICE_TRACE_PROFILE_REQUIRED_ERROR_MESSAGE = `${PROFILE_REQUIRED_ERROR_ROOT}; dispatch trace needs an acting profile. Run \`openmeld profile set <profile-id>\` once, or pass \`--profile <profile-id>\` with this trace command. \`--target-profile\` only identifies the agent being traced.`;
1015
+ const PROFILE_REQUIRED_ERROR_PREFIX = "no OpenMeld profile is selected for this terminal session yet; run `";
1016
+ const PROFILE_REQUIRED_ERROR_SUFFIX = " start` to choose one, or pass `--profile <id>`.";
1017
+ function isSelectedOpenMeldProfileRequiredError(error) {
1018
+ if (!(error instanceof Error)) return false;
1019
+ if (error.message === PROFILE_REQUIRED_ERROR_MESSAGE) return true;
1020
+ if (error.message.includes(PROFILE_REQUIRED_ERROR_ROOT) && error.message.includes("--profile <")) return true;
1021
+ return error.message.startsWith(PROFILE_REQUIRED_ERROR_PREFIX) && error.message.endsWith(PROFILE_REQUIRED_ERROR_SUFFIX);
1022
+ }
1023
+ async function resolveOpenMeldProfileOrNull(input = {}) {
1024
+ const explicitOpenMeldProfileId = normalizeOptionalString(input.openMeldProfileId);
1025
+ if (explicitOpenMeldProfileId) return await resolveExplicitOpenMeldProfile(explicitOpenMeldProfileId, {
1026
+ profileKind: input.profileKind,
1027
+ allowUnauthenticated: input.allowUnauthenticated === true,
1028
+ persistSelection: input.persistSelection !== false
1029
+ });
1030
+ const selectedOpenMeldProfileId = await getSelectedOpenMeldProfileId();
1031
+ if (selectedOpenMeldProfileId) {
1032
+ const selectedProfile = await resolveSelectedOpenMeldProfile(selectedOpenMeldProfileId, {
1033
+ profileKind: input.profileKind,
1034
+ allowUnauthenticated: input.allowUnauthenticated === true
1035
+ });
1036
+ if (selectedProfile) return selectedProfile;
1037
+ }
1038
+ if (input.allowUnauthenticated === true) {
1039
+ if ((await getAuthSessionState({ validateRemote: false })).state !== "valid") return null;
1040
+ }
1041
+ if (input.allowDefaultFallback !== true) return null;
1042
+ let fallbackProfile;
1043
+ try {
1044
+ fallbackProfile = await resolveOpenMeldProfile({ profileKind: input.profileKind });
1045
+ } catch (error) {
1046
+ if (input.allowUnauthenticated === true && isAuthRequiredError(error)) return null;
1047
+ throw error;
1048
+ }
1049
+ if (input.persistSelection !== false) await setSelectedOpenMeldProfileId(fallbackProfile.openMeldProfileId);
1050
+ return fallbackProfile;
1051
+ }
1052
+ async function resolveExplicitOpenMeldProfile(openMeldProfileId, input) {
1053
+ try {
1054
+ const profile = await resolveOpenMeldProfileByIdOrName({
1055
+ profileIdentifier: openMeldProfileId,
1056
+ profileKind: input.profileKind
1057
+ });
1058
+ if (input.persistSelection) await setSelectedOpenMeldProfileId(profile.openMeldProfileId);
1059
+ return profile;
1060
+ } catch (error) {
1061
+ if (isAuthRequiredError(error) && input.allowUnauthenticated) return null;
1062
+ throw error;
1063
+ }
1064
+ }
1065
+ async function requireOpenMeldProfile(input = {}) {
1066
+ const profile = await resolveOpenMeldProfileOrNull(input);
1067
+ if (profile) return profile;
1068
+ const authState = await getAuthSessionState({ validateRemote: false });
1069
+ if (authState.state === "valid") throw new Error(formatInlineOpenMeldCliCommands(resolveProfileRequiredErrorMessage(input.authAction)));
1070
+ throw createAuthenticationError({
1071
+ reason: resolveAuthenticationReasonFromState(authState.state) ?? "required",
1072
+ action: input.authAction
1073
+ });
1074
+ }
1075
+ function resolveProfileRequiredErrorMessage(authAction) {
1076
+ if (authAction === "reading a dispatch trace") return SERVICE_TRACE_PROFILE_REQUIRED_ERROR_MESSAGE;
1077
+ return PROFILE_REQUIRED_ERROR_MESSAGE;
1078
+ }
1079
+ async function resolveSelectedOpenMeldProfile(selectedOpenMeldProfileId, input) {
1080
+ try {
1081
+ return await resolveOpenMeldProfile({
1082
+ openMeldProfileId: selectedOpenMeldProfileId,
1083
+ profileKind: input.profileKind
1084
+ });
1085
+ } catch (error) {
1086
+ if (isAuthRequiredError(error)) {
1087
+ if (input.allowUnauthenticated) return null;
1088
+ throw error;
1089
+ }
1090
+ if (isProfileMissingError(error)) {
1091
+ await clearSelectedOpenMeldProfileId();
1092
+ return null;
1093
+ }
1094
+ throw error;
1095
+ }
1096
+ }
1097
+ function normalizeOptionalString(value) {
1098
+ const normalized = String(value ?? "").trim();
1099
+ return normalized.length > 0 ? normalized : null;
1100
+ }
1101
+ function isAuthRequiredError(error) {
1102
+ return resolveAuthenticationGuidanceFromError(error) !== null;
1103
+ }
1104
+ function isProfileMissingError(error) {
1105
+ if ((error && typeof error === "object" && "code" in error ? String(error.code ?? "") : "") === "profile.not_found") return true;
1106
+ return (error instanceof Error ? error.message : String(error ?? "")).includes("profile not found");
1107
+ }
1108
+ //#endregion
801
1109
  //#region src/local-service/core/constants.ts
802
1110
  const CATALOG_SYNC_RETRY_INTERVAL_MS = CATALOG_SYNC_RETRY_INTERVAL_MS$1;
803
1111
  const CATALOG_SYNC_SIGNAL_POLL_INTERVAL_MS = CATALOG_SYNC_SIGNAL_POLL_INTERVAL_MS$1;
@@ -983,6 +1291,6 @@ async function migrateLegacyDaemonDeviceId(input) {
983
1291
  });
984
1292
  }
985
1293
  //#endregion
986
- export { buildCommandAuthenticationPromptMessage as $, DEFAULT_RECONNECT_DELAY_MS as A, createOpenMeldHumanProfile as B, CONTROLLED_SHUTDOWN_SOCKET_CLOSE_TIMEOUT_MS as C, DAEMON_STREAM_CONNECT_TIMEOUT_MS as D, DAEMON_RUNTIME_CONTRACT_REPAIR_REPORT_FILE as E, REGISTER_RESPONSE_TIMEOUT_MS as F, resolveOpenMeldProfile as G, getOpenMeldProfileCapabilities as H, RUNTIME_AGENT_CONTROLLER_REPORT_SYNC_INTERVAL_MS as I, assertAdditionalHumanProfileCreationEnabled as J, resolveOpenMeldProfileByIdOrName as K, RUNTIME_AGENT_CONTROLLER_REPORT_SYNC_RETRY_INTERVAL_MS as L, MAX_RECONNECT_DELAY_MS as M, PROVIDER_CONVERSATION_PROOF_SYNC_INTERVAL_MS as N, DAEMON_STREAM_KEEPALIVE_INTERVAL_MS as O, PROVIDER_CONVERSATION_PROOF_SYNC_RETRY_INTERVAL_MS as P, buildAuthenticationStatusLabel as Q, RUNTIME_STATE_PERSIST_MIN_INTERVAL_MS as R, CONTROLLED_SHUTDOWN_RESULT_ACK_TIMEOUT_MS as S, DAEMON_RUNTIME_CONTRACT_META_FILE as T, listOpenMeldProfiles as U, deleteOpenMeldProfile as V, primeOpenMeldProfilesSessionCache as W, touchDaemonCatalogSyncSignal as X, readDaemonCatalogSyncSignal as Y, buildAgentAuthenticationGuide as Z, toErrorMessage as _, asRecord as a, resolveAuthenticationGuidanceFromMessage as at, CATALOG_SYNC_SIGNAL_POLL_INTERVAL_MS as b, normalizeHeartbeatIntervalMs as c, DAEMON_ROUTE_CATALOG_CACHE_SCHEMA_NAME as ct, normalizeText as d, buildHumanAuthenticationCard as et, nowIsoString as f, parseTransportMode as g, parseStreamingMode as h, resolvePreferredDaemonDeviceId as i, resolveAuthenticationGuidanceFromError as it, HEARTBEAT_RESPONSE_TIMEOUT_MS as j, DAEMON_STREAM_KEEPALIVE_PONG_TIMEOUT_MS as k, normalizeNonNegativeInteger as l, cachedDaemonRouteConfigSchema as lt, parseRuntimeTransportMode as m, ensureDaemonRuntimePaths as n, extractAuthenticationPromptAction as nt, dirnamePath as o, resolveAuthenticationReasonFromState as ot, parseContextIdMappingSpec as p, updateOpenMeldProfile as q, resolveDaemonDeviceId as r, resolveAuthenticationGuidance as rt, emitRunLine as s, resolveCurrentOpenMeldAccountContext as st, buildLedgerPaths as t, createAuthenticationError as tt, normalizeOptionalText as u, daemonRouteCatalogCacheSchema as ut, warnDaemonEvent as v, DAEMON_RUNTIME_CONTRACT_EPOCH as w, CONTROLLED_SHUTDOWN_REQUEST_TIMEOUT_MS as x, CATALOG_SYNC_RETRY_INTERVAL_MS as y, createOpenMeldAgentProfile as z };
1294
+ export { touchDaemonCatalogSyncSignal as $, DEFAULT_RECONNECT_DELAY_MS as A, requireOpenMeldProfile as B, CONTROLLED_SHUTDOWN_SOCKET_CLOSE_TIMEOUT_MS as C, DAEMON_STREAM_CONNECT_TIMEOUT_MS as D, DAEMON_RUNTIME_CONTRACT_REPAIR_REPORT_FILE as E, REGISTER_RESPONSE_TIMEOUT_MS as F, getOpenMeldProfileCapabilities as G, createOpenMeldAgentProfile as H, RUNTIME_AGENT_CONTROLLER_REPORT_SYNC_INTERVAL_MS as I, resolveOpenMeldProfile as J, listOpenMeldProfiles as K, RUNTIME_AGENT_CONTROLLER_REPORT_SYNC_RETRY_INTERVAL_MS as L, MAX_RECONNECT_DELAY_MS as M, PROVIDER_CONVERSATION_PROOF_SYNC_INTERVAL_MS as N, DAEMON_STREAM_KEEPALIVE_INTERVAL_MS as O, PROVIDER_CONVERSATION_PROOF_SYNC_RETRY_INTERVAL_MS as P, readDaemonCatalogSyncSignal as Q, RUNTIME_STATE_PERSIST_MIN_INTERVAL_MS as R, CONTROLLED_SHUTDOWN_RESULT_ACK_TIMEOUT_MS as S, DAEMON_RUNTIME_CONTRACT_META_FILE as T, createOpenMeldHumanProfile as U, resolveOpenMeldProfileOrNull as V, deleteOpenMeldProfile as W, updateOpenMeldProfile as X, resolveOpenMeldProfileByIdOrName as Y, assertAdditionalHumanProfileCreationEnabled as Z, toErrorMessage as _, cachedDaemonRouteConfigSchema as _t, asRecord as a, buildAgentAuthenticationGuide as at, CATALOG_SYNC_SIGNAL_POLL_INTERVAL_MS as b, normalizeHeartbeatIntervalMs as c, buildHumanAuthenticationCard as ct, normalizeText as d, resolveAuthenticationGuidance as dt, alignSelectedOpenMeldProfileStorage as et, nowIsoString as f, resolveAuthenticationGuidanceFromError as ft, parseTransportMode as g, DAEMON_ROUTE_CATALOG_CACHE_SCHEMA_NAME as gt, parseStreamingMode as h, resolveCurrentOpenMeldAccountContext as ht, resolvePreferredDaemonDeviceId as i, setSelectedOpenMeldProfileId as it, HEARTBEAT_RESPONSE_TIMEOUT_MS as j, DAEMON_STREAM_KEEPALIVE_PONG_TIMEOUT_MS as k, normalizeNonNegativeInteger as l, createAuthenticationError as lt, parseRuntimeTransportMode as m, resolveAuthenticationReasonFromState as mt, ensureDaemonRuntimePaths as n, clearSelectedOpenMeldProfileId as nt, dirnamePath as o, buildAuthenticationStatusLabel as ot, parseContextIdMappingSpec as p, resolveAuthenticationGuidanceFromMessage as pt, primeOpenMeldProfilesSessionCache as q, resolveDaemonDeviceId as r, getSelectedOpenMeldProfileId as rt, emitRunLine as s, buildCommandAuthenticationPromptMessage as st, buildLedgerPaths as t, clearAllSelectedOpenMeldProfileIds as tt, normalizeOptionalText as u, extractAuthenticationPromptAction as ut, warnDaemonEvent as v, daemonRouteCatalogCacheSchema as vt, DAEMON_RUNTIME_CONTRACT_EPOCH as w, CONTROLLED_SHUTDOWN_REQUEST_TIMEOUT_MS as x, CATALOG_SYNC_RETRY_INTERVAL_MS as y, isSelectedOpenMeldProfileRequiredError as z };
987
1295
 
988
- //# sourceMappingURL=daemon-device-id-DWO9_QW6.js.map
1296
+ //# sourceMappingURL=daemon-device-id-B1Af2Zmn.js.map