rookery-agent 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (670) hide show
  1. package/README.md +467 -367
  2. package/docs/migration.md +88 -88
  3. package/docs/updates.md +112 -0
  4. package/package.json +13 -3
  5. package/packages/cli/dist/commands/config.js +2 -2
  6. package/packages/cli/dist/commands/doctor.d.ts.map +1 -1
  7. package/packages/cli/dist/commands/doctor.js +13 -9
  8. package/packages/cli/dist/commands/doctor.js.map +1 -1
  9. package/packages/cli/dist/commands/memory.js +1 -1
  10. package/packages/cli/dist/commands/org.d.ts +2 -2
  11. package/packages/cli/dist/commands/org.d.ts.map +1 -1
  12. package/packages/cli/dist/commands/org.js +19 -17
  13. package/packages/cli/dist/commands/org.js.map +1 -1
  14. package/packages/cli/dist/commands/serve.js +1 -1
  15. package/packages/cli/dist/commands/serve.js.map +1 -1
  16. package/packages/cli/dist/commands/shared.d.ts.map +1 -1
  17. package/packages/cli/dist/commands/shared.js +2 -1
  18. package/packages/cli/dist/commands/shared.js.map +1 -1
  19. package/packages/cli/dist/commands/tasks.d.ts.map +1 -1
  20. package/packages/cli/dist/commands/tasks.js +25 -11
  21. package/packages/cli/dist/commands/tasks.js.map +1 -1
  22. package/packages/cli/dist/commands/tools.js +1 -1
  23. package/packages/cli/dist/commands/tools.js.map +1 -1
  24. package/packages/cli/dist/index.js +13 -13
  25. package/packages/cli/dist/index.js.map +1 -1
  26. package/packages/cli/dist/repl.d.ts +12 -0
  27. package/packages/cli/dist/repl.d.ts.map +1 -1
  28. package/packages/cli/dist/repl.js +170 -16
  29. package/packages/cli/dist/repl.js.map +1 -1
  30. package/packages/cli/dist/tui/App.d.ts +7 -3
  31. package/packages/cli/dist/tui/App.d.ts.map +1 -1
  32. package/packages/cli/dist/tui/App.js +182 -16
  33. package/packages/cli/dist/tui/App.js.map +1 -1
  34. package/packages/cli/dist/tui/commands.d.ts +7 -0
  35. package/packages/cli/dist/tui/commands.d.ts.map +1 -1
  36. package/packages/cli/dist/tui/commands.js +70 -8
  37. package/packages/cli/dist/tui/commands.js.map +1 -1
  38. package/packages/cli/dist/tui/components/AssignmentsView.js +4 -4
  39. package/packages/cli/dist/tui/components/AssignmentsView.js.map +1 -1
  40. package/packages/cli/dist/tui/components/Banner.d.ts +11 -2
  41. package/packages/cli/dist/tui/components/Banner.d.ts.map +1 -1
  42. package/packages/cli/dist/tui/components/Banner.js +7 -10
  43. package/packages/cli/dist/tui/components/Banner.js.map +1 -1
  44. package/packages/cli/dist/tui/components/CodeBlock.js +2 -2
  45. package/packages/cli/dist/tui/components/CodeBlock.js.map +1 -1
  46. package/packages/cli/dist/tui/components/InputBox.d.ts.map +1 -1
  47. package/packages/cli/dist/tui/components/InputBox.js +4 -4
  48. package/packages/cli/dist/tui/components/InputBox.js.map +1 -1
  49. package/packages/cli/dist/tui/components/Logo.d.ts +56 -0
  50. package/packages/cli/dist/tui/components/Logo.d.ts.map +1 -0
  51. package/packages/cli/dist/tui/components/Logo.js +50 -0
  52. package/packages/cli/dist/tui/components/Logo.js.map +1 -0
  53. package/packages/cli/dist/tui/components/Markdown.js +8 -8
  54. package/packages/cli/dist/tui/components/Markdown.js.map +1 -1
  55. package/packages/cli/dist/tui/components/Message.d.ts +1 -1
  56. package/packages/cli/dist/tui/components/Message.d.ts.map +1 -1
  57. package/packages/cli/dist/tui/components/Message.js +5 -4
  58. package/packages/cli/dist/tui/components/Message.js.map +1 -1
  59. package/packages/cli/dist/tui/components/QuestionView.d.ts +29 -0
  60. package/packages/cli/dist/tui/components/QuestionView.d.ts.map +1 -0
  61. package/packages/cli/dist/tui/components/QuestionView.js +53 -0
  62. package/packages/cli/dist/tui/components/QuestionView.js.map +1 -0
  63. package/packages/cli/dist/tui/components/SlashPalette.d.ts +5 -2
  64. package/packages/cli/dist/tui/components/SlashPalette.d.ts.map +1 -1
  65. package/packages/cli/dist/tui/components/SlashPalette.js +2 -2
  66. package/packages/cli/dist/tui/components/SlashPalette.js.map +1 -1
  67. package/packages/cli/dist/tui/components/StatusLine.d.ts +0 -2
  68. package/packages/cli/dist/tui/components/StatusLine.d.ts.map +1 -1
  69. package/packages/cli/dist/tui/components/StatusLine.js +8 -5
  70. package/packages/cli/dist/tui/components/StatusLine.js.map +1 -1
  71. package/packages/cli/dist/tui/components/ToolGroup.js +2 -2
  72. package/packages/cli/dist/tui/components/ToolGroup.js.map +1 -1
  73. package/packages/cli/dist/tui/components/WatchView.d.ts +21 -0
  74. package/packages/cli/dist/tui/components/WatchView.d.ts.map +1 -0
  75. package/packages/cli/dist/tui/components/WatchView.js +36 -0
  76. package/packages/cli/dist/tui/components/WatchView.js.map +1 -0
  77. package/packages/cli/dist/tui/history.d.ts +20 -0
  78. package/packages/cli/dist/tui/history.d.ts.map +1 -0
  79. package/packages/cli/dist/tui/history.js +105 -0
  80. package/packages/cli/dist/tui/history.js.map +1 -0
  81. package/packages/cli/dist/tui/hooks/useSlash.d.ts.map +1 -1
  82. package/packages/cli/dist/tui/hooks/useSlash.js +3 -2
  83. package/packages/cli/dist/tui/hooks/useSlash.js.map +1 -1
  84. package/packages/cli/dist/tui/hooks/useTurn.d.ts +58 -1
  85. package/packages/cli/dist/tui/hooks/useTurn.d.ts.map +1 -1
  86. package/packages/cli/dist/tui/hooks/useTurn.js +214 -36
  87. package/packages/cli/dist/tui/hooks/useTurn.js.map +1 -1
  88. package/packages/cli/dist/tui/hooks/useWatch.d.ts +52 -0
  89. package/packages/cli/dist/tui/hooks/useWatch.d.ts.map +1 -0
  90. package/packages/cli/dist/tui/hooks/useWatch.js +145 -0
  91. package/packages/cli/dist/tui/hooks/useWatch.js.map +1 -0
  92. package/packages/cli/dist/tui/inkTheme.d.ts +19 -0
  93. package/packages/cli/dist/tui/inkTheme.d.ts.map +1 -0
  94. package/packages/cli/dist/tui/inkTheme.js +81 -0
  95. package/packages/cli/dist/tui/inkTheme.js.map +1 -0
  96. package/packages/cli/dist/tui/theme.d.ts +39 -29
  97. package/packages/cli/dist/tui/theme.d.ts.map +1 -1
  98. package/packages/cli/dist/tui/theme.js +35 -25
  99. package/packages/cli/dist/tui/theme.js.map +1 -1
  100. package/packages/cli/dist/tui/types.d.ts +56 -3
  101. package/packages/cli/dist/tui/types.d.ts.map +1 -1
  102. package/packages/cli/dist/tui/types.js +85 -0
  103. package/packages/cli/dist/tui/types.js.map +1 -1
  104. package/packages/cli/dist/ui/modelNames.d.ts +51 -0
  105. package/packages/cli/dist/ui/modelNames.d.ts.map +1 -0
  106. package/packages/cli/dist/ui/modelNames.js +134 -0
  107. package/packages/cli/dist/ui/modelNames.js.map +1 -0
  108. package/packages/cli/dist/ui/render.d.ts.map +1 -1
  109. package/packages/cli/dist/ui/render.js +17 -8
  110. package/packages/cli/dist/ui/render.js.map +1 -1
  111. package/packages/cli/dist/ui/speech.js +5 -0
  112. package/packages/cli/dist/ui/speech.js.map +1 -1
  113. package/packages/cli/dist/ui/theme.d.ts +33 -9
  114. package/packages/cli/dist/ui/theme.d.ts.map +1 -1
  115. package/packages/cli/dist/ui/theme.js +33 -9
  116. package/packages/cli/dist/ui/theme.js.map +1 -1
  117. package/packages/cli/package.json +1 -1
  118. package/packages/core/dist/agents/persona.d.ts.map +1 -1
  119. package/packages/core/dist/agents/persona.js +5 -2
  120. package/packages/core/dist/agents/persona.js.map +1 -1
  121. package/packages/core/dist/computer/accessibility.d.ts +78 -0
  122. package/packages/core/dist/computer/accessibility.d.ts.map +1 -0
  123. package/packages/core/dist/computer/accessibility.js +270 -0
  124. package/packages/core/dist/computer/accessibility.js.map +1 -0
  125. package/packages/core/dist/computer/assemblies.d.ts +17 -0
  126. package/packages/core/dist/computer/assemblies.d.ts.map +1 -0
  127. package/packages/core/dist/computer/assemblies.js +55 -0
  128. package/packages/core/dist/computer/assemblies.js.map +1 -0
  129. package/packages/core/dist/computer/browser-init.d.ts +9 -0
  130. package/packages/core/dist/computer/browser-init.d.ts.map +1 -0
  131. package/packages/core/dist/computer/browser-init.js +133 -0
  132. package/packages/core/dist/computer/browser-init.js.map +1 -0
  133. package/packages/core/dist/computer/cursor.d.ts +30 -0
  134. package/packages/core/dist/computer/cursor.d.ts.map +1 -0
  135. package/packages/core/dist/computer/cursor.js +30 -0
  136. package/packages/core/dist/computer/cursor.js.map +1 -0
  137. package/packages/core/dist/computer/mcp-server.js +524 -82
  138. package/packages/core/dist/computer/mcp-server.js.map +1 -1
  139. package/packages/core/dist/computer/powershell.d.ts +4 -0
  140. package/packages/core/dist/computer/powershell.d.ts.map +1 -1
  141. package/packages/core/dist/computer/powershell.js +471 -81
  142. package/packages/core/dist/computer/powershell.js.map +1 -1
  143. package/packages/core/dist/computer/screen-text.d.ts +82 -0
  144. package/packages/core/dist/computer/screen-text.d.ts.map +1 -0
  145. package/packages/core/dist/computer/screen-text.js +243 -0
  146. package/packages/core/dist/computer/screen-text.js.map +1 -0
  147. package/packages/core/dist/computer/sketch.d.ts +66 -0
  148. package/packages/core/dist/computer/sketch.d.ts.map +1 -0
  149. package/packages/core/dist/computer/sketch.js +540 -0
  150. package/packages/core/dist/computer/sketch.js.map +1 -0
  151. package/packages/core/dist/computer/tools.d.ts +8 -8
  152. package/packages/core/dist/computer/tools.d.ts.map +1 -1
  153. package/packages/core/dist/computer/tools.js +186 -31
  154. package/packages/core/dist/computer/tools.js.map +1 -1
  155. package/packages/core/dist/computer/validation.d.ts +555 -0
  156. package/packages/core/dist/computer/validation.d.ts.map +1 -0
  157. package/packages/core/dist/computer/validation.js +111 -0
  158. package/packages/core/dist/computer/validation.js.map +1 -0
  159. package/packages/core/dist/computer/windows-cursor.d.ts +14 -0
  160. package/packages/core/dist/computer/windows-cursor.d.ts.map +1 -0
  161. package/packages/core/dist/computer/windows-cursor.js +713 -0
  162. package/packages/core/dist/computer/windows-cursor.js.map +1 -0
  163. package/packages/core/dist/config.d.ts +34 -1
  164. package/packages/core/dist/config.d.ts.map +1 -1
  165. package/packages/core/dist/config.js +362 -11
  166. package/packages/core/dist/config.js.map +1 -1
  167. package/packages/core/dist/cron/scheduler.d.ts +59 -6
  168. package/packages/core/dist/cron/scheduler.d.ts.map +1 -1
  169. package/packages/core/dist/cron/scheduler.js +295 -27
  170. package/packages/core/dist/cron/scheduler.js.map +1 -1
  171. package/packages/core/dist/cron/store.d.ts +19 -1
  172. package/packages/core/dist/cron/store.d.ts.map +1 -1
  173. package/packages/core/dist/cron/store.js +36 -8
  174. package/packages/core/dist/cron/store.js.map +1 -1
  175. package/packages/core/dist/external/claude-code.d.ts +4 -0
  176. package/packages/core/dist/external/claude-code.d.ts.map +1 -0
  177. package/packages/core/dist/external/claude-code.js +111 -0
  178. package/packages/core/dist/external/claude-code.js.map +1 -0
  179. package/packages/core/dist/external/discovery.d.ts +33 -0
  180. package/packages/core/dist/external/discovery.d.ts.map +1 -0
  181. package/packages/core/dist/external/discovery.js +144 -0
  182. package/packages/core/dist/external/discovery.js.map +1 -0
  183. package/packages/core/dist/external/homes.d.ts +26 -0
  184. package/packages/core/dist/external/homes.d.ts.map +1 -0
  185. package/packages/core/dist/external/homes.js +49 -0
  186. package/packages/core/dist/external/homes.js.map +1 -0
  187. package/packages/core/dist/external/shared.d.ts +201 -0
  188. package/packages/core/dist/external/shared.d.ts.map +1 -0
  189. package/packages/core/dist/external/shared.js +308 -0
  190. package/packages/core/dist/external/shared.js.map +1 -0
  191. package/packages/core/dist/gateway/policy.d.ts +117 -2
  192. package/packages/core/dist/gateway/policy.d.ts.map +1 -1
  193. package/packages/core/dist/gateway/policy.js +286 -6
  194. package/packages/core/dist/gateway/policy.js.map +1 -1
  195. package/packages/core/dist/index.d.ts +38 -12
  196. package/packages/core/dist/index.d.ts.map +1 -1
  197. package/packages/core/dist/index.js +66 -12
  198. package/packages/core/dist/index.js.map +1 -1
  199. package/packages/core/dist/memory/db.d.ts +1 -1
  200. package/packages/core/dist/memory/db.d.ts.map +1 -1
  201. package/packages/core/dist/memory/db.js +878 -1
  202. package/packages/core/dist/memory/db.js.map +1 -1
  203. package/packages/core/dist/memory/dream/admission.d.ts +124 -0
  204. package/packages/core/dist/memory/dream/admission.d.ts.map +1 -0
  205. package/packages/core/dist/memory/dream/admission.js +116 -0
  206. package/packages/core/dist/memory/dream/admission.js.map +1 -0
  207. package/packages/core/dist/memory/dream/candidate.d.ts +152 -0
  208. package/packages/core/dist/memory/dream/candidate.d.ts.map +1 -0
  209. package/packages/core/dist/memory/dream/candidate.js +547 -0
  210. package/packages/core/dist/memory/dream/candidate.js.map +1 -0
  211. package/packages/core/dist/memory/dream/evaluate.d.ts +394 -0
  212. package/packages/core/dist/memory/dream/evaluate.d.ts.map +1 -0
  213. package/packages/core/dist/memory/dream/evaluate.js +1032 -0
  214. package/packages/core/dist/memory/dream/evaluate.js.map +1 -0
  215. package/packages/core/dist/memory/dream/frame.d.ts +61 -0
  216. package/packages/core/dist/memory/dream/frame.d.ts.map +1 -0
  217. package/packages/core/dist/memory/dream/frame.js +292 -0
  218. package/packages/core/dist/memory/dream/frame.js.map +1 -0
  219. package/packages/core/dist/memory/dream/label.d.ts +370 -0
  220. package/packages/core/dist/memory/dream/label.d.ts.map +1 -0
  221. package/packages/core/dist/memory/dream/label.js +439 -0
  222. package/packages/core/dist/memory/dream/label.js.map +1 -0
  223. package/packages/core/dist/memory/dream/measure.d.ts +114 -0
  224. package/packages/core/dist/memory/dream/measure.d.ts.map +1 -0
  225. package/packages/core/dist/memory/dream/measure.js +205 -0
  226. package/packages/core/dist/memory/dream/measure.js.map +1 -0
  227. package/packages/core/dist/memory/dream/policy.d.ts +21 -0
  228. package/packages/core/dist/memory/dream/policy.d.ts.map +1 -0
  229. package/packages/core/dist/memory/dream/policy.js +157 -0
  230. package/packages/core/dist/memory/dream/policy.js.map +1 -0
  231. package/packages/core/dist/memory/dream/probe.d.ts +202 -0
  232. package/packages/core/dist/memory/dream/probe.d.ts.map +1 -0
  233. package/packages/core/dist/memory/dream/probe.js +671 -0
  234. package/packages/core/dist/memory/dream/probe.js.map +1 -0
  235. package/packages/core/dist/memory/dream/promote.d.ts +312 -0
  236. package/packages/core/dist/memory/dream/promote.d.ts.map +1 -0
  237. package/packages/core/dist/memory/dream/promote.js +528 -0
  238. package/packages/core/dist/memory/dream/promote.js.map +1 -0
  239. package/packages/core/dist/memory/dream/score.d.ts +103 -0
  240. package/packages/core/dist/memory/dream/score.d.ts.map +1 -0
  241. package/packages/core/dist/memory/dream/score.js +334 -0
  242. package/packages/core/dist/memory/dream/score.js.map +1 -0
  243. package/packages/core/dist/memory/dream/slots.d.ts +193 -0
  244. package/packages/core/dist/memory/dream/slots.d.ts.map +1 -0
  245. package/packages/core/dist/memory/dream/slots.js +0 -0
  246. package/packages/core/dist/memory/dream/slots.js.map +1 -0
  247. package/packages/core/dist/memory/dream/trajectory.d.ts +262 -0
  248. package/packages/core/dist/memory/dream/trajectory.d.ts.map +1 -0
  249. package/packages/core/dist/memory/dream/trajectory.js +366 -0
  250. package/packages/core/dist/memory/dream/trajectory.js.map +1 -0
  251. package/packages/core/dist/memory/extractor.d.ts +7 -0
  252. package/packages/core/dist/memory/extractor.d.ts.map +1 -1
  253. package/packages/core/dist/memory/extractor.js +35 -12
  254. package/packages/core/dist/memory/extractor.js.map +1 -1
  255. package/packages/core/dist/memory/gate.d.ts +43 -7
  256. package/packages/core/dist/memory/gate.d.ts.map +1 -1
  257. package/packages/core/dist/memory/gate.js +91 -4
  258. package/packages/core/dist/memory/gate.js.map +1 -1
  259. package/packages/core/dist/memory/recall.d.ts +57 -0
  260. package/packages/core/dist/memory/recall.d.ts.map +1 -1
  261. package/packages/core/dist/memory/recall.js +60 -123
  262. package/packages/core/dist/memory/recall.js.map +1 -1
  263. package/packages/core/dist/memory/sleep.d.ts +131 -4
  264. package/packages/core/dist/memory/sleep.d.ts.map +1 -1
  265. package/packages/core/dist/memory/sleep.js +2384 -65
  266. package/packages/core/dist/memory/sleep.js.map +1 -1
  267. package/packages/core/dist/memory/store.d.ts +564 -10
  268. package/packages/core/dist/memory/store.d.ts.map +1 -1
  269. package/packages/core/dist/memory/store.js +1673 -102
  270. package/packages/core/dist/memory/store.js.map +1 -1
  271. package/packages/core/dist/org/controller.d.ts +268 -4
  272. package/packages/core/dist/org/controller.d.ts.map +1 -1
  273. package/packages/core/dist/org/controller.js +2298 -248
  274. package/packages/core/dist/org/controller.js.map +1 -1
  275. package/packages/core/dist/org/ponytail.d.ts +1 -1
  276. package/packages/core/dist/org/ponytail.js +1 -1
  277. package/packages/core/dist/org/project-mcp.d.ts +3 -3
  278. package/packages/core/dist/org/prompts.d.ts +44 -30
  279. package/packages/core/dist/org/prompts.d.ts.map +1 -1
  280. package/packages/core/dist/org/prompts.js +209 -92
  281. package/packages/core/dist/org/prompts.js.map +1 -1
  282. package/packages/core/dist/org/questions.d.ts +104 -0
  283. package/packages/core/dist/org/questions.d.ts.map +1 -0
  284. package/packages/core/dist/org/questions.js +136 -0
  285. package/packages/core/dist/org/questions.js.map +1 -0
  286. package/packages/core/dist/org/review.d.ts +100 -0
  287. package/packages/core/dist/org/review.d.ts.map +1 -0
  288. package/packages/core/dist/org/review.js +256 -0
  289. package/packages/core/dist/org/review.js.map +1 -0
  290. package/packages/core/dist/org/store.d.ts +311 -2
  291. package/packages/core/dist/org/store.d.ts.map +1 -1
  292. package/packages/core/dist/org/store.js +981 -13
  293. package/packages/core/dist/org/store.js.map +1 -1
  294. package/packages/core/dist/org/tools.d.ts +33 -3
  295. package/packages/core/dist/org/tools.d.ts.map +1 -1
  296. package/packages/core/dist/org/tools.js +380 -67
  297. package/packages/core/dist/org/tools.js.map +1 -1
  298. package/packages/core/dist/providers/catalogue.d.ts +1 -1
  299. package/packages/core/dist/providers/catalogue.d.ts.map +1 -1
  300. package/packages/core/dist/providers/catalogue.js +2 -2
  301. package/packages/core/dist/providers/catalogue.js.map +1 -1
  302. package/packages/core/dist/providers/claude-code.d.ts +19 -3
  303. package/packages/core/dist/providers/claude-code.d.ts.map +1 -1
  304. package/packages/core/dist/providers/claude-code.js +501 -40
  305. package/packages/core/dist/providers/claude-code.js.map +1 -1
  306. package/packages/core/dist/providers/claude-tui.d.ts +288 -0
  307. package/packages/core/dist/providers/claude-tui.d.ts.map +1 -0
  308. package/packages/core/dist/providers/claude-tui.js +1118 -0
  309. package/packages/core/dist/providers/claude-tui.js.map +1 -0
  310. package/packages/core/dist/providers/codex-auth.d.ts +15 -0
  311. package/packages/core/dist/providers/codex-auth.d.ts.map +1 -0
  312. package/packages/core/dist/providers/codex-auth.js +127 -0
  313. package/packages/core/dist/providers/codex-auth.js.map +1 -0
  314. package/packages/core/dist/providers/codex-bridge.d.ts +58 -0
  315. package/packages/core/dist/providers/codex-bridge.d.ts.map +1 -0
  316. package/packages/core/dist/providers/codex-bridge.js +375 -0
  317. package/packages/core/dist/providers/codex-bridge.js.map +1 -0
  318. package/packages/core/dist/providers/codex-translate.d.ts +75 -0
  319. package/packages/core/dist/providers/codex-translate.d.ts.map +1 -0
  320. package/packages/core/dist/providers/codex-translate.js +383 -0
  321. package/packages/core/dist/providers/codex-translate.js.map +1 -0
  322. package/packages/core/dist/providers/model-gateway.d.ts +56 -0
  323. package/packages/core/dist/providers/model-gateway.d.ts.map +1 -0
  324. package/packages/core/dist/providers/model-gateway.js +119 -0
  325. package/packages/core/dist/providers/model-gateway.js.map +1 -0
  326. package/packages/core/dist/providers/process.d.ts +3 -1
  327. package/packages/core/dist/providers/process.d.ts.map +1 -1
  328. package/packages/core/dist/providers/process.js +3 -3
  329. package/packages/core/dist/providers/process.js.map +1 -1
  330. package/packages/core/dist/providers/profiles.d.ts +11 -0
  331. package/packages/core/dist/providers/profiles.d.ts.map +1 -0
  332. package/packages/core/dist/providers/profiles.js +28 -0
  333. package/packages/core/dist/providers/profiles.js.map +1 -0
  334. package/packages/core/dist/providers/provider-catalog.d.ts +72 -0
  335. package/packages/core/dist/providers/provider-catalog.d.ts.map +1 -0
  336. package/packages/core/dist/providers/provider-catalog.js +144 -0
  337. package/packages/core/dist/providers/provider-catalog.js.map +1 -0
  338. package/packages/core/dist/providers/quota.d.ts +40 -1
  339. package/packages/core/dist/providers/quota.d.ts.map +1 -1
  340. package/packages/core/dist/providers/quota.js +288 -25
  341. package/packages/core/dist/providers/quota.js.map +1 -1
  342. package/packages/core/dist/providers/registry.d.ts +46 -3
  343. package/packages/core/dist/providers/registry.d.ts.map +1 -1
  344. package/packages/core/dist/providers/registry.js +148 -13
  345. package/packages/core/dist/providers/registry.js.map +1 -1
  346. package/packages/core/dist/providers/router.d.ts +28 -0
  347. package/packages/core/dist/providers/router.d.ts.map +1 -0
  348. package/packages/core/dist/providers/router.js +88 -0
  349. package/packages/core/dist/providers/router.js.map +1 -0
  350. package/packages/core/dist/providers/user-settings-guard.d.ts +12 -0
  351. package/packages/core/dist/providers/user-settings-guard.d.ts.map +1 -0
  352. package/packages/core/dist/providers/user-settings-guard.js +130 -0
  353. package/packages/core/dist/providers/user-settings-guard.js.map +1 -0
  354. package/packages/core/dist/runtime.d.ts +193 -7
  355. package/packages/core/dist/runtime.d.ts.map +1 -1
  356. package/packages/core/dist/runtime.js +1676 -219
  357. package/packages/core/dist/runtime.js.map +1 -1
  358. package/packages/core/dist/skills/builtin.d.ts +34 -0
  359. package/packages/core/dist/skills/builtin.d.ts.map +1 -0
  360. package/packages/core/dist/skills/builtin.js +305 -0
  361. package/packages/core/dist/skills/builtin.js.map +1 -0
  362. package/packages/core/dist/skills/shelf.d.ts +30 -0
  363. package/packages/core/dist/skills/shelf.d.ts.map +1 -0
  364. package/packages/core/dist/skills/shelf.js +159 -0
  365. package/packages/core/dist/skills/shelf.js.map +1 -0
  366. package/packages/core/dist/skills/store.d.ts +66 -4
  367. package/packages/core/dist/skills/store.d.ts.map +1 -1
  368. package/packages/core/dist/skills/store.js +105 -18
  369. package/packages/core/dist/skills/store.js.map +1 -1
  370. package/packages/core/dist/skills/suggest.d.ts +21 -0
  371. package/packages/core/dist/skills/suggest.d.ts.map +1 -0
  372. package/packages/core/dist/skills/suggest.js +150 -0
  373. package/packages/core/dist/skills/suggest.js.map +1 -0
  374. package/packages/core/dist/tools/catalog.d.ts +1 -3
  375. package/packages/core/dist/tools/catalog.d.ts.map +1 -1
  376. package/packages/core/dist/tools/catalog.js +38 -26
  377. package/packages/core/dist/tools/catalog.js.map +1 -1
  378. package/packages/core/dist/tools/hub.d.ts +136 -10
  379. package/packages/core/dist/tools/hub.d.ts.map +1 -1
  380. package/packages/core/dist/tools/hub.js +418 -24
  381. package/packages/core/dist/tools/hub.js.map +1 -1
  382. package/packages/core/dist/turns/journal.d.ts +78 -0
  383. package/packages/core/dist/turns/journal.d.ts.map +1 -0
  384. package/packages/core/dist/turns/journal.js +104 -0
  385. package/packages/core/dist/turns/journal.js.map +1 -0
  386. package/packages/core/dist/types.d.ts +1776 -12
  387. package/packages/core/dist/types.d.ts.map +1 -1
  388. package/packages/core/dist/types.js.map +1 -1
  389. package/packages/core/dist/util/blocks.d.ts +41 -0
  390. package/packages/core/dist/util/blocks.d.ts.map +1 -0
  391. package/packages/core/dist/util/blocks.js +175 -0
  392. package/packages/core/dist/util/blocks.js.map +1 -0
  393. package/packages/core/dist/util/queue.d.ts +12 -0
  394. package/packages/core/dist/util/queue.d.ts.map +1 -1
  395. package/packages/core/dist/util/queue.js +16 -0
  396. package/packages/core/dist/util/queue.js.map +1 -1
  397. package/packages/core/dist/util/time.d.ts +39 -0
  398. package/packages/core/dist/util/time.d.ts.map +1 -0
  399. package/packages/core/dist/util/time.js +71 -0
  400. package/packages/core/dist/util/time.js.map +1 -0
  401. package/packages/core/package.json +1 -1
  402. package/packages/server/dist/auth.d.ts +14 -1
  403. package/packages/server/dist/auth.d.ts.map +1 -1
  404. package/packages/server/dist/auth.js +19 -0
  405. package/packages/server/dist/auth.js.map +1 -1
  406. package/packages/server/dist/context.d.ts +35 -1
  407. package/packages/server/dist/context.d.ts.map +1 -1
  408. package/packages/server/dist/context.js +39 -10
  409. package/packages/server/dist/context.js.map +1 -1
  410. package/packages/server/dist/gateways/attachments.d.ts +32 -0
  411. package/packages/server/dist/gateways/attachments.d.ts.map +1 -0
  412. package/packages/server/dist/gateways/attachments.js +167 -0
  413. package/packages/server/dist/gateways/attachments.js.map +1 -0
  414. package/packages/server/dist/gateways/markdown.d.ts +9 -0
  415. package/packages/server/dist/gateways/markdown.d.ts.map +1 -0
  416. package/packages/server/dist/gateways/markdown.js +170 -0
  417. package/packages/server/dist/gateways/markdown.js.map +1 -0
  418. package/packages/server/dist/gateways/push.d.ts +1 -1
  419. package/packages/server/dist/gateways/push.d.ts.map +1 -1
  420. package/packages/server/dist/gateways/push.js +420 -13
  421. package/packages/server/dist/gateways/push.js.map +1 -1
  422. package/packages/server/dist/gateways/telegram-api.d.ts +70 -1
  423. package/packages/server/dist/gateways/telegram-api.d.ts.map +1 -1
  424. package/packages/server/dist/gateways/telegram-api.js +140 -1
  425. package/packages/server/dist/gateways/telegram-api.js.map +1 -1
  426. package/packages/server/dist/gateways/telegram.d.ts +181 -1
  427. package/packages/server/dist/gateways/telegram.d.ts.map +1 -1
  428. package/packages/server/dist/gateways/telegram.js +1572 -78
  429. package/packages/server/dist/gateways/telegram.js.map +1 -1
  430. package/packages/server/dist/gateways/threads.d.ts +84 -0
  431. package/packages/server/dist/gateways/threads.d.ts.map +1 -0
  432. package/packages/server/dist/gateways/threads.js +289 -0
  433. package/packages/server/dist/gateways/threads.js.map +1 -0
  434. package/packages/server/dist/index.d.ts +2 -1
  435. package/packages/server/dist/index.d.ts.map +1 -1
  436. package/packages/server/dist/index.js +2 -1
  437. package/packages/server/dist/index.js.map +1 -1
  438. package/packages/server/dist/listeners/imap.d.ts +13 -0
  439. package/packages/server/dist/listeners/imap.d.ts.map +1 -0
  440. package/packages/server/dist/listeners/imap.js +0 -0
  441. package/packages/server/dist/listeners/imap.js.map +1 -0
  442. package/packages/server/dist/listeners/registry.d.ts +18 -0
  443. package/packages/server/dist/listeners/registry.d.ts.map +1 -0
  444. package/packages/server/dist/listeners/registry.js +88 -0
  445. package/packages/server/dist/listeners/registry.js.map +1 -0
  446. package/packages/server/dist/listeners/types.d.ts +55 -0
  447. package/packages/server/dist/listeners/types.d.ts.map +1 -0
  448. package/packages/server/dist/listeners/types.js +2 -0
  449. package/packages/server/dist/listeners/types.js.map +1 -0
  450. package/packages/server/dist/main.js +15 -1
  451. package/packages/server/dist/main.js.map +1 -1
  452. package/packages/server/dist/routes/chat.d.ts +7 -3
  453. package/packages/server/dist/routes/chat.d.ts.map +1 -1
  454. package/packages/server/dist/routes/chat.js +8 -17
  455. package/packages/server/dist/routes/chat.js.map +1 -1
  456. package/packages/server/dist/routes/config.d.ts.map +1 -1
  457. package/packages/server/dist/routes/config.js +66 -7
  458. package/packages/server/dist/routes/config.js.map +1 -1
  459. package/packages/server/dist/routes/cron.d.ts.map +1 -1
  460. package/packages/server/dist/routes/cron.js +65 -8
  461. package/packages/server/dist/routes/cron.js.map +1 -1
  462. package/packages/server/dist/routes/dream.d.ts +22 -0
  463. package/packages/server/dist/routes/dream.d.ts.map +1 -0
  464. package/packages/server/dist/routes/dream.js +152 -0
  465. package/packages/server/dist/routes/dream.js.map +1 -0
  466. package/packages/server/dist/routes/hooks.d.ts +18 -0
  467. package/packages/server/dist/routes/hooks.d.ts.map +1 -0
  468. package/packages/server/dist/routes/hooks.js +62 -0
  469. package/packages/server/dist/routes/hooks.js.map +1 -0
  470. package/packages/server/dist/routes/listeners.d.ts +10 -0
  471. package/packages/server/dist/routes/listeners.d.ts.map +1 -0
  472. package/packages/server/dist/routes/listeners.js +12 -0
  473. package/packages/server/dist/routes/listeners.js.map +1 -0
  474. package/packages/server/dist/routes/memories.d.ts.map +1 -1
  475. package/packages/server/dist/routes/memories.js +55 -3
  476. package/packages/server/dist/routes/memories.js.map +1 -1
  477. package/packages/server/dist/routes/org.d.ts.map +1 -1
  478. package/packages/server/dist/routes/org.js +289 -49
  479. package/packages/server/dist/routes/org.js.map +1 -1
  480. package/packages/server/dist/routes/profile.d.ts.map +1 -1
  481. package/packages/server/dist/routes/profile.js +6 -3
  482. package/packages/server/dist/routes/profile.js.map +1 -1
  483. package/packages/server/dist/routes/providers.d.ts.map +1 -1
  484. package/packages/server/dist/routes/providers.js +66 -7
  485. package/packages/server/dist/routes/providers.js.map +1 -1
  486. package/packages/server/dist/routes/questions.d.ts +45 -0
  487. package/packages/server/dist/routes/questions.d.ts.map +1 -0
  488. package/packages/server/dist/routes/questions.js +73 -0
  489. package/packages/server/dist/routes/questions.js.map +1 -0
  490. package/packages/server/dist/routes/sessions.d.ts.map +1 -1
  491. package/packages/server/dist/routes/sessions.js +26 -6
  492. package/packages/server/dist/routes/sessions.js.map +1 -1
  493. package/packages/server/dist/routes/sleep.d.ts.map +1 -1
  494. package/packages/server/dist/routes/sleep.js +71 -2
  495. package/packages/server/dist/routes/sleep.js.map +1 -1
  496. package/packages/server/dist/routes/terminals.d.ts +25 -0
  497. package/packages/server/dist/routes/terminals.d.ts.map +1 -0
  498. package/packages/server/dist/routes/terminals.js +35 -0
  499. package/packages/server/dist/routes/terminals.js.map +1 -0
  500. package/packages/server/dist/routes/tools.d.ts.map +1 -1
  501. package/packages/server/dist/routes/tools.js +140 -6
  502. package/packages/server/dist/routes/tools.js.map +1 -1
  503. package/packages/server/dist/routes/updates.d.ts +10 -0
  504. package/packages/server/dist/routes/updates.d.ts.map +1 -0
  505. package/packages/server/dist/routes/updates.js +22 -0
  506. package/packages/server/dist/routes/updates.js.map +1 -0
  507. package/packages/server/dist/routes/ws.d.ts +11 -5
  508. package/packages/server/dist/routes/ws.d.ts.map +1 -1
  509. package/packages/server/dist/routes/ws.js +168 -28
  510. package/packages/server/dist/routes/ws.js.map +1 -1
  511. package/packages/server/dist/schemas.d.ts +1177 -215
  512. package/packages/server/dist/schemas.d.ts.map +1 -1
  513. package/packages/server/dist/schemas.js +317 -12
  514. package/packages/server/dist/schemas.js.map +1 -1
  515. package/packages/server/dist/server.d.ts +7 -1
  516. package/packages/server/dist/server.d.ts.map +1 -1
  517. package/packages/server/dist/server.js +210 -3
  518. package/packages/server/dist/server.js.map +1 -1
  519. package/packages/server/dist/services/stream.d.ts +94 -5
  520. package/packages/server/dist/services/stream.d.ts.map +1 -1
  521. package/packages/server/dist/services/stream.js +9 -20
  522. package/packages/server/dist/services/stream.js.map +1 -1
  523. package/packages/server/dist/services/stt.d.ts +65 -0
  524. package/packages/server/dist/services/stt.d.ts.map +1 -0
  525. package/packages/server/dist/services/stt.js +306 -0
  526. package/packages/server/dist/services/stt.js.map +1 -0
  527. package/packages/server/dist/services/turns.d.ts +54 -0
  528. package/packages/server/dist/services/turns.d.ts.map +1 -0
  529. package/packages/server/dist/services/turns.js +186 -0
  530. package/packages/server/dist/services/turns.js.map +1 -0
  531. package/packages/server/dist/services/updates.d.ts +99 -0
  532. package/packages/server/dist/services/updates.d.ts.map +1 -0
  533. package/packages/server/dist/services/updates.js +316 -0
  534. package/packages/server/dist/services/updates.js.map +1 -0
  535. package/packages/server/package.json +1 -1
  536. package/packages/web/dist/app-icon.svg +2 -0
  537. package/packages/web/dist/apple-touch-icon.png +0 -0
  538. package/packages/web/dist/assets/abnfDiagram-O67JEVCF-D7YyFndQ.js +1 -0
  539. package/packages/web/dist/assets/arc-C_Zgk2dJ.js +1 -0
  540. package/packages/web/dist/assets/architectureDiagram-NJMV4G6O-eI0adu1B.js +36 -0
  541. package/packages/web/dist/assets/blockDiagram-BEXU5L5S-WAoOFUA9.js +140 -0
  542. package/packages/web/dist/assets/c4Diagram-YGBWAQC7-DE8Zyhng.js +38 -0
  543. package/packages/web/dist/assets/channel-egZxcyUK.js +1 -0
  544. package/packages/web/dist/assets/chunk-2Q5K7J3B-bnqLP2XD.js +1 -0
  545. package/packages/web/dist/assets/chunk-3FUC2YCW-Ck1_SVe0.js +2 -0
  546. package/packages/web/dist/assets/chunk-5VM5RSS4-hDmC41gD.js +15 -0
  547. package/packages/web/dist/assets/chunk-GTNCS2PH-PoWvfCrT.js +88 -0
  548. package/packages/web/dist/assets/chunk-GWA4HPMP-D3V0IG43.js +1 -0
  549. package/packages/web/dist/assets/chunk-JWPE2WC7-BryfpHM5.js +1 -0
  550. package/packages/web/dist/assets/chunk-NETBCI7D-8ic1iEdT.js +1 -0
  551. package/packages/web/dist/assets/chunk-WEXAMYUT-nM8tmQT2.js +1 -0
  552. package/packages/web/dist/assets/chunk-XXDRQBXY-Do28F482.js +1 -0
  553. package/packages/web/dist/assets/classDiagram-v2-NBCMYWYE-Bop9oNNO.js +217 -0
  554. package/packages/web/dist/assets/cose-bilkent-JH36ORCC-a7f_bpnt.js +1 -0
  555. package/packages/web/dist/assets/cynefin-OW5HDTMX-DnArcis_.js +178 -0
  556. package/packages/web/dist/assets/cynefinDiagram-VND7K2PF-vEuTb1GD.js +62 -0
  557. package/packages/web/dist/assets/cytoscape.esm-Ix0LnXOy.js +331 -0
  558. package/packages/web/dist/assets/dagre-6A5THRUB-BgG4MynJ.js +4 -0
  559. package/packages/web/dist/assets/diagram-22UHCM2B-DRCQpafv.js +200 -0
  560. package/packages/web/dist/assets/diagram-3UASUU5V-BKgmAXde.js +24 -0
  561. package/packages/web/dist/assets/diagram-ATOU4E4O-B6Hsy36X.js +3 -0
  562. package/packages/web/dist/assets/diagram-CDSNMT55-JflyfyoB.js +30 -0
  563. package/packages/web/dist/assets/diagram-MLGK6HIB-Dd2QPJjT.js +24 -0
  564. package/packages/web/dist/assets/diagram-MPIPVDR6-DE5QU60x.js +41 -0
  565. package/packages/web/dist/assets/draco_decoder-C32yEggz.wasm +0 -0
  566. package/packages/web/dist/assets/draco_decoder-Z1_iN-Ht.wasm +0 -0
  567. package/packages/web/dist/assets/draco_decoder-fzg4nYZr.js +34 -0
  568. package/packages/web/dist/assets/draco_wasm_wrapper-DxJM36Ib.js +117 -0
  569. package/packages/web/dist/assets/draco_wasm_wrapper-fZCQGLGb.js +116 -0
  570. package/packages/web/dist/assets/ebnfDiagram-ZINNZB2B-D7AQ741b.js +1 -0
  571. package/packages/web/dist/assets/elk-276RUBZZ-CeewBVLF.js +27 -0
  572. package/packages/web/dist/assets/erDiagram-OPXOYQCR-mLLYkZ5c.js +99 -0
  573. package/packages/web/dist/assets/flowDiagram-KWPJA3E3-DtpSpsQN.js +213 -0
  574. package/packages/web/dist/assets/ganttDiagram-FUAMR5RP-1_lh-3ky.js +292 -0
  575. package/packages/web/dist/assets/gitGraphDiagram-X574FWY7-DoPXZuT5.js +106 -0
  576. package/packages/web/dist/assets/graph-Bn3Yngep.js +1 -0
  577. package/packages/web/dist/assets/index-Cw2Opmx7.js +648 -0
  578. package/packages/web/dist/assets/index-j0zBRCgT.css +32 -0
  579. package/packages/web/dist/assets/infoDiagram-VRGFBTTK-DQpRGGiD.js +2 -0
  580. package/packages/web/dist/assets/ishikawaDiagram-OU5B5YK6-gH5C9Q2e.js +70 -0
  581. package/packages/web/dist/assets/journeyDiagram-ZHPQQLJL-Bg-oeFjb.js +139 -0
  582. package/packages/web/dist/assets/kanban-definition-PNTS6WVX-BnpI4VH8.js +89 -0
  583. package/packages/web/dist/assets/katex-C5jXJg4s.js +257 -0
  584. package/packages/web/dist/assets/mermaid.core-BwBKxlRA.js +313 -0
  585. package/packages/web/dist/assets/mindmap-definition-NLK3R4M7-NBnnxEoO.js +96 -0
  586. package/packages/web/dist/assets/pegDiagram-GJSIUBJH-RrXXbIvO.js +1 -0
  587. package/packages/web/dist/assets/pieDiagram-5QR66LMP-B27q6Gso.js +39 -0
  588. package/packages/web/dist/assets/quadrantDiagram-O4NWA36T-DGDsdur2.js +7 -0
  589. package/packages/web/dist/assets/railroadDiagram-XR7U4H2S-GdjkE3mI.js +1 -0
  590. package/packages/web/dist/assets/requirementDiagram-PLB6GJNP-DjK0GfgO.js +84 -0
  591. package/packages/web/dist/assets/sankeyDiagram-IPEJSGJF-BG_AIkwF.js +40 -0
  592. package/packages/web/dist/assets/scene-D4LPicHk.js +4620 -0
  593. package/packages/web/dist/assets/sequenceDiagram-PO4LG4MO-CIQwUb4y.js +169 -0
  594. package/packages/web/dist/assets/sizeCapture-INFHLROL-bpIoPxdJ.js +1 -0
  595. package/packages/web/dist/assets/stateDiagram-v2-GCMORJYK-8hYXvPPv.js +291 -0
  596. package/packages/web/dist/assets/swimlanes-2SLR337P-gfflUMF9.js +1 -0
  597. package/packages/web/dist/assets/swimlanesDiagram-TC7HE7FX-9wdzGXU-.js +8 -0
  598. package/packages/web/dist/assets/timeline-definition-EJHVYXUP-PHMNoGTZ.js +120 -0
  599. package/packages/web/dist/assets/usecaseDiagram-POWQR4AR-B2j5iteO.js +370 -0
  600. package/packages/web/dist/assets/vennDiagram-UO4OBE2U-BzxtZ-_2.js +34 -0
  601. package/packages/web/dist/assets/wardleyDiagram-VNRHLVJA-DL7YbMpY.js +78 -0
  602. package/packages/web/dist/assets/xychartDiagram-PMCCYNJV-CisgP1cT.js +7 -0
  603. package/packages/web/dist/draco/draco_decoder.js +33 -0
  604. package/packages/web/dist/draco/draco_decoder.wasm +0 -0
  605. package/packages/web/dist/draco/draco_wasm_wrapper.js +116 -0
  606. package/packages/web/dist/favicon-16.png +0 -0
  607. package/packages/web/dist/favicon-32.png +0 -0
  608. package/packages/web/dist/favicon-48.png +0 -0
  609. package/packages/web/dist/favicon.ico +0 -0
  610. package/packages/web/dist/favicon.svg +1 -1
  611. package/packages/web/dist/icon-192.png +0 -0
  612. package/packages/web/dist/icon-512.png +0 -0
  613. package/packages/web/dist/index.html +12 -4
  614. package/packages/web/dist/logo-light.svg +1 -1
  615. package/packages/web/dist/logo-mono.svg +2 -0
  616. package/packages/web/dist/logo-stacked-light.svg +2 -0
  617. package/packages/web/dist/logo-stacked.svg +2 -0
  618. package/packages/web/dist/logo-white.svg +2 -0
  619. package/packages/web/dist/logo.svg +1 -1
  620. package/packages/web/dist/mark-light.svg +1 -1
  621. package/packages/web/dist/mark-mono.svg +2 -0
  622. package/packages/web/dist/mark-small-light.svg +2 -0
  623. package/packages/web/dist/mark-small.svg +2 -0
  624. package/packages/web/dist/mark-white.svg +2 -0
  625. package/packages/web/dist/mark.svg +1 -1
  626. package/packages/web/dist/models/LICENSE.txt +5 -0
  627. package/packages/web/dist/models/brain.glb +0 -0
  628. package/packages/web/dist/site.webmanifest +23 -0
  629. package/packages/web/dist/wordmark-light.svg +2 -0
  630. package/packages/web/dist/wordmark.svg +2 -0
  631. package/packages/web/package.json +1 -1
  632. package/scripts/rookery.mjs +204 -122
  633. package/scripts/updater.mjs +227 -0
  634. package/packages/cli/dist/tui/components/Wordmark.d.ts +0 -35
  635. package/packages/cli/dist/tui/components/Wordmark.d.ts.map +0 -1
  636. package/packages/cli/dist/tui/components/Wordmark.js +0 -81
  637. package/packages/cli/dist/tui/components/Wordmark.js.map +0 -1
  638. package/packages/core/dist/agents/orchestrator.d.ts +0 -24
  639. package/packages/core/dist/agents/orchestrator.d.ts.map +0 -1
  640. package/packages/core/dist/agents/orchestrator.js +0 -88
  641. package/packages/core/dist/agents/orchestrator.js.map +0 -1
  642. package/packages/core/dist/agents/roles.d.ts +0 -21
  643. package/packages/core/dist/agents/roles.d.ts.map +0 -1
  644. package/packages/core/dist/agents/roles.js +0 -81
  645. package/packages/core/dist/agents/roles.js.map +0 -1
  646. package/packages/core/dist/agents/team.d.ts +0 -105
  647. package/packages/core/dist/agents/team.d.ts.map +0 -1
  648. package/packages/core/dist/agents/team.js +0 -623
  649. package/packages/core/dist/agents/team.js.map +0 -1
  650. package/packages/core/dist/providers/codex.d.ts +0 -10
  651. package/packages/core/dist/providers/codex.d.ts.map +0 -1
  652. package/packages/core/dist/providers/codex.js +0 -375
  653. package/packages/core/dist/providers/codex.js.map +0 -1
  654. package/packages/core/dist/tools/browser.d.ts +0 -20
  655. package/packages/core/dist/tools/browser.d.ts.map +0 -1
  656. package/packages/core/dist/tools/browser.js +0 -72
  657. package/packages/core/dist/tools/browser.js.map +0 -1
  658. package/packages/server/dist/routes/agents.d.ts +0 -5
  659. package/packages/server/dist/routes/agents.d.ts.map +0 -1
  660. package/packages/server/dist/routes/agents.js +0 -6
  661. package/packages/server/dist/routes/agents.js.map +0 -1
  662. package/packages/server/dist/routes/team.d.ts +0 -11
  663. package/packages/server/dist/routes/team.d.ts.map +0 -1
  664. package/packages/server/dist/routes/team.js +0 -36
  665. package/packages/server/dist/routes/team.js.map +0 -1
  666. package/packages/web/dist/assets/3d-force-graph-BPZmoydi.js +0 -1163
  667. package/packages/web/dist/assets/index-IBSTzK7-.js +0 -1255
  668. package/packages/web/dist/assets/index-qUXUui7W.css +0 -1
  669. package/packages/web/dist/assets/three-spritetext-B9ZIW7c-.js +0 -4
  670. package/packages/web/dist/assets/three.module-cmFfBtHS.js +0 -4228
@@ -0,0 +1,1032 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { DEFAULT_CONFIG } from '../../config.js';
3
+ import { REVIEW_TARGET, cohensKappa, costOnlyShare, gainFrom, labelCoverage, pairedRatings, pairwiseAgreement, } from './label.js';
4
+ import { measure } from './measure.js';
5
+ import { bootstrapCi, corpusDrifted, freshnessCheck } from './probe.js';
6
+ import { pipelineAgent, pipelineAssistant } from './score.js';
7
+ /**
8
+ * The evaluation machinery (dream stage 2, AP8; concept 5.3, 5.4, 5.5, 4.4).
9
+ *
10
+ * This module answers one question and refuses to answer a second one: given
11
+ * a recorded pool of frames, a baseline arm and a candidate arm, how much
12
+ * better did the candidate rank the block the model actually read - and is
13
+ * that number worth anything at all? The first half is `evaluateCandidate`,
14
+ * the second half is the validity certificate it carries with it. Whether
15
+ * the candidate is then PROMOTED is not decided here; that is AP9's gate,
16
+ * and keeping the two apart is what makes "the evaluation is invalid"
17
+ * distinguishable from "the candidate lost" (concept 5.4, rule 3).
18
+ *
19
+ * Three contracts hold everywhere in this file:
20
+ *
21
+ * - **It never writes.** It reads frames, traces and labels through the
22
+ * store's read paths and nothing else. `fetchFrame` (through
23
+ * `freshnessCheck`) has no touch path at all and `measure` is pure, so
24
+ * `touch: false` is not a flag anyone could flip - it is the absence of a
25
+ * write path (S30). The test that pins this compares `access_count` and
26
+ * `usefulness` of every row before and after a full evaluation, because a
27
+ * sensor that feeds the feedback loop it watches is worse than no sensor.
28
+ * The night's corpus fingerprint is a meta WRITE (`store.corpusFingerprint`)
29
+ * and is therefore never called here: the caller hands its stamp in.
30
+ * - **It never throws.** The night has no throw site in the dream block; an
31
+ * internal failure is reported into the result and the night carries on.
32
+ * - **It reads no further than the owner it was given.** A frame of another
33
+ * bank that reached the pool through a join is dropped and counted, never
34
+ * scored (concept 10.5).
35
+ *
36
+ * The four pieces, in the order the night uses them:
37
+ *
38
+ * 1. `splitOf` - the train/holdout/audit split, deterministic, SESSION-wise
39
+ * and free of any store, because AP14's recorder stamps a trace with the
40
+ * very same function (E3).
41
+ * 2. `evaluateCandidate` - paired per trace on the INTERSECTION of both
42
+ * closed sets, cluster-bootstrapped over sessions, with the abstention
43
+ * histogram, the coverage rates and the five validity rules.
44
+ * 3. `selectOnTraining` - the ranking runs on the training half; exactly
45
+ * one candidate goes on to the holdout (E4/S12), and the frozen audit
46
+ * set is touched exactly once per promotion (S13).
47
+ * 4. `agreementReport` - the label agreement sensor (5.5b), with `user`
48
+ * privileged. Thin `user` labels are the finding, not a zero.
49
+ *
50
+ * > Der Schaetzer ist eine untere Schranke, kein Punktschaetzer (E8). Jede
51
+ * > Bewertung berichtet ihre Abdeckungsrate, und ein Delta, das ueberwiegend
52
+ * > aus unetikettierten Positionen stammt, ist ungueltig.
53
+ */
54
+ /* ------------------------------- constants ------------------------------- */
55
+ /**
56
+ * Salt for the split draw. Deliberately NOT the recorder's sampling salt
57
+ * (`runtime.ts`): the sample decides whether a session is framed at all, the
58
+ * split decides which half it lands in, and one hash serving both would make
59
+ * every framed session fall on the same side of the split.
60
+ */
61
+ const SPLIT_SALT = 'rookery.dream.split.v1';
62
+ /**
63
+ * Split rates. Guessed, like every other bare number in the concept: three
64
+ * in ten sessions held back for the one holdout check, one in ten frozen
65
+ * into the audit set that never selects and never serves as a holdout
66
+ * (concept 5.5d). They are parameters everywhere they are used.
67
+ */
68
+ const DEFAULT_HOLDOUT_RATE = 0.3;
69
+ const DEFAULT_AUDIT_RATE = 0.1;
70
+ /**
71
+ * The one place those two rates live. The recorder stamps a trace with
72
+ * `splitOf` at turn time and the night reads the stamp back months later: if
73
+ * the two sides ever picked their rates separately, a session could change
74
+ * sides between the stamp and the evaluation, and the holdout would quietly
75
+ * stop being one.
76
+ */
77
+ export const DEFAULT_SPLIT_RATES = {
78
+ holdoutRate: DEFAULT_HOLDOUT_RATE,
79
+ auditRate: DEFAULT_AUDIT_RATE,
80
+ };
81
+ /** Mirrors the writer in store.ts; read-only here (see the module doc). */
82
+ const CORPUS_STAMP_PREFIX = 'dream.corpus_stamp.';
83
+ /** SQLite takes at most 999 bound parameters; labels are read in batches. */
84
+ const TURN_BATCH = 200;
85
+ /** No single frame may eat the shared wall clock on its own (like probe.ts). */
86
+ const FRAME_TIME_LIMIT_MS = 2000;
87
+ /** Decimals the evidence digest prints a share or a delta with. */
88
+ const DIGEST_DIGITS = 4;
89
+ /** Every reason a frame can go unscored, zeroed - counted, never swallowed. */
90
+ const ABSTAIN_REASONS = [
91
+ 'limit-out-of-box',
92
+ 'seeds-capped',
93
+ 'degraded-turn',
94
+ 'frame-missing',
95
+ 'corpus-drifted',
96
+ 'corpus-invalidated',
97
+ 'budget-changed',
98
+ 'no-reachable-label',
99
+ 'no-labelled-move',
100
+ 'pipeline-mismatch',
101
+ 'no-label-source',
102
+ 'unfinished',
103
+ ];
104
+ const LABEL_SOURCES = ['correction', 'review', 'merge', 'user'];
105
+ /**
106
+ * The sources the retrieval policy has a causal path to: a correction is
107
+ * written about what the incumbent surfaced, a merge about what the night
108
+ * condensed, a review about an assignment the same policy fed. `user` is the
109
+ * one source outside that loop, which is why it is privileged (concept 4.2b).
110
+ */
111
+ const INFLUENCEABLE = ['correction', 'merge', 'review'];
112
+ /** How many common targets `user` needs before an agreement means anything. */
113
+ const MIN_USER_PAIRS = 10;
114
+ function clampRate(value) {
115
+ if (!Number.isFinite(value))
116
+ return 0;
117
+ return Math.min(1, Math.max(0, value));
118
+ }
119
+ /**
120
+ * The split draw of one session as a number in [0, 1): FNV-1a over the
121
+ * session id and the split salt. Cheap, stable and portable - it only has to
122
+ * be deterministic, never cryptographic, and it must survive a restart,
123
+ * because a session that changed sides between two nights would put
124
+ * near-duplicate turns on both sides of every comparison.
125
+ */
126
+ function splitDraw(sessionId) {
127
+ let hash = 0x811c9dc5;
128
+ const input = sessionId + SPLIT_SALT;
129
+ for (let index = 0; index < input.length; index += 1) {
130
+ hash ^= input.charCodeAt(index);
131
+ hash = Math.imul(hash, 0x01000193);
132
+ }
133
+ return (hash >>> 0) / 0x1_0000_0000;
134
+ }
135
+ /**
136
+ * Which half a session falls in (E3). The unit is the SESSION, never the
137
+ * trace: consecutive turns of one session share topic, bank cutout and
138
+ * entity neighbourhood, so a per-trace split would lay near-duplicates on
139
+ * both sides and let `ci_low > 0` fire on leakage rather than on an effect.
140
+ *
141
+ * AP14's recorder stamps `dream_traces.holdout` and `.audit` with this same
142
+ * function, which is why it takes no store and reads no config: the recorder
143
+ * calls it inside a turn, the night calls it over a pool, and both must get
144
+ * the same answer for the same session id.
145
+ *
146
+ * The two bands sit at opposite ends of the unit interval on purpose. The
147
+ * audit set is the FROZEN one (concept 5.5d) - it takes the top band, so
148
+ * raising or lowering the holdout rate never moves a session in or out of
149
+ * it. A session without an id of its own (a trace outside any conversation)
150
+ * is its own cluster; the caller passes `trace.sessionId ?? trace.id` and
151
+ * gets a stable answer either way.
152
+ */
153
+ export function splitOf(sessionId, rates) {
154
+ const audit = clampRate(rates.auditRate);
155
+ const holdout = clampRate(rates.holdoutRate);
156
+ const draw = splitDraw(sessionId);
157
+ // Audit first: where the two bands would overlap, the frozen set wins -
158
+ // it is the floor the other two stand on, not a leftover.
159
+ if (audit > 0 && draw >= 1 - audit)
160
+ return 'audit';
161
+ if (holdout > 0 && draw < holdout)
162
+ return 'holdout';
163
+ return 'train';
164
+ }
165
+ /**
166
+ * Split a recorded pool by session. A trace that was STAMPED at record time
167
+ * keeps its stamp - `dream_traces.holdout`/`.audit` are what the turn
168
+ * decided, and re-deriving them from today's rates would silently move
169
+ * yesterday's evidence. Only an unstamped trace (every trace recorded before
170
+ * AP14 wires the stamp) is drawn here, with the same function.
171
+ */
172
+ export function splitPool(entries, rates) {
173
+ const pool = { train: [], holdout: [], audit: [] };
174
+ for (const entry of entries) {
175
+ const where = entry.trace.audit
176
+ ? 'audit'
177
+ : entry.trace.holdout
178
+ ? 'holdout'
179
+ : splitOf(entry.trace.sessionId ?? entry.trace.id, rates);
180
+ pool[where].push(entry);
181
+ }
182
+ return pool;
183
+ }
184
+ /**
185
+ * Validity rule 1 (concept 5.4): baseline and candidate are scored on the
186
+ * INTERSECTION, never each arm on its own set. A candidate that abstained on
187
+ * the hard third of the pool and was averaged over the easy two thirds would
188
+ * win against a baseline that answered everywhere, and the number would not
189
+ * be wrong - it would be about a different set.
190
+ *
191
+ * The predicate is deliberately a check on the counts rather than a comment
192
+ * on the loop that produced them: it is the one rule that can only be broken
193
+ * by a mistake inside this file, and the test that pins it must be able to
194
+ * state that mistake in numbers.
195
+ */
196
+ export function pairedOnIntersection(counts) {
197
+ return (counts.paired === counts.closed &&
198
+ counts.closed <= Math.min(counts.closedBaseline, counts.closedCandidate));
199
+ }
200
+ /**
201
+ * Validity rule 2 (concept 5.4): the candidate may abstain at most
202
+ * `abstainEps` more often than the baseline, and BOTH arms must stay under
203
+ * `abstainFloor`. A candidate that wins because it was only ever tested
204
+ * where it felt comfortable is rejected - the delta it reports is real, and
205
+ * it is about the frames it did not run away from.
206
+ */
207
+ export function abstainRuleHolds(candidateRate, baselineRate, limits) {
208
+ if (candidateRate > baselineRate + limits.abstainEps)
209
+ return false;
210
+ return candidateRate < limits.abstainFloor && baselineRate < limits.abstainFloor;
211
+ }
212
+ /**
213
+ * Validity rule 3 (concept 5.4): below `minTraces` closed traces the
214
+ * evaluation is INVALID, not "the candidate lost". The distinction is the
215
+ * whole point of the rule - a thin night must not be readable as evidence
216
+ * against a candidate, or the ratchet turns on noise.
217
+ */
218
+ export function traceFloorHolds(closed, minTraces) {
219
+ return closed >= minTraces;
220
+ }
221
+ /**
222
+ * Validity rule 4 (concept 5.4): a mean `reachable_rate` under
223
+ * `reachableFloor` means most labelled targets are unreachable for EVERY
224
+ * candidate alike (superseded, forgotten, dormant, archived). The ideal is
225
+ * then built from what is left, and the ratio says more about the bank's
226
+ * condensation than about any policy.
227
+ */
228
+ export function reachableFloorHolds(reachableRate, floor) {
229
+ return reachableRate >= floor;
230
+ }
231
+ /**
232
+ * Validity rule 5 (concept 4.4, S10): `label_coverage` over the floor and
233
+ * `cost_only_share` under the ceiling. Below the coverage floor an
234
+ * evaluation cannot tell a real delta from missing labels; above the
235
+ * cost-only ceiling the delta is predominantly block length, and a delta
236
+ * drawn from unlabelled positions is not a delta.
237
+ */
238
+ export function coverageRuleHolds(coverage, costOnly, limits) {
239
+ return coverage >= limits.coverageFloor && costOnly <= limits.costOnlyCeiling;
240
+ }
241
+ /* ------------------------------- internals ------------------------------- */
242
+ function emptyReasons() {
243
+ const reasons = {};
244
+ for (const reason of ABSTAIN_REASONS)
245
+ reasons[reason] = 0;
246
+ return reasons;
247
+ }
248
+ /** Clamp to a range, for dream keys read outside the patch schema (E21/S23). */
249
+ function clampNumber(value, lo, hi) {
250
+ const safe = Number.isFinite(value) ? value : lo;
251
+ return Math.min(hi, Math.max(lo, safe));
252
+ }
253
+ function mean(values) {
254
+ if (!values.length)
255
+ return null;
256
+ return values.reduce((total, value) => total + value, 0) / values.length;
257
+ }
258
+ /** The chain the frame belongs to - never the other one (R15). */
259
+ function replay(frame, policy) {
260
+ return frame.pipeline === 'agent' ? pipelineAgent(frame, policy) : pipelineAssistant(frame, policy);
261
+ }
262
+ /**
263
+ * The corpus stamp a frame was recorded under. Read-only twin of probe.ts's
264
+ * private helper: a stamp that cannot be read certifies nothing, and the
265
+ * drift check is waived rather than guessed.
266
+ */
267
+ function stampById(store, id) {
268
+ if (!id)
269
+ return null;
270
+ const raw = store.getMeta(CORPUS_STAMP_PREFIX + id);
271
+ if (!raw)
272
+ return null;
273
+ try {
274
+ return JSON.parse(raw);
275
+ }
276
+ catch {
277
+ return null;
278
+ }
279
+ }
280
+ /** The budget the assistant turn renders with; mirrors runtime.ts. */
281
+ function expectedBudgetChars(config) {
282
+ return Math.floor(config.memory.contextBudget * 0.4);
283
+ }
284
+ /**
285
+ * Read the labels of a pool's turns and sessions in batches, so a pool of
286
+ * five hundred frames cannot walk into SQLite's bound-parameter limit. Both
287
+ * scopes are read: a session-wide label never yields a gain (S3), but it is
288
+ * part of the labelled universe `label_coverage` is measured against and it
289
+ * takes part in the agreement check.
290
+ */
291
+ function labelsOfPool(store, owner, entries) {
292
+ const turnIds = [...new Set(entries.map((entry) => entry.trace.turnId))];
293
+ const sessionIds = [
294
+ ...new Set(entries.map((entry) => entry.trace.sessionId).filter((id) => !!id)),
295
+ ];
296
+ const labels = [];
297
+ for (let index = 0; index < turnIds.length; index += TURN_BATCH) {
298
+ labels.push(...store.labelsForTurns(turnIds.slice(index, index + TURN_BATCH), owner));
299
+ }
300
+ for (let index = 0; index < sessionIds.length; index += TURN_BATCH) {
301
+ labels.push(...store.labelsForSessions(sessionIds.slice(index, index + TURN_BATCH), owner));
302
+ }
303
+ // `labelsForSessions` selects on `turn_id`, so a session id that is also a
304
+ // turn id would come back twice; the key is what makes a label one label.
305
+ const seen = new Set();
306
+ return labels.filter((label) => {
307
+ const key = label.turnId + ' ' + label.target + ' ' + label.source;
308
+ if (seen.has(key))
309
+ return false;
310
+ seen.add(key);
311
+ return true;
312
+ });
313
+ }
314
+ const NO_GAIN = () => 0;
315
+ /**
316
+ * Fold a pool's labels into one gain function per turn (concept 4.1). The
317
+ * labelled universe is every target any label of the window names, both
318
+ * scopes included and the `review` sentinel excluded - that universe is what
319
+ * `label_coverage` asks about ("could a label exist for this position at
320
+ * all"), which is a question about the window, not about this turn.
321
+ */
322
+ function indexLabels(labels) {
323
+ const byTurn = new Map();
324
+ const universe = new Set();
325
+ for (const label of labels) {
326
+ if (label.target !== REVIEW_TARGET)
327
+ universe.add(label.target);
328
+ const bucket = byTurn.get(label.turnId);
329
+ if (bucket)
330
+ bucket.push(label);
331
+ else
332
+ byTurn.set(label.turnId, [label]);
333
+ }
334
+ const gains = new Map();
335
+ let conflicts = 0;
336
+ for (const [turnId, bucket] of byTurn) {
337
+ const folded = gainFrom(bucket);
338
+ conflicts += folded.conflicts;
339
+ gains.set(turnId, folded.gain);
340
+ }
341
+ return { gainFor: (turnId) => gains.get(turnId) ?? NO_GAIN, universe, conflicts };
342
+ }
343
+ /**
344
+ * The paired pass (concept 5.3): score both arms over every eligible frame,
345
+ * keep only the traces where BOTH closed, and form one delta per kept trace.
346
+ *
347
+ * Two things happen here that are easy to get subtly wrong, and both have
348
+ * their own test. The intersection is formed before any mean is taken, never
349
+ * after - each arm averaged over its own set is the mistake rule 1 names.
350
+ * And a trace whose two arms moved no labelled position at all abstains as
351
+ * `no-labelled-move` (concept 4.4): its delta could only ever come from the
352
+ * cost term, and a block that is shorter by four characters is not a better
353
+ * ranking. Those traces leave the mean and stay in `cost_only_share`.
354
+ */
355
+ function pairedRun(entries, index, baseline, candidate, costWeight, options) {
356
+ const reasons = emptyReasons();
357
+ const clusters = new Map();
358
+ const positions = [];
359
+ const deltaPositions = [];
360
+ const candidateScores = [];
361
+ const baselineScores = [];
362
+ const reachable = [];
363
+ const traceIds = [];
364
+ const pairedEntries = [];
365
+ let closedBaseline = 0;
366
+ let closedCandidate = 0;
367
+ let intersection = 0;
368
+ let costOnly = 0;
369
+ let frameTimeouts = 0;
370
+ let deadlineHit = false;
371
+ for (const entry of entries) {
372
+ if (options.signal?.aborted)
373
+ break;
374
+ const now = Date.now();
375
+ if (options.deadline !== undefined && now > options.deadline) {
376
+ deadlineHit = true;
377
+ break;
378
+ }
379
+ const frameDeadline = options.deadline !== undefined
380
+ ? Math.min(options.deadline, now + FRAME_TIME_LIMIT_MS)
381
+ : now + FRAME_TIME_LIMIT_MS;
382
+ const payload = entry.frame.payload;
383
+ const gain = index.gainFor(entry.trace.turnId);
384
+ const baseResult = measure(payload, baseline, gain, costWeight);
385
+ const candResult = measure(payload, candidate, gain, costWeight);
386
+ if (!baseResult.ok)
387
+ reasons[baseResult.abstain] += 1;
388
+ else
389
+ closedBaseline += 1;
390
+ if (!candResult.ok)
391
+ reasons[candResult.abstain] += 1;
392
+ else
393
+ closedCandidate += 1;
394
+ if (!baseResult.ok || !candResult.ok)
395
+ continue;
396
+ intersection += 1;
397
+ reachable.push(candResult.reachableRate);
398
+ // A frame past its sub-cap leaves the paired set rather than eating the
399
+ // shared wall clock; it still counted towards both arms' closures.
400
+ if (Date.now() > frameDeadline) {
401
+ frameTimeouts += 1;
402
+ continue;
403
+ }
404
+ // What the model read on each arm. `measure` returns the number, not the
405
+ // list, so the rendered lines are replayed once more here - the price of
406
+ // keeping `measure` a pure score with no by-products to keep in step.
407
+ const baseLines = replay(payload, baseline);
408
+ const candLines = replay(payload, candidate);
409
+ if (!baseLines.ok || !candLines.ok)
410
+ continue;
411
+ const baseIds = new Set(baseLines.lines.map((memory) => memory.id));
412
+ const candIds = new Set(candLines.lines.map((memory) => memory.id));
413
+ for (const id of new Set([...baseIds, ...candIds]))
414
+ positions.push(id);
415
+ const moved = [];
416
+ for (const id of baseIds) {
417
+ if (!candIds.has(id))
418
+ moved.push({ id, labelPossible: index.universe.has(id) });
419
+ }
420
+ for (const id of candIds) {
421
+ if (!baseIds.has(id))
422
+ moved.push({ id, labelPossible: index.universe.has(id) });
423
+ }
424
+ deltaPositions.push(moved);
425
+ if (!moved.some((position) => position.labelPossible)) {
426
+ costOnly += 1;
427
+ reasons['no-labelled-move'] += 1;
428
+ continue;
429
+ }
430
+ const cluster = entry.trace.sessionId ?? entry.trace.id;
431
+ const bucket = clusters.get(cluster);
432
+ const delta = candResult.score - baseResult.score;
433
+ if (bucket)
434
+ bucket.push(delta);
435
+ else
436
+ clusters.set(cluster, [delta]);
437
+ candidateScores.push(candResult.score);
438
+ baselineScores.push(baseResult.score);
439
+ traceIds.push(entry.trace.id);
440
+ pairedEntries.push(entry);
441
+ }
442
+ const scoreCandidate = mean(candidateScores);
443
+ const scoreBaseline = mean(baselineScores);
444
+ return {
445
+ closedBaseline,
446
+ closedCandidate,
447
+ intersection,
448
+ costOnly,
449
+ closed: traceIds.length,
450
+ scoreCandidate,
451
+ scoreBaseline,
452
+ delta: scoreCandidate !== null && scoreBaseline !== null ? scoreCandidate - scoreBaseline : null,
453
+ clusters: [...clusters.values()],
454
+ sessions: clusters.size,
455
+ reachableRate: mean(reachable),
456
+ labelCoverage: labelCoverage(positions, index.universe),
457
+ costOnlyShare: costOnlyShare(deltaPositions),
458
+ traceIds,
459
+ pairedEntries,
460
+ reasons,
461
+ frameTimeouts,
462
+ deadlineHit,
463
+ };
464
+ }
465
+ /** sha256 over the sorted trace ids - order in, one hash out (concept 5.3). */
466
+ export function traceSetHash(traceIds) {
467
+ return createHash('sha256').update([...traceIds].sort().join('\n')).digest('hex');
468
+ }
469
+ /* -------------------------- the evidence digest -------------------------- */
470
+ function signed(value) {
471
+ if (value === null || value === undefined || !Number.isFinite(value))
472
+ return 'na';
473
+ return (value >= 0 ? '+' : '') + value.toFixed(DIGEST_DIGITS);
474
+ }
475
+ function share(value) {
476
+ return Number.isFinite(value) ? value.toFixed(3) : '0.000';
477
+ }
478
+ /**
479
+ * The condensed justification stored on the evaluation (E19,
480
+ * `dream_evals.evidence_digest`).
481
+ *
482
+ * Retention is what makes this a type of its own rather than a sentence:
483
+ * frames die after `frameRetainDays` and evaluations live for
484
+ * `retainDays`, so a justification that quoted the frames would either
485
+ * outlive the memories it quoted - which S21 forbids - or vanish before the
486
+ * calibration that needs it. So the digest carries NUMBERS and the closed
487
+ * vocabulary of this file (abstention reasons, label sources, rule names)
488
+ * and no verbatim text at all. The test asserts exactly that, over frames
489
+ * whose contents are distinctive words.
490
+ */
491
+ export function renderEvidenceDigest(result) {
492
+ const detail = result.detail;
493
+ const worst = ABSTAIN_REASONS.filter((reason) => (result.abstainReasons[reason] ?? 0) > 0)
494
+ .sort((a, b) => (result.abstainReasons[b] ?? 0) - (result.abstainReasons[a] ?? 0))
495
+ .slice(0, 3)
496
+ .map((reason) => reason + ':' + result.abstainReasons[reason])
497
+ .join(',');
498
+ const sources = LABEL_SOURCES.filter((source) => detail?.deltaBySource[source] !== undefined)
499
+ .map((source) => source + ':' + signed(detail?.deltaBySource[source]))
500
+ .join('|');
501
+ const parts = [
502
+ 'slot=' + result.slot,
503
+ 'n=' + result.traces,
504
+ 'closed=' + result.closed,
505
+ 'sess=' + result.sessions,
506
+ 'abst=' + share(result.abstainRateBaseline) + '/' + share(result.abstainRateCandidate),
507
+ 'reach=' + share(result.reachableRate),
508
+ 'cov=' + share(result.labelCoverage),
509
+ 'cost=' + share(result.costOnlyShare),
510
+ 'd=' + signed(result.delta),
511
+ 'ci=[' + signed(result.ciLow) + ',' + signed(result.ciHigh) + ']',
512
+ 'live=' + signed(result.deltaLive),
513
+ 'sign=' + (result.signAgree === null ? 'na' : result.signAgree ? '1' : '0'),
514
+ 'audit=' + signed(result.auditDelta) + '/' + signed(result.auditCiLow),
515
+ 'valid=' + (result.valid ? '1' : '0'),
516
+ 'hash=' + result.traceSetHash.slice(0, 12),
517
+ ];
518
+ if (sources)
519
+ parts.push('src=' + sources);
520
+ if (worst)
521
+ parts.push('abstain=' + worst);
522
+ if (result.violations.length)
523
+ parts.push('violations=' + result.violations.join(','));
524
+ // The estimator is a lower bound, and that stands next to the number
525
+ // rather than in a footnote (E8); `ci` is a percentile interval of a
526
+ // cluster bootstrap and approximate, never exact (S11/E6).
527
+ parts.push('bound=lower', 'ci-kind=approximate');
528
+ return parts.join(' ');
529
+ }
530
+ /* --------------------------- the freshness sensor --------------------------- */
531
+ /**
532
+ * The frame-ageing sensor over a pool (concept 5.5a), through probe.ts's
533
+ * `freshnessCheck`.
534
+ *
535
+ * `freshnessCheck` takes ONE gain function, and a gain is a statement about
536
+ * one turn - so the pool is walked entry by entry, each with its own turn's
537
+ * gain, and the per-frame deltas are averaged here. That is the only honest
538
+ * way to hand a per-turn label set to a per-pool sensor; folding every
539
+ * turn's labels into one function would let a memory proven relevant in one
540
+ * turn score in every other.
541
+ *
542
+ * `touch: false` needs no flag: the live re-fetch goes through `fetchFrame`,
543
+ * which has no touch path at all (S30). The sensor is a comparator, never a
544
+ * measurement - the live world is knowingly polluted, and a sign FLIP is the
545
+ * only thing read out of it.
546
+ */
547
+ function runFreshness(store, entries, index, input, costWeight, margin) {
548
+ const summary = {
549
+ frames: 0,
550
+ closedBoth: 0,
551
+ deltaFrozen: null,
552
+ deltaLive: null,
553
+ signAgree: null,
554
+ rowsDifferShare: 0,
555
+ };
556
+ const frozen = [];
557
+ const live = [];
558
+ let compared = 0;
559
+ let differ = 0;
560
+ for (const entry of entries) {
561
+ if (input.signal?.aborted)
562
+ break;
563
+ if (input.deadline !== undefined && Date.now() > input.deadline)
564
+ break;
565
+ const report = freshnessCheck(store, [entry], {
566
+ config: input.config,
567
+ baseline: input.baseline,
568
+ candidate: input.candidate,
569
+ gain: index.gainFor(entry.trace.turnId),
570
+ costWeight,
571
+ deadline: input.deadline,
572
+ signal: input.signal,
573
+ });
574
+ summary.frames += 1;
575
+ const one = report.entries[0];
576
+ if (!one)
577
+ continue;
578
+ if (one.fresh) {
579
+ compared += 1;
580
+ if (one.rowsDiffer)
581
+ differ += 1;
582
+ }
583
+ if (one.frozenDelta !== null && one.liveDelta !== null) {
584
+ summary.closedBoth += 1;
585
+ frozen.push(one.frozenDelta);
586
+ live.push(one.liveDelta);
587
+ }
588
+ }
589
+ summary.deltaFrozen = mean(frozen);
590
+ summary.deltaLive = mean(live);
591
+ summary.rowsDifferShare = compared ? differ / compared : 0;
592
+ if (summary.deltaFrozen !== null && summary.deltaLive !== null) {
593
+ // Inside the margin the sign comparison is moot, and `null` says
594
+ // undetermined - not "they disagree" (concept 5.5a).
595
+ if (Math.abs(summary.deltaFrozen) <= margin)
596
+ summary.signAgree = null;
597
+ else
598
+ summary.signAgree = Math.sign(summary.deltaFrozen) === Math.sign(summary.deltaLive);
599
+ }
600
+ return summary;
601
+ }
602
+ /* --------------------------- evaluateCandidate --------------------------- */
603
+ function emptyResult(slot) {
604
+ return {
605
+ slot,
606
+ traces: 0,
607
+ closed: 0,
608
+ abstained: 0,
609
+ abstainReasons: emptyReasons(),
610
+ reachableRate: 0,
611
+ labelCoverage: 0,
612
+ costOnlyShare: 0,
613
+ score: 0,
614
+ baseline: 0,
615
+ delta: 0,
616
+ ciLow: 0,
617
+ ciHigh: 0,
618
+ signAgree: null,
619
+ evalMs: 0,
620
+ traceSetHash: traceSetHash([]),
621
+ valid: false,
622
+ violations: [],
623
+ sessions: 0,
624
+ closedBaseline: 0,
625
+ closedCandidate: 0,
626
+ abstainRateBaseline: 0,
627
+ abstainRateCandidate: 0,
628
+ freshness: null,
629
+ error: null,
630
+ };
631
+ }
632
+ /** The limits of concept 5.4, clamped as they are read (S23). */
633
+ export function validityLimits(config) {
634
+ const dream = config.memory.dream;
635
+ return {
636
+ minTraces: Math.max(0, Math.floor(clampNumber(dream.minTraces, 0, 1_000_000))),
637
+ abstainEps: clampNumber(dream.abstainEps, 0, 1),
638
+ abstainFloor: clampNumber(dream.abstainFloor, 0, 1),
639
+ reachableFloor: clampNumber(dream.reachableFloor, 0, 1),
640
+ coverageFloor: clampNumber(dream.coverageFloor, 0, 1),
641
+ costOnlyCeiling: clampNumber(dream.costOnlyCeiling, 0, 1),
642
+ };
643
+ }
644
+ /**
645
+ * The five rules of concept 5.4 over a finished result. Every failure is a
646
+ * named violation and the result stays readable - an invalid evaluation is
647
+ * not an error, it is a measurement that does not certify anything, and the
648
+ * numbers it did produce are still worth storing.
649
+ */
650
+ export function validityOf(result, limits) {
651
+ const violations = [];
652
+ if (!pairedOnIntersection({
653
+ closedBaseline: result.closedBaseline,
654
+ closedCandidate: result.closedCandidate,
655
+ closed: result.closed,
656
+ paired: result.closed,
657
+ })) {
658
+ violations.push('not-paired-on-intersection');
659
+ }
660
+ if (!abstainRuleHolds(result.abstainRateCandidate, result.abstainRateBaseline, limits)) {
661
+ violations.push('abstain-rate');
662
+ }
663
+ // Rule 3 is the one that must never read as "the candidate lost".
664
+ if (!traceFloorHolds(result.closed, limits.minTraces))
665
+ violations.push('n-closed-below-min');
666
+ if (!reachableFloorHolds(result.reachableRate, limits.reachableFloor)) {
667
+ violations.push('reachable-rate');
668
+ }
669
+ if (!coverageRuleHolds(result.labelCoverage, result.costOnlyShare, limits)) {
670
+ if (result.labelCoverage < limits.coverageFloor)
671
+ violations.push('label-coverage');
672
+ if (result.costOnlyShare > limits.costOnlyCeiling)
673
+ violations.push('cost-only-share');
674
+ }
675
+ return { valid: violations.length === 0, violations };
676
+ }
677
+ /**
678
+ * Evaluate one candidate arm against one baseline arm over a recorded pool
679
+ * (concept 5.3, 5.4, 4.4).
680
+ *
681
+ * The order of work is the contract. The pre-checks fire first and in a
682
+ * fixed order - a frame of another owner is dropped outright (10.5), then
683
+ * `unfinished`, then `corpus-drifted` against the stamp the caller handed
684
+ * in, then `budget-changed` against the config the turn would render with
685
+ * today. What survives is scored on both arms; the intersection of the two
686
+ * closed sets is what a delta may be formed over, and the bootstrap draws
687
+ * SESSIONS, not traces. The five validity rules run last, over the finished
688
+ * numbers, so their verdict is reproducible from the stored row alone.
689
+ *
690
+ * Nothing here writes, and nothing here throws.
691
+ */
692
+ export function evaluateCandidate(store, input) {
693
+ const startedAt = Date.now();
694
+ const result = emptyResult(input.slot);
695
+ // First line of work: the abort guard. There is no `#throwIfAborted` in the
696
+ // night's dream block, so an aborted run reports an empty, invalid result.
697
+ if (input.signal?.aborted) {
698
+ result.violations.push('aborted');
699
+ result.evalMs = Date.now() - startedAt;
700
+ return result;
701
+ }
702
+ try {
703
+ const dream = input.config.memory.dream;
704
+ const costWeight = clampNumber(dream.costWeight, 0, 1);
705
+ const tolerance = clampNumber(dream.corpusTolerance, 0, 10);
706
+ const margin = clampNumber(dream.margin, 0, 1);
707
+ const budget = expectedBudgetChars(input.config);
708
+ // Pre-checks. The owner filter is first and is not an abstention: a
709
+ // frame of another bank is not a frame this evaluation may read at all.
710
+ const reasons = emptyReasons();
711
+ const eligible = [];
712
+ let foreignOwner = 0;
713
+ for (const entry of input.entries) {
714
+ if (entry.frame.owner !== input.owner || entry.trace.owner !== input.owner) {
715
+ foreignOwner += 1;
716
+ continue;
717
+ }
718
+ const payload = entry.frame.payload;
719
+ let reason = null;
720
+ if (!entry.trace.finishedAt)
721
+ reason = 'unfinished';
722
+ else if (input.corpus &&
723
+ corpusDrifted(payload, input.corpus, tolerance, stampById(store, payload.corpusStampId))) {
724
+ reason = 'corpus-drifted';
725
+ }
726
+ else if (payload.pipeline === 'assistant' && payload.budgetChars !== budget) {
727
+ reason = 'budget-changed';
728
+ }
729
+ if (reason) {
730
+ reasons[reason] += 1;
731
+ continue;
732
+ }
733
+ eligible.push(entry);
734
+ }
735
+ result.traces = input.entries.length - foreignOwner;
736
+ const labels = labelsOfPool(store, input.owner, eligible);
737
+ const index = indexLabels(labels);
738
+ const run = pairedRun(eligible, index, input.baseline, input.candidate, costWeight, {
739
+ deadline: input.deadline,
740
+ signal: input.signal,
741
+ });
742
+ for (const reason of ABSTAIN_REASONS) {
743
+ result.abstainReasons[reason] = reasons[reason] + run.reasons[reason];
744
+ }
745
+ result.closed = run.closed;
746
+ result.closedBaseline = run.closedBaseline;
747
+ result.closedCandidate = run.closedCandidate;
748
+ result.abstained = Math.max(0, result.traces - run.closed);
749
+ result.abstainRateBaseline = result.traces
750
+ ? (result.traces - run.closedBaseline) / result.traces
751
+ : 0;
752
+ result.abstainRateCandidate = result.traces
753
+ ? (result.traces - run.closedCandidate) / result.traces
754
+ : 0;
755
+ result.reachableRate = run.reachableRate ?? 0;
756
+ result.labelCoverage = run.labelCoverage;
757
+ result.costOnlyShare = run.costOnlyShare;
758
+ result.score = run.scoreCandidate ?? 0;
759
+ result.baseline = run.scoreBaseline ?? 0;
760
+ result.delta = run.delta ?? 0;
761
+ result.sessions = run.sessions;
762
+ result.traceSetHash = traceSetHash(run.traceIds);
763
+ // The interval: B = 2000 draws of SESSIONS with replacement, percentile
764
+ // 2.5/97.5, and it is reported as approximate - at the ten to twenty-five
765
+ // clusters this pool produces, the coverage of a percentile interval on a
766
+ // skewed paired mean sits noticeably under its nominal value (S11).
767
+ const ci = run.clusters.length ? bootstrapCi(run.clusters) : null;
768
+ result.ciLow = ci?.low ?? 0;
769
+ result.ciHigh = ci?.high ?? 0;
770
+ // Per-source deltas (concept 5.5b): the same paired pass, with each
771
+ // source alone supplying the gain. One source in the pool means the
772
+ // combined gain already IS that source's, and the second pass is skipped
773
+ // rather than paid for.
774
+ const labelsBySource = {};
775
+ for (const label of labels) {
776
+ labelsBySource[label.source] = (labelsBySource[label.source] ?? 0) + 1;
777
+ }
778
+ const present = LABEL_SOURCES.filter((source) => (labelsBySource[source] ?? 0) > 0);
779
+ const deltaBySource = {};
780
+ if (input.sourceDeltas !== false && present.length === 1) {
781
+ deltaBySource[present[0]] = result.delta;
782
+ }
783
+ else if (input.sourceDeltas !== false) {
784
+ for (const source of present) {
785
+ if (input.signal?.aborted)
786
+ break;
787
+ if (input.deadline !== undefined && Date.now() > input.deadline)
788
+ break;
789
+ const only = indexLabels(labels.filter((label) => label.source === source));
790
+ const sourceRun = pairedRun(eligible, only, input.baseline, input.candidate, costWeight, { deadline: input.deadline, signal: input.signal });
791
+ if (sourceRun.delta !== null)
792
+ deltaBySource[source] = sourceRun.delta;
793
+ }
794
+ }
795
+ // The freshness sensor, over the traces that actually paired - the only
796
+ // ones whose sign there is anything to compare.
797
+ if (input.freshness !== false && run.pairedEntries.length) {
798
+ result.freshness = runFreshness(store, run.pairedEntries, index, input, costWeight, margin);
799
+ if (result.freshness.deltaLive !== null)
800
+ result.deltaLive = result.freshness.deltaLive;
801
+ result.signAgree = result.freshness.signAgree;
802
+ }
803
+ result.detail = {
804
+ deltaBySource,
805
+ labelsBySource,
806
+ conflicts: index.conflicts,
807
+ foreignOwner,
808
+ intersection: run.intersection,
809
+ costOnly: run.costOnly,
810
+ frameTimeouts: run.frameTimeouts,
811
+ deadlineHit: run.deadlineHit,
812
+ };
813
+ const verdict = validityOf(result, validityLimits(input.config));
814
+ result.valid = verdict.valid;
815
+ result.violations = verdict.violations;
816
+ result.evalMs = Date.now() - startedAt;
817
+ result.evidenceDigest = renderEvidenceDigest(result);
818
+ return result;
819
+ }
820
+ catch (cause) {
821
+ // Like the probe: an internal failure is reported, and the night goes on.
822
+ result.error = cause.message;
823
+ result.evalMs = Date.now() - startedAt;
824
+ result.valid = false;
825
+ if (!result.violations.includes('error'))
826
+ result.violations.push('error');
827
+ result.evidenceDigest = renderEvidenceDigest(result);
828
+ return result;
829
+ }
830
+ }
831
+ /**
832
+ * Rank the candidates on the training half and send exactly one of them to
833
+ * the holdout (E4/S12).
834
+ *
835
+ * Testing six candidates against one 95 percent interval is six-fold
836
+ * testing, and the concept's answer is not a correction but a discipline:
837
+ * the ranking happens where a wrong answer costs nothing, and the one
838
+ * interval that will be read is computed once, on data the ranking never
839
+ * saw. A candidate that is not ahead of the incumbent on training has no
840
+ * business on the holdout at all - the margin test itself belongs to the
841
+ * holdout (promotion condition 2a), so the bar here is plain improvement.
842
+ *
843
+ * The frozen audit set (concept 5.5d) is touched exactly once per promotion
844
+ * (S13), and only when a promotion is actually on the table: the holdout
845
+ * must be valid, over the margin and with `ci_low > 0` before the audit set
846
+ * is opened at all. Without that rule the set would be consumed by every
847
+ * night that measured something, and a set that is read every night is not
848
+ * a frozen set - it is just another holdout with a longer name.
849
+ */
850
+ export function selectOnTraining(store, input) {
851
+ const rates = input.rates ?? {
852
+ holdoutRate: DEFAULT_HOLDOUT_RATE,
853
+ auditRate: DEFAULT_AUDIT_RATE,
854
+ };
855
+ const pool = splitPool(input.entries, rates);
856
+ const report = {
857
+ split: { train: pool.train.length, holdout: pool.holdout.length, audit: pool.audit.length },
858
+ ranked: [],
859
+ chosen: null,
860
+ holdout: null,
861
+ audit: null,
862
+ auditTouched: 0,
863
+ findings: [],
864
+ };
865
+ const common = {
866
+ owner: input.owner,
867
+ slot: input.slot,
868
+ config: input.config,
869
+ corpus: input.corpus,
870
+ sourceDeltas: input.sourceDeltas,
871
+ deadline: input.deadline,
872
+ signal: input.signal,
873
+ };
874
+ for (let index = 0; index < input.candidates.length; index += 1) {
875
+ if (input.signal?.aborted)
876
+ break;
877
+ const policy = input.candidates[index];
878
+ report.ranked.push({
879
+ index,
880
+ policy,
881
+ training: evaluateCandidate(store, {
882
+ ...common,
883
+ entries: pool.train,
884
+ baseline: input.incumbent,
885
+ candidate: policy,
886
+ // The training half ranks; the freshness sensor is a promotion
887
+ // sensor and costs a live fetch per frame, so it runs once, on the
888
+ // one evaluation that can lead anywhere.
889
+ freshness: false,
890
+ }),
891
+ });
892
+ }
893
+ report.ranked.sort((a, b) => {
894
+ if (a.training.valid !== b.training.valid)
895
+ return a.training.valid ? -1 : 1;
896
+ if (b.training.delta !== a.training.delta)
897
+ return b.training.delta - a.training.delta;
898
+ if (b.training.ciLow !== a.training.ciLow)
899
+ return b.training.ciLow - a.training.ciLow;
900
+ return a.index - b.index;
901
+ });
902
+ const best = report.ranked.find((entry) => entry.training.valid && entry.training.delta > 0);
903
+ if (!best) {
904
+ report.findings.push('no-candidate-ahead-on-training');
905
+ return report;
906
+ }
907
+ report.chosen = best;
908
+ if (!pool.holdout.length) {
909
+ report.findings.push('holdout-empty');
910
+ return report;
911
+ }
912
+ report.holdout = evaluateCandidate(store, {
913
+ ...common,
914
+ entries: pool.holdout,
915
+ baseline: input.incumbent,
916
+ candidate: best.policy,
917
+ freshness: input.freshness,
918
+ });
919
+ const margin = clampNumber(input.config.memory.dream.margin, 0, 1);
920
+ const promotable = report.holdout.valid && report.holdout.delta > margin && report.holdout.ciLow > 0;
921
+ if (!promotable) {
922
+ // The audit set stays shut: nothing is on the table, so nothing spends
923
+ // the one touch this promotion would have had (S13).
924
+ report.findings.push('holdout-not-promotable');
925
+ return report;
926
+ }
927
+ if (!pool.audit.length) {
928
+ report.findings.push('audit-set-empty');
929
+ return report;
930
+ }
931
+ report.auditTouched = 1;
932
+ report.audit = evaluateCandidate(store, {
933
+ ...common,
934
+ entries: pool.audit,
935
+ // Cumulative, against the FACTORY default rather than the incumbent
936
+ // (condition 2b): a chain of individually significant steps, each only
937
+ // against its own predecessor, is a random walk with a ratchet.
938
+ baseline: input.factory,
939
+ candidate: best.policy,
940
+ freshness: false,
941
+ });
942
+ report.holdout.auditDelta = report.audit.delta;
943
+ report.holdout.auditCiLow = report.audit.ciLow;
944
+ report.holdout.evidenceDigest = renderEvidenceDigest(report.holdout);
945
+ return report;
946
+ }
947
+ /**
948
+ * The label agreement sensor (concept 5.5b, E12): Cohen's kappa per source
949
+ * pair over their common targets, with `user` privileged.
950
+ *
951
+ * `user` is privileged because it is the one source the retrieval policy has
952
+ * no causal path to. Everything else is written downstream of what the
953
+ * incumbent surfaced, so a candidate can move all of them together and be
954
+ * measuring its own reflection. Hence the second finding: a delta that is
955
+ * positive on the influenceable sources and flat or negative on `user` is
956
+ * flagged, not averaged away.
957
+ *
958
+ * And when `user` has too few common targets for an agreement at all, that
959
+ * IS the answer. The report says `validated: false` and names it, rather
960
+ * than falling back on the sources that agree with each other because they
961
+ * were written by the same process.
962
+ */
963
+ export function agreementReport(labels, options = {}) {
964
+ const floor = clampNumber(options.floor ?? DEFAULT_CONFIG.memory.dream.agreementFloor, -1, 1);
965
+ const margin = clampNumber(options.margin ?? DEFAULT_CONFIG.memory.dream.margin, 0, 1);
966
+ const minUserPairs = Math.max(1, Math.floor(options.minUserPairs ?? MIN_USER_PAIRS));
967
+ const bySource = new Map();
968
+ const labelsBySource = {};
969
+ for (const label of labels) {
970
+ const bucket = bySource.get(label.source);
971
+ if (bucket)
972
+ bucket.push(label);
973
+ else
974
+ bySource.set(label.source, [label]);
975
+ labelsBySource[label.source] = (labelsBySource[label.source] ?? 0) + 1;
976
+ }
977
+ const pairs = [];
978
+ for (let i = 0; i < LABEL_SOURCES.length; i += 1) {
979
+ for (let j = i + 1; j < LABEL_SOURCES.length; j += 1) {
980
+ const a = LABEL_SOURCES[i];
981
+ const b = LABEL_SOURCES[j];
982
+ const left = bySource.get(a) ?? [];
983
+ const right = bySource.get(b) ?? [];
984
+ if (!left.length || !right.length)
985
+ continue;
986
+ const common = pairedRatings(left, right);
987
+ if (!common.length)
988
+ continue;
989
+ pairs.push({
990
+ a,
991
+ b,
992
+ pairs: common.length,
993
+ kappa: cohensKappa(left, right),
994
+ agreement: pairwiseAgreement(left, right),
995
+ });
996
+ }
997
+ }
998
+ // The privileged comparison: the best-supported pair `user` takes part in.
999
+ const userPairsList = pairs.filter((pair) => pair.a === 'user' || pair.b === 'user');
1000
+ const bestUser = userPairsList.reduce((best, pair) => (!best || pair.pairs > best.pairs ? pair : best), null);
1001
+ const userPairs = bestUser?.pairs ?? 0;
1002
+ // Kappa where it is defined, the plain rate where it is not: `merge`
1003
+ // writes nothing but zeroes, so a kappa against it is degenerate by
1004
+ // construction and a fabricated number would be worse than the fallback.
1005
+ const userScore = bestUser ? (bestUser.kappa ?? bestUser.agreement) : null;
1006
+ const validated = userPairs >= minUserPairs && userScore !== null;
1007
+ const floorHolds = validated && (userScore ?? 0) >= floor;
1008
+ const deltas = options.deltaBySource ?? {};
1009
+ const influenceableUp = INFLUENCEABLE.some((source) => (deltas[source] ?? 0) > margin);
1010
+ const userDelta = deltas.user;
1011
+ const influenceableOnly = influenceableUp && userDelta !== undefined && userDelta <= margin;
1012
+ const findings = [];
1013
+ if (!validated)
1014
+ findings.push('user-labels-thin');
1015
+ else if (!floorHolds)
1016
+ findings.push('agreement-below-floor');
1017
+ if (influenceableOnly)
1018
+ findings.push('influenceable-only-delta');
1019
+ return {
1020
+ labelsBySource,
1021
+ pairs,
1022
+ userPairs,
1023
+ userKappa: bestUser?.kappa ?? null,
1024
+ userAgreement: bestUser?.agreement ?? null,
1025
+ validated,
1026
+ floorHolds,
1027
+ influenceableOnly,
1028
+ findings,
1029
+ ok: findings.length === 0,
1030
+ };
1031
+ }
1032
+ //# sourceMappingURL=evaluate.js.map