@dexto/server 1.5.8 → 1.6.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.
Files changed (58) hide show
  1. package/dist/events/a2a-sse-subscriber.d.ts +1 -1
  2. package/dist/hono/__tests__/test-fixtures.cjs +27 -6
  3. package/dist/hono/__tests__/test-fixtures.d.ts +2 -1
  4. package/dist/hono/__tests__/test-fixtures.d.ts.map +1 -1
  5. package/dist/hono/__tests__/test-fixtures.js +31 -6
  6. package/dist/hono/index.cjs +17 -2
  7. package/dist/hono/index.d.ts +874 -58
  8. package/dist/hono/index.d.ts.map +1 -1
  9. package/dist/hono/index.js +17 -2
  10. package/dist/hono/routes/a2a-tasks.d.ts +6 -6
  11. package/dist/hono/routes/agents.cjs +38 -27
  12. package/dist/hono/routes/agents.d.ts +2 -1
  13. package/dist/hono/routes/agents.d.ts.map +1 -1
  14. package/dist/hono/routes/agents.js +37 -31
  15. package/dist/hono/routes/discovery.cjs +99 -22
  16. package/dist/hono/routes/discovery.d.ts +14 -12
  17. package/dist/hono/routes/discovery.d.ts.map +1 -1
  18. package/dist/hono/routes/discovery.js +89 -22
  19. package/dist/hono/routes/llm.d.ts +2 -2
  20. package/dist/hono/routes/mcp.cjs +96 -14
  21. package/dist/hono/routes/mcp.d.ts +139 -4
  22. package/dist/hono/routes/mcp.d.ts.map +1 -1
  23. package/dist/hono/routes/mcp.js +97 -15
  24. package/dist/hono/routes/memory.d.ts +1 -1
  25. package/dist/hono/routes/models.d.ts +1 -1
  26. package/dist/hono/routes/resources.d.ts +1 -1
  27. package/dist/hono/routes/schedules.cjs +456 -0
  28. package/dist/hono/routes/schedules.d.ts +472 -0
  29. package/dist/hono/routes/schedules.d.ts.map +1 -0
  30. package/dist/hono/routes/schedules.js +439 -0
  31. package/dist/hono/routes/search.d.ts +1 -1
  32. package/dist/hono/routes/sessions.cjs +10 -4
  33. package/dist/hono/routes/sessions.d.ts +135 -5
  34. package/dist/hono/routes/sessions.d.ts.map +1 -1
  35. package/dist/hono/routes/sessions.js +10 -4
  36. package/dist/hono/routes/tools.cjs +12 -19
  37. package/dist/hono/routes/tools.d.ts +5 -3
  38. package/dist/hono/routes/tools.d.ts.map +1 -1
  39. package/dist/hono/routes/tools.js +12 -19
  40. package/dist/hono/routes/workspaces.cjs +136 -0
  41. package/dist/hono/routes/workspaces.d.ts +77 -0
  42. package/dist/hono/routes/workspaces.d.ts.map +1 -0
  43. package/dist/hono/routes/workspaces.js +112 -0
  44. package/dist/hono/schemas/responses.cjs +82 -7
  45. package/dist/hono/schemas/responses.d.ts +366 -16
  46. package/dist/hono/schemas/responses.d.ts.map +1 -1
  47. package/dist/hono/schemas/responses.js +75 -6
  48. package/dist/hono/start-server.cjs +3 -3
  49. package/dist/hono/start-server.d.ts +15 -6
  50. package/dist/hono/start-server.d.ts.map +1 -1
  51. package/dist/hono/start-server.js +3 -3
  52. package/dist/index.cjs +9 -0
  53. package/dist/index.d.ts +1 -0
  54. package/dist/index.d.ts.map +1 -1
  55. package/dist/index.js +4 -0
  56. package/dist/mcp/mcp-handler.d.ts +2 -2
  57. package/dist/mcp/mcp-handler.d.ts.map +1 -1
  58. package/package.json +8 -5
@@ -0,0 +1,439 @@
1
+ import { OpenAPIHono, createRoute, z } from "@hono/zod-openapi";
2
+ import {
3
+ ErrorResponseSchema,
4
+ ExecutionLogSchema,
5
+ ScheduleSchema
6
+ } from "../schemas/responses.js";
7
+ import { SchedulerErrorCode } from "@dexto/tools-scheduler";
8
+ import {
9
+ ensureSchedulerManagerForAgent,
10
+ getSchedulerManager
11
+ } from "@dexto/tools-scheduler/service";
12
+ import { DextoRuntimeError, ErrorType } from "@dexto/core";
13
+ const CreateScheduleSchema = z.object({
14
+ name: z.string().min(1).describe("Schedule name"),
15
+ instruction: z.string().min(1).describe("Instruction to run on schedule"),
16
+ cronExpression: z.string().min(1).describe("Cron expression"),
17
+ timezone: z.string().optional().describe("Timezone for schedule"),
18
+ enabled: z.boolean().optional().describe("Whether the schedule is enabled"),
19
+ workspacePath: z.string().optional().nullable().describe("Optional workspace path for scheduled runs")
20
+ }).strict().describe("Request body for creating a schedule");
21
+ const UpdateScheduleSchema = CreateScheduleSchema.partial().strict().describe("Request body for updating a schedule");
22
+ const isScheduleNotFoundError = (error) => error instanceof DextoRuntimeError && error.type === ErrorType.NOT_FOUND && error.code === SchedulerErrorCode.SCHEDULE_NOT_FOUND;
23
+ const logSchedulerError = (agent, message, error) => {
24
+ if (!agent?.logger) {
25
+ return;
26
+ }
27
+ agent.logger.error(message, {
28
+ error: error instanceof Error ? error.message : String(error ?? "Unknown error"),
29
+ stack: error instanceof Error ? error.stack : void 0,
30
+ code: error instanceof DextoRuntimeError ? error.code : void 0
31
+ });
32
+ };
33
+ const toErrorResponse = (message, code) => ({
34
+ ok: false,
35
+ error: {
36
+ message,
37
+ ...code ? { code } : {}
38
+ }
39
+ });
40
+ function createSchedulesRouter(getAgent) {
41
+ const app = new OpenAPIHono();
42
+ const resolveScheduler = async (ctx) => {
43
+ const agent = await getAgent(ctx);
44
+ const agentId = agent.config?.agentId ?? "default";
45
+ let scheduler = getSchedulerManager(agentId) ?? null;
46
+ if (!scheduler) {
47
+ scheduler = await ensureSchedulerManagerForAgent(agent);
48
+ }
49
+ return { scheduler, agent };
50
+ };
51
+ const listRoute = createRoute({
52
+ method: "get",
53
+ path: "/schedules",
54
+ summary: "List Schedules",
55
+ description: "Retrieves all automation schedules",
56
+ tags: ["schedules"],
57
+ responses: {
58
+ 200: {
59
+ description: "List of schedules",
60
+ content: {
61
+ "application/json": {
62
+ schema: z.object({
63
+ schedules: z.array(ScheduleSchema).describe("Schedule list")
64
+ }).strict()
65
+ }
66
+ }
67
+ },
68
+ 500: {
69
+ description: "Failed to list schedules",
70
+ content: {
71
+ "application/json": {
72
+ schema: ErrorResponseSchema
73
+ }
74
+ }
75
+ },
76
+ 503: {
77
+ description: "Scheduler tools are not enabled",
78
+ content: {
79
+ "application/json": {
80
+ schema: ErrorResponseSchema
81
+ }
82
+ }
83
+ }
84
+ }
85
+ });
86
+ const createRouteDef = createRoute({
87
+ method: "post",
88
+ path: "/schedules",
89
+ summary: "Create Schedule",
90
+ description: "Creates a new automation schedule",
91
+ tags: ["schedules"],
92
+ request: { body: { content: { "application/json": { schema: CreateScheduleSchema } } } },
93
+ responses: {
94
+ 201: {
95
+ description: "Created schedule",
96
+ content: {
97
+ "application/json": {
98
+ schema: z.object({ schedule: ScheduleSchema }).strict()
99
+ }
100
+ }
101
+ },
102
+ 400: {
103
+ description: "Validation error",
104
+ content: {
105
+ "application/json": {
106
+ schema: ErrorResponseSchema
107
+ }
108
+ }
109
+ },
110
+ 429: {
111
+ description: "Schedule limit reached",
112
+ content: {
113
+ "application/json": {
114
+ schema: ErrorResponseSchema
115
+ }
116
+ }
117
+ },
118
+ 500: {
119
+ description: "Failed to create schedule",
120
+ content: {
121
+ "application/json": {
122
+ schema: ErrorResponseSchema
123
+ }
124
+ }
125
+ },
126
+ 503: {
127
+ description: "Scheduler tools are not enabled",
128
+ content: {
129
+ "application/json": {
130
+ schema: ErrorResponseSchema
131
+ }
132
+ }
133
+ }
134
+ }
135
+ });
136
+ const updateRoute = createRoute({
137
+ method: "patch",
138
+ path: "/schedules/{scheduleId}",
139
+ summary: "Update Schedule",
140
+ description: "Updates an existing schedule",
141
+ tags: ["schedules"],
142
+ request: {
143
+ params: z.object({
144
+ scheduleId: z.string().min(1).describe("Schedule ID")
145
+ }).strict().describe("Schedule identifier params"),
146
+ body: { content: { "application/json": { schema: UpdateScheduleSchema } } }
147
+ },
148
+ responses: {
149
+ 200: {
150
+ description: "Updated schedule",
151
+ content: {
152
+ "application/json": {
153
+ schema: z.object({ schedule: ScheduleSchema }).strict()
154
+ }
155
+ }
156
+ },
157
+ 400: {
158
+ description: "Validation error",
159
+ content: {
160
+ "application/json": {
161
+ schema: ErrorResponseSchema
162
+ }
163
+ }
164
+ },
165
+ 404: {
166
+ description: "Schedule not found",
167
+ content: {
168
+ "application/json": {
169
+ schema: ErrorResponseSchema
170
+ }
171
+ }
172
+ },
173
+ 500: {
174
+ description: "Failed to update schedule",
175
+ content: {
176
+ "application/json": {
177
+ schema: ErrorResponseSchema
178
+ }
179
+ }
180
+ },
181
+ 503: {
182
+ description: "Scheduler tools are not enabled",
183
+ content: {
184
+ "application/json": {
185
+ schema: ErrorResponseSchema
186
+ }
187
+ }
188
+ }
189
+ }
190
+ });
191
+ const deleteRoute = createRoute({
192
+ method: "delete",
193
+ path: "/schedules/{scheduleId}",
194
+ summary: "Delete Schedule",
195
+ description: "Deletes an automation schedule",
196
+ tags: ["schedules"],
197
+ request: {
198
+ params: z.object({
199
+ scheduleId: z.string().min(1).describe("Schedule ID")
200
+ }).strict().describe("Schedule identifier params")
201
+ },
202
+ responses: {
203
+ 200: {
204
+ description: "Schedule deleted",
205
+ content: {
206
+ "application/json": {
207
+ schema: z.object({
208
+ deleted: z.boolean().describe("Whether the schedule was deleted")
209
+ }).strict().describe("Delete schedule response")
210
+ }
211
+ }
212
+ },
213
+ 404: {
214
+ description: "Schedule not found",
215
+ content: {
216
+ "application/json": {
217
+ schema: ErrorResponseSchema
218
+ }
219
+ }
220
+ },
221
+ 500: {
222
+ description: "Failed to delete schedule",
223
+ content: {
224
+ "application/json": {
225
+ schema: ErrorResponseSchema
226
+ }
227
+ }
228
+ },
229
+ 503: {
230
+ description: "Scheduler tools are not enabled",
231
+ content: {
232
+ "application/json": {
233
+ schema: ErrorResponseSchema
234
+ }
235
+ }
236
+ }
237
+ }
238
+ });
239
+ const triggerRoute = createRoute({
240
+ method: "post",
241
+ path: "/schedules/{scheduleId}/trigger",
242
+ summary: "Trigger Schedule",
243
+ description: "Runs a schedule immediately and waits for execution to complete (bounded by executionTimeout, default 5 minutes). Clients should set timeouts accordingly.",
244
+ tags: ["schedules"],
245
+ request: {
246
+ params: z.object({
247
+ scheduleId: z.string().min(1).describe("Schedule ID")
248
+ }).strict().describe("Schedule identifier params")
249
+ },
250
+ responses: {
251
+ 200: {
252
+ description: "Schedule triggered",
253
+ content: {
254
+ "application/json": {
255
+ schema: z.object({
256
+ scheduled: z.boolean().describe(
257
+ "Whether the schedule was queued. Execution is omitted when false."
258
+ ),
259
+ execution: ExecutionLogSchema.optional().describe(
260
+ "Execution log (present when scheduled is true)"
261
+ )
262
+ }).strict().describe("Trigger schedule response")
263
+ }
264
+ }
265
+ },
266
+ 404: {
267
+ description: "Schedule not found",
268
+ content: {
269
+ "application/json": {
270
+ schema: ErrorResponseSchema
271
+ }
272
+ }
273
+ },
274
+ 500: {
275
+ description: "Failed to trigger schedule",
276
+ content: {
277
+ "application/json": {
278
+ schema: ErrorResponseSchema
279
+ }
280
+ }
281
+ },
282
+ 503: {
283
+ description: "Scheduler tools are not enabled",
284
+ content: {
285
+ "application/json": {
286
+ schema: ErrorResponseSchema
287
+ }
288
+ }
289
+ }
290
+ }
291
+ });
292
+ return app.openapi(listRoute, async (ctx) => {
293
+ const { scheduler, agent } = await resolveScheduler(ctx);
294
+ if (!scheduler) {
295
+ return ctx.json(
296
+ toErrorResponse("Scheduler tools are not enabled for this agent."),
297
+ 503
298
+ );
299
+ }
300
+ try {
301
+ const schedules = await scheduler.listSchedules();
302
+ return ctx.json({ schedules }, 200);
303
+ } catch (error) {
304
+ const message = error instanceof Error ? error.message : String(error ?? "Unknown error");
305
+ logSchedulerError(agent, "Failed to list schedules", error);
306
+ if (error instanceof DextoRuntimeError) {
307
+ return ctx.json(toErrorResponse(message, String(error.code)), 500);
308
+ }
309
+ return ctx.json(toErrorResponse("Failed to list schedules"), 500);
310
+ }
311
+ }).openapi(createRouteDef, async (ctx) => {
312
+ const { scheduler, agent } = await resolveScheduler(ctx);
313
+ if (!scheduler) {
314
+ return ctx.json(
315
+ toErrorResponse("Scheduler tools are not enabled for this agent."),
316
+ 503
317
+ );
318
+ }
319
+ const input = ctx.req.valid("json");
320
+ const createPayload = {
321
+ name: input.name,
322
+ instruction: input.instruction,
323
+ cronExpression: input.cronExpression,
324
+ ...input.timezone !== void 0 ? { timezone: input.timezone } : {},
325
+ enabled: input.enabled ?? true,
326
+ ...input.workspacePath !== void 0 ? { workspacePath: input.workspacePath } : {},
327
+ sessionMode: "dedicated"
328
+ };
329
+ try {
330
+ const schedule = await scheduler.createSchedule(createPayload);
331
+ return ctx.json({ schedule }, 201);
332
+ } catch (error) {
333
+ if (error instanceof DextoRuntimeError && error.code === SchedulerErrorCode.SCHEDULE_INVALID_CRON) {
334
+ return ctx.json(toErrorResponse(error.message, String(error.code)), 400);
335
+ }
336
+ if (error instanceof DextoRuntimeError && error.code === SchedulerErrorCode.SCHEDULE_INVALID_INPUT) {
337
+ return ctx.json(toErrorResponse(error.message, String(error.code)), 400);
338
+ }
339
+ if (error instanceof DextoRuntimeError && error.code === SchedulerErrorCode.SCHEDULE_LIMIT_REACHED) {
340
+ return ctx.json(toErrorResponse(error.message, String(error.code)), 429);
341
+ }
342
+ logSchedulerError(agent, "Failed to create schedule", error);
343
+ return ctx.json(toErrorResponse("Failed to create schedule"), 500);
344
+ }
345
+ }).openapi(updateRoute, async (ctx) => {
346
+ const { scheduler, agent } = await resolveScheduler(ctx);
347
+ if (!scheduler) {
348
+ return ctx.json(
349
+ toErrorResponse("Scheduler tools are not enabled for this agent."),
350
+ 503
351
+ );
352
+ }
353
+ const { scheduleId } = ctx.req.valid("param");
354
+ const input = ctx.req.valid("json");
355
+ const updatePayload = {
356
+ ...input.name !== void 0 ? { name: input.name } : {},
357
+ ...input.instruction !== void 0 ? { instruction: input.instruction } : {},
358
+ ...input.cronExpression !== void 0 ? { cronExpression: input.cronExpression } : {},
359
+ ...input.timezone !== void 0 ? { timezone: input.timezone } : {},
360
+ ...input.enabled !== void 0 ? { enabled: input.enabled } : {},
361
+ ...input.workspacePath !== void 0 ? { workspacePath: input.workspacePath } : {}
362
+ };
363
+ try {
364
+ const schedule = await scheduler.updateSchedule(scheduleId, updatePayload);
365
+ return ctx.json({ schedule }, 200);
366
+ } catch (error) {
367
+ if (isScheduleNotFoundError(error)) {
368
+ return ctx.json(
369
+ toErrorResponse(
370
+ "Schedule not found",
371
+ SchedulerErrorCode.SCHEDULE_NOT_FOUND
372
+ ),
373
+ 404
374
+ );
375
+ }
376
+ if (error instanceof DextoRuntimeError && error.code === SchedulerErrorCode.SCHEDULE_INVALID_CRON) {
377
+ return ctx.json(toErrorResponse(error.message, String(error.code)), 400);
378
+ }
379
+ if (error instanceof DextoRuntimeError && error.code === SchedulerErrorCode.SCHEDULE_INVALID_INPUT) {
380
+ return ctx.json(toErrorResponse(error.message, String(error.code)), 400);
381
+ }
382
+ logSchedulerError(agent, "Failed to update schedule", error);
383
+ return ctx.json(toErrorResponse("Failed to update schedule"), 500);
384
+ }
385
+ }).openapi(deleteRoute, async (ctx) => {
386
+ const { scheduler, agent } = await resolveScheduler(ctx);
387
+ if (!scheduler) {
388
+ return ctx.json(
389
+ toErrorResponse("Scheduler tools are not enabled for this agent."),
390
+ 503
391
+ );
392
+ }
393
+ const { scheduleId } = ctx.req.valid("param");
394
+ try {
395
+ await scheduler.deleteSchedule(scheduleId);
396
+ return ctx.json({ deleted: true }, 200);
397
+ } catch (error) {
398
+ if (isScheduleNotFoundError(error)) {
399
+ return ctx.json(
400
+ toErrorResponse(
401
+ "Schedule not found",
402
+ SchedulerErrorCode.SCHEDULE_NOT_FOUND
403
+ ),
404
+ 404
405
+ );
406
+ }
407
+ logSchedulerError(agent, "Failed to delete schedule", error);
408
+ return ctx.json(toErrorResponse("Failed to delete schedule"), 500);
409
+ }
410
+ }).openapi(triggerRoute, async (ctx) => {
411
+ const { scheduler, agent } = await resolveScheduler(ctx);
412
+ if (!scheduler) {
413
+ return ctx.json(
414
+ toErrorResponse("Scheduler tools are not enabled for this agent."),
415
+ 503
416
+ );
417
+ }
418
+ const { scheduleId } = ctx.req.valid("param");
419
+ try {
420
+ const execution = await scheduler.triggerScheduleNow(scheduleId);
421
+ return ctx.json({ scheduled: true, execution }, 200);
422
+ } catch (error) {
423
+ if (isScheduleNotFoundError(error)) {
424
+ return ctx.json(
425
+ toErrorResponse(
426
+ "Schedule not found",
427
+ SchedulerErrorCode.SCHEDULE_NOT_FOUND
428
+ ),
429
+ 404
430
+ );
431
+ }
432
+ logSchedulerError(agent, "Failed to trigger schedule", error);
433
+ return ctx.json(toErrorResponse("Failed to trigger schedule"), 500);
434
+ }
435
+ });
436
+ }
437
+ export {
438
+ createSchedulesRouter
439
+ };
@@ -93,9 +93,9 @@ export declare function createSearchRouter(getAgent: GetAgentFn): OpenAPIHono<im
93
93
  results: {
94
94
  sessionId: string;
95
95
  metadata: {
96
+ messageCount: number;
96
97
  createdAt: number;
97
98
  lastActivity: number;
98
- messageCount: number;
99
99
  };
100
100
  matchCount: number;
101
101
  firstMatch: {
@@ -279,7 +279,8 @@ function createSessionsRouter(getAgent) {
279
279
  createdAt: metadata?.createdAt || null,
280
280
  lastActivity: metadata?.lastActivity || null,
281
281
  messageCount: metadata?.messageCount || 0,
282
- title: metadata?.title || null
282
+ title: metadata?.title || null,
283
+ workspaceId: metadata?.workspaceId || null
283
284
  };
284
285
  } catch {
285
286
  return {
@@ -287,7 +288,8 @@ function createSessionsRouter(getAgent) {
287
288
  createdAt: null,
288
289
  lastActivity: null,
289
290
  messageCount: 0,
290
- title: null
291
+ title: null,
292
+ workspaceId: null
291
293
  };
292
294
  }
293
295
  })
@@ -305,7 +307,8 @@ function createSessionsRouter(getAgent) {
305
307
  createdAt: metadata?.createdAt || Date.now(),
306
308
  lastActivity: metadata?.lastActivity || Date.now(),
307
309
  messageCount: metadata?.messageCount || 0,
308
- title: metadata?.title || null
310
+ title: metadata?.title || null,
311
+ workspaceId: metadata?.workspaceId || null
309
312
  }
310
313
  },
311
314
  201
@@ -322,6 +325,7 @@ function createSessionsRouter(getAgent) {
322
325
  lastActivity: metadata?.lastActivity || null,
323
326
  messageCount: metadata?.messageCount || 0,
324
327
  title: metadata?.title || null,
328
+ workspaceId: metadata?.workspaceId || null,
325
329
  history: history.length
326
330
  }
327
331
  });
@@ -387,6 +391,7 @@ function createSessionsRouter(getAgent) {
387
391
  lastActivity: metadata?.lastActivity || null,
388
392
  messageCount: metadata?.messageCount || 0,
389
393
  title: metadata?.title || null,
394
+ workspaceId: metadata?.workspaceId || null,
390
395
  isBusy
391
396
  }
392
397
  },
@@ -404,7 +409,8 @@ function createSessionsRouter(getAgent) {
404
409
  createdAt: metadata?.createdAt || null,
405
410
  lastActivity: metadata?.lastActivity || null,
406
411
  messageCount: metadata?.messageCount || 0,
407
- title: metadata?.title || title
412
+ title: metadata?.title || title,
413
+ workspaceId: metadata?.workspaceId || null
408
414
  }
409
415
  });
410
416
  }).openapi(generateTitleRoute, async (ctx) => {
@@ -7,10 +7,36 @@ export declare function createSessionsRouter(getAgent: GetAgentFn): OpenAPIHono<
7
7
  output: {
8
8
  sessions: {
9
9
  id: string;
10
+ messageCount: number;
10
11
  createdAt: number | null;
11
12
  lastActivity: number | null;
12
- messageCount: number;
13
13
  title?: string | null | undefined;
14
+ tokenUsage?: {
15
+ inputTokens: number;
16
+ outputTokens: number;
17
+ reasoningTokens: number;
18
+ totalTokens: number;
19
+ cacheReadTokens: number;
20
+ cacheWriteTokens: number;
21
+ } | undefined;
22
+ estimatedCost?: number | undefined;
23
+ modelStats?: {
24
+ tokenUsage: {
25
+ inputTokens: number;
26
+ outputTokens: number;
27
+ reasoningTokens: number;
28
+ totalTokens: number;
29
+ cacheReadTokens: number;
30
+ cacheWriteTokens: number;
31
+ };
32
+ model: string;
33
+ provider: string;
34
+ messageCount: number;
35
+ estimatedCost: number;
36
+ firstUsedAt: number;
37
+ lastUsedAt: number;
38
+ }[] | undefined;
39
+ workspaceId?: string | null | undefined;
14
40
  }[];
15
41
  };
16
42
  outputFormat: "json";
@@ -28,10 +54,36 @@ export declare function createSessionsRouter(getAgent: GetAgentFn): OpenAPIHono<
28
54
  output: {
29
55
  session: {
30
56
  id: string;
57
+ messageCount: number;
31
58
  createdAt: number | null;
32
59
  lastActivity: number | null;
33
- messageCount: number;
34
60
  title?: string | null | undefined;
61
+ tokenUsage?: {
62
+ inputTokens: number;
63
+ outputTokens: number;
64
+ reasoningTokens: number;
65
+ totalTokens: number;
66
+ cacheReadTokens: number;
67
+ cacheWriteTokens: number;
68
+ } | undefined;
69
+ estimatedCost?: number | undefined;
70
+ modelStats?: {
71
+ tokenUsage: {
72
+ inputTokens: number;
73
+ outputTokens: number;
74
+ reasoningTokens: number;
75
+ totalTokens: number;
76
+ cacheReadTokens: number;
77
+ cacheWriteTokens: number;
78
+ };
79
+ model: string;
80
+ provider: string;
81
+ messageCount: number;
82
+ estimatedCost: number;
83
+ firstUsedAt: number;
84
+ lastUsedAt: number;
85
+ }[] | undefined;
86
+ workspaceId?: string | null | undefined;
35
87
  };
36
88
  };
37
89
  outputFormat: "json";
@@ -49,11 +101,37 @@ export declare function createSessionsRouter(getAgent: GetAgentFn): OpenAPIHono<
49
101
  output: {
50
102
  session: {
51
103
  id: string;
104
+ messageCount: number;
52
105
  createdAt: number | null;
53
106
  lastActivity: number | null;
54
- messageCount: number;
55
107
  history: number;
56
108
  title?: string | null | undefined;
109
+ tokenUsage?: {
110
+ inputTokens: number;
111
+ outputTokens: number;
112
+ reasoningTokens: number;
113
+ totalTokens: number;
114
+ cacheReadTokens: number;
115
+ cacheWriteTokens: number;
116
+ } | undefined;
117
+ estimatedCost?: number | undefined;
118
+ modelStats?: {
119
+ tokenUsage: {
120
+ inputTokens: number;
121
+ outputTokens: number;
122
+ reasoningTokens: number;
123
+ totalTokens: number;
124
+ cacheReadTokens: number;
125
+ cacheWriteTokens: number;
126
+ };
127
+ model: string;
128
+ provider: string;
129
+ messageCount: number;
130
+ estimatedCost: number;
131
+ firstUsedAt: number;
132
+ lastUsedAt: number;
133
+ }[] | undefined;
134
+ workspaceId?: string | null | undefined;
57
135
  };
58
136
  };
59
137
  outputFormat: "json";
@@ -175,11 +253,37 @@ export declare function createSessionsRouter(getAgent: GetAgentFn): OpenAPIHono<
175
253
  output: {
176
254
  session: {
177
255
  id: string;
256
+ messageCount: number;
178
257
  createdAt: number | null;
179
258
  lastActivity: number | null;
180
- messageCount: number;
181
259
  isBusy: boolean;
182
260
  title?: string | null | undefined;
261
+ tokenUsage?: {
262
+ inputTokens: number;
263
+ outputTokens: number;
264
+ reasoningTokens: number;
265
+ totalTokens: number;
266
+ cacheReadTokens: number;
267
+ cacheWriteTokens: number;
268
+ } | undefined;
269
+ estimatedCost?: number | undefined;
270
+ modelStats?: {
271
+ tokenUsage: {
272
+ inputTokens: number;
273
+ outputTokens: number;
274
+ reasoningTokens: number;
275
+ totalTokens: number;
276
+ cacheReadTokens: number;
277
+ cacheWriteTokens: number;
278
+ };
279
+ model: string;
280
+ provider: string;
281
+ messageCount: number;
282
+ estimatedCost: number;
283
+ firstUsedAt: number;
284
+ lastUsedAt: number;
285
+ }[] | undefined;
286
+ workspaceId?: string | null | undefined;
183
287
  };
184
288
  };
185
289
  outputFormat: "json";
@@ -212,10 +316,36 @@ export declare function createSessionsRouter(getAgent: GetAgentFn): OpenAPIHono<
212
316
  output: {
213
317
  session: {
214
318
  id: string;
319
+ messageCount: number;
215
320
  createdAt: number | null;
216
321
  lastActivity: number | null;
217
- messageCount: number;
218
322
  title?: string | null | undefined;
323
+ tokenUsage?: {
324
+ inputTokens: number;
325
+ outputTokens: number;
326
+ reasoningTokens: number;
327
+ totalTokens: number;
328
+ cacheReadTokens: number;
329
+ cacheWriteTokens: number;
330
+ } | undefined;
331
+ estimatedCost?: number | undefined;
332
+ modelStats?: {
333
+ tokenUsage: {
334
+ inputTokens: number;
335
+ outputTokens: number;
336
+ reasoningTokens: number;
337
+ totalTokens: number;
338
+ cacheReadTokens: number;
339
+ cacheWriteTokens: number;
340
+ };
341
+ model: string;
342
+ provider: string;
343
+ messageCount: number;
344
+ estimatedCost: number;
345
+ firstUsedAt: number;
346
+ lastUsedAt: number;
347
+ }[] | undefined;
348
+ workspaceId?: string | null | undefined;
219
349
  };
220
350
  };
221
351
  outputFormat: "json";
@@ -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;AAEhE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAQ9C,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAiexD"}
1
+ {"version":3,"file":"sessions.d.ts","sourceRoot":"","sources":["../../../src/hono/routes/sessions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkB,MAAM,mBAAmB,CAAC;AAEhE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAQ9C,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAuexD"}