@opencorelabs/lucidity 0.8.0 → 0.9.5

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 (371) hide show
  1. package/README.md +2 -2
  2. package/dist/assets/speech/lucidity-speech +0 -0
  3. package/dist/automations/service.d.ts +4 -0
  4. package/dist/automations/service.d.ts.map +1 -1
  5. package/dist/automations/service.js +60 -22
  6. package/dist/automations/store.d.ts +9 -3
  7. package/dist/automations/store.d.ts.map +1 -1
  8. package/dist/automations/store.js +45 -32
  9. package/dist/automations/workflow.d.ts +14 -0
  10. package/dist/automations/workflow.d.ts.map +1 -0
  11. package/dist/automations/workflow.js +57 -0
  12. package/dist/coding/listPrs.d.ts +2 -0
  13. package/dist/coding/listPrs.d.ts.map +1 -1
  14. package/dist/coding/listPrs.js +10 -0
  15. package/dist/coding/runCodeTurn.d.ts +3 -14
  16. package/dist/coding/runCodeTurn.d.ts.map +1 -1
  17. package/dist/coding/runCodeTurn.js +21 -86
  18. package/dist/coding/runReview.d.ts +10 -0
  19. package/dist/coding/runReview.d.ts.map +1 -0
  20. package/dist/coding/runReview.js +87 -0
  21. package/dist/coding/workspaceRegistry.d.ts +49 -1
  22. package/dist/coding/workspaceRegistry.d.ts.map +1 -1
  23. package/dist/coding/workspaceRegistry.js +208 -17
  24. package/dist/coding/worktree.d.ts +61 -18
  25. package/dist/coding/worktree.d.ts.map +1 -1
  26. package/dist/coding/worktree.js +149 -17
  27. package/dist/coding/worktreeSetup.d.ts +7 -0
  28. package/dist/coding/worktreeSetup.d.ts.map +1 -0
  29. package/dist/coding/worktreeSetup.js +49 -0
  30. package/dist/index.js +21 -28
  31. package/dist/jobs/briefing.d.ts +2 -16
  32. package/dist/jobs/briefing.d.ts.map +1 -1
  33. package/dist/jobs/briefing.js +65 -93
  34. package/dist/logTimestamps.d.ts +10 -0
  35. package/dist/logTimestamps.d.ts.map +1 -0
  36. package/dist/logTimestamps.js +12 -0
  37. package/dist/providerRecovery.d.ts +48 -0
  38. package/dist/providerRecovery.d.ts.map +1 -0
  39. package/dist/providerRecovery.js +100 -0
  40. package/dist/room/client.d.ts +2 -20
  41. package/dist/room/client.d.ts.map +1 -1
  42. package/dist/room/client.js +18 -29
  43. package/dist/room/computer.d.ts.map +1 -1
  44. package/dist/room/computer.js +1 -2
  45. package/dist/room/incidents.d.ts +3 -0
  46. package/dist/room/incidents.d.ts.map +1 -1
  47. package/dist/room/incidents.js +1 -0
  48. package/dist/room/turnQueue.d.ts.map +1 -1
  49. package/dist/room/turnQueue.js +28 -22
  50. package/dist/runtimeStore.d.ts +2 -0
  51. package/dist/runtimeStore.d.ts.map +1 -1
  52. package/dist/runtimeStore.js +17 -0
  53. package/dist/vault.d.ts +6 -3
  54. package/dist/vault.d.ts.map +1 -1
  55. package/dist/vault.js +18 -4
  56. package/package.json +1 -1
  57. package/src/automations/service.ts +47 -21
  58. package/src/automations/store.ts +41 -50
  59. package/src/automations/workflow.ts +49 -0
  60. package/src/coding/listPrs.ts +14 -0
  61. package/src/coding/runCodeTurn.ts +26 -95
  62. package/src/coding/runReview.ts +83 -0
  63. package/src/coding/workspaceRegistry.ts +186 -16
  64. package/src/coding/worktree.ts +161 -20
  65. package/src/coding/worktreeSetup.ts +50 -0
  66. package/src/index.ts +22 -31
  67. package/src/jobs/briefing.ts +62 -109
  68. package/src/logTimestamps.ts +14 -0
  69. package/src/providerRecovery.ts +99 -0
  70. package/src/room/client.ts +19 -54
  71. package/src/room/computer.ts +1 -2
  72. package/src/room/incidents.ts +4 -0
  73. package/src/room/turnQueue.ts +27 -29
  74. package/src/runtimeStore.ts +18 -1
  75. package/src/vault.ts +16 -7
  76. package/vendor/mcp-server/package.json +1 -1
  77. package/vendor/runtime/README.md +34 -0
  78. package/vendor/runtime/dist/executor/claudeAgent.d.ts +4 -0
  79. package/vendor/runtime/dist/executor/claudeAgent.d.ts.map +1 -1
  80. package/vendor/runtime/dist/executor/claudeAgent.js +57 -4
  81. package/vendor/runtime/dist/executor/codex.d.ts +7 -2
  82. package/vendor/runtime/dist/executor/codex.d.ts.map +1 -1
  83. package/vendor/runtime/dist/executor/codex.js +47 -4
  84. package/vendor/runtime/dist/executor/codexProtocol/AgentPath.d.ts +2 -0
  85. package/vendor/runtime/dist/executor/codexProtocol/AgentPath.d.ts.map +1 -0
  86. package/vendor/runtime/dist/executor/codexProtocol/AgentPath.js +2 -0
  87. package/vendor/runtime/dist/executor/codexProtocol/ImageGenerationFailure.d.ts +6 -0
  88. package/vendor/runtime/dist/executor/codexProtocol/ImageGenerationFailure.d.ts.map +1 -0
  89. package/vendor/runtime/dist/executor/codexProtocol/ImageGenerationFailure.js +2 -0
  90. package/vendor/runtime/dist/executor/codexProtocol/ImageGenerationItem.d.ts +12 -0
  91. package/vendor/runtime/dist/executor/codexProtocol/ImageGenerationItem.d.ts.map +1 -0
  92. package/vendor/runtime/dist/executor/codexProtocol/ImageGenerationItem.js +2 -0
  93. package/vendor/runtime/dist/executor/codexProtocol/LegacyAppPathString.d.ts +24 -0
  94. package/vendor/runtime/dist/executor/codexProtocol/LegacyAppPathString.d.ts.map +1 -0
  95. package/vendor/runtime/dist/executor/codexProtocol/LegacyAppPathString.js +2 -0
  96. package/vendor/runtime/dist/executor/codexProtocol/MessagePhase.d.ts +8 -0
  97. package/vendor/runtime/dist/executor/codexProtocol/MessagePhase.d.ts.map +1 -0
  98. package/vendor/runtime/dist/executor/codexProtocol/MessagePhase.js +2 -0
  99. package/vendor/runtime/dist/executor/codexProtocol/SleepItem.d.ts +8 -0
  100. package/vendor/runtime/dist/executor/codexProtocol/SleepItem.d.ts.map +1 -0
  101. package/vendor/runtime/dist/executor/codexProtocol/SleepItem.js +2 -0
  102. package/vendor/runtime/dist/executor/codexProtocol/SubAgentSource.d.ts +14 -0
  103. package/vendor/runtime/dist/executor/codexProtocol/SubAgentSource.d.ts.map +1 -0
  104. package/vendor/runtime/dist/executor/codexProtocol/SubAgentSource.js +2 -0
  105. package/vendor/runtime/dist/executor/codexProtocol/ThreadId.d.ts +7 -0
  106. package/vendor/runtime/dist/executor/codexProtocol/ThreadId.d.ts.map +1 -0
  107. package/vendor/runtime/dist/executor/codexProtocol/ThreadId.js +2 -0
  108. package/vendor/runtime/dist/executor/codexProtocol/WebSearchItem.d.ts +15 -0
  109. package/vendor/runtime/dist/executor/codexProtocol/WebSearchItem.d.ts.map +1 -0
  110. package/vendor/runtime/dist/executor/codexProtocol/WebSearchItem.js +2 -0
  111. package/vendor/runtime/dist/executor/codexProtocol/v2/AgentMessageDelivery.d.ts +2 -0
  112. package/vendor/runtime/dist/executor/codexProtocol/v2/AgentMessageDelivery.d.ts.map +1 -0
  113. package/vendor/runtime/dist/executor/codexProtocol/v2/AgentMessageDelivery.js +2 -0
  114. package/vendor/runtime/dist/executor/codexProtocol/v2/AsyncUserInputQuestion.d.ts +5 -0
  115. package/vendor/runtime/dist/executor/codexProtocol/v2/AsyncUserInputQuestion.d.ts.map +1 -0
  116. package/vendor/runtime/dist/executor/codexProtocol/v2/AsyncUserInputQuestion.js +2 -0
  117. package/vendor/runtime/dist/executor/codexProtocol/v2/CodexErrorInfo.d.ts +29 -0
  118. package/vendor/runtime/dist/executor/codexProtocol/v2/CodexErrorInfo.d.ts.map +1 -0
  119. package/vendor/runtime/dist/executor/codexProtocol/v2/CodexErrorInfo.js +2 -0
  120. package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentState.d.ts +6 -0
  121. package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentState.d.ts.map +1 -0
  122. package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentState.js +2 -0
  123. package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentStatus.d.ts +2 -0
  124. package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentStatus.d.ts.map +1 -0
  125. package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentStatus.js +2 -0
  126. package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentTool.d.ts +2 -0
  127. package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentTool.d.ts.map +1 -0
  128. package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentTool.js +2 -0
  129. package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentToolCallStatus.d.ts +2 -0
  130. package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentToolCallStatus.d.ts.map +1 -0
  131. package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentToolCallStatus.js +2 -0
  132. package/vendor/runtime/dist/executor/codexProtocol/v2/CommandAction.d.ts +20 -0
  133. package/vendor/runtime/dist/executor/codexProtocol/v2/CommandAction.d.ts.map +1 -0
  134. package/vendor/runtime/dist/executor/codexProtocol/v2/CommandAction.js +2 -0
  135. package/vendor/runtime/dist/executor/codexProtocol/v2/CommandExecutionSource.d.ts +2 -0
  136. package/vendor/runtime/dist/executor/codexProtocol/v2/CommandExecutionSource.d.ts.map +1 -0
  137. package/vendor/runtime/dist/executor/codexProtocol/v2/CommandExecutionSource.js +2 -0
  138. package/vendor/runtime/dist/executor/codexProtocol/v2/CommandExecutionStatus.d.ts +2 -0
  139. package/vendor/runtime/dist/executor/codexProtocol/v2/CommandExecutionStatus.d.ts.map +1 -0
  140. package/vendor/runtime/dist/executor/codexProtocol/v2/CommandExecutionStatus.js +2 -0
  141. package/vendor/runtime/dist/executor/codexProtocol/v2/DynamicToolCallOutputContentItem.d.ts +11 -0
  142. package/vendor/runtime/dist/executor/codexProtocol/v2/DynamicToolCallOutputContentItem.d.ts.map +1 -0
  143. package/vendor/runtime/dist/executor/codexProtocol/v2/DynamicToolCallOutputContentItem.js +2 -0
  144. package/vendor/runtime/dist/executor/codexProtocol/v2/DynamicToolCallStatus.d.ts +2 -0
  145. package/vendor/runtime/dist/executor/codexProtocol/v2/DynamicToolCallStatus.d.ts.map +1 -0
  146. package/vendor/runtime/dist/executor/codexProtocol/v2/DynamicToolCallStatus.js +2 -0
  147. package/vendor/runtime/dist/executor/codexProtocol/v2/FileUpdateChange.d.ts +7 -0
  148. package/vendor/runtime/dist/executor/codexProtocol/v2/FileUpdateChange.d.ts.map +1 -0
  149. package/vendor/runtime/dist/executor/codexProtocol/v2/FileUpdateChange.js +2 -0
  150. package/vendor/runtime/dist/executor/codexProtocol/v2/GitInfo.d.ts +6 -0
  151. package/vendor/runtime/dist/executor/codexProtocol/v2/GitInfo.d.ts.map +1 -0
  152. package/vendor/runtime/dist/executor/codexProtocol/v2/GitInfo.js +2 -0
  153. package/vendor/runtime/dist/executor/codexProtocol/v2/HookPromptFragment.d.ts +5 -0
  154. package/vendor/runtime/dist/executor/codexProtocol/v2/HookPromptFragment.d.ts.map +1 -0
  155. package/vendor/runtime/dist/executor/codexProtocol/v2/HookPromptFragment.js +2 -0
  156. package/vendor/runtime/dist/executor/codexProtocol/v2/McpAppDisplayMode.d.ts +2 -0
  157. package/vendor/runtime/dist/executor/codexProtocol/v2/McpAppDisplayMode.d.ts.map +1 -0
  158. package/vendor/runtime/dist/executor/codexProtocol/v2/McpAppDisplayMode.js +2 -0
  159. package/vendor/runtime/dist/executor/codexProtocol/v2/McpAppUi.d.ts +9 -0
  160. package/vendor/runtime/dist/executor/codexProtocol/v2/McpAppUi.d.ts.map +1 -0
  161. package/vendor/runtime/dist/executor/codexProtocol/v2/McpAppUi.js +2 -0
  162. package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallAppContext.d.ts +8 -0
  163. package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallAppContext.d.ts.map +1 -0
  164. package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallAppContext.js +2 -0
  165. package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallError.d.ts +4 -0
  166. package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallError.d.ts.map +1 -0
  167. package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallError.js +2 -0
  168. package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallResult.d.ts +7 -0
  169. package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallResult.d.ts.map +1 -0
  170. package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallResult.js +2 -0
  171. package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallStatus.d.ts +2 -0
  172. package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallStatus.d.ts.map +1 -0
  173. package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallStatus.js +2 -0
  174. package/vendor/runtime/dist/executor/codexProtocol/v2/MemoryCitation.d.ts +6 -0
  175. package/vendor/runtime/dist/executor/codexProtocol/v2/MemoryCitation.d.ts.map +1 -0
  176. package/vendor/runtime/dist/executor/codexProtocol/v2/MemoryCitation.js +2 -0
  177. package/vendor/runtime/dist/executor/codexProtocol/v2/MemoryCitationEntry.d.ts +7 -0
  178. package/vendor/runtime/dist/executor/codexProtocol/v2/MemoryCitationEntry.d.ts.map +1 -0
  179. package/vendor/runtime/dist/executor/codexProtocol/v2/MemoryCitationEntry.js +2 -0
  180. package/vendor/runtime/dist/executor/codexProtocol/v2/MisalignmentErrorDetails.d.ts +16 -0
  181. package/vendor/runtime/dist/executor/codexProtocol/v2/MisalignmentErrorDetails.d.ts.map +1 -0
  182. package/vendor/runtime/dist/executor/codexProtocol/v2/MisalignmentErrorDetails.js +2 -0
  183. package/vendor/runtime/dist/executor/codexProtocol/v2/MisalignmentSteer.d.ts +4 -0
  184. package/vendor/runtime/dist/executor/codexProtocol/v2/MisalignmentSteer.d.ts.map +1 -0
  185. package/vendor/runtime/dist/executor/codexProtocol/v2/MisalignmentSteer.js +2 -0
  186. package/vendor/runtime/dist/executor/codexProtocol/v2/NonSteerableTurnKind.d.ts +2 -0
  187. package/vendor/runtime/dist/executor/codexProtocol/v2/NonSteerableTurnKind.d.ts.map +1 -0
  188. package/vendor/runtime/dist/executor/codexProtocol/v2/NonSteerableTurnKind.js +2 -0
  189. package/vendor/runtime/dist/executor/codexProtocol/v2/PatchApplyStatus.d.ts +2 -0
  190. package/vendor/runtime/dist/executor/codexProtocol/v2/PatchApplyStatus.d.ts.map +1 -0
  191. package/vendor/runtime/dist/executor/codexProtocol/v2/PatchApplyStatus.js +2 -0
  192. package/vendor/runtime/dist/executor/codexProtocol/v2/PatchChangeKind.d.ts +9 -0
  193. package/vendor/runtime/dist/executor/codexProtocol/v2/PatchChangeKind.d.ts.map +1 -0
  194. package/vendor/runtime/dist/executor/codexProtocol/v2/PatchChangeKind.js +2 -0
  195. package/vendor/runtime/dist/executor/codexProtocol/v2/SessionSource.d.ts +7 -0
  196. package/vendor/runtime/dist/executor/codexProtocol/v2/SessionSource.d.ts.map +1 -0
  197. package/vendor/runtime/dist/executor/codexProtocol/v2/SessionSource.js +2 -0
  198. package/vendor/runtime/dist/executor/codexProtocol/v2/SubAgentActivityKind.d.ts +2 -0
  199. package/vendor/runtime/dist/executor/codexProtocol/v2/SubAgentActivityKind.d.ts.map +1 -0
  200. package/vendor/runtime/dist/executor/codexProtocol/v2/SubAgentActivityKind.js +2 -0
  201. package/vendor/runtime/dist/executor/codexProtocol/v2/Thread.d.ts +100 -0
  202. package/vendor/runtime/dist/executor/codexProtocol/v2/Thread.d.ts.map +1 -0
  203. package/vendor/runtime/dist/executor/codexProtocol/v2/Thread.js +2 -0
  204. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadActiveFlag.d.ts +2 -0
  205. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadActiveFlag.d.ts.map +1 -0
  206. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadActiveFlag.js +2 -0
  207. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadHistoryMode.d.ts +2 -0
  208. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadHistoryMode.d.ts.map +1 -0
  209. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadHistoryMode.js +2 -0
  210. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadItem.d.ts +216 -0
  211. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadItem.d.ts.map +1 -0
  212. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadItem.js +2 -0
  213. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadReadParams.d.ts +11 -0
  214. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadReadParams.d.ts.map +1 -0
  215. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadReadParams.js +2 -0
  216. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadReadResponse.d.ts +5 -0
  217. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadReadResponse.d.ts.map +1 -0
  218. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadReadResponse.js +2 -0
  219. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadSection.d.ts +19 -0
  220. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadSection.d.ts.map +1 -0
  221. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadSection.js +2 -0
  222. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadSectionAppearance.d.ts +8 -0
  223. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadSectionAppearance.d.ts.map +1 -0
  224. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadSectionAppearance.js +2 -0
  225. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadStatus.d.ts +12 -0
  226. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadStatus.d.ts.map +1 -0
  227. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadStatus.js +2 -0
  228. package/vendor/runtime/dist/executor/codexProtocol/v2/Turn.d.ts +36 -0
  229. package/vendor/runtime/dist/executor/codexProtocol/v2/Turn.d.ts.map +1 -0
  230. package/vendor/runtime/dist/executor/codexProtocol/v2/Turn.js +2 -0
  231. package/vendor/runtime/dist/executor/codexProtocol/v2/TurnError.d.ts +12 -0
  232. package/vendor/runtime/dist/executor/codexProtocol/v2/TurnError.d.ts.map +1 -0
  233. package/vendor/runtime/dist/executor/codexProtocol/v2/TurnError.js +2 -0
  234. package/vendor/runtime/dist/executor/codexProtocol/v2/TurnItemsView.d.ts +2 -0
  235. package/vendor/runtime/dist/executor/codexProtocol/v2/TurnItemsView.d.ts.map +1 -0
  236. package/vendor/runtime/dist/executor/codexProtocol/v2/TurnItemsView.js +2 -0
  237. package/vendor/runtime/dist/executor/codexProtocol/v2/TurnStatus.d.ts +2 -0
  238. package/vendor/runtime/dist/executor/codexProtocol/v2/TurnStatus.d.ts.map +1 -0
  239. package/vendor/runtime/dist/executor/codexProtocol/v2/TurnStatus.js +2 -0
  240. package/vendor/runtime/dist/executor/codexProtocol/v2/WebSearchAction.d.ts +15 -0
  241. package/vendor/runtime/dist/executor/codexProtocol/v2/WebSearchAction.d.ts.map +1 -0
  242. package/vendor/runtime/dist/executor/codexProtocol/v2/WebSearchAction.js +2 -0
  243. package/vendor/runtime/dist/executor/codexRpc.d.ts +3 -1
  244. package/vendor/runtime/dist/executor/codexRpc.d.ts.map +1 -1
  245. package/vendor/runtime/dist/executor/codexRpc.js +3 -2
  246. package/vendor/runtime/dist/executor/health.d.ts +6 -1
  247. package/vendor/runtime/dist/executor/health.d.ts.map +1 -1
  248. package/vendor/runtime/dist/executor/health.js +4 -0
  249. package/vendor/runtime/dist/executor/ownership.d.ts +6 -1
  250. package/vendor/runtime/dist/executor/ownership.d.ts.map +1 -1
  251. package/vendor/runtime/dist/executor/ownership.js +7 -0
  252. package/vendor/runtime/dist/executor/types.d.ts +25 -0
  253. package/vendor/runtime/dist/executor/types.d.ts.map +1 -1
  254. package/vendor/runtime/dist/harness/index.d.ts.map +1 -1
  255. package/vendor/runtime/dist/harness/index.js +1 -0
  256. package/vendor/runtime/dist/index.d.ts +1 -1
  257. package/vendor/runtime/dist/index.d.ts.map +1 -1
  258. package/vendor/runtime/src/executor/claudeAgent.ts +50 -4
  259. package/vendor/runtime/src/executor/codex.ts +51 -5
  260. package/vendor/runtime/src/executor/codexProtocol/AgentPath.ts +5 -0
  261. package/vendor/runtime/src/executor/codexProtocol/ImageGenerationFailure.ts +5 -0
  262. package/vendor/runtime/src/executor/codexProtocol/ImageGenerationItem.ts +7 -0
  263. package/vendor/runtime/src/executor/codexProtocol/LegacyAppPathString.ts +27 -0
  264. package/vendor/runtime/src/executor/codexProtocol/MessagePhase.ts +11 -0
  265. package/vendor/runtime/src/executor/codexProtocol/SleepItem.ts +8 -0
  266. package/vendor/runtime/src/executor/codexProtocol/SubAgentSource.ts +7 -0
  267. package/vendor/runtime/src/executor/codexProtocol/ThreadId.ts +10 -0
  268. package/vendor/runtime/src/executor/codexProtocol/WebSearchItem.ts +14 -0
  269. package/vendor/runtime/src/executor/codexProtocol/v2/AgentMessageDelivery.ts +5 -0
  270. package/vendor/runtime/src/executor/codexProtocol/v2/AsyncUserInputQuestion.ts +5 -0
  271. package/vendor/runtime/src/executor/codexProtocol/v2/CodexErrorInfo.ts +12 -0
  272. package/vendor/runtime/src/executor/codexProtocol/v2/CollabAgentState.ts +6 -0
  273. package/vendor/runtime/src/executor/codexProtocol/v2/CollabAgentStatus.ts +5 -0
  274. package/vendor/runtime/src/executor/codexProtocol/v2/CollabAgentTool.ts +5 -0
  275. package/vendor/runtime/src/executor/codexProtocol/v2/CollabAgentToolCallStatus.ts +5 -0
  276. package/vendor/runtime/src/executor/codexProtocol/v2/CommandAction.ts +6 -0
  277. package/vendor/runtime/src/executor/codexProtocol/v2/CommandExecutionSource.ts +5 -0
  278. package/vendor/runtime/src/executor/codexProtocol/v2/CommandExecutionStatus.ts +5 -0
  279. package/vendor/runtime/src/executor/codexProtocol/v2/DynamicToolCallOutputContentItem.ts +5 -0
  280. package/vendor/runtime/src/executor/codexProtocol/v2/DynamicToolCallStatus.ts +5 -0
  281. package/vendor/runtime/src/executor/codexProtocol/v2/FileUpdateChange.ts +6 -0
  282. package/vendor/runtime/src/executor/codexProtocol/v2/GitInfo.ts +5 -0
  283. package/vendor/runtime/src/executor/codexProtocol/v2/HookPromptFragment.ts +5 -0
  284. package/vendor/runtime/src/executor/codexProtocol/v2/McpAppDisplayMode.ts +5 -0
  285. package/vendor/runtime/src/executor/codexProtocol/v2/McpAppUi.ts +9 -0
  286. package/vendor/runtime/src/executor/codexProtocol/v2/McpToolCallAppContext.ts +5 -0
  287. package/vendor/runtime/src/executor/codexProtocol/v2/McpToolCallError.ts +5 -0
  288. package/vendor/runtime/src/executor/codexProtocol/v2/McpToolCallResult.ts +6 -0
  289. package/vendor/runtime/src/executor/codexProtocol/v2/McpToolCallStatus.ts +5 -0
  290. package/vendor/runtime/src/executor/codexProtocol/v2/MemoryCitation.ts +6 -0
  291. package/vendor/runtime/src/executor/codexProtocol/v2/MemoryCitationEntry.ts +5 -0
  292. package/vendor/runtime/src/executor/codexProtocol/v2/MisalignmentErrorDetails.ts +18 -0
  293. package/vendor/runtime/src/executor/codexProtocol/v2/MisalignmentSteer.ts +5 -0
  294. package/vendor/runtime/src/executor/codexProtocol/v2/NonSteerableTurnKind.ts +5 -0
  295. package/vendor/runtime/src/executor/codexProtocol/v2/PatchApplyStatus.ts +5 -0
  296. package/vendor/runtime/src/executor/codexProtocol/v2/PatchChangeKind.ts +5 -0
  297. package/vendor/runtime/src/executor/codexProtocol/v2/SessionSource.ts +6 -0
  298. package/vendor/runtime/src/executor/codexProtocol/v2/SubAgentActivityKind.ts +5 -0
  299. package/vendor/runtime/src/executor/codexProtocol/v2/Thread.ts +104 -0
  300. package/vendor/runtime/src/executor/codexProtocol/v2/ThreadActiveFlag.ts +5 -0
  301. package/vendor/runtime/src/executor/codexProtocol/v2/ThreadHistoryMode.ts +5 -0
  302. package/vendor/runtime/src/executor/codexProtocol/v2/ThreadItem.ts +125 -0
  303. package/vendor/runtime/src/executor/codexProtocol/v2/ThreadReadParams.ts +12 -0
  304. package/vendor/runtime/src/executor/codexProtocol/v2/ThreadReadResponse.ts +6 -0
  305. package/vendor/runtime/src/executor/codexProtocol/v2/ThreadSection.ts +21 -0
  306. package/vendor/runtime/src/executor/codexProtocol/v2/ThreadSectionAppearance.ts +8 -0
  307. package/vendor/runtime/src/executor/codexProtocol/v2/ThreadStatus.ts +6 -0
  308. package/vendor/runtime/src/executor/codexProtocol/v2/Turn.ts +37 -0
  309. package/vendor/runtime/src/executor/codexProtocol/v2/TurnError.ts +11 -0
  310. package/vendor/runtime/src/executor/codexProtocol/v2/TurnItemsView.ts +5 -0
  311. package/vendor/runtime/src/executor/codexProtocol/v2/TurnStatus.ts +5 -0
  312. package/vendor/runtime/src/executor/codexProtocol/v2/WebSearchAction.ts +5 -0
  313. package/vendor/runtime/src/executor/codexRpc.ts +4 -2
  314. package/vendor/runtime/src/executor/health.ts +5 -1
  315. package/vendor/runtime/src/executor/ownership.ts +8 -1
  316. package/vendor/runtime/src/executor/types.ts +18 -1
  317. package/vendor/runtime/src/harness/index.ts +1 -0
  318. package/vendor/runtime/src/index.ts +1 -1
  319. package/vendor/shared/dist/automations.d.ts +34 -0
  320. package/vendor/shared/dist/automations.d.ts.map +1 -1
  321. package/vendor/shared/dist/automations.js +12 -0
  322. package/vendor/shared/dist/computer.d.ts +1 -1
  323. package/vendor/shared/dist/computer.d.ts.map +1 -1
  324. package/vendor/shared/dist/computer.js +1 -2
  325. package/vendor/shared/dist/constants.d.ts +1 -1
  326. package/vendor/shared/dist/constants.d.ts.map +1 -1
  327. package/vendor/shared/dist/constants.js +3 -10
  328. package/vendor/shared/dist/index.d.ts +4 -2
  329. package/vendor/shared/dist/index.d.ts.map +1 -1
  330. package/vendor/shared/dist/index.js +3 -1
  331. package/vendor/shared/dist/journal-vault.d.ts +1 -1
  332. package/vendor/shared/dist/messagingSafety.d.ts +21 -0
  333. package/vendor/shared/dist/messagingSafety.d.ts.map +1 -0
  334. package/vendor/shared/dist/messagingSafety.js +8 -0
  335. package/vendor/shared/dist/schemas/harness.d.ts +98 -169
  336. package/vendor/shared/dist/schemas/harness.d.ts.map +1 -1
  337. package/vendor/shared/dist/schemas/harness.js +19 -124
  338. package/vendor/shared/dist/smartCapture.d.ts +24 -0
  339. package/vendor/shared/dist/smartCapture.d.ts.map +1 -1
  340. package/vendor/shared/dist/smartCapture.js +15 -0
  341. package/vendor/shared/dist/taskSync.d.ts +342 -0
  342. package/vendor/shared/dist/taskSync.d.ts.map +1 -0
  343. package/vendor/shared/dist/taskSync.js +111 -0
  344. package/vendor/shared/dist/types.d.ts +1 -4
  345. package/vendor/shared/dist/types.d.ts.map +1 -1
  346. package/vendor/shared/dist/voiceCapture.d.ts +1 -1
  347. package/vendor/shared/dist/workspaces.d.ts +117 -0
  348. package/vendor/shared/dist/workspaces.d.ts.map +1 -1
  349. package/vendor/shared/dist/workspaces.js +50 -1
  350. package/vendor/shared/src/automations.ts +12 -0
  351. package/vendor/shared/src/computer.ts +3 -3
  352. package/vendor/shared/src/constants.ts +3 -10
  353. package/vendor/shared/src/index.ts +3 -6
  354. package/vendor/shared/src/messagingSafety.ts +11 -0
  355. package/vendor/shared/src/schemas/harness.ts +18 -130
  356. package/vendor/shared/src/smartCapture.ts +27 -0
  357. package/vendor/shared/src/taskSync.ts +81 -0
  358. package/vendor/shared/src/types.ts +0 -6
  359. package/vendor/shared/src/workspaces.ts +56 -1
  360. package/dist/coding/conduct.d.ts +0 -48
  361. package/dist/coding/conduct.d.ts.map +0 -1
  362. package/dist/coding/conduct.js +0 -263
  363. package/dist/coding/fleetPlan.d.ts +0 -20
  364. package/dist/coding/fleetPlan.d.ts.map +0 -1
  365. package/dist/coding/fleetPlan.js +0 -125
  366. package/dist/coding/fleetTasks.d.ts +0 -33
  367. package/dist/coding/fleetTasks.d.ts.map +0 -1
  368. package/dist/coding/fleetTasks.js +0 -75
  369. package/src/coding/conduct.ts +0 -325
  370. package/src/coding/fleetPlan.ts +0 -135
  371. package/src/coding/fleetTasks.ts +0 -109
