weflow-cli 1.9.0 → 1.11.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.
Files changed (134) hide show
  1. package/ARCHITECTURE.md +62 -26
  2. package/CHANGELOG.md +1051 -0
  3. package/OPERATIONS.md +99 -13
  4. package/README.en.md +14 -5
  5. package/README.md +23 -8
  6. package/bin/weflow-cli.ts +364 -40
  7. package/dist/bin/weflow-cli.js +381 -69
  8. package/dist/bin/weflow-cli.js.map +1 -1
  9. package/dist/mcp-server/index.d.ts.map +1 -1
  10. package/dist/mcp-server/index.js +19 -1
  11. package/dist/mcp-server/index.js.map +1 -1
  12. package/dist/src/core/dbPathService.d.ts +12 -0
  13. package/dist/src/core/dbPathService.d.ts.map +1 -1
  14. package/dist/src/core/dbPathService.js +20 -3
  15. package/dist/src/core/dbPathService.js.map +1 -1
  16. package/dist/src/panel/server.d.ts.map +1 -1
  17. package/dist/src/panel/server.js +35 -0
  18. package/dist/src/panel/server.js.map +1 -1
  19. package/dist/src/services/assistantService.d.ts +19 -0
  20. package/dist/src/services/assistantService.d.ts.map +1 -1
  21. package/dist/src/services/assistantService.js +20 -0
  22. package/dist/src/services/assistantService.js.map +1 -1
  23. package/dist/src/services/assistantTools.d.ts +27 -1
  24. package/dist/src/services/assistantTools.d.ts.map +1 -1
  25. package/dist/src/services/assistantTools.js +169 -35
  26. package/dist/src/services/assistantTools.js.map +1 -1
  27. package/dist/src/services/configService.d.ts +2 -0
  28. package/dist/src/services/configService.d.ts.map +1 -1
  29. package/dist/src/services/configService.js +3 -2
  30. package/dist/src/services/configService.js.map +1 -1
  31. package/dist/src/services/exportService.d.ts +43 -0
  32. package/dist/src/services/exportService.d.ts.map +1 -1
  33. package/dist/src/services/exportService.js +116 -11
  34. package/dist/src/services/exportService.js.map +1 -1
  35. package/dist/src/services/messageQuery.d.ts +18 -0
  36. package/dist/src/services/messageQuery.d.ts.map +1 -1
  37. package/dist/src/services/messageQuery.js +29 -0
  38. package/dist/src/services/messageQuery.js.map +1 -1
  39. package/dist/src/services/wechatClient.d.ts +125 -0
  40. package/dist/src/services/wechatClient.d.ts.map +1 -0
  41. package/dist/src/services/wechatClient.js +344 -0
  42. package/dist/src/services/wechatClient.js.map +1 -0
  43. package/dist/src/services/wechatMedia.d.ts +44 -0
  44. package/dist/src/services/wechatMedia.d.ts.map +1 -0
  45. package/dist/src/services/wechatMedia.js +155 -0
  46. package/dist/src/services/wechatMedia.js.map +1 -0
  47. package/dist/src/services/wechatMessageService.d.ts +11 -0
  48. package/dist/src/services/wechatMessageService.d.ts.map +1 -1
  49. package/dist/src/services/wechatMessageService.js +55 -11
  50. package/dist/src/services/wechatMessageService.js.map +1 -1
  51. package/dist/src/types.d.ts +4 -0
  52. package/dist/src/types.d.ts.map +1 -1
  53. package/docs/CONTACT_DB_SCHEMA.md +1085 -0
  54. package/docs/DECISIONS.md +1274 -0
  55. package/docs/EXTENDING.md +69 -7
  56. package/docs/FUNCTIONAL-IMPROVEMENT-SPEC.md +27 -0
  57. package/docs/HEALTH-CHECK.md +12 -7
  58. package/docs/JEV/345/272/224/347/224/250/346/226/275/345/267/245/346/226/207/346/241/243.md +2 -2
  59. package/docs/MCP.md +2 -2
  60. package/docs/PROJECT_STATE.md +64 -5
  61. package/docs/RELEASING.md +128 -1
  62. package/docs/images/weflow-architecture-gpt-image-2.png +0 -0
  63. package/logo.png +0 -0
  64. package/mcp-server/index.ts +18 -3
  65. package/package.json +5 -3
  66. package/resources/js/graph3d/NOTICE.txt +35 -0
  67. package/resources/js/graph3d/d3-binarytree.min.js +2 -0
  68. package/resources/js/graph3d/d3-dispatch.min.js +2 -0
  69. package/resources/js/graph3d/d3-force-3d.min.js +2 -0
  70. package/resources/js/graph3d/d3-octree.min.js +2 -0
  71. package/resources/js/graph3d/d3-quadtree.min.js +2 -0
  72. package/resources/js/graph3d/d3-timer.min.js +2 -0
  73. package/resources/js/graph3d/layout.mjs +63 -0
  74. package/resources/js/graph3d/three.min.js +6 -0
  75. package/resources/js/graph3d/viewer2d.js +448 -0
  76. package/resources/panel/index.html +12 -0
  77. package/resources/panel/mascot-blink-1.png +0 -0
  78. package/resources/panel/mascot-blink-2.png +0 -0
  79. package/resources/panel/mascot-lift-down-1.png +0 -0
  80. package/resources/panel/mascot-lift-down-2.png +0 -0
  81. package/resources/panel/mascot-lift-down-3.png +0 -0
  82. package/resources/panel/mascot-lift-down-4.png +0 -0
  83. package/resources/panel/mascot-lift-down-5.png +0 -0
  84. package/resources/panel/mascot-lift-down-6.png +0 -0
  85. package/resources/panel/mascot-lift-up-1.png +0 -0
  86. package/resources/panel/mascot-lift-up-2.png +0 -0
  87. package/resources/panel/mascot-lift-up-3.png +0 -0
  88. package/resources/panel/mascot-lift-up-4.png +0 -0
  89. package/resources/panel/mascot-lift-up-5.png +0 -0
  90. package/resources/panel/mascot-lift-up-6.png +0 -0
  91. package/resources/panel/mascot-tickle-1.png +0 -0
  92. package/resources/panel/mascot-tickle-2.png +0 -0
  93. package/resources/panel/mascot-tickle-3.png +0 -0
  94. package/resources/panel/mascot-tickle-4.png +0 -0
  95. package/resources/panel/panel.css +111 -0
  96. package/resources/panel/renderer.js +480 -8
  97. package/scripts/_utils.py +1203 -977
  98. package/scripts/biz_daily.py +25 -10
  99. package/scripts/chat_notes.py +15 -5
  100. package/scripts/check_readme_commands.py +426 -0
  101. package/scripts/compile_wiki.py +163 -57
  102. package/scripts/contact_schema.py +339 -0
  103. package/scripts/data/wechat_emoji.json +225 -0
  104. package/scripts/export_chat_html.py +346 -6
  105. package/scripts/fav_notes.py +4 -1
  106. package/scripts/graph_2d.py +151 -0
  107. package/scripts/graph_3d.py +646 -0
  108. package/scripts/health_check.py +163 -26
  109. package/scripts/nt_decrypt.py +3 -3
  110. package/scripts/panel_frames.py +683 -0
  111. package/scripts/pipeline.py +21 -10
  112. package/scripts/quality_eval.py +5 -0
  113. package/scripts/rag_chat.py +33 -16
  114. package/scripts/reply_debt.py +26 -6
  115. package/scripts/semantic_search.py +212 -58
  116. package/scripts/vault_rag.py +42 -16
  117. package/scripts/vault_search.py +44 -8
  118. package/scripts/wechat_emoticon.py +6 -0
  119. package/scripts/wiki_lint.py +94 -17
  120. package/src/core/dbPathService.ts +22 -4
  121. package/src/panel/server.ts +33 -0
  122. package/src/services/assistantService.ts +26 -0
  123. package/src/services/assistantTools.ts +2452 -2319
  124. package/src/services/configService.ts +5 -2
  125. package/src/services/exportService.ts +129 -12
  126. package/src/services/messageQuery.ts +29 -0
  127. package/src/services/wechatClient.ts +380 -0
  128. package/src/services/wechatMedia.ts +166 -0
  129. package/src/services/wechatMessageService.ts +62 -11
  130. package/src/types.ts +4 -0
  131. package/dist/src/utils/wechatEmoji.d.ts +0 -5
  132. package/dist/src/utils/wechatEmoji.d.ts.map +0 -1
  133. package/dist/src/utils/wechatEmoji.js +0 -35
  134. package/dist/src/utils/wechatEmoji.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  # Project State
2
2
 
