@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,15 @@
1
+ export type WebSearchAction = {
2
+ "type": "search";
3
+ query: string | null;
4
+ queries: Array<string> | null;
5
+ } | {
6
+ "type": "openPage";
7
+ url: string | null;
8
+ } | {
9
+ "type": "findInPage";
10
+ url: string | null;
11
+ pattern: string | null;
12
+ } | {
13
+ "type": "other";
14
+ };
15
+ //# sourceMappingURL=WebSearchAction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebSearchAction.d.ts","sourceRoot":"","sources":["../../../../src/executor/codexProtocol/v2/WebSearchAction.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,eAAe,GAAG;IAAE,MAAM,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;CAAE,GAAG;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CAAE,GAAG;IAAE,MAAM,EAAE,YAAY,CAAC;IAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CAAE,GAAG;IAAE,MAAM,EAAE,OAAO,CAAA;CAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ // GENERATED CODE! DO NOT MODIFY BY HAND!
2
+ export {};
@@ -10,6 +10,7 @@ export interface RpcMessage {
10
10
  };
11
11
  }
12
12
  export interface CodexConnection {
13
+ readonly pid?: number;
13
14
  readonly isConnected?: boolean;
14
15
  events: AsyncIterable<RpcMessage>;
15
16
  request<T>(method: string, params: unknown): Promise<T>;
@@ -22,6 +23,7 @@ export interface CodexConnection {
22
23
  export declare function codexSubscriptionEnv(): NodeJS.ProcessEnv;
23
24
  /** Bidirectional stdio JSON-RPC. Pending requests fail on timeout or child exit. */
24
25
  export declare class CodexRpc implements CodexConnection {
26
+ get pid(): number | undefined;
25
27
  readonly events: AsyncQueue<RpcMessage>;
26
28
  onRequest?: (message: RpcMessage) => Promise<unknown>;
27
29
  private child;
@@ -31,7 +33,7 @@ export declare class CodexRpc implements CodexConnection {
31
33
  private idle;
32
34
  get isConnected(): boolean;
33
35
  private pending;
34
- constructor(command?: string, cwd?: string);
36
+ constructor(command?: string, cwd?: string, env?: Record<string, string>);
35
37
  private write;
36
38
  setIdle(idle: boolean): void;
37
39
  notify(method: string, params?: unknown): void;
@@ -1 +1 @@
1
- {"version":3,"file":"codexRpc.d.ts","sourceRoot":"","sources":["../../src/executor/codexRpc.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAQ7C,eAAO,MAAM,qBAAqB,YAAY,CAAC;AAC/C,MAAM,WAAW,UAAU;IACzB,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CAC7B;AACD,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAC/B,MAAM,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;IAClC,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACxD,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IACpD,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,UAAU,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACtD,oFAAoF;IACpF,OAAO,CAAC,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAAC;IAC9B,KAAK,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/B;AAED,wBAAgB,oBAAoB,IAAI,MAAM,CAAC,UAAU,CAKxD;AAED,oFAAoF;AACpF,qBAAa,QAAS,YAAW,eAAe;IAC9C,QA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;gBAEQ,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAqExE,OAAO,CAAC,KAAK;IAIb,OAAO,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI;IAI5B,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,IAAI;IAG9C,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI;IAGnD,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;IAsBvD,OAAO,CAAC,MAAM;IAgBR,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAI7B;AAED,wBAAsB,eAAe,CAAC,GAAG,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAczE"}
@@ -14,6 +14,7 @@ export function codexSubscriptionEnv() {
14
14
  }
15
15
  /** Bidirectional stdio JSON-RPC. Pending requests fail on timeout or child exit. */
16
16
  export class CodexRpc {
17
+ get pid() { return this.child.pid; }
17
18
  events = new AsyncQueue();
18
19
  onRequest;
19
20
  child;
@@ -25,7 +26,7 @@ export class CodexRpc {
25
26
  return !this.closed;
26
27
  }
27
28
  pending = new Map();
28
- constructor(command, cwd) {
29
+ constructor(command, cwd, env) {
29
30
  const prefix = command
30
31
  ? []
31
32
  : [require.resolve('@openai/codex/bin/codex.js')];
@@ -40,7 +41,7 @@ export class CodexRpc {
40
41
  'model_provider="openai"',
41
42
  ], {
42
43
  cwd,
43
- env: codexSubscriptionEnv(),
44
+ env: { ...codexSubscriptionEnv(), ...env },
44
45
  stdio: ['pipe', 'pipe', 'pipe'],
45
46
  });
46
47
  this.exited = new Promise((resolve) => {
@@ -1,5 +1,5 @@
1
1
  import type { ProviderHealth } from '@lucidity/shared';
2
- import type { AgentExecutor, ExecutorRunInput } from './types.js';
2
+ import type { AgentExecutor, ExecutorRunInput, ProviderRunRef, ProviderInspection } from './types.js';
3
3
  export declare function providerFailure(error: unknown): Pick<ProviderHealth, 'auth' | 'allowance' | 'problem'> | undefined;
4
4
  /** Observes the same adapter used by interactive and scheduled work. No probe inference. */
5
5
  export declare class HealthAwareExecutor implements AgentExecutor {
@@ -10,6 +10,11 @@ export declare class HealthAwareExecutor implements AgentExecutor {
10
10
  private check;
11
11
  constructor(executor: AgentExecutor);
12
12
  get name(): string;
13
+ get recoveryCapability(): "native-turn" | "completion-receipt" | undefined;
14
+ inspect(ref: ProviderRunRef, options?: {
15
+ cwd?: string;
16
+ timeoutMs?: number;
17
+ }): Promise<ProviderInspection>;
13
18
  health(): ProviderHealth;
14
19
  subscribe(listener: () => void): () => void;
15
20
  private update;
@@ -1 +1 @@
1
- {"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../../src/executor/health.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAElE,wBAAgB,eAAe,CAC7B,KAAK,EAAE,OAAO,GACb,IAAI,CAAC,cAAc,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAAC,GAAG,SAAS,CAoBpE;AAED,4FAA4F;AAC5F,qBAAa,mBAAoB,YAAW,aAAa;IAK3C,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAJrC,QAAQ,CAAC,YAAY,QAAQ;IAC7B,OAAO,CAAC,KAAK,CAA6D;IAC1E,OAAO,CAAC,SAAS,CAAyB;IAC1C,OAAO,CAAC,KAAK,CAA4D;gBAC5C,QAAQ,EAAE,aAAa;IACpD,IAAI,IAAI,WAEP;IACD,MAAM,IAAI,cAAc;IAGxB,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI;IAM9B,OAAO,CAAC,MAAM;I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AAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAGzG,MAAM,IAAI,cAAc;IAGxB,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI;IAM9B,OAAO,CAAC,MAAM;IAId,OAAO,CAAC,MAAM;IASR,MAAM;;;;;;;;;;IAyBN,QAAQ,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,gBAAgB,EAAE,KAAK,GAAG,gBAAgB,GAAG,KAAK,CAAC;IAG/E,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAGzE,GAAG,CAAC,KAAK,EAAE,gBAAgB;IAU1B,SAAS,CAAC,KAAK,EAAE,gBAAgB;IAcxC,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAK/B,SAAS,CAAC,SAAS,EAAE,MAAM;IAG3B,OAAO;CAGd"}
@@ -24,6 +24,10 @@ export class HealthAwareExecutor {
24
24
  get name() {
25
25
  return this.executor.name;
26
26
  }
27
+ get recoveryCapability() { return this.executor.recoveryCapability; }
28
+ inspect(ref, options) {
29
+ return this.executor.inspect?.(ref, options) ?? Promise.resolve({ status: 'unsupported', reason: 'Provider history inspection is unavailable.' });
30
+ }
27
31
  health() {
28
32
  return { ...this.state };
29
33
  }
@@ -1,4 +1,4 @@
1
- import type { AgentExecutor, ExecutorRunInput } from './types.js';
1
+ import type { AgentExecutor, ExecutorRunInput, ProviderRunRef, ProviderInspection } from './types.js';
2
2
  /** Shared across providers and callers, including scheduled and local chat work. */
3
3
  export declare class ExecutionOwnership {
4
4
  private context;
@@ -13,6 +13,11 @@ export declare class OwnedExecutor implements AgentExecutor {
13
13
  constructor(executor: AgentExecutor, provider: string, ownership: ExecutionOwnership);
14
14
  get name(): string;
15
15
  get strictResume(): boolean | undefined;
16
+ get recoveryCapability(): "native-turn" | "completion-receipt" | undefined;
17
+ inspect(ref: ProviderRunRef, options?: {
18
+ cwd?: string;
19
+ timeoutMs?: number;
20
+ }): Promise<ProviderInspection>;
16
21
  private keys;
17
22
  withOwnership<T>(input: ExecutorRunInput, action: () => Promise<T>): Promise<T>;
18
23
  run(input: ExecutorRunInput): Promise<import("./types.js").ExecutorResult>;
@@ -1 +1 @@
1
- {"version":3,"file":"ownership.d.ts","sourceRoot":"","sources":["../../src/executor/ownership.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAGlE,oFAAoF;AACpF,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,OAAO,CAAwC;IAEjD,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC;IAOxF,OAAO,CAAC,MAAM,CAAoC;IAE5C,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,IAAI,CAAC;CAoBzE;AAMD,qBAAa,aAAc,YAAW,aAAa;IACrC,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAAiB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAAU,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAtF,QAAQ,EAAE,aAAa,EAAmB,QAAQ,EAAE,MAAM,EAAmB,SAAS,EAAE,kBAAkB;IACvI,IAAI,IAAI,WAAiC;IACzC,IAAI,YAAY,wBAAyC;IACzD,OAAO,CAAC,IAAI;IAOZ,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAGzE,GAAG,CAAC,KAAK,EAAE,gBAAgB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C;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAM7G,OAAO,CAAC,IAAI;IAOZ,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAGzE,GAAG,CAAC,KAAK,EAAE,gBAAgB;IAI1B,SAAS,CAAC,KAAK,EAAE,gBAAgB;IAOxC,MAAM;;;;;;;;;;IACN,QAAQ,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,gBAAgB,EAAE,KAAK,GAAG,gBAAgB,GAAG,KAAK,CAAC;IACzE,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAC9B,SAAS,CAAC,EAAE,EAAE,MAAM;IACd,OAAO;CACd"}
@@ -61,6 +61,13 @@ export class OwnedExecutor {
61
61
  }
62
62
  get name() { return this.executor.name; }
63
63
  get strictResume() { return this.executor.strictResume; }
64
+ get recoveryCapability() { return this.executor.recoveryCapability; }
65
+ inspect(ref, options = {}) {
66
+ return this.ownership.run([
67
+ ...(ref.sessionId ? [`session:${this.provider}:${ref.sessionId}`] : []),
68
+ ...(options.cwd ? [`workspace:${workspaceKey(options.cwd)}`] : []),
69
+ ], () => this.executor.inspect?.(ref, options) ?? Promise.resolve({ status: 'unsupported', reason: 'Provider history inspection is unavailable.' }));
70
+ }
64
71
  keys(input) {
65
72
  const session = input.resume ?? input.sessionId;
66
73
  return [
@@ -13,9 +13,25 @@ export interface ExecutorApproval {
13
13
  cwd?: string;
14
14
  }
15
15
  export type ExecutorModel = import('@lucidity/shared').AgentModelOption;
16
+ export interface ProviderRunRef {
17
+ sessionId?: string;
18
+ turnId?: string;
19
+ pid?: number;
20
+ /** Commands do not necessarily have a native inference turn. */
21
+ inspectionDisabled?: boolean;
22
+ }
23
+ export type ProviderInspection = {
24
+ status: 'completed';
25
+ result: ExecutorResult;
26
+ } | {
27
+ status: 'unknown' | 'unsupported';
28
+ reason: string;
29
+ };
16
30
  export interface ExecutorRunInput {
17
31
  /** Lucidity request identity, used for live controls; unrelated to provider session IDs. */
18
32
  requestId?: string;
33
+ /** Synchronous durable write. A failure must prevent further provider work. */
34
+ onRecovery?: (ref: ProviderRunRef) => void;
19
35
  /** Interactive callers can provide a permission surface. Absent means deny. */
20
36
  onApproval?: (approval: ExecutorApproval) => Promise<boolean>;
21
37
  /** The main user prompt. */
@@ -57,6 +73,8 @@ export interface ExecutorRunInput {
57
73
  provider?: AgentProvider;
58
74
  /** Working directory for the run (the target repo for a coding turn, M7). */
59
75
  cwd?: string;
76
+ /** Extra variables for the agent's process, on top of the sanitised daemon environment. */
77
+ env?: Record<string, string>;
60
78
  /** Compatibility policy names; each adapter maps them to native permissions. */
61
79
  permissionMode?: 'default' | 'acceptEdits' | 'plan' | 'auto' | 'bypassPermissions';
62
80
  /** Tools to pre-approve (`--allowedTools`), the static first filter before auto mode. */
@@ -75,6 +93,8 @@ export type ExecutorStreamEvent = {
75
93
  type: 'tool_call';
76
94
  name: string;
77
95
  phase: 'start' | 'end';
96
+ itemId?: string;
97
+ outcome?: string;
78
98
  } | {
79
99
  type: 'done';
80
100
  text: string;
@@ -95,6 +115,11 @@ export interface AgentExecutor {
95
115
  readonly name: string;
96
116
  /** Strict providers report resume failures instead of silently starting memoryless. */
97
117
  readonly strictResume?: boolean;
118
+ readonly recoveryCapability?: 'native-turn' | 'completion-receipt';
119
+ inspect?(ref: ProviderRunRef, options?: {
120
+ cwd?: string;
121
+ timeoutMs?: number;
122
+ }): Promise<ProviderInspection>;
98
123
  /** Resolves once input is accepted by the provider transport. */
99
124
  steer?(requestId: string, text: string): Promise<void>;
100
125
  /** Interrupt a turn owned by this adapter, including conductor workers. */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/executor/types.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,MAAM,WA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GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;CACvE;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,gBAAgB,GAAG,YAAY,CA4LvE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/harness/index.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAIV,aAAa,EACb,YAAY,EACb,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,QAAQ,EACR,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,aAAa,EACb,YAAY,GACb,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,gBAAgB;IAC/B,6EAA6E;IAC7E,QAAQ,EAAE,aAAa,CAAC;IACxB,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B,gBAAgB,CAAC,EAAE,aAAa,CAAC;IACjC,6DAA6D;IAC7D,OAAO,EAAE,MAAM,CAAC;IAChB,4EAA4E;IAC5E,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B;;;;;OAKG;IACH,GAAG,CAAC,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IACtD,8EAA8E;IAC9E,YAAY,CAAC,EAAE;QAAE,KAAK,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,OAAO,CAAC;QAAC,WAAW,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IAC1E;;;;;;OAMG;IACH,KAAK,CAAC,EAAE;QAAE,cAAc,EAAE,MAAM,GAAG,mBAAmB,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;CACvE;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,gBAAgB,GAAG,YAAY,CA6LvE"}
@@ -49,6 +49,7 @@ export function createLucidHarness(deps) {
49
49
  const result = await deps.planningExecutor.run({
50
50
  ...buildDayPlanningPrompt(input.prompt, input.dayPlan),
51
51
  requestId: input.requestId, noTools: true, effort: 'high',
52
+ provider: input.provider,
52
53
  timeoutMs: 120_000, signal: input.signal,
53
54
  });
54
55
  return { text: JSON.stringify(parseDayPlanningResult(result.text, input.prompt, input.dayPlan)), costUsd: result.costUsd };
@@ -27,7 +27,7 @@ export { ClaudeAgentExecutor, CLAUDE_AGENT_SDK_VERSION } from './executor/claude
27
27
  export { CodexExecutor } from './executor/codex.js';
28
28
  export { CODEX_RUNTIME_VERSION } from './executor/codexRpc.js';
29
29
  export { ProviderRouter, encodeSession, decodeSession } from './executor/providerRouter.js';
30
- export type { AgentProvider, ExecutorApproval, ExecutorModel } from './executor/types.js';
30
+ export type { AgentProvider, ExecutorApproval, ExecutorModel, ProviderRunRef, ProviderInspection } from './executor/types.js';
31
31
  export { HealthAwareExecutor, providerFailure } from './executor/health.js';
32
32
  export { ExecutionOwnership, OwnedExecutor } from './executor/ownership.js';
33
33
  export * from '@lucidity/decisions';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,mBAAmB,EACnB,WAAW,EACX,eAAe,EACf,oBAAoB,GACrB,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EAAE,wBAAwB,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC3G,OAAO,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AACtE,YAAY,EAAE,gCAAgC,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAClG,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC9E,YAAY,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,WAAW,EACX,mBAAmB,GACpB,M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S,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9D,OAAO,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAC1F,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC5F,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,aAAa,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9H,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAG5E,cAAc,qBAAqB,CAAC"}
@@ -4,6 +4,7 @@ import {
4
4
  type AgentCommandOption,
5
5
  } from '@lucidity/shared';
6
6
  import { randomUUID } from 'node:crypto';
7
+ import { spawn } from 'node:child_process';
7
8
  import { readFileSync } from 'node:fs';
8
9
  import {
9
10
  query,
@@ -86,7 +87,7 @@ export function claudeAgentOptions(
86
87
  : {};
87
88
  return {
88
89
  cwd: input.cwd,
89
- env: claudeSubscriptionEnv(oauthToken),
90
+ env: { ...claudeSubscriptionEnv(oauthToken), ...input.env },
90
91
  model: input.model,
91
92
  effort: input.effort as Options['effort'],
92
93
  outputFormat: input.outputSchema ? { type: 'json_schema', schema: input.outputSchema } : undefined,
@@ -198,11 +199,17 @@ function chatCommands(
198
199
  export class ClaudeAgentExecutor implements AgentExecutor {
199
200
  readonly name = 'claude-agent-sdk';
200
201
  readonly strictResume = true;
202
+ readonly recoveryCapability = 'completion-receipt';
203
+ async inspect(): Promise<import('./types.js').ProviderInspection> {
204
+ return { status: 'unsupported', reason: 'Claude SDK 0.3.287 history contains messages, not a durable run-completion receipt. Partial text cannot establish completion.' };
205
+ }
201
206
  private readonly turns = new LiveTurns();
202
207
  constructor(
203
208
  private readonly options: {
204
209
  oauthToken?: string;
205
210
  query?: typeof query;
211
+ /** How long to wait for a closing loop after the last background task ends. */
212
+ backgroundGraceMs?: number;
206
213
  } = {},
207
214
  ) {}
208
215
 
@@ -316,6 +323,12 @@ export class ClaudeAgentExecutor implements AgentExecutor {
316
323
  let ended = false;
317
324
  let ready = false;
318
325
  const pending = new Set<string>();
326
+ // Sub-agents and background commands outlive the loop that started them. The turn stays
327
+ // open while any are live, and `carried` holds what Claude said before they reported back.
328
+ let background = 0;
329
+ const carried: string[] = [];
330
+ let carriedSession = '';
331
+ let grace: ReturnType<typeof setTimeout> | undefined;
319
332
  const owner = this.turns.open(input, async (text) => {
320
333
  if (command)
321
334
  throw new Error(
@@ -336,6 +349,13 @@ export class ClaudeAgentExecutor implements AgentExecutor {
336
349
  options: {
337
350
  ...claudeAgentOptions(input, this.options.oauthToken),
338
351
  abortController: owner.controller,
352
+ ...(input.onRecovery ? { spawnClaudeCodeProcess: (options: import('@anthropic-ai/claude-agent-sdk').SpawnOptions) => {
353
+ const child = spawn(options.command, options.args, { cwd: options.cwd, env: options.env, signal: options.signal, stdio: ['pipe', 'pipe', 'pipe'] });
354
+ child.stderr.on('data', () => {});
355
+ try { input.onRecovery!({ pid: child.pid }); }
356
+ catch (error) { child.kill('SIGKILL'); throw error; }
357
+ return child;
358
+ } } : {}),
339
359
  },
340
360
  });
341
361
  requireClaudeSubscription(await active.accountInfo());
@@ -356,12 +376,24 @@ export class ClaudeAgentExecutor implements AgentExecutor {
356
376
  });
357
377
  yield { type: 'tool_call', name: `/${commandName}`, phase: 'start' };
358
378
  }
379
+ input.onRecovery?.({ turnId: initial.uuid, inspectionDisabled: !!command });
359
380
  incoming.push(initial);
360
381
  ready = true;
361
382
  for await (const event of active) {
362
383
  owner.check();
363
- if (event.type === 'system' && event.subtype === 'init')
384
+ if (event.type === 'system' && event.subtype === 'background_tasks_changed') {
385
+ background = event.tasks.filter((task) => !task.ambient).length;
386
+ // Finished work normally starts another loop. If none follows (a task was stopped,
387
+ // say), close the input so the query ends and the turn settles with what it has.
388
+ if (!background && carried.length && !grace)
389
+ grace = setTimeout(() => incoming.end(), this.options.backgroundGraceMs ?? 90_000);
390
+ continue;
391
+ }
392
+ if (grace) { clearTimeout(grace); grace = undefined; }
393
+ if (event.type === 'system' && event.subtype === 'init') {
394
+ input.onRecovery?.({ sessionId: event.session_id });
364
395
  yield { type: 'session', sessionId: event.session_id };
396
+ }
365
397
  if (
366
398
  event.type === 'system' &&
367
399
  event.subtype === 'local_command_output' &&
@@ -387,6 +419,7 @@ export class ClaudeAgentExecutor implements AgentExecutor {
387
419
  type: 'tool_call',
388
420
  name: e.content_block.name,
389
421
  phase: 'start',
422
+ itemId: e.content_block.id,
390
423
  };
391
424
  }
392
425
  } else if (
@@ -397,7 +430,7 @@ export class ClaudeAgentExecutor implements AgentExecutor {
397
430
  if (block.type === 'tool_result') {
398
431
  const name = toolNames.get(block.tool_use_id);
399
432
  if (name) {
400
- yield { type: 'tool_call', name, phase: 'end' };
433
+ yield { type: 'tool_call', name, phase: 'end', itemId: block.tool_use_id, outcome: block.is_error ? 'failed' : 'completed' };
401
434
  toolNames.delete(block.tool_use_id);
402
435
  }
403
436
  }
@@ -417,6 +450,13 @@ export class ClaudeAgentExecutor implements AgentExecutor {
417
450
  // A late priority message may become a subsequent loop in this same SDK
418
451
  // query. Keep consuming until its echoed user message and result arrive.
419
452
  if (pending.size) continue;
453
+ // Closing the query now would kill the work still running, and its report would
454
+ // never reach the phone. Claude continues in a later loop of this same query.
455
+ if (background > 0 && !input.outputSchema && !command) {
456
+ if (event.result.trim()) carried.push(event.result.trim());
457
+ carriedSession = event.session_id;
458
+ continue;
459
+ }
420
460
  if (input.outputSchema && event.structured_output === undefined)
421
461
  throw new Error('Claude did not return the requested structured result.');
422
462
  ended = true;
@@ -426,7 +466,7 @@ export class ClaudeAgentExecutor implements AgentExecutor {
426
466
  type: 'done',
427
467
  text:
428
468
  (input.outputSchema ? JSON.stringify(event.structured_output) : '') ||
429
- event.result.trim() ||
469
+ [...carried, event.result.trim()].filter(Boolean).join('\n\n') ||
430
470
  commandOutput.trim() ||
431
471
  (compacted
432
472
  ? 'Conversation compacted. You can continue here.'
@@ -442,6 +482,11 @@ export class ClaudeAgentExecutor implements AgentExecutor {
442
482
  }
443
483
  }
444
484
  owner.check();
485
+ if (carried.length) {
486
+ ended = true;
487
+ yield { type: 'done', text: carried.join('\n\n'), sessionId: carriedSession };
488
+ return;
489
+ }
445
490
  throw new Error('Claude disconnected before completing the turn.');
446
491
  } catch (error) {
447
492
  // The SDK can reject with a plain process error when our controller aborts.
@@ -450,6 +495,7 @@ export class ClaudeAgentExecutor implements AgentExecutor {
450
495
  throw error;
451
496
  } finally {
452
497
  ended = true;
498
+ clearTimeout(grace);
453
499
  incoming.end();
454
500
  try {
455
501
  active?.close();
@@ -23,6 +23,8 @@ import type {
23
23
  ExecutorStreamEvent,
24
24
  ExecutorModel,
25
25
  ExecutorResult,
26
+ ProviderRunRef,
27
+ ProviderInspection,
26
28
  } from './types.js';
27
29
  import type { ThreadStartParams } from './codexProtocol/v2/ThreadStartParams.js';
28
30
  import type { ThreadResumeParams } from './codexProtocol/v2/ThreadResumeParams.js';
@@ -34,6 +36,8 @@ import type { ReviewStartParams } from './codexProtocol/v2/ReviewStartParams.js'
34
36
  import type { ThreadSetNameParams } from './codexProtocol/v2/ThreadSetNameParams.js';
35
37
  import type { GetAccountRateLimitsResponse } from './codexProtocol/v2/GetAccountRateLimitsResponse.js';
36
38
  import type { SkillsListResponse } from './codexProtocol/v2/SkillsListResponse.js';
39
+ import type { ThreadReadResponse } from './codexProtocol/v2/ThreadReadResponse.js';
40
+ import type { ThreadReadParams } from './codexProtocol/v2/ThreadReadParams.js';
37
41
 
38
42
  // App-server does not persist an empty thread until its first turn. Keep a durable
39
43
  // reset marker in Lucidity's provider session envelope until that turn starts.
@@ -161,19 +165,53 @@ export function codexRunConfig(
161
165
  export class CodexExecutor implements AgentExecutor {
162
166
  readonly name = 'codex-app-server';
163
167
  readonly strictResume = true;
168
+ readonly recoveryCapability = 'native-turn';
164
169
  private readonly turns = new LiveTurns();
165
170
  private readonly sessions = new CodexSessions();
166
171
  constructor(
167
172
  private readonly options: {
168
173
  command?: string;
169
- connect?: (cwd?: string) => CodexConnection;
174
+ connect?: (cwd?: string, env?: Record<string, string>) => CodexConnection;
170
175
  } = {},
171
176
  ) {}
172
- private connect(cwd?: string) {
177
+ private connect(cwd?: string, env?: Record<string, string>) {
173
178
  return (
174
- this.options.connect?.(cwd) ?? new CodexRpc(this.options.command, cwd)
179
+ this.options.connect?.(cwd, env) ?? new CodexRpc(this.options.command, cwd, env)
175
180
  );
176
181
  }
182
+ async inspect(ref: ProviderRunRef, options: { cwd?: string; timeoutMs?: number } = {}): Promise<ProviderInspection> {
183
+ if (!ref.sessionId || !ref.turnId || ref.inspectionDisabled)
184
+ return { status: 'unsupported', reason: 'No inspectable native Codex turn was recorded.' };
185
+ const rpc = this.connect(options.cwd);
186
+ let timer: ReturnType<typeof setTimeout> | undefined;
187
+ try {
188
+ return await Promise.race([
189
+ (async (): Promise<ProviderInspection> => {
190
+ await initializeCodex(rpc);
191
+ const { thread } = await rpc.request<ThreadReadResponse>('thread/read', {
192
+ threadId: ref.sessionId!, includeTurns: true,
193
+ } satisfies ThreadReadParams);
194
+ if (thread.id !== ref.sessionId || thread.status?.type === 'active')
195
+ return { status: 'unknown', reason: 'Codex history does not identify an inactive matching thread.' };
196
+ const turn = thread.turns?.find((turn) => turn.id === ref.turnId);
197
+ if (!turn || turn.status !== 'completed' || turn.itemsView !== 'full')
198
+ return { status: 'unknown', reason: 'Codex has no complete result for this exact turn.' };
199
+ const answer = [...turn.items].reverse().find((item) => item.type === 'agentMessage' && item.phase !== 'commentary');
200
+ if (!answer || answer.type !== 'agentMessage' || typeof answer.text !== 'string')
201
+ return { status: 'unknown', reason: 'The completed turn has no retained final answer.' };
202
+ return { status: 'completed', result: { text: answer.text.trim(), sessionId: thread.id } };
203
+ })(),
204
+ new Promise<ProviderInspection>((resolve) => {
205
+ timer = setTimeout(() => resolve({ status: 'unknown', reason: 'Codex history inspection timed out.' }), Math.min(options.timeoutMs ?? 10_000, 30_000));
206
+ }),
207
+ ]);
208
+ } catch {
209
+ return { status: 'unknown', reason: 'Codex history is unavailable or unreadable with the installed runtime.' };
210
+ } finally {
211
+ clearTimeout(timer);
212
+ await rpc.close();
213
+ }
214
+ }
177
215
  steer(requestId: string, text: string) {
178
216
  return this.turns.steer(requestId, text);
179
217
  }
@@ -394,7 +432,8 @@ export class CodexExecutor implements AgentExecutor {
394
432
  try {
395
433
  owner.check();
396
434
  const pooled = await this.sessions.take(input.resume);
397
- rpc = pooled?.rpc ?? this.connect(input.cwd);
435
+ rpc = pooled?.rpc ?? this.connect(input.cwd, input.env);
436
+ input.onRecovery?.({ pid: rpc.pid, inspectionDisabled: !!command });
398
437
  rpc.onRequest = onRequest;
399
438
  owner.check();
400
439
  if (!pooled) await initializeCodex(rpc);
@@ -441,7 +480,8 @@ export class CodexExecutor implements AgentExecutor {
441
480
  // resumes only after the old owner has fully exited.
442
481
  await rpc.close();
443
482
  owner.check();
444
- rpc = this.connect(input.cwd);
483
+ rpc = this.connect(input.cwd, input.env);
484
+ input.onRecovery?.({ pid: rpc.pid });
445
485
  rpc.onRequest = onRequest;
446
486
  await initializeCodex(rpc);
447
487
  }
@@ -455,6 +495,7 @@ export class CodexExecutor implements AgentExecutor {
455
495
  } satisfies ThreadResumeParams)
456
496
  : await rpc.request<CodexThread>('thread/start', params);
457
497
  threadId = thread.thread.id;
498
+ input.onRecovery?.({ sessionId: threadId });
458
499
  const sessionId =
459
500
  isEmptySession(input.resume) &&
460
501
  command &&
@@ -554,6 +595,7 @@ export class CodexExecutor implements AgentExecutor {
554
595
  );
555
596
  turnId = turn.turn.id;
556
597
  }
598
+ if (turnId) input.onRecovery?.({ turnId });
557
599
  let finalText = '';
558
600
  let streamedText = '';
559
601
  for await (const event of rpc.events) {
@@ -576,6 +618,8 @@ export class CodexExecutor implements AgentExecutor {
576
618
  event.method === 'item/completed'
577
619
  ) {
578
620
  const item = p.item as {
621
+ id?: string;
622
+ status?: string;
579
623
  type: string;
580
624
  text?: string;
581
625
  phase?: string;
@@ -614,6 +658,8 @@ export class CodexExecutor implements AgentExecutor {
614
658
  yield {
615
659
  type: 'tool_call',
616
660
  name,
661
+ ...(item.id ? { itemId: item.id } : {}),
662
+ ...(item.status ? { outcome: item.status } : {}),
617
663
  phase: event.method === 'item/started' ? 'start' : 'end',
618
664
  };
619
665
  } else if (event.method === 'turn/completed') {
@@ -0,0 +1,5 @@
1
+ // GENERATED CODE! DO NOT MODIFY BY HAND!
2
+
3
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
4
+
5
+ export type AgentPath = string;
@@ -0,0 +1,5 @@
1
+ // GENERATED CODE! DO NOT MODIFY BY HAND!
2
+
3
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
4
+
5
+ export type ImageGenerationFailure = { "type": "usageLimitExceeded", limitId: string, resetsAt: number | null, };
@@ -0,0 +1,7 @@
1
+ // GENERATED CODE! DO NOT MODIFY BY HAND!
2
+
3
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
4
+ import type { AbsolutePathBuf } from "./AbsolutePathBuf.js";
5
+ import type { ImageGenerationFailure } from "./ImageGenerationFailure.js";
6
+
7
+ export type ImageGenerationItem = { id: string, status: string, revisedPrompt: string | null, result: string, transparentBackground?: boolean, failure: ImageGenerationFailure | null, savedPath?: AbsolutePathBuf, };
@@ -0,0 +1,27 @@
1
+ // GENERATED CODE! DO NOT MODIFY BY HAND!
2
+
3
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
4
+
5
+ /**
6
+ * A UTF-8 path for preserving raw path compatibility at the app-server API
7
+ * boundary while Codex migrates to [`PathUri`].
8
+ *
9
+ * Supports storing arbitrary strings read from the API and converting to and
10
+ * from [`PathUri`] using an explicitly selected native path convention.
11
+ *
12
+ * When converting from [`PathUri`], "native" refers to the supplied
13
+ * [`PathConvention`], which may be foreign to the operating system running
14
+ * this process. The inner string is private so path-producing code must use a
15
+ * path conversion method instead of bypassing the intended conversion
16
+ * boundary. Non-UTF-8 paths are converted to UTF-8 lossily because this API
17
+ * value is serialized as a JSON string.
18
+ *
19
+ * Deserialization and [`Self::from_string`] accept any UTF-8 string without
20
+ * interpreting or validating it. Use [`Self::from_string`] when a caller
21
+ * already owns legacy app-server path text and needs to preserve its wire
22
+ * spelling; use [`Self::from_path`], [`Self::from_abs_path`], or
23
+ * [`Self::from_path_uri`] when converting an actual path value. Relative
24
+ * path text remains valid until an operation such as [`Self::to_path_uri`]
25
+ * requires an absolute path.
26
+ */
27
+ export type LegacyAppPathString = string;
@@ -0,0 +1,11 @@
1
+ // GENERATED CODE! DO NOT MODIFY BY HAND!
2
+
3
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
4
+
5
+ /**
6
+ * Classifies an assistant message as interim commentary or final answer text.
7
+ *
8
+ * Providers do not emit this consistently, so callers must treat `None` as
9
+ * "phase unknown" and keep compatibility behavior for legacy models.
10
+ */
11
+ export type MessagePhase = "commentary" | "final_answer";
@@ -0,0 +1,8 @@
1
+ // GENERATED CODE! DO NOT MODIFY BY HAND!
2
+
3
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
4
+
5
+ /**
6
+ * Display item emitted by the interruptible `clock.sleep` tool.
7
+ */
8
+ export type SleepItem = { id: string, durationMs: number, };