@dexto/server 1.4.0 → 1.5.1

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 (100) hide show
  1. package/dist/hono/__tests__/test-fixtures.cjs +1 -1
  2. package/dist/hono/__tests__/test-fixtures.d.ts.map +1 -1
  3. package/dist/hono/__tests__/test-fixtures.js +1 -1
  4. package/dist/hono/index.cjs +41 -5
  5. package/dist/hono/index.d.ts +470 -456
  6. package/dist/hono/index.d.ts.map +1 -1
  7. package/dist/hono/index.js +41 -5
  8. package/dist/hono/routes/a2a-jsonrpc.cjs +3 -3
  9. package/dist/hono/routes/a2a-jsonrpc.d.ts +4 -1
  10. package/dist/hono/routes/a2a-jsonrpc.d.ts.map +1 -1
  11. package/dist/hono/routes/a2a-jsonrpc.js +3 -3
  12. package/dist/hono/routes/a2a-tasks.cjs +5 -5
  13. package/dist/hono/routes/a2a-tasks.d.ts +13 -10
  14. package/dist/hono/routes/a2a-tasks.d.ts.map +1 -1
  15. package/dist/hono/routes/a2a-tasks.js +5 -5
  16. package/dist/hono/routes/agents.cjs +25 -35
  17. package/dist/hono/routes/agents.d.ts +6 -407
  18. package/dist/hono/routes/agents.d.ts.map +1 -1
  19. package/dist/hono/routes/agents.js +25 -35
  20. package/dist/hono/routes/approvals.cjs +2 -2
  21. package/dist/hono/routes/approvals.d.ts +4 -1
  22. package/dist/hono/routes/approvals.d.ts.map +1 -1
  23. package/dist/hono/routes/approvals.js +2 -2
  24. package/dist/hono/routes/discovery.cjs +68 -0
  25. package/dist/hono/routes/discovery.d.ts +53 -0
  26. package/dist/hono/routes/discovery.d.ts.map +1 -0
  27. package/dist/hono/routes/discovery.js +44 -0
  28. package/dist/hono/routes/greeting.cjs +2 -2
  29. package/dist/hono/routes/greeting.d.ts +2 -2
  30. package/dist/hono/routes/greeting.d.ts.map +1 -1
  31. package/dist/hono/routes/greeting.js +2 -2
  32. package/dist/hono/routes/health.d.ts +2 -2
  33. package/dist/hono/routes/health.d.ts.map +1 -1
  34. package/dist/hono/routes/key.cjs +110 -0
  35. package/dist/hono/routes/key.d.ts +48 -0
  36. package/dist/hono/routes/key.d.ts.map +1 -0
  37. package/dist/hono/routes/key.js +90 -0
  38. package/dist/hono/routes/llm.cjs +12 -34
  39. package/dist/hono/routes/llm.d.ts +179 -25
  40. package/dist/hono/routes/llm.d.ts.map +1 -1
  41. package/dist/hono/routes/llm.js +12 -35
  42. package/dist/hono/routes/mcp.cjs +8 -8
  43. package/dist/hono/routes/mcp.d.ts +2 -2
  44. package/dist/hono/routes/mcp.d.ts.map +1 -1
  45. package/dist/hono/routes/mcp.js +8 -8
  46. package/dist/hono/routes/memory.cjs +5 -5
  47. package/dist/hono/routes/memory.d.ts +8 -5
  48. package/dist/hono/routes/memory.d.ts.map +1 -1
  49. package/dist/hono/routes/memory.js +5 -5
  50. package/dist/hono/routes/messages.cjs +4 -4
  51. package/dist/hono/routes/messages.d.ts +12 -12
  52. package/dist/hono/routes/messages.d.ts.map +1 -1
  53. package/dist/hono/routes/messages.js +4 -4
  54. package/dist/hono/routes/models.cjs +319 -0
  55. package/dist/hono/routes/models.d.ts +107 -0
  56. package/dist/hono/routes/models.d.ts.map +1 -0
  57. package/dist/hono/routes/models.js +305 -0
  58. package/dist/hono/routes/openrouter.cjs +153 -0
  59. package/dist/hono/routes/openrouter.d.ts +54 -0
  60. package/dist/hono/routes/openrouter.d.ts.map +1 -0
  61. package/dist/hono/routes/openrouter.js +134 -0
  62. package/dist/hono/routes/prompts.cjs +5 -5
  63. package/dist/hono/routes/prompts.d.ts +4 -1
  64. package/dist/hono/routes/prompts.d.ts.map +1 -1
  65. package/dist/hono/routes/prompts.js +5 -5
  66. package/dist/hono/routes/queue.cjs +4 -4
  67. package/dist/hono/routes/queue.d.ts +4 -1
  68. package/dist/hono/routes/queue.d.ts.map +1 -1
  69. package/dist/hono/routes/queue.js +4 -4
  70. package/dist/hono/routes/resources.cjs +3 -3
  71. package/dist/hono/routes/resources.d.ts +2 -2
  72. package/dist/hono/routes/resources.d.ts.map +1 -1
  73. package/dist/hono/routes/resources.js +3 -3
  74. package/dist/hono/routes/search.cjs +2 -2
  75. package/dist/hono/routes/search.d.ts +6 -3
  76. package/dist/hono/routes/search.d.ts.map +1 -1
  77. package/dist/hono/routes/search.js +2 -2
  78. package/dist/hono/routes/sessions.cjs +9 -9
  79. package/dist/hono/routes/sessions.d.ts +3 -3
  80. package/dist/hono/routes/sessions.d.ts.map +1 -1
  81. package/dist/hono/routes/sessions.js +9 -9
  82. package/dist/hono/routes/tools.cjs +126 -0
  83. package/dist/hono/routes/tools.d.ts +42 -0
  84. package/dist/hono/routes/tools.d.ts.map +1 -0
  85. package/dist/hono/routes/tools.js +102 -0
  86. package/dist/hono/routes/webhooks.cjs +4 -4
  87. package/dist/hono/routes/webhooks.d.ts +4 -1
  88. package/dist/hono/routes/webhooks.d.ts.map +1 -1
  89. package/dist/hono/routes/webhooks.js +4 -4
  90. package/dist/hono/schemas/responses.d.ts +47 -41
  91. package/dist/hono/schemas/responses.d.ts.map +1 -1
  92. package/dist/hono/start-server.cjs +102 -0
  93. package/dist/hono/start-server.d.ts +61 -0
  94. package/dist/hono/start-server.d.ts.map +1 -0
  95. package/dist/hono/start-server.js +78 -0
  96. package/dist/index.cjs +2 -0
  97. package/dist/index.d.ts +1 -0
  98. package/dist/index.d.ts.map +1 -1
  99. package/dist/index.js +1 -0
  100. package/package.json +5 -4
@@ -1,6 +1,8 @@
1
1
  import { OpenAPIHono } from '@hono/zod-openapi';
2
2
  import type { DextoAgent } from '@dexto/core';
3
- export declare function createLlmRouter(getAgent: () => DextoAgent): OpenAPIHono<import("hono").Env, {
3
+ import type { Context } from 'hono';
4
+ type GetAgentFn = (ctx: Context) => DextoAgent | Promise<DextoAgent>;
5
+ export declare function createLlmRouter(getAgent: GetAgentFn): OpenAPIHono<import("hono").Env, {
4
6
  "/llm/current": {
5
7
  $get: {
6
8
  input: {
@@ -11,13 +13,14 @@ export declare function createLlmRouter(getAgent: () => DextoAgent): OpenAPIHono
11
13
  output: {
12
14
  config: {
13
15
  model: string;
14
- provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere";
16
+ provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
15
17
  maxIterations?: number | undefined;
16
18
  baseURL?: string | undefined;
17
19
  maxInputTokens?: number | undefined;
18
20
  maxOutputTokens?: number | undefined;
19
21
  temperature?: number | undefined;
20
22
  allowedMediaTypes?: string[] | undefined;
23
+ reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
21
24
  hasApiKey?: boolean | undefined;
22
25
  displayName?: string | undefined;
23
26
  };
@@ -194,6 +197,160 @@ export declare function createLlmRouter(getAgent: () => DextoAgent): OpenAPIHono
194
197
  } | undefined;
195
198
  }[];
196
199
  } | undefined;
200
+ openrouter?: {
201
+ name: string;
202
+ hasApiKey: boolean;
203
+ supportedFileTypes: ("image" | "audio" | "pdf")[];
204
+ primaryEnvVar: string;
205
+ supportsBaseURL: boolean;
206
+ models: {
207
+ name: string;
208
+ maxInputTokens: number;
209
+ supportedFileTypes: ("image" | "audio" | "pdf")[];
210
+ default?: boolean | undefined;
211
+ displayName?: string | undefined;
212
+ pricing?: {
213
+ inputPerM: number;
214
+ outputPerM: number;
215
+ cacheReadPerM?: number | undefined;
216
+ cacheWritePerM?: number | undefined;
217
+ currency?: "USD" | undefined;
218
+ unit?: "per_million_tokens" | undefined;
219
+ } | undefined;
220
+ }[];
221
+ } | undefined;
222
+ litellm?: {
223
+ name: string;
224
+ hasApiKey: boolean;
225
+ supportedFileTypes: ("image" | "audio" | "pdf")[];
226
+ primaryEnvVar: string;
227
+ supportsBaseURL: boolean;
228
+ models: {
229
+ name: string;
230
+ maxInputTokens: number;
231
+ supportedFileTypes: ("image" | "audio" | "pdf")[];
232
+ default?: boolean | undefined;
233
+ displayName?: string | undefined;
234
+ pricing?: {
235
+ inputPerM: number;
236
+ outputPerM: number;
237
+ cacheReadPerM?: number | undefined;
238
+ cacheWritePerM?: number | undefined;
239
+ currency?: "USD" | undefined;
240
+ unit?: "per_million_tokens" | undefined;
241
+ } | undefined;
242
+ }[];
243
+ } | undefined;
244
+ glama?: {
245
+ name: string;
246
+ hasApiKey: boolean;
247
+ supportedFileTypes: ("image" | "audio" | "pdf")[];
248
+ primaryEnvVar: string;
249
+ supportsBaseURL: boolean;
250
+ models: {
251
+ name: string;
252
+ maxInputTokens: number;
253
+ supportedFileTypes: ("image" | "audio" | "pdf")[];
254
+ default?: boolean | undefined;
255
+ displayName?: string | undefined;
256
+ pricing?: {
257
+ inputPerM: number;
258
+ outputPerM: number;
259
+ cacheReadPerM?: number | undefined;
260
+ cacheWritePerM?: number | undefined;
261
+ currency?: "USD" | undefined;
262
+ unit?: "per_million_tokens" | undefined;
263
+ } | undefined;
264
+ }[];
265
+ } | undefined;
266
+ vertex?: {
267
+ name: string;
268
+ hasApiKey: boolean;
269
+ supportedFileTypes: ("image" | "audio" | "pdf")[];
270
+ primaryEnvVar: string;
271
+ supportsBaseURL: boolean;
272
+ models: {
273
+ name: string;
274
+ maxInputTokens: number;
275
+ supportedFileTypes: ("image" | "audio" | "pdf")[];
276
+ default?: boolean | undefined;
277
+ displayName?: string | undefined;
278
+ pricing?: {
279
+ inputPerM: number;
280
+ outputPerM: number;
281
+ cacheReadPerM?: number | undefined;
282
+ cacheWritePerM?: number | undefined;
283
+ currency?: "USD" | undefined;
284
+ unit?: "per_million_tokens" | undefined;
285
+ } | undefined;
286
+ }[];
287
+ } | undefined;
288
+ bedrock?: {
289
+ name: string;
290
+ hasApiKey: boolean;
291
+ supportedFileTypes: ("image" | "audio" | "pdf")[];
292
+ primaryEnvVar: string;
293
+ supportsBaseURL: boolean;
294
+ models: {
295
+ name: string;
296
+ maxInputTokens: number;
297
+ supportedFileTypes: ("image" | "audio" | "pdf")[];
298
+ default?: boolean | undefined;
299
+ displayName?: string | undefined;
300
+ pricing?: {
301
+ inputPerM: number;
302
+ outputPerM: number;
303
+ cacheReadPerM?: number | undefined;
304
+ cacheWritePerM?: number | undefined;
305
+ currency?: "USD" | undefined;
306
+ unit?: "per_million_tokens" | undefined;
307
+ } | undefined;
308
+ }[];
309
+ } | undefined;
310
+ local?: {
311
+ name: string;
312
+ hasApiKey: boolean;
313
+ supportedFileTypes: ("image" | "audio" | "pdf")[];
314
+ primaryEnvVar: string;
315
+ supportsBaseURL: boolean;
316
+ models: {
317
+ name: string;
318
+ maxInputTokens: number;
319
+ supportedFileTypes: ("image" | "audio" | "pdf")[];
320
+ default?: boolean | undefined;
321
+ displayName?: string | undefined;
322
+ pricing?: {
323
+ inputPerM: number;
324
+ outputPerM: number;
325
+ cacheReadPerM?: number | undefined;
326
+ cacheWritePerM?: number | undefined;
327
+ currency?: "USD" | undefined;
328
+ unit?: "per_million_tokens" | undefined;
329
+ } | undefined;
330
+ }[];
331
+ } | undefined;
332
+ ollama?: {
333
+ name: string;
334
+ hasApiKey: boolean;
335
+ supportedFileTypes: ("image" | "audio" | "pdf")[];
336
+ primaryEnvVar: string;
337
+ supportsBaseURL: boolean;
338
+ models: {
339
+ name: string;
340
+ maxInputTokens: number;
341
+ supportedFileTypes: ("image" | "audio" | "pdf")[];
342
+ default?: boolean | undefined;
343
+ displayName?: string | undefined;
344
+ pricing?: {
345
+ inputPerM: number;
346
+ outputPerM: number;
347
+ cacheReadPerM?: number | undefined;
348
+ cacheWritePerM?: number | undefined;
349
+ currency?: "USD" | undefined;
350
+ unit?: "per_million_tokens" | undefined;
351
+ } | undefined;
352
+ }[];
353
+ } | undefined;
197
354
  };
198
355
  } | {
199
356
  models: {
@@ -217,31 +374,13 @@ export declare function createLlmRouter(getAgent: () => DextoAgent): OpenAPIHono
217
374
  status: 200;
218
375
  };
219
376
  };
220
- } & {
221
- "/llm/key": {
222
- $post: {
223
- input: {
224
- json: {
225
- provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere";
226
- apiKey: string;
227
- };
228
- };
229
- output: {
230
- provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere";
231
- ok: true;
232
- envVar: string;
233
- };
234
- outputFormat: "json";
235
- status: 200;
236
- };
237
- };
238
377
  } & {
239
378
  "/llm/switch": {
240
379
  $post: {
241
380
  input: {
242
381
  json: {
243
382
  model?: string | undefined;
244
- provider?: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | undefined;
383
+ provider?: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | undefined;
245
384
  apiKey?: string | undefined;
246
385
  maxIterations?: number | undefined;
247
386
  baseURL?: string | undefined;
@@ -249,6 +388,7 @@ export declare function createLlmRouter(getAgent: () => DextoAgent): OpenAPIHono
249
388
  maxOutputTokens?: number | undefined;
250
389
  temperature?: number | undefined;
251
390
  allowedMediaTypes?: string[] | undefined;
391
+ reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
252
392
  } & {
253
393
  sessionId?: string | undefined;
254
394
  };
@@ -256,13 +396,14 @@ export declare function createLlmRouter(getAgent: () => DextoAgent): OpenAPIHono
256
396
  output: {
257
397
  config: {
258
398
  model: string;
259
- provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere";
399
+ provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
260
400
  maxIterations: number;
261
401
  baseURL?: string | undefined;
262
402
  maxInputTokens?: number | undefined;
263
403
  maxOutputTokens?: number | undefined;
264
404
  temperature?: number | undefined;
265
405
  allowedMediaTypes?: string[] | undefined;
406
+ reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
266
407
  hasApiKey?: boolean | undefined;
267
408
  };
268
409
  sessionId?: string | undefined;
@@ -278,7 +419,11 @@ export declare function createLlmRouter(getAgent: () => DextoAgent): OpenAPIHono
278
419
  output: {
279
420
  models: {
280
421
  name: string;
281
- baseURL: string;
422
+ provider: "openai-compatible" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
423
+ apiKey?: string | undefined | undefined;
424
+ baseURL?: string | undefined | undefined;
425
+ reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined | undefined;
426
+ filePath?: string | undefined | undefined;
282
427
  displayName?: string | undefined | undefined;
283
428
  maxInputTokens?: number | undefined | undefined;
284
429
  maxOutputTokens?: number | undefined | undefined;
@@ -294,7 +439,11 @@ export declare function createLlmRouter(getAgent: () => DextoAgent): OpenAPIHono
294
439
  input: {
295
440
  json: {
296
441
  name: string;
297
- baseURL: string;
442
+ provider?: "openai-compatible" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | undefined;
443
+ apiKey?: string | undefined;
444
+ baseURL?: string | undefined;
445
+ reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
446
+ filePath?: string | undefined;
298
447
  displayName?: string | undefined;
299
448
  maxInputTokens?: number | undefined;
300
449
  maxOutputTokens?: number | undefined;
@@ -303,7 +452,11 @@ export declare function createLlmRouter(getAgent: () => DextoAgent): OpenAPIHono
303
452
  output: {
304
453
  model: {
305
454
  name: string;
306
- baseURL: string;
455
+ provider: "openai-compatible" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
456
+ apiKey?: string | undefined | undefined;
457
+ baseURL?: string | undefined | undefined;
458
+ reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined | undefined;
459
+ filePath?: string | undefined | undefined;
307
460
  displayName?: string | undefined | undefined;
308
461
  maxInputTokens?: number | undefined | undefined;
309
462
  maxOutputTokens?: number | undefined | undefined;
@@ -343,4 +496,5 @@ export declare function createLlmRouter(getAgent: () => DextoAgent): OpenAPIHono
343
496
  };
344
497
  };
345
498
  }, "/">;
499
+ export {};
346
500
  //# sourceMappingURL=llm.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"llm.d.ts","sourceRoot":"","sources":["../../../src/hono/routes/llm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkB,MAAM,mBAAmB,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAoG9C,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA2YzD"}
1
+ {"version":3,"file":"llm.d.ts","sourceRoot":"","sources":["../../../src/hono/routes/llm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkB,MAAM,mBAAmB,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAkB9C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAOpC,KAAK,UAAU,GAAG,CAAC,GAAG,EAAE,OAAO,KAAK,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAgErE,wBAAgB,eAAe,CAAC,QAAQ,EAAE,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAoXnD"}
@@ -9,7 +9,6 @@ import {
9
9
  } from "@dexto/core";
10
10
  import {
11
11
  getProviderKeyStatus,
12
- saveProviderApiKey,
13
12
  loadCustomModels,
14
13
  saveCustomModel,
15
14
  deleteCustomModel,
@@ -36,10 +35,6 @@ const CatalogQuerySchema = z.object({
36
35
  ).describe("Include only default models (true or false)"),
37
36
  mode: z.enum(["grouped", "flat"]).default("grouped").describe("Response format mode (grouped by provider or flat list)")
38
37
  }).describe("Query parameters for filtering and formatting the LLM catalog");
39
- const SaveKeySchema = z.object({
40
- provider: z.enum(LLM_PROVIDERS).describe("LLM provider identifier (e.g., openai, anthropic)"),
41
- apiKey: z.string().min(1, "API key is required").describe("API key for the provider (writeOnly - never returned in responses)").openapi({ writeOnly: true })
42
- }).describe("Request body for saving a provider API key");
43
38
  const SwitchLLMBodySchema = LLMUpdatesSchema.and(
44
39
  z.object({
45
40
  sessionId: z.string().optional().describe("Session identifier for session-specific LLM configuration")
@@ -102,28 +97,6 @@ function createLlmRouter(getAgent) {
102
97
  }
103
98
  }
104
99
  });
105
- const saveKeyRoute = createRoute({
106
- method: "post",
107
- path: "/llm/key",
108
- summary: "Save Provider API Key",
109
- description: "Stores an API key for a provider in .env and makes it available immediately",
110
- tags: ["llm"],
111
- request: { body: { content: { "application/json": { schema: SaveKeySchema } } } },
112
- responses: {
113
- 200: {
114
- description: "API key saved",
115
- content: {
116
- "application/json": {
117
- schema: z.object({
118
- ok: z.literal(true).describe("Operation success indicator"),
119
- provider: z.enum(LLM_PROVIDERS).describe("Provider for which the key was saved"),
120
- envVar: z.string().describe("Environment variable name where key was stored")
121
- }).strict().describe("API key save response")
122
- }
123
- }
124
- }
125
- }
126
- });
127
100
  const switchRoute = createRoute({
128
101
  method: "post",
129
102
  path: "/llm/switch",
@@ -233,8 +206,8 @@ function createLlmRouter(getAgent) {
233
206
  }
234
207
  }
235
208
  });
236
- return app.openapi(currentRoute, (ctx) => {
237
- const agent = getAgent();
209
+ return app.openapi(currentRoute, async (ctx) => {
210
+ const agent = await getAgent(ctx);
238
211
  const { sessionId } = ctx.req.valid("query");
239
212
  const currentConfig = sessionId ? agent.getEffectiveConfig(sessionId).llm : agent.getCurrentLLMConfig();
240
213
  let displayName;
@@ -243,6 +216,13 @@ function createLlmRouter(getAgent) {
243
216
  (m) => m.name.toLowerCase() === String(currentConfig.model).toLowerCase()
244
217
  );
245
218
  displayName = model?.displayName || void 0;
219
+ if (!displayName) {
220
+ const customModels = await loadCustomModels();
221
+ const customModel = customModels.find(
222
+ (cm) => cm.name.toLowerCase() === String(currentConfig.model).toLowerCase()
223
+ );
224
+ displayName = customModel?.displayName || void 0;
225
+ }
246
226
  } catch {
247
227
  }
248
228
  const { apiKey, ...configWithoutKey } = currentConfig;
@@ -326,12 +306,8 @@ function createLlmRouter(getAgent) {
326
306
  return ctx.json({ models: flat });
327
307
  }
328
308
  return ctx.json({ providers: filtered });
329
- }).openapi(saveKeyRoute, async (ctx) => {
330
- const { provider, apiKey } = ctx.req.valid("json");
331
- const meta = await saveProviderApiKey(provider, apiKey, process.cwd());
332
- return ctx.json({ ok: true, provider, envVar: meta.envVar });
333
309
  }).openapi(switchRoute, async (ctx) => {
334
- const agent = getAgent();
310
+ const agent = await getAgent(ctx);
335
311
  const raw = ctx.req.valid("json");
336
312
  const { sessionId, ...llmUpdates } = raw;
337
313
  const config = await agent.switchLLM(llmUpdates, sessionId);
@@ -351,7 +327,8 @@ function createLlmRouter(getAgent) {
351
327
  await saveCustomModel(model);
352
328
  return ctx.json({ ok: true, model });
353
329
  }).openapi(deleteCustomModelRoute, async (ctx) => {
354
- const { name } = ctx.req.valid("param");
330
+ const { name: encodedName } = ctx.req.valid("param");
331
+ const name = decodeURIComponent(encodedName);
355
332
  const deleted = await deleteCustomModel(name);
356
333
  if (!deleted) {
357
334
  throw new DextoRuntimeError(
@@ -228,7 +228,7 @@ function createMcpRouter(getAgent) {
228
228
  }
229
229
  });
230
230
  return app.openapi(addServerRoute, async (ctx) => {
231
- const agent = getAgent();
231
+ const agent = await getAgent(ctx);
232
232
  const { name, config, persistToAgent } = ctx.req.valid("json");
233
233
  await agent.addMcpServer(name, config);
234
234
  const isConnected = config.enabled !== false;
@@ -268,7 +268,7 @@ function createMcpRouter(getAgent) {
268
268
  const status = isConnected ? "connected" : "registered";
269
269
  return ctx.json({ status, name }, 200);
270
270
  }).openapi(listServersRoute, async (ctx) => {
271
- const agent = getAgent();
271
+ const agent = await getAgent(ctx);
272
272
  const clientsMap = agent.getMcpClients();
273
273
  const failedConnections = agent.getMcpFailedConnections();
274
274
  const servers = [];
@@ -280,7 +280,7 @@ function createMcpRouter(getAgent) {
280
280
  }
281
281
  return ctx.json({ servers });
282
282
  }).openapi(toolsRoute, async (ctx) => {
283
- const agent = getAgent();
283
+ const agent = await getAgent(ctx);
284
284
  const { serverId } = ctx.req.valid("param");
285
285
  const client = agent.getMcpClients().get(serverId);
286
286
  if (!client) {
@@ -295,7 +295,7 @@ function createMcpRouter(getAgent) {
295
295
  }));
296
296
  return ctx.json({ tools });
297
297
  }).openapi(deleteServerRoute, async (ctx) => {
298
- const agent = getAgent();
298
+ const agent = await getAgent(ctx);
299
299
  const { serverId } = ctx.req.valid("param");
300
300
  const clientExists = agent.getMcpClients().has(serverId) || agent.getMcpFailedConnections()[serverId];
301
301
  if (!clientExists) {
@@ -304,7 +304,7 @@ function createMcpRouter(getAgent) {
304
304
  await agent.removeMcpServer(serverId);
305
305
  return ctx.json({ status: "disconnected", id: serverId });
306
306
  }).openapi(restartServerRoute, async (ctx) => {
307
- const agent = getAgent();
307
+ const agent = await getAgent(ctx);
308
308
  const { serverId } = ctx.req.valid("param");
309
309
  import_core.logger.info(`Received request to POST /api/mcp/servers/${serverId}/restart`);
310
310
  const clientExists = agent.getMcpClients().has(serverId);
@@ -315,7 +315,7 @@ function createMcpRouter(getAgent) {
315
315
  await agent.restartMcpServer(serverId);
316
316
  return ctx.json({ status: "restarted", id: serverId });
317
317
  }).openapi(execToolRoute, async (ctx) => {
318
- const agent = getAgent();
318
+ const agent = await getAgent(ctx);
319
319
  const { serverId, toolName } = ctx.req.valid("param");
320
320
  const body = ctx.req.valid("json");
321
321
  const client = agent.getMcpClients().get(serverId);
@@ -334,7 +334,7 @@ function createMcpRouter(getAgent) {
334
334
  return ctx.json({ success: false, error: errorMessage }, 200);
335
335
  }
336
336
  }).openapi(listResourcesRoute, async (ctx) => {
337
- const agent = getAgent();
337
+ const agent = await getAgent(ctx);
338
338
  const { serverId } = ctx.req.valid("param");
339
339
  const client = agent.getMcpClients().get(serverId);
340
340
  if (!client) {
@@ -343,7 +343,7 @@ function createMcpRouter(getAgent) {
343
343
  const resources = await agent.listResourcesForServer(serverId);
344
344
  return ctx.json({ success: true, resources });
345
345
  }).openapi(getResourceContentRoute, async (ctx) => {
346
- const agent = getAgent();
346
+ const agent = await getAgent(ctx);
347
347
  const { serverId, resourceId } = ctx.req.valid("param");
348
348
  const client = agent.getMcpClients().get(serverId);
349
349
  if (!client) {
@@ -1,6 +1,6 @@
1
1
  import { OpenAPIHono } from '@hono/zod-openapi';
2
- import type { DextoAgent } from '@dexto/core';
3
- export declare function createMcpRouter(getAgent: () => DextoAgent): OpenAPIHono<import("hono").Env, {
2
+ import type { GetAgentFn } from '../index.js';
3
+ export declare function createMcpRouter(getAgent: GetAgentFn): OpenAPIHono<import("hono").Env, {
4
4
  "/mcp/servers": {
5
5
  $post: {
6
6
  input: {
@@ -1 +1 @@
1
- {"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../../src/hono/routes/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkB,MAAM,mBAAmB,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AA0I9C,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAkTzD"}
1
+ {"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../../src/hono/routes/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkB,MAAM,mBAAmB,CAAC;AAIhE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAuI9C,wBAAgB,eAAe,CAAC,QAAQ,EAAE,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAkTnD"}
@@ -205,7 +205,7 @@ function createMcpRouter(getAgent) {
205
205
  }
206
206
  });
207
207
  return app.openapi(addServerRoute, async (ctx) => {
208
- const agent = getAgent();
208
+ const agent = await getAgent(ctx);
209
209
  const { name, config, persistToAgent } = ctx.req.valid("json");
210
210
  await agent.addMcpServer(name, config);
211
211
  const isConnected = config.enabled !== false;
@@ -245,7 +245,7 @@ function createMcpRouter(getAgent) {
245
245
  const status = isConnected ? "connected" : "registered";
246
246
  return ctx.json({ status, name }, 200);
247
247
  }).openapi(listServersRoute, async (ctx) => {
248
- const agent = getAgent();
248
+ const agent = await getAgent(ctx);
249
249
  const clientsMap = agent.getMcpClients();
250
250
  const failedConnections = agent.getMcpFailedConnections();
251
251
  const servers = [];
@@ -257,7 +257,7 @@ function createMcpRouter(getAgent) {
257
257
  }
258
258
  return ctx.json({ servers });
259
259
  }).openapi(toolsRoute, async (ctx) => {
260
- const agent = getAgent();
260
+ const agent = await getAgent(ctx);
261
261
  const { serverId } = ctx.req.valid("param");
262
262
  const client = agent.getMcpClients().get(serverId);
263
263
  if (!client) {
@@ -272,7 +272,7 @@ function createMcpRouter(getAgent) {
272
272
  }));
273
273
  return ctx.json({ tools });
274
274
  }).openapi(deleteServerRoute, async (ctx) => {
275
- const agent = getAgent();
275
+ const agent = await getAgent(ctx);
276
276
  const { serverId } = ctx.req.valid("param");
277
277
  const clientExists = agent.getMcpClients().has(serverId) || agent.getMcpFailedConnections()[serverId];
278
278
  if (!clientExists) {
@@ -281,7 +281,7 @@ function createMcpRouter(getAgent) {
281
281
  await agent.removeMcpServer(serverId);
282
282
  return ctx.json({ status: "disconnected", id: serverId });
283
283
  }).openapi(restartServerRoute, async (ctx) => {
284
- const agent = getAgent();
284
+ const agent = await getAgent(ctx);
285
285
  const { serverId } = ctx.req.valid("param");
286
286
  logger.info(`Received request to POST /api/mcp/servers/${serverId}/restart`);
287
287
  const clientExists = agent.getMcpClients().has(serverId);
@@ -292,7 +292,7 @@ function createMcpRouter(getAgent) {
292
292
  await agent.restartMcpServer(serverId);
293
293
  return ctx.json({ status: "restarted", id: serverId });
294
294
  }).openapi(execToolRoute, async (ctx) => {
295
- const agent = getAgent();
295
+ const agent = await getAgent(ctx);
296
296
  const { serverId, toolName } = ctx.req.valid("param");
297
297
  const body = ctx.req.valid("json");
298
298
  const client = agent.getMcpClients().get(serverId);
@@ -311,7 +311,7 @@ function createMcpRouter(getAgent) {
311
311
  return ctx.json({ success: false, error: errorMessage }, 200);
312
312
  }
313
313
  }).openapi(listResourcesRoute, async (ctx) => {
314
- const agent = getAgent();
314
+ const agent = await getAgent(ctx);
315
315
  const { serverId } = ctx.req.valid("param");
316
316
  const client = agent.getMcpClients().get(serverId);
317
317
  if (!client) {
@@ -320,7 +320,7 @@ function createMcpRouter(getAgent) {
320
320
  const resources = await agent.listResourcesForServer(serverId);
321
321
  return ctx.json({ success: true, resources });
322
322
  }).openapi(getResourceContentRoute, async (ctx) => {
323
- const agent = getAgent();
323
+ const agent = await getAgent(ctx);
324
324
  const { serverId, resourceId } = ctx.req.valid("param");
325
325
  const client = agent.getMcpClients().get(serverId);
326
326
  if (!client) {
@@ -150,7 +150,7 @@ function createMemoryRouter(getAgent) {
150
150
  if (input.metadata !== void 0) {
151
151
  createInput.metadata = input.metadata;
152
152
  }
153
- const agent = getAgent();
153
+ const agent = await getAgent(ctx);
154
154
  const memory = await agent.memoryManager.create(createInput);
155
155
  return ctx.json({ ok: true, memory }, 201);
156
156
  }).openapi(listRoute, async (ctx) => {
@@ -161,12 +161,12 @@ function createMemoryRouter(getAgent) {
161
161
  if (query.pinned !== void 0) options.pinned = query.pinned;
162
162
  if (query.limit !== void 0) options.limit = query.limit;
163
163
  if (query.offset !== void 0) options.offset = query.offset;
164
- const agent = getAgent();
164
+ const agent = await getAgent(ctx);
165
165
  const memories = await agent.memoryManager.list(options);
166
166
  return ctx.json({ ok: true, memories });
167
167
  }).openapi(getRoute, async (ctx) => {
168
168
  const { id } = ctx.req.valid("param");
169
- const agent = getAgent();
169
+ const agent = await getAgent(ctx);
170
170
  const memory = await agent.memoryManager.get(id);
171
171
  return ctx.json({ ok: true, memory });
172
172
  }).openapi(updateRoute, async (ctx) => {
@@ -176,12 +176,12 @@ function createMemoryRouter(getAgent) {
176
176
  if (updatesRaw.content !== void 0) updates.content = updatesRaw.content;
177
177
  if (updatesRaw.metadata !== void 0) updates.metadata = updatesRaw.metadata;
178
178
  if (updatesRaw.tags !== void 0) updates.tags = updatesRaw.tags;
179
- const agent = getAgent();
179
+ const agent = await getAgent(ctx);
180
180
  const memory = await agent.memoryManager.update(id, updates);
181
181
  return ctx.json({ ok: true, memory });
182
182
  }).openapi(deleteRoute, async (ctx) => {
183
183
  const { id } = ctx.req.valid("param");
184
- const agent = getAgent();
184
+ const agent = await getAgent(ctx);
185
185
  await agent.memoryManager.delete(id);
186
186
  return ctx.json({ ok: true, message: "Memory deleted successfully" });
187
187
  });
@@ -1,6 +1,8 @@
1
1
  import { OpenAPIHono, z } from '@hono/zod-openapi';
2
2
  import type { DextoAgent } from '@dexto/core';
3
- export declare function createMemoryRouter(getAgent: () => DextoAgent): OpenAPIHono<import("hono").Env, {
3
+ import type { Context } from 'hono';
4
+ type GetAgentFn = (ctx: Context) => DextoAgent | Promise<DextoAgent>;
5
+ export declare function createMemoryRouter(getAgent: GetAgentFn): OpenAPIHono<import("hono").Env, {
4
6
  "/memory": {
5
7
  $post: {
6
8
  input: {
@@ -17,8 +19,8 @@ export declare function createMemoryRouter(getAgent: () => DextoAgent): OpenAPIH
17
19
  ok: true;
18
20
  memory: {
19
21
  content: string;
20
- id: string;
21
22
  createdAt: number;
23
+ id: string;
22
24
  updatedAt: number;
23
25
  metadata?: {
24
26
  [x: string]: import("hono/utils/types").JSONValue;
@@ -47,8 +49,8 @@ export declare function createMemoryRouter(getAgent: () => DextoAgent): OpenAPIH
47
49
  output: {
48
50
  memories: {
49
51
  content: string;
50
- id: string;
51
52
  createdAt: number;
53
+ id: string;
52
54
  updatedAt: number;
53
55
  metadata?: {
54
56
  [x: string]: import("hono/utils/types").JSONValue;
@@ -75,8 +77,8 @@ export declare function createMemoryRouter(getAgent: () => DextoAgent): OpenAPIH
75
77
  ok: true;
76
78
  memory: {
77
79
  content: string;
78
- id: string;
79
80
  createdAt: number;
81
+ id: string;
80
82
  updatedAt: number;
81
83
  metadata?: {
82
84
  [x: string]: import("hono/utils/types").JSONValue;
@@ -111,8 +113,8 @@ export declare function createMemoryRouter(getAgent: () => DextoAgent): OpenAPIH
111
113
  ok: true;
112
114
  memory: {
113
115
  content: string;
114
- id: string;
115
116
  createdAt: number;
117
+ id: string;
116
118
  updatedAt: number;
117
119
  metadata?: {
118
120
  [x: string]: import("hono/utils/types").JSONValue;
@@ -143,4 +145,5 @@ export declare function createMemoryRouter(getAgent: () => DextoAgent): OpenAPIH
143
145
  };
144
146
  };
145
147
  }, "/">;
148
+ export {};
146
149
  //# sourceMappingURL=memory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../../src/hono/routes/memory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAe,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AA6D9C,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAwK5D"}
1
+ {"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../../src/hono/routes/memory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAe,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG9C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,KAAK,UAAU,GAAG,CAAC,GAAG,EAAE,OAAO,KAAK,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AA2DrE,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAwKtD"}