@proposit/proposit-core 3.4.0 → 3.4.1

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 (22) hide show
  1. package/dist/extensions/pipelines/base/source-anchors.d.ts +2 -1
  2. package/dist/extensions/pipelines/base/source-anchors.d.ts.map +1 -1
  3. package/dist/extensions/pipelines/base/source-anchors.js +41 -6
  4. package/dist/extensions/pipelines/base/source-anchors.js.map +1 -1
  5. package/dist/extensions/pipelines/ingestion/canonical-stages.d.ts.map +1 -1
  6. package/dist/extensions/pipelines/ingestion/canonical-stages.js +1 -0
  7. package/dist/extensions/pipelines/ingestion/canonical-stages.js.map +1 -1
  8. package/dist/extensions/pipelines/ingestion/scribe/extract-stage.d.ts +27 -11
  9. package/dist/extensions/pipelines/ingestion/scribe/extract-stage.d.ts.map +1 -1
  10. package/dist/extensions/pipelines/ingestion/scribe/extract-stage.js +56 -22
  11. package/dist/extensions/pipelines/ingestion/scribe/extract-stage.js.map +1 -1
  12. package/dist/extensions/pipelines/ingestion/scribe/schemas.d.ts +25 -1
  13. package/dist/extensions/pipelines/ingestion/scribe/schemas.d.ts.map +1 -1
  14. package/dist/extensions/pipelines/ingestion/scribe/schemas.js +25 -3
  15. package/dist/extensions/pipelines/ingestion/scribe/schemas.js.map +1 -1
  16. package/dist/extensions/pipelines/ingestion/scribe/scribe.d.ts.map +1 -1
  17. package/dist/extensions/pipelines/ingestion/scribe/scribe.js +25 -9
  18. package/dist/extensions/pipelines/ingestion/scribe/scribe.js.map +1 -1
  19. package/dist/extensions/pipelines/ingestion/scribe/structure-stage.d.ts +1 -1
  20. package/dist/extensions/pipelines/ingestion/scribe/structure-stage.d.ts.map +1 -1
  21. package/dist/extensions/pipelines/ingestion/scribe/structure-stage.js +1 -1
  22. package/package.json +1 -1
@@ -50,7 +50,8 @@ export type TSourceAnchorMatch = {
50
50
  * matches, so a wrong hint degrades to "picked another occurrence of the
51
51
  * same text", never to a wrong span.
52
52
  *
53
- * The ladder is exact match, then whitespace-insensitive match. Nothing
53
+ * The ladder is exact match, then whitespace-insensitive match, then
54
+ * both again with the quote's first character re-cased. Nothing
54
55
  * approximate: a quote that still does not match yields `undefined`.
55
56
  */
56
57
  export declare function locateSourceAnchor(input: string, quote: string, hintUtf16: number): TSourceAnchorMatch | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"source-anchors.d.ts","sourceRoot":"","sources":["../../../../src/extensions/pipelines/base/source-anchors.ts"],"names":[],"mappings":"AAoBA,yEAAyE;AACzE,eAAO,MAAM,2BAA2B,KAAK,CAAA;AAE7C;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACjC,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;CACjB,CAAA;AAuBD;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC7B,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,SAAS,SAAI,GACd,MAAM,GAAG,SAAS,CAYpB;AAyGD;;;;;;;GAOG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC7B,MAAM,EAAE,sBAAsB,CAAA;IAC9B,WAAW,EAAE,MAAM,CAAA;CACtB,CAAA;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAC9B,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,GAClB,kBAAkB,GAAG,SAAS,CAyBhC"}
1
+ {"version":3,"file":"source-anchors.d.ts","sourceRoot":"","sources":["../../../../src/extensions/pipelines/base/source-anchors.ts"],"names":[],"mappings":"AAoBA,yEAAyE;AACzE,eAAO,MAAM,2BAA2B,KAAK,CAAA;AAE7C;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACjC,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;CACjB,CAAA;AAuBD;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC7B,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,SAAS,SAAI,GACd,MAAM,GAAG,SAAS,CAYpB;AA8ID;;;;;;;GAOG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC7B,MAAM,EAAE,sBAAsB,CAAA;IAC9B,WAAW,EAAE,MAAM,CAAA;CACtB,CAAA;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAC9B,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,GAClB,kBAAkB,GAAG,SAAS,CAwBhC"}
@@ -72,6 +72,39 @@ function whitespaceInsensitiveRanges(haystack, quote) {
72
72
  }
73
73
  return ranges;
74
74
  }
75
+ /** Exact ranges for `quote`, falling back to whitespace-insensitive ones. */
76
+ function rangesFor(input, quote) {
77
+ const exact = exactOccurrences(input, quote).map((start) => ({
78
+ start,
79
+ end: start + quote.length,
80
+ }));
81
+ return exact.length > 0 ? exact : whitespaceInsensitiveRanges(input, quote);
82
+ }
83
+ /**
84
+ * The same text with its first character's case flipped, or `undefined`
85
+ * when that character has no other case.
86
+ *
87
+ * Models re-case the first character of a quoted span reflexively, in
88
+ * both directions: a span lifted from mid-sentence comes back with a
89
+ * capital, and one lifted from a sentence start comes back lower-cased
90
+ * to look like a fragment. Both were observed on the same document, on
91
+ * consecutive runs, under a prompt that forbids exactly this — so it is
92
+ * handled here rather than argued about in the prompt.
93
+ *
94
+ * Only the first character, and only after an exact search has already
95
+ * failed: every other character must still match, so this cannot invent
96
+ * a match the model did not essentially supply. The anchor is built from
97
+ * the range in the input, so what gets stored is the document's own
98
+ * casing, not the model's.
99
+ */
100
+ function flipFirstCharacterCase(text) {
101
+ const first = text[0];
102
+ const lower = first.toLowerCase();
103
+ const upper = first.toUpperCase();
104
+ if (lower === upper)
105
+ return undefined;
106
+ return (first === lower ? upper : lower) + text.slice(1);
107
+ }
75
108
  /**
76
109
  * Drop a lone surrogate left at either edge by slicing on a code-unit
77
110
  * boundary, shrinking the window by one unit rather than emitting an
@@ -147,18 +180,20 @@ function nearestRange(ranges, hintUtf16) {
147
180
  * matches, so a wrong hint degrades to "picked another occurrence of the
148
181
  * same text", never to a wrong span.
149
182
  *
150
- * The ladder is exact match, then whitespace-insensitive match. Nothing
183
+ * The ladder is exact match, then whitespace-insensitive match, then
184
+ * both again with the quote's first character re-cased. Nothing
151
185
  * approximate: a quote that still does not match yields `undefined`.
152
186
  */
153
187
  export function locateSourceAnchor(input, quote, hintUtf16) {
154
188
  const trimmed = quote.trim();
155
189
  if (trimmed.length === 0)
156
190
  return undefined;
157
- const exact = exactOccurrences(input, trimmed).map((start) => ({
158
- start,
159
- end: start + trimmed.length,
160
- }));
161
- const candidates = exact.length > 0 ? exact : whitespaceInsensitiveRanges(input, trimmed);
191
+ let candidates = rangesFor(input, trimmed);
192
+ if (candidates.length === 0) {
193
+ const recased = flipFirstCharacterCase(trimmed);
194
+ if (recased !== undefined)
195
+ candidates = rangesFor(input, recased);
196
+ }
162
197
  // Discarding the range, rather than trimming the quote, is what
163
198
  // keeps `input.slice(start, end) === quote` true.
164
199
  const ranges = candidates.filter((range) => !splitsSurrogatePair(input, range.start) &&
@@ -1 +1 @@
1
- {"version":3,"file":"source-anchors.js","sourceRoot":"","sources":["../../../../src/extensions/pipelines/base/source-anchors.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,EAAE;AACF,wEAAwE;AACxE,yDAAyD;AACzD,EAAE;AACF,oEAAoE;AACpE,uEAAuE;AACvE,wDAAwD;AACxD,0DAA0D;AAC1D,sEAAsE;AACtE,qEAAqE;A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W,EAAE,MAAM,CAAC,MAAM;SAC7B,CAAA;AACX,CAAC"}
1
+ {"version":3,"file":"source-anchors.js","sourceRoot":"","sources":["../../../../src/extensions/pipelines/base/source-anchors.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,EAAE;AACF,wEAAwE;AACxE,yDAAyD;AACzD,EAAE;AACF,oEAAoE;AACpE,uEAAuE;AACvE,wDAAwD;AACxD,0DAA0D;AAC1D,sEAAsE;AACtE,qEAAqE;AACrE,oEAAoE;AACpE,EAAE;AACF,kEAAkE;AAClE,oEAAoE;AACpE,uCAAuC;AACvC,wEAAwE;AACxE,oEAAoE;AACpE,UAAU;AAEV,yEAAyE;AACzE,MAAM,CAAC,MAAM,2BAA2B,GAAG,EAAE,CAAA;AAuB7C,mEAAmE;AACnE,SAAS,eAAe,CAAC,OAAe;IACpC,OAAO,OAAO,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAA;AACzD,CAAC;AAED,kFAAkF;AAClF,SAAS,gBAAgB,CACrB,QAAgB,EAChB,MAAc,EACd,SAAS,GAAG,CAAC;IAEb,MAAM,MAAM,GAAa,EAAE,CAAA;IAC3B,IAAI,IAAI,GAAG,SAAS,CAAA;IACpB,SAAS,CAAC;QACN,MAAM,EAAE,GAAG,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;QACzC,IAAI,EAAE,KAAK,CAAC,CAAC;YAAE,OAAO,MAAM,CAAA;QAC5B,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QACf,IAAI,GAAG,EAAE,GAAG,CAAC,CAAA;IACjB,CAAC;AACL,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB,CAC7B,QAAgB,EAChB,MAAc,EACd,SAAiB,EACjB,SAAS,GAAG,CAAC;IAEb,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAA;IACzC,IAAI,IAAwB,CAAA;IAC5B,KAAK,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AAA;YACZ,YAAY,GAAG,QAAQ,CAAA;QAC3B,CAAC;IACL,CAAC;IACD,OAAO,IAAI,CAAA;AACf,CAAC;AAeD;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,kBAAkB,CAC9B,KAAa,EACb,KAAa,EACb,SAAiB;IAEjB,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAA;IAC5B,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAA;IAE1C,IAAI,UAAU,GAAG,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;IAC1C,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,MAAM,OAAO,GAAG,sBAAsB,CAAC,OAAO,CAAC,CAAA;QAC/C,IAAI,OAAO,KAAK,SAAS;YAAE,UAAU,GAAG,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;IACrE,CAAC;IACD,gEAAgE;IAChE,kDAAkD;IAClD,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAC5B,CAAC,KAAK,EAAE,EAAE,CACN,CAAC,mBAAmB,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC;QACxC,CAAC,mBAAmB,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAC7C,CAAA;IAED,MAAM,KAAK,GAAG,YAAY,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;IAC7C,OAAO,KAAK,KAAK,SAAS;QACtB,CAAC,CAAC,SAAS;QACX,CAAC,CAAC;YACI,MAAM,EAAE,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC;YAClD,WAAW,EAAE,MAAM,CAAC,MAAM;SAC7B,CAAA;AACX,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"canonical-stages.d.ts","sourceRoot":"","sources":["../../../../src/extensions/pipelines/ingestion/canonical-stages.ts"],"names":[],"mappings":"AASA,2DAA2D;AAC3D,eAAO,MAAM,2BAA2B,EAAE,SAAS,MAAM,EAaxD,CAAA;AAED,0DAA0D;AAC1D,eAAO,MAAM,0BAA0B,EAAE,SAAS,MAAM,EAWvD,CAAA;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAChC,UAAU,EAAE,MAAM,GAAG,SAAS,GAC/B,SAAS,MAAM,EAAE,CAMnB"}
1
+ {"version":3,"file":"canonical-stages.d.ts","sourceRoot":"","sources":["../../../../src/extensions/pipelines/ingestion/canonical-stages.ts"],"names":[],"mappings":"AASA,2DAA2D;AAC3D,eAAO,MAAM,2BAA2B,EAAE,SAAS,MAAM,EAaxD,CAAA;AAED,0DAA0D;AAC1D,eAAO,MAAM,0BAA0B,EAAE,SAAS,MAAM,EAYvD,CAAA;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAChC,UAAU,EAAE,MAAM,GAAG,SAAS,GAC/B,SAAS,MAAM,EAAE,CAMnB"}
@@ -26,6 +26,7 @@ export const INGESTION_SCRIBE_STAGE_IDS = [
26
26
  "extract",
27
27
  "claim-canonicalization",
28
28
  "claim-type-classification",
29
+ "claim-mention-extraction",
29
30
  "claim-reference-validation",
30
31
  "variable-assignment",
31
32
  "scribe-structure",
@@ -1 +1 @@
1
- {"version":3,"file":"canonical-stages.js","sourceRoot":"","sources":["../../../../src/extensions/pipelines/ingestion/canonical-stages.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,EAAE;AACF,uEAAuE;AACvE,2EAA2E;AAC3E,0EAA0E;AAC1E,+EAA+E;AAC/E,2DAA2D;AAC3D,sCAAsC;AAEtC,2DAA2D;AAC3D,MAAM,CAAC,MAAM,2BAA2B,GAAsB;IAC1D,cAAc;IACd,0BAA0B;IAC1B,2BAA2B;IAC3B,2BAA2B;IAC3B,wBAAwB;IACxB,2BAA2B;IAC3B,4BAA4B;IAC5B,qBAAqB;IACrB,qBAAqB;IACrB,sBAAsB;IACtB,qBAAqB;IACrB,oBAAoB;CACvB,CAAA;AAED,0DAA0D;AAC1D,MAAM,CAAC,MAAM,0BAA0B,GAAsB;IACzD,SAAS;IACT,wBAAwB;IACxB,2BAA2B;IAC3B,4BAA4B;IAC5B,qBAAqB;IACrB,kBAAkB;IAClB,qBAAqB;IACrB,sBAAsB;IACtB,qBAAqB;IACrB,oBAAoB;CACvB,CAAA;AAED;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAChC,UAA8B;IAE9B,IAAI,UAAU,KAAK,4BAA4B;QAC3C,OAAO,2BAA2B,CAAA;IACtC,IAAI,UAAU,KAAK,2BAA2B;QAC1C,OAAO,0BAA0B,CAAA;IACrC,OAAO,EAAE,CAAA;AACb,CAAC"}
1
+ {"version":3,"file":"canonical-stages.js","sourceRoot":"","sources":["../../../../src/extensions/pipelines/ingestion/canonical-stages.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,EAAE;AACF,uEAAuE;AACvE,2EAA2E;AAC3E,0EAA0E;AAC1E,+EAA+E;AAC/E,2DAA2D;AAC3D,sCAAsC;AAEtC,2DAA2D;AAC3D,MAAM,CAAC,MAAM,2BAA2B,GAAsB;IAC1D,cAAc;IACd,0BAA0B;IAC1B,2BAA2B;IAC3B,2BAA2B;IAC3B,wBAAwB;IACxB,2BAA2B;IAC3B,4BAA4B;IAC5B,qBAAqB;IACrB,qBAAqB;IACrB,sBAAsB;IACtB,qBAAqB;IACrB,oBAAoB;CACvB,CAAA;AAED,0DAA0D;AAC1D,MAAM,CAAC,MAAM,0BAA0B,GAAsB;IACzD,SAAS;IACT,wBAAwB;IACxB,2BAA2B;IAC3B,0BAA0B;IAC1B,4BAA4B;IAC5B,qBAAqB;IACrB,kBAAkB;IAClB,qBAAqB;IACrB,sBAAsB;IACtB,qBAAqB;IACrB,oBAAoB;CACvB,CAAA;AAED;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAChC,UAA8B;IAE9B,IAAI,UAAU,KAAK,4BAA4B;QAC3C,OAAO,2BAA2B,CAAA;IACtC,IAAI,UAAU,KAAK,2BAA2B;QAC1C,OAAO,0BAA0B,CAAA;IACrC,OAAO,EAAE,CAAA;AACb,CAAC"}
@@ -1,27 +1,43 @@
1
1
  import type { TStage } from "../../../../lib/pipelines/types.js";
2
- import { type TClaimCanonicalizationOutput, type TClaimTypeClassificationOutput } from "../../base/stages/index.js";
2
+ import { type TClaimCanonicalizationOutput, type TClaimMentionExtractionOutput, type TClaimTypeClassificationOutput } from "../../base/stages/index.js";
3
3
  import type { TIngestionExtension, TLlmStageOptionsOverride } from "../../base/types.js";
4
+ import { type TScribeExtractOutput } from "./schemas.js";
4
5
  export declare const EXTRACT_MODEL = "gpt-5.4-mini";
5
6
  /** Internal default knobs for scribe's `extract` stage. */
6
7
  export declare const EXTRACT_STAGE_DEFAULTS: TLlmStageOptionsOverride;
7
- export declare const EXTRACT_SYSTEM_PROMPT = "You read a raw argument and emit its canonical claim set in one pass.\n\nFor each distinct proposition the author makes, emit one canonical claim. Two phrasings of the same proposition merge into a single claim.\n\nEach canonical claim carries:\n- `miniId` \u2014 assign in order: c1, c2, c3, ...\n- `mentionIds` \u2014 leave as a single synthetic id per claim (e.g. [\"c1-m\"]); scribe does not track sub-claim mentions.\n- `type` \u2014 \"normal\" (a primary proposition), \"citation\" (content is \"the cited source asserts X\"; populate `url` + `title`, and set `citationTypeGuess`), or \"axiomatic\" (invoked as self-evident; populate `axiom`).\n- `citationTypeGuess` (citation claims only) \u2014 your best guess at the source's IEEE reference type, chosen from the allowed values in your output schema (e.g. \"JournalArticle\", \"NewspaperArticle\", \"Book\", \"Website\", \"GovernmentPublication\", \u2026). Use \"unknown\" when no IEEE type fits or you cannot tell.\n- `suggestedSymbol` \u2014 a short PascalCase-or-snake_case identifier (letters/digits/underscores, starts with a letter or underscore, under 32 chars). Avoid single letters and generic names.\n- the extension fields your output schema requires (title, body, url, axiom \u2014 whichever apply to the claim's type).\n- `mentionToClaim` \u2014 one `{ \"mentionId\": \"...\", \"claimMiniId\": \"...\" }` entry per synthetic mention id you used.\n\nStyle:\n- Third-person, present-tense, active voice.\n- State the proposition itself \u2014 never \"The author claims that ...\". For a citation claim, the title summarizes what the source asserts.\n\nOutput ONLY the schema-shaped object. No prose.";
8
+ export declare const EXTRACT_SYSTEM_PROMPT = "You read a raw argument and emit its canonical claim set in one pass.\n\nFor each distinct proposition the author makes, emit one canonical claim. Two phrasings of the same proposition merge into a single claim.\n\nAlso emit `mentions` \u2014 where in the input each claim is stated. One entry per place a claim is made:\n- `mentionId` \u2014 \"<claim miniId>-m\" for the first mention of a claim, then \"-m2\", \"-m3\", ... for further ones (e.g. \"c1-m\", \"c1-m2\").\n- `text` \u2014 the span of the input that states the claim, COPIED CHARACTER FOR CHARACTER from the input. Never reword, summarize, translate, correct, or join separated passages with an ellipsis, and do not change capitalization or punctuation \u2014 copy the first character exactly as the input has it, upper- or lower-case. Prefer the shortest span that states the claim on its own \u2014 usually one sentence or clause. A span that is not present in the input verbatim is discarded, and the claim loses its link back to the source.\n- `span` \u2014 approximate `{ start, end }` character offsets of that text in the input. A rough estimate is fine; the text is what is trusted.\n- `segmentId` \u2014 the empty string.\n\nEach canonical claim carries:\n- `miniId` \u2014 assign in order: c1, c2, c3, ...\n- `mentionIds` \u2014 the `mentionId`s of every mention that states this claim.\n- `type` \u2014 \"normal\" (a primary proposition), \"citation\" (content is \"the cited source asserts X\"; populate `url` + `title`, and set `citationTypeGuess`), or \"axiomatic\" (invoked as self-evident; populate `axiom`).\n- `citationTypeGuess` (citation claims only) \u2014 your best guess at the source's IEEE reference type, chosen from the allowed values in your output schema (e.g. \"JournalArticle\", \"NewspaperArticle\", \"Book\", \"Website\", \"GovernmentPublication\", \u2026). Use \"unknown\" when no IEEE type fits or you cannot tell.\n- `suggestedSymbol` \u2014 a short PascalCase-or-snake_case identifier (letters/digits/underscores, starts with a letter or underscore, under 32 chars). Avoid single letters and generic names.\n- the extension fields your output schema requires (title, body, url, axiom \u2014 whichever apply to the claim's type).\n- `mentionToClaim` \u2014 one `{ \"mentionId\": \"...\", \"claimMiniId\": \"...\" }` entry per mention id you used.\n\nStyle:\n- Third-person, present-tense, active voice.\n- State the proposition itself \u2014 never \"The author claims that ...\". For a citation claim, the title summarizes what the source asserts.\n\nOutput ONLY the schema-shaped object. No prose.";
8
9
  /**
9
10
  * Build scribe's `extract` LLM stage. Its `outputSchema` is the
10
- * per-extension canonicalization schema, so the cheap model is asked
11
- * for the same extension-shaped claim records (title/body/url/axiom)
12
- * scholar's canonicalizer produces — without which finalize would
13
- * assemble empty claims.
11
+ * per-extension canonicalization schema widened with the mention slot,
12
+ * so the cheap model is asked for the same extension-shaped claim
13
+ * records (title/body/url/axiom) scholar's canonicalizer produces —
14
+ * without which finalize would assemble empty claims — plus the quoted
15
+ * spans those claims came from.
14
16
  */
15
- export declare function createExtractStage(extension: TIngestionExtension, options?: TLlmStageOptionsOverride): TStage<TClaimCanonicalizationOutput>;
17
+ export declare function createExtractStage(extension: TIngestionExtension, options?: TLlmStageOptionsOverride): TStage<TScribeExtractOutput>;
16
18
  /**
17
19
  * Adapter — republish `extract`'s canonical claims under the
18
20
  * canonicalization slot scholar's deterministic stages + finalize read.
19
- * `extract` already emits the canonicalization shape, so this is a
20
- * pass-through (with a defensive empty default). Built per-extension
21
- * because the canonicalization slot's schema carries the extension's
22
- * claim fields.
21
+ *
22
+ * It picks the two keys rather than passing the whole output through:
23
+ * the canonicalization envelope is `additionalProperties: false`, so
24
+ * `extract`'s `mentions` would fail validation here. They reach finalize
25
+ * through the mention adapter below instead.
26
+ *
27
+ * Built per-extension because the canonicalization slot's schema carries
28
+ * the extension's claim fields.
23
29
  */
24
30
  export declare function createExtractCanonicalizationAdapterStage(extension: TIngestionExtension): TStage<TClaimCanonicalizationOutput>;
31
+ /**
32
+ * Adapter — republish `extract`'s mentions under the mention slot
33
+ * finalize resolves into each claim's source anchors.
34
+ *
35
+ * Scribe has no segmentation stage, and needs none: a mention's `span`
36
+ * is only ever a tie-break hint between repeated occurrences, and with
37
+ * no segment to offset from, `buildAnchorByMentionId` falls back to the
38
+ * mention's own reported start. The quoted text is what is located.
39
+ */
40
+ export declare const extractMentionAdapterStage: TStage<TClaimMentionExtractionOutput>;
25
41
  /**
26
42
  * Adapter — derive the classification slot from `extract`'s claim
27
43
  * records: each canonical claim already carries its `type`, so the
@@ -1 +1 @@
1
- {"version":3,"file":"extract-stage.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/pipelines/ingestion/scribe/extract-stage.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,oCAAoC,CAAA;AAC/E,OAAO,EAIH,KAAK,4BAA4B,EACjC,KAAK,8BAA8B,EACtC,MAAM,4BAA4B,CAAA;AACnC,OAAO,KAAK,EACR,mBAAmB,EAEnB,wBAAwB,EAC3B,MAAM,qBAAqB,CAAA;AAE5B,eAAO,MAAM,aAAa,iBAAiB,CAAA;AAE3C,2DAA2D;AAC3D,eAAO,MAAM,sBAAsB,EAAE,wBAEpC,CAAA;AAED,eAAO,MAAM,qBAAqB,0oDAiBc,CAAA;AAYhD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAC9B,SAAS,EAAE,mBAAmB,EAC9B,OAAO,CAAC,EAAE,wBAAwB,GACnC,MAAM,CAAC,4BAA4B,CAAC,CAWtC;AAED;;;;;;;GAOG;AACH,wBAAgB,yCAAyC,CACrD,SAAS,EAAE,mBAAmB,GAC/B,MAAM,CAAC,4BAA4B,CAAC,CAWtC;AAED;;;;;;GAMG;AACH,eAAO,MAAM,iCAAiC,EAAE,MAAM,CAAC,8BAA8B,CAmB/E,CAAA"}
1
+ {"version":3,"file":"extract-stage.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/pipelines/ingestion/scribe/extract-stage.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,oCAAoC,CAAA;AAC/E,OAAO,EAKH,KAAK,4BAA4B,EACjC,KAAK,6BAA6B,EAClC,KAAK,8BAA8B,EACtC,MAAM,4BAA4B,CAAA;AACnC,OAAO,KAAK,EACR,mBAAmB,EAEnB,wBAAwB,EAC3B,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAEH,KAAK,oBAAoB,EAC5B,MAAM,cAAc,CAAA;AAErB,eAAO,MAAM,aAAa,iBAAiB,CAAA;AAE3C,2DAA2D;AAC3D,eAAO,MAAM,sBAAsB,EAAE,wBAEpC,CAAA;AAED,eAAO,MAAM,qBAAqB,2iFAuBc,CAAA;AAYhD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAC9B,SAAS,EAAE,mBAAmB,EAC9B,OAAO,CAAC,EAAE,wBAAwB,GACnC,MAAM,CAAC,oBAAoB,CAAC,CAW9B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,yCAAyC,CACrD,SAAS,EAAE,mBAAmB,GAC/B,MAAM,CAAC,4BAA4B,CAAC,CAatC;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,0BAA0B,EAAE,MAAM,CAAC,6BAA6B,CAUvE,CAAA;AAEN;;;;;;GAMG;AACH,eAAO,MAAM,iCAAiC,EAAE,MAAM,CAAC,8BAA8B,CAmB/E,CAAA"}
@@ -1,16 +1,18 @@
1
1
  // scribe stage 1 — `extract`: one cheap LLM call that produces the
2
2
  // canonical claim set (the same per-extension canonicalization shape
3
- // scholar's `claim-canonicalization` stage emits), collapsing scholar's
4
- // segmentation, claim-mention, citation-source, axiom-indicator,
5
- // canonicalization, and type-classification stages.
3
+ // scholar's `claim-canonicalization` stage emits) plus the mentions that
4
+ // locate each claim in the input, collapsing scholar's segmentation,
5
+ // claim-mention, citation-source, axiom-indicator, canonicalization, and
6
+ // type-classification stages.
6
7
  //
7
8
  // Because a stage writes exactly one output slot, `extract` is paired
8
- // with two deterministic adapter stages that republish its parts under
9
- // the canonicalization and classification slots scholar's deterministic
10
- // backend + `finalizeResponseV2` read.
9
+ // with three deterministic adapter stages that republish its parts under
10
+ // the canonicalization, classification, and mention slots scholar's
11
+ // deterministic backend + `finalizeResponseV2` read.
11
12
  import { llmStage } from "../../../../lib/pipelines/stage-helpers.js";
12
13
  import { deterministicStage } from "../../../../lib/pipelines/stage-helpers.js";
13
- import { STAGE_IDS, buildResponseSchema, ClaimTypeClassificationOutputSchema, } from "../../base/stages/index.js";
14
+ import { STAGE_IDS, buildResponseSchema, ClaimMentionExtractionOutputSchema, ClaimTypeClassificationOutputSchema, } from "../../base/stages/index.js";
15
+ import { buildExtractOutputSchema, } from "./schemas.js";
14
16
  export const EXTRACT_MODEL = "gpt-5.4-mini";
15
17
  /** Internal default knobs for scribe's `extract` stage. */
16
18
  export const EXTRACT_STAGE_DEFAULTS = {
@@ -20,14 +22,20 @@ export const EXTRACT_SYSTEM_PROMPT = `You read a raw argument and emit its canon
20
22
 
21
23
  For each distinct proposition the author makes, emit one canonical claim. Two phrasings of the same proposition merge into a single claim.
22
24
 
25
+ Also emit \`mentions\` — where in the input each claim is stated. One entry per place a claim is made:
26
+ - \`mentionId\` — "<claim miniId>-m" for the first mention of a claim, then "-m2", "-m3", ... for further ones (e.g. "c1-m", "c1-m2").
27
+ - \`text\` — the span of the input that states the claim, COPIED CHARACTER FOR CHARACTER from the input. Never reword, summarize, translate, correct, or join separated passages with an ellipsis, and do not change capitalization or punctuation — copy the first character exactly as the input has it, upper- or lower-case. Prefer the shortest span that states the claim on its own — usually one sentence or clause. A span that is not present in the input verbatim is discarded, and the claim loses its link back to the source.
28
+ - \`span\` — approximate \`{ start, end }\` character offsets of that text in the input. A rough estimate is fine; the text is what is trusted.
29
+ - \`segmentId\` — the empty string.
30
+
23
31
  Each canonical claim carries:
24
32
  - \`miniId\` — assign in order: c1, c2, c3, ...
25
- - \`mentionIds\` — leave as a single synthetic id per claim (e.g. ["c1-m"]); scribe does not track sub-claim mentions.
33
+ - \`mentionIds\` — the \`mentionId\`s of every mention that states this claim.
26
34
  - \`type\` — "normal" (a primary proposition), "citation" (content is "the cited source asserts X"; populate \`url\` + \`title\`, and set \`citationTypeGuess\`), or "axiomatic" (invoked as self-evident; populate \`axiom\`).
27
35
  - \`citationTypeGuess\` (citation claims only) — your best guess at the source's IEEE reference type, chosen from the allowed values in your output schema (e.g. "JournalArticle", "NewspaperArticle", "Book", "Website", "GovernmentPublication", …). Use "unknown" when no IEEE type fits or you cannot tell.
28
36
  - \`suggestedSymbol\` — a short PascalCase-or-snake_case identifier (letters/digits/underscores, starts with a letter or underscore, under 32 chars). Avoid single letters and generic names.
29
37
  - the extension fields your output schema requires (title, body, url, axiom — whichever apply to the claim's type).
30
- - \`mentionToClaim\` — one \`{ "mentionId": "...", "claimMiniId": "..." }\` entry per synthetic mention id you used.
38
+ - \`mentionToClaim\` — one \`{ "mentionId": "...", "claimMiniId": "..." }\` entry per mention id you used.
31
39
 
32
40
  Style:
33
41
  - Third-person, present-tense, active voice.
@@ -37,21 +45,22 @@ Output ONLY the schema-shaped object. No prose.`;
37
45
  function buildExtractPrompt(ctx) {
38
46
  const input = ctx.input;
39
47
  const system = `<!-- stage-id: ${STAGE_IDS.extract} -->\n${EXTRACT_SYSTEM_PROMPT}`;
40
- const user = `Input text:\n\n${input.text}\n\nProduce the canonicalClaims + mentionToClaim object.`;
48
+ const user = `Input text:\n\n${input.text}\n\nProduce the canonicalClaims + mentions + mentionToClaim object.`;
41
49
  return { system, user };
42
50
  }
43
51
  /**
44
52
  * Build scribe's `extract` LLM stage. Its `outputSchema` is the
45
- * per-extension canonicalization schema, so the cheap model is asked
46
- * for the same extension-shaped claim records (title/body/url/axiom)
47
- * scholar's canonicalizer produces — without which finalize would
48
- * assemble empty claims.
53
+ * per-extension canonicalization schema widened with the mention slot,
54
+ * so the cheap model is asked for the same extension-shaped claim
55
+ * records (title/body/url/axiom) scholar's canonicalizer produces —
56
+ * without which finalize would assemble empty claims — plus the quoted
57
+ * spans those claims came from.
49
58
  */
50
59
  export function createExtractStage(extension, options) {
51
60
  return llmStage({
52
61
  id: STAGE_IDS.extract,
53
62
  dependsOn: [],
54
- outputSchema: buildResponseSchema(extension),
63
+ outputSchema: buildExtractOutputSchema(extension),
55
64
  model: options?.model ?? EXTRACT_MODEL,
56
65
  maxOutputTokens: options?.maxOutputTokens,
57
66
  reasoningEffort: options?.reasoningEffort,
@@ -62,22 +71,47 @@ export function createExtractStage(extension, options) {
62
71
  /**
63
72
  * Adapter — republish `extract`'s canonical claims under the
64
73
  * canonicalization slot scholar's deterministic stages + finalize read.
65
- * `extract` already emits the canonicalization shape, so this is a
66
- * pass-through (with a defensive empty default). Built per-extension
67
- * because the canonicalization slot's schema carries the extension's
68
- * claim fields.
74
+ *
75
+ * It picks the two keys rather than passing the whole output through:
76
+ * the canonicalization envelope is `additionalProperties: false`, so
77
+ * `extract`'s `mentions` would fail validation here. They reach finalize
78
+ * through the mention adapter below instead.
79
+ *
80
+ * Built per-extension because the canonicalization slot's schema carries
81
+ * the extension's claim fields.
69
82
  */
70
83
  export function createExtractCanonicalizationAdapterStage(extension) {
71
84
  return deterministicStage({
72
85
  id: STAGE_IDS.claimCanonicalization,
73
86
  dependsOn: [STAGE_IDS.extract],
74
87
  outputSchema: buildResponseSchema(extension),
75
- fn: (ctx) => ctx.get(STAGE_IDS.extract) ?? {
76
- canonicalClaims: [],
77
- mentionToClaim: [],
88
+ fn: (ctx) => {
89
+ const extract = ctx.get(STAGE_IDS.extract);
90
+ return {
91
+ canonicalClaims: extract?.canonicalClaims ?? [],
92
+ mentionToClaim: extract?.mentionToClaim ?? [],
93
+ };
78
94
  },
79
95
  });
80
96
  }
97
+ /**
98
+ * Adapter — republish `extract`'s mentions under the mention slot
99
+ * finalize resolves into each claim's source anchors.
100
+ *
101
+ * Scribe has no segmentation stage, and needs none: a mention's `span`
102
+ * is only ever a tie-break hint between repeated occurrences, and with
103
+ * no segment to offset from, `buildAnchorByMentionId` falls back to the
104
+ * mention's own reported start. The quoted text is what is located.
105
+ */
106
+ export const extractMentionAdapterStage = deterministicStage({
107
+ id: STAGE_IDS.claimMentionExtraction,
108
+ dependsOn: [STAGE_IDS.extract],
109
+ outputSchema: ClaimMentionExtractionOutputSchema,
110
+ fn: (ctx) => ({
111
+ mentions: ctx.get(STAGE_IDS.extract)?.mentions ??
112
+ [],
113
+ }),
114
+ });
81
115
  /**
82
116
  * Adapter — derive the classification slot from `extract`'s claim
83
117
  * records: each canonical claim already carries its `type`, so the
@@ -1 +1 @@
1
- {"version":3,"file":"extract-stage.js","sourceRoot":"","sources":["../../../../../src/extensions/pipelines/ingestion/scribe/extract-stage.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,qEAAqE;AACrE,wEAAwE;AACxE,iEAAiE;AACjE,oDAAoD;AACpD,EAAE;AACF,sEAAsE;AACtE,uEAAuE;AACvE,wEAAwE;AACxE,uCAAuC;AAEvC,OAAO,EAAE,QAAQ,EAAE,MAAM,4CAA4C,CAAA;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAA;AAE/E,OAAO,EACH,SAAS,EACT,mBAAmB,EACnB,mCAAmC,GAGtC,MAAM,4BAA4B,CAAA;AAOnC,MAAM,CAAC,MAAM,aAAa,GAAG,cAAc,CAAA;AAE3C,2DAA2D;AAC3D,MAAM,CAAC,MAAM,sBAAsB,GAA6B;IAC5D,KAAK,EAAE,aAAa;CACvB,CAAA;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;gDAiBW,CAAA;AAEhD,SAAS,kBAAkB,CAAC,GAAkB;IAI1C,MAAM,KAAK,GAAG,GAAG,CAAC,KAAwB,CAAA;IAC1C,MAAM,MAAM,GAAG,kBAAkB,SAAS,CAAC,OAAO,SAAS,qBAAqB,EAAE,CAAA;IAClF,MAAM,IAAI,GAAG,kBAAkB,KAAK,CAAC,IAAI,0DAA0D,CAAA;IACnG,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAA;AAC3B,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAC9B,SAA8B,EAC9B,OAAkC;IAElC,OAAO,QAAQ,CAA+B;QAC1C,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,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAA;gBAC1D,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,YAAY,EAAE,CAAA;YAC3D,CAAC,CAAC;SACL,CAAA;IACL,CAAC;CACJ,CAAC,CAAA"}
1
+ {"version":3,"file":"extract-stage.js","sourceRoot":"","sources":["../../../../../src/extensions/pipelines/ingestion/scribe/extract-stage.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,qEAAqE;AACrE,yEAAyE;AACzE,qEAAqE;AACrE,yEAAyE;AACzE,8BAA8B;AAC9B,EAAE;AACF,sEAAsE;AACtE,yEAAyE;AACzE,oEAAoE;AACpE,qDAAqD;AAErD,OAAO,EAAE,QAAQ,EAAE,MAAM,4CAA4C,CAAA;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAA;AAE/E,OAAO,EACH,SAAS,EACT,mBAAmB,EACnB,kCAAkC,EAClC,mCAAmC,GAItC,MAAM,4BAA4B,CAAA;AAMnC,OAAO,EACH,wBAAwB,GAE3B,MAAM,cAAc,CAAA;AAErB,MAAM,CAAC,MAAM,aAAa,GAAG,cAAc,CAAA;AAE3C,2DAA2D;AAC3D,MAAM,CAAC,MAAM,sBAAsB,GAA6B;IAC5D,KAAK,EAAE,aAAa;CACvB,CAAA;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;gDAuBW,CAAA;AAEhD,SAAS,kBAAkB,CAAC,GAAkB;IAI1C,MAAM,KAAK,GAAG,GAAG,CAAC,KAAwB,CAAA;IAC1C,MAAM,MAAM,GAAG,kBAAkB,SAAS,CAAC,OAAO,SAAS,qBAAqB,EAAE,CAAA;IAClF,MAAM,IAAI,GAAG,kBAAkB,KAAK,CAAC,IAAI,qEAAq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;QACV,QAAQ,EACJ,GAAG,CAAC,GAAG,CAAuB,SAAS,CAAC,OAAO,CAAC,EAAE,QAAQ;YAC1D,EAAE;KACT,CAAC;CACL,CAAC,CAAA;AAEN;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAC1C,kBAAkB,CAAiC;IAC/C,EAAE,EAAE,SAAS,CAAC,uBAAuB;IACrC,SAAS,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC;IAC9B,YAAY,EAAE,mCAAmC;IACjD,EAAE,EAAE,CAAC,GAAG,EAAE,EAAE;QACR,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CACjB,SAAS,CAAC,OAAO,CACpB,CAAA;QACD,MAAM,MAAM,GAAG,KAAK,EAAE,eAAe,IAAI,EAAE,CAAA;QAC3C,OAAO;YACH,eAAe,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;gBAC9B,MAAM,GAAG,GAAI,CAA6B,CAAC,GAAG,CAAA;gBAC9C,MAAM,YAAY,GACd,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAA;gBAC1D,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,YAAY,EAAE,CAAA;YAC3D,CAAC,CAAC;SACL,CAAA;IACL,CAAC;CACJ,CAAC,CAAA"}
@@ -1,4 +1,28 @@
1
- import Type, { type Static } from "typebox";
1
+ import Type, { type Static, type TSchema } from "typebox";
2
+ import type { TClaimCanonicalizationOutput, TClaimMentionExtractionOutput } from "../../base/stages/index.js";
3
+ import type { TIngestionExtension } from "../../base/types.js";
4
+ /**
5
+ * What `extract` returns: the canonicalization slot's payload and the
6
+ * mention slot's, in one object. Structural rather than a `Static<>`,
7
+ * because the schema is built per-extension.
8
+ */
9
+ export type TScribeExtractOutput = TClaimCanonicalizationOutput & TClaimMentionExtractionOutput;
10
+ /**
11
+ * `extract`'s output: the per-extension canonicalization shape, plus the
12
+ * mentions whose quoted text becomes each claim's source anchor.
13
+ *
14
+ * The mentions ride along on the one stage that is given the input text,
15
+ * rather than coming from a stage of their own — scribe's whole point is
16
+ * that there are two LLM calls, and locating a claim in the text is not
17
+ * worth a third. Their item shape is scholar's, so the same finalize
18
+ * resolution reads them without a translation layer.
19
+ *
20
+ * The canonicalization envelope is `additionalProperties: false`, so the
21
+ * widened shape is a distinct schema rather than an extra key on the
22
+ * shared one — and the adapter that republishes the canonicalization slot
23
+ * has to narrow back to it. See `createExtractCanonicalizationAdapterStage`.
24
+ */
25
+ export declare function buildExtractOutputSchema(extension: TIngestionExtension): TSchema;
2
26
  export declare const ScribeStructureOutputSchema: Type.TObject<{
3
27
  relations: Type.TArray<Type.TObject<{
4
28
  relationId: Type.TString;
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/pipelines/ingestion/scribe/schemas.ts"],"names":[],"mappings":"AAeA,OAAO,IAAI,EAAE,EAAE,KAAK,MAAM,EAAE,MAAM,SAAS,CAAA;AAO3C,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;EAOvC,CAAA;AACD,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAC,OAAO,2BAA2B,CAAC,CAAA"}
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/pipelines/ingestion/scribe/schemas.ts"],"names":[],"mappings":"AAeA,OAAO,IAAI,EAAE,EAAE,KAAK,MAAM,EAAE,KAAK,OAAO,EAAE,MAAM,SAAS,CAAA;AAMzD,OAAO,KAAK,EACR,4BAA4B,EAC5B,6BAA6B,EAChC,MAAM,4BAA4B,CAAA;AACnC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAE9D;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG,4BAA4B,GAC3D,6BAA6B,CAAA;AAEjC;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,wBAAwB,CACpC,SAAS,EAAE,mBAAmB,GAC/B,OAAO,CAWT;AAMD,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;EAOvC,CAAA;AACD,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAC,OAAO,2BAA2B,CAAC,CAAA"}
@@ -10,10 +10,32 @@
10
10
  // relation-extraction + conclusion-selection slots.
11
11
  //
12
12
  // `extract`'s output schema is the per-extension canonicalization
13
- // schema itself (`buildResponseSchema(extension)`); only `structure`
14
- // needs a bespoke schema, defined here.
13
+ // schema widened with the mention slot (`buildExtractOutputSchema`);
14
+ // `structure` needs a bespoke schema. Both are defined here.
15
15
  import Type, {} from "typebox";
16
- import { RelationExtractionOutputSchema } from "../../base/stages/index.js";
16
+ import { ClaimMentionExtractionOutputSchema, RelationExtractionOutputSchema, buildResponseSchema, } from "../../base/stages/index.js";
17
+ /**
18
+ * `extract`'s output: the per-extension canonicalization shape, plus the
19
+ * mentions whose quoted text becomes each claim's source anchor.
20
+ *
21
+ * The mentions ride along on the one stage that is given the input text,
22
+ * rather than coming from a stage of their own — scribe's whole point is
23
+ * that there are two LLM calls, and locating a claim in the text is not
24
+ * worth a third. Their item shape is scholar's, so the same finalize
25
+ * resolution reads them without a translation layer.
26
+ *
27
+ * The canonicalization envelope is `additionalProperties: false`, so the
28
+ * widened shape is a distinct schema rather than an extra key on the
29
+ * shared one — and the adapter that republishes the canonicalization slot
30
+ * has to narrow back to it. See `createExtractCanonicalizationAdapterStage`.
31
+ */
32
+ export function buildExtractOutputSchema(extension) {
33
+ const canonicalization = buildResponseSchema(extension);
34
+ return Type.Object({
35
+ ...canonicalization.properties,
36
+ mentions: ClaimMentionExtractionOutputSchema.properties.mentions,
37
+ }, { additionalProperties: false });
38
+ }
17
39
  // `structure` emits the relation graph (same per-relation shape as
18
40
  // scholar's `relation-extraction`) plus the conclusion candidates +
19
41
  // rationale (same fields scholar's conclusion-selection LLM emits,
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../../../../src/extensions/pipelines/ingestion/scribe/schemas.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,EAAE;AACF,uEAAuE;AACvE,mEAAmE;AACnE,kEAAkE;AAClE,mEAAmE;AACnE,qCAAqC;AACrC,qEAAqE;AACrE,+DAA+D;AAC/D,wDAAwD;AACxD,EAAE;AACF,kEAAkE;AAClE,qEAAqE;AACrE,wCAAwC;AAExC,OAAO,IAAI,EAAE,EAAe,MAAM,SAAS,CAAA;AAC3C,OAAO,EAAE,8BAA8B,EAAE,MAAM,4BAA4B,CAAA;AAE3E,mEAAmE;AACnE,oEAAoE;AACpE,mEAAmE;AACnE,+DAA+D;AAC/D,MAAM,CAAC,MAAM,2BAA2B,GAAG,IAAI,CAAC,MAAM,CAClD;IACI,SAAS,EAAE,8BAA8B,CAAC,UAAU,CAAC,SAAS;IAC9D,oBAAoB,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;IAC/C,SAAS,EAAE,IAAI,CAAC,MAAM,EAAE;CAC3B,EACD,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAClC,CAAA"}
1
+ {"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../../../../src/extensions/pipelines/ingestion/scribe/schemas.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,EAAE;AACF,uEAAuE;AACvE,mEAAmE;AACnE,kEAAkE;AAClE,mEAAmE;AACnE,qCAAqC;AACrC,qEAAqE;AACrE,+DAA+D;AAC/D,wDAAwD;AACxD,EAAE;AACF,kEAAkE;AAClE,qEAAqE;AACrE,6DAA6D;AAE7D,OAAO,IAAI,EAAE,EAA6B,MAAM,SAAS,CAAA;AACzD,OAAO,EACH,kCAAkC,EAClC,8BAA8B,EAC9B,mBAAmB,GACtB,MAAM,4BAA4B,CAAA;AAenC;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,wBAAwB,CACpC,SAA8B;IAE9B,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,SAAS,CAErD,CAAA;IACD,OAAO,IAAI,CAAC,MAAM,CACd;QACI,GAAG,gBAAgB,CAAC,UAAU;QAC9B,QAAQ,EAAE,kCAAkC,CAAC,UAAU,CAAC,QAAQ;KACnE,EACD,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAClC,CAAA;AACL,CAAC;AAED,mEAAmE;AACnE,oEAAoE;AACpE,mEAAmE;AACnE,+DAA+D;AAC/D,MAAM,CAAC,MAAM,2BAA2B,GAAG,IAAI,CAAC,MAAM,CAClD;IACI,SAAS,EAAE,8BAA8B,CAAC,UAAU,CAAC,SAAS;IAC9D,oBAAoB,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;IAC/C,SAAS,EAAE,IAAI,CAAC,MAAM,EAAE;CAC3B,EACD,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAClC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"scribe.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/pipelines/ingestion/scribe/scribe.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,SAAS,EAAU,MAAM,oCAAoC,CAAA;AAC3E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAA;AAU/E,OAAO,KAAK,EACR,mBAAmB,EACnB,eAAe,EACf,oBAAoB,EACvB,MAAM,qBAAqB,CAAA;AAkB5B;;;;GAIG;AACH,MAAM,MAAM,4BAA4B,GAAG;IACvC,GAAG,CAAC,EAAE,oBAAoB,CAAA;CAC7B,CAAA;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAChC,SAAS,EAAE,mBAAmB,EAC9B,OAAO,CAAC,EAAE,4BAA4B,GACvC,SAAS,CAAC,eAAe,EAAE,uBAAuB,CAAC,CAyDrD"}
1
+ {"version":3,"file":"scribe.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/pipelines/ingestion/scribe/scribe.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,SAAS,EAAU,MAAM,oCAAoC,CAAA;AAC3E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAA;AAW/E,OAAO,KAAK,EACR,mBAAmB,EACnB,eAAe,EACf,oBAAoB,EACvB,MAAM,qBAAqB,CAAA;AAmB5B;;;;GAIG;AACH,MAAM,MAAM,4BAA4B,GAAG;IACvC,GAAG,CAAC,EAAE,oBAAoB,CAAA;CAC7B,CAAA;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAChC,SAAS,EAAE,mBAAmB,EAC9B,OAAO,CAAC,EAAE,4BAA4B,GACvC,SAAS,CAAC,eAAe,EAAE,uBAAuB,CAAC,CA2ErD"}
@@ -11,8 +11,9 @@
11
11
  // DAG:
12
12
  //
13
13
  // extract ──┬─ (adapter) claim-canonicalization ─┬─ claim-reference-validation
14
- // └─ (adapter) claim-type-classification ┤
15
- // └─ variable-assignment
14
+ // ├─ (adapter) claim-type-classification ┤
15
+ // │ └─ variable-assignment
16
+ // └─ (adapter) claim-mention-extraction
16
17
  // structure ─┬─ (adapter) relation-extraction
17
18
  // └─ (adapter) conclusion-selection
18
19
  // formula-compilation
@@ -26,7 +27,7 @@ import { STAGE_IDS, claimReferenceValidationStage, variableAssignmentStage, form
26
27
  import { finalizeResponseV2 } from "../../base/finalize-response-v2.js";
27
28
  import { resolveLlmStageOptions } from "../../base/resolve-llm-stage-options.js";
28
29
  import { INGESTION_INPUT_SCHEMA } from "../scholar/scholar.js";
29
- import { createExtractStage, createExtractCanonicalizationAdapterStage, extractClassificationAdapterStage, EXTRACT_STAGE_DEFAULTS, } from "./extract-stage.js";
30
+ import { createExtractStage, createExtractCanonicalizationAdapterStage, extractClassificationAdapterStage, extractMentionAdapterStage, EXTRACT_STAGE_DEFAULTS, } from "./extract-stage.js";
30
31
  import { createStructureStage, structureRelationAdapterStage, structureConclusionAdapterStage, STRUCTURE_STAGE_DEFAULTS, } from "./structure-stage.js";
31
32
  const PIPELINE_ID = "argument-ingestion-scribe";
32
33
  const PIPELINE_VERSION = "1.0.0";
@@ -46,6 +47,7 @@ export function createScribePipeline(extension, options) {
46
47
  extractStage,
47
48
  extractCanonicalizationAdapterStage,
48
49
  extractClassificationAdapterStage,
50
+ extractMentionAdapterStage,
49
51
  claimReferenceValidationStage,
50
52
  variableAssignmentStage,
51
53
  structureStage,
@@ -73,13 +75,27 @@ export function createScribePipeline(extension, options) {
73
75
  optional(STAGE_IDS.conclusionSelection),
74
76
  optional(STAGE_IDS.formulaValidation),
75
77
  optional(STAGE_IDS.claimReferenceValidation),
78
+ // Read only for the source anchors finalize attaches to
79
+ // claims; a missing mention output costs the anchors,
80
+ // never the argument.
81
+ optional(STAGE_IDS.claimMentionExtraction),
76
82
  ],
77
- // No segmentation or mention output is passed: this pipeline
78
- // has neither stage, and its `extract` prompt asks for
79
- // synthetic mention ids. Claims therefore carry no source
80
- // anchors; relation-derived premises still do, since their
81
- // evidence quote comes from `structure`.
82
- run: (ctx) => finalizeResponseV2({ ctx, extension }),
83
+ // No segmentation is passed — this pipeline has no such stage,
84
+ // and needs none: a mention's span is only a tie-break hint
85
+ // between repeated occurrences, and finalize locates the quoted
86
+ // text itself.
87
+ //
88
+ // Premises carry no source anchors here. Their quote would have
89
+ // to come from `structure`, which is built from the canonical
90
+ // claim set and never sees the input text, so anything it
91
+ // returned would be a paraphrase that could only fail to
92
+ // resolve. `structure` is asked for no quote at all rather than
93
+ // for one it cannot have.
94
+ run: (ctx) => finalizeResponseV2({
95
+ ctx,
96
+ extension,
97
+ mentions: ctx.get(STAGE_IDS.claimMentionExtraction),
98
+ }),
83
99
  },
84
100
  };
85
101
  }
@@ -1 +1 @@
1
- {"version":3,"file":"scribe.js","sourceRoot":"","sources":["../../../../../src/extensions/pipelines/ingestion/scribe/scribe.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,EAAE;AACF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BAAsB,CAClB,SAAS,CAAC,eAAe,EACzB,wBAAwB,EACxB,GAAG,CACN,CACJ,CAAA;IAED,MAAM,MAAM,GAA+B;QACvC,YAAY;QACZ,mCAAmC;QACnC,iCAAiC;QACjC,6BAA6B;QAC7B,uBAAuB;QACvB,cAAc;QACd,6BAA6B;QAC7B,+BAA+B;QAC/B,uBAAuB;QACvB,sBAAsB;KACK,CAAA;IAE/B,OAAO;QACH,EAAE,EAAE,WAAW;QACf,OAAO,EAAE,gBAAgB;QACzB,WAAW,EAAE,sBAAsB;QACnC,sDAAsD;QACtD,mDAAmD;QACnD,wCAAwC;QACxC,YAAY,EAAE,SAAS,CAAC,cAAc;QACtC,MAAM;QACN,QAAQ,EAAE;YACN,SAAS,EAAE;gBACP,SAAS,CAAC,qBAAqB;gBAC/B,SAAS,CAAC,kBAAkB;gBAC5B,SAAS,CAAC,kBAAkB;gBAC5B,QAAQ,CAAC,SAAS,CAAC,uBAAuB,CAAC;gBAC3C,QAAQ,CAAC,SAAS,CAAC,kBAAkB,CAAC;gBACtC,QAAQ,CAAC,SAAS,CAAC,mBAAmB,CAAC;gBACvC,QAAQ,CAAC,SAAS,CAAC,iBAAiB,CAAC;gBACrC,QAAQ,CAAC,SAAS,CAAC,wBAAwB,CAAC;aAC/C;YACD,6DAA6D;YAC7D,uDAAuD;YACvD,0DAA0D;YAC1D,2DAA2D;YAC3D,yCAAyC;YACzC,GAAG,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,kBAAkB,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC;SACvD;KACJ,CAAA;AACL,CAAC"}
1
+ {"version":3,"file":"scribe.js","sourceRoot":"","sources":["../../../../../src/extensions/pipelines/ingestion/scribe/scribe.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,EAAE;AACF,+DAA+D;AAC/D,sEAAsE;AACtE,8DAA8D;AAC9D,sEAAsE;AACtE,iEAAiE;AACjE,oEAAoE;AACpE,qEAAqE;AACrE,EAAE;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export declare const STRUCTURE_MODEL = "gpt-5.4-mini";
6
6
  /** Internal default knobs for scribe's `structure` stage. */
7
7
  export declare const STRUCTURE_STAGE_DEFAULTS: TLlmStageOptionsOverride;
8
- export declare const STRUCTURE_SYSTEM_PROMPT = "You read a canonical claim set \u2014 each claim's id, type, and content fields (title/body) \u2014 and emit the argument's structure.\n\nEmit:\n- `relations` \u2014 the inference edges between claims. Each relation: a stable `relationId` (r1, r2, ...), a `type` of \"inference\", an `antecedents` array of the claim miniIds whose conjunction implies the consequent (one or more; citation- or axiomatic-typed claims may appear here, but never as the consequent), a single `consequent` claim miniId, and an `evidence` object ({ segmentIds: [], quote: \"\" } is acceptable when you have no span to cite).\n- `conclusionCandidates` \u2014 the claim miniIds that could be the argument's conclusion, ordered by DECREASING confidence (best first). The conclusion is the claim other claims support but that supports nothing further. Never list a citation- or axiomatic-typed claim. Return an empty array only when there is no argument structure.\n- `rationale` \u2014 one sentence explaining your best pick (or why none qualifies).\n\nOutput ONLY the schema-shaped object. No prose.";
8
+ export declare const STRUCTURE_SYSTEM_PROMPT = "You read a canonical claim set \u2014 each claim's id, type, and content fields (title/body) \u2014 and emit the argument's structure.\n\nEmit:\n- `relations` \u2014 the inference edges between claims. Each relation: a stable `relationId` (r1, r2, ...), a `type` of \"inference\", an `antecedents` array of the claim miniIds whose conjunction implies the consequent (one or more; citation- or axiomatic-typed claims may appear here, but never as the consequent), a single `consequent` claim miniId, and an `evidence` object, which is always exactly { segmentIds: [], quote: \"\" } \u2014 you are shown the claims, not the text they came from, so you have nothing to quote.\n- `conclusionCandidates` \u2014 the claim miniIds that could be the argument's conclusion, ordered by DECREASING confidence (best first). The conclusion is the claim other claims support but that supports nothing further. Never list a citation- or axiomatic-typed claim. Return an empty array only when there is no argument structure.\n- `rationale` \u2014 one sentence explaining your best pick (or why none qualifies).\n\nOutput ONLY the schema-shaped object. No prose.";
9
9
  /**
10
10
  * Build scribe's `structure` LLM stage. Depends on the canonicalization
11
11
  * + classification slots (populated by `extract`'s adapters) so the
@@ -1 +1 @@
1
- {"version":3,"file":"structure-stage.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/pipelines/ingestion/scribe/structure-stage.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,oCAAoC,CAAA;AAC/E,OAAO,EAQH,KAAK,0BAA0B,EAC/B,KAAK,yBAAyB,EACjC,MAAM,4BAA4B,CAAA;AACnC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA;AACnE,OAAO,EAEH,KAAK,sBAAsB,EAC9B,MAAM,cAAc,CAAA;AAErB,eAAO,MAAM,eAAe,iBAAiB,CAAA;AAE7C,6DAA6D;AAC7D,eAAO,MAAM,wBAAwB,EAAE,wBAEtC,CAAA;AAED,eAAO,MAAM,uBAAuB,wjCAOY,CAAA;AAwChD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAChC,OAAO,CAAC,EAAE,wBAAwB,GACnC,MAAM,CAAC,sBAAsB,CAAC,CAchC;AAED;;;GAGG;AACH,eAAO,MAAM,6BAA6B,EAAE,MAAM,CAAC,yBAAyB,CAUtE,CAAA;AAEN;;;;;;;GAOG;AACH,eAAO,MAAM,+BAA+B,EAAE,MAAM,CAAC,0BAA0B,CAwDzE,CAAA"}
1
+ {"version":3,"file":"structure-stage.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/pipelines/ingestion/scribe/structure-stage.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,oCAAoC,CAAA;AAC/E,OAAO,EAQH,KAAK,0BAA0B,EAC/B,KAAK,yBAAyB,EACjC,MAAM,4BAA4B,CAAA;AACnC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA;AACnE,OAAO,EAEH,KAAK,sBAAsB,EAC9B,MAAM,cAAc,CAAA;AAErB,eAAO,MAAM,eAAe,iBAAiB,CAAA;AAE7C,6DAA6D;AAC7D,eAAO,MAAM,wBAAwB,EAAE,wBAEtC,CAAA;AAED,eAAO,MAAM,uBAAuB,8nCAOY,CAAA;AAwChD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAChC,OAAO,CAAC,EAAE,wBAAwB,GACnC,MAAM,CAAC,sBAAsB,CAAC,CAchC;AAED;;;GAGG;AACH,eAAO,MAAM,6BAA6B,EAAE,MAAM,CAAC,yBAAyB,CAUtE,CAAA;AAEN;;;;;;;GAOG;AACH,eAAO,MAAM,+BAA+B,EAAE,MAAM,CAAC,0BAA0B,CAwDzE,CAAA"}
@@ -23,7 +23,7 @@ export const STRUCTURE_STAGE_DEFAULTS = {
23
23
  export const STRUCTURE_SYSTEM_PROMPT = `You read a canonical claim set — each claim's id, type, and content fields (title/body) — and emit the argument's structure.
24
24
 
25
25
  Emit:
26
- - \`relations\` — the inference edges between claims. Each relation: a stable \`relationId\` (r1, r2, ...), a \`type\` of "inference", an \`antecedents\` array of the claim miniIds whose conjunction implies the consequent (one or more; citation- or axiomatic-typed claims may appear here, but never as the consequent), a single \`consequent\` claim miniId, and an \`evidence\` object ({ segmentIds: [], quote: "" } is acceptable when you have no span to cite).
26
+ - \`relations\` — the inference edges between claims. Each relation: a stable \`relationId\` (r1, r2, ...), a \`type\` of "inference", an \`antecedents\` array of the claim miniIds whose conjunction implies the consequent (one or more; citation- or axiomatic-typed claims may appear here, but never as the consequent), a single \`consequent\` claim miniId, and an \`evidence\` object, which is always exactly { segmentIds: [], quote: "" } — you are shown the claims, not the text they came from, so you have nothing to quote.
27
27
  - \`conclusionCandidates\` — the claim miniIds that could be the argument's conclusion, ordered by DECREASING confidence (best first). The conclusion is the claim other claims support but that supports nothing further. Never list a citation- or axiomatic-typed claim. Return an empty array only when there is no argument structure.
28
28
  - \`rationale\` — one sentence explaining your best pick (or why none qualifies).
29
29
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proposit/proposit-core",
3
- "version": "3.4.0",
3
+ "version": "3.4.1",
4
4
  "description": "Core engine for building and manipulating propositional logic arguments.",
5
5
  "license": "MIT",
6
6
  "keywords": [