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