@lssm/example.agent-console 0.0.0-canary-20251206160926

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 (175) hide show
  1. package/.turbo/turbo-build.log +202 -0
  2. package/CHANGELOG.md +13 -0
  3. package/README.md +83 -0
  4. package/dist/contracts/agent.d.ts +886 -0
  5. package/dist/contracts/agent.js +1 -0
  6. package/dist/contracts/index.d.ts +4 -0
  7. package/dist/contracts/index.js +1 -0
  8. package/dist/contracts/run.d.ts +1106 -0
  9. package/dist/contracts/run.js +1 -0
  10. package/dist/contracts/tool.d.ts +607 -0
  11. package/dist/contracts/tool.js +1 -0
  12. package/dist/entities/agent.d.ts +54 -0
  13. package/dist/entities/agent.js +1 -0
  14. package/dist/entities/index.d.ts +4 -0
  15. package/dist/entities/index.js +1 -0
  16. package/dist/entities/log.d.ts +31 -0
  17. package/dist/entities/log.js +1 -0
  18. package/dist/entities/run.d.ts +85 -0
  19. package/dist/entities/run.js +1 -0
  20. package/dist/entities/tool.d.ts +36 -0
  21. package/dist/entities/tool.js +1 -0
  22. package/dist/events.d.ts +965 -0
  23. package/dist/events.js +1 -0
  24. package/dist/feature.d.ts +11 -0
  25. package/dist/feature.js +1 -0
  26. package/dist/handlers/agent.handlers.d.ts +99 -0
  27. package/dist/handlers/agent.handlers.js +1 -0
  28. package/dist/handlers/index.d.ts +5 -0
  29. package/dist/handlers/index.js +1 -0
  30. package/dist/handlers/mock-data.d.ts +533 -0
  31. package/dist/handlers/mock-data.js +1 -0
  32. package/dist/handlers/run.handlers.d.ts +145 -0
  33. package/dist/handlers/run.handlers.js +1 -0
  34. package/dist/handlers/tool.handlers.d.ts +86 -0
  35. package/dist/handlers/tool.handlers.js +1 -0
  36. package/dist/index.d.ts +18 -0
  37. package/dist/index.js +1 -0
  38. package/dist/libs/contracts/dist/capabilities/openbanking.js +1 -0
  39. package/dist/libs/contracts/dist/client/index.js +1 -0
  40. package/dist/libs/contracts/dist/client/react/feature-render.js +1 -0
  41. package/dist/libs/contracts/dist/client/react/form-render.js +1 -0
  42. package/dist/libs/contracts/dist/client/react/index.js +1 -0
  43. package/dist/libs/contracts/dist/events.js +1 -0
  44. package/dist/libs/contracts/dist/experiments/evaluator.js +1 -0
  45. package/dist/libs/contracts/dist/graphql-federation/dist/index.js +1 -0
  46. package/dist/libs/contracts/dist/index.js +1 -0
  47. package/dist/libs/contracts/dist/install.js +1 -0
  48. package/dist/libs/contracts/dist/integrations/contracts.js +1 -0
  49. package/dist/libs/contracts/dist/integrations/index.js +1 -0
  50. package/dist/libs/contracts/dist/integrations/openbanking/contracts/accounts.js +1 -0
  51. package/dist/libs/contracts/dist/integrations/openbanking/contracts/balances.js +1 -0
  52. package/dist/libs/contracts/dist/integrations/openbanking/contracts/index.js +1 -0
  53. package/dist/libs/contracts/dist/integrations/openbanking/contracts/transactions.js +1 -0
  54. package/dist/libs/contracts/dist/integrations/openbanking/models.js +1 -0
  55. package/dist/libs/contracts/dist/integrations/openbanking/telemetry.js +1 -0
  56. package/dist/libs/contracts/dist/integrations/providers/elevenlabs.js +1 -0
  57. package/dist/libs/contracts/dist/integrations/providers/gcs-storage.js +1 -0
  58. package/dist/libs/contracts/dist/integrations/providers/gmail.js +1 -0
  59. package/dist/libs/contracts/dist/integrations/providers/google-calendar.js +1 -0
  60. package/dist/libs/contracts/dist/integrations/providers/impls/elevenlabs-voice.js +1 -0
  61. package/dist/libs/contracts/dist/integrations/providers/impls/gcs-storage.js +1 -0
  62. package/dist/libs/contracts/dist/integrations/providers/impls/gmail-inbound.js +1 -0
  63. package/dist/libs/contracts/dist/integrations/providers/impls/gmail-outbound.js +1 -0
  64. package/dist/libs/contracts/dist/integrations/providers/impls/google-calendar.js +1 -0
  65. package/dist/libs/contracts/dist/integrations/providers/impls/index.js +1 -0
  66. package/dist/libs/contracts/dist/integrations/providers/impls/mistral-embedding.js +1 -0
  67. package/dist/libs/contracts/dist/integrations/providers/impls/mistral-llm.js +1 -0
  68. package/dist/libs/contracts/dist/integrations/providers/impls/postmark-email.js +1 -0
  69. package/dist/libs/contracts/dist/integrations/providers/impls/powens-client.js +1 -0
  70. package/dist/libs/contracts/dist/integrations/providers/impls/powens-openbanking.js +1 -0
  71. package/dist/libs/contracts/dist/integrations/providers/impls/provider-factory.js +1 -0
  72. package/dist/libs/contracts/dist/integrations/providers/impls/qdrant-vector.js +1 -0
  73. package/dist/libs/contracts/dist/integrations/providers/impls/stripe-payments.js +1 -0
  74. package/dist/libs/contracts/dist/integrations/providers/impls/twilio-sms.js +1 -0
  75. package/dist/libs/contracts/dist/integrations/providers/index.js +1 -0
  76. package/dist/libs/contracts/dist/integrations/providers/mistral.js +1 -0
  77. package/dist/libs/contracts/dist/integrations/providers/postmark.js +1 -0
  78. package/dist/libs/contracts/dist/integrations/providers/powens.js +1 -0
  79. package/dist/libs/contracts/dist/integrations/providers/qdrant.js +1 -0
  80. package/dist/libs/contracts/dist/integrations/providers/stripe.js +1 -0
  81. package/dist/libs/contracts/dist/integrations/providers/twilio-sms.js +1 -0
  82. package/dist/libs/contracts/dist/integrations/runtime.js +1 -0
  83. package/dist/libs/contracts/dist/integrations/secrets/env-secret-provider.js +1 -0
  84. package/dist/libs/contracts/dist/integrations/secrets/gcp-secret-manager.js +1 -0
  85. package/dist/libs/contracts/dist/integrations/secrets/index.js +1 -0
  86. package/dist/libs/contracts/dist/integrations/secrets/manager.js +1 -0
  87. package/dist/libs/contracts/dist/integrations/secrets/provider.js +1 -0
  88. package/dist/libs/contracts/dist/jsonschema.js +1 -0
  89. package/dist/libs/contracts/dist/knowledge/contracts.js +1 -0
  90. package/dist/libs/contracts/dist/knowledge/index.js +1 -0
  91. package/dist/libs/contracts/dist/knowledge/spaces/email-threads.js +1 -0
  92. package/dist/libs/contracts/dist/knowledge/spaces/financial-docs.js +1 -0
  93. package/dist/libs/contracts/dist/knowledge/spaces/financial-overview.js +1 -0
  94. package/dist/libs/contracts/dist/knowledge/spaces/index.js +1 -0
  95. package/dist/libs/contracts/dist/knowledge/spaces/product-canon.js +1 -0
  96. package/dist/libs/contracts/dist/knowledge/spaces/support-faq.js +1 -0
  97. package/dist/libs/contracts/dist/knowledge/spaces/uploaded-docs.js +1 -0
  98. package/dist/libs/contracts/dist/onboarding-base.js +1 -0
  99. package/dist/libs/contracts/dist/ownership.js +1 -0
  100. package/dist/libs/contracts/dist/presentations.js +1 -0
  101. package/dist/libs/contracts/dist/presentations.v2.js +1 -0
  102. package/dist/libs/contracts/dist/prompt.js +1 -0
  103. package/dist/libs/contracts/dist/promptRegistry.js +1 -0
  104. package/dist/libs/contracts/dist/regenerator/index.js +1 -0
  105. package/dist/libs/contracts/dist/regenerator/service.js +1 -0
  106. package/dist/libs/contracts/dist/registry.js +1 -0
  107. package/dist/libs/contracts/dist/resources.js +1 -0
  108. package/dist/libs/contracts/dist/schema/dist/EnumType.js +1 -0
  109. package/dist/libs/contracts/dist/schema/dist/FieldType.js +1 -0
  110. package/dist/libs/contracts/dist/schema/dist/ScalarTypeEnum.js +1 -0
  111. package/dist/libs/contracts/dist/schema/dist/SchemaModel.js +1 -0
  112. package/dist/libs/contracts/dist/schema/dist/entity/defineEntity.js +1 -0
  113. package/dist/libs/contracts/dist/schema/dist/entity/index.js +1 -0
  114. package/dist/libs/contracts/dist/schema/dist/entity/types.js +1 -0
  115. package/dist/libs/contracts/dist/schema/dist/index.js +1 -0
  116. package/dist/libs/contracts/dist/server/graphql-pothos.js +1 -0
  117. package/dist/libs/contracts/dist/server/graphql-schema-export.js +1 -0
  118. package/dist/libs/contracts/dist/server/index.js +1 -0
  119. package/dist/libs/contracts/dist/server/provider-mcp.js +1 -0
  120. package/dist/libs/contracts/dist/server/rest-elysia.js +1 -0
  121. package/dist/libs/contracts/dist/server/rest-express.js +1 -0
  122. package/dist/libs/contracts/dist/server/rest-generic.js +1 -0
  123. package/dist/libs/contracts/dist/server/rest-next-app.js +1 -0
  124. package/dist/libs/contracts/dist/server/rest-next-pages.js +1 -0
  125. package/dist/libs/contracts/dist/spec.js +1 -0
  126. package/dist/libs/contracts/dist/telemetry/index.js +1 -0
  127. package/dist/libs/contracts/dist/telemetry/tracker.js +1 -0
  128. package/dist/libs/contracts/dist/tests/index.js +1 -0
  129. package/dist/libs/contracts/dist/tests/runner.js +1 -0
  130. package/dist/libs/contracts/dist/workflow/index.js +1 -0
  131. package/dist/libs/contracts/dist/workflow/runner.js +1 -0
  132. package/dist/libs/schema/dist/EnumType.js +1 -0
  133. package/dist/libs/schema/dist/FieldType.js +1 -0
  134. package/dist/libs/schema/dist/ScalarTypeEnum.js +1 -0
  135. package/dist/libs/schema/dist/SchemaModel.js +1 -0
  136. package/dist/libs/schema/dist/entity/defineEntity.js +1 -0
  137. package/dist/libs/schema/dist/entity/index.js +1 -0
  138. package/dist/libs/schema/dist/entity/types.js +1 -0
  139. package/dist/libs/schema/dist/index.js +1 -0
  140. package/dist/presentations/agent-list.d.ts +15 -0
  141. package/dist/presentations/agent-list.js +1 -0
  142. package/dist/presentations/dashboard.d.ts +11 -0
  143. package/dist/presentations/dashboard.js +1 -0
  144. package/dist/presentations/index.d.ts +11 -0
  145. package/dist/presentations/index.js +1 -0
  146. package/dist/presentations/run-list.d.ts +18 -0
  147. package/dist/presentations/run-list.js +1 -0
  148. package/dist/presentations/tool-registry.d.ts +14 -0
  149. package/dist/presentations/tool-registry.js +1 -0
  150. package/package.json +86 -0
  151. package/src/contracts/agent.ts +501 -0
  152. package/src/contracts/index.ts +29 -0
  153. package/src/contracts/run.ts +561 -0
  154. package/src/contracts/tool.ts +392 -0
  155. package/src/entities/agent.ts +151 -0
  156. package/src/entities/index.ts +20 -0
  157. package/src/entities/log.ts +76 -0
  158. package/src/entities/run.ts +240 -0
  159. package/src/entities/tool.ts +105 -0
  160. package/src/events.ts +419 -0
  161. package/src/feature.ts +144 -0
  162. package/src/handlers/agent.handlers.ts +203 -0
  163. package/src/handlers/index.ts +55 -0
  164. package/src/handlers/mock-data.ts +413 -0
  165. package/src/handlers/run.handlers.ts +331 -0
  166. package/src/handlers/tool.handlers.ts +188 -0
  167. package/src/index.ts +34 -0
  168. package/src/presentations/agent-list.ts +55 -0
  169. package/src/presentations/dashboard.ts +29 -0
  170. package/src/presentations/index.ts +48 -0
  171. package/src/presentations/run-list.ts +76 -0
  172. package/src/presentations/tool-registry.ts +52 -0
  173. package/tsconfig.json +10 -0
  174. package/tsconfig.tsbuildinfo +1 -0
  175. package/tsdown.config.js +7 -0
