@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,331 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,188 @@
|
|
|
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
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Console Example
|
|
3
|
+
*
|
|
4
|
+
* A ContractSpec example demonstrating AI agent orchestration with tools, runs, and logs.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import {
|
|
9
|
+
* ToolEntity,
|
|
10
|
+
* AgentEntity,
|
|
11
|
+
* RunEntity,
|
|
12
|
+
* CreateToolCommand,
|
|
13
|
+
* ExecuteAgentCommand
|
|
14
|
+
* } from '@lssm/example.agent-console';
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
// Entity exports
|
|
19
|
+
export * from './entities';
|
|
20
|
+
|
|
21
|
+
// Contract exports
|
|
22
|
+
export * from './contracts';
|
|
23
|
+
|
|
24
|
+
// Event exports
|
|
25
|
+
export * from './events';
|
|
26
|
+
|
|
27
|
+
// Handler exports (for sandbox/demo use)
|
|
28
|
+
export * from './handlers';
|
|
29
|
+
|
|
30
|
+
// Presentation exports
|
|
31
|
+
export * from './presentations';
|
|
32
|
+
|
|
33
|
+
// Feature spec export
|
|
34
|
+
export * from './feature';
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent List Presentation Descriptor
|
|
3
|
+
*/
|
|
4
|
+
import type { PresentationDescriptorV2 } from '@lssm/lib.contracts';
|
|
5
|
+
import { AgentSummaryModel } from '../contracts/agent';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Presentation for displaying a list of AI agents.
|
|
9
|
+
* Supports both React (DataTable) and Markdown (list) rendering.
|
|
10
|
+
*/
|
|
11
|
+
export const AgentListPresentation: PresentationDescriptorV2 = {
|
|
12
|
+
meta: {
|
|
13
|
+
name: 'agent-console.agent.list',
|
|
14
|
+
version: 1,
|
|
15
|
+
description:
|
|
16
|
+
'List view of AI agents with status, model provider, and version info',
|
|
17
|
+
domain: 'agent-console',
|
|
18
|
+
owners: ['agent-console-team'],
|
|
19
|
+
tags: ['agent', 'list', 'dashboard'],
|
|
20
|
+
},
|
|
21
|
+
source: {
|
|
22
|
+
type: 'component',
|
|
23
|
+
framework: 'react',
|
|
24
|
+
componentKey: 'AgentListView',
|
|
25
|
+
props: AgentSummaryModel,
|
|
26
|
+
},
|
|
27
|
+
targets: ['react', 'markdown', 'application/json'],
|
|
28
|
+
policy: {
|
|
29
|
+
flags: ['agent-console.enabled'],
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Presentation for agent detail view.
|
|
35
|
+
*/
|
|
36
|
+
export const AgentDetailPresentation: PresentationDescriptorV2 = {
|
|
37
|
+
meta: {
|
|
38
|
+
name: 'agent-console.agent.detail',
|
|
39
|
+
version: 1,
|
|
40
|
+
description:
|
|
41
|
+
'Detailed view of an AI agent with configuration, tools, and recent runs',
|
|
42
|
+
domain: 'agent-console',
|
|
43
|
+
owners: ['agent-console-team'],
|
|
44
|
+
tags: ['agent', 'detail'],
|
|
45
|
+
},
|
|
46
|
+
source: {
|
|
47
|
+
type: 'component',
|
|
48
|
+
framework: 'react',
|
|
49
|
+
componentKey: 'AgentDetailView',
|
|
50
|
+
},
|
|
51
|
+
targets: ['react', 'markdown'],
|
|
52
|
+
policy: {
|
|
53
|
+
flags: ['agent-console.enabled'],
|
|
54
|
+
},
|
|
55
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Presentation descriptors for agent-console
|
|
3
|
+
*
|
|
4
|
+
* These define how data can be rendered across different targets (React, Markdown, JSON).
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
// Agent presentations
|
|
8
|
+
export { AgentListPresentation, AgentDetailPresentation } from './agent-list';
|
|
9
|
+
|
|
10
|
+
// Run presentations
|
|
11
|
+
export {
|
|
12
|
+
RunListPresentation,
|
|
13
|
+
RunDetailPresentation,
|
|
14
|
+
RunMetricsPresentation,
|
|
15
|
+
} from './run-list';
|
|
16
|
+
|
|
17
|
+
// Tool presentations
|
|
18
|
+
export {
|
|
19
|
+
ToolRegistryPresentation,
|
|
20
|
+
ToolDetailPresentation,
|
|
21
|
+
} from './tool-registry';
|
|
22
|
+
|
|
23
|
+
// Dashboard
|
|
24
|
+
export { AgentConsoleDashboardPresentation } from './dashboard';
|
|
25
|
+
|
|
26
|
+
// Re-export all presentations as an array for easy registration
|
|
27
|
+
import { AgentListPresentation, AgentDetailPresentation } from './agent-list';
|
|
28
|
+
import {
|
|
29
|
+
RunListPresentation,
|
|
30
|
+
RunDetailPresentation,
|
|
31
|
+
RunMetricsPresentation,
|
|
32
|
+
} from './run-list';
|
|
33
|
+
import {
|
|
34
|
+
ToolRegistryPresentation,
|
|
35
|
+
ToolDetailPresentation,
|
|
36
|
+
} from './tool-registry';
|
|
37
|
+
import { AgentConsoleDashboardPresentation } from './dashboard';
|
|
38
|
+
|
|
39
|
+
export const AgentConsolePresentations = [
|
|
40
|
+
AgentConsoleDashboardPresentation,
|
|
41
|
+
AgentListPresentation,
|
|
42
|
+
AgentDetailPresentation,
|
|
43
|
+
RunListPresentation,
|
|
44
|
+
RunDetailPresentation,
|
|
45
|
+
RunMetricsPresentation,
|
|
46
|
+
ToolRegistryPresentation,
|
|
47
|
+
ToolDetailPresentation,
|
|
48
|
+
];
|