@opencorelabs/lucidity 0.3.0 → 0.7.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 (527) hide show
  1. package/README.md +18 -3
  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 +185 -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 +266 -47
  85. package/dist/room/computer.d.ts.map +1 -1
  86. package/dist/room/computer.js +9 -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 +202 -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 +320 -54
  142. package/src/room/computer.ts +9 -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/dayPlan.d.ts +9 -0
  156. package/vendor/decisions/dist/dayPlan.js +82 -0
  157. package/vendor/decisions/dist/gate.d.ts +12 -0
  158. package/vendor/decisions/dist/gate.js +18 -0
  159. package/vendor/decisions/dist/index.d.ts +6 -0
  160. package/vendor/decisions/dist/index.js +6 -0
  161. package/vendor/decisions/dist/jev.d.ts +15 -0
  162. package/vendor/decisions/dist/jev.js +244 -0
  163. package/vendor/decisions/dist/types.d.ts +67 -0
  164. package/vendor/decisions/dist/types.js +1 -0
  165. package/vendor/decisions/package.json +22 -0
  166. package/vendor/decisions/src/capture.ts +199 -0
  167. package/vendor/decisions/src/command.ts +836 -0
  168. package/vendor/decisions/src/dayPlan.ts +80 -0
  169. package/vendor/decisions/src/gate.ts +32 -0
  170. package/vendor/decisions/src/index.ts +6 -0
  171. package/vendor/decisions/src/jev.ts +295 -0
  172. package/vendor/decisions/src/types.ts +79 -0
  173. package/vendor/mcp-server/README.md +6 -1
  174. package/vendor/mcp-server/dist/client.d.ts +1 -0
  175. package/vendor/mcp-server/dist/client.d.ts.map +1 -1
  176. package/vendor/mcp-server/dist/client.js +8 -0
  177. package/vendor/mcp-server/dist/commentProvider.d.ts +3 -0
  178. package/vendor/mcp-server/dist/commentProvider.d.ts.map +1 -0
  179. package/vendor/mcp-server/dist/commentProvider.js +10 -0
  180. package/vendor/mcp-server/dist/index.js +21 -6
  181. package/vendor/mcp-server/dist/tools/automations.d.ts +6 -0
  182. package/vendor/mcp-server/dist/tools/automations.d.ts.map +1 -0
  183. package/vendor/mcp-server/dist/tools/automations.js +163 -0
  184. package/vendor/mcp-server/dist/tools/commandEventFormat.d.ts +52 -0
  185. package/vendor/mcp-server/dist/tools/commandEventFormat.d.ts.map +1 -0
  186. package/vendor/mcp-server/dist/tools/commandEventFormat.js +83 -0
  187. package/vendor/mcp-server/dist/tools/commandEvents.d.ts +3 -0
  188. package/vendor/mcp-server/dist/tools/commandEvents.d.ts.map +1 -0
  189. package/vendor/mcp-server/dist/tools/commandEvents.js +21 -0
  190. package/vendor/mcp-server/dist/tools/comments.d.ts.map +1 -1
  191. package/vendor/mcp-server/dist/tools/comments.js +25 -4
  192. package/vendor/mcp-server/dist/tools/index.d.ts +2 -0
  193. package/vendor/mcp-server/dist/tools/index.d.ts.map +1 -1
  194. package/vendor/mcp-server/dist/tools/index.js +2 -0
  195. package/vendor/mcp-server/dist/tools/journal.d.ts +3 -0
  196. package/vendor/mcp-server/dist/tools/journal.d.ts.map +1 -0
  197. package/vendor/mcp-server/dist/tools/journal.js +131 -0
  198. package/vendor/mcp-server/dist/tools/taskActivity.d.ts +3 -0
  199. package/vendor/mcp-server/dist/tools/taskActivity.d.ts.map +1 -0
  200. package/vendor/mcp-server/dist/tools/taskActivity.js +32 -0
  201. package/vendor/mcp-server/dist/tools/taskOccurrences.d.ts +3 -0
  202. package/vendor/mcp-server/dist/tools/taskOccurrences.d.ts.map +1 -0
  203. package/vendor/mcp-server/dist/tools/taskOccurrences.js +12 -0
  204. package/vendor/mcp-server/dist/tools/taskTrash.d.ts +3 -0
  205. package/vendor/mcp-server/dist/tools/taskTrash.d.ts.map +1 -0
  206. package/vendor/mcp-server/dist/tools/taskTrash.js +21 -0
  207. package/vendor/mcp-server/dist/tools/tasks.d.ts.map +1 -1
  208. package/vendor/mcp-server/dist/tools/tasks.js +67 -27
  209. package/vendor/mcp-server/package.json +5 -1
  210. package/vendor/mcp-server/src/client.ts +10 -0
  211. package/vendor/mcp-server/src/commentProvider.ts +9 -0
  212. package/vendor/mcp-server/src/index.ts +20 -6
  213. package/vendor/mcp-server/src/tools/automations.ts +199 -0
  214. package/vendor/mcp-server/src/tools/commandEventFormat.ts +108 -0
  215. package/vendor/mcp-server/src/tools/commandEvents.ts +27 -0
  216. package/vendor/mcp-server/src/tools/comments.ts +24 -3
  217. package/vendor/mcp-server/src/tools/index.ts +2 -0
  218. package/vendor/mcp-server/src/tools/journal.ts +168 -0
  219. package/vendor/mcp-server/src/tools/taskActivity.ts +55 -0
  220. package/vendor/mcp-server/src/tools/taskOccurrences.ts +26 -0
  221. package/vendor/mcp-server/src/tools/taskTrash.ts +23 -0
  222. package/vendor/mcp-server/src/tools/tasks.ts +66 -30
  223. package/vendor/notes/dist/index.d.ts +2 -0
  224. package/vendor/notes/dist/index.d.ts.map +1 -1
  225. package/vendor/notes/dist/index.js +2 -0
  226. package/vendor/notes/dist/journal-backend.d.ts +4 -0
  227. package/vendor/notes/dist/journal-backend.d.ts.map +1 -0
  228. package/vendor/notes/dist/journal-backend.js +33 -0
  229. package/vendor/notes/dist/journal.d.ts +7 -0
  230. package/vendor/notes/dist/journal.d.ts.map +1 -0
  231. package/vendor/notes/dist/journal.js +173 -0
  232. package/vendor/notes/dist/vault.d.ts.map +1 -1
  233. package/vendor/notes/dist/vault.js +6 -1
  234. package/vendor/notes/src/index.ts +2 -0
  235. package/vendor/notes/src/journal-backend.ts +53 -0
  236. package/vendor/notes/src/journal.ts +194 -0
  237. package/vendor/notes/src/vault.ts +9 -1
  238. package/vendor/runtime/README.md +4 -0
  239. package/vendor/runtime/dist/executor/claudeAgent.d.ts +2 -0
  240. package/vendor/runtime/dist/executor/claudeAgent.d.ts.map +1 -1
  241. package/vendor/runtime/dist/executor/claudeAgent.js +117 -8
  242. package/vendor/runtime/dist/executor/claudeCode.d.ts.map +1 -1
  243. package/vendor/runtime/dist/executor/claudeCode.js +8 -4
  244. package/vendor/runtime/dist/executor/codex.d.ts +2 -0
  245. package/vendor/runtime/dist/executor/codex.d.ts.map +1 -1
  246. package/vendor/runtime/dist/executor/codex.js +214 -11
  247. package/vendor/runtime/dist/executor/codexProtocol/PlanType.d.ts +2 -0
  248. package/vendor/runtime/dist/executor/codexProtocol/PlanType.d.ts.map +1 -0
  249. package/vendor/runtime/dist/executor/codexProtocol/PlanType.js +2 -0
  250. package/vendor/runtime/dist/executor/codexProtocol/v2/CreditsSnapshot.d.ts +6 -0
  251. package/vendor/runtime/dist/executor/codexProtocol/v2/CreditsSnapshot.d.ts.map +1 -0
  252. package/vendor/runtime/dist/executor/codexProtocol/v2/CreditsSnapshot.js +2 -0
  253. package/vendor/runtime/dist/executor/codexProtocol/v2/GetAccountRateLimitsResponse.d.ts +26 -0
  254. package/vendor/runtime/dist/executor/codexProtocol/v2/GetAccountRateLimitsResponse.d.ts.map +1 -0
  255. package/vendor/runtime/dist/executor/codexProtocol/v2/GetAccountRateLimitsResponse.js +2 -0
  256. package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitReachedType.d.ts +2 -0
  257. package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitReachedType.d.ts.map +1 -0
  258. package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitReachedType.js +2 -0
  259. package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitResetCredit.d.ts +27 -0
  260. package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitResetCredit.d.ts.map +1 -0
  261. package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitResetCredit.js +2 -0
  262. package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitResetCreditStatus.d.ts +2 -0
  263. package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitResetCreditStatus.d.ts.map +1 -0
  264. package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitResetCreditStatus.js +2 -0
  265. package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitResetCreditsSummary.d.ts +13 -0
  266. package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitResetCreditsSummary.d.ts.map +1 -0
  267. package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitResetCreditsSummary.js +2 -0
  268. package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitResetType.d.ts +2 -0
  269. package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitResetType.d.ts.map +1 -0
  270. package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitResetType.js +2 -0
  271. package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitSnapshot.d.ts +20 -0
  272. package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitSnapshot.d.ts.map +1 -0
  273. package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitSnapshot.js +2 -0
  274. package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitWindow.d.ts +6 -0
  275. package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitWindow.d.ts.map +1 -0
  276. package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitWindow.js +2 -0
  277. package/vendor/runtime/dist/executor/codexProtocol/v2/ReviewDelivery.d.ts +2 -0
  278. package/vendor/runtime/dist/executor/codexProtocol/v2/ReviewDelivery.d.ts.map +1 -0
  279. package/vendor/runtime/dist/executor/codexProtocol/v2/ReviewDelivery.js +2 -0
  280. package/vendor/runtime/dist/executor/codexProtocol/v2/ReviewStartParams.d.ts +12 -0
  281. package/vendor/runtime/dist/executor/codexProtocol/v2/ReviewStartParams.d.ts.map +1 -0
  282. package/vendor/runtime/dist/executor/codexProtocol/v2/ReviewStartParams.js +2 -0
  283. package/vendor/runtime/dist/executor/codexProtocol/v2/ReviewTarget.d.ts +17 -0
  284. package/vendor/runtime/dist/executor/codexProtocol/v2/ReviewTarget.d.ts.map +1 -0
  285. package/vendor/runtime/dist/executor/codexProtocol/v2/ReviewTarget.js +2 -0
  286. package/vendor/runtime/dist/executor/codexProtocol/v2/SkillDependencies.d.ts +5 -0
  287. package/vendor/runtime/dist/executor/codexProtocol/v2/SkillDependencies.d.ts.map +1 -0
  288. package/vendor/runtime/dist/executor/codexProtocol/v2/SkillDependencies.js +2 -0
  289. package/vendor/runtime/dist/executor/codexProtocol/v2/SkillErrorInfo.d.ts +5 -0
  290. package/vendor/runtime/dist/executor/codexProtocol/v2/SkillErrorInfo.d.ts.map +1 -0
  291. package/vendor/runtime/dist/executor/codexProtocol/v2/SkillErrorInfo.js +2 -0
  292. package/vendor/runtime/dist/executor/codexProtocol/v2/SkillInterface.d.ts +18 -0
  293. package/vendor/runtime/dist/executor/codexProtocol/v2/SkillInterface.d.ts.map +1 -0
  294. package/vendor/runtime/dist/executor/codexProtocol/v2/SkillInterface.js +2 -0
  295. package/vendor/runtime/dist/executor/codexProtocol/v2/SkillMetadata.d.ts +22 -0
  296. package/vendor/runtime/dist/executor/codexProtocol/v2/SkillMetadata.d.ts.map +1 -0
  297. package/vendor/runtime/dist/executor/codexProtocol/v2/SkillMetadata.js +2 -0
  298. package/vendor/runtime/dist/executor/codexProtocol/v2/SkillScope.d.ts +2 -0
  299. package/vendor/runtime/dist/executor/codexProtocol/v2/SkillScope.d.ts.map +1 -0
  300. package/vendor/runtime/dist/executor/codexProtocol/v2/SkillScope.js +2 -0
  301. package/vendor/runtime/dist/executor/codexProtocol/v2/SkillToolDependency.d.ts +9 -0
  302. package/vendor/runtime/dist/executor/codexProtocol/v2/SkillToolDependency.d.ts.map +1 -0
  303. package/vendor/runtime/dist/executor/codexProtocol/v2/SkillToolDependency.js +2 -0
  304. package/vendor/runtime/dist/executor/codexProtocol/v2/SkillsListEntry.d.ts +8 -0
  305. package/vendor/runtime/dist/executor/codexProtocol/v2/SkillsListEntry.d.ts.map +1 -0
  306. package/vendor/runtime/dist/executor/codexProtocol/v2/SkillsListEntry.js +2 -0
  307. package/vendor/runtime/dist/executor/codexProtocol/v2/SkillsListResponse.d.ts +5 -0
  308. package/vendor/runtime/dist/executor/codexProtocol/v2/SkillsListResponse.d.ts.map +1 -0
  309. package/vendor/runtime/dist/executor/codexProtocol/v2/SkillsListResponse.js +2 -0
  310. package/vendor/runtime/dist/executor/codexProtocol/v2/SpendControlLimitSnapshot.d.ts +7 -0
  311. package/vendor/runtime/dist/executor/codexProtocol/v2/SpendControlLimitSnapshot.d.ts.map +1 -0
  312. package/vendor/runtime/dist/executor/codexProtocol/v2/SpendControlLimitSnapshot.js +2 -0
  313. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadSetNameParams.d.ts +5 -0
  314. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadSetNameParams.d.ts.map +1 -0
  315. package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadSetNameParams.js +2 -0
  316. package/vendor/runtime/dist/executor/health.d.ts +1 -0
  317. package/vendor/runtime/dist/executor/health.d.ts.map +1 -1
  318. package/vendor/runtime/dist/executor/health.js +3 -0
  319. package/vendor/runtime/dist/executor/liveTurns.d.ts.map +1 -1
  320. package/vendor/runtime/dist/executor/liveTurns.js +3 -0
  321. package/vendor/runtime/dist/executor/providerRouter.d.ts.map +1 -1
  322. package/vendor/runtime/dist/executor/providerRouter.js +2 -1
  323. package/vendor/runtime/dist/executor/types.d.ts +10 -0
  324. package/vendor/runtime/dist/executor/types.d.ts.map +1 -1
  325. package/vendor/runtime/dist/harness/index.d.ts +2 -0
  326. package/vendor/runtime/dist/harness/index.d.ts.map +1 -1
  327. package/vendor/runtime/dist/harness/index.js +46 -1
  328. package/vendor/runtime/dist/harness/types.d.ts +5 -1
  329. package/vendor/runtime/dist/harness/types.d.ts.map +1 -1
  330. package/vendor/runtime/dist/index.d.ts +2 -1
  331. package/vendor/runtime/dist/index.d.ts.map +1 -1
  332. package/vendor/runtime/dist/index.js +2 -0
  333. package/vendor/runtime/dist/journal/context.d.ts +18 -0
  334. package/vendor/runtime/dist/journal/context.d.ts.map +1 -1
  335. package/vendor/runtime/dist/journal/context.js +19 -5
  336. package/vendor/runtime/dist/prompts/briefing.d.ts +4 -7
  337. package/vendor/runtime/dist/prompts/briefing.d.ts.map +1 -1
  338. package/vendor/runtime/dist/prompts/briefing.js +61 -12
  339. package/vendor/runtime/dist/prompts/cardStatement.d.ts +7 -0
  340. package/vendor/runtime/dist/prompts/cardStatement.d.ts.map +1 -0
  341. package/vendor/runtime/dist/prompts/cardStatement.js +52 -0
  342. package/vendor/runtime/dist/prompts/chat.d.ts +1 -0
  343. package/vendor/runtime/dist/prompts/chat.d.ts.map +1 -1
  344. package/vendor/runtime/dist/prompts/chat.js +15 -1
  345. package/vendor/runtime/dist/prompts/dayPlanning.d.ts +44 -0
  346. package/vendor/runtime/dist/prompts/dayPlanning.d.ts.map +1 -0
  347. package/vendor/runtime/dist/prompts/dayPlanning.js +42 -0
  348. package/vendor/runtime/dist/prompts/projectCapture.d.ts +7 -0
  349. package/vendor/runtime/dist/prompts/projectCapture.d.ts.map +1 -0
  350. package/vendor/runtime/dist/prompts/projectCapture.js +31 -0
  351. package/vendor/runtime/src/executor/claudeAgent.ts +137 -7
  352. package/vendor/runtime/src/executor/claudeCode.ts +6 -4
  353. package/vendor/runtime/src/executor/codex.ts +281 -20
  354. package/vendor/runtime/src/executor/codexProtocol/PlanType.ts +5 -0
  355. package/vendor/runtime/src/executor/codexProtocol/v2/CreditsSnapshot.ts +5 -0
  356. package/vendor/runtime/src/executor/codexProtocol/v2/GetAccountRateLimitsResponse.ts +25 -0
  357. package/vendor/runtime/src/executor/codexProtocol/v2/RateLimitReachedType.ts +5 -0
  358. package/vendor/runtime/src/executor/codexProtocol/v2/RateLimitResetCredit.ts +27 -0
  359. package/vendor/runtime/src/executor/codexProtocol/v2/RateLimitResetCreditStatus.ts +5 -0
  360. package/vendor/runtime/src/executor/codexProtocol/v2/RateLimitResetCreditsSummary.ts +14 -0
  361. package/vendor/runtime/src/executor/codexProtocol/v2/RateLimitResetType.ts +5 -0
  362. package/vendor/runtime/src/executor/codexProtocol/v2/RateLimitSnapshot.ts +14 -0
  363. package/vendor/runtime/src/executor/codexProtocol/v2/RateLimitWindow.ts +5 -0
  364. package/vendor/runtime/src/executor/codexProtocol/v2/ReviewDelivery.ts +5 -0
  365. package/vendor/runtime/src/executor/codexProtocol/v2/ReviewStartParams.ts +12 -0
  366. package/vendor/runtime/src/executor/codexProtocol/v2/ReviewTarget.ts +9 -0
  367. package/vendor/runtime/src/executor/codexProtocol/v2/SkillDependencies.ts +6 -0
  368. package/vendor/runtime/src/executor/codexProtocol/v2/SkillErrorInfo.ts +5 -0
  369. package/vendor/runtime/src/executor/codexProtocol/v2/SkillInterface.ts +14 -0
  370. package/vendor/runtime/src/executor/codexProtocol/v2/SkillMetadata.ts +17 -0
  371. package/vendor/runtime/src/executor/codexProtocol/v2/SkillScope.ts +5 -0
  372. package/vendor/runtime/src/executor/codexProtocol/v2/SkillToolDependency.ts +5 -0
  373. package/vendor/runtime/src/executor/codexProtocol/v2/SkillsListEntry.ts +7 -0
  374. package/vendor/runtime/src/executor/codexProtocol/v2/SkillsListResponse.ts +6 -0
  375. package/vendor/runtime/src/executor/codexProtocol/v2/SpendControlLimitSnapshot.ts +5 -0
  376. package/vendor/runtime/src/executor/codexProtocol/v2/ThreadSetNameParams.ts +5 -0
  377. package/vendor/runtime/src/executor/health.ts +3 -0
  378. package/vendor/runtime/src/executor/liveTurns.ts +3 -0
  379. package/vendor/runtime/src/executor/providerRouter.ts +2 -1
  380. package/vendor/runtime/src/executor/types.ts +10 -0
  381. package/vendor/runtime/src/harness/index.ts +51 -6
  382. package/vendor/runtime/src/harness/types.ts +5 -1
  383. package/vendor/runtime/src/index.ts +4 -1
  384. package/vendor/runtime/src/journal/context.ts +40 -7
  385. package/vendor/runtime/src/prompts/briefing.ts +62 -17
  386. package/vendor/runtime/src/prompts/cardStatement.ts +64 -0
  387. package/vendor/runtime/src/prompts/chat.ts +25 -3
  388. package/vendor/runtime/src/prompts/dayPlanning.ts +46 -0
  389. package/vendor/runtime/src/prompts/projectCapture.ts +51 -0
  390. package/vendor/shared/dist/agentCommands.d.ts +22 -0
  391. package/vendor/shared/dist/agentCommands.d.ts.map +1 -0
  392. package/vendor/shared/dist/agentCommands.js +11 -0
  393. package/vendor/shared/dist/automationTemplates.d.ts +37 -0
  394. package/vendor/shared/dist/automationTemplates.d.ts.map +1 -0
  395. package/vendor/shared/dist/automationTemplates.js +48 -0
  396. package/vendor/shared/dist/automations.d.ts +1052 -0
  397. package/vendor/shared/dist/automations.d.ts.map +1 -0
  398. package/vendor/shared/dist/automations.js +300 -0
  399. package/vendor/shared/dist/cardStatement.d.ts +28 -0
  400. package/vendor/shared/dist/cardStatement.d.ts.map +1 -0
  401. package/vendor/shared/dist/cardStatement.js +37 -0
  402. package/vendor/shared/dist/cardStudio.d.ts +756 -0
  403. package/vendor/shared/dist/cardStudio.d.ts.map +1 -0
  404. package/vendor/shared/dist/cardStudio.js +297 -0
  405. package/vendor/shared/dist/commandLocal.d.ts +218 -0
  406. package/vendor/shared/dist/commandLocal.d.ts.map +1 -0
  407. package/vendor/shared/dist/commandLocal.js +664 -0
  408. package/vendor/shared/dist/commandText.d.ts +12 -0
  409. package/vendor/shared/dist/commandText.d.ts.map +1 -0
  410. package/vendor/shared/dist/commandText.js +21 -0
  411. package/vendor/shared/dist/commands.d.ts +1534 -0
  412. package/vendor/shared/dist/commands.d.ts.map +1 -0
  413. package/vendor/shared/dist/commands.js +233 -0
  414. package/vendor/shared/dist/computer.d.ts +9 -9
  415. package/vendor/shared/dist/computer.d.ts.map +1 -1
  416. package/vendor/shared/dist/computer.js +12 -2
  417. package/vendor/shared/dist/constants.d.ts +3 -3
  418. package/vendor/shared/dist/constants.d.ts.map +1 -1
  419. package/vendor/shared/dist/constants.js +9 -2
  420. package/vendor/shared/dist/dayPlan.d.ts +86 -0
  421. package/vendor/shared/dist/dayPlan.d.ts.map +1 -0
  422. package/vendor/shared/dist/dayPlan.js +46 -0
  423. package/vendor/shared/dist/dayPlanning.d.ts +139 -0
  424. package/vendor/shared/dist/dayPlanning.d.ts.map +1 -0
  425. package/vendor/shared/dist/dayPlanning.js +67 -0
  426. package/vendor/shared/dist/githubContributions.d.ts +93 -0
  427. package/vendor/shared/dist/githubContributions.d.ts.map +1 -0
  428. package/vendor/shared/dist/githubContributions.js +54 -0
  429. package/vendor/shared/dist/habitContributions.d.ts +26 -0
  430. package/vendor/shared/dist/habitContributions.d.ts.map +1 -0
  431. package/vendor/shared/dist/habitContributions.js +119 -0
  432. package/vendor/shared/dist/index.d.ts +28 -2
  433. package/vendor/shared/dist/index.d.ts.map +1 -1
  434. package/vendor/shared/dist/index.js +25 -2
  435. package/vendor/shared/dist/journal-migration.d.ts +29 -0
  436. package/vendor/shared/dist/journal-migration.d.ts.map +1 -0
  437. package/vendor/shared/dist/journal-migration.js +73 -0
  438. package/vendor/shared/dist/journal-vault.d.ts +414 -0
  439. package/vendor/shared/dist/journal-vault.d.ts.map +1 -0
  440. package/vendor/shared/dist/journal-vault.js +972 -0
  441. package/vendor/shared/dist/projectCapture.d.ts +73 -0
  442. package/vendor/shared/dist/projectCapture.d.ts.map +1 -0
  443. package/vendor/shared/dist/projectCapture.js +66 -0
  444. package/vendor/shared/dist/quickAdd.d.ts +90 -0
  445. package/vendor/shared/dist/quickAdd.d.ts.map +1 -0
  446. package/vendor/shared/dist/quickAdd.js +260 -0
  447. package/vendor/shared/dist/recurrence.d.ts +44 -0
  448. package/vendor/shared/dist/recurrence.d.ts.map +1 -0
  449. package/vendor/shared/dist/recurrence.js +37 -0
  450. package/vendor/shared/dist/reminderWords.d.ts +11 -0
  451. package/vendor/shared/dist/reminderWords.d.ts.map +1 -0
  452. package/vendor/shared/dist/reminderWords.js +63 -0
  453. package/vendor/shared/dist/schemas/comment.d.ts +13 -1
  454. package/vendor/shared/dist/schemas/comment.d.ts.map +1 -1
  455. package/vendor/shared/dist/schemas/comment.js +5 -0
  456. package/vendor/shared/dist/schemas/conversation.d.ts +3 -3
  457. package/vendor/shared/dist/schemas/harness.d.ts +976 -59
  458. package/vendor/shared/dist/schemas/harness.d.ts.map +1 -1
  459. package/vendor/shared/dist/schemas/harness.js +124 -3
  460. package/vendor/shared/dist/schemas/journal.d.ts +10 -0
  461. package/vendor/shared/dist/schemas/journal.d.ts.map +1 -1
  462. package/vendor/shared/dist/schemas/journal.js +10 -2
  463. package/vendor/shared/dist/schemas/notification.d.ts +1 -1
  464. package/vendor/shared/dist/schemas/organization.d.ts +3 -2
  465. package/vendor/shared/dist/schemas/organization.d.ts.map +1 -1
  466. package/vendor/shared/dist/schemas/organization.js +3 -2
  467. package/vendor/shared/dist/schemas/proposal.d.ts +7 -3
  468. package/vendor/shared/dist/schemas/proposal.d.ts.map +1 -1
  469. package/vendor/shared/dist/schemas/proposal.js +2 -1
  470. package/vendor/shared/dist/schemas/request.d.ts +44 -4
  471. package/vendor/shared/dist/schemas/request.d.ts.map +1 -1
  472. package/vendor/shared/dist/schemas/task.d.ts +83 -8
  473. package/vendor/shared/dist/schemas/task.d.ts.map +1 -1
  474. package/vendor/shared/dist/schemas/task.js +20 -2
  475. package/vendor/shared/dist/schemas/timeSession.d.ts +2 -2
  476. package/vendor/shared/dist/smartCapture.d.ts +60 -0
  477. package/vendor/shared/dist/smartCapture.d.ts.map +1 -0
  478. package/vendor/shared/dist/smartCapture.js +56 -0
  479. package/vendor/shared/dist/speech.d.ts +39 -0
  480. package/vendor/shared/dist/speech.d.ts.map +1 -0
  481. package/vendor/shared/dist/speech.js +36 -0
  482. package/vendor/shared/dist/spokenNames.d.ts +25 -0
  483. package/vendor/shared/dist/spokenNames.d.ts.map +1 -0
  484. package/vendor/shared/dist/spokenNames.js +120 -0
  485. package/vendor/shared/dist/taskActivity.d.ts +76 -0
  486. package/vendor/shared/dist/taskActivity.d.ts.map +1 -0
  487. package/vendor/shared/dist/taskActivity.js +27 -0
  488. package/vendor/shared/dist/vault-search.d.ts +50 -0
  489. package/vendor/shared/dist/vault-search.d.ts.map +1 -0
  490. package/vendor/shared/dist/vault-search.js +177 -0
  491. package/vendor/shared/dist/voiceCapture.d.ts +32 -0
  492. package/vendor/shared/dist/voiceCapture.d.ts.map +1 -0
  493. package/vendor/shared/dist/voiceCapture.js +29 -0
  494. package/vendor/shared/package.json +4 -0
  495. package/vendor/shared/src/agentCommands.ts +35 -0
  496. package/vendor/shared/src/automationTemplates.ts +54 -0
  497. package/vendor/shared/src/automations.ts +329 -0
  498. package/vendor/shared/src/cardStatement.ts +49 -0
  499. package/vendor/shared/src/cardStudio.ts +340 -0
  500. package/vendor/shared/src/commandLocal.ts +740 -0
  501. package/vendor/shared/src/commandText.ts +25 -0
  502. package/vendor/shared/src/commands.ts +255 -0
  503. package/vendor/shared/src/computer.ts +25 -6
  504. package/vendor/shared/src/constants.ts +9 -2
  505. package/vendor/shared/src/dayPlan.ts +81 -0
  506. package/vendor/shared/src/dayPlanning.ts +77 -0
  507. package/vendor/shared/src/githubContributions.ts +70 -0
  508. package/vendor/shared/src/habitContributions.ts +144 -0
  509. package/vendor/shared/src/index.ts +44 -1
  510. package/vendor/shared/src/journal-migration.ts +130 -0
  511. package/vendor/shared/src/journal-vault.ts +1240 -0
  512. package/vendor/shared/src/projectCapture.ts +86 -0
  513. package/vendor/shared/src/quickAdd.ts +310 -0
  514. package/vendor/shared/src/recurrence.ts +37 -0
  515. package/vendor/shared/src/reminderWords.ts +54 -0
  516. package/vendor/shared/src/schemas/comment.ts +5 -0
  517. package/vendor/shared/src/schemas/harness.ts +146 -7
  518. package/vendor/shared/src/schemas/journal.ts +15 -6
  519. package/vendor/shared/src/schemas/organization.ts +3 -2
  520. package/vendor/shared/src/schemas/proposal.ts +6 -1
  521. package/vendor/shared/src/schemas/task.ts +20 -2
  522. package/vendor/shared/src/smartCapture.ts +67 -0
  523. package/vendor/shared/src/speech.ts +44 -0
  524. package/vendor/shared/src/spokenNames.ts +128 -0
  525. package/vendor/shared/src/taskActivity.ts +34 -0
  526. package/vendor/shared/src/vault-search.ts +243 -0
  527. 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,19 +263,101 @@ 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 structured = req.kind === 'ask' && (req.dayPlan ? 'day-plan' : req.projectPlan ? 'project-plan' : undefined);