3
- > Last reviewed: 2026-10-01 (the historical backfill can fetch one topic at a time - `--topic AI` uses the classifier the script already had, `_guess_topic`, which reads only an article's title and its account name and never the body, so it selects exactly the articles a full run would file under that topic: over 2025-09-05 ~ 2026-03-02 the untouched backlog is 9,207 articles across 156 days (official accounts only, `gh_%`), 1,758 of them AI, and a full run needs 3,929 network fetches against the AI run's 1,208 (the rest already carry enough text in the database); the window has since been fetched in full - **8,754** articles over 157 days in an archive whose index matches the directory on **every** day, then carried through reading notes and cards into the Vault, which now holds **49,953** concept pages with **0** broken links. A day written that way is **partial and says so** - `topicFilter` in `.articles.json`, the missing topics named in its README, and `day_done` refusing to treat it as finished, so a later full run still covers it; auditing that turned up the same defect already shipped in `--limit-per-day`, where a sliced day read as complete and everything past the limit was silently out of scope, which now carries its own marker and is redone on the next run (D-060); previously, 2026-09-28 (the Vault's copy of an article is cleaned as it is copied in - the eight WeChat interface phrases go, the frontmatter and any fenced code block stay, and the fetched original in `output/biz-daily` stays byte-for-byte (D-055); the rule that decides which days that copy covers had been keyed off a `backfilled` marker that only one of the two writers sets, so **12 days were never copied and never reported as skipped** - it now asks whether the day holds an article, 187 → 199 days; `wiki lint`'s duplicate-title report was **rebuilt**, not re-tuned: the old rule (a common substring of ≥5 characters covering ≥40% of the shorter title) had gone from useful at 5,062 pages to **424,697 groups** at 22,374, so it now reports two tiers - 314 groups that differ only in spacing/hyphen/case/plural and use the **same normaliser as `wiki compile --merge-duplicates`** (so the list is directly executable; measured, every group is one that tool would merge), and 378 groups where one name is the other plus a qualifier, labelled as a lead rather than a conclusion because hand-sampling puts its precision near half (a "hub" filter takes out the worst of it - `agent` alone is contained in 731 names). Per-directory, because the two concept directories are two knowledge bases and the merge tool runs per directory - the first version compared across both and so told the reader that two cross-line groups were mergeable when the tool could never touch them; the merge was then run on the resulting list, absorbing **341 pages** (338 article-line, 3 chat-line) into their duplicates, and `wiki lint` still reports **0 broken links** because `aliases` catch the old names. That run also exposed a latent defect in the merge itself: it carried `sources:` over from the surviving page only, so **all 315 merged groups** lost at least one card name from their frontmatter. That key drives `来源/文章|聊天|收藏` tag inference, so the fix is to union it, and the 315 pages were repaired from the pre-merge backup. Measured afterwards: the loss changed no tag, because **0 of 22,033 pages carry sources from more than one line** - latent, not live; the knowledge base now holds **35,463** article copies, **34,092** reading notes and **22,374** concept pages across both lines, most of the article ones built with no model call; previously, 2026-09-27 (the two knowledge bases - articles and conversations - were split into one Vault with two directories, `Wiki/Concepts` and `Chat/Concepts`, which meant teaching five readers that a second directory exists, since reading one of two halves the results silently rather than failing; `wiki lint` went from 7,872 broken links to 0; previously, 2026-09-26: the knowledge base has a health check and a gate on what deserves a page - 120 article notes produced 387 concepts of which 37 were durable, and the 108 resulting pages (86 from articles, 6 from conversations, 6 from WeChat favourites, 5 from the user's own notes - a fourth source added the same day, which reads hand-written notes read-only and marks its summaries as model readings) passed `wiki lint` with 0 breaks, and the generated vault now explains itself (generated-vs-hand-edited, `verified: false`, `知识/概念` and `来源/文章|聊天|收藏` nested tags, and the graph-filter string to use - conventions borrowed from a local Obsidian vault built for exam prep); a 1200-token cap was truncating the chat line's JSON on long conversations and is now 2000; the WeChat channel reports an expired token instead of retrying forever; conversations now feed the knowledge base as cards the existing wiki pipeline aggregates; drafted replies: text only, never sent, and never judged against the user's own last message; the assistant may not invent a reason for a tool failure; every extension point in docs/EXTENDING.md now names the test that catches a missed step; extension is in-repo or over MCP, by decision). This is the current maintenance snapshot, not a release note. Keep it factual and update it with meaningful project changes.
3
+ > Last reviewed: 2026-10-02 (the historical backfill can fetch one topic at a time - `--topic AI` uses the classifier the script already had, `_guess_topic`, which reads only an article's title and its account name and never the body, so it selects exactly the articles a full run would file under that topic: over 2025-09-05 ~ 2026-03-02 the untouched backlog is 9,207 articles across 156 days (official accounts only, `gh_%`), 1,758 of them AI, and a full run needs 3,929 network fetches against the AI run's 1,208 (the rest already carry enough text in the database); the window has since been fetched in full - **8,754** articles over 157 days in an archive whose index matches the directory on **every** day, then carried through reading notes and cards into the Vault, which now holds **49,953** concept pages with **0** broken links. A day written that way is **partial and says so** - `topicFilter` in `.articles.json`, the missing topics named in its README, and `day_done` refusing to treat it as finished, so a later full run still covers it; auditing that turned up the same defect already shipped in `--limit-per-day`, where a sliced day read as complete and everything past the limit was silently out of scope, which now carries its own marker and is redone on the next run (D-060); previously, 2026-09-28 (the Vault's copy of an article is cleaned as it is copied in - the eight WeChat interface phrases go, the frontmatter and any fenced code block stay, and the fetched original in `output/biz-daily` stays byte-for-byte (D-055); the rule that decides which days that copy covers had been keyed off a `backfilled` marker that only one of the two writers sets, so **12 days were never copied and never reported as skipped** - it now asks whether the day holds an article, 187 → 199 days; `wiki lint`'s duplicate-title report was **rebuilt**, not re-tuned: the old rule (a common substring of ≥5 characters covering ≥40% of the shorter title) had gone from useful at 5,062 pages to **424,697 groups** at 22,374, so it now reports two tiers - 314 groups that differ only in spacing/hyphen/case/plural and use the **same normaliser as `wiki compile --merge-duplicates`** (so the list is directly executable; measured, every group is one that tool would merge), and 378 groups where one name is the other plus a qualifier, labelled as a lead rather than a conclusion because hand-sampling puts its precision near half (a "hub" filter takes out the worst of it - `agent` alone is contained in 731 names). Per-directory, because the two concept directories are two knowledge bases and the merge tool runs per directory - the first version compared across both and so told the reader that two cross-line groups were mergeable when the tool could never touch them; the merge was then run on the resulting list, absorbing **341 pages** (338 article-line, 3 chat-line) into their duplicates, and `wiki lint` still reports **0 broken links** because `aliases` catch the old names. That run also exposed a latent defect in the merge itself: it carried `sources:` over from the surviving page only, so **all 315 merged groups** lost at least one card name from their frontmatter. That key drives `来源/文章|聊天|收藏` tag inference, so the fix is to union it, and the 315 pages were repaired from the pre-merge backup. Measured afterwards: the loss changed no tag, because **0 of 22,033 pages carry sources from more than one line** - latent, not live; the knowledge base now holds **35,463** article copies, **34,092** reading notes and **22,374** concept pages across both lines, most of the article ones built with no model call; previously, 2026-09-27 (the two knowledge bases - articles and conversations - were split into one Vault with two directories, `Wiki/Concepts` and `Chat/Concepts`, which meant teaching five readers that a second directory exists, since reading one of two halves the results silently rather than failing; `wiki lint` went from 7,872 broken links to 0; previously, 2026-09-26: the knowledge base has a health check and a gate on what deserves a page - 120 article notes produced 387 concepts of which 37 were durable, and the 108 resulting pages (86 from articles, 6 from conversations, 6 from WeChat favourites, 5 from the user's own notes - a fourth source added the same day, which reads hand-written notes read-only and marks its summaries as model readings) passed `wiki lint` with 0 breaks, and the generated vault now explains itself (generated-vs-hand-edited, `verified: false`, `知识/概念` and `来源/文章|聊天|收藏` nested tags, and the graph-filter string to use - conventions borrowed from a local Obsidian vault built for exam prep); a 1200-token cap was truncating the chat line's JSON on long conversations and is now 2000; the WeChat channel reports an expired token instead of retrying forever; conversations now feed the knowledge base as cards the existing wiki pipeline aggregates; drafted replies: text only, never sent, and never judged against the user's own last message; the assistant may not invent a reason for a tool failure; every extension point in docs/EXTENDING.md now names the test that catches a missed step; extension is in-repo or over MCP, by decision). This is the current maintenance snapshot, not a release note. Keep it factual and update it with meaningful project changes.
4
4
 
5
5
  ## Purpose
6
6
 
@@ -14,15 +14,23 @@ WeFlow CLI is a local-first command-line tool and MCP server for user-authorized
14
14
  - Compiled/package command: `node cli.cjs <command>`; CLI, MCP, database, export, and assistant services resolve resources from the same package root in both source and compiled layouts.
15
15
  - Build check: `npm run build`.
16
16
  - Regression check: `npm test`.
17
+ - CI: three jobs (`node`, `python`, `release-consistency`) on ubuntu. **Both test jobs had been failing on every single run for at least 60 runs before 2026-10-11**, so nothing in CI was actually gating anything; the causes were Windows path semantics in `wechatClient`, a stale dependency list in the python job, and six tests that read the **developer's machine** (knowledge-base root, privacy config, timezone) rather than a fixture. Green as of 2026-10-11. Failing test names are emitted as **annotations**, because the step logs live in blob storage this machine cannot reach (`gh run view --log-failed` vs `--json`, measured). Five `health_check` cases that used to carry `skipIf(os.name != 'nt')` - and therefore never ran in CI at all - now pin the platform instead, so the scheduled-task row has coverage there too.
18
+ - Command surface: `scripts/check_readme_commands.py` checks **three hand-written command surfaces** - every `weflow-cli ...` line (and every `node …/cli.cjs <cmd>` / `npx tsx bin/weflow-cli.ts <cmd>` invocation, which is the same thing written differently) in the fenced code blocks of the **user-facing docs** (the two READMEs, the root docs, `docs/*.md` except `CHANGELOG.md`/`DECISIONS.md`, which quote past commands), every `python|py scripts/x.py --flag` call in those same blocks (judged by AST - the scripts are never run, per the repo's discipline), and every hand-written `cli:` **and `preview:`** string in `capabilities --json` (the `preview:` half is the two-phase convention's first step, i.e. a promise users and agents act on; that output's MCP half is derived from the real registry, so only the hand-written half needs this) - against the **built CLI** (it walks the CLI's own `--help` `Usage:` lines and compares flags against that command's help), and runs in the CI `node` job after the build. The doc-command surface has an anti-empty-scan; `--self-test` carries ten positive controls. Measured state 2026-10-11: **277 doc commands + 24 script calls + 46 invocations from the 45 `cli:`/`preview:` strings, 0 mismatches**. This is the check for the `1.5.0` failure - two months of drift left the README telling users to run `init --path`, which the CLI answered with `unknown option` - and on 2026-10-11 it found the same shape again: `docs/OPERATIONS.md` taught `search --no-rerank`, which the CLI did not have (now wired; `test/search-cli.test.ts` pins that class).
19
+ - npm package contents: what ships is `package.json` -> `files`, and it is an allowlist of **directories and globs** - a file added just outside a listed pattern is dropped with nothing going red. `test/pack-contents.test.ts` asserts the positive side against a real `npm pack --dry-run --json`: every tracked file under `scripts/` ships except the dev-only `.ts`/`.mjs` ones (the `.mjs` is a verification tool that needs a GPU browser), every local image the two READMEs reference ships, and no `dist/` file lacks a matching source (`tsc` never prunes, so a renamed source used to keep shipping - four such files were removed on 2026-10-11). The negative side (nothing from `output/` or `models/`, no keys) is the CI `release-consistency` job. Both halves mattered on 2026-10-11: the published `1.9.0` tarball was missing `scripts/data/wechat_emoji.json` (the emoji fallback map `scripts/wechat_emoji.py` reads) and `logo.png`, so npm installs rendered a batch of face codes as literal text and the package page showed a broken logo.
17
20
  - Downstream data contract: local JSON export is the first compatibility boundary for `she-love-me` and future consumers; see `docs/DATA_CONTRACT.md`.
18
21
  - Supported focus: Windows WeChat 4.x; Linux WeChat 4.x has an NT database path; macOS requires user-provided local access credentials for initialization.
22
+ The version actually verified on this machine is **4.1.15.13** (2026-10-11) - and the way to read that is the live
23
+ process's `--user-lib-dir`, **not** the version literal inside `Weixin.exe` (that one is only a fallback for when the
24
+ primary load path fails; two of this machine's four version *directories* are install leftovers, one of which holds a
25
+ single file - see `docs/CONTACT_DB_SCHEMA.md`, which also records which directories are actually usable).
19
26
 
20
27
  ## Verified Capabilities
21
28
 
22
29
  | Area | Current state | Main entry points |
23
30
  | --- | --- | --- |
24
31
  | Local chat data | Query sessions, contacts, messages, favorites, Moments cache, and exports. HTML chat exports decode NT compressed media records, locally cached WeChat 4.x V2 image containers, entity-escaped emoji XML, and remote emoticons; app cards preserve links and embed available公众号/Bilibili covers. Media matching prefers server-message resources, exact local-message-ID plus timestamp pairs, and a unique local-ID fallback; high-bit encoded image rows are resolved through the same conversation cache. | `sessions`, `contacts`, `messages`, `export`, `fav`, `sns` |
25
- | Initialization | Verify and reuse existing local database access by default; refresh only when needed. Missing-key tests can run without changing saved configuration. | `init`, `init --refresh`, `init --test-missing-keys`, `config forget-keys`, `check` |
32
+ | Initialization | Verify and reuse existing local database access by default; refresh only when needed. Missing-key tests can run without changing saved configuration. Data-root discovery asks the **running client** first (its command line carries `--wechat-files-path`; the other two routes guess from the folder name) and reports which source won; a hint still has to pass the same structural check. | `init`, `init --refresh`, `init --test-missing-keys`, `config forget-keys`, `check` |
33
+ | Environment / diagnosis | `check` (and the scheduled `health_check`) reports the **WeChat build actually loaded**, read from the live process's `--user-lib-dir` rather than from the version literal inside `Weixin.exe` (that one is only a fallback - D-107), and flags version directories that cannot work (no `Weixin.dll`). When the client is not running it says *unknown*, and a missing field counts as a failure so a stale build cannot pass. Verified on this machine: `4.1.15.13` loaded, `4.1.15.11\` (one file) flagged as a leftover. | `check`, `check --json`, `scripts/health_check.py` |
26
34
  | Relationship temperature | Who is going quiet, who is heating up, and who is reachable **only** here. Reads the local message database directly: read-only, no model, no network (D-062). Three groups - `cooling` (substantial history then silence, ranked by messages x silent days), `heating` (last 7 days at least twice the long-run daily rate), `only-wechat` (no phone/email/meeting-up ever appears in the history). Only 1:1 chats, only text messages, and only accounts whose **id shape** is a person: anything with `@` (`@chatroom`/`@openim`/`@weclaw`), `filehelper` or `gh_` is out - ranking by volume alone produced no information, and the first irreplaceability rule was inverted (it is trivially true of bots, so it put a coffee-shop bot first). Accounts that look like a person but whose name reads as a shop are **flagged, not dropped**, and every exclusion is printed with its reason. Deliberately **not** in the assistant or MCP tool tables: its output is an inference about third parties. | `bonds` |
27
35
  | Official-account daily | Filter configured sources, preserve source categories, backfill incomplete yesterday output before an unqualified today run, fetch articles, classify them, create summaries, generate a local HTML reader, and synchronize reader favorites into local files. Topic (6-way), relevance (3-level) and "does this belong in today's report" (yes/no) are decided by TypeSafe's Jev when `typesafeApiKey` is configured - concurrently, before the serial summary loop (12 articles in 3.3s at 6 workers against ~12s one at a time), and by the previous LLM-parse path otherwise; `--classifier llm` forces the latter. The report's admission rule is applied on both loader paths and can be bypassed with `--include-all`. | `daily`, `daily favorites`, `daily-stats`, `daily-server` |
28
36
  | Knowledge workflows | Wiki compilation (`compile_wiki` aggregates `[[concept]]` links into Vault pages; **the article corpus produced none as of 2026-09-26** (the 1,633 article notes then in the Vault carried only their own topic link and `## 关联网络` path links, measured over the whole corpus), so an article-side concept-extraction step was missing; `article-notes` (added the same day) is that step, and it works: 30 article notes produced 110 concepts and 10 concept pages on this machine, which are now the first knowledge pages the assistant can search (`vault search`, `search_knowledge`). The corpus has grown since - 7,119 concept cards, and 22,374 concept pages across both lines as of 2026-09-28. The degeneracy reported in that trial was an artefact of a 120-card sample: with all 710 September articles carded, the topic field splits into 学术/新闻/政治 (62/33/25 of 108 pages), so the earlier "the classifier puts everything in one bucket" judgement is withdrawn. Two upstream noise sources showed up in that trial. The first - WeChat reader UI text inside article summaries - is **fixed**, and the backfill this line used to defer has since been run: measured over the corpus it was 1,484 of 1,633 notes (the corpus has grown to 34,092 since), the cleaner runs on both write paths, and `create_reading_notes --clean-summaries` took the existing notes to **0**; the Vault's `Sources/WeChat` copies were cleaned on 2026-09-28 as well (D-055), so the residue now survives only in `output/biz-daily`, which is the archive. The second is **measured but not fixed**: of 224 notes whose titles read as news, 40 are labelled `学术` - that classifier belongs to the daily pipeline and changing its criteria without labels would be a guess. Fed by both sources: `output/biz-daily` articles and, since 2026-09-26, `output/chat-notes` conversation cards produced by the confirmed `chat-notes` command - which, since 2026-10-01, carries voice messages as **text** rather than a bare `[语音]`: it reads the local faster-whisper transcript cache (content-addressed, `output/.voice-cache` - one definition, in `wechat_voice`) and labels each one `[语音·本机转写·未校对]`, because a machine transcript of someone's speech may be wrong and the model must not quote it as fact. Measured on the 30-day window: **54 of 125** voice messages carry text that used to be a placeholder; the ones still missing are counted and printed, and `--transcribe-voice` fills them locally (the cache is the progress, so an interrupted run resumes); **the graph is also kept free of duplicate nodes by `wiki compile --merge-duplicates`** (74 groups merged, 80 pages removed, and 98 links that pointed at the removed names still resolve through `aliases` - see D-053); **most of the article line's pages were never written by a model** - `wiki compile --pages-from-cards` assembles a page from material the cards already carry (the definition is the card's own `desc`, the related concepts are the other concepts from the same article, the source is that article) and marks it `summary_by: card`. That label is deliberate and is not the same as "no model was involved": the `desc` line was written by `article_notes`, so the quality is that line's quality, and a few read as meta-descriptions of where the term appeared rather than as definitions. 17,383 pages at ¥0; the model-based route was priced at ¥31 and rejected, because every one of those concepts is mentioned by exactly one article (D-054); **the pages accumulate only if `wiki compile --refresh-sources` is run** - `wiki compile` itself only builds pages for concepts that do not have one, so an existing page never gains an edge (measured: one run added 3,164 edges across 324 article-line pages; on 2026-10-01, after the whole
@@ -98,18 +106,38 @@ called `get_messages` and refused without ever reaching for `draft_reply`, so an
98
106
  ['draft_reply']` (the first version of that case) would have failed on the first run and sent someone chasing a
99
107
  defect that does not exist; asserting the **outcome** instead is what the memory cases already argued for
100
108
  (`memory-recall` judges "was it used", not "was `save_memory` called"). Two of the ten are **out of scope here by design**: `fetch_article` and `search_public` leave the machine, and the harness rejects any egress other than the model call ("a second exit means something leaked"). `get_concepts` and `get_review` were in that gap too and are now covered (see below), which required the harness to be able to lay down fixture files and set the environment variables that point the tools at them. The write cases also brought a new floor, `neverSucceeds`: if the named tool was called at all, that call must have produced nothing (read from the trace), so both "asked the user instead of writing" and "called the tool and was refused" pass while an actual write fails - the first live run of `todo-ambiguous-refused` failed because the expectation first written was too narrow (`mustCall: set_todo_status`), and the model had done the better thing (asked which of the two todos to mark). One case (`ambiguous-contact`) runs over its efficiency budget of 3 most times - measured over four runs on 2026-09-30 it used **6, 6, 2 and 4** tool calls, so it varies rather than having shifted once (the earlier note that "a single run cannot say" is now answered by those four runs). The floors pass every time and the traces show it **re-querying the same thing** (`list_sessions` two or three times) rather than failing, so this is a routing-efficiency question, not a broken promise. **A fixture gap found the same day did not explain it**: `listContacts` had never been stubbed, so `list_contacts` in the eval hit the real service against a temp home with no contacts and always came back empty - two cases were therefore running on "the real service happens to find nothing" while this entry claims synthetic data, and a change in that service would have moved the eval silently. The stub was added (contacts derive from the case's own sessions), and four more runs of the case gave **2, 6, 2 and 2** - the spread is unchanged, so the extra calls are the model exploring routes, not the fixture (the slow runs also reach for `search_chats`). Recorded as a negative result rather than a fix and asserts floor conditions: was the tool that could answer actually called, and were tools avoided when none was needed; did tool usage stay bounded; **is a failing tool reported as failing** (exit code 2 produces a reply quoting the error and offering an alternative, not "no one is waiting"); is an unknown contact ever given invented content; is memory judged by the fact landing in long-term memory rather than by whether `save_memory` was called; does an ambiguous contact name get a question back instead of a guess; are two asks in one message both served; and is a refused fetch (an internal address in favourites) reported as a refusal rather than summarised. Synthetic data, temporary home directory (the real audit and memory files stay untouched - a second writer would clobber the daemon's), and only the model call may leave the process. The expectations are the author's, **not human labels**, so this measures floors and not quality; a first green run proves little (cases and behaviour share an author) and the value is in re-running it after a change. Assertions must key off the tool's own diagnostics, never the model's wording - this suite's own first version asserted "查不到" and produced two false failures on "查不了". The criterion that follows from it, applied once more in `todos-never-extracted`: an expectation that moves with the model's phrasing is a budget, not a floor. That case first asserted "the reply mentions extraction" as a hard floor and passed three clean runs; putting the old tool behaviour back (mutation) still passed once before failing once - the model has its own ways of saying it - so the assertion now rides the soft channel, and the deterministic guard for the distinction lives in `test/assistant-tools-branches.test.ts`. Not in `npm test`: it needs network and money. | `npm run eval:assistant`, `--only=<case>`, `--json` |
109
+ | Graph pages (3D / 2D) | `weflow-cli wiki graph` renders the concept graph as a **self-contained** HTML page - on this machine 49,956 concepts / 145,794 links / 9.05 MB (2026-10-02). The libraries, the data and the coordinates are all inlined, so it opens by double-click with **no server and no network**: a `file://` page cannot `fetch` its data (CORS), and a CDN reference would make a local-first feature depend on the network. The layout (250 ticks - the slow part, measured at ~55 s for half this size) is computed at build time by Node and cached under `output/.graph3d-cache/`, so changing only the rendering does not recompute it. The vendored three.js r147 and six d3 modules live in `resources/js/graph3d/` with versions and licences in `NOTICE.txt` beside them. It can be filtered to the structure that matters: `--min-degree N` keeps only concepts whose **whole-graph** degree is at least N (measured: 3,825 of the 49,956 have 10 or more links, and the filtered page is 1.09 MB against the full page's 9.05 MB), and `--line wiki|chat` draws one corpus at a time (48k article concepts vs 1,527 chat ones - different vocabularies that hide each other's structure when merged). Links pointing at removed nodes are dropped with them, because a dangling link makes the force layout fail with "node not found"; the layout cache is keyed by a hash of the data so building the small page no longer evicts the 50k-node coordinates. `test/graph-3d-cli.test.ts` pins that the emitted page carries **no** external reference, that the two library lists (`graph_3d.py` / `layout.mjs`) agree, that `--dry-run` writes nothing, that the filters change the counts and drop dangling links, that the CLI declares **and** forwards both flags, and that a hand-run without the CLI's `PYTHONIOENCODING` still prints readable UTF-8 (this machine's console is GBK). **`--flat` adds a 2D canvas page** (`output/knowledge-graph-2d.html`): the layout is a *separate* build-time solve rather than a flattening of the 3D coordinates - the z axis carries structure, so dropping it stacks unrelated clusters on top of each other - and it is much cheaper (3,825 nodes / 250 ticks in **2.4 s**, against ~55 s for the 3D solve at 25k), so the page is 0.71 MB and needs **no libraries at all** (the layout is precomputed; the renderer is plain canvas, so not even three.js is inlined). Interaction is drag-to-pan, wheel-to-zoom, hover for a name, click to dim everything but a concept and its neighbours, and a search box; `--min-degree` / `--line` apply unchanged, and the 2D and 3D coordinates cache separately (the digest includes the dimension). `test/graph-2d-cli.test.ts` carries a **render smoke test**: it runs the viewer over a fake canvas context and counts the `arc` / `lineTo` / `fillText` calls, because a JS error in a viewer yields a blank page with no failing assertion anywhere. **Performance was then measured in a real headless Edge over CDP** (Node built-in WebSocket, no puppeteer): one `draw()` at 49,956 nodes cost 12.78 ms, of which 50,000 `arc` calls were 9.0 ms against 3.4 ms for the same number of `rect` calls - so sub-2px dots are now squares and interaction redraws are coalesced to one per frame (the handlers used to redraw on every `pointermove`, which is what actually felt laggy). After: 7.6 ms per frame and a 200-event drag storm in 6.9 ms instead of ~2.6 s. Labels are capped and de-overlapped, because at 50k the top-degree concepts are all hubs in the middle and eighty names landed on top of each other. **The 2D solve uses its own force parameters** (stronger repulsion, longer links): the 3D numbers in one dimension fewer pack everything into a featureless disc. The layout cache key covers the data, the dimensions, the tick count **and** those parameters - it used to cover the data only, which silently served stale coordinates after a parameter change (`test/graph_layout_key_test.py`). At 50k a 2D force layout is still a texture rather than a map; the `--min-degree 10` page (3,825 nodes) is the one that reads as structure. |
101
110
  | Assistant | Optional WeChat Bot-channel assistant: 31 local tools (12 originally; plus chat search, reply debt, semantic search and chat export, with export in html/txt/json/excel, Moments "who posts most", favourites without a keyword, and drafted replies). The single write tool (`export_chat`) can only create a new directory under `output/exports/` - the model supplies no path and an existing name gets a numeric suffix, so "never overwrite" is enforced in code. `draft_reply` writes nothing and **sends nothing** (D-047). `evidence-review`, `vault promote`, sending messages and every configuration change are deliberately **not** reachable from a chat message: the first two have their own human-facing confirm gates, sending is irreversible, and configuration is meant to be changed on the machine. 31 local tools, three-layer memory (working window / rolling summary / long-term facts), PII redaction before any cloud call, and a 100-message/day quota. It denies **every** sender until an allowlist is configured. The **single-round fast path** (D-035) is shipped but **off by default** (`assistantFastRoute` = `off` | `log` | `on`): it resolves "needs local data? which capability?" in one decision call and pre-dispatches that tool, so the loop's first request already sees the result (two round trips become one). Only the six tools with closed or empty arguments are routable; everything else falls back, and falling back is byte-identical to the previous behaviour. Measured on 17 questions against the real decision layer: 0 wrong routes, 10 routed concretely, ~1.33 s per decision, 2 fell back (`scripts/assistant_route_probe.ts`; those expectations are the author's, not human labels). Covered by synthetic harnesses (stubbed `callLLM`, stubbed `chatService`/`wereadService` singletons, a replaced `fetch`, a stubbed message channel, an injected route decider, temp `HOME`): per-message logic, **all 31 tool branches** (2026-09-29: the last uncovered one, `get_daily_report`, got the `WEFLOW_ASSISTANT_BIZ_DAILY_DIR` injection point its own coverage note had been asking for - read per call, so a test can swap fixtures; it is now asserted against a fixture instead of a "there may or may not be data" shape check), the resident loop itself - who is denied, the three group controls, the serial queue, the 100/day quota with its date rollover - the **privacy wiring** (which `aiEngine` values count as local inference, where `engineConfig` sends the request, and `reviewEvidence` refusing to send chat text to the cloud without `--allow-cloud`), and the fast path (correct / wrong / uncertain / log-only / no dispatch without the audit line). `get_todos` is executed through `pythonBridge`'s injectable runner (empty list, urgency and deadline rendering, the 15-row cap, a classified failure whose `stderr` is redacted, and "no JSON" not being read as "no todos"). It also keeps "no pending todos" apart from "extraction has never been run" (D-044): the emptiness has a cause of its own on a machine where `todos extract` was never invoked, so the tool names that cause and the command that would fill the list instead of reporting "nothing to do". The list is extracted from chat logs only by an explicit, confirmed command; nothing schedules it. Note on that claim's history: an earlier revision of this line - and the commit message for the `pythonBridge` refactor - asserted this coverage before any such test existed; it was written in prose only, and the file's own header comment said the opposite. The tests are real as of this revision. The assistant is time-aware: the system prompt opens with the current local date and weekday, and `get_messages` takes `since`/`until` (a date or `3d`/`2w`/`12h`) so a specific past day is reachable - before this, a day far enough back could not be fetched at all. An identical tool call repeated within one turn is answered with a note instead of being re-executed. The tool list is built per machine: a tool whose prerequisite is missing (semantic search without `dashscopeApiKey`, WeRead without `wereadApiKey`) is not offered at all, and the fast path - which dispatches directly - checks the same predicate; the filter only drops tools that *cannot* run, never ones that merely have no data yet. Name resolution searches the recent sessions first and then falls back to the contact book (remark / display name / nickname / alias), refusing anything that is not unique - measured on 378 real contacts outside the recent sessions: 362 resolved, 0 resolved to the wrong person. | `login-wechat`, `assistant` |
102
- | 本机面板 (local panel) | A second entrance to the same assistant, for when logging into the Bot channel is not worth it: `weflow-cli panel` opens an always-on-top window (Electron) or a chromeless Edge/Chrome `--app` window when Electron is absent. **The window is only a client** - every turn goes through the daemon's own `runTurn`, so the allowlist path, the 100/day quota counter, the serial queue and the memory file all stay single-writer (D-045). The daemon exposes a **loopback-only** HTTP endpoint (`127.0.0.1:8766`, not configurable) that is deliberately stricter than the daily reader: **every** request needs a per-run token (including `/api/status`), Origin is a second gate, POSTs must be JSON, and only one turn may be in flight (a second one gets 429 rather than being queued, because queueing means it will run and spend quota). The token lives in `~/.weflow-cli/assistant_endpoint.json` (atomic write; readers probe `kill(pid,0)` and verify `service` + `startedAt`, because SIGTERM leaves the file behind) and never reaches a command line: the Electron shell reads it itself and installs it as an `HttpOnly` cookie, while the browser fallback uses a one-time 60-second code from `/api/pair`. The memory bucket decides whether the panel is the same brain as WeChat - it resolves to the single allowlisted id, else it says on screen that it uses a separate bucket (`assistantPanelUser` pins it). Verified live: the browser fallback opened, the pair-code flow returned the page with an `HttpOnly` cookie, a replayed code 401s, and a real question through the endpoint answered from local data while the shared quota counter went 0 -> 3. The floating ball was verified on Windows 11 with Electron 42 (76x76, no caption, always-on-top, renderer authenticated via the cookie, ball visible on screen); with Electron absent the same command falls back to a chromeless Edge/Chrome window and says it cannot give the ball. Ball-to-chat resize and the global hotkey were then exercised **without a click** (DevTools protocol; a differential registration test), which is how two bugs surfaced that a screenshot could not have shown - a non-resizable window ignoring `setSize` on Windows (collapse left it at the expanded size) and a `ready-to-show` listener attached too late (the window sometimes stayed hidden). **Right-clicking in the panel opens a quick-reply menu listing the contacts in `quickReplyContacts` (a config key added for it; the list rides on `/api/status`, which the page already polls every 30 seconds, so no new endpoint and no new IPC). Picking a name asks the assistant to draft for that person through the existing `/api/ask`, so quota, the serial queue, memory and the copy button all come along unchanged. The menu states its own cost (drafting sends that conversation to two cloud models), an empty list shows the command to run instead of an empty box, and the menu is a **native** one (built in the main process from `quick-menu.cjs`) so it draws outside the window - the ball is 96x96 and never has to expand, which is what the first attempt got wrong; the browser fallback does not take over right-click at all, because the native menu's Copy belongs to the user there. That menu's **last item hides the ball** (the only item in it that reaches no model), and it is the one item still present when the list is empty - otherwise a user who never configured the key would get a menu of two grey lines with nothing clickable, including no way to dismiss the ball. It hides rather than quits, so it is deliberately reversible, and the label names the way back (`关闭悬浮球(托盘图标能再打开)`) because the ball runs with `setSkipTaskbar(true)` and would leave nothing on the taskbar to click; the exit actions stay in the tray menu, which already separates them from show/expand (no test ever drives a real right-click, so the menu's *contents* are covered by executing every item's callback in `test/panel-quick-menu.test.ts`). Dragging the ball used to **grow the window by the drag distance** whenever it happened in the chat window: `dragMove` re-read the current size and wrote it back, and that read lags (measured with a probe driving the same IPC sequence: 0 drift with `resizable: false`, exactly the drag delta with `resizable: true`). The extra width showed up as a gap between the ball and the bubble, and expanding re-asserted the exact size - which is why clicking the ball appeared to reset it. The size is now captured once at `dragStart`. **Pressing the ball switches it to a second, closed-eyes face, and releasing reverts it immediately** (a 900ms hold after release was tried first and the user called it stuck; the generated face is composited in only inside an eye-shaped mask, because the endpoint repainted the whole canvas and returned no alpha). The ball stays put and the conversation unfolds beside it** - clicking it opens a bubble to its left (flipping to the right when there is no room, top-aligning when the bubble would run off the top of the work area) and clicking it again closes it; the ball is a toggle and never fades out. The window is "ball + gap + bubble" as one piece (508x560), with the ball pinned to its own corner so it does not move at all; `bubbleLayout` and `ballRectInWindow` in `ball-position.cjs` compute that geometry (pure, tested with synthetic displays, including a round-trip that expand-then-collapse returns the ball to where it started). The mode has one source of truth (the main process announces `{mode, side, anchorY}`; the page only requests), so the ball, the collapse button, the tray and the hotkey take the same path, and `prefers-reduced-motion` stops both halves. Measured on a real window with the real page at 150% scaling: the ball's offset inside the window is exactly 0 at every sample and its screen position varies by at most 1px across a whole expand and collapse (23 and 30 samples), with identical resting positions before and after. Two bugs came out of that measurement rather than out of reading the code: the tween rounded each edge independently so the edge the ball hangs on wobbled 1-2px (since fixed by pinning the corner), and collapsing placed the ball at the window's top-left instead of the corner it sits on, which would have made it jump to the bubble's opposite corner. The platform wrinkle behind some of this: at 150% scaling a request for a 76x76 window yields a ~79px client width (Windows enforces a minimum), which is why the remembered position is the window's, not the ball's visual edge. That arithmetic is a pure module tested against **synthetic** monitor layouts (negative-x second displays, a removed display, a rect larger than the work area) - this machine has one display, so a real second monitor remains unperformed. **The ball's coloured halo is now painted only in the three non-idle states** (`busy` / `offline` / `quota`); while idle the ball is just the mascot, with nothing behind it. It had been on permanently - which was the original request (an animated background) - but that made the mascot PNG's own transparency invisible and, because the same layer is the status light, made offline / busy / quota-out look identical. The `@keyframes drift` and `@property --hue` machinery stays (it drives the busy state); what changed is when the layer is drawn. The test was **rewritten to the new contract, not weakened**: the first version searched the whole stylesheet for each `body.<state> #ball .glow`, which also matches that state's separate `animation: none` rule, so removing a state from the gradient selector still passed - caught by a mutation check, and the assertion now requires the state to appear in the selector of the rule that actually carries the `radial-gradient`. **The right-click menu now has a second section of eight one-click functions** (谁在等我回话 / 待办 / 日报 / 统计 / 阅读统计 / 会话 / 朋友圈 / 微信读书), admitted by a single rule: the action must be completable by **one fixed sentence**, because a native menu cannot collect input - so search/export/read-one-message are excluded rather than shipped as items that do nothing. Each prompt names its tool, which is a request to the model and **not a hard binding** (the assistant still chooses from 19 tools; forcing it is a decision for when a wrong pick is actually observed). The prompt travels with the menu item and the page keeps no id→prompt table (two tables drift into "the menu says A, clicking does B", silently - a test asserts `renderer.js` contains no action id); the cost line is **derived** from the action list rather than written down, because a stale cost warning is worse than none, and it now names which items are cloud calls and which are local reads. The pick payload is `{kind:'contact'|'action', …}` and the page ignores anything else, so a menu from the previous version cannot be dispatched as a draft nobody asked for. All of it verified by executing every item's callback and by two mutation checks (dispatching an action as a draft, and the page keeping its own id table). **The ball's eyes now follow the mouse** (D-059): the main process samples `screen.getCursorScreenPoint()` every 120 ms and pushes the position **only when it changes**, the page eases toward it and stops its rAF loop once it settles. The renderer cannot see the cursor itself - the ball is 96x96 and the pointer is outside it almost always - which is why this needs the main process at all. The ball's face is now **two layers**: `mascot-base.png` (the same art with the iris region repainted as sclera) plus `mascot-iris.png` (the iris, pupil and highlight), composited at zero offset **pixel-identical** to `mascot.png` - a test decodes all three PNGs and asserts that, because same-size / whitelisted / listed-in-`PANEL_FILES` all stay green if the layers are re-cut one pixel off, and a misalignment is visible only to a person. Travel is clamped to an **ellipse** (about 2.6 px sideways, 0.8 up, 2.6 down at the 96 px ball) because those are the measured sclera margins - past them the iris separates from the rim and the eye reads as a sticker sliding. The iris layer is hidden on `busy` / `offline` / `quota` / `ball-happy`, whose faces have their eyes baked in (otherwise there would be two pupils). `prefers-reduced-motion` leaves the eyes still. The cursor position is in-process only, narrowed in `preload.cjs`, never logged and never sent anywhere. **Not yet verified live** - the wiring and the pixel identity are covered by the suite, but the effect has not been run on a real window. **The ball can also be pushed to a screen edge to hide behind it**: drag it until it touches a monitor's left or right edge and let go, and it swaps to a dedicated drawing of the cat **peeking out from behind that edge** - head and front paws out, body hidden, the drawing's left side being a straight cut that lands exactly on the screen edge (`mascot-peek.png`; the right edge reuses it mirrored). The window stays **fully on screen**, flush against the edge - the illusion comes from the artwork, so nothing goes off-screen, the whole ball stays clickable, and a restart simply puts the ball back at the edge rather than losing it. The first click (or drag) brings the normal ball back, and that click deliberately does **not** expand the conversation - on a hidden ball a click means "come back", not "let's talk". Only left and right: top and bottom fight the taskbar and Windows' edge snapping. Two rules carry the effect and both are pinned by tests because everything else stays green without them: the ball's circular clip must be off in this state (a circle would slice the straight cut into an arc) and hover-zoom must be off as well (scale 1.02 lifts the cut 1px off the edge - a visible seam). The snap threshold is deliberately below the normal 24px edge margin, so a ball merely parked is never mistaken for one being pushed off; a test pins that boundary, because raising it past the margin would hide the ball on every release while every other test stayed green. | `panel`, `panel --status`, `panel --ask` |
111
+ | 本机面板 (local panel) | A second entrance to the same assistant, for when logging into the Bot channel is not worth it: `weflow-cli panel` opens an always-on-top window (Electron) or a chromeless Edge/Chrome `--app` window when Electron is absent. **The window is only a client** - every turn goes through the daemon's own `runTurn`, so the allowlist path, the 100/day quota counter, the serial queue and the memory file all stay single-writer (D-045). The daemon exposes a **loopback-only** HTTP endpoint (`127.0.0.1:8766`, not configurable) that is deliberately stricter than the daily reader: **every** request needs a per-run token (including `/api/status`), Origin is a second gate, POSTs must be JSON, and only one turn may be in flight (a second one gets 429 rather than being queued, because queueing means it will run and spend quota). The token lives in `~/.weflow-cli/assistant_endpoint.json` (atomic write; readers probe `kill(pid,0)` and verify `service` + `startedAt`, because SIGTERM leaves the file behind) and never reaches a command line: the Electron shell reads it itself and installs it as an `HttpOnly` cookie, while the browser fallback uses a one-time 60-second code from `/api/pair`. The memory bucket decides whether the panel is the same brain as WeChat - it resolves to the single allowlisted id, else it says on screen that it uses a separate bucket (`assistantPanelUser` pins it). **The panel can show what the assistant remembers** (2026-10-03): a `记忆` button in the bubble header fetches `GET /api/memory` and renders a **read-only** list of the long-term facts, each with the time it was recorded and the quote it came from, so a wrong memory can be traced back to the sentence that produced it. The bucket is decided **server-side** (the same `memoryBucket` the panel already reports) and a query parameter cannot steer it - otherwise the route would be a way to read another memory bucket. **That payload never goes to a model**: it exists for the user to audit what the assistant believes about them, and it is deliberately separate from the fact injection in `buildSystemPrompt`, which has its own budget and redaction. Facts are capped at 30 (`FACTS_MAX`), so the view is bounded by construction; the page renders with `textContent` only, and a test feeds in a memory shaped like an `<img onerror=…>` tag to prove it shows up as text. Verified live: the browser fallback opened, the pair-code flow returned the page with an `HttpOnly` cookie, a replayed code 401s, and a real question through the endpoint answered from local data while the shared quota counter went 0 -> 3. The floating ball was verified on Windows 11 with Electron 42 (76x76, no caption, always-on-top, renderer authenticated via the cookie, ball visible on screen); with Electron absent the same command falls back to a chromeless Edge/Chrome window and says it cannot give the ball. Ball-to-chat resize and the global hotkey were then exercised **without a click** (DevTools protocol; a differential registration test), which is how two bugs surfaced that a screenshot could not have shown - a non-resizable window ignoring `setSize` on Windows (collapse left it at the expanded size) and a `ready-to-show` listener attached too late (the window sometimes stayed hidden). **Right-clicking in the panel opens a quick-reply menu listing the contacts in `quickReplyContacts` (a config key added for it; the list rides on `/api/status`, which the page already polls every 30 seconds, so no new endpoint and no new IPC). Picking a name asks the assistant to draft for that person through the existing `/api/ask`, so quota, the serial queue, memory and the copy button all come along unchanged. The menu states its own cost (drafting sends that conversation to two cloud models), an empty list shows the command to run instead of an empty box, and the menu is a **native** one (built in the main process from `quick-menu.cjs`) so it draws outside the window - the ball is 96x96 and never has to expand, which is what the first attempt got wrong; the browser fallback does not take over right-click at all, because the native menu's Copy belongs to the user there. That menu's **last item hides the ball** (the only item in it that reaches no model), and it is the one item still present when the list is empty - otherwise a user who never configured the key would get a menu of two grey lines with nothing clickable, including no way to dismiss the ball. It hides rather than quits, so it is deliberately reversible, and the label names the way back (`关闭悬浮球(托盘图标能再打开)`) because the ball runs with `setSkipTaskbar(true)` and would leave nothing on the taskbar to click; the exit actions stay in the tray menu, which already separates them from show/expand (no test ever drives a real right-click, so the menu's *contents* are covered by executing every item's callback in `test/panel-quick-menu.test.ts`). Dragging the ball used to **grow the window by the drag distance** whenever it happened in the chat window: `dragMove` re-read the current size and wrote it back, and that read lags (measured with a probe driving the same IPC sequence: 0 drift with `resizable: false`, exactly the drag delta with `resizable: true`). The extra width showed up as a gap between the ball and the bubble, and expanding re-asserted the exact size - which is why clicking the ball appeared to reset it. The size is now captured once at `dragStart`. **Pressing the ball switches it to a second, closed-eyes face, and releasing reverts it immediately** (a 900ms hold after release was tried first and the user called it stuck; the generated face is composited in only inside an eye-shaped mask, because the endpoint repainted the whole canvas and returned no alpha). The ball stays put and the conversation unfolds beside it** - clicking it opens a bubble to its left (flipping to the right when there is no room, top-aligning when the bubble would run off the top of the work area) and clicking it again closes it; the ball is a toggle and never fades out. The window is "ball + gap + bubble" as one piece (508x560), with the ball pinned to its own corner so it does not move at all; `bubbleLayout` and `ballRectInWindow` in `ball-position.cjs` compute that geometry (pure, tested with synthetic displays, including a round-trip that expand-then-collapse returns the ball to where it started). The mode has one source of truth (the main process announces `{mode, side, anchorY}`; the page only requests), so the ball, the collapse button, the tray and the hotkey take the same path, and `prefers-reduced-motion` stops both halves. Measured on a real window with the real page at 150% scaling: the ball's offset inside the window is exactly 0 at every sample and its screen position varies by at most 1px across a whole expand and collapse (23 and 30 samples), with identical resting positions before and after. Two bugs came out of that measurement rather than out of reading the code: the tween rounded each edge independently so the edge the ball hangs on wobbled 1-2px (since fixed by pinning the corner), and collapsing placed the ball at the window's top-left instead of the corner it sits on, which would have made it jump to the bubble's opposite corner. The platform wrinkle behind some of this: at 150% scaling a request for a 76x76 window yields a ~79px client width (Windows enforces a minimum), which is why the remembered position is the window's, not the ball's visual edge. That arithmetic is a pure module tested against **synthetic** monitor layouts (negative-x second displays, a removed display, a rect larger than the work area) - this machine has one display, so a real second monitor remains unperformed. **The ball's coloured halo is gone entirely** (2026-09-29): the element, the three state rules and the `--hue` / `drift` / `breathe` drivers were all deleted, and `test/panel-packaging.test.ts` forbids reintroducing any of them (the user raised the same complaint twice, so the answer was removal rather than "draw less"). **Pressing the ball plays a twelve-frame "picked up by the scruff" animation**: six frames up while it is held (`mascot-lift-up-1..6.png`) and six back down on release (`mascot-lift-down-1..6.png`, then the resting frame `mascot-base.png`), hard cuts about 60 ms apart, the first frame synchronous so a press never shows an empty ball, and no tail after release. The twelve frames are **generated art** (`gpt-image-2-ca` via `/images/edits`; pipeline and contract in `scripts/panel_frames.py`) normalized to: 256x256 RGBA, 0 solid pixels past r=128, farthest solid distance under 0.98 x 128 **measured from the canvas centre with solid = alpha >= 128**, the apex anchored to the resting frame, and the scale taken from **the cat's own bounding box** (`170 x s`) rather than the canvas - the canvas also carries the speech bubble and the shock marks, and letting those set the scale would make a decoration decide the character's size. The silhouette is asserted rather than assumed: the first generation drew the hood as a pointed cone with no ears, moved the cat's aspect ratio from 0.794 to 0.650, and **every geometry assertion still passed**, so the suite now pins the largest connected component's width and aspect ratio. `prefers-reduced-motion` plays no animation and keeps the squint face, which is now that face's only role. **Running the pointer across the ball makes it squirm as if tickled** (2026-10-02): four generated poses (`mascot-tickle-1..4.png`, normalized at scale 1.0 - a tickle must not change the ball's size) cycle every 110 ms, and there is **no tilt** any more (2026-10-02, D-066): the 4-degree rotation that used to be computed in the renderer from the pointer speed was removed because it shared one `rotate` on `#ball` with the lift, which made a casual sweep look like a small take-off - rotation belongs to the lift alone now, and 260 ms without movement settles the poses back. The rotation is about the ball's centre, which is what makes it safe under the circular clip - rotation preserves every pixel's distance from the centre, so the ears cannot be rotated out of the circle (translation would). It is skipped under `prefers-reduced-motion` and while the ball is peek-hidden (that artwork has a straight cut edge that a rotation would open into a seam), and a press settles it so the lift owns the ball. **Not yet verified live** - geometry, wiring and the sequence are covered by `test/panel-lift-frames.test.ts` and `test/panel-lift-sequence.test.ts`, but nobody has watched the animation on a real window yet. The test was **rewritten to the new contract, not weakened**: the first version searched the whole stylesheet for each `body.<state> #ball .glow`, which also matches that state's separate `animation: none` rule, so removing a state from the gradient selector still passed - caught by a mutation check, and the assertion now requires the state to appear in the selector of the rule that actually carries the `radial-gradient`. **The right-click menu now has a second section of eight one-click functions** (谁在等我回话 / 待办 / 日报 / 统计 / 阅读统计 / 会话 / 朋友圈 / 微信读书), admitted by a single rule: the action must be completable by **one fixed sentence**, because a native menu cannot collect input - so search/export/read-one-message are excluded rather than shipped as items that do nothing. Each prompt names its tool, which is a request to the model and **not a hard binding** (the assistant still chooses from 19 tools; forcing it is a decision for when a wrong pick is actually observed). The prompt travels with the menu item and the page keeps no id→prompt table (two tables drift into "the menu says A, clicking does B", silently - a test asserts `renderer.js` contains no action id); the cost line is **derived** from the action list rather than written down, because a stale cost warning is worse than none, and it now names which items are cloud calls and which are local reads. The pick payload is `{kind:'contact'|'action', …}` and the page ignores anything else, so a menu from the previous version cannot be dispatched as a draft nobody asked for. All of it verified by executing every item's callback and by two mutation checks (dispatching an action as a draft, and the page keeping its own id table). **The ball's eyes now follow the mouse** (D-059): the main process samples `screen.getCursorScreenPoint()` every 120 ms and pushes the position **only when it changes**, the page eases toward it and stops its rAF loop once it settles. The renderer cannot see the cursor itself - the ball is 96x96 and the pointer is outside it almost always - which is why this needs the main process at all. The ball's face is now **two layers**: `mascot-base.png` (the same art with the iris region repainted as sclera) plus `mascot-iris.png` (the iris, pupil and highlight), composited at zero offset **pixel-identical** to `mascot.png` - a test decodes all three PNGs and asserts that, because same-size / whitelisted / listed-in-`PANEL_FILES` all stay green if the layers are re-cut one pixel off, and a misalignment is visible only to a person. Travel is clamped to an **ellipse** (about 2.6 px sideways, 0.8 up, 2.6 down at the 96 px ball) because those are the measured sclera margins - past them the iris separates from the rim and the eye reads as a sticker sliding. The iris layer is hidden on `busy` / `offline` / `quota` / `ball-happy`, whose faces have their eyes baked in (otherwise there would be two pupils). `prefers-reduced-motion` leaves the eyes still. The cursor position is in-process only, narrowed in `preload.cjs`, never logged and never sent anywhere. **Not yet verified live** - the wiring and the pixel identity are covered by the suite, but the effect has not been run on a real window. **The ball can also be pushed to a screen edge to hide behind it**: drag it until it touches a monitor's left or right edge and let go, and it swaps to a dedicated drawing of the cat **peeking out from behind that edge** - head and front paws out, body hidden, the drawing's left side being a straight cut that lands exactly on the screen edge (`mascot-peek.png`; the right edge reuses it mirrored). The window stays **fully on screen**, flush against the edge - the illusion comes from the artwork, so nothing goes off-screen, the whole ball stays clickable, and a restart simply puts the ball back at the edge rather than losing it. The first click (or drag) brings the normal ball back, and that click deliberately does **not** expand the conversation - on a hidden ball a click means "come back", not "let's talk". Only left and right: top and bottom fight the taskbar and Windows' edge snapping. Two rules carry the effect and both are pinned by tests because everything else stays green without them: the ball's circular clip must be off in this state (a circle would slice the straight cut into an arc) and hover-zoom must be off as well (scale 1.02 lifts the cut 1px off the edge - a visible seam). The snap threshold is deliberately below the normal 24px edge margin, so a ball merely parked is never mistaken for one being pushed off; a test pins that boundary, because raising it past the margin would hide the ball on every release while every other test stayed green. | `panel`, `panel --status`, `panel --ask` |
103
112
 
104
113
  | Assistant tool surface | The chat assistant now reaches the same ceiling the MCP surface has, minus the exclusions. Ten tools were added on 2026-09-29 (`list_contacts`, `get_review`, `get_concepts`, `fetch_article`, `search_public`, `format_article`, `list_themes`, `lint_wiki`, `check_skills`, `set_todo_status`), seven MCP-only hand-written tools were **moved** into the shared table (same names and arguments, one implementation; the hand-written table went 11 entries to 4), and four tools were **widened** instead of duplicated (`get_daily_report` gained the human-readable daily plus cross-date search, `get_todos` gained the item id and grouping, `get_weread` gained five modes, `get_stats` gained the knowledge-base half). What stays out is unchanged and named in D-058. Two residual risks are recorded there rather than left to be discovered: `search_public` sends a **model-authored query** to a third-party search page with no preview (the user chose this explicitly; `fetch_article` by contrast is allowlisted to `mp.weixin.qq.com` and re-validates every redirect hop), and `set_todo_status` can flip one existing todo between done/pending with no confirmation gate (bounded: no create, no delete - and excluded from MCP entirely). | `list_contacts`, `get_review`, `get_concepts`, `fetch_article`, `search_public`, `format_article`, `list_themes`, `lint_wiki`, `check_skills`, `set_todo_status` |
105
114
  | 技能与场景 (skills & scenes) | Two assistant features that give a conversation shape without giving the model new powers. **Skills** are `SKILL.md` packages scanned from a configurable root list (`skillDirs`, default `~/.claude/skills` and `~/.weflow-cli/skills`) and surfaced two ways: the system prompt carries the catalogue (id, name, one-line description, version, state) and two read-only tools, `list_skills` and `read_skill`, return the catalogue and one body. Nothing is installed and nothing is executed - a skill is **material**, the prompt points at its path and asks the model to read it first. Referencing a skill that is missing, disabled or unreadable renders that state and instructs the model to continue and say which part it could not do, rather than dropping the reference or implying the capability exists (`{{skill:<id>}}` in a scene instruction resolves the same way). Disabling is one config key (`skillDisabled`) or one line in the skill's own frontmatter (`enabled: false`). **Scenes** are named prompt presets (keywords, extra instruction, output spec, required skills, enabled) in `~/.weflow-cli/assistant_scenes.json` (`weflow-scenes/v1`, unknown version quarantined rather than migrated). A turn picks at most one through three tiers - explicit binding, keyword hit, last used in that conversation - and a tie between two equally long keyword matches produces **no** scene plus a trace note explaining why, rather than a coin flip. Managed by `weflow-cli scene …` (two-phase for every mutation) and by one built-in chat command (`场景 <id>` / `场景 无` / `场景`), which accepts only an argument that names an existing scene so ordinary sentences beginning with 场景 fall through to the model. **The model cannot write scenes at all** - there is no such tool, and `capabilities --json` reports `modelWritable: false`; a scene enters the prompt wrapped by `frameLocalData`, and ids are refused if they contain quotes or angle brackets (they would close the `source="…"` attribute). Verified on the real machine: `skill check` reports 28 skills / 0 unreadable / 0 collisions / 5 non-conforming-id warnings / 1 self-disabled, and end-to-end tests with a stubbed model assert the scene section reaches the system prompt and the trace records the matching tier. | `skill list/show/check`, `scene list/show/add/remove/enable/disable/bind/unbind`, `场景 <id>` in chat |
106
115
 
107
- The 776-test TypeScript regression suite (counted from `npm test` on this revision; it grows with every capability) covers home-path expansion, custom NT data-root discovery, bounded daily-favorites synchronization, confirmed no-AI daily generation, no-AI Vault promotion, Vault content mutation previews, Vault initialization and synchronization confirmation, MCP configuration write confirmation, source/compiled Python resource lookup, outbound PII redaction, local-inference bypass, strict message-body masking, MCP path/date/URL validation and live tool discovery, message-contract preservation, local-date export bounds, export result metadata, evidence-package safety, assistant routing and lifecycle confirmation, message-channel authentication confirmation, todo and access-control mutation confirmation, message-send preview/confirmation, local-reader port validation, redacted configuration status, access-list JSON, database-key reset confirmation, human-gated initialization and key capture, content-free account-scan and assistant-log diagnostics, confirmed Vault RAG, confirmed semantic search and RAG chat, drafted-reply confirmation and its refusal path, structured todo reminders, strict knowledge limits, report previews, skill parsing and its path confinement, scene matching precedence, the three-surface tool alignment (contact listing that keeps wxids out, per-hop redirect re-validation, refusal on ambiguous todo text, cross-date article search), and cover-image signature validation. The panel's copy button is executed rather than read: `test/panel-copy-button.test.ts` boots `renderer.js` in a jsdom page, goes through the real `submit -> ask() -> fetch -> addTurn` path, clicks the button, and asserts both the success label and that a **failed** clipboard write says so instead of claiming success - and says in its own header that jsdom cannot reproduce Chromium's drag-region behaviour, so it proves the handler and not the OS-level click. Core automation entry points now include `capabilities --json`, `config show --json`, `whitelist list --json`, `blacklist list --json`, `check --json`, `init --dry-run --json`, `scan --json`, `dbkey --dry-run --json`, `sessions --json`, `messages --json`, `contacts --json`, `export ... --json`, `fav export ... --json-result`, `sns ... --json`, `daily-stats --json`, `daily --no-ai --dry-run --json`, `daily-server --status --json`, `assistant status --json`, `assistant log --json`, `todos list --json`, `todos remind --json`, `evidence --json`, `sync run --dry-run --json`, `sync run --yes --json`, `sync status --json`, `sync verify --json`, `evidence-review --dry-run --json`, Vault mutation previews, confirmed `vault rag`, confirmed `search` and `chat`, daily-favorite previews, `search-index --dry-run --json`, `pipeline run --dry-run --json`, report-generator previews, login/logout previews, and `mcp-config --output <file> --dry-run --json-result`. CI runs three jobs: `node` (build plus the TypeScript suite on Node 22.13), `python` (the Python suites on 3.11), and `release-consistency` (package.json and package-lock.json version agreement, plus a check that the npm package carries no outputs, models, databases or keys). The jobs are separate because a Node failure previously stopped the Python tests from running at all, which let them fail unnoticed.
116
+ The 873-test TypeScript regression suite (counted from `npm test` on this revision; it grows with every capability) covers home-path expansion, custom NT data-root discovery, bounded daily-favorites synchronization, confirmed no-AI daily generation, no-AI Vault promotion, Vault content mutation previews, Vault initialization and synchronization confirmation, MCP configuration write confirmation, source/compiled Python resource lookup, outbound PII redaction, local-inference bypass, strict message-body masking, MCP path/date/URL validation and live tool discovery, message-contract preservation, local-date export bounds, export result metadata, evidence-package safety, assistant routing and lifecycle confirmation, message-channel authentication confirmation, todo and access-control mutation confirmation, message-send preview/confirmation, local-reader port validation, redacted configuration status, access-list JSON, database-key reset confirmation, human-gated initialization and key capture, content-free account-scan and assistant-log diagnostics, confirmed Vault RAG, confirmed semantic search and RAG chat, drafted-reply confirmation and its refusal path, structured todo reminders, strict knowledge limits, report previews, skill parsing and its path confinement, scene matching precedence, the three-surface tool alignment (contact listing that keeps wxids out, per-hop redirect re-validation, refusal on ambiguous todo text, cross-date article search), cover-image signature validation, and the pipeline's Vault default (it copies the day into the Obsidian Vault and compiles concept pages **only** when asked - `--with-vault` / `--with-wiki` - because Obsidian's own graph view is live and re-renders whenever a vault file changes, so a graph that "rebuilds itself when the content updates" was really the vault being rewritten; `test/pipeline-vault-default.test.ts` pins the default, since writing the vault succeeds silently and nothing else would have caught a flip back), and the ball's state faces **recovering from a transient failure** (the `offline` face used to latch permanently - it was set when a status poll failed and the success path never cleared it, so an `assistant stop`/`start` was enough to leave the ball looking aggrieved until the window was reopened, which is how the user reported it: the mascot PNGs were byte-identical to the repo, so the artifact was innocent), and **the ball swinging while it is held** (a continuous sine rather than a speed-derived tilt: the swing starts the moment the ball is picked up - a click sways too, because a click *is* a pick-up, so the old "a click must not tilt" assertion was dropped rather than inverted - and the direction you drag adds a **bias towards that side**, and **the whole swing is scaled by the drag speed**, not just the lean: one "energy" value drives both, so hanging still gives a 6-degree sway (being picked up is enough to start it), 400 px/s gives 8.9, 900 gives 12.6, and 1800 px/s reaches 19.3 for a single move (about 22 in a continuous drag); the lean alone was scaled at first (saturating at 450 px/s, below any real drag) while the swing itself stayed a constant +/-12 degrees, which is the part the user actually sees and why he reported it as fixed twice, which is why the test pins that curve on a **virtual clock** (a real one measured `await wait(20)` at 25-31 ms, too coarse to set a speed, and a mutation restoring 450 px/s passed the whole suite because of it). Like the tickle this needs no new artwork and no part of the circle's budget, because rotation about the centre preserves every pixel's distance from it; the amplitude is a matter of taste, not geometry. The energy decays only after 1.2 s of stillness, **deliberately longer than the 900 ms period**: at the 240 ms tried first it had expired before the second peak arrived, so a leftward drag damped the rightward swing (measured -12.6 degrees, indistinguishable from not dragging at all) instead of amplifying the leftward one - half of what was asked for. `test/panel-dangle.test.ts` pins the start-at-pick-up, both extremes of the swing, the settle with its no-leaked-timer check, and the reduced-motion skip; the "both extremes" part is there because the first version sampled only the first 300 ms, which mutation testing showed could not fail on that decay bug, the peak it depends on never appearing in that window), plus **a hop when a reply lands and a blink every 7-13 seconds** (the hop has **no generated frames on purpose**: the model reliably squashes the body for a crouch - measured +9.2%/+8.0% on the outline metric, and milder wording did not help - which over three frames meant the ball visibly fattening and thinning four times in 270 ms, so the hop is a transform with a **budgeted** rise: the art already uses 125.25 of the circle's 128 radius, so the airborne step shrinks to 0.96 first and only then rises 7 px; the blink's two frames are **composited** rather than used as generated, because the model repaints the whole face and even a one-pixel difference reads as the entire ball flickering - only the eye band is pasted back, measured at 0 pixels differing outside it. Both are skipped under `prefers-reduced-motion`; the blink also waits until no other face is showing and the page is visible). The panel's copy button is executed rather than read: `test/panel-copy-button.test.ts` boots `renderer.js` in a jsdom page, goes through the real `submit -> ask() -> fetch -> addTurn` path, clicks the button, and asserts both the success label and that a **failed** clipboard write says so instead of claiming success - and says in its own header that jsdom cannot reproduce Chromium's drag-region behaviour, so it proves the handler and not the OS-level click. Core automation entry points now include `capabilities --json`, `config show --json`, `whitelist list --json`, `blacklist list --json`, `check --json`, `init --dry-run --json`, `scan --json`, `dbkey --dry-run --json`, `sessions --json`, `messages --json`, `contacts --json`, `export ... --json`, `fav export ... --json-result`, `sns ... --json`, `daily-stats --json`, `daily --no-ai --dry-run --json`, `daily-server --status --json`, `assistant status --json`, `assistant log --json`, `todos list --json`, `todos remind --json`, `evidence --json`, `sync run --dry-run --json`, `sync run --yes --json`, `sync status --json`, `sync verify --json`, `evidence-review --dry-run --json`, Vault mutation previews, confirmed `vault rag`, confirmed `search` and `chat`, daily-favorite previews, `search-index --dry-run --json`, `pipeline run --dry-run --json`, `wiki graph --dry-run --json`, `contact-schema --json` and `contact-schema --contacts --json`, report-generator previews, login/logout previews, and `mcp-config --output <file> --dry-run --json-result`. CI runs three jobs: `node` (build plus the TypeScript suite on Node 22.13), `python` (the Python suites on 3.11), and `release-consistency` (package.json and package-lock.json version agreement, plus a check that the npm package carries no outputs, models, databases or keys). The jobs are separate because a Node failure previously stopped the Python tests from running at all, which let them fail unnoticed.
108
117
 
109
118
  The daily workflow supports `dailyAiEnabled=false` for a persistent no-AI mode, or `daily --no-ai` for a single run. Both the CLI and direct Python entry points honor the setting. Fetching, HTML generation, and local indexes remain available in that mode. Machine execution requires `daily --yes --json`; it keeps progress logs on stderr and returns a machine-readable completion result on stdout after checking the required local artifacts.
110
119
 
111
120
  Date-bounded message exports and `wechat.export_messages` page through the selected conversation before applying the result limit. Older matching dates are therefore not hidden by a newer, nonmatching first page. Versioned envelopes report requested bounds, returned count, and conservative `mayHaveMore` metadata. `sync` adds a local checkpoint on top of the same overlapping-window approach, but **a stable incremental cursor is still not exposed** - it must be supported by every relevant database backend before it is advertised (D-027), and `capabilities --json` reports `stableCursor: false` for both.
112
121
 
122
+ ## Not Verified (and what closing it would take)
123
+
124
+ Same shape as the launcher reverse-engineering report's closing section ("what we could not do, and why"): an
125
+ unverified claim gets written down **once**, together with the price of closing it, so it is not rediscovered every
126
+ few weeks. Each row is an index entry - the measurements and the reasoning live in the decision it names.
127
+
128
+ | Not verified | Why not here | What closing it would take |
129
+ | --- | --- | --- |
130
+ | The **semantic (vector) search path** (D-105) | **Partly closed on 2026-10-13**: the index now exists (built with a 7-day chat / 3-article window - 749 records, inside DashScope's free quota) and the vector path has been exercised for real, per line (`indexCounts` 383 + 366 = 749). Still open: the **default 90/30 window** was never built (it exceeds the free quota; measured cost ≈ ¥1.3-2.2), and the **rerank layer cannot run on this machine** - it calls Typesafe (`api.typesafe.ai`) and answers `HTTP 451: Typesafe is not available in your region`, so the default path here is the un-reranked one. | Two things, both cheap but not done here: (a) decide whether the degraded search should stay byte-identical to a successful un-reranked one - `rerank` returns only the list, so nothing in the JSON says it failed; (b) build the 90/30 window if the small one proves useful. |
131
+ | `update\update.data`'s **internal format** (D-107) | The report reverse-engineered the loader but not this file, and the file does not exist here. When it does exist the loaded build may not be the one the command line names, so `check` **states that** instead of guessing. | A machine where the file exists. |
132
+ | The **version token ↔ dotted version** mapping (D-107) | The **low 16 bits are decoded** (2026-10-11): byte 3 is the fourth component, byte 2 is the third `+ 0x10` - both known pairs agree. The high 16 bits are `F254` on both, and both versions are `4.1.x`, so major/minor cannot be separated with two samples (n=2: "both fit", not "solved"). | More (build, token) pairs, or the encoder. `update\download` and `update\patch` are empty on this machine, and the client's `log/*.xlog` (53 files, 373 MB) is **not plain text**: grep for the token there returns 0 matches, which is a **false negative** rather than evidence, and single-byte-XOR zlib/zstd does not unlock it either. The falsifiable prediction to test: `4.1.15.11 → 0xF2541F0B`. |
133
+ | The MMKV stores under `%APPDATA%\Tencent\xwechat\radium\mmkv\` (D-101) | Their format holds (crc32 precondition passes; one is empty), but the only key we can construct does not open them, and the `config/` root key is random and was never captured. | **Deliberately not attempted**: the remaining route is injecting into the client process, which this repo does not do (D-101). |
134
+ | **Why** the data root uses hard links (CONTACT_DB_SCHEMA §6.2) | The effect is measured (395 groups, 407 MB double-counted if you sum sizes); the cause is the report's `hardlink.dat` inference (multi-account / multi-version reuse) and has not been established. The file itself was read on 2026-10-11: it is **32 hex characters** (a 16-byte value), one copy on this machine, older than both installed client versions - so it is a marker or seed, not the link inventory (16 bytes cannot describe 395 groups). | Finding what consumes it. One testable guess, not yet tried: use those 16 bytes as an AES-128 key for the `radium\mmkv\` stores, judged by the D-101 oracle (crc32 consistent **and** the whole record sequence walks). The stores are on this machine; the tooling is not. |
135
+ | Issue #7 (HTML emoji export) | Open pending reporter verification. | The reporter's confirmation. |
136
+ | The CLI's **runtime** error paths under `--json` (~100 prose sites in `bin/weflow-cli.ts`) | The argument-validation family **is** audited (80 sites, 0 defects, 2026-10-11) and `weread`'s nine one-line failure branches are fixed, but the rest are runtime failures - "not configured", "no WeChat process", permission denied - whose reachability under `--json` depends on that command's interactive gate. A window around a line cannot tell "mentions `opts.json`" from "is governed by `opts.json`": that filter answered wrongly in **both** directions on 2026-10-11 (305 candidates, then 12, of which the real family was nine). | Reading each site, or driving each command into its failure state where that needs no credentials and no network - `weread`'s empty-`HOME` case is the worked example (`test/json-error-surface.test.ts`). Two named gaps: `export --contract` is verified **on this machine only**, because its check runs after `resolveTalker()`; and the human-facing error arm is not uniform across the CLI (most sites `console.error`, some `console.log`) - a separate, user-visible change that this work deliberately did not make. |
137
+
138
+ **What this is not**: a bug list. Everything above works on the paths this machine exercises; what is missing is
139
+ the *evidence* for the paths it does not.
140
+
113
141
  ## Security Baseline
114
142
 
115
143
  - Process only data the user owns or is explicitly authorized to access.
@@ -127,6 +155,7 @@ Date-bounded message exports and `wechat.export_messages` page through the selec
127
155
  - `init --dry-run --json` exposes a content-free plan. JSON execution returns `INTERACTIVE_REQUIRED`; database verification, directory discovery, key capture, and configuration writes remain an explicit terminal workflow.
128
156
  - `vault rag` requires a read-only preview and explicit confirmation before reading local knowledge or calling the configured AI provider. The question is inherited by the Python worker through the environment rather than copied into process arguments.
129
157
  - `search` and `chat` use the same preview/confirmation boundary. Queries, questions, and optional conversation restrictions are inherited through the worker environment instead of appearing in process arguments; machine callers cannot start interactive RAG chat.
158
+ - `vault search --json` is the exception to the rows above: its `results[].file` is an **absolute local path**. That is deliberate rather than overlooked - the flag spent its life as the command's only output (the TS action forwarded `--json` unconditionally while declaring no such flag), and that output was meant to be read on the terminal, where a path you can open is the point. Since 2026-10-11 it is opt-in: the default is the script's scored, human-readable list, which carries titles and scores but no paths. Nothing in the repo consumes the JSON (no MCP tool, no assistant tool, no script), so the shape is kept as-is rather than changed around no dependants; if it is ever fed to a model or pasted into an issue, this row is the thing to revisit.
130
159
  - `daily-server --status --json` remains read-only. Machine startup uses `daily-server --dry-run --json` followed by `daily-server --yes --json`; the confirmed process is detached and remains bound to loopback. The legacy `fav-server` compatibility entry enforces the same preview and confirmation rules.
131
160
 
132
161
  Documentation was synchronized with the current source baseline on 2026-09-19. Command behavior is defined by `bin/weflow-cli.ts`; detached reader startup waits for service readiness, and release packages can lag behind the GitHub source until published.
@@ -135,6 +164,8 @@ Documentation was synchronized with the current source baseline on 2026-09-19. C
135
164
 
136
165
  - Issue #7 remains open pending reporter verification. HTML emoji export preserves the emoji label and matches resource records only by nonzero server-message identity; local IDs are not unique across shards or conversations. WeChat 4.x V2 image containers are decoded with an account-specific media key derived from local `kvcomm` data and verified against a real cached V2 header. Remote emoticons use AES-CBC with the message key as both key and IV. Entity-escaped emoji XML is normalized before extracting MD5 and media URLs; failed encrypted downloads fall back across available thumbnail/CDN fields. Signature-only default `[打脸]` messages use the bundled official Facepalm asset when no message-specific resource is available. Forwarded app cards remain structured links with available covers, and Bilibili share pages can resolve covers through their BV metadata endpoint when no `og:image` is present. Forty-two synthetic Python regression tests (`export_chat_media_test.py`, `export_chat_media_report_test.py`) cover these paths; run `python -m unittest discover -s test -p '*_test.py' -v`. CI also runs these tests. This does not establish compatibility with every real WeChat media format.
137
166
 
167
+ - **Media leaves the export as files now, images and documents alike, and the matching happens once.** `export … md` writes images to `<output>/<talker>_assets/` and references them relatively; `export … json|txt|excel --media` runs the same Python extraction and then writes the requested format against the same `manifest.json`. The switch existed because a reporter asked whether the non-HTML formats omitted images *and documents* - images had just been fixed, documents had not, and **no format exported a document body** (the HTML page showed `[文件] <name>`). Documents are file-message appmsg `type=6`: the row carries only name/md5/size, and the body sits in the account directory's `msg/file/YYYY-MM/` **with no per-conversation directory**, so the index is a stat-only `(normalized name, byte size)` lookup and md5 disambiguates only when a name is ambiguous (WeChat appends its own `(1)`). Measured on this machine: 1,855 file messages, 1,489 unique matches + 154 md5-resolved = **88.6%**, and the remaining 212 have no local body at all (never downloaded, or cleaned up) - those stay as `[文件] name` labels and are *counted*, not guessed (D-014). Bodies are copied under their original names and extensions; the manifest is `weflow-media-manifest/v2` (values carry `kind`) and v1 files still read. Two traps are worth keeping: `<refermsg>` sits **inside** `<appmsg>`, so searching the XML for the first matching tag reported 7,083 "files" that were nearly all quoted text (the parser now reads `<appmsg>`'s direct children only); and a count of newly copied files was reported as the number of documents exported, so a second run into the same directory printed "0 document(s)" with 67 documents on disk. **HTML deliberately embeds no document bodies** (a multi-MB PDF as base64 in a page nobody can open), and voice/video still have labels only.
168
+
138
169
  - WeChat platform behavior, database formats, account restrictions, and terms can change without notice. Local operation is not a legal, account-safety, or platform-compatibility guarantee.
139
170
  - **The daily is no longer all-or-nothing.** It fetches every article before writing anything and the bodies lived only in memory, so any interruption threw the whole day away - a 400-article day is over an hour of fetching, and the 2026-09-22 run stopped at 105/403 with nothing written. Bodies are now cached under `output/.cache/fetch/` keyed by URL, so a re-run fetches only the missing ones (measured: a resumed batch of 3 goes from 64 s to 2.0 s, and cache hits take **no** throttle sleep because they send no request - the throttle exists to spare the upstream, and this is the same direction). Only successes are cached, so a failure is retried next time rather than remembered. `--no-fetch-cache` forces a refetch. **The lesson that made this urgent**: a long single-shot run is a gamble, and `cmd | tee log` reports the wrapper's exit code, not the program's - the 105/403 failure looked like `exit 0`.
140
171
  - Where a many-source day spends its time is now measured rather than assumed, and two of the three biggest items have been fixed. A 190-article day **was** ~3 h 10 m: fetching bodies ~130 min, the deliberate 8-12 s inter-article throttle ~32 min, image downloads ~18 min (47 image links per three articles, 0.37 s and 135 KB each, sequential), and the serial summary loop ~9 min (measured 2.27/2.92/2.45 s per article, plus 0.3 s each). It is now ~1 h 5 m: fetching ~33 min (gzip, below), throttle ~32 min, images ~3 min (6-way concurrent), summaries ~2 min (6-way concurrent). Classification was never a factor - already concurrent. **The throttle is now the largest single item, and it is the one thing left that is deliberate** ("reduce upstream pressure"); the other two costs were implementation choices, not policy. Both new concurrency settings are 6 (`IMAGE_WORKERS`, `SUMMARY_WORKERS`), matching `JEV_WORKERS`.
@@ -142,6 +173,7 @@ Documentation was synchronized with the current source baseline on 2026-09-19. C
142
173
  - The article body is **not** available locally, so fetching cannot be skipped: a 公众号 message in the local database carries title, digest, URL and metadata, and stripping its XML tags leaves 0 Chinese characters (the ~5-12 KB that remains is URLs, base64 and ids).
143
174
  - The OC Bot channel is separate from a personal WeChat message stream. `send` can only reply through an already established Bot-channel conversation with a valid context token; it cannot initiate messages to existing personal contacts, post as the user's personal account, or send into ordinary personal WeChat groups.
144
175
  - The current official OC/iLink payload model has not been verified to support group events or group invitations. The project does not implement client automation or protocol bypasses to add a bot to groups.
176
+ - Inbound media on the OC Bot channel (image / voice / file / video) is downloaded **only when `wechatMediaDownload` is `true`** (`false` by default, so a default install makes no such request). When it is on, each item is decrypted locally (AES-128-ECB, the same scheme as the local image files) and written under `output/wechat-media/` (directory overridable with `WEFLOW_WECHAT_MEDIA_DIR`). Names are decided locally - a server-supplied name is reduced to a sanitised basename - and each item is capped at 25 MB; a download that fails, comes back empty or exceeds the cap leaves `filePath` empty and writes one log line naming the reason, never a partial file. The field and key order follow the vendor implementation (`third-party/WeKnora/internal/im/wechat/longpoll.go`): images use `image_item.aeskey` (hex) before `media.aes_key` (base64). **Verified on a real inbound message** (2026-10-10, after a fresh `login-wechat`): a text message arrived and was answered, then a real image arrived - 27,637 bytes, PNG magic, and **PIL opened it at 798x513 RGB**, which is what separates "decryption is right" from "some bytes landed". The log showed `忽略非文本消息 (image)` on the same message, i.e. the assistant keeps ignoring non-text for its reply. **And no consumer reads the saved path yet**: `components[].filePath` is populated and the file really is on disk, but the only reader of an inbound message (`assistantService`) takes `messageStr` + `messageKind` and carries the full object along unread - so the assistant still knows only "an image arrived", not where it landed. Letting a model look at that file would be a new class of egress and is deliberately left as its own decision (D-042 set the precedent for local images). **And it downloads from any sender, not just the allowlist**: the download happens while parsing the polled message, one layer earlier than "should the assistant answer this", so the allowlist governs replies and not downloads - anyone who can message the bot gets their media written to disk here.
145
177
  - Cloud AI workflows may transmit user-selected, privacy-filtered input to the configured provider. Local inference avoids that network transfer.
146
178
  - `vault promote ideas` and `vault promote all` run without AI by default. AI generation requires explicit `--with-ai` and an API key. CLI execution also requires preview and confirmation. `vault init` creates both the existing article-sync folders and the structured directories required by promotion workflows.
147
179
  - `vault init`, semantic-index construction, the knowledge pipeline, and report generators require preview and confirmation for machine execution. Preview JSON contains counts and behavior flags but omits local paths, conversation names, and generated content.
@@ -304,7 +336,33 @@ not a gap. `Sources/` holds **raw material** (`Sources/WeChat/<date>/` from the
304
336
  the reading notes, `Wiki/` holds the **article line's** generated concept pages plus `00-Overview.md`, and `Chat/` holds the
305
337
  **chat line's** (`Chat/Concepts/`, `Chat/00-Overview.md`) - one Vault, two knowledge bases, split on
306
338
  2026-09-27 at the user's request (D-051 records why every reader had to be told about both: reading one of
307
- two directories is silently wrong, not broken). Two things about this were
339
+ two directories is silently wrong, not broken). Since 2026-10-10 the two lines also have separate **concept
340
+ namespaces** (D-104): the same name may hold a page on both lines, graph node ids are line-qualified
341
+ (`wiki:DeepSeek`), and `wiki lint` reports the overlap in its `crossLineSameName` section instead of counting
342
+ those pages as duplicates. Measured on 2026-10-10: **36** names have a page on both lines and **539** article-line
343
+ links point at one of them, so the rule this replaced ("one name, one page, library-wide") was never true of the
344
+ data on disk. What that rule protected is real and unchanged - a bare `[[DeepSeek]]` in Obsidian resolves
345
+ deterministically but not necessarily to the page you meant - and it is now **reported rather than prevented**;
346
+ the two ways to actually fix it (a root per line, or path-qualified links) are left to the step that splits the
347
+ roots, so until then clicking such a link is genuinely ambiguous.
348
+
349
+ **Resolved on 2026-10-10 the second way (D-106): the vault stays one library, and links that name a
350
+ both-lines concept now carry the line's path** (`[[Chat/Concepts/DeepSeek|DeepSeek]]`). Measured before the
351
+ rewrite: 36 shared names, 477 pages, 539 links (462 in concept pages, 36 in the index pages, 41 in the chat
352
+ cards; none anywhere else in the vault). The rewrite was checked by reverse audit rather than by sampling -
353
+ `ambiguousLinks` went 462 → 0 while every other lint count stayed identical (49,956 pages, 9 broken, 0 orphans,
354
+ 1 empty, 0 within-line duplicates, 36 cross-line names, 10,324 aspirational) and the graph's three scopes are
355
+ byte-identical to before (48,429/144,628, 1,527/878, 49,956/145,795). **What is not solved**: a *new* collision
356
+ will be written bare again until `wiki compile --qualify-links` is re-run, which is why `wiki lint` grew an
357
+ `ambiguousLinks` section that names the fix. Since 2026-10-10 the **readers** carry the same
358
+ line too (D-105): `search`, `chat`, `vault search`, `vault rag` and the assistant's `search_semantic` /
359
+ `search_knowledge` all take `line: wiki|chat|all`, default to the article line where the user sees it (the
360
+ *functions* default to `all` so a caller that forgets cannot silently halve the search), and every output says which
361
+ line it searched. The semantic side carries this as a mask applied **before** the top-k sort over one shared index.
362
+ **Limitation to keep in view**: the vector path of semantic search has never run against a real index on this
363
+ machine - the index does not exist (building it needs `dashscopeApiKey` and spends the user's embedding credit), so
364
+ the mask is pinned against a hand-made fixture index and the real-data check was done on the keyword fallback (which
365
+ is the path this machine actually takes). Two things about this were
308
366
  wrong on 2026-09-27 and are now fixed: the concept directory was **declared in two places** (`VAULT_DIRS` said
309
367
  `007_Wiki/Concepts`, every writer and reader used the top-level `Wiki/Concepts`), so `007_Wiki/` was created and
310
368
  never filled; and the historical import skipped `Sources/` entirely (it would have carried ~33 GB of images), which
@@ -400,6 +458,7 @@ step (the CLI's interactive-menu entry is the notable one).
400
458
  ## Related Documents
401
459
 
402
460
  - Architecture and data flow: [ARCHITECTURE.md](../ARCHITECTURE.md)
461
+ - WeChat `contact.db` schema notes (the `ext_buffer` blobs): [CONTACT_DB_SCHEMA.md](CONTACT_DB_SCHEMA.md)
403
462
  - Setup and troubleshooting: [OPERATIONS.md](../OPERATIONS.md)
404
463
  - Security and reporting: [SECURITY.md](../SECURITY.md)
405
464
  - MCP surface: [MCP.md](MCP.md)
package/docs/RELEASING.md CHANGED
@@ -32,8 +32,25 @@ npm 包与 GitHub 分开发布,中间隔多久都不奇怪——`1.5.0` 与主
32
32
  ```powershell
33
33
  npm run build
34
34
  npm test
35
+ py scripts/check_readme_commands.py # 文档/脚本调用/capabilities 里写的命令必须真的存在
35
36
  ```
36
37
 
38
+ 最后那条盯的是**用户先发现的那一类漂移**:`1.5.0` 与主线拉开 128 个提交时,用户照着 README 敲
39
+ `init --path` 得到 `unknown option`。它逐级问 CLI 的 `--help`(不复刻命令表),扫**三个手写的命令面**:
40
+ **用户文档**的围栏代码块(两份 README + 仓库根那几份 + `docs/*.md`,排除按性质记录过去的
41
+ `CHANGELOG.md` 与 `docs/DECISIONS.md` —— 它们会成段引用当时的命令;同一批代码块里
42
+ `node …/cli.cjs <命令>`、`npx tsx bin/weflow-cli.ts <命令>` 也算这一面 —— 那是同一套命令换个写法)、
43
+ 同一批代码块里的
44
+ `python|py scripts/x.py --flag` 调用(**不跑脚本**,按 AST 读它们的 `add_argument` 声明表 —— 仓库对
45
+ Python 脚本的既定纪律就是不 import 也不运行),以及 `capabilities --json` 里手写的 `cli:` **与 `preview:`**
46
+ 串(`preview:` 是两阶段约定的第一步 —— 用户与 agent 都按它来,所以它和 `cli:` 一样会被手写漂移;
47
+ 那个输出的 MCP 那半是从真实注册表派生的,不用管。串里有这个输出自己的记法:`<a|b>` 是"或"、
48
+ 括号外的 `|` 是"两种写法"、`…` 之后截断 —— 判据会按这个归一化后再验)。`--self-test` 是十三条正对照;
49
+ 文档命令那一面还有反空扫(缺省语料一定有命令,扫到 0 条就不报通过)。CI 的 `node` job 每次推送都会跑这两步。
50
+
51
+ > 2026-10-11 它就是这么抓到东西的:`OPERATIONS.md` 教用户敲 `search --no-rerank`,而 CLI 从来没有
52
+ > 这个旗标(Python 侧一直有)。只扫两份 README 时它一条也扫不到 —— 所以缺省集合就是"用户文档"。
53
+
37
54
  ## 4. 打包检查(**不能跳过**)
38
55
 
39
56
  ```powershell
@@ -57,6 +74,46 @@ grep -E "^output/|^models/|node_modules|\.env|\.db$|\.dat$|secret|credential" /t
57
74
  grep -E "新文件名" /tmp/list.txt
58
75
  ```
59
76
 
77
+ 这后半句("**该有的在不在**")现在有自动判据:`test/pack-contents.test.ts` 跑一次
78
+ `npm pack --dry-run --json`,断言 `scripts/` 下每个跟踪文件(`.ts` 开发入口除外)与两份 README 引用的
79
+ 本地图片都在包里。它防的故障 2026-10-11 在**真实发布物**上量到过:registry 上 `weflow-cli@1.9.0`
80
+ 的 501 个文件里同时缺 `scripts/data/wechat_emoji.json` 与 `logo.png` —— 前者让 npm 用户导出的
81
+ 聊天记录里一批表情码原样显示成 `[名字]`,后者让包页面挂着一张裂图。这条测试跟着 `npm test` 跑,
82
+ CI 的 `node` job 也在跑;上面那条人工命令留着,用来核对本次**新加**的文件名。
83
+
84
+ 想验到"**装出来真的能跑**"(最强的一道,代价是多装一次依赖):把包打进临时目录、再装进一个空
85
+ prefix,然后从**装好的那一份**里问版本。它盯的是白名单之外的另一半 —— 清单对、运行时不成立的情况。
86
+
87
+ ```powershell
88
+ npm pack --pack-destination $env:TEMP
89
+ mkdir $env:TEMP\wf-smoke ; cd $env:TEMP\wf-smoke # 空目录
90
+ npm install --no-save --no-audit --no-fund "$env:TEMP\weflow-cli-<版本>.tgz"
91
+ node node_modules\weflow-cli\cli.cjs --version
92
+ node node_modules\weflow-cli\cli.cjs --help
93
+ ```
94
+
95
+ 2026-10-11 拿 1.10.0 跑过一遍:`ALL_NAMES = 222`(不是只有原图的 118 —— 那正是上一版缺
96
+ `scripts/data/wechat_emoji.json` 时的值)、`[乒乓]`/`[冷汗]`/`[开红包]` 都渲染成对应表情、
97
+ `--version` 答 `1.10.0`。
98
+
99
+ **两个数字口径,免得下一次又花半小时**(2026-10-11 实测):`npm publish` 的 notice 报
100
+ `package size: 12.5 MB` 用的是**十进制 MB**,而 `npm pack --json` 的 `size` 是**字节**(你按习惯除以
101
+ `1MB` 得到 11.88 是 MiB)—— **同一份 tarball**:12,460,202 字节 = 12.46 MB = 11.88 MiB。
102
+ `unpacked size` 同理(publish 27.9 MB = pack 26.62 MiB,解压实测 27,915,402 字节)。不是
103
+ "publish 比 pack 大",是两套单位。
104
+
105
+ **发布时那两条 `npm warn publish … errors corrected` 是修饰性的,不是故障。**
106
+ `bin[weflow-cli]` 那句「cli.cjs was invalid and removed」措辞很吓人,实际只是把 `./cli.cjs` 规范成
107
+ `cli.cjs`;`repository.url` 被改写成 `git+https://…`。**实测证据**:registry 上 `weflow-cli@1.9.0`
108
+ 的元数据里 `bin = { 'weflow-cli': 'cli.cjs' }` 完好无损(`npm view weflow-cli@1.9.0 bin repository.url`)
109
+ ⇒ `npm i -g` 装出来的命令入口一直都在,**别据此以为发布物少了 bin**。
110
+ (那两条规范化 2026-10-11 已经直接落到仓库里了:`package.json` 的 `bin` 与 `repository.url` 现在就是
111
+ 规范形式,发布时不再报这两条 warning,仓库也与 registry 上的一致。)
112
+
113
+ > ⚠️ **`npm pkg fix` 没有 `--dry-run`**:`npm pkg fix --dry-run` 会把 `--dry-run` 当成不认识的参数**忽略掉**,
114
+ > 然后**直接改你的 `package.json`**(2026-10-11 就是这么被改的 —— 我原以为只是"看看会改什么")。
115
+ > 想先看结果就用 `git diff package.json` 兜底,别指望它自己停手。
116
+
60
117
  ## 5. 发布
61
118
 
62
119
  需要 npm 凭据。`ribiaosu` 账号开了 2FA,所以两条路:
@@ -68,7 +125,7 @@ grep -E "新文件名" /tmp/list.txt
68
125
  | 现象 | 原因 |
69
126
  | --- | --- |
70
127
  | `403 ... two-factor authentication ... required` | token 没勾 Bypass 2FA,或没用 OTP |
71
- | `ENEEAUTH` | 没登录 / 没配 token |
128
+ | `ENEEDAUTH` | 没登录 / 没配 token |
72
129
 
73
130
  **验证 token 是否可用**(`bypass_2fa` 必须是 `true`):
74
131
 
@@ -111,6 +168,22 @@ npm publish # 再发一次
111
168
 
112
169
  报 `409 Conflict - Cannot publish over previously staged version` → **已经发布成功**。
113
170
 
171
+ 但 409 只说明**版本槽位已被占**,不等于 registry 已经能查到它。发布后 npm 要先扫描再让版本可读,
172
+ **官方不承诺上限**:常见 5 分钟,实测出现过 14、16、25、55 分钟。这个窗口里的表现是:
173
+
174
+ - `npm view weflow-cli version` 还是旧版本号
175
+ - tarball 直链仍然 404
176
+ - 再发一次仍然是 409 —— 所以 409 **区分不了**「还在传播」和「已经好了」
177
+
178
+ 窗口期内只做一件事:等 + 轮询,**不要改版本号重发**。想确认不是卡在人工审批:
179
+
180
+ ```powershell
181
+ npx --yes npm@11.17.0 stage list weflow-cli --json # 返回 [] 即无待审批版本,属传播中
182
+ ```
183
+
184
+ (`npm stage` 需要 npm ≥ 11.15;本机装的是 11.6.2,直接跑会报 `Unknown command: "stage"`,
185
+ 所以用 npx 临时拉一个高版本。`npm@11.17.0` 是在本机 Node 24.11.1 上验证过能用的。)
186
+
114
187
  ## 8. 兜底:告诉用户怎么绕开镜像
115
188
 
116
189
  ```powershell
@@ -121,6 +194,43 @@ npm view weflow-cli version --registry=https://registry.npmjs.org # 用官方
121
194
  两个源结果不一致 → 是镜像同步问题,不是包的问题:
122
195
  `npm install -g weflow-cli@<版本> --registry=https://registry.npmjs.org` 立刻可用。
123
196
 
197
+ ## 建 GitHub Release 时的两个坑(2026-10-02 补 1.8.0/1.8.1/1.8.2 时实测)
198
+
199
+ - **正文上限 125,000 字符。** 1.8.0 那段 CHANGELOG 是 140,154 字符,直接贴会被 API 拒:
200
+ `HTTP 422 ... body is too long (maximum is 125000 characters)`。处理方式是**按 `### ` 小节边界
201
+ 机械截断**(放到装不下为止),末尾补一句"完整条目在 `CHANGELOG.md`"。**不要凭"哪几段更重要"去挑**:
202
+ 那既不可复现,也不是发布这件事该做的判断。
203
+ - **补历史的 Release 要显式 `--latest=false`。** `gh release create` 默认会把新页面标成 Latest ——
204
+ 给 1.8.x 补账时会把 1.9.0 从 Latest 上挤下去。补完用 `gh release list` 确认 Latest 还是最新的那个。
205
+ - **发布前先确认工作区干净**(`git status` 为空,HEAD 就是你打算打 tag 的那次提交)。
206
+ 理由不是形式主义,是实测出来的:2026-10-02 给 1.8.0/1.8.1/1.8.2 补 tag 时做了逐文件溯源
207
+ (拿 registry 上的 tarball 与 `git archive <tag>` 比,行尾差异不算),结果是 1.8.1 与 1.8.2 的
208
+ 发布源码与 tag 树**一致**,而 **1.8.0 的包里有两个文档文件在 git 里找不到对应状态**:
209
+ `docs/DECISIONS.md` 与更晚的一次提交一致,`README.en.md` 则**与任何提交都不一致**(比 tag 那份
210
+ 长约 7,000 字符)。代码部分没问题(逐字节相同),但**那次发布出去的文档再也回不来** ——
211
+ 这正是"不把 npm 发布包当作 GitHub 源码的实时镜像;先确认版本和提交"这条规矩要防的事。
212
+ - **1.9.0 的出处核过了(2026-10-11,用上面同一套办法)**:把 registry 上的 tarball 与
213
+ `git archive v1.9.0` 逐文件比(行尾归一后比内容):两边都有的 **289 个文件全部逐字节一致、0 处不同**;
214
+ 包里多出的 212 个是 `dist/`(构建产物、不在 git 里);tag 里有而包里没有的 124 个是白名单外的
215
+ 东西(`.github/`、`AGENTS.md`、`package-lock.json`、`scripts/*.ts` 等)。
216
+ ⚠️ 其中 **`logo.png` 与 `scripts/data/wechat_emoji.json` 两个文件当时确实没进包** —— 那正是
217
+ 1.10.0 修掉的缺口(同一件事,两条独立的路都指到它)。
218
+ **结论:1.8.0 那个"发出去的文档再也回不来"没有在 1.9.0 重演** ✅
219
+ - **1.10.0 的出处核过了(2026-10-12,发布当天,三种证据)**:
220
+ 1. registry 上 `weflow-cli@1.10.0` 的 `dist.shasum` = `bb7604fe063d330360d00f89c19069367c509d7a`,与本机
221
+ `npm pack --dry-run` 报的是**同一个值** ⇒ 发出去的就是我构建的那一份;
222
+ 2. 从 registry 装进一个**空目录**(`npm install --no-save weflow-cli@1.10.0`),用**装好的那份**跑
223
+ `cli.cjs --version` 得到 `1.10.0`、`--help` 正常(4128 字节、含 `Commands:`);同时确认 1.9.0 缺的
224
+ 那两个文件这次都在(`logo.png`、`scripts/data/wechat_emoji.json`),而开发用探针
225
+ `scripts/json_surface_probe.mjs` **不在**包里(`.mjs` 不进包是有意的,见 `test/pack-contents.test.ts`);
226
+ 3. 两个源都是 1.10.0:官方源与 `registry.npmmirror.com`(`curl -X PUT …/syncs` 受理后约 **4 分钟**生效)。
227
+ 另外**发布日志 0 条告警** —— 下面说的那两条装饰性 normalize 告警确实随 `package.json` 规范化一起消失了。
228
+ **tag 打在被发布的那个提交上**:`v1.10.0` → `9baa752`(发布时 HEAD 就是它;随后只有这一个文档提交
229
+ 3cf5605,它不在包里那一份 tarball 的对应关系里 —— 写下来是因为 1.8.0 那次正是"事后不知道 tag 对应哪个
230
+ 提交")。GitHub Release `v1.10.0` 同样指向它,正文由 `## 1.10.0` 段机械切出(92,213 字符,未触及
231
+ 125,000 上限 ⇒ 未截断),List 上已是 **Latest**。
232
+
233
+
124
234
  ## 发布后
125
235
 
126
236
  - 回到相关 issue 回复「已发布 + 升级方式」
@@ -162,6 +272,23 @@ npm view weflow-cli version --registry=https://registry.npmjs.org # 用官方
162
272
  - 手动跑一次:`py scripts/watch_issues.py`
163
273
  - 查看/改频率:`Get-ScheduledTask -TaskName 'WeFlow Issue Watch'`
164
274
 
275
+ **两个任务怎么建**(这一节此前只写"交给计划任务",**命令本身没记下来过** —— 而 `scripts/health_check.py`
276
+ 正是按这两个**名字**判红的,所以缺的从来不是判断,是这三行):
277
+
278
+ ```powershell
279
+ schtasks /create /tn "WeFlow Issue Watch" /sc minute /mo 30 ^
280
+ /tr "py \"<仓库路径>\scripts\watch_issues.py\""
281
+ schtasks /create /tn "WeFlow Mail Watch" /sc minute /mo 30 ^
282
+ /tr "py \"<仓库路径>\scripts\watch_mail.py\""
283
+ ```
284
+
285
+ - 查看:`Get-ScheduledTask -TaskName 'WeFlow *'` / 撤销:`schtasks /delete /tn "<任务名>" /f`
286
+ - **PATH 不用操心**(计划任务的 PATH 与交互式会话不同,这是这类任务常见的翻车点):`watch_issues.py`
287
+ 自己带兜底 —— `GH_CANDIDATES = ['gh', r'C:\Program Files\GitHub CLI\gh.exe']`;`py` 是系统启动器
288
+ (`C:\Windows\py.exe`)。两者都不依赖任务继承的 PATH。
289
+ - `watch_mail.py` 做的是**另一件事**:把白名单来信追加进本地队列 `~/.weflow-mail-queue.jsonl`
290
+ (不读别人的信、不发信;真正按指令做事要等一个会话在跑)。
291
+
165
292
  ### 发布后自检
166
293
 
167
294
  ```powershell
package/logo.png ADDED
Binary file
@@ -267,13 +267,28 @@ export function buildServer(): Server {
267
267
  if (!name || name.includes('/') || name.includes('\\') || name.includes('..')) {
268
268
  return { content: [{ type: 'text', text: '概念名无效' }] }
269
269
  }
270
+ // **两条线各留一张同名页是设计**(用户要求两个概念命名空间分开)。只回第一条
271
+ // 会让人以为另一条没有这个概念 —— 所以同名的都要说出来,并指明回的是哪一张。
272
+ const found: string[] = []
270
273
  for (const dir of VAULT_WIKI_DIRS) {
271
274
  for (const ext of ['', '.md']) {
272
275
  const path = safeChildPath(dir, name + ext)
273
- if (path && existsSync(path)) {
274
- return { content: [{ type: 'text', text: readFileSync(path, 'utf-8') }] }
275
- }
276
+ if (path && existsSync(path)) { found.push(path); break }
277
+ }
278
+ }
279
+ if (found.length) {
280
+ const text = readFileSync(found[0], 'utf-8')
281
+ if (found.length === 1) return { content: [{ type: 'text', text }] }
282
+ // 用**目录名**说清是哪条线(`Wiki/Concepts` / `Chat/Concepts`):这里不再自己
283
+ // 写一份"文章线/聊天线"的名单 —— 那份在 `_utils.LINE_LABELS` 与助手里各有一份,
284
+ // 已经有测试钉着两边一致,再来第三份就是三处要一起改。
285
+ const rel = (p: string): string => {
286
+ const dir = VAULT_WIKI_DIRS.find(d => p.startsWith(d))
287
+ return dir ? dir.split(/[\\/]/).slice(-2).join('/') : p
276
288
  }
289
+ const where = found.map(rel)
290
+ return { content: [{ type: 'text', text:
291
+ `(这个概念两条线都有:${where.join('、')};下面是第一条 ${where[0]})\n\n${text}` }] }
277
292
  }
278
293
  // Fuzzy search
279
294
  for (const dir of VAULT_WIKI_DIRS) {
package/package.json CHANGED
@@ -1,21 +1,23 @@
1
1
  {
2
2
  "name": "weflow-cli",
3
- "version": "1.9.0",
3
+ "version": "1.11.0",
4
4
  "description": "让 AI 读懂你的微信 — 公众号日报·聊天导出·知识库搜索·MCP Server",
5
5
  "type": "module",
6
6
  "bin": {
7
- "weflow-cli": "./cli.cjs"
7
+ "weflow-cli": "cli.cjs"
8
8
  },
9
9
  "files": [
10
10
  "cli.cjs",
11
11
  "dist/",
12
12
  "scripts/**/*.py",
13
+ "scripts/data/",
13
14
  "mcp-server/",
14
15
  "bin/",
15
16
  "src/",
16
17
  "resources/",
17
18
  "docs/images/",
18
19
  "docs/*.md",
20
+ "logo.png",
19
21
  "README.md",
20
22
  "OPERATIONS.md",
21
23
  "ARCHITECTURE.md",
@@ -39,7 +41,7 @@
39
41
  ],
40
42
  "repository": {
41
43
  "type": "git",
42
- "url": "https://github.com/zhuobichen/weflow-cli"
44
+ "url": "git+https://github.com/zhuobichen/weflow-cli.git"
43
45
  },
44
46
  "scripts": {
45
47
  "build": "tsc",