@dexto/server 1.2.6 → 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 +59 -50
- package/dist/hono/index.d.ts.map +1 -1
- package/dist/hono/index.js +11 -1
- package/dist/hono/routes/llm.d.ts +19 -19
- 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 +1 -1
- 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 +44 -21
- package/dist/hono/schemas/responses.d.ts +1202 -198
- package/dist/hono/schemas/responses.d.ts.map +1 -1
- package/dist/hono/schemas/responses.js +51 -31
- package/package.json +3 -3
|
@@ -29,11 +29,11 @@ const MessageBodySchema = import_zod_openapi.z.object({
|
|
|
29
29
|
message: import_zod_openapi.z.string().optional().describe("The user message text"),
|
|
30
30
|
sessionId: import_zod_openapi.z.string().min(1, "Session ID is required").describe("The session to use for this message"),
|
|
31
31
|
imageData: import_zod_openapi.z.object({
|
|
32
|
-
|
|
32
|
+
image: import_zod_openapi.z.string().describe("Base64-encoded image data"),
|
|
33
33
|
mimeType: import_zod_openapi.z.string().describe("The MIME type of the image (e.g., image/png)")
|
|
34
34
|
}).optional().describe("Optional image data to include with the message"),
|
|
35
35
|
fileData: import_zod_openapi.z.object({
|
|
36
|
-
|
|
36
|
+
data: import_zod_openapi.z.string().describe("Base64-encoded file data"),
|
|
37
37
|
mimeType: import_zod_openapi.z.string().describe("The MIME type of the file (e.g., application/pdf)"),
|
|
38
38
|
filename: import_zod_openapi.z.string().optional().describe("The filename")
|
|
39
39
|
}).optional().describe("Optional file data to include with the message")
|
|
@@ -174,9 +174,9 @@ function createMessagesRouter(getAgent, approvalCoordinator) {
|
|
|
174
174
|
const agent = getAgent();
|
|
175
175
|
agent.logger.info("Received message via POST /api/message");
|
|
176
176
|
const { message, sessionId, imageData, fileData } = ctx.req.valid("json");
|
|
177
|
-
const imageDataInput = imageData ? { image: imageData.
|
|
177
|
+
const imageDataInput = imageData ? { image: imageData.image, mimeType: imageData.mimeType } : void 0;
|
|
178
178
|
const fileDataInput = fileData ? {
|
|
179
|
-
data: fileData.
|
|
179
|
+
data: fileData.data,
|
|
180
180
|
mimeType: fileData.mimeType,
|
|
181
181
|
...fileData.filename && { filename: fileData.filename }
|
|
182
182
|
} : void 0;
|
|
@@ -193,9 +193,9 @@ function createMessagesRouter(getAgent, approvalCoordinator) {
|
|
|
193
193
|
const agent = getAgent();
|
|
194
194
|
agent.logger.info("Received message via POST /api/message-sync");
|
|
195
195
|
const { message, sessionId, imageData, fileData } = ctx.req.valid("json");
|
|
196
|
-
const imageDataInput = imageData ? { image: imageData.
|
|
196
|
+
const imageDataInput = imageData ? { image: imageData.image, mimeType: imageData.mimeType } : void 0;
|
|
197
197
|
const fileDataInput = fileData ? {
|
|
198
|
-
data: fileData.
|
|
198
|
+
data: fileData.data,
|
|
199
199
|
mimeType: fileData.mimeType,
|
|
200
200
|
...fileData.filename && { filename: fileData.filename }
|
|
201
201
|
} : void 0;
|
|
@@ -228,9 +228,9 @@ function createMessagesRouter(getAgent, approvalCoordinator) {
|
|
|
228
228
|
const agent = getAgent();
|
|
229
229
|
const body = ctx.req.valid("json");
|
|
230
230
|
const { message = "", sessionId, imageData, fileData } = body;
|
|
231
|
-
const imageDataInput = imageData ? { image: imageData.
|
|
231
|
+
const imageDataInput = imageData ? { image: imageData.image, mimeType: imageData.mimeType } : void 0;
|
|
232
232
|
const fileDataInput = fileData ? {
|
|
233
|
-
data: fileData.
|
|
233
|
+
data: fileData.data,
|
|
234
234
|
mimeType: fileData.mimeType,
|
|
235
235
|
...fileData.filename && { filename: fileData.filename }
|
|
236
236
|
} : void 0;
|
|
@@ -277,7 +277,7 @@ function createMessagesRouter(getAgent, approvalCoordinator) {
|
|
|
277
277
|
data: JSON.stringify(approvalEvent.data)
|
|
278
278
|
});
|
|
279
279
|
}
|
|
280
|
-
const eventData = event.
|
|
280
|
+
const eventData = event.name === "llm:error" && event.error instanceof Error ? {
|
|
281
281
|
...event,
|
|
282
282
|
error: {
|
|
283
283
|
message: event.error.message,
|
|
@@ -286,7 +286,7 @@ function createMessagesRouter(getAgent, approvalCoordinator) {
|
|
|
286
286
|
}
|
|
287
287
|
} : event;
|
|
288
288
|
await stream.writeSSE({
|
|
289
|
-
event: event.
|
|
289
|
+
event: event.name,
|
|
290
290
|
data: JSON.stringify(eventData)
|
|
291
291
|
});
|
|
292
292
|
}
|
|
@@ -9,12 +9,12 @@ export declare function createMessagesRouter(getAgent: () => DextoAgent, approva
|
|
|
9
9
|
sessionId: string;
|
|
10
10
|
message?: string | undefined;
|
|
11
11
|
imageData?: {
|
|
12
|
+
image: string;
|
|
12
13
|
mimeType: string;
|
|
13
|
-
base64: string;
|
|
14
14
|
} | undefined;
|
|
15
15
|
fileData?: {
|
|
16
16
|
mimeType: string;
|
|
17
|
-
|
|
17
|
+
data: string;
|
|
18
18
|
filename?: string | undefined;
|
|
19
19
|
} | undefined;
|
|
20
20
|
};
|
|
@@ -31,12 +31,12 @@ export declare function createMessagesRouter(getAgent: () => DextoAgent, approva
|
|
|
31
31
|
sessionId: string;
|
|
32
32
|
message?: string | undefined;
|
|
33
33
|
imageData?: {
|
|
34
|
+
image: string;
|
|
34
35
|
mimeType: string;
|
|
35
|
-
base64: string;
|
|
36
36
|
} | undefined;
|
|
37
37
|
fileData?: {
|
|
38
38
|
mimeType: string;
|
|
39
|
-
|
|
39
|
+
data: string;
|
|
40
40
|
filename?: string | undefined;
|
|
41
41
|
} | undefined;
|
|
42
42
|
};
|
|
@@ -54,12 +54,12 @@ export declare function createMessagesRouter(getAgent: () => DextoAgent, approva
|
|
|
54
54
|
sessionId: string;
|
|
55
55
|
message?: string | undefined;
|
|
56
56
|
imageData?: {
|
|
57
|
+
image: string;
|
|
57
58
|
mimeType: string;
|
|
58
|
-
base64: string;
|
|
59
59
|
} | undefined;
|
|
60
60
|
fileData?: {
|
|
61
61
|
mimeType: string;
|
|
62
|
-
|
|
62
|
+
data: string;
|
|
63
63
|
filename?: string | undefined;
|
|
64
64
|
} | undefined;
|
|
65
65
|
};
|
|
@@ -73,12 +73,12 @@ export declare function createMessagesRouter(getAgent: () => DextoAgent, approva
|
|
|
73
73
|
sessionId: string;
|
|
74
74
|
message?: string | undefined;
|
|
75
75
|
imageData?: {
|
|
76
|
+
image: string;
|
|
76
77
|
mimeType: string;
|
|
77
|
-
base64: string;
|
|
78
78
|
} | undefined;
|
|
79
79
|
fileData?: {
|
|
80
80
|
mimeType: string;
|
|
81
|
-
|
|
81
|
+
data: string;
|
|
82
82
|
filename?: string | undefined;
|
|
83
83
|
} | undefined;
|
|
84
84
|
};
|
|
@@ -86,9 +86,6 @@ export declare function createMessagesRouter(getAgent: () => DextoAgent, approva
|
|
|
86
86
|
output: {
|
|
87
87
|
sessionId: string;
|
|
88
88
|
response: string;
|
|
89
|
-
provider?: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | undefined;
|
|
90
|
-
model?: string | undefined;
|
|
91
|
-
router?: "vercel" | "in-built" | undefined;
|
|
92
89
|
reasoning?: string | undefined;
|
|
93
90
|
tokenUsage?: {
|
|
94
91
|
inputTokens?: number | undefined;
|
|
@@ -96,6 +93,9 @@ export declare function createMessagesRouter(getAgent: () => DextoAgent, approva
|
|
|
96
93
|
reasoningTokens?: number | undefined;
|
|
97
94
|
totalTokens?: number | undefined;
|
|
98
95
|
} | undefined;
|
|
96
|
+
model?: string | undefined;
|
|
97
|
+
provider?: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | undefined;
|
|
98
|
+
router?: "vercel" | "in-built" | undefined;
|
|
99
99
|
};
|
|
100
100
|
outputFormat: "json";
|
|
101
101
|
status: 200;
|
|
@@ -125,12 +125,12 @@ export declare function createMessagesRouter(getAgent: () => DextoAgent, approva
|
|
|
125
125
|
sessionId: string;
|
|
126
126
|
message?: string | undefined;
|
|
127
127
|
imageData?: {
|
|
128
|
+
image: string;
|
|
128
129
|
mimeType: string;
|
|
129
|
-
base64: string;
|
|
130
130
|
} | undefined;
|
|
131
131
|
fileData?: {
|
|
132
132
|
mimeType: string;
|
|
133
|
-
|
|
133
|
+
data: string;
|
|
134
134
|
filename?: string | undefined;
|
|
135
135
|
} | undefined;
|
|
136
136
|
};
|
|
@@ -144,12 +144,12 @@ export declare function createMessagesRouter(getAgent: () => DextoAgent, approva
|
|
|
144
144
|
sessionId: string;
|
|
145
145
|
message?: string | undefined;
|
|
146
146
|
imageData?: {
|
|
147
|
+
image: string;
|
|
147
148
|
mimeType: string;
|
|
148
|
-
base64: string;
|
|
149
149
|
} | undefined;
|
|
150
150
|
fileData?: {
|
|
151
151
|
mimeType: string;
|
|
152
|
-
|
|
152
|
+
data: string;
|
|
153
153
|
filename?: string | undefined;
|
|
154
154
|
} | undefined;
|
|
155
155
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../src/hono/routes/messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkB,MAAM,mBAAmB,CAAC;AAEhE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AA4ClF,wBAAgB,oBAAoB,CAChC,QAAQ,EAAE,MAAM,UAAU,EAC1B,mBAAmB,CAAC,EAAE,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../src/hono/routes/messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkB,MAAM,mBAAmB,CAAC;AAEhE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AA4ClF,wBAAgB,oBAAoB,CAChC,QAAQ,EAAE,MAAM,UAAU,EAC1B,mBAAmB,CAAC,EAAE,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAoW5C"}
|
|
@@ -6,11 +6,11 @@ const MessageBodySchema = z.object({
|
|
|
6
6
|
message: z.string().optional().describe("The user message text"),
|
|
7
7
|
sessionId: z.string().min(1, "Session ID is required").describe("The session to use for this message"),
|
|
8
8
|
imageData: z.object({
|
|
9
|
-
|
|
9
|
+
image: z.string().describe("Base64-encoded image data"),
|
|
10
10
|
mimeType: z.string().describe("The MIME type of the image (e.g., image/png)")
|
|
11
11
|
}).optional().describe("Optional image data to include with the message"),
|
|
12
12
|
fileData: z.object({
|
|
13
|
-
|
|
13
|
+
data: z.string().describe("Base64-encoded file data"),
|
|
14
14
|
mimeType: z.string().describe("The MIME type of the file (e.g., application/pdf)"),
|
|
15
15
|
filename: z.string().optional().describe("The filename")
|
|
16
16
|
}).optional().describe("Optional file data to include with the message")
|
|
@@ -151,9 +151,9 @@ function createMessagesRouter(getAgent, approvalCoordinator) {
|
|
|
151
151
|
const agent = getAgent();
|
|
152
152
|
agent.logger.info("Received message via POST /api/message");
|
|
153
153
|
const { message, sessionId, imageData, fileData } = ctx.req.valid("json");
|
|
154
|
-
const imageDataInput = imageData ? { image: imageData.
|
|
154
|
+
const imageDataInput = imageData ? { image: imageData.image, mimeType: imageData.mimeType } : void 0;
|
|
155
155
|
const fileDataInput = fileData ? {
|
|
156
|
-
data: fileData.
|
|
156
|
+
data: fileData.data,
|
|
157
157
|
mimeType: fileData.mimeType,
|
|
158
158
|
...fileData.filename && { filename: fileData.filename }
|
|
159
159
|
} : void 0;
|
|
@@ -170,9 +170,9 @@ function createMessagesRouter(getAgent, approvalCoordinator) {
|
|
|
170
170
|
const agent = getAgent();
|
|
171
171
|
agent.logger.info("Received message via POST /api/message-sync");
|
|
172
172
|
const { message, sessionId, imageData, fileData } = ctx.req.valid("json");
|
|
173
|
-
const imageDataInput = imageData ? { image: imageData.
|
|
173
|
+
const imageDataInput = imageData ? { image: imageData.image, mimeType: imageData.mimeType } : void 0;
|
|
174
174
|
const fileDataInput = fileData ? {
|
|
175
|
-
data: fileData.
|
|
175
|
+
data: fileData.data,
|
|
176
176
|
mimeType: fileData.mimeType,
|
|
177
177
|
...fileData.filename && { filename: fileData.filename }
|
|
178
178
|
} : void 0;
|
|
@@ -205,9 +205,9 @@ function createMessagesRouter(getAgent, approvalCoordinator) {
|
|
|
205
205
|
const agent = getAgent();
|
|
206
206
|
const body = ctx.req.valid("json");
|
|
207
207
|
const { message = "", sessionId, imageData, fileData } = body;
|
|
208
|
-
const imageDataInput = imageData ? { image: imageData.
|
|
208
|
+
const imageDataInput = imageData ? { image: imageData.image, mimeType: imageData.mimeType } : void 0;
|
|
209
209
|
const fileDataInput = fileData ? {
|
|
210
|
-
data: fileData.
|
|
210
|
+
data: fileData.data,
|
|
211
211
|
mimeType: fileData.mimeType,
|
|
212
212
|
...fileData.filename && { filename: fileData.filename }
|
|
213
213
|
} : void 0;
|
|
@@ -254,7 +254,7 @@ function createMessagesRouter(getAgent, approvalCoordinator) {
|
|
|
254
254
|
data: JSON.stringify(approvalEvent.data)
|
|
255
255
|
});
|
|
256
256
|
}
|
|
257
|
-
const eventData = event.
|
|
257
|
+
const eventData = event.name === "llm:error" && event.error instanceof Error ? {
|
|
258
258
|
...event,
|
|
259
259
|
error: {
|
|
260
260
|
message: event.error.message,
|
|
@@ -263,7 +263,7 @@ function createMessagesRouter(getAgent, approvalCoordinator) {
|
|
|
263
263
|
}
|
|
264
264
|
} : event;
|
|
265
265
|
await stream.writeSSE({
|
|
266
|
-
event: event.
|
|
266
|
+
event: event.name,
|
|
267
267
|
data: JSON.stringify(eventData)
|
|
268
268
|
});
|
|
269
269
|
}
|
|
@@ -37,7 +37,7 @@ const CustomPromptRequestSchema = import_zod_openapi.z.object({
|
|
|
37
37
|
}).strict()
|
|
38
38
|
).optional().describe("Array of argument definitions"),
|
|
39
39
|
resource: import_zod_openapi.z.object({
|
|
40
|
-
|
|
40
|
+
data: import_zod_openapi.z.string().min(1, "Resource data is required").describe("Base64-encoded resource data"),
|
|
41
41
|
mimeType: import_zod_openapi.z.string().min(1, "Resource MIME type is required").describe("MIME type of the resource (e.g., text/plain, application/pdf)"),
|
|
42
42
|
filename: import_zod_openapi.z.string().optional().describe("Resource filename")
|
|
43
43
|
}).strict().optional().describe("Attach a resource to this prompt")
|
|
@@ -182,7 +182,7 @@ function createPromptsRouter(getAgent) {
|
|
|
182
182
|
...promptArguments && promptArguments.length > 0 ? { arguments: promptArguments } : {},
|
|
183
183
|
...payload.resource ? {
|
|
184
184
|
resource: {
|
|
185
|
-
|
|
185
|
+
data: payload.resource.data,
|
|
186
186
|
mimeType: payload.resource.mimeType,
|
|
187
187
|
...payload.resource.filename ? { filename: payload.resource.filename } : {}
|
|
188
188
|
}
|
|
@@ -14,7 +14,7 @@ const CustomPromptRequestSchema = z.object({
|
|
|
14
14
|
}).strict()
|
|
15
15
|
).optional().describe("Array of argument definitions"),
|
|
16
16
|
resource: z.object({
|
|
17
|
-
|
|
17
|
+
data: z.string().min(1, "Resource data is required").describe("Base64-encoded resource data"),
|
|
18
18
|
mimeType: z.string().min(1, "Resource MIME type is required").describe("MIME type of the resource (e.g., text/plain, application/pdf)"),
|
|
19
19
|
filename: z.string().optional().describe("Resource filename")
|
|
20
20
|
}).strict().optional().describe("Attach a resource to this prompt")
|
|
@@ -159,7 +159,7 @@ function createPromptsRouter(getAgent) {
|
|
|
159
159
|
...promptArguments && promptArguments.length > 0 ? { arguments: promptArguments } : {},
|
|
160
160
|
...payload.resource ? {
|
|
161
161
|
resource: {
|
|
162
|
-
|
|
162
|
+
data: payload.resource.data,
|
|
163
163
|
mimeType: payload.resource.mimeType,
|
|
164
164
|
...payload.resource.filename ? { filename: payload.resource.filename } : {}
|
|
165
165
|
}
|
|
@@ -45,18 +45,7 @@ function createSearchRouter(getAgent) {
|
|
|
45
45
|
responses: {
|
|
46
46
|
200: {
|
|
47
47
|
description: "Message search results",
|
|
48
|
-
content: {
|
|
49
|
-
"application/json": {
|
|
50
|
-
schema: import_zod_openapi.z.object({
|
|
51
|
-
results: import_zod_openapi.z.array(import_responses.SearchResultSchema).describe("Array of search results"),
|
|
52
|
-
total: import_zod_openapi.z.number().int().nonnegative().describe("Total number of results available"),
|
|
53
|
-
hasMore: import_zod_openapi.z.boolean().describe(
|
|
54
|
-
"Whether there are more results beyond the current page"
|
|
55
|
-
),
|
|
56
|
-
query: import_zod_openapi.z.string().describe("Query that was searched")
|
|
57
|
-
}).strict().describe("Message search response")
|
|
58
|
-
}
|
|
59
|
-
}
|
|
48
|
+
content: { "application/json": { schema: import_responses.MessageSearchResponseSchema } }
|
|
60
49
|
}
|
|
61
50
|
}
|
|
62
51
|
});
|
|
@@ -70,18 +59,7 @@ function createSearchRouter(getAgent) {
|
|
|
70
59
|
responses: {
|
|
71
60
|
200: {
|
|
72
61
|
description: "Session search results",
|
|
73
|
-
content: {
|
|
74
|
-
"application/json": {
|
|
75
|
-
schema: import_zod_openapi.z.object({
|
|
76
|
-
results: import_zod_openapi.z.array(import_responses.SessionSearchResultSchema).describe("Array of session search results"),
|
|
77
|
-
total: import_zod_openapi.z.number().int().nonnegative().describe("Total number of sessions with matches"),
|
|
78
|
-
hasMore: import_zod_openapi.z.boolean().describe(
|
|
79
|
-
"Always false - session search returns all matching sessions without pagination"
|
|
80
|
-
),
|
|
81
|
-
query: import_zod_openapi.z.string().describe("Query that was searched")
|
|
82
|
-
}).strict().describe("Session search response")
|
|
83
|
-
}
|
|
84
|
-
}
|
|
62
|
+
content: { "application/json": { schema: import_responses.SessionSearchResponseSchema } }
|
|
85
63
|
}
|
|
86
64
|
}
|
|
87
65
|
});
|
|
@@ -21,18 +21,16 @@ export declare function createSearchRouter(getAgent: () => DextoAgent): OpenAPIH
|
|
|
21
21
|
text: string;
|
|
22
22
|
} | {
|
|
23
23
|
type: "image";
|
|
24
|
-
image
|
|
24
|
+
image: string;
|
|
25
25
|
mimeType?: string | undefined;
|
|
26
26
|
} | {
|
|
27
27
|
type: "file";
|
|
28
28
|
mimeType: string;
|
|
29
|
-
data
|
|
29
|
+
data: string;
|
|
30
30
|
filename?: string | undefined;
|
|
31
31
|
})[] | null;
|
|
32
32
|
role: "system" | "user" | "assistant" | "tool";
|
|
33
|
-
|
|
34
|
-
model?: string | undefined;
|
|
35
|
-
router?: string | undefined;
|
|
33
|
+
id?: string | undefined;
|
|
36
34
|
name?: string | undefined;
|
|
37
35
|
timestamp?: number | undefined;
|
|
38
36
|
reasoning?: string | undefined;
|
|
@@ -42,6 +40,9 @@ export declare function createSearchRouter(getAgent: () => DextoAgent): OpenAPIH
|
|
|
42
40
|
reasoningTokens?: number | undefined;
|
|
43
41
|
totalTokens?: number | undefined;
|
|
44
42
|
} | undefined;
|
|
43
|
+
model?: string | undefined;
|
|
44
|
+
provider?: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | undefined;
|
|
45
|
+
router?: "vercel" | "in-built" | undefined;
|
|
45
46
|
toolCalls?: {
|
|
46
47
|
function: {
|
|
47
48
|
name: string;
|
|
@@ -84,18 +85,16 @@ export declare function createSearchRouter(getAgent: () => DextoAgent): OpenAPIH
|
|
|
84
85
|
text: string;
|
|
85
86
|
} | {
|
|
86
87
|
type: "image";
|
|
87
|
-
image
|
|
88
|
+
image: string;
|
|
88
89
|
mimeType?: string | undefined;
|
|
89
90
|
} | {
|
|
90
91
|
type: "file";
|
|
91
92
|
mimeType: string;
|
|
92
|
-
data
|
|
93
|
+
data: string;
|
|
93
94
|
filename?: string | undefined;
|
|
94
95
|
})[] | null;
|
|
95
96
|
role: "system" | "user" | "assistant" | "tool";
|
|
96
|
-
|
|
97
|
-
model?: string | undefined;
|
|
98
|
-
router?: string | undefined;
|
|
97
|
+
id?: string | undefined;
|
|
99
98
|
name?: string | undefined;
|
|
100
99
|
timestamp?: number | undefined;
|
|
101
100
|
reasoning?: string | undefined;
|
|
@@ -105,6 +104,9 @@ export declare function createSearchRouter(getAgent: () => DextoAgent): OpenAPIH
|
|
|
105
104
|
reasoningTokens?: number | undefined;
|
|
106
105
|
totalTokens?: number | undefined;
|
|
107
106
|
} | undefined;
|
|
107
|
+
model?: string | undefined;
|
|
108
|
+
provider?: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | undefined;
|
|
109
|
+
router?: "vercel" | "in-built" | undefined;
|
|
108
110
|
toolCalls?: {
|
|
109
111
|
function: {
|
|
110
112
|
name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/hono/routes/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkB,MAAM,mBAAmB,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AA2B9C,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,UAAU
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/hono/routes/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkB,MAAM,mBAAmB,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AA2B9C,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAwD5D"}
|
|
@@ -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"}
|