@dexto/server 1.5.7 → 1.6.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.
Files changed (67) 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 +897 -76
  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/key.d.ts +4 -4
  20. package/dist/hono/routes/llm.cjs +21 -7
  21. package/dist/hono/routes/llm.d.ts +12 -10
  22. package/dist/hono/routes/llm.d.ts.map +1 -1
  23. package/dist/hono/routes/llm.js +22 -7
  24. package/dist/hono/routes/mcp.cjs +96 -14
  25. package/dist/hono/routes/mcp.d.ts +138 -3
  26. package/dist/hono/routes/mcp.d.ts.map +1 -1
  27. package/dist/hono/routes/mcp.js +97 -15
  28. package/dist/hono/routes/memory.d.ts +4 -4
  29. package/dist/hono/routes/messages.d.ts +1 -1
  30. package/dist/hono/routes/models.d.ts +1 -1
  31. package/dist/hono/routes/queue.cjs +9 -3
  32. package/dist/hono/routes/queue.d.ts +3 -0
  33. package/dist/hono/routes/queue.d.ts.map +1 -1
  34. package/dist/hono/routes/queue.js +9 -3
  35. package/dist/hono/routes/resources.d.ts +1 -1
  36. package/dist/hono/routes/schedules.cjs +455 -0
  37. package/dist/hono/routes/schedules.d.ts +472 -0
  38. package/dist/hono/routes/schedules.d.ts.map +1 -0
  39. package/dist/hono/routes/schedules.js +439 -0
  40. package/dist/hono/routes/search.d.ts +3 -3
  41. package/dist/hono/routes/sessions.cjs +10 -4
  42. package/dist/hono/routes/sessions.d.ts +136 -6
  43. package/dist/hono/routes/sessions.d.ts.map +1 -1
  44. package/dist/hono/routes/sessions.js +10 -4
  45. package/dist/hono/routes/tools.cjs +12 -19
  46. package/dist/hono/routes/tools.d.ts +5 -3
  47. package/dist/hono/routes/tools.d.ts.map +1 -1
  48. package/dist/hono/routes/tools.js +12 -19
  49. package/dist/hono/routes/workspaces.cjs +136 -0
  50. package/dist/hono/routes/workspaces.d.ts +77 -0
  51. package/dist/hono/routes/workspaces.d.ts.map +1 -0
  52. package/dist/hono/routes/workspaces.js +112 -0
  53. package/dist/hono/schemas/responses.cjs +82 -7
  54. package/dist/hono/schemas/responses.d.ts +403 -53
  55. package/dist/hono/schemas/responses.d.ts.map +1 -1
  56. package/dist/hono/schemas/responses.js +75 -6
  57. package/dist/hono/start-server.cjs +4 -3
  58. package/dist/hono/start-server.d.ts +15 -6
  59. package/dist/hono/start-server.d.ts.map +1 -1
  60. package/dist/hono/start-server.js +5 -4
  61. package/dist/index.cjs +9 -0
  62. package/dist/index.d.ts +1 -0
  63. package/dist/index.d.ts.map +1 -1
  64. package/dist/index.js +4 -0
  65. package/dist/mcp/mcp-handler.d.ts +2 -2
  66. package/dist/mcp/mcp-handler.d.ts.map +1 -1
  67. package/package.json +8 -5
@@ -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";
@@ -108,7 +186,7 @@ export declare function createSessionsRouter(getAgent: GetAgentFn): OpenAPIHono<
108
186
  totalTokens?: number | undefined;
109
187
  } | undefined;
110
188
  model?: string | undefined;
