@proposit/proposit-core 1.1.1 → 1.3.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/dist/extensions/argument-ingestion/index.d.ts +4 -0
- package/dist/extensions/argument-ingestion/index.d.ts.map +1 -1
- package/dist/extensions/argument-ingestion/index.js +9 -4
- package/dist/extensions/argument-ingestion/index.js.map +1 -1
- package/dist/extensions/argument-ingestion/shared/finalize-response-v2.d.ts +17 -0
- package/dist/extensions/argument-ingestion/shared/finalize-response-v2.d.ts.map +1 -0
- package/dist/extensions/argument-ingestion/shared/finalize-response-v2.js +185 -0
- package/dist/extensions/argument-ingestion/shared/finalize-response-v2.js.map +1 -0
- package/dist/extensions/argument-ingestion/stages/axiom-indicator-detection.d.ts +6 -0
- package/dist/extensions/argument-ingestion/stages/axiom-indicator-detection.d.ts.map +1 -0
- package/dist/extensions/argument-ingestion/stages/axiom-indicator-detection.js +42 -0
- package/dist/extensions/argument-ingestion/stages/axiom-indicator-detection.js.map +1 -0
- package/dist/extensions/argument-ingestion/stages/citation-source-detection.d.ts +6 -0
- package/dist/extensions/argument-ingestion/stages/citation-source-detection.d.ts.map +1 -0
- package/dist/extensions/argument-ingestion/stages/citation-source-detection.js +42 -0
- package/dist/extensions/argument-ingestion/stages/citation-source-detection.js.map +1 -0
- package/dist/extensions/argument-ingestion/stages/claim-canonicalization.d.ts +15 -0
- package/dist/extensions/argument-ingestion/stages/claim-canonicalization.d.ts.map +1 -0
- package/dist/extensions/argument-ingestion/stages/claim-canonicalization.js +148 -0
- package/dist/extensions/argument-ingestion/stages/claim-canonicalization.js.map +1 -0
- package/dist/extensions/argument-ingestion/stages/claim-mention-extraction.d.ts +6 -0
- package/dist/extensions/argument-ingestion/stages/claim-mention-extraction.d.ts.map +1 -0
- package/dist/extensions/argument-ingestion/stages/claim-mention-extraction.js +38 -0
- package/dist/extensions/argument-ingestion/stages/claim-mention-extraction.js.map +1 -0
- package/dist/extensions/argument-ingestion/stages/claim-reference-validation.d.ts +37 -0
- package/dist/extensions/argument-ingestion/stages/claim-reference-validation.d.ts.map +1 -0
- package/dist/extensions/argument-ingestion/stages/claim-reference-validation.js +108 -0
- package/dist/extensions/argument-ingestion/stages/claim-reference-validation.js.map +1 -0
- package/dist/extensions/argument-ingestion/stages/claim-type-classification.d.ts +6 -0
- package/dist/extensions/argument-ingestion/stages/claim-type-classification.d.ts.map +1 -0
- package/dist/extensions/argument-ingestion/stages/claim-type-classification.js +67 -0
- package/dist/extensions/argument-ingestion/stages/claim-type-classification.js.map +1 -0
- package/dist/extensions/argument-ingestion/stages/conclusion-selection.d.ts +20 -0
- package/dist/extensions/argument-ingestion/stages/conclusion-selection.d.ts.map +1 -0
- package/dist/extensions/argument-ingestion/stages/conclusion-selection.js +94 -0
- package/dist/extensions/argument-ingestion/stages/conclusion-selection.js.map +1 -0
- package/dist/extensions/argument-ingestion/stages/formula-compilation.d.ts +27 -0
- package/dist/extensions/argument-ingestion/stages/formula-compilation.d.ts.map +1 -0
- package/dist/extensions/argument-ingestion/stages/formula-compilation.js +175 -0
- package/dist/extensions/argument-ingestion/stages/formula-compilation.js.map +1 -0
- package/dist/extensions/argument-ingestion/stages/formula-validation.d.ts +19 -0
- package/dist/extensions/argument-ingestion/stages/formula-validation.d.ts.map +1 -0
- package/dist/extensions/argument-ingestion/stages/formula-validation.js +101 -0
- package/dist/extensions/argument-ingestion/stages/formula-validation.js.map +1 -0
- package/dist/extensions/argument-ingestion/stages/index.d.ts +15 -0
- package/dist/extensions/argument-ingestion/stages/index.d.ts.map +1 -0
- package/dist/extensions/argument-ingestion/stages/index.js +16 -0
- package/dist/extensions/argument-ingestion/stages/index.js.map +1 -0
- package/dist/extensions/argument-ingestion/stages/relation-extraction.d.ts +7 -0
- package/dist/extensions/argument-ingestion/stages/relation-extraction.d.ts.map +1 -0
- package/dist/extensions/argument-ingestion/stages/relation-extraction.js +77 -0
- package/dist/extensions/argument-ingestion/stages/relation-extraction.js.map +1 -0
- package/dist/extensions/argument-ingestion/stages/schemas.d.ts +161 -0
- package/dist/extensions/argument-ingestion/stages/schemas.d.ts.map +1 -0
- package/dist/extensions/argument-ingestion/stages/schemas.js +218 -0
- package/dist/extensions/argument-ingestion/stages/schemas.js.map +1 -0
- package/dist/extensions/argument-ingestion/stages/segmentation.d.ts +6 -0
- package/dist/extensions/argument-ingestion/stages/segmentation.d.ts.map +1 -0
- package/dist/extensions/argument-ingestion/stages/segmentation.js +37 -0
- package/dist/extensions/argument-ingestion/stages/segmentation.js.map +1 -0
- package/dist/extensions/argument-ingestion/stages/variable-assignment.d.ts +15 -0
- package/dist/extensions/argument-ingestion/stages/variable-assignment.d.ts.map +1 -0
- package/dist/extensions/argument-ingestion/stages/variable-assignment.js +84 -0
- package/dist/extensions/argument-ingestion/stages/variable-assignment.js.map +1 -0
- package/dist/extensions/argument-ingestion/v2-multi-stage.d.ts +15 -0
- package/dist/extensions/argument-ingestion/v2-multi-stage.d.ts.map +1 -0
- package/dist/extensions/argument-ingestion/v2-multi-stage.js +91 -0
- package/dist/extensions/argument-ingestion/v2-multi-stage.js.map +1 -0
- package/dist/lib/index.d.ts +2 -2
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +1 -1
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/pipelines/stage-helpers.d.ts.map +1 -1
- package/dist/lib/pipelines/stage-helpers.js +32 -2
- package/dist/lib/pipelines/stage-helpers.js.map +1 -1
- package/dist/lib/pipelines/types.d.ts +20 -0
- package/dist/lib/pipelines/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
export { createIngestionV1Pipeline } from "./v1-single-shot.js";
|
|
2
2
|
export type { TCreateIngestionV1PipelineOptions } from "./v1-single-shot.js";
|
|
3
|
+
export { createIngestionV2Pipeline } from "./v2-multi-stage.js";
|
|
3
4
|
export { basicsExtension } from "./shared/basics-extension.js";
|
|
4
5
|
export type { TIngestionExtension, TIngestionInput } from "./shared/types.js";
|
|
5
6
|
export { finalizeResponse } from "./shared/finalize-response.js";
|
|
6
7
|
export type { TFinalizeResponseInput } from "./shared/finalize-response.js";
|
|
8
|
+
export { finalizeResponseV2, FINALIZE_V2_FAILURE_TEXTS, } from "./shared/finalize-response-v2.js";
|
|
9
|
+
export type { TFinalizeResponseV2Input } from "./shared/finalize-response-v2.js";
|
|
7
10
|
export { deriveRoles } from "./shared/role-derivation.js";
|
|
8
11
|
export type { TClaimRole, TDeriveRolesInput } from "./shared/role-derivation.js";
|
|
12
|
+
export * from "./stages/index.js";
|
|
9
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/extensions/argument-ingestion/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAA;AAC/D,YAAY,EAAE,iCAAiC,EAAE,MAAM,qBAAqB,CAAA;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAA;AAC9D,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAChE,YAAY,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAA;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AACzD,YAAY,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/extensions/argument-ingestion/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAA;AAC/D,YAAY,EAAE,iCAAiC,EAAE,MAAM,qBAAqB,CAAA;AAC5E,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAA;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAA;AAC9D,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAChE,YAAY,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAA;AAC3E,OAAO,EACH,kBAAkB,EAClB,yBAAyB,GAC5B,MAAM,kCAAkC,CAAA;AACzC,YAAY,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAA;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AACzD,YAAY,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AAGhF,cAAc,mBAAmB,CAAA"}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
// Barrel for the argument-ingestion extension.
|
|
2
2
|
//
|
|
3
|
-
// Exposes the v1 single-shot pipeline factory + the
|
|
4
|
-
//
|
|
5
|
-
// `
|
|
6
|
-
//
|
|
3
|
+
// Exposes the v1 single-shot pipeline factory + the v2 multi-stage
|
|
4
|
+
// pipeline factory + the default `basicsExtension`. The shared
|
|
5
|
+
// `TIngestionExtension` descriptor is forward-compatible across both
|
|
6
|
+
// pipelines.
|
|
7
7
|
export { createIngestionV1Pipeline } from "./v1-single-shot.js";
|
|
8
|
+
export { createIngestionV2Pipeline } from "./v2-multi-stage.js";
|
|
8
9
|
export { basicsExtension } from "./shared/basics-extension.js";
|
|
9
10
|
export { finalizeResponse } from "./shared/finalize-response.js";
|
|
11
|
+
export { finalizeResponseV2, FINALIZE_V2_FAILURE_TEXTS, } from "./shared/finalize-response-v2.js";
|
|
10
12
|
export { deriveRoles } from "./shared/role-derivation.js";
|
|
13
|
+
// Per-stage exports — surfaced for consumers (e.g. observability
|
|
14
|
+
// bridges) that want to key on stage ids without re-stringifying.
|
|
15
|
+
export * from "./stages/index.js";
|
|
11
16
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/extensions/argument-ingestion/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,EAAE;AACF,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/extensions/argument-ingestion/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,EAAE;AACF,mEAAmE;AACnE,+DAA+D;AAC/D,qEAAqE;AACrE,aAAa;AAEb,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAA;AAE/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAA;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAA;AAE9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAEhE,OAAO,EACH,kBAAkB,EAClB,yBAAyB,GAC5B,MAAM,kCAAkC,CAAA;AAEzC,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAEzD,iEAAiE;AACjE,kEAAkE;AAClE,cAAc,mBAAmB,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { TParsedArgumentResponse } from "../../../lib/parsing/index.js";
|
|
2
|
+
import type { TStageContext } from "../../../lib/pipelines/index.js";
|
|
3
|
+
import type { TIngestionExtension } from "./types.js";
|
|
4
|
+
export declare const FINALIZE_V2_FAILURE_TEXTS: {
|
|
5
|
+
readonly noClaims: "No claims could be extracted from the input.";
|
|
6
|
+
readonly noConclusion: "No single conclusion could be selected.";
|
|
7
|
+
};
|
|
8
|
+
export type TFinalizeResponseV2Input = {
|
|
9
|
+
ctx: TStageContext;
|
|
10
|
+
extension: TIngestionExtension;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Assembles the v2 pipeline's final response from the
|
|
14
|
+
* `TStageContext`'s accumulated upstream outputs.
|
|
15
|
+
*/
|
|
16
|
+
export declare function finalizeResponseV2(input: TFinalizeResponseV2Input): TParsedArgumentResponse;
|
|
17
|
+
//# sourceMappingURL=finalize-response-v2.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"finalize-response-v2.d.ts","sourceRoot":"","sources":["../../../../src/extensions/argument-ingestion/shared/finalize-response-v2.ts"],"names":[],"mappings":"AAiCA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAA;AAC5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAA;AAWpE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAErD,eAAO,MAAM,yBAAyB;;;CAG5B,CAAA;AAyGV,MAAM,MAAM,wBAAwB,GAAG;IACnC,GAAG,EAAE,aAAa,CAAA;IAClB,SAAS,EAAE,mBAAmB,CAAA;CACjC,CAAA;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAC9B,KAAK,EAAE,wBAAwB,GAChC,uBAAuB,CA2GzB"}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
// `finalize-response-v2` — assembles the v2 multi-stage pipeline's
|
|
2
|
+
// final `TParsedArgumentResponse`-shaped output from accumulated
|
|
3
|
+
// per-stage outputs.
|
|
4
|
+
//
|
|
5
|
+
// Behavior per spec §7.2 finalize row + §7.4 (role derivation) +
|
|
6
|
+
// §7.5 (failure model):
|
|
7
|
+
//
|
|
8
|
+
// - When `claim-canonicalization.canonicalClaims` is empty:
|
|
9
|
+
// `{ argument: null, failureText: "No claims could be extracted
|
|
10
|
+
// from the input.", uncategorizedText: null,
|
|
11
|
+
// selectionRationale: null, processingFailures: [] }`.
|
|
12
|
+
//
|
|
13
|
+
// - When `formula-compilation.conclusionPremiseMiniId` is null
|
|
14
|
+
// (conclusion-selection returned null, or the conclusion claim
|
|
15
|
+
// wasn't resolvable to a symbol): `{ argument: null,
|
|
16
|
+
// failureText: "No single conclusion could be selected.", ... }`.
|
|
17
|
+
//
|
|
18
|
+
// - Otherwise: assemble the full argument from the canonical claims
|
|
19
|
+
// (with per-claim role derived from `relation-extraction` +
|
|
20
|
+
// `conclusion-selection`), the variables from `variable-assignment`,
|
|
21
|
+
// and the premises from `formula-compilation`. The `selectionRationale`
|
|
22
|
+
// field is `conclusion-selection.rationale` (or null when the
|
|
23
|
+
// stage is missing).
|
|
24
|
+
//
|
|
25
|
+
// **`processingFailures` slot.** Mirroring v1's convention, finalize
|
|
26
|
+
// always emits an empty `processingFailures: []` array on the output.
|
|
27
|
+
// The full list of per-stage failures lives on `PipelineResult.failures`
|
|
28
|
+
// — consumers that want them read that field. The slot on the response
|
|
29
|
+
// object is a forward-compat hook; the framework doesn't have a clean
|
|
30
|
+
// way for `finalize.run` to consult the executor's accumulated failure
|
|
31
|
+
// list (which would require widening `TStageContext` — out of scope
|
|
32
|
+
// for slice 2A.late).
|
|
33
|
+
import { STAGE_IDS, } from "../stages/schemas.js";
|
|
34
|
+
export const FINALIZE_V2_FAILURE_TEXTS = {
|
|
35
|
+
noClaims: "No claims could be extracted from the input.",
|
|
36
|
+
noConclusion: "No single conclusion could be selected.",
|
|
37
|
+
};
|
|
38
|
+
function buildClaimToRole(args) {
|
|
39
|
+
const out = {};
|
|
40
|
+
// Claims that participate in any relation (source or target) are
|
|
41
|
+
// "premise" by default; claims that don't appear in any relation
|
|
42
|
+
// are "intermediate" (per spec §7.4). The conclusion overrides.
|
|
43
|
+
const claimsInRelations = new Set();
|
|
44
|
+
for (const rel of args.relations) {
|
|
45
|
+
for (const s of rel.sources)
|
|
46
|
+
claimsInRelations.add(s);
|
|
47
|
+
claimsInRelations.add(rel.target);
|
|
48
|
+
}
|
|
49
|
+
for (const claim of args.canonicalClaims) {
|
|
50
|
+
if (claim.miniId === args.conclusionMiniId) {
|
|
51
|
+
out[claim.miniId] = "conclusion";
|
|
52
|
+
}
|
|
53
|
+
else if (claimsInRelations.has(claim.miniId)) {
|
|
54
|
+
out[claim.miniId] = "premise";
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
out[claim.miniId] = "intermediate";
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return out;
|
|
61
|
+
}
|
|
62
|
+
function stripCanonicalizerOnlyFields(claim) {
|
|
63
|
+
// The canonicalizer's per-claim record carries `mentionIds` and
|
|
64
|
+
// `suggestedSymbol` which are not part of the public response
|
|
65
|
+
// schema. Strip them from the finalize output (the variable's
|
|
66
|
+
// `symbol` carries the assigned identifier; mentionIds are an
|
|
67
|
+
// internal trace).
|
|
68
|
+
const stripped = {};
|
|
69
|
+
for (const [key, value] of Object.entries(claim)) {
|
|
70
|
+
if (key === "mentionIds" || key === "suggestedSymbol")
|
|
71
|
+
continue;
|
|
72
|
+
stripped[key] = value;
|
|
73
|
+
}
|
|
74
|
+
return stripped;
|
|
75
|
+
}
|
|
76
|
+
function buildPremiseTitle(formula, roleHint) {
|
|
77
|
+
const cap = 50;
|
|
78
|
+
const truncate = (s) => s.length <= cap ? s : s.slice(0, cap - 1) + "…";
|
|
79
|
+
switch (roleHint) {
|
|
80
|
+
case "conclusion":
|
|
81
|
+
return truncate(`Conclusion: ${formula}`);
|
|
82
|
+
case "joint-support":
|
|
83
|
+
return truncate(`Joint support → ${formula}`);
|
|
84
|
+
case "derivation":
|
|
85
|
+
return truncate(`Derivation: ${formula}`);
|
|
86
|
+
case "support":
|
|
87
|
+
return truncate(`Support: ${formula}`);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function buildArgumentTitle(canonicalClaims, conclusionMiniId) {
|
|
91
|
+
const cap = 50;
|
|
92
|
+
const conclusionClaim = canonicalClaims.find((c) => c.miniId === conclusionMiniId);
|
|
93
|
+
const candidateTitle = conclusionClaim?.title ??
|
|
94
|
+
conclusionClaim?.axiom ??
|
|
95
|
+
"Argument";
|
|
96
|
+
return candidateTitle.length <= cap
|
|
97
|
+
? candidateTitle
|
|
98
|
+
: candidateTitle.slice(0, cap - 1) + "…";
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Assembles the v2 pipeline's final response from the
|
|
102
|
+
* `TStageContext`'s accumulated upstream outputs.
|
|
103
|
+
*/
|
|
104
|
+
export function finalizeResponseV2(input) {
|
|
105
|
+
void input.extension; // forward-compat (extension-specific assembly hooks)
|
|
106
|
+
const { ctx } = input;
|
|
107
|
+
const canon = ctx.get(STAGE_IDS.claimCanonicalization);
|
|
108
|
+
const variables = ctx.get(STAGE_IDS.variableAssignment) ?? [];
|
|
109
|
+
const compilation = ctx.get(STAGE_IDS.formulaCompilation);
|
|
110
|
+
const conclusion = ctx.get(STAGE_IDS.conclusionSelection);
|
|
111
|
+
const relationEnvelope = ctx.get(STAGE_IDS.relationExtraction);
|
|
112
|
+
const relations = relationEnvelope?.relations ?? [];
|
|
113
|
+
const typeEnvelope = ctx.get(STAGE_IDS.claimTypeClassification);
|
|
114
|
+
const typeByMiniId = new Map();
|
|
115
|
+
for (const entry of typeEnvelope?.classifications ?? []) {
|
|
116
|
+
typeByMiniId.set(entry.miniId, entry);
|
|
117
|
+
}
|
|
118
|
+
const processingFailures = [];
|
|
119
|
+
const baseResponse = {
|
|
120
|
+
uncategorizedText: null,
|
|
121
|
+
selectionRationale: conclusion?.rationale ?? null,
|
|
122
|
+
};
|
|
123
|
+
// Failure path 1: no canonical claims at all.
|
|
124
|
+
if (!canon || canon.canonicalClaims.length === 0) {
|
|
125
|
+
return {
|
|
126
|
+
argument: null,
|
|
127
|
+
failureText: FINALIZE_V2_FAILURE_TEXTS.noClaims,
|
|
128
|
+
...baseResponse,
|
|
129
|
+
// `processingFailures` is a side-channel slot the v1
|
|
130
|
+
// finalize also attaches; the response schema permits
|
|
131
|
+
// additional properties.
|
|
132
|
+
processingFailures,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
// Failure path 2: no single conclusion could be selected (or the
|
|
136
|
+
// conclusion claim has no resolvable variable, in which case
|
|
137
|
+
// formula-compilation already emitted an unresolved-conclusion
|
|
138
|
+
// failure and left conclusionPremiseMiniId null).
|
|
139
|
+
if (compilation?.conclusionPremiseMiniId === null || !compilation) {
|
|
140
|
+
return {
|
|
141
|
+
argument: null,
|
|
142
|
+
failureText: FINALIZE_V2_FAILURE_TEXTS.noConclusion,
|
|
143
|
+
...baseResponse,
|
|
144
|
+
processingFailures,
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
// Happy path: assemble the argument.
|
|
148
|
+
const conclusionMiniId = conclusion?.conclusionMiniId ?? null;
|
|
149
|
+
const roles = buildClaimToRole({
|
|
150
|
+
canonicalClaims: canon.canonicalClaims,
|
|
151
|
+
relations,
|
|
152
|
+
conclusionMiniId,
|
|
153
|
+
});
|
|
154
|
+
const claims = canon.canonicalClaims.map((c) => {
|
|
155
|
+
const refinedType = typeByMiniId.get(c.miniId)?.type ?? c.type;
|
|
156
|
+
const stripped = stripCanonicalizerOnlyFields(c);
|
|
157
|
+
return {
|
|
158
|
+
...stripped,
|
|
159
|
+
type: refinedType,
|
|
160
|
+
role: roles[c.miniId],
|
|
161
|
+
};
|
|
162
|
+
});
|
|
163
|
+
const finalVariables = variables.map((v) => ({
|
|
164
|
+
...v,
|
|
165
|
+
}));
|
|
166
|
+
const finalPremises = compilation.premises.map((p) => ({
|
|
167
|
+
miniId: p.premiseMiniId,
|
|
168
|
+
formula: p.formula,
|
|
169
|
+
title: buildPremiseTitle(p.formula, p.roleHint),
|
|
170
|
+
}));
|
|
171
|
+
const argument = {
|
|
172
|
+
claims,
|
|
173
|
+
variables: finalVariables,
|
|
174
|
+
premises: finalPremises,
|
|
175
|
+
conclusionPremiseMiniId: compilation.conclusionPremiseMiniId,
|
|
176
|
+
title: buildArgumentTitle(canon.canonicalClaims, conclusionMiniId),
|
|
177
|
+
};
|
|
178
|
+
return {
|
|
179
|
+
argument: argument,
|
|
180
|
+
failureText: null,
|
|
181
|
+
...baseResponse,
|
|
182
|
+
processingFailures,
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
//# sourceMappingURL=finalize-response-v2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"finalize-response-v2.js","sourceRoot":"","sources":["../../../../src/extensions/argument-ingestion/shared/finalize-response-v2.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,iEAAiE;AACjE,qBAAqB;AACrB,EAAE;AACF,iEAAiE;AACjE,wBAAwB;AACxB,EAAE;AACF,8DAA8D;AAC9D,oEAAoE;AACpE,iDAAiD;AACjD,2DAA2D;AAC3D,EAAE;AACF,iEAAiE;AACjE,mEAAmE;AACnE,yDAAyD;AACzD,sEAAsE;AACtE,EAAE;AACF,sEAAsE;AACtE,gEAAgE;AAChE,yEAAyE;AACzE,4EAA4E;AAC5E,kEAAkE;AAClE,yBAAyB;AACzB,EAAE;AACF,qEAAqE;AACrE,sEAAsE;AACtE,yEAAyE;AACzE,uEAAuE;AACvE,sEAAsE;AACtE,uEAAuE;AACvE,oEAAoE;AACpE,sBAAsB;AAItB,OAAO,EACH,SAAS,GAQZ,MAAM,sBAAsB,CAAA;AAG7B,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACrC,QAAQ,EAAE,8CAA8C;IACxD,YAAY,EAAE,yCAAyC;CACjD,CAAA;AA0BV,SAAS,gBAAgB,CAAC,IAKzB;IACG,MAAM,GAAG,GAA8D,EAAE,CAAA;IACzE,iEAAiE;IACjE,iEAAiE;IACjE,gEAAgE;IAChE,MAAM,iBAAiB,GAAG,IAAI,GAAG,EAAU,CAAA;IAC3C,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;QAC/B,KAAK,MAAM,CAAC,IAAI,GAAG,CAAC,OAAO;YAAE,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;QACrD,iBAAiB,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;IACrC,CAAC;IACD,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;QACvC,IAAI,KAAK,CAAC,MAAM,KAAK,IAAI,CAAC,gBA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"../../../lib/pipelines/types.js";
|
|
3
|
+
export declare const AXIOM_INDICATOR_DETECTION_MODEL = "gpt-5.4-mini";
|
|
4
|
+
export declare const AXIOM_INDICATOR_DETECTION_SYSTEM_PROMPT = "You scan the segments of an argument for axiom indicators \u2014 explicit signals that the author is invoking a self-evident truth as bottom-level support.\n\nRecognized indicator patterns include (non-exhaustive):\n- \"by definition\"\n- \"tautologically\", \"necessarily true\"\n- \"by convention\"\n- \"is true a priori\"\n- \"as a matter of (logic | mathematics | definition)\"\n- \"trivially\"\n\nReturn an object with a single key `axioms` whose value is the array of detected indicators. For each detected indicator emit:\n- a fresh \"axiomId\" (ax1, ax2, ...)\n- the list of \"segmentIds\" the indicator occurs in (usually one; sometimes two when the indicator straddles a clause)\n- the \"indicator\" \u2014 the verbatim trigger phrase\n- the character \"spans\" \u2014 one span object (\"start\" inclusive, \"end\" exclusive) per occurrence, relative to the SEGMENT'S TEXT\n\nHedging phrases (\"clearly\", \"obviously\", \"of course\") are NOT axiom indicators on their own \u2014 they are stylistic emphasis. Return `{ \"axioms\": [] }` when no indicators are present.";
|
|
5
|
+
export declare const axiomIndicatorDetectionStage: TStage<TAxiomIndicatorDetectionOutput>;
|
|
6
|
+
//# sourceMappingURL=axiom-indicator-detection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"axiom-indicator-detection.d.ts","sourceRoot":"","sources":["../../../../src/extensions/argument-ingestion/stages/axiom-indicator-detection.ts"],"names":[],"mappings":"AAKA,OAAO,EAGH,KAAK,8BAA8B,EAEtC,MAAM,cAAc,CAAA;AAErB,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,iCAAiC,CAAA;AAE5E,eAAO,MAAM,+BAA+B,iBAAiB,CAAA;AAE7D,eAAO,MAAM,uCAAuC,4jCAgBmI,CAAA;AAavL,eAAO,MAAM,4BAA4B,EAAE,MAAM,CAAC,8BAA8B,CAO1E,CAAA"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// `axiom-indicator-detection` — detects places where the author
|
|
2
|
+
// invokes a self-evident truth (axiom) as the bottom-level support of
|
|
3
|
+
// some claim. Phrases like "by definition", "by convention",
|
|
4
|
+
// "as a matter of logic", "is necessarily true" mark the spots.
|
|
5
|
+
import { STAGE_IDS, AxiomIndicatorDetectionOutputSchema, } from "./schemas.js";
|
|
6
|
+
import { llmStage } from "../../../lib/pipelines/stage-helpers.js";
|
|
7
|
+
export const AXIOM_INDICATOR_DETECTION_MODEL = "gpt-5.4-mini";
|
|
8
|
+
export const AXIOM_INDICATOR_DETECTION_SYSTEM_PROMPT = `You scan the segments of an argument for axiom indicators — explicit signals that the author is invoking a self-evident truth as bottom-level support.
|
|
9
|
+
|
|
10
|
+
Recognized indicator patterns include (non-exhaustive):
|
|
11
|
+
- "by definition"
|
|
12
|
+
- "tautologically", "necessarily true"
|
|
13
|
+
- "by convention"
|
|
14
|
+
- "is true a priori"
|
|
15
|
+
- "as a matter of (logic | mathematics | definition)"
|
|
16
|
+
- "trivially"
|
|
17
|
+
|
|
18
|
+
Return an object with a single key \`axioms\` whose value is the array of detected indicators. For each detected indicator emit:
|
|
19
|
+
- a fresh "axiomId" (ax1, ax2, ...)
|
|
20
|
+
- the list of "segmentIds" the indicator occurs in (usually one; sometimes two when the indicator straddles a clause)
|
|
21
|
+
- the "indicator" — the verbatim trigger phrase
|
|
22
|
+
- the character "spans" — one span object ("start" inclusive, "end" exclusive) per occurrence, relative to the SEGMENT'S TEXT
|
|
23
|
+
|
|
24
|
+
Hedging phrases ("clearly", "obviously", "of course") are NOT axiom indicators on their own — they are stylistic emphasis. Return \`{ "axioms": [] }\` when no indicators are present.`;
|
|
25
|
+
function buildPrompt(ctx) {
|
|
26
|
+
const segmentation = ctx.get(STAGE_IDS.segmentation);
|
|
27
|
+
const segments = segmentation?.segments ?? [];
|
|
28
|
+
const renderedSegments = segments
|
|
29
|
+
.map((s) => `[${s.segmentId}] ${JSON.stringify(s.text)}`)
|
|
30
|
+
.join("\n");
|
|
31
|
+
const markedSystem = `<!-- stage-id: ${STAGE_IDS.axiomIndicatorDetection} -->\n${AXIOM_INDICATOR_DETECTION_SYSTEM_PROMPT}`;
|
|
32
|
+
const user = `Segments:\n\n${renderedSegments}\n\nDetect every axiom indicator.`;
|
|
33
|
+
return { system: markedSystem, user };
|
|
34
|
+
}
|
|
35
|
+
export const axiomIndicatorDetectionStage = llmStage({
|
|
36
|
+
id: STAGE_IDS.axiomIndicatorDetection,
|
|
37
|
+
dependsOn: [STAGE_IDS.segmentation],
|
|
38
|
+
outputSchema: AxiomIndicatorDetectionOutputSchema,
|
|
39
|
+
model: AXIOM_INDICATOR_DETECTION_MODEL,
|
|
40
|
+
buildPrompt,
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=axiom-indicator-detection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"axiom-indicator-detection.js","sourceRoot":"","sources":["../../../../src/extensions/argument-ingestion/stages/axiom-indicator-detection.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,sEAAsE;AACtE,6DAA6D;AAC7D,gEAAgE;AAEhE,OAAO,EACH,SAAS,EACT,mCAAmC,GAGtC,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,QAAQ,EAAE,MAAM,yCAAyC,CAAA;AAGlE,MAAM,CAAC,MAAM,+BAA+B,GAAG,cAAc,CAAA;AAE7D,MAAM,CAAC,MAAM,uCAAuC,GAAG;;;;;;;;;;;;;;;;uLAgBgI,CAAA;AAEvL,SAAS,WAAW,CAAC,GAAkB;IACnC,MAAM,YAAY,GAAG,GAAG,CAAC,GAAG,CAAsB,SAAS,CAAC,YAAY,CAAC,CAAA;IACzE,MAAM,QAAQ,GAAG,YAAY,EAAE,QAAQ,IAAI,EAAE,CAAA;IAC7C,MAAM,gBAAgB,GAAG,QAAQ;SAC5B,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,SAAS,KAAK,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;SACxD,IAAI,CAAC,IAAI,CAAC,CAAA;IACf,MAAM,YAAY,GAAG,kBAAkB,SAAS,CAAC,uBAAuB,SAAS,uCAAuC,EAAE,CAAA;IAC1H,MAAM,IAAI,GAAG,gBAAgB,gBAAgB,mCAAmC,CAAA;IAChF,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,CAAA;AACzC,CAAC;AAED,MAAM,CAAC,MAAM,4BAA4B,GACrC,QAAQ,CAAiC;IACrC,EAAE,EAAE,SAAS,CAAC,uBAAuB;IACrC,SAAS,EAAE,CAAC,SAAS,CAAC,YAAY,CAAC;IACnC,YAAY,EAAE,mCAAmC;IACjD,KAAK,EAAE,+BAA+B;IACtC,WAAW;CACd,CAAC,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type TCitationSourceDetectionOutput } from "./schemas.js";
|
|
2
|
+
import type { TStage } from "../../../lib/pipelines/types.js";
|
|
3
|
+
export declare const CITATION_SOURCE_DETECTION_MODEL = "gpt-5.4-mini";
|
|
4
|
+
export declare const CITATION_SOURCE_DETECTION_SYSTEM_PROMPT = "You scan the segments of an argument for explicit references to external sources of evidence.\n\nA source reference is any of:\n- a Markdown link: `[label](url)`\n- a named source: \"according to X\", \"as reported in Y\", \"the X report\"\n- a bracketed citation marker: `[1]`, `[Smith 2024]`\n- a fully-qualified URL\n\nReturn an object with a single key `sources` whose value is the array of detected source references. For each detected source emit:\n- a fresh \"sourceId\" (src1, src2, ...)\n- the list of \"segmentIds\" the source occurs in (almost always one; multi-segment when one citation spans a clause boundary)\n- a short \"sourceString\" \u2014 the human-readable label (e.g. \"NASA climate report\", \"Smith 2024\")\n- the \"url\" field \u2014 the URL when one is present, otherwise null\n- the character \"spans\" \u2014 one span object (\"start\" inclusive, \"end\" exclusive) per occurrence, relative to the SEGMENT'S TEXT\n\nDo not detect mere mentions of people, organizations, or studies that are not invoked as supporting evidence. Quote attribution alone (\"Bob said X\") is not a citation unless Bob's saying is being used to support a claim. Return `{ \"sources\": [] }` when no sources are present.";
|
|
5
|
+
export declare const citationSourceDetectionStage: TStage<TCitationSourceDetectionOutput>;
|
|
6
|
+
//# sourceMappingURL=citation-source-detection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"citation-source-detection.d.ts","sourceRoot":"","sources":["../../../../src/extensions/argument-ingestion/stages/citation-source-detection.ts"],"names":[],"mappings":"AAMA,OAAO,EAGH,KAAK,8BAA8B,EAEtC,MAAM,cAAc,CAAA;AAErB,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,iCAAiC,CAAA;AAE5E,eAAO,MAAM,+BAA+B,iBAAiB,CAAA;AAE7D,eAAO,MAAM,uCAAuC,6sCAemO,CAAA;AAavR,eAAO,MAAM,4BAA4B,EAAE,MAAM,CAAC,8BAA8B,CAO1E,CAAA"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// `citation-source-detection` — detects explicit source references in
|
|
2
|
+
// the segmented input. Markdown links, "according to X", named
|
|
3
|
+
// reports/papers, bracketed citation markers, etc. The downstream
|
|
4
|
+
// `claim-canonicalization` stage uses this to route the right claims
|
|
5
|
+
// to citation-typed records with their `url` / `title` populated.
|
|
6
|
+
import { STAGE_IDS, CitationSourceDetectionOutputSchema, } from "./schemas.js";
|
|
7
|
+
import { llmStage } from "../../../lib/pipelines/stage-helpers.js";
|
|
8
|
+
export const CITATION_SOURCE_DETECTION_MODEL = "gpt-5.4-mini";
|
|
9
|
+
export const CITATION_SOURCE_DETECTION_SYSTEM_PROMPT = `You scan the segments of an argument for explicit references to external sources of evidence.
|
|
10
|
+
|
|
11
|
+
A source reference is any of:
|
|
12
|
+
- a Markdown link: \`[label](url)\`
|
|
13
|
+
- a named source: "according to X", "as reported in Y", "the X report"
|
|
14
|
+
- a bracketed citation marker: \`[1]\`, \`[Smith 2024]\`
|
|
15
|
+
- a fully-qualified URL
|
|
16
|
+
|
|
17
|
+
Return an object with a single key \`sources\` whose value is the array of detected source references. For each detected source emit:
|
|
18
|
+
- a fresh "sourceId" (src1, src2, ...)
|
|
19
|
+
- the list of "segmentIds" the source occurs in (almost always one; multi-segment when one citation spans a clause boundary)
|
|
20
|
+
- a short "sourceString" — the human-readable label (e.g. "NASA climate report", "Smith 2024")
|
|
21
|
+
- the "url" field — the URL when one is present, otherwise null
|
|
22
|
+
- the character "spans" — one span object ("start" inclusive, "end" exclusive) per occurrence, relative to the SEGMENT'S TEXT
|
|
23
|
+
|
|
24
|
+
Do not detect mere mentions of people, organizations, or studies that are not invoked as supporting evidence. Quote attribution alone ("Bob said X") is not a citation unless Bob's saying is being used to support a claim. Return \`{ "sources": [] }\` when no sources are present.`;
|
|
25
|
+
function buildPrompt(ctx) {
|
|
26
|
+
const segmentation = ctx.get(STAGE_IDS.segmentation);
|
|
27
|
+
const segments = segmentation?.segments ?? [];
|
|
28
|
+
const renderedSegments = segments
|
|
29
|
+
.map((s) => `[${s.segmentId}] ${JSON.stringify(s.text)}`)
|
|
30
|
+
.join("\n");
|
|
31
|
+
const markedSystem = `<!-- stage-id: ${STAGE_IDS.citationSourceDetection} -->\n${CITATION_SOURCE_DETECTION_SYSTEM_PROMPT}`;
|
|
32
|
+
const user = `Segments:\n\n${renderedSegments}\n\nDetect every citation/source reference.`;
|
|
33
|
+
return { system: markedSystem, user };
|
|
34
|
+
}
|
|
35
|
+
export const citationSourceDetectionStage = llmStage({
|
|
36
|
+
id: STAGE_IDS.citationSourceDetection,
|
|
37
|
+
dependsOn: [STAGE_IDS.segmentation],
|
|
38
|
+
outputSchema: CitationSourceDetectionOutputSchema,
|
|
39
|
+
model: CITATION_SOURCE_DETECTION_MODEL,
|
|
40
|
+
buildPrompt,
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=citation-source-detection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"citation-source-detection.js","sourceRoot":"","sources":["../../../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} from "./schemas.js";
|
|
2
|
+
import type { TStage } from "../../../lib/pipelines/types.js";
|
|
3
|
+
import type { TIngestionExtension } from "../shared/types.js";
|
|
4
|
+
export declare const CLAIM_CANONICALIZATION_MODEL = "gpt-5.5";
|
|
5
|
+
export declare const CLAIM_CANONICALIZATION_REASONING: "minimal" | "low" | "medium" | "high";
|
|
6
|
+
export declare const CLAIM_CANONICALIZATION_SYSTEM_PROMPT = "You merge raw claim mentions into a single canonical set of claims for an argument-ingestion pipeline.\n\nYou are given:\n- the raw input text (for full context)\n- the segmented breakdown of the text\n- the list of every claim mention extracted from those segments\n- optionally, the detected citation sources + axiom indicators\n\nYour output has two parts:\n\n1. `canonicalClaims` \u2014 an array of canonical claims, one entry per distinct proposition the author makes. Two mentions that assert the same proposition (even when phrased differently across the text) merge into a single canonical claim. Each canonical claim carries:\n - `miniId` \u2014 assign in canonicalization order: c1, c2, c3, ...\n - `mentionIds` \u2014 list of the mention ids that resolved to this claim\n - `type` \u2014 one of \"normal\", \"citation\", or \"axiomatic\" (see below)\n - `suggestedSymbol` \u2014 a short PascalCase-or-snake_case identifier summarizing the claim (e.g. \"Rain_Wets_Ground\", \"NASA_Temp_Rise\", \"Socrates_Mortal\"). Use letters, digits, and underscores only; start with a letter or underscore; keep under 32 characters; aim for under 20. AVOID single letters and generic names like \"Claim1\".\n - the extension fields described in your output schema (title, body, url, axiom \u2014 whichever apply to the claim's `type`)\n\n2. `mentionToClaim` \u2014 an array of `{ \"mentionId\": \"...\", \"claimMiniId\": \"...\" }` entries, one per input mention. Every input mentionId must appear in exactly one entry; the mapping is total. (We surface this as a list rather than a map because the response schema does not allow arbitrary string keys.)\n\n## Claim types\n\n- `\"normal\"` \u2014 a primary proposition the argument argues for or from.\n- `\"citation\"` \u2014 a claim whose content is \"the cited source asserts X\". Use this type when one of the citation sources covers the same span(s) as the mention. Populate `url` (the URL if present) and `title` (a short human-readable label).\n- `\"axiomatic\"` \u2014 a claim invoked as self-evident truth. Use this type when an axiom indicator (e.g. \"by definition\") covers or precedes the mention. Populate `axiom` with the gist of the self-evident proposition.\n\nWhen a mention is the antecedent of \"according to X, P\", split it into two claims: a citation-typed claim for the source itself + a normal-typed claim for the proposition. The two are connected via a relation in a later stage, not here.\n\n## Style\n\n- Claim titles + bodies are written in third-person, present-tense, active voice.\n- Titles are short (\u2264 50 characters); bodies fill in the detail.\n- For citation claims, the title summarizes what the source asserts (e.g. \"NASA reports temperature rise\"); the URL goes in `url`.\n- For axiomatic claims, the `axiom` field captures the self-evident proposition (e.g. \"A bachelor is an unmarried man by definition.\").\n\nOutput ONLY the schema-shaped object. No prose.";
|
|
7
|
+
/**
|
|
8
|
+
* Builds the `claim-canonicalization` stage for the supplied
|
|
9
|
+
* extension. The stage's `outputSchema` carries the extension's
|
|
10
|
+
* per-claim fields, so the LLM's structured-output schema matches the
|
|
11
|
+
* extension's claim shape (e.g. for `basics`: a discriminated union
|
|
12
|
+
* over `type`).
|
|
13
|
+
*/
|
|
14
|
+
export declare function createClaimCanonicalizationStage(extension: TIngestionExtension): TStage<TClaimCanonicalizationOutput>;
|
|
15
|
+
//# sourceMappingURL=claim-canonicalization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claim-canonicalization.d.ts","sourceRoot":"","sources":["../../../../src/extensions/argument-ingestion/stages/claim-canonicalization.ts"],"names":[],"mappings":"AAiBA,OAAO,EAMH,KAAK,4BAA4B,EACpC,MAAM,cAAc,CAAA;AAGrB,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,iCAAiC,CAAA;AAC5E,OAAO,KAAK,EAAE,mBAAmB,EAAmB,MAAM,oBAAoB,CAAA;AAE9E,eAAO,MAAM,4BAA4B,YAAY,CAAA;AACrD,eAAO,MAAM,gCAAgC,EACvC,SAAS,GACT,KAAK,GACL,QAAQ,GACR,MAAiB,CAAA;AAEvB,eAAO,MAAM,oCAAoC,05FAkCD,CAAA;AA8GhD;;;;;;GAMG;AACH,wBAAgB,gCAAgC,CAC5C,SAAS,EAAE,mBAAmB,GAC/B,MAAM,CAAC,4BAA4B,CAAC,CAatC"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
// `claim-canonicalization` — merges the raw mentions into a single
|
|
2
|
+
// canonical claim set. Each canonical claim carries:
|
|
3
|
+
// - a miniId (c1, c2, ...) allocated by the stage
|
|
4
|
+
// - the mentionIds it absorbed
|
|
5
|
+
// - a `suggestedSymbol` — the canonicalizer's snake_case-shaped
|
|
6
|
+
// proposal (validated downstream by variable-assignment)
|
|
7
|
+
// - the extension's per-claim fields (e.g. for `basics`: a
|
|
8
|
+
// discriminated union over `type` with title/body/url/axiom)
|
|
9
|
+
//
|
|
10
|
+
// `mentionToClaim` maps every mention id back to its assigned
|
|
11
|
+
// canonical claim's miniId — useful for downstream stages (and
|
|
12
|
+
// finalize) that want to trace evidence back to the text.
|
|
13
|
+
//
|
|
14
|
+
// Per spec §6.4 this is a strong-reasoning stage: `gpt-5.5` with
|
|
15
|
+
// `reasoningEffort: 'medium'`.
|
|
16
|
+
import Type, {} from "typebox";
|
|
17
|
+
import { MentionToClaimEntrySchema, STAGE_IDS, } from "./schemas.js";
|
|
18
|
+
import { llmStage } from "../../../lib/pipelines/stage-helpers.js";
|
|
19
|
+
import { optional } from "../../../lib/pipelines/types.js";
|
|
20
|
+
export const CLAIM_CANONICALIZATION_MODEL = "gpt-5.5";
|
|
21
|
+
export const CLAIM_CANONICALIZATION_REASONING = "medium";
|
|
22
|
+
export const CLAIM_CANONICALIZATION_SYSTEM_PROMPT = `You merge raw claim mentions into a single canonical set of claims for an argument-ingestion pipeline.
|
|
23
|
+
|
|
24
|
+
You are given:
|
|
25
|
+
- the raw input text (for full context)
|
|
26
|
+
- the segmented breakdown of the text
|
|
27
|
+
- the list of every claim mention extracted from those segments
|
|
28
|
+
- optionally, the detected citation sources + axiom indicators
|
|
29
|
+
|
|
30
|
+
Your output has two parts:
|
|
31
|
+
|
|
32
|
+
1. \`canonicalClaims\` — an array of canonical claims, one entry per distinct proposition the author makes. Two mentions that assert the same proposition (even when phrased differently across the text) merge into a single canonical claim. Each canonical claim carries:
|
|
33
|
+
- \`miniId\` — assign in canonicalization order: c1, c2, c3, ...
|
|
34
|
+
- \`mentionIds\` — list of the mention ids that resolved to this claim
|
|
35
|
+
- \`type\` — one of "normal", "citation", or "axiomatic" (see below)
|
|
36
|
+
- \`suggestedSymbol\` — a short PascalCase-or-snake_case identifier summarizing the claim (e.g. "Rain_Wets_Ground", "NASA_Temp_Rise", "Socrates_Mortal"). Use letters, digits, and underscores only; start with a letter or underscore; keep under 32 characters; aim for under 20. AVOID single letters and generic names like "Claim1".
|
|
37
|
+
- the extension fields described in your output schema (title, body, url, axiom — whichever apply to the claim's \`type\`)
|
|
38
|
+
|
|
39
|
+
2. \`mentionToClaim\` — an array of \`{ "mentionId": "...", "claimMiniId": "..." }\` entries, one per input mention. Every input mentionId must appear in exactly one entry; the mapping is total. (We surface this as a list rather than a map because the response schema does not allow arbitrary string keys.)
|
|
40
|
+
|
|
41
|
+
## Claim types
|
|
42
|
+
|
|
43
|
+
- \`"normal"\` — a primary proposition the argument argues for or from.
|
|
44
|
+
- \`"citation"\` — a claim whose content is "the cited source asserts X". Use this type when one of the citation sources covers the same span(s) as the mention. Populate \`url\` (the URL if present) and \`title\` (a short human-readable label).
|
|
45
|
+
- \`"axiomatic"\` — a claim invoked as self-evident truth. Use this type when an axiom indicator (e.g. "by definition") covers or precedes the mention. Populate \`axiom\` with the gist of the self-evident proposition.
|
|
46
|
+
|
|
47
|
+
When a mention is the antecedent of "according to X, P", split it into two claims: a citation-typed claim for the source itself + a normal-typed claim for the proposition. The two are connected via a relation in a later stage, not here.
|
|
48
|
+
|
|
49
|
+
## Style
|
|
50
|
+
|
|
51
|
+
- Claim titles + bodies are written in third-person, present-tense, active voice.
|
|
52
|
+
- Titles are short (≤ 50 characters); bodies fill in the detail.
|
|
53
|
+
- For citation claims, the title summarizes what the source asserts (e.g. "NASA reports temperature rise"); the URL goes in \`url\`.
|
|
54
|
+
- For axiomatic claims, the \`axiom\` field captures the self-evident proposition (e.g. "A bachelor is an unmarried man by definition.").
|
|
55
|
+
|
|
56
|
+
Output ONLY the schema-shaped object. No prose.`;
|
|
57
|
+
function buildResponseSchema(extension) {
|
|
58
|
+
return Type.Object({
|
|
59
|
+
canonicalClaims: Type.Array(buildClaimRecordSchema(extension.claimSchema)),
|
|
60
|
+
// List-shape (not Record/map) for OpenAI strict-mode
|
|
61
|
+
// compatibility — see `MentionToClaimEntrySchema` docstring
|
|
62
|
+
// in `./schemas.ts` for the OpenAI 400 chain that motivated
|
|
63
|
+
// the shape change.
|
|
64
|
+
mentionToClaim: Type.Array(MentionToClaimEntrySchema),
|
|
65
|
+
}, { additionalProperties: false });
|
|
66
|
+
}
|
|
67
|
+
function buildClaimRecordSchema(claimSchema) {
|
|
68
|
+
// claimSchema is the extension's claim shape — often a
|
|
69
|
+
// discriminated union over `type`. We need to inject the
|
|
70
|
+
// canonicalizer-owned fields (miniId / mentionIds / suggestedSymbol)
|
|
71
|
+
// into each branch.
|
|
72
|
+
const canonicalFields = {
|
|
73
|
+
miniId: Type.String({
|
|
74
|
+
description: "Sequential canonicalization id (c1, c2, ...).",
|
|
75
|
+
}),
|
|
76
|
+
mentionIds: Type.Array(Type.String(), {
|
|
77
|
+
description: "Mention ids merged into this canonical claim.",
|
|
78
|
+
}),
|
|
79
|
+
suggestedSymbol: Type.String({
|
|
80
|
+
description: "Snake_case / PascalCase identifier proposal for the claim's logical variable. ≤ 32 chars; letters / digits / underscores; starts with letter or underscore.",
|
|
81
|
+
}),
|
|
82
|
+
};
|
|
83
|
+
const ext = claimSchema;
|
|
84
|
+
const anyOf = ext.anyOf;
|
|
85
|
+
if (Array.isArray(anyOf)) {
|
|
86
|
+
const branches = anyOf.map((branch) => {
|
|
87
|
+
const branchProps = branch
|
|
88
|
+
.properties;
|
|
89
|
+
if (!branchProps) {
|
|
90
|
+
throw new Error("claim-canonicalization: union extension branches must be object schemas.");
|
|
91
|
+
}
|
|
92
|
+
return Type.Object({ ...canonicalFields, ...branchProps }, { additionalProperties: false });
|
|
93
|
+
});
|
|
94
|
+
return Type.Union(branches);
|
|
95
|
+
}
|
|
96
|
+
const objProps = ext.properties;
|
|
97
|
+
if (!objProps) {
|
|
98
|
+
throw new Error("claim-canonicalization: extension claimSchema must be a Type.Object or a Type.Union of Type.Objects.");
|
|
99
|
+
}
|
|
100
|
+
return Type.Object({ ...canonicalFields, ...objProps }, { additionalProperties: false });
|
|
101
|
+
}
|
|
102
|
+
function buildPrompt(ctx) {
|
|
103
|
+
const input = ctx.input;
|
|
104
|
+
const mentionEnvelope = ctx.get(STAGE_IDS.claimMentionExtraction);
|
|
105
|
+
const mentions = mentionEnvelope?.mentions ?? [];
|
|
106
|
+
const citationEnvelope = ctx.get(STAGE_IDS.citationSourceDetection);
|
|
107
|
+
const citations = citationEnvelope?.sources ?? [];
|
|
108
|
+
const axiomEnvelope = ctx.get(STAGE_IDS.axiomIndicatorDetection);
|
|
109
|
+
const axioms = axiomEnvelope?.axioms ?? [];
|
|
110
|
+
const mentionLines = mentions
|
|
111
|
+
.map((m) => ` [${m.mentionId} @ ${m.segmentId}] ${JSON.stringify(m.text)}`)
|
|
112
|
+
.join("\n");
|
|
113
|
+
const citationLines = citations.length > 0
|
|
114
|
+
? citations
|
|
115
|
+
.map((c) => ` [${c.sourceId} @ ${c.segmentIds.join(",")}] ${JSON.stringify(c.sourceString)}${c.url ? ` (url: ${c.url})` : ""}`)
|
|
116
|
+
.join("\n")
|
|
117
|
+
: " (none)";
|
|
118
|
+
const axiomLines = axioms.length > 0
|
|
119
|
+
? axioms
|
|
120
|
+
.map((a) => ` [${a.axiomId} @ ${a.segmentIds.join(",")}] ${JSON.stringify(a.indicator)}`)
|
|
121
|
+
.join("\n")
|
|
122
|
+
: " (none)";
|
|
123
|
+
const markedSystem = `<!-- stage-id: ${STAGE_IDS.claimCanonicalization} -->\n${CLAIM_CANONICALIZATION_SYSTEM_PROMPT}`;
|
|
124
|
+
const user = `Input text:\n\n${input.text}\n\nClaim mentions:\n${mentionLines}\n\nDetected citation sources:\n${citationLines}\n\nDetected axiom indicators:\n${axiomLines}\n\nProduce the canonicalClaims + mentionToClaim object.`;
|
|
125
|
+
return { system: markedSystem, user };
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Builds the `claim-canonicalization` stage for the supplied
|
|
129
|
+
* extension. The stage's `outputSchema` carries the extension's
|
|
130
|
+
* per-claim fields, so the LLM's structured-output schema matches the
|
|
131
|
+
* extension's claim shape (e.g. for `basics`: a discriminated union
|
|
132
|
+
* over `type`).
|
|
133
|
+
*/
|
|
134
|
+
export function createClaimCanonicalizationStage(extension) {
|
|
135
|
+
return llmStage({
|
|
136
|
+
id: STAGE_IDS.claimCanonicalization,
|
|
137
|
+
dependsOn: [
|
|
138
|
+
STAGE_IDS.claimMentionExtraction,
|
|
139
|
+
optional(STAGE_IDS.citationSourceDetection),
|
|
140
|
+
optional(STAGE_IDS.axiomIndicatorDetection),
|
|
141
|
+
],
|
|
142
|
+
outputSchema: buildResponseSchema(extension),
|
|
143
|
+
model: CLAIM_CANONICALIZATION_MODEL,
|
|
144
|
+
reasoningEffort: CLAIM_CANONICALIZATION_REASONING,
|
|
145
|
+
buildPrompt,
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
//# sourceMappingURL=claim-canonicalization.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claim-canonicalization.js","sourceRoot":"","sources":["../../../../src/extensions/argument-ingestion/stages/claim-canonicalization.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,qDAAqD;AACrD,oDAAoD;AACpD,iCAAiC;AACjC,kEAAkE;AAClE,6DAA6D;AAC7D,6DAA6D;AAC7D,iEAAiE;AACjE,EAAE;AACF,8DAA8D;AAC9D,+DAA+D;AAC/D,0DAA0D;AAC1D,EAAE;AACF,iEAAiE;AACjE,+BAA+B;AAE/B,OAA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AAE,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,CAAA;AACzC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,gCAAgC,CAC5C,SAA8B;IAE9B,OAAO,QAAQ,CAA+B;QAC1C,EAAE,EAAE,SAAS,CAAC,qBAAqB;QACnC,SAAS,EAAE;YACP,SAAS,CAAC,sBAAsB;YAChC,QAAQ,CAAC,SAAS,CAAC,uBAAuB,CAAC;YAC3C,QAAQ,CAAC,SAAS,CAAC,uBAAuB,CAAC;SAC9C;QACD,YAAY,EAAE,mBAAmB,CAAC,SAAS,CAAC;QAC5C,KAAK,EAAE,4BAA4B;QACnC,eAAe,EAAE,gCAAgC;QACjD,WAAW;KACd,CAAC,CAAA;AACN,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type TClaimMentionExtractionOutput } from "./schemas.js";
|
|
2
|
+
import type { TStage } from "../../../lib/pipelines/types.js";
|
|
3
|
+
export declare const CLAIM_MENTION_EXTRACTION_MODEL = "gpt-5.4";
|
|
4
|
+
export declare const CLAIM_MENTION_EXTRACTION_SYSTEM_PROMPT = "You extract textual \"claim mentions\" from segments of an argument. A mention is any contiguous span of text that asserts a proposition the author is making \u2014 a sentence-or-clause-sized chunk that a reader would read as a single assertion.\n\nReturn an object with a single key `mentions` whose value is the array of extracted mentions. For each mention emit:\n- a fresh \"mentionId\" (m1, m2, ...; unique across all segments)\n- the \"segmentId\" the mention belongs to\n- the verbatim \"text\" of the mention (copy from the input \u2014 do not rewrite)\n- the character \"span\" (an object with \"start\" inclusive, \"end\" exclusive) relative to the SEGMENT'S TEXT (not the original input)\n\nA single segment can produce multiple mentions when it asserts multiple things. Most segments produce one mention. Do NOT deduplicate \u2014 if the same proposition is reasserted in a later segment, emit it as a separate mention there too. Do NOT classify the mention. Do NOT include connectives, hedges, or discourse markers in the span when they are not part of the asserted proposition.\n\nIf a segment is purely a discourse marker (e.g., \"Therefore,\" or \"Moreover,\"), emit no mention for it. If there are no mentions at all, return `{ \"mentions\": [] }`.";
|
|
5
|
+
export declare const claimMentionExtractionStage: TStage<TClaimMentionExtractionOutput>;
|
|
6
|
+
//# sourceMappingURL=claim-mention-extraction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claim-mention-extraction.d.ts","sourceRoot":"","sources":["../../../../src/extensions/argument-ingestion/stages/claim-mention-extraction.ts"],"names":[],"mappings":"AAOA,OAAO,EAGH,KAAK,6BAA6B,EAErC,MAAM,cAAc,CAAA;AAErB,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,iCAAiC,CAAA;AAE5E,eAAO,MAAM,8BAA8B,YAAY,CAAA;AAEvD,eAAO,MAAM,sCAAsC,svCAUoH,CAAA;AAavK,eAAO,MAAM,2BAA2B,EAAE,MAAM,CAAC,6BAA6B,CAOxE,CAAA"}
|