@@ -0,0 +1,501 @@
1
+ import { defineCommand, defineQuery } from '@lssm/lib.contracts/spec';
2
+ import {
3
+ defineSchemaModel,
4
+ ScalarTypeEnum,
5
+ defineEnum,
6
+ } from '@lssm/lib.schema';
7
+
8
+ const OWNERS = ['agent-console-team'] as const;
9
+
10
+ // ============ Enums ============
11
+
12
+ export const AgentStatusEnum = defineEnum('AgentStatus', [
13
+ 'DRAFT',
14
+ 'ACTIVE',
15
+ 'PAUSED',
16
+ 'ARCHIVED',
17
+ ]);
18
+ export const ModelProviderEnum = defineEnum('ModelProvider', [
19
+ 'OPENAI',
20
+ 'ANTHROPIC',
21
+ 'GOOGLE',
22
+ 'MISTRAL',
23
+ 'CUSTOM',
24
+ ]);
25
+ export const ToolChoiceEnum = defineEnum('ToolChoice', [
26
+ 'auto',
27
+ 'required',
28
+ 'none',
29
+ ]);
30
+
31
+ // ============ Schemas ============
32
+
33
+ export const AgentModel = defineSchemaModel({
34
+ name: 'Agent',
35
+ description: 'AI agent configuration',
36
+ fields: {
37
+ id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
38
+ organizationId: {
39
+ type: ScalarTypeEnum.String_unsecure(),
40
+ isOptional: false,
41
+ },
42
+ name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
43
+ slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
44
+ description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
45
+ status: { type: AgentStatusEnum, isOptional: false },
46
+ modelProvider: { type: ModelProviderEnum, isOptional: false },
47
+ modelName: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
48
+ modelConfig: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
49
+ systemPrompt: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
50
+ userPromptTemplate: {
51
+ type: ScalarTypeEnum.String_unsecure(),
52
+ isOptional: true,
53
+ },
54
+ toolIds: {
55
+ type: ScalarTypeEnum.String_unsecure(),
56
+ isArray: true,
57
+ isOptional: true,
58
+ },
59
+ toolChoice: {
60
+ type: ToolChoiceEnum,
61
+ isOptional: false,
62
+ defaultValue: 'auto',
63
+ },
64
+ maxIterations: {
65
+ type: ScalarTypeEnum.Int_unsecure(),
66
+ isOptional: false,
67
+ defaultValue: 10,
68
+ },
69
+ maxTokensPerRun: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
70
+ timeoutMs: {
71
+ type: ScalarTypeEnum.Int_unsecure(),
72
+ isOptional: false,
73
+ defaultValue: 120000,
74
+ },
75
+ version: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
76
+ tags: {
77
+ type: ScalarTypeEnum.String_unsecure(),
78
+ isArray: true,
79
+ isOptional: true,
80
+ },
81
+ createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
82
+ updatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
83
+ },
84
+ });
85
+
86
+ export const AgentSummaryModel = defineSchemaModel({
87
+ name: 'AgentSummary',
88
+ description: 'Summary of an agent for list views',
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: true },
94
+ status: { type: AgentStatusEnum, isOptional: false },
95
+ modelProvider: { type: ModelProviderEnum, isOptional: false },
96
+ modelName: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
97
+ version: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
98
+ createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
99
+ },
100
+ });
101
+
102
+ export const AgentToolRefModel = defineSchemaModel({
103
+ name: 'AgentToolRef',
104
+ description: 'Tool reference in agent context',
105
+ fields: {
106
+ id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
107
+ name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
108
+ slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
109
+ description: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
110
+ category: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
111
+ },
112
+ });
113
+
114
+ export const AgentWithToolsModel = defineSchemaModel({
115
+ name: 'AgentWithTools',
116
+ description: 'Agent with associated tools',
117
+ fields: {
118
+ id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
119
+ organizationId: {
120
+ type: ScalarTypeEnum.String_unsecure(),
121
+ isOptional: false,
122
+ },
123
+ name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
124
+ slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
125
+ description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
126
+ status: { type: AgentStatusEnum, isOptional: false },
127
+ modelProvider: { type: ModelProviderEnum, isOptional: false },
128
+ modelName: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
129
+ modelConfig: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
130
+ systemPrompt: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
131
+ userPromptTemplate: {
132
+ type: ScalarTypeEnum.String_unsecure(),
133
+ isOptional: true,
134
+ },
135
+ toolIds: {
136
+ type: ScalarTypeEnum.String_unsecure(),
137
+ isArray: true,
138
+ isOptional: true,
139
+ },
140
+ toolChoice: { type: ToolChoiceEnum, isOptional: false },
141
+ maxIterations: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
142
+ maxTokensPerRun: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
143
+ timeoutMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
144
+ version: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
145
+ tags: {
146
+ type: ScalarTypeEnum.String_unsecure(),
147
+ isArray: true,
148
+ isOptional: true,
149
+ },
150
+ createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
151
+ updatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
152
+ tools: { type: AgentToolRefModel, isArray: true, isOptional: true },
153
+ },
154
+ });
155
+
156
+ export const CreateAgentInputModel = defineSchemaModel({
157
+ name: 'CreateAgentInput',
158
+ description: 'Input for creating an agent',
159
+ fields: {
160
+ organizationId: {
161
+ type: ScalarTypeEnum.String_unsecure(),
162
+ isOptional: false,
163
+ },
164
+ name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
165
+ slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
166
+ description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
167
+ modelProvider: { type: ModelProviderEnum, isOptional: false },
168
+ modelName: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
169
+ modelConfig: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
170
+ systemPrompt: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
171
+ userPromptTemplate: {
172
+ type: ScalarTypeEnum.String_unsecure(),
173
+ isOptional: true,
174
+ },
175
+ toolIds: {
176
+ type: ScalarTypeEnum.String_unsecure(),
177
+ isArray: true,
178
+ isOptional: true,
179
+ },
180
+ toolChoice: { type: ToolChoiceEnum, isOptional: true },
181
+ maxIterations: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
182
+ maxTokensPerRun: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
183
+ timeoutMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
184
+ tags: {
185
+ type: ScalarTypeEnum.String_unsecure(),
186
+ isArray: true,
187
+ isOptional: true,
188
+ },
189
+ },
190
+ });
191
+
192
+ export const UpdateAgentInputModel = defineSchemaModel({
193
+ name: 'UpdateAgentInput',
194
+ description: 'Input for updating an agent',
195
+ fields: {
196
+ agentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
197
+ name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: true },
198
+ description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
199
+ status: { type: AgentStatusEnum, isOptional: true },
200
+ modelConfig: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
201
+ systemPrompt: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
202
+ userPromptTemplate: {
203
+ type: ScalarTypeEnum.String_unsecure(),
204
+ isOptional: true,
205
+ },
206
+ toolIds: {
207
+ type: ScalarTypeEnum.String_unsecure(),
208
+ isArray: true,
209
+ isOptional: true,
210
+ },
211
+ toolChoice: { type: ToolChoiceEnum, isOptional: true },
212
+ maxIterations: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
213
+ maxTokensPerRun: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
214
+ timeoutMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
215
+ tags: {
216
+ type: ScalarTypeEnum.String_unsecure(),
217
+ isArray: true,
218
+ isOptional: true,
219
+ },
220
+ },
221
+ });
222
+
223
+ // ============ Contracts ============
224
+
225
+ /**
226
+ * CreateAgentCommand - Creates a new agent configuration
227
+ */
228
+ export const CreateAgentCommand = defineCommand({
229
+ meta: {
230
+ name: 'agent.agent.create',
231
+ version: 1,
232
+ stability: 'stable',
233
+ owners: [...OWNERS],
234
+ tags: ['agent', 'create'],
235
+ description: 'Creates a new AI agent configuration.',
236
+ goal: 'Allow users to define new AI agents with specific models and tools.',
237
+ context: 'Called from the agent builder UI when creating a new agent.',
238
+ },
239
+ io: {
240
+ input: CreateAgentInputModel,
241
+ output: defineSchemaModel({
242
+ name: 'CreateAgentOutput',
243
+ fields: {
244
+ id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
245
+ name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
246
+ slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
247
+ status: { type: AgentStatusEnum, isOptional: false },
248
+ },
249
+ }),
250
+ errors: {
251
+ SLUG_EXISTS: {
252
+ description:
253
+ 'An agent with this slug already exists in the organization',
254
+ http: 409,
255
+ gqlCode: 'SLUG_EXISTS',
256
+ when: 'Slug is already taken',
257
+ },
258
+ },
259
+ },
260
+ policy: {
261
+ auth: 'user',
262
+ },
263
+ sideEffects: {
264
+ emits: [
265
+ {
266
+ name: 'agent.created',
267
+ version: 1,
268
+ when: 'Agent is successfully created',
269
+ payload: AgentSummaryModel,
270
+ },
271
+ ],
272
+ audit: ['agent.created'],
273
+ },
274
+ });
275
+
276
+ /**
277
+ * UpdateAgentCommand - Updates an existing agent
278
+ */
279
+ export const UpdateAgentCommand = defineCommand({
280
+ meta: {
281
+ name: 'agent.agent.update',
282
+ version: 1,
283
+ stability: 'stable',
284
+ owners: [...OWNERS],
285
+ tags: ['agent', 'update'],
286
+ description: 'Updates an existing AI agent configuration.',
287
+ goal: 'Allow users to modify agent settings and configuration.',
288
+ context: 'Called from the agent settings UI.',
289
+ },
290
+ io: {
291
+ input: UpdateAgentInputModel,
292
+ output: defineSchemaModel({
293
+ name: 'UpdateAgentOutput',
294
+ fields: {
295
+ id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
296
+ name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
297
+ status: { type: AgentStatusEnum, isOptional: false },
298
+ updatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
299
+ },
300
+ }),
301
+ errors: {
302
+ AGENT_NOT_FOUND: {
303
+ description: 'The specified agent does not exist',
304
+ http: 404,
305
+ gqlCode: 'AGENT_NOT_FOUND',
306
+ when: 'Agent ID is invalid',
307
+ },
308
+ },
309
+ },
310
+ policy: {
311
+ auth: 'user',
312
+ },
313
+ sideEffects: {
314
+ emits: [
315
+ {
316
+ name: 'agent.updated',
317
+ version: 1,
318
+ when: 'Agent is updated',
319
+ payload: AgentSummaryModel,
320
+ },
321
+ ],
322
+ audit: ['agent.updated'],
323
+ },
324
+ });
325
+
326
+ /**
327
+ * GetAgentQuery - Retrieves an agent by ID
328
+ */
329
+ export const GetAgentQuery = defineQuery({
330
+ meta: {
331
+ name: 'agent.agent.get',
332
+ version: 1,
333
+ stability: 'stable',
334
+ owners: [...OWNERS],
335
+ tags: ['agent', 'get'],
336
+ description: 'Retrieves an agent by its ID.',
337
+ goal: 'View detailed agent configuration.',
338
+ context: 'Called when viewing agent details or editing.',
339
+ },
340
+ io: {
341
+ input: defineSchemaModel({
342
+ name: 'GetAgentInput',
343
+ fields: {
344
+ agentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
345
+ includeTools: { type: ScalarTypeEnum.Boolean(), isOptional: true },
346
+ },
347
+ }),
348
+ output: AgentWithToolsModel,
349
+ errors: {
350
+ AGENT_NOT_FOUND: {
351
+ description: 'The specified agent does not exist',
352
+ http: 404,
353
+ gqlCode: 'AGENT_NOT_FOUND',
354
+ when: 'Agent ID is invalid',
355
+ },
356
+ },
357
+ },
358
+ policy: {
359
+ auth: 'user',
360
+ },
361
+ });
362
+
363
+ /**
364
+ * ListAgentsQuery - Lists agents for an organization
365
+ */
366
+ export const ListAgentsQuery = defineQuery({
367
+ meta: {
368
+ name: 'agent.agent.list',
369
+ version: 1,
370
+ stability: 'stable',
371
+ owners: [...OWNERS],
372
+ tags: ['agent', 'list'],
373
+ description: 'Lists agents for an organization with optional filtering.',
374
+ goal: 'Browse and search available agents.',
375
+ context: 'Agent list/dashboard view.',
376
+ },
377
+ io: {
378
+ input: defineSchemaModel({
379
+ name: 'ListAgentsInput',
380
+ fields: {
381
+ organizationId: {
382
+ type: ScalarTypeEnum.String_unsecure(),
383
+ isOptional: false,
384
+ },
385
+ status: { type: AgentStatusEnum, isOptional: true },
386
+ modelProvider: { type: ModelProviderEnum, isOptional: true },
387
+ search: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
388
+ limit: {
389
+ type: ScalarTypeEnum.Int_unsecure(),
390
+ isOptional: true,
391
+ defaultValue: 20,
392
+ },
393
+ offset: {
394
+ type: ScalarTypeEnum.Int_unsecure(),
395
+ isOptional: true,
396
+ defaultValue: 0,
397
+ },
398
+ },
399
+ }),
400
+ output: defineSchemaModel({
401
+ name: 'ListAgentsOutput',
402
+ fields: {
403
+ items: { type: AgentSummaryModel, isArray: true, isOptional: false },
404
+ total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
405
+ hasMore: { type: ScalarTypeEnum.Boolean(), isOptional: false },
406
+ },
407
+ }),
408
+ },
409
+ policy: {
410
+ auth: 'user',
411
+ },
412
+ });
413
+
414
+ /**
415
+ * AssignToolToAgentCommand - Assigns a tool to an agent
416
+ */
417
+ export const AssignToolToAgentCommand = defineCommand({
418
+ meta: {
419
+ name: 'agent.agent.assignTool',
420
+ version: 1,
421
+ stability: 'stable',
422
+ owners: [...OWNERS],
423
+ tags: ['agent', 'tool', 'assign'],
424
+ description: 'Assigns a tool to an agent with optional configuration.',
425
+ goal: 'Enable agents to use specific tools.',
426
+ context: 'Agent configuration UI - tool selection.',
427
+ },
428
+ io: {
429
+ input: defineSchemaModel({
430
+ name: 'AssignToolToAgentInput',
431
+ fields: {
432
+ agentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
433
+ toolId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
434
+ config: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
435
+ order: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
436
+ },
437
+ }),
438
+ output: defineSchemaModel({
439
+ name: 'AssignToolToAgentOutput',
440
+ fields: {
441
+ agentToolId: {
442
+ type: ScalarTypeEnum.String_unsecure(),
443
+ isOptional: false,
444
+ },
445
+ agentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
446
+ toolId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
447
+ },
448
+ }),
449
+ errors: {
450
+ TOOL_ALREADY_ASSIGNED: {
451
+ description: 'This tool is already assigned to the agent',
452
+ http: 409,
453
+ gqlCode: 'TOOL_ALREADY_ASSIGNED',
454
+ when: 'Tool assignment already exists',
455
+ },
456
+ },
457
+ },
458
+ policy: {
459
+ auth: 'user',
460
+ },
461
+ sideEffects: {
462
+ audit: ['agent.tool.assigned'],
463
+ },
464
+ });
465
+
466
+ /**
467
+ * RemoveToolFromAgentCommand - Removes a tool from an agent
468
+ */
469
+ export const RemoveToolFromAgentCommand = defineCommand({
470
+ meta: {
471
+ name: 'agent.agent.removeTool',
472
+ version: 1,
473
+ stability: 'stable',
474
+ owners: [...OWNERS],
475
+ tags: ['agent', 'tool', 'remove'],
476
+ description: 'Removes a tool assignment from an agent.',
477
+ goal: 'Disable specific tools for an agent.',
478
+ context: 'Agent configuration UI - tool management.',
479
+ },
480
+ io: {
481
+ input: defineSchemaModel({
482
+ name: 'RemoveToolFromAgentInput',
483
+ fields: {
484
+ agentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
485
+ toolId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
486
+ },
487
+ }),
488
+ output: defineSchemaModel({
489
+ name: 'RemoveToolFromAgentOutput',
490
+ fields: {
491
+ success: { type: ScalarTypeEnum.Boolean(), isOptional: false },
492
+ },
493
+ }),
494
+ },
495
+ policy: {
496
+ auth: 'user',
497
+ },
498
+ sideEffects: {
499
+ audit: ['agent.tool.removed'],
500
+ },
501
+ });
@@ -0,0 +1,29 @@
1
+ // Tool contracts
2
+ export {
3
+ CreateToolCommand,
4
+ UpdateToolCommand,
5
+ GetToolQuery,
6
+ ListToolsQuery,
7
+ TestToolCommand,
8
+ } from './tool';
9
+
10
+ // Agent contracts
11
+ export {
12
+ CreateAgentCommand,
13
+ UpdateAgentCommand,
14
+ GetAgentQuery,
15
+ ListAgentsQuery,
16
+ AssignToolToAgentCommand,
17
+ RemoveToolFromAgentCommand,
18
+ } from './agent';
19
+
20
+ // Run contracts
21
+ export {
22
+ ExecuteAgentCommand,
23
+ CancelRunCommand,
24
+ GetRunQuery,
25
+ ListRunsQuery,
26
+ GetRunStepsQuery,
27
+ GetRunLogsQuery,
28
+ GetRunMetricsQuery,
29
+ } from './run';