@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/run.ts
DELETED
|
@@ -1,561 +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 RunStatusEnum = defineEnum('RunStatus', [
|
|
13
|
-
'QUEUED',
|
|
14
|
-
'IN_PROGRESS',
|
|
15
|
-
'COMPLETED',
|
|
16
|
-
'FAILED',
|
|
17
|
-
'CANCELLED',
|
|
18
|
-
'EXPIRED',
|
|
19
|
-
]);
|
|
20
|
-
|
|
21
|
-
export const RunStepTypeEnum = defineEnum('RunStepType', [
|
|
22
|
-
'MESSAGE_CREATION',
|
|
23
|
-
'TOOL_CALL',
|
|
24
|
-
'TOOL_RESULT',
|
|
25
|
-
'ERROR',
|
|
26
|
-
]);
|
|
27
|
-
|
|
28
|
-
export const LogLevelEnum = defineEnum('LogLevel', [
|
|
29
|
-
'DEBUG',
|
|
30
|
-
'INFO',
|
|
31
|
-
'WARN',
|
|
32
|
-
'ERROR',
|
|
33
|
-
]);
|
|
34
|
-
|
|
35
|
-
export const GranularityEnum = defineEnum('Granularity', [
|
|
36
|
-
'hour',
|
|
37
|
-
'day',
|
|
38
|
-
'week',
|
|
39
|
-
'month',
|
|
40
|
-
]);
|
|
41
|
-
|
|
42
|
-
// ============ Schemas ============
|
|
43
|
-
|
|
44
|
-
export const RunInputModel = defineSchemaModel({
|
|
45
|
-
name: 'RunInput',
|
|
46
|
-
description: 'Input data for agent execution',
|
|
47
|
-
fields: {
|
|
48
|
-
message: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
|
|
49
|
-
context: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
|
|
50
|
-
},
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
export const RunStepModel = defineSchemaModel({
|
|
54
|
-
name: 'RunStep',
|
|
55
|
-
description: 'Individual step within a run',
|
|
56
|
-
fields: {
|
|
57
|
-
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
58
|
-
stepNumber: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
59
|
-
type: { type: RunStepTypeEnum, isOptional: false },
|
|
60
|
-
toolId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
61
|
-
toolName: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
62
|
-
input: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
|
|
63
|
-
output: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
|
|
64
|
-
status: { type: RunStatusEnum, isOptional: false },
|
|
65
|
-
errorMessage: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
66
|
-
tokensUsed: {
|
|
67
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
68
|
-
isOptional: false,
|
|
69
|
-
defaultValue: 0,
|
|
70
|
-
},
|
|
71
|
-
durationMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
|
|
72
|
-
startedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
|
|
73
|
-
completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },
|
|
74
|
-
},
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
export const RunLogModel = defineSchemaModel({
|
|
78
|
-
name: 'RunLog',
|
|
79
|
-
description: 'Execution log entry',
|
|
80
|
-
fields: {
|
|
81
|
-
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
82
|
-
stepId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
83
|
-
level: { type: LogLevelEnum, isOptional: false },
|
|
84
|
-
message: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
85
|
-
data: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
|
|
86
|
-
source: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
87
|
-
traceId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
88
|
-
spanId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
89
|
-
timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false },
|
|
90
|
-
},
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
export const RunAgentRefModel = defineSchemaModel({
|
|
94
|
-
name: 'RunAgentRef',
|
|
95
|
-
description: 'Agent reference in a run',
|
|
96
|
-
fields: {
|
|
97
|
-
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
98
|
-
name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
|
|
99
|
-
modelProvider: {
|
|
100
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
101
|
-
isOptional: false,
|
|
102
|
-
},
|
|
103
|
-
modelName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
104
|
-
},
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
export const RunModel = defineSchemaModel({
|
|
108
|
-
name: 'Run',
|
|
109
|
-
description: 'Agent execution instance',
|
|
110
|
-
fields: {
|
|
111
|
-
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
112
|
-
organizationId: {
|
|
113
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
114
|
-
isOptional: false,
|
|
115
|
-
},
|
|
116
|
-
agentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
117
|
-
userId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
118
|
-
sessionId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
119
|
-
input: { type: ScalarTypeEnum.JSONObject(), isOptional: false },
|
|
120
|
-
output: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
|
|
121
|
-
status: { type: RunStatusEnum, isOptional: false },
|
|
122
|
-
errorMessage: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
123
|
-
errorCode: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
124
|
-
totalTokens: {
|
|
125
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
126
|
-
isOptional: false,
|
|
127
|
-
defaultValue: 0,
|
|
128
|
-
},
|
|
129
|
-
promptTokens: {
|
|
130
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
131
|
-
isOptional: false,
|
|
132
|
-
defaultValue: 0,
|
|
133
|
-
},
|
|
134
|
-
completionTokens: {
|
|
135
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
136
|
-
isOptional: false,
|
|
137
|
-
defaultValue: 0,
|
|
138
|
-
},
|
|
139
|
-
totalIterations: {
|
|
140
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
141
|
-
isOptional: false,
|
|
142
|
-
defaultValue: 0,
|
|
143
|
-
},
|
|
144
|
-
durationMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
|
|
145
|
-
estimatedCostUsd: {
|
|
146
|
-
type: ScalarTypeEnum.Float_unsecure(),
|
|
147
|
-
isOptional: true,
|
|
148
|
-
},
|
|
149
|
-
queuedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
|
|
150
|
-
startedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },
|
|
151
|
-
completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },
|
|
152
|
-
metadata: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
|
|
153
|
-
steps: { type: RunStepModel, isArray: true, isOptional: true },
|
|
154
|
-
logs: { type: RunLogModel, isArray: true, isOptional: true },
|
|
155
|
-
agent: { type: RunAgentRefModel, isOptional: true },
|
|
156
|
-
},
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
export const RunSummaryModel = defineSchemaModel({
|
|
160
|
-
name: 'RunSummary',
|
|
161
|
-
description: 'Summary of a run for list views',
|
|
162
|
-
fields: {
|
|
163
|
-
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
164
|
-
agentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
165
|
-
agentName: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
|
|
166
|
-
status: { type: RunStatusEnum, isOptional: false },
|
|
167
|
-
totalTokens: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
168
|
-
durationMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
|
|
169
|
-
estimatedCostUsd: {
|
|
170
|
-
type: ScalarTypeEnum.Float_unsecure(),
|
|
171
|
-
isOptional: true,
|
|
172
|
-
},
|
|
173
|
-
queuedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
|
|
174
|
-
completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },
|
|
175
|
-
},
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
export const TimelineDataPointModel = defineSchemaModel({
|
|
179
|
-
name: 'TimelineDataPoint',
|
|
180
|
-
description: 'Timeline data point for metrics',
|
|
181
|
-
fields: {
|
|
182
|
-
period: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
183
|
-
runs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
184
|
-
tokens: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
185
|
-
costUsd: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
|
|
186
|
-
avgDurationMs: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
|
|
187
|
-
},
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
// ============ Contracts ============
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* ExecuteAgentCommand - Starts a new agent run
|
|
194
|
-
*/
|
|
195
|
-
export const ExecuteAgentCommand = defineCommand({
|
|
196
|
-
meta: {
|
|
197
|
-
name: 'agent.run.execute',
|
|
198
|
-
version: 1,
|
|
199
|
-
stability: 'stable',
|
|
200
|
-
owners: [...OWNERS],
|
|
201
|
-
tags: ['run', 'execute'],
|
|
202
|
-
description: 'Starts a new agent run with the given input.',
|
|
203
|
-
goal: 'Execute an AI agent with user input.',
|
|
204
|
-
context: 'Called from chat interface or API.',
|
|
205
|
-
},
|
|
206
|
-
io: {
|
|
207
|
-
input: defineSchemaModel({
|
|
208
|
-
name: 'ExecuteAgentInput',
|
|
209
|
-
fields: {
|
|
210
|
-
agentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
211
|
-
input: { type: RunInputModel, isOptional: false },
|
|
212
|
-
sessionId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
213
|
-
metadata: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
|
|
214
|
-
stream: { type: ScalarTypeEnum.Boolean(), isOptional: true },
|
|
215
|
-
maxIterations: {
|
|
216
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
217
|
-
isOptional: true,
|
|
218
|
-
},
|
|
219
|
-
timeoutMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
|
|
220
|
-
},
|
|
221
|
-
}),
|
|
222
|
-
output: defineSchemaModel({
|
|
223
|
-
name: 'ExecuteAgentOutput',
|
|
224
|
-
fields: {
|
|
225
|
-
runId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
226
|
-
status: { type: RunStatusEnum, isOptional: false },
|
|
227
|
-
estimatedWaitMs: {
|
|
228
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
229
|
-
isOptional: true,
|
|
230
|
-
},
|
|
231
|
-
},
|
|
232
|
-
}),
|
|
233
|
-
errors: {
|
|
234
|
-
AGENT_NOT_FOUND: {
|
|
235
|
-
description: 'The specified agent does not exist',
|
|
236
|
-
http: 404,
|
|
237
|
-
gqlCode: 'AGENT_NOT_FOUND',
|
|
238
|
-
when: 'Agent ID is invalid',
|
|
239
|
-
},
|
|
240
|
-
AGENT_NOT_ACTIVE: {
|
|
241
|
-
description: 'The specified agent is not active',
|
|
242
|
-
http: 400,
|
|
243
|
-
gqlCode: 'AGENT_NOT_ACTIVE',
|
|
244
|
-
when: 'Agent is in draft/paused/archived state',
|
|
245
|
-
},
|
|
246
|
-
},
|
|
247
|
-
},
|
|
248
|
-
policy: {
|
|
249
|
-
auth: 'user',
|
|
250
|
-
},
|
|
251
|
-
sideEffects: {
|
|
252
|
-
emits: [
|
|
253
|
-
{
|
|
254
|
-
name: 'run.started',
|
|
255
|
-
version: 1,
|
|
256
|
-
when: 'Run is queued',
|
|
257
|
-
payload: RunSummaryModel,
|
|
258
|
-
},
|
|
259
|
-
],
|
|
260
|
-
audit: ['run.started'],
|
|
261
|
-
},
|
|
262
|
-
});
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
* CancelRunCommand - Cancels an in-progress run
|
|
266
|
-
*/
|
|
267
|
-
export const CancelRunCommand = defineCommand({
|
|
268
|
-
meta: {
|
|
269
|
-
name: 'agent.run.cancel',
|
|
270
|
-
version: 1,
|
|
271
|
-
stability: 'stable',
|
|
272
|
-
owners: [...OWNERS],
|
|
273
|
-
tags: ['run', 'cancel'],
|
|
274
|
-
description: 'Cancels an in-progress agent run.',
|
|
275
|
-
goal: 'Stop a running agent execution.',
|
|
276
|
-
context: 'Called when user wants to abort a long-running task.',
|
|
277
|
-
},
|
|
278
|
-
io: {
|
|
279
|
-
input: defineSchemaModel({
|
|
280
|
-
name: 'CancelRunInput',
|
|
281
|
-
fields: {
|
|
282
|
-
runId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
283
|
-
reason: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
284
|
-
},
|
|
285
|
-
}),
|
|
286
|
-
output: defineSchemaModel({
|
|
287
|
-
name: 'CancelRunOutput',
|
|
288
|
-
fields: {
|
|
289
|
-
success: { type: ScalarTypeEnum.Boolean(), isOptional: false },
|
|
290
|
-
status: { type: RunStatusEnum, isOptional: false },
|
|
291
|
-
},
|
|
292
|
-
}),
|
|
293
|
-
errors: {
|
|
294
|
-
RUN_NOT_FOUND: {
|
|
295
|
-
description: 'The specified run does not exist',
|
|
296
|
-
http: 404,
|
|
297
|
-
gqlCode: 'RUN_NOT_FOUND',
|
|
298
|
-
when: 'Run ID is invalid',
|
|
299
|
-
},
|
|
300
|
-
RUN_NOT_CANCELLABLE: {
|
|
301
|
-
description: 'The run cannot be cancelled',
|
|
302
|
-
http: 400,
|
|
303
|
-
gqlCode: 'RUN_NOT_CANCELLABLE',
|
|
304
|
-
when: 'Run is already completed/failed/cancelled',
|
|
305
|
-
},
|
|
306
|
-
},
|
|
307
|
-
},
|
|
308
|
-
policy: {
|
|
309
|
-
auth: 'user',
|
|
310
|
-
},
|
|
311
|
-
sideEffects: {
|
|
312
|
-
emits: [
|
|
313
|
-
{
|
|
314
|
-
name: 'run.cancelled',
|
|
315
|
-
version: 1,
|
|
316
|
-
when: 'Run is cancelled',
|
|
317
|
-
payload: RunSummaryModel,
|
|
318
|
-
},
|
|
319
|
-
],
|
|
320
|
-
audit: ['run.cancelled'],
|
|
321
|
-
},
|
|
322
|
-
});
|
|
323
|
-
|
|
324
|
-
/**
|
|
325
|
-
* GetRunQuery - Retrieves a run by ID
|
|
326
|
-
*/
|
|
327
|
-
export const GetRunQuery = defineQuery({
|
|
328
|
-
meta: {
|
|
329
|
-
name: 'agent.run.get',
|
|
330
|
-
version: 1,
|
|
331
|
-
stability: 'stable',
|
|
332
|
-
owners: [...OWNERS],
|
|
333
|
-
tags: ['run', 'get'],
|
|
334
|
-
description: 'Retrieves a run by its ID with optional details.',
|
|
335
|
-
goal: 'View detailed run information.',
|
|
336
|
-
context: 'Run details page or monitoring.',
|
|
337
|
-
},
|
|
338
|
-
io: {
|
|
339
|
-
input: defineSchemaModel({
|
|
340
|
-
name: 'GetRunInput',
|
|
341
|
-
fields: {
|
|
342
|
-
runId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
343
|
-
includeSteps: { type: ScalarTypeEnum.Boolean(), isOptional: true },
|
|
344
|
-
includeLogs: { type: ScalarTypeEnum.Boolean(), isOptional: true },
|
|
345
|
-
},
|
|
346
|
-
}),
|
|
347
|
-
output: RunModel,
|
|
348
|
-
errors: {
|
|
349
|
-
RUN_NOT_FOUND: {
|
|
350
|
-
description: 'The specified run does not exist',
|
|
351
|
-
http: 404,
|
|
352
|
-
gqlCode: 'RUN_NOT_FOUND',
|
|
353
|
-
when: 'Run ID is invalid',
|
|
354
|
-
},
|
|
355
|
-
},
|
|
356
|
-
},
|
|
357
|
-
policy: {
|
|
358
|
-
auth: 'user',
|
|
359
|
-
},
|
|
360
|
-
});
|
|
361
|
-
|
|
362
|
-
/**
|
|
363
|
-
* ListRunsQuery - Lists runs for an organization or agent
|
|
364
|
-
*/
|
|
365
|
-
export const ListRunsQuery = defineQuery({
|
|
366
|
-
meta: {
|
|
367
|
-
name: 'agent.run.list',
|
|
368
|
-
version: 1,
|
|
369
|
-
stability: 'stable',
|
|
370
|
-
owners: [...OWNERS],
|
|
371
|
-
tags: ['run', 'list'],
|
|
372
|
-
description: 'Lists runs with optional filtering.',
|
|
373
|
-
goal: 'Browse and search run history.',
|
|
374
|
-
context: 'Run history/dashboard view.',
|
|
375
|
-
},
|
|
376
|
-
io: {
|
|
377
|
-
input: defineSchemaModel({
|
|
378
|
-
name: 'ListRunsInput',
|
|
379
|
-
fields: {
|
|
380
|
-
organizationId: {
|
|
381
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
382
|
-
isOptional: true,
|
|
383
|
-
},
|
|
384
|
-
agentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
385
|
-
userId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
386
|
-
sessionId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
387
|
-
status: { type: RunStatusEnum, isOptional: true },
|
|
388
|
-
startDate: { type: ScalarTypeEnum.DateTime(), isOptional: true },
|
|
389
|
-
endDate: { type: ScalarTypeEnum.DateTime(), isOptional: true },
|
|
390
|
-
limit: {
|
|
391
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
392
|
-
isOptional: true,
|
|
393
|
-
defaultValue: 20,
|
|
394
|
-
},
|
|
395
|
-
offset: {
|
|
396
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
397
|
-
isOptional: true,
|
|
398
|
-
defaultValue: 0,
|
|
399
|
-
},
|
|
400
|
-
},
|
|
401
|
-
}),
|
|
402
|
-
output: defineSchemaModel({
|
|
403
|
-
name: 'ListRunsOutput',
|
|
404
|
-
fields: {
|
|
405
|
-
items: { type: RunSummaryModel, isArray: true, isOptional: false },
|
|
406
|
-
total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
407
|
-
hasMore: { type: ScalarTypeEnum.Boolean(), isOptional: false },
|
|
408
|
-
},
|
|
409
|
-
}),
|
|
410
|
-
},
|
|
411
|
-
policy: {
|
|
412
|
-
auth: 'user',
|
|
413
|
-
},
|
|
414
|
-
});
|
|
415
|
-
|
|
416
|
-
/**
|
|
417
|
-
* GetRunStepsQuery - Retrieves steps for a run
|
|
418
|
-
*/
|
|
419
|
-
export const GetRunStepsQuery = defineQuery({
|
|
420
|
-
meta: {
|
|
421
|
-
name: 'agent.run.getSteps',
|
|
422
|
-
version: 1,
|
|
423
|
-
stability: 'stable',
|
|
424
|
-
owners: [...OWNERS],
|
|
425
|
-
tags: ['run', 'steps'],
|
|
426
|
-
description: 'Retrieves all steps for a specific run.',
|
|
427
|
-
goal: 'View step-by-step execution details.',
|
|
428
|
-
context: 'Run details page - steps tab.',
|
|
429
|
-
},
|
|
430
|
-
io: {
|
|
431
|
-
input: defineSchemaModel({
|
|
432
|
-
name: 'GetRunStepsInput',
|
|
433
|
-
fields: {
|
|
434
|
-
runId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
435
|
-
},
|
|
436
|
-
}),
|
|
437
|
-
output: defineSchemaModel({
|
|
438
|
-
name: 'GetRunStepsOutput',
|
|
439
|
-
fields: {
|
|
440
|
-
steps: { type: RunStepModel, isArray: true, isOptional: false },
|
|
441
|
-
},
|
|
442
|
-
}),
|
|
443
|
-
},
|
|
444
|
-
policy: {
|
|
445
|
-
auth: 'user',
|
|
446
|
-
},
|
|
447
|
-
});
|
|
448
|
-
|
|
449
|
-
/**
|
|
450
|
-
* GetRunLogsQuery - Retrieves logs for a run
|
|
451
|
-
*/
|
|
452
|
-
export const GetRunLogsQuery = defineQuery({
|
|
453
|
-
meta: {
|
|
454
|
-
name: 'agent.run.getLogs',
|
|
455
|
-
version: 1,
|
|
456
|
-
stability: 'stable',
|
|
457
|
-
owners: [...OWNERS],
|
|
458
|
-
tags: ['run', 'logs'],
|
|
459
|
-
description: 'Retrieves all logs for a specific run.',
|
|
460
|
-
goal: 'Debug and audit run execution.',
|
|
461
|
-
context: 'Run details page - logs tab.',
|
|
462
|
-
},
|
|
463
|
-
io: {
|
|
464
|
-
input: defineSchemaModel({
|
|
465
|
-
name: 'GetRunLogsInput',
|
|
466
|
-
fields: {
|
|
467
|
-
runId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
468
|
-
level: { type: LogLevelEnum, isOptional: true },
|
|
469
|
-
stepId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
470
|
-
limit: {
|
|
471
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
472
|
-
isOptional: true,
|
|
473
|
-
defaultValue: 100,
|
|
474
|
-
},
|
|
475
|
-
offset: {
|
|
476
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
477
|
-
isOptional: true,
|
|
478
|
-
defaultValue: 0,
|
|
479
|
-
},
|
|
480
|
-
},
|
|
481
|
-
}),
|
|
482
|
-
output: defineSchemaModel({
|
|
483
|
-
name: 'GetRunLogsOutput',
|
|
484
|
-
fields: {
|
|
485
|
-
items: { type: RunLogModel, isArray: true, isOptional: false },
|
|
486
|
-
total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
487
|
-
hasMore: { type: ScalarTypeEnum.Boolean(), isOptional: false },
|
|
488
|
-
},
|
|
489
|
-
}),
|
|
490
|
-
},
|
|
491
|
-
policy: {
|
|
492
|
-
auth: 'user',
|
|
493
|
-
},
|
|
494
|
-
});
|
|
495
|
-
|
|
496
|
-
/**
|
|
497
|
-
* GetRunMetricsQuery - Retrieves aggregated metrics for runs
|
|
498
|
-
*/
|
|
499
|
-
export const GetRunMetricsQuery = defineQuery({
|
|
500
|
-
meta: {
|
|
501
|
-
name: 'agent.run.getMetrics',
|
|
502
|
-
version: 1,
|
|
503
|
-
stability: 'stable',
|
|
504
|
-
owners: [...OWNERS],
|
|
505
|
-
tags: ['run', 'metrics'],
|
|
506
|
-
description: 'Retrieves aggregated metrics for runs within a time period.',
|
|
507
|
-
goal: 'Monitor and analyze agent usage.',
|
|
508
|
-
context: 'Analytics dashboard.',
|
|
509
|
-
},
|
|
510
|
-
io: {
|
|
511
|
-
input: defineSchemaModel({
|
|
512
|
-
name: 'GetRunMetricsInput',
|
|
513
|
-
fields: {
|
|
514
|
-
organizationId: {
|
|
515
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
516
|
-
isOptional: false,
|
|
517
|
-
},
|
|
518
|
-
agentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
519
|
-
startDate: { type: ScalarTypeEnum.DateTime(), isOptional: false },
|
|
520
|
-
endDate: { type: ScalarTypeEnum.DateTime(), isOptional: false },
|
|
521
|
-
granularity: {
|
|
522
|
-
type: GranularityEnum,
|
|
523
|
-
isOptional: true,
|
|
524
|
-
defaultValue: 'day',
|
|
525
|
-
},
|
|
526
|
-
},
|
|
527
|
-
}),
|
|
528
|
-
output: defineSchemaModel({
|
|
529
|
-
name: 'GetRunMetricsOutput',
|
|
530
|
-
fields: {
|
|
531
|
-
totalRuns: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
532
|
-
completedRuns: {
|
|
533
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
534
|
-
isOptional: false,
|
|
535
|
-
},
|
|
536
|
-
failedRuns: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
537
|
-
totalTokens: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
538
|
-
totalCostUsd: {
|
|
539
|
-
type: ScalarTypeEnum.Float_unsecure(),
|
|
540
|
-
isOptional: false,
|
|
541
|
-
},
|
|
542
|
-
averageDurationMs: {
|
|
543
|
-
type: ScalarTypeEnum.Float_unsecure(),
|
|
544
|
-
isOptional: false,
|
|
545
|
-
},
|
|
546
|
-
successRate: {
|
|
547
|
-
type: ScalarTypeEnum.Float_unsecure(),
|
|
548
|
-
isOptional: false,
|
|
549
|
-
},
|
|
550
|
-
timeline: {
|
|
551
|
-
type: TimelineDataPointModel,
|
|
552
|
-
isArray: true,
|
|
553
|
-
isOptional: false,
|
|
554
|
-
},
|
|
555
|
-
},
|
|
556
|
-
}),
|
|
557
|
-
},
|
|
558
|
-
policy: {
|
|
559
|
-
auth: 'user',
|
|
560
|
-
},
|
|
561
|
-
});
|