@konneal/engine 0.2.51 → 0.2.52
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-27TMC7PV.js +12 -0
- package/dist/{chunk-Z24IAKB6.js → chunk-2PCUAJJO.js} +5 -0
- package/dist/{chunk-DMIOBGQU.js → chunk-FLNX4O7C.js} +4 -4
- package/dist/{chunk-O6VZIDPW.js → chunk-LVZTWUVJ.js} +1 -1
- package/dist/{chunk-JWTIPQ4L.js → chunk-SPKPH54J.js} +1 -1
- package/dist/{chunk-HT2MDJ5S.js → chunk-SU4FO7TN.js} +4 -4
- package/dist/{chunk-VVLNUHW2.js → chunk-TPV5GPY2.js} +2 -2
- package/dist/config.d.ts +5 -0
- package/dist/search-PBOODCMQ.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 +14 -7
- package/dist/worker_public/src/requestScope.js +2 -2
- package/package.json +1 -1
- package/workers/worker_public/src/attachments.ts +13 -0
- package/workers/worker_public/src/config.ts +6 -0
- package/dist/ask-FZA3ZFVB.js +0 -12
- package/dist/search-KNB2S2PS.js +0 -12
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
handleAsk
|
|
3
|
+
} from "./chunk-SU4FO7TN.js";
|
|
4
|
+
import "./chunk-TPV5GPY2.js";
|
|
5
|
+
import "./chunk-SPKPH54J.js";
|
|
6
|
+
import "./chunk-A3QHHUN5.js";
|
|
7
|
+
import "./chunk-LVZTWUVJ.js";
|
|
8
|
+
import "./chunk-2PCUAJJO.js";
|
|
9
|
+
import "./chunk-3FYJM7LH.js";
|
|
10
|
+
export {
|
|
11
|
+
handleAsk
|
|
12
|
+
};
|
|
@@ -31,6 +31,11 @@ var MODELS = {
|
|
|
31
31
|
research: "@cf/zai-org/glm-5.3-flash"
|
|
32
32
|
};
|
|
33
33
|
var LIMITS = {
|
|
34
|
+
/** Attachment quotas (TODO.new-era/8): per-member ceilings so a member's
|
|
35
|
+
* uploads cannot grow without bound — count AND total bytes, checked
|
|
36
|
+
* before every upload writes. */
|
|
37
|
+
attachMaxCount: 50,
|
|
38
|
+
attachMaxTotalBytes: 50 * 1024 * 1024,
|
|
34
39
|
// input sizes: generous — real questions can be long (pasted scenarios,
|
|
35
40
|
// multi-part asks). The context BUDGET is the real governor of what the
|
|
36
41
|
// model sees; these caps only bound abuse.
|
|
@@ -7,24 +7,24 @@ import {
|
|
|
7
7
|
sessionFrom,
|
|
8
8
|
telemetry,
|
|
9
9
|
understandQuery
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-TPV5GPY2.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-SPKPH54J.js";
|
|
18
18
|
import {
|
|
19
19
|
entitlementScope,
|
|
20
20
|
standardKeysFrom
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-LVZTWUVJ.js";
|
|
22
22
|
import {
|
|
23
23
|
LIMITS,
|
|
24
24
|
MODELS,
|
|
25
25
|
num,
|
|
26
26
|
sha256Hex
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-2PCUAJJO.js";
|
|
28
28
|
|
|
29
29
|
// workers/worker_public/src/search.ts
|
|
30
30
|
async function handleSearch(env, ctx, req, tier, key) {
|
|
@@ -35,14 +35,14 @@ import {
|
|
|
35
35
|
syntheticUnderstanding,
|
|
36
36
|
telemetry,
|
|
37
37
|
understandQuery
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-TPV5GPY2.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-SPKPH54J.js";
|
|
46
46
|
import {
|
|
47
47
|
canonicalRefusal,
|
|
48
48
|
refusalAnswer
|
|
@@ -52,7 +52,7 @@ import {
|
|
|
52
52
|
requestSalt,
|
|
53
53
|
resolveRequestScope,
|
|
54
54
|
standardKeysFrom
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-LVZTWUVJ.js";
|
|
56
56
|
import {
|
|
57
57
|
LIMITS,
|
|
58
58
|
MODELS,
|
|
@@ -63,7 +63,7 @@ import {
|
|
|
63
63
|
requestEffort,
|
|
64
64
|
roleModel,
|
|
65
65
|
sha256Hex
|
|
66
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-2PCUAJJO.js";
|
|
67
67
|
import {
|
|
68
68
|
P
|
|
69
69
|
} from "./chunk-3FYJM7LH.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
bubbleConfirmPage,
|
|
3
3
|
isAllowedBubbleOrigin
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-SPKPH54J.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-2PCUAJJO.js";
|
|
16
16
|
import {
|
|
17
17
|
P
|
|
18
18
|
} from "./chunk-3FYJM7LH.js";
|
package/dist/config.d.ts
CHANGED
|
@@ -12,6 +12,11 @@ export declare const MODELS: {
|
|
|
12
12
|
readonly research: "@cf/zai-org/glm-5.3-flash";
|
|
13
13
|
};
|
|
14
14
|
export declare const LIMITS: {
|
|
15
|
+
/** Attachment quotas (TODO.new-era/8): per-member ceilings so a member's
|
|
16
|
+
* uploads cannot grow without bound — count AND total bytes, checked
|
|
17
|
+
* before every upload writes. */
|
|
18
|
+
readonly attachMaxCount: 50;
|
|
19
|
+
readonly attachMaxTotalBytes: number;
|
|
15
20
|
readonly maxInputChars: 8000;
|
|
16
21
|
readonly maxOutputTokens: 3072;
|
|
17
22
|
readonly retrieveK: 50;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
handleSearch
|
|
3
|
+
} from "./chunk-FLNX4O7C.js";
|
|
4
|
+
import "./chunk-TPV5GPY2.js";
|
|
5
|
+
import "./chunk-SPKPH54J.js";
|
|
6
|
+
import "./chunk-A3QHHUN5.js";
|
|
7
|
+
import "./chunk-LVZTWUVJ.js";
|
|
8
|
+
import "./chunk-2PCUAJJO.js";
|
|
9
|
+
import "./chunk-3FYJM7LH.js";
|
|
10
|
+
export {
|
|
11
|
+
handleSearch
|
|
12
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
handleSearch
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-FLNX4O7C.js";
|
|
4
4
|
import {
|
|
5
5
|
bindModelNode,
|
|
6
6
|
checkQuoteAnchors,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
scoreFaithfulness,
|
|
11
11
|
scoreJudge,
|
|
12
12
|
standardForDocNumber
|
|
13
|
-
} from "../../chunk-
|
|
13
|
+
} from "../../chunk-SU4FO7TN.js";
|
|
14
14
|
import {
|
|
15
15
|
buildMessages,
|
|
16
16
|
cfBlobs,
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
sessionFrom,
|
|
38
38
|
telemetry,
|
|
39
39
|
understandQuery
|
|
40
|
-
} from "../../chunk-
|
|
40
|
+
} from "../../chunk-TPV5GPY2.js";
|
|
41
41
|
import {
|
|
42
42
|
authenticate,
|
|
43
43
|
corsHeaders,
|
|
@@ -46,14 +46,14 @@ import {
|
|
|
46
46
|
readJson,
|
|
47
47
|
validateQuery,
|
|
48
48
|
withCors
|
|
49
|
-
} from "../../chunk-
|
|
49
|
+
} from "../../chunk-SPKPH54J.js";
|
|
50
50
|
import {
|
|
51
51
|
canonicalRefusal
|
|
52
52
|
} from "../../chunk-A3QHHUN5.js";
|
|
53
53
|
import {
|
|
54
54
|
entitlementScope,
|
|
55
55
|
standardKeysFrom
|
|
56
|
-
} from "../../chunk-
|
|
56
|
+
} from "../../chunk-LVZTWUVJ.js";
|
|
57
57
|
import {
|
|
58
58
|
LIMITS,
|
|
59
59
|
MODELS,
|
|
@@ -64,7 +64,7 @@ import {
|
|
|
64
64
|
roleModel,
|
|
65
65
|
sha256Hex,
|
|
66
66
|
today
|
|
67
|
-
} from "../../chunk-
|
|
67
|
+
} from "../../chunk-2PCUAJJO.js";
|
|
68
68
|
import {
|
|
69
69
|
P,
|
|
70
70
|
setProfile
|
|
@@ -857,6 +857,13 @@ async function uploadAttachment(deps, sub, dataUrl) {
|
|
|
857
857
|
if (!parsed) {
|
|
858
858
|
return new Response(JSON.stringify({ error: { code: "invalid_input", message: "A PNG, JPEG, WebP or GIF image of at most 4 MB is required" } }), { status: 400, headers: { "content-type": "application/json" } });
|
|
859
859
|
}
|
|
860
|
+
const usage = await deps.store.prepare("SELECT COUNT(*) AS n, COALESCE(SUM(bytes), 0) AS total FROM attachments WHERE sub = ?1").bind(sub).first();
|
|
861
|
+
if ((usage?.n ?? 0) >= LIMITS.attachMaxCount) {
|
|
862
|
+
return new Response(JSON.stringify({ error: { code: "attachment_count_cap", message: `Attachment limit reached (${LIMITS.attachMaxCount} files). Delete one to upload another.` } }), { status: 409, headers: { "content-type": "application/json" } });
|
|
863
|
+
}
|
|
864
|
+
if ((usage?.total ?? 0) + parsed.bytes.length > LIMITS.attachMaxTotalBytes) {
|
|
865
|
+
return new Response(JSON.stringify({ error: { code: "attachment_bytes_cap", message: `Attachment storage limit reached (${Math.round(LIMITS.attachMaxTotalBytes / 1048576)} MB). Delete an image to upload another.` } }), { status: 409, headers: { "content-type": "application/json" } });
|
|
866
|
+
}
|
|
860
867
|
const id = crypto.randomUUID();
|
|
861
868
|
const key = `att/${sub}/${id}`;
|
|
862
869
|
await deps.blobs.put(key, parsed.bytes.buffer, parsed.mime);
|
|
@@ -947,7 +954,7 @@ async function handleMcp(env, ctx, req, tier, key) {
|
|
|
947
954
|
// stream:false forces the JSON lane (anon defaults to SSE)
|
|
948
955
|
body: JSON.stringify({ ...args, stream: false })
|
|
949
956
|
});
|
|
950
|
-
const res = name === "ask" ? await (await import("../../ask-
|
|
957
|
+
const res = name === "ask" ? await (await import("../../ask-27TMC7PV.js")).handleAsk(env, ctx, inner, tier, key) : await (await import("../../search-PBOODCMQ.js")).handleSearch(env, ctx, inner, tier, key);
|
|
951
958
|
return res.json().catch(() => ({ error: { message: "tool transport failed", status: res.status } }));
|
|
952
959
|
});
|
|
953
960
|
if (out.ok && "accepted" in out) return new Response(null, { status: 202 });
|
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
requestSalt,
|
|
5
5
|
resolveRequestScope,
|
|
6
6
|
standardKeysFrom
|
|
7
|
-
} from "../../chunk-
|
|
8
|
-
import "../../chunk-
|
|
7
|
+
} from "../../chunk-LVZTWUVJ.js";
|
|
8
|
+
import "../../chunk-2PCUAJJO.js";
|
|
9
9
|
import "../../chunk-3FYJM7LH.js";
|
|
10
10
|
export {
|
|
11
11
|
entitlementScope,
|
package/package.json
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"playwright": "^1.62.1",
|
|
28
28
|
"yaml": "^2.9.1"
|
|
29
29
|
},
|
|
30
|
-
"version": "0.2.
|
|
30
|
+
"version": "0.2.52",
|
|
31
31
|
"description": "The Konneal engine: the publisher-agnostic build pipeline and API plane for standards intelligence (retrieval, answer contract, verdicts, evaluation).",
|
|
32
32
|
"license": "BSD-3-Clause",
|
|
33
33
|
"type": "module",
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
// Storage rides the Blobs port and the row rides the StoreQuery port —
|
|
15
15
|
// the module never names a provider binding (the ports purity lint).
|
|
16
16
|
|
|
17
|
+
import { LIMITS } from "./config.ts";
|
|
17
18
|
import type { Blobs } from "./ports/blobs.ts";
|
|
18
19
|
import type { StoreQuery } from "./ports/store.ts";
|
|
19
20
|
|
|
@@ -67,6 +68,18 @@ export async function uploadAttachment(deps: AttachmentDeps, sub: string, dataUr
|
|
|
67
68
|
if (!parsed) {
|
|
68
69
|
return new Response(JSON.stringify({ error: { code: "invalid_input", message: "A PNG, JPEG, WebP or GIF image of at most 4 MB is required" } }), { status: 400, headers: { "content-type": "application/json" } });
|
|
69
70
|
}
|
|
71
|
+
// the per-member ceilings: count first, then total bytes — both
|
|
72
|
+
// checked against the member's own rows before anything writes
|
|
73
|
+
const usage = await deps.store
|
|
74
|
+
.prepare("SELECT COUNT(*) AS n, COALESCE(SUM(bytes), 0) AS total FROM attachments WHERE sub = ?1")
|
|
75
|
+
.bind(sub)
|
|
76
|
+
.first<{ n: number; total: number }>();
|
|
77
|
+
if ((usage?.n ?? 0) >= LIMITS.attachMaxCount) {
|
|
78
|
+
return new Response(JSON.stringify({ error: { code: "attachment_count_cap", message: `Attachment limit reached (${LIMITS.attachMaxCount} files). Delete one to upload another.` } }), { status: 409, headers: { "content-type": "application/json" } });
|
|
79
|
+
}
|
|
80
|
+
if ((usage?.total ?? 0) + parsed.bytes.length > LIMITS.attachMaxTotalBytes) {
|
|
81
|
+
return new Response(JSON.stringify({ error: { code: "attachment_bytes_cap", message: `Attachment storage limit reached (${Math.round(LIMITS.attachMaxTotalBytes / 1048576)} MB). Delete an image to upload another.` } }), { status: 409, headers: { "content-type": "application/json" } });
|
|
82
|
+
}
|
|
70
83
|
const id = crypto.randomUUID();
|
|
71
84
|
// the key embeds the owner — the storage partition IS the isolation
|
|
72
85
|
const key = `att/${sub}/${id}`;
|
|
@@ -27,6 +27,12 @@ export const MODELS = {
|
|
|
27
27
|
} as const;
|
|
28
28
|
|
|
29
29
|
export const LIMITS = {
|
|
30
|
+
/** Attachment quotas (TODO.new-era/8): per-member ceilings so a member's
|
|
31
|
+
* uploads cannot grow without bound — count AND total bytes, checked
|
|
32
|
+
* before every upload writes. */
|
|
33
|
+
attachMaxCount: 50,
|
|
34
|
+
attachMaxTotalBytes: 50 * 1024 * 1024,
|
|
35
|
+
|
|
30
36
|
// input sizes: generous — real questions can be long (pasted scenarios,
|
|
31
37
|
// multi-part asks). The context BUDGET is the real governor of what the
|
|
32
38
|
// model sees; these caps only bound abuse.
|
package/dist/ask-FZA3ZFVB.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
handleAsk
|
|
3
|
-
} from "./chunk-HT2MDJ5S.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
|
-
};
|
package/dist/search-KNB2S2PS.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
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
|
-
};
|