@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.
- package/dist/a2a/jsonrpc/methods.cjs +1 -1
- package/dist/a2a/jsonrpc/methods.d.ts +14 -4
- package/dist/a2a/jsonrpc/methods.d.ts.map +1 -1
- package/dist/a2a/jsonrpc/methods.js +1 -1
- package/dist/approval/wire-approval-events.cjs +44 -0
- package/dist/approval/wire-approval-events.d.ts +4 -0
- package/dist/approval/wire-approval-events.d.ts.map +1 -0
- package/dist/approval/wire-approval-events.js +20 -0
- package/dist/events/session-sse-subscriber.cjs +167 -0
- package/dist/events/session-sse-subscriber.d.ts +13 -0
- package/dist/events/session-sse-subscriber.d.ts.map +1 -0
- package/dist/events/session-sse-subscriber.js +143 -0
- package/dist/hono/__tests__/test-fixtures.cjs +8 -0
- package/dist/hono/__tests__/test-fixtures.d.ts +1 -0
- package/dist/hono/__tests__/test-fixtures.d.ts.map +1 -1
- package/dist/hono/__tests__/test-fixtures.js +8 -0
- package/dist/hono/index.cjs +40 -8
- package/dist/hono/index.d.ts +45 -4531
- package/dist/hono/index.d.ts.map +1 -1
- package/dist/hono/index.js +43 -9
- package/dist/hono/node/index.cjs +51 -6
- package/dist/hono/node/index.d.ts.map +1 -1
- package/dist/hono/node/index.js +51 -6
- package/dist/hono/routes/a2a-jsonrpc.d.ts.map +1 -1
- package/dist/hono/routes/a2a-tasks.cjs +158 -32
- package/dist/hono/routes/a2a-tasks.d.ts +1 -502
- package/dist/hono/routes/a2a-tasks.d.ts.map +1 -1
- package/dist/hono/routes/a2a-tasks.js +162 -32
- package/dist/hono/routes/a2a.d.ts.map +1 -1
- package/dist/hono/routes/agents.cjs +410 -329
- package/dist/hono/routes/agents.d.ts +16043 -68
- package/dist/hono/routes/agents.d.ts.map +1 -1
- package/dist/hono/routes/agents.js +418 -330
- package/dist/hono/routes/approvals.cjs +102 -88
- package/dist/hono/routes/approvals.d.ts +2089 -142
- package/dist/hono/routes/approvals.d.ts.map +1 -1
- package/dist/hono/routes/approvals.js +108 -89
- package/dist/hono/routes/dexto-auth.cjs +40 -33
- package/dist/hono/routes/dexto-auth.d.ts +401 -2
- package/dist/hono/routes/dexto-auth.d.ts.map +1 -1
- package/dist/hono/routes/dexto-auth.js +40 -33
- package/dist/hono/routes/discovery.cjs +16 -14
- package/dist/hono/routes/discovery.d.ts +586 -1
- package/dist/hono/routes/discovery.d.ts.map +1 -1
- package/dist/hono/routes/discovery.js +16 -14
- package/dist/hono/routes/greeting.cjs +26 -22
- package/dist/hono/routes/greeting.d.ts +787 -3
- package/dist/hono/routes/greeting.d.ts.map +1 -1
- package/dist/hono/routes/greeting.js +26 -22
- package/dist/hono/routes/health.d.ts +1 -1
- package/dist/hono/routes/key.cjs +60 -52
- package/dist/hono/routes/key.d.ts +1597 -1
- package/dist/hono/routes/key.d.ts.map +1 -1
- package/dist/hono/routes/key.js +60 -52
- package/dist/hono/routes/llm.cjs +382 -349
- package/dist/hono/routes/llm.d.ts +12148 -98
- package/dist/hono/routes/llm.d.ts.map +1 -1
- package/dist/hono/routes/llm.js +386 -349
- package/dist/hono/routes/mcp.cjs +257 -226
- package/dist/hono/routes/mcp.d.ts +6605 -309
- package/dist/hono/routes/mcp.d.ts.map +1 -1
- package/dist/hono/routes/mcp.js +263 -225
- package/dist/hono/routes/memory.cjs +102 -89
- package/dist/hono/routes/memory.d.ts +5368 -4
- package/dist/hono/routes/memory.d.ts.map +1 -1
- package/dist/hono/routes/memory.js +108 -90
- package/dist/hono/routes/messages.cjs +189 -191
- package/dist/hono/routes/messages.d.ts +3900 -12
- package/dist/hono/routes/messages.d.ts.map +1 -1
- package/dist/hono/routes/messages.js +192 -191
- package/dist/hono/routes/models.cjs +106 -64
- package/dist/hono/routes/models.d.ts +2875 -2
- package/dist/hono/routes/models.d.ts.map +1 -1
- package/dist/hono/routes/models.js +108 -64
- package/dist/hono/routes/openrouter.cjs +79 -65
- package/dist/hono/routes/openrouter.d.ts +854 -1
- package/dist/hono/routes/openrouter.d.ts.map +1 -1
- package/dist/hono/routes/openrouter.js +79 -65
- package/dist/hono/routes/prompts.cjs +136 -109
- package/dist/hono/routes/prompts.d.ts +2818 -10
- package/dist/hono/routes/prompts.d.ts.map +1 -1
- package/dist/hono/routes/prompts.js +138 -109
- package/dist/hono/routes/queue.cjs +133 -120
- package/dist/hono/routes/queue.d.ts +5240 -11
- package/dist/hono/routes/queue.d.ts.map +1 -1
- package/dist/hono/routes/queue.js +136 -120
- package/dist/hono/routes/resources.cjs +65 -46
- package/dist/hono/routes/resources.d.ts +1983 -5
- package/dist/hono/routes/resources.d.ts.map +1 -1
- package/dist/hono/routes/resources.js +72 -47
- package/dist/hono/routes/schedules.cjs +233 -226
- package/dist/hono/routes/schedules.d.ts +4198 -22
- package/dist/hono/routes/schedules.d.ts.map +1 -1
- package/dist/hono/routes/schedules.js +233 -226
- package/dist/hono/routes/search.cjs +34 -30
- package/dist/hono/routes/search.d.ts +3094 -17
- package/dist/hono/routes/search.d.ts.map +1 -1
- package/dist/hono/routes/search.js +40 -31
- package/dist/hono/routes/sessions.cjs +491 -393
- package/dist/hono/routes/sessions.d.ts +18263 -65
- package/dist/hono/routes/sessions.d.ts.map +1 -1
- package/dist/hono/routes/sessions.js +497 -395
- package/dist/hono/routes/static.d.ts.map +1 -1
- package/dist/hono/routes/system-prompt.cjs +57 -61
- package/dist/hono/routes/system-prompt.d.ts +1228 -2
- package/dist/hono/routes/system-prompt.d.ts.map +1 -1
- package/dist/hono/routes/system-prompt.js +58 -62
- package/dist/hono/routes/tools.cjs +29 -34
- package/dist/hono/routes/tools.d.ts +1755 -6
- package/dist/hono/routes/tools.d.ts.map +1 -1
- package/dist/hono/routes/tools.js +33 -33
- package/dist/hono/routes/webhooks.cjs +115 -123
- package/dist/hono/routes/webhooks.d.ts +2501 -11
- package/dist/hono/routes/webhooks.d.ts.map +1 -1
- package/dist/hono/routes/webhooks.js +120 -124
- package/dist/hono/routes/workspaces.cjs +84 -79
- package/dist/hono/routes/workspaces.d.ts +2093 -2
- package/dist/hono/routes/workspaces.d.ts.map +1 -1
- package/dist/hono/routes/workspaces.js +89 -80
- package/dist/hono/schemas/responses.cjs +463 -260
- package/dist/hono/schemas/responses.d.ts +1893 -209
- package/dist/hono/schemas/responses.d.ts.map +1 -1
- package/dist/hono/schemas/responses.js +203 -14
- package/dist/hono/start-server.cjs +9 -0
- package/dist/hono/start-server.d.ts.map +1 -1
- package/dist/hono/start-server.js +9 -0
- package/dist/hono/types.d.ts +11 -0
- package/dist/hono/types.d.ts.map +1 -1
- package/dist/index.cjs +5 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/package.json +7 -7
package/dist/hono/routes/llm.cjs
CHANGED
|
@@ -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
|
|
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
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
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("
|
|
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
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
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
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
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
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
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
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
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
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
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
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
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
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
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
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
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
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
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
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
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
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
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
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
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
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
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
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
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
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
606
|
+
return ctx.json(
|
|
607
|
+
{
|
|
608
|
+
config: {
|
|
609
|
+
...configWithoutKey,
|
|
610
|
+
hasApiKey: !!apiKey,
|
|
611
|
+
...displayName && { displayName }
|
|
612
|
+
},
|
|
613
|
+
routing: {
|
|
614
|
+
viaDexto
|
|
615
|
+
}
|
|
593
616
|
},
|
|
594
|
-
|
|
595
|
-
|
|
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
|
-
|
|
699
|
-
|
|
700
|
-
|
|
718
|
+
return ctx.json(
|
|
719
|
+
{
|
|
720
|
+
config: {
|
|
721
|
+
...configWithoutKey,
|
|
722
|
+
hasApiKey: !!apiKey
|
|
723
|
+
},
|
|
724
|
+
sessionId
|
|
701
725
|
},
|
|
702
|
-
|
|
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
|
-
|
|
737
|
-
|
|
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
|
-
|
|
746
|
-
|
|
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
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
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:
|