@hold-rein/cli 0.0.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 (420) hide show
  1. package/dist/cli.js +3 -0
  2. package/dist/cli.js.map +1 -0
  3. package/dist/index.js +139 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist/runtime/api/app.d.ts +7 -0
  6. package/dist/runtime/api/app.d.ts.map +1 -0
  7. package/dist/runtime/api/app.js +41 -0
  8. package/dist/runtime/api/config/const.d.ts +8 -0
  9. package/dist/runtime/api/config/const.d.ts.map +1 -0
  10. package/dist/runtime/api/config/const.js +9 -0
  11. package/dist/runtime/api/config/env.d.ts +10 -0
  12. package/dist/runtime/api/config/env.d.ts.map +1 -0
  13. package/dist/runtime/api/config/env.js +32 -0
  14. package/dist/runtime/api/db/connection.d.ts +11 -0
  15. package/dist/runtime/api/db/connection.d.ts.map +1 -0
  16. package/dist/runtime/api/db/connection.js +21 -0
  17. package/dist/runtime/api/db/index.d.ts +4 -0
  18. package/dist/runtime/api/db/index.d.ts.map +1 -0
  19. package/dist/runtime/api/db/index.js +3 -0
  20. package/dist/runtime/api/db/migrate.d.ts +4 -0
  21. package/dist/runtime/api/db/migrate.d.ts.map +1 -0
  22. package/dist/runtime/api/db/migrate.js +308 -0
  23. package/dist/runtime/api/db/schema.d.ts +1610 -0
  24. package/dist/runtime/api/db/schema.d.ts.map +1 -0
  25. package/dist/runtime/api/db/schema.js +148 -0
  26. package/dist/runtime/api/middleware/error-middleware.d.ts +3 -0
  27. package/dist/runtime/api/middleware/error-middleware.d.ts.map +1 -0
  28. package/dist/runtime/api/middleware/error-middleware.js +5 -0
  29. package/dist/runtime/api/middleware/not-found-middleware.d.ts +3 -0
  30. package/dist/runtime/api/middleware/not-found-middleware.d.ts.map +1 -0
  31. package/dist/runtime/api/middleware/not-found-middleware.js +4 -0
  32. package/dist/runtime/api/modules/agents/active-task-run-registry.d.ts +10 -0
  33. package/dist/runtime/api/modules/agents/active-task-run-registry.d.ts.map +1 -0
  34. package/dist/runtime/api/modules/agents/active-task-run-registry.js +20 -0
  35. package/dist/runtime/api/modules/agents/agent-approval-store.d.ts +7 -0
  36. package/dist/runtime/api/modules/agents/agent-approval-store.d.ts.map +1 -0
  37. package/dist/runtime/api/modules/agents/agent-approval-store.js +23 -0
  38. package/dist/runtime/api/modules/agents/agent-event-bus.d.ts +8 -0
  39. package/dist/runtime/api/modules/agents/agent-event-bus.d.ts.map +1 -0
  40. package/dist/runtime/api/modules/agents/agent-event-bus.js +40 -0
  41. package/dist/runtime/api/modules/agents/agent-message-repository.d.ts +22 -0
  42. package/dist/runtime/api/modules/agents/agent-message-repository.d.ts.map +1 -0
  43. package/dist/runtime/api/modules/agents/agent-message-repository.js +60 -0
  44. package/dist/runtime/api/modules/agents/agent-message-storage.d.ts +4 -0
  45. package/dist/runtime/api/modules/agents/agent-message-storage.d.ts.map +1 -0
  46. package/dist/runtime/api/modules/agents/agent-message-storage.js +11 -0
  47. package/dist/runtime/api/modules/agents/agent-model-resolver.d.ts +4 -0
  48. package/dist/runtime/api/modules/agents/agent-model-resolver.d.ts.map +1 -0
  49. package/dist/runtime/api/modules/agents/agent-model-resolver.js +17 -0
  50. package/dist/runtime/api/modules/agents/agent-runtime-messages.d.ts +12 -0
  51. package/dist/runtime/api/modules/agents/agent-runtime-messages.d.ts.map +1 -0
  52. package/dist/runtime/api/modules/agents/agent-runtime-messages.js +19 -0
  53. package/dist/runtime/api/modules/agents/agent-runtime-support.d.ts +12 -0
  54. package/dist/runtime/api/modules/agents/agent-runtime-support.d.ts.map +1 -0
  55. package/dist/runtime/api/modules/agents/agent-runtime-support.js +38 -0
  56. package/dist/runtime/api/modules/agents/agent-runtime.d.ts +25 -0
  57. package/dist/runtime/api/modules/agents/agent-runtime.d.ts.map +1 -0
  58. package/dist/runtime/api/modules/agents/agent-runtime.js +371 -0
  59. package/dist/runtime/api/modules/agents/agent-subagents.d.ts +32 -0
  60. package/dist/runtime/api/modules/agents/agent-subagents.d.ts.map +1 -0
  61. package/dist/runtime/api/modules/agents/agent-subagents.js +65 -0
  62. package/dist/runtime/api/modules/agents/agent-task-actions.d.ts +9 -0
  63. package/dist/runtime/api/modules/agents/agent-task-actions.d.ts.map +1 -0
  64. package/dist/runtime/api/modules/agents/agent-task-actions.js +33 -0
  65. package/dist/runtime/api/modules/agents/agent-task-title-generator.d.ts +15 -0
  66. package/dist/runtime/api/modules/agents/agent-task-title-generator.d.ts.map +1 -0
  67. package/dist/runtime/api/modules/agents/agent-task-title-generator.js +61 -0
  68. package/dist/runtime/api/modules/agents/agent-tool-approval.d.ts +12 -0
  69. package/dist/runtime/api/modules/agents/agent-tool-approval.d.ts.map +1 -0
  70. package/dist/runtime/api/modules/agents/agent-tool-approval.js +40 -0
  71. package/dist/runtime/api/modules/agents/agent-types.d.ts +198 -0
  72. package/dist/runtime/api/modules/agents/agent-types.d.ts.map +1 -0
  73. package/dist/runtime/api/modules/agents/agent-types.js +1 -0
  74. package/dist/runtime/api/modules/agents/agents-router.d.ts +7 -0
  75. package/dist/runtime/api/modules/agents/agents-router.d.ts.map +1 -0
  76. package/dist/runtime/api/modules/agents/agents-router.js +210 -0
  77. package/dist/runtime/api/modules/agents/agents-service.d.ts +52 -0
  78. package/dist/runtime/api/modules/agents/agents-service.d.ts.map +1 -0
  79. package/dist/runtime/api/modules/agents/agents-service.js +282 -0
  80. package/dist/runtime/api/modules/agents/approval/store.d.ts +7 -0
  81. package/dist/runtime/api/modules/agents/approval/store.d.ts.map +1 -0
  82. package/dist/runtime/api/modules/agents/approval/store.js +23 -0
  83. package/dist/runtime/api/modules/agents/approval/tool-approval.d.ts +14 -0
  84. package/dist/runtime/api/modules/agents/approval/tool-approval.d.ts.map +1 -0
  85. package/dist/runtime/api/modules/agents/approval/tool-approval.js +43 -0
  86. package/dist/runtime/api/modules/agents/custom-agent-model.d.ts +16 -0
  87. package/dist/runtime/api/modules/agents/custom-agent-model.d.ts.map +1 -0
  88. package/dist/runtime/api/modules/agents/custom-agent-model.js +21 -0
  89. package/dist/runtime/api/modules/agents/default-agents-service.d.ts +3 -0
  90. package/dist/runtime/api/modules/agents/default-agents-service.d.ts.map +1 -0
  91. package/dist/runtime/api/modules/agents/default-agents-service.js +52 -0
  92. package/dist/runtime/api/modules/agents/event/event-bus.d.ts +8 -0
  93. package/dist/runtime/api/modules/agents/event/event-bus.d.ts.map +1 -0
  94. package/dist/runtime/api/modules/agents/event/event-bus.js +40 -0
  95. package/dist/runtime/api/modules/agents/index.d.ts +11 -0
  96. package/dist/runtime/api/modules/agents/index.d.ts.map +1 -0
  97. package/dist/runtime/api/modules/agents/index.js +9 -0
  98. package/dist/runtime/api/modules/agents/message/storage.d.ts +4 -0
  99. package/dist/runtime/api/modules/agents/message/storage.d.ts.map +1 -0
  100. package/dist/runtime/api/modules/agents/message/storage.js +11 -0
  101. package/dist/runtime/api/modules/agents/model/custom-model.d.ts +16 -0
  102. package/dist/runtime/api/modules/agents/model/custom-model.d.ts.map +1 -0
  103. package/dist/runtime/api/modules/agents/model/custom-model.js +21 -0
  104. package/dist/runtime/api/modules/agents/model/resolver.d.ts +4 -0
  105. package/dist/runtime/api/modules/agents/model/resolver.d.ts.map +1 -0
  106. package/dist/runtime/api/modules/agents/model/resolver.js +17 -0
  107. package/dist/runtime/api/modules/agents/router/browser-tool-result.d.ts +8 -0
  108. package/dist/runtime/api/modules/agents/router/browser-tool-result.d.ts.map +1 -0
  109. package/dist/runtime/api/modules/agents/router/browser-tool-result.js +35 -0
  110. package/dist/runtime/api/modules/agents/router/index.d.ts +10 -0
  111. package/dist/runtime/api/modules/agents/router/index.d.ts.map +1 -0
  112. package/dist/runtime/api/modules/agents/router/index.js +210 -0
  113. package/dist/runtime/api/modules/agents/router/request-parsing.d.ts +24 -0
  114. package/dist/runtime/api/modules/agents/router/request-parsing.d.ts.map +1 -0
  115. package/dist/runtime/api/modules/agents/router/request-parsing.js +78 -0
  116. package/dist/runtime/api/modules/agents/runtime/browser-runtime-contributions.d.ts +5 -0
  117. package/dist/runtime/api/modules/agents/runtime/browser-runtime-contributions.d.ts.map +1 -0
  118. package/dist/runtime/api/modules/agents/runtime/browser-runtime-contributions.js +115 -0
  119. package/dist/runtime/api/modules/agents/runtime/browser-runtime-tools.d.ts +13 -0
  120. package/dist/runtime/api/modules/agents/runtime/browser-runtime-tools.d.ts.map +1 -0
  121. package/dist/runtime/api/modules/agents/runtime/browser-runtime-tools.js +31 -0
  122. package/dist/runtime/api/modules/agents/runtime/browser-tool-call-store.d.ts +21 -0
  123. package/dist/runtime/api/modules/agents/runtime/browser-tool-call-store.d.ts.map +1 -0
  124. package/dist/runtime/api/modules/agents/runtime/browser-tool-call-store.js +69 -0
  125. package/dist/runtime/api/modules/agents/runtime/continuation-subagent.d.ts +26 -0
  126. package/dist/runtime/api/modules/agents/runtime/continuation-subagent.d.ts.map +1 -0
  127. package/dist/runtime/api/modules/agents/runtime/continuation-subagent.js +67 -0
  128. package/dist/runtime/api/modules/agents/runtime/index.d.ts +3 -0
  129. package/dist/runtime/api/modules/agents/runtime/index.d.ts.map +1 -0
  130. package/dist/runtime/api/modules/agents/runtime/index.js +432 -0
  131. package/dist/runtime/api/modules/agents/runtime/messages.d.ts +12 -0
  132. package/dist/runtime/api/modules/agents/runtime/messages.d.ts.map +1 -0
  133. package/dist/runtime/api/modules/agents/runtime/messages.js +19 -0
  134. package/dist/runtime/api/modules/agents/runtime/subagent-results.d.ts +22 -0
  135. package/dist/runtime/api/modules/agents/runtime/subagent-results.d.ts.map +1 -0
  136. package/dist/runtime/api/modules/agents/runtime/subagent-results.js +39 -0
  137. package/dist/runtime/api/modules/agents/runtime/subagent-tools.d.ts +49 -0
  138. package/dist/runtime/api/modules/agents/runtime/subagent-tools.d.ts.map +1 -0
  139. package/dist/runtime/api/modules/agents/runtime/subagent-tools.js +195 -0
  140. package/dist/runtime/api/modules/agents/runtime/support.d.ts +19 -0
  141. package/dist/runtime/api/modules/agents/runtime/support.d.ts.map +1 -0
  142. package/dist/runtime/api/modules/agents/runtime/support.js +106 -0
  143. package/dist/runtime/api/modules/agents/runtime/token-collection.d.ts +28 -0
  144. package/dist/runtime/api/modules/agents/runtime/token-collection.d.ts.map +1 -0
  145. package/dist/runtime/api/modules/agents/runtime/token-collection.js +131 -0
  146. package/dist/runtime/api/modules/agents/runtime/token-usage-sync.d.ts +15 -0
  147. package/dist/runtime/api/modules/agents/runtime/token-usage-sync.d.ts.map +1 -0
  148. package/dist/runtime/api/modules/agents/runtime/token-usage-sync.js +46 -0
  149. package/dist/runtime/api/modules/agents/runtime/type.d.ts +62 -0
  150. package/dist/runtime/api/modules/agents/runtime/type.d.ts.map +1 -0
  151. package/dist/runtime/api/modules/agents/runtime/type.js +1 -0
  152. package/dist/runtime/api/modules/agents/runtime/workspace-agent-instructions.d.ts +3 -0
  153. package/dist/runtime/api/modules/agents/runtime/workspace-agent-instructions.d.ts.map +1 -0
  154. package/dist/runtime/api/modules/agents/runtime/workspace-agent-instructions.js +31 -0
  155. package/dist/runtime/api/modules/agents/service/default.d.ts +3 -0
  156. package/dist/runtime/api/modules/agents/service/default.d.ts.map +1 -0
  157. package/dist/runtime/api/modules/agents/service/default.js +65 -0
  158. package/dist/runtime/api/modules/agents/service/index.d.ts +56 -0
  159. package/dist/runtime/api/modules/agents/service/index.d.ts.map +1 -0
  160. package/dist/runtime/api/modules/agents/service/index.js +296 -0
  161. package/dist/runtime/api/modules/agents/service/interrupt-task.d.ts +14 -0
  162. package/dist/runtime/api/modules/agents/service/interrupt-task.d.ts.map +1 -0
  163. package/dist/runtime/api/modules/agents/service/interrupt-task.js +34 -0
  164. package/dist/runtime/api/modules/agents/service/startup-recovery.d.ts +14 -0
  165. package/dist/runtime/api/modules/agents/service/startup-recovery.d.ts.map +1 -0
  166. package/dist/runtime/api/modules/agents/service/startup-recovery.js +15 -0
  167. package/dist/runtime/api/modules/agents/shell-command-risk.d.ts +3 -0
  168. package/dist/runtime/api/modules/agents/shell-command-risk.d.ts.map +1 -0
  169. package/dist/runtime/api/modules/agents/shell-command-risk.js +24 -0
  170. package/dist/runtime/api/modules/agents/shell-exec-tool.d.ts +4 -0
  171. package/dist/runtime/api/modules/agents/shell-exec-tool.d.ts.map +1 -0
  172. package/dist/runtime/api/modules/agents/shell-exec-tool.js +71 -0
  173. package/dist/runtime/api/modules/agents/subagent/index.d.ts +45 -0
  174. package/dist/runtime/api/modules/agents/subagent/index.d.ts.map +1 -0
  175. package/dist/runtime/api/modules/agents/subagent/index.js +143 -0
  176. package/dist/runtime/api/modules/agents/subagent/lifecycle.d.ts +13 -0
  177. package/dist/runtime/api/modules/agents/subagent/lifecycle.d.ts.map +1 -0
  178. package/dist/runtime/api/modules/agents/subagent/lifecycle.js +36 -0
  179. package/dist/runtime/api/modules/agents/subagent/repository.d.ts +12 -0
  180. package/dist/runtime/api/modules/agents/subagent/repository.d.ts.map +1 -0
  181. package/dist/runtime/api/modules/agents/subagent/repository.js +93 -0
  182. package/dist/runtime/api/modules/agents/subagent-repository.d.ts +11 -0
  183. package/dist/runtime/api/modules/agents/subagent-repository.d.ts.map +1 -0
  184. package/dist/runtime/api/modules/agents/subagent-repository.js +65 -0
  185. package/dist/runtime/api/modules/agents/task/actions.d.ts +10 -0
  186. package/dist/runtime/api/modules/agents/task/actions.d.ts.map +1 -0
  187. package/dist/runtime/api/modules/agents/task/actions.js +37 -0
  188. package/dist/runtime/api/modules/agents/task/active-run-registry.d.ts +10 -0
  189. package/dist/runtime/api/modules/agents/task/active-run-registry.d.ts.map +1 -0
  190. package/dist/runtime/api/modules/agents/task/active-run-registry.js +20 -0
  191. package/dist/runtime/api/modules/agents/task/run-monitor.d.ts +14 -0
  192. package/dist/runtime/api/modules/agents/task/run-monitor.d.ts.map +1 -0
  193. package/dist/runtime/api/modules/agents/task/run-monitor.js +42 -0
  194. package/dist/runtime/api/modules/agents/task/title-generator.d.ts +15 -0
  195. package/dist/runtime/api/modules/agents/task/title-generator.d.ts.map +1 -0
  196. package/dist/runtime/api/modules/agents/task/title-generator.js +61 -0
  197. package/dist/runtime/api/modules/agents/task-run-monitor.d.ts +14 -0
  198. package/dist/runtime/api/modules/agents/task-run-monitor.d.ts.map +1 -0
  199. package/dist/runtime/api/modules/agents/task-run-monitor.js +42 -0
  200. package/dist/runtime/api/modules/file-system/file-system-router.d.ts +6 -0
  201. package/dist/runtime/api/modules/file-system/file-system-router.d.ts.map +1 -0
  202. package/dist/runtime/api/modules/file-system/file-system-router.js +119 -0
  203. package/dist/runtime/api/modules/file-system/file-system-service.d.ts +30 -0
  204. package/dist/runtime/api/modules/file-system/file-system-service.d.ts.map +1 -0
  205. package/dist/runtime/api/modules/file-system/file-system-service.js +209 -0
  206. package/dist/runtime/api/modules/file-system/index.d.ts +4 -0
  207. package/dist/runtime/api/modules/file-system/index.d.ts.map +1 -0
  208. package/dist/runtime/api/modules/file-system/index.js +1 -0
  209. package/dist/runtime/api/modules/health/health-router.d.ts +3 -0
  210. package/dist/runtime/api/modules/health/health-router.d.ts.map +1 -0
  211. package/dist/runtime/api/modules/health/health-router.js +10 -0
  212. package/dist/runtime/api/modules/health/index.d.ts +2 -0
  213. package/dist/runtime/api/modules/health/index.d.ts.map +1 -0
  214. package/dist/runtime/api/modules/health/index.js +1 -0
  215. package/dist/runtime/api/modules/model-providers/default-model-provider-service.d.ts +3 -0
  216. package/dist/runtime/api/modules/model-providers/default-model-provider-service.d.ts.map +1 -0
  217. package/dist/runtime/api/modules/model-providers/default-model-provider-service.js +21 -0
  218. package/dist/runtime/api/modules/model-providers/index.d.ts +5 -0
  219. package/dist/runtime/api/modules/model-providers/index.d.ts.map +1 -0
  220. package/dist/runtime/api/modules/model-providers/index.js +4 -0
  221. package/dist/runtime/api/modules/model-providers/model-provider-api-key-crypto.d.ts +8 -0
  222. package/dist/runtime/api/modules/model-providers/model-provider-api-key-crypto.d.ts.map +1 -0
  223. package/dist/runtime/api/modules/model-providers/model-provider-api-key-crypto.js +35 -0
  224. package/dist/runtime/api/modules/model-providers/model-provider-repository.d.ts +51 -0
  225. package/dist/runtime/api/modules/model-providers/model-provider-repository.d.ts.map +1 -0
  226. package/dist/runtime/api/modules/model-providers/model-provider-repository.js +314 -0
  227. package/dist/runtime/api/modules/model-providers/model-providers-router.d.ts +9 -0
  228. package/dist/runtime/api/modules/model-providers/model-providers-router.d.ts.map +1 -0
  229. package/dist/runtime/api/modules/model-providers/model-providers-router.js +188 -0
  230. package/dist/runtime/api/modules/model-providers/model-providers-service.d.ts +52 -0
  231. package/dist/runtime/api/modules/model-providers/model-providers-service.d.ts.map +1 -0
  232. package/dist/runtime/api/modules/model-providers/model-providers-service.js +239 -0
  233. package/dist/runtime/api/modules/model-proxies/default-model-proxies-service.d.ts +3 -0
  234. package/dist/runtime/api/modules/model-proxies/default-model-proxies-service.d.ts.map +1 -0
  235. package/dist/runtime/api/modules/model-proxies/default-model-proxies-service.js +22 -0
  236. package/dist/runtime/api/modules/model-proxies/index.d.ts +5 -0
  237. package/dist/runtime/api/modules/model-proxies/index.d.ts.map +1 -0
  238. package/dist/runtime/api/modules/model-proxies/index.js +4 -0
  239. package/dist/runtime/api/modules/model-proxies/model-proxies-router.d.ts +7 -0
  240. package/dist/runtime/api/modules/model-proxies/model-proxies-router.d.ts.map +1 -0
  241. package/dist/runtime/api/modules/model-proxies/model-proxies-router.js +55 -0
  242. package/dist/runtime/api/modules/model-proxies/model-proxies-service.d.ts +26 -0
  243. package/dist/runtime/api/modules/model-proxies/model-proxies-service.d.ts.map +1 -0
  244. package/dist/runtime/api/modules/model-proxies/model-proxies-service.js +107 -0
  245. package/dist/runtime/api/modules/model-proxies/model-proxy-repository.d.ts +39 -0
  246. package/dist/runtime/api/modules/model-proxies/model-proxy-repository.d.ts.map +1 -0
  247. package/dist/runtime/api/modules/model-proxies/model-proxy-repository.js +146 -0
  248. package/dist/runtime/api/modules/model-proxies/model-proxy-runtime.d.ts +20 -0
  249. package/dist/runtime/api/modules/model-proxies/model-proxy-runtime.d.ts.map +1 -0
  250. package/dist/runtime/api/modules/model-proxies/model-proxy-runtime.js +45 -0
  251. package/dist/runtime/api/modules/plugins/plugins-router.d.ts +7 -0
  252. package/dist/runtime/api/modules/plugins/plugins-router.d.ts.map +1 -0
  253. package/dist/runtime/api/modules/plugins/plugins-router.js +11 -0
  254. package/dist/runtime/api/modules/skills/default-skills-service.d.ts +3 -0
  255. package/dist/runtime/api/modules/skills/default-skills-service.d.ts.map +1 -0
  256. package/dist/runtime/api/modules/skills/default-skills-service.js +9 -0
  257. package/dist/runtime/api/modules/skills/index.d.ts +5 -0
  258. package/dist/runtime/api/modules/skills/index.d.ts.map +1 -0
  259. package/dist/runtime/api/modules/skills/index.js +3 -0
  260. package/dist/runtime/api/modules/skills/skills-router.d.ts +7 -0
  261. package/dist/runtime/api/modules/skills/skills-router.d.ts.map +1 -0
  262. package/dist/runtime/api/modules/skills/skills-router.js +56 -0
  263. package/dist/runtime/api/modules/skills/skills-service.d.ts +7 -0
  264. package/dist/runtime/api/modules/skills/skills-service.d.ts.map +1 -0
  265. package/dist/runtime/api/modules/skills/skills-service.js +264 -0
  266. package/dist/runtime/api/modules/skills/skills-types.d.ts +22 -0
  267. package/dist/runtime/api/modules/skills/skills-types.d.ts.map +1 -0
  268. package/dist/runtime/api/modules/skills/skills-types.js +1 -0
  269. package/dist/runtime/api/modules/usage-stats/default-usage-stats-service.d.ts +3 -0
  270. package/dist/runtime/api/modules/usage-stats/default-usage-stats-service.d.ts.map +1 -0
  271. package/dist/runtime/api/modules/usage-stats/default-usage-stats-service.js +17 -0
  272. package/dist/runtime/api/modules/usage-stats/index.d.ts +4 -0
  273. package/dist/runtime/api/modules/usage-stats/index.d.ts.map +1 -0
  274. package/dist/runtime/api/modules/usage-stats/index.js +2 -0
  275. package/dist/runtime/api/modules/usage-stats/usage-stats-router.d.ts +7 -0
  276. package/dist/runtime/api/modules/usage-stats/usage-stats-router.d.ts.map +1 -0
  277. package/dist/runtime/api/modules/usage-stats/usage-stats-router.js +42 -0
  278. package/dist/runtime/api/modules/usage-stats/usage-stats-service.d.ts +40 -0
  279. package/dist/runtime/api/modules/usage-stats/usage-stats-service.d.ts.map +1 -0
  280. package/dist/runtime/api/modules/usage-stats/usage-stats-service.js +144 -0
  281. package/dist/runtime/api/modules/usage-stats/usage-stats-types.d.ts +39 -0
  282. package/dist/runtime/api/modules/usage-stats/usage-stats-types.d.ts.map +1 -0
  283. package/dist/runtime/api/modules/usage-stats/usage-stats-types.js +1 -0
  284. package/dist/runtime/api/modules/workspaces/default-workspaces-service.d.ts +3 -0
  285. package/dist/runtime/api/modules/workspaces/default-workspaces-service.d.ts.map +1 -0
  286. package/dist/runtime/api/modules/workspaces/default-workspaces-service.js +20 -0
  287. package/dist/runtime/api/modules/workspaces/index.d.ts +6 -0
  288. package/dist/runtime/api/modules/workspaces/index.d.ts.map +1 -0
  289. package/dist/runtime/api/modules/workspaces/index.js +5 -0
  290. package/dist/runtime/api/modules/workspaces/workspace-repository.d.ts +41 -0
  291. package/dist/runtime/api/modules/workspaces/workspace-repository.d.ts.map +1 -0
  292. package/dist/runtime/api/modules/workspaces/workspace-repository.js +326 -0
  293. package/dist/runtime/api/modules/workspaces/workspace-types.d.ts +33 -0
  294. package/dist/runtime/api/modules/workspaces/workspace-types.d.ts.map +1 -0
  295. package/dist/runtime/api/modules/workspaces/workspace-types.js +1 -0
  296. package/dist/runtime/api/modules/workspaces/workspaces-router.d.ts +7 -0
  297. package/dist/runtime/api/modules/workspaces/workspaces-router.d.ts.map +1 -0
  298. package/dist/runtime/api/modules/workspaces/workspaces-router.js +71 -0
  299. package/dist/runtime/api/modules/workspaces/workspaces-service.d.ts +24 -0
  300. package/dist/runtime/api/modules/workspaces/workspaces-service.d.ts.map +1 -0
  301. package/dist/runtime/api/modules/workspaces/workspaces-service.js +109 -0
  302. package/dist/runtime/api/plugin.d.ts +5 -0
  303. package/dist/runtime/api/plugin.d.ts.map +1 -0
  304. package/dist/runtime/api/plugin.js +48 -0
  305. package/dist/runtime/api/response/api-response.d.ts +11 -0
  306. package/dist/runtime/api/response/api-response.d.ts.map +1 -0
  307. package/dist/runtime/api/response/api-response.js +18 -0
  308. package/dist/runtime/api/response/index.d.ts +3 -0
  309. package/dist/runtime/api/response/index.d.ts.map +1 -0
  310. package/dist/runtime/api/response/index.js +2 -0
  311. package/dist/runtime/api/response/response-codes.d.ts +52 -0
  312. package/dist/runtime/api/response/response-codes.d.ts.map +1 -0
  313. package/dist/runtime/api/response/response-codes.js +44 -0
  314. package/dist/runtime/api/router/v1/index.d.ts +12 -0
  315. package/dist/runtime/api/router/v1/index.d.ts.map +1 -0
  316. package/dist/runtime/api/router/v1/index.js +26 -0
  317. package/dist/runtime/api/runtime.d.ts +15 -0
  318. package/dist/runtime/api/runtime.d.ts.map +1 -0
  319. package/dist/runtime/api/runtime.js +30 -0
  320. package/dist/runtime/api/server.d.ts +2 -0
  321. package/dist/runtime/api/server.d.ts.map +1 -0
  322. package/dist/runtime/api/server.js +14 -0
  323. package/dist/runtime/api/service/health-service.d.ts +7 -0
  324. package/dist/runtime/api/service/health-service.d.ts.map +1 -0
  325. package/dist/runtime/api/service/health-service.js +7 -0
  326. package/dist/runtime/web/assets/abap-DLDM7-KI.js +1 -0
  327. package/dist/runtime/web/assets/apex-DNDY2TF8.js +1 -0
  328. package/dist/runtime/web/assets/azcli-Y6nb8tq_.js +1 -0
  329. package/dist/runtime/web/assets/bat-BwHxbl9M.js +1 -0
  330. package/dist/runtime/web/assets/bicep-CFznDFnq.js +2 -0
  331. package/dist/runtime/web/assets/cameligo-Bf6VGUru.js +1 -0
  332. package/dist/runtime/web/assets/clojure-Dnu-v4kV.js +1 -0
  333. package/dist/runtime/web/assets/codicon-ngg6Pgfi.ttf +0 -0
  334. package/dist/runtime/web/assets/coffee-Bd8akH9Z.js +1 -0
  335. package/dist/runtime/web/assets/cpp-BbWJElDN.js +1 -0
  336. package/dist/runtime/web/assets/csharp-Co3qMtFm.js +1 -0
  337. package/dist/runtime/web/assets/csp-D-4FJmMZ.js +1 -0
  338. package/dist/runtime/web/assets/css-DdJfP1eB.js +3 -0
  339. package/dist/runtime/web/assets/css.worker-B4z49cGk.js +93 -0
  340. package/dist/runtime/web/assets/cssMode-w2xbbUEW.js +1 -0
  341. package/dist/runtime/web/assets/cypher-cTPe9QuQ.js +1 -0
  342. package/dist/runtime/web/assets/dart-BOtBlQCF.js +1 -0
  343. package/dist/runtime/web/assets/dockerfile-BG73LgW2.js +1 -0
  344. package/dist/runtime/web/assets/ecl-BEgZUVRK.js +1 -0
  345. package/dist/runtime/web/assets/elixir-BkW5O-1t.js +1 -0
  346. package/dist/runtime/web/assets/flow9-BeJ5waoc.js +1 -0
  347. package/dist/runtime/web/assets/freemarker2-mywz2bob.js +3 -0
  348. package/dist/runtime/web/assets/fsharp-PahG7c26.js +1 -0
  349. package/dist/runtime/web/assets/go-acbASCJo.js +1 -0
  350. package/dist/runtime/web/assets/graphql-BxJiqAUM.js +1 -0
  351. package/dist/runtime/web/assets/handlebars-Cy-2QN_R.js +1 -0
  352. package/dist/runtime/web/assets/hcl-DtV1sZF8.js +1 -0
  353. package/dist/runtime/web/assets/html-2WQMGvns.js +1 -0
  354. package/dist/runtime/web/assets/html.worker-DtiGdgqp.js +470 -0
  355. package/dist/runtime/web/assets/htmlMode-BznIdxOy.js +1 -0
  356. package/dist/runtime/web/assets/index-CQ_mZUpS.css +1 -0
  357. package/dist/runtime/web/assets/index-CtZcItCu.js +1512 -0
  358. package/dist/runtime/web/assets/ini-Kd9XrMLS.js +1 -0
  359. package/dist/runtime/web/assets/java-CXBNlu9o.js +1 -0
  360. package/dist/runtime/web/assets/javascript-BK6G_5BV.js +1 -0
  361. package/dist/runtime/web/assets/json.worker-leyajbqV.js +58 -0
  362. package/dist/runtime/web/assets/jsonMode-DI8_Cj0K.js +7 -0
  363. package/dist/runtime/web/assets/julia-cl7-CwDS.js +1 -0
  364. package/dist/runtime/web/assets/kotlin-s7OhZKlX.js +1 -0
  365. package/dist/runtime/web/assets/less-9HpZscsL.js +2 -0
  366. package/dist/runtime/web/assets/lexon-OrD6JF1K.js +1 -0
  367. package/dist/runtime/web/assets/liquid-CE7Qnc0w.js +1 -0
  368. package/dist/runtime/web/assets/lspLanguageFeatures-DKvGiYOU.js +4 -0
  369. package/dist/runtime/web/assets/lua-Cyyb5UIc.js +1 -0
  370. package/dist/runtime/web/assets/m3-B8OfTtLu.js +1 -0
  371. package/dist/runtime/web/assets/markdown-BFxVWTOG.js +1 -0
  372. package/dist/runtime/web/assets/mdx-Fk0ZjYeT.js +1 -0
  373. package/dist/runtime/web/assets/mips-CiqrrVzr.js +1 -0
  374. package/dist/runtime/web/assets/msdax-DmeGPVcC.js +1 -0
  375. package/dist/runtime/web/assets/mysql-C_tMU-Nz.js +1 -0
  376. package/dist/runtime/web/assets/objective-c-BDtDVThU.js +1 -0
  377. package/dist/runtime/web/assets/pascal-vHIfCaH5.js +1 -0
  378. package/dist/runtime/web/assets/pascaligo-DtZ0uQbO.js +1 -0
  379. package/dist/runtime/web/assets/perl-Ub6l9XKa.js +1 -0
  380. package/dist/runtime/web/assets/pgsql-BlNEE0v7.js +1 -0
  381. package/dist/runtime/web/assets/php-BBUBE1dy.js +1 -0
  382. package/dist/runtime/web/assets/pla-DSh2-awV.js +1 -0
  383. package/dist/runtime/web/assets/postiats-CocnycG-.js +1 -0
  384. package/dist/runtime/web/assets/powerquery-tScXyioY.js +1 -0
  385. package/dist/runtime/web/assets/powershell-COWaemsV.js +1 -0
  386. package/dist/runtime/web/assets/protobuf-Brw8urJB.js +2 -0
  387. package/dist/runtime/web/assets/pug-8SOpv6rk.js +1 -0
  388. package/dist/runtime/web/assets/python-xn7eKnQc.js +1 -0
  389. package/dist/runtime/web/assets/qsharp-Bw9ernYp.js +1 -0
  390. package/dist/runtime/web/assets/r-j7ic8hl3.js +1 -0
  391. package/dist/runtime/web/assets/razor-BjC5fot0.js +1 -0
  392. package/dist/runtime/web/assets/redis-Bu5POkcn.js +1 -0
  393. package/dist/runtime/web/assets/redshift-Bs9aos_-.js +1 -0
  394. package/dist/runtime/web/assets/restructuredtext-CqXO7rUv.js +1 -0
  395. package/dist/runtime/web/assets/ruby-zBfavPgS.js +1 -0
  396. package/dist/runtime/web/assets/rust-BzKRNQWT.js +1 -0
  397. package/dist/runtime/web/assets/sb-BBc9UKZt.js +1 -0
  398. package/dist/runtime/web/assets/scala-D9hQfWCl.js +1 -0
  399. package/dist/runtime/web/assets/scheme-BPhDTwHR.js +1 -0
  400. package/dist/runtime/web/assets/scss-CBJaRo0y.js +3 -0
  401. package/dist/runtime/web/assets/shell-DiJ1NA_G.js +1 -0
  402. package/dist/runtime/web/assets/solidity-Db0IVjzk.js +1 -0
  403. package/dist/runtime/web/assets/sophia-CnS9iZB_.js +1 -0
  404. package/dist/runtime/web/assets/sparql-CJmd_6j2.js +1 -0
  405. package/dist/runtime/web/assets/sql-ClhHkBeG.js +1 -0
  406. package/dist/runtime/web/assets/st-CHwy0fLd.js +1 -0
  407. package/dist/runtime/web/assets/swift-Bqt4WxQ4.js +3 -0
  408. package/dist/runtime/web/assets/systemverilog-Bs9z6M-B.js +1 -0
  409. package/dist/runtime/web/assets/tcl-Dm6ycUr_.js +1 -0
  410. package/dist/runtime/web/assets/ts.worker-59MjiAqk.js +67731 -0
  411. package/dist/runtime/web/assets/tsMode-8t6AIduV.js +11 -0
  412. package/dist/runtime/web/assets/twig-Csy3S7wG.js +1 -0
  413. package/dist/runtime/web/assets/typescript-DvPPogGC.js +1 -0
  414. package/dist/runtime/web/assets/typespec-Btyra-wh.js +1 -0
  415. package/dist/runtime/web/assets/vb-Db0cS2oM.js +1 -0
  416. package/dist/runtime/web/assets/wgsl-BTesnYfV.js +298 -0
  417. package/dist/runtime/web/assets/xml-CB8xdh8u.js +1 -0
  418. package/dist/runtime/web/assets/yaml-B4sXC4FA.js +1 -0
  419. package/dist/runtime/web/index.html +13 -0
  420. package/package.json +42 -0
