@cogitator-ai/express 0.2.0
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/LICENSE +21 -0
- package/README.md +346 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/middleware/auth.d.ts +4 -0
- package/dist/middleware/auth.d.ts.map +1 -0
- package/dist/middleware/auth.js +26 -0
- package/dist/middleware/auth.js.map +1 -0
- package/dist/middleware/cors.d.ts +4 -0
- package/dist/middleware/cors.d.ts.map +1 -0
- package/dist/middleware/cors.js +42 -0
- package/dist/middleware/cors.js.map +1 -0
- package/dist/middleware/error-handler.d.ts +4 -0
- package/dist/middleware/error-handler.d.ts.map +1 -0
- package/dist/middleware/error-handler.js +32 -0
- package/dist/middleware/error-handler.js.map +1 -0
- package/dist/middleware/index.d.ts +5 -0
- package/dist/middleware/index.d.ts.map +1 -0
- package/dist/middleware/index.js +5 -0
- package/dist/middleware/index.js.map +1 -0
- package/dist/middleware/rate-limit.d.ts +4 -0
- package/dist/middleware/rate-limit.d.ts.map +1 -0
- package/dist/middleware/rate-limit.js +50 -0
- package/dist/middleware/rate-limit.js.map +1 -0
- package/dist/routes/agents.d.ts +4 -0
- package/dist/routes/agents.d.ts.map +1 -0
- package/dist/routes/agents.js +116 -0
- package/dist/routes/agents.js.map +1 -0
- package/dist/routes/health.d.ts +4 -0
- package/dist/routes/health.d.ts.map +1 -0
- package/dist/routes/health.js +18 -0
- package/dist/routes/health.js.map +1 -0
- package/dist/routes/index.d.ts +7 -0
- package/dist/routes/index.d.ts.map +1 -0
- package/dist/routes/index.js +7 -0
- package/dist/routes/index.js.map +1 -0
- package/dist/routes/swarms.d.ts +4 -0
- package/dist/routes/swarms.d.ts.map +1 -0
- package/dist/routes/swarms.js +179 -0
- package/dist/routes/swarms.js.map +1 -0
- package/dist/routes/threads.d.ts +4 -0
- package/dist/routes/threads.d.ts.map +1 -0
- package/dist/routes/threads.js +108 -0
- package/dist/routes/threads.js.map +1 -0
- package/dist/routes/tools.d.ts +4 -0
- package/dist/routes/tools.d.ts.map +1 -0
- package/dist/routes/tools.js +29 -0
- package/dist/routes/tools.js.map +1 -0
- package/dist/routes/workflows.d.ts +4 -0
- package/dist/routes/workflows.d.ts.map +1 -0
- package/dist/routes/workflows.js +110 -0
- package/dist/routes/workflows.js.map +1 -0
- package/dist/server.d.ts +15 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +90 -0
- package/dist/server.js.map +1 -0
- package/dist/streaming/express-stream-writer.d.ts +24 -0
- package/dist/streaming/express-stream-writer.d.ts.map +1 -0
- package/dist/streaming/express-stream-writer.js +73 -0
- package/dist/streaming/express-stream-writer.js.map +1 -0
- package/dist/streaming/helpers.d.ts +4 -0
- package/dist/streaming/helpers.d.ts.map +1 -0
- package/dist/streaming/helpers.js +14 -0
- package/dist/streaming/helpers.js.map +1 -0
- package/dist/streaming/index.d.ts +4 -0
- package/dist/streaming/index.d.ts.map +1 -0
- package/dist/streaming/index.js +4 -0
- package/dist/streaming/index.js.map +1 -0
- package/dist/streaming/protocol.d.ts +76 -0
- package/dist/streaming/protocol.d.ts.map +1 -0
- package/dist/streaming/protocol.js +37 -0
- package/dist/streaming/protocol.js.map +1 -0
- package/dist/swagger/generator.d.ts +3 -0
- package/dist/swagger/generator.d.ts.map +1 -0
- package/dist/swagger/generator.js +486 -0
- package/dist/swagger/generator.js.map +1 -0
- package/dist/swagger/index.d.ts +3 -0
- package/dist/swagger/index.d.ts.map +1 -0
- package/dist/swagger/index.js +3 -0
- package/dist/swagger/index.js.map +1 -0
- package/dist/swagger/ui.d.ts +4 -0
- package/dist/swagger/ui.d.ts.map +1 -0
- package/dist/swagger/ui.js +39 -0
- package/dist/swagger/ui.js.map +1 -0
- package/dist/types.d.ts +246 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/websocket/index.d.ts +2 -0
- package/dist/websocket/index.d.ts.map +1 -0
- package/dist/websocket/index.js +2 -0
- package/dist/websocket/index.js.map +1 -0
- package/dist/websocket/ws-handler.d.ts +6 -0
- package/dist/websocket/ws-handler.d.ts.map +1 -0
- package/dist/websocket/ws-handler.js +145 -0
- package/dist/websocket/ws-handler.js.map +1 -0
- package/package.json +62 -0
|
@@ -0,0 +1,486 @@
|
|
|
1
|
+
export function generateOpenAPISpec(ctx, config) {
|
|
2
|
+
const spec = {
|
|
3
|
+
openapi: '3.0.3',
|
|
4
|
+
info: {
|
|
5
|
+
title: config.title || 'Cogitator API',
|
|
6
|
+
description: config.description || 'AI Agent Runtime API',
|
|
7
|
+
version: config.version || '1.0.0',
|
|
8
|
+
contact: config.contact,
|
|
9
|
+
license: config.license,
|
|
10
|
+
},
|
|
11
|
+
servers: config.servers || [{ url: ctx.config.basePath, description: 'Default server' }],
|
|
12
|
+
tags: [
|
|
13
|
+
{ name: 'health', description: 'Health check endpoints' },
|
|
14
|
+
{ name: 'agents', description: 'Agent execution endpoints' },
|
|
15
|
+
{ name: 'threads', description: 'Thread/conversation management' },
|
|
16
|
+
{ name: 'tools', description: 'Tool discovery' },
|
|
17
|
+
{ name: 'workflows', description: 'Workflow execution' },
|
|
18
|
+
{ name: 'swarms', description: 'Multi-agent swarm execution' },
|
|
19
|
+
],
|
|
20
|
+
paths: {},
|
|
21
|
+
components: {
|
|
22
|
+
schemas: generateSchemas(),
|
|
23
|
+
securitySchemes: {
|
|
24
|
+
bearerAuth: {
|
|
25
|
+
type: 'http',
|
|
26
|
+
scheme: 'bearer',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
spec.paths['/health'] = {
|
|
32
|
+
get: {
|
|
33
|
+
tags: ['health'],
|
|
34
|
+
summary: 'Health check',
|
|
35
|
+
responses: {
|
|
36
|
+
200: {
|
|
37
|
+
description: 'Service is healthy',
|
|
38
|
+
content: {
|
|
39
|
+
'application/json': {
|
|
40
|
+
schema: { $ref: '#/components/schemas/HealthResponse' },
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
spec.paths['/ready'] = {
|
|
48
|
+
get: {
|
|
49
|
+
tags: ['health'],
|
|
50
|
+
summary: 'Readiness check',
|
|
51
|
+
responses: {
|
|
52
|
+
200: { description: 'Service is ready' },
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
spec.paths['/agents'] = {
|
|
57
|
+
get: {
|
|
58
|
+
tags: ['agents'],
|
|
59
|
+
summary: 'List all agents',
|
|
60
|
+
responses: {
|
|
61
|
+
200: {
|
|
62
|
+
description: 'List of agents',
|
|
63
|
+
content: {
|
|
64
|
+
'application/json': {
|
|
65
|
+
schema: { $ref: '#/components/schemas/AgentListResponse' },
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
for (const [name] of Object.entries(ctx.agents)) {
|
|
73
|
+
spec.paths[`/agents/${name}/run`] = {
|
|
74
|
+
post: {
|
|
75
|
+
tags: ['agents'],
|
|
76
|
+
summary: `Run agent: ${name}`,
|
|
77
|
+
requestBody: {
|
|
78
|
+
required: true,
|
|
79
|
+
content: {
|
|
80
|
+
'application/json': {
|
|
81
|
+
schema: { $ref: '#/components/schemas/AgentRunRequest' },
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
responses: {
|
|
86
|
+
200: {
|
|
87
|
+
description: 'Agent execution result',
|
|
88
|
+
content: {
|
|
89
|
+
'application/json': {
|
|
90
|
+
schema: { $ref: '#/components/schemas/AgentRunResponse' },
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
404: { description: 'Agent not found' },
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
spec.paths[`/agents/${name}/stream`] = {
|
|
99
|
+
post: {
|
|
100
|
+
tags: ['agents'],
|
|
101
|
+
summary: `Stream agent: ${name}`,
|
|
102
|
+
requestBody: {
|
|
103
|
+
required: true,
|
|
104
|
+
content: {
|
|
105
|
+
'application/json': {
|
|
106
|
+
schema: { $ref: '#/components/schemas/AgentRunRequest' },
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
responses: {
|
|
111
|
+
200: {
|
|
112
|
+
description: 'SSE stream',
|
|
113
|
+
content: { 'text/event-stream': {} },
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
spec.paths['/threads/{id}'] = {
|
|
120
|
+
get: {
|
|
121
|
+
tags: ['threads'],
|
|
122
|
+
summary: 'Get thread by ID',
|
|
123
|
+
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
|
124
|
+
responses: {
|
|
125
|
+
200: {
|
|
126
|
+
description: 'Thread data',
|
|
127
|
+
content: {
|
|
128
|
+
'application/json': {
|
|
129
|
+
schema: { $ref: '#/components/schemas/ThreadResponse' },
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
503: { description: 'Memory not configured' },
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
delete: {
|
|
137
|
+
tags: ['threads'],
|
|
138
|
+
summary: 'Delete thread',
|
|
139
|
+
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
|
140
|
+
responses: {
|
|
141
|
+
204: { description: 'Thread deleted' },
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
spec.paths['/threads/{id}/messages'] = {
|
|
146
|
+
post: {
|
|
147
|
+
tags: ['threads'],
|
|
148
|
+
summary: 'Add message to thread',
|
|
149
|
+
parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
|
|
150
|
+
requestBody: {
|
|
151
|
+
required: true,
|
|
152
|
+
content: {
|
|
153
|
+
'application/json': {
|
|
154
|
+
schema: { $ref: '#/components/schemas/AddMessageRequest' },
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
responses: {
|
|
159
|
+
201: { description: 'Message added' },
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
};
|
|
163
|
+
spec.paths['/tools'] = {
|
|
164
|
+
get: {
|
|
165
|
+
tags: ['tools'],
|
|
166
|
+
summary: 'List all tools',
|
|
167
|
+
responses: {
|
|
168
|
+
200: {
|
|
169
|
+
description: 'List of tools',
|
|
170
|
+
content: {
|
|
171
|
+
'application/json': {
|
|
172
|
+
schema: { $ref: '#/components/schemas/ToolListResponse' },
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
};
|
|
179
|
+
spec.paths['/workflows'] = {
|
|
180
|
+
get: {
|
|
181
|
+
tags: ['workflows'],
|
|
182
|
+
summary: 'List all workflows',
|
|
183
|
+
responses: {
|
|
184
|
+
200: {
|
|
185
|
+
description: 'List of workflows',
|
|
186
|
+
content: {
|
|
187
|
+
'application/json': {
|
|
188
|
+
schema: { $ref: '#/components/schemas/WorkflowListResponse' },
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
};
|
|
195
|
+
for (const [name] of Object.entries(ctx.workflows)) {
|
|
196
|
+
spec.paths[`/workflows/${name}/run`] = {
|
|
197
|
+
post: {
|
|
198
|
+
tags: ['workflows'],
|
|
199
|
+
summary: `Run workflow: ${name}`,
|
|
200
|
+
requestBody: {
|
|
201
|
+
content: {
|
|
202
|
+
'application/json': {
|
|
203
|
+
schema: { $ref: '#/components/schemas/WorkflowRunRequest' },
|
|
204
|
+
},
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
responses: {
|
|
208
|
+
200: {
|
|
209
|
+
description: 'Workflow result',
|
|
210
|
+
content: {
|
|
211
|
+
'application/json': {
|
|
212
|
+
schema: { $ref: '#/components/schemas/WorkflowRunResponse' },
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
};
|
|
219
|
+
spec.paths[`/workflows/${name}/stream`] = {
|
|
220
|
+
post: {
|
|
221
|
+
tags: ['workflows'],
|
|
222
|
+
summary: `Stream workflow: ${name}`,
|
|
223
|
+
responses: {
|
|
224
|
+
200: {
|
|
225
|
+
description: 'SSE stream',
|
|
226
|
+
content: { 'text/event-stream': {} },
|
|
227
|
+
},
|
|
228
|
+
},
|
|
229
|
+
},
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
spec.paths['/swarms'] = {
|
|
233
|
+
get: {
|
|
234
|
+
tags: ['swarms'],
|
|
235
|
+
summary: 'List all swarms',
|
|
236
|
+
responses: {
|
|
237
|
+
200: {
|
|
238
|
+
description: 'List of swarms',
|
|
239
|
+
content: {
|
|
240
|
+
'application/json': {
|
|
241
|
+
schema: { $ref: '#/components/schemas/SwarmListResponse' },
|
|
242
|
+
},
|
|
243
|
+
},
|
|
244
|
+
},
|
|
245
|
+
},
|
|
246
|
+
},
|
|
247
|
+
};
|
|
248
|
+
for (const [name] of Object.entries(ctx.swarms)) {
|
|
249
|
+
spec.paths[`/swarms/${name}/run`] = {
|
|
250
|
+
post: {
|
|
251
|
+
tags: ['swarms'],
|
|
252
|
+
summary: `Run swarm: ${name}`,
|
|
253
|
+
requestBody: {
|
|
254
|
+
required: true,
|
|
255
|
+
content: {
|
|
256
|
+
'application/json': {
|
|
257
|
+
schema: { $ref: '#/components/schemas/SwarmRunRequest' },
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
},
|
|
261
|
+
responses: {
|
|
262
|
+
200: {
|
|
263
|
+
description: 'Swarm result',
|
|
264
|
+
content: {
|
|
265
|
+
'application/json': {
|
|
266
|
+
schema: { $ref: '#/components/schemas/SwarmRunResponse' },
|
|
267
|
+
},
|
|
268
|
+
},
|
|
269
|
+
},
|
|
270
|
+
},
|
|
271
|
+
},
|
|
272
|
+
};
|
|
273
|
+
spec.paths[`/swarms/${name}/stream`] = {
|
|
274
|
+
post: {
|
|
275
|
+
tags: ['swarms'],
|
|
276
|
+
summary: `Stream swarm: ${name}`,
|
|
277
|
+
responses: {
|
|
278
|
+
200: {
|
|
279
|
+
description: 'SSE stream',
|
|
280
|
+
content: { 'text/event-stream': {} },
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
},
|
|
284
|
+
};
|
|
285
|
+
spec.paths[`/swarms/${name}/blackboard`] = {
|
|
286
|
+
get: {
|
|
287
|
+
tags: ['swarms'],
|
|
288
|
+
summary: `Get blackboard: ${name}`,
|
|
289
|
+
responses: {
|
|
290
|
+
200: {
|
|
291
|
+
description: 'Blackboard state',
|
|
292
|
+
content: {
|
|
293
|
+
'application/json': {
|
|
294
|
+
schema: { $ref: '#/components/schemas/BlackboardResponse' },
|
|
295
|
+
},
|
|
296
|
+
},
|
|
297
|
+
},
|
|
298
|
+
},
|
|
299
|
+
},
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
return spec;
|
|
303
|
+
}
|
|
304
|
+
function generateSchemas() {
|
|
305
|
+
return {
|
|
306
|
+
HealthResponse: {
|
|
307
|
+
type: 'object',
|
|
308
|
+
properties: {
|
|
309
|
+
status: { type: 'string', enum: ['ok', 'degraded', 'error'] },
|
|
310
|
+
uptime: { type: 'number' },
|
|
311
|
+
timestamp: { type: 'number' },
|
|
312
|
+
},
|
|
313
|
+
},
|
|
314
|
+
AgentListResponse: {
|
|
315
|
+
type: 'object',
|
|
316
|
+
properties: {
|
|
317
|
+
agents: {
|
|
318
|
+
type: 'array',
|
|
319
|
+
items: {
|
|
320
|
+
type: 'object',
|
|
321
|
+
properties: {
|
|
322
|
+
name: { type: 'string' },
|
|
323
|
+
description: { type: 'string' },
|
|
324
|
+
tools: { type: 'array', items: { type: 'string' } },
|
|
325
|
+
},
|
|
326
|
+
},
|
|
327
|
+
},
|
|
328
|
+
},
|
|
329
|
+
},
|
|
330
|
+
AgentRunRequest: {
|
|
331
|
+
type: 'object',
|
|
332
|
+
required: ['input'],
|
|
333
|
+
properties: {
|
|
334
|
+
input: { type: 'string' },
|
|
335
|
+
context: { type: 'object' },
|
|
336
|
+
threadId: { type: 'string' },
|
|
337
|
+
},
|
|
338
|
+
},
|
|
339
|
+
AgentRunResponse: {
|
|
340
|
+
type: 'object',
|
|
341
|
+
properties: {
|
|
342
|
+
output: { type: 'string' },
|
|
343
|
+
threadId: { type: 'string' },
|
|
344
|
+
usage: {
|
|
345
|
+
type: 'object',
|
|
346
|
+
properties: {
|
|
347
|
+
inputTokens: { type: 'number' },
|
|
348
|
+
outputTokens: { type: 'number' },
|
|
349
|
+
totalTokens: { type: 'number' },
|
|
350
|
+
},
|
|
351
|
+
},
|
|
352
|
+
toolCalls: { type: 'array' },
|
|
353
|
+
},
|
|
354
|
+
},
|
|
355
|
+
ThreadResponse: {
|
|
356
|
+
type: 'object',
|
|
357
|
+
properties: {
|
|
358
|
+
id: { type: 'string' },
|
|
359
|
+
messages: { type: 'array' },
|
|
360
|
+
createdAt: { type: 'number' },
|
|
361
|
+
updatedAt: { type: 'number' },
|
|
362
|
+
},
|
|
363
|
+
},
|
|
364
|
+
AddMessageRequest: {
|
|
365
|
+
type: 'object',
|
|
366
|
+
required: ['role', 'content'],
|
|
367
|
+
properties: {
|
|
368
|
+
role: { type: 'string', enum: ['user', 'assistant', 'system'] },
|
|
369
|
+
content: { type: 'string' },
|
|
370
|
+
metadata: { type: 'object' },
|
|
371
|
+
},
|
|
372
|
+
},
|
|
373
|
+
ToolListResponse: {
|
|
374
|
+
type: 'object',
|
|
375
|
+
properties: {
|
|
376
|
+
tools: {
|
|
377
|
+
type: 'array',
|
|
378
|
+
items: {
|
|
379
|
+
type: 'object',
|
|
380
|
+
properties: {
|
|
381
|
+
name: { type: 'string' },
|
|
382
|
+
description: { type: 'string' },
|
|
383
|
+
parameters: { type: 'object' },
|
|
384
|
+
},
|
|
385
|
+
},
|
|
386
|
+
},
|
|
387
|
+
},
|
|
388
|
+
},
|
|
389
|
+
WorkflowListResponse: {
|
|
390
|
+
type: 'object',
|
|
391
|
+
properties: {
|
|
392
|
+
workflows: {
|
|
393
|
+
type: 'array',
|
|
394
|
+
items: {
|
|
395
|
+
type: 'object',
|
|
396
|
+
properties: {
|
|
397
|
+
name: { type: 'string' },
|
|
398
|
+
entryPoint: { type: 'string' },
|
|
399
|
+
nodes: { type: 'array', items: { type: 'string' } },
|
|
400
|
+
},
|
|
401
|
+
},
|
|
402
|
+
},
|
|
403
|
+
},
|
|
404
|
+
},
|
|
405
|
+
WorkflowRunRequest: {
|
|
406
|
+
type: 'object',
|
|
407
|
+
properties: {
|
|
408
|
+
input: { type: 'object' },
|
|
409
|
+
options: { type: 'object' },
|
|
410
|
+
},
|
|
411
|
+
},
|
|
412
|
+
WorkflowRunResponse: {
|
|
413
|
+
type: 'object',
|
|
414
|
+
properties: {
|
|
415
|
+
workflowId: { type: 'string' },
|
|
416
|
+
workflowName: { type: 'string' },
|
|
417
|
+
state: { type: 'object' },
|
|
418
|
+
duration: { type: 'number' },
|
|
419
|
+
nodeResults: { type: 'object' },
|
|
420
|
+
},
|
|
421
|
+
},
|
|
422
|
+
SwarmListResponse: {
|
|
423
|
+
type: 'object',
|
|
424
|
+
properties: {
|
|
425
|
+
swarms: {
|
|
426
|
+
type: 'array',
|
|
427
|
+
items: {
|
|
428
|
+
type: 'object',
|
|
429
|
+
properties: {
|
|
430
|
+
name: { type: 'string' },
|
|
431
|
+
strategy: { type: 'string' },
|
|
432
|
+
agents: { type: 'array', items: { type: 'string' } },
|
|
433
|
+
},
|
|
434
|
+
},
|
|
435
|
+
},
|
|
436
|
+
},
|
|
437
|
+
},
|
|
438
|
+
SwarmRunRequest: {
|
|
439
|
+
type: 'object',
|
|
440
|
+
required: ['input'],
|
|
441
|
+
properties: {
|
|
442
|
+
input: { type: 'string' },
|
|
443
|
+
context: { type: 'object' },
|
|
444
|
+
threadId: { type: 'string' },
|
|
445
|
+
timeout: { type: 'number' },
|
|
446
|
+
},
|
|
447
|
+
},
|
|
448
|
+
SwarmRunResponse: {
|
|
449
|
+
type: 'object',
|
|
450
|
+
properties: {
|
|
451
|
+
swarmId: { type: 'string' },
|
|
452
|
+
swarmName: { type: 'string' },
|
|
453
|
+
strategy: { type: 'string' },
|
|
454
|
+
output: {},
|
|
455
|
+
agentResults: { type: 'object' },
|
|
456
|
+
usage: {
|
|
457
|
+
type: 'object',
|
|
458
|
+
properties: {
|
|
459
|
+
totalTokens: { type: 'number' },
|
|
460
|
+
totalCost: { type: 'number' },
|
|
461
|
+
elapsedTime: { type: 'number' },
|
|
462
|
+
},
|
|
463
|
+
},
|
|
464
|
+
},
|
|
465
|
+
},
|
|
466
|
+
BlackboardResponse: {
|
|
467
|
+
type: 'object',
|
|
468
|
+
properties: {
|
|
469
|
+
sections: { type: 'object' },
|
|
470
|
+
},
|
|
471
|
+
},
|
|
472
|
+
ErrorResponse: {
|
|
473
|
+
type: 'object',
|
|
474
|
+
properties: {
|
|
475
|
+
error: {
|
|
476
|
+
type: 'object',
|
|
477
|
+
properties: {
|
|
478
|
+
message: { type: 'string' },
|
|
479
|
+
code: { type: 'string' },
|
|
480
|
+
},
|
|
481
|
+
},
|
|
482
|
+
},
|
|
483
|
+
},
|
|
484
|
+
};
|
|
485
|
+
}
|
|
486
|
+
//# sourceMappingURL=generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../src/swagger/generator.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,mBAAmB,CAAC,GAAiB,EAAE,MAAqB;IAC1E,MAAM,IAAI,GAAgB;QACxB,OAAO,EAAE,OAAO;QAChB,IAAI,EAAE;YACJ,KAAK,EAAE,MAAM,CAAC,KAAK,IA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F,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/swagger/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/swagger/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../src/swagger/ui.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,wBAAgB,cAAc,CAAC,IAAI,EAAE,WAAW,IACtC,MAAM,OAAO,EAAE,KAAK,QAAQ,UAqCrC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export function serveSwaggerUI(spec) {
|
|
2
|
+
return (_req, res) => {
|
|
3
|
+
const html = `
|
|
4
|
+
<!DOCTYPE html>
|
|
5
|
+
<html lang="en">
|
|
6
|
+
<head>
|
|
7
|
+
<meta charset="UTF-8">
|
|
8
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
9
|
+
<title>${spec.info.title} - API Documentation</title>
|
|
10
|
+
<link rel="stylesheet" href="https://unpkg.com/swagger-ui-dist@5.9.0/swagger-ui.css">
|
|
11
|
+
<style>
|
|
12
|
+
body { margin: 0; padding: 0; }
|
|
13
|
+
.swagger-ui .topbar { display: none; }
|
|
14
|
+
</style>
|
|
15
|
+
</head>
|
|
16
|
+
<body>
|
|
17
|
+
<div id="swagger-ui"></div>
|
|
18
|
+
<script src="https://unpkg.com/swagger-ui-dist@5.9.0/swagger-ui-bundle.js"></script>
|
|
19
|
+
<script>
|
|
20
|
+
window.onload = () => {
|
|
21
|
+
SwaggerUIBundle({
|
|
22
|
+
spec: ${JSON.stringify(spec)},
|
|
23
|
+
dom_id: '#swagger-ui',
|
|
24
|
+
deepLinking: true,
|
|
25
|
+
presets: [
|
|
26
|
+
SwaggerUIBundle.presets.apis,
|
|
27
|
+
SwaggerUIBundle.SwaggerUIStandalonePreset
|
|
28
|
+
],
|
|
29
|
+
layout: "BaseLayout"
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
</script>
|
|
33
|
+
</body>
|
|
34
|
+
</html>`;
|
|
35
|
+
res.setHeader('Content-Type', 'text/html');
|
|
36
|
+
res.send(html);
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=ui.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui.js","sourceRoot":"","sources":["../../src/swagger/ui.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,cAAc,CAAC,IAAiB;IAC9C,OAAO,CAAC,IAAa,EAAE,GAAa,EAAE,EAAE;QACtC,MAAM,IAAI,GAAG;;;;;;WAMN,IAAI,CAAC,IAAI,CAAC,KAAK;;;;;;;;;;;;;gBAaV,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;;;;;;;;;;;;QAY5B,CAAC;QAEL,GAAG,CAAC,SAAS,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;QAC3C,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjB,CAAC,CAAC;AACJ,CAAC"}
|