@dexto/server 1.6.19 → 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.
- package/dist/a2a/jsonrpc/methods.cjs +1 -1
- package/dist/a2a/jsonrpc/methods.d.ts +14 -4
- package/dist/a2a/jsonrpc/methods.d.ts.map +1 -1
- package/dist/a2a/jsonrpc/methods.js +1 -1
- package/dist/hono/index.cjs +39 -8
- package/dist/hono/index.d.ts +43 -4503
- package/dist/hono/index.d.ts.map +1 -1
- package/dist/hono/index.js +42 -9
- package/dist/hono/routes/a2a-jsonrpc.d.ts.map +1 -1
- package/dist/hono/routes/a2a-tasks.cjs +173 -34
- package/dist/hono/routes/a2a-tasks.d.ts +1 -498
- package/dist/hono/routes/a2a-tasks.d.ts.map +1 -1
- package/dist/hono/routes/a2a-tasks.js +177 -34
- package/dist/hono/routes/a2a.d.ts.map +1 -1
- package/dist/hono/routes/agents.cjs +410 -329
- package/dist/hono/routes/agents.d.ts +16048 -73
- package/dist/hono/routes/agents.d.ts.map +1 -1
- package/dist/hono/routes/agents.js +418 -330
- package/dist/hono/routes/approvals.cjs +103 -78
- package/dist/hono/routes/approvals.d.ts +2090 -112
- package/dist/hono/routes/approvals.d.ts.map +1 -1
- package/dist/hono/routes/approvals.js +108 -78
- package/dist/hono/routes/dexto-auth.cjs +40 -33
- package/dist/hono/routes/dexto-auth.d.ts +401 -2
- package/dist/hono/routes/dexto-auth.d.ts.map +1 -1
- package/dist/hono/routes/dexto-auth.js +40 -33
- package/dist/hono/routes/discovery.cjs +16 -14
- package/dist/hono/routes/discovery.d.ts +586 -1
- package/dist/hono/routes/discovery.d.ts.map +1 -1
- package/dist/hono/routes/discovery.js +16 -14
- package/dist/hono/routes/greeting.cjs +26 -22
- package/dist/hono/routes/greeting.d.ts +787 -3
- package/dist/hono/routes/greeting.d.ts.map +1 -1
- package/dist/hono/routes/greeting.js +26 -22
- package/dist/hono/routes/health.d.ts +1 -1
- package/dist/hono/routes/key.cjs +60 -52
- package/dist/hono/routes/key.d.ts +1597 -1
- package/dist/hono/routes/key.d.ts.map +1 -1
- package/dist/hono/routes/key.js +60 -52
- package/dist/hono/routes/llm.cjs +381 -348
- package/dist/hono/routes/llm.d.ts +12137 -87
- package/dist/hono/routes/llm.d.ts.map +1 -1
- package/dist/hono/routes/llm.js +385 -348
- package/dist/hono/routes/mcp.cjs +273 -212
- package/dist/hono/routes/mcp.d.ts +6605 -316
- package/dist/hono/routes/mcp.d.ts.map +1 -1
- package/dist/hono/routes/mcp.js +287 -213
- package/dist/hono/routes/memory.cjs +102 -89
- package/dist/hono/routes/memory.d.ts +5368 -4
- package/dist/hono/routes/memory.d.ts.map +1 -1
- package/dist/hono/routes/memory.js +108 -90
- package/dist/hono/routes/messages.cjs +171 -164
- package/dist/hono/routes/messages.d.ts +3899 -10
- package/dist/hono/routes/messages.d.ts.map +1 -1
- package/dist/hono/routes/messages.js +181 -165
- package/dist/hono/routes/models.cjs +106 -64
- package/dist/hono/routes/models.d.ts +2874 -1
- package/dist/hono/routes/models.d.ts.map +1 -1
- package/dist/hono/routes/models.js +108 -64
- package/dist/hono/routes/openrouter.cjs +79 -65
- package/dist/hono/routes/openrouter.d.ts +854 -1
- package/dist/hono/routes/openrouter.d.ts.map +1 -1
- package/dist/hono/routes/openrouter.js +79 -65
- package/dist/hono/routes/prompts.cjs +137 -104
- package/dist/hono/routes/prompts.d.ts +2820 -12
- package/dist/hono/routes/prompts.d.ts.map +1 -1
- package/dist/hono/routes/prompts.js +144 -105
- package/dist/hono/routes/queue.cjs +158 -132
- package/dist/hono/routes/queue.d.ts +5148 -13
- package/dist/hono/routes/queue.d.ts.map +1 -1
- package/dist/hono/routes/queue.js +168 -133
- package/dist/hono/routes/resources.cjs +65 -46
- package/dist/hono/routes/resources.d.ts +1983 -5
- package/dist/hono/routes/resources.d.ts.map +1 -1
- package/dist/hono/routes/resources.js +72 -47
- package/dist/hono/routes/schedules.cjs +233 -226
- package/dist/hono/routes/schedules.d.ts +4202 -26
- package/dist/hono/routes/schedules.d.ts.map +1 -1
- package/dist/hono/routes/schedules.js +233 -226
- package/dist/hono/routes/search.cjs +34 -30
- package/dist/hono/routes/search.d.ts +2837 -14
- package/dist/hono/routes/search.d.ts.map +1 -1
- package/dist/hono/routes/search.js +40 -31
- package/dist/hono/routes/sessions.cjs +404 -392
- package/dist/hono/routes/sessions.d.ts +16585 -30
- package/dist/hono/routes/sessions.d.ts.map +1 -1
- package/dist/hono/routes/sessions.js +408 -393
- package/dist/hono/routes/static.d.ts.map +1 -1
- package/dist/hono/routes/system-prompt.cjs +57 -61
- package/dist/hono/routes/system-prompt.d.ts +1228 -2
- package/dist/hono/routes/system-prompt.d.ts.map +1 -1
- package/dist/hono/routes/system-prompt.js +58 -62
- package/dist/hono/routes/tools.cjs +29 -34
- package/dist/hono/routes/tools.d.ts +1756 -7
- package/dist/hono/routes/tools.d.ts.map +1 -1
- package/dist/hono/routes/tools.js +33 -33
- package/dist/hono/routes/webhooks.cjs +159 -132
- package/dist/hono/routes/webhooks.d.ts +2504 -14
- package/dist/hono/routes/webhooks.d.ts.map +1 -1
- package/dist/hono/routes/webhooks.js +163 -132
- package/dist/hono/routes/workspaces.cjs +84 -79
- package/dist/hono/routes/workspaces.d.ts +2093 -2
- package/dist/hono/routes/workspaces.d.ts.map +1 -1
- package/dist/hono/routes/workspaces.js +89 -80
- package/dist/hono/schemas/responses.cjs +492 -235
- package/dist/hono/schemas/responses.d.ts +1461 -146
- package/dist/hono/schemas/responses.d.ts.map +1 -1
- package/dist/hono/schemas/responses.js +247 -9
- package/dist/hono/types.d.ts +11 -0
- package/dist/hono/types.d.ts.map +1 -1
- 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,
|
|
1
|
+
{"version":3,"file":"webhooks.d.ts","sourceRoot":"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AK,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAAC;AAE5D,KAAK,mBAAmB,GAAG,kBAAkB,CACzC,OAAO,aAAa,EACpB;IAAE,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAA;CAAE,CAC9C,CAAC;AACF,KAAK,eAAe,GAAG,kBAAkB,CAAC,OAAO,SAAS,EAAE,EAAE,CAAC,CAAC;AAChE,KAAK,cAAc,GAAG,kBAAkB,CAAC,OAAO,QAAQ,EAAE,mBAAmB,CAAC,CAAC;AAC/E,KAAK,iBAAiB,GAAG,kBAAkB,CAAC,OAAO,WAAW,EAAE,mBAAmB,CAAC,CAAC;AACrF,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,9 +1,15 @@
|
|
|
1
1
|
import { OpenAPIHono, createRoute, z } from "@hono/zod-openapi";
|
|
2
|
+
import { DextoRuntimeError, ErrorType } from "@dexto/core";
|
|
3
|
+
import {
|
|
4
|
+
ApiErrorResponseSchema,
|
|
5
|
+
BadRequestErrorResponse,
|
|
6
|
+
InternalErrorResponse
|
|
7
|
+
} from "../schemas/responses.js";
|
|
2
8
|
const WebhookResponseSchema = z.object({
|
|
3
9
|
id: z.string().describe("Unique webhook identifier"),
|
|
4
10
|
url: z.string().url().describe("Webhook URL"),
|
|
5
11
|
description: z.string().optional().describe("Webhook description"),
|
|
6
|
-
createdAt: z.
|
|
12
|
+
createdAt: z.string().datetime().describe("Creation timestamp (ISO 8601)")
|
|
7
13
|
}).strict().describe("Webhook response object");
|
|
8
14
|
const WebhookTestResultSchema = z.object({
|
|
9
15
|
success: z.boolean().describe("Whether the webhook test succeeded"),
|
|
@@ -16,113 +22,129 @@ const WebhookBodySchema = z.object({
|
|
|
16
22
|
secret: z.string().optional().describe("A secret key for HMAC signature verification"),
|
|
17
23
|
description: z.string().optional().describe("A description of the webhook for reference")
|
|
18
24
|
}).describe("Request body for registering a webhook");
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
webhook: WebhookResponseSchema.describe(
|
|
35
|
-
"Registered webhook details"
|
|
36
|
-
)
|
|
37
|
-
}).strict()
|
|
38
|
-
}
|
|
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()
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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()
|
|
58
61
|
}
|
|
59
62
|
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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()
|
|
78
82
|
}
|
|
79
|
-
}
|
|
80
|
-
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
404: {
|
|
86
|
+
description: "Not found",
|
|
87
|
+
content: { "application/json": { schema: ApiErrorResponseSchema } }
|
|
81
88
|
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
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()
|
|
100
107
|
}
|
|
101
|
-
}
|
|
102
|
-
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
404: {
|
|
111
|
+
description: "Not found",
|
|
112
|
+
content: { "application/json": { schema: ApiErrorResponseSchema } }
|
|
103
113
|
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
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()
|
|
122
132
|
}
|
|
123
|
-
}
|
|
124
|
-
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
404: {
|
|
136
|
+
description: "Not found",
|
|
137
|
+
content: { "application/json": { schema: ApiErrorResponseSchema } }
|
|
125
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()
|
|
126
148
|
});
|
|
127
149
|
return app.openapi(registerRoute, async (ctx) => {
|
|
128
150
|
const agent = await getAgent(ctx);
|
|
@@ -139,64 +161,73 @@ function createWebhooksRouter(getAgent, webhookSubscriber) {
|
|
|
139
161
|
agent.logger.info(`Webhook registered: ${webhookId} -> ${url}`);
|
|
140
162
|
return ctx.json(
|
|
141
163
|
{
|
|
142
|
-
webhook:
|
|
143
|
-
id: webhook.id,
|
|
144
|
-
url: webhook.url,
|
|
145
|
-
description: webhook.description,
|
|
146
|
-
createdAt: webhook.createdAt
|
|
147
|
-
}
|
|
164
|
+
webhook: serializeWebhook(webhook)
|
|
148
165
|
},
|
|
149
166
|
201
|
|
150
167
|
);
|
|
151
168
|
}).openapi(listRoute, async (ctx) => {
|
|
152
|
-
const webhooks = webhookSubscriber.getWebhooks().map(
|
|
153
|
-
|
|
154
|
-
url: webhook.url,
|
|
155
|
-
description: webhook.description,
|
|
156
|
-
createdAt: webhook.createdAt
|
|
157
|
-
}));
|
|
158
|
-
return ctx.json({ webhooks });
|
|
169
|
+
const webhooks = webhookSubscriber.getWebhooks().map(serializeWebhook);
|
|
170
|
+
return ctx.json({ webhooks }, 200);
|
|
159
171
|
}).openapi(getRoute, (ctx) => {
|
|
160
172
|
const { webhookId } = ctx.req.valid("param");
|
|
161
173
|
const webhook = webhookSubscriber.getWebhook(webhookId);
|
|
162
174
|
if (!webhook) {
|
|
163
|
-
|
|
175
|
+
throw new DextoRuntimeError(
|
|
176
|
+
"webhook_not_found",
|
|
177
|
+
"webhook",
|
|
178
|
+
ErrorType.NOT_FOUND,
|
|
179
|
+
"Webhook not found",
|
|
180
|
+
{ webhookId }
|
|
181
|
+
);
|
|
164
182
|
}
|
|
165
|
-
return ctx.json(
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}
|
|
172
|
-
});
|
|
183
|
+
return ctx.json(
|
|
184
|
+
{
|
|
185
|
+
webhook: serializeWebhook(webhook)
|
|
186
|
+
},
|
|
187
|
+
200
|
|
188
|
+
);
|
|
173
189
|
}).openapi(deleteRoute, async (ctx) => {
|
|
174
190
|
const agent = await getAgent(ctx);
|
|
175
191
|
const { webhookId } = ctx.req.valid("param");
|
|
176
192
|
const removed = webhookSubscriber.removeWebhook(webhookId);
|
|
177
193
|
if (!removed) {
|
|
178
|
-
|
|
194
|
+
throw new DextoRuntimeError(
|
|
195
|
+
"webhook_not_found",
|
|
196
|
+
"webhook",
|
|
197
|
+
ErrorType.NOT_FOUND,
|
|
198
|
+
"Webhook not found",
|
|
199
|
+
{ webhookId }
|
|
200
|
+
);
|
|
179
201
|
}
|
|
180
202
|
agent.logger.info(`Webhook removed: ${webhookId}`);
|
|
181
|
-
return ctx.json({ status: "removed", webhookId });
|
|
203
|
+
return ctx.json({ status: "removed", webhookId }, 200);
|
|
182
204
|
}).openapi(testRoute, async (ctx) => {
|
|
183
205
|
const agent = await getAgent(ctx);
|
|
184
206
|
const { webhookId } = ctx.req.valid("param");
|
|
185
207
|
const webhook = webhookSubscriber.getWebhook(webhookId);
|
|
186
208
|
if (!webhook) {
|
|
187
|
-
|
|
209
|
+
throw new DextoRuntimeError(
|
|
210
|
+
"webhook_not_found",
|
|
211
|
+
"webhook",
|
|
212
|
+
ErrorType.NOT_FOUND,
|
|
213
|
+
"Webhook not found",
|
|
214
|
+
{ webhookId }
|
|
215
|
+
);
|
|
188
216
|
}
|
|
189
217
|
agent.logger.info(`Testing webhook: ${webhookId}`);
|
|
190
218
|
const result = await webhookSubscriber.testWebhook(webhookId);
|
|
191
|
-
return ctx.json(
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
219
|
+
return ctx.json(
|
|
220
|
+
{
|
|
221
|
+
test: "completed",
|
|
222
|
+
result: {
|
|
223
|
+
success: result.success,
|
|
224
|
+
statusCode: result.statusCode,
|
|
225
|
+
responseTime: result.responseTime,
|
|
226
|
+
error: result.error
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
200
|
|
230
|
+
);
|
|
200
231
|
});
|
|
201
232
|
}
|
|
202
233
|
export {
|
|
@@ -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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
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:
|