ai-model-verifier 1.4.0 → 2.0.0

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.
Files changed (224) hide show
  1. package/README.md +79 -21
  2. package/dist/engine/context.d.ts +43 -0
  3. package/dist/engine/context.d.ts.map +1 -0
  4. package/dist/engine/context.js +50 -0
  5. package/dist/engine/context.js.map +1 -0
  6. package/dist/engine/evidence.d.ts +40 -0
  7. package/dist/engine/evidence.d.ts.map +1 -0
  8. package/dist/engine/evidence.js +108 -0
  9. package/dist/engine/evidence.js.map +1 -0
  10. package/dist/engine/handshake.d.ts +16 -0
  11. package/dist/engine/handshake.d.ts.map +1 -0
  12. package/dist/{handshake.js → engine/handshake.js} +35 -63
  13. package/dist/engine/handshake.js.map +1 -0
  14. package/dist/engine/probe-runner.d.ts +14 -0
  15. package/dist/engine/probe-runner.d.ts.map +1 -0
  16. package/dist/engine/probe-runner.js +163 -0
  17. package/dist/engine/probe-runner.js.map +1 -0
  18. package/dist/engine/verdict.d.ts +15 -0
  19. package/dist/engine/verdict.d.ts.map +1 -0
  20. package/dist/engine/verdict.js +19 -0
  21. package/dist/engine/verdict.js.map +1 -0
  22. package/dist/highlight.d.ts +2 -2
  23. package/dist/highlight.d.ts.map +1 -1
  24. package/dist/highlight.js +10 -9
  25. package/dist/highlight.js.map +1 -1
  26. package/dist/{patterns.d.ts → identity/patterns.d.ts} +7 -0
  27. package/dist/identity/patterns.d.ts.map +1 -0
  28. package/dist/{patterns.js → identity/patterns.js} +7 -0
  29. package/dist/identity/patterns.js.map +1 -0
  30. package/dist/identity/signals.d.ts +15 -0
  31. package/dist/identity/signals.d.ts.map +1 -0
  32. package/dist/{signals.js → identity/signals.js} +15 -24
  33. package/dist/identity/signals.js.map +1 -0
  34. package/dist/index.d.ts +15 -5
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +12 -5
  37. package/dist/index.js.map +1 -1
  38. package/dist/internal/utils.d.ts +3 -1
  39. package/dist/internal/utils.d.ts.map +1 -1
  40. package/dist/internal/utils.js +12 -6
  41. package/dist/internal/utils.js.map +1 -1
  42. package/dist/models/catalog.d.ts +7 -0
  43. package/dist/models/catalog.d.ts.map +1 -0
  44. package/dist/models/catalog.js +23 -0
  45. package/dist/models/catalog.js.map +1 -0
  46. package/dist/models/facts.d.ts +56 -0
  47. package/dist/models/facts.d.ts.map +1 -0
  48. package/dist/models/facts.js +91 -0
  49. package/dist/models/facts.js.map +1 -0
  50. package/dist/models/index.d.ts +6 -0
  51. package/dist/models/index.d.ts.map +1 -0
  52. package/dist/models/index.js +5 -0
  53. package/dist/models/index.js.map +1 -0
  54. package/dist/{substitution.d.ts → models/substitution.d.ts} +3 -4
  55. package/dist/models/substitution.d.ts.map +1 -0
  56. package/dist/{substitution.js → models/substitution.js} +3 -4
  57. package/dist/models/substitution.js.map +1 -0
  58. package/dist/models/tiers.d.ts +14 -0
  59. package/dist/models/tiers.d.ts.map +1 -0
  60. package/dist/models/tiers.js +35 -0
  61. package/dist/models/tiers.js.map +1 -0
  62. package/dist/probes/prompts.d.ts +23 -0
  63. package/dist/probes/prompts.d.ts.map +1 -0
  64. package/dist/probes/prompts.js +31 -0
  65. package/dist/probes/prompts.js.map +1 -0
  66. package/dist/probes/table.d.ts +37 -0
  67. package/dist/probes/table.d.ts.map +1 -0
  68. package/dist/probes/table.js +57 -0
  69. package/dist/probes/table.js.map +1 -0
  70. package/dist/registry.d.ts +26 -0
  71. package/dist/registry.d.ts.map +1 -0
  72. package/dist/registry.js +23 -0
  73. package/dist/registry.js.map +1 -0
  74. package/dist/rules/index.d.ts +15 -0
  75. package/dist/rules/index.d.ts.map +1 -0
  76. package/dist/rules/index.js +8 -0
  77. package/dist/rules/index.js.map +1 -0
  78. package/dist/rules/probe-ladder.d.ts +33 -0
  79. package/dist/rules/probe-ladder.d.ts.map +1 -0
  80. package/dist/rules/probe-ladder.js +156 -0
  81. package/dist/rules/probe-ladder.js.map +1 -0
  82. package/dist/{detectors → rules}/response-metadata.d.ts +11 -14
  83. package/dist/rules/response-metadata.d.ts.map +1 -0
  84. package/dist/{detectors → rules}/response-metadata.js +32 -15
  85. package/dist/rules/response-metadata.js.map +1 -0
  86. package/dist/rules/table.d.ts +27 -0
  87. package/dist/rules/table.d.ts.map +1 -0
  88. package/dist/rules/table.js +47 -0
  89. package/dist/rules/table.js.map +1 -0
  90. package/dist/{detectors → rules}/thinking-floor.d.ts +14 -29
  91. package/dist/rules/thinking-floor.d.ts.map +1 -0
  92. package/dist/rules/thinking-floor.js +119 -0
  93. package/dist/rules/thinking-floor.js.map +1 -0
  94. package/dist/rules/thinking-signature.d.ts +43 -0
  95. package/dist/rules/thinking-signature.d.ts.map +1 -0
  96. package/dist/rules/thinking-signature.js +72 -0
  97. package/dist/rules/thinking-signature.js.map +1 -0
  98. package/dist/{detectors → rules}/throughput.d.ts +7 -10
  99. package/dist/rules/throughput.d.ts.map +1 -0
  100. package/dist/{detectors → rules}/throughput.js +32 -11
  101. package/dist/rules/throughput.js.map +1 -0
  102. package/dist/{detectors → rules}/token-truth.d.ts +7 -13
  103. package/dist/rules/token-truth.d.ts.map +1 -0
  104. package/dist/rules/token-truth.js +112 -0
  105. package/dist/rules/token-truth.js.map +1 -0
  106. package/dist/rules/tokenizer-fingerprint.d.ts +46 -0
  107. package/dist/rules/tokenizer-fingerprint.d.ts.map +1 -0
  108. package/dist/rules/tokenizer-fingerprint.js +110 -0
  109. package/dist/rules/tokenizer-fingerprint.js.map +1 -0
  110. package/dist/rules/types.d.ts +57 -0
  111. package/dist/rules/types.d.ts.map +1 -0
  112. package/dist/rules/types.js +2 -0
  113. package/dist/rules/types.js.map +1 -0
  114. package/dist/transport.d.ts +10 -2
  115. package/dist/transport.d.ts.map +1 -1
  116. package/dist/transport.js +40 -32
  117. package/dist/transport.js.map +1 -1
  118. package/dist/types.d.ts +70 -31
  119. package/dist/types.d.ts.map +1 -1
  120. package/dist/vendors/anthropic.d.ts +44 -0
  121. package/dist/vendors/anthropic.d.ts.map +1 -0
  122. package/dist/vendors/anthropic.js +114 -0
  123. package/dist/vendors/anthropic.js.map +1 -0
  124. package/dist/vendors/base-url.d.ts +3 -0
  125. package/dist/vendors/base-url.d.ts.map +1 -0
  126. package/dist/vendors/base-url.js +6 -0
  127. package/dist/vendors/base-url.js.map +1 -0
  128. package/dist/vendors/gemini.d.ts +44 -0
  129. package/dist/vendors/gemini.d.ts.map +1 -0
  130. package/dist/vendors/gemini.js +77 -0
  131. package/dist/vendors/gemini.js.map +1 -0
  132. package/dist/vendors/index.d.ts +9 -0
  133. package/dist/vendors/index.d.ts.map +1 -0
  134. package/dist/vendors/index.js +7 -0
  135. package/dist/vendors/index.js.map +1 -0
  136. package/dist/vendors/openai.d.ts +46 -0
  137. package/dist/vendors/openai.d.ts.map +1 -0
  138. package/dist/vendors/openai.js +77 -0
  139. package/dist/vendors/openai.js.map +1 -0
  140. package/dist/vendors/table.d.ts +113 -0
  141. package/dist/vendors/table.d.ts.map +1 -0
  142. package/dist/vendors/table.js +14 -0
  143. package/dist/vendors/table.js.map +1 -0
  144. package/dist/vendors/types.d.ts +93 -0
  145. package/dist/vendors/types.d.ts.map +1 -0
  146. package/dist/vendors/types.js +2 -0
  147. package/dist/vendors/types.js.map +1 -0
  148. package/dist/verify.d.ts +30 -0
  149. package/dist/verify.d.ts.map +1 -0
  150. package/dist/verify.js +185 -0
  151. package/dist/verify.js.map +1 -0
  152. package/package.json +25 -10
  153. package/dist/detectors/response-metadata.d.ts.map +0 -1
  154. package/dist/detectors/response-metadata.js.map +0 -1
  155. package/dist/detectors/thinking-floor.d.ts.map +0 -1
  156. package/dist/detectors/thinking-floor.js +0 -135
  157. package/dist/detectors/thinking-floor.js.map +0 -1
  158. package/dist/detectors/thinking-signature.d.ts +0 -70
  159. package/dist/detectors/thinking-signature.d.ts.map +0 -1
  160. package/dist/detectors/thinking-signature.js +0 -177
  161. package/dist/detectors/thinking-signature.js.map +0 -1
  162. package/dist/detectors/throughput.d.ts.map +0 -1
  163. package/dist/detectors/throughput.js.map +0 -1
  164. package/dist/detectors/token-truth.d.ts.map +0 -1
  165. package/dist/detectors/token-truth.js +0 -142
  166. package/dist/detectors/token-truth.js.map +0 -1
  167. package/dist/detectors/tokenizer-fingerprint.d.ts +0 -65
  168. package/dist/detectors/tokenizer-fingerprint.d.ts.map +0 -1
  169. package/dist/detectors/tokenizer-fingerprint.js +0 -135
  170. package/dist/detectors/tokenizer-fingerprint.js.map +0 -1
  171. package/dist/handshake.d.ts +0 -23
  172. package/dist/handshake.d.ts.map +0 -1
  173. package/dist/handshake.js.map +0 -1
  174. package/dist/internal/fixed-text.d.ts +0 -13
  175. package/dist/internal/fixed-text.d.ts.map +0 -1
  176. package/dist/internal/fixed-text.js +0 -13
  177. package/dist/internal/fixed-text.js.map +0 -1
  178. package/dist/models.d.ts +0 -5
  179. package/dist/models.d.ts.map +0 -1
  180. package/dist/models.js +0 -54
  181. package/dist/models.js.map +0 -1
  182. package/dist/nonce.d.ts +0 -4
  183. package/dist/nonce.d.ts.map +0 -1
  184. package/dist/nonce.js +0 -12
  185. package/dist/nonce.js.map +0 -1
  186. package/dist/patterns.d.ts.map +0 -1
  187. package/dist/patterns.js.map +0 -1
  188. package/dist/probes.d.ts +0 -10
  189. package/dist/probes.d.ts.map +0 -1
  190. package/dist/probes.js +0 -54
  191. package/dist/probes.js.map +0 -1
  192. package/dist/providers/anthropic.d.ts +0 -3
  193. package/dist/providers/anthropic.d.ts.map +0 -1
  194. package/dist/providers/anthropic.js +0 -67
  195. package/dist/providers/anthropic.js.map +0 -1
  196. package/dist/providers/config.d.ts +0 -34
  197. package/dist/providers/config.d.ts.map +0 -1
  198. package/dist/providers/config.js +0 -14
  199. package/dist/providers/config.js.map +0 -1
  200. package/dist/providers/gemini.d.ts +0 -3
  201. package/dist/providers/gemini.d.ts.map +0 -1
  202. package/dist/providers/gemini.js +0 -58
  203. package/dist/providers/gemini.js.map +0 -1
  204. package/dist/providers/openai.d.ts +0 -3
  205. package/dist/providers/openai.d.ts.map +0 -1
  206. package/dist/providers/openai.js +0 -56
  207. package/dist/providers/openai.js.map +0 -1
  208. package/dist/rules.d.ts +0 -6
  209. package/dist/rules.d.ts.map +0 -1
  210. package/dist/rules.js +0 -28
  211. package/dist/rules.js.map +0 -1
  212. package/dist/runner.d.ts +0 -39
  213. package/dist/runner.d.ts.map +0 -1
  214. package/dist/runner.js +0 -352
  215. package/dist/runner.js.map +0 -1
  216. package/dist/signals.d.ts +0 -11
  217. package/dist/signals.d.ts.map +0 -1
  218. package/dist/signals.js.map +0 -1
  219. package/dist/substitution.d.ts.map +0 -1
  220. package/dist/substitution.js.map +0 -1
  221. package/dist/verdict.d.ts +0 -26
  222. package/dist/verdict.d.ts.map +0 -1
  223. package/dist/verdict.js +0 -84
  224. package/dist/verdict.js.map +0 -1
