@opencorelabs/lucidity 0.7.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 (502) hide show
  1. package/README.md +9 -2
  2. package/dist/assets/speech/lucidity-speech +0 -0
  3. package/dist/automations/agent.d.ts.map +1 -1
  4. package/dist/automations/agent.js +2 -0
  5. package/dist/automations/designer.d.ts +1 -1
  6. package/dist/automations/service.d.ts +4 -0
  7. package/dist/automations/service.d.ts.map +1 -1
  8. package/dist/automations/service.js +60 -22
  9. package/dist/automations/store.d.ts +9 -3
  10. package/dist/automations/store.d.ts.map +1 -1
  11. package/dist/automations/store.js +45 -32
  12. package/dist/automations/workflow.d.ts +14 -0
  13. package/dist/automations/workflow.d.ts.map +1 -0
  14. package/dist/automations/workflow.js +57 -0
  15. package/dist/chat/server.d.ts +1 -0
  16. package/dist/chat/server.d.ts.map +1 -1
  17. package/dist/chat/server.js +6 -1
  18. package/dist/coding/listPrs.d.ts +2 -0
  19. package/dist/coding/listPrs.d.ts.map +1 -1
  20. package/dist/coding/listPrs.js +10 -0
  21. package/dist/coding/runCodeTurn.d.ts +6 -30
  22. package/dist/coding/runCodeTurn.d.ts.map +1 -1
  23. package/dist/coding/runCodeTurn.js +145 -218
  24. package/dist/coding/runReview.d.ts +10 -0
  25. package/dist/coding/runReview.d.ts.map +1 -0
  26. package/dist/coding/runReview.js +87 -0
  27. package/dist/coding/workspaceRegistry.d.ts +72 -0
  28. package/dist/coding/workspaceRegistry.d.ts.map +1 -0
  29. package/dist/coding/workspaceRegistry.js +421 -0
  30. package/dist/coding/worktree.d.ts +72 -32
  31. package/dist/coding/worktree.d.ts.map +1 -1
  32. package/dist/coding/worktree.js +190 -38
  33. package/dist/coding/worktreeSetup.d.ts +7 -0
  34. package/dist/coding/worktreeSetup.d.ts.map +1 -0
  35. package/dist/coding/worktreeSetup.js +49 -0
  36. package/dist/config.d.ts +2 -0
  37. package/dist/config.d.ts.map +1 -1
  38. package/dist/daemonLease.d.ts +12 -0
  39. package/dist/daemonLease.d.ts.map +1 -0
  40. package/dist/daemonLease.js +32 -0
  41. package/dist/goals/assessment.d.ts +115 -0
  42. package/dist/goals/assessment.d.ts.map +1 -0
  43. package/dist/goals/assessment.js +67 -0
  44. package/dist/goals/notes.d.ts +18 -0
  45. package/dist/goals/notes.d.ts.map +1 -0
  46. package/dist/goals/notes.js +72 -0
  47. package/dist/index.js +75 -40
  48. package/dist/jobs/briefing.d.ts +2 -16
  49. package/dist/jobs/briefing.d.ts.map +1 -1
  50. package/dist/jobs/briefing.js +65 -93
  51. package/dist/jobs/goals.d.ts +15 -0
  52. package/dist/jobs/goals.d.ts.map +1 -0
  53. package/dist/jobs/goals.js +286 -0
  54. package/dist/jobs/weeklyReview.d.ts.map +1 -1
  55. package/dist/jobs/weeklyReview.js +3 -2
  56. package/dist/logTimestamps.d.ts +10 -0
  57. package/dist/logTimestamps.d.ts.map +1 -0
  58. package/dist/logTimestamps.js +12 -0
  59. package/dist/providerRecovery.d.ts +48 -0
  60. package/dist/providerRecovery.d.ts.map +1 -0
  61. package/dist/providerRecovery.js +100 -0
  62. package/dist/queue.d.ts +1 -0
  63. package/dist/queue.d.ts.map +1 -1
  64. package/dist/queue.js +4 -0
  65. package/dist/room/client.d.ts +6 -19
  66. package/dist/room/client.d.ts.map +1 -1
  67. package/dist/room/client.js +127 -123
  68. package/dist/room/computer.js +1 -1
  69. package/dist/room/durablePublish.d.ts +6 -0
  70. package/dist/room/durablePublish.d.ts.map +1 -0
  71. package/dist/room/durablePublish.js +19 -0
  72. package/dist/room/incidents.d.ts +4 -1
  73. package/dist/room/incidents.d.ts.map +1 -1
  74. package/dist/room/incidents.js +15 -7
  75. package/dist/room/turnQueue.d.ts.map +1 -1
  76. package/dist/room/turnQueue.js +55 -46
  77. package/dist/runtimeStore.d.ts +46 -0
  78. package/dist/runtimeStore.d.ts.map +1 -0
  79. package/dist/runtimeStore.js +205 -0
  80. package/dist/setup/server.js +1 -1
  81. package/dist/turnLog.d.ts +10 -40
  82. package/dist/turnLog.d.ts.map +1 -1
  83. package/dist/turnLog.js +33 -56
  84. package/dist/vault.d.ts +6 -3
  85. package/dist/vault.d.ts.map +1 -1
  86. package/dist/vault.js +18 -4
  87. package/package.json +4 -4
  88. package/src/automations/agent.ts +2 -0
  89. package/src/automations/service.ts +47 -21
  90. package/src/automations/store.ts +41 -50
  91. package/src/automations/workflow.ts +49 -0
  92. package/src/chat/server.ts +7 -1
  93. package/src/coding/listPrs.ts +14 -0
  94. package/src/coding/runCodeTurn.ts +51 -139
  95. package/src/coding/runReview.ts +83 -0
  96. package/src/coding/workspaceRegistry.ts +380 -0
  97. package/src/coding/worktree.ts +205 -40
  98. package/src/coding/worktreeSetup.ts +50 -0
  99. package/src/config.ts +2 -0
  100. package/src/daemonLease.ts +33 -0
  101. package/src/goals/assessment.ts +106 -0
  102. package/src/goals/notes.ts +88 -0
  103. package/src/index.ts +76 -46
  104. package/src/jobs/briefing.ts +62 -109
  105. package/src/jobs/goals.ts +384 -0
  106. package/src/jobs/weeklyReview.ts +4 -3
  107. package/src/logTimestamps.ts +14 -0
  108. package/src/providerRecovery.ts +99 -0
  109. package/src/queue.ts +4 -0
  110. package/src/room/client.ts +84 -116
  111. package/src/room/computer.ts +1 -1
  112. package/src/room/durablePublish.ts +25 -0
  113. package/src/room/incidents.ts +20 -8
  114. package/src/room/turnQueue.ts +53 -56
  115. package/src/runtimeStore.ts +207 -0
  116. package/src/setup/server.ts +1 -1
  117. package/src/turnLog.ts +32 -75
  118. package/src/vault.ts +16 -7
  119. package/vendor/mcp-server/dist/index.js +2 -0
  120. package/vendor/mcp-server/dist/tools/goals.d.ts +4 -0
  121. package/vendor/mcp-server/dist/tools/goals.d.ts.map +1 -0
  122. package/vendor/mcp-server/dist/tools/goals.js +38 -0
  123. package/vendor/mcp-server/package.json +1 -1
  124. package/vendor/mcp-server/src/index.ts +2 -0
  125. package/vendor/mcp-server/src/tools/goals.ts +62 -0
  126. package/vendor/runtime/README.md +36 -2
  127. package/vendor/runtime/dist/executor/asyncQueue.d.ts +1 -0
  128. package/vendor/runtime/dist/executor/asyncQueue.d.ts.map +1 -1
  129. package/vendor/runtime/dist/executor/asyncQueue.js +3 -0
  130. package/vendor/runtime/dist/executor/claudeAgent.d.ts +5 -1
  131. package/vendor/runtime/dist/executor/claudeAgent.d.ts.map +1 -1
  132. package/vendor/runtime/dist/executor/claudeAgent.js +77 -13
  133. package/vendor/runtime/dist/executor/codex.d.ts +8 -2
  134. package/vendor/runtime/dist/executor/codex.d.ts.map +1 -1
  135. package/vendor/runtime/dist/executor/codex.js +113 -38
  136. package/vendor/runtime/dist/executor/codexProtocol/AgentPath.d.ts +2 -0
  137. package/vendor/runtime/dist/executor/codexProtocol/AgentPath.d.ts.map +1 -0
  138. package/vendor/runtime/dist/executor/codexProtocol/AgentPath.js +2 -0
  139. package/vendor/runtime/dist/executor/codexProtocol/FunctionCallOutputContentItem.d.ts +4 -1
  140. package/vendor/runtime/dist/executor/codexProtocol/FunctionCallOutputContentItem.d.ts.map +1 -1
  141. package/vendor/runtime/dist/executor/codexProtocol/ImageGenerationFailure.d.ts +6 -0
  142. package/vendor/runtime/dist/executor/codexProtocol/ImageGenerationFailure.d.ts.map +1 -0
  143. package/vendor/runtime/dist/executor/codexProtocol/ImageGenerationFailure.js +2 -0
  144. package/vendor/runtime/dist/executor/codexProtocol/ImageGenerationItem.d.ts +12 -0
  145. package/vendor/runtime/dist/executor/codexProtocol/ImageGenerationItem.d.ts.map +1 -0
  146. package/vendor/runtime/dist/executor/codexProtocol/ImageGenerationItem.js +2 -0
  147. package/vendor/runtime/dist/executor/codexProtocol/LegacyAppPathString.d.ts +24 -0
  148. package/vendor/runtime/dist/executor/codexProtocol/LegacyAppPathString.d.ts.map +1 -0
  149. package/vendor/runtime/dist/executor/codexProtocol/LegacyAppPathString.js +2 -0
  150. package/vendor/runtime/dist/executor/codexProtocol/MessagePhase.d.ts +8 -0
  151. package/vendor/runtime/dist/executor/codexProtocol/MessagePhase.d.ts.map +1 -0
  152. package/vendor/runtime/dist/executor/codexProtocol/MessagePhase.js +2 -0
  153. package/vendor/runtime/dist/executor/codexProtocol/Personality.d.ts +3 -0
  154. package/vendor/runtime/dist/executor/codexProtocol/Personality.d.ts.map +1 -1
  155. package/vendor/runtime/dist/executor/codexProtocol/PlanType.d.ts +1 -1
  156. package/vendor/runtime/dist/executor/codexProtocol/PlanType.d.ts.map +1 -1
  157. package/vendor/runtime/dist/executor/codexProtocol/SleepItem.d.ts +8 -0
  158. package/vendor/runtime/dist/executor/codexProtocol/SleepItem.d.ts.map +1 -0
  159. package/vendor/runtime/dist/executor/codexProtocol/SleepItem.js +2 -0
  160. package/vendor/runtime/dist/executor/codexProtocol/SubAgentSource.d.ts +14 -0
  161. package/vendor/runtime/dist/executor/codexProtocol/SubAgentSource.d.ts.map +1 -0
  162. package/vendor/runtime/dist/executor/codexProtocol/SubAgentSource.js +2 -0
  163. package/vendor/runtime/dist/executor/codexProtocol/ThreadId.d.ts +7 -0
  164. package/vendor/runtime/dist/executor/codexProtocol/ThreadId.d.ts.map +1 -0
  165. package/vendor/runtime/dist/executor/codexProtocol/ThreadId.js +2 -0
  166. package/vendor/runtime/dist/executor/codexProtocol/WebSearchItem.d.ts +15 -0
  167. package/vendor/runtime/dist/executor/codexProtocol/WebSearchItem.d.ts.map +1 -0
  168. package/vendor/runtime/dist/executor/codexProtocol/WebSearchItem.js +2 -0
  169. package/vendor/runtime/dist/executor/codexProtocol/v2/AgentMessageDelivery.d.ts +2 -0
  170. package/vendor/runtime/dist/executor/codexProtocol/v2/AgentMessageDelivery.d.ts.map +1 -0
  171. package/vendor/runtime/dist/executor/codexProtocol/v2/AgentMessageDelivery.js +2 -0
  172. package/vendor/runtime/dist/executor/codexProtocol/v2/AsyncUserInputQuestion.d.ts +5 -0
  173. package/vendor/runtime/dist/executor/codexProtocol/v2/AsyncUserInputQuestion.d.ts.map +1 -0
  174. package/vendor/runtime/dist/executor/codexProtocol/v2/AsyncUserInputQuestion.js +2 -0
  175. package/vendor/runtime/dist/executor/codexProtocol/v2/CodexErrorInfo.d.ts +29 -0
  176. package/vendor/runtime/dist/executor/codexProtocol/v2/CodexErrorInfo.d.ts.map +1 -0
  177. package/vendor/runtime/dist/executor/codexProtocol/v2/CodexErrorInfo.js +2 -0
  178. package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentState.d.ts +6 -0
  179. package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentState.d.ts.map +1 -0
  180. package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentState.js +2 -0
  181. package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentStatus.d.ts +2 -0
  182. package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentStatus.d.ts.map +1 -0
  183. package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentStatus.js +2 -0
  184. package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentTool.d.ts +2 -0
  185. package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentTool.d.ts.map +1 -0
  186. package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentTool.js +2 -0
  187. package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentToolCallStatus.d.ts +2 -0
  188. package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentToolCallStatus.d.ts.map +1 -0
  189. package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentToolCallStatus.js +2 -0
  190. package/vendor/runtime/dist/executor/codexProtocol/v2/CommandAction.d.ts +20 -0
  191. package/vendor/runtime/dist/executor/codexProtocol/v2/CommandAction.d.ts.map +1 -0
  192. package/vendor/runtime/dist/executor/codexProtocol/v2/CommandAction.js +2 -0
  193. package/vendor/runtime/dist/executor/codexProtocol/v2/CommandExecutionSource.d.ts +2 -0
  194. package/vendor/runtime/dist/executor/codexProtocol/v2/CommandExecutionSource.d.ts.map +1 -0
  195. package/vendor/runtime/dist/executor/codexProtocol/v2/CommandExecutionSource.js +2 -0
  196. package/vendor/runtime/dist/executor/codexProtocol/v2/CommandExecutionStatus.d.ts +2 -0
  197. package/vendor/runtime/dist/executor/codexProtocol/v2/CommandExecutionStatus.d.ts.map +1 -0
  198. package/vendor/runtime/dist/executor/codexProtocol/v2/CommandExecutionStatus.js +2 -0
  199. package/vendor/runtime/dist/executor/codexProtocol/v2/CyberAccessProgram.d.ts +6 -0
  200. package/vendor/runtime/dist/executor/codexProtocol/v2/CyberAccessProgram.d.ts.map +1 -0
  201. package/vendor/runtime/dist/executor/codexProtocol/v2/CyberAccessProgram.js +2 -0
  202. package/vendor/runtime/dist/executor/codexProtocol/v2/DynamicToolCallOutputContentItem.d.ts +11 -0
  203. package/vendor/runtime/dist/executor/codexProtocol/v2/DynamicToolCallOutputContentItem.d.ts.map +1 -0
  204. package/vendor/runtime/dist/executor/codexProtocol/v2/DynamicToolCallOutputContentItem.js +2 -0
  205. package/vendor/runtime/dist/executor/codexProtocol/v2/DynamicToolCallStatus.d.ts +2 -0
  206. package/vendor/runtime/dist/executor/codexProtocol/v2/DynamicToolCallStatus.d.ts.map +1 -0
  207. package/vendor/runtime/dist/executor/codexProtocol/v2/DynamicToolCallStatus.js +2 -0
  208. package/vendor/runtime/dist/executor/codexProtocol/v2/FileUpdateChange.d.ts +7 -0
  209. package/vendor/runtime/dist/executor/codexProtocol/v2/FileUpdateChange.d.ts.map +1 -0
  210. package/vendor/runtime/dist/executor/codexProtocol/v2/FileUpdateChange.js +2 -0
  211. package/vendor/runtime/dist/executor/codexProtocol/v2/GetAccountRateLimitsResponse.d.ts +5 -0
  212. package/vendor/runtime/dist/executor/codexProtocol/v2/GetAccountRateLimitsResponse.d.ts.map +1 -1
  213. package/vendor/runtime/dist/executor/codexProtocol/v2/GitInfo.d.ts +6 -0
  214. package/vendor/runtime/dist/executor/codexProtocol/v2/GitInfo.d.ts.map +1 -0
  215. package/vendor/runtime/dist/executor/codexProtocol/v2/GitInfo.js +2 -0
  216. package/vendor/runtime/dist/executor/codexProtocol/v2/HookPromptFragment.d.ts +5 -0
  217. package/vendor/runtime/dist/executor/codexProtocol/v2/HookPromptFragment.d.ts.map +1 -0
  218. package/vendor/runtime/dist/executor/codexProtocol/v2/HookPromptFragment.js +2 -0
  219. package/vendor/runtime/dist/executor/codexProtocol/v2/McpAppDisplayMode.d.ts +2 -0
  220. package/vendor/runtime/dist/executor/codexProtocol/v2/McpAppDisplayMode.d.ts.map +1 -0
  221. package/vendor/runtime/dist/executor/codexProtocol/v2/McpAppDisplayMode.js +2 -0
  222. package/vendor/runtime/dist/executor/codexProtocol/v2/McpAppUi.d.ts +9 -0
  223. package/vendor/runtime/dist/executor/codexProtocol/v2/McpAppUi.d.ts.map +1 -0
  224. package/vendor/runtime/dist/executor/codexProtocol/v2/McpAppUi.js +2 -0
  225. package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallAppContext.d.ts +8 -0
  226. package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallAppContext.d.ts.map +1 -0
  227. package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallAppContext.js +2 -0
  228. package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallError.d.ts +4 -0
  229. package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallError.d.ts.map +1 -0
  230. package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallError.js +2 -0
  231. package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallResult.d.ts +7 -0
  232. package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallResult.d.ts.map +1 -0
  233. package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallResult.js +2 -0
  234. package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallStatus.d.ts +2 -0
  235. package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallStatus.d.ts.map +1 -0
  236. package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallStatus.js +2 -0
  237. package/vendor/runtime/dist/executor/codexProtocol/v2/MemoryCitation.d.ts +6 -0
  238. package/vendor/runtime/dist/executor/codexProtocol/v2/MemoryCitation.d.ts.map +1 -0
  239. package/vendor/runtime/dist/executor/codexProtocol/v2/MemoryCitation.js +2 -0
  240. package/vendor/runtime/dist/executor/codexProtocol/v2/MemoryCitationEntry.d.ts +7 -0
  241. package/vendor/runtime/dist/executor/codexProtocol/v2/MemoryCitationEntry.d.ts.map +1 -0
  242. package/vendor/runtime/dist/executor/codexProtocol/v2/MemoryCitationEntry.js +2 -0
  243. package/vendor/runtime/dist/executor/codexProtocol/v2/MisalignmentErrorDetails.d.ts +16 -0
  244. package/vendor/runtime/dist/executor/codexProtocol/v2/MisalignmentErrorDetails.d.ts.map +1 -0
  245. package/vendor/runtime/dist/executor/codexProtocol/v2/MisalignmentErrorDetails.js +2 -0
  246. package/vendor/runtime/dist/executor/codexProtocol/v2/MisalignmentSteer.d.ts +4 -0
  247. package/vendor/runtime/dist/executor/codexProtocol/v2/MisalignmentSteer.d.ts.map +1 -0
  248. package/vendor/runtime/dist/executor/codexProtocol/v2/MisalignmentSteer.js +2 -0
  249. package/vendor/runtime/dist/executor/codexProtocol/v2/Model.d.ts +8 -0
  250. package/vendor/runtime/dist/executor/codexProtocol/v2/Model.d.ts.map +1 -1
  251. package/vendor/runtime/dist/executor/codexProtocol/v2/ModelAccessPrograms.d.ts +11 -0
  252. package/vendor/runtime/dist/executor/codexProtocol/v2/ModelAccessPrograms.d.ts.map +1 -0
  253. package/vendor/runtime/dist/executor/codexProtocol/v2/ModelAccessPrograms.js +2 -0
  254. package/vendor/runtime/dist/executor/codexProtocol/v2/NonSteerableTurnKind.d.ts +2 -0
  255. package/vendor/runtime/dist/executor/codexProtocol/v2/NonSteerableTurnKind.d.ts.map +1 -0
  256. package/vendor/runtime/dist/executor/codexProtocol/v2/NonSteerableTurnKind.js +2 -0
  257. package/vendor/runtime/dist/executor/codexProtocol/v2/PatchApplyStatus.d.ts +2 -0
  258. package/vendor/runtime/dist/executor/codexProtocol/v2/PatchApplyStatus.d.ts.map +1 -0
  259. package/vendor/runtime/dist/executor/codexProtocol/v2/PatchApplyStatus.js +2 -0
  260. package/vendor/runtime/dist/executor/codexProtocol/v2/PatchChangeKind.d.ts +9 -0
  261. package/vendor/runtime/dist/executor/codexProtocol/v2/PatchChangeKind.d.ts.map +1 -0
  262. package/vendor/runtime/dist/executor/codexProtocol/v2/PatchChangeKind.js +2 -0
  263. package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitSnapshot.d.ts +4 -0
  264. package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitSnapshot.d.ts.map +1 -1
  265. package/vendor/runtime/dist/executor/codexProtocol/v2/ReviewStartParams.d.ts +2 -0
  266. package/vendor/runtime/dist/executor/codexProtocol/v2/ReviewStartParams.d.ts.map +1 -1
  267. package/vendor/runtime/dist/executor/codexProtocol/v2/SessionSource.d.ts +7 -0
  268. package/vendor/runtime/dist/executor/codexProtocol/v2/SessionSource.d.ts.map +1 -0
  269. package/vendor/runtime/dist/executor/codexProtocol/v2/SessionSource.js +2 -0
  270. package/vendor/runtime/dist/executor/codexProtocol/v2/SubAgentActivityKind.d.ts +2 -0
  271. package/vendor/runtime/dist/executor/codexProtocol/v2/SubAgentActivityKind.d.ts.map +1 -0
  272. package/vendor/runtime/dist/executor/codexProtocol/v2/SubAgentActivityKind.js +2 -0
  273. package/vendor/runtime/dist/executor/codexProtocol/v2/Thread.d.ts +100 -0
  274. package/vendor/runtime/dist/executor/codexProtocol/v2/Thread.d.ts.map +1 -0
  275. package/vendor/runtime/dist/executor/codexProtocol/v2/Thread.js +2 -0
  276. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadActiveFlag.d.ts +2 -0
  277. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadActiveFlag.d.ts.map +1 -0
  278. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadActiveFlag.js +2 -0
  279. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadHistoryMode.d.ts +2 -0
  280. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadHistoryMode.d.ts.map +1 -0
  281. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadHistoryMode.js +2 -0
  282. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadItem.d.ts +216 -0
  283. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadItem.d.ts.map +1 -0
  284. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadItem.js +2 -0
  285. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadReadParams.d.ts +11 -0
  286. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadReadParams.d.ts.map +1 -0
  287. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadReadParams.js +2 -0
  288. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadReadResponse.d.ts +5 -0
  289. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadReadResponse.d.ts.map +1 -0
  290. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadReadResponse.js +2 -0
  291. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadResumeParams.d.ts +4 -1
  292. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadResumeParams.d.ts.map +1 -1
  293. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadSection.d.ts +19 -0
  294. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadSection.d.ts.map +1 -0
  295. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadSection.js +2 -0
  296. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadSectionAppearance.d.ts +8 -0
  297. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadSectionAppearance.d.ts.map +1 -0
  298. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadSectionAppearance.js +2 -0
  299. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadStartParams.d.ts +3 -1
  300. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadStartParams.d.ts.map +1 -1
  301. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadStatus.d.ts +12 -0
  302. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadStatus.d.ts.map +1 -0
  303. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadStatus.js +2 -0
  304. package/vendor/runtime/dist/executor/codexProtocol/v2/Turn.d.ts +36 -0
  305. package/vendor/runtime/dist/executor/codexProtocol/v2/Turn.d.ts.map +1 -0
  306. package/vendor/runtime/dist/executor/codexProtocol/v2/Turn.js +2 -0
  307. package/vendor/runtime/dist/executor/codexProtocol/v2/TurnError.d.ts +12 -0
  308. package/vendor/runtime/dist/executor/codexProtocol/v2/TurnError.d.ts.map +1 -0
  309. package/vendor/runtime/dist/executor/codexProtocol/v2/TurnError.js +2 -0
  310. package/vendor/runtime/dist/executor/codexProtocol/v2/TurnItemsView.d.ts +2 -0
  311. package/vendor/runtime/dist/executor/codexProtocol/v2/TurnItemsView.d.ts.map +1 -0
  312. package/vendor/runtime/dist/executor/codexProtocol/v2/TurnItemsView.js +2 -0
  313. package/vendor/runtime/dist/executor/codexProtocol/v2/TurnStartParams.d.ts +7 -2
  314. package/vendor/runtime/dist/executor/codexProtocol/v2/TurnStartParams.d.ts.map +1 -1
  315. package/vendor/runtime/dist/executor/codexProtocol/v2/TurnStatus.d.ts +2 -0
  316. package/vendor/runtime/dist/executor/codexProtocol/v2/TurnStatus.d.ts.map +1 -0
  317. package/vendor/runtime/dist/executor/codexProtocol/v2/TurnStatus.js +2 -0
  318. package/vendor/runtime/dist/executor/codexProtocol/v2/UserInput.d.ts +3 -0
  319. package/vendor/runtime/dist/executor/codexProtocol/v2/UserInput.d.ts.map +1 -1
  320. package/vendor/runtime/dist/executor/codexProtocol/v2/WebSearchAction.d.ts +15 -0
  321. package/vendor/runtime/dist/executor/codexProtocol/v2/WebSearchAction.d.ts.map +1 -0
  322. package/vendor/runtime/dist/executor/codexProtocol/v2/WebSearchAction.js +2 -0
  323. package/vendor/runtime/dist/executor/codexRpc.d.ts +13 -4
  324. package/vendor/runtime/dist/executor/codexRpc.d.ts.map +1 -1
  325. package/vendor/runtime/dist/executor/codexRpc.js +21 -5
  326. package/vendor/runtime/dist/executor/codexSessions.d.ts +30 -0
  327. package/vendor/runtime/dist/executor/codexSessions.d.ts.map +1 -0
  328. package/vendor/runtime/dist/executor/codexSessions.js +88 -0
  329. package/vendor/runtime/dist/executor/health.d.ts +8 -2
  330. package/vendor/runtime/dist/executor/health.d.ts.map +1 -1
  331. package/vendor/runtime/dist/executor/health.js +21 -5
  332. package/vendor/runtime/dist/executor/liveTurns.d.ts +2 -1
  333. package/vendor/runtime/dist/executor/liveTurns.d.ts.map +1 -1
  334. package/vendor/runtime/dist/executor/liveTurns.js +12 -5
  335. package/vendor/runtime/dist/executor/ownership.d.ts +40 -0
  336. package/vendor/runtime/dist/executor/ownership.d.ts.map +1 -0
  337. package/vendor/runtime/dist/executor/ownership.js +106 -0
  338. package/vendor/runtime/dist/executor/providerRouter.d.ts +1 -0
  339. package/vendor/runtime/dist/executor/providerRouter.d.ts.map +1 -1
  340. package/vendor/runtime/dist/executor/providerRouter.js +5 -0
  341. package/vendor/runtime/dist/executor/types.d.ts +27 -0
  342. package/vendor/runtime/dist/executor/types.d.ts.map +1 -1
  343. package/vendor/runtime/dist/harness/index.d.ts.map +1 -1
  344. package/vendor/runtime/dist/harness/index.js +1 -0
  345. package/vendor/runtime/dist/index.d.ts +2 -1
  346. package/vendor/runtime/dist/index.d.ts.map +1 -1
  347. package/vendor/runtime/dist/index.js +1 -0
  348. package/vendor/runtime/src/executor/asyncQueue.ts +3 -0
  349. package/vendor/runtime/src/executor/claudeAgent.ts +66 -13
  350. package/vendor/runtime/src/executor/codex.ts +124 -47
  351. package/vendor/runtime/src/executor/codexProtocol/AgentPath.ts +5 -0
  352. package/vendor/runtime/src/executor/codexProtocol/FunctionCallOutputContentItem.ts +1 -1
  353. package/vendor/runtime/src/executor/codexProtocol/ImageGenerationFailure.ts +5 -0
  354. package/vendor/runtime/src/executor/codexProtocol/ImageGenerationItem.ts +7 -0
  355. package/vendor/runtime/src/executor/codexProtocol/LegacyAppPathString.ts +27 -0
  356. package/vendor/runtime/src/executor/codexProtocol/MessagePhase.ts +11 -0
  357. package/vendor/runtime/src/executor/codexProtocol/Personality.ts +3 -0
  358. package/vendor/runtime/src/executor/codexProtocol/PlanType.ts +1 -1
  359. package/vendor/runtime/src/executor/codexProtocol/README.md +2 -2
  360. package/vendor/runtime/src/executor/codexProtocol/SleepItem.ts +8 -0
  361. package/vendor/runtime/src/executor/codexProtocol/SubAgentSource.ts +7 -0
  362. package/vendor/runtime/src/executor/codexProtocol/ThreadId.ts +10 -0
  363. package/vendor/runtime/src/executor/codexProtocol/WebSearchItem.ts +14 -0
  364. package/vendor/runtime/src/executor/codexProtocol/v2/AgentMessageDelivery.ts +5 -0
  365. package/vendor/runtime/src/executor/codexProtocol/v2/AsyncUserInputQuestion.ts +5 -0
  366. package/vendor/runtime/src/executor/codexProtocol/v2/CodexErrorInfo.ts +12 -0
  367. package/vendor/runtime/src/executor/codexProtocol/v2/CollabAgentState.ts +6 -0
  368. package/vendor/runtime/src/executor/codexProtocol/v2/CollabAgentStatus.ts +5 -0
  369. package/vendor/runtime/src/executor/codexProtocol/v2/CollabAgentTool.ts +5 -0
  370. package/vendor/runtime/src/executor/codexProtocol/v2/CollabAgentToolCallStatus.ts +5 -0
  371. package/vendor/runtime/src/executor/codexProtocol/v2/CommandAction.ts +6 -0
  372. package/vendor/runtime/src/executor/codexProtocol/v2/CommandExecutionSource.ts +5 -0
  373. package/vendor/runtime/src/executor/codexProtocol/v2/CommandExecutionStatus.ts +5 -0
  374. package/vendor/runtime/src/executor/codexProtocol/v2/CyberAccessProgram.ts +9 -0
  375. package/vendor/runtime/src/executor/codexProtocol/v2/DynamicToolCallOutputContentItem.ts +5 -0
  376. package/vendor/runtime/src/executor/codexProtocol/v2/DynamicToolCallStatus.ts +5 -0
  377. package/vendor/runtime/src/executor/codexProtocol/v2/FileUpdateChange.ts +6 -0
  378. package/vendor/runtime/src/executor/codexProtocol/v2/GetAccountRateLimitsResponse.ts +5 -0
  379. package/vendor/runtime/src/executor/codexProtocol/v2/GitInfo.ts +5 -0
  380. package/vendor/runtime/src/executor/codexProtocol/v2/HookPromptFragment.ts +5 -0
  381. package/vendor/runtime/src/executor/codexProtocol/v2/McpAppDisplayMode.ts +5 -0
  382. package/vendor/runtime/src/executor/codexProtocol/v2/McpAppUi.ts +9 -0
  383. package/vendor/runtime/src/executor/codexProtocol/v2/McpToolCallAppContext.ts +5 -0
  384. package/vendor/runtime/src/executor/codexProtocol/v2/McpToolCallError.ts +5 -0
  385. package/vendor/runtime/src/executor/codexProtocol/v2/McpToolCallResult.ts +6 -0
  386. package/vendor/runtime/src/executor/codexProtocol/v2/McpToolCallStatus.ts +5 -0
  387. package/vendor/runtime/src/executor/codexProtocol/v2/MemoryCitation.ts +6 -0
  388. package/vendor/runtime/src/executor/codexProtocol/v2/MemoryCitationEntry.ts +5 -0
  389. package/vendor/runtime/src/executor/codexProtocol/v2/MisalignmentErrorDetails.ts +18 -0
  390. package/vendor/runtime/src/executor/codexProtocol/v2/MisalignmentSteer.ts +5 -0
  391. package/vendor/runtime/src/executor/codexProtocol/v2/Model.ts +11 -2
  392. package/vendor/runtime/src/executor/codexProtocol/v2/ModelAccessPrograms.ts +13 -0
  393. package/vendor/runtime/src/executor/codexProtocol/v2/NonSteerableTurnKind.ts +5 -0
  394. package/vendor/runtime/src/executor/codexProtocol/v2/PatchApplyStatus.ts +5 -0
  395. package/vendor/runtime/src/executor/codexProtocol/v2/PatchChangeKind.ts +5 -0
  396. package/vendor/runtime/src/executor/codexProtocol/v2/RateLimitSnapshot.ts +5 -1
  397. package/vendor/runtime/src/executor/codexProtocol/v2/ReviewStartParams.ts +2 -0
  398. package/vendor/runtime/src/executor/codexProtocol/v2/SessionSource.ts +6 -0
  399. package/vendor/runtime/src/executor/codexProtocol/v2/SubAgentActivityKind.ts +5 -0
  400. package/vendor/runtime/src/executor/codexProtocol/v2/Thread.ts +104 -0
  401. package/vendor/runtime/src/executor/codexProtocol/v2/ThreadActiveFlag.ts +5 -0
  402. package/vendor/runtime/src/executor/codexProtocol/v2/ThreadHistoryMode.ts +5 -0
  403. package/vendor/runtime/src/executor/codexProtocol/v2/ThreadItem.ts +125 -0
  404. package/vendor/runtime/src/executor/codexProtocol/v2/ThreadReadParams.ts +12 -0
  405. package/vendor/runtime/src/executor/codexProtocol/v2/ThreadReadResponse.ts +6 -0
  406. package/vendor/runtime/src/executor/codexProtocol/v2/ThreadResumeParams.ts +5 -1
  407. package/vendor/runtime/src/executor/codexProtocol/v2/ThreadSection.ts +21 -0
  408. package/vendor/runtime/src/executor/codexProtocol/v2/ThreadSectionAppearance.ts +8 -0
  409. package/vendor/runtime/src/executor/codexProtocol/v2/ThreadStartParams.ts +4 -1
  410. package/vendor/runtime/src/executor/codexProtocol/v2/ThreadStatus.ts +6 -0
  411. package/vendor/runtime/src/executor/codexProtocol/v2/Turn.ts +37 -0
  412. package/vendor/runtime/src/executor/codexProtocol/v2/TurnError.ts +11 -0
  413. package/vendor/runtime/src/executor/codexProtocol/v2/TurnItemsView.ts +5 -0
  414. package/vendor/runtime/src/executor/codexProtocol/v2/TurnStartParams.ts +7 -2
  415. package/vendor/runtime/src/executor/codexProtocol/v2/TurnStatus.ts +5 -0
  416. package/vendor/runtime/src/executor/codexProtocol/v2/UserInput.ts +1 -1
  417. package/vendor/runtime/src/executor/codexProtocol/v2/WebSearchAction.ts +5 -0
  418. package/vendor/runtime/src/executor/codexRpc.ts +26 -6
  419. package/vendor/runtime/src/executor/codexSessions.ts +108 -0
  420. package/vendor/runtime/src/executor/health.ts +21 -7
  421. package/vendor/runtime/src/executor/liveTurns.ts +12 -5
  422. package/vendor/runtime/src/executor/ownership.ts +83 -0
  423. package/vendor/runtime/src/executor/providerRouter.ts +6 -0
  424. package/vendor/runtime/src/executor/types.ts +20 -1
  425. package/vendor/runtime/src/harness/index.ts +1 -0
  426. package/vendor/runtime/src/index.ts +2 -1
  427. package/vendor/shared/dist/agentCommands.d.ts +1 -0
  428. package/vendor/shared/dist/agentCommands.d.ts.map +1 -1
  429. package/vendor/shared/dist/automations.d.ts +34 -0
  430. package/vendor/shared/dist/automations.d.ts.map +1 -1
  431. package/vendor/shared/dist/automations.js +12 -0
  432. package/vendor/shared/dist/cardStudio.d.ts +41 -0
  433. package/vendor/shared/dist/cardStudio.d.ts.map +1 -1
  434. package/vendor/shared/dist/cardStudio.js +13 -3
  435. package/vendor/shared/dist/computer.d.ts +7 -1
  436. package/vendor/shared/dist/computer.d.ts.map +1 -1
  437. package/vendor/shared/dist/computer.js +13 -4
  438. package/vendor/shared/dist/constants.d.ts +3 -3
  439. package/vendor/shared/dist/constants.d.ts.map +1 -1
  440. package/vendor/shared/dist/constants.js +8 -14
  441. package/vendor/shared/dist/goalNotes.d.ts +4 -0
  442. package/vendor/shared/dist/goalNotes.d.ts.map +1 -0
  443. package/vendor/shared/dist/goalNotes.js +23 -0
  444. package/vendor/shared/dist/goals.d.ts +835 -0
  445. package/vendor/shared/dist/goals.d.ts.map +1 -0
  446. package/vendor/shared/dist/goals.js +198 -0
  447. package/vendor/shared/dist/index.d.ts +7 -2
  448. package/vendor/shared/dist/index.d.ts.map +1 -1
  449. package/vendor/shared/dist/index.js +6 -1
  450. package/vendor/shared/dist/journal-vault.d.ts +1 -1
  451. package/vendor/shared/dist/messagingSafety.d.ts +21 -0
  452. package/vendor/shared/dist/messagingSafety.d.ts.map +1 -0
  453. package/vendor/shared/dist/messagingSafety.js +8 -0
  454. package/vendor/shared/dist/schemas/harness.d.ts +199 -169
  455. package/vendor/shared/dist/schemas/harness.d.ts.map +1 -1
  456. package/vendor/shared/dist/schemas/harness.js +25 -124
  457. package/vendor/shared/dist/smartCapture.d.ts +24 -0
  458. package/vendor/shared/dist/smartCapture.d.ts.map +1 -1
  459. package/vendor/shared/dist/smartCapture.js +15 -0
  460. package/vendor/shared/dist/taskSync.d.ts +342 -0
  461. package/vendor/shared/dist/taskSync.d.ts.map +1 -0
  462. package/vendor/shared/dist/taskSync.js +111 -0
  463. package/vendor/shared/dist/types.d.ts +1 -4
  464. package/vendor/shared/dist/types.d.ts.map +1 -1
  465. package/vendor/shared/dist/voiceCapture.d.ts +1 -1
  466. package/vendor/shared/dist/workspaces.d.ts +255 -0
  467. package/vendor/shared/dist/workspaces.d.ts.map +1 -0
  468. package/vendor/shared/dist/workspaces.js +89 -0
  469. package/vendor/shared/src/agentCommands.ts +1 -0
  470. package/vendor/shared/src/automations.ts +12 -0
  471. package/vendor/shared/src/cardStudio.ts +13 -3
  472. package/vendor/shared/src/computer.ts +19 -5
  473. package/vendor/shared/src/constants.ts +8 -14
  474. package/vendor/shared/src/goalNotes.ts +23 -0
  475. package/vendor/shared/src/goals.ts +237 -0
  476. package/vendor/shared/src/index.ts +7 -6
  477. package/vendor/shared/src/messagingSafety.ts +11 -0
  478. package/vendor/shared/src/schemas/harness.ts +24 -130
  479. package/vendor/shared/src/smartCapture.ts +27 -0
  480. package/vendor/shared/src/taskSync.ts +81 -0
  481. package/vendor/shared/src/types.ts +0 -6
  482. package/vendor/shared/src/workspaces.ts +103 -0
  483. package/dist/coding/conduct.d.ts +0 -69
  484. package/dist/coding/conduct.d.ts.map +0 -1
  485. package/dist/coding/conduct.js +0 -348
  486. package/dist/coding/fleetIntegrate.d.ts +0 -37
  487. package/dist/coding/fleetIntegrate.d.ts.map +0 -1
  488. package/dist/coding/fleetIntegrate.js +0 -64
  489. package/dist/coding/fleetPlan.d.ts +0 -20
  490. package/dist/coding/fleetPlan.d.ts.map +0 -1
  491. package/dist/coding/fleetPlan.js +0 -125
  492. package/dist/coding/fleetTasks.d.ts +0 -33
  493. package/dist/coding/fleetTasks.d.ts.map +0 -1
  494. package/dist/coding/fleetTasks.js +0 -75
  495. package/dist/coding/openFleetPr.d.ts +0 -41
  496. package/dist/coding/openFleetPr.d.ts.map +0 -1
  497. package/dist/coding/openFleetPr.js +0 -121
  498. package/src/coding/conduct.ts +0 -462
  499. package/src/coding/fleetIntegrate.ts +0 -95
  500. package/src/coding/fleetPlan.ts +0 -135
  501. package/src/coding/fleetTasks.ts +0 -109
  502. package/src/coding/openFleetPr.ts +0 -148
