@contractspec/example.agent-console 0.0.0-canary-20260113170453

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 (306) hide show
  1. package/.turbo/turbo-build$colon$bundle.log +280 -0
  2. package/.turbo/turbo-build.log +281 -0
  3. package/CHANGELOG.md +368 -0
  4. package/LICENSE +21 -0
  5. package/README.md +86 -0
  6. package/dist/agent/agent.entity.d.ts +55 -0
  7. package/dist/agent/agent.entity.d.ts.map +1 -0
  8. package/dist/agent/agent.entity.js +136 -0
  9. package/dist/agent/agent.entity.js.map +1 -0
  10. package/dist/agent/agent.enum.d.ts +18 -0
  11. package/dist/agent/agent.enum.d.ts.map +1 -0
  12. package/dist/agent/agent.enum.js +34 -0
  13. package/dist/agent/agent.enum.js.map +1 -0
  14. package/dist/agent/agent.event.d.ts +128 -0
  15. package/dist/agent/agent.event.d.ts.map +1 -0
  16. package/dist/agent/agent.event.js +210 -0
  17. package/dist/agent/agent.event.js.map +1 -0
  18. package/dist/agent/agent.handler.d.ts +100 -0
  19. package/dist/agent/agent.handler.d.ts.map +1 -0
  20. package/dist/agent/agent.handler.js +84 -0
  21. package/dist/agent/agent.handler.js.map +1 -0
  22. package/dist/agent/agent.operation.d.ts +471 -0
  23. package/dist/agent/agent.operation.d.ts.map +1 -0
  24. package/dist/agent/agent.operation.js +486 -0
  25. package/dist/agent/agent.operation.js.map +1 -0
  26. package/dist/agent/agent.presentation.d.ts +18 -0
  27. package/dist/agent/agent.presentation.d.ts.map +1 -0
  28. package/dist/agent/agent.presentation.js +89 -0
  29. package/dist/agent/agent.presentation.js.map +1 -0
  30. package/dist/agent/agent.schema.d.ts +401 -0
  31. package/dist/agent/agent.schema.d.ts.map +1 -0
  32. package/dist/agent/agent.schema.js +406 -0
  33. package/dist/agent/agent.schema.js.map +1 -0
  34. package/dist/agent/agent.test-spec.d.ts +8 -0
  35. package/dist/agent/agent.test-spec.d.ts.map +1 -0
  36. package/dist/agent/agent.test-spec.js +65 -0
  37. package/dist/agent/agent.test-spec.js.map +1 -0
  38. package/dist/agent/index.d.ts +8 -0
  39. package/dist/agent/index.js +9 -0
  40. package/dist/agent.capability.d.ts +7 -0
  41. package/dist/agent.capability.d.ts.map +1 -0
  42. package/dist/agent.capability.js +20 -0
  43. package/dist/agent.capability.js.map +1 -0
  44. package/dist/agent.feature.d.ts +12 -0
  45. package/dist/agent.feature.d.ts.map +1 -0
  46. package/dist/agent.feature.js +305 -0
  47. package/dist/agent.feature.js.map +1 -0
  48. package/dist/docs/agent-console.docblock.d.ts +1 -0
  49. package/dist/docs/agent-console.docblock.js +113 -0
  50. package/dist/docs/agent-console.docblock.js.map +1 -0
  51. package/dist/docs/index.d.ts +1 -0
  52. package/dist/docs/index.js +1 -0
  53. package/dist/example.d.ts +7 -0
  54. package/dist/example.d.ts.map +1 -0
  55. package/dist/example.js +58 -0
  56. package/dist/example.js.map +1 -0
  57. package/dist/handlers/agent.handlers.d.ts +135 -0
  58. package/dist/handlers/agent.handlers.d.ts.map +1 -0
  59. package/dist/handlers/agent.handlers.js +263 -0
  60. package/dist/handlers/agent.handlers.js.map +1 -0
  61. package/dist/handlers/index.d.ts +5 -0
  62. package/dist/handlers/index.js +6 -0
  63. package/dist/index.d.ts +48 -0
  64. package/dist/index.js +50 -0
  65. package/dist/presentations/index.d.ts +4 -0
  66. package/dist/presentations/index.js +5 -0
  67. package/dist/run/index.d.ts +8 -0
  68. package/dist/run/index.js +9 -0
  69. package/dist/run/run.entity.d.ts +82 -0
  70. package/dist/run/run.entity.d.ts.map +1 -0
  71. package/dist/run/run.entity.js +205 -0
  72. package/dist/run/run.entity.js.map +1 -0
  73. package/dist/run/run.enum.d.ts +22 -0
  74. package/dist/run/run.enum.d.ts.map +1 -0
  75. package/dist/run/run.enum.js +45 -0
  76. package/dist/run/run.enum.js.map +1 -0
  77. package/dist/run/run.event.d.ts +290 -0
  78. package/dist/run/run.event.d.ts.map +1 -0
  79. package/dist/run/run.event.js +434 -0
  80. package/dist/run/run.event.js.map +1 -0
  81. package/dist/run/run.handler.d.ts +203 -0
  82. package/dist/run/run.handler.d.ts.map +1 -0
  83. package/dist/run/run.handler.js +83 -0
  84. package/dist/run/run.handler.js.map +1 -0
  85. package/dist/run/run.operation.d.ts +720 -0
  86. package/dist/run/run.operation.d.ts.map +1 -0
  87. package/dist/run/run.operation.js +626 -0
  88. package/dist/run/run.operation.js.map +1 -0
  89. package/dist/run/run.presentation.d.ts +14 -0
  90. package/dist/run/run.presentation.d.ts.map +1 -0
  91. package/dist/run/run.presentation.js +65 -0
  92. package/dist/run/run.presentation.js.map +1 -0
  93. package/dist/run/run.schema.d.ts +416 -0
  94. package/dist/run/run.schema.d.ts.map +1 -0
  95. package/dist/run/run.schema.js +338 -0
  96. package/dist/run/run.schema.js.map +1 -0
  97. package/dist/run/run.test-spec.d.ts +8 -0
  98. package/dist/run/run.test-spec.d.ts.map +1 -0
  99. package/dist/run/run.test-spec.js +65 -0
  100. package/dist/run/run.test-spec.js.map +1 -0
  101. package/dist/seeders/index.d.ts +10 -0
  102. package/dist/seeders/index.d.ts.map +1 -0
  103. package/dist/seeders/index.js +20 -0
  104. package/dist/seeders/index.js.map +1 -0
  105. package/dist/shared/index.d.ts +4 -0
  106. package/dist/shared/index.js +5 -0
  107. package/dist/shared/mock-agents.d.ts +88 -0
  108. package/dist/shared/mock-agents.d.ts.map +1 -0
  109. package/dist/shared/mock-agents.js +94 -0
  110. package/dist/shared/mock-agents.js.map +1 -0
  111. package/dist/shared/mock-runs.d.ts +120 -0
  112. package/dist/shared/mock-runs.d.ts.map +1 -0
  113. package/dist/shared/mock-runs.js +118 -0
  114. package/dist/shared/mock-runs.js.map +1 -0
  115. package/dist/shared/mock-tools.d.ts +244 -0
  116. package/dist/shared/mock-tools.d.ts.map +1 -0
  117. package/dist/shared/mock-tools.js +181 -0
  118. package/dist/shared/mock-tools.js.map +1 -0
  119. package/dist/shared/overlay-types.d.ts +34 -0
  120. package/dist/shared/overlay-types.d.ts.map +1 -0
  121. package/dist/shared/overlay-types.js +0 -0
  122. package/dist/tool/index.d.ts +8 -0
  123. package/dist/tool/index.js +9 -0
  124. package/dist/tool/tool.entity.d.ts +42 -0
  125. package/dist/tool/tool.entity.d.ts.map +1 -0
  126. package/dist/tool/tool.entity.js +105 -0
  127. package/dist/tool/tool.entity.js.map +1 -0
  128. package/dist/tool/tool.enum.d.ts +18 -0
  129. package/dist/tool/tool.enum.d.ts.map +1 -0
  130. package/dist/tool/tool.enum.js +35 -0
  131. package/dist/tool/tool.enum.js.map +1 -0
  132. package/dist/tool/tool.event.d.ts +103 -0
  133. package/dist/tool/tool.event.d.ts.map +1 -0
  134. package/dist/tool/tool.event.js +159 -0
  135. package/dist/tool/tool.event.js.map +1 -0
  136. package/dist/tool/tool.handler.d.ts +315 -0
  137. package/dist/tool/tool.handler.d.ts.map +1 -0
  138. package/dist/tool/tool.handler.js +87 -0
  139. package/dist/tool/tool.handler.js.map +1 -0
  140. package/dist/tool/tool.operation.d.ts +411 -0
  141. package/dist/tool/tool.operation.d.ts.map +1 -0
  142. package/dist/tool/tool.operation.js +406 -0
  143. package/dist/tool/tool.operation.js.map +1 -0
  144. package/dist/tool/tool.presentation.d.ts +14 -0
  145. package/dist/tool/tool.presentation.d.ts.map +1 -0
  146. package/dist/tool/tool.presentation.js +65 -0
  147. package/dist/tool/tool.presentation.js.map +1 -0
  148. package/dist/tool/tool.schema.d.ts +218 -0
  149. package/dist/tool/tool.schema.d.ts.map +1 -0
  150. package/dist/tool/tool.schema.js +236 -0
  151. package/dist/tool/tool.schema.js.map +1 -0
  152. package/dist/tool/tool.test-spec.d.ts +8 -0
  153. package/dist/tool/tool.test-spec.d.ts.map +1 -0
  154. package/dist/tool/tool.test-spec.js +65 -0
  155. package/dist/tool/tool.test-spec.js.map +1 -0
  156. package/dist/ui/AgentDashboard.d.ts +7 -0
  157. package/dist/ui/AgentDashboard.d.ts.map +1 -0
  158. package/dist/ui/AgentDashboard.js +420 -0
  159. package/dist/ui/AgentDashboard.js.map +1 -0
  160. package/dist/ui/AgentRunList.d.ts +2 -0
  161. package/dist/ui/AgentRunList.js +5 -0
  162. package/dist/ui/AgentToolRegistry.d.ts +2 -0
  163. package/dist/ui/AgentToolRegistry.js +5 -0
  164. package/dist/ui/hooks/index.d.ts +6 -0
  165. package/dist/ui/hooks/index.js +8 -0
  166. package/dist/ui/hooks/useAgentList.d.ts +28 -0
  167. package/dist/ui/hooks/useAgentList.d.ts.map +1 -0
  168. package/dist/ui/hooks/useAgentList.js +66 -0
  169. package/dist/ui/hooks/useAgentList.js.map +1 -0
  170. package/dist/ui/hooks/useAgentMutations.d.ts +29 -0
  171. package/dist/ui/hooks/useAgentMutations.d.ts.map +1 -0
  172. package/dist/ui/hooks/useAgentMutations.js +124 -0
  173. package/dist/ui/hooks/useAgentMutations.js.map +1 -0
  174. package/dist/ui/hooks/useRunList.d.ts +24 -0
  175. package/dist/ui/hooks/useRunList.d.ts.map +1 -0
  176. package/dist/ui/hooks/useRunList.js +66 -0
  177. package/dist/ui/hooks/useRunList.js.map +1 -0
  178. package/dist/ui/hooks/useToolList.d.ts +40 -0
  179. package/dist/ui/hooks/useToolList.d.ts.map +1 -0
  180. package/dist/ui/hooks/useToolList.js +96 -0
  181. package/dist/ui/hooks/useToolList.js.map +1 -0
  182. package/dist/ui/index.d.ts +24 -0
  183. package/dist/ui/index.js +24 -0
  184. package/dist/ui/modals/AgentActionsModal.d.ts +27 -0
  185. package/dist/ui/modals/AgentActionsModal.d.ts.map +1 -0
  186. package/dist/ui/modals/AgentActionsModal.js +262 -0
  187. package/dist/ui/modals/AgentActionsModal.js.map +1 -0
  188. package/dist/ui/modals/CreateAgentModal.d.ts +25 -0
  189. package/dist/ui/modals/CreateAgentModal.d.ts.map +1 -0
  190. package/dist/ui/modals/CreateAgentModal.js +214 -0
  191. package/dist/ui/modals/CreateAgentModal.js.map +1 -0
  192. package/dist/ui/modals/index.d.ts +3 -0
  193. package/dist/ui/modals/index.js +4 -0
  194. package/dist/ui/overlays/demo-overlays.d.ts +19 -0
  195. package/dist/ui/overlays/demo-overlays.d.ts.map +1 -0
  196. package/dist/ui/overlays/demo-overlays.js +73 -0
  197. package/dist/ui/overlays/demo-overlays.js.map +1 -0
  198. package/dist/ui/overlays/index.d.ts +2 -0
  199. package/dist/ui/overlays/index.js +3 -0
  200. package/dist/ui/renderers/agent-list.markdown.d.ts +15 -0
  201. package/dist/ui/renderers/agent-list.markdown.d.ts.map +1 -0
  202. package/dist/ui/renderers/agent-list.markdown.js +51 -0
  203. package/dist/ui/renderers/agent-list.markdown.js.map +1 -0
  204. package/dist/ui/renderers/agent-list.renderer.d.ts +11 -0
  205. package/dist/ui/renderers/agent-list.renderer.d.ts.map +1 -0
  206. package/dist/ui/renderers/agent-list.renderer.js +19 -0
  207. package/dist/ui/renderers/agent-list.renderer.js.map +1 -0
  208. package/dist/ui/renderers/dashboard.markdown.d.ts +15 -0
  209. package/dist/ui/renderers/dashboard.markdown.d.ts.map +1 -0
  210. package/dist/ui/renderers/dashboard.markdown.js +100 -0
  211. package/dist/ui/renderers/dashboard.markdown.js.map +1 -0
  212. package/dist/ui/renderers/index.d.ts +6 -0
  213. package/dist/ui/renderers/index.js +7 -0
  214. package/dist/ui/renderers/run-list.markdown.d.ts +15 -0
  215. package/dist/ui/renderers/run-list.markdown.d.ts.map +1 -0
  216. package/dist/ui/renderers/run-list.markdown.js +44 -0
  217. package/dist/ui/renderers/run-list.markdown.js.map +1 -0
  218. package/dist/ui/renderers/tool-registry.markdown.d.ts +15 -0
  219. package/dist/ui/renderers/tool-registry.markdown.d.ts.map +1 -0
  220. package/dist/ui/renderers/tool-registry.markdown.js +55 -0
  221. package/dist/ui/renderers/tool-registry.markdown.js.map +1 -0
  222. package/dist/ui/views/AgentListView.d.ts +7 -0
  223. package/dist/ui/views/AgentListView.d.ts.map +1 -0
  224. package/dist/ui/views/AgentListView.js +93 -0
  225. package/dist/ui/views/AgentListView.js.map +1 -0
  226. package/dist/ui/views/RunListView.d.ts +14 -0
  227. package/dist/ui/views/RunListView.d.ts.map +1 -0
  228. package/dist/ui/views/RunListView.js +165 -0
  229. package/dist/ui/views/RunListView.js.map +1 -0
  230. package/dist/ui/views/ToolRegistryView.d.ts +14 -0
  231. package/dist/ui/views/ToolRegistryView.d.ts.map +1 -0
  232. package/dist/ui/views/ToolRegistryView.js +97 -0
  233. package/dist/ui/views/ToolRegistryView.js.map +1 -0
  234. package/dist/ui/views/index.d.ts +4 -0
  235. package/dist/ui/views/index.js +5 -0
  236. package/example.ts +1 -0
  237. package/package.json +155 -0
  238. package/src/agent/agent.entity.ts +137 -0
  239. package/src/agent/agent.enum.ts +31 -0
  240. package/src/agent/agent.event.ts +142 -0
  241. package/src/agent/agent.handler.ts +178 -0
  242. package/src/agent/agent.operation.ts +444 -0
  243. package/src/agent/agent.presentation.ts +80 -0
  244. package/src/agent/agent.schema.ts +214 -0
  245. package/src/agent/agent.test-spec.ts +55 -0
  246. package/src/agent/index.ts +67 -0
  247. package/src/agent.capability.ts +13 -0
  248. package/src/agent.feature.ts +147 -0
  249. package/src/docs/agent-console.docblock.ts +97 -0
  250. package/src/docs/index.ts +1 -0
  251. package/src/example.ts +41 -0
  252. package/src/handlers/agent.handlers.ts +572 -0
  253. package/src/handlers/index.ts +30 -0
  254. package/src/index.ts +32 -0
  255. package/src/presentations/index.ts +26 -0
  256. package/src/run/index.ts +68 -0
  257. package/src/run/run.entity.ts +175 -0
  258. package/src/run/run.enum.ts +43 -0
  259. package/src/run/run.event.ts +264 -0
  260. package/src/run/run.handler.ts +138 -0
  261. package/src/run/run.operation.ts +524 -0
  262. package/src/run/run.presentation.ts +54 -0
  263. package/src/run/run.schema.ts +169 -0
  264. package/src/run/run.test-spec.ts +55 -0
  265. package/src/seeders/index.ts +29 -0
  266. package/src/shared/index.ts +6 -0
  267. package/src/shared/mock-agents.ts +81 -0
  268. package/src/shared/mock-runs.ts +107 -0
  269. package/src/shared/mock-tools.ts +145 -0
  270. package/src/shared/overlay-types.ts +39 -0
  271. package/src/tool/index.ts +60 -0
  272. package/src/tool/tool.entity.ts +99 -0
  273. package/src/tool/tool.enum.ts +32 -0
  274. package/src/tool/tool.event.ts +119 -0
  275. package/src/tool/tool.handler.ts +154 -0
  276. package/src/tool/tool.operation.ts +366 -0
  277. package/src/tool/tool.presentation.ts +55 -0
  278. package/src/tool/tool.schema.ts +133 -0
  279. package/src/tool/tool.test-spec.ts +55 -0
  280. package/src/ui/AgentDashboard.tsx +416 -0
  281. package/src/ui/AgentRunList.tsx +8 -0
  282. package/src/ui/AgentToolRegistry.tsx +8 -0
  283. package/src/ui/hooks/index.ts +14 -0
  284. package/src/ui/hooks/useAgentList.ts +80 -0
  285. package/src/ui/hooks/useAgentMutations.ts +156 -0
  286. package/src/ui/hooks/useRunList.ts +81 -0
  287. package/src/ui/hooks/useToolList.ts +122 -0
  288. package/src/ui/index.ts +21 -0
  289. package/src/ui/modals/AgentActionsModal.tsx +306 -0
  290. package/src/ui/modals/CreateAgentModal.tsx +257 -0
  291. package/src/ui/modals/index.ts +2 -0
  292. package/src/ui/overlays/demo-overlays.ts +77 -0
  293. package/src/ui/overlays/index.ts +1 -0
  294. package/src/ui/renderers/agent-list.markdown.ts +84 -0
  295. package/src/ui/renderers/agent-list.renderer.tsx +27 -0
  296. package/src/ui/renderers/dashboard.markdown.ts +169 -0
  297. package/src/ui/renderers/index.ts +12 -0
  298. package/src/ui/renderers/run-list.markdown.ts +75 -0
  299. package/src/ui/renderers/tool-registry.markdown.ts +91 -0
  300. package/src/ui/views/AgentListView.tsx +113 -0
  301. package/src/ui/views/RunListView.tsx +173 -0
  302. package/src/ui/views/ToolRegistryView.tsx +140 -0
  303. package/src/ui/views/index.ts +6 -0
  304. package/tsconfig.json +10 -0
  305. package/tsconfig.tsbuildinfo +1 -0
  306. package/tsdown.config.js +7 -0
