@proposit/proposit-core 2.2.1 → 2.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/basics/schemata.d.ts +4 -0
- package/dist/extensions/basics/schemata.d.ts.map +1 -1
- package/dist/extensions/basics/schemata.js +6 -0
- package/dist/extensions/basics/schemata.js.map +1 -1
- package/dist/extensions/pipelines/base/finalize-response-v2.d.ts.map +1 -1
- package/dist/extensions/pipelines/base/finalize-response-v2.js +88 -22
- package/dist/extensions/pipelines/base/finalize-response-v2.js.map +1 -1
- package/dist/extensions/pipelines/base/stages/claim-canonicalization.d.ts +1 -1
- package/dist/extensions/pipelines/base/stages/claim-canonicalization.d.ts.map +1 -1
- package/dist/extensions/pipelines/base/stages/claim-canonicalization.js +1 -1
- package/dist/extensions/pipelines/base/stages/conclusion-selection.d.ts +3 -3
- package/dist/extensions/pipelines/base/stages/conclusion-selection.d.ts.map +1 -1
- package/dist/extensions/pipelines/base/stages/conclusion-selection.js +5 -5
- package/dist/extensions/pipelines/base/stages/conclusion-selection.js.map +1 -1
- package/dist/extensions/pipelines/base/stages/formula-compilation.d.ts +69 -14
- package/dist/extensions/pipelines/base/stages/formula-compilation.d.ts.map +1 -1
- package/dist/extensions/pipelines/base/stages/formula-compilation.js +204 -76
- package/dist/extensions/pipelines/base/stages/formula-compilation.js.map +1 -1
- package/dist/extensions/pipelines/base/stages/relation-extraction.d.ts +1 -1
- package/dist/extensions/pipelines/base/stages/relation-extraction.d.ts.map +1 -1
- package/dist/extensions/pipelines/base/stages/relation-extraction.js +20 -19
- package/dist/extensions/pipelines/base/stages/relation-extraction.js.map +1 -1
- package/dist/extensions/pipelines/base/stages/schemas.d.ts +10 -8
- package/dist/extensions/pipelines/base/stages/schemas.d.ts.map +1 -1
- package/dist/extensions/pipelines/base/stages/schemas.js +14 -11
- package/dist/extensions/pipelines/base/stages/schemas.js.map +1 -1
- package/dist/extensions/pipelines/ingestion/scribe/extract-stage.d.ts +1 -1
- package/dist/extensions/pipelines/ingestion/scribe/extract-stage.d.ts.map +1 -1
- package/dist/extensions/pipelines/ingestion/scribe/extract-stage.js +2 -1
- package/dist/extensions/pipelines/ingestion/scribe/extract-stage.js.map +1 -1
- package/dist/extensions/pipelines/ingestion/scribe/schemas.d.ts +3 -3
- package/dist/extensions/pipelines/ingestion/scribe/structure-stage.d.ts +1 -1
- package/dist/extensions/pipelines/ingestion/scribe/structure-stage.d.ts.map +1 -1
- package/dist/extensions/pipelines/ingestion/scribe/structure-stage.js +2 -2
- package/dist/extensions/pipelines/ingestion/scribe/structure-stage.js.map +1 -1
- package/dist/lib/parsing/argument-parser.d.ts.map +1 -1
- package/dist/lib/parsing/argument-parser.js +18 -68
- package/dist/lib/parsing/argument-parser.js.map +1 -1
- package/dist/lib/parsing/schemata.d.ts +13 -0
- package/dist/lib/parsing/schemata.d.ts.map +1 -1
- package/dist/lib/parsing/schemata.js +10 -0
- package/dist/lib/parsing/schemata.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,34 +1,167 @@
|
|
|
1
|
-
// `formula-compilation` — deterministic stage that
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
1
|
+
// `formula-compilation` — deterministic stage that turns each `inference`
|
|
2
|
+
// relation into a `parseFormula`-consumable formula string for a freeform
|
|
3
|
+
// premise, sorts citation/axiomatic antecedents out into derivation
|
|
4
|
+
// backing, and mints one dedicated "conclusion premise" whose formula is
|
|
5
|
+
// just the conclusion claim's variable symbol.
|
|
5
6
|
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
// derivation-support s → t ⇒ s_symbol IMPLIES t_symbol
|
|
7
|
+
// Inference relations compile to:
|
|
8
|
+
// antecedents a1..an → consequent c ⇒ (a1 AND ... AND an) IMPLIES c
|
|
9
|
+
// (a single antecedent drops the parentheses: a1 IMPLIES c)
|
|
10
10
|
//
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
//
|
|
11
|
+
// Citation/axiomatic claims may not sit in a freeform premise (grammar
|
|
12
|
+
// rules D-4 / D-5) — they ground a derivation premise instead.
|
|
13
|
+
// `sortInferenceRelations` extracts any citation/axiomatic antecedent into
|
|
14
|
+
// `derivationBacking` (consumed by the parser to build derivation premises)
|
|
15
|
+
// and keeps only the normal antecedents in the freeform implication. A
|
|
16
|
+
// relation left with no normal antecedents is fully captured by the backing
|
|
17
|
+
// and emits no freeform premise. A relation whose consequent is itself
|
|
18
|
+
// citation/axiomatic, or whose antecedent can't be resolved to a known
|
|
19
|
+
// claim type, is dropped with a recorded warning — a bad relation degrades
|
|
20
|
+
// to "premise omitted", never to a failed import.
|
|
19
21
|
//
|
|
20
|
-
//
|
|
21
|
-
//
|
|
22
|
-
//
|
|
23
|
-
//
|
|
22
|
+
// The conclusion-premise mapping rule:
|
|
23
|
+
// - When `conclusion-selection.conclusionMiniId` is non-null AND the
|
|
24
|
+
// claim resolves to a variable symbol: one premise is minted with
|
|
25
|
+
// `roleHint: "conclusion"` and `formula: <the claim's symbol>`.
|
|
26
|
+
// - Otherwise `conclusionPremiseMiniId` is null.
|
|
24
27
|
import { STAGE_IDS, FormulaCompilationOutputSchema, } from "./schemas.js";
|
|
25
28
|
import { deterministicStage } from "../../../../lib/pipelines/stage-helpers.js";
|
|
26
29
|
export const FORMULA_COMPILATION_FAILURE_CODES = {
|
|
27
|
-
|
|
28
|
-
|
|
30
|
+
unresolvedAntecedent: "FORMULA_COMPILATION_ANTECEDENT_UNRESOLVED",
|
|
31
|
+
unresolvedConsequent: "FORMULA_COMPILATION_CONSEQUENT_UNRESOLVED",
|
|
29
32
|
unresolvedConclusion: "FORMULA_COMPILATION_CONCLUSION_UNRESOLVED",
|
|
30
|
-
|
|
33
|
+
emptyAntecedents: "FORMULA_COMPILATION_ANTECEDENTS_EMPTY",
|
|
31
34
|
};
|
|
35
|
+
// Claim types that may only ground a derivation premise — never sit in a
|
|
36
|
+
// freeform premise. An inference antecedent of one of these types is
|
|
37
|
+
// extracted into derivation backing instead of the freeform formula.
|
|
38
|
+
const DERIVATION_ONLY_CLAIM_TYPES = new Set(["citation", "axiomatic"]);
|
|
39
|
+
export const RELATION_PLACEMENT_FAILURE_CODES = {
|
|
40
|
+
droppedTypedConsequent: "RELATION_PLACEMENT_DROPPED_TYPED_CONSEQUENT",
|
|
41
|
+
droppedUnresolvedClaim: "RELATION_PLACEMENT_DROPPED_UNRESOLVED_CLAIM",
|
|
42
|
+
droppedEmptyAntecedents: "RELATION_PLACEMENT_DROPPED_EMPTY_ANTECEDENTS",
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Resolve each claim's effective type into a `miniId → type` map,
|
|
46
|
+
* preferring the `claim-type-classification` entry and falling back to the
|
|
47
|
+
* canonicalizer's drafted `type`. This is the SAME resolution
|
|
48
|
+
* `finalizeResponseV2` uses, so the sort and finalize never disagree on
|
|
49
|
+
* whether a claim is citation/axiomatic — a disagreement is exactly what
|
|
50
|
+
* would let a citation slip into a freeform premise.
|
|
51
|
+
*/
|
|
52
|
+
export function resolveClaimTypes(input) {
|
|
53
|
+
const byMiniId = new Map();
|
|
54
|
+
for (const claim of input.canonicalClaims) {
|
|
55
|
+
byMiniId.set(claim.miniId, claim.type);
|
|
56
|
+
}
|
|
57
|
+
for (const entry of input.classifications) {
|
|
58
|
+
byMiniId.set(entry.miniId, entry.type);
|
|
59
|
+
}
|
|
60
|
+
return byMiniId;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Deterministically sort inference relations into freeform premises and
|
|
64
|
+
* derivation backing. For each relation:
|
|
65
|
+
* - drop (warn) if the consequent is citation/axiomatic — a typed claim
|
|
66
|
+
* cannot be the consequent of an implication;
|
|
67
|
+
* - dedupe antecedents and drop a self-referential antecedent;
|
|
68
|
+
* - drop (warn) the whole relation if any antecedent's type can't be
|
|
69
|
+
* resolved — never silently treat an unresolved id as `normal`;
|
|
70
|
+
* - route citation/axiomatic antecedents into `derivationBacking`;
|
|
71
|
+
* - keep the normal antecedents as the freeform implication; if none
|
|
72
|
+
* remain, the relation is fully captured by the backing and yields no
|
|
73
|
+
* freeform premise.
|
|
74
|
+
*/
|
|
75
|
+
export function sortInferenceRelations(input) {
|
|
76
|
+
const emit = input.addFailure ?? (() => undefined);
|
|
77
|
+
const freeformRelations = [];
|
|
78
|
+
const derivationBacking = new Map();
|
|
79
|
+
const addBacking = (consequent, supporter) => {
|
|
80
|
+
const list = derivationBacking.get(consequent) ?? [];
|
|
81
|
+
if (!list.includes(supporter))
|
|
82
|
+
list.push(supporter);
|
|
83
|
+
derivationBacking.set(consequent, list);
|
|
84
|
+
};
|
|
85
|
+
for (const relation of input.relations) {
|
|
86
|
+
const consequentType = input.typeByClaimMiniId.get(relation.consequent);
|
|
87
|
+
if (consequentType === undefined) {
|
|
88
|
+
emit({
|
|
89
|
+
code: RELATION_PLACEMENT_FAILURE_CODES.droppedUnresolvedClaim,
|
|
90
|
+
message: `Relation "${relation.relationId}" consequent "${relation.consequent}" has no resolvable claim type; dropping.`,
|
|
91
|
+
severity: "warning",
|
|
92
|
+
context: {
|
|
93
|
+
relationId: relation.relationId,
|
|
94
|
+
claimMiniId: relation.consequent,
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
if (DERIVATION_ONLY_CLAIM_TYPES.has(consequentType)) {
|
|
100
|
+
emit({
|
|
101
|
+
code: RELATION_PLACEMENT_FAILURE_CODES.droppedTypedConsequent,
|
|
102
|
+
message: `Relation "${relation.relationId}" has a ${consequentType} consequent; citation/axiomatic claims cannot be an implication's consequent. Dropping.`,
|
|
103
|
+
severity: "warning",
|
|
104
|
+
context: {
|
|
105
|
+
relationId: relation.relationId,
|
|
106
|
+
consequent: relation.consequent,
|
|
107
|
+
consequentType,
|
|
108
|
+
},
|
|
109
|
+
});
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
// Dedupe antecedents and drop any self-reference to the consequent.
|
|
113
|
+
const antecedents = [...new Set(relation.antecedents)].filter((a) => a !== relation.consequent);
|
|
114
|
+
if (antecedents.length === 0) {
|
|
115
|
+
emit({
|
|
116
|
+
code: RELATION_PLACEMENT_FAILURE_CODES.droppedEmptyAntecedents,
|
|
117
|
+
message: `Relation "${relation.relationId}" has no usable antecedents; dropping.`,
|
|
118
|
+
severity: "warning",
|
|
119
|
+
context: { relationId: relation.relationId },
|
|
120
|
+
});
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
const normalAntecedents = [];
|
|
124
|
+
const typedAntecedents = [];
|
|
125
|
+
let unresolved = false;
|
|
126
|
+
for (const antecedent of antecedents) {
|
|
127
|
+
const type = input.typeByClaimMiniId.get(antecedent);
|
|
128
|
+
if (type === undefined) {
|
|
129
|
+
emit({
|
|
130
|
+
code: RELATION_PLACEMENT_FAILURE_CODES.droppedUnresolvedClaim,
|
|
131
|
+
message: `Relation "${relation.relationId}" antecedent "${antecedent}" has no resolvable claim type; dropping the relation rather than treating it as normal.`,
|
|
132
|
+
severity: "warning",
|
|
133
|
+
context: {
|
|
134
|
+
relationId: relation.relationId,
|
|
135
|
+
claimMiniId: antecedent,
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
unresolved = true;
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
if (DERIVATION_ONLY_CLAIM_TYPES.has(type)) {
|
|
142
|
+
typedAntecedents.push(antecedent);
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
normalAntecedents.push(antecedent);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
if (unresolved)
|
|
149
|
+
continue;
|
|
150
|
+
for (const supporter of typedAntecedents) {
|
|
151
|
+
addBacking(relation.consequent, supporter);
|
|
152
|
+
}
|
|
153
|
+
if (normalAntecedents.length === 0) {
|
|
154
|
+
// Fully captured by derivation backing; no freeform premise.
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
freeformRelations.push({
|
|
158
|
+
relationId: relation.relationId,
|
|
159
|
+
antecedents: normalAntecedents,
|
|
160
|
+
consequent: relation.consequent,
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
return { freeformRelations, derivationBacking };
|
|
164
|
+
}
|
|
32
165
|
function buildClaimToSymbol(variables) {
|
|
33
166
|
const m = new Map();
|
|
34
167
|
for (const v of variables) {
|
|
@@ -36,94 +169,71 @@ function buildClaimToSymbol(variables) {
|
|
|
36
169
|
}
|
|
37
170
|
return m;
|
|
38
171
|
}
|
|
39
|
-
function relationToRoleHint(type) {
|
|
40
|
-
switch (type) {
|
|
41
|
-
case "support":
|
|
42
|
-
return "support";
|
|
43
|
-
case "joint-support":
|
|
44
|
-
return "joint-support";
|
|
45
|
-
case "derivation-support":
|
|
46
|
-
return "derivation";
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
172
|
/**
|
|
50
|
-
*
|
|
173
|
+
* Compile freeform relations into premise formulas, and mint the
|
|
174
|
+
* conclusion premise. Pure helper exposed for direct testing. The stage's
|
|
175
|
+
* `derivationBacking` is added by the stage wrapper, not here.
|
|
51
176
|
*/
|
|
52
177
|
export function compileFormulas(input) {
|
|
53
178
|
const claimToSymbol = buildClaimToSymbol(input.variables);
|
|
54
|
-
const
|
|
55
|
-
// intentionally empty — tests can supply addFailure to capture emits
|
|
56
|
-
};
|
|
57
|
-
const emit = input.addFailure ?? noopEmit;
|
|
179
|
+
const emit = input.addFailure ?? (() => undefined);
|
|
58
180
|
const premises = [];
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if (relation.sources.length === 0) {
|
|
181
|
+
for (const relation of input.freeformRelations) {
|
|
182
|
+
if (relation.antecedents.length === 0) {
|
|
62
183
|
emit({
|
|
63
|
-
code: FORMULA_COMPILATION_FAILURE_CODES.
|
|
64
|
-
message: `Relation "${relation.relationId}" has no
|
|
184
|
+
code: FORMULA_COMPILATION_FAILURE_CODES.emptyAntecedents,
|
|
185
|
+
message: `Relation "${relation.relationId}" has no antecedents; cannot compile.`,
|
|
65
186
|
severity: "warning",
|
|
66
187
|
context: { relationId: relation.relationId },
|
|
67
188
|
});
|
|
68
189
|
continue;
|
|
69
190
|
}
|
|
70
|
-
const
|
|
71
|
-
if (!
|
|
191
|
+
const consequentSymbol = claimToSymbol.get(relation.consequent);
|
|
192
|
+
if (!consequentSymbol) {
|
|
72
193
|
emit({
|
|
73
|
-
code: FORMULA_COMPILATION_FAILURE_CODES.
|
|
74
|
-
message: `Relation "${relation.relationId}"
|
|
194
|
+
code: FORMULA_COMPILATION_FAILURE_CODES.unresolvedConsequent,
|
|
195
|
+
message: `Relation "${relation.relationId}" consequent claim "${relation.consequent}" has no variable assignment; dropping.`,
|
|
75
196
|
severity: "error",
|
|
76
197
|
context: {
|
|
77
198
|
relationId: relation.relationId,
|
|
78
|
-
|
|
199
|
+
consequentClaimMiniId: relation.consequent,
|
|
79
200
|
},
|
|
80
201
|
});
|
|
81
202
|
continue;
|
|
82
203
|
}
|
|
83
|
-
const
|
|
84
|
-
let
|
|
85
|
-
for (const
|
|
86
|
-
const sym = claimToSymbol.get(
|
|
204
|
+
const antecedentSymbols = [];
|
|
205
|
+
let antecedentsOk = true;
|
|
206
|
+
for (const antecedent of relation.antecedents) {
|
|
207
|
+
const sym = claimToSymbol.get(antecedent);
|
|
87
208
|
if (!sym) {
|
|
88
209
|
emit({
|
|
89
|
-
code: FORMULA_COMPILATION_FAILURE_CODES.
|
|
90
|
-
message: `Relation "${relation.relationId}"
|
|
210
|
+
code: FORMULA_COMPILATION_FAILURE_CODES.unresolvedAntecedent,
|
|
211
|
+
message: `Relation "${relation.relationId}" antecedent claim "${antecedent}" has no variable assignment; dropping.`,
|
|
91
212
|
severity: "error",
|
|
92
213
|
context: {
|
|
93
214
|
relationId: relation.relationId,
|
|
94
|
-
|
|
215
|
+
antecedentClaimMiniId: antecedent,
|
|
95
216
|
},
|
|
96
217
|
});
|
|
97
|
-
|
|
218
|
+
antecedentsOk = false;
|
|
98
219
|
break;
|
|
99
220
|
}
|
|
100
|
-
|
|
221
|
+
antecedentSymbols.push(sym);
|
|
101
222
|
}
|
|
102
|
-
if (!
|
|
223
|
+
if (!antecedentsOk)
|
|
103
224
|
continue;
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
108
|
-
else if (sourceSymbols.length === 1) {
|
|
109
|
-
formula = `${sourceSymbols[0]} implies ${targetSymbol}`;
|
|
110
|
-
}
|
|
111
|
-
else {
|
|
112
|
-
// joint-support with exactly one source — degenerate; still
|
|
113
|
-
// compile as a plain support implication (the parens would
|
|
114
|
-
// be redundant). joint-support with zero sources is caught
|
|
115
|
-
// by the emptySources guard above.
|
|
116
|
-
formula = `${sourceSymbols.join(" and ")} implies ${targetSymbol}`;
|
|
117
|
-
}
|
|
225
|
+
const formula = antecedentSymbols.length > 1
|
|
226
|
+
? `(${antecedentSymbols.join(" and ")}) implies ${consequentSymbol}`
|
|
227
|
+
: `${antecedentSymbols[0]} implies ${consequentSymbol}`;
|
|
118
228
|
premises.push({
|
|
119
229
|
premiseMiniId: input.generateId(),
|
|
120
230
|
formula,
|
|
121
|
-
roleHint:
|
|
231
|
+
roleHint: "freeform",
|
|
122
232
|
sourceRelationId: relation.relationId,
|
|
123
233
|
});
|
|
124
234
|
}
|
|
125
|
-
// Mint the conclusion premise iff conclusion-selection chose a
|
|
126
|
-
//
|
|
235
|
+
// Mint the conclusion premise iff conclusion-selection chose a claim
|
|
236
|
+
// AND the claim resolves to a known variable symbol.
|
|
127
237
|
let conclusionPremiseMiniId = null;
|
|
128
238
|
const conclusionClaimMiniId = input.conclusion?.conclusionMiniId ?? null;
|
|
129
239
|
if (conclusionClaimMiniId !== null) {
|
|
@@ -156,6 +266,7 @@ export const formulaCompilationStage = deterministicStage({
|
|
|
156
266
|
STAGE_IDS.conclusionSelection,
|
|
157
267
|
STAGE_IDS.variableAssignment,
|
|
158
268
|
STAGE_IDS.claimTypeClassification,
|
|
269
|
+
STAGE_IDS.claimCanonicalization,
|
|
159
270
|
],
|
|
160
271
|
outputSchema: FormulaCompilationOutputSchema,
|
|
161
272
|
fn: (ctx) => {
|
|
@@ -163,13 +274,30 @@ export const formulaCompilationStage = deterministicStage({
|
|
|
163
274
|
const relations = relationEnvelope?.relations ?? [];
|
|
164
275
|
const conclusion = ctx.get(STAGE_IDS.conclusionSelection);
|
|
165
276
|
const variables = ctx.get(STAGE_IDS.variableAssignment) ?? [];
|
|
166
|
-
|
|
277
|
+
const typeEnvelope = ctx.get(STAGE_IDS.claimTypeClassification);
|
|
278
|
+
const canon = ctx.get(STAGE_IDS.claimCanonicalization);
|
|
279
|
+
const { freeformRelations, derivationBacking } = sortInferenceRelations({
|
|
167
280
|
relations,
|
|
281
|
+
typeByClaimMiniId: resolveClaimTypes({
|
|
282
|
+
classifications: typeEnvelope?.classifications ?? [],
|
|
283
|
+
canonicalClaims: canon?.canonicalClaims ?? [],
|
|
284
|
+
}),
|
|
285
|
+
addFailure: ctx.addFailure,
|
|
286
|
+
});
|
|
287
|
+
const compiled = compileFormulas({
|
|
288
|
+
freeformRelations,
|
|
168
289
|
conclusion,
|
|
169
290
|
variables,
|
|
170
291
|
generateId: ctx.generateId,
|
|
171
292
|
addFailure: ctx.addFailure,
|
|
172
293
|
});
|
|
294
|
+
return {
|
|
295
|
+
...compiled,
|
|
296
|
+
derivationBacking: [...derivationBacking.entries()].map(([derivedClaimMiniId, supportingClaimMiniIds]) => ({
|
|
297
|
+
derivedClaimMiniId,
|
|
298
|
+
supportingClaimMiniIds,
|
|
299
|
+
})),
|
|
300
|
+
};
|
|
173
301
|
},
|
|
174
302
|
});
|
|
175
303
|
//# sourceMappingURL=formula-compilation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formula-compilation.js","sourceRoot":"","sources":["../../../../../src/extensions/pipelines/base/stages/formula-compilation.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"formula-compilation.js","sourceRoot":"","sources":["../../../../../src/extensions/pipelines/base/stages/formula-compilation.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,0EAA0E;AAC1E,oEAAoE;AACpE,yEAAyE;AACzE,+CAA+C;AAC/C,EAAE;AACF,kCAAkC;AAClC,wEAAwE;AACxE,8DAA8D;AAC9D,EAAE;AACF,uEAAuE;AACvE,+DAA+D;AAC/D,2EAA2E;AAC3E,4EAA4E;AAC5E,uEAAuE;AACvE,4EAA4E;AAC5E,uEAAuE;AACvE,uEAAuE;AACvE,2EAA2E;AAC3E,kDAAkD;AAClD,EAAE;AACF,uCAAuC;AACvC,uEAAuE;AACvE,sEAAsE;AACtE,oEAAoE;AACpE,mDAAmD;AAEnD,OAAO,EACH,SAAS,EACT,8BAA8B,GASjC,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAA;AAG/E,MAAM,CAAC,MAAM,iCAAiC,GAAG;IAC7C,oBAAoB,EAAE,2CAA2C;IACjE,oBAAoB,EAAE,2CAA2C;IACjE,oBAAoB,EAAE,2CAA2C;IACjE,gBAAgB,EAAE,uCAAuC;CACnD,CAAA;AAEV,yEAAyE;AACzE,qEAAqE;AACrE,qEAAqE;AACrE,MAAM,2BAA2B,GAAG,IAAI,GAAG,CAEzC,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC,CAAA;AAE5B,MAAM,CAAC,MAAM,gCAAgC,GAAG;IAC5C,sBAAsB,EAAE,6CAA6C;IACrE,sBAAsB,EAAE,6CAA6C;IACrE,uBAAuB,EAAE,8CAA8C;CACjE,CAAA;AASV;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAMjC;IACG,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAiD,CAAA;IACzE,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,eAAe,EAAE,CAAC;QACxC,QAAQ,CAAC,GAAG,CAAC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AAC,GAAG,CACxB,SAAS,CAAC,uBAAuB,CACpC,CAAA;QACD,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CACjB,SAAS,CAAC,qBAAqB,CAClC,CAAA;QACD,MAAM,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,GAC1C,sBAAsB,CAAC;YACnB,SAAS;YACT,iBAAiB,EAAE,iBAAiB,CAAC;gBACjC,eAAe,EAAE,YAAY,EAAE,eAAe,IAAI,EAAE;gBACpD,eAAe,EAAE,KAAK,EAAE,eAAe,IAAI,EAAE;aAChD,CAAC;YACF,UAAU,EAAE,GAAG,CAAC,UAAU;SAC7B,CAAC,CAAA;QACN,MAAM,QAAQ,GAAG,eAAe,CAAC;YAC7B,iBAAiB;YACjB,UAAU;YACV,SAAS;YACT,UAAU,EAAE,GAAG,CAAC,UAAU;YAC1B,UAAU,EAAE,GAAG,CAAC,UAAU;SAC7B,CAAC,CAAA;QACF,OAAO;YACH,GAAG,QAAQ;YACX,iBAAiB,EAAE,CAAC,GAAG,iBAAiB,CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,CACnD,CAAC,CAAC,kBAAkB,EAAE,sBAAsB,CAAC,EAAE,EAAE,CAAC,CAAC;gBAC/C,kBAAkB;gBAClB,sBAAsB;aACzB,CAAC,CACL;SACJ,CAAA;IACL,CAAC;CACJ,CAAC,CAAA"}
|
|
@@ -3,7 +3,7 @@ import type { TStage } from "../../../../lib/pipelines/types.js";
|
|
|
3
3
|
import type { TLlmStageOptionsOverride } from "../types.js";
|
|
4
4
|
export declare const RELATION_EXTRACTION_MODEL = "gpt-5.5";
|
|
5
5
|
export declare const RELATION_EXTRACTION_REASONING: "minimal" | "low" | "medium" | "high";
|
|
6
|
-
export declare const RELATION_EXTRACTION_SYSTEM_PROMPT = "You identify
|
|
6
|
+
export declare const RELATION_EXTRACTION_SYSTEM_PROMPT = "You identify inference relationships between canonical claims in an argument.\n\nGiven the canonical claim set, the per-claim type map, and the original segments, emit one entry per inference. Return an object with a single key `relations` whose value is the array.\n\nAn `inference` relation says: the claims in `antecedents`, taken together, imply the claim in `consequent`. Use a SINGLE antecedent for an ordinary \"P, therefore Q\" step; use MULTIPLE antecedents when the author commits to a step that requires ALL of them to hold together (e.g. major premise + minor premise \u2192 conclusion).\n\nFor each relation emit:\n- a fresh `relationId` (r1, r2, ...)\n- `type` \u2014 always `\"inference\"`\n- `antecedents` \u2014 an array of the supporting claim miniIds (one or more) whose conjunction implies the consequent\n- `consequent` \u2014 the implied claim's miniId\n- `evidence.segmentIds` \u2014 the segments that ground the relation (often a single segment containing a \"therefore\", \"so\", \"because\")\n- `evidence.quote` \u2014 a short verbatim quote from the input that justifies the relation\n\n`antecedents` and `consequent` are CLAIM miniIds \u2014 NOT source citations. A citation-typed or axiomatic-typed claim may appear in `antecedents` (the pipeline routes it to where it belongs); do not special-case it. A citation/axiomatic claim is never a `consequent`.\n\n## Conservatism rules\n\n- Do not invent relations. If the author doesn't actually argue from the antecedents to the consequent, don't emit a relation.\n- Do not double-count. If several claims share the same backing, emit one relation per consequent, not a redundant pairing.\n- The conclusion of the argument is identified in a separate stage; do NOT emit a special \"conclusion\" relation here. Just emit the inference edges you see; the conclusion stage selects from your output.\n- Avoid attack/rebuttal relations entirely for now \u2014 the pipeline does not yet handle them.\n\nIf there are no relations to emit, return `{ \"relations\": [] }`.";
|
|
7
7
|
/** Internal default knobs for the relation-extraction stage. */
|
|
8
8
|
export declare const RELATION_EXTRACTION_STAGE_DEFAULTS: TLlmStageOptionsOverride;
|
|
9
9
|
/** Build the relation-extraction stage with optional caller overrides. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relation-extraction.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/pipelines/base/stages/relation-extraction.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"relation-extraction.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/pipelines/base/stages/relation-extraction.ts"],"names":[],"mappings":"AAUA,OAAO,EAMH,KAAK,yBAAyB,EAEjC,MAAM,cAAc,CAAA;AAErB,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,oCAAoC,CAAA;AAC/E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA;AAE3D,eAAO,MAAM,yBAAyB,YAAY,CAAA;AAClD,eAAO,MAAM,6BAA6B,EACpC,SAAS,GACT,KAAK,GACL,QAAQ,GACR,MAAe,CAAA;AAErB,eAAO,MAAM,iCAAiC,2/DAuBqB,CAAA;AAuCnE,gEAAgE;AAChE,eAAO,MAAM,kCAAkC,EAAE,wBAGhD,CAAA;AAED,0EAA0E;AAC1E,wBAAgB,6BAA6B,CACzC,OAAO,CAAC,EAAE,wBAAwB,GACnC,MAAM,CAAC,yBAAyB,CAAC,CAgBnC;AAED,iDAAiD;AACjD,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,yBAAyB,CACnC,CAAA"}
|
|
@@ -1,37 +1,38 @@
|
|
|
1
1
|
// `relation-extraction` — strong-reasoning stage that identifies the
|
|
2
|
-
//
|
|
3
|
-
//
|
|
2
|
+
// inference relationships between canonical claims. Each relation is an
|
|
3
|
+
// `inference`: its `antecedents` claims, taken together, imply its
|
|
4
|
+
// `consequent` claim.
|
|
4
5
|
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
6
|
+
// This stage uses gpt-5.5 with reasoning_effort=high — it's the most
|
|
7
|
+
// subtle judgement call in the pipeline. The output is a graph; the
|
|
8
|
+
// conclusion + the inference graph drive the formula-compilation stage
|
|
9
|
+
// that comes next.
|
|
9
10
|
import { STAGE_IDS, RelationExtractionOutputSchema, } from "./schemas.js";
|
|
10
11
|
import { llmStage } from "../../../../lib/pipelines/stage-helpers.js";
|
|
11
12
|
export const RELATION_EXTRACTION_MODEL = "gpt-5.5";
|
|
12
13
|
export const RELATION_EXTRACTION_REASONING = "high";
|
|
13
|
-
export const RELATION_EXTRACTION_SYSTEM_PROMPT = `You identify
|
|
14
|
+
export const RELATION_EXTRACTION_SYSTEM_PROMPT = `You identify inference relationships between canonical claims in an argument.
|
|
14
15
|
|
|
15
|
-
Given the canonical claim set, the per-claim type map, and the original segments, emit one entry per
|
|
16
|
+
Given the canonical claim set, the per-claim type map, and the original segments, emit one entry per inference. Return an object with a single key \`relations\` whose value is the array.
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
- \`"joint-support"\` — multiple claims S1, S2, ... jointly support T. Use this when the author commits to a syllogistic step that requires ALL of the sources to hold (e.g. major premise + minor premise → conclusion).
|
|
19
|
-
- \`"derivation-support"\` — a citation-typed or axiomatic-typed claim S supports a normal-typed claim T. Use this exclusively for relations whose source is "citation" or "axiomatic". The shape is otherwise identical to \`"support"\`.
|
|
18
|
+
An \`inference\` relation says: the claims in \`antecedents\`, taken together, imply the claim in \`consequent\`. Use a SINGLE antecedent for an ordinary "P, therefore Q" step; use MULTIPLE antecedents when the author commits to a step that requires ALL of them to hold together (e.g. major premise + minor premise → conclusion).
|
|
20
19
|
|
|
21
20
|
For each relation emit:
|
|
22
21
|
- a fresh \`relationId\` (r1, r2, ...)
|
|
23
|
-
-
|
|
24
|
-
- \`
|
|
25
|
-
- \`
|
|
22
|
+
- \`type\` — always \`"inference"\`
|
|
23
|
+
- \`antecedents\` — an array of the supporting claim miniIds (one or more) whose conjunction implies the consequent
|
|
24
|
+
- \`consequent\` — the implied claim's miniId
|
|
26
25
|
- \`evidence.segmentIds\` — the segments that ground the relation (often a single segment containing a "therefore", "so", "because")
|
|
27
26
|
- \`evidence.quote\` — a short verbatim quote from the input that justifies the relation
|
|
28
27
|
|
|
28
|
+
\`antecedents\` and \`consequent\` are CLAIM miniIds — NOT source citations. A citation-typed or axiomatic-typed claim may appear in \`antecedents\` (the pipeline routes it to where it belongs); do not special-case it. A citation/axiomatic claim is never a \`consequent\`.
|
|
29
|
+
|
|
29
30
|
## Conservatism rules
|
|
30
31
|
|
|
31
|
-
- Do not invent relations. If the author doesn't actually argue from
|
|
32
|
-
- Do not double-count. If
|
|
33
|
-
- The conclusion of the argument is identified in a separate stage; do NOT emit a special "conclusion" relation here. Just emit the
|
|
34
|
-
- Avoid attack/rebuttal relations entirely
|
|
32
|
+
- Do not invent relations. If the author doesn't actually argue from the antecedents to the consequent, don't emit a relation.
|
|
33
|
+
- Do not double-count. If several claims share the same backing, emit one relation per consequent, not a redundant pairing.
|
|
34
|
+
- The conclusion of the argument is identified in a separate stage; do NOT emit a special "conclusion" relation here. Just emit the inference edges you see; the conclusion stage selects from your output.
|
|
35
|
+
- Avoid attack/rebuttal relations entirely for now — the pipeline does not yet handle them.
|
|
35
36
|
|
|
36
37
|
If there are no relations to emit, return \`{ "relations": [] }\`.`;
|
|
37
38
|
function buildPrompt(ctx) {
|
|
@@ -59,7 +60,7 @@ function buildPrompt(ctx) {
|
|
|
59
60
|
.map((s) => ` [${s.segmentId}] ${JSON.stringify(s.text)}`)
|
|
60
61
|
.join("\n");
|
|
61
62
|
const markedSystem = `<!-- stage-id: ${STAGE_IDS.relationExtraction} -->\n${RELATION_EXTRACTION_SYSTEM_PROMPT}`;
|
|
62
|
-
const user = `Canonical claims (with refined types):\n${claimLines}\n\nSegments:\n${segmentLines}\n\nEmit every
|
|
63
|
+
const user = `Canonical claims (with refined types):\n${claimLines}\n\nSegments:\n${segmentLines}\n\nEmit every inference relationship as a relations array.`;
|
|
63
64
|
return { system: markedSystem, user };
|
|
64
65
|
}
|
|
65
66
|
/** Internal default knobs for the relation-extraction stage. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relation-extraction.js","sourceRoot":"","sources":["../../../../../src/extensions/pipelines/base/stages/relation-extraction.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,
|
|
1
|
+
{"version":3,"file":"relation-extraction.js","sourceRoot":"","sources":["../../../../../src/extensions/pipelines/base/stages/relation-extraction.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,wEAAwE;AACxE,mEAAmE;AACnE,sBAAsB;A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,uBAAuB,GAChC,6BAA6B,EAAE,CAAA"}
|
|
@@ -104,14 +104,12 @@ export declare const VariableAssignmentOutputSchema: Type.TArray<Type.TObject<{
|
|
|
104
104
|
}>>;
|
|
105
105
|
export type TVariableAssignmentOutput = Static<typeof VariableAssignmentOutputSchema>;
|
|
106
106
|
export type TAssignedVariable = TVariableAssignmentOutput[number];
|
|
107
|
-
export declare const RelationKindSchema: Type.TUnion<[Type.TLiteral<"support">, Type.TLiteral<"joint-support">, Type.TLiteral<"derivation-support">]>;
|
|
108
|
-
export type TRelationKind = Static<typeof RelationKindSchema>;
|
|
109
107
|
export declare const RelationExtractionOutputSchema: Type.TObject<{
|
|
110
108
|
relations: Type.TArray<Type.TObject<{
|
|
111
109
|
relationId: Type.TString;
|
|
112
|
-
type: Type.
|
|
113
|
-
|
|
114
|
-
|
|
110
|
+
type: Type.TLiteral<"inference">;
|
|
111
|
+
antecedents: Type.TArray<Type.TString>;
|
|
112
|
+
consequent: Type.TString;
|
|
115
113
|
evidence: Type.TObject<{
|
|
116
114
|
segmentIds: Type.TArray<Type.TString>;
|
|
117
115
|
quote: Type.TString;
|
|
@@ -119,7 +117,7 @@ export declare const RelationExtractionOutputSchema: Type.TObject<{
|
|
|
119
117
|
}>>;
|
|
120
118
|
}>;
|
|
121
119
|
export type TRelationExtractionOutput = Static<typeof RelationExtractionOutputSchema>;
|
|
122
|
-
export type
|
|
120
|
+
export type TInferenceRelation = TRelationExtractionOutput["relations"][number];
|
|
123
121
|
export declare const ConclusionSelectionLlmOutputSchema: Type.TObject<{
|
|
124
122
|
conclusionCandidates: Type.TArray<Type.TString>;
|
|
125
123
|
rationale: Type.TString;
|
|
@@ -131,16 +129,20 @@ export declare const ConclusionSelectionOutputSchema: Type.TObject<{
|
|
|
131
129
|
rationale: Type.TString;
|
|
132
130
|
}>;
|
|
133
131
|
export type TConclusionSelectionOutput = Static<typeof ConclusionSelectionOutputSchema>;
|
|
134
|
-
export declare const FormulaPremiseRoleHintSchema: Type.TUnion<[Type.TLiteral<"
|
|
132
|
+
export declare const FormulaPremiseRoleHintSchema: Type.TUnion<[Type.TLiteral<"freeform">, Type.TLiteral<"conclusion">]>;
|
|
135
133
|
export type TFormulaPremiseRoleHint = Static<typeof FormulaPremiseRoleHintSchema>;
|
|
136
134
|
export declare const FormulaCompilationOutputSchema: Type.TObject<{
|
|
137
135
|
premises: Type.TArray<Type.TObject<{
|
|
138
136
|
premiseMiniId: Type.TString;
|
|
139
137
|
formula: Type.TString;
|
|
140
|
-
roleHint: Type.TUnion<[Type.TLiteral<"
|
|
138
|
+
roleHint: Type.TUnion<[Type.TLiteral<"freeform">, Type.TLiteral<"conclusion">]>;
|
|
141
139
|
sourceRelationId: Type.TUnion<[Type.TString, Type.TNull]>;
|
|
142
140
|
}>>;
|
|
143
141
|
conclusionPremiseMiniId: Type.TUnion<[Type.TString, Type.TNull]>;
|
|
142
|
+
derivationBacking: Type.TArray<Type.TObject<{
|
|
143
|
+
derivedClaimMiniId: Type.TString;
|
|
144
|
+
supportingClaimMiniIds: Type.TArray<Type.TString>;
|
|
145
|
+
}>>;
|
|
144
146
|
}>;
|
|
145
147
|
export type TFormulaCompilationOutput = Static<typeof FormulaCompilationOutputSchema>;
|
|
146
148
|
export type TCompiledPremise = TFormulaCompilationOutput["premises"][number];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/pipelines/base/stages/schemas.ts"],"names":[],"mappings":"AAOA,OAAO,IAAI,EAAE,EAAE,KAAK,MAAM,EAAE,MAAM,SAAS,CAAA;AAiB3C,eAAO,MAAM,UAAU;;;EASrB,CAAA;AACF,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,UAAU,CAAC,CAAA;AAiB7C,eAAO,MAAM,wBAAwB;;;;;;;;;EAQnC,CAAA;AACF,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,OAAO,wBAAwB,CAAC,CAAA;AACzE,MAAM,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,CAAC,MAAM,CAAC,CAAA;AAQ/E,eAAO,MAAM,kCAAkC;;;EAG7C,CAAA;AACF,MAAM,MAAM,6BAA6B,GAAG,MAAM,CAC9C,OAAO,kCAAkC,CAC5C,CAAA;AAOD,eAAO,MAAM,+BAA+B;;;;EAI1C,CAAA;AACF,MAAM,MAAM,0BAA0B,GAAG,MAAM,CAC3C,OAAO,+BAA+B,CACzC,CAAA;AAID,eAAO,MAAM,4BAA4B,uEAGvC,CAAA;AACF,MAAM,MAAM,uBAAuB,GAAG,MAAM,CACxC,OAAO,4BAA4B,CACtC,CAAA;AAED,eAAO,MAAM,8BAA8B;;;;;;;;;;;;EAuBzC,CAAA;AACF,MAAM,MAAM,yBAAyB,GAAG,MAAM,CAC1C,OAAO,8BAA8B,CACxC,CAAA;AACD,MAAM,MAAM,gBAAgB,GAAG,yBAAyB,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAA;AAO5E,eAAO,MAAM,2BAA2B;;;;GAMvC,CAAA;AACD,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAC,OAAO,2BAA2B,CAAC,CAAA;AAI/E,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;CAqBZ,CAAA"}
|
|
@@ -150,17 +150,14 @@ export const VariableAssignmentOutputSchema = Type.Array(Type.Object({
|
|
|
150
150
|
claimMiniId: Type.String(),
|
|
151
151
|
}));
|
|
152
152
|
// -- Stage 9: relation-extraction --
|
|
153
|
-
export const RelationKindSchema = Type.Union([
|
|
154
|
-
Type.Literal("support"),
|
|
155
|
-
Type.Literal("joint-support"),
|
|
156
|
-
Type.Literal("derivation-support"),
|
|
157
|
-
]);
|
|
158
153
|
export const RelationExtractionOutputSchema = Type.Object({
|
|
159
154
|
relations: Type.Array(Type.Object({
|
|
160
155
|
relationId: Type.String(),
|
|
161
|
-
type
|
|
162
|
-
|
|
163
|
-
|
|
156
|
+
// `type` stays a discriminator so further relation kinds can
|
|
157
|
+
// be added as union members without reshaping the object.
|
|
158
|
+
type: Type.Literal("inference"),
|
|
159
|
+
antecedents: Type.Array(Type.String()),
|
|
160
|
+
consequent: Type.String(),
|
|
164
161
|
evidence: Type.Object({
|
|
165
162
|
segmentIds: Type.Array(Type.String()),
|
|
166
163
|
quote: Type.String(),
|
|
@@ -188,9 +185,7 @@ export const ConclusionSelectionOutputSchema = Type.Object({
|
|
|
188
185
|
});
|
|
189
186
|
// -- Stage 11: formula-compilation --
|
|
190
187
|
export const FormulaPremiseRoleHintSchema = Type.Union([
|
|
191
|
-
Type.Literal("
|
|
192
|
-
Type.Literal("joint-support"),
|
|
193
|
-
Type.Literal("derivation"),
|
|
188
|
+
Type.Literal("freeform"),
|
|
194
189
|
Type.Literal("conclusion"),
|
|
195
190
|
]);
|
|
196
191
|
export const FormulaCompilationOutputSchema = Type.Object({
|
|
@@ -204,6 +199,14 @@ export const FormulaCompilationOutputSchema = Type.Object({
|
|
|
204
199
|
sourceRelationId: Type.Union([Type.String(), Type.Null()]),
|
|
205
200
|
})),
|
|
206
201
|
conclusionPremiseMiniId: Type.Union([Type.String(), Type.Null()]),
|
|
202
|
+
// Citation/axiomatic backing extracted from inference antecedents:
|
|
203
|
+
// each entry records that claim `derivedClaimMiniId` is grounded by
|
|
204
|
+
// the listed citation/axiomatic supporting claims. The parser
|
|
205
|
+
// materializes these into derivation premises.
|
|
206
|
+
derivationBacking: Type.Array(Type.Object({
|
|
207
|
+
derivedClaimMiniId: Type.String(),
|
|
208
|
+
supportingClaimMiniIds: Type.Array(Type.String()),
|
|
209
|
+
})),
|
|
207
210
|
});
|
|
208
211
|
// -- Stage 7 + 12 are validation stages whose `run` return value is
|
|
209
212
|
// the same shape: an array of structured processing-failure-context
|