@dexto/server 1.6.18 → 1.6.20
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/dist/hono/index.d.ts +170 -142
- package/dist/hono/index.d.ts.map +1 -1
- package/dist/hono/routes/a2a-tasks.cjs +17 -4
- package/dist/hono/routes/a2a-tasks.d.ts +39 -35
- package/dist/hono/routes/a2a-tasks.d.ts.map +1 -1
- package/dist/hono/routes/a2a-tasks.js +17 -4
- package/dist/hono/routes/agents.d.ts +8 -8
- package/dist/hono/routes/approvals.cjs +19 -8
- package/dist/hono/routes/approvals.d.ts +49 -18
- package/dist/hono/routes/approvals.d.ts.map +1 -1
- package/dist/hono/routes/approvals.js +19 -8
- package/dist/hono/routes/llm.d.ts +1 -1
- package/dist/hono/routes/mcp.cjs +56 -26
- package/dist/hono/routes/mcp.d.ts +22 -29
- package/dist/hono/routes/mcp.d.ts.map +1 -1
- package/dist/hono/routes/mcp.js +64 -28
- package/dist/hono/routes/messages.cjs +34 -35
- package/dist/hono/routes/messages.d.ts +12 -12
- package/dist/hono/routes/messages.d.ts.map +1 -1
- package/dist/hono/routes/messages.js +41 -36
- package/dist/hono/routes/prompts.cjs +10 -4
- package/dist/hono/routes/prompts.d.ts +4 -4
- package/dist/hono/routes/prompts.d.ts.map +1 -1
- package/dist/hono/routes/prompts.js +15 -5
- package/dist/hono/routes/queue.cjs +42 -29
- package/dist/hono/routes/queue.d.ts +9 -9
- package/dist/hono/routes/queue.d.ts.map +1 -1
- package/dist/hono/routes/queue.js +49 -30
- package/dist/hono/routes/resources.d.ts +1 -1
- package/dist/hono/routes/schedules.d.ts +4 -4
- package/dist/hono/routes/search.d.ts +4 -4
- package/dist/hono/routes/sessions.cjs +7 -2
- package/dist/hono/routes/sessions.d.ts +12 -12
- package/dist/hono/routes/sessions.d.ts.map +1 -1
- package/dist/hono/routes/sessions.js +7 -2
- package/dist/hono/routes/tools.d.ts +1 -1
- package/dist/hono/routes/webhooks.cjs +59 -24
- package/dist/hono/routes/webhooks.d.ts +7 -7
- package/dist/hono/routes/webhooks.d.ts.map +1 -1
- package/dist/hono/routes/webhooks.js +59 -24
- package/dist/hono/schemas/responses.cjs +112 -2
- package/dist/hono/schemas/responses.d.ts +246 -54
- package/dist/hono/schemas/responses.d.ts.map +1 -1
- package/dist/hono/schemas/responses.js +105 -1
- package/package.json +11 -11
package/dist/hono/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hono/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAmBzD,OAAO,EAAsB,KAAK,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAUlF,OAAO,EAGH,KAAK,kBAAkB,EAC1B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAKxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAiE1E,MAAM,MAAM,UAAU,GAAG,CAAC,GAAG,EAAE,OAAO,KAAK,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAC5E,MAAM,MAAM,oBAAoB,GAAG,CAC/B,GAAG,EAAE,OAAO,KACX,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;AAEtD,MAAM,MAAM,qBAAqB,GAAG;IAChC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,UAAU,CAAC;IACrB;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,oBAAoB,CAAC;IAC1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_zod_openapi.z.record(import_zod_openapi.z.any()).optional().describe("Extension metadata"),
|
|
89
89
|
kind: import_zod_openapi.z.literal("task").describe("Object type discriminator")
|
|
90
90
|
}).describe("A2A Protocol task");
|
|
91
|
+
const TaskErrorResponseSchema = import_zod_openapi.z.object({
|
|
92
|
+
error: import_zod_openapi.z.string().describe("Task error message")
|
|
93
|
+
}).strict().describe("A2A task error response");
|
|
91
94
|
const MessageSendRequestSchema = import_zod_openapi.z.object({
|
|
92
95
|
message: MessageSchema.describe("Message to send to the agent"),
|
|
93
96
|
configuration: import_zod_openapi.z.object({
|
|
@@ -209,7 +212,12 @@ function createA2ATasksRouter(getAgent, sseSubscriber) {
|
|
|
209
212
|
}
|
|
210
213
|
},
|
|
211
214
|
404: {
|
|
212
|
-
description: "Task not found"
|
|
215
|
+
description: "Task not found",
|
|
216
|
+
content: {
|
|
217
|
+
"application/json": {
|
|
218
|
+
schema: TaskErrorResponseSchema
|
|
219
|
+
}
|
|
220
|
+
}
|
|
213
221
|
}
|
|
214
222
|
}
|
|
215
223
|
});
|
|
@@ -234,7 +242,12 @@ function createA2ATasksRouter(getAgent, sseSubscriber) {
|
|
|
234
242
|
}
|
|
235
243
|
},
|
|
236
244
|
404: {
|
|
237
|
-
description: "Task not found"
|
|
245
|
+
description: "Task not found",
|
|
246
|
+
content: {
|
|
247
|
+
"application/json": {
|
|
248
|
+
schema: TaskErrorResponseSchema
|
|
249
|
+
}
|
|
250
|
+
}
|
|
238
251
|
}
|
|
239
252
|
}
|
|
240
253
|
});
|
|
@@ -291,7 +304,7 @@ function createA2ATasksRouter(getAgent, sseSubscriber) {
|
|
|
291
304
|
const { id } = ctx.req.valid("param");
|
|
292
305
|
try {
|
|
293
306
|
const task = await handlers.tasksGet({ id });
|
|
294
|
-
return ctx.json(task);
|
|
307
|
+
return ctx.json(task, 200);
|
|
295
308
|
} catch (error) {
|
|
296
309
|
import_core.logger.warn(`Task ${id} not found: ${error}`);
|
|
297
310
|
return ctx.json({ error: "Task not found" }, 404);
|
|
@@ -302,7 +315,7 @@ function createA2ATasksRouter(getAgent, sseSubscriber) {
|
|
|
302
315
|
import_core.logger.info(`REST: tasks/cancel ${id}`);
|
|
303
316
|
try {
|
|
304
317
|
const task = await handlers.tasksCancel({ id });
|
|
305
|
-
return ctx.json(task);
|
|
318
|
+
return ctx.json(task, 200);
|
|
306
319
|
} catch (error) {
|
|
307
320
|
import_core.logger.error(`Failed to cancel task ${id}: ${error}`);
|
|
308
321
|
return ctx.json({ error: "Task not found" }, 404);
|
|
@@ -47,12 +47,12 @@ export declare function createA2ATasksRouter(getAgent: GetAgentFn, sseSubscriber
|
|
|
47
47
|
} | {
|
|
48
48
|
file: {
|
|
49
49
|
bytes: string;
|
|
50
|
-
mimeType?: string | undefined;
|
|
51
50
|
name?: string | undefined;
|
|
51
|
+
mimeType?: string | undefined;
|
|
52
52
|
} | {
|
|
53
53
|
uri: string;
|
|
54
|
-
mimeType?: string | undefined;
|
|
55
54
|
name?: string | undefined;
|
|
55
|
+
mimeType?: string | undefined;
|
|
56
56
|
};
|
|
57
57
|
kind: "file";
|
|
58
58
|
metadata?: Record<string, any> | undefined;
|
|
@@ -95,12 +95,12 @@ export declare function createA2ATasksRouter(getAgent: GetAgentFn, sseSubscriber
|
|
|
95
95
|
} | {
|
|
96
96
|
file: {
|
|
97
97
|
bytes: string;
|
|
98
|
-
mimeType?: string | undefined;
|
|
99
98
|
name?: string | undefined;
|
|
99
|
+
mimeType?: string | undefined;
|
|
100
100
|
} | {
|
|
101
101
|
uri: string;
|
|
102
|
-
mimeType?: string | undefined;
|
|
103
102
|
name?: string | undefined;
|
|
103
|
+
mimeType?: string | undefined;
|
|
104
104
|
};
|
|
105
105
|
kind: "file";
|
|
106
106
|
metadata?: {
|
|
@@ -144,12 +144,12 @@ export declare function createA2ATasksRouter(getAgent: GetAgentFn, sseSubscriber
|
|
|
144
144
|
} | {
|
|
145
145
|
file: {
|
|
146
146
|
bytes: string;
|
|
147
|
-
mimeType?: string | undefined;
|
|
148
147
|
name?: string | undefined;
|
|
148
|
+
mimeType?: string | undefined;
|
|
149
149
|
} | {
|
|
150
150
|
uri: string;
|
|
151
|
-
mimeType?: string | undefined;
|
|
152
151
|
name?: string | undefined;
|
|
152
|
+
mimeType?: string | undefined;
|
|
153
153
|
};
|
|
154
154
|
kind: "file";
|
|
155
155
|
metadata?: {
|
|
@@ -209,12 +209,12 @@ export declare function createA2ATasksRouter(getAgent: GetAgentFn, sseSubscriber
|
|
|
209
209
|
} | {
|
|
210
210
|
file: {
|
|
211
211
|
bytes: string;
|
|
212
|
-
mimeType?: string | undefined;
|
|
213
212
|
name?: string | undefined;
|
|
213
|
+
mimeType?: string | undefined;
|
|
214
214
|
} | {
|
|
215
215
|
uri: string;
|
|
216
|
-
mimeType?: string | undefined;
|
|
217
216
|
name?: string | undefined;
|
|
217
|
+
mimeType?: string | undefined;
|
|
218
218
|
};
|
|
219
219
|
kind: "file";
|
|
220
220
|
metadata?: {
|
|
@@ -258,12 +258,12 @@ export declare function createA2ATasksRouter(getAgent: GetAgentFn, sseSubscriber
|
|
|
258
258
|
} | {
|
|
259
259
|
file: {
|
|
260
260
|
bytes: string;
|
|
261
|
-
mimeType?: string | undefined;
|
|
262
261
|
name?: string | undefined;
|
|
262
|
+
mimeType?: string | undefined;
|
|
263
263
|
} | {
|
|
264
264
|
uri: string;
|
|
265
|
-
mimeType?: string | undefined;
|
|
266
265
|
name?: string | undefined;
|
|
266
|
+
mimeType?: string | undefined;
|
|
267
267
|
};
|
|
268
268
|
kind: "file";
|
|
269
269
|
metadata?: {
|
|
@@ -299,15 +299,6 @@ export declare function createA2ATasksRouter(getAgent: GetAgentFn, sseSubscriber
|
|
|
299
299
|
} & {
|
|
300
300
|
"/v1/tasks/:id": {
|
|
301
301
|
$get: {
|
|
302
|
-
input: {
|
|
303
|
-
param: {
|
|
304
|
-
id: string;
|
|
305
|
-
};
|
|
306
|
-
};
|
|
307
|
-
output: {};
|
|
308
|
-
outputFormat: string;
|
|
309
|
-
status: 404;
|
|
310
|
-
} | {
|
|
311
302
|
input: {
|
|
312
303
|
param: {
|
|
313
304
|
id: string;
|
|
@@ -329,12 +320,12 @@ export declare function createA2ATasksRouter(getAgent: GetAgentFn, sseSubscriber
|
|
|
329
320
|
} | {
|
|
330
321
|
file: {
|
|
331
322
|
bytes: string;
|
|
332
|
-
mimeType?: string | undefined;
|
|
333
323
|
name?: string | undefined;
|
|
324
|
+
mimeType?: string | undefined;
|
|
334
325
|
} | {
|
|
335
326
|
uri: string;
|
|
336
|
-
mimeType?: string | undefined;
|
|
337
327
|
name?: string | undefined;
|
|
328
|
+
mimeType?: string | undefined;
|
|
338
329
|
};
|
|
339
330
|
kind: "file";
|
|
340
331
|
metadata?: {
|
|
@@ -378,12 +369,12 @@ export declare function createA2ATasksRouter(getAgent: GetAgentFn, sseSubscriber
|
|
|
378
369
|
} | {
|
|
379
370
|
file: {
|
|
380
371
|
bytes: string;
|
|
381
|
-
mimeType?: string | undefined;
|
|
382
372
|
name?: string | undefined;
|
|
373
|
+
mimeType?: string | undefined;
|
|
383
374
|
} | {
|
|
384
375
|
uri: string;
|
|
385
|
-
mimeType?: string | undefined;
|
|
386
376
|
name?: string | undefined;
|
|
377
|
+
mimeType?: string | undefined;
|
|
387
378
|
};
|
|
388
379
|
kind: "file";
|
|
389
380
|
metadata?: {
|
|
@@ -410,20 +401,22 @@ export declare function createA2ATasksRouter(getAgent: GetAgentFn, sseSubscriber
|
|
|
410
401
|
};
|
|
411
402
|
outputFormat: "json";
|
|
412
403
|
status: 200;
|
|
413
|
-
}
|
|
414
|
-
};
|
|
415
|
-
} & {
|
|
416
|
-
"/v1/tasks/:id:cancel": {
|
|
417
|
-
$post: {
|
|
404
|
+
} | {
|
|
418
405
|
input: {
|
|
419
406
|
param: {
|
|
420
407
|
id: string;
|
|
421
408
|
};
|
|
422
409
|
};
|
|
423
|
-
output: {
|
|
424
|
-
|
|
410
|
+
output: {
|
|
411
|
+
error: string;
|
|
412
|
+
};
|
|
413
|
+
outputFormat: "json";
|
|
425
414
|
status: 404;
|
|
426
|
-
}
|
|
415
|
+
};
|
|
416
|
+
};
|
|
417
|
+
} & {
|
|
418
|
+
"/v1/tasks/:id:cancel": {
|
|
419
|
+
$post: {
|
|
427
420
|
input: {
|
|
428
421
|
param: {
|
|
429
422
|
id: string;
|
|
@@ -445,12 +438,12 @@ export declare function createA2ATasksRouter(getAgent: GetAgentFn, sseSubscriber
|
|
|
445
438
|
} | {
|
|
446
439
|
file: {
|
|
447
440
|
bytes: string;
|
|
448
|
-
mimeType?: string | undefined;
|
|
449
441
|
name?: string | undefined;
|
|
442
|
+
mimeType?: string | undefined;
|
|
450
443
|
} | {
|
|
451
444
|
uri: string;
|
|
452
|
-
mimeType?: string | undefined;
|
|
453
445
|
name?: string | undefined;
|
|
446
|
+
mimeType?: string | undefined;
|
|
454
447
|
};
|
|
455
448
|
kind: "file";
|
|
456
449
|
metadata?: {
|
|
@@ -494,12 +487,12 @@ export declare function createA2ATasksRouter(getAgent: GetAgentFn, sseSubscriber
|
|
|
494
487
|
} | {
|
|
495
488
|
file: {
|
|
496
489
|
bytes: string;
|
|
497
|
-
mimeType?: string | undefined;
|
|
498
490
|
name?: string | undefined;
|
|
491
|
+
mimeType?: string | undefined;
|
|
499
492
|
} | {
|
|
500
493
|
uri: string;
|
|
501
|
-
mimeType?: string | undefined;
|
|
502
494
|
name?: string | undefined;
|
|
495
|
+
mimeType?: string | undefined;
|
|
503
496
|
};
|
|
504
497
|
kind: "file";
|
|
505
498
|
metadata?: {
|
|
@@ -526,6 +519,17 @@ export declare function createA2ATasksRouter(getAgent: GetAgentFn, sseSubscriber
|
|
|
526
519
|
};
|
|
527
520
|
outputFormat: "json";
|
|
528
521
|
status: 200;
|
|
522
|
+
} | {
|
|
523
|
+
input: {
|
|
524
|
+
param: {
|
|
525
|
+
id: string;
|
|
526
|
+
};
|
|
527
|
+
};
|
|
528
|
+
output: {
|
|
529
|
+
error: string;
|
|
530
|
+
};
|
|
531
|
+
outputFormat: "json";
|
|
532
|
+
status: 404;
|
|
529
533
|
};
|
|
530
534
|
};
|
|
531
535
|
}, "/">;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"a2a-tasks.d.ts","sourceRoot":"","sources":["../../../src/hono/routes/a2a-tasks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,WAAW,EAAkB,MAAM,mBAAmB,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG9C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAEhF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,KAAK,UAAU,GAAG,CAAC,GAAG,EAAE,OAAO,KAAK,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"a2a-tasks.d.ts","sourceRoot":"","sources":["../../../src/hono/routes/a2a-tasks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,WAAW,EAAkB,MAAM,mBAAmB,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG9C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAEhF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,KAAK,UAAU,GAAG,CAAC,GAAG,EAAE,OAAO,KAAK,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAkLrE;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,UAAU,EAAE,aAAa,EAAE,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAiO9F"}
|
|
@@ -65,6 +65,9 @@ const TaskSchema = z.object({
|
|
|
65
65
|
metadata: z.record(z.any()).optional().describe("Extension metadata"),
|
|
66
66
|
kind: z.literal("task").describe("Object type discriminator")
|
|
67
67
|
}).describe("A2A Protocol task");
|
|
68
|
+
const TaskErrorResponseSchema = z.object({
|
|
69
|
+
error: z.string().describe("Task error message")
|
|
70
|
+
}).strict().describe("A2A task error response");
|
|
68
71
|
const MessageSendRequestSchema = z.object({
|
|
69
72
|
message: MessageSchema.describe("Message to send to the agent"),
|
|
70
73
|
configuration: z.object({
|
|
@@ -186,7 +189,12 @@ function createA2ATasksRouter(getAgent, sseSubscriber) {
|
|
|
186
189
|
}
|
|
187
190
|
},
|
|
188
191
|
404: {
|
|
189
|
-
description: "Task not found"
|
|
192
|
+
description: "Task not found",
|
|
193
|
+
content: {
|
|
194
|
+
"application/json": {
|
|
195
|
+
schema: TaskErrorResponseSchema
|
|
196
|
+
}
|
|
197
|
+
}
|
|
190
198
|
}
|
|
191
199
|
}
|
|
192
200
|
});
|
|
@@ -211,7 +219,12 @@ function createA2ATasksRouter(getAgent, sseSubscriber) {
|
|
|
211
219
|
}
|
|
212
220
|
},
|
|
213
221
|
404: {
|
|
214
|
-
description: "Task not found"
|
|
222
|
+
description: "Task not found",
|
|
223
|
+
content: {
|
|
224
|
+
"application/json": {
|
|
225
|
+
schema: TaskErrorResponseSchema
|
|
226
|
+
}
|
|
227
|
+
}
|
|
215
228
|
}
|
|
216
229
|
}
|
|
217
230
|
});
|
|
@@ -268,7 +281,7 @@ function createA2ATasksRouter(getAgent, sseSubscriber) {
|
|
|
268
281
|
const { id } = ctx.req.valid("param");
|
|
269
282
|
try {
|
|
270
283
|
const task = await handlers.tasksGet({ id });
|
|
271
|
-
return ctx.json(task);
|
|
284
|
+
return ctx.json(task, 200);
|
|
272
285
|
} catch (error) {
|
|
273
286
|
logger.warn(`Task ${id} not found: ${error}`);
|
|
274
287
|
return ctx.json({ error: "Task not found" }, 404);
|
|
@@ -279,7 +292,7 @@ function createA2ATasksRouter(getAgent, sseSubscriber) {
|
|
|
279
292
|
logger.info(`REST: tasks/cancel ${id}`);
|
|
280
293
|
try {
|
|
281
294
|
const task = await handlers.tasksCancel({ id });
|
|
282
|
-
return ctx.json(task);
|
|
295
|
+
return ctx.json(task, 200);
|
|
283
296
|
} catch (error) {
|
|
284
297
|
logger.error(`Failed to cancel task ${id}: ${error}`);
|
|
285
298
|
return ctx.json({ error: "Task not found" }, 404);
|
|
@@ -27,22 +27,22 @@ export declare function createAgentsRouter(getAgent: GetAgentFn, context: Agents
|
|
|
27
27
|
installed: {
|
|
28
28
|
description: string;
|
|
29
29
|
type: "custom" | "builtin";
|
|
30
|
-
id: string;
|
|
31
30
|
name: string;
|
|
31
|
+
id: string;
|
|
32
32
|
tags?: string[] | undefined;
|
|
33
33
|
author?: string | undefined;
|
|
34
34
|
}[];
|
|
35
35
|
available: {
|
|
36
36
|
description: string;
|
|
37
37
|
type: "custom" | "builtin";
|
|
38
|
-
id: string;
|
|
39
38
|
name: string;
|
|
39
|
+
id: string;
|
|
40
40
|
tags?: string[] | undefined;
|
|
41
41
|
author?: string | undefined;
|
|
42
42
|
}[];
|
|
43
43
|
current: {
|
|
44
|
-
id: string | null;
|
|
45
44
|
name: string | null;
|
|
45
|
+
id: string | null;
|
|
46
46
|
};
|
|
47
47
|
};
|
|
48
48
|
outputFormat: "json";
|
|
@@ -54,8 +54,8 @@ export declare function createAgentsRouter(getAgent: GetAgentFn, context: Agents
|
|
|
54
54
|
$get: {
|
|
55
55
|
input: {};
|
|
56
56
|
output: {
|
|
57
|
-
id: string | null;
|
|
58
57
|
name: string | null;
|
|
58
|
+
id: string | null;
|
|
59
59
|
};
|
|
60
60
|
outputFormat: "json";
|
|
61
61
|
status: 200;
|
|
@@ -82,8 +82,8 @@ export declare function createAgentsRouter(getAgent: GetAgentFn, context: Agents
|
|
|
82
82
|
};
|
|
83
83
|
output: {
|
|
84
84
|
type: "custom" | "builtin";
|
|
85
|
-
id: string;
|
|
86
85
|
name: string;
|
|
86
|
+
id: string;
|
|
87
87
|
installed: true;
|
|
88
88
|
};
|
|
89
89
|
outputFormat: "json";
|
|
@@ -100,8 +100,8 @@ export declare function createAgentsRouter(getAgent: GetAgentFn, context: Agents
|
|
|
100
100
|
};
|
|
101
101
|
};
|
|
102
102
|
output: {
|
|
103
|
-
id: string;
|
|
104
103
|
name: string;
|
|
104
|
+
id: string;
|
|
105
105
|
switched: true;
|
|
106
106
|
};
|
|
107
107
|
outputFormat: "json";
|
|
@@ -150,15 +150,15 @@ export declare function createAgentsRouter(getAgent: GetAgentFn, context: Agents
|
|
|
150
150
|
json: {
|
|
151
151
|
description: string;
|
|
152
152
|
config: Record<string, any>;
|
|
153
|
-
id: string;
|
|
154
153
|
name: string;
|
|
154
|
+
id: string;
|
|
155
155
|
tags?: string[] | undefined;
|
|
156
156
|
author?: string | undefined;
|
|
157
157
|
};
|
|
158
158
|
};
|
|
159
159
|
output: {
|
|
160
|
-
id: string;
|
|
161
160
|
name: string;
|
|
161
|
+
id: string;
|
|
162
162
|
created: true;
|
|
163
163
|
};
|
|
164
164
|
outputFormat: "json";
|
|
@@ -23,6 +23,7 @@ __export(approvals_exports, {
|
|
|
23
23
|
module.exports = __toCommonJS(approvals_exports);
|
|
24
24
|
var import_zod_openapi = require("@hono/zod-openapi");
|
|
25
25
|
var import_core = require("@dexto/core");
|
|
26
|
+
var import_responses = require("../schemas/responses.js");
|
|
26
27
|
const ApprovalBodySchema = import_zod_openapi.z.object({
|
|
27
28
|
status: import_zod_openapi.z.enum([import_core.ApprovalStatus.APPROVED, import_core.ApprovalStatus.DENIED, import_core.ApprovalStatus.CANCELLED]).describe("The user decision"),
|
|
28
29
|
formData: import_zod_openapi.z.record(import_zod_openapi.z.unknown()).optional().describe("Optional form data provided by the user (for elicitation)"),
|
|
@@ -167,13 +168,20 @@ function createApprovalsRouter(getAgent, approvalCoordinator) {
|
|
|
167
168
|
}
|
|
168
169
|
},
|
|
169
170
|
404: {
|
|
170
|
-
description: "Approval request not found or expired"
|
|
171
|
+
description: "Approval request not found or expired",
|
|
172
|
+
content: { "application/json": { schema: import_responses.ApiErrorResponseSchema } }
|
|
171
173
|
},
|
|
172
174
|
400: {
|
|
173
|
-
description: "Validation error"
|
|
175
|
+
description: "Validation error",
|
|
176
|
+
content: { "application/json": { schema: import_responses.ApiErrorResponseSchema } }
|
|
174
177
|
},
|
|
175
178
|
503: {
|
|
176
|
-
description: "Approval coordinator unavailable (server not initialized for approvals)"
|
|
179
|
+
description: "Approval coordinator unavailable (server not initialized for approvals)",
|
|
180
|
+
content: { "application/json": { schema: ApprovalResponseSchema } }
|
|
181
|
+
},
|
|
182
|
+
500: {
|
|
183
|
+
description: "Approval processing failed",
|
|
184
|
+
content: { "application/json": { schema: ApprovalResponseSchema } }
|
|
177
185
|
}
|
|
178
186
|
}
|
|
179
187
|
});
|
|
@@ -247,11 +255,14 @@ function createApprovalsRouter(getAgent, approvalCoordinator) {
|
|
|
247
255
|
...Object.keys(data).length > 0 ? { data } : {}
|
|
248
256
|
};
|
|
249
257
|
approvalCoordinator.emitResponse(responsePayload);
|
|
250
|
-
return ctx.json(
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
258
|
+
return ctx.json(
|
|
259
|
+
{
|
|
260
|
+
ok: true,
|
|
261
|
+
approvalId,
|
|
262
|
+
status
|
|
263
|
+
},
|
|
264
|
+
200
|
|
265
|
+
);
|
|
255
266
|
} catch (error) {
|
|
256
267
|
agent.logger.error("Error processing approval", { approvalId, error });
|
|
257
268
|
return ctx.json({ ok: false, approvalId, status }, 500);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OpenAPIHono } from '@hono/zod-openapi';
|
|
2
|
-
import { type DextoAgent
|
|
2
|
+
import { type DextoAgent } from '@dexto/core';
|
|
3
3
|
import type { ApprovalCoordinator } from '../../approval/approval-coordinator.js';
|
|
4
4
|
import type { Context } from 'hono';
|
|
5
5
|
type GetAgentFn = (ctx: Context) => DextoAgent | Promise<DextoAgent>;
|
|
@@ -41,17 +41,17 @@ export declare function createApprovalsRouter(getAgent: GetAgentFn, approvalCoor
|
|
|
41
41
|
};
|
|
42
42
|
} & {
|
|
43
43
|
json: {
|
|
44
|
-
status:
|
|
44
|
+
status: "approved" | "denied" | "cancelled";
|
|
45
45
|
message?: string | undefined;
|
|
46
46
|
formData?: Record<string, unknown> | undefined;
|
|
47
47
|
rememberChoice?: boolean | undefined;
|
|
48
48
|
rememberPattern?: string | undefined;
|
|
49
49
|
rememberDirectory?: boolean | undefined;
|
|
50
|
-
reason?:
|
|
50
|
+
reason?: "timeout" | "user_denied" | "system_denied" | "user_cancelled" | "system_cancelled" | "validation_failed" | "elicitation_disabled" | undefined;
|
|
51
51
|
};
|
|
52
52
|
};
|
|
53
|
-
output:
|
|
54
|
-
outputFormat:
|
|
53
|
+
output: never;
|
|
54
|
+
outputFormat: "json";
|
|
55
55
|
status: 400;
|
|
56
56
|
} | {
|
|
57
57
|
input: {
|
|
@@ -64,17 +64,17 @@ export declare function createApprovalsRouter(getAgent: GetAgentFn, approvalCoor
|
|
|
64
64
|
};
|
|
65
65
|
} & {
|
|
66
66
|
json: {
|
|
67
|
-
status:
|
|
67
|
+
status: "approved" | "denied" | "cancelled";
|
|
68
68
|
message?: string | undefined;
|
|
69
69
|
formData?: Record<string, unknown> | undefined;
|
|
70
70
|
rememberChoice?: boolean | undefined;
|
|
71
71
|
rememberPattern?: string | undefined;
|
|
72
72
|
rememberDirectory?: boolean | undefined;
|
|
73
|
-
reason?:
|
|
73
|
+
reason?: "timeout" | "user_denied" | "system_denied" | "user_cancelled" | "system_cancelled" | "validation_failed" | "elicitation_disabled" | undefined;
|
|
74
74
|
};
|
|
75
75
|
};
|
|
76
|
-
output:
|
|
77
|
-
outputFormat:
|
|
76
|
+
output: never;
|
|
77
|
+
outputFormat: "json";
|
|
78
78
|
status: 404;
|
|
79
79
|
} | {
|
|
80
80
|
input: {
|
|
@@ -87,18 +87,22 @@ export declare function createApprovalsRouter(getAgent: GetAgentFn, approvalCoor
|
|
|
87
87
|
};
|
|
88
88
|
} & {
|
|
89
89
|
json: {
|
|
90
|
-
status:
|
|
90
|
+
status: "approved" | "denied" | "cancelled";
|
|
91
91
|
message?: string | undefined;
|
|
92
92
|
formData?: Record<string, unknown> | undefined;
|
|
93
93
|
rememberChoice?: boolean | undefined;
|
|
94
94
|
rememberPattern?: string | undefined;
|
|
95
95
|
rememberDirectory?: boolean | undefined;
|
|
96
|
-
reason?:
|
|
96
|
+
reason?: "timeout" | "user_denied" | "system_denied" | "user_cancelled" | "system_cancelled" | "validation_failed" | "elicitation_disabled" | undefined;
|
|
97
97
|
};
|
|
98
98
|
};
|
|
99
|
-
output: {
|
|
100
|
-
|
|
101
|
-
|
|
99
|
+
output: {
|
|
100
|
+
status: "approved" | "denied" | "cancelled";
|
|
101
|
+
ok: boolean;
|
|
102
|
+
approvalId: string;
|
|
103
|
+
};
|
|
104
|
+
outputFormat: "json";
|
|
105
|
+
status: 200;
|
|
102
106
|
} | {
|
|
103
107
|
input: {
|
|
104
108
|
param: {
|
|
@@ -110,22 +114,49 @@ export declare function createApprovalsRouter(getAgent: GetAgentFn, approvalCoor
|
|
|
110
114
|
};
|
|
111
115
|
} & {
|
|
112
116
|
json: {
|
|
113
|
-
status:
|
|
117
|
+
status: "approved" | "denied" | "cancelled";
|
|
114
118
|
message?: string | undefined;
|
|
115
119
|
formData?: Record<string, unknown> | undefined;
|
|
116
120
|
rememberChoice?: boolean | undefined;
|
|
117
121
|
rememberPattern?: string | undefined;
|
|
118
122
|
rememberDirectory?: boolean | undefined;
|
|
119
|
-
reason?:
|
|
123
|
+
reason?: "timeout" | "user_denied" | "system_denied" | "user_cancelled" | "system_cancelled" | "validation_failed" | "elicitation_disabled" | undefined;
|
|
120
124
|
};
|
|
121
125
|
};
|
|
122
126
|
output: {
|
|
123
|
-
status:
|
|
127
|
+
status: "approved" | "denied" | "cancelled";
|
|
124
128
|
ok: boolean;
|
|
125
129
|
approvalId: string;
|
|
126
130
|
};
|
|
127
131
|
outputFormat: "json";
|
|
128
|
-
status:
|
|
132
|
+
status: 500;
|
|
133
|
+
} | {
|
|
134
|
+
input: {
|
|
135
|
+
param: {
|
|
136
|
+
approvalId: string;
|
|
137
|
+
};
|
|
138
|
+
} & {
|
|
139
|
+
header: {
|
|
140
|
+
'Idempotency-Key'?: string | undefined;
|
|
141
|
+
};
|
|
142
|
+
} & {
|
|
143
|
+
json: {
|
|
144
|
+
status: "approved" | "denied" | "cancelled";
|
|
145
|
+
message?: string | undefined;
|
|
146
|
+
formData?: Record<string, unknown> | undefined;
|
|
147
|
+
rememberChoice?: boolean | undefined;
|
|
148
|
+
rememberPattern?: string | undefined;
|
|
149
|
+
rememberDirectory?: boolean | undefined;
|
|
150
|
+
reason?: "timeout" | "user_denied" | "system_denied" | "user_cancelled" | "system_cancelled" | "validation_failed" | "elicitation_disabled" | undefined;
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
output: {
|
|
154
|
+
status: "approved" | "denied" | "cancelled";
|
|
155
|
+
ok: boolean;
|
|
156
|
+
approvalId: string;
|
|
157
|
+
};
|
|
158
|
+
outputFormat: "json";
|
|
159
|
+
status: 503;
|
|
129
160
|
};
|
|
130
161
|
};
|
|
131
162
|
}, "/">;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"approvals.d.ts","sourceRoot":"","sources":["../../../src/hono/routes/approvals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkB,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAE,KAAK,UAAU,
|
|
1
|
+
{"version":3,"file":"approvals.d.ts","sourceRoot":"","sources":["../../../src/hono/routes/approvals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkB,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAE,KAAK,UAAU,EAA+C,MAAM,aAAa,CAAC;AAC3F,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAElF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,KAAK,UAAU,GAAG,CAAC,GAAG,EAAE,OAAO,KAAK,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAqIrE,wBAAgB,qBAAqB,CACjC,QAAQ,EAAE,UAAU,EACpB,mBAAmB,CAAC,EAAE,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA6L5C"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { OpenAPIHono, createRoute, z } from "@hono/zod-openapi";
|
|
2
2
|
import { DenialReason, ApprovalStatus, ApprovalError } from "@dexto/core";
|
|
3
|
+
import { ApiErrorResponseSchema } from "../schemas/responses.js";
|
|
3
4
|
const ApprovalBodySchema = z.object({
|
|
4
5
|
status: z.enum([ApprovalStatus.APPROVED, ApprovalStatus.DENIED, ApprovalStatus.CANCELLED]).describe("The user decision"),
|
|
5
6
|
formData: z.record(z.unknown()).optional().describe("Optional form data provided by the user (for elicitation)"),
|
|
@@ -144,13 +145,20 @@ function createApprovalsRouter(getAgent, approvalCoordinator) {
|
|
|
144
145
|
}
|
|
145
146
|
},
|
|
146
147
|
404: {
|
|
147
|
-
description: "Approval request not found or expired"
|
|
148
|
+
description: "Approval request not found or expired",
|
|
149
|
+
content: { "application/json": { schema: ApiErrorResponseSchema } }
|
|
148
150
|
},
|
|
149
151
|
400: {
|
|
150
|
-
description: "Validation error"
|
|
152
|
+
description: "Validation error",
|
|
153
|
+
content: { "application/json": { schema: ApiErrorResponseSchema } }
|
|
151
154
|
},
|
|
152
155
|
503: {
|
|
153
|
-
description: "Approval coordinator unavailable (server not initialized for approvals)"
|
|
156
|
+
description: "Approval coordinator unavailable (server not initialized for approvals)",
|
|
157
|
+
content: { "application/json": { schema: ApprovalResponseSchema } }
|
|
158
|
+
},
|
|
159
|
+
500: {
|
|
160
|
+
description: "Approval processing failed",
|
|
161
|
+
content: { "application/json": { schema: ApprovalResponseSchema } }
|
|
154
162
|
}
|
|
155
163
|
}
|
|
156
164
|
});
|
|
@@ -224,11 +232,14 @@ function createApprovalsRouter(getAgent, approvalCoordinator) {
|
|
|
224
232
|
...Object.keys(data).length > 0 ? { data } : {}
|
|
225
233
|
};
|
|
226
234
|
approvalCoordinator.emitResponse(responsePayload);
|
|
227
|
-
return ctx.json(
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
235
|
+
return ctx.json(
|
|
236
|
+
{
|
|
237
|
+
ok: true,
|
|
238
|
+
approvalId,
|
|
239
|
+
status
|
|
240
|
+
},
|
|
241
|
+
200
|
|
242
|
+
);
|
|
232
243
|
} catch (error) {
|
|
233
244
|
agent.logger.error("Error processing approval", { approvalId, error });
|
|
234
245
|
return ctx.json({ ok: false, approvalId, status }, 500);
|