dsh-metaphysics 0.17.0 → 0.18.0
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 +99 -14
- package/README.md +54 -14
- package/client.js +2098 -35
- package/engine/almanac.js +215 -0
- package/engine/bazi.js +10 -2
- package/engine/chenggu.js +126 -0
- package/engine/dst.js +68 -0
- package/engine/fengshui.js +288 -0
- package/engine/geo.js +1 -1
- package/engine/hepan.js +82 -1
- package/engine/index.js +277 -2
- package/engine/name.js +303 -0
- package/engine/numerology.js +60 -0
- package/engine/rectify.js +1 -0
- package/engine/star.js +82 -0
- package/engine/trend.js +193 -0
- package/engine/xiaoliuren.js +64 -0
- package/engine/zeri.js +127 -0
- package/engine/ziwei.js +7 -2
- package/index.js +93 -25
- package/locale/en.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +17 -4
package/index.js
CHANGED
|
@@ -19,7 +19,8 @@ const TOOL_NAME = 'metaphysics_chart';
|
|
|
19
19
|
|
|
20
20
|
const DESCRIPTION = [
|
|
21
21
|
'排中国传统命理盘与塔罗:四柱八字(bazi)、紫微斗数(ziwei)、六爻纳甲(liuyao)、梅花易数(meihua)、大六壬(daliuren)、奇门遁甲(qimen)、合盘(hepan)或塔罗抽牌(tarot)。',
|
|
22
|
-
'
|
|
22
|
+
'另有速查类:黄历(almanac)、择日(zeri)、称骨(chenggu)、小六壬(xiaoliuren)、星座(star)、生命数字(numerology)、人生 K 线(trend)、风水(fengshui)、起名(name)。',
|
|
23
|
+
'当用户明确要求“排盘 / 算八字 / 看四柱 / 排紫微盘 / 起卦 / 摇一卦 / 抽塔罗 / 看运势 / 合盘 / 看黄历 / 挑日子 / 称骨 / 小六壬”时调用。',
|
|
23
24
|
'bazi 与 ziwei 需要公历出生时间与性别;hepan 需要双方的时间与性别;liuyao 可给定六爻值或随机起卦;meihua 可按时间或数字起卦;tarot 可指定张数与问题。',
|
|
24
25
|
'要给「结合所问之事的解读」时,把 withInterpret 设为 true,并尽量带上 question(所问之事)与 direction(询问方向)。',
|
|
25
26
|
'结果可复现:tarot / liuyao 传 seed,紫微 / 八字 / 塔罗传 asOf;输出摘要会写明晚子时与真太阳时实际采用的口径。',
|
|
@@ -71,13 +72,29 @@ export function apply(ctx) {
|
|
|
71
72
|
// 联网失败不影响排盘,退回内置表
|
|
72
73
|
}
|
|
73
74
|
};
|
|
74
|
-
if (next.system === 'bazi' || next.system === 'ziwei' || next.system === 'hepan'
|
|
75
|
+
if (next.system === 'bazi' || next.system === 'ziwei' || next.system === 'hepan'
|
|
76
|
+
|| next.system === 'trend' || next.system === 'fengshui' || next.system === 'name') {
|
|
75
77
|
await resolveGeo(next);
|
|
76
78
|
}
|
|
77
79
|
if (next.system === 'hepan' && next.partner && typeof next.partner === 'object') {
|
|
78
80
|
next.partner = { ...next.partner }; // 不改调用方传进来的对象
|
|
79
81
|
await resolveGeo(next.partner);
|
|
80
82
|
}
|
|
83
|
+
// 宿主有时钟:日期类体系缺日期时补「今天」,免得模型自己猜日期;
|
|
84
|
+
// 择日与此刻起课同理——补上后仍会把实际采用的日期写进结果,可回溯。
|
|
85
|
+
const now = new Date();
|
|
86
|
+
const pad = (n) => String(n).padStart(2, '0');
|
|
87
|
+
const today = `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())}`;
|
|
88
|
+
const DATE_ONLY = { almanac: 1, star: 1, numerology: 1 };
|
|
89
|
+
if (DATE_ONLY[next.system] && !next.datetime) next.datetime = today;
|
|
90
|
+
if (next.system === 'zeri' && !next.startDate) next.startDate = today;
|
|
91
|
+
if (next.system === 'xiaoliuren' && next.mode !== 'number' && !next.datetime && !next.date) {
|
|
92
|
+
next.datetime = `${today}T${pad(now.getHours())}:${pad(now.getMinutes())}`;
|
|
93
|
+
}
|
|
94
|
+
// 风水 natal 的流年飞星默认看今年;显式给了 fortuneYear 就按给的算
|
|
95
|
+
if (next.system === 'fengshui' && next.action !== 'advise' && next.fortuneYear === undefined) {
|
|
96
|
+
next.fortuneYear = now.getFullYear();
|
|
97
|
+
}
|
|
81
98
|
return compute(next);
|
|
82
99
|
}
|
|
83
100
|
|
|
@@ -89,13 +106,25 @@ export function apply(ctx) {
|
|
|
89
106
|
properties: {
|
|
90
107
|
system: {
|
|
91
108
|
type: 'string',
|
|
92
|
-
enum: ['bazi', 'ziwei', 'liuyao', 'tarot', 'meihua', 'daliuren', 'hepan', 'qimen'],
|
|
93
|
-
description: 'bazi = 四柱八字;ziwei = 紫微斗数;liuyao = 六爻;tarot = 塔罗;meihua = 梅花易数;daliuren = 大六壬;hepan = 合盘(合婚),需同时给 partner;qimen =
|
|
109
|
+
enum: ['bazi', 'ziwei', 'liuyao', 'tarot', 'meihua', 'daliuren', 'hepan', 'qimen', 'almanac', 'zeri', 'chenggu', 'xiaoliuren', 'star', 'numerology', 'trend', 'fengshui', 'name'],
|
|
110
|
+
description: 'bazi = 四柱八字;ziwei = 紫微斗数;liuyao = 六爻;tarot = 塔罗;meihua = 梅花易数;daliuren = 大六壬;hepan = 合盘(合婚),需同时给 partner;qimen = 奇门遁甲(时家转盘,拆补法);almanac = 黄历(某日宜忌/冲煞/建除/节气);zeri = 择日(某事项在日期区间内逐日打分排序);chenggu = 袁天罡称骨;xiaoliuren = 小六壬(时间或报数起课);star = 星座当日基调;numerology = 生命数字;trend = 人生 K 线(大运/流年走势可视化);fengshui = 风水(八宅命卦/流年飞星/门主灶布局);name = 起名(用字五行评估与候选生成)。',
|
|
94
111
|
},
|
|
95
112
|
datetime: {
|
|
96
113
|
type: 'string',
|
|
97
114
|
description:
|
|
98
|
-
'公历本地时间,如 1990-05-12T14:30。bazi / ziwei 必填;liuyao 可选,仅用于取日辰定六神。',
|
|
115
|
+
'公历本地时间,如 1990-05-12T14:30。bazi / ziwei 必填;liuyao 可选,仅用于取日辰定六神。almanac / star / numerology 只需要日期(可省略,省略则取今天);chenggu 需要带时分或用 hour 补时辰;xiaoliuren 时间起课用它的日期与时分。',
|
|
116
|
+
},
|
|
117
|
+
date: {
|
|
118
|
+
type: 'string',
|
|
119
|
+
description: '仅 xiaoliuren 时间起课用:公历日期 YYYY-MM-DD(与 hour 成对);省略则取 datetime 的日期。',
|
|
120
|
+
},
|
|
121
|
+
hour: {
|
|
122
|
+
type: 'integer',
|
|
123
|
+
description: '时辰小时(0–23)。chenggu 用它补时辰(datetime 不带时分时必填);xiaoliuren 时间起课用它代替 datetime 的时分。',
|
|
124
|
+
},
|
|
125
|
+
dst: {
|
|
126
|
+
type: 'boolean',
|
|
127
|
+
description: '是否自动校正 1986–1991 年中国夏令时(默认 true)。出生证时间是真实太阳口径、或想复现旧结果时传 false。',
|
|
99
128
|
},
|
|
100
129
|
gender: {
|
|
101
130
|
type: 'string',
|
|
@@ -137,6 +166,27 @@ export function apply(ctx) {
|
|
|
137
166
|
type: 'string',
|
|
138
167
|
description: '所问之事。六爻、塔罗、梅花会直接用于取象;配合 withInterpret 时也会写进解析的引语。',
|
|
139
168
|
},
|
|
169
|
+
task: {
|
|
170
|
+
type: 'string',
|
|
171
|
+
enum: ['嫁娶', '订婚', '开业', '入宅', '搬家', '动土', '装修', '安葬', '出行', '祭祀', '签约', '求医', '纳财'],
|
|
172
|
+
description: '仅 zeri 使用:要挑的事项。',
|
|
173
|
+
},
|
|
174
|
+
startDate: {
|
|
175
|
+
type: 'string',
|
|
176
|
+
description: '仅 zeri 使用:起算日(公历 YYYY-MM-DD)。省略则由宿主补今天。',
|
|
177
|
+
},
|
|
178
|
+
days: {
|
|
179
|
+
type: 'number',
|
|
180
|
+
description: '仅 zeri 使用:往后考察天数,1–60,默认 30。',
|
|
181
|
+
},
|
|
182
|
+
shengXiao: {
|
|
183
|
+
type: 'string',
|
|
184
|
+
enum: ['鼠', '牛', '虎', '兔', '龙', '蛇', '马', '羊', '猴', '鸡', '狗', '猪'],
|
|
185
|
+
description: '仅 zeri 使用:当事人属相,用于排除冲煞日(不给则不排除)。',
|
|
186
|
+
},
|
|
187
|
+
num1: { type: 'number', description: '仅 xiaoliuren 报数模式:第一个数(1–99)。' },
|
|
188
|
+
num2: { type: 'number', description: '仅 xiaoliuren 报数模式:第二个数(1–99)。' },
|
|
189
|
+
num3: { type: 'number', description: '仅 xiaoliuren 报数模式:第三个数(1–99)。' },
|
|
140
190
|
direction: {
|
|
141
191
|
type: 'string',
|
|
142
192
|
enum: ['general', 'wealth', 'career', 'love', 'health', 'study', 'travel'],
|
|
@@ -146,26 +196,26 @@ export function apply(ctx) {
|
|
|
146
196
|
type: 'boolean',
|
|
147
197
|
description: '八字 / 紫微专用:为同一份出生信息再排另一套盘,返回「八字 × 紫微 交叉验证」(同向 / 有张力 / 互补),不合并数值。',
|
|
148
198
|
},
|
|
149
|
-
verifyPast: {
|
|
150
|
-
type: 'number',
|
|
151
|
-
description: '验前事(仅八字):传年数(如 6),返回过去 N 年的流年信号行,供用户勾选「准/不准」并算贴合度;只读,不改盘。',
|
|
152
|
-
},
|
|
153
|
-
rectify: {
|
|
154
|
-
type: 'boolean',
|
|
155
|
-
description: '生时校正(仅八字):配合 events 使用,把候选时辰逐一排盘并按固定规则对过去事件打分,返回候选排序;用于缩小时辰范围,不替代出生记录。',
|
|
156
|
-
},
|
|
157
|
-
events: {
|
|
158
|
-
type: 'array',
|
|
159
|
-
description: '生时校正用的过去事件:年份 + 类别(career/wealth/love/move/health/other)。',
|
|
160
|
-
items: {
|
|
161
|
-
type: 'object',
|
|
162
|
-
properties: {
|
|
163
|
-
year: { type: 'integer', description: '事件发生的公历年份,如 2019' },
|
|
164
|
-
kind: { type: 'string', enum: ['career', 'wealth', 'love', 'move', 'health', 'other'], description: '事件类别' },
|
|
165
|
-
},
|
|
166
|
-
required: ['year'],
|
|
167
|
-
},
|
|
168
|
-
},
|
|
199
|
+
verifyPast: {
|
|
200
|
+
type: 'number',
|
|
201
|
+
description: '验前事(仅八字):传年数(如 6),返回过去 N 年的流年信号行,供用户勾选「准/不准」并算贴合度;只读,不改盘。',
|
|
202
|
+
},
|
|
203
|
+
rectify: {
|
|
204
|
+
type: 'boolean',
|
|
205
|
+
description: '生时校正(仅八字):配合 events 使用,把候选时辰逐一排盘并按固定规则对过去事件打分,返回候选排序;用于缩小时辰范围,不替代出生记录。',
|
|
206
|
+
},
|
|
207
|
+
events: {
|
|
208
|
+
type: 'array',
|
|
209
|
+
description: '生时校正用的过去事件:年份 + 类别(career/wealth/love/move/health/other)。',
|
|
210
|
+
items: {
|
|
211
|
+
type: 'object',
|
|
212
|
+
properties: {
|
|
213
|
+
year: { type: 'integer', description: '事件发生的公历年份,如 2019' },
|
|
214
|
+
kind: { type: 'string', enum: ['career', 'wealth', 'love', 'move', 'health', 'other'], description: '事件类别' },
|
|
215
|
+
},
|
|
216
|
+
required: ['year'],
|
|
217
|
+
},
|
|
218
|
+
},
|
|
169
219
|
ask: {
|
|
170
220
|
type: 'string',
|
|
171
221
|
description: '追问:围绕已算好的盘回答「某一年 / 某方面」的问题,如「2027 年事业怎么样」「感情如何」。只取盘面已有字段,不重排、不猜测。',
|
|
@@ -219,6 +269,24 @@ export function apply(ctx) {
|
|
|
219
269
|
type: 'boolean',
|
|
220
270
|
description: '紫微斗数:闰月是否按次月起盘(默认按本月起盘)。',
|
|
221
271
|
},
|
|
272
|
+
action: {
|
|
273
|
+
type: 'string',
|
|
274
|
+
enum: ['natal', 'advise', 'assess', 'generate'],
|
|
275
|
+
description: '子动作。fengshui:natal(默认,算八宅命卦+流年飞星,需生日与性别)、advise(算宅卦门主灶布局,需 sitting 或 facing,出生信息可选);name:assess(默认,评估已有名字,需 surname + givenName)、generate(生成候选名,需生辰,可选 surname / limit)。',
|
|
276
|
+
},
|
|
277
|
+
toAge: {
|
|
278
|
+
type: 'number',
|
|
279
|
+
description: '仅 trend 使用:算到几岁(10–100,默认 100)。',
|
|
280
|
+
},
|
|
281
|
+
sitting: { type: 'string', description: '仅 fengshui advise:坐山(24 山之一,如 子/午/乾)。与 facing 至少给一个。' },
|
|
282
|
+
facing: { type: 'string', description: '仅 fengshui advise:向山(24 山之一)。缺 sitting 时按对宫反推。' },
|
|
283
|
+
fortuneYear: {
|
|
284
|
+
type: 'number',
|
|
285
|
+
description: '仅 fengshui natal:流年九宫飞星的目标年份,省略则不算飞星(只算命卦与八星)。',
|
|
286
|
+
},
|
|
287
|
+
surname: { type: 'string', description: '仅 name 使用:姓氏,如「李」(复姓整体写,如「欧阳」)。' },
|
|
288
|
+
givenName: { type: 'string', description: '仅 name assess 使用:名(1–2 个汉字)。' },
|
|
289
|
+
limit: { type: 'number', description: '仅 name generate 使用:候选个数(1–20,默认 10)。' },
|
|
222
290
|
},
|
|
223
291
|
required: ['system'],
|
|
224
292
|
},
|
package/locale/en.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
3
|
"title": "Metaphysics Charts",
|
|
4
|
-
"description": "
|
|
4
|
+
"description": "Seventeen systems in one plugin: eight chart systems plus nine quick references (almanac, date selection, bone-weight fortune, Xiao Liu Ren, horoscope, numerology, life-curve, feng shui, name analysis). Chart systems: BaZi (hidden stems, ten gods, 12 stages, 42 shensha, strength, pattern and useful-god, luck scoring), Zi Wei Dou Shu (49 stars with brightness, four 12-god cycles, 34 patterns, decade and annual/monthly/daily/hourly mutagen), LiuYao, MeiHua YiShu, Da Liu Ren, Qi Men Dun Jia (three ju-selection schools), compatibility charts (BaZi and Zi Wei), and Tarot, plus an ask-driven interpretation layer. Computed locally with networking off by default, exposed as an agent tool with a Web panel."
|
|
5
5
|
}
|
|
6
6
|
}
|
package/locale/zh.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
3
|
"title": "命理排盘 · 八字紫微六爻梅花六壬奇门合盘塔罗",
|
|
4
|
-
"description": "
|
|
4
|
+
"description": "十七套体系一站排盘:既有的八套排盘(八字、紫微、六爻、梅花、大六壬、奇门、合盘、塔罗)之外,新增九套速查(黄历、择日、称骨、小六壬、星座、生命数字、人生K线、风水、起名):八字(藏干十神、十二长生、42 神煞、旺衰、格局用神、大运流年吉凶评分)、紫微斗数(49 星曜与主星庙旺、四层十二神、34 格局、大限、流年流月流日流时四化)、六爻纳甲、梅花易数、大六壬(天地盘/四课/三传)、奇门遁甲(拆补/超神接气/置闰三派取局)、合盘(八字与紫微两套)与塔罗;另有所问之事驱动的解析与详解。纯本地计算、默认不联网,作为 Agent 工具供对话调用,并提供可切换本命/大限/流年视图的 Web 面板。"
|
|
5
5
|
}
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-metaphysics",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "命理排盘 for DeepSeek Harness:
|
|
5
|
+
"description": "命理排盘 for DeepSeek Harness: seventeen systems — eight chart systems (BaZi four pillars, Zi Wei Dou Shu, LiuYao, MeiHua, Da Liu Ren, Qi Men Dun Jia, compatibility charts, Tarot) plus nine quick references (almanac, date selection, bone-weight fortune, Xiao Liu Ren, horoscope, numerology, life-curve, feng shui, name analysis); ask-driven interpretation, report layer with evidence and confidence, DST correction for 1986–1991. All computed locally, networking off by default — as an agent tool plus a Web panel.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"dsh-plugin",
|
|
8
8
|
"dsh-bundle",
|
|
@@ -26,7 +26,19 @@
|
|
|
26
26
|
"meihua-yishu",
|
|
27
27
|
"da-liu-ren",
|
|
28
28
|
"大六壬",
|
|
29
|
-
"梅花易数"
|
|
29
|
+
"梅花易数",
|
|
30
|
+
"almanac",
|
|
31
|
+
"黄历",
|
|
32
|
+
"择日",
|
|
33
|
+
"称骨",
|
|
34
|
+
"小六壬",
|
|
35
|
+
"feng-shui",
|
|
36
|
+
"风水",
|
|
37
|
+
"起名",
|
|
38
|
+
"numerology",
|
|
39
|
+
"生命数字",
|
|
40
|
+
"horoscope",
|
|
41
|
+
"星座"
|
|
30
42
|
],
|
|
31
43
|
"license": "MIT",
|
|
32
44
|
"author": "xuanfu-web",
|
|
@@ -74,9 +86,10 @@
|
|
|
74
86
|
"build": "node tools/build-client.mjs",
|
|
75
87
|
"build:html": "node tools/build-html.mjs",
|
|
76
88
|
"test": "node tools/test-all.mjs",
|
|
77
|
-
"test:ci": "node tools/test-all.mjs && node tools/check-assertions.mjs && node tools/verify-tests-can-fail.mjs && node tools/check-html-sinks.mjs && node tools/check-patterns.mjs",
|
|
89
|
+
"test:ci": "node tools/build-client.mjs && node tools/check-bundle.mjs && node tools/test-all.mjs && node tools/check-assertions.mjs && node tools/verify-tests-can-fail.mjs && node tools/check-html-sinks.mjs && node tools/check-patterns.mjs",
|
|
78
90
|
"test:baseline": "node tools/check-assertions.mjs --update",
|
|
79
91
|
"check:html": "node tools/check-html-sinks.mjs",
|
|
92
|
+
"check:bundle": "node tools/check-bundle.mjs",
|
|
80
93
|
"check:patterns": "node tools/check-patterns.mjs",
|
|
81
94
|
"release": "node tools/release.mjs"
|
|
82
95
|
}
|