285
+ const send = (frame: unknown) => sendFrame(structured
286
+ ? { ...(frame as Record<string, unknown>), purpose: structured } : frame);
287
+ if (req.kind === 'voice-capture' || req.kind === 'voice-capture-status') {
288
+ try {
289
+ if (!deps.captures)
290
+ throw new Error(
291
+ 'Update Lucidity on your computer to receive Watch recordings.',
292
+ );
293
+ // Existing receipts remain readable even if the provider later signs out.
294
+ const previous = deps.captures.status(req.credentialId, req.captureId);
295
+ if (req.kind === 'voice-capture' && !previous && deps.runtime) {
296
+ for (const feature of ['transcribe', 'ask']) {
297
+ const availability = computerAvailability(
298
+ {
299
+ type: 'presence',
300
+ daemonConnected: true,
301
+ runtime: deps.runtime(),
302
+ },
303
+ 'online',
304
+ feature,
305
+ );
306
+ if (!availability.canSend)
307
+ throw new Error(`${availability.title}. ${availability.detail}`);
308
+ }
309
+ }
310
+ const receipt =
311
+ req.kind === 'voice-capture'
312
+ ? deps.captures.submit(req.credentialId, {
313
+ captureId: req.captureId,
314
+ audio: req.audio,
315
+ })
316
+ : previous;
317
+ send({ requestId: req.id, kind: 'voice-capture', receipt });
318
+ } catch (error) {
319
+ send({
320
+ type: 'error',
321
+ requestId: req.id,
322
+ message:
323
+ error instanceof Error
324
+ ? error.message
325
+ : 'Voice capture is unavailable.',
326
+ });
327
+ }
328
+ return;
329
+ }
253
330
  deps.telemetry?.record('request', req.kind, req.id);
331
+ if (req.kind === 'queue-control') {
332
+ try {
333
+ if (!deps.turnQueue)
334
+ throw new Error(
335
+ 'Update Lucidity on your computer to manage queued messages.',
336
+ );
337
+ await deps.turnQueue.control(req.targetId, req.action, req.activeId);
338
+ send({ kind: 'control', requestId: req.id, accepted: true });
339
+ } catch (error) {
340
+ send({
341
+ kind: 'control',
342
+ requestId: req.id,
343
+ accepted: false,
344
+ message: (error as Error).message,
345
+ });
346
+ }
347
+ return;
348
+ }
254
349
  if (
255
350
  deps.runtime &&
256
351
  !['pull', 'cancel', 'permission', 'steer'].includes(req.kind)
257
352
  ) {
258
353
  let provider: AgentProvider | undefined;
259
354
  try {
260
- provider =
355
+ provider = req.kind === 'ask' && req.dayPlan ? deps.runtime().defaults.code :
261
356
  'resume' in req && req.resume
262
357
  ? decodeSession(req.resume).provider
263
- : undefined;
358
+ : 'provider' in req
359
+ ? req.provider
360
+ : undefined;
264
361
  } catch {
265
362
  send({
266
363
  type: 'error',
@@ -273,7 +370,7 @@ export async function dispatchRequest(
273
370
  const availability = computerAvailability(
274
371
  { type: 'presence', daemonConnected: true, runtime: deps.runtime() },
275
372
  'online',
276
- req.kind,
373
+ req.kind === 'ask' && req.dayPlan ? 'day-plan' : req.kind,
277
374
  provider,
278
375
  );
279
376
  if (!availability.canSend) {
@@ -348,6 +445,26 @@ export async function dispatchRequest(
348
445
  send({ kind: 'control', requestId: req.id, ...result });
349
446
  return;
350
447
  }
448
+ if (req.kind === 'commands') {
449
+ try {
450
+ if (!deps.commands)
451
+ throw new Error('Update Lucidity on your computer to use commands.');
452
+ send({
453
+ kind: 'commands',
454
+ requestId: req.id,
455
+ provider: req.provider,
456
+ commands: await deps.commands(req.provider, req.context),
457
+ });
458
+ } catch (error) {
459
+ send({
460
+ type: 'error',
461
+ requestId: req.id,
462
+ message:
463
+ error instanceof Error ? error.message : 'Command discovery failed.',
464
+ });
465
+ }
466
+ return;
467
+ }
351
468
  if (req.kind === 'models') {
352
469
  try {
353
470
  send({
@@ -400,6 +517,7 @@ export async function dispatchRequest(
400
517
  for (const frame of state.frames) {
401
518
  if (frame.seq > req.sinceSeq) sendRaw(frame);
402
519
  }
520
+ if (!state.terminated) deps.turnQueue?.confirm(req.targetId);
403
521
  // A phone may already have every logged frame while the turn waits for its
404
522
  // decision. Reconfirm that live approval with a new sequence so reconnect
405
523
  // restores its controls instead of waiting forever for another model token.
@@ -409,7 +527,11 @@ export async function dispatchRequest(
409
527
  // restarted mid-turn). Settle it with a synthesized, persisted terminal so the phone
410
528
  // stops waiting and a repeat pull is idempotent. If it's still in `inFlight`, live
411
529
  // frames past maxSeq keep flowing on the current socket (deduped by seq) — leave it.
412
- if (!state.terminated && !inFlight?.has(req.targetId)) {
530
+ if (
531
+ !state.terminated &&
532
+ !inFlight?.has(req.targetId) &&
533
+ !deps.turnQueue?.owns(req.targetId)
534
+ ) {
413
535
  sendRaw(
414
536
  turnLogs.append(req.targetId, {
415
537
  type: 'error',
@@ -421,6 +543,21 @@ export async function dispatchRequest(
421
543
  return;
422
544
  }
423
545
 
546
+ if ((req.kind === 'ask' || req.kind === 'code') && req.queue) {
547
+ try {
548
+ if (!deps.turnQueue)
549
+ throw new Error('Update Lucidity on your computer to queue messages.');
550
+ deps.turnQueue.enqueue(req);
551
+ } catch (error) {
552
+ send({
553
+ type: 'error',
554
+ requestId: req.id,
555
+ message: (error as Error).message,
556
+ });
557
+ }
558
+ return;
559
+ }
560
+
424
561
  if (
425
562
  deps.recordAcceptance &&
426
563
  ['ask', 'code', 'conduct', 'briefing', 'attention', 'clone'].includes(
@@ -437,6 +574,12 @@ export async function dispatchRequest(
437
574
  const accepted = deps.turnLogs.append(req.id, {
438
575
  type: 'accepted',
439
576
  requestId: req.id,
577
+ scope: {
578
+ kind: req.kind,
579
+ ...('repoId' in req ? { repoId: req.repoId } : {}),
580
+ ...('workerId' in req ? { workerId: req.workerId } : {}),
581
+ ...('mode' in req ? { mode: req.mode } : {}),
582
+ },
440
583
  });
441
584
  if (!deps.turnLogs.read(req.id).exists) {
442
585
  send({
@@ -460,14 +603,26 @@ export async function dispatchRequest(
460
603
  // must still be cancellable, and the `signal?.aborted` checks below mean a cancel that lands
461
604
  // while queued drops the run instead of starting it late.
462
605
  const onLane = <T>(lane: string, fn: () => Promise<T>): Promise<T> =>
463
- deps.queue ? deps.queue.run(lane, fn) : fn();
606
+ deps.queue
607
+ ? deps.queue.run(lane, () =>
608
+ signal?.aborted ? Promise.resolve(undefined as T) : fn(),
609
+ )
610
+ : signal?.aborted
611
+ ? Promise.resolve(undefined as T)
612
+ : fn();
464
613
 
465
614
  try {
466
615
  if (req.kind === 'ask') {
467
616
  await onLane('room:ask', async () => {
468
617
  const base = {
469
- ...(await askContext()),
470
- prompt: req.prompt,
618
+ ...(structured ? { user: { name: '' } } : await askContext(req.prompt)),
619
+ prompt:
620
+ req.handoff && !req.resume && !structured
621
+ ? handoffPrompt(req.prompt, req.handoff, { coding: false })
622
+ : req.prompt,
623
+ provider: req.resume ? undefined : req.provider,
624
+ projectPlan: req.projectPlan,
625
+ dayPlan: req.dayPlan,
471
626
  images: req.images,
472
627
  requestId: req.id,
473
628
  onApproval: deps.controls
@@ -488,7 +643,7 @@ export async function dispatchRequest(
488
643
  // attempt with a first-output deadline. Yields nothing in time → retry once
489
644
  // fresh so the turn still lands and a new session id is captured. A user
490
645
  // cancel (`signal.aborted`) must not retry. Mirrors runCodeTurn.
491
- const resumed = req.resume
646
+ const resumed = req.resume && !structured
492
647
  ? await consumeResumed(
493
648
  (sig) =>
494
649
  harness.askStream({
@@ -516,7 +671,7 @@ export async function dispatchRequest(
516
671
  onEvent(ev);
517
672
  }
518
673
  } else {
519
- const reply = await harness.ask({ ...base, resume: req.resume });
674
+ const reply = await harness.ask({ ...base, resume: structured ? undefined : req.resume });
520
675
  send({
521
676
  requestId: req.id,
522
677
  kind: 'ask',
@@ -621,6 +776,23 @@ export async function dispatchRequest(
621
776
  requestId: req.id,
622
777
  message: 'Cloning is not enabled on this daemon yet.',
623
778
  });
779
+ } else if (req.kind === 'transcribe') {
780
+ if (!deps.speech)
781
+ throw new Error(
782
+ 'Speech recognition is not installed on this computer.',
783
+ );
784
+ const transcript = await onLane('speech', () =>
785
+ deps.speech!.transcribe(req.audio, signal),
786
+ );
787
+ send({ requestId: req.id, kind: 'transcription', transcript });
788
+ } else if (req.kind === 'getAutomations' || req.kind === 'automation') {
789
+ if (!deps.automations)
790
+ throw new Error('Update Lucidity on your computer to use automations.');
791
+ const snapshot =
792
+ req.kind === 'getAutomations'
793
+ ? deps.automations.snapshot(req)
794
+ : await deps.automations.command(req.command);
795
+ send({ requestId: req.id, kind: 'automations', snapshot });
624
796
  } else if (req.kind === 'getConfig') {
625
797
  // Daemon Settings read: reply with the redacted config (secrets stripped).
626
798
  if (deps.getConfig)
@@ -697,6 +869,8 @@ export async function dispatchRequest(
697
869
  prompt: req.prompt,
698
870
  images: req.images,
699
871
  resume: req.resume,
872
+ provider: req.provider,
873
+ handoff: req.handoff,
700
874
  mode: req.mode,
701
875
  expectedBranch: req.expectedBranch,
702
876
  workerId: req.workerId,
@@ -725,11 +899,14 @@ export async function dispatchRequest(
725
899
  }
726
900
 
727
901
  export interface RoomClientOptions {
902
+ speech?: SpeechService;
903
+ capturesDir?: string;
728
904
  computerId?: string;
729
905
  providerHealth?: () => { claude: ProviderHealth; codex: ProviderHealth };
730
906
  onProviderHealth?: (listener: () => void) => () => void;
731
907
  controls?: AgentControls;
732
908
  models?: (provider: AgentProvider) => Promise<ExecutorModel[]>;
909
+ commands?: (provider: AgentProvider, context?: AgentCommandContext) => Promise<AgentCommandOption[]>;
733
910
  config: DaemonConfig;
734
911
  harness: LucidHarness;
735
912
  vault: Vault;
@@ -747,6 +924,7 @@ export interface RoomClientOptions {
747
924
  cloneHandler?: CloneHandler;
748
925
  /** Read the daemon's redacted config for the phone's Daemon Settings screen. */
749
926
  getConfig?: () => DaemonConfigView;
927
+ automations?: AutomationService;
750
928
  /** Persist + live-apply a config patch from Daemon Settings; reports restart intent. */
751
929
  setConfig?: (
752
930
  patch: DaemonConfigPatch,
@@ -898,9 +1076,10 @@ export function startRoomClient(opts: RoomClientOptions): RoomClientHandle {
898
1076
  const url =
899
1077
  roomUrl(config.apiUrl, config.machineName) +
900
1078
  `&device=${encodeURIComponent(identity)}`;
901
- const askContext = () => loadAskContext(config, vault);
1079
+ const askContext = (query?: string) => loadAskContext(config, vault, query);
902
1080
  const briefingContext = () => loadBriefingContext(config, vault);
903
1081
  const turnLogs = opts.turnLogs ?? new TurnLogStore();
1082
+ const executionLanes = queue ?? new LaneQueue();
904
1083
  // The daemon's side of an incident bundle (#314): a rolling connection timeline the
905
1084
  // `incident` handler joins to the turn log. In-memory — the durable evidence is the turn log.
906
1085
  const telemetry = new RoomTelemetry();
@@ -912,6 +1091,8 @@ export function startRoomClient(opts: RoomClientOptions): RoomClientHandle {
912
1091
  // Survives reconnects — an in-flight run outlives a dropped socket, so a `cancel`
913
1092
  // sent after re-dialing must still be able to find and abort it.
914
1093
  const inFlight = new Map<string, AbortController>();
1094
+ let durableQueue: DurableTurnQueue | undefined;
1095
+ let captures: VoiceCaptureService | undefined;
915
1096
 
916
1097
  // Send to whatever socket is CURRENT, read fresh each call — an in-flight turn started
917
1098
  // on a socket that later dropped must deliver its remaining frames to the reconnected
@@ -941,6 +1122,7 @@ export function startRoomClient(opts: RoomClientOptions): RoomClientHandle {
941
1122
  typeof rec.requestId === 'string'
942
1123
  ) {
943
1124
  sendRaw(turnLogs.append(rec.requestId, rec));
1125
+ durableQueue?.wake();
944
1126
  return;
945
1127
  }
946
1128
  }
@@ -1001,6 +1183,122 @@ export function startRoomClient(opts: RoomClientOptions): RoomClientHandle {
1001
1183
  reconnectTimer.unref?.();
1002
1184
  }
1003
1185
 
1186
+ const dispatch = (raw: string, overrides: Partial<DispatchDeps> = {}) =>
1187
+ dispatchRequest(raw, {
1188
+ harness,
1189
+ recordAcceptance: true,
1190
+ runtime: opts.providerHealth ? () => computerRuntime(opts) : undefined,
1191
+ controls: opts.controls,
1192
+ models: opts.models,
1193
+ commands: opts.commands,
1194
+ askContext,
1195
+ briefingContext,
1196
+ send: turnSend,
1197
+ sendRaw,
1198
+ turnLogs,
1199
+ signal,
1200
+ codeHandler,
1201
+ conductHandler,
1202
+ cloneHandler,
1203
+ queue: executionLanes,
1204
+ inFlight,
1205
+ attention: opts.attention,
1206
+ logger: log,
1207
+ // Live allowlist (#78) + each row's live branch (#121); shared with pushRepos above.
1208
+ listRepos,
1209
+ listPrs: (repoId, mode) => resolvePrs(repoId, mode, config),
1210
+ getConfig,
1211
+ speech: opts.speech,
1212
+ captures,
1213
+ automations: opts.automations,
1214
+ setConfig: setConfig
1215
+ ? (patch, restart) => {
1216
+ const result = setConfig(patch, restart);
1217
+ publishComputer();
1218
+ return result;
1219
+ }
1220
+ : undefined,
1221
+ requestRestart,
1222
+ telemetry,
1223
+ machine: config.machineName,
1224
+ incidentsDir: opts.incidentsDir,
1225
+
1226
+ turnQueue: durableQueue,
1227
+ ...overrides,
1228
+ });
1229
+ durableQueue = new DurableTurnQueue({
1230
+ dir: turnLogs.queueDirectory(),
1231
+ logs: turnLogs,
1232
+ lanes: executionLanes,
1233
+ sendRaw,
1234
+ execute: (request) =>
1235
+ dispatch(JSON.stringify(request), {
1236
+ recordAcceptance: false,
1237
+ queue: undefined,
1238
+ }),
1239
+ steer: opts.controls
1240
+ ? (targetId, prompt) => opts.controls!.steer(targetId, prompt)
1241
+ : undefined,
1242
+ });
1243
+ durableQueue.wake();
1244
+
1245
+ if (opts.speech) {
1246
+ // Never resume another account's queued commands after replacing credentials.
1247
+ const account = createHash('sha256')
1248
+ .update(`${config.apiUrl}\n${config.apiKey}`)
1249
+ .digest('hex');
1250
+ try {
1251
+ captures = new VoiceCaptureService({
1252
+ directory:
1253
+ opts.capturesDir ?? join(CONFIG_DIR, 'voice-captures', account),
1254
+ logger: log,
1255
+ transcribe: (audio, signal) =>
1256
+ executionLanes.run('speech', () =>
1257
+ opts.speech!.transcribe(audio, signal),
1258
+ ),
1259
+ act: async (transcript, signal) => {
1260
+ let answer: string | undefined;
1261
+ let failure: string | undefined;
1262
+ await dispatch(
1263
+ JSON.stringify({
1264
+ id: uuidv7(),
1265
+ kind: 'ask',
1266
+ prompt: transcript,
1267
+ stream: false,
1268
+ }),
1269
+ {
1270
+ signal,
1271
+ recordAcceptance: false,
1272
+ // The Watch has no approval UI. Provider defaults deny requests that
1273
+ // require an interactive decision; the user's existing tool scope applies.
1274
+ controls: undefined,
1275
+ send: (frame) => {
1276
+ const result = frame as {
1277
+ kind?: string;
1278
+ type?: string;
1279
+ text?: string;
1280
+ message?: string;
1281
+ };
1282
+ if (result.kind === 'ask') answer = result.text;
1283
+ if (result.type === 'error') failure = result.message;
1284
+ },
1285
+ },
1286
+ );
1287
+ if (failure || answer === undefined)
1288
+ throw new Error('Voice action did not finish.');
1289
+ return answer;
1290
+ },
1291
+ });
1292
+ captures.wake();
1293
+ } catch {
1294
+ // Preserve the receipt ledger: disabling capture prevents replay while
1295
+ // leaving the computer's other features available.
1296
+ log(
1297
+ 'Voice capture is disabled because its saved receipts could not be opened.',
1298
+ );
1299
+ }
1300
+ }
1301
+
1004
1302
  function connect(): void {
1005
1303
  if (stopped) return;
1006
1304
  const ws = new WebSocket(url, {
@@ -1036,41 +1334,7 @@ export function startRoomClient(opts: RoomClientOptions): RoomClientHandle {
1036
1334
  const raw = Array.isArray(data)
1037
1335
  ? Buffer.concat(data).toString()
1038
1336
  : 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) => {
1337
+ void dispatch(raw).catch((err) => {
1074
1338
  log(
1075
1339
  `dispatch error: ${err instanceof Error ? err.message : String(err)}`,
1076
1340
  );
@@ -1118,6 +1382,8 @@ export function startRoomClient(opts: RoomClientOptions): RoomClientHandle {
1118
1382
  function stop(): void {
1119
1383
  if (stopped) return;
1120
1384
  stopped = true;
1385
+ captures?.stop();
1386
+ durableQueue?.stop();
1121
1387
  clearInterval(redialWatchdog);
1122
1388
  unsubscribeHealth?.();
1123
1389
  if (reconnectTimer) {
@@ -39,21 +39,30 @@ export function computerRuntime(opts: RoomClientOptions): ComputerRuntime {
39
39
  protocol: COMPUTER_PROTOCOL,
40
40
  features: [
41
41
  'ask',
42
+ 'project-plan',
43
+ 'day-plan',
42
44
  'briefing',
43
45
  'journal',
44
46
  'repos',
45
47
  'prs',
46
48
  'pull',
47
49
  'cancel',
50
+ 'turn-queue',
51
+ 'queue-control',
52
+ 'provider-handoff',
48
53
  'incident',
49
54
  'voice-diag',
55
+ ...(opts.speech?.view().available ? ['transcribe'] : []),
56
+ ...(opts.speech ? ['voice-capture', 'voice-capture-status'] : []),
50
57
  ...(opts.models ? ['models'] : []),
58
+ ...(opts.commands ? ['commands'] : []),
51
59
  ...(opts.controls ? ['permission', 'steer'] : []),
52
60
  ...(opts.codeHandler ? ['code'] : []),
53
61
  ...(opts.conductHandler ? ['conduct'] : []),
54
62
  ...(opts.cloneHandler ? ['clone'] : []),
55
63
  ...(opts.attention ? ['attention'] : []),
56
64
  ...(opts.getConfig ? ['getConfig'] : []),
65
+ ...(opts.automations ? ['getAutomations', 'automation'] : []),
57
66
  ...(opts.setConfig ? ['setConfig'] : []),
58
67
  ],
59
68
  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,