@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.
- 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 -4531
- 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 +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 +381 -348
- package/dist/hono/routes/llm.d.ts +12136 -86
- package/dist/hono/routes/llm.d.ts.map +1 -1
- package/dist/hono/routes/llm.js +385 -348
- 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 +147 -139
- package/dist/hono/routes/messages.d.ts +3900 -11
- package/dist/hono/routes/messages.d.ts.map +1 -1
- package/dist/hono/routes/messages.js +150 -139
- 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 +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 +5144 -9
- 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 +1982 -4
- 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 +2835 -12
- package/dist/hono/routes/search.d.ts.map +1 -1
- package/dist/hono/routes/search.js +40 -31
- package/dist/hono/routes/sessions.cjs +403 -396
- package/dist/hono/routes/sessions.d.ts +16582 -27
- package/dist/hono/routes/sessions.d.ts.map +1 -1
- package/dist/hono/routes/sessions.js +407 -397
- 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 +406 -259
- package/dist/hono/schemas/responses.d.ts +1246 -123
- package/dist/hono/schemas/responses.d.ts.map +1 -1
- package/dist/hono/schemas/responses.js +144 -10
- package/dist/hono/types.d.ts +11 -0
- package/dist/hono/types.d.ts.map +1 -1
- package/package.json +7 -7
|
@@ -68,423 +68,412 @@ function mapSessionMetadata(sessionId, metadata, defaults) {
|
|
|
68
68
|
parentSessionId: metadata?.parentSessionId ?? defaults?.parentSessionId ?? null
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
)
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
app.onError((err, ctx) => (0, import_error.handleHonoError)(ctx, err));
|
|
90
|
-
const listRoute = (0, import_zod_openapi.createRoute)({
|
|
91
|
-
method: "get",
|
|
92
|
-
path: "/sessions",
|
|
93
|
-
summary: "List Sessions",
|
|
94
|
-
description: "Retrieves a list of all active sessions",
|
|
95
|
-
tags: ["sessions"],
|
|
96
|
-
responses: {
|
|
97
|
-
200: {
|
|
98
|
-
description: "List of all active sessions",
|
|
99
|
-
content: {
|
|
100
|
-
"application/json": {
|
|
101
|
-
schema: import_zod_openapi.z.object({
|
|
102
|
-
sessions: import_zod_openapi.z.array(import_responses.SessionMetadataSchema).describe("Array of session metadata objects")
|
|
103
|
-
}).strict()
|
|
104
|
-
}
|
|
71
|
+
const listRoute = (0, import_zod_openapi.createRoute)({
|
|
72
|
+
method: "get",
|
|
73
|
+
path: "/sessions",
|
|
74
|
+
summary: "List Sessions",
|
|
75
|
+
description: "Retrieves a list of all active sessions",
|
|
76
|
+
tags: ["sessions"],
|
|
77
|
+
responses: {
|
|
78
|
+
200: {
|
|
79
|
+
description: "List of all active sessions",
|
|
80
|
+
content: {
|
|
81
|
+
"application/json": {
|
|
82
|
+
schema: import_zod_openapi.z.object({
|
|
83
|
+
sessions: import_zod_openapi.z.array(import_responses.SessionMetadataSchema).describe("Array of session metadata objects")
|
|
84
|
+
}).strict()
|
|
105
85
|
}
|
|
106
86
|
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
87
|
+
},
|
|
88
|
+
400: import_responses.BadRequestErrorResponse,
|
|
89
|
+
500: import_responses.InternalErrorResponse
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
const createRouteDef = (0, import_zod_openapi.createRoute)({
|
|
93
|
+
method: "post",
|
|
94
|
+
path: "/sessions",
|
|
95
|
+
summary: "Create Session",
|
|
96
|
+
description: "Creates a new session",
|
|
97
|
+
tags: ["sessions"],
|
|
98
|
+
request: { body: { content: { "application/json": { schema: CreateSessionSchema } } } },
|
|
99
|
+
responses: {
|
|
100
|
+
201: {
|
|
101
|
+
description: "Session created successfully",
|
|
102
|
+
content: {
|
|
103
|
+
"application/json": {
|
|
104
|
+
schema: import_zod_openapi.z.object({
|
|
105
|
+
session: import_responses.SessionMetadataSchema.describe(
|
|
106
|
+
"Newly created session metadata"
|
|
107
|
+
)
|
|
108
|
+
}).strict()
|
|
127
109
|
}
|
|
128
110
|
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
111
|
+
},
|
|
112
|
+
400: import_responses.BadRequestErrorResponse,
|
|
113
|
+
500: import_responses.InternalErrorResponse
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
const getRoute = (0, import_zod_openapi.createRoute)({
|
|
117
|
+
method: "get",
|
|
118
|
+
path: "/sessions/{sessionId}",
|
|
119
|
+
summary: "Get Session Details",
|
|
120
|
+
description: "Fetches details for a specific session",
|
|
121
|
+
tags: ["sessions"],
|
|
122
|
+
request: { params: import_zod_openapi.z.object({ sessionId: import_zod_openapi.z.string().describe("Session identifier") }) },
|
|
123
|
+
responses: {
|
|
124
|
+
200: {
|
|
125
|
+
description: "Session details with metadata",
|
|
126
|
+
content: {
|
|
127
|
+
"application/json": {
|
|
128
|
+
schema: import_zod_openapi.z.object({
|
|
129
|
+
session: import_responses.SessionMetadataSchema.extend({
|
|
130
|
+
history: import_zod_openapi.z.number().int().nonnegative().describe("Number of messages in history")
|
|
131
|
+
}).strict().describe("Session metadata with history count")
|
|
132
|
+
}).strict()
|
|
149
133
|
}
|
|
150
134
|
}
|
|
151
|
-
}
|
|
152
|
-
});
|
|
153
|
-
const forkRoute = (0, import_zod_openapi.createRoute)({
|
|
154
|
-
method: "post",
|
|
155
|
-
path: "/sessions/{sessionId}/fork",
|
|
156
|
-
summary: "Fork Session",
|
|
157
|
-
description: "Creates a new child session by cloning the specified parent session history and metadata lineage.",
|
|
158
|
-
tags: ["sessions"],
|
|
159
|
-
request: {
|
|
160
|
-
params: import_zod_openapi.z.object({
|
|
161
|
-
sessionId: import_zod_openapi.z.string().describe("Parent session identifier")
|
|
162
|
-
})
|
|
163
135
|
},
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
}
|
|
136
|
+
400: import_responses.BadRequestErrorResponse,
|
|
137
|
+
404: import_responses.NotFoundErrorResponse,
|
|
138
|
+
500: import_responses.InternalErrorResponse
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
const forkRoute = (0, import_zod_openapi.createRoute)({
|
|
142
|
+
method: "post",
|
|
143
|
+
path: "/sessions/{sessionId}/fork",
|
|
144
|
+
summary: "Fork Session",
|
|
145
|
+
description: "Creates a new child session by cloning the specified parent session history and metadata lineage.",
|
|
146
|
+
tags: ["sessions"],
|
|
147
|
+
request: {
|
|
148
|
+
params: import_zod_openapi.z.object({
|
|
149
|
+
sessionId: import_zod_openapi.z.string().describe("Parent session identifier")
|
|
150
|
+
})
|
|
151
|
+
},
|
|
152
|
+
responses: {
|
|
153
|
+
201: {
|
|
154
|
+
description: "Forked session created successfully",
|
|
155
|
+
content: {
|
|
156
|
+
"application/json": {
|
|
157
|
+
schema: import_zod_openapi.z.object({
|
|
158
|
+
session: import_responses.SessionMetadataSchema.describe(
|
|
159
|
+
"Newly created child session metadata"
|
|
160
|
+
)
|
|
161
|
+
}).strict()
|
|
191
162
|
}
|
|
192
163
|
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
164
|
+
},
|
|
165
|
+
400: {
|
|
166
|
+
...import_responses.BadRequestErrorResponse
|
|
167
|
+
},
|
|
168
|
+
404: {
|
|
169
|
+
...import_responses.NotFoundErrorResponse
|
|
170
|
+
},
|
|
171
|
+
500: import_responses.InternalErrorResponse
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
const historyRoute = (0, import_zod_openapi.createRoute)({
|
|
175
|
+
method: "get",
|
|
176
|
+
path: "/sessions/{sessionId}/history",
|
|
177
|
+
summary: "Get Session History",
|
|
178
|
+
description: "Retrieves the conversation history for a session along with processing status",
|
|
179
|
+
tags: ["sessions"],
|
|
180
|
+
request: { params: import_zod_openapi.z.object({ sessionId: import_zod_openapi.z.string().describe("Session identifier") }) },
|
|
181
|
+
responses: {
|
|
182
|
+
200: {
|
|
183
|
+
description: "Session conversation history",
|
|
184
|
+
content: {
|
|
185
|
+
"application/json": {
|
|
186
|
+
schema: import_zod_openapi.z.object({
|
|
187
|
+
history: import_zod_openapi.z.array(import_responses.InternalMessageSchema).describe("Array of messages in conversation history"),
|
|
188
|
+
isBusy: import_zod_openapi.z.boolean().describe("Whether the session is currently processing a message")
|
|
189
|
+
}).strict()
|
|
214
190
|
}
|
|
215
191
|
}
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
192
|
+
},
|
|
193
|
+
400: import_responses.BadRequestErrorResponse,
|
|
194
|
+
404: import_responses.NotFoundErrorResponse,
|
|
195
|
+
500: import_responses.InternalErrorResponse
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
const listSessionPromptContributorsRoute = (0, import_zod_openapi.createRoute)({
|
|
199
|
+
method: "get",
|
|
200
|
+
path: "/sessions/{sessionId}/system-prompt/contributors",
|
|
201
|
+
summary: "List Session System Prompt Contributors",
|
|
202
|
+
description: "Lists static system prompt contributors that apply only to the specified session.",
|
|
203
|
+
tags: ["sessions", "config"],
|
|
204
|
+
request: { params: import_zod_openapi.z.object({ sessionId: import_zod_openapi.z.string().describe("Session identifier") }) },
|
|
205
|
+
responses: {
|
|
206
|
+
200: {
|
|
207
|
+
description: "Current session contributor list",
|
|
208
|
+
content: {
|
|
209
|
+
"application/json": {
|
|
210
|
+
schema: import_zod_openapi.z.object({
|
|
211
|
+
contributors: import_zod_openapi.z.array(SessionPromptContributorInfoSchema).describe("Registered session prompt contributors.")
|
|
212
|
+
}).strict()
|
|
234
213
|
}
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
404: {
|
|
217
|
+
...import_responses.NotFoundErrorResponse
|
|
218
|
+
},
|
|
219
|
+
500: import_responses.InternalErrorResponse
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
const upsertSessionPromptContributorRoute = (0, import_zod_openapi.createRoute)({
|
|
223
|
+
method: "post",
|
|
224
|
+
path: "/sessions/{sessionId}/system-prompt/contributors",
|
|
225
|
+
summary: "Upsert Session System Prompt Contributor",
|
|
226
|
+
description: "Adds or updates a static system prompt contributor that applies only to the specified session. Set enabled=false to remove it.",
|
|
227
|
+
tags: ["sessions", "config"],
|
|
228
|
+
request: {
|
|
229
|
+
params: import_zod_openapi.z.object({ sessionId: import_zod_openapi.z.string().describe("Session identifier") }),
|
|
230
|
+
body: {
|
|
231
|
+
required: true,
|
|
232
|
+
content: {
|
|
233
|
+
"application/json": {
|
|
234
|
+
schema: UpsertSessionPromptContributorSchema
|
|
242
235
|
}
|
|
243
236
|
}
|
|
244
237
|
}
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
}
|
|
238
|
+
},
|
|
239
|
+
responses: {
|
|
240
|
+
200: {
|
|
241
|
+
description: "Session contributor upsert result",
|
|
242
|
+
content: {
|
|
243
|
+
"application/json": {
|
|
244
|
+
schema: import_zod_openapi.z.object({
|
|
245
|
+
id: import_zod_openapi.z.string().describe("Contributor identifier"),
|
|
246
|
+
enabled: import_zod_openapi.z.boolean().describe("Whether the contributor remains enabled"),
|
|
247
|
+
priority: import_zod_openapi.z.number().optional().describe("Contributor priority"),
|
|
248
|
+
replaced: import_zod_openapi.z.boolean().optional().describe("Whether an existing contributor was replaced"),
|
|
249
|
+
removed: import_zod_openapi.z.boolean().optional().describe("Whether the contributor was removed"),
|
|
250
|
+
contentLength: import_zod_openapi.z.number().optional().describe("Stored content length in characters"),
|
|
251
|
+
truncated: import_zod_openapi.z.boolean().optional().describe("Whether the submitted content was truncated")
|
|
252
|
+
}).strict()
|
|
260
253
|
}
|
|
261
254
|
}
|
|
262
255
|
},
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
256
|
+
400: {
|
|
257
|
+
...import_responses.BadRequestErrorResponse
|
|
258
|
+
},
|
|
259
|
+
404: {
|
|
260
|
+
...import_responses.NotFoundErrorResponse
|
|
261
|
+
},
|
|
262
|
+
500: import_responses.InternalErrorResponse
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
const deleteRoute = (0, import_zod_openapi.createRoute)({
|
|
266
|
+
method: "delete",
|
|
267
|
+
path: "/sessions/{sessionId}",
|
|
268
|
+
summary: "Delete Session",
|
|
269
|
+
description: "Permanently deletes a session and all its conversation history. This action cannot be undone",
|
|
270
|
+
tags: ["sessions"],
|
|
271
|
+
request: { params: import_zod_openapi.z.object({ sessionId: import_zod_openapi.z.string().describe("Session identifier") }) },
|
|
272
|
+
responses: {
|
|
273
|
+
200: {
|
|
274
|
+
description: "Session deleted successfully",
|
|
275
|
+
content: {
|
|
276
|
+
"application/json": {
|
|
277
|
+
schema: import_zod_openapi.z.object({
|
|
278
|
+
status: import_zod_openapi.z.literal("deleted").describe("Deletion status"),
|
|
279
|
+
sessionId: import_zod_openapi.z.string().describe("ID of the deleted session")
|
|
280
|
+
}).strict()
|
|
278
281
|
}
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
400: import_responses.BadRequestErrorResponse,
|
|
285
|
+
404: import_responses.NotFoundErrorResponse,
|
|
286
|
+
500: import_responses.InternalErrorResponse
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
const cancelRoute = (0, import_zod_openapi.createRoute)({
|
|
290
|
+
method: "post",
|
|
291
|
+
path: "/sessions/{sessionId}/cancel",
|
|
292
|
+
summary: "Cancel Session Run",
|
|
293
|
+
description: "Cancels an in-flight agent run for the specified session. By default (soft cancel), only the current LLM call is cancelled and queued messages continue processing. Set clearQueue=true for hard cancel to also clear any queued messages.",
|
|
294
|
+
tags: ["sessions"],
|
|
295
|
+
request: {
|
|
296
|
+
params: import_zod_openapi.z.object({ sessionId: import_zod_openapi.z.string().describe("Session identifier") }),
|
|
297
|
+
body: {
|
|
298
|
+
content: {
|
|
299
|
+
"application/json": {
|
|
300
|
+
schema: import_zod_openapi.z.object({
|
|
301
|
+
clearQueue: import_zod_openapi.z.boolean().optional().default(false).describe(
|
|
302
|
+
"If true (hard cancel), clears queued messages. If false (soft cancel, default), queued messages continue processing."
|
|
303
|
+
)
|
|
304
|
+
}).strict()
|
|
286
305
|
}
|
|
287
306
|
},
|
|
288
|
-
|
|
289
|
-
description: "Session not found",
|
|
290
|
-
content: {
|
|
291
|
-
"application/json": {
|
|
292
|
-
schema: import_responses.StandardErrorEnvelopeSchema
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
}
|
|
307
|
+
required: false
|
|
296
308
|
}
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
"application/json": {
|
|
310
|
-
schema: import_zod_openapi.z.object({
|
|
311
|
-
status: import_zod_openapi.z.literal("deleted").describe("Deletion status"),
|
|
312
|
-
sessionId: import_zod_openapi.z.string().describe("ID of the deleted session")
|
|
313
|
-
}).strict()
|
|
314
|
-
}
|
|
309
|
+
},
|
|
310
|
+
responses: {
|
|
311
|
+
200: {
|
|
312
|
+
description: "Cancel operation result",
|
|
313
|
+
content: {
|
|
314
|
+
"application/json": {
|
|
315
|
+
schema: import_zod_openapi.z.object({
|
|
316
|
+
cancelled: import_zod_openapi.z.boolean().describe("Whether a run was cancelled"),
|
|
317
|
+
sessionId: import_zod_openapi.z.string().describe("Session ID"),
|
|
318
|
+
queueCleared: import_zod_openapi.z.boolean().describe("Whether queued messages were cleared"),
|
|
319
|
+
clearedCount: import_zod_openapi.z.number().describe("Number of queued messages cleared (0 if soft cancel)")
|
|
320
|
+
}).strict()
|
|
315
321
|
}
|
|
316
322
|
}
|
|
317
|
-
}
|
|
318
|
-
});
|
|
319
|
-
const cancelRoute = (0, import_zod_openapi.createRoute)({
|
|
320
|
-
method: "post",
|
|
321
|
-
path: "/sessions/{sessionId}/cancel",
|
|
322
|
-
summary: "Cancel Session Run",
|
|
323
|
-
description: "Cancels an in-flight agent run for the specified session. By default (soft cancel), only the current LLM call is cancelled and queued messages continue processing. Set clearQueue=true for hard cancel to also clear any queued messages.",
|
|
324
|
-
tags: ["sessions"],
|
|
325
|
-
request: {
|
|
326
|
-
params: import_zod_openapi.z.object({ sessionId: import_zod_openapi.z.string().describe("Session identifier") }),
|
|
327
|
-
body: {
|
|
328
|
-
content: {
|
|
329
|
-
"application/json": {
|
|
330
|
-
schema: import_zod_openapi.z.object({
|
|
331
|
-
clearQueue: import_zod_openapi.z.boolean().optional().default(false).describe(
|
|
332
|
-
"If true (hard cancel), clears queued messages. If false (soft cancel, default), queued messages continue processing."
|
|
333
|
-
)
|
|
334
|
-
}).strict()
|
|
335
|
-
}
|
|
336
|
-
},
|
|
337
|
-
required: false
|
|
338
|
-
}
|
|
339
323
|
},
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
324
|
+
400: import_responses.BadRequestErrorResponse,
|
|
325
|
+
404: import_responses.NotFoundErrorResponse,
|
|
326
|
+
409: import_responses.ConflictErrorResponse,
|
|
327
|
+
500: import_responses.InternalErrorResponse
|
|
328
|
+
}
|
|
329
|
+
});
|
|
330
|
+
const loadRoute = (0, import_zod_openapi.createRoute)({
|
|
331
|
+
method: "get",
|
|
332
|
+
path: "/sessions/{sessionId}/load",
|
|
333
|
+
summary: "Load Session",
|
|
334
|
+
description: "Validates and retrieves session information including processing status. The client should track the active session.",
|
|
335
|
+
tags: ["sessions"],
|
|
336
|
+
request: {
|
|
337
|
+
params: import_zod_openapi.z.object({ sessionId: import_zod_openapi.z.string().describe("Session identifier") })
|
|
338
|
+
},
|
|
339
|
+
responses: {
|
|
340
|
+
200: {
|
|
341
|
+
description: "Session information retrieved successfully",
|
|
342
|
+
content: {
|
|
343
|
+
"application/json": {
|
|
344
|
+
schema: import_zod_openapi.z.object({
|
|
345
|
+
session: import_responses.SessionMetadataSchema.extend({
|
|
346
|
+
isBusy: import_zod_openapi.z.boolean().describe(
|
|
347
|
+
"Whether the session is currently processing a message"
|
|
348
|
+
),
|
|
349
|
+
usageSummary: import_responses.UsageSummarySchema.describe(
|
|
350
|
+
"Exact usage summary derived from assistant message history"
|
|
351
|
+
),
|
|
352
|
+
activeUsageScopeId: import_zod_openapi.z.string().nullable().describe(
|
|
353
|
+
"Current runtime usage scope identifier, if configured"
|
|
354
|
+
),
|
|
355
|
+
activeUsageScope: import_responses.ScopedUsageSummarySchema.nullable().describe(
|
|
356
|
+
"Usage summary for the current runtime scope, if configured"
|
|
351
357
|
)
|
|
352
|
-
}).
|
|
353
|
-
}
|
|
358
|
+
}).describe("Session metadata with processing status")
|
|
359
|
+
}).strict()
|
|
354
360
|
}
|
|
355
361
|
}
|
|
356
|
-
}
|
|
357
|
-
});
|
|
358
|
-
const loadRoute = (0, import_zod_openapi.createRoute)({
|
|
359
|
-
method: "get",
|
|
360
|
-
path: "/sessions/{sessionId}/load",
|
|
361
|
-
summary: "Load Session",
|
|
362
|
-
description: "Validates and retrieves session information including processing status. The client should track the active session.",
|
|
363
|
-
tags: ["sessions"],
|
|
364
|
-
request: {
|
|
365
|
-
params: import_zod_openapi.z.object({ sessionId: import_zod_openapi.z.string().describe("Session identifier") })
|
|
366
362
|
},
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
description: "Session not found",
|
|
393
|
-
content: {
|
|
394
|
-
"application/json": {
|
|
395
|
-
schema: import_zod_openapi.z.object({
|
|
396
|
-
error: import_zod_openapi.z.string().describe("Error message")
|
|
397
|
-
}).strict()
|
|
398
|
-
}
|
|
363
|
+
404: {
|
|
364
|
+
...import_responses.NotFoundErrorResponse
|
|
365
|
+
},
|
|
366
|
+
400: import_responses.BadRequestErrorResponse,
|
|
367
|
+
500: import_responses.InternalErrorResponse
|
|
368
|
+
}
|
|
369
|
+
});
|
|
370
|
+
const clearContextRoute = (0, import_zod_openapi.createRoute)({
|
|
371
|
+
method: "post",
|
|
372
|
+
path: "/sessions/{sessionId}/clear-context",
|
|
373
|
+
summary: "Clear Session Context",
|
|
374
|
+
description: "Clears the model context window for a session while preserving conversation history for review.",
|
|
375
|
+
tags: ["sessions"],
|
|
376
|
+
request: {
|
|
377
|
+
params: import_zod_openapi.z.object({ sessionId: import_zod_openapi.z.string().describe("Session identifier") })
|
|
378
|
+
},
|
|
379
|
+
responses: {
|
|
380
|
+
200: {
|
|
381
|
+
description: "Session context cleared successfully",
|
|
382
|
+
content: {
|
|
383
|
+
"application/json": {
|
|
384
|
+
schema: import_zod_openapi.z.object({
|
|
385
|
+
status: import_zod_openapi.z.literal("context cleared").describe("Context clear status"),
|
|
386
|
+
sessionId: import_zod_openapi.z.string().describe("Session ID")
|
|
387
|
+
}).strict()
|
|
399
388
|
}
|
|
400
389
|
}
|
|
401
|
-
}
|
|
402
|
-
});
|
|
403
|
-
const clearContextRoute = (0, import_zod_openapi.createRoute)({
|
|
404
|
-
method: "post",
|
|
405
|
-
path: "/sessions/{sessionId}/clear-context",
|
|
406
|
-
summary: "Clear Session Context",
|
|
407
|
-
description: "Clears the model context window for a session while preserving conversation history for review.",
|
|
408
|
-
tags: ["sessions"],
|
|
409
|
-
request: {
|
|
410
|
-
params: import_zod_openapi.z.object({ sessionId: import_zod_openapi.z.string().describe("Session identifier") })
|
|
411
390
|
},
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
391
|
+
400: import_responses.BadRequestErrorResponse,
|
|
392
|
+
404: import_responses.NotFoundErrorResponse,
|
|
393
|
+
500: import_responses.InternalErrorResponse
|
|
394
|
+
}
|
|
395
|
+
});
|
|
396
|
+
const patchRoute = (0, import_zod_openapi.createRoute)({
|
|
397
|
+
method: "patch",
|
|
398
|
+
path: "/sessions/{sessionId}",
|
|
399
|
+
summary: "Update Session Title",
|
|
400
|
+
description: "Updates the title of an existing session",
|
|
401
|
+
tags: ["sessions"],
|
|
402
|
+
request: {
|
|
403
|
+
params: import_zod_openapi.z.object({ sessionId: import_zod_openapi.z.string().describe("Session identifier") }),
|
|
404
|
+
body: {
|
|
405
|
+
content: {
|
|
406
|
+
"application/json": {
|
|
407
|
+
schema: import_zod_openapi.z.object({
|
|
408
|
+
title: import_zod_openapi.z.string().min(1, "Title is required").max(120, "Title too long").describe("New title for the session (maximum 120 characters)")
|
|
409
|
+
})
|
|
422
410
|
}
|
|
423
411
|
}
|
|
424
412
|
}
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
body: {
|
|
435
|
-
content: {
|
|
436
|
-
"application/json": {
|
|
437
|
-
schema: import_zod_openapi.z.object({
|
|
438
|
-
title: import_zod_openapi.z.string().min(1, "Title is required").max(120, "Title too long").describe("New title for the session (maximum 120 characters)")
|
|
439
|
-
})
|
|
440
|
-
}
|
|
413
|
+
},
|
|
414
|
+
responses: {
|
|
415
|
+
200: {
|
|
416
|
+
description: "Session updated successfully",
|
|
417
|
+
content: {
|
|
418
|
+
"application/json": {
|
|
419
|
+
schema: import_zod_openapi.z.object({
|
|
420
|
+
session: import_responses.SessionMetadataSchema.describe("Updated session metadata")
|
|
421
|
+
}).strict()
|
|
441
422
|
}
|
|
442
423
|
}
|
|
443
424
|
},
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
425
|
+
400: import_responses.BadRequestErrorResponse,
|
|
426
|
+
404: import_responses.NotFoundErrorResponse,
|
|
427
|
+
500: import_responses.InternalErrorResponse
|
|
428
|
+
}
|
|
429
|
+
});
|
|
430
|
+
const generateTitleRoute = (0, import_zod_openapi.createRoute)({
|
|
431
|
+
method: "post",
|
|
432
|
+
path: "/sessions/{sessionId}/generate-title",
|
|
433
|
+
summary: "Generate Session Title",
|
|
434
|
+
description: "Generates a descriptive title for the session using the first user message. Returns existing title if already set.",
|
|
435
|
+
tags: ["sessions"],
|
|
436
|
+
request: {
|
|
437
|
+
params: import_zod_openapi.z.object({ sessionId: import_zod_openapi.z.string().describe("Session identifier") })
|
|
438
|
+
},
|
|
439
|
+
responses: {
|
|
440
|
+
200: {
|
|
441
|
+
description: "Title generated successfully",
|
|
442
|
+
content: {
|
|
443
|
+
"application/json": {
|
|
444
|
+
schema: import_zod_openapi.z.object({
|
|
445
|
+
title: import_zod_openapi.z.string().nullable().describe("Generated title, or null if generation failed"),
|
|
446
|
+
sessionId: import_zod_openapi.z.string().describe("Session ID")
|
|
447
|
+
}).strict()
|
|
453
448
|
}
|
|
454
449
|
}
|
|
455
|
-
}
|
|
456
|
-
});
|
|
457
|
-
const generateTitleRoute = (0, import_zod_openapi.createRoute)({
|
|
458
|
-
method: "post",
|
|
459
|
-
path: "/sessions/{sessionId}/generate-title",
|
|
460
|
-
summary: "Generate Session Title",
|
|
461
|
-
description: "Generates a descriptive title for the session using the first user message. Returns existing title if already set.",
|
|
462
|
-
tags: ["sessions"],
|
|
463
|
-
request: {
|
|
464
|
-
params: import_zod_openapi.z.object({ sessionId: import_zod_openapi.z.string().describe("Session identifier") })
|
|
465
450
|
},
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
451
|
+
404: {
|
|
452
|
+
...import_responses.NotFoundErrorResponse
|
|
453
|
+
},
|
|
454
|
+
400: import_responses.BadRequestErrorResponse,
|
|
455
|
+
500: import_responses.InternalErrorResponse
|
|
456
|
+
}
|
|
457
|
+
});
|
|
458
|
+
function createSessionsRouter(getAgent) {
|
|
459
|
+
const app = new import_zod_openapi.OpenAPIHono({
|
|
460
|
+
defaultHook: (result, ctx) => {
|
|
461
|
+
if (!result.success) {
|
|
462
|
+
const issues = (0, import_core.zodToIssues)(result.error);
|
|
463
|
+
return (0, import_error.handleHonoError)(
|
|
464
|
+
ctx,
|
|
465
|
+
new import_core.DextoRuntimeError(
|
|
466
|
+
"validation_failed",
|
|
467
|
+
"validation",
|
|
468
|
+
import_core.ErrorType.USER,
|
|
469
|
+
issues[0]?.message ?? "Validation failed",
|
|
470
|
+
{ issues }
|
|
471
|
+
)
|
|
472
|
+
);
|
|
485
473
|
}
|
|
486
474
|
}
|
|
487
475
|
});
|
|
476
|
+
app.onError((err, ctx) => (0, import_error.handleHonoError)(ctx, err));
|
|
488
477
|
return app.openapi(listRoute, async (ctx) => {
|
|
489
478
|
const agent = await getAgent(ctx);
|
|
490
479
|
const sessionIds = await agent.listSessions();
|
|
@@ -498,7 +487,7 @@ function createSessionsRouter(getAgent) {
|
|
|
498
487
|
}
|
|
499
488
|
})
|
|
500
489
|
);
|
|
501
|
-
return ctx.json({ sessions });
|
|
490
|
+
return ctx.json({ sessions }, 200);
|
|
502
491
|
}).openapi(createRouteDef, async (ctx) => {
|
|
503
492
|
const agent = await getAgent(ctx);
|
|
504
493
|
const { sessionId } = ctx.req.valid("json");
|
|
@@ -529,12 +518,15 @@ function createSessionsRouter(getAgent) {
|
|
|
529
518
|
const { sessionId } = ctx.req.param();
|
|
530
519
|
const metadata = await agent.getSessionMetadata(sessionId);
|
|
531
520
|
const history = await agent.getSessionHistory(sessionId);
|
|
532
|
-
return ctx.json(
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
521
|
+
return ctx.json(
|
|
522
|
+
{
|
|
523
|
+
session: {
|
|
524
|
+
...mapSessionMetadata(sessionId, metadata),
|
|
525
|
+
history: history.length
|
|
526
|
+
}
|
|
527
|
+
},
|
|
528
|
+
200
|
|
529
|
+
);
|
|
538
530
|
}).openapi(historyRoute, async (ctx) => {
|
|
539
531
|
const agent = await getAgent(ctx);
|
|
540
532
|
const { sessionId } = ctx.req.param();
|
|
@@ -542,10 +534,13 @@ function createSessionsRouter(getAgent) {
|
|
|
542
534
|
agent.getSessionHistory(sessionId),
|
|
543
535
|
agent.isSessionBusy(sessionId)
|
|
544
536
|
]);
|
|
545
|
-
return ctx.json(
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
537
|
+
return ctx.json(
|
|
538
|
+
{
|
|
539
|
+
history,
|
|
540
|
+
isBusy
|
|
541
|
+
},
|
|
542
|
+
200
|
|
543
|
+
);
|
|
549
544
|
}).openapi(listSessionPromptContributorsRoute, async (ctx) => {
|
|
550
545
|
const agent = await getAgent(ctx);
|
|
551
546
|
const { sessionId } = ctx.req.valid("param");
|
|
@@ -625,7 +620,7 @@ function createSessionsRouter(getAgent) {
|
|
|
625
620
|
const agent = await getAgent(ctx);
|
|
626
621
|
const { sessionId } = ctx.req.param();
|
|
627
622
|
await agent.deleteSession(sessionId);
|
|
628
|
-
return ctx.json({ status: "deleted", sessionId });
|
|
623
|
+
return ctx.json({ status: "deleted", sessionId }, 200);
|
|
629
624
|
}).openapi(cancelRoute, async (ctx) => {
|
|
630
625
|
const agent = await getAgent(ctx);
|
|
631
626
|
const { sessionId } = ctx.req.valid("param");
|
|
@@ -649,18 +644,27 @@ function createSessionsRouter(getAgent) {
|
|
|
649
644
|
if (!cancelled) {
|
|
650
645
|
agent.logger.debug(`No in-flight run to cancel for session: ${sessionId}`);
|
|
651
646
|
}
|
|
652
|
-
return ctx.json(
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
647
|
+
return ctx.json(
|
|
648
|
+
{
|
|
649
|
+
cancelled,
|
|
650
|
+
sessionId,
|
|
651
|
+
queueCleared: clearQueue,
|
|
652
|
+
clearedCount
|
|
653
|
+
},
|
|
654
|
+
200
|
|
655
|
+
);
|
|
658
656
|
}).openapi(loadRoute, async (ctx) => {
|
|
659
657
|
const agent = await getAgent(ctx);
|
|
660
658
|
const { sessionId } = ctx.req.valid("param");
|
|
661
659
|
const sessionIds = await agent.listSessions();
|
|
662
660
|
if (!sessionIds.includes(sessionId)) {
|
|
663
|
-
|
|
661
|
+
throw new import_core.DextoRuntimeError(
|
|
662
|
+
"session_not_found",
|
|
663
|
+
import_core.ErrorScope.SESSION,
|
|
664
|
+
import_core.ErrorType.NOT_FOUND,
|
|
665
|
+
`Session not found: ${sessionId}`,
|
|
666
|
+
{ sessionId }
|
|
667
|
+
);
|
|
664
668
|
}
|
|
665
669
|
const metadata = await agent.getSessionMetadata(sessionId);
|
|
666
670
|
const isBusy = await agent.isSessionBusy(sessionId);
|
|
@@ -686,16 +690,19 @@ function createSessionsRouter(getAgent) {
|
|
|
686
690
|
const agent = await getAgent(ctx);
|
|
687
691
|
const { sessionId } = ctx.req.valid("param");
|
|
688
692
|
await agent.clearContext(sessionId);
|
|
689
|
-
return ctx.json({ status: "context cleared", sessionId });
|
|
693
|
+
return ctx.json({ status: "context cleared", sessionId }, 200);
|
|
690
694
|
}).openapi(patchRoute, async (ctx) => {
|
|
691
695
|
const agent = await getAgent(ctx);
|
|
692
696
|
const { sessionId } = ctx.req.valid("param");
|
|
693
697
|
const { title } = ctx.req.valid("json");
|
|
694
698
|
await agent.setSessionTitle(sessionId, title);
|
|
695
699
|
const metadata = await agent.getSessionMetadata(sessionId);
|
|
696
|
-
return ctx.json(
|
|
697
|
-
|
|
698
|
-
|
|
700
|
+
return ctx.json(
|
|
701
|
+
{
|
|
702
|
+
session: mapSessionMetadata(sessionId, metadata, { title })
|
|
703
|
+
},
|
|
704
|
+
200
|
|
705
|
+
);
|
|
699
706
|
}).openapi(generateTitleRoute, async (ctx) => {
|
|
700
707
|
const agent = await getAgent(ctx);
|
|
701
708
|
const { sessionId } = ctx.req.valid("param");
|