@contractspec/example.agent-console 1.57.0 → 1.59.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 (386) hide show
  1. package/.turbo/turbo-build.log +210 -278
  2. package/.turbo/turbo-prebuild.log +1 -0
  3. package/CHANGELOG.md +31 -0
  4. package/dist/agent/agent.entity.d.ts +35 -40
  5. package/dist/agent/agent.entity.d.ts.map +1 -1
  6. package/dist/agent/agent.entity.js +124 -132
  7. package/dist/agent/agent.enum.d.ts +3 -8
  8. package/dist/agent/agent.enum.d.ts.map +1 -1
  9. package/dist/agent/agent.enum.js +22 -30
  10. package/dist/agent/agent.event.d.ts +105 -111
  11. package/dist/agent/agent.event.d.ts.map +1 -1
  12. package/dist/agent/agent.event.js +107 -200
  13. package/dist/agent/agent.handler.d.ts +74 -77
  14. package/dist/agent/agent.handler.d.ts.map +1 -1
  15. package/dist/agent/agent.handler.js +293 -75
  16. package/dist/agent/agent.operation.d.ts +424 -430
  17. package/dist/agent/agent.operation.d.ts.map +1 -1
  18. package/dist/agent/agent.operation.js +728 -478
  19. package/dist/agent/agent.presentation.d.ts +3 -8
  20. package/dist/agent/agent.presentation.d.ts.map +1 -1
  21. package/dist/agent/agent.presentation.js +275 -84
  22. package/dist/agent/agent.schema.d.ts +371 -376
  23. package/dist/agent/agent.schema.d.ts.map +1 -1
  24. package/dist/agent/agent.schema.js +209 -399
  25. package/dist/agent/agent.test-spec.d.ts +2 -7
  26. package/dist/agent/agent.test-spec.d.ts.map +1 -1
  27. package/dist/agent/agent.test-spec.js +56 -62
  28. package/dist/agent/index.d.ts +11 -8
  29. package/dist/agent/index.d.ts.map +1 -0
  30. package/dist/agent/index.js +1245 -9
  31. package/dist/agent.capability.d.ts +1 -6
  32. package/dist/agent.capability.d.ts.map +1 -1
  33. package/dist/agent.capability.js +17 -20
  34. package/dist/agent.feature.d.ts +7 -6
  35. package/dist/agent.feature.d.ts.map +1 -1
  36. package/dist/agent.feature.js +117 -303
  37. package/dist/browser/agent/agent.entity.js +127 -0
  38. package/dist/browser/agent/agent.enum.js +25 -0
  39. package/dist/browser/agent/agent.event.js +116 -0
  40. package/dist/browser/agent/agent.handler.js +301 -0
  41. package/dist/browser/agent/agent.operation.js +735 -0
  42. package/dist/browser/agent/agent.presentation.js +279 -0
  43. package/dist/browser/agent/agent.schema.js +215 -0
  44. package/dist/browser/agent/agent.test-spec.js +58 -0
  45. package/dist/browser/agent/index.js +1244 -0
  46. package/dist/browser/agent.capability.js +16 -0
  47. package/dist/browser/agent.feature.js +118 -0
  48. package/dist/browser/docs/agent-console.docblock.js +93 -0
  49. package/dist/browser/docs/index.js +93 -0
  50. package/dist/browser/example.js +42 -0
  51. package/dist/browser/handlers/agent.handlers.js +252 -0
  52. package/dist/browser/handlers/index.js +799 -0
  53. package/dist/browser/index.js +5895 -0
  54. package/dist/browser/presentations/index.js +684 -0
  55. package/dist/browser/run/index.js +1350 -0
  56. package/dist/browser/run/run.entity.js +160 -0
  57. package/dist/browser/run/run.enum.js +34 -0
  58. package/dist/browser/run/run.event.js +213 -0
  59. package/dist/browser/run/run.handler.js +254 -0
  60. package/dist/browser/run/run.operation.js +667 -0
  61. package/dist/browser/run/run.presentation.js +220 -0
  62. package/dist/browser/run/run.schema.js +179 -0
  63. package/dist/browser/run/run.test-spec.js +58 -0
  64. package/dist/browser/seeders/index.js +21 -0
  65. package/dist/browser/shared/index.js +334 -0
  66. package/dist/browser/shared/mock-agents.js +82 -0
  67. package/dist/browser/shared/mock-runs.js +108 -0
  68. package/dist/browser/shared/mock-tools.js +146 -0
  69. package/dist/browser/shared/overlay-types.js +0 -0
  70. package/dist/browser/tool/index.js +946 -0
  71. package/dist/browser/tool/tool.entity.js +90 -0
  72. package/dist/browser/tool/tool.enum.js +26 -0
  73. package/dist/browser/tool/tool.event.js +99 -0
  74. package/dist/browser/tool/tool.handler.js +223 -0
  75. package/dist/browser/tool/tool.operation.js +482 -0
  76. package/dist/browser/tool/tool.presentation.js +185 -0
  77. package/dist/browser/tool/tool.schema.js +141 -0
  78. package/dist/browser/tool/tool.test-spec.js +58 -0
  79. package/dist/browser/ui/AgentDashboard.js +1607 -0
  80. package/dist/browser/ui/AgentRunList.js +250 -0
  81. package/dist/browser/ui/AgentToolRegistry.js +212 -0
  82. package/dist/browser/ui/hooks/index.js +271 -0
  83. package/dist/browser/ui/hooks/useAgentList.js +55 -0
  84. package/dist/browser/ui/hooks/useAgentMutations.js +76 -0
  85. package/dist/browser/ui/hooks/useRunList.js +55 -0
  86. package/dist/browser/ui/hooks/useToolList.js +85 -0
  87. package/dist/browser/ui/index.js +2080 -0
  88. package/dist/browser/ui/modals/AgentActionsModal.js +304 -0
  89. package/dist/browser/ui/modals/CreateAgentModal.js +229 -0
  90. package/dist/browser/ui/modals/index.js +532 -0
  91. package/dist/browser/ui/overlays/demo-overlays.js +64 -0
  92. package/dist/browser/ui/overlays/index.js +64 -0
  93. package/dist/browser/ui/renderers/agent-list.markdown.js +55 -0
  94. package/dist/browser/ui/renderers/agent-list.renderer.js +180 -0
  95. package/dist/browser/ui/renderers/dashboard.markdown.js +117 -0
  96. package/dist/browser/ui/renderers/index.js +446 -0
  97. package/dist/browser/ui/renderers/run-list.markdown.js +45 -0
  98. package/dist/browser/ui/renderers/tool-registry.markdown.js +53 -0
  99. package/dist/browser/ui/views/AgentListView.js +165 -0
  100. package/dist/browser/ui/views/RunListView.js +247 -0
  101. package/dist/browser/ui/views/ToolRegistryView.js +209 -0
  102. package/dist/browser/ui/views/index.js +619 -0
  103. package/dist/docs/agent-console.docblock.d.ts +2 -1
  104. package/dist/docs/agent-console.docblock.d.ts.map +1 -0
  105. package/dist/docs/agent-console.docblock.js +45 -64
  106. package/dist/docs/index.d.ts +2 -1
  107. package/dist/docs/index.d.ts.map +1 -0
  108. package/dist/docs/index.js +94 -1
  109. package/dist/example.d.ts +2 -6
  110. package/dist/example.d.ts.map +1 -1
  111. package/dist/example.js +41 -55
  112. package/dist/handlers/agent.handlers.d.ts +121 -120
  113. package/dist/handlers/agent.handlers.d.ts.map +1 -1
  114. package/dist/handlers/agent.handlers.js +235 -245
  115. package/dist/handlers/index.d.ts +8 -5
  116. package/dist/handlers/index.d.ts.map +1 -0
  117. package/dist/handlers/index.js +799 -5
  118. package/dist/index.d.ts +26 -48
  119. package/dist/index.d.ts.map +1 -0
  120. package/dist/index.js +5896 -50
  121. package/dist/node/agent/agent.entity.js +127 -0
  122. package/dist/node/agent/agent.enum.js +25 -0
  123. package/dist/node/agent/agent.event.js +116 -0
  124. package/dist/node/agent/agent.handler.js +301 -0
  125. package/dist/node/agent/agent.operation.js +735 -0
  126. package/dist/node/agent/agent.presentation.js +279 -0
  127. package/dist/node/agent/agent.schema.js +215 -0
  128. package/dist/node/agent/agent.test-spec.js +58 -0
  129. package/dist/node/agent/index.js +1244 -0
  130. package/dist/node/agent.capability.js +16 -0
  131. package/dist/node/agent.feature.js +118 -0
  132. package/dist/node/docs/agent-console.docblock.js +93 -0
  133. package/dist/node/docs/index.js +93 -0
  134. package/dist/node/example.js +42 -0
  135. package/dist/node/handlers/agent.handlers.js +252 -0
  136. package/dist/node/handlers/index.js +799 -0
  137. package/dist/node/index.js +5895 -0
  138. package/dist/node/presentations/index.js +684 -0
  139. package/dist/node/run/index.js +1350 -0
  140. package/dist/node/run/run.entity.js +160 -0
  141. package/dist/node/run/run.enum.js +34 -0
  142. package/dist/node/run/run.event.js +213 -0
  143. package/dist/node/run/run.handler.js +254 -0
  144. package/dist/node/run/run.operation.js +667 -0
  145. package/dist/node/run/run.presentation.js +220 -0
  146. package/dist/node/run/run.schema.js +179 -0
  147. package/dist/node/run/run.test-spec.js +58 -0
  148. package/dist/node/seeders/index.js +21 -0
  149. package/dist/node/shared/index.js +334 -0
  150. package/dist/node/shared/mock-agents.js +82 -0
  151. package/dist/node/shared/mock-runs.js +108 -0
  152. package/dist/node/shared/mock-tools.js +146 -0
  153. package/dist/node/shared/overlay-types.js +0 -0
  154. package/dist/node/tool/index.js +946 -0
  155. package/dist/node/tool/tool.entity.js +90 -0
  156. package/dist/node/tool/tool.enum.js +26 -0
  157. package/dist/node/tool/tool.event.js +99 -0
  158. package/dist/node/tool/tool.handler.js +223 -0
  159. package/dist/node/tool/tool.operation.js +482 -0
  160. package/dist/node/tool/tool.presentation.js +185 -0
  161. package/dist/node/tool/tool.schema.js +141 -0
  162. package/dist/node/tool/tool.test-spec.js +58 -0
  163. package/dist/node/ui/AgentDashboard.js +1607 -0
  164. package/dist/node/ui/AgentRunList.js +250 -0
  165. package/dist/node/ui/AgentToolRegistry.js +212 -0
  166. package/dist/node/ui/hooks/index.js +271 -0
  167. package/dist/node/ui/hooks/useAgentList.js +55 -0
  168. package/dist/node/ui/hooks/useAgentMutations.js +76 -0
  169. package/dist/node/ui/hooks/useRunList.js +55 -0
  170. package/dist/node/ui/hooks/useToolList.js +85 -0
  171. package/dist/node/ui/index.js +2080 -0
  172. package/dist/node/ui/modals/AgentActionsModal.js +304 -0
  173. package/dist/node/ui/modals/CreateAgentModal.js +229 -0
  174. package/dist/node/ui/modals/index.js +532 -0
  175. package/dist/node/ui/overlays/demo-overlays.js +64 -0
  176. package/dist/node/ui/overlays/index.js +64 -0
  177. package/dist/node/ui/renderers/agent-list.markdown.js +55 -0
  178. package/dist/node/ui/renderers/agent-list.renderer.js +180 -0
  179. package/dist/node/ui/renderers/dashboard.markdown.js +117 -0
  180. package/dist/node/ui/renderers/index.js +446 -0
  181. package/dist/node/ui/renderers/run-list.markdown.js +45 -0
  182. package/dist/node/ui/renderers/tool-registry.markdown.js +53 -0
  183. package/dist/node/ui/views/AgentListView.js +165 -0
  184. package/dist/node/ui/views/RunListView.js +247 -0
  185. package/dist/node/ui/views/ToolRegistryView.js +209 -0
  186. package/dist/node/ui/views/index.js +619 -0
  187. package/dist/presentations/index.d.ts +9 -4
  188. package/dist/presentations/index.d.ts.map +1 -0
  189. package/dist/presentations/index.js +684 -4
  190. package/dist/run/index.d.ts +11 -8
  191. package/dist/run/index.d.ts.map +1 -0
  192. package/dist/run/index.js +1351 -9
  193. package/dist/run/run.entity.d.ts +55 -60
  194. package/dist/run/run.entity.d.ts.map +1 -1
  195. package/dist/run/run.entity.js +155 -199
  196. package/dist/run/run.enum.d.ts +4 -9
  197. package/dist/run/run.enum.d.ts.map +1 -1
  198. package/dist/run/run.enum.js +30 -40
  199. package/dist/run/run.event.d.ts +255 -261
  200. package/dist/run/run.event.d.ts.map +1 -1
  201. package/dist/run/run.event.js +198 -418
  202. package/dist/run/run.handler.d.ts +169 -172
  203. package/dist/run/run.handler.d.ts.map +1 -1
  204. package/dist/run/run.handler.js +246 -74
  205. package/dist/run/run.operation.d.ts +658 -664
  206. package/dist/run/run.operation.d.ts.map +1 -1
  207. package/dist/run/run.operation.js +659 -617
  208. package/dist/run/run.presentation.d.ts +2 -7
  209. package/dist/run/run.presentation.d.ts.map +1 -1
  210. package/dist/run/run.presentation.js +217 -61
  211. package/dist/run/run.schema.d.ts +367 -372
  212. package/dist/run/run.schema.d.ts.map +1 -1
  213. package/dist/run/run.schema.js +172 -330
  214. package/dist/run/run.test-spec.d.ts +2 -7
  215. package/dist/run/run.test-spec.d.ts.map +1 -1
  216. package/dist/run/run.test-spec.js +56 -62
  217. package/dist/seeders/index.d.ts +4 -8
  218. package/dist/seeders/index.d.ts.map +1 -1
  219. package/dist/seeders/index.js +19 -17
  220. package/dist/shared/index.d.ts +7 -4
  221. package/dist/shared/index.d.ts.map +1 -0
  222. package/dist/shared/index.js +334 -4
  223. package/dist/shared/mock-agents.d.ts +77 -80
  224. package/dist/shared/mock-agents.d.ts.map +1 -1
  225. package/dist/shared/mock-agents.js +82 -93
  226. package/dist/shared/mock-runs.d.ts +107 -110
  227. package/dist/shared/mock-runs.d.ts.map +1 -1
  228. package/dist/shared/mock-runs.js +108 -117
  229. package/dist/shared/mock-tools.d.ts +217 -220
  230. package/dist/shared/mock-tools.d.ts.map +1 -1
  231. package/dist/shared/mock-tools.js +146 -180
  232. package/dist/shared/overlay-types.d.ts +25 -28
  233. package/dist/shared/overlay-types.d.ts.map +1 -1
  234. package/dist/shared/overlay-types.js +1 -0
  235. package/dist/tool/index.d.ts +11 -8
  236. package/dist/tool/index.d.ts.map +1 -0
  237. package/dist/tool/index.js +947 -9
  238. package/dist/tool/tool.entity.d.ts +23 -28
  239. package/dist/tool/tool.entity.d.ts.map +1 -1
  240. package/dist/tool/tool.entity.js +87 -101
  241. package/dist/tool/tool.enum.d.ts +3 -8
  242. package/dist/tool/tool.enum.d.ts.map +1 -1
  243. package/dist/tool/tool.enum.js +23 -31
  244. package/dist/tool/tool.event.d.ts +84 -90
  245. package/dist/tool/tool.event.d.ts.map +1 -1
  246. package/dist/tool/tool.event.js +92 -151
  247. package/dist/tool/tool.handler.d.ts +266 -269
  248. package/dist/tool/tool.handler.d.ts.map +1 -1
  249. package/dist/tool/tool.handler.js +213 -76
  250. package/dist/tool/tool.operation.d.ts +359 -365
  251. package/dist/tool/tool.operation.d.ts.map +1 -1
  252. package/dist/tool/tool.operation.js +477 -400
  253. package/dist/tool/tool.presentation.d.ts +2 -7
  254. package/dist/tool/tool.presentation.d.ts.map +1 -1
  255. package/dist/tool/tool.presentation.js +182 -61
  256. package/dist/tool/tool.schema.d.ts +196 -201
  257. package/dist/tool/tool.schema.d.ts.map +1 -1
  258. package/dist/tool/tool.schema.js +137 -231
  259. package/dist/tool/tool.test-spec.d.ts +2 -7
  260. package/dist/tool/tool.test-spec.d.ts.map +1 -1
  261. package/dist/tool/tool.test-spec.js +56 -62
  262. package/dist/ui/AgentDashboard.d.ts +1 -6
  263. package/dist/ui/AgentDashboard.d.ts.map +1 -1
  264. package/dist/ui/AgentDashboard.js +1598 -410
  265. package/dist/ui/AgentRunList.d.ts +7 -2
  266. package/dist/ui/AgentRunList.d.ts.map +1 -0
  267. package/dist/ui/AgentRunList.js +249 -3
  268. package/dist/ui/AgentToolRegistry.d.ts +7 -2
  269. package/dist/ui/AgentToolRegistry.d.ts.map +1 -0
  270. package/dist/ui/AgentToolRegistry.js +211 -3
  271. package/dist/ui/hooks/index.d.ts +8 -6
  272. package/dist/ui/hooks/index.d.ts.map +1 -0
  273. package/dist/ui/hooks/index.js +270 -6
  274. package/dist/ui/hooks/useAgentList.d.ts +21 -25
  275. package/dist/ui/hooks/useAgentList.d.ts.map +1 -1
  276. package/dist/ui/hooks/useAgentList.js +52 -62
  277. package/dist/ui/hooks/useAgentMutations.d.ts +22 -25
  278. package/dist/ui/hooks/useAgentMutations.d.ts.map +1 -1
  279. package/dist/ui/hooks/useAgentMutations.js +73 -120
  280. package/dist/ui/hooks/useRunList.d.ts +17 -21
  281. package/dist/ui/hooks/useRunList.d.ts.map +1 -1
  282. package/dist/ui/hooks/useRunList.js +52 -62
  283. package/dist/ui/hooks/useToolList.d.ts +32 -36
  284. package/dist/ui/hooks/useToolList.d.ts.map +1 -1
  285. package/dist/ui/hooks/useToolList.js +82 -92
  286. package/dist/ui/index.d.ts +9 -24
  287. package/dist/ui/index.d.ts.map +1 -0
  288. package/dist/ui/index.js +2081 -24
  289. package/dist/ui/modals/AgentActionsModal.d.ts +11 -24
  290. package/dist/ui/modals/AgentActionsModal.d.ts.map +1 -1
  291. package/dist/ui/modals/AgentActionsModal.js +300 -257
  292. package/dist/ui/modals/CreateAgentModal.d.ts +12 -21
  293. package/dist/ui/modals/CreateAgentModal.d.ts.map +1 -1
  294. package/dist/ui/modals/CreateAgentModal.js +226 -210
  295. package/dist/ui/modals/index.d.ts +3 -3
  296. package/dist/ui/modals/index.d.ts.map +1 -0
  297. package/dist/ui/modals/index.js +532 -3
  298. package/dist/ui/overlays/demo-overlays.d.ts +10 -8
  299. package/dist/ui/overlays/demo-overlays.d.ts.map +1 -1
  300. package/dist/ui/overlays/demo-overlays.js +63 -71
  301. package/dist/ui/overlays/index.d.ts +2 -2
  302. package/dist/ui/overlays/index.d.ts.map +1 -0
  303. package/dist/ui/overlays/index.js +65 -3
  304. package/dist/ui/renderers/agent-list.markdown.d.ts +9 -8
  305. package/dist/ui/renderers/agent-list.markdown.d.ts.map +1 -1
  306. package/dist/ui/renderers/agent-list.markdown.js +55 -50
  307. package/dist/ui/renderers/agent-list.renderer.d.ts +5 -6
  308. package/dist/ui/renderers/agent-list.renderer.d.ts.map +1 -1
  309. package/dist/ui/renderers/agent-list.renderer.js +179 -17
  310. package/dist/ui/renderers/dashboard.markdown.d.ts +9 -8
  311. package/dist/ui/renderers/dashboard.markdown.d.ts.map +1 -1
  312. package/dist/ui/renderers/dashboard.markdown.js +115 -97
  313. package/dist/ui/renderers/index.d.ts +9 -6
  314. package/dist/ui/renderers/index.d.ts.map +1 -0
  315. package/dist/ui/renderers/index.js +446 -6
  316. package/dist/ui/renderers/run-list.markdown.d.ts +9 -8
  317. package/dist/ui/renderers/run-list.markdown.d.ts.map +1 -1
  318. package/dist/ui/renderers/run-list.markdown.js +42 -40
  319. package/dist/ui/renderers/tool-registry.markdown.d.ts +9 -8
  320. package/dist/ui/renderers/tool-registry.markdown.d.ts.map +1 -1
  321. package/dist/ui/renderers/tool-registry.markdown.js +52 -53
  322. package/dist/ui/views/AgentListView.d.ts +1 -6
  323. package/dist/ui/views/AgentListView.d.ts.map +1 -1
  324. package/dist/ui/views/AgentListView.js +161 -88
  325. package/dist/ui/views/RunListView.d.ts +4 -11
  326. package/dist/ui/views/RunListView.d.ts.map +1 -1
  327. package/dist/ui/views/RunListView.js +237 -154
  328. package/dist/ui/views/ToolRegistryView.d.ts +4 -11
  329. package/dist/ui/views/ToolRegistryView.d.ts.map +1 -1
  330. package/dist/ui/views/ToolRegistryView.js +205 -92
  331. package/dist/ui/views/index.d.ts +7 -4
  332. package/dist/ui/views/index.d.ts.map +1 -0
  333. package/dist/ui/views/index.js +619 -4
  334. package/package.json +656 -118
  335. package/tsdown.config.js +1 -2
  336. package/.turbo/turbo-build$colon$bundle.log +0 -285
  337. package/dist/agent/agent.entity.js.map +0 -1
  338. package/dist/agent/agent.enum.js.map +0 -1
  339. package/dist/agent/agent.event.js.map +0 -1
  340. package/dist/agent/agent.handler.js.map +0 -1
  341. package/dist/agent/agent.operation.js.map +0 -1
  342. package/dist/agent/agent.presentation.js.map +0 -1
  343. package/dist/agent/agent.schema.js.map +0 -1
  344. package/dist/agent/agent.test-spec.js.map +0 -1
  345. package/dist/agent.capability.js.map +0 -1
  346. package/dist/agent.feature.js.map +0 -1
  347. package/dist/docs/agent-console.docblock.js.map +0 -1
  348. package/dist/example.js.map +0 -1
  349. package/dist/handlers/agent.handlers.js.map +0 -1
  350. package/dist/run/run.entity.js.map +0 -1
  351. package/dist/run/run.enum.js.map +0 -1
  352. package/dist/run/run.event.js.map +0 -1
  353. package/dist/run/run.handler.js.map +0 -1
  354. package/dist/run/run.operation.js.map +0 -1
  355. package/dist/run/run.presentation.js.map +0 -1
  356. package/dist/run/run.schema.js.map +0 -1
  357. package/dist/run/run.test-spec.js.map +0 -1
  358. package/dist/seeders/index.js.map +0 -1
  359. package/dist/shared/mock-agents.js.map +0 -1
  360. package/dist/shared/mock-runs.js.map +0 -1
  361. package/dist/shared/mock-tools.js.map +0 -1
  362. package/dist/tool/tool.entity.js.map +0 -1
  363. package/dist/tool/tool.enum.js.map +0 -1
  364. package/dist/tool/tool.event.js.map +0 -1
  365. package/dist/tool/tool.handler.js.map +0 -1
  366. package/dist/tool/tool.operation.js.map +0 -1
  367. package/dist/tool/tool.presentation.js.map +0 -1
  368. package/dist/tool/tool.schema.js.map +0 -1
  369. package/dist/tool/tool.test-spec.js.map +0 -1
  370. package/dist/ui/AgentDashboard.js.map +0 -1
  371. package/dist/ui/hooks/useAgentList.js.map +0 -1
  372. package/dist/ui/hooks/useAgentMutations.js.map +0 -1
  373. package/dist/ui/hooks/useRunList.js.map +0 -1
  374. package/dist/ui/hooks/useToolList.js.map +0 -1
  375. package/dist/ui/modals/AgentActionsModal.js.map +0 -1
  376. package/dist/ui/modals/CreateAgentModal.js.map +0 -1
  377. package/dist/ui/overlays/demo-overlays.js.map +0 -1
  378. package/dist/ui/renderers/agent-list.markdown.js.map +0 -1
  379. package/dist/ui/renderers/agent-list.renderer.js.map +0 -1
  380. package/dist/ui/renderers/dashboard.markdown.js.map +0 -1
  381. package/dist/ui/renderers/run-list.markdown.js.map +0 -1
  382. package/dist/ui/renderers/tool-registry.markdown.js.map +0 -1
  383. package/dist/ui/views/AgentListView.js.map +0 -1
  384. package/dist/ui/views/RunListView.js.map +0 -1
  385. package/dist/ui/views/ToolRegistryView.js.map +0 -1
  386. package/tsconfig.tsbuildinfo +0 -1
