@runflow-ai/sdk 1.0.2 → 1.0.3
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/README.md +0 -1
- package/dist/agents/server.d.ts +2 -0
- package/dist/agents/server.d.ts.map +1 -1
- package/dist/agents/server.js +11 -0
- package/dist/agents/server.js.map +1 -1
- package/dist/agents/swagger.d.ts +678 -0
- package/dist/agents/swagger.d.ts.map +1 -0
- package/dist/agents/swagger.js +338 -0
- package/dist/agents/swagger.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -890,4 +890,3 @@ Contribuições são bem-vindas! Por favor, abra uma issue ou pull request no re
|
|
|
890
890
|
## 📞 Suporte
|
|
891
891
|
|
|
892
892
|
Para suporte técnico, entre em contato através dos canais oficiais da Runflow ou consulte a documentação completa da plataforma.
|
|
893
|
-
>>>>>>> 6435d75437a22d2d974b5406d5c881d3d016d76d
|
package/dist/agents/server.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import express from 'express';
|
|
2
2
|
import { RunflowAgentConfig } from './runflow-agent';
|
|
3
3
|
import { AgentInput } from '../types';
|
|
4
|
+
import { SwaggerConfig } from './swagger';
|
|
4
5
|
export interface AgentServerConfig extends RunflowAgentConfig {
|
|
5
6
|
port?: number;
|
|
6
7
|
cors?: boolean;
|
|
@@ -13,6 +14,7 @@ export interface AgentServerOptions {
|
|
|
13
14
|
rateLimiting?: boolean;
|
|
14
15
|
healthEndpoint?: boolean;
|
|
15
16
|
middleware?: express.RequestHandler[];
|
|
17
|
+
swagger?: boolean | SwaggerConfig;
|
|
16
18
|
hooks?: {
|
|
17
19
|
beforeChat?: (req: express.Request, res: express.Response) => Promise<void> | void;
|
|
18
20
|
transformInput?: (raw: any) => AgentInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/agents/server.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAgB,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/agents/server.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAgB,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAgB,aAAa,EAAE,MAAM,WAAW,CAAC;AAIxD,MAAM,WAAW,iBAAkB,SAAQ,kBAAkB;IAC3D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,UAAU,CAAC,EAAE,OAAO,CAAC,cAAc,EAAE,CAAC;CACvC;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,UAAU,CAAC,EAAE,OAAO,CAAC,cAAc,EAAE,CAAC;IAEtC,OAAO,CAAC,EAAE,OAAO,GAAG,aAAa,CAAC;IAElC,KAAK,CAAC,EAAE;QACN,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;QACnF,cAAc,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,UAAU,CAAC;QAC1C,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE;YAAE,GAAG,EAAE,OAAO,CAAC,OAAO,CAAC;YAAC,GAAG,EAAE,OAAO,CAAC,QAAQ,CAAC;YAAC,SAAS,EAAE,MAAM,CAAC;YAAC,UAAU,EAAE,MAAM,CAAA;SAAE,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;QAClK,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE;YAAE,GAAG,EAAE,OAAO,CAAC,OAAO,CAAC;YAAC,GAAG,EAAE,OAAO,CAAC,QAAQ,CAAC;YAAC,SAAS,EAAE,MAAM,CAAC;YAAC,UAAU,EAAE,MAAM,CAAA;SAAE,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;KAC3K,CAAC;IAGF,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC/B;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,kBAAkB,EAC1B,OAAO,GAAE,kBAAuB;;iBAmNjB,MAAM;EAetB;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,UAAU,CAAC,EAAE,MAAM,QAsE7C"}
|
package/dist/agents/server.js
CHANGED
|
@@ -40,6 +40,7 @@ exports.createAgentServer = createAgentServer;
|
|
|
40
40
|
exports.startAgent = startAgent;
|
|
41
41
|
const express_1 = __importDefault(require("express"));
|
|
42
42
|
const runflow_agent_1 = require("./runflow-agent");
|
|
43
|
+
const swagger_1 = require("./swagger");
|
|
43
44
|
const fs = __importStar(require("fs"));
|
|
44
45
|
const path = __importStar(require("path"));
|
|
45
46
|
/**
|
|
@@ -229,6 +230,12 @@ function createAgentServer(config, options = {}) {
|
|
|
229
230
|
sessionEnabled: config.session?.enabled || false
|
|
230
231
|
});
|
|
231
232
|
});
|
|
233
|
+
// Swagger/OpenAPI Documentation
|
|
234
|
+
if (options.swagger !== false) {
|
|
235
|
+
const swaggerConfig = typeof options.swagger === 'object' ? options.swagger : {};
|
|
236
|
+
const serverPort = options.port || process.env.PORT || 3000;
|
|
237
|
+
(0, swagger_1.setupSwagger)(app, Number(serverPort), swaggerConfig);
|
|
238
|
+
}
|
|
232
239
|
return {
|
|
233
240
|
app,
|
|
234
241
|
start(port) {
|
|
@@ -238,6 +245,10 @@ function createAgentServer(config, options = {}) {
|
|
|
238
245
|
console.log(`📡 Chat endpoint: http://localhost:${serverPort}/chat`);
|
|
239
246
|
console.log(`❤️ Health check: http://localhost:${serverPort}/health`);
|
|
240
247
|
console.log(`ℹ️ Agent info: http://localhost:${serverPort}/agent-info`);
|
|
248
|
+
if (options.swagger !== false) {
|
|
249
|
+
console.log(`📚 API Documentation: http://localhost:${serverPort}/docs`);
|
|
250
|
+
console.log(`📄 OpenAPI Spec: http://localhost:${serverPort}/api-docs.json`);
|
|
251
|
+
}
|
|
241
252
|
});
|
|
242
253
|
}
|
|
243
254
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/agents/server.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/agents/server.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,8CAoOC;AAKD,gCAsEC;AApVD,sDAA8B;AAC9B,mDAAmE;AAEnE,uCAAwD;AACxD,uCAAyB;AACzB,2CAA6B;AA6B7B;;GAEG;AACH,SAAgB,iBAAiB,CAC/B,MAA0B,EAC1B,UAA8B,EAAE;IAEhC,MAAM,KAAK,GAAG,IAAI,4BAAY,CAAC,MAAM,CAAC,CAAC;IACvC,MAAM,GAAG,GAAG,IAAA,iBAAO,GAAE,CAAC;IAEtB,oBAAoB;IACpB,GAAG,CAAC,GAAG,CAAC,iBAAO,CAAC,IAAI,CAAC,E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C,CAAC;oBACpE,CAAC;gBACH,CAAC;YACH,CAAC;YAED,IAAI,CAAC,WAAW,EAAE,CAAC;gBACjB,MAAM,IAAI,KAAK,CAAC;;;;;;;;;;;;;;;;;;SAkBf,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;QACzD,CAAC;QAED,8BAA8B;QAC9B,MAAM,MAAM,GAAG,iBAAiB,CAAC,MAAM,EAAE;YACvC,IAAI,EAAE,IAAI;YACV,YAAY,EAAE,IAAI;YAClB,cAAc,EAAE,IAAI;SACrB,CAAC,CAAC;QAEH,MAAM,CAAC,KAAK,EAAE,CAAC;IAEjB,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,CAAC,KAAK,CAAC,2BAA2B,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QAC1D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,678 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
export interface SwaggerConfig {
|
|
3
|
+
title?: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
version?: string;
|
|
6
|
+
contact?: {
|
|
7
|
+
name?: string;
|
|
8
|
+
email?: string;
|
|
9
|
+
url?: string;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Gera especificação OpenAPI para o agente
|
|
14
|
+
*/
|
|
15
|
+
export declare function generateSwaggerSpec(port: number, config?: SwaggerConfig): {
|
|
16
|
+
openapi: string;
|
|
17
|
+
info: {
|
|
18
|
+
title: string;
|
|
19
|
+
description: string;
|
|
20
|
+
version: string;
|
|
21
|
+
contact: {
|
|
22
|
+
name?: string;
|
|
23
|
+
email?: string;
|
|
24
|
+
url?: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
servers: {
|
|
28
|
+
url: string;
|
|
29
|
+
description: string;
|
|
30
|
+
}[];
|
|
31
|
+
paths: {
|
|
32
|
+
'/chat': {
|
|
33
|
+
post: {
|
|
34
|
+
summary: string;
|
|
35
|
+
description: string;
|
|
36
|
+
tags: string[];
|
|
37
|
+
requestBody: {
|
|
38
|
+
required: boolean;
|
|
39
|
+
content: {
|
|
40
|
+
'application/json': {
|
|
41
|
+
schema: {
|
|
42
|
+
type: string;
|
|
43
|
+
required: string[];
|
|
44
|
+
properties: {
|
|
45
|
+
message: {
|
|
46
|
+
type: string;
|
|
47
|
+
description: string;
|
|
48
|
+
example: string;
|
|
49
|
+
};
|
|
50
|
+
companyId: {
|
|
51
|
+
type: string;
|
|
52
|
+
description: string;
|
|
53
|
+
example: string;
|
|
54
|
+
};
|
|
55
|
+
userId: {
|
|
56
|
+
type: string;
|
|
57
|
+
description: string;
|
|
58
|
+
example: string;
|
|
59
|
+
};
|
|
60
|
+
sessionId: {
|
|
61
|
+
type: string;
|
|
62
|
+
description: string;
|
|
63
|
+
example: string;
|
|
64
|
+
};
|
|
65
|
+
channel: {
|
|
66
|
+
type: string;
|
|
67
|
+
description: string;
|
|
68
|
+
example: string;
|
|
69
|
+
};
|
|
70
|
+
metadata: {
|
|
71
|
+
type: string;
|
|
72
|
+
description: string;
|
|
73
|
+
example: {
|
|
74
|
+
source: string;
|
|
75
|
+
page: string;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
responses: {
|
|
84
|
+
200: {
|
|
85
|
+
description: string;
|
|
86
|
+
content: {
|
|
87
|
+
'application/json': {
|
|
88
|
+
schema: {
|
|
89
|
+
type: string;
|
|
90
|
+
properties: {
|
|
91
|
+
success: {
|
|
92
|
+
type: string;
|
|
93
|
+
example: boolean;
|
|
94
|
+
};
|
|
95
|
+
data: {
|
|
96
|
+
type: string;
|
|
97
|
+
properties: {
|
|
98
|
+
message: {
|
|
99
|
+
type: string;
|
|
100
|
+
description: string;
|
|
101
|
+
example: string;
|
|
102
|
+
};
|
|
103
|
+
metadata: {
|
|
104
|
+
type: string;
|
|
105
|
+
description: string;
|
|
106
|
+
properties: {
|
|
107
|
+
llmProvider: {
|
|
108
|
+
type: string;
|
|
109
|
+
example: string;
|
|
110
|
+
};
|
|
111
|
+
model: {
|
|
112
|
+
type: string;
|
|
113
|
+
example: string;
|
|
114
|
+
};
|
|
115
|
+
toolsUsed: {
|
|
116
|
+
type: string;
|
|
117
|
+
items: {
|
|
118
|
+
type: string;
|
|
119
|
+
};
|
|
120
|
+
example: string[];
|
|
121
|
+
};
|
|
122
|
+
processingTime: {
|
|
123
|
+
type: string;
|
|
124
|
+
example: number;
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
400: {
|
|
136
|
+
description: string;
|
|
137
|
+
content: {
|
|
138
|
+
'application/json': {
|
|
139
|
+
schema: {
|
|
140
|
+
type: string;
|
|
141
|
+
properties: {
|
|
142
|
+
success: {
|
|
143
|
+
type: string;
|
|
144
|
+
example: boolean;
|
|
145
|
+
};
|
|
146
|
+
error: {
|
|
147
|
+
type: string;
|
|
148
|
+
example: string;
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
429: {
|
|
156
|
+
description: string;
|
|
157
|
+
content: {
|
|
158
|
+
'application/json': {
|
|
159
|
+
schema: {
|
|
160
|
+
type: string;
|
|
161
|
+
properties: {
|
|
162
|
+
success: {
|
|
163
|
+
type: string;
|
|
164
|
+
example: boolean;
|
|
165
|
+
};
|
|
166
|
+
error: {
|
|
167
|
+
type: string;
|
|
168
|
+
example: string;
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
};
|
|
175
|
+
500: {
|
|
176
|
+
description: string;
|
|
177
|
+
content: {
|
|
178
|
+
'application/json': {
|
|
179
|
+
schema: {
|
|
180
|
+
type: string;
|
|
181
|
+
properties: {
|
|
182
|
+
success: {
|
|
183
|
+
type: string;
|
|
184
|
+
example: boolean;
|
|
185
|
+
};
|
|
186
|
+
error: {
|
|
187
|
+
type: string;
|
|
188
|
+
example: string;
|
|
189
|
+
};
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
};
|
|
193
|
+
};
|
|
194
|
+
};
|
|
195
|
+
};
|
|
196
|
+
};
|
|
197
|
+
};
|
|
198
|
+
'/health': {
|
|
199
|
+
get: {
|
|
200
|
+
summary: string;
|
|
201
|
+
description: string;
|
|
202
|
+
tags: string[];
|
|
203
|
+
responses: {
|
|
204
|
+
200: {
|
|
205
|
+
description: string;
|
|
206
|
+
content: {
|
|
207
|
+
'application/json': {
|
|
208
|
+
schema: {
|
|
209
|
+
type: string;
|
|
210
|
+
properties: {
|
|
211
|
+
status: {
|
|
212
|
+
type: string;
|
|
213
|
+
example: string;
|
|
214
|
+
};
|
|
215
|
+
timestamp: {
|
|
216
|
+
type: string;
|
|
217
|
+
example: string;
|
|
218
|
+
};
|
|
219
|
+
agent: {
|
|
220
|
+
type: string;
|
|
221
|
+
properties: {
|
|
222
|
+
systemPrompt: {
|
|
223
|
+
type: string;
|
|
224
|
+
};
|
|
225
|
+
llmProvider: {
|
|
226
|
+
type: string;
|
|
227
|
+
};
|
|
228
|
+
model: {
|
|
229
|
+
type: string;
|
|
230
|
+
};
|
|
231
|
+
};
|
|
232
|
+
};
|
|
233
|
+
};
|
|
234
|
+
};
|
|
235
|
+
};
|
|
236
|
+
};
|
|
237
|
+
};
|
|
238
|
+
};
|
|
239
|
+
};
|
|
240
|
+
};
|
|
241
|
+
'/agent-info': {
|
|
242
|
+
get: {
|
|
243
|
+
summary: string;
|
|
244
|
+
description: string;
|
|
245
|
+
tags: string[];
|
|
246
|
+
responses: {
|
|
247
|
+
200: {
|
|
248
|
+
description: string;
|
|
249
|
+
content: {
|
|
250
|
+
'application/json': {
|
|
251
|
+
schema: {
|
|
252
|
+
type: string;
|
|
253
|
+
properties: {
|
|
254
|
+
systemPrompt: {
|
|
255
|
+
type: string;
|
|
256
|
+
};
|
|
257
|
+
llm: {
|
|
258
|
+
type: string;
|
|
259
|
+
properties: {
|
|
260
|
+
provider: {
|
|
261
|
+
type: string;
|
|
262
|
+
example: string;
|
|
263
|
+
};
|
|
264
|
+
model: {
|
|
265
|
+
type: string;
|
|
266
|
+
example: string;
|
|
267
|
+
};
|
|
268
|
+
};
|
|
269
|
+
};
|
|
270
|
+
toolsEnabled: {
|
|
271
|
+
type: string;
|
|
272
|
+
};
|
|
273
|
+
sessionEnabled: {
|
|
274
|
+
type: string;
|
|
275
|
+
};
|
|
276
|
+
};
|
|
277
|
+
};
|
|
278
|
+
};
|
|
279
|
+
};
|
|
280
|
+
};
|
|
281
|
+
};
|
|
282
|
+
};
|
|
283
|
+
};
|
|
284
|
+
};
|
|
285
|
+
components: {
|
|
286
|
+
schemas: {
|
|
287
|
+
ChatRequest: {
|
|
288
|
+
type: string;
|
|
289
|
+
required: string[];
|
|
290
|
+
properties: {
|
|
291
|
+
message: {
|
|
292
|
+
type: string;
|
|
293
|
+
};
|
|
294
|
+
companyId: {
|
|
295
|
+
type: string;
|
|
296
|
+
};
|
|
297
|
+
userId: {
|
|
298
|
+
type: string;
|
|
299
|
+
};
|
|
300
|
+
sessionId: {
|
|
301
|
+
type: string;
|
|
302
|
+
};
|
|
303
|
+
channel: {
|
|
304
|
+
type: string;
|
|
305
|
+
};
|
|
306
|
+
metadata: {
|
|
307
|
+
type: string;
|
|
308
|
+
};
|
|
309
|
+
};
|
|
310
|
+
};
|
|
311
|
+
ChatResponse: {
|
|
312
|
+
type: string;
|
|
313
|
+
properties: {
|
|
314
|
+
success: {
|
|
315
|
+
type: string;
|
|
316
|
+
};
|
|
317
|
+
data: {
|
|
318
|
+
type: string;
|
|
319
|
+
properties: {
|
|
320
|
+
message: {
|
|
321
|
+
type: string;
|
|
322
|
+
};
|
|
323
|
+
metadata: {
|
|
324
|
+
type: string;
|
|
325
|
+
};
|
|
326
|
+
};
|
|
327
|
+
};
|
|
328
|
+
};
|
|
329
|
+
};
|
|
330
|
+
ErrorResponse: {
|
|
331
|
+
type: string;
|
|
332
|
+
properties: {
|
|
333
|
+
success: {
|
|
334
|
+
type: string;
|
|
335
|
+
example: boolean;
|
|
336
|
+
};
|
|
337
|
+
error: {
|
|
338
|
+
type: string;
|
|
339
|
+
};
|
|
340
|
+
};
|
|
341
|
+
};
|
|
342
|
+
};
|
|
343
|
+
};
|
|
344
|
+
};
|
|
345
|
+
/**
|
|
346
|
+
* Adiciona endpoints de documentação Swagger ao app Express
|
|
347
|
+
*/
|
|
348
|
+
export declare function setupSwagger(app: express.Application, port: number, config?: SwaggerConfig): {
|
|
349
|
+
openapi: string;
|
|
350
|
+
info: {
|
|
351
|
+
title: string;
|
|
352
|
+
description: string;
|
|
353
|
+
version: string;
|
|
354
|
+
contact: {
|
|
355
|
+
name?: string;
|
|
356
|
+
email?: string;
|
|
357
|
+
url?: string;
|
|
358
|
+
};
|
|
359
|
+
};
|
|
360
|
+
servers: {
|
|
361
|
+
url: string;
|
|
362
|
+
description: string;
|
|
363
|
+
}[];
|
|
364
|
+
paths: {
|
|
365
|
+
'/chat': {
|
|
366
|
+
post: {
|
|
367
|
+
summary: string;
|
|
368
|
+
description: string;
|
|
369
|
+
tags: string[];
|
|
370
|
+
requestBody: {
|
|
371
|
+
required: boolean;
|
|
372
|
+
content: {
|
|
373
|
+
'application/json': {
|
|
374
|
+
schema: {
|
|
375
|
+
type: string;
|
|
376
|
+
required: string[];
|
|
377
|
+
properties: {
|
|
378
|
+
message: {
|
|
379
|
+
type: string;
|
|
380
|
+
description: string;
|
|
381
|
+
example: string;
|
|
382
|
+
};
|
|
383
|
+
companyId: {
|
|
384
|
+
type: string;
|
|
385
|
+
description: string;
|
|
386
|
+
example: string;
|
|
387
|
+
};
|
|
388
|
+
userId: {
|
|
389
|
+
type: string;
|
|
390
|
+
description: string;
|
|
391
|
+
example: string;
|
|
392
|
+
};
|
|
393
|
+
sessionId: {
|
|
394
|
+
type: string;
|
|
395
|
+
description: string;
|
|
396
|
+
example: string;
|
|
397
|
+
};
|
|
398
|
+
channel: {
|
|
399
|
+
type: string;
|
|
400
|
+
description: string;
|
|
401
|
+
example: string;
|
|
402
|
+
};
|
|
403
|
+
metadata: {
|
|
404
|
+
type: string;
|
|
405
|
+
description: string;
|
|
406
|
+
example: {
|
|
407
|
+
source: string;
|
|
408
|
+
page: string;
|
|
409
|
+
};
|
|
410
|
+
};
|
|
411
|
+
};
|
|
412
|
+
};
|
|
413
|
+
};
|
|
414
|
+
};
|
|
415
|
+
};
|
|
416
|
+
responses: {
|
|
417
|
+
200: {
|
|
418
|
+
description: string;
|
|
419
|
+
content: {
|
|
420
|
+
'application/json': {
|
|
421
|
+
schema: {
|
|
422
|
+
type: string;
|
|
423
|
+
properties: {
|
|
424
|
+
success: {
|
|
425
|
+
type: string;
|
|
426
|
+
example: boolean;
|
|
427
|
+
};
|
|
428
|
+
data: {
|
|
429
|
+
type: string;
|
|
430
|
+
properties: {
|
|
431
|
+
message: {
|
|
432
|
+
type: string;
|
|
433
|
+
description: string;
|
|
434
|
+
example: string;
|
|
435
|
+
};
|
|
436
|
+
metadata: {
|
|
437
|
+
type: string;
|
|
438
|
+
description: string;
|
|
439
|
+
properties: {
|
|
440
|
+
llmProvider: {
|
|
441
|
+
type: string;
|
|
442
|
+
example: string;
|
|
443
|
+
};
|
|
444
|
+
model: {
|
|
445
|
+
type: string;
|
|
446
|
+
example: string;
|
|
447
|
+
};
|
|
448
|
+
toolsUsed: {
|
|
449
|
+
type: string;
|
|
450
|
+
items: {
|
|
451
|
+
type: string;
|
|
452
|
+
};
|
|
453
|
+
example: string[];
|
|
454
|
+
};
|
|
455
|
+
processingTime: {
|
|
456
|
+
type: string;
|
|
457
|
+
example: number;
|
|
458
|
+
};
|
|
459
|
+
};
|
|
460
|
+
};
|
|
461
|
+
};
|
|
462
|
+
};
|
|
463
|
+
};
|
|
464
|
+
};
|
|
465
|
+
};
|
|
466
|
+
};
|
|
467
|
+
};
|
|
468
|
+
400: {
|
|
469
|
+
description: string;
|
|
470
|
+
content: {
|
|
471
|
+
'application/json': {
|
|
472
|
+
schema: {
|
|
473
|
+
type: string;
|
|
474
|
+
properties: {
|
|
475
|
+
success: {
|
|
476
|
+
type: string;
|
|
477
|
+
example: boolean;
|
|
478
|
+
};
|
|
479
|
+
error: {
|
|
480
|
+
type: string;
|
|
481
|
+
example: string;
|
|
482
|
+
};
|
|
483
|
+
};
|
|
484
|
+
};
|
|
485
|
+
};
|
|
486
|
+
};
|
|
487
|
+
};
|
|
488
|
+
429: {
|
|
489
|
+
description: string;
|
|
490
|
+
content: {
|
|
491
|
+
'application/json': {
|
|
492
|
+
schema: {
|
|
493
|
+
type: string;
|
|
494
|
+
properties: {
|
|
495
|
+
success: {
|
|
496
|
+
type: string;
|
|
497
|
+
example: boolean;
|
|
498
|
+
};
|
|
499
|
+
error: {
|
|
500
|
+
type: string;
|
|
501
|
+
example: string;
|
|
502
|
+
};
|
|
503
|
+
};
|
|
504
|
+
};
|
|
505
|
+
};
|
|
506
|
+
};
|
|
507
|
+
};
|
|
508
|
+
500: {
|
|
509
|
+
description: string;
|
|
510
|
+
content: {
|
|
511
|
+
'application/json': {
|
|
512
|
+
schema: {
|
|
513
|
+
type: string;
|
|
514
|
+
properties: {
|
|
515
|
+
success: {
|
|
516
|
+
type: string;
|
|
517
|
+
example: boolean;
|
|
518
|
+
};
|
|
519
|
+
error: {
|
|
520
|
+
type: string;
|
|
521
|
+
example: string;
|
|
522
|
+
};
|
|
523
|
+
};
|
|
524
|
+
};
|
|
525
|
+
};
|
|
526
|
+
};
|
|
527
|
+
};
|
|
528
|
+
};
|
|
529
|
+
};
|
|
530
|
+
};
|
|
531
|
+
'/health': {
|
|
532
|
+
get: {
|
|
533
|
+
summary: string;
|
|
534
|
+
description: string;
|
|
535
|
+
tags: string[];
|
|
536
|
+
responses: {
|
|
537
|
+
200: {
|
|
538
|
+
description: string;
|
|
539
|
+
content: {
|
|
540
|
+
'application/json': {
|
|
541
|
+
schema: {
|
|
542
|
+
type: string;
|
|
543
|
+
properties: {
|
|
544
|
+
status: {
|
|
545
|
+
type: string;
|
|
546
|
+
example: string;
|
|
547
|
+
};
|
|
548
|
+
timestamp: {
|
|
549
|
+
type: string;
|
|
550
|
+
example: string;
|
|
551
|
+
};
|
|
552
|
+
agent: {
|
|
553
|
+
type: string;
|
|
554
|
+
properties: {
|
|
555
|
+
systemPrompt: {
|
|
556
|
+
type: string;
|
|
557
|
+
};
|
|
558
|
+
llmProvider: {
|
|
559
|
+
type: string;
|
|
560
|
+
};
|
|
561
|
+
model: {
|
|
562
|
+
type: string;
|
|
563
|
+
};
|
|
564
|
+
};
|
|
565
|
+
};
|
|
566
|
+
};
|
|
567
|
+
};
|
|
568
|
+
};
|
|
569
|
+
};
|
|
570
|
+
};
|
|
571
|
+
};
|
|
572
|
+
};
|
|
573
|
+
};
|
|
574
|
+
'/agent-info': {
|
|
575
|
+
get: {
|
|
576
|
+
summary: string;
|
|
577
|
+
description: string;
|
|
578
|
+
tags: string[];
|
|
579
|
+
responses: {
|
|
580
|
+
200: {
|
|
581
|
+
description: string;
|
|
582
|
+
content: {
|
|
583
|
+
'application/json': {
|
|
584
|
+
schema: {
|
|
585
|
+
type: string;
|
|
586
|
+
properties: {
|
|
587
|
+
systemPrompt: {
|
|
588
|
+
type: string;
|
|
589
|
+
};
|
|
590
|
+
llm: {
|
|
591
|
+
type: string;
|
|
592
|
+
properties: {
|
|
593
|
+
provider: {
|
|
594
|
+
type: string;
|
|
595
|
+
example: string;
|
|
596
|
+
};
|
|
597
|
+
model: {
|
|
598
|
+
type: string;
|
|
599
|
+
example: string;
|
|
600
|
+
};
|
|
601
|
+
};
|
|
602
|
+
};
|
|
603
|
+
toolsEnabled: {
|
|
604
|
+
type: string;
|
|
605
|
+
};
|
|
606
|
+
sessionEnabled: {
|
|
607
|
+
type: string;
|
|
608
|
+
};
|
|
609
|
+
};
|
|
610
|
+
};
|
|
611
|
+
};
|
|
612
|
+
};
|
|
613
|
+
};
|
|
614
|
+
};
|
|
615
|
+
};
|
|
616
|
+
};
|
|
617
|
+
};
|
|
618
|
+
components: {
|
|
619
|
+
schemas: {
|
|
620
|
+
ChatRequest: {
|
|
621
|
+
type: string;
|
|
622
|
+
required: string[];
|
|
623
|
+
properties: {
|
|
624
|
+
message: {
|
|
625
|
+
type: string;
|
|
626
|
+
};
|
|
627
|
+
companyId: {
|
|
628
|
+
type: string;
|
|
629
|
+
};
|
|
630
|
+
userId: {
|
|
631
|
+
type: string;
|
|
632
|
+
};
|
|
633
|
+
sessionId: {
|
|
634
|
+
type: string;
|
|
635
|
+
};
|
|
636
|
+
channel: {
|
|
637
|
+
type: string;
|
|
638
|
+
};
|
|
639
|
+
metadata: {
|
|
640
|
+
type: string;
|
|
641
|
+
};
|
|
642
|
+
};
|
|
643
|
+
};
|
|
644
|
+
ChatResponse: {
|
|
645
|
+
type: string;
|
|
646
|
+
properties: {
|
|
647
|
+
success: {
|
|
648
|
+
type: string;
|
|
649
|
+
};
|
|
650
|
+
data: {
|
|
651
|
+
type: string;
|
|
652
|
+
properties: {
|
|
653
|
+
message: {
|
|
654
|
+
type: string;
|
|
655
|
+
};
|
|
656
|
+
metadata: {
|
|
657
|
+
type: string;
|
|
658
|
+
};
|
|
659
|
+
};
|
|
660
|
+
};
|
|
661
|
+
};
|
|
662
|
+
};
|
|
663
|
+
ErrorResponse: {
|
|
664
|
+
type: string;
|
|
665
|
+
properties: {
|
|
666
|
+
success: {
|
|
667
|
+
type: string;
|
|
668
|
+
example: boolean;
|
|
669
|
+
};
|
|
670
|
+
error: {
|
|
671
|
+
type: string;
|
|
672
|
+
};
|
|
673
|
+
};
|
|
674
|
+
};
|
|
675
|
+
};
|
|
676
|
+
};
|
|
677
|
+
};
|
|
678
|
+
//# sourceMappingURL=swagger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"swagger.d.ts","sourceRoot":"","sources":["../../src/agents/swagger.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE;QACR,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,GAAG,CAAC,EAAE,MAAM,CAAC;KACd,CAAC;CACH;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,GAAE,aAAkB;;;;;;;mBATjE,MAAM;oBACL,MAAM;kBACR,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgQf;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,CAAC,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,GAAE,aAAkB;;;;;;;mBAvQpF,MAAM;oBACL,MAAM;kBACR,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoRf"}
|
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateSwaggerSpec = generateSwaggerSpec;
|
|
4
|
+
exports.setupSwagger = setupSwagger;
|
|
5
|
+
/**
|
|
6
|
+
* Gera especificação OpenAPI para o agente
|
|
7
|
+
*/
|
|
8
|
+
function generateSwaggerSpec(port, config = {}) {
|
|
9
|
+
return {
|
|
10
|
+
openapi: '3.0.0',
|
|
11
|
+
info: {
|
|
12
|
+
title: config.title || 'Runflow Agent API',
|
|
13
|
+
description: config.description || 'API documentation for your Runflow intelligent agent',
|
|
14
|
+
version: config.version || '1.0.0',
|
|
15
|
+
contact: config.contact || {
|
|
16
|
+
name: 'Runflow Support',
|
|
17
|
+
url: 'https://runflow.ai'
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
servers: [
|
|
21
|
+
{
|
|
22
|
+
url: `http://localhost:${port}`,
|
|
23
|
+
description: 'Development server'
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
paths: {
|
|
27
|
+
'/chat': {
|
|
28
|
+
post: {
|
|
29
|
+
summary: 'Chat with the AI agent',
|
|
30
|
+
description: 'Send a message to the intelligent agent and receive a response. The agent can use tools, search knowledge bases, and maintain conversation context.',
|
|
31
|
+
tags: ['Chat'],
|
|
32
|
+
requestBody: {
|
|
33
|
+
required: true,
|
|
34
|
+
content: {
|
|
35
|
+
'application/json': {
|
|
36
|
+
schema: {
|
|
37
|
+
type: 'object',
|
|
38
|
+
required: ['message', 'companyId'],
|
|
39
|
+
properties: {
|
|
40
|
+
message: {
|
|
41
|
+
type: 'string',
|
|
42
|
+
description: 'The user message to send to the agent',
|
|
43
|
+
example: 'Hello, what are your business hours?'
|
|
44
|
+
},
|
|
45
|
+
companyId: {
|
|
46
|
+
type: 'string',
|
|
47
|
+
description: 'Company identifier',
|
|
48
|
+
example: 'company-123'
|
|
49
|
+
},
|
|
50
|
+
userId: {
|
|
51
|
+
type: 'string',
|
|
52
|
+
description: 'User identifier (optional)',
|
|
53
|
+
example: 'user-456'
|
|
54
|
+
},
|
|
55
|
+
sessionId: {
|
|
56
|
+
type: 'string',
|
|
57
|
+
description: 'Session identifier for conversation continuity (optional)',
|
|
58
|
+
example: 'session-789'
|
|
59
|
+
},
|
|
60
|
+
channel: {
|
|
61
|
+
type: 'string',
|
|
62
|
+
description: 'Communication channel (optional)',
|
|
63
|
+
example: 'web'
|
|
64
|
+
},
|
|
65
|
+
metadata: {
|
|
66
|
+
type: 'object',
|
|
67
|
+
description: 'Additional metadata (optional)',
|
|
68
|
+
example: { source: 'website', page: 'contact' }
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
responses: {
|
|
76
|
+
200: {
|
|
77
|
+
description: 'Successful response from the agent',
|
|
78
|
+
content: {
|
|
79
|
+
'application/json': {
|
|
80
|
+
schema: {
|
|
81
|
+
type: 'object',
|
|
82
|
+
properties: {
|
|
83
|
+
success: {
|
|
84
|
+
type: 'boolean',
|
|
85
|
+
example: true
|
|
86
|
+
},
|
|
87
|
+
data: {
|
|
88
|
+
type: 'object',
|
|
89
|
+
properties: {
|
|
90
|
+
message: {
|
|
91
|
+
type: 'string',
|
|
92
|
+
description: 'The agent response message',
|
|
93
|
+
example: 'Our business hours are Monday-Friday 9AM-6PM EST.'
|
|
94
|
+
},
|
|
95
|
+
metadata: {
|
|
96
|
+
type: 'object',
|
|
97
|
+
description: 'Response metadata including tools used, processing time, etc.',
|
|
98
|
+
properties: {
|
|
99
|
+
llmProvider: { type: 'string', example: 'openai' },
|
|
100
|
+
model: { type: 'string', example: 'gpt-4' },
|
|
101
|
+
toolsUsed: { type: 'array', items: { type: 'string' }, example: ['search_knowledge'] },
|
|
102
|
+
processingTime: { type: 'number', example: 1250 }
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
400: {
|
|
113
|
+
description: 'Bad request - missing required fields',
|
|
114
|
+
content: {
|
|
115
|
+
'application/json': {
|
|
116
|
+
schema: {
|
|
117
|
+
type: 'object',
|
|
118
|
+
properties: {
|
|
119
|
+
success: { type: 'boolean', example: false },
|
|
120
|
+
error: { type: 'string', example: 'Campo "message" é obrigatório' }
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
429: {
|
|
127
|
+
description: 'Rate limit exceeded',
|
|
128
|
+
content: {
|
|
129
|
+
'application/json': {
|
|
130
|
+
schema: {
|
|
131
|
+
type: 'object',
|
|
132
|
+
properties: {
|
|
133
|
+
success: { type: 'boolean', example: false },
|
|
134
|
+
error: { type: 'string', example: 'Rate limit exceeded. Try again later.' }
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
500: {
|
|
141
|
+
description: 'Internal server error',
|
|
142
|
+
content: {
|
|
143
|
+
'application/json': {
|
|
144
|
+
schema: {
|
|
145
|
+
type: 'object',
|
|
146
|
+
properties: {
|
|
147
|
+
success: { type: 'boolean', example: false },
|
|
148
|
+
error: { type: 'string', example: 'Erro interno do servidor' }
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
'/health': {
|
|
158
|
+
get: {
|
|
159
|
+
summary: 'Health check',
|
|
160
|
+
description: 'Check if the agent server is running and healthy',
|
|
161
|
+
tags: ['System'],
|
|
162
|
+
responses: {
|
|
163
|
+
200: {
|
|
164
|
+
description: 'Server is healthy',
|
|
165
|
+
content: {
|
|
166
|
+
'application/json': {
|
|
167
|
+
schema: {
|
|
168
|
+
type: 'object',
|
|
169
|
+
properties: {
|
|
170
|
+
status: { type: 'string', example: 'ok' },
|
|
171
|
+
timestamp: { type: 'string', example: '2024-01-01T12:00:00Z' },
|
|
172
|
+
agent: {
|
|
173
|
+
type: 'object',
|
|
174
|
+
properties: {
|
|
175
|
+
systemPrompt: { type: 'string' },
|
|
176
|
+
llmProvider: { type: 'string' },
|
|
177
|
+
model: { type: 'string' }
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
'/agent-info': {
|
|
189
|
+
get: {
|
|
190
|
+
summary: 'Agent information',
|
|
191
|
+
description: 'Get information about the agent configuration and capabilities',
|
|
192
|
+
tags: ['System'],
|
|
193
|
+
responses: {
|
|
194
|
+
200: {
|
|
195
|
+
description: 'Agent information',
|
|
196
|
+
content: {
|
|
197
|
+
'application/json': {
|
|
198
|
+
schema: {
|
|
199
|
+
type: 'object',
|
|
200
|
+
properties: {
|
|
201
|
+
systemPrompt: { type: 'string' },
|
|
202
|
+
llm: {
|
|
203
|
+
type: 'object',
|
|
204
|
+
properties: {
|
|
205
|
+
provider: { type: 'string', example: 'openai' },
|
|
206
|
+
model: { type: 'string', example: 'gpt-4' }
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
toolsEnabled: { type: 'boolean' },
|
|
210
|
+
sessionEnabled: { type: 'boolean' }
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
components: {
|
|
221
|
+
schemas: {
|
|
222
|
+
ChatRequest: {
|
|
223
|
+
type: 'object',
|
|
224
|
+
required: ['message', 'companyId'],
|
|
225
|
+
properties: {
|
|
226
|
+
message: { type: 'string' },
|
|
227
|
+
companyId: { type: 'string' },
|
|
228
|
+
userId: { type: 'string' },
|
|
229
|
+
sessionId: { type: 'string' },
|
|
230
|
+
channel: { type: 'string' },
|
|
231
|
+
metadata: { type: 'object' }
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
ChatResponse: {
|
|
235
|
+
type: 'object',
|
|
236
|
+
properties: {
|
|
237
|
+
success: { type: 'boolean' },
|
|
238
|
+
data: {
|
|
239
|
+
type: 'object',
|
|
240
|
+
properties: {
|
|
241
|
+
message: { type: 'string' },
|
|
242
|
+
metadata: { type: 'object' }
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
},
|
|
247
|
+
ErrorResponse: {
|
|
248
|
+
type: 'object',
|
|
249
|
+
properties: {
|
|
250
|
+
success: { type: 'boolean', example: false },
|
|
251
|
+
error: { type: 'string' }
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Adiciona endpoints de documentação Swagger ao app Express
|
|
260
|
+
*/
|
|
261
|
+
function setupSwagger(app, port, config = {}) {
|
|
262
|
+
const swaggerSpec = generateSwaggerSpec(port, config);
|
|
263
|
+
// Swagger JSON endpoint
|
|
264
|
+
app.get('/api-docs.json', (req, res) => {
|
|
265
|
+
res.json(swaggerSpec);
|
|
266
|
+
});
|
|
267
|
+
// Swagger UI
|
|
268
|
+
app.get('/docs', (req, res) => {
|
|
269
|
+
const html = generateSwaggerHTML(swaggerSpec.info.title);
|
|
270
|
+
res.send(html);
|
|
271
|
+
});
|
|
272
|
+
return swaggerSpec;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Gera HTML para Swagger UI
|
|
276
|
+
*/
|
|
277
|
+
function generateSwaggerHTML(title) {
|
|
278
|
+
return `
|
|
279
|
+
<!DOCTYPE html>
|
|
280
|
+
<html>
|
|
281
|
+
<head>
|
|
282
|
+
<title>${title} - API Documentation</title>
|
|
283
|
+
<link rel="stylesheet" type="text/css" href="https://unpkg.com/swagger-ui-dist@4.15.5/swagger-ui.css" />
|
|
284
|
+
<style>
|
|
285
|
+
html {
|
|
286
|
+
box-sizing: border-box;
|
|
287
|
+
overflow: -moz-scrollbars-vertical;
|
|
288
|
+
overflow-y: scroll;
|
|
289
|
+
}
|
|
290
|
+
*, *:before, *:after {
|
|
291
|
+
box-sizing: inherit;
|
|
292
|
+
}
|
|
293
|
+
body {
|
|
294
|
+
margin: 0;
|
|
295
|
+
background: #fafafa;
|
|
296
|
+
}
|
|
297
|
+
.swagger-ui .topbar {
|
|
298
|
+
display: none;
|
|
299
|
+
}
|
|
300
|
+
.swagger-ui .info {
|
|
301
|
+
margin: 20px 0;
|
|
302
|
+
}
|
|
303
|
+
.swagger-ui .info .title {
|
|
304
|
+
color: #3b4151;
|
|
305
|
+
font-size: 36px;
|
|
306
|
+
}
|
|
307
|
+
</style>
|
|
308
|
+
</head>
|
|
309
|
+
<body>
|
|
310
|
+
<div id="swagger-ui"></div>
|
|
311
|
+
<script src="https://unpkg.com/swagger-ui-dist@4.15.5/swagger-ui-bundle.js"></script>
|
|
312
|
+
<script src="https://unpkg.com/swagger-ui-dist@4.15.5/swagger-ui-standalone-preset.js"></script>
|
|
313
|
+
<script>
|
|
314
|
+
window.onload = function() {
|
|
315
|
+
const ui = SwaggerUIBundle({
|
|
316
|
+
url: '/api-docs.json',
|
|
317
|
+
dom_id: '#swagger-ui',
|
|
318
|
+
deepLinking: true,
|
|
319
|
+
presets: [
|
|
320
|
+
SwaggerUIBundle.presets.apis,
|
|
321
|
+
SwaggerUIStandalonePreset
|
|
322
|
+
],
|
|
323
|
+
plugins: [
|
|
324
|
+
SwaggerUIBundle.plugins.DownloadUrl
|
|
325
|
+
],
|
|
326
|
+
layout: "StandaloneLayout",
|
|
327
|
+
tryItOutEnabled: true,
|
|
328
|
+
requestInterceptor: (request) => {
|
|
329
|
+
// Adicionar headers padrão se necessário
|
|
330
|
+
return request;
|
|
331
|
+
}
|
|
332
|
+
});
|
|
333
|
+
};
|
|
334
|
+
</script>
|
|
335
|
+
</body>
|
|
336
|
+
</html>`;
|
|
337
|
+
}
|
|
338
|
+
//# sourceMappingURL=swagger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"swagger.js","sourceRoot":"","sources":["../../src/agents/swagger.ts"],"names":[],"mappings":";;AAgBA,kDAyPC;AAKD,oCAeC;AAhRD;;GAEG;AACH,SAAgB,mBAAmB,CAAC,IAAY,EAAE,SAAwB,EAAE;IAC1E,OAAO;QACL,OAAO,EAAE,OAAO;QAChB,IAAI,EAAE;YACJ,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,mBAAmB;YAC1C,WAAW,EAAE,MAAM,CAAC,WAAW,IAAI,sDAAsD;YACzF,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,OAAO;YAClC,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI;gBACzB,IAAI,EAAE,iBAAiB;gBACvB,GAAG,EAAE,oBAAoB;aAC1B;SACF;QACD,OAAO,EAAE;YACP;gBACE,GAAG,EAAE,oBAAoB,IAAI,EAAE;gBAC/B,WAAW,EAAE,oBAAoB;aAClC;SACF;QACD,KAAK,EAAE;YACL,OAAO,EAAE;gBACP,IAAI,EAAE;oBACJ,OAAO,EAAE,wBAAwB;oBACjC,WA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owConfig, checkEnvironmentVariables } from './config';
|
|
4
4
|
export { RunflowAgent, RunflowAgentConfig, RunflowTool, ToolContext } from './agents/runflow-agent';
|
|
5
5
|
export { createAgentServer, startAgent, AgentServerConfig, AgentServerOptions } from './agents/server';
|
|
6
|
+
export { SwaggerConfig } from './agents/swagger';
|
|
6
7
|
export { getSDK, resetSDK, hasSDKInstance, getCredential, getPrompt, getAvailableVectorStores, searchVectorStore, addDocument, listDocuments, deleteDocument, getSession, log, trace } from './singleton';
|
|
7
8
|
export { validateAgentInput, sanitizeMetadata, maskSensitiveData, HttpClient, batchRequests, withTimeout, debounce, SimpleCache, credentialCache, sessionCache } from './utils';
|
|
8
9
|
export declare function createHandler(fn: (input: import('./types').AgentInput, context: import('./types').AgentContext) => Promise<import('./types').AgentOutput>): (input: import("./types").AgentInput, context: import("./types").AgentContext) => Promise<import("./types").AgentOutput>;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC3D,cAAc,SAAS,CAAC;AACxB,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,yBAAyB,EAC1B,MAAM,UAAU,CAAC;AAGlB,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,WAAW,EACX,WAAW,EACZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,iBAAiB,EACjB,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC3D,cAAc,SAAS,CAAC;AACxB,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,yBAAyB,EAC1B,MA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AAE,YAAY,GAAG,OAAO,eAAe,EAAE,UAAU,CAEtG;AAGD,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,CAAC,KAAK,EAAE,OAAO,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,SAAS,EAAE,YAAY,KAAK,OAAO,CAAC,OAAO,SAAS,EAAE,WAAW,CAAC,GAClI,CAAC,KAAK,EAAE,OAAO,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,SAAS,EAAE,YAAY,KAAK,OAAO,CAAC,OAAO,SAAS,EAAE,WAAW,CAAC,CAQ1H"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuDA,sCAIC;AAGD,gDAQC;AAGD,8BAEC;AAGD,kDAUC;AAxFD,6CAA2D;AAAlD,yGAAA,UAAU,OAAA;AAAE,6GAAA,cAAc,OAAA;AACnC,0CAAwB;AACxB,mCAIkB;AAHhB,2GAAA,iBAAiB,OAAA;AACjB,6GAAA,mBAAmB,OAAA;AACnB,mHAAA,yBAAyB,OAAA;AAG3B,kBAAkB;AAClB,wDAKgC;AAJ9B,6GAAA,YAAY,OAAA;AAKd,0CAKyB;AAJvB,2GAAA,iBAAiB,OAAA;AACjB,oGAAA,UAAU,OAAA;AAMZ,yDAAyD;AACzD,yCAcqB;AAbnB,mGAAA,MAAM,OAAA;AACN,qGAAA,QAAQ,OAAA;AACR,2GAAA,cAAc,OAAA;AACd,0GAAA,aAAa,OAAA;AACb,sGAAA,SAAS,OAAA;AACT,qHAAA,wBAAwB,OAAA;AACxB,8GAAA,iBAAiB,OAAA;AACjB,wGAAA,WAAW,O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