pi-harness-runtime 1.1.462 → 1.1.463
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/CHANGELOG.md +40 -0
- package/index.ts +16 -2
- package/package.json +1 -1
- package/packages/agent-policy/package.json +1 -1
- package/packages/auth/package.json +1 -1
- package/packages/autonomous-runtime/package.json +1 -1
- package/packages/checkpoint/package.json +1 -1
- package/packages/clipboard/package.json +1 -1
- package/packages/codex-watcher/package.json +1 -1
- package/packages/config-capture/package.json +1 -1
- package/packages/contracts/package.json +1 -1
- package/packages/cookie-sanitizer/package.json +1 -1
- package/packages/evaluation-engine/package.json +1 -1
- package/packages/event-bus/package.json +1 -1
- package/packages/event-store/package.json +1 -1
- package/packages/experience-replay/package.json +1 -1
- package/packages/file-copy-helper/package.json +1 -1
- package/packages/intent-analyzer/package.json +1 -1
- package/packages/jev-judge/dist/auto-continue.d.ts.map +1 -1
- package/packages/jev-judge/dist/auto-continue.js +40 -5
- package/packages/jev-judge/dist/auto-continue.js.map +1 -1
- package/packages/jev-judge/dist/decision-context.d.ts +211 -0
- package/packages/jev-judge/dist/decision-context.d.ts.map +1 -0
- package/packages/jev-judge/dist/decision-context.js +633 -0
- package/packages/jev-judge/dist/decision-context.js.map +1 -0
- package/packages/jev-judge/dist/index.d.ts +2 -0
- package/packages/jev-judge/dist/index.d.ts.map +1 -1
- package/packages/jev-judge/dist/index.js +1 -0
- package/packages/jev-judge/dist/index.js.map +1 -1
- package/packages/jev-judge/package.json +1 -1
- package/packages/jev-judge/src/auto-continue.ts +52 -5
- package/packages/jev-judge/src/decision-context.ts +900 -0
- package/packages/jev-judge/src/index.ts +20 -0
- package/packages/knowledge-retrieval/package.json +1 -1
- package/packages/learning-engine/package.json +1 -1
- package/packages/logging/package.json +1 -1
- package/packages/memory-engine/package.json +1 -1
- package/packages/notification/dist/pending-question.d.ts +4 -2
- package/packages/notification/dist/pending-question.d.ts.map +1 -1
- package/packages/notification/dist/pending-question.js +30 -15
- package/packages/notification/dist/pending-question.js.map +1 -1
- package/packages/notification/package.json +1 -1
- package/packages/notification/src/pending-question.ts +31 -15
- package/packages/paperclip-integration/package.json +1 -1
- package/packages/performance-optimizer/package.json +1 -1
- package/packages/privilege-broker/package.json +1 -1
- package/packages/prompt-compiler/package.json +1 -1
- package/packages/providers/package.json +1 -1
- package/packages/qdrant-skills/package.json +1 -1
- package/packages/quota-manager/package.json +1 -1
- package/packages/relay/package.json +1 -1
- package/packages/skill-mcp-client/package.json +1 -1
- package/packages/skills/package.json +1 -1
- package/packages/todo-bd-sync/package.json +1 -1
- package/packages/token-estimation/package.json +1 -1
- package/packages/tooling-preference/package.json +1 -1
- package/packages/trajectory/package.json +1 -1
- package/packages/tui/package.json +1 -1
- package/packages/two-phase-review/package.json +1 -1
- package/packages/types/package.json +1 -1
- package/packages/webmcp-tester/package.json +1 -1
- package/packages/wiki/package.json +1 -1
- package/packages/write-review/package.json +1 -1
|
@@ -0,0 +1,633 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The decision context of a choice question.
|
|
3
|
+
*
|
|
4
|
+
* A choice is only decidable when the evaluation sees what the alternatives
|
|
5
|
+
* MEAN. The detection layer extracts short labels ("implement A", "A+B"), and
|
|
6
|
+
* a label alone does not carry the meaning, the caveats or the boundaries of
|
|
7
|
+
* an option. This module is the single place where the runtime turns the
|
|
8
|
+
* source message into the facts of a decision.
|
|
9
|
+
*
|
|
10
|
+
* The rules of the module:
|
|
11
|
+
*
|
|
12
|
+
* - Structured facts supplied by the agent win over extracted ones.
|
|
13
|
+
* - Extracted text is verbatim: negation, dependencies and caveats are kept
|
|
14
|
+
* as they were written, never paraphrased into something weaker.
|
|
15
|
+
* - Nothing here decides: the module never selects an option and never
|
|
16
|
+
* invents an approval. Missing information is surfaced as an uncertainty
|
|
17
|
+
* so that a wait outcome stays possible.
|
|
18
|
+
* - Every bound is declared and every cut is reported, so a reader can tell
|
|
19
|
+
* what the evaluation did not see.
|
|
20
|
+
*/
|
|
21
|
+
/** How many options reach the evaluation. */
|
|
22
|
+
export const MAX_CHOICE_OPTIONS = 10;
|
|
23
|
+
/** How much of the problem statement reaches the evaluation. */
|
|
24
|
+
export const MAX_PROBLEM_CHARS = 600;
|
|
25
|
+
/** How much of the question reaches the evaluation. */
|
|
26
|
+
export const MAX_CHOICE_QUESTION_CHARS = 600;
|
|
27
|
+
/** How much of one option description reaches the evaluation. */
|
|
28
|
+
export const MAX_OPTION_DESCRIPTION_CHARS = 600;
|
|
29
|
+
/** How many tradeoffs or constraints per option reach the evaluation. */
|
|
30
|
+
export const MAX_OPTION_FACTS = 6;
|
|
31
|
+
/** How much of one fact (a tradeoff, a constraint) reaches the evaluation. */
|
|
32
|
+
export const MAX_OPTION_FACT_CHARS = 400;
|
|
33
|
+
/** How much of the rendered excerpt reaches the evaluation. */
|
|
34
|
+
export const MAX_CHOICE_EXCERPT_CHARS = 2000;
|
|
35
|
+
/** How much of one criterion reaches the evaluation. */
|
|
36
|
+
export const MAX_OPTION_CRITERION_CHARS = 400;
|
|
37
|
+
/**
|
|
38
|
+
* How far into a paragraph a name of an option is looked for.
|
|
39
|
+
*
|
|
40
|
+
* A paragraph that names an option in its first line talks about that
|
|
41
|
+
* option; a paragraph that names it much later talks about something else.
|
|
42
|
+
*/
|
|
43
|
+
export const MENTION_WINDOW_CHARS = 80;
|
|
44
|
+
/**
|
|
45
|
+
* Normalize a label for a comparison: case and spacing do not change what a
|
|
46
|
+
* label means, but a different label is a different option.
|
|
47
|
+
*/
|
|
48
|
+
function normalizeLabel(label) {
|
|
49
|
+
return label.trim().toLowerCase().replace(/\s+/g, " ");
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* The primary tokens of a label: the short uppercase ones.
|
|
53
|
+
*
|
|
54
|
+
* "implement A" has the primary "A", "A+B" has the primary "A+B".
|
|
55
|
+
*/
|
|
56
|
+
export function derivePrimaryAnchors(label) {
|
|
57
|
+
const tokens = label
|
|
58
|
+
.split(/\s+/)
|
|
59
|
+
.map((token) => token.replace(/^[^\w+]+/, "").replace(/[^\w+]+$/, ""))
|
|
60
|
+
.filter((token) => token.length > 0);
|
|
61
|
+
if (tokens.length === 0)
|
|
62
|
+
return [];
|
|
63
|
+
const upper = tokens.filter((token) => /^[A-Z0-9+]{1,6}$/.test(token) &&
|
|
64
|
+
/[A-Z0-9]/.test(token) &&
|
|
65
|
+
token !== token.toLowerCase());
|
|
66
|
+
if (upper.length === 0) {
|
|
67
|
+
return [tokens[tokens.length - 1]];
|
|
68
|
+
}
|
|
69
|
+
return upper;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* The primary anchor of an option: the token that names it.
|
|
73
|
+
*/
|
|
74
|
+
export function deriveOptionAnchor(label) {
|
|
75
|
+
return derivePrimaryAnchors(label)[0] ?? "";
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The tokens that can name an option in the source message.
|
|
79
|
+
*
|
|
80
|
+
* A combination like "A+B" also names its parts, because the message writes
|
|
81
|
+
* the second part as its own header ("**B. ...**").
|
|
82
|
+
*/
|
|
83
|
+
export function deriveOptionAnchors(label) {
|
|
84
|
+
const anchors = [];
|
|
85
|
+
for (const token of derivePrimaryAnchors(label)) {
|
|
86
|
+
if (!anchors.includes(token))
|
|
87
|
+
anchors.push(token);
|
|
88
|
+
for (const part of token.split("+")) {
|
|
89
|
+
if (part.length > 0 && !anchors.includes(part))
|
|
90
|
+
anchors.push(part);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return anchors;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* The tokens that name an option in prose.
|
|
97
|
+
*
|
|
98
|
+
* A part of a combination is dropped when it is the primary token of
|
|
99
|
+
* another option: in "implement A" against "A+B", the "A" belongs to the
|
|
100
|
+
* first option, and the second option is named by "A+B" and "B".
|
|
101
|
+
*
|
|
102
|
+
* A token that does not look like an identifier ("so" in "make it so") never
|
|
103
|
+
* becomes a mention anchor: a common word would make every paragraph that
|
|
104
|
+
* contains it a fact of the option.
|
|
105
|
+
*/
|
|
106
|
+
function deriveMentionAnchors(primaries, otherPrimaries) {
|
|
107
|
+
const anchors = [];
|
|
108
|
+
for (const token of primaries) {
|
|
109
|
+
if (!isIdentifierToken(token))
|
|
110
|
+
continue;
|
|
111
|
+
if (!anchors.includes(token))
|
|
112
|
+
anchors.push(token);
|
|
113
|
+
for (const part of token.split("+")) {
|
|
114
|
+
if (part.length === 0)
|
|
115
|
+
continue;
|
|
116
|
+
if (!isIdentifierToken(part))
|
|
117
|
+
continue;
|
|
118
|
+
if (otherPrimaries.includes(part))
|
|
119
|
+
continue;
|
|
120
|
+
if (!anchors.includes(part))
|
|
121
|
+
anchors.push(part);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return anchors;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Whether a token names something: it carries a capital letter or a digit.
|
|
128
|
+
*/
|
|
129
|
+
function isIdentifierToken(token) {
|
|
130
|
+
return /[A-Z0-9]/.test(token) && token !== token.toLowerCase();
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Split the source message into paragraphs.
|
|
134
|
+
*
|
|
135
|
+
* A paragraph is a block of text separated by an empty line. The position of
|
|
136
|
+
* every paragraph is kept, so a fact can be pointed at.
|
|
137
|
+
*/
|
|
138
|
+
function splitParagraphs(source) {
|
|
139
|
+
const paragraphs = [];
|
|
140
|
+
const pattern = /\S[\s\S]*?(?=\n\s*\n|$)/g;
|
|
141
|
+
let match;
|
|
142
|
+
while ((match = pattern.exec(source)) !== null) {
|
|
143
|
+
const text = match[0].trim();
|
|
144
|
+
if (text.length > 0) {
|
|
145
|
+
paragraphs.push({ text, start: match.index });
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return paragraphs;
|
|
149
|
+
}
|
|
150
|
+
/** The characters that end the anchor of an option header. */
|
|
151
|
+
const HEADER_SEPARATORS = [".", ":", ")", "-", "–", "—"];
|
|
152
|
+
function isWordCharacter(character) {
|
|
153
|
+
return /[A-Za-z0-9]/.test(character);
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Whether a line is the header of an option: the line starts with the
|
|
157
|
+
* anchor, followed by a separator.
|
|
158
|
+
*
|
|
159
|
+
* The anchor comes from the text of the agent, so the check is a string
|
|
160
|
+
* comparison and never a pattern built from that text.
|
|
161
|
+
*/
|
|
162
|
+
function isOptionHeader(line, anchor) {
|
|
163
|
+
if (anchor.length === 0)
|
|
164
|
+
return false;
|
|
165
|
+
const stripped = line.replace(/^\s*(?:[-*+]\s+)?(?:\*\*|__)?\s*/, "");
|
|
166
|
+
if (!stripped.startsWith(anchor))
|
|
167
|
+
return false;
|
|
168
|
+
const next = stripped.charAt(anchor.length);
|
|
169
|
+
if (next === "")
|
|
170
|
+
return true;
|
|
171
|
+
if (isWordCharacter(next))
|
|
172
|
+
return false;
|
|
173
|
+
return HEADER_SEPARATORS.includes(next);
|
|
174
|
+
}
|
|
175
|
+
/** Whether a line mentions the anchor as a word. */
|
|
176
|
+
function mentionsAnchor(line, anchor) {
|
|
177
|
+
if (anchor.length === 0)
|
|
178
|
+
return false;
|
|
179
|
+
let from = 0;
|
|
180
|
+
for (;;) {
|
|
181
|
+
const index = line.indexOf(anchor, from);
|
|
182
|
+
if (index === -1)
|
|
183
|
+
return false;
|
|
184
|
+
const before = index > 0 ? line.charAt(index - 1) : "";
|
|
185
|
+
const after = line.charAt(index + anchor.length);
|
|
186
|
+
if ((before === "" || !isWordCharacter(before)) &&
|
|
187
|
+
(after === "" || !isWordCharacter(after))) {
|
|
188
|
+
return true;
|
|
189
|
+
}
|
|
190
|
+
from = index + 1;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
/** Strip the markdown markers of a heading or a bold label. */
|
|
194
|
+
function stripMarkdown(value) {
|
|
195
|
+
return value
|
|
196
|
+
.replace(/^\s*(?:[-*+]\s+)+/, "")
|
|
197
|
+
.replace(/(\*\*|__|`)/g, "")
|
|
198
|
+
.trim();
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Remove the anchor of an option from the beginning of its description, so
|
|
202
|
+
* the description starts with the meaning and not with the label.
|
|
203
|
+
*/
|
|
204
|
+
function stripLeadingAnchor(text, anchor) {
|
|
205
|
+
const stripped = text.replace(/^\s*(?:\*\*|__)?\s*/, "");
|
|
206
|
+
if (anchor.length === 0 || !stripped.startsWith(anchor))
|
|
207
|
+
return stripped;
|
|
208
|
+
const next = stripped.charAt(anchor.length);
|
|
209
|
+
if (next !== "" && isWordCharacter(next))
|
|
210
|
+
return stripped;
|
|
211
|
+
return stripped.slice(anchor.length).replace(/^[.:)\-–—\s]+/, "").trim();
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* A paragraph states a restriction when it names a duty, a prohibition or a
|
|
215
|
+
* condition. The markers are conservative: a paragraph that is not
|
|
216
|
+
* recognized is a consequence, not a restriction.
|
|
217
|
+
*/
|
|
218
|
+
function statesConstraint(paragraph) {
|
|
219
|
+
return (/^\s*(caveat|caveats?|careful|note|warning|constraint|constraints?|however|but|instead|only if|never|must|do not|don't|cannot|can't)\b/i.test(paragraph) ||
|
|
220
|
+
/\b(must|never|cannot|can not|only if|is required to|has to|not just)\b/i.test(paragraph));
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Whether a text mentions an anchor as a word.
|
|
224
|
+
*/
|
|
225
|
+
function mentionsAny(text, anchors) {
|
|
226
|
+
return anchors.some((anchor) => mentionsAnchor(text, anchor));
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Whether a paragraph is a fact of one option.
|
|
230
|
+
*
|
|
231
|
+
* The paragraph has to name the option near its beginning, and it must not
|
|
232
|
+
* name another option there: a paragraph about two options says something
|
|
233
|
+
* about both, and it belongs to neither of them alone.
|
|
234
|
+
*/
|
|
235
|
+
function belongsToOption(text, ownAnchors, otherAnchors) {
|
|
236
|
+
const window = text.slice(0, MENTION_WINDOW_CHARS);
|
|
237
|
+
if (!mentionsAny(window, ownAnchors))
|
|
238
|
+
return false;
|
|
239
|
+
return !mentionsAny(window, otherAnchors);
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* The line of the header of an option.
|
|
243
|
+
*
|
|
244
|
+
* The candidates are tried in order, and a header that another option
|
|
245
|
+
* already claims is skipped: the label "A+B" must not land on the header of
|
|
246
|
+
* the option "A".
|
|
247
|
+
*/
|
|
248
|
+
function locateHeader(lines, candidates, claimed) {
|
|
249
|
+
for (const candidate of candidates) {
|
|
250
|
+
for (let index = 0; index < lines.length; index += 1) {
|
|
251
|
+
if (claimed.has(index))
|
|
252
|
+
continue;
|
|
253
|
+
if (isOptionHeader(lines[index], candidate))
|
|
254
|
+
return index;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
return -1;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Extract the facts of one option from the source message.
|
|
261
|
+
*
|
|
262
|
+
* The extraction is anchored on the option header, not on the beginning of
|
|
263
|
+
* the message: a decisive caveat that stands behind the two thousandth
|
|
264
|
+
* character of the message is as much a part of the option as the sentence
|
|
265
|
+
* in front of it.
|
|
266
|
+
*
|
|
267
|
+
* A paragraph belongs to an option when it names that option and no other.
|
|
268
|
+
* A paragraph that names two options says something about both, and it is
|
|
269
|
+
* left out instead of being filed under one of them.
|
|
270
|
+
*/
|
|
271
|
+
export function extractOptionFacts(input) {
|
|
272
|
+
const { source, headerCandidates, mentionAnchors, otherHeaderCandidates, otherMentionAnchors, claimed, question, } = input;
|
|
273
|
+
const empty = {
|
|
274
|
+
description: "",
|
|
275
|
+
tradeoffs: [],
|
|
276
|
+
constraints: [],
|
|
277
|
+
found: false,
|
|
278
|
+
headerIndex: -1,
|
|
279
|
+
};
|
|
280
|
+
if (headerCandidates.length === 0 || source.length === 0)
|
|
281
|
+
return empty;
|
|
282
|
+
const lines = source.split("\n");
|
|
283
|
+
const headerIndex = locateHeader(lines, headerCandidates, claimed);
|
|
284
|
+
const paragraphs = splitParagraphs(source);
|
|
285
|
+
let description = "";
|
|
286
|
+
let region = [];
|
|
287
|
+
if (headerIndex >= 0) {
|
|
288
|
+
// The region of the option ends at the next option header, at the
|
|
289
|
+
// next heading of the message, or at the question itself.
|
|
290
|
+
const regionLines = [];
|
|
291
|
+
const questionMarker = question.trim().slice(0, 40);
|
|
292
|
+
for (let index = headerIndex; index < lines.length; index += 1) {
|
|
293
|
+
const line = lines[index];
|
|
294
|
+
if (index > headerIndex) {
|
|
295
|
+
if (/^\s*#{1,6}\s/.test(line))
|
|
296
|
+
break;
|
|
297
|
+
if (questionMarker.length > 0 && line.includes(questionMarker))
|
|
298
|
+
break;
|
|
299
|
+
if (otherHeaderCandidates.some((other) => isOptionHeader(line, other))) {
|
|
300
|
+
break;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
regionLines.push(line);
|
|
304
|
+
}
|
|
305
|
+
region = splitParagraphs(regionLines.join("\n"));
|
|
306
|
+
if (region.length > 0) {
|
|
307
|
+
const anchor = headerCandidates.find((candidate) => isOptionHeader(lines[headerIndex], candidate)) ?? headerCandidates[0];
|
|
308
|
+
description = stripMarkdown(stripLeadingAnchor(region[0].text, anchor));
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
else {
|
|
312
|
+
// No header: the first paragraph that names the option and no other
|
|
313
|
+
// one carries its meaning.
|
|
314
|
+
const own = region;
|
|
315
|
+
const candidate = paragraphs.find((paragraph) => belongsToOption(paragraph.text, mentionAnchors, otherMentionAnchors));
|
|
316
|
+
if (candidate) {
|
|
317
|
+
const anchor = mentionAnchors.find((token) => mentionsAnchor(candidate.text.slice(0, MENTION_WINDOW_CHARS), token)) ?? mentionAnchors[0];
|
|
318
|
+
description = stripMarkdown(stripLeadingAnchor(candidate.text, anchor));
|
|
319
|
+
region = own;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
const tradeoffs = [];
|
|
323
|
+
const constraints = [];
|
|
324
|
+
const addFact = (text) => {
|
|
325
|
+
const value = stripMarkdown(text);
|
|
326
|
+
if (value.length === 0)
|
|
327
|
+
return;
|
|
328
|
+
if (!belongsToOption(value, mentionAnchors, otherMentionAnchors))
|
|
329
|
+
return;
|
|
330
|
+
if (statesConstraint(value)) {
|
|
331
|
+
if (!constraints.includes(value))
|
|
332
|
+
constraints.push(value);
|
|
333
|
+
}
|
|
334
|
+
else if (!tradeoffs.includes(value)) {
|
|
335
|
+
tradeoffs.push(value);
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
// The paragraphs of the region after the description.
|
|
339
|
+
for (const paragraph of region.slice(1)) {
|
|
340
|
+
addFact(paragraph.text);
|
|
341
|
+
}
|
|
342
|
+
// A caveat that names the option belongs to the option, even when it
|
|
343
|
+
// stands outside the region: "Caveat for B: ..." is about B.
|
|
344
|
+
const regionStart = region[0]?.start ?? Number.MAX_SAFE_INTEGER;
|
|
345
|
+
for (const paragraph of paragraphs) {
|
|
346
|
+
if (paragraph.start <= regionStart)
|
|
347
|
+
continue;
|
|
348
|
+
addFact(paragraph.text);
|
|
349
|
+
}
|
|
350
|
+
return {
|
|
351
|
+
description,
|
|
352
|
+
tradeoffs,
|
|
353
|
+
constraints,
|
|
354
|
+
found: description.length > 0,
|
|
355
|
+
headerIndex,
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* The paragraph of the source message that stands directly before the
|
|
360
|
+
* question: it states the problem the question is about.
|
|
361
|
+
*/
|
|
362
|
+
function extractProblem(source, question) {
|
|
363
|
+
if (source.length === 0)
|
|
364
|
+
return "";
|
|
365
|
+
const questionIndex = question.length > 0 ? source.indexOf(question) : -1;
|
|
366
|
+
if (questionIndex > 0) {
|
|
367
|
+
const before = source.slice(0, questionIndex);
|
|
368
|
+
const paragraphs = splitParagraphs(before);
|
|
369
|
+
const last = paragraphs[paragraphs.length - 1];
|
|
370
|
+
if (last)
|
|
371
|
+
return stripMarkdown(last.text);
|
|
372
|
+
}
|
|
373
|
+
const paragraphs = splitParagraphs(source);
|
|
374
|
+
const first = paragraphs[0];
|
|
375
|
+
return first ? stripMarkdown(first.text) : "";
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* Build the decision context of a choice question.
|
|
379
|
+
*
|
|
380
|
+
* The function never decides and never authorizes: it prepares the facts
|
|
381
|
+
* that a decision is made of, and it names what it could not establish.
|
|
382
|
+
*/
|
|
383
|
+
export function buildChoiceDecisionContext(input) {
|
|
384
|
+
const omitted = [];
|
|
385
|
+
const uncertainties = [];
|
|
386
|
+
const structured = input.structured ?? {};
|
|
387
|
+
const structuredOptions = Array.isArray(structured.options)
|
|
388
|
+
? structured.options
|
|
389
|
+
: [];
|
|
390
|
+
// The question itself.
|
|
391
|
+
let question = input.question.trim();
|
|
392
|
+
if (question.length > MAX_CHOICE_QUESTION_CHARS) {
|
|
393
|
+
question = question.slice(0, MAX_CHOICE_QUESTION_CHARS);
|
|
394
|
+
omitted.push(`the question was cut at ${MAX_CHOICE_QUESTION_CHARS} characters`);
|
|
395
|
+
}
|
|
396
|
+
// The alternatives, with their stable ids.
|
|
397
|
+
const allAlternatives = input.alternatives.filter((alternative) => alternative.trim().length > 0);
|
|
398
|
+
const alternatives = allAlternatives.slice(0, MAX_CHOICE_OPTIONS);
|
|
399
|
+
if (allAlternatives.length > alternatives.length) {
|
|
400
|
+
omitted.push(`${allAlternatives.length - alternatives.length} alternative(s) beyond the limit of ${MAX_CHOICE_OPTIONS} did not reach the evaluation`);
|
|
401
|
+
}
|
|
402
|
+
const source = input.contextText ?? "";
|
|
403
|
+
const primarySets = alternatives.map((alternative) => derivePrimaryAnchors(alternative));
|
|
404
|
+
const headerSets = alternatives.map((alternative) => deriveOptionAnchors(alternative));
|
|
405
|
+
// The mention anchors of every option: a part of a combination belongs
|
|
406
|
+
// to the option that names it and to no other.
|
|
407
|
+
const mentionSets = primarySets.map((primaries) => deriveMentionAnchors(primaries, primarySets
|
|
408
|
+
.flat()
|
|
409
|
+
.filter((token) => !primaries.includes(token))));
|
|
410
|
+
const structuredByLabel = new Map();
|
|
411
|
+
for (const option of structuredOptions) {
|
|
412
|
+
if (typeof option?.label !== "string")
|
|
413
|
+
continue;
|
|
414
|
+
structuredByLabel.set(normalizeLabel(option.label), option);
|
|
415
|
+
}
|
|
416
|
+
const options = [];
|
|
417
|
+
const claimed = new Set();
|
|
418
|
+
let derivedFromStructured = 0;
|
|
419
|
+
let derivedFromMessage = 0;
|
|
420
|
+
let missingMeaning = false;
|
|
421
|
+
const readFacts = (values, fallback) => {
|
|
422
|
+
const list = Array.isArray(values)
|
|
423
|
+
? values.filter((value) => typeof value === "string" && value.trim().length > 0)
|
|
424
|
+
: fallback;
|
|
425
|
+
const facts = list.slice(0, MAX_OPTION_FACTS).map((fact) => {
|
|
426
|
+
const trimmed = fact.trim();
|
|
427
|
+
return trimmed.length > MAX_OPTION_FACT_CHARS
|
|
428
|
+
? trimmed.slice(0, MAX_OPTION_FACT_CHARS)
|
|
429
|
+
: trimmed;
|
|
430
|
+
});
|
|
431
|
+
return { facts, cut: list.length > MAX_OPTION_FACTS };
|
|
432
|
+
};
|
|
433
|
+
for (const [index, alternative] of alternatives.entries()) {
|
|
434
|
+
const id = `option_${index + 1}`;
|
|
435
|
+
const label = alternative.trim();
|
|
436
|
+
const headerCandidates = headerSets[index] ?? [];
|
|
437
|
+
const mentionAnchors = mentionSets[index] ?? [];
|
|
438
|
+
const otherHeaderCandidates = headerSets
|
|
439
|
+
.flat()
|
|
440
|
+
.filter((candidate) => !headerCandidates.includes(candidate));
|
|
441
|
+
const otherMentionAnchors = mentionSets
|
|
442
|
+
.flat()
|
|
443
|
+
.filter((anchor) => !mentionAnchors.includes(anchor));
|
|
444
|
+
// A labelled fact belongs to its label. The positional fallback is
|
|
445
|
+
// only for a supplied option that carries no label at all.
|
|
446
|
+
const labelled = structuredByLabel.get(normalizeLabel(label));
|
|
447
|
+
const unlabelled = structuredOptions.length === alternatives.length
|
|
448
|
+
? structuredOptions[index]
|
|
449
|
+
: undefined;
|
|
450
|
+
const supplied = labelled ??
|
|
451
|
+
(unlabelled && typeof unlabelled.label !== "string"
|
|
452
|
+
? unlabelled
|
|
453
|
+
: undefined);
|
|
454
|
+
const suppliedDescription = supplied && typeof supplied.description === "string"
|
|
455
|
+
? supplied.description.trim()
|
|
456
|
+
: "";
|
|
457
|
+
if (supplied && supplied.description !== undefined && !suppliedDescription) {
|
|
458
|
+
uncertainties.push(`${id} (${label}): the supplied description is empty or malformed, the message was used instead`);
|
|
459
|
+
}
|
|
460
|
+
const extracted = suppliedDescription.length > 0
|
|
461
|
+
? null
|
|
462
|
+
: extractOptionFacts({
|
|
463
|
+
source,
|
|
464
|
+
headerCandidates,
|
|
465
|
+
mentionAnchors,
|
|
466
|
+
otherHeaderCandidates,
|
|
467
|
+
otherMentionAnchors,
|
|
468
|
+
claimed,
|
|
469
|
+
question: input.question,
|
|
470
|
+
});
|
|
471
|
+
if (extracted && extracted.headerIndex >= 0) {
|
|
472
|
+
claimed.add(extracted.headerIndex);
|
|
473
|
+
}
|
|
474
|
+
let description = suppliedDescription.length > 0
|
|
475
|
+
? suppliedDescription
|
|
476
|
+
: (extracted?.description ?? "");
|
|
477
|
+
if (description.length > MAX_OPTION_DESCRIPTION_CHARS) {
|
|
478
|
+
description = description.slice(0, MAX_OPTION_DESCRIPTION_CHARS);
|
|
479
|
+
omitted.push(`${id} (${label}): the description was cut at ${MAX_OPTION_DESCRIPTION_CHARS} characters`);
|
|
480
|
+
}
|
|
481
|
+
const tradeoffsResult = readFacts(supplied?.tradeoffs, extracted?.tradeoffs ?? []);
|
|
482
|
+
const constraintsResult = readFacts(supplied?.constraints, extracted?.constraints ?? []);
|
|
483
|
+
if (tradeoffsResult.cut || constraintsResult.cut) {
|
|
484
|
+
omitted.push(`${id} (${label}): facts beyond the limit of ${MAX_OPTION_FACTS} did not reach the evaluation`);
|
|
485
|
+
}
|
|
486
|
+
if (tradeoffsResult.facts.some((fact) => fact.length === MAX_OPTION_FACT_CHARS) ||
|
|
487
|
+
constraintsResult.facts.some((fact) => fact.length === MAX_OPTION_FACT_CHARS)) {
|
|
488
|
+
omitted.push(`${id} (${label}): a fact was cut at ${MAX_OPTION_FACT_CHARS} characters`);
|
|
489
|
+
}
|
|
490
|
+
if (suppliedDescription.length > 0) {
|
|
491
|
+
derivedFromStructured += 1;
|
|
492
|
+
}
|
|
493
|
+
else if (extracted?.found) {
|
|
494
|
+
derivedFromMessage += 1;
|
|
495
|
+
}
|
|
496
|
+
else {
|
|
497
|
+
missingMeaning = true;
|
|
498
|
+
uncertainties.push(`${id} (${label}): the source does not state what this option means`);
|
|
499
|
+
}
|
|
500
|
+
options.push({
|
|
501
|
+
id: supplied?.id && typeof supplied.id === "string" && supplied.id.trim().length > 0
|
|
502
|
+
? supplied.id
|
|
503
|
+
: id,
|
|
504
|
+
label,
|
|
505
|
+
description,
|
|
506
|
+
tradeoffs: tradeoffsResult.facts,
|
|
507
|
+
constraints: constraintsResult.facts,
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
// The problem.
|
|
511
|
+
let problem = typeof structured.problem === "string" ? structured.problem.trim() : "";
|
|
512
|
+
if (problem.length === 0) {
|
|
513
|
+
problem = extractProblem(source, input.question);
|
|
514
|
+
}
|
|
515
|
+
if (problem.length > MAX_PROBLEM_CHARS) {
|
|
516
|
+
problem = problem.slice(0, MAX_PROBLEM_CHARS);
|
|
517
|
+
omitted.push(`the problem was cut at ${MAX_PROBLEM_CHARS} characters`);
|
|
518
|
+
}
|
|
519
|
+
if (problem.length === 0) {
|
|
520
|
+
uncertainties.push("the source does not state the problem the choice is about");
|
|
521
|
+
}
|
|
522
|
+
// The authorization. Only supplied facts establish an authorization:
|
|
523
|
+
// the message of the agent is not a human answer.
|
|
524
|
+
const approved = Array.isArray(structured.authorization?.approved)
|
|
525
|
+
? structured.authorization.approved.filter((value) => typeof value === "string")
|
|
526
|
+
: [];
|
|
527
|
+
const notEstablished = Array.isArray(structured.authorization?.notEstablished)
|
|
528
|
+
? structured.authorization.notEstablished.filter((value) => typeof value === "string")
|
|
529
|
+
: [];
|
|
530
|
+
if (!structured.authorization) {
|
|
531
|
+
notEstablished.push("no human selection between the alternatives is recorded in this evaluation input");
|
|
532
|
+
if (/\bapproved\b/i.test(source)) {
|
|
533
|
+
notEstablished.push("the source reports an approval of an earlier action; it does not establish a selection between the alternatives");
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
// The uncertainties the agent reported itself.
|
|
537
|
+
if (Array.isArray(structured.uncertainties)) {
|
|
538
|
+
for (const uncertainty of structured.uncertainties) {
|
|
539
|
+
if (typeof uncertainty === "string" && uncertainty.trim().length > 0) {
|
|
540
|
+
uncertainties.push(uncertainty.trim());
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
// The earlier turns of the conversation. Their absence stays visible.
|
|
545
|
+
if (input.history && input.history.available === true) {
|
|
546
|
+
if (input.history.note) {
|
|
547
|
+
omitted.push(input.history.note);
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
else {
|
|
551
|
+
const note = input.history?.note ??
|
|
552
|
+
"the earlier turns of the conversation were not supplied";
|
|
553
|
+
uncertainties.push(note);
|
|
554
|
+
omitted.push(note);
|
|
555
|
+
}
|
|
556
|
+
const derived = derivedFromStructured > 0 && derivedFromMessage > 0
|
|
557
|
+
? "mixed"
|
|
558
|
+
: derivedFromStructured > 0
|
|
559
|
+
? "structured"
|
|
560
|
+
: "extracted";
|
|
561
|
+
return {
|
|
562
|
+
problem,
|
|
563
|
+
question,
|
|
564
|
+
options,
|
|
565
|
+
authorization: { approved, notEstablished },
|
|
566
|
+
uncertainties,
|
|
567
|
+
source: {
|
|
568
|
+
originalChars: source.length,
|
|
569
|
+
truncated: omitted.length > 0,
|
|
570
|
+
omittedInformation: omitted,
|
|
571
|
+
derived,
|
|
572
|
+
complete: !missingMeaning,
|
|
573
|
+
},
|
|
574
|
+
};
|
|
575
|
+
}
|
|
576
|
+
/**
|
|
577
|
+
* The criterion text of one option: the label, the meaning and the
|
|
578
|
+
* constraints that restrict it.
|
|
579
|
+
*
|
|
580
|
+
* The label alone does not tell the evaluation what the option does, so the
|
|
581
|
+
* meaning travels with it. The constraint is part of the criterion because
|
|
582
|
+
* an option whose restriction is invisible is an option the evaluation
|
|
583
|
+
* cannot judge correctly.
|
|
584
|
+
*/
|
|
585
|
+
export function describeChoiceOption(id, label, description, constraints) {
|
|
586
|
+
const meaning = description.length > 0
|
|
587
|
+
? description
|
|
588
|
+
: "the source does not state what this option means";
|
|
589
|
+
const parts = [`${id} (${label}): ${meaning}`];
|
|
590
|
+
if (constraints.length > 0) {
|
|
591
|
+
parts.push(`constraints: ${constraints.join(" ")}`);
|
|
592
|
+
}
|
|
593
|
+
return parts.join(" - ").slice(0, MAX_OPTION_CRITERION_CHARS);
|
|
594
|
+
}
|
|
595
|
+
/**
|
|
596
|
+
* The bounded text of a choice that reaches the evaluation.
|
|
597
|
+
*
|
|
598
|
+
* The excerpt carries the facts, not the beginning of the message: the
|
|
599
|
+
* relevant sentence of a long message stands behind the two thousandth
|
|
600
|
+
* character far more often than the first one does.
|
|
601
|
+
*/
|
|
602
|
+
export function renderChoiceExcerpt(context) {
|
|
603
|
+
const lines = [];
|
|
604
|
+
lines.push(`Question: ${context.question}`);
|
|
605
|
+
for (const option of context.options) {
|
|
606
|
+
lines.push(`${option.id} (${option.label}): ${option.description || "the source does not state what this option means"}`);
|
|
607
|
+
// The constraints come first: a restriction is the fact that decides
|
|
608
|
+
// the option, and it must not be pushed out by the consequences.
|
|
609
|
+
for (const constraint of option.constraints) {
|
|
610
|
+
lines.push(` - constraint: ${constraint}`);
|
|
611
|
+
}
|
|
612
|
+
for (const tradeoff of option.tradeoffs) {
|
|
613
|
+
lines.push(` - consequence: ${tradeoff}`);
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
if (context.problem.length > 0) {
|
|
617
|
+
lines.push(`Problem: ${context.problem}`);
|
|
618
|
+
}
|
|
619
|
+
if (context.authorization.approved.length > 0) {
|
|
620
|
+
lines.push(`Authorized: ${context.authorization.approved.join("; ")}`);
|
|
621
|
+
}
|
|
622
|
+
for (const entry of context.authorization.notEstablished) {
|
|
623
|
+
lines.push(`Not authorized: ${entry}`);
|
|
624
|
+
}
|
|
625
|
+
for (const uncertainty of context.uncertainties) {
|
|
626
|
+
lines.push(`Uncertain: ${uncertainty}`);
|
|
627
|
+
}
|
|
628
|
+
if (context.source.omittedInformation.length > 0) {
|
|
629
|
+
lines.push(`Not in the evaluation input: ${context.source.omittedInformation.join("; ")}`);
|
|
630
|
+
}
|
|
631
|
+
return lines.join("\n").slice(0, MAX_CHOICE_EXCERPT_CHARS);
|
|
632
|
+
}
|
|
633
|
+
//# sourceMappingURL=decision-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decision-context.js","sourceRoot":"","sources":["../src/decision-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,6CAA6C;AAC7C,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AACrC,gEAAgE;AAChE,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAC;AACrC,uDAAuD;AACvD,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,CAAC;AAC7C,iEAAiE;AACjE,MAAM,CAAC,MAAM,4BAA4B,GAAG,GAAG,CAAC;AAChD,yEAAyE;AACzE,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAClC,8EAA8E;AAC9E,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,CAAC;AACzC,+DAA+D;AAC/D,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,CAAC;AAC7C,wDAAwD;AACxD,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAG,CAAC;AAC9C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,CAAC;AA+HvC;;;GAGG;A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C,EAAE,CAC9E,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,wBAAwB,CAAC,CAAC;AAC5D,CAAC"}
|
|
@@ -176,6 +176,8 @@ export { E2EJudge } from "./e2e-judge.js";
|
|
|
176
176
|
export { FlakyDetector } from "./flaky-detector.js";
|
|
177
177
|
export { DecisionEngine } from "./decision-engine.js";
|
|
178
178
|
export { AutoContinueJudge, createTaskState } from "./auto-continue.js";
|
|
179
|
+
export { buildChoiceDecisionContext, describeChoiceOption, deriveOptionAnchor, extractOptionFacts, renderChoiceExcerpt, MAX_CHOICE_OPTIONS, MAX_CHOICE_QUESTION_CHARS, MAX_CHOICE_EXCERPT_CHARS, MAX_OPTION_CRITERION_CHARS, MAX_OPTION_DESCRIPTION_CHARS, MAX_OPTION_FACTS, MAX_PROBLEM_CHARS, } from "./decision-context.js";
|
|
180
|
+
export type { ChoiceContextInput, ChoiceDecisionContext, ChoiceOptionFacts, StructuredChoiceFacts, } from "./decision-context.js";
|
|
179
181
|
export type { TaskState, AutoContinueDecision, AutoContinueConfig, DecisionScope, DecisionOutcome, DecisionContext, PendingQuestionContext, } from "./auto-continue.js";
|
|
180
182
|
export { buildAutonomyInstruction, AUTONOMY_INSTRUCTION_HEADER, } from "./autonomy-instruction.js";
|
|
181
183
|
export type { AutonomyInstructionInput } from "./autonomy-instruction.js";
|