@dexto/server 1.6.20 → 1.6.22

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 (133) hide show
  1. package/dist/a2a/jsonrpc/methods.cjs +1 -1
  2. package/dist/a2a/jsonrpc/methods.d.ts +14 -4
  3. package/dist/a2a/jsonrpc/methods.d.ts.map +1 -1
  4. package/dist/a2a/jsonrpc/methods.js +1 -1
  5. package/dist/approval/wire-approval-events.cjs +44 -0
  6. package/dist/approval/wire-approval-events.d.ts +4 -0
  7. package/dist/approval/wire-approval-events.d.ts.map +1 -0
  8. package/dist/approval/wire-approval-events.js +20 -0
  9. package/dist/events/session-sse-subscriber.cjs +167 -0
  10. package/dist/events/session-sse-subscriber.d.ts +13 -0
  11. package/dist/events/session-sse-subscriber.d.ts.map +1 -0
  12. package/dist/events/session-sse-subscriber.js +143 -0
  13. package/dist/hono/__tests__/test-fixtures.cjs +8 -0
  14. package/dist/hono/__tests__/test-fixtures.d.ts +1 -0
  15. package/dist/hono/__tests__/test-fixtures.d.ts.map +1 -1
  16. package/dist/hono/__tests__/test-fixtures.js +8 -0
  17. package/dist/hono/index.cjs +40 -8
  18. package/dist/hono/index.d.ts +45 -4531
  19. package/dist/hono/index.d.ts.map +1 -1
  20. package/dist/hono/index.js +43 -9
  21. package/dist/hono/node/index.cjs +51 -6
  22. package/dist/hono/node/index.d.ts.map +1 -1
  23. package/dist/hono/node/index.js +51 -6
  24. package/dist/hono/routes/a2a-jsonrpc.d.ts.map +1 -1
  25. package/dist/hono/routes/a2a-tasks.cjs +158 -32
  26. package/dist/hono/routes/a2a-tasks.d.ts +1 -502
  27. package/dist/hono/routes/a2a-tasks.d.ts.map +1 -1
  28. package/dist/hono/routes/a2a-tasks.js +162 -32
  29. package/dist/hono/routes/a2a.d.ts.map +1 -1
  30. package/dist/hono/routes/agents.cjs +410 -329
  31. package/dist/hono/routes/agents.d.ts +16043 -68
  32. package/dist/hono/routes/agents.d.ts.map +1 -1
  33. package/dist/hono/routes/agents.js +418 -330
  34. package/dist/hono/routes/approvals.cjs +102 -88
  35. package/dist/hono/routes/approvals.d.ts +2089 -142
  36. package/dist/hono/routes/approvals.d.ts.map +1 -1
  37. package/dist/hono/routes/approvals.js +108 -89
  38. package/dist/hono/routes/dexto-auth.cjs +40 -33
  39. package/dist/hono/routes/dexto-auth.d.ts +401 -2
  40. package/dist/hono/routes/dexto-auth.d.ts.map +1 -1
  41. package/dist/hono/routes/dexto-auth.js +40 -33
  42. package/dist/hono/routes/discovery.cjs +16 -14
  43. package/dist/hono/routes/discovery.d.ts +586 -1
  44. package/dist/hono/routes/discovery.d.ts.map +1 -1
  45. package/dist/hono/routes/discovery.js +16 -14
  46. package/dist/hono/routes/greeting.cjs +26 -22
  47. package/dist/hono/routes/greeting.d.ts +787 -3
  48. package/dist/hono/routes/greeting.d.ts.map +1 -1
  49. package/dist/hono/routes/greeting.js +26 -22
  50. package/dist/hono/routes/health.d.ts +1 -1
  51. package/dist/hono/routes/key.cjs +60 -52
  52. package/dist/hono/routes/key.d.ts +1597 -1
  53. package/dist/hono/routes/key.d.ts.map +1 -1
  54. package/dist/hono/routes/key.js +60 -52
  55. package/dist/hono/routes/llm.cjs +382 -349
  56. package/dist/hono/routes/llm.d.ts +12148 -98
  57. package/dist/hono/routes/llm.d.ts.map +1 -1
  58. package/dist/hono/routes/llm.js +386 -349
  59. package/dist/hono/routes/mcp.cjs +257 -226
  60. package/dist/hono/routes/mcp.d.ts +6605 -309
  61. package/dist/hono/routes/mcp.d.ts.map +1 -1
  62. package/dist/hono/routes/mcp.js +263 -225
  63. package/dist/hono/routes/memory.cjs +102 -89
  64. package/dist/hono/routes/memory.d.ts +5368 -4
  65. package/dist/hono/routes/memory.d.ts.map +1 -1
  66. package/dist/hono/routes/memory.js +108 -90
  67. package/dist/hono/routes/messages.cjs +189 -191
  68. package/dist/hono/routes/messages.d.ts +3900 -12
  69. package/dist/hono/routes/messages.d.ts.map +1 -1
  70. package/dist/hono/routes/messages.js +192 -191
  71. package/dist/hono/routes/models.cjs +106 -64
  72. package/dist/hono/routes/models.d.ts +2875 -2
  73. package/dist/hono/routes/models.d.ts.map +1 -1
  74. package/dist/hono/routes/models.js +108 -64
  75. package/dist/hono/routes/openrouter.cjs +79 -65
  76. package/dist/hono/routes/openrouter.d.ts +854 -1
  77. package/dist/hono/routes/openrouter.d.ts.map +1 -1
  78. package/dist/hono/routes/openrouter.js +79 -65
  79. package/dist/hono/routes/prompts.cjs +136 -109
  80. package/dist/hono/routes/prompts.d.ts +2818 -10
  81. package/dist/hono/routes/prompts.d.ts.map +1 -1
  82. package/dist/hono/routes/prompts.js +138 -109
  83. package/dist/hono/routes/queue.cjs +133 -120
  84. package/dist/hono/routes/queue.d.ts +5240 -11
  85. package/dist/hono/routes/queue.d.ts.map +1 -1
  86. package/dist/hono/routes/queue.js +136 -120
  87. package/dist/hono/routes/resources.cjs +65 -46
  88. package/dist/hono/routes/resources.d.ts +1983 -5
  89. package/dist/hono/routes/resources.d.ts.map +1 -1
  90. package/dist/hono/routes/resources.js +72 -47
  91. package/dist/hono/routes/schedules.cjs +233 -226
  92. package/dist/hono/routes/schedules.d.ts +4198 -22
  93. package/dist/hono/routes/schedules.d.ts.map +1 -1
  94. package/dist/hono/routes/schedules.js +233 -226
  95. package/dist/hono/routes/search.cjs +34 -30
  96. package/dist/hono/routes/search.d.ts +3094 -17
  97. package/dist/hono/routes/search.d.ts.map +1 -1
  98. package/dist/hono/routes/search.js +40 -31
  99. package/dist/hono/routes/sessions.cjs +491 -393
  100. package/dist/hono/routes/sessions.d.ts +18263 -65
  101. package/dist/hono/routes/sessions.d.ts.map +1 -1
  102. package/dist/hono/routes/sessions.js +497 -395
  103. package/dist/hono/routes/static.d.ts.map +1 -1
  104. package/dist/hono/routes/system-prompt.cjs +57 -61
  105. package/dist/hono/routes/system-prompt.d.ts +1228 -2
  106. package/dist/hono/routes/system-prompt.d.ts.map +1 -1
  107. package/dist/hono/routes/system-prompt.js +58 -62
  108. package/dist/hono/routes/tools.cjs +29 -34
  109. package/dist/hono/routes/tools.d.ts +1755 -6
  110. package/dist/hono/routes/tools.d.ts.map +1 -1
  111. package/dist/hono/routes/tools.js +33 -33
  112. package/dist/hono/routes/webhooks.cjs +115 -123
  113. package/dist/hono/routes/webhooks.d.ts +2501 -11
  114. package/dist/hono/routes/webhooks.d.ts.map +1 -1
  115. package/dist/hono/routes/webhooks.js +120 -124
  116. package/dist/hono/routes/workspaces.cjs +84 -79
  117. package/dist/hono/routes/workspaces.d.ts +2093 -2
  118. package/dist/hono/routes/workspaces.d.ts.map +1 -1
  119. package/dist/hono/routes/workspaces.js +89 -80
  120. package/dist/hono/schemas/responses.cjs +463 -260
  121. package/dist/hono/schemas/responses.d.ts +1893 -209
  122. package/dist/hono/schemas/responses.d.ts.map +1 -1
  123. package/dist/hono/schemas/responses.js +203 -14
  124. package/dist/hono/start-server.cjs +9 -0
  125. package/dist/hono/start-server.d.ts.map +1 -1
  126. package/dist/hono/start-server.js +9 -0
  127. package/dist/hono/types.d.ts +11 -0
  128. package/dist/hono/types.d.ts.map +1 -1
  129. package/dist/index.cjs +5 -1
  130. package/dist/index.d.ts +2 -0
  131. package/dist/index.d.ts.map +1 -1
  132. package/dist/index.js +2 -0
  133. package/package.json +7 -7
