@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,240 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defineEntity,
|
|
3
|
+
defineEntityEnum,
|
|
4
|
+
field,
|
|
5
|
+
index,
|
|
6
|
+
} from '@lssm/lib.schema/entity';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Run status for tracking execution lifecycle
|
|
10
|
+
*/
|
|
11
|
+
export const RunStatusEnum = defineEntityEnum({
|
|
12
|
+
name: 'RunStatus',
|
|
13
|
+
values: [
|
|
14
|
+
'QUEUED', // Waiting to start
|
|
15
|
+
'IN_PROGRESS', // Currently executing
|
|
16
|
+
'COMPLETED', // Successfully finished
|
|
17
|
+
'FAILED', // Encountered an error
|
|
18
|
+
'CANCELLED', // User cancelled
|
|
19
|
+
'EXPIRED', // Timed out
|
|
20
|
+
],
|
|
21
|
+
description: 'Execution lifecycle status',
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Run entity - Represents an agent execution instance
|
|
26
|
+
*/
|
|
27
|
+
export const RunEntity = defineEntity({
|
|
28
|
+
name: 'Run',
|
|
29
|
+
schema: 'agent_console',
|
|
30
|
+
description: 'Represents an agent execution instance.',
|
|
31
|
+
fields: {
|
|
32
|
+
id: field.id(),
|
|
33
|
+
organizationId: field.string({
|
|
34
|
+
description: 'Organization that owns this run',
|
|
35
|
+
}),
|
|
36
|
+
agentId: field.foreignKey({ description: 'Agent being executed' }),
|
|
37
|
+
// Execution context
|
|
38
|
+
userId: field.string({
|
|
39
|
+
isOptional: true,
|
|
40
|
+
description: 'User who initiated the run',
|
|
41
|
+
}),
|
|
42
|
+
sessionId: field.string({
|
|
43
|
+
isOptional: true,
|
|
44
|
+
description: 'Session ID for conversational context',
|
|
45
|
+
}),
|
|
46
|
+
parentRunId: field.string({
|
|
47
|
+
isOptional: true,
|
|
48
|
+
description: 'Parent run ID for nested agent calls',
|
|
49
|
+
}),
|
|
50
|
+
// Input/Output
|
|
51
|
+
input: field.json({ description: 'Input data for the run' }),
|
|
52
|
+
output: field.json({
|
|
53
|
+
isOptional: true,
|
|
54
|
+
description: 'Output data from the run',
|
|
55
|
+
}),
|
|
56
|
+
// Status
|
|
57
|
+
status: field.enum('RunStatus', { default: 'QUEUED' }),
|
|
58
|
+
errorMessage: field.string({
|
|
59
|
+
isOptional: true,
|
|
60
|
+
description: 'Error message if run failed',
|
|
61
|
+
}),
|
|
62
|
+
errorCode: field.string({
|
|
63
|
+
isOptional: true,
|
|
64
|
+
description: 'Error code if run failed',
|
|
65
|
+
}),
|
|
66
|
+
// Metrics
|
|
67
|
+
totalTokens: field.int({ default: 0, description: 'Total tokens used' }),
|
|
68
|
+
promptTokens: field.int({ default: 0, description: 'Prompt tokens used' }),
|
|
69
|
+
completionTokens: field.int({
|
|
70
|
+
default: 0,
|
|
71
|
+
description: 'Completion tokens used',
|
|
72
|
+
}),
|
|
73
|
+
totalIterations: field.int({
|
|
74
|
+
default: 0,
|
|
75
|
+
description: 'Total iterations executed',
|
|
76
|
+
}),
|
|
77
|
+
durationMs: field.int({
|
|
78
|
+
isOptional: true,
|
|
79
|
+
description: 'Total duration in milliseconds',
|
|
80
|
+
}),
|
|
81
|
+
// Cost tracking
|
|
82
|
+
estimatedCostUsd: field.float({
|
|
83
|
+
isOptional: true,
|
|
84
|
+
description: 'Estimated cost in USD',
|
|
85
|
+
}),
|
|
86
|
+
// Timestamps
|
|
87
|
+
queuedAt: field.createdAt(),
|
|
88
|
+
startedAt: field.dateTime({
|
|
89
|
+
isOptional: true,
|
|
90
|
+
description: 'When execution started',
|
|
91
|
+
}),
|
|
92
|
+
completedAt: field.dateTime({
|
|
93
|
+
isOptional: true,
|
|
94
|
+
description: 'When execution completed',
|
|
95
|
+
}),
|
|
96
|
+
// Metadata
|
|
97
|
+
metadata: field.json({
|
|
98
|
+
isOptional: true,
|
|
99
|
+
description: 'Additional run metadata',
|
|
100
|
+
}),
|
|
101
|
+
// Relations
|
|
102
|
+
agent: field.belongsTo('Agent', ['agentId'], ['id']),
|
|
103
|
+
parentRun: field.belongsTo('Run', ['parentRunId'], ['id']),
|
|
104
|
+
steps: field.hasMany('RunStep'),
|
|
105
|
+
logs: field.hasMany('RunLog'),
|
|
106
|
+
},
|
|
107
|
+
indexes: [
|
|
108
|
+
index.on(['organizationId', 'status']),
|
|
109
|
+
index.on(['organizationId', 'agentId']),
|
|
110
|
+
index.on(['organizationId', 'userId']),
|
|
111
|
+
index.on(['sessionId']),
|
|
112
|
+
index.on(['queuedAt']),
|
|
113
|
+
],
|
|
114
|
+
enums: [RunStatusEnum],
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Run step type
|
|
119
|
+
*/
|
|
120
|
+
export const RunStepTypeEnum = defineEntityEnum({
|
|
121
|
+
name: 'RunStepType',
|
|
122
|
+
values: [
|
|
123
|
+
'MESSAGE_CREATION', // Agent generates a response
|
|
124
|
+
'TOOL_CALL', // Agent calls a tool
|
|
125
|
+
'TOOL_RESULT', // Tool returns a result
|
|
126
|
+
'ERROR', // Step encountered an error
|
|
127
|
+
],
|
|
128
|
+
description: 'Type of step in an agent run',
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* RunStep entity - Individual step within a run
|
|
133
|
+
*/
|
|
134
|
+
export const RunStepEntity = defineEntity({
|
|
135
|
+
name: 'RunStep',
|
|
136
|
+
schema: 'agent_console',
|
|
137
|
+
description: 'Represents an individual step within an agent run.',
|
|
138
|
+
fields: {
|
|
139
|
+
id: field.id(),
|
|
140
|
+
runId: field.foreignKey({ description: 'Run ID' }),
|
|
141
|
+
stepNumber: field.int({ description: 'Step number in sequence' }),
|
|
142
|
+
type: field.enum('RunStepType'),
|
|
143
|
+
// Step details
|
|
144
|
+
toolId: field.string({
|
|
145
|
+
isOptional: true,
|
|
146
|
+
description: 'Tool ID if tool call',
|
|
147
|
+
}),
|
|
148
|
+
toolName: field.string({
|
|
149
|
+
isOptional: true,
|
|
150
|
+
description: 'Tool name for display',
|
|
151
|
+
}),
|
|
152
|
+
input: field.json({ isOptional: true, description: 'Step input data' }),
|
|
153
|
+
output: field.json({ isOptional: true, description: 'Step output data' }),
|
|
154
|
+
// Status
|
|
155
|
+
status: field.enum('RunStatus', { default: 'IN_PROGRESS' }),
|
|
156
|
+
errorMessage: field.string({
|
|
157
|
+
isOptional: true,
|
|
158
|
+
description: 'Error message if step failed',
|
|
159
|
+
}),
|
|
160
|
+
// Metrics
|
|
161
|
+
tokensUsed: field.int({
|
|
162
|
+
default: 0,
|
|
163
|
+
description: 'Tokens used in this step',
|
|
164
|
+
}),
|
|
165
|
+
durationMs: field.int({
|
|
166
|
+
isOptional: true,
|
|
167
|
+
description: 'Step duration in milliseconds',
|
|
168
|
+
}),
|
|
169
|
+
// Timestamps
|
|
170
|
+
startedAt: field.createdAt(),
|
|
171
|
+
completedAt: field.dateTime({
|
|
172
|
+
isOptional: true,
|
|
173
|
+
description: 'When step completed',
|
|
174
|
+
}),
|
|
175
|
+
// Relations
|
|
176
|
+
run: field.belongsTo('Run', ['runId'], ['id']),
|
|
177
|
+
tool: field.belongsTo('Tool', ['toolId'], ['id']),
|
|
178
|
+
},
|
|
179
|
+
indexes: [
|
|
180
|
+
index.on(['runId', 'stepNumber']),
|
|
181
|
+
index.on(['runId', 'type']),
|
|
182
|
+
index.on(['toolId']),
|
|
183
|
+
],
|
|
184
|
+
enums: [RunStepTypeEnum],
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Log level
|
|
189
|
+
*/
|
|
190
|
+
export const LogLevelEnum = defineEntityEnum({
|
|
191
|
+
name: 'LogLevel',
|
|
192
|
+
values: ['DEBUG', 'INFO', 'WARN', 'ERROR'],
|
|
193
|
+
description: 'Log severity level',
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* RunLog entity - Detailed execution logs
|
|
198
|
+
*/
|
|
199
|
+
export const RunLogEntity = defineEntity({
|
|
200
|
+
name: 'RunLog',
|
|
201
|
+
schema: 'agent_console',
|
|
202
|
+
description: 'Detailed execution logs for debugging and auditing.',
|
|
203
|
+
fields: {
|
|
204
|
+
id: field.id(),
|
|
205
|
+
runId: field.foreignKey({ description: 'Run ID' }),
|
|
206
|
+
stepId: field.string({
|
|
207
|
+
isOptional: true,
|
|
208
|
+
description: 'Step ID if related to a specific step',
|
|
209
|
+
}),
|
|
210
|
+
level: field.enum('LogLevel', { default: 'INFO' }),
|
|
211
|
+
message: field.string({ description: 'Log message' }),
|
|
212
|
+
// Structured data
|
|
213
|
+
data: field.json({ isOptional: true, description: 'Structured log data' }),
|
|
214
|
+
// Context
|
|
215
|
+
source: field.string({
|
|
216
|
+
isOptional: true,
|
|
217
|
+
description: "Log source: 'agent', 'tool', 'system'",
|
|
218
|
+
}),
|
|
219
|
+
traceId: field.string({
|
|
220
|
+
isOptional: true,
|
|
221
|
+
description: 'Trace ID for distributed tracing',
|
|
222
|
+
}),
|
|
223
|
+
spanId: field.string({
|
|
224
|
+
isOptional: true,
|
|
225
|
+
description: 'Span ID for distributed tracing',
|
|
226
|
+
}),
|
|
227
|
+
// Timestamp
|
|
228
|
+
timestamp: field.createdAt(),
|
|
229
|
+
// Relations
|
|
230
|
+
run: field.belongsTo('Run', ['runId'], ['id']),
|
|
231
|
+
step: field.belongsTo('RunStep', ['stepId'], ['id']),
|
|
232
|
+
},
|
|
233
|
+
indexes: [
|
|
234
|
+
index.on(['runId', 'timestamp']),
|
|
235
|
+
index.on(['runId', 'level']),
|
|
236
|
+
index.on(['stepId']),
|
|
237
|
+
index.on(['traceId']),
|
|
238
|
+
],
|
|
239
|
+
enums: [LogLevelEnum],
|
|
240
|
+
});
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defineEntity,
|
|
3
|
+
defineEntityEnum,
|
|
4
|
+
field,
|
|
5
|
+
index,
|
|
6
|
+
} from '@lssm/lib.schema/entity';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Tool category for organization and filtering
|
|
10
|
+
*/
|
|
11
|
+
export const ToolCategoryEnum = defineEntityEnum({
|
|
12
|
+
name: 'ToolCategory',
|
|
13
|
+
values: [
|
|
14
|
+
'RETRIEVAL', // Search, RAG, document retrieval
|
|
15
|
+
'COMPUTATION', // Math, code execution, data processing
|
|
16
|
+
'COMMUNICATION', // Email, messaging, notifications
|
|
17
|
+
'INTEGRATION', // External API integrations
|
|
18
|
+
'UTILITY', // General utilities
|
|
19
|
+
'CUSTOM', // User-defined tools
|
|
20
|
+
],
|
|
21
|
+
description: 'Category of the tool for organization and filtering',
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Tool status for lifecycle management
|
|
26
|
+
*/
|
|
27
|
+
export const ToolStatusEnum = defineEntityEnum({
|
|
28
|
+
name: 'ToolStatus',
|
|
29
|
+
values: [
|
|
30
|
+
'DRAFT', // Being configured
|
|
31
|
+
'ACTIVE', // Available for use
|
|
32
|
+
'DEPRECATED', // Being phased out
|
|
33
|
+
'DISABLED', // Temporarily unavailable
|
|
34
|
+
],
|
|
35
|
+
description: 'Lifecycle status of the tool',
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Tool entity - Represents an AI tool/function that agents can invoke
|
|
40
|
+
*/
|
|
41
|
+
export const ToolEntity = defineEntity({
|
|
42
|
+
name: 'Tool',
|
|
43
|
+
schema: 'agent_console',
|
|
44
|
+
description:
|
|
45
|
+
'Represents an AI tool/function that agents can invoke during execution.',
|
|
46
|
+
fields: {
|
|
47
|
+
id: field.id(),
|
|
48
|
+
organizationId: field.string({
|
|
49
|
+
description: 'Organization that owns this tool',
|
|
50
|
+
}),
|
|
51
|
+
name: field.string({ description: 'Tool name (1-100 chars)' }),
|
|
52
|
+
slug: field.string({
|
|
53
|
+
description: 'URL-safe identifier (lowercase, numbers, hyphens)',
|
|
54
|
+
}),
|
|
55
|
+
description: field.string({
|
|
56
|
+
description: 'Tool description (max 1000 chars)',
|
|
57
|
+
}),
|
|
58
|
+
category: field.enum('ToolCategory', { default: 'UTILITY' }),
|
|
59
|
+
status: field.enum('ToolStatus', { default: 'DRAFT' }),
|
|
60
|
+
// JSON Schema for tool parameters
|
|
61
|
+
parametersSchema: field.json({
|
|
62
|
+
description: 'JSON Schema for tool input parameters',
|
|
63
|
+
}),
|
|
64
|
+
// JSON Schema for tool output
|
|
65
|
+
outputSchema: field.json({
|
|
66
|
+
isOptional: true,
|
|
67
|
+
description: 'JSON Schema for tool output',
|
|
68
|
+
}),
|
|
69
|
+
// Implementation details
|
|
70
|
+
implementationType: field.string({
|
|
71
|
+
description: "Implementation type: 'http', 'function', 'workflow'",
|
|
72
|
+
}),
|
|
73
|
+
implementationConfig: field.json({
|
|
74
|
+
description: 'Implementation configuration (URL, function name, etc.)',
|
|
75
|
+
}),
|
|
76
|
+
// Rate limiting
|
|
77
|
+
maxInvocationsPerMinute: field.int({
|
|
78
|
+
isOptional: true,
|
|
79
|
+
description: 'Rate limit per minute',
|
|
80
|
+
}),
|
|
81
|
+
timeoutMs: field.int({
|
|
82
|
+
default: 30000,
|
|
83
|
+
description: 'Execution timeout in milliseconds',
|
|
84
|
+
}),
|
|
85
|
+
// Metadata
|
|
86
|
+
version: field.string({ default: '1.0.0', description: 'Tool version' }),
|
|
87
|
+
tags: field.string({
|
|
88
|
+
isArray: true,
|
|
89
|
+
isOptional: true,
|
|
90
|
+
description: 'Tags for categorization',
|
|
91
|
+
}),
|
|
92
|
+
createdAt: field.createdAt(),
|
|
93
|
+
updatedAt: field.updatedAt(),
|
|
94
|
+
createdById: field.string({
|
|
95
|
+
isOptional: true,
|
|
96
|
+
description: 'User who created this tool',
|
|
97
|
+
}),
|
|
98
|
+
},
|
|
99
|
+
indexes: [
|
|
100
|
+
index.unique(['organizationId', 'slug']),
|
|
101
|
+
index.on(['organizationId', 'category']),
|
|
102
|
+
index.on(['organizationId', 'status']),
|
|
103
|
+
],
|
|
104
|
+
enums: [ToolCategoryEnum, ToolStatusEnum],
|
|
105
|
+
});
|