Choice C/D without new evidence never changed the candidate posterior until the next dated-event rescore, and persist-v2 would cache-hit on the same evidence fingerprint. Patch the latest decision_receipt.inference_state in place so the next follow-up sees the asked split immediately. Co-authored-by: Cursor <cursoragent@cursor.com>
29 lines
1014 B
TypeScript
29 lines
1014 B
TypeScript
import { isDuplicateProbe } from "./duplicate-probes.ts";
|
|
import { HIGH_INFORMATION_GAIN, type ConflictProbe, type ProbeAnswer } from "./types.ts";
|
|
|
|
export function selectHighestGainProbe(
|
|
probes: readonly ConflictProbe[],
|
|
asked: readonly ProbeAnswer[],
|
|
options: { minGain?: number } = {},
|
|
): ConflictProbe | null {
|
|
const minGain = options.minGain ?? 0;
|
|
const ranked = [...probes]
|
|
.filter((probe) => probe.information_gain >= minGain && !isDuplicateProbe(probe, asked))
|
|
.sort((left, right) => {
|
|
if (right.information_gain !== left.information_gain) {
|
|
return right.information_gain - left.information_gain;
|
|
}
|
|
return left.semantic_key.localeCompare(right.semantic_key);
|
|
});
|
|
return ranked[0] ?? null;
|
|
}
|
|
|
|
export function remainingHighValueProbes(
|
|
probes: readonly ConflictProbe[],
|
|
asked: readonly ProbeAnswer[],
|
|
): ConflictProbe[] {
|
|
return probes.filter((probe) => (
|
|
probe.information_gain >= HIGH_INFORMATION_GAIN && !isDuplicateProbe(probe, asked)
|
|
));
|
|
}
|