@@ -0,0 +1,799 @@
1
+ // src/shared/mock-agents.ts
2
+ var MOCK_AGENTS = [
3
+ {
4
+ id: "agent-1",
5
+ organizationId: "demo-org",
6
+ name: "Customer Support Bot",
7
+ slug: "customer-support-bot",
8
+ description: "Handles tier-1 customer inquiries and routes complex issues.",
9
+ status: "ACTIVE",
10
+ modelProvider: "OPENAI",
11
+ modelName: "gpt-4o-mini",
12
+ modelConfig: { temperature: 0.7 },
13
+ systemPrompt: "You are a helpful customer support assistant.",
14
+ toolChoice: "auto",
15
+ maxIterations: 10,
16
+ timeoutMs: 120000,
17
+ version: "1.0.0",
18
+ tags: ["support", "tier-1"],
19
+ createdAt: new Date("2024-01-15T10:00:00Z"),
20
+ updatedAt: new Date("2024-03-20T14:30:00Z")
21
+ },
22
+ {
23
+ id: "agent-2",
24
+ organizationId: "demo-org",
25
+ name: "Code Review Assistant",
26
+ slug: "code-review-assistant",
27
+ description: "Reviews pull requests and provides actionable feedback.",
28
+ status: "ACTIVE",
29
+ modelProvider: "ANTHROPIC",
30
+ modelName: "claude-sonnet-4-20250514",
31
+ modelConfig: { temperature: 0.3 },
32
+ systemPrompt: "You are a code review expert.",
33
+ toolChoice: "auto",
34
+ maxIterations: 15,
35
+ timeoutMs: 180000,
36
+ version: "2.1.0",
37
+ tags: ["code", "review", "dev"],
38
+ createdAt: new Date("2024-02-10T09:00:00Z"),
39
+ updatedAt: new Date("2024-04-05T11:15:00Z")
40
+ },
41
+ {
42
+ id: "agent-3",
43
+ organizationId: "demo-org",
44
+ name: "Data Analyst",
45
+ slug: "data-analyst",
46
+ description: "Queries databases and generates insights from data.",
47
+ status: "PAUSED",
48
+ modelProvider: "OPENAI",
49
+ modelName: "gpt-4o",
50
+ modelConfig: { temperature: 0.5 },
51
+ systemPrompt: "You are a data analyst expert in SQL and analytics.",
52
+ toolChoice: "required",
53
+ maxIterations: 20,
54
+ timeoutMs: 300000,
55
+ version: "1.2.0",
56
+ tags: ["data", "analytics", "sql"],
57
+ createdAt: new Date("2024-03-01T08:00:00Z"),
58
+ updatedAt: new Date("2024-04-10T16:45:00Z")
59
+ },
60
+ {
61
+ id: "agent-4",
62
+ organizationId: "demo-org",
63
+ name: "Meeting Scheduler",
64
+ slug: "meeting-scheduler",
65
+ description: "Schedules meetings and manages calendar conflicts.",
66
+ status: "DRAFT",
67
+ modelProvider: "GOOGLE",
68
+ modelName: "gemini-2.0-flash",
69
+ modelConfig: { temperature: 0.2 },
70
+ systemPrompt: "You help schedule and organize meetings efficiently.",
71
+ toolChoice: "auto",
72
+ maxIterations: 5,
73
+ timeoutMs: 60000,
74
+ version: "0.1.0",
75
+ tags: ["calendar", "scheduling"],
76
+ createdAt: new Date("2024-04-01T12:00:00Z"),
77
+ updatedAt: new Date("2024-04-01T12:00:00Z")
78
+ }
79
+ ];
80
+
81
+ // src/shared/mock-tools.ts
82
+ var MOCK_TOOLS = [
83
+ {
84
+ id: "tool-1",
85
+ organizationId: "demo-org",
86
+ name: "Web Search",
87
+ slug: "web-search",
88
+ description: "Search the web for real-time information using Brave API.",
89
+ category: "RETRIEVAL",
90
+ status: "ACTIVE",
91
+ parametersSchema: {
92
+ type: "object",
93
+ properties: {
94
+ query: { type: "string", description: "Search query" },
95
+ numResults: { type: "number", default: 10 }
96
+ },
97
+ required: ["query"]
98
+ },
99
+ outputSchema: { type: "array", items: { type: "object" } },
100
+ implementationType: "http",
101
+ implementationConfig: {
102
+ url: "https://api.brave.com/search",
103
+ method: "GET"
104
+ },
105
+ maxInvocationsPerMinute: 60,
106
+ timeoutMs: 30000,
107
+ version: "1.0.0",
108
+ tags: ["search", "web"],
109
+ createdAt: new Date("2024-01-01T00:00:00Z"),
110
+ updatedAt: new Date("2024-02-15T10:00:00Z")
111
+ },
112
+ {
113
+ id: "tool-2",
114
+ organizationId: "demo-org",
115
+ name: "SQL Query",
116
+ slug: "sql-query",
117
+ description: "Execute read-only SQL queries against the data warehouse.",
118
+ category: "RETRIEVAL",
119
+ status: "ACTIVE",
120
+ parametersSchema: {
121
+ type: "object",
122
+ properties: {
123
+ query: { type: "string", description: "SQL query" },
124
+ maxRows: { type: "number", default: 100 }
125
+ },
126
+ required: ["query"]
127
+ },
128
+ outputSchema: { type: "object" },
129
+ implementationType: "function",
130
+ implementationConfig: { handler: "executeSqlQuery" },
131
+ maxInvocationsPerMinute: 30,
132
+ timeoutMs: 60000,
133
+ version: "1.1.0",
134
+ tags: ["sql", "database"],
135
+ createdAt: new Date("2024-01-05T00:00:00Z"),
136
+ updatedAt: new Date("2024-03-10T14:00:00Z")
137
+ },
138
+ {
139
+ id: "tool-3",
140
+ organizationId: "demo-org",
141
+ name: "Email Sender",
142
+ slug: "email-sender",
143
+ description: "Send emails via SMTP or API.",
144
+ category: "COMMUNICATION",
145
+ status: "ACTIVE",
146
+ parametersSchema: {
147
+ type: "object",
148
+ properties: {
149
+ to: { type: "string" },
150
+ subject: { type: "string" },
151
+ body: { type: "string" }
152
+ },
153
+ required: ["to", "subject", "body"]
154
+ },
155
+ implementationType: "http",
156
+ implementationConfig: { url: "/api/send-email", method: "POST" },
157
+ maxInvocationsPerMinute: 10,
158
+ timeoutMs: 30000,
159
+ version: "1.0.0",
160
+ tags: ["email", "communication"],
161
+ createdAt: new Date("2024-02-01T00:00:00Z"),
162
+ updatedAt: new Date("2024-02-01T00:00:00Z")
163
+ },
164
+ {
165
+ id: "tool-4",
166
+ organizationId: "demo-org",
167
+ name: "GitHub Integration",
168
+ slug: "github-integration",
169
+ description: "Interact with GitHub repositories, PRs, and issues.",
170
+ category: "INTEGRATION",
171
+ status: "ACTIVE",
172
+ parametersSchema: {
173
+ type: "object",
174
+ properties: {
175
+ action: {
176
+ type: "string",
177
+ enum: ["list_prs", "get_pr", "create_comment"]
178
+ },
179
+ repo: { type: "string" },
180
+ params: { type: "object" }
181
+ },
182
+ required: ["action", "repo"]
183
+ },
184
+ implementationType: "http",
185
+ implementationConfig: { url: "https://api.github.com", auth: "token" },
186
+ maxInvocationsPerMinute: 100,
187
+ timeoutMs: 15000,
188
+ version: "2.0.0",
189
+ tags: ["github", "integration", "code"],
190
+ createdAt: new Date("2024-02-20T00:00:00Z"),
191
+ updatedAt: new Date("2024-04-01T09:00:00Z")
192
+ },
193
+ {
194
+ id: "tool-5",
195
+ organizationId: "demo-org",
196
+ name: "Calculator",
197
+ slug: "calculator",
198
+ description: "Perform mathematical calculations.",
199
+ category: "COMPUTATION",
200
+ status: "ACTIVE",
201
+ parametersSchema: {
202
+ type: "object",
203
+ properties: {
204
+ expression: {
205
+ type: "string",
206
+ description: "Math expression to evaluate"
207
+ }
208
+ },
209
+ required: ["expression"]
210
+ },
211
+ outputSchema: {
212
+ type: "object",
213
+ properties: { result: { type: "number" } }
214
+ },
215
+ implementationType: "function",
216
+ implementationConfig: { handler: "evaluateMath" },
217
+ timeoutMs: 5000,
218
+ version: "1.0.0",
219
+ tags: ["math", "utility"],
220
+ createdAt: new Date("2024-01-10T00:00:00Z"),
221
+ updatedAt: new Date("2024-01-10T00:00:00Z")
222
+ }
223
+ ];
224
+
225
+ // src/agent/agent.handler.ts
226
+ async function mockListAgentsHandler(input) {
227
+ const {
228
+ organizationId,
229
+ status,
230
+ modelProvider,
231
+ search,
232
+ limit = 20,
233
+ offset = 0
234
+ } = input;
235
+ let filtered = MOCK_AGENTS.filter((a) => a.organizationId === organizationId);
236
+ if (status)
237
+ filtered = filtered.filter((a) => a.status === status);
238
+ if (modelProvider)
239
+ filtered = filtered.filter((a) => a.modelProvider === modelProvider);
240
+ if (search) {
241
+ const q = search.toLowerCase();
242
+ filtered = filtered.filter((a) => a.name.toLowerCase().includes(q) || a.description?.toLowerCase().includes(q) || a.tags?.some((t) => t.toLowerCase().includes(q)));
243
+ }
244
+ const total = filtered.length;
245
+ const items = filtered.slice(offset, offset + limit).map((a) => ({
246
+ id: a.id,
247
+ name: a.name,
248
+ slug: a.slug,
249
+ description: a.description,
250
+ status: a.status,
251
+ modelProvider: a.modelProvider,
252
+ modelName: a.modelName,
253
+ version: a.version,
254
+ createdAt: a.createdAt
255
+ }));
256
+ return { items, total, hasMore: offset + limit < total };
257
+ }
258
+ async function mockGetAgentHandler(input) {
259
+ const agent = MOCK_AGENTS.find((a) => a.id === input.agentId);
260
+ if (!agent)
261
+ throw new Error("AGENT_NOT_FOUND");
262
+ const result = { ...agent, toolIds: ["tool-1", "tool-2"] };
263
+ if (input.includeTools) {
264
+ result.tools = MOCK_TOOLS.slice(0, 2).map((t) => ({
265
+ id: t.id,
266
+ name: t.name,
267
+ slug: t.slug,
268
+ description: t.description,
269
+ category: t.category
270
+ }));
271
+ }
272
+ return result;
273
+ }
274
+ async function mockCreateAgentHandler(input) {
275
+ const exists = MOCK_AGENTS.some((a) => a.organizationId === input.organizationId && a.slug === input.slug);
276
+ if (exists)
277
+ throw new Error("SLUG_EXISTS");
278
+ return {
279
+ id: `agent-${Date.now()}`,
280
+ name: input.name,
281
+ slug: input.slug,
282
+ status: "DRAFT"
283
+ };
284
+ }
285
+ async function mockUpdateAgentHandler(input) {
286
+ const agent = MOCK_AGENTS.find((a) => a.id === input.agentId);
287
+ if (!agent)
288
+ throw new Error("AGENT_NOT_FOUND");
289
+ return {
290
+ id: agent.id,
291
+ name: input.name ?? agent.name,
292
+ status: input.status ?? agent.status,
293
+ updatedAt: new Date
294
+ };
295
+ }
296
+
297
+ // src/handlers/agent.handlers.ts
298
+ import { web } from "@contractspec/lib.runtime-sandbox";
299
+ var { generateId } = web;
300
+ function rowToAgent(row) {
301
+ return {
302
+ id: row.id,
303
+ projectId: row.projectId,
304
+ organizationId: row.organizationId,
305
+ name: row.name,
306
+ description: row.description ?? undefined,
307
+ modelProvider: row.modelProvider,
308
+ modelName: row.modelName,
309
+ systemPrompt: row.systemPrompt ?? undefined,
310
+ temperature: row.temperature,
311
+ maxTokens: row.maxTokens,
312
+ status: row.status,
313
+ createdAt: new Date(row.createdAt),
314
+ updatedAt: new Date(row.updatedAt)
315
+ };
316
+ }
317
+ function rowToTool(row) {
318
+ return {
319
+ id: row.id,
320
+ projectId: row.projectId,
321
+ organizationId: row.organizationId,
322
+ name: row.name,
323
+ description: row.description ?? undefined,
324
+ version: row.version,
325
+ category: row.category,
326
+ status: row.status,
327
+ inputSchema: row.inputSchema ?? undefined,
328
+ outputSchema: row.outputSchema ?? undefined,
329
+ endpoint: row.endpoint ?? undefined,
330
+ createdAt: new Date(row.createdAt),
331
+ updatedAt: new Date(row.updatedAt)
332
+ };
333
+ }
334
+ function rowToRun(row, agentName) {
335
+ return {
336
+ id: row.id,
337
+ projectId: row.projectId,
338
+ agentId: row.agentId,
339
+ agentName,
340
+ status: row.status,
341
+ input: row.input ?? undefined,
342
+ output: row.output ?? undefined,
343
+ totalTokens: row.totalTokens,
344
+ promptTokens: row.promptTokens,
345
+ completionTokens: row.completionTokens,
346
+ estimatedCostUsd: row.estimatedCostUsd,
347
+ durationMs: row.durationMs ?? undefined,
348
+ errorMessage: row.errorMessage ?? undefined,
349
+ queuedAt: new Date(row.queuedAt),
350
+ startedAt: row.startedAt ? new Date(row.startedAt) : undefined,
351
+ completedAt: row.completedAt ? new Date(row.completedAt) : undefined
352
+ };
353
+ }
354
+ function createAgentHandlers(db) {
355
+ async function listAgents(input) {
356
+ const {
357
+ projectId,
358
+ organizationId,
359
+ status,
360
+ search,
361
+ limit = 20,
362
+ offset = 0
363
+ } = input;
364
+ let whereClause = "WHERE projectId = ?";
365
+ const params = [projectId];
366
+ if (organizationId) {
367
+ whereClause += " AND organizationId = ?";
368
+ params.push(organizationId);
369
+ }
370
+ if (status && status !== "all") {
371
+ whereClause += " AND status = ?";
372
+ params.push(status);
373
+ }
374
+ if (search) {
375
+ whereClause += " AND (name LIKE ? OR description LIKE ?)";
376
+ params.push(`%${search}%`, `%${search}%`);
377
+ }
378
+ const countResult = (await db.query(`SELECT COUNT(*) as count FROM agent_definition ${whereClause}`, params)).rows;
379
+ const total = countResult[0]?.count ?? 0;
380
+ const rows = (await db.query(`SELECT * FROM agent_definition ${whereClause} ORDER BY createdAt DESC LIMIT ? OFFSET ?`, [...params, limit, offset])).rows;
381
+ return {
382
+ items: rows.map(rowToAgent),
383
+ total,
384
+ hasMore: offset + rows.length < total
385
+ };
386
+ }
387
+ async function getAgent(id) {
388
+ const rows = (await db.query(`SELECT * FROM agent_definition WHERE id = ?`, [id])).rows;
389
+ return rows[0] ? rowToAgent(rows[0]) : null;
390
+ }
391
+ async function createAgent(input, context) {
392
+ const id = generateId("agent");
393
+ const now = new Date().toISOString();
394
+ await db.execute(`INSERT INTO agent_definition (id, projectId, organizationId, name, description, modelProvider, modelName, systemPrompt, temperature, maxTokens, status, createdAt, updatedAt)
395
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, [
396
+ id,
397
+ context.projectId,
398
+ context.organizationId,
399
+ input.name,
400
+ input.description ?? null,
401
+ input.modelProvider ?? "openai",
402
+ input.modelName ?? "gpt-4",
403
+ input.systemPrompt ?? null,
404
+ input.temperature ?? 0.7,
405
+ input.maxTokens ?? 4096,
406
+ "DRAFT",
407
+ now,
408
+ now
409
+ ]);
410
+ const rows = (await db.query(`SELECT * FROM agent_definition WHERE id = ?`, [id])).rows;
411
+ const row = rows[0];
412
+ if (!row) {
413
+ throw new Error("Failed to retrieve created agent");
414
+ }
415
+ return rowToAgent(row);
416
+ }
417
+ async function updateAgent(input) {
418
+ const now = new Date().toISOString();
419
+ const updates = ["updatedAt = ?"];
420
+ const params = [now];
421
+ if (input.name !== undefined) {
422
+ updates.push("name = ?");
423
+ params.push(input.name);
424
+ }
425
+ if (input.description !== undefined) {
426
+ updates.push("description = ?");
427
+ params.push(input.description);
428
+ }
429
+ if (input.status !== undefined) {
430
+ updates.push("status = ?");
431
+ params.push(input.status);
432
+ }
433
+ params.push(input.id);
434
+ await db.execute(`UPDATE agent_definition SET ${updates.join(", ")} WHERE id = ?`, params);
435
+ const rows = (await db.query(`SELECT * FROM agent_definition WHERE id = ?`, [input.id])).rows;
436
+ if (!rows[0]) {
437
+ throw new Error("NOT_FOUND");
438
+ }
439
+ return rowToAgent(rows[0]);
440
+ }
441
+ async function listTools(input) {
442
+ const {
443
+ projectId,
444
+ organizationId,
445
+ category,
446
+ status,
447
+ search,
448
+ limit = 50,
449
+ offset = 0
450
+ } = input;
451
+ let whereClause = "WHERE projectId = ?";
452
+ const params = [projectId];
453
+ if (organizationId) {
454
+ whereClause += " AND organizationId = ?";
455
+ params.push(organizationId);
456
+ }
457
+ if (category && category !== "all") {
458
+ whereClause += " AND category = ?";
459
+ params.push(category);
460
+ }
461
+ if (status && status !== "all") {
462
+ whereClause += " AND status = ?";
463
+ params.push(status);
464
+ }
465
+ if (search) {
466
+ whereClause += " AND (name LIKE ? OR description LIKE ?)";
467
+ params.push(`%${search}%`, `%${search}%`);
468
+ }
469
+ const countResult = (await db.query(`SELECT COUNT(*) as count FROM agent_tool ${whereClause}`, params)).rows;
470
+ const total = countResult[0]?.count ?? 0;
471
+ const rows = (await db.query(`SELECT * FROM agent_tool ${whereClause} ORDER BY name ASC LIMIT ? OFFSET ?`, [...params, limit, offset])).rows;
472
+ return {
473
+ items: rows.map(rowToTool),
474
+ total,
475
+ hasMore: offset + rows.length < total
476
+ };
477
+ }
478
+ async function listRuns(input) {
479
+ const { projectId, agentId, status, limit = 20, offset = 0 } = input;
480
+ let whereClause = "WHERE r.projectId = ?";
481
+ const params = [projectId];
482
+ if (agentId) {
483
+ whereClause += " AND r.agentId = ?";
484
+ params.push(agentId);
485
+ }
486
+ if (status && status !== "all") {
487
+ whereClause += " AND r.status = ?";
488
+ params.push(status);
489
+ }
490
+ const countResult = (await db.query(`SELECT COUNT(*) as count FROM agent_run r ${whereClause}`, params)).rows;
491
+ const total = countResult[0]?.count ?? 0;
492
+ const rows = (await db.query(`SELECT r.*, a.name as agentName
493
+ FROM agent_run r
494
+ LEFT JOIN agent_definition a ON r.agentId = a.id
495
+ ${whereClause}
496
+ ORDER BY r.queuedAt DESC LIMIT ? OFFSET ?`, [...params, limit, offset])).rows;
497
+ return {
498
+ items: rows.map((r) => rowToRun(r, r.agentName)),
499
+ total,
500
+ hasMore: offset + rows.length < total
501
+ };
502
+ }
503
+ async function getRunMetrics(input) {
504
+ let whereClause = "WHERE projectId = ?";
505
+ const params = [input.projectId];
506
+ if (input.agentId) {
507
+ whereClause += " AND agentId = ?";
508
+ params.push(input.agentId);
509
+ }
510
+ if (input.startDate) {
511
+ whereClause += " AND queuedAt >= ?";
512
+ params.push(input.startDate.toISOString());
513
+ }
514
+ if (input.endDate) {
515
+ whereClause += " AND queuedAt <= ?";
516
+ params.push(input.endDate.toISOString());
517
+ }
518
+ const result = (await db.query(`SELECT
519
+ COUNT(*) as totalRuns,
520
+ SUM(CASE WHEN status = 'COMPLETED' THEN 1 ELSE 0 END) as completedRuns,
521
+ AVG(CASE WHEN status = 'COMPLETED' THEN durationMs ELSE NULL END) as avgDuration,
522
+ COALESCE(SUM(totalTokens), 0) as totalTokens,
523
+ COALESCE(SUM(estimatedCostUsd), 0) as totalCost
524
+ FROM agent_run ${whereClause}`, params)).rows;
525
+ const data = result[0];
526
+ const totalRuns = data?.totalRuns ?? 0;
527
+ const completedRuns = data?.completedRuns ?? 0;
528
+ return {
529
+ totalRuns,
530
+ successRate: totalRuns > 0 ? completedRuns / totalRuns : 0,
531
+ averageDurationMs: data?.avgDuration ?? 0,
532
+ totalTokens: data?.totalTokens ?? 0,
533
+ totalCostUsd: data?.totalCost ?? 0
534
+ };
535
+ }
536
+ return {
537
+ listAgents,
538
+ getAgent,
539
+ createAgent,
540
+ updateAgent,
541
+ listTools,
542
+ listRuns,
543
+ getRunMetrics
544
+ };
545
+ }
546
+
547
+ // src/shared/mock-runs.ts
548
+ var MOCK_RUNS = [
549
+ {
550
+ id: "run-1",
551
+ organizationId: "demo-org",
552
+ agentId: "agent-1",
553
+ agentName: "Customer Support Bot",
554
+ userId: "user-1",
555
+ sessionId: "session-1",
556
+ input: { message: "How do I reset my password?", context: {} },
557
+ output: { response: "You can reset your password by clicking..." },
558
+ status: "COMPLETED",
559
+ totalTokens: 1250,
560
+ promptTokens: 800,
561
+ completionTokens: 450,
562
+ totalIterations: 3,
563
+ durationMs: 4500,
564
+ estimatedCostUsd: 0.0025,
565
+ queuedAt: new Date("2024-04-15T10:00:00Z"),
566
+ startedAt: new Date("2024-04-15T10:00:01Z"),
567
+ completedAt: new Date("2024-04-15T10:00:05Z"),
568
+ steps: [],
569
+ logs: []
570
+ },
571
+ {
572
+ id: "run-2",
573
+ organizationId: "demo-org",
574
+ agentId: "agent-2",
575
+ agentName: "Code Review Assistant",
576
+ userId: "user-2",
577
+ input: { message: "Review PR #123", context: { prNumber: 123 } },
578
+ status: "IN_PROGRESS",
579
+ totalTokens: 3500,
580
+ promptTokens: 3000,
581
+ completionTokens: 500,
582
+ totalIterations: 5,
583
+ queuedAt: new Date("2024-04-15T10:30:00Z"),
584
+ startedAt: new Date("2024-04-15T10:30:02Z"),
585
+ steps: [],
586
+ logs: []
587
+ },
588
+ {
589
+ id: "run-3",
590
+ organizationId: "demo-org",
591
+ agentId: "agent-1",
592
+ agentName: "Customer Support Bot",
593
+ userId: "user-1",
594
+ input: { message: "What are your business hours?" },
595
+ output: { response: "Our business hours are 9 AM to 5 PM EST..." },
596
+ status: "COMPLETED",
597
+ totalTokens: 800,
598
+ promptTokens: 500,
599
+ completionTokens: 300,
600
+ totalIterations: 2,
601
+ durationMs: 2100,
602
+ estimatedCostUsd: 0.0012,
603
+ queuedAt: new Date("2024-04-15T09:00:00Z"),
604
+ startedAt: new Date("2024-04-15T09:00:01Z"),
605
+ completedAt: new Date("2024-04-15T09:00:03Z"),
606
+ steps: [],
607
+ logs: []
608
+ },
609
+ {
610
+ id: "run-4",
611
+ organizationId: "demo-org",
612
+ agentId: "agent-3",
613
+ agentName: "Data Analyst",
614
+ userId: "user-3",
615
+ input: { message: "Generate sales report for Q1" },
616
+ status: "FAILED",
617
+ errorMessage: "Database connection timeout",
618
+ errorCode: "DB_TIMEOUT",
619
+ totalTokens: 2000,
620
+ promptTokens: 1500,
621
+ completionTokens: 500,
622
+ totalIterations: 8,
623
+ durationMs: 45000,
624
+ queuedAt: new Date("2024-04-14T15:00:00Z"),
625
+ startedAt: new Date("2024-04-14T15:00:05Z"),
626
+ completedAt: new Date("2024-04-14T15:00:50Z"),
627
+ steps: [],
628
+ logs: []
629
+ },
630
+ {
631
+ id: "run-5",
632
+ organizationId: "demo-org",
633
+ agentId: "agent-2",
634
+ agentName: "Code Review Assistant",
635
+ userId: "user-2",
636
+ input: { message: "Review PR #120" },
637
+ output: { response: "Code review complete. 3 suggestions..." },
638
+ status: "COMPLETED",
639
+ totalTokens: 5200,
640
+ promptTokens: 4000,
641
+ completionTokens: 1200,
642
+ totalIterations: 7,
643
+ durationMs: 15000,
644
+ estimatedCostUsd: 0.0156,
645
+ queuedAt: new Date("2024-04-14T11:00:00Z"),
646
+ startedAt: new Date("2024-04-14T11:00:03Z"),
647
+ completedAt: new Date("2024-04-14T11:00:18Z"),
648
+ steps: [],
649
+ logs: []
650
+ }
651
+ ];
652
+
653
+ // src/run/run.handler.ts
654
+ async function mockListRunsHandler(input) {
655
+ const { agentId, status, limit = 20, offset = 0 } = input;
656
+ let filtered = [...MOCK_RUNS];
657
+ if (agentId)
658
+ filtered = filtered.filter((r) => r.agentId === agentId);
659
+ if (status)
660
+ filtered = filtered.filter((r) => r.status === status);
661
+ const total = filtered.length;
662
+ const items = filtered.slice(offset, offset + limit).map((r) => {
663
+ const agent = MOCK_AGENTS.find((a) => a.id === r.agentId);
664
+ return {
665
+ id: r.id,
666
+ agentId: r.agentId,
667
+ agentName: agent?.name ?? "Unknown",
668
+ status: r.status,
669
+ totalTokens: r.totalTokens,
670
+ durationMs: r.durationMs,
671
+ estimatedCostUsd: r.estimatedCostUsd,
672
+ queuedAt: r.queuedAt,
673
+ completedAt: r.completedAt
674
+ };
675
+ });
676
+ return { items, total, hasMore: offset + limit < total };
677
+ }
678
+ async function mockGetRunHandler(input) {
679
+ const run = MOCK_RUNS.find((r) => r.id === input.runId);
680
+ if (!run)
681
+ throw new Error("RUN_NOT_FOUND");
682
+ const agent = MOCK_AGENTS.find((a) => a.id === run.agentId);
683
+ return {
684
+ ...run,
685
+ agent: agent ? {
686
+ id: agent.id,
687
+ name: agent.name,
688
+ modelProvider: agent.modelProvider,
689
+ modelName: agent.modelName
690
+ } : undefined,
691
+ steps: input.includeSteps ? run.steps : undefined,
692
+ logs: input.includeLogs ? run.logs : undefined
693
+ };
694
+ }
695
+ async function mockExecuteAgentHandler(input) {
696
+ const agent = MOCK_AGENTS.find((a) => a.id === input.agentId);
697
+ if (!agent)
698
+ throw new Error("AGENT_NOT_FOUND");
699
+ if (agent.status !== "ACTIVE")
700
+ throw new Error("AGENT_NOT_ACTIVE");
701
+ return {
702
+ runId: `run-${Date.now()}`,
703
+ status: "QUEUED",
704
+ estimatedWaitMs: 500
705
+ };
706
+ }
707
+ async function mockCancelRunHandler(input) {
708
+ const run = MOCK_RUNS.find((r) => r.id === input.runId);
709
+ if (!run)
710
+ throw new Error("RUN_NOT_FOUND");
711
+ if (!["QUEUED", "IN_PROGRESS"].includes(run.status))
712
+ throw new Error("RUN_NOT_CANCELLABLE");
713
+ return { success: true, status: "CANCELLED" };
714
+ }
715
+
716
+ // src/tool/tool.handler.ts
717
+ async function mockListToolsHandler(input) {
718
+ const {
719
+ organizationId,
720
+ category,
721
+ status,
722
+ search,
723
+ limit = 20,
724
+ offset = 0
725
+ } = input;
726
+ let filtered = MOCK_TOOLS.filter((t) => t.organizationId === organizationId);
727
+ if (category)
728
+ filtered = filtered.filter((t) => t.category === category);
729
+ if (status)
730
+ filtered = filtered.filter((t) => t.status === status);
731
+ if (search) {
732
+ const q = search.toLowerCase();
733
+ filtered = filtered.filter((t) => t.name.toLowerCase().includes(q) || t.description.toLowerCase().includes(q));
734
+ }
735
+ const total = filtered.length;
736
+ const items = filtered.slice(offset, offset + limit).map((t) => ({
737
+ id: t.id,
738
+ name: t.name,
739
+ slug: t.slug,
740
+ description: t.description,
741
+ category: t.category,
742
+ status: t.status,
743
+ version: t.version,
744
+ createdAt: t.createdAt
745
+ }));
746
+ return { items, total, hasMore: offset + limit < total };
747
+ }
748
+ async function mockGetToolHandler(input) {
749
+ const tool = MOCK_TOOLS.find((t) => t.id === input.toolId);
750
+ if (!tool)
751
+ throw new Error("TOOL_NOT_FOUND");
752
+ return tool;
753
+ }
754
+ async function mockCreateToolHandler(input) {
755
+ const exists = MOCK_TOOLS.some((t) => t.organizationId === input.organizationId && t.slug === input.slug);
756
+ if (exists)
757
+ throw new Error("SLUG_EXISTS");
758
+ return {
759
+ id: `tool-${Date.now()}`,
760
+ name: input.name,
761
+ slug: input.slug,
762
+ status: "DRAFT"
763
+ };
764
+ }
765
+ async function mockUpdateToolHandler(input) {
766
+ const tool = MOCK_TOOLS.find((t) => t.id === input.toolId);
767
+ if (!tool)
768
+ throw new Error("TOOL_NOT_FOUND");
769
+ return {
770
+ id: tool.id,
771
+ name: input.name ?? tool.name,
772
+ status: input.status ?? tool.status,
773
+ updatedAt: new Date
774
+ };
775
+ }
776
+ async function mockTestToolHandler(input) {
777
+ const tool = MOCK_TOOLS.find((t) => t.id === input.toolId);
778
+ if (!tool)
779
+ throw new Error("TOOL_NOT_FOUND");
780
+ const startTime = Date.now();
781
+ await new Promise((resolve) => setTimeout(resolve, 100));
782
+ return {
783
+ success: true,
784
+ output: { result: "Test successful", input: input.testInput },
785
+ durationMs: Date.now() - startTime
786
+ };
787
+ }
788
+ export {
789
+ mockListToolsHandler,
790
+ mockListRunsHandler,
791
+ mockListAgentsHandler,
792
+ mockGetToolHandler,
793
+ mockGetRunHandler,
794
+ mockGetAgentHandler,
795
+ mockExecuteAgentHandler,
796
+ mockCreateToolHandler,
797
+ mockCreateAgentHandler,
798
+ createAgentHandlers
799
+ };