@konneal/engine 0.2.47 → 0.2.49
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/ask-OH5KPHZA.js +12 -0
- package/dist/attachments.d.ts +31 -0
- package/dist/{chunk-SE67PTJ6.js → chunk-4KA34NMU.js} +140 -5
- package/dist/{chunk-AKAFLMIB.js → chunk-DMIOBGQU.js} +4 -4
- package/dist/{chunk-R2V3X6SQ.js → chunk-JWTIPQ4L.js} +1 -1
- package/dist/{chunk-4GJGBGJK.js → chunk-O6VZIDPW.js} +1 -1
- package/dist/{chunk-N2UOENDY.js → chunk-VVLNUHW2.js} +19 -2
- package/dist/{chunk-V46XM2GU.js → chunk-Z24IAKB6.js} +9 -0
- package/dist/config.d.ts +9 -0
- package/dist/entailment.d.ts +5 -0
- package/dist/env.d.ts +1 -0
- package/dist/openapi-surface.gen.d.ts +1 -1
- package/dist/openapi-types.d.ts +149 -0
- package/dist/search-KNB2S2PS.js +12 -0
- package/dist/worker_mcp/src/index.js +2 -2
- package/dist/worker_public/src/config.js +1 -1
- package/dist/worker_public/src/index.js +121 -119
- package/dist/worker_public/src/requestScope.js +2 -2
- package/package.json +1 -1
- package/workers/worker_public/migrations/0017_attachments.sql +12 -0
- package/workers/worker_public/openapi.yaml +69 -0
- package/workers/worker_public/schema.sql +10 -0
- package/workers/worker_public/src/ask.ts +23 -2
- package/workers/worker_public/src/attachments.ts +102 -0
- package/workers/worker_public/src/config.ts +9 -0
- package/workers/worker_public/src/entailment.ts +15 -0
- package/workers/worker_public/src/env.ts +1 -0
- package/workers/worker_public/src/index.ts +42 -0
- package/workers/worker_public/src/openapi-surface.gen.ts +24 -0
- package/workers/worker_public/src/ports/blobs.ts +1 -0
- package/workers/worker_public/src/ports/cloudflare/adapters.ts +3 -0
- package/dist/ask-6QPD3QA5.js +0 -12
- package/dist/search-QZDQVB57.js +0 -12
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
handleAsk
|
|
3
|
+
} from "./chunk-4KA34NMU.js";
|
|
4
|
+
import "./chunk-VVLNUHW2.js";
|
|
5
|
+
import "./chunk-JWTIPQ4L.js";
|
|
6
|
+
import "./chunk-A3QHHUN5.js";
|
|
7
|
+
import "./chunk-O6VZIDPW.js";
|
|
8
|
+
import "./chunk-Z24IAKB6.js";
|
|
9
|
+
import "./chunk-3FYJM7LH.js";
|
|
10
|
+
export {
|
|
11
|
+
handleAsk
|
|
12
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Blobs } from "./ports/blobs.ts";
|
|
2
|
+
import type { StoreQuery } from "./ports/store.ts";
|
|
3
|
+
export interface AttachmentDeps {
|
|
4
|
+
blobs: Blobs;
|
|
5
|
+
store: StoreQuery;
|
|
6
|
+
}
|
|
7
|
+
export interface AttachmentRow {
|
|
8
|
+
id: string;
|
|
9
|
+
sub: string;
|
|
10
|
+
mime: string;
|
|
11
|
+
bytes: number;
|
|
12
|
+
created_at: string;
|
|
13
|
+
}
|
|
14
|
+
/** Sniff the image type from the magic bytes — the declared type is
|
|
15
|
+
* never trusted. Returns null for anything that is not one of the four
|
|
16
|
+
* allowed images or that exceeds the cap. */
|
|
17
|
+
export declare function sniffImage(head: Uint8Array, totalBytes: number): string | null;
|
|
18
|
+
/** A data URL (the composer's current shape) → { mime, bytes } or null. */
|
|
19
|
+
export declare function parseDataUrl(dataUrl: string): {
|
|
20
|
+
mime: string;
|
|
21
|
+
bytes: Uint8Array;
|
|
22
|
+
} | null;
|
|
23
|
+
export declare function uploadAttachment(deps: AttachmentDeps, sub: string, dataUrl: string): Promise<{
|
|
24
|
+
id: string;
|
|
25
|
+
} | Response>;
|
|
26
|
+
/** The ownership check every access runs first: the row must exist and
|
|
27
|
+
* belong to the caller. A foreign id is indistinguishable from a
|
|
28
|
+
* missing one (404 — never a confirmation of someone else's file). */
|
|
29
|
+
export declare function ownedAttachment(deps: AttachmentDeps, sub: string, id: string): Promise<AttachmentRow | null>;
|
|
30
|
+
export declare function readAttachment(deps: AttachmentDeps, sub: string, id: string): Promise<Response | null>;
|
|
31
|
+
export declare function deleteAttachment(deps: AttachmentDeps, sub: string, id: string): Promise<boolean>;
|
|
@@ -35,14 +35,14 @@ import {
|
|
|
35
35
|
syntheticUnderstanding,
|
|
36
36
|
telemetry,
|
|
37
37
|
understandQuery
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-VVLNUHW2.js";
|
|
39
39
|
import {
|
|
40
40
|
corsHeaders,
|
|
41
41
|
err,
|
|
42
42
|
json,
|
|
43
43
|
readJson,
|
|
44
44
|
validateQuery
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-JWTIPQ4L.js";
|
|
46
46
|
import {
|
|
47
47
|
canonicalRefusal,
|
|
48
48
|
refusalAnswer
|
|
@@ -52,17 +52,18 @@ import {
|
|
|
52
52
|
requestSalt,
|
|
53
53
|
resolveRequestScope,
|
|
54
54
|
standardKeysFrom
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-O6VZIDPW.js";
|
|
56
56
|
import {
|
|
57
57
|
LIMITS,
|
|
58
58
|
MODELS,
|
|
59
|
+
THRESHOLDS,
|
|
59
60
|
answerEffort,
|
|
60
61
|
effortBudget,
|
|
61
62
|
num,
|
|
62
63
|
requestEffort,
|
|
63
64
|
roleModel,
|
|
64
65
|
sha256Hex
|
|
65
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-Z24IAKB6.js";
|
|
66
67
|
import {
|
|
67
68
|
P
|
|
68
69
|
} from "./chunk-3FYJM7LH.js";
|
|
@@ -216,6 +217,125 @@ ${ctx}`
|
|
|
216
217
|
}
|
|
217
218
|
}
|
|
218
219
|
|
|
220
|
+
// workers/worker_public/prompts/faithfulness.md
|
|
221
|
+
var faithfulness_default = `You are a factuality judge. Given an answer and the retrieved passages it was based on, identify any claims in the answer that are NOT directly supported by the passages. Reply with ONLY a JSON object: {"score": 0.0-1.0, "ungrounded_claims": ["claim text", ...]} \u2014 score is the fraction of claims that ARE grounded in the passages; if every claim is supported, score is 1.0 and ungrounded_claims is [].
|
|
222
|
+
|
|
223
|
+
Passages prefixed [M] are this service's own machine-computed model data (typed blocks the answer was given) \u2014 a claim restating [M] content is grounded.
|
|
224
|
+
`;
|
|
225
|
+
|
|
226
|
+
// workers/worker_public/src/verdict-parse.ts
|
|
227
|
+
function coerceVerdict(obj) {
|
|
228
|
+
if (obj === null || typeof obj !== "object" || Array.isArray(obj)) return null;
|
|
229
|
+
const raw = obj.score;
|
|
230
|
+
const score = typeof raw === "number" ? raw : typeof raw === "string" && raw.trim() !== "" ? Number(raw) : NaN;
|
|
231
|
+
if (!Number.isFinite(score)) return null;
|
|
232
|
+
const claims = obj.ungrounded_claims;
|
|
233
|
+
return {
|
|
234
|
+
score: Math.max(0, Math.min(1, score)),
|
|
235
|
+
ungrounded_claims: Array.isArray(claims) ? claims.map(String).slice(0, 5) : []
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
function parseVerdict(text) {
|
|
239
|
+
const stripped = text.replace(/```[a-zA-Z]*\n?/g, "").replace(/```/g, "").trim();
|
|
240
|
+
try {
|
|
241
|
+
const whole = coerceVerdict(JSON.parse(stripped));
|
|
242
|
+
if (whole) return whole;
|
|
243
|
+
} catch {
|
|
244
|
+
}
|
|
245
|
+
let verdict = null;
|
|
246
|
+
let depth = 0;
|
|
247
|
+
let start = -1;
|
|
248
|
+
let inString = false;
|
|
249
|
+
let escaped = false;
|
|
250
|
+
for (let i = 0; i < stripped.length; i++) {
|
|
251
|
+
const ch = stripped[i];
|
|
252
|
+
if (escaped) {
|
|
253
|
+
escaped = false;
|
|
254
|
+
continue;
|
|
255
|
+
}
|
|
256
|
+
if (inString && ch === "\\") {
|
|
257
|
+
escaped = true;
|
|
258
|
+
continue;
|
|
259
|
+
}
|
|
260
|
+
if (ch === '"') {
|
|
261
|
+
inString = !inString;
|
|
262
|
+
continue;
|
|
263
|
+
}
|
|
264
|
+
if (inString) continue;
|
|
265
|
+
if (ch === "{") {
|
|
266
|
+
if (depth === 0) start = i;
|
|
267
|
+
depth++;
|
|
268
|
+
} else if (ch === "}" && depth > 0) {
|
|
269
|
+
depth--;
|
|
270
|
+
if (depth === 0 && start >= 0) {
|
|
271
|
+
try {
|
|
272
|
+
const v = coerceVerdict(JSON.parse(stripped.slice(start, i + 1)));
|
|
273
|
+
if (v) verdict = v;
|
|
274
|
+
} catch {
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
return verdict;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// workers/worker_public/src/faithfulness-context.ts
|
|
283
|
+
function buildJudgeContext(passages, machine = []) {
|
|
284
|
+
const context = passages.slice(0, 8).map((p, i) => {
|
|
285
|
+
const text = typeof p === "string" ? p : p.text;
|
|
286
|
+
const limit = typeof p !== "string" && p.table ? 2400 : 1400;
|
|
287
|
+
return `[${i + 1}] ${text.replace(/\s+/g, " ").slice(0, limit)}`;
|
|
288
|
+
}).join("\n");
|
|
289
|
+
const machineContext = machine.length ? "\n" + machine.slice(0, 6).map((m) => `[M] ${m.replace(/\s+/g, " ").slice(0, 400)}`).join("\n") : "";
|
|
290
|
+
return context + machineContext;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
// workers/worker_public/src/faithfulness.ts
|
|
294
|
+
async function scoreFaithfulness(ai, model, answer, passages, machine = []) {
|
|
295
|
+
if (!answer || !passages.length) return null;
|
|
296
|
+
const context = buildJudgeContext(passages, machine);
|
|
297
|
+
const t0 = Date.now();
|
|
298
|
+
const timeout = new Promise((r) => setTimeout(() => {
|
|
299
|
+
console.log(`faithfulness: timeout (${Date.now() - t0}ms)`);
|
|
300
|
+
r(null);
|
|
301
|
+
}, 24e4));
|
|
302
|
+
const call = (async () => {
|
|
303
|
+
const res = await ai.run(model, {
|
|
304
|
+
messages: [
|
|
305
|
+
{
|
|
306
|
+
role: "system",
|
|
307
|
+
content: faithfulness_default.trimEnd()
|
|
308
|
+
},
|
|
309
|
+
{ role: "user", content: `Answer:
|
|
310
|
+
${answer.slice(0, 2e3)}
|
|
311
|
+
|
|
312
|
+
Passages:
|
|
313
|
+
${context}${machine.length ? buildJudgeContext([], machine) : ""}` }
|
|
314
|
+
],
|
|
315
|
+
max_tokens: 6144,
|
|
316
|
+
reasoning_effort: "low",
|
|
317
|
+
// DeepSeek-V4 card: temp 1.0 / top_p 1.0
|
|
318
|
+
temperature: 1,
|
|
319
|
+
top_p: 1
|
|
320
|
+
});
|
|
321
|
+
const text = typeof res?.response === "string" ? res.response : res?.choices?.[0]?.message?.content;
|
|
322
|
+
const verdict = parseVerdict(text ?? "");
|
|
323
|
+
if (!verdict) {
|
|
324
|
+
console.log(`faithfulness: no parse (${Date.now() - t0}ms, text ${(text ?? "").length} chars) raw=${JSON.stringify((text ?? "").replace(/\s+/g, " ").slice(0, 500))}`);
|
|
325
|
+
return null;
|
|
326
|
+
}
|
|
327
|
+
return verdict;
|
|
328
|
+
})();
|
|
329
|
+
return await Promise.race([call, timeout]);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
// workers/worker_public/src/entailment.ts
|
|
333
|
+
function entailmentVerdict(score, supportedFloor, partialFloor) {
|
|
334
|
+
if (score >= supportedFloor) return { support: "supported", note: "" };
|
|
335
|
+
if (score >= partialFloor) return { support: "partial", note: "Partially grounded \u2014 some claims lack support in the cited passages; verify against the cited clauses." };
|
|
336
|
+
return { support: "unsupported", note: "WARNING: This answer's claims are largely unsupported by the retrieved passages. Verify against official publications." };
|
|
337
|
+
}
|
|
338
|
+
|
|
219
339
|
// workers/worker_public/src/anchors.ts
|
|
220
340
|
var normalize = (s) => s.replace(/[‘’‛′]/g, "'").replace(/[“”‟″]/g, '"').replace(/[–—−]/g, "-").replace(//g, "").replace(/[ ]/g, " ").replace(/\s+/g, " ").toLowerCase();
|
|
221
341
|
var ANCHOR = /\[[^\[\]\n]*\]/g;
|
|
@@ -2688,7 +2808,21 @@ Answer account questions from these records ONLY: name the record when you use i
|
|
|
2688
2808
|
}
|
|
2689
2809
|
completionBlocks.push(...await completeFigures(env.DB, answer, [...c2ns.blocks, ...completionBlocks], used));
|
|
2690
2810
|
const jsonQuality = answerQuality(finalCites.map((c) => c.quality));
|
|
2691
|
-
|
|
2811
|
+
let entailment = null;
|
|
2812
|
+
let entailmentNote = "";
|
|
2813
|
+
if (THRESHOLDS.entailmentGate && jsonQuality && used.length && !answer.includes(refusalAnswer())) {
|
|
2814
|
+
const raced = await Promise.race([
|
|
2815
|
+
scoreFaithfulness(env.AI, roleModel(env, "grader"), answer, used.map((h) => h.text)),
|
|
2816
|
+
new Promise((r) => setTimeout(() => r(null), THRESHOLDS.entailmentBudgetMs))
|
|
2817
|
+
]);
|
|
2818
|
+
if (raced) {
|
|
2819
|
+
const v = entailmentVerdict(raced.score, THRESHOLDS.entailmentSupportedFloor, THRESHOLDS.entailmentPartialFloor);
|
|
2820
|
+
entailment = { support: v.support, score: Math.round(raced.score * 100) / 100, ...raced.ungrounded_claims?.length ? { ungrounded: raced.ungrounded_claims.slice(0, 3) } : {} };
|
|
2821
|
+
entailmentNote = v.note;
|
|
2822
|
+
if (v.support !== "supported") console.log("entailment:", v.support, raced.score, raced.ungrounded_claims?.slice(0, 2));
|
|
2823
|
+
}
|
|
2824
|
+
}
|
|
2825
|
+
const out = { answer, citations: finalCites, ...jsonQuality ? { source_quality: jsonQuality, confidence_note: entailmentNote || qualityNote(jsonQuality), ...entailment ? { entailment } : {}, ...jsonQuality === "ocr" ? { experimental_sources: experimentalSourceLabels(finalCites) } : {} } : {}, model: MODELS.member, query_hash: queryHash, follow_ups: understanding?.follow_ups ?? [], blocks: [...c2ns.blocks, ...verdictBlock ? [verdictBlock] : [], ...conditionBlock ? [conditionBlock] : [], ...aggregationBlock ? [aggregationBlock] : [], ...completionBlocks], context_applied: ctxApplied, ...liveRecords ? { records: liveRecords } : {} };
|
|
2692
2826
|
const cacheable = !contextual && !declaredCtx && !answer.includes(refusalAnswer()) && finalAnchors.violations.length === 0;
|
|
2693
2827
|
if (cacheable) {
|
|
2694
2828
|
const ck = exactCacheKey(env.INDEX_VERSION, gen, ns, await sha256Hex(cacheKeyMaterial(q.query, q.lang, salt)));
|
|
@@ -2720,6 +2854,7 @@ function sseResponse(events, cors) {
|
|
|
2720
2854
|
|
|
2721
2855
|
export {
|
|
2722
2856
|
handleMemories,
|
|
2857
|
+
scoreFaithfulness,
|
|
2723
2858
|
checkQuoteAnchors,
|
|
2724
2859
|
standardForDocNumber,
|
|
2725
2860
|
bindModelNode,
|
|
@@ -7,24 +7,24 @@ import {
|
|
|
7
7
|
sessionFrom,
|
|
8
8
|
telemetry,
|
|
9
9
|
understandQuery
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-VVLNUHW2.js";
|
|
11
11
|
import {
|
|
12
12
|
corsHeaders,
|
|
13
13
|
err,
|
|
14
14
|
json,
|
|
15
15
|
readJson,
|
|
16
16
|
validateQuery
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-JWTIPQ4L.js";
|
|
18
18
|
import {
|
|
19
19
|
entitlementScope,
|
|
20
20
|
standardKeysFrom
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-O6VZIDPW.js";
|
|
22
22
|
import {
|
|
23
23
|
LIMITS,
|
|
24
24
|
MODELS,
|
|
25
25
|
num,
|
|
26
26
|
sha256Hex
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-Z24IAKB6.js";
|
|
28
28
|
|
|
29
29
|
// workers/worker_public/src/search.ts
|
|
30
30
|
async function handleSearch(env, ctx, req, tier, key) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
bubbleConfirmPage,
|
|
3
3
|
isAllowedBubbleOrigin
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-JWTIPQ4L.js";
|
|
5
5
|
import {
|
|
6
6
|
DATASETS,
|
|
7
7
|
LIMITS,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
processExpansion,
|
|
13
13
|
sha256Hex,
|
|
14
14
|
today
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-Z24IAKB6.js";
|
|
16
16
|
import {
|
|
17
17
|
P
|
|
18
18
|
} from "./chunk-3FYJM7LH.js";
|
|
@@ -22214,6 +22214,22 @@ function cfVectorIndex(index) {
|
|
|
22214
22214
|
}
|
|
22215
22215
|
};
|
|
22216
22216
|
}
|
|
22217
|
+
function cfBlobs(bucket) {
|
|
22218
|
+
const r2 = bucket;
|
|
22219
|
+
return {
|
|
22220
|
+
async get(key) {
|
|
22221
|
+
const obj = await r2.get(key);
|
|
22222
|
+
if (!obj) return null;
|
|
22223
|
+
return { body: obj.body, contentType: obj.httpMetadata?.contentType };
|
|
22224
|
+
},
|
|
22225
|
+
async put(key, value2, contentType) {
|
|
22226
|
+
await r2.put(key, value2, contentType ? { httpMetadata: { contentType } } : void 0);
|
|
22227
|
+
},
|
|
22228
|
+
async delete(key) {
|
|
22229
|
+
await r2.delete(key);
|
|
22230
|
+
}
|
|
22231
|
+
};
|
|
22232
|
+
}
|
|
22217
22233
|
function cfStore(db) {
|
|
22218
22234
|
return db;
|
|
22219
22235
|
}
|
|
@@ -24618,6 +24634,7 @@ export {
|
|
|
24618
24634
|
parseAppliedContext,
|
|
24619
24635
|
contextNote,
|
|
24620
24636
|
syntheticUnderstanding,
|
|
24637
|
+
cfBlobs,
|
|
24621
24638
|
portModelRunner,
|
|
24622
24639
|
portStore,
|
|
24623
24640
|
promptVars,
|
|
@@ -60,6 +60,15 @@ var THRESHOLDS = {
|
|
|
60
60
|
* pool below the primary dense lane; they must earn their window
|
|
61
61
|
* slot under the cross-encoder, not by graph membership alone. */
|
|
62
62
|
graphLaneDiscount: 0.75,
|
|
63
|
+
/** The entailment gate (TODO.new-era/10): the faithfulness scorer
|
|
64
|
+
* promoted from eval-only onto the serving path. The confidence line
|
|
65
|
+
* then states a measurement — claim support in the cited passages —
|
|
66
|
+
* not only the source rung. Fails open (a slow or unparseable check
|
|
67
|
+
* leaves the source-rung note unchanged). */
|
|
68
|
+
entailmentGate: true,
|
|
69
|
+
entailmentBudgetMs: 6e3,
|
|
70
|
+
entailmentSupportedFloor: 0.9,
|
|
71
|
+
entailmentPartialFloor: 0.5,
|
|
63
72
|
/** Concept-graph candidate discount — same rationale as the graph
|
|
64
73
|
* lane: definitional content enters discounted. */
|
|
65
74
|
conceptGraphDiscount: 0.75,
|
package/dist/config.d.ts
CHANGED
|
@@ -32,6 +32,15 @@ export declare const THRESHOLDS: {
|
|
|
32
32
|
* pool below the primary dense lane; they must earn their window
|
|
33
33
|
* slot under the cross-encoder, not by graph membership alone. */
|
|
34
34
|
readonly graphLaneDiscount: 0.75;
|
|
35
|
+
/** The entailment gate (TODO.new-era/10): the faithfulness scorer
|
|
36
|
+
* promoted from eval-only onto the serving path. The confidence line
|
|
37
|
+
* then states a measurement — claim support in the cited passages —
|
|
38
|
+
* not only the source rung. Fails open (a slow or unparseable check
|
|
39
|
+
* leaves the source-rung note unchanged). */
|
|
40
|
+
readonly entailmentGate: true;
|
|
41
|
+
readonly entailmentBudgetMs: 6000;
|
|
42
|
+
readonly entailmentSupportedFloor: 0.9;
|
|
43
|
+
readonly entailmentPartialFloor: 0.5;
|
|
35
44
|
/** Concept-graph candidate discount — same rationale as the graph
|
|
36
45
|
* lane: definitional content enters discounted. */
|
|
37
46
|
readonly conceptGraphDiscount: 0.75;
|
package/dist/env.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export interface OpenApiRoute {
|
|
|
3
3
|
pattern: string;
|
|
4
4
|
operationId: string;
|
|
5
5
|
}
|
|
6
|
-
export type OpenApiOperationId = "askAnonymous" | "askKeyed" | "search" | "searchKeyed" | "absence" | "absenceKeyed" | "verify" | "verifyKeyed" | "research" | "researchKeyed" | "mcp" | "datasets" | "keyUsage" | "health" | "listConversations" | "createConversation" | "getConversation" | "renameConversation" | "deleteConversation" | "appendMessage" | "shareConversation" | "getShared" | "listMemories" | "createMemory" | "deleteMemory" | "listProjects" | "createProject" | "deleteProject" | "listProjectFiles" | "attachProjectFile" | "detachProjectFile" | "laneQuery" | "laneKeyed" | "feedback" | "adminEnrich" | "adminEnrichAlias" | "adminSection" | "adminSectionAlias" | "adminVectors" | "adminCaption" | "adminJudge" | "adminJudgeAlias" | "adminRevokeKey" | "authMe" | "authLogin" | "authCallback" | "authLogout" | "authLogoutLink" | "adminStats" | "adminListKeys" | "adminCreateKey";
|
|
6
|
+
export type OpenApiOperationId = "askAnonymous" | "askKeyed" | "search" | "searchKeyed" | "absence" | "absenceKeyed" | "verify" | "verifyKeyed" | "research" | "researchKeyed" | "mcp" | "datasets" | "keyUsage" | "health" | "listConversations" | "createConversation" | "getConversation" | "renameConversation" | "deleteConversation" | "appendMessage" | "shareConversation" | "getShared" | "uploadAttachment" | "listAttachments" | "getAttachment" | "deleteAttachment" | "listMemories" | "createMemory" | "deleteMemory" | "listProjects" | "createProject" | "deleteProject" | "listProjectFiles" | "attachProjectFile" | "detachProjectFile" | "laneQuery" | "laneKeyed" | "feedback" | "adminEnrich" | "adminEnrichAlias" | "adminSection" | "adminSectionAlias" | "adminVectors" | "adminCaption" | "adminJudge" | "adminJudgeAlias" | "adminRevokeKey" | "authMe" | "authLogin" | "authCallback" | "authLogout" | "authLogoutLink" | "adminStats" | "adminListKeys" | "adminCreateKey";
|
|
7
7
|
export declare const OPENAPI_SURFACE: readonly (Omit<OpenApiRoute, "operationId"> & {
|
|
8
8
|
operationId: OpenApiOperationId;
|
|
9
9
|
})[];
|
package/dist/openapi-types.d.ts
CHANGED
|
@@ -368,6 +368,51 @@ export interface paths {
|
|
|
368
368
|
patch?: never;
|
|
369
369
|
trace?: never;
|
|
370
370
|
};
|
|
371
|
+
"/api/attachments": {
|
|
372
|
+
parameters: {
|
|
373
|
+
query?: never;
|
|
374
|
+
header?: never;
|
|
375
|
+
path?: never;
|
|
376
|
+
cookie?: never;
|
|
377
|
+
};
|
|
378
|
+
/** List the member's attachments */
|
|
379
|
+
get: operations["listAttachments"];
|
|
380
|
+
put?: never;
|
|
381
|
+
/**
|
|
382
|
+
* Upload an image attachment
|
|
383
|
+
* @description Stores a member-uploaded image (PNG, JPEG, WebP or GIF, at most 4 MB) and returns its identifier. The attachment persists until the member deletes it. The content is verified from its bytes, never from a declared type. The body carries the image as a data URL — the same shape the composer produces.
|
|
384
|
+
*/
|
|
385
|
+
post: operations["uploadAttachment"];
|
|
386
|
+
delete?: never;
|
|
387
|
+
options?: never;
|
|
388
|
+
head?: never;
|
|
389
|
+
patch?: never;
|
|
390
|
+
trace?: never;
|
|
391
|
+
};
|
|
392
|
+
"/api/attachments/{id}": {
|
|
393
|
+
parameters: {
|
|
394
|
+
query?: never;
|
|
395
|
+
header?: never;
|
|
396
|
+
path?: never;
|
|
397
|
+
cookie?: never;
|
|
398
|
+
};
|
|
399
|
+
/**
|
|
400
|
+
* Read one attachment's image
|
|
401
|
+
* @description Streams the stored image. The response is 404 for a foreign identifier — ownership is checked on every fetch, and a file belonging to another account is indistinguishable from a missing one.
|
|
402
|
+
*/
|
|
403
|
+
get: operations["getAttachment"];
|
|
404
|
+
put?: never;
|
|
405
|
+
post?: never;
|
|
406
|
+
/**
|
|
407
|
+
* Delete an attachment
|
|
408
|
+
* @description Removes the stored object and its record. Stored until deleted — and this deletes it.
|
|
409
|
+
*/
|
|
410
|
+
delete: operations["deleteAttachment"];
|
|
411
|
+
options?: never;
|
|
412
|
+
head?: never;
|
|
413
|
+
patch?: never;
|
|
414
|
+
trace?: never;
|
|
415
|
+
};
|
|
371
416
|
"/api/memories": {
|
|
372
417
|
parameters: {
|
|
373
418
|
query?: never;
|
|
@@ -1479,6 +1524,110 @@ export interface operations {
|
|
|
1479
1524
|
};
|
|
1480
1525
|
};
|
|
1481
1526
|
};
|
|
1527
|
+
listAttachments: {
|
|
1528
|
+
parameters: {
|
|
1529
|
+
query?: never;
|
|
1530
|
+
header?: never;
|
|
1531
|
+
path?: never;
|
|
1532
|
+
cookie?: never;
|
|
1533
|
+
};
|
|
1534
|
+
requestBody?: never;
|
|
1535
|
+
responses: {
|
|
1536
|
+
/** @description The attachment identifiers, newest first. */
|
|
1537
|
+
200: {
|
|
1538
|
+
headers: {
|
|
1539
|
+
[name: string]: unknown;
|
|
1540
|
+
};
|
|
1541
|
+
content?: never;
|
|
1542
|
+
};
|
|
1543
|
+
};
|
|
1544
|
+
};
|
|
1545
|
+
uploadAttachment: {
|
|
1546
|
+
parameters: {
|
|
1547
|
+
query?: never;
|
|
1548
|
+
header?: never;
|
|
1549
|
+
path?: never;
|
|
1550
|
+
cookie?: never;
|
|
1551
|
+
};
|
|
1552
|
+
requestBody: {
|
|
1553
|
+
content: {
|
|
1554
|
+
"application/json": {
|
|
1555
|
+
/** @description The image as a data URL. */
|
|
1556
|
+
data_url: string;
|
|
1557
|
+
};
|
|
1558
|
+
};
|
|
1559
|
+
};
|
|
1560
|
+
responses: {
|
|
1561
|
+
/** @description The attachment's identifier. */
|
|
1562
|
+
201: {
|
|
1563
|
+
headers: {
|
|
1564
|
+
[name: string]: unknown;
|
|
1565
|
+
};
|
|
1566
|
+
content?: never;
|
|
1567
|
+
};
|
|
1568
|
+
/** @description The content is not an allowed image, or exceeds the size cap. */
|
|
1569
|
+
400: {
|
|
1570
|
+
headers: {
|
|
1571
|
+
[name: string]: unknown;
|
|
1572
|
+
};
|
|
1573
|
+
content?: never;
|
|
1574
|
+
};
|
|
1575
|
+
};
|
|
1576
|
+
};
|
|
1577
|
+
getAttachment: {
|
|
1578
|
+
parameters: {
|
|
1579
|
+
query?: never;
|
|
1580
|
+
header?: never;
|
|
1581
|
+
path: {
|
|
1582
|
+
id: string;
|
|
1583
|
+
};
|
|
1584
|
+
cookie?: never;
|
|
1585
|
+
};
|
|
1586
|
+
requestBody?: never;
|
|
1587
|
+
responses: {
|
|
1588
|
+
/** @description The image bytes. */
|
|
1589
|
+
200: {
|
|
1590
|
+
headers: {
|
|
1591
|
+
[name: string]: unknown;
|
|
1592
|
+
};
|
|
1593
|
+
content?: never;
|
|
1594
|
+
};
|
|
1595
|
+
/** @description No such attachment owned by the caller. */
|
|
1596
|
+
404: {
|
|
1597
|
+
headers: {
|
|
1598
|
+
[name: string]: unknown;
|
|
1599
|
+
};
|
|
1600
|
+
content?: never;
|
|
1601
|
+
};
|
|
1602
|
+
};
|
|
1603
|
+
};
|
|
1604
|
+
deleteAttachment: {
|
|
1605
|
+
parameters: {
|
|
1606
|
+
query?: never;
|
|
1607
|
+
header?: never;
|
|
1608
|
+
path: {
|
|
1609
|
+
id: string;
|
|
1610
|
+
};
|
|
1611
|
+
cookie?: never;
|
|
1612
|
+
};
|
|
1613
|
+
requestBody?: never;
|
|
1614
|
+
responses: {
|
|
1615
|
+
/** @description Deleted. */
|
|
1616
|
+
200: {
|
|
1617
|
+
headers: {
|
|
1618
|
+
[name: string]: unknown;
|
|
1619
|
+
};
|
|
1620
|
+
content?: never;
|
|
1621
|
+
};
|
|
1622
|
+
/** @description No such attachment owned by the caller. */
|
|
1623
|
+
404: {
|
|
1624
|
+
headers: {
|
|
1625
|
+
[name: string]: unknown;
|
|
1626
|
+
};
|
|
1627
|
+
content?: never;
|
|
1628
|
+
};
|
|
1629
|
+
};
|
|
1630
|
+
};
|
|
1482
1631
|
listMemories: {
|
|
1483
1632
|
parameters: {
|
|
1484
1633
|
query?: never;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
handleSearch
|
|
3
|
+
} from "./chunk-DMIOBGQU.js";
|
|
4
|
+
import "./chunk-VVLNUHW2.js";
|
|
5
|
+
import "./chunk-JWTIPQ4L.js";
|
|
6
|
+
import "./chunk-A3QHHUN5.js";
|
|
7
|
+
import "./chunk-O6VZIDPW.js";
|
|
8
|
+
import "./chunk-Z24IAKB6.js";
|
|
9
|
+
import "./chunk-3FYJM7LH.js";
|
|
10
|
+
export {
|
|
11
|
+
handleSearch
|
|
12
|
+
};
|