@@ -0,0 +1,46 @@
1
+ import { type ChatRequest, type ProbeMeta, type ReasoningUsage, type WireCtx } from "./types";
2
+ declare function chat(req: ChatRequest, ctx: WireCtx): {
3
+ url: string;
4
+ headers: {
5
+ "content-type": string;
6
+ authorization: string;
7
+ };
8
+ body: {
9
+ max_tokens: number;
10
+ max_completion_tokens?: undefined;
11
+ model: string;
12
+ messages: readonly import("./types").ChatMessage[];
13
+ } | {
14
+ max_tokens?: undefined;
15
+ max_completion_tokens: number;
16
+ model: string;
17
+ messages: readonly import("./types").ChatMessage[];
18
+ };
19
+ };
20
+ declare function text(data: unknown): string | null;
21
+ declare function meta(data: unknown): ProbeMeta;
22
+ declare function reasoningUsage(data: unknown): ReasoningUsage | null;
23
+ export declare const openaiVendor: {
24
+ readonly id: "openai";
25
+ readonly vendorName: "openai";
26
+ readonly envelope: "openai";
27
+ readonly fallbackWires: readonly [];
28
+ readonly ops: {
29
+ readonly chat: typeof chat;
30
+ };
31
+ readonly read: {
32
+ readonly text: typeof text;
33
+ readonly meta: typeof meta;
34
+ readonly reasoningUsage: typeof reasoningUsage;
35
+ };
36
+ readonly identity: {
37
+ readonly home: readonly ["openai"];
38
+ readonly foreign: string[];
39
+ readonly homeModelNames: readonly ["gpt", "openai", "o1", "o3", "o4"];
40
+ readonly cloudModelNames: readonly [];
41
+ readonly acceptsCloudHost: false;
42
+ };
43
+ readonly tiers: null;
44
+ };
45
+ export {};
46
+ //# sourceMappingURL=openai.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openai.d.ts","sourceRoot":"","sources":["../../src/vendors/openai.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,OAAO,EACb,MAAM,SAAS,CAAC;AAkBjB,iBAAS,IAAI,CAAC,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE,OAAO;IASxC,GAAG;IACH,OAAO;QACL,cAAc;QACd,aAAa;;IAEf,IAAI;;;;;;;;;;;EAEP;AAED,iBAAS,IAAI,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAY1C;AAED,iBAAS,IAAI,CAAC,IAAI,EAAE,OAAO,GAAG,SAAS,CAatC;AAED,iBAAS,cAAc,CAAC,IAAI,EAAE,OAAO,GAAG,cAAc,GAAG,IAAI,CAW5D;AAED,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;CAevB,CAAC"}
@@ -0,0 +1,77 @@
1
+ import { intOf, rec } from "../internal/utils";
2
+ import { foreignPatternsExcept } from "../identity/patterns";
3
+ import { normalizeBaseUrl } from "./base-url";
4
+ import { defineVendor, } from "./types";
5
+ function chat(req, ctx) {
6
+ const min = ctx.facts.minOutputTokens;
7
+ // Reasoning models refuse `max_tokens` and need room for hidden thought;
8
+ // everything else gets the field every OpenAI-shaped relay understands.
9
+ const limit = min === null
10
+ ? { max_tokens: req.maxTokens }
11
+ : { max_completion_tokens: Math.max(req.maxTokens, min) };
12
+ return {
13
+ url: `${normalizeBaseUrl(ctx.baseUrl)}/v1/chat/completions`,
14
+ headers: {
15
+ "content-type": "application/json",
16
+ authorization: `Bearer ${ctx.apiKey}`,
17
+ },
18
+ body: { model: req.model, ...limit, messages: req.messages },
19
+ };
20
+ }
21
+ function text(data) {
22
+ const d = rec(data) ?? {};
23
+ if (d.error)
24
+ return null;
25
+ const content = d.choices?.[0]?.message?.content;
26
+ if (typeof content === "string")
27
+ return content.toLowerCase();
28
+ if (Array.isArray(content))
29
+ return content
30
+ .filter((b) => b.type === "text")
31
+ .map((b) => b.text ?? "")
32
+ .join(" ")
33
+ .toLowerCase();
34
+ return null;
35
+ }
36
+ function meta(data) {
37
+ const d = rec(data) ?? {};
38
+ const u = d.usage;
39
+ return {
40
+ detectedModel: typeof d.model === "string" ? d.model : null,
41
+ usage: u
42
+ ? {
43
+ prompt: intOf(u.prompt_tokens),
44
+ completion: intOf(u.completion_tokens),
45
+ total: intOf(u.total_tokens),
46
+ }
47
+ : null,
48
+ };
49
+ }
50
+ function reasoningUsage(data) {
51
+ const d = rec(data) ?? {};
52
+ const u = d.usage;
53
+ if (!u || typeof u !== "object")
54
+ return null;
55
+ const details = u.completion_tokens_details;
56
+ return {
57
+ completion: intOf(u.completion_tokens),
58
+ reasoning: intOf(details && typeof details === "object" ? details.reasoning_tokens : null),
59
+ };
60
+ }
61
+ export const openaiVendor = defineVendor({
62
+ id: "openai",
63
+ vendorName: "openai",
64
+ envelope: "openai",
65
+ fallbackWires: [],
66
+ ops: { chat },
67
+ read: { text, meta, reasoningUsage },
68
+ identity: {
69
+ home: ["openai"],
70
+ foreign: foreignPatternsExcept("openai"),
71
+ homeModelNames: ["gpt", "openai", "o1", "o3", "o4"],
72
+ cloudModelNames: [],
73
+ acceptsCloudHost: false,
74
+ },
75
+ tiers: null,
76
+ });
77
+ //# sourceMappingURL=openai.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openai.js","sourceRoot":"","sources":["../../src/vendors/openai.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,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IAAI,CACzE;KACF,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,YAAY,CAAC;IACvC,EAAE,EAAE,QAAQ;IACZ,UAAU,EAAE,QAAQ;IACpB,QAAQ,EAAE,QAAQ;IAClB,aAAa,EAAE,EAAE;IACjB,GAAG,EAAE,EAAE,IAAI,EAAE;IACb,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,EAAE;IACpC,QAAQ,EAAE;QACR,IAAI,EAAE,CAAC,QAAQ,CAAC;QAChB,OAAO,EAAE,qBAAqB,CAAC,QAAQ,CAAC;QACxC,cAAc,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;QACnD,eAAe,EAAE,EAAE;QACnB,gBAAgB,EAAE,KAAK;KACxB;IACD,KAAK,EAAE,IAAI;CACZ,CAAC,CAAC"}
@@ -0,0 +1,113 @@
1
+ import type { VendorAdapter } from "./types";
2
+ export declare const VENDORS: readonly [{
3
+ readonly id: "anthropic";
4
+ readonly vendorName: "anthropic";
5
+ readonly envelope: "anthropic";
6
+ readonly fallbackWires: readonly ["openai"];
7
+ readonly ops: {
8
+ readonly chat: (req: import("./types").ChatRequest, ctx: import("./types").WireCtx) => {
9
+ url: string;
10
+ headers: Record<string, string>;
11
+ body: Record<string, unknown>;
12
+ };
13
+ readonly countTokens: (req: import("./types").CountRequest, ctx: import("./types").WireCtx) => {
14
+ url: string;
15
+ headers: Record<string, string>;
16
+ body: {
17
+ model: string;
18
+ messages: readonly import("./types").ChatMessage[];
19
+ };
20
+ };
21
+ };
22
+ readonly read: {
23
+ readonly text: (data: unknown) => string | null;
24
+ readonly meta: (data: unknown) => import("./types").ProbeMeta;
25
+ readonly thinkingBlock: (data: unknown) => import("./types").ThinkingBlockRead | null;
26
+ readonly countedTokens: (data: unknown) => number | null;
27
+ };
28
+ readonly identity: {
29
+ readonly home: readonly ["anthropic"];
30
+ readonly foreign: string[];
31
+ readonly homeModelNames: readonly ["claude", "anthropic"];
32
+ readonly cloudModelNames: readonly ["amazon q", "q developer", "kiro"];
33
+ readonly acceptsCloudHost: true;
34
+ };
35
+ readonly tiers: readonly ["opus", "sonnet", "haiku", "fable"];
36
+ }, {
37
+ readonly id: "openai";
38
+ readonly vendorName: "openai";
39
+ readonly envelope: "openai";
40
+ readonly fallbackWires: readonly [];
41
+ readonly ops: {
42
+ readonly chat: (req: import("./types").ChatRequest, ctx: import("./types").WireCtx) => {
43
+ url: string;
44
+ headers: {
45
+ "content-type": string;
46
+ authorization: string;
47
+ };
48
+ body: {
49
+ max_tokens: number;
50
+ max_completion_tokens?: undefined;
51
+ model: string;
52
+ messages: readonly import("./types").ChatMessage[];
53
+ } | {
54
+ max_tokens?: undefined;
55
+ max_completion_tokens: number;
56
+ model: string;
57
+ messages: readonly import("./types").ChatMessage[];
58
+ };
59
+ };
60
+ };
61
+ readonly read: {
62
+ readonly text: (data: unknown) => string | null;
63
+ readonly meta: (data: unknown) => import("./types").ProbeMeta;
64
+ readonly reasoningUsage: (data: unknown) => import("./types").ReasoningUsage | null;
65
+ };
66
+ readonly identity: {
67
+ readonly home: readonly ["openai"];
68
+ readonly foreign: string[];
69
+ readonly homeModelNames: readonly ["gpt", "openai", "o1", "o3", "o4"];
70
+ readonly cloudModelNames: readonly [];
71
+ readonly acceptsCloudHost: false;
72
+ };
73
+ readonly tiers: null;
74
+ }, {
75
+ readonly id: "gemini";
76
+ readonly vendorName: "google";
77
+ readonly envelope: "gemini";
78
+ readonly fallbackWires: readonly ["openai"];
79
+ readonly ops: {
80
+ readonly chat: (req: import("./types").ChatRequest, ctx: import("./types").WireCtx) => {
81
+ url: string;
82
+ headers: {
83
+ "content-type": string;
84
+ "x-goog-api-key": string;
85
+ };
86
+ body: {
87
+ contents: {
88
+ role: string;
89
+ parts: readonly unknown[];
90
+ }[];
91
+ generationConfig: {
92
+ maxOutputTokens: number;
93
+ };
94
+ };
95
+ };
96
+ };
97
+ readonly read: {
98
+ readonly text: (data: unknown) => string | null;
99
+ readonly meta: (data: unknown) => import("./types").ProbeMeta;
100
+ readonly reasoningUsage: (data: unknown) => import("./types").ReasoningUsage | null;
101
+ };
102
+ readonly identity: {
103
+ readonly home: readonly ["google", "deepmind"];
104
+ readonly foreign: string[];
105
+ readonly homeModelNames: readonly ["gemini", "google"];
106
+ readonly cloudModelNames: readonly [];
107
+ readonly acceptsCloudHost: false;
108
+ };
109
+ readonly tiers: null;
110
+ }];
111
+ export type VendorId = (typeof VENDORS)[number]["id"];
112
+ export declare function vendorFor<V extends string>(vendors: readonly VendorAdapter<V>[], id: string): VendorAdapter<V> | undefined;
113
+ //# sourceMappingURL=table.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../src/vendors/table.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIyB,CAAC;AAE9C,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC;AAKtD,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,EACxC,OAAO,EAAE,SAAS,aAAa,CAAC,CAAC,CAAC,EAAE,EACpC,EAAE,EAAE,MAAM,GACT,aAAa,CAAC,CAAC,CAAC,GAAG,SAAS,CAE9B"}
@@ -0,0 +1,14 @@
1
+ import { anthropicVendor } from "./anthropic";
2
+ import { geminiVendor } from "./gemini";
3
+ import { openaiVendor } from "./openai";
4
+ export const VENDORS = [
5
+ anthropicVendor,
6
+ openaiVendor,
7
+ geminiVendor,
8
+ ];
9
+ // A fallback wire that names no adapter is a typo; fail the build, not the run.
10
+ void VENDORS;
11
+ export function vendorFor(vendors, id) {
12
+ return vendors.find((v) => v.id === id);
13
+ }
14
+ //# sourceMappingURL=table.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table.js","sourceRoot":"","sources":["../../src/vendors/table.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGxC,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,eAAe;IACf,YAAY;IACZ,YAAY;CAC+B,CAAC;AAI9C,gFAAgF;AAChF,KAAM,OAAoE,CAAC;AAE3E,MAAM,UAAU,SAAS,CACvB,OAAoC,EACpC,EAAU;IAEV,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;AAC1C,CAAC"}
@@ -0,0 +1,93 @@
1
+ import type { ModelFacts } from "../models/facts";
2
+ /** Vendor whose response shape a payload looks like. */
3
+ export type EnvelopeShape = "anthropic" | "openai" | "gemini" | "unknown";
4
+ export type ProbeUsage = {
5
+ prompt: number | null;
6
+ completion: number | null;
7
+ total: number | null;
8
+ };
9
+ export type ChatMessage = {
10
+ role: "user" | "assistant";
11
+ /** A string, or the vendor's own content blocks (a replayed thinking block). */
12
+ content: string | readonly unknown[];
13
+ };
14
+ export type ThinkingSpec = {
15
+ kind: "adaptive" | "extended";
16
+ budgetTokens: number;
17
+ };
18
+ export type ChatRequest = {
19
+ model: string;
20
+ maxTokens: number;
21
+ messages: readonly ChatMessage[];
22
+ thinking?: ThinkingSpec;
23
+ };
24
+ export type CountRequest = {
25
+ model: string;
26
+ messages: readonly ChatMessage[];
27
+ };
28
+ export type WireCtx = {
29
+ baseUrl: string;
30
+ apiKey: string;
31
+ /** The request leaves a browser: some vendors want an opt-in header. */
32
+ direct: boolean;
33
+ facts: ModelFacts;
34
+ };
35
+ export type BuiltRequest = {
36
+ url: string;
37
+ headers: Record<string, string>;
38
+ body: unknown;
39
+ };
40
+ export type ProbeMeta = {
41
+ detectedModel: string | null;
42
+ usage: ProbeUsage | null;
43
+ };
44
+ export type ThinkingBlockRead = {
45
+ /** The raw block, for replay. */
46
+ block: unknown;
47
+ signature: string;
48
+ chars: number;
49
+ };
50
+ export type ReasoningUsage = {
51
+ completion: number | null;
52
+ reasoning: number | null;
53
+ };
54
+ export type VendorIdentity = {
55
+ /** Words a genuine model uses for its maker. */
56
+ home: readonly string[];
57
+ /** Words that name a competitor. */
58
+ foreign: readonly string[];
59
+ homeModelNames: readonly string[];
60
+ /** Model names a cloud host sells under its own badge (Amazon Q over Claude). */
61
+ cloudModelNames: readonly string[];
62
+ /** A cloud host named as the maker still counts as home (Bedrock is Claude). */
63
+ acceptsCloudHost: boolean;
64
+ };
65
+ /**
66
+ * One wire format. Every request the engine makes goes through `ops`, every
67
+ * reply is read through `read`, so a rule never knows a URL or a header name.
68
+ */
69
+ export type VendorAdapter<Id extends string = string> = {
70
+ id: Id;
71
+ /** Name shown in reports ("google" for the gemini wire). */
72
+ vendorName: string;
73
+ envelope: EnvelopeShape;
74
+ /** Wires the handshake tries after this one, in order. */
75
+ fallbackWires: readonly string[];
76
+ ops: {
77
+ chat(req: ChatRequest, ctx: WireCtx): BuiltRequest;
78
+ countTokens?(req: CountRequest, ctx: WireCtx): BuiltRequest;
79
+ };
80
+ read: {
81
+ /** Lowercased reply text; null on an error envelope. */
82
+ text(data: unknown): string | null;
83
+ meta(data: unknown): ProbeMeta;
84
+ thinkingBlock?(data: unknown): ThinkingBlockRead | null;
85
+ reasoningUsage?(data: unknown): ReasoningUsage | null;
86
+ countedTokens?(data: unknown): number | null;
87
+ };
88
+ identity: VendorIdentity;
89
+ /** Tier vocabulary for tier checks; null when the vendor sells no tiers. */
90
+ tiers: readonly string[] | null;
91
+ };
92
+ export declare const defineVendor: <const V extends VendorAdapter>(vendor: V) => V;
93
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/vendors/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,wDAAwD;AACxD,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE1E,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,gFAAgF;IAChF,OAAO,EAAE,MAAM,GAAG,SAAS,OAAO,EAAE,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,UAAU,GAAG,UAAU,CAAC;IAC9B,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,SAAS,WAAW,EAAE,CAAC;IACjC,QAAQ,CAAC,EAAE,YAAY,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,SAAS,WAAW,EAAE,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,wEAAwE;IACxE,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,UAAU,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACz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AAE,OAAO,GAAG,YAAY,CAAC;KAC7D,CAAC;IACF,IAAI,EAAE;QACJ,wDAAwD;QACxD,IAAI,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAAC;QACnC,IAAI,CAAC,IAAI,EAAE,OAAO,GAAG,SAAS,CAAC;QAC/B,aAAa,CAAC,CAAC,IAAI,EAAE,OAAO,GAAG,iBAAiB,GAAG,IAAI,CAAC;QACxD,cAAc,CAAC,CAAC,IAAI,EAAE,OAAO,GAAG,cAAc,GAAG,IAAI,CAAC;QACtD,aAAa,CAAC,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAAC;KAC9C,CAAC;IACF,QAAQ,EAAE,cAAc,CAAC;IACzB,4EAA4E;IAC5E,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAAC;CACjC,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,KAAK,CAAC,CAAC,SAAS,aAAa,UAAU,CAAC,KAAG,CAChE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export const defineVendor = (vendor) => vendor;
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/vendors/types.ts"],"names":[],"mappings":"AAyGA,MAAM,CAAC,MAAM,YAAY,GAAG,CAAgC,MAAS,EAAK,EAAE,CAC1E,MAAM,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { callWire } from "./engine/context";
2
+ import { type FactsEntry } from "./models/facts";
3
+ import { type RuleId } from "./rules/table";
4
+ import type { Rule } from "./rules/types";
5
+ import type { RuleRun, VerifyOptions, VerifyResult } from "./types";
6
+ import { type VendorId } from "./vendors/table";
7
+ import type { VendorAdapter } from "./vendors/types";
8
+ export type Registry<V extends string = VendorId, R extends string = RuleId> = {
9
+ vendors: readonly VendorAdapter<V>[];
10
+ rules: readonly Rule<R>[];
11
+ facts: readonly FactsEntry[];
12
+ };
13
+ export declare const DEFAULT_REGISTRY: Registry;
14
+ /** Handshake, probes, every enabled rule, verdict. */
15
+ export declare function verifyWith<V extends string, R extends string>(registry: Registry<V, R>, opts: VerifyOptions<V>): Promise<VerifyResult<V, R>>;
16
+ /**
17
+ * Judge chosen rules on a wire the caller already knows works: no handshake,
18
+ * no verdict, only the evidence those rules ask for. A rule named here runs
19
+ * whether or not its `checks` switch is on; `checks` still carries options.
20
+ */
21
+ export declare function runRulesWith<V extends string, R extends string>(registry: Registry<V, R>, opts: VerifyOptions<V> & {
22
+ only: readonly R[];
23
+ }): Promise<RuleRun<R>>;
24
+ export declare const verify: (opts: VerifyOptions) => Promise<VerifyResult<"anthropic" | "gemini" | "openai", "cjk-leak" | "coding-tool" | "envelope" | "foreign" | "mux" | "quorum" | "scam" | "served-model-mismatch" | "signature" | "substituted" | "thinking-floor" | "throughput" | "tier-self-report" | "token-truth" | "tokenizer-fingerprint">>;
25
+ export declare const runRules: (opts: VerifyOptions & {
26
+ only: readonly RuleId[];
27
+ }) => Promise<RuleRun<"cjk-leak" | "coding-tool" | "envelope" | "foreign" | "mux" | "quorum" | "scam" | "served-model-mismatch" | "signature" | "substituted" | "thinking-floor" | "throughput" | "tier-self-report" | "token-truth" | "tokenizer-fingerprint">>;
28
+ /** One raw request through the run's transport and body extras, for callers with their own probes. */
29
+ export { callWire };
30
+ //# sourceMappingURL=verify.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../src/verify.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAA8B,MAAM,kBAAkB,CAAC;AAMxE,OAAO,EAGL,KAAK,UAAU,EAChB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAS,KAAK,MAAM,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EAAoB,IAAI,EAAW,MAAM,eAAe,CAAC;AAErE,OAAO,KAAK,EAGV,OAAO,EACP,aAAa,EACb,YAAY,EACb,MAAM,SAAS,CAAC;AACjB,O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Wire, resolveChecks } from "./engine/context";
2
+ import { EVIDENCE_ORDER, EvidenceStore } from "./engine/evidence";
3
+ import { runHandshake } from "./engine/handshake";
4
+ import { foldVerdict } from "./engine/verdict";
5
+ import { hostOf } from "./internal/utils";
6
+ import { normalizeModelId, resolveModelFacts, } from "./models/facts";
7
+ import { makeNonce } from "./probes/prompts";
8
+ import { RULES } from "./rules/table";
9
+ import { browserTransport, directTransport } from "./transport";
10
+ import { VENDORS, vendorFor } from "./vendors/table";
11
+ const DEFAULT_TIMEOUT_MS = 30_000;
12
+ export const DEFAULT_REGISTRY = {
13
+ vendors: VENDORS,
14
+ rules: RULES,
15
+ facts: [],
16
+ };
17
+ function buildCtx(registry, opts) {
18
+ const wire = vendorFor(registry.vendors, opts.vendor);
19
+ if (!wire)
20
+ throw new TypeError(`unknown vendor "${opts.vendor}"`);
21
+ const floor = opts.checks?.thinkingFloor;
22
+ const floorModels = typeof floor === "object" ? (floor.models ?? []) : [];
23
+ const facts = resolveModelFacts(opts.model, [
24
+ ...floorModels.map((p) => ({
25
+ match: `${normalizeModelId(p)}*`,
26
+ alwaysThinks: true,
27
+ })),
28
+ ...registry.facts,
29
+ ]);
30
+ const transport = opts.transport ??
31
+ (opts.mode === "server"
32
+ ? opts.serverProxyUrl
33
+ ? browserTransport({ serverProxyUrl: opts.serverProxyUrl })
34
+ : undefined
35
+ : directTransport);
36
+ if (!transport)
37
+ throw new TypeError("server mode needs a transport or a serverProxyUrl");
38
+ return {
39
+ model: opts.model,
40
+ facts,
41
+ requestedVendor: opts.vendor,
42
+ wire,
43
+ mode: opts.mode,
44
+ direct: opts.mode === "direct",
45
+ baseUrl: opts.baseUrl,
46
+ apiKey: opts.apiKey,
47
+ timeoutMs: opts.timeoutMs ?? DEFAULT_TIMEOUT_MS,
48
+ transport,
49
+ ...(opts.bodyExtras ? { bodyExtras: opts.bodyExtras } : {}),
50
+ nonce: opts.nonce ?? makeNonce,
51
+ ...(opts.onProbe ? { onProbe: opts.onProbe } : {}),
52
+ checks: resolveChecks(opts.checks),
53
+ };
54
+ }
55
+ /**
56
+ * Collect what the applicable rules need, in canonical order, then judge them
57
+ * in table order so the findings carry their precedence.
58
+ */
59
+ async function runRuleSet(ctx, rules) {
60
+ const active = rules.filter((r) => r.applies(ctx));
61
+ const needs = new Set(active.flatMap((r) => r.needs));
62
+ const store = new EvidenceStore(ctx);
63
+ for (const key of EVIDENCE_ORDER)
64
+ if (needs.has(key))
65
+ await store.get(key);
66
+ const rctx = { ...ctx, evidence: (key) => store.get(key) };
67
+ const findings = [];
68
+ const reports = {};
69
+ for (const rule of active) {
70
+ const verdict = await rule.judge(rctx);
71
+ if (verdict)
72
+ findings.push({ ...verdict, rule: rule.id, layer: rule.layer });
73
+ if (rule.report)
74
+ Object.assign(reports, await rule.report(rctx));
75
+ }
76
+ return {
77
+ findings,
78
+ reports,
79
+ probes: needs.has("probes") ? await store.get("probes") : [],
80
+ };
81
+ }
82
+ const publicProbe = (p) => ({
83
+ label: p.label,
84
+ pass: p.pass,
85
+ signal: p.signal,
86
+ muxFailure: p.muxFailure,
87
+ transient: p.transient,
88
+ latencyMs: p.latencyMs,
89
+ prompt: p.prompt,
90
+ responseText: p.responseText,
91
+ httpStatus: p.httpStatus,
92
+ usage: p.usage,
93
+ detectedModel: p.detectedModel,
94
+ reason: p.reason,
95
+ });
96
+ function sumUsage(usages) {
97
+ const present = usages.filter((u) => u !== null);
98
+ if (present.length === 0)
99
+ return null;
100
+ const add = (key) => {
101
+ const vals = present
102
+ .map((u) => u[key])
103
+ .filter((v) => v !== null);
104
+ return vals.length > 0 ? vals.reduce((a, b) => a + b, 0) : null;
105
+ };
106
+ return {
107
+ prompt: add("prompt"),
108
+ completion: add("completion"),
109
+ total: add("total"),
110
+ };
111
+ }
112
+ function connectivityResult(opts, error, corsBlocked, startedAt) {
113
+ return {
114
+ vendor: opts.vendor,
115
+ model: opts.model,
116
+ baseUrlHost: hostOf(opts.baseUrl),
117
+ verdict: "unverified",
118
+ versionUnverifiable: false,
119
+ probes: [],
120
+ findings: [],
121
+ reasons: [error],
122
+ probesPassed: 0,
123
+ probesTotal: 0,
124
+ latencyMs: Math.round(performance.now() - startedAt),
125
+ transport: opts.mode,
126
+ corsBlocked,
127
+ detectedModel: null,
128
+ totalUsage: null,
129
+ resolvedVendor: opts.vendor,
130
+ connectivityError: error,
131
+ };
132
+ }
133
+ /** Handshake, probes, every enabled rule, verdict. */
134
+ export async function verifyWith(registry, opts) {
135
+ const started = performance.now();
136
+ const requested = buildCtx(registry, opts);
137
+ const hs = await runHandshake(requested, registry.vendors);
138
+ if (!hs.ok)
139
+ return connectivityResult(opts, hs.reason, hs.corsBlocked, started);
140
+ const ctx = { ...requested, wire: hs.wire };
141
+ const rules = registry.rules.filter((r) => !r.check || ctx.checks[r.check]);
142
+ const run = await runRuleSet(ctx, rules);
143
+ const folded = foldVerdict(run.findings);
144
+ const probes = run.probes.map(publicProbe);
145
+ return {
146
+ ...run.reports,
147
+ vendor: opts.vendor,
148
+ model: opts.model,
149
+ baseUrlHost: hostOf(opts.baseUrl),
150
+ verdict: folded.verdict,
151
+ versionUnverifiable: folded.versionUnverifiable,
152
+ probes,
153
+ findings: run.findings,
154
+ reasons: folded.reasons,
155
+ probesPassed: probes.filter((p) => p.pass).length,
156
+ probesTotal: probes.length,
157
+ latencyMs: Math.round(performance.now() - started),
158
+ transport: ctx.mode,
159
+ corsBlocked: ctx.direct && run.probes.some((p) => p.corsBlocked),
160
+ detectedModel: probes.find((p) => p.detectedModel)?.detectedModel ?? null,
161
+ totalUsage: sumUsage(probes.map((p) => p.usage)),
162
+ resolvedVendor: hs.wire.id,
163
+ connectivityError: null,
164
+ };
165
+ }
166
+ /**
167
+ * Judge chosen rules on a wire the caller already knows works: no handshake,
168
+ * no verdict, only the evidence those rules ask for. A rule named here runs
169
+ * whether or not its `checks` switch is on; `checks` still carries options.
170
+ */
171
+ export async function runRulesWith(registry, opts) {
172
+ const ctx = buildCtx(registry, opts);
173
+ const wanted = new Set(opts.only);
174
+ const run = await runRuleSet(ctx, registry.rules.filter((r) => wanted.has(r.id)));
175
+ return {
176
+ findings: run.findings,
177
+ reports: run.reports,
178
+ probes: run.probes.map(publicProbe),
179
+ };
180
+ }
181
+ export const verify = (opts) => verifyWith(DEFAULT_REGISTRY, opts);
182
+ export const runRules = (opts) => runRulesWith(DEFAULT_REGISTRY, opts);
183
+ /** One raw request through the run's transport and body extras, for callers with their own probes. */
184
+ export { callWire };
185
+ //# sourceMappingURL=verify.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify.js","sourceRoot":"","sources":["../src/verify.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAe,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EACL,gBAAgB,EAChB,iBAAiB,GAElB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAe,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAQhE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAiB,MAAM,iBAAiB,CAAC;AAGpE,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAQlC,MAAM,CAAC,MAAM,gBAAgB,GAAa;IACxC,OAAO,EAAE,OAAO;IAChB,KAAK,EAAE,KAAK;IACZ,KAAK,EAAE,EAAE;CACV,CAAC;AAEF,SAAS,QAAQ,CACf,QAA6B,EAC7B,IAAsB;IAEtB,MAAM,IAAI,GAAG,SAAS,CAAC,QAAQ,CAAC,OAAO,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