@opencorelabs/lucidity 0.3.0 → 0.6.0

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 (512) hide show
  1. package/README.md +9 -2
  2. package/dist/assets/speech/licenses/FluidAudio/LICENSE +201 -0
  3. package/dist/assets/speech/licenses/FluidAudio/ThirdPartyLicenses/fastcluster-LICENSE.md +11 -0
  4. package/dist/assets/speech/licenses/FluidAudio/ThirdPartyLicenses/vbx-LICENSE.md +201 -0
  5. package/dist/assets/speech/lucidity-speech +0 -0
  6. package/dist/automations/agent.d.ts +16 -0
  7. package/dist/automations/agent.d.ts.map +1 -0
  8. package/dist/automations/agent.js +196 -0
  9. package/dist/automations/cli.d.ts +4 -0
  10. package/dist/automations/cli.d.ts.map +1 -0
  11. package/dist/automations/cli.js +44 -0
  12. package/dist/automations/connections.d.ts +11 -0
  13. package/dist/automations/connections.d.ts.map +1 -0
  14. package/dist/automations/connections.js +74 -0
  15. package/dist/automations/designer.d.ts +39 -0
  16. package/dist/automations/designer.d.ts.map +1 -0
  17. package/dist/automations/designer.js +450 -0
  18. package/dist/automations/history.d.ts +4 -0
  19. package/dist/automations/history.d.ts.map +1 -0
  20. package/dist/automations/history.js +57 -0
  21. package/dist/automations/learning.d.ts +19 -0
  22. package/dist/automations/learning.d.ts.map +1 -0
  23. package/dist/automations/learning.js +121 -0
  24. package/dist/automations/pinterest.d.ts +21 -0
  25. package/dist/automations/pinterest.d.ts.map +1 -0
  26. package/dist/automations/pinterest.js +113 -0
  27. package/dist/automations/service.d.ts +42 -0
  28. package/dist/automations/service.d.ts.map +1 -0
  29. package/dist/automations/service.js +406 -0
  30. package/dist/automations/setup.d.ts +3 -0
  31. package/dist/automations/setup.d.ts.map +1 -0
  32. package/dist/automations/setup.js +48 -0
  33. package/dist/automations/skill.d.ts +3 -0
  34. package/dist/automations/skill.d.ts.map +1 -0
  35. package/dist/automations/skill.js +29 -0
  36. package/dist/automations/store.d.ts +13 -0
  37. package/dist/automations/store.d.ts.map +1 -0
  38. package/dist/automations/store.js +46 -0
  39. package/dist/chat/server.d.ts +2 -0
  40. package/dist/chat/server.d.ts.map +1 -1
  41. package/dist/chat/server.js +46 -2
  42. package/dist/coding/commandContext.d.ts +6 -0
  43. package/dist/coding/commandContext.d.ts.map +1 -0
  44. package/dist/coding/commandContext.js +20 -0
  45. package/dist/coding/runCodeTurn.d.ts +12 -2
  46. package/dist/coding/runCodeTurn.d.ts.map +1 -1
  47. package/dist/coding/runCodeTurn.js +49 -19
  48. package/dist/coding/worktree.d.ts +3 -4
  49. package/dist/coding/worktree.d.ts.map +1 -1
  50. package/dist/coding/worktree.js +3 -4
  51. package/dist/config.d.ts +4 -0
  52. package/dist/config.d.ts.map +1 -1
  53. package/dist/config.js +20 -3
  54. package/dist/decisions/cli.d.ts +2 -0
  55. package/dist/decisions/cli.d.ts.map +1 -0
  56. package/dist/decisions/cli.js +106 -0
  57. package/dist/decisions/client.d.ts +20 -0
  58. package/dist/decisions/client.d.ts.map +1 -0
  59. package/dist/decisions/client.js +41 -0
  60. package/dist/handoff.d.ts +11 -0
  61. package/dist/handoff.d.ts.map +1 -0
  62. package/dist/handoff.js +21 -0
  63. package/dist/index.js +179 -40
  64. package/dist/jobs/briefing.js +1 -1
  65. package/dist/jobs/extraction.d.ts.map +1 -1
  66. package/dist/jobs/extraction.js +112 -22
  67. package/dist/jobs/fastModeReview.d.ts +39 -0
  68. package/dist/jobs/fastModeReview.d.ts.map +1 -0
  69. package/dist/jobs/fastModeReview.js +192 -0
  70. package/dist/jobs/voiceReview.d.ts +24 -0
  71. package/dist/jobs/voiceReview.d.ts.map +1 -0
  72. package/dist/jobs/voiceReview.js +128 -0
  73. package/dist/mcp/clients.d.ts +5 -0
  74. package/dist/mcp/clients.d.ts.map +1 -1
  75. package/dist/mcp/clients.js +1 -1
  76. package/dist/mcp/config.d.ts +3 -1
  77. package/dist/mcp/config.d.ts.map +1 -1
  78. package/dist/mcp/config.js +48 -6
  79. package/dist/mcp/paired.js +1 -0
  80. package/dist/notesContext.d.ts.map +1 -1
  81. package/dist/notesContext.js +3 -2
  82. package/dist/room/client.d.ts +20 -7
  83. package/dist/room/client.d.ts.map +1 -1
  84. package/dist/room/client.js +262 -45
  85. package/dist/room/computer.d.ts.map +1 -1
  86. package/dist/room/computer.js +8 -0
  87. package/dist/room/context.d.ts +3 -2
  88. package/dist/room/context.d.ts.map +1 -1
  89. package/dist/room/context.js +10 -3
  90. package/dist/room/turnQueue.d.ts +40 -0
  91. package/dist/room/turnQueue.d.ts.map +1 -0
  92. package/dist/room/turnQueue.js +301 -0
  93. package/dist/skills/lucidity-automations/SKILL.md +54 -0
  94. package/dist/speech/captures.d.ts +30 -0
  95. package/dist/speech/captures.d.ts.map +1 -0
  96. package/dist/speech/captures.js +209 -0
  97. package/dist/speech/fluidAudio.d.ts +28 -0
  98. package/dist/speech/fluidAudio.d.ts.map +1 -0
  99. package/dist/speech/fluidAudio.js +182 -0
  100. package/dist/speech/service.d.ts +14 -0
  101. package/dist/speech/service.d.ts.map +1 -0
  102. package/dist/speech/service.js +88 -0
  103. package/dist/speech/types.d.ts +19 -0
  104. package/dist/speech/types.d.ts.map +1 -0
  105. package/dist/speech/types.js +1 -0
  106. package/dist/turnLog.d.ts +1 -0
  107. package/dist/turnLog.d.ts.map +1 -1
  108. package/dist/turnLog.js +3 -0
  109. package/native/speech/Package.resolved +15 -0
  110. package/native/speech/Package.swift +16 -0
  111. package/native/speech/Sources/lucidity-speech/Speech.swift +81 -0
  112. package/package.json +6 -2
  113. package/src/automations/agent.ts +239 -0
  114. package/src/automations/cli.ts +52 -0
  115. package/src/automations/connections.ts +83 -0
  116. package/src/automations/designer.ts +594 -0
  117. package/src/automations/history.ts +59 -0
  118. package/src/automations/learning.ts +180 -0
  119. package/src/automations/pinterest.ts +146 -0
  120. package/src/automations/service.ts +505 -0
  121. package/src/automations/setup.ts +71 -0
  122. package/src/automations/skill.ts +40 -0
  123. package/src/automations/store.ts +63 -0
  124. package/src/chat/server.ts +62 -3
  125. package/src/coding/commandContext.ts +29 -0
  126. package/src/coding/runCodeTurn.ts +65 -21
  127. package/src/coding/worktree.ts +3 -4
  128. package/src/config.ts +29 -2
  129. package/src/decisions/cli.ts +136 -0
  130. package/src/decisions/client.ts +62 -0
  131. package/src/handoff.ts +28 -0
  132. package/src/index.ts +196 -67
  133. package/src/jobs/briefing.ts +1 -1
  134. package/src/jobs/extraction.ts +157 -32
  135. package/src/jobs/fastModeReview.ts +221 -0
  136. package/src/jobs/voiceReview.ts +156 -0
  137. package/src/mcp/clients.ts +1 -1
  138. package/src/mcp/config.ts +56 -6
  139. package/src/mcp/paired.ts +1 -0
  140. package/src/notesContext.ts +3 -2
  141. package/src/room/client.ts +316 -52
  142. package/src/room/computer.ts +8 -0
  143. package/src/room/context.ts +12 -3
  144. package/src/room/turnQueue.ts +358 -0
  145. package/src/speech/captures.ts +265 -0
  146. package/src/speech/fluidAudio.ts +242 -0
  147. package/src/speech/service.ts +108 -0
  148. package/src/speech/types.ts +13 -0
  149. package/src/turnLog.ts +4 -0
  150. package/vendor/decisions/LICENSE +662 -0
  151. package/vendor/decisions/dist/capture.d.ts +79 -0
  152. package/vendor/decisions/dist/capture.js +183 -0
  153. package/vendor/decisions/dist/command.d.ts +202 -0
  154. package/vendor/decisions/dist/command.js +750 -0
  155. package/vendor/decisions/dist/gate.d.ts +12 -0
  156. package/vendor/decisions/dist/gate.js +18 -0
  157. package/vendor/decisions/dist/index.d.ts +5 -0
  158. package/vendor/decisions/dist/index.js +5 -0
  159. package/vendor/decisions/dist/jev.d.ts +15 -0
  160. package/vendor/decisions/dist/jev.js +242 -0
  161. package/vendor/decisions/dist/types.d.ts +67 -0
  162. package/vendor/decisions/dist/types.js +1 -0
  163. package/vendor/decisions/package.json +22 -0
  164. package/vendor/decisions/src/capture.ts +199 -0
  165. package/vendor/decisions/src/command.ts +836 -0
  166. package/vendor/decisions/src/gate.ts +32 -0
  167. package/vendor/decisions/src/index.ts +5 -0
  168. package/vendor/decisions/src/jev.ts +293 -0
  169. package/vendor/decisions/src/types.ts +79 -0
  170. package/vendor/mcp-server/README.md +6 -1
  171. package/vendor/mcp-server/dist/client.d.ts +1 -0
  172. package/vendor/mcp-server/dist/client.d.ts.map +1 -1
  173. package/vendor/mcp-server/dist/client.js +8 -0
  174. package/vendor/mcp-server/dist/commentProvider.d.ts +3 -0
  175. package/vendor/mcp-server/dist/commentProvider.d.ts.map +1 -0
  176. package/vendor/mcp-server/dist/commentProvider.js +10 -0
  177. package/vendor/mcp-server/dist/index.js +21 -6
  178. package/vendor/mcp-server/dist/tools/automations.d.ts +6 -0
  179. package/vendor/mcp-server/dist/tools/automations.d.ts.map +1 -0
  180. package/vendor/mcp-server/dist/tools/automations.js +163 -0
  181. package/vendor/mcp-server/dist/tools/commandEventFormat.d.ts +52 -0
  182. package/vendor/mcp-server/dist/tools/commandEventFormat.d.ts.map +1 -0
  183. package/vendor/mcp-server/dist/tools/commandEventFormat.js +83 -0
  184. package/vendor/mcp-server/dist/tools/commandEvents.d.ts +3 -0
  185. package/vendor/mcp-server/dist/tools/commandEvents.d.ts.map +1 -0
  186. package/vendor/mcp-server/dist/tools/commandEvents.js +21 -0
  187. package/vendor/mcp-server/dist/tools/comments.d.ts.map +1 -1
  188. package/vendor/mcp-server/dist/tools/comments.js +25 -4
  189. package/vendor/mcp-server/dist/tools/index.d.ts +2 -0
  190. package/vendor/mcp-server/dist/tools/index.d.ts.map +1 -1
  191. package/vendor/mcp-server/dist/tools/index.js +2 -0
  192. package/vendor/mcp-server/dist/tools/journal.d.ts +3 -0
  193. package/vendor/mcp-server/dist/tools/journal.d.ts.map +1 -0
  194. package/vendor/mcp-server/dist/tools/journal.js +131 -0
  195. package/vendor/mcp-server/dist/tools/taskActivity.d.ts +3 -0
  196. package/vendor/mcp-server/dist/tools/taskActivity.d.ts.map +1 -0
  197. package/vendor/mcp-server/dist/tools/taskActivity.js +32 -0
  198. package/vendor/mcp-server/dist/tools/taskOccurrences.d.ts +3 -0
  199. package/vendor/mcp-server/dist/tools/taskOccurrences.d.ts.map +1 -0
  200. package/vendor/mcp-server/dist/tools/taskOccurrences.js +12 -0
  201. package/vendor/mcp-server/dist/tools/taskTrash.d.ts +3 -0
  202. package/vendor/mcp-server/dist/tools/taskTrash.d.ts.map +1 -0
  203. package/vendor/mcp-server/dist/tools/taskTrash.js +21 -0
  204. package/vendor/mcp-server/dist/tools/tasks.d.ts.map +1 -1
  205. package/vendor/mcp-server/dist/tools/tasks.js +67 -27
  206. package/vendor/mcp-server/package.json +5 -1
  207. package/vendor/mcp-server/src/client.ts +10 -0
  208. package/vendor/mcp-server/src/commentProvider.ts +9 -0
  209. package/vendor/mcp-server/src/index.ts +20 -6
  210. package/vendor/mcp-server/src/tools/automations.ts +199 -0
  211. package/vendor/mcp-server/src/tools/commandEventFormat.ts +108 -0
  212. package/vendor/mcp-server/src/tools/commandEvents.ts +27 -0
  213. package/vendor/mcp-server/src/tools/comments.ts +24 -3
  214. package/vendor/mcp-server/src/tools/index.ts +2 -0
  215. package/vendor/mcp-server/src/tools/journal.ts +168 -0
  216. package/vendor/mcp-server/src/tools/taskActivity.ts +55 -0
  217. package/vendor/mcp-server/src/tools/taskOccurrences.ts +26 -0
  218. package/vendor/mcp-server/src/tools/taskTrash.ts +23 -0
  219. package/vendor/mcp-server/src/tools/tasks.ts +66 -30
  220. package/vendor/notes/dist/index.d.ts +2 -0
  221. package/vendor/notes/dist/index.d.ts.map +1 -1
  222. package/vendor/notes/dist/index.js +2 -0
  223. package/vendor/notes/dist/journal-backend.d.ts +4 -0
  224. package/vendor/notes/dist/journal-backend.d.ts.map +1 -0
  225. package/vendor/notes/dist/journal-backend.js +33 -0
  226. package/vendor/notes/dist/journal.d.ts +7 -0
  227. package/vendor/notes/dist/journal.d.ts.map +1 -0
  228. package/vendor/notes/dist/journal.js +173 -0
  229. package/vendor/notes/dist/vault.d.ts.map +1 -1
  230. package/vendor/notes/dist/vault.js +6 -1
  231. package/vendor/notes/src/index.ts +2 -0
  232. package/vendor/notes/src/journal-backend.ts +53 -0
  233. package/vendor/notes/src/journal.ts +194 -0
  234. package/vendor/notes/src/vault.ts +9 -1
  235. package/vendor/runtime/README.md +4 -0
  236. package/vendor/runtime/dist/executor/claudeAgent.d.ts +2 -0
  237. package/vendor/runtime/dist/executor/claudeAgent.d.ts.map +1 -1
  238. package/vendor/runtime/dist/executor/claudeAgent.js +113 -8
  239. package/vendor/runtime/dist/executor/claudeCode.d.ts.map +1 -1
  240. package/vendor/runtime/dist/executor/claudeCode.js +8 -4
  241. package/vendor/runtime/dist/executor/codex.d.ts +2 -0
  242. package/vendor/runtime/dist/executor/codex.d.ts.map +1 -1
  243. package/vendor/runtime/dist/executor/codex.js +213 -11
  244. package/vendor/runtime/dist/executor/codexProtocol/PlanType.d.ts +2 -0
  245. package/vendor/runtime/dist/executor/codexProtocol/PlanType.d.ts.map +1 -0
  246. package/vendor/runtime/dist/executor/codexProtocol/PlanType.js +2 -0
  247. package/vendor/runtime/dist/executor/codexProtocol/v2/CreditsSnapshot.d.ts +6 -0
  248. package/vendor/runtime/dist/executor/codexProtocol/v2/CreditsSnapshot.d.ts.map +1 -0
  249. package/vendor/runtime/dist/executor/codexProtocol/v2/CreditsSnapshot.js +2 -0
  250. package/vendor/runtime/dist/executor/codexProtocol/v2/GetAccountRateLimitsResponse.d.ts +26 -0
  251. package/vendor/runtime/dist/executor/codexProtocol/v2/GetAccountRateLimitsResponse.d.ts.map +1 -0
  252. package/vendor/runtime/dist/executor/codexProtocol/v2/GetAccountRateLimitsResponse.js +2 -0
  253. package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitReachedType.d.ts +2 -0
  254. package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitReachedType.d.ts.map +1 -0
  255. package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitReachedType.js +2 -0
  256. package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitResetCredit.d.ts +27 -0
  257. package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitResetCredit.d.ts.map +1 -0
  258. package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitResetCredit.js +2 -0
  259. package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitResetCreditStatus.d.ts +2 -0
  260. package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitResetCreditStatus.d.ts.map +1 -0
  261. package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitResetCreditStatus.js +2 -0
  262. package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitResetCreditsSummary.d.ts +13 -0
  263. package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitResetCreditsSummary.d.ts.map +1 -0
  264. package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitResetCreditsSummary.js +2 -0
  265. package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitResetType.d.ts +2 -0
  266. package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitResetType.d.ts.map +1 -0
  267. package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitResetType.js +2 -0
  268. package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitSnapshot.d.ts +20 -0
  269. package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitSnapshot.d.ts.map +1 -0
  270. package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitSnapshot.js +2 -0
  271. package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitWindow.d.ts +6 -0
  272. package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitWindow.d.ts.map +1 -0
  273. package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitWindow.js +2 -0
  274. package/vendor/runtime/dist/executor/codexProtocol/v2/ReviewDelivery.d.ts +2 -0
  275. package/vendor/runtime/dist/executor/codexProtocol/v2/ReviewDelivery.d.ts.map +1 -0
  276. package/vendor/runtime/dist/executor/codexProtocol/v2/ReviewDelivery.js +2 -0
  277. package/vendor/runtime/dist/executor/codexProtocol/v2/ReviewStartParams.d.ts +12 -0
  278. package/vendor/runtime/dist/executor/codexProtocol/v2/ReviewStartParams.d.ts.map +1 -0
  279. package/vendor/runtime/dist/executor/codexProtocol/v2/ReviewStartParams.js +2 -0
  280. package/vendor/runtime/dist/executor/codexProtocol/v2/ReviewTarget.d.ts +17 -0
  281. package/vendor/runtime/dist/executor/codexProtocol/v2/ReviewTarget.d.ts.map +1 -0
  282. package/vendor/runtime/dist/executor/codexProtocol/v2/ReviewTarget.js +2 -0
  283. package/vendor/runtime/dist/executor/codexProtocol/v2/SkillDependencies.d.ts +5 -0
  284. package/vendor/runtime/dist/executor/codexProtocol/v2/SkillDependencies.d.ts.map +1 -0
  285. package/vendor/runtime/dist/executor/codexProtocol/v2/SkillDependencies.js +2 -0
  286. package/vendor/runtime/dist/executor/codexProtocol/v2/SkillErrorInfo.d.ts +5 -0
  287. package/vendor/runtime/dist/executor/codexProtocol/v2/SkillErrorInfo.d.ts.map +1 -0
  288. package/vendor/runtime/dist/executor/codexProtocol/v2/SkillErrorInfo.js +2 -0
  289. package/vendor/runtime/dist/executor/codexProtocol/v2/SkillInterface.d.ts +18 -0
  290. package/vendor/runtime/dist/executor/codexProtocol/v2/SkillInterface.d.ts.map +1 -0
  291. package/vendor/runtime/dist/executor/codexProtocol/v2/SkillInterface.js +2 -0
  292. package/vendor/runtime/dist/executor/codexProtocol/v2/SkillMetadata.d.ts +22 -0
  293. package/vendor/runtime/dist/executor/codexProtocol/v2/SkillMetadata.d.ts.map +1 -0
  294. package/vendor/runtime/dist/executor/codexProtocol/v2/SkillMetadata.js +2 -0
  295. package/vendor/runtime/dist/executor/codexProtocol/v2/SkillScope.d.ts +2 -0
  296. package/vendor/runtime/dist/executor/codexProtocol/v2/SkillScope.d.ts.map +1 -0
  297. package/vendor/runtime/dist/executor/codexProtocol/v2/SkillScope.js +2 -0
  298. package/vendor/runtime/dist/executor/codexProtocol/v2/SkillToolDependency.d.ts +9 -0
  299. package/vendor/runtime/dist/executor/codexProtocol/v2/SkillToolDependency.d.ts.map +1 -0
  300. package/vendor/runtime/dist/executor/codexProtocol/v2/SkillToolDependency.js +2 -0
  301. package/vendor/runtime/dist/executor/codexProtocol/v2/SkillsListEntry.d.ts +8 -0
  302. package/vendor/runtime/dist/executor/codexProtocol/v2/SkillsListEntry.d.ts.map +1 -0
  303. package/vendor/runtime/dist/executor/codexProtocol/v2/SkillsListEntry.js +2 -0
  304. package/vendor/runtime/dist/executor/codexProtocol/v2/SkillsListResponse.d.ts +5 -0
  305. package/vendor/runtime/dist/executor/codexProtocol/v2/SkillsListResponse.d.ts.map +1 -0
  306. package/vendor/runtime/dist/executor/codexProtocol/v2/SkillsListResponse.js +2 -0
  307. package/vendor/runtime/dist/executor/codexProtocol/v2/SpendControlLimitSnapshot.d.ts +7 -0
  308. package/vendor/runtime/dist/executor/codexProtocol/v2/SpendControlLimitSnapshot.d.ts.map +1 -0
  309. package/vendor/runtime/dist/executor/codexProtocol/v2/SpendControlLimitSnapshot.js +2 -0
  310. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadSetNameParams.d.ts +5 -0
  311. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadSetNameParams.d.ts.map +1 -0
  312. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadSetNameParams.js +2 -0
  313. package/vendor/runtime/dist/executor/health.d.ts +1 -0
  314. package/vendor/runtime/dist/executor/health.d.ts.map +1 -1
  315. package/vendor/runtime/dist/executor/health.js +3 -0
  316. package/vendor/runtime/dist/executor/liveTurns.d.ts.map +1 -1
  317. package/vendor/runtime/dist/executor/liveTurns.js +3 -0
  318. package/vendor/runtime/dist/executor/providerRouter.d.ts.map +1 -1
  319. package/vendor/runtime/dist/executor/providerRouter.js +2 -1
  320. package/vendor/runtime/dist/executor/types.d.ts +8 -0
  321. package/vendor/runtime/dist/executor/types.d.ts.map +1 -1
  322. package/vendor/runtime/dist/harness/index.d.ts +1 -0
  323. package/vendor/runtime/dist/harness/index.d.ts.map +1 -1
  324. package/vendor/runtime/dist/harness/index.js +35 -1
  325. package/vendor/runtime/dist/harness/types.d.ts +4 -1
  326. package/vendor/runtime/dist/harness/types.d.ts.map +1 -1
  327. package/vendor/runtime/dist/index.d.ts +2 -1
  328. package/vendor/runtime/dist/index.d.ts.map +1 -1
  329. package/vendor/runtime/dist/index.js +2 -0
  330. package/vendor/runtime/dist/journal/context.d.ts +18 -0
  331. package/vendor/runtime/dist/journal/context.d.ts.map +1 -1
  332. package/vendor/runtime/dist/journal/context.js +19 -5
  333. package/vendor/runtime/dist/prompts/briefing.d.ts +4 -7
  334. package/vendor/runtime/dist/prompts/briefing.d.ts.map +1 -1
  335. package/vendor/runtime/dist/prompts/briefing.js +61 -12
  336. package/vendor/runtime/dist/prompts/cardStatement.d.ts +7 -0
  337. package/vendor/runtime/dist/prompts/cardStatement.d.ts.map +1 -0
  338. package/vendor/runtime/dist/prompts/cardStatement.js +52 -0
  339. package/vendor/runtime/dist/prompts/chat.d.ts +1 -0
  340. package/vendor/runtime/dist/prompts/chat.d.ts.map +1 -1
  341. package/vendor/runtime/dist/prompts/chat.js +15 -1
  342. package/vendor/runtime/dist/prompts/projectCapture.d.ts +7 -0
  343. package/vendor/runtime/dist/prompts/projectCapture.d.ts.map +1 -0
  344. package/vendor/runtime/dist/prompts/projectCapture.js +31 -0
  345. package/vendor/runtime/src/executor/claudeAgent.ts +133 -7
  346. package/vendor/runtime/src/executor/claudeCode.ts +6 -4
  347. package/vendor/runtime/src/executor/codex.ts +280 -20
  348. package/vendor/runtime/src/executor/codexProtocol/PlanType.ts +5 -0
  349. package/vendor/runtime/src/executor/codexProtocol/v2/CreditsSnapshot.ts +5 -0
  350. package/vendor/runtime/src/executor/codexProtocol/v2/GetAccountRateLimitsResponse.ts +25 -0
  351. package/vendor/runtime/src/executor/codexProtocol/v2/RateLimitReachedType.ts +5 -0
  352. package/vendor/runtime/src/executor/codexProtocol/v2/RateLimitResetCredit.ts +27 -0
  353. package/vendor/runtime/src/executor/codexProtocol/v2/RateLimitResetCreditStatus.ts +5 -0
  354. package/vendor/runtime/src/executor/codexProtocol/v2/RateLimitResetCreditsSummary.ts +14 -0
  355. package/vendor/runtime/src/executor/codexProtocol/v2/RateLimitResetType.ts +5 -0
  356. package/vendor/runtime/src/executor/codexProtocol/v2/RateLimitSnapshot.ts +14 -0
  357. package/vendor/runtime/src/executor/codexProtocol/v2/RateLimitWindow.ts +5 -0
  358. package/vendor/runtime/src/executor/codexProtocol/v2/ReviewDelivery.ts +5 -0
  359. package/vendor/runtime/src/executor/codexProtocol/v2/ReviewStartParams.ts +12 -0
  360. package/vendor/runtime/src/executor/codexProtocol/v2/ReviewTarget.ts +9 -0
  361. package/vendor/runtime/src/executor/codexProtocol/v2/SkillDependencies.ts +6 -0
  362. package/vendor/runtime/src/executor/codexProtocol/v2/SkillErrorInfo.ts +5 -0
  363. package/vendor/runtime/src/executor/codexProtocol/v2/SkillInterface.ts +14 -0
  364. package/vendor/runtime/src/executor/codexProtocol/v2/SkillMetadata.ts +17 -0
  365. package/vendor/runtime/src/executor/codexProtocol/v2/SkillScope.ts +5 -0
  366. package/vendor/runtime/src/executor/codexProtocol/v2/SkillToolDependency.ts +5 -0
  367. package/vendor/runtime/src/executor/codexProtocol/v2/SkillsListEntry.ts +7 -0
  368. package/vendor/runtime/src/executor/codexProtocol/v2/SkillsListResponse.ts +6 -0
  369. package/vendor/runtime/src/executor/codexProtocol/v2/SpendControlLimitSnapshot.ts +5 -0
  370. package/vendor/runtime/src/executor/codexProtocol/v2/ThreadSetNameParams.ts +5 -0
  371. package/vendor/runtime/src/executor/health.ts +3 -0
  372. package/vendor/runtime/src/executor/liveTurns.ts +3 -0
  373. package/vendor/runtime/src/executor/providerRouter.ts +2 -1
  374. package/vendor/runtime/src/executor/types.ts +8 -0
  375. package/vendor/runtime/src/harness/index.ts +40 -6
  376. package/vendor/runtime/src/harness/types.ts +4 -1
  377. package/vendor/runtime/src/index.ts +4 -1
  378. package/vendor/runtime/src/journal/context.ts +40 -7
  379. package/vendor/runtime/src/prompts/briefing.ts +62 -17
  380. package/vendor/runtime/src/prompts/cardStatement.ts +64 -0
  381. package/vendor/runtime/src/prompts/chat.ts +25 -3
  382. package/vendor/runtime/src/prompts/projectCapture.ts +51 -0
  383. package/vendor/shared/dist/agentCommands.d.ts +22 -0
  384. package/vendor/shared/dist/agentCommands.d.ts.map +1 -0
  385. package/vendor/shared/dist/agentCommands.js +11 -0
  386. package/vendor/shared/dist/automationTemplates.d.ts +37 -0
  387. package/vendor/shared/dist/automationTemplates.d.ts.map +1 -0
  388. package/vendor/shared/dist/automationTemplates.js +48 -0
  389. package/vendor/shared/dist/automations.d.ts +1052 -0
  390. package/vendor/shared/dist/automations.d.ts.map +1 -0
  391. package/vendor/shared/dist/automations.js +300 -0
  392. package/vendor/shared/dist/cardStatement.d.ts +28 -0
  393. package/vendor/shared/dist/cardStatement.d.ts.map +1 -0
  394. package/vendor/shared/dist/cardStatement.js +37 -0
  395. package/vendor/shared/dist/cardStudio.d.ts +756 -0
  396. package/vendor/shared/dist/cardStudio.d.ts.map +1 -0
  397. package/vendor/shared/dist/cardStudio.js +297 -0
  398. package/vendor/shared/dist/commandLocal.d.ts +218 -0
  399. package/vendor/shared/dist/commandLocal.d.ts.map +1 -0
  400. package/vendor/shared/dist/commandLocal.js +662 -0
  401. package/vendor/shared/dist/commandText.d.ts +12 -0
  402. package/vendor/shared/dist/commandText.d.ts.map +1 -0
  403. package/vendor/shared/dist/commandText.js +21 -0
  404. package/vendor/shared/dist/commands.d.ts +1516 -0
  405. package/vendor/shared/dist/commands.d.ts.map +1 -0
  406. package/vendor/shared/dist/commands.js +231 -0
  407. package/vendor/shared/dist/computer.d.ts +9 -9
  408. package/vendor/shared/dist/computer.d.ts.map +1 -1
  409. package/vendor/shared/dist/computer.js +11 -2
  410. package/vendor/shared/dist/constants.d.ts +3 -3
  411. package/vendor/shared/dist/constants.d.ts.map +1 -1
  412. package/vendor/shared/dist/constants.js +9 -2
  413. package/vendor/shared/dist/githubContributions.d.ts +93 -0
  414. package/vendor/shared/dist/githubContributions.d.ts.map +1 -0
  415. package/vendor/shared/dist/githubContributions.js +54 -0
  416. package/vendor/shared/dist/habitContributions.d.ts +26 -0
  417. package/vendor/shared/dist/habitContributions.d.ts.map +1 -0
  418. package/vendor/shared/dist/habitContributions.js +119 -0
  419. package/vendor/shared/dist/index.d.ts +26 -2
  420. package/vendor/shared/dist/index.d.ts.map +1 -1
  421. package/vendor/shared/dist/index.js +23 -2
  422. package/vendor/shared/dist/journal-migration.d.ts +29 -0
  423. package/vendor/shared/dist/journal-migration.d.ts.map +1 -0
  424. package/vendor/shared/dist/journal-migration.js +73 -0
  425. package/vendor/shared/dist/journal-vault.d.ts +414 -0
  426. package/vendor/shared/dist/journal-vault.d.ts.map +1 -0
  427. package/vendor/shared/dist/journal-vault.js +972 -0
  428. package/vendor/shared/dist/projectCapture.d.ts +73 -0
  429. package/vendor/shared/dist/projectCapture.d.ts.map +1 -0
  430. package/vendor/shared/dist/projectCapture.js +66 -0
  431. package/vendor/shared/dist/quickAdd.d.ts +90 -0
  432. package/vendor/shared/dist/quickAdd.d.ts.map +1 -0
  433. package/vendor/shared/dist/quickAdd.js +260 -0
  434. package/vendor/shared/dist/recurrence.d.ts +44 -0
  435. package/vendor/shared/dist/recurrence.d.ts.map +1 -0
  436. package/vendor/shared/dist/recurrence.js +37 -0
  437. package/vendor/shared/dist/reminderWords.d.ts +11 -0
  438. package/vendor/shared/dist/reminderWords.d.ts.map +1 -0
  439. package/vendor/shared/dist/reminderWords.js +63 -0
  440. package/vendor/shared/dist/schemas/comment.d.ts +13 -1
  441. package/vendor/shared/dist/schemas/comment.d.ts.map +1 -1
  442. package/vendor/shared/dist/schemas/comment.js +5 -0
  443. package/vendor/shared/dist/schemas/conversation.d.ts +3 -3
  444. package/vendor/shared/dist/schemas/harness.d.ts +922 -59
  445. package/vendor/shared/dist/schemas/harness.d.ts.map +1 -1
  446. package/vendor/shared/dist/schemas/harness.js +122 -3
  447. package/vendor/shared/dist/schemas/journal.d.ts +10 -0
  448. package/vendor/shared/dist/schemas/journal.d.ts.map +1 -1
  449. package/vendor/shared/dist/schemas/journal.js +10 -2
  450. package/vendor/shared/dist/schemas/notification.d.ts +1 -1
  451. package/vendor/shared/dist/schemas/organization.d.ts +3 -2
  452. package/vendor/shared/dist/schemas/organization.d.ts.map +1 -1
  453. package/vendor/shared/dist/schemas/organization.js +3 -2
  454. package/vendor/shared/dist/schemas/proposal.d.ts +7 -3
  455. package/vendor/shared/dist/schemas/proposal.d.ts.map +1 -1
  456. package/vendor/shared/dist/schemas/proposal.js +2 -1
  457. package/vendor/shared/dist/schemas/request.d.ts +44 -4
  458. package/vendor/shared/dist/schemas/request.d.ts.map +1 -1
  459. package/vendor/shared/dist/schemas/task.d.ts +83 -8
  460. package/vendor/shared/dist/schemas/task.d.ts.map +1 -1
  461. package/vendor/shared/dist/schemas/task.js +20 -2
  462. package/vendor/shared/dist/schemas/timeSession.d.ts +2 -2
  463. package/vendor/shared/dist/smartCapture.d.ts +60 -0
  464. package/vendor/shared/dist/smartCapture.d.ts.map +1 -0
  465. package/vendor/shared/dist/smartCapture.js +56 -0
  466. package/vendor/shared/dist/speech.d.ts +39 -0
  467. package/vendor/shared/dist/speech.d.ts.map +1 -0
  468. package/vendor/shared/dist/speech.js +36 -0
  469. package/vendor/shared/dist/spokenNames.d.ts +25 -0
  470. package/vendor/shared/dist/spokenNames.d.ts.map +1 -0
  471. package/vendor/shared/dist/spokenNames.js +120 -0
  472. package/vendor/shared/dist/taskActivity.d.ts +76 -0
  473. package/vendor/shared/dist/taskActivity.d.ts.map +1 -0
  474. package/vendor/shared/dist/taskActivity.js +27 -0
  475. package/vendor/shared/dist/vault-search.d.ts +50 -0
  476. package/vendor/shared/dist/vault-search.d.ts.map +1 -0
  477. package/vendor/shared/dist/vault-search.js +177 -0
  478. package/vendor/shared/dist/voiceCapture.d.ts +32 -0
  479. package/vendor/shared/dist/voiceCapture.d.ts.map +1 -0
  480. package/vendor/shared/dist/voiceCapture.js +29 -0
  481. package/vendor/shared/package.json +4 -0
  482. package/vendor/shared/src/agentCommands.ts +35 -0
  483. package/vendor/shared/src/automationTemplates.ts +54 -0
  484. package/vendor/shared/src/automations.ts +329 -0
  485. package/vendor/shared/src/cardStatement.ts +49 -0
  486. package/vendor/shared/src/cardStudio.ts +340 -0
  487. package/vendor/shared/src/commandLocal.ts +738 -0
  488. package/vendor/shared/src/commandText.ts +25 -0
  489. package/vendor/shared/src/commands.ts +253 -0
  490. package/vendor/shared/src/computer.ts +23 -6
  491. package/vendor/shared/src/constants.ts +9 -2
  492. package/vendor/shared/src/githubContributions.ts +70 -0
  493. package/vendor/shared/src/habitContributions.ts +144 -0
  494. package/vendor/shared/src/index.ts +42 -1
  495. package/vendor/shared/src/journal-migration.ts +130 -0
  496. package/vendor/shared/src/journal-vault.ts +1240 -0
  497. package/vendor/shared/src/projectCapture.ts +86 -0
  498. package/vendor/shared/src/quickAdd.ts +310 -0
  499. package/vendor/shared/src/recurrence.ts +37 -0
  500. package/vendor/shared/src/reminderWords.ts +54 -0
  501. package/vendor/shared/src/schemas/comment.ts +5 -0
  502. package/vendor/shared/src/schemas/harness.ts +144 -7
  503. package/vendor/shared/src/schemas/journal.ts +15 -6
  504. package/vendor/shared/src/schemas/organization.ts +3 -2
  505. package/vendor/shared/src/schemas/proposal.ts +6 -1
  506. package/vendor/shared/src/schemas/task.ts +20 -2
  507. package/vendor/shared/src/smartCapture.ts +67 -0
  508. package/vendor/shared/src/speech.ts +44 -0
  509. package/vendor/shared/src/spokenNames.ts +128 -0
  510. package/vendor/shared/src/taskActivity.ts +34 -0
  511. package/vendor/shared/src/vault-search.ts +243 -0
  512. package/vendor/shared/src/voiceCapture.ts +34 -0
