@dexto/server 1.3.0 → 1.5.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.
Files changed (109) hide show
  1. package/dist/approval/manual-approval-handler.cjs +23 -15
  2. package/dist/approval/manual-approval-handler.d.ts.map +1 -1
  3. package/dist/approval/manual-approval-handler.js +23 -15
  4. package/dist/events/webhook-subscriber.cjs +1 -1
  5. package/dist/events/webhook-subscriber.d.ts.map +1 -1
  6. package/dist/events/webhook-subscriber.js +1 -1
  7. package/dist/hono/__tests__/test-fixtures.cjs +3 -3
  8. package/dist/hono/__tests__/test-fixtures.d.ts.map +1 -1
  9. package/dist/hono/__tests__/test-fixtures.js +3 -3
  10. package/dist/hono/index.cjs +46 -5
  11. package/dist/hono/index.d.ts +928 -584
  12. package/dist/hono/index.d.ts.map +1 -1
  13. package/dist/hono/index.js +46 -5
  14. package/dist/hono/middleware/error.d.ts.map +1 -1
  15. package/dist/hono/routes/a2a-jsonrpc.cjs +3 -3
  16. package/dist/hono/routes/a2a-jsonrpc.d.ts +4 -1
  17. package/dist/hono/routes/a2a-jsonrpc.d.ts.map +1 -1
  18. package/dist/hono/routes/a2a-jsonrpc.js +3 -3
  19. package/dist/hono/routes/a2a-tasks.cjs +5 -5
  20. package/dist/hono/routes/a2a-tasks.d.ts +13 -10
  21. package/dist/hono/routes/a2a-tasks.d.ts.map +1 -1
  22. package/dist/hono/routes/a2a-tasks.js +5 -5
  23. package/dist/hono/routes/agents.cjs +30 -42
  24. package/dist/hono/routes/agents.d.ts +7 -401
  25. package/dist/hono/routes/agents.d.ts.map +1 -1
  26. package/dist/hono/routes/agents.js +32 -42
  27. package/dist/hono/routes/approvals.cjs +53 -2
  28. package/dist/hono/routes/approvals.d.ts +29 -1
  29. package/dist/hono/routes/approvals.d.ts.map +1 -1
  30. package/dist/hono/routes/approvals.js +53 -2
  31. package/dist/hono/routes/discovery.cjs +67 -0
  32. package/dist/hono/routes/discovery.d.ts +44 -0
  33. package/dist/hono/routes/discovery.d.ts.map +1 -0
  34. package/dist/hono/routes/discovery.js +43 -0
  35. package/dist/hono/routes/greeting.cjs +2 -2
  36. package/dist/hono/routes/greeting.d.ts +2 -2
  37. package/dist/hono/routes/greeting.d.ts.map +1 -1
  38. package/dist/hono/routes/greeting.js +2 -2
  39. package/dist/hono/routes/health.d.ts +2 -2
  40. package/dist/hono/routes/health.d.ts.map +1 -1
  41. package/dist/hono/routes/key.cjs +110 -0
  42. package/dist/hono/routes/key.d.ts +48 -0
  43. package/dist/hono/routes/key.d.ts.map +1 -0
  44. package/dist/hono/routes/key.js +90 -0
  45. package/dist/hono/routes/llm.cjs +119 -62
  46. package/dist/hono/routes/llm.d.ts +242 -42
  47. package/dist/hono/routes/llm.d.ts.map +1 -1
  48. package/dist/hono/routes/llm.js +118 -58
  49. package/dist/hono/routes/mcp.cjs +16 -12
  50. package/dist/hono/routes/mcp.d.ts +6 -3
  51. package/dist/hono/routes/mcp.d.ts.map +1 -1
  52. package/dist/hono/routes/mcp.js +17 -13
  53. package/dist/hono/routes/memory.cjs +5 -5
  54. package/dist/hono/routes/memory.d.ts +5 -2
  55. package/dist/hono/routes/memory.d.ts.map +1 -1
  56. package/dist/hono/routes/memory.js +5 -5
  57. package/dist/hono/routes/messages.cjs +58 -66
  58. package/dist/hono/routes/messages.d.ts +99 -55
  59. package/dist/hono/routes/messages.d.ts.map +1 -1
  60. package/dist/hono/routes/messages.js +59 -67
  61. package/dist/hono/routes/models.cjs +319 -0
  62. package/dist/hono/routes/models.d.ts +107 -0
  63. package/dist/hono/routes/models.d.ts.map +1 -0
  64. package/dist/hono/routes/models.js +305 -0
  65. package/dist/hono/routes/openrouter.cjs +153 -0
  66. package/dist/hono/routes/openrouter.d.ts +54 -0
  67. package/dist/hono/routes/openrouter.d.ts.map +1 -0
  68. package/dist/hono/routes/openrouter.js +134 -0
  69. package/dist/hono/routes/prompts.cjs +5 -5
  70. package/dist/hono/routes/prompts.d.ts +10 -7
  71. package/dist/hono/routes/prompts.d.ts.map +1 -1
  72. package/dist/hono/routes/prompts.js +5 -5
  73. package/dist/hono/routes/queue.cjs +202 -0
  74. package/dist/hono/routes/queue.d.ts +174 -0
  75. package/dist/hono/routes/queue.d.ts.map +1 -0
  76. package/dist/hono/routes/queue.js +178 -0
  77. package/dist/hono/routes/resources.cjs +3 -3
  78. package/dist/hono/routes/resources.d.ts +3 -3
  79. package/dist/hono/routes/resources.d.ts.map +1 -1
  80. package/dist/hono/routes/resources.js +3 -3
  81. package/dist/hono/routes/search.cjs +2 -2
  82. package/dist/hono/routes/search.d.ts +39 -10
  83. package/dist/hono/routes/search.d.ts.map +1 -1
  84. package/dist/hono/routes/search.js +2 -2
  85. package/dist/hono/routes/sessions.cjs +74 -20
  86. package/dist/hono/routes/sessions.d.ts +25 -4
  87. package/dist/hono/routes/sessions.d.ts.map +1 -1
  88. package/dist/hono/routes/sessions.js +74 -20
  89. package/dist/hono/routes/tools.cjs +126 -0
  90. package/dist/hono/routes/tools.d.ts +42 -0
  91. package/dist/hono/routes/tools.d.ts.map +1 -0
  92. package/dist/hono/routes/tools.js +102 -0
  93. package/dist/hono/routes/webhooks.cjs +4 -4
  94. package/dist/hono/routes/webhooks.d.ts +4 -1
  95. package/dist/hono/routes/webhooks.d.ts.map +1 -1
  96. package/dist/hono/routes/webhooks.js +4 -4
  97. package/dist/hono/schemas/responses.cjs +24 -5
  98. package/dist/hono/schemas/responses.d.ts +838 -120
  99. package/dist/hono/schemas/responses.d.ts.map +1 -1
  100. package/dist/hono/schemas/responses.js +24 -10
  101. package/dist/hono/start-server.cjs +102 -0
  102. package/dist/hono/start-server.d.ts +61 -0
  103. package/dist/hono/start-server.d.ts.map +1 -0
  104. package/dist/hono/start-server.js +78 -0
  105. package/dist/index.cjs +2 -0
  106. package/dist/index.d.ts +1 -0
  107. package/dist/index.d.ts.map +1 -1
  108. package/dist/index.js +1 -0
  109. package/package.json +5 -4
