rookery-agent 0.1.0 → 0.3.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 (670) hide show
  1. package/README.md +467 -367
  2. package/docs/migration.md +88 -88
  3. package/docs/updates.md +112 -0
  4. package/package.json +13 -3
  5. package/packages/cli/dist/commands/config.js +2 -2
  6. package/packages/cli/dist/commands/doctor.d.ts.map +1 -1
  7. package/packages/cli/dist/commands/doctor.js +13 -9
  8. package/packages/cli/dist/commands/doctor.js.map +1 -1
  9. package/packages/cli/dist/commands/memory.js +1 -1
  10. package/packages/cli/dist/commands/org.d.ts +2 -2
  11. package/packages/cli/dist/commands/org.d.ts.map +1 -1
  12. package/packages/cli/dist/commands/org.js +19 -17
  13. package/packages/cli/dist/commands/org.js.map +1 -1
  14. package/packages/cli/dist/commands/serve.js +1 -1
  15. package/packages/cli/dist/commands/serve.js.map +1 -1
  16. package/packages/cli/dist/commands/shared.d.ts.map +1 -1
  17. package/packages/cli/dist/commands/shared.js +2 -1
  18. package/packages/cli/dist/commands/shared.js.map +1 -1
  19. package/packages/cli/dist/commands/tasks.d.ts.map +1 -1
  20. package/packages/cli/dist/commands/tasks.js +25 -11
  21. package/packages/cli/dist/commands/tasks.js.map +1 -1
  22. package/packages/cli/dist/commands/tools.js +1 -1
  23. package/packages/cli/dist/commands/tools.js.map +1 -1
  24. package/packages/cli/dist/index.js +13 -13
  25. package/packages/cli/dist/index.js.map +1 -1
  26. package/packages/cli/dist/repl.d.ts +12 -0
  27. package/packages/cli/dist/repl.d.ts.map +1 -1
  28. package/packages/cli/dist/repl.js +170 -16
  29. package/packages/cli/dist/repl.js.map +1 -1
  30. package/packages/cli/dist/tui/App.d.ts +7 -3
  31. package/packages/cli/dist/tui/App.d.ts.map +1 -1
  32. package/packages/cli/dist/tui/App.js +182 -16
  33. package/packages/cli/dist/tui/App.js.map +1 -1
  34. package/packages/cli/dist/tui/commands.d.ts +7 -0
  35. package/packages/cli/dist/tui/commands.d.ts.map +1 -1
  36. package/packages/cli/dist/tui/commands.js +70 -8
  37. package/packages/cli/dist/tui/commands.js.map +1 -1
  38. package/packages/cli/dist/tui/components/AssignmentsView.js +4 -4
  39. package/packages/cli/dist/tui/components/AssignmentsView.js.map +1 -1
  40. package/packages/cli/dist/tui/components/Banner.d.ts +11 -2
  41. package/packages/cli/dist/tui/components/Banner.d.ts.map +1 -1
  42. package/packages/cli/dist/tui/components/Banner.js +7 -10
  43. package/packages/cli/dist/tui/components/Banner.js.map +1 -1
  44. package/packages/cli/dist/tui/components/CodeBlock.js +2 -2
  45. package/packages/cli/dist/tui/components/CodeBlock.js.map +1 -1
  46. package/packages/cli/dist/tui/components/InputBox.d.ts.map +1 -1
  47. package/packages/cli/dist/tui/components/InputBox.js +4 -4
  48. package/packages/cli/dist/tui/components/InputBox.js.map +1 -1
  49. package/packages/cli/dist/tui/components/Logo.d.ts +56 -0
  50. package/packages/cli/dist/tui/components/Logo.d.ts.map +1 -0
  51. package/packages/cli/dist/tui/components/Logo.js +50 -0
  52. package/packages/cli/dist/tui/components/Logo.js.map +1 -0
  53. package/packages/cli/dist/tui/components/Markdown.js +8 -8
  54. package/packages/cli/dist/tui/components/Markdown.js.map +1 -1
  55. package/packages/cli/dist/tui/components/Message.d.ts +1 -1
  56. package/packages/cli/dist/tui/components/Message.d.ts.map +1 -1
  57. package/packages/cli/dist/tui/components/Message.js +5 -4
  58. package/packages/cli/dist/tui/components/Message.js.map +1 -1
  59. package/packages/cli/dist/tui/components/QuestionView.d.ts +29 -0
  60. package/packages/cli/dist/tui/components/QuestionView.d.ts.map +1 -0
  61. package/packages/cli/dist/tui/components/QuestionView.js +53 -0
  62. package/packages/cli/dist/tui/components/QuestionView.js.map +1 -0
  63. package/packages/cli/dist/tui/components/SlashPalette.d.ts +5 -2
  64. package/packages/cli/dist/tui/components/SlashPalette.d.ts.map +1 -1
  65. package/packages/cli/dist/tui/components/SlashPalette.js +2 -2
  66. package/packages/cli/dist/tui/components/SlashPalette.js.map +1 -1
  67. package/packages/cli/dist/tui/components/StatusLine.d.ts +0 -2
  68. package/packages/cli/dist/tui/components/StatusLine.d.ts.map +1 -1
  69. package/packages/cli/dist/tui/components/StatusLine.js +8 -5
  70. package/packages/cli/dist/tui/components/StatusLine.js.map +1 -1
  71. package/packages/cli/dist/tui/components/ToolGroup.js +2 -2
  72. package/packages/cli/dist/tui/components/ToolGroup.js.map +1 -1
  73. package/packages/cli/dist/tui/components/WatchView.d.ts +21 -0
  74. package/packages/cli/dist/tui/components/WatchView.d.ts.map +1 -0
  75. package/packages/cli/dist/tui/components/WatchView.js +36 -0
  76. package/packages/cli/dist/tui/components/WatchView.js.map +1 -0
  77. package/packages/cli/dist/tui/history.d.ts +20 -0
  78. package/packages/cli/dist/tui/history.d.ts.map +1 -0
  79. package/packages/cli/dist/tui/history.js +105 -0
  80. package/packages/cli/dist/tui/history.js.map +1 -0
  81. package/packages/cli/dist/tui/hooks/useSlash.d.ts.map +1 -1
  82. package/packages/cli/dist/tui/hooks/useSlash.js +3 -2
  83. package/packages/cli/dist/tui/hooks/useSlash.js.map +1 -1
  84. package/packages/cli/dist/tui/hooks/useTurn.d.ts +58 -1
  85. package/packages/cli/dist/tui/hooks/useTurn.d.ts.map +1 -1
  86. package/packages/cli/dist/tui/hooks/useTurn.js +214 -36
  87. package/packages/cli/dist/tui/hooks/useTurn.js.map +1 -1
  88. package/packages/cli/dist/tui/hooks/useWatch.d.ts +52 -0
  89. package/packages/cli/dist/tui/hooks/useWatch.d.ts.map +1 -0
  90. package/packages/cli/dist/tui/hooks/useWatch.js +145 -0
  91. package/packages/cli/dist/tui/hooks/useWatch.js.map +1 -0
  92. package/packages/cli/dist/tui/inkTheme.d.ts +19 -0
  93. package/packages/cli/dist/tui/inkTheme.d.ts.map +1 -0
  94. package/packages/cli/dist/tui/inkTheme.js +81 -0
  95. package/packages/cli/dist/tui/inkTheme.js.map +1 -0
  96. package/packages/cli/dist/tui/theme.d.ts +39 -29
  97. package/packages/cli/dist/tui/theme.d.ts.map +1 -1
  98. package/packages/cli/dist/tui/theme.js +35 -25
  99. package/packages/cli/dist/tui/theme.js.map +1 -1
  100. package/packages/cli/dist/tui/types.d.ts +56 -3
  101. package/packages/cli/dist/tui/types.d.ts.map +1 -1
  102. package/packages/cli/dist/tui/types.js +85 -0
  103. package/packages/cli/dist/tui/types.js.map +1 -1
  104. package/packages/cli/dist/ui/modelNames.d.ts +51 -0
  105. package/packages/cli/dist/ui/modelNames.d.ts.map +1 -0
  106. package/packages/cli/dist/ui/modelNames.js +134 -0
  107. package/packages/cli/dist/ui/modelNames.js.map +1 -0
  108. package/packages/cli/dist/ui/render.d.ts.map +1 -1
  109. package/packages/cli/dist/ui/render.js +17 -8
  110. package/packages/cli/dist/ui/render.js.map +1 -1
  111. package/packages/cli/dist/ui/speech.js +5 -0
  112. package/packages/cli/dist/ui/speech.js.map +1 -1
  113. package/packages/cli/dist/ui/theme.d.ts +33 -9
  114. package/packages/cli/dist/ui/theme.d.ts.map +1 -1
  115. package/packages/cli/dist/ui/theme.js +33 -9
  116. package/packages/cli/dist/ui/theme.js.map +1 -1
  117. package/packages/cli/package.json +1 -1
  118. package/packages/core/dist/agents/persona.d.ts.map +1 -1
  119. package/packages/core/dist/agents/persona.js +5 -2
  120. package/packages/core/dist/agents/persona.js.map +1 -1
  121. package/packages/core/dist/computer/accessibility.d.ts +78 -0
  122. package/packages/core/dist/computer/accessibility.d.ts.map +1 -0
  123. package/packages/core/dist/computer/accessibility.js +270 -0
  124. package/packages/core/dist/computer/accessibility.js.map +1 -0
  125. package/packages/core/dist/computer/assemblies.d.ts +17 -0
  126. package/packages/core/dist/computer/assemblies.d.ts.map +1 -0
  127. package/packages/core/dist/computer/assemblies.js +55 -0
  128. package/packages/core/dist/computer/assemblies.js.map +1 -0
  129. package/packages/core/dist/computer/browser-init.d.ts +9 -0
  130. package/packages/core/dist/computer/browser-init.d.ts.map +1 -0
  131. package/packages/core/dist/computer/browser-init.js +133 -0
  132. package/packages/core/dist/computer/browser-init.js.map +1 -0
  133. package/packages/core/dist/computer/cursor.d.ts +30 -0
  134. package/packages/core/dist/computer/cursor.d.ts.map +1 -0
  135. package/packages/core/dist/computer/cursor.js +30 -0
  136. package/packages/core/dist/computer/cursor.js.map +1 -0
  137. package/packages/core/dist/computer/mcp-server.js +524 -82
  138. package/packages/core/dist/computer/mcp-server.js.map +1 -1
  139. package/packages/core/dist/computer/powershell.d.ts +4 -0
  140. package/packages/core/dist/computer/powershell.d.ts.map +1 -1
  141. package/packages/core/dist/computer/powershell.js +471 -81
  142. package/packages/core/dist/computer/powershell.js.map +1 -1
  143. package/packages/core/dist/computer/screen-text.d.ts +82 -0
  144. package/packages/core/dist/computer/screen-text.d.ts.map +1 -0
  145. package/packages/core/dist/computer/screen-text.js +243 -0
  146. package/packages/core/dist/computer/screen-text.js.map +1 -0
  147. package/packages/core/dist/computer/sketch.d.ts +66 -0
  148. package/packages/core/dist/computer/sketch.d.ts.map +1 -0
  149. package/packages/core/dist/computer/sketch.js +540 -0
  150. package/packages/core/dist/computer/sketch.js.map +1 -0
  151. package/packages/core/dist/computer/tools.d.ts +8 -8
  152. package/packages/core/dist/computer/tools.d.ts.map +1 -1
  153. package/packages/core/dist/computer/tools.js +186 -31
  154. package/packages/core/dist/computer/tools.js.map +1 -1
  155. package/packages/core/dist/computer/validation.d.ts +555 -0
  156. package/packages/core/dist/computer/validation.d.ts.map +1 -0
  157. package/packages/core/dist/computer/validation.js +111 -0
  158. package/packages/core/dist/computer/validation.js.map +1 -0
  159. package/packages/core/dist/computer/windows-cursor.d.ts +14 -0
  160. package/packages/core/dist/computer/windows-cursor.d.ts.map +1 -0
  161. package/packages/core/dist/computer/windows-cursor.js +713 -0
  162. package/packages/core/dist/computer/windows-cursor.js.map +1 -0
  163. package/packages/core/dist/config.d.ts +34 -1
  164. package/packages/core/dist/config.d.ts.map +1 -1
  165. package/packages/core/dist/config.js +362 -11
  166. package/packages/core/dist/config.js.map +1 -1
  167. package/packages/core/dist/cron/scheduler.d.ts +59 -6
  168. package/packages/core/dist/cron/scheduler.d.ts.map +1 -1
  169. package/packages/core/dist/cron/scheduler.js +295 -27
  170. package/packages/core/dist/cron/scheduler.js.map +1 -1
  171. package/packages/core/dist/cron/store.d.ts +19 -1
  172. package/packages/core/dist/cron/store.d.ts.map +1 -1
  173. package/packages/core/dist/cron/store.js +36 -8
  174. package/packages/core/dist/cron/store.js.map +1 -1
  175. package/packages/core/dist/external/claude-code.d.ts +4 -0
  176. package/packages/core/dist/external/claude-code.d.ts.map +1 -0
  177. package/packages/core/dist/external/claude-code.js +111 -0
  178. package/packages/core/dist/external/claude-code.js.map +1 -0
  179. package/packages/core/dist/external/discovery.d.ts +33 -0
  180. package/packages/core/dist/external/discovery.d.ts.map +1 -0
  181. package/packages/core/dist/external/discovery.js +144 -0
  182. package/packages/core/dist/external/discovery.js.map +1 -0
  183. package/packages/core/dist/external/homes.d.ts +26 -0
  184. package/packages/core/dist/external/homes.d.ts.map +1 -0
  185. package/packages/core/dist/external/homes.js +49 -0
  186. package/packages/core/dist/external/homes.js.map +1 -0
  187. package/packages/core/dist/external/shared.d.ts +201 -0
  188. package/packages/core/dist/external/shared.d.ts.map +1 -0
  189. package/packages/core/dist/external/shared.js +308 -0
  190. package/packages/core/dist/external/shared.js.map +1 -0
  191. package/packages/core/dist/gateway/policy.d.ts +117 -2
  192. package/packages/core/dist/gateway/policy.d.ts.map +1 -1
  193. package/packages/core/dist/gateway/policy.js +286 -6
  194. package/packages/core/dist/gateway/policy.js.map +1 -1
  195. package/packages/core/dist/index.d.ts +38 -12
  196. package/packages/core/dist/index.d.ts.map +1 -1
  197. package/packages/core/dist/index.js +66 -12
  198. package/packages/core/dist/index.js.map +1 -1
  199. package/packages/core/dist/memory/db.d.ts +1 -1
  200. package/packages/core/dist/memory/db.d.ts.map +1 -1
  201. package/packages/core/dist/memory/db.js +878 -1
  202. package/packages/core/dist/memory/db.js.map +1 -1
  203. package/packages/core/dist/memory/dream/admission.d.ts +124 -0
  204. package/packages/core/dist/memory/dream/admission.d.ts.map +1 -0
  205. package/packages/core/dist/memory/dream/admission.js +116 -0
  206. package/packages/core/dist/memory/dream/admission.js.map +1 -0
  207. package/packages/core/dist/memory/dream/candidate.d.ts +152 -0
  208. package/packages/core/dist/memory/dream/candidate.d.ts.map +1 -0
  209. package/packages/core/dist/memory/dream/candidate.js +547 -0
  210. package/packages/core/dist/memory/dream/candidate.js.map +1 -0
  211. package/packages/core/dist/memory/dream/evaluate.d.ts +394 -0
  212. package/packages/core/dist/memory/dream/evaluate.d.ts.map +1 -0
  213. package/packages/core/dist/memory/dream/evaluate.js +1032 -0
  214. package/packages/core/dist/memory/dream/evaluate.js.map +1 -0
  215. package/packages/core/dist/memory/dream/frame.d.ts +61 -0
  216. package/packages/core/dist/memory/dream/frame.d.ts.map +1 -0
  217. package/packages/core/dist/memory/dream/frame.js +292 -0
  218. package/packages/core/dist/memory/dream/frame.js.map +1 -0
  219. package/packages/core/dist/memory/dream/label.d.ts +370 -0
  220. package/packages/core/dist/memory/dream/label.d.ts.map +1 -0
  221. package/packages/core/dist/memory/dream/label.js +439 -0
  222. package/packages/core/dist/memory/dream/label.js.map +1 -0
  223. package/packages/core/dist/memory/dream/measure.d.ts +114 -0
  224. package/packages/core/dist/memory/dream/measure.d.ts.map +1 -0
  225. package/packages/core/dist/memory/dream/measure.js +205 -0
  226. package/packages/core/dist/memory/dream/measure.js.map +1 -0
  227. package/packages/core/dist/memory/dream/policy.d.ts +21 -0
  228. package/packages/core/dist/memory/dream/policy.d.ts.map +1 -0
  229. package/packages/core/dist/memory/dream/policy.js +157 -0
  230. package/packages/core/dist/memory/dream/policy.js.map +1 -0
  231. package/packages/core/dist/memory/dream/probe.d.ts +202 -0
  232. package/packages/core/dist/memory/dream/probe.d.ts.map +1 -0
  233. package/packages/core/dist/memory/dream/probe.js +671 -0
  234. package/packages/core/dist/memory/dream/probe.js.map +1 -0
  235. package/packages/core/dist/memory/dream/promote.d.ts +312 -0
  236. package/packages/core/dist/memory/dream/promote.d.ts.map +1 -0
  237. package/packages/core/dist/memory/dream/promote.js +528 -0
  238. package/packages/core/dist/memory/dream/promote.js.map +1 -0
  239. package/packages/core/dist/memory/dream/score.d.ts +103 -0
  240. package/packages/core/dist/memory/dream/score.d.ts.map +1 -0
  241. package/packages/core/dist/memory/dream/score.js +334 -0
  242. package/packages/core/dist/memory/dream/score.js.map +1 -0
  243. package/packages/core/dist/memory/dream/slots.d.ts +193 -0
  244. package/packages/core/dist/memory/dream/slots.d.ts.map +1 -0
  245. package/packages/core/dist/memory/dream/slots.js +0 -0
  246. package/packages/core/dist/memory/dream/slots.js.map +1 -0
  247. package/packages/core/dist/memory/dream/trajectory.d.ts +262 -0
  248. package/packages/core/dist/memory/dream/trajectory.d.ts.map +1 -0
  249. package/packages/core/dist/memory/dream/trajectory.js +366 -0
  250. package/packages/core/dist/memory/dream/trajectory.js.map +1 -0
  251. package/packages/core/dist/memory/extractor.d.ts +7 -0
  252. package/packages/core/dist/memory/extractor.d.ts.map +1 -1
  253. package/packages/core/dist/memory/extractor.js +35 -12
  254. package/packages/core/dist/memory/extractor.js.map +1 -1
  255. package/packages/core/dist/memory/gate.d.ts +43 -7
  256. package/packages/core/dist/memory/gate.d.ts.map +1 -1
  257. package/packages/core/dist/memory/gate.js +91 -4
  258. package/packages/core/dist/memory/gate.js.map +1 -1
  259. package/packages/core/dist/memory/recall.d.ts +57 -0
  260. package/packages/core/dist/memory/recall.d.ts.map +1 -1
  261. package/packages/core/dist/memory/recall.js +60 -123
  262. package/packages/core/dist/memory/recall.js.map +1 -1
  263. package/packages/core/dist/memory/sleep.d.ts +131 -4
  264. package/packages/core/dist/memory/sleep.d.ts.map +1 -1
  265. package/packages/core/dist/memory/sleep.js +2384 -65
  266. package/packages/core/dist/memory/sleep.js.map +1 -1
  267. package/packages/core/dist/memory/store.d.ts +564 -10
  268. package/packages/core/dist/memory/store.d.ts.map +1 -1
  269. package/packages/core/dist/memory/store.js +1673 -102
  270. package/packages/core/dist/memory/store.js.map +1 -1
  271. package/packages/core/dist/org/controller.d.ts +268 -4
  272. package/packages/core/dist/org/controller.d.ts.map +1 -1
  273. package/packages/core/dist/org/controller.js +2298 -248
  274. package/packages/core/dist/org/controller.js.map +1 -1
  275. package/packages/core/dist/org/ponytail.d.ts +1 -1
  276. package/packages/core/dist/org/ponytail.js +1 -1
  277. package/packages/core/dist/org/project-mcp.d.ts +3 -3
  278. package/packages/core/dist/org/prompts.d.ts +44 -30
  279. package/packages/core/dist/org/prompts.d.ts.map +1 -1
  280. package/packages/core/dist/org/prompts.js +209 -92
  281. package/packages/core/dist/org/prompts.js.map +1 -1
  282. package/packages/core/dist/org/questions.d.ts +104 -0
  283. package/packages/core/dist/org/questions.d.ts.map +1 -0
  284. package/packages/core/dist/org/questions.js +136 -0
  285. package/packages/core/dist/org/questions.js.map +1 -0
  286. package/packages/core/dist/org/review.d.ts +100 -0
  287. package/packages/core/dist/org/review.d.ts.map +1 -0
  288. package/packages/core/dist/org/review.js +256 -0
  289. package/packages/core/dist/org/review.js.map +1 -0
  290. package/packages/core/dist/org/store.d.ts +311 -2
  291. package/packages/core/dist/org/store.d.ts.map +1 -1
  292. package/packages/core/dist/org/store.js +981 -13
  293. package/packages/core/dist/org/store.js.map +1 -1
  294. package/packages/core/dist/org/tools.d.ts +33 -3
  295. package/packages/core/dist/org/tools.d.ts.map +1 -1
  296. package/packages/core/dist/org/tools.js +380 -67
  297. package/packages/core/dist/org/tools.js.map +1 -1
  298. package/packages/core/dist/providers/catalogue.d.ts +1 -1
  299. package/packages/core/dist/providers/catalogue.d.ts.map +1 -1
  300. package/packages/core/dist/providers/catalogue.js +2 -2
  301. package/packages/core/dist/providers/catalogue.js.map +1 -1
  302. package/packages/core/dist/providers/claude-code.d.ts +19 -3
  303. package/packages/core/dist/providers/claude-code.d.ts.map +1 -1
  304. package/packages/core/dist/providers/claude-code.js +501 -40
  305. package/packages/core/dist/providers/claude-code.js.map +1 -1
  306. package/packages/core/dist/providers/claude-tui.d.ts +288 -0
  307. package/packages/core/dist/providers/claude-tui.d.ts.map +1 -0
  308. package/packages/core/dist/providers/claude-tui.js +1118 -0
  309. package/packages/core/dist/providers/claude-tui.js.map +1 -0
  310. package/packages/core/dist/providers/codex-auth.d.ts +15 -0
  311. package/packages/core/dist/providers/codex-auth.d.ts.map +1 -0
  312. package/packages/core/dist/providers/codex-auth.js +127 -0
  313. package/packages/core/dist/providers/codex-auth.js.map +1 -0
  314. package/packages/core/dist/providers/codex-bridge.d.ts +58 -0
  315. package/packages/core/dist/providers/codex-bridge.d.ts.map +1 -0
  316. package/packages/core/dist/providers/codex-bridge.js +375 -0
  317. package/packages/core/dist/providers/codex-bridge.js.map +1 -0
  318. package/packages/core/dist/providers/codex-translate.d.ts +75 -0
  319. package/packages/core/dist/providers/codex-translate.d.ts.map +1 -0
  320. package/packages/core/dist/providers/codex-translate.js +383 -0
  321. package/packages/core/dist/providers/codex-translate.js.map +1 -0
  322. package/packages/core/dist/providers/model-gateway.d.ts +56 -0
  323. package/packages/core/dist/providers/model-gateway.d.ts.map +1 -0
  324. package/packages/core/dist/providers/model-gateway.js +119 -0
  325. package/packages/core/dist/providers/model-gateway.js.map +1 -0
  326. package/packages/core/dist/providers/process.d.ts +3 -1
  327. package/packages/core/dist/providers/process.d.ts.map +1 -1
  328. package/packages/core/dist/providers/process.js +3 -3
  329. package/packages/core/dist/providers/process.js.map +1 -1
  330. package/packages/core/dist/providers/profiles.d.ts +11 -0
  331. package/packages/core/dist/providers/profiles.d.ts.map +1 -0
  332. package/packages/core/dist/providers/profiles.js +28 -0
  333. package/packages/core/dist/providers/profiles.js.map +1 -0
  334. package/packages/core/dist/providers/provider-catalog.d.ts +72 -0
  335. package/packages/core/dist/providers/provider-catalog.d.ts.map +1 -0
  336. package/packages/core/dist/providers/provider-catalog.js +144 -0
  337. package/packages/core/dist/providers/provider-catalog.js.map +1 -0
  338. package/packages/core/dist/providers/quota.d.ts +40 -1
  339. package/packages/core/dist/providers/quota.d.ts.map +1 -1
  340. package/packages/core/dist/providers/quota.js +288 -25
  341. package/packages/core/dist/providers/quota.js.map +1 -1
  342. package/packages/core/dist/providers/registry.d.ts +46 -3
  343. package/packages/core/dist/providers/registry.d.ts.map +1 -1
  344. package/packages/core/dist/providers/registry.js +148 -13
  345. package/packages/core/dist/providers/registry.js.map +1 -1
  346. package/packages/core/dist/providers/router.d.ts +28 -0
  347. package/packages/core/dist/providers/router.d.ts.map +1 -0
  348. package/packages/core/dist/providers/router.js +88 -0
  349. package/packages/core/dist/providers/router.js.map +1 -0
  350. package/packages/core/dist/providers/user-settings-guard.d.ts +12 -0
  351. package/packages/core/dist/providers/user-settings-guard.d.ts.map +1 -0
  352. package/packages/core/dist/providers/user-settings-guard.js +130 -0
  353. package/packages/core/dist/providers/user-settings-guard.js.map +1 -0
  354. package/packages/core/dist/runtime.d.ts +193 -7
  355. package/packages/core/dist/runtime.d.ts.map +1 -1
  356. package/packages/core/dist/runtime.js +1676 -219
  357. package/packages/core/dist/runtime.js.map +1 -1
  358. package/packages/core/dist/skills/builtin.d.ts +34 -0
  359. package/packages/core/dist/skills/builtin.d.ts.map +1 -0
  360. package/packages/core/dist/skills/builtin.js +305 -0
  361. package/packages/core/dist/skills/builtin.js.map +1 -0
  362. package/packages/core/dist/skills/shelf.d.ts +30 -0
  363. package/packages/core/dist/skills/shelf.d.ts.map +1 -0
  364. package/packages/core/dist/skills/shelf.js +159 -0
  365. package/packages/core/dist/skills/shelf.js.map +1 -0
  366. package/packages/core/dist/skills/store.d.ts +66 -4
  367. package/packages/core/dist/skills/store.d.ts.map +1 -1
  368. package/packages/core/dist/skills/store.js +105 -18
  369. package/packages/core/dist/skills/store.js.map +1 -1
  370. package/packages/core/dist/skills/suggest.d.ts +21 -0
  371. package/packages/core/dist/skills/suggest.d.ts.map +1 -0
  372. package/packages/core/dist/skills/suggest.js +150 -0
  373. package/packages/core/dist/skills/suggest.js.map +1 -0
  374. package/packages/core/dist/tools/catalog.d.ts +1 -3
  375. package/packages/core/dist/tools/catalog.d.ts.map +1 -1
  376. package/packages/core/dist/tools/catalog.js +38 -26
  377. package/packages/core/dist/tools/catalog.js.map +1 -1
  378. package/packages/core/dist/tools/hub.d.ts +136 -10
  379. package/packages/core/dist/tools/hub.d.ts.map +1 -1
  380. package/packages/core/dist/tools/hub.js +418 -24
  381. package/packages/core/dist/tools/hub.js.map +1 -1
  382. package/packages/core/dist/turns/journal.d.ts +78 -0
  383. package/packages/core/dist/turns/journal.d.ts.map +1 -0
  384. package/packages/core/dist/turns/journal.js +104 -0
  385. package/packages/core/dist/turns/journal.js.map +1 -0
  386. package/packages/core/dist/types.d.ts +1776 -12
  387. package/packages/core/dist/types.d.ts.map +1 -1
  388. package/packages/core/dist/types.js.map +1 -1
  389. package/packages/core/dist/util/blocks.d.ts +41 -0
  390. package/packages/core/dist/util/blocks.d.ts.map +1 -0
  391. package/packages/core/dist/util/blocks.js +175 -0
  392. package/packages/core/dist/util/blocks.js.map +1 -0
  393. package/packages/core/dist/util/queue.d.ts +12 -0
  394. package/packages/core/dist/util/queue.d.ts.map +1 -1
  395. package/packages/core/dist/util/queue.js +16 -0
  396. package/packages/core/dist/util/queue.js.map +1 -1
  397. package/packages/core/dist/util/time.d.ts +39 -0
  398. package/packages/core/dist/util/time.d.ts.map +1 -0
  399. package/packages/core/dist/util/time.js +71 -0
  400. package/packages/core/dist/util/time.js.map +1 -0
  401. package/packages/core/package.json +1 -1
  402. package/packages/server/dist/auth.d.ts +14 -1
  403. package/packages/server/dist/auth.d.ts.map +1 -1
  404. package/packages/server/dist/auth.js +19 -0
  405. package/packages/server/dist/auth.js.map +1 -1
  406. package/packages/server/dist/context.d.ts +35 -1
  407. package/packages/server/dist/context.d.ts.map +1 -1
  408. package/packages/server/dist/context.js +39 -10
  409. package/packages/server/dist/context.js.map +1 -1
  410. package/packages/server/dist/gateways/attachments.d.ts +32 -0
  411. package/packages/server/dist/gateways/attachments.d.ts.map +1 -0
  412. package/packages/server/dist/gateways/attachments.js +167 -0
  413. package/packages/server/dist/gateways/attachments.js.map +1 -0
  414. package/packages/server/dist/gateways/markdown.d.ts +9 -0
  415. package/packages/server/dist/gateways/markdown.d.ts.map +1 -0
  416. package/packages/server/dist/gateways/markdown.js +170 -0
  417. package/packages/server/dist/gateways/markdown.js.map +1 -0
  418. package/packages/server/dist/gateways/push.d.ts +1 -1
  419. package/packages/server/dist/gateways/push.d.ts.map +1 -1
  420. package/packages/server/dist/gateways/push.js +420 -13
  421. package/packages/server/dist/gateways/push.js.map +1 -1
  422. package/packages/server/dist/gateways/telegram-api.d.ts +70 -1
  423. package/packages/server/dist/gateways/telegram-api.d.ts.map +1 -1
  424. package/packages/server/dist/gateways/telegram-api.js +140 -1
  425. package/packages/server/dist/gateways/telegram-api.js.map +1 -1
  426. package/packages/server/dist/gateways/telegram.d.ts +181 -1
  427. package/packages/server/dist/gateways/telegram.d.ts.map +1 -1
  428. package/packages/server/dist/gateways/telegram.js +1572 -78
  429. package/packages/server/dist/gateways/telegram.js.map +1 -1
  430. package/packages/server/dist/gateways/threads.d.ts +84 -0
  431. package/packages/server/dist/gateways/threads.d.ts.map +1 -0
  432. package/packages/server/dist/gateways/threads.js +289 -0
  433. package/packages/server/dist/gateways/threads.js.map +1 -0
  434. package/packages/server/dist/index.d.ts +2 -1
  435. package/packages/server/dist/index.d.ts.map +1 -1
  436. package/packages/server/dist/index.js +2 -1
  437. package/packages/server/dist/index.js.map +1 -1
  438. package/packages/server/dist/listeners/imap.d.ts +13 -0
  439. package/packages/server/dist/listeners/imap.d.ts.map +1 -0
  440. package/packages/server/dist/listeners/imap.js +0 -0
  441. package/packages/server/dist/listeners/imap.js.map +1 -0
  442. package/packages/server/dist/listeners/registry.d.ts +18 -0
  443. package/packages/server/dist/listeners/registry.d.ts.map +1 -0
  444. package/packages/server/dist/listeners/registry.js +88 -0
  445. package/packages/server/dist/listeners/registry.js.map +1 -0
  446. package/packages/server/dist/listeners/types.d.ts +55 -0
  447. package/packages/server/dist/listeners/types.d.ts.map +1 -0
  448. package/packages/server/dist/listeners/types.js +2 -0
  449. package/packages/server/dist/listeners/types.js.map +1 -0
  450. package/packages/server/dist/main.js +15 -1
  451. package/packages/server/dist/main.js.map +1 -1
  452. package/packages/server/dist/routes/chat.d.ts +7 -3
  453. package/packages/server/dist/routes/chat.d.ts.map +1 -1
  454. package/packages/server/dist/routes/chat.js +8 -17
  455. package/packages/server/dist/routes/chat.js.map +1 -1
  456. package/packages/server/dist/routes/config.d.ts.map +1 -1
  457. package/packages/server/dist/routes/config.js +66 -7
  458. package/packages/server/dist/routes/config.js.map +1 -1
  459. package/packages/server/dist/routes/cron.d.ts.map +1 -1
  460. package/packages/server/dist/routes/cron.js +65 -8
  461. package/packages/server/dist/routes/cron.js.map +1 -1
  462. package/packages/server/dist/routes/dream.d.ts +22 -0
  463. package/packages/server/dist/routes/dream.d.ts.map +1 -0
  464. package/packages/server/dist/routes/dream.js +152 -0
  465. package/packages/server/dist/routes/dream.js.map +1 -0
  466. package/packages/server/dist/routes/hooks.d.ts +18 -0
  467. package/packages/server/dist/routes/hooks.d.ts.map +1 -0
  468. package/packages/server/dist/routes/hooks.js +62 -0
  469. package/packages/server/dist/routes/hooks.js.map +1 -0
  470. package/packages/server/dist/routes/listeners.d.ts +10 -0
  471. package/packages/server/dist/routes/listeners.d.ts.map +1 -0
  472. package/packages/server/dist/routes/listeners.js +12 -0
  473. package/packages/server/dist/routes/listeners.js.map +1 -0
  474. package/packages/server/dist/routes/memories.d.ts.map +1 -1
  475. package/packages/server/dist/routes/memories.js +55 -3
  476. package/packages/server/dist/routes/memories.js.map +1 -1
  477. package/packages/server/dist/routes/org.d.ts.map +1 -1
  478. package/packages/server/dist/routes/org.js +289 -49
  479. package/packages/server/dist/routes/org.js.map +1 -1
  480. package/packages/server/dist/routes/profile.d.ts.map +1 -1
  481. package/packages/server/dist/routes/profile.js +6 -3
  482. package/packages/server/dist/routes/profile.js.map +1 -1
  483. package/packages/server/dist/routes/providers.d.ts.map +1 -1
  484. package/packages/server/dist/routes/providers.js +66 -7
  485. package/packages/server/dist/routes/providers.js.map +1 -1
  486. package/packages/server/dist/routes/questions.d.ts +45 -0
  487. package/packages/server/dist/routes/questions.d.ts.map +1 -0
  488. package/packages/server/dist/routes/questions.js +73 -0
  489. package/packages/server/dist/routes/questions.js.map +1 -0
  490. package/packages/server/dist/routes/sessions.d.ts.map +1 -1
  491. package/packages/server/dist/routes/sessions.js +26 -6
  492. package/packages/server/dist/routes/sessions.js.map +1 -1
  493. package/packages/server/dist/routes/sleep.d.ts.map +1 -1
  494. package/packages/server/dist/routes/sleep.js +71 -2
  495. package/packages/server/dist/routes/sleep.js.map +1 -1
  496. package/packages/server/dist/routes/terminals.d.ts +25 -0
  497. package/packages/server/dist/routes/terminals.d.ts.map +1 -0
  498. package/packages/server/dist/routes/terminals.js +35 -0
  499. package/packages/server/dist/routes/terminals.js.map +1 -0
  500. package/packages/server/dist/routes/tools.d.ts.map +1 -1
  501. package/packages/server/dist/routes/tools.js +140 -6
  502. package/packages/server/dist/routes/tools.js.map +1 -1
  503. package/packages/server/dist/routes/updates.d.ts +10 -0
  504. package/packages/server/dist/routes/updates.d.ts.map +1 -0
  505. package/packages/server/dist/routes/updates.js +22 -0
  506. package/packages/server/dist/routes/updates.js.map +1 -0
  507. package/packages/server/dist/routes/ws.d.ts +11 -5
  508. package/packages/server/dist/routes/ws.d.ts.map +1 -1
  509. package/packages/server/dist/routes/ws.js +168 -28
  510. package/packages/server/dist/routes/ws.js.map +1 -1
  511. package/packages/server/dist/schemas.d.ts +1177 -215
  512. package/packages/server/dist/schemas.d.ts.map +1 -1
  513. package/packages/server/dist/schemas.js +317 -12
  514. package/packages/server/dist/schemas.js.map +1 -1
  515. package/packages/server/dist/server.d.ts +7 -1
  516. package/packages/server/dist/server.d.ts.map +1 -1
  517. package/packages/server/dist/server.js +210 -3
  518. package/packages/server/dist/server.js.map +1 -1
  519. package/packages/server/dist/services/stream.d.ts +94 -5
  520. package/packages/server/dist/services/stream.d.ts.map +1 -1
  521. package/packages/server/dist/services/stream.js +9 -20
  522. package/packages/server/dist/services/stream.js.map +1 -1
  523. package/packages/server/dist/services/stt.d.ts +65 -0
  524. package/packages/server/dist/services/stt.d.ts.map +1 -0
  525. package/packages/server/dist/services/stt.js +306 -0
  526. package/packages/server/dist/services/stt.js.map +1 -0
  527. package/packages/server/dist/services/turns.d.ts +54 -0
  528. package/packages/server/dist/services/turns.d.ts.map +1 -0
  529. package/packages/server/dist/services/turns.js +186 -0
  530. package/packages/server/dist/services/turns.js.map +1 -0
  531. package/packages/server/dist/services/updates.d.ts +99 -0
  532. package/packages/server/dist/services/updates.d.ts.map +1 -0
  533. package/packages/server/dist/services/updates.js +316 -0
  534. package/packages/server/dist/services/updates.js.map +1 -0
  535. package/packages/server/package.json +1 -1
  536. package/packages/web/dist/app-icon.svg +2 -0
  537. package/packages/web/dist/apple-touch-icon.png +0 -0
  538. package/packages/web/dist/assets/abnfDiagram-O67JEVCF-D7YyFndQ.js +1 -0
  539. package/packages/web/dist/assets/arc-C_Zgk2dJ.js +1 -0
  540. package/packages/web/dist/assets/architectureDiagram-NJMV4G6O-eI0adu1B.js +36 -0
  541. package/packages/web/dist/assets/blockDiagram-BEXU5L5S-WAoOFUA9.js +140 -0
  542. package/packages/web/dist/assets/c4Diagram-YGBWAQC7-DE8Zyhng.js +38 -0
  543. package/packages/web/dist/assets/channel-egZxcyUK.js +1 -0
  544. package/packages/web/dist/assets/chunk-2Q5K7J3B-bnqLP2XD.js +1 -0
  545. package/packages/web/dist/assets/chunk-3FUC2YCW-Ck1_SVe0.js +2 -0
  546. package/packages/web/dist/assets/chunk-5VM5RSS4-hDmC41gD.js +15 -0
  547. package/packages/web/dist/assets/chunk-GTNCS2PH-PoWvfCrT.js +88 -0
  548. package/packages/web/dist/assets/chunk-GWA4HPMP-D3V0IG43.js +1 -0
  549. package/packages/web/dist/assets/chunk-JWPE2WC7-BryfpHM5.js +1 -0
  550. package/packages/web/dist/assets/chunk-NETBCI7D-8ic1iEdT.js +1 -0
  551. package/packages/web/dist/assets/chunk-WEXAMYUT-nM8tmQT2.js +1 -0
  552. package/packages/web/dist/assets/chunk-XXDRQBXY-Do28F482.js +1 -0
  553. package/packages/web/dist/assets/classDiagram-v2-NBCMYWYE-Bop9oNNO.js +217 -0
  554. package/packages/web/dist/assets/cose-bilkent-JH36ORCC-a7f_bpnt.js +1 -0
  555. package/packages/web/dist/assets/cynefin-OW5HDTMX-DnArcis_.js +178 -0
  556. package/packages/web/dist/assets/cynefinDiagram-VND7K2PF-vEuTb1GD.js +62 -0
  557. package/packages/web/dist/assets/cytoscape.esm-Ix0LnXOy.js +331 -0
  558. package/packages/web/dist/assets/dagre-6A5THRUB-BgG4MynJ.js +4 -0
  559. package/packages/web/dist/assets/diagram-22UHCM2B-DRCQpafv.js +200 -0
  560. package/packages/web/dist/assets/diagram-3UASUU5V-BKgmAXde.js +24 -0
  561. package/packages/web/dist/assets/diagram-ATOU4E4O-B6Hsy36X.js +3 -0
  562. package/packages/web/dist/assets/diagram-CDSNMT55-JflyfyoB.js +30 -0
  563. package/packages/web/dist/assets/diagram-MLGK6HIB-Dd2QPJjT.js +24 -0
  564. package/packages/web/dist/assets/diagram-MPIPVDR6-DE5QU60x.js +41 -0
  565. package/packages/web/dist/assets/draco_decoder-C32yEggz.wasm +0 -0
  566. package/packages/web/dist/assets/draco_decoder-Z1_iN-Ht.wasm +0 -0
  567. package/packages/web/dist/assets/draco_decoder-fzg4nYZr.js +34 -0
  568. package/packages/web/dist/assets/draco_wasm_wrapper-DxJM36Ib.js +117 -0
  569. package/packages/web/dist/assets/draco_wasm_wrapper-fZCQGLGb.js +116 -0
  570. package/packages/web/dist/assets/ebnfDiagram-ZINNZB2B-D7AQ741b.js +1 -0
  571. package/packages/web/dist/assets/elk-276RUBZZ-CeewBVLF.js +27 -0
  572. package/packages/web/dist/assets/erDiagram-OPXOYQCR-mLLYkZ5c.js +99 -0
  573. package/packages/web/dist/assets/flowDiagram-KWPJA3E3-DtpSpsQN.js +213 -0
  574. package/packages/web/dist/assets/ganttDiagram-FUAMR5RP-1_lh-3ky.js +292 -0
  575. package/packages/web/dist/assets/gitGraphDiagram-X574FWY7-DoPXZuT5.js +106 -0
  576. package/packages/web/dist/assets/graph-Bn3Yngep.js +1 -0
  577. package/packages/web/dist/assets/index-Cw2Opmx7.js +648 -0
  578. package/packages/web/dist/assets/index-j0zBRCgT.css +32 -0
  579. package/packages/web/dist/assets/infoDiagram-VRGFBTTK-DQpRGGiD.js +2 -0
  580. package/packages/web/dist/assets/ishikawaDiagram-OU5B5YK6-gH5C9Q2e.js +70 -0
  581. package/packages/web/dist/assets/journeyDiagram-ZHPQQLJL-Bg-oeFjb.js +139 -0
  582. package/packages/web/dist/assets/kanban-definition-PNTS6WVX-BnpI4VH8.js +89 -0
  583. package/packages/web/dist/assets/katex-C5jXJg4s.js +257 -0
  584. package/packages/web/dist/assets/mermaid.core-BwBKxlRA.js +313 -0
  585. package/packages/web/dist/assets/mindmap-definition-NLK3R4M7-NBnnxEoO.js +96 -0
  586. package/packages/web/dist/assets/pegDiagram-GJSIUBJH-RrXXbIvO.js +1 -0
  587. package/packages/web/dist/assets/pieDiagram-5QR66LMP-B27q6Gso.js +39 -0
  588. package/packages/web/dist/assets/quadrantDiagram-O4NWA36T-DGDsdur2.js +7 -0
  589. package/packages/web/dist/assets/railroadDiagram-XR7U4H2S-GdjkE3mI.js +1 -0
  590. package/packages/web/dist/assets/requirementDiagram-PLB6GJNP-DjK0GfgO.js +84 -0
  591. package/packages/web/dist/assets/sankeyDiagram-IPEJSGJF-BG_AIkwF.js +40 -0
  592. package/packages/web/dist/assets/scene-D4LPicHk.js +4620 -0
  593. package/packages/web/dist/assets/sequenceDiagram-PO4LG4MO-CIQwUb4y.js +169 -0
  594. package/packages/web/dist/assets/sizeCapture-INFHLROL-bpIoPxdJ.js +1 -0
  595. package/packages/web/dist/assets/stateDiagram-v2-GCMORJYK-8hYXvPPv.js +291 -0
  596. package/packages/web/dist/assets/swimlanes-2SLR337P-gfflUMF9.js +1 -0
  597. package/packages/web/dist/assets/swimlanesDiagram-TC7HE7FX-9wdzGXU-.js +8 -0
  598. package/packages/web/dist/assets/timeline-definition-EJHVYXUP-PHMNoGTZ.js +120 -0
  599. package/packages/web/dist/assets/usecaseDiagram-POWQR4AR-B2j5iteO.js +370 -0
  600. package/packages/web/dist/assets/vennDiagram-UO4OBE2U-BzxtZ-_2.js +34 -0
  601. package/packages/web/dist/assets/wardleyDiagram-VNRHLVJA-DL7YbMpY.js +78 -0
  602. package/packages/web/dist/assets/xychartDiagram-PMCCYNJV-CisgP1cT.js +7 -0
  603. package/packages/web/dist/draco/draco_decoder.js +33 -0
  604. package/packages/web/dist/draco/draco_decoder.wasm +0 -0
  605. package/packages/web/dist/draco/draco_wasm_wrapper.js +116 -0
  606. package/packages/web/dist/favicon-16.png +0 -0
  607. package/packages/web/dist/favicon-32.png +0 -0
  608. package/packages/web/dist/favicon-48.png +0 -0
  609. package/packages/web/dist/favicon.ico +0 -0
  610. package/packages/web/dist/favicon.svg +1 -1
  611. package/packages/web/dist/icon-192.png +0 -0
  612. package/packages/web/dist/icon-512.png +0 -0
  613. package/packages/web/dist/index.html +12 -4
  614. package/packages/web/dist/logo-light.svg +1 -1
  615. package/packages/web/dist/logo-mono.svg +2 -0
  616. package/packages/web/dist/logo-stacked-light.svg +2 -0
  617. package/packages/web/dist/logo-stacked.svg +2 -0
  618. package/packages/web/dist/logo-white.svg +2 -0
  619. package/packages/web/dist/logo.svg +1 -1
  620. package/packages/web/dist/mark-light.svg +1 -1
  621. package/packages/web/dist/mark-mono.svg +2 -0
  622. package/packages/web/dist/mark-small-light.svg +2 -0
  623. package/packages/web/dist/mark-small.svg +2 -0
  624. package/packages/web/dist/mark-white.svg +2 -0
  625. package/packages/web/dist/mark.svg +1 -1
  626. package/packages/web/dist/models/LICENSE.txt +5 -0
  627. package/packages/web/dist/models/brain.glb +0 -0
  628. package/packages/web/dist/site.webmanifest +23 -0
  629. package/packages/web/dist/wordmark-light.svg +2 -0
  630. package/packages/web/dist/wordmark.svg +2 -0
  631. package/packages/web/package.json +1 -1
  632. package/scripts/rookery.mjs +204 -122
  633. package/scripts/updater.mjs +227 -0
  634. package/packages/cli/dist/tui/components/Wordmark.d.ts +0 -35
  635. package/packages/cli/dist/tui/components/Wordmark.d.ts.map +0 -1
  636. package/packages/cli/dist/tui/components/Wordmark.js +0 -81
  637. package/packages/cli/dist/tui/components/Wordmark.js.map +0 -1
  638. package/packages/core/dist/agents/orchestrator.d.ts +0 -24
  639. package/packages/core/dist/agents/orchestrator.d.ts.map +0 -1
  640. package/packages/core/dist/agents/orchestrator.js +0 -88
  641. package/packages/core/dist/agents/orchestrator.js.map +0 -1
  642. package/packages/core/dist/agents/roles.d.ts +0 -21
  643. package/packages/core/dist/agents/roles.d.ts.map +0 -1
  644. package/packages/core/dist/agents/roles.js +0 -81
  645. package/packages/core/dist/agents/roles.js.map +0 -1
  646. package/packages/core/dist/agents/team.d.ts +0 -105
  647. package/packages/core/dist/agents/team.d.ts.map +0 -1
  648. package/packages/core/dist/agents/team.js +0 -623
  649. package/packages/core/dist/agents/team.js.map +0 -1
  650. package/packages/core/dist/providers/codex.d.ts +0 -10
  651. package/packages/core/dist/providers/codex.d.ts.map +0 -1
  652. package/packages/core/dist/providers/codex.js +0 -375
  653. package/packages/core/dist/providers/codex.js.map +0 -1
  654. package/packages/core/dist/tools/browser.d.ts +0 -20
  655. package/packages/core/dist/tools/browser.d.ts.map +0 -1
  656. package/packages/core/dist/tools/browser.js +0 -72
  657. package/packages/core/dist/tools/browser.js.map +0 -1
  658. package/packages/server/dist/routes/agents.d.ts +0 -5
  659. package/packages/server/dist/routes/agents.d.ts.map +0 -1
  660. package/packages/server/dist/routes/agents.js +0 -6
  661. package/packages/server/dist/routes/agents.js.map +0 -1
  662. package/packages/server/dist/routes/team.d.ts +0 -11
  663. package/packages/server/dist/routes/team.d.ts.map +0 -1
  664. package/packages/server/dist/routes/team.js +0 -36
  665. package/packages/server/dist/routes/team.js.map +0 -1
  666. package/packages/web/dist/assets/3d-force-graph-BPZmoydi.js +0 -1163
  667. package/packages/web/dist/assets/index-IBSTzK7-.js +0 -1255
  668. package/packages/web/dist/assets/index-qUXUui7W.css +0 -1
  669. package/packages/web/dist/assets/three-spritetext-B9ZIW7c-.js +0 -4
  670. package/packages/web/dist/assets/three.module-cmFfBtHS.js +0 -4228
@@ -5,8 +5,14 @@
5
5
  * the web UI and the provider adapters. Changing something here is a
6
6
  * cross-package change.
7
7
  */
8
- /** Which local CLI backs a turn. Auth comes from the CLI's own login, never an API key. */
9
- export type ProviderId = 'claude' | 'codex';
8
+ /**
9
+ * Which provider backs a turn. Every turn runs on the `claude` binary; the
10
+ * id only says what it is pointed at. `'claude'` is the local Claude Code
11
+ * login and `'codex'` the ChatGPT subscription served through Rookery's own
12
+ * bridge - both authenticated by a login session, never an API key. Any
13
+ * other id names a configured `ProviderProfile` with its own backend and key.
14
+ */
15
+ export type ProviderId = string;
10
16
  export type Role = 'user' | 'assistant' | 'system';
11
17
  /** A persisted conversation turn. */
12
18
  export interface Message {
@@ -23,9 +29,55 @@ export interface Message {
23
29
  /** Provenance only, never identity. Unset for an ordinary turn. */
24
30
  agent?: string;
25
31
  createdAt: number;
32
+ /**
33
+ * The journal's turn id (`runtime.ts:645`), carried onto the message so a
34
+ * dream label can target this exact turn instead of guessing at it from
35
+ * session position (concept 9.4, "one turn id instead of three").
36
+ */
37
+ turnId?: string;
26
38
  /** Token/cost accounting, when the provider reported it. */
27
39
  usage?: TurnUsage;
40
+ /**
41
+ * The turn as it actually happened: text, thinking and tool calls in the
42
+ * order they arrived. `content` and `toolCalls` stay the flat compatibility
43
+ * view (and the fallback for rows written before this existed); `blocks` is
44
+ * the ordered transcript, built by `TurnBlocks` during the turn.
45
+ */
46
+ blocks?: MessageBlock[];
47
+ }
48
+ /**
49
+ * One memory as an answer keeps it: the id a feedback click posts against
50
+ * and the sentence its row shows. Deliberately not the whole `MemoryRecord` -
51
+ * this is stored on every answer that recalled anything.
52
+ */
53
+ export interface RecalledMemory {
54
+ id: string;
55
+ content: string;
28
56
  }
57
+ /**
58
+ * One segment of a turn, in arrival order: assistant text, model reasoning,
59
+ * a tool call, or the memories the turn was given before it answered. A tool
60
+ * block carries its whole event - the start event as it arrived, with
61
+ * `status: 'end'` and the (clipped) result merged in once the matching end
62
+ * event shows up. A memory block carries the journal's turn id, because a
63
+ * verdict on one of its rows is a claim about this turn (concept 4.2b, S6).
64
+ */
65
+ export type MessageBlock = {
66
+ type: 'text';
67
+ text: string;
68
+ } | {
69
+ type: 'thinking';
70
+ text: string;
71
+ } | {
72
+ type: 'tool';
73
+ call: Extract<AgentEvent, {
74
+ type: 'tool';
75
+ }>;
76
+ } | {
77
+ type: 'memory';
78
+ memories: RecalledMemory[];
79
+ turnId?: string;
80
+ };
29
81
  export interface TurnUsage {
30
82
  inputTokens?: number;
31
83
  outputTokens?: number;
@@ -70,8 +122,22 @@ export interface ProviderQuota {
70
122
  * What a conversation is for. A `voice` session belongs to the hands-free
71
123
  * screen: the assistant answers in its spoken register there, whichever
72
124
  * surface a turn comes from, and the web UI files it apart from the chats.
125
+ *
126
+ * `mail` is not a conversation anyone holds. Answering a mail addressed to
127
+ * the assistant needs a session to run the turn in, and that session used to
128
+ * be indistinguishable from a chat - so every answered mail left a "Mail:
129
+ * <subject>" thread in the conversations list that nobody had opened and
130
+ * nobody could continue. Marking it as its own kind keeps the transcript
131
+ * without pretending it is something to come back to: `listSessions` leaves
132
+ * these out unless a caller asks for them by name. Nothing creates one any
133
+ * more - mail was removed in schema 27 - but the old rows keep their kind.
134
+ *
135
+ * `schedule` is the same idea for a cron run: each firing gets its own fresh
136
+ * session to think in, nobody is there to hold that conversation, and the
137
+ * outcome is what gets read later (from its notification and from the
138
+ * schedule's own run history), not the transcript sitting in the chat list.
73
139
  */
74
- export type SessionKind = 'chat' | 'voice';
140
+ export type SessionKind = 'chat' | 'voice' | 'mail' | 'schedule';
75
141
  export interface Session {
76
142
  id: string;
77
143
  title: string;
@@ -98,6 +164,31 @@ export interface Session {
98
164
  archived: boolean;
99
165
  messageCount: number;
100
166
  }
167
+ /**
168
+ * One offered answer to a question the assistant asked. Two to four of these
169
+ * ride a `question` event; a surface renders them as buttons, radio rows or
170
+ * a numbered list, whatever fits it.
171
+ */
172
+ export interface QuestionOption {
173
+ /** What the button says. Short - it has to fit a phone keyboard row. */
174
+ label: string;
175
+ /** One line under the label, when the label alone is not enough. */
176
+ description?: string;
177
+ }
178
+ /**
179
+ * What came back. `selected` holds indices into the question's `options`, in
180
+ * the order they were offered; `text` carries a free answer, either from the
181
+ * "Other" field or from a plain chat reply on a channel that has no buttons.
182
+ * At least one of the two is always set.
183
+ */
184
+ export interface QuestionAnswer {
185
+ selected: number[];
186
+ text?: string;
187
+ /** Which surface answered, for the log. Unset when nobody recorded it. */
188
+ source?: 'web' | 'tui' | 'telegram' | 'api';
189
+ /** Epoch ms the answer arrived. */
190
+ at?: number;
191
+ }
101
192
  /**
102
193
  * The single event vocabulary Rookery streams to any frontend.
103
194
  * Provider adapters normalise their native JSON into exactly these.
@@ -119,7 +210,13 @@ export type AgentEvent = {
119
210
  type: 'thinking';
120
211
  delta: string;
121
212
  }
122
- /** The provider started or finished running one of its own tools. */
213
+ /**
214
+ * The provider started or finished running one of its own tools.
215
+ * `argsHash`/`input` are the recorder fidelity Phase 6 needs (concept
216
+ * S28): a sha256 over the canonical JSON of the call's arguments, and the
217
+ * canonical JSON itself up to a size limit, both set on the start event.
218
+ * `detail` is unchanged - the surface still renders off it.
219
+ */
123
220
  | {
124
221
  type: 'tool';
125
222
  name: string;
@@ -128,6 +225,8 @@ export type AgentEvent = {
128
225
  id?: string;
129
226
  result?: string;
130
227
  isError?: boolean;
228
+ argsHash?: string;
229
+ input?: string;
131
230
  }
132
231
  /** Rookery-level progress: memory recall, delegation, lifecycle. */
133
232
  | {
@@ -135,12 +234,17 @@ export type AgentEvent = {
135
234
  label: string;
136
235
  detail?: string;
137
236
  }
138
- /** A memory record was written or recalled. */
237
+ /**
238
+ * A memory record was written or recalled. A `recalled` event carries the
239
+ * journal's turn id (S6): it is what lets the chat highlight write a label
240
+ * about THIS turn instead of about the session it happened in.
241
+ */
139
242
  | {
140
243
  type: 'memory';
141
244
  action: 'recalled' | 'stored';
142
245
  count: number;
143
246
  items?: MemoryRecord[];
247
+ turnId?: string;
144
248
  }
145
249
  /**
146
250
  * An assignment changed state. Sent when an agent is handed a task, while
@@ -156,6 +260,29 @@ export type AgentEvent = {
156
260
  type: 'message';
157
261
  message: AgentMessage;
158
262
  }
263
+ /**
264
+ * Mail was sent: the user, the assistant, or an agent, to To + Cc.
265
+ * @deprecated Internal mail is gone (docs/concepts/mail-removal-notifications-and-task-activity.md);
266
+ * nothing in core emits this any more. Kept only so old clients still compile.
267
+ */
268
+ | {
269
+ type: 'mail';
270
+ mail: Mail;
271
+ }
272
+ /**
273
+ * Something for the user: a schedule's outcome, a question on one of their
274
+ * cards, a report an agent or the watcher wrote. Stored, readable later,
275
+ * and the one event a push channel carries to the phone.
276
+ */
277
+ | {
278
+ type: 'notification';
279
+ notification: Notification;
280
+ }
281
+ /** One line was added to a task's activity - what happened on the card. */
282
+ | {
283
+ type: 'task-event';
284
+ event: TaskEvent;
285
+ }
159
286
  /** A task on the board was created or changed state. */
160
287
  | {
161
288
  type: 'task';
@@ -179,6 +306,35 @@ export type AgentEvent = {
179
306
  | {
180
307
  type: 'quota';
181
308
  quota: ProviderQuota;
309
+ }
310
+ /**
311
+ * The assistant asked the person something and the turn is waiting on the
312
+ * answer. Broadcast rather than confined to the turn that asked: whoever
313
+ * is at a screen may answer, including a channel that did not start it.
314
+ */
315
+ | {
316
+ type: 'question';
317
+ /** Global, not scoped to a turn: any connection may answer this id. */
318
+ id: string;
319
+ /** Two or three words over the card, e.g. "Deploy target". */
320
+ header: string;
321
+ question: string;
322
+ options: QuestionOption[];
323
+ /** More than one option may be picked. */
324
+ multiSelect: boolean;
325
+ /** Epoch ms after which the question gives up and the turn moves on. */
326
+ expiresAt: number;
327
+ }
328
+ /**
329
+ * The question is over. Needed so a surface that is showing the card takes
330
+ * it away again when the answer came from somewhere else - or when nobody
331
+ * answered at all.
332
+ */
333
+ | {
334
+ type: 'question-closed';
335
+ id: string;
336
+ reason: 'answered' | 'cancelled' | 'expired';
337
+ answer?: QuestionAnswer;
182
338
  } | {
183
339
  type: 'error';
184
340
  message: string;
@@ -189,6 +345,30 @@ export type AgentEvent = {
189
345
  usage?: TurnUsage;
190
346
  providerSessionId?: string;
191
347
  };
348
+ /**
349
+ * One line of a running assignment's live log: the event as it arrived,
350
+ * with a sequence number that stays monotone over the whole run - including
351
+ * the reset a provider switch performs - so clients can order and merge a
352
+ * snapshot against later frames without ever assuming continuity.
353
+ */
354
+ export interface AssignmentLogEntry {
355
+ seq: number;
356
+ event: AgentEvent;
357
+ }
358
+ /** Point-in-time read of a running assignment's live log. */
359
+ export interface AssignmentLogSnapshot {
360
+ /** The buffered entries, in arrival order. */
361
+ events: AssignmentLogEntry[];
362
+ /** True once the oldest whole entries were dropped to stay under the cap. */
363
+ overflowed: boolean;
364
+ /** False when no run holds the buffer: unknown or finished id alike. */
365
+ active: boolean;
366
+ }
367
+ /** One live-log entry on its way to a watcher of the run it belongs to. */
368
+ export interface AssignmentLogFrame {
369
+ assignmentId: string;
370
+ entry: AssignmentLogEntry;
371
+ }
192
372
  /**
193
373
  * Long-term memory kinds.
194
374
  * - fact: stable truth about the user or their world
@@ -215,6 +395,15 @@ export interface MemoryRecord {
215
395
  importance: number;
216
396
  /** Whose memory this is: `assistant`, or an agent id. */
217
397
  owner: string;
398
+ /**
399
+ * The words this memory stands on, quoted from whoever said them: the
400
+ * user's own message for the assistant's bank, the assignment or the report
401
+ * for an agent's. An extracted memory that cannot produce one is not
402
+ * written at all - see `memory/gate.ts`. Absent on the rows the user wrote
403
+ * by hand and on what the night condensed out of memories that each carry
404
+ * their own.
405
+ */
406
+ evidence?: string;
218
407
  /** Session this was learned in, when known. */
219
408
  sourceSessionId?: string;
220
409
  createdAt: number;
@@ -238,6 +427,12 @@ export interface MemoryRecord {
238
427
  supersededBy?: string;
239
428
  /** The sleep run that wrote this memory, when one did. */
240
429
  sleepRunId?: string;
430
+ /**
431
+ * Set when the agent this belonged to was replaced (agent-performance-
432
+ * management, phase 4). Archived memories stay out of recall for good but
433
+ * remain visible, audit-only, on the retired agent's own page.
434
+ */
435
+ archivedAt?: number;
241
436
  /**
242
437
  * 0..1 - how often this memory actually got recalled. Separate from
243
438
  * `importance` on purpose: importance says how much it should matter,
@@ -343,7 +538,21 @@ export type SleepStatus = 'running' | 'done' | 'failed';
343
538
  * A night runs several cycles of the three, because condensing changes what
344
539
  * there is to connect: the second pass works on a bank the first one tidied.
345
540
  */
346
- export type SleepStage = 'light' | 'deep' | 'rem';
541
+ /**
542
+ * `replay` runs once, before the cycles: the day's conversations are read
543
+ * again, properly this time. The per-turn extractor sees one exchange at a
544
+ * time through a small model, so anything that only becomes visible across a
545
+ * whole conversation is invisible to it. Reading the transcripts at night
546
+ * catches that - and it comes first so the day's harvest is in the bank
547
+ * before deep sleep starts condensing, rather than waiting a day for it.
548
+ *
549
+ * `dream` is stage 2 (concept 11, Phase 3 on): the model-free grid probe,
550
+ * evaluation and promotion gate. It sits between `replay` and `light` - the
551
+ * probe reads the day's fresh traces before condensation starts folding
552
+ * memories away, and it never runs inside the light/deep/rem cycle itself
553
+ * (concept 5.5a: it must not see a bank `#condense` has already touched).
554
+ */
555
+ export type SleepStage = 'replay' | 'dream' | 'light' | 'deep' | 'rem';
347
556
  /**
348
557
  * One night's work on one memory bank. Every write a run makes carries its
349
558
  * id, which is what makes a night undoable in a single transaction.
@@ -358,16 +567,55 @@ export interface SleepRun {
358
567
  durationMs?: number;
359
568
  /** How many live memories the run looked at. */
360
569
  readCount: number;
570
+ /** Conversations the night read again in full. */
571
+ replayedCount: number;
572
+ /** Memories those conversations yielded that the day had missed. */
573
+ learnedCount: number;
361
574
  /** How many memories were folded into a condensed one. */
362
575
  mergedCount: number;
363
576
  /** How many were put to sleep. */
364
577
  dormantCount: number;
365
578
  edgeCount: number;
366
579
  insightCount: number;
580
+ /** Skills the night wrote out of what the bank kept repeating. */
581
+ skillCount: number;
582
+ /**
583
+ * Skills the night rewrote because something they stood on changed, or
584
+ * because a run that had them open failed. Counted apart from `skillCount`:
585
+ * repairing a procedure and inventing one are different kinds of work.
586
+ */
587
+ skillRevisedCount: number;
367
588
  /** Contradictions found. */
368
589
  conflictCount: number;
369
590
  /** Contradictions actually decided, the loser filed away. */
370
591
  resolvedCount: number;
592
+ /**
593
+ * Dream traces the night's probe looked at. Optional on purpose: the only
594
+ * places that build a complete `SleepRun` are written from AP7 / Schema 21
595
+ * on, and a required field would break the wave-1 typecheck before then.
596
+ */
597
+ dreamTracesSeen?: number;
598
+ /**
599
+ * Dream frames the night's grid probe scored. In stage 1 this carries the
600
+ * grid placements, not candidates. Set from AP7 / Schema 21 on.
601
+ */
602
+ dreamFramesScored?: number;
603
+ /**
604
+ * Model-written dream candidates. Reserved for Phase 3 and 0 until then,
605
+ * so the counter cannot quietly change meaning. Set from AP7 / Schema 21 on.
606
+ */
607
+ dreamCandidates?: number;
608
+ /**
609
+ * Stage 2 counters, same reason these are optional as the three above:
610
+ * only `createSleepRun`, `updateSleepRun`'s whitelist and `mapSleepRun`
611
+ * from AP3/Schema 24 on set them, at the same four places in lockstep
612
+ * (concept 8.8), and a required field would break the wave-1 typecheck
613
+ * before AP3 lands.
614
+ */
615
+ /** Policy versions this run promoted. At most `dream.maxPromotionsPerNight`. */
616
+ dreamPromoted?: number;
617
+ /** Dream labels this run's replay and merge passes wrote (concept 4.2a/c). */
618
+ dreamLabelsWritten?: number;
371
619
  /** Small-model calls spent. Capped by config. */
372
620
  modelCalls: number;
373
621
  /** Two or three sentences a person can read. */
@@ -376,6 +624,514 @@ export interface SleepRun {
376
624
  /** Set when the run was rolled back. */
377
625
  undoneAt?: number;
378
626
  }
627
+ /**
628
+ * The dream: recall decisions are recorded and replayed so the night can
629
+ * measure the retrieval policy instead of guessing at it. See
630
+ * docs/concepts/dream-and-recursive-self-improvement.md.
631
+ *
632
+ * Stage 1 records and measures, nothing else: no model call, no candidate
633
+ * writer, no promotion. The types below are the shared vocabulary every
634
+ * later package builds against, so they live here rather than in a `dream/`
635
+ * module that two wave-2 packages would have to serialise on.
636
+ */
637
+ /** Where a recall call came from. Stage 1 scores only `turn` (concept 3.5). */
638
+ export type DreamSite = 'turn' | 'extract' | 'tool' | 'inspect';
639
+ /**
640
+ * Which post-processing chain a frame belongs to. The assistant path groups
641
+ * by entity and drops contradicted memories; the agent path does neither.
642
+ * Scoring one with the other's chain would score a prompt that never
643
+ * existed (concept 3.6).
644
+ */
645
+ export type DreamPipeline = 'assistant' | 'agent';
646
+ /** What kind of run opened a trace. */
647
+ export type DreamTraceKind = 'turn' | 'assignment' | 'night';
648
+ /**
649
+ * How a recall call degraded. Three worlds, not two: "rows came, but all
650
+ * fell below the threshold" is a legitimate miss that must be scored, never
651
+ * inferred from an empty result (concept 3.4).
652
+ */
653
+ export type DreamDegraded = 'no-tokens' | 'fts-threw';
654
+ /**
655
+ * Where a policy value came from: the factory default, the user's config,
656
+ * or a dream promotion.
657
+ */
658
+ export type PolicyOrigin = 'default' | 'user' | 'dream';
659
+ /** The four recall scoring terms. `scoreFrame` normalises them to sum 1. */
660
+ export interface RecallWeights {
661
+ relevance: number;
662
+ importance: number;
663
+ recency: number;
664
+ usage: number;
665
+ }
666
+ /** Field-by-field provenance of a resolved policy (concept 9.3). */
667
+ export interface RecallPolicyOrigin {
668
+ limit: PolicyOrigin;
669
+ threshold: PolicyOrigin;
670
+ hopEntity: PolicyOrigin;
671
+ hopEdge: PolicyOrigin;
672
+ relevance: PolicyOrigin;
673
+ importance: PolicyOrigin;
674
+ recency: PolicyOrigin;
675
+ usage: PolicyOrigin;
676
+ }
677
+ /**
678
+ * The declared parameter space a frame is closed under.
679
+ *
680
+ * A replay is honest exactly when the recorded surface is closed under this
681
+ * box: every value `scoreFrame` may vary appears here as an interval, so a
682
+ * replay can never need a row that was not fetched. `kinds` and
683
+ * `minImportance` are SQL filters rather than scoring terms - widening them
684
+ * admits rows that were never fetched - so they ride as literals
685
+ * (concept 3.4).
686
+ */
687
+ export interface RecallBox {
688
+ /**
689
+ * Upper bound for `limit`. With a trace open, the hop-1 frontier is
690
+ * `max(limit, limitMax) * 4` rows, so one frame recorded at this corner
691
+ * stays replayable for every `limit` below it.
692
+ */
693
+ limitMax: number;
694
+ /** Weight interval per scoring term. */
695
+ w: {
696
+ relevance: [number, number];
697
+ importance: [number, number];
698
+ recency: [number, number];
699
+ usage: [number, number];
700
+ };
701
+ threshold: [number, number];
702
+ hopEntity: [number, number];
703
+ hopEdge: [number, number];
704
+ /** Kind filter, as the live call received it. */
705
+ kinds: MemoryKind[];
706
+ /** Importance floor, as the live call received it. */
707
+ minImportance: number;
708
+ }
709
+ /**
710
+ * One realisation of the recall parameters, inside the box.
711
+ *
712
+ * `resolvePolicy` (memory/dream/policy.ts) is the single truth for these
713
+ * numbers: today two effective policies exist for one function, because the
714
+ * agent path never passes the hop weights. A config value that deviates
715
+ * from the factory default is classified `user`, so a later promotion
716
+ * cannot silently override what the user set (concept 9.3).
717
+ */
718
+ export interface RecallPolicy {
719
+ limit: number;
720
+ threshold: number;
721
+ w: RecallWeights;
722
+ hopEntity: number;
723
+ hopEdge: number;
724
+ kinds: MemoryKind[];
725
+ minImportance: number;
726
+ /** Where each value came from. `default` while nothing is promoted. */
727
+ origin: RecallPolicyOrigin;
728
+ }
729
+ /** The query as it arrived, with everything derived from it at record time. */
730
+ export interface FrameQuery {
731
+ /**
732
+ * The user's literal question. Frames are verbatim storage: this text
733
+ * never outlives the memory and the session it came from (R17).
734
+ */
735
+ text: string;
736
+ /** The safe FTS5 MATCH expression built from the text (`toMatchQuery`). */
737
+ matchQuery: string;
738
+ /** The tokens the tag boost compared against (`tokenize`). */
739
+ tokens: string[];
740
+ }
741
+ /** One hop-1 row: identity plus the frozen bm25 relevance SQL returned. */
742
+ export interface FrameHop1Row {
743
+ id: string;
744
+ relevance: number;
745
+ }
746
+ /** An entity attached to a reachable memory, as the frame froze it. */
747
+ export interface FrameEntityRef {
748
+ entityId: string;
749
+ name: string;
750
+ mentions: number;
751
+ }
752
+ /**
753
+ * An edge the second hop could follow: `refines`/`caused_by`, collected
754
+ * from the possible seeds rather than the realised ones.
755
+ */
756
+ export interface FrameEdgeRef {
757
+ id: string;
758
+ srcId: string;
759
+ dstId: string;
760
+ relation: MemoryRelation;
761
+ weight: number;
762
+ }
763
+ /**
764
+ * A frozen copy of one memory row, taken when the frame was recorded. Every
765
+ * column the score reads is fixed here: reading `access_count` or
766
+ * `importance` live at replay time replays a world that never existed
767
+ * (concept 3.7 c).
768
+ */
769
+ export type MemoryRecordSnapshot = MemoryRecord;
770
+ /**
771
+ * The document-frequency fingerprint of one night, over the tokens of that
772
+ * night's frames (R10). bm25 is frozen in the frame and can never be
773
+ * revalidated, so the corpus is the only observable that correlates with a
774
+ * frame going stale. The fingerprint is computed once per night into `meta`
775
+ * and each frame carries only its id; the stamp is up to 24 hours younger
776
+ * than the frames it certifies, which is approximate and reported as such.
777
+ */
778
+ export interface FrameCorpus {
779
+ /** Identifies the `meta` row; stamped onto each frame as `corpusStampId`. */
780
+ id: string;
781
+ owner: string;
782
+ /** When the fingerprint was computed, epoch milliseconds. */
783
+ at: number;
784
+ /** Document frequency per frame token at that moment. */
785
+ df: Record<string, number>;
786
+ }
787
+ /**
788
+ * Why a frame was not scored. A box violation firing is a recorder error,
789
+ * not a measurement; the rest are real abstentions (concept 5.4).
790
+ * `corpus-invalidated` is for frames older than a `reindex` or bulk import
791
+ * that moved the corpus stamp discontinuously, and is counted apart from
792
+ * `corpus-drifted`.
793
+ */
794
+ export type AbstainReason = 'limit-out-of-box' | 'seeds-capped' | 'degraded-turn' | 'frame-missing' | 'corpus-drifted' | 'corpus-invalidated' | 'budget-changed' | 'no-reachable-label' | 'no-labelled-move' | 'pipeline-mismatch' | 'no-label-source' | 'unfinished';
795
+ /** What `scoreFrame` answers: a ranking, or an abstention with its reason. */
796
+ export type ScoreResult = {
797
+ ok: true;
798
+ ranked: ScoredMemory[];
799
+ } | {
800
+ ok: false;
801
+ reason: AbstainReason;
802
+ };
803
+ /**
804
+ * A recorded recall decision: the permissive corner of the declared box,
805
+ * not the path that was taken. Everything a replay needs, frozen.
806
+ *
807
+ * The reachable set R is `hop1` plus `profile` plus every `entityNeighbours`
808
+ * list plus every edge destination; `entities` covers all of R, because
809
+ * `groupByEntity` reads entities for every delivered memory, not just the
810
+ * seeds (concept 3.4).
811
+ */
812
+ export interface RecallFrame {
813
+ v: 1;
814
+ site: DreamSite;
815
+ pipeline: DreamPipeline;
816
+ owner: string;
817
+ box: RecallBox;
818
+ query: FrameQuery;
819
+ /**
820
+ * The clock the recency term was computed with. A replay that recomputes
821
+ * it makes all rows decay together and shrinks exactly the spread a
822
+ * candidate could have moved (concept 3.7 b).
823
+ */
824
+ now: number;
825
+ corpusStampId: string;
826
+ /**
827
+ * The normaliser of the relevance term AFTER the `Math.max(..., 1)`
828
+ * clamp. Renormalising without the clamp inflates queries with a low
829
+ * bm25 by a plausible-looking factor (concept 3.7 g).
830
+ */
831
+ maxRelevanceClamped: number;
832
+ /**
833
+ * Budget and subject the block was rendered with. A drift against the
834
+ * live config abstains with `budget-changed`, because the cost term's
835
+ * denominator moved (concept 5.4).
836
+ */
837
+ budgetChars: number;
838
+ subject: string;
839
+ /** One store of frozen rows; everything else references them by id. */
840
+ records: Record<string, MemoryRecordSnapshot>;
841
+ /** The hop-1 frontier in SQL order. */
842
+ hop1: FrameHop1Row[];
843
+ /**
844
+ * Superset of the true second-hop seeds, from interval arithmetic over
845
+ * the box. An error in the bound degrades to an abstention, never to a
846
+ * plausible wrong number.
847
+ */
848
+ possibleSeeds: string[];
849
+ /** Entities per reachable memory id. */
850
+ entities: Record<string, FrameEntityRef[]>;
851
+ /**
852
+ * Neighbour ids per entity, recorded WITHOUT `exclude`, `8 +
853
+ * |possibleSeeds|` rows each. Superseded rows are included on purpose:
854
+ * the SQL limit bites before `offer` filters them.
855
+ */
856
+ entityNeighbours: Record<string, string[]>;
857
+ edges: FrameEdgeRef[];
858
+ /** Contradiction pairs over the reachable set, for a store-free `dropContradicted`. */
859
+ contradicts: {
860
+ srcId: string;
861
+ dstId: string;
862
+ }[];
863
+ /**
864
+ * The core profile at the box's most permissive corner. A profile
865
+ * recorded at a realised `limit` is not closed over `limit`, so
866
+ * `mergeProfile` slices this list per candidate instead.
867
+ */
868
+ profile: {
869
+ id: string;
870
+ reason: string;
871
+ }[];
872
+ /** Three worlds, not two - see `DreamDegraded`. */
873
+ degraded: DreamDegraded | null;
874
+ }
875
+ /** What a framed turn reports when it opens a trace (`Store.beginTrace`). */
876
+ export interface DreamTraceInput {
877
+ /** Groups the calls of one turn; labels attach here (R19). */
878
+ turnId: string;
879
+ owner: string;
880
+ kind: DreamTraceKind;
881
+ site: DreamSite;
882
+ pipeline: DreamPipeline;
883
+ sessionId?: string;
884
+ sessionKind?: SessionKind;
885
+ assignmentId?: string;
886
+ sleepRunId?: string;
887
+ /** Position of the turn in its session. */
888
+ turnIndex?: number;
889
+ /** The policy set in effect per slot, as `resolvePolicy` returned it. */
890
+ policySet: Record<string, RecallPolicy>;
891
+ /**
892
+ * Whether the session fell into the sample - drawn per session, never
893
+ * per trace, so consecutive turns cannot split across both sides.
894
+ */
895
+ framed?: boolean;
896
+ holdout?: boolean;
897
+ /** Marks the frozen audit set (R3); its reader arrives with Phase 3. */
898
+ audit?: boolean;
899
+ }
900
+ /** What a framed turn reports when it closes its trace (`Store.finishTrace`). */
901
+ export interface DreamTracePatch {
902
+ /** How the recall call degraded, once known. Explicit `null` is a legitimate value. */
903
+ degraded?: DreamDegraded | null;
904
+ }
905
+ /**
906
+ * One recorded recall invocation. A turn groups several calls under one
907
+ * `turnId` (R19): the assistant's turn calls `recall` twice, plus
908
+ * `coreProfile` and the write gate.
909
+ */
910
+ export interface DreamTrace {
911
+ id: string;
912
+ turnId: string;
913
+ owner: string;
914
+ kind: DreamTraceKind;
915
+ site: DreamSite;
916
+ pipeline: DreamPipeline;
917
+ sessionId?: string;
918
+ sessionKind?: SessionKind;
919
+ assignmentId?: string;
920
+ sleepRunId?: string;
921
+ turnIndex: number;
922
+ policySet: Record<string, RecallPolicy>;
923
+ framed: boolean;
924
+ holdout: boolean;
925
+ /** Frozen audit set (R3): the column exists in stage 1, its reader arrives with Phase 3. */
926
+ audit: boolean;
927
+ degraded: DreamDegraded | null;
928
+ startedAt: number;
929
+ finishedAt?: number;
930
+ createdAt: number;
931
+ }
932
+ /** A stored frame, as the night's read path (`Store.framesFor`) hands it over. */
933
+ export interface DreamFrame {
934
+ traceId: string;
935
+ /** Which slot the frame closed over. Stage 1 has exactly one: `recall`. */
936
+ slot: string;
937
+ frameV: number;
938
+ /** Denormalised for the deletion paths, so `payload` is never read for them (R17). */
939
+ owner: string;
940
+ sessionId?: string;
941
+ box: RecallBox;
942
+ corpusStampId: string;
943
+ payload: RecallFrame;
944
+ /** Serialised size; `saveFrame` rejects frames above `dream.maxFrameBytes`. */
945
+ bytes: number;
946
+ createdAt: number;
947
+ }
948
+ /**
949
+ * Where a dream label came from. `usefulness`/`access_count`/`memory_touches`
950
+ * are deliberately not sources (concept 4.3, E9) - they are score inputs,
951
+ * frozen into the frame, never a claim about a turn.
952
+ */
953
+ export type DreamLabelSource = 'correction' | 'review' | 'merge' | 'user';
954
+ /**
955
+ * Whether a label names an exact turn or only the session it fell in.
956
+ * Only `scope: 'turn'` feeds `gain(m)`/DCG (concept 4.2a) - a session-wide
957
+ * label from an unlocatable quote still counts for the label agreement
958
+ * check and calibration, never for a score.
959
+ */
960
+ export type DreamLabelScope = 'turn' | 'session';
961
+ /**
962
+ * A claim that one memory should, or should not, have been in one turn's
963
+ * prompt (concept 4.1): `(turnId, target, relevance in {0,1}, source,
964
+ * evidence)`. `target` is a memory id, or the sentinel `'*'` for a `review`
965
+ * assignment-level weight (concept 4.2d), which never enters DCG. `dead_at`
966
+ * survives the row when its target is later removed (concept 8.3, S9) - the
967
+ * label history is calibration material and is never deleted outright.
968
+ */
969
+ export interface DreamLabel {
970
+ turnId: string;
971
+ /** Memory id, or `'*'` for a `review` assignment-level weight. */
972
+ target: string;
973
+ source: DreamLabelSource;
974
+ /** 1 = proven relevant, 0 = proven irrelevant. `review` lands in (0,1). */
975
+ relevance: number;
976
+ scope: DreamLabelScope;
977
+ /** Correction id / review id / route name + actor. */
978
+ evidence?: string;
979
+ /** Set once the target is gone; the row itself is never deleted (S9). */
980
+ deadAt?: number;
981
+ createdAt: number;
982
+ /** Denormalised for the deletion paths, mirroring `DreamFrame.owner`. */
983
+ owner: string;
984
+ sessionId?: string;
985
+ }
986
+ /** The three recall-family slots stage 2 carries a policy for (concept 7.1). */
987
+ export type DreamSlot = 'recall' | 'budget' | 'retry';
988
+ /**
989
+ * One resolved, versioned parameter set for one owner's slot: the factory
990
+ * default, a user override, or a dream promotion (`PolicyOrigin`, already
991
+ * declared above for `RecallPolicyOrigin`). `resolvePolicy` (AP10) reads the
992
+ * highest `version` with `promotedAt` set and `retiredAt` unset; `prevActiveId`
993
+ * is what was active right before this one was promoted, so a revert or a
994
+ * night's undo has something to reactivate (concept 8.5).
995
+ */
996
+ export interface PolicyVersion {
997
+ id: string;
998
+ owner: string;
999
+ slot: DreamSlot;
1000
+ version: number;
1001
+ /** Full parameter set for `slot`; shape depends on which slot this is. */
1002
+ params: Record<string, unknown>;
1003
+ /** The box this version was validated against; shape depends on `slot`. */
1004
+ box: Record<string, unknown>;
1005
+ origin: PolicyOrigin;
1006
+ parentId?: string;
1007
+ /** What was active when this version was promoted. `undefined`: none was. */
1008
+ prevActiveId?: string;
1009
+ sleepRunId?: string;
1010
+ rationale?: string;
1011
+ replayScore?: number;
1012
+ replayN?: number;
1013
+ baselineScore?: number;
1014
+ /** Against the factory default parameter set, on the frozen audit set. */
1015
+ auditDelta?: number;
1016
+ auditCiLow?: number;
1017
+ onlineScore?: number;
1018
+ promotedAt?: number;
1019
+ retiredAt?: number;
1020
+ createdAt: number;
1021
+ }
1022
+ /**
1023
+ * The four freeze causes (concept 10.3). A frozen slot keeps measuring but
1024
+ * never promotes again until a person thaws it.
1025
+ */
1026
+ export type DreamSlotFreezeReason = 'calibration' | 'staleness' | 'agreement' | 'manual';
1027
+ /** Per-owner, per-slot promotion state: frozen or not, and the cooldown clock. */
1028
+ export interface DreamSlotState {
1029
+ owner: string;
1030
+ slot: DreamSlot;
1031
+ frozenAt?: number;
1032
+ frozenReason?: DreamSlotFreezeReason;
1033
+ cooldownUntil?: number;
1034
+ lastPromoted?: number;
1035
+ }
1036
+ /**
1037
+ * One candidate evaluation: the paired, bootstrapped delta against the
1038
+ * incumbent, its validity certificate (concept 5.4) and its promotion
1039
+ * outcome. `abstainReasons` keys on `AbstainReason`; `signAgree` is the
1040
+ * freshness check's verdict (concept 5.5a) - `null` means "undetermined",
1041
+ * because `|delta_frozen| <= margin` makes the sign comparison moot.
1042
+ */
1043
+ export interface DreamEval {
1044
+ id: string;
1045
+ sleepRunId: string;
1046
+ policyId: string;
1047
+ slot: DreamSlot;
1048
+ /** Offered. */
1049
+ traces: number;
1050
+ /** Closed and scored. */
1051
+ closed: number;
1052
+ abstained: number;
1053
+ abstainReasons: Partial<Record<AbstainReason, number>>;
1054
+ reachableRate: number;
1055
+ labelCoverage: number;
1056
+ costOnlyShare: number;
1057
+ score: number;
1058
+ baseline: number;
1059
+ delta: number;
1060
+ /** Cluster-bootstrap over sessions, 95 percent, reported as approximated. */
1061
+ ciLow: number;
1062
+ ciHigh: number;
1063
+ /** Against the factory default, on the frozen audit set. */
1064
+ auditDelta?: number;
1065
+ auditCiLow?: number;
1066
+ /** Freshness check: score against the live bank instead of frozen frames. */
1067
+ deltaLive?: number;
1068
+ /**
1069
+ * `null` is a legitimate value, not "not yet known" - it means
1070
+ * undetermined (`|delta| <= margin`), see the freshness check above. The
1071
+ * same pattern `DreamTrace.degraded` already uses.
1072
+ */
1073
+ signAgree: boolean | null;
1074
+ evalMs: number;
1075
+ /** sha256 over the sorted trace ids this evaluation closed over. */
1076
+ traceSetHash: string;
1077
+ /** Condensed reasoning, never verbatim text. */
1078
+ evidenceDigest?: string;
1079
+ promoted: boolean;
1080
+ /** Score per label source, gaming-admission counters. */
1081
+ detail?: Record<string, unknown>;
1082
+ createdAt: number;
1083
+ }
1084
+ /**
1085
+ * The index over one turn's or one assignment's existing `turn_events`
1086
+ * journal (concept, AP1 "dream_episodes"): not a second transcript store,
1087
+ * only what the journal does not already know - outcome, step count, and
1088
+ * whether this episode fell into the frozen audit set. `id` is the same id
1089
+ * as the underlying `turns`/`assignments` row.
1090
+ */
1091
+ export interface DreamEpisode {
1092
+ id: string;
1093
+ owner: string;
1094
+ kind: 'turn' | 'assignment';
1095
+ sessionId?: string;
1096
+ /** Which slot's policy this episode is relevant to. */
1097
+ slot: string;
1098
+ steps: number;
1099
+ outcome: 'success' | 'failure' | 'unknown';
1100
+ holdout: boolean;
1101
+ audit: boolean;
1102
+ startedAt: number;
1103
+ finishedAt?: number;
1104
+ createdAt: number;
1105
+ }
1106
+ /**
1107
+ * One tool step of an episode, read back from `turn_events` rather than
1108
+ * stored anywhere new (`episodeFromEvents`, AP7). Observations are keyed on
1109
+ * `(step, argsHash)` - concept S28/S29 - so a diverging action can
1110
+ * structurally never match a recorded one.
1111
+ */
1112
+ export interface DreamEpisodeStep {
1113
+ step: number;
1114
+ name: string;
1115
+ argsHash?: string;
1116
+ input?: string;
1117
+ result?: string;
1118
+ isError?: boolean;
1119
+ at: number;
1120
+ }
1121
+ /**
1122
+ * The first-divergence verdict (concept 7.2/S29): `k = n` is `no-change`;
1123
+ * `k < n` on a failed episode is `may-avoid-failure` and counts for nothing;
1124
+ * `k < n` on a successful episode is `regression-risk` at step `k`. Nothing
1125
+ * is claimed about steps after `k`.
1126
+ */
1127
+ export type DreamVerdict = 'no-change' | 'may-avoid-failure' | 'regression-risk';
1128
+ /**
1129
+ * Who caused a memory write or edit. `'model'` is the default for every
1130
+ * existing store call site so nothing breaks; only the HTTP path passes
1131
+ * `'user'` explicitly (concept 4.2b, S5), and `'sleep'` is the night itself.
1132
+ * Only `actor === 'user'` makes the store write a `user` dream label.
1133
+ */
1134
+ export type MemoryActor = 'user' | 'model' | 'sleep';
379
1135
  /**
380
1136
  * The company the assistant runs.
381
1137
  *
@@ -434,6 +1190,13 @@ export interface Agent {
434
1190
  title: string;
435
1191
  /** The role's standing instructions. Never mixed into the assistant's voice. */
436
1192
  instructions: string;
1193
+ /**
1194
+ * Two to four sentences on HOW this person writes - never what they can
1195
+ * do, which is what `instructions` is for. Nullable and usually empty:
1196
+ * an unset voice colours nothing, exactly today's behaviour (decision
1197
+ * E11, F5). Set at `hire_agent`, editable on the agent's own form.
1198
+ */
1199
+ voice?: string;
437
1200
  teamId?: string;
438
1201
  /** Direct manager. Unset: reports to the assistant. */
439
1202
  managerId?: string;
@@ -458,6 +1221,14 @@ export interface Assignment {
458
1221
  parentId?: string;
459
1222
  requesterKind: RequesterKind;
460
1223
  requesterAgentId?: string;
1224
+ /**
1225
+ * What this run is called - three to eight words, never the brief itself.
1226
+ * A run that belongs to a task carries that task's name (decision E17);
1227
+ * one that does not is named by whoever started it. Required here and
1228
+ * nullable in the column: a row written before the name existed is named
1229
+ * from its own first line when it is read, and never written back.
1230
+ */
1231
+ title: string;
461
1232
  task: string;
462
1233
  status: AssignmentStatus;
463
1234
  result?: string;
@@ -479,6 +1250,8 @@ export interface AssignmentView {
479
1250
  agentId: string;
480
1251
  agentSlug: string;
481
1252
  agentName: string;
1253
+ /** The run's name, for lists; `task` stays the full brief underneath it. */
1254
+ title: string;
482
1255
  task: string;
483
1256
  status: AssignmentStatus;
484
1257
  projectId?: string;
@@ -488,9 +1261,106 @@ export interface AssignmentView {
488
1261
  chars?: number;
489
1262
  /** Tail of the output, for a live preview line. */
490
1263
  preview?: string;
1264
+ /** The most recent tool call this run made, for a live activity view. */
1265
+ lastActivity?: {
1266
+ kind: 'tool' | 'status';
1267
+ label: string;
1268
+ at: number;
1269
+ };
491
1270
  durationMs?: number;
492
1271
  error?: string;
493
1272
  }
1273
+ /** Who judged a run: a hard signal with no model call, Jarvis, or the user. */
1274
+ export type ReviewSource = 'user' | 'assistant' | 'system';
1275
+ /**
1276
+ * A judgment of one completed assignment, always against the agent's own
1277
+ * role - never against other agents. `overall` is its own judgement rather
1278
+ * than an average of the five dimensions below: averaging would wash out
1279
+ * exactly the outlier that makes a review worth having.
1280
+ *
1281
+ * Organisation data, not a memory: it never enters `memories` and never
1282
+ * reaches the reviewed agent's own prompt (see
1283
+ * docs/concepts/agent-performance-management.md, decision E2).
1284
+ */
1285
+ export interface AgentReview {
1286
+ id: string;
1287
+ orgId: string;
1288
+ agentId: string;
1289
+ /** Unset for a periodic review with no single run behind it. */
1290
+ assignmentId?: string;
1291
+ /** Convenience for the UI; the assignment id is the durable link. */
1292
+ taskId?: string;
1293
+ source: ReviewSource;
1294
+ /** 1..5, the only required judgement. */
1295
+ overall: number;
1296
+ quality?: number;
1297
+ completeness?: number;
1298
+ reliability?: number;
1299
+ communication?: number;
1300
+ efficiency?: number;
1301
+ /** One to three sentences on what was good or bad. */
1302
+ comment?: string;
1303
+ tags: string[];
1304
+ /**
1305
+ * A technically failed run (timeout, no provider, empty output) - counts
1306
+ * toward the agent's failure rate, never toward its quality average.
1307
+ */
1308
+ failedRun: boolean;
1309
+ createdAt: number;
1310
+ }
1311
+ /**
1312
+ * `reconfig-proposal` is a drafted instruction rewrite that has not been
1313
+ * applied: stage 2 files one whenever `autoReconfig` is off, and approving
1314
+ * it on the agent's page is what turns it into a `reconfig`.
1315
+ */
1316
+ export type AgentActionKind = 'note' | 'reconfig' | 'reconfig-proposal' | 'probation' | 'replace';
1317
+ /**
1318
+ * The personnel record behind a review trail: what actually changed about an
1319
+ * agent, and why. Exists so a `reconfig` is a documented, reversible step
1320
+ * instead of `updateAgent` silently overwriting `instructions`.
1321
+ */
1322
+ export interface AgentAction {
1323
+ id: string;
1324
+ orgId: string;
1325
+ agentId: string;
1326
+ kind: AgentActionKind;
1327
+ /** The escalation stage in effect when this action was taken. */
1328
+ stage: number;
1329
+ /** Internal diagnosis with evidence; the agent never sees this. */
1330
+ reason: string;
1331
+ /** Required together with `afterText` when `kind` is `reconfig`. */
1332
+ beforeText?: string;
1333
+ afterText?: string;
1334
+ /** Qualitative feedback addressed to the agent itself - no numbers, no dimension names. */
1335
+ agentNote?: string;
1336
+ /** Set on `replace`: the condensed handover for the successor. */
1337
+ handoverText?: string;
1338
+ /** The reviews that justified this action. */
1339
+ reviewIds: string[];
1340
+ decidedBy: 'user' | 'assistant';
1341
+ /** Set on `replace`: the newly hired agent taking over. */
1342
+ successorAgentId?: string;
1343
+ createdAt: number;
1344
+ }
1345
+ /**
1346
+ * The computed, never-materialised view of one agent's standing: a rolling
1347
+ * average over effective reviews, a trend, the escalation stage, and a
1348
+ * failure rate kept apart from it so infrastructure trouble never reads as a
1349
+ * quality problem. See `OrgStore.performance()`.
1350
+ */
1351
+ export interface AgentPerformance {
1352
+ /** Mean `overall` of the last 10 effective, non-failed reviews. Null with fewer than 3. */
1353
+ average: number | null;
1354
+ /** How many effective reviews fed the average. */
1355
+ count: number;
1356
+ /** avg(last 5) - avg(previous 5). Null with fewer than 10 effective reviews. */
1357
+ trend: number | null;
1358
+ /** 0 normal, 1 flagged, 2 reconfigured/on probation, 3 replacement proposed. */
1359
+ stage: 0 | 1 | 2 | 3;
1360
+ /** Technically failed runs over the last 20 effective reviews, 0..1. */
1361
+ failureRate: number;
1362
+ lastReviewAt?: number;
1363
+ }
494
1364
  export interface AgentMessage {
495
1365
  id: string;
496
1366
  orgId: string;
@@ -503,7 +1373,161 @@ export interface AgentMessage {
503
1373
  createdAt: number;
504
1374
  readAt?: number;
505
1375
  }
506
- export type TaskStatus = 'open' | 'planned' | 'running' | 'done' | 'failed' | 'cancelled';
1376
+ /**
1377
+ * Company mail: To + Cc, a subject, threading, and per-recipient read state.
1378
+ *
1379
+ * Retired (schema 27, docs/concepts/mail-removal-notifications-and-task-activity.md):
1380
+ * the tables stay and their content was migrated once into notifications and
1381
+ * task activity, but nothing in the runtime writes mail any more. The types
1382
+ * below stay exported so the web and server compile until they have moved
1383
+ * over; every one of them is deprecated.
1384
+ */
1385
+ /** Whose mailbox: the user, the assistant, or one agent (`id` set). @deprecated Mail was removed. */
1386
+ export interface MailWho {
1387
+ kind: RequesterKind;
1388
+ /** Agent id. Set only when `kind` is 'agent'. */
1389
+ id?: string;
1390
+ }
1391
+ /**
1392
+ * What a mail thread *is*, decided once when the thread is created and
1393
+ * inherited by every reply. `chat` is plain conversation; `assignment` is a
1394
+ * work order that created a task; `report` is a thread a run started (self
1395
+ * reports, cron results, an agent writing first). The kind is what routes a
1396
+ * thread into the fixed inbox folders.
1397
+ * @deprecated Mail was removed.
1398
+ */
1399
+ export type MailThreadKind = 'chat' | 'assignment' | 'report';
1400
+ /**
1401
+ * The fixed inbox folders, the same for every mailbox. `outbox` is not one of
1402
+ * them - what you sent is routed by sender, not by what the thread is.
1403
+ * @deprecated Mail was removed.
1404
+ */
1405
+ export type MailFolder = 'inbox' | 'tasks' | 'reports' | 'archiv';
1406
+ /** The protocol row behind one `threadId` - see `mail_threads` in memory/db.ts. @deprecated Mail was removed. */
1407
+ export interface MailThread {
1408
+ threadId: string;
1409
+ orgId: string;
1410
+ kind: MailThreadKind;
1411
+ /** The task an assignment thread created; what makes the work traceable. */
1412
+ taskId?: string;
1413
+ archivedAt?: number;
1414
+ createdAt: number;
1415
+ }
1416
+ /** @deprecated Mail was removed; see `Notification` and `TaskEvent`. */
1417
+ export interface Mail {
1418
+ id: string;
1419
+ orgId: string;
1420
+ fromKind: RequesterKind;
1421
+ /** Set only when `fromKind` is 'agent'. */
1422
+ fromAgentId?: string;
1423
+ subject: string;
1424
+ body: string;
1425
+ /** Shared by every mail in a reply chain; equals `id` for the root mail. */
1426
+ threadId: string;
1427
+ inReplyTo?: string;
1428
+ /** Auto-trigger hop count, the loop guard for mail-triggered runs. */
1429
+ depth: number;
1430
+ /** The run this mail's body came from, when it is an automatic reply. */
1431
+ assignmentId?: string;
1432
+ createdAt: number;
1433
+ recipients: MailRecipient[];
1434
+ /** The thread's kind, joined in from `mail_threads`. */
1435
+ threadKind?: MailThreadKind;
1436
+ /** Set when the thread is an assignment with a task on the board. */
1437
+ taskId?: string;
1438
+ taskTitle?: string;
1439
+ /** Set when the whole thread has been archived. */
1440
+ threadArchivedAt?: number;
1441
+ }
1442
+ /** @deprecated Mail was removed. */
1443
+ export interface MailRecipient {
1444
+ id: string;
1445
+ mailId: string;
1446
+ recipientKind: RequesterKind;
1447
+ /** Set only when `recipientKind` is 'agent'. */
1448
+ recipientId?: string;
1449
+ box: 'to' | 'cc';
1450
+ readAt?: number;
1451
+ }
1452
+ /**
1453
+ * What a notification is about. It decides the icon, the push switch that
1454
+ * governs it (`notificationPushAllowed` in config.ts) and what a reply to it
1455
+ * means: a reply to a `question` answers the task, a reply to anything else
1456
+ * starts a conversation about it.
1457
+ *
1458
+ * schedule a schedule's run finished (the old "Schedule X completed" mail)
1459
+ * watch the board watcher found something that needs a person
1460
+ * task a card the user asked for ended - done, failed or cancelled
1461
+ * question an agent asked the user something about a card; always pushed
1462
+ * agent an agent wrote to the user with `report_to_user`
1463
+ * sleep the night promoted a retrieval policy
1464
+ * system anything else Rookery says on its own, `notify` included
1465
+ */
1466
+ export type NotificationKind = 'schedule' | 'watch' | 'task' | 'question' | 'agent' | 'sleep' | 'system';
1467
+ /**
1468
+ * One message to the user - the only thing that still reaches them outside a
1469
+ * conversation (docs/concepts/mail-removal-notifications-and-task-activity.md).
1470
+ * Stored, read and archived like a mail used to be, but addressed to nobody
1471
+ * else and answered through the thing it points at: the task, the schedule
1472
+ * run, the conversation.
1473
+ */
1474
+ export interface Notification {
1475
+ id: string;
1476
+ orgId: string;
1477
+ kind: NotificationKind;
1478
+ title: string;
1479
+ body: string;
1480
+ /** Who is speaking: the assistant, one agent (`fromAgentId`), or Rookery itself. */
1481
+ fromKind: 'assistant' | 'agent' | 'system';
1482
+ fromAgentId?: string;
1483
+ /** The card it is about; for a `question`, the task an answer continues. */
1484
+ taskId?: string;
1485
+ /** The schedule and the run it reports, for `schedule`. */
1486
+ cronJobId?: string;
1487
+ cronRunId?: string;
1488
+ /** The conversation it came out of, when there is one - where a reply continues. */
1489
+ sessionId?: string;
1490
+ readAt?: number;
1491
+ archivedAt?: number;
1492
+ createdAt: number;
1493
+ }
1494
+ /**
1495
+ * What one line of a task's activity records.
1496
+ *
1497
+ * created the card was made; the text is the brief
1498
+ * run-started an agent started working on it (`assignmentId` is the run)
1499
+ * run-ended that run ended; the text says how, with its result
1500
+ * question the agent asked whoever asked for the work (`ask_requester`)
1501
+ * answer the requester answered (`answer_task`)
1502
+ * status the card moved to done, failed, cancelled or blocked
1503
+ * note anything else worth keeping on the card
1504
+ */
1505
+ export type TaskEventKind = 'created' | 'run-started' | 'run-ended' | 'question' | 'answer' | 'note' | 'status';
1506
+ /** Who wrote a task event. `system` is Rookery's own bookkeeping. */
1507
+ export type TaskEventActor = 'user' | 'assistant' | 'agent' | 'system';
1508
+ /**
1509
+ * One line of a task's activity - the card's own protocol, which replaces the
1510
+ * mail thread a task used to be negotiated in. Oldest first; nothing in it is
1511
+ * ever rewritten.
1512
+ */
1513
+ export interface TaskEvent {
1514
+ id: string;
1515
+ taskId: string;
1516
+ at: number;
1517
+ kind: TaskEventKind;
1518
+ actorKind: TaskEventActor;
1519
+ /** Set only when `actorKind` is 'agent'. */
1520
+ actorAgentId?: string;
1521
+ text: string;
1522
+ /** The run this line belongs to, when it belongs to one. */
1523
+ assignmentId?: string;
1524
+ }
1525
+ /**
1526
+ * `blocked` is the state a task is in while it waits for an answer: its run
1527
+ * ended with a question to whoever assigned it (`ask_requester`), so the work
1528
+ * is neither done nor failed. `answer_task` continues it.
1529
+ */
1530
+ export type TaskStatus = 'open' | 'planned' | 'running' | 'blocked' | 'done' | 'failed' | 'cancelled';
507
1531
  export type TaskPriority = 'low' | 'normal' | 'high';
508
1532
  /**
509
1533
  * A task on the company board.
@@ -530,6 +1554,24 @@ export interface Task {
530
1554
  assignmentId?: string;
531
1555
  createdBy: RequesterKind;
532
1556
  createdByAgentId?: string;
1557
+ /**
1558
+ * The schedule whose firing made this card, when one did.
1559
+ *
1560
+ * `createdBy` stays `user` for these: a schedule is not a fourth kind of
1561
+ * party, it is an arrangement the user made, and the work it produces is
1562
+ * theirs. This is what lets the board answer "why does this exist?" for a
1563
+ * card that appeared at three in the morning (decision E1 of
1564
+ * docs/concepts/work-as-one-surface.md).
1565
+ */
1566
+ scheduleId?: string;
1567
+ /**
1568
+ * The conversation this work was handed over from, when it was. Whoever
1569
+ * hands work off in the background is told how it ended, in that same
1570
+ * conversation (docs/concepts/delegation-report-back-and-chat-terminal.md,
1571
+ * R1). A card made inside another task has a `parentId` instead: its
1572
+ * report goes to that task, not past it.
1573
+ */
1574
+ requesterSessionId?: string;
533
1575
  /** Sibling task ids that must finish first. */
534
1576
  dependsOn: string[];
535
1577
  /** Why the planner decided what it decided. */
@@ -540,6 +1582,8 @@ export interface Task {
540
1582
  updatedAt: number;
541
1583
  startedAt?: number;
542
1584
  finishedAt?: number;
1585
+ /** Manual board position within its status column; drag&drop only. */
1586
+ sortOrder: number;
543
1587
  }
544
1588
  /**
545
1589
  * Who does the work when a schedule fires: the assistant itself, as a turn
@@ -554,8 +1598,17 @@ export interface CronScript {
554
1598
  noAgent?: boolean;
555
1599
  }
556
1600
  export type CronRunStatus = 'running' | 'done' | 'failed';
557
- /** Whether the clock started a run or somebody pressed "run now". */
558
- export type CronTrigger = 'schedule' | 'manual';
1601
+ /** What started a run: the clock, a person pressing "run now", or something that happened. */
1602
+ export type CronTrigger = 'schedule' | 'manual' | 'event';
1603
+ /**
1604
+ * Whether the clock fires a schedule at all.
1605
+ *
1606
+ * `schedule` is the original behaviour, and an event may fire such a job on
1607
+ * top - the clock is then the backstop for events that never arrived.
1608
+ * `event` means there is no clock: the job waits for a webhook call or a
1609
+ * heartbeat listener, and its `schedule` expression may be empty.
1610
+ */
1611
+ export type CronTriggerMode = 'schedule' | 'event';
559
1612
  /**
560
1613
  * A standing order: a prompt that runs on a cron schedule while the server
561
1614
  * is up. Times are the machine's local time; a five-field expression such as
@@ -565,8 +1618,22 @@ export interface CronJob {
565
1618
  id: string;
566
1619
  orgId: string;
567
1620
  name: string;
568
- /** Five-field cron expression, normalised. */
1621
+ /** Five-field cron expression, normalised; empty when only events fire this job. */
569
1622
  schedule: string;
1623
+ /** Whether the clock fires this job, or only an event does. */
1624
+ triggerMode: CronTriggerMode;
1625
+ /**
1626
+ * The secret an outside caller puts in the webhook URL to fire this job.
1627
+ * Unset while no webhook exists; one job, one secret, revocable on its own
1628
+ * without touching the server's shared token.
1629
+ */
1630
+ webhookToken?: string;
1631
+ /**
1632
+ * Shortest gap between two runs before an event may start another. An
1633
+ * event that arrives inside the gap is not dropped - it waits for the gap
1634
+ * to pass and then fires once, however many arrived meanwhile.
1635
+ */
1636
+ eventCooldownMs?: number;
570
1637
  kind: CronJobKind;
571
1638
  script?: CronScript;
572
1639
  /** Remaining attempts for a finite schedule; omitted means unlimited. */
@@ -609,7 +1676,38 @@ export interface CronRun {
609
1676
  sessionId?: string;
610
1677
  /** The assignment that ran, for the `agent` kind. */
611
1678
  assignmentId?: string;
1679
+ /**
1680
+ * What fired an `event` run, in words a person reads: `webhook` for a call
1681
+ * that came in over HTTP, or a listener's id such as `imap:work`. Unset for
1682
+ * the clock and for "run now", whose trigger already says everything.
1683
+ */
1684
+ source?: string;
612
1685
  }
1686
+ /**
1687
+ * What came of offering an event to a schedule.
1688
+ *
1689
+ * An event is never silently dropped: it either starts a run, joins the run
1690
+ * already under way, or waits for the cooldown to pass and fires once for all
1691
+ * the events that arrived meanwhile.
1692
+ */
1693
+ export type CronEventOutcome = {
1694
+ status: 'started';
1695
+ run: CronRun;
1696
+ }
1697
+ /** A run was already under way; one more follows when it finishes. */
1698
+ | {
1699
+ status: 'coalesced';
1700
+ }
1701
+ /** Inside the cooldown; it fires in `waitMs`. */
1702
+ | {
1703
+ status: 'queued';
1704
+ waitMs: number;
1705
+ }
1706
+ /** Nothing will happen, and why: unknown, switched off, or out of runs. */
1707
+ | {
1708
+ status: 'ignored';
1709
+ reason: string;
1710
+ };
613
1711
  /**
614
1712
  * Whole-database counts, every one of them a `COUNT(*)`.
615
1713
  *
@@ -689,10 +1787,54 @@ export interface StatsSnapshot {
689
1787
  export interface McpServerSpec {
690
1788
  /** Server name as the CLI sees it; tools become `mcp__<name>__<tool>`. */
691
1789
  name: string;
692
- command: string;
1790
+ /**
1791
+ * How the CLI reaches it. Absent means `stdio`, the only shape Rookery's
1792
+ * own catalogue produces; the hosted endpoints come in with the servers
1793
+ * read out of a Claude Code plugin (`context7`, `vercel`).
1794
+ */
1795
+ transport?: 'stdio' | 'http' | 'sse';
1796
+ /** stdio only. */
1797
+ command?: string;
693
1798
  args: string[];
694
1799
  env: Record<string, string>;
1800
+ /** http and sse only. */
1801
+ url?: string;
1802
+ headers?: Record<string, string>;
1803
+ }
1804
+ /**
1805
+ * One subagent type handed to the provider CLI for a single turn, as the file
1806
+ * it was approved from. The body never travels through argv: a Windows shim
1807
+ * spawn goes through `cmd.exe` in verbatim mode, where no escaping of ours can
1808
+ * guarantee that foreign text stays one argument, so the provider copies the
1809
+ * file into a generated plugin folder instead and points `--plugin-dir` at it.
1810
+ */
1811
+ export interface ProviderAgentFile {
1812
+ /** The name the model calls the subagent by, from the file's frontmatter. */
1813
+ name: string;
1814
+ /** The approved source file, copied verbatim at spawn time. */
1815
+ path: string;
1816
+ }
1817
+ /**
1818
+ * The settings document for one turn, written to a file and passed to
1819
+ * `--settings` by path. It carries Rookery's own `permissions.deny`
1820
+ * groundwork and nothing a plugin wrote: foreign text reaches the spawn
1821
+ * through files, never through this document. Left open on purpose - the
1822
+ * provider owns the schema, Rookery only assembles it.
1823
+ */
1824
+ export interface ProviderSettings {
1825
+ permissions?: {
1826
+ allow?: string[];
1827
+ ask?: string[];
1828
+ deny?: string[];
1829
+ };
1830
+ [key: string]: unknown;
695
1831
  }
1832
+ /**
1833
+ * Approved hook handlers for one turn, merged across sources into the
1834
+ * `hooks.json` of the generated plugin folder. Opaque on purpose: the table is
1835
+ * the plugin's own format, read back verbatim after the fingerprint matched.
1836
+ */
1837
+ export type ProviderHookTable = Record<string, unknown[]>;
696
1838
  export interface ProviderTurnOptions {
697
1839
  prompt: string;
698
1840
  /** Prepended context: persona, recalled memories, conversation digest. */
@@ -715,6 +1857,51 @@ export interface ProviderTurnOptions {
715
1857
  mcp?: McpServerSpec;
716
1858
  /** Further MCP servers for this turn, e.g. computer control. */
717
1859
  mcpExtra?: McpServerSpec[];
1860
+ /**
1861
+ * Subagent types for this turn, as approved files the provider copies into
1862
+ * its generated plugin folder. Empty or unset passes nothing, so the CLI
1863
+ * keeps whatever it would have had.
1864
+ */
1865
+ handoffAgents?: ProviderAgentFile[];
1866
+ /** Rookery's own permission floor for this turn, passed as a settings file. */
1867
+ settings?: ProviderSettings;
1868
+ /** Approved hook handlers for this turn, merged into the plugin folder. */
1869
+ hooks?: ProviderHookTable;
1870
+ /**
1871
+ * Plugin folders to load whole for this turn. A source loaded this way is
1872
+ * not additionally passed as curated skills, agents or hooks - otherwise
1873
+ * the same shelf would stand there twice.
1874
+ */
1875
+ pluginDirs?: string[];
1876
+ /**
1877
+ * Run Claude Code with its full TUI in a pseudo terminal instead of as a
1878
+ * headless print run (`providers/claude-tui.ts`). `key` names the terminal
1879
+ * - an assignment id - so the server can stream it to whoever watches.
1880
+ * Providers without a terminal, or a system without the pty binding,
1881
+ * ignore it and run headless.
1882
+ */
1883
+ /**
1884
+ * Point Claude Code at Rookery's model gateway instead of one backend
1885
+ * (`providers/model-gateway.ts`): every model Rookery knows becomes
1886
+ * reachable from the same process, and `picker` adds the ones that are not
1887
+ * Claude's to the TUI's `/model` menu. The Claude login still travels, so
1888
+ * Claude models stay on the person's own plan.
1889
+ */
1890
+ gateway?: {
1891
+ baseUrl: string;
1892
+ token: string;
1893
+ picker: {
1894
+ model: string;
1895
+ label: string;
1896
+ description?: string;
1897
+ }[];
1898
+ };
1899
+ tui?: {
1900
+ key: string;
1901
+ lingerMs?: number;
1902
+ /** What a person does in the terminal after the work was reported done. */
1903
+ onLateEvent?: (event: AgentEvent) => void;
1904
+ };
718
1905
  signal?: AbortSignal;
719
1906
  }
720
1907
  /**
@@ -737,8 +1924,36 @@ export interface ProviderModel {
737
1924
  description?: string;
738
1925
  isDefault?: boolean;
739
1926
  }
1927
+ /**
1928
+ * A configured alternative backend for the `claude` binary: same adapter,
1929
+ * same event parsing, just pointed at another Anthropic-compatible endpoint
1930
+ * via env vars. `authToken` is the only field never sent to the browser; see
1931
+ * `publicConfig` in the server package.
1932
+ */
1933
+ export interface ProviderProfile {
1934
+ /** Slug used as this profile's ProviderId, e.g. "glm". */
1935
+ id: string;
1936
+ displayName: string;
1937
+ /** Anthropic-Messages-compatible endpoint. */
1938
+ baseUrl: string;
1939
+ /** Stored the same way as `gateways.telegram.token`: empty string means unset. */
1940
+ authToken: string;
1941
+ defaultModel?: string;
1942
+ /**
1943
+ * `'direct'`: the endpoint speaks Anthropic Messages natively (z.ai, Moonshot,
1944
+ * MiniMax, ...). `'router'`: reach it through the Rookery-managed
1945
+ * `claude-code-router` process instead, for backends with no native
1946
+ * Anthropic-compatible API (OpenRouter, DeepSeek, Ollama, ...).
1947
+ * `'codex-bridge'`: Rookery's own in-process bridge, which serves the
1948
+ * ChatGPT Codex backend as Anthropic Messages on the session `codex login`
1949
+ * created - a subscription rather than an API key.
1950
+ */
1951
+ via: 'direct' | 'router' | 'codex-bridge';
1952
+ }
740
1953
  export interface ProviderStatus {
741
1954
  id: ProviderId;
1955
+ /** For a UI rendering an id it has no hardcoded label for, e.g. a profile. */
1956
+ displayName: string;
742
1957
  available: boolean;
743
1958
  binary: string;
744
1959
  version?: string;
@@ -755,6 +1970,67 @@ export interface Provider {
755
1970
  run(options: ProviderTurnOptions): AsyncGenerator<AgentEvent, void, unknown>;
756
1971
  /** Models this provider accepts, for UI pickers. */
757
1972
  models(): string[] | Promise<ProviderModel[]>;
1973
+ /**
1974
+ * Open a conversation in the provider's own interactive terminal instead
1975
+ * of running one turn: no prompt, no end, every answer reported through
1976
+ * `handlers`. `options.tui.key` names the terminal; `options.prompt` is
1977
+ * ignored. Absent on providers without a terminal.
1978
+ */
1979
+ openTerminal?(options: ProviderTurnOptions, handlers: ProviderTerminalHandlers): Promise<{
1980
+ providerSessionId: string;
1981
+ terminal: ConversationTerminalHandle;
1982
+ }>;
1983
+ }
1984
+ /** One message Rookery typed into a conversation terminal, and how it ended. */
1985
+ export interface ConversationTerminalTurn {
1986
+ prompt: string;
1987
+ answer: string;
1988
+ /** Text, thinking and tool events of the turn, in order. */
1989
+ events: AgentEvent[];
1990
+ model?: string;
1991
+ providerSessionId: string;
1992
+ usage: TurnUsage;
1993
+ /** Stopped with Esc before Claude Code said it was done. */
1994
+ interrupted?: boolean;
1995
+ error?: string;
1996
+ }
1997
+ /**
1998
+ * A conversation's Claude Code process, as the runtime drives it: every chat
1999
+ * message is typed into it, and a person may type into it too
2000
+ * (docs/concepts/delegation-report-back-and-chat-terminal.md, T1).
2001
+ */
2002
+ export interface ConversationTerminalHandle {
2003
+ readonly key: string;
2004
+ readonly providerSessionId: string;
2005
+ /** A submitted message is being answered right now. */
2006
+ readonly busy: boolean;
2007
+ alive(): boolean;
2008
+ close(): void;
2009
+ /** Resolves once nothing is being answered - by Rookery or a person - or after a long wait. */
2010
+ whenIdle(): Promise<void>;
2011
+ submit(input: {
2012
+ prompt: string;
2013
+ /** Handed to Claude Code for this message only, through the prompt hook. */
2014
+ context?: string;
2015
+ onEvent: (event: AgentEvent) => void;
2016
+ signal?: AbortSignal;
2017
+ }): Promise<ConversationTerminalTurn>;
2018
+ }
2019
+ /** What a conversation terminal reports while it is open. */
2020
+ export interface ProviderTerminalHandlers {
2021
+ /** After every answer: what was typed since the last one, and the answer. */
2022
+ onTurn(turn: {
2023
+ prompt: string;
2024
+ answer: string;
2025
+ /** Text, thinking and tool events of the turn, in order. */
2026
+ events: AgentEvent[];
2027
+ /** The model that answered, as the transcript names it - `/model` may have changed it. */
2028
+ model?: string;
2029
+ providerSessionId: string;
2030
+ usage: TurnUsage;
2031
+ }): void;
2032
+ /** The process is gone, however it ended. */
2033
+ onExit(): void;
758
2034
  }
759
2035
  export interface RookeryConfig {
760
2036
  /** Root for db, logs and config. Defaults to ~/.rookery */
@@ -779,10 +2055,26 @@ export interface RookeryConfig {
779
2055
  voice: VoiceConfig;
780
2056
  org: OrgConfig;
781
2057
  gateways: GatewaysConfig;
2058
+ /** Connections held open so a schedule can react instead of poll. */
2059
+ listeners: ListenersConfig;
782
2060
  /** The MCP hub: which servers run for whom. */
783
2061
  tools: ToolsConfig;
2062
+ /** What is taken over from the Claude Code installed here. */
2063
+ external: ExternalConfig;
2064
+ /** How long the assistant waits when it asks the user something. */
2065
+ questions: QuestionsConfig;
2066
+ /** Hard stop for one conversational turn. */
2067
+ turns: TurnsConfig;
784
2068
  /** Where skills live, one folder per skill. Defaults to `<home>/skills`. */
785
2069
  skillsDir: string;
2070
+ /** Alternative backends for the `claude` binary. Empty by default: opt-in per provider. */
2071
+ providerProfiles: ProviderProfile[];
2072
+ /** The Rookery-managed `claude-code-router` process, used by `via: 'router'` profiles. */
2073
+ router: RouterConfig;
2074
+ /** Switching providers when one runs low on quota. */
2075
+ providerFallback: ProviderFallbackConfig;
2076
+ /** Whether Rookery looks for, and installs, new releases from npm. */
2077
+ updates: UpdatesConfig;
786
2078
  /** Name the assistant answers to, used in the persona and as wake word base. */
787
2079
  assistantName: string;
788
2080
  userName?: string;
@@ -791,6 +2083,21 @@ export interface RookeryConfig {
791
2083
  /** What the assistant calls the user now and then, e.g. "Master" or "Sir". Empty: the name. */
792
2084
  honorific: string;
793
2085
  }
2086
+ /**
2087
+ * Routing around a provider whose quota is running out: one that reports a
2088
+ * window this full is avoided while a roomier one is signed in, and one whose
2089
+ * turn died on a usage limit is left alone until the window resets.
2090
+ */
2091
+ export interface ProviderFallbackConfig {
2092
+ enabled: boolean;
2093
+ /** A window at or above this share of its quota counts as "running low". */
2094
+ thresholdPercent: number;
2095
+ /**
2096
+ * Which provider to try after the preferred one, in this order. Empty: the
2097
+ * preferred provider, then the rest as they were configured.
2098
+ */
2099
+ order: ProviderId[];
2100
+ }
794
2101
  export interface MemoryConfig {
795
2102
  enabled: boolean;
796
2103
  /** Max memories injected into a single turn's context. */
@@ -807,6 +2114,13 @@ export interface MemoryConfig {
807
2114
  gate: MemoryGateConfig;
808
2115
  /** The second hop: how far recall reaches past a literal match. */
809
2116
  graph: MemoryGraphConfig;
2117
+ /**
2118
+ * The dream: recording and replaying recall so the night can measure the
2119
+ * retrieval policy, and - stage 2 on - promoting what measurably wins.
2120
+ * Every switch ships off (`enabled`, `record`, `promote`); this stage
2121
+ * delivers the machine, not its start (concept 11, plan section 1.2).
2122
+ */
2123
+ dream: DreamConfig;
810
2124
  /** The nightly clean-up. */
811
2125
  sleep: SleepConfig;
812
2126
  }
@@ -828,20 +2142,146 @@ export interface MemoryGraphConfig {
828
2142
  /** Hard cap on nodes handed to the graph view. */
829
2143
  maxNodes: number;
830
2144
  }
2145
+ /**
2146
+ * The dream's own settings, beside `memory.sleep`. Every key names its
2147
+ * reader - the key table sits above the `dream:` block in config.ts - and a
2148
+ * key without a reader does not ship (E20). Stage 2 adds the keys the
2149
+ * candidate writer, the evaluation machinery and the promotion gate read;
2150
+ * see docs/concepts/dream-stage2plus-buildplan.md section 3, AP2.
2151
+ */
2152
+ export interface DreamConfig {
2153
+ /** The whole dream. Off means: no recorder, no night probe. */
2154
+ enabled: boolean;
2155
+ /** Only the recorder. Separate, so it can be switched off without losing the night. */
2156
+ record: boolean;
2157
+ /**
2158
+ * The promotion gate. Off means: the night still measures and writes
2159
+ * `dream_evals`, but never touches `policy_versions` (concept 10.2,
2160
+ * condition 8; E20/E22 - this stage ships it off).
2161
+ */
2162
+ promote: boolean;
2163
+ /** Share of sessions that get framed at all. Drawn per session, never per trace. */
2164
+ frameRate: number;
2165
+ /** The most permissive corner: up to which `limit` a frame stays replayable. */
2166
+ limitMax: number;
2167
+ /** The grid: fixed placements the night scores against the incumbent. */
2168
+ gridSize: number;
2169
+ /** Weight of the cost term in the block measure. */
2170
+ costWeight: number;
2171
+ /** Relative change in the frame tokens' document frequency at which a trace abstains. */
2172
+ corpusTolerance: number;
2173
+ /** Hard ceiling on frame size in bytes; above it, nothing is framed. */
2174
+ maxFrameBytes: number;
2175
+ /** Wall-clock ceiling for the model-free night evaluation, in milliseconds. */
2176
+ maxEvalMs: number;
2177
+ /** Retention for frames (large, kept only for replay). */
2178
+ frameRetainDays: number;
2179
+ /** Retention for traces and touches (small, they carry the calibration). */
2180
+ retainDays: number;
2181
+ /**
2182
+ * Run-global ceiling over all owners. Zero in stage 1, where nothing spent
2183
+ * a call; from stage 2 on the candidate writer does, so this is the wallet
2184
+ * for it (concept 9.4).
2185
+ */
2186
+ maxCallsPerNight: number;
2187
+ /** Which slots the night carries a policy for. Stage 2 ships `['recall']` alone. */
2188
+ slots: DreamSlot[];
2189
+ /** Candidates the candidate writer proposes per slot per night (concept 6.2). */
2190
+ candidates: number;
2191
+ /** Model for the candidate writer. Never `smallModelFor`/`ask`'s wired `'low'` effort (S16). */
2192
+ model: string;
2193
+ /** Reasoning effort for that same caller. Never `'low'`: designing a policy is judgement (E14). */
2194
+ effort: 'medium' | 'high';
2195
+ /** Below this many closed traces (post-intersection), an evaluation is invalid, not lost (validity rule 3). */
2196
+ minTraces: number;
2197
+ /** Promotion needs `delta > margin` on the holdout, and the freshness check's sign-agreement tolerance. */
2198
+ margin: number;
2199
+ /** Below this `label_coverage`, an evaluation is invalid (concept 4.4). */
2200
+ coverageFloor: number;
2201
+ /** Above this `cost_only_share`, an evaluation is invalid (concept 4.4). */
2202
+ costOnlyCeiling: number;
2203
+ /** Candidate abstain rate may exceed the baseline's by at most this (validity rule 2). */
2204
+ abstainEps: number;
2205
+ /** Both arms' abstain rate must stay under this (validity rule 2). */
2206
+ abstainFloor: number;
2207
+ /** Below this mean `reachable_rate`, an evaluation is invalid (validity rule 4). */
2208
+ reachableFloor: number;
2209
+ /**
2210
+ * Below this precision, the `correction` label source is not a source
2211
+ * (concept 4.2a) - the fallback is `labelModelCalls` below.
2212
+ */
2213
+ correctionPrecisionFloor: number;
2214
+ /** Model calls spent labelling corrections directly, when precision falls short. Zero: modelfree. */
2215
+ labelModelCalls: number;
2216
+ /** Milliseconds: the session window a `user` label's HTTP edit is attributed over (concept 4.2b). */
2217
+ userLabelWindow: number;
2218
+ /** Below this Cohen's kappa between label sources, the label agreement check is unvalidated (concept 5.5b). */
2219
+ agreementFloor: number;
2220
+ /** Traces after promotion before the wake test's regression alarm runs (concept 5.5c). */
2221
+ calibrationTraces: number;
2222
+ /** Replay-vs-online score drift the wake test tolerates before it freezes the slot. */
2223
+ tolerance: number;
2224
+ /** Nights a slot must wait between promotions (concept 5.3, `trace_set_hash` disjointness). */
2225
+ cooldownNights: number;
2226
+ /** Hard cap on promotions per night, across every slot (concept 10.2, condition 8). */
2227
+ maxPromotionsPerNight: number;
2228
+ /** Share of nights that spend a free exploration instead of a promotion attempt (E17). Zero: none. */
2229
+ explorationRate: number;
2230
+ /**
2231
+ * Trial episodes for Phase 6's first-divergence evaluation. Zero in this
2232
+ * stage on purpose (concept 11, Phase 6; plan section 1.2): the mechanism
2233
+ * ships, its validation gate does not open itself.
2234
+ */
2235
+ trialEpisodes: number;
2236
+ }
831
2237
  export interface SleepConfig {
832
2238
  enabled: boolean;
833
2239
  /** Five-field cron expression for the nightly run. */
834
2240
  schedule: string;
835
2241
  /** Which banks sleep: only the assistant's, or every agent's too. */
836
2242
  scope: 'assistant' | 'all';
837
- /** Upper bound on condensation calls per night. */
2243
+ /**
2244
+ * Hard cap on the night's expensive model calls across the consolidation
2245
+ * phases (condense, resolve, link, reflect, revise, practise). The budget
2246
+ * is not spent by the clock: each phase first measures how much work there
2247
+ * actually is, and only that demand is funded, up to this ceiling. A quiet
2248
+ * week costs a few calls; a loud one runs until the cap. The replay pass
2249
+ * sits outside the wallet - it is bounded by `replaySessions`, and its
2250
+ * cheap triage pass does not count against anything.
2251
+ */
2252
+ nightBudget: number;
2253
+ /** Ceiling on condensation calls per night; the adaptive budget may spend less. */
838
2254
  maxMergeCalls: number;
2255
+ /** Ceiling on the calls that draw new edges between memories. */
2256
+ maxLinkCalls: number;
839
2257
  /** Untouched for this long and weak enough, a memory goes dormant. */
840
2258
  dormantAfterDays: number;
841
2259
  /** Blended strength below which a memory may be put to sleep. */
842
2260
  minStrength: number;
843
2261
  /** How many insights one night may write. */
844
2262
  insights: number;
2263
+ /** How far back the insight phase looks for a pattern. */
2264
+ insightWindowDays: number;
2265
+ /**
2266
+ * How many skills one night may write. A memory says what is true; a skill
2267
+ * says how something is done, and the night is where the second is
2268
+ * distilled out of the first. Zero switches the distillation off and leaves
2269
+ * skill writing to the `write_skill` tool alone.
2270
+ */
2271
+ skills: number;
2272
+ /**
2273
+ * How many of the day's conversations one night may read in full. A cheap
2274
+ * model sorts them first, so this caps only the expensive half: the deep
2275
+ * read of the ones that looked like they held something.
2276
+ */
2277
+ replaySessions: number;
2278
+ /**
2279
+ * How many skills one night may rewrite. Deliberately larger than
2280
+ * `skills`: a procedure that has gone wrong costs more than a procedure
2281
+ * that was never written, so repair outranks invention and runs first.
2282
+ * Zero switches the revision pass off.
2283
+ */
2284
+ skillRevisions: number;
845
2285
  /**
846
2286
  * How often the three stages repeat in one night. More than one because
847
2287
  * deep sleep changes what dream sleep has to work with.
@@ -902,6 +2342,121 @@ export interface ToolServerConfig {
902
2342
  export interface ToolsConfig {
903
2343
  servers: ToolServerConfig[];
904
2344
  }
2345
+ /**
2346
+ * The locally managed `claude-code-router` process. Only started when at
2347
+ * least one enabled `ProviderProfile` has `via: 'router'`.
2348
+ */
2349
+ export interface RouterConfig {
2350
+ enabled: boolean;
2351
+ /** Defaults to the router's own default port, 3456. */
2352
+ port?: number;
2353
+ }
2354
+ /**
2355
+ * What Rookery takes over from the Claude Code installed beside it.
2356
+ *
2357
+ * Claude Code already carries a curated set of skills, plugins and MCP
2358
+ * servers on this machine, and Rookery runs on its session anyway. This
2359
+ * block is the consent layer in front of that: reading is always safe, but a
2360
+ * skills shelf of three hundred entries and a server that starts a process
2361
+ * are not things that arrive unannounced. Rookery never writes back into
2362
+ * `~/.claude`.
2363
+ */
2364
+ /**
2365
+ * One decision about something found in that installation. The fingerprint is
2366
+ * taken over the definition at the moment of approval, so anything edited in
2367
+ * `~/.claude` afterwards goes inactive until a person looks at it again - the
2368
+ * rule `servers` already follows, spelled out once for everything else.
2369
+ */
2370
+ export interface ExternalApproval {
2371
+ enabled: boolean;
2372
+ audience: ToolServerAudience;
2373
+ fingerprint: string;
2374
+ }
2375
+ export interface ExternalConfig {
2376
+ /** Look at that installation at all. */
2377
+ enabled: boolean;
2378
+ /**
2379
+ * Source id (`claude-code:home`, `claude-code:plugin/ecc@ecc`) to whether
2380
+ * its skills are available. A source nobody decided about follows the
2381
+ * default in `sourceEnabled`: Claude Code's own folder yes, a plugin no.
2382
+ */
2383
+ skillSources: Record<string, boolean>;
2384
+ /**
2385
+ * Discovered MCP server id to what was decided about it. The fingerprint is
2386
+ * over the start definition at the time of approval, so an edit in Claude
2387
+ * Code's own configuration takes the server out of service until a person
2388
+ * looks at it again.
2389
+ */
2390
+ servers: Record<string, {
2391
+ enabled: boolean;
2392
+ audience: ToolServerAudience;
2393
+ projectIds?: string[];
2394
+ fingerprint: string;
2395
+ }>;
2396
+ /**
2397
+ * Discovered subagent id (`<sourceId>/<name>`) to what was decided about
2398
+ * it. Nothing is on until somebody says so: a subagent carries a system
2399
+ * prompt and a tool list into a turn Rookery otherwise composes itself.
2400
+ */
2401
+ agents: Record<string, ExternalApproval>;
2402
+ /**
2403
+ * Hook-set id to what was decided about it. Off everywhere by default and
2404
+ * meant to stay that way for agents: a hook is a command line that runs
2405
+ * around every tool call of an unattended run, so it is approved per source
2406
+ * *and* per audience, and the assistant gets the first try, not the agents.
2407
+ */
2408
+ hooks: Record<string, ExternalApproval>;
2409
+ /**
2410
+ * Source id to the "load the whole plugin" switch, for a plugin that is
2411
+ * trusted outright. With `loadWhole` on, the source is handed to the CLI as
2412
+ * a plugin directory and its curated skills, agents and hooks are *not*
2413
+ * passed a second time.
2414
+ */
2415
+ plugins: Record<string, ExternalApproval & {
2416
+ loadWhole: boolean;
2417
+ }>;
2418
+ }
2419
+ /** The `ask_user` tool: how long a question stays open. */
2420
+ /**
2421
+ * Self-updating from the npm registry. `notify` only says a release exists;
2422
+ * `auto` also installs it, but only while nothing is running - no turn, no
2423
+ * agent run, no schedule - because installing restarts the server.
2424
+ */
2425
+ export interface UpdatesConfig {
2426
+ mode: 'off' | 'notify' | 'auto';
2427
+ /** npm dist-tag to follow: `latest` for releases, `next` for pre-releases. */
2428
+ channel: 'latest' | 'next';
2429
+ }
2430
+ export interface QuestionsConfig {
2431
+ /**
2432
+ * Milliseconds a question waits before it resolves itself as unanswered
2433
+ * and the turn carries on. Has to stay well under the provider's own MCP
2434
+ * tool timeout (six hours for Claude Code), or the call the question is
2435
+ * blocking dies before the question can give up.
2436
+ */
2437
+ timeoutMs: number;
2438
+ }
2439
+ /** One conversational turn: the ceiling nothing else was giving it. */
2440
+ export interface TurnsConfig {
2441
+ /**
2442
+ * Milliseconds one turn may run before it is stopped.
2443
+ *
2444
+ * Runs and schedules both had a hard stop; a turn had none, so one that
2445
+ * got into a tool loop ran until the provider process ended by itself.
2446
+ * Over `POST /api/chat` there was not even a way to interrupt it - that
2447
+ * route passes no abort signal. Set wide: this is a backstop for turns
2448
+ * that are never coming back, not a limit on how long a person may think.
2449
+ */
2450
+ timeoutMs: number;
2451
+ /**
2452
+ * Ordinary conversations are answered in their Claude Code terminal - one
2453
+ * process per chat, typed into for every message, the same one the
2454
+ * terminal view shows (docs/concepts/delegation-report-back-and-chat-terminal.md,
2455
+ * T1). Off, every turn is a headless print run again, and the terminal view
2456
+ * opens a process of its own on the same session.
2457
+ */
2458
+ terminal: boolean;
2459
+ }
905
2460
  export interface OrgConfig {
906
2461
  /** Provider processes that may run assignments at the same time. */
907
2462
  maxConcurrentAssignments: number;
@@ -909,6 +2464,15 @@ export interface OrgConfig {
909
2464
  maxDelegationDepth: number;
910
2465
  /** Hard stop for a single assignment, in milliseconds. */
911
2466
  assignmentTimeoutMs: number;
2467
+ /**
2468
+ * How many times work may re-run one task on the machine's own
2469
+ * initiative - an agent's reply in the task's own thread being the only
2470
+ * such path today. A person asking for another run is never counted
2471
+ * against it: the limit exists so a deterministic failure cannot cost a
2472
+ * model run every time it recurs, not to stop anyone from retrying
2473
+ * something.
2474
+ */
2475
+ maxTaskRuns: number;
912
2476
  /**
913
2477
  * Put the Ponytail ruleset (org/ponytail.ts) into every agent's system
914
2478
  * prompt: understand the problem, then stop at the first rung of the
@@ -917,9 +2481,91 @@ export interface OrgConfig {
917
2481
  * judgement.
918
2482
  */
919
2483
  lazyCoding: boolean;
2484
+ /**
2485
+ * Jarvis's own judgment of every finished assignment, one model call in
2486
+ * the background (agent-performance-management, phase 2). On by default;
2487
+ * off leaves only the automatic `system` review that hard failures write
2488
+ * with no model call at all.
2489
+ */
2490
+ autoReview: boolean;
2491
+ /**
2492
+ * Whether a stage-2 escalation may rewrite an agent's standing
2493
+ * instructions by itself, or only propose the rewrite and wait.
2494
+ *
2495
+ * Off by default, and that is the deliberate answer to the open question
2496
+ * in agent-performance-management O2: a role description is something the
2497
+ * user wrote, and having it replaced overnight by a model's judgment of
2498
+ * another model's output is the kind of change that has to be seen before
2499
+ * it takes effect. Off, the drafted text is filed as a
2500
+ * `reconfig-proposal` the agent's page offers for approval; the agent
2501
+ * keeps working to its current instructions until somebody accepts it.
2502
+ */
2503
+ autoReconfig: boolean;
2504
+ /**
2505
+ * On, a mail-born run writes its result as a letter in the agent's own
2506
+ * voice instead of a report (decision E10, section 6.3). Off restores
2507
+ * today's report register everywhere, unconditionally. Global, not
2508
+ * per-agent (decision E6/F6): the tone is a property of the company.
2509
+ * @deprecated Ignored since mail was removed - there are no mail-born runs
2510
+ * left to write letters. Kept so an existing config file still loads.
2511
+ */
2512
+ roleplay: boolean;
2513
+ /**
2514
+ * Agents work in a visible Claude Code terminal (the full TUI in a pseudo
2515
+ * terminal, watchable and typeable from the run page) rather than as a
2516
+ * headless print run. The result is the same either way; off saves the
2517
+ * terminal's memory and the minutes it stays open after the work.
2518
+ */
2519
+ interactiveRuns: boolean;
920
2520
  /** Explicitly chosen company; the newest one otherwise. */
921
2521
  activeOrganizationId?: string;
922
2522
  }
2523
+ /**
2524
+ * What a listener watches. Only mailboxes so far.
2525
+ *
2526
+ * A listener is the other half of an event-driven schedule: it holds one
2527
+ * connection open, waits for something to happen, and fires a schedule when
2528
+ * it does. Where a gateway carries a conversation, a listener carries a
2529
+ * single fact - "something changed" - and the schedule decides what that is
2530
+ * worth.
2531
+ */
2532
+ export type ListenerKind = 'imap';
2533
+ export interface ListenersConfig {
2534
+ /** Mailboxes watched over IMAP, one entry per account. */
2535
+ imap: ImapListenerConfig[];
2536
+ }
2537
+ /**
2538
+ * One watched mailbox.
2539
+ *
2540
+ * IMAP has no webhook and never will; what it has is IDLE, a connection the
2541
+ * server holds open and speaks into the moment mail arrives. That is why this
2542
+ * is a listener rather than a schedule: the waiting costs one socket, not one
2543
+ * model call every few minutes.
2544
+ */
2545
+ export interface ImapListenerConfig {
2546
+ /** Stable name, chosen by whoever adds it; runs record it as `imap:<id>`. */
2547
+ id: string;
2548
+ /** Off by default: this holds a password and opens a connection. */
2549
+ enabled: boolean;
2550
+ host: string;
2551
+ port: number;
2552
+ /** TLS from the first byte, the usual 993. Off means STARTTLS on 143. */
2553
+ secure: boolean;
2554
+ user: string;
2555
+ /**
2556
+ * The mailbox password. It lives here for the same reason the bot token
2557
+ * does (see `TelegramGatewayConfig.token`): local user state a person must
2558
+ * be able to set from the page that exists to set it.
2559
+ *
2560
+ * It must never reach a browser. `publicConfig` blanks it on the way out,
2561
+ * and a listener's status reports only whether one is present.
2562
+ */
2563
+ password: string;
2564
+ /** Which mailbox to watch. */
2565
+ mailbox: string;
2566
+ /** The schedule this listener fires when something arrives. */
2567
+ jobId: string;
2568
+ }
923
2569
  /** Which chat gateway a config section belongs to. Only Telegram for now. */
924
2570
  export type GatewayId = 'telegram';
925
2571
  export interface GatewaysConfig {
@@ -964,14 +2610,132 @@ export interface TelegramGatewayConfig {
964
2610
  /** Rights for turns that arrive through this channel. */
965
2611
  permission: PermissionLevel;
966
2612
  model?: string;
2613
+ /**
2614
+ * Photos, voice notes, documents: taken in and handed to the turn, or
2615
+ * dropped in silence the way everything non-textual used to be. Off is the
2616
+ * cautious setting, not the safe one - what arrives is still only ever a
2617
+ * file the allowlist itself sent.
2618
+ */
2619
+ media: boolean;
2620
+ /** Which engine turns a voice note into words. See `TranscribeEngine`. */
2621
+ transcribe: TranscribeEngine;
2622
+ /**
2623
+ * The local Whisper model, used by `local` and as `auto`'s last resort.
2624
+ * `base` is the balance that holds on a laptop; `small` hears more and
2625
+ * takes about four times as long.
2626
+ */
2627
+ transcribeModel: string;
2628
+ /**
2629
+ * Largest attachment accepted, in MB. Telegram's own bot download ceiling
2630
+ * is 20 MB, so anything above that is a promise the Bot API cannot keep.
2631
+ */
2632
+ maxAttachmentMb: number;
2633
+ /**
2634
+ * Write the answer as it is produced, by rewriting one message, instead of
2635
+ * sending it whole at the end. Telegram has no streaming of its own; this
2636
+ * is `editMessageText` on a timer, and the timer is why it can be switched
2637
+ * off - a slow line or a rate-limited account is better served by one
2638
+ * message that arrives once.
2639
+ */
2640
+ stream: boolean;
967
2641
  push: TelegramPushConfig;
968
2642
  }
2643
+ /**
2644
+ * Where speech becomes text.
2645
+ *
2646
+ * auto - a configured key first (OpenAI, then ElevenLabs), the local
2647
+ * model when there is none or the key fails. The default, and
2648
+ * the only value that cannot end in "no engine available".
2649
+ * local - Whisper on this machine through `@huggingface/transformers`.
2650
+ * No key, no account, no audio leaving the house; the model is
2651
+ * fetched once and cached under `<home>/models`.
2652
+ * openai - gpt-4o-mini-transcribe. Needs the OpenAI key the voice page
2653
+ * already stores.
2654
+ * elevenlabs - Scribe v1. Needs the ElevenLabs key.
2655
+ * off - a voice note arrives as a file and nothing more.
2656
+ */
2657
+ export type TranscribeEngine = 'auto' | 'local' | 'openai' | 'elevenlabs' | 'off';
2658
+ /**
2659
+ * What kind of file came in. The distinction is not cosmetic: it decides
2660
+ * whether the turn gets a transcript (anything with a sound track), a path
2661
+ * to look at (a photo), or a path to open (a document).
2662
+ */
2663
+ export type GatewayAttachmentKind = 'photo' | 'voice' | 'audio' | 'video' | 'video_note' | 'animation' | 'document' | 'sticker';
2664
+ /**
2665
+ * One file hanging off an incoming message, as the guard reports it.
2666
+ *
2667
+ * Still only a reference: `fileId` is Telegram's handle, and nothing has
2668
+ * been downloaded at this point. Every field beyond the id and the kind is
2669
+ * optional because it comes from foreign JSON - a missing `mime` is normal,
2670
+ * a missing `size` means Telegram did not say, and neither may be asserted.
2671
+ */
2672
+ export interface GatewayAttachment {
2673
+ kind: GatewayAttachmentKind;
2674
+ fileId: string;
2675
+ /** Stable across bots and re-sends; the key for "this is the same file". */
2676
+ uniqueId?: string;
2677
+ mime?: string;
2678
+ fileName?: string;
2679
+ /** Bytes, as Telegram reports them. */
2680
+ size?: number;
2681
+ /** Seconds, for anything with a sound track. */
2682
+ duration?: number;
2683
+ }
969
2684
  export interface TelegramPushConfig {
970
2685
  enabled: boolean;
971
2686
  assignments: boolean;
972
2687
  cron: boolean;
2688
+ /** Also governs `sleep` notifications (a promoted retrieval policy). */
973
2689
  sleep: boolean;
2690
+ /** Also governs `task` notifications: a card the user asked for ended. */
974
2691
  tasks: boolean;
2692
+ /**
2693
+ * `schedule` and `watch` notifications: a schedule's outcome - agent jobs
2694
+ * included, whoever the agent is - and what the board watcher reports.
2695
+ * Read from `mail` when an old config file has no such key yet.
2696
+ */
2697
+ schedules: boolean;
2698
+ /**
2699
+ * `question` notifications. Always true: a question is never silent, and
2700
+ * the switch exists only so the settings page can show that it is on.
2701
+ */
2702
+ questions: boolean;
2703
+ /**
2704
+ * `agent` notifications - what an agent writes with `report_to_user`:
2705
+ * only from leads (a team lead, or anyone with reports), from every agent,
2706
+ * or never. Read from `mail`/`mailFrom` when an old config file has no such
2707
+ * key yet.
2708
+ */
2709
+ agents: 'leads' | 'all' | 'off';
2710
+ /**
2711
+ * Mail the user is To or Cc on, pushed to the phone. See `mailFrom`.
2712
+ * @deprecated Mail was removed; only read as the fallback for `schedules`
2713
+ * and `agents` in an old config file.
2714
+ */
2715
+ mail: boolean;
2716
+ /**
2717
+ * The running commentary the web app shows as toasts: a memory stored, a
2718
+ * skill written, an agent or a project saved. Off by default - this is a
2719
+ * line per thing that happens, and the phone is not a log viewer - but on
2720
+ * it is the closest thing to watching over the assistant's shoulder.
2721
+ */
2722
+ activity: boolean;
2723
+ /**
2724
+ * Every tool the assistant reaches for, one short line each, batched.
2725
+ * Louder than `activity` by an order of magnitude, and never buffered:
2726
+ * when it is quiet hours these are dropped rather than delivered later,
2727
+ * because a tool call from this morning is not news.
2728
+ */
2729
+ tools: boolean;
2730
+ /**
2731
+ * Which senders a mail push is worth it for. 'assistant' is the quiet
2732
+ * default: the assistant is the only one who writes to the user on their
2733
+ * own initiative anyway. 'leads' adds the agents named as a team's lead,
2734
+ * so a team reaches the user through one voice; 'all' pushes every mail
2735
+ * that lands in the user's mailbox, which is what the web inbox is for.
2736
+ * @deprecated Mail was removed; only read as the fallback for `agents`.
2737
+ */
2738
+ mailFrom: 'assistant' | 'leads' | 'all';
975
2739
  /** "22:00"; empty means no quiet hours. */
976
2740
  quietFrom: string;
977
2741
  /** "08:00" */