@pellux/goodvibes-daemon-sdk 0.18.3
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/README.md +32 -0
- package/dist/api-router.d.ts +3 -0
- package/dist/api-router.d.ts.map +1 -0
- package/dist/api-router.js +13 -0
- package/dist/automation.d.ts +3 -0
- package/dist/automation.d.ts.map +1 -0
- package/dist/automation.js +56 -0
- package/dist/channel-route-types.d.ts +78 -0
- package/dist/channel-route-types.d.ts.map +1 -0
- package/dist/channel-route-types.js +1 -0
- package/dist/channel-routes.d.ts +4 -0
- package/dist/channel-routes.d.ts.map +1 -0
- package/dist/channel-routes.js +264 -0
- package/dist/context.d.ts +207 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +1 -0
- package/dist/control-routes.d.ts +57 -0
- package/dist/control-routes.d.ts.map +1 -0
- package/dist/control-routes.js +120 -0
- package/dist/error-response.d.ts +10 -0
- package/dist/error-response.d.ts.map +1 -0
- package/dist/error-response.js +84 -0
- package/dist/http-policy.d.ts +33 -0
- package/dist/http-policy.d.ts.map +1 -0
- package/dist/http-policy.js +30 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/integration-route-types.d.ts +64 -0
- package/dist/integration-route-types.d.ts.map +1 -0
- package/dist/integration-route-types.js +1 -0
- package/dist/integration-routes.d.ts +4 -0
- package/dist/integration-routes.d.ts.map +1 -0
- package/dist/integration-routes.js +172 -0
- package/dist/knowledge-route-types.d.ts +114 -0
- package/dist/knowledge-route-types.d.ts.map +1 -0
- package/dist/knowledge-route-types.js +1 -0
- package/dist/knowledge-routes.d.ts +4 -0
- package/dist/knowledge-routes.d.ts.map +1 -0
- package/dist/knowledge-routes.js +582 -0
- package/dist/media-route-types.d.ts +66 -0
- package/dist/media-route-types.d.ts.map +1 -0
- package/dist/media-route-types.js +1 -0
- package/dist/media-routes.d.ts +4 -0
- package/dist/media-routes.d.ts.map +1 -0
- package/dist/media-routes.js +328 -0
- package/dist/operator.d.ts +3 -0
- package/dist/operator.d.ts.map +1 -0
- package/dist/operator.js +395 -0
- package/dist/remote-routes.d.ts +40 -0
- package/dist/remote-routes.d.ts.map +1 -0
- package/dist/remote-routes.js +238 -0
- package/dist/remote.d.ts +3 -0
- package/dist/remote.d.ts.map +1 -0
- package/dist/remote.js +35 -0
- package/dist/route-helpers.d.ts +11 -0
- package/dist/route-helpers.d.ts.map +1 -0
- package/dist/route-helpers.js +54 -0
- package/dist/runtime-automation-routes.d.ts +4 -0
- package/dist/runtime-automation-routes.d.ts.map +1 -0
- package/dist/runtime-automation-routes.js +165 -0
- package/dist/runtime-route-types.d.ts +240 -0
- package/dist/runtime-route-types.d.ts.map +1 -0
- package/dist/runtime-route-types.js +1 -0
- package/dist/runtime-routes.d.ts +5 -0
- package/dist/runtime-routes.d.ts.map +1 -0
- package/dist/runtime-routes.js +8 -0
- package/dist/runtime-session-routes.d.ts +4 -0
- package/dist/runtime-session-routes.d.ts.map +1 -0
- package/dist/runtime-session-routes.js +387 -0
- package/dist/sessions.d.ts +3 -0
- package/dist/sessions.d.ts.map +1 -0
- package/dist/sessions.js +37 -0
- package/dist/system-route-types.d.ts +124 -0
- package/dist/system-route-types.d.ts.map +1 -0
- package/dist/system-route-types.js +1 -0
- package/dist/system-routes.d.ts +4 -0
- package/dist/system-routes.d.ts.map +1 -0
- package/dist/system-routes.js +327 -0
- package/dist/tasks.d.ts +3 -0
- package/dist/tasks.d.ts.map +1 -0
- package/dist/tasks.js +22 -0
- package/dist/telemetry-routes.d.ts +44 -0
- package/dist/telemetry-routes.d.ts.map +1 -0
- package/dist/telemetry-routes.js +227 -0
- package/package.json +42 -0
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
export function createDaemonRuntimeSessionRouteHandlers(context) {
|
|
2
|
+
return {
|
|
3
|
+
createSharedSession: async (request) => handleCreateSharedSession(context, request),
|
|
4
|
+
postTask: async (request) => handlePostTask(context, request),
|
|
5
|
+
getSharedSession: async (sessionId) => handleGetSharedSession(context, sessionId),
|
|
6
|
+
closeSharedSession: (sessionId) => handleSharedSessionLifecycle(context, sessionId, 'close'),
|
|
7
|
+
reopenSharedSession: (sessionId) => handleSharedSessionLifecycle(context, sessionId, 'reopen'),
|
|
8
|
+
getSharedSessionMessages: async (sessionId, url) => handleGetSharedSessionMessages(context, sessionId, url),
|
|
9
|
+
getSharedSessionInputs: async (sessionId, url) => handleGetSharedSessionInputs(context, sessionId, url),
|
|
10
|
+
postSharedSessionMessage: (sessionId, request) => handlePostSharedSessionMessage(context, sessionId, request),
|
|
11
|
+
postSharedSessionSteer: (sessionId, request) => handlePostSharedSessionSteer(context, sessionId, request),
|
|
12
|
+
postSharedSessionFollowUp: (sessionId, request) => handlePostSharedSessionFollowUp(context, sessionId, request),
|
|
13
|
+
cancelSharedSessionInput: (sessionId, inputId) => handleCancelSharedSessionInput(context, sessionId, inputId),
|
|
14
|
+
getRuntimeTask: (taskId) => handleGetRuntimeTask(context, taskId),
|
|
15
|
+
runtimeTaskAction: (taskId, action, request) => handleRuntimeTaskAction(context, taskId, action, request),
|
|
16
|
+
getTaskStatus: (agentId) => handleGetTaskStatus(context, agentId),
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
async function handleCreateSharedSession(context, req) {
|
|
20
|
+
const body = await context.parseJsonBody(req);
|
|
21
|
+
if (body instanceof Response)
|
|
22
|
+
return body;
|
|
23
|
+
await context.sessionBroker.start();
|
|
24
|
+
await context.routeBindings.start();
|
|
25
|
+
const routeBinding = typeof body.routeId === 'string'
|
|
26
|
+
? context.routeBindings.getBinding(body.routeId)
|
|
27
|
+
: undefined;
|
|
28
|
+
const session = await context.sessionBroker.createSession({
|
|
29
|
+
id: typeof body.id === 'string' ? body.id : undefined,
|
|
30
|
+
title: typeof body.title === 'string' ? body.title : undefined,
|
|
31
|
+
metadata: typeof body.metadata === 'object' && body.metadata !== null ? body.metadata : {},
|
|
32
|
+
routeBinding,
|
|
33
|
+
participant: typeof body.surfaceKind === 'string' && typeof body.surfaceId === 'string'
|
|
34
|
+
? {
|
|
35
|
+
surfaceKind: body.surfaceKind,
|
|
36
|
+
surfaceId: body.surfaceId,
|
|
37
|
+
externalId: typeof body.externalId === 'string' ? body.externalId : undefined,
|
|
38
|
+
userId: typeof body.userId === 'string' ? body.userId : undefined,
|
|
39
|
+
displayName: typeof body.displayName === 'string' ? body.displayName : undefined,
|
|
40
|
+
routeId: routeBinding?.id,
|
|
41
|
+
lastSeenAt: Date.now(),
|
|
42
|
+
}
|
|
43
|
+
: undefined,
|
|
44
|
+
});
|
|
45
|
+
return context.recordApiResponse(req, '/api/sessions', Response.json({ session }, { status: 201 }));
|
|
46
|
+
}
|
|
47
|
+
async function handlePostTask(context, req) {
|
|
48
|
+
const body = await context.parseJsonBody(req);
|
|
49
|
+
if (body instanceof Response)
|
|
50
|
+
return body;
|
|
51
|
+
const task = body.task;
|
|
52
|
+
if (!task || typeof task !== 'string' || task.trim() === '') {
|
|
53
|
+
return Response.json({ error: 'Missing required field: task (non-empty string)' }, { status: 400 });
|
|
54
|
+
}
|
|
55
|
+
const model = typeof body.model === 'string' ? body.model : undefined;
|
|
56
|
+
const tools = Array.isArray(body.tools) ? body.tools.filter((t) => typeof t === 'string') : undefined;
|
|
57
|
+
const wantsSharedSession = typeof body.sessionId === 'string' || typeof body.routeId === 'string' || typeof body.surfaceKind === 'string';
|
|
58
|
+
if (wantsSharedSession) {
|
|
59
|
+
const submission = await context.sessionBroker.submitMessage({
|
|
60
|
+
sessionId: typeof body.sessionId === 'string' ? body.sessionId : undefined,
|
|
61
|
+
routeId: typeof body.routeId === 'string' ? body.routeId : undefined,
|
|
62
|
+
surfaceKind: typeof body.surfaceKind === 'string' ? body.surfaceKind : 'web',
|
|
63
|
+
surfaceId: typeof body.surfaceId === 'string' ? body.surfaceId : 'surface:web',
|
|
64
|
+
externalId: typeof body.externalId === 'string' ? body.externalId : undefined,
|
|
65
|
+
threadId: typeof body.threadId === 'string' ? body.threadId : undefined,
|
|
66
|
+
userId: typeof body.userId === 'string' ? body.userId : undefined,
|
|
67
|
+
displayName: typeof body.displayName === 'string' ? body.displayName : undefined,
|
|
68
|
+
title: typeof body.title === 'string' ? body.title : undefined,
|
|
69
|
+
body: task.trim(),
|
|
70
|
+
metadata: typeof body.metadata === 'object' && body.metadata !== null ? body.metadata : {},
|
|
71
|
+
...(typeof body.routing === 'object' && body.routing !== null ? { routing: body.routing } : {}),
|
|
72
|
+
});
|
|
73
|
+
if (submission.mode === 'continued-live') {
|
|
74
|
+
return context.recordApiResponse(req, '/task', Response.json({
|
|
75
|
+
acknowledged: true,
|
|
76
|
+
mode: submission.mode,
|
|
77
|
+
sessionId: submission.session.id,
|
|
78
|
+
agentId: submission.activeAgentId ?? null,
|
|
79
|
+
inputId: submission.input.id,
|
|
80
|
+
}, { status: 202 }));
|
|
81
|
+
}
|
|
82
|
+
if (submission.mode === 'queued-follow-up') {
|
|
83
|
+
return context.recordApiResponse(req, '/task', Response.json({
|
|
84
|
+
acknowledged: true,
|
|
85
|
+
mode: submission.mode,
|
|
86
|
+
sessionId: submission.session.id,
|
|
87
|
+
agentId: submission.activeAgentId ?? null,
|
|
88
|
+
inputId: submission.input.id,
|
|
89
|
+
}, { status: 202 }));
|
|
90
|
+
}
|
|
91
|
+
if (submission.mode === 'rejected') {
|
|
92
|
+
return context.recordApiResponse(req, '/task', Response.json({
|
|
93
|
+
acknowledged: false,
|
|
94
|
+
mode: submission.mode,
|
|
95
|
+
sessionId: submission.session.id,
|
|
96
|
+
inputId: submission.input.id,
|
|
97
|
+
}, { status: 409 }));
|
|
98
|
+
}
|
|
99
|
+
const sessionSpawn = context.trySpawnAgent({
|
|
100
|
+
mode: 'spawn',
|
|
101
|
+
task: submission.task,
|
|
102
|
+
...(model !== undefined || submission.input.routing?.modelId ? { model: model ?? submission.input.routing?.modelId } : {}),
|
|
103
|
+
...(tools !== undefined || submission.input.routing?.tools ? { tools: tools ?? [...(submission.input.routing?.tools ?? [])] } : {}),
|
|
104
|
+
...(submission.input.routing?.providerId ? { provider: submission.input.routing.providerId } : {}),
|
|
105
|
+
...(submission.input.routing?.executionIntent ? { executionIntent: submission.input.routing.executionIntent } : {}),
|
|
106
|
+
}, 'DaemonServer.handlePostTask.sharedSession', submission.session.id);
|
|
107
|
+
if (sessionSpawn instanceof Response)
|
|
108
|
+
return sessionSpawn;
|
|
109
|
+
await context.sessionBroker.bindAgent(submission.session.id, sessionSpawn.id);
|
|
110
|
+
context.queueSurfaceReplyFromBinding(submission.routeBinding, {
|
|
111
|
+
agentId: sessionSpawn.id,
|
|
112
|
+
task,
|
|
113
|
+
sessionId: submission.session.id,
|
|
114
|
+
});
|
|
115
|
+
return context.recordApiResponse(req, '/task', Response.json({
|
|
116
|
+
acknowledged: true,
|
|
117
|
+
mode: submission.mode,
|
|
118
|
+
sessionId: submission.session.id,
|
|
119
|
+
agentId: sessionSpawn.id,
|
|
120
|
+
status: sessionSpawn.status,
|
|
121
|
+
}, { status: 202 }));
|
|
122
|
+
}
|
|
123
|
+
const spawnResult = context.trySpawnAgent({
|
|
124
|
+
mode: 'spawn',
|
|
125
|
+
task,
|
|
126
|
+
...(model !== undefined && { model }),
|
|
127
|
+
...(tools !== undefined && { tools }),
|
|
128
|
+
...(typeof body.routing === 'object'
|
|
129
|
+
&& body.routing !== null
|
|
130
|
+
&& typeof body.routing.executionIntent === 'object'
|
|
131
|
+
&& body.routing.executionIntent !== null
|
|
132
|
+
? {
|
|
133
|
+
executionIntent: body.routing.executionIntent,
|
|
134
|
+
}
|
|
135
|
+
: {}),
|
|
136
|
+
}, 'DaemonServer', typeof body.sessionId === 'string' ? body.sessionId : undefined);
|
|
137
|
+
if (spawnResult instanceof Response)
|
|
138
|
+
return spawnResult;
|
|
139
|
+
return context.recordApiResponse(req, '/task', Response.json({
|
|
140
|
+
acknowledged: true,
|
|
141
|
+
agentId: spawnResult.id,
|
|
142
|
+
status: spawnResult.status,
|
|
143
|
+
task: spawnResult.task,
|
|
144
|
+
model: spawnResult.model ?? null,
|
|
145
|
+
tools: spawnResult.tools,
|
|
146
|
+
}, { status: 202 }));
|
|
147
|
+
}
|
|
148
|
+
async function handleGetSharedSession(context, sessionId) {
|
|
149
|
+
await context.sessionBroker.start();
|
|
150
|
+
const session = context.sessionBroker.getSession(sessionId);
|
|
151
|
+
if (!session) {
|
|
152
|
+
return Response.json({ error: 'Unknown shared session' }, { status: 404 });
|
|
153
|
+
}
|
|
154
|
+
return Response.json({
|
|
155
|
+
session,
|
|
156
|
+
messages: context.sessionBroker.getMessages(sessionId, 100),
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
async function handleSharedSessionLifecycle(context, sessionId, action) {
|
|
160
|
+
await context.sessionBroker.start();
|
|
161
|
+
const session = action === 'close'
|
|
162
|
+
? await context.sessionBroker.closeSession(sessionId)
|
|
163
|
+
: await context.sessionBroker.reopenSession(sessionId);
|
|
164
|
+
return session
|
|
165
|
+
? Response.json({ session })
|
|
166
|
+
: Response.json({ error: 'Unknown shared session' }, { status: 404 });
|
|
167
|
+
}
|
|
168
|
+
async function handleGetSharedSessionMessages(context, sessionId, url) {
|
|
169
|
+
await context.sessionBroker.start();
|
|
170
|
+
const session = context.sessionBroker.getSession(sessionId);
|
|
171
|
+
if (!session) {
|
|
172
|
+
return Response.json({ error: 'Unknown shared session' }, { status: 404 });
|
|
173
|
+
}
|
|
174
|
+
const limit = Number(url.searchParams.get('limit') ?? 100);
|
|
175
|
+
return Response.json({
|
|
176
|
+
session,
|
|
177
|
+
messages: context.sessionBroker.getMessages(sessionId, limit),
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
async function handleGetSharedSessionInputs(context, sessionId, url) {
|
|
181
|
+
await context.sessionBroker.start();
|
|
182
|
+
const session = context.sessionBroker.getSession(sessionId);
|
|
183
|
+
if (!session) {
|
|
184
|
+
return Response.json({ error: 'Unknown shared session' }, { status: 404 });
|
|
185
|
+
}
|
|
186
|
+
const limit = Number(url.searchParams.get('limit') ?? 100);
|
|
187
|
+
return Response.json({
|
|
188
|
+
session,
|
|
189
|
+
inputs: context.sessionBroker.getInputs(sessionId, limit),
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
async function handlePostSharedSessionMessage(context, sessionId, req) {
|
|
193
|
+
const body = await context.parseJsonBody(req);
|
|
194
|
+
if (body instanceof Response)
|
|
195
|
+
return body;
|
|
196
|
+
const message = readSharedSessionMessageBody(body);
|
|
197
|
+
if (!message) {
|
|
198
|
+
return Response.json({ error: 'Missing shared session message body' }, { status: 400 });
|
|
199
|
+
}
|
|
200
|
+
const submission = await context.sessionBroker.submitMessage(buildSharedSessionMessageInput(sessionId, body, message));
|
|
201
|
+
return await respondToSessionSubmission(context, req, submission, message, `/api/sessions/${sessionId}/messages`, 'DaemonServer.handlePostSharedSessionMessage', {
|
|
202
|
+
context: `shared-session:${submission.session.id}`,
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
async function handlePostSharedSessionSteer(context, sessionId, req) {
|
|
206
|
+
const body = await context.parseJsonBody(req);
|
|
207
|
+
if (body instanceof Response)
|
|
208
|
+
return body;
|
|
209
|
+
const message = readSharedSessionMessageBody(body);
|
|
210
|
+
if (!message) {
|
|
211
|
+
return Response.json({ error: 'Missing shared session steer body' }, { status: 400 });
|
|
212
|
+
}
|
|
213
|
+
const submission = await context.sessionBroker.steerMessage({
|
|
214
|
+
...buildSharedSessionMessageInput(sessionId, body, message),
|
|
215
|
+
...(body.allowSpawnFallback === true ? { allowSpawnFallback: true } : {}),
|
|
216
|
+
});
|
|
217
|
+
return await respondToSessionSubmission(context, req, submission, message, `/api/sessions/${sessionId}/steer`, 'DaemonServer.handlePostSharedSessionSteer', {
|
|
218
|
+
context: `shared-session:${submission.session.id}`,
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
async function handlePostSharedSessionFollowUp(context, sessionId, req) {
|
|
222
|
+
const body = await context.parseJsonBody(req);
|
|
223
|
+
if (body instanceof Response)
|
|
224
|
+
return body;
|
|
225
|
+
const message = readSharedSessionMessageBody(body);
|
|
226
|
+
if (!message) {
|
|
227
|
+
return Response.json({ error: 'Missing shared session follow-up body' }, { status: 400 });
|
|
228
|
+
}
|
|
229
|
+
const submission = await context.sessionBroker.followUpMessage(buildSharedSessionMessageInput(sessionId, body, message));
|
|
230
|
+
return await respondToSessionSubmission(context, req, submission, message, `/api/sessions/${sessionId}/follow-up`, 'DaemonServer.handlePostSharedSessionFollowUp', {
|
|
231
|
+
context: `shared-session:${submission.session.id}`,
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
async function handleCancelSharedSessionInput(context, sessionId, inputId) {
|
|
235
|
+
await context.sessionBroker.start();
|
|
236
|
+
const input = await context.sessionBroker.cancelInput(sessionId, inputId);
|
|
237
|
+
if (!input) {
|
|
238
|
+
return Response.json({ error: 'Unknown shared session input' }, { status: 404 });
|
|
239
|
+
}
|
|
240
|
+
return Response.json({ input });
|
|
241
|
+
}
|
|
242
|
+
function handleGetRuntimeTask(context, taskId) {
|
|
243
|
+
const task = context.runtimeStore?.getState().tasks.tasks.get(taskId);
|
|
244
|
+
if (!task) {
|
|
245
|
+
return Response.json({ error: 'Unknown runtime task' }, { status: 404 });
|
|
246
|
+
}
|
|
247
|
+
return Response.json({ task });
|
|
248
|
+
}
|
|
249
|
+
function readSharedSessionMessageBody(body) {
|
|
250
|
+
return typeof body.message === 'string'
|
|
251
|
+
? body.message.trim()
|
|
252
|
+
: typeof body.body === 'string'
|
|
253
|
+
? body.body.trim()
|
|
254
|
+
: typeof body.text === 'string'
|
|
255
|
+
? body.text.trim()
|
|
256
|
+
: '';
|
|
257
|
+
}
|
|
258
|
+
function buildSharedSessionMessageInput(sessionId, body, message) {
|
|
259
|
+
return {
|
|
260
|
+
sessionId,
|
|
261
|
+
surfaceKind: typeof body.surfaceKind === 'string' ? body.surfaceKind : 'web',
|
|
262
|
+
surfaceId: typeof body.surfaceId === 'string' ? body.surfaceId : 'surface:web',
|
|
263
|
+
...(typeof body.externalId === 'string' ? { externalId: body.externalId } : {}),
|
|
264
|
+
...(typeof body.threadId === 'string' ? { threadId: body.threadId } : {}),
|
|
265
|
+
...(typeof body.userId === 'string' ? { userId: body.userId } : {}),
|
|
266
|
+
...(typeof body.displayName === 'string' ? { displayName: body.displayName } : {}),
|
|
267
|
+
...(typeof body.title === 'string' ? { title: body.title } : {}),
|
|
268
|
+
...(typeof body.routeId === 'string' ? { routeId: body.routeId } : {}),
|
|
269
|
+
body: message,
|
|
270
|
+
...(typeof body.metadata === 'object' && body.metadata !== null ? { metadata: body.metadata } : {}),
|
|
271
|
+
...(typeof body.routing === 'object' && body.routing !== null ? { routing: body.routing } : {}),
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
async function respondToSessionSubmission(context, req, submission, taskText, path, logLabel, spawnOptions = {}) {
|
|
275
|
+
if (submission.mode === 'continued-live' || submission.mode === 'queued-follow-up') {
|
|
276
|
+
return context.recordApiResponse(req, path, Response.json({
|
|
277
|
+
session: submission.session,
|
|
278
|
+
message: submission.userMessage ?? null,
|
|
279
|
+
input: submission.input,
|
|
280
|
+
mode: submission.mode,
|
|
281
|
+
agentId: submission.activeAgentId ?? null,
|
|
282
|
+
}, { status: 202 }));
|
|
283
|
+
}
|
|
284
|
+
if (submission.mode === 'rejected') {
|
|
285
|
+
return context.recordApiResponse(req, path, Response.json({
|
|
286
|
+
session: submission.session,
|
|
287
|
+
message: submission.userMessage ?? null,
|
|
288
|
+
input: submission.input,
|
|
289
|
+
mode: submission.mode,
|
|
290
|
+
}, { status: 409 }));
|
|
291
|
+
}
|
|
292
|
+
const spawnResult = context.trySpawnAgent({
|
|
293
|
+
mode: 'spawn',
|
|
294
|
+
task: submission.task,
|
|
295
|
+
...(spawnOptions.context ? { context: spawnOptions.context } : {}),
|
|
296
|
+
...(spawnOptions.model ?? submission.input.routing?.modelId ? { model: spawnOptions.model ?? submission.input.routing?.modelId } : {}),
|
|
297
|
+
...(spawnOptions.provider ?? submission.input.routing?.providerId ? { provider: spawnOptions.provider ?? submission.input.routing?.providerId } : {}),
|
|
298
|
+
...(spawnOptions.tools ?? submission.input.routing?.tools ? { tools: [...(spawnOptions.tools ?? submission.input.routing?.tools ?? [])] } : {}),
|
|
299
|
+
...(spawnOptions.executionIntent ?? submission.input.routing?.executionIntent
|
|
300
|
+
? { executionIntent: spawnOptions.executionIntent ?? submission.input.routing?.executionIntent }
|
|
301
|
+
: {}),
|
|
302
|
+
}, logLabel, submission.session.id);
|
|
303
|
+
if (spawnResult instanceof Response)
|
|
304
|
+
return spawnResult;
|
|
305
|
+
await context.sessionBroker.bindAgent(submission.session.id, spawnResult.id);
|
|
306
|
+
context.queueSurfaceReplyFromBinding(submission.routeBinding, {
|
|
307
|
+
agentId: spawnResult.id,
|
|
308
|
+
task: taskText,
|
|
309
|
+
sessionId: submission.session.id,
|
|
310
|
+
});
|
|
311
|
+
return context.recordApiResponse(req, path, Response.json({
|
|
312
|
+
session: context.sessionBroker.getSession(submission.session.id),
|
|
313
|
+
message: submission.userMessage ?? null,
|
|
314
|
+
input: {
|
|
315
|
+
...submission.input,
|
|
316
|
+
state: 'spawned',
|
|
317
|
+
activeAgentId: spawnResult.id,
|
|
318
|
+
},
|
|
319
|
+
mode: submission.mode,
|
|
320
|
+
agentId: spawnResult.id,
|
|
321
|
+
}, { status: 202 }));
|
|
322
|
+
}
|
|
323
|
+
function handleRuntimeTaskAction(context, taskId, action, _req) {
|
|
324
|
+
if (!context.runtimeStore || !context.runtimeDispatch) {
|
|
325
|
+
return Response.json({ error: 'Runtime store unavailable' }, { status: 503 });
|
|
326
|
+
}
|
|
327
|
+
const task = context.runtimeStore.getState().tasks.tasks.get(taskId);
|
|
328
|
+
if (!task) {
|
|
329
|
+
return Response.json({ error: 'Unknown runtime task' }, { status: 404 });
|
|
330
|
+
}
|
|
331
|
+
if (action === 'cancel') {
|
|
332
|
+
if (task.kind === 'agent' && task.owner) {
|
|
333
|
+
context.agentManager.cancel(task.owner);
|
|
334
|
+
}
|
|
335
|
+
context.runtimeDispatch.transitionRuntimeTask(taskId, 'cancelled', {
|
|
336
|
+
endedAt: Date.now(),
|
|
337
|
+
error: 'Cancelled via control plane',
|
|
338
|
+
}, 'daemon.server.tasks.cancel');
|
|
339
|
+
return Response.json({ task: context.runtimeStore.getState().tasks.tasks.get(taskId) });
|
|
340
|
+
}
|
|
341
|
+
if (action === 'retry') {
|
|
342
|
+
if (task.kind !== 'agent') {
|
|
343
|
+
return Response.json({ error: 'Retry is only implemented for agent tasks' }, { status: 400 });
|
|
344
|
+
}
|
|
345
|
+
const spawnResult = context.trySpawnAgent({
|
|
346
|
+
mode: 'spawn',
|
|
347
|
+
task: task.description ?? task.title ?? '',
|
|
348
|
+
}, 'DaemonServer.handleRuntimeTaskAction');
|
|
349
|
+
if (spawnResult instanceof Response)
|
|
350
|
+
return spawnResult;
|
|
351
|
+
context.runtimeDispatch.transitionRuntimeTask(taskId, 'queued', {
|
|
352
|
+
startedAt: undefined,
|
|
353
|
+
endedAt: undefined,
|
|
354
|
+
error: undefined,
|
|
355
|
+
result: undefined,
|
|
356
|
+
}, 'daemon.server.tasks.retry');
|
|
357
|
+
return Response.json({
|
|
358
|
+
retried: true,
|
|
359
|
+
task: context.runtimeStore.getState().tasks.tasks.get(taskId),
|
|
360
|
+
agentId: spawnResult.id,
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
return Response.json({ error: 'Unsupported task action' }, { status: 400 });
|
|
364
|
+
}
|
|
365
|
+
function handleGetTaskStatus(context, agentId) {
|
|
366
|
+
const record = context.agentManager.getStatus(agentId);
|
|
367
|
+
if (!record) {
|
|
368
|
+
return Response.json({ error: `Agent not found: ${agentId}` }, { status: 404 });
|
|
369
|
+
}
|
|
370
|
+
if (record.status === 'completed' || record.status === 'failed' || record.status === 'cancelled') {
|
|
371
|
+
context.syncFinishedAgentTask(record);
|
|
372
|
+
}
|
|
373
|
+
const durationMs = record.completedAt !== undefined
|
|
374
|
+
? record.completedAt - record.startedAt
|
|
375
|
+
: Date.now() - record.startedAt;
|
|
376
|
+
return Response.json({
|
|
377
|
+
agentId: record.id,
|
|
378
|
+
task: record.task,
|
|
379
|
+
status: record.status,
|
|
380
|
+
model: record.model ?? null,
|
|
381
|
+
tools: record.tools,
|
|
382
|
+
durationMs,
|
|
383
|
+
toolCallCount: record.toolCallCount,
|
|
384
|
+
progress: record.progress ?? null,
|
|
385
|
+
error: record.error ?? null,
|
|
386
|
+
});
|
|
387
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { DaemonApiRouteHandlers } from './context.js';
|
|
2
|
+
export declare function dispatchSessionRoutes(req: Request, handlers: Pick<DaemonApiRouteHandlers, 'getIntegrationSessions' | 'createSharedSession' | 'getSharedSession' | 'closeSharedSession' | 'reopenSharedSession' | 'getSharedSessionMessages' | 'postSharedSessionMessage' | 'getSharedSessionInputs' | 'postSharedSessionSteer' | 'postSharedSessionFollowUp' | 'cancelSharedSessionInput'>): Promise<Response | null>;
|
|
3
|
+
//# sourceMappingURL=sessions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sessions.d.ts","sourceRoot":"","sources":["../src/sessions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAE3D,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,OAAO,EACZ,QAAQ,EAAE,IAAI,CACZ,sBAAsB,EACpB,wBAAwB,GACxB,qBAAqB,GACrB,kBAAkB,GAClB,oBAAoB,GACpB,qBAAqB,GACrB,0BAA0B,GAC1B,0BAA0B,GAC1B,wBAAwB,GACxB,wBAAwB,GACxB,2BAA2B,GAC3B,0BAA0B,CAC7B,GACA,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAqC1B"}
|
package/dist/sessions.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export async function dispatchSessionRoutes(req, handlers) {
|
|
2
|
+
const url = new URL(req.url);
|
|
3
|
+
const { pathname } = url;
|
|
4
|
+
const method = req.method;
|
|
5
|
+
if (pathname === '/api/sessions' && method === 'GET')
|
|
6
|
+
return handlers.getIntegrationSessions();
|
|
7
|
+
if (pathname === '/api/sessions' && method === 'POST')
|
|
8
|
+
return handlers.createSharedSession(req);
|
|
9
|
+
const sharedSessionMatch = pathname.match(/^\/api\/sessions\/([^/]+)$/);
|
|
10
|
+
if (sharedSessionMatch && method === 'GET')
|
|
11
|
+
return handlers.getSharedSession(sharedSessionMatch[1]);
|
|
12
|
+
const sharedSessionCloseMatch = pathname.match(/^\/api\/sessions\/([^/]+)\/(close|reopen)$/);
|
|
13
|
+
if (sharedSessionCloseMatch && method === 'POST') {
|
|
14
|
+
return sharedSessionCloseMatch[2] === 'close'
|
|
15
|
+
? handlers.closeSharedSession(sharedSessionCloseMatch[1])
|
|
16
|
+
: handlers.reopenSharedSession(sharedSessionCloseMatch[1]);
|
|
17
|
+
}
|
|
18
|
+
const sharedSessionMessagesMatch = pathname.match(/^\/api\/sessions\/([^/]+)\/messages$/);
|
|
19
|
+
if (sharedSessionMessagesMatch && method === 'GET')
|
|
20
|
+
return handlers.getSharedSessionMessages(sharedSessionMessagesMatch[1], url);
|
|
21
|
+
if (sharedSessionMessagesMatch && method === 'POST')
|
|
22
|
+
return handlers.postSharedSessionMessage(sharedSessionMessagesMatch[1], req);
|
|
23
|
+
const sharedSessionInputsMatch = pathname.match(/^\/api\/sessions\/([^/]+)\/inputs$/);
|
|
24
|
+
if (sharedSessionInputsMatch && method === 'GET')
|
|
25
|
+
return handlers.getSharedSessionInputs(sharedSessionInputsMatch[1], url);
|
|
26
|
+
const sharedSessionSteerMatch = pathname.match(/^\/api\/sessions\/([^/]+)\/steer$/);
|
|
27
|
+
if (sharedSessionSteerMatch && method === 'POST')
|
|
28
|
+
return handlers.postSharedSessionSteer(sharedSessionSteerMatch[1], req);
|
|
29
|
+
const sharedSessionFollowUpMatch = pathname.match(/^\/api\/sessions\/([^/]+)\/follow-up$/);
|
|
30
|
+
if (sharedSessionFollowUpMatch && method === 'POST')
|
|
31
|
+
return handlers.postSharedSessionFollowUp(sharedSessionFollowUpMatch[1], req);
|
|
32
|
+
const sharedSessionCancelInputMatch = pathname.match(/^\/api\/sessions\/([^/]+)\/inputs\/([^/]+)\/cancel$/);
|
|
33
|
+
if (sharedSessionCancelInputMatch && method === 'POST') {
|
|
34
|
+
return handlers.cancelSharedSessionInput(sharedSessionCancelInputMatch[1], sharedSessionCancelInputMatch[2]);
|
|
35
|
+
}
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import type { JsonRecord } from './route-helpers.js';
|
|
2
|
+
export type DaemonApiClientKind = 'web' | 'slack' | 'discord' | 'ntfy' | 'webhook' | 'telegram' | 'google-chat' | 'signal' | 'whatsapp' | 'imessage' | 'msteams' | 'bluebubbles' | 'mattermost' | 'matrix' | 'daemon';
|
|
3
|
+
export type AutomationRouteBindingKind = string;
|
|
4
|
+
export type AutomationSurfaceKind = string;
|
|
5
|
+
export type AutomationSessionPolicy = string;
|
|
6
|
+
export type AutomationThreadPolicy = string;
|
|
7
|
+
export type AutomationDeliveryGuarantee = string;
|
|
8
|
+
export type WatcherKind = string;
|
|
9
|
+
export interface ConfigManagerLike {
|
|
10
|
+
get(key: string): unknown;
|
|
11
|
+
getAll(): Record<string, unknown>;
|
|
12
|
+
setDynamic(key: string, value: unknown): void;
|
|
13
|
+
}
|
|
14
|
+
export interface IntegrationApprovalSnapshotSourceLike {
|
|
15
|
+
getApprovalSnapshot(): unknown;
|
|
16
|
+
}
|
|
17
|
+
export interface PlatformServiceManagerLike {
|
|
18
|
+
status(): Record<string, unknown>;
|
|
19
|
+
install(): unknown;
|
|
20
|
+
start(): unknown;
|
|
21
|
+
stop(): unknown;
|
|
22
|
+
restart(): unknown;
|
|
23
|
+
uninstall(): unknown;
|
|
24
|
+
}
|
|
25
|
+
export interface RouteBindingRecordInput {
|
|
26
|
+
readonly id?: string;
|
|
27
|
+
readonly kind: AutomationRouteBindingKind;
|
|
28
|
+
readonly surfaceKind: AutomationSurfaceKind;
|
|
29
|
+
readonly surfaceId: string;
|
|
30
|
+
readonly externalId: string;
|
|
31
|
+
readonly sessionPolicy?: AutomationSessionPolicy;
|
|
32
|
+
readonly threadPolicy?: AutomationThreadPolicy;
|
|
33
|
+
readonly deliveryGuarantee?: AutomationDeliveryGuarantee;
|
|
34
|
+
readonly threadId?: string;
|
|
35
|
+
readonly channelId?: string;
|
|
36
|
+
readonly sessionId?: string | null;
|
|
37
|
+
readonly jobId?: string | null;
|
|
38
|
+
readonly runId?: string | null;
|
|
39
|
+
readonly title?: string;
|
|
40
|
+
readonly metadata: Record<string, unknown>;
|
|
41
|
+
}
|
|
42
|
+
export interface RouteBindingPatchInput {
|
|
43
|
+
readonly sessionPolicy?: AutomationSessionPolicy;
|
|
44
|
+
readonly threadPolicy?: AutomationThreadPolicy;
|
|
45
|
+
readonly deliveryGuarantee?: AutomationDeliveryGuarantee;
|
|
46
|
+
readonly threadId?: string;
|
|
47
|
+
readonly channelId?: string;
|
|
48
|
+
readonly sessionId?: string | null;
|
|
49
|
+
readonly jobId?: string | null;
|
|
50
|
+
readonly runId?: string | null;
|
|
51
|
+
readonly title?: string;
|
|
52
|
+
readonly metadata?: Record<string, unknown>;
|
|
53
|
+
}
|
|
54
|
+
export interface RouteBindingManagerLike {
|
|
55
|
+
listBindings(): readonly unknown[];
|
|
56
|
+
upsertBinding(input: RouteBindingRecordInput): Promise<unknown>;
|
|
57
|
+
patchBinding(bindingId: string, input: RouteBindingPatchInput): Promise<unknown | null>;
|
|
58
|
+
removeBinding(bindingId: string): Promise<boolean>;
|
|
59
|
+
}
|
|
60
|
+
export interface WatcherSourceRecord {
|
|
61
|
+
readonly id: string;
|
|
62
|
+
readonly kind: string;
|
|
63
|
+
readonly label: string;
|
|
64
|
+
readonly enabled: boolean;
|
|
65
|
+
readonly createdAt: number;
|
|
66
|
+
readonly updatedAt: number;
|
|
67
|
+
readonly metadata: Record<string, unknown>;
|
|
68
|
+
}
|
|
69
|
+
export interface WatcherRecord {
|
|
70
|
+
readonly id: string;
|
|
71
|
+
readonly label: string;
|
|
72
|
+
readonly kind: WatcherKind;
|
|
73
|
+
readonly source: WatcherSourceRecord;
|
|
74
|
+
readonly intervalMs?: number;
|
|
75
|
+
readonly metadata: Record<string, unknown>;
|
|
76
|
+
}
|
|
77
|
+
export interface WatcherRegistryLike {
|
|
78
|
+
list(): readonly unknown[];
|
|
79
|
+
removeWatcher(watcherId: string): boolean;
|
|
80
|
+
registerWatcher(input: {
|
|
81
|
+
readonly id: string;
|
|
82
|
+
readonly label: string;
|
|
83
|
+
readonly kind: WatcherKind;
|
|
84
|
+
readonly source: WatcherSourceRecord;
|
|
85
|
+
readonly intervalMs: number;
|
|
86
|
+
readonly metadata: Record<string, unknown>;
|
|
87
|
+
readonly run?: () => string;
|
|
88
|
+
}): WatcherRecord;
|
|
89
|
+
getWatcher(watcherId: string): WatcherRecord | null;
|
|
90
|
+
startWatcher(watcherId: string): WatcherRecord | null;
|
|
91
|
+
stopWatcher(watcherId: string, reason: string): WatcherRecord | null;
|
|
92
|
+
runWatcherNow(watcherId: string): Promise<WatcherRecord | null>;
|
|
93
|
+
}
|
|
94
|
+
export interface ApprovalBrokerLike {
|
|
95
|
+
claimApproval(approvalId: string, actor: string, actorSurface: string, note?: string): Promise<unknown | null>;
|
|
96
|
+
cancelApproval(approvalId: string, actor: string, actorSurface: string, note?: string): Promise<unknown | null>;
|
|
97
|
+
resolveApproval(approvalId: string, input: {
|
|
98
|
+
readonly approved: boolean;
|
|
99
|
+
readonly remember: boolean;
|
|
100
|
+
readonly actor: string;
|
|
101
|
+
readonly actorSurface: string;
|
|
102
|
+
readonly note?: string;
|
|
103
|
+
}): Promise<unknown | null>;
|
|
104
|
+
}
|
|
105
|
+
export interface DaemonSystemRouteContext {
|
|
106
|
+
readonly approvalBroker: ApprovalBrokerLike;
|
|
107
|
+
readonly configManager: ConfigManagerLike;
|
|
108
|
+
readonly integrationHelpers: IntegrationApprovalSnapshotSourceLike | null;
|
|
109
|
+
readonly inspectInboundTls: (surface: 'controlPlane' | 'httpListener') => unknown;
|
|
110
|
+
readonly inspectOutboundTls: () => unknown;
|
|
111
|
+
readonly isValidConfigKey: (key: string) => boolean;
|
|
112
|
+
readonly parseJsonBody: (req: Request) => Promise<JsonRecord | Response>;
|
|
113
|
+
readonly parseOptionalJsonBody: (req: Request) => Promise<JsonRecord | null | Response>;
|
|
114
|
+
readonly platformServiceManager: PlatformServiceManagerLike;
|
|
115
|
+
readonly recordApiResponse: (req: Request, path: string, response: Response, clientKind?: DaemonApiClientKind) => Response;
|
|
116
|
+
readonly requireAdmin: (req: Request) => Response | null;
|
|
117
|
+
readonly requireAuthenticatedSession: (req: Request) => {
|
|
118
|
+
username: string;
|
|
119
|
+
roles: readonly string[];
|
|
120
|
+
} | null;
|
|
121
|
+
readonly routeBindings: RouteBindingManagerLike;
|
|
122
|
+
readonly watcherRegistry: WatcherRegistryLike;
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=system-route-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system-route-types.d.ts","sourceRoot":"","sources":["../src/system-route-types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,MAAM,MAAM,mBAAmB,GAC3B,KAAK,GACL,OAAO,GACP,SAAS,GACT,MAAM,GACN,SAAS,GACT,UAAU,GACV,aAAa,GACb,QAAQ,GACR,UAAU,GACV,UAAU,GACV,SAAS,GACT,aAAa,GACb,YAAY,GACZ,QAAQ,GACR,QAAQ,CAAC;AAEb,MAAM,MAAM,0BAA0B,GAAG,MAAM,CAAC;AAChD,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC;AAC3C,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC;AAC7C,M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AAK,OAAO,CAAC;IAClF,QAAQ,CAAC,kBAAkB,EAAE,MAAM,OAAO,CAAC;IAC3C,QAAQ,CAAC,gBAAgB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;IACpD,QAAQ,CAAC,aAAa,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,UAAU,GAAG,QAAQ,CAAC,CAAC;IACzE,QAAQ,CAAC,qBAAqB,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,UAAU,GAAG,IAAI,GAAG,QAAQ,CAAC,CAAC;IACxF,QAAQ,CAAC,sBAAsB,EAAE,0BAA0B,CAAC;IAC5D,QAAQ,CAAC,iBAAiB,EAAE,CAC1B,GAAG,EAAE,OAAO,EACZ,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,QAAQ,EAClB,UAAU,CAAC,EAAE,mBAAmB,KAC7B,QAAQ,CAAC;IACd,QAAQ,CAAC,YAAY,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,QAAQ,GAAG,IAAI,CAAC;IACzD,QAAQ,CAAC,2BAA2B,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;KAAE,GAAG,IAAI,CAAC;IAC9G,QAAQ,CAAC,aAAa,EAAE,uBAAuB,CAAC;IAChD,QAAQ,CAAC,eAAe,EAAE,mBAAmB,CAAC;CAC/C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DaemonApiRouteHandlers } from './context.js';
|
|
2
|
+
import type { DaemonSystemRouteContext } from './system-route-types.js';
|
|
3
|
+
export declare function createDaemonSystemRouteHandlers(context: DaemonSystemRouteContext, request: Request): Pick<DaemonApiRouteHandlers, 'getWatchers' | 'postWatcher' | 'patchWatcher' | 'watcherAction' | 'deleteWatcher' | 'getServiceStatus' | 'installService' | 'startService' | 'stopService' | 'restartService' | 'uninstallService' | 'getRouteBindings' | 'postRouteBinding' | 'patchRouteBinding' | 'deleteRouteBinding' | 'getApprovals' | 'approvalAction' | 'getConfig' | 'postConfig'>;
|
|
4
|
+
//# sourceMappingURL=system-routes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system-routes.d.ts","sourceRoot":"","sources":["../src/system-routes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAG3D,OAAO,KAAK,EAMV,wBAAwB,EAEzB,MAAM,yBAAyB,CAAC;AAEjC,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,wBAAwB,EACjC,OAAO,EAAE,OAAO,GACf,IAAI,CACL,sBAAsB,EACpB,aAAa,GACb,aAAa,GACb,cAAc,GACd,eAAe,GACf,eAAe,GACf,kBAAkB,GAClB,gBAAgB,GAChB,cAAc,GACd,aAAa,GACb,gBAAgB,GAChB,kBAAkB,GAClB,kBAAkB,GAClB,kBAAkB,GAClB,mBAAmB,GACnB,oBAAoB,GACpB,cAAc,GACd,gBAAgB,GAChB,WAAW,GACX,YAAY,CACf,CAwJA"}
|