openmeld 0.3.217 → 0.3.218

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 (110) hide show
  1. package/LICENSE +21 -0
  2. package/dist/{add-me-membership-C2Ys6Gq2.js → add-me-membership-CY6oMdtz.js} +2 -2
  3. package/dist/{add-me-membership-C2Ys6Gq2.js.map → add-me-membership-CY6oMdtz.js.map} +1 -1
  4. package/dist/{agents-ClqMS9aO.js → agents-CzSR8rmW.js} +9 -9
  5. package/dist/{agents-ClqMS9aO.js.map → agents-CzSR8rmW.js.map} +1 -1
  6. package/dist/{api-client-foundation-Cib1elkI.js → api-client-foundation-BOBrz3Lx.js} +3 -3
  7. package/dist/{api-client-foundation-Cib1elkI.js.map → api-client-foundation-BOBrz3Lx.js.map} +1 -1
  8. package/dist/{api-client-foundation-CMVD057A.js → api-client-foundation-D1M0bkwm.js} +1 -1
  9. package/dist/{auth-session-DOjVKRI_.js → auth-session-BAq7KkIa.js} +22 -6
  10. package/dist/auth-session-BAq7KkIa.js.map +1 -0
  11. package/dist/auth-session-D-HTJNKZ.js +4 -0
  12. package/dist/{channel-BfTy6fDo.js → channel-DAZr7cKE.js} +3 -3
  13. package/dist/{channel-BfTy6fDo.js.map → channel-DAZr7cKE.js.map} +1 -1
  14. package/dist/{cli-space-api-BT_Pu9Yg.js → cli-space-api-Ccr8COpr.js} +6 -6
  15. package/dist/{cli-space-api-BT_Pu9Yg.js.map → cli-space-api-Ccr8COpr.js.map} +1 -1
  16. package/dist/{command-C1w0UpIu.js → command-tsXWNPpM.js} +15 -15
  17. package/dist/{command-C1w0UpIu.js.map → command-tsXWNPpM.js.map} +1 -1
  18. package/dist/{computer-connection-DsjsjmPp.js → computer-connection-BK9TsQjc.js} +2 -2
  19. package/dist/{computer-connection-DsjsjmPp.js.map → computer-connection-BK9TsQjc.js.map} +1 -1
  20. package/dist/{computer-connection-review-RXJyryCh.js → computer-connection-review-jPtrO484.js} +5 -5
  21. package/dist/{computer-connection-review-RXJyryCh.js.map → computer-connection-review-jPtrO484.js.map} +1 -1
  22. package/dist/{computer-disconnect-B_LZM2QE.js → computer-disconnect-DzvN_Cbv.js} +7 -7
  23. package/dist/{computer-disconnect-B_LZM2QE.js.map → computer-disconnect-DzvN_Cbv.js.map} +1 -1
  24. package/dist/{computer-setup-continuation-BVI7SD0M.js → computer-setup-continuation-bJzZPnNU.js} +3 -3
  25. package/dist/{computer-setup-continuation-BVI7SD0M.js.map → computer-setup-continuation-bJzZPnNU.js.map} +1 -1
  26. package/dist/{context-Di5R4iik.js → context-DN_LvdgC.js} +4 -4
  27. package/dist/{context-Di5R4iik.js.map → context-DN_LvdgC.js.map} +1 -1
  28. package/dist/{daemon-device-id-bfkbZj9G.js → daemon-device-id-bP58j3NL.js} +5 -5
  29. package/dist/{daemon-device-id-bfkbZj9G.js.map → daemon-device-id-bP58j3NL.js.map} +1 -1
  30. package/dist/{daemon-frame-transport-saNQVOyi.js → daemon-frame-transport-DFfxVRi2.js} +34 -7
  31. package/dist/{daemon-frame-transport-saNQVOyi.js.map → daemon-frame-transport-DFfxVRi2.js.map} +1 -1
  32. package/dist/{daemon-lifecycle-journal-DP01txRB.js → daemon-lifecycle-journal-57QR_a3_.js} +7 -8
  33. package/dist/{daemon-lifecycle-journal-DP01txRB.js.map → daemon-lifecycle-journal-57QR_a3_.js.map} +1 -1
  34. package/dist/{daemon-service-manager-CRHq3YSj.js → daemon-service-manager-ReGjcyjq.js} +1 -1
  35. package/dist/{daemon-service-manager-CXbN836B.js → daemon-service-manager-rNRRVrj1.js} +2 -2
  36. package/dist/{daemon-service-manager-CXbN836B.js.map → daemon-service-manager-rNRRVrj1.js.map} +1 -1
  37. package/dist/{daemon-service-runtime-DpiD8oap.js → daemon-service-runtime-686fUcq9.js} +5 -5
  38. package/dist/{daemon-service-runtime-DpiD8oap.js.map → daemon-service-runtime-686fUcq9.js.map} +1 -1
  39. package/dist/{daemon-service-update-coordinator-BuCEBJoe.js → daemon-service-update-coordinator-DaoVYK6k.js} +16 -12
  40. package/dist/daemon-service-update-coordinator-DaoVYK6k.js.map +1 -0
  41. package/dist/{dist-RR7jryeV.js → dist-C1fbc-VK.js} +1 -1
  42. package/dist/{dist-BdibASYs.js → dist-CBWePGgY.js} +2 -2
  43. package/dist/{dist-BdibASYs.js.map → dist-CBWePGgY.js.map} +1 -1
  44. package/dist/{dist-DkRliHib.js → dist-CiLvbjZA.js} +4 -4
  45. package/dist/dist-CiLvbjZA.js.map +1 -0
  46. package/dist/{elapsed-time-CR9OIZSD.js → elapsed-time-DslUBczL.js} +5 -5
  47. package/dist/{elapsed-time-CR9OIZSD.js.map → elapsed-time-DslUBczL.js.map} +1 -1
  48. package/dist/{entry-CSoHtCQ9.js → entry-B3x5OX3x.js} +7 -7
  49. package/dist/{entry-CSoHtCQ9.js.map → entry-B3x5OX3x.js.map} +1 -1
  50. package/dist/{installation-inventory-CscX0nmD.js → installation-inventory-BZJmaCVr.js} +3 -3
  51. package/dist/{installation-inventory-CscX0nmD.js.map → installation-inventory-BZJmaCVr.js.map} +1 -1
  52. package/dist/{installer-CkF3gSdD.js → installer-BRcaSYgu.js} +2 -2
  53. package/dist/{installer-CkF3gSdD.js.map → installer-BRcaSYgu.js.map} +1 -1
  54. package/dist/native/openmeld-keychain.node +0 -0
  55. package/dist/{open-code-permission-Doem1R2N.js → open-code-permission-DHFJYc_o.js} +5 -1
  56. package/dist/open-code-permission-DHFJYc_o.js.map +1 -0
  57. package/dist/{openmeld-BcyBlby4.js → openmeld-Bbffsx9Y.js} +238 -43
  58. package/dist/openmeld-Bbffsx9Y.js.map +1 -0
  59. package/dist/openmeld-dev.js +0 -0
  60. package/dist/{openmeld-maintenance-worker-Brsfy22C.js → openmeld-maintenance-worker-CDd4d01O.js} +10 -10
  61. package/dist/{openmeld-maintenance-worker-Brsfy22C.js.map → openmeld-maintenance-worker-CDd4d01O.js.map} +1 -1
  62. package/dist/{openmeld-tools-update-join-CUh0JERe.js → openmeld-tools-update-join-htb9JVUN.js} +4 -4
  63. package/dist/{openmeld-tools-update-join-CUh0JERe.js.map → openmeld-tools-update-join-htb9JVUN.js.map} +1 -1
  64. package/dist/openmeld.js +4 -4
  65. package/dist/{prepare-provider-runtime-DxaGSe3R.js → prepare-provider-runtime-3eIWxGgM.js} +93 -72
  66. package/dist/prepare-provider-runtime-3eIWxGgM.js.map +1 -0
  67. package/dist/{prepare-session-executor-CyouBl49.js → prepare-session-executor-DO2p7uLE.js} +19 -19
  68. package/dist/{prepare-session-executor-CyouBl49.js.map → prepare-session-executor-DO2p7uLE.js.map} +1 -1
  69. package/dist/{process-channel-Cocpv3Br.js → process-channel-48ZNmEF6.js} +2 -2
  70. package/dist/{process-channel-Cocpv3Br.js.map → process-channel-48ZNmEF6.js.map} +1 -1
  71. package/dist/{runtime-DGT66AR-.js → runtime-C49hR7fG.js} +142 -21
  72. package/dist/runtime-C49hR7fG.js.map +1 -0
  73. package/dist/{runtime-agent-controller-reporting-submission-C1Vc_JWm.js → runtime-agent-controller-reporting-submission-BJuVnZqs.js} +8 -8
  74. package/dist/{runtime-agent-controller-reporting-submission-C1Vc_JWm.js.map → runtime-agent-controller-reporting-submission-BJuVnZqs.js.map} +1 -1
  75. package/dist/{runtime-reporting-health-state-CPWlQ5IX.js → runtime-reporting-health-state-4Y-fo13l.js} +9 -36
  76. package/dist/runtime-reporting-health-state-4Y-fo13l.js.map +1 -0
  77. package/dist/{runtime-transport-BLtOFrtv.js → runtime-transport-KEwcSZ89.js} +63 -2
  78. package/dist/runtime-transport-KEwcSZ89.js.map +1 -0
  79. package/dist/{service-ClETdJbz.js → service-BlcIfxYE.js} +21 -21
  80. package/dist/service-BlcIfxYE.js.map +1 -0
  81. package/dist/{service-account-authorization-kciEaW5t.js → service-account-authorization-A5Ly0UFD.js} +2 -2
  82. package/dist/{service-account-authorization-kciEaW5t.js.map → service-account-authorization-A5Ly0UFD.js.map} +1 -1
  83. package/dist/{service-account-control-3n_YwNsF.js → service-account-control-DCz_pwrV.js} +10 -10
  84. package/dist/{service-account-control-3n_YwNsF.js.map → service-account-control-DCz_pwrV.js.map} +1 -1
  85. package/dist/{service-control-capabilities-DoW5MW7A.js → service-control-capabilities-BPL-T8xI.js} +1 -1
  86. package/dist/{service-control-capabilities-C2tMMuFl.js → service-control-capabilities-plI5rUzP.js} +4 -4
  87. package/dist/{service-control-capabilities-C2tMMuFl.js.map → service-control-capabilities-plI5rUzP.js.map} +1 -1
  88. package/dist/{state-CMs4p0wo.js → state-Dj3YS3aV.js} +2 -2
  89. package/dist/{state-CMs4p0wo.js.map → state-Dj3YS3aV.js.map} +1 -1
  90. package/dist/{upgrade-2epQATRq.js → upgrade-CRKSer_1.js} +14 -7
  91. package/dist/upgrade-CRKSer_1.js.map +1 -0
  92. package/dist/upgrade-DdetA0-U.js +4 -0
  93. package/dist/{windows-user-task-CSJpDs-S.js → windows-user-task-D4uMvea3.js} +84 -3
  94. package/dist/windows-user-task-D4uMvea3.js.map +1 -0
  95. package/dist/{windows-user-task-CWDzkJCq.js → windows-user-task-hNE24Gqr.js} +1 -1
  96. package/package.json +41 -43
  97. package/dist/auth-session-D7oAIuHk.js +0 -4
  98. package/dist/auth-session-DOjVKRI_.js.map +0 -1
  99. package/dist/daemon-service-update-coordinator-BuCEBJoe.js.map +0 -1
  100. package/dist/dist-DkRliHib.js.map +0 -1
  101. package/dist/open-code-permission-Doem1R2N.js.map +0 -1
  102. package/dist/openmeld-BcyBlby4.js.map +0 -1
  103. package/dist/prepare-provider-runtime-DxaGSe3R.js.map +0 -1
  104. package/dist/runtime-DGT66AR-.js.map +0 -1
  105. package/dist/runtime-reporting-health-state-CPWlQ5IX.js.map +0 -1
  106. package/dist/runtime-transport-BLtOFrtv.js.map +0 -1
  107. package/dist/service-ClETdJbz.js.map +0 -1
  108. package/dist/upgrade-2epQATRq.js.map +0 -1
  109. package/dist/upgrade-BVIot_cP.js +0 -4
  110. package/dist/windows-user-task-CSJpDs-S.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { ft as computerConnectionProgressObservationSchema, it as prepareSessionSnapshotSchema, nt as createPrepareSessionRequestSchema, pt as computerConnectionProgressPhaseSchema } from "./auth-session-DOjVKRI_.js";
3
+ import { ft as computerConnectionProgressObservationSchema, it as prepareSessionSnapshotSchema, nt as createPrepareSessionRequestSchema, pt as computerConnectionProgressPhaseSchema } from "./auth-session-BAq7KkIa.js";
4
4
  import * as z$1 from "zod/v4";
5
5
  //#region ../../packages/schemas/dist/computer-connection.js
