@ssamurias/dsh-fish 1.1.4 → 1.1.6

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.
Files changed (64) hide show
  1. package/AGENTS.md +13 -3
  2. package/CHANGELOG.md +110 -1
  3. package/README.md +37 -122
  4. package/RELEASE-NOTES-1.1.5.md +49 -0
  5. package/RELEASE-NOTES-1.1.6.md +57 -0
  6. package/lib/ask.js +7 -1
  7. package/lib/becoming.js +70 -0
  8. package/lib/claim.js +23 -0
  9. package/lib/client.js +306 -71
  10. package/lib/cue.js +99 -23
  11. package/lib/decisions.js +207 -0
  12. package/lib/derive.js +148 -13
  13. package/lib/events.js +28 -0
  14. package/lib/guard.js +75 -9
  15. package/lib/handoff.js +9 -1
  16. package/lib/herpeople.js +1 -1
  17. package/lib/home.js +4 -0
  18. package/lib/index.js +9 -3
  19. package/lib/memorymap-html.js +1 -1
  20. package/lib/move.js +68 -8
  21. package/lib/observe-bili.js +32 -2
  22. package/lib/observe-config.js +14 -2
  23. package/lib/observe-data.js +19 -1
  24. package/lib/observe-home.js +13 -3
  25. package/lib/observe-state.js +3 -2
  26. package/lib/people.js +20 -11
  27. package/lib/peopledoc.js +1 -1
  28. package/lib/persona.js +15 -0
  29. package/lib/proactive.js +4 -2
  30. package/lib/quality.js +202 -48
  31. package/lib/recall.js +103 -24
  32. package/lib/reset-pending.js +15 -5
  33. package/lib/reset.js +78 -0
  34. package/lib/retire.js +42 -1
  35. package/lib/say.js +45 -3
  36. package/lib/scheduler.js +69 -30
  37. package/lib/selfdoc.js +1 -1
  38. package/lib/settings.js +148 -31
  39. package/lib/speak.js +10 -5
  40. package/lib/status.js +1 -1
  41. package/lib/timeintent.js +178 -0
  42. package/lib/turns.js +40 -1
  43. package/lib/types.d.ts +1 -0
  44. package/lib/wiki.js +66 -8
  45. package/package.json +4 -1
  46. package/tools/README.md +70 -0
  47. package/tools/recall-bench.mjs +240 -0
  48. package/tools/recall-cases.json +64 -0
  49. package/tools/recall-live-cases.json +20 -0
  50. package/lib/client/00-shell.js +0 -630
  51. package/lib/client/01-state-load.js +0 -962
  52. package/lib/client/02-actions.js +0 -692
  53. package/lib/client/03-widgets-header.js +0 -749
  54. package/lib/client/04-pressure-lab.js +0 -906
  55. package/lib/client/05-pressure-charts.js +0 -431
  56. package/lib/client/06-tab-status-grow.js +0 -479
  57. package/lib/client/07-tab-home-bili.js +0 -610
  58. package/lib/client/08-tab-memory-plugins.js +0 -676
  59. package/lib/client/09-tab-outing.js +0 -797
  60. package/lib/client/10-data-handlers.js +0 -519
  61. package/lib/client/11-tab-data-frame.js +0 -755
  62. package/lib/client/12-pressure-chip-mount.js +0 -579
  63. package/scripts/build-client.mjs +0 -97
  64. package/scripts/sync-pressure-formulas.mjs +0 -14
