@dexto/server 1.5.7 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/events/a2a-sse-subscriber.d.ts +1 -1
- package/dist/hono/__tests__/test-fixtures.cjs +27 -6
- package/dist/hono/__tests__/test-fixtures.d.ts +2 -1
- package/dist/hono/__tests__/test-fixtures.d.ts.map +1 -1
- package/dist/hono/__tests__/test-fixtures.js +31 -6
- package/dist/hono/index.cjs +17 -2
- package/dist/hono/index.d.ts +897 -76
- package/dist/hono/index.d.ts.map +1 -1
- package/dist/hono/index.js +17 -2
- package/dist/hono/routes/a2a-tasks.d.ts +6 -6
- package/dist/hono/routes/agents.cjs +38 -27
- package/dist/hono/routes/agents.d.ts +2 -1
- package/dist/hono/routes/agents.d.ts.map +1 -1
- package/dist/hono/routes/agents.js +37 -31
- package/dist/hono/routes/discovery.cjs +99 -22
- package/dist/hono/routes/discovery.d.ts +14 -12
- package/dist/hono/routes/discovery.d.ts.map +1 -1
- package/dist/hono/routes/discovery.js +89 -22
- package/dist/hono/routes/key.d.ts +4 -4
- package/dist/hono/routes/llm.cjs +21 -7
- package/dist/hono/routes/llm.d.ts +12 -10
- package/dist/hono/routes/llm.d.ts.map +1 -1
- package/dist/hono/routes/llm.js +22 -7
- package/dist/hono/routes/mcp.cjs +96 -14
- package/dist/hono/routes/mcp.d.ts +138 -3
- package/dist/hono/routes/mcp.d.ts.map +1 -1
- package/dist/hono/routes/mcp.js +97 -15
- package/dist/hono/routes/memory.d.ts +4 -4
- package/dist/hono/routes/messages.d.ts +1 -1
- package/dist/hono/routes/models.d.ts +1 -1
- package/dist/hono/routes/queue.cjs +9 -3
- package/dist/hono/routes/queue.d.ts +3 -0
- package/dist/hono/routes/queue.d.ts.map +1 -1
- package/dist/hono/routes/queue.js +9 -3
- package/dist/hono/routes/resources.d.ts +1 -1
- package/dist/hono/routes/schedules.cjs +455 -0
- package/dist/hono/routes/schedules.d.ts +472 -0
- package/dist/hono/routes/schedules.d.ts.map +1 -0
- package/dist/hono/routes/schedules.js +439 -0
- package/dist/hono/routes/search.d.ts +3 -3
- package/dist/hono/routes/sessions.cjs +10 -4
- package/dist/hono/routes/sessions.d.ts +136 -6
- package/dist/hono/routes/sessions.d.ts.map +1 -1
- package/dist/hono/routes/sessions.js +10 -4
- package/dist/hono/routes/tools.cjs +12 -19
- package/dist/hono/routes/tools.d.ts +5 -3
- package/dist/hono/routes/tools.d.ts.map +1 -1
- package/dist/hono/routes/tools.js +12 -19
- package/dist/hono/routes/workspaces.cjs +136 -0
- package/dist/hono/routes/workspaces.d.ts +77 -0
- package/dist/hono/routes/workspaces.d.ts.map +1 -0
- package/dist/hono/routes/workspaces.js +112 -0
- package/dist/hono/schemas/responses.cjs +82 -7
- package/dist/hono/schemas/responses.d.ts +403 -53
- package/dist/hono/schemas/responses.d.ts.map +1 -1
- package/dist/hono/schemas/responses.js +75 -6
- package/dist/hono/start-server.cjs +4 -3
- package/dist/hono/start-server.d.ts +15 -6
- package/dist/hono/start-server.d.ts.map +1 -1
- package/dist/hono/start-server.js +5 -4
- package/dist/index.cjs +9 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/mcp/mcp-handler.d.ts +2 -2
- package/dist/mcp/mcp-handler.d.ts.map +1 -1
- package/package.json +8 -5
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { OpenAPIHono } from '@hono/zod-openapi';
|
|
2
|
-
|
|
2
|
+
import type { Context } from 'hono';
|
|
3
|
+
export type GetAgentConfigPathFn = (ctx: Context) => string | undefined | Promise<string | undefined>;
|
|
4
|
+
export declare function createDiscoveryRouter(getAgentConfigPath: GetAgentConfigPathFn): OpenAPIHono<import("hono").Env, {
|
|
3
5
|
"/discovery": {
|
|
4
6
|
$get: {
|
|
5
7
|
input: {};
|
|
6
8
|
output: {
|
|
7
|
-
|
|
8
|
-
description: string;
|
|
9
|
-
name: string;
|
|
10
|
-
}[];
|
|
11
|
-
customTools: {
|
|
9
|
+
blob: {
|
|
12
10
|
type: string;
|
|
13
|
-
category: "
|
|
11
|
+
category: "blob" | "tools" | "compaction" | "database";
|
|
14
12
|
metadata?: {
|
|
15
13
|
[x: string]: import("hono/utils/types").JSONValue;
|
|
16
14
|
description?: string | undefined;
|
|
@@ -19,31 +17,35 @@ export declare function createDiscoveryRouter(): OpenAPIHono<import("hono").Env,
|
|
|
19
17
|
}[];
|
|
20
18
|
compaction: {
|
|
21
19
|
type: string;
|
|
22
|
-
category: "
|
|
20
|
+
category: "blob" | "tools" | "compaction" | "database";
|
|
23
21
|
metadata?: {
|
|
24
22
|
[x: string]: import("hono/utils/types").JSONValue;
|
|
25
23
|
description?: string | undefined;
|
|
26
24
|
displayName?: string | undefined;
|
|
27
25
|
} | undefined;
|
|
28
26
|
}[];
|
|
29
|
-
|
|
27
|
+
database: {
|
|
30
28
|
type: string;
|
|
31
|
-
category: "
|
|
29
|
+
category: "blob" | "tools" | "compaction" | "database";
|
|
32
30
|
metadata?: {
|
|
33
31
|
[x: string]: import("hono/utils/types").JSONValue;
|
|
34
32
|
description?: string | undefined;
|
|
35
33
|
displayName?: string | undefined;
|
|
36
34
|
} | undefined;
|
|
37
35
|
}[];
|
|
38
|
-
|
|
36
|
+
toolFactories: {
|
|
39
37
|
type: string;
|
|
40
|
-
category: "
|
|
38
|
+
category: "blob" | "tools" | "compaction" | "database";
|
|
41
39
|
metadata?: {
|
|
42
40
|
[x: string]: import("hono/utils/types").JSONValue;
|
|
43
41
|
description?: string | undefined;
|
|
44
42
|
displayName?: string | undefined;
|
|
45
43
|
} | undefined;
|
|
46
44
|
}[];
|
|
45
|
+
builtinTools: {
|
|
46
|
+
description: string;
|
|
47
|
+
name: string;
|
|
48
|
+
}[];
|
|
47
49
|
};
|
|
48
50
|
outputFormat: "json";
|
|
49
51
|
status: 200;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../../../src/hono/routes/discovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../../../src/hono/routes/discovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkB,MAAM,mBAAmB,CAAC;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAMpC,MAAM,MAAM,oBAAoB,GAAG,CAC/B,GAAG,EAAE,OAAO,KACX,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;AAgJtD,wBAAgB,qBAAqB,CAAC,kBAAkB,EAAE,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAqB7E"}
|
|
@@ -1,42 +1,109 @@
|
|
|
1
1
|
import { OpenAPIHono, createRoute, z } from "@hono/zod-openapi";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import { loadImage } from "@dexto/agent-config";
|
|
3
|
+
import { loadAgentConfig } from "@dexto/agent-management";
|
|
4
|
+
import imageLocal from "@dexto/image-local";
|
|
5
|
+
const DiscoveredFactorySchema = z.object({
|
|
6
|
+
type: z.string().describe("Factory type identifier"),
|
|
7
|
+
category: z.enum(["blob", "database", "compaction", "tools"]).describe("Factory category"),
|
|
6
8
|
metadata: z.object({
|
|
7
9
|
displayName: z.string().optional().describe("Human-readable display name"),
|
|
8
|
-
description: z.string().optional().describe("
|
|
9
|
-
}).passthrough().optional().describe("Optional metadata about the
|
|
10
|
-
}).describe("Information about a registered
|
|
11
|
-
const
|
|
12
|
-
name: z.string().describe('
|
|
10
|
+
description: z.string().optional().describe("Factory description")
|
|
11
|
+
}).passthrough().optional().describe("Optional metadata about the factory")
|
|
12
|
+
}).describe("Information about a registered factory");
|
|
13
|
+
const ToolSchema = z.object({
|
|
14
|
+
name: z.string().describe('Built-in tool name identifier (e.g., "search_history", "ask_user")'),
|
|
13
15
|
description: z.string().describe("Human-readable description of what the tool does")
|
|
14
|
-
}).describe("Information about
|
|
16
|
+
}).describe("Information about a built-in tool");
|
|
15
17
|
const DiscoveryResponseSchema = z.object({
|
|
16
|
-
blob: z.array(
|
|
17
|
-
database: z.array(
|
|
18
|
-
compaction: z.array(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}).describe("Discovery response with
|
|
22
|
-
function
|
|
18
|
+
blob: z.array(DiscoveredFactorySchema).describe("Blob storage factories"),
|
|
19
|
+
database: z.array(DiscoveredFactorySchema).describe("Database factories"),
|
|
20
|
+
compaction: z.array(DiscoveredFactorySchema).describe("Compaction strategy factories"),
|
|
21
|
+
toolFactories: z.array(DiscoveredFactorySchema).describe("Tool factories"),
|
|
22
|
+
builtinTools: z.array(ToolSchema).describe("Built-in tools available for configuration")
|
|
23
|
+
}).describe("Discovery response with factories grouped by category");
|
|
24
|
+
function toMetadata(metadata) {
|
|
25
|
+
if (!metadata || typeof metadata !== "object" || Array.isArray(metadata)) {
|
|
26
|
+
return void 0;
|
|
27
|
+
}
|
|
28
|
+
const record = metadata;
|
|
29
|
+
const result = {};
|
|
30
|
+
for (const [key, value] of Object.entries(record)) {
|
|
31
|
+
if (value === void 0) {
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
if (value === null || typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
35
|
+
result[key] = value;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return Object.keys(result).length > 0 ? result : void 0;
|
|
39
|
+
}
|
|
40
|
+
async function resolveImage(options) {
|
|
41
|
+
const { ctx, getAgentConfigPath } = options;
|
|
42
|
+
const configPath = await getAgentConfigPath(ctx);
|
|
43
|
+
if (!configPath) {
|
|
44
|
+
return imageLocal;
|
|
45
|
+
}
|
|
46
|
+
const rawConfig = await loadAgentConfig(configPath);
|
|
47
|
+
const imageName = (typeof rawConfig.image === "string" && rawConfig.image.length > 0 ? rawConfig.image : void 0) ?? process.env.DEXTO_IMAGE ?? "@dexto/image-local";
|
|
48
|
+
if (imageName === "@dexto/image-local") {
|
|
49
|
+
return imageLocal;
|
|
50
|
+
}
|
|
51
|
+
try {
|
|
52
|
+
return await loadImage(imageName);
|
|
53
|
+
} catch (error) {
|
|
54
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
55
|
+
throw new Error(
|
|
56
|
+
`Failed to load image module '${imageName}'. Ensure it is installed and that the host called setImageImporter(). Original error: ${message}`
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
async function listDiscoveryFactories(options) {
|
|
61
|
+
const image = await resolveImage(options);
|
|
62
|
+
const blob = Object.entries(image.storage.blob).map(([type, factory]) => ({
|
|
63
|
+
type,
|
|
64
|
+
category: "blob",
|
|
65
|
+
metadata: toMetadata(factory.metadata)
|
|
66
|
+
}));
|
|
67
|
+
const database = Object.entries(image.storage.database).map(([type, factory]) => ({
|
|
68
|
+
type,
|
|
69
|
+
category: "database",
|
|
70
|
+
metadata: toMetadata(factory.metadata)
|
|
71
|
+
}));
|
|
72
|
+
const compaction = Object.entries(image.compaction).map(([type, factory]) => ({
|
|
73
|
+
type,
|
|
74
|
+
category: "compaction",
|
|
75
|
+
metadata: toMetadata(factory.metadata)
|
|
76
|
+
}));
|
|
77
|
+
const toolFactories = Object.entries(image.tools);
|
|
78
|
+
const builtinFactory = toolFactories.find(([type]) => type === "builtin-tools")?.[1];
|
|
79
|
+
const builtinTools = builtinFactory ? builtinFactory.create(builtinFactory.configSchema.parse({ type: "builtin-tools" })).map((tool) => ({
|
|
80
|
+
name: tool.id,
|
|
81
|
+
description: tool.description
|
|
82
|
+
})) : [];
|
|
83
|
+
const toolFactoriesList = toolFactories.filter(([type]) => type !== "builtin-tools").map(([type, factory]) => ({
|
|
84
|
+
type,
|
|
85
|
+
category: "tools",
|
|
86
|
+
metadata: toMetadata(factory.metadata)
|
|
87
|
+
}));
|
|
88
|
+
return { blob, database, compaction, toolFactories: toolFactoriesList, builtinTools };
|
|
89
|
+
}
|
|
90
|
+
function createDiscoveryRouter(getAgentConfigPath) {
|
|
23
91
|
const app = new OpenAPIHono();
|
|
24
92
|
const discoveryRoute = createRoute({
|
|
25
93
|
method: "get",
|
|
26
94
|
path: "/discovery",
|
|
27
|
-
summary: "Discover Available
|
|
28
|
-
description: "Returns all
|
|
95
|
+
summary: "Discover Available Factories and Tools",
|
|
96
|
+
description: "Returns all available factories (storage, compaction, tools) for the currently active image.",
|
|
29
97
|
tags: ["discovery"],
|
|
30
98
|
responses: {
|
|
31
99
|
200: {
|
|
32
|
-
description: "Available
|
|
100
|
+
description: "Available factories grouped by category",
|
|
33
101
|
content: { "application/json": { schema: DiscoveryResponseSchema } }
|
|
34
102
|
}
|
|
35
103
|
}
|
|
36
104
|
});
|
|
37
105
|
return app.openapi(discoveryRoute, async (ctx) => {
|
|
38
|
-
|
|
39
|
-
return ctx.json(providers);
|
|
106
|
+
return ctx.json(await listDiscoveryFactories({ ctx, getAgentConfigPath }));
|
|
40
107
|
});
|
|
41
108
|
}
|
|
42
109
|
export {
|
|
@@ -13,11 +13,11 @@ export declare function createKeyRouter(): OpenAPIHono<import("hono").Env, {
|
|
|
13
13
|
$get: {
|
|
14
14
|
input: {
|
|
15
15
|
param: {
|
|
16
|
-
provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto";
|
|
16
|
+
provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto-nova";
|
|
17
17
|
};
|
|
18
18
|
};
|
|
19
19
|
output: {
|
|
20
|
-
provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto";
|
|
20
|
+
provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto-nova";
|
|
21
21
|
hasKey: boolean;
|
|
22
22
|
envVar: string;
|
|
23
23
|
keyValue?: string | undefined;
|
|
@@ -31,12 +31,12 @@ export declare function createKeyRouter(): OpenAPIHono<import("hono").Env, {
|
|
|
31
31
|
$post: {
|
|
32
32
|
input: {
|
|
33
33
|
json: {
|
|
34
|
-
provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto";
|
|
34
|
+
provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto-nova";
|
|
35
35
|
apiKey: string;
|
|
36
36
|
};
|
|
37
37
|
};
|
|
38
38
|
output: {
|
|
39
|
-
provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto";
|
|
39
|
+
provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto-nova";
|
|
40
40
|
ok: true;
|
|
41
41
|
envVar: string;
|
|
42
42
|
};
|
package/dist/hono/routes/llm.cjs
CHANGED
|
@@ -28,11 +28,17 @@ var import_agent_management = require("@dexto/agent-management");
|
|
|
28
28
|
var import_responses = require("../schemas/responses.js");
|
|
29
29
|
const CurrentQuerySchema = import_zod_openapi.z.object({
|
|
30
30
|
sessionId: import_zod_openapi.z.string().optional().describe("Session identifier to retrieve session-specific LLM configuration")
|
|
31
|
-
}).describe("Query parameters for getting current LLM configuration");
|
|
31
|
+
}).strict().describe("Query parameters for getting current LLM configuration");
|
|
32
32
|
const CatalogQuerySchema = import_zod_openapi.z.object({
|
|
33
|
+
scope: import_zod_openapi.z.enum(["curated", "all"]).default("all").describe(
|
|
34
|
+
"Catalog scope: 'curated' returns a small, UI-friendly set of models; 'all' returns the full registry (can be large)"
|
|
35
|
+
),
|
|
33
36
|
provider: import_zod_openapi.z.union([import_zod_openapi.z.string(), import_zod_openapi.z.array(import_zod_openapi.z.string())]).optional().transform(
|
|
34
37
|
(value) => Array.isArray(value) ? value : value ? value.split(",") : void 0
|
|
35
38
|
).describe("Comma-separated list of LLM providers to filter by"),
|
|
39
|
+
includeModels: 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(
|
|
40
|
+
(raw) => raw === "true" || raw === "1" ? true : raw === "false" || raw === "0" ? false : void 0
|
|
41
|
+
).describe("Include models list in the response (true or false)"),
|
|
36
42
|
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(
|
|
37
43
|
(raw) => raw === "true" || raw === "1" ? true : raw === "false" || raw === "0" ? false : void 0
|
|
38
44
|
).describe("Filter by API key presence (true or false)"),
|
|
@@ -41,7 +47,7 @@ const CatalogQuerySchema = import_zod_openapi.z.object({
|
|
|
41
47
|
(raw) => raw === "true" || raw === "1" ? true : raw === "false" || raw === "0" ? false : void 0
|
|
42
48
|
).describe("Include only default models (true or false)"),
|
|
43
49
|
mode: import_zod_openapi.z.enum(["grouped", "flat"]).default("grouped").describe("Response format mode (grouped by provider or flat list)")
|
|
44
|
-
}).describe("Query parameters for filtering and formatting the LLM catalog");
|
|
50
|
+
}).strict().describe("Query parameters for filtering and formatting the LLM catalog");
|
|
45
51
|
const SwitchLLMBodySchema = import_core2.LLMUpdatesSchema.and(
|
|
46
52
|
import_zod_openapi.z.object({
|
|
47
53
|
sessionId: import_zod_openapi.z.string().optional().describe("Session identifier for session-specific LLM configuration")
|
|
@@ -224,7 +230,7 @@ function createLlmRouter(getAgent) {
|
|
|
224
230
|
method: "get",
|
|
225
231
|
path: "/llm/capabilities",
|
|
226
232
|
summary: "Get Model Capabilities",
|
|
227
|
-
description: "Returns the capabilities (supported file types) for a specific provider/model combination. Handles gateway providers (dexto, openrouter) by resolving to the underlying model capabilities.",
|
|
233
|
+
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.",
|
|
228
234
|
tags: ["llm"],
|
|
229
235
|
request: {
|
|
230
236
|
query: import_zod_openapi.z.object({
|
|
@@ -267,7 +273,7 @@ function createLlmRouter(getAgent) {
|
|
|
267
273
|
} catch {
|
|
268
274
|
}
|
|
269
275
|
const { apiKey, ...configWithoutKey } = currentConfig;
|
|
270
|
-
const viaDexto = (0, import_agent_management.isDextoAuthEnabled)() && currentConfig.provider === "dexto";
|
|
276
|
+
const viaDexto = (0, import_agent_management.isDextoAuthEnabled)() && currentConfig.provider === "dexto-nova";
|
|
271
277
|
return ctx.json({
|
|
272
278
|
config: {
|
|
273
279
|
...configWithoutKey,
|
|
@@ -280,15 +286,23 @@ function createLlmRouter(getAgent) {
|
|
|
280
286
|
});
|
|
281
287
|
}).openapi(catalogRoute, (ctx) => {
|
|
282
288
|
const queryParams = ctx.req.valid("query");
|
|
289
|
+
const includeModels = queryParams.includeModels ?? true;
|
|
290
|
+
const scope = queryParams.scope ?? "all";
|
|
283
291
|
const providers = {};
|
|
284
292
|
for (const provider of import_core2.LLM_PROVIDERS) {
|
|
285
|
-
if (provider === "dexto" && !(0, import_agent_management.isDextoAuthEnabled)()) {
|
|
293
|
+
if (provider === "dexto-nova" && !(0, import_agent_management.isDextoAuthEnabled)()) {
|
|
286
294
|
continue;
|
|
287
295
|
}
|
|
288
296
|
const info = import_core2.LLM_REGISTRY[provider];
|
|
289
|
-
const displayName = provider.charAt(0).toUpperCase() + provider.slice(1);
|
|
297
|
+
const displayName = provider === "dexto-nova" ? "Dexto Nova" : provider.charAt(0).toUpperCase() + provider.slice(1);
|
|
290
298
|
const keyStatus = (0, import_agent_management.getProviderKeyStatus)(provider);
|
|
291
|
-
const models = (
|
|
299
|
+
const models = (() => {
|
|
300
|
+
if (!includeModels) return [];
|
|
301
|
+
if (scope === "all") {
|
|
302
|
+
return (0, import_core2.getAllModelsForProvider)(provider);
|
|
303
|
+
}
|
|
304
|
+
return (0, import_core2.getCuratedModelsForProvider)(provider);
|
|
305
|
+
})();
|
|
292
306
|
providers[provider] = {
|
|
293
307
|
name: displayName,
|
|
294
308
|
hasApiKey: keyStatus.hasApiKey,
|
|
@@ -13,7 +13,7 @@ export declare function createLlmRouter(getAgent: GetAgentFn): OpenAPIHono<impor
|
|
|
13
13
|
output: {
|
|
14
14
|
config: {
|
|
15
15
|
model: string;
|
|
16
|
-
provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto";
|
|
16
|
+
provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto-nova";
|
|
17
17
|
maxIterations?: number | undefined;
|
|
18
18
|
baseURL?: string | undefined;
|
|
19
19
|
maxInputTokens?: number | undefined;
|
|
@@ -38,6 +38,8 @@ export declare function createLlmRouter(getAgent: GetAgentFn): OpenAPIHono<impor
|
|
|
38
38
|
input: {
|
|
39
39
|
query: {
|
|
40
40
|
provider?: string | string[] | undefined;
|
|
41
|
+
scope?: "curated" | "all" | undefined;
|
|
42
|
+
includeModels?: "0" | "1" | "true" | "false" | undefined;
|
|
41
43
|
hasKey?: "0" | "1" | "true" | "false" | undefined;
|
|
42
44
|
fileType?: "image" | "audio" | "pdf" | undefined;
|
|
43
45
|
defaultOnly?: "0" | "1" | "true" | "false" | undefined;
|
|
@@ -398,7 +400,7 @@ export declare function createLlmRouter(getAgent: GetAgentFn): OpenAPIHono<impor
|
|
|
398
400
|
} | undefined;
|
|
399
401
|
}[];
|
|
400
402
|
} | undefined;
|
|
401
|
-
dexto?: {
|
|
403
|
+
"dexto-nova"?: {
|
|
402
404
|
name: string;
|
|
403
405
|
hasApiKey: boolean;
|
|
404
406
|
supportedFileTypes: ("image" | "audio" | "pdf")[];
|
|
@@ -449,7 +451,7 @@ export declare function createLlmRouter(getAgent: GetAgentFn): OpenAPIHono<impor
|
|
|
449
451
|
input: {
|
|
450
452
|
json: {
|
|
451
453
|
model?: string | undefined;
|
|
452
|
-
provider?: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto" | undefined;
|
|
454
|
+
provider?: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto-nova" | undefined;
|
|
453
455
|
apiKey?: string | undefined;
|
|
454
456
|
maxInputTokens?: number | undefined;
|
|
455
457
|
maxIterations?: number | undefined;
|
|
@@ -465,7 +467,7 @@ export declare function createLlmRouter(getAgent: GetAgentFn): OpenAPIHono<impor
|
|
|
465
467
|
output: {
|
|
466
468
|
config: {
|
|
467
469
|
model: string;
|
|
468
|
-
provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto";
|
|
470
|
+
provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto-nova";
|
|
469
471
|
maxIterations?: number | undefined;
|
|
470
472
|
baseURL?: string | undefined;
|
|
471
473
|
maxInputTokens?: number | undefined;
|
|
@@ -488,7 +490,7 @@ export declare function createLlmRouter(getAgent: GetAgentFn): OpenAPIHono<impor
|
|
|
488
490
|
output: {
|
|
489
491
|
models: {
|
|
490
492
|
name: string;
|
|
491
|
-
provider: "
|
|
493
|
+
provider: "openai-compatible" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto-nova";
|
|
492
494
|
apiKey?: string | undefined | undefined;
|
|
493
495
|
baseURL?: string | undefined | undefined;
|
|
494
496
|
reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined | undefined;
|
|
@@ -508,7 +510,7 @@ export declare function createLlmRouter(getAgent: GetAgentFn): OpenAPIHono<impor
|
|
|
508
510
|
input: {
|
|
509
511
|
json: {
|
|
510
512
|
name: string;
|
|
511
|
-
provider?: "
|
|
513
|
+
provider?: "openai-compatible" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto-nova" | undefined;
|
|
512
514
|
apiKey?: string | undefined;
|
|
513
515
|
baseURL?: string | undefined;
|
|
514
516
|
reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
|
|
@@ -521,7 +523,7 @@ export declare function createLlmRouter(getAgent: GetAgentFn): OpenAPIHono<impor
|
|
|
521
523
|
output: {
|
|
522
524
|
model: {
|
|
523
525
|
name: string;
|
|
524
|
-
provider: "
|
|
526
|
+
provider: "openai-compatible" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto-nova";
|
|
525
527
|
apiKey?: string | undefined | undefined;
|
|
526
528
|
baseURL?: string | undefined | undefined;
|
|
527
529
|
reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined | undefined;
|
|
@@ -557,8 +559,8 @@ export declare function createLlmRouter(getAgent: GetAgentFn): OpenAPIHono<impor
|
|
|
557
559
|
};
|
|
558
560
|
};
|
|
559
561
|
output: {
|
|
560
|
-
ok: false;
|
|
561
562
|
error: string;
|
|
563
|
+
ok: false;
|
|
562
564
|
};
|
|
563
565
|
outputFormat: "json";
|
|
564
566
|
status: 404;
|
|
@@ -570,12 +572,12 @@ export declare function createLlmRouter(getAgent: GetAgentFn): OpenAPIHono<impor
|
|
|
570
572
|
input: {
|
|
571
573
|
query: {
|
|
572
574
|
model: string;
|
|
573
|
-
provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto";
|
|
575
|
+
provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto-nova";
|
|
574
576
|
};
|
|
575
577
|
};
|
|
576
578
|
output: {
|
|
577
579
|
model: string;
|
|
578
|
-
provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto";
|
|
580
|
+
provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto-nova";
|
|
579
581
|
supportedFileTypes: ("image" | "audio" | "pdf")[];
|
|
580
582
|
};
|
|
581
583
|
outputFormat: "json";
|
|
@@ -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;
|
|
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;AAuB9C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAOpC,KAAK,UAAU,GAAG,CAAC,GAAG,EAAE,OAAO,KAAK,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAmFrE,wBAAgB,eAAe,CAAC,QAAQ,EAAE,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAwdnD"}
|
package/dist/hono/routes/llm.js
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
SUPPORTED_FILE_TYPES,
|
|
7
7
|
supportsBaseURL,
|
|
8
8
|
getAllModelsForProvider,
|
|
9
|
+
getCuratedModelsForProvider,
|
|
9
10
|
getSupportedFileTypesForModel,
|
|
10
11
|
LLMUpdatesSchema
|
|
11
12
|
} from "@dexto/core";
|
|
@@ -24,11 +25,17 @@ import {
|
|
|
24
25
|
} from "../schemas/responses.js";
|
|
25
26
|
const CurrentQuerySchema = z.object({
|
|
26
27
|
sessionId: z.string().optional().describe("Session identifier to retrieve session-specific LLM configuration")
|
|
27
|
-
}).describe("Query parameters for getting current LLM configuration");
|
|
28
|
+
}).strict().describe("Query parameters for getting current LLM configuration");
|
|
28
29
|
const CatalogQuerySchema = z.object({
|
|
30
|
+
scope: z.enum(["curated", "all"]).default("all").describe(
|
|
31
|
+
"Catalog scope: 'curated' returns a small, UI-friendly set of models; 'all' returns the full registry (can be large)"
|
|
32
|
+
),
|
|
29
33
|
provider: z.union([z.string(), z.array(z.string())]).optional().transform(
|
|
30
34
|
(value) => Array.isArray(value) ? value : value ? value.split(",") : void 0
|
|
31
35
|
).describe("Comma-separated list of LLM providers to filter by"),
|
|
36
|
+
includeModels: z.union([z.literal("true"), z.literal("false"), z.literal("1"), z.literal("0")]).optional().transform(
|
|
37
|
+
(raw) => raw === "true" || raw === "1" ? true : raw === "false" || raw === "0" ? false : void 0
|
|
38
|
+
).describe("Include models list in the response (true or false)"),
|
|
32
39
|
hasKey: z.union([z.literal("true"), z.literal("false"), z.literal("1"), z.literal("0")]).optional().transform(
|
|
33
40
|
(raw) => raw === "true" || raw === "1" ? true : raw === "false" || raw === "0" ? false : void 0
|
|
34
41
|
).describe("Filter by API key presence (true or false)"),
|
|
@@ -37,7 +44,7 @@ const CatalogQuerySchema = z.object({
|
|
|
37
44
|
(raw) => raw === "true" || raw === "1" ? true : raw === "false" || raw === "0" ? false : void 0
|
|
38
45
|
).describe("Include only default models (true or false)"),
|
|
39
46
|
mode: z.enum(["grouped", "flat"]).default("grouped").describe("Response format mode (grouped by provider or flat list)")
|
|
40
|
-
}).describe("Query parameters for filtering and formatting the LLM catalog");
|
|
47
|
+
}).strict().describe("Query parameters for filtering and formatting the LLM catalog");
|
|
41
48
|
const SwitchLLMBodySchema = LLMUpdatesSchema.and(
|
|
42
49
|
z.object({
|
|
43
50
|
sessionId: z.string().optional().describe("Session identifier for session-specific LLM configuration")
|
|
@@ -220,7 +227,7 @@ function createLlmRouter(getAgent) {
|
|
|
220
227
|
method: "get",
|
|
221
228
|
path: "/llm/capabilities",
|
|
222
229
|
summary: "Get Model Capabilities",
|
|
223
|
-
description: "Returns the capabilities (supported file types) for a specific provider/model combination. Handles gateway providers (dexto, openrouter) by resolving to the underlying model capabilities.",
|
|
230
|
+
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.",
|
|
224
231
|
tags: ["llm"],
|
|
225
232
|
request: {
|
|
226
233
|
query: z.object({
|
|
@@ -263,7 +270,7 @@ function createLlmRouter(getAgent) {
|
|
|
263
270
|
} catch {
|
|
264
271
|
}
|
|
265
272
|
const { apiKey, ...configWithoutKey } = currentConfig;
|
|
266
|
-
const viaDexto = isDextoAuthEnabled() && currentConfig.provider === "dexto";
|
|
273
|
+
const viaDexto = isDextoAuthEnabled() && currentConfig.provider === "dexto-nova";
|
|
267
274
|
return ctx.json({
|
|
268
275
|
config: {
|
|
269
276
|
...configWithoutKey,
|
|
@@ -276,15 +283,23 @@ function createLlmRouter(getAgent) {
|
|
|
276
283
|
});
|
|
277
284
|
}).openapi(catalogRoute, (ctx) => {
|
|
278
285
|
const queryParams = ctx.req.valid("query");
|
|
286
|
+
const includeModels = queryParams.includeModels ?? true;
|
|
287
|
+
const scope = queryParams.scope ?? "all";
|
|
279
288
|
const providers = {};
|
|
280
289
|
for (const provider of LLM_PROVIDERS) {
|
|
281
|
-
if (provider === "dexto" && !isDextoAuthEnabled()) {
|
|
290
|
+
if (provider === "dexto-nova" && !isDextoAuthEnabled()) {
|
|
282
291
|
continue;
|
|
283
292
|
}
|
|
284
293
|
const info = LLM_REGISTRY[provider];
|
|
285
|
-
const displayName = provider.charAt(0).toUpperCase() + provider.slice(1);
|
|
294
|
+
const displayName = provider === "dexto-nova" ? "Dexto Nova" : provider.charAt(0).toUpperCase() + provider.slice(1);
|
|
286
295
|
const keyStatus = getProviderKeyStatus(provider);
|
|
287
|
-
const models =
|
|
296
|
+
const models = (() => {
|
|
297
|
+
if (!includeModels) return [];
|
|
298
|
+
if (scope === "all") {
|
|
299
|
+
return getAllModelsForProvider(provider);
|
|
300
|
+
}
|
|
301
|
+
return getCuratedModelsForProvider(provider);
|
|
302
|
+
})();
|
|
288
303
|
providers[provider] = {
|
|
289
304
|
name: displayName,
|
|
290
305
|
hasApiKey: keyStatus.hasApiKey,
|