@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.
- package/.turbo/turbo-build.log +202 -0
- package/CHANGELOG.md +13 -0
- package/README.md +83 -0
- package/dist/contracts/agent.d.ts +886 -0
- package/dist/contracts/agent.js +1 -0
- package/dist/contracts/index.d.ts +4 -0
- package/dist/contracts/index.js +1 -0
- package/dist/contracts/run.d.ts +1106 -0
- package/dist/contracts/run.js +1 -0
- package/dist/contracts/tool.d.ts +607 -0
- package/dist/contracts/tool.js +1 -0
- package/dist/entities/agent.d.ts +54 -0
- package/dist/entities/agent.js +1 -0
- package/dist/entities/index.d.ts +4 -0
- package/dist/entities/index.js +1 -0
- package/dist/entities/log.d.ts +31 -0
- package/dist/entities/log.js +1 -0
- package/dist/entities/run.d.ts +85 -0
- package/dist/entities/run.js +1 -0
- package/dist/entities/tool.d.ts +36 -0
- package/dist/entities/tool.js +1 -0
- package/dist/events.d.ts +965 -0
- package/dist/events.js +1 -0
- package/dist/feature.d.ts +11 -0
- package/dist/feature.js +1 -0
- package/dist/handlers/agent.handlers.d.ts +99 -0
- package/dist/handlers/agent.handlers.js +1 -0
- package/dist/handlers/index.d.ts +5 -0
- package/dist/handlers/index.js +1 -0
- package/dist/handlers/mock-data.d.ts +533 -0
- package/dist/handlers/mock-data.js +1 -0
- package/dist/handlers/run.handlers.d.ts +145 -0
- package/dist/handlers/run.handlers.js +1 -0
- package/dist/handlers/tool.handlers.d.ts +86 -0
- package/dist/handlers/tool.handlers.js +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +1 -0
- package/dist/libs/contracts/dist/capabilities/openbanking.js +1 -0
- package/dist/libs/contracts/dist/client/index.js +1 -0
- package/dist/libs/contracts/dist/client/react/feature-render.js +1 -0
- package/dist/libs/contracts/dist/client/react/form-render.js +1 -0
- package/dist/libs/contracts/dist/client/react/index.js +1 -0
- package/dist/libs/contracts/dist/events.js +1 -0
- package/dist/libs/contracts/dist/experiments/evaluator.js +1 -0
- package/dist/libs/contracts/dist/graphql-federation/dist/index.js +1 -0
- package/dist/libs/contracts/dist/index.js +1 -0
- package/dist/libs/contracts/dist/install.js +1 -0
- package/dist/libs/contracts/dist/integrations/contracts.js +1 -0
- package/dist/libs/contracts/dist/integrations/index.js +1 -0
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/accounts.js +1 -0
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/balances.js +1 -0
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/index.js +1 -0
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/transactions.js +1 -0
- package/dist/libs/contracts/dist/integrations/openbanking/models.js +1 -0
- package/dist/libs/contracts/dist/integrations/openbanking/telemetry.js +1 -0
- package/dist/libs/contracts/dist/integrations/providers/elevenlabs.js +1 -0
- package/dist/libs/contracts/dist/integrations/providers/gcs-storage.js +1 -0
- package/dist/libs/contracts/dist/integrations/providers/gmail.js +1 -0
- package/dist/libs/contracts/dist/integrations/providers/google-calendar.js +1 -0
- package/dist/libs/contracts/dist/integrations/providers/impls/elevenlabs-voice.js +1 -0
- package/dist/libs/contracts/dist/integrations/providers/impls/gcs-storage.js +1 -0
- package/dist/libs/contracts/dist/integrations/providers/impls/gmail-inbound.js +1 -0
- package/dist/libs/contracts/dist/integrations/providers/impls/gmail-outbound.js +1 -0
- package/dist/libs/contracts/dist/integrations/providers/impls/google-calendar.js +1 -0
- package/dist/libs/contracts/dist/integrations/providers/impls/index.js +1 -0
- package/dist/libs/contracts/dist/integrations/providers/impls/mistral-embedding.js +1 -0
- package/dist/libs/contracts/dist/integrations/providers/impls/mistral-llm.js +1 -0
- package/dist/libs/contracts/dist/integrations/providers/impls/postmark-email.js +1 -0
- package/dist/libs/contracts/dist/integrations/providers/impls/powens-client.js +1 -0
- package/dist/libs/contracts/dist/integrations/providers/impls/powens-openbanking.js +1 -0
- package/dist/libs/contracts/dist/integrations/providers/impls/provider-factory.js +1 -0
- package/dist/libs/contracts/dist/integrations/providers/impls/qdrant-vector.js +1 -0
- package/dist/libs/contracts/dist/integrations/providers/impls/stripe-payments.js +1 -0
- package/dist/libs/contracts/dist/integrations/providers/impls/twilio-sms.js +1 -0
- package/dist/libs/contracts/dist/integrations/providers/index.js +1 -0
- package/dist/libs/contracts/dist/integrations/providers/mistral.js +1 -0
- package/dist/libs/contracts/dist/integrations/providers/postmark.js +1 -0
- package/dist/libs/contracts/dist/integrations/providers/powens.js +1 -0
- package/dist/libs/contracts/dist/integrations/providers/qdrant.js +1 -0
- package/dist/libs/contracts/dist/integrations/providers/stripe.js +1 -0
- package/dist/libs/contracts/dist/integrations/providers/twilio-sms.js +1 -0
- package/dist/libs/contracts/dist/integrations/runtime.js +1 -0
- package/dist/libs/contracts/dist/integrations/secrets/env-secret-provider.js +1 -0
- package/dist/libs/contracts/dist/integrations/secrets/gcp-secret-manager.js +1 -0
- package/dist/libs/contracts/dist/integrations/secrets/index.js +1 -0
- package/dist/libs/contracts/dist/integrations/secrets/manager.js +1 -0
- package/dist/libs/contracts/dist/integrations/secrets/provider.js +1 -0
- package/dist/libs/contracts/dist/jsonschema.js +1 -0
- package/dist/libs/contracts/dist/knowledge/contracts.js +1 -0
- package/dist/libs/contracts/dist/knowledge/index.js +1 -0
- package/dist/libs/contracts/dist/knowledge/spaces/email-threads.js +1 -0
- package/dist/libs/contracts/dist/knowledge/spaces/financial-docs.js +1 -0
- package/dist/libs/contracts/dist/knowledge/spaces/financial-overview.js +1 -0
- package/dist/libs/contracts/dist/knowledge/spaces/index.js +1 -0
- package/dist/libs/contracts/dist/knowledge/spaces/product-canon.js +1 -0
- package/dist/libs/contracts/dist/knowledge/spaces/support-faq.js +1 -0
- package/dist/libs/contracts/dist/knowledge/spaces/uploaded-docs.js +1 -0
- package/dist/libs/contracts/dist/onboarding-base.js +1 -0
- package/dist/libs/contracts/dist/ownership.js +1 -0
- package/dist/libs/contracts/dist/presentations.js +1 -0
- package/dist/libs/contracts/dist/presentations.v2.js +1 -0
- package/dist/libs/contracts/dist/prompt.js +1 -0
- package/dist/libs/contracts/dist/promptRegistry.js +1 -0
- package/dist/libs/contracts/dist/regenerator/index.js +1 -0
- package/dist/libs/contracts/dist/regenerator/service.js +1 -0
- package/dist/libs/contracts/dist/registry.js +1 -0
- package/dist/libs/contracts/dist/resources.js +1 -0
- package/dist/libs/contracts/dist/schema/dist/EnumType.js +1 -0
- package/dist/libs/contracts/dist/schema/dist/FieldType.js +1 -0
- package/dist/libs/contracts/dist/schema/dist/ScalarTypeEnum.js +1 -0
- package/dist/libs/contracts/dist/schema/dist/SchemaModel.js +1 -0
- package/dist/libs/contracts/dist/schema/dist/entity/defineEntity.js +1 -0
- package/dist/libs/contracts/dist/schema/dist/entity/index.js +1 -0
- package/dist/libs/contracts/dist/schema/dist/entity/types.js +1 -0
- package/dist/libs/contracts/dist/schema/dist/index.js +1 -0
- package/dist/libs/contracts/dist/server/graphql-pothos.js +1 -0
- package/dist/libs/contracts/dist/server/graphql-schema-export.js +1 -0
- package/dist/libs/contracts/dist/server/index.js +1 -0
- package/dist/libs/contracts/dist/server/provider-mcp.js +1 -0
- package/dist/libs/contracts/dist/server/rest-elysia.js +1 -0
- package/dist/libs/contracts/dist/server/rest-express.js +1 -0
- package/dist/libs/contracts/dist/server/rest-generic.js +1 -0
- package/dist/libs/contracts/dist/server/rest-next-app.js +1 -0
- package/dist/libs/contracts/dist/server/rest-next-pages.js +1 -0
- package/dist/libs/contracts/dist/spec.js +1 -0
- package/dist/libs/contracts/dist/telemetry/index.js +1 -0
- package/dist/libs/contracts/dist/telemetry/tracker.js +1 -0
- package/dist/libs/contracts/dist/tests/index.js +1 -0
- package/dist/libs/contracts/dist/tests/runner.js +1 -0
- package/dist/libs/contracts/dist/workflow/index.js +1 -0
- package/dist/libs/contracts/dist/workflow/runner.js +1 -0
- package/dist/libs/schema/dist/EnumType.js +1 -0
- package/dist/libs/schema/dist/FieldType.js +1 -0
- package/dist/libs/schema/dist/ScalarTypeEnum.js +1 -0
- package/dist/libs/schema/dist/SchemaModel.js +1 -0
- package/dist/libs/schema/dist/entity/defineEntity.js +1 -0
- package/dist/libs/schema/dist/entity/index.js +1 -0
- package/dist/libs/schema/dist/entity/types.js +1 -0
- package/dist/libs/schema/dist/index.js +1 -0
- package/dist/presentations/agent-list.d.ts +15 -0
- package/dist/presentations/agent-list.js +1 -0
- package/dist/presentations/dashboard.d.ts +11 -0
- package/dist/presentations/dashboard.js +1 -0
- package/dist/presentations/index.d.ts +11 -0
- package/dist/presentations/index.js +1 -0
- package/dist/presentations/run-list.d.ts +18 -0
- package/dist/presentations/run-list.js +1 -0
- package/dist/presentations/tool-registry.d.ts +14 -0
- package/dist/presentations/tool-registry.js +1 -0
- package/package.json +86 -0
- package/src/contracts/agent.ts +501 -0
- package/src/contracts/index.ts +29 -0
- package/src/contracts/run.ts +561 -0
- package/src/contracts/tool.ts +392 -0
- package/src/entities/agent.ts +151 -0
- package/src/entities/index.ts +20 -0
- package/src/entities/log.ts +76 -0
- package/src/entities/run.ts +240 -0
- package/src/entities/tool.ts +105 -0
- package/src/events.ts +419 -0
- package/src/feature.ts +144 -0
- package/src/handlers/agent.handlers.ts +203 -0
- package/src/handlers/index.ts +55 -0
- package/src/handlers/mock-data.ts +413 -0
- package/src/handlers/run.handlers.ts +331 -0
- package/src/handlers/tool.handlers.ts +188 -0
- package/src/index.ts +34 -0
- package/src/presentations/agent-list.ts +55 -0
- package/src/presentations/dashboard.ts +29 -0
- package/src/presentations/index.ts +48 -0
- package/src/presentations/run-list.ts +76 -0
- package/src/presentations/tool-registry.ts +52 -0
- package/tsconfig.json +10 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/tsdown.config.js +7 -0
|
@@ -0,0 +1,392 @@
|
|
|
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
|
+
});
|
|
@@ -0,0 +1,151 @@
|
|
|
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
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
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';
|
|
@@ -0,0 +1,76 @@
|
|
|
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
|
+
});
|