@lssm/example.agent-console 0.0.0-canary-20251215234340 → 0.0.0-canary-20251216024228
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.
- package/.turbo/turbo-build.log +38 -28
- package/CHANGELOG.md +6 -6
- package/dist/agent/agent.contracts.js +1 -0
- package/dist/{entities/agent.js → agent/agent.entity.js} +1 -1
- package/dist/agent/agent.enum.js +1 -0
- package/dist/agent/agent.event.js +1 -0
- package/dist/agent/agent.handler.js +1 -0
- package/dist/agent/agent.presentation.js +1 -0
- package/dist/agent/agent.schema.js +1 -0
- package/dist/agent/index.js +1 -0
- package/dist/handlers/index.js +1 -1
- package/dist/index.js +1 -1
- package/dist/presentations/index.js +1 -1
- package/dist/run/index.js +1 -0
- package/dist/run/run.contracts.js +1 -0
- package/dist/run/run.entity.js +1 -0
- package/dist/run/run.enum.js +1 -0
- package/dist/run/run.event.js +1 -0
- package/dist/run/run.handler.js +1 -0
- package/dist/run/run.presentation.js +1 -0
- package/dist/run/run.schema.js +1 -0
- package/dist/shared/index.js +1 -0
- package/dist/shared/mock-agents.js +1 -0
- package/dist/shared/mock-runs.js +1 -0
- package/dist/shared/mock-tools.js +1 -0
- package/dist/tool/index.js +1 -0
- package/dist/tool/tool.contracts.js +1 -0
- package/dist/tool/tool.entity.js +1 -0
- package/dist/tool/tool.enum.js +1 -0
- package/dist/tool/tool.event.js +1 -0
- package/dist/tool/tool.handler.js +1 -0
- package/dist/tool/tool.presentation.js +1 -0
- package/dist/tool/tool.schema.js +1 -0
- package/package.json +59 -39
- package/src/agent/agent.contracts.ts +275 -0
- package/src/agent/agent.entity.ts +84 -0
- package/src/agent/agent.enum.ts +31 -0
- package/src/agent/agent.event.ts +109 -0
- package/src/{handlers/agent.handlers.ts → agent/agent.handler.ts} +23 -78
- package/src/{presentations/agent-list.ts → agent/agent.presentation.ts} +26 -14
- package/src/agent/agent.schema.ts +147 -0
- package/src/agent/index.ts +65 -0
- package/src/handlers/index.ts +17 -44
- package/src/index.ts +6 -15
- package/src/presentations/index.ts +13 -34
- package/src/run/index.ts +65 -0
- package/src/run/run.contracts.ts +266 -0
- package/src/run/run.entity.ts +126 -0
- package/src/run/run.enum.ts +45 -0
- package/src/run/run.event.ts +211 -0
- package/src/run/run.handler.ts +103 -0
- package/src/run/run.presentation.ts +47 -0
- package/src/run/run.schema.ts +139 -0
- package/src/shared/index.ts +6 -0
- package/src/shared/mock-agents.ts +83 -0
- package/src/shared/mock-runs.ts +108 -0
- package/src/shared/mock-tools.ts +146 -0
- package/src/tool/index.ts +35 -0
- package/src/tool/tool.contracts.ts +180 -0
- package/src/tool/tool.entity.ts +66 -0
- package/src/tool/tool.enum.ts +34 -0
- package/src/tool/tool.event.ts +84 -0
- package/src/tool/tool.handler.ts +107 -0
- package/src/{presentations/tool-registry.ts → tool/tool.presentation.ts} +12 -17
- package/src/tool/tool.schema.ts +134 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/contracts/agent.js +0 -1
- package/dist/contracts/index.js +0 -1
- package/dist/contracts/run.js +0 -1
- package/dist/contracts/tool.js +0 -1
- package/dist/entities/index.js +0 -1
- package/dist/entities/log.js +0 -1
- package/dist/entities/run.js +0 -1
- package/dist/entities/tool.js +0 -1
- package/dist/events.js +0 -1
- package/dist/handlers/agent.handlers.js +0 -1
- package/dist/handlers/mock-data.js +0 -1
- package/dist/handlers/run.handlers.js +0 -1
- package/dist/handlers/tool.handlers.js +0 -1
- package/dist/presentations/agent-list.js +0 -1
- package/dist/presentations/dashboard.js +0 -1
- package/dist/presentations/run-list.js +0 -1
- package/dist/presentations/tool-registry.js +0 -1
- package/src/contracts/agent.ts +0 -501
- package/src/contracts/index.ts +0 -29
- package/src/contracts/run.ts +0 -561
- package/src/contracts/tool.ts +0 -392
- package/src/entities/agent.ts +0 -151
- package/src/entities/index.ts +0 -20
- package/src/entities/log.ts +0 -76
- package/src/entities/run.ts +0 -240
- package/src/entities/tool.ts +0 -105
- package/src/events.ts +0 -419
- package/src/handlers/mock-data.ts +0 -413
- package/src/handlers/run.handlers.ts +0 -331
- package/src/handlers/tool.handlers.ts +0 -188
- package/src/presentations/dashboard.ts +0 -29
- package/src/presentations/run-list.ts +0 -76
- /package/dist/{feature.js → agent.feature.js} +0 -0
- /package/src/{feature.ts → agent.feature.ts} +0 -0
package/src/contracts/tool.ts
DELETED
|
@@ -1,392 +0,0 @@
|
|
|
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 ToolCategoryEnum = defineEnum('ToolCategory', [
|
|
13
|
-
'RETRIEVAL',
|
|
14
|
-
'COMPUTATION',
|
|
15
|
-
'COMMUNICATION',
|
|
16
|
-
'INTEGRATION',
|
|
17
|
-
'UTILITY',
|
|
18
|
-
'CUSTOM',
|
|
19
|
-
]);
|
|
20
|
-
|
|
21
|
-
export const ToolStatusEnum = defineEnum('ToolStatus', [
|
|
22
|
-
'DRAFT',
|
|
23
|
-
'ACTIVE',
|
|
24
|
-
'DEPRECATED',
|
|
25
|
-
'DISABLED',
|
|
26
|
-
]);
|
|
27
|
-
|
|
28
|
-
export const ImplementationTypeEnum = defineEnum('ImplementationType', [
|
|
29
|
-
'http',
|
|
30
|
-
'function',
|
|
31
|
-
'workflow',
|
|
32
|
-
]);
|
|
33
|
-
|
|
34
|
-
// ============ Schemas ============
|
|
35
|
-
|
|
36
|
-
export const ToolModel = defineSchemaModel({
|
|
37
|
-
name: 'Tool',
|
|
38
|
-
description: 'AI tool definition',
|
|
39
|
-
fields: {
|
|
40
|
-
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
41
|
-
organizationId: {
|
|
42
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
43
|
-
isOptional: false,
|
|
44
|
-
},
|
|
45
|
-
name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
|
|
46
|
-
slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
47
|
-
description: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
48
|
-
category: { type: ToolCategoryEnum, isOptional: false },
|
|
49
|
-
status: { type: ToolStatusEnum, isOptional: false },
|
|
50
|
-
parametersSchema: { type: ScalarTypeEnum.JSONObject(), isOptional: false },
|
|
51
|
-
outputSchema: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
|
|
52
|
-
implementationType: { type: ImplementationTypeEnum, isOptional: false },
|
|
53
|
-
implementationConfig: {
|
|
54
|
-
type: ScalarTypeEnum.JSONObject(),
|
|
55
|
-
isOptional: false,
|
|
56
|
-
},
|
|
57
|
-
maxInvocationsPerMinute: {
|
|
58
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
59
|
-
isOptional: true,
|
|
60
|
-
},
|
|
61
|
-
timeoutMs: {
|
|
62
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
63
|
-
isOptional: false,
|
|
64
|
-
defaultValue: 30000,
|
|
65
|
-
},
|
|
66
|
-
version: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
|
|
67
|
-
tags: {
|
|
68
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
69
|
-
isArray: true,
|
|
70
|
-
isOptional: true,
|
|
71
|
-
},
|
|
72
|
-
createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
|
|
73
|
-
updatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
|
|
74
|
-
},
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
export const ToolSummaryModel = defineSchemaModel({
|
|
78
|
-
name: 'ToolSummary',
|
|
79
|
-
description: 'Summary of a tool for list views',
|
|
80
|
-
fields: {
|
|
81
|
-
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
82
|
-
name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
|
|
83
|
-
slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
84
|
-
description: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
85
|
-
category: { type: ToolCategoryEnum, isOptional: false },
|
|
86
|
-
status: { type: ToolStatusEnum, isOptional: false },
|
|
87
|
-
version: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
|
|
88
|
-
createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
|
|
89
|
-
},
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
export const CreateToolInputModel = defineSchemaModel({
|
|
93
|
-
name: 'CreateToolInput',
|
|
94
|
-
description: 'Input for creating a tool',
|
|
95
|
-
fields: {
|
|
96
|
-
organizationId: {
|
|
97
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
98
|
-
isOptional: false,
|
|
99
|
-
},
|
|
100
|
-
name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
|
|
101
|
-
slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
102
|
-
description: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
103
|
-
category: { type: ToolCategoryEnum, isOptional: true },
|
|
104
|
-
parametersSchema: { type: ScalarTypeEnum.JSONObject(), isOptional: false },
|
|
105
|
-
outputSchema: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
|
|
106
|
-
implementationType: { type: ImplementationTypeEnum, isOptional: false },
|
|
107
|
-
implementationConfig: {
|
|
108
|
-
type: ScalarTypeEnum.JSONObject(),
|
|
109
|
-
isOptional: false,
|
|
110
|
-
},
|
|
111
|
-
maxInvocationsPerMinute: {
|
|
112
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
113
|
-
isOptional: true,
|
|
114
|
-
},
|
|
115
|
-
timeoutMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
|
|
116
|
-
tags: {
|
|
117
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
118
|
-
isArray: true,
|
|
119
|
-
isOptional: true,
|
|
120
|
-
},
|
|
121
|
-
},
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
export const UpdateToolInputModel = defineSchemaModel({
|
|
125
|
-
name: 'UpdateToolInput',
|
|
126
|
-
description: 'Input for updating a tool',
|
|
127
|
-
fields: {
|
|
128
|
-
toolId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
129
|
-
name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: true },
|
|
130
|
-
description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
131
|
-
status: { type: ToolStatusEnum, isOptional: true },
|
|
132
|
-
parametersSchema: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
|
|
133
|
-
outputSchema: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
|
|
134
|
-
implementationConfig: {
|
|
135
|
-
type: ScalarTypeEnum.JSONObject(),
|
|
136
|
-
isOptional: true,
|
|
137
|
-
},
|
|
138
|
-
maxInvocationsPerMinute: {
|
|
139
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
140
|
-
isOptional: true,
|
|
141
|
-
},
|
|
142
|
-
timeoutMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
|
|
143
|
-
tags: {
|
|
144
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
145
|
-
isArray: true,
|
|
146
|
-
isOptional: true,
|
|
147
|
-
},
|
|
148
|
-
},
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
// ============ Contracts ============
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* CreateToolCommand - Creates a new tool definition
|
|
155
|
-
*/
|
|
156
|
-
export const CreateToolCommand = defineCommand({
|
|
157
|
-
meta: {
|
|
158
|
-
name: 'agent.tool.create',
|
|
159
|
-
version: 1,
|
|
160
|
-
stability: 'stable',
|
|
161
|
-
owners: [...OWNERS],
|
|
162
|
-
tags: ['tool', 'create'],
|
|
163
|
-
description: 'Creates a new AI tool definition.',
|
|
164
|
-
goal: 'Allow users to define new tools that agents can use.',
|
|
165
|
-
context: 'Called from the tool builder UI when creating a new tool.',
|
|
166
|
-
},
|
|
167
|
-
io: {
|
|
168
|
-
input: CreateToolInputModel,
|
|
169
|
-
output: defineSchemaModel({
|
|
170
|
-
name: 'CreateToolOutput',
|
|
171
|
-
fields: {
|
|
172
|
-
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
173
|
-
name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
|
|
174
|
-
slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
175
|
-
status: { type: ToolStatusEnum, isOptional: false },
|
|
176
|
-
},
|
|
177
|
-
}),
|
|
178
|
-
errors: {
|
|
179
|
-
SLUG_EXISTS: {
|
|
180
|
-
description: 'A tool with this slug already exists in the organization',
|
|
181
|
-
http: 409,
|
|
182
|
-
gqlCode: 'SLUG_EXISTS',
|
|
183
|
-
when: 'Slug is already taken',
|
|
184
|
-
},
|
|
185
|
-
},
|
|
186
|
-
},
|
|
187
|
-
policy: {
|
|
188
|
-
auth: 'user',
|
|
189
|
-
},
|
|
190
|
-
sideEffects: {
|
|
191
|
-
emits: [
|
|
192
|
-
{
|
|
193
|
-
name: 'tool.created',
|
|
194
|
-
version: 1,
|
|
195
|
-
when: 'Tool is successfully created',
|
|
196
|
-
payload: ToolSummaryModel,
|
|
197
|
-
},
|
|
198
|
-
],
|
|
199
|
-
audit: ['tool.created'],
|
|
200
|
-
},
|
|
201
|
-
});
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
* UpdateToolCommand - Updates an existing tool
|
|
205
|
-
*/
|
|
206
|
-
export const UpdateToolCommand = defineCommand({
|
|
207
|
-
meta: {
|
|
208
|
-
name: 'agent.tool.update',
|
|
209
|
-
version: 1,
|
|
210
|
-
stability: 'stable',
|
|
211
|
-
owners: [...OWNERS],
|
|
212
|
-
tags: ['tool', 'update'],
|
|
213
|
-
description: 'Updates an existing AI tool definition.',
|
|
214
|
-
goal: 'Allow users to modify tool settings and configuration.',
|
|
215
|
-
context: 'Called from the tool settings UI.',
|
|
216
|
-
},
|
|
217
|
-
io: {
|
|
218
|
-
input: UpdateToolInputModel,
|
|
219
|
-
output: defineSchemaModel({
|
|
220
|
-
name: 'UpdateToolOutput',
|
|
221
|
-
fields: {
|
|
222
|
-
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
223
|
-
name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
|
|
224
|
-
status: { type: ToolStatusEnum, isOptional: false },
|
|
225
|
-
updatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
|
|
226
|
-
},
|
|
227
|
-
}),
|
|
228
|
-
errors: {
|
|
229
|
-
TOOL_NOT_FOUND: {
|
|
230
|
-
description: 'The specified tool does not exist',
|
|
231
|
-
http: 404,
|
|
232
|
-
gqlCode: 'TOOL_NOT_FOUND',
|
|
233
|
-
when: 'Tool ID is invalid',
|
|
234
|
-
},
|
|
235
|
-
},
|
|
236
|
-
},
|
|
237
|
-
policy: {
|
|
238
|
-
auth: 'user',
|
|
239
|
-
},
|
|
240
|
-
sideEffects: {
|
|
241
|
-
emits: [
|
|
242
|
-
{
|
|
243
|
-
name: 'tool.updated',
|
|
244
|
-
version: 1,
|
|
245
|
-
when: 'Tool is updated',
|
|
246
|
-
payload: ToolSummaryModel,
|
|
247
|
-
},
|
|
248
|
-
],
|
|
249
|
-
audit: ['tool.updated'],
|
|
250
|
-
},
|
|
251
|
-
});
|
|
252
|
-
|
|
253
|
-
/**
|
|
254
|
-
* GetToolQuery - Retrieves a tool by ID
|
|
255
|
-
*/
|
|
256
|
-
export const GetToolQuery = defineQuery({
|
|
257
|
-
meta: {
|
|
258
|
-
name: 'agent.tool.get',
|
|
259
|
-
version: 1,
|
|
260
|
-
stability: 'stable',
|
|
261
|
-
owners: [...OWNERS],
|
|
262
|
-
tags: ['tool', 'get'],
|
|
263
|
-
description: 'Retrieves a tool by its ID.',
|
|
264
|
-
goal: 'View detailed tool configuration.',
|
|
265
|
-
context: 'Called when viewing tool details or editing.',
|
|
266
|
-
},
|
|
267
|
-
io: {
|
|
268
|
-
input: defineSchemaModel({
|
|
269
|
-
name: 'GetToolInput',
|
|
270
|
-
fields: {
|
|
271
|
-
toolId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
272
|
-
},
|
|
273
|
-
}),
|
|
274
|
-
output: ToolModel,
|
|
275
|
-
errors: {
|
|
276
|
-
TOOL_NOT_FOUND: {
|
|
277
|
-
description: 'The specified tool does not exist',
|
|
278
|
-
http: 404,
|
|
279
|
-
gqlCode: 'TOOL_NOT_FOUND',
|
|
280
|
-
when: 'Tool ID is invalid',
|
|
281
|
-
},
|
|
282
|
-
},
|
|
283
|
-
},
|
|
284
|
-
policy: {
|
|
285
|
-
auth: 'user',
|
|
286
|
-
},
|
|
287
|
-
});
|
|
288
|
-
|
|
289
|
-
/**
|
|
290
|
-
* ListToolsQuery - Lists tools for an organization
|
|
291
|
-
*/
|
|
292
|
-
export const ListToolsQuery = defineQuery({
|
|
293
|
-
meta: {
|
|
294
|
-
name: 'agent.tool.list',
|
|
295
|
-
version: 1,
|
|
296
|
-
stability: 'stable',
|
|
297
|
-
owners: [...OWNERS],
|
|
298
|
-
tags: ['tool', 'list'],
|
|
299
|
-
description: 'Lists tools for an organization with optional filtering.',
|
|
300
|
-
goal: 'Browse and search available tools.',
|
|
301
|
-
context: 'Tool list/dashboard view.',
|
|
302
|
-
},
|
|
303
|
-
io: {
|
|
304
|
-
input: defineSchemaModel({
|
|
305
|
-
name: 'ListToolsInput',
|
|
306
|
-
fields: {
|
|
307
|
-
organizationId: {
|
|
308
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
309
|
-
isOptional: false,
|
|
310
|
-
},
|
|
311
|
-
category: { type: ToolCategoryEnum, isOptional: true },
|
|
312
|
-
status: { type: ToolStatusEnum, isOptional: true },
|
|
313
|
-
search: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
314
|
-
limit: {
|
|
315
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
316
|
-
isOptional: true,
|
|
317
|
-
defaultValue: 20,
|
|
318
|
-
},
|
|
319
|
-
offset: {
|
|
320
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
321
|
-
isOptional: true,
|
|
322
|
-
defaultValue: 0,
|
|
323
|
-
},
|
|
324
|
-
},
|
|
325
|
-
}),
|
|
326
|
-
output: defineSchemaModel({
|
|
327
|
-
name: 'ListToolsOutput',
|
|
328
|
-
fields: {
|
|
329
|
-
items: { type: ToolSummaryModel, isArray: true, isOptional: false },
|
|
330
|
-
total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
331
|
-
hasMore: { type: ScalarTypeEnum.Boolean(), isOptional: false },
|
|
332
|
-
},
|
|
333
|
-
}),
|
|
334
|
-
},
|
|
335
|
-
policy: {
|
|
336
|
-
auth: 'user',
|
|
337
|
-
},
|
|
338
|
-
});
|
|
339
|
-
|
|
340
|
-
/**
|
|
341
|
-
* TestToolCommand - Tests a tool with sample input
|
|
342
|
-
*/
|
|
343
|
-
export const TestToolCommand = defineCommand({
|
|
344
|
-
meta: {
|
|
345
|
-
name: 'agent.tool.test',
|
|
346
|
-
version: 1,
|
|
347
|
-
stability: 'stable',
|
|
348
|
-
owners: [...OWNERS],
|
|
349
|
-
tags: ['tool', 'test'],
|
|
350
|
-
description: 'Tests a tool with sample input to verify it works correctly.',
|
|
351
|
-
goal: 'Validate tool configuration before deployment.',
|
|
352
|
-
context: 'Tool builder UI - test panel.',
|
|
353
|
-
},
|
|
354
|
-
io: {
|
|
355
|
-
input: defineSchemaModel({
|
|
356
|
-
name: 'TestToolInput',
|
|
357
|
-
fields: {
|
|
358
|
-
toolId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
359
|
-
testInput: { type: ScalarTypeEnum.JSONObject(), isOptional: false },
|
|
360
|
-
},
|
|
361
|
-
}),
|
|
362
|
-
output: defineSchemaModel({
|
|
363
|
-
name: 'TestToolOutput',
|
|
364
|
-
fields: {
|
|
365
|
-
success: { type: ScalarTypeEnum.Boolean(), isOptional: false },
|
|
366
|
-
output: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
|
|
367
|
-
error: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
368
|
-
durationMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
369
|
-
},
|
|
370
|
-
}),
|
|
371
|
-
errors: {
|
|
372
|
-
TOOL_NOT_FOUND: {
|
|
373
|
-
description: 'The specified tool does not exist',
|
|
374
|
-
http: 404,
|
|
375
|
-
gqlCode: 'TOOL_NOT_FOUND',
|
|
376
|
-
when: 'Tool ID is invalid',
|
|
377
|
-
},
|
|
378
|
-
TOOL_EXECUTION_ERROR: {
|
|
379
|
-
description: 'Tool execution failed',
|
|
380
|
-
http: 500,
|
|
381
|
-
gqlCode: 'TOOL_EXECUTION_ERROR',
|
|
382
|
-
when: 'Tool returns an error',
|
|
383
|
-
},
|
|
384
|
-
},
|
|
385
|
-
},
|
|
386
|
-
policy: {
|
|
387
|
-
auth: 'user',
|
|
388
|
-
},
|
|
389
|
-
sideEffects: {
|
|
390
|
-
audit: ['tool.tested'],
|
|
391
|
-
},
|
|
392
|
-
});
|
package/src/entities/agent.ts
DELETED
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
defineEntity,
|
|
3
|
-
defineEntityEnum,
|
|
4
|
-
field,
|
|
5
|
-
index,
|
|
6
|
-
} from '@lssm/lib.schema/entity';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Agent status for lifecycle management
|
|
10
|
-
*/
|
|
11
|
-
export const AgentStatusEnum = defineEntityEnum({
|
|
12
|
-
name: 'AgentStatus',
|
|
13
|
-
values: [
|
|
14
|
-
'DRAFT', // Being configured
|
|
15
|
-
'ACTIVE', // Available for execution
|
|
16
|
-
'PAUSED', // Temporarily unavailable
|
|
17
|
-
'ARCHIVED', // No longer active
|
|
18
|
-
],
|
|
19
|
-
description: 'Lifecycle status of the agent',
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Agent model provider
|
|
24
|
-
*/
|
|
25
|
-
export const ModelProviderEnum = defineEntityEnum({
|
|
26
|
-
name: 'ModelProvider',
|
|
27
|
-
values: ['OPENAI', 'ANTHROPIC', 'GOOGLE', 'MISTRAL', 'CUSTOM'],
|
|
28
|
-
description: 'AI model provider',
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Agent entity - Represents an AI agent configuration
|
|
33
|
-
*/
|
|
34
|
-
export const AgentEntity = defineEntity({
|
|
35
|
-
name: 'Agent',
|
|
36
|
-
schema: 'agent_console',
|
|
37
|
-
description:
|
|
38
|
-
'Represents an AI agent configuration with assigned tools and parameters.',
|
|
39
|
-
fields: {
|
|
40
|
-
id: field.id(),
|
|
41
|
-
organizationId: field.string({
|
|
42
|
-
description: 'Organization that owns this agent',
|
|
43
|
-
}),
|
|
44
|
-
name: field.string({ description: 'Agent name (1-100 chars)' }),
|
|
45
|
-
slug: field.string({
|
|
46
|
-
description: 'URL-safe identifier (lowercase, numbers, hyphens)',
|
|
47
|
-
}),
|
|
48
|
-
description: field.string({
|
|
49
|
-
isOptional: true,
|
|
50
|
-
description: 'Agent description (max 1000 chars)',
|
|
51
|
-
}),
|
|
52
|
-
status: field.enum('AgentStatus', { default: 'DRAFT' }),
|
|
53
|
-
// Model configuration
|
|
54
|
-
modelProvider: field.enum('ModelProvider', { default: 'OPENAI' }),
|
|
55
|
-
modelName: field.string({
|
|
56
|
-
description: "Model identifier: 'gpt-4', 'claude-3-opus', etc.",
|
|
57
|
-
}),
|
|
58
|
-
modelConfig: field.json({
|
|
59
|
-
isOptional: true,
|
|
60
|
-
description: 'Model parameters: temperature, max_tokens, etc.',
|
|
61
|
-
}),
|
|
62
|
-
// Prompts
|
|
63
|
-
systemPrompt: field.string({ description: 'System prompt for the agent' }),
|
|
64
|
-
userPromptTemplate: field.string({
|
|
65
|
-
isOptional: true,
|
|
66
|
-
description: 'Template for user prompts',
|
|
67
|
-
}),
|
|
68
|
-
// Tool configuration
|
|
69
|
-
toolIds: field.string({
|
|
70
|
-
isArray: true,
|
|
71
|
-
isOptional: true,
|
|
72
|
-
description: 'IDs of assigned tools',
|
|
73
|
-
}),
|
|
74
|
-
toolChoice: field.string({
|
|
75
|
-
default: 'auto',
|
|
76
|
-
description: "Tool selection mode: 'auto', 'required', 'none'",
|
|
77
|
-
}),
|
|
78
|
-
// Execution limits
|
|
79
|
-
maxIterations: field.int({
|
|
80
|
-
default: 10,
|
|
81
|
-
description: 'Maximum iterations per run',
|
|
82
|
-
}),
|
|
83
|
-
maxTokensPerRun: field.int({
|
|
84
|
-
isOptional: true,
|
|
85
|
-
description: 'Maximum tokens per run',
|
|
86
|
-
}),
|
|
87
|
-
timeoutMs: field.int({
|
|
88
|
-
default: 120000,
|
|
89
|
-
description: 'Execution timeout in milliseconds',
|
|
90
|
-
}),
|
|
91
|
-
// Metadata
|
|
92
|
-
version: field.string({ default: '1.0.0', description: 'Agent version' }),
|
|
93
|
-
tags: field.string({
|
|
94
|
-
isArray: true,
|
|
95
|
-
isOptional: true,
|
|
96
|
-
description: 'Tags for categorization',
|
|
97
|
-
}),
|
|
98
|
-
createdAt: field.createdAt(),
|
|
99
|
-
updatedAt: field.updatedAt(),
|
|
100
|
-
createdById: field.string({
|
|
101
|
-
isOptional: true,
|
|
102
|
-
description: 'User who created this agent',
|
|
103
|
-
}),
|
|
104
|
-
// Relations (virtual for type purposes)
|
|
105
|
-
tools: field.hasMany('Tool', {
|
|
106
|
-
description: 'Tools assigned to this agent',
|
|
107
|
-
}),
|
|
108
|
-
},
|
|
109
|
-
indexes: [
|
|
110
|
-
index.unique(['organizationId', 'slug']),
|
|
111
|
-
index.on(['organizationId', 'status']),
|
|
112
|
-
index.on(['modelProvider', 'modelName']),
|
|
113
|
-
],
|
|
114
|
-
enums: [AgentStatusEnum, ModelProviderEnum],
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* AgentTool join entity - Links agents to their assigned tools
|
|
119
|
-
*/
|
|
120
|
-
export const AgentToolEntity = defineEntity({
|
|
121
|
-
name: 'AgentTool',
|
|
122
|
-
schema: 'agent_console',
|
|
123
|
-
description: 'Links an agent to its assigned tools with configuration.',
|
|
124
|
-
fields: {
|
|
125
|
-
id: field.id(),
|
|
126
|
-
agentId: field.foreignKey({ description: 'Agent ID' }),
|
|
127
|
-
toolId: field.foreignKey({ description: 'Tool ID' }),
|
|
128
|
-
// Tool-specific configuration for this agent
|
|
129
|
-
config: field.json({
|
|
130
|
-
isOptional: true,
|
|
131
|
-
description: 'Tool-specific configuration for this agent',
|
|
132
|
-
}),
|
|
133
|
-
// Ordering for tool priority
|
|
134
|
-
order: field.int({
|
|
135
|
-
default: 0,
|
|
136
|
-
description: 'Order of tool in agent tool list',
|
|
137
|
-
}),
|
|
138
|
-
isEnabled: field.boolean({
|
|
139
|
-
default: true,
|
|
140
|
-
description: 'Whether tool is enabled for this agent',
|
|
141
|
-
}),
|
|
142
|
-
createdAt: field.createdAt(),
|
|
143
|
-
// Relations
|
|
144
|
-
agent: field.belongsTo('Agent', ['agentId'], ['id']),
|
|
145
|
-
tool: field.belongsTo('Tool', ['toolId'], ['id']),
|
|
146
|
-
},
|
|
147
|
-
indexes: [
|
|
148
|
-
index.unique(['agentId', 'toolId']),
|
|
149
|
-
index.on(['agentId', 'order']),
|
|
150
|
-
],
|
|
151
|
-
});
|
package/src/entities/index.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// Tool entities
|
|
2
|
-
export { ToolEntity, ToolCategoryEnum, ToolStatusEnum } from './tool';
|
|
3
|
-
|
|
4
|
-
// Agent entities
|
|
5
|
-
export {
|
|
6
|
-
AgentEntity,
|
|
7
|
-
AgentToolEntity,
|
|
8
|
-
AgentStatusEnum,
|
|
9
|
-
ModelProviderEnum,
|
|
10
|
-
} from './agent';
|
|
11
|
-
|
|
12
|
-
// Run entities
|
|
13
|
-
export {
|
|
14
|
-
RunEntity,
|
|
15
|
-
RunStepEntity,
|
|
16
|
-
RunLogEntity,
|
|
17
|
-
RunStatusEnum,
|
|
18
|
-
RunStepTypeEnum,
|
|
19
|
-
LogLevelEnum,
|
|
20
|
-
} from './run';
|
package/src/entities/log.ts
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { defineEntity, defineEntityEnum, field, index } from '@lssm/lib.schema';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Log level enum.
|
|
5
|
-
*/
|
|
6
|
-
export const LogLevelEnum = defineEntityEnum({
|
|
7
|
-
name: 'LogLevel',
|
|
8
|
-
values: ['DEBUG', 'INFO', 'WARN', 'ERROR'] as const,
|
|
9
|
-
schema: 'agent',
|
|
10
|
-
description: 'Log severity level.',
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Log type enum.
|
|
15
|
-
*/
|
|
16
|
-
export const LogTypeEnum = defineEntityEnum({
|
|
17
|
-
name: 'LogType',
|
|
18
|
-
values: [
|
|
19
|
-
'MESSAGE',
|
|
20
|
-
'TOOL_CALL',
|
|
21
|
-
'TOOL_RESULT',
|
|
22
|
-
'THINKING',
|
|
23
|
-
'ERROR',
|
|
24
|
-
'SYSTEM',
|
|
25
|
-
] as const,
|
|
26
|
-
schema: 'agent',
|
|
27
|
-
description: 'Type of log entry.',
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* RunLog entity - detailed run logs.
|
|
32
|
-
*/
|
|
33
|
-
export const RunLogEntity = defineEntity({
|
|
34
|
-
name: 'RunLog',
|
|
35
|
-
description: 'A log entry within an agent run.',
|
|
36
|
-
schema: 'agent',
|
|
37
|
-
map: 'run_log',
|
|
38
|
-
fields: {
|
|
39
|
-
id: field.id(),
|
|
40
|
-
|
|
41
|
-
// Parent
|
|
42
|
-
runId: field.foreignKey(),
|
|
43
|
-
|
|
44
|
-
// Type
|
|
45
|
-
type: field.enum('LogType'),
|
|
46
|
-
level: field.enum('LogLevel', { default: 'INFO' }),
|
|
47
|
-
|
|
48
|
-
// Content
|
|
49
|
-
role: field.string({
|
|
50
|
-
isOptional: true,
|
|
51
|
-
description: 'Message role (user, assistant, system, tool)',
|
|
52
|
-
}),
|
|
53
|
-
content: field.string({ description: 'Log content/message' }),
|
|
54
|
-
|
|
55
|
-
// Metadata
|
|
56
|
-
metadata: field.json({ isOptional: true }),
|
|
57
|
-
|
|
58
|
-
// Sequence
|
|
59
|
-
sequence: field.int({ description: 'Order within run' }),
|
|
60
|
-
iteration: field.int({ isOptional: true }),
|
|
61
|
-
|
|
62
|
-
// Tokens
|
|
63
|
-
tokens: field.int({ isOptional: true }),
|
|
64
|
-
|
|
65
|
-
// Timing
|
|
66
|
-
timestamp: field.dateTime(),
|
|
67
|
-
durationMs: field.int({ isOptional: true }),
|
|
68
|
-
|
|
69
|
-
// Relations
|
|
70
|
-
run: field.belongsTo('AgentRun', ['runId'], ['id'], {
|
|
71
|
-
onDelete: 'Cascade',
|
|
72
|
-
}),
|
|
73
|
-
},
|
|
74
|
-
indexes: [index.on(['runId', 'sequence']), index.on(['runId', 'type'])],
|
|
75
|
-
enums: [LogLevelEnum, LogTypeEnum],
|
|
76
|
-
});
|