@@ -1,97 +0,0 @@
1
- #!/usr/bin/env node
2
- // @ts-check
3
- /**
4
- * scripts/build-client.mjs —— 把 `lib/client/*.js` 按序拼成浏览器单入口 `lib/client.js`
5
- *
6
- * 为什么这样拆而不引打包器:
7
- * 1. 零依赖铁律(dependencies / peerDependencies / devDependencies 全空),不能引 esbuild / rollup;
8
- * 2. 支持 `dsh plugin add "github:mochi-fish/dsh-fish"` 与 `link:` 源码直连,仓库里必须直接有可跑的 `lib/client.js`;
9
- * 3. 宿主客户端加载器(`window.__ModuleLoader__.load`)按 `./client` 单脚本装载。
10
- *
11
- * 同时把服务端 `lib/session-pressure-formulas.js` 的共享公式自动嵌进 `// BEGIN shared pressure formulas` 槽位,
12
- * 不再需要两处手抄同步。
13
- *
14
- * 用法:
15
- * node scripts/build-client.mjs # 重新生成 lib/client.js
16
- * node scripts/build-client.mjs --check # 只校验 lib/client.js 与分片源码是否逐字节一致(测试与 CI 用)
17
- */
18
-
19
- import fs from 'node:fs'
20
- import path from 'node:path'
21
- import { fileURLToPath } from 'node:url'
22
-
23
- const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')
24
- export const CLIENT_PARTS_DIR = path.join(ROOT, 'lib', 'client')
25
- export const CLIENT_OUT_FILE = path.join(ROOT, 'lib', 'client.js')
26
- export const FORMULAS_FILE = path.join(ROOT, 'lib', 'session-pressure-formulas.js')
27
- export const FORMULAS_PLACEHOLDER = ' // {{SHARED_PRESSURE_FORMULAS}}'
28
-
29
- /**
30
- * 读取服务端 `session-pressure-formulas.js`(去掉末尾 `export {...}`),缩进 4 格嵌入客户端壳。
31
- * @param {string} [root]
32
- * @returns {string}
33
- */
34
- export function renderSharedFormulas(root = ROOT) {
35
- const raw = fs.readFileSync(path.join(root, 'lib', 'session-pressure-formulas.js'), 'utf8').replace(/\r\n/g, '\n')
36
- const body = raw.split('\nexport {')[0].trimEnd()
37
- const indented = body
38
- .split('\n')
39
- .map((line) => (line.length ? ` ${line}` : ''))
40
- .join('\n')
41
- return ` // BEGIN shared pressure formulas\n${indented}\n // END shared pressure formulas`
42
- }
43
-
44
- /**
45
- * 按文件名顺序读取 `lib/client/*.js` 并拼出完整的 `lib/client.js` 源码(LF 换行)。
46
- * @param {string} [root]
47
- * @returns {{ code: string, parts: string[] }}
48
- */
49
- export function buildClientSource(root = ROOT) {
50
- const dir = path.join(root, 'lib', 'client')
51
- const parts = fs.readdirSync(dir).filter((f) => /^\d{2}-.*\.js$/.test(f)).sort()
52
- if (!parts.length) {
53
- throw new Error(`lib/client/ 下没有找到客户端分片文件(${dir})`)
54
- }
55
- const chunks = parts.map((name) => {
56
- const text = fs.readFileSync(path.join(dir, name), 'utf8').replace(/\r\n/g, '\n')
57
- if (name === '00-shell.js') {
58
- if (!text.includes(FORMULAS_PLACEHOLDER)) {
59
- throw new Error(`lib/client/00-shell.js 缺少共享公式占位符:${FORMULAS_PLACEHOLDER}`)
60
- }
61
- return text.replace(FORMULAS_PLACEHOLDER, renderSharedFormulas(root))
62
- }
63
- return text
64
- })
65
- return { code: chunks.join('\n'), parts }
66
- }
67
-
68
- // 是否「被直接执行」的判定。
69
- // 2026-11-25:原来直接比 path.resolve(process.argv[1]) 与 import.meta.url,
70
- // 仓库从目录联接(junction / symlink)进来时 argv[1] 走的是联接路径、import.meta.url
71
- // 已被 Node 解成真实路径,两边永远不等 ⇒ 脚本静默什么都不做、还返回 0(构建看着成功但没重打)。
72
- // 所以两边都 realpath 一次再比。
73
- const isMain = (() => {
74
- const entry = process.argv[1]
75
- if (!entry) return false
76
- const self = fileURLToPath(import.meta.url)
77
- try {
78
- return fs.realpathSync(entry) === fs.realpathSync(self)
79
- } catch {
80
- return path.resolve(entry) === self
81
- }
82
- })()
83
- if (isMain) {
84
- const checkOnly = process.argv.includes('--check')
85
- const { code, parts } = buildClientSource(ROOT)
86
- if (checkOnly) {
87
- const current = fs.readFileSync(CLIENT_OUT_FILE, 'utf8').replace(/\r\n/g, '\n')
88
- if (current !== code) {
89
- console.error('✖ lib/client.js 与 lib/client/*.js 分片不一致。请运行:node scripts/build-client.mjs')
90
- process.exit(1)
91
- }
92
- console.log(`✔ lib/client.js 与 ${parts.length} 个分片及共享公式逐字节一致。`)
93
- } else {
94
- fs.writeFileSync(CLIENT_OUT_FILE, code, 'utf8')
95
- console.log(`✔ 已从 ${parts.length} 个分片生成 lib/client.js(${Buffer.byteLength(code, 'utf8')} 字节)。`)
96
- }
97
- }
@@ -1,14 +0,0 @@
1
- // @ts-check
2
- /**
3
- * 兼容旧入口:把 `lib/session-pressure-formulas.js` 与 `lib/client/*.js` 一并拼回 `lib/client.js`。
4
- */
5
- import { writeFile } from 'node:fs/promises'
6
- import { readFileSync } from 'node:fs'
7
- import { CLIENT_OUT_FILE, buildClientSource } from './build-client.mjs'
8
-
9
- const { code } = buildClientSource()
10
- const original = readFileSync(CLIENT_OUT_FILE, 'utf8').replace(/\r\n/g, '\n')
11
- if (code !== original) {
12
- if (process.argv.includes('--check')) throw new Error('Client formulas or slices are out of sync')
13
- await writeFile(CLIENT_OUT_FILE, code, 'utf8')
14
- }