@@ -43,7 +43,7 @@ const CatalogQuerySchema = import_zod_openapi.z.object({
43
43
  hasKey: import_zod_openapi.z.union([import_zod_openapi.z.literal("true"), import_zod_openapi.z.literal("false"), import_zod_openapi.z.literal("1"), import_zod_openapi.z.literal("0")]).optional().transform(
44
44
  (raw) => raw === "true" || raw === "1" ? true : raw === "false" || raw === "0" ? false : void 0
45
45
  ).describe("Filter by API key presence (true or false)"),
46
- fileType: import_zod_openapi.z.enum(import_core2.SUPPORTED_FILE_TYPES).optional().describe("Filter by supported file type (audio, pdf, or image)"),
46
+ fileType: import_zod_openapi.z.enum(import_core2.SUPPORTED_FILE_TYPES).optional().describe("Filter by supported file type (audio, pdf, image, video, or document)"),
47
47
  defaultOnly: import_zod_openapi.z.union([import_zod_openapi.z.literal("true"), import_zod_openapi.z.literal("false"), import_zod_openapi.z.literal("1"), import_zod_openapi.z.literal("0")]).optional().transform(
48
48
  (raw) => raw === "true" || raw === "1" ? true : raw === "false" || raw === "0" ? false : void 0
49
49
  ).describe("Include only default models (true or false)"),
@@ -96,356 +96,374 @@ const ModelPickerErrorResponses = {
96
96
  }
97
97
  }
98
98
  };
99
- function createLlmRouter(getAgent) {
100
- const app = new import_zod_openapi.OpenAPIHono();
101
- const currentRoute = (0, import_zod_openapi.createRoute)({
102
- method: "get",
103
- path: "/llm/current",
104
- summary: "Get Current LLM Config",
105
- description: "Retrieves the current LLM configuration for the agent or a specific session",
106
- tags: ["llm"],
107
- request: { query: CurrentQuerySchema },
108
- responses: {
109
- 200: {
110
- description: "Current LLM config",
111
- content: {
112
- "application/json": {
113
- schema: import_zod_openapi.z.object({
114
- config: import_responses.LLMConfigResponseSchema.partial({
115
- maxIterations: true
116
- }).extend({
117
- displayName: import_zod_openapi.z.string().optional().describe("Human-readable model display name")
118
- }),
119
- routing: import_zod_openapi.z.object({
120
- viaDexto: import_zod_openapi.z.boolean().describe(
121
- "Whether requests route through Dexto gateway"
122
- )
123
- }).describe(
124
- "Routing information for the current LLM configuration"
99
+ const CapabilitiesQuerySchema = import_zod_openapi.z.object({
100
+ provider: import_zod_openapi.z.enum(import_core2.LLM_PROVIDERS).describe("LLM provider name"),
101
+ model: import_zod_openapi.z.string().min(1).describe("Model name (supports both native and OpenRouter format)")
102
+ }).strict().describe("Query parameters for model capability lookup");
103
+ const SetFavoritesBodySchema = import_zod_openapi.z.object({
104
+ favorites: import_zod_openapi.z.array(ModelPickerModelRefSchema).describe("Complete list of favorite model references")
105
+ }).strict().describe("Request body for setting favorite models");
106
+ const currentRoute = (0, import_zod_openapi.createRoute)({
107
+ method: "get",
108
+ path: "/llm/current",
109
+ summary: "Get Current LLM Config",
110
+ description: "Retrieves the current LLM configuration for the agent or a specific session",
111
+ tags: ["llm"],
112
+ request: { query: CurrentQuerySchema },
113
+ responses: {
114
+ 200: {
115
+ description: "Current LLM config",
116
+ content: {
117
+ "application/json": {
118
+ schema: import_zod_openapi.z.object({
119
+ config: import_responses.LLMConfigResponseSchema.partial({
120
+ maxIterations: true
121
+ }).extend({
122
+ displayName: import_zod_openapi.z.string().optional().describe("Human-readable model display name")
123
+ }),
124
+ routing: import_zod_openapi.z.object({
125
+ viaDexto: import_zod_openapi.z.boolean().describe("Whether requests route through Dexto gateway")
126
+ }).describe("Routing information for the current LLM configuration")
127
+ }).describe("Response containing current LLM configuration")
128
+ }
129
+ }
130
+ },
131
+ 400: import_responses.BadRequestErrorResponse,
132
+ 404: import_responses.NotFoundErrorResponse,
133
+ 500: import_responses.InternalErrorResponse
134
+ }
135
+ });
136
+ const catalogRoute = (0, import_zod_openapi.createRoute)({
137
+ method: "get",
138
+ path: "/llm/catalog",
139
+ summary: "LLM Catalog",
140
+ description: "Providers, models, capabilities, and API key status",
141
+ tags: ["llm"],
142
+ request: { query: CatalogQuerySchema },
143
+ responses: {
144
+ 200: {
145
+ description: "LLM catalog",
146
+ content: {
147
+ "application/json": {
148
+ schema: import_zod_openapi.z.union([
149
+ import_zod_openapi.z.object({
150
+ providers: import_zod_openapi.z.record(import_zod_openapi.z.enum(import_core2.LLM_PROVIDERS), import_responses.ProviderCatalogSchema).describe(
151
+ "Providers grouped by ID with their models and capabilities"
152
+ )
153
+ }).strict().describe("Grouped catalog response (mode=grouped)"),
154
+ import_zod_openapi.z.object({
155
+ models: import_zod_openapi.z.array(import_responses.ModelFlatSchema).describe(
156
+ "Flat list of all models with provider information"
125
157
  )
126
- }).describe("Response containing current LLM configuration")
127
- }
158
+ }).strict().describe("Flat catalog response (mode=flat)")
159
+ ]).describe(
160
+ "LLM catalog in grouped or flat format based on mode query parameter"
161
+ )
128
162
  }
129
163
  }
130
- }
131
- });
132
- const catalogRoute = (0, import_zod_openapi.createRoute)({
133
- method: "get",
134
- path: "/llm/catalog",
135
- summary: "LLM Catalog",
136
- description: "Providers, models, capabilities, and API key status",
137
- tags: ["llm"],
138
- request: { query: CatalogQuerySchema },
139
- responses: {
140
- 200: {
141
- description: "LLM catalog",
142
- content: {
143
- "application/json": {
144
- schema: import_zod_openapi.z.union([
145
- import_zod_openapi.z.object({
146
- providers: import_zod_openapi.z.record(import_zod_openapi.z.enum(import_core2.LLM_PROVIDERS), import_responses.ProviderCatalogSchema).describe(
147
- "Providers grouped by ID with their models and capabilities"
148
- )
149
- }).strict().describe("Grouped catalog response (mode=grouped)"),
150
- import_zod_openapi.z.object({
151
- models: import_zod_openapi.z.array(import_responses.ModelFlatSchema).describe(
152
- "Flat list of all models with provider information"
153
- )
154
- }).strict().describe("Flat catalog response (mode=flat)")
155
- ]).describe(
156
- "LLM catalog in grouped or flat format based on mode query parameter"
157
- )
158
- }
164
+ },
165
+ 400: import_responses.BadRequestErrorResponse,
166
+ 404: import_responses.NotFoundErrorResponse,
167
+ 500: import_responses.InternalErrorResponse
168
+ }
169
+ });
170
+ const switchRoute = (0, import_zod_openapi.createRoute)({
171
+ method: "post",
172
+ path: "/llm/switch",
173
+ summary: "Switch LLM",
174
+ description: "Switches the LLM configuration for the agent or a specific session",
175
+ tags: ["llm"],
176
+ request: {
177
+ body: {
178
+ content: {
179
+ "application/json": {
180
+ schema: SwitchLLMBodySchema
159
181
  }
160
182
  }
161
183
  }
162
- });
163
- const switchRoute = (0, import_zod_openapi.createRoute)({
164
- method: "post",
165
- path: "/llm/switch",
166
- summary: "Switch LLM",
167
- description: "Switches the LLM configuration for the agent or a specific session",
168
- tags: ["llm"],
169
- request: {
170
- body: {
171
- content: {
172
- "application/json": {
173
- schema: SwitchLLMBodySchema
174
- }
184
+ },
185
+ responses: {
186
+ 200: {
187
+ description: "LLM switch result",
188
+ content: {
189
+ "application/json": {
190
+ schema: import_zod_openapi.z.object({
191
+ config: import_responses.LLMConfigResponseSchema.describe(
192
+ "New LLM configuration with all defaults applied (apiKey omitted)"
193
+ ),
194
+ sessionId: import_zod_openapi.z.string().optional().describe("Session ID if session-specific switch")
195
+ }).describe("LLM switch result")
175
196
  }
176
197
  }
177
198
  },
178
- responses: {
179
- 200: {
180
- description: "LLM switch result",
181
- content: {
182
- "application/json": {
183
- schema: import_zod_openapi.z.object({
184
- config: import_responses.LLMConfigResponseSchema.describe(
185
- "New LLM configuration with all defaults applied (apiKey omitted)"
186
- ),
187
- sessionId: import_zod_openapi.z.string().optional().describe("Session ID if session-specific switch")
188
- }).describe("LLM switch result")
189
- }
199
+ 400: import_responses.BadRequestErrorResponse,
200
+ 404: import_responses.NotFoundErrorResponse,
201
+ 409: import_responses.ConflictErrorResponse,
202
+ 500: import_responses.InternalErrorResponse
203
+ }
204
+ });
205
+ const listCustomModelsRoute = (0, import_zod_openapi.createRoute)({
206
+ method: "get",
207
+ path: "/llm/custom-models",
208
+ summary: "List Custom Models",
209
+ description: "Returns all saved custom openai-compatible model configurations",
210
+ tags: ["llm"],
211
+ responses: {
212
+ 200: {
213
+ description: "List of custom models",
214
+ content: {
215
+ "application/json": {
216
+ schema: import_zod_openapi.z.object({
217
+ models: import_zod_openapi.z.array(import_agent_management.CustomModelSchema).describe("List of custom models")
218
+ })
190
219
  }
191
220
  }
192
- }
193
- });
194
- const listCustomModelsRoute = (0, import_zod_openapi.createRoute)({
195
- method: "get",
196
- path: "/llm/custom-models",
197
- summary: "List Custom Models",
198
- description: "Returns all saved custom openai-compatible model configurations",
199
- tags: ["llm"],
200
- responses: {
201
- 200: {
202
- description: "List of custom models",
203
- content: {
204
- "application/json": {
205
- schema: import_zod_openapi.z.object({
206
- models: import_zod_openapi.z.array(import_agent_management.CustomModelSchema).describe("List of custom models")
207
- })
208
- }
221
+ },
222
+ 400: import_responses.BadRequestErrorResponse,
223
+ 404: import_responses.NotFoundErrorResponse,
224
+ 500: import_responses.InternalErrorResponse
225
+ }
226
+ });
227
+ const createCustomModelRoute = (0, import_zod_openapi.createRoute)({
228
+ method: "post",
229
+ path: "/llm/custom-models",
230
+ summary: "Create Custom Model",
231
+ description: "Saves a new custom openai-compatible model configuration",
232
+ tags: ["llm"],
233
+ request: {
234
+ body: { content: { "application/json": { schema: import_agent_management.CustomModelSchema } } }
235
+ },
236
+ responses: {
237
+ 200: {
238
+ description: "Custom model saved",
239
+ content: {
240
+ "application/json": {
241
+ schema: import_zod_openapi.z.object({
242
+ ok: import_zod_openapi.z.literal(true).describe("Success indicator"),
243
+ model: import_agent_management.CustomModelSchema
244
+ })
209
245
  }
210
246
  }
211
- }
212
- });
213
- const createCustomModelRoute = (0, import_zod_openapi.createRoute)({
214
- method: "post",
215
- path: "/llm/custom-models",
216
- summary: "Create Custom Model",
217
- description: "Saves a new custom openai-compatible model configuration",
218
- tags: ["llm"],
219
- request: {
220
- body: { content: { "application/json": { schema: import_agent_management.CustomModelSchema } } }
221
247
  },
222
- responses: {
223
- 200: {
224
- description: "Custom model saved",
225
- content: {
226
- "application/json": {
227
- schema: import_zod_openapi.z.object({
228
- ok: import_zod_openapi.z.literal(true).describe("Success indicator"),
229
- model: import_agent_management.CustomModelSchema
230
- })
231
- }
248
+ 400: import_responses.BadRequestErrorResponse,
249
+ 404: import_responses.NotFoundErrorResponse,
250
+ 409: import_responses.ConflictErrorResponse,
251
+ 500: import_responses.InternalErrorResponse
252
+ }
253
+ });
254
+ const deleteCustomModelRoute = (0, import_zod_openapi.createRoute)({
255
+ method: "delete",
256
+ path: "/llm/custom-models/{name}",
257
+ summary: "Delete Custom Model",
258
+ description: "Deletes a custom model by name",
259
+ tags: ["llm"],
260
+ request: {
261
+ params: import_zod_openapi.z.object({
262
+ name: import_zod_openapi.z.string().min(1).describe("Model name to delete")
263
+ })
264
+ },
265
+ responses: {
266
+ 200: {
267
+ description: "Custom model deleted",
268
+ content: {
269
+ "application/json": {
270
+ schema: import_zod_openapi.z.object({
271
+ ok: import_zod_openapi.z.literal(true).describe("Success indicator"),
272
+ deleted: import_zod_openapi.z.string().describe("Name of the deleted model")
273
+ })
232
274
  }
233
275
  }
234
- }
235
- });
236
- const deleteCustomModelRoute = (0, import_zod_openapi.createRoute)({
237
- method: "delete",
238
- path: "/llm/custom-models/{name}",
239
- summary: "Delete Custom Model",
240
- description: "Deletes a custom model by name",
241
- tags: ["llm"],
242
- request: {
243
- params: import_zod_openapi.z.object({
244
- name: import_zod_openapi.z.string().min(1).describe("Model name to delete")
245
- })
246
276
  },
247
- responses: {
248
- 200: {
249
- description: "Custom model deleted",
250
- content: {
251
- "application/json": {
252
- schema: import_zod_openapi.z.object({
253
- ok: import_zod_openapi.z.literal(true).describe("Success indicator"),
254
- deleted: import_zod_openapi.z.string().describe("Name of the deleted model")
255
- })
256
- }
257
- }
258
- },
259
- 404: {
260
- description: "Custom model not found",
261
- content: {
262
- "application/json": {
263
- schema: import_zod_openapi.z.object({
264
- ok: import_zod_openapi.z.literal(false).describe("Failure indicator"),
265
- error: import_zod_openapi.z.string().describe("Error message")
266
- })
267
- }
277
+ 400: import_responses.BadRequestErrorResponse,
278
+ 404: import_responses.NotFoundErrorResponse,
279
+ 500: import_responses.InternalErrorResponse
280
+ }
281
+ });
282
+ const capabilitiesRoute = (0, import_zod_openapi.createRoute)({
283
+ method: "get",
284
+ path: "/llm/capabilities",
285
+ summary: "Get Model Capabilities",
286
+ description: "Returns the capabilities (supported file types) for a specific provider/model combination. Handles gateway providers (dexto-nova, openrouter) by resolving to the underlying model capabilities.",
287
+ tags: ["llm"],
288
+ request: {
289
+ query: CapabilitiesQuerySchema
290
+ },
291
+ responses: {
292
+ 200: {
293
+ description: "Model capabilities",
294
+ content: {
295
+ "application/json": {
296
+ schema: import_zod_openapi.z.object({
297
+ provider: import_zod_openapi.z.enum(import_core2.LLM_PROVIDERS).describe("Provider name"),
298
+ model: import_zod_openapi.z.string().describe("Model name as provided"),
299
+ supportedFileTypes: import_zod_openapi.z.array(import_zod_openapi.z.enum(import_core2.SUPPORTED_FILE_TYPES)).describe("File types supported by this model"),
300
+ reasoning: import_zod_openapi.z.object({
301
+ capable: import_zod_openapi.z.boolean().describe(
302
+ "Whether Dexto considers this provider/model reasoning-capable (derived from registry metadata plus explicit provider/model rules)"
303
+ ),
304
+ paradigm: import_zod_openapi.z.enum([
305
+ "effort",
306
+ "adaptive-effort",
307
+ "thinking-level",
308
+ "budget",
309
+ "none"
310
+ ]).describe("Reasoning control paradigm for this model"),
311
+ variants: import_zod_openapi.z.array(
312
+ import_zod_openapi.z.object({
313
+ id: import_zod_openapi.z.string().describe(
314
+ "Native reasoning variant identifier"
315
+ ),
316
+ label: import_zod_openapi.z.string().describe(
317
+ "Display label for the native reasoning variant"
318
+ )
319
+ }).strict()
320
+ ).describe("Native reasoning variants exposed to users"),
321
+ supportedVariants: import_zod_openapi.z.array(import_zod_openapi.z.string()).describe(
322
+ "Native reasoning variant IDs supported for this model/provider"
323
+ ),
324
+ defaultVariant: import_zod_openapi.z.string().optional().describe(
325
+ "Default reasoning variant used when no explicit override is set"
326
+ ),
327
+ supportsBudgetTokens: import_zod_openapi.z.boolean().describe(
328
+ "Whether this provider/model supports a budgetTokens-style escape hatch"
329
+ )
330
+ }).strict().describe(
331
+ "Reasoning tuning capabilities derived from registry metadata and explicit provider/model rules"
332
+ )
333
+ })
268
334
  }
269
335
  }
270
- }
271
- });
272
- const capabilitiesRoute = (0, import_zod_openapi.createRoute)({
273
- method: "get",
274
- path: "/llm/capabilities",
275
- summary: "Get Model Capabilities",
276
- description: "Returns the capabilities (supported file types) for a specific provider/model combination. Handles gateway providers (dexto-nova, openrouter) by resolving to the underlying model capabilities.",
277
- tags: ["llm"],
278
- request: {
279
- query: import_zod_openapi.z.object({
280
- provider: import_zod_openapi.z.enum(import_core2.LLM_PROVIDERS).describe("LLM provider name"),
281
- model: import_zod_openapi.z.string().min(1).describe("Model name (supports both native and OpenRouter format)")
282
- })
283
336
  },
284
- responses: {
285
- 200: {
286
- description: "Model capabilities",
287
- content: {
288
- "application/json": {
289
- schema: import_zod_openapi.z.object({
290
- provider: import_zod_openapi.z.enum(import_core2.LLM_PROVIDERS).describe("Provider name"),
291
- model: import_zod_openapi.z.string().describe("Model name as provided"),
292
- supportedFileTypes: import_zod_openapi.z.array(import_zod_openapi.z.enum(import_core2.SUPPORTED_FILE_TYPES)).describe("File types supported by this model"),
293
- reasoning: import_zod_openapi.z.object({
294
- capable: import_zod_openapi.z.boolean().describe(
295
- "Whether Dexto considers this provider/model reasoning-capable (derived from registry metadata plus explicit provider/model rules)"
296
- ),
297
- paradigm: import_zod_openapi.z.enum([
298
- "effort",
299
- "adaptive-effort",
300
- "thinking-level",
301
- "budget",
302
- "none"
303
- ]).describe("Reasoning control paradigm for this model"),
304
- variants: import_zod_openapi.z.array(
305
- import_zod_openapi.z.object({
306
- id: import_zod_openapi.z.string().describe(
307
- "Native reasoning variant identifier"
308
- ),
309
- label: import_zod_openapi.z.string().describe(
310
- "Display label for the native reasoning variant"
311
- )
312
- }).strict()
313
- ).describe("Native reasoning variants exposed to users"),
314
- supportedVariants: import_zod_openapi.z.array(import_zod_openapi.z.string()).describe(
315
- "Native reasoning variant IDs supported for this model/provider"
316
- ),
317
- defaultVariant: import_zod_openapi.z.string().optional().describe(
318
- "Default reasoning variant used when no explicit override is set"
319
- ),
320
- supportsBudgetTokens: import_zod_openapi.z.boolean().describe(
321
- "Whether this provider/model supports a budgetTokens-style escape hatch"
322
- )
323
- }).strict().describe(
324
- "Reasoning tuning capabilities derived from registry metadata and explicit provider/model rules"
325
- )
326
- })
327
- }
337
+ 400: import_responses.BadRequestErrorResponse,
338
+ 404: import_responses.NotFoundErrorResponse,
339
+ 500: import_responses.InternalErrorResponse
340
+ }
341
+ });
342
+ const modelPickerStateRoute = (0, import_zod_openapi.createRoute)({
343
+ method: "get",
344
+ path: "/llm/model-picker-state",
345
+ summary: "Model Picker State",
346
+ description: "Returns hydrated Featured, Recents, Favorites, and Custom sections for the model picker.",
347
+ tags: ["llm"],
348
+ responses: {
349
+ 200: {
350
+ description: "Hydrated model picker sections",
351
+ content: {
352
+ "application/json": {
353
+ schema: import_zod_openapi.z.object({
354
+ featured: import_zod_openapi.z.array(ModelPickerEntrySchema).describe("Curated featured models"),
355
+ recents: import_zod_openapi.z.array(ModelPickerEntrySchema).describe("Most recently used models"),
356
+ favorites: import_zod_openapi.z.array(ModelPickerEntrySchema).describe("User favorited models"),
357
+ custom: import_zod_openapi.z.array(ModelPickerEntrySchema).describe("User-defined custom models")
358
+ }).strict()
328
359
  }
329
360
  }
330
- }
331
- });
332
- const modelPickerStateRoute = (0, import_zod_openapi.createRoute)({
333
- method: "get",
334
- path: "/llm/model-picker-state",
335
- summary: "Model Picker State",
336
- description: "Returns hydrated Featured, Recents, Favorites, and Custom sections for the model picker.",
337
- tags: ["llm"],
338
- responses: {
339
- 200: {
340
- description: "Hydrated model picker sections",
341
- content: {
342
- "application/json": {
343
- schema: import_zod_openapi.z.object({
344
- featured: import_zod_openapi.z.array(ModelPickerEntrySchema).describe("Curated featured models"),
345
- recents: import_zod_openapi.z.array(ModelPickerEntrySchema).describe("Most recently used models"),
346
- favorites: import_zod_openapi.z.array(ModelPickerEntrySchema).describe("User favorited models"),
347
- custom: import_zod_openapi.z.array(ModelPickerEntrySchema).describe("User-defined custom models")
348
- }).strict()
349
- }
361
+ },
362
+ 400: ModelPickerErrorResponses[400],
363
+ 404: ModelPickerErrorResponses[404],
364
+ 500: ModelPickerErrorResponses[500]
365
+ }
366
+ });
367
+ const recordRecentModelRoute = (0, import_zod_openapi.createRoute)({
368
+ method: "post",
369
+ path: "/llm/model-picker-state/recents",
370
+ summary: "Record Recent Model",
371
+ description: "Records a model selection in recents.",
372
+ tags: ["llm"],
373
+ request: {
374
+ body: {
375
+ required: true,
376
+ content: {
377
+ "application/json": {
378
+ schema: ModelPickerModelRefSchema
350
379
  }
351
- },
352
- ...ModelPickerErrorResponses
380
+ }
353
381
  }
354
- });
355
- const recordRecentModelRoute = (0, import_zod_openapi.createRoute)({
356
- method: "post",
357
- path: "/llm/model-picker-state/recents",
358
- summary: "Record Recent Model",
359
- description: "Records a model selection in recents.",
360
- tags: ["llm"],
361
- request: {
362
- body: {
363
- required: true,
364
- content: {
365
- "application/json": {
366
- schema: ModelPickerModelRefSchema
367
- }
382
+ },
383
+ responses: {
384
+ 200: {
385
+ description: "Recent model recorded",
386
+ content: {
387
+ "application/json": {
388
+ schema: import_zod_openapi.z.object({
389
+ ok: import_zod_openapi.z.literal(true).describe("Success indicator")
390
+ }).strict()
368
391
  }
369
392
  }
370
393
  },
371
- responses: {
372
- 200: {
373
- description: "Recent model recorded",
374
- content: {
375
- "application/json": {
376
- schema: import_zod_openapi.z.object({
377
- ok: import_zod_openapi.z.literal(true).describe("Success indicator")
378
- }).strict()
379
- }
394
+ 400: ModelPickerErrorResponses[400],
395
+ 404: ModelPickerErrorResponses[404],
396
+ 500: ModelPickerErrorResponses[500]
397
+ }
398
+ });
399
+ const toggleFavoriteModelRoute = (0, import_zod_openapi.createRoute)({
400
+ method: "post",
401
+ path: "/llm/model-picker-state/favorites/toggle",
402
+ summary: "Toggle Favorite Model",
403
+ description: "Adds or removes a model from favorites.",
404
+ tags: ["llm"],
405
+ request: {
406
+ body: {
407
+ required: true,
408
+ content: {
409
+ "application/json": {
410
+ schema: ModelPickerModelRefSchema
380
411
  }
381
- },
382
- ...ModelPickerErrorResponses
412
+ }
383
413
  }
384
- });
385
- const toggleFavoriteModelRoute = (0, import_zod_openapi.createRoute)({
386
- method: "post",
387
- path: "/llm/model-picker-state/favorites/toggle",
388
- summary: "Toggle Favorite Model",
389
- description: "Adds or removes a model from favorites.",
390
- tags: ["llm"],
391
- request: {
392
- body: {
393
- required: true,
394
- content: {
395
- "application/json": {
396
- schema: ModelPickerModelRefSchema
397
- }
414
+ },
415
+ responses: {
416
+ 200: {
417
+ description: "Favorite toggled",
418
+ content: {
419
+ "application/json": {
420
+ schema: import_zod_openapi.z.object({
421
+ ok: import_zod_openapi.z.literal(true).describe("Success indicator"),
422
+ isFavorite: import_zod_openapi.z.boolean().describe("Whether the model is now favorited")
423
+ }).strict()
398
424
  }
399
425
  }
400
426
  },
401
- responses: {
402
- 200: {
403
- description: "Favorite toggled",
404
- content: {
405
- "application/json": {
406
- schema: import_zod_openapi.z.object({
407
- ok: import_zod_openapi.z.literal(true).describe("Success indicator"),
408
- isFavorite: import_zod_openapi.z.boolean().describe("Whether the model is now favorited")
409
- }).strict()
410
- }
427
+ 400: ModelPickerErrorResponses[400],
428
+ 404: ModelPickerErrorResponses[404],
429
+ 500: ModelPickerErrorResponses[500]
430
+ }
431
+ });
432
+ const setFavoritesRoute = (0, import_zod_openapi.createRoute)({
433
+ method: "put",
434
+ path: "/llm/model-picker-state/favorites",
435
+ summary: "Set Favorite Models",
436
+ description: "Replaces favorite models list. Used by migration or bulk updates.",
437
+ tags: ["llm"],
438
+ request: {
439
+ body: {
440
+ required: true,
441
+ content: {
442
+ "application/json": {
443
+ schema: SetFavoritesBodySchema
411
444
  }
412
- },
413
- ...ModelPickerErrorResponses
445
+ }
414
446
  }
415
- });
416
- const setFavoritesRoute = (0, import_zod_openapi.createRoute)({
417
- method: "put",
418
- path: "/llm/model-picker-state/favorites",
419
- summary: "Set Favorite Models",
420
- description: "Replaces favorite models list. Used by migration or bulk updates.",
421
- tags: ["llm"],
422
- request: {
423
- body: {
424
- required: true,
425
- content: {
426
- "application/json": {
427
- schema: import_zod_openapi.z.object({
428
- favorites: import_zod_openapi.z.array(ModelPickerModelRefSchema).describe("Complete list of favorite model references")
429
- }).strict()
430
- }
447
+ },
448
+ responses: {
449
+ 200: {
450
+ description: "Favorites updated",
451
+ content: {
452
+ "application/json": {
453
+ schema: import_zod_openapi.z.object({
454
+ ok: import_zod_openapi.z.literal(true).describe("Success indicator"),
455
+ count: import_zod_openapi.z.number().int().nonnegative().describe("Number of favorites persisted")
456
+ }).strict()
431
457
  }
432
458
  }
433
459
  },
434
- responses: {
435
- 200: {
436
- description: "Favorites updated",
437
- content: {
438
- "application/json": {
439
- schema: import_zod_openapi.z.object({
440
- ok: import_zod_openapi.z.literal(true).describe("Success indicator"),
441
- count: import_zod_openapi.z.number().int().nonnegative().describe("Number of favorites persisted")
442
- }).strict()
443
- }
444
- }
445
- },
446
- ...ModelPickerErrorResponses
447
- }
448
- });
460
+ 400: ModelPickerErrorResponses[400],
461
+ 404: ModelPickerErrorResponses[404],
462
+ 500: ModelPickerErrorResponses[500]
463
+ }
464
+ });
465
+ function createLlmRouter(getAgent) {
466
+ const app = new import_zod_openapi.OpenAPIHono();
449
467
  const isProviderEnabled = (provider) => provider !== "dexto-nova" || (0, import_agent_management.isDextoAuthEnabled)();
450
468
  const dedupeEntries = (entries) => {
451
469
  const seen = /* @__PURE__ */ new Set();
@@ -585,16 +603,19 @@ function createLlmRouter(getAgent) {
585
603
  }
586
604
  const { apiKey, ...configWithoutKey } = currentConfig;
587
605
  const viaDexto = (0, import_agent_management.isDextoAuthEnabled)() && currentConfig.provider === "dexto-nova";
588
- return ctx.json({
589
- config: {
590
- ...configWithoutKey,
591
- hasApiKey: !!apiKey,
592
- ...displayName && { displayName }
606
+ return ctx.json(
607
+ {
608
+ config: {
609
+ ...configWithoutKey,
610
+ hasApiKey: !!apiKey,
611
+ ...displayName && { displayName }
612
+ },
613
+ routing: {
614
+ viaDexto
615
+ }
593
616
  },
594
- routing: {
595
- viaDexto
596
- }
597
- });
617
+ 200
618
+ );
598
619
  }).openapi(catalogRoute, (ctx) => {
599
620
  const queryParams = ctx.req.valid("query");
600
621
  const includeModels = queryParams.includeModels ?? true;
@@ -677,9 +698,9 @@ function createLlmRouter(getAgent) {
677
698
  flat.push({ provider: id, ...model });
678
699
  }
679
700
  }
680
- return ctx.json({ models: flat });
701
+ return ctx.json({ models: flat }, 200);
681
702
  }
682
- return ctx.json({ providers: filtered });
703
+ return ctx.json({ providers: filtered }, 200);
683
704
  }).openapi(switchRoute, async (ctx) => {
684
705
  const agent = await getAgent(ctx);
685
706
  const raw = ctx.req.valid("json");
@@ -694,20 +715,23 @@ function createLlmRouter(getAgent) {
694
715
  } catch {
695
716
  }
696
717
  const { apiKey, ...configWithoutKey } = config;
697
- return ctx.json({
698
- config: {
699
- ...configWithoutKey,
700
- hasApiKey: !!apiKey
718
+ return ctx.json(
719
+ {
720
+ config: {
721
+ ...configWithoutKey,
722
+ hasApiKey: !!apiKey
723
+ },
724
+ sessionId
701
725
  },
702
- sessionId
703
- });
726
+ 200
727
+ );
704
728
  }).openapi(listCustomModelsRoute, async (ctx) => {
705
729
  const models = await (0, import_agent_management.loadCustomModels)();
706
- return ctx.json({ models });
730
+ return ctx.json({ models }, 200);
707
731
  }).openapi(createCustomModelRoute, async (ctx) => {
708
732
  const model = ctx.req.valid("json");
709
733
  await (0, import_agent_management.saveCustomModel)(model);
710
- return ctx.json({ ok: true, model });
734
+ return ctx.json({ ok: true, model }, 200);
711
735
  }).openapi(deleteCustomModelRoute, async (ctx) => {
712
736
  const { name: encodedName } = ctx.req.valid("param");
713
737
  const name = decodeURIComponent(encodedName);
@@ -724,27 +748,33 @@ function createLlmRouter(getAgent) {
724
748
  return ctx.json({ ok: true, deleted: name }, 200);
725
749
  }).openapi(modelPickerStateRoute, async (ctx) => {
726
750
  const sections = await buildModelPickerSections();
727
- return ctx.json(sections);
751
+ return ctx.json(sections, 200);
728
752
  }).openapi(recordRecentModelRoute, async (ctx) => {
729
753
  const modelRef = ctx.req.valid("json");
730
754
  await (0, import_agent_management.recordRecentModel)(modelRef);
731
- return ctx.json({ ok: true });
755
+ return ctx.json({ ok: true }, 200);
732
756
  }).openapi(toggleFavoriteModelRoute, async (ctx) => {
733
757
  const modelRef = ctx.req.valid("json");
734
758
  const result = await (0, import_agent_management.toggleFavoriteModel)(modelRef);
735
- return ctx.json({
736
- ok: true,
737
- isFavorite: result.isFavorite
738
- });
759
+ return ctx.json(
760
+ {
761
+ ok: true,
762
+ isFavorite: result.isFavorite
763
+ },
764
+ 200
765
+ );
739
766
  }).openapi(setFavoritesRoute, async (ctx) => {
740
767
  const payload = ctx.req.valid("json");
741
768
  const state = await (0, import_agent_management.setFavoriteModels)({
742
769
  favorites: payload.favorites
743
770
  });
744
- return ctx.json({
745
- ok: true,
746
- count: state.favorites.length
747
- });
771
+ return ctx.json(
772
+ {
773
+ ok: true,
774
+ count: state.favorites.length
775
+ },
776
+ 200
777
+ );
748
778
  }).openapi(capabilitiesRoute, (ctx) => {
749
779
  const { provider, model } = ctx.req.valid("query");
750
780
  let supportedFileTypes;
@@ -755,12 +785,15 @@ function createLlmRouter(getAgent) {
755
785
  supportedFileTypes = providerInfo?.supportedFileTypes ?? [];
756
786
  }
757
787
  const reasoning = (0, import_core2.getReasoningProfile)(provider, model);
758
- return ctx.json({
759
- provider,
760
- model,
761
- supportedFileTypes,
762
- reasoning
763
- });
788
+ return ctx.json(
789
+ {
790
+ provider,
791
+ model,
792
+ supportedFileTypes,
793
+ reasoning
794
+ },
795
+ 200
796
+ );
764
797
  });
765
798
  }
766
799
  // Annotate the CommonJS export names for ESM import in node: