@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
|
@@ -1,331 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Mock handlers for Run contracts
|
|
3
|
-
*/
|
|
4
|
-
import { MOCK_RUNS, MOCK_RUN_STEPS, MOCK_RUN_LOGS } from './mock-data';
|
|
5
|
-
|
|
6
|
-
// Types inferred from contract schemas
|
|
7
|
-
export interface ListRunsInput {
|
|
8
|
-
organizationId?: string;
|
|
9
|
-
agentId?: string;
|
|
10
|
-
userId?: string;
|
|
11
|
-
sessionId?: string;
|
|
12
|
-
status?:
|
|
13
|
-
| 'QUEUED'
|
|
14
|
-
| 'IN_PROGRESS'
|
|
15
|
-
| 'COMPLETED'
|
|
16
|
-
| 'FAILED'
|
|
17
|
-
| 'CANCELLED'
|
|
18
|
-
| 'EXPIRED';
|
|
19
|
-
startDate?: Date;
|
|
20
|
-
endDate?: Date;
|
|
21
|
-
limit?: number;
|
|
22
|
-
offset?: number;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export interface RunSummary {
|
|
26
|
-
id: string;
|
|
27
|
-
agentId: string;
|
|
28
|
-
agentName: string;
|
|
29
|
-
status:
|
|
30
|
-
| 'QUEUED'
|
|
31
|
-
| 'IN_PROGRESS'
|
|
32
|
-
| 'COMPLETED'
|
|
33
|
-
| 'FAILED'
|
|
34
|
-
| 'CANCELLED'
|
|
35
|
-
| 'EXPIRED';
|
|
36
|
-
totalTokens: number;
|
|
37
|
-
durationMs?: number;
|
|
38
|
-
estimatedCostUsd?: number;
|
|
39
|
-
queuedAt: Date;
|
|
40
|
-
completedAt?: Date;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export interface ListRunsOutput {
|
|
44
|
-
items: RunSummary[];
|
|
45
|
-
total: number;
|
|
46
|
-
hasMore: boolean;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export interface GetRunInput {
|
|
50
|
-
runId: string;
|
|
51
|
-
includeSteps?: boolean;
|
|
52
|
-
includeLogs?: boolean;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export interface Run {
|
|
56
|
-
id: string;
|
|
57
|
-
organizationId: string;
|
|
58
|
-
agentId: string;
|
|
59
|
-
userId?: string;
|
|
60
|
-
sessionId?: string;
|
|
61
|
-
input: Record<string, unknown>;
|
|
62
|
-
output?: Record<string, unknown>;
|
|
63
|
-
status:
|
|
64
|
-
| 'QUEUED'
|
|
65
|
-
| 'IN_PROGRESS'
|
|
66
|
-
| 'COMPLETED'
|
|
67
|
-
| 'FAILED'
|
|
68
|
-
| 'CANCELLED'
|
|
69
|
-
| 'EXPIRED';
|
|
70
|
-
errorMessage?: string;
|
|
71
|
-
errorCode?: string;
|
|
72
|
-
totalTokens: number;
|
|
73
|
-
promptTokens: number;
|
|
74
|
-
completionTokens: number;
|
|
75
|
-
totalIterations: number;
|
|
76
|
-
durationMs?: number;
|
|
77
|
-
estimatedCostUsd?: number;
|
|
78
|
-
queuedAt: Date;
|
|
79
|
-
startedAt?: Date;
|
|
80
|
-
completedAt?: Date;
|
|
81
|
-
metadata?: Record<string, unknown>;
|
|
82
|
-
steps?: RunStep[];
|
|
83
|
-
logs?: RunLog[];
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export interface RunStep {
|
|
87
|
-
id: string;
|
|
88
|
-
stepNumber: number;
|
|
89
|
-
type: 'MESSAGE_CREATION' | 'TOOL_CALL' | 'TOOL_RESULT' | 'ERROR';
|
|
90
|
-
toolId?: string;
|
|
91
|
-
toolName?: string;
|
|
92
|
-
input?: Record<string, unknown>;
|
|
93
|
-
output?: Record<string, unknown>;
|
|
94
|
-
status:
|
|
95
|
-
| 'QUEUED'
|
|
96
|
-
| 'IN_PROGRESS'
|
|
97
|
-
| 'COMPLETED'
|
|
98
|
-
| 'FAILED'
|
|
99
|
-
| 'CANCELLED'
|
|
100
|
-
| 'EXPIRED';
|
|
101
|
-
errorMessage?: string;
|
|
102
|
-
tokensUsed: number;
|
|
103
|
-
durationMs?: number;
|
|
104
|
-
startedAt: Date;
|
|
105
|
-
completedAt?: Date;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
export interface RunLog {
|
|
109
|
-
id: string;
|
|
110
|
-
stepId?: string;
|
|
111
|
-
level: 'DEBUG' | 'INFO' | 'WARN' | 'ERROR';
|
|
112
|
-
message: string;
|
|
113
|
-
data?: Record<string, unknown>;
|
|
114
|
-
source?: string;
|
|
115
|
-
traceId?: string;
|
|
116
|
-
spanId?: string;
|
|
117
|
-
timestamp: Date;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
export interface GetRunMetricsInput {
|
|
121
|
-
organizationId: string;
|
|
122
|
-
agentId?: string;
|
|
123
|
-
startDate: Date;
|
|
124
|
-
endDate: Date;
|
|
125
|
-
granularity?: 'hour' | 'day' | 'week' | 'month';
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export interface TimelineDataPoint {
|
|
129
|
-
period: string;
|
|
130
|
-
runs: number;
|
|
131
|
-
tokens: number;
|
|
132
|
-
costUsd: number;
|
|
133
|
-
avgDurationMs: number;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
export interface RunMetrics {
|
|
137
|
-
totalRuns: number;
|
|
138
|
-
completedRuns: number;
|
|
139
|
-
failedRuns: number;
|
|
140
|
-
totalTokens: number;
|
|
141
|
-
totalCostUsd: number;
|
|
142
|
-
averageDurationMs: number;
|
|
143
|
-
successRate: number;
|
|
144
|
-
timeline: TimelineDataPoint[];
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* Mock handler for ListRunsQuery
|
|
149
|
-
*/
|
|
150
|
-
export async function mockListRunsHandler(
|
|
151
|
-
input: ListRunsInput
|
|
152
|
-
): Promise<ListRunsOutput> {
|
|
153
|
-
const { agentId, status, limit = 20, offset = 0 } = input;
|
|
154
|
-
|
|
155
|
-
let filtered = [...MOCK_RUNS];
|
|
156
|
-
|
|
157
|
-
if (agentId) {
|
|
158
|
-
filtered = filtered.filter((r) => r.agentId === agentId);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
if (status) {
|
|
162
|
-
filtered = filtered.filter((r) => r.status === status);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
// Sort by queuedAt descending
|
|
166
|
-
filtered.sort((a, b) => b.queuedAt.getTime() - a.queuedAt.getTime());
|
|
167
|
-
|
|
168
|
-
const total = filtered.length;
|
|
169
|
-
const items = filtered.slice(offset, offset + limit).map((r) => ({
|
|
170
|
-
id: r.id,
|
|
171
|
-
agentId: r.agentId,
|
|
172
|
-
agentName: r.agentName,
|
|
173
|
-
status: r.status,
|
|
174
|
-
totalTokens: r.totalTokens,
|
|
175
|
-
durationMs: r.durationMs,
|
|
176
|
-
estimatedCostUsd: r.estimatedCostUsd,
|
|
177
|
-
queuedAt: r.queuedAt,
|
|
178
|
-
completedAt: r.completedAt,
|
|
179
|
-
}));
|
|
180
|
-
|
|
181
|
-
return {
|
|
182
|
-
items,
|
|
183
|
-
total,
|
|
184
|
-
hasMore: offset + limit < total,
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* Mock handler for GetRunQuery
|
|
190
|
-
*/
|
|
191
|
-
export async function mockGetRunHandler(input: GetRunInput): Promise<Run> {
|
|
192
|
-
const run = MOCK_RUNS.find((r) => r.id === input.runId);
|
|
193
|
-
|
|
194
|
-
if (!run) {
|
|
195
|
-
throw new Error('RUN_NOT_FOUND');
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
const result: Run = {
|
|
199
|
-
...run,
|
|
200
|
-
promptTokens: run.promptTokens ?? 0,
|
|
201
|
-
completionTokens: run.completionTokens ?? 0,
|
|
202
|
-
totalIterations: run.totalIterations ?? 0,
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
if (input.includeSteps) {
|
|
206
|
-
result.steps = MOCK_RUN_STEPS.filter((s) => s.runId === input.runId).map(
|
|
207
|
-
(s) => ({
|
|
208
|
-
id: s.id,
|
|
209
|
-
stepNumber: s.stepNumber,
|
|
210
|
-
type: s.type,
|
|
211
|
-
toolId: s.toolId,
|
|
212
|
-
toolName: s.toolName,
|
|
213
|
-
input: s.input,
|
|
214
|
-
output: s.output,
|
|
215
|
-
status: s.status,
|
|
216
|
-
errorMessage: undefined,
|
|
217
|
-
tokensUsed: s.tokensUsed,
|
|
218
|
-
durationMs: s.durationMs,
|
|
219
|
-
startedAt: s.startedAt,
|
|
220
|
-
completedAt: s.completedAt,
|
|
221
|
-
})
|
|
222
|
-
);
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
if (input.includeLogs) {
|
|
226
|
-
result.logs = MOCK_RUN_LOGS.filter((l) => l.runId === input.runId).map(
|
|
227
|
-
(l) => ({
|
|
228
|
-
id: l.id,
|
|
229
|
-
stepId: l.stepId,
|
|
230
|
-
level: l.level,
|
|
231
|
-
message: l.message,
|
|
232
|
-
data: l.data,
|
|
233
|
-
source: l.source,
|
|
234
|
-
timestamp: l.timestamp,
|
|
235
|
-
})
|
|
236
|
-
);
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
return result;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
/**
|
|
243
|
-
* Mock handler for GetRunMetricsQuery
|
|
244
|
-
*/
|
|
245
|
-
export async function mockGetRunMetricsHandler(
|
|
246
|
-
input: GetRunMetricsInput
|
|
247
|
-
): Promise<RunMetrics> {
|
|
248
|
-
const { agentId } = input;
|
|
249
|
-
|
|
250
|
-
let runs = [...MOCK_RUNS];
|
|
251
|
-
if (agentId) {
|
|
252
|
-
runs = runs.filter((r) => r.agentId === agentId);
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
const completed = runs.filter((r) => r.status === 'COMPLETED');
|
|
256
|
-
const failed = runs.filter((r) => r.status === 'FAILED');
|
|
257
|
-
|
|
258
|
-
const totalTokens = runs.reduce((sum, r) => sum + r.totalTokens, 0);
|
|
259
|
-
const totalCost = runs.reduce((sum, r) => sum + (r.estimatedCostUsd ?? 0), 0);
|
|
260
|
-
const avgDuration =
|
|
261
|
-
completed.length > 0
|
|
262
|
-
? completed.reduce((sum, r) => sum + (r.durationMs ?? 0), 0) /
|
|
263
|
-
completed.length
|
|
264
|
-
: 0;
|
|
265
|
-
|
|
266
|
-
// Generate mock timeline
|
|
267
|
-
const timeline: TimelineDataPoint[] = [
|
|
268
|
-
{
|
|
269
|
-
period: '2024-04-14',
|
|
270
|
-
runs: 2,
|
|
271
|
-
tokens: 7200,
|
|
272
|
-
costUsd: 0.0168,
|
|
273
|
-
avgDurationMs: 30000,
|
|
274
|
-
},
|
|
275
|
-
{
|
|
276
|
-
period: '2024-04-15',
|
|
277
|
-
runs: 3,
|
|
278
|
-
tokens: 5550,
|
|
279
|
-
costUsd: 0.0137,
|
|
280
|
-
avgDurationMs: 3600,
|
|
281
|
-
},
|
|
282
|
-
];
|
|
283
|
-
|
|
284
|
-
return {
|
|
285
|
-
totalRuns: runs.length,
|
|
286
|
-
completedRuns: completed.length,
|
|
287
|
-
failedRuns: failed.length,
|
|
288
|
-
totalTokens,
|
|
289
|
-
totalCostUsd: totalCost,
|
|
290
|
-
averageDurationMs: avgDuration,
|
|
291
|
-
successRate: runs.length > 0 ? completed.length / runs.length : 0,
|
|
292
|
-
timeline,
|
|
293
|
-
};
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
/**
|
|
297
|
-
* Mock handler for ExecuteAgentCommand
|
|
298
|
-
*/
|
|
299
|
-
export async function mockExecuteAgentHandler(input: {
|
|
300
|
-
agentId: string;
|
|
301
|
-
input: { message: string; context?: Record<string, unknown> };
|
|
302
|
-
}) {
|
|
303
|
-
// Simulate queuing a run
|
|
304
|
-
return {
|
|
305
|
-
runId: `run-${Date.now()}`,
|
|
306
|
-
status: 'QUEUED' as const,
|
|
307
|
-
estimatedWaitMs: 2000,
|
|
308
|
-
};
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
/**
|
|
312
|
-
* Mock handler for CancelRunCommand
|
|
313
|
-
*/
|
|
314
|
-
export async function mockCancelRunHandler(input: {
|
|
315
|
-
runId: string;
|
|
316
|
-
reason?: string;
|
|
317
|
-
}) {
|
|
318
|
-
const run = MOCK_RUNS.find((r) => r.id === input.runId);
|
|
319
|
-
if (!run) {
|
|
320
|
-
throw new Error('RUN_NOT_FOUND');
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
if (!['QUEUED', 'IN_PROGRESS'].includes(run.status)) {
|
|
324
|
-
throw new Error('RUN_NOT_CANCELLABLE');
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
return {
|
|
328
|
-
success: true,
|
|
329
|
-
status: 'CANCELLED' as const,
|
|
330
|
-
};
|
|
331
|
-
}
|
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Mock handlers for Tool contracts
|
|
3
|
-
*/
|
|
4
|
-
import { MOCK_TOOLS } from './mock-data';
|
|
5
|
-
|
|
6
|
-
// Types inferred from contract schemas
|
|
7
|
-
export interface ListToolsInput {
|
|
8
|
-
organizationId: string;
|
|
9
|
-
category?:
|
|
10
|
-
| 'RETRIEVAL'
|
|
11
|
-
| 'COMPUTATION'
|
|
12
|
-
| 'COMMUNICATION'
|
|
13
|
-
| 'INTEGRATION'
|
|
14
|
-
| 'UTILITY'
|
|
15
|
-
| 'CUSTOM';
|
|
16
|
-
status?: 'DRAFT' | 'ACTIVE' | 'DEPRECATED' | 'DISABLED';
|
|
17
|
-
search?: string;
|
|
18
|
-
limit?: number;
|
|
19
|
-
offset?: number;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface ToolSummary {
|
|
23
|
-
id: string;
|
|
24
|
-
name: string;
|
|
25
|
-
slug: string;
|
|
26
|
-
description: string;
|
|
27
|
-
category:
|
|
28
|
-
| 'RETRIEVAL'
|
|
29
|
-
| 'COMPUTATION'
|
|
30
|
-
| 'COMMUNICATION'
|
|
31
|
-
| 'INTEGRATION'
|
|
32
|
-
| 'UTILITY'
|
|
33
|
-
| 'CUSTOM';
|
|
34
|
-
status: 'DRAFT' | 'ACTIVE' | 'DEPRECATED' | 'DISABLED';
|
|
35
|
-
version: string;
|
|
36
|
-
createdAt: Date;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export interface ListToolsOutput {
|
|
40
|
-
items: ToolSummary[];
|
|
41
|
-
total: number;
|
|
42
|
-
hasMore: boolean;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export interface GetToolInput {
|
|
46
|
-
toolId: string;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export interface Tool {
|
|
50
|
-
id: string;
|
|
51
|
-
organizationId: string;
|
|
52
|
-
name: string;
|
|
53
|
-
slug: string;
|
|
54
|
-
description: string;
|
|
55
|
-
category:
|
|
56
|
-
| 'RETRIEVAL'
|
|
57
|
-
| 'COMPUTATION'
|
|
58
|
-
| 'COMMUNICATION'
|
|
59
|
-
| 'INTEGRATION'
|
|
60
|
-
| 'UTILITY'
|
|
61
|
-
| 'CUSTOM';
|
|
62
|
-
status: 'DRAFT' | 'ACTIVE' | 'DEPRECATED' | 'DISABLED';
|
|
63
|
-
parametersSchema: Record<string, unknown>;
|
|
64
|
-
outputSchema?: Record<string, unknown>;
|
|
65
|
-
implementationType: 'http' | 'function' | 'workflow';
|
|
66
|
-
implementationConfig: Record<string, unknown>;
|
|
67
|
-
maxInvocationsPerMinute?: number;
|
|
68
|
-
timeoutMs: number;
|
|
69
|
-
version: string;
|
|
70
|
-
tags?: string[];
|
|
71
|
-
createdAt: Date;
|
|
72
|
-
updatedAt: Date;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Mock handler for ListToolsQuery
|
|
77
|
-
*/
|
|
78
|
-
export async function mockListToolsHandler(
|
|
79
|
-
input: ListToolsInput
|
|
80
|
-
): Promise<ListToolsOutput> {
|
|
81
|
-
const {
|
|
82
|
-
organizationId,
|
|
83
|
-
category,
|
|
84
|
-
status,
|
|
85
|
-
search,
|
|
86
|
-
limit = 20,
|
|
87
|
-
offset = 0,
|
|
88
|
-
} = input;
|
|
89
|
-
|
|
90
|
-
let filtered = MOCK_TOOLS.filter((t) => t.organizationId === organizationId);
|
|
91
|
-
|
|
92
|
-
if (category) {
|
|
93
|
-
filtered = filtered.filter((t) => t.category === category);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
if (status) {
|
|
97
|
-
filtered = filtered.filter((t) => t.status === status);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
if (search) {
|
|
101
|
-
const q = search.toLowerCase();
|
|
102
|
-
filtered = filtered.filter(
|
|
103
|
-
(t) =>
|
|
104
|
-
t.name.toLowerCase().includes(q) ||
|
|
105
|
-
t.description.toLowerCase().includes(q) ||
|
|
106
|
-
t.tags?.some((tag) => tag.toLowerCase().includes(q))
|
|
107
|
-
);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
const total = filtered.length;
|
|
111
|
-
const items = filtered.slice(offset, offset + limit).map((t) => ({
|
|
112
|
-
id: t.id,
|
|
113
|
-
name: t.name,
|
|
114
|
-
slug: t.slug,
|
|
115
|
-
description: t.description,
|
|
116
|
-
category: t.category,
|
|
117
|
-
status: t.status,
|
|
118
|
-
version: t.version,
|
|
119
|
-
createdAt: t.createdAt,
|
|
120
|
-
}));
|
|
121
|
-
|
|
122
|
-
return {
|
|
123
|
-
items,
|
|
124
|
-
total,
|
|
125
|
-
hasMore: offset + limit < total,
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Mock handler for GetToolQuery
|
|
131
|
-
*/
|
|
132
|
-
export async function mockGetToolHandler(input: GetToolInput): Promise<Tool> {
|
|
133
|
-
const tool = MOCK_TOOLS.find((t) => t.id === input.toolId);
|
|
134
|
-
|
|
135
|
-
if (!tool) {
|
|
136
|
-
throw new Error('TOOL_NOT_FOUND');
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
return tool;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Mock handler for CreateToolCommand
|
|
144
|
-
*/
|
|
145
|
-
export async function mockCreateToolHandler(input: {
|
|
146
|
-
organizationId: string;
|
|
147
|
-
name: string;
|
|
148
|
-
slug: string;
|
|
149
|
-
description: string;
|
|
150
|
-
parametersSchema: Record<string, unknown>;
|
|
151
|
-
implementationType: 'http' | 'function' | 'workflow';
|
|
152
|
-
implementationConfig: Record<string, unknown>;
|
|
153
|
-
}) {
|
|
154
|
-
// Simulate slug collision check
|
|
155
|
-
const exists = MOCK_TOOLS.some(
|
|
156
|
-
(t) => t.organizationId === input.organizationId && t.slug === input.slug
|
|
157
|
-
);
|
|
158
|
-
if (exists) {
|
|
159
|
-
throw new Error('SLUG_EXISTS');
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
return {
|
|
163
|
-
id: `tool-${Date.now()}`,
|
|
164
|
-
name: input.name,
|
|
165
|
-
slug: input.slug,
|
|
166
|
-
status: 'DRAFT' as const,
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* Mock handler for TestToolCommand
|
|
172
|
-
*/
|
|
173
|
-
export async function mockTestToolHandler(input: {
|
|
174
|
-
toolId: string;
|
|
175
|
-
testInput: Record<string, unknown>;
|
|
176
|
-
}) {
|
|
177
|
-
const tool = MOCK_TOOLS.find((t) => t.id === input.toolId);
|
|
178
|
-
if (!tool) {
|
|
179
|
-
throw new Error('TOOL_NOT_FOUND');
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
// Simulate tool execution
|
|
183
|
-
return {
|
|
184
|
-
success: true,
|
|
185
|
-
output: { result: 'Mock tool execution result' },
|
|
186
|
-
durationMs: Math.floor(Math.random() * 1000) + 100,
|
|
187
|
-
};
|
|
188
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Agent Console Dashboard Presentation Descriptor
|
|
3
|
-
*/
|
|
4
|
-
import type { PresentationDescriptorV2 } from '@lssm/lib.contracts';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Main dashboard presentation for the agent console.
|
|
8
|
-
* Combines agent stats, recent runs, and tool overview.
|
|
9
|
-
*/
|
|
10
|
-
export const AgentConsoleDashboardPresentation: PresentationDescriptorV2 = {
|
|
11
|
-
meta: {
|
|
12
|
-
name: 'agent-console.dashboard',
|
|
13
|
-
version: 1,
|
|
14
|
-
description:
|
|
15
|
-
'Main dashboard for AI agent operations with stats, recent activity, and quick actions',
|
|
16
|
-
domain: 'agent-console',
|
|
17
|
-
owners: ['agent-console-team'],
|
|
18
|
-
tags: ['dashboard', 'overview'],
|
|
19
|
-
},
|
|
20
|
-
source: {
|
|
21
|
-
type: 'component',
|
|
22
|
-
framework: 'react',
|
|
23
|
-
componentKey: 'AgentConsoleDashboard',
|
|
24
|
-
},
|
|
25
|
-
targets: ['react', 'markdown'],
|
|
26
|
-
policy: {
|
|
27
|
-
flags: ['agent-console.enabled'],
|
|
28
|
-
},
|
|
29
|
-
};
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Run List Presentation Descriptor
|
|
3
|
-
*/
|
|
4
|
-
import type { PresentationDescriptorV2 } from '@lssm/lib.contracts';
|
|
5
|
-
import { RunSummaryModel } from '../contracts/run';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Presentation for displaying a list of agent runs.
|
|
9
|
-
*/
|
|
10
|
-
export const RunListPresentation: PresentationDescriptorV2 = {
|
|
11
|
-
meta: {
|
|
12
|
-
name: 'agent-console.run.list',
|
|
13
|
-
version: 1,
|
|
14
|
-
description:
|
|
15
|
-
'List view of agent execution runs with status, tokens, duration, and cost',
|
|
16
|
-
domain: 'agent-console',
|
|
17
|
-
owners: ['agent-console-team'],
|
|
18
|
-
tags: ['run', 'list', 'history'],
|
|
19
|
-
},
|
|
20
|
-
source: {
|
|
21
|
-
type: 'component',
|
|
22
|
-
framework: 'react',
|
|
23
|
-
componentKey: 'RunListView',
|
|
24
|
-
props: RunSummaryModel,
|
|
25
|
-
},
|
|
26
|
-
targets: ['react', 'markdown', 'application/json'],
|
|
27
|
-
policy: {
|
|
28
|
-
flags: ['agent-console.enabled'],
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Presentation for run detail view with steps and logs.
|
|
34
|
-
*/
|
|
35
|
-
export const RunDetailPresentation: PresentationDescriptorV2 = {
|
|
36
|
-
meta: {
|
|
37
|
-
name: 'agent-console.run.detail',
|
|
38
|
-
version: 1,
|
|
39
|
-
description: 'Detailed view of a run with step-by-step execution and logs',
|
|
40
|
-
domain: 'agent-console',
|
|
41
|
-
owners: ['agent-console-team'],
|
|
42
|
-
tags: ['run', 'detail', 'debug'],
|
|
43
|
-
},
|
|
44
|
-
source: {
|
|
45
|
-
type: 'component',
|
|
46
|
-
framework: 'react',
|
|
47
|
-
componentKey: 'RunDetailView',
|
|
48
|
-
},
|
|
49
|
-
targets: ['react', 'markdown'],
|
|
50
|
-
policy: {
|
|
51
|
-
flags: ['agent-console.enabled'],
|
|
52
|
-
},
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Presentation for run metrics dashboard.
|
|
57
|
-
*/
|
|
58
|
-
export const RunMetricsPresentation: PresentationDescriptorV2 = {
|
|
59
|
-
meta: {
|
|
60
|
-
name: 'agent-console.run.metrics',
|
|
61
|
-
version: 1,
|
|
62
|
-
description: 'Metrics and analytics dashboard for agent runs',
|
|
63
|
-
domain: 'agent-console',
|
|
64
|
-
owners: ['agent-console-team'],
|
|
65
|
-
tags: ['run', 'metrics', 'analytics'],
|
|
66
|
-
},
|
|
67
|
-
source: {
|
|
68
|
-
type: 'component',
|
|
69
|
-
framework: 'react',
|
|
70
|
-
componentKey: 'RunMetricsView',
|
|
71
|
-
},
|
|
72
|
-
targets: ['react', 'markdown'],
|
|
73
|
-
policy: {
|
|
74
|
-
flags: ['agent-console.enabled'],
|
|
75
|
-
},
|
|
76
|
-
};
|
|
File without changes
|
|
File without changes
|