@framers/agentos-ext-citation-check 0.3.0 → 0.4.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.
package/README.md CHANGED
@@ -273,18 +273,53 @@ const outcome = await checker.check(
273
273
  // outcome.kind 'decided': outcome.decision.relation 'differs', the pair 1918 beside 1919 (offsets into
274
274
  // outcome.decision.texts[0], the sentence as read), outcome.named the passage,
275
275
  // outcome.quote 'signed on 28 June 1919', outcome.verdict the verifier's ClaimVerdict, outcome.usage the tokens
276
- // outcome.kind 'ended': outcome.reason 'no_passage' | 'no_best' | 'judge_none' | 'quote' | 'undecided'
276
+ // outcome.kind 'ended': outcome.reason 'no_passage' | 'limited' | 'no_best' | 'judge_none' | 'quote' | 'undecided'
277
+ // outcome.kind 'known': a verdict key the host passed in `known`, with nothing sent
277
278
  ```
278
279
 
279
- `check(claim, given, { signal, found })` runs these steps in order, and stops at the first that ends it:
280
+ `check(claim, given, { signal, found, known, beforeSend, verdictContext })` runs these steps in order, and stops at the first that ends it:
280
281
 
281
- 1. The grounding guard's `passages` keeps the sentences of `given` about the claim (two shared stems and a comparable value, or the claim's names for a stated fact without a value). None ends `no_passage`, with nothing sent anywhere.
282
- 2. AgentOS's `CitationVerifier`, its thresholds 0, embeds the claim and the first `maxPassages` (24) kept in one call and names the best by cosine. A sentence two sources share word for word, such as a page that copies an encyclopedia, is compared once, as the first of them, so the judge reads the title and kind of the passage the outcome names; every passage found still meets step 5. The cosine decides nothing. No passage above 0 ends `no_best`.
283
- 3. The judge is asked once about that sentence, under `claimJudgeSystem(kind)` with `claimJudgePrompt`: `matches`, `differs` or `none`, with the words it compared quoted. `none` ends `judge_none`.
284
- 4. The quote must hold 1 to 20 words (`CLAIM_QUOTE_MAX_WORDS`) and stand in the sentence word for word, cutting no word or number (the grounding guard's `verifyQuotes`, typographic quotation marks read as plain ones). Else it ends `quote`.
285
- 5. The grounding guard's `decide` takes the judge's relation as a proposal and decides by code over every passage found, the ones in `found` among them: a "differs" needs every content word heard and a heard value paired with a different one, and a passage found that agrees with every heard value stops it. Nothing decided ends `undecided`.
282
+ 1. The grounding guard's `passages` keeps the sentences of `given` about the claim (two shared stems and a comparable value, or the claim's names for a stated fact without a value). None ends `no_passage`, with nothing sent anywhere. The first `maxPassages` (24) kept are compared; a sentence two sources share word for word, such as a page that copies an encyclopedia, is compared once, as the first of them, so the judge reads the title and kind of the passage the outcome names, and every passage found still meets step 8.
283
+ 2. With `verdictSecret`, the verdict key is made (below). A key in `known` ends the check `known`, with nothing sent.
284
+ 3. `beforeSend()` is awaited once, before anything is sent; unless it answers `true` the check ends `limited`. A host counts its allowance here, so a known repeat costs none.
285
+ 4. One sentence compared is named with no embeddings call (AgentOS's `CitationVerifier` with `pickOnly`), and the judge decides.
286
+ 5. Otherwise the claim is embedded in one call with every compared sentence that carries no passage `vector` and has no stored public vector. Sentence vectors and passage vectors are not on one scale, so each class is ranked by its own cosine, and of the two classes' best the one earlier among the compared sentences (more stems shared with what was heard) is named. A sentence whose cosine is 0 or less is never named; none ends `no_best`. The cosine decides nothing else.
287
+ 6. The judge is asked once about that sentence, under `claimJudgeSystem(kind)` with `claimJudgePrompt`: `matches`, `differs` or `none`, with the words it compared quoted. `none` ends `judge_none`.
288
+ 7. The quote must hold 1 to 20 words (`CLAIM_QUOTE_MAX_WORDS`) and stand in the sentence word for word, cutting no word or number (the grounding guard's `verifyQuotes`, typographic quotation marks read as plain ones). Else it ends `quote`.
289
+ 8. The grounding guard's `decide` takes the judge's relation as a proposal and decides by code over every passage found, the ones in `found` among them: a "differs" needs every content word heard and a heard value paired with a different one, and a passage found that agrees with every heard value stops it. Nothing decided ends `undecided`.
286
290
 
287
- `found` is every passage about the claim the host holds, the ones it must not send included, such as a sentence that holds personal data: they are never embedded, judged or sent, and take part in step 5 alone. Left out, it is `given`'s passages about the claim.
291
+ `found` is every passage about the claim the host holds, the ones it must not send included, such as a sentence that holds personal data: they are never embedded, judged or sent, and take part in step 8 alone. Left out, it is `given`'s passages about the claim.
292
+
293
+ #### Vectors a host holds, and the verdict key
294
+
295
+ A check embeds no text whose vector the host already holds:
296
+
297
+ ```ts
298
+ const checker = new ClaimChecker({
299
+ embed, judge, checker: valueChecker,
300
+ grader: { judgeModel: 'openai:gpt-6-luna', embedding: { model: 'text-embedding-3-small', dimensions: 1536 } },
301
+ // Public sentences' vectors by the hash of their exact input, the tenant fixed by the host, such as AgentOS's
302
+ // SqlEmbeddingStore bound to it; clean is the host's redaction test.
303
+ publicVectors: {
304
+ get: (hashes) => store.get({ tenant }, model, hashes),
305
+ put: (rows) => store.put({ tenant }, model, rows),
306
+ clean: (text) => !redact(text).found,
307
+ },
308
+ verdictSecret: process.env.CLAIM_VERDICT_SECRET,
309
+ });
310
+ const outcome = await checker.check(claim, passages, {
311
+ signal,
312
+ known: keysHeldForThisRun, // a verdict the host already holds ends 'known', with nothing sent
313
+ beforeSend: () => allowance.take(), // awaited once, before the first send
314
+ verdictContext: `${accountId}:${runId}`,
315
+ });
316
+ ```
317
+
318
+ - A passage's `vector` (`{ embedding, level: 'passage', passageId, inputHash }`) is the vector of the passage a sentence stands in, made by the check's embedding model: the sentence is ranked by it and never sent to the embeddings. With `grader`, a vector of another size than its embedding's is left out and the sentence is embedded; without it, a vector of another size than the claim's throws a `RangeError`. An embeddings answer holding a vector of another size, or a value that is not a finite number, rejects the check before the judge is asked.
319
+ - A sentence marked `publicKey`, only for a verified public source, whose text `clean` passes, is looked up in `publicVectors` by the SHA-256 of the model, NUL, the dimensions, NUL and the text (AgentOS's `embeddingInputHash`). A store that rejects or answers after `vectorReadMs` (200) counts as empty, and `usage.vectorHits` counts the vectors read. The vectors the check made for such sentences are stored after the verdict, a failed or late write changing nothing; an abort while they are written rejects the check at once with the signal's reason. Any other sentence is embedded and never stored.
320
+ - The verdict key is an HMAC-SHA-256, under a key derived by HKDF from `verdictSecret` with `verdictContext` (an account and a run, so a key never matches across them), over everything that decides the verdict: this pack's and the grounding guard's versions, the judge's model, the embedding model and size, `maxPassages`, the grounding guard checker's rules as `grader.rules` names them (`'names:true'`, for example), the claim, each compared sentence with its text, title, kind, group, `ref` and passage vector (its id, its `inputHash` and a hash of the vector), and each sentence found with its text, group, `ref` and whether it is held back. A changed sentence, a 25th agreeing sentence found, a held-back sentence changed, a new release of either pack or another context makes a new key. Every outcome past `no_passage` carries `key`.
321
+
322
+ `publicVectors` and `verdictSecret` need `grader`; the constructor throws without it.
288
323
 
289
324
  The judge's instruction names the source by the named passage's `kind`, an open word:
290
325
 
@@ -309,7 +344,7 @@ In both, every passage of `more` and `found` takes part in the veto, as `check`'
309
344
 
310
345
  Each call reads every passage once, as it is when the call begins (its text, group, title, kind and address), and never again: a host that redacts a passage in place between calls sends only the redacted text from then on, and a change made while a call runs reaches only later calls. `agree` and `revisit` read the first check's passages as they are when they are called, so a passage the host moved to another source is read in that source. A decision's `sentences` are the host's own passage objects, and its `texts` hold each one's text as the call read it, at the same index: `marks` and `pairs` index `texts`, whatever the host has done to a passage since. `texts` is the host's copy: `agree` reads the sentence of the decision it is given as the call that answered it read it (`check`'s, or `revisit`'s when the host puts that decision in the outcome's place), kept apart with the decision's `pairs`, so a host may redact or reformat `texts`, in place or in a shallow copy of the decision, without changing what `agree` answers. A decision whose `pairs` the host has replaced is read from its `texts`.
311
346
 
312
- `usage` counts the judge's tokens in and out and the embeddings' tokens apart; `judged` is the judge calls made (0 or 1). An abort rejects `check` with the signal's reason at once, whatever is pending; a failed embeddings call or judge rejects with its own error.
347
+ `usage` counts the judge's tokens in and out, the embeddings' tokens and the public vectors read apart; `judged` is the judge calls made (0 or 1). An abort rejects `check` with the signal's reason at once, whatever is pending; a failed embeddings call or judge rejects with its own error.
313
348
 
314
349
  ## The tool
315
350
 
@@ -321,7 +356,7 @@ import { createExtensionPack } from '@framers/agentos-ext-citation-check';
321
356
  const pack = createExtensionPack({ options: { embeddings: 'openai' }, getSecret: (id) => secrets[id] });
322
357
  ```
323
358
 
324
- The tool reads pages through AgentOS's checked egress with the hosted policy, so a document cannot point it at a private address. The pack needs AgentOS 0.13.158 or later: checked egress came in 0.13.120, and `claimJudge` needs `generateObject`'s `maxAttempts`, which came in 0.13.158. Pack options: `embeddings` (`none` or `openai`, the key from the `openai.apiKey` secret or `OPENAI_API_KEY`), `embeddingModel`, `egress` (`hosted` or `local`), and from code `fetch`, `embedFn` and `nliFn`, with `timeoutMs`, `maxBytes`, `maxPages` and `priority`.
359
+ The tool reads pages through AgentOS's checked egress with the hosted policy, so a document cannot point it at a private address. The pack needs AgentOS 0.19.4 or later: checked egress came in 0.13.120, `claimJudge` needs `generateObject`'s `maxAttempts`, which came in 0.13.158, and `ClaimChecker` needs `CitationVerifier`'s source vectors and `pickOnly`, which came in 0.19.4. Pack options: `embeddings` (`none` or `openai`, the key from the `openai.apiKey` secret or `OPENAI_API_KEY`), `embeddingModel`, `egress` (`hosted` or `local`), and from code `fetch`, `embedFn` and `nliFn`, with `timeoutMs`, `maxBytes`, `maxPages` and `priority`.
325
360
 
326
361
  ## API
327
362
 
package/dist/claims.d.ts CHANGED
@@ -44,12 +44,60 @@ export interface ClaimPassage {
44
44
  * `document`, or any other. It chooses the judge's instruction ({@link claimJudgeSystem}).
45
45
  */
46
46
  kind: string;
47
+ /**
48
+ * The vector of the passage the sentence stands in, made by the check's embedding model: the sentence is ranked by
49
+ * it and never sent to the embeddings. Sentences of one passage share it.
50
+ */
51
+ vector?: ClaimPassageVector;
52
+ /**
53
+ * True only for a sentence of a verified public source, whose vector may be read from and written to
54
+ * {@link ClaimCheckerOptions.publicVectors} when the host's `clean` test passes it.
55
+ */
56
+ publicKey?: boolean;
57
+ /** The host's reference for citing the sentence, which the verdict key reads. */
58
+ ref?: string;
59
+ }
60
+ /** A passage's vector a host holds, with the passage's id and the hash of the input it was made from. */
61
+ export interface ClaimPassageVector {
62
+ embedding: readonly number[];
63
+ level: 'passage';
64
+ passageId: string;
65
+ inputHash: string;
47
66
  }
48
- /** The tokens a check used: the judge's in and out, and the embeddings' in. */
67
+ /**
68
+ * A store of public sentences' vectors by the hash of their exact input, its tenant and model fixed by the host, such
69
+ * as AgentOS's `SqlEmbeddingStore` with them bound, and the host's test of what may be stored.
70
+ */
71
+ export interface ClaimPublicVectors {
72
+ /** The stored vectors of the hashes given, by hash; a hash with none is left out. */
73
+ get(hashes: readonly string[]): Promise<ReadonlyMap<string, readonly number[]>>;
74
+ /** Stores each vector under its hash. */
75
+ put(rows: ReadonlyArray<{
76
+ hash: string;
77
+ vector: readonly number[];
78
+ }>): Promise<unknown>;
79
+ /** The host's redaction test: true when the sentence holds nothing that may not be stored or read by its hash. */
80
+ clean(text: string): boolean | Promise<boolean>;
81
+ }
82
+ /** What grades a check, beside this pack's and the grounding guard's versions: the judge's model and the embeddings'. */
83
+ export interface ClaimGrader {
84
+ judgeModel: string;
85
+ embedding: {
86
+ model: string;
87
+ dimensions: number;
88
+ };
89
+ /**
90
+ * The host's name for the grounding guard checker's rules (its options, such as `names`), which the verdict key
91
+ * reads, so a check under other rules never matches a key made under these.
92
+ */
93
+ rules?: string;
94
+ }
95
+ /** The tokens a check used: the judge's in and out, and the embeddings' in; and the public vectors read from the store. */
49
96
  export interface ClaimUsage {
50
97
  judgeIn: number;
51
98
  judgeOut: number;
52
99
  embedIn: number;
100
+ vectorHits: number;
53
101
  }
54
102
  /** What a judge answers about one sentence: the relation, and the words of the sentence it compared. */
55
103
  export interface ClaimJudgement {
@@ -87,6 +135,14 @@ export interface ClaimCheckerOptions {
87
135
  checker: Pick<ValueAgreementChecker, 'passages' | 'decide' | 'stems'>;
88
136
  /** The most passages the verifier compares; 24 when left out. */
89
137
  maxPassages?: number;
138
+ /** A store of public sentences' vectors; it needs `grader`, whose embedding names the hash. */
139
+ publicVectors?: ClaimPublicVectors;
140
+ /** What grades a check, which the verdict key and the stored vectors' hashes read. */
141
+ grader?: ClaimGrader;
142
+ /** The host's secret, from which each context's verdict key is derived; it needs `grader`. */
143
+ verdictSecret?: string | Uint8Array;
144
+ /** How long a read of `publicVectors` may take before it counts as empty, in milliseconds; 200 when left out. */
145
+ vectorReadMs?: number;
90
146
  }
91
147
  /** The grounding guard's decision, its sentences the host's own passages. */
92
148
  export type ClaimDecision<P extends ClaimPassage = ClaimPassage> = Omit<Decision, 'sentences'> & {
@@ -100,15 +156,19 @@ export type ClaimDecision<P extends ClaimPassage = ClaimPassage> = Omit<Decision
100
156
  };
101
157
  /**
102
158
  * What a check came to: a decision, with the passage the verifier named, the judge's quote, the verifier's verdict, the
103
- * judge calls made and the tokens used; or why nothing may be shown.
159
+ * judge calls made and the tokens used; a verdict the host already holds; or why nothing may be shown.
104
160
  *
105
161
  * - `no_passage`: no passage given is about the claim; nothing was sent to a model;
162
+ * - `limited`: `beforeSend` did not answer true; nothing was sent;
106
163
  * - `no_best`: the verifier named no passage (no cosine above 0);
107
164
  * - `judge_none`: the judge answered `none`;
108
165
  * - `quote`: the judge's quote is empty, longer than {@link CLAIM_QUOTE_MAX_WORDS} words, or does not stand word for
109
166
  * word in the sentence;
110
167
  * - `undecided`: the grounding guard's rule decided nothing, a passage found that agrees with every heard value among
111
168
  * the reasons.
169
+ *
170
+ * With `verdictSecret`, every outcome past `no_passage` carries `key`, the verdict key; `known` answers a key the host
171
+ * passed in `known`, with nothing sent.
112
172
  */
113
173
  export type ClaimCheckOutcome<P extends ClaimPassage = ClaimPassage> = {
114
174
  kind: 'decided';
@@ -118,11 +178,18 @@ export type ClaimCheckOutcome<P extends ClaimPassage = ClaimPassage> = {
118
178
  verdict: ClaimVerdict;
119
179
  judged: number;
120
180
  usage: ClaimUsage;
181
+ key?: string;
121
182
  } | {
122
183
  kind: 'ended';
123
- reason: 'no_passage' | 'no_best' | 'judge_none' | 'quote' | 'undecided';
184
+ reason: 'no_passage' | 'limited' | 'no_best' | 'judge_none' | 'quote' | 'undecided';
124
185
  judged: number;
125
186
  usage: ClaimUsage;
187
+ key?: string;
188
+ } | {
189
+ kind: 'known';
190
+ key: string;
191
+ judged: 0;
192
+ usage: ClaimUsage;
126
193
  };
127
194
  /**
128
195
  * The judge's instruction for a sentence from a source of this kind: whether the sentence states the same fact as the
@@ -190,6 +257,10 @@ export declare class ClaimChecker {
190
257
  private readonly judge;
191
258
  private readonly checker;
192
259
  private readonly maxPassages;
260
+ private readonly publicVectors;
261
+ private readonly grader;
262
+ private readonly verdictSecret;
263
+ private readonly vectorReadMs;
193
264
  /**
194
265
  * What a decided check keeps for `agree` and `revisit`, by the outcome `check` answered: every passage it found, the
195
266
  * held-back ones among them.
@@ -202,42 +273,76 @@ export declare class ClaimChecker {
202
273
  */
203
274
  private readonly decisionTexts;
204
275
  /**
205
- * @param options - The embeddings call, the judge, the grounding guard's checker, and the most passages compared.
206
- * @throws {RangeError} For a `maxPassages` that is not a whole number of at least 1.
276
+ * @param options - The embeddings call, the judge, the grounding guard's checker, the most passages compared, and
277
+ * the store of public vectors, the grader and the verdict secret.
278
+ * @throws {RangeError} For a `maxPassages` that is not a whole number of at least 1, a `vectorReadMs` that is not a
279
+ * positive number, or a grader whose dimensions are not a whole number of at least 1.
280
+ * @throws {TypeError} For `publicVectors` or `verdictSecret` without `grader`.
207
281
  */
208
282
  constructor(options: ClaimCheckerOptions);
209
283
  /** A decision with the host's passages in place of the grounding guard's sentences, and their texts as read. */
210
284
  private toHost;
211
285
  /** Every passage found for a decided check; the decision's own passages when the outcome is not one `check` answered. */
212
286
  private foundOf;
287
+ /**
288
+ * The verdict key: an HMAC-SHA-256, under a key derived by HKDF-SHA-256 from the secret with the context, over a
289
+ * canonical encoding of everything that decides the verdict. That is the grader (this pack's and the grounding guard's
290
+ * versions, the judge's model, the embedding model and dimensions, `maxPassages`), the claim, each compared sentence
291
+ * in order with its text, title, kind, group and `ref` and, for one ranked by a passage vector, the passage's id, its
292
+ * `inputHash` and a hash of the vector, and each sentence found with its text, group, `ref` and whether it is held
293
+ * back. `undefined` without a secret.
294
+ */
295
+ private verdictKey;
296
+ /**
297
+ * The sentences whose vectors may be read from and written to the public store: those marked `publicKey` that the
298
+ * host's `clean` passes. A `clean` that throws refuses its sentence.
299
+ */
300
+ private storable;
301
+ /** The stored vectors of `storable`, by sentence; a store that rejects or answers after `vectorReadMs` gives none. */
302
+ private readPublic;
303
+ /** Writes the new public vectors, waiting at most `vectorReadMs`; a failed or late write changes nothing. */
304
+ private writePublic;
213
305
  /**
214
306
  * Checks a claim against passages, in order:
215
307
  *
216
308
  * 1. the grounding guard's `passages` keeps the sentences of `given` about the claim; none ends `no_passage`, with
217
- * nothing sent anywhere;
218
- * 2. AgentOS's `CitationVerifier`, both its thresholds 0 and its `embedFn` the host's `embed` (one call for the claim
219
- * and the first `maxPassages` sentences kept, one a text: a text two sources share is compared as the first of
220
- * them, whose title and kind the judge then reads), names the best of them by cosine; none ends `no_best`;
221
- * 3. the judge is asked once about that sentence, under {@link claimJudgeSystem} for its kind, with
309
+ * nothing sent anywhere. The first `maxPassages` kept, one a text (a text two sources share is compared as the
310
+ * first of them, whose title and kind the judge then reads), are the ones compared;
311
+ * 2. with `verdictSecret`, the verdict key is made; a key in `options.known` answers `known`, with nothing sent;
312
+ * 3. `options.beforeSend` is awaited once, before anything is sent; unless it answers true the check ends `limited`;
313
+ * 4. one sentence compared is named with no embeddings call (AgentOS's `CitationVerifier` with `pickOnly`), its
314
+ * verdict's `confidence` 0 and `scored` false;
315
+ * 5. otherwise the claim is embedded in one call with every compared sentence that carries no passage vector and has
316
+ * no stored public vector. A sentence marked `publicKey` that the host's `clean` passes is looked up in
317
+ * `publicVectors` first; a store that rejects or answers after `vectorReadMs` counts as empty. Sentence vectors and
318
+ * passage vectors are not on one scale, so the verifier ranks each class by its own cosine, and of the two classes'
319
+ * best the one earlier among the compared sentences is named; a sentence whose cosine is 0 or less is never named,
320
+ * and none ends `no_best`. The public vectors made are then stored, a failed or late write changing nothing;
321
+ * 6. the judge is asked once about the named sentence, under {@link claimJudgeSystem} for its kind, with
222
322
  * {@link claimJudgePrompt}; `none` ends `judge_none`;
223
- * 4. the judge's quote must hold one to {@link CLAIM_QUOTE_MAX_WORDS} words and stand in the sentence word for word
323
+ * 7. the judge's quote must hold one to {@link CLAIM_QUOTE_MAX_WORDS} words and stand in the sentence word for word
224
324
  * (`verifyQuotes` with `fold`); else it ends `quote`;
225
- * 5. the grounding guard's `decide` takes the judge's relation as its proposal, the named sentence, the quote, and as
325
+ * 8. the grounding guard's `decide` takes the judge's relation as its proposal, the named sentence, the quote, and as
226
326
  * `found` every sentence kept in step 1 and every one of `options.found`; `null` ends `undecided`.
227
327
  *
228
328
  * `options.found` is every passage about the claim the host holds, the ones it may not send included (a sentence that
229
- * holds personal data, for example): they are never embedded, judged or sent, and take part in step 5 alone, where a
329
+ * holds personal data, for example): they are never embedded, judged or sent, and take part in step 8 alone, where a
230
330
  * passage that agrees with every heard value stops a "differs". Left out, it is `given`'s sentences about the claim.
231
331
  *
232
- * @param claim - The claim heard.
332
+ * @param heard - The claim heard, read once when the call begins.
233
333
  * @param given - The passages that may be sent to the embeddings and the judge.
234
- * @param options - The check's signal, and every passage found.
334
+ * @param options - The check's signal; every passage found; the verdict keys the host holds; the host's say before
335
+ * anything is sent; and the context the verdict key is derived for, such as the account's and the run's ids.
235
336
  * @throws The signal's reason when it aborts, at once, whatever is pending; the embeddings' or the judge's error as it
236
- * came, which the verifier alone would have swallowed.
337
+ * came, which the verifier alone would have swallowed; `beforeSend`'s error; a `RangeError` for a passage vector of
338
+ * another size than the claim's.
237
339
  */
238
- check<P extends ClaimPassage>(claim: SpokenClaim, given: readonly P[], options: {
340
+ check<P extends ClaimPassage>(heard: SpokenClaim, given: readonly P[], options: {
239
341
  signal: AbortSignal;
240
342
  found?: readonly P[];
343
+ known?: Iterable<string>;
344
+ beforeSend?: () => boolean | Promise<boolean>;
345
+ verdictContext?: string;
241
346
  }): Promise<ClaimCheckOutcome<P>>;
242
347
  /**
243
348
  * The passages that arrived after a first decision and agree with it, decided by code alone, with no model call. Each
@@ -1 +1 @@
1
- {"version":3,"file":"claims.d.ts","sourceRoot":"","sources":["../src/claims.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AAC,EAAE,CAAC;QACrB,KAAK,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;QACzB,UAAU,CAAC,EAAE,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;QAC9C,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB,GACA,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;IAkOhC;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,KAAK,CAAC,CAAC,SAAS,YAAY,EAAE,KAAK,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE;QAAE,IAAI,EAAE,SAAS,CAAA;KAAE,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,CAAC,EAAE,GAAG,CAAC,EAAE;IA0CrI;;;;;;;;;;OAUG;IACH,OAAO,CAAC,CAAC,SAAS,YAAY,EAAE,KAAK,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE;QAAE,IAAI,EAAE,SAAS,CAAA;KAAE,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,GAAG,aAAa,CAAC,CAAC,CAAC,GAAG,IAAI;CAW7J"}
package/dist/claims.js CHANGED
@@ -13,10 +13,84 @@
13
13
  *
14
14
  * @module @framers/agentos-ext-citation-check/claims
15
15
  */
16
+ import { createHash, createHmac, hkdfSync } from 'node:crypto';
17
+ import { existsSync, readFileSync } from 'node:fs';
18
+ import { createRequire } from 'node:module';
19
+ import { join } from 'node:path';
16
20
  import { collapse, fold, numberOf, words } from '@framers/agentos-ext-grounding-guard/values';
17
21
  import { z } from 'zod';
18
22
  /** The most words a judge's quote may hold. */
19
23
  export const CLAIM_QUOTE_MAX_WORDS = 20;
24
+ /** How long a read of the public vectors may take before it counts as empty, in milliseconds. */
25
+ const VECTOR_READ_MS = 200;
26
+ /** The salt of the verdict key's derivation, which names what the key is for. */
27
+ const VERDICT_KEY_SALT = 'agentos-ext-citation-check claim verdict key';
28
+ /** This pack's version and the grounding guard's, read from their package files once. */
29
+ let packVersions;
30
+ /**
31
+ * This pack's version and the grounding guard's, which the verdict key reads, so an upgrade of either checks again.
32
+ * The grounding guard is found as Node would find it from this module; a version that cannot be read is `unknown`.
33
+ */
34
+ function versions() {
35
+ if (packVersions !== undefined)
36
+ return packVersions;
37
+ const read = (file) => {
38
+ try {
39
+ const version = JSON.parse(readFileSync(file, 'utf8')).version;
40
+ return typeof version === 'string' ? version : 'unknown';
41
+ }
42
+ catch {
43
+ return 'unknown';
44
+ }
45
+ };
46
+ let citationCheck = 'unknown';
47
+ let groundingGuard = 'unknown';
48
+ try {
49
+ const require = createRequire(import.meta.url);
50
+ citationCheck = read(require.resolve('../package.json'));
51
+ // The guard's package exports no package.json, so its file is found by Node's own search path from here.
52
+ for (const dir of require.resolve.paths('@framers/agentos-ext-grounding-guard') ?? []) {
53
+ const file = join(dir, '@framers', 'agentos-ext-grounding-guard', 'package.json');
54
+ if (existsSync(file)) {
55
+ groundingGuard = read(file);
56
+ break;
57
+ }
58
+ }
59
+ }
60
+ catch {
61
+ // A host that bundles the pack may give no module URL to search from.
62
+ }
63
+ packVersions = { citationCheck, groundingGuard };
64
+ return packVersions;
65
+ }
66
+ /** The SHA-256 hex of a text. */
67
+ function sha256(text) {
68
+ return createHash('sha256').update(text).digest('hex');
69
+ }
70
+ /**
71
+ * The hash a sentence's vector is stored under: the SHA-256 hex of the model, NUL, the dimensions, NUL and the text, as
72
+ * AgentOS's `embeddingInputHash` gives it.
73
+ */
74
+ function inputHashOf(embedding, text) {
75
+ return sha256(`${embedding.model}\u0000${embedding.dimensions}\u0000${text}`);
76
+ }
77
+ /** `work`'s value, or `undefined` when it rejects or has not settled within `ms`. */
78
+ function within(work, ms) {
79
+ return new Promise((resolve) => {
80
+ const timer = setTimeout(() => resolve(undefined), ms);
81
+ work.then((value) => {
82
+ clearTimeout(timer);
83
+ resolve(value);
84
+ }, () => {
85
+ clearTimeout(timer);
86
+ resolve(undefined);
87
+ });
88
+ });
89
+ }
90
+ /** Whether a vector holds `dimensions` finite numbers. */
91
+ function vectorOfSize(vector, dimensions) {
92
+ return Array.isArray(vector) && (dimensions === undefined || vector.length === dimensions) && vector.every((value) => Number.isFinite(value));
93
+ }
20
94
  /** The judge's instruction's words for a kind of source: what the sentence is from, and the title above it. */
21
95
  function sourceWords(kind) {
22
96
  switch (kind) {
@@ -144,7 +218,17 @@ function snapshot() {
144
218
  return (passage) => {
145
219
  let sentence = sentences.get(passage);
146
220
  if (sentence === undefined) {
147
- sentence = { text: passage.content, group: passage.group, title: passage.title, kind: passage.kind, url: passage.url, passage };
221
+ sentence = {
222
+ text: passage.content,
223
+ group: passage.group,
224
+ title: passage.title,
225
+ kind: passage.kind,
226
+ url: passage.url,
227
+ ref: passage.ref,
228
+ vector: passage.vector === undefined ? undefined : { ...passage.vector, embedding: [...passage.vector.embedding] },
229
+ publicKey: passage.publicKey === true,
230
+ passage,
231
+ };
148
232
  sentences.set(passage, sentence);
149
233
  }
150
234
  return sentence;
@@ -210,6 +294,10 @@ export class ClaimChecker {
210
294
  judge;
211
295
  checker;
212
296
  maxPassages;
297
+ publicVectors;
298
+ grader;
299
+ verdictSecret;
300
+ vectorReadMs;
213
301
  /**
214
302
  * What a decided check keeps for `agree` and `revisit`, by the outcome `check` answered: every passage it found, the
215
303
  * held-back ones among them.
@@ -222,17 +310,47 @@ export class ClaimChecker {
222
310
  */
223
311
  decisionTexts = new WeakMap();
224
312
  /**
225
- * @param options - The embeddings call, the judge, the grounding guard's checker, and the most passages compared.
226
- * @throws {RangeError} For a `maxPassages` that is not a whole number of at least 1.
313
+ * @param options - The embeddings call, the judge, the grounding guard's checker, the most passages compared, and
314
+ * the store of public vectors, the grader and the verdict secret.
315
+ * @throws {RangeError} For a `maxPassages` that is not a whole number of at least 1, a `vectorReadMs` that is not a
316
+ * positive number, or a grader whose dimensions are not a whole number of at least 1.
317
+ * @throws {TypeError} For `publicVectors` or `verdictSecret` without `grader`.
227
318
  */
228
319
  constructor(options) {
229
320
  const maxPassages = options.maxPassages ?? 24;
230
321
  if (!Number.isInteger(maxPassages) || maxPassages < 1)
231
322
  throw new RangeError(`maxPassages must be a whole number of at least 1, not ${maxPassages}`);
323
+ const vectorReadMs = options.vectorReadMs ?? VECTOR_READ_MS;
324
+ if (!Number.isFinite(vectorReadMs) || vectorReadMs <= 0)
325
+ throw new RangeError(`vectorReadMs must be a positive number, not ${vectorReadMs}`);
326
+ const dimensions = options.grader?.embedding.dimensions;
327
+ if (dimensions !== undefined && (!Number.isInteger(dimensions) || dimensions < 1)) {
328
+ throw new RangeError(`the grader's dimensions must be a whole number of at least 1, not ${dimensions}`);
329
+ }
330
+ if (options.grader === undefined && options.publicVectors !== undefined)
331
+ throw new TypeError('publicVectors needs grader, whose embedding names the hash');
332
+ if (options.grader === undefined && options.verdictSecret !== undefined)
333
+ throw new TypeError('verdictSecret needs grader, which the verdict key reads');
232
334
  this.embed = options.embed;
233
335
  this.judge = options.judge;
234
336
  this.checker = options.checker;
235
337
  this.maxPassages = maxPassages;
338
+ this.publicVectors = options.publicVectors;
339
+ this.grader =
340
+ options.grader === undefined
341
+ ? undefined
342
+ : {
343
+ judgeModel: options.grader.judgeModel,
344
+ embedding: { ...options.grader.embedding },
345
+ ...(options.grader.rules === undefined ? {} : { rules: options.grader.rules }),
346
+ };
347
+ this.verdictSecret =
348
+ options.verdictSecret === undefined
349
+ ? undefined
350
+ : typeof options.verdictSecret === 'string'
351
+ ? new TextEncoder().encode(options.verdictSecret)
352
+ : Uint8Array.from(options.verdictSecret);
353
+ this.vectorReadMs = vectorReadMs;
236
354
  }
237
355
  /** A decision with the host's passages in place of the grounding guard's sentences, and their texts as read. */
238
356
  toHost(decision) {
@@ -253,45 +371,134 @@ export class ClaimChecker {
253
371
  const kept = this.decided.get(first)?.found;
254
372
  return kept ?? unite(first.decision.sentences, [first.named]);
255
373
  }
374
+ /**
375
+ * The verdict key: an HMAC-SHA-256, under a key derived by HKDF-SHA-256 from the secret with the context, over a
376
+ * canonical encoding of everything that decides the verdict. That is the grader (this pack's and the grounding guard's
377
+ * versions, the judge's model, the embedding model and dimensions, `maxPassages`), the claim, each compared sentence
378
+ * in order with its text, title, kind, group and `ref` and, for one ranked by a passage vector, the passage's id, its
379
+ * `inputHash` and a hash of the vector, and each sentence found with its text, group, `ref` and whether it is held
380
+ * back. `undefined` without a secret.
381
+ */
382
+ verdictKey(claim, compared, found, sendable, context) {
383
+ const secret = this.verdictSecret;
384
+ const grader = this.grader;
385
+ if (secret === undefined || grader === undefined)
386
+ return undefined;
387
+ const { citationCheck, groundingGuard } = versions();
388
+ const canonical = JSON.stringify([
389
+ 'claim-verdict/1',
390
+ [citationCheck, groundingGuard, grader.judgeModel, grader.embedding.model, grader.embedding.dimensions, this.maxPassages, grader.rules ?? null],
391
+ [claim.heard, claim.heardSentence, claim.statement],
392
+ compared.map((sentence) => [
393
+ sentence.text,
394
+ sentence.title,
395
+ sentence.kind,
396
+ sentence.group,
397
+ sentence.ref ?? null,
398
+ sentence.vector === undefined ? null : [sentence.vector.passageId, sentence.vector.inputHash, sha256(JSON.stringify(sentence.vector.embedding))],
399
+ ]),
400
+ found.map((sentence) => [sentence.text, sentence.group, sentence.ref ?? null, !sendable.has(sentence.passage)]),
401
+ ]);
402
+ const key = new Uint8Array(hkdfSync('sha256', secret, VERDICT_KEY_SALT, context, 32));
403
+ return createHmac('sha256', key).update(canonical).digest('base64url');
404
+ }
405
+ /**
406
+ * The sentences whose vectors may be read from and written to the public store: those marked `publicKey` that the
407
+ * host's `clean` passes. A `clean` that throws refuses its sentence.
408
+ */
409
+ async storable(sentences, signal) {
410
+ const store = this.publicVectors;
411
+ const marked = sentences.filter((sentence) => sentence.publicKey);
412
+ if (store === undefined || marked.length === 0)
413
+ return new Set();
414
+ const passed = await untilAbort(Promise.all(marked.map(async (sentence) => {
415
+ try {
416
+ return (await store.clean(sentence.text)) === true;
417
+ }
418
+ catch {
419
+ return false;
420
+ }
421
+ })), signal);
422
+ return new Set(marked.filter((_, index) => passed[index]));
423
+ }
424
+ /** The stored vectors of `storable`, by sentence; a store that rejects or answers after `vectorReadMs` gives none. */
425
+ async readPublic(storable, signal) {
426
+ const stored = new Map();
427
+ const store = this.publicVectors;
428
+ const grader = this.grader;
429
+ if (store === undefined || grader === undefined || storable.size === 0)
430
+ return stored;
431
+ const hashes = new Map([...storable].map((sentence) => [sentence, inputHashOf(grader.embedding, sentence.text)]));
432
+ const answered = await untilAbort(within(Promise.resolve().then(() => store.get([...new Set(hashes.values())])), this.vectorReadMs), signal);
433
+ if (answered === undefined)
434
+ return stored;
435
+ for (const [sentence, hash] of hashes) {
436
+ const vector = answered.get(hash);
437
+ if (vectorOfSize(vector, grader.embedding.dimensions))
438
+ stored.set(sentence, [...vector]);
439
+ }
440
+ return stored;
441
+ }
442
+ /** Writes the new public vectors, waiting at most `vectorReadMs`; a failed or late write changes nothing. */
443
+ async writePublic(rows) {
444
+ const store = this.publicVectors;
445
+ if (store === undefined || rows.length === 0)
446
+ return;
447
+ await within(Promise.resolve().then(() => store.put(rows)), this.vectorReadMs);
448
+ }
256
449
  /**
257
450
  * Checks a claim against passages, in order:
258
451
  *
259
452
  * 1. the grounding guard's `passages` keeps the sentences of `given` about the claim; none ends `no_passage`, with
260
- * nothing sent anywhere;
261
- * 2. AgentOS's `CitationVerifier`, both its thresholds 0 and its `embedFn` the host's `embed` (one call for the claim
262
- * and the first `maxPassages` sentences kept, one a text: a text two sources share is compared as the first of
263
- * them, whose title and kind the judge then reads), names the best of them by cosine; none ends `no_best`;
264
- * 3. the judge is asked once about that sentence, under {@link claimJudgeSystem} for its kind, with
453
+ * nothing sent anywhere. The first `maxPassages` kept, one a text (a text two sources share is compared as the
454
+ * first of them, whose title and kind the judge then reads), are the ones compared;
455
+ * 2. with `verdictSecret`, the verdict key is made; a key in `options.known` answers `known`, with nothing sent;
456
+ * 3. `options.beforeSend` is awaited once, before anything is sent; unless it answers true the check ends `limited`;
457
+ * 4. one sentence compared is named with no embeddings call (AgentOS's `CitationVerifier` with `pickOnly`), its
458
+ * verdict's `confidence` 0 and `scored` false;
459
+ * 5. otherwise the claim is embedded in one call with every compared sentence that carries no passage vector and has
460
+ * no stored public vector. A sentence marked `publicKey` that the host's `clean` passes is looked up in
461
+ * `publicVectors` first; a store that rejects or answers after `vectorReadMs` counts as empty. Sentence vectors and
462
+ * passage vectors are not on one scale, so the verifier ranks each class by its own cosine, and of the two classes'
463
+ * best the one earlier among the compared sentences is named; a sentence whose cosine is 0 or less is never named,
464
+ * and none ends `no_best`. The public vectors made are then stored, a failed or late write changing nothing;
465
+ * 6. the judge is asked once about the named sentence, under {@link claimJudgeSystem} for its kind, with
265
466
  * {@link claimJudgePrompt}; `none` ends `judge_none`;
266
- * 4. the judge's quote must hold one to {@link CLAIM_QUOTE_MAX_WORDS} words and stand in the sentence word for word
467
+ * 7. the judge's quote must hold one to {@link CLAIM_QUOTE_MAX_WORDS} words and stand in the sentence word for word
267
468
  * (`verifyQuotes` with `fold`); else it ends `quote`;
268
- * 5. the grounding guard's `decide` takes the judge's relation as its proposal, the named sentence, the quote, and as
469
+ * 8. the grounding guard's `decide` takes the judge's relation as its proposal, the named sentence, the quote, and as
269
470
  * `found` every sentence kept in step 1 and every one of `options.found`; `null` ends `undecided`.
270
471
  *
271
472
  * `options.found` is every passage about the claim the host holds, the ones it may not send included (a sentence that
272
- * holds personal data, for example): they are never embedded, judged or sent, and take part in step 5 alone, where a
473
+ * holds personal data, for example): they are never embedded, judged or sent, and take part in step 8 alone, where a
273
474
  * passage that agrees with every heard value stops a "differs". Left out, it is `given`'s sentences about the claim.
274
475
  *
275
- * @param claim - The claim heard.
476
+ * @param heard - The claim heard, read once when the call begins.
276
477
  * @param given - The passages that may be sent to the embeddings and the judge.
277
- * @param options - The check's signal, and every passage found.
478
+ * @param options - The check's signal; every passage found; the verdict keys the host holds; the host's say before
479
+ * anything is sent; and the context the verdict key is derived for, such as the account's and the run's ids.
278
480
  * @throws The signal's reason when it aborts, at once, whatever is pending; the embeddings' or the judge's error as it
279
- * came, which the verifier alone would have swallowed.
481
+ * came, which the verifier alone would have swallowed; `beforeSend`'s error; a `RangeError` for a passage vector of
482
+ * another size than the claim's.
280
483
  */
281
- async check(claim, given, options) {
484
+ async check(heard, given, options) {
282
485
  const { signal } = options;
283
486
  signal.throwIfAborted();
284
- const usage = { judgeIn: 0, judgeOut: 0, embedIn: 0 };
487
+ // The claim as it is now: the key, the embeddings and the judge read this copy, whatever the host changes later.
488
+ const claim = { ...heard };
489
+ const usage = { judgeIn: 0, judgeOut: 0, embedIn: 0, vectorHits: 0 };
285
490
  const state = {
286
491
  judged: 0,
287
492
  judgement: null,
288
493
  failure: null,
494
+ key: undefined,
289
495
  };
290
496
  const ended = (reason) => ({
291
497
  kind: 'ended',
292
498
  reason,
293
499
  judged: state.judged,
294
500
  usage: { ...usage },
501
+ ...(state.key === undefined ? {} : { key: state.key }),
295
502
  });
296
503
  // The passages as they are now: this call reads nothing of them later.
297
504
  const sentenceOf = snapshot();
@@ -299,68 +506,174 @@ export class ClaimChecker {
299
506
  const kept = this.checker.passages(claim.heard, given.map((passage) => sentenceOf(passage))).found;
300
507
  if (kept.length === 0)
301
508
  return ended('no_passage');
302
- // One passage a text, the first found: the verifier hands its NLI function the text alone, so the judge reads the
303
- // title and the kind of the very passage the outcome names. Every passage found still meets the rule in step 5.
509
+ // One passage a text, the first found: the judge reads the title and the kind of the very passage the outcome names.
510
+ // Every passage found still meets the rule in step 8.
304
511
  const compared = firstOfEachText(kept).slice(0, this.maxPassages);
305
512
  const found = unite(kept, (options.found ?? []).map((passage) => sentenceOf(passage)));
306
- // The title and the kind the judge reads, by the sentence the verifier hands its NLI function.
307
- const about = new Map(compared.map((sentence) => [sentence.text, { title: sentence.title, kind: sentence.kind }]));
513
+ // 2. The verdict key, and a verdict the host holds.
514
+ state.key = this.verdictKey(claim, compared, found, new Set(given), options.verdictContext ?? '');
515
+ if (state.key !== undefined && options.known !== undefined && new Set(options.known).has(state.key)) {
516
+ return { kind: 'known', key: state.key, judged: 0, usage: { ...usage } };
517
+ }
518
+ // 3. The host's say, once, before anything is sent.
519
+ if (options.beforeSend !== undefined) {
520
+ const go = await untilAbort(Promise.resolve().then(() => options.beforeSend?.()), signal);
521
+ if (go !== true)
522
+ return ended('limited');
523
+ }
308
524
  const [{ CitationVerifier }, { verifyQuotes }] = await untilAbort(Promise.all([import('@framers/agentos/cognition/rag/citation/index'), import('@framers/agentos-ext-grounding-guard')]), signal);
309
- const verifier = new CitationVerifier({
310
- // The cosine names the best passage and decides nothing: the judge and the grounding guard's rule decide.
311
- supportThreshold: 0,
312
- unverifiableThreshold: 0,
313
- embedFn: async (texts) => {
314
- signal.throwIfAborted();
315
- const embedded = await this.embed(texts, signal);
316
- usage.embedIn += embedded.usage.in;
317
- if (embedded.vectors.length !== texts.length) {
318
- throw new Error(`the embeddings answered ${embedded.vectors.length} vectors for ${texts.length} texts`);
319
- }
320
- return embedded.vectors;
321
- },
322
- // The verifier keeps its cosine verdict when its NLI function throws, so a judge that failed is held here and
323
- // thrown after `verify`, as the embeddings' failure is.
324
- nliFn: async (premise, hypothesis) => {
325
- try {
525
+ let named;
526
+ let verdict;
527
+ if (compared.length === 1) {
528
+ // 4. One sentence compared: named with no embeddings call, the judge deciding.
529
+ const about = new Map(compared.map((sentence) => [sentence.text, { title: sentence.title, kind: sentence.kind }]));
530
+ const verifier = new CitationVerifier({
531
+ pickOnly: true,
532
+ supportThreshold: 0,
533
+ unverifiableThreshold: 0,
534
+ embedFn: async (texts) => {
326
535
  signal.throwIfAborted();
327
- const source = about.get(premise) ?? { title: '', kind: '' };
328
- state.judged += 1;
329
- const answer = await this.judge({
330
- system: claimJudgeSystem(source.kind),
331
- prompt: claimJudgePrompt(claim.heardSentence, hypothesis, source.title, premise),
332
- signal,
333
- });
334
- usage.judgeIn += answer.usage.in;
335
- usage.judgeOut += answer.usage.out;
336
- const holds = quoteHolds(answer.value, premise, verifyQuotes);
337
- state.judgement = { value: answer.value, holds };
338
- if (answer.value.relation === 'none' || !holds)
339
- return { label: 'neutral', score: 0 };
340
- return { label: answer.value.relation === 'matches' ? 'entailment' : 'contradiction', score: 1 };
536
+ const embedded = await this.embed(texts, signal);
537
+ usage.embedIn += embedded.usage.in;
538
+ if (embedded.vectors.length !== texts.length)
539
+ throw new Error(`the embeddings answered ${embedded.vectors.length} vectors for ${texts.length} texts`);
540
+ return embedded.vectors;
541
+ },
542
+ // The verifier keeps its verdict when its NLI function throws, so a judge that failed is held here and thrown
543
+ // after `verify`.
544
+ nliFn: async (premise, hypothesis) => {
545
+ try {
546
+ signal.throwIfAborted();
547
+ const source = about.get(premise) ?? { title: '', kind: '' };
548
+ state.judged += 1;
549
+ const answer = await this.judge({
550
+ system: claimJudgeSystem(source.kind),
551
+ prompt: claimJudgePrompt(claim.heardSentence, hypothesis, source.title, premise),
552
+ signal,
553
+ });
554
+ usage.judgeIn += answer.usage.in;
555
+ usage.judgeOut += answer.usage.out;
556
+ const holds = quoteHolds(answer.value, premise, verifyQuotes);
557
+ state.judgement = { value: answer.value, holds };
558
+ if (answer.value.relation === 'none' || !holds)
559
+ return { label: 'neutral', score: 0 };
560
+ return { label: answer.value.relation === 'matches' ? 'entailment' : 'contradiction', score: 1 };
561
+ }
562
+ catch (error) {
563
+ state.failure = { error };
564
+ throw error;
565
+ }
566
+ },
567
+ });
568
+ const verified = await untilAbort(verifier.verify([claim.statement], compared.map((sentence) => ({ content: sentence.text, title: sentence.title, ...(sentence.url === undefined ? {} : { url: sentence.url }) }))), signal);
569
+ if (state.failure !== null)
570
+ throw state.failure.error;
571
+ signal.throwIfAborted();
572
+ verdict = verified.claims[0];
573
+ named = verdict?.sourceIndex === undefined ? undefined : compared[verdict.sourceIndex];
574
+ if (verdict === undefined || named === undefined)
575
+ return ended('no_best');
576
+ }
577
+ else {
578
+ // 5. The claim and every sentence without a vector, in one call; each class ranked by its own cosine.
579
+ const dimensions = this.grader?.embedding.dimensions;
580
+ const byPassage = compared.filter((sentence) => sentence.vector !== undefined && vectorOfSize(sentence.vector.embedding, dimensions));
581
+ const passageSet = new Set(byPassage);
582
+ const bySentence = compared.filter((sentence) => !passageSet.has(sentence));
583
+ const storable = await this.storable(bySentence, signal);
584
+ const stored = await this.readPublic(storable, signal);
585
+ usage.vectorHits = stored.size;
586
+ const toEmbed = bySentence.filter((sentence) => !stored.has(sentence));
587
+ signal.throwIfAborted();
588
+ const texts = [claim.statement, ...toEmbed.map((sentence) => sentence.text)];
589
+ const embedded = await untilAbort(this.embed(texts, signal), signal);
590
+ usage.embedIn += embedded.usage.in;
591
+ if (embedded.vectors.length !== texts.length)
592
+ throw new Error(`the embeddings answered ${embedded.vectors.length} vectors for ${texts.length} texts`);
593
+ // Every vector the embeddings answered is of the grader's size, or the claim's with no grader, and finite.
594
+ const size = this.grader?.embedding.dimensions ?? embedded.vectors[0]?.length;
595
+ for (const vector of embedded.vectors) {
596
+ if (!vectorOfSize(vector, size) || vector.length === 0) {
597
+ throw new Error(`the embeddings answered a vector that is not ${size} finite numbers`);
341
598
  }
342
- catch (error) {
343
- state.failure = { error };
344
- throw error;
599
+ }
600
+ const [statementVector] = embedded.vectors;
601
+ // With no grader, a passage vector of another size than the claim's cannot be ranked beside it.
602
+ for (const sentence of byPassage) {
603
+ const length = sentence.vector.embedding.length;
604
+ if (length !== statementVector.length) {
605
+ throw new RangeError(`a passage vector holds ${length} numbers, and the claim's ${statementVector.length}`);
345
606
  }
346
- },
347
- });
348
- // 2 and 3: the verifier's best, and the judge on it.
349
- const verified = await untilAbort(verifier.verify([claim.statement], compared.map((sentence) => ({ content: sentence.text, title: sentence.title, ...(sentence.url === undefined ? {} : { url: sentence.url }) }))), signal);
350
- if (state.failure !== null)
351
- throw state.failure.error;
352
- signal.throwIfAborted();
353
- const verdict = verified.claims[0];
354
- const named = verdict?.sourceIndex === undefined ? undefined : compared[verdict.sourceIndex];
355
- if (verdict === undefined || named === undefined)
356
- return ended('no_best');
607
+ }
608
+ const vectorOf = new Map();
609
+ toEmbed.forEach((sentence, index) => vectorOf.set(sentence, embedded.vectors[index + 1]));
610
+ for (const [sentence, vector] of stored)
611
+ vectorOf.set(sentence, vector);
612
+ for (const sentence of byPassage)
613
+ vectorOf.set(sentence, sentence.vector.embedding);
614
+ // Every vector is known, so the verifier's one embeddings call, the claim's, is answered from the call above.
615
+ const rank = async (sentences) => {
616
+ if (sentences.length === 0)
617
+ return undefined;
618
+ const verifier = new CitationVerifier({
619
+ supportThreshold: 0,
620
+ unverifiableThreshold: 0,
621
+ embedFn: async (claims) => claims.map(() => [...statementVector]),
622
+ });
623
+ const ranked = await verifier.verify([claim.statement], sentences.map((sentence) => ({
624
+ content: sentence.text,
625
+ title: sentence.title,
626
+ ...(sentence.url === undefined ? {} : { url: sentence.url }),
627
+ embedding: vectorOf.get(sentence),
628
+ })));
629
+ const best = ranked.claims[0];
630
+ const sentence = best?.sourceIndex === undefined ? undefined : sentences[best.sourceIndex];
631
+ return best === undefined || sentence === undefined ? undefined : { sentence, verdict: best };
632
+ };
633
+ const ranked = [await rank(bySentence), await rank(byPassage)].filter((one) => one !== undefined);
634
+ ranked.sort((a, b) => compared.indexOf(a.sentence) - compared.indexOf(b.sentence));
635
+ const best = ranked[0];
636
+ // The public vectors made, stored once the claim is ranked.
637
+ const grader = this.grader;
638
+ const rows = grader === undefined
639
+ ? []
640
+ : toEmbed
641
+ .filter((sentence) => storable.has(sentence) && vectorOfSize(vectorOf.get(sentence), grader.embedding.dimensions))
642
+ .map((sentence) => ({ hash: inputHashOf(grader.embedding, sentence.text), vector: [...vectorOf.get(sentence)] }));
643
+ if (best === undefined) {
644
+ await untilAbort(this.writePublic(rows), signal);
645
+ signal.throwIfAborted();
646
+ return ended('no_best');
647
+ }
648
+ // 6. The judge on the named sentence.
649
+ signal.throwIfAborted();
650
+ named = best.sentence;
651
+ state.judged += 1;
652
+ const answer = await untilAbort(this.judge({
653
+ system: claimJudgeSystem(named.kind),
654
+ prompt: claimJudgePrompt(claim.heardSentence, claim.statement, named.title, named.text),
655
+ signal,
656
+ }), signal);
657
+ usage.judgeIn += answer.usage.in;
658
+ usage.judgeOut += answer.usage.out;
659
+ const holds = quoteHolds(answer.value, named.text, verifyQuotes);
660
+ state.judgement = { value: answer.value, holds };
661
+ // The verdict the verifier gives with this judge as its NLI function: a "differs" whose quote holds contradicts.
662
+ verdict = {
663
+ ...best.verdict,
664
+ sourceIndex: compared.indexOf(named),
665
+ verdict: answer.value.relation === 'differs' && holds ? 'contradicted' : best.verdict.verdict,
666
+ };
667
+ await untilAbort(this.writePublic(rows), signal);
668
+ signal.throwIfAborted();
669
+ }
357
670
  const judgement = state.judgement;
358
671
  if (judgement === null || judgement.value.relation === 'none')
359
672
  return ended('judge_none');
360
- // 4. The quote.
673
+ // 7. The quote.
361
674
  if (!judgement.holds)
362
675
  return ended('quote');
363
- // 5. The rule, by code, over every passage found.
676
+ // 8. The rule, by code, over every passage found.
364
677
  const decision = this.checker.decide({
365
678
  heardWords: claim.heard,
366
679
  heardSentence: claim.heardSentence,
@@ -379,6 +692,7 @@ export class ClaimChecker {
379
692
  verdict,
380
693
  judged: state.judged,
381
694
  usage: { ...usage },
695
+ ...(state.key === undefined ? {} : { key: state.key }),
382
696
  };
383
697
  this.decided.set(outcome, { found: found.map((sentence) => sentence.passage) });
384
698
  return outcome;
@@ -1 +1 @@
1
- {"version":3,"file":"claims.js","sourceRoot":"","sources":["../src/claims.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,6CAA6C,CAAC;AAC9F,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,+CAA+C;AAC/C,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,CAAC;AAsGxC,+GAA+G;AAC/G,SAAS,WAAW,CAAC,IAAY;IAC/B,QAAQ,IAAI,EAAE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I,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC,KAAK,EAAE,aAAa,EAAE,KAAK,CAAC,aAAa,EAAE,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;QACvK,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,QAAQ,KAAK,QAAQ,CAAC,QAAQ;YAAE,OAAO,IAAI,CAAC;QACxE,OAAO,IAAI,CAAC,MAAM,CAAI,KAAK,CAAC,CAAC;IAC/B,CAAC;CACF"}
package/dist/index.d.ts CHANGED
@@ -29,7 +29,7 @@ export { renderCitationLog, citationReportFails, FAILING_VERDICTS, type Citation
29
29
  export { openAIEmbeddings, managerEmbeddings, type OpenAIEmbeddingOptions, type EmbeddingManagerLike } from './embeddings.js';
30
30
  export { CitationVerifyTool, type CitationVerifyInput, type CitationVerifyOutput } from './tools/citationVerify.js';
31
31
  export { runCitationCli, CITATION_CLI_USAGE, type CitationCliIO } from './cli.js';
32
- export { ClaimChecker, claimJudge, claimJudgeSystem, claimJudgePrompt, CLAIM_QUOTE_MAX_WORDS, type SpokenClaim, type ClaimPassage, type ClaimUsage, type ClaimJudgement, type ClaimJudge, type ClaimCheckerOptions, type ClaimCheckOutcome, type ClaimDecision, } from './claims.js';
32
+ export { ClaimChecker, claimJudge, claimJudgeSystem, claimJudgePrompt, CLAIM_QUOTE_MAX_WORDS, type SpokenClaim, type ClaimPassage, type ClaimPassageVector, type ClaimPublicVectors, type ClaimGrader, type ClaimUsage, type ClaimJudgement, type ClaimJudge, type ClaimCheckerOptions, type ClaimCheckOutcome, type ClaimDecision, } from './claims.js';
33
33
  /** The pack's options, from its manifest entry or from the host's code. */
34
34
  export interface CitationCheckPackOptions {
35
35
  /** `none` (the default) or `openai`: grade a claim not found word for word with OpenAI embeddings through AgentO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C,EAAE,CAAC;KACpE,CAAC,CAAC;IACH,OAAO;QACL,IAAI,EAAE,qCAAqC;QAC3C,WAAW,EAAE;YACX;gBACE,EAAE,EAAE,IAAI,CAAC,IAAI;gBACb,IAAI,EAAE,MAAM;gBACZ,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,EAAE;gBAChC,OAAO,EAAE,IAAI;gBACb,eAAe,EAAE,CAAC,EAAE,EAAE,EAAE,eAAe,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;aAC3D;SACF;KACF,CAAC;AACJ,CAAC;AAED,eAAe,mBAAmB,CAAC"}
package/manifest.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://agentos.sh/schemas/extension-manifest-v1.json",
3
3
  "id": "com.framers.research.citation-check",
4
4
  "name": "Citation Check",
5
- "version": "0.3.0",
5
+ "version": "0.4.0",
6
6
  "description": "Checks the quoted claims of a document against the pages they cite, with AgentOS's citation tooling: word for word first, then by embeddings when a model is configured. Reads public pages under robots.txt and a host's rules, and serves the open web as a public source",
7
7
  "author": {
8
8
  "name": "Frame",
@@ -17,7 +17,7 @@
17
17
  "research",
18
18
  "robots-txt"
19
19
  ],
20
- "agentosVersion": ">=0.13.158",
20
+ "agentosVersion": ">=0.19.4",
21
21
  "categories": ["research"],
22
22
  "repository": {
23
23
  "type": "git",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@framers/agentos-ext-citation-check",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Checks the quoted claims of a document against the pages they cite, with AgentOS's citation tooling: word for word first, then by embeddings when a model is configured. Reads public pages under robots.txt and a host's rules, and serves the open web as a public source",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -50,7 +50,7 @@
50
50
  "node": ">=22"
51
51
  },
52
52
  "peerDependencies": {
53
- "@framers/agentos": ">=0.13.158"
53
+ "@framers/agentos": ">=0.19.4"
54
54
  },
55
55
  "dependencies": {
56
56
  "@framers/agentos-ext-grounding-guard": "^0.12.0",
@@ -64,7 +64,7 @@
64
64
  "rimraf": "^6.1.3",
65
65
  "typescript": "^6.0.3",
66
66
  "vitest": "^5.1.0",
67
- "@framers/agentos": "^0.19.3"
67
+ "@framers/agentos": "^0.19.4"
68
68
  },
69
69
  "homepage": "https://github.com/framerslab/agentos-extensions/tree/master/registry/curated/research/citation-check#readme",
70
70
  "bugs": {
@@ -75,7 +75,7 @@
75
75
  "manifest.json",
76
76
  "README.md"
77
77
  ],
78
- "gitHead": "a2c922287f1e54d61efef7bafad95c43eede1328",
78
+ "gitHead": "4b0f1aaffbe487c704b57f90a37844d471ff62e7",
79
79
  "scripts": {
80
80
  "build": "tsc",
81
81
  "test": "vitest run",