rookery-agent 0.1.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 (508) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +367 -0
  3. package/docs/migration.md +88 -0
  4. package/package.json +39 -0
  5. package/packages/cli/dist/commands/chat.d.ts +52 -0
  6. package/packages/cli/dist/commands/chat.d.ts.map +1 -0
  7. package/packages/cli/dist/commands/chat.js +107 -0
  8. package/packages/cli/dist/commands/chat.js.map +1 -0
  9. package/packages/cli/dist/commands/config.d.ts +12 -0
  10. package/packages/cli/dist/commands/config.d.ts.map +1 -0
  11. package/packages/cli/dist/commands/config.js +156 -0
  12. package/packages/cli/dist/commands/config.js.map +1 -0
  13. package/packages/cli/dist/commands/doctor.d.ts +12 -0
  14. package/packages/cli/dist/commands/doctor.d.ts.map +1 -0
  15. package/packages/cli/dist/commands/doctor.js +137 -0
  16. package/packages/cli/dist/commands/doctor.js.map +1 -0
  17. package/packages/cli/dist/commands/memory.d.ts +34 -0
  18. package/packages/cli/dist/commands/memory.d.ts.map +1 -0
  19. package/packages/cli/dist/commands/memory.js +133 -0
  20. package/packages/cli/dist/commands/memory.js.map +1 -0
  21. package/packages/cli/dist/commands/org.d.ts +93 -0
  22. package/packages/cli/dist/commands/org.d.ts.map +1 -0
  23. package/packages/cli/dist/commands/org.js +389 -0
  24. package/packages/cli/dist/commands/org.js.map +1 -0
  25. package/packages/cli/dist/commands/serve.d.ts +13 -0
  26. package/packages/cli/dist/commands/serve.d.ts.map +1 -0
  27. package/packages/cli/dist/commands/serve.js +100 -0
  28. package/packages/cli/dist/commands/serve.js.map +1 -0
  29. package/packages/cli/dist/commands/sessions.d.ts +18 -0
  30. package/packages/cli/dist/commands/sessions.d.ts.map +1 -0
  31. package/packages/cli/dist/commands/sessions.js +88 -0
  32. package/packages/cli/dist/commands/sessions.js.map +1 -0
  33. package/packages/cli/dist/commands/shared.d.ts +59 -0
  34. package/packages/cli/dist/commands/shared.d.ts.map +1 -0
  35. package/packages/cli/dist/commands/shared.js +230 -0
  36. package/packages/cli/dist/commands/shared.js.map +1 -0
  37. package/packages/cli/dist/commands/tasks.d.ts +62 -0
  38. package/packages/cli/dist/commands/tasks.d.ts.map +1 -0
  39. package/packages/cli/dist/commands/tasks.js +262 -0
  40. package/packages/cli/dist/commands/tasks.js.map +1 -0
  41. package/packages/cli/dist/commands/tools.d.ts +8 -0
  42. package/packages/cli/dist/commands/tools.d.ts.map +1 -0
  43. package/packages/cli/dist/commands/tools.js +65 -0
  44. package/packages/cli/dist/commands/tools.js.map +1 -0
  45. package/packages/cli/dist/index.d.ts +15 -0
  46. package/packages/cli/dist/index.d.ts.map +1 -0
  47. package/packages/cli/dist/index.js +513 -0
  48. package/packages/cli/dist/index.js.map +1 -0
  49. package/packages/cli/dist/repl.d.ts +29 -0
  50. package/packages/cli/dist/repl.d.ts.map +1 -0
  51. package/packages/cli/dist/repl.js +634 -0
  52. package/packages/cli/dist/repl.js.map +1 -0
  53. package/packages/cli/dist/tui/App.d.ts +51 -0
  54. package/packages/cli/dist/tui/App.d.ts.map +1 -0
  55. package/packages/cli/dist/tui/App.js +461 -0
  56. package/packages/cli/dist/tui/App.js.map +1 -0
  57. package/packages/cli/dist/tui/commands.d.ts +34 -0
  58. package/packages/cli/dist/tui/commands.d.ts.map +1 -0
  59. package/packages/cli/dist/tui/commands.js +367 -0
  60. package/packages/cli/dist/tui/commands.js.map +1 -0
  61. package/packages/cli/dist/tui/components/ActivityLine.d.ts +16 -0
  62. package/packages/cli/dist/tui/components/ActivityLine.d.ts.map +1 -0
  63. package/packages/cli/dist/tui/components/ActivityLine.js +7 -0
  64. package/packages/cli/dist/tui/components/ActivityLine.js.map +1 -0
  65. package/packages/cli/dist/tui/components/AssignmentsView.d.ts +31 -0
  66. package/packages/cli/dist/tui/components/AssignmentsView.d.ts.map +1 -0
  67. package/packages/cli/dist/tui/components/AssignmentsView.js +79 -0
  68. package/packages/cli/dist/tui/components/AssignmentsView.js.map +1 -0
  69. package/packages/cli/dist/tui/components/Banner.d.ts +18 -0
  70. package/packages/cli/dist/tui/components/Banner.d.ts.map +1 -0
  71. package/packages/cli/dist/tui/components/Banner.js +16 -0
  72. package/packages/cli/dist/tui/components/Banner.js.map +1 -0
  73. package/packages/cli/dist/tui/components/CodeBlock.d.ts +19 -0
  74. package/packages/cli/dist/tui/components/CodeBlock.d.ts.map +1 -0
  75. package/packages/cli/dist/tui/components/CodeBlock.js +21 -0
  76. package/packages/cli/dist/tui/components/CodeBlock.js.map +1 -0
  77. package/packages/cli/dist/tui/components/InputBox.d.ts +25 -0
  78. package/packages/cli/dist/tui/components/InputBox.d.ts.map +1 -0
  79. package/packages/cli/dist/tui/components/InputBox.js +35 -0
  80. package/packages/cli/dist/tui/components/InputBox.js.map +1 -0
  81. package/packages/cli/dist/tui/components/Markdown.d.ts +74 -0
  82. package/packages/cli/dist/tui/components/Markdown.d.ts.map +1 -0
  83. package/packages/cli/dist/tui/components/Markdown.js +293 -0
  84. package/packages/cli/dist/tui/components/Markdown.js.map +1 -0
  85. package/packages/cli/dist/tui/components/Message.d.ts +29 -0
  86. package/packages/cli/dist/tui/components/Message.d.ts.map +1 -0
  87. package/packages/cli/dist/tui/components/Message.js +28 -0
  88. package/packages/cli/dist/tui/components/Message.js.map +1 -0
  89. package/packages/cli/dist/tui/components/Scrollback.d.ts +23 -0
  90. package/packages/cli/dist/tui/components/Scrollback.d.ts.map +1 -0
  91. package/packages/cli/dist/tui/components/Scrollback.js +36 -0
  92. package/packages/cli/dist/tui/components/Scrollback.js.map +1 -0
  93. package/packages/cli/dist/tui/components/SlashPalette.d.ts +17 -0
  94. package/packages/cli/dist/tui/components/SlashPalette.d.ts.map +1 -0
  95. package/packages/cli/dist/tui/components/SlashPalette.js +19 -0
  96. package/packages/cli/dist/tui/components/SlashPalette.js.map +1 -0
  97. package/packages/cli/dist/tui/components/StatusLine.d.ts +61 -0
  98. package/packages/cli/dist/tui/components/StatusLine.d.ts.map +1 -0
  99. package/packages/cli/dist/tui/components/StatusLine.js +55 -0
  100. package/packages/cli/dist/tui/components/StatusLine.js.map +1 -0
  101. package/packages/cli/dist/tui/components/ToolGroup.d.ts +33 -0
  102. package/packages/cli/dist/tui/components/ToolGroup.d.ts.map +1 -0
  103. package/packages/cli/dist/tui/components/ToolGroup.js +52 -0
  104. package/packages/cli/dist/tui/components/ToolGroup.js.map +1 -0
  105. package/packages/cli/dist/tui/components/Wordmark.d.ts +35 -0
  106. package/packages/cli/dist/tui/components/Wordmark.d.ts.map +1 -0
  107. package/packages/cli/dist/tui/components/Wordmark.js +81 -0
  108. package/packages/cli/dist/tui/components/Wordmark.js.map +1 -0
  109. package/packages/cli/dist/tui/highlight.d.ts +29 -0
  110. package/packages/cli/dist/tui/highlight.d.ts.map +1 -0
  111. package/packages/cli/dist/tui/highlight.js +137 -0
  112. package/packages/cli/dist/tui/highlight.js.map +1 -0
  113. package/packages/cli/dist/tui/hooks/useColumns.d.ts +20 -0
  114. package/packages/cli/dist/tui/hooks/useColumns.d.ts.map +1 -0
  115. package/packages/cli/dist/tui/hooks/useColumns.js +38 -0
  116. package/packages/cli/dist/tui/hooks/useColumns.js.map +1 -0
  117. package/packages/cli/dist/tui/hooks/useHistory.d.ts +21 -0
  118. package/packages/cli/dist/tui/hooks/useHistory.d.ts.map +1 -0
  119. package/packages/cli/dist/tui/hooks/useHistory.js +57 -0
  120. package/packages/cli/dist/tui/hooks/useHistory.js.map +1 -0
  121. package/packages/cli/dist/tui/hooks/useSlash.d.ts +38 -0
  122. package/packages/cli/dist/tui/hooks/useSlash.d.ts.map +1 -0
  123. package/packages/cli/dist/tui/hooks/useSlash.js +89 -0
  124. package/packages/cli/dist/tui/hooks/useSlash.js.map +1 -0
  125. package/packages/cli/dist/tui/hooks/useTurn.d.ts +75 -0
  126. package/packages/cli/dist/tui/hooks/useTurn.d.ts.map +1 -0
  127. package/packages/cli/dist/tui/hooks/useTurn.js +396 -0
  128. package/packages/cli/dist/tui/hooks/useTurn.js.map +1 -0
  129. package/packages/cli/dist/tui/theme.d.ts +126 -0
  130. package/packages/cli/dist/tui/theme.d.ts.map +1 -0
  131. package/packages/cli/dist/tui/theme.js +127 -0
  132. package/packages/cli/dist/tui/theme.js.map +1 -0
  133. package/packages/cli/dist/tui/types.d.ts +205 -0
  134. package/packages/cli/dist/tui/types.d.ts.map +1 -0
  135. package/packages/cli/dist/tui/types.js +55 -0
  136. package/packages/cli/dist/tui/types.js.map +1 -0
  137. package/packages/cli/dist/ui/render.d.ts +74 -0
  138. package/packages/cli/dist/ui/render.d.ts.map +1 -0
  139. package/packages/cli/dist/ui/render.js +349 -0
  140. package/packages/cli/dist/ui/render.js.map +1 -0
  141. package/packages/cli/dist/ui/speech.d.ts +42 -0
  142. package/packages/cli/dist/ui/speech.d.ts.map +1 -0
  143. package/packages/cli/dist/ui/speech.js +257 -0
  144. package/packages/cli/dist/ui/speech.js.map +1 -0
  145. package/packages/cli/dist/ui/spinner.d.ts +17 -0
  146. package/packages/cli/dist/ui/spinner.d.ts.map +1 -0
  147. package/packages/cli/dist/ui/spinner.js +61 -0
  148. package/packages/cli/dist/ui/spinner.js.map +1 -0
  149. package/packages/cli/dist/ui/theme.d.ts +54 -0
  150. package/packages/cli/dist/ui/theme.d.ts.map +1 -0
  151. package/packages/cli/dist/ui/theme.js +74 -0
  152. package/packages/cli/dist/ui/theme.js.map +1 -0
  153. package/packages/cli/package.json +1 -0
  154. package/packages/core/dist/agents/legacy-persona.d.ts +4 -0
  155. package/packages/core/dist/agents/legacy-persona.d.ts.map +1 -0
  156. package/packages/core/dist/agents/legacy-persona.js +39 -0
  157. package/packages/core/dist/agents/legacy-persona.js.map +1 -0
  158. package/packages/core/dist/agents/orchestrator.d.ts +24 -0
  159. package/packages/core/dist/agents/orchestrator.d.ts.map +1 -0
  160. package/packages/core/dist/agents/orchestrator.js +88 -0
  161. package/packages/core/dist/agents/orchestrator.js.map +1 -0
  162. package/packages/core/dist/agents/persona.d.ts +56 -0
  163. package/packages/core/dist/agents/persona.d.ts.map +1 -0
  164. package/packages/core/dist/agents/persona.js +153 -0
  165. package/packages/core/dist/agents/persona.js.map +1 -0
  166. package/packages/core/dist/agents/roles.d.ts +21 -0
  167. package/packages/core/dist/agents/roles.d.ts.map +1 -0
  168. package/packages/core/dist/agents/roles.js +81 -0
  169. package/packages/core/dist/agents/roles.js.map +1 -0
  170. package/packages/core/dist/agents/team.d.ts +105 -0
  171. package/packages/core/dist/agents/team.d.ts.map +1 -0
  172. package/packages/core/dist/agents/team.js +623 -0
  173. package/packages/core/dist/agents/team.js.map +1 -0
  174. package/packages/core/dist/computer/keys.d.ts +12 -0
  175. package/packages/core/dist/computer/keys.d.ts.map +1 -0
  176. package/packages/core/dist/computer/keys.js +56 -0
  177. package/packages/core/dist/computer/keys.js.map +1 -0
  178. package/packages/core/dist/computer/mcp-server.d.ts +11 -0
  179. package/packages/core/dist/computer/mcp-server.d.ts.map +1 -0
  180. package/packages/core/dist/computer/mcp-server.js +228 -0
  181. package/packages/core/dist/computer/mcp-server.js.map +1 -0
  182. package/packages/core/dist/computer/powershell.d.ts +13 -0
  183. package/packages/core/dist/computer/powershell.d.ts.map +1 -0
  184. package/packages/core/dist/computer/powershell.js +359 -0
  185. package/packages/core/dist/computer/powershell.js.map +1 -0
  186. package/packages/core/dist/computer/tools.d.ts +43 -0
  187. package/packages/core/dist/computer/tools.d.ts.map +1 -0
  188. package/packages/core/dist/computer/tools.js +260 -0
  189. package/packages/core/dist/computer/tools.js.map +1 -0
  190. package/packages/core/dist/config.d.ts +32 -0
  191. package/packages/core/dist/config.d.ts.map +1 -0
  192. package/packages/core/dist/config.js +329 -0
  193. package/packages/core/dist/config.js.map +1 -0
  194. package/packages/core/dist/cron/parse.d.ts +52 -0
  195. package/packages/core/dist/cron/parse.d.ts.map +1 -0
  196. package/packages/core/dist/cron/parse.js +277 -0
  197. package/packages/core/dist/cron/parse.js.map +1 -0
  198. package/packages/core/dist/cron/scheduler.d.ts +102 -0
  199. package/packages/core/dist/cron/scheduler.d.ts.map +1 -0
  200. package/packages/core/dist/cron/scheduler.js +334 -0
  201. package/packages/core/dist/cron/scheduler.js.map +1 -0
  202. package/packages/core/dist/cron/script.d.ts +9 -0
  203. package/packages/core/dist/cron/script.d.ts.map +1 -0
  204. package/packages/core/dist/cron/script.js +113 -0
  205. package/packages/core/dist/cron/script.js.map +1 -0
  206. package/packages/core/dist/cron/store.d.ts +77 -0
  207. package/packages/core/dist/cron/store.d.ts.map +1 -0
  208. package/packages/core/dist/cron/store.js +229 -0
  209. package/packages/core/dist/cron/store.js.map +1 -0
  210. package/packages/core/dist/gateway/policy.d.ts +113 -0
  211. package/packages/core/dist/gateway/policy.d.ts.map +1 -0
  212. package/packages/core/dist/gateway/policy.js +373 -0
  213. package/packages/core/dist/gateway/policy.js.map +1 -0
  214. package/packages/core/dist/index.d.ts +45 -0
  215. package/packages/core/dist/index.d.ts.map +1 -0
  216. package/packages/core/dist/index.js +52 -0
  217. package/packages/core/dist/index.js.map +1 -0
  218. package/packages/core/dist/logger.d.ts +21 -0
  219. package/packages/core/dist/logger.d.ts.map +1 -0
  220. package/packages/core/dist/logger.js +61 -0
  221. package/packages/core/dist/logger.js.map +1 -0
  222. package/packages/core/dist/memory/db.d.ts +12 -0
  223. package/packages/core/dist/memory/db.d.ts.map +1 -0
  224. package/packages/core/dist/memory/db.js +414 -0
  225. package/packages/core/dist/memory/db.js.map +1 -0
  226. package/packages/core/dist/memory/extractor.d.ts +35 -0
  227. package/packages/core/dist/memory/extractor.d.ts.map +1 -0
  228. package/packages/core/dist/memory/extractor.js +159 -0
  229. package/packages/core/dist/memory/extractor.js.map +1 -0
  230. package/packages/core/dist/memory/gate.d.ts +68 -0
  231. package/packages/core/dist/memory/gate.d.ts.map +1 -0
  232. package/packages/core/dist/memory/gate.js +163 -0
  233. package/packages/core/dist/memory/gate.js.map +1 -0
  234. package/packages/core/dist/memory/recall.d.ts +61 -0
  235. package/packages/core/dist/memory/recall.d.ts.map +1 -0
  236. package/packages/core/dist/memory/recall.js +342 -0
  237. package/packages/core/dist/memory/recall.js.map +1 -0
  238. package/packages/core/dist/memory/sleep.d.ts +105 -0
  239. package/packages/core/dist/memory/sleep.d.ts.map +1 -0
  240. package/packages/core/dist/memory/sleep.js +888 -0
  241. package/packages/core/dist/memory/sleep.js.map +1 -0
  242. package/packages/core/dist/memory/store.d.ts +263 -0
  243. package/packages/core/dist/memory/store.d.ts.map +1 -0
  244. package/packages/core/dist/memory/store.js +999 -0
  245. package/packages/core/dist/memory/store.js.map +1 -0
  246. package/packages/core/dist/migration-cron.d.ts +37 -0
  247. package/packages/core/dist/migration-cron.d.ts.map +1 -0
  248. package/packages/core/dist/migration-cron.js +257 -0
  249. package/packages/core/dist/migration-cron.js.map +1 -0
  250. package/packages/core/dist/migration-scripts.d.ts +15 -0
  251. package/packages/core/dist/migration-scripts.d.ts.map +1 -0
  252. package/packages/core/dist/migration-scripts.js +97 -0
  253. package/packages/core/dist/migration-scripts.js.map +1 -0
  254. package/packages/core/dist/migration.d.ts +33 -0
  255. package/packages/core/dist/migration.d.ts.map +1 -0
  256. package/packages/core/dist/migration.js +296 -0
  257. package/packages/core/dist/migration.js.map +1 -0
  258. package/packages/core/dist/org/bridge.d.ts +42 -0
  259. package/packages/core/dist/org/bridge.d.ts.map +1 -0
  260. package/packages/core/dist/org/bridge.js +139 -0
  261. package/packages/core/dist/org/bridge.js.map +1 -0
  262. package/packages/core/dist/org/controller.d.ts +118 -0
  263. package/packages/core/dist/org/controller.d.ts.map +1 -0
  264. package/packages/core/dist/org/controller.js +1431 -0
  265. package/packages/core/dist/org/controller.js.map +1 -0
  266. package/packages/core/dist/org/mcp-bridge.d.ts +11 -0
  267. package/packages/core/dist/org/mcp-bridge.d.ts.map +1 -0
  268. package/packages/core/dist/org/mcp-bridge.js +148 -0
  269. package/packages/core/dist/org/mcp-bridge.js.map +1 -0
  270. package/packages/core/dist/org/planner.d.ts +60 -0
  271. package/packages/core/dist/org/planner.d.ts.map +1 -0
  272. package/packages/core/dist/org/planner.js +175 -0
  273. package/packages/core/dist/org/planner.js.map +1 -0
  274. package/packages/core/dist/org/ponytail.d.ts +24 -0
  275. package/packages/core/dist/org/ponytail.d.ts.map +1 -0
  276. package/packages/core/dist/org/ponytail.js +53 -0
  277. package/packages/core/dist/org/ponytail.js.map +1 -0
  278. package/packages/core/dist/org/project-mcp.d.ts +32 -0
  279. package/packages/core/dist/org/project-mcp.d.ts.map +1 -0
  280. package/packages/core/dist/org/project-mcp.js +53 -0
  281. package/packages/core/dist/org/project-mcp.js.map +1 -0
  282. package/packages/core/dist/org/prompts.d.ts +71 -0
  283. package/packages/core/dist/org/prompts.d.ts.map +1 -0
  284. package/packages/core/dist/org/prompts.js +268 -0
  285. package/packages/core/dist/org/prompts.js.map +1 -0
  286. package/packages/core/dist/org/store.d.ts +176 -0
  287. package/packages/core/dist/org/store.d.ts.map +1 -0
  288. package/packages/core/dist/org/store.js +594 -0
  289. package/packages/core/dist/org/store.js.map +1 -0
  290. package/packages/core/dist/org/tools.d.ts +22 -0
  291. package/packages/core/dist/org/tools.d.ts.map +1 -0
  292. package/packages/core/dist/org/tools.js +578 -0
  293. package/packages/core/dist/org/tools.js.map +1 -0
  294. package/packages/core/dist/profile.d.ts +16 -0
  295. package/packages/core/dist/profile.d.ts.map +1 -0
  296. package/packages/core/dist/profile.js +176 -0
  297. package/packages/core/dist/profile.js.map +1 -0
  298. package/packages/core/dist/providers/catalogue.d.ts +6 -0
  299. package/packages/core/dist/providers/catalogue.d.ts.map +1 -0
  300. package/packages/core/dist/providers/catalogue.js +104 -0
  301. package/packages/core/dist/providers/catalogue.js.map +1 -0
  302. package/packages/core/dist/providers/claude-code.d.ts +10 -0
  303. package/packages/core/dist/providers/claude-code.d.ts.map +1 -0
  304. package/packages/core/dist/providers/claude-code.js +321 -0
  305. package/packages/core/dist/providers/claude-code.js.map +1 -0
  306. package/packages/core/dist/providers/codex.d.ts +10 -0
  307. package/packages/core/dist/providers/codex.d.ts.map +1 -0
  308. package/packages/core/dist/providers/codex.js +375 -0
  309. package/packages/core/dist/providers/codex.js.map +1 -0
  310. package/packages/core/dist/providers/process.d.ts +48 -0
  311. package/packages/core/dist/providers/process.d.ts.map +1 -0
  312. package/packages/core/dist/providers/process.js +165 -0
  313. package/packages/core/dist/providers/process.js.map +1 -0
  314. package/packages/core/dist/providers/quota.d.ts +13 -0
  315. package/packages/core/dist/providers/quota.d.ts.map +1 -0
  316. package/packages/core/dist/providers/quota.js +231 -0
  317. package/packages/core/dist/providers/quota.js.map +1 -0
  318. package/packages/core/dist/providers/registry.d.ts +27 -0
  319. package/packages/core/dist/providers/registry.d.ts.map +1 -0
  320. package/packages/core/dist/providers/registry.js +64 -0
  321. package/packages/core/dist/providers/registry.js.map +1 -0
  322. package/packages/core/dist/runtime.d.ts +149 -0
  323. package/packages/core/dist/runtime.d.ts.map +1 -0
  324. package/packages/core/dist/runtime.js +778 -0
  325. package/packages/core/dist/runtime.js.map +1 -0
  326. package/packages/core/dist/skills/import.d.ts +41 -0
  327. package/packages/core/dist/skills/import.d.ts.map +1 -0
  328. package/packages/core/dist/skills/import.js +129 -0
  329. package/packages/core/dist/skills/import.js.map +1 -0
  330. package/packages/core/dist/skills/store.d.ts +57 -0
  331. package/packages/core/dist/skills/store.d.ts.map +1 -0
  332. package/packages/core/dist/skills/store.js +126 -0
  333. package/packages/core/dist/skills/store.js.map +1 -0
  334. package/packages/core/dist/tools/browser.d.ts +20 -0
  335. package/packages/core/dist/tools/browser.d.ts.map +1 -0
  336. package/packages/core/dist/tools/browser.js +72 -0
  337. package/packages/core/dist/tools/browser.js.map +1 -0
  338. package/packages/core/dist/tools/catalog.d.ts +67 -0
  339. package/packages/core/dist/tools/catalog.d.ts.map +1 -0
  340. package/packages/core/dist/tools/catalog.js +233 -0
  341. package/packages/core/dist/tools/catalog.js.map +1 -0
  342. package/packages/core/dist/tools/hub.d.ts +68 -0
  343. package/packages/core/dist/tools/hub.d.ts.map +1 -0
  344. package/packages/core/dist/tools/hub.js +213 -0
  345. package/packages/core/dist/tools/hub.js.map +1 -0
  346. package/packages/core/dist/types.d.ts +1031 -0
  347. package/packages/core/dist/types.d.ts.map +1 -0
  348. package/packages/core/dist/types.js +22 -0
  349. package/packages/core/dist/types.js.map +1 -0
  350. package/packages/core/dist/util/queue.d.ts +25 -0
  351. package/packages/core/dist/util/queue.d.ts.map +1 -0
  352. package/packages/core/dist/util/queue.js +64 -0
  353. package/packages/core/dist/util/queue.js.map +1 -0
  354. package/packages/core/package.json +1 -0
  355. package/packages/server/dist/auth.d.ts +12 -0
  356. package/packages/server/dist/auth.d.ts.map +1 -0
  357. package/packages/server/dist/auth.js +61 -0
  358. package/packages/server/dist/auth.js.map +1 -0
  359. package/packages/server/dist/context.d.ts +29 -0
  360. package/packages/server/dist/context.d.ts.map +1 -0
  361. package/packages/server/dist/context.js +46 -0
  362. package/packages/server/dist/context.js.map +1 -0
  363. package/packages/server/dist/env.d.ts +8 -0
  364. package/packages/server/dist/env.d.ts.map +1 -0
  365. package/packages/server/dist/env.js +36 -0
  366. package/packages/server/dist/env.js.map +1 -0
  367. package/packages/server/dist/gateways/push.d.ts +22 -0
  368. package/packages/server/dist/gateways/push.d.ts.map +1 -0
  369. package/packages/server/dist/gateways/push.js +267 -0
  370. package/packages/server/dist/gateways/push.js.map +1 -0
  371. package/packages/server/dist/gateways/telegram-api.d.ts +82 -0
  372. package/packages/server/dist/gateways/telegram-api.d.ts.map +1 -0
  373. package/packages/server/dist/gateways/telegram-api.js +168 -0
  374. package/packages/server/dist/gateways/telegram-api.js.map +1 -0
  375. package/packages/server/dist/gateways/telegram.d.ts +32 -0
  376. package/packages/server/dist/gateways/telegram.d.ts.map +1 -0
  377. package/packages/server/dist/gateways/telegram.js +583 -0
  378. package/packages/server/dist/gateways/telegram.js.map +1 -0
  379. package/packages/server/dist/index.d.ts +12 -0
  380. package/packages/server/dist/index.d.ts.map +1 -0
  381. package/packages/server/dist/index.js +12 -0
  382. package/packages/server/dist/index.js.map +1 -0
  383. package/packages/server/dist/main.d.ts +2 -0
  384. package/packages/server/dist/main.d.ts.map +1 -0
  385. package/packages/server/dist/main.js +74 -0
  386. package/packages/server/dist/main.js.map +1 -0
  387. package/packages/server/dist/routes/agents.d.ts +5 -0
  388. package/packages/server/dist/routes/agents.d.ts.map +1 -0
  389. package/packages/server/dist/routes/agents.js +6 -0
  390. package/packages/server/dist/routes/agents.js.map +1 -0
  391. package/packages/server/dist/routes/chat.d.ts +10 -0
  392. package/packages/server/dist/routes/chat.d.ts.map +1 -0
  393. package/packages/server/dist/routes/chat.js +36 -0
  394. package/packages/server/dist/routes/chat.js.map +1 -0
  395. package/packages/server/dist/routes/config.d.ts +4 -0
  396. package/packages/server/dist/routes/config.d.ts.map +1 -0
  397. package/packages/server/dist/routes/config.js +58 -0
  398. package/packages/server/dist/routes/config.js.map +1 -0
  399. package/packages/server/dist/routes/cron.d.ts +10 -0
  400. package/packages/server/dist/routes/cron.d.ts.map +1 -0
  401. package/packages/server/dist/routes/cron.js +128 -0
  402. package/packages/server/dist/routes/cron.js.map +1 -0
  403. package/packages/server/dist/routes/gateways.d.ts +10 -0
  404. package/packages/server/dist/routes/gateways.d.ts.map +1 -0
  405. package/packages/server/dist/routes/gateways.js +32 -0
  406. package/packages/server/dist/routes/gateways.js.map +1 -0
  407. package/packages/server/dist/routes/health.d.ts +8 -0
  408. package/packages/server/dist/routes/health.d.ts.map +1 -0
  409. package/packages/server/dist/routes/health.js +12 -0
  410. package/packages/server/dist/routes/health.js.map +1 -0
  411. package/packages/server/dist/routes/memories.d.ts +11 -0
  412. package/packages/server/dist/routes/memories.d.ts.map +1 -0
  413. package/packages/server/dist/routes/memories.js +134 -0
  414. package/packages/server/dist/routes/memories.js.map +1 -0
  415. package/packages/server/dist/routes/org.d.ts +13 -0
  416. package/packages/server/dist/routes/org.d.ts.map +1 -0
  417. package/packages/server/dist/routes/org.js +316 -0
  418. package/packages/server/dist/routes/org.js.map +1 -0
  419. package/packages/server/dist/routes/profile.d.ts +4 -0
  420. package/packages/server/dist/routes/profile.d.ts.map +1 -0
  421. package/packages/server/dist/routes/profile.js +51 -0
  422. package/packages/server/dist/routes/profile.js.map +1 -0
  423. package/packages/server/dist/routes/providers.d.ts +9 -0
  424. package/packages/server/dist/routes/providers.d.ts.map +1 -0
  425. package/packages/server/dist/routes/providers.js +41 -0
  426. package/packages/server/dist/routes/providers.js.map +1 -0
  427. package/packages/server/dist/routes/sessions.d.ts +9 -0
  428. package/packages/server/dist/routes/sessions.d.ts.map +1 -0
  429. package/packages/server/dist/routes/sessions.js +72 -0
  430. package/packages/server/dist/routes/sessions.js.map +1 -0
  431. package/packages/server/dist/routes/sleep.d.ts +12 -0
  432. package/packages/server/dist/routes/sleep.d.ts.map +1 -0
  433. package/packages/server/dist/routes/sleep.js +70 -0
  434. package/packages/server/dist/routes/sleep.js.map +1 -0
  435. package/packages/server/dist/routes/stats.d.ts +17 -0
  436. package/packages/server/dist/routes/stats.d.ts.map +1 -0
  437. package/packages/server/dist/routes/stats.js +57 -0
  438. package/packages/server/dist/routes/stats.js.map +1 -0
  439. package/packages/server/dist/routes/team.d.ts +11 -0
  440. package/packages/server/dist/routes/team.d.ts.map +1 -0
  441. package/packages/server/dist/routes/team.js +36 -0
  442. package/packages/server/dist/routes/team.js.map +1 -0
  443. package/packages/server/dist/routes/tools.d.ts +10 -0
  444. package/packages/server/dist/routes/tools.d.ts.map +1 -0
  445. package/packages/server/dist/routes/tools.js +128 -0
  446. package/packages/server/dist/routes/tools.js.map +1 -0
  447. package/packages/server/dist/routes/tts.d.ts +12 -0
  448. package/packages/server/dist/routes/tts.d.ts.map +1 -0
  449. package/packages/server/dist/routes/tts.js +38 -0
  450. package/packages/server/dist/routes/tts.js.map +1 -0
  451. package/packages/server/dist/routes/ws.d.ts +13 -0
  452. package/packages/server/dist/routes/ws.d.ts.map +1 -0
  453. package/packages/server/dist/routes/ws.js +96 -0
  454. package/packages/server/dist/routes/ws.js.map +1 -0
  455. package/packages/server/dist/schemas.d.ts +981 -0
  456. package/packages/server/dist/schemas.d.ts.map +1 -0
  457. package/packages/server/dist/schemas.js +339 -0
  458. package/packages/server/dist/schemas.js.map +1 -0
  459. package/packages/server/dist/server.d.ts +20 -0
  460. package/packages/server/dist/server.d.ts.map +1 -0
  461. package/packages/server/dist/server.js +234 -0
  462. package/packages/server/dist/server.js.map +1 -0
  463. package/packages/server/dist/services/stream.d.ts +77 -0
  464. package/packages/server/dist/services/stream.d.ts.map +1 -0
  465. package/packages/server/dist/services/stream.js +84 -0
  466. package/packages/server/dist/services/stream.js.map +1 -0
  467. package/packages/server/dist/services/tts.d.ts +53 -0
  468. package/packages/server/dist/services/tts.d.ts.map +1 -0
  469. package/packages/server/dist/services/tts.js +281 -0
  470. package/packages/server/dist/services/tts.js.map +1 -0
  471. package/packages/server/dist/services/voice-keys.d.ts +26 -0
  472. package/packages/server/dist/services/voice-keys.d.ts.map +1 -0
  473. package/packages/server/dist/services/voice-keys.js +51 -0
  474. package/packages/server/dist/services/voice-keys.js.map +1 -0
  475. package/packages/server/dist/static.d.ts +12 -0
  476. package/packages/server/dist/static.d.ts.map +1 -0
  477. package/packages/server/dist/static.js +63 -0
  478. package/packages/server/dist/static.js.map +1 -0
  479. package/packages/server/package.json +1 -0
  480. package/packages/web/dist/apple-touch-icon.png +0 -0
  481. package/packages/web/dist/assets/3d-force-graph-BPZmoydi.js +1163 -0
  482. package/packages/web/dist/assets/bricolage-grotesque-latin-ext-wght-normal-CcLUaPy7.woff2 +0 -0
  483. package/packages/web/dist/assets/bricolage-grotesque-latin-wght-normal-DLoelf7F.woff2 +0 -0
  484. package/packages/web/dist/assets/bricolage-grotesque-vietnamese-wght-normal-BUzh504Q.woff2 +0 -0
  485. package/packages/web/dist/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
  486. package/packages/web/dist/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
  487. package/packages/web/dist/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
  488. package/packages/web/dist/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
  489. package/packages/web/dist/assets/geist-mono-cyrillic-ext-wght-normal-X_5orZeX.woff2 +0 -0
  490. package/packages/web/dist/assets/geist-mono-cyrillic-wght-normal-DiZS0aHC.woff2 +0 -0
  491. package/packages/web/dist/assets/geist-mono-latin-ext-wght-normal-Bwz-egvJ.woff2 +0 -0
  492. package/packages/web/dist/assets/geist-mono-latin-wght-normal-XN7g48iV.woff2 +0 -0
  493. package/packages/web/dist/assets/geist-mono-symbols2-wght-normal-CO5SzqOn.woff2 +0 -0
  494. package/packages/web/dist/assets/geist-mono-vietnamese-wght-normal-DadHysG0.woff2 +0 -0
  495. package/packages/web/dist/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
  496. package/packages/web/dist/assets/index-IBSTzK7-.js +1255 -0
  497. package/packages/web/dist/assets/index-qUXUui7W.css +1 -0
  498. package/packages/web/dist/assets/three-spritetext-B9ZIW7c-.js +4 -0
  499. package/packages/web/dist/assets/three.module-cmFfBtHS.js +4228 -0
  500. package/packages/web/dist/favicon.ico +0 -0
  501. package/packages/web/dist/favicon.svg +2 -0
  502. package/packages/web/dist/index.html +28 -0
  503. package/packages/web/dist/logo-light.svg +2 -0
  504. package/packages/web/dist/logo.svg +2 -0
  505. package/packages/web/dist/mark-light.svg +2 -0
  506. package/packages/web/dist/mark.svg +2 -0
  507. package/packages/web/package.json +1 -0
  508. package/scripts/rookery.mjs +183 -0
@@ -0,0 +1,359 @@
1
+ import { spawn } from 'node:child_process';
2
+ import { createInterface } from 'node:readline';
3
+ /**
4
+ * One long-lived Windows PowerShell with the screen, mouse and keyboard
5
+ * helpers compiled in. Compiling the C# once per process is what makes a
6
+ * click cost milliseconds instead of a second; a fresh shell per action
7
+ * would recompile every time.
8
+ *
9
+ * Protocol: one base64 line in, a JSON line plus an end marker out. Requests
10
+ * are serialised, so an action never overlaps a screenshot.
11
+ */
12
+ const END = '<<RK-END>>';
13
+ /** The C# behind the helpers: raw Win32, because .NET has no mouse of its own. */
14
+ const NATIVE = `
15
+ using System;
16
+ using System.Text;
17
+ using System.Runtime.InteropServices;
18
+ public static class RkNative {
19
+ [DllImport("user32.dll")] public static extern bool SetProcessDPIAware();
20
+ [DllImport("user32.dll")] public static extern bool SetCursorPos(int x, int y);
21
+ [DllImport("user32.dll")] public static extern bool GetCursorPos(out POINT p);
22
+ [DllImport("user32.dll")] public static extern void mouse_event(uint flags, int dx, int dy, int data, UIntPtr extra);
23
+ [DllImport("user32.dll")] public static extern void keybd_event(byte vk, byte scan, uint flags, UIntPtr extra);
24
+ [DllImport("user32.dll")] public static extern uint SendInput(uint n, INPUT[] inputs, int size);
25
+ [DllImport("user32.dll")] public static extern IntPtr GetForegroundWindow();
26
+ [DllImport("user32.dll")] public static extern bool SetForegroundWindow(IntPtr h);
27
+ [DllImport("user32.dll")] public static extern bool ShowWindow(IntPtr h, int cmd);
28
+ [DllImport("user32.dll")] public static extern bool IsIconic(IntPtr h);
29
+ [DllImport("user32.dll")] public static extern bool IsWindowVisible(IntPtr h);
30
+ [DllImport("user32.dll")] public static extern int GetWindowText(IntPtr h, StringBuilder s, int n);
31
+ [DllImport("user32.dll")] public static extern int GetWindowTextLength(IntPtr h);
32
+ [DllImport("user32.dll")] public static extern bool GetWindowRect(IntPtr h, out RECT r);
33
+ [DllImport("user32.dll")] public static extern uint GetWindowThreadProcessId(IntPtr h, out uint pid);
34
+ [DllImport("user32.dll")] public static extern bool EnumWindows(EnumProc cb, IntPtr l);
35
+ public delegate bool EnumProc(IntPtr h, IntPtr l);
36
+ [StructLayout(LayoutKind.Sequential)] public struct POINT { public int X; public int Y; }
37
+ [StructLayout(LayoutKind.Sequential)] public struct RECT { public int Left; public int Top; public int Right; public int Bottom; }
38
+ [StructLayout(LayoutKind.Sequential)] public struct KEYBDINPUT { public ushort wVk; public ushort wScan; public uint dwFlags; public uint time; public IntPtr dwExtraInfo; }
39
+ [StructLayout(LayoutKind.Sequential)] public struct MOUSEINPUT { public int dx; public int dy; public uint mouseData; public uint dwFlags; public uint time; public IntPtr dwExtraInfo; }
40
+ [StructLayout(LayoutKind.Sequential)] public struct HARDWAREINPUT { public uint uMsg; public ushort wParamL; public ushort wParamH; }
41
+ [StructLayout(LayoutKind.Explicit)] public struct INPUTUNION { [FieldOffset(0)] public MOUSEINPUT mi; [FieldOffset(0)] public KEYBDINPUT ki; [FieldOffset(0)] public HARDWAREINPUT hi; }
42
+ [StructLayout(LayoutKind.Sequential)] public struct INPUT { public uint type; public INPUTUNION u; }
43
+
44
+ // Text goes in as Unicode key events, so umlauts and symbols arrive whatever the layout.
45
+ public static void TypeText(string text) {
46
+ foreach (char c in text) {
47
+ if (c == '\\r') continue;
48
+ if (c == '\\n') { Tap(0x0D); continue; }
49
+ INPUT[] pair = new INPUT[2];
50
+ pair[0].type = 1; pair[0].u.ki.wScan = (ushort)c; pair[0].u.ki.dwFlags = 0x0004;
51
+ pair[1].type = 1; pair[1].u.ki.wScan = (ushort)c; pair[1].u.ki.dwFlags = 0x0004 | 0x0002;
52
+ SendInput(2, pair, Marshal.SizeOf(typeof(INPUT)));
53
+ System.Threading.Thread.Sleep(4);
54
+ }
55
+ }
56
+ public static void Tap(byte vk) { keybd_event(vk, 0, 0, UIntPtr.Zero); keybd_event(vk, 0, 2, UIntPtr.Zero); }
57
+ public static void Combo(int[] keys) {
58
+ foreach (int k in keys) { keybd_event((byte)k, 0, 0, UIntPtr.Zero); System.Threading.Thread.Sleep(15); }
59
+ for (int i = keys.Length - 1; i >= 0; i--) { keybd_event((byte)keys[i], 0, 2, UIntPtr.Zero); System.Threading.Thread.Sleep(15); }
60
+ }
61
+ public static string Title(IntPtr h) {
62
+ int n = GetWindowTextLength(h); if (n == 0) return "";
63
+ StringBuilder sb = new StringBuilder(n + 1); GetWindowText(h, sb, n + 1); return sb.ToString();
64
+ }
65
+ public static System.Collections.Generic.List<IntPtr> Windows() {
66
+ var list = new System.Collections.Generic.List<IntPtr>();
67
+ EnumWindows(delegate(IntPtr h, IntPtr l) { if (IsWindowVisible(h) && GetWindowTextLength(h) > 0) list.Add(h); return true; }, IntPtr.Zero);
68
+ return list;
69
+ }
70
+ public static bool Focus(IntPtr h) {
71
+ if (IsIconic(h)) ShowWindow(h, 9);
72
+ // A synthetic Alt tap lifts the foreground lock so SetForegroundWindow is honoured.
73
+ keybd_event(0x12, 0, 0, UIntPtr.Zero); keybd_event(0x12, 0, 2, UIntPtr.Zero);
74
+ return SetForegroundWindow(h);
75
+ }
76
+ }
77
+ `;
78
+ /** The PowerShell side: the helpers the Node process calls by name. */
79
+ const PRELUDE = `
80
+ $ErrorActionPreference = 'Stop'
81
+ $ProgressPreference = 'SilentlyContinue'
82
+ [Console]::OutputEncoding = [System.Text.Encoding]::UTF8
83
+ [Console]::InputEncoding = [System.Text.Encoding]::UTF8
84
+ Add-Type -AssemblyName System.Windows.Forms
85
+ Add-Type -AssemblyName System.Drawing
86
+ Add-Type -TypeDefinition @'
87
+ ${NATIVE}
88
+ '@
89
+ [RkNative]::SetProcessDPIAware() | Out-Null
90
+
91
+ function Rk-Bounds { [System.Windows.Forms.SystemInformation]::VirtualScreen }
92
+
93
+ function Rk-Cursor {
94
+ $p = New-Object RkNative+POINT
95
+ [RkNative]::GetCursorPos([ref]$p) | Out-Null
96
+ @{ x = $p.X; y = $p.Y }
97
+ }
98
+
99
+ function Rk-Failsafe {
100
+ $b = Rk-Bounds
101
+ $c = Rk-Cursor
102
+ if (($c.x - $b.Left) -le 2 -and ($c.y - $b.Top) -le 2) {
103
+ throw 'Refused: the pointer is in the top-left corner, which is the emergency brake. Ask the user before continuing.'
104
+ }
105
+ }
106
+
107
+ function Rk-ScreenInfo {
108
+ $b = Rk-Bounds
109
+ $screens = @([System.Windows.Forms.Screen]::AllScreens | ForEach-Object {
110
+ @{ name = $_.DeviceName; primary = $_.Primary; x = $_.Bounds.X; y = $_.Bounds.Y; width = $_.Bounds.Width; height = $_.Bounds.Height }
111
+ })
112
+ @{ left = $b.Left; top = $b.Top; width = $b.Width; height = $b.Height; screens = $screens; cursor = (Rk-Cursor) }
113
+ }
114
+
115
+ function Rk-Screenshot($maxWidth, $path) {
116
+ $b = Rk-Bounds
117
+ $bmp = New-Object System.Drawing.Bitmap $b.Width, $b.Height
118
+ $g = [System.Drawing.Graphics]::FromImage($bmp)
119
+ $g.CopyFromScreen($b.Left, $b.Top, 0, 0, $bmp.Size)
120
+ $g.Dispose()
121
+ $scale = 1.0
122
+ if ($b.Width -gt $maxWidth) {
123
+ $scale = $maxWidth / $b.Width
124
+ $w = [int][Math]::Round($b.Width * $scale)
125
+ $h = [int][Math]::Round($b.Height * $scale)
126
+ $small = New-Object System.Drawing.Bitmap $w, $h
127
+ $sg = [System.Drawing.Graphics]::FromImage($small)
128
+ $sg.InterpolationMode = [System.Drawing.Drawing2D.InterpolationMode]::HighQualityBicubic
129
+ $sg.DrawImage($bmp, 0, 0, $w, $h)
130
+ $sg.Dispose()
131
+ $bmp.Dispose()
132
+ $bmp = $small
133
+ }
134
+ $ms = New-Object System.IO.MemoryStream
135
+ $bmp.Save($ms, [System.Drawing.Imaging.ImageFormat]::Png)
136
+ $bytes = $ms.ToArray()
137
+ $ms.Dispose()
138
+ if ($path) { [System.IO.File]::WriteAllBytes($path, $bytes) }
139
+ $c = Rk-Cursor
140
+ $result = @{ width = $bmp.Width; height = $bmp.Height; scale = $scale; left = $b.Left; top = $b.Top;
141
+ cursorX = [int](($c.x - $b.Left) * $scale); cursorY = [int](($c.y - $b.Top) * $scale);
142
+ png = [Convert]::ToBase64String($bytes) }
143
+ $bmp.Dispose()
144
+ $result
145
+ }
146
+
147
+ function Rk-Move($x, $y) {
148
+ Rk-Failsafe
149
+ [RkNative]::SetCursorPos([int]$x, [int]$y) | Out-Null
150
+ Start-Sleep -Milliseconds 30
151
+ @{ ok = $true }
152
+ }
153
+
154
+ function Rk-Click($x, $y, $button, $count) {
155
+ Rk-Move $x $y | Out-Null
156
+ $down = 0x0002; $up = 0x0004
157
+ if ($button -eq 'right') { $down = 0x0008; $up = 0x0010 }
158
+ elseif ($button -eq 'middle') { $down = 0x0020; $up = 0x0040 }
159
+ for ($i = 0; $i -lt $count; $i++) {
160
+ [RkNative]::mouse_event($down, 0, 0, 0, [UIntPtr]::Zero)
161
+ Start-Sleep -Milliseconds 40
162
+ [RkNative]::mouse_event($up, 0, 0, 0, [UIntPtr]::Zero)
163
+ if ($i -lt $count - 1) { Start-Sleep -Milliseconds 90 }
164
+ }
165
+ @{ ok = $true }
166
+ }
167
+
168
+ function Rk-Drag($x1, $y1, $x2, $y2) {
169
+ Rk-Move $x1 $y1 | Out-Null
170
+ [RkNative]::mouse_event(0x0002, 0, 0, 0, [UIntPtr]::Zero)
171
+ Start-Sleep -Milliseconds 120
172
+ $steps = 20
173
+ for ($i = 1; $i -le $steps; $i++) {
174
+ $px = [int]($x1 + ($x2 - $x1) * $i / $steps)
175
+ $py = [int]($y1 + ($y2 - $y1) * $i / $steps)
176
+ [RkNative]::SetCursorPos($px, $py) | Out-Null
177
+ Start-Sleep -Milliseconds 15
178
+ }
179
+ Start-Sleep -Milliseconds 120
180
+ [RkNative]::mouse_event(0x0004, 0, 0, 0, [UIntPtr]::Zero)
181
+ @{ ok = $true }
182
+ }
183
+
184
+ function Rk-Scroll($x, $y, $direction, $amount) {
185
+ Rk-Move $x $y | Out-Null
186
+ $delta = 120 * $amount
187
+ if ($direction -eq 'down') { [RkNative]::mouse_event(0x0800, 0, 0, -$delta, [UIntPtr]::Zero) }
188
+ elseif ($direction -eq 'up') { [RkNative]::mouse_event(0x0800, 0, 0, $delta, [UIntPtr]::Zero) }
189
+ elseif ($direction -eq 'right') { [RkNative]::mouse_event(0x1000, 0, 0, $delta, [UIntPtr]::Zero) }
190
+ else { [RkNative]::mouse_event(0x1000, 0, 0, -$delta, [UIntPtr]::Zero) }
191
+ @{ ok = $true }
192
+ }
193
+
194
+ function Rk-Type($text) {
195
+ Rk-Failsafe
196
+ [RkNative]::TypeText($text)
197
+ @{ ok = $true; chars = $text.Length }
198
+ }
199
+
200
+ function Rk-Keys($combos) {
201
+ Rk-Failsafe
202
+ foreach ($combo in $combos) {
203
+ [RkNative]::Combo([int[]]$combo)
204
+ Start-Sleep -Milliseconds 60
205
+ }
206
+ @{ ok = $true }
207
+ }
208
+
209
+ function Rk-Windows {
210
+ $fg = [RkNative]::GetForegroundWindow()
211
+ $rows = @()
212
+ foreach ($h in [RkNative]::Windows()) {
213
+ $r = New-Object RkNative+RECT
214
+ [RkNative]::GetWindowRect($h, [ref]$r) | Out-Null
215
+ $procId = [uint32]0
216
+ [RkNative]::GetWindowThreadProcessId($h, [ref]$procId) | Out-Null
217
+ $proc = ''
218
+ try { $proc = (Get-Process -Id $procId -ErrorAction Stop).ProcessName } catch { }
219
+ $rows += @{ handle = [int64]$h; title = [RkNative]::Title($h); process = $proc; active = ($h -eq $fg);
220
+ x = $r.Left; y = $r.Top; width = ($r.Right - $r.Left); height = ($r.Bottom - $r.Top) }
221
+ }
222
+ ,@($rows | Sort-Object -Property @{ Expression = { $_.active }; Descending = $true })
223
+ }
224
+
225
+ function Rk-Focus($needle) {
226
+ $needle = $needle.ToLowerInvariant()
227
+ $match = $null
228
+ $matchTitle = ''
229
+ foreach ($h in [RkNative]::Windows()) {
230
+ $title = [RkNative]::Title($h)
231
+ $procId = [uint32]0
232
+ [RkNative]::GetWindowThreadProcessId($h, [ref]$procId) | Out-Null
233
+ $proc = ''
234
+ try { $proc = (Get-Process -Id $procId -ErrorAction Stop).ProcessName } catch { }
235
+ if ($title.ToLowerInvariant().Contains($needle) -or $proc.ToLowerInvariant() -eq $needle) { $match = $h; $matchTitle = $title; break }
236
+ }
237
+ if ($null -eq $match) { throw "No window matches '$needle'." }
238
+ $ok = [RkNative]::Focus($match)
239
+ Start-Sleep -Milliseconds 150
240
+ @{ ok = $ok; title = $matchTitle }
241
+ }
242
+
243
+ function Rk-Open($target) {
244
+ Start-Process $target
245
+ Start-Sleep -Milliseconds 400
246
+ @{ ok = $true }
247
+ }
248
+
249
+ function Rk-ClipGet { @{ text = [string](Get-Clipboard -Raw) } }
250
+ function Rk-ClipSet($text) { Set-Clipboard -Value $text; @{ ok = $true } }
251
+
252
+ while ($true) {
253
+ $line = [Console]::In.ReadLine()
254
+ if ($null -eq $line) { break }
255
+ $script = [System.Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($line))
256
+ try {
257
+ $out = Invoke-Expression $script
258
+ $json = ConvertTo-Json -InputObject $out -Compress -Depth 5
259
+ [Console]::Out.WriteLine($json)
260
+ } catch {
261
+ $err = @{ error = $_.Exception.Message }
262
+ [Console]::Out.WriteLine((ConvertTo-Json -InputObject $err -Compress))
263
+ }
264
+ [Console]::Out.WriteLine('${END}')
265
+ [Console]::Out.Flush()
266
+ }
267
+ `;
268
+ /** Quote a string for a PowerShell single-quoted literal. */
269
+ export function psQuote(value) {
270
+ return "'" + value.replace(/'/g, "''") + "'";
271
+ }
272
+ /** Where the shell is: Windows PowerShell, because its .NET has WinForms without extras. */
273
+ export function powershellBinary() {
274
+ const system = process.env.SystemRoot ?? 'C:\\Windows';
275
+ return system + '\\System32\\WindowsPowerShell\\v1.0\\powershell.exe';
276
+ }
277
+ export class PowerShellSession {
278
+ #child = null;
279
+ #queue = Promise.resolve();
280
+ #lines = null;
281
+ #stderr = '';
282
+ /** Spawn the shell with the prelude loaded; the first call waits for the compile. */
283
+ start() {
284
+ if (this.#child)
285
+ return;
286
+ const encoded = Buffer.from(PRELUDE, 'utf16le').toString('base64');
287
+ const child = spawn(powershellBinary(), ['-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Bypass', '-EncodedCommand', encoded], { stdio: ['pipe', 'pipe', 'pipe'], windowsHide: true });
288
+ child.stderr?.setEncoding('utf8');
289
+ child.stderr?.on('data', (chunk) => {
290
+ this.#stderr = (this.#stderr + chunk).slice(-4000);
291
+ });
292
+ const reader = createInterface({ input: child.stdout });
293
+ reader.on('line', (line) => this.#lines?.(line));
294
+ child.on('exit', () => {
295
+ this.#child = null;
296
+ });
297
+ this.#child = child;
298
+ }
299
+ /** Evaluate one expression and parse the JSON it prints. Calls are serialised. */
300
+ run(expression, timeoutMs = 30_000) {
301
+ const task = this.#queue.then(() => this.#exec(expression, timeoutMs));
302
+ this.#queue = task.catch(() => undefined);
303
+ return task;
304
+ }
305
+ #exec(expression, timeoutMs) {
306
+ this.start();
307
+ const child = this.#child;
308
+ if (!child?.stdin)
309
+ return Promise.reject(new Error('PowerShell is not running.' + this.#tail()));
310
+ return new Promise((resolve, reject) => {
311
+ const chunks = [];
312
+ const finish = () => {
313
+ clearTimeout(timer);
314
+ child.off('exit', onExit);
315
+ this.#lines = null;
316
+ };
317
+ const timer = setTimeout(() => {
318
+ finish();
319
+ reject(new Error('The action timed out after ' + Math.round(timeoutMs / 1000) + ' s.' + this.#tail()));
320
+ }, timeoutMs);
321
+ const onExit = () => {
322
+ finish();
323
+ reject(new Error('PowerShell exited.' + this.#tail()));
324
+ };
325
+ child.once('exit', onExit);
326
+ this.#lines = (line) => {
327
+ if (line !== END) {
328
+ chunks.push(line);
329
+ return;
330
+ }
331
+ finish();
332
+ const text = chunks.join('\n').trim();
333
+ let parsed;
334
+ try {
335
+ parsed = text ? JSON.parse(text) : {};
336
+ }
337
+ catch {
338
+ reject(new Error('Unreadable reply from PowerShell: ' + text.slice(0, 200)));
339
+ return;
340
+ }
341
+ const error = parsed.error;
342
+ if (error)
343
+ reject(new Error(error));
344
+ else
345
+ resolve(parsed);
346
+ };
347
+ child.stdin.write(Buffer.from(expression, 'utf8').toString('base64') + '\n');
348
+ });
349
+ }
350
+ #tail() {
351
+ return this.#stderr.trim() ? '\n' + this.#stderr.trim().slice(-600) : '';
352
+ }
353
+ close() {
354
+ this.#child?.stdin?.end();
355
+ this.#child?.kill();
356
+ this.#child = null;
357
+ }
358
+ }
359
+ //# sourceMappingURL=powershell.js.map
@@ -0,0 +1 @@
1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AAI,EAAE,CAAC;QACpB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;IACrB,CAAC;CACF"}
@@ -0,0 +1,43 @@
1
+ import type { McpServerSpec, ProviderId, RookeryConfig } from '../types.js';
2
+ /**
3
+ * Computer control: the assistant sees the screen and works the mouse and
4
+ * keyboard of the machine it runs on.
5
+ *
6
+ * The tools live in their own MCP server (`computer`), next to `rookery`, so
7
+ * a provider process gets them only when the user switched them on. Three
8
+ * engines can stand behind that name:
9
+ *
10
+ * zavora `@zavora-ai/computer-use-mcp`: screenshots plus the Windows
11
+ * accessibility tree, so the model clicks controls by label
12
+ * instead of hunting pixels. The default when it is installed.
13
+ * builtin Rookery's own PowerShell server: no dependencies, pixels only.
14
+ * The fallback when the package is missing.
15
+ * custom whatever `computer.command` names in the config.
16
+ */
17
+ export declare const COMPUTER_SERVER_NAME = "computer";
18
+ export type ComputerEngine = 'zavora' | 'builtin';
19
+ export interface ComputerToolDefinition {
20
+ name: string;
21
+ description: string;
22
+ inputSchema: Record<string, unknown>;
23
+ }
24
+ /** The built-in server's tools. The zavora engine publishes its own list. */
25
+ export declare const COMPUTER_TOOLS: ComputerToolDefinition[];
26
+ /**
27
+ * The zavora server's entry script, or null when the package is not
28
+ * installed. The package publishes ESM-only export conditions, so a plain
29
+ * `require.resolve` fails; the ESM resolver is asked first, and a walk up
30
+ * the node_modules chain from this file covers hosts without it.
31
+ */
32
+ export declare function zavoraServerPath(): string | null;
33
+ /** Which engine this machine has: the zavora package when installed, the PowerShell server otherwise. */
34
+ export declare function computerEngine(): ComputerEngine;
35
+ /**
36
+ * The MCP server for this turn. `provider` picks the screenshot sizing the
37
+ * model likes; `profile` is the zavora authority level.
38
+ */
39
+ export declare function computerServerSpec(config: RookeryConfig, provider?: ProviderId, profile?: string): McpServerSpec;
40
+ export declare function computerScriptPath(): string;
41
+ /** The prompt paragraph that comes with the tools. Method, not enthusiasm. */
42
+ export declare function computerPromptBlock(engine?: ComputerEngine): string;
43
+ //# sourceMappingURL=tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/computer/tools.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAG5E;;;;;;;;;;;;;;GAcG;AAEH,eAAO,MAAM,oBAAoB,aAAa,CAAC;AAE/C,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,SAAS,CAAC;AAKlD,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAED,6EAA6E;AAC7E,eAAO,MAAM,cAAc,EAAE,sBAAsB,EA8IlD,CAAC;AAMF;;;;;GAKG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,GAAG,IAAI,CAmBhD;AAED,yGAAyG;AACzG,wBAAgB,cAAc,IAAI,cAAc,CAE/C;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,aAAa,EAAE,QAAQ,CAAC,EAAE,UAAU,EAAE,OAAO,SAAO,GAAG,aAAa,CAsB9G;AAED,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAED,8EAA8E;AAC9E,wBAAgB,mBAAmB,CAAC,MAAM,GAAE,cAA0B,GAAG,MAAM,CA6B9E"}
@@ -0,0 +1,260 @@
1
+ import { existsSync } from 'node:fs';
2
+ import { dirname, join } from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+ import { COMPUTER_PROFILES } from '../types.js';
5
+ /**
6
+ * Computer control: the assistant sees the screen and works the mouse and
7
+ * keyboard of the machine it runs on.
8
+ *
9
+ * The tools live in their own MCP server (`computer`), next to `rookery`, so
10
+ * a provider process gets them only when the user switched them on. Three
11
+ * engines can stand behind that name:
12
+ *
13
+ * zavora `@zavora-ai/computer-use-mcp`: screenshots plus the Windows
14
+ * accessibility tree, so the model clicks controls by label
15
+ * instead of hunting pixels. The default when it is installed.
16
+ * builtin Rookery's own PowerShell server: no dependencies, pixels only.
17
+ * The fallback when the package is missing.
18
+ * custom whatever `computer.command` names in the config.
19
+ */
20
+ export const COMPUTER_SERVER_NAME = 'computer';
21
+ const str = (description) => ({ type: 'string', description });
22
+ const num = (description) => ({ type: 'number', description });
23
+ /** The built-in server's tools. The zavora engine publishes its own list. */
24
+ export const COMPUTER_TOOLS = [
25
+ {
26
+ name: 'screenshot',
27
+ description: 'A picture of the whole screen as it is right now. Coordinates you pass to the other tools ' +
28
+ 'are pixels in this image. Take one before acting and another after, to see what happened.',
29
+ inputSchema: { type: 'object', properties: {}, additionalProperties: false },
30
+ },
31
+ {
32
+ name: 'screen_info',
33
+ description: 'Screen size in screenshot pixels, the scale to real pixels, and the monitors.',
34
+ inputSchema: { type: 'object', properties: {}, additionalProperties: false },
35
+ },
36
+ {
37
+ name: 'click',
38
+ description: 'Click at a point. Double-click with count 2; right-click with button "right".',
39
+ inputSchema: {
40
+ type: 'object',
41
+ properties: {
42
+ x: num('Horizontal position in screenshot pixels.'),
43
+ y: num('Vertical position in screenshot pixels.'),
44
+ button: str('left, right or middle. Default left.'),
45
+ count: num('1 or 2. Default 1.'),
46
+ },
47
+ required: ['x', 'y'],
48
+ additionalProperties: false,
49
+ },
50
+ },
51
+ {
52
+ name: 'move_mouse',
53
+ description: 'Move the pointer without clicking, for hover menus and tooltips.',
54
+ inputSchema: {
55
+ type: 'object',
56
+ properties: { x: num('Screenshot pixels.'), y: num('Screenshot pixels.') },
57
+ required: ['x', 'y'],
58
+ additionalProperties: false,
59
+ },
60
+ },
61
+ {
62
+ name: 'drag',
63
+ description: 'Press the left button at one point, move to another, release.',
64
+ inputSchema: {
65
+ type: 'object',
66
+ properties: {
67
+ fromX: num('Start, screenshot pixels.'),
68
+ fromY: num('Start, screenshot pixels.'),
69
+ toX: num('End, screenshot pixels.'),
70
+ toY: num('End, screenshot pixels.'),
71
+ },
72
+ required: ['fromX', 'fromY', 'toX', 'toY'],
73
+ additionalProperties: false,
74
+ },
75
+ },
76
+ {
77
+ name: 'scroll',
78
+ description: 'Scroll the wheel over a point.',
79
+ inputSchema: {
80
+ type: 'object',
81
+ properties: {
82
+ x: num('Screenshot pixels.'),
83
+ y: num('Screenshot pixels.'),
84
+ direction: str('up, down, left or right. Default down.'),
85
+ amount: num('Wheel notches, 1 to 20. Default 3.'),
86
+ },
87
+ required: ['x', 'y'],
88
+ additionalProperties: false,
89
+ },
90
+ },
91
+ {
92
+ name: 'type_text',
93
+ description: 'Type text into whatever has focus, as keystrokes, umlauts and all. For more than a few ' +
94
+ 'lines use clipboard set and press_keys ctrl+v.',
95
+ inputSchema: {
96
+ type: 'object',
97
+ properties: { text: str('The text to type.') },
98
+ required: ['text'],
99
+ additionalProperties: false,
100
+ },
101
+ },
102
+ {
103
+ name: 'press_keys',
104
+ description: 'Press a shortcut or a sequence of them: "ctrl+l", "alt+tab", "win+r", "enter", or several ' +
105
+ 'separated by spaces, "ctrl+a backspace". Names: ctrl, alt, shift, win, enter, tab, esc, ' +
106
+ 'backspace, delete, space, arrows, home, end, pageup, pagedown, f1 to f12, letters, digits.',
107
+ inputSchema: {
108
+ type: 'object',
109
+ properties: { keys: str('The combo or sequence.') },
110
+ required: ['keys'],
111
+ additionalProperties: false,
112
+ },
113
+ },
114
+ {
115
+ name: 'list_windows',
116
+ description: 'Open windows with title, program and position, the active one first.',
117
+ inputSchema: { type: 'object', properties: {}, additionalProperties: false },
118
+ },
119
+ {
120
+ name: 'focus_window',
121
+ description: 'Bring a window to the front by a part of its title or its program name.',
122
+ inputSchema: {
123
+ type: 'object',
124
+ properties: { title: str('Part of the window title, or the program name, case-insensitive.') },
125
+ required: ['title'],
126
+ additionalProperties: false,
127
+ },
128
+ },
129
+ {
130
+ name: 'open',
131
+ description: 'Start a program, open a file or a URL, the way the Start menu or a double-click would: ' +
132
+ '"notepad", "https://example.com", "C:/Users/me/report.docx", "ms-settings:".',
133
+ inputSchema: {
134
+ type: 'object',
135
+ properties: { target: str('Program name, path or URL.') },
136
+ required: ['target'],
137
+ additionalProperties: false,
138
+ },
139
+ },
140
+ {
141
+ name: 'clipboard',
142
+ description: 'Read the clipboard, or put text on it (then press_keys ctrl+v to paste).',
143
+ inputSchema: {
144
+ type: 'object',
145
+ properties: {
146
+ action: str('get or set.'),
147
+ text: str('The text to put on the clipboard, for set.'),
148
+ },
149
+ required: ['action'],
150
+ additionalProperties: false,
151
+ },
152
+ },
153
+ {
154
+ name: 'wait',
155
+ description: 'Pause, for a program or page that is still loading.',
156
+ inputSchema: {
157
+ type: 'object',
158
+ properties: { ms: num('Milliseconds, up to 30000. Default 1000.') },
159
+ additionalProperties: false,
160
+ },
161
+ },
162
+ ];
163
+ /* --------------------------------- engines -------------------------------- */
164
+ const ZAVORA_PACKAGE = '@zavora-ai/computer-use-mcp';
165
+ /**
166
+ * The zavora server's entry script, or null when the package is not
167
+ * installed. The package publishes ESM-only export conditions, so a plain
168
+ * `require.resolve` fails; the ESM resolver is asked first, and a walk up
169
+ * the node_modules chain from this file covers hosts without it.
170
+ */
171
+ export function zavoraServerPath() {
172
+ try {
173
+ const resolved = import.meta.resolve(ZAVORA_PACKAGE + '/server');
174
+ if (resolved.startsWith('file:')) {
175
+ const path = fileURLToPath(resolved);
176
+ if (existsSync(path))
177
+ return path;
178
+ }
179
+ }
180
+ catch {
181
+ // fall through to the manual walk
182
+ }
183
+ let dir = dirname(fileURLToPath(import.meta.url));
184
+ for (let depth = 0; depth < 8; depth += 1) {
185
+ const candidate = join(dir, 'node_modules', ZAVORA_PACKAGE, 'dist', 'server.js');
186
+ if (existsSync(candidate))
187
+ return candidate;
188
+ const parent = dirname(dir);
189
+ if (parent === dir)
190
+ break;
191
+ dir = parent;
192
+ }
193
+ return null;
194
+ }
195
+ /** Which engine this machine has: the zavora package when installed, the PowerShell server otherwise. */
196
+ export function computerEngine() {
197
+ return zavoraServerPath() ? 'zavora' : 'builtin';
198
+ }
199
+ /**
200
+ * The MCP server for this turn. `provider` picks the screenshot sizing the
201
+ * model likes; `profile` is the zavora authority level.
202
+ */
203
+ export function computerServerSpec(config, provider, profile = 'ax') {
204
+ if (computerEngine() === 'zavora') {
205
+ return {
206
+ name: COMPUTER_SERVER_NAME,
207
+ command: process.execPath,
208
+ args: [zavoraServerPath()],
209
+ env: {
210
+ COMPUTER_USE_PROFILE: COMPUTER_PROFILES.includes(profile) ? profile : 'ax',
211
+ COMPUTER_USE_PROVIDER: provider === 'codex' ? 'openai' : 'anthropic',
212
+ COMPUTER_USE_AUDIT_LOG: join(config.home, 'run', 'computer-audit.jsonl'),
213
+ },
214
+ };
215
+ }
216
+ return {
217
+ name: COMPUTER_SERVER_NAME,
218
+ command: process.execPath,
219
+ args: [computerScriptPath()],
220
+ env: {
221
+ ROOKERY_COMPUTER_MAX_WIDTH: '1280',
222
+ ROOKERY_COMPUTER_DIR: config.home,
223
+ },
224
+ };
225
+ }
226
+ export function computerScriptPath() {
227
+ return fileURLToPath(new URL('./mcp-server.js', import.meta.url));
228
+ }
229
+ /** The prompt paragraph that comes with the tools. Method, not enthusiasm. */
230
+ export function computerPromptBlock(engine = 'builtin') {
231
+ const shared = [
232
+ 'Before anything the user could not undo - deleting, sending, paying, closing unsaved work -',
233
+ 'stop and ask with one question. When the user says stop, stop at once. In a written turn do',
234
+ 'not narrate each click; say what you did once it is done, and what you saw when it did not',
235
+ 'work. In a spoken turn follow the think-aloud rule of the spoken register instead.',
236
+ ];
237
+ if (engine === 'zavora') {
238
+ return [
239
+ 'You can see and operate this computer through the computer tools. Work the way the tools',
240
+ 'themselves advise: get_ui_tree, find_element and get_focused_element to read the interface,',
241
+ 'click_element, press_button, set_value and fill_form to operate it by label, and only then',
242
+ 'screenshot plus left_click, type and key by coordinates. open_application, activate_app and',
243
+ 'list_windows bring the right program to the front; physical input needs its target in front,',
244
+ 'so pass target_app when you click or type. get_tool_guide tells you the best route for an',
245
+ 'unfamiliar app. Verify after acting: a fresh screenshot or a fresh ui tree, never an assumption.',
246
+ ...shared,
247
+ ].join(' ');
248
+ }
249
+ return [
250
+ 'You can see and operate this computer through the computer tools: screenshot, click,',
251
+ 'move_mouse, drag, scroll, type_text, press_keys, list_windows, focus_window, open,',
252
+ 'clipboard, wait. Method: screenshot first, act, screenshot again to verify; never report an',
253
+ 'action as done because you sent it. Coordinates are pixels of the last screenshot.',
254
+ 'Prefer open, focus_window and keyboard shortcuts over hunting for pixels; put long text on',
255
+ 'the clipboard and paste it. If every action is refused because the pointer sits in the',
256
+ 'top-left corner, the user pulled the emergency brake: stop, do not work around it.',
257
+ ...shared,
258
+ ].join(' ');
259
+ }
260
+ //# sourceMappingURL=tools.js.map