openmeld 0.3.222 → 0.3.224

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (177) hide show
  1. package/dist/{add-me-membership-Wc69O6rA.js → add-me-membership-CGISMRPF.js} +2 -2
  2. package/dist/{add-me-membership-Wc69O6rA.js.map → add-me-membership-CGISMRPF.js.map} +1 -1
  3. package/dist/{agents-B8zhQnGw.js → agents-CR7BebgO.js} +12 -12
  4. package/dist/{agents-B8zhQnGw.js.map → agents-CR7BebgO.js.map} +1 -1
  5. package/dist/{api-client-foundation-DTiFoGpI.js → api-client-foundation-CqbIn_de.js} +1 -1
  6. package/dist/{api-client-foundation-DnJ_JYli.js → api-client-foundation-DpVwrgh-.js} +3 -3
  7. package/dist/{api-client-foundation-DnJ_JYli.js.map → api-client-foundation-DpVwrgh-.js.map} +1 -1
  8. package/dist/auth-session-BJfKu74u.js +4 -0
  9. package/dist/{auth-session-nhS8jyux.js → auth-session-uEk_Tx6T.js} +8 -8
  10. package/dist/auth-session-uEk_Tx6T.js.map +1 -0
  11. package/dist/{base-url-CMBApK1J.js → base-url-DXrUiSMI.js} +1 -1
  12. package/dist/{base-url-D7uE_xTo.js → base-url-DvjOkKPs.js} +2 -2
  13. package/dist/{base-url-D7uE_xTo.js.map → base-url-DvjOkKPs.js.map} +1 -1
  14. package/dist/{channel-ggx0o_aG.js → channel-B2fD2_be.js} +4 -4
  15. package/dist/{channel-ggx0o_aG.js.map → channel-B2fD2_be.js.map} +1 -1
  16. package/dist/{cli-binary-manifest-DiUulkp0.js → cli-binary-manifest-CT5X05lk.js} +30 -4
  17. package/dist/cli-binary-manifest-CT5X05lk.js.map +1 -0
  18. package/dist/{command-Bz9x7V2T.js → command-CQ9XRwqf.js} +22 -165
  19. package/dist/command-CQ9XRwqf.js.map +1 -0
  20. package/dist/{computer-connection-M3N6plkj.js → computer-connection-Dm7iTnRK.js} +2 -2
  21. package/dist/{computer-connection-M3N6plkj.js.map → computer-connection-Dm7iTnRK.js.map} +1 -1
  22. package/dist/{computer-connection-review-DY5BK_27.js → computer-connection-review-RHAoddSS.js} +6 -6
  23. package/dist/{computer-connection-review-DY5BK_27.js.map → computer-connection-review-RHAoddSS.js.map} +1 -1
  24. package/dist/{computer-disconnect-DR1WDSPK.js → computer-disconnect-BWRsge_2.js} +10 -10
  25. package/dist/{computer-disconnect-DR1WDSPK.js.map → computer-disconnect-BWRsge_2.js.map} +1 -1
  26. package/dist/{computer-setup-continuation-2gs8z-nB.js → computer-setup-continuation-BOCRH0qq.js} +4 -4
  27. package/dist/{computer-setup-continuation-2gs8z-nB.js.map → computer-setup-continuation-BOCRH0qq.js.map} +1 -1
  28. package/dist/context-Bdh3nAzw.js +162 -0
  29. package/dist/context-Bdh3nAzw.js.map +1 -0
  30. package/dist/{control-plane-e3W6PD2M.js → control-plane-rTE2rHZ5.js} +2 -2
  31. package/dist/{control-plane-e3W6PD2M.js.map → control-plane-rTE2rHZ5.js.map} +1 -1
  32. package/dist/{daemon-device-id-DWO9_QW6.js → daemon-device-id-B1Af2Zmn.js} +344 -36
  33. package/dist/daemon-device-id-B1Af2Zmn.js.map +1 -0
  34. package/dist/{daemon-frame-transport-D2-tazuK.js → daemon-frame-transport-WiB73yhT.js} +519 -12
  35. package/dist/daemon-frame-transport-WiB73yhT.js.map +1 -0
  36. package/dist/{daemon-lifecycle-journal-DyKx1xzm.js → daemon-lifecycle-journal-CDZLWgMj.js} +11 -11
  37. package/dist/daemon-lifecycle-journal-CDZLWgMj.js.map +1 -0
  38. package/dist/{daemon-runtime-lease-BUr4qsLo.js → daemon-runtime-lease-1LMeZ6IS.js} +2 -2
  39. package/dist/{daemon-runtime-lease-BUr4qsLo.js.map → daemon-runtime-lease-1LMeZ6IS.js.map} +1 -1
  40. package/dist/{daemon-runtime-lease-C9X8xV_F.js → daemon-runtime-lease-Bz0ucJj3.js} +1 -1
  41. package/dist/{daemon-service-contract-BpOBMGX0.js → daemon-service-contract-GLmAxsq-.js} +4 -4
  42. package/dist/{daemon-service-contract-BpOBMGX0.js.map → daemon-service-contract-GLmAxsq-.js.map} +1 -1
  43. package/dist/{daemon-service-manager-HL4VKbIU.js → daemon-service-manager-C8RUCMDo.js} +9 -7
  44. package/dist/daemon-service-manager-C8RUCMDo.js.map +1 -0
  45. package/dist/{daemon-service-manager-B-QrDe5p.js → daemon-service-manager-CU-79a4z.js} +1 -1
  46. package/dist/{daemon-service-runtime-bKt0YjC7.js → daemon-service-runtime-CBJtgM4P.js} +397 -51
  47. package/dist/daemon-service-runtime-CBJtgM4P.js.map +1 -0
  48. package/dist/{daemon-service-update-coordinator-D8O1uTtu.js → daemon-service-update-coordinator-0LB_XGVZ.js} +48 -33
  49. package/dist/daemon-service-update-coordinator-0LB_XGVZ.js.map +1 -0
  50. package/dist/{daemon-state-B44aq2nm.js → daemon-state-Ca0WK5x0.js} +3 -3
  51. package/dist/{daemon-state-B44aq2nm.js.map → daemon-state-Ca0WK5x0.js.map} +1 -1
  52. package/dist/{dist-B07ziN_u.js → dist-BeJcIdCZ.js} +25 -17
  53. package/dist/dist-BeJcIdCZ.js.map +1 -0
  54. package/dist/dist-C32frPV2.js +4 -0
  55. package/dist/{dist-B2EauBG6.js → dist-YbTZ-Y-2.js} +16 -12
  56. package/dist/dist-YbTZ-Y-2.js.map +1 -0
  57. package/dist/{elapsed-time-Ooo4IC25.js → elapsed-time-q8lSPcfm.js} +6 -6
  58. package/dist/{elapsed-time-Ooo4IC25.js.map → elapsed-time-q8lSPcfm.js.map} +1 -1
  59. package/dist/{entry-DeIRMCiW.js → entry-CpS6tnIk.js} +12 -12
  60. package/dist/{entry-DeIRMCiW.js.map → entry-CpS6tnIk.js.map} +1 -1
  61. package/dist/{installation-inventory-DThnBEhV.js → installation-inventory-C5FsAvrf.js} +5 -5
  62. package/dist/{installation-inventory-DThnBEhV.js.map → installation-inventory-C5FsAvrf.js.map} +1 -1
  63. package/dist/{installer-D2bWZT88.js → installer-054NLJg6.js} +2 -2
  64. package/dist/{installer-D2bWZT88.js.map → installer-054NLJg6.js.map} +1 -1
  65. package/dist/io-DT66typ4.js +16 -0
  66. package/dist/io-DT66typ4.js.map +1 -0
  67. package/dist/{local-components-B6SCXZf9.js → local-components-DleLEzSU.js} +2 -1
  68. package/dist/local-components-DleLEzSU.js.map +1 -0
  69. package/dist/{lock-Bsl_ElWy.js → lock-iue1J2xy.js} +8 -5
  70. package/dist/lock-iue1J2xy.js.map +1 -0
  71. package/dist/{cli-space-api-CQtKu9Zt.js → meta-api-B1k3mwHN.js} +203 -19
  72. package/dist/meta-api-B1k3mwHN.js.map +1 -0
  73. package/dist/{openmeld-BQy0nMox.js → openmeld-BFO3sfC_.js} +93 -1027
  74. package/dist/openmeld-BFO3sfC_.js.map +1 -0
  75. package/dist/openmeld-dev.js +1 -1
  76. package/dist/{openmeld-environment-target-B6HqY0_a.js → openmeld-environment-target-BBn5Ko6p.js} +3 -3
  77. package/dist/{openmeld-environment-target-B6HqY0_a.js.map → openmeld-environment-target-BBn5Ko6p.js.map} +1 -1
  78. package/dist/{openmeld-maintenance-worker-BSODPHbn.js → openmeld-maintenance-worker-Ce4ehQ-c.js} +15 -14
  79. package/dist/openmeld-maintenance-worker-Ce4ehQ-c.js.map +1 -0
  80. package/dist/{openmeld-tools-update-join-BfY0GnDs.js → openmeld-tools-update-join-D24llJ9L.js} +4 -4
  81. package/dist/{openmeld-tools-update-join-BfY0GnDs.js.map → openmeld-tools-update-join-D24llJ9L.js.map} +1 -1
  82. package/dist/{openmeld-tools-update-process-frame-B-XB4dmO.js → openmeld-tools-update-process-frame-BtFKp70p.js} +2 -2
  83. package/dist/{openmeld-tools-update-process-frame-B-XB4dmO.js.map → openmeld-tools-update-process-frame-BtFKp70p.js.map} +1 -1
  84. package/dist/{openmeld-tools-update-process-frame-j-RXwFsK.js → openmeld-tools-update-process-frame-DbEZ3fEh.js} +1 -1
  85. package/dist/openmeld.js +9 -5
  86. package/dist/openmeld.js.map +1 -1
  87. package/dist/{prepare-provider-runtime-CWZcuMF6.js → prepare-provider-runtime-MB-BxOgt.js} +3342 -1327
  88. package/dist/prepare-provider-runtime-MB-BxOgt.js.map +1 -0
  89. package/dist/{prepare-session-executor-CkDxstsf.js → prepare-session-executor-zvSZ6jqy.js} +29 -28
  90. package/dist/prepare-session-executor-zvSZ6jqy.js.map +1 -0
  91. package/dist/{presenter-BcxiQyJg.js → presenter-MJ5YgsOT.js} +3 -13
  92. package/dist/presenter-MJ5YgsOT.js.map +1 -0
  93. package/dist/{process-channel-BQwtOlRc.js → process-channel-CgbduFCz.js} +2 -2
  94. package/dist/{process-channel-BQwtOlRc.js.map → process-channel-CgbduFCz.js.map} +1 -1
  95. package/dist/process-environment-BWSFeUu6.js +49 -0
  96. package/dist/process-environment-BWSFeUu6.js.map +1 -0
  97. package/dist/process-identity-BQLdaZdB.js +190 -0
  98. package/dist/process-identity-BQLdaZdB.js.map +1 -0
  99. package/dist/process-launch-B0pHlkV_.js +173 -0
  100. package/dist/process-launch-B0pHlkV_.js.map +1 -0
  101. package/dist/{published-production-safety-dp-fOmmB.js → published-production-safety-C40hKrBA.js} +2 -2
  102. package/dist/{published-production-safety-dp-fOmmB.js.map → published-production-safety-C40hKrBA.js.map} +1 -1
  103. package/dist/{runtime-BYaFkkLK.js → runtime-D6jItuQ-.js} +155 -702
  104. package/dist/runtime-D6jItuQ-.js.map +1 -0
  105. package/dist/{runtime-agent-controller-reporting-submission-BUUub9_1.js → runtime-agent-controller-reporting-submission-D9ysbi7R.js} +9 -9
  106. package/dist/{runtime-agent-controller-reporting-submission-BUUub9_1.js.map → runtime-agent-controller-reporting-submission-D9ysbi7R.js.map} +1 -1
  107. package/dist/{runtime-reporting-health-state-BgwfrH7f.js → runtime-reporting-health-state-DA-_vW-n.js} +2210 -60
  108. package/dist/runtime-reporting-health-state-DA-_vW-n.js.map +1 -0
  109. package/dist/{runtime-transport-Cc_RN-PL.js → runtime-transport-YIYHSJPn.js} +99 -14
  110. package/dist/runtime-transport-YIYHSJPn.js.map +1 -0
  111. package/dist/{service-CfO38_a-.js → service-Dz2MsvGr.js} +126 -550
  112. package/dist/service-Dz2MsvGr.js.map +1 -0
  113. package/dist/{service-account-admission-Dy2W3n3_.js → service-account-admission-BfdJ-kKR.js} +18 -10
  114. package/dist/service-account-admission-BfdJ-kKR.js.map +1 -0
  115. package/dist/{service-account-authorization-DKpIpxXo.js → service-account-authorization-DZbUOD29.js} +6 -6
  116. package/dist/{service-account-authorization-DKpIpxXo.js.map → service-account-authorization-DZbUOD29.js.map} +1 -1
  117. package/dist/{service-account-control-CCPQAZzn.js → service-account-control-DCMOKXDT.js} +16 -16
  118. package/dist/service-account-control-DCMOKXDT.js.map +1 -0
  119. package/dist/{service-control-capabilities-C9UHSMPz.js → service-control-capabilities-3_bdeHXu.js} +1 -1
  120. package/dist/{service-control-capabilities-xGylBNoH.js → service-control-capabilities-Bb738e_d.js} +19 -15
  121. package/dist/service-control-capabilities-Bb738e_d.js.map +1 -0
  122. package/dist/{service-control-carrier-capability-DDNyE5cB.js → service-control-carrier-capability-gMk5gMKU.js} +11 -4
  123. package/dist/service-control-carrier-capability-gMk5gMKU.js.map +1 -0
  124. package/dist/{state-CQG3k9eh.js → state-GxF_KAM1.js} +4 -4
  125. package/dist/{state-CQG3k9eh.js.map → state-GxF_KAM1.js.map} +1 -1
  126. package/dist/{upgrade-D5FxGbh1.js → upgrade-DfJwCD5H.js} +52 -32
  127. package/dist/upgrade-DfJwCD5H.js.map +1 -0
  128. package/dist/upgrade-DgmYWeNu.js +4 -0
  129. package/dist/windows/openmeld-windows-process.exe +0 -0
  130. package/dist/windows-artifact-DJ9DKjfc.js +16 -0
  131. package/dist/windows-artifact-DJ9DKjfc.js.map +1 -0
  132. package/dist/windows-task-command-COu_6Ke3.js +74 -0
  133. package/dist/windows-task-command-COu_6Ke3.js.map +1 -0
  134. package/dist/windows-task-entry-CtRpUbiK.js +50 -0
  135. package/dist/windows-task-entry-CtRpUbiK.js.map +1 -0
  136. package/dist/{windows-user-task-Bx2yYnOM.js → windows-user-task-B8NcRg_u.js} +1 -1
  137. package/dist/{windows-user-task-CRGbKggi.js → windows-user-task-Io5QuEVR.js} +108 -51
  138. package/dist/windows-user-task-Io5QuEVR.js.map +1 -0
  139. package/package.json +12 -12
  140. package/skills/openmeld-cli/playbooks/space-ops.md +9 -3
  141. package/skills/openmeld-cli/references/commands.md +0 -1
  142. package/dist/auth-session-D8dbMpaK.js +0 -4
  143. package/dist/auth-session-nhS8jyux.js.map +0 -1
  144. package/dist/cli-binary-manifest-DiUulkp0.js.map +0 -1
  145. package/dist/cli-space-api-CQtKu9Zt.js.map +0 -1
  146. package/dist/command-Bz9x7V2T.js.map +0 -1
  147. package/dist/context-l_31Mn4X.js +0 -473
  148. package/dist/context-l_31Mn4X.js.map +0 -1
  149. package/dist/daemon-device-id-DWO9_QW6.js.map +0 -1
  150. package/dist/daemon-frame-transport-D2-tazuK.js.map +0 -1
  151. package/dist/daemon-lifecycle-journal-DyKx1xzm.js.map +0 -1
  152. package/dist/daemon-service-manager-HL4VKbIU.js.map +0 -1
  153. package/dist/daemon-service-runtime-bKt0YjC7.js.map +0 -1
  154. package/dist/daemon-service-update-coordinator-D8O1uTtu.js.map +0 -1
  155. package/dist/dist-B07ziN_u.js.map +0 -1
  156. package/dist/dist-B2EauBG6.js.map +0 -1
  157. package/dist/dist-DhWI1iyi.js +0 -4
  158. package/dist/local-components-B6SCXZf9.js.map +0 -1
  159. package/dist/lock-Bsl_ElWy.js.map +0 -1
  160. package/dist/openmeld-BQy0nMox.js.map +0 -1
  161. package/dist/openmeld-maintenance-worker-BSODPHbn.js.map +0 -1
  162. package/dist/prepare-provider-runtime-CWZcuMF6.js.map +0 -1
  163. package/dist/prepare-session-executor-CkDxstsf.js.map +0 -1
  164. package/dist/presenter-BcxiQyJg.js.map +0 -1
  165. package/dist/process-identity-CNus0e6E.js +0 -146
  166. package/dist/process-identity-CNus0e6E.js.map +0 -1
  167. package/dist/runtime-BYaFkkLK.js.map +0 -1
  168. package/dist/runtime-reporting-health-state-BgwfrH7f.js.map +0 -1
  169. package/dist/runtime-transport-Cc_RN-PL.js.map +0 -1
  170. package/dist/service-CfO38_a-.js.map +0 -1
  171. package/dist/service-account-admission-Dy2W3n3_.js.map +0 -1
  172. package/dist/service-account-control-CCPQAZzn.js.map +0 -1
  173. package/dist/service-control-capabilities-xGylBNoH.js.map +0 -1
  174. package/dist/service-control-carrier-capability-DDNyE5cB.js.map +0 -1
  175. package/dist/upgrade-D5FxGbh1.js.map +0 -1
  176. package/dist/upgrade-DhFEu0k6.js +0 -4
  177. package/dist/windows-user-task-CRGbKggi.js.map +0 -1
