openmeld 0.3.222 → 0.3.224

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (177) hide show
  1. package/dist/{add-me-membership-Wc69O6rA.js → add-me-membership-CGISMRPF.js} +2 -2
  2. package/dist/{add-me-membership-Wc69O6rA.js.map → add-me-membership-CGISMRPF.js.map} +1 -1
  3. package/dist/{agents-B8zhQnGw.js → agents-CR7BebgO.js} +12 -12
  4. package/dist/{agents-B8zhQnGw.js.map → agents-CR7BebgO.js.map} +1 -1
  5. package/dist/{api-client-foundation-DTiFoGpI.js → api-client-foundation-CqbIn_de.js} +1 -1
  6. package/dist/{api-client-foundation-DnJ_JYli.js → api-client-foundation-DpVwrgh-.js} +3 -3
  7. package/dist/{api-client-foundation-DnJ_JYli.js.map → api-client-foundation-DpVwrgh-.js.map} +1 -1
  8. package/dist/auth-session-BJfKu74u.js +4 -0
  9. package/dist/{auth-session-nhS8jyux.js → auth-session-uEk_Tx6T.js} +8 -8
  10. package/dist/auth-session-uEk_Tx6T.js.map +1 -0
  11. package/dist/{base-url-CMBApK1J.js → base-url-DXrUiSMI.js} +1 -1
  12. package/dist/{base-url-D7uE_xTo.js → base-url-DvjOkKPs.js} +2 -2
  13. package/dist/{base-url-D7uE_xTo.js.map → base-url-DvjOkKPs.js.map} +1 -1
  14. package/dist/{channel-ggx0o_aG.js → channel-B2fD2_be.js} +4 -4
  15. package/dist/{channel-ggx0o_aG.js.map → channel-B2fD2_be.js.map} +1 -1
  16. package/dist/{cli-binary-manifest-DiUulkp0.js → cli-binary-manifest-CT5X05lk.js} +30 -4
  17. package/dist/cli-binary-manifest-CT5X05lk.js.map +1 -0
  18. package/dist/{command-Bz9x7V2T.js → command-CQ9XRwqf.js} +22 -165
  19. package/dist/command-CQ9XRwqf.js.map +1 -0
  20. package/dist/{computer-connection-M3N6plkj.js → computer-connection-Dm7iTnRK.js} +2 -2
  21. package/dist/{computer-connection-M3N6plkj.js.map → computer-connection-Dm7iTnRK.js.map} +1 -1
  22. package/dist/{computer-connection-review-DY5BK_27.js → computer-connection-review-RHAoddSS.js} +6 -6
  23. package/dist/{computer-connection-review-DY5BK_27.js.map → computer-connection-review-RHAoddSS.js.map} +1 -1
  24. package/dist/{computer-disconnect-DR1WDSPK.js → computer-disconnect-BWRsge_2.js} +10 -10
  25. package/dist/{computer-disconnect-DR1WDSPK.js.map → computer-disconnect-BWRsge_2.js.map} +1 -1
  26. package/dist/{computer-setup-continuation-2gs8z-nB.js → computer-setup-continuation-BOCRH0qq.js} +4 -4
  27. package/dist/{computer-setup-continuation-2gs8z-nB.js.map → computer-setup-continuation-BOCRH0qq.js.map} +1 -1
  28. package/dist/context-Bdh3nAzw.js +162 -0
  29. package/dist/context-Bdh3nAzw.js.map +1 -0
  30. package/dist/{control-plane-e3W6PD2M.js → control-plane-rTE2rHZ5.js} +2 -2
  31. package/dist/{control-plane-e3W6PD2M.js.map → control-plane-rTE2rHZ5.js.map} +1 -1
  32. package/dist/{daemon-device-id-DWO9_QW6.js → daemon-device-id-B1Af2Zmn.js} +344 -36
  33. package/dist/daemon-device-id-B1Af2Zmn.js.map +1 -0
  34. package/dist/{daemon-frame-transport-D2-tazuK.js → daemon-frame-transport-WiB73yhT.js} +519 -12
  35. package/dist/daemon-frame-transport-WiB73yhT.js.map +1 -0
  36. package/dist/{daemon-lifecycle-journal-DyKx1xzm.js → daemon-lifecycle-journal-CDZLWgMj.js} +11 -11
  37. package/dist/daemon-lifecycle-journal-CDZLWgMj.js.map +1 -0
  38. package/dist/{daemon-runtime-lease-BUr4qsLo.js → daemon-runtime-lease-1LMeZ6IS.js} +2 -2
  39. package/dist/{daemon-runtime-lease-BUr4qsLo.js.map → daemon-runtime-lease-1LMeZ6IS.js.map} +1 -1
  40. package/dist/{daemon-runtime-lease-C9X8xV_F.js → daemon-runtime-lease-Bz0ucJj3.js} +1 -1
  41. package/dist/{daemon-service-contract-BpOBMGX0.js → daemon-service-contract-GLmAxsq-.js} +4 -4
  42. package/dist/{daemon-service-contract-BpOBMGX0.js.map → daemon-service-contract-GLmAxsq-.js.map} +1 -1
  43. package/dist/{daemon-service-manager-HL4VKbIU.js → daemon-service-manager-C8RUCMDo.js} +9 -7
  44. package/dist/daemon-service-manager-C8RUCMDo.js.map +1 -0
  45. package/dist/{daemon-service-manager-B-QrDe5p.js → daemon-service-manager-CU-79a4z.js} +1 -1
  46. package/dist/{daemon-service-runtime-bKt0YjC7.js → daemon-service-runtime-CBJtgM4P.js} +397 -51
  47. package/dist/daemon-service-runtime-CBJtgM4P.js.map +1 -0
  48. package/dist/{daemon-service-update-coordinator-D8O1uTtu.js → daemon-service-update-coordinator-0LB_XGVZ.js} +48 -33
  49. package/dist/daemon-service-update-coordinator-0LB_XGVZ.js.map +1 -0
  50. package/dist/{daemon-state-B44aq2nm.js → daemon-state-Ca0WK5x0.js} +3 -3
  51. package/dist/{daemon-state-B44aq2nm.js.map → daemon-state-Ca0WK5x0.js.map} +1 -1
  52. package/dist/{dist-B07ziN_u.js → dist-BeJcIdCZ.js} +25 -17
  53. package/dist/dist-BeJcIdCZ.js.map +1 -0
  54. package/dist/dist-C32frPV2.js +4 -0
  55. package/dist/{dist-B2EauBG6.js → dist-YbTZ-Y-2.js} +16 -12
  56. package/dist/dist-YbTZ-Y-2.js.map +1 -0
  57. package/dist/{elapsed-time-Ooo4IC25.js → elapsed-time-q8lSPcfm.js} +6 -6
  58. package/dist/{elapsed-time-Ooo4IC25.js.map → elapsed-time-q8lSPcfm.js.map} +1 -1
  59. package/dist/{entry-DeIRMCiW.js → entry-CpS6tnIk.js} +12 -12
  60. package/dist/{entry-DeIRMCiW.js.map → entry-CpS6tnIk.js.map} +1 -1
  61. package/dist/{installation-inventory-DThnBEhV.js → installation-inventory-C5FsAvrf.js} +5 -5
  62. package/dist/{installation-inventory-DThnBEhV.js.map → installation-inventory-C5FsAvrf.js.map} +1 -1
  63. package/dist/{installer-D2bWZT88.js → installer-054NLJg6.js} +2 -2
  64. package/dist/{installer-D2bWZT88.js.map → installer-054NLJg6.js.map} +1 -1
  65. package/dist/io-DT66typ4.js +16 -0
  66. package/dist/io-DT66typ4.js.map +1 -0
  67. package/dist/{local-components-B6SCXZf9.js → local-components-DleLEzSU.js} +2 -1
  68. package/dist/local-components-DleLEzSU.js.map +1 -0
  69. package/dist/{lock-Bsl_ElWy.js → lock-iue1J2xy.js} +8 -5
  70. package/dist/lock-iue1J2xy.js.map +1 -0
  71. package/dist/{cli-space-api-CQtKu9Zt.js → meta-api-B1k3mwHN.js} +203 -19
  72. package/dist/meta-api-B1k3mwHN.js.map +1 -0
  73. package/dist/{openmeld-BQy0nMox.js → openmeld-BFO3sfC_.js} +93 -1027
  74. package/dist/openmeld-BFO3sfC_.js.map +1 -0
  75. package/dist/openmeld-dev.js +1 -1
  76. package/dist/{openmeld-environment-target-B6HqY0_a.js → openmeld-environment-target-BBn5Ko6p.js} +3 -3
  77. package/dist/{openmeld-environment-target-B6HqY0_a.js.map → openmeld-environment-target-BBn5Ko6p.js.map} +1 -1
  78. package/dist/{openmeld-maintenance-worker-BSODPHbn.js → openmeld-maintenance-worker-Ce4ehQ-c.js} +15 -14
  79. package/dist/openmeld-maintenance-worker-Ce4ehQ-c.js.map +1 -0
  80. package/dist/{openmeld-tools-update-join-BfY0GnDs.js → openmeld-tools-update-join-D24llJ9L.js} +4 -4
  81. package/dist/{openmeld-tools-update-join-BfY0GnDs.js.map → openmeld-tools-update-join-D24llJ9L.js.map} +1 -1
  82. package/dist/{openmeld-tools-update-process-frame-B-XB4dmO.js → openmeld-tools-update-process-frame-BtFKp70p.js} +2 -2
  83. package/dist/{openmeld-tools-update-process-frame-B-XB4dmO.js.map → openmeld-tools-update-process-frame-BtFKp70p.js.map} +1 -1
  84. package/dist/{openmeld-tools-update-process-frame-j-RXwFsK.js → openmeld-tools-update-process-frame-DbEZ3fEh.js} +1 -1
  85. package/dist/openmeld.js +9 -5
  86. package/dist/openmeld.js.map +1 -1
  87. package/dist/{prepare-provider-runtime-CWZcuMF6.js → prepare-provider-runtime-MB-BxOgt.js} +3342 -1327
  88. package/dist/prepare-provider-runtime-MB-BxOgt.js.map +1 -0
  89. package/dist/{prepare-session-executor-CkDxstsf.js → prepare-session-executor-zvSZ6jqy.js} +29 -28
  90. package/dist/prepare-session-executor-zvSZ6jqy.js.map +1 -0
  91. package/dist/{presenter-BcxiQyJg.js → presenter-MJ5YgsOT.js} +3 -13
  92. package/dist/presenter-MJ5YgsOT.js.map +1 -0
  93. package/dist/{process-channel-BQwtOlRc.js → process-channel-CgbduFCz.js} +2 -2
  94. package/dist/{process-channel-BQwtOlRc.js.map → process-channel-CgbduFCz.js.map} +1 -1
  95. package/dist/process-environment-BWSFeUu6.js +49 -0
  96. package/dist/process-environment-BWSFeUu6.js.map +1 -0
  97. package/dist/process-identity-BQLdaZdB.js +190 -0
  98. package/dist/process-identity-BQLdaZdB.js.map +1 -0
  99. package/dist/process-launch-B0pHlkV_.js +173 -0
  100. package/dist/process-launch-B0pHlkV_.js.map +1 -0
  101. package/dist/{published-production-safety-dp-fOmmB.js → published-production-safety-C40hKrBA.js} +2 -2
  102. package/dist/{published-production-safety-dp-fOmmB.js.map → published-production-safety-C40hKrBA.js.map} +1 -1
  103. package/dist/{runtime-BYaFkkLK.js → runtime-D6jItuQ-.js} +155 -702
  104. package/dist/runtime-D6jItuQ-.js.map +1 -0
  105. package/dist/{runtime-agent-controller-reporting-submission-BUUub9_1.js → runtime-agent-controller-reporting-submission-D9ysbi7R.js} +9 -9
  106. package/dist/{runtime-agent-controller-reporting-submission-BUUub9_1.js.map → runtime-agent-controller-reporting-submission-D9ysbi7R.js.map} +1 -1
  107. package/dist/{runtime-reporting-health-state-BgwfrH7f.js → runtime-reporting-health-state-DA-_vW-n.js} +2210 -60
  108. package/dist/runtime-reporting-health-state-DA-_vW-n.js.map +1 -0
  109. package/dist/{runtime-transport-Cc_RN-PL.js → runtime-transport-YIYHSJPn.js} +99 -14
  110. package/dist/runtime-transport-YIYHSJPn.js.map +1 -0
  111. package/dist/{service-CfO38_a-.js → service-Dz2MsvGr.js} +126 -550
  112. package/dist/service-Dz2MsvGr.js.map +1 -0
  113. package/dist/{service-account-admission-Dy2W3n3_.js → service-account-admission-BfdJ-kKR.js} +18 -10
  114. package/dist/service-account-admission-BfdJ-kKR.js.map +1 -0
  115. package/dist/{service-account-authorization-DKpIpxXo.js → service-account-authorization-DZbUOD29.js} +6 -6
  116. package/dist/{service-account-authorization-DKpIpxXo.js.map → service-account-authorization-DZbUOD29.js.map} +1 -1
  117. package/dist/{service-account-control-CCPQAZzn.js → service-account-control-DCMOKXDT.js} +16 -16
  118. package/dist/service-account-control-DCMOKXDT.js.map +1 -0
  119. package/dist/{service-control-capabilities-C9UHSMPz.js → service-control-capabilities-3_bdeHXu.js} +1 -1
  120. package/dist/{service-control-capabilities-xGylBNoH.js → service-control-capabilities-Bb738e_d.js} +19 -15
  121. package/dist/service-control-capabilities-Bb738e_d.js.map +1 -0
  122. package/dist/{service-control-carrier-capability-DDNyE5cB.js → service-control-carrier-capability-gMk5gMKU.js} +11 -4
  123. package/dist/service-control-carrier-capability-gMk5gMKU.js.map +1 -0
  124. package/dist/{state-CQG3k9eh.js → state-GxF_KAM1.js} +4 -4
  125. package/dist/{state-CQG3k9eh.js.map → state-GxF_KAM1.js.map} +1 -1
  126. package/dist/{upgrade-D5FxGbh1.js → upgrade-DfJwCD5H.js} +52 -32
  127. package/dist/upgrade-DfJwCD5H.js.map +1 -0
  128. package/dist/upgrade-DgmYWeNu.js +4 -0
  129. package/dist/windows/openmeld-windows-process.exe +0 -0
  130. package/dist/windows-artifact-DJ9DKjfc.js +16 -0
  131. package/dist/windows-artifact-DJ9DKjfc.js.map +1 -0
  132. package/dist/windows-task-command-COu_6Ke3.js +74 -0
  133. package/dist/windows-task-command-COu_6Ke3.js.map +1 -0
  134. package/dist/windows-task-entry-CtRpUbiK.js +50 -0
  135. package/dist/windows-task-entry-CtRpUbiK.js.map +1 -0
  136. package/dist/{windows-user-task-Bx2yYnOM.js → windows-user-task-B8NcRg_u.js} +1 -1
  137. package/dist/{windows-user-task-CRGbKggi.js → windows-user-task-Io5QuEVR.js} +108 -51
  138. package/dist/windows-user-task-Io5QuEVR.js.map +1 -0
  139. package/package.json +12 -12
  140. package/skills/openmeld-cli/playbooks/space-ops.md +9 -3
  141. package/skills/openmeld-cli/references/commands.md +0 -1
  142. package/dist/auth-session-D8dbMpaK.js +0 -4
  143. package/dist/auth-session-nhS8jyux.js.map +0 -1
  144. package/dist/cli-binary-manifest-DiUulkp0.js.map +0 -1
  145. package/dist/cli-space-api-CQtKu9Zt.js.map +0 -1
  146. package/dist/command-Bz9x7V2T.js.map +0 -1
  147. package/dist/context-l_31Mn4X.js +0 -473
  148. package/dist/context-l_31Mn4X.js.map +0 -1
  149. package/dist/daemon-device-id-DWO9_QW6.js.map +0 -1
  150. package/dist/daemon-frame-transport-D2-tazuK.js.map +0 -1
  151. package/dist/daemon-lifecycle-journal-DyKx1xzm.js.map +0 -1
  152. package/dist/daemon-service-manager-HL4VKbIU.js.map +0 -1
  153. package/dist/daemon-service-runtime-bKt0YjC7.js.map +0 -1
  154. package/dist/daemon-service-update-coordinator-D8O1uTtu.js.map +0 -1
  155. package/dist/dist-B07ziN_u.js.map +0 -1
  156. package/dist/dist-B2EauBG6.js.map +0 -1
  157. package/dist/dist-DhWI1iyi.js +0 -4
  158. package/dist/local-components-B6SCXZf9.js.map +0 -1
  159. package/dist/lock-Bsl_ElWy.js.map +0 -1
  160. package/dist/openmeld-BQy0nMox.js.map +0 -1
  161. package/dist/openmeld-maintenance-worker-BSODPHbn.js.map +0 -1
  162. package/dist/prepare-provider-runtime-CWZcuMF6.js.map +0 -1
  163. package/dist/prepare-session-executor-CkDxstsf.js.map +0 -1
  164. package/dist/presenter-BcxiQyJg.js.map +0 -1
  165. package/dist/process-identity-CNus0e6E.js +0 -146
  166. package/dist/process-identity-CNus0e6E.js.map +0 -1
  167. package/dist/runtime-BYaFkkLK.js.map +0 -1
  168. package/dist/runtime-reporting-health-state-BgwfrH7f.js.map +0 -1
  169. package/dist/runtime-transport-Cc_RN-PL.js.map +0 -1
  170. package/dist/service-CfO38_a-.js.map +0 -1
  171. package/dist/service-account-admission-Dy2W3n3_.js.map +0 -1
  172. package/dist/service-account-control-CCPQAZzn.js.map +0 -1
  173. package/dist/service-control-capabilities-xGylBNoH.js.map +0 -1
  174. package/dist/service-control-carrier-capability-DDNyE5cB.js.map +0 -1
  175. package/dist/upgrade-D5FxGbh1.js.map +0 -1
  176. package/dist/upgrade-DhFEu0k6.js +0 -4
  177. package/dist/windows-user-task-CRGbKggi.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"channel-ggx0o_aG.js","names":[],"sources":["../../../packages/schemas/dist/service-execution-host.js","../src/local-service/execution-host/channel.ts"],"sourcesContent":["import { daemonServiceLaneSchema } from \"./schemas/daemon/service-contract.js\";\nimport { providerDispatchRuntimeContextSchema } from \"./schemas/daemon/provider-runtime-context.js\";\nimport { openMeldDaemonCancelPayloadSchema, openMeldDaemonCancelRequestPayloadSchema, openMeldDaemonConversationExecutionStatusPayloadSchema, openMeldDaemonConversationExecutionStatusRequestPayloadSchema, openMeldDaemonInterruptPayloadSchema, openMeldDaemonInterruptRequestPayloadSchema, openMeldDaemonSetLocalAgentEnabledPayloadSchema, openMeldDaemonSetLocalAgentEnabledRequestPayloadSchema, skippedDaemonProfileSchema } from \"./schemas/daemon/control-plane.js\";\nimport { daemonStreamFrameSchema, localWakeRouteWorkingFolderObservationSchema, runtimeTransportLeaseSchema } from \"./schemas/daemon/runtime-transport.js\";\nimport { cachedDaemonRouteConfigSchema } from \"./schemas/daemon/route-catalog-cache.js\";\nimport * as z$1 from \"zod/v4\";\n//#region src/service-execution-host.ts\nconst SERVICE_EXECUTION_HOST_PROTOCOL = \"service-execution-host-v1\";\nconst SERVICE_EXECUTION_HOST_MAX_FRAME_BYTES = 8 * 1024 * 1024;\nconst SERVICE_EXECUTION_HOST_MAX_PENDING_REQUESTS = 64;\nconst identityString = z$1.string().min(1).max(1024);\nconst count = z$1.number().int().nonnegative();\nconst empty = z$1.strictObject({});\nconst serviceExecutionHostIdentitySchema = z$1.strictObject({\n\townerUserId: identityString,\n\tdeviceId: identityString,\n\tlane: daemonServiceLaneSchema,\n\tdaemonSessionId: identityString,\n\tserviceContractGeneration: count,\n\tsessionIdentity: identityString,\n\tstateRoot: z$1.string().min(1).max(4096),\n\tauthBaseUrl: z$1.url(),\n\tgatewayBaseUrl: z$1.url(),\n\tparentPid: z$1.number().int().positive(),\n\tparentProcessStartedAt: identityString\n});\nconst serviceExecutionHostSnapshotSchema = z$1.strictObject({\n\tpid: z$1.number().int().positive(),\n\tadmission: z$1.enum([\"open\", \"draining\"]),\n\tactiveCount: count,\n\tpendingCount: count,\n\tlocalQuiescent: z$1.boolean(),\n\tunacknowledgedResultCount: count,\n\tstartupReplayPending: z$1.boolean(),\n\tadapterIds: z$1.array(identityString).max(256)\n});\nconst serviceExecutionHostOwnerSchema = z$1.strictObject({\n\tschema: z$1.literal(\"service-execution-host-owner-v1\"),\n\thostInstanceId: z$1.uuid(),\n\townerUserId: identityString,\n\tdeviceId: identityString,\n\tlane: daemonServiceLaneSchema,\n\tpid: z$1.number().int().positive(),\n\tbootIdentity: identityString.nullable(),\n\tlocalQuiescent: z$1.boolean()\n});\nconst profileWorkingFolderFactSchema = z$1.strictObject({\n\tdefaultProjectId: identityString.nullable(),\n\tlocalProjectBindingGeneration: identityString.nullable(),\n\tobservedAtMs: count,\n\treasonCode: z$1.enum([\n\t\t\"profile.workspace.invalid\",\n\t\t\"profile.workspace.missing\",\n\t\t\"project.local_connection.folder_missing\",\n\t\t\"project.local_connection.invalid\",\n\t\t\"project.local_connection.missing\"\n\t]).nullable(),\n\tsource: z$1.enum([\"default_project\", \"profile_workspace\"]),\n\tstatus: z$1.enum([\n\t\t\"invalid\",\n\t\t\"missing\",\n\t\t\"ready\"\n\t])\n});\nconst readyWorkingFolder = {\n\tconfiguredWorkspacePath: z$1.string().min(1),\n\teffectiveRuntimeWorkingDirectory: z$1.string().min(1),\n\truntimeContext: providerDispatchRuntimeContextSchema,\n\tstatus: z$1.literal(\"ready\"),\n\tworkingFolderFact: profileWorkingFolderFactSchema\n};\nconst serviceExecutionHostRouteSchema = cachedDaemonRouteConfigSchema.extend({\n\tagentControllerConversationId: identityString.nullable().optional(),\n\tworkingFolderRuntime: z$1.discriminatedUnion(\"workingFolderSource\", [z$1.strictObject({\n\t\t...readyWorkingFolder,\n\t\tconfigPath: z$1.string().min(1),\n\t\tworkspaceMode: z$1.enum([\"openmeld_managed\", \"custom\"]),\n\t\tworkingFolderSource: z$1.literal(\"profile_workspace\")\n\t}), z$1.strictObject({\n\t\t...readyWorkingFolder,\n\t\tconfigPath: z$1.null(),\n\t\tworkspaceMode: z$1.null(),\n\t\tdefaultProjectId: identityString,\n\t\tdefaultProjectBindingGeneration: identityString,\n\t\tworkingFolderSource: z$1.literal(\"default_project\")\n\t})]).optional()\n});\nconst serviceExecutionHostCatalogSchema = z$1.strictObject({\n\trevision: z$1.number().int().positive(),\n\texpectedRoutesContractVersion: z$1.literal(\"v4\").optional(),\n\tprofileIds: z$1.array(identityString).max(1e4),\n\troutes: z$1.array(serviceExecutionHostRouteSchema).max(1e4),\n\tskippedProfiles: z$1.array(skippedDaemonProfileSchema).max(1e4),\n\tworkingFolderExpectedProfileIds: z$1.array(identityString).max(1e4).optional(),\n\tworkingFolderObservations: z$1.array(localWakeRouteWorkingFolderObservationSchema).max(1e4).optional()\n}).superRefine((catalog, context) => {\n\tconst ids = new Set(catalog.profileIds);\n\tconst routes = new Set(catalog.routes.map((route) => route.profileId));\n\tif (ids.size !== catalog.profileIds.length || routes.size !== catalog.routes.length || ids.size !== routes.size || catalog.profileIds.some((id) => !routes.has(id))) context.addIssue({\n\t\tcode: \"custom\",\n\t\tmessage: \"Host catalog must contain exactly one route per profile.\"\n\t});\n});\nconst reportResult = z$1.strictObject({\n\tstatus: z$1.enum([\"skipped\", \"submitted\"]),\n\treasonCodes: z$1.array(z$1.string().max(256)).max(1024),\n\tsubmittedCount: count,\n\tfailedCount: count\n});\nconst executionFrameCodes = /* @__PURE__ */ new Set([\n\t\"daemon.dispatch.deliver\",\n\t\"daemon.dispatch.lifecycle_acknowledged\",\n\t\"daemon.dispatch.accepted\",\n\t\"daemon.dispatch.interaction_response\",\n\t\"daemon.reasoning.preferences\",\n\t\"daemon.local_agent_control.cancel\",\n\t\"daemon.local_agent_control.interrupt\",\n\t\"daemon.local_agent_control.fork_session\",\n\t\"daemon.local_agent_control.manage_installation\",\n\t\"daemon.local_agent_control.set_enabled\",\n\t\"daemon.execution_recovery.resume_controller_conversation\"\n]);\nconst executionOutputFrameCodes = /* @__PURE__ */ new Set([\n\t\"daemon.dispatch.result\",\n\t\"daemon.dispatch.lifecycle\",\n\t\"daemon.dispatch.runtime_evidence\",\n\t\"daemon.dispatch.reasoning\",\n\t\"daemon.dispatch.tool_activity\",\n\t\"daemon.dispatch.interaction_request\",\n\t\"daemon.dispatch.interaction_delivered\",\n\t\"daemon.dispatch.preview\",\n\t\"daemon.dispatch.preview_end\",\n\t\"daemon.local_agent_control.result\",\n\t\"daemon.execution_recovery.resume_controller_conversation_result\"\n]);\nconst serviceExecutionHostMethods = {\n\tinitialize: {\n\t\tinput: serviceExecutionHostIdentitySchema,\n\t\toutput: serviceExecutionHostSnapshotSchema\n\t},\n\thealth: {\n\t\tinput: empty,\n\t\toutput: serviceExecutionHostSnapshotSchema\n\t},\n\tloadCatalog: {\n\t\tinput: z$1.strictObject({ initial: z$1.boolean() }),\n\t\toutput: serviceExecutionHostCatalogSchema\n\t},\n\tconfigureConnection: {\n\t\tinput: z$1.strictObject({\n\t\t\texecutionAdmissionConfirmation: z$1.boolean().optional(),\n\t\t\tconnectionGeneration: z$1.number().int().positive(),\n\t\t\tcatalogRevision: count,\n\t\t\tleases: z$1.array(runtimeTransportLeaseSchema).max(1e4)\n\t\t}),\n\t\toutput: serviceExecutionHostSnapshotSchema\n\t},\n\tdetachConnection: {\n\t\tinput: z$1.strictObject({ connectionGeneration: z$1.number().int().positive() }),\n\t\toutput: serviceExecutionHostSnapshotSchema\n\t},\n\theartbeat: {\n\t\tinput: z$1.strictObject({\n\t\t\tconnectionGeneration: z$1.number().int().positive(),\n\t\t\tstaleProfileIds: z$1.array(identityString).max(1e4)\n\t\t}),\n\t\toutput: serviceExecutionHostSnapshotSchema\n\t},\n\thandleFrame: {\n\t\tinput: z$1.strictObject({\n\t\t\tconnectionGeneration: z$1.number().int().positive(),\n\t\t\tframe: daemonStreamFrameSchema.refine((frame) => executionFrameCodes.has(frame.code), \"This frame belongs to the connector, not the execution host.\")\n\t\t}),\n\t\toutput: empty\n\t},\n\tcancel: {\n\t\tinput: openMeldDaemonCancelRequestPayloadSchema,\n\t\toutput: openMeldDaemonCancelPayloadSchema\n\t},\n\tinterrupt: {\n\t\tinput: openMeldDaemonInterruptRequestPayloadSchema,\n\t\toutput: openMeldDaemonInterruptPayloadSchema\n\t},\n\tconversationStatus: {\n\t\tinput: openMeldDaemonConversationExecutionStatusRequestPayloadSchema,\n\t\toutput: openMeldDaemonConversationExecutionStatusPayloadSchema\n\t},\n\tsetEnabled: {\n\t\tinput: openMeldDaemonSetLocalAgentEnabledRequestPayloadSchema,\n\t\toutput: openMeldDaemonSetLocalAgentEnabledPayloadSchema\n\t},\n\treportControllers: {\n\t\tinput: z$1.strictObject({ probePolicy: z$1.enum([\"background\", \"fresh\"]) }),\n\t\toutput: reportResult.extend({\n\t\t\treportCount: count,\n\t\t\thasArmedReprobe: z$1.boolean()\n\t\t})\n\t},\n\treportConversations: {\n\t\tinput: empty,\n\t\toutput: reportResult.extend({ proofCount: count })\n\t},\n\tpersistCatalog: {\n\t\tinput: z$1.strictObject({ revision: z$1.number().int().positive() }),\n\t\toutput: empty\n\t},\n\tsyncActivity: {\n\t\tinput: z$1.strictObject({ refreshIntegrations: z$1.boolean().optional() }),\n\t\toutput: empty\n\t},\n\tbeginDrain: {\n\t\tinput: empty,\n\t\toutput: serviceExecutionHostSnapshotSchema\n\t},\n\tdrain: {\n\t\tinput: empty,\n\t\toutput: serviceExecutionHostSnapshotSchema\n\t},\n\tsettleResults: {\n\t\tinput: empty,\n\t\toutput: z$1.strictObject({ status: z$1.enum([\n\t\t\t\"acknowledged\",\n\t\t\t\"connection_closed\",\n\t\t\t\"timeout\"\n\t\t]) })\n\t},\n\tstop: {\n\t\tinput: empty,\n\t\toutput: serviceExecutionHostSnapshotSchema\n\t}\n};\nconst method = z$1.enum(Object.keys(serviceExecutionHostMethods));\nconst envelope = {\n\tprotocol: z$1.literal(SERVICE_EXECUTION_HOST_PROTOCOL),\n\thostInstanceId: z$1.uuid()\n};\nconst serviceExecutionHostRequestSchema = z$1.strictObject({\n\t...envelope,\n\trequestId: z$1.uuid(),\n\tmethod,\n\tpayload: z$1.unknown()\n});\nconst serviceExecutionHostMessageSchema = z$1.discriminatedUnion(\"type\", [\n\tz$1.strictObject({\n\t\t...envelope,\n\t\ttype: z$1.literal(\"reply\"),\n\t\trequestId: z$1.uuid(),\n\t\tmethod,\n\t\tresult: z$1.discriminatedUnion(\"ok\", [z$1.strictObject({\n\t\t\tok: z$1.literal(true),\n\t\t\tpayload: z$1.unknown()\n\t\t}), z$1.strictObject({\n\t\t\tok: z$1.literal(false),\n\t\t\terror: z$1.strictObject({\n\t\t\t\tcode: z$1.string().min(1).max(256),\n\t\t\t\tmessage: z$1.string().min(1).max(4096)\n\t\t\t})\n\t\t})])\n\t}),\n\tz$1.strictObject({\n\t\t...envelope,\n\t\ttype: z$1.literal(\"frame\"),\n\t\tconnectionGeneration: z$1.number().int().positive(),\n\t\tframe: daemonStreamFrameSchema.refine((frame) => executionOutputFrameCodes.has(frame.code), \"The execution host cannot emit connector-owned frames.\")\n\t}),\n\tz$1.strictObject({\n\t\t...envelope,\n\t\ttype: z$1.literal(\"invalidate\"),\n\t\tscope: z$1.enum([\n\t\t\t\"routes\",\n\t\t\t\"activity\",\n\t\t\t\"execution\"\n\t\t])\n\t}),\n\tz$1.strictObject({\n\t\t...envelope,\n\t\ttype: z$1.literal(\"authentication_failure\"),\n\t\tconnectionGeneration: z$1.number().int().positive().nullable(),\n\t\tfailure: z$1.strictObject({\n\t\t\tcredentialFingerprint: z$1.string().min(1).max(256).optional(),\n\t\t\tmessage: z$1.string().min(1).max(4096),\n\t\t\treasonCode: z$1.string().min(1).max(256)\n\t\t})\n\t})\n]);\n//#endregion\nexport { SERVICE_EXECUTION_HOST_MAX_FRAME_BYTES, SERVICE_EXECUTION_HOST_MAX_PENDING_REQUESTS, SERVICE_EXECUTION_HOST_PROTOCOL, profileWorkingFolderFactSchema, serviceExecutionHostCatalogSchema, serviceExecutionHostIdentitySchema, serviceExecutionHostMessageSchema, serviceExecutionHostMethods, serviceExecutionHostOwnerSchema, serviceExecutionHostRequestSchema, serviceExecutionHostRouteSchema, serviceExecutionHostSnapshotSchema };\n\n//# sourceMappingURL=service-execution-host.js.map","import { randomUUID } from \"node:crypto\";\nimport {\n SERVICE_EXECUTION_HOST_MAX_FRAME_BYTES,\n SERVICE_EXECUTION_HOST_MAX_PENDING_REQUESTS,\n SERVICE_EXECUTION_HOST_PROTOCOL,\n type ServiceExecutionHostArguments,\n type ServiceExecutionHostInput,\n type ServiceExecutionHostMessage,\n type ServiceExecutionHostMethod,\n type ServiceExecutionHostOutput,\n serviceExecutionHostMessageSchema,\n serviceExecutionHostMethods,\n serviceExecutionHostRequestSchema,\n} from \"@openmeld/schemas\";\n\nexport type ExecutionHostChannel = {\n connected(): boolean;\n send(message: object, completed: (error: Error | null) => void): void;\n onMessage(listener: (message: unknown) => void): () => void;\n onDisconnect(listener: (error?: Error) => void): () => void;\n};\n\nexport class ExecutionHostError extends Error {\n readonly code: string;\n\n constructor(code: string, message: string) {\n super(message);\n this.name = \"ExecutionHostError\";\n this.code = code;\n }\n}\n\nconst RESERVED_CONTROL_REQUESTS = 4;\nconst controlMethods = new Set<ServiceExecutionHostMethod>([\n \"health\",\n \"beginDrain\",\n \"detachConnection\",\n \"stop\",\n]);\n\nfunction assertFrameSize(message: unknown): number {\n const serialized = JSON.stringify(message);\n if (serialized === undefined) {\n throw new ExecutionHostError(\n \"host.invalid_frame\",\n \"Host IPC requires JSON.\"\n );\n }\n const size = Buffer.byteLength(serialized);\n if (size > SERVICE_EXECUTION_HOST_MAX_FRAME_BYTES) {\n throw new ExecutionHostError(\n \"host.frame_too_large\",\n \"The local execution message exceeds the IPC limit.\"\n );\n }\n return size;\n}\n\nfunction createSender(channel: ExecutionHostChannel) {\n let queuedBytes = 0;\n return (message: object, completed: (error: Error | null) => void): void => {\n const size = assertFrameSize(message);\n if (!channel.connected()) {\n throw new ExecutionHostError(\n \"host.disconnected\",\n \"The Host IPC channel is closed.\"\n );\n }\n if (queuedBytes + size > SERVICE_EXECUTION_HOST_MAX_FRAME_BYTES * 2) {\n throw new ExecutionHostError(\n \"host.backpressure\",\n \"Host IPC is full; no new message was queued.\"\n );\n }\n queuedBytes += size;\n let settled = false;\n const settle = (error: Error | null) => {\n if (settled) {\n return;\n }\n settled = true;\n queuedBytes -= size;\n completed(error);\n };\n try {\n channel.send(message, settle);\n } catch (error) {\n settle(error instanceof Error ? error : new Error(String(error)));\n }\n };\n}\n\ntype PendingRequest = {\n method: ServiceExecutionHostMethod;\n resolve(value: unknown): void;\n reject(error: Error): void;\n timer: ReturnType<typeof setTimeout> | null;\n};\n\nfunction resolveReply(\n request: PendingRequest,\n message: Extract<ServiceExecutionHostMessage, { type: \"reply\" }>\n): void {\n if (!message.result.ok) {\n request.reject(\n new ExecutionHostError(\n message.result.error.code,\n message.result.error.message\n )\n );\n return;\n }\n const result = serviceExecutionHostMethods[request.method].output.safeParse(\n message.result.payload\n );\n if (!result.success) {\n const error = new ExecutionHostError(\n \"host.invalid_response\",\n `Invalid ${request.method} response from the execution host.`\n );\n request.reject(error);\n throw error;\n }\n request.resolve(result.data);\n}\n\nexport function createExecutionHostClient(input: {\n channel: ExecutionHostChannel;\n hostInstanceId: string;\n onEvent?(\n event: Exclude<ServiceExecutionHostMessage, { type: \"reply\" }>\n ): void;\n onFailure?(error: Error): void;\n}) {\n const pending = new Map<string, PendingRequest>();\n const send = createSender(input.channel);\n let failure: Error | null = null;\n\n const fail = (error: Error) => {\n if (failure) {\n return;\n }\n failure = error;\n for (const request of pending.values()) {\n if (request.timer) {\n clearTimeout(request.timer);\n }\n request.reject(error);\n }\n pending.clear();\n input.onFailure?.(error);\n };\n\n const stopMessages = input.channel.onMessage((raw) => {\n if (failure) {\n return;\n }\n try {\n assertFrameSize(raw);\n const parsed = serviceExecutionHostMessageSchema.safeParse(raw);\n if (\n !parsed.success ||\n parsed.data.hostInstanceId !== input.hostInstanceId\n ) {\n throw new ExecutionHostError(\n \"host.invalid_response\",\n \"Host response does not match this process incarnation.\"\n );\n }\n const message = parsed.data;\n if (message.type !== \"reply\") {\n input.onEvent?.(message);\n return;\n }\n const request = pending.get(message.requestId);\n // A timed-out observer is gone, not the accepted operation. Do not retry it\n // or turn its late result into the outcome of a newer request.\n if (!request) {\n return;\n }\n if (request.method !== message.method) {\n throw new ExecutionHostError(\n \"host.invalid_response\",\n \"Host response method does not match its request.\"\n );\n }\n pending.delete(message.requestId);\n if (request.timer) {\n clearTimeout(request.timer);\n }\n resolveReply(request, message);\n } catch (error) {\n fail(error instanceof Error ? error : new Error(String(error)));\n }\n });\n const stopDisconnect = input.channel.onDisconnect((cause) => {\n fail(\n new ExecutionHostError(\n \"host.disconnected\",\n cause\n ? `The execution host disconnected: ${cause.message}. In-flight outcomes are unconfirmed.`\n : \"The execution host disconnected; in-flight outcomes are unconfirmed.\"\n )\n );\n });\n\n return {\n call<M extends ServiceExecutionHostMethod>(\n method: M,\n value: ServiceExecutionHostInput<M>,\n options: { timeoutMs?: number | null } = {}\n ): Promise<ServiceExecutionHostOutput<M>> {\n if (failure) {\n return Promise.reject(failure);\n }\n const limit =\n SERVICE_EXECUTION_HOST_MAX_PENDING_REQUESTS -\n (controlMethods.has(method) ? 0 : RESERVED_CONTROL_REQUESTS);\n if (pending.size >= limit) {\n return Promise.reject(\n new ExecutionHostError(\n \"host.busy\",\n \"Too many outstanding Host requests; no new request was sent.\"\n )\n );\n }\n const payload =\n serviceExecutionHostMethods[method].input.safeParse(value);\n if (!payload.success) {\n return Promise.reject(\n new ExecutionHostError(\n \"host.invalid_request\",\n `Invalid ${method} request.`\n )\n );\n }\n const requestId = randomUUID();\n const timeoutMs =\n options.timeoutMs === undefined ? 30_000 : options.timeoutMs;\n if (\n timeoutMs !== null &&\n (!Number.isFinite(timeoutMs) || timeoutMs <= 0)\n ) {\n return Promise.reject(\n new ExecutionHostError(\n \"host.invalid_timeout\",\n \"The observer deadline must be positive or absent.\"\n )\n );\n }\n return new Promise<ServiceExecutionHostOutput<M>>((resolve, reject) => {\n const request: PendingRequest = {\n method,\n resolve: (result) => resolve(result as ServiceExecutionHostOutput<M>),\n reject,\n timer: null,\n };\n if (timeoutMs !== null) {\n request.timer = setTimeout(() => {\n pending.delete(requestId);\n reject(\n new ExecutionHostError(\n \"host.observation_timeout\",\n `The ${method} response is unconfirmed. No operation was cancelled or retried.`\n )\n );\n }, timeoutMs);\n request.timer.unref?.();\n }\n pending.set(requestId, request);\n try {\n send(\n {\n protocol: SERVICE_EXECUTION_HOST_PROTOCOL,\n hostInstanceId: input.hostInstanceId,\n requestId,\n method,\n payload: payload.data,\n },\n (error) => {\n if (error) {\n fail(error);\n }\n }\n );\n } catch (error) {\n pending.delete(requestId);\n if (request.timer) {\n clearTimeout(request.timer);\n }\n reject(error);\n }\n });\n },\n pendingCount: () => pending.size,\n dispose(): void {\n stopMessages();\n stopDisconnect();\n fail(\n new ExecutionHostError(\n \"host.observer_closed\",\n \"The Host observer closed; accepted work was not cancelled.\"\n )\n );\n },\n };\n}\n\nexport type ExecutionHostHandlers = {\n [M in ServiceExecutionHostMethod]: (\n input: ServiceExecutionHostArguments<M>\n ) => Promise<ServiceExecutionHostOutput<M>> | ServiceExecutionHostOutput<M>;\n};\n\nexport function serveExecutionHost(input: {\n channel: ExecutionHostChannel;\n hostInstanceId: string;\n handlers: ExecutionHostHandlers;\n onFailure(error: Error): void;\n onDisconnect(): void;\n}) {\n const activeIds = new Set<string>();\n const send = createSender(input.channel);\n let closed = false;\n\n const sendMessage = (message: ServiceExecutionHostMessage) => {\n if (closed) {\n throw new ExecutionHostError(\n \"host.disconnected\",\n \"The connector is no longer observing this Host.\"\n );\n }\n send(message, (error) => {\n if (error) {\n input.onFailure(error);\n }\n });\n };\n\n const stopMessages = input.channel.onMessage((raw) => {\n if (closed) {\n return;\n }\n let request: ReturnType<typeof serviceExecutionHostRequestSchema.parse>;\n try {\n assertFrameSize(raw);\n const parsed = serviceExecutionHostRequestSchema.safeParse(raw);\n if (\n !parsed.success ||\n parsed.data.hostInstanceId !== input.hostInstanceId\n ) {\n throw new ExecutionHostError(\n \"host.invalid_request\",\n \"Host request does not match this process incarnation.\"\n );\n }\n request = parsed.data;\n } catch (error) {\n input.onFailure(\n error instanceof Error ? error : new Error(String(error))\n );\n return;\n }\n\n const respond = (\n result: Extract<ServiceExecutionHostMessage, { type: \"reply\" }>[\"result\"]\n ) => {\n if (!closed) {\n sendMessage({\n protocol: SERVICE_EXECUTION_HOST_PROTOCOL,\n hostInstanceId: input.hostInstanceId,\n type: \"reply\",\n requestId: request.requestId,\n method: request.method,\n result,\n });\n }\n };\n const reject = (error: unknown) => {\n try {\n respond({\n ok: false,\n error: {\n code:\n error instanceof ExecutionHostError\n ? error.code\n : \"host.operation_failed\",\n message:\n (error instanceof Error ? error.message : String(error)).slice(\n 0,\n 4096\n ) || \"Host operation failed.\",\n },\n });\n } catch (sendError) {\n input.onFailure(\n sendError instanceof Error ? sendError : new Error(String(sendError))\n );\n }\n };\n\n const limit =\n SERVICE_EXECUTION_HOST_MAX_PENDING_REQUESTS -\n (controlMethods.has(request.method) ? 0 : RESERVED_CONTROL_REQUESTS);\n if (activeIds.has(request.requestId) || activeIds.size >= limit) {\n reject(\n new ExecutionHostError(\n \"host.busy\",\n \"Host request is duplicate or capacity is exhausted; it was not admitted again.\"\n )\n );\n return;\n }\n const method = serviceExecutionHostMethods[request.method];\n const payload = method.input.safeParse(request.payload);\n if (!payload.success) {\n reject(\n new ExecutionHostError(\n \"host.invalid_request\",\n `Invalid ${request.method} payload.`\n )\n );\n return;\n }\n activeIds.add(request.requestId);\n // This cast connects the fixed schema table to its corresponding handler.\n // Both request and response are runtime-validated, including local callers.\n const handler = input.handlers[request.method] as (\n value: unknown\n ) => unknown;\n Promise.resolve()\n .then(() => handler(payload.data))\n .then((result) => {\n const parsed = method.output.safeParse(result);\n if (!parsed.success) {\n throw new ExecutionHostError(\n \"host.invalid_response\",\n `The ${request.method} owner returned an invalid response.`\n );\n }\n respond({ ok: true, payload: parsed.data });\n })\n .catch(reject)\n .finally(() => activeIds.delete(request.requestId));\n });\n const stopDisconnect = input.channel.onDisconnect(() => {\n if (closed) {\n return;\n }\n closed = true;\n input.onDisconnect();\n });\n return {\n emit(event: Exclude<ServiceExecutionHostMessage, { type: \"reply\" }>): void {\n const parsed = serviceExecutionHostMessageSchema.safeParse(event);\n if (!parsed.success || event.hostInstanceId !== input.hostInstanceId) {\n throw new ExecutionHostError(\n \"host.invalid_event\",\n \"Invalid execution-host event.\"\n );\n }\n sendMessage(parsed.data);\n },\n dispose(): void {\n closed = true;\n stopMessages();\n stopDisconnect();\n },\n };\n}\n"],"mappings":";;;;;;;;;AAOA,MAAM,kCAAkC;AAGxC,MAAM,iBAAiB,IAAI,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI;AACnD,MAAM,QAAQ,IAAI,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,YAAY;AAC7C,MAAM,QAAQ,IAAI,aAAa,CAAC,CAAC;AACjC,MAAM,qCAAqC,IAAI,aAAa;CAC3D,aAAa;CACb,UAAU;CACV,MAAM;CACN,iBAAiB;CACjB,2BAA2B;CAC3B,iBAAiB;CACjB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 {"version":3,"file":"channel-B2fD2_be.js","names":[],"sources":["../../../packages/schemas/dist/service-execution-host.js","../src/local-service/execution-host/channel.ts"],"sourcesContent":["import { daemonServiceLaneSchema } from \"./schemas/daemon/service-contract.js\";\nimport { providerDispatchRuntimeContextSchema } from \"./schemas/daemon/provider-runtime-context.js\";\nimport { openMeldDaemonCancelPayloadSchema, openMeldDaemonCancelRequestPayloadSchema, openMeldDaemonConversationExecutionStatusPayloadSchema, openMeldDaemonConversationExecutionStatusRequestPayloadSchema, openMeldDaemonInterruptPayloadSchema, openMeldDaemonInterruptRequestPayloadSchema, openMeldDaemonSetLocalAgentEnabledPayloadSchema, openMeldDaemonSetLocalAgentEnabledRequestPayloadSchema, skippedDaemonProfileSchema } from \"./schemas/daemon/control-plane.js\";\nimport { daemonStreamFrameSchema, localWakeRouteWorkingFolderObservationSchema, runtimeTransportLeaseSchema } from \"./schemas/daemon/runtime-transport.js\";\nimport { cachedDaemonRouteConfigSchema } from \"./schemas/daemon/route-catalog-cache.js\";\nimport * as z$1 from \"zod/v4\";\n//#region src/service-execution-host.ts\nconst SERVICE_EXECUTION_HOST_PROTOCOL = \"service-execution-host-v1\";\nconst SERVICE_EXECUTION_HOST_MAX_FRAME_BYTES = 8 * 1024 * 1024;\nconst SERVICE_EXECUTION_HOST_MAX_PENDING_REQUESTS = 64;\nconst identityString = z$1.string().min(1).max(1024);\nconst count = z$1.number().int().nonnegative();\nconst empty = z$1.strictObject({});\nconst serviceExecutionHostIdentitySchema = z$1.strictObject({\n\townerUserId: identityString,\n\tdeviceId: identityString,\n\tlane: daemonServiceLaneSchema,\n\tdaemonSessionId: identityString,\n\tserviceContractGeneration: count,\n\tsessionIdentity: identityString,\n\tstateRoot: z$1.string().min(1).max(4096),\n\tauthBaseUrl: z$1.url(),\n\tgatewayBaseUrl: z$1.url(),\n\tparentPid: z$1.number().int().positive(),\n\tparentProcessStartedAt: identityString\n});\nconst serviceExecutionHostSnapshotSchema = z$1.strictObject({\n\tpid: z$1.number().int().positive(),\n\tadmission: z$1.enum([\"open\", \"draining\"]),\n\tactiveCount: count,\n\tpendingCount: count,\n\tlocalQuiescent: z$1.boolean(),\n\tunacknowledgedResultCount: count,\n\tstartupReplayPending: z$1.boolean(),\n\tadapterIds: z$1.array(identityString).max(256)\n});\nconst serviceExecutionHostOwnerSchema = z$1.strictObject({\n\tschema: z$1.literal(\"service-execution-host-owner-v1\"),\n\thostInstanceId: z$1.uuid(),\n\townerUserId: identityString,\n\tdeviceId: identityString,\n\tlane: daemonServiceLaneSchema,\n\tpid: z$1.number().int().positive(),\n\tbootIdentity: identityString.nullable(),\n\tlocalQuiescent: z$1.boolean()\n});\nconst profileWorkingFolderFactSchema = z$1.strictObject({\n\tdefaultProjectId: identityString.nullable(),\n\tlocalProjectBindingGeneration: identityString.nullable(),\n\tobservedAtMs: count,\n\treasonCode: z$1.enum([\n\t\t\"profile.workspace.invalid\",\n\t\t\"profile.workspace.missing\",\n\t\t\"project.local_connection.folder_missing\",\n\t\t\"project.local_connection.invalid\",\n\t\t\"project.local_connection.missing\"\n\t]).nullable(),\n\tsource: z$1.enum([\"default_project\", \"profile_workspace\"]),\n\tstatus: z$1.enum([\n\t\t\"invalid\",\n\t\t\"missing\",\n\t\t\"ready\"\n\t])\n});\nconst readyWorkingFolder = {\n\tconfiguredWorkspacePath: z$1.string().min(1),\n\teffectiveRuntimeWorkingDirectory: z$1.string().min(1),\n\truntimeContext: providerDispatchRuntimeContextSchema,\n\tstatus: z$1.literal(\"ready\"),\n\tworkingFolderFact: profileWorkingFolderFactSchema\n};\nconst serviceExecutionHostRouteSchema = cachedDaemonRouteConfigSchema.extend({\n\tagentControllerConversationId: identityString.nullable().optional(),\n\tworkingFolderRuntime: z$1.discriminatedUnion(\"workingFolderSource\", [z$1.strictObject({\n\t\t...readyWorkingFolder,\n\t\tconfigPath: z$1.string().min(1),\n\t\tworkspaceMode: z$1.enum([\"openmeld_managed\", \"custom\"]),\n\t\tworkingFolderSource: z$1.literal(\"profile_workspace\")\n\t}), z$1.strictObject({\n\t\t...readyWorkingFolder,\n\t\tconfigPath: z$1.null(),\n\t\tworkspaceMode: z$1.null(),\n\t\tdefaultProjectId: identityString,\n\t\tdefaultProjectBindingGeneration: identityString,\n\t\tworkingFolderSource: z$1.literal(\"default_project\")\n\t})]).optional()\n});\nconst serviceExecutionHostCatalogSchema = z$1.strictObject({\n\trevision: z$1.number().int().positive(),\n\texpectedRoutesContractVersion: z$1.literal(\"v4\").optional(),\n\tprofileIds: z$1.array(identityString).max(1e4),\n\troutes: z$1.array(serviceExecutionHostRouteSchema).max(1e4),\n\tskippedProfiles: z$1.array(skippedDaemonProfileSchema).max(1e4),\n\tworkingFolderExpectedProfileIds: z$1.array(identityString).max(1e4).optional(),\n\tworkingFolderObservations: z$1.array(localWakeRouteWorkingFolderObservationSchema).max(1e4).optional()\n}).superRefine((catalog, context) => {\n\tconst ids = new Set(catalog.profileIds);\n\tconst routes = new Set(catalog.routes.map((route) => route.profileId));\n\tif (ids.size !== catalog.profileIds.length || routes.size !== catalog.routes.length || ids.size !== routes.size || catalog.profileIds.some((id) => !routes.has(id))) context.addIssue({\n\t\tcode: \"custom\",\n\t\tmessage: \"Host catalog must contain exactly one route per profile.\"\n\t});\n});\nconst reportResult = z$1.strictObject({\n\tstatus: z$1.enum([\"skipped\", \"submitted\"]),\n\treasonCodes: z$1.array(z$1.string().max(256)).max(1024),\n\tsubmittedCount: count,\n\tfailedCount: count\n});\nconst executionFrameCodes = /* @__PURE__ */ new Set([\n\t\"daemon.dispatch.deliver\",\n\t\"daemon.dispatch.lifecycle_acknowledged\",\n\t\"daemon.dispatch.accepted\",\n\t\"daemon.dispatch.interaction_response\",\n\t\"daemon.reasoning.preferences\",\n\t\"daemon.local_agent_control.cancel\",\n\t\"daemon.local_agent_control.interrupt\",\n\t\"daemon.local_agent_control.fork_session\",\n\t\"daemon.local_agent_control.manage_installation\",\n\t\"daemon.local_agent_control.set_enabled\",\n\t\"daemon.execution_recovery.resume_controller_conversation\"\n]);\nconst executionOutputFrameCodes = /* @__PURE__ */ new Set([\n\t\"daemon.dispatch.result\",\n\t\"daemon.dispatch.lifecycle\",\n\t\"daemon.dispatch.runtime_evidence\",\n\t\"daemon.dispatch.reasoning\",\n\t\"daemon.dispatch.tool_activity\",\n\t\"daemon.dispatch.interaction_request\",\n\t\"daemon.dispatch.interaction_delivered\",\n\t\"daemon.dispatch.preview\",\n\t\"daemon.dispatch.preview_end\",\n\t\"daemon.local_agent_control.result\",\n\t\"daemon.execution_recovery.resume_controller_conversation_result\"\n]);\nconst serviceExecutionHostMethods = {\n\tinitialize: {\n\t\tinput: serviceExecutionHostIdentitySchema,\n\t\toutput: serviceExecutionHostSnapshotSchema\n\t},\n\thealth: {\n\t\tinput: empty,\n\t\toutput: serviceExecutionHostSnapshotSchema\n\t},\n\tloadCatalog: {\n\t\tinput: z$1.strictObject({ initial: z$1.boolean() }),\n\t\toutput: serviceExecutionHostCatalogSchema\n\t},\n\tconfigureConnection: {\n\t\tinput: z$1.strictObject({\n\t\t\texecutionAdmissionConfirmation: z$1.boolean().optional(),\n\t\t\tconnectionGeneration: z$1.number().int().positive(),\n\t\t\tcatalogRevision: count,\n\t\t\tleases: z$1.array(runtimeTransportLeaseSchema).max(1e4)\n\t\t}),\n\t\toutput: serviceExecutionHostSnapshotSchema\n\t},\n\tdetachConnection: {\n\t\tinput: z$1.strictObject({ connectionGeneration: z$1.number().int().positive() }),\n\t\toutput: serviceExecutionHostSnapshotSchema\n\t},\n\theartbeat: {\n\t\tinput: z$1.strictObject({\n\t\t\tconnectionGeneration: z$1.number().int().positive(),\n\t\t\tstaleProfileIds: z$1.array(identityString).max(1e4)\n\t\t}),\n\t\toutput: serviceExecutionHostSnapshotSchema\n\t},\n\thandleFrame: {\n\t\tinput: z$1.strictObject({\n\t\t\tconnectionGeneration: z$1.number().int().positive(),\n\t\t\tframe: daemonStreamFrameSchema.refine((frame) => executionFrameCodes.has(frame.code), \"This frame belongs to the connector, not the execution host.\")\n\t\t}),\n\t\toutput: empty\n\t},\n\tcancel: {\n\t\tinput: openMeldDaemonCancelRequestPayloadSchema,\n\t\toutput: openMeldDaemonCancelPayloadSchema\n\t},\n\tinterrupt: {\n\t\tinput: openMeldDaemonInterruptRequestPayloadSchema,\n\t\toutput: openMeldDaemonInterruptPayloadSchema\n\t},\n\tconversationStatus: {\n\t\tinput: openMeldDaemonConversationExecutionStatusRequestPayloadSchema,\n\t\toutput: openMeldDaemonConversationExecutionStatusPayloadSchema\n\t},\n\tsetEnabled: {\n\t\tinput: openMeldDaemonSetLocalAgentEnabledRequestPayloadSchema,\n\t\toutput: openMeldDaemonSetLocalAgentEnabledPayloadSchema\n\t},\n\treportControllers: {\n\t\tinput: z$1.strictObject({ probePolicy: z$1.enum([\"background\", \"fresh\"]) }),\n\t\toutput: reportResult.extend({\n\t\t\treportCount: count,\n\t\t\thasArmedReprobe: z$1.boolean()\n\t\t})\n\t},\n\treportConversations: {\n\t\tinput: empty,\n\t\toutput: reportResult.extend({ proofCount: count })\n\t},\n\tpersistCatalog: {\n\t\tinput: z$1.strictObject({ revision: z$1.number().int().positive() }),\n\t\toutput: empty\n\t},\n\tsyncActivity: {\n\t\tinput: z$1.strictObject({ refreshIntegrations: z$1.boolean().optional() }),\n\t\toutput: empty\n\t},\n\tbeginDrain: {\n\t\tinput: empty,\n\t\toutput: serviceExecutionHostSnapshotSchema\n\t},\n\tdrain: {\n\t\tinput: empty,\n\t\toutput: serviceExecutionHostSnapshotSchema\n\t},\n\tsettleResults: {\n\t\tinput: empty,\n\t\toutput: z$1.strictObject({ status: z$1.enum([\n\t\t\t\"acknowledged\",\n\t\t\t\"connection_closed\",\n\t\t\t\"timeout\"\n\t\t]) })\n\t},\n\tstop: {\n\t\tinput: empty,\n\t\toutput: serviceExecutionHostSnapshotSchema\n\t}\n};\nconst method = z$1.enum(Object.keys(serviceExecutionHostMethods));\nconst envelope = {\n\tprotocol: z$1.literal(SERVICE_EXECUTION_HOST_PROTOCOL),\n\thostInstanceId: z$1.uuid()\n};\nconst serviceExecutionHostRequestSchema = z$1.strictObject({\n\t...envelope,\n\trequestId: z$1.uuid(),\n\tmethod,\n\tpayload: z$1.unknown()\n});\nconst serviceExecutionHostMessageSchema = z$1.discriminatedUnion(\"type\", [\n\tz$1.strictObject({\n\t\t...envelope,\n\t\ttype: z$1.literal(\"reply\"),\n\t\trequestId: z$1.uuid(),\n\t\tmethod,\n\t\tresult: z$1.discriminatedUnion(\"ok\", [z$1.strictObject({\n\t\t\tok: z$1.literal(true),\n\t\t\tpayload: z$1.unknown()\n\t\t}), z$1.strictObject({\n\t\t\tok: z$1.literal(false),\n\t\t\terror: z$1.strictObject({\n\t\t\t\tcode: z$1.string().min(1).max(256),\n\t\t\t\tmessage: z$1.string().min(1).max(4096)\n\t\t\t})\n\t\t})])\n\t}),\n\tz$1.strictObject({\n\t\t...envelope,\n\t\ttype: z$1.literal(\"frame\"),\n\t\tconnectionGeneration: z$1.number().int().positive(),\n\t\tframe: daemonStreamFrameSchema.refine((frame) => executionOutputFrameCodes.has(frame.code), \"The execution host cannot emit connector-owned frames.\")\n\t}),\n\tz$1.strictObject({\n\t\t...envelope,\n\t\ttype: z$1.literal(\"invalidate\"),\n\t\tscope: z$1.enum([\n\t\t\t\"routes\",\n\t\t\t\"activity\",\n\t\t\t\"execution\"\n\t\t])\n\t}),\n\tz$1.strictObject({\n\t\t...envelope,\n\t\ttype: z$1.literal(\"authentication_failure\"),\n\t\tconnectionGeneration: z$1.number().int().positive().nullable(),\n\t\tfailure: z$1.strictObject({\n\t\t\tcredentialFingerprint: z$1.string().min(1).max(256).optional(),\n\t\t\tmessage: z$1.string().min(1).max(4096),\n\t\t\treasonCode: z$1.string().min(1).max(256)\n\t\t})\n\t})\n]);\n//#endregion\nexport { SERVICE_EXECUTION_HOST_MAX_FRAME_BYTES, SERVICE_EXECUTION_HOST_MAX_PENDING_REQUESTS, SERVICE_EXECUTION_HOST_PROTOCOL, profileWorkingFolderFactSchema, serviceExecutionHostCatalogSchema, serviceExecutionHostIdentitySchema, serviceExecutionHostMessageSchema, serviceExecutionHostMethods, serviceExecutionHostOwnerSchema, serviceExecutionHostRequestSchema, serviceExecutionHostRouteSchema, serviceExecutionHostSnapshotSchema };\n\n//# sourceMappingURL=service-execution-host.js.map","import { randomUUID } from \"node:crypto\";\nimport {\n SERVICE_EXECUTION_HOST_MAX_FRAME_BYTES,\n SERVICE_EXECUTION_HOST_MAX_PENDING_REQUESTS,\n SERVICE_EXECUTION_HOST_PROTOCOL,\n type ServiceExecutionHostArguments,\n type ServiceExecutionHostInput,\n type ServiceExecutionHostMessage,\n type ServiceExecutionHostMethod,\n type ServiceExecutionHostOutput,\n serviceExecutionHostMessageSchema,\n serviceExecutionHostMethods,\n serviceExecutionHostRequestSchema,\n} from \"@openmeld/schemas\";\n\nexport type ExecutionHostChannel = {\n connected(): boolean;\n send(message: object, completed: (error: Error | null) => void): void;\n onMessage(listener: (message: unknown) => void): () => void;\n onDisconnect(listener: (error?: Error) => void): () => void;\n};\n\nexport class ExecutionHostError extends Error {\n readonly code: string;\n\n constructor(code: string, message: string) {\n super(message);\n this.name = \"ExecutionHostError\";\n this.code = code;\n }\n}\n\nconst RESERVED_CONTROL_REQUESTS = 4;\nconst controlMethods = new Set<ServiceExecutionHostMethod>([\n \"health\",\n \"beginDrain\",\n \"detachConnection\",\n \"stop\",\n]);\n\nfunction assertFrameSize(message: unknown): number {\n const serialized = JSON.stringify(message);\n if (serialized === undefined) {\n throw new ExecutionHostError(\n \"host.invalid_frame\",\n \"Host IPC requires JSON.\"\n );\n }\n const size = Buffer.byteLength(serialized);\n if (size > SERVICE_EXECUTION_HOST_MAX_FRAME_BYTES) {\n throw new ExecutionHostError(\n \"host.frame_too_large\",\n \"The local execution message exceeds the IPC limit.\"\n );\n }\n return size;\n}\n\nfunction createSender(channel: ExecutionHostChannel) {\n let queuedBytes = 0;\n return (message: object, completed: (error: Error | null) => void): void => {\n const size = assertFrameSize(message);\n if (!channel.connected()) {\n throw new ExecutionHostError(\n \"host.disconnected\",\n \"The Host IPC channel is closed.\"\n );\n }\n if (queuedBytes + size > SERVICE_EXECUTION_HOST_MAX_FRAME_BYTES * 2) {\n throw new ExecutionHostError(\n \"host.backpressure\",\n \"Host IPC is full; no new message was queued.\"\n );\n }\n queuedBytes += size;\n let settled = false;\n const settle = (error: Error | null) => {\n if (settled) {\n return;\n }\n settled = true;\n queuedBytes -= size;\n completed(error);\n };\n try {\n channel.send(message, settle);\n } catch (error) {\n settle(error instanceof Error ? error : new Error(String(error)));\n }\n };\n}\n\ntype PendingRequest = {\n method: ServiceExecutionHostMethod;\n resolve(value: unknown): void;\n reject(error: Error): void;\n timer: ReturnType<typeof setTimeout> | null;\n};\n\nfunction resolveReply(\n request: PendingRequest,\n message: Extract<ServiceExecutionHostMessage, { type: \"reply\" }>\n): void {\n if (!message.result.ok) {\n request.reject(\n new ExecutionHostError(\n message.result.error.code,\n message.result.error.message\n )\n );\n return;\n }\n const result = serviceExecutionHostMethods[request.method].output.safeParse(\n message.result.payload\n );\n if (!result.success) {\n const error = new ExecutionHostError(\n \"host.invalid_response\",\n `Invalid ${request.method} response from the execution host.`\n );\n request.reject(error);\n throw error;\n }\n request.resolve(result.data);\n}\n\nexport function createExecutionHostClient(input: {\n channel: ExecutionHostChannel;\n hostInstanceId: string;\n onEvent?(\n event: Exclude<ServiceExecutionHostMessage, { type: \"reply\" }>\n ): void;\n onFailure?(error: Error): void;\n}) {\n const pending = new Map<string, PendingRequest>();\n const send = createSender(input.channel);\n let failure: Error | null = null;\n\n const fail = (error: Error) => {\n if (failure) {\n return;\n }\n failure = error;\n for (const request of pending.values()) {\n if (request.timer) {\n clearTimeout(request.timer);\n }\n request.reject(error);\n }\n pending.clear();\n input.onFailure?.(error);\n };\n\n const stopMessages = input.channel.onMessage((raw) => {\n if (failure) {\n return;\n }\n try {\n assertFrameSize(raw);\n const parsed = serviceExecutionHostMessageSchema.safeParse(raw);\n if (\n !parsed.success ||\n parsed.data.hostInstanceId !== input.hostInstanceId\n ) {\n throw new ExecutionHostError(\n \"host.invalid_response\",\n \"Host response does not match this process incarnation.\"\n );\n }\n const message = parsed.data;\n if (message.type !== \"reply\") {\n input.onEvent?.(message);\n return;\n }\n const request = pending.get(message.requestId);\n // A timed-out observer is gone, not the accepted operation. Do not retry it\n // or turn its late result into the outcome of a newer request.\n if (!request) {\n return;\n }\n if (request.method !== message.method) {\n throw new ExecutionHostError(\n \"host.invalid_response\",\n \"Host response method does not match its request.\"\n );\n }\n pending.delete(message.requestId);\n if (request.timer) {\n clearTimeout(request.timer);\n }\n resolveReply(request, message);\n } catch (error) {\n fail(error instanceof Error ? error : new Error(String(error)));\n }\n });\n const stopDisconnect = input.channel.onDisconnect((cause) => {\n fail(\n new ExecutionHostError(\n \"host.disconnected\",\n cause\n ? `The execution host disconnected: ${cause.message}. In-flight outcomes are unconfirmed.`\n : \"The execution host disconnected; in-flight outcomes are unconfirmed.\"\n )\n );\n });\n\n return {\n call<M extends ServiceExecutionHostMethod>(\n method: M,\n value: ServiceExecutionHostInput<M>,\n options: { timeoutMs?: number | null } = {}\n ): Promise<ServiceExecutionHostOutput<M>> {\n if (failure) {\n return Promise.reject(failure);\n }\n const limit =\n SERVICE_EXECUTION_HOST_MAX_PENDING_REQUESTS -\n (controlMethods.has(method) ? 0 : RESERVED_CONTROL_REQUESTS);\n if (pending.size >= limit) {\n return Promise.reject(\n new ExecutionHostError(\n \"host.busy\",\n \"Too many outstanding Host requests; no new request was sent.\"\n )\n );\n }\n const payload =\n serviceExecutionHostMethods[method].input.safeParse(value);\n if (!payload.success) {\n return Promise.reject(\n new ExecutionHostError(\n \"host.invalid_request\",\n `Invalid ${method} request.`\n )\n );\n }\n const requestId = randomUUID();\n const timeoutMs =\n options.timeoutMs === undefined ? 30_000 : options.timeoutMs;\n if (\n timeoutMs !== null &&\n (!Number.isFinite(timeoutMs) || timeoutMs <= 0)\n ) {\n return Promise.reject(\n new ExecutionHostError(\n \"host.invalid_timeout\",\n \"The observer deadline must be positive or absent.\"\n )\n );\n }\n return new Promise<ServiceExecutionHostOutput<M>>((resolve, reject) => {\n const request: PendingRequest = {\n method,\n resolve: (result) => resolve(result as ServiceExecutionHostOutput<M>),\n reject,\n timer: null,\n };\n if (timeoutMs !== null) {\n request.timer = setTimeout(() => {\n pending.delete(requestId);\n reject(\n new ExecutionHostError(\n \"host.observation_timeout\",\n `The ${method} response is unconfirmed. No operation was cancelled or retried.`\n )\n );\n }, timeoutMs);\n request.timer.unref?.();\n }\n pending.set(requestId, request);\n try {\n send(\n {\n protocol: SERVICE_EXECUTION_HOST_PROTOCOL,\n hostInstanceId: input.hostInstanceId,\n requestId,\n method,\n payload: payload.data,\n },\n (error) => {\n if (error) {\n fail(error);\n }\n }\n );\n } catch (error) {\n pending.delete(requestId);\n if (request.timer) {\n clearTimeout(request.timer);\n }\n reject(error);\n }\n });\n },\n pendingCount: () => pending.size,\n dispose(): void {\n stopMessages();\n stopDisconnect();\n fail(\n new ExecutionHostError(\n \"host.observer_closed\",\n \"The Host observer closed; accepted work was not cancelled.\"\n )\n );\n },\n };\n}\n\nexport type ExecutionHostHandlers = {\n [M in ServiceExecutionHostMethod]: (\n input: ServiceExecutionHostArguments<M>\n ) => Promise<ServiceExecutionHostOutput<M>> | ServiceExecutionHostOutput<M>;\n};\n\nexport function serveExecutionHost(input: {\n channel: ExecutionHostChannel;\n hostInstanceId: string;\n handlers: ExecutionHostHandlers;\n onFailure(error: Error): void;\n onDisconnect(): void;\n}) {\n const activeIds = new Set<string>();\n const send = createSender(input.channel);\n let closed = false;\n\n const sendMessage = (message: ServiceExecutionHostMessage) => {\n if (closed) {\n throw new ExecutionHostError(\n \"host.disconnected\",\n \"The connector is no longer observing this Host.\"\n );\n }\n send(message, (error) => {\n if (error) {\n input.onFailure(error);\n }\n });\n };\n\n const stopMessages = input.channel.onMessage((raw) => {\n if (closed) {\n return;\n }\n let request: ReturnType<typeof serviceExecutionHostRequestSchema.parse>;\n try {\n assertFrameSize(raw);\n const parsed = serviceExecutionHostRequestSchema.safeParse(raw);\n if (\n !parsed.success ||\n parsed.data.hostInstanceId !== input.hostInstanceId\n ) {\n throw new ExecutionHostError(\n \"host.invalid_request\",\n \"Host request does not match this process incarnation.\"\n );\n }\n request = parsed.data;\n } catch (error) {\n input.onFailure(\n error instanceof Error ? error : new Error(String(error))\n );\n return;\n }\n\n const respond = (\n result: Extract<ServiceExecutionHostMessage, { type: \"reply\" }>[\"result\"]\n ) => {\n if (!closed) {\n sendMessage({\n protocol: SERVICE_EXECUTION_HOST_PROTOCOL,\n hostInstanceId: input.hostInstanceId,\n type: \"reply\",\n requestId: request.requestId,\n method: request.method,\n result,\n });\n }\n };\n const reject = (error: unknown) => {\n try {\n respond({\n ok: false,\n error: {\n code:\n error instanceof ExecutionHostError\n ? error.code\n : \"host.operation_failed\",\n message:\n (error instanceof Error ? error.message : String(error)).slice(\n 0,\n 4096\n ) || \"Host operation failed.\",\n },\n });\n } catch (sendError) {\n input.onFailure(\n sendError instanceof Error ? sendError : new Error(String(sendError))\n );\n }\n };\n\n const limit =\n SERVICE_EXECUTION_HOST_MAX_PENDING_REQUESTS -\n (controlMethods.has(request.method) ? 0 : RESERVED_CONTROL_REQUESTS);\n if (activeIds.has(request.requestId) || activeIds.size >= limit) {\n reject(\n new ExecutionHostError(\n \"host.busy\",\n \"Host request is duplicate or capacity is exhausted; it was not admitted again.\"\n )\n );\n return;\n }\n const method = serviceExecutionHostMethods[request.method];\n const payload = method.input.safeParse(request.payload);\n if (!payload.success) {\n reject(\n new ExecutionHostError(\n \"host.invalid_request\",\n `Invalid ${request.method} payload.`\n )\n );\n return;\n }\n activeIds.add(request.requestId);\n // This cast connects the fixed schema table to its corresponding handler.\n // Both request and response are runtime-validated, including local callers.\n const handler = input.handlers[request.method] as (\n value: unknown\n ) => unknown;\n Promise.resolve()\n .then(() => handler(payload.data))\n .then((result) => {\n const parsed = method.output.safeParse(result);\n if (!parsed.success) {\n throw new ExecutionHostError(\n \"host.invalid_response\",\n `The ${request.method} owner returned an invalid response.`\n );\n }\n respond({ ok: true, payload: parsed.data });\n })\n .catch(reject)\n .finally(() => activeIds.delete(request.requestId));\n });\n const stopDisconnect = input.channel.onDisconnect(() => {\n if (closed) {\n return;\n }\n closed = true;\n input.onDisconnect();\n });\n return {\n emit(event: Exclude<ServiceExecutionHostMessage, { type: \"reply\" }>): void {\n const parsed = serviceExecutionHostMessageSchema.safeParse(event);\n if (!parsed.success || event.hostInstanceId !== input.hostInstanceId) {\n throw new ExecutionHostError(\n \"host.invalid_event\",\n \"Invalid execution-host event.\"\n );\n }\n sendMessage(parsed.data);\n },\n dispose(): void {\n closed = true;\n stopMessages();\n stopDisconnect();\n },\n };\n}\n"],"mappings":";;;;;;;;;AAOA,MAAM,kCAAkC;AAGxC,MAAM,iBAAiB,IAAI,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI;AACnD,MAAM,QAAQ,IAAI,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,YAAY;AAC7C,MAAM,QAAQ,IAAI,aAAa,CAAC,CAAC;AACjC,MAAM,qCAAqC,IAAI,aAAa;CAC3D,aAAa;CACb,UAAU;CACV,MAAM;CACN,iBAAiB;CACjB,2BAA2B;CAC3B,iBAAiB;CACjB,WAAW,IAAI,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI;CACvC,aAAa,IAAI,IAAI;CACrB,gBAAgB,IAAI,IAAI;CACxB,WAAW,IAAI,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS;CACvC,wBAAwB;AACzB,CAAC;AACD,MAAM,qCAAqC,IAAI,aAAa;CAC3D,KAAK,IAAI,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS;CACjC,WAAW,IAAI,KAAK,CAAC,QAAQ,UAAU,CAAC;CACxC,aAAa;CACb,cAAc;CACd,gBAAgB,IAAI,QAAQ;CAC5B,2BAA2B;CAC3B,sBAAsB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O,UAC5B,CACF;GACA;EACF;EACA,UAAU,IAAI,QAAQ,SAAS;EAG/B,MAAM,UAAU,MAAM,SAAS,QAAQ;EAGvC,QAAQ,QAAQ,CAAC,CACd,WAAW,QAAQ,QAAQ,IAAI,CAAC,CAAC,CACjC,MAAM,WAAW;GAChB,MAAM,SAAS,OAAO,OAAO,UAAU,MAAM;GAC7C,IAAI,CAAC,OAAO,SACV,MAAM,IAAI,mBACR,yBACA,OAAO,QAAQ,OAAO,qCACxB;GAEF,QAAQ;IAAE,IAAI;IAAM,SAAS,OAAO;GAAK,CAAC;EAC5C,CAAC,CAAC,CACD,MAAM,MAAM,CAAC,CACb,cAAc,UAAU,OAAO,QAAQ,SAAS,CAAC;CACtD,CAAC;CACD,MAAM,iBAAiB,MAAM,QAAQ,mBAAmB;EACtD,IAAI,QACF;EAEF,SAAS;EACT,MAAM,aAAa;CACrB,CAAC;CACD,OAAO;EACL,KAAK,OAAsE;GACzE,MAAM,SAAS,kCAAkC,UAAU,KAAK;GAChE,IAAI,CAAC,OAAO,WAAW,MAAM,mBAAmB,MAAM,gBACpD,MAAM,IAAI,mBACR,sBACA,+BACF;GAEF,YAAY,OAAO,IAAI;EACzB;EACA,UAAgB;GACd,SAAS;GACT,aAAa;GACb,eAAe;EACjB;CACF;AACF"}
