@dexto/server 1.4.0 → 1.5.1
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/__tests__/test-fixtures.cjs +1 -1
- package/dist/hono/__tests__/test-fixtures.d.ts.map +1 -1
- package/dist/hono/__tests__/test-fixtures.js +1 -1
- package/dist/hono/index.cjs +41 -5
- package/dist/hono/index.d.ts +470 -456
- package/dist/hono/index.d.ts.map +1 -1
- package/dist/hono/index.js +41 -5
- package/dist/hono/routes/a2a-jsonrpc.cjs +3 -3
- package/dist/hono/routes/a2a-jsonrpc.d.ts +4 -1
- package/dist/hono/routes/a2a-jsonrpc.d.ts.map +1 -1
- package/dist/hono/routes/a2a-jsonrpc.js +3 -3
- package/dist/hono/routes/a2a-tasks.cjs +5 -5
- package/dist/hono/routes/a2a-tasks.d.ts +13 -10
- package/dist/hono/routes/a2a-tasks.d.ts.map +1 -1
- package/dist/hono/routes/a2a-tasks.js +5 -5
- package/dist/hono/routes/agents.cjs +25 -35
- package/dist/hono/routes/agents.d.ts +6 -407
- package/dist/hono/routes/agents.d.ts.map +1 -1
- package/dist/hono/routes/agents.js +25 -35
- package/dist/hono/routes/approvals.cjs +2 -2
- package/dist/hono/routes/approvals.d.ts +4 -1
- package/dist/hono/routes/approvals.d.ts.map +1 -1
- package/dist/hono/routes/approvals.js +2 -2
- package/dist/hono/routes/discovery.cjs +68 -0
- package/dist/hono/routes/discovery.d.ts +53 -0
- package/dist/hono/routes/discovery.d.ts.map +1 -0
- package/dist/hono/routes/discovery.js +44 -0
- package/dist/hono/routes/greeting.cjs +2 -2
- package/dist/hono/routes/greeting.d.ts +2 -2
- package/dist/hono/routes/greeting.d.ts.map +1 -1
- package/dist/hono/routes/greeting.js +2 -2
- package/dist/hono/routes/health.d.ts +2 -2
- package/dist/hono/routes/health.d.ts.map +1 -1
- package/dist/hono/routes/key.cjs +110 -0
- package/dist/hono/routes/key.d.ts +48 -0
- package/dist/hono/routes/key.d.ts.map +1 -0
- package/dist/hono/routes/key.js +90 -0
- package/dist/hono/routes/llm.cjs +12 -34
- package/dist/hono/routes/llm.d.ts +179 -25
- package/dist/hono/routes/llm.d.ts.map +1 -1
- package/dist/hono/routes/llm.js +12 -35
- package/dist/hono/routes/mcp.cjs +8 -8
- package/dist/hono/routes/mcp.d.ts +2 -2
- package/dist/hono/routes/mcp.d.ts.map +1 -1
- package/dist/hono/routes/mcp.js +8 -8
- package/dist/hono/routes/memory.cjs +5 -5
- package/dist/hono/routes/memory.d.ts +8 -5
- package/dist/hono/routes/memory.d.ts.map +1 -1
- package/dist/hono/routes/memory.js +5 -5
- package/dist/hono/routes/messages.cjs +4 -4
- package/dist/hono/routes/messages.d.ts +12 -12
- package/dist/hono/routes/messages.d.ts.map +1 -1
- package/dist/hono/routes/messages.js +4 -4
- package/dist/hono/routes/models.cjs +319 -0
- package/dist/hono/routes/models.d.ts +107 -0
- package/dist/hono/routes/models.d.ts.map +1 -0
- package/dist/hono/routes/models.js +305 -0
- package/dist/hono/routes/openrouter.cjs +153 -0
- package/dist/hono/routes/openrouter.d.ts +54 -0
- package/dist/hono/routes/openrouter.d.ts.map +1 -0
- package/dist/hono/routes/openrouter.js +134 -0
- package/dist/hono/routes/prompts.cjs +5 -5
- package/dist/hono/routes/prompts.d.ts +4 -1
- package/dist/hono/routes/prompts.d.ts.map +1 -1
- package/dist/hono/routes/prompts.js +5 -5
- package/dist/hono/routes/queue.cjs +4 -4
- package/dist/hono/routes/queue.d.ts +4 -1
- package/dist/hono/routes/queue.d.ts.map +1 -1
- package/dist/hono/routes/queue.js +4 -4
- package/dist/hono/routes/resources.cjs +3 -3
- package/dist/hono/routes/resources.d.ts +2 -2
- package/dist/hono/routes/resources.d.ts.map +1 -1
- package/dist/hono/routes/resources.js +3 -3
- package/dist/hono/routes/search.cjs +2 -2
- package/dist/hono/routes/search.d.ts +6 -3
- package/dist/hono/routes/search.d.ts.map +1 -1
- package/dist/hono/routes/search.js +2 -2
- package/dist/hono/routes/sessions.cjs +9 -9
- package/dist/hono/routes/sessions.d.ts +3 -3
- package/dist/hono/routes/sessions.d.ts.map +1 -1
- package/dist/hono/routes/sessions.js +9 -9
- package/dist/hono/routes/tools.cjs +126 -0
- package/dist/hono/routes/tools.d.ts +42 -0
- package/dist/hono/routes/tools.d.ts.map +1 -0
- package/dist/hono/routes/tools.js +102 -0
- package/dist/hono/routes/webhooks.cjs +4 -4
- package/dist/hono/routes/webhooks.d.ts +4 -1
- package/dist/hono/routes/webhooks.d.ts.map +1 -1
- package/dist/hono/routes/webhooks.js +4 -4
- package/dist/hono/schemas/responses.d.ts +47 -41
- package/dist/hono/schemas/responses.d.ts.map +1 -1
- package/dist/hono/start-server.cjs +102 -0
- package/dist/hono/start-server.d.ts +61 -0
- package/dist/hono/start-server.d.ts.map +1 -0
- package/dist/hono/start-server.js +78 -0
- package/dist/index.cjs +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/package.json +5 -4
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { OpenAPIHono
|
|
1
|
+
import { OpenAPIHono } from '@hono/zod-openapi';
|
|
2
2
|
import type { DextoAgent } from '@dexto/core';
|
|
3
|
+
import type { Context } from 'hono';
|
|
4
|
+
type GetAgentFn = (ctx: Context) => DextoAgent | Promise<DextoAgent>;
|
|
3
5
|
export type AgentsRouterContext = {
|
|
4
6
|
switchAgentById: (agentId: string) => Promise<{
|
|
5
7
|
id: string;
|
|
@@ -16,7 +18,7 @@ export type AgentsRouterContext = {
|
|
|
16
18
|
ensureAgentAvailable: () => void;
|
|
17
19
|
getActiveAgentId: () => string | undefined;
|
|
18
20
|
};
|
|
19
|
-
export declare function createAgentsRouter(getAgent:
|
|
21
|
+
export declare function createAgentsRouter(getAgent: GetAgentFn, context: AgentsRouterContext): OpenAPIHono<import("hono").Env, {
|
|
20
22
|
"/agents": {
|
|
21
23
|
$get: {
|
|
22
24
|
input: {};
|
|
@@ -75,7 +77,6 @@ export declare function createAgentsRouter(getAgent: () => DextoAgent, context:
|
|
|
75
77
|
id: string;
|
|
76
78
|
sourcePath: string;
|
|
77
79
|
name?: string | undefined;
|
|
78
|
-
injectPreferences?: boolean | undefined;
|
|
79
80
|
};
|
|
80
81
|
};
|
|
81
82
|
output: {
|
|
@@ -147,410 +148,7 @@ export declare function createAgentsRouter(getAgent: () => DextoAgent, context:
|
|
|
147
148
|
input: {
|
|
148
149
|
json: {
|
|
149
150
|
description: string;
|
|
150
|
-
config:
|
|
151
|
-
llm: {
|
|
152
|
-
model: string;
|
|
153
|
-
provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere";
|
|
154
|
-
apiKey: string;
|
|
155
|
-
maxIterations?: number | undefined;
|
|
156
|
-
baseURL?: string | undefined;
|
|
157
|
-
maxInputTokens?: number | undefined;
|
|
158
|
-
maxOutputTokens?: number | undefined;
|
|
159
|
-
temperature?: number | undefined;
|
|
160
|
-
allowedMediaTypes?: string[] | undefined;
|
|
161
|
-
};
|
|
162
|
-
systemPrompt: string | {
|
|
163
|
-
contributors?: ({
|
|
164
|
-
type: "static";
|
|
165
|
-
content: string;
|
|
166
|
-
id: string;
|
|
167
|
-
priority: number;
|
|
168
|
-
enabled?: boolean | undefined;
|
|
169
|
-
} | {
|
|
170
|
-
type: "dynamic";
|
|
171
|
-
id: string;
|
|
172
|
-
source: "resources" | "dateTime";
|
|
173
|
-
priority: number;
|
|
174
|
-
enabled?: boolean | undefined;
|
|
175
|
-
} | {
|
|
176
|
-
type: "file";
|
|
177
|
-
id: string;
|
|
178
|
-
priority: number;
|
|
179
|
-
files: string[];
|
|
180
|
-
options?: {
|
|
181
|
-
includeFilenames?: boolean | undefined;
|
|
182
|
-
separator?: string | undefined;
|
|
183
|
-
errorHandling?: "error" | "skip" | undefined;
|
|
184
|
-
maxFileSize?: number | undefined;
|
|
185
|
-
includeMetadata?: boolean | undefined;
|
|
186
|
-
} | undefined;
|
|
187
|
-
enabled?: boolean | undefined;
|
|
188
|
-
})[] | undefined;
|
|
189
|
-
};
|
|
190
|
-
tools?: Record<string, {
|
|
191
|
-
maxOutputChars?: number | undefined;
|
|
192
|
-
maxLines?: number | undefined;
|
|
193
|
-
maxLineLength?: number | undefined;
|
|
194
|
-
}> | undefined;
|
|
195
|
-
storage?: {
|
|
196
|
-
database: {
|
|
197
|
-
type: "in-memory";
|
|
198
|
-
options?: Record<string, any> | undefined;
|
|
199
|
-
maxConnections?: number | undefined;
|
|
200
|
-
idleTimeoutMillis?: number | undefined;
|
|
201
|
-
connectionTimeoutMillis?: number | undefined;
|
|
202
|
-
} | {
|
|
203
|
-
path: string;
|
|
204
|
-
type: "sqlite";
|
|
205
|
-
options?: Record<string, any> | undefined;
|
|
206
|
-
maxConnections?: number | undefined;
|
|
207
|
-
idleTimeoutMillis?: number | undefined;
|
|
208
|
-
connectionTimeoutMillis?: number | undefined;
|
|
209
|
-
} | {
|
|
210
|
-
type: "postgres";
|
|
211
|
-
password?: string | undefined;
|
|
212
|
-
options?: Record<string, any> | undefined;
|
|
213
|
-
url?: string | undefined;
|
|
214
|
-
maxConnections?: number | undefined;
|
|
215
|
-
idleTimeoutMillis?: number | undefined;
|
|
216
|
-
connectionTimeoutMillis?: number | undefined;
|
|
217
|
-
host?: string | undefined;
|
|
218
|
-
port?: number | undefined;
|
|
219
|
-
database?: string | undefined;
|
|
220
|
-
connectionString?: string | undefined;
|
|
221
|
-
};
|
|
222
|
-
cache: {
|
|
223
|
-
type: "in-memory";
|
|
224
|
-
options?: Record<string, any> | undefined;
|
|
225
|
-
maxConnections?: number | undefined;
|
|
226
|
-
idleTimeoutMillis?: number | undefined;
|
|
227
|
-
connectionTimeoutMillis?: number | undefined;
|
|
228
|
-
} | {
|
|
229
|
-
type: "redis";
|
|
230
|
-
password?: string | undefined;
|
|
231
|
-
options?: Record<string, any> | undefined;
|
|
232
|
-
url?: string | undefined;
|
|
233
|
-
maxConnections?: number | undefined;
|
|
234
|
-
idleTimeoutMillis?: number | undefined;
|
|
235
|
-
connectionTimeoutMillis?: number | undefined;
|
|
236
|
-
host?: string | undefined;
|
|
237
|
-
port?: number | undefined;
|
|
238
|
-
database?: number | undefined;
|
|
239
|
-
};
|
|
240
|
-
blob: {
|
|
241
|
-
type: "in-memory";
|
|
242
|
-
maxBlobSize?: number | undefined;
|
|
243
|
-
maxTotalSize?: number | undefined;
|
|
244
|
-
} | {
|
|
245
|
-
type: "local";
|
|
246
|
-
storePath: string;
|
|
247
|
-
maxBlobSize?: number | undefined;
|
|
248
|
-
maxTotalSize?: number | undefined;
|
|
249
|
-
cleanupAfterDays?: number | undefined;
|
|
250
|
-
};
|
|
251
|
-
} | undefined;
|
|
252
|
-
telemetry?: {
|
|
253
|
-
enabled?: boolean | undefined;
|
|
254
|
-
serviceName?: string | undefined;
|
|
255
|
-
tracerName?: string | undefined;
|
|
256
|
-
export?: {
|
|
257
|
-
type: "otlp";
|
|
258
|
-
headers?: Record<string, string> | undefined;
|
|
259
|
-
protocol?: "http" | "grpc" | undefined;
|
|
260
|
-
endpoint?: string | undefined;
|
|
261
|
-
} | {
|
|
262
|
-
type: "console";
|
|
263
|
-
} | undefined;
|
|
264
|
-
} | undefined;
|
|
265
|
-
logger?: {
|
|
266
|
-
level?: "debug" | "info" | "warn" | "error" | "silly" | undefined;
|
|
267
|
-
transports?: ({
|
|
268
|
-
type: "console";
|
|
269
|
-
colorize?: boolean | undefined;
|
|
270
|
-
} | {
|
|
271
|
-
path: string;
|
|
272
|
-
type: "file";
|
|
273
|
-
maxFiles?: number | undefined;
|
|
274
|
-
maxSize?: number | undefined;
|
|
275
|
-
} | {
|
|
276
|
-
token: string;
|
|
277
|
-
type: "upstash";
|
|
278
|
-
url: string;
|
|
279
|
-
listName?: string | undefined;
|
|
280
|
-
maxListLength?: number | undefined;
|
|
281
|
-
batchSize?: number | undefined;
|
|
282
|
-
})[] | undefined;
|
|
283
|
-
} | undefined;
|
|
284
|
-
elicitation?: {
|
|
285
|
-
timeout?: number | undefined;
|
|
286
|
-
enabled?: boolean | undefined;
|
|
287
|
-
} | undefined;
|
|
288
|
-
prompts?: ({
|
|
289
|
-
prompt: string;
|
|
290
|
-
type: "inline";
|
|
291
|
-
id: string;
|
|
292
|
-
description?: string | undefined;
|
|
293
|
-
title?: string | undefined;
|
|
294
|
-
priority?: number | undefined;
|
|
295
|
-
category?: string | undefined;
|
|
296
|
-
showInStarters?: boolean | undefined;
|
|
297
|
-
} | {
|
|
298
|
-
file: string;
|
|
299
|
-
type: "file";
|
|
300
|
-
showInStarters?: boolean | undefined;
|
|
301
|
-
})[] | undefined;
|
|
302
|
-
agentId?: string | undefined;
|
|
303
|
-
agentCard?: {
|
|
304
|
-
description: string;
|
|
305
|
-
name: string;
|
|
306
|
-
url: string;
|
|
307
|
-
version: string;
|
|
308
|
-
provider?: {
|
|
309
|
-
url: string;
|
|
310
|
-
organization: string;
|
|
311
|
-
} | undefined;
|
|
312
|
-
metadata?: z.objectInputType<{
|
|
313
|
-
dexto: z.ZodOptional<z.ZodObject<{
|
|
314
|
-
authentication: z.ZodOptional<z.ZodObject<{
|
|
315
|
-
schemes: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
316
|
-
credentials: z.ZodOptional<z.ZodString>;
|
|
317
|
-
}, "strict", z.ZodTypeAny, {
|
|
318
|
-
schemes: string[];
|
|
319
|
-
credentials?: string | undefined;
|
|
320
|
-
}, {
|
|
321
|
-
schemes?: string[] | undefined;
|
|
322
|
-
credentials?: string | undefined;
|
|
323
|
-
}>>;
|
|
324
|
-
delegation: z.ZodOptional<z.ZodObject<{
|
|
325
|
-
protocol: z.ZodEnum<["dexto-v1", "http-simple", "a2a-jsonrpc", "mcp-http"]>;
|
|
326
|
-
endpoint: z.ZodString;
|
|
327
|
-
supportsSession: z.ZodBoolean;
|
|
328
|
-
supportsStreaming: z.ZodOptional<z.ZodBoolean>;
|
|
329
|
-
}, "strict", z.ZodTypeAny, {
|
|
330
|
-
protocol: "dexto-v1" | "http-simple" | "a2a-jsonrpc" | "mcp-http";
|
|
331
|
-
endpoint: string;
|
|
332
|
-
supportsSession: boolean;
|
|
333
|
-
supportsStreaming?: boolean | undefined;
|
|
334
|
-
}, {
|
|
335
|
-
protocol: "dexto-v1" | "http-simple" | "a2a-jsonrpc" | "mcp-http";
|
|
336
|
-
endpoint: string;
|
|
337
|
-
supportsSession: boolean;
|
|
338
|
-
supportsStreaming?: boolean | undefined;
|
|
339
|
-
}>>;
|
|
340
|
-
owner: z.ZodOptional<z.ZodObject<{
|
|
341
|
-
userId: z.ZodString;
|
|
342
|
-
username: z.ZodString;
|
|
343
|
-
email: z.ZodOptional<z.ZodString>;
|
|
344
|
-
}, "strict", z.ZodTypeAny, {
|
|
345
|
-
userId: string;
|
|
346
|
-
username: string;
|
|
347
|
-
email?: string | undefined;
|
|
348
|
-
}, {
|
|
349
|
-
userId: string;
|
|
350
|
-
username: string;
|
|
351
|
-
email?: string | undefined;
|
|
352
|
-
}>>;
|
|
353
|
-
}, "strict", z.ZodTypeAny, {
|
|
354
|
-
authentication?: {
|
|
355
|
-
schemes: string[];
|
|
356
|
-
credentials?: string | undefined;
|
|
357
|
-
} | undefined;
|
|
358
|
-
delegation?: {
|
|
359
|
-
protocol: "dexto-v1" | "http-simple" | "a2a-jsonrpc" | "mcp-http";
|
|
360
|
-
endpoint: string;
|
|
361
|
-
supportsSession: boolean;
|
|
362
|
-
supportsStreaming?: boolean | undefined;
|
|
363
|
-
} | undefined;
|
|
364
|
-
owner?: {
|
|
365
|
-
userId: string;
|
|
366
|
-
username: string;
|
|
367
|
-
email?: string | undefined;
|
|
368
|
-
} | undefined;
|
|
369
|
-
}, {
|
|
370
|
-
authentication?: {
|
|
371
|
-
schemes?: string[] | undefined;
|
|
372
|
-
credentials?: string | undefined;
|
|
373
|
-
} | undefined;
|
|
374
|
-
delegation?: {
|
|
375
|
-
protocol: "dexto-v1" | "http-simple" | "a2a-jsonrpc" | "mcp-http";
|
|
376
|
-
endpoint: string;
|
|
377
|
-
supportsSession: boolean;
|
|
378
|
-
supportsStreaming?: boolean | undefined;
|
|
379
|
-
} | undefined;
|
|
380
|
-
owner?: {
|
|
381
|
-
userId: string;
|
|
382
|
-
username: string;
|
|
383
|
-
email?: string | undefined;
|
|
384
|
-
} | undefined;
|
|
385
|
-
}>>;
|
|
386
|
-
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
387
|
-
capabilities?: {
|
|
388
|
-
streaming?: boolean | undefined;
|
|
389
|
-
pushNotifications?: boolean | undefined;
|
|
390
|
-
stateTransitionHistory?: boolean | undefined;
|
|
391
|
-
} | undefined;
|
|
392
|
-
protocolVersion?: string | undefined;
|
|
393
|
-
preferredTransport?: "JSONRPC" | "GRPC" | "HTTP+JSON" | undefined;
|
|
394
|
-
defaultInputModes?: string[] | undefined;
|
|
395
|
-
defaultOutputModes?: string[] | undefined;
|
|
396
|
-
skills?: {
|
|
397
|
-
description: string;
|
|
398
|
-
name: string;
|
|
399
|
-
id: string;
|
|
400
|
-
tags: string[];
|
|
401
|
-
examples?: string[] | undefined;
|
|
402
|
-
inputModes?: string[] | undefined;
|
|
403
|
-
outputModes?: string[] | undefined;
|
|
404
|
-
}[] | undefined;
|
|
405
|
-
iconUrl?: string | undefined;
|
|
406
|
-
documentationUrl?: string | undefined;
|
|
407
|
-
additionalInterfaces?: {
|
|
408
|
-
url: string;
|
|
409
|
-
transport: "JSONRPC" | "GRPC" | "HTTP+JSON";
|
|
410
|
-
}[] | undefined;
|
|
411
|
-
securitySchemes?: Record<string, {
|
|
412
|
-
type: "apiKey";
|
|
413
|
-
name: string;
|
|
414
|
-
in: "query" | "header" | "cookie";
|
|
415
|
-
description?: string | undefined;
|
|
416
|
-
} | {
|
|
417
|
-
type: "http";
|
|
418
|
-
scheme: string;
|
|
419
|
-
description?: string | undefined;
|
|
420
|
-
bearerFormat?: string | undefined;
|
|
421
|
-
} | {
|
|
422
|
-
type: "oauth2";
|
|
423
|
-
flows: {
|
|
424
|
-
password?: {
|
|
425
|
-
scopes: Record<string, string>;
|
|
426
|
-
authorizationUrl?: string | undefined;
|
|
427
|
-
tokenUrl?: string | undefined;
|
|
428
|
-
refreshUrl?: string | undefined;
|
|
429
|
-
} | undefined;
|
|
430
|
-
implicit?: {
|
|
431
|
-
scopes: Record<string, string>;
|
|
432
|
-
authorizationUrl?: string | undefined;
|
|
433
|
-
tokenUrl?: string | undefined;
|
|
434
|
-
refreshUrl?: string | undefined;
|
|
435
|
-
} | undefined;
|
|
436
|
-
clientCredentials?: {
|
|
437
|
-
scopes: Record<string, string>;
|
|
438
|
-
authorizationUrl?: string | undefined;
|
|
439
|
-
tokenUrl?: string | undefined;
|
|
440
|
-
refreshUrl?: string | undefined;
|
|
441
|
-
} | undefined;
|
|
442
|
-
authorizationCode?: {
|
|
443
|
-
scopes: Record<string, string>;
|
|
444
|
-
authorizationUrl?: string | undefined;
|
|
445
|
-
tokenUrl?: string | undefined;
|
|
446
|
-
refreshUrl?: string | undefined;
|
|
447
|
-
} | undefined;
|
|
448
|
-
};
|
|
449
|
-
description?: string | undefined;
|
|
450
|
-
} | {
|
|
451
|
-
type: "openIdConnect";
|
|
452
|
-
openIdConnectUrl: string;
|
|
453
|
-
description?: string | undefined;
|
|
454
|
-
} | {
|
|
455
|
-
type: "mutualTLS";
|
|
456
|
-
description?: string | undefined;
|
|
457
|
-
}> | undefined;
|
|
458
|
-
security?: Record<string, string[]>[] | undefined;
|
|
459
|
-
supportsAuthenticatedExtendedCard?: boolean | undefined;
|
|
460
|
-
signatures?: {
|
|
461
|
-
protected: string;
|
|
462
|
-
signature: string;
|
|
463
|
-
}[] | undefined;
|
|
464
|
-
} | undefined;
|
|
465
|
-
greeting?: string | undefined;
|
|
466
|
-
memories?: {
|
|
467
|
-
enabled?: boolean | undefined;
|
|
468
|
-
limit?: number | undefined;
|
|
469
|
-
priority?: number | undefined;
|
|
470
|
-
includeTimestamps?: boolean | undefined;
|
|
471
|
-
includeTags?: boolean | undefined;
|
|
472
|
-
pinnedOnly?: boolean | undefined;
|
|
473
|
-
} | undefined;
|
|
474
|
-
mcpServers?: Record<string, {
|
|
475
|
-
type: "stdio";
|
|
476
|
-
command: string;
|
|
477
|
-
timeout?: number | undefined;
|
|
478
|
-
enabled?: boolean | undefined;
|
|
479
|
-
args?: string[] | undefined;
|
|
480
|
-
env?: Record<string, string> | undefined;
|
|
481
|
-
connectionMode?: "strict" | "lenient" | undefined;
|
|
482
|
-
} | {
|
|
483
|
-
type: "sse";
|
|
484
|
-
url: string;
|
|
485
|
-
timeout?: number | undefined;
|
|
486
|
-
enabled?: boolean | undefined;
|
|
487
|
-
connectionMode?: "strict" | "lenient" | undefined;
|
|
488
|
-
headers?: Record<string, string> | undefined;
|
|
489
|
-
} | {
|
|
490
|
-
type: "http";
|
|
491
|
-
url: string;
|
|
492
|
-
timeout?: number | undefined;
|
|
493
|
-
enabled?: boolean | undefined;
|
|
494
|
-
connectionMode?: "strict" | "lenient" | undefined;
|
|
495
|
-
headers?: Record<string, string> | undefined;
|
|
496
|
-
}> | undefined;
|
|
497
|
-
internalTools?: ("search_history" | "ask_user" | "read_file" | "glob_files" | "grep_content" | "write_file" | "edit_file" | "bash_exec" | "bash_output" | "kill_process" | "delegate_to_url")[] | undefined;
|
|
498
|
-
sessions?: {
|
|
499
|
-
maxSessions?: number | undefined;
|
|
500
|
-
sessionTTL?: number | undefined;
|
|
501
|
-
} | undefined;
|
|
502
|
-
toolConfirmation?: {
|
|
503
|
-
timeout?: number | undefined;
|
|
504
|
-
mode?: "manual" | "auto-approve" | "auto-deny" | undefined;
|
|
505
|
-
allowedToolsStorage?: "storage" | "memory" | undefined;
|
|
506
|
-
toolPolicies?: {
|
|
507
|
-
alwaysAllow?: string[] | undefined;
|
|
508
|
-
alwaysDeny?: string[] | undefined;
|
|
509
|
-
} | undefined;
|
|
510
|
-
} | undefined;
|
|
511
|
-
internalResources?: ({
|
|
512
|
-
type: "filesystem";
|
|
513
|
-
paths: string[];
|
|
514
|
-
maxFiles?: number | undefined;
|
|
515
|
-
maxDepth?: number | undefined;
|
|
516
|
-
includeHidden?: boolean | undefined;
|
|
517
|
-
includeExtensions?: string[] | undefined;
|
|
518
|
-
} | {
|
|
519
|
-
type: "blob";
|
|
520
|
-
})[] | {
|
|
521
|
-
enabled?: boolean | undefined;
|
|
522
|
-
resources?: ({
|
|
523
|
-
type: "filesystem";
|
|
524
|
-
paths: string[];
|
|
525
|
-
maxFiles?: number | undefined;
|
|
526
|
-
maxDepth?: number | undefined;
|
|
527
|
-
includeHidden?: boolean | undefined;
|
|
528
|
-
includeExtensions?: string[] | undefined;
|
|
529
|
-
} | {
|
|
530
|
-
type: "blob";
|
|
531
|
-
})[] | undefined;
|
|
532
|
-
} | undefined;
|
|
533
|
-
plugins?: {
|
|
534
|
-
custom?: {
|
|
535
|
-
name: string;
|
|
536
|
-
priority: number;
|
|
537
|
-
module: string;
|
|
538
|
-
blocking: boolean;
|
|
539
|
-
config?: Record<string, any> | undefined;
|
|
540
|
-
enabled?: boolean | undefined;
|
|
541
|
-
}[] | undefined;
|
|
542
|
-
contentPolicy?: z.objectInputType<{
|
|
543
|
-
priority: z.ZodNumber;
|
|
544
|
-
blocking: z.ZodOptional<z.ZodBoolean>;
|
|
545
|
-
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
546
|
-
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
547
|
-
responseSanitizer?: z.objectInputType<{
|
|
548
|
-
priority: z.ZodNumber;
|
|
549
|
-
blocking: z.ZodOptional<z.ZodBoolean>;
|
|
550
|
-
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
551
|
-
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
552
|
-
} | undefined;
|
|
553
|
-
};
|
|
151
|
+
config: Record<string, any>;
|
|
554
152
|
id: string;
|
|
555
153
|
name: string;
|
|
556
154
|
tags?: string[] | undefined;
|
|
@@ -657,4 +255,5 @@ export declare function createAgentsRouter(getAgent: () => DextoAgent, context:
|
|
|
657
255
|
};
|
|
658
256
|
};
|
|
659
257
|
}, "/">;
|
|
258
|
+
export {};
|
|
660
259
|
//# sourceMappingURL=agents.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../../src/hono/routes/agents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../../src/hono/routes/agents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkB,MAAM,mBAAmB,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAsB9C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,KAAK,UAAU,GAAG,CAAC,GAAG,EAAE,OAAO,KAAK,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AA8MrE,MAAM,MAAM,mBAAmB,GAAG;IAC9B,eAAe,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC5E,iBAAiB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/E,gBAAgB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC7E,oBAAoB,EAAE,MAAM,IAAI,CAAC;IACjC,gBAAgB,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;CAC9C,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA6sBpF"}
|
|
@@ -19,6 +19,9 @@ import path from "path";
|
|
|
19
19
|
import { promises as fs } from "fs";
|
|
20
20
|
import { DextoValidationError, AgentErrorCode, ErrorScope, ErrorType } from "@dexto/core";
|
|
21
21
|
import { AgentRegistryEntrySchema } from "../schemas/responses.js";
|
|
22
|
+
const AgentConfigSchemaForOpenAPI = z.record(z.any()).describe(
|
|
23
|
+
"Complete agent configuration. See AgentConfig type documentation for full schema details."
|
|
24
|
+
);
|
|
22
25
|
const AgentIdentifierSchema = z.object({
|
|
23
26
|
id: z.string().min(1, "Agent id is required").describe('Unique agent identifier (e.g., "database-agent")'),
|
|
24
27
|
path: z.string().optional().describe(
|
|
@@ -38,16 +41,14 @@ const CustomAgentInstallSchema = z.object({
|
|
|
38
41
|
author: z.string().min(1).describe("Agent author or organization name"),
|
|
39
42
|
tags: z.array(z.string()).describe("Tags for categorizing the agent"),
|
|
40
43
|
main: z.string().optional().describe("Main configuration file name within source directory")
|
|
41
|
-
}).strict().describe("Agent metadata including description, author, and tags")
|
|
42
|
-
injectPreferences: z.boolean().default(true).describe("Whether to inject user preferences into agent config")
|
|
44
|
+
}).strict().describe("Agent metadata including description, author, and tags")
|
|
43
45
|
}).strict().describe("Request body for installing a custom agent from file system").transform((value) => {
|
|
44
46
|
const displayName = value.name?.trim() || deriveDisplayName(value.id);
|
|
45
47
|
return {
|
|
46
48
|
id: value.id,
|
|
47
49
|
displayName,
|
|
48
50
|
sourcePath: value.sourcePath,
|
|
49
|
-
metadata: value.metadata
|
|
50
|
-
injectPreferences: value.injectPreferences
|
|
51
|
+
metadata: value.metadata
|
|
51
52
|
};
|
|
52
53
|
});
|
|
53
54
|
const CustomAgentCreateSchema = z.object({
|
|
@@ -61,7 +62,7 @@ const CustomAgentCreateSchema = z.object({
|
|
|
61
62
|
author: z.string().optional().describe("Author or organization"),
|
|
62
63
|
tags: z.array(z.string()).default([]).describe("Tags for discovery"),
|
|
63
64
|
// Full agent configuration
|
|
64
|
-
config:
|
|
65
|
+
config: AgentConfigSchemaForOpenAPI.describe("Complete agent configuration")
|
|
65
66
|
}).strict().describe("Request body for creating a new custom agent with full configuration");
|
|
66
67
|
const AgentConfigValidateSchema = z.object({
|
|
67
68
|
yaml: z.string().describe("YAML agent configuration content to validate")
|
|
@@ -405,18 +406,13 @@ function createAgentsRouter(getAgent, context) {
|
|
|
405
406
|
}).openapi(installRoute, async (ctx) => {
|
|
406
407
|
const body = ctx.req.valid("json");
|
|
407
408
|
if ("sourcePath" in body && "metadata" in body) {
|
|
408
|
-
const { id, displayName, sourcePath, metadata
|
|
409
|
-
await AgentFactory.installCustomAgent(
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
author: metadata.author,
|
|
416
|
-
tags: metadata.tags
|
|
417
|
-
},
|
|
418
|
-
injectPreferences
|
|
419
|
-
);
|
|
409
|
+
const { id, displayName, sourcePath, metadata } = body;
|
|
410
|
+
await AgentFactory.installCustomAgent(id, sourcePath, {
|
|
411
|
+
name: displayName,
|
|
412
|
+
description: metadata.description,
|
|
413
|
+
author: metadata.author,
|
|
414
|
+
tags: metadata.tags
|
|
415
|
+
});
|
|
420
416
|
return ctx.json(
|
|
421
417
|
{ installed: true, id, name: displayName, type: "custom" },
|
|
422
418
|
201
|
|
@@ -496,18 +492,12 @@ function createAgentsRouter(getAgent, context) {
|
|
|
496
492
|
const tmpFile = path.join(tmpDir, `${id}-${Date.now()}.yml`);
|
|
497
493
|
await fs.writeFile(tmpFile, yamlContent, "utf-8");
|
|
498
494
|
try {
|
|
499
|
-
await AgentFactory.installCustomAgent(
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
author: author || "Custom",
|
|
506
|
-
tags: tags || []
|
|
507
|
-
},
|
|
508
|
-
false
|
|
509
|
-
// Don't inject preferences
|
|
510
|
-
);
|
|
495
|
+
await AgentFactory.installCustomAgent(id, tmpFile, {
|
|
496
|
+
name,
|
|
497
|
+
description,
|
|
498
|
+
author: author || "Custom",
|
|
499
|
+
tags: tags || []
|
|
500
|
+
});
|
|
511
501
|
await fs.unlink(tmpFile).catch(() => {
|
|
512
502
|
});
|
|
513
503
|
return ctx.json({ created: true, id, name }, 201);
|
|
@@ -516,8 +506,8 @@ function createAgentsRouter(getAgent, context) {
|
|
|
516
506
|
});
|
|
517
507
|
throw installError;
|
|
518
508
|
}
|
|
519
|
-
}).openapi(getPathRoute, (ctx) => {
|
|
520
|
-
const agent = getAgent();
|
|
509
|
+
}).openapi(getPathRoute, async (ctx) => {
|
|
510
|
+
const agent = await getAgent(ctx);
|
|
521
511
|
const agentPath = agent.getAgentFilePath();
|
|
522
512
|
const relativePath = path.basename(agentPath);
|
|
523
513
|
const ext = path.extname(agentPath);
|
|
@@ -526,10 +516,10 @@ function createAgentsRouter(getAgent, context) {
|
|
|
526
516
|
path: agentPath,
|
|
527
517
|
relativePath,
|
|
528
518
|
name,
|
|
529
|
-
isDefault: name === "
|
|
519
|
+
isDefault: name === "coding-agent"
|
|
530
520
|
});
|
|
531
521
|
}).openapi(getConfigRoute, async (ctx) => {
|
|
532
|
-
const agent = getAgent();
|
|
522
|
+
const agent = await getAgent(ctx);
|
|
533
523
|
const agentPath = agent.getAgentFilePath();
|
|
534
524
|
const yamlContent = await fs.readFile(agentPath, "utf-8");
|
|
535
525
|
const stats = await fs.stat(agentPath);
|
|
@@ -605,7 +595,7 @@ function createAgentsRouter(getAgent, context) {
|
|
|
605
595
|
warnings
|
|
606
596
|
});
|
|
607
597
|
}).openapi(saveConfigRoute, async (ctx) => {
|
|
608
|
-
const agent = getAgent();
|
|
598
|
+
const agent = await getAgent(ctx);
|
|
609
599
|
const { yaml } = ctx.req.valid("json");
|
|
610
600
|
let parsed;
|
|
611
601
|
try {
|
|
@@ -677,7 +667,7 @@ function createAgentsRouter(getAgent, context) {
|
|
|
677
667
|
throw error;
|
|
678
668
|
}
|
|
679
669
|
}).openapi(exportConfigRoute, async (ctx) => {
|
|
680
|
-
const agent = getAgent();
|
|
670
|
+
const agent = await getAgent(ctx);
|
|
681
671
|
const { sessionId } = ctx.req.valid("query");
|
|
682
672
|
const config = agent.getEffectiveConfig(sessionId);
|
|
683
673
|
const maskedConfig = {
|
|
@@ -107,7 +107,7 @@ function createApprovalsRouter(getAgent, approvalCoordinator) {
|
|
|
107
107
|
}
|
|
108
108
|
});
|
|
109
109
|
return app.openapi(getPendingApprovalsRoute, async (ctx) => {
|
|
110
|
-
const agent = getAgent();
|
|
110
|
+
const agent = await getAgent(ctx);
|
|
111
111
|
const { sessionId } = ctx.req.valid("query");
|
|
112
112
|
agent.logger.debug(`Fetching pending approvals for session ${sessionId}`);
|
|
113
113
|
const pendingIds = agent.services.approvalManager.getPendingApprovals();
|
|
@@ -124,7 +124,7 @@ function createApprovalsRouter(getAgent, approvalCoordinator) {
|
|
|
124
124
|
approvals
|
|
125
125
|
});
|
|
126
126
|
}).openapi(submitApprovalRoute, async (ctx) => {
|
|
127
|
-
const agent = getAgent();
|
|
127
|
+
const agent = await getAgent(ctx);
|
|
128
128
|
const { approvalId } = ctx.req.valid("param");
|
|
129
129
|
const { status, formData, rememberChoice } = ctx.req.valid("json");
|
|
130
130
|
agent.logger.info(`Received approval decision for ${approvalId}: ${status}`);
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { OpenAPIHono } from '@hono/zod-openapi';
|
|
2
2
|
import { type DextoAgent, ApprovalStatus } from '@dexto/core';
|
|
3
3
|
import type { ApprovalCoordinator } from '../../approval/approval-coordinator.js';
|
|
4
|
-
|
|
4
|
+
import type { Context } from 'hono';
|
|
5
|
+
type GetAgentFn = (ctx: Context) => DextoAgent | Promise<DextoAgent>;
|
|
6
|
+
export declare function createApprovalsRouter(getAgent: GetAgentFn, approvalCoordinator?: ApprovalCoordinator): OpenAPIHono<import("hono").Env, {
|
|
5
7
|
"/approvals": {
|
|
6
8
|
$get: {
|
|
7
9
|
input: {
|
|
@@ -111,4 +113,5 @@ export declare function createApprovalsRouter(getAgent: () => DextoAgent, approv
|
|
|
111
113
|
};
|
|
112
114
|
};
|
|
113
115
|
}, "/">;
|
|
116
|
+
export {};
|
|
114
117
|
//# sourceMappingURL=approvals.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"approvals.d.ts","sourceRoot":"","sources":["../../../src/hono/routes/approvals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkB,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAE,KAAK,UAAU,EAAgB,cAAc,EAAiB,MAAM,aAAa,CAAC;AAC3F,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"approvals.d.ts","sourceRoot":"","sources":["../../../src/hono/routes/approvals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkB,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAE,KAAK,UAAU,EAAgB,cAAc,EAAiB,MAAM,aAAa,CAAC;AAC3F,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAClF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,KAAK,UAAU,GAAG,CAAC,GAAG,EAAE,OAAO,KAAK,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AA8CrE,wBAAgB,qBAAqB,CACjC,QAAQ,EAAE,UAAU,EACpB,mBAAmB,CAAC,EAAE,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAgK5C"}
|
|
@@ -84,7 +84,7 @@ function createApprovalsRouter(getAgent, approvalCoordinator) {
|
|
|
84
84
|
}
|
|
85
85
|
});
|
|
86
86
|
return app.openapi(getPendingApprovalsRoute, async (ctx) => {
|
|
87
|
-
const agent = getAgent();
|
|
87
|
+
const agent = await getAgent(ctx);
|
|
88
88
|
const { sessionId } = ctx.req.valid("query");
|
|
89
89
|
agent.logger.debug(`Fetching pending approvals for session ${sessionId}`);
|
|
90
90
|
const pendingIds = agent.services.approvalManager.getPendingApprovals();
|
|
@@ -101,7 +101,7 @@ function createApprovalsRouter(getAgent, approvalCoordinator) {
|
|
|
101
101
|
approvals
|
|
102
102
|
});
|
|
103
103
|
}).openapi(submitApprovalRoute, async (ctx) => {
|
|
104
|
-
const agent = getAgent();
|
|
104
|
+
const agent = await getAgent(ctx);
|
|
105
105
|
const { approvalId } = ctx.req.valid("param");
|
|
106
106
|
const { status, formData, rememberChoice } = ctx.req.valid("json");
|
|
107
107
|
agent.logger.info(`Received approval decision for ${approvalId}: ${status}`);
|