@@ -1,33 +1,31 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { d as runWithHeldLock, lt as resolveOpenMeldRootDir, s as releaseLock, t as acquireLock } from "./lock-Bsl_ElWy.js";
4
- import { Pi as COMPUTER_FILE_ACCESS_OWNER_CANCELLED_REASON_CODE, Sr as SPACE_DISPATCH_TRACE_PROMPT_PREVIEW_MAX_CHARS, Tt as buildSpaceAttachmentDownloadPath, Xt as createOrganizationSkillsApi, sn as createSpaceApi } from "./dist-B07ziN_u.js";
3
+ import { ut as resolveOpenMeldRootDir } from "./lock-iue1J2xy.js";
4
+ import { Pi as COMPUTER_FILE_ACCESS_OWNER_CANCELLED_REASON_CODE, Sr as SPACE_DISPATCH_TRACE_PROMPT_PREVIEW_MAX_CHARS, Tt as buildSpaceAttachmentDownloadPath, Zt as createOrganizationSkillsApi, cn as createSpaceApi } from "./dist-BeJcIdCZ.js";
5
5
  import { b as normalizeKnownBuiltinAgentControllerId, d as resolveBuiltinAgentControllerConversationKind, l as buildAgentControllerConversationRef } from "./controller-contract-DAOCaefz.js";