@@ -1,9 +1,12 @@
1
1
  import { computerId, computerRuntime } from './computer.js';
2
+ import { DurableTurnQueue } from './turnQueue.js';
2
3
  import type { AgentControls } from '../agentControls.js';
3
4
  import type { AgentProvider, ExecutorModel } from '@lucidity/runtime';
4
5
  import { WebSocket } from 'ws';
5
6
  import {
6
7
  HarnessRequestSchema,
8
+ type AgentCommandOption,
9
+ type AgentCommandContext,
7
10
  computerAvailability,
8
11
  type ComputerRuntime,
9
12
  type ProviderHealth,
@@ -19,6 +22,7 @@ import type {
19
22
  } from '@lucidity/shared';
20
23
  import type { ExecutorStreamEvent, LucidHarness } from '@lucidity/runtime';
21
24
  import type { DaemonConfig } from '../config.js';
25
+ import type { AutomationService } from '../automations/service.js';
22
26
  import type { Vault } from '../vault.js';
23
27
  import {
24
28
  loadAskContext,
@@ -38,11 +42,18 @@ import {
38
42
  } from '../streamDeadline.js';
39
43
  import { TurnLogStore } from '../turnLog.js';
40
44
  import type { AttentionPublisher } from '../attention.js';
41
- import type { AttentionBoardEntry } from '@lucidity/shared';
45
+ import type { AttentionBoardEntry, ProviderHandoff } from '@lucidity/shared';
42
46
  import { LaneQueue } from '../queue.js';
43
47
  import { RoomTelemetry } from './telemetry.js';
44
48
  import { buildIncidentBundle, writeIncidentBundle } from './incidents.js';
45
49
  import { writeVoiceDiagBundle } from './voiceDiag.js';
50
+ import type { SpeechService } from '../speech/service.js';
51
+ import { VoiceCaptureService } from '../speech/captures.js';
52
+ import { CONFIG_DIR } from '../config.js';
53
+ import { handoffPrompt } from '../handoff.js';
54
+ import { createHash } from 'node:crypto';
55
+ import { join } from 'node:path';
56
+ import { uuidv7 } from 'uuidv7';
46
57
 
47
58
  /** Frame `type`s that carry recoverable turn output — the ones written to the durable
48
59
  * turn log and stamped with a `seq`. Buffered responses (`kind` replies) and any other
@@ -91,6 +102,8 @@ export type CodeHandler = (
91
102
  prompt: string;
92
103
  images?: HarnessImage[];
93
104
  resume?: string;
105
+ provider?: AgentProvider;
106
+ handoff?: ProviderHandoff;
94
107
  workerId?: string;
95
108
  mode?: WorkspaceMode;
96
109
  expectedBranch?: string;
@@ -130,12 +143,16 @@ export interface RepoInfo {
130
143
  }
131
144
 
132
145
  export interface DispatchDeps {
146
+ speech?: Pick<SpeechService, 'transcribe'>;
147
+ captures?: Pick<VoiceCaptureService, 'submit' | 'status'>;
148
+ turnQueue?: DurableTurnQueue;
133
149
  recordAcceptance?: boolean;
134
150
  runtime?: () => ComputerRuntime;
135
151
  controls?: AgentControls;
136
152
  models?: (provider: AgentProvider) => Promise<ExecutorModel[]>;
153
+ commands?: (provider: AgentProvider, context?: AgentCommandContext) => Promise<AgentCommandOption[]>;
137
154
  harness: LucidHarness;
138
- askContext: () => Promise<AskContext>;
155
+ askContext: (query?: string) => Promise<AskContext>;
139
156
  briefingContext: () => Promise<BriefingContext>;
140
157
  /** Serialize + send one wire message to the counterpart (phone). For a stream frame
141
158
  * this appends it to the durable turn log and stamps a `seq` before sending; other
@@ -172,6 +189,7 @@ export interface DispatchDeps {
172
189
  logger?: (msg: string) => void;
173
190
  /** Read the daemon's redacted config (`getConfig`, Daemon Settings). Absent → editing disabled. */
174
191
  getConfig?: () => DaemonConfigView;
192
+ automations?: AutomationService;
175
193
  /** Persist + live-apply a config patch (`setConfig`). Returns the new redacted config plus
176
194
  * whether the change needs a restart and whether one was triggered. Absent → editing disabled. */
177
195
  setConfig?: (
@@ -182,11 +200,8 @@ export interface DispatchDeps {
182
200
  requestRestart?: () => void;
183
201
  /** First-output deadline (ms) for a resumed run before it's treated as a dead handle. Test seam. */
184
202
  resumeDeadlineMs?: number;
185
- /** Serialises model runs per lane, so two `claude` subprocesses never share a session. The
186
- * phone already queues turns itself (#317) and is the mechanism — it has to be, since only it
187
- * knows the resume handle the previous turn produced. This is the backstop for what the phone
188
- * can't see: a second device, or a double-send that slips past it. Absent → runs unserialised,
189
- * as before. */
203
+ /** Serialises execution in each workspace. Durable queued requests resolve their
204
+ * predecessor's session on the daemon before taking this lane. */
190
205
  queue?: LaneQueue;
191
206
  /** Structured connection telemetry (#314) — the daemon's side of the join. Records the
192
207
  * request timeline and supplies it as the incident bundle's connection context. */
@@ -234,7 +249,7 @@ export async function dispatchRequest(
234
249
  harness,
235
250
  askContext,
236
251
  briefingContext,
237
- send,
252
+ send: sendFrame,
238
253
  signal: outerSignal,
239
254
  inFlight,
240
255
  attention,
@@ -248,9 +263,88 @@ export async function dispatchRequest(
248
263
  return;
249
264
  }
250
265
  const parsed = HarnessRequestSchema.safeParse(json);
251
- if (!parsed.success) return;
266
+ if (!parsed.success) {
267
+ const invalid = json as { id?: unknown; kind?: unknown } | null;
268
+ if (
269
+ invalid?.kind === 'transcribe' &&
270
+ typeof invalid.id === 'string' &&
271
+ /^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(
272
+ invalid.id,
273
+ )
274
+ ) {
275
+ sendFrame({
276
+ type: 'error',
277
+ requestId: invalid.id,
278
+ message: 'Use a supported audio recording under 10 MB.',
279
+ });
280
+ }
281
+ return;
282
+ }
252
283
  const req = parsed.data;
284
+ const send = (frame: unknown) => sendFrame(req.kind === 'ask' && req.projectPlan
285
+ ? { ...(frame as Record<string, unknown>), purpose: 'project-plan' } : frame);
286
+ if (req.kind === 'voice-capture' || req.kind === 'voice-capture-status') {
287
+ try {
288
+ if (!deps.captures)
289
+ throw new Error(
290
+ 'Update Lucidity on your computer to receive Watch recordings.',
291
+ );
292
+ // Existing receipts remain readable even if the provider later signs out.
293
+ const previous = deps.captures.status(req.credentialId, req.captureId);
294
+ if (req.kind === 'voice-capture' && !previous && deps.runtime) {
295
+ for (const feature of ['transcribe', 'ask']) {
296
+ const availability = computerAvailability(
297
+ {
298
+ type: 'presence',
299
+ daemonConnected: true,
300
+ runtime: deps.runtime(),
301
+ },
302
+ 'online',
303
+ feature,
304
+ );
305
+ if (!availability.canSend)
306
+ throw new Error(`${availability.title}. ${availability.detail}`);
307
+ }
308
+ }
309
+ const receipt =
310
+ req.kind === 'voice-capture'
311
+ ? deps.captures.submit(req.credentialId, {
312
+ captureId: req.captureId,
313
+ audio: req.audio,
314
+ })
315
+ : previous;
316
+ send({ requestId: req.id, kind: 'voice-capture', receipt });
317
+ } catch (error) {
318
+ send({
319
+ type: 'error',
320
+ requestId: req.id,
321
+ message:
322
+ error instanceof Error
323
+ ? error.message
324
+ : 'Voice capture is unavailable.',
325
+ });
326
+ }
327
+ return;
328
+ }
253
329
  deps.telemetry?.record('request', req.kind, req.id);
330
+ if (req.kind === 'queue-control') {
331
+ try {
332
+ if (!deps.turnQueue)
333
+ throw new Error(
334
+ 'Update Lucidity on your computer to manage queued messages.',
335
+ );
336
+ await deps.turnQueue.control(req.targetId, req.action, req.activeId);
337
+ send({ kind: 'control', requestId: req.id, accepted: true });
338
+ } catch (error) {
339
+ send({
340
+ kind: 'control',
341
+ requestId: req.id,
342
+ accepted: false,
343
+ message: (error as Error).message,
344
+ });
345
+ }
346
+ return;
347
+ }
254
348
  if (
255
349
  deps.runtime &&
256
350
  !['pull', 'cancel', 'permission', 'steer'].includes(req.kind)
@@ -260,7 +354,9 @@ export async function dispatchRequest(
260
354
  provider =
261
355
  'resume' in req && req.resume
262
356
  ? decodeSession(req.resume).provider
263
- : undefined;
357
+ : 'provider' in req
358
+ ? req.provider
359
+ : undefined;
264
360
  } catch {
265
361
  send({
266
362
  type: 'error',
@@ -348,6 +444,26 @@ export async function dispatchRequest(
348
444
  send({ kind: 'control', requestId: req.id, ...result });
349
445
  return;
350
446
  }
447
+ if (req.kind === 'commands') {
448
+ try {
449
+ if (!deps.commands)
450
+ throw new Error('Update Lucidity on your computer to use commands.');
451
+ send({
452
+ kind: 'commands',
453
+ requestId: req.id,
454
+ provider: req.provider,
455
+ commands: await deps.commands(req.provider, req.context),
456
+ });
457
+ } catch (error) {
458
+ send({
459
+ type: 'error',
460
+ requestId: req.id,
461
+ message:
462
+ error instanceof Error ? error.message : 'Command discovery failed.',
463
+ });
464
+ }
465
+ return;
466
+ }
351
467
  if (req.kind === 'models') {
352
468
  try {
353
469
  send({
@@ -400,6 +516,7 @@ export async function dispatchRequest(
400
516
  for (const frame of state.frames) {
401
517
  if (frame.seq > req.sinceSeq) sendRaw(frame);
402
518
  }
519
+ if (!state.terminated) deps.turnQueue?.confirm(req.targetId);
403
520
  // A phone may already have every logged frame while the turn waits for its
404
521
  // decision. Reconfirm that live approval with a new sequence so reconnect
405
522
  // restores its controls instead of waiting forever for another model token.
@@ -409,7 +526,11 @@ export async function dispatchRequest(
409
526
  // restarted mid-turn). Settle it with a synthesized, persisted terminal so the phone
410
527
  // stops waiting and a repeat pull is idempotent. If it's still in `inFlight`, live
411
528
  // frames past maxSeq keep flowing on the current socket (deduped by seq) — leave it.
412
- if (!state.terminated && !inFlight?.has(req.targetId)) {
529
+ if (
530
+ !state.terminated &&
531
+ !inFlight?.has(req.targetId) &&
532
+ !deps.turnQueue?.owns(req.targetId)
533
+ ) {
413
534
  sendRaw(
414
535
  turnLogs.append(req.targetId, {
415
536
  type: 'error',
@@ -421,6 +542,21 @@ export async function dispatchRequest(
421
542
  return;
422
543
  }
423
544
 
545
+ if ((req.kind === 'ask' || req.kind === 'code') && req.queue) {
546
+ try {
547
+ if (!deps.turnQueue)
548
+ throw new Error('Update Lucidity on your computer to queue messages.');
549
+ deps.turnQueue.enqueue(req);
550
+ } catch (error) {
551
+ send({
552
+ type: 'error',
553
+ requestId: req.id,
554
+ message: (error as Error).message,
555
+ });
556
+ }
557
+ return;
558
+ }
559
+
424
560
  if (
425
561
  deps.recordAcceptance &&
426
562
  ['ask', 'code', 'conduct', 'briefing', 'attention', 'clone'].includes(
@@ -437,6 +573,12 @@ export async function dispatchRequest(
437
573
  const accepted = deps.turnLogs.append(req.id, {
438
574
  type: 'accepted',
439
575
  requestId: req.id,
576
+ scope: {
577
+ kind: req.kind,
578
+ ...('repoId' in req ? { repoId: req.repoId } : {}),
579
+ ...('workerId' in req ? { workerId: req.workerId } : {}),
580
+ ...('mode' in req ? { mode: req.mode } : {}),
581
+ },
440
582
  });
441
583
  if (!deps.turnLogs.read(req.id).exists) {
442
584
  send({
@@ -460,14 +602,25 @@ export async function dispatchRequest(
460
602
  // must still be cancellable, and the `signal?.aborted` checks below mean a cancel that lands
461
603
  // while queued drops the run instead of starting it late.
462
604
  const onLane = <T>(lane: string, fn: () => Promise<T>): Promise<T> =>
463
- deps.queue ? deps.queue.run(lane, fn) : fn();
605
+ deps.queue
606
+ ? deps.queue.run(lane, () =>
607
+ signal?.aborted ? Promise.resolve(undefined as T) : fn(),
608
+ )
609
+ : signal?.aborted
610
+ ? Promise.resolve(undefined as T)
611
+ : fn();
464
612
 
465
613
  try {
466
614
  if (req.kind === 'ask') {
467
615
  await onLane('room:ask', async () => {
468
616
  const base = {
469
- ...(await askContext()),
470
- prompt: req.prompt,
617
+ ...(req.projectPlan ? { user: { name: '' } } : await askContext(req.prompt)),
618
+ prompt:
619
+ req.handoff && !req.resume
620
+ ? handoffPrompt(req.prompt, req.handoff, { coding: false })
621
+ : req.prompt,
622
+ provider: req.resume ? undefined : req.provider,
623
+ projectPlan: req.projectPlan,
471
624
  images: req.images,
472
625
  requestId: req.id,
473
626
  onApproval: deps.controls
@@ -488,7 +641,7 @@ export async function dispatchRequest(
488
641
  // attempt with a first-output deadline. Yields nothing in time → retry once
489
642
  // fresh so the turn still lands and a new session id is captured. A user
490
643
  // cancel (`signal.aborted`) must not retry. Mirrors runCodeTurn.
491
- const resumed = req.resume
644
+ const resumed = req.resume && !req.projectPlan
492
645
  ? await consumeResumed(
493
646
  (sig) =>
494
647
  harness.askStream({
@@ -516,7 +669,7 @@ export async function dispatchRequest(
516
669
  onEvent(ev);
517
670
  }
518
671
  } else {
519
- const reply = await harness.ask({ ...base, resume: req.resume });
672
+ const reply = await harness.ask({ ...base, resume: req.projectPlan ? undefined : req.resume });
520
673
  send({
521
674
  requestId: req.id,
522
675
  kind: 'ask',
@@ -621,6 +774,23 @@ export async function dispatchRequest(
621
774
  requestId: req.id,
622
775
  message: 'Cloning is not enabled on this daemon yet.',
623
776
  });
777
+ } else if (req.kind === 'transcribe') {
778
+ if (!deps.speech)
779
+ throw new Error(
780
+ 'Speech recognition is not installed on this computer.',
781
+ );
782
+ const transcript = await onLane('speech', () =>
783
+ deps.speech!.transcribe(req.audio, signal),
784
+ );
785
+ send({ requestId: req.id, kind: 'transcription', transcript });
786
+ } else if (req.kind === 'getAutomations' || req.kind === 'automation') {
787
+ if (!deps.automations)
788
+ throw new Error('Update Lucidity on your computer to use automations.');
789
+ const snapshot =
790
+ req.kind === 'getAutomations'
791
+ ? deps.automations.snapshot(req)
792
+ : await deps.automations.command(req.command);
793
+ send({ requestId: req.id, kind: 'automations', snapshot });
624
794
  } else if (req.kind === 'getConfig') {
625
795
  // Daemon Settings read: reply with the redacted config (secrets stripped).
626
796
  if (deps.getConfig)
@@ -697,6 +867,8 @@ export async function dispatchRequest(
697
867
  prompt: req.prompt,
698
868
  images: req.images,
699
869
  resume: req.resume,
870
+ provider: req.provider,
871
+ handoff: req.handoff,
700
872
  mode: req.mode,
701
873
  expectedBranch: req.expectedBranch,
702
874
  workerId: req.workerId,
@@ -725,11 +897,14 @@ export async function dispatchRequest(
725
897
  }
726
898
 
727
899
  export interface RoomClientOptions {
900
+ speech?: SpeechService;
901
+ capturesDir?: string;
728
902
  computerId?: string;
729
903
  providerHealth?: () => { claude: ProviderHealth; codex: ProviderHealth };
730
904
  onProviderHealth?: (listener: () => void) => () => void;
731
905
  controls?: AgentControls;
732
906
  models?: (provider: AgentProvider) => Promise<ExecutorModel[]>;
907
+ commands?: (provider: AgentProvider, context?: AgentCommandContext) => Promise<AgentCommandOption[]>;
733
908
  config: DaemonConfig;
734
909
  harness: LucidHarness;
735
910
  vault: Vault;
@@ -747,6 +922,7 @@ export interface RoomClientOptions {
747
922
  cloneHandler?: CloneHandler;
748
923
  /** Read the daemon's redacted config for the phone's Daemon Settings screen. */
749
924
  getConfig?: () => DaemonConfigView;
925
+ automations?: AutomationService;
750
926
  /** Persist + live-apply a config patch from Daemon Settings; reports restart intent. */
751
927
  setConfig?: (
752
928
  patch: DaemonConfigPatch,
@@ -898,9 +1074,10 @@ export function startRoomClient(opts: RoomClientOptions): RoomClientHandle {
898
1074
  const url =
899
1075
  roomUrl(config.apiUrl, config.machineName) +
900
1076
  `&device=${encodeURIComponent(identity)}`;
901
- const askContext = () => loadAskContext(config, vault);
1077
+ const askContext = (query?: string) => loadAskContext(config, vault, query);
902
1078
  const briefingContext = () => loadBriefingContext(config, vault);
903
1079
  const turnLogs = opts.turnLogs ?? new TurnLogStore();
1080
+ const executionLanes = queue ?? new LaneQueue();
904
1081
  // The daemon's side of an incident bundle (#314): a rolling connection timeline the
905
1082
  // `incident` handler joins to the turn log. In-memory — the durable evidence is the turn log.
906
1083
  const telemetry = new RoomTelemetry();
@@ -912,6 +1089,8 @@ export function startRoomClient(opts: RoomClientOptions): RoomClientHandle {
912
1089
  // Survives reconnects — an in-flight run outlives a dropped socket, so a `cancel`
913
1090
  // sent after re-dialing must still be able to find and abort it.
914
1091
  const inFlight = new Map<string, AbortController>();
1092
+ let durableQueue: DurableTurnQueue | undefined;
1093
+ let captures: VoiceCaptureService | undefined;
915
1094
 
916
1095
  // Send to whatever socket is CURRENT, read fresh each call — an in-flight turn started
917
1096
  // on a socket that later dropped must deliver its remaining frames to the reconnected
@@ -941,6 +1120,7 @@ export function startRoomClient(opts: RoomClientOptions): RoomClientHandle {
941
1120
  typeof rec.requestId === 'string'
942
1121
  ) {
943
1122
  sendRaw(turnLogs.append(rec.requestId, rec));
1123
+ durableQueue?.wake();
944
1124
  return;
945
1125
  }
946
1126
  }
@@ -1001,6 +1181,122 @@ export function startRoomClient(opts: RoomClientOptions): RoomClientHandle {
1001
1181
  reconnectTimer.unref?.();
1002
1182
  }
1003
1183
 
1184
+ const dispatch = (raw: string, overrides: Partial<DispatchDeps> = {}) =>
1185
+ dispatchRequest(raw, {
1186
+ harness,
1187
+ recordAcceptance: true,
1188
+ runtime: opts.providerHealth ? () => computerRuntime(opts) : undefined,
1189
+ controls: opts.controls,
1190
+ models: opts.models,
1191
+ commands: opts.commands,
1192
+ askContext,
1193
+ briefingContext,
1194
+ send: turnSend,
1195
+ sendRaw,
1196
+ turnLogs,
1197
+ signal,
1198
+ codeHandler,
1199
+ conductHandler,
1200
+ cloneHandler,
1201
+ queue: executionLanes,
1202
+ inFlight,
1203
+ attention: opts.attention,
1204
+ logger: log,
1205
+ // Live allowlist (#78) + each row's live branch (#121); shared with pushRepos above.
1206
+ listRepos,
1207
+ listPrs: (repoId, mode) => resolvePrs(repoId, mode, config),
1208
+ getConfig,
1209
+ speech: opts.speech,
1210
+ captures,
1211
+ automations: opts.automations,
1212
+ setConfig: setConfig
1213
+ ? (patch, restart) => {
1214
+ const result = setConfig(patch, restart);
1215
+ publishComputer();
1216
+ return result;
1217
+ }
1218
+ : undefined,
1219
+ requestRestart,
1220
+ telemetry,
1221
+ machine: config.machineName,
1222
+ incidentsDir: opts.incidentsDir,
1223
+
1224
+ turnQueue: durableQueue,
1225
+ ...overrides,
1226
+ });
1227
+ durableQueue = new DurableTurnQueue({
1228
+ dir: turnLogs.queueDirectory(),
1229
+ logs: turnLogs,
1230
+ lanes: executionLanes,
1231
+ sendRaw,
1232
+ execute: (request) =>
1233
+ dispatch(JSON.stringify(request), {
1234
+ recordAcceptance: false,
1235
+ queue: undefined,
1236
+ }),
1237
+ steer: opts.controls
1238
+ ? (targetId, prompt) => opts.controls!.steer(targetId, prompt)
1239
+ : undefined,
1240
+ });
1241
+ durableQueue.wake();
1242
+
1243
+ if (opts.speech) {
1244
+ // Never resume another account's queued commands after replacing credentials.
1245
+ const account = createHash('sha256')
1246
+ .update(`${config.apiUrl}\n${config.apiKey}`)
1247
+ .digest('hex');
1248
+ try {
1249
+ captures = new VoiceCaptureService({
1250
+ directory:
1251
+ opts.capturesDir ?? join(CONFIG_DIR, 'voice-captures', account),
1252
+ logger: log,
1253
+ transcribe: (audio, signal) =>
1254
+ executionLanes.run('speech', () =>
1255
+ opts.speech!.transcribe(audio, signal),
1256
+ ),
1257
+ act: async (transcript, signal) => {
1258
+ let answer: string | undefined;
1259
+ let failure: string | undefined;
1260
+ await dispatch(
1261
+ JSON.stringify({
1262
+ id: uuidv7(),
1263
+ kind: 'ask',
1264
+ prompt: transcript,
1265
+ stream: false,
1266
+ }),
1267
+ {
1268
+ signal,
1269
+ recordAcceptance: false,
1270
+ // The Watch has no approval UI. Provider defaults deny requests that
1271
+ // require an interactive decision; the user's existing tool scope applies.
1272
+ controls: undefined,
1273
+ send: (frame) => {
1274
+ const result = frame as {
1275
+ kind?: string;
1276
+ type?: string;
1277
+ text?: string;
1278
+ message?: string;
1279
+ };
1280
+ if (result.kind === 'ask') answer = result.text;
1281
+ if (result.type === 'error') failure = result.message;
1282
+ },
1283
+ },
1284
+ );
1285
+ if (failure || answer === undefined)
1286
+ throw new Error('Voice action did not finish.');
1287
+ return answer;
1288
+ },
1289
+ });
1290
+ captures.wake();
1291
+ } catch {
1292
+ // Preserve the receipt ledger: disabling capture prevents replay while
1293
+ // leaving the computer's other features available.
1294
+ log(
1295
+ 'Voice capture is disabled because its saved receipts could not be opened.',
1296
+ );
1297
+ }
1298
+ }
1299
+
1004
1300
  function connect(): void {
1005
1301
  if (stopped) return;
1006
1302
  const ws = new WebSocket(url, {
@@ -1036,41 +1332,7 @@ export function startRoomClient(opts: RoomClientOptions): RoomClientHandle {
1036
1332
  const raw = Array.isArray(data)
1037
1333
  ? Buffer.concat(data).toString()
1038
1334
  : data.toString();
1039
- void dispatchRequest(raw, {
1040
- harness,
1041
- recordAcceptance: true,
1042
- runtime: opts.providerHealth ? () => computerRuntime(opts) : undefined,
1043
- controls: opts.controls,
1044
- models: opts.models,
1045
- askContext,
1046
- briefingContext,
1047
- send: turnSend,
1048
- sendRaw,
1049
- turnLogs,
1050
- signal,
1051
- codeHandler,
1052
- conductHandler,
1053
- cloneHandler,
1054
- queue,
1055
- inFlight,
1056
- attention: opts.attention,
1057
- logger: log,
1058
- // Live allowlist (#78) + each row's live branch (#121); shared with pushRepos above.
1059
- listRepos,
1060
- listPrs: (repoId, mode) => resolvePrs(repoId, mode, config),
1061
- getConfig,
1062
- setConfig: setConfig
1063
- ? (patch, restart) => {
1064
- const result = setConfig(patch, restart);
1065
- publishComputer();
1066
- return result;
1067
- }
1068
- : undefined,
1069
- requestRestart,
1070
- telemetry,
1071
- machine: config.machineName,
1072
- incidentsDir: opts.incidentsDir,
1073
- }).catch((err) => {
1335
+ void dispatch(raw).catch((err) => {
1074
1336
  log(
1075
1337
  `dispatch error: ${err instanceof Error ? err.message : String(err)}`,
1076
1338
  );
@@ -1118,6 +1380,8 @@ export function startRoomClient(opts: RoomClientOptions): RoomClientHandle {
1118
1380
  function stop(): void {
1119
1381
  if (stopped) return;
1120
1382
  stopped = true;
1383
+ captures?.stop();
1384
+ durableQueue?.stop();
1121
1385
  clearInterval(redialWatchdog);
1122
1386
  unsubscribeHealth?.();
1123
1387
  if (reconnectTimer) {
@@ -39,21 +39,29 @@ export function computerRuntime(opts: RoomClientOptions): ComputerRuntime {
39
39
  protocol: COMPUTER_PROTOCOL,
40
40
  features: [
41
41
  'ask',
42
+ 'project-plan',
42
43
  'briefing',
43
44
  'journal',
44
45
  'repos',
45
46
  'prs',
46
47
  'pull',
47
48
  'cancel',
49
+ 'turn-queue',
50
+ 'queue-control',
51
+ 'provider-handoff',
48
52
  'incident',
49
53
  'voice-diag',
54
+ ...(opts.speech?.view().available ? ['transcribe'] : []),
55
+ ...(opts.speech ? ['voice-capture', 'voice-capture-status'] : []),
50
56
  ...(opts.models ? ['models'] : []),
57
+ ...(opts.commands ? ['commands'] : []),
51
58
  ...(opts.controls ? ['permission', 'steer'] : []),
52
59
  ...(opts.codeHandler ? ['code'] : []),
53
60
  ...(opts.conductHandler ? ['conduct'] : []),
54
61
  ...(opts.cloneHandler ? ['clone'] : []),
55
62
  ...(opts.attention ? ['attention'] : []),
56
63
  ...(opts.getConfig ? ['getConfig'] : []),
64
+ ...(opts.automations ? ['getAutomations', 'automation'] : []),
57
65
  ...(opts.setConfig ? ['setConfig'] : []),
58
66
  ],
59
67
  permissions: [
@@ -1,4 +1,5 @@
1
- import { createApiClient } from '@lucidity/runtime';
1
+ import { createApiClient, loadJournalContext } from '@lucidity/runtime';
2
+ import { privateJournalBackend } from '@lucidity/notes';
2
3
  import type { Task, User } from '@lucidity/shared';
3
4
  import type { DaemonConfig, EffortLevel } from '../config.js';
4
5
  import type { Vault } from '../vault.js';
@@ -8,7 +9,7 @@ import { loadFlaggedTasks } from '../importantTasks.js';
8
9
  /**
9
10
  * Per-request context gatherers for the room client. The harness bakes in the
10
11
  * persona at construction; everything else (who the user is, durable memory, a
11
- * recent-notes digest, a task snapshot) is assembled here per turn, mirroring
12
+ * recent-notes and journal digests, a task snapshot) is assembled here per turn, mirroring
12
13
  * the chat server's turn-1 build and the briefing job. All API reads are
13
14
  * best-effort: offline → Lucid still answers, just with less context.
14
15
  */
@@ -17,6 +18,7 @@ export interface AskContext {
17
18
  user: Pick<User, 'name'>;
18
19
  memory?: string;
19
20
  notes?: string;
21
+ journal?: string;
20
22
  context?: string;
21
23
  /** The Chat pair — Ask Lucid + voice run on the latency-tuned model, not the daemon's
22
24
  * batch default. Spread straight onto the harness AskInput by the room ask handler. */
@@ -41,21 +43,27 @@ function memoryFrom(vault: Vault): string | undefined {
41
43
  export async function loadAskContext(
42
44
  config: DaemonConfig,
43
45
  vault: Vault,
46
+ query?: string,
44
47
  ): Promise<AskContext> {
45
48
  const memory = memoryFrom(vault);
46
49
  const notes = loadNotesContext(config);
47
50
  let name = '';
48
51
  let context: string | undefined;
52
+ let journal: string | undefined;
49
53
  try {
50
54
  const api = createApiClient({
51
55
  apiUrl: config.apiUrl,
52
56
  apiKey: config.apiKey,
53
57
  });
54
- const [tasks, user] = await Promise.all([
58
+ const [tasks, user, journalDigest] = await Promise.all([
55
59
  api.request<Task[]>('/api/tasks/today').catch(() => [] as Task[]),
56
60
  api.request<User>('/api/users/me'),
61
+ privateJournalBackend((path) => api.request(path), config.notesPath)
62
+ .then((backend) => loadJournalContext(api, { query, backend }))
63
+ .catch(() => undefined),
57
64
  ]);
58
65
  name = user.name ?? '';
66
+ journal = journalDigest?.text;
59
67
  const titles = tasks.map((t) => t.title).filter(Boolean);
60
68
  if (titles.length) context = `Today/overdue tasks: ${titles.join('; ')}`;
61
69
  } catch {
@@ -65,6 +73,7 @@ export async function loadAskContext(
65
73
  user: { name },
66
74
  memory,
67
75
  notes,
76
+ journal,
68
77
  context,
69
78
  model: config.chatModel,
70
79
  effort: config.chatEffort,