openmeld 0.3.216 → 0.3.217

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 (116) hide show
  1. package/dist/{add-me-membership-CxgkT6ht.js → add-me-membership-C2Ys6Gq2.js} +2 -2
  2. package/dist/{add-me-membership-CxgkT6ht.js.map → add-me-membership-C2Ys6Gq2.js.map} +1 -1
  3. package/dist/{agents-B_qjzGkQ.js → agents-ClqMS9aO.js} +10 -10
  4. package/dist/{agents-B_qjzGkQ.js.map → agents-ClqMS9aO.js.map} +1 -1
  5. package/dist/{api-client-foundation-DdtV7aF-.js → api-client-foundation-CMVD057A.js} +1 -1
  6. package/dist/{api-client-foundation-XILCNkrF.js → api-client-foundation-Cib1elkI.js} +3 -3
  7. package/dist/{api-client-foundation-XILCNkrF.js.map → api-client-foundation-Cib1elkI.js.map} +1 -1
  8. package/dist/auth-session-D7oAIuHk.js +4 -0
  9. package/dist/{auth-session-B9Whm1hq.js → auth-session-DOjVKRI_.js} +2 -2
  10. package/dist/{auth-session-B9Whm1hq.js.map → auth-session-DOjVKRI_.js.map} +1 -1
  11. package/dist/{base-url-CiSsUvmr.js → base-url-CMBApK1J.js} +1 -1
  12. package/dist/{base-url-jdL78gyl.js → base-url-D7uE_xTo.js} +2 -2
  13. package/dist/{base-url-jdL78gyl.js.map → base-url-D7uE_xTo.js.map} +1 -1
  14. package/dist/{channel-CKmbucdt.js → channel-BfTy6fDo.js} +4 -4
  15. package/dist/{channel-CKmbucdt.js.map → channel-BfTy6fDo.js.map} +1 -1
  16. package/dist/{cli-space-api-DlDztj9O.js → cli-space-api-BT_Pu9Yg.js} +6 -6
  17. package/dist/{cli-space-api-DlDztj9O.js.map → cli-space-api-BT_Pu9Yg.js.map} +1 -1
  18. package/dist/{command-Cbp4ZeZs.js → command-C1w0UpIu.js} +28 -23
  19. package/dist/command-C1w0UpIu.js.map +1 -0
  20. package/dist/{computer-connection-CVE1MAqF.js → computer-connection-DsjsjmPp.js} +2 -2
  21. package/dist/{computer-connection-CVE1MAqF.js.map → computer-connection-DsjsjmPp.js.map} +1 -1
  22. package/dist/{computer-connection-review-CfFmjZLP.js → computer-connection-review-RXJyryCh.js} +5 -5
  23. package/dist/{computer-connection-review-CfFmjZLP.js.map → computer-connection-review-RXJyryCh.js.map} +1 -1
  24. package/dist/{computer-disconnect-B5nMRe9T.js → computer-disconnect-B_LZM2QE.js} +7 -7
  25. package/dist/{computer-disconnect-B5nMRe9T.js.map → computer-disconnect-B_LZM2QE.js.map} +1 -1
  26. package/dist/{computer-setup-continuation-Bd3BIgdU.js → computer-setup-continuation-BVI7SD0M.js} +3 -3
  27. package/dist/{computer-setup-continuation-Bd3BIgdU.js.map → computer-setup-continuation-BVI7SD0M.js.map} +1 -1
  28. package/dist/{context-Cz5nJnDe.js → context-Di5R4iik.js} +5 -5
  29. package/dist/{context-Cz5nJnDe.js.map → context-Di5R4iik.js.map} +1 -1
  30. package/dist/{control-plane-DKPz7DMv.js → control-plane-BDS63N7Y.js} +2 -2
  31. package/dist/{control-plane-DKPz7DMv.js.map → control-plane-BDS63N7Y.js.map} +1 -1
  32. package/dist/{controller-contract-pe3_Re-c.js → controller-contract-DAOCaefz.js} +9 -1
  33. package/dist/controller-contract-DAOCaefz.js.map +1 -0
  34. package/dist/{daemon-device-id-KgO7zcEr.js → daemon-device-id-bfkbZj9G.js} +7 -7
  35. package/dist/{daemon-device-id-KgO7zcEr.js.map → daemon-device-id-bfkbZj9G.js.map} +1 -1
  36. package/dist/{daemon-frame-transport-DUDAgNbO.js → daemon-frame-transport-saNQVOyi.js} +8 -8
  37. package/dist/daemon-frame-transport-saNQVOyi.js.map +1 -0
  38. package/dist/{daemon-lifecycle-journal-Bj-fw052.js → daemon-lifecycle-journal-DP01txRB.js} +5 -4
  39. package/dist/{daemon-lifecycle-journal-Bj-fw052.js.map → daemon-lifecycle-journal-DP01txRB.js.map} +1 -1
  40. package/dist/{daemon-service-manager-Cq3ANgn8.js → daemon-service-manager-CRHq3YSj.js} +1 -1
  41. package/dist/{daemon-service-manager-CZY8Bin4.js → daemon-service-manager-CXbN836B.js} +2 -2
  42. package/dist/{daemon-service-manager-CZY8Bin4.js.map → daemon-service-manager-CXbN836B.js.map} +1 -1
  43. package/dist/{daemon-service-runtime-yD-w1dQw.js → daemon-service-runtime-DpiD8oap.js} +5 -5
  44. package/dist/{daemon-service-runtime-yD-w1dQw.js.map → daemon-service-runtime-DpiD8oap.js.map} +1 -1
  45. package/dist/{daemon-service-update-coordinator-BATuKmZA.js → daemon-service-update-coordinator-BuCEBJoe.js} +16 -16
  46. package/dist/{daemon-service-update-coordinator-BATuKmZA.js.map → daemon-service-update-coordinator-BuCEBJoe.js.map} +1 -1
  47. package/dist/{dist-o3UL1EGQ.js → dist-BLuEEVHh.js} +2 -2
  48. package/dist/dist-BLuEEVHh.js.map +1 -0
  49. package/dist/{dist-Ddy96dwl.js → dist-BdibASYs.js} +3 -3
  50. package/dist/{dist-Ddy96dwl.js.map → dist-BdibASYs.js.map} +1 -1
  51. package/dist/{dist-CkGG099H.js → dist-DkRliHib.js} +9292 -9207
  52. package/dist/dist-DkRliHib.js.map +1 -0
  53. package/dist/{dist-DZYJ8yLA.js → dist-RR7jryeV.js} +1 -1
  54. package/dist/{elapsed-time-DGQ63StD.js → elapsed-time-CR9OIZSD.js} +6 -6
  55. package/dist/{elapsed-time-DGQ63StD.js.map → elapsed-time-CR9OIZSD.js.map} +1 -1
  56. package/dist/{entry-Dhify7h7.js → entry-CSoHtCQ9.js} +8 -8
  57. package/dist/{entry-Dhify7h7.js.map → entry-CSoHtCQ9.js.map} +1 -1
  58. package/dist/{installation-inventory-BJe8fC9k.js → installation-inventory-CscX0nmD.js} +4 -4
  59. package/dist/{installation-inventory-BJe8fC9k.js.map → installation-inventory-CscX0nmD.js.map} +1 -1
  60. package/dist/{installer-CWgaNzfE.js → installer-CkF3gSdD.js} +2 -2
  61. package/dist/{installer-CWgaNzfE.js.map → installer-CkF3gSdD.js.map} +1 -1
  62. package/dist/{openmeld-koCpjXo7.js → openmeld-BcyBlby4.js} +44 -40
  63. package/dist/openmeld-BcyBlby4.js.map +1 -0
  64. package/dist/openmeld-dev.js +1 -1
  65. package/dist/{openmeld-environment-target-Dn2rJCa7.js → openmeld-environment-target-B6HqY0_a.js} +2 -2
  66. package/dist/{openmeld-environment-target-Dn2rJCa7.js.map → openmeld-environment-target-B6HqY0_a.js.map} +1 -1
  67. package/dist/{openmeld-maintenance-worker-DdsIYpG-.js → openmeld-maintenance-worker-Brsfy22C.js} +11 -11
  68. package/dist/{openmeld-maintenance-worker-DdsIYpG-.js.map → openmeld-maintenance-worker-Brsfy22C.js.map} +1 -1
  69. package/dist/{openmeld-tools-update-join-Clgm1ix5.js → openmeld-tools-update-join-CUh0JERe.js} +4 -4
  70. package/dist/{openmeld-tools-update-join-Clgm1ix5.js.map → openmeld-tools-update-join-CUh0JERe.js.map} +1 -1
  71. package/dist/{openmeld-tools-update-process-frame-0X-t0Kjv.js → openmeld-tools-update-process-frame-B-XB4dmO.js} +2 -2
  72. package/dist/{openmeld-tools-update-process-frame-0X-t0Kjv.js.map → openmeld-tools-update-process-frame-B-XB4dmO.js.map} +1 -1
  73. package/dist/{openmeld-tools-update-process-frame-DX1Dc8VI.js → openmeld-tools-update-process-frame-j-RXwFsK.js} +1 -1
  74. package/dist/openmeld.js +5 -5
  75. package/dist/{prepare-provider-runtime-CeGzeQbD.js → prepare-provider-runtime-DxaGSe3R.js} +1130 -122
  76. package/dist/prepare-provider-runtime-DxaGSe3R.js.map +1 -0
  77. package/dist/{prepare-session-executor-CsxnDFgS.js → prepare-session-executor-CyouBl49.js} +22 -22
  78. package/dist/{prepare-session-executor-CsxnDFgS.js.map → prepare-session-executor-CyouBl49.js.map} +1 -1
  79. package/dist/{process-channel-BTxB9zK-.js → process-channel-Cocpv3Br.js} +2 -2
  80. package/dist/{process-channel-BTxB9zK-.js.map → process-channel-Cocpv3Br.js.map} +1 -1
  81. package/dist/{runtime-CesmzZ2L.js → runtime-DGT66AR-.js} +19 -19
  82. package/dist/{runtime-CesmzZ2L.js.map → runtime-DGT66AR-.js.map} +1 -1
  83. package/dist/{runtime-agent-controller-reporting-submission-B6cDV_zW.js → runtime-agent-controller-reporting-submission-C1Vc_JWm.js} +59 -9
  84. package/dist/runtime-agent-controller-reporting-submission-C1Vc_JWm.js.map +1 -0
  85. package/dist/{runtime-reporting-health-state-Cjavvccq.js → runtime-reporting-health-state-CPWlQ5IX.js} +9 -9
  86. package/dist/{runtime-reporting-health-state-Cjavvccq.js.map → runtime-reporting-health-state-CPWlQ5IX.js.map} +1 -1
  87. package/dist/{runtime-transport-CVtBXzIp.js → runtime-transport-BLtOFrtv.js} +64 -11
  88. package/dist/runtime-transport-BLtOFrtv.js.map +1 -0
  89. package/dist/{service-Cgat7nEE.js → service-ClETdJbz.js} +49 -28
  90. package/dist/service-ClETdJbz.js.map +1 -0
  91. package/dist/{service-account-authorization-Ct0OZwbr.js → service-account-authorization-kciEaW5t.js} +3 -3
  92. package/dist/{service-account-authorization-Ct0OZwbr.js.map → service-account-authorization-kciEaW5t.js.map} +1 -1
  93. package/dist/{service-account-control-DefN0EOY.js → service-account-control-3n_YwNsF.js} +10 -10
  94. package/dist/{service-account-control-DefN0EOY.js.map → service-account-control-3n_YwNsF.js.map} +1 -1
  95. package/dist/{service-control-capabilities-BsCCHsUg.js → service-control-capabilities-C2tMMuFl.js} +4 -4
  96. package/dist/{service-control-capabilities-BsCCHsUg.js.map → service-control-capabilities-C2tMMuFl.js.map} +1 -1
  97. package/dist/{service-control-capabilities-m7mmxVOi.js → service-control-capabilities-DoW5MW7A.js} +1 -1
  98. package/dist/{state-C2ztY4iq.js → state-CMs4p0wo.js} +2 -2
  99. package/dist/{state-C2ztY4iq.js.map → state-CMs4p0wo.js.map} +1 -1
  100. package/dist/{upgrade-O_blyOta.js → upgrade-2epQATRq.js} +8 -8
  101. package/dist/{upgrade-O_blyOta.js.map → upgrade-2epQATRq.js.map} +1 -1
  102. package/dist/upgrade-BVIot_cP.js +4 -0
  103. package/package.json +3 -2
  104. package/skills/openmeld-cli/playbooks/agent-onboarding.md +15 -0
  105. package/dist/auth-session-DXKHtGTr.js +0 -4
  106. package/dist/command-Cbp4ZeZs.js.map +0 -1
  107. package/dist/controller-contract-pe3_Re-c.js.map +0 -1
  108. package/dist/daemon-frame-transport-DUDAgNbO.js.map +0 -1
  109. package/dist/dist-CkGG099H.js.map +0 -1
  110. package/dist/dist-o3UL1EGQ.js.map +0 -1
  111. package/dist/openmeld-koCpjXo7.js.map +0 -1
  112. package/dist/prepare-provider-runtime-CeGzeQbD.js.map +0 -1
  113. package/dist/runtime-agent-controller-reporting-submission-B6cDV_zW.js.map +0 -1
  114. package/dist/runtime-transport-CVtBXzIp.js.map +0 -1
  115. package/dist/service-Cgat7nEE.js.map +0 -1
  116. package/dist/upgrade-axb9z2uy.js +0 -4
