@dexto/server 1.7.2 → 1.8.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.
- package/dist/approval/manual-approval-handler.d.ts +1 -1
- package/dist/hono/index.cjs +13 -3
- package/dist/hono/index.d.ts +2 -1
- package/dist/hono/index.d.ts.map +1 -1
- package/dist/hono/index.js +13 -3
- package/dist/hono/routes/approvals.cjs +1 -1
- package/dist/hono/routes/approvals.js +1 -1
- package/dist/hono/routes/discovery.cjs +18 -22
- package/dist/hono/routes/discovery.d.ts +8 -33
- package/dist/hono/routes/discovery.d.ts.map +1 -1
- package/dist/hono/routes/discovery.js +18 -22
- package/dist/hono/routes/messages.cjs +21 -12
- package/dist/hono/routes/messages.d.ts.map +1 -1
- package/dist/hono/routes/messages.js +21 -12
- package/dist/hono/routes/prompts.d.ts +0 -45
- package/dist/hono/routes/prompts.d.ts.map +1 -1
- package/dist/hono/routes/queue.cjs +193 -82
- package/dist/hono/routes/queue.d.ts +2456 -21
- package/dist/hono/routes/queue.d.ts.map +1 -1
- package/dist/hono/routes/queue.js +193 -82
- package/dist/hono/routes/sessions.cjs +13 -14
- package/dist/hono/routes/sessions.d.ts.map +1 -1
- package/dist/hono/routes/sessions.js +13 -14
- package/dist/hono/routes/skills.cjs +116 -0
- package/dist/hono/routes/skills.d.ts +602 -0
- package/dist/hono/routes/skills.d.ts.map +1 -0
- package/dist/hono/routes/skills.js +97 -0
- package/dist/hono/routes/static.cjs +6 -1
- package/dist/hono/routes/static.d.ts +1 -1
- package/dist/hono/routes/static.d.ts.map +1 -1
- package/dist/hono/routes/static.js +6 -1
- package/dist/hono/schemas/responses.cjs +13 -13
- package/dist/hono/schemas/responses.d.ts +13 -18
- package/dist/hono/schemas/responses.d.ts.map +1 -1
- package/dist/hono/schemas/responses.js +11 -13
- package/package.json +7 -7
|
@@ -44,16 +44,7 @@ declare const listRoute: {
|
|
|
44
44
|
description: z.ZodOptional<z.ZodString>;
|
|
45
45
|
required: z.ZodOptional<z.ZodBoolean>;
|
|
46
46
|
}, z.core.$strict>>>;
|
|
47
|
-
disableModelInvocation: z.ZodOptional<z.ZodBoolean>;
|
|
48
47
|
userInvocable: z.ZodOptional<z.ZodBoolean>;
|
|
49
|
-
allowedTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
50
|
-
toolkits: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
51
|
-
model: z.ZodOptional<z.ZodString>;
|
|
52
|
-
context: z.ZodOptional<z.ZodEnum<{
|
|
53
|
-
inline: "inline";
|
|
54
|
-
fork: "fork";
|
|
55
|
-
}>>;
|
|
56
|
-
agent: z.ZodOptional<z.ZodString>;
|
|
57
48
|
source: z.ZodEnum<{
|
|
58
49
|
mcp: "mcp";
|
|
59
50
|
custom: "custom";
|
|
@@ -302,16 +293,7 @@ declare const createCustomRoute: {
|
|
|
302
293
|
description: z.ZodOptional<z.ZodString>;
|
|
303
294
|
required: z.ZodOptional<z.ZodBoolean>;
|
|
304
295
|
}, z.core.$strict>>>;
|
|
305
|
-
disableModelInvocation: z.ZodOptional<z.ZodBoolean>;
|
|
306
296
|
userInvocable: z.ZodOptional<z.ZodBoolean>;
|
|
307
|
-
allowedTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
308
|
-
toolkits: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
309
|
-
model: z.ZodOptional<z.ZodString>;
|
|
310
|
-
context: z.ZodOptional<z.ZodEnum<{
|
|
311
|
-
inline: "inline";
|
|
312
|
-
fork: "fork";
|
|
313
|
-
}>>;
|
|
314
|
-
agent: z.ZodOptional<z.ZodString>;
|
|
315
297
|
source: z.ZodEnum<{
|
|
316
298
|
mcp: "mcp";
|
|
317
299
|
custom: "custom";
|
|
@@ -694,16 +676,7 @@ declare const getPromptRoute: {
|
|
|
694
676
|
description: z.ZodOptional<z.ZodString>;
|
|
695
677
|
required: z.ZodOptional<z.ZodBoolean>;
|
|
696
678
|
}, z.core.$strict>>>;
|
|
697
|
-
disableModelInvocation: z.ZodOptional<z.ZodBoolean>;
|
|
698
679
|
userInvocable: z.ZodOptional<z.ZodBoolean>;
|
|
699
|
-
allowedTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
700
|
-
toolkits: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
701
|
-
model: z.ZodOptional<z.ZodString>;
|
|
702
|
-
context: z.ZodOptional<z.ZodEnum<{
|
|
703
|
-
inline: "inline";
|
|
704
|
-
fork: "fork";
|
|
705
|
-
}>>;
|
|
706
|
-
agent: z.ZodOptional<z.ZodString>;
|
|
707
680
|
}, z.core.$strict>;
|
|
708
681
|
}, z.core.$strict>;
|
|
709
682
|
};
|
|
@@ -1056,13 +1029,7 @@ export declare function createPromptsRouter(getAgent: GetAgentFn): OpenAPIHono<i
|
|
|
1056
1029
|
description?: string | undefined;
|
|
1057
1030
|
required?: boolean | undefined;
|
|
1058
1031
|
}[] | undefined;
|
|
1059
|
-
disableModelInvocation?: boolean | undefined;
|
|
1060
1032
|
userInvocable?: boolean | undefined;
|
|
1061
|
-
allowedTools?: string[] | undefined;
|
|
1062
|
-
toolkits?: string[] | undefined;
|
|
1063
|
-
model?: string | undefined;
|
|
1064
|
-
context?: "inline" | "fork" | undefined;
|
|
1065
|
-
agent?: string | undefined;
|
|
1066
1033
|
displayName?: string | undefined;
|
|
1067
1034
|
commandName?: string | undefined;
|
|
1068
1035
|
metadata?: {
|
|
@@ -1198,13 +1165,7 @@ export declare function createPromptsRouter(getAgent: GetAgentFn): OpenAPIHono<i
|
|
|
1198
1165
|
description?: string | undefined;
|
|
1199
1166
|
required?: boolean | undefined;
|
|
1200
1167
|
}[] | undefined;
|
|
1201
|
-
disableModelInvocation?: boolean | undefined;
|
|
1202
1168
|
userInvocable?: boolean | undefined;
|
|
1203
|
-
allowedTools?: string[] | undefined;
|
|
1204
|
-
toolkits?: string[] | undefined;
|
|
1205
|
-
model?: string | undefined;
|
|
1206
|
-
context?: "inline" | "fork" | undefined;
|
|
1207
|
-
agent?: string | undefined;
|
|
1208
1169
|
displayName?: string | undefined;
|
|
1209
1170
|
commandName?: string | undefined;
|
|
1210
1171
|
metadata?: {
|
|
@@ -1280,13 +1241,7 @@ export declare function createPromptsRouter(getAgent: GetAgentFn): OpenAPIHono<i
|
|
|
1280
1241
|
description?: string | undefined;
|
|
1281
1242
|
required?: boolean | undefined;
|
|
1282
1243
|
}[] | undefined;
|
|
1283
|
-
disableModelInvocation?: boolean | undefined;
|
|
1284
1244
|
userInvocable?: boolean | undefined;
|
|
1285
|
-
allowedTools?: string[] | undefined;
|
|
1286
|
-
toolkits?: string[] | undefined;
|
|
1287
|
-
model?: string | undefined;
|
|
1288
|
-
context?: "inline" | "fork" | undefined;
|
|
1289
|
-
agent?: string | undefined;
|
|
1290
1245
|
};
|
|
1291
1246
|
};
|
|
1292
1247
|
outputFormat: "json";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../../src/hono/routes/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAe,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAShE,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAElE,QAAA,MAAM,yBAAyB;;;;;;;;;;;;;;;kBA+C6D,CAAC;AAE7F,QAAA,MAAM,qBAAqB;;iBAI0B,CAAC;AAEtD,QAAA,MAAM,wBAAwB;;;iBAQkC,CAAC;AAuCjE,QAAA,MAAM,SAAS
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../../src/hono/routes/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAe,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAShE,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAElE,QAAA,MAAM,yBAAyB;;;;;;;;;;;;;;;kBA+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kBAAkB,CAC9C,OAAO,kBAAkB,EACzB,oBAAoB,GAAG;IAAE,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAA;CAAE,CAC7E,CAAC;AAEF,MAAM,MAAM,mBAAmB,GACzB,eAAe,GACf,uBAAuB,GACvB,uBAAuB,GACvB,oBAAoB,GACpB,wBAAwB,CAAC"}
|
|
@@ -37,13 +37,13 @@ const QueueMessageBodySchema = import_zod_openapi.z.object({
|
|
|
37
37
|
}).describe("Request body for queueing a message");
|
|
38
38
|
const GetQueueResponseSchema = import_zod_openapi.z.object({
|
|
39
39
|
messages: import_zod_openapi.z.array(QueuedMessageSchema).describe("Queued messages"),
|
|
40
|
-
count: import_zod_openapi.z.number().describe("Number of messages
|
|
41
|
-
}).strict().describe("Get
|
|
40
|
+
count: import_zod_openapi.z.number().describe("Number of queued messages")
|
|
41
|
+
}).strict().describe("Get queued messages response");
|
|
42
42
|
const QueueMessageResponseSchema = import_zod_openapi.z.object({
|
|
43
43
|
queued: import_zod_openapi.z.literal(true).describe("Indicates message was queued"),
|
|
44
44
|
id: import_zod_openapi.z.string().describe("ID of the queued message"),
|
|
45
45
|
position: import_zod_openapi.z.number().describe("Position in the queue (1-based)")
|
|
46
|
-
}).strict().describe("
|
|
46
|
+
}).strict().describe("Queued message response");
|
|
47
47
|
const RemoveQueuedMessageResponseSchema = import_zod_openapi.z.object({
|
|
48
48
|
removed: import_zod_openapi.z.literal(true).describe("Indicates message was removed"),
|
|
49
49
|
id: import_zod_openapi.z.string().describe("ID of the removed message")
|
|
@@ -51,7 +51,7 @@ const RemoveQueuedMessageResponseSchema = import_zod_openapi.z.object({
|
|
|
51
51
|
const ClearQueueResponseSchema = import_zod_openapi.z.object({
|
|
52
52
|
cleared: import_zod_openapi.z.literal(true).describe("Indicates queue was cleared"),
|
|
53
53
|
count: import_zod_openapi.z.number().describe("Number of messages that were removed")
|
|
54
|
-
}).strict().describe("Clear
|
|
54
|
+
}).strict().describe("Clear queued messages response");
|
|
55
55
|
const QueueSessionParamSchema = import_zod_openapi.z.object({
|
|
56
56
|
sessionId: import_zod_openapi.z.string().min(1).describe("Session ID")
|
|
57
57
|
}).describe("Queue session params");
|
|
@@ -59,23 +59,17 @@ const QueueMessageParamSchema = import_zod_openapi.z.object({
|
|
|
59
59
|
sessionId: import_zod_openapi.z.string().min(1).describe("Session ID"),
|
|
60
60
|
messageId: import_zod_openapi.z.string().min(1).describe("ID of the queued message to remove")
|
|
61
61
|
}).describe("Queue message identifier params");
|
|
62
|
-
const
|
|
62
|
+
const getSteerRoute = (0, import_zod_openapi.createRoute)({
|
|
63
63
|
method: "get",
|
|
64
|
-
path: "/
|
|
65
|
-
summary: "Get
|
|
66
|
-
description: "Returns
|
|
67
|
-
tags: ["
|
|
68
|
-
request: {
|
|
69
|
-
params: QueueSessionParamSchema
|
|
70
|
-
},
|
|
64
|
+
path: "/steer/{sessionId}",
|
|
65
|
+
summary: "Get steer messages",
|
|
66
|
+
description: "Returns active-turn steer messages waiting for the next executor boundary",
|
|
67
|
+
tags: ["steer"],
|
|
68
|
+
request: { params: QueueSessionParamSchema },
|
|
71
69
|
responses: {
|
|
72
70
|
200: {
|
|
73
|
-
description: "List of
|
|
74
|
-
content: {
|
|
75
|
-
"application/json": {
|
|
76
|
-
schema: GetQueueResponseSchema
|
|
77
|
-
}
|
|
78
|
-
}
|
|
71
|
+
description: "List of steer messages",
|
|
72
|
+
content: { "application/json": { schema: GetQueueResponseSchema } }
|
|
79
73
|
},
|
|
80
74
|
404: {
|
|
81
75
|
description: "Session not found",
|
|
@@ -85,26 +79,20 @@ const getQueueRoute = (0, import_zod_openapi.createRoute)({
|
|
|
85
79
|
500: import_responses.InternalErrorResponse
|
|
86
80
|
}
|
|
87
81
|
});
|
|
88
|
-
const
|
|
82
|
+
const steerRoute = (0, import_zod_openapi.createRoute)({
|
|
89
83
|
method: "post",
|
|
90
|
-
path: "/
|
|
91
|
-
summary: "Queue
|
|
92
|
-
description: "Adds a message to
|
|
93
|
-
tags: ["
|
|
84
|
+
path: "/steer/{sessionId}",
|
|
85
|
+
summary: "Queue active-turn steer input",
|
|
86
|
+
description: "Adds a message to be injected into the current active turn",
|
|
87
|
+
tags: ["steer"],
|
|
94
88
|
request: {
|
|
95
89
|
params: QueueSessionParamSchema,
|
|
96
|
-
body: {
|
|
97
|
-
content: { "application/json": { schema: QueueMessageBodySchema } }
|
|
98
|
-
}
|
|
90
|
+
body: { content: { "application/json": { schema: QueueMessageBodySchema } } }
|
|
99
91
|
},
|
|
100
92
|
responses: {
|
|
101
93
|
201: {
|
|
102
|
-
description: "
|
|
103
|
-
content: {
|
|
104
|
-
"application/json": {
|
|
105
|
-
schema: QueueMessageResponseSchema
|
|
106
|
-
}
|
|
107
|
-
}
|
|
94
|
+
description: "Steer message queued successfully",
|
|
95
|
+
content: { "application/json": { schema: QueueMessageResponseSchema } }
|
|
108
96
|
},
|
|
109
97
|
404: {
|
|
110
98
|
description: "Session not found",
|
|
@@ -114,23 +102,17 @@ const queueMessageRoute = (0, import_zod_openapi.createRoute)({
|
|
|
114
102
|
500: import_responses.InternalErrorResponse
|
|
115
103
|
}
|
|
116
104
|
});
|
|
117
|
-
const
|
|
105
|
+
const removeSteerRoute = (0, import_zod_openapi.createRoute)({
|
|
118
106
|
method: "delete",
|
|
119
|
-
path: "/
|
|
120
|
-
summary: "Remove
|
|
121
|
-
description: "Removes a specific
|
|
122
|
-
tags: ["
|
|
123
|
-
request: {
|
|
124
|
-
params: QueueMessageParamSchema
|
|
125
|
-
},
|
|
107
|
+
path: "/steer/{sessionId}/{messageId}",
|
|
108
|
+
summary: "Remove steer message",
|
|
109
|
+
description: "Removes a specific active-turn steer message",
|
|
110
|
+
tags: ["steer"],
|
|
111
|
+
request: { params: QueueMessageParamSchema },
|
|
126
112
|
responses: {
|
|
127
113
|
200: {
|
|
128
|
-
description: "
|
|
129
|
-
content: {
|
|
130
|
-
"application/json": {
|
|
131
|
-
schema: RemoveQueuedMessageResponseSchema
|
|
132
|
-
}
|
|
133
|
-
}
|
|
114
|
+
description: "Steer message removed successfully",
|
|
115
|
+
content: { "application/json": { schema: RemoveQueuedMessageResponseSchema } }
|
|
134
116
|
},
|
|
135
117
|
404: {
|
|
136
118
|
description: "Session or message not found",
|
|
@@ -140,23 +122,100 @@ const removeQueuedMessageRoute = (0, import_zod_openapi.createRoute)({
|
|
|
140
122
|
500: import_responses.InternalErrorResponse
|
|
141
123
|
}
|
|
142
124
|
});
|
|
143
|
-
const
|
|
125
|
+
const clearSteerRoute = (0, import_zod_openapi.createRoute)({
|
|
144
126
|
method: "delete",
|
|
145
|
-
path: "/
|
|
146
|
-
summary: "Clear
|
|
147
|
-
description: "Removes all
|
|
148
|
-
tags: ["
|
|
127
|
+
path: "/steer/{sessionId}",
|
|
128
|
+
summary: "Clear steer queue",
|
|
129
|
+
description: "Removes all active-turn steer messages for a session",
|
|
130
|
+
tags: ["steer"],
|
|
131
|
+
request: { params: QueueSessionParamSchema },
|
|
132
|
+
responses: {
|
|
133
|
+
200: {
|
|
134
|
+
description: "Steer queue cleared successfully",
|
|
135
|
+
content: { "application/json": { schema: ClearQueueResponseSchema } }
|
|
136
|
+
},
|
|
137
|
+
404: {
|
|
138
|
+
description: "Session not found",
|
|
139
|
+
content: { "application/json": { schema: import_responses.ApiErrorResponseSchema } }
|
|
140
|
+
},
|
|
141
|
+
400: import_responses.BadRequestErrorResponse,
|
|
142
|
+
500: import_responses.InternalErrorResponse
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
const getFollowUpRoute = (0, import_zod_openapi.createRoute)({
|
|
146
|
+
method: "get",
|
|
147
|
+
path: "/follow-up/{sessionId}",
|
|
148
|
+
summary: "Get follow-up messages",
|
|
149
|
+
description: "Returns queued follow-up messages that will run after the active turn stops",
|
|
150
|
+
tags: ["follow-up"],
|
|
151
|
+
request: { params: QueueSessionParamSchema },
|
|
152
|
+
responses: {
|
|
153
|
+
200: {
|
|
154
|
+
description: "List of follow-up messages",
|
|
155
|
+
content: { "application/json": { schema: GetQueueResponseSchema } }
|
|
156
|
+
},
|
|
157
|
+
404: {
|
|
158
|
+
description: "Session not found",
|
|
159
|
+
content: { "application/json": { schema: import_responses.ApiErrorResponseSchema } }
|
|
160
|
+
},
|
|
161
|
+
400: import_responses.BadRequestErrorResponse,
|
|
162
|
+
500: import_responses.InternalErrorResponse
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
const followUpRoute = (0, import_zod_openapi.createRoute)({
|
|
166
|
+
method: "post",
|
|
167
|
+
path: "/follow-up/{sessionId}",
|
|
168
|
+
summary: "Queue follow-up input",
|
|
169
|
+
description: "Adds a message to run as a follow-up after the active turn stops",
|
|
170
|
+
tags: ["follow-up"],
|
|
149
171
|
request: {
|
|
150
|
-
params: QueueSessionParamSchema
|
|
172
|
+
params: QueueSessionParamSchema,
|
|
173
|
+
body: { content: { "application/json": { schema: QueueMessageBodySchema } } }
|
|
151
174
|
},
|
|
175
|
+
responses: {
|
|
176
|
+
201: {
|
|
177
|
+
description: "Follow-up message queued successfully",
|
|
178
|
+
content: { "application/json": { schema: QueueMessageResponseSchema } }
|
|
179
|
+
},
|
|
180
|
+
404: {
|
|
181
|
+
description: "Session not found",
|
|
182
|
+
content: { "application/json": { schema: import_responses.ApiErrorResponseSchema } }
|
|
183
|
+
},
|
|
184
|
+
400: import_responses.BadRequestErrorResponse,
|
|
185
|
+
500: import_responses.InternalErrorResponse
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
const removeFollowUpRoute = (0, import_zod_openapi.createRoute)({
|
|
189
|
+
method: "delete",
|
|
190
|
+
path: "/follow-up/{sessionId}/{messageId}",
|
|
191
|
+
summary: "Remove follow-up message",
|
|
192
|
+
description: "Removes a specific queued follow-up message",
|
|
193
|
+
tags: ["follow-up"],
|
|
194
|
+
request: { params: QueueMessageParamSchema },
|
|
195
|
+
responses: {
|
|
196
|
+
200: {
|
|
197
|
+
description: "Follow-up message removed successfully",
|
|
198
|
+
content: { "application/json": { schema: RemoveQueuedMessageResponseSchema } }
|
|
199
|
+
},
|
|
200
|
+
404: {
|
|
201
|
+
description: "Session or message not found",
|
|
202
|
+
content: { "application/json": { schema: import_responses.ApiErrorResponseSchema } }
|
|
203
|
+
},
|
|
204
|
+
400: import_responses.BadRequestErrorResponse,
|
|
205
|
+
500: import_responses.InternalErrorResponse
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
const clearFollowUpRoute = (0, import_zod_openapi.createRoute)({
|
|
209
|
+
method: "delete",
|
|
210
|
+
path: "/follow-up/{sessionId}",
|
|
211
|
+
summary: "Clear follow-up queue",
|
|
212
|
+
description: "Removes all queued follow-up messages for a session",
|
|
213
|
+
tags: ["follow-up"],
|
|
214
|
+
request: { params: QueueSessionParamSchema },
|
|
152
215
|
responses: {
|
|
153
216
|
200: {
|
|
154
|
-
description: "
|
|
155
|
-
content: {
|
|
156
|
-
"application/json": {
|
|
157
|
-
schema: ClearQueueResponseSchema
|
|
158
|
-
}
|
|
159
|
-
}
|
|
217
|
+
description: "Follow-up queue cleared successfully",
|
|
218
|
+
content: { "application/json": { schema: ClearQueueResponseSchema } }
|
|
160
219
|
},
|
|
161
220
|
404: {
|
|
162
221
|
description: "Session not found",
|
|
@@ -166,19 +225,78 @@ const clearQueueRoute = (0, import_zod_openapi.createRoute)({
|
|
|
166
225
|
500: import_responses.InternalErrorResponse
|
|
167
226
|
}
|
|
168
227
|
});
|
|
228
|
+
function toQueueResponseMessage(message) {
|
|
229
|
+
return {
|
|
230
|
+
id: message.id,
|
|
231
|
+
content: message.content.map(import_responses.toApiContentPart),
|
|
232
|
+
queuedAt: message.queuedAt,
|
|
233
|
+
...message.metadata !== void 0 ? { metadata: message.metadata } : {},
|
|
234
|
+
...message.kind !== void 0 ? { kind: message.kind } : {}
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
function messageNotFound(sessionId, messageId, scope) {
|
|
238
|
+
return new import_core.DextoRuntimeError(
|
|
239
|
+
`${scope}_message_not_found`,
|
|
240
|
+
scope,
|
|
241
|
+
import_core.ErrorType.NOT_FOUND,
|
|
242
|
+
"Message not found in queue",
|
|
243
|
+
{ sessionId, messageId }
|
|
244
|
+
);
|
|
245
|
+
}
|
|
169
246
|
function createQueueRouter(getAgent) {
|
|
170
247
|
const app = new import_zod_openapi.OpenAPIHono();
|
|
171
|
-
return app.openapi(
|
|
248
|
+
return app.openapi(getSteerRoute, async (ctx) => {
|
|
249
|
+
const agent = await getAgent(ctx);
|
|
250
|
+
const { sessionId } = ctx.req.valid("param");
|
|
251
|
+
const responseMessages = (await agent.getSteerMessages(sessionId)).map(
|
|
252
|
+
toQueueResponseMessage
|
|
253
|
+
);
|
|
254
|
+
return ctx.json(
|
|
255
|
+
GetQueueResponseSchema.parse({
|
|
256
|
+
messages: responseMessages,
|
|
257
|
+
count: responseMessages.length
|
|
258
|
+
}),
|
|
259
|
+
200
|
|
260
|
+
);
|
|
261
|
+
}).openapi(steerRoute, async (ctx) => {
|
|
262
|
+
const agent = await getAgent(ctx);
|
|
263
|
+
const { sessionId } = ctx.req.valid("param");
|
|
264
|
+
const { content: rawContent, kind } = ctx.req.valid("json");
|
|
265
|
+
const content = (0, import_responses.toContentInput)(rawContent);
|
|
266
|
+
const result = await agent.steer(sessionId, {
|
|
267
|
+
content,
|
|
268
|
+
...kind !== void 0 && { kind }
|
|
269
|
+
});
|
|
270
|
+
return ctx.json(
|
|
271
|
+
QueueMessageResponseSchema.parse({
|
|
272
|
+
queued: true,
|
|
273
|
+
id: result.id,
|
|
274
|
+
position: result.position
|
|
275
|
+
}),
|
|
276
|
+
201
|
|
277
|
+
);
|
|
278
|
+
}).openapi(removeSteerRoute, async (ctx) => {
|
|
279
|
+
const agent = await getAgent(ctx);
|
|
280
|
+
const { sessionId, messageId } = ctx.req.valid("param");
|
|
281
|
+
const removed = await agent.removeSteerMessage(sessionId, messageId);
|
|
282
|
+
if (!removed) {
|
|
283
|
+
throw messageNotFound(sessionId, messageId, "steer");
|
|
284
|
+
}
|
|
285
|
+
return ctx.json(
|
|
286
|
+
RemoveQueuedMessageResponseSchema.parse({ removed: true, id: messageId }),
|
|
287
|
+
200
|
|
288
|
+
);
|
|
289
|
+
}).openapi(clearSteerRoute, async (ctx) => {
|
|
172
290
|
const agent = await getAgent(ctx);
|
|
173
291
|
const { sessionId } = ctx.req.valid("param");
|
|
174
|
-
const
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
292
|
+
const count = await agent.clearSteerQueue(sessionId);
|
|
293
|
+
return ctx.json(ClearQueueResponseSchema.parse({ cleared: true, count }), 200);
|
|
294
|
+
}).openapi(getFollowUpRoute, async (ctx) => {
|
|
295
|
+
const agent = await getAgent(ctx);
|
|
296
|
+
const { sessionId } = ctx.req.valid("param");
|
|
297
|
+
const responseMessages = (await agent.getFollowUpMessages(sessionId)).map(
|
|
298
|
+
toQueueResponseMessage
|
|
299
|
+
);
|
|
182
300
|
return ctx.json(
|
|
183
301
|
GetQueueResponseSchema.parse({
|
|
184
302
|
messages: responseMessages,
|
|
@@ -186,13 +304,12 @@ function createQueueRouter(getAgent) {
|
|
|
186
304
|
}),
|
|
187
305
|
200
|
|
188
306
|
);
|
|
189
|
-
}).openapi(
|
|
307
|
+
}).openapi(followUpRoute, async (ctx) => {
|
|
190
308
|
const agent = await getAgent(ctx);
|
|
191
309
|
const { sessionId } = ctx.req.valid("param");
|
|
192
|
-
const { content: rawContent } = ctx.req.valid("json");
|
|
310
|
+
const { content: rawContent, kind } = ctx.req.valid("json");
|
|
193
311
|
const content = (0, import_responses.toContentInput)(rawContent);
|
|
194
|
-
const
|
|
195
|
-
const result = await agent.queueMessage(sessionId, {
|
|
312
|
+
const result = await agent.followUp(sessionId, {
|
|
196
313
|
content,
|
|
197
314
|
...kind !== void 0 && { kind }
|
|
198
315
|
});
|
|
@@ -204,27 +321,21 @@ function createQueueRouter(getAgent) {
|
|
|
204
321
|
}),
|
|
205
322
|
201
|
|
206
323
|
);
|
|
207
|
-
}).openapi(
|
|
324
|
+
}).openapi(removeFollowUpRoute, async (ctx) => {
|
|
208
325
|
const agent = await getAgent(ctx);
|
|
209
326
|
const { sessionId, messageId } = ctx.req.valid("param");
|
|
210
|
-
const removed = await agent.
|
|
327
|
+
const removed = await agent.removeFollowUpMessage(sessionId, messageId);
|
|
211
328
|
if (!removed) {
|
|
212
|
-
throw
|
|
213
|
-
"queued_message_not_found",
|
|
214
|
-
"queue",
|
|
215
|
-
import_core.ErrorType.NOT_FOUND,
|
|
216
|
-
"Message not found in queue",
|
|
217
|
-
{ sessionId, messageId }
|
|
218
|
-
);
|
|
329
|
+
throw messageNotFound(sessionId, messageId, "follow_up");
|
|
219
330
|
}
|
|
220
331
|
return ctx.json(
|
|
221
332
|
RemoveQueuedMessageResponseSchema.parse({ removed: true, id: messageId }),
|
|
222
333
|
200
|
|
223
334
|
);
|
|
224
|
-
}).openapi(
|
|
335
|
+
}).openapi(clearFollowUpRoute, async (ctx) => {
|
|
225
336
|
const agent = await getAgent(ctx);
|
|
226
337
|
const { sessionId } = ctx.req.valid("param");
|
|
227
|
-
const count = await agent.
|
|
338
|
+
const count = await agent.clearFollowUpQueue(sessionId);
|
|
228
339
|
return ctx.json(ClearQueueResponseSchema.parse({ cleared: true, count }), 200);
|
|
229
340
|
});
|
|
230
341
|
}
|