@tianshu-ai/tianshu 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 (917) hide show
  1. package/LICENSE +200 -0
  2. package/README.md +284 -0
  3. package/README.zh-CN.md +136 -0
  4. package/bin/tianshu.mjs +32 -0
  5. package/package.json +60 -0
  6. package/packages/plugin-sdk/dist/agent-loop.d.ts +96 -0
  7. package/packages/plugin-sdk/dist/agent-loop.d.ts.map +1 -0
  8. package/packages/plugin-sdk/dist/agent-loop.js +11 -0
  9. package/packages/plugin-sdk/dist/agent-loop.js.map +1 -0
  10. package/packages/plugin-sdk/dist/capabilities.d.ts +48 -0
  11. package/packages/plugin-sdk/dist/capabilities.d.ts.map +1 -0
  12. package/packages/plugin-sdk/dist/capabilities.js +61 -0
  13. package/packages/plugin-sdk/dist/capabilities.js.map +1 -0
  14. package/packages/plugin-sdk/dist/catalog.d.ts +60 -0
  15. package/packages/plugin-sdk/dist/catalog.d.ts.map +1 -0
  16. package/packages/plugin-sdk/dist/catalog.js +11 -0
  17. package/packages/plugin-sdk/dist/catalog.js.map +1 -0
  18. package/packages/plugin-sdk/dist/client.d.ts +171 -0
  19. package/packages/plugin-sdk/dist/client.d.ts.map +1 -0
  20. package/packages/plugin-sdk/dist/client.js +96 -0
  21. package/packages/plugin-sdk/dist/client.js.map +1 -0
  22. package/packages/plugin-sdk/dist/index.d.ts +9 -0
  23. package/packages/plugin-sdk/dist/index.d.ts.map +1 -0
  24. package/packages/plugin-sdk/dist/index.js +19 -0
  25. package/packages/plugin-sdk/dist/index.js.map +1 -0
  26. package/packages/plugin-sdk/dist/lsp.d.ts +32 -0
  27. package/packages/plugin-sdk/dist/lsp.d.ts.map +1 -0
  28. package/packages/plugin-sdk/dist/lsp.js +19 -0
  29. package/packages/plugin-sdk/dist/lsp.js.map +1 -0
  30. package/packages/plugin-sdk/dist/manifest.d.ts +423 -0
  31. package/packages/plugin-sdk/dist/manifest.d.ts.map +1 -0
  32. package/packages/plugin-sdk/dist/manifest.js +7 -0
  33. package/packages/plugin-sdk/dist/manifest.js.map +1 -0
  34. package/packages/plugin-sdk/dist/mcp-client.d.ts +74 -0
  35. package/packages/plugin-sdk/dist/mcp-client.d.ts.map +1 -0
  36. package/packages/plugin-sdk/dist/mcp-client.js +226 -0
  37. package/packages/plugin-sdk/dist/mcp-client.js.map +1 -0
  38. package/packages/plugin-sdk/dist/mcp-fetch.d.ts +10 -0
  39. package/packages/plugin-sdk/dist/mcp-fetch.d.ts.map +1 -0
  40. package/packages/plugin-sdk/dist/mcp-fetch.js +130 -0
  41. package/packages/plugin-sdk/dist/mcp-fetch.js.map +1 -0
  42. package/packages/plugin-sdk/dist/mcp-toolset.d.ts +128 -0
  43. package/packages/plugin-sdk/dist/mcp-toolset.d.ts.map +1 -0
  44. package/packages/plugin-sdk/dist/mcp-toolset.js +246 -0
  45. package/packages/plugin-sdk/dist/mcp-toolset.js.map +1 -0
  46. package/packages/plugin-sdk/dist/server.d.ts +486 -0
  47. package/packages/plugin-sdk/dist/server.d.ts.map +1 -0
  48. package/packages/plugin-sdk/dist/server.js +10 -0
  49. package/packages/plugin-sdk/dist/server.js.map +1 -0
  50. package/packages/plugin-sdk/dist/session-inbox.d.ts +56 -0
  51. package/packages/plugin-sdk/dist/session-inbox.d.ts.map +1 -0
  52. package/packages/plugin-sdk/dist/session-inbox.js +12 -0
  53. package/packages/plugin-sdk/dist/session-inbox.js.map +1 -0
  54. package/packages/plugin-sdk/package.json +36 -0
  55. package/packages/server/builtinConfig/plugins/README.md +1 -0
  56. package/packages/server/builtinConfig/plugins/files/manifest.json +100 -0
  57. package/packages/server/builtinConfig/plugins/files/skills/files-workspace-layout.md +29 -0
  58. package/packages/server/builtinConfig/plugins/microsandbox/manifest.json +177 -0
  59. package/packages/server/builtinConfig/plugins/microsandbox/skills/microsandbox-browser-howto.md +155 -0
  60. package/packages/server/builtinConfig/plugins/microsandbox/skills/microsandbox-build-use.md +201 -0
  61. package/packages/server/builtinConfig/plugins/microsandbox/skills/microsandbox-config.md +38 -0
  62. package/packages/server/builtinConfig/plugins/microsandbox/skills/microsandbox-exec-howto.md +144 -0
  63. package/packages/server/builtinConfig/plugins/microsandbox/skills/microsandbox-libreoffice.md +159 -0
  64. package/packages/server/builtinConfig/plugins/microsandbox/skills/microsandbox-main-orchestration.md +75 -0
  65. package/packages/server/builtinConfig/plugins/microsandbox/templates/README.md +26 -0
  66. package/packages/server/builtinConfig/plugins/microsandbox/templates/browser.yaml +105 -0
  67. package/packages/server/builtinConfig/plugins/microsandbox/templates/task-runner-with-browser.yaml +80 -0
  68. package/packages/server/builtinConfig/plugins/microsandbox/templates/task-runner.yaml +80 -0
  69. package/packages/server/builtinConfig/plugins/web-search/manifest.json +65 -0
  70. package/packages/server/builtinConfig/plugins/web-search/skills/web-search-howto.md +69 -0
  71. package/packages/server/builtinConfig/plugins/workboard/agent-seeds/echo-demo/agent.json +7 -0
  72. package/packages/server/builtinConfig/plugins/workboard/agent-seeds/llm-default/SOUL.md +53 -0
  73. package/packages/server/builtinConfig/plugins/workboard/agent-seeds/llm-default/agent.json +7 -0
  74. package/packages/server/builtinConfig/plugins/workboard/manifest.json +180 -0
  75. package/packages/server/builtinConfig/plugins/workboard/skills/large-input-large-output.md +185 -0
  76. package/packages/server/builtinConfig/plugins/workboard/skills/workboard-howto.md +166 -0
  77. package/packages/server/builtinConfig/plugins/workboard/skills/worker-creator.md +267 -0
  78. package/packages/server/builtinConfig/plugins/workboard/skills/worker-fleet.md +431 -0
  79. package/packages/server/dist/catalog.d.ts +52 -0
  80. package/packages/server/dist/catalog.d.ts.map +1 -0
  81. package/packages/server/dist/catalog.js +189 -0
  82. package/packages/server/dist/catalog.js.map +1 -0
  83. package/packages/server/dist/chat/active-harnesses.d.ts +34 -0
  84. package/packages/server/dist/chat/active-harnesses.d.ts.map +1 -0
  85. package/packages/server/dist/chat/active-harnesses.js +118 -0
  86. package/packages/server/dist/chat/active-harnesses.js.map +1 -0
  87. package/packages/server/dist/chat/agent-loop.d.ts +64 -0
  88. package/packages/server/dist/chat/agent-loop.d.ts.map +1 -0
  89. package/packages/server/dist/chat/agent-loop.js +597 -0
  90. package/packages/server/dist/chat/agent-loop.js.map +1 -0
  91. package/packages/server/dist/chat/agent-tool-adapter.d.ts +33 -0
  92. package/packages/server/dist/chat/agent-tool-adapter.d.ts.map +1 -0
  93. package/packages/server/dist/chat/agent-tool-adapter.js +260 -0
  94. package/packages/server/dist/chat/agent-tool-adapter.js.map +1 -0
  95. package/packages/server/dist/chat/compact.d.ts +52 -0
  96. package/packages/server/dist/chat/compact.d.ts.map +1 -0
  97. package/packages/server/dist/chat/compact.js +248 -0
  98. package/packages/server/dist/chat/compact.js.map +1 -0
  99. package/packages/server/dist/chat/dump-system-prompt.d.ts +17 -0
  100. package/packages/server/dist/chat/dump-system-prompt.d.ts.map +1 -0
  101. package/packages/server/dist/chat/dump-system-prompt.js +58 -0
  102. package/packages/server/dist/chat/dump-system-prompt.js.map +1 -0
  103. package/packages/server/dist/chat/handler.d.ts +186 -0
  104. package/packages/server/dist/chat/handler.d.ts.map +1 -0
  105. package/packages/server/dist/chat/handler.js +1248 -0
  106. package/packages/server/dist/chat/handler.js.map +1 -0
  107. package/packages/server/dist/chat/image-fit.d.ts +34 -0
  108. package/packages/server/dist/chat/image-fit.d.ts.map +1 -0
  109. package/packages/server/dist/chat/image-fit.js +157 -0
  110. package/packages/server/dist/chat/image-fit.js.map +1 -0
  111. package/packages/server/dist/chat/messages.d.ts +118 -0
  112. package/packages/server/dist/chat/messages.d.ts.map +1 -0
  113. package/packages/server/dist/chat/messages.js +341 -0
  114. package/packages/server/dist/chat/messages.js.map +1 -0
  115. package/packages/server/dist/chat/session-inbox.d.ts +114 -0
  116. package/packages/server/dist/chat/session-inbox.d.ts.map +1 -0
  117. package/packages/server/dist/chat/session-inbox.js +418 -0
  118. package/packages/server/dist/chat/session-inbox.js.map +1 -0
  119. package/packages/server/dist/chat/sqlite-session-repo.d.ts +26 -0
  120. package/packages/server/dist/chat/sqlite-session-repo.d.ts.map +1 -0
  121. package/packages/server/dist/chat/sqlite-session-repo.js +132 -0
  122. package/packages/server/dist/chat/sqlite-session-repo.js.map +1 -0
  123. package/packages/server/dist/chat/sqlite-session-storage.d.ts +83 -0
  124. package/packages/server/dist/chat/sqlite-session-storage.d.ts.map +1 -0
  125. package/packages/server/dist/chat/sqlite-session-storage.js +418 -0
  126. package/packages/server/dist/chat/sqlite-session-storage.js.map +1 -0
  127. package/packages/server/dist/chat/stub-execution-env.d.ts +3 -0
  128. package/packages/server/dist/chat/stub-execution-env.d.ts.map +1 -0
  129. package/packages/server/dist/chat/stub-execution-env.js +87 -0
  130. package/packages/server/dist/chat/stub-execution-env.js.map +1 -0
  131. package/packages/server/dist/chat/token-estimate.d.ts +11 -0
  132. package/packages/server/dist/chat/token-estimate.d.ts.map +1 -0
  133. package/packages/server/dist/chat/token-estimate.js +67 -0
  134. package/packages/server/dist/chat/token-estimate.js.map +1 -0
  135. package/packages/server/dist/chat/ws-protocol.d.ts +244 -0
  136. package/packages/server/dist/chat/ws-protocol.d.ts.map +1 -0
  137. package/packages/server/dist/chat/ws-protocol.js +193 -0
  138. package/packages/server/dist/chat/ws-protocol.js.map +1 -0
  139. package/packages/server/dist/cli.d.ts +9 -0
  140. package/packages/server/dist/cli.d.ts.map +1 -0
  141. package/packages/server/dist/cli.js +329 -0
  142. package/packages/server/dist/cli.js.map +1 -0
  143. package/packages/server/dist/core/agent-seeds.d.ts +25 -0
  144. package/packages/server/dist/core/agent-seeds.d.ts.map +1 -0
  145. package/packages/server/dist/core/agent-seeds.js +69 -0
  146. package/packages/server/dist/core/agent-seeds.js.map +1 -0
  147. package/packages/server/dist/core/config.d.ts +172 -0
  148. package/packages/server/dist/core/config.d.ts.map +1 -0
  149. package/packages/server/dist/core/config.js +155 -0
  150. package/packages/server/dist/core/config.js.map +1 -0
  151. package/packages/server/dist/core/db-pool.d.ts +32 -0
  152. package/packages/server/dist/core/db-pool.d.ts.map +1 -0
  153. package/packages/server/dist/core/db-pool.js +108 -0
  154. package/packages/server/dist/core/db-pool.js.map +1 -0
  155. package/packages/server/dist/core/dev-mode.d.ts +13 -0
  156. package/packages/server/dist/core/dev-mode.d.ts.map +1 -0
  157. package/packages/server/dist/core/dev-mode.js +51 -0
  158. package/packages/server/dist/core/dev-mode.js.map +1 -0
  159. package/packages/server/dist/core/global-ops.d.ts +54 -0
  160. package/packages/server/dist/core/global-ops.d.ts.map +1 -0
  161. package/packages/server/dist/core/global-ops.js +143 -0
  162. package/packages/server/dist/core/global-ops.js.map +1 -0
  163. package/packages/server/dist/core/identity-resolvers.d.ts +102 -0
  164. package/packages/server/dist/core/identity-resolvers.d.ts.map +1 -0
  165. package/packages/server/dist/core/identity-resolvers.js +176 -0
  166. package/packages/server/dist/core/identity-resolvers.js.map +1 -0
  167. package/packages/server/dist/core/index.d.ts +13 -0
  168. package/packages/server/dist/core/index.d.ts.map +1 -0
  169. package/packages/server/dist/core/index.js +18 -0
  170. package/packages/server/dist/core/index.js.map +1 -0
  171. package/packages/server/dist/core/llm.d.ts +45 -0
  172. package/packages/server/dist/core/llm.d.ts.map +1 -0
  173. package/packages/server/dist/core/llm.js +140 -0
  174. package/packages/server/dist/core/llm.js.map +1 -0
  175. package/packages/server/dist/core/mcp-manager.d.ts +47 -0
  176. package/packages/server/dist/core/mcp-manager.d.ts.map +1 -0
  177. package/packages/server/dist/core/mcp-manager.js +129 -0
  178. package/packages/server/dist/core/mcp-manager.js.map +1 -0
  179. package/packages/server/dist/core/middleware.d.ts +31 -0
  180. package/packages/server/dist/core/middleware.d.ts.map +1 -0
  181. package/packages/server/dist/core/middleware.js +102 -0
  182. package/packages/server/dist/core/middleware.js.map +1 -0
  183. package/packages/server/dist/core/migrations/001-initial.d.ts +4 -0
  184. package/packages/server/dist/core/migrations/001-initial.d.ts.map +1 -0
  185. package/packages/server/dist/core/migrations/001-initial.js +66 -0
  186. package/packages/server/dist/core/migrations/001-initial.js.map +1 -0
  187. package/packages/server/dist/core/migrations/002-task-dependencies.d.ts +4 -0
  188. package/packages/server/dist/core/migrations/002-task-dependencies.d.ts.map +1 -0
  189. package/packages/server/dist/core/migrations/002-task-dependencies.js +20 -0
  190. package/packages/server/dist/core/migrations/002-task-dependencies.js.map +1 -0
  191. package/packages/server/dist/core/migrations/003-session-tree.d.ts +4 -0
  192. package/packages/server/dist/core/migrations/003-session-tree.d.ts.map +1 -0
  193. package/packages/server/dist/core/migrations/003-session-tree.js +96 -0
  194. package/packages/server/dist/core/migrations/003-session-tree.js.map +1 -0
  195. package/packages/server/dist/core/migrations/003-worker-agents.d.ts +4 -0
  196. package/packages/server/dist/core/migrations/003-worker-agents.d.ts.map +1 -0
  197. package/packages/server/dist/core/migrations/003-worker-agents.js +65 -0
  198. package/packages/server/dist/core/migrations/003-worker-agents.js.map +1 -0
  199. package/packages/server/dist/core/migrations/004-rebuild-message-chain.d.ts +4 -0
  200. package/packages/server/dist/core/migrations/004-rebuild-message-chain.d.ts.map +1 -0
  201. package/packages/server/dist/core/migrations/004-rebuild-message-chain.js +52 -0
  202. package/packages/server/dist/core/migrations/004-rebuild-message-chain.js.map +1 -0
  203. package/packages/server/dist/core/migrations/005-task-status-rename.d.ts +4 -0
  204. package/packages/server/dist/core/migrations/005-task-status-rename.d.ts.map +1 -0
  205. package/packages/server/dist/core/migrations/005-task-status-rename.js +64 -0
  206. package/packages/server/dist/core/migrations/005-task-status-rename.js.map +1 -0
  207. package/packages/server/dist/core/migrations/006-task-labels.d.ts +4 -0
  208. package/packages/server/dist/core/migrations/006-task-labels.d.ts.map +1 -0
  209. package/packages/server/dist/core/migrations/006-task-labels.js +43 -0
  210. package/packages/server/dist/core/migrations/006-task-labels.js.map +1 -0
  211. package/packages/server/dist/core/migrations/007-session-inbox.d.ts +4 -0
  212. package/packages/server/dist/core/migrations/007-session-inbox.d.ts.map +1 -0
  213. package/packages/server/dist/core/migrations/007-session-inbox.js +67 -0
  214. package/packages/server/dist/core/migrations/007-session-inbox.js.map +1 -0
  215. package/packages/server/dist/core/migrations/008-task-intervention.d.ts +4 -0
  216. package/packages/server/dist/core/migrations/008-task-intervention.d.ts.map +1 -0
  217. package/packages/server/dist/core/migrations/008-task-intervention.js +60 -0
  218. package/packages/server/dist/core/migrations/008-task-intervention.js.map +1 -0
  219. package/packages/server/dist/core/migrations/index.d.ts +12 -0
  220. package/packages/server/dist/core/migrations/index.d.ts.map +1 -0
  221. package/packages/server/dist/core/migrations/index.js +58 -0
  222. package/packages/server/dist/core/migrations/index.js.map +1 -0
  223. package/packages/server/dist/core/paths.d.ts +53 -0
  224. package/packages/server/dist/core/paths.d.ts.map +1 -0
  225. package/packages/server/dist/core/paths.js +125 -0
  226. package/packages/server/dist/core/paths.js.map +1 -0
  227. package/packages/server/dist/core/plugins/builtin-loader.d.ts +56 -0
  228. package/packages/server/dist/core/plugins/builtin-loader.d.ts.map +1 -0
  229. package/packages/server/dist/core/plugins/builtin-loader.js +153 -0
  230. package/packages/server/dist/core/plugins/builtin-loader.js.map +1 -0
  231. package/packages/server/dist/core/plugins/discovery.d.ts +28 -0
  232. package/packages/server/dist/core/plugins/discovery.d.ts.map +1 -0
  233. package/packages/server/dist/core/plugins/discovery.js +97 -0
  234. package/packages/server/dist/core/plugins/discovery.js.map +1 -0
  235. package/packages/server/dist/core/plugins/index.d.ts +6 -0
  236. package/packages/server/dist/core/plugins/index.d.ts.map +1 -0
  237. package/packages/server/dist/core/plugins/index.js +6 -0
  238. package/packages/server/dist/core/plugins/index.js.map +1 -0
  239. package/packages/server/dist/core/plugins/manifest.d.ts +9 -0
  240. package/packages/server/dist/core/plugins/manifest.d.ts.map +1 -0
  241. package/packages/server/dist/core/plugins/manifest.js +584 -0
  242. package/packages/server/dist/core/plugins/manifest.js.map +1 -0
  243. package/packages/server/dist/core/plugins/registry.d.ts +269 -0
  244. package/packages/server/dist/core/plugins/registry.d.ts.map +1 -0
  245. package/packages/server/dist/core/plugins/registry.js +1003 -0
  246. package/packages/server/dist/core/plugins/registry.js.map +1 -0
  247. package/packages/server/dist/core/plugins/secrets.d.ts +46 -0
  248. package/packages/server/dist/core/plugins/secrets.d.ts.map +1 -0
  249. package/packages/server/dist/core/plugins/secrets.js +174 -0
  250. package/packages/server/dist/core/plugins/secrets.js.map +1 -0
  251. package/packages/server/dist/core/plugins/skills.d.ts +131 -0
  252. package/packages/server/dist/core/plugins/skills.d.ts.map +1 -0
  253. package/packages/server/dist/core/plugins/skills.js +389 -0
  254. package/packages/server/dist/core/plugins/skills.js.map +1 -0
  255. package/packages/server/dist/core/templates.d.ts +28 -0
  256. package/packages/server/dist/core/templates.d.ts.map +1 -0
  257. package/packages/server/dist/core/templates.js +103 -0
  258. package/packages/server/dist/core/templates.js.map +1 -0
  259. package/packages/server/dist/core/tenant-context.d.ts +18 -0
  260. package/packages/server/dist/core/tenant-context.d.ts.map +1 -0
  261. package/packages/server/dist/core/tenant-context.js +42 -0
  262. package/packages/server/dist/core/tenant-context.js.map +1 -0
  263. package/packages/server/dist/core/tenant-id.d.ts +8 -0
  264. package/packages/server/dist/core/tenant-id.d.ts.map +1 -0
  265. package/packages/server/dist/core/tenant-id.js +53 -0
  266. package/packages/server/dist/core/tenant-id.js.map +1 -0
  267. package/packages/server/dist/core/tenant-skills.d.ts +29 -0
  268. package/packages/server/dist/core/tenant-skills.d.ts.map +1 -0
  269. package/packages/server/dist/core/tenant-skills.js +77 -0
  270. package/packages/server/dist/core/tenant-skills.js.map +1 -0
  271. package/packages/server/dist/core/worker-agents-fs.d.ts +44 -0
  272. package/packages/server/dist/core/worker-agents-fs.d.ts.map +1 -0
  273. package/packages/server/dist/core/worker-agents-fs.js +86 -0
  274. package/packages/server/dist/core/worker-agents-fs.js.map +1 -0
  275. package/packages/server/dist/core/worker-agents.d.ts +77 -0
  276. package/packages/server/dist/core/worker-agents.d.ts.map +1 -0
  277. package/packages/server/dist/core/worker-agents.js +191 -0
  278. package/packages/server/dist/core/worker-agents.js.map +1 -0
  279. package/packages/server/dist/index.d.ts +2 -0
  280. package/packages/server/dist/index.d.ts.map +1 -0
  281. package/packages/server/dist/index.js +623 -0
  282. package/packages/server/dist/index.js.map +1 -0
  283. package/packages/server/dist/lsp/client.d.ts +53 -0
  284. package/packages/server/dist/lsp/client.d.ts.map +1 -0
  285. package/packages/server/dist/lsp/client.js +258 -0
  286. package/packages/server/dist/lsp/client.js.map +1 -0
  287. package/packages/server/dist/lsp/format.d.ts +13 -0
  288. package/packages/server/dist/lsp/format.d.ts.map +1 -0
  289. package/packages/server/dist/lsp/format.js +55 -0
  290. package/packages/server/dist/lsp/format.js.map +1 -0
  291. package/packages/server/dist/lsp/index.d.ts +20 -0
  292. package/packages/server/dist/lsp/index.d.ts.map +1 -0
  293. package/packages/server/dist/lsp/index.js +32 -0
  294. package/packages/server/dist/lsp/index.js.map +1 -0
  295. package/packages/server/dist/lsp/language-registry.d.ts +29 -0
  296. package/packages/server/dist/lsp/language-registry.d.ts.map +1 -0
  297. package/packages/server/dist/lsp/language-registry.js +62 -0
  298. package/packages/server/dist/lsp/language-registry.js.map +1 -0
  299. package/packages/server/dist/lsp/manager.d.ts +77 -0
  300. package/packages/server/dist/lsp/manager.d.ts.map +1 -0
  301. package/packages/server/dist/lsp/manager.js +300 -0
  302. package/packages/server/dist/lsp/manager.js.map +1 -0
  303. package/packages/server/dist/plugins-routes.d.ts +96 -0
  304. package/packages/server/dist/plugins-routes.d.ts.map +1 -0
  305. package/packages/server/dist/plugins-routes.js +627 -0
  306. package/packages/server/dist/plugins-routes.js.map +1 -0
  307. package/packages/server/dist/setup/checks/config.d.ts +9 -0
  308. package/packages/server/dist/setup/checks/config.d.ts.map +1 -0
  309. package/packages/server/dist/setup/checks/config.js +66 -0
  310. package/packages/server/dist/setup/checks/config.js.map +1 -0
  311. package/packages/server/dist/setup/checks/db.d.ts +6 -0
  312. package/packages/server/dist/setup/checks/db.d.ts.map +1 -0
  313. package/packages/server/dist/setup/checks/db.js +79 -0
  314. package/packages/server/dist/setup/checks/db.js.map +1 -0
  315. package/packages/server/dist/setup/checks/known-models.d.ts +18 -0
  316. package/packages/server/dist/setup/checks/known-models.d.ts.map +1 -0
  317. package/packages/server/dist/setup/checks/known-models.js +119 -0
  318. package/packages/server/dist/setup/checks/known-models.js.map +1 -0
  319. package/packages/server/dist/setup/checks/network.d.ts +11 -0
  320. package/packages/server/dist/setup/checks/network.d.ts.map +1 -0
  321. package/packages/server/dist/setup/checks/network.js +176 -0
  322. package/packages/server/dist/setup/checks/network.js.map +1 -0
  323. package/packages/server/dist/setup/checks/plugins.d.ts +9 -0
  324. package/packages/server/dist/setup/checks/plugins.d.ts.map +1 -0
  325. package/packages/server/dist/setup/checks/plugins.js +194 -0
  326. package/packages/server/dist/setup/checks/plugins.js.map +1 -0
  327. package/packages/server/dist/setup/checks/providers.d.ts +12 -0
  328. package/packages/server/dist/setup/checks/providers.d.ts.map +1 -0
  329. package/packages/server/dist/setup/checks/providers.js +368 -0
  330. package/packages/server/dist/setup/checks/providers.js.map +1 -0
  331. package/packages/server/dist/setup/checks/runtime.d.ts +3 -0
  332. package/packages/server/dist/setup/checks/runtime.d.ts.map +1 -0
  333. package/packages/server/dist/setup/checks/runtime.js +44 -0
  334. package/packages/server/dist/setup/checks/runtime.js.map +1 -0
  335. package/packages/server/dist/setup/checks/sandbox.d.ts +9 -0
  336. package/packages/server/dist/setup/checks/sandbox.d.ts.map +1 -0
  337. package/packages/server/dist/setup/checks/sandbox.js +110 -0
  338. package/packages/server/dist/setup/checks/sandbox.js.map +1 -0
  339. package/packages/server/dist/setup/checks/tenants.d.ts +9 -0
  340. package/packages/server/dist/setup/checks/tenants.d.ts.map +1 -0
  341. package/packages/server/dist/setup/checks/tenants.js +509 -0
  342. package/packages/server/dist/setup/checks/tenants.js.map +1 -0
  343. package/packages/server/dist/setup/cli-agent.d.ts +39 -0
  344. package/packages/server/dist/setup/cli-agent.d.ts.map +1 -0
  345. package/packages/server/dist/setup/cli-agent.js +1353 -0
  346. package/packages/server/dist/setup/cli-agent.js.map +1 -0
  347. package/packages/server/dist/setup/doctor.d.ts +32 -0
  348. package/packages/server/dist/setup/doctor.d.ts.map +1 -0
  349. package/packages/server/dist/setup/doctor.js +80 -0
  350. package/packages/server/dist/setup/doctor.js.map +1 -0
  351. package/packages/server/dist/setup/launchd.d.ts +107 -0
  352. package/packages/server/dist/setup/launchd.d.ts.map +1 -0
  353. package/packages/server/dist/setup/launchd.js +309 -0
  354. package/packages/server/dist/setup/launchd.js.map +1 -0
  355. package/packages/server/dist/setup/load-env.d.ts +21 -0
  356. package/packages/server/dist/setup/load-env.d.ts.map +1 -0
  357. package/packages/server/dist/setup/load-env.js +88 -0
  358. package/packages/server/dist/setup/load-env.js.map +1 -0
  359. package/packages/server/dist/setup/probe-default-model.d.ts +28 -0
  360. package/packages/server/dist/setup/probe-default-model.d.ts.map +1 -0
  361. package/packages/server/dist/setup/probe-default-model.js +133 -0
  362. package/packages/server/dist/setup/probe-default-model.js.map +1 -0
  363. package/packages/server/dist/setup/render.d.ts +28 -0
  364. package/packages/server/dist/setup/render.d.ts.map +1 -0
  365. package/packages/server/dist/setup/render.js +60 -0
  366. package/packages/server/dist/setup/render.js.map +1 -0
  367. package/packages/server/dist/setup/repo-root.d.ts +3 -0
  368. package/packages/server/dist/setup/repo-root.d.ts.map +1 -0
  369. package/packages/server/dist/setup/repo-root.js +43 -0
  370. package/packages/server/dist/setup/repo-root.js.map +1 -0
  371. package/packages/server/dist/setup/service.d.ts +60 -0
  372. package/packages/server/dist/setup/service.d.ts.map +1 -0
  373. package/packages/server/dist/setup/service.js +345 -0
  374. package/packages/server/dist/setup/service.js.map +1 -0
  375. package/packages/server/dist/setup/start-server.d.ts +23 -0
  376. package/packages/server/dist/setup/start-server.d.ts.map +1 -0
  377. package/packages/server/dist/setup/start-server.js +465 -0
  378. package/packages/server/dist/setup/start-server.js.map +1 -0
  379. package/packages/server/dist/setup/wizard.d.ts +59 -0
  380. package/packages/server/dist/setup/wizard.d.ts.map +1 -0
  381. package/packages/server/dist/setup/wizard.js +556 -0
  382. package/packages/server/dist/setup/wizard.js.map +1 -0
  383. package/packages/server/dist/tools/edit-file.d.ts +13 -0
  384. package/packages/server/dist/tools/edit-file.d.ts.map +1 -0
  385. package/packages/server/dist/tools/edit-file.js +90 -0
  386. package/packages/server/dist/tools/edit-file.js.map +1 -0
  387. package/packages/server/dist/tools/glob.d.ts +12 -0
  388. package/packages/server/dist/tools/glob.d.ts.map +1 -0
  389. package/packages/server/dist/tools/glob.js +82 -0
  390. package/packages/server/dist/tools/glob.js.map +1 -0
  391. package/packages/server/dist/tools/index.d.ts +82 -0
  392. package/packages/server/dist/tools/index.d.ts.map +1 -0
  393. package/packages/server/dist/tools/index.js +72 -0
  394. package/packages/server/dist/tools/index.js.map +1 -0
  395. package/packages/server/dist/tools/list-dir.d.ts +24 -0
  396. package/packages/server/dist/tools/list-dir.d.ts.map +1 -0
  397. package/packages/server/dist/tools/list-dir.js +99 -0
  398. package/packages/server/dist/tools/list-dir.js.map +1 -0
  399. package/packages/server/dist/tools/path-helper.d.ts +15 -0
  400. package/packages/server/dist/tools/path-helper.d.ts.map +1 -0
  401. package/packages/server/dist/tools/path-helper.js +72 -0
  402. package/packages/server/dist/tools/path-helper.js.map +1 -0
  403. package/packages/server/dist/tools/read-file.d.ts +17 -0
  404. package/packages/server/dist/tools/read-file.d.ts.map +1 -0
  405. package/packages/server/dist/tools/read-file.js +94 -0
  406. package/packages/server/dist/tools/read-file.js.map +1 -0
  407. package/packages/server/dist/tools/sandbox.d.ts +57 -0
  408. package/packages/server/dist/tools/sandbox.d.ts.map +1 -0
  409. package/packages/server/dist/tools/sandbox.js +291 -0
  410. package/packages/server/dist/tools/sandbox.js.map +1 -0
  411. package/packages/server/dist/tools/write-file.d.ts +12 -0
  412. package/packages/server/dist/tools/write-file.d.ts.map +1 -0
  413. package/packages/server/dist/tools/write-file.js +67 -0
  414. package/packages/server/dist/tools/write-file.js.map +1 -0
  415. package/packages/server/dist/worker-agents-routes.d.ts +11 -0
  416. package/packages/server/dist/worker-agents-routes.d.ts.map +1 -0
  417. package/packages/server/dist/worker-agents-routes.js +253 -0
  418. package/packages/server/dist/worker-agents-routes.js.map +1 -0
  419. package/packages/server/package.json +41 -0
  420. package/packages/web/dist/assets/index-DH-gJ09_.js +60 -0
  421. package/packages/web/dist/assets/index-xU4lYYqY.css +2 -0
  422. package/packages/web/dist/index.html +14 -0
  423. package/packages/web/package.json +36 -0
  424. package/plugins/README.md +64 -0
  425. package/plugins/files/dist/client.d.ts +5 -0
  426. package/plugins/files/dist/client.d.ts.map +1 -0
  427. package/plugins/files/dist/client.js +354 -0
  428. package/plugins/files/dist/client.js.map +1 -0
  429. package/plugins/files/dist/server.d.ts +32 -0
  430. package/plugins/files/dist/server.d.ts.map +1 -0
  431. package/plugins/files/dist/server.js +514 -0
  432. package/plugins/files/dist/server.js.map +1 -0
  433. package/plugins/files/dist/tools/edit-file.d.ts +29 -0
  434. package/plugins/files/dist/tools/edit-file.d.ts.map +1 -0
  435. package/plugins/files/dist/tools/edit-file.js +230 -0
  436. package/plugins/files/dist/tools/edit-file.js.map +1 -0
  437. package/plugins/files/dist/tools/edit-file.prompt.md +36 -0
  438. package/plugins/files/dist/tools/glob.d.ts +12 -0
  439. package/plugins/files/dist/tools/glob.d.ts.map +1 -0
  440. package/plugins/files/dist/tools/glob.js +84 -0
  441. package/plugins/files/dist/tools/glob.js.map +1 -0
  442. package/plugins/files/dist/tools/index.d.ts +13 -0
  443. package/plugins/files/dist/tools/index.d.ts.map +1 -0
  444. package/plugins/files/dist/tools/index.js +158 -0
  445. package/plugins/files/dist/tools/index.js.map +1 -0
  446. package/plugins/files/dist/tools/list-dir.d.ts +24 -0
  447. package/plugins/files/dist/tools/list-dir.d.ts.map +1 -0
  448. package/plugins/files/dist/tools/list-dir.js +104 -0
  449. package/plugins/files/dist/tools/list-dir.js.map +1 -0
  450. package/plugins/files/dist/tools/load-prompt.d.ts +5 -0
  451. package/plugins/files/dist/tools/load-prompt.d.ts.map +1 -0
  452. package/plugins/files/dist/tools/load-prompt.js +39 -0
  453. package/plugins/files/dist/tools/load-prompt.js.map +1 -0
  454. package/plugins/files/dist/tools/path-helper.d.ts +32 -0
  455. package/plugins/files/dist/tools/path-helper.d.ts.map +1 -0
  456. package/plugins/files/dist/tools/path-helper.js +113 -0
  457. package/plugins/files/dist/tools/path-helper.js.map +1 -0
  458. package/plugins/files/dist/tools/read-file.d.ts +17 -0
  459. package/plugins/files/dist/tools/read-file.d.ts.map +1 -0
  460. package/plugins/files/dist/tools/read-file.js +109 -0
  461. package/plugins/files/dist/tools/read-file.js.map +1 -0
  462. package/plugins/files/dist/tools/read-tracker.d.ts +28 -0
  463. package/plugins/files/dist/tools/read-tracker.d.ts.map +1 -0
  464. package/plugins/files/dist/tools/read-tracker.js +135 -0
  465. package/plugins/files/dist/tools/read-tracker.js.map +1 -0
  466. package/plugins/files/dist/tools/replacers.d.ts +27 -0
  467. package/plugins/files/dist/tools/replacers.d.ts.map +1 -0
  468. package/plugins/files/dist/tools/replacers.js +221 -0
  469. package/plugins/files/dist/tools/replacers.js.map +1 -0
  470. package/plugins/files/dist/tools/tenant-config-delete.d.ts +12 -0
  471. package/plugins/files/dist/tools/tenant-config-delete.d.ts.map +1 -0
  472. package/plugins/files/dist/tools/tenant-config-delete.js +70 -0
  473. package/plugins/files/dist/tools/tenant-config-delete.js.map +1 -0
  474. package/plugins/files/dist/tools/tenant-config-edit.d.ts +25 -0
  475. package/plugins/files/dist/tools/tenant-config-edit.d.ts.map +1 -0
  476. package/plugins/files/dist/tools/tenant-config-edit.js +142 -0
  477. package/plugins/files/dist/tools/tenant-config-edit.js.map +1 -0
  478. package/plugins/files/dist/tools/tenant-config-glob.d.ts +12 -0
  479. package/plugins/files/dist/tools/tenant-config-glob.d.ts.map +1 -0
  480. package/plugins/files/dist/tools/tenant-config-glob.js +64 -0
  481. package/plugins/files/dist/tools/tenant-config-glob.js.map +1 -0
  482. package/plugins/files/dist/tools/tenant-config-helper.d.ts +64 -0
  483. package/plugins/files/dist/tools/tenant-config-helper.d.ts.map +1 -0
  484. package/plugins/files/dist/tools/tenant-config-helper.js +162 -0
  485. package/plugins/files/dist/tools/tenant-config-helper.js.map +1 -0
  486. package/plugins/files/dist/tools/tenant-config-list.d.ts +20 -0
  487. package/plugins/files/dist/tools/tenant-config-list.d.ts.map +1 -0
  488. package/plugins/files/dist/tools/tenant-config-list.js +95 -0
  489. package/plugins/files/dist/tools/tenant-config-list.js.map +1 -0
  490. package/plugins/files/dist/tools/tenant-config-read.d.ts +17 -0
  491. package/plugins/files/dist/tools/tenant-config-read.d.ts.map +1 -0
  492. package/plugins/files/dist/tools/tenant-config-read.js +87 -0
  493. package/plugins/files/dist/tools/tenant-config-read.js.map +1 -0
  494. package/plugins/files/dist/tools/tenant-config-write.d.ts +14 -0
  495. package/plugins/files/dist/tools/tenant-config-write.d.ts.map +1 -0
  496. package/plugins/files/dist/tools/tenant-config-write.js +78 -0
  497. package/plugins/files/dist/tools/tenant-config-write.js.map +1 -0
  498. package/plugins/files/dist/tools/text-shape.d.ts +20 -0
  499. package/plugins/files/dist/tools/text-shape.d.ts.map +1 -0
  500. package/plugins/files/dist/tools/text-shape.js +57 -0
  501. package/plugins/files/dist/tools/text-shape.js.map +1 -0
  502. package/plugins/files/dist/tools/write-file.d.ts +12 -0
  503. package/plugins/files/dist/tools/write-file.d.ts.map +1 -0
  504. package/plugins/files/dist/tools/write-file.js +89 -0
  505. package/plugins/files/dist/tools/write-file.js.map +1 -0
  506. package/plugins/files/dist/tools/write-file.prompt.md +14 -0
  507. package/plugins/files/manifest.json +100 -0
  508. package/plugins/files/package.json +39 -0
  509. package/plugins/files/skills/files-workspace-layout.md +29 -0
  510. package/plugins/microsandbox/dist/admin/browser-routes.d.ts +41 -0
  511. package/plugins/microsandbox/dist/admin/browser-routes.d.ts.map +1 -0
  512. package/plugins/microsandbox/dist/admin/browser-routes.js +208 -0
  513. package/plugins/microsandbox/dist/admin/browser-routes.js.map +1 -0
  514. package/plugins/microsandbox/dist/admin/preview-exec.d.ts +38 -0
  515. package/plugins/microsandbox/dist/admin/preview-exec.d.ts.map +1 -0
  516. package/plugins/microsandbox/dist/admin/preview-exec.js +185 -0
  517. package/plugins/microsandbox/dist/admin/preview-exec.js.map +1 -0
  518. package/plugins/microsandbox/dist/admin/routes.d.ts +35 -0
  519. package/plugins/microsandbox/dist/admin/routes.d.ts.map +1 -0
  520. package/plugins/microsandbox/dist/admin/routes.js +728 -0
  521. package/plugins/microsandbox/dist/admin/routes.js.map +1 -0
  522. package/plugins/microsandbox/dist/admin/sandboxfile-io.d.ts +11 -0
  523. package/plugins/microsandbox/dist/admin/sandboxfile-io.d.ts.map +1 -0
  524. package/plugins/microsandbox/dist/admin/sandboxfile-io.js +72 -0
  525. package/plugins/microsandbox/dist/admin/sandboxfile-io.js.map +1 -0
  526. package/plugins/microsandbox/dist/admin/templates.d.ts +16 -0
  527. package/plugins/microsandbox/dist/admin/templates.d.ts.map +1 -0
  528. package/plugins/microsandbox/dist/admin/templates.js +66 -0
  529. package/plugins/microsandbox/dist/admin/templates.js.map +1 -0
  530. package/plugins/microsandbox/dist/admin.d.ts +5 -0
  531. package/plugins/microsandbox/dist/admin.d.ts.map +1 -0
  532. package/plugins/microsandbox/dist/admin.js +256 -0
  533. package/plugins/microsandbox/dist/admin.js.map +1 -0
  534. package/plugins/microsandbox/dist/build/builder.d.ts +69 -0
  535. package/plugins/microsandbox/dist/build/builder.d.ts.map +1 -0
  536. package/plugins/microsandbox/dist/build/builder.js +257 -0
  537. package/plugins/microsandbox/dist/build/builder.js.map +1 -0
  538. package/plugins/microsandbox/dist/build/metadata.d.ts +27 -0
  539. package/plugins/microsandbox/dist/build/metadata.d.ts.map +1 -0
  540. package/plugins/microsandbox/dist/build/metadata.js +55 -0
  541. package/plugins/microsandbox/dist/build/metadata.js.map +1 -0
  542. package/plugins/microsandbox/dist/build/pointer.d.ts +51 -0
  543. package/plugins/microsandbox/dist/build/pointer.d.ts.map +1 -0
  544. package/plugins/microsandbox/dist/build/pointer.js +130 -0
  545. package/plugins/microsandbox/dist/build/pointer.js.map +1 -0
  546. package/plugins/microsandbox/dist/build/sandboxfile.d.ts +15 -0
  547. package/plugins/microsandbox/dist/build/sandboxfile.d.ts.map +1 -0
  548. package/plugins/microsandbox/dist/build/sandboxfile.js +176 -0
  549. package/plugins/microsandbox/dist/build/sandboxfile.js.map +1 -0
  550. package/plugins/microsandbox/dist/client.d.ts +5 -0
  551. package/plugins/microsandbox/dist/client.d.ts.map +1 -0
  552. package/plugins/microsandbox/dist/client.js +941 -0
  553. package/plugins/microsandbox/dist/client.js.map +1 -0
  554. package/plugins/microsandbox/dist/runner/browser.d.ts +50 -0
  555. package/plugins/microsandbox/dist/runner/browser.d.ts.map +1 -0
  556. package/plugins/microsandbox/dist/runner/browser.js +142 -0
  557. package/plugins/microsandbox/dist/runner/browser.js.map +1 -0
  558. package/plugins/microsandbox/dist/runner/free-port.d.ts +6 -0
  559. package/plugins/microsandbox/dist/runner/free-port.d.ts.map +1 -0
  560. package/plugins/microsandbox/dist/runner/free-port.js +53 -0
  561. package/plugins/microsandbox/dist/runner/free-port.js.map +1 -0
  562. package/plugins/microsandbox/dist/runner/index.d.ts +28 -0
  563. package/plugins/microsandbox/dist/runner/index.d.ts.map +1 -0
  564. package/plugins/microsandbox/dist/runner/index.js +72 -0
  565. package/plugins/microsandbox/dist/runner/index.js.map +1 -0
  566. package/plugins/microsandbox/dist/runner/microsandbox.d.ts +64 -0
  567. package/plugins/microsandbox/dist/runner/microsandbox.d.ts.map +1 -0
  568. package/plugins/microsandbox/dist/runner/microsandbox.js +668 -0
  569. package/plugins/microsandbox/dist/runner/microsandbox.js.map +1 -0
  570. package/plugins/microsandbox/dist/runner/nullable.d.ts +36 -0
  571. package/plugins/microsandbox/dist/runner/nullable.d.ts.map +1 -0
  572. package/plugins/microsandbox/dist/runner/nullable.js +82 -0
  573. package/plugins/microsandbox/dist/runner/nullable.js.map +1 -0
  574. package/plugins/microsandbox/dist/runner/pool.d.ts +97 -0
  575. package/plugins/microsandbox/dist/runner/pool.d.ts.map +1 -0
  576. package/plugins/microsandbox/dist/runner/pool.js +494 -0
  577. package/plugins/microsandbox/dist/runner/pool.js.map +1 -0
  578. package/plugins/microsandbox/dist/runner/types.d.ts +33 -0
  579. package/plugins/microsandbox/dist/runner/types.d.ts.map +1 -0
  580. package/plugins/microsandbox/dist/runner/types.js +79 -0
  581. package/plugins/microsandbox/dist/runner/types.js.map +1 -0
  582. package/plugins/microsandbox/dist/server.d.ts +7 -0
  583. package/plugins/microsandbox/dist/server.d.ts.map +1 -0
  584. package/plugins/microsandbox/dist/server.js +276 -0
  585. package/plugins/microsandbox/dist/server.js.map +1 -0
  586. package/plugins/microsandbox/dist/tools/browser.d.ts +25 -0
  587. package/plugins/microsandbox/dist/tools/browser.d.ts.map +1 -0
  588. package/plugins/microsandbox/dist/tools/browser.js +78 -0
  589. package/plugins/microsandbox/dist/tools/browser.js.map +1 -0
  590. package/plugins/microsandbox/dist/tools/build.d.ts +5 -0
  591. package/plugins/microsandbox/dist/tools/build.d.ts.map +1 -0
  592. package/plugins/microsandbox/dist/tools/build.js +243 -0
  593. package/plugins/microsandbox/dist/tools/build.js.map +1 -0
  594. package/plugins/microsandbox/dist/tools/index.d.ts +9 -0
  595. package/plugins/microsandbox/dist/tools/index.d.ts.map +1 -0
  596. package/plugins/microsandbox/dist/tools/index.js +430 -0
  597. package/plugins/microsandbox/dist/tools/index.js.map +1 -0
  598. package/plugins/microsandbox/dist/tools/mcp-client.d.ts +63 -0
  599. package/plugins/microsandbox/dist/tools/mcp-client.d.ts.map +1 -0
  600. package/plugins/microsandbox/dist/tools/mcp-client.js +226 -0
  601. package/plugins/microsandbox/dist/tools/mcp-client.js.map +1 -0
  602. package/plugins/microsandbox/manifest.json +177 -0
  603. package/plugins/microsandbox/package.json +38 -0
  604. package/plugins/microsandbox/skills/microsandbox-browser-howto.md +155 -0
  605. package/plugins/microsandbox/skills/microsandbox-build-use.md +201 -0
  606. package/plugins/microsandbox/skills/microsandbox-config.md +38 -0
  607. package/plugins/microsandbox/skills/microsandbox-exec-howto.md +144 -0
  608. package/plugins/microsandbox/skills/microsandbox-libreoffice.md +159 -0
  609. package/plugins/microsandbox/templates/README.md +26 -0
  610. package/plugins/web-search/dist/server.d.ts +4 -0
  611. package/plugins/web-search/dist/server.d.ts.map +1 -0
  612. package/plugins/web-search/dist/server.js +73 -0
  613. package/plugins/web-search/dist/server.js.map +1 -0
  614. package/plugins/web-search/dist/tools/health.d.ts +31 -0
  615. package/plugins/web-search/dist/tools/health.d.ts.map +1 -0
  616. package/plugins/web-search/dist/tools/health.js +59 -0
  617. package/plugins/web-search/dist/tools/health.js.map +1 -0
  618. package/plugins/web-search/dist/tools/index.d.ts +3 -0
  619. package/plugins/web-search/dist/tools/index.d.ts.map +1 -0
  620. package/plugins/web-search/dist/tools/index.js +2 -0
  621. package/plugins/web-search/dist/tools/index.js.map +1 -0
  622. package/plugins/web-search/dist/tools/providers.d.ts +43 -0
  623. package/plugins/web-search/dist/tools/providers.d.ts.map +1 -0
  624. package/plugins/web-search/dist/tools/providers.js +140 -0
  625. package/plugins/web-search/dist/tools/providers.js.map +1 -0
  626. package/plugins/web-search/dist/tools/web-search.d.ts +15 -0
  627. package/plugins/web-search/dist/tools/web-search.d.ts.map +1 -0
  628. package/plugins/web-search/dist/tools/web-search.js +244 -0
  629. package/plugins/web-search/dist/tools/web-search.js.map +1 -0
  630. package/plugins/web-search/manifest.json +65 -0
  631. package/plugins/web-search/node_modules/@esbuild/darwin-arm64/README.md +3 -0
  632. package/plugins/web-search/node_modules/@esbuild/darwin-arm64/package.json +20 -0
  633. package/plugins/web-search/node_modules/@vitest/expect/LICENSE +21 -0
  634. package/plugins/web-search/node_modules/@vitest/expect/README.md +21 -0
  635. package/plugins/web-search/node_modules/@vitest/expect/dist/index.d.ts +808 -0
  636. package/plugins/web-search/node_modules/@vitest/expect/dist/index.js +1799 -0
  637. package/plugins/web-search/node_modules/@vitest/expect/package.json +46 -0
  638. package/plugins/web-search/node_modules/@vitest/mocker/LICENSE +21 -0
  639. package/plugins/web-search/node_modules/@vitest/mocker/README.md +5 -0
  640. package/plugins/web-search/node_modules/@vitest/mocker/dist/auto-register.d.ts +2 -0
  641. package/plugins/web-search/node_modules/@vitest/mocker/dist/auto-register.js +9 -0
  642. package/plugins/web-search/node_modules/@vitest/mocker/dist/browser.d.ts +53 -0
  643. package/plugins/web-search/node_modules/@vitest/mocker/dist/browser.js +91 -0
  644. package/plugins/web-search/node_modules/@vitest/mocker/dist/chunk-interceptor-native.js +15 -0
  645. package/plugins/web-search/node_modules/@vitest/mocker/dist/chunk-mocker.js +1602 -0
  646. package/plugins/web-search/node_modules/@vitest/mocker/dist/chunk-pathe.M-eThtNZ.js +174 -0
  647. package/plugins/web-search/node_modules/@vitest/mocker/dist/chunk-registry.js +182 -0
  648. package/plugins/web-search/node_modules/@vitest/mocker/dist/chunk-utils.js +16 -0
  649. package/plugins/web-search/node_modules/@vitest/mocker/dist/index.d.ts +21 -0
  650. package/plugins/web-search/node_modules/@vitest/mocker/dist/index.js +174 -0
  651. package/plugins/web-search/node_modules/@vitest/mocker/dist/mocker.d-Ce9_ySj5.d.ts +83 -0
  652. package/plugins/web-search/node_modules/@vitest/mocker/dist/node.d.ts +821 -0
  653. package/plugins/web-search/node_modules/@vitest/mocker/dist/node.js +1306 -0
  654. package/plugins/web-search/node_modules/@vitest/mocker/dist/redirect.d.ts +3 -0
  655. package/plugins/web-search/node_modules/@vitest/mocker/dist/redirect.js +75 -0
  656. package/plugins/web-search/node_modules/@vitest/mocker/dist/register.d.ts +9 -0
  657. package/plugins/web-search/node_modules/@vitest/mocker/dist/register.js +41 -0
  658. package/plugins/web-search/node_modules/@vitest/mocker/dist/registry.d-D765pazg.d.ts +87 -0
  659. package/plugins/web-search/node_modules/@vitest/mocker/dist/types.d-D_aRZRdy.d.ts +8 -0
  660. package/plugins/web-search/node_modules/@vitest/mocker/package.json +82 -0
  661. package/plugins/web-search/node_modules/@vitest/pretty-format/LICENSE +21 -0
  662. package/plugins/web-search/node_modules/@vitest/pretty-format/dist/index.d.ts +119 -0
  663. package/plugins/web-search/node_modules/@vitest/pretty-format/dist/index.js +1387 -0
  664. package/plugins/web-search/node_modules/@vitest/pretty-format/package.json +44 -0
  665. package/plugins/web-search/node_modules/@vitest/runner/LICENSE +21 -0
  666. package/plugins/web-search/node_modules/@vitest/runner/README.md +5 -0
  667. package/plugins/web-search/node_modules/@vitest/runner/dist/chunk-hooks.js +2254 -0
  668. package/plugins/web-search/node_modules/@vitest/runner/dist/index.d.ts +261 -0
  669. package/plugins/web-search/node_modules/@vitest/runner/dist/index.js +6 -0
  670. package/plugins/web-search/node_modules/@vitest/runner/dist/tasks.d-CkscK4of.d.ts +558 -0
  671. package/plugins/web-search/node_modules/@vitest/runner/dist/types.d.ts +163 -0
  672. package/plugins/web-search/node_modules/@vitest/runner/dist/types.js +1 -0
  673. package/plugins/web-search/node_modules/@vitest/runner/dist/utils.d.ts +47 -0
  674. package/plugins/web-search/node_modules/@vitest/runner/dist/utils.js +6 -0
  675. package/plugins/web-search/node_modules/@vitest/runner/package.json +49 -0
  676. package/plugins/web-search/node_modules/@vitest/snapshot/LICENSE +21 -0
  677. package/plugins/web-search/node_modules/@vitest/snapshot/README.md +84 -0
  678. package/plugins/web-search/node_modules/@vitest/snapshot/dist/environment.d-DHdQ1Csl.d.ts +22 -0
  679. package/plugins/web-search/node_modules/@vitest/snapshot/dist/environment.d.ts +16 -0
  680. package/plugins/web-search/node_modules/@vitest/snapshot/dist/environment.js +40 -0
  681. package/plugins/web-search/node_modules/@vitest/snapshot/dist/index.d.ts +137 -0
  682. package/plugins/web-search/node_modules/@vitest/snapshot/dist/index.js +2305 -0
  683. package/plugins/web-search/node_modules/@vitest/snapshot/dist/manager.d.ts +18 -0
  684. package/plugins/web-search/node_modules/@vitest/snapshot/dist/manager.js +73 -0
  685. package/plugins/web-search/node_modules/@vitest/snapshot/dist/rawSnapshot.d-lFsMJFUd.d.ts +61 -0
  686. package/plugins/web-search/node_modules/@vitest/snapshot/package.json +54 -0
  687. package/plugins/web-search/node_modules/@vitest/spy/LICENSE +21 -0
  688. package/plugins/web-search/node_modules/@vitest/spy/README.md +3 -0
  689. package/plugins/web-search/node_modules/@vitest/spy/dist/index.d.ts +356 -0
  690. package/plugins/web-search/node_modules/@vitest/spy/dist/index.js +191 -0
  691. package/plugins/web-search/node_modules/@vitest/spy/package.json +38 -0
  692. package/plugins/web-search/node_modules/@vitest/utils/LICENSE +21 -0
  693. package/plugins/web-search/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.js +158 -0
  694. package/plugins/web-search/node_modules/@vitest/utils/dist/diff.d.ts +104 -0
  695. package/plugins/web-search/node_modules/@vitest/utils/dist/diff.js +2185 -0
  696. package/plugins/web-search/node_modules/@vitest/utils/dist/error.d.ts +9 -0
  697. package/plugins/web-search/node_modules/@vitest/utils/dist/error.js +162 -0
  698. package/plugins/web-search/node_modules/@vitest/utils/dist/helpers.d.ts +56 -0
  699. package/plugins/web-search/node_modules/@vitest/utils/dist/helpers.js +251 -0
  700. package/plugins/web-search/node_modules/@vitest/utils/dist/index.d.ts +57 -0
  701. package/plugins/web-search/node_modules/@vitest/utils/dist/index.js +633 -0
  702. package/plugins/web-search/node_modules/@vitest/utils/dist/source-map.d.ts +139 -0
  703. package/plugins/web-search/node_modules/@vitest/utils/dist/source-map.js +996 -0
  704. package/plugins/web-search/node_modules/@vitest/utils/dist/types.d-BCElaP-c.d.ts +53 -0
  705. package/plugins/web-search/node_modules/@vitest/utils/dist/types.d.ts +53 -0
  706. package/plugins/web-search/node_modules/@vitest/utils/dist/types.js +1 -0
  707. package/plugins/web-search/node_modules/@vitest/utils/package.json +77 -0
  708. package/plugins/web-search/node_modules/chai/LICENSE +21 -0
  709. package/plugins/web-search/node_modules/chai/README.md +162 -0
  710. package/plugins/web-search/node_modules/chai/package.json +74 -0
  711. package/plugins/web-search/node_modules/esbuild/README.md +3 -0
  712. package/plugins/web-search/node_modules/esbuild/package.json +49 -0
  713. package/plugins/web-search/node_modules/std-env/README.md +118 -0
  714. package/plugins/web-search/node_modules/std-env/dist/index.cjs +1 -0
  715. package/plugins/web-search/node_modules/std-env/dist/index.d.cts +92 -0
  716. package/plugins/web-search/node_modules/std-env/dist/index.d.mts +92 -0
  717. package/plugins/web-search/node_modules/std-env/dist/index.d.ts +92 -0
  718. package/plugins/web-search/node_modules/std-env/dist/index.mjs +1 -0
  719. package/plugins/web-search/node_modules/std-env/package.json +46 -0
  720. package/plugins/web-search/node_modules/tinyexec/LICENSE +21 -0
  721. package/plugins/web-search/node_modules/tinyexec/README.md +256 -0
  722. package/plugins/web-search/node_modules/tinyexec/dist/main.cjs +575 -0
  723. package/plugins/web-search/node_modules/tinyexec/dist/main.d.cts +70 -0
  724. package/plugins/web-search/node_modules/tinyexec/dist/main.d.ts +70 -0
  725. package/plugins/web-search/node_modules/tinyexec/dist/main.js +578 -0
  726. package/plugins/web-search/node_modules/tinyexec/package.json +66 -0
  727. package/plugins/web-search/node_modules/tinyrainbow/README.md +28 -0
  728. package/plugins/web-search/node_modules/tinyrainbow/dist/browser.d.ts +8 -0
  729. package/plugins/web-search/node_modules/tinyrainbow/dist/browser.js +20 -0
  730. package/plugins/web-search/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.js +90 -0
  731. package/plugins/web-search/node_modules/tinyrainbow/dist/index-8b61d5bc.d.ts +59 -0
  732. package/plugins/web-search/node_modules/tinyrainbow/dist/node.d.ts +8 -0
  733. package/plugins/web-search/node_modules/tinyrainbow/dist/node.js +22 -0
  734. package/plugins/web-search/node_modules/tinyrainbow/package.json +37 -0
  735. package/plugins/web-search/node_modules/typescript/README.md +50 -0
  736. package/plugins/web-search/node_modules/typescript/package.json +120 -0
  737. package/plugins/web-search/node_modules/vite/README.md +20 -0
  738. package/plugins/web-search/node_modules/vite/dist/client/client.mjs +1106 -0
  739. package/plugins/web-search/node_modules/vite/dist/client/env.mjs +19 -0
  740. package/plugins/web-search/node_modules/vite/dist/node/chunks/build.js +4 -0
  741. package/plugins/web-search/node_modules/vite/dist/node/chunks/build2.js +5538 -0
  742. package/plugins/web-search/node_modules/vite/dist/node/chunks/chunk.js +48 -0
  743. package/plugins/web-search/node_modules/vite/dist/node/chunks/config.js +36065 -0
  744. package/plugins/web-search/node_modules/vite/dist/node/chunks/config2.js +4 -0
  745. package/plugins/web-search/node_modules/vite/dist/node/chunks/dist.js +6758 -0
  746. package/plugins/web-search/node_modules/vite/dist/node/chunks/lib.js +377 -0
  747. package/plugins/web-search/node_modules/vite/dist/node/chunks/logger.js +329 -0
  748. package/plugins/web-search/node_modules/vite/dist/node/chunks/moduleRunnerTransport.d.ts +96 -0
  749. package/plugins/web-search/node_modules/vite/dist/node/chunks/optimizer.js +4 -0
  750. package/plugins/web-search/node_modules/vite/dist/node/chunks/postcss-import.js +479 -0
  751. package/plugins/web-search/node_modules/vite/dist/node/chunks/preview.js +4 -0
  752. package/plugins/web-search/node_modules/vite/dist/node/chunks/server.js +4 -0
  753. package/plugins/web-search/node_modules/vite/dist/node/cli.js +698 -0
  754. package/plugins/web-search/node_modules/vite/dist/node/index.d.ts +3717 -0
  755. package/plugins/web-search/node_modules/vite/dist/node/index.js +30 -0
  756. package/plugins/web-search/node_modules/vite/dist/node/module-runner.d.ts +311 -0
  757. package/plugins/web-search/node_modules/vite/dist/node/module-runner.js +1160 -0
  758. package/plugins/web-search/node_modules/vite/package.json +199 -0
  759. package/plugins/web-search/node_modules/vite/types/package.json +4 -0
  760. package/plugins/web-search/node_modules/vitest/README.md +7 -0
  761. package/plugins/web-search/node_modules/vitest/dist/browser.d.ts +34 -0
  762. package/plugins/web-search/node_modules/vitest/dist/browser.js +8 -0
  763. package/plugins/web-search/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.js +7 -0
  764. package/plugins/web-search/node_modules/vitest/dist/chunks/base.DfmxU-tU.js +38 -0
  765. package/plugins/web-search/node_modules/vitest/dist/chunks/benchmark.CYdenmiT.js +37 -0
  766. package/plugins/web-search/node_modules/vitest/dist/chunks/benchmark.d.BwvBVTda.d.ts +24 -0
  767. package/plugins/web-search/node_modules/vitest/dist/chunks/cac.0BJqEUeA.js +1469 -0
  768. package/plugins/web-search/node_modules/vitest/dist/chunks/cli-api.DWGBtMmz.js +10660 -0
  769. package/plugins/web-search/node_modules/vitest/dist/chunks/config.d.BKdhh7Zx.d.ts +224 -0
  770. package/plugins/web-search/node_modules/vitest/dist/chunks/console.CtFJOzRO.js +153 -0
  771. package/plugins/web-search/node_modules/vitest/dist/chunks/constants.DnKduX2e.js +44 -0
  772. package/plugins/web-search/node_modules/vitest/dist/chunks/coverage.DVF1vEu8.js +25 -0
  773. package/plugins/web-search/node_modules/vitest/dist/chunks/coverage.DfSpMS-b.js +4350 -0
  774. package/plugins/web-search/node_modules/vitest/dist/chunks/coverage.d.S9RMNXIe.d.ts +35 -0
  775. package/plugins/web-search/node_modules/vitest/dist/chunks/creator.GK6I-cL4.js +640 -0
  776. package/plugins/web-search/node_modules/vitest/dist/chunks/date.Bq6ZW5rf.js +73 -0
  777. package/plugins/web-search/node_modules/vitest/dist/chunks/defaults.B7q_naMc.js +115 -0
  778. package/plugins/web-search/node_modules/vitest/dist/chunks/env.D4Lgay0q.js +8 -0
  779. package/plugins/web-search/node_modules/vitest/dist/chunks/environment.d.cL3nLXbE.d.ts +119 -0
  780. package/plugins/web-search/node_modules/vitest/dist/chunks/execute.B7h3T_Hc.js +708 -0
  781. package/plugins/web-search/node_modules/vitest/dist/chunks/git.BVQ8w_Sw.js +72 -0
  782. package/plugins/web-search/node_modules/vitest/dist/chunks/global.d.MAmajcmJ.d.ts +136 -0
  783. package/plugins/web-search/node_modules/vitest/dist/chunks/globals.DEHgCU4V.js +26 -0
  784. package/plugins/web-search/node_modules/vitest/dist/chunks/index.B521nVV-.js +157 -0
  785. package/plugins/web-search/node_modules/vitest/dist/chunks/index.BCWujgDG.js +231 -0
  786. package/plugins/web-search/node_modules/vitest/dist/chunks/index.CdQS2e2Q.js +37 -0
  787. package/plugins/web-search/node_modules/vitest/dist/chunks/index.CmSc2RE5.js +587 -0
  788. package/plugins/web-search/node_modules/vitest/dist/chunks/index.CwejwG0H.js +105 -0
  789. package/plugins/web-search/node_modules/vitest/dist/chunks/index.D3XRDfWc.js +213 -0
  790. package/plugins/web-search/node_modules/vitest/dist/chunks/index.VByaPkjc.js +2183 -0
  791. package/plugins/web-search/node_modules/vitest/dist/chunks/index.X0nbfr6-.js +6584 -0
  792. package/plugins/web-search/node_modules/vitest/dist/chunks/inspector.C914Efll.js +57 -0
  793. package/plugins/web-search/node_modules/vitest/dist/chunks/mocker.d.BE_2ls6u.d.ts +17 -0
  794. package/plugins/web-search/node_modules/vitest/dist/chunks/node.fjCdwEIl.js +15 -0
  795. package/plugins/web-search/node_modules/vitest/dist/chunks/reporters.d.BuRON0I0.d.ts +3168 -0
  796. package/plugins/web-search/node_modules/vitest/dist/chunks/rpc.-pEldfrD.js +83 -0
  797. package/plugins/web-search/node_modules/vitest/dist/chunks/runBaseTests.9Ij9_de-.js +129 -0
  798. package/plugins/web-search/node_modules/vitest/dist/chunks/setup-common.Dd054P77.js +60 -0
  799. package/plugins/web-search/node_modules/vitest/dist/chunks/suite.d.FvehnV49.d.ts +10 -0
  800. package/plugins/web-search/node_modules/vitest/dist/chunks/typechecker.DRKU1-1g.js +874 -0
  801. package/plugins/web-search/node_modules/vitest/dist/chunks/utils.CAioKnHs.js +61 -0
  802. package/plugins/web-search/node_modules/vitest/dist/chunks/utils.XdZDrNZV.js +65 -0
  803. package/plugins/web-search/node_modules/vitest/dist/chunks/vi.bdSIJ99Y.js +4015 -0
  804. package/plugins/web-search/node_modules/vitest/dist/chunks/vite.d.BnOPPc46.d.ts +25 -0
  805. package/plugins/web-search/node_modules/vitest/dist/chunks/vm.BThCzidc.js +756 -0
  806. package/plugins/web-search/node_modules/vitest/dist/chunks/worker.d.CUgIPz9V.d.ts +176 -0
  807. package/plugins/web-search/node_modules/vitest/dist/chunks/worker.d.uzWsCv9X.d.ts +8 -0
  808. package/plugins/web-search/node_modules/vitest/dist/cli.js +27 -0
  809. package/plugins/web-search/node_modules/vitest/dist/config.cjs +148 -0
  810. package/plugins/web-search/node_modules/vitest/dist/config.d.ts +100 -0
  811. package/plugins/web-search/node_modules/vitest/dist/config.js +21 -0
  812. package/plugins/web-search/node_modules/vitest/dist/coverage.d.ts +108 -0
  813. package/plugins/web-search/node_modules/vitest/dist/coverage.js +34 -0
  814. package/plugins/web-search/node_modules/vitest/dist/environments.d.ts +26 -0
  815. package/plugins/web-search/node_modules/vitest/dist/environments.js +2 -0
  816. package/plugins/web-search/node_modules/vitest/dist/execute.d.ts +150 -0
  817. package/plugins/web-search/node_modules/vitest/dist/execute.js +13 -0
  818. package/plugins/web-search/node_modules/vitest/dist/index.d.ts +651 -0
  819. package/plugins/web-search/node_modules/vitest/dist/index.js +18 -0
  820. package/plugins/web-search/node_modules/vitest/dist/mocker.d.ts +1 -0
  821. package/plugins/web-search/node_modules/vitest/dist/mocker.js +1 -0
  822. package/plugins/web-search/node_modules/vitest/dist/node.d.ts +158 -0
  823. package/plugins/web-search/node_modules/vitest/dist/node.js +105 -0
  824. package/plugins/web-search/node_modules/vitest/dist/path.js +7 -0
  825. package/plugins/web-search/node_modules/vitest/dist/reporters.d.ts +25 -0
  826. package/plugins/web-search/node_modules/vitest/dist/reporters.js +23 -0
  827. package/plugins/web-search/node_modules/vitest/dist/runners.d.ts +46 -0
  828. package/plugins/web-search/node_modules/vitest/dist/runners.js +235 -0
  829. package/plugins/web-search/node_modules/vitest/dist/snapshot.d.ts +9 -0
  830. package/plugins/web-search/node_modules/vitest/dist/snapshot.js +4 -0
  831. package/plugins/web-search/node_modules/vitest/dist/spy.js +1 -0
  832. package/plugins/web-search/node_modules/vitest/dist/suite.d.ts +5 -0
  833. package/plugins/web-search/node_modules/vitest/dist/suite.js +5 -0
  834. package/plugins/web-search/node_modules/vitest/dist/worker.js +124 -0
  835. package/plugins/web-search/node_modules/vitest/dist/workers/forks.js +43 -0
  836. package/plugins/web-search/node_modules/vitest/dist/workers/runVmTests.js +90 -0
  837. package/plugins/web-search/node_modules/vitest/dist/workers/threads.js +31 -0
  838. package/plugins/web-search/node_modules/vitest/dist/workers/vmForks.js +47 -0
  839. package/plugins/web-search/node_modules/vitest/dist/workers/vmThreads.js +37 -0
  840. package/plugins/web-search/node_modules/vitest/dist/workers.d.ts +40 -0
  841. package/plugins/web-search/node_modules/vitest/dist/workers.js +30 -0
  842. package/plugins/web-search/node_modules/vitest/package.json +207 -0
  843. package/plugins/web-search/package.json +30 -0
  844. package/plugins/web-search/skills/web-search-howto.md +69 -0
  845. package/plugins/workboard/agent-seeds/echo-demo/agent.json +7 -0
  846. package/plugins/workboard/agent-seeds/llm-default/SOUL.md +53 -0
  847. package/plugins/workboard/agent-seeds/llm-default/agent.json +7 -0
  848. package/plugins/workboard/dist/client.d.ts +5 -0
  849. package/plugins/workboard/dist/client.d.ts.map +1 -0
  850. package/plugins/workboard/dist/client.js +895 -0
  851. package/plugins/workboard/dist/client.js.map +1 -0
  852. package/plugins/workboard/dist/db/agents.d.ts +100 -0
  853. package/plugins/workboard/dist/db/agents.d.ts.map +1 -0
  854. package/plugins/workboard/dist/db/agents.js +280 -0
  855. package/plugins/workboard/dist/db/agents.js.map +1 -0
  856. package/plugins/workboard/dist/db/schema.d.ts +3 -0
  857. package/plugins/workboard/dist/db/schema.d.ts.map +1 -0
  858. package/plugins/workboard/dist/db/schema.js +31 -0
  859. package/plugins/workboard/dist/db/schema.js.map +1 -0
  860. package/plugins/workboard/dist/db/session-history.d.ts +28 -0
  861. package/plugins/workboard/dist/db/session-history.d.ts.map +1 -0
  862. package/plugins/workboard/dist/db/session-history.js +224 -0
  863. package/plugins/workboard/dist/db/session-history.js.map +1 -0
  864. package/plugins/workboard/dist/db/tasks.d.ts +260 -0
  865. package/plugins/workboard/dist/db/tasks.d.ts.map +1 -0
  866. package/plugins/workboard/dist/db/tasks.js +451 -0
  867. package/plugins/workboard/dist/db/tasks.js.map +1 -0
  868. package/plugins/workboard/dist/db/worker-agents.d.ts +16 -0
  869. package/plugins/workboard/dist/db/worker-agents.d.ts.map +1 -0
  870. package/plugins/workboard/dist/db/worker-agents.js +62 -0
  871. package/plugins/workboard/dist/db/worker-agents.js.map +1 -0
  872. package/plugins/workboard/dist/effective-skills.d.ts +13 -0
  873. package/plugins/workboard/dist/effective-skills.d.ts.map +1 -0
  874. package/plugins/workboard/dist/effective-skills.js +126 -0
  875. package/plugins/workboard/dist/effective-skills.js.map +1 -0
  876. package/plugins/workboard/dist/fs-worker-agents.d.ts +35 -0
  877. package/plugins/workboard/dist/fs-worker-agents.d.ts.map +1 -0
  878. package/plugins/workboard/dist/fs-worker-agents.js +199 -0
  879. package/plugins/workboard/dist/fs-worker-agents.js.map +1 -0
  880. package/plugins/workboard/dist/migrate-worker-agents.d.ts +11 -0
  881. package/plugins/workboard/dist/migrate-worker-agents.d.ts.map +1 -0
  882. package/plugins/workboard/dist/migrate-worker-agents.js +89 -0
  883. package/plugins/workboard/dist/migrate-worker-agents.js.map +1 -0
  884. package/plugins/workboard/dist/routes/handlers.d.ts +106 -0
  885. package/plugins/workboard/dist/routes/handlers.d.ts.map +1 -0
  886. package/plugins/workboard/dist/routes/handlers.js +668 -0
  887. package/plugins/workboard/dist/routes/handlers.js.map +1 -0
  888. package/plugins/workboard/dist/server.d.ts +6 -0
  889. package/plugins/workboard/dist/server.d.ts.map +1 -0
  890. package/plugins/workboard/dist/server.js +368 -0
  891. package/plugins/workboard/dist/server.js.map +1 -0
  892. package/plugins/workboard/dist/tools/index.d.ts +70 -0
  893. package/plugins/workboard/dist/tools/index.d.ts.map +1 -0
  894. package/plugins/workboard/dist/tools/index.js +963 -0
  895. package/plugins/workboard/dist/tools/index.js.map +1 -0
  896. package/plugins/workboard/dist/types.d.ts +27 -0
  897. package/plugins/workboard/dist/types.d.ts.map +1 -0
  898. package/plugins/workboard/dist/types.js +16 -0
  899. package/plugins/workboard/dist/types.js.map +1 -0
  900. package/plugins/workboard/dist/worker/pool.d.ts +220 -0
  901. package/plugins/workboard/dist/worker/pool.d.ts.map +1 -0
  902. package/plugins/workboard/dist/worker/pool.js +866 -0
  903. package/plugins/workboard/dist/worker/pool.js.map +1 -0
  904. package/plugins/workboard/dist/worker/tool-policy.d.ts +27 -0
  905. package/plugins/workboard/dist/worker/tool-policy.d.ts.map +1 -0
  906. package/plugins/workboard/dist/worker/tool-policy.js +76 -0
  907. package/plugins/workboard/dist/worker/tool-policy.js.map +1 -0
  908. package/plugins/workboard/dist/worker-agents-page.d.ts +4 -0
  909. package/plugins/workboard/dist/worker-agents-page.d.ts.map +1 -0
  910. package/plugins/workboard/dist/worker-agents-page.js +193 -0
  911. package/plugins/workboard/dist/worker-agents-page.js.map +1 -0
  912. package/plugins/workboard/manifest.json +180 -0
  913. package/plugins/workboard/package.json +37 -0
  914. package/plugins/workboard/skills/large-input-large-output.md +185 -0
  915. package/plugins/workboard/skills/workboard-howto.md +166 -0
  916. package/plugins/workboard/skills/worker-creator.md +267 -0
  917. package/plugins/workboard/skills/worker-fleet.md +431 -0
