feat(consult): project the native technique layers with per-layer allowlists

TASK-consult-evidence-card-v2-20260927 T2. toAgentConsultationContext carries
chart.consultation_native_layers as local_layers.native_layers; toModelOutput
projects d9_summary / punarphoo / vivah_saham / day_night into the natal card
and slow_transits / double_transit / annual_tajika into the timing card, each
through its own nested-key allowlist (as BUG-1054 did for Narayana), so the
existing natal and timing key sets are not widened and the depth / list caps
are unchanged. Pada A1 (the engine's Arudha Lagna) is allowlisted for the
career card's AL.

Golden test: every projected layer equals the engine layer value for value on
3 public AA charts (family, timing and annual routes); the Double Transit
per-house summary line is the only field left out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017eEAG8HD3mm8gsKXgk8uU8
This commit is contained in:
Jesse_Chen
2026-09-27 16:31:20 +08:00
co-authored by Claude Opus 5.5
parent d5616c347e
commit 33739e3789
2 changed files with 172 additions and 0 deletions
@@ -322,6 +322,8 @@ const natalFoundationKeys = new Set([
"functionalbeneficmalefic", "functionalbenefics", "functionalmalefics", "functionalneutrals",
"yogakarakas", "ownedhouses", "ascendantsign", "effectonconfidence",
"yogas", "category", "arudhapadas", "padas", "a10", "a7", "ul", "al", "gulika", "mandi", "kakshya",
// Evidence card v2: the engine writes the Arudha Lagna (AL) as pada `A1`.
"a1",
"kpcusps", "cusps", "sublord", "star", "starlord", "claimboundary", "reason",
]);
@@ -502,6 +504,59 @@ function projectWesternSpectrum(value: unknown): ModelOutputValue | undefined {
return Object.keys(output).length ? output : undefined;
}
/*
* Evidence card v2 (TASK-consult-evidence-card-v2-20260927 T2): the native
* technique layers the engine now attaches (chart.consultation_native_layers,
* scripts/consultation_native_layers.py). Each layer has its own allowlist of
* nested keys, as BUG-1054 did for the Narayana period, so the existing natal
* and timing sets are not widened; depth and list caps are unchanged.
*/
const nativeD9SummaryKeys = new Set([
"status", "source", "lagna", "lagnavargottama", "planets", "d9sign", "d9dignity", "vargottama",
"reversals", "planet", "d1", "d9", "reversalrule",
]);
const nativePunarphooKeys = new Set([
"status", "source", "natalpresent", "orbdeg", "orblimitdeg", "samehouse", "saturnreturntonatalmoon",
"active", "claimboundary",
]);
const nativeVivahSahamKeys = new Set([
"status", "source", "longitude", "sign", "degreeinsign", "house", "natalconjuncts", "planet", "diffdeg", "boundary",
]);
const nativeDayNightKeys = new Set(["status", "source", "isday"]);
const nativeSlowTransitKeys = new Set([
"status", "source", "referencedate", "window", "start", "end", "current", "sign", "degreeinsign",
"retrograde", "natalhouse", "sav", "bav", "keydates", "kind", "date", "body", "fromsign", "tosign",
"tonatalhouse", "motion", "housesinwindow", "boundary",
]);
const nativeDoubleTransitKeys = new Set([
"status", "source", "date", "activehouses", "conclusions", "house", "layer", "target", "strength",
"jupiterpac", "saturnpac", "conclusioncount", "karakatargets", "dk", "ul", "doubletransit", "method", "boundary",
]);
const nativeAnnualKeys = new Set([
"status", "reason", "source", "targetyear", "age", "varshayear", "start", "end", "annuallagna", "varshesha",
"muntha", "sign", "lord", "houseinannualchart", "houseinnatalchart", "muddadasha", "months",
"tajikaaspects", "name", "planets", "aspect", "motion", "tajikaaspectsstatus", "producers",
"solarreturn", "annualchart", "yearlord", "tajikayogas", "boundary",
]);
function nativeLayer(context: ReturnType<typeof toAgentConsultationContext>, name: string) {
return record(record(context.local_layers.native_layers)[name]);
}
function projectNativeLayers(
context: ReturnType<typeof toAgentConsultationContext>,
layers: ReadonlyArray<readonly [string, ReadonlySet<string>]>,
) {
const output: { [key: string]: ModelOutputValue } = {};
for (const [name, keys] of layers) {
const layer = nativeLayer(context, name);
if (!Object.keys(layer).length) continue;
const projected = projectAllowlistedTree(layer, keys, { allowAstrologyEntityKeys: true });
if (projected !== undefined) output[name] = projected;
}
return output;
}
function projectNatalFoundation(context: ReturnType<typeof toAgentConsultationContext>) {
const foundation = projectAllowlistedTree({
ascendant: context.chart.ascendant,
@@ -519,6 +574,12 @@ function projectNatalFoundation(context: ReturnType<typeof toAgentConsultationCo
const output = record(foundation);
const varga = projectVargaSpectrum(context.local_layers.varga_spectrum);
if (varga !== undefined) output.varga_spectrum = varga;
Object.assign(output, projectNativeLayers(context, [
["d9_summary", nativeD9SummaryKeys],
["punarphoo", nativePunarphooKeys],
["vivah_saham", nativeVivahSahamKeys],
["day_night", nativeDayNightKeys],
]));
return Object.keys(output).length ? output : undefined;
}
@@ -569,6 +630,11 @@ function projectTimingEvidence(context: ReturnType<typeof toAgentConsultationCon
const output = record(timing);
const western = projectWesternSpectrum(context.evidence_contract.western_spectrum);
if (western !== undefined) output.western_spectrum = western;
Object.assign(output, projectNativeLayers(context, [
["slow_transits", nativeSlowTransitKeys],
["double_transit", nativeDoubleTransitKeys],
["annual_tajika", nativeAnnualKeys],
]));
return Object.keys(output).length ? output : undefined;
}
@@ -782,6 +848,9 @@ export function toAgentConsultationContext(data: JsonRecord) {
transits: modules.transits,
functional_benefic_malefic: modules.functional_benefic_malefic
|| record(data.machine_evidence_packet).functional_benefic_malefic,
// Evidence card v2: native technique layers (D9 summary, Punarphoo,
// Double Transit, slow transits, annual Tajika pack, lookup-only layers).
native_layers: chart.consultation_native_layers,
},
rectification: {
boundary: rectificationBoundaryFromGate(rectification),