dsh-maoying 0.1.16 → 0.1.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.en.md CHANGED
@@ -10,13 +10,13 @@ Once installed, the main agent becomes the **editor-in-chief of your novel**: it
10
10
 
11
11
  - **Editor-in-chief + five helpers**: the main agent plans, connects, reviews and advances states; the outliner (outline), writer (write), reviewer (review), lore keeper (lore) and researcher (research) each carry their own tools. Trivial errands like finding a file or checking a foreshadow status, the chief handles itself with glob/grep.
12
12
  - **novel/ as a file database**: character cards, worldbuilding & science settings with three-color tags, relations graph, foreshadow ledger, timeline, narrative memory, clue board — all grep-friendly flat-key/top-level-array YAML, human-editable, git-versioned, no migrations, no ops.
13
- - **Seven-phase workflow**: idea → setting → outline → writing → review → consistency → export. The phase lives in the `phase` key of project.yml; the chief advances it at each milestone and reports to you.
14
- - **Writing six-step method**: continuity check → outline → draft → review → revision → finalization, looping per chapter; paired with the Collab four-step co-writing flow (setting co-creation → volume planning → golden three chapters → handoff loop) it takes a new book from zero to rolling updates.
13
+ - **Seven-phase workflow**: idea → setting → outline → writing → review → consistency → export. The phase lives in the `phase` key of project.yml; the chief advances it at each milestone and reports to you, with completion gates (core settings saved; volume plan and the target chapter outline in place before writing) — unmet, it steps back a phase.
14
+ - **Writing six-step method**: continuity check → outline → draft → review → revision → finalization, looping per chapter; paired with the Collab four-step co-writing flow (setting co-creation → volume planning → golden three chapters → handoff loop) it takes a new book from zero to rolling updates; the setting digest and the volume plan each get a user sign-off, and the golden three chapters wait until settings are locked.
15
15
  - **Foreshadowing state machine**: planted → progressing → resolved / abandoned, with planting and payoff chapter numbers, expected-payoff scheduling and priority tiers — a long serial never drops a thread; past 15 active foreshadowing entries the chief proactively suggests cleanup.