111
- provider?: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto" | undefined;
189
+ provider?: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto-nova" | undefined;
112
190
  toolCalls?: {
113
191
  function: {
114
192
  name: string;
@@ -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"}
@@ -256,7 +256,8 @@ function createSessionsRouter(getAgent) {
256
256
  createdAt: metadata?.createdAt || null,
257
257
  lastActivity: metadata?.lastActivity || null,
258
258
  messageCount: metadata?.messageCount || 0,
259
- title: metadata?.title || null
259
+ title: metadata?.title || null,
260
+ workspaceId: metadata?.workspaceId || null
260
261
  };
261
262
  } catch {
262
263
  return {
@@ -264,7 +265,8 @@ function createSessionsRouter(getAgent) {
264
265
  createdAt: null,
265
266
  lastActivity: null,
266
267
  messageCount: 0,
267
- title: null
268
+ title: null,
269
+ workspaceId: null
268
270
  };
269
271
  }
270
272
  })
@@ -282,7 +284,8 @@ function createSessionsRouter(getAgent) {
282
284
  createdAt: metadata?.createdAt || Date.now(),
283
285
  lastActivity: metadata?.lastActivity || Date.now(),
284
286
  messageCount: metadata?.messageCount || 0,
285
- title: metadata?.title || null
287
+ title: metadata?.title || null,
288
+ workspaceId: metadata?.workspaceId || null
286
289
  }
287
290
  },
288
291
  201
@@ -299,6 +302,7 @@ function createSessionsRouter(getAgent) {
299
302
  lastActivity: metadata?.lastActivity || null,
300
303
  messageCount: metadata?.messageCount || 0,
301
304
  title: metadata?.title || null,
305
+ workspaceId: metadata?.workspaceId || null,
302
306
  history: history.length
303
307
  }
304
308
  });
@@ -364,6 +368,7 @@ function createSessionsRouter(getAgent) {
364
368
  lastActivity: metadata?.lastActivity || null,
365
369
  messageCount: metadata?.messageCount || 0,
366
370
  title: metadata?.title || null,
371
+ workspaceId: metadata?.workspaceId || null,
367
372
  isBusy
368
373
  }
369
374
  },
@@ -381,7 +386,8 @@ function createSessionsRouter(getAgent) {
381
386
  createdAt: metadata?.createdAt || null,
382
387
  lastActivity: metadata?.lastActivity || null,
383
388
  messageCount: metadata?.messageCount || 0,
384
- title: metadata?.title || title
389
+ title: metadata?.title || title,
390
+ workspaceId: metadata?.workspaceId || null
385
391
  }
386
392
  });