6
6
  const computerConnectionIntentSchema = z$1.strictObject({
@@ -117,4 +117,4 @@ z$1.union([desktopComputerConnectionOperationSchema, desktopComputerDisconnectOp
117
117
  //#endregion
118
118
  export { computerConnectionReviewSchema as n, computerConnectionIntentSchema as t };
119
119
 
120
- //# sourceMappingURL=computer-connection-DsjsjmPp.js.map
120
+ //# sourceMappingURL=computer-connection-BK9TsQjc.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"computer-connection-DsjsjmPp.js","names":[],"sources":["../../../packages/schemas/dist/computer-connection.js"],"sourcesContent":["import { computerConnectionProgressObservationSchema, computerConnectionProgressPhaseSchema } from \"./computer-connection-progress.js\";\nimport { createPrepareSessionRequestSchema, prepareSessionSnapshotSchema } from \"./schemas/prepare/session.js\";\nimport * as z$1 from \"zod/v4\";\n//#region src/computer-connection.ts\nconst computerConnectionIntentSchema = z$1.strictObject({\n\texpectedAccount: z$1.string().trim().min(1).max(256),\n\tpreviousSessionIdentity: z$1.string().min(1).max(128)\n});\nconst computerSetupVerboseOutputSchema = z$1.object({\n\ttype: z$1.string(),\n\tcode: z$1.string().min(1).max(256),\n\ttext: z$1.string().optional(),\n\tmessage: z$1.string().optional(),\n\tdata: z$1.object({\n\t\tstate: z$1.string().optional(),\n\t\tphase: computerConnectionProgressPhaseSchema.optional()\n\t}).optional()\n});\nconst computerSetupOutputSchema = z$1.union([computerSetupVerboseOutputSchema, z$1.object({\n\tt: z$1.string(),\n\tc: z$1.string().min(1).max(256),\n\tx: z$1.string().optional(),\n\tm: z$1.string().optional(),\n\td: computerSetupVerboseOutputSchema.shape.data\n}).transform((event) => ({\n\ttype: event.t,\n\tcode: event.c,\n\ttext: event.x,\n\tmessage: event.m,\n\tdata: event.d\n}))]);\nconst desktopComputerConnectionProgressSchema = computerConnectionProgressObservationSchema.extend({ expectedAccount: computerConnectionIntentSchema.shape.expectedAccount });\nconst computerConnectionReviewSchema = z$1.strictObject({\n\tprotocol: z$1.literal(\"computer-connection-v1\"),\n\tpreviousSessionIdentity: z$1.string().min(1).max(128),\n\taccount: z$1.strictObject({\n\t\tid: z$1.string().min(1).max(256),\n\t\temail: z$1.string().max(512).nullable()\n\t}).nullable(),\n\texistingConnection: z$1.strictObject({\n\t\tdeviceId: z$1.string().min(1),\n\t\truntimeLane: z$1.enum([\n\t\t\t\"prod\",\n\t\t\t\"dev-local\",\n\t\t\t\"canary\"\n\t\t])\n\t}).nullable()\n});\nconst desktopComputerDisconnectRequestSchema = z$1.strictObject({\n\texpectedAccount: computerConnectionIntentSchema.shape.expectedAccount,\n\texpectedConnection: computerConnectionReviewSchema.shape.existingConnection.unwrap().optional()\n});\nconst desktopComputerConnectionRequestSchema = createPrepareSessionRequestSchema.pick({\n\thumanProfileId: true,\n\ttargetSpaceId: true,\n\tsourceNavigationAction: true,\n\tconnectedComputerId: true\n}).extend({\n\texpectedAccount: computerConnectionIntentSchema.shape.expectedAccount,\n\tresetThisComputer: z$1.boolean().optional()\n});\nconst desktopComputerConnectionResultSchema = z$1.discriminatedUnion(\"status\", [\n\tz$1.strictObject({\n\t\tstatus: z$1.literal(\"failed\"),\n\t\tmessage: z$1.string().min(1),\n\t\tdiagnosticId: z$1.string().min(1),\n\t\tdiagnosticsPath: z$1.string().min(1).optional()\n\t}),\n\tz$1.strictObject({\n\t\tstatus: z$1.literal(\"reused\"),\n\t\tconnection: computerConnectionReviewSchema.shape.existingConnection.unwrap()\n\t}),\n\tz$1.strictObject({\n\t\tstatus: z$1.literal(\"completed\"),\n\t\tsnapshot: prepareSessionSnapshotSchema\n\t}),\n\tz$1.strictObject({ status: z$1.literal(\"cancelled\") })\n]);\nconst desktopComputerConnectionOperationSchema = z$1.strictObject({\n\toperationId: z$1.string().min(1).max(128),\n\trequest: desktopComputerConnectionRequestSchema,\n\tstatus: z$1.enum([\"pending\", \"settled\"]),\n\tprogress: desktopComputerConnectionProgressSchema.nullable(),\n\tresult: desktopComputerConnectionResultSchema.nullable(),\n\terrorMessage: z$1.string().min(1).max(4096).nullable()\n});\nconst desktopComputerDisconnectPhaseSchema = z$1.enum([\n\t\"checking\",\n\t\"waiting_for_confirmation\",\n\t\"disconnecting\"\n]);\nconst desktopComputerDisconnectResultSchema = z$1.union([\n\tz$1.strictObject({ status: z$1.literal(\"disconnected\") }),\n\tz$1.strictObject({ status: z$1.literal(\"cancelled\") }),\n\tz$1.strictObject({\n\t\tstatus: z$1.enum([\n\t\t\t\"connection_changed\",\n\t\t\t\"failed\",\n\t\t\t\"unconfirmed\"\n\t\t]),\n\t\tcode: z$1.string().min(1).max(256),\n\t\tmessage: z$1.string().min(1).max(4096),\n\t\tdiagnosticId: z$1.string().min(1).max(128).optional(),\n\t\tdiagnosticsPath: z$1.string().min(1).max(4096).optional()\n\t})\n]);\nconst desktopComputerDisconnectOperationSchema = z$1.strictObject({\n\tkind: z$1.literal(\"disconnect\"),\n\toperationId: desktopComputerConnectionOperationSchema.shape.operationId,\n\trequest: desktopComputerDisconnectRequestSchema,\n\tstatus: z$1.enum([\"pending\", \"settled\"]),\n\tphase: desktopComputerDisconnectPhaseSchema,\n\tresult: desktopComputerDisconnectResultSchema.nullable()\n});\nconst desktopComputerOperationSchema = z$1.union([desktopComputerConnectionOperationSchema, desktopComputerDisconnectOperationSchema]);\n//#endregion\nexport { computerConnectionIntentSchema, computerConnectionReviewSchema, computerSetupOutputSchema, desktopComputerConnectionOperationSchema, desktopComputerConnectionProgressSchema, desktopComputerConnectionRequestSchema, desktopComputerConnectionResultSchema, desktopComputerDisconnectOperationSchema, desktopComputerDisconnectPhaseSchema, desktopComputerDisconnectRequestSchema, desktopComputerDisconnectResultSchema, desktopComputerOperationSchema };\n\n//# sourceMappingURL=computer-connection.js.map"],"mappings":";;;;;AAIA,MAAM,iCAAiC,IAAI,aAAa;CACvD,iBAAiB,IAAI,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG;CACnD,yBAAyB,IAAI,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG;AACrD,CAAC;AACD,MAAM,mCAAmC,IAAI,OAAO;CACnD,MAAM,IAAI,OAAO;CACjB,MAAM,IAAI,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG;CACjC,MAAM,IAAI,OAAO,CAAC,CAAC,SAAS;CAC5B,SAAS,IAAI,OAAO,CAAC,CAAC,SAAS;CAC/B,MAAM,IAAI,OAAO;EAChB,OAAO,IAAI,OAAO,CAAC,CAAC,SAAS;EAC7B,OAAO,sCAAsC,SAAS;CACvD,CAAC,CAAC,CAAC,SAAS;AACb,CAAC;AACiC,IAAI,MAAM,CAAC,kCAAkC,IAAI,OAAO;CACzF,GAAG,IAAI,OAAO;CACd,GAAG,IAAI,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG;CAC9B,GAAG,IAAI,OAAO,CAAC,CAAC,SAAS;CACzB,GAAG,IAAI,OAAO,CAAC,CAAC,SAAS;CACzB,GAAG,iCAAiC,MAAM;AAC3C,CAAC,CAAC,CAAC,WAAW,WAAW;CACxB,MAAM,MAAM;CACZ,MAAM,MAAM;CACZ,MAAM,MAAM;CACZ,SAAS,MAAM;CACf,MAAM,MAAM;AACb,EAAE,CAAC,CAAC;AACJ,MAAM,0CAA0C,4CAA4C,OAAO,EAAE,iBAAiB,+BAA+B,MAAM,gBAAgB,CAAC;AAC5K,MAAM,iCAAiC,IAAI,aAAa;CACv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AAsC,SAAS;AACxD,CAAC;AACsC,IAAI,MAAM,CAAC,0CAA0C,wCAAwC,CAAC"}
1
+ {"version":3,"file":"computer-connection-BK9TsQjc.js","names":[],"sources":["../../../packages/schemas/dist/computer-connection.js"],"sourcesContent":["import { computerConnectionProgressObservationSchema, computerConnectionProgressPhaseSchema } from \"./computer-connection-progress.js\";\nimport { createPrepareSessionRequestSchema, prepareSessionSnapshotSchema } from \"./schemas/prepare/session.js\";\nimport * as z$1 from \"zod/v4\";\n//#region src/computer-connection.ts\nconst computerConnectionIntentSchema = z$1.strictObject({\n\texpectedAccount: z$1.string().trim().min(1).max(256),\n\tpreviousSessionIdentity: z$1.string().min(1).max(128)\n});\nconst computerSetupVerboseOutputSchema = z$1.object({\n\ttype: z$1.string(),\n\tcode: z$1.string().min(1).max(256),\n\ttext: z$1.string().optional(),\n\tmessage: z$1.string().optional(),\n\tdata: z$1.object({\n\t\tstate: z$1.string().optional(),\n\t\tphase: computerConnectionProgressPhaseSchema.optional()\n\t}).optional()\n});\nconst computerSetupOutputSchema = z$1.union([computerSetupVerboseOutputSchema, z$1.object({\n\tt: z$1.string(),\n\tc: z$1.string().min(1).max(256),\n\tx: z$1.string().optional(),\n\tm: z$1.string().optional(),\n\td: computerSetupVerboseOutputSchema.shape.data\n}).transform((event) => ({\n\ttype: event.t,\n\tcode: event.c,\n\ttext: event.x,\n\tmessage: event.m,\n\tdata: event.d\n}))]);\nconst desktopComputerConnectionProgressSchema = computerConnectionProgressObservationSchema.extend({ expectedAccount: computerConnectionIntentSchema.shape.expectedAccount });\nconst computerConnectionReviewSchema = z$1.strictObject({\n\tprotocol: z$1.literal(\"computer-connection-v1\"),\n\tpreviousSessionIdentity: z$1.string().min(1).max(128),\n\taccount: z$1.strictObject({\n\t\tid: z$1.string().min(1).max(256),\n\t\temail: z$1.string().max(512).nullable()\n\t}).nullable(),\n\texistingConnection: z$1.strictObject({\n\t\tdeviceId: z$1.string().min(1),\n\t\truntimeLane: z$1.enum([\n\t\t\t\"prod\",\n\t\t\t\"dev-local\",\n\t\t\t\"canary\"\n\t\t])\n\t}).nullable()\n});\nconst desktopComputerDisconnectRequestSchema = z$1.strictObject({\n\texpectedAccount: computerConnectionIntentSchema.shape.expectedAccount,\n\texpectedConnection: computerConnectionReviewSchema.shape.existingConnection.unwrap().optional()\n});\nconst desktopComputerConnectionRequestSchema = createPrepareSessionRequestSchema.pick({\n\thumanProfileId: true,\n\ttargetSpaceId: true,\n\tsourceNavigationAction: true,\n\tconnectedComputerId: true\n}).extend({\n\texpectedAccount: computerConnectionIntentSchema.shape.expectedAccount,\n\tresetThisComputer: z$1.boolean().optional()\n});\nconst desktopComputerConnectionResultSchema = z$1.discriminatedUnion(\"status\", [\n\tz$1.strictObject({\n\t\tstatus: z$1.literal(\"failed\"),\n\t\tmessage: z$1.string().min(1),\n\t\tdiagnosticId: z$1.string().min(1),\n\t\tdiagnosticsPath: z$1.string().min(1).optional()\n\t}),\n\tz$1.strictObject({\n\t\tstatus: z$1.literal(\"reused\"),\n\t\tconnection: computerConnectionReviewSchema.shape.existingConnection.unwrap()\n\t}),\n\tz$1.strictObject({\n\t\tstatus: z$1.literal(\"completed\"),\n\t\tsnapshot: prepareSessionSnapshotSchema\n\t}),\n\tz$1.strictObject({ status: z$1.literal(\"cancelled\") })\n]);\nconst desktopComputerConnectionOperationSchema = z$1.strictObject({\n\toperationId: z$1.string().min(1).max(128),\n\trequest: desktopComputerConnectionRequestSchema,\n\tstatus: z$1.enum([\"pending\", \"settled\"]),\n\tprogress: desktopComputerConnectionProgressSchema.nullable(),\n\tresult: desktopComputerConnectionResultSchema.nullable(),\n\terrorMessage: z$1.string().min(1).max(4096).nullable()\n});\nconst desktopComputerDisconnectPhaseSchema = z$1.enum([\n\t\"checking\",\n\t\"waiting_for_confirmation\",\n\t\"disconnecting\"\n]);\nconst desktopComputerDisconnectResultSchema = z$1.union([\n\tz$1.strictObject({ status: z$1.literal(\"disconnected\") }),\n\tz$1.strictObject({ status: z$1.literal(\"cancelled\") }),\n\tz$1.strictObject({\n\t\tstatus: z$1.enum([\n\t\t\t\"connection_changed\",\n\t\t\t\"failed\",\n\t\t\t\"unconfirmed\"\n\t\t]),\n\t\tcode: z$1.string().min(1).max(256),\n\t\tmessage: z$1.string().min(1).max(4096),\n\t\tdiagnosticId: z$1.string().min(1).max(128).optional(),\n\t\tdiagnosticsPath: z$1.string().min(1).max(4096).optional()\n\t})\n]);\nconst desktopComputerDisconnectOperationSchema = z$1.strictObject({\n\tkind: z$1.literal(\"disconnect\"),\n\toperationId: desktopComputerConnectionOperationSchema.shape.operationId,\n\trequest: desktopComputerDisconnectRequestSchema,\n\tstatus: z$1.enum([\"pending\", \"settled\"]),\n\tphase: desktopComputerDisconnectPhaseSchema,\n\tresult: desktopComputerDisconnectResultSchema.nullable()\n});\nconst desktopComputerOperationSchema = z$1.union([desktopComputerConnectionOperationSchema, desktopComputerDisconnectOperationSchema]);\n//#endregion\nexport { computerConnectionIntentSchema, computerConnectionReviewSchema, computerSetupOutputSchema, desktopComputerConnectionOperationSchema, desktopComputerConnectionProgressSchema, desktopComputerConnectionRequestSchema, desktopComputerConnectionResultSchema, desktopComputerDisconnectOperationSchema, desktopComputerDisconnectPhaseSchema, desktopComputerDisconnectRequestSchema, desktopComputerDisconnectResultSchema, desktopComputerOperationSchema };\n\n//# sourceMappingURL=computer-connection.js.map"],"mappings":";;;;;AAIA,MAAM,iCAAiC,IAAI,aAAa;CACvD,iBAAiB,IAAI,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG;CACnD,yBAAyB,IAAI,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG;AACrD,CAAC;AACD,MAAM,mCAAmC,IAAI,OAAO;CACnD,MAAM,IAAI,OAAO;CACjB,MAAM,IAAI,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG;CACjC,MAAM,IAAI,OAAO,CAAC,C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a,EAAE,QAAQ,IAAI,QAAQ,cAAc,EAAE,CAAC;CACxD,IAAI,aAAa,EAAE,QAAQ,IAAI,QAAQ,WAAW,EAAE,CAAC;CACrD,IAAI,aAAa;EAChB,QAAQ,IAAI,KAAK;GAChB;GACA;GACA;EACD,CAAC;EACD,MAAM,IAAI,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG;EACjC,SAAS,IAAI,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI;EACrC,cAAc,IAAI,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,SAAS;EACpD,iBAAiB,IAAI,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,SAAS;CACzD,CAAC;AACF,CAAC;AACD,MAAM,2CAA2C,IAAI,aAAa;CACjE,MAAM,IAAI,QAAQ,YAAY;CAC9B,aAAa,yCAAyC,MAAM;CAC5D,SAAS;CACT,QAAQ,IAAI,KAAK,CAAC,WAAW,SAAS,CAAC;CACvC,OAAO;CACP,QAAQ,sCAAsC,SAAS;AACxD,CAAC;AACsC,IAAI,MAAM,CAAC,0CAA0C,wCAAwC,CAAC"}
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { d as getAuthSessionState, o as buildStoredAuthSessionIdentity, u as getAuthSessionMetadata } from "./auth-session-DOjVKRI_.js";
4
- import { n as computerConnectionReviewSchema } from "./computer-connection-DsjsjmPp.js";
3
+ import { d as getAuthSessionState, o as buildStoredAuthSessionIdentity, u as getAuthSessionMetadata } from "./auth-session-BAq7KkIa.js";
4
+ import { n as computerConnectionReviewSchema } from "./computer-connection-BK9TsQjc.js";
5
5
  import { i as readDaemonServiceContract } from "./daemon-service-contract-BpOBMGX0.js";
6
- import { n as resolveServiceAccountIdentity } from "./service-account-authorization-kciEaW5t.js";
7
- import { t as readServiceControlCapabilities } from "./service-control-capabilities-C2tMMuFl.js";
6
+ import { n as resolveServiceAccountIdentity } from "./service-account-authorization-A5Ly0UFD.js";
7
+ import { t as readServiceControlCapabilities } from "./service-control-capabilities-plI5rUzP.js";
8
8
  //#region src/commands/computer-connection-review.ts
9
9
  /** Display evidence only. Auth and Service owners validate an existing connection. */
10
10
  async function readComputerConnectionReview() {
@@ -36,4 +36,4 @@ async function readComputerConnectionReview() {
36
36
  //#endregion
37
37
  export { readComputerConnectionReview };
38
38
 
39
- //# sourceMappingURL=computer-connection-review-RXJyryCh.js.map
39
+ //# sourceMappingURL=computer-connection-review-jPtrO484.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"computer-connection-review-RXJyryCh.js","names":[],"sources":["../src/commands/computer-connection-review.ts"],"sourcesContent":["import { computerConnectionReviewSchema } from \"@openmeld/schemas\";\nimport {\n buildStoredAuthSessionIdentity,\n getAuthSessionMetadata,\n getAuthSessionState,\n} from \"../config/auth-session\";\nimport { readDaemonServiceContract } from \"../config/daemon-service-contract\";\nimport { resolveServiceAccountIdentity } from \"../local-service/lifecycle/service-account-authorization\";\nimport { readServiceControlCapabilities } from \"./service-control-capabilities\";\n\n/** Display evidence only. Auth and Service owners validate an existing connection. */\nexport async function readComputerConnectionReview() {\n const session = await getAuthSessionMetadata();\n if (session && !session.user?.id) {\n throw new Error(\n \"The computer account cannot be identified. Review its sign-in before connecting.\"\n );\n }\n let existingConnection: ReturnType<\n typeof computerConnectionReviewSchema.parse\n >[\"existingConnection\"] = null;\n const contract = await readDaemonServiceContract();\n if (session && contract && contract.ownerUserId === session.user?.id) {\n const auth = await getAuthSessionState({ validateRemote: true });\n if (auth.state === \"valid\" && auth.session) {\n const identity = await resolveServiceAccountIdentity(\n auth.session,\n contract\n );\n const capabilities = await readServiceControlCapabilities();\n if (capabilities.stop && capabilities.deviceId === identity.deviceId) {\n existingConnection = {\n deviceId: identity.deviceId,\n runtimeLane: identity.lane,\n };\n }\n }\n }\n return computerConnectionReviewSchema.parse({\n protocol: \"computer-connection-v1\",\n previousSessionIdentity: buildStoredAuthSessionIdentity(session),\n account: session\n ? { id: session.user?.id, email: session.user?.email ?? null }\n : null,\n existingConnection,\n });\n}\n"],"mappings":";;;;;;;;;AAWA,eAAsB,+BAA+B;CACnD,MAAM,UAAU,MAAM,uBAAuB;CAC7C,IAAI,WAAW,CAAC,QAAQ,MAAM,IAC5B,MAAM,IAAI,MACR,kFACF;CAEF,IAAI,qBAEsB;CAC1B,MAAM,WAAW,MAAM,0BAA0B;CACjD,IAAI,WAAW,YAAY,SAAS,gBAAgB,QAAQ,MAAM,IAAI;EACpE,MAAM,OAAO,MAAM,oBAAoB,EAAE,gBAAgB,KAAK,CAAC;EAC/D,IAAI,KAAK,UAAU,WAAW,KAAK,SAAS;GAC1C,MAAM,WAAW,MAAM,8BACrB,KAAK,SACL,QACF;GACA,MAAM,eAAe,MAAM,+BAA+B;GAC1D,IAAI,aAAa,QAAQ,aAAa,aAAa,SAAS,UAC1D,qBAAqB;IACnB,UAAU,SAAS;IACnB,aAAa,SAAS;GACxB;EAEJ;CACF;CACA,OAAO,+BAA+B,MAAM;EAC1C,UAAU;EACV,yBAAyB,+BAA+B,OAAO;EAC/D,SAAS,UACL;GAAE,IAAI,QAAQ,MAAM;GAAI,OAAO,QAAQ,MAAM,SAAS;EAAK,IAC3D;EACJ;CACF,CAAC;AACH"}
1
+ {"version":3,"file":"computer-connection-review-jPtrO484.js","names":[],"sources":["../src/commands/computer-connection-review.ts"],"sourcesContent":["import { computerConnectionReviewSchema } from \"@openmeld/schemas\";\nimport {\n buildStoredAuthSessionIdentity,\n getAuthSessionMetadata,\n getAuthSessionState,\n} from \"../config/auth-session\";\nimport { readDaemonServiceContract } from \"../config/daemon-service-contract\";\nimport { resolveServiceAccountIdentity } from \"../local-service/lifecycle/service-account-authorization\";\nimport { readServiceControlCapabilities } from \"./service-control-capabilities\";\n\n/** Display evidence only. Auth and Service owners validate an existing connection. */\nexport async function readComputerConnectionReview() {\n const session = await getAuthSessionMetadata();\n if (session && !session.user?.id) {\n throw new Error(\n \"The computer account cannot be identified. Review its sign-in before connecting.\"\n );\n }\n let existingConnection: ReturnType<\n typeof computerConnectionReviewSchema.parse\n >[\"existingConnection\"] = null;\n const contract = await readDaemonServiceContract();\n if (session && contract && contract.ownerUserId === session.user?.id) {\n const auth = await getAuthSessionState({ validateRemote: true });\n if (auth.state === \"valid\" && auth.session) {\n const identity = await resolveServiceAccountIdentity(\n auth.session,\n contract\n );\n const capabilities = await readServiceControlCapabilities();\n if (capabilities.stop && capabilities.deviceId === identity.deviceId) {\n existingConnection = {\n deviceId: identity.deviceId,\n runtimeLane: identity.lane,\n };\n }\n }\n }\n return computerConnectionReviewSchema.parse({\n protocol: \"computer-connection-v1\",\n previousSessionIdentity: buildStoredAuthSessionIdentity(session),\n account: session\n ? { id: session.user?.id, email: session.user?.email ?? null }\n : null,\n existingConnection,\n });\n}\n"],"mappings":";;;;;;;;;AAWA,eAAsB,+BAA+B;CACnD,MAAM,UAAU,MAAM,uBAAuB;CAC7C,IAAI,WAAW,CAAC,QAAQ,MAAM,IAC5B,MAAM,IAAI,MACR,kFACF;CAEF,IAAI,qBAEsB;CAC1B,MAAM,WAAW,MAAM,0BAA0B;CACjD,IAAI,WAAW,YAAY,SAAS,gBAAgB,QAAQ,MAAM,IAAI;EACpE,MAAM,OAAO,MAAM,oBAAoB,EAAE,gBAAgB,KAAK,CAAC;EAC/D,IAAI,KAAK,UAAU,WAAW,KAAK,SAAS;GAC1C,MAAM,WAAW,MAAM,8BACrB,KAAK,SACL,QACF;GACA,MAAM,eAAe,MAAM,+BAA+B;GAC1D,IAAI,aAAa,QAAQ,aAAa,aAAa,SAAS,UAC1D,qBAAqB;IACnB,UAAU,SAAS;IACnB,aAAa,SAAS;GACxB;EAEJ;CACF;CACA,OAAO,+BAA+B,MAAM;EAC1C,UAAU;EACV,yBAAyB,+BAA+B,OAAO;EAC/D,SAAS,UACL;GAAE,IAAI,QAAQ,MAAM;GAAI,OAAO,QAAQ,MAAM,SAAS;EAAK,IAC3D;EACJ;CACF,CAAC;AACH"}
@@ -1,14 +1,14 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { l as getAuthSession, o as buildStoredAuthSessionIdentity, s as clearAuthSession, u as getAuthSessionMetadata } from "./auth-session-DOjVKRI_.js";
4
- import { t as computerConnectionIntentSchema } from "./computer-connection-DsjsjmPp.js";
5
- import { r as readCurrentDaemonRuntimeContext } from "./daemon-service-runtime-DpiD8oap.js";
3
+ import { l as getAuthSession, o as buildStoredAuthSessionIdentity, s as clearAuthSession, u as getAuthSessionMetadata } from "./auth-session-BAq7KkIa.js";
4
+ import { t as computerConnectionIntentSchema } from "./computer-connection-BK9TsQjc.js";
5
+ import { r as readCurrentDaemonRuntimeContext } from "./daemon-service-runtime-686fUcq9.js";
6
6
  import { K as withDaemonServiceRunLock } from "./daemon-state-B44aq2nm.js";
7
7
  import { i as readDaemonServiceContract } from "./daemon-service-contract-BpOBMGX0.js";
8
- import { n as resolveServiceAccountIdentity } from "./service-account-authorization-kciEaW5t.js";
9
- import { n as resolveRuntimeContext } from "./context-Di5R4iik.js";
8
+ import { n as resolveServiceAccountIdentity } from "./service-account-authorization-A5Ly0UFD.js";
9
+ import { n as resolveRuntimeContext } from "./context-DN_LvdgC.js";
10
10
  import { t as createPresenter } from "./presenter-BcxiQyJg.js";
11
- import { t as runServiceAccountControl } from "./service-account-control-3n_YwNsF.js";
11
+ import { t as runServiceAccountControl } from "./service-account-control-DCz_pwrV.js";
12
12
  //#region src/commands/computer-disconnect.ts
13
13
  async function runComputerDisconnect(request, view) {
14
14
  const presenter = createPresenter(await resolveRuntimeContext({ view }));
@@ -45,4 +45,4 @@ async function disconnectComputer(request) {
45
45
  //#endregion
46
46
  export { runComputerDisconnect };
47
47
 
48
- //# sourceMappingURL=computer-disconnect-B_LZM2QE.js.map
48
+ //# sourceMappingURL=computer-disconnect-DzvN_Cbv.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"computer-disconnect-B_LZM2QE.js","names":[],"sources":["../src/commands/computer-disconnect.ts"],"sourcesContent":["import {\n type ComputerConnectionIntent,\n computerConnectionIntentSchema,\n} from \"@openmeld/schemas\";\nimport {\n buildStoredAuthSessionIdentity,\n clearAuthSession,\n getAuthSession,\n getAuthSessionMetadata,\n} from \"../config/auth-session\";\nimport { readDaemonServiceContract } from \"../config/daemon-service-contract\";\nimport { withDaemonServiceRunLock } from \"../config/daemon-state\";\nimport { readCurrentDaemonRuntimeContext } from \"../local-service/lifecycle/daemon-service-runtime\";\nimport { resolveServiceAccountIdentity } from \"../local-service/lifecycle/service-account-authorization\";\nimport { resolveRuntimeContext } from \"../runtime/context\";\nimport { createPresenter } from \"../runtime/presenter/index\";\nimport { runServiceAccountControl } from \"./service-account-control\";\n\nexport async function runComputerDisconnect(\n request: ComputerConnectionIntent,\n view?: string\n) {\n const presenter = createPresenter(await resolveRuntimeContext({ view }));\n presenter.line({\n code: \"computer.disconnect.started\",\n text: \"Stopping OpenMeld Service…\",\n data: { state: \"started\" },\n });\n await disconnectComputer(request);\n presenter.line({\n code: \"computer.disconnected\",\n text: \"This computer is disconnected. Its record is still in your account.\",\n });\n}\n\n// Disconnect ends this Mac's local account connection. Forget remains the\n// separate cloud operation that removes the account's Computer record.\nexport async function disconnectComputer(\n request: ComputerConnectionIntent\n): Promise<void> {\n const intent = computerConnectionIntentSchema.parse(request);\n const session = await getAuthSessionMetadata();\n if (\n !session ||\n session.user?.id !== intent.expectedAccount ||\n buildStoredAuthSessionIdentity(session) !== intent.previousSessionIdentity\n ) {\n throw new Error(\n \"The computer sign-in changed. Review its connection before disconnecting.\"\n );\n }\n // The existing admission owner rechecks account, process and generation,\n // drains active work, and disables automatic startup. Never use an unscoped Stop.\n await withDaemonServiceRunLock(async () => {\n const contract = await readDaemonServiceContract();\n const runtime = await readCurrentDaemonRuntimeContext();\n if (contract?.desiredState === \"stopped\") {\n const current = await getAuthSession();\n if (!current) {\n throw new Error(\"Review this computer's sign-in before disconnecting.\");\n }\n await resolveServiceAccountIdentity(current, contract);\n }\n // A retry may follow an acknowledged Stop and a failed credential cleanup.\n // Only the owner's explicit stopped intent can skip another Stop.\n if (\n !(\n contract?.ownerUserId === intent.expectedAccount &&\n contract.desiredState === \"stopped\" &&\n runtime.effectiveRuntimeStatus === \"not_running\"\n )\n ) {\n await runServiceAccountControl(\n {\n operation: \"stop\",\n expectedAccount: intent.expectedAccount,\n },\n intent.previousSessionIdentity\n );\n }\n // Hold the existing lifecycle lock through cleanup so Start cannot race it.\n // A concurrent sign-in after Stop must never be cleared by this operation.\n await clearAuthSession(session);\n });\n}\n"],"mappings":";;;;;;;;;;;;AAkBA,eAAsB,sBACpB,SACA,MACA;CACA,MAAM,YAAY,gBAAgB,MAAM,sBAAsB,EAAE,KAAK,CAAC,CAAC;CACvE,UAAU,KAAK;EACb,MAAM;EACN,MAAM;EACN,MAAM,EAAE,OAAO,UAAU;CAC3B,CAAC;CACD,MAAM,mBAAmB,OAAO;CAChC,UAAU,KAAK;EACb,MAAM;EACN,MAAM;CACR,CAAC;AACH;AAIA,eAAsB,mBACpB,SACe;CACf,MAAM,SAAS,+BAA+B,MAAM,OAAO;CAC3D,MAAM,UAAU,MAAM,uBAAuB;CAC7C,IACE,CAAC,WACD,QAAQ,MAAM,OAAO,OAAO,mBAC5B,+BAA+B,OAAO,MAAM,OAAO,yBAEnD,MAAM,IAAI,MACR,2EACF;CAIF,MAAM,yBAAyB,YAAY;EACzC,MAAM,WAAW,MAAM,0BAA0B;EACjD,MAAM,UAAU,MAAM,gCAAgC;EACtD,IAAI,UAAU,iBAAiB,WAAW;GACxC,MAAM,UAAU,MAAM,eAAe;GACrC,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,sDAAsD;GAExE,MAAM,8BAA8B,SAAS,QAAQ;EACvD;EAGA,IACE,EACE,UAAU,gBAAgB,OAAO,mBACjC,SAAS,iBAAiB,aAC1B,QAAQ,2BAA2B,gBAGrC,MAAM,yBACJ;GACE,WAAW;GACX,iBAAiB,OAAO;EAC1B,GACA,OAAO,uBACT;EAIF,MAAM,iBAAiB,OAAO;CAChC,CAAC;AACH"}
1
+ {"version":3,"file":"computer-disconnect-DzvN_Cbv.js","names":[],"sources":["../src/commands/computer-disconnect.ts"],"sourcesContent":["import {\n type ComputerConnectionIntent,\n computerConnectionIntentSchema,\n} from \"@openmeld/schemas\";\nimport {\n buildStoredAuthSessionIdentity,\n clearAuthSession,\n getAuthSession,\n getAuthSessionMetadata,\n} from \"../config/auth-session\";\nimport { readDaemonServiceContract } from \"../config/daemon-service-contract\";\nimport { withDaemonServiceRunLock } from \"../config/daemon-state\";\nimport { readCurrentDaemonRuntimeContext } from \"../local-service/lifecycle/daemon-service-runtime\";\nimport { resolveServiceAccountIdentity } from \"../local-service/lifecycle/service-account-authorization\";\nimport { resolveRuntimeContext } from \"../runtime/context\";\nimport { createPresenter } from \"../runtime/presenter/index\";\nimport { runServiceAccountControl } from \"./service-account-control\";\n\nexport async function runComputerDisconnect(\n request: ComputerConnectionIntent,\n view?: string\n) {\n const presenter = createPresenter(await resolveRuntimeContext({ view }));\n presenter.line({\n code: \"computer.disconnect.started\",\n text: \"Stopping OpenMeld Service…\",\n data: { state: \"started\" },\n });\n await disconnectComputer(request);\n presenter.line({\n code: \"computer.disconnected\",\n text: \"This computer is disconnected. Its record is still in your account.\",\n });\n}\n\n// Disconnect ends this Mac's local account connection. Forget remains the\n// separate cloud operation that removes the account's Computer record.\nexport async function disconnectComputer(\n request: ComputerConnectionIntent\n): Promise<void> {\n const intent = computerConnectionIntentSchema.parse(request);\n const session = await getAuthSessionMetadata();\n if (\n !session ||\n session.user?.id !== intent.expectedAccount ||\n buildStoredAuthSessionIdentity(session) !== intent.previousSessionIdentity\n ) {\n throw new Error(\n \"The computer sign-in changed. Review its connection before disconnecting.\"\n );\n }\n // The existing admission owner rechecks account, process and generation,\n // drains active work, and disables automatic startup. Never use an unscoped Stop.\n await withDaemonServiceRunLock(async () => {\n const contract = await readDaemonServiceContract();\n const runtime = await readCurrentDaemonRuntimeContext();\n if (contract?.desiredState === \"stopped\") {\n const current = await getAuthSession();\n if (!current) {\n throw new Error(\"Review this computer's sign-in before disconnecting.\");\n }\n await resolveServiceAccountIdentity(current, contract);\n }\n // A retry may follow an acknowledged Stop and a failed credential cleanup.\n // Only the owner's explicit stopped intent can skip another Stop.\n if (\n !(\n contract?.ownerUserId === intent.expectedAccount &&\n contract.desiredState === \"stopped\" &&\n runtime.effectiveRuntimeStatus === \"not_running\"\n )\n ) {\n await runServiceAccountControl(\n {\n operation: \"stop\",\n expectedAccount: intent.expectedAccount,\n },\n intent.previousSessionIdentity\n );\n }\n // Hold the existing lifecycle lock through cleanup so Start cannot race it.\n // A concurrent sign-in after Stop must never be cleared by this operation.\n await clearAuthSession(session);\n });\n}\n"],"mappings":";;;;;;;;;;;;AAkBA,eAAsB,sBACpB,SACA,MACA;CACA,MAAM,YAAY,gBAAgB,MAAM,sBAAsB,EAAE,KAAK,CAAC,CAAC;CACvE,UAAU,KAAK;EACb,MAAM;EACN,MAAM;EACN,MAAM,EAAE,OAAO,UAAU;CAC3B,CAAC;CACD,MAAM,mBAAmB,OAAO;CAChC,UAAU,KAAK;EACb,MAAM;EACN,MAAM;CACR,CAAC;AACH;AAIA,eAAsB,mBACpB,SACe;CACf,MAAM,SAAS,+BAA+B,MAAM,OAAO;CAC3D,MAAM,UAAU,MAAM,uBAAuB;CAC7C,IACE,CAAC,WACD,QAAQ,MAAM,OAAO,OAAO,mBAC5B,+BAA+B,OAAO,MAAM,OAAO,yBAEnD,MAAM,IAAI,MACR,2EACF;CAIF,MAAM,yBAAyB,YAAY;EACzC,MAAM,WAAW,MAAM,0BAA0B;EACjD,MAAM,UAAU,MAAM,gCAAgC;EACtD,IAAI,UAAU,iBAAiB,WAAW;GACxC,MAAM,UAAU,MAAM,eAAe;GACrC,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,sDAAsD;GAExE,MAAM,8BAA8B,SAAS,QAAQ;EACvD;EAGA,IACE,EACE,UAAU,gBAAgB,OAAO,mBACjC,SAAS,iBAAiB,aAC1B,QAAQ,2BAA2B,gBAGrC,MAAM,yBACJ;GACE,WAAW;GACX,iBAAiB,OAAO;EAC1B,GACA,OAAO,uBACT;EAIF,MAAM,iBAAiB,OAAO;CAChC,CAAC;AACH"}
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { m as hasPendingComputerSetupContinuation, x as resumeInterruptedComputerSetup } from "./auth-session-DOjVKRI_.js";
3
+ import { m as hasPendingComputerSetupContinuation, x as resumeInterruptedComputerSetup } from "./auth-session-BAq7KkIa.js";
4
4
  import { t as createPresenter } from "./presenter-BcxiQyJg.js";
5
- import { A as mintPrepareSessionReconnectToken, D as recoverInterruptedComputerAuthHandoff, i as runPrepareSessionExecutor } from "./prepare-session-executor-CyouBl49.js";
5
+ import { A as mintPrepareSessionReconnectToken, D as recoverInterruptedComputerAuthHandoff, i as runPrepareSessionExecutor } from "./prepare-session-executor-DO2p7uLE.js";
6
6
  import { setTimeout } from "node:timers/promises";
7
7
  //#region src/commands/computer-setup-continuation.ts
8
8
  const runtime = {
@@ -39,4 +39,4 @@ async function recoverComputerSetupAfterBackgroundUpdate() {
39
39
  //#endregion
40
40
  export { finishComputerSetupAfterBackgroundUpdate, recoverComputerSetupAfterBackgroundUpdate };
41
41
 
42
- //# sourceMappingURL=computer-setup-continuation-BVI7SD0M.js.map
42
+ //# sourceMappingURL=computer-setup-continuation-bJzZPnNU.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"computer-setup-continuation-BVI7SD0M.js","names":["sleep"],"sources":["../src/commands/computer-setup-continuation.ts"],"sourcesContent":["import { setTimeout as sleep } from \"node:timers/promises\";\nimport {\n hasPendingComputerSetupContinuation,\n resumeInterruptedComputerSetup,\n} from \"../config/auth-session\";\nimport { mintPrepareSessionReconnectToken } from \"../config/prepare-session-api\";\nimport { createPresenter } from \"../runtime/presenter/index\";\nimport type { RuntimeContext } from \"../runtime/types\";\nimport { recoverInterruptedComputerAuthHandoff } from \"./computer-auth-handoff-recovery\";\nimport { runPrepareSessionExecutor } from \"./prepare-session-executor\";\n\nconst runtime: RuntimeContext = {\n interactive: false,\n resolvedView: \"agent\",\n viewMode: \"agent\",\n};\n\n// Called only by the existing OS-owned maintenance worker after its update.\n// The live Terminal keeps ownership. If it exits, continue the same Core\n// Prepare session using the existing auth journal, not a second setup plan.\nexport async function finishComputerSetupAfterBackgroundUpdate(): Promise<void> {\n while (await hasPendingComputerSetupContinuation()) {\n const resumed = await resumeInterruptedComputerSetup(\n async (continuation) => {\n const { snapshot, opaqueToken } =\n await mintPrepareSessionReconnectToken({\n baseUrl: continuation.gatewayUrl,\n prepareSessionId: continuation.prepareSessionId,\n });\n if (\n snapshot.lifecycleStatus !== \"active\" &&\n snapshot.lifecycleStatus !== \"completed\"\n ) {\n return \"not_completed\";\n }\n const result = await runPrepareSessionExecutor({\n gatewayUrl: continuation.gatewayUrl,\n initialSnapshot: snapshot,\n interactive: false,\n localAgentSelection: continuation.localAgentSelection,\n presenter: createPresenter(runtime),\n runtime,\n startSession: opaqueToken,\n view: \"agent\",\n });\n return result.status;\n }\n );\n if (!resumed) {\n await sleep(500);\n }\n }\n}\n\n// Run after the completed update has released its pending job. Account rollback\n// uses the existing handoff recovery, which itself waits for active updates.\nexport async function recoverComputerSetupAfterBackgroundUpdate(): Promise<void> {\n await recoverInterruptedComputerAuthHandoff({\n presenter: createPresenter(runtime),\n runtime,\n view: \"agent\",\n });\n}\n"],"mappings":";;;;;;;AAWA,MAAM,UAA0B;CAC9B,aAAa;CACb,cAAc;CACd,UAAU;AACZ;AAKA,eAAsB,2CAA0D;CAC9E,OAAO,MAAM,oCAAoC,GA2B/C,IAAI,CAAC,MA1BiB,+BACpB,OAAO,iBAAiB;EACtB,MAAM,EAAE,UAAU,gBAChB,MAAM,iCAAiC;GACrC,SAAS,aAAa;GACtB,kBAAkB,aAAa;EACjC,CAAC;EACH,IACE,SAAS,oBAAoB,YAC7B,SAAS,oBAAoB,aAE7B,OAAO;EAYT,QAAO,MAVc,0BAA0B;GAC7C,YAAY,aAAa;GACzB,iBAAiB;GACjB,aAAa;GACb,qBAAqB,aAAa;GAClC,WAAW,gBAAgB,OAAO;GAClC;GACA,cAAc;GACd,MAAM;EACR,CAAC,EAAA,CACa;CAChB,CACF,GAEE,MAAMA,WAAM,GAAG;AAGrB;AAIA,eAAsB,4CAA2D;CAC/E,MAAM,sCAAsC;EAC1C,WAAW,gBAAgB,OAAO;EAClC;EACA,MAAM;CACR,CAAC;AACH"}
1
+ {"version":3,"file":"computer-setup-continuation-bJzZPnNU.js","names":["sleep"],"sources":["../src/commands/computer-setup-continuation.ts"],"sourcesContent":["import { setTimeout as sleep } from \"node:timers/promises\";\nimport {\n hasPendingComputerSetupContinuation,\n resumeInterruptedComputerSetup,\n} from \"../config/auth-session\";\nimport { mintPrepareSessionReconnectToken } from \"../config/prepare-session-api\";\nimport { createPresenter } from \"../runtime/presenter/index\";\nimport type { RuntimeContext } from \"../runtime/types\";\nimport { recoverInterruptedComputerAuthHandoff } from \"./computer-auth-handoff-recovery\";\nimport { runPrepareSessionExecutor } from \"./prepare-session-executor\";\n\nconst runtime: RuntimeContext = {\n interactive: false,\n resolvedView: \"agent\",\n viewMode: \"agent\",\n};\n\n// Called only by the existing OS-owned maintenance worker after its update.\n// The live Terminal keeps ownership. If it exits, continue the same Core\n// Prepare session using the existing auth journal, not a second setup plan.\nexport async function finishComputerSetupAfterBackgroundUpdate(): Promise<void> {\n while (await hasPendingComputerSetupContinuation()) {\n const resumed = await resumeInterruptedComputerSetup(\n async (continuation) => {\n const { snapshot, opaqueToken } =\n await mintPrepareSessionReconnectToken({\n baseUrl: continuation.gatewayUrl,\n prepareSessionId: continuation.prepareSessionId,\n });\n if (\n snapshot.lifecycleStatus !== \"active\" &&\n snapshot.lifecycleStatus !== \"completed\"\n ) {\n return \"not_completed\";\n }\n const result = await runPrepareSessionExecutor({\n gatewayUrl: continuation.gatewayUrl,\n initialSnapshot: snapshot,\n interactive: false,\n localAgentSelection: continuation.localAgentSelection,\n presenter: createPresenter(runtime),\n runtime,\n startSession: opaqueToken,\n view: \"agent\",\n });\n return result.status;\n }\n );\n if (!resumed) {\n await sleep(500);\n }\n }\n}\n\n// Run after the completed update has released its pending job. Account rollback\n// uses the existing handoff recovery, which itself waits for active updates.\nexport async function recoverComputerSetupAfterBackgroundUpdate(): Promise<void> {\n await recoverInterruptedComputerAuthHandoff({\n presenter: createPresenter(runtime),\n runtime,\n view: \"agent\",\n });\n}\n"],"mappings":";;;;;;;AAWA,MAAM,UAA0B;CAC9B,aAAa;CACb,cAAc;CACd,UAAU;AACZ;AAKA,eAAsB,2CAA0D;CAC9E,OAAO,MAAM,oCAAoC,GA2B/C,IAAI,CAAC,MA1BiB,+BACpB,OAAO,iBAAiB;EACtB,MAAM,EAAE,UAAU,gBAChB,MAAM,iCAAiC;GACrC,SAAS,aAAa;GACtB,kBAAkB,aAAa;EACjC,CAAC;EACH,IACE,SAAS,oBAAoB,YAC7B,SAAS,oBAAoB,aAE7B,OAAO;EAYT,QAAO,MAVc,0BAA0B;GAC7C,YAAY,aAAa;GACzB,iBAAiB;GACjB,aAAa;GACb,qBAAqB,aAAa;GAClC,WAAW,gBAAgB,OAAO;GAClC;GACA,cAAc;GACd,MAAM;EACR,CAAC,EAAA,CACa;CAChB,CACF,GAEE,MAAMA,WAAM,GAAG;AAGrB;AAIA,eAAsB,4CAA2D;CAC/E,MAAM,sCAAsC;EAC1C,WAAW,gBAAgB,OAAO;EAClC;EACA,MAAM;CACR,CAAC;AACH"}
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { J as normalizeOpenMeldProfileId, N as accountProfileViewPath, _ as resolveCliContext, et as openMeldRootDir, ft as runtimeDir, g as readCliContextState, h as listCliContextStates, y as writeCliContextState } from "./lock-Bsl_ElWy.js";
4
- import { ci as openMeldProfileIdSchema } from "./runtime-transport-BLtOFrtv.js";
5
- import { d as getAuthSessionState } from "./auth-session-DOjVKRI_.js";
6
- import { G as resolveOpenMeldProfile, K as resolveOpenMeldProfileByIdOrName, it as resolveAuthenticationGuidanceFromError, ot as resolveAuthenticationReasonFromState, st as resolveCurrentOpenMeldAccountContext, tt as createAuthenticationError } from "./daemon-device-id-bfkbZj9G.js";
4
+ import { ci as openMeldProfileIdSchema } from "./runtime-transport-KEwcSZ89.js";
5
+ import { d as getAuthSessionState } from "./auth-session-BAq7KkIa.js";
6
+ import { G as resolveOpenMeldProfile, K as resolveOpenMeldProfileByIdOrName, it as resolveAuthenticationGuidanceFromError, ot as resolveAuthenticationReasonFromState, st as resolveCurrentOpenMeldAccountContext, tt as createAuthenticationError } from "./daemon-device-id-bP58j3NL.js";
7
7
  import { _ as getConfiguredViewCustomization } from "./base-url-D7uE_xTo.js";
8
8
  import { t as formatInlineOpenMeldCliCommands } from "./cli-entry-command-CR_9QU1i.js";
9
9
  import { createHash } from "node:crypto";
@@ -470,4 +470,4 @@ function isInteractiveSession() {
470
470
  //#endregion
471
471
  export { requireOpenMeldProfile as a, clearAllSelectedOpenMeldProfileIds as c, setSelectedOpenMeldProfileId as d, getProfileDefaultView as f, isSelectedOpenMeldProfileRequiredError as i, clearSelectedOpenMeldProfileId as l, resolveRuntimeContext as n, resolveOpenMeldProfileOrNull as o, setProfileDefaultView as p, resolveViewProfileKey as r, alignSelectedOpenMeldProfileStorage as s, parseCliViewMode as t, getSelectedOpenMeldProfileId as u };
472
472
 
473
- //# sourceMappingURL=context-Di5R4iik.js.map
473
+ //# sourceMappingURL=context-DN_LvdgC.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"context-Di5R4iik.js","names":["normalizeOptionalString","normalizeOptionalString"],"sources":["../src/config/profile-view.ts","../src/config/openmeld-profile-selection.ts","../src/config/resolve-openmeld-profile.ts","../src/config/view-profile-key.ts","../src/runtime/context.ts"],"sourcesContent":["import { mkdir, readFile, rename, rm, writeFile } from \"node:fs/promises\";\nimport { dirname } from \"node:path\";\nimport { resolveCurrentOpenMeldAccountContext } from \"./account-context\";\nimport {\n accountProfileViewPath,\n normalizeOpenMeldProfileId,\n type OpenMeldProfileId,\n} from \"./paths\";\n\nexport type ProfileDefaultView = \"auto\" | \"human\" | \"agent\";\n\ntype ProfileViewV1 = {\n v: 1;\n openMeldProfileId: OpenMeldProfileId;\n defaultView: Exclude<ProfileDefaultView, \"auto\">;\n updatedAt: string;\n};\n\ntype StoredProfileViewInput = Partial<ProfileViewV1> & { profile?: string };\n\ntype NormalizedStoredProfileView = {\n needsRewrite: boolean;\n payload: ProfileViewV1;\n};\n\nexport async function getProfileDefaultView(\n openMeldProfileId: string\n): Promise<ProfileDefaultView> {\n const normalizedOpenMeldProfileId =\n normalizeOpenMeldProfileId(openMeldProfileId);\n const path = await resolveAccountProfileViewPath(normalizedOpenMeldProfileId);\n const raw = await readFile(path, \"utf8\").catch(() => null);\n if (!raw) {\n return \"auto\";\n }\n\n try {\n const parsed = JSON.parse(raw) as StoredProfileViewInput;\n if (parsed.v !== 1) {\n return \"auto\";\n }\n const normalizedStoredProfileView = normalizeStoredProfileView(parsed);\n if (!normalizedStoredProfileView) {\n return \"auto\";\n }\n if (\n normalizedStoredProfileView.payload.openMeldProfileId !==\n normalizedOpenMeldProfileId\n ) {\n await rm(path, { force: true });\n return \"auto\";\n }\n if (normalizedStoredProfileView.needsRewrite) {\n await writeProfileViewFile(path, normalizedStoredProfileView.payload);\n }\n return normalizedStoredProfileView.payload.defaultView;\n } catch {\n return \"auto\";\n }\n}\n\nexport async function setProfileDefaultView(input: {\n openMeldProfileId: string;\n view: ProfileDefaultView;\n}): Promise<void> {\n const openMeldProfileId = normalizeOpenMeldProfileId(input.openMeldProfileId);\n const path = await resolveAccountProfileViewPath(openMeldProfileId);\n\n if (input.view === \"auto\") {\n await rm(path, { force: true });\n return;\n }\n\n await writeProfileViewFile(path, {\n v: 1,\n openMeldProfileId,\n defaultView: input.view,\n updatedAt: new Date().toISOString(),\n });\n}\n\nasync function writeProfileViewFile(\n path: string,\n payload: ProfileViewV1\n): Promise<void> {\n await mkdir(dirname(path), { recursive: true });\n const tempPath = `${path}.tmp-${process.pid}-${Date.now()}`;\n await writeFile(tempPath, `${JSON.stringify(payload, null, 2)}\\n`, \"utf8\");\n try {\n await rename(tempPath, path);\n } catch (error) {\n await rm(tempPath, { force: true }).catch(() => undefined);\n throw error;\n }\n}\n\nasync function resolveAccountProfileViewPath(\n openMeldProfileId: OpenMeldProfileId\n): Promise<string> {\n const accountContext = await resolveCurrentOpenMeldAccountContext();\n return accountProfileViewPath(accountContext.key, openMeldProfileId);\n}\n\nfunction normalizeStoredProfileView(\n input: StoredProfileViewInput\n): NormalizedStoredProfileView | null {\n const openMeldProfileId = normalizeOptionalOpenMeldProfileId(\n input.openMeldProfileId\n );\n const legacyProfile = normalizeOptionalOpenMeldProfileId(input.profile);\n const resolvedOpenMeldProfileId = openMeldProfileId ?? legacyProfile;\n if (!resolvedOpenMeldProfileId) {\n return null;\n }\n const defaultView = normalizeStoredDefaultView(input.defaultView);\n if (!defaultView) {\n return null;\n }\n const updatedAt = normalizeStoredUpdatedAt(input.updatedAt);\n return {\n needsRewrite:\n openMeldProfileId !== resolvedOpenMeldProfileId ||\n input.profile !== undefined ||\n input.updatedAt !== updatedAt,\n payload: {\n v: 1,\n openMeldProfileId: resolvedOpenMeldProfileId,\n defaultView,\n updatedAt,\n },\n };\n}\n\nfunction normalizeStoredDefaultView(\n value: unknown\n): Exclude<ProfileDefaultView, \"auto\"> | null {\n if (value === \"human\" || value === \"agent\") {\n return value;\n }\n return null;\n}\n\nfunction normalizeStoredUpdatedAt(value: unknown): string {\n if (typeof value === \"string\") {\n const trimmedValue = value.trim();\n if (trimmedValue.length > 0 && !Number.isNaN(Date.parse(trimmedValue))) {\n return trimmedValue;\n }\n }\n return new Date().toISOString();\n}\n\nfunction normalizeOptionalOpenMeldProfileId(\n value: unknown\n): OpenMeldProfileId | null {\n if (typeof value !== \"string\") {\n return null;\n }\n try {\n return normalizeOpenMeldProfileId(value);\n } catch {\n return null;\n }\n}\n","import { createHash } from \"node:crypto\";\nimport {\n mkdir,\n readdir,\n readFile,\n rm,\n stat,\n writeFile,\n} from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { openMeldRootDir, runtimeDir } from \"./paths\";\nimport {\n listCliContextStates,\n readCliContextState,\n resolveCliContext,\n writeCliContextState,\n} from \"./session-profile\";\n\ntype SelectedOpenMeldProfileV1 = {\n v: 1;\n sessionId: string;\n sessionSource: string;\n openMeldProfileId: string;\n updatedAt: string;\n};\n\nexport type SetSelectedOpenMeldProfileResult = {\n persistent: boolean;\n cliContextSource?: string;\n};\n\nexport type ClearAllSelectedOpenMeldProfileIdsResult = {\n clearedSessionSelections: number;\n failedSessionIds: string[];\n removedFallbackSelection: boolean;\n removedLegacySelectionFile: boolean;\n removedLegacySessionSelectionDirectory: boolean;\n};\n\nconst SESSION_FILE_HASH_LENGTH = 8;\nconst SESSION_FILE_MAX_LENGTH = 128;\nconst FALLBACK_SELECTION_SESSION_ID = \"global-default\";\nconst FALLBACK_SELECTION_SOURCE = \"fallback:no_runtime_session\";\n\nexport async function setSelectedOpenMeldProfileId(\n openMeldProfileId: string\n): Promise<SetSelectedOpenMeldProfileResult> {\n const normalized = normalizeRequiredString(\n openMeldProfileId,\n \"openMeldProfileId\"\n );\n await rm(legacySelectionPath(), { force: true }).catch(() => undefined);\n\n const cliContext = resolveCliContext();\n if (!cliContext) {\n await writeFallbackSelectionPayload(normalized);\n return {\n persistent: true,\n cliContextSource: FALLBACK_SELECTION_SOURCE,\n };\n }\n\n await writeCliContextState({\n selectedOpenMeldProfileId: normalized,\n });\n await rm(selectionPath(cliContext.cliContextId), {\n force: true,\n }).catch(() => undefined);\n return {\n persistent: true,\n cliContextSource: cliContext.source,\n };\n}\n\nexport async function getSelectedOpenMeldProfileId(): Promise<string | null> {\n const cliContext = resolveCliContext();\n if (!cliContext) {\n return await readFallbackSelectionPayload();\n }\n\n const sessionState = await readCliContextState();\n if (sessionState?.selectedOpenMeldProfileId) {\n return sessionState.selectedOpenMeldProfileId;\n }\n\n const legacySelection = await readLegacySelectionPayload(\n cliContext.cliContextId\n );\n if (!legacySelection?.openMeldProfileId) {\n return null;\n }\n await writeCliContextState({\n sessionId: legacySelection.sessionId,\n sessionSource: legacySelection.sessionSource,\n openMeldProfileId: legacySelection.openMeldProfileId,\n });\n await rm(selectionPath(cliContext.cliContextId), {\n force: true,\n }).catch(() => undefined);\n return legacySelection.openMeldProfileId;\n}\n\nexport async function clearSelectedOpenMeldProfileId(): Promise<void> {\n const cliContext = resolveCliContext();\n if (!cliContext) {\n await rm(fallbackSelectionPath(), { force: true }).catch(() => undefined);\n await rm(legacySelectionPath(), { force: true }).catch(() => undefined);\n return;\n }\n\n await writeCliContextState({\n selectedOpenMeldProfileId: null,\n });\n await rm(selectionPath(cliContext.cliContextId), { force: true });\n await rm(legacySelectionPath(), { force: true }).catch(() => undefined);\n}\n\nexport async function clearAllSelectedOpenMeldProfileIds(): Promise<ClearAllSelectedOpenMeldProfileIdsResult> {\n const sessionStates = await listCliContextStates();\n let clearedSessionSelections = 0;\n const failedSessionIds: string[] = [];\n\n for (const sessionState of sessionStates) {\n if (!sessionState.selectedOpenMeldProfileId) {\n continue;\n }\n try {\n const written = await writeCliContextState({\n sessionId: sessionState.sessionId,\n sessionSource: sessionState.cliContextSource,\n selectedOpenMeldProfileId: null,\n });\n if (written) {\n clearedSessionSelections += 1;\n continue;\n }\n } catch {\n // Best-effort cleanup: skip unwritable session state and continue logout.\n }\n failedSessionIds.push(sessionState.sessionId);\n }\n\n const removedFallbackSelection = await removeFileIfPresent(\n fallbackSelectionPath()\n );\n const removedLegacySelectionFile = await removeFileIfPresent(\n legacySelectionPath()\n );\n const removedLegacySessionSelectionDirectory = await removeDirectoryIfPresent(\n sessionSelectionDir()\n );\n\n return {\n clearedSessionSelections,\n failedSessionIds,\n removedFallbackSelection,\n removedLegacySelectionFile,\n removedLegacySessionSelectionDirectory,\n };\n}\n\nexport async function alignSelectedOpenMeldProfileStorage(): Promise<{\n migratedSessionSelections: number;\n removedLegacyDirectory: boolean;\n removedLegacySelectionFile: boolean;\n}> {\n let migratedSessionSelections = 0;\n const entryNames = await readdir(sessionSelectionDir()).catch(() => []);\n for (const entryName of entryNames) {\n if (!entryName.endsWith(\".selected-profile.json\")) {\n continue;\n }\n const raw = await readFile(\n join(sessionSelectionDir(), entryName),\n \"utf8\"\n ).catch(() => null);\n if (!raw) {\n continue;\n }\n const parsed = parseLegacySelectionPayload(raw);\n if (!parsed) {\n continue;\n }\n const written = await writeCliContextState({\n sessionId: parsed.sessionId,\n sessionSource: parsed.sessionSource,\n selectedOpenMeldProfileId: parsed.openMeldProfileId,\n });\n if (written) {\n migratedSessionSelections += 1;\n }\n }\n\n const legacyDirectoryExists = entryNames.length > 0;\n if (legacyDirectoryExists) {\n await rm(sessionSelectionDir(), { recursive: true, force: true });\n }\n await migrateLegacyFallbackSelection();\n const removedLegacySelectionFile = await removeLegacySelectionFile();\n return {\n migratedSessionSelections,\n removedLegacyDirectory: legacyDirectoryExists,\n removedLegacySelectionFile,\n };\n}\n\nfunction selectionPath(sessionId: string): string {\n return join(\n sessionSelectionDir(),\n `${toSafeSessionFile(sessionId)}.selected-profile.json`\n );\n}\n\nfunction sessionSelectionDir(): string {\n return join(runtimeDir(), \"selected-openmeld-profiles\");\n}\n\nfunction legacySelectionPath(): string {\n return join(openMeldRootDir(), \"auth\", \"selected-profile.json\");\n}\n\nfunction fallbackSelectionPath(): string {\n return join(runtimeDir(), \"selected-profile-fallback.json\");\n}\n\nasync function readLegacySelectionPayload(\n sessionId: string\n): Promise<SelectedOpenMeldProfileV1 | null> {\n const raw = await readFile(selectionPath(sessionId), \"utf8\").catch(\n () => null\n );\n if (!raw) {\n return null;\n }\n return parseLegacySelectionPayload(raw);\n}\n\nasync function readFallbackSelectionPayload(): Promise<string | null> {\n const raw = await readFile(fallbackSelectionPath(), \"utf8\").catch(() => null);\n if (!raw) {\n const legacyFallback = await readLegacyFallbackSelection();\n if (!legacyFallback) {\n return null;\n }\n await writeFallbackSelectionPayload(legacyFallback.openMeldProfileId);\n await rm(legacySelectionPath(), { force: true }).catch(() => undefined);\n return legacyFallback.openMeldProfileId;\n }\n return parseLegacySelectionPayload(raw)?.openMeldProfileId ?? null;\n}\n\nasync function writeFallbackSelectionPayload(\n openMeldProfileId: string\n): Promise<void> {\n await mkdir(runtimeDir(), { recursive: true });\n const payload: SelectedOpenMeldProfileV1 = {\n v: 1,\n sessionId: FALLBACK_SELECTION_SESSION_ID,\n sessionSource: FALLBACK_SELECTION_SOURCE,\n openMeldProfileId,\n updatedAt: new Date().toISOString(),\n };\n await writeFile(\n fallbackSelectionPath(),\n `${JSON.stringify(payload, null, 2)}\\n`,\n \"utf8\"\n );\n}\n\nfunction parseLegacySelectionPayload(\n raw: string\n): SelectedOpenMeldProfileV1 | null {\n try {\n const payload = JSON.parse(raw) as Partial<SelectedOpenMeldProfileV1>;\n if (payload.v !== 1) {\n return null;\n }\n const sessionId = normalizeOptionalString(payload.sessionId);\n const openMeldProfileId = normalizeOptionalString(\n payload.openMeldProfileId\n );\n if (!(sessionId && openMeldProfileId)) {\n return null;\n }\n return {\n v: 1,\n sessionId,\n sessionSource: normalizeOptionalString(payload.sessionSource) ?? \"manual\",\n openMeldProfileId,\n updatedAt:\n normalizeOptionalString(payload.updatedAt) ?? new Date(0).toISOString(),\n };\n } catch {\n return null;\n }\n}\n\nasync function readLegacyFallbackSelection(): Promise<SelectedOpenMeldProfileV1 | null> {\n const raw = await readFile(legacySelectionPath(), \"utf8\").catch(() => null);\n if (!raw) {\n return null;\n }\n const parsed = parseLegacySelectionPayload(raw);\n if (parsed?.sessionSource !== FALLBACK_SELECTION_SOURCE) {\n return null;\n }\n return parsed;\n}\n\nasync function migrateLegacyFallbackSelection(): Promise<void> {\n const legacyFallback = await readLegacyFallbackSelection();\n if (!legacyFallback) {\n return;\n }\n const existingFallback = await readFile(\n fallbackSelectionPath(),\n \"utf8\"\n ).catch(() => null);\n if (!existingFallback) {\n await writeFallbackSelectionPayload(legacyFallback.openMeldProfileId);\n }\n}\n\nasync function removeLegacySelectionFile(): Promise<boolean> {\n const raw = await readFile(legacySelectionPath(), \"utf8\").catch(() => null);\n if (!raw) {\n return false;\n }\n await rm(legacySelectionPath(), { force: true }).catch(() => undefined);\n return true;\n}\n\nfunction toSafeSessionFile(value: string): string {\n const hash = createHash(\"sha1\")\n .update(value, \"utf8\")\n .digest(\"hex\")\n .slice(0, SESSION_FILE_HASH_LENGTH);\n const safeBaseRaw = value.replace(/[^a-zA-Z0-9._-]+/g, \"_\");\n const safeBase = safeBaseRaw.length > 0 ? safeBaseRaw : \"session\";\n const maxBaseLength = Math.max(\n 1,\n SESSION_FILE_MAX_LENGTH - SESSION_FILE_HASH_LENGTH - 1\n );\n const truncatedBase = safeBase.slice(0, maxBaseLength);\n return `${truncatedBase}-${hash}`;\n}\n\nfunction normalizeOptionalString(value: unknown): string | null {\n const normalized = String(value ?? \"\").trim();\n return normalized.length > 0 ? normalized : null;\n}\n\nfunction normalizeRequiredString(value: unknown, field: string): string {\n const normalized = normalizeOptionalString(value);\n if (!normalized) {\n throw new Error(`${field} is required`);\n }\n return normalized;\n}\n\nasync function removeFileIfPresent(path: string): Promise<boolean> {\n const raw = await readFile(path, \"utf8\").catch(() => null);\n if (raw === null) {\n return false;\n }\n await rm(path, { force: true }).catch(() => undefined);\n return true;\n}\n\nasync function removeDirectoryIfPresent(path: string): Promise<boolean> {\n const directory = await stat(path).catch(() => null);\n if (!directory?.isDirectory()) {\n return false;\n }\n await rm(path, { recursive: true, force: true }).catch(() => undefined);\n return true;\n}\n","import {\n createAuthenticationError,\n resolveAuthenticationGuidanceFromError,\n resolveAuthenticationReasonFromState,\n} from \"../auth/auth-guidance\";\nimport { formatInlineOpenMeldCliCommands } from \"../runtime/cli-entry-command\";\nimport { getAuthSessionState } from \"./auth-session\";\nimport {\n clearSelectedOpenMeldProfileId,\n getSelectedOpenMeldProfileId,\n setSelectedOpenMeldProfileId,\n} from \"./openmeld-profile-selection\";\nimport {\n type OpenMeldProfile,\n type OpenMeldProfileKind,\n resolveOpenMeldProfile,\n resolveOpenMeldProfileByIdOrName,\n} from \"./openmeld-profiles-api\";\n\nexport type ResolveOpenMeldProfileInput = {\n openMeldProfileId?: string;\n profileKind?: OpenMeldProfileKind;\n allowUnauthenticated?: boolean;\n persistSelection?: boolean;\n allowDefaultFallback?: boolean;\n authAction?: string;\n};\n\nconst PROFILE_REQUIRED_ERROR_ROOT =\n \"no OpenMeld profile is selected for this terminal session yet\";\nconst PROFILE_REQUIRED_ERROR_MESSAGE = `${PROFILE_REQUIRED_ERROR_ROOT}; run \\`openmeld start\\` to choose one, or pass \\`--profile <id>\\`.`;\nconst 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.`;\nconst PROFILE_REQUIRED_ERROR_PREFIX =\n \"no OpenMeld profile is selected for this terminal session yet; run `\";\nconst PROFILE_REQUIRED_ERROR_SUFFIX =\n \" start` to choose one, or pass `--profile <id>`.\";\n\nexport function isSelectedOpenMeldProfileRequiredError(\n error: unknown\n): boolean {\n if (!(error instanceof Error)) {\n return false;\n }\n\n if (error.message === PROFILE_REQUIRED_ERROR_MESSAGE) {\n return true;\n }\n\n if (\n error.message.includes(PROFILE_REQUIRED_ERROR_ROOT) &&\n error.message.includes(\"--profile <\")\n ) {\n return true;\n }\n\n return (\n error.message.startsWith(PROFILE_REQUIRED_ERROR_PREFIX) &&\n error.message.endsWith(PROFILE_REQUIRED_ERROR_SUFFIX)\n );\n}\n\nexport async function resolveOpenMeldProfileOrNull(\n input: ResolveOpenMeldProfileInput = {}\n): Promise<OpenMeldProfile | null> {\n const explicitOpenMeldProfileId = normalizeOptionalString(\n input.openMeldProfileId\n );\n if (explicitOpenMeldProfileId) {\n return await resolveExplicitOpenMeldProfile(explicitOpenMeldProfileId, {\n profileKind: input.profileKind,\n allowUnauthenticated: input.allowUnauthenticated === true,\n persistSelection: input.persistSelection !== false,\n });\n }\n\n const selectedOpenMeldProfileId = await getSelectedOpenMeldProfileId();\n if (selectedOpenMeldProfileId) {\n const selectedProfile = await resolveSelectedOpenMeldProfile(\n selectedOpenMeldProfileId,\n {\n profileKind: input.profileKind,\n allowUnauthenticated: input.allowUnauthenticated === true,\n }\n );\n if (selectedProfile) {\n return selectedProfile;\n }\n }\n\n if (input.allowUnauthenticated === true) {\n const authState = await getAuthSessionState({\n validateRemote: false,\n });\n if (authState.state !== \"valid\") {\n return null;\n }\n }\n\n if (input.allowDefaultFallback !== true) {\n return null;\n }\n\n let fallbackProfile: OpenMeldProfile;\n try {\n fallbackProfile = await resolveOpenMeldProfile({\n profileKind: input.profileKind,\n });\n } catch (error) {\n if (input.allowUnauthenticated === true && isAuthRequiredError(error)) {\n return null;\n }\n throw error;\n }\n if (input.persistSelection !== false) {\n await setSelectedOpenMeldProfileId(fallbackProfile.openMeldProfileId);\n }\n return fallbackProfile;\n}\n\nasync function resolveExplicitOpenMeldProfile(\n openMeldProfileId: string,\n input: {\n profileKind?: OpenMeldProfileKind;\n allowUnauthenticated: boolean;\n persistSelection: boolean;\n }\n): Promise<OpenMeldProfile | null> {\n try {\n const profile = await resolveOpenMeldProfileByIdOrName({\n profileIdentifier: openMeldProfileId,\n profileKind: input.profileKind,\n });\n if (input.persistSelection) {\n await setSelectedOpenMeldProfileId(profile.openMeldProfileId);\n }\n return profile;\n } catch (error) {\n if (isAuthRequiredError(error) && input.allowUnauthenticated) {\n return null;\n }\n throw error;\n }\n}\n\nexport async function requireOpenMeldProfile(\n input: ResolveOpenMeldProfileInput = {}\n): Promise<OpenMeldProfile> {\n const profile = await resolveOpenMeldProfileOrNull(input);\n if (profile) {\n return profile;\n }\n\n const authState = await getAuthSessionState({\n validateRemote: false,\n });\n if (authState.state === \"valid\") {\n throw new Error(\n formatInlineOpenMeldCliCommands(\n resolveProfileRequiredErrorMessage(input.authAction)\n )\n );\n }\n const reason = resolveAuthenticationReasonFromState(authState.state);\n throw createAuthenticationError({\n reason: reason ?? \"required\",\n action: input.authAction,\n });\n}\n\nfunction resolveProfileRequiredErrorMessage(authAction?: string): string {\n if (authAction === \"reading a dispatch trace\") {\n return SERVICE_TRACE_PROFILE_REQUIRED_ERROR_MESSAGE;\n }\n\n return PROFILE_REQUIRED_ERROR_MESSAGE;\n}\n\nasync function resolveSelectedOpenMeldProfile(\n selectedOpenMeldProfileId: string,\n input: {\n profileKind?: OpenMeldProfileKind;\n allowUnauthenticated: boolean;\n }\n): Promise<OpenMeldProfile | null> {\n try {\n return await resolveOpenMeldProfile({\n openMeldProfileId: selectedOpenMeldProfileId,\n profileKind: input.profileKind,\n });\n } catch (error) {\n if (isAuthRequiredError(error)) {\n if (input.allowUnauthenticated) {\n return null;\n }\n throw error;\n }\n\n if (isProfileMissingError(error)) {\n await clearSelectedOpenMeldProfileId();\n return null;\n }\n\n throw error;\n }\n}\n\nfunction normalizeOptionalString(value: unknown): string | null {\n const normalized = String(value ?? \"\").trim();\n return normalized.length > 0 ? normalized : null;\n}\n\nfunction isAuthRequiredError(error: unknown): boolean {\n return resolveAuthenticationGuidanceFromError(error) !== null;\n}\n\nfunction isProfileMissingError(error: unknown): boolean {\n const code =\n error && typeof error === \"object\" && \"code\" in error\n ? String((error as { code?: unknown }).code ?? \"\")\n : \"\";\n if (code === \"profile.not_found\") {\n return true;\n }\n\n const message = error instanceof Error ? error.message : String(error ?? \"\");\n return message.includes(\"profile not found\");\n}\n","import { openMeldProfileIdSchema } from \"@openmeld/schemas\";\nimport { getSelectedOpenMeldProfileId } from \"./openmeld-profile-selection\";\nimport { resolveOpenMeldProfileByIdOrName } from \"./openmeld-profiles-api\";\n\nexport async function resolveViewProfileKey(\n inputProfile?: string\n): Promise<string | null> {\n const explicit = normalizeOptionalString(inputProfile);\n if (explicit) {\n const profileId = openMeldProfileIdSchema.safeParse(explicit);\n if (profileId.success) {\n return profileId.data;\n }\n const profile = await resolveOpenMeldProfileByIdOrName({\n profileIdentifier: explicit,\n }).catch(() => null);\n return profile?.openMeldProfileId ?? explicit;\n }\n\n const selected = await getSelectedOpenMeldProfileId();\n if (selected) {\n return selected;\n }\n\n return null;\n}\n\nfunction normalizeOptionalString(value: unknown): string | null {\n const normalized = String(value ?? \"\").trim();\n return normalized.length > 0 ? normalized : null;\n}\n","import { getProfileDefaultView } from \"../config/profile-view\";\nimport { resolveOpenMeldProfileOrNull } from \"../config/resolve-openmeld-profile\";\nimport {\n getConfiguredViewCustomization,\n type RuntimeViewCustomization,\n} from \"../config/runtime-config\";\nimport { resolveViewProfileKey } from \"../config/view-profile-key\";\nimport type { CliViewMode, RuntimeContext } from \"./types\";\n\nexport type { CliViewMode, RuntimeContext } from \"./types\";\n\nexport async function resolveRuntimeContext(input?: {\n view?: string;\n profile?: string;\n interactive?: boolean;\n}): Promise<RuntimeContext> {\n const viewOpenMeldProfileId = await resolveViewProfileKey(input?.profile);\n const configuredViewMode = await readConfiguredDefaultView(\n viewOpenMeldProfileId\n );\n const viewMode = parseCliViewMode(input?.view ?? configuredViewMode);\n const interactive = input?.interactive ?? isInteractiveSession();\n const viewCustomization = await readViewCustomization();\n\n if (viewMode === \"human\" || viewMode === \"agent\") {\n return {\n viewMode,\n resolvedView: viewMode,\n interactive,\n ...(viewOpenMeldProfileId\n ? { openMeldProfileId: viewOpenMeldProfileId }\n : {}),\n ...(viewCustomization ? { viewCustomization } : {}),\n };\n }\n\n const openMeldProfile = await resolveOpenMeldProfileOrNull({\n openMeldProfileId: input?.profile,\n allowUnauthenticated: true,\n persistSelection: false,\n allowDefaultFallback: false,\n }).catch(() => null);\n const resolvedView =\n openMeldProfile?.profileKind === \"agent\" ? \"agent\" : \"human\";\n const resolvedOpenMeldProfileId = openMeldProfile\n ? openMeldProfile.openMeldProfileId\n : viewOpenMeldProfileId;\n\n return {\n viewMode,\n resolvedView,\n interactive,\n ...(resolvedOpenMeldProfileId\n ? { openMeldProfileId: resolvedOpenMeldProfileId }\n : {}),\n ...(openMeldProfile?.profileKind\n ? { profileKind: openMeldProfile.profileKind }\n : {}),\n ...(viewCustomization ? { viewCustomization } : {}),\n };\n}\n\nexport function parseCliViewMode(value?: string): CliViewMode {\n const normalized = String(value ?? \"auto\")\n .trim()\n .toLowerCase();\n if (\n normalized === \"auto\" ||\n normalized === \"human\" ||\n normalized === \"agent\"\n ) {\n return normalized;\n }\n\n throw new Error(`invalid --view value: ${normalized} (use auto|human|agent)`);\n}\n\nfunction readViewCustomization(): Promise<RuntimeViewCustomization | null> {\n return getConfiguredViewCustomization().catch(() => null);\n}\n\nfunction readConfiguredDefaultView(\n openMeldProfileId?: string | null\n): Promise<CliViewMode> {\n if (!openMeldProfileId) {\n return Promise.resolve(\"auto\");\n }\n return getProfileDefaultView(openMeldProfileId).catch(() => \"auto\");\n}\n\nfunction isInteractiveSession(): boolean {\n return Boolean(process.stdin.isTTY && process.stdout.isTTY);\n}\n"],"mappings":";;;;;;;;;;;;AAyBA,eAAsB,sBACpB,mBAC6B;CAC7B,MAAM,8BACJ,2BAA2B,iBAAiB;CAC9C,MAAM,OAAO,MAAM,8BAA8B,2BAA2B;CAC5E,MAAM,MAAM,MAAM,SAAS,MAAM,MAAM,CAAC,CAAC,YAAY,IAAI;CACzD,IAAI,CAAC,KACH,OAAO;CAGT,IAAI;EACF,MAAM,SAAS,KAAK,MAAM,GAAG;EAC7B,IAAI,OAAO,MAAM,GACf,OAAO;EAET,MAAM,8BAA8B,2BAA2B,MAAM;EACrE,IAAI,CAAC,6BACH,OAAO;EAET,IACE,4BAA4B,QAAQ,sBACpC,6BACA;GACA,MAAM,GAAG,MAAM,EAAE,OAAO,KAAK,CAAC;GAC9B,OAAO;EACT;EACA,IAAI,4BAA4B,cAC9B,MAAM,qBAAqB,MAAM,4BAA4B,OAAO;EAE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GAAI,oBAAoB,EAAE,kBAAkB,IAAI,CAAC;CACnD;CAGF,MAAM,kBAAkB,MAAM,6BAA6B;EACzD,mBAAmB,OAAO;EAC1B,sBAAsB;EACtB,kBAAkB;EAClB,sBAAsB;CACxB,CAAC,CAAC,CAAC,YAAY,IAAI;CACnB,MAAM,eACJ,iBAAiB,gBAAgB,UAAU,UAAU;CACvD,MAAM,4BAA4B,kBAC9B,gBAAgB,oBAChB;CAEJ,OAAO;EACL;EACA;EACA;EACA,GAAI,4BACA,EAAE,mBAAmB,0BAA0B,IAC/C,CAAC;EACL,GAAI,iBAAiB,cACjB,EAAE,aAAa,gBAAgB,YAAY,IAC3C,CAAC;EACL,GAAI,oBAAoB,EAAE,kBAAkB,IAAI,CAAC;CACnD;AACF;AAEA,SAAgB,iBAAiB,OAA6B;CAC5D,MAAM,aAAa,OAAO,SAAS,MAAM,CAAC,CACvC,KAAK,CAAC,CACN,YAAY;CACf,IACE,eAAe,UACf,eAAe,WACf,eAAe,SAEf,OAAO;CAGT,MAAM,IAAI,MAAM,yBAAyB,WAAW,wBAAwB;AAC9E;AAEA,SAAS,wBAAkE;CACzE,OAAO,+BAA+B,CAAC,CAAC,YAAY,IAAI;AAC1D;AAEA,SAAS,0BACP,mBACsB;CACtB,IAAI,CAAC,mBACH,OAAO,QAAQ,QAAQ,MAAM;CAE/B,OAAO,sBAAsB,iBAAiB,CAAC,CAAC,YAAY,MAAM;AACpE;AAEA,SAAS,uBAAgC;CACvC,OAAO,QAAQ,QAAQ,MAAM,SAAS,QAAQ,OAAO,KAAK;AAC5D"}
1
+ {"version":3,"file":"context-DN_LvdgC.js","names":["normalizeOptionalString","normalizeOptionalString"],"sources":["../src/config/profile-view.ts","../src/config/openmeld-profile-selection.ts","../src/config/resolve-openmeld-profile.ts","../src/config/view-profile-key.ts","../src/runtime/context.ts"],"sourcesContent":["import { mkdir, readFile, rename, rm, writeFile } from \"node:fs/promises\";\nimport { dirname } from \"node:path\";\nimport { resolveCurrentOpenMeldAccountContext } from \"./account-context\";\nimport {\n accountProfileViewPath,\n normalizeOpenMeldProfileId,\n type OpenMeldProfileId,\n} from \"./paths\";\n\nexport type ProfileDefaultView = \"auto\" | \"human\" | \"agent\";\n\ntype ProfileViewV1 = {\n v: 1;\n openMeldProfileId: OpenMeldProfileId;\n defaultView: Exclude<ProfileDefaultView, \"auto\">;\n updatedAt: string;\n};\n\ntype StoredProfileViewInput = Partial<ProfileViewV1> & { profile?: string };\n\ntype NormalizedStoredProfileView = {\n needsRewrite: boolean;\n payload: ProfileViewV1;\n};\n\nexport async function getProfileDefaultView(\n openMeldProfileId: string\n): Promise<ProfileDefaultView> {\n const normalizedOpenMeldProfileId =\n normalizeOpenMeldProfileId(openMeldProfileId);\n const path = await resolveAccountProfileViewPath(normalizedOpenMeldProfileId);\n const raw = await readFile(path, \"utf8\").catch(() => null);\n if (!raw) {\n return \"auto\";\n }\n\n try {\n const parsed = JSON.parse(raw) as StoredProfileViewInput;\n if (parsed.v !== 1) {\n return \"auto\";\n }\n const normalizedStoredProfileView = normalizeStoredProfileView(parsed);\n if (!normalizedStoredProfileView) {\n return \"auto\";\n }\n if (\n normalizedStoredProfileView.payload.openMeldProfileId !==\n normalizedOpenMeldProfileId\n ) {\n await rm(path, { force: true });\n return \"auto\";\n }\n if (normalizedStoredProfileView.needsRewrite) {\n await writeProfileViewFile(path, normalizedStoredProfileView.payload);\n }\n return normalizedStoredProfileView.payload.defaultView;\n } catch {\n return \"auto\";\n }\n}\n\nexport async function setProfileDefaultView(input: {\n openMeldProfileId: string;\n view: ProfileDefaultView;\n}): Promise<void> {\n const openMeldProfileId = normalizeOpenMeldProfileId(input.openMeldProfileId);\n const path = await resolveAccountProfileViewPath(openMeldProfileId);\n\n if (input.view === \"auto\") {\n await rm(path, { force: true });\n return;\n }\n\n await writeProfileViewFile(path, {\n v: 1,\n openMeldProfileId,\n defaultView: input.view,\n updatedAt: new Date().toISOString(),\n });\n}\n\nasync function writeProfileViewFile(\n path: string,\n payload: ProfileViewV1\n): Promise<void> {\n await mkdir(dirname(path), { recursive: true });\n const tempPath = `${path}.tmp-${process.pid}-${Date.now()}`;\n await writeFile(tempPath, `${JSON.stringify(payload, null, 2)}\\n`, \"utf8\");\n try {\n await rename(tempPath, path);\n } catch (error) {\n await rm(tempPath, { force: true }).catch(() => undefined);\n throw error;\n }\n}\n\nasync function resolveAccountProfileViewPath(\n openMeldProfileId: OpenMeldProfileId\n): Promise<string> {\n const accountContext = await resolveCurrentOpenMeldAccountContext();\n return accountProfileViewPath(accountContext.key, openMeldProfileId);\n}\n\nfunction normalizeStoredProfileView(\n input: StoredProfileViewInput\n): NormalizedStoredProfileView | null {\n const openMeldProfileId = normalizeOptionalOpenMeldProfileId(\n input.openMeldProfileId\n );\n const legacyProfile = normalizeOptionalOpenMeldProfileId(input.profile);\n const resolvedOpenMeldProfileId = openMeldProfileId ?? legacyProfile;\n if (!resolvedOpenMeldProfileId) {\n return null;\n }\n const defaultView = normalizeStoredDefaultView(input.defaultView);\n if (!defaultView) {\n return null;\n }\n const updatedAt = normalizeStoredUpdatedAt(input.updatedAt);\n return {\n needsRewrite:\n openMeldProfileId !== resolvedOpenMeldProfileId ||\n input.profile !== undefined ||\n input.updatedAt !== updatedAt,\n payload: {\n v: 1,\n openMeldProfileId: resolvedOpenMeldProfileId,\n defaultView,\n updatedAt,\n },\n };\n}\n\nfunction normalizeStoredDefaultView(\n value: unknown\n): Exclude<ProfileDefaultView, \"auto\"> | null {\n if (value === \"human\" || value === \"agent\") {\n return value;\n }\n return null;\n}\n\nfunction normalizeStoredUpdatedAt(value: unknown): string {\n if (typeof value === \"string\") {\n const trimmedValue = value.trim();\n if (trimmedValue.length > 0 && !Number.isNaN(Date.parse(trimmedValue))) {\n return trimmedValue;\n }\n }\n return new Date().toISOString();\n}\n\nfunction normalizeOptionalOpenMeldProfileId(\n value: unknown\n): OpenMeldProfileId | null {\n if (typeof value !== \"string\") {\n return null;\n }\n try {\n return normalizeOpenMeldProfileId(value);\n } catch {\n return null;\n }\n}\n","import { createHash } from \"node:crypto\";\nimport {\n mkdir,\n readdir,\n readFile,\n rm,\n stat,\n writeFile,\n} from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { openMeldRootDir, runtimeDir } from \"./paths\";\nimport {\n listCliContextStates,\n readCliContextState,\n resolveCliContext,\n writeCliContextState,\n} from \"./session-profile\";\n\ntype SelectedOpenMeldProfileV1 = {\n v: 1;\n sessionId: string;\n sessionSource: string;\n openMeldProfileId: string;\n updatedAt: string;\n};\n\nexport type SetSelectedOpenMeldProfileResult = {\n persistent: boolean;\n cliContextSource?: string;\n};\n\nexport type ClearAllSelectedOpenMeldProfileIdsResult = {\n clearedSessionSelections: number;\n failedSessionIds: string[];\n removedFallbackSelection: boolean;\n removedLegacySelectionFile: boolean;\n removedLegacySessionSelectionDirectory: boolean;\n};\n\nconst SESSION_FILE_HASH_LENGTH = 8;\nconst SESSION_FILE_MAX_LENGTH = 128;\nconst FALLBACK_SELECTION_SESSION_ID = \"global-default\";\nconst FALLBACK_SELECTION_SOURCE = \"fallback:no_runtime_session\";\n\nexport async function setSelectedOpenMeldProfileId(\n openMeldProfileId: string\n): Promise<SetSelectedOpenMeldProfileResult> {\n const normalized = normalizeRequiredString(\n openMeldProfileId,\n \"openMeldProfileId\"\n );\n await rm(legacySelectionPath(), { force: true }).catch(() => undefined);\n\n const cliContext = resolveCliContext();\n if (!cliContext) {\n await writeFallbackSelectionPayload(normalized);\n return {\n persistent: true,\n cliContextSource: FALLBACK_SELECTION_SOURCE,\n };\n }\n\n await writeCliContextState({\n selectedOpenMeldProfileId: normalized,\n });\n await rm(selectionPath(cliContext.cliContextId), {\n force: true,\n }).catch(() => undefined);\n return {\n persistent: true,\n cliContextSource: cliContext.source,\n };\n}\n\nexport async function getSelectedOpenMeldProfileId(): Promise<string | null> {\n const cliContext = resolveCliContext();\n if (!cliContext) {\n return await readFallbackSelectionPayload();\n }\n\n const sessionState = await readCliContextState();\n if (sessionState?.selectedOpenMeldProfileId) {\n return sessionState.selectedOpenMeldProfileId;\n }\n\n const legacySelection = await readLegacySelectionPayload(\n cliContext.cliContextId\n );\n if (!legacySelection?.openMeldProfileId) {\n return null;\n }\n await writeCliContextState({\n sessionId: legacySelection.sessionId,\n sessionSource: legacySelection.sessionSource,\n openMeldProfileId: legacySelection.openMeldProfileId,\n });\n await rm(selectionPath(cliContext.cliContextId), {\n force: true,\n }).catch(() => undefined);\n return legacySelection.openMeldProfileId;\n}\n\nexport async function clearSelectedOpenMeldProfileId(): Promise<void> {\n const cliContext = resolveCliContext();\n if (!cliContext) {\n await rm(fallbackSelectionPath(), { force: true }).catch(() => undefined);\n await rm(legacySelectionPath(), { force: true }).catch(() => undefined);\n return;\n }\n\n await writeCliContextState({\n selectedOpenMeldProfileId: null,\n });\n await rm(selectionPath(cliContext.cliContextId), { force: true });\n await rm(legacySelectionPath(), { force: true }).catch(() => undefined);\n}\n\nexport async function clearAllSelectedOpenMeldProfileIds(): Promise<ClearAllSelectedOpenMeldProfileIdsResult> {\n const sessionStates = await listCliContextStates();\n let clearedSessionSelections = 0;\n const failedSessionIds: string[] = [];\n\n for (const sessionState of sessionStates) {\n if (!sessionState.selectedOpenMeldProfileId) {\n continue;\n }\n try {\n const written = await writeCliContextState({\n sessionId: sessionState.sessionId,\n sessionSource: sessionState.cliContextSource,\n selectedOpenMeldProfileId: null,\n });\n if (written) {\n clearedSessionSelections += 1;\n continue;\n }\n } catch {\n // Best-effort cleanup: skip unwritable session state and continue logout.\n }\n failedSessionIds.push(sessionState.sessionId);\n }\n\n const removedFallbackSelection = await removeFileIfPresent(\n fallbackSelectionPath()\n );\n const removedLegacySelectionFile = await removeFileIfPresent(\n legacySelectionPath()\n );\n const removedLegacySessionSelectionDirectory = await removeDirectoryIfPresent(\n sessionSelectionDir()\n );\n\n return {\n clearedSessionSelections,\n failedSessionIds,\n removedFallbackSelection,\n removedLegacySelectionFile,\n removedLegacySessionSelectionDirectory,\n };\n}\n\nexport async function alignSelectedOpenMeldProfileStorage(): Promise<{\n migratedSessionSelections: number;\n removedLegacyDirectory: boolean;\n removedLegacySelectionFile: boolean;\n}> {\n let migratedSessionSelections = 0;\n const entryNames = await readdir(sessionSelectionDir()).catch(() => []);\n for (const entryName of entryNames) {\n if (!entryName.endsWith(\".selected-profile.json\")) {\n continue;\n }\n const raw = await readFile(\n join(sessionSelectionDir(), entryName),\n \"utf8\"\n ).catch(() => null);\n if (!raw) {\n continue;\n }\n const parsed = parseLegacySelectionPayload(raw);\n if (!parsed) {\n continue;\n }\n const written = await writeCliContextState({\n sessionId: parsed.sessionId,\n sessionSource: parsed.sessionSource,\n selectedOpenMeldProfileId: parsed.openMeldProfileId,\n });\n if (written) {\n migratedSessionSelections += 1;\n }\n }\n\n const legacyDirectoryExists = entryNames.length > 0;\n if (legacyDirectoryExists) {\n await rm(sessionSelectionDir(), { recursive: true, force: true });\n }\n await migrateLegacyFallbackSelection();\n const removedLegacySelectionFile = await removeLegacySelectionFile();\n return {\n migratedSessionSelections,\n removedLegacyDirectory: legacyDirectoryExists,\n removedLegacySelectionFile,\n };\n}\n\nfunction selectionPath(sessionId: string): string {\n return join(\n sessionSelectionDir(),\n `${toSafeSessionFile(sessionId)}.selected-profile.json`\n );\n}\n\nfunction sessionSelectionDir(): string {\n return join(runtimeDir(), \"selected-openmeld-profiles\");\n}\n\nfunction legacySelectionPath(): string {\n return join(openMeldRootDir(), \"auth\", \"selected-profile.json\");\n}\n\nfunction fallbackSelectionPath(): string {\n return join(runtimeDir(), \"selected-profile-fallback.json\");\n}\n\nasync function readLegacySelectionPayload(\n sessionId: string\n): Promise<SelectedOpenMeldProfileV1 | null> {\n const raw = await readFile(selectionPath(sessionId), \"utf8\").catch(\n () => null\n );\n if (!raw) {\n return null;\n }\n return parseLegacySelectionPayload(raw);\n}\n\nasync function readFallbackSelectionPayload(): Promise<string | null> {\n const raw = await readFile(fallbackSelectionPath(), \"utf8\").catch(() => null);\n if (!raw) {\n const legacyFallback = await readLegacyFallbackSelection();\n if (!legacyFallback) {\n return null;\n }\n await writeFallbackSelectionPayload(legacyFallback.openMeldProfileId);\n await rm(legacySelectionPath(), { force: true }).catch(() => undefined);\n return legacyFallback.openMeldProfileId;\n }\n return parseLegacySelectionPayload(raw)?.openMeldProfileId ?? null;\n}\n\nasync function writeFallbackSelectionPayload(\n openMeldProfileId: string\n): Promise<void> {\n await mkdir(runtimeDir(), { recursive: true });\n const payload: SelectedOpenMeldProfileV1 = {\n v: 1,\n sessionId: FALLBACK_SELECTION_SESSION_ID,\n sessionSource: FALLBACK_SELECTION_SOURCE,\n openMeldProfileId,\n updatedAt: new Date().toISOString(),\n };\n await writeFile(\n fallbackSelectionPath(),\n `${JSON.stringify(payload, null, 2)}\\n`,\n \"utf8\"\n );\n}\n\nfunction parseLegacySelectionPayload(\n raw: string\n): SelectedOpenMeldProfileV1 | null {\n try {\n const payload = JSON.parse(raw) as Partial<SelectedOpenMeldProfileV1>;\n if (payload.v !== 1) {\n return null;\n }\n const sessionId = normalizeOptionalString(payload.sessionId);\n const openMeldProfileId = normalizeOptionalString(\n payload.openMeldProfileId\n );\n if (!(sessionId && openMeldProfileId)) {\n return null;\n }\n return {\n v: 1,\n sessionId,\n sessionSource: normalizeOptionalString(payload.sessionSource) ?? \"manual\",\n openMeldProfileId,\n updatedAt:\n normalizeOptionalString(payload.updatedAt) ?? new Date(0).toISOString(),\n };\n } catch {\n return null;\n }\n}\n\nasync function readLegacyFallbackSelection(): Promise<SelectedOpenMeldProfileV1 | null> {\n const raw = await readFile(legacySelectionPath(), \"utf8\").catch(() => null);\n if (!raw) {\n return null;\n }\n const parsed = parseLegacySelectionPayload(raw);\n if (parsed?.sessionSource !== FALLBACK_SELECTION_SOURCE) {\n return null;\n }\n return parsed;\n}\n\nasync function migrateLegacyFallbackSelection(): Promise<void> {\n const legacyFallback = await readLegacyFallbackSelection();\n if (!legacyFallback) {\n return;\n }\n const existingFallback = await readFile(\n fallbackSelectionPath(),\n \"utf8\"\n ).catch(() => null);\n if (!existingFallback) {\n await writeFallbackSelectionPayload(legacyFallback.openMeldProfileId);\n }\n}\n\nasync function removeLegacySelectionFile(): Promise<boolean> {\n const raw = await readFile(legacySelectionPath(), \"utf8\").catch(() => null);\n if (!raw) {\n return false;\n }\n await rm(legacySelectionPath(), { force: true }).catch(() => undefined);\n return true;\n}\n\nfunction toSafeSessionFile(value: string): string {\n const hash = createHash(\"sha1\")\n .update(value, \"utf8\")\n .digest(\"hex\")\n .slice(0, SESSION_FILE_HASH_LENGTH);\n const safeBaseRaw = value.replace(/[^a-zA-Z0-9._-]+/g, \"_\");\n const safeBase = safeBaseRaw.length > 0 ? safeBaseRaw : \"session\";\n const maxBaseLength = Math.max(\n 1,\n SESSION_FILE_MAX_LENGTH - SESSION_FILE_HASH_LENGTH - 1\n );\n const truncatedBase = safeBase.slice(0, maxBaseLength);\n return `${truncatedBase}-${hash}`;\n}\n\nfunction normalizeOptionalString(value: unknown): string | null {\n const normalized = String(value ?? \"\").trim();\n return normalized.length > 0 ? normalized : null;\n}\n\nfunction normalizeRequiredString(value: unknown, field: string): string {\n const normalized = normalizeOptionalString(value);\n if (!normalized) {\n throw new Error(`${field} is required`);\n }\n return normalized;\n}\n\nasync function removeFileIfPresent(path: string): Promise<boolean> {\n const raw = await readFile(path, \"utf8\").catch(() => null);\n if (raw === null) {\n return false;\n }\n await rm(path, { force: true }).catch(() => undefined);\n return true;\n}\n\nasync function removeDirectoryIfPresent(path: string): Promise<boolean> {\n const directory = await stat(path).catch(() => null);\n if (!directory?.isDirectory()) {\n return false;\n }\n await rm(path, { recursive: true, force: true }).catch(() => undefined);\n return true;\n}\n","import {\n createAuthenticationError,\n resolveAuthenticationGuidanceFromError,\n resolveAuthenticationReasonFromState,\n} from \"../auth/auth-guidance\";\nimport { formatInlineOpenMeldCliCommands } from \"../runtime/cli-entry-command\";\nimport { getAuthSessionState } from \"./auth-session\";\nimport {\n clearSelectedOpenMeldProfileId,\n getSelectedOpenMeldProfileId,\n setSelectedOpenMeldProfileId,\n} from \"./openmeld-profile-selection\";\nimport {\n type OpenMeldProfile,\n type OpenMeldProfileKind,\n resolveOpenMeldProfile,\n resolveOpenMeldProfileByIdOrName,\n} from \"./openmeld-profiles-api\";\n\nexport type ResolveOpenMeldProfileInput = {\n openMeldProfileId?: string;\n profileKind?: OpenMeldProfileKind;\n allowUnauthenticated?: boolean;\n persistSelection?: boolean;\n allowDefaultFallback?: boolean;\n authAction?: string;\n};\n\nconst PROFILE_REQUIRED_ERROR_ROOT =\n \"no OpenMeld profile is selected for this terminal session yet\";\nconst PROFILE_REQUIRED_ERROR_MESSAGE = `${PROFILE_REQUIRED_ERROR_ROOT}; run \\`openmeld start\\` to choose one, or pass \\`--profile <id>\\`.`;\nconst 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.`;\nconst PROFILE_REQUIRED_ERROR_PREFIX =\n \"no OpenMeld profile is selected for this terminal session yet; run `\";\nconst PROFILE_REQUIRED_ERROR_SUFFIX =\n \" start` to choose one, or pass `--profile <id>`.\";\n\nexport function isSelectedOpenMeldProfileRequiredError(\n error: unknown\n): boolean {\n if (!(error instanceof Error)) {\n return false;\n }\n\n if (error.message === PROFILE_REQUIRED_ERROR_MESSAGE) {\n return true;\n }\n\n if (\n error.message.includes(PROFILE_REQUIRED_ERROR_ROOT) &&\n error.message.includes(\"--profile <\")\n ) {\n return true;\n }\n\n return (\n error.message.startsWith(PROFILE_REQUIRED_ERROR_PREFIX) &&\n error.message.endsWith(PROFILE_REQUIRED_ERROR_SUFFIX)\n );\n}\n\nexport async function resolveOpenMeldProfileOrNull(\n input: ResolveOpenMeldProfileInput = {}\n): Promise<OpenMeldProfile | null> {\n const explicitOpenMeldProfileId = normalizeOptionalString(\n input.openMeldProfileId\n );\n if (explicitOpenMeldProfileId) {\n return await resolveExplicitOpenMeldProfile(explicitOpenMeldProfileId, {\n profileKind: input.profileKind,\n allowUnauthenticated: input.allowUnauthenticated === true,\n persistSelection: input.persistSelection !== false,\n });\n }\n\n const selectedOpenMeldProfileId = await getSelectedOpenMeldProfileId();\n if (selectedOpenMeldProfileId) {\n const selectedProfile = await resolveSelectedOpenMeldProfile(\n selectedOpenMeldProfileId,\n {\n profileKind: input.profileKind,\n allowUnauthenticated: input.allowUnauthenticated === true,\n }\n );\n if (selectedProfile) {\n return selectedProfile;\n }\n }\n\n if (input.allowUnauthenticated === true) {\n const authState = await getAuthSessionState({\n validateRemote: false,\n });\n if (authState.state !== \"valid\") {\n return null;\n }\n }\n\n if (input.allowDefaultFallback !== true) {\n return null;\n }\n\n let fallbackProfile: OpenMeldProfile;\n try {\n fallbackProfile = await resolveOpenMeldProfile({\n profileKind: input.profileKind,\n });\n } catch (error) {\n if (input.allowUnauthenticated === true && isAuthRequiredError(error)) {\n return null;\n }\n throw error;\n }\n if (input.persistSelection !== false) {\n await setSelectedOpenMeldProfileId(fallbackProfile.openMeldProfileId);\n }\n return fallbackProfile;\n}\n\nasync function resolveExplicitOpenMeldProfile(\n openMeldProfileId: string,\n input: {\n profileKind?: OpenMeldProfileKind;\n allowUnauthenticated: boolean;\n persistSelection: boolean;\n }\n): Promise<OpenMeldProfile | null> {\n try {\n const profile = await resolveOpenMeldProfileByIdOrName({\n profileIdentifier: openMeldProfileId,\n profileKind: input.profileKind,\n });\n if (input.persistSelection) {\n await setSelectedOpenMeldProfileId(profile.openMeldProfileId);\n }\n return profile;\n } catch (error) {\n if (isAuthRequiredError(error) && input.allowUnauthenticated) {\n return null;\n }\n throw error;\n }\n}\n\nexport async function requireOpenMeldProfile(\n input: ResolveOpenMeldProfileInput = {}\n): Promise<OpenMeldProfile> {\n const profile = await resolveOpenMeldProfileOrNull(input);\n if (profile) {\n return profile;\n }\n\n const authState = await getAuthSessionState({\n validateRemote: false,\n });\n if (authState.state === \"valid\") {\n throw new Error(\n formatInlineOpenMeldCliCommands(\n resolveProfileRequiredErrorMessage(input.authAction)\n )\n );\n }\n const reason = resolveAuthenticationReasonFromState(authState.state);\n throw createAuthenticationError({\n reason: reason ?? \"required\",\n action: input.authAction,\n });\n}\n\nfunction resolveProfileRequiredErrorMessage(authAction?: string): string {\n if (authAction === \"reading a dispatch trace\") {\n return SERVICE_TRACE_PROFILE_REQUIRED_ERROR_MESSAGE;\n }\n\n return PROFILE_REQUIRED_ERROR_MESSAGE;\n}\n\nasync function resolveSelectedOpenMeldProfile(\n selectedOpenMeldProfileId: string,\n input: {\n profileKind?: OpenMeldProfileKind;\n allowUnauthenticated: boolean;\n }\n): Promise<OpenMeldProfile | null> {\n try {\n return await resolveOpenMeldProfile({\n openMeldProfileId: selectedOpenMeldProfileId,\n profileKind: input.profileKind,\n });\n } catch (error) {\n if (isAuthRequiredError(error)) {\n if (input.allowUnauthenticated) {\n return null;\n }\n throw error;\n }\n\n if (isProfileMissingError(error)) {\n await clearSelectedOpenMeldProfileId();\n return null;\n }\n\n throw error;\n }\n}\n\nfunction normalizeOptionalString(value: unknown): string | null {\n const normalized = String(value ?? \"\").trim();\n return normalized.length > 0 ? normalized : null;\n}\n\nfunction isAuthRequiredError(error: unknown): boolean {\n return resolveAuthenticationGuidanceFromError(error) !== null;\n}\n\nfunction isProfileMissingError(error: unknown): boolean {\n const code =\n error && typeof error === \"object\" && \"code\" in error\n ? String((error as { code?: unknown }).code ?? \"\")\n : \"\";\n if (code === \"profile.not_found\") {\n return true;\n }\n\n const message = error instanceof Error ? error.message : String(error ?? \"\");\n return message.includes(\"profile not found\");\n}\n","import { openMeldProfileIdSchema } from \"@openmeld/schemas\";\nimport { getSelectedOpenMeldProfileId } from \"./openmeld-profile-selection\";\nimport { resolveOpenMeldProfileByIdOrName } from \"./openmeld-profiles-api\";\n\nexport async function resolveViewProfileKey(\n inputProfile?: string\n): Promise<string | null> {\n const explicit = normalizeOptionalString(inputProfile);\n if (explicit) {\n const profileId = openMeldProfileIdSchema.safeParse(explicit);\n if (profileId.success) {\n return profileId.data;\n }\n const profile = await resolveOpenMeldProfileByIdOrName({\n profileIdentifier: explicit,\n }).catch(() => null);\n return profile?.openMeldProfileId ?? explicit;\n }\n\n const selected = await getSelectedOpenMeldProfileId();\n if (selected) {\n return selected;\n }\n\n return null;\n}\n\nfunction normalizeOptionalString(value: unknown): string | null {\n const normalized = String(value ?? \"\").trim();\n return normalized.length > 0 ? normalized : null;\n}\n","import { getProfileDefaultView } from \"../config/profile-view\";\nimport { resolveOpenMeldProfileOrNull } from \"../config/resolve-openmeld-profile\";\nimport {\n getConfiguredViewCustomization,\n type RuntimeViewCustomization,\n} from \"../config/runtime-config\";\nimport { resolveViewProfileKey } from \"../config/view-profile-key\";\nimport type { CliViewMode, RuntimeContext } from \"./types\";\n\nexport type { CliViewMode, RuntimeContext } from \"./types\";\n\nexport async function resolveRuntimeContext(input?: {\n view?: string;\n profile?: string;\n interactive?: boolean;\n}): Promise<RuntimeContext> {\n const viewOpenMeldProfileId = await resolveViewProfileKey(input?.profile);\n const configuredViewMode = await readConfiguredDefaultView(\n viewOpenMeldProfileId\n );\n const viewMode = parseCliViewMode(input?.view ?? configuredViewMode);\n const interactive = input?.interactive ?? isInteractiveSession();\n const viewCustomization = await readViewCustomization();\n\n if (viewMode === \"human\" || viewMode === \"agent\") {\n return {\n viewMode,\n resolvedView: viewMode,\n interactive,\n ...(viewOpenMeldProfileId\n ? { openMeldProfileId: viewOpenMeldProfileId }\n : {}),\n ...(viewCustomization ? { viewCustomization } : {}),\n };\n }\n\n const openMeldProfile = await resolveOpenMeldProfileOrNull({\n openMeldProfileId: input?.profile,\n allowUnauthenticated: true,\n persistSelection: false,\n allowDefaultFallback: false,\n }).catch(() => null);\n const resolvedView =\n openMeldProfile?.profileKind === \"agent\" ? \"agent\" : \"human\";\n const resolvedOpenMeldProfileId = openMeldProfile\n ? openMeldProfile.openMeldProfileId\n : viewOpenMeldProfileId;\n\n return {\n viewMode,\n resolvedView,\n interactive,\n ...(resolvedOpenMeldProfileId\n ? { openMeldProfileId: resolvedOpenMeldProfileId }\n : {}),\n ...(openMeldProfile?.profileKind\n ? { profileKind: openMeldProfile.profileKind }\n : {}),\n ...(viewCustomization ? { viewCustomization } : {}),\n };\n}\n\nexport function parseCliViewMode(value?: string): CliViewMode {\n const normalized = String(value ?? \"auto\")\n .trim()\n .toLowerCase();\n if (\n normalized === \"auto\" ||\n normalized === \"human\" ||\n normalized === \"agent\"\n ) {\n return normalized;\n }\n\n throw new Error(`invalid --view value: ${normalized} (use auto|human|agent)`);\n}\n\nfunction readViewCustomization(): Promise<RuntimeViewCustomization | null> {\n return getConfiguredViewCustomization().catch(() => null);\n}\n\nfunction readConfiguredDefaultView(\n openMeldProfileId?: string | null\n): Promise<CliViewMode> {\n if (!openMeldProfileId) {\n return Promise.resolve(\"auto\");\n }\n return getProfileDefaultView(openMeldProfileId).catch(() => \"auto\");\n}\n\nfunction isInteractiveSession(): boolean {\n return Boolean(process.stdin.isTTY && process.stdout.isTTY);\n}\n"],"mappings":";;;;;;;;;;;;AAyBA,eAAsB,sBACpB,mBAC6B;CAC7B,MAAM,8BACJ,2BAA2B,iBAAiB;CAC9C,MAAM,OAAO,MAAM,8BAA8B,2BAA2B;CAC5E,MAAM,MAAM,MAAM,SAAS,MAAM,MAAM,CAAC,CAAC,YAAY,IAAI;CACzD,IAAI,CAAC,KACH,OAAO;CAGT,IAAI;EACF,MAAM,SAAS,KAAK,MAAM,GAAG;EAC7B,IAAI,OAAO,MAAM,GACf,OAAO;EAET,MAAM,8BAA8B,2BAA2B,MAAM;EACrE,IAAI,CAAC,6BACH,OAAO;EAET,IACE,4BAA4B,QAAQ,sBACpC,6BACA;GACA,MAAM,GAAG,MAAM,EAAE,OAAO,KAAK,CAAC;GAC9B,OAAO;EACT;EACA,IAAI,4BAA4B,cAC9B,MAAM,qBAAqB,MAAM,4BAA4B,OAAO;EAEtE,OAAO,4BAA4B,QA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kBAAkB,IAAI,CAAC;CACnD;CAGF,MAAM,kBAAkB,MAAM,6BAA6B;EACzD,mBAAmB,OAAO;EAC1B,sBAAsB;EACtB,kBAAkB;EAClB,sBAAsB;CACxB,CAAC,CAAC,CAAC,YAAY,IAAI;CACnB,MAAM,eACJ,iBAAiB,gBAAgB,UAAU,UAAU;CACvD,MAAM,4BAA4B,kBAC9B,gBAAgB,oBAChB;CAEJ,OAAO;EACL;EACA;EACA;EACA,GAAI,4BACA,EAAE,mBAAmB,0BAA0B,IAC/C,CAAC;EACL,GAAI,iBAAiB,cACjB,EAAE,aAAa,gBAAgB,YAAY,IAC3C,CAAC;EACL,GAAI,oBAAoB,EAAE,kBAAkB,IAAI,CAAC;CACnD;AACF;AAEA,SAAgB,iBAAiB,OAA6B;CAC5D,MAAM,aAAa,OAAO,SAAS,MAAM,CAAC,CACvC,KAAK,CAAC,CACN,YAAY;CACf,IACE,eAAe,UACf,eAAe,WACf,eAAe,SAEf,OAAO;CAGT,MAAM,IAAI,MAAM,yBAAyB,WAAW,wBAAwB;AAC9E;AAEA,SAAS,wBAAkE;CACzE,OAAO,+BAA+B,CAAC,CAAC,YAAY,IAAI;AAC1D;AAEA,SAAS,0BACP,mBACsB;CACtB,IAAI,CAAC,mBACH,OAAO,QAAQ,QAAQ,MAAM;CAE/B,OAAO,sBAAsB,iBAAiB,CAAC,CAAC,YAAY,MAAM;AACpE;AAEA,SAAS,uBAAgC;CACvC,OAAO,QAAQ,QAAQ,MAAM,SAAS,QAAQ,OAAO,KAAK;AAC5D"}
@@ -3,11 +3,11 @@
3
3
  import { t as isLoopbackHostname } from "./loopback-hostname-DHQPKq8N.js";
4
4
  import { A as OPENMELD_HOME_ENV_KEY, gt as systemDir, q as normalizeAccountKey } from "./lock-Bsl_ElWy.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-BLtOFrtv.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-DOjVKRI_.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-KEwcSZ89.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-BAq7KkIa.js";
8
8
  import { E as agentProfileIdSchema, b as skippedDaemonProfileSchema } from "./control-plane-BDS63N7Y.js";
9
9
  import { r as daemonServiceLaneSchema } from "./service-contract-CRyDcIIf.js";
10
- import { n as agentControllerPermissionModeSchema, r as agentControllerCollaborationModeSchema, t as openCodePermissionConfigSchema } from "./open-code-permission-Doem1R2N.js";
10
+ import { n as agentControllerPermissionModeSchema, r as agentControllerCollaborationModeSchema, t as openCodePermissionConfigSchema } from "./open-code-permission-DHFJYc_o.js";
11
11
  import { h as daemonRuntimeRootPath, m as daemonRuntimeDataPath } from "./daemon-state-B44aq2nm.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";
@@ -90,7 +90,7 @@ function resolveOpenMeldAccountContext(input) {
90
90
  };
91
91
  }
92
92
  async function resolveCurrentOpenMeldAccountContext() {
93
- const { getAuthSessionMetadata } = await import("./auth-session-D7oAIuHk.js");
93
+ const { getAuthSessionMetadata } = await import("./auth-session-D-HTJNKZ.js");
94
94
  return resolveOpenMeldAccountContext({ session: await getAuthSessionMetadata().catch(() => null) });
95
95
  }
96
96
  function resolveHostKey(baseUrl) {
@@ -985,4 +985,4 @@ async function migrateLegacyDaemonDeviceId(input) {
985
985
  //#endregion
986
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 };
987
987
 
988
- //# sourceMappingURL=daemon-device-id-bfkbZj9G.js.map
988
+ //# sourceMappingURL=daemon-device-id-bP58j3NL.js.map