@@ -1,5 +1,7 @@
1
- import { OpenAPIHono, z } from '@hono/zod-openapi';
1
+ import { OpenAPIHono } from '@hono/zod-openapi';
2
2
  import type { DextoAgent } from '@dexto/core';
3
+ import type { Context } from 'hono';
4
+ type GetAgentFn = (ctx: Context) => DextoAgent | Promise<DextoAgent>;
3
5
  export type AgentsRouterContext = {
4
6
  switchAgentById: (agentId: string) => Promise<{
5
7
  id: string;
@@ -16,7 +18,7 @@ export type AgentsRouterContext = {
16
18
  ensureAgentAvailable: () => void;
17
19
  getActiveAgentId: () => string | undefined;
18
20
  };
19
- export declare function createAgentsRouter(getAgent: () => DextoAgent, context: AgentsRouterContext): OpenAPIHono<import("hono").Env, {
21
+ export declare function createAgentsRouter(getAgent: GetAgentFn, context: AgentsRouterContext): OpenAPIHono<import("hono").Env, {
20
22
  "/agents": {
21
23
  $get: {
22
24
  input: {};
@@ -66,16 +68,15 @@ export declare function createAgentsRouter(getAgent: () => DextoAgent, context:
66
68
  id: string;
67
69
  path?: string | undefined;
68
70
  } | {
69
- id: string;
70
71
  metadata: {
71
72
  tags: string[];
72
73
  description: string;
73
74
  author: string;
74
75
  main?: string | undefined;
75
76
  };
77
+ id: string;
76
78
  sourcePath: string;
77
79
  name?: string | undefined;
78
- injectPreferences?: boolean | undefined;
79
80
  };
80
81
  };
81
82
  output: {
@@ -147,403 +148,7 @@ export declare function createAgentsRouter(getAgent: () => DextoAgent, context:
147
148
  input: {
148
149
  json: {
149
150
  description: string;
150
- config: {
151
- llm: {
152
- apiKey: string;
153
- model: string;
154
- provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere";
155
- router?: "vercel" | "in-built" | undefined;
156
- maxIterations?: number | undefined;
157
- baseURL?: string | undefined;
158
- maxInputTokens?: number | undefined;
159
- maxOutputTokens?: number | undefined;
160
- temperature?: number | undefined;
161
- allowedMediaTypes?: string[] | undefined;
162
- };
163
- systemPrompt: string | {
164
- contributors?: ({
165
- type: "static";
166
- content: string;
167
- id: string;
168
- priority: number;
169
- enabled?: boolean | undefined;
170
- } | {
171
- type: "dynamic";
172
- id: string;
173
- source: "resources" | "dateTime";
174
- priority: number;
175
- enabled?: boolean | undefined;
176
- } | {
177
- type: "file";
178
- id: string;
179
- priority: number;
180
- files: string[];
181
- options?: {
182
- includeFilenames?: boolean | undefined;
183
- separator?: string | undefined;
184
- errorHandling?: "error" | "skip" | undefined;
185
- maxFileSize?: number | undefined;
186
- includeMetadata?: boolean | undefined;
187
- } | undefined;
188
- enabled?: boolean | undefined;
189
- })[] | undefined;
190
- };
191
- storage?: {
192
- database: {
193
- type: "in-memory";
194
- options?: Record<string, any> | undefined;
195
- maxConnections?: number | undefined;
196
- idleTimeoutMillis?: number | undefined;
197
- connectionTimeoutMillis?: number | undefined;
198
- } | {
199
- path: string;
200
- type: "sqlite";
201
- options?: Record<string, any> | undefined;
202
- maxConnections?: number | undefined;
203
- idleTimeoutMillis?: number | undefined;
204
- connectionTimeoutMillis?: number | undefined;
205
- } | {
206
- type: "postgres";
207
- password?: string | undefined;
208
- options?: Record<string, any> | undefined;
209
- url?: string | undefined;
210
- maxConnections?: number | undefined;
211
- idleTimeoutMillis?: number | undefined;
212
- connectionTimeoutMillis?: number | undefined;
213
- host?: string | undefined;
214
- port?: number | undefined;
215
- database?: string | undefined;
216
- connectionString?: string | undefined;
217
- };
218
- cache: {
219
- type: "in-memory";
220
- options?: Record<string, any> | undefined;
221
- maxConnections?: number | undefined;
222
- idleTimeoutMillis?: number | undefined;
223
- connectionTimeoutMillis?: number | undefined;
224
- } | {
225
- type: "redis";
226
- password?: string | undefined;
227
- options?: Record<string, any> | undefined;
228
- url?: string | undefined;
229
- maxConnections?: number | undefined;
230
- idleTimeoutMillis?: number | undefined;
231
- connectionTimeoutMillis?: number | undefined;
232
- host?: string | undefined;
233
- port?: number | undefined;
234
- database?: number | undefined;
235
- };
236
- blob: {
237
- type: "in-memory";
238
- maxBlobSize?: number | undefined;
239
- maxTotalSize?: number | undefined;
240
- } | {
241
- type: "local";
242
- storePath: string;
243
- maxBlobSize?: number | undefined;
244
- maxTotalSize?: number | undefined;
245
- cleanupAfterDays?: number | undefined;
246
- };
247
- } | undefined;
248
- telemetry?: {
249
- enabled?: boolean | undefined;
250
- serviceName?: string | undefined;
251
- tracerName?: string | undefined;
252
- export?: {
253
- type: "otlp";
254
- headers?: Record<string, string> | undefined;
255
- protocol?: "http" | "grpc" | undefined;
256
- endpoint?: string | undefined;
257
- } | {
258
- type: "console";
259
- } | undefined;
260
- } | undefined;
261
- logger?: {
262
- level?: "debug" | "info" | "warn" | "error" | "silly" | undefined;
263
- transports?: ({
264
- type: "console";
265
- colorize?: boolean | undefined;
266
- } | {
267
- path: string;
268
- type: "file";
269
- maxFiles?: number | undefined;
270
- maxSize?: number | undefined;
271
- } | {
272
- token: string;
273
- type: "upstash";
274
- url: string;
275
- listName?: string | undefined;
276
- maxListLength?: number | undefined;
277
- batchSize?: number | undefined;
278
- })[] | undefined;
279
- } | undefined;
280
- elicitation?: {
281
- timeout?: number | undefined;
282
- enabled?: boolean | undefined;
283
- } | undefined;
284
- prompts?: ({
285
- prompt: string;
286
- type: "inline";
287
- id: string;
288
- description?: string | undefined;
289
- title?: string | undefined;
290
- priority?: number | undefined;
291
- category?: string | undefined;
292
- showInStarters?: boolean | undefined;
293
- } | {
294
- file: string;
295
- type: "file";
296
- showInStarters?: boolean | undefined;
297
- })[] | undefined;
298
- agentId?: string | undefined;
299
- agentCard?: {
300
- description: string;
301
- url: string;
302
- name: string;
303
- version: string;
304
- metadata?: z.objectInputType<{
305
- dexto: z.ZodOptional<z.ZodObject<{
306
- authentication: z.ZodOptional<z.ZodObject<{
307
- schemes: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
308
- credentials: z.ZodOptional<z.ZodString>;
309
- }, "strict", z.ZodTypeAny, {
310
- schemes: string[];
311
- credentials?: string | undefined;
312
- }, {
313
- schemes?: string[] | undefined;
314
- credentials?: string | undefined;
315
- }>>;
316
- delegation: z.ZodOptional<z.ZodObject<{
317
- protocol: z.ZodEnum<["dexto-v1", "http-simple", "a2a-jsonrpc", "mcp-http"]>;
318
- endpoint: z.ZodString;
319
- supportsSession: z.ZodBoolean;
320
- supportsStreaming: z.ZodOptional<z.ZodBoolean>;
321
- }, "strict", z.ZodTypeAny, {
322
- protocol: "dexto-v1" | "http-simple" | "a2a-jsonrpc" | "mcp-http";
323
- endpoint: string;
324
- supportsSession: boolean;
325
- supportsStreaming?: boolean | undefined;
326
- }, {
327
- protocol: "dexto-v1" | "http-simple" | "a2a-jsonrpc" | "mcp-http";
328
- endpoint: string;
329
- supportsSession: boolean;
330
- supportsStreaming?: boolean | undefined;
331
- }>>;
332
- owner: z.ZodOptional<z.ZodObject<{
333
- userId: z.ZodString;
334
- username: z.ZodString;
335
- email: z.ZodOptional<z.ZodString>;
336
- }, "strict", z.ZodTypeAny, {
337
- userId: string;
338
- username: string;
339
- email?: string | undefined;
340
- }, {
341
- userId: string;
342
- username: string;
343
- email?: string | undefined;
344
- }>>;
345
- }, "strict", z.ZodTypeAny, {
346
- authentication?: {
347
- schemes: string[];
348
- credentials?: string | undefined;
349
- } | undefined;
350
- delegation?: {
351
- protocol: "dexto-v1" | "http-simple" | "a2a-jsonrpc" | "mcp-http";
352
- endpoint: string;
353
- supportsSession: boolean;
354
- supportsStreaming?: boolean | undefined;
355
- } | undefined;
356
- owner?: {
357
- userId: string;
358
- username: string;
359
- email?: string | undefined;
360
- } | undefined;
361
- }, {
362
- authentication?: {
363
- schemes?: string[] | undefined;
364
- credentials?: string | undefined;
365
- } | undefined;
366
- delegation?: {
367
- protocol: "dexto-v1" | "http-simple" | "a2a-jsonrpc" | "mcp-http";
368
- endpoint: string;
369
- supportsSession: boolean;
370
- supportsStreaming?: boolean | undefined;
371
- } | undefined;
372
- owner?: {
373
- userId: string;
374
- username: string;
375
- email?: string | undefined;
376
- } | undefined;
377
- }>>;
378
- }, z.ZodTypeAny, "passthrough"> | undefined;
379
- capabilities?: {
380
- streaming?: boolean | undefined;
381
- pushNotifications?: boolean | undefined;
382
- stateTransitionHistory?: boolean | undefined;
383
- } | undefined;
384
- provider?: {
385
- url: string;
386
- organization: string;
387
- } | undefined;
388
- protocolVersion?: string | undefined;
389
- preferredTransport?: "JSONRPC" | "GRPC" | "HTTP+JSON" | undefined;
390
- defaultInputModes?: string[] | undefined;
391
- defaultOutputModes?: string[] | undefined;
392
- skills?: {
393
- description: string;
394
- name: string;
395
- id: string;
396
- tags: string[];
397
- examples?: string[] | undefined;
398
- inputModes?: string[] | undefined;
399
- outputModes?: string[] | undefined;
400
- }[] | undefined;
401
- iconUrl?: string | undefined;
402
- documentationUrl?: string | undefined;
403
- additionalInterfaces?: {
404
- url: string;
405
- transport: "JSONRPC" | "GRPC" | "HTTP+JSON";
406
- }[] | undefined;
407
- securitySchemes?: Record<string, {
408
- type: "apiKey";
409
- name: string;
410
- in: "query" | "header" | "cookie";
411
- description?: string | undefined;
412
- } | {
413
- type: "http";
414
- scheme: string;
415
- description?: string | undefined;
416
- bearerFormat?: string | undefined;
417
- } | {
418
- type: "oauth2";
419
- flows: {
420
- password?: {
421
- scopes: Record<string, string>;
422
- authorizationUrl?: string | undefined;
423
- tokenUrl?: string | undefined;
424
- refreshUrl?: string | undefined;
425
- } | undefined;
426
- implicit?: {
427
- scopes: Record<string, string>;
428
- authorizationUrl?: string | undefined;
429
- tokenUrl?: string | undefined;
430
- refreshUrl?: string | undefined;
431
- } | undefined;
432
- clientCredentials?: {
433
- scopes: Record<string, string>;
434
- authorizationUrl?: string | undefined;
435
- tokenUrl?: string | undefined;
436
- refreshUrl?: string | undefined;
437
- } | undefined;
438
- authorizationCode?: {
439
- scopes: Record<string, string>;
440
- authorizationUrl?: string | undefined;
441
- tokenUrl?: string | undefined;
442
- refreshUrl?: string | undefined;
443
- } | undefined;
444
- };
445
- description?: string | undefined;
446
- } | {
447
- type: "openIdConnect";
448
- openIdConnectUrl: string;
449
- description?: string | undefined;
450
- } | {
451
- type: "mutualTLS";
452
- description?: string | undefined;
453
- }> | undefined;
454
- security?: Record<string, string[]>[] | undefined;
455
- supportsAuthenticatedExtendedCard?: boolean | undefined;
456
- signatures?: {
457
- protected: string;
458
- signature: string;
459
- }[] | undefined;
460
- } | undefined;
461
- greeting?: string | undefined;
462
- memories?: {
463
- enabled?: boolean | undefined;
464
- limit?: number | undefined;
465
- priority?: number | undefined;
466
- includeTimestamps?: boolean | undefined;
467
- includeTags?: boolean | undefined;
468
- pinnedOnly?: boolean | undefined;
469
- } | undefined;
470
- mcpServers?: Record<string, {
471
- type: "stdio";
472
- command: string;
473
- timeout?: number | undefined;
474
- args?: string[] | undefined;
475
- env?: Record<string, string> | undefined;
476
- connectionMode?: "strict" | "lenient" | undefined;
477
- } | {
478
- type: "sse";
479
- url: string;
480
- timeout?: number | undefined;
481
- connectionMode?: "strict" | "lenient" | undefined;
482
- headers?: Record<string, string> | undefined;
483
- } | {
484
- type: "http";
485
- url: string;
486
- timeout?: number | undefined;
487
- connectionMode?: "strict" | "lenient" | undefined;
488
- headers?: Record<string, string> | undefined;
489
- }> | undefined;
490
- internalTools?: ("search_history" | "ask_user" | "read_file" | "glob_files" | "grep_content" | "write_file" | "edit_file" | "bash_exec" | "bash_output" | "kill_process" | "delegate_to_url")[] | undefined;
491
- sessions?: {
492
- maxSessions?: number | undefined;
493
- sessionTTL?: number | undefined;
494
- } | undefined;
495
- toolConfirmation?: {
496
- timeout?: number | undefined;
497
- mode?: "manual" | "auto-approve" | "auto-deny" | undefined;
498
- allowedToolsStorage?: "storage" | "memory" | undefined;
499
- toolPolicies?: {
500
- alwaysAllow?: string[] | undefined;
501
- alwaysDeny?: string[] | undefined;
502
- } | undefined;
503
- } | undefined;
504
- internalResources?: ({
505
- type: "filesystem";
506
- paths: string[];
507
- maxFiles?: number | undefined;
508
- maxDepth?: number | undefined;
509
- includeHidden?: boolean | undefined;
510
- includeExtensions?: string[] | undefined;
511
- } | {
512
- type: "blob";
513
- })[] | {
514
- enabled?: boolean | undefined;
515
- resources?: ({
516
- type: "filesystem";
517
- paths: string[];
518
- maxFiles?: number | undefined;
519
- maxDepth?: number | undefined;
520
- includeHidden?: boolean | undefined;
521
- includeExtensions?: string[] | undefined;
522
- } | {
523
- type: "blob";
524
- })[] | undefined;
525
- } | undefined;
526
- plugins?: {
527
- custom?: {
528
- name: string;
529
- priority: number;
530
- module: string;
531
- blocking: boolean;
532
- config?: Record<string, any> | undefined;
533
- enabled?: boolean | undefined;
534
- }[] | undefined;
535
- contentPolicy?: z.objectInputType<{
536
- priority: z.ZodNumber;
537
- blocking: z.ZodOptional<z.ZodBoolean>;
538
- enabled: z.ZodDefault<z.ZodBoolean>;
539
- }, z.ZodTypeAny, "passthrough"> | undefined;
540
- responseSanitizer?: z.objectInputType<{
541
- priority: z.ZodNumber;
542
- blocking: z.ZodOptional<z.ZodBoolean>;
543
- enabled: z.ZodDefault<z.ZodBoolean>;
544
- }, z.ZodTypeAny, "passthrough"> | undefined;
545
- } | undefined;
546
- };
151
+ config: Record<string, any>;
547
152
  id: string;
548
153
  name: string;
549
154
  tags?: string[] | undefined;
@@ -650,4 +255,5 @@ export declare function createAgentsRouter(getAgent: () => DextoAgent, context:
650
255
  };
651
256
  };
652
257
  }, "/">;
258
+ export {};
653
259
  //# sourceMappingURL=agents.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../../src/hono/routes/agents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAe,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAsN9C,MAAM,MAAM,mBAAmB,GAAG;IAC9B,eAAe,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC5E,iBAAiB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;QAAE,EAAE,EAAE,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ayName,
14
+ AgentFactory
13
15
  } from "@dexto/agent-management";
14
- import { Dexto, deriveDisplayName } from "@dexto/agent-management";
15
16
  import { stringify as yamlStringify, parse as yamlParse } from "yaml";
16
17
  import os from "os";
17
18
  import path from "path";
18
19
  import { promises as fs } from "fs";
19
20
  import { DextoValidationError, AgentErrorCode, ErrorScope, ErrorType } from "@dexto/core";
20
21
  import { AgentRegistryEntrySchema } from "../schemas/responses.js";
22
+ const AgentConfigSchemaForOpenAPI = z.record(z.any()).describe(
23
+ "Complete agent configuration. See AgentConfig type documentation for full schema details."
24
+ );
21
25
  const AgentIdentifierSchema = z.object({
22
26
  id: z.string().min(1, "Agent id is required").describe('Unique agent identifier (e.g., "database-agent")'),
23
27
  path: z.string().optional().describe(
@@ -37,16 +41,14 @@ const CustomAgentInstallSchema = z.object({
37
41
  author: z.string().min(1).describe("Agent author or organization name"),
38
42
  tags: z.array(z.string()).describe("Tags for categorizing the agent"),
39
43
  main: z.string().optional().describe("Main configuration file name within source directory")
40
- }).strict().describe("Agent metadata including description, author, and tags"),
41
- injectPreferences: z.boolean().default(true).describe("Whether to inject user preferences into agent config")
44
+ }).strict().describe("Agent metadata including description, author, and tags")
42
45
  }).strict().describe("Request body for installing a custom agent from file system").transform((value) => {
43
46
  const displayName = value.name?.trim() || deriveDisplayName(value.id);
44
47
  return {
45
48
  id: value.id,
46
49
  displayName,
47
50
  sourcePath: value.sourcePath,
48
- metadata: value.metadata,
49
- injectPreferences: value.injectPreferences
51
+ metadata: value.metadata
50
52
  };
51
53
  });
52
54
  const CustomAgentCreateSchema = z.object({
@@ -60,7 +62,7 @@ const CustomAgentCreateSchema = z.object({
60
62
  author: z.string().optional().describe("Author or organization"),
61
63
  tags: z.array(z.string()).default([]).describe("Tags for discovery"),
62
64
  // Full agent configuration
63
- config: AgentConfigSchema.describe("Complete agent configuration")
65
+ config: AgentConfigSchemaForOpenAPI.describe("Complete agent configuration")
64
66
  }).strict().describe("Request body for creating a new custom agent with full configuration");
65
67
  const AgentConfigValidateSchema = z.object({
66
68
  yaml: z.string().describe("YAML agent configuration content to validate")
@@ -388,7 +390,7 @@ function createAgentsRouter(getAgent, context) {
388
390
  }
389
391
  });
390
392
  return app.openapi(listRoute, async (ctx) => {
391
- const agents = await Dexto.listAgents();
393
+ const agents = await AgentFactory.listAgents();
392
394
  const currentId = getActiveAgentId() ?? null;
393
395
  return ctx.json({
394
396
  installed: agents.installed,
@@ -404,26 +406,20 @@ function createAgentsRouter(getAgent, context) {
404
406
  }).openapi(installRoute, async (ctx) => {
405
407
  const body = ctx.req.valid("json");
406
408
  if ("sourcePath" in body && "metadata" in body) {
407
- const { id, displayName, sourcePath, metadata, injectPreferences } = body;
408
- await Dexto.installCustomAgent(
409
- id,
410
- sourcePath,
411
- {
412
- name: displayName,
413
- description: metadata.description,
414
- author: metadata.author,
415
- tags: metadata.tags,
416
- ...metadata.main ? { main: metadata.main } : {}
417
- },
418
- injectPreferences
419
- );
409
+ const { id, displayName, sourcePath, metadata } = body;
410
+ await AgentFactory.installCustomAgent(id, sourcePath, {
411
+ name: displayName,
412
+ description: metadata.description,
413
+ author: metadata.author,
414
+ tags: metadata.tags
415
+ });
420
416
  return ctx.json(
421
417
  { installed: true, id, name: displayName, type: "custom" },
422
418
  201
423
419
  );
424
420
  } else {
425
421
  const { id } = body;
426
- await Dexto.installAgent(id);
422
+ await AgentFactory.installAgent(id);
427
423
  const agentInfo = await resolveAgentInfo(id);
428
424
  return ctx.json(
429
425
  {
@@ -440,7 +436,7 @@ function createAgentsRouter(getAgent, context) {
440
436
  return ctx.json({ switched: true, ...result });
441
437
  }).openapi(validateNameRoute, async (ctx) => {
442
438
  const { id } = ctx.req.valid("json");
443
- const agents = await Dexto.listAgents();
439
+ const agents = await AgentFactory.listAgents();
444
440
  const installedAgent = agents.installed.find((a) => a.id === id);
445
441
  if (installedAgent) {
446
442
  return ctx.json({
@@ -460,7 +456,7 @@ function createAgentsRouter(getAgent, context) {
460
456
  return ctx.json({ valid: true });
461
457
  }).openapi(uninstallRoute, async (ctx) => {
462
458
  const { id, force } = ctx.req.valid("json");
463
- await Dexto.uninstallAgent(id, force);
459
+ await AgentFactory.uninstallAgent(id, force);
464
460
  return ctx.json({ uninstalled: true, id });
465
461
  }).openapi(customCreateRoute, async (ctx) => {
466
462
  const { id, name, description, author, tags, config } = ctx.req.valid("json");
@@ -496,18 +492,12 @@ function createAgentsRouter(getAgent, context) {
496
492
  const tmpFile = path.join(tmpDir, `${id}-${Date.now()}.yml`);
497
493
  await fs.writeFile(tmpFile, yamlContent, "utf-8");
498
494
  try {
499
- await Dexto.installCustomAgent(
500
- id,
501
- tmpFile,
502
- {
503
- name,
504
- description,
505
- author: author || "Custom",
506
- tags: tags || []
507
- },
508
- false
509
- // Don't inject preferences
510
- );
495
+ await AgentFactory.installCustomAgent(id, tmpFile, {
496
+ name,
497
+ description,
498
+ author: author || "Custom",
499
+ tags: tags || []
500
+ });
511
501
  await fs.unlink(tmpFile).catch(() => {
512
502
  });
513
503
  return ctx.json({ created: true, id, name }, 201);
@@ -516,8 +506,8 @@ function createAgentsRouter(getAgent, context) {
516
506
  });
517
507
  throw installError;
518
508
  }
519
- }).openapi(getPathRoute, (ctx) => {
520
- const agent = getAgent();
509
+ }).openapi(getPathRoute, async (ctx) => {
510
+ const agent = await getAgent(ctx);
521
511
  const agentPath = agent.getAgentFilePath();
522
512
  const relativePath = path.basename(agentPath);
523
513
  const ext = path.extname(agentPath);
@@ -526,10 +516,10 @@ function createAgentsRouter(getAgent, context) {
526
516
  path: agentPath,
527
517
  relativePath,
528
518
  name,
529
- isDefault: name === "default-agent"
519
+ isDefault: name === "coding-agent"
530
520
  });
531
521
  }).openapi(getConfigRoute, async (ctx) => {
532
- const agent = getAgent();
522
+ const agent = await getAgent(ctx);
533
523
  const agentPath = agent.getAgentFilePath();
534
524
  const yamlContent = await fs.readFile(agentPath, "utf-8");
535
525
  const stats = await fs.stat(agentPath);
@@ -605,7 +595,7 @@ function createAgentsRouter(getAgent, context) {
605
595
  warnings
606
596
  });
607
597
  }).openapi(saveConfigRoute, async (ctx) => {
608
- const agent = getAgent();
598
+ const agent = await getAgent(ctx);
609
599
  const { yaml } = ctx.req.valid("json");
610
600
  let parsed;
611
601
  try {
@@ -677,7 +667,7 @@ function createAgentsRouter(getAgent, context) {
677
667
  throw error;
678
668
  }
679
669
  }).openapi(exportConfigRoute, async (ctx) => {
680
- const agent = getAgent();
670
+ const agent = await getAgent(ctx);
681
671
  const { sessionId } = ctx.req.valid("query");
682
672
  const config = agent.getEffectiveConfig(sessionId);
683
673
  const maskedConfig = {