@@ -1,8 +1,17 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ import { i as windowsPublisherNameSchema } from "./windows-artifact-DJ9DKjfc.js";
3
4
  import * as z$1 from "zod/v4";
4
5
  //#region ../../packages/schemas/dist/schemas/http/cli-binary-manifest.js
5
6
  const SHA256_HEX_PATTERN = /^[a-f0-9]{64}$/u;
7
+ function resolveCliBinaryPlatform(os, arch) {
8
+ return `${os === "win32" ? "windows" : os}-${arch}`;
9
+ }
10
+ const OPENMELD_MACOS_CLI_SIGNING_IDENTITY = {
11
+ codeIdentifier: "sh.openmeld.cli",
12
+ teamIdentifier: "38FFHDPA3B"
13
+ };
14
+ const OPENMELD_MACOS_CLI_SIGNING_REQUIREMENT = `anchor apple generic and identifier "${OPENMELD_MACOS_CLI_SIGNING_IDENTITY.codeIdentifier}" and certificate 1[field.1.2.840.113635.100.6.2.6] exists and certificate leaf[field.1.2.840.113635.100.6.1.13] exists and certificate leaf[subject.OU] = "${OPENMELD_MACOS_CLI_SIGNING_IDENTITY.teamIdentifier}"`;
6
15
  function isBase64(value) {
7
16
  if (value.length === 0 || value.length % 4 !== 0) return false;
8
17
  let contentEnd = value.length;
@@ -57,8 +66,19 @@ const cliBinaryReleaseSchema = cliBinaryArtifactSchema.extend({
57
66
  archiveUrl: cliBinaryArchiveTransportSchema.shape.archiveUrl.optional(),
58
67
  codeIdentifier: z$1.string().trim().min(1).optional(),
59
68
  deltas: z$1.array(cliBinaryDeltaTransportSchema).max(8).optional(),
60
- teamIdentifier: z$1.string().trim().min(1).optional()
69
+ teamIdentifier: z$1.string().trim().min(1).optional(),
70
+ windows: z$1.union([z$1.strictObject({
71
+ publisherName: windowsPublisherNameSchema,
72
+ processHelper: cliBinaryArtifactSchema
73
+ }), z$1.strictObject({
74
+ mode: z$1.literal("internal-unsigned-preview"),
75
+ processHelper: cliBinaryArtifactSchema
76
+ })]).optional()
61
77
  }).superRefine((release, context) => {
78
+ if (release.windows && (release.codeIdentifier || release.teamIdentifier)) context.addIssue({
79
+ code: "custom",
80
+ message: "Windows and macOS signature identities cannot be combined"
81
+ });
62
82
  const archiveFields = [
63
83
  release.archiveFormat,
64
84
  release.archiveSha256,
@@ -86,7 +106,13 @@ const cliBinaryReleaseSchema = cliBinaryArtifactSchema.extend({
86
106
  deltaBases.add(baseKey);
87
107
  }
88
108
  });
89
- const binaryPlatformsSchema = z$1.record(z$1.string().trim().min(1), cliBinaryReleaseSchema).refine((platforms) => Object.keys(platforms).length > 0, { message: "at least one platform is required" });
109
+ const binaryPlatformsSchema = z$1.record(z$1.string().trim().min(1), cliBinaryReleaseSchema).refine((platforms) => Object.keys(platforms).length > 0, { message: "at least one platform is required" }).superRefine((platforms, context) => {
110
+ for (const [platform, release] of Object.entries(platforms)) if (platform.startsWith("windows-") !== Boolean(release.windows)) context.addIssue({
111
+ code: "custom",
112
+ path: [platform, "windows"],
113
+ message: "Windows artifact metadata must match its platform"
114
+ });
115
+ });
90
116
  const cliBinaryServiceReleaseSchema = z$1.object({
91
117
  platforms: binaryPlatformsSchema,
92
118
  version: z$1.string().trim().min(1)
@@ -112,6 +138,6 @@ const cliBinaryManifestSchema = z$1.object({
112
138
  schemaVersion: z$1.literal(1)
113
139
  });
114
140
  //#endregion
115
- export { cliBinaryManifestSchema as n, cliBinaryServiceReleaseSchema as r, cliBinaryDeltaPatchSchema as t };
141
+ export { cliBinaryServiceReleaseSchema as a, cliBinaryManifestSchema as i, OPENMELD_MACOS_CLI_SIGNING_REQUIREMENT as n, resolveCliBinaryPlatform as o, cliBinaryDeltaPatchSchema as r, OPENMELD_MACOS_CLI_SIGNING_IDENTITY as t };
116
142
 
117
- //# sourceMappingURL=cli-binary-manifest-DiUulkp0.js.map
143
+ //# sourceMappingURL=cli-binary-manifest-CT5X05lk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-binary-manifest-CT5X05lk.js","names":[],"sources":["../../../packages/schemas/dist/schemas/http/cli-binary-manifest.js"],"sourcesContent":["import { windowsPublisherNameSchema } from \"../../windows-artifact.js\";\nimport * as z$1 from \"zod/v4\";\n//#region src/schemas/http/cli-binary-manifest.ts\nconst SHA256_HEX_PATTERN = /^[a-f0-9]{64}$/u;\nfunction resolveCliBinaryPlatform(os, arch) {\n\treturn `${os === \"win32\" ? \"windows\" : os}-${arch}`;\n}\nconst OPENMELD_MACOS_CLI_SIGNING_IDENTITY = {\n\tcodeIdentifier: \"sh.openmeld.cli\",\n\tteamIdentifier: \"38FFHDPA3B\"\n};\nconst OPENMELD_MACOS_CLI_SIGNING_REQUIREMENT = `anchor apple generic and identifier \"${OPENMELD_MACOS_CLI_SIGNING_IDENTITY.codeIdentifier}\" and certificate 1[field.1.2.840.113635.100.6.2.6] exists and certificate leaf[field.1.2.840.113635.100.6.1.13] exists and certificate leaf[subject.OU] = \"${OPENMELD_MACOS_CLI_SIGNING_IDENTITY.teamIdentifier}\"`;\nfunction isBase64(value) {\n\tif (value.length === 0 || value.length % 4 !== 0) return false;\n\tlet contentEnd = value.length;\n\tif (value.endsWith(\"==\")) contentEnd -= 2;\n\telse if (value.endsWith(\"=\")) contentEnd -= 1;\n\tfor (let index = 0; index < contentEnd; index += 1) {\n\t\tconst code = value.charCodeAt(index);\n\t\tif (!(code >= 65 && code <= 90 || code >= 97 && code <= 122 || code >= 48 && code <= 57 || code === 43 || code === 47)) return false;\n\t}\n\treturn true;\n}\nconst cliBinaryArtifactSchema = z$1.object({\n\tsha256: z$1.string().regex(SHA256_HEX_PATTERN),\n\tsizeBytes: z$1.number().int().positive(),\n\turl: z$1.url()\n});\nconst cliBinaryArchiveTransportSchema = z$1.object({\n\tarchiveFormat: z$1.literal(\"gzip\"),\n\tarchiveSha256: z$1.string().regex(SHA256_HEX_PATTERN),\n\tarchiveSizeBytes: z$1.number().int().positive(),\n\tarchiveUrl: z$1.url()\n});\nconst cliBinaryCompressedReleaseSchema = cliBinaryArtifactSchema.extend(cliBinaryArchiveTransportSchema.shape);\nconst cliBinaryDeltaPatchSchema = z$1.object({\n\tbaseSha256: z$1.string().regex(SHA256_HEX_PATTERN),\n\tbaseSizeBytes: z$1.number().int().positive(),\n\tblockSizeBytes: z$1.literal(4096),\n\tpatchFormat: z$1.literal(\"block-ranges-v1\"),\n\tschemaVersion: z$1.literal(1),\n\tsegments: z$1.array(z$1.object({\n\t\tdataBase64: z$1.string().min(4).refine(isBase64, \"invalid base64\"),\n\t\toffset: z$1.number().int().nonnegative()\n\t})).max(1e5),\n\ttargetSha256: z$1.string().regex(SHA256_HEX_PATTERN),\n\ttargetSizeBytes: z$1.number().int().positive()\n});\nconst cliBinaryDeltaTransportSchema = z$1.object({\n\tfromSha256: z$1.string().regex(SHA256_HEX_PATTERN),\n\tfromSizeBytes: z$1.number().int().positive(),\n\tfromVersion: z$1.string().trim().min(1),\n\tpatchCompression: z$1.literal(\"gzip\"),\n\tpatchFormat: z$1.literal(\"block-ranges-v1\"),\n\tpatchPayloadSizeBytes: z$1.number().int().positive(),\n\tpatchSha256: z$1.string().regex(SHA256_HEX_PATTERN),\n\tpatchSizeBytes: z$1.number().int().positive(),\n\tpatchUrl: z$1.url()\n});\nconst cliBinaryReleaseSchema = cliBinaryArtifactSchema.extend({\n\tarchiveFormat: cliBinaryArchiveTransportSchema.shape.archiveFormat.optional(),\n\tarchiveSha256: cliBinaryArchiveTransportSchema.shape.archiveSha256.optional(),\n\tarchiveSizeBytes: cliBinaryArchiveTransportSchema.shape.archiveSizeBytes.optional(),\n\tarchiveUrl: cliBinaryArchiveTransportSchema.shape.archiveUrl.optional(),\n\tcodeIdentifier: z$1.string().trim().min(1).optional(),\n\tdeltas: z$1.array(cliBinaryDeltaTransportSchema).max(8).optional(),\n\tteamIdentifier: z$1.string().trim().min(1).optional(),\n\twindows: z$1.union([z$1.strictObject({\n\t\tpublisherName: windowsPublisherNameSchema,\n\t\tprocessHelper: cliBinaryArtifactSchema\n\t}), z$1.strictObject({\n\t\tmode: z$1.literal(\"internal-unsigned-preview\"),\n\t\tprocessHelper: cliBinaryArtifactSchema\n\t})]).optional()\n}).superRefine((release, context) => {\n\tif (release.windows && (release.codeIdentifier || release.teamIdentifier)) context.addIssue({\n\t\tcode: \"custom\",\n\t\tmessage: \"Windows and macOS signature identities cannot be combined\"\n\t});\n\tconst archiveFields = [\n\t\trelease.archiveFormat,\n\t\trelease.archiveSha256,\n\t\trelease.archiveSizeBytes,\n\t\trelease.archiveUrl\n\t];\n\tif (!(archiveFields.every((value) => value === void 0) || archiveFields.every((value) => value !== void 0))) context.addIssue({\n\t\tcode: \"custom\",\n\t\tmessage: \"compressed transport fields must be provided together\"\n\t});\n\tif (release.codeIdentifier === void 0 !== (release.teamIdentifier === void 0)) context.addIssue({\n\t\tcode: \"custom\",\n\t\tmessage: \"signature identity fields must be provided together\"\n\t});\n\tconst deltaBases = /* @__PURE__ */ new Set();\n\tfor (const delta of release.deltas ?? []) {\n\t\tconst baseKey = `${delta.fromVersion}:${delta.fromSha256}`;\n\t\tif (deltaBases.has(baseKey)) {\n\t\t\tcontext.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tmessage: \"delta base records must be unique\"\n\t\t\t});\n\t\t\tbreak;\n\t\t}\n\t\tdeltaBases.add(baseKey);\n\t}\n});\nconst binaryPlatformsSchema = z$1.record(z$1.string().trim().min(1), cliBinaryReleaseSchema).refine((platforms) => Object.keys(platforms).length > 0, { message: \"at least one platform is required\" }).superRefine((platforms, context) => {\n\tfor (const [platform, release] of Object.entries(platforms)) if (platform.startsWith(\"windows-\") !== Boolean(release.windows)) context.addIssue({\n\t\tcode: \"custom\",\n\t\tpath: [platform, \"windows\"],\n\t\tmessage: \"Windows artifact metadata must match its platform\"\n\t});\n});\nconst cliBinaryServiceReleaseSchema = z$1.object({\n\tplatforms: binaryPlatformsSchema,\n\tversion: z$1.string().trim().min(1)\n});\nconst cliBinaryManifestSchema = z$1.object({\n\tchannels: z$1.object({ stable: z$1.object({\n\t\tminRequiredCliVersion: z$1.string().trim().min(1).nullable().optional(),\n\t\tplatforms: binaryPlatformsSchema,\n\t\tservice: cliBinaryServiceReleaseSchema.optional(),\n\t\tversion: z$1.string().trim().min(1)\n\t}).superRefine((stable, context) => {\n\t\tif (!stable.service) return;\n\t\tfor (const platform of Object.keys(stable.platforms)) if (!stable.service.platforms[platform]) context.addIssue({\n\t\t\tcode: \"custom\",\n\t\t\tpath: [\n\t\t\t\t\"service\",\n\t\t\t\t\"platforms\",\n\t\t\t\tplatform\n\t\t\t],\n\t\t\tmessage: \"a Service artifact is required for every CLI platform\"\n\t\t});\n\t}) }),\n\tschemaVersion: z$1.literal(1)\n});\n//#endregion\nexport { OPENMELD_MACOS_CLI_SIGNING_IDENTITY, OPENMELD_MACOS_CLI_SIGNING_REQUIREMENT, cliBinaryCompressedReleaseSchema, cliBinaryDeltaPatchSchema, cliBinaryDeltaTransportSchema, cliBinaryManifestSchema, cliBinaryReleaseSchema, cliBinaryServiceReleaseSchema, resolveCliBinaryPlatform };\n\n//# sourceMappingURL=cli-binary-manifest.js.map"],"mappings":";;;;;AAGA,MAAM,qBAAqB;AAC3B,SAAS,yBAAyB,IAAI,MAAM;CAC3C,OAAO,GAAG,OAAO,UAAU,YAAY,GAAG,GAAG;AAC9C;AACA,MAAM,sCAAsC;CAC3C,gBAAgB;CAChB,gBAAgB;AACjB;AACA,MAAM,yCAAyC,wCAAwC,oCAAoC,eAAe,8JAA8J,oCAAoC,eAAe;AAC3V,SAAS,SAAS,OAAO;CACxB,IAAI,MAAM,WAAW,KAAK,MAAM,SAAS,MAAM,GAAG,OAAO;CACzD,IAAI,aAAa,MAAM;CACvB,IAAI,MAAM,SAAS,IAAI,GAAG,cAAc;MACnC,IAAI,MAAM,SAAS,GAAG,GAAG,cAAc;CAC5C,KAAK,IAAI,QAAQ,GAAG,QAAQ,YAAY,SAAS,GAAG;EACnD,MAAM,OAAO,MAAM,WAAW,KAAK;EACnC,IAAI,EAAE,QAAQ,MAAM,QAAQ,MAAM,QAAQ,MAAM,QAAQ,OAAO,QAAQ,MAAM,QAAQ,MAAM,SAAS,MAAM,SAAS,KAAK,OAAO;CAChI;CACA,OAAO;AACR;AACA,MAAM,0BAA0B,IAAI,OAAO;CAC1C,QAAQ,IAAI,OAAO,CAAC,CAAC,MAAM,kBAAkB;CAC7C,WAAW,IAAI,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS;CACvC,KAAK,IAAI,IAAI;AACd,CAAC;AACD,MAAM,kCAAkC,IAAI,OAAO;CAClD,eAAe,IAAI,QAAQ,MAAM;CACjC,eAAe,IAAI,OAAO,CAAC,CAAC,MAAM,kBAAkB;CACpD,kBAAkB,IAAI,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS;CAC9C,YAAY,IAAI,I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
2
 
3
3
  import { _ as toSpaceWsUrl, a as toSpaceCreateUrl, d as toSpaceMembersUrl, f as toSpaceMetaUrl, m as toSpaceRemoveMembersUrl, o as toSpaceCursorUrl, p as toSpacePasswordUrl, s as toSpaceDeleteUrl, t as normalizeBaseUrl, u as toSpaceLeaveUrl } from "./urls-CY2uzH2-.js";
4
4
  import { t as isLoopbackHostname } from "./loopback-hostname-DHQPKq8N.js";
5
- import { ct as resolveOpenMeldEnvPreset, d as runWithHeldLock, i as isOpenMeldLockError, t as acquireLock, u as resolveOpenMeldOrphanedLockIssue } from "./lock-Bsl_ElWy.js";
6
- import { An as resolveAccountSpaceIndexGatewayHost, At as createAccountSpaceIndexApi, Bi as toLegacySpaceImageGeometryWireValue, Br as removeSpaceMembersResponseSchema, Gn as parseServerErrorFrame$1, Hn as MAX_TEXT_LENGTH, Ht as createFetchTransport, Jt as createOrganizationApi, Kn as resolveCustomMentionAliasOverride, Mt as createAgentProfileBindingApi, Nn as toStructuredApiClientFailure, Rr as leaveSpaceResponseSchema, Un as parseEnvelope$1, Vi as toCompatibleSpaceAddressingRequestWireValue, Wn as parseIncoming$1, en as createProfileSpaceHistoryApi, gt as buildProfileSpaceHistoryUpsertPath, ht as buildProfileSpaceHistoryStatusPath, ii as resolveInitialSpaceAccessMode, jn as resolveProfileSpaceHistoryGatewayHost, n as OpenMeldApiClientInvalidResponseError, qt as createOpenMeldApiClient, t as OpenMeldApiClientHttpError, zr as postSpaceMembersResponseSchema } from "./dist-B07ziN_u.js";
5
+ import { d as runWithHeldLock, i as isOpenMeldLockError, lt as resolveOpenMeldEnvPreset, t as acquireLock, u as resolveOpenMeldOrphanedLockIssue } from "./lock-iue1J2xy.js";
6
+ import { Bi as toLegacySpaceImageGeometryWireValue, Br as removeSpaceMembersResponseSchema, Gn as parseIncoming$1, Jt as createOpenMeldApiClient, Kn as parseServerErrorFrame$1, Mn as resolveProfileSpaceHistoryGatewayHost, Nt as createAgentProfileBindingApi, Pn as toStructuredApiClientFailure, Rr as leaveSpaceResponseSchema, Un as MAX_TEXT_LENGTH, Ut as createFetchTransport, Vi as toCompatibleSpaceAddressingRequestWireValue, Wn as parseEnvelope$1, Yt as createOrganizationApi, gt as buildProfileSpaceHistoryUpsertPath, ht as buildProfileSpaceHistoryStatusPath, ii as resolveInitialSpaceAccessMode, jn as resolveAccountSpaceIndexGatewayHost, jt as createAccountSpaceIndexApi, n as OpenMeldApiClientInvalidResponseError, qn as resolveCustomMentionAliasOverride, t as OpenMeldApiClientHttpError, tn as createProfileSpaceHistoryApi, zr as postSpaceMembersResponseSchema } from "./dist-BeJcIdCZ.js";
7
7
  import { v as canonicalizeBuiltinAgentControllerRef, x as parseAgentControllerRef, y as normalizeBuiltinAgentControllerId } from "./controller-contract-DAOCaefz.js";
8
- import { Dt as resolveRegistryOriginLaunchCommand, Et as listBuiltinAgentsRegistryEntries, G as updateAgentRegistrations, H as resolveAgentTargetState, I as listAgentTargetStates, O as syncDeviceRuntimeStateProjection, Q as resolveLocalRegistryAgentIdFromAgentControllerRef, S as syncProfileWorkspaceState, ar as createAuthorityOpenMeldServiceRuntimeId, br as resolveSelectableCandidates, cr as isAgentExecutionReadyOrConnecting, er as buildAgentControllerRef, j as resolveAgentProfilePrimaryAgentControllerReport, jr as resolveBuiltinAgentControllerBrand, kt as resolveRegistryRuntimeAdapterContractByAgentControllerRef, ur as parseAgentControllerRef$1 } from "./prepare-provider-runtime-CWZcuMF6.js";
9
- import { Ct as SPACE_MENTION_REJECT_NOTICE_PURPOSE, In as buildTargetWakeLifecycleId, Sr as resolveSingleSpaceMentionLabels, St as SPACE_MEMBER_REMOVE_NOTICE_PURPOSE, Yn as executionContextSelectionSchema, _t as CONVERSATION_CONTINUITY_WARNING_PURPOSE, br as normalizeSpacePasswordText, fr as parseOptionalClientMessageId, pn as spaceFileNameSchema, qt as SPACE_FILE_MAX_SIZE_BYTES, rn as resolveSpaceFileMimeType, ui as MAX_TEXT_LENGTH$1, xt as SPACE_MEMBER_JOIN_NOTICE_PURPOSE } from "./runtime-transport-Cc_RN-PL.js";
10
- import { d as getAuthSessionState } from "./auth-session-nhS8jyux.js";
11
- import { D as normalizeOptionalWorkingDirectory } from "./control-plane-e3W6PD2M.js";
12
- import { D as createDelayedSpinner, G as ensureCommandAuthenticationOrCancel, N as renderHumanErrorCard, U as connectWebSocket, W as buildCommandAuthenticationPromptMessage, at as promptTextEntry, b as formatServiceRuntimeHeadline, it as buildUnifiedCardFrame, lt as getCurrentCommandCheckState, nt as renderInfoCard, x as resolveServiceParticipationReadiness, y as formatServiceParticipationReadinessLabel } from "./service-CfO38_a-.js";
13
- import { B as createOpenMeldHumanProfile, H as getOpenMeldProfileCapabilities, J as assertAdditionalHumanProfileCreationEnabled, U as listOpenMeldProfiles, et as buildHumanAuthenticationCard, it as resolveAuthenticationGuidanceFromError, rt as resolveAuthenticationGuidance, st as resolveCurrentOpenMeldAccountContext, z as createOpenMeldAgentProfile } from "./daemon-device-id-DWO9_QW6.js";
14
- import { F as formatSpaceMemberCommandRecoveryCopy, H as resolveGatewayChainRetryGuidance, I as resolveReplyReadinessAvailabilityReasonCopy, L as resolveReplyReadinessGuidanceSummaryCopy, M as formatReplyReadinessSummary, O as resolveCurrentReplyReadinessSnapshot, P as REPLY_READINESS_COPY, R as resolveOpenClawDiagnosticsGuidance, U as resolveOpenClawLocalDiagnosticsValue, V as resolveGatewayChainRepairGuidance, W as resolveLocalServiceDemand, b as buildDaemonServiceRepairGuidance, z as classifyGatewayChainFailure } from "./daemon-service-update-coordinator-D8O1uTtu.js";
15
- import { At as SpaceComposerSubmissionError, Bt as buildSpaceProfileAddPlan, Ct as removeSpaceConfig, Dt as upsertSpaceConfig, Et as updateSpaceLastSeenTs, Ft as buildSignalMessageReadProjection, Gt as collectResolvedSpaceMentions, It as buildSignalReplyWorkflowProjection, Jt as createSpaceTargetCatalog, Lt as buildSpaceMemberAgentPresencePresentation, Ot as writeSpaceCacheDeletionNoticeState, Pt as buildSignalIndex, Rt as buildSpaceMentionProfileIndex, St as readSpaceRecentMentionProfileIds, Tt as toSpaceConfigListIntegrityError, Wt as closeMentionPickerState, Xt as extractMentionAuthoringPrefix, Yt as enterRelationPickerState, _t as isLocalSpaceStateCorruptResult, an as listSpaceMentionSuggestions, bt as readSpaceConfig, cn as prepareSpaceFileOnlySubmission, dn as returnToTargetPickerState, en as isRelationPickerState, fn as updateAuthoredMentionRanges, ht as LocalSpaceStateIntegrityError, in as listSpaceMentionRelationChoices, jt as buildDispatchResultMessageReadProjection, kt as writeSpaceRecentMentionProfileIds, ln as resolveNextRecentMentionProfileIdsForQueuedText, mt as projectSpaceProfileCache, on as openTargetPickerState, sn as prepareSpaceComposerSubmission, tn as isTargetPickerState, un as resolveSpaceMemberAgentOwnerWakeDiagnosticsView, vt as listSpaceConfigs, wt as toLocalSpaceStateIntegrityError, xt as readSpaceLastSeenTs, yt as readSpaceCacheDeletionNoticeState, zt as buildSpaceMessageReadRelationSummary } from "./daemon-frame-transport-D2-tazuK.js";
16
- import { a as resolveBaseUrl, d as createDefaultRuntimeAgentControllerSettings } from "./base-url-D7uE_xTo.js";
8
+ import { Cr as resolveSelectableCandidates, Dt as resolveRegistryOriginLaunchCommand, Et as listBuiltinAgentsRegistryEntries, G as updateAgentRegistrations, H as resolveAgentTargetState, I as listAgentTargetStates, O as syncDeviceRuntimeStateProjection, Pr as resolveBuiltinAgentControllerBrand, Q as resolveLocalRegistryAgentIdFromAgentControllerRef, S as syncProfileWorkspaceState, cr as createAuthorityOpenMeldServiceRuntimeId, dr as isAgentExecutionReadyOrConnecting, j as resolveAgentProfilePrimaryAgentControllerReport, kt as resolveRegistryRuntimeAdapterContractByAgentControllerRef, pr as parseAgentControllerRef$1, rr as buildAgentControllerRef } from "./prepare-provider-runtime-MB-BxOgt.js";
9
+ import { Ct as SPACE_MEMBER_REMOVE_NOTICE_PURPOSE, Ln as buildTargetWakeLifecycleId, Sr as normalizeSpacePasswordText, St as SPACE_MEMBER_JOIN_NOTICE_PURPOSE, Xn as executionContextSelectionSchema, fi as MAX_TEXT_LENGTH$1, pr as parseOptionalClientMessageId, vt as CONVERSATION_CONTINUITY_WARNING_PURPOSE, wr as resolveSingleSpaceMentionLabels, wt as SPACE_MENTION_REJECT_NOTICE_PURPOSE } from "./runtime-transport-YIYHSJPn.js";
10
+ import { d as getAuthSessionState } from "./auth-session-uEk_Tx6T.js";
11
+ import { D as normalizeOptionalWorkingDirectory } from "./control-plane-rTE2rHZ5.js";
12
+ import { D as createDelayedSpinner, G as ensureCommandAuthenticationOrCancel, N as renderHumanErrorCard, U as connectWebSocket, W as buildCommandAuthenticationPromptMessage, at as promptTextEntry, b as formatServiceRuntimeHeadline, it as buildUnifiedCardFrame, lt as getCurrentCommandCheckState, nt as renderInfoCard, x as resolveServiceParticipationReadiness, y as formatServiceParticipationReadinessLabel } from "./service-Dz2MsvGr.js";
13
+ import { At as SpaceComposerSubmissionError, Bt as buildSpaceProfileAddPlan, Ct as removeSpaceConfig, Dt as upsertSpaceConfig, Et as updateSpaceLastSeenTs, Ft as buildSignalMessageReadProjection, Gt as collectResolvedSpaceMentions, It as buildSignalReplyWorkflowProjection, Jt as createSpaceTargetCatalog, Lt as buildSpaceMemberAgentPresencePresentation, Ot as writeSpaceCacheDeletionNoticeState, Pt as buildSignalIndex, Rt as buildSpaceMentionProfileIndex, St as readSpaceRecentMentionProfileIds, Tt as toSpaceConfigListIntegrityError, Wt as closeMentionPickerState, Xt as extractMentionAuthoringPrefix, Yt as enterRelationPickerState, _t as isLocalSpaceStateCorruptResult, an as listSpaceMentionSuggestions, bt as readSpaceConfig, cn as prepareSpaceFileOnlySubmission, dn as returnToTargetPickerState, en as isRelationPickerState, fn as updateAuthoredMentionRanges, ht as LocalSpaceStateIntegrityError, in as listSpaceMentionRelationChoices, jt as buildDispatchResultMessageReadProjection, kt as writeSpaceRecentMentionProfileIds, ln as resolveNextRecentMentionProfileIdsForQueuedText, mt as projectSpaceProfileCache, on as openTargetPickerState, sn as prepareSpaceComposerSubmission, tn as isTargetPickerState, un as resolveSpaceMemberAgentOwnerWakeDiagnosticsView, vt as listSpaceConfigs, wt as toLocalSpaceStateIntegrityError, xt as readSpaceLastSeenTs, yt as readSpaceCacheDeletionNoticeState, zt as buildSpaceMessageReadRelationSummary } from "./daemon-frame-transport-WiB73yhT.js";
14
+ import { B as requireOpenMeldProfile, G as getOpenMeldProfileCapabilities, H as createOpenMeldAgentProfile, K as listOpenMeldProfiles, U as createOpenMeldHumanProfile, V as resolveOpenMeldProfileOrNull, Z as assertAdditionalHumanProfileCreationEnabled, ct as buildHumanAuthenticationCard, dt as resolveAuthenticationGuidance, ft as resolveAuthenticationGuidanceFromError, ht as resolveCurrentOpenMeldAccountContext } from "./daemon-device-id-B1Af2Zmn.js";
15
+ import { F as formatSpaceMemberCommandRecoveryCopy, H as resolveGatewayChainRetryGuidance, I as resolveReplyReadinessAvailabilityReasonCopy, L as resolveReplyReadinessGuidanceSummaryCopy, M as formatReplyReadinessSummary, O as resolveCurrentReplyReadinessSnapshot, P as REPLY_READINESS_COPY, R as resolveOpenClawDiagnosticsGuidance, U as resolveOpenClawLocalDiagnosticsValue, V as resolveGatewayChainRepairGuidance, W as resolveLocalServiceDemand, b as buildDaemonServiceRepairGuidance, z as classifyGatewayChainFailure } from "./daemon-service-update-coordinator-0LB_XGVZ.js";
16
+ import { a as resolveBaseUrl, d as createDefaultRuntimeAgentControllerSettings } from "./base-url-DvjOkKPs.js";
17
17
  import { a as formatOpenMeldCliTextBlock, l as resolveUserFacingCliEntryCommand, n as formatOpenMeldCliCommand, o as formatProfileAwareOpenMeldCliCommand, r as formatOpenMeldCliCommands, t as formatInlineOpenMeldCliCommands } from "./cli-entry-command-CR_9QU1i.js";
18
18
  import { t as sleep } from "./dist-BLuEEVHh.js";
19
- import { a as requireOpenMeldProfile, n as resolveRuntimeContext, o as resolveOpenMeldProfileOrNull } from "./context-l_31Mn4X.js";
20
- import { a as outJsonLine, i as errLine, n as sanitizeTerminalDisplayText, o as outLine, r as formatMessage, t as createPresenter } from "./presenter-BcxiQyJg.js";
21
- import { $ as ROOT_ENTRY_START_COMMAND, A as createSpaceLeaveCreatorGuideError, B as createSpaceSendInputEmptyGuideError, D as createSpaceContractSetGuideError, F as createSpaceRemoveMembersCreatorGuideError, G as createSpaceUnsupportedProfileKindGuideError, H as createSpaceSendInputRequiredGuideError, I as createSpaceRemoveMembersCurrentProfileGuideError, K as createSpaceUpdatesGuideError, L as createSpaceRemoveMembersGuideError, M as createSpaceMenuGuideError, N as createSpaceProfileRequiredGuideError, O as createSpaceCreateGuideError, P as createSpacePublicationSetGuideError, Q as ROOT_ENTRY_COMMANDS, R as createSpaceResultGuideError, T as createSpaceAddMembersGuideError, Tt as formatAgentOverviewPayload, U as createSpaceSubcommandTargetGuideError, V as createSpaceSendInputFileReadFailedGuideError, W as createSpaceTargetGuideError, b as createProfileCreateGuideError, dt as getCliVersionInfo, g as canUseInteractivePrompts, it as resolveSpaceAddMembersProgressPhase, j as createSpaceLeaveGuideError, k as createSpaceDeleteHumanApprovalGuideError, nt as SPACE_ADD_MEMBERS_AGENT_OVERVIEW_STAGES, rt as SPACE_ADD_MEMBERS_PROGRESS_HEARTBEAT_MS, tt as validateSpaceMemberSelectionInput, ut as formatCliVersionSummary, w as createSpaceAddMembersCurrentProfileGuideError, z as createSpaceSendInputConflictGuideError } from "./elapsed-time-Ooo4IC25.js";
22
- import { a as buildOpenMeldProfileIdentityRequestHeadersWithAuth, d as buildOpenMeldRequestContextFromProfile, f as buildOpenMeldRequestContextFromProfileIdentity, m as resolveAuthRequestCompatibility, n as fetchSpaceRequestWithTimeout, o as buildOpenMeldProfileRequestHeadersWithAuth, p as deriveAuthBaseUrlFromGatewayUrl, r as resolveSpaceRequestTimeoutMsForDiagnostics, s as buildOpenMeldRequestContextHeadersWithAuth, t as createCliApiClientFoundation } from "./api-client-foundation-DnJ_JYli.js";
23
- import { S as buildSpaceWebUrl, T as runDaemonServiceParticipationGate, _ as promptSearchSelect, b as resolveOffsetVisibleWindow, f as runAgentsRepair, g as promptSearchMultiselectWorkbench, h as promptSearchMultiselect, l as runAgentsEnable, m as formatTransportModeDisplay, v as clampNumber$2, x as computeRetryDelayMs, y as resolveAnchoredVisibleWindow } from "./agents-B8zhQnGw.js";
24
- import { l as resolveLocalAgentControllerReportDecision, n as submitProfileRuntimeAgentControllerReport, o as collectLocalAgentControllerInventory, r as submitRuntimeAgentControllerReport } from "./runtime-agent-controller-reporting-submission-BUUub9_1.js";
25
- import { a as parseSpaceMetaResponse, d as assertDispatchOwnedRuntimePublicWriteAllowed, i as parseSpaceMetaPayload, l as toStructuredGatewayFailure, n as fetchSpaceMeta, o as GatewayHttpError, s as readGatewayJsonResponse, t as createCliSpaceApi } from "./cli-space-api-CQtKu9Zt.js";
26
- import { basename } from "node:path";
27
- import { access, readFile } from "node:fs/promises";
19
+ import { n as resolveRuntimeContext } from "./context-Bdh3nAzw.js";
20
+ import { n as outJsonLine, r as outLine, t as errLine } from "./io-DT66typ4.js";
21
+ import { n as sanitizeTerminalDisplayText, r as formatMessage, t as createPresenter } from "./presenter-MJ5YgsOT.js";
22
+ import { $ as ROOT_ENTRY_START_COMMAND, A as createSpaceLeaveCreatorGuideError, B as createSpaceSendInputEmptyGuideError, D as createSpaceContractSetGuideError, F as createSpaceRemoveMembersCreatorGuideError, G as createSpaceUnsupportedProfileKindGuideError, H as createSpaceSendInputRequiredGuideError, I as createSpaceRemoveMembersCurrentProfileGuideError, K as createSpaceUpdatesGuideError, L as createSpaceRemoveMembersGuideError, M as createSpaceMenuGuideError, N as createSpaceProfileRequiredGuideError, O as createSpaceCreateGuideError, P as createSpacePublicationSetGuideError, Q as ROOT_ENTRY_COMMANDS, R as createSpaceResultGuideError, T as createSpaceAddMembersGuideError, Tt as formatAgentOverviewPayload, U as createSpaceSubcommandTargetGuideError, V as createSpaceSendInputFileReadFailedGuideError, W as createSpaceTargetGuideError, b as createProfileCreateGuideError, dt as getCliVersionInfo, g as canUseInteractivePrompts, it as resolveSpaceAddMembersProgressPhase, j as createSpaceLeaveGuideError, k as createSpaceDeleteHumanApprovalGuideError, nt as SPACE_ADD_MEMBERS_AGENT_OVERVIEW_STAGES, rt as SPACE_ADD_MEMBERS_PROGRESS_HEARTBEAT_MS, tt as validateSpaceMemberSelectionInput, ut as formatCliVersionSummary, w as createSpaceAddMembersCurrentProfileGuideError, z as createSpaceSendInputConflictGuideError } from "./elapsed-time-q8lSPcfm.js";
23
+ import { a as buildOpenMeldProfileIdentityRequestHeadersWithAuth, d as buildOpenMeldRequestContextFromProfile, f as buildOpenMeldRequestContextFromProfileIdentity, m as resolveAuthRequestCompatibility, n as fetchSpaceRequestWithTimeout, o as buildOpenMeldProfileRequestHeadersWithAuth, p as deriveAuthBaseUrlFromGatewayUrl, r as resolveSpaceRequestTimeoutMsForDiagnostics, s as buildOpenMeldRequestContextHeadersWithAuth, t as createCliApiClientFoundation } from "./api-client-foundation-DpVwrgh-.js";
24
+ import { S as buildSpaceWebUrl, T as runDaemonServiceParticipationGate, _ as promptSearchSelect, b as resolveOffsetVisibleWindow, f as runAgentsRepair, g as promptSearchMultiselectWorkbench, h as promptSearchMultiselect, l as runAgentsEnable, m as formatTransportModeDisplay, v as clampNumber$2, x as computeRetryDelayMs, y as resolveAnchoredVisibleWindow } from "./agents-CR7BebgO.js";
25
+ import { l as resolveLocalAgentControllerReportDecision, n as submitProfileRuntimeAgentControllerReport, o as collectLocalAgentControllerInventory, r as submitRuntimeAgentControllerReport } from "./runtime-agent-controller-reporting-submission-D9ysbi7R.js";
26
+ import { a as GatewayHttpError, c as toStructuredGatewayFailure, d as uploadPreparedSpaceFiles, f as createCliSpaceApi, i as parseSpaceMetaResponse, o as readGatewayJsonResponse, p as assertDispatchOwnedRuntimePublicWriteAllowed, r as parseSpaceMetaPayload, t as fetchSpaceMeta, u as prepareRequestedSpaceSendFiles } from "./meta-api-B1k3mwHN.js";
27
+ import { readFile } from "node:fs/promises";
28
28
  import * as z$1 from "zod/v4";
29
- import { openAsBlob } from "node:fs";
30
29
  import { stripVTControlCharacters } from "node:util";
31
30
  import pc from "picocolors";
32
31
  import { cancel, confirm, isCancel, multiselect, password, select, text } from "@clack/prompts";
@@ -19172,148 +19171,6 @@ async function leaveSpace(input) {
19172
19171
  });
19173
19172
  }
19174
19173
  //#endregion
19175
- //#region src/space/send-files.ts
19176
- var SpaceSendFileError = class extends Error {
19177
- code;
19178
- requestId;
19179
- status;
19180
- upstreamCode;
19181
- constructor(input) {
19182
- super(input.message, { cause: input.cause });
19183
- this.name = "SpaceSendFileError";
19184
- this.code = input.code;
19185
- if (input.requestId) this.requestId = input.requestId;
19186
- if (input.status !== null && input.status !== void 0) this.status = input.status;
19187
- if (input.upstreamCode) this.upstreamCode = input.upstreamCode;
19188
- }
19189
- };
19190
- async function prepareRequestedSpaceSendFiles(input) {
19191
- if (input.filePaths.length > 10) throw new SpaceSendFileError({
19192
- code: "space.file.too_many",
19193
- message: `A Space message can include at most 10 files. The message was not sent.`
19194
- });
19195
- const prepared = [];
19196
- for (const rawPath of input.filePaths) {
19197
- if (!rawPath.trim()) throw new SpaceSendFileError({
19198
- code: "space.file.invalid_path",
19199
- message: "File paths cannot be empty. The message was not sent."
19200
- });
19201
- prepared.push(await prepareSpaceSendFile(rawPath));
19202
- }
19203
- return prepared;
19204
- }
19205
- async function uploadPreparedSpaceFiles(input) {
19206
- const uploaded = [];
19207
- for (const file of input.files) try {
19208
- const descriptor = await input.spaceApi.uploadFile({
19209
- bytes: file.bytes,
19210
- clientMutationId: crypto.randomUUID(),
19211
- mimeType: file.mimeType,
19212
- name: file.name,
19213
- origin: "chat_upload",
19214
- parentId: null,
19215
- requestContext: input.requestContext,
19216
- spaceId: input.spaceId,
19217
- ...input.password === void 0 ? {} : { spacePassword: input.password }
19218
- });
19219
- uploaded.push({
19220
- fileId: descriptor.id,
19221
- revision: descriptor.latestRevision.revision,
19222
- name: descriptor.name,
19223
- mimeType: descriptor.latestRevision.mimeType,
19224
- sizeBytes: descriptor.latestRevision.sizeBytes
19225
- });
19226
- } catch (error) {
19227
- const failure = toStructuredApiClientFailure(error);
19228
- const cleanupFailures = await moveUploadedFilesToTrash({
19229
- files: uploaded,
19230
- password: input.password,
19231
- requestContext: input.requestContext,
19232
- spaceApi: input.spaceApi,
19233
- spaceId: input.spaceId
19234
- });
19235
- let cleanupMessage = "";
19236
- if (uploaded.length > 0) cleanupMessage = cleanupFailures.length === 0 ? " Files added earlier in this send were moved to Trash." : ` ${formatCleanupFailures({
19237
- failures: cleanupFailures,
19238
- passwordProtected: input.password !== void 0,
19239
- profileId: input.requestContext.actorContext.openMeldProfileId,
19240
- spaceId: input.spaceId
19241
- })}`;
19242
- throw new SpaceSendFileError({
19243
- code: failure.code ?? "space.file.upload_failed",
19244
- message: `Could not add file "${file.name}" to this Space. The message was not sent. ${failure.message}${cleanupMessage}`,
19245
- cause: error,
19246
- requestId: failure.requestId,
19247
- status: failure.status,
19248
- upstreamCode: failure.upstreamCode
19249
- });
19250
- }
19251
- return uploaded;
19252
- }
19253
- async function moveUploadedFilesToTrash(input) {
19254
- const failures = [];
19255
- for (const file of input.files) try {
19256
- await input.spaceApi.trashFileEntry({
19257
- clientMutationId: crypto.randomUUID(),
19258
- entryId: file.fileId,
19259
- requestContext: input.requestContext,
19260
- spaceId: input.spaceId,
19261
- ...input.password === void 0 ? {} : { spacePassword: input.password }
19262
- });
19263
- } catch (error) {
19264
- failures.push({
19265
- failure: toStructuredApiClientFailure(error),
19266
- fileId: file.fileId
19267
- });
19268
- }
19269
- return failures;
19270
- }
19271
- function formatCleanupFailures(input) {
19272
- return `${input.failures.map(({ failure, fileId }) => {
19273
- const evidence = [failure.code ? `code ${failure.code}` : null, failure.requestId ? `request ${failure.requestId}` : null].filter((value) => value !== null).join(", ");
19274
- return `Could not move file ${fileId} to Trash${evidence ? ` (${evidence})` : ""}: ${failure.message} Run \`openmeld space files trash ${input.spaceId} ${fileId} --profile ${input.profileId}\` to finish cleanup.`;
19275
- }).join(" ")}${input.passwordProtected ? " This Space is password protected. Add `--password` with the same Space password you used for this send; OpenMeld does not include the password in this message." : ""}`;
19276
- }
19277
- async function prepareSpaceSendFile(sourcePath) {
19278
- let bytes;
19279
- try {
19280
- await access(sourcePath);
19281
- bytes = await openAsBlob(sourcePath);
19282
- } catch (error) {
19283
- if (readNodeErrorCode(error) === "ENOENT") throw new SpaceSendFileError({
19284
- code: "space.file.file_not_found",
19285
- message: `File not found: ${sourcePath}. The message was not sent.`,
19286
- cause: error
19287
- });
19288
- throw new SpaceSendFileError({
19289
- code: "space.file.file_unreadable",
19290
- message: `Could not read file: ${sourcePath}. The message was not sent.`,
19291
- cause: error
19292
- });
19293
- }
19294
- if (bytes.size > 262144e3) throw new SpaceSendFileError({
19295
- code: "space.file.too_large",
19296
- message: `File exceeds the ${formatFileSizeLimit()} limit: ${sourcePath}. The message was not sent.`
19297
- });
19298
- const parsedName = spaceFileNameSchema.safeParse(basename(sourcePath));
19299
- if (!parsedName.success) throw new SpaceSendFileError({
19300
- code: "space.file.invalid_file_name",
19301
- message: `File name is invalid: ${sourcePath}. The message was not sent.`
19302
- });
19303
- return {
19304
- bytes,
19305
- name: parsedName.data,
19306
- mimeType: resolveSpaceFileMimeType({ fileName: parsedName.data })
19307
- };
19308
- }
19309
- function readNodeErrorCode(error) {
19310
- if (!(error && typeof error === "object" && "code" in error)) return null;
19311
- return typeof error.code === "string" ? error.code : null;
19312
- }
19313
- function formatFileSizeLimit() {
19314
- return `${SPACE_FILE_MAX_SIZE_BYTES / (1024 * 1024)} MiB`;
19315
- }
19316
- //#endregion
19317
19174
  //#region src/space/send.ts
19318
19175
  async function runSend(input) {
19319
19176
  assertDispatchOwnedRuntimePublicWriteAllowed({ commandLabel: "openmeld space send" });
@@ -24481,6 +24338,6 @@ function isHumanInteractiveSpaceRuntime(runtime) {
24481
24338
  return runtime.resolvedView === "human" && canUseInteractivePrompts(runtime);
24482
24339
  }
24483
24340
  //#endregion
24484
- export { resolveCreateProfileKind as $, parseEnvelope as A, resolveHumanControllerDisplayName as B, toSpaceMetaUpsertInput as C, formatHumanReadTargetList as D, buildHumanReplyContextSummary as E, resolveOpenMeldProfileForSpaceCommand as F, printOpenMeldBanner as G, resolveAgentProfileSetup as H, emitSpaceAgentOverview as I, renderOpenMeldLogo as J, renderOpenMeldBrandBlockLines as K, emitSpaceCliAgentOverview as L, assertFullSignalIdArgument as M, assertValidSpaceIdTarget as N, resolveLinkAccessLabel as O, prepareAuthenticatedSpaceCommandContext as P, createProfileByKind as Q, prepareLocalAgentReadiness as R, loadSpaceSignalIndexOrNull as S, buildFormalSignalReadPayload as T, colorizeAgentLabel as U, persistAgentTransportSelection as V, colorizeDisplayProfileLabel as W, resolveSpaceSendText as X, renderOpenMeldTagline as Y, resolveSpaceTaskSelection as Z, runSpaceWriteWithPasswordRetry as _, runSpaceDelete as a, buildIdentityOnlyMembersSnapshotForReadProjection as b, runSpaceLeave as c, runSpaceRemoveMembers as d, resolveCreateProfileName as et, runSpaceSend as f, runSpaceReadWithPasswordRetry as g, uploadPreparedSpaceFiles as h, runSpaceCreate as i, isSpaceCommandOutputHandledError as j, resolveOrganizationVisibilityLabel as k, runSpaceList as l, prepareRequestedSpaceSendFiles as m, promptAndConfirmSpacePassword as n, assessActionParticipationCandidate as nt, runSpaceHistory as o, runSpaceWatch as p, renderOpenMeldHeader as q, runSpaceAddMembers as r, runSpaceJoin as s, buildCreateSpacePasswordPromptConfig as t, ensureAgentProfileRuntimeBinding as tt, runSpacePassword as u, buildHumanReadSignalsTranscriptItems as v, buildFormalDispatchResultReadPayload as w, loadSpaceIdentityDirectoryOrNull as x, emitHumanReadSignalsTextProjection as y, buildReplyReadinessGuidance as z };
24341
+ export { ensureAgentProfileRuntimeBinding as $, assertFullSignalIdArgument as A, resolveAgentProfileSetup as B, buildFormalSignalReadPayload as C, resolveOrganizationVisibilityLabel as D, resolveLinkAccessLabel as E, emitSpaceCliAgentOverview as F, renderOpenMeldHeader as G, colorizeDisplayProfileLabel as H, prepareLocalAgentReadiness as I, resolveSpaceSendText as J, renderOpenMeldLogo as K, buildReplyReadinessGuidance as L, prepareAuthenticatedSpaceCommandContext as M, resolveOpenMeldProfileForSpaceCommand as N, parseEnvelope as O, emitSpaceAgentOverview as P, resolveCreateProfileName as Q, resolveHumanControllerDisplayName as R, buildFormalDispatchResultReadPayload as S, formatHumanReadTargetList as T, printOpenMeldBanner as U, colorizeAgentLabel as V, renderOpenMeldBrandBlockLines as W, createProfileByKind as X, resolveSpaceTaskSelection as Y, resolveCreateProfileKind as Z, emitHumanReadSignalsTextProjection as _, runSpaceDelete as a, loadSpaceSignalIndexOrNull as b, runSpaceLeave as c, runSpaceRemoveMembers as d, assessActionParticipationCandidate as et, runSpaceSend as f, buildHumanReadSignalsTranscriptItems as g, runSpaceWriteWithPasswordRetry as h, runSpaceCreate as i, assertValidSpaceIdTarget as j, isSpaceCommandOutputHandledError as k, runSpaceList as l, runSpaceReadWithPasswordRetry as m, promptAndConfirmSpacePassword as n, runSpaceHistory as o, runSpaceWatch as p, renderOpenMeldTagline as q, runSpaceAddMembers as r, runSpaceJoin as s, buildCreateSpacePasswordPromptConfig as t, runSpacePassword as u, buildIdentityOnlyMembersSnapshotForReadProjection as v, buildHumanReplyContextSummary as w, toSpaceMetaUpsertInput as x, loadSpaceIdentityDirectoryOrNull as y, persistAgentTransportSelection as z };
24485
24342
 
24486
- //# sourceMappingURL=command-Bz9x7V2T.js.map
24343
+ //# sourceMappingURL=command-CQ9XRwqf.js.map