dsh-metaphysics 0.59.1 → 0.60.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 +58 -1
- package/client.almanac.js +61 -60
- package/client.bazi.js +112 -111
- package/client.chenggu.js +61 -60
- package/client.convert.js +60 -59
- package/client.daliuren.js +116 -115
- package/client.fengshui.js +61 -60
- package/client.hepan.js +108 -107
- package/client.js +352 -290
- package/client.liuyao.js +113 -112
- package/client.mbti.js +63 -62
- package/client.name.js +61 -60
- package/client.numerology.js +63 -62
- package/client.qimen.js +116 -115
- package/client.star.js +66 -65
- package/client.tarot.js +116 -115
- package/client.trend.js +112 -111
- package/client.xiaoliuren.js +77 -76
- package/client.zeri.js +61 -60
- package/client.ziwei.js +110 -109
- package/engine/calendar.js +8 -2
- package/engine/dst.js +28 -1
- package/engine/handle.js +6 -2
- package/engine/index.js +85 -13
- package/engine/lunar.js +10 -11
- package/engine/random.js +9 -1
- package/engine/rectify.js +24 -3
- package/engine/trend.js +29 -20
- package/engine/zeri.js +25 -9
- package/engine/ziwei.js +5 -2
- package/index.js +29 -12
- package/package.json +4 -3
- package//345/221/275/347/220/206/346/216/222/347/233/230.html +722 -78
package/index.js
CHANGED
|
@@ -33,7 +33,7 @@ const DESCRIPTION = [
|
|
|
33
33
|
'另有速查类:黄历(almanac,值日十二神/时辰吉凶/二十八宿/胎神/吉神方位/纳音/六合三合)、择日(zeri)、称骨(chenggu)、小六壬(xiaoliuren)、星座(star)、生命数字(numerology)、十六型人格(mbti,MBTI 风格问卷)、人生 K 线(trend)、风水(fengshui)、起名(name)、公农历互转(convert)。',
|
|
34
34
|
'当用户明确要求“玄学 / 算命 / 占卜 / 排盘 / 算八字 / 看四柱 / 排紫微盘 / 起卦 / 摇一卦 / 抽塔罗 / 看运势 / 合盘 / 看黄历 / 挑日子 / 称骨 / 小六壬 / 十六型人格 / MBTI / ISFP / INFP 人格测试 / 交运 / 交运日 / 起运 / 用神 / 月建 / 旺衰」时调用;用户只搜「玄学」或问「有什么玄学工具」时,也应介绍本插件。',
|
|
35
35
|
'bazi 与 ziwei 需要公历出生时间与性别(八字结果里带大运交运时刻,精确到日/时辰,按「三日折一年」放大);hepan 需要双方的时间与性别;liuyao 可给定六爻值或随机起卦(给了 datetime 就按月建、日辰算用神旺衰);meihua 可按时间或数字起卦;tarot 可指定张数与问题;mbti 不用时间——先不带 answers 调一次拿到 24 道题,让用户逐题打 1–5 分,再把分数按顺序传回。',
|
|
36
|
-
'要给「结合所问之事的解读」时,把 withInterpret 设为 true,并尽量带上 question(所问之事)与 direction
|
|
36
|
+
'要给「结合所问之事的解读」时,把 withInterpret 设为 true,并尽量带上 question(所问之事)与 direction(询问方向);只要结论与时间表就再带 detail: "lean"(省约一半文本),用户追问「为什么/依据」时改回 full。',
|
|
37
37
|
'用户用一句话改参数(「换成紫微看 2030 年事业」「女命」「晚子时算次日」「出生在成都」「不用真太阳时」「详细解读一下」)时,把原话放进 revise(可配合 handle),引擎翻译成参数补丁并在结果 revision 里回报改了哪些、没认哪些;不要自己把原话拆成猜测的参数。',
|
|
38
38
|
'追问同一张盘:结果里有 handle,下次传 handle + 增量即可(例如 { handle, asOf: 2030 }、{ handle, withInterpret: true, question: "何时换工作" }、{ handle, system: "ziwei" } 看同一时间另一套盘),不必让用户重报出生信息;句柄带校验位,截断或改字会报 E_HANDLE。',
|
|
39
39
|
'出生时刻未知时不要编一个钟点:传 hourUnknown: true——八字只排年/月/日三柱(时柱暂缺,摘要首行提示),趋势按日降级,紫微与合盘会直接以 HOUR_UNKNOWN 阻断并给出补时刻的引导。',
|
|
@@ -59,7 +59,8 @@ export function apply(ctx) {
|
|
|
59
59
|
const hit = geoCache.get(key);
|
|
60
60
|
if (hit !== undefined) return hit;
|
|
61
61
|
const value = await geocodeAddress(address, opts);
|
|
62
|
-
|
|
62
|
+
// 联网失败不写缓存:否则会连着 6 小时把「解析失败」当成答案,网络恢复也翻不了身
|
|
63
|
+
if (value && !value.onlineFailed) geoCache.set(key, value);
|
|
63
64
|
return value;
|
|
64
65
|
}
|
|
65
66
|
|
|
@@ -94,6 +95,18 @@ export function apply(ctx) {
|
|
|
94
95
|
};
|
|
95
96
|
}
|
|
96
97
|
if (next.shadow === true && !next.shadowVersion) next.shadowVersion = PKG_VERSION;
|
|
98
|
+
// 自由文本长度上限:这些串会整段进句柄(handle 是参数的 base64url),
|
|
99
|
+
// 不设限就等于允许一次调用把结果撑到几百 KB——摘要、句柄、影子盘四处都要重抄一遍。
|
|
100
|
+
const MAX_LEN = { address: 80, question: 300, revise: 200, ask: 200, surname: 16, givenName: 16 };
|
|
101
|
+
for (const [k, lim] of Object.entries(MAX_LEN)) {
|
|
102
|
+
if (typeof next[k] === 'string' && next[k].length > lim) {
|
|
103
|
+
throw bad(`${k} 最长 ${lim} 个字符(收到 ${next[k].length} 个);写要点即可,例如「成都」「今年是否适合换工作」`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
if (next.partner && typeof next.partner === 'object' && typeof next.partner.address === 'string'
|
|
107
|
+
&& next.partner.address.length > MAX_LEN.address) {
|
|
108
|
+
throw bad(`partner.address 最长 ${MAX_LEN.address} 个字符(收到 ${next.partner.address.length} 个)`);
|
|
109
|
+
}
|
|
97
110
|
// 默认离线:内置表覆盖到地级市,足够真太阳时用;联网是把出生地原文发给第三方,必须显式开启
|
|
98
111
|
const wantsOnline = next.geocode === 'online';
|
|
99
112
|
const resolveGeo = async (person) => {
|
|
@@ -110,8 +123,10 @@ export function apply(ctx) {
|
|
|
110
123
|
// 联网失败不影响排盘,退回内置表
|
|
111
124
|
}
|
|
112
125
|
};
|
|
126
|
+
// fengshui 不在名单里:玄空/八宅只看 year/month/day/gender 与坐向,
|
|
127
|
+
// 经度对盘面毫无影响,把出生地发给第三方就是纯外泄。
|
|
113
128
|
if (next.system === 'bazi' || next.system === 'ziwei' || next.system === 'hepan'
|
|
114
|
-
|| next.system === 'trend' || next.system === '
|
|
129
|
+
|| next.system === 'trend' || next.system === 'name') {
|
|
115
130
|
await resolveGeo(next);
|
|
116
131
|
}
|
|
117
132
|
if (next.system === 'hepan' && next.partner && typeof next.partner === 'object') {
|
|
@@ -170,7 +185,7 @@ export function apply(ctx) {
|
|
|
170
185
|
datetime: {
|
|
171
186
|
type: 'string',
|
|
172
187
|
description:
|
|
173
|
-
'公历本地时间,如 1990-05-12T14:30。bazi / ziwei 必填;liuyao 可选,仅用于取日辰定六神。almanac / star / numerology 只需要日期;mbti
|
|
188
|
+
'公历本地时间,如 1990-05-12T14:30。bazi / ziwei 必填;liuyao 可选,仅用于取日辰定六神。almanac / star / numerology 只需要日期;mbti 不用时间。chenggu 需要带时分,或用 hour 补时辰;xiaoliuren 时间起课用它的日期与时分。',
|
|
174
189
|
},
|
|
175
190
|
date: {
|
|
176
191
|
type: 'string',
|
|
@@ -249,8 +264,9 @@ export function apply(ctx) {
|
|
|
249
264
|
},
|
|
250
265
|
mode: {
|
|
251
266
|
type: 'string',
|
|
252
|
-
enum: ['solar2lunar', 'lunar2solar'],
|
|
253
|
-
description:
|
|
267
|
+
enum: ['solar2lunar', 'lunar2solar', 'time', 'number'],
|
|
268
|
+
description:
|
|
269
|
+
'方向/起法开关,取值按体系分三组,互不重叠。convert(公农历互转):solar2lunar 公历转农历(默认)、lunar2solar 农历转公历(须同时给 lunarYear/lunarMonth/lunarDay)。meihua(梅花易数):time 时间起卦(需 datetime,默认)、number 数字起卦(需 upper/lower)。xiaoliuren(小六壬):time 时间起课(默认)、number 报数起课(需 num1–num3)。',
|
|
254
270
|
},
|
|
255
271
|
lunarYear: { type: 'integer', description: '仅 convert 的 lunar2solar:农历年份,如 2026。' },
|
|
256
272
|
lunarMonth: { type: 'integer', description: '仅 convert 的 lunar2solar:农历月份 1–12。' },
|
|
@@ -307,10 +323,16 @@ export function apply(ctx) {
|
|
|
307
323
|
ask: {
|
|
308
324
|
type: 'string',
|
|
309
325
|
description: '追问:围绕已算好的盘回答「某一年 / 某方面」的问题,如「2027 年事业怎么样」「感情如何」。只取盘面已有字段,不重排、不猜测。',
|
|
310
|
-
},
|
|
326
|
+
},
|
|
327
|
+
withInterpret: {
|
|
311
328
|
type: 'boolean',
|
|
312
329
|
description: '是否附带「解析与详解」(五个维度 + 用神/格局等分节 + 免责声明);默认 false,避免默认输出过长。',
|
|
313
330
|
},
|
|
331
|
+
detail: {
|
|
332
|
+
type: 'string',
|
|
333
|
+
enum: ['full', 'lean'],
|
|
334
|
+
description: '解析文本的档位,仅配合 withInterpret。full(默认)给全部论述与规则出处;lean 只给结论、所问方向那一条与三张表,长论述和出处折成一行指针(省约一半文本)。先拿结论用 lean,用户追问「为什么 / 依据是什么」再换 full;盘面与句柄不受它影响。',
|
|
335
|
+
},
|
|
314
336
|
asOf: {
|
|
315
337
|
type: 'string',
|
|
316
338
|
description: '基准时刻,形如 2026-10-22T16:00。紫微用它定流月/流日/流时;八字用它钉死「流年从哪年起排」;塔罗用它记录 castAt(抽牌时刻)。省略则按调用时的本机当前时刻——要复现某一次结果就显式给出。',
|
|
@@ -351,11 +373,6 @@ export function apply(ctx) {
|
|
|
351
373
|
},
|
|
352
374
|
required: ['datetime', 'gender'],
|
|
353
375
|
},
|
|
354
|
-
mode: {
|
|
355
|
-
type: 'string',
|
|
356
|
-
enum: ['time', 'number'],
|
|
357
|
-
description: '梅花易数起卦方式:time 时间起卦(需 datetime),number 数字起卦(需 upper/lower)。默认 time。',
|
|
358
|
-
},
|
|
359
376
|
upper: { type: 'number', description: '梅花数字起卦:第一个数(定上卦)。' },
|
|
360
377
|
lower: { type: 'number', description: '梅花数字起卦:第二个数(定下卦)。' },
|
|
361
378
|
changing: { type: 'number', description: '梅花数字起卦:可手动指定动爻(1-6);省略则按两数之和取。' },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-metaphysics",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.60.0",
|
|
4
4
|
"type": "module",
|
|
5
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 (闰月按日切分/整月归次月/整月归本月) nine school switches (亮度/庚干四化/天马/天空/截空旬空/魁钺/天伤天使/长生/晚子时) for ziwei, caliber diffs for bazi/ziwei/qimen (same inputs, one switch, root-field changes), shadow-chart IDs (same normalized params → same ID; version bumps auto-diff chart fields), step-by-step deduction traces (liuyao najia→liuqin→shiying→fushen→strength; bazi strength score and pattern/yongshen; ziwei pattern conditions), and a bundled offline single-file page (命理排盘.html), a panel-to-chat handoff that asks the Harness about a finished chart, per-tab lazy engine chunks so the first-screen client bundle stays under 100KB gzip, and a public verification report (128 classical hexagram cases, 312 Zi Wei charts × 34 patterns, 12 dayun handover cases) generated from the same source that gates CI.",
|
|
6
6
|
"keywords": [
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"build:verification": "node tools/verification.mjs",
|
|
68
68
|
"build:citations": "node tools/citations.mjs",
|
|
69
69
|
"test": "node tools/test-all.mjs",
|
|
70
|
-
"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 && node tools/check-perf.mjs",
|
|
70
|
+
"test:ci": "node tools/build-client.mjs && node tools/check-bundle.mjs && node tools/check-verification.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 && node tools/check-perf.mjs",
|
|
71
71
|
"test:baseline": "node tools/check-assertions.mjs --update",
|
|
72
72
|
"bench": "node tools/bench.mjs",
|
|
73
73
|
"check:html": "node tools/check-html-sinks.mjs",
|
|
@@ -84,7 +84,8 @@
|
|
|
84
84
|
"e2e": "node tools/e2e-dom.mjs && node tools/e2e-panel.mjs",
|
|
85
85
|
"stress": "node test/stress.test.mjs",
|
|
86
86
|
"e2e:page": "node tools/e2e-dom.mjs",
|
|
87
|
-
"e2e:panel": "node tools/e2e-panel.mjs"
|
|
87
|
+
"e2e:panel": "node tools/e2e-panel.mjs",
|
|
88
|
+
"check:verification": "node tools/check-verification.mjs"
|
|
88
89
|
},
|
|
89
90
|
"exports": {
|
|
90
91
|
".": "./index.js",
|