package/src/vault.ts CHANGED
@@ -24,9 +24,9 @@ export interface Vault {
24
24
  /** SOUL.md if present (and non-empty), else the packaged default — seeding SOUL.md so it's editable. */
25
25
  readPersona(): string;
26
26
  /** Durable facts from MEMORY.md (empty if absent/malformed). */
27
- readMemoryFacts(): string[];
28
- writeMemoryFacts(facts: string[]): void;
29
- writeSessionLog(entry: SessionEntry): void;
27
+ readMemoryFacts(strict?: boolean): string[];
28
+ writeMemoryFacts(facts: string[], strict?: boolean): void;
29
+ writeSessionLog(entry: SessionEntry, receipt?: { id: string; strict: boolean }): void;
30
30
  }
31
31
 
32
32
  function msg(err: unknown): string {
@@ -56,26 +56,28 @@ export function createVault(vaultPath: string): Vault {
56
56
  return def;
57
57
  },
58
58
 
59
- readMemoryFacts(): string[] {
59
+ readMemoryFacts(strict = false): string[] {
60
60
  if (!existsSync(memoryPath)) return [];
61
61
  try {
62
62
  return parseFacts(readFileSync(memoryPath, 'utf8'));
63
63
  } catch (err) {
64
+ if (strict) throw err;
64
65
  console.error(`[vault] could not read MEMORY.md: ${msg(err)}`);
65
66
  return [];
66
67
  }
67
68
  },
68
69
 
69
- writeMemoryFacts(facts: string[]): void {
70
+ writeMemoryFacts(facts: string[], strict = false): void {
70
71
  try {
71
72
  mkdirSync(vaultPath, { recursive: true });
72
73
  writeFileSync(memoryPath, renderMemoryFile(facts), 'utf8');
73
74
  } catch (err) {
75
+ if (strict) throw err;
74
76
  console.error(`[vault] could not write MEMORY.md: ${msg(err)}`);
75
77
  }
76
78
  },
77
79
 
78
- writeSessionLog(entry: SessionEntry): void {
80
+ writeSessionLog(entry: SessionEntry, receipt?: { id: string; strict: boolean }): void {
79
81
  try {
80
82
  mkdirSync(sessionsDir, { recursive: true });
81
83
  const kind = entry.kind ?? 'briefing';
@@ -88,8 +90,15 @@ export function createVault(vaultPath: string): Vault {
88
90
  `Delivered via: ${entry.deliveredVia}\n\n` +
89
91
  `## Message\n\n${entry.body.trim()}\n\n` +
90
92
  `## Facts learned\n\n${facts}\n`;
91
- writeFileSync(join(sessionsDir, `${stamp}-${kind}.md`), content, 'utf8');
93
+ if (receipt && !/^[a-zA-Z0-9-]+$/.test(receipt.id)) throw new Error('Invalid session receipt ID');
94
+ const path = join(sessionsDir, `${receipt?.id ?? stamp}-${kind}.md`);
95
+ if (receipt && existsSync(path)) {
96
+ if (readFileSync(path, 'utf8') !== content) throw new Error('The saved briefing was changed outside this run.');
97
+ return;
98
+ }
99
+ writeFileSync(path, content, { encoding: 'utf8', flag: receipt ? 'wx' : 'w' });
92
100
  } catch (err) {
101
+ if (receipt?.strict) throw err;
93
102
  console.error(`[vault] could not write session log: ${msg(err)}`);
94
103
  }
95
104
  },
@@ -8,6 +8,7 @@ import { registerTaskTrashTools } from './tools/taskTrash.js';
8
8
  import { registerTaskOccurrenceTools } from './tools/taskOccurrences.js';
9
9
  import { setClientNameReader } from './client.js';
10
10
  import { registerProjectTools } from './tools/projects.js';
11
+ import { registerGoalTools } from './tools/goals.js';
11
12
  import { registerQueryTools } from './tools/queries.js';
12
13
  import { registerMilestoneTools } from './tools/milestones.js';
13
14
  import { registerCommentTools } from './tools/comments.js';
@@ -31,6 +32,7 @@ registerTaskActivityTools(server);
31
32
  registerTaskTrashTools(server);
32
33
  registerTaskOccurrenceTools(server);
33
34
  registerProjectTools(server);
35
+ registerGoalTools(server);
34
36
  registerQueryTools(server);
35
37
  registerMilestoneTools(server);
36
38
  registerCommentTools(server);
@@ -0,0 +1,4 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ /** Discussion can inspect goals; it cannot approve its own proposed work. */
3
+ export declare function registerGoalTools(server: McpServer): void;
4
+ //# sourceMappingURL=goals.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"goals.d.ts","sourceRoot":"","sources":["../../src/tools/goals.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAWzE,6EAA6E;AAC7E,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,QAiDlD"}
@@ -0,0 +1,38 @@
1
+ import { z } from '#lucidity-zod';
2
+ import { apiRequest } from '../client.js';
3
+ /** Discussion can inspect goals; it cannot approve its own proposed work. */
4
+ export function registerGoalTools(server) {
5
+ const annotations = {
6
+ readOnlyHint: true,
7
+ destructiveHint: false,
8
+ idempotentHint: true,
9
+ openWorldHint: false,
10
+ };
11
+ server.tool('list_goals', 'List personal goals, their timeframes and latest dated observations. Missing checks do not mean inactivity.', {}, annotations, async () => {
12
+ const result = await apiRequest('/api/goals');
13
+ return {
14
+ content: [
15
+ {
16
+ type: 'text',
17
+ text: JSON.stringify(result.goals.map(({ goal, checks }) => ({
18
+ goal,
19
+ latestCheck: checks.find((check) => check.cadence === 'daily') ?? null,
20
+ }))),
21
+ },
22
+ ],
23
+ };
24
+ });
25
+ server.tool('get_goal', 'Read one personal goal with linked sources, evidence, reviews and draft proposals. Work must be approved in the app; a context link is not permission to act.', { id: z.string().uuid() }, annotations, async ({ id }) => {
26
+ const result = await apiRequest('/api/goals');
27
+ const goal = result.goals.find((detail) => detail.goal.id === id);
28
+ return {
29
+ content: [
30
+ {
31
+ type: 'text',
32
+ text: goal ? JSON.stringify(goal) : 'Goal not found.',
33
+ },
34
+ ],
35
+ isError: !goal,
36
+ };
37
+ });
38
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lucidity/mcp-server",
3
- "version": "0.7.0",
3
+ "version": "0.9.5",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "bin": {
@@ -9,6 +9,7 @@ import { registerTaskTrashTools } from './tools/taskTrash.js';
9
9
  import { registerTaskOccurrenceTools } from './tools/taskOccurrences.js';
10
10
  import { setClientNameReader } from './client.js';
11
11
  import { registerProjectTools } from './tools/projects.js';
12
+ import { registerGoalTools } from './tools/goals.js';
12
13
  import { registerQueryTools } from './tools/queries.js';
13
14
  import { registerMilestoneTools } from './tools/milestones.js';
14
15
  import { registerCommentTools } from './tools/comments.js';
@@ -41,6 +42,7 @@ registerTaskActivityTools(server);
41
42
  registerTaskTrashTools(server);
42
43
  registerTaskOccurrenceTools(server);
43
44
  registerProjectTools(server);
45
+ registerGoalTools(server);
44
46
  registerQueryTools(server);
45
47
  registerMilestoneTools(server);
46
48
  registerCommentTools(server);
@@ -0,0 +1,62 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import { z } from '#lucidity-zod';
3
+ import { apiRequest } from '../client.js';
4
+ // This independently published package keeps its small API projection local.
5
+ interface GoalsSnapshot {
6
+ goals: {
7
+ goal: { id: string; [key: string]: unknown };
8
+ checks: { cadence: string; [key: string]: unknown }[];
9
+ }[];
10
+ }
11
+
12
+ /** Discussion can inspect goals; it cannot approve its own proposed work. */
13
+ export function registerGoalTools(server: McpServer) {
14
+ const annotations = {
15
+ readOnlyHint: true,
16
+ destructiveHint: false,
17
+ idempotentHint: true,
18
+ openWorldHint: false,
19
+ };
20
+ server.tool(
21
+ 'list_goals',
22
+ 'List personal goals, their timeframes and latest dated observations. Missing checks do not mean inactivity.',
23
+ {},
24
+ annotations,
25
+ async () => {
26
+ const result = await apiRequest<GoalsSnapshot>('/api/goals');
27
+ return {
28
+ content: [
29
+ {
30
+ type: 'text' as const,
31
+ text: JSON.stringify(
32
+ result.goals.map(({ goal, checks }) => ({
33
+ goal,
34
+ latestCheck:
35
+ checks.find((check) => check.cadence === 'daily') ?? null,
36
+ })),
37
+ ),
38
+ },
39
+ ],
40
+ };
41
+ },
42
+ );
43
+ server.tool(
44
+ 'get_goal',
45
+ 'Read one personal goal with linked sources, evidence, reviews and draft proposals. Work must be approved in the app; a context link is not permission to act.',
46
+ { id: z.string().uuid() },
47
+ annotations,
48
+ async ({ id }) => {
49
+ const result = await apiRequest<GoalsSnapshot>('/api/goals');
50
+ const goal = result.goals.find((detail) => detail.goal.id === id);
51
+ return {
52
+ content: [
53
+ {
54
+ type: 'text' as const,
55
+ text: goal ? JSON.stringify(goal) : 'Goal not found.',
56
+ },
57
+ ],
58
+ isError: !goal,
59
+ };
60
+ },
61
+ );
62
+ }
@@ -17,9 +17,9 @@ The runtime just turns data into prompts and runs them through an executor.
17
17
 
18
18
  **Executor seam** — the boundary between prompt assembly and the model engine:
19
19
  - `AgentExecutor`: buffered/streamed runs, active-turn correction, model discovery, and disposal.
20
- - `ClaudeAgentExecutor`: pinned Agent SDK 0.3.267 and its bundled runtime, with subscription
20
+ - `ClaudeAgentExecutor`: pinned Agent SDK 0.3.287 and its bundled runtime, with subscription
21
21
  authentication, streaming input, cancellation, and tool permissions.
22
- - `CodexExecutor`: pinned Codex 0.153.4 App Server over local stdio, with ChatGPT login,
22
+ - `CodexExecutor`: pinned Codex 0.160.0 App Server over local stdio, with ChatGPT login,
23
23
  generated protocol types, thread resume, steering, interruption, and scoped MCP tools.
24
24
  - `HealthAwareExecutor`: observes authentication and inference failures on the same adapters
25
25
  used for interactive and scheduled work. Catalog success leaves allowance unknown;
@@ -71,3 +71,37 @@ regenerate with `node scripts/generate-codex-protocol.mjs`, and run the pin chec
71
71
  and authenticated provider smoke checks. Keep changes reviewable in one PR. Never regenerate
72
72
  against a PATH-selected Codex. Model availability, shared login state, and provider-side behavior
73
73
  can still change independently of the local package pin.
74
+
75
+ ## Restart inspection
76
+
77
+ Adapters expose `recoveryCapability`, `inspect(ref, { cwd, timeoutMs })`, and a
78
+ synchronous `onRecovery` callback on executions. The callback persists native
79
+ session/thread, turn and process identifiers before execution continues. Tool
80
+ events retain native item IDs and outcomes when the provider supplies them.
81
+ `inspect` never starts inference or runs a tool.
82
+
83
+ - Codex 0.160.0 supports `native-turn`: a fresh App Server connection uses
84
+ `thread/read`, matches the exact saved thread and turn, requires a completed
85
+ turn with full items, and recovers its final answer. An active thread, partial
86
+ items, missing turn, timeout, authentication problem or unreadable history stays
87
+ unknown. Native command turns are excluded from this recovery path.
88
+ - Claude Agent SDK 0.3.287 supports `completion-receipt`: Lucidity persists the
89
+ successful native result before publishing it. The pinned SDK's session-message
90
+ history does not expose a durable terminal run result, so native history alone
91
+ cannot recover the gap before this receipt. Its inspector explicitly reports
92
+ that limitation. A session ID or partial assistant message is never completion
93
+ evidence.
94
+
95
+ The daemon wraps ordinary streaming Ask and Code turns in `RecoveryExecutor`.
96
+ Structured planning results still require their normal consumer validation, and
97
+ host-controlled briefing steps use `SavedWorkflow`. Startup reconciliation happens
98
+ under the daemon lease before queue admission. A surviving prior owner/native
99
+ process prevents a replacement from starting work. Proven answers flow through the
100
+ ordered event log once. Already-terminal uncertain runs retain their original
101
+ terminal and receive a linked reconciliation record for review.
102
+
103
+ Verification on 6 October 2026: runtime regressions and process-kill fixtures cover
104
+ both capabilities; live Codex inspection recovered a native answer without a new
105
+ inference. Live Claude validation was blocked because `claude auth status` reported
106
+ `loggedIn: false` and no configured OAuth token authenticated the SDK. Rerun that
107
+ live check after subscription sign-in; this does not authorize API-key billing.
@@ -6,6 +6,7 @@ export declare class AsyncQueue<T> implements AsyncIterable<T> {
6
6
  private error?;
7
7
  push(item: T): void;
8
8
  end(error?: Error): void;
9
+ discardPending(): void;
9
10
  [Symbol.asyncIterator](): AsyncGenerator<T>;
10
11
  }
11
12
  //# sourceMappingURL=asyncQueue.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"asyncQueue.d.ts","sourceRoot":"","sources":["../../src/executor/asyncQueue.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,qBAAa,UAAU,CAAC,CAAC,CAAE,YAAW,aAAa,CAAC,CAAC,CAAC;IACpD,OAAO,CAAC,KAAK,CAAW;IACxB,OAAO,CAAC,IAAI,CAAC,CAAa;IAC1B,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,KAAK,CAAC,CAAQ;IAEtB,IAAI,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI;IAKnB,GAAG,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI;IAKjB,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,cAAc,CAAC,CAAC,CAAC;CAenD"}
1
+ {"version":3,"file":"asyncQueue.d.ts","sourceRoot":"","sources":["../../src/executor/asyncQueue.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,qBAAa,UAAU,CAAC,CAAC,CAAE,YAAW,aAAa,CAAC,CAAC,CAAC;IACpD,OAAO,CAAC,KAAK,CAAW;IACxB,OAAO,CAAC,IAAI,CAAC,CAAa;IAC1B,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,KAAK,CAAC,CAAQ;IAEtB,IAAI,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI;IAKnB,GAAG,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI;IAKxB,cAAc,IAAI,IAAI;IAGf,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,cAAc,CAAC,CAAC,CAAC;CAenD"}
@@ -15,6 +15,9 @@ export class AsyncQueue {
15
15
  this.error = error;
16
16
  this.wake?.();
17
17
  }
18
+ discardPending() {
19
+ this.items = [];
20
+ }
18
21
  async *[Symbol.asyncIterator]() {
19
22
  for (;;) {
20
23
  if (this.items.length) {
@@ -1,7 +1,7 @@
1
1
  import { type AgentCommandOption } from '@lucidity/shared';
2
2
  import { query, type Options, type AccountInfo } from '@anthropic-ai/claude-agent-sdk';
3
3
  import type { AgentExecutor, ExecutorRunInput, ExecutorStreamEvent, ExecutorResult, ExecutorModel } from './types.js';
4
- export declare const CLAUDE_AGENT_SDK_VERSION = "0.3.267";
4
+ export declare const CLAUDE_AGENT_SDK_VERSION = "0.3.287";
5
5
  export declare function claudeSubscriptionEnv(oauthToken?: string): NodeJS.ProcessEnv;
6
6
  export declare function claudeAgentOptions(input: ExecutorRunInput, oauthToken?: string): Options;
7
7
  /** Check resolved authentication after settings load, before sending any prompt. */
@@ -11,10 +11,14 @@ export declare class ClaudeAgentExecutor implements AgentExecutor {
11
11
  private readonly options;
12
12
  readonly name = "claude-agent-sdk";
13
13
  readonly strictResume = true;
14
+ readonly recoveryCapability = "completion-receipt";
15
+ inspect(): Promise<import('./types.js').ProviderInspection>;
14
16
  private readonly turns;
15
17
  constructor(options?: {
16
18
  oauthToken?: string;
17
19
  query?: typeof query;
20
+ /** How long to wait for a closing loop after the last background task ends. */
21
+ backgroundGraceMs?: number;
18
22
  });
19
23
  steer(requestId: string, text: string): Promise<void>;
20
24
  interrupt(requestId: string): Promise<boolean>;
@@ -1 +1 @@
1
- {"version":3,"file":"claudeAgent.d.ts","sourceRoot":"","sources":["../../src/executor/claudeAgent.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,KAAK,EACL,KAAK,OAAO,EAGZ,KAAK,WAAW,EACjB,MAAM,gCAAgC,CAAC;AAIxC,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,EACd,aAAa,EACd,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,wBAAwB,YAAY,CAAC;AAIlD,wBAAgB,qBAAqB,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,UAAU,CAa5E;AA4BD,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,gBAAgB,EACvB,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CA8ET;AAED,oFAAoF;AACpF,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAuBpE;AAmBD,mFAAmF;AACnF,qBAAa,mBAAoB,YAAW,aAAa;IAKrD,OAAO,CAAC,QAAQ,CAAC,OAAO;IAJ1B,QAAQ,CAAC,IAAI,sBAAsB;IACnC,QAAQ,CAAC,YAAY,QAAQ;IAC7B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAmB;gBAEtB,OAAO,GAAE;QACxB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;KACjB;IAGR,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAG/B,SAAS,CAAC,SAAS,EAAE,MAAM;IAG3B,OAAO;IAIb,gFAAgF;IAC1E,MAAM,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;IA0ClC,QAAQ,CAAC,KAAK,GAAE,IAAI,CAAC,gBAAgB,EAAE,KAAK,GAAG,gBAAgB,GAAG,KAAK,CAAM,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAgC7G,GAAG,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,cAAc,CAAC;IAMpD,SAAS,CACd,KAAK,EAAE,gBAAgB,GACtB,aAAa,CAAC,mBAAmB,CAAC;CAuJtC"}
1
+ {"version":3,"file":"claudeAgent.d.ts","sourceRoot":"","sources":["../../src/executor/claudeAgent.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,kBAAkB,CAAC;AAI1B,OAAO,EACL,KAAK,EACL,KAAK,OAAO,EAGZ,KAAK,WAAW,EACjB,MAAM,gCAAgC,CAAC;AAIxC,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,EACd,aAAa,EACd,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,wBAAwB,YAAY,CAAC;AAIlD,wBAAgB,qBAAqB,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,UAAU,CAa5E;AA4BD,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,gBAAgB,EACvB,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CA8ET;AAED,oFAAoF;AACpF,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAuBpE;AAmBD,mFAAmF;AACnF,qBAAa,mBAAoB,YAAW,aAAa;IASrD,OAAO,CAAC,QAAQ,CAAC,OAAO;IAR1B,QAAQ,CAAC,IAAI,sBAAsB;IACnC,QAAQ,CAAC,YAAY,QAAQ;IAC7B,QAAQ,CAAC,kBAAkB,wBAAwB;IAC7C,OAAO,IAAI,OAAO,CAAC,OAAO,YAAY,EAAE,kBAAkB,CAAC;IAGjE,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAmB;gBAEtB,OAAO,GAAE;QACxB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;QACrB,+EAA+E;QAC/E,iBAAiB,CAAC,EAAE,MAAM,CAAC;KACvB;IAGR,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAG/B,SAAS,CAAC,SAAS,EAAE,MAAM;IAG3B,OAAO;IAIb,gFAAgF;IAC1E,MAAM,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;IA2ClC,QAAQ,CAAC,KAAK,GAAE,IAAI,CAAC,gBAAgB,EAAE,KAAK,GAAG,gBAAgB,GAAG,KAAK,CAAM,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAiC7G,GAAG,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,cAAc,CAAC;IAMpD,SAAS,CACd,KAAK,EAAE,gBAAgB,GACtB,aAAa,CAAC,mBAAmB,CAAC;CAmMtC"}
@@ -1,11 +1,12 @@
1
1
  import { findAgentCommand, parseAgentCommand, } from '@lucidity/shared';
2
2
  import { randomUUID } from 'node:crypto';
3
+ import { spawn } from 'node:child_process';
3
4
  import { readFileSync } from 'node:fs';
4
5
  import { query, } from '@anthropic-ai/claude-agent-sdk';
5
6
  import { stripUnsafeEnv } from './claudeCode.js';
6
7
  import { AsyncQueue } from './asyncQueue.js';
7
8
  import { LiveTurns } from './liveTurns.js';
8
- export const CLAUDE_AGENT_SDK_VERSION = '0.3.267';
9
+ export const CLAUDE_AGENT_SDK_VERSION = '0.3.287';
9
10
  const INTERACTIVE_TOOLS = ['AskUserQuestion', 'EnterPlanMode', 'ExitPlanMode'];
10
11
  const WRITE_TOOLS = ['Bash', 'Write', 'Edit', 'NotebookEdit'];
11
12
  export function claudeSubscriptionEnv(oauthToken) {
@@ -54,7 +55,7 @@ export function claudeAgentOptions(input, oauthToken) {
54
55
  : {};
55
56
  return {
56
57
  cwd: input.cwd,
57
- env: claudeSubscriptionEnv(oauthToken),
58
+ env: { ...claudeSubscriptionEnv(oauthToken), ...input.env },
58
59
  model: input.model,
59
60
  effort: input.effort,
60
61
  outputFormat: input.outputSchema ? { type: 'json_schema', schema: input.outputSchema } : undefined,
@@ -152,6 +153,10 @@ export class ClaudeAgentExecutor {
152
153
  options;
153
154
  name = 'claude-agent-sdk';
154
155
  strictResume = true;
156
+ recoveryCapability = 'completion-receipt';
157
+ async inspect() {
158
+ return { status: 'unsupported', reason: 'Claude SDK 0.3.287 history contains messages, not a durable run-completion receipt. Partial text cannot establish completion.' };
159
+ }
155
160
  turns = new LiveTurns();
156
161
  constructor(options = {}) {
157
162
  this.options = options;
@@ -163,7 +168,7 @@ export class ClaudeAgentExecutor {
163
168
  return this.turns.interrupt(requestId);
164
169
  }
165
170
  async dispose() {
166
- this.turns.dispose();
171
+ await this.turns.dispose();
167
172
  }
168
173
  /** Start the SDK control channel without ever supplying an inference prompt. */
169
174
  async models() {
@@ -202,6 +207,7 @@ export class ClaudeAgentExecutor {
202
207
  incoming.end();
203
208
  abortController.abort();
204
209
  active.close();
210
+ await active.return();
205
211
  }
206
212
  }
207
213
  async commands(input = {}) {
@@ -231,6 +237,7 @@ export class ClaudeAgentExecutor {
231
237
  incoming.end();
232
238
  abortController.abort();
233
239
  active.close();
240
+ await active.return();
234
241
  }
235
242
  }
236
243
  async run(input) {
@@ -254,6 +261,12 @@ export class ClaudeAgentExecutor {
254
261
  let ended = false;
255
262
  let ready = false;
256
263
  const pending = new Set();
264
+ // Sub-agents and background commands outlive the loop that started them. The turn stays
265
+ // open while any are live, and `carried` holds what Claude said before they reported back.
266
+ let background = 0;
267
+ const carried = [];
268
+ let carriedSession = '';
269
+ let grace;
257
270
  const owner = this.turns.open(input, async (text) => {
258
271
  if (command)
259
272
  throw new Error('Wait for the command to finish before sending a message.');
@@ -272,6 +285,18 @@ export class ClaudeAgentExecutor {
272
285
  options: {
273
286
  ...claudeAgentOptions(input, this.options.oauthToken),
274
287
  abortController: owner.controller,
288
+ ...(input.onRecovery ? { spawnClaudeCodeProcess: (options) => {
289
+ const child = spawn(options.command, options.args, { cwd: options.cwd, env: options.env, signal: options.signal, stdio: ['pipe', 'pipe', 'pipe'] });
290
+ child.stderr.on('data', () => { });
291
+ try {
292
+ input.onRecovery({ pid: child.pid });
293
+ }
294
+ catch (error) {
295
+ child.kill('SIGKILL');
296
+ throw error;
297
+ }
298
+ return child;
299
+ } } : {}),
275
300
  },
276
301
  });
277
302
  requireClaudeSubscription(await active.accountInfo());
@@ -287,12 +312,27 @@ export class ClaudeAgentExecutor {
287
312
  });
288
313
  yield { type: 'tool_call', name: `/${commandName}`, phase: 'start' };
289
314
  }
315
+ input.onRecovery?.({ turnId: initial.uuid, inspectionDisabled: !!command });
290
316
  incoming.push(initial);
291
317
  ready = true;
292
318
  for await (const event of active) {
293
319
  owner.check();
294
- if (event.type === 'system' && event.subtype === 'init')
320
+ if (event.type === 'system' && event.subtype === 'background_tasks_changed') {
321
+ background = event.tasks.filter((task) => !task.ambient).length;
322
+ // Finished work normally starts another loop. If none follows (a task was stopped,
323
+ // say), close the input so the query ends and the turn settles with what it has.
324
+ if (!background && carried.length && !grace)
325
+ grace = setTimeout(() => incoming.end(), this.options.backgroundGraceMs ?? 90_000);
326
+ continue;
327
+ }
328
+ if (grace) {
329
+ clearTimeout(grace);
330
+ grace = undefined;
331
+ }
332
+ if (event.type === 'system' && event.subtype === 'init') {
333
+ input.onRecovery?.({ sessionId: event.session_id });
295
334
  yield { type: 'session', sessionId: event.session_id };
335
+ }
296
336
  if (event.type === 'system' &&
297
337
  event.subtype === 'local_command_output' &&
298
338
  command) {
@@ -316,6 +356,7 @@ export class ClaudeAgentExecutor {
316
356
  type: 'tool_call',
317
357
  name: e.content_block.name,
318
358
  phase: 'start',
359
+ itemId: e.content_block.id,
319
360
  };
320
361
  }
321
362
  }
@@ -325,23 +366,35 @@ export class ClaudeAgentExecutor {
325
366
  if (block.type === 'tool_result') {
326
367
  const name = toolNames.get(block.tool_use_id);
327
368
  if (name) {
328
- yield { type: 'tool_call', name, phase: 'end' };
369
+ yield { type: 'tool_call', name, phase: 'end', itemId: block.tool_use_id, outcome: block.is_error ? 'failed' : 'completed' };
329
370
  toolNames.delete(block.tool_use_id);
330
371
  }
331
372
  }
332
373
  }
333
374
  else if (event.type === 'result') {
375
+ // A priority correction interrupts the old native loop before its own loop
376
+ // starts. The pinned SDK reports this intermediate result before echoing
377
+ // the queued correction. Drain it without turning it into a Lucidity terminal.
378
+ if (pending.size && event.subtype === 'error_during_execution' &&
379
+ event.errors.length === 1 &&
380
+ event.errors[0] === '[ede_diagnostic] result_type=user last_content_type=n/a stop_reason=null')
381
+ continue;
334
382
  if (event.subtype !== 'success' || event.is_error) {
335
- throw new Error((command &&
336
- (event.subtype === 'success'
337
- ? event.result
338
- : event.errors.join('\n'))) ||
339
- `Claude could not complete the turn (${event.subtype}). Check subscription access and usage limits.`);
383
+ throw new Error((event.subtype === 'success' ? event.result : event.errors.join('\n')) ||
384
+ `Claude turn ended with ${event.subtype}.`);
340
385
  }
341
386
  // A late priority message may become a subsequent loop in this same SDK
342
387
  // query. Keep consuming until its echoed user message and result arrive.
343
388
  if (pending.size)
344
389
  continue;
390
+ // Closing the query now would kill the work still running, and its report would
391
+ // never reach the phone. Claude continues in a later loop of this same query.
392
+ if (background > 0 && !input.outputSchema && !command) {
393
+ if (event.result.trim())
394
+ carried.push(event.result.trim());
395
+ carriedSession = event.session_id;
396
+ continue;
397
+ }
345
398
  if (input.outputSchema && event.structured_output === undefined)
346
399
  throw new Error('Claude did not return the requested structured result.');
347
400
  ended = true;
@@ -350,7 +403,7 @@ export class ClaudeAgentExecutor {
350
403
  yield {
351
404
  type: 'done',
352
405
  text: (input.outputSchema ? JSON.stringify(event.structured_output) : '') ||
353
- event.result.trim() ||
406
+ [...carried, event.result.trim()].filter(Boolean).join('\n\n') ||
354
407
  commandOutput.trim() ||
355
408
  (compacted
356
409
  ? 'Conversation compacted. You can continue here.'
@@ -366,6 +419,11 @@ export class ClaudeAgentExecutor {
366
419
  }
367
420
  }
368
421
  owner.check();
422
+ if (carried.length) {
423
+ ended = true;
424
+ yield { type: 'done', text: carried.join('\n\n'), sessionId: carriedSession };
425
+ return;
426
+ }
369
427
  throw new Error('Claude disconnected before completing the turn.');
370
428
  }
371
429
  catch (error) {
@@ -376,9 +434,15 @@ export class ClaudeAgentExecutor {
376
434
  }
377
435
  finally {
378
436
  ended = true;
437
+ clearTimeout(grace);
379
438
  incoming.end();
380
- active?.close();
381
- owner.close();
439
+ try {
440
+ active?.close();
441
+ await active?.return();
442
+ }
443
+ finally {
444
+ owner.close();
445
+ }
382
446
  }
383
447
  }
384
448
  }
@@ -1,6 +1,6 @@
1
1
  import { type AgentCommandOption } from '@lucidity/shared';
2
2
  import { type CodexConnection } from './codexRpc.js';
3
- import type { AgentExecutor, ExecutorRunInput, ExecutorStreamEvent, ExecutorModel, ExecutorResult } from './types.js';
3
+ import type { AgentExecutor, ExecutorRunInput, ExecutorStreamEvent, ExecutorModel, ExecutorResult, ProviderRunRef, ProviderInspection } from './types.js';
4
4
  import type { ThreadStartParams } from './codexProtocol/v2/ThreadStartParams.js';
5
5
  /** Override inherited tool integrations before starting any thread. */
6
6
  export declare function codexRunConfig(input: ExecutorRunInput, inherited: Record<string, unknown>): NonNullable<ThreadStartParams['config']>;
@@ -8,12 +8,18 @@ export declare class CodexExecutor implements AgentExecutor {
8
8
  private readonly options;
9
9
  readonly name = "codex-app-server";
10
10
  readonly strictResume = true;
11
+ readonly recoveryCapability = "native-turn";
11
12
  private readonly turns;
13
+ private readonly sessions;
12
14
  constructor(options?: {
13
15
  command?: string;
14
- connect?: (cwd?: string) => CodexConnection;
16
+ connect?: (cwd?: string, env?: Record<string, string>) => CodexConnection;
15
17
  });
16
18
  private connect;
19
+ inspect(ref: ProviderRunRef, options?: {
20
+ cwd?: string;
21
+ timeoutMs?: number;
22
+ }): Promise<ProviderInspection>;
17
23
  steer(requestId: string, text: string): Promise<void>;
18
24
  interrupt(requestId: string): Promise<boolean>;
19
25
  dispose(): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../src/executor/codex.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAGL,KAAK,eAAe,EAErB,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACnB,aAAa,EACb,cAAc,EACf,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AA6BjF,uEAAuE;AACvE,wBAAgB,cAAc,CAC5B,KAAK,EAAE,gBAAgB,EACvB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACjC,WAAW,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAmG1C;AAED,qBAAa,aAAc,YAAW,aAAa;IAK/C,OAAO,CAAC,QAAQ,CAAC,OAAO;IAJ1B,QAAQ,CAAC,IAAI,sBAAsB;IACnC,QAAQ,CAAC,YAAY,QAAQ;IAC7B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAmB;gBAEtB,OAAO,GAAE;QACxB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,MAAM,KAAK,eAAe,CAAC;KACxC;IAER,OAAO,CAAC,OAAO;IAKf,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAG/B,SAAS,CAAC,SAAS,EAAE,MAAM;IAG3B,OAAO;IAIP,MAAM,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;IAgClC,QAAQ,CACZ,KAAK,GAAE,IAAI,CAAC,gBAAgB,EAAE,KAAK,GAAG,gBAAgB,CAAM,GAC3D,OAAO,CAAC,kBAAkB,EAAE,CAAC;IA2C1B,GAAG,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,cAAc,CAAC;IAMpD,SAAS,CACd,KAAK,EAAE,gBAAgB,GACtB,aAAa,CAAC,mBAAmB,CAAC;CAoXtC"}
1
+ {"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../src/executor/codex.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAGL,KAAK,eAAe,EAErB,MAAM,eAAe,CAAC;AAOvB,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,cAAc,EACd,kBAAkB,EACnB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AA+BjF,uEAAuE;AACvE,wBAAgB,cAAc,CAC5B,KAAK,EAAE,gBAAgB,EACvB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACjC,WAAW,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAmG1C;AAED,qBAAa,aAAc,YAAW,aAAa;IAO/C,OAAO,CAAC,QAAQ,CAAC,OAAO;IAN1B,QAAQ,CAAC,IAAI,sBAAsB;IACnC,QAAQ,CAAC,YAAY,QAAQ;IAC7B,QAAQ,CAAC,kBAAkB,iBAAiB;IAC5C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAmB;IACzC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAuB;gBAE7B,OAAO,GAAE;QACxB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,eAAe,CAAC;KACtE;IAER,OAAO,CAAC,OAAO;IAKT,OAAO,CAAC,GAAG,EAAE,cAAc,EAAE,OAAO,GAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAiCnH,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAG/B,SAAS,CAAC,SAAS,EAAE,MAAM;IAG3B,OAAO;IAIP,MAAM,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;IAgClC,QAAQ,CACZ,KAAK,GAAE,IAAI,CAAC,gBAAgB,EAAE,KAAK,GAAG,gBAAgB,CAAM,GAC3D,OAAO,CAAC,kBAAkB,EAAE,CAAC;IA2C1B,GAAG,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,cAAc,CAAC;IAMpD,SAAS,CACd,KAAK,EAAE,gBAAgB,GACtB,aAAa,CAAC,mBAAmB,CAAC;CAqZtC"}