387
393
  }).openapi(generateTitleRoute, async (ctx) => {
@@ -37,15 +37,15 @@ const ToolInfoSchema = import_zod_openapi.z.object({
37
37
  id: import_zod_openapi.z.string().describe("Tool identifier"),
38
38
  name: import_zod_openapi.z.string().describe("Tool name"),
39
39
  description: import_zod_openapi.z.string().describe("Tool description"),
40
- source: import_zod_openapi.z.enum(["internal", "custom", "mcp"]).describe("Source of the tool (internal, custom, or mcp)"),
40
+ source: import_zod_openapi.z.enum(["local", "mcp"]).describe("Source of the tool (local or mcp)"),
41
41
  serverName: import_zod_openapi.z.string().optional().describe("MCP server name (if source is mcp)"),
42
- inputSchema: ToolInputSchema.optional().describe("JSON Schema for tool input parameters")
42
+ inputSchema: ToolInputSchema.optional().describe("JSON Schema for tool input parameters"),
43
+ _meta: import_zod_openapi.z.record(import_zod_openapi.z.unknown()).optional().describe("Optional tool metadata (e.g., MCP Apps UI resource info)")
43
44
  }).strict().describe("Tool information");
44
45
  const AllToolsResponseSchema = import_zod_openapi.z.object({
45
46
  tools: import_zod_openapi.z.array(ToolInfoSchema).describe("Array of all available tools"),
46
47
  totalCount: import_zod_openapi.z.number().describe("Total number of tools"),
47
- internalCount: import_zod_openapi.z.number().describe("Number of internal tools"),
48
- customCount: import_zod_openapi.z.number().describe("Number of custom tools"),
48
+ localCount: import_zod_openapi.z.number().describe("Number of local tools"),
49
49
  mcpCount: import_zod_openapi.z.number().describe("Number of MCP tools")
50
50
  }).strict().describe("All available tools from all sources");
51
51
  function createToolsRouter(getAgent) {
@@ -54,7 +54,7 @@ function createToolsRouter(getAgent) {
54
54
  method: "get",
55
55
  path: "/tools",
56
56
  summary: "List All Tools",
57
- description: "Retrieves all available tools from all sources (internal, custom, and MCP servers)",
57
+ description: "Retrieves all available tools from all sources (local and MCP)",
58
58
  tags: ["tools"],
59
59
  responses: {
60
60
  200: {
@@ -68,8 +68,7 @@ function createToolsRouter(getAgent) {
68
68
  const allTools = await agent.getAllTools();
69
69
  const mcpToolsWithServerInfo = agent.getAllMcpToolsWithServerInfo();
70
70
  const toolList = [];
71
- let internalCount = 0;
72
- let customCount = 0;
71
+ let localCount = 0;
73
72
  let mcpCount = 0;
74
73
  for (const [toolName, toolInfo] of Object.entries(allTools)) {
75
74
  let source;
@@ -85,15 +84,9 @@ function createToolsRouter(getAgent) {
85
84
  source = "mcp";
86
85
  mcpCount++;
87
86
  }
88
- } else if (toolName.startsWith("internal--")) {
89
- source = "internal";
90
- internalCount++;
91
- } else if (toolName.startsWith("custom--")) {
92
- source = "custom";
93
- customCount++;
94
87
  } else {
95
- source = "internal";
96
- internalCount++;
88
+ source = "local";
89
+ localCount++;
97
90
  }
98
91
  toolList.push({
99
92
  id: toolName,
@@ -101,11 +94,12 @@ function createToolsRouter(getAgent) {
101
94
  description: toolInfo.description || "No description available",
102
95
  source,
103
96
  serverName,
104
- inputSchema: toolInfo.parameters
97
+ inputSchema: toolInfo.parameters,
98
+ _meta: toolInfo._meta
105
99
  });
106
100
  }
107
101
  toolList.sort((a, b) => {
108
- const sourceOrder = { internal: 0, custom: 1, mcp: 2 };
102
+ const sourceOrder = { local: 0, mcp: 1 };
109
103
  if (a.source !== b.source) {
110
104
  return sourceOrder[a.source] - sourceOrder[b.source];
111
105
  }
@@ -114,8 +108,7 @@ function createToolsRouter(getAgent) {
114
108
  return ctx.json({
115
109
  tools: toolList,
116
110
  totalCount: toolList.length,
117
- internalCount,
118
- customCount,
111
+ localCount,
119
112
  mcpCount
120
113
  });
121
114
  });
@@ -11,7 +11,7 @@ export declare function createToolsRouter(getAgent: GetAgentFn): OpenAPIHono<imp
11
11
  description: string;
12
12
  id: string;
13
13
  name: string;
14
- source: "custom" | "mcp" | "internal";
14
+ source: "local" | "mcp";
15
15
  serverName?: string | undefined;
16
16
  inputSchema?: {
17
17
  [x: string]: import("hono/utils/types").JSONValue;
@@ -27,10 +27,12 @@ export declare function createToolsRouter(getAgent: GetAgentFn): OpenAPIHono<imp
27
27
  } | undefined;
28
28
  required?: string[] | undefined;
29
29
  } | undefined;
30
+ _meta?: {
31
+ [x: string]: import("hono/utils/types").JSONValue;
32
+ } | undefined;
30
33
  }[];
31
34
  totalCount: number;
32
- internalCount: number;
33
- customCount: number;
35
+ localCount: number;
34
36
  mcpCount: number;
35
37
  };
36
38
  outputFormat: "json";
@@ -1 +1 @@
1
- {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/hono/routes/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkB,MAAM,mBAAmB,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,KAAK,UAAU,GAAG,CAAC,GAAG,EAAE,OAAO,KAAK,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAqDrE,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA0FrD"}
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/hono/routes/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkB,MAAM,mBAAmB,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,KAAK,UAAU,GAAG,CAAC,GAAG,EAAE,OAAO,KAAK,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAsDrE,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAkFrD"}
@@ -14,15 +14,15 @@ const ToolInfoSchema = z.object({
14
14
  id: z.string().describe("Tool identifier"),
15
15
  name: z.string().describe("Tool name"),
16
16
  description: z.string().describe("Tool description"),
17
- source: z.enum(["internal", "custom", "mcp"]).describe("Source of the tool (internal, custom, or mcp)"),
17
+ source: z.enum(["local", "mcp"]).describe("Source of the tool (local or mcp)"),
18
18
  serverName: z.string().optional().describe("MCP server name (if source is mcp)"),
19
- inputSchema: ToolInputSchema.optional().describe("JSON Schema for tool input parameters")
19
+ inputSchema: ToolInputSchema.optional().describe("JSON Schema for tool input parameters"),
20
+ _meta: z.record(z.unknown()).optional().describe("Optional tool metadata (e.g., MCP Apps UI resource info)")
20
21
  }).strict().describe("Tool information");
21
22
  const AllToolsResponseSchema = z.object({
22
23
  tools: z.array(ToolInfoSchema).describe("Array of all available tools"),
23
24
  totalCount: z.number().describe("Total number of tools"),
24
- internalCount: z.number().describe("Number of internal tools"),
25
- customCount: z.number().describe("Number of custom tools"),
25
+ localCount: z.number().describe("Number of local tools"),
26
26
  mcpCount: z.number().describe("Number of MCP tools")
27
27
  }).strict().describe("All available tools from all sources");
28
28
  function createToolsRouter(getAgent) {
@@ -31,7 +31,7 @@ function createToolsRouter(getAgent) {
31
31
  method: "get",
32
32
  path: "/tools",
33
33
  summary: "List All Tools",
34
- description: "Retrieves all available tools from all sources (internal, custom, and MCP servers)",
34
+ description: "Retrieves all available tools from all sources (local and MCP)",
35
35
  tags: ["tools"],
36
36
  responses: {
37
37
  200: {
@@ -45,8 +45,7 @@ function createToolsRouter(getAgent) {
45
45
  const allTools = await agent.getAllTools();
46
46
  const mcpToolsWithServerInfo = agent.getAllMcpToolsWithServerInfo();
47
47
  const toolList = [];
48
- let internalCount = 0;
49
- let customCount = 0;
48
+ let localCount = 0;
50
49
  let mcpCount = 0;
51
50
  for (const [toolName, toolInfo] of Object.entries(allTools)) {
52
51
  let source;
@@ -62,15 +61,9 @@ function createToolsRouter(getAgent) {
62
61
  source = "mcp";
63
62
  mcpCount++;
64
63
  }
65
- } else if (toolName.startsWith("internal--")) {
66
- source = "internal";
67
- internalCount++;
68
- } else if (toolName.startsWith("custom--")) {
69
- source = "custom";
70
- customCount++;
71
64
  } else {
72
- source = "internal";
73
- internalCount++;
65
+ source = "local";
66
+ localCount++;
74
67
  }
75
68
  toolList.push({
76
69
  id: toolName,
@@ -78,11 +71,12 @@ function createToolsRouter(getAgent) {
78
71
  description: toolInfo.description || "No description available",
79
72
  source,
80
73
  serverName,
81
- inputSchema: toolInfo.parameters
74
+ inputSchema: toolInfo.parameters,
75
+ _meta: toolInfo._meta
82
76
  });
83
77
  }
84
78
  toolList.sort((a, b) => {
85
- const sourceOrder = { internal: 0, custom: 1, mcp: 2 };
79
+ const sourceOrder = { local: 0, mcp: 1 };
86
80
  if (a.source !== b.source) {
87
81
  return sourceOrder[a.source] - sourceOrder[b.source];
88
82
  }
@@ -91,8 +85,7 @@ function createToolsRouter(getAgent) {
91
85
  return ctx.json({
92
86
  tools: toolList,
93
87
  totalCount: toolList.length,
94
- internalCount,
95
- customCount,
88
+ localCount,
96
89
  mcpCount
97
90
  });
98
91
  });
@@ -0,0 +1,136 @@
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 workspaces_exports = {};
20
+ __export(workspaces_exports, {
21
+ createWorkspacesRouter: () => createWorkspacesRouter
22
+ });
23
+ module.exports = __toCommonJS(workspaces_exports);
24
+ var import_zod_openapi = require("@hono/zod-openapi");
25
+ var import_responses = require("../schemas/responses.js");
26
+ const SetWorkspaceSchema = import_zod_openapi.z.object({
27
+ path: import_zod_openapi.z.string().min(1).describe("Absolute workspace root path"),
28
+ name: import_zod_openapi.z.string().optional().describe("Optional workspace display name")
29
+ }).strict().describe("Request body for setting the active workspace");
30
+ function createWorkspacesRouter(getAgent) {
31
+ const app = new import_zod_openapi.OpenAPIHono();
32
+ const listRoute = (0, import_zod_openapi.createRoute)({
33
+ method: "get",
34
+ path: "/workspaces",
35
+ summary: "List Workspaces",
36
+ description: "Retrieves all known workspaces",
37
+ tags: ["workspaces"],
38
+ responses: {
39
+ 200: {
40
+ description: "List of workspaces",
41
+ content: {
42
+ "application/json": {
43
+ schema: import_zod_openapi.z.object({
44
+ workspaces: import_zod_openapi.z.array(import_responses.WorkspaceSchema).describe("Workspace list")
45
+ }).strict()
46
+ }
47
+ }
48
+ }
49
+ }
50
+ });
51
+ const getActiveRoute = (0, import_zod_openapi.createRoute)({
52
+ method: "get",
53
+ path: "/workspaces/active",
54
+ summary: "Get Active Workspace",
55
+ description: "Returns the active workspace, if any",
56
+ tags: ["workspaces"],
57
+ responses: {
58
+ 200: {
59
+ description: "Active workspace",
60
+ content: {
61
+ "application/json": {
62
+ schema: import_zod_openapi.z.object({
63
+ workspace: import_responses.WorkspaceSchema.nullable().describe(
64
+ "Active workspace or null if none is set"
65
+ )
66
+ }).strict()
67
+ }
68
+ }
69
+ }
70
+ }
71
+ });
72
+ const setActiveRoute = (0, import_zod_openapi.createRoute)({
73
+ method: "post",
74
+ path: "/workspaces/active",
75
+ summary: "Set Active Workspace",
76
+ description: "Sets the active workspace for this runtime",
77
+ tags: ["workspaces"],
78
+ request: { body: { content: { "application/json": { schema: SetWorkspaceSchema } } } },
79
+ responses: {
80
+ 200: {
81
+ description: "Active workspace updated",
82
+ content: {
83
+ "application/json": {
84
+ schema: import_zod_openapi.z.object({
85
+ workspace: import_responses.WorkspaceSchema.describe("Updated active workspace")
86
+ }).strict()
87
+ }
88
+ }
89
+ }
90
+ }
91
+ });
92
+ const clearActiveRoute = (0, import_zod_openapi.createRoute)({
93
+ method: "delete",
94
+ path: "/workspaces/active",
95
+ summary: "Clear Active Workspace",
96
+ description: "Clears the active workspace for this runtime",
97
+ tags: ["workspaces"],
98
+ responses: {
99
+ 200: {
100
+ description: "Active workspace cleared",
101
+ content: {
102
+ "application/json": {
103
+ schema: import_zod_openapi.z.object({
104
+ workspace: import_responses.WorkspaceSchema.nullable().describe(
105
+ "Active workspace or null if none is set"
106
+ )
107
+ }).strict()
108
+ }
109
+ }
110
+ }
111
+ }
112
+ });
113
+ return app.openapi(listRoute, async (ctx) => {
114
+ const agent = await getAgent(ctx);
115
+ const workspaces = await agent.listWorkspaces();
116
+ return ctx.json({ workspaces });
117
+ }).openapi(getActiveRoute, async (ctx) => {
118
+ const agent = await getAgent(ctx);
119
+ const workspace = await agent.getWorkspace();
120
+ return ctx.json({ workspace: workspace ?? null });
121
+ }).openapi(setActiveRoute, async (ctx) => {
122
+ const agent = await getAgent(ctx);
123
+ const input = ctx.req.valid("json");
124
+ const workspaceInput = input.name === void 0 ? { path: input.path } : { path: input.path, name: input.name };
125
+ const workspace = await agent.setWorkspace(workspaceInput);
126
+ return ctx.json({ workspace });
127
+ }).openapi(clearActiveRoute, async (ctx) => {
128
+ const agent = await getAgent(ctx);
129
+ await agent.clearWorkspace();
130
+ return ctx.json({ workspace: null });
131
+ });
132
+ }
133
+ // Annotate the CommonJS export names for ESM import in node:
134
+ 0 && (module.exports = {
135
+ createWorkspacesRouter
136
+ });
@@ -0,0 +1,77 @@
1
+ import { OpenAPIHono } from '@hono/zod-openapi';
2
+ import type { GetAgentFn } from '../index.js';
3
+ export declare function createWorkspacesRouter(getAgent: GetAgentFn): OpenAPIHono<import("hono").Env, {
4
+ "/workspaces": {
5
+ $get: {
6
+ input: {};
7
+ output: {
8
+ workspaces: {
9
+ path: string;
10
+ id: string;
11
+ createdAt: number;
12
+ lastActiveAt: number;
13
+ name?: string | null | undefined;
14
+ }[];
15
+ };
16
+ outputFormat: "json";
17
+ status: 200;
18
+ };
19
+ };
20
+ } & {
21
+ "/workspaces/active": {
22
+ $get: {
23
+ input: {};
24
+ output: {
25
+ workspace: {
26
+ path: string;
27
+ id: string;
28
+ createdAt: number;
29
+ lastActiveAt: number;
30
+ name?: string | null | undefined;
31
+ } | null;
32
+ };
33
+ outputFormat: "json";
34
+ status: 200;
35
+ };
36
+ };
37
+ } & {
38
+ "/workspaces/active": {
39
+ $post: {
40
+ input: {
41
+ json: {
42
+ path: string;
43
+ name?: string | undefined;
44
+ };
45
+ };
46
+ output: {
47
+ workspace: {
48
+ path: string;
49
+ id: string;
50
+ createdAt: number;
51
+ lastActiveAt: number;
52
+ name?: string | null | undefined;
53
+ };
54
+ };
55
+ outputFormat: "json";
56
+ status: 200;
57
+ };
58
+ };
59
+ } & {
60
+ "/workspaces/active": {
61
+ $delete: {
62
+ input: {};
63
+ output: {
64
+ workspace: {
65
+ path: string;
66
+ id: string;
67
+ createdAt: number;
68
+ lastActiveAt: number;
69
+ name?: string | null | undefined;
70
+ } | null;
71
+ };
72
+ outputFormat: "json";
73
+ status: 200;
74
+ };
75
+ };
76
+ }, "/">;
77
+ //# sourceMappingURL=workspaces.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspaces.d.ts","sourceRoot":"","sources":["../../../src/hono/routes/workspaces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkB,MAAM,mBAAmB,CAAC;AAEhE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAU9C,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA0H1D"}