@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,42 @@
1
+ export async function startTaskRun(input) {
2
+ input.activeTaskRuns?.markStarting(input.taskId);
3
+ try {
4
+ const run = await input.runtime.start(input.runtimeInput);
5
+ input.activeTaskRuns?.register(input.taskId, run.agentId);
6
+ monitorTaskRun({
7
+ ...(input.activeTaskRuns
8
+ ? { activeTaskRuns: input.activeTaskRuns }
9
+ : {}),
10
+ agentId: run.agentId,
11
+ eventBus: input.eventBus,
12
+ now: input.now,
13
+ repository: input.repository,
14
+ taskId: input.taskId
15
+ });
16
+ return run;
17
+ }
18
+ catch (error) {
19
+ input.activeTaskRuns?.remove(input.taskId);
20
+ input.repository.updateTaskStatus(input.taskId, "error", input.now().toISOString());
21
+ throw error;
22
+ }
23
+ }
24
+ function monitorTaskRun(input) {
25
+ let terminal = false;
26
+ let subscription;
27
+ subscription = input.eventBus.subscribe({ agentId: input.agentId }, (event) => {
28
+ const status = event.type === "task_end"
29
+ ? "completed"
30
+ : event.type === "agent_error"
31
+ ? "error"
32
+ : undefined;
33
+ if (!status || terminal)
34
+ return;
35
+ terminal = true;
36
+ input.repository.updateTaskStatus(input.taskId, status, input.now().toISOString());
37
+ input.activeTaskRuns?.remove(input.taskId);
38
+ subscription?.unsubscribe();
39
+ });
40
+ if (terminal)
41
+ subscription.unsubscribe();
42
+ }
@@ -0,0 +1,15 @@
1
+ import { type AgentModelLookup } from "../model/resolver";
2
+ export interface GenerateTaskTitleInput {
3
+ apiKey?: string;
4
+ modelId: string;
5
+ prompt: string;
6
+ provider: string;
7
+ }
8
+ export interface TaskTitleGenerator {
9
+ generateTitle: (input: GenerateTaskTitleInput) => Promise<string>;
10
+ }
11
+ export interface CreateTaskTitleGeneratorOptions {
12
+ getCustomModel?: AgentModelLookup;
13
+ }
14
+ export declare function createDefaultTaskTitleGenerator(options?: CreateTaskTitleGeneratorOptions): TaskTitleGenerator;
15
+ //# sourceMappingURL=title-generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"title-generator.d.ts","sourceRoot":"","sources":["../../../../src/modules/agents/task/title-generator.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,mBAAmB,CAAC;AAE3B,MAAM,WAAW,sBAAsB;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,kBAAkB;IACjC,aAAa,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CACnE;AAED,MAAM,WAAW,+BAA+B;IAC9C,cAAc,CAAC,EAAE,gBAAgB,CAAC;CACnC;AAED,wBAAgB,+BAA+B,CAC7C,OAAO,GAAE,+BAAoC,GAC5C,kBAAkB,CAqDpB"}
@@ -0,0 +1,61 @@
1
+ import { complete } from "@earendil-works/pi-ai";
2
+ import { resolveAgentModel } from "../model/resolver.js";
3
+ export function createDefaultTaskTitleGenerator(options = {}) {
4
+ return {
5
+ generateTitle: async (input) => {
6
+ const model = await resolveAgentModel(input.provider, input.modelId, options.getCustomModel);
7
+ if (!model) {
8
+ return createFallbackTitle(input.prompt);
9
+ }
10
+ try {
11
+ const message = await complete(model, {
12
+ messages: [
13
+ {
14
+ content: [
15
+ {
16
+ text: [
17
+ "Create a concise task title for this user request.",
18
+ "Return only the title, without quotes or punctuation wrappers.",
19
+ `Request: ${input.prompt}`
20
+ ].join("\n"),
21
+ type: "text"
22
+ }
23
+ ],
24
+ role: "user",
25
+ timestamp: Date.now()
26
+ }
27
+ ],
28
+ systemPrompt: "You create short software task titles."
29
+ }, {
30
+ ...(input.apiKey ? { apiKey: input.apiKey } : {}),
31
+ maxTokens: 64,
32
+ temperature: 0.2
33
+ });
34
+ const title = message.content
35
+ .filter((content) => content.type === "text")
36
+ .map((content) => content.text)
37
+ .join("")
38
+ .trim();
39
+ return normalizeGeneratedTitle(title, input.prompt);
40
+ }
41
+ catch {
42
+ return createFallbackTitle(input.prompt);
43
+ }
44
+ }
45
+ };
46
+ }
47
+ function normalizeGeneratedTitle(title, prompt) {
48
+ const normalizedTitle = title
49
+ .replace(/^["'`]+|["'`]+$/g, "")
50
+ .replace(/\s+/g, " ")
51
+ .trim();
52
+ return normalizedTitle.length > 0
53
+ ? normalizedTitle.slice(0, 80)
54
+ : createFallbackTitle(prompt);
55
+ }
56
+ function createFallbackTitle(prompt) {
57
+ const normalizedPrompt = prompt.replace(/\s+/g, " ").trim();
58
+ return normalizedPrompt.length > 0
59
+ ? normalizedPrompt.slice(0, 80)
60
+ : "New task";
61
+ }
@@ -0,0 +1,14 @@
1
+ import type { WorkspaceRepository } from "../workspaces/workspace-repository";
2
+ import type { ActiveTaskRunRegistry } from "./active-task-run-registry";
3
+ import type { AgentEventBus } from "./agent-event-bus";
4
+ import type { AgentRuntime } from "./agent-runtime";
5
+ export declare function startTaskRun(input: {
6
+ activeTaskRuns?: ActiveTaskRunRegistry;
7
+ eventBus: AgentEventBus;
8
+ now: () => Date;
9
+ repository: WorkspaceRepository;
10
+ runtime: AgentRuntime;
11
+ runtimeInput: Parameters<AgentRuntime["start"]>[0];
12
+ taskId: string;
13
+ }): Promise<import("./agent-types").AgentRunResult>;
14
+ //# sourceMappingURL=task-run-monitor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task-run-monitor.d.ts","sourceRoot":"","sources":["../../../src/modules/agents/task-run-monitor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAGpD,wBAAsB,YAAY,CAAC,KAAK,EAAE;IACxC,cAAc,CAAC,EAAE,qBAAqB,CAAC;IACvC,QAAQ,EAAE,aAAa,CAAC;IACxB,GAAG,EAAE,MAAM,IAAI,CAAC;IAChB,UAAU,EAAE,mBAAmB,CAAC;IAChC,OAAO,EAAE,YAAY,CAAC;IACtB,YAAY,EAAE,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACnD,MAAM,EAAE,MAAM,CAAC;CAChB,mDA0BA"}
@@ -0,0 +1,42 @@
1
+ export async function startTaskRun(input) {
2
+ input.activeTaskRuns?.markStarting(input.taskId);
3
+ try {
4
+ const run = await input.runtime.start(input.runtimeInput);
5
+ input.activeTaskRuns?.register(input.taskId, run.agentId);
6
+ monitorTaskRun({
7
+ ...(input.activeTaskRuns
8
+ ? { activeTaskRuns: input.activeTaskRuns }
9
+ : {}),
10
+ agentId: run.agentId,
11
+ eventBus: input.eventBus,
12
+ now: input.now,
13
+ repository: input.repository,
14
+ taskId: input.taskId
15
+ });
16
+ return run;
17
+ }
18
+ catch (error) {
19
+ input.activeTaskRuns?.remove(input.taskId);
20
+ input.repository.updateTaskStatus(input.taskId, "error", input.now().toISOString());
21
+ throw error;
22
+ }
23
+ }
24
+ function monitorTaskRun(input) {
25
+ let terminal = false;
26
+ let subscription;
27
+ subscription = input.eventBus.subscribe({ agentId: input.agentId }, (event) => {
28
+ const status = event.type === "task_end"
29
+ ? "completed"
30
+ : event.type === "agent_error"
31
+ ? "error"
32
+ : undefined;
33
+ if (!status || terminal)
34
+ return;
35
+ terminal = true;
36
+ input.repository.updateTaskStatus(input.taskId, status, input.now().toISOString());
37
+ input.activeTaskRuns?.remove(input.taskId);
38
+ subscription?.unsubscribe();
39
+ });
40
+ if (terminal)
41
+ subscription.unsubscribe();
42
+ }
@@ -0,0 +1,6 @@
1
+ import { Router } from "express";
2
+ export interface CreateFileSystemRouterOptions {
3
+ fileSystemRootPath?: string;
4
+ }
5
+ export declare function createFileSystemRouter(options?: CreateFileSystemRouterOptions): Router;
6
+ //# sourceMappingURL=file-system-router.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-system-router.d.ts","sourceRoot":"","sources":["../../../src/modules/file-system/file-system-router.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAA+B,MAAM,SAAS,CAAC;AAU9D,MAAM,WAAW,6BAA6B;IAC5C,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,wBAAgB,sBAAsB,CACpC,OAAO,GAAE,6BAAkC,GAC1C,MAAM,CAyIR"}
@@ -0,0 +1,119 @@
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 { listDirectoryEntries, listDirectoryEntriesRecursive, readFileContent } from "./file-system-service.js";
5
+ export function createFileSystemRouter(options = {}) {
6
+ const router = Router();
7
+ router.get("/file-system/entries", (request, response) => {
8
+ const parentPath = getParentPath(request.query.parentPath);
9
+ if (parentPath === null) {
10
+ sendError(response, RESPONSE_CODE_DEFINITIONS.badRequest, "parentPath must be a string");
11
+ return;
12
+ }
13
+ const listOptions = {
14
+ ...(parentPath === undefined ? {} : { parentPath }),
15
+ ...(options.fileSystemRootPath === undefined
16
+ ? {}
17
+ : { rootPath: options.fileSystemRootPath })
18
+ };
19
+ void listDirectoryEntries(listOptions)
20
+ .then((listing) => {
21
+ sendSuccess(response, listing);
22
+ })
23
+ .catch((error) => {
24
+ sendError(response, RESPONSE_CODE_DEFINITIONS.badRequest, error instanceof Error
25
+ ? error.message
26
+ : "Failed to list directory entries");
27
+ });
28
+ });
29
+ router.get("/file-system/entries/recursive", (request, response) => {
30
+ const parentPath = getParentPath(request.query.parentPath);
31
+ const ignores = getOptionalQueryStringArray(request.query.ignores);
32
+ const useGitIgnore = getOptionalQueryBoolean(request.query.useGitIgnore);
33
+ if (parentPath === null) {
34
+ sendError(response, RESPONSE_CODE_DEFINITIONS.badRequest, "parentPath must be a string");
35
+ return;
36
+ }
37
+ if (ignores === null) {
38
+ sendError(response, RESPONSE_CODE_DEFINITIONS.badRequest, "ignores must be a string array");
39
+ return;
40
+ }
41
+ if (useGitIgnore === null) {
42
+ sendError(response, RESPONSE_CODE_DEFINITIONS.badRequest, "useGitIgnore must be a boolean");
43
+ return;
44
+ }
45
+ const listOptions = {
46
+ ...(ignores === undefined ? {} : { ignores }),
47
+ ...(parentPath === undefined ? {} : { parentPath }),
48
+ ...(useGitIgnore === undefined ? {} : { useGitIgnore }),
49
+ ...(options.fileSystemRootPath === undefined
50
+ ? {}
51
+ : { rootPath: options.fileSystemRootPath })
52
+ };
53
+ void listDirectoryEntriesRecursive(listOptions)
54
+ .then((listing) => {
55
+ sendSuccess(response, listing);
56
+ })
57
+ .catch((error) => {
58
+ sendError(response, RESPONSE_CODE_DEFINITIONS.badRequest, error instanceof Error
59
+ ? error.message
60
+ : "Failed to list directory entries recursively");
61
+ });
62
+ });
63
+ router.get("/file-system/file-content", (request, response) => {
64
+ const filePath = getRequiredQueryString(request.query.filePath);
65
+ if (filePath === null) {
66
+ sendError(response, RESPONSE_CODE_DEFINITIONS.badRequest, "filePath must be a string");
67
+ return;
68
+ }
69
+ const readOptions = {
70
+ filePath,
71
+ ...(options.fileSystemRootPath === undefined
72
+ ? {}
73
+ : { rootPath: options.fileSystemRootPath })
74
+ };
75
+ void readFileContent(readOptions)
76
+ .then((fileContent) => {
77
+ sendSuccess(response, fileContent);
78
+ })
79
+ .catch((error) => {
80
+ sendError(response, RESPONSE_CODE_DEFINITIONS.badRequest, error instanceof Error
81
+ ? error.message
82
+ : "Failed to read file content");
83
+ });
84
+ });
85
+ return router;
86
+ }
87
+ function getParentPath(parentPath) {
88
+ if (parentPath === undefined) {
89
+ return undefined;
90
+ }
91
+ return typeof parentPath === "string" ? parentPath : null;
92
+ }
93
+ function getRequiredQueryString(value) {
94
+ return typeof value === "string" ? value : null;
95
+ }
96
+ function getOptionalQueryStringArray(value) {
97
+ if (value === undefined) {
98
+ return undefined;
99
+ }
100
+ if (typeof value === "string") {
101
+ return [value];
102
+ }
103
+ if (Array.isArray(value) && value.every((item) => typeof item === "string")) {
104
+ return value;
105
+ }
106
+ return null;
107
+ }
108
+ function getOptionalQueryBoolean(value) {
109
+ if (value === undefined) {
110
+ return undefined;
111
+ }
112
+ if (value === "true") {
113
+ return true;
114
+ }
115
+ if (value === "false") {
116
+ return false;
117
+ }
118
+ return null;
119
+ }
@@ -0,0 +1,30 @@
1
+ export type FileSystemEntryKind = "file" | "folder";
2
+ export interface FileSystemEntry {
3
+ children?: FileSystemEntry[];
4
+ extension: string;
5
+ kind: FileSystemEntryKind;
6
+ name: string;
7
+ path: string;
8
+ }
9
+ export interface FileSystemDirectoryListing {
10
+ entries: FileSystemEntry[];
11
+ parentPath: string;
12
+ }
13
+ export interface FileSystemFileContent {
14
+ content: string;
15
+ filePath: string;
16
+ }
17
+ export interface ListDirectoryOptions {
18
+ ignores?: string[];
19
+ parentPath?: string;
20
+ rootPath?: string;
21
+ useGitIgnore?: boolean;
22
+ }
23
+ export interface ReadFileContentOptions {
24
+ filePath: string;
25
+ rootPath?: string;
26
+ }
27
+ export declare function listDirectoryEntries(options?: ListDirectoryOptions): Promise<FileSystemDirectoryListing>;
28
+ export declare function listDirectoryEntriesRecursive(options?: ListDirectoryOptions): Promise<FileSystemDirectoryListing>;
29
+ export declare function readFileContent(options: ReadFileContentOptions): Promise<FileSystemFileContent>;
30
+ //# sourceMappingURL=file-system-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-system-service.d.ts","sourceRoot":"","sources":["../../../src/modules/file-system/file-system-service.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,QAAQ,CAAC;AAEpD,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,eAAe,EAAE,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,mBAAmB,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wBAAsB,oBAAoB,CACxC,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,0BAA0B,CAAC,CA6BrC;AAED,wBAAsB,6BAA6B,CACjD,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,0BAA0B,CAAC,CAerC;AAED,wBAAsB,eAAe,CACnC,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,qBAAqB,CAAC,CAahC"}
@@ -0,0 +1,209 @@
1
+ import { readFile, readdir, stat } from "node:fs/promises";
2
+ import { extname, isAbsolute, parse, relative, resolve } from "node:path";
3
+ export async function listDirectoryEntries(options = {}) {
4
+ const rootPath = normalizeRootPath(options.rootPath);
5
+ const parentPath = normalizeParentPath(rootPath, options.parentPath);
6
+ const parentStat = await stat(parentPath);
7
+ if (!parentStat.isDirectory()) {
8
+ throw new Error("parentPath must be a directory");
9
+ }
10
+ const entries = await readdir(parentPath, { withFileTypes: true });
11
+ const visibleEntries = entries.filter((entry) => !entry.name.startsWith("."));
12
+ return {
13
+ entries: visibleEntries
14
+ .filter((entry) => entry.isDirectory() || entry.isFile())
15
+ .map((entry) => {
16
+ const entryPath = resolve(parentPath, entry.name);
17
+ const isDirectory = entry.isDirectory();
18
+ return {
19
+ extension: isDirectory ? "" : extname(entry.name),
20
+ kind: isDirectory ? "folder" : "file",
21
+ name: entry.name,
22
+ path: entryPath
23
+ };
24
+ })
25
+ .sort(compareEntries),
26
+ parentPath
27
+ };
28
+ }
29
+ export async function listDirectoryEntriesRecursive(options = {}) {
30
+ const rootPath = normalizeRootPath(options.rootPath);
31
+ const parentPath = normalizeParentPath(rootPath, options.parentPath);
32
+ const parentStat = await stat(parentPath);
33
+ if (!parentStat.isDirectory()) {
34
+ throw new Error("parentPath must be a directory");
35
+ }
36
+ const ignoreMatcher = await createIgnoreMatcher(parentPath, options);
37
+ return {
38
+ entries: await listEntriesRecursive(parentPath, ignoreMatcher),
39
+ parentPath
40
+ };
41
+ }
42
+ export async function readFileContent(options) {
43
+ const rootPath = normalizeRootPath(options.rootPath);
44
+ const filePath = normalizeFilePath(rootPath, options.filePath);
45
+ const fileStat = await stat(filePath);
46
+ if (!fileStat.isFile()) {
47
+ throw new Error("filePath must be a file");
48
+ }
49
+ return {
50
+ content: await readFile(filePath, "utf8"),
51
+ filePath
52
+ };
53
+ }
54
+ function normalizeRootPath(rootPath) {
55
+ return rootPath ? resolve(rootPath) : parse(process.cwd()).root;
56
+ }
57
+ function normalizeParentPath(rootPath, parentPath) {
58
+ const resolvedParentPath = parentPath
59
+ ? resolve(parentPath)
60
+ : rootPath;
61
+ if (!isPathInsideRoot(rootPath, resolvedParentPath)) {
62
+ throw new Error("parentPath must be inside the root directory");
63
+ }
64
+ return resolvedParentPath;
65
+ }
66
+ function normalizeFilePath(rootPath, filePath) {
67
+ const resolvedFilePath = resolve(filePath);
68
+ if (!isPathInsideRoot(rootPath, resolvedFilePath)) {
69
+ throw new Error("filePath must be inside the root directory");
70
+ }
71
+ return resolvedFilePath;
72
+ }
73
+ function isPathInsideRoot(rootPath, targetPath) {
74
+ const pathFromRoot = relative(rootPath, targetPath);
75
+ return (pathFromRoot === "" ||
76
+ (!pathFromRoot.startsWith("..") && !isAbsolute(pathFromRoot)));
77
+ }
78
+ async function createIgnoreMatcher(parentPath, options) {
79
+ const ignoredNames = new Set(options.ignores ?? []);
80
+ const gitIgnoreRules = options.useGitIgnore
81
+ ? await loadGitIgnoreRules(parentPath)
82
+ : [];
83
+ return (entryPath, name, isDirectory) => {
84
+ if (ignoredNames.has(name)) {
85
+ return true;
86
+ }
87
+ const relativeEntryPath = normalizeRelativePath(relative(parentPath, entryPath));
88
+ return isIgnoredByGitIgnoreRules(relativeEntryPath, name, isDirectory, gitIgnoreRules);
89
+ };
90
+ }
91
+ async function listEntriesRecursive(parentPath, ignoreMatcher) {
92
+ const entries = await readdir(parentPath, { withFileTypes: true });
93
+ const visibleEntries = await Promise.all(entries
94
+ .filter((entry) => !entry.name.startsWith("."))
95
+ .filter((entry) => entry.isDirectory() || entry.isFile())
96
+ .filter((entry) => {
97
+ const entryPath = resolve(parentPath, entry.name);
98
+ return !ignoreMatcher(entryPath, entry.name, entry.isDirectory());
99
+ })
100
+ .map(async (entry) => {
101
+ const entryPath = resolve(parentPath, entry.name);
102
+ const isDirectory = entry.isDirectory();
103
+ return {
104
+ ...(isDirectory
105
+ ? { children: await listEntriesRecursive(entryPath, ignoreMatcher) }
106
+ : {}),
107
+ extension: isDirectory ? "" : extname(entry.name),
108
+ kind: isDirectory ? "folder" : "file",
109
+ name: entry.name,
110
+ path: entryPath
111
+ };
112
+ }));
113
+ return visibleEntries.sort(compareEntries);
114
+ }
115
+ async function loadGitIgnoreRules(parentPath) {
116
+ let gitIgnoreContent = "";
117
+ try {
118
+ gitIgnoreContent = await readFile(resolve(parentPath, ".gitignore"), "utf8");
119
+ }
120
+ catch (error) {
121
+ if (isNodeError(error) && error.code === "ENOENT") {
122
+ return [];
123
+ }
124
+ throw error;
125
+ }
126
+ return gitIgnoreContent
127
+ .split(/\r?\n/u)
128
+ .map(parseGitIgnoreRule)
129
+ .filter((rule) => rule !== null);
130
+ }
131
+ function parseGitIgnoreRule(line) {
132
+ let pattern = line.trim();
133
+ if (!pattern || pattern.startsWith("#")) {
134
+ return null;
135
+ }
136
+ if (pattern.startsWith("\\#") || pattern.startsWith("\\!")) {
137
+ pattern = pattern.slice(1);
138
+ }
139
+ const ignored = !pattern.startsWith("!");
140
+ pattern = ignored ? pattern : pattern.slice(1);
141
+ if (!pattern) {
142
+ return null;
143
+ }
144
+ if (pattern.startsWith("/")) {
145
+ pattern = pattern.slice(1);
146
+ }
147
+ const directoryOnly = pattern.endsWith("/");
148
+ pattern = directoryOnly ? pattern.slice(0, -1) : pattern;
149
+ if (!pattern) {
150
+ return null;
151
+ }
152
+ return {
153
+ directoryOnly,
154
+ hasSlash: pattern.includes("/"),
155
+ ignored,
156
+ pattern,
157
+ regex: createGitIgnorePatternRegex(pattern)
158
+ };
159
+ }
160
+ function isIgnoredByGitIgnoreRules(relativeEntryPath, name, isDirectory, rules) {
161
+ let ignored = false;
162
+ for (const rule of rules) {
163
+ if (rule.directoryOnly && !isDirectory) {
164
+ continue;
165
+ }
166
+ const target = rule.hasSlash ? relativeEntryPath : name;
167
+ if (rule.regex.test(target)) {
168
+ ignored = rule.ignored;
169
+ }
170
+ }
171
+ return ignored;
172
+ }
173
+ function createGitIgnorePatternRegex(pattern) {
174
+ let source = "";
175
+ for (let index = 0; index < pattern.length; index += 1) {
176
+ const character = pattern[index] ?? "";
177
+ const nextCharacter = pattern[index + 1];
178
+ if (character === "*" && nextCharacter === "*") {
179
+ source += ".*";
180
+ index += 1;
181
+ continue;
182
+ }
183
+ if (character === "*") {
184
+ source += "[^/]*";
185
+ continue;
186
+ }
187
+ if (character === "?") {
188
+ source += "[^/]";
189
+ continue;
190
+ }
191
+ source += escapeRegexCharacter(character);
192
+ }
193
+ return new RegExp(`^${source}$`, "u");
194
+ }
195
+ function normalizeRelativePath(path) {
196
+ return path.replace(/\\/gu, "/");
197
+ }
198
+ function escapeRegexCharacter(character) {
199
+ return character.replace(/[|\\{}()[\]^$+*?.]/gu, "\\$&");
200
+ }
201
+ function isNodeError(error) {
202
+ return error instanceof Error && "code" in error;
203
+ }
204
+ function compareEntries(left, right) {
205
+ if (left.kind !== right.kind) {
206
+ return left.kind === "folder" ? -1 : 1;
207
+ }
208
+ return left.name.localeCompare(right.name);
209
+ }
@@ -0,0 +1,4 @@
1
+ export { createFileSystemRouter } from "./file-system-router";
2
+ export type { CreateFileSystemRouterOptions } from "./file-system-router";
3
+ export type { FileSystemDirectoryListing, FileSystemEntry, FileSystemEntryKind } from "./file-system-service";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/file-system/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,YAAY,EAAE,6BAA6B,EAAE,MAAM,sBAAsB,CAAC;AAC1E,YAAY,EACV,0BAA0B,EAC1B,eAAe,EACf,mBAAmB,EACpB,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1 @@
1
+ export { createFileSystemRouter } from "./file-system-router.js";
@@ -0,0 +1,3 @@
1
+ import { Router } from "express";
2
+ export declare function createHealthRouter(): Router;
3
+ //# sourceMappingURL=health-router.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"health-router.d.ts","sourceRoot":"","sources":["../../../src/modules/health/health-router.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAA+B,MAAM,SAAS,CAAC;AAK9D,wBAAgB,kBAAkB,IAAI,MAAM,CAQ3C"}
@@ -0,0 +1,10 @@
1
+ import { Router } from "express";
2
+ import { sendSuccess } from "../../response/index.js";
3
+ import { getHealthStatus } from "../../service/health-service.js";
4
+ export function createHealthRouter() {
5
+ const router = Router();
6
+ router.get("/health", (_request, response) => {
7
+ sendSuccess(response, getHealthStatus());
8
+ });
9
+ return router;
10
+ }
@@ -0,0 +1,2 @@
1
+ export { createHealthRouter } from "./health-router";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/health/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1 @@
1
+ export { createHealthRouter } from "./health-router.js";
@@ -0,0 +1,3 @@
1
+ import { type ModelProvidersService } from "./model-providers-service";
2
+ export declare function getDefaultModelProvidersService(): ModelProvidersService;
3
+ //# sourceMappingURL=default-model-provider-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default-model-provider-service.d.ts","sourceRoot":"","sources":["../../../src/modules/model-providers/default-model-provider-service.ts"],"names":[],"mappings":"AAOA,OAAO,EAEL,KAAK,qBAAqB,EAC3B,MAAM,2BAA2B,CAAC;AAKnC,wBAAgB,+BAA+B,IAAI,qBAAqB,CAoBvE"}
@@ -0,0 +1,21 @@
1
+ import { loadApiEnv } from "../../config/env.js";
2
+ import { DB_FILE } from "../../config/const.js";
3
+ import { createDatabase, migrateDatabase } from "../../db/index.js";
4
+ import { createSqliteModelProviderRepository } from "./model-provider-repository.js";
5
+ import { createModelProvidersService } from "./model-providers-service.js";
6
+ let repository;
7
+ let service;
8
+ export function getDefaultModelProvidersService() {
9
+ if (service) {
10
+ return service;
11
+ }
12
+ loadApiEnv();
13
+ const database = createDatabase(process.env.SQLITE_DB_PATH ?? DB_FILE);
14
+ migrateDatabase(database.sqlite);
15
+ repository = createSqliteModelProviderRepository(database);
16
+ service = createModelProvidersService({
17
+ providerApiKeyEncryptionKey: process.env.PROVIDER_API_KEY_ENCRYPTION_KEY ?? "",
18
+ repository
19
+ });
20
+ return service;
21
+ }
@@ -0,0 +1,5 @@
1
+ export { getDefaultModelProvidersService } from "./default-model-provider-service";
2
+ export { createModelProvidersRouter } from "./model-providers-router";
3
+ export { createInMemoryModelProviderRepository, createSqliteModelProviderRepository } from "./model-provider-repository";
4
+ export { createModelProvidersService } from "./model-providers-service";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/model-providers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,kCAAkC,CAAC;AACnF,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EACL,qCAAqC,EACrC,mCAAmC,EACpC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { getDefaultModelProvidersService } from "./default-model-provider-service.js";
2
+ export { createModelProvidersRouter } from "./model-providers-router.js";
3
+ export { createInMemoryModelProviderRepository, createSqliteModelProviderRepository } from "./model-provider-repository.js";
4
+ export { createModelProvidersService } from "./model-providers-service.js";