dsh-metaphysics 0.46.5 → 0.50.1
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 +100 -0
- package/README.md +11 -6
- package/client.js +571 -54
- package/engine/almanac.js +7 -6
- package/engine/bazi.js +62 -0
- package/engine/classics.js +40 -3
- package/engine/crosscheck.js +29 -3
- package/engine/geju.js +49 -5
- package/engine/index.js +24 -6
- package/engine/interpret-knowledge.js +17 -8
- package/engine/interpret-plain.js +15 -2
- package/engine/interpret.js +41 -4
- package/engine/liuyao.js +100 -0
- package/package.json +2 -2
- package//345/221/275/347/220/206/346/216/222/347/233/230.html +522 -76
package/engine/interpret.js
CHANGED
|
@@ -395,6 +395,19 @@ function baziInterpret(r) {
|
|
|
395
395
|
`⑤ 落到维度:工作看喜用五行与十神权重;感情看配偶星与日支;健康看最旺与最弱的五行。五维度都只是这套推导的应用,不是另一套算法。`,
|
|
396
396
|
].join('\n'),
|
|
397
397
|
},
|
|
398
|
+
...(r.renyuan ? [(() => {
|
|
399
|
+
const ry = r.renyuan;
|
|
400
|
+
const table = ry.segments.map((s) => `${s.stem}${s.from}–${s.to}`).join(' / ');
|
|
401
|
+
const nextSeg = ry.next ? `,第 ${ry.next.from} 日起交 ${ry.next.stem}${ry.next.element}` : '';
|
|
402
|
+
const outside = ry.inHidden ? '' : ` 表里的 ${ry.active} 不在本柱藏干表中(属余气口径),两表各照原样,不互相改写。`;
|
|
403
|
+
const beyond = ry.beyond ? ' 你生在第 31 日以后,已超出 30 日表,按本气算,不硬分摊。' : '';
|
|
404
|
+
return {
|
|
405
|
+
key: 'renyuan', label: '人元司权',
|
|
406
|
+
text: `生于${ry.month}月第 ${ry.day} 日(从${ry.term ? ry.term.name : '节'}起算,节当日为第 1 日,日差按本盘所用时刻所在日计):这一日由 **${ry.active}${ry.activeElement}** 司权,第 ${ry.segment.from}–${ry.segment.to} 日属它${nextSeg}。\n`
|
|
407
|
+
+ '月令这一个月里,余气、中气、本气轮值,不是整月同一个五行当值——所以「月令是什么」,还要看生在第几日。\n'
|
|
408
|
+
+ `**口径**:本插件固定 30 日表(${table});另有 7/7/16、9/3/18 等分法,各家不一。分日只作解释层的一层细节,**不改取格**:取格仍按本气、透干与会支判定。${outside}${beyond}`,
|
|
409
|
+
};
|
|
410
|
+
})()] : []),
|
|
398
411
|
{
|
|
399
412
|
key: 'timeline', label: '时间窗',
|
|
400
413
|
text: (() => {
|
|
@@ -415,6 +428,8 @@ function baziInterpret(r) {
|
|
|
415
428
|
{ key: 'advice', label: '专业建议', text: adviceText },
|
|
416
429
|
(() => {
|
|
417
430
|
const hits = (r.liunian || []).filter((l) => l.suiyun && Array.isArray(l.suiyun.signals) && l.suiyun.signals.length);
|
|
431
|
+
const e = suiyunClassicOf(r);
|
|
432
|
+
const src = e ? `\n原文:《${CLASSIC_BOOKS[e.book].name}·${e.chapter}》「${e.quote}」\n白话:${e.plain}` : '';
|
|
418
433
|
return {
|
|
419
434
|
key: 'suiyun', label: '岁运提示',
|
|
420
435
|
text: hits.length
|
|
@@ -422,7 +437,7 @@ function baziInterpret(r) {
|
|
|
422
437
|
const stem = (l.suiyun.dayun || []).map((d) => `第${d.step}步${d.ganzhi}`).join('、');
|
|
423
438
|
return `${l.year} ${l.ganzhi}(${stem || '未到起运'}):${l.suiyun.signals.map((s) => s.detail).join(';')}`;
|
|
424
439
|
}).join('\n') +
|
|
425
|
-
'\n读法:岁运并临、运年反吟与流年伏吟/反吟只说明干支层面重复或对冲,传统上当作「变动感较强」的信号;本插件不据此判吉凶,要落到具体年份,仍看该年是否动到用神。'
|
|
440
|
+
'\n读法:岁运并临、运年反吟与流年伏吟/反吟只说明干支层面重复或对冲,传统上当作「变动感较强」的信号;本插件不据此判吉凶,要落到具体年份,仍看该年是否动到用神。' + src
|
|
426
441
|
: '近十年没有岁运并临、运年反吟或流年伏吟/反吟。「岁运并临主大凶」这类说法流传很广,本插件只把它当变动提示,没有命中就不作额外解读。',
|
|
427
442
|
};
|
|
428
443
|
})(),
|
|
@@ -1207,10 +1222,32 @@ function liuyaoInterpret(r, ask) {
|
|
|
1207
1222
|
useText.push(`时令对用神:${head},日辰 ${strength.day ? `${strength.day.branch}(${strength.day.element})` : '—'}。${body.join(';')}。`);
|
|
1208
1223
|
useText.push('月建看这一段时令站在哪一边,日辰看当天那股力量是扶还是克;两处同时看,只报状态,不折成分数。');
|
|
1209
1224
|
}
|
|
1210
|
-
useText.push('
|
|
1225
|
+
useText.push('这一层只把用神、卦体与时令对起来,不折成分数、不断成败;应期另在「应期线索」一节只给触发支与快慢。');
|
|
1211
1226
|
sections.push({ key: 'yongshen', label: '用神落位与卦体', text: useText.join('\n') });
|
|
1212
1227
|
}
|
|
1213
1228
|
|
|
1229
|
+
// 应期线索:只给触发支与快慢方向,不给日期
|
|
1230
|
+
{
|
|
1231
|
+
const yq = r.yingqi;
|
|
1232
|
+
if (yq && Array.isArray(yq.items) && yq.items.length) {
|
|
1233
|
+
const rows = yq.items.map((it) => {
|
|
1234
|
+
const flags = [
|
|
1235
|
+
it.monthState && it.monthState !== 'unknown' ? `月建${it.monthState}` : '',
|
|
1236
|
+
it.monthChong ? '月破' : '',
|
|
1237
|
+
it.kong ? '旬空' : '',
|
|
1238
|
+
].filter(Boolean).join('、');
|
|
1239
|
+
return `${it.position}爻${it.branch}${it.element}${flags ? `(${flags})` : ''}:${it.tempoSay}`;
|
|
1240
|
+
});
|
|
1241
|
+
sections.push({
|
|
1242
|
+
key: 'yingqi',
|
|
1243
|
+
label: '应期线索',
|
|
1244
|
+
text: `应期快慢:${yq.tempoSay}。${rows.join(';')}。可留意的地支:${yq.triggers.map((t) => `${t.branch}(${t.labels.join('、')})`).join(';')}。` +
|
|
1245
|
+
`${yq.viaFushen ? '用神不上卦,这里的支取自伏神;伏神要先得出才算数。' : ''}` +
|
|
1246
|
+
'这一节只把传统的「逢值、逢冲、逢合」与旬空的出空、冲空摆出来,不换算成具体日期、不排先后、也不判忌神受制;近事以日计、远事以月计,用哪把尺取决于事情本身。',
|
|
1247
|
+
});
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1214
1251
|
// 全卦逐爻旺衰:不挑用神,六爻都过一遍,看整张卦的气压在哪一头
|
|
1215
1252
|
{
|
|
1216
1253
|
const hs = r.hexStrength;
|
|
@@ -1240,7 +1277,7 @@ function liuyaoInterpret(r, ask) {
|
|
|
1240
1277
|
|
|
1241
1278
|
sections.push({
|
|
1242
1279
|
key: 'limits', label: '未纳入',
|
|
1243
|
-
text: '
|
|
1280
|
+
text: '本卦没有计算:用神两现时该取哪一爻的权重、应期的具体日期(只给逢值/逢冲/逢合的触发支与快慢方向)、忌神受制的时点、动变连环。化进/化退的力重只按月建五态给「得令/失令」这类档位,不折成加权分数;这些都会改变"旺不旺"的判断,所以这里只给取象与方向。',
|
|
1244
1281
|
});
|
|
1245
1282
|
|
|
1246
1283
|
const dimensions = [
|
|
@@ -1666,7 +1703,7 @@ const BUILDERS = {
|
|
|
1666
1703
|
import { interpretQimen } from './qimen-interpret.js';
|
|
1667
1704
|
import { buildAnswer, buildPlain, buildGlossary, buildFollowups, dimensionPlain } from './interpret-plain.js';
|
|
1668
1705
|
import { knowledgeFor, caveatsFor, STATUS_LABEL } from './interpret-knowledge.js';
|
|
1669
|
-
import { CLASSIC_BOOKS } from './classics.js';
|
|
1706
|
+
import { CLASSIC_BOOKS, suiyunClassicOf } from './classics.js';
|
|
1670
1707
|
|
|
1671
1708
|
/**
|
|
1672
1709
|
* 给任意体系的解析结果补上「白话四层」:直答 / 说人话 / 每维一句话 / 追问建议。
|
package/engine/liuyao.js
CHANGED
|
@@ -66,6 +66,7 @@ const LIUSHEN_START = { 甲: 0, 乙: 0, 丙: 1, 丁: 1, 戊: 2, 己: 3, 庚: 4,
|
|
|
66
66
|
const ZHI_CHONG_PAIRS = [['子', '午'], ['丑', '未'], ['寅', '申'], ['卯', '酉'], ['辰', '戌'], ['巳', '亥']];
|
|
67
67
|
const ZHI_HE_PAIRS = [['子', '丑'], ['寅', '亥'], ['卯', '戌'], ['辰', '酉'], ['巳', '申'], ['午', '未']];
|
|
68
68
|
const CHONG_OF = Object.fromEntries(ZHI_CHONG_PAIRS.flatMap(([a, b]) => [[a, b], [b, a]]));
|
|
69
|
+
const HE_OF = Object.fromEntries(ZHI_HE_PAIRS.flatMap(([a, b]) => [[a, b], [b, a]]));
|
|
69
70
|
const TRIGRAM_OPPOSITE = { 乾: '巽', 巽: '乾', 坎: '离', 离: '坎', 艮: '坤', 坤: '艮', 震: '兑', 兑: '震' };
|
|
70
71
|
|
|
71
72
|
// ── 化进神 / 化退神 ────────────────────────────────────────────────
|
|
@@ -930,3 +931,102 @@ export function jinTuiPower(result, opts = {}) {
|
|
|
930
931
|
note: '进退只说这一爻往哪边走;力重是把它放回月建日辰,看有没有托着——得令则进得动、退得慢,失令则进得虚、退得实,月破压过一切。仍不直接定吉凶:用神化进为喜,忌神化进反而是忌。',
|
|
931
932
|
};
|
|
932
933
|
}
|
|
934
|
+
|
|
935
|
+
// ── 应期线索:只列「该留意哪一支」,不给日期 ─────────────────────────
|
|
936
|
+
// 知识卡 liuyao-yingqi 的承诺是「只作时间窗口的提示」:传统取用神逢值、
|
|
937
|
+
// 逢冲、逢合之期,旬空另等出空、冲空。这里只把这些地支列出来,再按月建给
|
|
938
|
+
// 一个快慢方向;不换算成日期、不排先后、不判忌神受制,也不叠动变连环。
|
|
939
|
+
export const YINGQI_TEMPO = ['偏速', '偏缓', '待解', '未定'];
|
|
940
|
+
const TEMPO_SAY = {
|
|
941
|
+
偏速: '用神得月令之气,应期偏近',
|
|
942
|
+
偏缓: '用神失月令之气,应期偏远',
|
|
943
|
+
待解: '有月破或旬空的用神,先等条件解除',
|
|
944
|
+
未定: '快慢不定(缺月建,或用神两现而旺衰不一)',
|
|
945
|
+
};
|
|
946
|
+
const TRIGGER_ORDER = ['逢值', '逢冲', '逢合', '出空填实', '冲空'];
|
|
947
|
+
|
|
948
|
+
/**
|
|
949
|
+
* 应期线索:用神逢值、逢冲、逢合,旬空另标出空与冲空。
|
|
950
|
+
* @param {object} result buildLiuyao 的结果
|
|
951
|
+
* @param {object} useGod yongshenOf 的结果
|
|
952
|
+
* @param {{monthBranch?: string}} opts
|
|
953
|
+
*/
|
|
954
|
+
export function yingqiWindow(result, useGod, opts = {}) {
|
|
955
|
+
if (!useGod || !useGod.liuqin) return null;
|
|
956
|
+
const found = Array.isArray(useGod.found) ? useGod.found : [];
|
|
957
|
+
const fushen = Array.isArray(useGod.fushen) ? useGod.fushen : [];
|
|
958
|
+
const viaFushen = !found.length && fushen.length > 0;
|
|
959
|
+
const source = found.length ? found : fushen;
|
|
960
|
+
if (!source.length) return null;
|
|
961
|
+
const monthBranch = opts.monthBranch || null;
|
|
962
|
+
const monthElement = monthBranch ? zhiElementOf(monthBranch) : null;
|
|
963
|
+
const kong = Array.isArray(result && result.xunKong)
|
|
964
|
+
? result.xunKong
|
|
965
|
+
: (result && typeof result.xunKong === 'string' ? result.xunKong.split('') : []);
|
|
966
|
+
|
|
967
|
+
const items = source.map((l) => {
|
|
968
|
+
const branch = l.branch;
|
|
969
|
+
const element = l.element || zhiElementOf(branch);
|
|
970
|
+
const monthState = monthStateOf(element, monthElement);
|
|
971
|
+
const isEmpty = kong.includes(branch);
|
|
972
|
+
const monthChong = !!(monthBranch && CHONG_OF[branch] === monthBranch);
|
|
973
|
+
const tempo = monthChong ? '待解'
|
|
974
|
+
: isEmpty ? '待解'
|
|
975
|
+
: monthState === 'unknown' ? '未定'
|
|
976
|
+
: (monthState === '旺' || monthState === '相') ? '偏速' : '偏缓';
|
|
977
|
+
const tempoSay = monthChong ? `遭${monthBranch}冲(月破),先待出月或填实`
|
|
978
|
+
: isEmpty ? '用神旬空,先待出空填实'
|
|
979
|
+
: monthState === 'unknown' ? '缺月建,快慢不定'
|
|
980
|
+
: `月建${monthState},${tempo === '偏速' ? '应期偏近' : '应期偏远'}`;
|
|
981
|
+
const triggers = [
|
|
982
|
+
{ branch, labels: ['逢值'] },
|
|
983
|
+
{ branch: CHONG_OF[branch] || null, labels: ['逢冲'] },
|
|
984
|
+
{ branch: HE_OF[branch] || null, labels: ['逢合'] },
|
|
985
|
+
];
|
|
986
|
+
if (isEmpty) {
|
|
987
|
+
triggers[0].labels.push('出空填实');
|
|
988
|
+
triggers[1].labels.push('冲空');
|
|
989
|
+
}
|
|
990
|
+
return {
|
|
991
|
+
position: l.position,
|
|
992
|
+
branch,
|
|
993
|
+
element,
|
|
994
|
+
monthState,
|
|
995
|
+
monthChong,
|
|
996
|
+
kong: isEmpty,
|
|
997
|
+
tempo,
|
|
998
|
+
tempoSay,
|
|
999
|
+
triggers,
|
|
1000
|
+
};
|
|
1001
|
+
});
|
|
1002
|
+
|
|
1003
|
+
// 用神两现时各爻的支可能不同:按支归并标签,不替谁选主用
|
|
1004
|
+
const merged = new Map();
|
|
1005
|
+
for (const it of items) {
|
|
1006
|
+
for (const t of it.triggers) {
|
|
1007
|
+
if (!t.branch) continue;
|
|
1008
|
+
const cur = merged.get(t.branch) || { branch: t.branch, labels: [] };
|
|
1009
|
+
for (const lb of t.labels) if (!cur.labels.includes(lb)) cur.labels.push(lb);
|
|
1010
|
+
merged.set(t.branch, cur);
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
const triggers = [...merged.values()].map((t) => ({
|
|
1014
|
+
branch: t.branch,
|
|
1015
|
+
labels: [...t.labels].sort((a, b) => TRIGGER_ORDER.indexOf(a) - TRIGGER_ORDER.indexOf(b)),
|
|
1016
|
+
}));
|
|
1017
|
+
const tempos = items.map((x) => x.tempo);
|
|
1018
|
+
const tempo = tempos.includes('待解') ? '待解'
|
|
1019
|
+
: tempos.every((t) => t === '偏速') ? '偏速'
|
|
1020
|
+
: tempos.every((t) => t === '偏缓') ? '偏缓' : '未定';
|
|
1021
|
+
|
|
1022
|
+
return {
|
|
1023
|
+
month: monthBranch ? { branch: monthBranch, element: monthElement } : null,
|
|
1024
|
+
viaFushen,
|
|
1025
|
+
tempo,
|
|
1026
|
+
tempoSay: TEMPO_SAY[tempo],
|
|
1027
|
+
items,
|
|
1028
|
+
triggers,
|
|
1029
|
+
labels: [`应期${tempo}`, ...triggers.map((t) => `${t.labels.join('/')}${t.branch}`)],
|
|
1030
|
+
note: '应期只给「该留意哪一支」与快慢方向:用神逢值、逢冲、逢合,旬空另标出空与冲空。不换算成日期、不排先后、不判忌神受制;近事以日计、远事以月计,用哪把尺由事情远近决定,本插件不代选。',
|
|
1031
|
+
};
|
|
1032
|
+
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-metaphysics",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.50.1",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "命理排盘(玄学 xuanxue)for DeepSeek Harness: nineteen systems and eleven quick references (almanac, solar–lunar conversion, …), with climate adjustment (tiaohou), the 120 Qiongtong Baojian entries, 391-char name library with per-character pinyin, Kangxi stroke counts, five-grid (五格/三才) analysis and mechanical phonetics checks, classical quotes (Ziping Zhenquan / Di Tian Sui / San Ming Tong Hui), hexagram body relations (六冲/六合/伏吟/反吟/化进神/化退神) plus yongshen placement (用神落位) with month/day strength (月建日辰旺衰) and whole-hexagram per-line strength (全卦逐爻旺衰) for liuyao, plus an MBTI-style 16-type questionnaire and exact dayun handover dates (交运日) with annual suiyun hints (岁运并临/伏吟反吟), palace conditions (击刑/入墓), month states (旺相休囚死) and stem–palace relations (天盘干与宫生克) for qimen, flying four-transformations with chained flights (四化飞星串连), three-way-four-corner composite flights (三方四正复合飞化), switchable leap-month policy (闰月按日切分/整月归次月/整月归本月) and nine school switches (亮度/庚干四化/天马/天空/截空旬空/魁钺/天伤天使/长生/晚子时) for ziwei, and a bundled offline single-file page (命理排盘.html), and a panel-to-chat handoff that asks the Harness about a finished chart.",
|
|
5
|
+
"description": "命理排盘(玄学 xuanxue)for DeepSeek Harness: nineteen systems and eleven quick references (almanac, solar–lunar conversion, …), with climate adjustment (tiaohou), the 120 Qiongtong Baojian entries, 391-char name library with per-character pinyin, Kangxi stroke counts, five-grid (五格/三才) analysis and mechanical phonetics checks, classical quotes (Ziping Zhenquan / Di Tian Sui / San Ming Tong Hui), hexagram body relations (六冲/六合/伏吟/反吟/化进神/化退神) plus yongshen placement (用神落位) with month/day strength (月建日辰旺衰) and whole-hexagram per-line strength (全卦逐爻旺衰) and response-time clues (应期线索:逢值/逢冲/逢合 + 月建五态快慢) for liuyao, plus an MBTI-style 16-type questionnaire and exact dayun handover dates (交运日) with annual suiyun hints (岁运并临/伏吟反吟), palace conditions (击刑/入墓), month states (旺相休囚死) and stem–palace relations (天盘干与宫生克) for qimen, flying four-transformations with chained flights (四化飞星串连), three-way-four-corner composite flights (三方四正复合飞化), switchable leap-month policy (闰月按日切分/整月归次月/整月归本月) and nine school switches (亮度/庚干四化/天马/天空/截空旬空/魁钺/天伤天使/长生/晚子时) for ziwei, and a bundled offline single-file page (命理排盘.html), and a panel-to-chat handoff that asks the Harness about a finished chart.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"玄学",
|
|
8
8
|
"玄学排盘",
|