@dexto/server 1.6.20 → 1.6.22
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/approval/wire-approval-events.cjs +44 -0
- package/dist/approval/wire-approval-events.d.ts +4 -0
- package/dist/approval/wire-approval-events.d.ts.map +1 -0
- package/dist/approval/wire-approval-events.js +20 -0
- package/dist/events/session-sse-subscriber.cjs +167 -0
- package/dist/events/session-sse-subscriber.d.ts +13 -0
- package/dist/events/session-sse-subscriber.d.ts.map +1 -0
- package/dist/events/session-sse-subscriber.js +143 -0
- package/dist/hono/__tests__/test-fixtures.cjs +8 -0
- package/dist/hono/__tests__/test-fixtures.d.ts +1 -0
- package/dist/hono/__tests__/test-fixtures.d.ts.map +1 -1
- package/dist/hono/__tests__/test-fixtures.js +8 -0
- package/dist/hono/index.cjs +40 -8
- package/dist/hono/index.d.ts +45 -4531
- package/dist/hono/index.d.ts.map +1 -1
- package/dist/hono/index.js +43 -9
- package/dist/hono/node/index.cjs +51 -6
- package/dist/hono/node/index.d.ts.map +1 -1
- package/dist/hono/node/index.js +51 -6
- package/dist/hono/routes/a2a-jsonrpc.d.ts.map +1 -1
- package/dist/hono/routes/a2a-tasks.cjs +158 -32
- package/dist/hono/routes/a2a-tasks.d.ts +1 -502
- package/dist/hono/routes/a2a-tasks.d.ts.map +1 -1
- package/dist/hono/routes/a2a-tasks.js +162 -32
- 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 +16043 -68
- package/dist/hono/routes/agents.d.ts.map +1 -1
- package/dist/hono/routes/agents.js +418 -330
- package/dist/hono/routes/approvals.cjs +102 -88
- package/dist/hono/routes/approvals.d.ts +2089 -142
- package/dist/hono/routes/approvals.d.ts.map +1 -1
- package/dist/hono/routes/approvals.js +108 -89
- 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 +382 -349
- package/dist/hono/routes/llm.d.ts +12148 -98
- package/dist/hono/routes/llm.d.ts.map +1 -1
- package/dist/hono/routes/llm.js +386 -349
- package/dist/hono/routes/mcp.cjs +257 -226
- package/dist/hono/routes/mcp.d.ts +6605 -309
- package/dist/hono/routes/mcp.d.ts.map +1 -1
- package/dist/hono/routes/mcp.js +263 -225
- 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 +189 -191
- package/dist/hono/routes/messages.d.ts +3900 -12
- package/dist/hono/routes/messages.d.ts.map +1 -1
- package/dist/hono/routes/messages.js +192 -191
- package/dist/hono/routes/models.cjs +106 -64
- package/dist/hono/routes/models.d.ts +2875 -2
- 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 +136 -109
- package/dist/hono/routes/prompts.d.ts +2818 -10
- package/dist/hono/routes/prompts.d.ts.map +1 -1
- package/dist/hono/routes/prompts.js +138 -109
- package/dist/hono/routes/queue.cjs +133 -120
- package/dist/hono/routes/queue.d.ts +5240 -11
- package/dist/hono/routes/queue.d.ts.map +1 -1
- package/dist/hono/routes/queue.js +136 -120
- 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 +4198 -22
- 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 +3094 -17
- package/dist/hono/routes/search.d.ts.map +1 -1
- package/dist/hono/routes/search.js +40 -31
- package/dist/hono/routes/sessions.cjs +491 -393
- package/dist/hono/routes/sessions.d.ts +18263 -65
- package/dist/hono/routes/sessions.d.ts.map +1 -1
- package/dist/hono/routes/sessions.js +497 -395
- 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 +1755 -6
- package/dist/hono/routes/tools.d.ts.map +1 -1
- package/dist/hono/routes/tools.js +33 -33
- package/dist/hono/routes/webhooks.cjs +115 -123
- package/dist/hono/routes/webhooks.d.ts +2501 -11
- package/dist/hono/routes/webhooks.d.ts.map +1 -1
- package/dist/hono/routes/webhooks.js +120 -124
- 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 +463 -260
- package/dist/hono/schemas/responses.d.ts +1893 -209
- package/dist/hono/schemas/responses.d.ts.map +1 -1
- package/dist/hono/schemas/responses.js +203 -14
- package/dist/hono/start-server.cjs +9 -0
- package/dist/hono/start-server.d.ts.map +1 -1
- package/dist/hono/start-server.js +9 -0
- package/dist/hono/types.d.ts +11 -0
- package/dist/hono/types.d.ts.map +1 -1
- package/dist/index.cjs +5 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhooks.d.ts","sourceRoot":"","sources":["../../../src/hono/routes/webhooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,
|
|
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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,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 {
|
|
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.
|
|
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
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
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
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
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(
|
|
164
|
-
|
|
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
|
-
|
|
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:
|