@dexto/server 1.6.20 → 1.6.21

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 (111) hide show
  1. package/dist/a2a/jsonrpc/methods.cjs +1 -1
  2. package/dist/a2a/jsonrpc/methods.d.ts +14 -4
  3. package/dist/a2a/jsonrpc/methods.d.ts.map +1 -1
  4. package/dist/a2a/jsonrpc/methods.js +1 -1
  5. package/dist/hono/index.cjs +39 -8
  6. package/dist/hono/index.d.ts +43 -4531
  7. package/dist/hono/index.d.ts.map +1 -1
  8. package/dist/hono/index.js +42 -9
  9. package/dist/hono/routes/a2a-jsonrpc.d.ts.map +1 -1
  10. package/dist/hono/routes/a2a-tasks.cjs +158 -32
  11. package/dist/hono/routes/a2a-tasks.d.ts +1 -502
  12. package/dist/hono/routes/a2a-tasks.d.ts.map +1 -1
  13. package/dist/hono/routes/a2a-tasks.js +162 -32
  14. package/dist/hono/routes/a2a.d.ts.map +1 -1
  15. package/dist/hono/routes/agents.cjs +410 -329
  16. package/dist/hono/routes/agents.d.ts +16043 -68
  17. package/dist/hono/routes/agents.d.ts.map +1 -1
  18. package/dist/hono/routes/agents.js +418 -330
  19. package/dist/hono/routes/approvals.cjs +102 -88
  20. package/dist/hono/routes/approvals.d.ts +2089 -142
  21. package/dist/hono/routes/approvals.d.ts.map +1 -1
  22. package/dist/hono/routes/approvals.js +108 -89
  23. package/dist/hono/routes/dexto-auth.cjs +40 -33
  24. package/dist/hono/routes/dexto-auth.d.ts +401 -2
  25. package/dist/hono/routes/dexto-auth.d.ts.map +1 -1
  26. package/dist/hono/routes/dexto-auth.js +40 -33
  27. package/dist/hono/routes/discovery.cjs +16 -14
  28. package/dist/hono/routes/discovery.d.ts +586 -1
  29. package/dist/hono/routes/discovery.d.ts.map +1 -1
  30. package/dist/hono/routes/discovery.js +16 -14
  31. package/dist/hono/routes/greeting.cjs +26 -22
  32. package/dist/hono/routes/greeting.d.ts +787 -3
  33. package/dist/hono/routes/greeting.d.ts.map +1 -1
  34. package/dist/hono/routes/greeting.js +26 -22
  35. package/dist/hono/routes/health.d.ts +1 -1
  36. package/dist/hono/routes/key.cjs +60 -52
  37. package/dist/hono/routes/key.d.ts +1597 -1
  38. package/dist/hono/routes/key.d.ts.map +1 -1
  39. package/dist/hono/routes/key.js +60 -52
  40. package/dist/hono/routes/llm.cjs +381 -348
  41. package/dist/hono/routes/llm.d.ts +12136 -86
  42. package/dist/hono/routes/llm.d.ts.map +1 -1
  43. package/dist/hono/routes/llm.js +385 -348
  44. package/dist/hono/routes/mcp.cjs +257 -226
  45. package/dist/hono/routes/mcp.d.ts +6605 -309
  46. package/dist/hono/routes/mcp.d.ts.map +1 -1
  47. package/dist/hono/routes/mcp.js +263 -225
  48. package/dist/hono/routes/memory.cjs +102 -89
  49. package/dist/hono/routes/memory.d.ts +5368 -4
  50. package/dist/hono/routes/memory.d.ts.map +1 -1
  51. package/dist/hono/routes/memory.js +108 -90
  52. package/dist/hono/routes/messages.cjs +147 -139
  53. package/dist/hono/routes/messages.d.ts +3900 -11
  54. package/dist/hono/routes/messages.d.ts.map +1 -1
  55. package/dist/hono/routes/messages.js +150 -139
  56. package/dist/hono/routes/models.cjs +106 -64
  57. package/dist/hono/routes/models.d.ts +2874 -1
  58. package/dist/hono/routes/models.d.ts.map +1 -1
  59. package/dist/hono/routes/models.js +108 -64
  60. package/dist/hono/routes/openrouter.cjs +79 -65
  61. package/dist/hono/routes/openrouter.d.ts +854 -1
  62. package/dist/hono/routes/openrouter.d.ts.map +1 -1
  63. package/dist/hono/routes/openrouter.js +79 -65
  64. package/dist/hono/routes/prompts.cjs +136 -109
  65. package/dist/hono/routes/prompts.d.ts +2818 -10
  66. package/dist/hono/routes/prompts.d.ts.map +1 -1
  67. package/dist/hono/routes/prompts.js +138 -109
  68. package/dist/hono/routes/queue.cjs +133 -120
  69. package/dist/hono/routes/queue.d.ts +5144 -9
  70. package/dist/hono/routes/queue.d.ts.map +1 -1
  71. package/dist/hono/routes/queue.js +136 -120
  72. package/dist/hono/routes/resources.cjs +65 -46
  73. package/dist/hono/routes/resources.d.ts +1982 -4
  74. package/dist/hono/routes/resources.d.ts.map +1 -1
  75. package/dist/hono/routes/resources.js +72 -47
  76. package/dist/hono/routes/schedules.cjs +233 -226
  77. package/dist/hono/routes/schedules.d.ts +4198 -22
  78. package/dist/hono/routes/schedules.d.ts.map +1 -1
  79. package/dist/hono/routes/schedules.js +233 -226
  80. package/dist/hono/routes/search.cjs +34 -30
  81. package/dist/hono/routes/search.d.ts +2835 -12
  82. package/dist/hono/routes/search.d.ts.map +1 -1
  83. package/dist/hono/routes/search.js +40 -31
  84. package/dist/hono/routes/sessions.cjs +403 -396
  85. package/dist/hono/routes/sessions.d.ts +16582 -27
  86. package/dist/hono/routes/sessions.d.ts.map +1 -1
  87. package/dist/hono/routes/sessions.js +407 -397
  88. package/dist/hono/routes/static.d.ts.map +1 -1
  89. package/dist/hono/routes/system-prompt.cjs +57 -61
  90. package/dist/hono/routes/system-prompt.d.ts +1228 -2
  91. package/dist/hono/routes/system-prompt.d.ts.map +1 -1
  92. package/dist/hono/routes/system-prompt.js +58 -62
  93. package/dist/hono/routes/tools.cjs +29 -34
  94. package/dist/hono/routes/tools.d.ts +1755 -6
  95. package/dist/hono/routes/tools.d.ts.map +1 -1
  96. package/dist/hono/routes/tools.js +33 -33
  97. package/dist/hono/routes/webhooks.cjs +115 -123
  98. package/dist/hono/routes/webhooks.d.ts +2501 -11
  99. package/dist/hono/routes/webhooks.d.ts.map +1 -1
  100. package/dist/hono/routes/webhooks.js +120 -124
  101. package/dist/hono/routes/workspaces.cjs +84 -79
  102. package/dist/hono/routes/workspaces.d.ts +2093 -2
  103. package/dist/hono/routes/workspaces.d.ts.map +1 -1
  104. package/dist/hono/routes/workspaces.js +89 -80
  105. package/dist/hono/schemas/responses.cjs +406 -259
  106. package/dist/hono/schemas/responses.d.ts +1246 -123
  107. package/dist/hono/schemas/responses.d.ts.map +1 -1
  108. package/dist/hono/schemas/responses.js +144 -10
  109. package/dist/hono/types.d.ts +11 -0
  110. package/dist/hono/types.d.ts.map +1 -1
  111. package/package.json +7 -7
