fix(rectification): ask reverse-inference probes at engine dasha months
Keep Vimshottari/Narayana start dates instead of truncating to year, so same-year month splits can appear on the choice card. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -729,7 +729,7 @@ function remainingQuestion(
|
||||
layer: string,
|
||||
layerLabel: string,
|
||||
): string {
|
||||
return `引擎给出的区分机会绑定 ${layerLabel}。按 Opportunity 的年份、领域和 expected_outcomes 改写成自然语言,不得发明年份、事件事实或候选映射。`;
|
||||
return `引擎给出的区分机会绑定 ${layerLabel}。按 Opportunity 的时间范围、领域和 expected_outcomes 改写成自然语言,不得发明年份、事件事实或候选映射,不得改写时间范围。`;
|
||||
}
|
||||
|
||||
function remainingOutcomes(
|
||||
|
||||
@@ -113,6 +113,8 @@ export type MethodFollowup = Readonly<{
|
||||
semantic_key?: string;
|
||||
candidate_split_hash?: string;
|
||||
probe_year?: number;
|
||||
year_label?: string;
|
||||
probe_month?: number;
|
||||
choice_kind?: "existence" | "varga_style" | "event_quality";
|
||||
candidate_ids?: readonly string[];
|
||||
expected_outcomes?: DiscriminatingEventProbe["expected_outcomes"];
|
||||
@@ -497,7 +499,13 @@ function followupOwnedProbe(
|
||||
if (styleOptions.length !== 4) return null;
|
||||
return {
|
||||
year: item.probe_year ?? 0,
|
||||
year_label: item.probe_year ? `${item.probe_year} 年前后` : "当前这几个候选",
|
||||
year_label: item.year_label
|
||||
?? (item.probe_year && item.probe_month
|
||||
? `${item.probe_year} 年 ${item.probe_month} 月前后`
|
||||
: item.probe_year
|
||||
? `${item.probe_year} 年前后`
|
||||
: "当前这几个候选"),
|
||||
...(item.probe_month ? { month: item.probe_month } : {}),
|
||||
domain: item.domain as EventProbeDomain,
|
||||
event_family: followupEventFamily(item.domain, kind),
|
||||
source: "dasha_activation",
|
||||
@@ -579,7 +587,7 @@ function agentHint(
|
||||
extra = "",
|
||||
evidence: readonly MethodFollowupEvidence[] = [],
|
||||
): string {
|
||||
return `${why}本题绑定 ${varga}。${extra}${recordedKindYearHint(evidence)}点选卡只出 A/B/C/D。用简体中文自己写一句追问;年份和事件家族以 choice_frame.period 与探针为准,不得发明年份,不得改问其他领域,不得把探针年份说成已经发生的事实。不要调用 set-focus。正文不要复述选项。`.replace(/\s+/g, " ").trim();
|
||||
return `${why}本题绑定 ${varga}。${extra}${recordedKindYearHint(evidence)}点选卡只出 A/B/C/D。用简体中文自己写一句追问;时间范围和事件家族以 choice_frame.period 与探针为准,不得发明年份,不得改写时间范围,不得改问其他领域,不得把探针时间说成已经发生的事实。不要调用 set-focus。正文不要复述选项。`.replace(/\s+/g, " ").trim();
|
||||
}
|
||||
|
||||
export function shouldAttachChoiceFrame(
|
||||
@@ -995,6 +1003,8 @@ export function buildMethodFollowupPlan(input: {
|
||||
semantic_key: liveProbe.semantic_key,
|
||||
candidate_split_hash: liveProbe.candidate_split_hash,
|
||||
probe_year: liveProbe.year,
|
||||
year_label: liveProbe.year_label,
|
||||
probe_month: liveProbe.month,
|
||||
choice_kind: liveProbe.choice_kind,
|
||||
candidate_ids: liveProbe.candidate_ids ?? candidateIdsFromProbe(liveProbe),
|
||||
expected_outcomes: liveProbe.expected_outcomes,
|
||||
@@ -1093,6 +1103,8 @@ export function buildMethodFollowupPlan(input: {
|
||||
semantic_key: conflictProbe.semantic_key ?? `${conflictProbe.domain}.${conflictProbe.year}`,
|
||||
candidate_split_hash: conflictProbe.candidate_split_hash,
|
||||
probe_year: conflictProbe.year,
|
||||
year_label: conflictProbe.year_label,
|
||||
probe_month: conflictProbe.month,
|
||||
choice_kind: conflictProbe.choice_kind ?? "existence",
|
||||
candidate_ids: conflictProbe.candidate_ids ?? candidateIdsFromProbe(conflictProbe),
|
||||
expected_outcomes: conflictProbe.expected_outcomes,
|
||||
|
||||
@@ -205,6 +205,7 @@ export type ProbeExpectedOutcome = Readonly<{
|
||||
export type DiscriminatingEventProbe = Readonly<{
|
||||
year: number;
|
||||
year_label: string;
|
||||
month?: number;
|
||||
domain: EventProbeDomain;
|
||||
event_family: string;
|
||||
source: EventProbeSource;
|
||||
@@ -511,6 +512,9 @@ export function parseEventProbes(
|
||||
const family = asText(row?.event_family, 80);
|
||||
const meaning = asText(row?.user_meaning, 160);
|
||||
const label = asText(row?.year_label, 40);
|
||||
const month = typeof row?.month === "number" && Number.isInteger(row.month) && row.month >= 1 && row.month <= 12
|
||||
? row.month
|
||||
: null;
|
||||
if (
|
||||
!row
|
||||
|| year === null
|
||||
@@ -536,6 +540,7 @@ export function parseEventProbes(
|
||||
const probe: DiscriminatingEventProbe = {
|
||||
year,
|
||||
year_label: label,
|
||||
...(month ? { month } : {}),
|
||||
domain: domain as EventProbeDomain,
|
||||
event_family: family,
|
||||
source: source as EventProbeSource,
|
||||
|
||||
@@ -128,6 +128,42 @@ test("choice frames ask one biographical event from a server probe, not competin
|
||||
assert.equal(mergeChoiceCard(frame, null), null);
|
||||
});
|
||||
|
||||
test("choice frames keep the engine month lock instead of collapsing to a year", () => {
|
||||
const frame = buildChoiceFrame(
|
||||
{
|
||||
method_id: "d10_career",
|
||||
ask_theme: "dated_event",
|
||||
domain: "career",
|
||||
user_prompt_hint: "unused",
|
||||
},
|
||||
{
|
||||
evidence: [{
|
||||
status: "confirmed",
|
||||
domain: "education",
|
||||
datePrecision: "year",
|
||||
occurredFrom: "2016-01-01",
|
||||
occurredTo: null,
|
||||
}],
|
||||
probes: [{
|
||||
...MOVE_PROBE,
|
||||
year: 2018,
|
||||
month: 3,
|
||||
year_label: "2018 年 3 月前后",
|
||||
domain: "career",
|
||||
event_family: "入职、升职或职责明显加重",
|
||||
source: "dasha_boundary",
|
||||
user_meaning: "时间范围锁定 2018 年 3 月前后;领域锁定 career。",
|
||||
semantic_key: "career.2018.03.dasha_boundary",
|
||||
}],
|
||||
},
|
||||
);
|
||||
assert.ok(frame);
|
||||
assert.equal(frame.period, "2018 年 3 月前后");
|
||||
assert.match(frame.prompt, /2018 年 3 月前后/);
|
||||
assert.match(frame.why, /2018 年 3 月前后/);
|
||||
assert.doesNotMatch(frame.period, /^2018 年前后$/);
|
||||
});
|
||||
|
||||
test("server-owned card names the event family, not a generic 有没有这件事", () => {
|
||||
const frame = buildChoiceFrame(
|
||||
{
|
||||
|
||||
@@ -74,6 +74,32 @@ test("receipt parser drops invalid distinguish probes and known_event_quality",
|
||||
assert.ok((parsed[0]?.information_gain ?? 0) > 0);
|
||||
});
|
||||
|
||||
test("receipt parser keeps engine month on dasha boundary probes", () => {
|
||||
const parsed = parseDiscriminatingEventProbes([{
|
||||
year: 2018,
|
||||
month: 3,
|
||||
year_label: "2018 年 3 月前后",
|
||||
domain: "career",
|
||||
event_family: "职责变化",
|
||||
source: "dasha_boundary",
|
||||
tracks: ["vimshottari", "narayana"],
|
||||
tracks_agree: true,
|
||||
unique_minute_claim: false,
|
||||
user_meaning: "时间范围锁定 2018 年 3 月前后",
|
||||
role: "distinguish",
|
||||
information_gain: 0.4,
|
||||
semantic_key: "career.2018.03.dasha_boundary",
|
||||
candidate_ids: ["05:00", "05:20"],
|
||||
expected_outcomes: [
|
||||
{ answer_class: "yes", supports: ["05:00"], conflicts: ["05:20"] },
|
||||
{ answer_class: "no", supports: ["05:20"], conflicts: ["05:00"] },
|
||||
],
|
||||
}]);
|
||||
assert.equal(parsed[0]?.month, 3);
|
||||
assert.equal(parsed[0]?.year_label, "2018 年 3 月前后");
|
||||
assert.equal(parsed[0]?.source, "dasha_boundary");
|
||||
});
|
||||
|
||||
test("randomized hidden mutated answers change posterior only when mapped", () => {
|
||||
const probe = probeFromEngine({
|
||||
year: 2018,
|
||||
|
||||
@@ -358,6 +358,30 @@ test("dasha conflict probe jumps after four scoreable events leave three trainin
|
||||
}), "collect_evidence");
|
||||
});
|
||||
|
||||
test("dasha conflict probe keeps the engine month on the choice card", () => {
|
||||
const plan = buildMethodFollowupPlan({
|
||||
evidence: [
|
||||
datedEvidence("education", "2016"),
|
||||
datedEvidence("education", "2020"),
|
||||
datedEvidence("relationship", "2018"),
|
||||
datedEvidence("family", "2023"),
|
||||
],
|
||||
eventProbes: [{
|
||||
...CAREER_CONFLICT_PROBE,
|
||||
month: 3,
|
||||
year_label: "2018 年 3 月前后",
|
||||
source: "dasha_boundary",
|
||||
user_meaning: "时间范围锁定 2018 年 3 月前后;领域锁定 career。",
|
||||
semantic_key: "career.2018.03.dasha_boundary",
|
||||
}],
|
||||
});
|
||||
assert.equal(plan.next_followup?.source, "event_probe");
|
||||
assert.equal(plan.next_followup?.choice_frame?.period, "2018 年 3 月前后");
|
||||
assert.equal(plan.next_followup?.year_label, "2018 年 3 月前后");
|
||||
assert.equal(plan.next_followup?.probe_month, 3);
|
||||
assert.match(plan.next_followup?.user_prompt_hint ?? "", /2018 年 3 月前后/);
|
||||
});
|
||||
|
||||
test("three scoreable events in one domain still rotate methods instead of reverse-inferring", () => {
|
||||
const plan = buildMethodFollowupPlan({
|
||||
evidence: [
|
||||
|
||||
Reference in New Issue
Block a user