@dexto/server 1.6.21 → 1.6.24
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/approval/wire-approval-events.cjs +44 -0
- package/dist/approval/wire-approval-events.d.ts +4 -0
- package/dist/approval/wire-approval-events.d.ts.map +1 -0
- package/dist/approval/wire-approval-events.js +20 -0
- package/dist/events/a2a-sse-subscriber.cjs +3 -0
- package/dist/events/a2a-sse-subscriber.d.ts.map +1 -1
- package/dist/events/a2a-sse-subscriber.js +3 -0
- package/dist/events/session-sse-subscriber.cjs +167 -0
- package/dist/events/session-sse-subscriber.d.ts +13 -0
- package/dist/events/session-sse-subscriber.d.ts.map +1 -0
- package/dist/events/session-sse-subscriber.js +143 -0
- package/dist/events/usage-event-subscriber.cjs +2 -2
- package/dist/events/usage-event-subscriber.d.ts.map +1 -1
- package/dist/events/usage-event-subscriber.js +2 -2
- package/dist/hono/__tests__/test-fixtures.cjs +8 -0
- package/dist/hono/__tests__/test-fixtures.d.ts +1 -0
- package/dist/hono/__tests__/test-fixtures.d.ts.map +1 -1
- package/dist/hono/__tests__/test-fixtures.js +8 -0
- package/dist/hono/index.cjs +2 -1
- package/dist/hono/index.d.ts +2 -0
- package/dist/hono/index.d.ts.map +1 -1
- package/dist/hono/index.js +2 -1
- package/dist/hono/node/index.cjs +51 -6
- package/dist/hono/node/index.d.ts.map +1 -1
- package/dist/hono/node/index.js +51 -6
- package/dist/hono/routes/llm.cjs +1 -1
- package/dist/hono/routes/llm.d.ts +175 -175
- package/dist/hono/routes/llm.d.ts.map +1 -1
- package/dist/hono/routes/llm.js +1 -1
- package/dist/hono/routes/messages.cjs +43 -53
- package/dist/hono/routes/messages.d.ts +1 -2
- package/dist/hono/routes/messages.d.ts.map +1 -1
- package/dist/hono/routes/messages.js +43 -53
- package/dist/hono/routes/models.d.ts +5 -5
- package/dist/hono/routes/prompts.d.ts +50 -50
- package/dist/hono/routes/queue.d.ts +106 -12
- package/dist/hono/routes/queue.d.ts.map +1 -1
- package/dist/hono/routes/resources.d.ts +5 -5
- package/dist/hono/routes/search.d.ts +297 -43
- package/dist/hono/routes/search.d.ts.map +1 -1
- package/dist/hono/routes/sessions.cjs +93 -2
- package/dist/hono/routes/sessions.d.ts +1736 -93
- package/dist/hono/routes/sessions.d.ts.map +1 -1
- package/dist/hono/routes/sessions.js +95 -3
- package/dist/hono/routes/tools.d.ts +5 -5
- package/dist/hono/schemas/responses.cjs +59 -3
- package/dist/hono/schemas/responses.d.ts +658 -97
- package/dist/hono/schemas/responses.d.ts.map +1 -1
- package/dist/hono/schemas/responses.js +59 -4
- package/dist/hono/start-server.cjs +9 -0
- package/dist/hono/start-server.d.ts.map +1 -1
- package/dist/hono/start-server.js +9 -0
- package/dist/index.cjs +5 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/hono/routes/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAe,KAAK,0BAA0B,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AACjG,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAO3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;EAkBtB,CAAC;AAEH,QAAA,MAAM,kBAAkB;;;;;;EAEtB,CAAC;AAEH,QAAA,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/hono/routes/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAe,KAAK,0BAA0B,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AACjG,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAO3C,OAAO,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AgB,kBAAkB,CAAC,QAAQ,EAAE,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA0BtD;AAED,KAAK,wBAAwB,GAAG,QAAQ,CACpC,KAAK,EACL,kBAAkB,EAClB;IAAE,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAA;CAAE,EAC7C,0BAA0B,CAAC,OAAO,aAAa,CAAC,CACnD,CAAC;AAEF,KAAK,wBAAwB,GAAG,QAAQ,CACpC,KAAK,EACL,kBAAkB,EAClB;IAAE,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAA;CAAE,EAC7C,0BAA0B,CAAC,OAAO,aAAa,CAAC,CACnD,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,wBAAwB,GAAG,wBAAwB,CAAC"}
|
|
@@ -327,6 +327,50 @@ const cancelRoute = (0, import_zod_openapi.createRoute)({
|
|
|
327
327
|
500: import_responses.InternalErrorResponse
|
|
328
328
|
}
|
|
329
329
|
});
|
|
330
|
+
const eventsRoute = (0, import_zod_openapi.createRoute)({
|
|
331
|
+
method: "get",
|
|
332
|
+
path: "/sessions/{sessionId}/events",
|
|
333
|
+
summary: "Attach Session Event Stream",
|
|
334
|
+
description: "Attaches to the live SSE event stream for an already-running session without starting a new run. Use this to reattach after a page reload or connection interruption.",
|
|
335
|
+
tags: ["sessions"],
|
|
336
|
+
request: {
|
|
337
|
+
params: import_zod_openapi.z.object({ sessionId: import_zod_openapi.z.string().describe("Session identifier") })
|
|
338
|
+
},
|
|
339
|
+
responses: {
|
|
340
|
+
200: {
|
|
341
|
+
description: "SSE stream of live session events",
|
|
342
|
+
headers: {
|
|
343
|
+
"Content-Type": {
|
|
344
|
+
description: "SSE content type",
|
|
345
|
+
schema: { type: "string", example: "text/event-stream" }
|
|
346
|
+
},
|
|
347
|
+
"Cache-Control": {
|
|
348
|
+
description: "Disable caching for stream",
|
|
349
|
+
schema: { type: "string", example: "no-cache" }
|
|
350
|
+
},
|
|
351
|
+
Connection: {
|
|
352
|
+
description: "Keep connection alive for streaming",
|
|
353
|
+
schema: { type: "string", example: "keep-alive" }
|
|
354
|
+
},
|
|
355
|
+
"X-Accel-Buffering": {
|
|
356
|
+
description: "Disable nginx buffering",
|
|
357
|
+
schema: { type: "string", example: "no" }
|
|
358
|
+
}
|
|
359
|
+
},
|
|
360
|
+
content: {
|
|
361
|
+
"text/event-stream": {
|
|
362
|
+
schema: import_zod_openapi.z.string().describe(
|
|
363
|
+
"Server-Sent Events stream for an active session. Events use the same payloads as /message-stream."
|
|
364
|
+
)
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
},
|
|
368
|
+
400: import_responses.BadRequestErrorResponse,
|
|
369
|
+
404: import_responses.NotFoundErrorResponse,
|
|
370
|
+
409: import_responses.ConflictErrorResponse,
|
|
371
|
+
500: import_responses.InternalErrorResponse
|
|
372
|
+
}
|
|
373
|
+
});
|
|
330
374
|
const loadRoute = (0, import_zod_openapi.createRoute)({
|
|
331
375
|
method: "get",
|
|
332
376
|
path: "/sessions/{sessionId}/load",
|
|
@@ -455,7 +499,7 @@ const generateTitleRoute = (0, import_zod_openapi.createRoute)({
|
|
|
455
499
|
500: import_responses.InternalErrorResponse
|
|
456
500
|
}
|
|
457
501
|
});
|
|
458
|
-
function createSessionsRouter(getAgent) {
|
|
502
|
+
function createSessionsRouter(getAgent, sessionSseSubscriber) {
|
|
459
503
|
const app = new import_zod_openapi.OpenAPIHono({
|
|
460
504
|
defaultHook: (result, ctx) => {
|
|
461
505
|
if (!result.success) {
|
|
@@ -534,9 +578,22 @@ function createSessionsRouter(getAgent) {
|
|
|
534
578
|
agent.getSessionHistory(sessionId),
|
|
535
579
|
agent.isSessionBusy(sessionId)
|
|
536
580
|
]);
|
|
581
|
+
const apiHistory = history.map((message) => (0, import_responses.toApiInternalMessage)(message));
|
|
582
|
+
for (const [index, message] of apiHistory.entries()) {
|
|
583
|
+
const parsed = import_responses.InternalMessageSchema.safeParse(message);
|
|
584
|
+
if (!parsed.success) {
|
|
585
|
+
throw new import_core.DextoRuntimeError(
|
|
586
|
+
"session_history_serialization_failed",
|
|
587
|
+
import_core.ErrorScope.SESSION,
|
|
588
|
+
import_core.ErrorType.SYSTEM,
|
|
589
|
+
"Failed to serialize session history",
|
|
590
|
+
{ sessionId, index, issues: (0, import_core.zodToIssues)(parsed.error) }
|
|
591
|
+
);
|
|
592
|
+
}
|
|
593
|
+
}
|
|
537
594
|
return ctx.json(
|
|
538
595
|
{
|
|
539
|
-
history,
|
|
596
|
+
history: apiHistory,
|
|
540
597
|
isBusy
|
|
541
598
|
},
|
|
542
599
|
200
|
|
@@ -653,6 +710,40 @@ function createSessionsRouter(getAgent) {
|
|
|
653
710
|
},
|
|
654
711
|
200
|
|
655
712
|
);
|
|
713
|
+
}).openapi(eventsRoute, async (ctx) => {
|
|
714
|
+
const agent = await getAgent(ctx);
|
|
715
|
+
const { sessionId } = ctx.req.valid("param");
|
|
716
|
+
const sessionIds = await agent.listSessions();
|
|
717
|
+
if (!sessionIds.includes(sessionId)) {
|
|
718
|
+
throw new import_core.DextoRuntimeError(
|
|
719
|
+
"session_not_found",
|
|
720
|
+
import_core.ErrorScope.SESSION,
|
|
721
|
+
import_core.ErrorType.NOT_FOUND,
|
|
722
|
+
`Session not found: ${sessionId}`,
|
|
723
|
+
{ sessionId }
|
|
724
|
+
);
|
|
725
|
+
}
|
|
726
|
+
const isBusy = await agent.isSessionBusy(sessionId);
|
|
727
|
+
if (!isBusy) {
|
|
728
|
+
throw new import_core.DextoRuntimeError(
|
|
729
|
+
"session_not_busy",
|
|
730
|
+
import_core.ErrorScope.SESSION,
|
|
731
|
+
import_core.ErrorType.CONFLICT,
|
|
732
|
+
`Session is not running: ${sessionId}`,
|
|
733
|
+
{ sessionId }
|
|
734
|
+
);
|
|
735
|
+
}
|
|
736
|
+
const eventStream = sessionSseSubscriber.createStream(
|
|
737
|
+
sessionId
|
|
738
|
+
);
|
|
739
|
+
return new Response(eventStream, {
|
|
740
|
+
headers: {
|
|
741
|
+
"Content-Type": "text/event-stream",
|
|
742
|
+
"Cache-Control": "no-cache",
|
|
743
|
+
Connection: "keep-alive",
|
|
744
|
+
"X-Accel-Buffering": "no"
|
|
745
|
+
}
|
|
746
|
+
});
|
|
656
747
|
}).openapi(loadRoute, async (ctx) => {
|
|
657
748
|
const agent = await getAgent(ctx);
|
|
658
749
|
const { sessionId } = ctx.req.valid("param");
|