@@ -0,0 +1,17 @@
1
+ import { getModels } from "@earendil-works/pi-ai";
2
+ export async function resolveAgentModel(provider, modelId, getCustomModel) {
3
+ const builtInModel = findBuiltInModel(provider, modelId);
4
+ if (builtInModel) {
5
+ return builtInModel;
6
+ }
7
+ return (await getCustomModel?.(provider, modelId)) ?? null;
8
+ }
9
+ function findBuiltInModel(provider, modelId) {
10
+ try {
11
+ return (getModels(provider).find((model) => model.id === modelId) ??
12
+ null);
13
+ }
14
+ catch {
15
+ return null;
16
+ }
17
+ }
@@ -0,0 +1,8 @@
1
+ import type { AgentsService } from "../service";
2
+ interface BrowserToolResultBody {
3
+ content?: unknown;
4
+ isError?: unknown;
5
+ }
6
+ export declare function parseBrowserToolResultBody(body: BrowserToolResultBody, agentId: string, toolCallId: string): Parameters<AgentsService["submitBrowserToolResult"]>[0] | null;
7
+ export {};
8
+ //# sourceMappingURL=browser-tool-result.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-tool-result.d.ts","sourceRoot":"","sources":["../../../../src/modules/agents/router/browser-tool-result.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,UAAU,qBAAqB;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,qBAAqB,EAC3B,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,GACjB,UAAU,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAYhE"}
@@ -0,0 +1,35 @@
1
+ export function parseBrowserToolResultBody(body, agentId, toolCallId) {
2
+ if (body.isError !== undefined && typeof body.isError !== "boolean") {
3
+ return null;
4
+ }
5
+ const content = parseBrowserToolResultContent(body.content);
6
+ if (!content)
7
+ return null;
8
+ return {
9
+ agentId,
10
+ content,
11
+ ...(body.isError === undefined ? {} : { isError: body.isError }),
12
+ toolCallId
13
+ };
14
+ }
15
+ function parseBrowserToolResultContent(value) {
16
+ if (typeof value === "string" && value.length <= 100_000)
17
+ return value;
18
+ if (!Array.isArray(value) || value.length > 64)
19
+ return null;
20
+ const items = [];
21
+ for (const item of value) {
22
+ if (!isTextContent(item))
23
+ return null;
24
+ items.push({ text: item.text, type: "text" });
25
+ }
26
+ return items;
27
+ }
28
+ function isTextContent(value) {
29
+ return (typeof value === "object" &&
30
+ value !== null &&
31
+ !Array.isArray(value) &&
32
+ value.type === "text" &&
33
+ typeof value.text === "string" &&
34
+ value.text.length <= 100_000);
35
+ }
@@ -0,0 +1,10 @@
1
+ import { Router } from "express";
2
+ import { type SkillsService } from "../../skills";
3
+ import type { AgentsService } from "../service";
4
+ export interface CreateAgentsRouterOptions {
5
+ agentsService?: AgentsService;
6
+ skillDirs?: string[];
7
+ skillsService?: SkillsService;
8
+ }
9
+ export declare function createAgentsRouter(options?: CreateAgentsRouterOptions): Router;
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/modules/agents/router/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAA+B,MAAM,SAAS,CAAC;AAI9D,OAAO,EAA2B,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAI3E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAoBhD,MAAM,WAAW,yBAAyB;IACxC,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B;AAED,wBAAgB,kBAAkB,CAChC,OAAO,GAAE,yBAA8B,GACtC,MAAM,CA8XR"}
@@ -0,0 +1,210 @@
1
+ import { Router } from "express";
2
+ import { sendError, sendSuccess } from "../../../response/index.js";
3
+ import { RESPONSE_CODE_DEFINITIONS } from "../../../response/response-codes.js";
4
+ import { getDefaultSkillsService } from "../../skills/index.js";
5
+ import { listWorkspaceSkills } from "../runtime/support.js";
6
+ import { getDefaultAgentsService } from "../service/default.js";
7
+ import { getRequiredQueryString, parseAfterSequence, parseContinueTaskBody, parseStartAgentBody } from "./request-parsing.js";
8
+ import { parseBrowserToolResultBody } from "./browser-tool-result.js";
9
+ export function createAgentsRouter(options = {}) {
10
+ const router = Router();
11
+ const getService = () => options.agentsService ?? getDefaultAgentsService();
12
+ const getSkillsService = () => options.skillsService ?? getDefaultSkillsService();
13
+ router.post("/agents/start", (request, response) => {
14
+ const input = parseStartAgentBody(request.body);
15
+ if (!input) {
16
+ sendError(response, RESPONSE_CODE_DEFINITIONS.badRequest, "workspacePath, provider, modelId and prompt must be strings; runtimeContributions must be valid when provided");
17
+ return;
18
+ }
19
+ void getService()
20
+ .startAgent(input)
21
+ .then((result) => {
22
+ sendSuccess(response, result);
23
+ })
24
+ .catch((error) => {
25
+ sendError(response, RESPONSE_CODE_DEFINITIONS.badRequest, error instanceof Error ? error.message : "Failed to start agent");
26
+ });
27
+ });
28
+ router.get("/agents/skills", (request, response) => {
29
+ const workspacePath = getRequiredQueryString(request.query.workspacePath);
30
+ if (workspacePath === null) {
31
+ sendError(response, RESPONSE_CODE_DEFINITIONS.badRequest, "workspacePath must be a string");
32
+ return;
33
+ }
34
+ void listWorkspaceSkills(workspacePath, options.skillDirs, getSkillsService())
35
+ .then((skills) => {
36
+ sendSuccess(response, { skills });
37
+ })
38
+ .catch((error) => {
39
+ sendError(response, RESPONSE_CODE_DEFINITIONS.badRequest, error instanceof Error ? error.message : "Failed to list skills");
40
+ });
41
+ });
42
+ router.get("/agents/tasks/:taskId/messages", (request, response) => {
43
+ void getService()
44
+ .listTaskMessages({ taskId: request.params.taskId })
45
+ .then((messages) => sendSuccess(response, messages))
46
+ .catch((error) => {
47
+ sendError(response, RESPONSE_CODE_DEFINITIONS.badRequest, error instanceof Error ? error.message : "Failed to load task messages");
48
+ });
49
+ });
50
+ router.patch("/agents/tasks/:taskId", (request, response) => {
51
+ const title = typeof request.body.title === "string" ? request.body.title.trim() : "";
52
+ if (!title) {
53
+ sendError(response, RESPONSE_CODE_DEFINITIONS.badRequest, "title must be a non-empty string");
54
+ return;
55
+ }
56
+ void getService()
57
+ .renameTask({ taskId: request.params.taskId, title })
58
+ .then((result) => {
59
+ if (!result) {
60
+ sendError(response, RESPONSE_CODE_DEFINITIONS.notFound, "Unknown task");
61
+ return;
62
+ }
63
+ sendSuccess(response, result);
64
+ })
65
+ .catch((error) => {
66
+ sendError(response, RESPONSE_CODE_DEFINITIONS.badRequest, error instanceof Error ? error.message : "Failed to rename task");
67
+ });
68
+ });
69
+ router.delete("/agents/tasks/:taskId", (request, response) => {
70
+ void getService()
71
+ .deleteTask({ taskId: request.params.taskId })
72
+ .then((result) => {
73
+ if (result.status === "not_found") {
74
+ sendError(response, RESPONSE_CODE_DEFINITIONS.notFound, "Unknown task");
75
+ return;
76
+ }
77
+ if (result.status === "running") {
78
+ sendError(response, RESPONSE_CODE_DEFINITIONS.conflict, "Task is running");
79
+ return;
80
+ }
81
+ sendSuccess(response, { taskId: result.taskId });
82
+ })
83
+ .catch((error) => {
84
+ sendError(response, RESPONSE_CODE_DEFINITIONS.badRequest, error instanceof Error ? error.message : "Failed to delete task");
85
+ });
86
+ });
87
+ router.post("/agents/tasks/:taskId/continue", (request, response) => {
88
+ const input = parseContinueTaskBody(request.body, request.params.taskId);
89
+ if (!input) {
90
+ sendError(response, RESPONSE_CODE_DEFINITIONS.badRequest, "prompt must be a string, provider and modelId must both be strings when provided, and runtimeContributions must be valid when provided");
91
+ return;
92
+ }
93
+ void getService()
94
+ .continueTask(input)
95
+ .then((result) => {
96
+ if (!result) {
97
+ sendError(response, RESPONSE_CODE_DEFINITIONS.notFound, "Unknown task");
98
+ return;
99
+ }
100
+ sendSuccess(response, result);
101
+ })
102
+ .catch((error) => {
103
+ sendError(response, RESPONSE_CODE_DEFINITIONS.badRequest, error instanceof Error ? error.message : "Failed to continue task");
104
+ });
105
+ });
106
+ router.post("/agents/tasks/:taskId/interrupt", (request, response) => {
107
+ void getService()
108
+ .interruptTask({ taskId: request.params.taskId })
109
+ .then((result) => {
110
+ if (result.status === "not_found") {
111
+ sendError(response, RESPONSE_CODE_DEFINITIONS.notFound, "Unknown task");
112
+ return;
113
+ }
114
+ if (result.status === "not_running") {
115
+ sendError(response, RESPONSE_CODE_DEFINITIONS.conflict, "Task is not running");
116
+ return;
117
+ }
118
+ sendSuccess(response, result);
119
+ })
120
+ .catch((error) => {
121
+ sendError(response, RESPONSE_CODE_DEFINITIONS.badRequest, error instanceof Error ? error.message : "Failed to interrupt task");
122
+ });
123
+ });
124
+ router.get("/agents/tasks/:taskId/title", (request, response) => {
125
+ void getService()
126
+ .getTaskTitle({ taskId: request.params.taskId })
127
+ .then((result) => {
128
+ if (!result) {
129
+ sendError(response, RESPONSE_CODE_DEFINITIONS.notFound, "Unknown task");
130
+ return;
131
+ }
132
+ sendSuccess(response, result);
133
+ })
134
+ .catch((error) => {
135
+ sendError(response, RESPONSE_CODE_DEFINITIONS.badRequest, error instanceof Error ? error.message : "Failed to get task title");
136
+ });
137
+ });
138
+ router.get("/agents/:agentId/events", (request, response) => {
139
+ const afterSequence = parseAfterSequence(request.query.afterSequence);
140
+ if (afterSequence === null) {
141
+ sendError(response, RESPONSE_CODE_DEFINITIONS.badRequest, "afterSequence must be a non-negative integer");
142
+ return;
143
+ }
144
+ response.status(200);
145
+ response.setHeader("Content-Type", "application/x-ndjson");
146
+ response.setHeader("Cache-Control", "no-cache");
147
+ response.setHeader("Connection", "keep-alive");
148
+ response.flushHeaders();
149
+ const subscription = getService().subscribeToAgentEvents({
150
+ ...(afterSequence === undefined ? {} : { afterSequence }),
151
+ agentId: request.params.agentId
152
+ }, (event) => {
153
+ writeNdjsonEvent(response, event);
154
+ });
155
+ request.on("close", () => {
156
+ subscription.unsubscribe();
157
+ });
158
+ });
159
+ router.post("/agents/:agentId/approvals/:approvalId", (request, response) => {
160
+ if (typeof request.body.approved !== "boolean") {
161
+ sendError(response, RESPONSE_CODE_DEFINITIONS.badRequest, "approved must be a boolean");
162
+ return;
163
+ }
164
+ if (request.body.reason !== undefined &&
165
+ typeof request.body.reason !== "string") {
166
+ sendError(response, RESPONSE_CODE_DEFINITIONS.badRequest, "reason must be a string");
167
+ return;
168
+ }
169
+ void getService()
170
+ .approveAgentAction({
171
+ agentId: request.params.agentId,
172
+ approvalId: request.params.approvalId,
173
+ approved: request.body.approved,
174
+ ...(request.body.reason === undefined
175
+ ? {}
176
+ : { reason: request.body.reason })
177
+ })
178
+ .then((result) => {
179
+ sendSuccess(response, result);
180
+ })
181
+ .catch((error) => {
182
+ sendError(response, RESPONSE_CODE_DEFINITIONS.notFound, error instanceof Error ? error.message : "Unknown approval request");
183
+ });
184
+ });
185
+ router.post("/agents/:agentId/browser-tools/:toolCallId/result", (request, response) => {
186
+ const input = parseBrowserToolResultBody(request.body, request.params.agentId, request.params.toolCallId);
187
+ if (!input) {
188
+ sendError(response, RESPONSE_CODE_DEFINITIONS.badRequest, "content must be a string or text content array");
189
+ return;
190
+ }
191
+ void getService()
192
+ .submitBrowserToolResult(input)
193
+ .then((result) => {
194
+ if (!result) {
195
+ sendError(response, RESPONSE_CODE_DEFINITIONS.notFound, "Unknown browser tool call");
196
+ return;
197
+ }
198
+ sendSuccess(response, result);
199
+ })
200
+ .catch((error) => {
201
+ sendError(response, RESPONSE_CODE_DEFINITIONS.badRequest, error instanceof Error
202
+ ? error.message
203
+ : "Failed to submit browser tool result");
204
+ });
205
+ });
206
+ return router;
207
+ }
208
+ function writeNdjsonEvent(response, event) {
209
+ response.write(`${JSON.stringify(event)}\n`);
210
+ }
@@ -0,0 +1,24 @@
1
+ import type { StartAgentInput } from "../agent-types";
2
+ import type { AgentsService } from "../service";
3
+ export interface StartAgentBody {
4
+ approvalPolicy?: unknown;
5
+ modelId?: string;
6
+ prompt?: string;
7
+ provider?: string;
8
+ runtimeContributions?: unknown;
9
+ thinkingLevel?: unknown;
10
+ workspacePath?: string;
11
+ }
12
+ export interface ContinueTaskBody {
13
+ approvalPolicy?: unknown;
14
+ modelId?: string;
15
+ prompt?: string;
16
+ provider?: string;
17
+ runtimeContributions?: unknown;
18
+ thinkingLevel?: unknown;
19
+ }
20
+ export declare function parseContinueTaskBody(body: ContinueTaskBody, taskId: string): Parameters<AgentsService["continueTask"]>[0] | null;
21
+ export declare function parseStartAgentBody(body: StartAgentBody): StartAgentInput | null;
22
+ export declare function parseAfterSequence(value: unknown): number | undefined | null;
23
+ export declare function getRequiredQueryString(value: unknown): string | null;
24
+ //# sourceMappingURL=request-parsing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-parsing.d.ts","sourceRoot":"","sources":["../../../../src/modules/agents/router/request-parsing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGhD,MAAM,WAAW,cAAc;IAC7B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,gBAAgB;IAC/B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,gBAAgB,EACtB,MAAM,EAAE,MAAM,GACb,UAAU,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAiCrD;AAED,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,cAAc,GACnB,eAAe,GAAG,IAAI,CA2BxB;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,IAAI,CAU5E;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAEpE"}
@@ -0,0 +1,78 @@
1
+ import { parseBrowserRuntimeContributions } from "../runtime/browser-runtime-contributions.js";
2
+ export function parseContinueTaskBody(body, taskId) {
3
+ if (typeof body.prompt !== "string") {
4
+ return null;
5
+ }
6
+ const options = parseTaskRunOptions(body);
7
+ const runtimeContributions = parseBrowserRuntimeContributions(body.runtimeContributions);
8
+ if (!options || runtimeContributions === null) {
9
+ return null;
10
+ }
11
+ const contributionInput = runtimeContributions === undefined ? {} : { runtimeContributions };
12
+ if (body.provider === undefined && body.modelId === undefined) {
13
+ return { ...options, ...contributionInput, prompt: body.prompt, taskId };
14
+ }
15
+ if (typeof body.provider !== "string" || typeof body.modelId !== "string") {
16
+ return null;
17
+ }
18
+ return {
19
+ ...options,
20
+ ...contributionInput,
21
+ modelId: body.modelId,
22
+ prompt: body.prompt,
23
+ provider: body.provider,
24
+ taskId
25
+ };
26
+ }
27
+ export function parseStartAgentBody(body) {
28
+ if (typeof body.workspacePath !== "string" ||
29
+ typeof body.provider !== "string" ||
30
+ typeof body.modelId !== "string" ||
31
+ typeof body.prompt !== "string") {
32
+ return null;
33
+ }
34
+ const options = parseTaskRunOptions(body);
35
+ const runtimeContributions = parseBrowserRuntimeContributions(body.runtimeContributions);
36
+ if (!options || runtimeContributions === null) {
37
+ return null;
38
+ }
39
+ return {
40
+ ...options,
41
+ ...(runtimeContributions === undefined ? {} : { runtimeContributions }),
42
+ modelId: body.modelId,
43
+ prompt: body.prompt,
44
+ provider: body.provider,
45
+ workspacePath: body.workspacePath
46
+ };
47
+ }
48
+ export function parseAfterSequence(value) {
49
+ if (value === undefined) {
50
+ return undefined;
51
+ }
52
+ if (typeof value !== "string" || !/^\d+$/.test(value)) {
53
+ return null;
54
+ }
55
+ return Number(value);
56
+ }
57
+ export function getRequiredQueryString(value) {
58
+ return typeof value === "string" ? value : null;
59
+ }
60
+ function parseTaskRunOptions(body) {
61
+ const approvalPolicy = body.approvalPolicy ?? "approval";
62
+ const thinkingLevel = body.thinkingLevel ?? "medium";
63
+ if (approvalPolicy !== "approval" && approvalPolicy !== "run_all") {
64
+ return null;
65
+ }
66
+ if (!isThinkingLevel(thinkingLevel)) {
67
+ return null;
68
+ }
69
+ return { approvalPolicy, thinkingLevel };
70
+ }
71
+ function isThinkingLevel(value) {
72
+ return (value === "off" ||
73
+ value === "minimal" ||
74
+ value === "low" ||
75
+ value === "medium" ||
76
+ value === "high" ||
77
+ value === "xhigh");
78
+ }
@@ -0,0 +1,5 @@
1
+ import type { Skill } from "@earendil-works/pi-agent-core";
2
+ import type { BrowserRuntimeContributions, BrowserRuntimeSkill } from "../agent-types";
3
+ export declare function parseBrowserRuntimeContributions(value: unknown): BrowserRuntimeContributions | undefined | null;
4
+ export declare function toRuntimeSkills(skills: readonly BrowserRuntimeSkill[] | undefined): Skill[];
5
+ //# sourceMappingURL=browser-runtime-contributions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-runtime-contributions.d.ts","sourceRoot":"","sources":["../../../../src/modules/agents/runtime/browser-runtime-contributions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AAE3D,OAAO,KAAK,EACV,2BAA2B,EAC3B,mBAAmB,EAEpB,MAAM,gBAAgB,CAAC;AAUxB,wBAAgB,gCAAgC,CAC9C,KAAK,EAAE,OAAO,GACb,2BAA2B,GAAG,SAAS,GAAG,IAAI,CAehD;AAED,wBAAgB,eAAe,CAC7B,MAAM,EAAE,SAAS,mBAAmB,EAAE,GAAG,SAAS,GACjD,KAAK,EAAE,CAOT"}
@@ -0,0 +1,115 @@
1
+ const MAX_TOOLS = 16;
2
+ const MAX_SKILLS = 16;
3
+ const MAX_SYSTEM_PROMPTS = 16;
4
+ const MAX_NAME_LENGTH = 80;
5
+ const MAX_DESCRIPTION_LENGTH = 1000;
6
+ const MAX_SKILL_CONTENT_LENGTH = 20_000;
7
+ const MAX_SYSTEM_PROMPT_LENGTH = 20_000;
8
+ export function parseBrowserRuntimeContributions(value) {
9
+ if (value === undefined)
10
+ return undefined;
11
+ if (!isRecord(value))
12
+ return null;
13
+ const tools = parseTools(value.tools);
14
+ const skills = parseSkills(value.skills);
15
+ const systemPrompts = parseSystemPrompts(value.systemPrompts);
16
+ if (tools === null || skills === null || systemPrompts === null)
17
+ return null;
18
+ return {
19
+ ...(skills === undefined ? {} : { skills }),
20
+ ...(systemPrompts === undefined ? {} : { systemPrompts }),
21
+ ...(tools === undefined ? {} : { tools })
22
+ };
23
+ }
24
+ export function toRuntimeSkills(skills) {
25
+ return (skills ?? []).map((skill) => ({
26
+ content: skill.content,
27
+ description: skill.description ?? "",
28
+ filePath: `browser-runtime://${skill.name}/SKILL.md`,
29
+ name: skill.name
30
+ }));
31
+ }
32
+ function parseTools(value) {
33
+ if (value === undefined)
34
+ return undefined;
35
+ if (!Array.isArray(value) || value.length > MAX_TOOLS)
36
+ return null;
37
+ const names = new Set();
38
+ const tools = [];
39
+ for (const item of value) {
40
+ if (!isRecord(item))
41
+ return null;
42
+ const name = parseName(item.name);
43
+ const description = parseOptionalString(item.description, MAX_DESCRIPTION_LENGTH);
44
+ if (!name || description === null || item.inputSchema === undefined) {
45
+ return null;
46
+ }
47
+ if (names.has(name))
48
+ return null;
49
+ names.add(name);
50
+ tools.push({
51
+ ...(description === undefined ? {} : { description }),
52
+ inputSchema: item.inputSchema,
53
+ name
54
+ });
55
+ }
56
+ return tools;
57
+ }
58
+ function parseSkills(value) {
59
+ if (value === undefined)
60
+ return undefined;
61
+ if (!Array.isArray(value) || value.length > MAX_SKILLS)
62
+ return null;
63
+ const skills = [];
64
+ for (const item of value) {
65
+ if (!isRecord(item))
66
+ return null;
67
+ const name = parseName(item.name);
68
+ const description = parseOptionalString(item.description, MAX_DESCRIPTION_LENGTH);
69
+ const content = parseRequiredString(item.content, MAX_SKILL_CONTENT_LENGTH);
70
+ if (!name || description === null || content === null)
71
+ return null;
72
+ skills.push({
73
+ content,
74
+ ...(description === undefined ? {} : { description }),
75
+ name
76
+ });
77
+ }
78
+ return skills;
79
+ }
80
+ function parseSystemPrompts(value) {
81
+ if (value === undefined)
82
+ return undefined;
83
+ if (!Array.isArray(value) || value.length > MAX_SYSTEM_PROMPTS)
84
+ return null;
85
+ const prompts = [];
86
+ for (const item of value) {
87
+ const prompt = parseRequiredString(item, MAX_SYSTEM_PROMPT_LENGTH);
88
+ if (prompt === null)
89
+ return null;
90
+ prompts.push(prompt);
91
+ }
92
+ return prompts;
93
+ }
94
+ function parseName(value) {
95
+ const name = parseRequiredString(value, MAX_NAME_LENGTH);
96
+ if (!name)
97
+ return null;
98
+ return /^[a-zA-Z_][a-zA-Z0-9_-]*$/.test(name) ? name : null;
99
+ }
100
+ function parseRequiredString(value, maxLength) {
101
+ if (typeof value !== "string")
102
+ return null;
103
+ const trimmed = value.trim();
104
+ if (!trimmed || trimmed.length > maxLength)
105
+ return null;
106
+ return trimmed;
107
+ }
108
+ function parseOptionalString(value, maxLength) {
109
+ if (value === undefined)
110
+ return undefined;
111
+ return parseRequiredString(value, maxLength);
112
+ }
113
+ function isRecord(value) {
114
+ return typeof value === "object" && value !== null && !Array.isArray(value);
115
+ }
@@ -0,0 +1,13 @@
1
+ import type { ServerPlugin } from "@hold-rein/plugin-server";
2
+ import type { BrowserRuntimeToolSchema } from "../agent-types";
3
+ import type { AgentEventBus } from "../event/event-bus";
4
+ import type { BrowserToolCallStore } from "./browser-tool-call-store";
5
+ interface CreateBrowserRuntimeToolsInput {
6
+ agentId: string;
7
+ eventBus: AgentEventBus;
8
+ store: BrowserToolCallStore;
9
+ tools: readonly BrowserRuntimeToolSchema[] | undefined;
10
+ }
11
+ export declare function createBrowserRuntimeTools(input: CreateBrowserRuntimeToolsInput): ServerPlugin.PluginTool[];
12
+ export {};
13
+ //# sourceMappingURL=browser-runtime-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-runtime-tools.d.ts","sourceRoot":"","sources":["../../../../src/modules/agents/runtime/browser-runtime-tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEtE,UAAU,8BAA8B;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,aAAa,CAAC;IACxB,KAAK,EAAE,oBAAoB,CAAC;IAC5B,KAAK,EAAE,SAAS,wBAAwB,EAAE,GAAG,SAAS,CAAC;CACxD;AAED,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,8BAA8B,GACpC,YAAY,CAAC,UAAU,EAAE,CAyB3B"}
@@ -0,0 +1,31 @@
1
+ export function createBrowserRuntimeTools(input) {
2
+ return (input.tools ?? []).map((tool) => ({
3
+ description: tool.description ?? tool.name,
4
+ execute: (toolCallId, toolInput) => {
5
+ const args = toArgumentsRecord(toolInput);
6
+ input.eventBus.emit({
7
+ agentId: input.agentId,
8
+ payload: {
9
+ arguments: args,
10
+ toolCallId,
11
+ toolName: tool.name
12
+ },
13
+ type: "browser_tool_call_requested"
14
+ });
15
+ return input.store.createCall({
16
+ agentId: input.agentId,
17
+ arguments: args,
18
+ toolCallId,
19
+ toolName: tool.name
20
+ });
21
+ },
22
+ label: tool.name,
23
+ name: tool.name,
24
+ parameters: tool.inputSchema
25
+ }));
26
+ }
27
+ function toArgumentsRecord(value) {
28
+ return typeof value === "object" && value !== null && !Array.isArray(value)
29
+ ? value
30
+ : {};
31
+ }
@@ -0,0 +1,21 @@
1
+ import type { AgentToolResult } from "@earendil-works/pi-agent-core";
2
+ import type { BrowserToolResultInput } from "../agent-types";
3
+ export interface BrowserToolCallRequest {
4
+ agentId: string;
5
+ arguments: Record<string, unknown>;
6
+ toolCallId: string;
7
+ toolName: string;
8
+ }
9
+ export interface BrowserToolCallStore {
10
+ clearAgent: (agentId: string) => void;
11
+ createCall: (request: BrowserToolCallRequest) => Promise<BrowserToolResult>;
12
+ submitResult: (input: BrowserToolResultInput) => boolean;
13
+ }
14
+ type BrowserToolResult = AgentToolResult<{
15
+ toolName?: string;
16
+ }> & {
17
+ isError?: boolean;
18
+ };
19
+ export declare function createBrowserToolCallStore(timeoutMs?: number): BrowserToolCallStore;
20
+ export {};
21
+ //# sourceMappingURL=browser-tool-call-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-tool-call-store.d.ts","sourceRoot":"","sources":["../../../../src/modules/agents/runtime/browser-tool-call-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAErE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAE7D,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,UAAU,EAAE,CAAC,OAAO,EAAE,sBAAsB,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC5E,YAAY,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,OAAO,CAAC;CAC1D;AAED,KAAK,iBAAiB,GAAG,eAAe,CAAC;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG;IAChE,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,wBAAgB,0BAA0B,CACxC,SAAS,SAAS,GACjB,oBAAoB,CAkEtB"}