@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,582 @@
|
|
|
1
|
+
import { buildMissingScopeBody, resolvePrivateHostFetchOptions, } from './http-policy.js';
|
|
2
|
+
import { jsonErrorResponse, summarizeErrorForRecord } from './error-response.js';
|
|
3
|
+
export function createDaemonKnowledgeRouteHandlers(context) {
|
|
4
|
+
return {
|
|
5
|
+
getKnowledgeStatus: async () => Response.json(await context.knowledgeService.getStatus()),
|
|
6
|
+
getKnowledgeSources: async (url) => Response.json({ sources: context.knowledgeService.listSources(readLimit(url, 100)) }),
|
|
7
|
+
getKnowledgeNodes: async (url) => Response.json({ nodes: context.knowledgeService.listNodes(readLimit(url, 100)) }),
|
|
8
|
+
getKnowledgeIssues: async (url) => Response.json({ issues: context.knowledgeService.listIssues(readLimit(url, 100)) }),
|
|
9
|
+
getKnowledgeItem: (id) => {
|
|
10
|
+
const item = context.knowledgeService.getItem(id);
|
|
11
|
+
return item
|
|
12
|
+
? Response.json(item)
|
|
13
|
+
: Response.json({ error: 'Unknown knowledge item' }, { status: 404 });
|
|
14
|
+
},
|
|
15
|
+
getKnowledgeConnectors: () => Response.json({ connectors: context.knowledgeService.listConnectors() }),
|
|
16
|
+
getKnowledgeConnector: (id) => {
|
|
17
|
+
const connector = context.knowledgeService.getConnector(id);
|
|
18
|
+
return connector
|
|
19
|
+
? Response.json({ connector })
|
|
20
|
+
: Response.json({ error: 'Unknown knowledge connector' }, { status: 404 });
|
|
21
|
+
},
|
|
22
|
+
getKnowledgeConnectorDoctor: async (id) => {
|
|
23
|
+
const report = await context.knowledgeService.doctorConnector(id);
|
|
24
|
+
return report
|
|
25
|
+
? Response.json({ report })
|
|
26
|
+
: Response.json({ error: 'Unknown knowledge connector' }, { status: 404 });
|
|
27
|
+
},
|
|
28
|
+
getKnowledgeProjectionTargets: async (url) => Response.json({ targets: await context.knowledgeService.listProjectionTargets(readLimit(url, 25)) }),
|
|
29
|
+
getKnowledgeGraphqlSchema: () => Response.json({
|
|
30
|
+
language: 'graphql',
|
|
31
|
+
domain: 'knowledge',
|
|
32
|
+
schema: context.knowledgeGraphqlService.schemaText,
|
|
33
|
+
}),
|
|
34
|
+
getKnowledgeExtractions: async (url) => {
|
|
35
|
+
const sourceId = url.searchParams.get('sourceId') ?? undefined;
|
|
36
|
+
return Response.json({ extractions: context.knowledgeService.listExtractions(readLimit(url, 100), sourceId) });
|
|
37
|
+
},
|
|
38
|
+
getKnowledgeUsage: async (url) => {
|
|
39
|
+
const targetKind = url.searchParams.get('targetKind') ?? undefined;
|
|
40
|
+
const targetId = url.searchParams.get('targetId') ?? undefined;
|
|
41
|
+
const usageKind = url.searchParams.get('usageKind') ?? undefined;
|
|
42
|
+
return Response.json({
|
|
43
|
+
usage: context.knowledgeService.listUsageRecords(readLimit(url, 100), {
|
|
44
|
+
...(targetKind ? { targetKind: targetKind } : {}),
|
|
45
|
+
...(targetId ? { targetId } : {}),
|
|
46
|
+
...(usageKind ? { usageKind: usageKind } : {}),
|
|
47
|
+
}),
|
|
48
|
+
});
|
|
49
|
+
},
|
|
50
|
+
getKnowledgeCandidates: async (url) => {
|
|
51
|
+
const status = url.searchParams.get('status') ?? undefined;
|
|
52
|
+
const subjectKind = url.searchParams.get('subjectKind') ?? undefined;
|
|
53
|
+
const subjectId = url.searchParams.get('subjectId') ?? undefined;
|
|
54
|
+
return Response.json({
|
|
55
|
+
candidates: context.knowledgeService.listConsolidationCandidates(readLimit(url, 100), {
|
|
56
|
+
...(status ? { status: status } : {}),
|
|
57
|
+
...(subjectKind ? { subjectKind: subjectKind } : {}),
|
|
58
|
+
...(subjectId ? { subjectId } : {}),
|
|
59
|
+
}),
|
|
60
|
+
});
|
|
61
|
+
},
|
|
62
|
+
getKnowledgeCandidate: (id) => {
|
|
63
|
+
const candidate = context.knowledgeService.getConsolidationCandidate(id);
|
|
64
|
+
return candidate
|
|
65
|
+
? Response.json({ candidate })
|
|
66
|
+
: Response.json({ error: 'Unknown knowledge consolidation candidate' }, { status: 404 });
|
|
67
|
+
},
|
|
68
|
+
getKnowledgeReports: async (url) => Response.json({ reports: context.knowledgeService.listConsolidationReports(readLimit(url, 100)) }),
|
|
69
|
+
getKnowledgeReport: (id) => {
|
|
70
|
+
const report = context.knowledgeService.getConsolidationReport(id);
|
|
71
|
+
return report
|
|
72
|
+
? Response.json({ report })
|
|
73
|
+
: Response.json({ error: 'Unknown knowledge consolidation report' }, { status: 404 });
|
|
74
|
+
},
|
|
75
|
+
getKnowledgeExtraction: (id) => {
|
|
76
|
+
const extraction = context.knowledgeService.getExtraction(id);
|
|
77
|
+
return extraction
|
|
78
|
+
? Response.json({ extraction })
|
|
79
|
+
: Response.json({ error: 'Unknown knowledge extraction' }, { status: 404 });
|
|
80
|
+
},
|
|
81
|
+
getKnowledgeSourceExtraction: (id) => {
|
|
82
|
+
const extraction = context.knowledgeService.getSourceExtraction(id);
|
|
83
|
+
return extraction
|
|
84
|
+
? Response.json({ extraction })
|
|
85
|
+
: Response.json({ error: 'Unknown source extraction' }, { status: 404 });
|
|
86
|
+
},
|
|
87
|
+
getKnowledgeJobs: () => Response.json({ jobs: context.knowledgeService.listJobs() }),
|
|
88
|
+
getKnowledgeJob: (jobId) => {
|
|
89
|
+
const job = context.knowledgeService.getJob(jobId);
|
|
90
|
+
return job
|
|
91
|
+
? Response.json({ job })
|
|
92
|
+
: Response.json({ error: 'Unknown knowledge job' }, { status: 404 });
|
|
93
|
+
},
|
|
94
|
+
getKnowledgeJobRuns: (url) => {
|
|
95
|
+
const jobId = url.searchParams.get('jobId') ?? undefined;
|
|
96
|
+
return Response.json({ runs: context.knowledgeService.listJobRuns(readLimit(url, 25), jobId) });
|
|
97
|
+
},
|
|
98
|
+
getKnowledgeSchedules: (url) => Response.json({ schedules: context.knowledgeService.listSchedules(readLimit(url, 100)) }),
|
|
99
|
+
getKnowledgeSchedule: (id) => {
|
|
100
|
+
const schedule = context.knowledgeService.getSchedule(id);
|
|
101
|
+
return schedule
|
|
102
|
+
? Response.json({ schedule })
|
|
103
|
+
: Response.json({ error: 'Unknown knowledge schedule' }, { status: 404 });
|
|
104
|
+
},
|
|
105
|
+
postKnowledgeIngestUrl: async (request) => handleKnowledgeIngestUrl(context, request),
|
|
106
|
+
postKnowledgeIngestArtifact: async (request) => handleKnowledgeIngestArtifact(context, request),
|
|
107
|
+
postKnowledgeImportBookmarks: async (request) => handleKnowledgeImportBookmarks(context, request),
|
|
108
|
+
postKnowledgeImportUrls: async (request) => handleKnowledgeImportUrls(context, request),
|
|
109
|
+
postKnowledgeIngestConnector: async (request) => handleKnowledgeIngestConnector(context, request),
|
|
110
|
+
postKnowledgeSearch: async (request) => handleKnowledgeSearch(context, request),
|
|
111
|
+
postKnowledgePacket: async (request) => handleKnowledgePacket(context, request),
|
|
112
|
+
postKnowledgeDecideCandidate: async (id, request) => handleKnowledgeDecideCandidate(context, id, request),
|
|
113
|
+
postKnowledgeRunJob: async (jobId, request) => handleKnowledgeRunJob(context, jobId, request),
|
|
114
|
+
postKnowledgeLint: async (request) => {
|
|
115
|
+
const admin = context.requireAdmin(request);
|
|
116
|
+
if (admin)
|
|
117
|
+
return admin;
|
|
118
|
+
return Response.json({ issues: await context.knowledgeService.lint() });
|
|
119
|
+
},
|
|
120
|
+
postKnowledgeReindex: async (request) => {
|
|
121
|
+
const admin = context.requireAdmin(request);
|
|
122
|
+
if (admin)
|
|
123
|
+
return admin;
|
|
124
|
+
return Response.json(await context.knowledgeService.reindex());
|
|
125
|
+
},
|
|
126
|
+
postKnowledgeSaveSchedule: async (request) => handleKnowledgeSaveSchedule(context, request),
|
|
127
|
+
deleteKnowledgeSchedule: async (id, request) => {
|
|
128
|
+
const admin = context.requireAdmin(request);
|
|
129
|
+
if (admin)
|
|
130
|
+
return admin;
|
|
131
|
+
const deleted = await context.knowledgeService.deleteSchedule(id);
|
|
132
|
+
return deleted
|
|
133
|
+
? Response.json({ deleted: true })
|
|
134
|
+
: Response.json({ error: 'Unknown knowledge schedule' }, { status: 404 });
|
|
135
|
+
},
|
|
136
|
+
postKnowledgeSetScheduleEnabled: async (id, request) => handleKnowledgeSetScheduleEnabled(context, id, request),
|
|
137
|
+
postKnowledgeRenderProjection: async (request) => handleKnowledgeRenderProjection(context, request),
|
|
138
|
+
postKnowledgeMaterializeProjection: async (request) => handleKnowledgeMaterializeProjection(context, request),
|
|
139
|
+
executeKnowledgeGraphql: async (request) => handleKnowledgeGraphql(context, request),
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
function readLimit(url, fallback) {
|
|
143
|
+
return Math.max(1, Number(url.searchParams.get('limit') ?? fallback) || fallback);
|
|
144
|
+
}
|
|
145
|
+
function readKnowledgeProjectionRequest(body) {
|
|
146
|
+
const rawKind = typeof body.kind === 'string' ? body.kind.trim().toLowerCase() : '';
|
|
147
|
+
if (rawKind !== 'overview'
|
|
148
|
+
&& rawKind !== 'bundle'
|
|
149
|
+
&& rawKind !== 'source'
|
|
150
|
+
&& rawKind !== 'node'
|
|
151
|
+
&& rawKind !== 'issue') {
|
|
152
|
+
return Response.json({ error: 'Projection kind must be one of overview, bundle, source, node, or issue.' }, { status: 400 });
|
|
153
|
+
}
|
|
154
|
+
const id = typeof body.id === 'string' ? body.id.trim() : '';
|
|
155
|
+
if ((rawKind === 'source' || rawKind === 'node' || rawKind === 'issue') && !id) {
|
|
156
|
+
return Response.json({ error: `Projection kind ${rawKind} requires id.` }, { status: 400 });
|
|
157
|
+
}
|
|
158
|
+
return {
|
|
159
|
+
kind: rawKind,
|
|
160
|
+
...(id ? { id } : {}),
|
|
161
|
+
...(typeof body.limit === 'number' ? { limit: Math.max(1, body.limit) } : {}),
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
function readKnowledgeSchedule(context, value) {
|
|
165
|
+
if (typeof value !== 'object' || value === null) {
|
|
166
|
+
return Response.json({ error: 'Missing schedule object' }, { status: 400 });
|
|
167
|
+
}
|
|
168
|
+
const schedule = value;
|
|
169
|
+
const kind = typeof schedule.kind === 'string' ? schedule.kind.trim().toLowerCase() : '';
|
|
170
|
+
try {
|
|
171
|
+
switch (kind) {
|
|
172
|
+
case 'every':
|
|
173
|
+
if (typeof schedule.intervalMs === 'number') {
|
|
174
|
+
return context.normalizeEverySchedule(schedule.intervalMs, typeof schedule.anchorAt === 'number' ? schedule.anchorAt : undefined);
|
|
175
|
+
}
|
|
176
|
+
if (typeof schedule.interval === 'string') {
|
|
177
|
+
return context.normalizeEverySchedule(schedule.interval, typeof schedule.anchorAt === 'number' ? schedule.anchorAt : undefined);
|
|
178
|
+
}
|
|
179
|
+
throw new Error('Every schedule requires intervalMs or interval.');
|
|
180
|
+
case 'cron':
|
|
181
|
+
if (typeof schedule.expression !== 'string' || !schedule.expression.trim()) {
|
|
182
|
+
throw new Error('Cron schedule requires expression.');
|
|
183
|
+
}
|
|
184
|
+
return context.normalizeCronSchedule(schedule.expression, typeof schedule.timezone === 'string' ? schedule.timezone : undefined, schedule.staggerMs);
|
|
185
|
+
case 'at':
|
|
186
|
+
if (typeof schedule.at !== 'number')
|
|
187
|
+
throw new Error('At schedule requires at.');
|
|
188
|
+
return context.normalizeAtSchedule(schedule.at);
|
|
189
|
+
default:
|
|
190
|
+
throw new Error('Schedule kind must be at, every, or cron.');
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
catch (error) {
|
|
194
|
+
return jsonErrorResponse(error, { status: 400 });
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
function readGraphqlVariables(value, parseJsonText) {
|
|
198
|
+
if (value === undefined || value === null || value === '')
|
|
199
|
+
return undefined;
|
|
200
|
+
if (typeof value === 'string') {
|
|
201
|
+
const parsed = parseJsonText(value);
|
|
202
|
+
if (parsed instanceof Response)
|
|
203
|
+
return parsed;
|
|
204
|
+
return parsed;
|
|
205
|
+
}
|
|
206
|
+
if (typeof value === 'object') {
|
|
207
|
+
return value;
|
|
208
|
+
}
|
|
209
|
+
return Response.json({ error: 'GraphQL variables must be an object or JSON string.' }, { status: 400 });
|
|
210
|
+
}
|
|
211
|
+
async function parseKnowledgeGraphqlRequest(context, req) {
|
|
212
|
+
if (req.method === 'GET') {
|
|
213
|
+
const url = new URL(req.url);
|
|
214
|
+
const query = url.searchParams.get('query')?.trim() ?? '';
|
|
215
|
+
if (!query)
|
|
216
|
+
return Response.json({ error: 'Missing query' }, { status: 400 });
|
|
217
|
+
const variables = readGraphqlVariables(url.searchParams.get('variables'), context.parseJsonText);
|
|
218
|
+
if (variables instanceof Response)
|
|
219
|
+
return variables;
|
|
220
|
+
const operationName = url.searchParams.get('operationName')?.trim();
|
|
221
|
+
return {
|
|
222
|
+
query,
|
|
223
|
+
...(operationName ? { operationName } : {}),
|
|
224
|
+
...(variables ? { variables } : {}),
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
const contentType = req.headers.get('content-type')?.toLowerCase() ?? '';
|
|
228
|
+
if (contentType.startsWith('application/graphql')) {
|
|
229
|
+
const query = (await req.text()).trim();
|
|
230
|
+
return query
|
|
231
|
+
? { query }
|
|
232
|
+
: Response.json({ error: 'Missing query' }, { status: 400 });
|
|
233
|
+
}
|
|
234
|
+
const body = await context.parseOptionalJsonBody(req);
|
|
235
|
+
if (body instanceof Response)
|
|
236
|
+
return body;
|
|
237
|
+
if (!body)
|
|
238
|
+
return Response.json({ error: 'Missing query' }, { status: 400 });
|
|
239
|
+
const query = typeof body.query === 'string' ? body.query.trim() : '';
|
|
240
|
+
if (!query)
|
|
241
|
+
return Response.json({ error: 'Missing query' }, { status: 400 });
|
|
242
|
+
const variables = readGraphqlVariables(body.variables, context.parseJsonText);
|
|
243
|
+
if (variables instanceof Response)
|
|
244
|
+
return variables;
|
|
245
|
+
const operationName = typeof body.operationName === 'string' ? body.operationName.trim() : '';
|
|
246
|
+
return {
|
|
247
|
+
query,
|
|
248
|
+
...(operationName ? { operationName } : {}),
|
|
249
|
+
...(variables ? { variables } : {}),
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
async function handleKnowledgeGraphql(context, req) {
|
|
253
|
+
const parsed = await parseKnowledgeGraphqlRequest(context, req);
|
|
254
|
+
if (parsed instanceof Response)
|
|
255
|
+
return parsed;
|
|
256
|
+
if (req.method === 'GET' && /\bmutation\b/.test(parsed.query)) {
|
|
257
|
+
return Response.json({ error: 'GraphQL mutations must use POST.' }, { status: 405 });
|
|
258
|
+
}
|
|
259
|
+
const principal = context.resolveAuthenticatedPrincipal(req);
|
|
260
|
+
if (!principal) {
|
|
261
|
+
return Response.json({ error: 'Unauthorized' }, { status: 401 });
|
|
262
|
+
}
|
|
263
|
+
let access;
|
|
264
|
+
try {
|
|
265
|
+
access = context.inspectGraphqlAccess(parsed.query, parsed.operationName);
|
|
266
|
+
}
|
|
267
|
+
catch (error) {
|
|
268
|
+
return jsonErrorResponse(error, { status: 400 });
|
|
269
|
+
}
|
|
270
|
+
const scopeDenied = buildMissingScopeBody('knowledge GraphQL operation', access.requiredScopes, principal.scopes);
|
|
271
|
+
if (scopeDenied) {
|
|
272
|
+
return Response.json(scopeDenied, { status: 403 });
|
|
273
|
+
}
|
|
274
|
+
if (access.adminRequired && !principal.admin) {
|
|
275
|
+
return Response.json({ error: 'Knowledge GraphQL mutation requires admin access.' }, { status: 403 });
|
|
276
|
+
}
|
|
277
|
+
const result = await context.knowledgeGraphqlService.execute({
|
|
278
|
+
query: parsed.query,
|
|
279
|
+
...(parsed.operationName ? { operationName: parsed.operationName } : {}),
|
|
280
|
+
...(parsed.variables ? { variables: parsed.variables } : {}),
|
|
281
|
+
admin: principal.admin,
|
|
282
|
+
scopes: principal.scopes,
|
|
283
|
+
});
|
|
284
|
+
const status = result.errors?.length && !result.data ? 400 : 200;
|
|
285
|
+
return Response.json(result, { status });
|
|
286
|
+
}
|
|
287
|
+
function buildKnowledgePrivateHostFetchOptions(context, requested) {
|
|
288
|
+
return resolvePrivateHostFetchOptions(requested, {
|
|
289
|
+
configManager: context.configManager,
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
async function handleKnowledgeIngestUrl(context, request) {
|
|
293
|
+
const admin = context.requireAdmin(request);
|
|
294
|
+
if (admin)
|
|
295
|
+
return admin;
|
|
296
|
+
const body = await context.parseJsonBody(request);
|
|
297
|
+
if (body instanceof Response)
|
|
298
|
+
return body;
|
|
299
|
+
const url = typeof body.url === 'string' ? body.url.trim() : '';
|
|
300
|
+
if (!url)
|
|
301
|
+
return Response.json({ error: 'Missing url' }, { status: 400 });
|
|
302
|
+
const privateHostFetchOptions = buildKnowledgePrivateHostFetchOptions(context, body.allowPrivateHosts);
|
|
303
|
+
if (privateHostFetchOptions instanceof Response)
|
|
304
|
+
return privateHostFetchOptions;
|
|
305
|
+
try {
|
|
306
|
+
return Response.json(await context.knowledgeService.ingestUrl({
|
|
307
|
+
url,
|
|
308
|
+
...(typeof body.title === 'string' ? { title: body.title } : {}),
|
|
309
|
+
...(typeof body.folderPath === 'string' ? { folderPath: body.folderPath } : {}),
|
|
310
|
+
...(Array.isArray(body.tags) ? { tags: body.tags.filter((entry) => typeof entry === 'string') } : {}),
|
|
311
|
+
...(typeof body.sessionId === 'string' ? { sessionId: body.sessionId } : {}),
|
|
312
|
+
...(typeof body.sourceType === 'string' ? { sourceType: body.sourceType } : {}),
|
|
313
|
+
...(typeof body.connectorId === 'string' ? { connectorId: body.connectorId } : {}),
|
|
314
|
+
...privateHostFetchOptions,
|
|
315
|
+
...(typeof body.metadata === 'object' && body.metadata !== null ? { metadata: body.metadata } : {}),
|
|
316
|
+
}), { status: 201 });
|
|
317
|
+
}
|
|
318
|
+
catch (error) {
|
|
319
|
+
return jsonErrorResponse(error, { status: 400 });
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
async function handleKnowledgeIngestArtifact(context, request) {
|
|
323
|
+
const admin = context.requireAdmin(request);
|
|
324
|
+
if (admin)
|
|
325
|
+
return admin;
|
|
326
|
+
const body = await context.parseJsonBody(request);
|
|
327
|
+
if (body instanceof Response)
|
|
328
|
+
return body;
|
|
329
|
+
const privateHostFetchOptions = buildKnowledgePrivateHostFetchOptions(context, body.allowPrivateHosts);
|
|
330
|
+
if (privateHostFetchOptions instanceof Response)
|
|
331
|
+
return privateHostFetchOptions;
|
|
332
|
+
try {
|
|
333
|
+
return Response.json(await context.knowledgeService.ingestArtifact({
|
|
334
|
+
...(typeof body.artifactId === 'string' ? { artifactId: body.artifactId } : {}),
|
|
335
|
+
...(typeof body.path === 'string' ? { path: body.path } : {}),
|
|
336
|
+
...(typeof body.uri === 'string' ? { uri: body.uri } : {}),
|
|
337
|
+
...(typeof body.title === 'string' ? { title: body.title } : {}),
|
|
338
|
+
...(typeof body.folderPath === 'string' ? { folderPath: body.folderPath } : {}),
|
|
339
|
+
...(Array.isArray(body.tags) ? { tags: body.tags.filter((entry) => typeof entry === 'string') } : {}),
|
|
340
|
+
...(typeof body.sessionId === 'string' ? { sessionId: body.sessionId } : {}),
|
|
341
|
+
...(typeof body.sourceType === 'string' ? { sourceType: body.sourceType } : {}),
|
|
342
|
+
...(typeof body.connectorId === 'string' ? { connectorId: body.connectorId } : {}),
|
|
343
|
+
...privateHostFetchOptions,
|
|
344
|
+
...(typeof body.metadata === 'object' && body.metadata !== null ? { metadata: body.metadata } : {}),
|
|
345
|
+
}), { status: 201 });
|
|
346
|
+
}
|
|
347
|
+
catch (error) {
|
|
348
|
+
return jsonErrorResponse(error, { status: 400 });
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
async function handleKnowledgeImportBookmarks(context, request) {
|
|
352
|
+
const admin = context.requireAdmin(request);
|
|
353
|
+
if (admin)
|
|
354
|
+
return admin;
|
|
355
|
+
const body = await context.parseJsonBody(request);
|
|
356
|
+
if (body instanceof Response)
|
|
357
|
+
return body;
|
|
358
|
+
const path = typeof body.path === 'string' ? body.path.trim() : '';
|
|
359
|
+
if (!path)
|
|
360
|
+
return Response.json({ error: 'Missing path' }, { status: 400 });
|
|
361
|
+
const privateHostFetchOptions = buildKnowledgePrivateHostFetchOptions(context, body.allowPrivateHosts);
|
|
362
|
+
if (privateHostFetchOptions instanceof Response)
|
|
363
|
+
return privateHostFetchOptions;
|
|
364
|
+
try {
|
|
365
|
+
return Response.json(await context.knowledgeService.importBookmarksFromFile({
|
|
366
|
+
path,
|
|
367
|
+
...(typeof body.sessionId === 'string' ? { sessionId: body.sessionId } : {}),
|
|
368
|
+
...privateHostFetchOptions,
|
|
369
|
+
}), { status: 201 });
|
|
370
|
+
}
|
|
371
|
+
catch (error) {
|
|
372
|
+
return jsonErrorResponse(error, { status: 400 });
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
async function handleKnowledgeImportUrls(context, request) {
|
|
376
|
+
const admin = context.requireAdmin(request);
|
|
377
|
+
if (admin)
|
|
378
|
+
return admin;
|
|
379
|
+
const body = await context.parseJsonBody(request);
|
|
380
|
+
if (body instanceof Response)
|
|
381
|
+
return body;
|
|
382
|
+
const path = typeof body.path === 'string' ? body.path.trim() : '';
|
|
383
|
+
if (!path)
|
|
384
|
+
return Response.json({ error: 'Missing path' }, { status: 400 });
|
|
385
|
+
const privateHostFetchOptions = buildKnowledgePrivateHostFetchOptions(context, body.allowPrivateHosts);
|
|
386
|
+
if (privateHostFetchOptions instanceof Response)
|
|
387
|
+
return privateHostFetchOptions;
|
|
388
|
+
try {
|
|
389
|
+
return Response.json(await context.knowledgeService.importUrlsFromFile({
|
|
390
|
+
path,
|
|
391
|
+
...(typeof body.sessionId === 'string' ? { sessionId: body.sessionId } : {}),
|
|
392
|
+
...privateHostFetchOptions,
|
|
393
|
+
}), { status: 201 });
|
|
394
|
+
}
|
|
395
|
+
catch (error) {
|
|
396
|
+
return jsonErrorResponse(error, { status: 400 });
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
async function handleKnowledgeIngestConnector(context, request) {
|
|
400
|
+
const admin = context.requireAdmin(request);
|
|
401
|
+
if (admin)
|
|
402
|
+
return admin;
|
|
403
|
+
const body = await context.parseJsonBody(request);
|
|
404
|
+
if (body instanceof Response)
|
|
405
|
+
return body;
|
|
406
|
+
const connectorId = typeof body.connectorId === 'string' ? body.connectorId.trim() : '';
|
|
407
|
+
if (!connectorId)
|
|
408
|
+
return Response.json({ error: 'Missing connectorId' }, { status: 400 });
|
|
409
|
+
const privateHostFetchOptions = buildKnowledgePrivateHostFetchOptions(context, body.allowPrivateHosts);
|
|
410
|
+
if (privateHostFetchOptions instanceof Response)
|
|
411
|
+
return privateHostFetchOptions;
|
|
412
|
+
try {
|
|
413
|
+
return Response.json(await context.knowledgeService.ingestConnectorInput({
|
|
414
|
+
connectorId,
|
|
415
|
+
...(Object.hasOwn(body, 'input') ? { input: body.input } : {}),
|
|
416
|
+
...(typeof body.content === 'string' ? { content: body.content } : {}),
|
|
417
|
+
...(typeof body.path === 'string' ? { path: body.path } : {}),
|
|
418
|
+
...(typeof body.sessionId === 'string' ? { sessionId: body.sessionId } : {}),
|
|
419
|
+
...privateHostFetchOptions,
|
|
420
|
+
}), { status: 201 });
|
|
421
|
+
}
|
|
422
|
+
catch (error) {
|
|
423
|
+
return jsonErrorResponse(error, { status: 400 });
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
async function handleKnowledgeSearch(context, request) {
|
|
427
|
+
const body = await context.parseJsonBody(request);
|
|
428
|
+
if (body instanceof Response)
|
|
429
|
+
return body;
|
|
430
|
+
const query = typeof body.query === 'string' ? body.query.trim() : '';
|
|
431
|
+
if (!query)
|
|
432
|
+
return Response.json({ error: 'Missing query' }, { status: 400 });
|
|
433
|
+
const limit = typeof body.limit === 'number' ? body.limit : 10;
|
|
434
|
+
return Response.json({ results: context.knowledgeService.search(query, limit) });
|
|
435
|
+
}
|
|
436
|
+
async function handleKnowledgePacket(context, request) {
|
|
437
|
+
const body = await context.parseJsonBody(request);
|
|
438
|
+
if (body instanceof Response)
|
|
439
|
+
return body;
|
|
440
|
+
const task = typeof body.task === 'string' ? body.task.trim() : '';
|
|
441
|
+
if (!task)
|
|
442
|
+
return Response.json({ error: 'Missing task' }, { status: 400 });
|
|
443
|
+
const writeScope = Array.isArray(body.writeScope) ? body.writeScope.filter((entry) => typeof entry === 'string') : [];
|
|
444
|
+
const limit = typeof body.limit === 'number' ? body.limit : 6;
|
|
445
|
+
const detail = typeof body.detail === 'string'
|
|
446
|
+
? body.detail.toLowerCase()
|
|
447
|
+
: undefined;
|
|
448
|
+
const budgetLimit = typeof body.budgetLimit === 'number' ? body.budgetLimit : undefined;
|
|
449
|
+
return Response.json(await context.knowledgeService.buildPacket(task, writeScope, limit, {
|
|
450
|
+
...(detail ? { detail } : {}),
|
|
451
|
+
...(typeof budgetLimit === 'number' ? { budgetLimit } : {}),
|
|
452
|
+
}));
|
|
453
|
+
}
|
|
454
|
+
async function handleKnowledgeDecideCandidate(context, id, request) {
|
|
455
|
+
const admin = context.requireAdmin(request);
|
|
456
|
+
if (admin)
|
|
457
|
+
return admin;
|
|
458
|
+
const body = await context.parseJsonBody(request);
|
|
459
|
+
if (body instanceof Response)
|
|
460
|
+
return body;
|
|
461
|
+
const decision = typeof body.decision === 'string' ? body.decision.trim().toLowerCase() : '';
|
|
462
|
+
if (decision !== 'accept' && decision !== 'reject' && decision !== 'supersede') {
|
|
463
|
+
return Response.json({ error: 'Decision must be accept, reject, or supersede.' }, { status: 400 });
|
|
464
|
+
}
|
|
465
|
+
try {
|
|
466
|
+
return Response.json({
|
|
467
|
+
candidate: await context.knowledgeService.decideConsolidationCandidate(id, decision, {
|
|
468
|
+
...(typeof body.decidedBy === 'string' ? { decidedBy: body.decidedBy } : {}),
|
|
469
|
+
...(typeof body.memoryClass === 'string' ? { memoryClass: body.memoryClass } : {}),
|
|
470
|
+
...(typeof body.scope === 'string' ? { scope: body.scope } : {}),
|
|
471
|
+
...(typeof body.detail === 'string' ? { detail: body.detail } : {}),
|
|
472
|
+
}),
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
catch (error) {
|
|
476
|
+
const message = summarizeErrorForRecord(error);
|
|
477
|
+
return jsonErrorResponse(error, {
|
|
478
|
+
status: message.startsWith('Unknown knowledge consolidation candidate:') ? 404 : 400,
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
async function handleKnowledgeRunJob(context, jobId, request) {
|
|
483
|
+
const admin = context.requireAdmin(request);
|
|
484
|
+
if (admin)
|
|
485
|
+
return admin;
|
|
486
|
+
const body = await context.parseJsonBody(request);
|
|
487
|
+
if (body instanceof Response)
|
|
488
|
+
return body;
|
|
489
|
+
try {
|
|
490
|
+
return Response.json({
|
|
491
|
+
run: await context.knowledgeService.runJob(jobId, {
|
|
492
|
+
...(typeof body.mode === 'string' ? { mode: body.mode.toLowerCase() } : {}),
|
|
493
|
+
...(Array.isArray(body.sourceIds) ? { sourceIds: body.sourceIds.filter((entry) => typeof entry === 'string') } : {}),
|
|
494
|
+
...(typeof body.limit === 'number' ? { limit: body.limit } : {}),
|
|
495
|
+
}),
|
|
496
|
+
});
|
|
497
|
+
}
|
|
498
|
+
catch (error) {
|
|
499
|
+
const message = summarizeErrorForRecord(error);
|
|
500
|
+
return jsonErrorResponse(error, {
|
|
501
|
+
status: message.startsWith('Unknown knowledge job:') ? 404 : 400,
|
|
502
|
+
});
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
async function handleKnowledgeSaveSchedule(context, request) {
|
|
506
|
+
const admin = context.requireAdmin(request);
|
|
507
|
+
if (admin)
|
|
508
|
+
return admin;
|
|
509
|
+
const body = await context.parseJsonBody(request);
|
|
510
|
+
if (body instanceof Response)
|
|
511
|
+
return body;
|
|
512
|
+
const jobId = typeof body.jobId === 'string' ? body.jobId.trim() : '';
|
|
513
|
+
if (!jobId)
|
|
514
|
+
return Response.json({ error: 'Missing jobId' }, { status: 400 });
|
|
515
|
+
const schedule = readKnowledgeSchedule(context, body.schedule);
|
|
516
|
+
if (schedule instanceof Response)
|
|
517
|
+
return schedule;
|
|
518
|
+
try {
|
|
519
|
+
return Response.json({
|
|
520
|
+
schedule: await context.knowledgeService.saveSchedule({
|
|
521
|
+
...(typeof body.id === 'string' ? { id: body.id } : {}),
|
|
522
|
+
jobId,
|
|
523
|
+
schedule,
|
|
524
|
+
...(typeof body.label === 'string' ? { label: body.label } : {}),
|
|
525
|
+
...(typeof body.enabled === 'boolean' ? { enabled: body.enabled } : {}),
|
|
526
|
+
...(typeof body.metadata === 'object' && body.metadata !== null ? { metadata: body.metadata } : {}),
|
|
527
|
+
}),
|
|
528
|
+
}, { status: 201 });
|
|
529
|
+
}
|
|
530
|
+
catch (error) {
|
|
531
|
+
return jsonErrorResponse(error, { status: 400 });
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
async function handleKnowledgeSetScheduleEnabled(context, id, request) {
|
|
535
|
+
const admin = context.requireAdmin(request);
|
|
536
|
+
if (admin)
|
|
537
|
+
return admin;
|
|
538
|
+
const body = await context.parseJsonBody(request);
|
|
539
|
+
if (body instanceof Response)
|
|
540
|
+
return body;
|
|
541
|
+
if (typeof body.enabled !== 'boolean') {
|
|
542
|
+
return Response.json({ error: 'Missing enabled boolean' }, { status: 400 });
|
|
543
|
+
}
|
|
544
|
+
const schedule = await context.knowledgeService.setScheduleEnabled(id, body.enabled);
|
|
545
|
+
return schedule
|
|
546
|
+
? Response.json({ schedule })
|
|
547
|
+
: Response.json({ error: 'Unknown knowledge schedule' }, { status: 404 });
|
|
548
|
+
}
|
|
549
|
+
async function handleKnowledgeRenderProjection(context, request) {
|
|
550
|
+
const body = await context.parseJsonBody(request);
|
|
551
|
+
if (body instanceof Response)
|
|
552
|
+
return body;
|
|
553
|
+
const parsed = readKnowledgeProjectionRequest(body);
|
|
554
|
+
if (parsed instanceof Response)
|
|
555
|
+
return parsed;
|
|
556
|
+
try {
|
|
557
|
+
return Response.json(await context.knowledgeService.renderProjection(parsed));
|
|
558
|
+
}
|
|
559
|
+
catch (error) {
|
|
560
|
+
return jsonErrorResponse(error, { status: 400 });
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
async function handleKnowledgeMaterializeProjection(context, request) {
|
|
564
|
+
const admin = context.requireAdmin(request);
|
|
565
|
+
if (admin)
|
|
566
|
+
return admin;
|
|
567
|
+
const body = await context.parseJsonBody(request);
|
|
568
|
+
if (body instanceof Response)
|
|
569
|
+
return body;
|
|
570
|
+
const parsed = readKnowledgeProjectionRequest(body);
|
|
571
|
+
if (parsed instanceof Response)
|
|
572
|
+
return parsed;
|
|
573
|
+
try {
|
|
574
|
+
return Response.json(await context.knowledgeService.materializeProjection({
|
|
575
|
+
...parsed,
|
|
576
|
+
...(typeof body.filename === 'string' ? { filename: body.filename } : {}),
|
|
577
|
+
}), { status: 201 });
|
|
578
|
+
}
|
|
579
|
+
catch (error) {
|
|
580
|
+
return jsonErrorResponse(error, { status: 400 });
|
|
581
|
+
}
|
|
582
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export type ArtifactKind = string;
|
|
2
|
+
export type FetchExtractMode = string;
|
|
3
|
+
export type MediaArtifact = Record<string, unknown>;
|
|
4
|
+
export type MultimodalAnalysisResult = unknown;
|
|
5
|
+
export type MultimodalDetail = string;
|
|
6
|
+
export type VoiceAudioArtifact = Record<string, unknown>;
|
|
7
|
+
export type WebSearchSafeSearch = string;
|
|
8
|
+
export type WebSearchTimeRange = string;
|
|
9
|
+
export type WebSearchVerbosity = string;
|
|
10
|
+
export interface ConfigManagerLike {
|
|
11
|
+
get(key: string): unknown;
|
|
12
|
+
}
|
|
13
|
+
export interface VoiceServiceLike {
|
|
14
|
+
getStatus(enabled: boolean): Promise<{
|
|
15
|
+
providers: readonly unknown[];
|
|
16
|
+
}>;
|
|
17
|
+
listVoices(providerId?: string): Promise<readonly unknown[]>;
|
|
18
|
+
synthesize(providerId: string | undefined, input: Record<string, unknown>): Promise<unknown>;
|
|
19
|
+
transcribe(providerId: string | undefined, input: Record<string, unknown>): Promise<unknown>;
|
|
20
|
+
openRealtimeSession(providerId: string | undefined, input: Record<string, unknown>): Promise<unknown>;
|
|
21
|
+
}
|
|
22
|
+
export interface WebSearchServiceLike {
|
|
23
|
+
getStatus(): Promise<{
|
|
24
|
+
providers: readonly unknown[];
|
|
25
|
+
}>;
|
|
26
|
+
search(input: Record<string, unknown>): Promise<unknown>;
|
|
27
|
+
}
|
|
28
|
+
export interface ArtifactStoreLike {
|
|
29
|
+
list(): readonly unknown[];
|
|
30
|
+
create(input: Record<string, unknown>): Promise<unknown>;
|
|
31
|
+
get(artifactId: string): unknown | null;
|
|
32
|
+
readContent(artifactId: string): Promise<{
|
|
33
|
+
readonly record: {
|
|
34
|
+
readonly mimeType: string;
|
|
35
|
+
readonly filename?: string;
|
|
36
|
+
};
|
|
37
|
+
readonly buffer: ArrayBuffer | Uint8Array;
|
|
38
|
+
}>;
|
|
39
|
+
}
|
|
40
|
+
export interface MediaProviderLike {
|
|
41
|
+
analyze?(input: Record<string, unknown>): Promise<unknown>;
|
|
42
|
+
transform?(input: Record<string, unknown>): Promise<unknown>;
|
|
43
|
+
generate?(input: Record<string, unknown>): Promise<unknown>;
|
|
44
|
+
}
|
|
45
|
+
export interface MediaProviderRegistryLike {
|
|
46
|
+
status(): Promise<unknown>;
|
|
47
|
+
findProvider(capability: 'understand' | 'transform' | 'generate', providerId?: string): MediaProviderLike | null;
|
|
48
|
+
}
|
|
49
|
+
export interface MultimodalServiceLike {
|
|
50
|
+
getStatus(): Promise<unknown>;
|
|
51
|
+
listProviders(): Promise<readonly unknown[]>;
|
|
52
|
+
analyze(input: Record<string, unknown>): Promise<MultimodalAnalysisResult>;
|
|
53
|
+
buildPacket(analysis: MultimodalAnalysisResult, detail: MultimodalDetail, budgetLimit?: number): unknown;
|
|
54
|
+
writeBackAnalysis(analysis: MultimodalAnalysisResult, input: Record<string, unknown>): Promise<unknown>;
|
|
55
|
+
}
|
|
56
|
+
export interface DaemonMediaRouteContext {
|
|
57
|
+
readonly artifactStore: ArtifactStoreLike;
|
|
58
|
+
readonly configManager: ConfigManagerLike;
|
|
59
|
+
readonly mediaProviders: MediaProviderRegistryLike;
|
|
60
|
+
readonly multimodalService: MultimodalServiceLike;
|
|
61
|
+
readonly parseJsonBody: (req: Request) => Promise<Record<string, unknown> | Response>;
|
|
62
|
+
readonly requireAdmin: (req: Request) => Response | null;
|
|
63
|
+
readonly voiceService: VoiceServiceLike;
|
|
64
|
+
readonly webSearchService: WebSearchServiceLike;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=media-route-types.d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,0 +1,4 @@
|
|
|
1
|
+
import type { DaemonApiRouteHandlers } from './context.js';
|
|
2
|
+
import type { DaemonMediaRouteContext } from './media-route-types.js';
|
|
3
|
+
export declare function createDaemonMediaRouteHandlers(context: DaemonMediaRouteContext): Pick<DaemonApiRouteHandlers, 'getVoiceStatus' | 'getVoiceProviders' | 'getVoiceVoices' | 'postVoiceTts' | 'postVoiceStt' | 'postVoiceRealtimeSession' | 'getWebSearchProviders' | 'postWebSearch' | 'getArtifacts' | 'postArtifact' | 'getArtifact' | 'getArtifactContent' | 'getMediaProviders' | 'postMediaAnalyze' | 'postMediaTransform' | 'postMediaGenerate' | 'getMultimodalStatus' | 'getMultimodalProviders' | 'postMultimodalAnalyze' | 'postMultimodalPacket' | 'postMultimodalWriteback'>;
|
|
4
|
+
//# sourceMappingURL=media-routes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media-routes.d.ts","sourceRoot":"","sources":["../src/media-routes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAG3D,OAAO,KAAK,EAEV,uBAAuB,EASxB,MAAM,wBAAwB,CAAC;AAIhC,wBAAgB,8BAA8B,CAC5C,OAAO,EAAE,uBAAuB,GAC/B,IAAI,CACL,sBAAsB,EACpB,gBAAgB,GAChB,mBAAmB,GACnB,gBAAgB,GAChB,cAAc,GACd,cAAc,GACd,0BAA0B,GAC1B,uBAAuB,GACvB,eAAe,GACf,cAAc,GACd,cAAc,GACd,aAAa,GACb,oBAAoB,GACpB,mBAAmB,GACnB,kBAAkB,GAClB,oBAAoB,GACpB,mBAAmB,GACnB,qBAAqB,GACrB,wBAAwB,GACxB,uBAAuB,GACvB,sBAAsB,GACtB,yBAAyB,CAC5B,CA+BA"}
|