@dexto/server 1.2.5 → 1.3.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/hono/index.cjs +8 -1
- package/dist/hono/index.d.ts +80 -68
- package/dist/hono/index.d.ts.map +1 -1
- package/dist/hono/index.js +11 -1
- package/dist/hono/routes/agents.d.ts +18 -15
- package/dist/hono/routes/agents.d.ts.map +1 -1
- package/dist/hono/routes/llm.d.ts +19 -19
- package/dist/hono/routes/memory.d.ts +1 -1
- package/dist/hono/routes/messages.cjs +10 -10
- package/dist/hono/routes/messages.d.ts +15 -15
- package/dist/hono/routes/messages.d.ts.map +1 -1
- package/dist/hono/routes/messages.js +10 -10
- package/dist/hono/routes/prompts.cjs +2 -2
- package/dist/hono/routes/prompts.d.ts +3 -3
- package/dist/hono/routes/prompts.js +2 -2
- package/dist/hono/routes/search.cjs +2 -24
- package/dist/hono/routes/search.d.ts +12 -10
- package/dist/hono/routes/search.d.ts.map +1 -1
- package/dist/hono/routes/search.js +3 -25
- package/dist/hono/routes/sessions.d.ts +6 -5
- package/dist/hono/routes/sessions.d.ts.map +1 -1
- package/dist/hono/routes/static.cjs +77 -0
- package/dist/hono/routes/static.d.ts +41 -0
- package/dist/hono/routes/static.d.ts.map +1 -0
- package/dist/hono/routes/static.js +52 -0
- package/dist/hono/schemas/responses.cjs +45 -22
- package/dist/hono/schemas/responses.d.ts +1205 -201
- package/dist/hono/schemas/responses.d.ts.map +1 -1
- package/dist/hono/schemas/responses.js +52 -32
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OpenAPIHono, createRoute, z } from "@hono/zod-openapi";
|
|
2
|
-
import {
|
|
2
|
+
import { MessageSearchResponseSchema, SessionSearchResponseSchema } from "../schemas/responses.js";
|
|
3
3
|
const MessageSearchQuery = z.object({
|
|
4
4
|
q: z.string().min(1, "Search query is required").describe("Search query string"),
|
|
5
5
|
limit: z.coerce.number().min(1).max(100).optional().describe("Maximum number of results to return (default: 20)"),
|
|
@@ -22,18 +22,7 @@ function createSearchRouter(getAgent) {
|
|
|
22
22
|
responses: {
|
|
23
23
|
200: {
|
|
24
24
|
description: "Message search results",
|
|
25
|
-
content: {
|
|
26
|
-
"application/json": {
|
|
27
|
-
schema: z.object({
|
|
28
|
-
results: z.array(SearchResultSchema).describe("Array of search results"),
|
|
29
|
-
total: z.number().int().nonnegative().describe("Total number of results available"),
|
|
30
|
-
hasMore: z.boolean().describe(
|
|
31
|
-
"Whether there are more results beyond the current page"
|
|
32
|
-
),
|
|
33
|
-
query: z.string().describe("Query that was searched")
|
|
34
|
-
}).strict().describe("Message search response")
|
|
35
|
-
}
|
|
36
|
-
}
|
|
25
|
+
content: { "application/json": { schema: MessageSearchResponseSchema } }
|
|
37
26
|
}
|
|
38
27
|
}
|
|
39
28
|
});
|
|
@@ -47,18 +36,7 @@ function createSearchRouter(getAgent) {
|
|
|
47
36
|
responses: {
|
|
48
37
|
200: {
|
|
49
38
|
description: "Session search results",
|
|
50
|
-
content: {
|
|
51
|
-
"application/json": {
|
|
52
|
-
schema: z.object({
|
|
53
|
-
results: z.array(SessionSearchResultSchema).describe("Array of session search results"),
|
|
54
|
-
total: z.number().int().nonnegative().describe("Total number of sessions with matches"),
|
|
55
|
-
hasMore: z.boolean().describe(
|
|
56
|
-
"Always false - session search returns all matching sessions without pagination"
|
|
57
|
-
),
|
|
58
|
-
query: z.string().describe("Query that was searched")
|
|
59
|
-
}).strict().describe("Session search response")
|
|
60
|
-
}
|
|
61
|
-
}
|
|
39
|
+
content: { "application/json": { schema: SessionSearchResponseSchema } }
|
|
62
40
|
}
|
|
63
41
|
}
|
|
64
42
|
});
|
|
@@ -75,18 +75,16 @@ export declare function createSessionsRouter(getAgent: () => DextoAgent): OpenAP
|
|
|
75
75
|
text: string;
|
|
76
76
|
} | {
|
|
77
77
|
type: "image";
|
|
78
|
-
image
|
|
78
|
+
image: string;
|
|
79
79
|
mimeType?: string | undefined;
|
|
80
80
|
} | {
|
|
81
81
|
type: "file";
|
|
82
82
|
mimeType: string;
|
|
83
|
-
data
|
|
83
|
+
data: string;
|
|
84
84
|
filename?: string | undefined;
|
|
85
85
|
})[] | null;
|
|
86
86
|
role: "system" | "user" | "assistant" | "tool";
|
|
87
|
-
|
|
88
|
-
model?: string | undefined;
|
|
89
|
-
router?: string | undefined;
|
|
87
|
+
id?: string | undefined;
|
|
90
88
|
name?: string | undefined;
|
|
91
89
|
timestamp?: number | undefined;
|
|
92
90
|
reasoning?: string | undefined;
|
|
@@ -96,6 +94,9 @@ export declare function createSessionsRouter(getAgent: () => DextoAgent): OpenAP
|
|
|
96
94
|
reasoningTokens?: number | undefined;
|
|
97
95
|
totalTokens?: number | undefined;
|
|
98
96
|
} | undefined;
|
|
97
|
+
model?: string | undefined;
|
|
98
|
+
provider?: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | undefined;
|
|
99
|
+
router?: "vercel" | "in-built" | undefined;
|
|
99
100
|
toolCalls?: {
|
|
100
101
|
function: {
|
|
101
102
|
name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sessions.d.ts","sourceRoot":"","sources":["../../../src/hono/routes/sessions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkB,MAAM,mBAAmB,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAS9C,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,UAAU
|
|
1
|
+
{"version":3,"file":"sessions.d.ts","sourceRoot":"","sources":["../../../src/hono/routes/sessions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkB,MAAM,mBAAmB,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAS9C,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAgZ9D"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var static_exports = {};
|
|
20
|
+
__export(static_exports, {
|
|
21
|
+
createSpaFallbackHandler: () => createSpaFallbackHandler,
|
|
22
|
+
createStaticRouter: () => createStaticRouter
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(static_exports);
|
|
25
|
+
var import_hono = require("hono");
|
|
26
|
+
var import_serve_static = require("@hono/node-server/serve-static");
|
|
27
|
+
var import_promises = require("node:fs/promises");
|
|
28
|
+
var import_node_path = require("node:path");
|
|
29
|
+
function createStaticRouter(webRoot) {
|
|
30
|
+
const app = new import_hono.Hono();
|
|
31
|
+
app.use("/assets/*", (0, import_serve_static.serveStatic)({ root: webRoot }));
|
|
32
|
+
app.use("/logos/*", (0, import_serve_static.serveStatic)({ root: webRoot }));
|
|
33
|
+
app.use("/favicon.ico", (0, import_serve_static.serveStatic)({ root: webRoot }));
|
|
34
|
+
return app;
|
|
35
|
+
}
|
|
36
|
+
function buildInjectionScript(config) {
|
|
37
|
+
const scripts = [];
|
|
38
|
+
if (config.analytics) {
|
|
39
|
+
const safeJson = JSON.stringify(config.analytics).replace(/</g, "\\u003c");
|
|
40
|
+
scripts.push(`window.__DEXTO_ANALYTICS__ = ${safeJson};`);
|
|
41
|
+
}
|
|
42
|
+
if (scripts.length === 0) return "";
|
|
43
|
+
return `<script>${scripts.join("\n")}</script>`;
|
|
44
|
+
}
|
|
45
|
+
function createSpaFallbackHandler(webRoot, runtimeConfig) {
|
|
46
|
+
const injectionScript = runtimeConfig ? buildInjectionScript(runtimeConfig) : "";
|
|
47
|
+
return async (c) => {
|
|
48
|
+
const path = c.req.path;
|
|
49
|
+
if (/\.[a-zA-Z0-9]+$/.test(path)) {
|
|
50
|
+
return c.json({ error: "Not Found", path }, 404);
|
|
51
|
+
}
|
|
52
|
+
try {
|
|
53
|
+
let html = await (0, import_promises.readFile)((0, import_node_path.join)(webRoot, "index.html"), "utf-8");
|
|
54
|
+
if (injectionScript) {
|
|
55
|
+
html = html.replace("</head>", `${injectionScript}</head>`);
|
|
56
|
+
}
|
|
57
|
+
return c.html(html);
|
|
58
|
+
} catch {
|
|
59
|
+
return c.html(
|
|
60
|
+
`<!DOCTYPE html>
|
|
61
|
+
<html>
|
|
62
|
+
<head><title>Dexto API Server</title></head>
|
|
63
|
+
<body>
|
|
64
|
+
<h1>Dexto API Server</h1>
|
|
65
|
+
<p>WebUI is not available. API endpoints are accessible at <code>/api/*</code></p>
|
|
66
|
+
</body>
|
|
67
|
+
</html>`,
|
|
68
|
+
200
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
74
|
+
0 && (module.exports = {
|
|
75
|
+
createSpaFallbackHandler,
|
|
76
|
+
createStaticRouter
|
|
77
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Hono } from 'hono';
|
|
2
|
+
import type { NotFoundHandler } from 'hono';
|
|
3
|
+
/**
|
|
4
|
+
* Runtime configuration injected into WebUI via window globals.
|
|
5
|
+
* This replaces the Next.js SSR injection that was lost in the Vite migration.
|
|
6
|
+
*
|
|
7
|
+
* TODO: This injection only works in production mode where Hono serves index.html.
|
|
8
|
+
* In dev mode (`pnpm dev`), Vite serves index.html directly, bypassing this injection.
|
|
9
|
+
* To support dev mode analytics, add a `/api/config/analytics` endpoint that the
|
|
10
|
+
* WebUI can fetch as a fallback when `window.__DEXTO_ANALYTICS__` is undefined.
|
|
11
|
+
*/
|
|
12
|
+
export interface WebUIRuntimeConfig {
|
|
13
|
+
analytics?: {
|
|
14
|
+
distinctId: string;
|
|
15
|
+
posthogKey: string;
|
|
16
|
+
posthogHost: string;
|
|
17
|
+
appVersion: string;
|
|
18
|
+
} | null;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Create a static file router for serving WebUI assets.
|
|
22
|
+
*
|
|
23
|
+
* Serves static files from the specified webRoot directory.
|
|
24
|
+
* Note: SPA fallback is handled separately via createSpaFallbackHandler.
|
|
25
|
+
*
|
|
26
|
+
* @param webRoot - Absolute path to the directory containing WebUI build output
|
|
27
|
+
*/
|
|
28
|
+
export declare function createStaticRouter(webRoot: string): Hono<import("hono/types").BlankEnv, import("hono/types").BlankSchema, "/">;
|
|
29
|
+
/**
|
|
30
|
+
* Create a notFound handler for SPA fallback.
|
|
31
|
+
*
|
|
32
|
+
* This handler serves index.html for client-side routes (paths without file extensions).
|
|
33
|
+
* For paths with file extensions (like /openapi.json), it returns a standard 404.
|
|
34
|
+
*
|
|
35
|
+
* This should be registered as app.notFound() to run after all routes fail to match.
|
|
36
|
+
*
|
|
37
|
+
* @param webRoot - Absolute path to the directory containing WebUI build output
|
|
38
|
+
* @param runtimeConfig - Optional runtime configuration to inject into the HTML
|
|
39
|
+
*/
|
|
40
|
+
export declare function createSpaFallbackHandler(webRoot: string, runtimeConfig?: WebUIRuntimeConfig): NotFoundHandler;
|
|
41
|
+
//# sourceMappingURL=static.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"static.d.ts","sourceRoot":"","sources":["../../../src/hono/routes/static.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AAK5C;;;;;;;;GAQG;AACH,MAAM,WAAW,kBAAkB;IAC/B,SAAS,CAAC,EAAE;QACR,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;QACnB,WAAW,EAAE,MAAM,CAAC;QACpB,UAAU,EAAE,MAAM,CAAC;KACtB,GAAG,IAAI,CAAC;CACZ;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,8EAajD;AAmBD;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CACpC,OAAO,EAAE,MAAM,EACf,aAAa,CAAC,EAAE,kBAAkB,GACnC,eAAe,CAuCjB"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Hono } from "hono";
|
|
2
|
+
import { serveStatic } from "@hono/node-server/serve-static";
|
|
3
|
+
import { readFile } from "node:fs/promises";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
function createStaticRouter(webRoot) {
|
|
6
|
+
const app = new Hono();
|
|
7
|
+
app.use("/assets/*", serveStatic({ root: webRoot }));
|
|
8
|
+
app.use("/logos/*", serveStatic({ root: webRoot }));
|
|
9
|
+
app.use("/favicon.ico", serveStatic({ root: webRoot }));
|
|
10
|
+
return app;
|
|
11
|
+
}
|
|
12
|
+
function buildInjectionScript(config) {
|
|
13
|
+
const scripts = [];
|
|
14
|
+
if (config.analytics) {
|
|
15
|
+
const safeJson = JSON.stringify(config.analytics).replace(/</g, "\\u003c");
|
|
16
|
+
scripts.push(`window.__DEXTO_ANALYTICS__ = ${safeJson};`);
|
|
17
|
+
}
|
|
18
|
+
if (scripts.length === 0) return "";
|
|
19
|
+
return `<script>${scripts.join("\n")}</script>`;
|
|
20
|
+
}
|
|
21
|
+
function createSpaFallbackHandler(webRoot, runtimeConfig) {
|
|
22
|
+
const injectionScript = runtimeConfig ? buildInjectionScript(runtimeConfig) : "";
|
|
23
|
+
return async (c) => {
|
|
24
|
+
const path = c.req.path;
|
|
25
|
+
if (/\.[a-zA-Z0-9]+$/.test(path)) {
|
|
26
|
+
return c.json({ error: "Not Found", path }, 404);
|
|
27
|
+
}
|
|
28
|
+
try {
|
|
29
|
+
let html = await readFile(join(webRoot, "index.html"), "utf-8");
|
|
30
|
+
if (injectionScript) {
|
|
31
|
+
html = html.replace("</head>", `${injectionScript}</head>`);
|
|
32
|
+
}
|
|
33
|
+
return c.html(html);
|
|
34
|
+
} catch {
|
|
35
|
+
return c.html(
|
|
36
|
+
`<!DOCTYPE html>
|
|
37
|
+
<html>
|
|
38
|
+
<head><title>Dexto API Server</title></head>
|
|
39
|
+
<body>
|
|
40
|
+
<h1>Dexto API Server</h1>
|
|
41
|
+
<p>WebUI is not available. API endpoints are accessible at <code>/api/*</code></p>
|
|
42
|
+
</body>
|
|
43
|
+
</html>`,
|
|
44
|
+
200
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export {
|
|
50
|
+
createSpaFallbackHandler,
|
|
51
|
+
createStaticRouter
|
|
52
|
+
};
|
|
@@ -21,9 +21,12 @@ __export(responses_exports, {
|
|
|
21
21
|
AgentCardSchema: () => import_core4.AgentCardSchema,
|
|
22
22
|
AgentRegistryEntrySchema: () => AgentRegistryEntrySchema,
|
|
23
23
|
CatalogModelInfoSchema: () => CatalogModelInfoSchema,
|
|
24
|
+
ContentPartSchema: () => ContentPartSchema,
|
|
24
25
|
DeleteResponseSchema: () => DeleteResponseSchema,
|
|
25
26
|
ErrorResponseSchema: () => ErrorResponseSchema,
|
|
27
|
+
FilePartSchema: () => FilePartSchema,
|
|
26
28
|
HttpServerConfigSchema: () => import_core5.HttpServerConfigSchema,
|
|
29
|
+
ImagePartSchema: () => ImagePartSchema,
|
|
27
30
|
InternalMessageSchema: () => InternalMessageSchema,
|
|
28
31
|
InternalResourceConfigSchema: () => import_core7.InternalResourceConfigSchema,
|
|
29
32
|
LLMConfigBaseSchema: () => import_core3.LLMConfigBaseSchema,
|
|
@@ -31,6 +34,7 @@ __export(responses_exports, {
|
|
|
31
34
|
LLMConfigSchema: () => LLMConfigSchema,
|
|
32
35
|
McpServerConfigSchema: () => import_core5.McpServerConfigSchema,
|
|
33
36
|
MemorySchema: () => import_core2.MemorySchema,
|
|
37
|
+
MessageSearchResponseSchema: () => MessageSearchResponseSchema,
|
|
34
38
|
ModelFlatSchema: () => ModelFlatSchema,
|
|
35
39
|
OkResponseSchema: () => OkResponseSchema,
|
|
36
40
|
PromptArgumentSchema: () => PromptArgumentSchema,
|
|
@@ -41,11 +45,14 @@ __export(responses_exports, {
|
|
|
41
45
|
ResourceSchema: () => ResourceSchema,
|
|
42
46
|
SearchResultSchema: () => SearchResultSchema,
|
|
43
47
|
SessionMetadataSchema: () => SessionMetadataSchema,
|
|
48
|
+
SessionSearchResponseSchema: () => SessionSearchResponseSchema,
|
|
44
49
|
SessionSearchResultSchema: () => SessionSearchResultSchema,
|
|
45
50
|
SseServerConfigSchema: () => import_core5.SseServerConfigSchema,
|
|
46
51
|
StatusResponseSchema: () => StatusResponseSchema,
|
|
47
52
|
StdioServerConfigSchema: () => import_core5.StdioServerConfigSchema,
|
|
53
|
+
TextPartSchema: () => TextPartSchema,
|
|
48
54
|
TokenUsageSchema: () => TokenUsageSchema,
|
|
55
|
+
ToolCallSchema: () => ToolCallSchema,
|
|
49
56
|
ToolConfirmationConfigSchema: () => import_core6.ToolConfirmationConfigSchema,
|
|
50
57
|
ToolSchema: () => ToolSchema,
|
|
51
58
|
WebhookSchema: () => WebhookSchema
|
|
@@ -59,35 +66,18 @@ var import_core4 = require("@dexto/core");
|
|
|
59
66
|
var import_core5 = require("@dexto/core");
|
|
60
67
|
var import_core6 = require("@dexto/core");
|
|
61
68
|
var import_core7 = require("@dexto/core");
|
|
62
|
-
const LLMConfigResponseSchema = import_core.LLMConfigBaseSchema.omit({ apiKey: true }).extend({
|
|
63
|
-
hasApiKey: import_zod.z.boolean().optional().describe("Whether an API key is configured")
|
|
64
|
-
}).describe("LLM configuration (apiKey omitted for security)");
|
|
65
|
-
const LLMConfigSchema = import_core.LLMConfigBaseSchema.describe("LLM configuration with API key");
|
|
66
|
-
const BinaryDataSchema = import_zod.z.custom(
|
|
67
|
-
(val) => {
|
|
68
|
-
return typeof val === "string" || val instanceof Buffer || val instanceof Uint8Array || val instanceof URL;
|
|
69
|
-
},
|
|
70
|
-
{ message: "Must be string, Buffer, Uint8Array, or URL" }
|
|
71
|
-
);
|
|
72
|
-
const SessionMetadataSchema = import_zod.z.object({
|
|
73
|
-
id: import_zod.z.string().describe("Unique session identifier"),
|
|
74
|
-
createdAt: import_zod.z.number().int().positive().nullable().describe("Creation timestamp (Unix ms, null if unavailable)"),
|
|
75
|
-
lastActivity: import_zod.z.number().int().positive().nullable().describe("Last activity timestamp (Unix ms, null if unavailable)"),
|
|
76
|
-
messageCount: import_zod.z.number().int().nonnegative().describe("Total number of messages in session"),
|
|
77
|
-
title: import_zod.z.string().optional().nullable().describe("Optional session title")
|
|
78
|
-
}).strict().describe("Session metadata");
|
|
79
69
|
const TextPartSchema = import_zod.z.object({
|
|
80
70
|
type: import_zod.z.literal("text").describe("Part type: text"),
|
|
81
71
|
text: import_zod.z.string().describe("Text content")
|
|
82
72
|
}).strict().describe("Text content part");
|
|
83
73
|
const ImagePartSchema = import_zod.z.object({
|
|
84
74
|
type: import_zod.z.literal("image").describe("Part type: image"),
|
|
85
|
-
image:
|
|
75
|
+
image: import_zod.z.string().describe("Base64-encoded image data"),
|
|
86
76
|
mimeType: import_zod.z.string().optional().describe("MIME type of the image")
|
|
87
77
|
}).strict().describe("Image content part");
|
|
88
78
|
const FilePartSchema = import_zod.z.object({
|
|
89
79
|
type: import_zod.z.literal("file").describe("Part type: file"),
|
|
90
|
-
data:
|
|
80
|
+
data: import_zod.z.string().describe("Base64-encoded file data"),
|
|
91
81
|
mimeType: import_zod.z.string().describe("MIME type of the file"),
|
|
92
82
|
filename: import_zod.z.string().optional().describe("Optional filename")
|
|
93
83
|
}).strict().describe("File content part");
|
|
@@ -107,18 +97,30 @@ const TokenUsageSchema = import_zod.z.object({
|
|
|
107
97
|
totalTokens: import_zod.z.number().int().nonnegative().optional().describe("Total tokens used")
|
|
108
98
|
}).strict().describe("Token usage accounting");
|
|
109
99
|
const InternalMessageSchema = import_zod.z.object({
|
|
100
|
+
id: import_zod.z.string().uuid().optional().describe("Unique message identifier (UUID)"),
|
|
110
101
|
role: import_zod.z.enum(["system", "user", "assistant", "tool"]).describe("Role of the message sender"),
|
|
111
102
|
timestamp: import_zod.z.number().int().positive().optional().describe("Creation timestamp (Unix ms)"),
|
|
112
103
|
content: import_zod.z.union([import_zod.z.string(), import_zod.z.null(), import_zod.z.array(ContentPartSchema)]).describe("Message content (string, null, or array of parts)"),
|
|
113
104
|
reasoning: import_zod.z.string().optional().describe("Optional model reasoning text"),
|
|
114
105
|
tokenUsage: TokenUsageSchema.optional().describe("Optional token usage accounting"),
|
|
115
106
|
model: import_zod.z.string().optional().describe("Model identifier for assistant messages"),
|
|
116
|
-
provider: import_zod.z.
|
|
117
|
-
router: import_zod.z.
|
|
107
|
+
provider: import_zod.z.enum(import_core.LLM_PROVIDERS).optional().describe("Provider identifier for assistant messages"),
|
|
108
|
+
router: import_zod.z.enum(import_core.LLM_ROUTERS).optional().describe("Router metadata for assistant messages"),
|
|
118
109
|
toolCalls: import_zod.z.array(ToolCallSchema).optional().describe("Tool calls made by the assistant"),
|
|
119
110
|
toolCallId: import_zod.z.string().optional().describe("ID of the tool call this message responds to"),
|
|
120
111
|
name: import_zod.z.string().optional().describe("Name of the tool that produced this result")
|
|
121
112
|
}).strict().describe("Internal message representation");
|
|
113
|
+
const LLMConfigResponseSchema = import_core.LLMConfigBaseSchema.omit({ apiKey: true }).extend({
|
|
114
|
+
hasApiKey: import_zod.z.boolean().optional().describe("Whether an API key is configured")
|
|
115
|
+
}).describe("LLM configuration (apiKey omitted for security)");
|
|
116
|
+
const LLMConfigSchema = import_core.LLMConfigBaseSchema.describe("LLM configuration with API key");
|
|
117
|
+
const SessionMetadataSchema = import_zod.z.object({
|
|
118
|
+
id: import_zod.z.string().describe("Unique session identifier"),
|
|
119
|
+
createdAt: import_zod.z.number().int().positive().nullable().describe("Creation timestamp (Unix ms, null if unavailable)"),
|
|
120
|
+
lastActivity: import_zod.z.number().int().positive().nullable().describe("Last activity timestamp (Unix ms, null if unavailable)"),
|
|
121
|
+
messageCount: import_zod.z.number().int().nonnegative().describe("Total number of messages in session"),
|
|
122
|
+
title: import_zod.z.string().optional().nullable().describe("Optional session title")
|
|
123
|
+
}).strict().describe("Session metadata");
|
|
122
124
|
const SearchResultSchema = import_zod.z.object({
|
|
123
125
|
sessionId: import_zod.z.string().describe("Session ID where the message was found"),
|
|
124
126
|
message: InternalMessageSchema.describe("The message that matched the search"),
|
|
@@ -136,6 +138,20 @@ const SessionSearchResultSchema = import_zod.z.object({
|
|
|
136
138
|
messageCount: import_zod.z.number().int().nonnegative().describe("Total messages in session")
|
|
137
139
|
}).strict().describe("Session metadata")
|
|
138
140
|
}).strict().describe("Result of a session search");
|
|
141
|
+
const MessageSearchResponseSchema = import_zod.z.object({
|
|
142
|
+
results: import_zod.z.array(SearchResultSchema).describe("Array of search results"),
|
|
143
|
+
total: import_zod.z.number().int().nonnegative().describe("Total number of results available"),
|
|
144
|
+
hasMore: import_zod.z.boolean().describe("Whether there are more results beyond the current page"),
|
|
145
|
+
query: import_zod.z.string().describe("Query that was searched")
|
|
146
|
+
}).strict().describe("Message search response");
|
|
147
|
+
const SessionSearchResponseSchema = import_zod.z.object({
|
|
148
|
+
results: import_zod.z.array(SessionSearchResultSchema).describe("Array of session search results"),
|
|
149
|
+
total: import_zod.z.number().int().nonnegative().describe("Total number of sessions with matches"),
|
|
150
|
+
hasMore: import_zod.z.boolean().describe(
|
|
151
|
+
"Always false - session search returns all matching sessions without pagination"
|
|
152
|
+
),
|
|
153
|
+
query: import_zod.z.string().describe("Query that was searched")
|
|
154
|
+
}).strict().describe("Session search response");
|
|
139
155
|
const WebhookSchema = import_zod.z.object({
|
|
140
156
|
id: import_zod.z.string().describe("Unique webhook identifier"),
|
|
141
157
|
url: import_zod.z.string().url().describe("Webhook URL to send events to"),
|
|
@@ -210,7 +226,7 @@ const PromptInfoSchema = import_zod.z.object({
|
|
|
210
226
|
title: import_zod.z.string().optional().describe("Prompt title"),
|
|
211
227
|
description: import_zod.z.string().optional().describe("Prompt description"),
|
|
212
228
|
arguments: import_zod.z.array(PromptArgumentSchema).optional().describe("Array of argument definitions"),
|
|
213
|
-
source: import_zod.z.enum(["mcp", "
|
|
229
|
+
source: import_zod.z.enum(["mcp", "config", "custom"]).describe("Source of the prompt"),
|
|
214
230
|
metadata: import_zod.z.record(import_zod.z.unknown()).optional().describe("Additional metadata")
|
|
215
231
|
}).strict().describe("Enhanced prompt information");
|
|
216
232
|
const PromptSchema = import_zod.z.object({
|
|
@@ -245,9 +261,12 @@ const DeleteResponseSchema = import_zod.z.object({
|
|
|
245
261
|
AgentCardSchema,
|
|
246
262
|
AgentRegistryEntrySchema,
|
|
247
263
|
CatalogModelInfoSchema,
|
|
264
|
+
ContentPartSchema,
|
|
248
265
|
DeleteResponseSchema,
|
|
249
266
|
ErrorResponseSchema,
|
|
267
|
+
FilePartSchema,
|
|
250
268
|
HttpServerConfigSchema,
|
|
269
|
+
ImagePartSchema,
|
|
251
270
|
InternalMessageSchema,
|
|
252
271
|
InternalResourceConfigSchema,
|
|
253
272
|
LLMConfigBaseSchema,
|
|
@@ -255,6 +274,7 @@ const DeleteResponseSchema = import_zod.z.object({
|
|
|
255
274
|
LLMConfigSchema,
|
|
256
275
|
McpServerConfigSchema,
|
|
257
276
|
MemorySchema,
|
|
277
|
+
MessageSearchResponseSchema,
|
|
258
278
|
ModelFlatSchema,
|
|
259
279
|
OkResponseSchema,
|
|
260
280
|
PromptArgumentSchema,
|
|
@@ -265,11 +285,14 @@ const DeleteResponseSchema = import_zod.z.object({
|
|
|
265
285
|
ResourceSchema,
|
|
266
286
|
SearchResultSchema,
|
|
267
287
|
SessionMetadataSchema,
|
|
288
|
+
SessionSearchResponseSchema,
|
|
268
289
|
SessionSearchResultSchema,
|
|
269
290
|
SseServerConfigSchema,
|
|
270
291
|
StatusResponseSchema,
|
|
271
292
|
StdioServerConfigSchema,
|
|
293
|
+
TextPartSchema,
|
|
272
294
|
TokenUsageSchema,
|
|
295
|
+
ToolCallSchema,
|
|
273
296
|
ToolConfirmationConfigSchema,
|
|
274
297
|
ToolSchema,
|
|
275
298
|
WebhookSchema
|