6
- import { $ as canManageRegistryAgentSkillTargets, $t as mergeOpenClawGatewayVisibility, An as runRuntimeTask, Bn as upsertConversationExecutionState, Bt as createMutableRouteCatalogState, Cn as verifyCodexAppServerThread, E as resolveProfileWorkspaceRuntime, Fn as loadLedgerState, Gt as syncRuntimeEventToInflightTaskControlRegistry, In as removeConversationExecutionState, Kt as SPACE_ACTION_CONTEXT_GUIDANCE_LINES, L as manageAgentRegistrationInstallation, Ln as resolveConversationExecutionStateByLookupKey, Nn as appendLedgerHistoryEntry, Pn as commitResolvedAgentContext, Qn as DEFAULT_TASK_LIFECYCLE_HEARTBEAT_INTERVAL_MS, Qt as createPendingAgentInteractionRegistry, Rn as seedLegacyAgentContext, Sn as resolveCodexAppServerCompletedTurn, U as setAgentRegistrationEnabled, Un as assertLegacyAgentContextAssociation, Vn as withLedgerStateTransaction, Vt as createRouteCatalogFromMutableState, Wn as buildAgentContextLookupKey, Wt as normalizeDispatchThreadAction, Xn as listAgentControllerSupervisedProcessIds, Yt as createSerialAgentInteractionCallback, Zt as normalizeDispatchPostMessageAction, _ as loadDaemonRouteCatalog, a as buildOpenClawSpaceSessionKey, an as resolveDispatchContinuityObservation, b as resolveLocalController, bn as resolveInstalledCodexLaunchCandidates, cn as resolveLatestScopedConversationExecutionState, dn as createLocalAdapterEntries, en as createLocalTaskInterruptSender, ft as listProjectBindings, g as writeDaemonRouteCatalogCache, h as readDaemonRouteCatalogCache, in as resolveDispatchQueueLogMeta, jn as buildRuntimeWorkspaceFingerprint, kn as DaemonServiceRunError, kt as resolveRegistryRuntimeAdapterContractByAgentControllerRef, mn as resolveInstalledOpenCodeLaunchCandidates, nn as createLocalExecutionSlots, o as normalizeOpenClawSpaceIdPrefix, on as resolveCompatibleAgentContextMatch, pn as forkOpenCodeServerSession, qt as SPACE_ACTION_TARGET_GUIDANCE_LINES, rn as createInflightTaskControlRegistry, rt as resolveBuiltinAgentControllerDefinition, s as slugifyOpenClawNamePart, sn as resolveCompatibleConversationExecutionState, t as prepareProviderRuntime, tt as resolveSkillsAgentRegistry, un as createLocalAdapterContainer, v as buildRuntimeRouteTargets, w as resolveCurrentEffectiveProfileWorkingFolderRuntime, x as resolveLocalRuntimeControllerSupport, xn as forkCodexAppServerThread, y as readLocalEnabledControllers, yn as resolveCodexTimeoutMs, z as reconcileNewRunnableBuiltinAgentRegistrations, zn as settleInflightTask } from "./prepare-provider-runtime-CWZcuMF6.js";
7
- import { D as runtimeTransportLocalAgentControlManageInstallationFramePayloadSchema, E as runtimeTransportLocalAgentControlInterruptFramePayloadSchema, Jn as executionContextAssignmentSchema, L as runtimeTransportResumeControllerConversationFramePayloadSchema, R as runtimeTransportResumeControllerConversationResultFramePayloadSchema, T as runtimeTransportLocalAgentControlForkSessionFramePayloadSchema, Wt as spaceWorkSelectionSchema, Xn as executionContextTaskSchema, Y as openMeldDaemonTaskResultPayloadSchema, _r as runtimeTransportDeliveryExecutionIdentitySchema, b as runtimeTransportForkAgentSessionResultSchema, c as runtimeTransportDeliverDispatchRequestSchema, d as runtimeTransportDispatchInteractionResponseFramePayloadSchema, f as runtimeTransportDispatchLifecycleAcknowledgementSchema, gr as runtimeCoordinatorExecutionTokenEnvelopeSchema, ir as AGENT_INTERACTION_DEFAULT_TIMEOUT_MS, jr as localAgentReasoningPreferencesSchema, k as runtimeTransportLocalAgentControlSetEnabledFramePayloadSchema, kr as LOCAL_AGENT_REASONING_MAX_CHARS, l as runtimeTransportDispatchInteractionDeliveredRequestSchema, or as agentInteractionRequestSchema, p as runtimeTransportDispatchLifecycleRequestSchema, w as runtimeTransportLocalAgentControlCancelFramePayloadSchema } from "./runtime-transport-Cc_RN-PL.js";
8
- import { d as getAuthSessionState } from "./auth-session-nhS8jyux.js";
9
- import { n as OPENMELD_DAEMON_CANCEL_WITHDRAWN_BEFORE_START_REASON_CODE, t as OPENMELD_DAEMON_CANCEL_STOP_REQUESTED_AFTER_START_REASON_CODE } from "./control-plane-e3W6PD2M.js";
10
- import { f as withSkillsInstallLock, h as OFFICIAL_CLI_SKILL_URL, r as ensureLocalSkills, t as resolveSkillInstallStateForTarget } from "./state-CQG3k9eh.js";
11
- import { C as defaultManagedIntegrationPaths, a as fetchSpaceUpdates, c as downloadWorkingCopyFile, f as discoverLocalAgentSessionProviders, i as recordRuntimeReportingSuccess, l as materializeOrganizationSkillRelease, n as recordRuntimeReportingFailure, o as createSpaceWorkingCopies, p as recordOpenMeldCreatedLocalAgentSession, r as recordRuntimeReportingNotApplicable, s as createLedgerIo, u as startLocalAgentActivitySyncLoop, w as installAgentActivityIntegrations, y as registerAgentActivityRoute } from "./runtime-reporting-health-state-BgwfrH7f.js";
12
- import { S as CONTROLLED_SHUTDOWN_RESULT_ACK_TIMEOUT_MS, _ as toErrorMessage$2, n as ensureDaemonRuntimePaths, s as emitRunLine, t as buildLedgerPaths, u as normalizeOptionalText$3, v as warnDaemonEvent } from "./daemon-device-id-DWO9_QW6.js";
13
- import { i as SPACE_PERSONAL_CONTRIBUTION_RULE, n as SPACE_COLLABORATION_CONTEXT_RULE, v as resolvePublicAgentFailureReason, y as resolveSpacePublicationRequirement } from "./dist-B2EauBG6.js";
14
- import { $ as emitDaemonDispatchJournalEvent, $t as getSpaceAccessRequestContext, B as enqueueDispatchResultOutboxRecord, G as resolveDispatchResultPayload, H as listDispatchResultOutboxPendingAcknowledgementKeys, Ht as buildSpaceRoundSignalPublication, J as sendDispatchPreviewEndFrame, K as sendDispatchInteractionRequestFrame, Kt as createDispatchContinuationSpaceAccessContext, O as consumeArmedAgentControllerInterfaceReprobe, Q as sendDispatchToolActivityFrame, Qt as getSpaceAccessPassword, U as waitForDispatchResultOutboxAcknowledgement, V as flushDispatchResultOutbox, W as buildFailedTaskResultPayload, X as sendDispatchReasoningFrame, Y as sendDispatchPreviewFrame, Z as sendDispatchRuntimeEvidenceFrame, a as resolveRegisterResponseFrame, at as isSameOrDescendantPath, ct as buildDispatchPromptPlan, dt as resolveBootstrapSpaceOwnerProfileId, f as resolveOpenCodeDatabasePath, ft as resolveBootstrapTargetProfileContext, i as resolveHeartbeatResponseFrame, lt as buildDispatchSessionTitle, mn as DISPATCH_SPACE_ACTION_CLI_FALLBACK_COMMAND, nn as isWakeClosingSystemNoticeType, nt as readComputerFileAccessPolicy, o as sendDaemonFrame, ot as buildDispatchBootstrapTemplateFacts, pt as resolveDispatchMentionSourceContext, q as sendDispatchLifecycleFrame, r as parseDaemonFrame, rn as listSpaceMemberDirectorySendTargets, rt as resolveComputerFileAccessStorePath, st as buildDispatchCorrelation, t as emitDaemonErrorFrame, u as readOpenCodeSessionRows, ut as parseDispatchTask, z as acknowledgeDispatchResultOutboxRecord } from "./daemon-frame-transport-D2-tazuK.js";
15
- import { a as serviceExecutionHostCatalogSchema, i as SERVICE_EXECUTION_HOST_PROTOCOL, t as ExecutionHostError } from "./channel-ggx0o_aG.js";
16
- import { a as resolveBaseUrl, f as getConfiguredDaemonDispatchLimits, g as getConfiguredSkillsConfig } from "./base-url-D7uE_xTo.js";
17
- import { t as emitDaemonLifecycleEvent } from "./daemon-lifecycle-journal-DyKx1xzm.js";
18
- import { a as buildOpenMeldProfileIdentityRequestHeadersWithAuth, f as buildOpenMeldRequestContextFromProfileIdentity, n as fetchSpaceRequestWithTimeout, t as createCliApiClientFoundation } from "./api-client-foundation-DnJ_JYli.js";
19
- import { a as submitRuntimeProviderConversationProofs, f as recordRuntimeProviderUsageLimits, i as submitRuntimeAgentControllerReports, l as resolveLocalAgentControllerReportDecision, o as collectLocalAgentControllerInventory, t as notifyRuntimeReportingAttemptObserver, u as probeAgentControllerUsageObservationAuth } from "./runtime-agent-controller-reporting-submission-BUUub9_1.js";
20
- import { t as installSkillsToTargets } from "./installer-D2bWZT88.js";
21
- import { b as supersedeDispatchSpaceActionRecordForReconsideration, f as buildDispatchOwnedRuntimeEnv, g as createDispatchSpaceActionContext, h as OPENMELD_SPACE_ACTION_CONTEXT_PATH_ENV, n as fetchSpaceMeta, t as createCliSpaceApi, y as readDispatchSpaceActionRecord } from "./cli-space-api-CQtKu9Zt.js";
6
+ import { $ as canManageRegistryAgentSkillTargets, $n as DISPATCH_SPACE_ACTION_DELIVERY_ONLY_ENV, $t as mergeOpenClawGatewayVisibility, An as runRuntimeTask, Bn as upsertConversationExecutionState, Bt as createMutableRouteCatalogState, Cn as verifyCodexAppServerThread, E as resolveProfileWorkspaceRuntime, Fn as loadLedgerState, Gt as syncRuntimeEventToInflightTaskControlRegistry, In as removeConversationExecutionState, Kt as SPACE_ACTION_CONTEXT_GUIDANCE_LINES, L as manageAgentRegistrationInstallation, Ln as resolveConversationExecutionStateByLookupKey, Nn as appendLedgerHistoryEntry, Pn as commitResolvedAgentContext, Qt as createPendingAgentInteractionRegistry, Rn as seedLegacyAgentContext, Sn as resolveCodexAppServerCompletedTurn, U as setAgentRegistrationEnabled, Un as assertLegacyAgentContextAssociation, Vn as withLedgerStateTransaction, Vt as createRouteCatalogFromMutableState, Wn as buildAgentContextLookupKey, Wt as normalizeDispatchThreadAction, Yt as createSerialAgentInteractionCallback, Zt as normalizeDispatchPostMessageAction, _ as loadDaemonRouteCatalog, a as buildOpenClawSpaceSessionKey, an as resolveDispatchContinuityObservation, b as resolveLocalController, bn as resolveInstalledCodexLaunchCandidates, cn as resolveLatestScopedConversationExecutionState, dn as createLocalAdapterEntries, en as createLocalTaskInterruptSender, ft as listProjectBindings, g as writeDaemonRouteCatalogCache, h as readDaemonRouteCatalogCache, in as resolveDispatchQueueLogMeta, jn as buildRuntimeWorkspaceFingerprint, kn as DaemonServiceRunError, kt as resolveRegistryRuntimeAdapterContractByAgentControllerRef, mn as resolveInstalledOpenCodeLaunchCandidates, nn as createLocalExecutionSlots, o as normalizeOpenClawSpaceIdPrefix, on as resolveCompatibleAgentContextMatch, pn as forkOpenCodeServerSession, qt as SPACE_ACTION_TARGET_GUIDANCE_LINES, rn as createInflightTaskControlRegistry, rt as resolveBuiltinAgentControllerDefinition, s as slugifyOpenClawNamePart, sn as resolveCompatibleConversationExecutionState, t as prepareProviderRuntime, tr as DEFAULT_TASK_LIFECYCLE_HEARTBEAT_INTERVAL_MS, tt as resolveSkillsAgentRegistry, un as createLocalAdapterContainer, v as buildRuntimeRouteTargets, w as resolveCurrentEffectiveProfileWorkingFolderRuntime, x as resolveLocalRuntimeControllerSupport, xn as forkCodexAppServerThread, y as readLocalEnabledControllers, yn as resolveCodexTimeoutMs, z as reconcileNewRunnableBuiltinAgentRegistrations, zn as settleInflightTask } from "./prepare-provider-runtime-MB-BxOgt.js";
7
+ import { A as runtimeTransportLocalAgentControlSetEnabledFramePayloadSchema, D as runtimeTransportLocalAgentControlInterruptFramePayloadSchema, E as runtimeTransportLocalAgentControlForkSessionFramePayloadSchema, Gt as spaceWorkSelectionSchema, Nr as localAgentReasoningPreferencesSchema, O as runtimeTransportLocalAgentControlManageInstallationFramePayloadSchema, R as runtimeTransportResumeControllerConversationFramePayloadSchema, T as runtimeTransportLocalAgentControlCancelFramePayloadSchema, X as openMeldDaemonTaskResultPayloadSchema, ar as AGENT_INTERACTION_DEFAULT_TIMEOUT_MS, f as runtimeTransportDispatchInteractionResponseFramePayloadSchema, jr as LOCAL_AGENT_REASONING_MAX_CHARS, l as runtimeTransportDeliverDispatchRequestSchema, m as runtimeTransportDispatchLifecycleRequestSchema, p as runtimeTransportDispatchLifecycleAcknowledgementSchema, sr as agentInteractionRequestSchema, u as runtimeTransportDispatchInteractionDeliveredRequestSchema, vr as runtimeCoordinatorExecutionTokenEnvelopeSchema, x as runtimeTransportForkAgentSessionResultSchema, yr as runtimeTransportDeliveryExecutionIdentitySchema, z as runtimeTransportResumeControllerConversationResultFramePayloadSchema } from "./runtime-transport-YIYHSJPn.js";
8
+ import { d as getAuthSessionState } from "./auth-session-uEk_Tx6T.js";
9
+ import { n as OPENMELD_DAEMON_CANCEL_WITHDRAWN_BEFORE_START_REASON_CODE, t as OPENMELD_DAEMON_CANCEL_STOP_REQUESTED_AFTER_START_REASON_CODE } from "./control-plane-rTE2rHZ5.js";
10
+ import { f as withSkillsInstallLock, h as OFFICIAL_CLI_SKILL_URL, r as ensureLocalSkills, t as resolveSkillInstallStateForTarget } from "./state-GxF_KAM1.js";
11
+ import { $ as emitDaemonDispatchJournalEvent, $t as getSpaceAccessRequestContext, B as enqueueDispatchResultOutboxRecord, G as resolveDispatchResultPayload, H as listDispatchResultOutboxPendingAcknowledgementKeys, Ht as buildSpaceRoundSignalPublication, J as sendDispatchPreviewEndFrame, K as sendDispatchInteractionRequestFrame, Kt as createDispatchContinuationSpaceAccessContext, O as consumeArmedAgentControllerInterfaceReprobe, Q as sendDispatchToolActivityFrame, Qt as getSpaceAccessPassword, U as waitForDispatchResultOutboxAcknowledgement, V as flushDispatchResultOutbox, W as buildFailedTaskResultPayload, X as sendDispatchReasoningFrame, Y as sendDispatchPreviewFrame, Z as sendDispatchRuntimeEvidenceFrame, a as resolveRegisterResponseFrame, at as isSameOrDescendantPath, ct as buildDispatchPromptPlan, dt as resolveBootstrapSpaceOwnerProfileId, f as resolveOpenCodeDatabasePath, ft as resolveBootstrapTargetProfileContext, i as resolveHeartbeatResponseFrame, lt as buildDispatchSessionTitle, mn as DISPATCH_SPACE_ACTION_CLI_FALLBACK_COMMAND, nn as isWakeClosingSystemNoticeType, nt as readComputerFileAccessPolicy, o as sendDaemonFrame, ot as buildDispatchBootstrapTemplateFacts, pt as resolveDispatchMentionSourceContext, q as sendDispatchLifecycleFrame, r as parseDaemonFrame, rn as listSpaceMemberDirectorySendTargets, rt as resolveComputerFileAccessStorePath, st as buildDispatchCorrelation, t as emitDaemonErrorFrame, u as readOpenCodeSessionRows, ut as parseDispatchTask, z as acknowledgeDispatchResultOutboxRecord } from "./daemon-frame-transport-WiB73yhT.js";
12
+ import { C as startLocalAgentActivitySyncLoop, E as recordOpenMeldCreatedLocalAgentSession, I as defaultManagedIntegrationPaths, L as installAgentActivityIntegrations, M as registerAgentActivityRoute, S as prepareClaudeProjectContainer, T as discoverLocalAgentSessionProviders, _ as markExecutionContextWorkspaceInUse, a as fetchSpaceUpdates, b as releaseExecutionContextWorkspace, c as materializeOrganizationSkillRelease, i as recordRuntimeReportingSuccess, l as createDispatchSpaceTools, n as recordRuntimeReportingFailure, o as createSpaceWorkingCopies, r as recordRuntimeReportingNotApplicable, s as downloadWorkingCopyFile, v as prepareExecutionContextWorkspace, x as createLedgerIo, y as readExecutionContextWorkspace } from "./runtime-reporting-health-state-DA-_vW-n.js";
13
+ import { S as CONTROLLED_SHUTDOWN_RESULT_ACK_TIMEOUT_MS, _ as toErrorMessage$2, n as ensureDaemonRuntimePaths, s as emitRunLine, t as buildLedgerPaths, u as normalizeOptionalText$3, v as warnDaemonEvent } from "./daemon-device-id-B1Af2Zmn.js";
14
+ import { _ as resolvePublicAgentFailureReason, n as SPACE_COLLABORATION_CONTEXT_RULE, r as SPACE_PERSONAL_CONTRIBUTION_RULE, v as resolveSpacePublicationRequirement } from "./dist-YbTZ-Y-2.js";
15
+ import { a as serviceExecutionHostCatalogSchema, i as SERVICE_EXECUTION_HOST_PROTOCOL, t as ExecutionHostError } from "./channel-B2fD2_be.js";
16
+ import { a as resolveBaseUrl, f as getConfiguredDaemonDispatchLimits, g as getConfiguredSkillsConfig } from "./base-url-DvjOkKPs.js";
17
+ import { t as emitDaemonLifecycleEvent } from "./daemon-lifecycle-journal-CDZLWgMj.js";
18
+ import { a as buildOpenMeldProfileIdentityRequestHeadersWithAuth, f as buildOpenMeldRequestContextFromProfileIdentity, n as fetchSpaceRequestWithTimeout, t as createCliApiClientFoundation } from "./api-client-foundation-DpVwrgh-.js";
19
+ import { a as submitRuntimeProviderConversationProofs, f as recordRuntimeProviderUsageLimits, i as submitRuntimeAgentControllerReports, l as resolveLocalAgentControllerReportDecision, o as collectLocalAgentControllerInventory, t as notifyRuntimeReportingAttemptObserver, u as probeAgentControllerUsageObservationAuth } from "./runtime-agent-controller-reporting-submission-D9ysbi7R.js";
20
+ import { t as installSkillsToTargets } from "./installer-054NLJg6.js";
21
+ import { C as supersedeDispatchSpaceActionRecordForReconsideration, S as readDispatchSpaceActionRecord, f as createCliSpaceApi, m as buildDispatchOwnedRuntimeEnv, t as fetchSpaceMeta, v as OPENMELD_SPACE_ACTION_CONTEXT_PATH_ENV, y as createDispatchSpaceActionContext } from "./meta-api-B1k3mwHN.js";
22
22
  import { createHash, randomUUID } from "node:crypto";
23
23
  import { homedir } from "node:os";
24
- import { basename, dirname, extname, isAbsolute, join, relative, resolve, sep } from "node:path";
25
- import { lstat, mkdir, open, readFile, readdir, readlink, realpath, rename, rm, writeFile } from "node:fs/promises";
24
+ import { basename, dirname, extname, join } from "node:path";
25
+ import { lstat, mkdir, readFile, realpath, rename, writeFile } from "node:fs/promises";
26
26
  import { z } from "zod/v4";
27
27
  import { mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
28
- import { execFile } from "node:child_process";
29
28
  import { setTimeout as setTimeout$1 } from "node:timers/promises";
30
- import { promisify } from "node:util";
31
29
  import { forkSession, getSessionInfo, getSessionMessages } from "@anthropic-ai/claude-agent-sdk";
32
30
  import { performance } from "node:perf_hooks";
33
31
  //#region ../../packages/schemas/dist/working-folder-recovery.js
@@ -414,10 +412,10 @@ async function resolveWorkingFolderRecovery(input) {
414
412
  selectedFolderLabel: basename(selectedFolder)
415
413
  }));
416
414
  const choice = response.kind === "question" && response.answers.length === 1 && response.answers[0]?.questionId === "working_folder_recovery" && response.answers[0].values.length === 1 ? response.answers[0].values[0] : null;
417
- if (choice === "leave_task") throw failure$1(WORKING_FOLDER_RECOVERY_DECLINED, "The Computer owner stopped this task before the Agent started. The previous conversation is saved.");
418
- if (choice !== "start_new_conversation" && !(choice === "use_previous_folder" && previousFolderAllowed)) throw failure$1("context.workspace_recovery_unanswered", "This task did not start because no folder choice was confirmed. Send it again when you’re ready.");
415
+ if (choice === "leave_task") throw failure(WORKING_FOLDER_RECOVERY_DECLINED, "The Computer owner stopped this task before the Agent started. The previous conversation is saved.");
416
+ if (choice !== "start_new_conversation" && !(choice === "use_previous_folder" && previousFolderAllowed)) throw failure("context.workspace_recovery_unanswered", "This task did not start because no folder choice was confirmed. Send it again when you’re ready.");
419
417
  const latest = await inspect();
420
- if (latest.sessionId !== session.sessionId || latest.directory !== session.directory || await realpath(input.workingDirectory).catch(() => null) !== selectedFolder || previousFolder && await realpath(session.directory).catch(() => null) !== previousFolder) throw failure$1("context.workspace_recovery_changed", "The conversation or folder changed while waiting. Send this task again to review the current choices.");
418
+ if (latest.sessionId !== session.sessionId || latest.directory !== session.directory || await realpath(input.workingDirectory).catch(() => null) !== selectedFolder || previousFolder && await realpath(session.directory).catch(() => null) !== previousFolder) throw failure("context.workspace_recovery_changed", "The conversation or folder changed while waiting. Send this task again to review the current choices.");
421
419
  return {
422
420
  workingDirectory: choice === "use_previous_folder" && previousFolder ? previousFolder : selectedFolder,
423
421
  startNewConversation: choice === "start_new_conversation"
@@ -430,7 +428,7 @@ function resolveRecoveredLedgerConversation(input) {
430
428
  currentExecutionState: null
431
429
  } : input;
432
430
  }
433
- function failure$1(code, message, cause) {
431
+ function failure(code, message, cause) {
434
432
  const error = new DaemonServiceRunError({
435
433
  code,
436
434
  message
@@ -447,9 +445,9 @@ async function inspectRetainedOpenCodeSession(nativeSessionId) {
447
445
  sessionId: nativeSessionId
448
446
  };
449
447
  } catch (cause) {
450
- throw failure$1("context.workspace_verification_unavailable", "OpenMeld could not read this conversation’s folder. Open the conversation in OpenCode, then try this task again.", cause);
448
+ throw failure("context.workspace_verification_unavailable", "OpenMeld could not read this conversation’s folder. Open the conversation in OpenCode, then try this task again.", cause);
451
449
  }
452
- throw failure$1("context.workspace_verification_unavailable", "OpenMeld could not read this conversation’s folder. Open the conversation in OpenCode, then try this task again.");
450
+ throw failure("context.workspace_verification_unavailable", "OpenMeld could not read this conversation’s folder. Open the conversation in OpenCode, then try this task again.");
453
451
  }
454
452
  //#endregion
455
453
  //#region src/local-service/file-access/computer-file-access-prompt.ts
@@ -1515,11 +1513,7 @@ function buildResultDispatchJournalMetadata(payload) {
1515
1513
  //#endregion
1516
1514
  //#region src/local-service/dispatch/execute-dispatch-structured-action-repair.ts
1517
1515
  function resolveStructuredActionRequirementFailure$1(input) {
1518
- if (input.resolution.parseError) return {
1519
- failureReason: input.resolution.parseError,
1520
- kind: "repair"
1521
- };
1522
- if (!(input.requiresStructuredSpaceAction && !input.resolution.action)) return null;
1516
+ if (!(input.resolution.parseError || input.requiresStructuredSpaceAction && !input.resolution.action)) return null;
1523
1517
  const payload = input.runtimeResult.resultPayload;
1524
1518
  if (payload.status === "failed") return {
1525
1519
  failureReason: resolvePublicAgentFailureReason({
@@ -1530,7 +1524,7 @@ function resolveStructuredActionRequirementFailure$1(input) {
1530
1524
  kind: "preserve_runtime_failure"
1531
1525
  };
1532
1526
  return {
1533
- failureReason: "A valid OpenMeld Space action is required in collaboration mode.",
1527
+ failureReason: input.resolution.parseError ?? "A valid OpenMeld Space action is required in collaboration mode.",
1534
1528
  kind: "repair"
1535
1529
  };
1536
1530
  }
@@ -1545,19 +1539,22 @@ function resolveStructuredActionOutputFallback(input) {
1545
1539
  }
1546
1540
  }
1547
1541
  function buildStructuredActionRepairPrompt$1(input) {
1548
- const previousOutput = buildBoundedRepairOutputPreview(input.previousOutput);
1542
+ const previousOutput = normalizeOptionalText$3(input.previousOutput);
1549
1543
  const publicationRequirement = resolveSpacePublicationRequirement(input.spaceContractSnapshot);
1550
1544
  return [
1551
1545
  `OpenMeld delivery repair: ${input.parseError}`,
1552
1546
  ...previousOutput ? [
1553
- "Your previous final answer was:",
1547
+ "Previous private output, for context only (not authorization to publish it):",
1554
1548
  "```text",
1555
1549
  previousOutput,
1556
1550
  "```"
1557
1551
  ] : [],
1558
1552
  "Do not redo the user's work or change the intended public outcome.",
1559
- "Never publish a shell, CLI, MCP, or transport failure message as the user's normal Space reply.",
1560
- "If the previous turn tried an action and that transport failed, retry the same intended action and message through the dispatch-scoped tool.",
1553
+ "This invocation is delivery-only: do not inspect or edit code, run commands, call business tools, or repeat the user's task. No shell, CLI, Skill research, or knowledge of OpenMeld internals is needed.",
1554
+ "If an earlier call reported an unknown outcome, use read_receipt first. Recover an existing record; do not replace it. If the record is invalid or cannot be verified, stop rather than resend.",
1555
+ "Only a positively rejected input may be corrected and retried. Explicit denials, cancellation and expired authority remain in force; do not change transports to bypass them.",
1556
+ "Use the exact tool names and input schemas in this invocation's catalog. reply takes message (the explicit public text), with optional files and recipient IDs; stay_silent takes reason; read_receipt takes no arguments.",
1557
+ "Author a deliberate public reply when the task has an answer, a known limitation, or a request for help. Do not turn private analysis or delivery-infrastructure logs into a public answer.",
1561
1558
  ...SPACE_ACTION_CONTEXT_GUIDANCE_LINES,
1562
1559
  "Your answer text never selects an OpenMeld Space action.",
1563
1560
  "Call exactly one dispatch-scoped OpenMeld Space Action tool now.",
@@ -1566,29 +1563,9 @@ function buildStructuredActionRepairPrompt$1(input) {
1566
1563
  ...normalizeOptionalText$3(input.currentReplyToSignalId) ? [`post_message.messageEnvelope.replyToSignalId must match the current dispatch reply target: ${normalizeOptionalText$3(input.currentReplyToSignalId)}.`] : [],
1567
1564
  ...publicationRequirement.actionGuidanceLines,
1568
1565
  ...buildStructuredActionRepairSendTargetReferenceLines(input.sendTargetReferenceLines),
1569
- "Use the official `openmeld-cli` skill for future OpenMeld work.",
1570
- ...buildStructuredActionRepairCompletionLines({ publicationRequirement })
1571
- ].join("\n");
1572
- }
1573
- function buildStructuredActionRepairCompletionLines(input) {
1574
- return [
1575
- buildStructuredActionRepairPrimaryCommandLine(input),
1576
- "If neither the tool nor the fallback command can record the action, stop. Do not print JSON or prose as a substitute.",
1566
+ "If the permitted tool cannot record the action, stop. Do not run a fallback CLI or print JSON/prose as a substitute. A native structured-output carrier may request an explicit public action through its supplied schema instead.",
1577
1567
  "Do not finish with an explanation of what you will do."
1578
- ];
1579
- }
1580
- const REPAIR_OUTPUT_PREVIEW_MAX_CHARS = 1200;
1581
- function buildBoundedRepairOutputPreview(value) {
1582
- const normalized = normalizeOptionalText$3(value);
1583
- if (!normalized) return null;
1584
- if (normalized.length <= REPAIR_OUTPUT_PREVIEW_MAX_CHARS) return normalized;
1585
- return `${normalized.slice(0, REPAIR_OUTPUT_PREVIEW_MAX_CHARS).trimEnd()}\n[truncated; reuse the complete answer already in this conversation]`;
1586
- }
1587
- function buildStructuredActionRepairPrimaryCommandLine(input) {
1588
- if (input.publicationRequirement.allowedActions.includes("post_message")) return `For a normal reply, call the dispatch-scoped OpenMeld Space Action \`reply\` tool with the corrected public message. If that tool is unavailable, run the fallback CLI command \`${DISPATCH_SPACE_ACTION_CLI_FALLBACK_COMMAND} space action reply "corrected public message"\` and wait for it to finish.`;
1589
- if (input.publicationRequirement.allowedActions.includes("post_status")) return `For a final status, call the dispatch-scoped OpenMeld Space Action \`status\` tool with a final-safe status and short update. If that tool is unavailable, run the fallback CLI command \`${DISPATCH_SPACE_ACTION_CLI_FALLBACK_COMMAND} space action status done "short completion update"\` and wait for it to finish.`;
1590
- if (input.publicationRequirement.allowedActions.includes("stay_silent")) return `If no public reply is needed, call the dispatch-scoped OpenMeld Space Action \`stay_silent\` tool with your reason. If that tool is unavailable, run the fallback CLI command \`${DISPATCH_SPACE_ACTION_CLI_FALLBACK_COMMAND} space action silent --reason "reason"\` and wait for it to finish.`;
1591
- return "No permitted OpenMeld Space action is available. Do not invent one in answer text.";
1568
+ ].join("\n");
1592
1569
  }
1593
1570
  function buildStructuredActionRepairSendTargetReferenceLines(sendTargetReferenceLines) {
1594
1571
  if (!(sendTargetReferenceLines && sendTargetReferenceLines.length > 0)) return [];
@@ -1879,583 +1856,6 @@ function stableJson$1(value) {
1879
1856
  return JSON.stringify(value) ?? "null";
1880
1857
  }
1881
1858
  //#endregion
1882
- //#region src/local-service/dispatch/execution-context-workspace.ts
1883
- const execFileAsync = promisify(execFile);
1884
- const syncDirectory = createLedgerIo().syncPath;
1885
- const COMMIT_PATTERN = /^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u;
1886
- const manifestSchema = z.strictObject({
1887
- version: z.union([z.literal(1), z.literal(2)]),
1888
- identity: executionContextAssignmentSchema,
1889
- sourceWorkingDirectory: z.string().nullable(),
1890
- baseCommit: z.string().regex(COMMIT_PATTERN).nullable(),
1891
- boundaryRoot: z.string(),
1892
- workingDirectory: z.string(),
1893
- status: z.enum([
1894
- "preparing",
1895
- "restoring",
1896
- "completed",
1897
- "in_use",
1898
- "retiring",
1899
- "released"
1900
- ]),
1901
- pristineFingerprint: z.string().regex(/^[a-f0-9]{64}$/u).optional(),
1902
- copiedUncommittedFiles: z.literal(false),
1903
- processSupervisionId: z.uuid().optional(),
1904
- retirement: z.strictObject({
1905
- path: z.string(),
1906
- pristineFingerprint: z.string().regex(/^[a-f0-9]{64}$/u)
1907
- }).optional()
1908
- }).refine((manifest) => manifest.version === 2 || (manifest.status === "preparing" || manifest.status === "completed") && !manifest.pristineFingerprint && !manifest.processSupervisionId && !manifest.retirement).refine((manifest) => manifest.identity.access === "space_context" ? manifest.sourceWorkingDirectory === null && manifest.baseCommit === null : manifest.sourceWorkingDirectory !== null && isAbsolute(manifest.sourceWorkingDirectory) && manifest.baseCommit !== null && manifest.identity.workspace === "isolated");
1909
- async function prepareExecutionContextWorkspace(input) {
1910
- const parsed = executionContextTaskSchema.safeParse(input.context);
1911
- if (!parsed.success) throw failure("invalid_workspace_context");
1912
- const { nativeConversationId, runtimeWorkspaceFingerprint } = parsed.data;
1913
- const identity = executionContextAssignmentSchema.strip().parse(parsed.data);
1914
- const source = identity.access !== "space_context" ? await canonicalDirectory(input.currentWorkingDirectory) : null;
1915
- if (source) {
1916
- assertSourceAllowed(source, input.policy);
1917
- if (identity.workspace === "current") return {
1918
- workingDirectory: source,
1919
- boundaryRoot: source
1920
- };
1921
- }
1922
- const ledgerRoot = await ensureDirectory(input.ledgerRootPath, true);
1923
- const workspaceRoot = await ensureDirectory(join(ledgerRoot, "execution-context-workspaces"));
1924
- const recordsRoot = await ensureDirectory(join(ledgerRoot, "execution-context-workspace-records"));
1925
- const boundaryRoot = join(workspaceRoot, identity.id);
1926
- const workingDirectory = source ? join(boundaryRoot, "worktree") : boundaryRoot;
1927
- const recordPath = join(recordsRoot, `${identity.id}.json`);
1928
- return await withWorkspaceLock(ledgerRoot, identity.id, async () => {
1929
- const stored = await readManifest(recordPath);
1930
- if (stored) {
1931
- if (JSON.stringify(stored.identity) !== JSON.stringify(identity) || stored.sourceWorkingDirectory !== source || stored.boundaryRoot !== boundaryRoot || stored.workingDirectory !== workingDirectory) throw failure("workspace_identity_mismatch");
1932
- await reconcileRetainedWorkspace(stored, recordPath, Boolean(runtimeWorkspaceFingerprint || nativeConversationId), ledgerRoot);
1933
- return await verifyRetainedWorkspace(stored);
1934
- }
1935
- if (runtimeWorkspaceFingerprint || nativeConversationId) throw failure("workspace_record_missing");
1936
- if (await inspectPath(boundaryRoot)) throw failure("workspace_already_exists");
1937
- const baseCommit = source ? await resolveSourceCommit(source) : null;
1938
- const manifest = {
1939
- version: 2,
1940
- identity,
1941
- sourceWorkingDirectory: source,
1942
- baseCommit,
1943
- boundaryRoot,
1944
- workingDirectory,
1945
- status: "preparing",
1946
- copiedUncommittedFiles: false,
1947
- processSupervisionId: randomUUID()
1948
- };
1949
- await writeManifest(recordPath, manifest, "wx");
1950
- await finishWorkspacePreparation(manifest, recordPath, true);
1951
- return workspaceResult(manifest);
1952
- });
1953
- }
1954
- async function reconcileRetainedWorkspace(record, path, hasNativeIdentity, ledgerRoot) {
1955
- if (record.status === "retiring") await runWithHeldLock({
1956
- lock: await acquireWorkspaceExecutionLock(ledgerRoot, record.identity.id),
1957
- run: async () => {
1958
- if (!record.processSupervisionId || (await listAgentControllerSupervisedProcessIds({
1959
- fresh: true,
1960
- processId: null,
1961
- supervisionId: record.processSupervisionId
1962
- })).length > 0) throw failure("workspace_execution_quiescence_unconfirmed");
1963
- const reconciled = await finishWorkspaceRetirement(record, path);
1964
- if (reconciled.status === "released") await restoreReleasedWorkspace(reconciled, path);
1965
- }
1966
- });
1967
- else if (record.status === "released") await restoreReleasedWorkspace(record, path);
1968
- else if (record.status === "preparing" || record.status === "restoring") {
1969
- if (record.status === "preparing" && hasNativeIdentity) throw failure("workspace_creation_incomplete");
1970
- if (!record.processSupervisionId || (await listAgentControllerSupervisedProcessIds({
1971
- fresh: true,
1972
- processId: null,
1973
- supervisionId: record.processSupervisionId
1974
- })).length > 0) throw failure("workspace_preparation_quiescence_unconfirmed");
1975
- await finishWorkspacePreparation(record, path);
1976
- } else if (record.status === "in_use") await runWithHeldLock({
1977
- lock: await acquireWorkspaceExecutionLock(ledgerRoot, record.identity.id),
1978
- run: async () => {
1979
- if (!record.processSupervisionId || (await listAgentControllerSupervisedProcessIds({
1980
- fresh: true,
1981
- processId: null,
1982
- supervisionId: record.processSupervisionId
1983
- })).length > 0) throw failure("workspace_execution_quiescence_unconfirmed");
1984
- await verifyRetainedWorkspace(record);
1985
- await writeManifest(path, {
1986
- ...record,
1987
- status: "completed"
1988
- }, "r+");
1989
- }
1990
- });
1991
- }
1992
- async function finishWorkspacePreparation(manifest, recordPath, pristineCreation = false) {
1993
- const { boundaryRoot, workingDirectory, sourceWorkingDirectory: source, baseCommit } = manifest;
1994
- await ensureDirectory(boundaryRoot);
1995
- const repository = join(boundaryRoot, "repository.git");
1996
- if (source && baseCommit) {
1997
- if (!await inspectPath(repository)) {
1998
- if ((await readdir(boundaryRoot)).length > 0) throw failure("workspace_creation_incomplete");
1999
- await git(boundaryRoot, [
2000
- "init",
2001
- "--bare",
2002
- "--template=",
2003
- `--object-format=${baseCommit.length === 64 ? "sha256" : "sha1"}`,
2004
- repository
2005
- ], manifest.processSupervisionId);
2006
- }
2007
- await canonicalDirectory(repository);
2008
- await assertPrivateMetadata(repository);
2009
- if ((await readdir(boundaryRoot)).some((name) => name !== "repository.git" && name !== "worktree")) throw failure("workspace_creation_incomplete");
2010
- if (await inspectPath(join(repository, "objects", "info", "alternates"))) throw failure("workspace_git_metadata_changed");
2011
- if (!await inspectPath(workingDirectory)) {
2012
- await git(boundaryRoot, [
2013
- `--git-dir=${repository}`,
2014
- "fetch",
2015
- "--no-tags",
2016
- "--no-recurse-submodules",
2017
- "--depth=1",
2018
- "--no-write-fetch-head",
2019
- source,
2020
- `${baseCommit}:refs/openmeld/base`
2021
- ], manifest.processSupervisionId);
2022
- await git(boundaryRoot, [
2023
- `--git-dir=${repository}`,
2024
- "worktree",
2025
- "add",
2026
- "--detach",
2027
- workingDirectory,
2028
- baseCommit
2029
- ], manifest.processSupervisionId);
2030
- }
2031
- await verifyOwnedRepository(manifest);
2032
- await finishMissingCheckoutFiles(manifest);
2033
- if (!await isUnchangedCheckout(manifest)) throw failure("workspace_creation_incomplete");
2034
- } else if ((await readdir(boundaryRoot)).length > 0) throw failure("workspace_creation_incomplete");
2035
- await writeManifest(recordPath, {
2036
- ...manifest,
2037
- status: "completed",
2038
- pristineFingerprint: pristineCreation ? await fingerprintDirectory(boundaryRoot) : void 0
2039
- }, "r+");
2040
- }
2041
- async function readExecutionContextWorkspace(input) {
2042
- if (!executionContextAssignmentSchema.shape.id.safeParse(input.contextId).success) throw failure("invalid_workspace_context");
2043
- if (!await inspectPath(input.ledgerRootPath)) return null;
2044
- const ledgerRoot = await canonicalDirectory(input.ledgerRootPath);
2045
- const recordsRoot = join(ledgerRoot, "execution-context-workspace-records");
2046
- if (!await inspectPath(recordsRoot)) return null;
2047
- await canonicalDirectory(recordsRoot);
2048
- const manifest = await readManifest(join(recordsRoot, `${input.contextId}.json`));
2049
- if (!manifest) return null;
2050
- const boundaryRoot = join(await canonicalDirectory(join(ledgerRoot, "execution-context-workspaces")), input.contextId);
2051
- const workingDirectory = manifest.identity.access !== "space_context" ? join(boundaryRoot, "worktree") : boundaryRoot;
2052
- if (manifest.identity.id !== input.contextId || manifest.boundaryRoot !== boundaryRoot || manifest.workingDirectory !== workingDirectory) throw failure("workspace_identity_mismatch");
2053
- if (manifest.status === "released" || manifest.status === "retiring") return workspaceResult(manifest);
2054
- if (manifest.status === "preparing" || manifest.status === "restoring") throw failure("workspace_creation_incomplete");
2055
- return await verifyRetainedWorkspace(manifest);
2056
- }
2057
- async function markExecutionContextWorkspaceInUse(input) {
2058
- const context = input.context;
2059
- if (!context || context.workspace !== "isolated" || context.access === "space_context") return null;
2060
- const root = await canonicalDirectory(input.ledgerRootPath);
2061
- const lock = await acquireWorkspaceExecutionLock(root, context.id);
2062
- const processSupervisionId = randomUUID();
2063
- try {
2064
- await withWorkspaceLock(root, context.id, async () => {
2065
- await readExecutionContextWorkspace({
2066
- ledgerRootPath: root,
2067
- contextId: context.id
2068
- });
2069
- const path = join(root, "execution-context-workspace-records", `${context.id}.json`);
2070
- const record = await readManifest(path);
2071
- if (record?.status !== "completed") throw failure("workspace_execution_quiescence_unconfirmed");
2072
- await writeManifest(path, {
2073
- ...record,
2074
- status: "in_use",
2075
- processSupervisionId
2076
- }, "r+");
2077
- });
2078
- return {
2079
- lock,
2080
- processSupervisionId
2081
- };
2082
- } catch (error) {
2083
- await releaseLock(lock);
2084
- throw error;
2085
- }
2086
- }
2087
- async function releaseExecutionContextWorkspace(input) {
2088
- const root = await canonicalDirectory(input.ledgerRootPath);
2089
- try {
2090
- return await withWorkspaceLock(root, input.context.id, async () => {
2091
- await readExecutionContextWorkspace({
2092
- ledgerRootPath: root,
2093
- contextId: input.context.id
2094
- });
2095
- const path = join(root, "execution-context-workspace-records", `${input.context.id}.json`);
2096
- let record = await readManifest(path);
2097
- if (!(record && ["completed", "in_use"].includes(record.status))) throw failure("workspace_creation_incomplete");
2098
- if (!input.ownedProcessesQuiescent) return {
2099
- status: "retained",
2100
- reason: "execution_quiescence_unconfirmed"
2101
- };
2102
- const completed = {
2103
- ...record,
2104
- status: "completed"
2105
- };
2106
- await writeManifest(path, completed, "r+");
2107
- record = await removePristineRetirement(completed, path);
2108
- if (record.retirement) return {
2109
- status: "retained",
2110
- reason: "cleanup_incomplete"
2111
- };
2112
- if (!record.pristineFingerprint) return {
2113
- status: "retained",
2114
- reason: "baseline_unverified"
2115
- };
2116
- await verifyRetainedWorkspace(record);
2117
- if (await fingerprintDirectory(record.boundaryRoot) !== record.pristineFingerprint) return {
2118
- status: "retained",
2119
- reason: "workspace_changed"
2120
- };
2121
- if (record.sourceWorkingDirectory && !await sourceHasCommit(record)) return {
2122
- status: "retained",
2123
- reason: "source_commit_unavailable"
2124
- };
2125
- return (await retirePristineWorkspace(record, path)).status === "released" ? { status: "released" } : {
2126
- status: "retained",
2127
- reason: "workspace_changed"
2128
- };
2129
- });
2130
- } finally {
2131
- if (input.use) await releaseLock(input.use.lock);
2132
- }
2133
- }
2134
- async function retirePristineWorkspace(record, recordPath) {
2135
- if (!record.pristineFingerprint || await fingerprintDirectory(record.boundaryRoot) !== record.pristineFingerprint) throw failure("workspace_release_incomplete");
2136
- const retiring = {
2137
- ...record,
2138
- status: "retiring",
2139
- retirement: {
2140
- path: `${recordPath}.retired-${randomUUID()}`,
2141
- pristineFingerprint: record.pristineFingerprint
2142
- }
2143
- };
2144
- await writeManifest(recordPath, retiring, "r+");
2145
- return await finishWorkspaceRetirement(retiring, recordPath);
2146
- }
2147
- async function finishWorkspaceRetirement(record, recordPath) {
2148
- const retirement = record.retirement;
2149
- if (!retirement) throw failure("workspace_release_incomplete");
2150
- const live = await inspectPath(record.boundaryRoot);
2151
- const retired = await inspectPath(retirement.path);
2152
- if (live && retired || !(live || retired)) throw failure("workspace_release_incomplete");
2153
- if (live) await moveWorkspace(record.boundaryRoot, retirement.path);
2154
- if (await fingerprintDirectory(retirement.path) !== retirement.pristineFingerprint) {
2155
- if (await inspectPath(record.boundaryRoot)) throw failure("workspace_release_incomplete");
2156
- await moveWorkspace(retirement.path, record.boundaryRoot);
2157
- const retained = {
2158
- ...record,
2159
- retirement: void 0,
2160
- status: "completed"
2161
- };
2162
- await writeManifest(recordPath, retained, "r+");
2163
- return retained;
2164
- }
2165
- const released = {
2166
- ...record,
2167
- status: "released"
2168
- };
2169
- await writeManifest(recordPath, released, "r+");
2170
- return await removePristineRetirement(released, recordPath);
2171
- }
2172
- async function removePristineRetirement(record, recordPath) {
2173
- const retirement = record.retirement;
2174
- if (!retirement) return record;
2175
- if (await inspectPath(retirement.path)) {
2176
- if (await fingerprintDirectory(retirement.path) !== retirement.pristineFingerprint) return record;
2177
- await rm(retirement.path, { recursive: true });
2178
- }
2179
- const removed = {
2180
- ...record,
2181
- retirement: void 0
2182
- };
2183
- await writeManifest(recordPath, removed, "r+");
2184
- return removed;
2185
- }
2186
- async function restoreReleasedWorkspace(record, recordPath) {
2187
- if (record.sourceWorkingDirectory && !await sourceHasCommit(record)) throw failure("workspace_base_commit_unavailable");
2188
- if (await inspectPath(record.boundaryRoot)) throw failure("workspace_already_exists");
2189
- const restoring = {
2190
- ...record,
2191
- status: "restoring",
2192
- processSupervisionId: randomUUID()
2193
- };
2194
- await writeManifest(recordPath, restoring, "r+");
2195
- await finishWorkspacePreparation(restoring, recordPath, true);
2196
- }
2197
- async function sourceHasCommit(record) {
2198
- if (!(record.sourceWorkingDirectory && record.baseCommit)) return false;
2199
- try {
2200
- await git(record.sourceWorkingDirectory, [
2201
- "cat-file",
2202
- "-e",
2203
- `${record.baseCommit}^{commit}`
2204
- ]);
2205
- return true;
2206
- } catch {
2207
- return false;
2208
- }
2209
- }
2210
- async function isUnchangedCheckout(record) {
2211
- return await git(record.workingDirectory, ["rev-parse", "HEAD"]) === record.baseCommit && await git(record.workingDirectory, [
2212
- "status",
2213
- "--porcelain",
2214
- "--untracked-files=all",
2215
- "--ignored"
2216
- ]) === "";
2217
- }
2218
- async function finishMissingCheckoutFiles(record) {
2219
- if (await git(record.workingDirectory, ["rev-parse", "HEAD"]) !== record.baseCommit) throw failure("workspace_creation_incomplete");
2220
- if ((await git(record.workingDirectory, [
2221
- "ls-files",
2222
- "-v",
2223
- "-z"
2224
- ])).split("\0").some((entry) => entry && !entry.startsWith("H "))) throw failure("workspace_creation_incomplete");
2225
- const status = await git(record.workingDirectory, [
2226
- "status",
2227
- "--porcelain",
2228
- "-z",
2229
- "--untracked-files=all",
2230
- "--ignored"
2231
- ]);
2232
- if (!status) return;
2233
- const changes = status.split("\0").filter(Boolean);
2234
- if (changes.some((entry) => !entry.startsWith(" D "))) throw failure("workspace_creation_incomplete");
2235
- const paths = changes.map((entry) => entry.slice(3));
2236
- for (let offset = 0; offset < paths.length; offset += 100) await git(record.workingDirectory, [
2237
- "checkout-index",
2238
- "--",
2239
- ...paths.slice(offset, offset + 100)
2240
- ], record.processSupervisionId);
2241
- }
2242
- async function fingerprintDirectory(root) {
2243
- const hash = createHash("sha256");
2244
- const visit = async (directory) => {
2245
- for (const name of (await readdir(directory)).sort()) {
2246
- const path = join(directory, name);
2247
- const info = await lstat(path);
2248
- hash.update(JSON.stringify([
2249
- relative(root, path),
2250
- info.mode,
2251
- info.nlink
2252
- ]));
2253
- if (info.isSymbolicLink()) hash.update(JSON.stringify(await readlink(path)));
2254
- else if (info.isDirectory()) await visit(path);
2255
- else if (info.isFile() && info.nlink === 1) {
2256
- hash.update(String(info.size));
2257
- hash.update(await fingerprintFile(path));
2258
- } else throw failure("workspace_git_metadata_changed");
2259
- }
2260
- };
2261
- await visit(root);
2262
- return hash.digest("hex");
2263
- }
2264
- async function fingerprintFile(path) {
2265
- const hash = createHash("sha256");
2266
- const file = await open(path, "r");
2267
- try {
2268
- const buffer = Buffer.alloc(64 * 1024);
2269
- for (;;) {
2270
- const { bytesRead } = await file.read(buffer);
2271
- if (!bytesRead) break;
2272
- hash.update(buffer.subarray(0, bytesRead));
2273
- }
2274
- } finally {
2275
- await file.close();
2276
- }
2277
- return hash.digest("hex");
2278
- }
2279
- async function withWorkspaceLock(root, contextId, run) {
2280
- if (!executionContextAssignmentSchema.shape.id.safeParse(contextId).success) throw failure("invalid_workspace_context");
2281
- return await runWithHeldLock({
2282
- lock: await acquireLock({
2283
- openMeldProfileId: "execution-context-workspaces",
2284
- key: contextId,
2285
- pathResolution: { env: { OPENMELD_HOME: root } }
2286
- }),
2287
- run
2288
- });
2289
- }
2290
- async function verifyRetainedWorkspace(manifest) {
2291
- await canonicalDirectory(manifest.boundaryRoot);
2292
- await canonicalDirectory(manifest.workingDirectory);
2293
- if (manifest.sourceWorkingDirectory) await verifyOwnedRepository(manifest);
2294
- return workspaceResult(manifest);
2295
- }
2296
- async function acquireWorkspaceExecutionLock(root, contextId) {
2297
- return await acquireLock({
2298
- openMeldProfileId: "execution-context-workspaces",
2299
- key: `${contextId}-execution`,
2300
- pathResolution: { env: { OPENMELD_HOME: root } }
2301
- });
2302
- }
2303
- function workspaceResult(manifest) {
2304
- return {
2305
- workingDirectory: manifest.workingDirectory,
2306
- boundaryRoot: manifest.boundaryRoot,
2307
- ...manifest.sourceWorkingDirectory ? { sourceWorkingDirectory: manifest.sourceWorkingDirectory } : {},
2308
- ...manifest.baseCommit ? { baseCommit: manifest.baseCommit } : {}
2309
- };
2310
- }
2311
- function assertSourceAllowed(source, policy) {
2312
- if (policy.mode === "only_selected_folders" && !policy.folders.some((folder) => within(source, folder))) throw failure("workspace_outside_computer_policy");
2313
- if (policy.mode === "block_selected_folders" && policy.folders.some((folder) => within(source, folder) || within(folder, source))) throw failure("workspace_overlaps_blocked_folder");
2314
- }
2315
- async function resolveSourceCommit(source) {
2316
- if (!await inspectPath(join(source, ".git"))) throw failure("project_repository_required");
2317
- if (await realpath(await git(source, ["rev-parse", "--show-toplevel"])) !== source) throw failure("project_repository_root_required");
2318
- const commit = await git(source, [
2319
- "rev-parse",
2320
- "--verify",
2321
- "HEAD^{commit}"
2322
- ]).catch((cause) => {
2323
- throw new Error("execution_context.project_commit_required", { cause });
2324
- });
2325
- if (!COMMIT_PATTERN.test(commit)) throw failure("project_commit_required");
2326
- return commit;
2327
- }
2328
- async function verifyOwnedRepository(manifest) {
2329
- const repository = join(manifest.boundaryRoot, "repository.git");
2330
- await canonicalDirectory(repository);
2331
- await assertPrivateMetadata(repository);
2332
- if (await inspectPath(join(repository, "objects", "info", "alternates"))) throw failure("workspace_git_metadata_changed");
2333
- const gitFile = join(manifest.workingDirectory, ".git");
2334
- const gitFileInfo = await inspectPath(gitFile);
2335
- if (!gitFileInfo?.isFile() || gitFileInfo.size > 4096) throw failure("workspace_git_metadata_changed");
2336
- const expectedGitDir = join(repository, "worktrees", "worktree");
2337
- if ((await readFile(gitFile, "utf8")).trim() !== `gitdir: ${expectedGitDir}`) throw failure("workspace_git_metadata_changed");
2338
- if (await realpath(join(expectedGitDir, (await readFile(join(expectedGitDir, "commondir"), "utf8")).trim())) !== repository) throw failure("workspace_git_metadata_changed");
2339
- if (await git(manifest.boundaryRoot, [
2340
- `--git-dir=${repository}`,
2341
- "rev-parse",
2342
- "--verify",
2343
- "refs/openmeld/base^{commit}"
2344
- ]) !== manifest.baseCommit) throw failure("workspace_base_commit_changed");
2345
- }
2346
- async function assertPrivateMetadata(path) {
2347
- for (const entry of await readdir(path, { withFileTypes: true })) {
2348
- if (entry.isSymbolicLink()) throw failure("workspace_is_symlink");
2349
- if (entry.isDirectory()) await assertPrivateMetadata(join(path, entry.name));
2350
- else if ((await lstat(join(path, entry.name))).nlink !== 1) throw failure("workspace_git_metadata_changed");
2351
- }
2352
- }
2353
- async function readManifest(path) {
2354
- const info = await inspectPath(path);
2355
- if (!info) return null;
2356
- if (!info.isFile() || info.size > 32768) throw failure("workspace_record_invalid");
2357
- let content;
2358
- try {
2359
- content = JSON.parse(await readFile(path, "utf8"));
2360
- } catch {
2361
- throw failure("workspace_record_invalid");
2362
- }
2363
- const parsed = manifestSchema.safeParse(content);
2364
- if (!parsed.success) throw failure("workspace_record_invalid");
2365
- const retirement = parsed.data.retirement;
2366
- const prefix = `${path}.retired-`;
2367
- if (parsed.data.status === "retiring" && !retirement || retirement && !(retirement.path.startsWith(prefix) && z.uuid().safeParse(retirement.path.slice(prefix.length)).success)) throw failure("workspace_record_invalid");
2368
- return parsed.data;
2369
- }
2370
- async function writeManifest(path, manifest, flags) {
2371
- const temporaryPath = flags === "wx" ? path : `${path}.${randomUUID()}.tmp`;
2372
- const file = await open(temporaryPath, "wx", 384);
2373
- try {
2374
- await file.writeFile(`${JSON.stringify({
2375
- ...manifest,
2376
- version: 2
2377
- })}\n`, "utf8");
2378
- await file.sync();
2379
- } finally {
2380
- await file.close();
2381
- }
2382
- if (flags !== "wx") await rename(temporaryPath, path);
2383
- await syncDirectory(dirname(path));
2384
- }
2385
- async function moveWorkspace(from, to) {
2386
- await rename(from, to);
2387
- await syncDirectory(dirname(from));
2388
- await syncDirectory(dirname(to));
2389
- }
2390
- async function inspectPath(path) {
2391
- const info = await lstat(path).catch((error) => {
2392
- if (error.code === "ENOENT") return null;
2393
- throw error;
2394
- });
2395
- if (info?.isSymbolicLink()) throw failure("workspace_is_symlink");
2396
- return info;
2397
- }
2398
- async function canonicalDirectory(path) {
2399
- if (!(await inspectPath(path))?.isDirectory()) throw failure("workspace_directory_unavailable");
2400
- return await realpath(path);
2401
- }
2402
- async function ensureDirectory(path, recursive = false) {
2403
- await inspectPath(path);
2404
- await mkdir(path, {
2405
- recursive,
2406
- mode: 448
2407
- }).catch((error) => {
2408
- if (error.code !== "EEXIST") throw error;
2409
- });
2410
- return await canonicalDirectory(path);
2411
- }
2412
- function within(child, parent) {
2413
- const path = relative(resolve(parent), child);
2414
- return path === "" || path !== ".." && !path.startsWith(`..${sep}`) && !isAbsolute(path);
2415
- }
2416
- const GIT_SETTINGS = {
2417
- "core.hooksPath": "/dev/null",
2418
- "core.attributesFile": "/dev/null",
2419
- "core.fsmonitor": "false",
2420
- "credential.helper": "",
2421
- "protocol.allow": "never",
2422
- "protocol.file.allow": "always",
2423
- "fetch.recurseSubmodules": "false",
2424
- "submodule.recurse": "false",
2425
- "uploadpack.packObjectsHook": "",
2426
- "gc.auto": "0",
2427
- "maintenance.auto": "false"
2428
- };
2429
- async function git(cwd, args, processSupervisionId) {
2430
- const env = Object.fromEntries(Object.entries(process.env).filter(([key]) => !key.startsWith("GIT_")));
2431
- Object.assign(env, {
2432
- ...processSupervisionId ? { OPENMELD_PROCESS_SUPERVISION_ID: processSupervisionId } : {},
2433
- GIT_CONFIG_NOSYSTEM: "1",
2434
- GIT_CONFIG_SYSTEM: "/dev/null",
2435
- GIT_CONFIG_GLOBAL: "/dev/null",
2436
- GIT_ATTR_NOSYSTEM: "1",
2437
- GIT_NO_REPLACE_OBJECTS: "1",
2438
- GIT_NO_LAZY_FETCH: "1",
2439
- GIT_ALLOW_PROTOCOL: "file",
2440
- GIT_TERMINAL_PROMPT: "0",
2441
- GIT_CONFIG_COUNT: String(Object.keys(GIT_SETTINGS).length)
2442
- });
2443
- for (const [index, [key, value]] of Object.entries(GIT_SETTINGS).entries()) {
2444
- env[`GIT_CONFIG_KEY_${index}`] = key;
2445
- env[`GIT_CONFIG_VALUE_${index}`] = value;
2446
- }
2447
- return (await execFileAsync("git", args, {
2448
- cwd,
2449
- env,
2450
- encoding: "utf8",
2451
- timeout: 3e4,
2452
- maxBuffer: 1024 * 1024
2453
- })).stdout.trimEnd();
2454
- }
2455
- function failure(code) {
2456
- return /* @__PURE__ */ new Error(`execution_context.${code}`);
2457
- }
2458
- //#endregion
2459
1859
  //#region src/local-service/dispatch/execution-context-session.ts
2460
1860
  function executionContextLedgerPolicy(context) {
2461
1861
  return context ? "throw" : "backup_and_reset";
@@ -3403,6 +2803,7 @@ async function handleDispatchDeliverFrame(input) {
3403
2803
  let dispatchSpaceActionContext = null;
3404
2804
  let nativeQuiescence;
3405
2805
  let workspaceUse = null;
2806
+ let claudeProjectRuntime = null;
3406
2807
  const workspaceProcesses = /* @__PURE__ */ new Map();
3407
2808
  const observeWorkspaceProcess = (event) => observeExecutionContextWorkspaceProcess(workspaceProcesses, event);
3408
2809
  let completedTurnId = null;
@@ -3462,13 +2863,20 @@ async function handleDispatchDeliverFrame(input) {
3462
2863
  currentWorkingDirectory: originalWorkingDirectory,
3463
2864
  computerFileAccessStorePath: input.computerFileAccessStorePath
3464
2865
  });
3465
- effectiveRuntimeContext = { providerRuntimeWorkingDirectory: await prepareDispatchWorkHandoff({
2866
+ const handoffWorkingDirectory = await prepareDispatchWorkHandoff({
3466
2867
  task: parsedTask,
3467
2868
  ownerUserId: input.profileOwnerUserId,
3468
2869
  workingDirectory: taskWorkspace.workingDirectory
3469
- }) };
2870
+ });
2871
+ effectiveRuntimeContext = { providerRuntimeWorkingDirectory: handoffWorkingDirectory };
3470
2872
  runtimePreparation.effectiveRuntimeContext = effectiveRuntimeContext;
2873
+ claudeProjectRuntime = await prepareDispatchClaudeProjectContainer({
2874
+ parsedTask,
2875
+ taskWorkspace,
2876
+ workingDirectory: handoffWorkingDirectory
2877
+ });
3471
2878
  computerFileAccessBoundary = await resolveDispatchComputerFileAccess({
2879
+ claudeProjectRuntime,
3472
2880
  computerFileAccessStorePath: input.computerFileAccessStorePath,
3473
2881
  onInteractionRequest,
3474
2882
  parsedTask,
@@ -3506,9 +2914,12 @@ async function handleDispatchDeliverFrame(input) {
3506
2914
  });
3507
2915
  const spaceActionRuntimeContext = createDispatchSpaceActionRuntimeContext({
3508
2916
  bootstrapContext,
2917
+ claudeProjectRuntime,
2918
+ ledgerRootPath: input.ledgerPaths.rootDirPath,
3509
2919
  parsedTask,
3510
2920
  runtimePreparation,
3511
- sendTargetReference
2921
+ sendTargetReference,
2922
+ taskWorkspace
3512
2923
  });
3513
2924
  dispatchSpaceActionContext = spaceActionRuntimeContext.dispatchSpaceActionContext;
3514
2925
  runtimeEnvOverrides = spaceActionRuntimeContext.runtimeEnvOverrides;
@@ -3547,7 +2958,10 @@ async function handleDispatchDeliverFrame(input) {
3547
2958
  existingContextId
3548
2959
  });
3549
2960
  workspaceUse = await markExecutionContextWorkspaceInUse({
2961
+ attemptId: parsedTask.attemptId,
3550
2962
  context: parsedTask.executionContext,
2963
+ containerRuntime: claudeProjectRuntime,
2964
+ dispatchId: parsedTask.dispatchId,
3551
2965
  ledgerRootPath: input.ledgerPaths.rootDirPath
3552
2966
  });
3553
2967
  runtimeEnvOverrides = {
@@ -4686,6 +4100,7 @@ async function resolveDispatchSpaceMetaContext(input) {
4686
4100
  }
4687
4101
  function buildDispatchRuntimePrompt(input) {
4688
4102
  return buildDispatchPromptPlan({
4103
+ executionContextAccess: input.parsedTask.executionContext?.access,
4689
4104
  callerContext: input.parsedTask.callerContext,
4690
4105
  shouldInjectBootstrap: input.shouldInjectBootstrap,
4691
4106
  shouldInjectCenterAgentRoleTemplate: input.parsedTask.targetProfileIsCenterAgent,
@@ -4744,6 +4159,26 @@ async function prepareDispatchTaskWorkspace(input) {
4744
4159
  boundaryRoot: workingDirectory
4745
4160
  };
4746
4161
  }
4162
+ async function prepareDispatchClaudeProjectContainer(input) {
4163
+ const context = input.parsedTask.executionContext;
4164
+ if (input.parsedTask.agentControllerRef !== "builtin:claude-code" || context?.access !== "workspace" || context.workspace !== "isolated") return null;
4165
+ try {
4166
+ return await prepareClaudeProjectContainer({
4167
+ boundaryRoot: input.taskWorkspace.boundaryRoot,
4168
+ contextId: context.id,
4169
+ workspacePath: input.workingDirectory
4170
+ });
4171
+ } catch (error) {
4172
+ const code = error instanceof Error && error.message.startsWith("claude_project.") ? error.message.split(":")[0] : "claude_project.isolation_unverified";
4173
+ let message = "OpenMeld could not verify this task's project container isolation. Check Docker or Podman and try again.";
4174
+ if (code === "claude_project.container_runtime_unavailable") message = "Start Docker or Podman with a Linux container engine on this computer, then try this project task again.";
4175
+ else if (code === "claude_project.image_unavailable") message = "Docker or Podman could not prepare the task image. Check the container engine and try again.";
4176
+ throw new DaemonServiceRunError({
4177
+ code: code ?? "claude_project.isolation_unverified",
4178
+ message
4179
+ });
4180
+ }
4181
+ }
4747
4182
  async function releaseDispatchTaskWorkspace(input) {
4748
4183
  const context = input.parsedTask.executionContext;
4749
4184
  if (!(input.workspaceUse && context)) return;
@@ -4785,6 +4220,7 @@ async function resolveDispatchComputerFileAccess(input) {
4785
4220
  if (input.parsedTask.executionContext) {
4786
4221
  const context = input.parsedTask.executionContext;
4787
4222
  if (input.parsedTask.agentControllerRef === "builtin:claude-code" && context.access === "space_context") return null;
4223
+ if (input.parsedTask.agentControllerRef === "builtin:claude-code" && context.access === "workspace" && context.workspace === "isolated" && input.claudeProjectRuntime) return null;
4788
4224
  if (input.parsedTask.agentControllerRef !== "builtin:codex" || input.parsedTask.transportMode !== "codex-app-server" || !verifier) throw new Error("execution_context.file_access_unsupported");
4789
4225
  const workingDirectory = input.runtimePreparation.effectiveRuntimeContext.providerRuntimeWorkingDirectory;
4790
4226
  const boundary = executionContextFileAccessBoundary({
@@ -4839,6 +4275,13 @@ async function resolveDispatchComputerFileAccess(input) {
4839
4275
  }
4840
4276
  function createDispatchSpaceActionRuntimeContext(input) {
4841
4277
  const contextResult = createDispatchSpaceActionContext({
4278
+ ...input.claudeProjectRuntime && input.parsedTask.executionContext ? { projectShell: {
4279
+ boundaryRoot: input.taskWorkspace.boundaryRoot,
4280
+ executionContextId: input.parsedTask.executionContext.id,
4281
+ ledgerRootPath: input.ledgerRootPath,
4282
+ workspacePath: input.runtimePreparation.effectiveRuntimeContext.providerRuntimeWorkingDirectory,
4283
+ runtime: input.claudeProjectRuntime
4284
+ } } : {},
4842
4285
  workingCopyId: input.parsedTask.workingCopyId,
4843
4286
  attemptId: input.parsedTask.attemptId,
4844
4287
  dispatchId: input.parsedTask.dispatchId,
@@ -5268,7 +4711,10 @@ async function resolveRuntimeResultStructuredSpaceAction(input) {
5268
4711
  prompt,
5269
4712
  routeConfig: input.routeConfig,
5270
4713
  runtimeContext: input.runtimeContext,
5271
- runtimeEnvOverrides: input.runtimeEnvOverrides,
4714
+ runtimeEnvOverrides: {
4715
+ ...input.runtimeEnvOverrides,
4716
+ [DISPATCH_SPACE_ACTION_DELIVERY_ONLY_ENV]: "1"
4717
+ },
5272
4718
  runtimeControllerSupport: input.runtimeControllerSupport,
5273
4719
  streamingModeOverride: "final",
5274
4720
  agentControllerConversationOverride: repairContinuation.agentControllerConversationOverride
@@ -5721,21 +5167,6 @@ async function maybeRepairStructuredSpaceAction(input) {
5721
5167
  taskId: input.parsedTask.taskId
5722
5168
  }
5723
5169
  });
5724
- const skillRepair = await ensureDispatchControllerOpenMeldSkill({ agentControllerRef: input.parsedTask.agentControllerRef });
5725
- emitRunLine({
5726
- presenter: input.presenter,
5727
- code: "daemon.run.dispatch_controller_skill_repair_checked",
5728
- text: `OpenMeld skill repair checked for task ${input.parsedTask.taskId}`,
5729
- payload: {
5730
- agentControllerRef: input.parsedTask.agentControllerRef,
5731
- agentId: skillRepair.agentId,
5732
- dispatchId: input.parsedTask.dispatchId,
5733
- ...skillRepair.reason ? { reason: skillRepair.reason } : {},
5734
- status: skillRepair.status,
5735
- targetProfileId: input.parsedTask.targetProfileId,
5736
- taskId: input.parsedTask.taskId
5737
- }
5738
- });
5739
5170
  if (!input.runControllerRepair) return {
5740
5171
  finalFailureDiagnostics: resolveStructuredActionFailureDiagnostics({
5741
5172
  carrierKind: "none",
@@ -5940,36 +5371,46 @@ function resolveStructuredSpaceActionProvenance(input) {
5940
5371
  return input.runtimeResult.resultPayload.spaceActionProvenance ?? "direct";
5941
5372
  }
5942
5373
  async function runDispatchRuntimeExecution(input) {
5943
- await input.onNativeTurnStarted();
5944
- const result = await runRuntimeTask({
5945
- agentContextOverride: {
5946
- agentControllerConversationId: input.contextId,
5947
- agentControllerConversationOverride: input.agentControllerConversationOverride ?? null
5948
- },
5949
- io: input.io,
5950
- ...input.onInteractionRequest ? { onInteractionRequest: input.onInteractionRequest } : {},
5951
- ...input.onPreview ? { onPreview: input.onPreview } : {},
5952
- ...input.onRuntimeEvent ? { onRuntimeEvent: input.onRuntimeEvent } : {},
5953
- paths: input.ledgerPaths,
5954
- route: buildDispatchRuntimeRoute({
5955
- contextId: input.contextId,
5956
- envOverrides: input.runtimeEnvOverrides,
5957
- parsedTask: input.parsedTask,
5958
- routeConfig: input.routeConfig,
5959
- runtimeControllerSupport: input.runtimeControllerSupport,
5960
- streamingMode: input.streamingModeOverride ?? input.parsedTask.streamingMode
5961
- }),
5962
- task: buildDispatchRuntimeTask({
5963
- computerFileAccessBoundary: input.computerFileAccessBoundary,
5964
- executionMode: input.executionMode,
5965
- instructionPrompt: input.instructionPrompt,
5966
- parsedTask: input.parsedTask,
5967
- prompt: input.prompt,
5968
- runtimeContext: input.runtimeContext
5969
- })
5970
- });
5971
- input.onNativeTurnCompleted(result);
5972
- return result;
5374
+ const route = buildDispatchRuntimeRoute({
5375
+ contextId: input.contextId,
5376
+ envOverrides: input.runtimeEnvOverrides,
5377
+ parsedTask: input.parsedTask,
5378
+ routeConfig: input.routeConfig,
5379
+ runtimeControllerSupport: input.runtimeControllerSupport,
5380
+ streamingMode: input.streamingModeOverride ?? input.parsedTask.streamingMode
5381
+ });
5382
+ const spaceActionTools = route.env?.["OPENMELD_SPACE_ACTION_CONTEXT_PATH"] ? createDispatchSpaceTools({ env: {
5383
+ ...process.env,
5384
+ ...route.env
5385
+ } }) : void 0;
5386
+ try {
5387
+ await input.onNativeTurnStarted();
5388
+ const result = await runRuntimeTask({
5389
+ spaceActionTools,
5390
+ agentContextOverride: {
5391
+ agentControllerConversationId: input.contextId,
5392
+ agentControllerConversationOverride: input.agentControllerConversationOverride ?? null
5393
+ },
5394
+ io: input.io,
5395
+ ...input.onInteractionRequest ? { onInteractionRequest: input.onInteractionRequest } : {},
5396
+ ...input.onPreview ? { onPreview: input.onPreview } : {},
5397
+ ...input.onRuntimeEvent ? { onRuntimeEvent: input.onRuntimeEvent } : {},
5398
+ paths: input.ledgerPaths,
5399
+ route,
5400
+ task: buildDispatchRuntimeTask({
5401
+ computerFileAccessBoundary: input.computerFileAccessBoundary,
5402
+ executionMode: input.executionMode,
5403
+ instructionPrompt: input.instructionPrompt,
5404
+ parsedTask: input.parsedTask,
5405
+ prompt: input.prompt,
5406
+ runtimeContext: input.runtimeContext
5407
+ })
5408
+ });
5409
+ input.onNativeTurnCompleted(result);
5410
+ return result;
5411
+ } finally {
5412
+ spaceActionTools?.close();
5413
+ }
5973
5414
  }
5974
5415
  function buildDispatchRuntimeRoute(input) {
5975
5416
  const runtimeEnv = input.contextId ? {
@@ -8929,13 +8370,35 @@ function createExecutionHostRuntime(input) {
8929
8370
  if (request.connectionGeneration < generation || disposed) throw new ExecutionHostError("host.connection_replaced", "An older connector cannot replace the active connection.");
8930
8371
  const catalog = catalogs.get(request.catalogRevision);
8931
8372
  if (!catalog || request.catalogRevision < activeCatalogRevision) throw new ExecutionHostError("host.catalog_replaced", "The requested Host catalog is no longer available.");
8373
+ const applyRouteFacts = () => {
8374
+ activeCatalogRevision = request.catalogRevision;
8375
+ Object.assign(routeCatalogState, createMutableRouteCatalogState(catalog));
8376
+ leasesByProfileId.clear();
8377
+ for (const lease of request.leases) leasesByProfileId.set(lease.profileId, lease.leaseEpoch);
8378
+ };
8379
+ const syncPermissionModes = async () => {
8380
+ const outcomes = await syncActiveTaskPermissionModes({
8381
+ catalogState: routeCatalogState,
8382
+ inflightTaskControlRegistry,
8383
+ localAdapterContainer
8384
+ });
8385
+ for (const outcome of outcomes) emitRunLine({
8386
+ presenter: input.presenter,
8387
+ code: "daemon.run.active_permission_mode_sync",
8388
+ text: `active permission update ${outcome.status} for ${outcome.taskId}`,
8389
+ payload: outcome
8390
+ });
8391
+ };
8392
+ if (request.connectionGeneration === generation && currentSocketRef.socket !== null) {
8393
+ applyRouteFacts();
8394
+ await syncPermissionModes();
8395
+ assertConnection(request.connectionGeneration);
8396
+ return snapshot();
8397
+ }
8932
8398
  connectionAbort?.abort();
8933
8399
  connectionAbort = new AbortController();
8934
8400
  generation = request.connectionGeneration;
8935
- activeCatalogRevision = request.catalogRevision;
8936
- Object.assign(routeCatalogState, createMutableRouteCatalogState(catalog));
8937
- leasesByProfileId.clear();
8938
- for (const lease of request.leases) leasesByProfileId.set(lease.profileId, lease.leaseEpoch);
8401
+ applyRouteFacts();
8939
8402
  const sink = { send: (raw) => {
8940
8403
  if (generation !== request.connectionGeneration || currentSocketRef.socket !== sink) throw new ExecutionHostError("host.connection_replaced", "This execution frame's connector has been retired.");
8941
8404
  const frame = parseDaemonFrame(raw);
@@ -8953,17 +8416,7 @@ function createExecutionHostRuntime(input) {
8953
8416
  currentSocketRef.socket = sink;
8954
8417
  currentSocketRef.connectionGeneration = generation;
8955
8418
  executionAdmission.resend();
8956
- const outcomes = await syncActiveTaskPermissionModes({
8957
- catalogState: routeCatalogState,
8958
- inflightTaskControlRegistry,
8959
- localAdapterContainer
8960
- });
8961
- for (const outcome of outcomes) emitRunLine({
8962
- presenter: input.presenter,
8963
- code: "daemon.run.active_permission_mode_sync",
8964
- text: `active permission update ${outcome.status} for ${outcome.taskId}`,
8965
- payload: outcome
8966
- });
8419
+ await syncPermissionModes();
8967
8420
  assertConnection(request.connectionGeneration);
8968
8421
  replayInteractions();
8969
8422
  startResultReplay();
@@ -9134,4 +8587,4 @@ function createExecutionHostRuntime(input) {
9134
8587
  //#endregion
9135
8588
  export { createExecutionHostResources, createExecutionHostRuntime };
9136
8589
 
9137
- //# sourceMappingURL=runtime-BYaFkkLK.js.map
8590
+ //# sourceMappingURL=runtime-D6jItuQ-.js.map