16
16
  - **Context on demand**: the chief reads index.yml for the big picture, then pulls only what the chapter at hand needs (previous chapter's ending ≈1500 chars + its outline + on-stage character cards + active foreshadow excerpts) — never the whole book.
17
17
  - **Narrow tool surface**: the chief sees only "role delegation + internal retrieval + coordination"; helpers carry their line's tools (reviewer read-only, researcher web+notes only) — less per-request tool overhead and context weight.
18
18
  - **Research**: the research helper searches the web for historical/geographic/domain material, files notes under `novel/research/`, separating fact from common lore from legend, with sources — a dividend of the DSH architecture.
19
- - **Creator panel**: a full-page web panel from the DSH sidebar — Overview (with in-place manuscript metadata editing) / Chapters / Characters / Foreshadowing / Relations / Timeline / Worldbuilding / Index Board; full-page chapter reading (outline side-by-side + five-dimension fields + status flow), form-based project.yml editing, UI language (中文/English), six font-size steps, and automatic new-version detection.
19
+ - **Creator panel**: a full-page web panel from the DSH sidebar — Overview (with in-place manuscript metadata editing and volume plan) / Chapters / Characters / Foreshadowing / Relations / Timeline / Worldbuilding / Index Board; full-page chapter reading (outline side-by-side + five-dimension fields + status flow), form-based project.yml editing, UI language (中文/English), six font-size steps, and automatic new-version detection.
20
20
  - **CLI fallback**: `maoying init / stats / index / export / brief / check` — six zero-dependency commands for scaffolding, stats, index rebuild, export, per-chapter writing cards and static checks.
21
21
 
22
22
  ## Quick Start
@@ -53,7 +53,7 @@ With the preset selected, just talk to the chief; it routes by the workflow itse
53
53
 
54
54
  > I want to write an Eastern fantasy where the protagonist's golden finger is hearing objects speak and appraising treasures to level up.
55
55
 
56
- The chief aligns genre and tone with you, delegates core character cards and worldbuilding to the lore keeper, volume planning to the outliner, then has the golden three chapters (world hook, protagonist motivation, core conflict) written and delivered.
56
+ The chief aligns the setting with you item by item (genre, golden finger, tone, the protagonist's want/obstacle/leverage, the core opposition); the lore keeper saves core character cards and worldbuilding entries for your sign-off, the outliner's volume plan gets a second sign-off — only then are the golden three chapters (world hook, protagonist motivation, core conflict) written and delivered.
57
57
 
58
58
  **Per-chapter writing (Writing six-step method)**:
59
59
 
@@ -74,8 +74,8 @@ A reply of "ok / sure / go on" counts as confirmation; the chief advances direct
74
74
  Open "**毛颖创作台**" at the bottom of the DSH sidebar — a full-page cockpit for the human eye, beyond what agents do:
75
75
 
76
76
  - **Chapters**: status filters + the writing queue; click a chapter for full-page reading — back button, outline side-by-side (Markdown rendered), read-only manuscript, five narrative-dimension fields, one-click status flow.
77
- - **Overview**: the "Edit" button on the manuscript card expands form-based editing of project.yml — title / author / genre / planned length / language / workflow phase / co-writing mode / synopsis (the former "Novel Settings" tab, merged in); saving preserves the file's existing comments. If project.yml was changed externally after the form loaded (manual edits or an agent advancing the phase), saving is rejected with a prompt to re-edit from the latest content instead of overwriting.
78
- - **Top bar**: current version always visible; a "new version ↗" badge links to the release page when npm has a newer one, next to an "Upgrade now" button that installs the latest release into the current DSH profile with pnpm (profile-directory installs only; a DeepSeek restart is required to take effect); the gear opens Settings — UI language (中文/English), six font-size steps (100%–150%), all applied immediately and remembered.
77
+ - **Overview**: the "Edit" button on the manuscript card expands form-based editing of project.yml — title / author / genre / planned length / language / workflow phase / co-writing mode / synopsis (the former "Novel Settings" tab, merged in); saving preserves the file's existing comments. If project.yml was changed externally after the form loaded (manual edits or an agent advancing the phase), saving is rejected with a prompt to re-edit from the latest content instead of overwriting. A separate "Volume plan" card lists each volume's positioning and planned chapter range from volumes.yml — signed-off volume plans are visible in the panel.
78
+ - **Top bar**: current version always visible; a "new version ↗" badge links to the release page when npm has a newer one, next to an "Upgrade now" button that installs the latest release into the current DSH profile with pnpm (profile-directory installs only, with an automatic corepack fallback when pnpm is missing; when a global `maoying` CLI is detected it is updated to the same exact version, and skipped if absent; a DeepSeek restart is required to take effect); the gear opens Settings — UI language (中文/English), six font-size steps (100%–150%), all applied immediately and remembered.
79
79
 
80
80
  The panel only writes state (chapter status, project.yml, index.yml rebuilds), never prose — prose belongs to the author and the chief.
81
81
 
@@ -89,7 +89,7 @@ The author-draft loop — you just write, hand it over, and the chores are taken
89
89
 
90
90
  After receiving a manuscript you get three things: a **review checklist** (issues only, no rewriting — applying them is up to you), a **ledger backfill** (foreshadowing / timeline / relations / memory / clue board recorded from what your text actually does, even off-plan changes, tagged `backfill`), and the **next chapter outline** (`novel/outlines/vXX-cXXX.md`, ready to write from).
91
91
 
92
- Companion commands: `maoying brief <dir> <chapter>` packs a per-chapter writing card (outline + previous ending + character cards + active foreshadowing — carry it to any editor or AI), and `maoying check <dir>` runs a zero-model static check (frontmatter completeness, foreshadow chapter references, timeline ordering — no model calls; LLM review goes through the chief).
92
+ Companion commands: `maoying brief <dir> <chapter>` packs a per-chapter writing card (outline + previous ending + character cards + active foreshadowing — carry it to any editor or AI), and `maoying check <dir>` runs a zero-model static check (frontmatter completeness, foreshadow chapter references, timeline ordering, phase readiness gates — no model calls; LLM review goes through the chief).
93
93
 
94
94
  ## Methodology Skills
95
95
 
@@ -99,7 +99,7 @@ The plugin ships 4 web-novel methodology skills. At startup the installer drops
99
99
  |---|---|
100
100
  | maoying-golden-opening | Golden three chapters: role split of the first three chapters (world hook → motivation → conflict detonation), the "something happens in the first 300 words" rule, information-release discipline and a self-check list |
101
101
  | maoying-beat-pacing | Payoff pacing: a payoff-type library, suppression-release ratios, chapter/arc/book pacing curves and chapter-end hook selection |
102
- | maoying-review-checklist | Review checklist: six layers (language / pacing / characterization / logic / foreshadowing / spoilers) with P0/P1/P2 severity |
102
+ | maoying-review-checklist | Review checklist: seven layers (language / pacing / characterization / logic / foreshadowing / spoilers / style) with P0/P1/P2 severity |
103
103
  | maoying-foreshadow-discipline | Foreshadow management: register on planting, pacing & scheduling, the "surprising yet reasonable" payoff bar, and ledger cleanup thresholds |
104
104
 
105
105
  The installer only touches `maoying-*` prefixed directories; your own skills under `~/.dsh/skills/` are untouched, byte for byte. After uninstalling the plugin, remove the skill directories manually (all four together):
@@ -111,7 +111,7 @@ rm -rf "${DSH_HOME:-$HOME/.dsh}/skills/"maoying-*
111
111
 
112
112
  ## The novel/ Data Spec
113
113
 
114
- The `novel/` directory is the plugin's entire database: project.yml (metadata + seven-phase state), volumes.yml, chapters/ (frontmatter five narrative dimensions + prose), characters/ (character cards), world/, science/ (three-color settings), relations.yml, foreshadows.yml (the state machine), timeline.yml, memories.yml (with appearance records and the promise ledger), clue-board.yml, research/, exports/. Full formats, examples and design rationale:
114
+ The `novel/` directory is the plugin's entire database: project.yml (metadata + seven-phase state), style.md (the writing style baseline), volumes.yml, chapters/ (frontmatter five narrative dimensions + prose), characters/ (character cards), world/, science/ (three-color settings), relations.yml, foreshadows.yml (the state machine), timeline.yml, memories.yml (with appearance records and the promise ledger), clue-board.yml, research/, exports/. Full formats, examples and design rationale:
115
115
 
116
116
  - Quick reference: `novel/README.md` after project init (template source: [templates/novel/README.md](templates/novel/README.md))
117
117
  - Full spec: [docs/spec.md](docs/spec.md) (why not SQLite, five-dimension field definitions, foreshadow state-machine semantics, appearance-record conventions)
@@ -124,7 +124,7 @@ maoying stats [dir] # per-chapter CJK counts, status breakdown, current phase
124
124
  maoying index [dir] # rebuild index.yml from volumes.yml + chapters/ (derived file)
125
125
  maoying export [dir] # export the book: --format md|txt|epub (default md), --out <dir> to change destination
126
126
  maoying brief [dir] <chapter> # pack a per-chapter writing card (outline + previous ending + character cards + active foreshadowing); --out to write to disk, stdout by default
127
- maoying check [dir] # static check (no model calls): frontmatter / enums / chapter numbers / foreshadow refs / timeline years / relation-card refs
127
+ maoying check [dir] # static check (no model calls): frontmatter / enums / chapter numbers / foreshadow refs / timeline years / relation-card refs / phase readiness gates
128
128
  ```
129
129
 
130
130
  Export examples:
package/README.md CHANGED
@@ -10,13 +10,13 @@
10
10
 
11
11
  - **主编 + 五帮手**:主 agent 当主编,只做规划、衔接、验收、状态推进;大纲师(outline)、写手(write)、审校(review)、设定管理员(lore)、素材调研员(research)各带本行工具随叫随到。找文件、查伏笔状态这类顺手小事主编自己 glob/grep 就办,不绕委派。
12
12
  - **novel/ 文件数据库**:角色卡、世界观、科学设定三色标注、关系图、伏笔账本、时间线、叙事记忆、线索板,全部是 grep 友好的平键/顶层数组 YAML——人可直接改,git 可版本化,无迁移无运维。
13
- - **七阶段工作流**:idea 选题 → setting 设定 → outline 大纲 → writing 写作 → review 审阅 → consistency 一致性 → export 导出。阶段记在 project.yml 的 phase 键,每完成一个里程碑主编推进并简报。
14
- - **Writing 六步法**:衔接检查 → 出大纲 → 写正文 → 审稿 → 修改 → 定稿维护,逐章循环;配合 Collab 四步共创(设定共创 → 分卷规划 → 黄金三章 → 交接循环)把新书从零带到滚动更新。
13
+ - **七阶段工作流**:idea 选题 → setting 设定 → outline 大纲 → writing 写作 → review 审阅 → consistency 一致性 → export 导出。阶段记在 project.yml 的 phase 键,每完成一个里程碑主编推进并简报;推进有完成判据(核心设定落盘、分卷规划与目标章大纲在案才进 writing),不满足就回上一阶段补齐。
14
+ - **Writing 六步法**:衔接检查 → 出大纲 → 写正文 → 审稿 → 修改 → 定稿维护,逐章循环;配合 Collab 四步共创(设定共创 → 分卷规划 → 黄金三章 → 交接循环)把新书从零带到滚动更新;设定一览与分卷规划各设一个用户拍板点,前三章在设定齐备前不开工。
15
15
  - **伏笔状态机**:planted(埋设)→ progressing(推进)→ resolved(回收)/ abandoned(弃用),埋设与回收记章节号、预期回收章节排期、优先级分档——长篇不断线,活跃伏笔超 15 条主编主动提醒清理。
16
16
  - **上下文按需取**:主编先读 index.yml 概览,写到哪章读哪章(前章结尾约 1500 字 + 该章大纲 + 出场角色卡 + 活跃伏笔节选),不把整本书塞进上下文。
17
17
  - **工具面收窄**:主编只见「角色委派 + 内部检索 + 协调」白名单,帮手各带本行工具(审校只读、考据只带联网+落笔记);每次请求的工具开销与上下文占用随之下降。
18
18
  - **素材考据**:research 帮手联网检索历史/地理/专业领域素材,笔记落 `novel/research/`,区分史实/通说/演义并附来源——DSH 架构的红利。
19
- - **创作台面板**:DSH 侧栏一键打开的全页可视化面板——概览(含书稿元信息编辑)/章节/角色/伏笔/关系图/时间线/设定/索引板八个 tab;章节整页阅读(章纲对照 + 五维 + 状态流转)、project.yml 表单化编辑、顶栏字号六档缩放与自动新版检测。
19
+ - **创作台面板**:DSH 侧栏一键打开的全页可视化面板——概览(含书稿元信息编辑与分卷规划)/章节/角色/伏笔/关系图/时间线/设定/索引板八个 tab;章节整页阅读(章纲对照 + 五维 + 状态流转)、project.yml 表单化编辑、顶栏字号六档缩放与自动新版检测。
20
20
  - **CLI 兜底**:`maoying init / stats / index / export / brief / check` 六条零依赖命令管脚手架、统计、索引重建、导出、写作卡打包与静态体检。
21
21
 
22
22
  ## 快速开始
@@ -53,7 +53,7 @@ npm install -g dsh-maoying # 或装成全局 maoying 命令
53
53
 
54
54
  > 我想写一本东方玄幻,主角靠「听懂器物说话」的金手指鉴宝升级。
55
55
 
56
- 主编与你对齐题材与基调,委派设定管理员建核心角色卡与世界观条目,委派大纲师做分卷规划,然后把黄金三章(立世界钩子、立主角动机、立核心冲突)写出来交付。
56
+ 主编与你逐项对齐设定(题材、金手指、基调、主角三要素、对抗主线),设定管理员落盘核心角色卡与世界观条目后交你拍板;大纲师出分卷规划再交你拍板——设定与分卷都定了,才动笔黄金三章(立世界钩子、立主角动机、立核心冲突)交付。
57
57
 
58
58
  **逐章写作(Writing 六步法)**:
59
59
 
@@ -74,8 +74,8 @@ npm install -g dsh-maoying # 或装成全局 maoying 命令
74
74
  DSH 左侧栏底部点「**毛颖创作台**」打开全页面板(改文件、跑流程之外,给肉眼看的驾驶舱):
75
75
 
76
76
  - **章节**:状态筛选 + 按单写作清单;点章节进整页阅读——返回按钮、章纲对照(Markdown 渲染)、只读正文、五维叙事字段、一键状态流转。
77
- - **概览**:书稿卡右上「编辑」按钮展开 project.yml 的书名/作者/题材/篇幅/语言/工作流阶段/共创模式/简介表单化编辑(原「小说设置」tab 并入),保存保留文件里原有注释;表单载入后 project.yml 被外部(作者手改 / agent 推进阶段)改过时拒绝保存并提示重改,不覆盖人工改动。
78
- - **顶栏**:当前版本号常驻;npm 上有新版时亮「有新版 ↗」徽章直连发布页,旁边「一键升级」按钮直接用 pnpm 把最新包装进当前 DSH 档(仅支持 profile 目录安装;装完需重启 DeepSeek 才生效);齿轮打开系统设置,界面语言中文/English 可切、字号六档(100%–150%)整体缩放,均立即生效并记忆。
77
+ - **概览**:书稿卡右上「编辑」按钮展开 project.yml 的书名/作者/题材/篇幅/语言/工作流阶段/共创模式/简介表单化编辑(原「小说设置」tab 并入),保存保留文件里原有注释;表单载入后 project.yml 被外部(作者手改 / agent 推进阶段)改过时拒绝保存并提示重改,不覆盖人工改动。概览另设「分卷规划」卡,列出 volumes.yml 各卷定位与计划章节范围——拍板过的分卷有处可查。
78
+ - **顶栏**:当前版本号常驻;npm 上有新版时亮「有新版 ↗」徽章直连发布页,旁边「一键升级」按钮直接用 pnpm 把最新包装进当前 DSH 档(仅支持 profile 目录安装,pnpm 缺失时自动回落 corepack;检测到全局 `maoying` CLI 时顺带以同一精确版本更新,未装则跳过;装完需重启 DeepSeek 才生效);齿轮打开系统设置,界面语言中文/English 可切、字号六档(100%–150%)整体缩放,均立即生效并记忆。
79
79
 
80
80
  面板只写状态(章节状态、project.yml、index.yml 重建),不改正文——正文永远归作者与主编。
81
81
 
@@ -99,7 +99,7 @@ author-draft 下的协作循环——你只管写,交稿即接管杂务:
99
99
  |---|---|
100
100
  | maoying-golden-opening | 黄金三章:前三章职能分工(世界钩子 → 动机确立 → 冲突引爆)、前 300 字出事原则、信息释放纪律与自检清单 |
101
101
  | maoying-beat-pacing | 爽点节奏:爽点类型库、压抑-释放配比、单章/中/大三级节奏曲线与章尾钩子选型 |
102
- | maoying-review-checklist | 审校清单:语言/节奏/人设/逻辑/伏笔/剧透六层逐项检查,按 P0/P1/P2 三档严重度输出 |
102
+ | maoying-review-checklist | 审校清单:语言/节奏/人设/逻辑/伏笔/剧透/风格七层逐项检查,按 P0/P1/P2 三档严重度输出 |
103
103
  | maoying-foreshadow-discipline | 伏笔管理:埋设即登记、推进节奏排期、回收「意外 + 合理」标准与台账清理阈值 |
104
104
 
105
105
  安装器只认 `maoying-*` 前缀目录,`~/.dsh/skills/` 下你自己的技能一个字节不动。卸载插件后技能目录需手动清理(四目录一起删):
@@ -111,7 +111,7 @@ rm -rf "${DSH_HOME:-$HOME/.dsh}/skills/"maoying-*
111
111
 
112
112
  ## novel/ 数据规范
113
113
 
114
- `novel/` 目录是整个插件的数据库:project.yml(元信息与七阶段 phase)、volumes.yml、chapters/(frontmatter 五维叙事字段 + 正文)、characters/(角色卡)、world/、science/(三色设定)、relations.yml、foreshadows.yml(伏笔状态机)、timeline.yml、memories.yml(含出场记录与承诺账)、clue-board.yml、research/、exports/。全部格式、示例与设计理由见:
114
+ `novel/` 目录是整个插件的数据库:project.yml(元信息与七阶段 phase)、style.md(写作风格基准)、volumes.yml、chapters/(frontmatter 五维叙事字段 + 正文)、characters/(角色卡)、world/、science/(三色设定)、relations.yml、foreshadows.yml(伏笔状态机)、timeline.yml、memories.yml(含出场记录与承诺账)、clue-board.yml、research/、exports/。全部格式、示例与设计理由见:
115
115
 
116
116
  - 速查版:项目初始化后的 `novel/README.md`(模板源 [templates/novel/README.md](templates/novel/README.md))
117
117
  - 完整版:[docs/spec.md](docs/spec.md)(为什么不用 SQLite、五维字段定义、伏笔状态机语义、出场记录约定)
@@ -124,7 +124,7 @@ maoying stats [dir] # 逐章 CJK 字数、状态分布、当前 phase
124
124
  maoying index [dir] # 从 volumes.yml + chapters/ 重建 index.yml(派生文件)
125
125
  maoying export [dir] # 导出全书:--format md|txt|epub(默认 md),--out <目录> 改输出位置
126
126
  maoying brief [dir] <chapter> # 组装单章写作卡(章纲+前章结尾+角色卡+活跃伏笔);--out 落盘,缺省 stdout
127
- maoying check [dir] # 静态体检(不调模型):frontmatter/枚举/章号/伏笔引用/时间线年份/关系卡引用
127
+ maoying check [dir] # 静态体检(不调模型):frontmatter/枚举/章号/伏笔引用/时间线年份/关系卡引用/phase 就绪判据
128
128
  ```
129
129
 
130
130
  export 示例:
package/bin/maoying.mjs CHANGED
@@ -12,7 +12,7 @@
12
12
  * maoying export [dir] 导出全书:--format md|txt|epub(默认 md)、--out <目录>
13
13
  * maoying brief [dir] <chapter> [--out <文件>]
14
14
  * 组装某章写作卡(章纲+前章结尾+出场角色卡+活跃伏笔)
15
- * maoying check [dir] 静态体检(不调模型):frontmatter/枚举/章号/伏笔引用等
15
+ * maoying check [dir] 静态体检(不调模型):frontmatter/枚举/章号/伏笔引用/阶段就绪判据等
16
16
  *
17
17
  * 子命令出错 exit 1,中文报错。
18
18
  */
@@ -446,7 +446,7 @@ const HELP_TEXT = `毛颖(maoying)—— 网文创作项目 CLI
446
446
  maoying export [dir] 导出全书:--format md|txt|epub(默认 md),--out <目录> 改输出位置
447
447
  maoying brief [dir] <chapter>
448
448
  组装某章写作卡(章纲+前章结尾+出场角色卡+活跃伏笔);--out <文件> 落盘,缺省打到 stdout
449
- maoying check [dir] 静态体检(不调模型):frontmatter 完整性、枚举值、章号卷号一致、伏笔章号引用、时间线年份、关系卡引用
449
+ maoying check [dir] 静态体检(不调模型):frontmatter 完整性、枚举值、章号卷号一致、伏笔章号引用、时间线年份、关系卡引用、phase 阶段就绪判据
450
450
 
451
451
  说明:
452
452
  novel/ 目录的数据规范见 templates/novel/README.md(或项目内 novel/README.md)。
@@ -39,7 +39,7 @@ webServer.register({ kind: 'prefix', path: '/api/maoying', handler: async (req,
39
39
  |---|---|---|---|
40
40
  | `client.css` | GET | — | text/css(lib/base.css 现读,no-cache) |
41
41
  | `update-check` | GET | — | `{ ok, current, latest, updateAvailable, releaseUrl, checkedAt, error, source }`——新版检测(npm registry → npmmirror → GitHub 三级源,1h 缓存 + 7 天 stale-if-error,全败静默降级为 latest=null / error 非空) |
42
- | `self-update` | POST | — | `{ ok, from, to, restartRequired: true }` 或 `{ ok: false, kind, error }`——面板内一键升级:安装形态/pnpm 探测通过后跑 `pnpm --dir <profileDir> add dsh-maoying@latest`(180s 超时,无 shell)。仅支持 `<dshHome>/profiles/<profile>/node_modules/dsh-maoying` 真实目录安装;symlink/dev 检出(dev-link)与非 profile 布局(unsupported-layout)、pnpm 缺失(pnpm-missing)、超时(timeout)、pnpm 非零退出(pnpm-failed)一律 200 + ok:false。**装完只换磁盘包,运行中进程仍是旧代码,restartRequired 恒 true——重启 DeepSeek 后生效** |
42
+ | `self-update` | POST | — | `{ ok: true, kind: 'installed', from, to, restartRequired: true }` / `{ ok: true, kind: 'up-to-date', from }` 或 `{ ok: false, kind, error }`——面板内一键升级:安装形态 + profile 就绪预检 + 版本预检(registry 失败再 mirror,拿不到 latest 不动手)通过后,在 profile 目录里直跑 `pnpm add dsh-maoying@<精确版本>`(pnpm 候选链逐个 spawn:裸 pnpm → corepack pnpm → homebrew / node@XX keg-only / execPath 同目录 corepack → PNPM_HOME 落位,仅 ENOENT 换下一路;180s 超时)。仅支持 `<dshHome>/profiles/<profile>/node_modules/dsh-maoying` 真实目录安装;symlink/dev 检出(dev-link)、非 profile 布局(unsupported-layout)、profile 未初始化(profile-missing)、拿不到最新版(no-target)、pnpm 缺失(pnpm-missing,message 带手动出路)、超时(timeout)、pnpm 非零退出(nonzero)一律 200 + ok:false。**装完只换磁盘包,运行中进程仍是旧代码,restartRequired 恒 true——重启 DeepSeek 后生效** |
43
43
  | `host-debug` | GET | — | `{ ok, hostVersion, trace, shape, registry, runtime }`——现场诊断(见下节) |
44
44
  | `workspaces` | GET | — | `{ ok, workspaces: [{ path, name, hasNovel }] }`——workspaceRegistry.list() 逐根探测 `<root>/novel/project.yml` |
45
45
  | `state` | GET | `path=<root>` | 全量快照(见 §3 契约) |
@@ -80,6 +80,7 @@ webServer.register({ kind: 'prefix', path: '/api/maoying', handler: async (req,
80
80
  "chapters": [{ "file","volume","num","title","status","words","summary",
81
81
  "cognitive_frame","emotional_anchor","world_texture",
82
82
  "suspense","interpersonal_tension" }], // 按 volume,num 升序;words 为 CJK 计数
83
+ "volumes": [{ "id","title","summary","chapters" }], // volumes.yml 分卷规划原样;chapters 为 001-020 计划范围串,非章节清单
83
84
  "characters": [{ "file","name","age","gender","role","appearance","personality",
84
85
  "background","motivation","arc","markers" }], // markers 数组,缺省 []
85
86
  "relations": [{ "a","b","type","description","intensity","started","ended" }], // a/b:relations.yml 里是角色 slug,出快照时对得上角色卡的端点归一成 name(关系图按 name 找节点),对不上原样保留
@@ -90,7 +91,7 @@ webServer.register({ kind: 'prefix', path: '/api/maoying', handler: async (req,
90
91
  "clues": [{ "kind","content","related_chapter","resolved" }],
91
92
  "world": [{ "file","category","tags","name","description" }],
92
93
  "science": [{ "file","label","name","description","references" }],
93
- "research": [{ "file","topic" }],
94
+ "research": [{ "file","topic","sources","description" }], // sources 为 frontmatter sources 的 URL 数组,description 为笔记正文
94
95
  "outlines": [{ "file","chapter","words","excerpt" }], // outlines/ 章纲清单,chapter 为对应章节文件名,excerpt 为章纲节选(前 120 字,面板按单写作区块用),无章纲的章不列
95
96
  "totals": { "chapters": 12, "words": 38412,
96
97
  "byStatus": { "pending": 3, "writing": 2, "review": 1, "accepted": 6 } },
@@ -136,6 +137,10 @@ webServer.register({ kind: 'prefix', path: '/api/maoying', handler: async (req,
136
137
  - **按单写作兼容孤儿章纲**(0.1.15):章纲先于正文时面板不再零入口——「按单写作」区块在联交(有章纲且 status=pending 的章)之外照列未建章的孤儿章纲(按章纲序保序混排):「未建章」徽章 + 章纲节选 + 字数 + 两个动作(行点击开章纲全文弹层:MaskPortal + MdView 渲染 GET `outline` 的 body、words 一并显示;「建章」按钮 POST `chapter-create` 在 chapters/ 落 status=pending 空章——frontmatter 按 chapters/vXX-cXXX.md 模板、title 取章纲首条标题行去「章纲」后缀,成功 toast 后重拉快照,新章进表格、走既有 pending 流转,孤儿行按新快照自然消失);chapters/ 为空而 outlines/ 非空时空态改提示「下方按单写作已列出未建章章纲」。路由 13 → 15 条(outline GET / chapter-create POST);I18N zh/en 各 219 → 230 条(chapters.outlineRowTip / noChapter / createBtn / creating / createTip / emptyWithOutlines、toast.chapterCreated、outline.modalAria / closeAria / loading / loadFailed)。
137
138
  - **小说设置并入概览**(0.1.15):原第 9 个「小说设置」tab 撤销(八个 tab),改为概览书稿卡右上「编辑」按钮——点击后 hero 卡原位切换为书稿元信息表单(ProjectMetaForm,8 平键 + 取消/保存),保存链路不变(`POST project-save` 携 `base_hash` 409 人工改动保护,成功重拉快照并退出编辑态,取消直接退出不落盘)。路由不变;I18N zh/en 各 230 → 232 条(tabs.settings 移除,overview.edit / overview.editTip / novel.cancel 新增)。
138
139
  - **role 徽章本地化**(0.1.15):角色卡墙与全卡弹层的 role 徽章不再直出角色卡 frontmatter 原文——契约四态(`protagonist|antagonist|supporting|minor`)按界面语言出标签(主角/反派/配角/龙套;英文面板 Protagonist/Antagonist/Supporting/Minor),role 是自由文本、契约外取值原样展示不翻译;tone 归色逻辑(roleTone 关键词匹配)不变。I18N zh/en 各 232 → 236 条(role.protagonist / antagonist / supporting / minor)。
140
+ - **分卷规划卡 + 考据笔记正文**(0.1.18):快照顶层新增 `volumes`(volumes.yml 原样:id/title/summary/chapters 计划范围串)——概览新增「分卷规划」卡(有卷才显,卷头 id · 卷名 + 计划范围 tag + 卷定位一句),分卷拍板件在面板有复核位(配合 CLI check 的 phase 阶段就绪判据);research 快照从只取 topic 扩为 sources + description,设定 tab「资料检索」从标签行改为逐条渲染:topic 标题 + 笔记正文(MdView)+ sources 参考(悬停显全文 URL)。路由不变;I18N zh/en 各 +1 条(overview.volumes)。
141
+ - **pnpm 候选链对齐 dsh-paoding**(0.1.18):修复一键升级「未找到 pnpm」误报。病因(实机验证):本机 pnpm 由 corepack 管理但未 `corepack enable`,PATH 里没有裸 pnpm,PNPM_HOME 落位也没有——旧版 existsSync+accessSync(X_OK) 文件预筛(PATH 目录扫描 + homebrew/pnpm 官方落位)全落空直接报 pnpm-missing;且 desktop Electron 进程 PATH 可能是 launchd 最小集(实测最小 PATH 下裸 corepack 也 ENOENT),`/opt/homebrew/bin/corepack` 不在,只有 `/opt/homebrew/opt/node@24/bin/corepack` 在盘上。机制照 dsh-paoding tools/lib/upgrade.mjs 对齐:① **spawn ENOENT 探测链**替代文件预筛——逐候选真 spawn,仅 err.code==='ENOENT' 换下一路(EACCES / 超时 / 非零退出是真实运行结果,如实返回不换通道),绝对路径候选才 existsSync 预筛(不存在不浪费 spawn);新候选链:裸 pnpm → 裸 corepack(+`pnpm` 参数前缀)→ `/opt/homebrew/bin/corepack` → `/opt/homebrew/opt/node@XX/bin/corepack`(readdirSync 过滤 node 前缀目录拼路径,多版本按序全收;目录不存在跳过)→ execPath 同目录 corepack(桌面 Electron 下无用但无害,headless/web profile 有用)→ `~/Library/pnpm`、`~/.local/share/pnpm`。② **升级前版本预检**:fetchLatestFromRegistry(10s) 失败再 fetchLatestFromMirror(10s),拿不到 latest 不做半截升级(kind: no-target,message 带两路错误);compareVersions(target, current)<=0 短路 kind: 'up-to-date'(`{ ok: true, kind: 'up-to-date', from }`,前端 toast「已是最新版」后按钮恢复可点、不进已安装态);装精确版本 `dsh-maoying@<target>` 而非 @latest(避开 pnpm 新鲜度防护 / 镜像 packument 滞后的静默空转)。③ **cwd = profile 目录**(pnpm 操作对象就是它),去掉 --dir。④ profile 目录缺 package.json → 诚实失败 kind: 'profile-missing'。⑤ win32 pnpm/corepack 是 .cmd shim:spawn shell:true(CVE-2024-27980 加固)+ 命令补 .cmd 后缀、参数保持数组;darwin/linux 恒 shell:false。⑥ 子进程输出尾部 2KB → 8KB(合并 stdout+stderr);全候选 ENOENT 的 pnpm-missing message 带可操作出路:「可先在终端执行 corepack enable 并重启 DSH 后重试;或手动升级:cd <profileDir> && corepack pnpm add dsh-maoying@<目标版本>」,dev-link 的 message 保留 git pull 出路。spawnImpl 契约改 paoding 形状 `(command, args, options, timeoutMs, timeoutLabel) → { code, output, error?, errorCode? }`(缺省 defaultSpawn 合并输出、超时 SIGTERM、5s 宽限后 SIGKILL 兜底、收敛 errorCode 'ETIMEDOUT');退出码非零 kind 从 pnpm-failed 更名 nonzero。前端 pnpm-missing 等失败 message 服务端已带出路文案,toast 直显不截断。安全闸(realpath 形态两道闸 / 模块级 in-flight 去重 / 成功后 invalidateVersionCache)与依赖全注入风格不变。路由仍 15 条;I18N zh/en 各 237 → 238 条(toast.selfUpdate.upToDate)。
142
+ - **概览补显共创模式**(0.1.18):书稿卡阶段行 phase pill 后补「共创模式」短标签徽章(悬浮出全称;快照 mode 缺失或越枚举时不显示,老项目无该键不误标)。路由不变;I18N zh/en 各 238 → 241 条(modeShort.aiDraft / coWrite / authorDraft)。
143
+ - **一键升级顺带全局 CLI**(0.1.18):本机常见两份独立安装——desktop profile(`<dshHome>/profiles/desktop/node_modules/dsh-maoying`,一键升级的更新对象)与全局 CLI(`npm i -g` 装的 `<npm 全局>/node_modules/dsh-maoying`,如 `/opt/homebrew/bin/maoying` → `/opt/homebrew/lib/node_modules/dsh-maoying/bin/maoying.mjs`)——只更 profile 会版本偏斜;方案 B:profile 阶段落定(installed 装完 / up-to-date 短路)后跑独立全局阶段,把两份收敛到同一精确版本。**检测**(detectGlobalCli,零 spawn 纯文件系统):PATH 各目录 + `/opt/homebrew/bin` + `/usr/local/bin` 找 `maoying`(win32 `maoying.cmd`),existsSync 预筛;命中后 realpathSync 该 bin 两级上溯得包根(`bin/maoying.mjs` → 包根),包根 package.json 的 name 必须是 `dsh-maoying` 才认(防怪链接);包根 realpath 落在本 profile 目录内(如 profile 自带 `.bin/maoying`)→ 不算全局,跳过该候选继续找;全落空 → 不 spawn。**更新**走 npm 候选链(与 pnpm 链同款 spawn ENOENT 探测):裸 npm → execPath 同目录 → `/opt/homebrew/bin` → `/usr/local/bin` → `/opt/homebrew/opt/node@XX/bin`,spawn `npm i -g dsh-maoying@<target>`(cwd=os.tmpdir()、独立 120s 超时,profile pnpm 仍 180s)。**返回形状**:成功对象新增 `globalCli` 字段——`{ ok: true, skipped: 'missing' }`(没装全局,跳过)/ `{ ok: true, skipped: 'same', version }`(已同版)/ `{ ok: true, from, to }` / `{ ok: false, error, output? }`(error 中文、含手动出路 `npm i -g dsh-maoying@<target>`)——**全局失败不拖累 profile 安装**:整体仍 ok:true,重启照常生效,失败如实透出;dev-link / unsupported-layout / no-target / profile-missing 等失败路径维持整单拒绝,不碰全局。路由把 globalCli 原样透传(up-to-date 与 installed 两个成功分支)。前端成功 toast 主文案不变、按 globalCli 拼第二句(missing / same 不提零噪音,真更新了显「全局 maoying CLI a → b」,失败如实报错),up-to-date 分支同样拼接,toast 文本容器加 `white-space: pre-line` 承接换行;self-update 请求前端超时 200s → 340s(180 + 120 + 40 余量)。路由不变;I18N zh/en 各 241 → 243 条(toast.selfUpdate.globalOk / globalFail)。
139
144
 
140
145
  ## 5. 验收基线
141
146
 
package/docs/design.md CHANGED
@@ -133,18 +133,18 @@ delegation-labels 静态角色名映射:{outline: 大纲师, write: 写手, re
133
133
  persona prefix 内容骨架(agent.cordis.yml 内联,中文书写):
134
134
 
135
135
  1. **身份**:网文主编/创作总监,管 project 目录 novel/,重活委派五帮手,自己只做规划、衔接、验收、状态推进。
136
- 2. **开工纪律**:先读 novel/project.yml + index.yml;不确定文件格式读 novel/README.md;不全量读章节,写到哪章读哪章上下文(前章结尾 ~1500 字 + 该章 frontmatter + 出场角色卡 + 活跃伏笔节选)。
136
+ 2. **开工纪律**:先读 novel/project.yml + index.yml + style.md(若有);不确定文件格式读 novel/README.md;不全量读章节,写到哪章读哪章上下文(前章结尾 ~1500 字 + 该章 frontmatter + 出场角色卡 + 活跃伏笔节选)。
137
137
  3. **七阶段状态机**(每阶段推进写 project.yml phase):idea 选题 → setting 设定 → outline 大纲 → writing 写作 → review 审阅 → consistency 一致性 → export 导出。每完成一个里程碑必须推进 phase 并告知用户。
138
138
  4. **Writing 六步法**(逐章循环):
139
139
  ① 衔接检查:读前章结尾,确认无断裂;
140
140
  ② 委派 outline 出/改本章大纲(含五维字段),主编过目;
141
141
  ③ 委派 write 写正文(写手人设要求:按大纲覆盖五维、不写崩人设、章尾留钩子),status→writing;
142
- ④ 委派 review 审稿(清单:语言/节奏/人设符合/不剧透/伏笔推进合理/前后矛盾),status→review;
142
+ ④ 委派 review 审稿(清单:语言/节奏/人设符合/不剧透/伏笔推进合理/前后矛盾/风格符合),status→review;
143
143
  ⑤ 审稿问题回 write 修(continuable 就地续修)或主编微调;
144
144
  ⑥ 通过后 status→accepted,委派 lore 做定稿维护(出场记录、伏笔状态、记忆、线索板、时间线),`maoying index` 重建概览。
145
145
  循环检查:还有非 accepted 章节 → 回 ①。
146
- 5. **Collab 四步共创**(新书冷启动):设定共创(世界观+核心角色卡)→ 分卷规划(volumes.yml + 各卷 summary)→ 前三章交付(黄金三章:第一章立世界观钩子、第二章立主角动机、第三章立核心冲突)→ 交接循环写作(切 Writing 六步法)。
147
- 6. **简短确认即执行**:用户回「ok/可以/继续」直接推进下一步,不再复述确认。
146
+ 5. **Collab 四步共创**(新书冷启动):设定共创(最小设定集逐项对齐 + 世界观与核心角色卡落盘,设用户拍板点)→ 分卷规划(volumes.yml + 各卷 summary,设用户拍板点)→ 前三章交付(机械自检设定件齐备后走黄金三章:第一章立世界观钩子、第二章立主角动机、第三章立核心冲突)→ 交接循环写作(切 Writing 六步法)。
147
+ 6. **简短确认即执行(分级)**:逐章滚动中用户回「ok/可以/继续」直接推进下一步,不再复述确认;冷启动里程碑(设定共创、分卷规划)是方向性拍板点,须列决策点等用户实质回应。
148
148
  7. **设定变更上报**:写手回报的临场设定变更(新角色/新地点/伏笔异动)必须经 lore 落盘才算数;发现与既有设定冲突,先停笔报告主编。
149
149
  8. **失败处理**:委派失败按 DSH 委派 SOP(diagnose by stop reason,max-tokens 拆章,refusal 换路)。
150
150
 
@@ -164,7 +164,7 @@ persona prefix 内容骨架(agent.cordis.yml 内联,中文书写):
164
164
  - `maoying index [dir]`:从 chapters/ 重建 index.yml(卷/章/标题/状态/字数/一句话梗概)。
165
165
  - `maoying export [dir]`:导出全书为 md / txt / epub(默认 md;`--out` 改输出目录,缺省 `<dir>/exports/`;同名自动加序号不覆盖)。
166
166
  - `maoying brief [dir] <chapter>`:组装单章写作卡(章纲 + 前章结尾 + 出场角色卡 + 活跃伏笔);`--out <文件>` 落盘,缺省打到 stdout。
167
- - `maoying check [dir]`:静态体检(不调模型),与面板/规范同一套规则(frontmatter 完整性、枚举、章号、伏笔引用、时间线年份、关系卡引用)。
167
+ - `maoying check [dir]`:静态体检(不调模型),与面板/规范同一套规则(frontmatter 完整性、枚举、章号、伏笔引用、时间线年份、关系卡引用、phase 阶段就绪判据)。
168
168
  - 主编人设里写明:定稿维护后由 lore 角色直接重写 index.yml(文件规范写明格式),CLI `maoying index` 仅供人工兜底;stats / init 供人工使用。
169
169
 
170
170
  ## 8. 二期路线
@@ -205,5 +205,5 @@ project.yml 加 `mode` 字段:`ai-draft`(默认,现状)/ `co-write`(
205
205
  ### 9.6 P1 工具
206
206
 
207
207
  - `maoying brief <dir> <章号>` 写作卡:章纲 + 前章结尾约 1500 字 + 出场角色卡 + 活跃伏笔节选,打成一个 md(stdout 或 --out)。给作者带去任意编辑器/其他 AI;
208
- - `maoying check <dir>` 静态体检(**不调模型**——LLM 审校走主编):frontmatter 完整性、五维缺键、状态枚举、章号/卷号规范、伏笔章号引用存在性、时间线年份乱序、角色卡悬空引用;
208
+ - `maoying check <dir>` 静态体检(**不调模型**——LLM 审校走主编):frontmatter 完整性、五维缺键、状态枚举、章号/卷号规范、伏笔章号引用存在性、时间线年份乱序、角色卡悬空引用、phase 枚举与阶段就绪判据(outline 起查主角卡/核心反派卡/世界观条目/分卷规划);
209
209
  - 面板三件:章节抽屉加章纲对照栏 + 复制文件路径按钮;伏笔看板卡上 `source: backfill` 显示「回填」徽章;章节 tab 顶部「按单写作」区块(有章纲且 status=pending 的章,按序列章纲节选;未建章的孤儿章纲照列——可看章纲全文、一键建章,0.1.15 起)。
package/docs/spec.md CHANGED
@@ -27,7 +27,10 @@
27
27
  字段与最小示例见速查版(`templates/novel/README.md`),此处只补约定:
28
28
 
29
29
  ### project.yml
30
- `phase` 七态 `idea|setting|outline|writing|review|consistency|export` 只能由主编推进(帮手不得越权改),且必须顺序推进不可跳越;推进时主编须向用户简报。`language` 影响写手与审校的语言纪律(如 `zh` 不允许成段外文)。`mode` 三值决定正文归谁写:`ai-draft`(缺省,AI 代笔,主编走 Writing 六步法)/ `co-write`(逐章指派谁写,主编动笔前先问清本章归谁)/ `author-draft`(全书作者亲笔,主编只备料、审稿、记账,永不代写)。文件里没有 `mode` 键的旧项目一律按 `ai-draft` 处理。
30
+ `phase` 七态 `idea|setting|outline|writing|review|consistency|export` 只能由主编推进(帮手不得越权改),且必须顺序推进不可跳越;推进时主编须向用户简报。推进有完成判据:setting → outline 须核心角色卡(主角、核心反派)与世界观核心条目(金手指规则、对抗格局)已落盘,且 characters/ 有两张及以上角色卡时 relations.yml 不为空(关系网须登记);outline → writing 须 volumes.yml 在案且目标章大纲已出;判据不满足回上一阶段补齐。冷启动(Collab 四步)在设定落盘与分卷规划两处各设一个用户拍板点——主编简报列决策点,等用户实质确认才进下一步。`language` 影响写手与审校的语言纪律(如 `zh` 不允许成段外文)。`mode` 三值决定正文归谁写:`ai-draft`(缺省,AI 代笔,主编走 Writing 六步法)/ `co-write`(逐章指派谁写,主编动笔前先问清本章归谁)/ `author-draft`(全书作者亲笔,主编只备料、审稿、记账,永不代写)。文件里没有 `mode` 键的旧项目一律按 `ai-draft` 处理。
31
+
32
+ ### style.md
33
+ 写作风格基准(人称视角、语言基调、节奏、对话、情绪与爽点、禁忌),写手/大纲师/审校一律遵守;纯 markdown、无 frontmatter,作者随时手改、改完即生效;冷启动由主编与用户对齐后落盘,旧项目缺失时按通用网文基线执行。设计理由:风格集中在一个可手改文件里,而不是写死在 persona——persona 只写加载纪律(读它、服从它、冲突上报主编),风格内容随书可变,作者不改插件就能改风格;旧项目没有该文件时优雅降级(各 persona 与审校风格层均写「若有」);审校风格层以其为裁判基准,文件缺席时退回通用网文基线抽查明显风格跳变,并在报告注明「无风格基准」。
31
34
 
32
35
  ### volumes.yml
33
36
  `id` 与章节文件名前缀严格一致(`v01` ↔ `chapters/v01-cXXX.md`),index.yml 的卷分组按本文件顺序输出。`chapters` 范围写法 `001-020` 是给人看的计划值,运行时以章节文件实况为准。
@@ -131,6 +134,6 @@ total: {chapters: 21, words: 65210, accepted: 18}
131
134
  - `maoying index` 是第 3 节重建逻辑的人工兜底(主编的日常路径是让 lore 角色直接重建);
132
135
  - `maoying export [dir]` 导出全书为 md / txt / epub(默认 md;`--out` 改输出目录,缺省 `<dir>/exports/`);
133
136
  - `maoying brief [dir] <chapter>` 组装单章写作卡(章纲 + 前章结尾 + 出场角色卡 + 活跃伏笔);`--out <文件>` 落盘,缺省打到 stdout;
134
- - `maoying check [dir]` 静态体检(不调模型):frontmatter 完整性、枚举值、章号卷号一致、伏笔章号引用、时间线年份、关系卡引用。
137
+ - `maoying check [dir]` 静态体检(不调模型):frontmatter 完整性、枚举值(含 phase)、章号卷号一致、伏笔章号引用、时间线年份、关系卡引用,并把本节 phase 完成判据落成静态检查——phase 到 outline 及之后仍缺主角卡/核心反派卡/世界观条目/分卷规划,或有两张及以上角色卡而 relations.yml 为空,即报 error(判据不满足回上一阶段补齐)。
135
138
 
136
139
  六者都零依赖,解析器只认本规范的两类形态(平键映射、顶层数组);深度嵌套不在支持范围——这是规范约束的执行手段之一。
package/index.mjs CHANGED
@@ -996,16 +996,25 @@ export async function registerCreatorRoutes(ctx) {
996
996
  }
997
997
 
998
998
  if (route === 'self-update' && req.method === 'POST') {
999
- // 面板内一键升级:形态/pnpm 检查 + `pnpm --dir <profileDir> add
1000
- // dsh-maoying@latest`(细节与安全边界见 lib/self-update.mjs)。可
1001
- // 预期的失败(dev-link / unsupported-layout / pnpm-missing / 超时 /
1002
- // pnpm 非零退出)统一 HTTP 200 + ok:false,kind 给客户端分流、
1003
- // message 经 sanitizeMessage 脱敏后透出;成功也带 restartRequired:
999
+ // 面板内一键升级:形态/profile 预检 + 版本预检后,在 profile 目录里
1000
+ // 直跑 `pnpm add dsh-maoying@<精确版本>`(pnpm 按候选链解析,细节与
1001
+ // 安全边界见 lib/self-update.mjs)。可预期的失败(dev-link /
1002
+ // unsupported-layout / profile-missing / no-target / pnpm-missing /
1003
+ // 超时 / 退出码非零 nonzero)统一 HTTP 200 + ok:false,kind 给客户端
1004
+ // 分流、message 经 sanitizeMessage 脱敏后透出;成功带 restartRequired:
1004
1005
  // true——装完的只是磁盘上的新包,运行中的进程仍是旧代码,必须重启
1005
- // DeepSeek 才生效,客户端文案必须照实转述。
1006
+ // DeepSeek 才生效,客户端文案必须照实转述。本地已不落后线上时短路
1007
+ // kind: 'up-to-date'(不装 profile)。两个成功路径都顺带全局 CLI:
1008
+ // globalCli 原样透传(json 序列化不截字段;形状与失败不拖累整体的
1009
+ // 语义见 lib/self-update.mjs 文件头注「全局 CLI 顺带更新」节)。
1006
1010
  const r = await selfUpdate({ logger: ctx.logger })
1007
- if (r.ok) {
1008
- json(res, 200, { ok: true, from: r.from ?? null, to: r.to ?? null, restartRequired: true })
1011
+ if (r.ok && r.kind === 'up-to-date') {
1012
+ json(res, 200, { ok: true, kind: 'up-to-date', from: r.from ?? null, globalCli: r.globalCli ?? null })
1013
+ } else if (r.ok) {
1014
+ json(res, 200, {
1015
+ ok: true, kind: r.kind, from: r.from ?? null, to: r.to ?? null,
1016
+ restartRequired: true, globalCli: r.globalCli ?? null,
1017
+ })
1009
1018
  } else {
1010
1019
  json(res, 200, { ok: false, kind: r.kind, error: sanitizeMessage(r.message ?? r.kind) })
1011
1020
  }
package/lib/base.css CHANGED
@@ -123,7 +123,10 @@ html[data-dsh-maoying-active]:not([data-dsh-mnemon-active]):not([data-dsh-taskbo
123
123
  overflow-y: auto;
124
124
  padding: 0 24px 32px;
125
125
  }
126
- .myt-page { display: flex; flex-direction: column; gap: 16px; max-width: 980px; }
126
+ /* 宽度随宿主中栏自适应:不设上限(980 上限已去,宽屏撑满);min-width
127
+ 兜底极窄中栏,低于时 .myt-body(overflow-y:auto 连带 overflow-x:auto)
128
+ 出横向滚动而不挤压看板/表格布局。 */
129
+ .myt-page { display: flex; flex-direction: column; gap: 16px; min-width: 720px; }
127
130
 
128
131
  /* ── 通用按钮 / 下拉 ───────────────────────────────────────────────────── */
129
132
  .myt-btn {
@@ -553,9 +556,15 @@ html[data-dsh-maoying-active]:not([data-dsh-mnemon-active]):not([data-dsh-taskbo
553
556
  .myt-charMeta { font-size: 11px; color: var(--dsw-alias-label-tertiary); }
554
557
  .myt-charLine { font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-secondary); overflow-wrap: anywhere; }
555
558
  .myt-charLabel { flex: none; font-size: 11px; color: var(--dsw-alias-label-tertiary); }
559
+ /* 弹层锚区居中:--myt-mask-* 由 client.js 持续测量面板容器视口矩形(已除
560
+ 面板 zoom 的 CSS px,mask 自身带 zoom)写入;--myt-anchor-* 同源视觉 px。
561
+ 变量缺省回落 0 = 全窗,行为同旧版。 */
556
562
  .myt-modalMask {
557
563
  position: fixed;
558
- inset: 0;
564
+ top: var(--myt-mask-top, 0px);
565
+ right: var(--myt-mask-right, 0px);
566
+ bottom: var(--myt-mask-bottom, 0px);
567
+ left: var(--myt-mask-left, 0px);
559
568
  z-index: 80;
560
569
  display: flex;
561
570
  align-items: center;
@@ -566,8 +575,8 @@ html[data-dsh-maoying-active]:not([data-dsh-mnemon-active]):not([data-dsh-taskbo
566
575
  .myt-modalCard {
567
576
  display: flex;
568
577
  flex-direction: column;
569
- width: min(520px, 94vw);
570
- max-height: 84vh;
578
+ width: min(520px, 100%); /* 百分比对 mask 内容盒解析:随锚区缩放,不再溢出中栏 */
579
+ max-height: 100%;
571
580
  border: 1px solid var(--dsw-alias-border-l2);
572
581
  border-radius: 16px;
573
582
  background: var(--dsw-alias-bg-layer-2);
@@ -674,8 +683,8 @@ html[data-dsh-maoying-active]:not([data-dsh-mnemon-active]):not([data-dsh-taskbo
674
683
  /* ── toast(fixed 悬浮,host 不挡点击)─────────────────────────────────── */
675
684
  .myt-toastHost {
676
685
  position: fixed;
677
- left: 50%;
678
- bottom: 28px;
686
+ left: calc(var(--myt-anchor-left, 0px) + var(--myt-anchor-width, 100vw) / 2);
687
+ bottom: calc(var(--myt-anchor-bottom, 0px) + 28px);
679
688
  transform: translateX(-50%);
680
689
  z-index: 90;
681
690
  display: flex;
@@ -688,7 +697,7 @@ html[data-dsh-maoying-active]:not([data-dsh-mnemon-active]):not([data-dsh-taskbo
688
697
  display: flex;
689
698
  align-items: flex-start;
690
699
  gap: 8px;
691
- max-width: min(520px, 86vw);
700
+ max-width: min(520px, var(--myt-anchor-width, 86vw));
692
701
  padding: 8px 12px;
693
702
  box-sizing: border-box;
694
703
  border-radius: 12px;
@@ -700,7 +709,8 @@ html[data-dsh-maoying-active]:not([data-dsh-mnemon-active]):not([data-dsh-taskbo
700
709
  box-shadow: 0 8px 28px color-mix(in srgb, #000 24%, transparent);
701
710
  pointer-events: auto;
702
711
  }
703
- .myt-toastText { min-width: 0; max-height: 120px; overflow-y: auto; overflow-wrap: anywhere; }
712
+ /* pre-line:一键升级 toast 的全局 CLI 第二句以 \n 换行显示(client.js globalCliNote)。 */
713
+ .myt-toastText { min-width: 0; max-height: 120px; overflow-y: auto; overflow-wrap: anywhere; white-space: pre-line; }
704
714
  .myt-toastOk { border-color: color-mix(in srgb, var(--dsw-alias-state-success-primary) 40%, transparent); }
705
715
  .myt-toastWarn { border-color: color-mix(in srgb, var(--dsw-alias-state-warn-primary) 40%, transparent); }
706
716
  .myt-toastErr { border-color: color-mix(in srgb, var(--dsw-alias-state-error-primary) 50%, transparent); }
@@ -764,15 +774,19 @@ html[data-dsh-maoying-active]:not([data-dsh-mnemon-active]):not([data-dsh-taskbo
764
774
  .myt-view, .myt-modalMask, .myt-settingsMask { zoom: var(--myt-zoom, 1); }
765
775
  .myt-settingsMask {
766
776
  position: fixed;
767
- inset: 0;
777
+ top: var(--myt-mask-top, 0px);
778
+ right: var(--myt-mask-right, 0px);
779
+ bottom: var(--myt-mask-bottom, 0px);
780
+ left: var(--myt-mask-left, 0px);
768
781
  z-index: 80;
769
782
  display: flex;
770
783
  align-items: center;
771
784
  justify-content: center;
785
+ padding: 24px;
772
786
  background: color-mix(in srgb, var(--dsw-alias-bg-base, #000) 55%, transparent);
773
787
  }
774
788
  .myt-settings {
775
- width: min(400px, 92vw);
789
+ width: min(400px, 100%);
776
790
  background: var(--dsw-alias-bg-layer-2);
777
791
  border: 1px solid var(--dsw-alias-border-l1);
778
792
  border-radius: 14px;