@@ -0,0 +1,81 @@
1
+ import { z } from 'zod';
2
+ import { CreateTaskSchema, UpdateTaskSchema } from './schemas/task.js';
3
+ import { CreateProjectSchema } from './schemas/project.js';
4
+ import { CreateMilestoneSchema } from './schemas/milestone.js';
5
+ import { UpdateOccurrenceSchema } from './recurrence.js';
6
+
7
+ export const TASK_SYNC_VERSION = '1';
8
+ export const TASK_SYNC_VERSION_HEADER = 'X-Lucidity-Sync-Version';
9
+ export const TASK_SYNC_OPERATION_HEADER = 'X-Lucidity-Operation-Id';
10
+
11
+ export const OccurrenceIdentitySchema = z.object({ version: z.number().int().min(1), ordinal: z.number().int().min(0).max(100000) }).strict();
12
+ const taskId = z.uuidv7();
13
+ export const TaskSyncActionSchema = z.discriminatedUnion('kind', [
14
+ z.object({ kind: z.literal('create_project'), data: CreateProjectSchema.extend({ id: taskId }).strict() }).strict(),
15
+ z.object({ kind: z.literal('create_milestone'), data: CreateMilestoneSchema.extend({ id: taskId }).strict() }).strict(),
16
+ z.object({ kind: z.literal('reorder'), taskIds: z.array(taskId).min(1).max(1000).refine(ids => new Set(ids).size === ids.length, 'Task IDs must be distinct') }).strict(),
17
+ z.object({ kind: z.literal('create'), data: CreateTaskSchema.extend({ id: taskId }).strict() }).strict(),
18
+ z.object({ kind: z.literal('update'), taskId, data: UpdateTaskSchema.strict() }).strict(),
19
+ z.object({ kind: z.literal('complete'), taskId, state: z.enum(['pending', 'completed']), occurrenceId: z.uuid().optional(), occurrenceIdentity: OccurrenceIdentitySchema.optional() }).strict(),
20
+ z.object({ kind: z.literal('occurrence'), taskId, occurrenceId: z.uuid(), occurrenceIdentity: OccurrenceIdentitySchema.optional(), data: UpdateOccurrenceSchema.strict() }).strict(),
21
+ z.object({ kind: z.literal('trash'), taskId }).strict(),
22
+ z.object({ kind: z.literal('restore'), taskId, deletionBatchId: z.uuid() }).strict(),
23
+ ]);
24
+ export type TaskSyncAction = z.infer<typeof TaskSyncActionSchema>;
25
+
26
+ export const TaskSyncCommandSchema = z.object({
27
+ version: z.literal(1),
28
+ operationId: z.uuid(),
29
+ action: TaskSyncActionSchema,
30
+ }).strict();
31
+ export type TaskSyncCommand = z.infer<typeof TaskSyncCommandSchema>;
32
+
33
+ export const TaskSyncAckSchema = z.object({ operationId: z.uuid(), accepted: z.literal(true) });
34
+
35
+ export function taskSyncRequest(command: TaskSyncCommand) {
36
+ const { action } = command;
37
+ const base = '/api/tasks';
38
+ let method: string, path: string, body: unknown;
39
+ switch (action.kind) {
40
+ case 'create_project': method = 'POST'; path = '/api/projects'; body = action.data; break;
41
+ case 'create_milestone': method = 'POST'; path = '/api/milestones'; body = action.data; break;
42
+ case 'reorder': method = 'PATCH'; path = `${base}/reorder`; body = { taskIds: action.taskIds }; break;
43
+ case 'create': method = 'POST'; path = base; body = action.data; break;
44
+ case 'update': method = 'PATCH'; path = `${base}/${action.taskId}`; body = action.data; break;
45
+ case 'complete':
46
+ method = 'PATCH'; path = `${base}/${action.taskId}/complete`;
47
+ body = { state: action.state, occurrenceId: action.occurrenceId, occurrenceIdentity: action.occurrenceIdentity }; break;
48
+ case 'occurrence': method = 'PATCH'; path = `${base}/${action.taskId}/occurrences/${action.occurrenceId}`; body = { ...action.data, occurrenceIdentity: action.occurrenceIdentity }; break;
49
+ case 'trash': method = 'DELETE'; path = `${base}/${action.taskId}`; break;
50
+ case 'restore': method = 'POST'; path = `${base}/${action.taskId}/restore`; body = { deletionBatchId: action.deletionBatchId }; break;
51
+ }
52
+ return { path, method, body: body === undefined ? undefined : JSON.stringify(body), headers: {
53
+ [TASK_SYNC_VERSION_HEADER]: TASK_SYNC_VERSION,
54
+ [TASK_SYNC_OPERATION_HEADER]: command.operationId,
55
+ } };
56
+ }
57
+
58
+ /** Restrict retryable uploads to the domain actions covered by this protocol. */
59
+ export function parseTaskSyncAction(method: string, path: string, body: unknown): TaskSyncAction {
60
+ const parts = path.split('/').filter(Boolean);
61
+ if (parts.length === 2 && parts[0] === 'api' && method === 'POST' && ['projects', 'milestones'].includes(parts[1]!)) {
62
+ return TaskSyncActionSchema.parse({ kind: parts[1] === 'projects' ? 'create_project' : 'create_milestone', data: body });
63
+ }
64
+ if (parts[0] !== 'api' || parts[1] !== 'tasks') throw new Error('Unsupported sync action');
65
+ let action: unknown;
66
+ if (parts.length === 2 && method === 'POST') action = { kind: 'create', data: body };
67
+ if (parts.length === 3 && method === 'PATCH') action = { kind: 'update', taskId: parts[2], data: body };
68
+ if (parts.length === 3 && parts[2] === 'reorder' && method === 'PATCH') action = { ...body as object, kind: 'reorder' };
69
+ if (parts.length === 3 && method === 'DELETE' && body === undefined) action = { kind: 'trash', taskId: parts[2] };
70
+ if (parts.length === 4 && parts[3] === 'complete' && method === 'PATCH') {
71
+ action = { ...body as object, kind: 'complete', taskId: parts[2] };
72
+ }
73
+ if (parts.length === 4 && parts[3] === 'restore' && method === 'POST') {
74
+ action = { ...body as object, kind: 'restore', taskId: parts[2] };
75
+ }
76
+ if (parts.length === 5 && parts[3] === 'occurrences' && method === 'PATCH') {
77
+ const { occurrenceIdentity, ...data } = (body ?? {}) as Record<string, unknown>;
78
+ action = { kind: 'occurrence', taskId: parts[2], occurrenceId: parts[4], occurrenceIdentity, data };
79
+ }
80
+ return TaskSyncActionSchema.parse(action);
81
+ }
@@ -130,9 +130,6 @@ import {
130
130
  BriefingRequestSchema,
131
131
  JournalRequestSchema,
132
132
  CodeRequestSchema,
133
- ConductRequestSchema,
134
- FleetPlanSchema,
135
- FleetWorkerSchema,
136
133
  RepoListRequestSchema,
137
134
  ListPrsRequestSchema,
138
135
  GetConfigRequestSchema,
@@ -276,9 +273,6 @@ export type AskRequest = z.input<typeof AskRequestSchema>;
276
273
  export type BriefingRequest = z.input<typeof BriefingRequestSchema>;
277
274
  export type JournalRequest = z.input<typeof JournalRequestSchema>;
278
275
  export type CodeRequest = z.input<typeof CodeRequestSchema>;
279
- export type ConductRequest = z.input<typeof ConductRequestSchema>;
280
- export type FleetPlan = z.infer<typeof FleetPlanSchema>;
281
- export type FleetWorker = z.infer<typeof FleetWorkerSchema>;
282
276
  export type RepoListRequest = z.input<typeof RepoListRequestSchema>;
283
277
  export type RepoListResponse = z.infer<typeof RepoListResponseSchema>;
284
278
  export type ListPrsRequest = z.input<typeof ListPrsRequestSchema>;
@@ -4,6 +4,28 @@ export const SavedChatMessageSchema = z.object({
4
4
  id: z.string().min(1), role: z.enum(['user', 'lucid', 'notice']), text: z.string(),
5
5
  }).passthrough();
6
6
 
7
+ /** How one repository's worktrees are prepared. Stored on the computer and edited from the phone. */
8
+ export const RepoSettingsSchema = z.object({
9
+ /** Gitignored files copied from the main checkout into a new worktree. Wildcards in the file name only. */
10
+ copy: z.array(z.string().trim().min(1).max(300)).max(50).default([]),
11
+ /** Shell command run in a new worktree once those files are in place. */
12
+ setup: z.string().trim().max(2000).optional(),
13
+ /** Remote branch new worktrees start from, e.g. `origin/main`. Unset uses the remote default. */
14
+ baseRef: z.string().trim().max(200).optional(),
15
+ /** Shell command run in a worktree just before it is archived. A failure stops the archive. */
16
+ archiveScript: z.string().trim().max(2000).optional(),
17
+ /** Archive a worktree once the pull request for its branch has merged. */
18
+ archiveOnMerge: z.boolean().optional(),
19
+ /** Delete the local branch when a worktree is archived. Restore brings it back from the snapshot. */
20
+ deleteBranchOnArchive: z.boolean().optional(),
21
+ });
22
+ /** Where a repository lives on the computer, and what its copy list matches there right now. */
23
+ export const RepoPlacesSchema = z.object({
24
+ root: z.string(), worktrees: z.string(), copyMatches: z.array(z.string()),
25
+ });
26
+ export type RepoPlaces = z.infer<typeof RepoPlacesSchema>;
27
+ export type RepoSettings = z.infer<typeof RepoSettingsSchema>;
28
+
7
29
  export const WorkerWorkspaceSchema = z.object({
8
30
  workerId: z.uuidv7(), repoId: z.string().min(1), title: z.string().min(1).max(200),
9
31
  brief: z.string().max(8000).default(''),
@@ -11,16 +33,26 @@ export const WorkerWorkspaceSchema = z.object({
11
33
  state: z.enum(['creating', 'ready', 'setup_failed', 'archived']),
12
34
  branch: z.string().optional(), baseRef: z.string().optional(), baseSha: z.string().optional(),
13
35
  resume: z.string().optional(), error: z.string().optional(),
36
+ /** The setup command's progress on a ready worktree. A failure's output is in `error`. */
37
+ setup: z.enum(['running', 'failed']).optional(),
38
+ /** First of the ten ports reserved for this worktree's servers. */
39
+ port: z.number().int().min(1024).max(65525).optional(),
14
40
  createdAt: z.string(), updatedAt: z.string(),
15
41
  });
16
42
  export type WorkerWorkspace = z.infer<typeof WorkerWorkspaceSchema>;
17
43
 
18
44
  export const WorkspaceCommandSchema = z.object({
19
- action: z.enum(['list', 'create', 'history', 'archive', 'restore', 'import', 'clear-history']),
45
+ action: z.enum(['list', 'create', 'history', 'archive', 'restore', 'import', 'clear-history', 'inspect-run', 'continue-run',
46
+ 'settings', 'save-settings', 'setup', 'delete']),
47
+ requestId: z.uuidv7().optional(), reviewId: z.uuidv7().optional(),
48
+ instruction: z.string().trim().min(1).max(8000).optional(),
20
49
  repoId: z.string().min(1).optional(), workerId: z.uuidv7().optional(),
21
50
  checkout: z.boolean().optional(), revision: z.string().optional(),
22
51
  title: z.string().trim().min(1).max(200).optional(),
23
52
  brief: z.string().max(8000).optional(), before: z.string().optional(),
53
+ settings: RepoSettingsSchema.optional(),
54
+ /** `delete` only: go ahead even though the worktree holds work that is not in the base branch. */
55
+ force: z.boolean().optional(),
24
56
  legacy: z.object({
25
57
  messages: z.array(SavedChatMessageSchema).max(10_000), resume: z.string().optional(),
26
58
  sessionCheckout: z.boolean().optional(),
@@ -28,6 +60,14 @@ export const WorkspaceCommandSchema = z.object({
28
60
  });
29
61
  export type WorkspaceCommand = z.infer<typeof WorkspaceCommandSchema>;
30
62
 
63
+ /** Work an archived worktree still holds that is neither in the repository's base branch nor pushed. */
64
+ export const UnmergedWorkSchema = z.object({
65
+ commits: z.number().int().min(0),
66
+ /** The archive snapshot holds files that were never committed. */
67
+ uncommitted: z.boolean(),
68
+ });
69
+ export type UnmergedWork = z.infer<typeof UnmergedWorkSchema>;
70
+
31
71
  export const WorkspaceRunSchema = z.object({
32
72
  requestId: z.string(), prompt: z.string(),
33
73
  handoff: z.object({ from: z.enum(['claude', 'codex']), to: z.enum(['claude', 'codex']) }).optional(),
@@ -35,8 +75,19 @@ export const WorkspaceRunSchema = z.object({
35
75
  terminated: z.boolean(),
36
76
  });
37
77
  export type WorkspaceRun = z.infer<typeof WorkspaceRunSchema>;
78
+ export const RunReviewSchema = z.object({
79
+ requestId: z.uuidv7(), reviewId: z.uuidv7(), inspectedAt: z.string(),
80
+ prompt: z.string(), workspace: z.string().optional(), branch: z.string().optional(),
81
+ changes: z.string(), diff: z.string(), inspectionError: z.string().optional(),
82
+ progress: z.string(), answer: z.string().optional(), evidence: z.string(),
83
+ tools: z.array(z.object({ name: z.string(), phase: z.string(), itemId: z.string().optional(), outcome: z.string().optional() })),
84
+ unresolved: z.array(z.string()),
85
+ continuationId: z.uuidv7(), continuedAt: z.string().optional(), instruction: z.string().optional(),
86
+ });
87
+ export type RunReview = z.infer<typeof RunReviewSchema>;
38
88
  export const WorkspaceSnapshotSchema = z.object({
39
89
  workers: z.array(WorkerWorkspaceSchema),
90
+ review: RunReviewSchema.optional(),
40
91
  checkout: z.object({
41
92
  repoId: z.string(), conversationId: z.string(), revision: z.string(),
42
93
  resume: z.string().optional(),
@@ -44,5 +95,9 @@ export const WorkspaceSnapshotSchema = z.object({
44
95
  runs: z.array(WorkspaceRunSchema).optional(),
45
96
  legacyMessages: z.array(SavedChatMessageSchema).optional(),
46
97
  nextBefore: z.string().optional(),
98
+ settings: RepoSettingsSchema.optional(),
99
+ places: RepoPlacesSchema.optional(),
100
+ /** A `delete` that was not carried out: what would be lost. Sending it again with `force` deletes. */
101
+ unmerged: UnmergedWorkSchema.optional(),
47
102
  });
48
103
  export type WorkspaceSnapshot = z.infer<typeof WorkspaceSnapshotSchema>;
@@ -1,48 +0,0 @@
1
- import type { AgentExecutor } from '@lucidity/runtime';
2
- import type { FleetPlan, HarnessImage } from '@lucidity/shared';
3
- import type { RepoEntry } from '../config.js';
4
- import { type CodeTurnRequest, type RunCodeTurnDeps } from './runCodeTurn.js';
5
- /** Compatibility handler for older phones. Workers persist after every turn. */
6
- export interface ConductTurnRequest {
7
- id: string;
8
- repoId: string;
9
- phase: 'plan' | 'run' | 'setup' | 'integrate';
10
- prompt: string;
11
- images?: HarnessImage[];
12
- plan?: FleetPlan;
13
- resume?: string;
14
- /** Skip the dogfood task graph (quick incremental spawn — the fleet UI tracks it anyway). */
15
- ephemeral?: boolean;
16
- }
17
- type Api = {
18
- request<T>(endpoint: string, options?: RequestInit): Promise<T>;
19
- };
20
- export interface RunConductTurnDeps {
21
- repos: RepoEntry[];
22
- executor: AgentExecutor;
23
- onWorkerApproval?: (requestId: string, approval: import('@lucidity/runtime').ExecutorApproval) => Promise<boolean>;
24
- onEnd?: (requestId: string) => void;
25
- send: (obj: unknown) => void;
26
- signal?: AbortSignal;
27
- model?: string;
28
- effort?: string;
29
- /** Task API for the dogfood (goal + subtasks). Absent → tasks are skipped, fleet still runs. */
30
- api?: Api;
31
- /** Project the fleet's tasks land in. Absent → the Inbox (projectId null). */
32
- projectId?: string | null;
33
- /** Default parallel-worker cap when the plan doesn't set one (quota guard). */
34
- maxParallel?: number;
35
- /** Worktree base override (tests point it at a temp dir). */
36
- baseDir?: string;
37
- /** Seam: run one worker's coding turn. Defaults to {@link runCodeTurn}. */
38
- runWorker?: (req: CodeTurnRequest, deps: RunCodeTurnDeps) => Promise<void>;
39
- }
40
- /** Count +/- lines and files in a unified diff, for a worker card's "+N −M". */
41
- export declare function diffStat(diff: string): {
42
- added: number;
43
- removed: number;
44
- files: number;
45
- };
46
- export declare function runConductTurn(req: ConductTurnRequest, deps: RunConductTurnDeps): Promise<void>;
47
- export {};
48
- //# sourceMappingURL=conduct.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"conduct.d.ts","sourceRoot":"","sources":["../../src/coding/conduct.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAgB,MAAM,kBAAkB,CAAC;AAC9E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAK9C,OAAO,EAAe,KAAK,eAAe,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAE3F,gFAAgF;AAEhF,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,WAAW,CAAC;IAC9C,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,YAAY,EAAE,CAAC;IACxB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6FAA6F;IAC7F,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,KAAK,GAAG,GAAG;IAAE,OAAO,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;CAAE,CAAC;AAE/E,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,QAAQ,EAAE,aAAa,CAAC;IACxB,gBAAgB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,mBAAmB,EAAE,gBAAgB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACnH,KAAK,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,IAAI,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7B,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gGAAgG;IAChG,GAAG,CAAC,EAAE,GAAG,CAAC;IACV,8EAA8E;IAC9E,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,+EAA+E;IAC/E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6DAA6D;IAC7D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2EAA2E;IAC3E,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,eAAe,EAAE,IAAI,EAAE,eAAe,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAE5E;AAQD,gFAAgF;AAChF,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAWxF;AAoBD,wBAAsB,cAAc,CAClC,GAAG,EAAE,kBAAkB,EACvB,IAAI,EAAE,kBAAkB,GACvB,OAAO,CAAC,IAAI,CAAC,CA0Bf"}
@@ -1,263 +0,0 @@
1
- import { resolveRepo } from './repos.js';
2
- import { isAbortError } from '../streamDeadline.js';
3
- import { buildConductPlanPrompt, parseFleetPlan } from './fleetPlan.js';
4
- import { createFleetTasks, syncWorkerStatus } from './fleetTasks.js';
5
- import { runCodeTurn } from './runCodeTurn.js';
6
- const DEFAULT_MAX_PARALLEL = 2;
7
- function msg(e) {
8
- return e instanceof Error ? e.message : String(e);
9
- }
10
- /** Count +/- lines and files in a unified diff, for a worker card's "+N −M". */
11
- export function diffStat(diff) {
12
- let added = 0;
13
- let removed = 0;
14
- let files = 0;
15
- for (const line of diff.split('\n')) {
16
- if (line.startsWith('+++') || line.startsWith('---'))
17
- continue;
18
- if (line.startsWith('diff --git'))
19
- files++;
20
- else if (line.startsWith('+'))
21
- added++;
22
- else if (line.startsWith('-'))
23
- removed++;
24
- }
25
- return { added, removed, files };
26
- }
27
- /** Run `fn` over `items` with at most `cap` in flight. */
28
- async function runWithCap(items, cap, fn) {
29
- const queue = [...items];
30
- const lanes = Array.from({ length: Math.max(1, Math.min(cap, items.length || 1)) }, async () => {
31
- for (let item = queue.shift(); item !== undefined; item = queue.shift()) {
32
- await fn(item);
33
- }
34
- });
35
- await Promise.all(lanes);
36
- }
37
- export async function runConductTurn(req, deps) {
38
- const repo = resolveRepo(req.repoId, deps.repos);
39
- if (!repo) {
40
- deps.send({
41
- type: 'error',
42
- requestId: req.id,
43
- message: `Repo "${req.repoId}" isn't on this daemon's allowlist.`,
44
- });
45
- return;
46
- }
47
- if (!deps.executor.runStream) {
48
- deps.send({
49
- type: 'error',
50
- requestId: req.id,
51
- message: 'The conductor needs a streaming executor.',
52
- });
53
- return;
54
- }
55
- if (req.phase === 'plan')
56
- return planPhase(req, deps, repo.root);
57
- if (req.phase === 'setup')
58
- return setupPhase(req, deps);
59
- if (req.phase === 'integrate') {
60
- deps.send({ type: 'error', requestId: req.id, message: 'Open a worker chat and ask to create or merge its PR. Workers are kept until archived.' });
61
- return;
62
- }
63
- return runPhase(req, deps);
64
- }
65
- /**
66
- * Design-first flow: materialize an approved plan WITHOUT writing any code. Create the task graph
67
- * (worker = subtask) and announce each worker as `queued`, then finish. The phone drives each
68
- * worker from here with `code` turns carrying its `workerId` (a conversation, in the worker's own
69
- * `fleet/<repo>/<workerId>` worktree), and merges with a later `integrate`. The counterpart to
70
- * `run`, which instead codes everything itself.
71
- */
72
- async function setupPhase(req, deps) {
73
- const plan = req.plan;
74
- if (!plan) {
75
- deps.send({ type: 'error', requestId: req.id, message: 'Setup needs an approved plan.' });
76
- return;
77
- }
78
- let parentTaskId;
79
- if (deps.api) {
80
- try {
81
- ({ parentTaskId } = await createFleetTasks(deps.api, plan, { projectId: deps.projectId }));
82
- }
83
- catch (err) {
84
- console.error(`[conduct] couldn't create the fleet task graph: ${msg(err)}`);
85
- }
86
- }
87
- deps.send({
88
- type: 'fleet_plan',
89
- requestId: req.id,
90
- plan: { ...plan, ...(parentTaskId ? { parentTaskId } : {}) },
91
- });
92
- for (const w of plan.workers) {
93
- deps.send({ type: 'worker_status', requestId: req.id, workerId: w.workerId, status: 'queued' });
94
- if (deps.api)
95
- void syncWorkerStatus(deps.api, w.workerId, 'queued');
96
- }
97
- deps.send({
98
- type: 'done',
99
- requestId: req.id,
100
- text: `Fleet set up: ${plan.workers.length} worker${plan.workers.length === 1 ? '' : 's'} ready to brief.`,
101
- });
102
- }
103
- /** Read-only lead turn → a FleetPlan, streamed back as a fleet_plan event. Creates nothing. */
104
- async function planPhase(req, deps, repoRoot) {
105
- let text = '';
106
- let sessionId;
107
- try {
108
- for await (const ev of deps.executor.runStream({
109
- requestId: req.id,
110
- userPrompt: buildConductPlanPrompt(req.prompt),
111
- cwd: repoRoot,
112
- // Auto mode lets the lead READ the repo (ls/grep/cat) to inform the split; a mutating
113
- // tool has no approver here, so the prompt tells it to plan only, never edit.
114
- // Read-only: the lead may ls/grep/cat the repo to inform the split but must never edit
115
- // the user's live checkout. `plan` mode blocks every mutating tool, so even an off-script
116
- // or prompt-injected planning turn can't touch the working tree.
117
- permissionMode: 'plan',
118
- model: deps.model,
119
- effort: deps.effort,
120
- resume: req.resume,
121
- signal: deps.signal,
122
- })) {
123
- if (ev.type === 'session') {
124
- deps.send({ type: 'session', requestId: req.id, sessionId: ev.sessionId });
125
- }
126
- else if (ev.type === 'delta') {
127
- text += ev.text;
128
- deps.send({ type: 'delta', requestId: req.id, text: ev.text });
129
- }
130
- else if (ev.type === 'tool_call') {
131
- deps.send({ type: 'tool_call', requestId: req.id, name: ev.name, phase: ev.phase });
132
- }
133
- else if (ev.type === 'done') {
134
- sessionId = ev.sessionId;
135
- }
136
- }
137
- }
138
- catch (err) {
139
- if (isAbortError(err))
140
- return;
141
- deps.send({ type: 'error', requestId: req.id, message: msg(err) });
142
- return;
143
- }
144
- let plan;
145
- try {
146
- plan = parseFleetPlan(text, { goal: req.prompt });
147
- }
148
- catch (err) {
149
- deps.send({
150
- type: 'error',
151
- requestId: req.id,
152
- message: `Couldn't turn that into a fan-out plan: ${msg(err)}`,
153
- });
154
- return;
155
- }
156
- deps.send({ type: 'fleet_plan', requestId: req.id, plan });
157
- deps.send({ type: 'done', requestId: req.id, text, sessionId });
158
- }
159
- /** Run legacy worker requests without publication or workspace cleanup. */
160
- async function runPhase(req, deps) {
161
- const plan = req.plan;
162
- if (!plan) {
163
- deps.send({
164
- type: 'error',
165
- requestId: req.id,
166
- message: 'A run needs an approved plan.',
167
- });
168
- return;
169
- }
170
- const emitStatus = (workerId, status, extra) => deps.send({
171
- type: 'worker_status',
172
- requestId: req.id,
173
- workerId,
174
- status,
175
- ...(extra?.detail ? { detail: extra.detail } : {}),
176
- ...(extra?.diffStat ? { diffStat: extra.diffStat } : {}),
177
- });
178
- const sync = (workerId, status) => deps.api && !req.ephemeral ? syncWorkerStatus(deps.api, workerId, status) : Promise.resolve();
179
- // Dogfood: the goal + one subtask per worker (worker = subtask). Skipped for ephemeral spawns so
180
- // quick incremental tasks don't spam the board. Best-effort; a fleet still runs if it can't write.
181
- let parentTaskId;
182
- if (deps.api && !req.ephemeral) {
183
- try {
184
- ({ parentTaskId } = await createFleetTasks(deps.api, plan, {
185
- projectId: deps.projectId,
186
- }));
187
- }
188
- catch (err) {
189
- console.error(`[conduct] couldn't create the fleet task graph: ${msg(err)}`);
190
- }
191
- }
192
- // Echo the plan with the parent id so the phone can link the Fleet board to the goal task.
193
- deps.send({
194
- type: 'fleet_plan',
195
- requestId: req.id,
196
- plan: { ...plan, ...(parentTaskId ? { parentTaskId } : {}) },
197
- });
198
- const runWorker = deps.runWorker ?? runCodeTurn;
199
- const cap = plan.maxParallel ?? deps.maxParallel ?? DEFAULT_MAX_PARALLEL;
200
- const diffStats = new Map();
201
- await runWithCap(plan.workers, cap, async (w) => {
202
- // A cancel mid-fleet drops the workers still queued behind the cap — we don't spin up new
203
- // worktrees for a run the user has already stopped.
204
- if (deps.signal?.aborted)
205
- return;
206
- emitStatus(w.workerId, 'working');
207
- await sync(w.workerId, 'working');
208
- // The worker's code frames already carry requestId === workerId (we set the turn id to it),
209
- // so we forward them verbatim — the phone routes them to the worker's lane through the
210
- // existing code-turn rendering. We only peek to capture the diff size and any error.
211
- let sawError = false;
212
- let wasCancelled = false;
213
- const workerSend = (obj) => {
214
- const o = obj;
215
- if (o?.type === 'code_result' && typeof o.diff === 'string') {
216
- diffStats.set(w.workerId, diffStat(o.diff));
217
- }
218
- if (o?.type === 'error')
219
- sawError = true;
220
- if (o?.type === 'cancelled') {
221
- wasCancelled = true;
222
- sawError = true;
223
- }
224
- deps.send(obj);
225
- };
226
- try {
227
- await runWorker({
228
- id: w.workerId,
229
- repoId: req.repoId,
230
- workerId: w.workerId,
231
- prompt: w.brief,
232
- }, {
233
- repos: deps.repos,
234
- executor: deps.executor,
235
- onApproval: deps.onWorkerApproval ? (approval) => deps.onWorkerApproval(w.workerId, approval) : undefined,
236
- send: workerSend,
237
- signal: deps.signal,
238
- model: deps.model,
239
- effort: deps.effort,
240
- baseDir: deps.baseDir,
241
- });
242
- }
243
- catch (err) {
244
- if (!isAbortError(err))
245
- sawError = true;
246
- }
247
- finally {
248
- deps.onEnd?.(w.workerId);
249
- }
250
- if (sawError) {
251
- emitStatus(w.workerId, 'failed', wasCancelled ? { detail: 'Stopped' } : undefined);
252
- await sync(w.workerId, 'failed');
253
- }
254
- else {
255
- emitStatus(w.workerId, 'review', { diffStat: diffStats.get(w.workerId) });
256
- await sync(w.workerId, 'review');
257
- }
258
- });
259
- if (deps.signal?.aborted)
260
- return;
261
- deps.send({ type: 'fleet_done', requestId: req.id, delivered: 0, total: plan.workers.length });
262
- deps.send({ type: 'done', requestId: req.id, text: 'Workers are ready for follow-up in their chats.' });
263
- }
@@ -1,20 +0,0 @@
1
- import { type FleetPlan } from '@lucidity/shared';
2
- export declare function buildConductPlanPrompt(goal: string): string;
3
- /** Do two owned-path entries cover any of the same tree — the same file, or one a directory of
4
- * the other? (`src/config.ts` vs `src/config.ts`; `src` vs `src/config.ts`.) */
5
- export declare function pathsOverlap(a: string, b: string): boolean;
6
- /** Every worker pair whose owned paths intersect, with the offending paths — the Fan-out card's
7
- * ⚠, and what tells the runner these two must integrate sequentially rather than race a merge. */
8
- export declare function detectOverlaps(workers: FleetPlan['workers']): FleetPlan['overlaps'];
9
- /**
10
- * Parse the lead's answer into a validated FleetPlan, minting a stable `workerId` (uuidv7) per
11
- * worker — the id doubles as the fleet subtask's id and the stream id its code frames arrive
12
- * under. `genId` is injectable so tests get deterministic ids. Throws on unparseable output.
13
- */
14
- export declare function parseFleetPlan(modelText: string, opts: {
15
- goal: string;
16
- genId?: () => string;
17
- }): FleetPlan;
18
- /** Workers in the order their branches should integrate (lower mergeOrder first, stable). */
19
- export declare function integrationOrder(plan: FleetPlan): FleetPlan['workers'];
20
- //# sourceMappingURL=fleetPlan.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fleetPlan.d.ts","sourceRoot":"","sources":["../../src/coding/fleetPlan.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAwBnE,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAoB3D;AAWD;iFACiF;AACjF,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAK1D;AAED;mGACmG;AACnG,wBAAgB,cAAc,CAC5B,OAAO,EAAE,SAAS,CAAC,SAAS,CAAC,GAC5B,SAAS,CAAC,UAAU,CAAC,CAoBvB;AAaD;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,MAAM,CAAA;CAAE,GAC3C,SAAS,CAkBX;AAED,6FAA6F;AAC7F,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,SAAS,GAAG,SAAS,CAAC,SAAS,CAAC,CAEtE"}