@@ -0,0 +1,169 @@
1
+ import { defineSchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';
2
+ import { RunStatusEnum, RunStepTypeEnum, LogLevelEnum } from './run.enum';
3
+
4
+ /**
5
+ * Input data for agent execution.
6
+ */
7
+ export const RunInputModel = defineSchemaModel({
8
+ name: 'RunInput',
9
+ description: 'Input data for agent execution',
10
+ fields: {
11
+ message: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
12
+ context: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
13
+ },
14
+ });
15
+
16
+ /**
17
+ * Individual step within a run.
18
+ */
19
+ export const RunStepModel = defineSchemaModel({
20
+ name: 'RunStep',
21
+ description: 'Individual step within a run',
22
+ fields: {
23
+ id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
24
+ stepNumber: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
25
+ type: { type: RunStepTypeEnum, isOptional: false },
26
+ toolId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
27
+ toolName: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
28
+ input: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
29
+ output: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
30
+ status: { type: RunStatusEnum, isOptional: false },
31
+ errorMessage: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
32
+ tokensUsed: {
33
+ type: ScalarTypeEnum.Int_unsecure(),
34
+ isOptional: false,
35
+ defaultValue: 0,
36
+ },
37
+ durationMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
38
+ startedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
39
+ completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },
40
+ },
41
+ });
42
+
43
+ /**
44
+ * Execution log entry.
45
+ */
46
+ export const RunLogModel = defineSchemaModel({
47
+ name: 'RunLog',
48
+ description: 'Execution log entry',
49
+ fields: {
50
+ id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
51
+ stepId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
52
+ level: { type: LogLevelEnum, isOptional: false },
53
+ message: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
54
+ data: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
55
+ source: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
56
+ traceId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
57
+ spanId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
58
+ timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false },
59
+ },
60
+ });
61
+
62
+ /**
63
+ * Agent reference in a run.
64
+ */
65
+ export const RunAgentRefModel = defineSchemaModel({
66
+ name: 'RunAgentRef',
67
+ description: 'Agent reference in a run',
68
+ fields: {
69
+ id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
70
+ name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
71
+ modelProvider: {
72
+ type: ScalarTypeEnum.String_unsecure(),
73
+ isOptional: false,
74
+ },
75
+ modelName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
76
+ },
77
+ });
78
+
79
+ /**
80
+ * Agent execution instance.
81
+ */
82
+ export const RunModel = defineSchemaModel({
83
+ name: 'Run',
84
+ description: 'Agent execution instance',
85
+ fields: {
86
+ id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
87
+ organizationId: {
88
+ type: ScalarTypeEnum.String_unsecure(),
89
+ isOptional: false,
90
+ },
91
+ agentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
92
+ userId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
93
+ sessionId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
94
+ input: { type: ScalarTypeEnum.JSONObject(), isOptional: false },
95
+ output: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
96
+ status: { type: RunStatusEnum, isOptional: false },
97
+ errorMessage: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
98
+ errorCode: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
99
+ totalTokens: {
100
+ type: ScalarTypeEnum.Int_unsecure(),
101
+ isOptional: false,
102
+ defaultValue: 0,
103
+ },
104
+ promptTokens: {
105
+ type: ScalarTypeEnum.Int_unsecure(),
106
+ isOptional: false,
107
+ defaultValue: 0,
108
+ },
109
+ completionTokens: {
110
+ type: ScalarTypeEnum.Int_unsecure(),
111
+ isOptional: false,
112
+ defaultValue: 0,
113
+ },
114
+ totalIterations: {
115
+ type: ScalarTypeEnum.Int_unsecure(),
116
+ isOptional: false,
117
+ defaultValue: 0,
118
+ },
119
+ durationMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
120
+ estimatedCostUsd: {
121
+ type: ScalarTypeEnum.Float_unsecure(),
122
+ isOptional: true,
123
+ },
124
+ queuedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
125
+ startedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },
126
+ completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },
127
+ metadata: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
128
+ steps: { type: RunStepModel, isArray: true, isOptional: true },
129
+ logs: { type: RunLogModel, isArray: true, isOptional: true },
130
+ agent: { type: RunAgentRefModel, isOptional: true },
131
+ },
132
+ });
133
+
134
+ /**
135
+ * Summary of a run for list views.
136
+ */
137
+ export const RunSummaryModel = defineSchemaModel({
138
+ name: 'RunSummary',
139
+ description: 'Summary of a run for list views',
140
+ fields: {
141
+ id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
142
+ agentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
143
+ agentName: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
144
+ status: { type: RunStatusEnum, isOptional: false },
145
+ totalTokens: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
146
+ durationMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
147
+ estimatedCostUsd: {
148
+ type: ScalarTypeEnum.Float_unsecure(),
149
+ isOptional: true,
150
+ },
151
+ queuedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
152
+ completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },
153
+ },
154
+ });
155
+
156
+ /**
157
+ * Timeline data point for metrics.
158
+ */
159
+ export const TimelineDataPointModel = defineSchemaModel({
160
+ name: 'TimelineDataPoint',
161
+ description: 'Timeline data point for metrics',
162
+ fields: {
163
+ period: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
164
+ runs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
165
+ tokens: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
166
+ costUsd: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
167
+ avgDurationMs: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
168
+ },
169
+ });
@@ -0,0 +1,55 @@
1
+ import { defineTestSpec } from '@contractspec/lib.contracts';
2
+
3
+ export const runListTest = defineTestSpec({
4
+ meta: {
5
+ key: 'test.agent.run.list',
6
+ version: '1.0.0',
7
+ owners: ['@agent-console-team'],
8
+ description: 'Test for listing runs',
9
+ stability: 'stable',
10
+ tags: ['test'],
11
+ },
12
+ target: {
13
+ type: 'operation',
14
+ operation: { key: 'agent.run.list', version: '1.0.0' },
15
+ },
16
+ scenarios: [
17
+ {
18
+ key: 'success',
19
+ when: { operation: { key: 'agent.run.list' } },
20
+ then: [{ type: 'expectOutput', match: {} }],
21
+ },
22
+ {
23
+ key: 'error',
24
+ when: { operation: { key: 'agent.run.list' } },
25
+ then: [{ type: 'expectError' }],
26
+ },
27
+ ],
28
+ });
29
+
30
+ export const runGetTest = defineTestSpec({
31
+ meta: {
32
+ key: 'test.agent.run.get',
33
+ version: '1.0.0',
34
+ owners: ['@agent-console-team'],
35
+ description: 'Test for getting run',
36
+ stability: 'stable',
37
+ tags: ['test'],
38
+ },
39
+ target: {
40
+ type: 'operation',
41
+ operation: { key: 'agent.run.get', version: '1.0.0' },
42
+ },
43
+ scenarios: [
44
+ {
45
+ key: 'success',
46
+ when: { operation: { key: 'agent.run.get' } },
47
+ then: [{ type: 'expectOutput', match: {} }],
48
+ },
49
+ {
50
+ key: 'error',
51
+ when: { operation: { key: 'agent.run.get' } },
52
+ then: [{ type: 'expectError' }],
53
+ },
54
+ ],
55
+ });
@@ -0,0 +1,29 @@
1
+ import type { DatabasePort } from '@contractspec/lib.runtime-sandbox';
2
+
3
+ export async function seedAgentConsole(params: {
4
+ projectId: string;
5
+ db: DatabasePort;
6
+ }) {
7
+ const { projectId, db } = params;
8
+
9
+ const existing = await db.query(
10
+ `SELECT COUNT(*) as count FROM agent_definition WHERE "projectId" = $1`,
11
+ [projectId]
12
+ );
13
+ if ((existing.rows[0]?.count as number) > 0) return;
14
+
15
+ await db.execute(
16
+ `INSERT INTO agent_definition (id, "projectId", "organizationId", name, description, "modelProvider", "modelName", status)
17
+ VALUES ($1, $2, $3, $4, $5, $6, $7, $8)`,
18
+ [
19
+ 'agent_1',
20
+ projectId,
21
+ 'org_demo',
22
+ 'Demo Agent',
23
+ 'A demo AI agent',
24
+ 'openai',
25
+ 'gpt-4',
26
+ 'ACTIVE',
27
+ ]
28
+ );
29
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Shared utilities and mock data.
3
+ */
4
+ export { MOCK_AGENTS } from './mock-agents';
5
+ export { MOCK_TOOLS } from './mock-tools';
6
+ export { MOCK_RUNS } from './mock-runs';
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Mock agent data for testing and demos.
3
+ */
4
+ export const MOCK_AGENTS = [
5
+ {
6
+ id: 'agent-1',
7
+ organizationId: 'demo-org',
8
+ name: 'Customer Support Bot',
9
+ slug: 'customer-support-bot',
10
+ description: 'Handles tier-1 customer inquiries and routes complex issues.',
11
+ status: 'ACTIVE' as const,
12
+ modelProvider: 'OPENAI' as const,
13
+ modelName: 'gpt-4o-mini',
14
+ modelConfig: { temperature: 0.7 },
15
+ systemPrompt: 'You are a helpful customer support assistant.',
16
+ toolChoice: 'auto' as const,
17
+ maxIterations: 10,
18
+ timeoutMs: 120000,
19
+ version: '1.0.0',
20
+ tags: ['support', 'tier-1'],
21
+ createdAt: new Date('2024-01-15T10:00:00Z'),
22
+ updatedAt: new Date('2024-03-20T14:30:00Z'),
23
+ },
24
+ {
25
+ id: 'agent-2',
26
+ organizationId: 'demo-org',
27
+ name: 'Code Review Assistant',
28
+ slug: 'code-review-assistant',
29
+ description: 'Reviews pull requests and provides actionable feedback.',
30
+ status: 'ACTIVE' as const,
31
+ modelProvider: 'ANTHROPIC' as const,
32
+ modelName: 'claude-sonnet-4-20250514',
33
+ modelConfig: { temperature: 0.3 },
34
+ systemPrompt: 'You are a code review expert.',
35
+ toolChoice: 'auto' as const,
36
+ maxIterations: 15,
37
+ timeoutMs: 180000,
38
+ version: '2.1.0',
39
+ tags: ['code', 'review', 'dev'],
40
+ createdAt: new Date('2024-02-10T09:00:00Z'),
41
+ updatedAt: new Date('2024-04-05T11:15:00Z'),
42
+ },
43
+ {
44
+ id: 'agent-3',
45
+ organizationId: 'demo-org',
46
+ name: 'Data Analyst',
47
+ slug: 'data-analyst',
48
+ description: 'Queries databases and generates insights from data.',
49
+ status: 'PAUSED' as const,
50
+ modelProvider: 'OPENAI' as const,
51
+ modelName: 'gpt-4o',
52
+ modelConfig: { temperature: 0.5 },
53
+ systemPrompt: 'You are a data analyst expert in SQL and analytics.',
54
+ toolChoice: 'required' as const,
55
+ maxIterations: 20,
56
+ timeoutMs: 300000,
57
+ version: '1.2.0',
58
+ tags: ['data', 'analytics', 'sql'],
59
+ createdAt: new Date('2024-03-01T08:00:00Z'),
60
+ updatedAt: new Date('2024-04-10T16:45:00Z'),
61
+ },
62
+ {
63
+ id: 'agent-4',
64
+ organizationId: 'demo-org',
65
+ name: 'Meeting Scheduler',
66
+ slug: 'meeting-scheduler',
67
+ description: 'Schedules meetings and manages calendar conflicts.',
68
+ status: 'DRAFT' as const,
69
+ modelProvider: 'GOOGLE' as const,
70
+ modelName: 'gemini-2.0-flash',
71
+ modelConfig: { temperature: 0.2 },
72
+ systemPrompt: 'You help schedule and organize meetings efficiently.',
73
+ toolChoice: 'auto' as const,
74
+ maxIterations: 5,
75
+ timeoutMs: 60000,
76
+ version: '0.1.0',
77
+ tags: ['calendar', 'scheduling'],
78
+ createdAt: new Date('2024-04-01T12:00:00Z'),
79
+ updatedAt: new Date('2024-04-01T12:00:00Z'),
80
+ },
81
+ ];
@@ -0,0 +1,107 @@
1
+ /**
2
+ * Mock run data for testing and demos.
3
+ */
4
+ export const MOCK_RUNS = [
5
+ {
6
+ id: 'run-1',
7
+ organizationId: 'demo-org',
8
+ agentId: 'agent-1',
9
+ agentName: 'Customer Support Bot',
10
+ userId: 'user-1',
11
+ sessionId: 'session-1',
12
+ input: { message: 'How do I reset my password?', context: {} },
13
+ output: { response: 'You can reset your password by clicking...' },
14
+ status: 'COMPLETED' as const,
15
+ totalTokens: 1250,
16
+ promptTokens: 800,
17
+ completionTokens: 450,
18
+ totalIterations: 3,
19
+ durationMs: 4500,
20
+ estimatedCostUsd: 0.0025,
21
+ queuedAt: new Date('2024-04-15T10:00:00Z'),
22
+ startedAt: new Date('2024-04-15T10:00:01Z'),
23
+ completedAt: new Date('2024-04-15T10:00:05Z'),
24
+ steps: [],
25
+ logs: [],
26
+ },
27
+ {
28
+ id: 'run-2',
29
+ organizationId: 'demo-org',
30
+ agentId: 'agent-2',
31
+ agentName: 'Code Review Assistant',
32
+ userId: 'user-2',
33
+ input: { message: 'Review PR #123', context: { prNumber: 123 } },
34
+ status: 'IN_PROGRESS' as const,
35
+ totalTokens: 3500,
36
+ promptTokens: 3000,
37
+ completionTokens: 500,
38
+ totalIterations: 5,
39
+ queuedAt: new Date('2024-04-15T10:30:00Z'),
40
+ startedAt: new Date('2024-04-15T10:30:02Z'),
41
+ steps: [],
42
+ logs: [],
43
+ },
44
+ {
45
+ id: 'run-3',
46
+ organizationId: 'demo-org',
47
+ agentId: 'agent-1',
48
+ agentName: 'Customer Support Bot',
49
+ userId: 'user-1',
50
+ input: { message: 'What are your business hours?' },
51
+ output: { response: 'Our business hours are 9 AM to 5 PM EST...' },
52
+ status: 'COMPLETED' as const,
53
+ totalTokens: 800,
54
+ promptTokens: 500,
55
+ completionTokens: 300,
56
+ totalIterations: 2,
57
+ durationMs: 2100,
58
+ estimatedCostUsd: 0.0012,
59
+ queuedAt: new Date('2024-04-15T09:00:00Z'),
60
+ startedAt: new Date('2024-04-15T09:00:01Z'),
61
+ completedAt: new Date('2024-04-15T09:00:03Z'),
62
+ steps: [],
63
+ logs: [],
64
+ },
65
+ {
66
+ id: 'run-4',
67
+ organizationId: 'demo-org',
68
+ agentId: 'agent-3',
69
+ agentName: 'Data Analyst',
70
+ userId: 'user-3',
71
+ input: { message: 'Generate sales report for Q1' },
72
+ status: 'FAILED' as const,
73
+ errorMessage: 'Database connection timeout',
74
+ errorCode: 'DB_TIMEOUT',
75
+ totalTokens: 2000,
76
+ promptTokens: 1500,
77
+ completionTokens: 500,
78
+ totalIterations: 8,
79
+ durationMs: 45000,
80
+ queuedAt: new Date('2024-04-14T15:00:00Z'),
81
+ startedAt: new Date('2024-04-14T15:00:05Z'),
82
+ completedAt: new Date('2024-04-14T15:00:50Z'),
83
+ steps: [],
84
+ logs: [],
85
+ },
86
+ {
87
+ id: 'run-5',
88
+ organizationId: 'demo-org',
89
+ agentId: 'agent-2',
90
+ agentName: 'Code Review Assistant',
91
+ userId: 'user-2',
92
+ input: { message: 'Review PR #120' },
93
+ output: { response: 'Code review complete. 3 suggestions...' },
94
+ status: 'COMPLETED' as const,
95
+ totalTokens: 5200,
96
+ promptTokens: 4000,
97
+ completionTokens: 1200,
98
+ totalIterations: 7,
99
+ durationMs: 15000,
100
+ estimatedCostUsd: 0.0156,
101
+ queuedAt: new Date('2024-04-14T11:00:00Z'),
102
+ startedAt: new Date('2024-04-14T11:00:03Z'),
103
+ completedAt: new Date('2024-04-14T11:00:18Z'),
104
+ steps: [],
105
+ logs: [],
106
+ },
107
+ ];
@@ -0,0 +1,145 @@
1
+ /**
2
+ * Mock tool data for testing and demos.
3
+ */
4
+ export const MOCK_TOOLS = [
5
+ {
6
+ id: 'tool-1',
7
+ organizationId: 'demo-org',
8
+ name: 'Web Search',
9
+ slug: 'web-search',
10
+ description: 'Search the web for real-time information using Brave API.',
11
+ category: 'RETRIEVAL' as const,
12
+ status: 'ACTIVE' as const,
13
+ parametersSchema: {
14
+ type: 'object',
15
+ properties: {
16
+ query: { type: 'string', description: 'Search query' },
17
+ numResults: { type: 'number', default: 10 },
18
+ },
19
+ required: ['query'],
20
+ },
21
+ outputSchema: { type: 'array', items: { type: 'object' } },
22
+ implementationType: 'http' as const,
23
+ implementationConfig: {
24
+ url: 'https://api.brave.com/search',
25
+ method: 'GET',
26
+ },
27
+ maxInvocationsPerMinute: 60,
28
+ timeoutMs: 30000,
29
+ version: '1.0.0',
30
+ tags: ['search', 'web'],
31
+ createdAt: new Date('2024-01-01T00:00:00Z'),
32
+ updatedAt: new Date('2024-02-15T10:00:00Z'),
33
+ },
34
+ {
35
+ id: 'tool-2',
36
+ organizationId: 'demo-org',
37
+ name: 'SQL Query',
38
+ slug: 'sql-query',
39
+ description: 'Execute read-only SQL queries against the data warehouse.',
40
+ category: 'RETRIEVAL' as const,
41
+ status: 'ACTIVE' as const,
42
+ parametersSchema: {
43
+ type: 'object',
44
+ properties: {
45
+ query: { type: 'string', description: 'SQL query' },
46
+ maxRows: { type: 'number', default: 100 },
47
+ },
48
+ required: ['query'],
49
+ },
50
+ outputSchema: { type: 'object' },
51
+ implementationType: 'function' as const,
52
+ implementationConfig: { handler: 'executeSqlQuery' },
53
+ maxInvocationsPerMinute: 30,
54
+ timeoutMs: 60000,
55
+ version: '1.1.0',
56
+ tags: ['sql', 'database'],
57
+ createdAt: new Date('2024-01-05T00:00:00Z'),
58
+ updatedAt: new Date('2024-03-10T14:00:00Z'),
59
+ },
60
+ {
61
+ id: 'tool-3',
62
+ organizationId: 'demo-org',
63
+ name: 'Email Sender',
64
+ slug: 'email-sender',
65
+ description: 'Send emails via SMTP or API.',
66
+ category: 'COMMUNICATION' as const,
67
+ status: 'ACTIVE' as const,
68
+ parametersSchema: {
69
+ type: 'object',
70
+ properties: {
71
+ to: { type: 'string' },
72
+ subject: { type: 'string' },
73
+ body: { type: 'string' },
74
+ },
75
+ required: ['to', 'subject', 'body'],
76
+ },
77
+ implementationType: 'http' as const,
78
+ implementationConfig: { url: '/api/send-email', method: 'POST' },
79
+ maxInvocationsPerMinute: 10,
80
+ timeoutMs: 30000,
81
+ version: '1.0.0',
82
+ tags: ['email', 'communication'],
83
+ createdAt: new Date('2024-02-01T00:00:00Z'),
84
+ updatedAt: new Date('2024-02-01T00:00:00Z'),
85
+ },
86
+ {
87
+ id: 'tool-4',
88
+ organizationId: 'demo-org',
89
+ name: 'GitHub Integration',
90
+ slug: 'github-integration',
91
+ description: 'Interact with GitHub repositories, PRs, and issues.',
92
+ category: 'INTEGRATION' as const,
93
+ status: 'ACTIVE' as const,
94
+ parametersSchema: {
95
+ type: 'object',
96
+ properties: {
97
+ action: {
98
+ type: 'string',
99
+ enum: ['list_prs', 'get_pr', 'create_comment'],
100
+ },
101
+ repo: { type: 'string' },
102
+ params: { type: 'object' },
103
+ },
104
+ required: ['action', 'repo'],
105
+ },
106
+ implementationType: 'http' as const,
107
+ implementationConfig: { url: 'https://api.github.com', auth: 'token' },
108
+ maxInvocationsPerMinute: 100,
109
+ timeoutMs: 15000,
110
+ version: '2.0.0',
111
+ tags: ['github', 'integration', 'code'],
112
+ createdAt: new Date('2024-02-20T00:00:00Z'),
113
+ updatedAt: new Date('2024-04-01T09:00:00Z'),
114
+ },
115
+ {
116
+ id: 'tool-5',
117
+ organizationId: 'demo-org',
118
+ name: 'Calculator',
119
+ slug: 'calculator',
120
+ description: 'Perform mathematical calculations.',
121
+ category: 'COMPUTATION' as const,
122
+ status: 'ACTIVE' as const,
123
+ parametersSchema: {
124
+ type: 'object',
125
+ properties: {
126
+ expression: {
127
+ type: 'string',
128
+ description: 'Math expression to evaluate',
129
+ },
130
+ },
131
+ required: ['expression'],
132
+ },
133
+ outputSchema: {
134
+ type: 'object',
135
+ properties: { result: { type: 'number' } },
136
+ },
137
+ implementationType: 'function' as const,
138
+ implementationConfig: { handler: 'evaluateMath' },
139
+ timeoutMs: 5000,
140
+ version: '1.0.0',
141
+ tags: ['math', 'utility'],
142
+ createdAt: new Date('2024-01-10T00:00:00Z'),
143
+ updatedAt: new Date('2024-01-10T00:00:00Z'),
144
+ },
145
+ ];
@@ -0,0 +1,39 @@
1
+ export interface OverlayDefinition {
2
+ overlayId: string;
3
+ version: string;
4
+ description: string;
5
+ appliesTo: Record<string, string>;
6
+ modifications: OverlayModification[];
7
+ }
8
+
9
+ export type OverlayModification =
10
+ | HideFieldModification
11
+ | RenameLabelModification
12
+ | AddBadgeModification
13
+ | SetLimitModification;
14
+
15
+ export interface HideFieldModification {
16
+ type: 'hideField';
17
+ field: string;
18
+ reason?: string;
19
+ }
20
+
21
+ export interface RenameLabelModification {
22
+ type: 'renameLabel';
23
+ field: string;
24
+ newLabel: string;
25
+ }
26
+
27
+ export interface AddBadgeModification {
28
+ type: 'addBadge';
29
+ position: 'header' | 'footer';
30
+ label: string;
31
+ variant: 'warning' | 'info' | 'error' | 'success' | 'default';
32
+ }
33
+
34
+ export interface SetLimitModification {
35
+ type: 'setLimit';
36
+ field: string;
37
+ max: number;
38
+ message: string;
39
+ }
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Tool domain - AI tool definitions and management.
3
+ */
4
+
5
+ // Enums
6
+ export {
7
+ ToolCategoryEnum,
8
+ ToolStatusEnum,
9
+ ImplementationTypeEnum,
10
+ } from './tool.enum';
11
+
12
+ // Schema models
13
+ export {
14
+ ToolModel,
15
+ ToolSummaryModel,
16
+ CreateToolInputModel,
17
+ UpdateToolInputModel,
18
+ } from './tool.schema';
19
+
20
+ // Contracts
21
+ export {
22
+ CreateToolCommand,
23
+ UpdateToolCommand,
24
+ GetToolQuery,
25
+ ListToolsQuery,
26
+ TestToolCommand,
27
+ } from './tool.operation';
28
+
29
+ // Events
30
+ export {
31
+ ToolCreatedEvent,
32
+ ToolUpdatedEvent,
33
+ ToolStatusChangedEvent,
34
+ } from './tool.event';
35
+
36
+ // Entities
37
+ export {
38
+ ToolCategoryEntityEnum,
39
+ ToolStatusEntityEnum,
40
+ ImplementationTypeEntityEnum,
41
+ ToolEntity,
42
+ } from './tool.entity';
43
+
44
+ // Presentations
45
+ export {
46
+ ToolListPresentation,
47
+ ToolDetailPresentation,
48
+ } from './tool.presentation';
49
+
50
+ // Handlers
51
+ export {
52
+ mockListToolsHandler,
53
+ mockGetToolHandler,
54
+ mockCreateToolHandler,
55
+ mockUpdateToolHandler,
56
+ mockTestToolHandler,
57
+ type ListToolsInput,
58
+ type ToolSummary,
59
+ type ListToolsOutput,
60
+ } from './tool.handler';