@konneal/engine 0.2.20 → 0.2.22
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 +6 -4
- package/dist/{ask-36JS3555.js → ask-HLELROYT.js} +2 -2
- package/dist/{chunk-DGFJUA2C.js → chunk-4XBU4J6B.js} +1345 -12
- package/dist/{chunk-SLZ4TZNO.js → chunk-IROEVHEV.js} +1 -1
- package/dist/{chunk-EE6V6X6D.js → chunk-M24JWPVN.js} +1 -1
- package/dist/{search-YA6TD6QJ.js → search-GVDELP3N.js} +2 -2
- package/dist/worker_public/src/index.js +5 -5
- package/package.json +7 -13
- package/workers/worker_public/src/codecs.ts +55 -2
- package/workers/worker_public/src/index.ts +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
handleSearch
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-IROEVHEV.js";
|
|
4
4
|
import {
|
|
5
5
|
checkQuoteAnchors,
|
|
6
6
|
handleAsk,
|
|
7
7
|
handleMemories,
|
|
8
8
|
scoreJudge,
|
|
9
9
|
standardForDocNumber
|
|
10
|
-
} from "../../chunk-
|
|
10
|
+
} from "../../chunk-M24JWPVN.js";
|
|
11
11
|
import {
|
|
12
12
|
buildMessages,
|
|
13
13
|
citations,
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
sessionFrom,
|
|
30
30
|
telemetry,
|
|
31
31
|
understandQuery
|
|
32
|
-
} from "../../chunk-
|
|
32
|
+
} from "../../chunk-4XBU4J6B.js";
|
|
33
33
|
import {
|
|
34
34
|
authenticate,
|
|
35
35
|
corsHeaders,
|
|
@@ -979,7 +979,7 @@ async function handleMcp(env, ctx, req, tier, key) {
|
|
|
979
979
|
// stream:false forces the JSON lane (anon defaults to SSE)
|
|
980
980
|
body: JSON.stringify({ ...args, stream: false })
|
|
981
981
|
});
|
|
982
|
-
const res = name === "ask" ? await (await import("../../ask-
|
|
982
|
+
const res = name === "ask" ? await (await import("../../ask-HLELROYT.js")).handleAsk(env, ctx, inner, tier, key) : await (await import("../../search-GVDELP3N.js")).handleSearch(env, ctx, inner, tier, key);
|
|
983
983
|
return res.json().catch(() => ({ error: { message: "tool transport failed", status: res.status } }));
|
|
984
984
|
});
|
|
985
985
|
if (out.ok && "accepted" in out) return new Response(null, { status: 202 });
|
|
@@ -1615,7 +1615,7 @@ async function openapiCatalogRoute(c) {
|
|
|
1615
1615
|
openapi: "3.1.0",
|
|
1616
1616
|
info: { title: `${P().publisher.product_name} API`, version: c.env.INDEX_VERSION ?? "0" },
|
|
1617
1617
|
paths: {},
|
|
1618
|
-
"x-
|
|
1618
|
+
"x-permissions-catalog": permissionsCatalog()
|
|
1619
1619
|
},
|
|
1620
1620
|
200,
|
|
1621
1621
|
corsHeaders(c.req)
|
package/package.json
CHANGED
|
@@ -5,13 +5,7 @@
|
|
|
5
5
|
],
|
|
6
6
|
"scripts": {
|
|
7
7
|
"typecheck": "tsc -p workers/worker_public",
|
|
8
|
-
"deploy:public": "npm run deploy -w workers/worker_public",
|
|
9
|
-
"dev:public": "npm run dev -w workers/worker_public",
|
|
10
|
-
"deploy": "./scripts/deploy.sh",
|
|
11
|
-
"test:golden": "node scripts/eval.mjs",
|
|
12
|
-
"test:e2e": "node tests/e2e.mjs",
|
|
13
8
|
"lint:wrangler": "python3 scripts/lint_wrangler.py",
|
|
14
|
-
"test:ui": "node tests/ui.mjs",
|
|
15
9
|
"test:bridge": "node --test tests/bridge.test.mjs",
|
|
16
10
|
"test:units": "node --test --experimental-strip-types tests/*.test.ts",
|
|
17
11
|
"gen:openapi-types": "node scripts/gen-openapi-types.mjs",
|
|
@@ -22,19 +16,19 @@
|
|
|
22
16
|
"gen:profile": "node scripts/gen_profile.mjs"
|
|
23
17
|
},
|
|
24
18
|
"devDependencies": {
|
|
19
|
+
"@astrojs/markdown-satteri": "^0.4.1",
|
|
20
|
+
"@astrojs/mdx": "^4.3.14",
|
|
25
21
|
"@cloudflare/workers-types": "^5.20260911.1",
|
|
22
|
+
"@konneal/client": "^0.2.1",
|
|
23
|
+
"@oimlsmart/oiml-pubid": "^1.2.1",
|
|
24
|
+
"@pubid/pubid": "^0.1.4",
|
|
26
25
|
"esbuild": "^0.28.2",
|
|
27
26
|
"jsdom": "^29.1.1",
|
|
28
27
|
"openapi-typescript": "^7.13.0",
|
|
29
28
|
"playwright": "^1.62.1",
|
|
30
|
-
"yaml": "^2.9.1"
|
|
31
|
-
"@astrojs/markdown-satteri": "^0.4.1",
|
|
32
|
-
"@astrojs/mdx": "^4.3.14",
|
|
33
|
-
"@konneal/client": "^0.2.1",
|
|
34
|
-
"@oimlsmart/oiml-pubid": "^1.2.1"
|
|
29
|
+
"yaml": "^2.9.1"
|
|
35
30
|
},
|
|
36
|
-
"
|
|
37
|
-
"version": "0.2.20",
|
|
31
|
+
"version": "0.2.22",
|
|
38
32
|
"description": "The Konneal engine: the publisher-agnostic build pipeline and API plane for standards intelligence (retrieval, answer contract, verdicts, evaluation).",
|
|
39
33
|
"license": "BSD-3-Clause",
|
|
40
34
|
"type": "module",
|
|
@@ -29,9 +29,54 @@ export interface RefCodec {
|
|
|
29
29
|
// the CS family — beyond what any regex here carried). This codec's
|
|
30
30
|
// job is the ADAPTATION: the parser takes the prefixed form and
|
|
31
31
|
// returns null for everything else; our callers also send bare forms
|
|
32
|
-
// ("R 60-1:2021") and the URN provenance shape.
|
|
33
|
-
//
|
|
32
|
+
// ("R 60-1:2021") and the URN provenance shape. The ONE construct the
|
|
33
|
+
// strict grammar deliberately does not own is the DUAL-PUBLISHED print
|
|
34
|
+
// ("ISO 4064-1:2024|OIML R 49-1:2024") — that lives in the unified
|
|
35
|
+
// pubid grammar (@pubid/pubid, single-flavor import so the worker
|
|
36
|
+
// bundle carries only the OIML grammar), and the retrieval spine of a
|
|
37
|
+
// dual is its OIML side, whichever side prints first.
|
|
34
38
|
import { parseOimlPubid } from "@oimlsmart/oiml-pubid";
|
|
39
|
+
import { oimlGrammarImplementation } from "@pubid/pubid/dist/flavors/oiml/implementation.js";
|
|
40
|
+
|
|
41
|
+
const oimlParser = oimlGrammarImplementation();
|
|
42
|
+
|
|
43
|
+
const TYPE_LETTER: Record<string, string> = {
|
|
44
|
+
recommendation: "R", document: "D", basic_publication: "B",
|
|
45
|
+
"basic-publication": "B", guide: "G", expert_report: "E",
|
|
46
|
+
"expert-report": "E", vocabulary: "V", seminar_report: "S",
|
|
47
|
+
"seminar-report": "S",
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
interface PubidHash {
|
|
51
|
+
_type?: string;
|
|
52
|
+
number?: string | number;
|
|
53
|
+
part?: string;
|
|
54
|
+
year?: string;
|
|
55
|
+
edition?: string;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** The OIML side of a dual-published print, through the unified
|
|
59
|
+
* grammar. Singles go through the strict grammar above — this path
|
|
60
|
+
* exists for the pipe construct and nothing else. */
|
|
61
|
+
function dualOimlSpine(side: string): { doc_number: string; edition?: string; label: string } | null {
|
|
62
|
+
try {
|
|
63
|
+
const h = oimlParser.parse(side.trim()).toHash() as PubidHash;
|
|
64
|
+
if (h.number === undefined) return null;
|
|
65
|
+
const kind = String(h._type ?? "").split(":").pop() ?? "";
|
|
66
|
+
const letter = TYPE_LETTER[kind] ?? "";
|
|
67
|
+
if (!letter) return null;
|
|
68
|
+
const num = String(Number(h.number));
|
|
69
|
+
const part = h.part !== undefined ? String(h.part) : undefined;
|
|
70
|
+
const ed = h.year !== undefined ? String(h.year) : h.edition !== undefined ? String(h.edition) : undefined;
|
|
71
|
+
return {
|
|
72
|
+
doc_number: num,
|
|
73
|
+
...(ed ? { edition: ed } : {}),
|
|
74
|
+
label: `OIML ${letter} ${num}${part ? `-${part}` : ""}${ed ? `:${ed}` : ""}`,
|
|
75
|
+
};
|
|
76
|
+
} catch {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
35
80
|
|
|
36
81
|
/** urn:oiml:pub:r:60-1:2021 (pub) / urn:oiml:pub:cs:pd-06 (CS) → the
|
|
37
82
|
* prefixed display form the parser takes. */
|
|
@@ -53,6 +98,14 @@ const parsePubid = (doc: string) => {
|
|
|
53
98
|
* edition is never part of the number. */
|
|
54
99
|
export const oimlPubid: RefCodec = {
|
|
55
100
|
parse(doc, edition) {
|
|
101
|
+
// the dual-published print: the OIML side is the spine, whichever
|
|
102
|
+
// side prints first — resolved before the strict grammar, whose
|
|
103
|
+
// null would otherwise be the whole answer
|
|
104
|
+
if (!/^urn:/i.test(doc) && doc.includes("|")) {
|
|
105
|
+
const side = doc.split("|").map((s) => s.trim()).find((s) => /^(?:OIML|oiml)\b/i.test(s));
|
|
106
|
+
const dual = side ? dualOimlSpine(side) : null;
|
|
107
|
+
if (dual) return dual;
|
|
108
|
+
}
|
|
56
109
|
const p = parsePubid(doc);
|
|
57
110
|
if (!p || p.series !== "pub") return null;
|
|
58
111
|
const type = p.family.toUpperCase();
|
|
@@ -435,7 +435,7 @@ async function openapiCatalogRoute(c: RouteContext): Promise<Response> {
|
|
|
435
435
|
openapi: "3.1.0",
|
|
436
436
|
info: { title: `${P().publisher.product_name} API`, version: c.env.INDEX_VERSION ?? "0" },
|
|
437
437
|
paths: {},
|
|
438
|
-
"x-
|
|
438
|
+
"x-permissions-catalog": permissionsCatalog(),
|
|
439
439
|
},
|
|
440
440
|
200,
|
|
441
441
|
corsHeaders(c.req),
|