@@ -0,0 +1,597 @@
1
+ // Headless agent loop for the workboard worker pool, built on
2
+ // pi-agent-core's `AgentHarness`.
3
+ //
4
+ // Why AgentHarness instead of the lower-level runAgentLoop?
5
+ // * harness drives auto-compact, tool gating, session-tree
6
+ // persistence, and steer/follow-up queues for free;
7
+ // * we already implement `SessionStorage` against SQLite so the
8
+ // transcript lives in the same `messages` table as user chat;
9
+ // * sharing harness with the chat handler means tianshu only has
10
+ // one agent runtime.
11
+ //
12
+ // The headless wrapper here adds:
13
+ // * a worker session created on entry, archived on exit;
14
+ // * three-layer timeouts (first-response / idle / max-run) on
15
+ // top of harness's per-turn semantics;
16
+ // * a `task_complete` capture path so the LLM's terminal call
17
+ // resolves the loop with status='done' + summary + files.
18
+ //
19
+ // Plugin authors don't see any of this; their tools come from the
20
+ // regular plugin registry, run through `agent-tool-adapter`, and
21
+ // land in the harness as the same AgentTool[] the chat handler
22
+ // uses.
23
+ import { AgentHarness, } from "@earendil-works/pi-agent-core";
24
+ import { buildModel, findModel, getDefaultModel, resolveApiKey, } from "../core/index.js";
25
+ import { buildToolset } from "../tools/index.js";
26
+ import { dumpSystemPrompt } from "./dump-system-prompt.js";
27
+ import { filterSkillsForTenant, } from "../core/plugins/skills.js";
28
+ import { defaultSystemPrompt, formatAvailableSkillsBlock, formatExecutionBiasBlock, formatPluginPromptFragments, formatWorkerAgentContextBlock, substituteUserIdPlaceholders, tryAutoCompact, } from "./handler.js";
29
+ import { loadTenantSkills } from "../core/tenant-skills.js";
30
+ import { adaptToolset } from "./agent-tool-adapter.js";
31
+ import { SqliteSessionRepo } from "./sqlite-session-repo.js";
32
+ import { makeStubExecutionEnv } from "./stub-execution-env.js";
33
+ const TASK_COMPLETE_TOOL = "task_complete";
34
+ const DEFAULT_FIRST_RESPONSE_MS = 300_000;
35
+ const DEFAULT_IDLE_MS = 600_000;
36
+ const DEFAULT_MAX_RUN_MS = 1_800_000;
37
+ // Note: no turn cap. The harness has three time-based watchdogs
38
+ // (first-response / idle / max-run) which are sufficient for runaway
39
+ // detection. A turn cap was inherited from the pre-N+6.4 worker and
40
+ // caused legitimate multi-step browser tasks to stall mid-flight.
41
+ // If we ever observe a model burning turns without burning time
42
+ // (tool-call thrashing without latency), revisit — but that's
43
+ // hypothetical, and the chat handler doesn't impose one either, so
44
+ // the worker shouldn't either.
45
+ export async function runAgentLoop(req) {
46
+ const { ctx, userId, initialUserMessage, pluginRegistry, homeDir, signal: externalSignal, } = req;
47
+ const repo = new SqliteSessionRepo(ctx);
48
+ // Resume vs. fresh:
49
+ // - When the caller (e.g. workboard's retry path) passes
50
+ // `resumeSessionId` AND that session still exists in this
51
+ // tenant's DB, we open it. The LLM sees the prior turns
52
+ // as context and `initialUserMessage` is appended as a
53
+ // follow-up prompt — think "continue from where we left
54
+ // off".
55
+ // - Otherwise (fresh task, or stale id) we create a brand
56
+ // new session row.
57
+ // We catch errors from `open` rather than letting them throw,
58
+ // so a stale id doesn't kill the run — we silently fall back
59
+ // to fresh and log a warning.
60
+ let session = null;
61
+ let resumed = false;
62
+ if (req.resumeSessionId) {
63
+ try {
64
+ // `repo.open` only consumes metadata.id internally (see
65
+ // SqliteSessionRepo.open). The other fields are required by
66
+ // the type but ignored at runtime; we pass plausible values
67
+ // sourced from the request so we don't accidentally load a
68
+ // session belonging to another tenant.
69
+ session = await repo.open({
70
+ id: req.resumeSessionId,
71
+ createdAt: new Date(0).toISOString(),
72
+ tenantId: ctx.tenantId,
73
+ userId,
74
+ kind: "worker",
75
+ workerRole: req.workerRole ?? null,
76
+ parentSessionId: req.parentSessionId ?? null,
77
+ title: req.sessionTitle ?? null,
78
+ });
79
+ resumed = true;
80
+ }
81
+ catch (err) {
82
+ // eslint-disable-next-line no-console
83
+ console.warn(`[agent-loop] resumeSessionId=${req.resumeSessionId} not found; creating fresh session`, err instanceof Error ? err.message : err);
84
+ }
85
+ }
86
+ if (!session) {
87
+ session = await repo.create({
88
+ userId,
89
+ kind: "worker",
90
+ workerRole: req.workerRole ?? null,
91
+ parentSessionId: req.parentSessionId ?? null,
92
+ title: req.sessionTitle ?? null,
93
+ });
94
+ }
95
+ const sessionMeta = await session.getMetadata();
96
+ // Notify caller of the freshly-created session row so callers
97
+ // (e.g. the workboard plugin) can link long-running tasks to
98
+ // their session id before the LLM loop runs. We swallow errors
99
+ // because a misbehaving callback shouldn't abort the run.
100
+ if (req.onSessionStart) {
101
+ try {
102
+ req.onSessionStart(sessionMeta.id);
103
+ }
104
+ catch (err) {
105
+ // eslint-disable-next-line no-console
106
+ console.warn("[agent-loop] onSessionStart callback threw", err);
107
+ }
108
+ }
109
+ // Resolve model.
110
+ const modelInfo = (req.modelId ? findModel(ctx.config, req.modelId) : undefined) ??
111
+ getDefaultModel(ctx.config);
112
+ if (!modelInfo) {
113
+ return {
114
+ status: "error",
115
+ summary: "no model configured",
116
+ files: [],
117
+ sessionId: sessionMeta.id,
118
+ turns: 0,
119
+ reason: "exception",
120
+ };
121
+ }
122
+ const piModel = buildModel(modelInfo);
123
+ const apiKey = resolveApiKey(modelInfo);
124
+ // Tools + skills, narrowed by per-agent allow-lists then by an
125
+ // optional deny-list. The deny-list is for cases where the host
126
+ // wants to forbid certain tools regardless of what the agent's
127
+ // allow-list says — worker pools use it to scrub e.g. task_create
128
+ // out of an LLM worker so it can't accidentally manage other
129
+ // tasks while running its own.
130
+ //
131
+ // Refresh stale dynamic toolsets (Playwright MCP, user MCP
132
+ // servers) before snapshotting them. Without this, a worker
133
+ // session that starts before the plugin's initial refresh
134
+ // succeeds (sidecar still booting, or sandbox just reset)
135
+ // sees an empty MCP tool list for the entire run — the chat
136
+ // handler refreshes per turn but workers don't, so they were
137
+ // simply never seeing browser_* tools.
138
+ if (pluginRegistry) {
139
+ try {
140
+ await pluginRegistry.refreshStaleToolsets(ctx.tenantId, 1500);
141
+ }
142
+ catch (err) {
143
+ // refreshStaleToolsets swallows per-toolset errors itself;
144
+ // an outer throw is unexpected but shouldn't block the run.
145
+ console.warn(`[agent-loop] refreshStaleToolsets failed: ${err instanceof Error ? err.message : String(err)}`);
146
+ }
147
+ }
148
+ const allPluginTools = pluginRegistry?.toolsForTenant(ctx.tenantId) ?? [];
149
+ const allowSet = req.toolsAllow ? new Set(req.toolsAllow) : null;
150
+ const denySet = req.toolsDeny ? new Set(req.toolsDeny) : null;
151
+ const pluginTools = allPluginTools.filter(({ tool }) => {
152
+ const name = tool.schema.name;
153
+ if (allowSet && !allowSet.has(name))
154
+ return false;
155
+ if (denySet && denySet.has(name))
156
+ return false;
157
+ return true;
158
+ });
159
+ // Worker-scoped tenant skills: shared `_tenant/config/skills/`
160
+ // plus the per-worker layer at
161
+ // `_tenant/config/workers/<slug>/skills/`. We prefer `req.workerSlug`
162
+ // when present (matches the on-disk directory exactly); the
163
+ // workerKind fallback is for legacy callers that don't yet
164
+ // forward the slug.
165
+ const tenantWorkerScope = req.workerRole
166
+ ? {
167
+ kind: "worker",
168
+ workerKind: req.workerRole,
169
+ slug: req.workerSlug ?? undefined,
170
+ }
171
+ : { kind: "worker", workerKind: "" };
172
+ const allSkills = [
173
+ // mirrored = host + plugin skills, all carrying
174
+ // tenant-config:/// paths the worker's tenant_config_read can
175
+ // open. See registry.mirroredSkillsForTenant.
176
+ ...(pluginRegistry?.mirroredSkillsForTenant(ctx.tenantId) ?? []),
177
+ ...loadTenantSkills({
178
+ tenantId: ctx.tenantId,
179
+ scope: tenantWorkerScope,
180
+ onFailure: (f) => console.warn(`[tenant-skills:${f.scope}] ${f.filePath}: ${f.reason}`),
181
+ }),
182
+ ];
183
+ const declaredToolNames = new Set(pluginTools.map(({ tool }) => tool.schema.name));
184
+ const hostCaps = pluginRegistry?.hostCapabilities(ctx.tenantId) ?? {
185
+ get: () => undefined,
186
+ has: () => false,
187
+ };
188
+ // skillsAllow scopes only host + plugin skills (the kind that
189
+ // appear in `host.skillCatalog`, which is what the worker-agent
190
+ // ChipPicker is built from). Tenant skills don't participate in
191
+ // that catalog — they're discovered live from
192
+ // `_tenant/config/.../skills/` every turn. Letting allowlist
193
+ // filtering see them would silently hide every newly-dropped
194
+ // tenant skill until the user re-saves the worker_agent row,
195
+ // which is exactly the bug Yu hit (test-shared / test-llm gone
196
+ // from the worker's <available_skills>). So: tenant skills pass
197
+ // through unconditionally; if a user wants to hide one from a
198
+ // worker, they remove the skill directory.
199
+ const skillsAllowed = req.skillsAllow ? new Set(req.skillsAllow) : null;
200
+ const skills = filterSkillsForTenant(allSkills, {
201
+ hasTool: (n) => declaredToolNames.has(n),
202
+ hasCapability: (n) => hostCaps.has(n),
203
+ agentScope: "worker",
204
+ }).filter((s) => {
205
+ if (!skillsAllowed)
206
+ return true;
207
+ if (s.source.pluginId.startsWith("tenant-"))
208
+ return true;
209
+ return skillsAllowed.has(s.name);
210
+ });
211
+ // Create the inner abort controller before the toolset so we
212
+ // can pipe its signal into AgentToolContext. The signal lets
213
+ // long-running tools (microsandbox `exec`, MCP fetches) bail
214
+ // out the moment a watchdog timeout / external `task_abort`
215
+ // fires, instead of waiting for their own internal timeout.
216
+ // Without this, an aborted run still has to wait for the
217
+ // current tool call to drain, and the worker session shows
218
+ // 'busy' for up to that tool's timeout budget.
219
+ const innerCtl = new AbortController();
220
+ const onExternalAbort = () => innerCtl.abort();
221
+ externalSignal?.addEventListener("abort", onExternalAbort, { once: true });
222
+ const toolset = await buildToolset({
223
+ pluginTools,
224
+ toolContext: {
225
+ tenantId: ctx.tenantId,
226
+ userId,
227
+ capabilities: hostCaps,
228
+ userHomeDir: ctx.userHomeDir(userId),
229
+ tenantHomeDir: homeDir ?? "",
230
+ // Worker scope. `workerRole` is the worker_agent kind id
231
+ // (e.g. "llm"); `workerSlug` is the fs directory name. Drives
232
+ // `tenant_config_write` boundary so a worker can write under
233
+ // its own `workers/<slug>/skills/` (and read everything).
234
+ agentScope: req.workerRole
235
+ ? {
236
+ kind: "worker",
237
+ workerKind: req.workerRole,
238
+ slug: req.workerSlug ?? undefined,
239
+ }
240
+ : { kind: "main" },
241
+ log: {
242
+ info: (msg, meta) => console.log(`[agent-loop] ${msg}`, meta ?? ""),
243
+ warn: (msg, meta) => console.warn(`[agent-loop] ${msg}`, meta ?? ""),
244
+ error: (msg, meta) => console.error(`[agent-loop] ${msg}`, meta ?? ""),
245
+ },
246
+ // Worker session id — currently no worker tool needs this,
247
+ // but future plugins (e.g. a sub-task spawner) will, and
248
+ // it costs nothing to plumb through.
249
+ sessionId: sessionMeta.id,
250
+ // Optional task binding: lets per-task tools (microsandbox
251
+ // `exec`) scope resources to the task lifecycle.
252
+ taskId: req.taskId ?? undefined,
253
+ // Cancellation signal piped from the agent loop's inner
254
+ // abort controller. Tools that do long-running work
255
+ // (microsandbox `exec`, MCP) read this and bail when the
256
+ // run is aborted from the outside (`task_abort`, watchdog
257
+ // timeout, idle timeout).
258
+ signal: innerCtl.signal,
259
+ },
260
+ });
261
+ const adapted = adaptToolset(toolset);
262
+ // Plugin-contributed system prompt fragments (ADR-0006). Workers
263
+ // need these for the same reason main does: when a plugin ships a
264
+ // tool, the rules for using that tool live in the plugin manifest.
265
+ // Without this block, every worker re-derives "don't run a foreground
266
+ // server in exec", "call read_file before edit_file", etc., from its
267
+ // SOUL prompt — versions drift, and any plugin-update prompt fix
268
+ // misses workers entirely.
269
+ //
270
+ // ADR-0006 originally only wired the chat handler; the worker path
271
+ // here was deferred to a follow-up. ADR-0007 PR-B closes that gap.
272
+ // Filtering by `scope` (`main` | `worker` | `all`) is owned by the
273
+ // registry; this site asks for fragments and renders whatever it
274
+ // gets back. Workers can request a subset ("worker" only) once
275
+ // ADR-0006's `scope` field ships in PR-C; until then we render
276
+ // every contributed fragment, which matches main's behaviour.
277
+ const pluginFragments = pluginRegistry?.systemPromptFragmentsForTenant(ctx.tenantId) ?? [];
278
+ const fragmentBlock = formatPluginPromptFragments(pluginFragments);
279
+ // Two paths into the worker system prompt:
280
+ // * `req.systemPrompt` set — the worker_agent table provided a
281
+ // kind-specific SOUL-style prompt. Stitch:
282
+ // <SOUL>
283
+ // <plugin guidance fragments>
284
+ // <available skills>
285
+ // The order matters: SOUL is who-the-worker-is (highest
286
+ // priority), fragments are how-to-use-tools (lower than
287
+ // identity, higher than discoverable skills), skills are
288
+ // situational reference. Same ordering as `defaultSystemPrompt`
289
+ // for the main agent.
290
+ // * Otherwise fall back to the host default, which already
291
+ // includes both the fragment and skill blocks via
292
+ // `defaultSystemPrompt`.
293
+ let systemPrompt;
294
+ if (req.systemPrompt) {
295
+ // Worker SOUL path. Order:
296
+ // <SOUL> identity / who-the-worker-is
297
+ // <Execution Bias> host-level behaviour rules — same
298
+ // text the main agent gets, so a
299
+ // stalled-on-no-completion failure
300
+ // mode hits both paths uniformly.
301
+ // <Workspace Context> AGENTS.md / USER.md from the
302
+ // worker's user home (SOUL.md is
303
+ // already covered by req.systemPrompt;
304
+ // inject the rest so user prefs reach
305
+ // workers too).
306
+ // <plugin fragments> how-to-use-tools (lower than
307
+ // identity, higher than discoverable
308
+ // skills).
309
+ // <available skills> situational reference.
310
+ const skillBlock = formatAvailableSkillsBlock(skills);
311
+ const parts = [req.systemPrompt, formatExecutionBiasBlock()];
312
+ // Worker context: only the worker's own AGENTS.md / MEMORY.md
313
+ // bundle plus the caller's USER.md. SOUL.md is already in
314
+ // req.systemPrompt above; tenant-shared AGENTS/SOUL/MEMORY are
315
+ // explicitly NOT injected for workers — each worker has its
316
+ // own scoped working notes.
317
+ if (req.workerSlug) {
318
+ const ctxBlock = formatWorkerAgentContextBlock(ctx.workspaceDir, ctx.userHomeDir(userId), req.workerSlug);
319
+ if (ctxBlock)
320
+ parts.push(ctxBlock);
321
+ }
322
+ if (fragmentBlock)
323
+ parts.push(fragmentBlock);
324
+ if (skillBlock)
325
+ parts.push(skillBlock);
326
+ systemPrompt = parts.join("\n\n");
327
+ }
328
+ else {
329
+ systemPrompt = defaultSystemPrompt(ctx, userId, skills, pluginFragments);
330
+ }
331
+ // Bind `<self>` / `<userId>` placeholders in the assembled
332
+ // prompt to the worker's concrete userId. `defaultSystemPrompt`
333
+ // applies the same pass internally; we repeat it here for the
334
+ // worker-SOUL path because that branch builds the prompt
335
+ // manually rather than going through defaultSystemPrompt.
336
+ // Idempotent and cheap, so double-application is harmless.
337
+ systemPrompt = substituteUserIdPlaceholders(systemPrompt, userId);
338
+ // Off-by-default debug dump (see `dump-system-prompt.ts`). Slug
339
+ // tag uses workerSlug when present, falling back to the role kind
340
+ // ("llm", etc.) and finally to a generic "worker" so callers
341
+ // without a slug still produce a stable filename.
342
+ dumpSystemPrompt({
343
+ ctx,
344
+ role: `worker:${req.workerSlug ?? req.workerRole ?? "unknown"}`,
345
+ userId,
346
+ systemPrompt,
347
+ });
348
+ const firstResponseMs = req.timeouts?.firstResponseMs ?? DEFAULT_FIRST_RESPONSE_MS;
349
+ const idleMs = req.timeouts?.idleMs ?? DEFAULT_IDLE_MS;
350
+ const maxRunMs = req.timeouts?.maxRunMs ?? DEFAULT_MAX_RUN_MS;
351
+ const startedAt = Date.now();
352
+ let lastEventAt = startedAt;
353
+ let sawAnyEvent = false;
354
+ let assistantTurns = 0;
355
+ let timedOutReason = null;
356
+ const completionSink = {};
357
+ // (innerCtl created earlier so AgentToolContext.signal can
358
+ // reference it; the watchdog below still drives it.)
359
+ const TICK_MS = 100;
360
+ const watchdog = setInterval(() => {
361
+ const now = Date.now();
362
+ if (!sawAnyEvent &&
363
+ firstResponseMs > 0 &&
364
+ now - startedAt >= firstResponseMs) {
365
+ timedOutReason = "first_response_timeout";
366
+ innerCtl.abort();
367
+ return;
368
+ }
369
+ if (sawAnyEvent && idleMs > 0 && now - lastEventAt >= idleMs) {
370
+ timedOutReason = "idle_timeout";
371
+ innerCtl.abort();
372
+ return;
373
+ }
374
+ if (maxRunMs > 0 && now - startedAt >= maxRunMs) {
375
+ timedOutReason = "max_run_timeout";
376
+ innerCtl.abort();
377
+ return;
378
+ }
379
+ }, TICK_MS);
380
+ const harness = new AgentHarness({
381
+ env: makeStubExecutionEnv(homeDir ?? ctx.userHomeDir(userId)),
382
+ session,
383
+ tools: adapted.tools,
384
+ systemPrompt,
385
+ model: piModel,
386
+ getApiKeyAndHeaders: async () => ({ apiKey }),
387
+ });
388
+ // Watch harness events for two purposes:
389
+ // 1. Reset the watchdog whenever something happens (timestamps
390
+ // drive first-response / idle timeouts below).
391
+ // 2. Detect task_complete tool calls and copy their args into
392
+ // completionSink so the post-run code can resolve `done`.
393
+ // We also count assistant turns so the result row reports a
394
+ // useful number, but no turn-based abort happens — see the note
395
+ // on the constants block.
396
+ // Heartbeat + turn counter on the broadcast channel. `subscribe`
397
+ // delivers anything the harness `emitAny`/`emitOwn`s; we use it
398
+ // for watchdog-resetting and counting assistant turns. The
399
+ // `tool_result` hook below is on a SEPARATE channel — see comment.
400
+ // Reentrancy guard for the auto-compact path. compact() runs
401
+ // its own LLM call (= more turn_end events emitted while we're
402
+ // mid-compaction). Without the guard those nested events would
403
+ // re-trigger compact() forever; see also handler.ts where the
404
+ // chat path is naturally serial because the turn loop drains
405
+ // before the next turn_end fires.
406
+ let compactInFlight = false;
407
+ const unsubscribe = harness.subscribe((event) => {
408
+ lastEventAt = Date.now();
409
+ sawAnyEvent = true;
410
+ if (event.type === "turn_end") {
411
+ assistantTurns += 1;
412
+ // Auto-compact for workers: fire-and-forget after every
413
+ // assistant turn. Same threshold as the chat path; the
414
+ // worker had been stalling on no_completion when a single
415
+ // task accumulated >70% of the model's context window
416
+ // (e.g. a research worker reading 5 large source files).
417
+ // We reach for compact ASAP rather than waiting for the
418
+ // next prompt because the worker is autonomously chaining
419
+ // turns — if we let context grow until the next call, the
420
+ // call itself fails.
421
+ if (!compactInFlight && modelInfo.contextWindow) {
422
+ compactInFlight = true;
423
+ void (async () => {
424
+ try {
425
+ const r = await tryAutoCompact({
426
+ piSession: session,
427
+ harness,
428
+ contextWindow: modelInfo.contextWindow,
429
+ });
430
+ if (r.compacted) {
431
+ console.log(`[agent-loop] worker auto-compact ran (tokensBefore=${r.tokensBefore})`);
432
+ }
433
+ else if (r.error) {
434
+ console.warn(`[agent-loop] worker auto-compact failed: ${r.error}`);
435
+ }
436
+ }
437
+ finally {
438
+ compactInFlight = false;
439
+ }
440
+ })();
441
+ }
442
+ }
443
+ });
444
+ // Detect task_complete tool calls and capture the agent's args
445
+ // into completionSink so the post-run code can resolve `done`.
446
+ //
447
+ // IMPORTANT: tool_result is dispatched via `emitHook` (the
448
+ // hook channel) and NOT via `emitAny` (the subscribe channel).
449
+ // pi-agent-core's `harness.subscribe(...)` listener never sees
450
+ // tool_result events — only `harness.on("tool_result", ...)`
451
+ // does. We learned this the hard way: a successful task_complete
452
+ // call would land in the DB but `completionSink.summary` stayed
453
+ // undefined, the run terminated as `no_completion`, and the
454
+ // pool re-queued the task forever.
455
+ const unhookToolResult = harness.on("tool_result", (e) => {
456
+ if (e.toolName !== TASK_COMPLETE_TOOL)
457
+ return;
458
+ const input = e.input;
459
+ if (typeof input.summary === "string") {
460
+ completionSink.summary = input.summary;
461
+ }
462
+ if (Array.isArray(input.files)) {
463
+ completionSink.files = input.files.filter((x) => typeof x === "string");
464
+ }
465
+ // Also bump the watchdog — a tool_result counts as activity.
466
+ lastEventAt = Date.now();
467
+ sawAnyEvent = true;
468
+ return undefined;
469
+ });
470
+ let result;
471
+ try {
472
+ // Wire the abort signal: when innerCtl aborts (timeout / turn
473
+ // cap / external), tell the harness.
474
+ const onAbort = () => void harness.abort();
475
+ innerCtl.signal.addEventListener("abort", onAbort, { once: true });
476
+ await harness.prompt(initialUserMessage);
477
+ await harness.waitForIdle();
478
+ if (timedOutReason) {
479
+ result = {
480
+ status: "error",
481
+ summary: timeoutMessage(timedOutReason, {
482
+ firstResponseMs,
483
+ idleMs,
484
+ maxRunMs,
485
+ }),
486
+ files: [],
487
+ sessionId: sessionMeta.id,
488
+ turns: assistantTurns,
489
+ reason: timedOutReason,
490
+ };
491
+ }
492
+ else if (externalSignal?.aborted) {
493
+ result = {
494
+ status: "aborted",
495
+ summary: "aborted by caller",
496
+ files: [],
497
+ sessionId: sessionMeta.id,
498
+ turns: assistantTurns,
499
+ reason: "aborted",
500
+ };
501
+ }
502
+ else if (completionSink.summary !== undefined) {
503
+ result = {
504
+ status: "done",
505
+ summary: completionSink.summary,
506
+ files: completionSink.files ?? [],
507
+ sessionId: sessionMeta.id,
508
+ turns: assistantTurns,
509
+ reason: "task_complete",
510
+ };
511
+ }
512
+ else {
513
+ // Loop ended without task_complete and without hitting any
514
+ // timeout — treat as stalled with whatever the LLM said last
515
+ // (best-effort reading from session). This used to be the
516
+ // "max_turns" branch when the worker capped turns; now it's
517
+ // the only "agent quietly gave up" path.
518
+ const finalText = await lastAssistantText(session);
519
+ result = {
520
+ status: "stalled",
521
+ summary: finalText || "agent stopped without calling task_complete",
522
+ files: [],
523
+ sessionId: sessionMeta.id,
524
+ turns: assistantTurns,
525
+ reason: "no_completion",
526
+ };
527
+ }
528
+ }
529
+ catch (err) {
530
+ if (timedOutReason) {
531
+ result = {
532
+ status: "error",
533
+ summary: timeoutMessage(timedOutReason, {
534
+ firstResponseMs,
535
+ idleMs,
536
+ maxRunMs,
537
+ }),
538
+ files: [],
539
+ sessionId: sessionMeta.id,
540
+ turns: assistantTurns,
541
+ reason: timedOutReason,
542
+ };
543
+ }
544
+ else {
545
+ result = {
546
+ status: "error",
547
+ summary: err instanceof Error ? err.message : String(err),
548
+ files: [],
549
+ sessionId: sessionMeta.id,
550
+ turns: assistantTurns,
551
+ reason: "exception",
552
+ };
553
+ }
554
+ }
555
+ finally {
556
+ clearInterval(watchdog);
557
+ unsubscribe();
558
+ unhookToolResult();
559
+ externalSignal?.removeEventListener("abort", onExternalAbort);
560
+ // Mark the worker session archived so admin tooling stops
561
+ // showing it as active.
562
+ ctx.db
563
+ .prepare(`UPDATE sessions SET status = 'archived', ended_at = ? WHERE id = ?`)
564
+ .run(Date.now(), sessionMeta.id);
565
+ }
566
+ return result;
567
+ }
568
+ async function lastAssistantText(session) {
569
+ const entries = await session.getEntries();
570
+ for (let i = entries.length - 1; i >= 0; i--) {
571
+ const e = entries[i];
572
+ if (e.type !== "message")
573
+ continue;
574
+ const m = e.message;
575
+ if (m.role !== "assistant")
576
+ continue;
577
+ for (const block of m.content) {
578
+ if (block.type === "text" && typeof block.text === "string") {
579
+ return block.text.trim();
580
+ }
581
+ }
582
+ }
583
+ return "";
584
+ }
585
+ function timeoutMessage(reason, budgets) {
586
+ if (reason === "first_response_timeout") {
587
+ return `LLM did not respond within ${Math.round(budgets.firstResponseMs / 1000)}s`;
588
+ }
589
+ if (reason === "idle_timeout") {
590
+ return `no stream events for ${Math.round(budgets.idleMs / 1000)}s`;
591
+ }
592
+ if (reason === "max_run_timeout") {
593
+ return `worker exceeded max-run budget (${Math.round(budgets.maxRunMs / 1000)}s)`;
594
+ }
595
+ return "timeout";
596
+ }
597
+ //# sourceMappingURL=agent-loop.js.map
@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AC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC7C,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAE,CAAC;QACtB,IAAI,CAAC,CAAC,IAAI,KAAK,SAAS;YAAE,SAAS;QACnC,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC;QACpB,IAAI,CAAC,CAAC,IAAI,KAAK,WAAW;YAAE,SAAS;QACrC,KAAK,MAAM,KAAK,IAAI,CAAC,CAAC,OAAiD,EAAE,CAAC;YACxE,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;gBAC5D,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YAC3B,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,SAAS,cAAc,CACrB,MAAiC,EACjC,OAAsE;IAEtE,IAAI,MAAM,KAAK,wBAAwB,EAAE,CAAC;QACxC,OAAO,8BAA8B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,GAAG,CAAC;IACrF,CAAC;IACD,IAAI,MAAM,KAAK,cAAc,EAAE,CAAC;QAC9B,OAAO,wBAAwB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC;IACtE,CAAC;IACD,IAAI,MAAM,KAAK,iBAAiB,EAAE,CAAC;QACjC,OAAO,mCAAmC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC;IACpF,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -0,0 +1,33 @@
1
+ import type { AgentTool as PiAgentTool } from "@earendil-works/pi-agent-core";
2
+ import type { Toolset } from "../tools/index.js";
3
+ export interface AnyToolResult {
4
+ ok: boolean;
5
+ text: string;
6
+ }
7
+ /**
8
+ * Normalise an executor's structured return value to `{ ok, text }`.
9
+ * Two shapes are accepted:
10
+ *
11
+ * 1. Fs-style: `{ ok: boolean, text: string, ...extras }` — used
12
+ * as-is.
13
+ * 2. Anything else: JSON-encoded into `text`. `ok` is derived
14
+ * from common hints (`ok`, `exit_code`, `state`) and defaults
15
+ * to true when there's no clear signal.
16
+ *
17
+ * Lives in the adapter file because it's the only consumer now
18
+ * that the host's chat handler runs through pi-agent-core.
19
+ */
20
+ export declare function normaliseToolResult(out: unknown): AnyToolResult;
21
+ export interface AdaptedToolset {
22
+ /** pi-agent-core tools, ready to drop into AgentContext.tools. */
23
+ tools: PiAgentTool[];
24
+ /** Tool name → original plugin executor. Useful when the host
25
+ * needs to peek (e.g. agent-loop's task_complete capture). */
26
+ executors: Toolset["executors"];
27
+ }
28
+ export declare function adaptToolset(toolset: Toolset): AdaptedToolset;
29
+ /** Helper for the surrounding agent run: detect whether a finished
30
+ * AgentToolResult came from a `{ ok:false }` plugin return, so
31
+ * pi-agent's `afterToolCall` can mark it as an error to the LLM. */
32
+ export declare function isAdapterError(result: unknown): boolean;
33
+ //# sourceMappingURL=agent-tool-adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-tool-adapter.d.ts","sourceRoot":"","sources":["../../src/chat/agent-tool-adapter.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EACV,SAAS,IAAI,WAAW,EAEzB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,OAAO,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,aAAa,CAoB/D;AAED,MAAM,WAAW,cAAc;IAC7B,kEAAkE;IAClE,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB;mEAC+D;IAC/D,SAAS,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;CACjC;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,cAAc,CAiG7D;AAED;;qEAEqE;AACrE,wBAAgB,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAIvD"}