@@ -1 +1 @@
1
- {"version":3,"file":"channel-CKmbucdt.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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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
+ {"version":3,"file":"channel-BfTy6fDo.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,CAA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,MAAM,SAAS,4BAA4B,QAAQ;EACnD,MAAM,UAAU,OAAO,MAAM,UAAU,QAAQ,OAAO;EACtD,IAAI,CAAC,QAAQ,SAAS;GACpB,OACE,IAAI,mBACF,wBACA,WAAW,QAAQ,OAAO,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"}
@@ -2,13 +2,13 @@
2
2
 
3
3
  import { f as toSpaceMetaUrl } from "./urls-CY2uzH2-.js";
4
4
  import { Z as openMeldManagedBinaryPath, ct as resolveOpenMeldEnvPreset } from "./lock-Bsl_ElWy.js";
5
- import { Er as gatewayErrorEnvelopeSchema, Ir as spaceMetaSchema, Yn as OPENMELD_HEADER_REQUEST_ID, pi as spaceMemberDirectoryEntrySchema, sn as createSpaceApi, t as OpenMeldApiClientHttpError } from "./dist-CkGG099H.js";
6
- import { Z as openMeldSpaceEgressActionSchema } from "./runtime-transport-CVtBXzIp.js";
7
- import { g as isSelfWakeSpaceAction } from "./dist-Ddy96dwl.js";
8
- import { _n as OPENMELD_SPACE_ACTION_TOOL_COMMAND_PATH_ENV, fn as DISPATCH_OWNED_RUNTIME_MODE, gn as OPENMELD_DISPATCH_RUNTIME_TARGET_PROFILE_ID_ENV, hn as OPENMELD_DISPATCH_RUNTIME_MODE_ENV, mn as OPENMELD_DISPATCH_RUNTIME_DISPATCH_ID_ENV, vn as OPENMELD_USER_FACING_CLI_COMMAND_ENV } from "./daemon-frame-transport-DUDAgNbO.js";
5
+ import { Wr as spaceMemberDirectoryEntrySchema, Yn as OPENMELD_HEADER_REQUEST_ID, fr as gatewayErrorEnvelopeSchema, oi as spaceMetaSchema, sn as createSpaceApi, t as OpenMeldApiClientHttpError } from "./dist-DkRliHib.js";
6
+ import { Z as openMeldSpaceEgressActionSchema } from "./runtime-transport-BLtOFrtv.js";
7
+ import { g as isSelfWakeSpaceAction } from "./dist-BdibASYs.js";
8
+ import { _n as OPENMELD_SPACE_ACTION_TOOL_COMMAND_PATH_ENV, fn as DISPATCH_OWNED_RUNTIME_MODE, gn as OPENMELD_DISPATCH_RUNTIME_TARGET_PROFILE_ID_ENV, hn as OPENMELD_DISPATCH_RUNTIME_MODE_ENV, mn as OPENMELD_DISPATCH_RUNTIME_DISPATCH_ID_ENV, vn as OPENMELD_USER_FACING_CLI_COMMAND_ENV } from "./daemon-frame-transport-saNQVOyi.js";
9
9
  import { n as resolveOpenMeldDistribution } from "./distribution-BDQT2ilb.js";
10
10
  import { h as daemonRuntimeRootPath } from "./daemon-state-B44aq2nm.js";
11
- import { n as fetchSpaceRequestWithTimeout, s as buildOpenMeldRequestContextHeadersWithAuth, t as createCliApiClientFoundation } from "./api-client-foundation-XILCNkrF.js";
11
+ import { n as fetchSpaceRequestWithTimeout, s as buildOpenMeldRequestContextHeadersWithAuth, t as createCliApiClientFoundation } from "./api-client-foundation-Cib1elkI.js";
12
12
  import { randomUUID } from "node:crypto";
13
13
  import { delimiter, dirname, join, resolve } from "node:path";
14
14
  import { chmodSync, existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
@@ -655,4 +655,4 @@ function createCliSpaceApi(baseUrl, options = {}) {
655
655
  //#endregion
656
656
  export { readDispatchSpaceActionContextForReceiptFromEnv as _, parseSpaceMetaResponse as a, supersedeDispatchSpaceActionRecordForReconsideration as b, readGatewayTextResponse as c, assertDispatchOwnedRuntimePublicWriteAllowed as d, buildDispatchOwnedRuntimeEnv as f, createDispatchSpaceActionContext as g, OPENMELD_SPACE_ACTION_CONTEXT_PATH_ENV as h, parseSpaceMetaPayload as i, toStructuredGatewayFailure as l, DispatchSpaceActionClosedError as m, fetchSpaceMeta as n, GatewayHttpError as o, readDispatchOwnedRuntimeGuard as p, updateSpaceMeta as r, readGatewayJsonResponse as s, createCliSpaceApi as t, parseJsonResponse as u, readDispatchSpaceActionContextFromEnv as v, writeDispatchSpaceActionRecord as x, readDispatchSpaceActionRecord as y };
657
657
 
658
- //# sourceMappingURL=cli-space-api-DlDztj9O.js.map
658
+ //# sourceMappingURL=cli-space-api-BT_Pu9Yg.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cli-space-api-DlDztj9O.js","names":["normalizeOptionalText","normalizeOptionalText","record"],"sources":["../src/runtime/dispatch-space-action-context.ts","../src/runtime/dispatch-owned-runtime.ts","../src/space/api-json.ts","../src/space/gateway-response.ts","../src/space/space-meta-response.ts","../src/space/meta-api.ts","../src/space/cli-space-api.ts"],"sourcesContent":["import { randomUUID } from \"node:crypto\";\nimport {\n chmodSync,\n existsSync,\n mkdirSync,\n readFileSync,\n renameSync,\n writeFileSync,\n} from \"node:fs\";\nimport { join } from \"node:path\";\nimport { isDeepStrictEqual } from \"node:util\";\nimport {\n openMeldSpaceEgressActionSchema,\n spaceMemberDirectoryEntrySchema,\n} from \"@openmeld/schemas\";\nimport type {\n DispatchSpaceActionClosedReasonCode,\n OpenMeldSpaceEgressAction,\n SpaceContract,\n SpaceMemberDirectoryEntry,\n} from \"@openmeld/schemas/types\";\nimport { isSelfWakeSpaceAction } from \"@openmeld/space-mesh\";\nimport { daemonRuntimeRootPath } from \"../config/daemon-state\";\nimport type { OpenMeldPathResolutionInput } from \"../config/paths\";\nimport {\n DISPATCH_OWNED_RUNTIME_MODE,\n OPENMELD_DISPATCH_RUNTIME_DISPATCH_ID_ENV,\n OPENMELD_DISPATCH_RUNTIME_MODE_ENV,\n OPENMELD_DISPATCH_RUNTIME_TARGET_PROFILE_ID_ENV,\n} from \"./dispatch-runtime-env\";\n\nexport const OPENMELD_SPACE_ACTION_CONTEXT_PATH_ENV =\n \"OPENMELD_SPACE_ACTION_CONTEXT_PATH\";\n\n/** The local action context is known expired/closed/mismatched: a new ordinary action must be rejected, never recorded. */\nexport class DispatchSpaceActionClosedError extends Error {\n readonly receipt = \"rejected_closed\" as const;\n readonly reasonCode: DispatchSpaceActionClosedReasonCode;\n constructor(\n reasonCode: DispatchSpaceActionClosedReasonCode,\n message: string\n ) {\n super(message);\n this.name = \"DispatchSpaceActionClosedError\";\n this.reasonCode = reasonCode;\n }\n}\n\nconst DISPATCH_SPACE_ACTION_CONTEXT_VERSION = 1 as const;\nconst DISPATCH_SPACE_ACTION_RECORD_VERSION = 1 as const;\nconst DEFAULT_CONTEXT_TTL_MS = 12 * 60 * 60 * 1000;\n\nexport type DispatchSpaceActionSendTargetReference =\n | {\n status: \"loaded\";\n projection: SpaceMemberDirectoryEntry[];\n referenceLines: string[];\n }\n | {\n status: \"failed\";\n errorMessage: string;\n projection: null;\n referenceLines: [];\n };\n\nexport type DispatchSpaceActionContext = {\n workingCopyId?: string;\n version: typeof DISPATCH_SPACE_ACTION_CONTEXT_VERSION;\n actionRecordPath: string;\n attemptId: string;\n contextId: string;\n dispatchId: string;\n expiresAtMs: number;\n nonce: string;\n replyToSignalId: string | null;\n sendTargetReference: DispatchSpaceActionSendTargetReference;\n sourceEventId: string;\n spaceContractSnapshot: Pick<\n SpaceContract,\n \"allowedActions\" | \"publicationMode\"\n > | null;\n spaceId: string;\n targetProfileId: string;\n taskId: string;\n};\n\nexport type DispatchSpaceActionRecord = {\n version: typeof DISPATCH_SPACE_ACTION_RECORD_VERSION;\n action: OpenMeldSpaceEgressAction;\n command: string;\n contextId: string;\n createdAtMs: number;\n nonce: string;\n};\n\nexport type DispatchSpaceActionRecordReadResult =\n | {\n status: \"missing\";\n }\n | {\n errorMessage: string;\n status: \"invalid\";\n }\n | {\n record: DispatchSpaceActionRecord;\n status: \"loaded\";\n };\n\nexport function createDispatchSpaceActionContext(input: {\n workingCopyId?: string;\n attemptId: string;\n dispatchId: string;\n env?: Record<string, string | undefined>;\n pathInput?: OpenMeldPathResolutionInput;\n replyToSignalId?: string | null;\n sendTargetReference: DispatchSpaceActionSendTargetReference;\n sourceEventId: string;\n spaceContractSnapshot:\n | Pick<SpaceContract, \"allowedActions\" | \"publicationMode\">\n | null\n | undefined;\n spaceId: string;\n targetProfileId: string;\n taskId: string;\n ttlMs?: number;\n}): {\n context: DispatchSpaceActionContext;\n contextPath: string;\n} {\n const contextId = randomUUID();\n const nonce = randomUUID();\n const contextDir = join(\n daemonRuntimeRootPath(input.pathInput ?? { env: input.env }),\n \"dispatch-space-actions\",\n `${Date.now().toString(36)}-${contextId}`\n );\n mkdirSync(contextDir, { recursive: true, mode: 0o700 });\n chmodSync(contextDir, 0o700);\n\n const contextPath = join(contextDir, \"context.json\");\n const actionRecordPath = join(contextDir, \"action.json\");\n const context: DispatchSpaceActionContext = {\n ...(input.workingCopyId ? { workingCopyId: input.workingCopyId } : {}),\n version: DISPATCH_SPACE_ACTION_CONTEXT_VERSION,\n actionRecordPath,\n attemptId: input.attemptId,\n contextId,\n dispatchId: input.dispatchId,\n expiresAtMs: Date.now() + (input.ttlMs ?? DEFAULT_CONTEXT_TTL_MS),\n nonce,\n replyToSignalId: normalizeOptionalText(input.replyToSignalId),\n sendTargetReference: input.sendTargetReference,\n sourceEventId: input.sourceEventId,\n spaceContractSnapshot: input.spaceContractSnapshot\n ? {\n allowedActions: input.spaceContractSnapshot.allowedActions,\n publicationMode: input.spaceContractSnapshot.publicationMode,\n }\n : null,\n spaceId: input.spaceId,\n targetProfileId: input.targetProfileId,\n taskId: input.taskId,\n };\n\n writeJsonFileExclusive(contextPath, context);\n return { context, contextPath };\n}\n\nexport function readDispatchSpaceActionContextFromEnv(\n env: NodeJS.ProcessEnv = process.env\n): DispatchSpaceActionContext {\n const context = readDispatchSpaceActionContextForReceiptFromEnv(env);\n assertContextActive(context, Date.now());\n return context;\n}\n\n// Expiry does not erase a prior receipt. Callers may use this context to compare\n// an exact existing action; writeDispatchSpaceActionRecord still rejects new\n// actions after expiry. File reads/uploads and target listing use the active\n// context reader instead.\nexport function readDispatchSpaceActionContextForReceiptFromEnv(\n env: NodeJS.ProcessEnv = process.env\n): DispatchSpaceActionContext {\n const contextPath = normalizeOptionalText(\n env[OPENMELD_SPACE_ACTION_CONTEXT_PATH_ENV]\n );\n if (!contextPath) {\n throw new Error(\n \"No active OpenMeld Space Action dispatch context was found. Use this command inside an OpenMeld Space Wake dispatch.\"\n );\n }\n const context = readDispatchSpaceActionContext(contextPath);\n assertDispatchRuntimeEnvMatchesContext({ context, env });\n return context;\n}\n\nexport function readDispatchSpaceActionContext(\n contextPath: string\n): DispatchSpaceActionContext {\n return parseDispatchSpaceActionContext(readJsonFile(contextPath));\n}\n\nexport function writeDispatchSpaceActionRecord(input: {\n action: OpenMeldSpaceEgressAction;\n command: string;\n context: DispatchSpaceActionContext;\n nowMs?: number;\n}): DispatchSpaceActionRecord {\n const parsedAction = openMeldSpaceEgressActionSchema.safeParse(input.action);\n if (!parsedAction.success) {\n throw parsedAction.error;\n }\n if (isSelfWakeSpaceAction(parsedAction.data, input.context.targetProfileId)) {\n throw new Error(\n \"An Agent cannot Wake itself. To reply to the current message, omit wakeTargets (CLI: --wake) and submit the reply again. No action was recorded.\"\n );\n }\n\n const existing = readDispatchSpaceActionRecord({ context: input.context });\n if (existing.status === \"invalid\") {\n throw new Error(existing.errorMessage);\n }\n if (\n existing.status === \"loaded\" &&\n isDeepStrictEqual(existing.record.action, parsedAction.data)\n ) {\n return existing.record;\n }\n assertContextActive(input.context, input.nowMs ?? Date.now());\n\n const record: DispatchSpaceActionRecord = {\n version: DISPATCH_SPACE_ACTION_RECORD_VERSION,\n action: parsedAction.data,\n command: input.command,\n contextId: input.context.contextId,\n createdAtMs: input.nowMs ?? Date.now(),\n nonce: input.context.nonce,\n };\n try {\n writeJsonFileExclusive(input.context.actionRecordPath, record);\n } catch (error) {\n if (isNodeErrorCode(error, \"EEXIST\")) {\n const existing = readDispatchSpaceActionRecord({\n context: input.context,\n });\n // A lost acknowledgement may cause the same proposal to be submitted\n // again. Acknowledge that record, never replace it or accept a new action.\n if (\n existing.status === \"loaded\" &&\n isDeepStrictEqual(existing.record.action, parsedAction.data)\n ) {\n return existing.record;\n }\n throw new Error(\n \"An OpenMeld Space Action has already been recorded for this dispatch. A Wake can only have one final Space action.\"\n );\n }\n throw error;\n }\n return record;\n}\n\nexport function readDispatchSpaceActionRecord(input: {\n context: DispatchSpaceActionContext;\n nowMs?: number;\n}): DispatchSpaceActionRecordReadResult {\n if (!existsSync(input.context.actionRecordPath)) {\n return { status: \"missing\" };\n }\n try {\n const record = parseDispatchSpaceActionRecord(\n readJsonFile(input.context.actionRecordPath)\n );\n if (\n record.contextId !== input.context.contextId ||\n record.nonce !== input.context.nonce\n ) {\n return {\n status: \"invalid\",\n errorMessage:\n \"OpenMeld Space Action record does not match the active dispatch context.\",\n };\n }\n if (record.createdAtMs > input.context.expiresAtMs) {\n return {\n status: \"invalid\",\n errorMessage:\n \"OpenMeld Space Action record was created after the active dispatch context expired.\",\n };\n }\n return { status: \"loaded\", record };\n } catch (error) {\n return {\n status: \"invalid\",\n errorMessage: error instanceof Error ? error.message : String(error),\n };\n }\n}\n\nexport function supersedeDispatchSpaceActionRecordForReconsideration(input: {\n context: DispatchSpaceActionContext;\n nowMs?: number;\n}): { archivedPath: string; record: DispatchSpaceActionRecord } | null {\n const readResult = readDispatchSpaceActionRecord(input);\n if (readResult.status === \"missing\") {\n return null;\n }\n if (readResult.status === \"invalid\") {\n throw new Error(readResult.errorMessage);\n }\n const archivedPath = `${input.context.actionRecordPath}.superseded-${String(input.nowMs ?? Date.now())}-${randomUUID()}`;\n renameSync(input.context.actionRecordPath, archivedPath);\n return { archivedPath, record: readResult.record };\n}\n\nfunction parseDispatchSpaceActionContext(\n value: unknown\n): DispatchSpaceActionContext {\n const record = toRecord(value, \"OpenMeld Space Action context\");\n const version = record.version;\n if (version !== DISPATCH_SPACE_ACTION_CONTEXT_VERSION) {\n throw new Error(\"Unsupported OpenMeld Space Action context version.\");\n }\n const sendTargetReference = parseSendTargetReference(\n record.sendTargetReference\n );\n return {\n version,\n actionRecordPath: requiredString(\n record.actionRecordPath,\n \"actionRecordPath\"\n ),\n attemptId: requiredString(record.attemptId, \"attemptId\"),\n contextId: requiredString(record.contextId, \"contextId\"),\n dispatchId: requiredString(record.dispatchId, \"dispatchId\"),\n expiresAtMs: requiredFiniteNumber(record.expiresAtMs, \"expiresAtMs\"),\n nonce: requiredString(record.nonce, \"nonce\"),\n replyToSignalId: optionalString(record.replyToSignalId),\n sendTargetReference,\n sourceEventId: requiredString(record.sourceEventId, \"sourceEventId\"),\n spaceContractSnapshot: parseSpaceContractSnapshot(\n record.spaceContractSnapshot\n ),\n spaceId: requiredString(record.spaceId, \"spaceId\"),\n targetProfileId: requiredString(record.targetProfileId, \"targetProfileId\"),\n taskId: requiredString(record.taskId, \"taskId\"),\n ...(record.workingCopyId\n ? { workingCopyId: requiredString(record.workingCopyId, \"workingCopyId\") }\n : {}),\n };\n}\n\nfunction assertDispatchRuntimeEnvMatchesContext(input: {\n context: DispatchSpaceActionContext;\n env: NodeJS.ProcessEnv;\n}): void {\n const mode = normalizeOptionalText(\n input.env[OPENMELD_DISPATCH_RUNTIME_MODE_ENV]\n );\n if (mode !== DISPATCH_OWNED_RUNTIME_MODE) {\n return;\n }\n\n const envDispatchId = normalizeOptionalText(\n input.env[OPENMELD_DISPATCH_RUNTIME_DISPATCH_ID_ENV]\n );\n if (!envDispatchId) {\n throw new Error(\n \"OpenMeld Space Action dispatch runtime is missing the active dispatch ID.\"\n );\n }\n if (envDispatchId !== input.context.dispatchId) {\n throw new DispatchSpaceActionClosedError(\n \"space_action.context_mismatch\",\n \"OpenMeld Space Action dispatch context does not match the active dispatch runtime.\"\n );\n }\n\n const envTargetProfileId = normalizeOptionalText(\n input.env[OPENMELD_DISPATCH_RUNTIME_TARGET_PROFILE_ID_ENV]\n );\n if (!envTargetProfileId) {\n throw new Error(\n \"OpenMeld Space Action dispatch runtime is missing the active target profile ID.\"\n );\n }\n if (envTargetProfileId !== input.context.targetProfileId) {\n throw new DispatchSpaceActionClosedError(\n \"space_action.context_mismatch\",\n \"OpenMeld Space Action target profile does not match the active dispatch runtime.\"\n );\n }\n}\n\nfunction parseDispatchSpaceActionRecord(\n value: unknown\n): DispatchSpaceActionRecord {\n const record = toRecord(value, \"OpenMeld Space Action record\");\n const version = record.version;\n if (version !== DISPATCH_SPACE_ACTION_RECORD_VERSION) {\n throw new Error(\"Unsupported OpenMeld Space Action record version.\");\n }\n const parsedAction = openMeldSpaceEgressActionSchema.safeParse(record.action);\n if (!parsedAction.success) {\n throw parsedAction.error;\n }\n return {\n version,\n action: parsedAction.data,\n command: requiredString(record.command, \"command\"),\n contextId: requiredString(record.contextId, \"contextId\"),\n createdAtMs: requiredFiniteNumber(record.createdAtMs, \"createdAtMs\"),\n nonce: requiredString(record.nonce, \"nonce\"),\n };\n}\n\nfunction parseSendTargetReference(\n value: unknown\n): DispatchSpaceActionSendTargetReference {\n const record = toRecord(value, \"sendTargetReference\");\n if (record.status === \"loaded\") {\n if (!Array.isArray(record.projection)) {\n throw new Error(\n \"OpenMeld Space Action send target projection must be an array.\"\n );\n }\n return {\n status: \"loaded\",\n projection: record.projection.map(parseSendTargetProjectionEntry),\n referenceLines: parseStringArray(record.referenceLines),\n };\n }\n if (record.status === \"failed\") {\n return {\n status: \"failed\",\n errorMessage: requiredString(record.errorMessage, \"errorMessage\"),\n projection: null,\n referenceLines: [],\n };\n }\n throw new Error(\n \"Invalid OpenMeld Space Action send target reference status.\"\n );\n}\n\nfunction parseSendTargetProjectionEntry(\n value: unknown,\n index: number\n): SpaceMemberDirectoryEntry {\n const parsed = spaceMemberDirectoryEntrySchema.safeParse(value);\n if (!parsed.success) {\n throw new Error(\n `OpenMeld Space Action target projection entry ${index} is not a valid Space member directory entry.`\n );\n }\n return parsed.data;\n}\n\nfunction parseSpaceContractSnapshot(\n value: unknown\n): Pick<SpaceContract, \"allowedActions\" | \"publicationMode\"> | null {\n if (value === null || value === undefined) {\n return null;\n }\n const record = toRecord(value, \"spaceContractSnapshot\");\n return {\n allowedActions: Array.isArray(record.allowedActions)\n ? (record.allowedActions as SpaceContract[\"allowedActions\"])\n : [],\n publicationMode:\n record.publicationMode === \"raw_context_sharing\"\n ? \"raw_context_sharing\"\n : \"collaboration\",\n };\n}\n\nfunction assertContextActive(\n context: DispatchSpaceActionContext,\n nowMs: number\n): void {\n if (nowMs > context.expiresAtMs) {\n throw new DispatchSpaceActionClosedError(\n \"space_action.context_expired\",\n \"The OpenMeld Space Action dispatch context has expired.\"\n );\n }\n}\n\nfunction readJsonFile(path: string): unknown {\n return JSON.parse(readFileSync(path, \"utf8\")) as unknown;\n}\n\nfunction writeJsonFileExclusive(path: string, value: unknown): void {\n writeFileSync(path, `${JSON.stringify(value, null, 2)}\\n`, {\n encoding: \"utf8\",\n flag: \"wx\",\n mode: 0o600,\n });\n chmodSync(path, 0o600);\n}\n\nfunction toRecord(value: unknown, label: string): Record<string, unknown> {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) {\n throw new Error(`${label} must be a JSON object.`);\n }\n return value as Record<string, unknown>;\n}\n\nfunction requiredString(value: unknown, fieldName: string): string {\n const normalized = normalizeOptionalText(value);\n if (!normalized) {\n throw new Error(`${fieldName} must be a non-empty string.`);\n }\n return normalized;\n}\n\nfunction requiredFiniteNumber(value: unknown, fieldName: string): number {\n if (typeof value !== \"number\" || !Number.isFinite(value)) {\n throw new Error(`${fieldName} must be a finite number.`);\n }\n return value;\n}\n\nfunction optionalString(value: unknown): string | null {\n if (value === null || value === undefined) {\n return null;\n }\n return normalizeOptionalText(value);\n}\n\nfunction parseStringArray(value: unknown): string[] {\n if (!Array.isArray(value)) {\n return [];\n }\n return value\n .map((item) => normalizeOptionalText(item))\n .filter((item): item is string => Boolean(item));\n}\n\nfunction normalizeOptionalText(value: unknown): string | null {\n const normalized = String(value ?? \"\").trim();\n return normalized.length > 0 ? normalized : null;\n}\n\nfunction isNodeErrorCode(error: unknown, code: string): boolean {\n return (\n typeof error === \"object\" &&\n error !== null &&\n \"code\" in error &&\n (error as { code?: unknown }).code === code\n );\n}\n","import {\n chmodSync,\n existsSync,\n mkdirSync,\n readFileSync,\n writeFileSync,\n} from \"node:fs\";\nimport { delimiter, dirname, join, resolve } from \"node:path\";\nimport { daemonRuntimeRootPath } from \"../config/daemon-state\";\nimport {\n type OpenMeldPathResolutionInput,\n openMeldManagedBinaryPath,\n resolveOpenMeldEnvPreset,\n} from \"../config/paths\";\nimport {\n DISPATCH_OWNED_RUNTIME_MODE,\n OPENMELD_DISPATCH_RUNTIME_DISPATCH_ID_ENV,\n OPENMELD_DISPATCH_RUNTIME_MODE_ENV,\n OPENMELD_DISPATCH_RUNTIME_TARGET_PROFILE_ID_ENV,\n OPENMELD_SPACE_ACTION_TOOL_COMMAND_PATH_ENV,\n OPENMELD_USER_FACING_CLI_COMMAND_ENV,\n} from \"./dispatch-runtime-env\";\nimport { OPENMELD_SPACE_ACTION_CONTEXT_PATH_ENV } from \"./dispatch-space-action-context\";\nimport {\n type OpenMeldDistribution,\n resolveOpenMeldDistribution,\n} from \"./distribution\";\n\nconst DISPATCH_OWNED_RUNTIME_CLI_SHIM_DIRNAME = \"dispatch-owned-cli\";\nconst DISPATCH_SPACE_ACTION_CLI_SHIM_DIRNAME = \"bin\";\nconst OPENMELD_ENV_PRESET_ENV = \"OPENMELD_ENV_PRESET\";\nconst DISPATCH_OWNED_RUNTIME_CLI_COMMAND_NAMES = [\n \"openmeld\",\n \"openmeld-dev\",\n \"openmeld-canary\",\n] as const;\n\nexport type DispatchOwnedRuntimeGuard = {\n active: boolean;\n dispatchId: string | null;\n targetProfileId: string | null;\n};\n\nexport function buildDispatchOwnedRuntimeEnv(input: {\n dispatchId: string;\n targetProfileId: string;\n distribution?: OpenMeldDistribution;\n env?: Record<string, string | undefined>;\n cliEntryPath?: string;\n spaceActionContextPath?: string | null;\n}): Record<string, string | undefined> {\n // Provider overrides are not a replacement for the carrier's lane. Keep\n // these non-secret installation selectors without copying unrelated Service\n // credentials into the provider environment.\n const env = {\n OPENMELD_HOME: process.env.OPENMELD_HOME,\n OPENMELD_ENV_PRESET: process.env.OPENMELD_ENV_PRESET,\n ...(input.env ?? {}),\n };\n const currentPath = normalizeOptionalText(\n input.env?.PATH ?? process.env.PATH\n );\n const shimDir = ensureDispatchOwnedRuntimeCliShims({\n cliEntryPath: input.cliEntryPath,\n dispatchId: input.dispatchId,\n distribution: input.distribution,\n env,\n spaceActionContextPath: input.spaceActionContextPath,\n targetProfileId: input.targetProfileId,\n });\n const actionCommand = resolveDispatchOwnedRuntimeActionCliEntryCommand({\n env,\n });\n return {\n ...env,\n PATH: prependPathEntry({\n currentPath,\n nextEntry: shimDir,\n }),\n [OPENMELD_DISPATCH_RUNTIME_MODE_ENV]: DISPATCH_OWNED_RUNTIME_MODE,\n [OPENMELD_DISPATCH_RUNTIME_DISPATCH_ID_ENV]: input.dispatchId,\n [OPENMELD_DISPATCH_RUNTIME_TARGET_PROFILE_ID_ENV]: input.targetProfileId,\n [OPENMELD_USER_FACING_CLI_COMMAND_ENV]: actionCommand,\n [OPENMELD_SPACE_ACTION_TOOL_COMMAND_PATH_ENV]: join(shimDir, actionCommand),\n [OPENMELD_ENV_PRESET_ENV]: resolveDispatchOwnedRuntimeEnvPreset({\n env,\n }),\n ...(input.spaceActionContextPath\n ? {\n [OPENMELD_SPACE_ACTION_CONTEXT_PATH_ENV]:\n input.spaceActionContextPath,\n }\n : {}),\n };\n}\n\nexport function resolveDispatchOwnedRuntimeActionCliEntryCommand(\n input: OpenMeldPathResolutionInput = {}\n): \"openmeld\" | \"openmeld-dev\" | \"openmeld-canary\" {\n const preset = resolveOpenMeldEnvPreset(input);\n if (preset === \"dev-local\") {\n return \"openmeld-dev\";\n }\n if (preset === \"canary\") {\n return \"openmeld-canary\";\n }\n return \"openmeld\";\n}\n\nexport function resolveDispatchOwnedRuntimeCliShimDir(\n input: OpenMeldPathResolutionInput & {\n spaceActionContextPath?: string | null;\n } = {}\n): string {\n const spaceActionContextPath = normalizeOptionalText(\n input.spaceActionContextPath\n );\n if (spaceActionContextPath) {\n return join(\n dirname(spaceActionContextPath),\n DISPATCH_SPACE_ACTION_CLI_SHIM_DIRNAME\n );\n }\n return join(\n daemonRuntimeRootPath(input),\n \"bin\",\n DISPATCH_OWNED_RUNTIME_CLI_SHIM_DIRNAME\n );\n}\n\nexport function ensureDispatchOwnedRuntimeCliShims(input?: {\n cliEntryPath?: string;\n distribution?: OpenMeldDistribution;\n dispatchId?: string;\n env?: Record<string, string | undefined>;\n spaceActionContextPath?: string | null;\n targetProfileId?: string;\n}): string {\n const distribution = input?.distribution ?? resolveOpenMeldDistribution();\n const cliEntryPath =\n distribution === \"binary\"\n ? resolveDispatchOwnedRuntimeBinaryCliEntryPath({\n cliEntryPath: input?.cliEntryPath,\n env: input?.env,\n })\n : resolveDispatchOwnedRuntimeCliEntryPath(input?.cliEntryPath);\n const shimDir = resolveDispatchOwnedRuntimeCliShimDir({\n env: input?.env,\n spaceActionContextPath: input?.spaceActionContextPath,\n });\n mkdirSync(shimDir, { recursive: true });\n\n for (const commandName of DISPATCH_OWNED_RUNTIME_CLI_COMMAND_NAMES) {\n const shimPath = join(shimDir, commandName);\n const shimSource = buildDispatchOwnedRuntimeCliShimSource({\n cliEntryPath,\n commandName,\n dispatchId: input?.dispatchId,\n distribution,\n nodePath: process.execPath,\n spaceActionContextPath: input?.spaceActionContextPath,\n targetProfileId: input?.targetProfileId,\n });\n if (existsSync(shimPath)) {\n const currentSource = safeReadTextFile(shimPath);\n if (currentSource === shimSource) {\n chmodSync(shimPath, 0o755);\n continue;\n }\n }\n writeFileSync(shimPath, shimSource, {\n encoding: \"utf8\",\n mode: 0o755,\n });\n chmodSync(shimPath, 0o755);\n }\n\n return shimDir;\n}\n\nexport function readDispatchOwnedRuntimeGuard(\n env: NodeJS.ProcessEnv = process.env\n): DispatchOwnedRuntimeGuard {\n const mode = normalizeOptionalText(env[OPENMELD_DISPATCH_RUNTIME_MODE_ENV]);\n if (mode !== DISPATCH_OWNED_RUNTIME_MODE) {\n return {\n active: false,\n dispatchId: null,\n targetProfileId: null,\n };\n }\n\n return {\n active: true,\n dispatchId: normalizeOptionalText(\n env[OPENMELD_DISPATCH_RUNTIME_DISPATCH_ID_ENV]\n ),\n targetProfileId: normalizeOptionalText(\n env[OPENMELD_DISPATCH_RUNTIME_TARGET_PROFILE_ID_ENV]\n ),\n };\n}\n\nexport function assertDispatchOwnedRuntimePublicWriteAllowed(input: {\n commandLabel: string;\n env?: NodeJS.ProcessEnv;\n}): void {\n const guard = readDispatchOwnedRuntimeGuard(input.env);\n if (!guard.active) {\n return;\n }\n\n const dispatchIdSuffix = guard.dispatchId\n ? ` (dispatch ${guard.dispatchId})`\n : \"\";\n throw new Error(\n `${input.commandLabel} is blocked inside a dispatch-owned runtime${dispatchIdSuffix}. Public space writes must be returned through OpenMeld Space structured actions: post_message, post_status, or stay_silent.`\n );\n}\n\nfunction normalizeOptionalText(value: unknown): string | null {\n const normalized = String(value ?? \"\").trim();\n return normalized.length > 0 ? normalized : null;\n}\n\nfunction resolveDispatchOwnedRuntimeCliEntryPath(\n cliEntryPath?: string\n): string {\n const normalizedCliEntryPath =\n normalizeOptionalText(cliEntryPath) ??\n normalizeOptionalText(process.argv[1]) ??\n null;\n if (!normalizedCliEntryPath) {\n throw new Error(\n \"dispatch-owned runtime CLI shim requires a current CLI entry path\"\n );\n }\n return resolve(normalizedCliEntryPath);\n}\n\nfunction resolveDispatchOwnedRuntimeBinaryCliEntryPath(input: {\n cliEntryPath?: string;\n env?: Record<string, string | undefined>;\n}): string {\n // A background Service may keep running from an executable path that an\n // upgrade later replaces with a launcher. The lane-owned managed CLI is the\n // stable command authority for new Space Action subprocesses.\n const normalizedCliEntryPath =\n normalizeOptionalText(input.cliEntryPath) ??\n normalizeOptionalText(openMeldManagedBinaryPath({ env: input.env })) ??\n null;\n if (!normalizedCliEntryPath) {\n throw new Error(\n \"dispatch-owned runtime CLI shim requires a current binary CLI path\"\n );\n }\n return resolve(normalizedCliEntryPath);\n}\n\nfunction buildDispatchOwnedRuntimeCliShimSource(input: {\n cliEntryPath: string;\n commandName: (typeof DISPATCH_OWNED_RUNTIME_CLI_COMMAND_NAMES)[number];\n distribution: OpenMeldDistribution;\n dispatchId?: string;\n nodePath: string;\n spaceActionContextPath?: string | null;\n targetProfileId?: string;\n}): string {\n const embeddedEnv = {\n [OPENMELD_DISPATCH_RUNTIME_MODE_ENV]: DISPATCH_OWNED_RUNTIME_MODE,\n [OPENMELD_ENV_PRESET_ENV]: resolveEnvPresetForCommandName(\n input.commandName\n ),\n [OPENMELD_USER_FACING_CLI_COMMAND_ENV]: input.commandName,\n ...(normalizeOptionalText(input.dispatchId)\n ? {\n [OPENMELD_DISPATCH_RUNTIME_DISPATCH_ID_ENV]: normalizeOptionalText(\n input.dispatchId\n ) as string,\n }\n : {}),\n ...(normalizeOptionalText(input.targetProfileId)\n ? {\n [OPENMELD_DISPATCH_RUNTIME_TARGET_PROFILE_ID_ENV]:\n normalizeOptionalText(input.targetProfileId) as string,\n }\n : {}),\n ...(normalizeOptionalText(input.spaceActionContextPath)\n ? {\n [OPENMELD_SPACE_ACTION_CONTEXT_PATH_ENV]: normalizeOptionalText(\n input.spaceActionContextPath\n ) as string,\n }\n : {}),\n };\n if (input.distribution === \"binary\") {\n const exportRows = Object.entries(embeddedEnv).map(\n ([key, value]) => `export ${key}=${quoteShellValue(value)}`\n );\n return `#!/bin/sh\n${exportRows.join(\"\\n\")}\nexec ${quoteShellValue(input.cliEntryPath)} \"$@\"\n`;\n }\n return `#!/usr/bin/env node\nimport { spawnSync } from \"node:child_process\";\n\nconst result = spawnSync(${JSON.stringify(input.nodePath)}, [${JSON.stringify(\n input.cliEntryPath\n )}, ...process.argv.slice(2)], {\n env: { ...process.env, ...${JSON.stringify(embeddedEnv)} },\n stdio: \"inherit\",\n});\n\nif (result.error) {\n throw result.error;\n}\n\nprocess.exit(result.status ?? 1);\n`;\n}\n\nfunction resolveDispatchOwnedRuntimeEnvPreset(input: {\n env?: Record<string, string | undefined>;\n}): \"prod\" | \"dev-local\" | \"canary\" {\n return resolveEnvPresetForCommandName(\n resolveDispatchOwnedRuntimeActionCliEntryCommand({\n env: input.env,\n })\n );\n}\n\nfunction resolveEnvPresetForCommandName(\n commandName: (typeof DISPATCH_OWNED_RUNTIME_CLI_COMMAND_NAMES)[number]\n): \"prod\" | \"dev-local\" | \"canary\" {\n if (commandName === \"openmeld-dev\") {\n return \"dev-local\";\n }\n if (commandName === \"openmeld-canary\") {\n return \"canary\";\n }\n return \"prod\";\n}\n\nfunction quoteShellValue(value: string): string {\n return `'${value.replaceAll(\"'\", \"'\\\\''\")}'`;\n}\n\nfunction safeReadTextFile(path: string): string | null {\n try {\n return readFileSync(path, \"utf8\");\n } catch {\n return null;\n }\n}\n\nfunction prependPathEntry(input: {\n currentPath: string | null;\n nextEntry: string;\n}): string {\n const currentEntries = (input.currentPath ?? \"\")\n .split(delimiter)\n .map((entry) => entry.trim())\n .filter((entry) => entry.length > 0);\n const dedupedEntries = currentEntries.filter(\n (entry) => entry !== input.nextEntry\n );\n return [input.nextEntry, ...dedupedEntries].join(delimiter);\n}\n","export function parseJsonResponse(raw: string): unknown {\n if (!raw.trim()) {\n return null;\n }\n try {\n return JSON.parse(raw);\n } catch {\n return null;\n }\n}\n","import { OpenMeldApiClientHttpError } from \"@openmeld/api-client\";\nimport { OPENMELD_HEADER_REQUEST_ID } from \"@openmeld/gateway-contract\";\nimport { gatewayErrorEnvelopeSchema } from \"@openmeld/schemas\";\nimport type { GatewayErrorCode } from \"@openmeld/schemas/types\";\nimport { parseJsonResponse } from \"./api-json\";\n\nconst FALLBACK_GATEWAY_HTTP_ERROR_CODE = \"gateway.http_error\" as const;\nconst GENERIC_NETWORK_ERROR_CODES = [\n \"network.timeout\",\n \"network.request_failed\",\n] as const;\n\ntype SafeParseResult<T> = { success: true; data: T } | { success: false };\n\ntype GatewayResponseSchema<T> = {\n safeParse: (value: unknown) => SafeParseResult<T>;\n};\n\nexport type GatewayResponseErrorCode =\n | GatewayErrorCode\n | typeof FALLBACK_GATEWAY_HTTP_ERROR_CODE\n | (typeof GENERIC_NETWORK_ERROR_CODES)[number]\n | string;\n\nexport type StructuredGatewayFailure = {\n code: GatewayResponseErrorCode | null;\n message: string;\n requestId: string | null;\n status: number | null;\n upstreamCode: string | null;\n};\n\nexport class GatewayHttpError extends Error {\n readonly code: GatewayResponseErrorCode;\n readonly requestId: string | null;\n readonly status: number;\n readonly rawBody: string;\n readonly upstreamCode: string | null;\n\n constructor(input: {\n code: GatewayResponseErrorCode;\n message: string;\n requestId?: string | null;\n status: number;\n rawBody: string;\n upstreamCode?: string | null;\n }) {\n super(input.message);\n this.name = \"GatewayHttpError\";\n this.code = input.code;\n this.requestId = normalizeOptionalText(input.requestId);\n this.status = input.status;\n this.rawBody = input.rawBody;\n this.upstreamCode = normalizeOptionalText(input.upstreamCode);\n }\n}\n\nexport async function readGatewayJsonResponse<T>(input: {\n response: Response;\n schema: GatewayResponseSchema<T>;\n invalidMessage: string;\n}): Promise<T> {\n const raw = await input.response.text();\n assertGatewayResponseOk({\n response: input.response,\n raw,\n });\n\n const parsed = input.schema.safeParse(parseJsonResponse(raw));\n if (!parsed.success) {\n throw new Error(input.invalidMessage);\n }\n return parsed.data;\n}\n\nexport async function readGatewayTextResponse(input: {\n response: Response;\n}): Promise<string> {\n const raw = await input.response.text();\n assertGatewayResponseOk({\n response: input.response,\n raw,\n });\n return raw;\n}\n\nexport function assertGatewayResponseOk(input: {\n response: Response;\n raw: string;\n}): void {\n if (input.response.ok) {\n return;\n }\n throw parseGatewayErrorResponse(input);\n}\n\nexport function parseGatewayErrorResponse(input: {\n response: Pick<Response, \"headers\" | \"status\">;\n raw: string;\n}): GatewayHttpError {\n const payload = parseJsonResponse(input.raw);\n const parsed = gatewayErrorEnvelopeSchema.safeParse(payload);\n const headerRequestId = normalizeOptionalText(\n input.response.headers.get(OPENMELD_HEADER_REQUEST_ID)\n );\n\n if (parsed.success) {\n return new GatewayHttpError({\n code: parsed.data.error.code,\n message: parsed.data.error.message,\n requestId: parsed.data.error.requestId || headerRequestId,\n status: input.response.status,\n rawBody: input.raw,\n upstreamCode: parsed.data.error.upstreamCode ?? null,\n });\n }\n\n const looseEnvelope = readLooseGatewayErrorEnvelope(payload);\n if (looseEnvelope) {\n return new GatewayHttpError({\n code: looseEnvelope.code ?? FALLBACK_GATEWAY_HTTP_ERROR_CODE,\n message:\n looseEnvelope.message ??\n `Gateway request failed with HTTP ${input.response.status}.`,\n requestId: looseEnvelope.requestId ?? headerRequestId,\n status: input.response.status,\n rawBody: input.raw,\n upstreamCode: looseEnvelope.upstreamCode,\n });\n }\n\n return new GatewayHttpError({\n code: FALLBACK_GATEWAY_HTTP_ERROR_CODE,\n message:\n normalizeOptionalText(input.raw) ??\n `Gateway request failed with HTTP ${input.response.status}.`,\n requestId: headerRequestId,\n status: input.response.status,\n rawBody: input.raw,\n upstreamCode: null,\n });\n}\n\nexport function toStructuredGatewayFailure(\n error: unknown\n): StructuredGatewayFailure {\n if (error instanceof OpenMeldApiClientHttpError) {\n return {\n code: error.code,\n message: normalizeFailureMessage(error.message),\n requestId: error.requestId,\n status: error.status,\n upstreamCode: error.upstreamCode,\n };\n }\n\n if (error instanceof GatewayHttpError) {\n return {\n code: error.code,\n message: normalizeFailureMessage(error.message),\n requestId: error.requestId,\n status: error.status,\n upstreamCode: error.upstreamCode,\n };\n }\n\n const genericErrorCode = readGenericErrorCode(error);\n if (genericErrorCode) {\n return {\n code: genericErrorCode,\n message: normalizeFailureMessage(\n error instanceof Error ? error.message : String(error)\n ),\n requestId: null,\n status: null,\n upstreamCode: null,\n };\n }\n\n return {\n code: null,\n message: normalizeFailureMessage(\n error instanceof Error ? error.message : String(error)\n ),\n requestId: null,\n status: null,\n upstreamCode: null,\n };\n}\n\nfunction normalizeOptionalText(value: unknown): string | null {\n const normalized = String(value ?? \"\").trim();\n return normalized.length > 0 ? normalized : null;\n}\n\nfunction normalizeFailureMessage(value: unknown): string {\n return normalizeOptionalText(value) ?? \"Unknown error.\";\n}\n\nfunction readGenericErrorCode(value: unknown): GatewayResponseErrorCode | null {\n if (!value || typeof value !== \"object\" || !(\"code\" in value)) {\n return null;\n }\n\n const normalized = normalizeOptionalText(\n (value as { code?: unknown }).code ?? null\n );\n return normalized as GatewayResponseErrorCode | null;\n}\n\nfunction readLooseGatewayErrorEnvelope(value: unknown): {\n code: string | null;\n message: string | null;\n requestId: string | null;\n upstreamCode: string | null;\n} | null {\n if (!value || typeof value !== \"object\") {\n return null;\n }\n\n const record = value as {\n error?: {\n code?: unknown;\n message?: unknown;\n requestId?: unknown;\n upstreamCode?: unknown;\n } | null;\n };\n const error = record.error;\n if (!error || typeof error !== \"object\") {\n return null;\n }\n\n const code = normalizeOptionalText(error.code);\n const message = normalizeOptionalText(error.message);\n const requestId = normalizeOptionalText(error.requestId);\n const upstreamCode = normalizeOptionalText(error.upstreamCode);\n if (!(code || message || requestId || upstreamCode)) {\n return null;\n }\n\n return {\n code,\n message,\n requestId,\n upstreamCode,\n };\n}\n","import type { SpaceMeta } from \"@openmeld/protocol\";\nimport { spaceMetaSchema } from \"@openmeld/schemas\";\n\ntype SpaceMetaParseOperation =\n | \"createSpaceMeta\"\n | \"fetchSpaceMeta\"\n | \"updateSpaceMeta\";\n\nexport function parseSpaceMetaPayload(input: {\n data: unknown;\n endpoint: string;\n operation: SpaceMetaParseOperation;\n}): SpaceMeta {\n try {\n const validation = spaceMetaSchema.safeParse(input.data);\n if (!validation.success) {\n const reason =\n validation.error.issues[0]?.message ??\n \"space meta payload does not match schema\";\n throw new Error(reason);\n }\n return validation.data;\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error);\n throw new Error(\n `${input.operation} received invalid response payload from ${input.endpoint}: ${reason}; raw=${JSON.stringify(input.data)}`\n );\n }\n}\n\nexport function parseSpaceMetaResponse(input: {\n raw: string;\n endpoint: string;\n operation: Extract<\n SpaceMetaParseOperation,\n \"fetchSpaceMeta\" | \"updateSpaceMeta\"\n >;\n}): SpaceMeta {\n try {\n return parseSpaceMetaPayload({\n data: JSON.parse(input.raw) as unknown,\n endpoint: input.endpoint,\n operation: input.operation,\n });\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error);\n throw new Error(\n `${input.operation} received invalid response payload from ${input.endpoint}: ${reason}; raw=${input.raw}`\n );\n }\n}\n","import type { SpaceMeta } from \"@openmeld/protocol\";\nimport type { OpenMeldRequestContext } from \"@openmeld/schemas/types\";\nimport { buildOpenMeldRequestContextHeadersWithAuth } from \"../config/request-headers\";\nimport { toSpaceMetaUrl } from \"../protocol/urls\";\nimport { fetchSpaceRequestWithTimeout } from \"./fetch-with-timeout\";\nimport { readGatewayTextResponse } from \"./gateway-response\";\nimport { parseSpaceMetaResponse } from \"./space-meta-response\";\n\ntype SpaceMetaApiInput = {\n requestContext: OpenMeldRequestContext;\n baseUrl: string;\n space: string;\n password?: string;\n};\n\nexport async function fetchSpaceMeta(\n input: SpaceMetaApiInput\n): Promise<SpaceMeta> {\n const endpoint = toSpaceMetaUrl(input.baseUrl, input.space);\n const response = await fetchSpaceRequestWithTimeout({\n url: endpoint,\n operation: \"space.fetch_meta\",\n init: {\n method: \"GET\",\n headers: await buildOpenMeldRequestContextHeadersWithAuth({\n requestUrl: endpoint,\n requestContext: input.requestContext,\n spacePassword: input.password,\n }),\n },\n });\n const raw = await readGatewayTextResponse({ response });\n\n return parseSpaceMetaResponse({\n raw,\n endpoint,\n operation: \"fetchSpaceMeta\",\n });\n}\n\nexport async function updateSpaceMeta(\n input: SpaceMetaApiInput & {\n purpose?: string;\n guide?: string;\n }\n): Promise<SpaceMeta> {\n const endpoint = toSpaceMetaUrl(input.baseUrl, input.space);\n const headers = await buildOpenMeldRequestContextHeadersWithAuth({\n requestUrl: endpoint,\n requestContext: input.requestContext,\n spacePassword: input.password,\n });\n headers[\"content-type\"] = \"application/json\";\n\n const response = await fetchSpaceRequestWithTimeout({\n url: endpoint,\n operation: \"space.update_meta\",\n init: {\n method: \"PATCH\",\n headers,\n body: JSON.stringify({\n ...(input.purpose === undefined ? {} : { purpose: input.purpose }),\n ...(input.guide === undefined ? {} : { guide: input.guide }),\n }),\n },\n });\n const raw = await readGatewayTextResponse({ response });\n\n return parseSpaceMetaResponse({\n raw,\n endpoint,\n operation: \"updateSpaceMeta\",\n });\n}\n","import { createSpaceApi, type SpaceApi } from \"@openmeld/api-client\";\nimport { createCliApiClientFoundation } from \"./api-client-foundation\";\n\nexport type {\n SpaceApi,\n SpaceSignalsReadQuery,\n} from \"@openmeld/api-client\";\n\nexport function createCliSpaceApi(\n baseUrl: string,\n options: { organizationId?: string } = {}\n): SpaceApi {\n return createSpaceApi(createCliApiClientFoundation(baseUrl, options));\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA+BA,MAAa,yCACX;;AAGF,IAAa,iCAAb,cAAoD,MAAM;CACxD,UAAmB;CACnB;CACA,YACE,YACA,SACA;EACA,MAAM,OAAO;EACb,KAAK,OAAO;EACZ,KAAK,aAAa;CACpB;AACF;AAEA,MAAM,wCAAwC;AAC9C,MAAM,uCAAuC;AAC7C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AAK;EACpE,MAAM,IAAI,MACR,GAAG,MAAM,UAAU,0CAA0C,MAAM,SAAS,IAAI,OAAO,QAAQ,MAAM,KACvG;CACF;AACF;;;ACnCA,eAAsB,eACpB,OACoB;CACpB,MAAM,WAAW,eAAe,MAAM,SAAS,MAAM,KAAK;CAe1D,OAAO,uBAAuB;EAC5B,KAAA,MAHgB,wBAAwB,EAAE,UAAA,MAZrB,6BAA6B;GAClD,KAAK;GACL,WAAW;GACX,MAAM;IACJ,QAAQ;IACR,SAAS,MAAM,2CAA2C;KACxD,YAAY;KACZ,gBAAgB,MAAM;KACtB,eAAe,MAAM;IACvB,CAAC;GACH;EACF,CAAC,EACoD,CAAC;EAIpD;EACA,WAAW;CACb,CAAC;AACH;AAEA,eAAsB,gBACpB,OAIoB;CACpB,MAAM,WAAW,eAAe,MAAM,SAAS,MAAM,KAAK;CAC1D,MAAM,UAAU,MAAM,2CAA2C;EAC/D,YAAY;EACZ,gBAAgB,MAAM;EACtB,eAAe,MAAM;CACvB,CAAC;CACD,QAAQ,kBAAkB;CAgB1B,OAAO,uBAAuB;EAC5B,KAAA,MAHgB,wBAAwB,EAAE,UAAA,MAZrB,6BAA6B;GAClD,KAAK;GACL,WAAW;GACX,MAAM;IACJ,QAAQ;IACR;IACA,MAAM,KAAK,UAAU;KACnB,GAAI,MAAM,YAAY,KAAA,IAAY,CAAC,IAAI,EAAE,SAAS,MAAM,QAAQ;KAChE,GAAI,MAAM,UAAU,KAAA,IAAY,CAAC,IAAI,EAAE,OAAO,MAAM,MAAM;IAC5D,CAAC;GACH;EACF,CAAC,EACoD,CAAC;EAIpD;EACA,WAAW;CACb,CAAC;AACH;;;ACjEA,SAAgB,kBACd,SACA,UAAuC,CAAC,GAC9B;CACV,OAAO,eAAe,6BAA6B,SAAS,OAAO,CAAC;AACtE"}
1
+ {"version":3,"file":"cli-space-api-BT_Pu9Yg.js","names":["normalizeOptionalText","normalizeOptionalText","record"],"sources":["../src/runtime/dispatch-space-action-context.ts","../src/runtime/dispatch-owned-runtime.ts","../src/space/api-json.ts","../src/space/gateway-response.ts","../src/space/space-meta-response.ts","../src/space/meta-api.ts","../src/space/cli-space-api.ts"],"sourcesContent":["import { randomUUID } from \"node:crypto\";\nimport {\n chmodSync,\n existsSync,\n mkdirSync,\n readFileSync,\n renameSync,\n writeFileSync,\n} from \"node:fs\";\nimport { join } from \"node:path\";\nimport { isDeepStrictEqual } from \"node:util\";\nimport {\n openMeldSpaceEgressActionSchema,\n spaceMemberDirectoryEntrySchema,\n} from \"@openmeld/schemas\";\nimport type {\n DispatchSpaceActionClosedReasonCode,\n OpenMeldSpaceEgressAction,\n SpaceContract,\n SpaceMemberDirectoryEntry,\n} from \"@openmeld/schemas/types\";\nimport { isSelfWakeSpaceAction } from \"@openmeld/space-mesh\";\nimport { daemonRuntimeRootPath } from \"../config/daemon-state\";\nimport type { OpenMeldPathResolutionInput } from \"../config/paths\";\nimport {\n DISPATCH_OWNED_RUNTIME_MODE,\n OPENMELD_DISPATCH_RUNTIME_DISPATCH_ID_ENV,\n OPENMELD_DISPATCH_RUNTIME_MODE_ENV,\n OPENMELD_DISPATCH_RUNTIME_TARGET_PROFILE_ID_ENV,\n} from \"./dispatch-runtime-env\";\n\nexport const OPENMELD_SPACE_ACTION_CONTEXT_PATH_ENV =\n \"OPENMELD_SPACE_ACTION_CONTEXT_PATH\";\n\n/** The local action context is known expired/closed/mismatched: a new ordinary action must be rejected, never recorded. */\nexport class DispatchSpaceActionClosedError extends Error {\n readonly receipt = \"rejected_closed\" as const;\n readonly reasonCode: DispatchSpaceActionClosedReasonCode;\n constructor(\n reasonCode: DispatchSpaceActionClosedReasonCode,\n message: string\n ) {\n super(message);\n this.name = \"DispatchSpaceActionClosedError\";\n this.reasonCode = reasonCode;\n }\n}\n\nconst DISPATCH_SPACE_ACTION_CONTEXT_VERSION = 1 as const;\nconst DISPATCH_SPACE_ACTION_RECORD_VERSION = 1 as const;\nconst DEFAULT_CONTEXT_TTL_MS = 12 * 60 * 60 * 1000;\n\nexport type DispatchSpaceActionSendTargetReference =\n | {\n status: \"loaded\";\n projection: SpaceMemberDirectoryEntry[];\n referenceLines: string[];\n }\n | {\n status: \"failed\";\n errorMessage: string;\n projection: null;\n referenceLines: [];\n };\n\nexport type DispatchSpaceActionContext = {\n workingCopyId?: string;\n version: typeof DISPATCH_SPACE_ACTION_CONTEXT_VERSION;\n actionRecordPath: string;\n attemptId: string;\n contextId: string;\n dispatchId: string;\n expiresAtMs: number;\n nonce: string;\n replyToSignalId: string | null;\n sendTargetReference: DispatchSpaceActionSendTargetReference;\n sourceEventId: string;\n spaceContractSnapshot: Pick<\n SpaceContract,\n \"allowedActions\" | \"publicationMode\"\n > | null;\n spaceId: string;\n targetProfileId: string;\n taskId: string;\n};\n\nexport type DispatchSpaceActionRecord = {\n version: typeof DISPATCH_SPACE_ACTION_RECORD_VERSION;\n action: OpenMeldSpaceEgressAction;\n command: string;\n contextId: string;\n createdAtMs: number;\n nonce: string;\n};\n\nexport type DispatchSpaceActionRecordReadResult =\n | {\n status: \"missing\";\n }\n | {\n errorMessage: string;\n status: \"invalid\";\n }\n | {\n record: DispatchSpaceActionRecord;\n status: \"loaded\";\n };\n\nexport function createDispatchSpaceActionContext(input: {\n workingCopyId?: string;\n attemptId: string;\n dispatchId: string;\n env?: Record<string, string | undefined>;\n pathInput?: OpenMeldPathResolutionInput;\n replyToSignalId?: string | null;\n sendTargetReference: DispatchSpaceActionSendTargetReference;\n sourceEventId: string;\n spaceContractSnapshot:\n | Pick<SpaceContract, \"allowedActions\" | \"publicationMode\">\n | null\n | undefined;\n spaceId: string;\n targetProfileId: string;\n taskId: string;\n ttlMs?: number;\n}): {\n context: DispatchSpaceActionContext;\n contextPath: string;\n} {\n const contextId = randomUUID();\n const nonce = randomUUID();\n const contextDir = join(\n daemonRuntimeRootPath(input.pathInput ?? { env: input.env }),\n \"dispatch-space-actions\",\n `${Date.now().toString(36)}-${contextId}`\n );\n mkdirSync(contextDir, { recursive: true, mode: 0o700 });\n chmodSync(contextDir, 0o700);\n\n const contextPath = join(contextDir, \"context.json\");\n const actionRecordPath = join(contextDir, \"action.json\");\n const context: DispatchSpaceActionContext = {\n ...(input.workingCopyId ? { workingCopyId: input.workingCopyId } : {}),\n version: DISPATCH_SPACE_ACTION_CONTEXT_VERSION,\n actionRecordPath,\n attemptId: input.attemptId,\n contextId,\n dispatchId: input.dispatchId,\n expiresAtMs: Date.now() + (input.ttlMs ?? DEFAULT_CONTEXT_TTL_MS),\n nonce,\n replyToSignalId: normalizeOptionalText(input.replyToSignalId),\n sendTargetReference: input.sendTargetReference,\n sourceEventId: input.sourceEventId,\n spaceContractSnapshot: input.spaceContractSnapshot\n ? {\n allowedActions: input.spaceContractSnapshot.allowedActions,\n publicationMode: input.spaceContractSnapshot.publicationMode,\n }\n : null,\n spaceId: input.spaceId,\n targetProfileId: input.targetProfileId,\n taskId: input.taskId,\n };\n\n writeJsonFileExclusive(contextPath, context);\n return { context, contextPath };\n}\n\nexport function readDispatchSpaceActionContextFromEnv(\n env: NodeJS.ProcessEnv = process.env\n): DispatchSpaceActionContext {\n const context = readDispatchSpaceActionContextForReceiptFromEnv(env);\n assertContextActive(context, Date.now());\n return context;\n}\n\n// Expiry does not erase a prior receipt. Callers may use this context to compare\n// an exact existing action; writeDispatchSpaceActionRecord still rejects new\n// actions after expiry. File reads/uploads and target listing use the active\n// context reader instead.\nexport function readDispatchSpaceActionContextForReceiptFromEnv(\n env: NodeJS.ProcessEnv = process.env\n): DispatchSpaceActionContext {\n const contextPath = normalizeOptionalText(\n env[OPENMELD_SPACE_ACTION_CONTEXT_PATH_ENV]\n );\n if (!contextPath) {\n throw new Error(\n \"No active OpenMeld Space Action dispatch context was found. Use this command inside an OpenMeld Space Wake dispatch.\"\n );\n }\n const context = readDispatchSpaceActionContext(contextPath);\n assertDispatchRuntimeEnvMatchesContext({ context, env });\n return context;\n}\n\nexport function readDispatchSpaceActionContext(\n contextPath: string\n): DispatchSpaceActionContext {\n return parseDispatchSpaceActionContext(readJsonFile(contextPath));\n}\n\nexport function writeDispatchSpaceActionRecord(input: {\n action: OpenMeldSpaceEgressAction;\n command: string;\n context: DispatchSpaceActionContext;\n nowMs?: number;\n}): DispatchSpaceActionRecord {\n const parsedAction = openMeldSpaceEgressActionSchema.safeParse(input.action);\n if (!parsedAction.success) {\n throw parsedAction.error;\n }\n if (isSelfWakeSpaceAction(parsedAction.data, input.context.targetProfileId)) {\n throw new Error(\n \"An Agent cannot Wake itself. To reply to the current message, omit wakeTargets (CLI: --wake) and submit the reply again. No action was recorded.\"\n );\n }\n\n const existing = readDispatchSpaceActionRecord({ context: input.context });\n if (existing.status === \"invalid\") {\n throw new Error(existing.errorMessage);\n }\n if (\n existing.status === \"loaded\" &&\n isDeepStrictEqual(existing.record.action, parsedAction.data)\n ) {\n return existing.record;\n }\n assertContextActive(input.context, input.nowMs ?? Date.now());\n\n const record: DispatchSpaceActionRecord = {\n version: DISPATCH_SPACE_ACTION_RECORD_VERSION,\n action: parsedAction.data,\n command: input.command,\n contextId: input.context.contextId,\n createdAtMs: input.nowMs ?? Date.now(),\n nonce: input.context.nonce,\n };\n try {\n writeJsonFileExclusive(input.context.actionRecordPath, record);\n } catch (error) {\n if (isNodeErrorCode(error, \"EEXIST\")) {\n const existing = readDispatchSpaceActionRecord({\n context: input.context,\n });\n // A lost acknowledgement may cause the same proposal to be submitted\n // again. Acknowledge that record, never replace it or accept a new action.\n if (\n existing.status === \"loaded\" &&\n isDeepStrictEqual(existing.record.action, parsedAction.data)\n ) {\n return existing.record;\n }\n throw new Error(\n \"An OpenMeld Space Action has already been recorded for this dispatch. A Wake can only have one final Space action.\"\n );\n }\n throw error;\n }\n return record;\n}\n\nexport function readDispatchSpaceActionRecord(input: {\n context: DispatchSpaceActionContext;\n nowMs?: number;\n}): DispatchSpaceActionRecordReadResult {\n if (!existsSync(input.context.actionRecordPath)) {\n return { status: \"missing\" };\n }\n try {\n const record = parseDispatchSpaceActionRecord(\n readJsonFile(input.context.actionRecordPath)\n );\n if (\n record.contextId !== input.context.contextId ||\n record.nonce !== input.context.nonce\n ) {\n return {\n status: \"invalid\",\n errorMessage:\n \"OpenMeld Space Action record does not match the active dispatch context.\",\n };\n }\n if (record.createdAtMs > input.context.expiresAtMs) {\n return {\n status: \"invalid\",\n errorMessage:\n \"OpenMeld Space Action record was created after the active dispatch context expired.\",\n };\n }\n return { status: \"loaded\", record };\n } catch (error) {\n return {\n status: \"invalid\",\n errorMessage: error instanceof Error ? error.message : String(error),\n };\n }\n}\n\nexport function supersedeDispatchSpaceActionRecordForReconsideration(input: {\n context: DispatchSpaceActionContext;\n nowMs?: number;\n}): { archivedPath: string; record: DispatchSpaceActionRecord } | null {\n const readResult = readDispatchSpaceActionRecord(input);\n if (readResult.status === \"missing\") {\n return null;\n }\n if (readResult.status === \"invalid\") {\n throw new Error(readResult.errorMessage);\n }\n const archivedPath = `${input.context.actionRecordPath}.superseded-${String(input.nowMs ?? Date.now())}-${randomUUID()}`;\n renameSync(input.context.actionRecordPath, archivedPath);\n return { archivedPath, record: readResult.record };\n}\n\nfunction parseDispatchSpaceActionContext(\n value: unknown\n): DispatchSpaceActionContext {\n const record = toRecord(value, \"OpenMeld Space Action context\");\n const version = record.version;\n if (version !== DISPATCH_SPACE_ACTION_CONTEXT_VERSION) {\n throw new Error(\"Unsupported OpenMeld Space Action context version.\");\n }\n const sendTargetReference = parseSendTargetReference(\n record.sendTargetReference\n );\n return {\n version,\n actionRecordPath: requiredString(\n record.actionRecordPath,\n \"actionRecordPath\"\n ),\n attemptId: requiredString(record.attemptId, \"attemptId\"),\n contextId: requiredString(record.contextId, \"contextId\"),\n dispatchId: requiredString(record.dispatchId, \"dispatchId\"),\n expiresAtMs: requiredFiniteNumber(record.expiresAtMs, \"expiresAtMs\"),\n nonce: requiredString(record.nonce, \"nonce\"),\n replyToSignalId: optionalString(record.replyToSignalId),\n sendTargetReference,\n sourceEventId: requiredString(record.sourceEventId, \"sourceEventId\"),\n spaceContractSnapshot: parseSpaceContractSnapshot(\n record.spaceContractSnapshot\n ),\n spaceId: requiredString(record.spaceId, \"spaceId\"),\n targetProfileId: requiredString(record.targetProfileId, \"targetProfileId\"),\n taskId: requiredString(record.taskId, \"taskId\"),\n ...(record.workingCopyId\n ? { workingCopyId: requiredString(record.workingCopyId, \"workingCopyId\") }\n : {}),\n };\n}\n\nfunction assertDispatchRuntimeEnvMatchesContext(input: {\n context: DispatchSpaceActionContext;\n env: NodeJS.ProcessEnv;\n}): void {\n const mode = normalizeOptionalText(\n input.env[OPENMELD_DISPATCH_RUNTIME_MODE_ENV]\n );\n if (mode !== DISPATCH_OWNED_RUNTIME_MODE) {\n return;\n }\n\n const envDispatchId = normalizeOptionalText(\n input.env[OPENMELD_DISPATCH_RUNTIME_DISPATCH_ID_ENV]\n );\n if (!envDispatchId) {\n throw new Error(\n \"OpenMeld Space Action dispatch runtime is missing the active dispatch ID.\"\n );\n }\n if (envDispatchId !== input.context.dispatchId) {\n throw new DispatchSpaceActionClosedError(\n \"space_action.context_mismatch\",\n \"OpenMeld Space Action dispatch context does not match the active dispatch runtime.\"\n );\n }\n\n const envTargetProfileId = normalizeOptionalText(\n input.env[OPENMELD_DISPATCH_RUNTIME_TARGET_PROFILE_ID_ENV]\n );\n if (!envTargetProfileId) {\n throw new Error(\n \"OpenMeld Space Action dispatch runtime is missing the active target profile ID.\"\n );\n }\n if (envTargetProfileId !== input.context.targetProfileId) {\n throw new DispatchSpaceActionClosedError(\n \"space_action.context_mismatch\",\n \"OpenMeld Space Action target profile does not match the active dispatch runtime.\"\n );\n }\n}\n\nfunction parseDispatchSpaceActionRecord(\n value: unknown\n): DispatchSpaceActionRecord {\n const record = toRecord(value, \"OpenMeld Space Action record\");\n const version = record.version;\n if (version !== DISPATCH_SPACE_ACTION_RECORD_VERSION) {\n throw new Error(\"Unsupported OpenMeld Space Action record version.\");\n }\n const parsedAction = openMeldSpaceEgressActionSchema.safeParse(record.action);\n if (!parsedAction.success) {\n throw parsedAction.error;\n }\n return {\n version,\n action: parsedAction.data,\n command: requiredString(record.command, \"command\"),\n contextId: requiredString(record.contextId, \"contextId\"),\n createdAtMs: requiredFiniteNumber(record.createdAtMs, \"createdAtMs\"),\n nonce: requiredString(record.nonce, \"nonce\"),\n };\n}\n\nfunction parseSendTargetReference(\n value: unknown\n): DispatchSpaceActionSendTargetReference {\n const record = toRecord(value, \"sendTargetReference\");\n if (record.status === \"loaded\") {\n if (!Array.isArray(record.projection)) {\n throw new Error(\n \"OpenMeld Space Action send target projection must be an array.\"\n );\n }\n return {\n status: \"loaded\",\n projection: record.projection.map(parseSendTargetProjectionEntry),\n referenceLines: parseStringArray(record.referenceLines),\n };\n }\n if (record.status === \"failed\") {\n return {\n status: \"failed\",\n errorMessage: requiredString(record.errorMessage, \"errorMessage\"),\n projection: null,\n referenceLines: [],\n };\n }\n throw new Error(\n \"Invalid OpenMeld Space Action send target reference status.\"\n );\n}\n\nfunction parseSendTargetProjectionEntry(\n value: unknown,\n index: number\n): SpaceMemberDirectoryEntry {\n const parsed = spaceMemberDirectoryEntrySchema.safeParse(value);\n if (!parsed.success) {\n throw new Error(\n `OpenMeld Space Action target projection entry ${index} is not a valid Space member directory entry.`\n );\n }\n return parsed.data;\n}\n\nfunction parseSpaceContractSnapshot(\n value: unknown\n): Pick<SpaceContract, \"allowedActions\" | \"publicationMode\"> | null {\n if (value === null || value === undefined) {\n return null;\n }\n const record = toRecord(value, \"spaceContractSnapshot\");\n return {\n allowedActions: Array.isArray(record.allowedActions)\n ? (record.allowedActions as SpaceContract[\"allowedActions\"])\n : [],\n publicationMode:\n record.publicationMode === \"raw_context_sharing\"\n ? \"raw_context_sharing\"\n : \"collaboration\",\n };\n}\n\nfunction assertContextActive(\n context: DispatchSpaceActionContext,\n nowMs: number\n): void {\n if (nowMs > context.expiresAtMs) {\n throw new DispatchSpaceActionClosedError(\n \"space_action.context_expired\",\n \"The OpenMeld Space Action dispatch context has expired.\"\n );\n }\n}\n\nfunction readJsonFile(path: string): unknown {\n return JSON.parse(readFileSync(path, \"utf8\")) as unknown;\n}\n\nfunction writeJsonFileExclusive(path: string, value: unknown): void {\n writeFileSync(path, `${JSON.stringify(value, null, 2)}\\n`, {\n encoding: \"utf8\",\n flag: \"wx\",\n mode: 0o600,\n });\n chmodSync(path, 0o600);\n}\n\nfunction toRecord(value: unknown, label: string): Record<string, unknown> {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) {\n throw new Error(`${label} must be a JSON object.`);\n }\n return value as Record<string, unknown>;\n}\n\nfunction requiredString(value: unknown, fieldName: string): string {\n const normalized = normalizeOptionalText(value);\n if (!normalized) {\n throw new Error(`${fieldName} must be a non-empty string.`);\n }\n return normalized;\n}\n\nfunction requiredFiniteNumber(value: unknown, fieldName: string): number {\n if (typeof value !== \"number\" || !Number.isFinite(value)) {\n throw new Error(`${fieldName} must be a finite number.`);\n }\n return value;\n}\n\nfunction optionalString(value: unknown): string | null {\n if (value === null || value === undefined) {\n return null;\n }\n return normalizeOptionalText(value);\n}\n\nfunction parseStringArray(value: unknown): string[] {\n if (!Array.isArray(value)) {\n return [];\n }\n return value\n .map((item) => normalizeOptionalText(item))\n .filter((item): item is string => Boolean(item));\n}\n\nfunction normalizeOptionalText(value: unknown): string | null {\n const normalized = String(value ?? \"\").trim();\n return normalized.length > 0 ? normalized : null;\n}\n\nfunction isNodeErrorCode(error: unknown, code: string): boolean {\n return (\n typeof error === \"object\" &&\n error !== null &&\n \"code\" in error &&\n (error as { code?: unknown }).code === code\n );\n}\n","import {\n chmodSync,\n existsSync,\n mkdirSync,\n readFileSync,\n writeFileSync,\n} from \"node:fs\";\nimport { delimiter, dirname, join, resolve } from \"node:path\";\nimport { daemonRuntimeRootPath } from \"../config/daemon-state\";\nimport {\n type OpenMeldPathResolutionInput,\n openMeldManagedBinaryPath,\n resolveOpenMeldEnvPreset,\n} from \"../config/paths\";\nimport {\n DISPATCH_OWNED_RUNTIME_MODE,\n OPENMELD_DISPATCH_RUNTIME_DISPATCH_ID_ENV,\n OPENMELD_DISPATCH_RUNTIME_MODE_ENV,\n OPENMELD_DISPATCH_RUNTIME_TARGET_PROFILE_ID_ENV,\n OPENMELD_SPACE_ACTION_TOOL_COMMAND_PATH_ENV,\n OPENMELD_USER_FACING_CLI_COMMAND_ENV,\n} from \"./dispatch-runtime-env\";\nimport { OPENMELD_SPACE_ACTION_CONTEXT_PATH_ENV } from \"./dispatch-space-action-context\";\nimport {\n type OpenMeldDistribution,\n resolveOpenMeldDistribution,\n} from \"./distribution\";\n\nconst DISPATCH_OWNED_RUNTIME_CLI_SHIM_DIRNAME = \"dispatch-owned-cli\";\nconst DISPATCH_SPACE_ACTION_CLI_SHIM_DIRNAME = \"bin\";\nconst OPENMELD_ENV_PRESET_ENV = \"OPENMELD_ENV_PRESET\";\nconst DISPATCH_OWNED_RUNTIME_CLI_COMMAND_NAMES = [\n \"openmeld\",\n \"openmeld-dev\",\n \"openmeld-canary\",\n] as const;\n\nexport type DispatchOwnedRuntimeGuard = {\n active: boolean;\n dispatchId: string | null;\n targetProfileId: string | null;\n};\n\nexport function buildDispatchOwnedRuntimeEnv(input: {\n dispatchId: string;\n targetProfileId: string;\n distribution?: OpenMeldDistribution;\n env?: Record<string, string | undefined>;\n cliEntryPath?: string;\n spaceActionContextPath?: string | null;\n}): Record<string, string | undefined> {\n // Provider overrides are not a replacement for the carrier's lane. Keep\n // these non-secret installation selectors without copying unrelated Service\n // credentials into the provider environment.\n const env = {\n OPENMELD_HOME: process.env.OPENMELD_HOME,\n OPENMELD_ENV_PRESET: process.env.OPENMELD_ENV_PRESET,\n ...(input.env ?? {}),\n };\n const currentPath = normalizeOptionalText(\n input.env?.PATH ?? process.env.PATH\n );\n const shimDir = ensureDispatchOwnedRuntimeCliShims({\n cliEntryPath: input.cliEntryPath,\n dispatchId: input.dispatchId,\n distribution: input.distribution,\n env,\n spaceActionContextPath: input.spaceActionContextPath,\n targetProfileId: input.targetProfileId,\n });\n const actionCommand = resolveDispatchOwnedRuntimeActionCliEntryCommand({\n env,\n });\n return {\n ...env,\n PATH: prependPathEntry({\n currentPath,\n nextEntry: shimDir,\n }),\n [OPENMELD_DISPATCH_RUNTIME_MODE_ENV]: DISPATCH_OWNED_RUNTIME_MODE,\n [OPENMELD_DISPATCH_RUNTIME_DISPATCH_ID_ENV]: input.dispatchId,\n [OPENMELD_DISPATCH_RUNTIME_TARGET_PROFILE_ID_ENV]: input.targetProfileId,\n [OPENMELD_USER_FACING_CLI_COMMAND_ENV]: actionCommand,\n [OPENMELD_SPACE_ACTION_TOOL_COMMAND_PATH_ENV]: join(shimDir, actionCommand),\n [OPENMELD_ENV_PRESET_ENV]: resolveDispatchOwnedRuntimeEnvPreset({\n env,\n }),\n ...(input.spaceActionContextPath\n ? {\n [OPENMELD_SPACE_ACTION_CONTEXT_PATH_ENV]:\n input.spaceActionContextPath,\n }\n : {}),\n };\n}\n\nexport function resolveDispatchOwnedRuntimeActionCliEntryCommand(\n input: OpenMeldPathResolutionInput = {}\n): \"openmeld\" | \"openmeld-dev\" | \"openmeld-canary\" {\n const preset = resolveOpenMeldEnvPreset(input);\n if (preset === \"dev-local\") {\n return \"openmeld-dev\";\n }\n if (preset === \"canary\") {\n return \"openmeld-canary\";\n }\n return \"openmeld\";\n}\n\nexport function resolveDispatchOwnedRuntimeCliShimDir(\n input: OpenMeldPathResolutionInput & {\n spaceActionContextPath?: string | null;\n } = {}\n): string {\n const spaceActionContextPath = normalizeOptionalText(\n input.spaceActionContextPath\n );\n if (spaceActionContextPath) {\n return join(\n dirname(spaceActionContextPath),\n DISPATCH_SPACE_ACTION_CLI_SHIM_DIRNAME\n );\n }\n return join(\n daemonRuntimeRootPath(input),\n \"bin\",\n DISPATCH_OWNED_RUNTIME_CLI_SHIM_DIRNAME\n );\n}\n\nexport function ensureDispatchOwnedRuntimeCliShims(input?: {\n cliEntryPath?: string;\n distribution?: OpenMeldDistribution;\n dispatchId?: string;\n env?: Record<string, string | undefined>;\n spaceActionContextPath?: string | null;\n targetProfileId?: string;\n}): string {\n const distribution = input?.distribution ?? resolveOpenMeldDistribution();\n const cliEntryPath =\n distribution === \"binary\"\n ? resolveDispatchOwnedRuntimeBinaryCliEntryPath({\n cliEntryPath: input?.cliEntryPath,\n env: input?.env,\n })\n : resolveDispatchOwnedRuntimeCliEntryPath(input?.cliEntryPath);\n const shimDir = resolveDispatchOwnedRuntimeCliShimDir({\n env: input?.env,\n spaceActionContextPath: input?.spaceActionContextPath,\n });\n mkdirSync(shimDir, { recursive: true });\n\n for (const commandName of DISPATCH_OWNED_RUNTIME_CLI_COMMAND_NAMES) {\n const shimPath = join(shimDir, commandName);\n const shimSource = buildDispatchOwnedRuntimeCliShimSource({\n cliEntryPath,\n commandName,\n dispatchId: input?.dispatchId,\n distribution,\n nodePath: process.execPath,\n spaceActionContextPath: input?.spaceActionContextPath,\n targetProfileId: input?.targetProfileId,\n });\n if (existsSync(shimPath)) {\n const currentSource = safeReadTextFile(shimPath);\n if (currentSource === shimSource) {\n chmodSync(shimPath, 0o755);\n continue;\n }\n }\n writeFileSync(shimPath, shimSource, {\n encoding: \"utf8\",\n mode: 0o755,\n });\n chmodSync(shimPath, 0o755);\n }\n\n return shimDir;\n}\n\nexport function readDispatchOwnedRuntimeGuard(\n env: NodeJS.ProcessEnv = process.env\n): DispatchOwnedRuntimeGuard {\n const mode = normalizeOptionalText(env[OPENMELD_DISPATCH_RUNTIME_MODE_ENV]);\n if (mode !== DISPATCH_OWNED_RUNTIME_MODE) {\n return {\n active: false,\n dispatchId: null,\n targetProfileId: null,\n };\n }\n\n return {\n active: true,\n dispatchId: normalizeOptionalText(\n env[OPENMELD_DISPATCH_RUNTIME_DISPATCH_ID_ENV]\n ),\n targetProfileId: normalizeOptionalText(\n env[OPENMELD_DISPATCH_RUNTIME_TARGET_PROFILE_ID_ENV]\n ),\n };\n}\n\nexport function assertDispatchOwnedRuntimePublicWriteAllowed(input: {\n commandLabel: string;\n env?: NodeJS.ProcessEnv;\n}): void {\n const guard = readDispatchOwnedRuntimeGuard(input.env);\n if (!guard.active) {\n return;\n }\n\n const dispatchIdSuffix = guard.dispatchId\n ? ` (dispatch ${guard.dispatchId})`\n : \"\";\n throw new Error(\n `${input.commandLabel} is blocked inside a dispatch-owned runtime${dispatchIdSuffix}. Public space writes must be returned through OpenMeld Space structured actions: post_message, post_status, or stay_silent.`\n );\n}\n\nfunction normalizeOptionalText(value: unknown): string | null {\n const normalized = String(value ?? \"\").trim();\n return normalized.length > 0 ? normalized : null;\n}\n\nfunction resolveDispatchOwnedRuntimeCliEntryPath(\n cliEntryPath?: string\n): string {\n const normalizedCliEntryPath =\n normalizeOptionalText(cliEntryPath) ??\n normalizeOptionalText(process.argv[1]) ??\n null;\n if (!normalizedCliEntryPath) {\n throw new Error(\n \"dispatch-owned runtime CLI shim requires a current CLI entry path\"\n );\n }\n return resolve(normalizedCliEntryPath);\n}\n\nfunction resolveDispatchOwnedRuntimeBinaryCliEntryPath(input: {\n cliEntryPath?: string;\n env?: Record<string, string | undefined>;\n}): string {\n // A background Service may keep running from an executable path that an\n // upgrade later replaces with a launcher. The lane-owned managed CLI is the\n // stable command authority for new Space Action subprocesses.\n const normalizedCliEntryPath =\n normalizeOptionalText(input.cliEntryPath) ??\n normalizeOptionalText(openMeldManagedBinaryPath({ env: input.env })) ??\n null;\n if (!normalizedCliEntryPath) {\n throw new Error(\n \"dispatch-owned runtime CLI shim requires a current binary CLI path\"\n );\n }\n return resolve(normalizedCliEntryPath);\n}\n\nfunction buildDispatchOwnedRuntimeCliShimSource(input: {\n cliEntryPath: string;\n commandName: (typeof DISPATCH_OWNED_RUNTIME_CLI_COMMAND_NAMES)[number];\n distribution: OpenMeldDistribution;\n dispatchId?: string;\n nodePath: string;\n spaceActionContextPath?: string | null;\n targetProfileId?: string;\n}): string {\n const embeddedEnv = {\n [OPENMELD_DISPATCH_RUNTIME_MODE_ENV]: DISPATCH_OWNED_RUNTIME_MODE,\n [OPENMELD_ENV_PRESET_ENV]: resolveEnvPresetForCommandName(\n input.commandName\n ),\n [OPENMELD_USER_FACING_CLI_COMMAND_ENV]: input.commandName,\n ...(normalizeOptionalText(input.dispatchId)\n ? {\n [OPENMELD_DISPATCH_RUNTIME_DISPATCH_ID_ENV]: normalizeOptionalText(\n input.dispatchId\n ) as string,\n }\n : {}),\n ...(normalizeOptionalText(input.targetProfileId)\n ? {\n [OPENMELD_DISPATCH_RUNTIME_TARGET_PROFILE_ID_ENV]:\n normalizeOptionalText(input.targetProfileId) as string,\n }\n : {}),\n ...(normalizeOptionalText(input.spaceActionContextPath)\n ? {\n [OPENMELD_SPACE_ACTION_CONTEXT_PATH_ENV]: normalizeOptionalText(\n input.spaceActionContextPath\n ) as string,\n }\n : {}),\n };\n if (input.distribution === \"binary\") {\n const exportRows = Object.entries(embeddedEnv).map(\n ([key, value]) => `export ${key}=${quoteShellValue(value)}`\n );\n return `#!/bin/sh\n${exportRows.join(\"\\n\")}\nexec ${quoteShellValue(input.cliEntryPath)} \"$@\"\n`;\n }\n return `#!/usr/bin/env node\nimport { spawnSync } from \"node:child_process\";\n\nconst result = spawnSync(${JSON.stringify(input.nodePath)}, [${JSON.stringify(\n input.cliEntryPath\n )}, ...process.argv.slice(2)], {\n env: { ...process.env, ...${JSON.stringify(embeddedEnv)} },\n stdio: \"inherit\",\n});\n\nif (result.error) {\n throw result.error;\n}\n\nprocess.exit(result.status ?? 1);\n`;\n}\n\nfunction resolveDispatchOwnedRuntimeEnvPreset(input: {\n env?: Record<string, string | undefined>;\n}): \"prod\" | \"dev-local\" | \"canary\" {\n return resolveEnvPresetForCommandName(\n resolveDispatchOwnedRuntimeActionCliEntryCommand({\n env: input.env,\n })\n );\n}\n\nfunction resolveEnvPresetForCommandName(\n commandName: (typeof DISPATCH_OWNED_RUNTIME_CLI_COMMAND_NAMES)[number]\n): \"prod\" | \"dev-local\" | \"canary\" {\n if (commandName === \"openmeld-dev\") {\n return \"dev-local\";\n }\n if (commandName === \"openmeld-canary\") {\n return \"canary\";\n }\n return \"prod\";\n}\n\nfunction quoteShellValue(value: string): string {\n return `'${value.replaceAll(\"'\", \"'\\\\''\")}'`;\n}\n\nfunction safeReadTextFile(path: string): string | null {\n try {\n return readFileSync(path, \"utf8\");\n } catch {\n return null;\n }\n}\n\nfunction prependPathEntry(input: {\n currentPath: string | null;\n nextEntry: string;\n}): string {\n const currentEntries = (input.currentPath ?? \"\")\n .split(delimiter)\n .map((entry) => entry.trim())\n .filter((entry) => entry.length > 0);\n const dedupedEntries = currentEntries.filter(\n (entry) => entry !== input.nextEntry\n );\n return [input.nextEntry, ...dedupedEntries].join(delimiter);\n}\n","export function parseJsonResponse(raw: string): unknown {\n if (!raw.trim()) {\n return null;\n }\n try {\n return JSON.parse(raw);\n } catch {\n return null;\n }\n}\n","import { OpenMeldApiClientHttpError } from \"@openmeld/api-client\";\nimport { OPENMELD_HEADER_REQUEST_ID } from \"@openmeld/gateway-contract\";\nimport { gatewayErrorEnvelopeSchema } from \"@openmeld/schemas\";\nimport type { GatewayErrorCode } from \"@openmeld/schemas/types\";\nimport { parseJsonResponse } from \"./api-json\";\n\nconst FALLBACK_GATEWAY_HTTP_ERROR_CODE = \"gateway.http_error\" as const;\nconst GENERIC_NETWORK_ERROR_CODES = [\n \"network.timeout\",\n \"network.request_failed\",\n] as const;\n\ntype SafeParseResult<T> = { success: true; data: T } | { success: false };\n\ntype GatewayResponseSchema<T> = {\n safeParse: (value: unknown) => SafeParseResult<T>;\n};\n\nexport type GatewayResponseErrorCode =\n | GatewayErrorCode\n | typeof FALLBACK_GATEWAY_HTTP_ERROR_CODE\n | (typeof GENERIC_NETWORK_ERROR_CODES)[number]\n | string;\n\nexport type StructuredGatewayFailure = {\n code: GatewayResponseErrorCode | null;\n message: string;\n requestId: string | null;\n status: number | null;\n upstreamCode: string | null;\n};\n\nexport class GatewayHttpError extends Error {\n readonly code: GatewayResponseErrorCode;\n readonly requestId: string | null;\n readonly status: number;\n readonly rawBody: string;\n readonly upstreamCode: string | null;\n\n constructor(input: {\n code: GatewayResponseErrorCode;\n message: string;\n requestId?: string | null;\n status: number;\n rawBody: string;\n upstreamCode?: string | null;\n }) {\n super(input.message);\n this.name = \"GatewayHttpError\";\n this.code = input.code;\n this.requestId = normalizeOptionalText(input.requestId);\n this.status = input.status;\n this.rawBody = input.rawBody;\n this.upstreamCode = normalizeOptionalText(input.upstreamCode);\n }\n}\n\nexport async function readGatewayJsonResponse<T>(input: {\n response: Response;\n schema: GatewayResponseSchema<T>;\n invalidMessage: string;\n}): Promise<T> {\n const raw = await input.response.text();\n assertGatewayResponseOk({\n response: input.response,\n raw,\n });\n\n const parsed = input.schema.safeParse(parseJsonResponse(raw));\n if (!parsed.success) {\n throw new Error(input.invalidMessage);\n }\n return parsed.data;\n}\n\nexport async function readGatewayTextResponse(input: {\n response: Response;\n}): Promise<string> {\n const raw = await input.response.text();\n assertGatewayResponseOk({\n response: input.response,\n raw,\n });\n return raw;\n}\n\nexport function assertGatewayResponseOk(input: {\n response: Response;\n raw: string;\n}): void {\n if (input.response.ok) {\n return;\n }\n throw parseGatewayErrorResponse(input);\n}\n\nexport function parseGatewayErrorResponse(input: {\n response: Pick<Response, \"headers\" | \"status\">;\n raw: string;\n}): GatewayHttpError {\n const payload = parseJsonResponse(input.raw);\n const parsed = gatewayErrorEnvelopeSchema.safeParse(payload);\n const headerRequestId = normalizeOptionalText(\n input.response.headers.get(OPENMELD_HEADER_REQUEST_ID)\n );\n\n if (parsed.success) {\n return new GatewayHttpError({\n code: parsed.data.error.code,\n message: parsed.data.error.message,\n requestId: parsed.data.error.requestId || headerRequestId,\n status: input.response.status,\n rawBody: input.raw,\n upstreamCode: parsed.data.error.upstreamCode ?? null,\n });\n }\n\n const looseEnvelope = readLooseGatewayErrorEnvelope(payload);\n if (looseEnvelope) {\n return new GatewayHttpError({\n code: looseEnvelope.code ?? FALLBACK_GATEWAY_HTTP_ERROR_CODE,\n message:\n looseEnvelope.message ??\n `Gateway request failed with HTTP ${input.response.status}.`,\n requestId: looseEnvelope.requestId ?? headerRequestId,\n status: input.response.status,\n rawBody: input.raw,\n upstreamCode: looseEnvelope.upstreamCode,\n });\n }\n\n return new GatewayHttpError({\n code: FALLBACK_GATEWAY_HTTP_ERROR_CODE,\n message:\n normalizeOptionalText(input.raw) ??\n `Gateway request failed with HTTP ${input.response.status}.`,\n requestId: headerRequestId,\n status: input.response.status,\n rawBody: input.raw,\n upstreamCode: null,\n });\n}\n\nexport function toStructuredGatewayFailure(\n error: unknown\n): StructuredGatewayFailure {\n if (error instanceof OpenMeldApiClientHttpError) {\n return {\n code: error.code,\n message: normalizeFailureMessage(error.message),\n requestId: error.requestId,\n status: error.status,\n upstreamCode: error.upstreamCode,\n };\n }\n\n if (error instanceof GatewayHttpError) {\n return {\n code: error.code,\n message: normalizeFailureMessage(error.message),\n requestId: error.requestId,\n status: error.status,\n upstreamCode: error.upstreamCode,\n };\n }\n\n const genericErrorCode = readGenericErrorCode(error);\n if (genericErrorCode) {\n return {\n code: genericErrorCode,\n message: normalizeFailureMessage(\n error instanceof Error ? error.message : String(error)\n ),\n requestId: null,\n status: null,\n upstreamCode: null,\n };\n }\n\n return {\n code: null,\n message: normalizeFailureMessage(\n error instanceof Error ? error.message : String(error)\n ),\n requestId: null,\n status: null,\n upstreamCode: null,\n };\n}\n\nfunction normalizeOptionalText(value: unknown): string | null {\n const normalized = String(value ?? \"\").trim();\n return normalized.length > 0 ? normalized : null;\n}\n\nfunction normalizeFailureMessage(value: unknown): string {\n return normalizeOptionalText(value) ?? \"Unknown error.\";\n}\n\nfunction readGenericErrorCode(value: unknown): GatewayResponseErrorCode | null {\n if (!value || typeof value !== \"object\" || !(\"code\" in value)) {\n return null;\n }\n\n const normalized = normalizeOptionalText(\n (value as { code?: unknown }).code ?? null\n );\n return normalized as GatewayResponseErrorCode | null;\n}\n\nfunction readLooseGatewayErrorEnvelope(value: unknown): {\n code: string | null;\n message: string | null;\n requestId: string | null;\n upstreamCode: string | null;\n} | null {\n if (!value || typeof value !== \"object\") {\n return null;\n }\n\n const record = value as {\n error?: {\n code?: unknown;\n message?: unknown;\n requestId?: unknown;\n upstreamCode?: unknown;\n } | null;\n };\n const error = record.error;\n if (!error || typeof error !== \"object\") {\n return null;\n }\n\n const code = normalizeOptionalText(error.code);\n const message = normalizeOptionalText(error.message);\n const requestId = normalizeOptionalText(error.requestId);\n const upstreamCode = normalizeOptionalText(error.upstreamCode);\n if (!(code || message || requestId || upstreamCode)) {\n return null;\n }\n\n return {\n code,\n message,\n requestId,\n upstreamCode,\n };\n}\n","import type { SpaceMeta } from \"@openmeld/protocol\";\nimport { spaceMetaSchema } from \"@openmeld/schemas\";\n\ntype SpaceMetaParseOperation =\n | \"createSpaceMeta\"\n | \"fetchSpaceMeta\"\n | \"updateSpaceMeta\";\n\nexport function parseSpaceMetaPayload(input: {\n data: unknown;\n endpoint: string;\n operation: SpaceMetaParseOperation;\n}): SpaceMeta {\n try {\n const validation = spaceMetaSchema.safeParse(input.data);\n if (!validation.success) {\n const reason =\n validation.error.issues[0]?.message ??\n \"space meta payload does not match schema\";\n throw new Error(reason);\n }\n return validation.data;\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error);\n throw new Error(\n `${input.operation} received invalid response payload from ${input.endpoint}: ${reason}; raw=${JSON.stringify(input.data)}`\n );\n }\n}\n\nexport function parseSpaceMetaResponse(input: {\n raw: string;\n endpoint: string;\n operation: Extract<\n SpaceMetaParseOperation,\n \"fetchSpaceMeta\" | \"updateSpaceMeta\"\n >;\n}): SpaceMeta {\n try {\n return parseSpaceMetaPayload({\n data: JSON.parse(input.raw) as unknown,\n endpoint: input.endpoint,\n operation: input.operation,\n });\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error);\n throw new Error(\n `${input.operation} received invalid response payload from ${input.endpoint}: ${reason}; raw=${input.raw}`\n );\n }\n}\n","import type { SpaceMeta } from \"@openmeld/protocol\";\nimport type { OpenMeldRequestContext } from \"@openmeld/schemas/types\";\nimport { buildOpenMeldRequestContextHeadersWithAuth } from \"../config/request-headers\";\nimport { toSpaceMetaUrl } from \"../protocol/urls\";\nimport { fetchSpaceRequestWithTimeout } from \"./fetch-with-timeout\";\nimport { readGatewayTextResponse } from \"./gateway-response\";\nimport { parseSpaceMetaResponse } from \"./space-meta-response\";\n\ntype SpaceMetaApiInput = {\n requestContext: OpenMeldRequestContext;\n baseUrl: string;\n space: string;\n password?: string;\n};\n\nexport async function fetchSpaceMeta(\n input: SpaceMetaApiInput\n): Promise<SpaceMeta> {\n const endpoint = toSpaceMetaUrl(input.baseUrl, input.space);\n const response = await fetchSpaceRequestWithTimeout({\n url: endpoint,\n operation: \"space.fetch_meta\",\n init: {\n method: \"GET\",\n headers: await buildOpenMeldRequestContextHeadersWithAuth({\n requestUrl: endpoint,\n requestContext: input.requestContext,\n spacePassword: input.password,\n }),\n },\n });\n const raw = await readGatewayTextResponse({ response });\n\n return parseSpaceMetaResponse({\n raw,\n endpoint,\n operation: \"fetchSpaceMeta\",\n });\n}\n\nexport async function updateSpaceMeta(\n input: SpaceMetaApiInput & {\n purpose?: string;\n guide?: string;\n }\n): Promise<SpaceMeta> {\n const endpoint = toSpaceMetaUrl(input.baseUrl, input.space);\n const headers = await buildOpenMeldRequestContextHeadersWithAuth({\n requestUrl: endpoint,\n requestContext: input.requestContext,\n spacePassword: input.password,\n });\n headers[\"content-type\"] = \"application/json\";\n\n const response = await fetchSpaceRequestWithTimeout({\n url: endpoint,\n operation: \"space.update_meta\",\n init: {\n method: \"PATCH\",\n headers,\n body: JSON.stringify({\n ...(input.purpose === undefined ? {} : { purpose: input.purpose }),\n ...(input.guide === undefined ? {} : { guide: input.guide }),\n }),\n },\n });\n const raw = await readGatewayTextResponse({ response });\n\n return parseSpaceMetaResponse({\n raw,\n endpoint,\n operation: \"updateSpaceMeta\",\n });\n}\n","import { createSpaceApi, type SpaceApi } from \"@openmeld/api-client\";\nimport { createCliApiClientFoundation } from \"./api-client-foundation\";\n\nexport type {\n SpaceApi,\n SpaceSignalsReadQuery,\n} from \"@openmeld/api-client\";\n\nexport function createCliSpaceApi(\n baseUrl: string,\n options: Parameters<typeof createCliApiClientFoundation>[1] = {}\n): SpaceApi {\n return createSpaceApi(createCliApiClientFoundation(baseUrl, options));\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA+BA,MAAa,yCACX;;AAGF,IAAa,iCAAb,cAAoD,MAAM;CACxD,UAAmB;CACnB;CACA,YACE,YACA,SACA;EACA,MAAM,OAAO;EACb,KAAK,OAAO;EACZ,KAAK,aAAa;CACpB;AACF;AAEA,MAAM,wCAAwC;AAC9C,MAAM,uCAAuC;AAC7C,MAAM,yBAAyB,MAAU,KAAK;AA0D9C,SAAgB,iCAAiC,OAoB/C;CACA,MAAM,YAAY,WAAW;CAC7B,MAAM,QAAQ,WAAW;CACzB,MAAM,aAAa,KACjB,sBAAsB,MAAM,aAAa,EAAE,KAAK,MAAM,IAAI,CAAC,GAC3D,0BACA,GAAG,KAAK,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,GAAG,WAChC;CACA,UAAU,YAAY;EAAE,WAAW;EAAM,MAAM;CAAM,CAAC;CACtD,UAAU,YAAY,GAAK;CAE3B,MAAM,cAAc,KAAK,YAAY,cAAc;CACnD,MAAM,mBAAmB,KAAK,YAAY,aAAa;CACvD,MAAM,UAAsC;EAC1C,GAAI,MAAM,gBAAgB,EAAE,eAAe,MAAM,cAAc,IAAI,CAAC;EACpE,SAAS;EACT;EACA,WAAW,MAAM;EACjB;EACA,YAAY,MAAM;EAClB,aAAa,KAAK,IAAI,KAAK,MAAM,SAAS;EAC1C;EACA,iBAAiBA,wBAAsB,MAAM,eAAe;EAC5D,qBAAqB,MAAM;EAC3B,eAAe,MAAM;EACrB,uBAAuB,MAAM,wBACzB;GACE,gBAAgB,MAAM,sBAAsB;GAC5C,iBAAiB,MAAM,sBAAsB;EAC/C,IACA;EACJ,SAAS,MAAM;EACf,iBAAiB,MAAM;EACvB,QAAQ,MAAM;CAChB;CAEA,uBAAuB,aAAa,OAAO;CAC3C,OAAO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