@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,214 @@
1
+ import { defineSchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';
2
+ import {
3
+ AgentStatusEnum,
4
+ ModelProviderEnum,
5
+ ToolChoiceEnum,
6
+ } from './agent.enum';
7
+
8
+ /**
9
+ * AI agent configuration schema.
10
+ */
11
+ export const AgentModel = defineSchemaModel({
12
+ name: 'Agent',
13
+ description: 'AI agent configuration',
14
+ fields: {
15
+ id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
16
+ organizationId: {
17
+ type: ScalarTypeEnum.String_unsecure(),
18
+ isOptional: false,
19
+ },
20
+ name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
21
+ slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
22
+ description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
23
+ status: { type: AgentStatusEnum, isOptional: false },
24
+ modelProvider: { type: ModelProviderEnum, isOptional: false },
25
+ modelName: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
26
+ modelConfig: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
27
+ systemPrompt: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
28
+ userPromptTemplate: {
29
+ type: ScalarTypeEnum.String_unsecure(),
30
+ isOptional: true,
31
+ },
32
+ toolIds: {
33
+ type: ScalarTypeEnum.String_unsecure(),
34
+ isArray: true,
35
+ isOptional: true,
36
+ },
37
+ toolChoice: {
38
+ type: ToolChoiceEnum,
39
+ isOptional: false,
40
+ defaultValue: 'auto',
41
+ },
42
+ maxIterations: {
43
+ type: ScalarTypeEnum.Int_unsecure(),
44
+ isOptional: false,
45
+ defaultValue: 10,
46
+ },
47
+ maxTokensPerRun: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
48
+ timeoutMs: {
49
+ type: ScalarTypeEnum.Int_unsecure(),
50
+ isOptional: false,
51
+ defaultValue: 120000,
52
+ },
53
+ version: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
54
+ tags: {
55
+ type: ScalarTypeEnum.String_unsecure(),
56
+ isArray: true,
57
+ isOptional: true,
58
+ },
59
+ createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
60
+ updatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
61
+ },
62
+ });
63
+
64
+ /**
65
+ * Summary of an agent for list views.
66
+ */
67
+ export const AgentSummaryModel = defineSchemaModel({
68
+ name: 'AgentSummary',
69
+ description: 'Summary of an agent for list views',
70
+ fields: {
71
+ id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
72
+ name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
73
+ slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
74
+ description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
75
+ status: { type: AgentStatusEnum, isOptional: false },
76
+ modelProvider: { type: ModelProviderEnum, isOptional: false },
77
+ modelName: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
78
+ version: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
79
+ createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
80
+ },
81
+ });
82
+
83
+ /**
84
+ * Tool reference in agent context.
85
+ */
86
+ export const AgentToolRefModel = defineSchemaModel({
87
+ name: 'AgentToolRef',
88
+ description: 'Tool reference in agent context',
89
+ fields: {
90
+ id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
91
+ name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
92
+ slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
93
+ description: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
94
+ category: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
95
+ },
96
+ });
97
+
98
+ /**
99
+ * Agent with associated tools.
100
+ */
101
+ export const AgentWithToolsModel = defineSchemaModel({
102
+ name: 'AgentWithTools',
103
+ description: 'Agent with associated tools',
104
+ fields: {
105
+ id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
106
+ organizationId: {
107
+ type: ScalarTypeEnum.String_unsecure(),
108
+ isOptional: false,
109
+ },
110
+ name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
111
+ slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
112
+ description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
113
+ status: { type: AgentStatusEnum, isOptional: false },
114
+ modelProvider: { type: ModelProviderEnum, isOptional: false },
115
+ modelName: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
116
+ modelConfig: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
117
+ systemPrompt: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
118
+ userPromptTemplate: {
119
+ type: ScalarTypeEnum.String_unsecure(),
120
+ isOptional: true,
121
+ },
122
+ toolIds: {
123
+ type: ScalarTypeEnum.String_unsecure(),
124
+ isArray: true,
125
+ isOptional: true,
126
+ },
127
+ toolChoice: { type: ToolChoiceEnum, isOptional: false },
128
+ maxIterations: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
129
+ maxTokensPerRun: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
130
+ timeoutMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
131
+ version: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
132
+ tags: {
133
+ type: ScalarTypeEnum.String_unsecure(),
134
+ isArray: true,
135
+ isOptional: true,
136
+ },
137
+ createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
138
+ updatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
139
+ tools: { type: AgentToolRefModel, isArray: true, isOptional: true },
140
+ },
141
+ });
142
+
143
+ /**
144
+ * Input for creating an agent.
145
+ */
146
+ export const CreateAgentInputModel = defineSchemaModel({
147
+ name: 'CreateAgentInput',
148
+ description: 'Input for creating an agent',
149
+ fields: {
150
+ organizationId: {
151
+ type: ScalarTypeEnum.String_unsecure(),
152
+ isOptional: false,
153
+ },
154
+ name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
155
+ slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
156
+ description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
157
+ modelProvider: { type: ModelProviderEnum, isOptional: false },
158
+ modelName: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
159
+ modelConfig: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
160
+ systemPrompt: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
161
+ userPromptTemplate: {
162
+ type: ScalarTypeEnum.String_unsecure(),
163
+ isOptional: true,
164
+ },
165
+ toolIds: {
166
+ type: ScalarTypeEnum.String_unsecure(),
167
+ isArray: true,
168
+ isOptional: true,
169
+ },
170
+ toolChoice: { type: ToolChoiceEnum, isOptional: true },
171
+ maxIterations: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
172
+ maxTokensPerRun: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
173
+ timeoutMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
174
+ tags: {
175
+ type: ScalarTypeEnum.String_unsecure(),
176
+ isArray: true,
177
+ isOptional: true,
178
+ },
179
+ },
180
+ });
181
+
182
+ /**
183
+ * Input for updating an agent.
184
+ */
185
+ export const UpdateAgentInputModel = defineSchemaModel({
186
+ name: 'UpdateAgentInput',
187
+ description: 'Input for updating an agent',
188
+ fields: {
189
+ agentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
190
+ name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: true },
191
+ description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
192
+ status: { type: AgentStatusEnum, isOptional: true },
193
+ modelConfig: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
194
+ systemPrompt: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
195
+ userPromptTemplate: {
196
+ type: ScalarTypeEnum.String_unsecure(),
197
+ isOptional: true,
198
+ },
199
+ toolIds: {
200
+ type: ScalarTypeEnum.String_unsecure(),
201
+ isArray: true,
202
+ isOptional: true,
203
+ },
204
+ toolChoice: { type: ToolChoiceEnum, isOptional: true },
205
+ maxIterations: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
206
+ maxTokensPerRun: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
207
+ timeoutMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
208
+ tags: {
209
+ type: ScalarTypeEnum.String_unsecure(),
210
+ isArray: true,
211
+ isOptional: true,
212
+ },
213
+ },
214
+ });
@@ -0,0 +1,55 @@
1
+ import { defineTestSpec } from '@contractspec/lib.contracts';
2
+
3
+ export const agentListTest = defineTestSpec({
4
+ meta: {
5
+ key: 'test.agent-console.agent.list',
6
+ version: '1.0.0',
7
+ owners: ['@agent-console-team'],
8
+ description: 'Test for listing agents',
9
+ stability: 'stable',
10
+ tags: ['test'],
11
+ },
12
+ target: {
13
+ type: 'operation',
14
+ operation: { key: 'agent-console.agent.list', version: '1.0.0' },
15
+ },
16
+ scenarios: [
17
+ {
18
+ key: 'success',
19
+ when: { operation: { key: 'agent-console.agent.list' } },
20
+ then: [{ type: 'expectOutput', match: {} }],
21
+ },
22
+ {
23
+ key: 'error',
24
+ when: { operation: { key: 'agent-console.agent.list' } },
25
+ then: [{ type: 'expectError' }],
26
+ },
27
+ ],
28
+ });
29
+
30
+ export const agentGetTest = defineTestSpec({
31
+ meta: {
32
+ key: 'test.agent-console.agent.get',
33
+ version: '1.0.0',
34
+ owners: ['@agent-console-team'],
35
+ description: 'Test for getting agent',
36
+ stability: 'stable',
37
+ tags: ['test'],
38
+ },
39
+ target: {
40
+ type: 'operation',
41
+ operation: { key: 'agent-console.agent.get', version: '1.0.0' },
42
+ },
43
+ scenarios: [
44
+ {
45
+ key: 'success',
46
+ when: { operation: { key: 'agent-console.agent.get' } },
47
+ then: [{ type: 'expectOutput', match: {} }],
48
+ },
49
+ {
50
+ key: 'error',
51
+ when: { operation: { key: 'agent-console.agent.get' } },
52
+ then: [{ type: 'expectError' }],
53
+ },
54
+ ],
55
+ });
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Agent domain - AI agent configuration and management.
3
+ */
4
+
5
+ // Enums
6
+ export {
7
+ AgentStatusEnum,
8
+ ModelProviderEnum,
9
+ ToolChoiceEnum,
10
+ } from './agent.enum';
11
+
12
+ // Schema models
13
+ export {
14
+ AgentModel,
15
+ AgentSummaryModel,
16
+ AgentToolRefModel,
17
+ AgentWithToolsModel,
18
+ CreateAgentInputModel,
19
+ UpdateAgentInputModel,
20
+ } from './agent.schema';
21
+
22
+ // Contracts
23
+ export {
24
+ CreateAgentCommand,
25
+ UpdateAgentCommand,
26
+ GetAgentQuery,
27
+ ListAgentsQuery,
28
+ AssignToolToAgentCommand,
29
+ RemoveToolFromAgentCommand,
30
+ } from './agent.operation';
31
+
32
+ // Events
33
+ export {
34
+ AgentCreatedEvent,
35
+ AgentUpdatedEvent,
36
+ AgentToolAssignedEvent,
37
+ AgentToolRemovedEvent,
38
+ } from './agent.event';
39
+
40
+ // Entities
41
+ export {
42
+ AgentStatusEntityEnum,
43
+ ModelProviderEntityEnum,
44
+ AgentEntity,
45
+ AgentToolEntity,
46
+ } from './agent.entity';
47
+
48
+ // Presentations
49
+ export {
50
+ AgentListPresentation,
51
+ AgentDetailPresentation,
52
+ AgentConsoleDashboardPresentation,
53
+ } from './agent.presentation';
54
+
55
+ // Handlers
56
+ export {
57
+ mockListAgentsHandler,
58
+ mockGetAgentHandler,
59
+ mockCreateAgentHandler,
60
+ mockUpdateAgentHandler,
61
+ type ListAgentsInput,
62
+ type AgentSummary,
63
+ type ListAgentsOutput,
64
+ type GetAgentInput,
65
+ type AgentToolRef,
66
+ type AgentWithTools,
67
+ } from './agent.handler';
@@ -0,0 +1,13 @@
1
+ import { defineCapability, StabilityEnum } from '@contractspec/lib.contracts';
2
+
3
+ export const AgentCapability = defineCapability({
4
+ meta: {
5
+ key: 'agent',
6
+ version: '1.0.0',
7
+ kind: 'ui',
8
+ stability: StabilityEnum.Experimental,
9
+ description: 'AI agent management and console capability',
10
+ owners: ['platform.core'],
11
+ tags: ['agent', 'ai', 'console'],
12
+ },
13
+ });
@@ -0,0 +1,147 @@
1
+ /**
2
+ * Agent Console Feature Module Specification
3
+ *
4
+ * Defines the feature module for agent orchestration capabilities.
5
+ */
6
+ import type { FeatureModuleSpec } from '@contractspec/lib.contracts';
7
+ import { defineFeature } from '@contractspec/lib.contracts';
8
+
9
+ /**
10
+ * Agent Console feature module that bundles all agent, tool, and run
11
+ * operations, events, and presentations into an installable feature.
12
+ */
13
+ export const AgentConsoleFeature: FeatureModuleSpec = defineFeature({
14
+ meta: {
15
+ key: 'agent-console',
16
+ version: '1.0.0',
17
+ title: 'AI Agent Console',
18
+ description: 'AI agent orchestration with tools, runs, and logs management',
19
+ domain: 'ai-ops',
20
+ owners: ['@agent-console-team'],
21
+ tags: ['ai', 'agents', 'orchestration'],
22
+ stability: 'stable',
23
+ },
24
+
25
+ // All contract operations included in this feature
26
+ operations: [
27
+ // Agent operations
28
+ { key: 'agent-console.agent.create', version: '1.0.0' },
29
+ { key: 'agent-console.agent.update', version: '1.0.0' },
30
+ { key: 'agent-console.agent.get', version: '1.0.0' },
31
+ { key: 'agent-console.agent.list', version: '1.0.0' },
32
+ { key: 'agent-console.agent.assignTool', version: '1.0.0' },
33
+ { key: 'agent-console.agent.removeTool', version: '1.0.0' },
34
+
35
+ // Tool operations
36
+ { key: 'agent.tool.create', version: '1.0.0' },
37
+ { key: 'agent.tool.update', version: '1.0.0' },
38
+ { key: 'agent.tool.get', version: '1.0.0' },
39
+ { key: 'agent.tool.list', version: '1.0.0' },
40
+ { key: 'agent.tool.test', version: '1.0.0' },
41
+
42
+ // Run operations
43
+ { key: 'agent.run.execute', version: '1.0.0' },
44
+ { key: 'agent.run.cancel', version: '1.0.0' },
45
+ { key: 'agent.run.get', version: '1.0.0' },
46
+ { key: 'agent.run.list', version: '1.0.0' },
47
+ { key: 'agent.run.getSteps', version: '1.0.0' },
48
+ { key: 'agent.run.getLogs', version: '1.0.0' },
49
+ { key: 'agent.run.getMetrics', version: '1.0.0' },
50
+ ],
51
+
52
+ // Events emitted by this feature
53
+ events: [
54
+ // Agent events
55
+ { key: 'agent-console.agent.created', version: '1.0.0' },
56
+ { key: 'agent-console.agent.updated', version: '1.0.0' },
57
+ { key: 'agent-console.agent.toolAssigned', version: '1.0.0' },
58
+ { key: 'agent-console.agent.toolRemoved', version: '1.0.0' },
59
+
60
+ // Tool events
61
+ { key: 'agent.tool.created', version: '1.0.0' },
62
+ { key: 'agent.tool.updated', version: '1.0.0' },
63
+ { key: 'agent.tool.statusChanged', version: '1.0.0' },
64
+
65
+ // Run events
66
+ { key: 'agent.run.started', version: '1.0.0' },
67
+ { key: 'agent.run.completed', version: '1.0.0' },
68
+ { key: 'agent.run.failed', version: '1.0.0' },
69
+ { key: 'agent.run.cancelled', version: '1.0.0' },
70
+ { key: 'agent.run.toolInvoked', version: '1.0.0' },
71
+ { key: 'agent.run.toolCompleted', version: '1.0.0' },
72
+ { key: 'agent.run.messageGenerated', version: '1.0.0' },
73
+ ],
74
+
75
+ // Presentations associated with this feature
76
+ presentations: [
77
+ { key: 'agent-console.dashboard', version: '1.0.0' },
78
+ { key: 'agent-console.agent.list', version: '1.0.0' },
79
+ { key: 'agent-console.agent.detail', version: '1.0.0' },
80
+ { key: 'agent-console.run.list', version: '1.0.0' },
81
+ { key: 'agent-console.run.detail', version: '1.0.0' },
82
+ { key: 'agent-console.tool.list', version: '1.0.0' },
83
+ { key: 'agent-console.tool.detail', version: '1.0.0' },
84
+ ],
85
+
86
+ // Link operations to their primary presentations
87
+ opToPresentation: [
88
+ {
89
+ op: { key: 'agent-console.agent.list', version: '1.0.0' },
90
+ pres: { key: 'agent-console.agent.list', version: '1.0.0' },
91
+ },
92
+ {
93
+ op: { key: 'agent-console.agent.get', version: '1.0.0' },
94
+ pres: { key: 'agent-console.agent.detail', version: '1.0.0' },
95
+ },
96
+ {
97
+ op: { key: 'agent.run.list', version: '1.0.0' },
98
+ pres: { key: 'agent-console.run.list', version: '1.0.0' },
99
+ },
100
+ {
101
+ op: { key: 'agent.run.get', version: '1.0.0' },
102
+ pres: { key: 'agent-console.run.detail', version: '1.0.0' },
103
+ },
104
+ {
105
+ op: { key: 'agent.tool.list', version: '1.0.0' },
106
+ pres: { key: 'agent-console.tool.list', version: '1.0.0' },
107
+ },
108
+ {
109
+ op: { key: 'agent.tool.get', version: '1.0.0' },
110
+ pres: { key: 'agent-console.tool.detail', version: '1.0.0' },
111
+ },
112
+ ],
113
+
114
+ // Target requirements for multi-surface rendering
115
+ presentationsTargets: [
116
+ {
117
+ key: 'agent-console.dashboard',
118
+ version: '1.0.0',
119
+ targets: ['react', 'markdown'],
120
+ },
121
+ {
122
+ key: 'agent-console.agent.list',
123
+ version: '1.0.0',
124
+ targets: ['react', 'markdown', 'application/json'],
125
+ },
126
+ {
127
+ key: 'agent-console.run.list',
128
+ version: '1.0.0',
129
+ targets: ['react', 'markdown', 'application/json'],
130
+ },
131
+ {
132
+ key: 'agent-console.tool.list',
133
+ version: '1.0.0',
134
+ targets: ['react', 'markdown', 'application/json'],
135
+ },
136
+ ],
137
+
138
+ // Capability requirements
139
+ capabilities: {
140
+ requires: [
141
+ { key: 'identity', version: '1.0.0' },
142
+ { key: 'audit-trail', version: '1.0.0' },
143
+ { key: 'jobs', version: '1.0.0' },
144
+ ],
145
+ provides: [{ key: 'agent', version: '1.0.0' }],
146
+ },
147
+ });
@@ -0,0 +1,97 @@
1
+ import type { DocBlock } from '@contractspec/lib.contracts/docs';
2
+ import { registerDocBlocks } from '@contractspec/lib.contracts/docs';
3
+
4
+ const agentConsoleDocBlocks: DocBlock[] = [
5
+ {
6
+ id: 'docs.examples.agent-console.goal',
7
+ title: 'Agent Console — Goal',
8
+ summary: 'AI agent ops console: tools, agents, runs, logs, and metrics.',
9
+ kind: 'goal',
10
+ visibility: 'public',
11
+ route: '/docs/examples/agent-console/goal',
12
+ tags: ['ai', 'agents', 'goal'],
13
+ body: `## Why it matters
14
+ - Provides a regenerable agent operations surface with tool registry and run history.
15
+ - Prevents drift between tool schemas, agent configs, and execution logs.
16
+
17
+ ## Business/Product goal
18
+ - Safely manage tools/agents/runs with auditability and observability.
19
+ - Enable staged rollout of tools and metrics via feature flags.
20
+
21
+ ## Success criteria
22
+ - Tool/agent/run specs regenerate UI/API/events cleanly.
23
+ - Logs/metrics stay aligned and PII is scoped.`,
24
+ },
25
+ {
26
+ id: 'docs.examples.agent-console.usage',
27
+ title: 'Agent Console — Usage',
28
+ summary: 'How to operate, extend, and regenerate the agent console safely.',
29
+ kind: 'usage',
30
+ visibility: 'public',
31
+ route: '/docs/examples/agent-console/usage',
32
+ tags: ['ai', 'agents', 'usage'],
33
+ body: `## Setup
34
+ 1) Seed (if available) or create tools and agents; define run configs.
35
+ 2) Configure Notifications for run completion/failure; Audit for changes.
36
+
37
+ ## Extend & regenerate
38
+ 1) Adjust tool schemas (inputs/outputs), agent configs, run metrics in spec.
39
+ 2) Regenerate to sync UI/API/events/logs; mark PII paths for run payloads.
40
+ 3) Use Feature Flags to gate risky tools or execution policies.
41
+
42
+ ## Guardrails
43
+ - Emit events for run lifecycle; store logs with redaction where needed.
44
+ - Enforce tool input validation; avoid unsafe arbitrary code exec in handlers.
45
+ - Keep tenant/user scoping explicit for ops data.`,
46
+ },
47
+ {
48
+ id: 'docs.examples.agent-console.reference',
49
+ title: 'Agent Console — Reference',
50
+ summary:
51
+ 'Entities, contracts, events, and presentations for the agent console.',
52
+ kind: 'reference',
53
+ visibility: 'public',
54
+ route: '/docs/examples/agent-console',
55
+ tags: ['ai', 'agents', 'reference'],
56
+ body: `## Entities
57
+ - Tool, Agent, AgentTool, Run, RunStep, RunLog, RunMetric.
58
+
59
+ ## Contracts
60
+ - tool/create, agent/create, agent/execute, run/get, run/logs, run/metrics.
61
+
62
+ ## Events
63
+ - tool.created, agent.created, run.started/completed/failed, tool.invoked.
64
+
65
+ ## Presentations
66
+ - Tool registry, agent list/detail, run list/detail, metrics dashboards.
67
+
68
+ ## Notes
69
+ - Keep tool schemas explicit; enforce validation in spec.
70
+ - Use Audit Trail for agent/run changes; Notifications for run outcomes.`,
71
+ },
72
+ {
73
+ id: 'docs.examples.agent-console.constraints',
74
+ title: 'Agent Console — Constraints & Safety',
75
+ summary:
76
+ 'Internal guardrails for tool/agent/run safety, PII, and regeneration.',
77
+ kind: 'reference',
78
+ visibility: 'internal',
79
+ route: '/docs/examples/agent-console/constraints',
80
+ tags: ['ai', 'agents', 'constraints', 'internal'],
81
+ body: `## Constraints
82
+ - Tool schemas (inputs/outputs) must be explicit in spec; no arbitrary untyped payloads.
83
+ - Events to emit: tool.created, agent.created, run.started/completed/failed, tool.invoked.
84
+ - Regeneration must not loosen execution policies or logging without explicit spec diff.
85
+
86
+ ## Safety & PII
87
+ - Mark PII in run payloads/logs; redact in markdown/JSON targets.
88
+ - Avoid exposing raw tool outputs to MCP/web without policy checks.
89
+
90
+ ## Verification
91
+ - Add fixtures for tool schema changes and run lifecycle.
92
+ - Ensure Audit/Notifications remain wired for runs; metrics collection unchanged.
93
+ - Use Feature Flags to gate risky tools; default safe/off.`,
94
+ },
95
+ ];
96
+
97
+ registerDocBlocks(agentConsoleDocBlocks);
@@ -0,0 +1 @@
1
+ import './agent-console.docblock';
package/src/example.ts ADDED
@@ -0,0 +1,41 @@
1
+ import { defineExample } from '@contractspec/lib.contracts';
2
+
3
+ const example = defineExample({
4
+ meta: {
5
+ key: 'agent-console',
6
+ version: '1.0.0',
7
+ title: 'Agent Console',
8
+ description:
9
+ 'AI agent ops console: tools, agents, runs, logs, and metrics (spec-first, regenerable).',
10
+ kind: 'template',
11
+ visibility: 'public',
12
+ stability: 'experimental',
13
+ owners: ['@platform.core'],
14
+ tags: ['ai', 'agents', 'tools', 'orchestration'],
15
+ },
16
+ docs: {
17
+ rootDocId: 'docs.examples.agent-console.reference',
18
+ goalDocId: 'docs.examples.agent-console.goal',
19
+ usageDocId: 'docs.examples.agent-console.usage',
20
+ constraintsDocId: 'docs.examples.agent-console.constraints',
21
+ },
22
+ entrypoints: {
23
+ packageName: '@contractspec/example.agent-console',
24
+ feature: './feature',
25
+ contracts: './contracts',
26
+ presentations: './presentations',
27
+ handlers: './handlers',
28
+ docs: './docs',
29
+ },
30
+ surfaces: {
31
+ templates: true,
32
+ sandbox: {
33
+ enabled: true,
34
+ modes: ['playground', 'specs', 'builder', 'markdown', 'evolution'],
35
+ },
36
+ studio: { enabled: true, installable: true },
37
+ mcp: { enabled: true },
38
+ },
39
+ });
40
+
41
+ export default example;