@@ -1 +1 @@
1
- {"version":3,"file":"webhooks.d.ts","sourceRoot":"","sources":["../../../src/hono/routes/webhooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkB,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAgC,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAG5E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,KAAK,UAAU,GAAG,CAAC,GAAG,EAAE,OAAO,KAAK,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAkCrE,wBAAgB,oBAAoB,CAChC,QAAQ,EAAE,UAAU,EACpB,iBAAiB,EAAE,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA2P5C"}
1
+ {"version":3,"file":"webhooks.d.ts","sourceRoot":"","sources":["../../../src/hono/routes/webhooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAe,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAEhE,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAO5E,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAuBlE,QAAA,MAAM,iBAAiB;;;;;;;;;;;;EASgC,CAAC;AAExD,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,KAAK,eAAe,GAAG,kBAAkB,CAAC,OAAO,SAAS,EAAE,mBAAmB,CAAC,CAAC;AAEjF,MAAM,MAAM,oBAAoB,GAC1B,mBAAmB,GACnB,eAAe,GACf,cAAc,GACd,iBAAiB,GACjB,eAAe,CAAC"}
@@ -1,11 +1,15 @@
1
1
  import { OpenAPIHono, createRoute, z } from "@hono/zod-openapi";
2
2
  import { DextoRuntimeError, ErrorType } from "@dexto/core";
3
- import { ApiErrorResponseSchema } from "../schemas/responses.js";
3
+ import {
4
+ ApiErrorResponseSchema,
5
+ BadRequestErrorResponse,
6
+ InternalErrorResponse
7
+ } from "../schemas/responses.js";
4
8
  const WebhookResponseSchema = z.object({
5
9
  id: z.string().describe("Unique webhook identifier"),
6
10
  url: z.string().url().describe("Webhook URL"),
7
11
  description: z.string().optional().describe("Webhook description"),
8
- createdAt: z.union([z.date(), z.number()]).describe("Creation timestamp (Date or Unix ms)")
12
+ createdAt: z.string().datetime().describe("Creation timestamp (ISO 8601)")
9
13
  }).strict().describe("Webhook response object");
10
14
  const WebhookTestResultSchema = z.object({
11
15
  success: z.boolean().describe("Whether the webhook test succeeded"),
@@ -18,122 +22,129 @@ const WebhookBodySchema = z.object({
18
22
  secret: z.string().optional().describe("A secret key for HMAC signature verification"),
19
23
  description: z.string().optional().describe("A description of the webhook for reference")
20
24
  }).describe("Request body for registering a webhook");
21
- function createWebhooksRouter(getAgent, webhookSubscriber) {
22
- const app = new OpenAPIHono();
23
- const registerRoute = createRoute({
24
- method: "post",
25
- path: "/webhooks",
26
- summary: "Register Webhook",
27
- description: "Registers a new webhook endpoint to receive agent events",
28
- tags: ["webhooks"],
29
- request: { body: { content: { "application/json": { schema: WebhookBodySchema } } } },
30
- responses: {
31
- 201: {
32
- description: "Webhook registered",
33
- content: {
34
- "application/json": {
35
- schema: z.object({
36
- webhook: WebhookResponseSchema.describe(
37
- "Registered webhook details"
38
- )
39
- }).strict()
40
- }
25
+ const registerRoute = createRoute({
26
+ method: "post",
27
+ path: "/webhooks",
28
+ summary: "Register Webhook",
29
+ description: "Registers a new webhook endpoint to receive agent events",
30
+ tags: ["webhooks"],
31
+ request: { body: { content: { "application/json": { schema: WebhookBodySchema } } } },
32
+ responses: {
33
+ 201: {
34
+ description: "Webhook registered",
35
+ content: {
36
+ "application/json": {
37
+ schema: z.object({
38
+ webhook: WebhookResponseSchema.describe("Registered webhook details")
39
+ }).strict()
41
40
  }
42
41
  }
43
- }
44
- });
45
- const listRoute = createRoute({
46
- method: "get",
47
- path: "/webhooks",
48
- summary: "List Webhooks",
49
- description: "Retrieves a list of all registered webhooks",
50
- tags: ["webhooks"],
51
- responses: {
52
- 200: {
53
- description: "List webhooks",
54
- content: {
55
- "application/json": {
56
- schema: z.object({
57
- webhooks: z.array(WebhookResponseSchema).describe("Array of registered webhooks")
58
- }).strict()
59
- }
42
+ },
43
+ 400: BadRequestErrorResponse,
44
+ 500: InternalErrorResponse
45
+ }
46
+ });
47
+ const listRoute = createRoute({
48
+ method: "get",
49
+ path: "/webhooks",
50
+ summary: "List Webhooks",
51
+ description: "Retrieves a list of all registered webhooks",
52
+ tags: ["webhooks"],
53
+ responses: {
54
+ 200: {
55
+ description: "List webhooks",
56
+ content: {
57
+ "application/json": {
58
+ schema: z.object({
59
+ webhooks: z.array(WebhookResponseSchema).describe("Array of registered webhooks")
60
+ }).strict()
60
61
  }
61
62
  }
62
- }
63
- });
64
- const getRoute = createRoute({
65
- method: "get",
66
- path: "/webhooks/{webhookId}",
67
- summary: "Get Webhook Details",
68
- description: "Fetches details for a specific webhook",
69
- tags: ["webhooks"],
70
- request: { params: z.object({ webhookId: z.string().describe("The webhook identifier") }) },
71
- responses: {
72
- 200: {
73
- description: "Webhook",
74
- content: {
75
- "application/json": {
76
- schema: z.object({
77
- webhook: WebhookResponseSchema.describe("Webhook details")
78
- }).strict()
79
- }
63
+ },
64
+ 500: InternalErrorResponse
65
+ }
66
+ });
67
+ const getRoute = createRoute({
68
+ method: "get",
69
+ path: "/webhooks/{webhookId}",
70
+ summary: "Get Webhook Details",
71
+ description: "Fetches details for a specific webhook",
72
+ tags: ["webhooks"],
73
+ request: { params: z.object({ webhookId: z.string().describe("The webhook identifier") }) },
74
+ responses: {
75
+ 200: {
76
+ description: "Webhook",
77
+ content: {
78
+ "application/json": {
79
+ schema: z.object({
80
+ webhook: WebhookResponseSchema.describe("Webhook details")
81
+ }).strict()
80
82
  }
81
- },
82
- 404: {
83
- description: "Not found",
84
- content: { "application/json": { schema: ApiErrorResponseSchema } }
85
83
  }
84
+ },
85
+ 404: {
86
+ description: "Not found",
87
+ content: { "application/json": { schema: ApiErrorResponseSchema } }
86
88
  }
87
- });
88
- const deleteRoute = createRoute({
89
- method: "delete",
90
- path: "/webhooks/{webhookId}",
91
- summary: "Delete Webhook",
92
- description: "Permanently removes a webhook endpoint. This action cannot be undone",
93
- tags: ["webhooks"],
94
- request: { params: z.object({ webhookId: z.string().describe("The webhook identifier") }) },
95
- responses: {
96
- 200: {
97
- description: "Removed",
98
- content: {
99
- "application/json": {
100
- schema: z.object({
101
- status: z.literal("removed").describe("Operation status indicating successful removal"),
102
- webhookId: z.string().describe("ID of the removed webhook")
103
- }).strict()
104
- }
89
+ }
90
+ });
91
+ const deleteRoute = createRoute({
92
+ method: "delete",
93
+ path: "/webhooks/{webhookId}",
94
+ summary: "Delete Webhook",
95
+ description: "Permanently removes a webhook endpoint. This action cannot be undone",
96
+ tags: ["webhooks"],
97
+ request: { params: z.object({ webhookId: z.string().describe("The webhook identifier") }) },
98
+ responses: {
99
+ 200: {
100
+ description: "Removed",
101
+ content: {
102
+ "application/json": {
103
+ schema: z.object({
104
+ status: z.literal("removed").describe("Operation status indicating successful removal"),
105
+ webhookId: z.string().describe("ID of the removed webhook")
106
+ }).strict()
105
107
  }
106
- },
107
- 404: {
108
- description: "Not found",
109
- content: { "application/json": { schema: ApiErrorResponseSchema } }
110
108
  }
109
+ },
110
+ 404: {
111
+ description: "Not found",
112
+ content: { "application/json": { schema: ApiErrorResponseSchema } }
111
113
  }
112
- });
113
- const testRoute = createRoute({
114
- method: "post",
115
- path: "/webhooks/{webhookId}/test",
116
- summary: "Test Webhook",
117
- description: "Sends a sample event to test webhook connectivity and configuration",
118
- tags: ["webhooks"],
119
- request: { params: z.object({ webhookId: z.string().describe("The webhook identifier") }) },
120
- responses: {
121
- 200: {
122
- description: "Test result",
123
- content: {
124
- "application/json": {
125
- schema: z.object({
126
- test: z.literal("completed").describe("Test status indicating completion"),
127
- result: WebhookTestResultSchema.describe("Test execution results")
128
- }).strict()
129
- }
114
+ }
115
+ });
116
+ const testRoute = createRoute({
117
+ method: "post",
118
+ path: "/webhooks/{webhookId}/test",
119
+ summary: "Test Webhook",
120
+ description: "Sends a sample event to test webhook connectivity and configuration",
121
+ tags: ["webhooks"],
122
+ request: { params: z.object({ webhookId: z.string().describe("The webhook identifier") }) },
123
+ responses: {
124
+ 200: {
125
+ description: "Test result",
126
+ content: {
127
+ "application/json": {
128
+ schema: z.object({
129
+ test: z.literal("completed").describe("Test status indicating completion"),
130
+ result: WebhookTestResultSchema.describe("Test execution results")
131
+ }).strict()
130
132
  }
131
- },
132
- 404: {
133
- description: "Not found",
134
- content: { "application/json": { schema: ApiErrorResponseSchema } }
135
133
  }
134
+ },
135
+ 404: {
136
+ description: "Not found",
137
+ content: { "application/json": { schema: ApiErrorResponseSchema } }
136
138
  }
139
+ }
140
+ });
141
+ function createWebhooksRouter(getAgent, webhookSubscriber) {
142
+ const app = new OpenAPIHono();
143
+ const serializeWebhook = (webhook) => ({
144
+ id: webhook.id,
145
+ url: webhook.url,
146
+ description: webhook.description,
147
+ createdAt: webhook.createdAt.toISOString()
137
148
  });
138
149
  return app.openapi(registerRoute, async (ctx) => {
139
150
  const agent = await getAgent(ctx);
@@ -150,23 +161,13 @@ function createWebhooksRouter(getAgent, webhookSubscriber) {
150
161
  agent.logger.info(`Webhook registered: ${webhookId} -> ${url}`);
151
162
  return ctx.json(
152
163
  {
153
- webhook: {
154
- id: webhook.id,
155
- url: webhook.url,
156
- description: webhook.description,
157
- createdAt: webhook.createdAt
158
- }
164
+ webhook: serializeWebhook(webhook)
159
165
  },
160
166
  201
161
167
  );
162
168
  }).openapi(listRoute, async (ctx) => {
163
- const webhooks = webhookSubscriber.getWebhooks().map((webhook) => ({
164
- id: webhook.id,
165
- url: webhook.url,
166
- description: webhook.description,
167
- createdAt: webhook.createdAt
168
- }));
169
- return ctx.json({ webhooks });
169
+ const webhooks = webhookSubscriber.getWebhooks().map(serializeWebhook);
170
+ return ctx.json({ webhooks }, 200);
170
171
  }).openapi(getRoute, (ctx) => {
171
172
  const { webhookId } = ctx.req.valid("param");
172
173
  const webhook = webhookSubscriber.getWebhook(webhookId);
@@ -181,12 +182,7 @@ function createWebhooksRouter(getAgent, webhookSubscriber) {
181
182
  }
182
183
  return ctx.json(
183
184
  {
184
- webhook: {
185
- id: webhook.id,
186
- url: webhook.url,
187
- description: webhook.description,
188
- createdAt: webhook.createdAt
189
- }
185
+ webhook: serializeWebhook(webhook)
190
186
  },
191
187
  200
192
188
  );
@@ -27,107 +27,112 @@ const SetWorkspaceSchema = import_zod_openapi.z.object({
27
27
  path: import_zod_openapi.z.string().min(1).describe("Absolute workspace root path"),
28
28
  name: import_zod_openapi.z.string().optional().describe("Optional workspace display name")
29
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
- }
30
+ const listRoute = (0, import_zod_openapi.createRoute)({
31
+ method: "get",
32
+ path: "/workspaces",
33
+ summary: "List Workspaces",
34
+ description: "Retrieves all known workspaces",
35
+ tags: ["workspaces"],
36
+ responses: {
37
+ 200: {
38
+ description: "List of workspaces",
39
+ content: {
40
+ "application/json": {
41
+ schema: import_zod_openapi.z.object({
42
+ workspaces: import_zod_openapi.z.array(import_responses.WorkspaceSchema).describe("Workspace list")
43
+ }).strict()
47
44
  }
48
45
  }
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
- }
46
+ },
47
+ 500: import_responses.InternalErrorResponse
48
+ }
49
+ });
50
+ const getActiveRoute = (0, import_zod_openapi.createRoute)({
51
+ method: "get",
52
+ path: "/workspaces/active",
53
+ summary: "Get Active Workspace",
54
+ description: "Returns the active workspace, if any",
55
+ tags: ["workspaces"],
56
+ responses: {
57
+ 200: {
58
+ description: "Active workspace",
59
+ content: {
60
+ "application/json": {
61
+ schema: import_zod_openapi.z.object({
62
+ workspace: import_responses.WorkspaceSchema.nullable().describe(
63
+ "Active workspace or null if none is set"
64
+ )
65
+ }).strict()
68
66
  }
69
67
  }
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
- }
68
+ },
69
+ 500: import_responses.InternalErrorResponse
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()
88
87
  }
89
88
  }
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
- }
89
+ },
90
+ 400: import_responses.BadRequestErrorResponse,
91
+ 500: import_responses.InternalErrorResponse
92
+ }
93
+ });
94
+ const clearActiveRoute = (0, import_zod_openapi.createRoute)({
95
+ method: "delete",
96
+ path: "/workspaces/active",
97
+ summary: "Clear Active Workspace",
98
+ description: "Clears the active workspace for this runtime",
99
+ tags: ["workspaces"],
100
+ responses: {
101
+ 200: {
102
+ description: "Active workspace cleared",
103
+ content: {
104
+ "application/json": {
105
+ schema: import_zod_openapi.z.object({
106
+ workspace: import_responses.WorkspaceSchema.nullable().describe(
107
+ "Active workspace or null if none is set"
108
+ )
109
+ }).strict()
109
110
  }
110
111
  }
111
- }
112
- });
112
+ },
113
+ 500: import_responses.InternalErrorResponse
114
+ }
115
+ });
116
+ function createWorkspacesRouter(getAgent) {
117
+ const app = new import_zod_openapi.OpenAPIHono();
113
118
  return app.openapi(listRoute, async (ctx) => {
114
119
  const agent = await getAgent(ctx);
115
120
  const workspaces = await agent.listWorkspaces();
116
- return ctx.json({ workspaces });
121
+ return ctx.json({ workspaces }, 200);
117
122
  }).openapi(getActiveRoute, async (ctx) => {
118
123
  const agent = await getAgent(ctx);
119
124
  const workspace = await agent.getWorkspace();
120
- return ctx.json({ workspace: workspace ?? null });
125
+ return ctx.json({ workspace: workspace ?? null }, 200);
121
126
  }).openapi(setActiveRoute, async (ctx) => {
122
127
  const agent = await getAgent(ctx);
123
128
  const input = ctx.req.valid("json");
124
129
  const workspaceInput = input.name === void 0 ? { path: input.path } : { path: input.path, name: input.name };
125
130
  const workspace = await agent.setWorkspace(workspaceInput);
126
- return ctx.json({ workspace });
131
+ return ctx.json({ workspace }, 200);
127
132
  }).openapi(clearActiveRoute, async (ctx) => {
128
133
  const agent = await getAgent(ctx);
129
134
  await agent.clearWorkspace();
130
- return ctx.json({ workspace: null });
135
+ return ctx.json({ workspace: null }, 200);
131
136
  });
132
137
  }
133
138
  // Annotate the CommonJS export names for ESM import in node: