@andares/pi-toolkits 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/README.md +21 -20
- package/README.zh-CN.md +23 -22
- package/package.json +5 -4
- package/src/features/ask/index.test.ts +2 -2
- package/src/features/ask/index.ts +1 -1
- package/src/features/init/index.test.ts +2 -2
- package/src/features/init/templates/workflow-block.md +2 -2
- package/src/features/permission/index.ts +1 -1
- package/src/features/review/index.ts +3 -3
- package/src/features/review/review.test.ts +2 -2
- package/src/features/spec/assets/index-CdTerMvN.css +1 -0
- package/src/features/spec/assets/index-Dv52AIjX.js +1 -0
- package/src/features/{plan → spec}/assets/index.html +3 -3
- package/src/features/{plan → spec}/assets.test.ts +5 -5
- package/src/features/{plan → spec}/blocks.ts +1 -1
- package/src/features/{plan → spec}/feedback.test.ts +26 -26
- package/src/features/{plan → spec}/feedback.ts +14 -14
- package/src/features/{plan → spec}/index.test.ts +100 -66
- package/src/features/{plan → spec}/index.ts +117 -106
- package/src/features/{plan → spec}/prompt.test.ts +20 -20
- package/src/features/{plan → spec}/prompt.ts +25 -25
- package/src/features/{plan → spec}/render.test.ts +2 -2
- package/src/features/{plan → spec}/server.test.ts +21 -21
- package/src/features/{plan → spec}/server.ts +22 -22
- package/src/features/{plan → spec}/store.test.ts +77 -35
- package/src/features/{plan → spec}/store.ts +80 -52
- package/src/features/uat/index.test.ts +5 -5
- package/src/features/uat/index.ts +8 -8
- package/src/features/uat/record-tool.ts +3 -3
- package/src/features/uat/records.test.ts +5 -5
- package/src/index.ts +6 -6
- package/src/lib/ask-control.ts +2 -2
- package/src/lib/permission-control.ts +4 -4
- package/src/lib/phases.ts +20 -7
- package/src/lib/web-review.ts +1 -1
- package/src/features/plan/assets/index-C1YLIi4I.js +0 -1
- package/src/features/plan/assets/index-DMEpYC3V.css +0 -1
- /package/src/features/{plan → spec}/blocks.test.ts +0 -0
- /package/src/features/{plan → spec}/diff.test.ts +0 -0
- /package/src/features/{plan → spec}/diff.ts +0 -0
- /package/src/features/{plan → spec}/render.ts +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -11,6 +11,15 @@ renames that heading to the version being published and refuses an empty section
|
|
|
11
11
|
|
|
12
12
|
<!-- Notes for the next release go here; `pnpm release` renames this heading. -->
|
|
13
13
|
|
|
14
|
+
## 1.0.1 — 2026-11-17
|
|
15
|
+
|
|
16
|
+
- **ask-spec** — the browser review command is now `/ask-spec` (`/ask-plan` still works as an alias), the submit tool is `spec_submit`, and an untitled review defaults to `specs/spec.md` instead of `specs/plan.md`.
|
|
17
|
+
- **spec review page** — a new two-column page: warm paper/rose palette, the spec on the left, revision stats and a clickable annotation index on the right; global notes stay visible above the blocks.
|
|
18
|
+
- **spec review page** — the decision bar now carries *Only changed* and *Global notes* on the left and the total note count in the middle, with the explanatory footer text removed.
|
|
19
|
+
- **ask-spec** — existing `<agent-dir>/ask-plan/` review histories are migrated to `<agent-dir>/ask-spec/` on first use.
|
|
20
|
+
|
|
21
|
+
<!-- Notes for the next release go here; `pnpm release` renames this heading. -->
|
|
22
|
+
|
|
14
23
|
## 1.0.0 — 2026-11-15
|
|
15
24
|
|
|
16
25
|
- **quit-guard** — a forced exit can no longer be defeated by a deadlock inside `process.exit` itself: after the report is written, a same-loop SIGKILL timer and then an independent worker thread guarantee the process ends (real hang observed 2026-11-13, process stuck 18 min with the pty already deleted).
|
|
@@ -54,3 +63,4 @@ renames that heading to the version being published and refuses an empty section
|
|
|
54
63
|
- permission — a capped rolling JSONL approval log records each ask, its parsed units and your answer; `pnpm approval-report` turns it into rule candidates.
|
|
55
64
|
|
|
56
65
|
|
|
66
|
+
|
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
[](https://github.com/earendil-works/pi)
|
|
14
14
|
[](https://github.com/andares/pi-toolkits)
|
|
15
15
|
|
|
16
|
-
In a nutshell: twelve ready-to-use capabilities — **read-only consult mode** `ask`, **session-scoped boundary permission** `ask-perm`, **model favorites** `favorites`, **prompt stash** `stash`, **third-party code review** `ask-review`, **dedicated compaction model** `compact-model`, **session startup automation** `autostart`, an **agent memory framework** `ask-init`, a **
|
|
16
|
+
In a nutshell: twelve ready-to-use capabilities — **read-only consult mode** `ask`, **session-scoped boundary permission** `ask-perm`, **model favorites** `favorites`, **prompt stash** `stash`, **third-party code review** `ask-review`, **dedicated compaction model** `compact-model`, **session startup automation** `autostart`, an **agent memory framework** `ask-init`, a **spec review in the browser** `ask-spec`, an **acceptance ledger with a browser page** `ask-uat`, a **quit watchdog** `quit-guard`, and **release notes on the first start after an upgrade** `whats-new` — with more to come.
|
|
17
17
|
|
|
18
18
|
**Requirements**: pi `>=0.99.0`. Every published pi release from 0.99.0 through 1.5.2 has been verified with the full gate (install → `tsc --noEmit` → full test suite → keybinding audit → hash compare of the host files this package patches), each in a sandbox with the whole `@earendil-works/*` family pinned to the version under test. Newer releases are verified as they ship and the floor moves only when the measurement says so; `pnpm check:compat` reproduces the result. Note: pi ≥ 0.99 hosts require host-provided packages to be declared in `peerDependencies` with a `"*"` range — `@earendil-works/pi-tui` and `typebox` (the `scratchpad` tool builds a TypeBox schema) are declared that way; an installed copy in `dependencies` would make pi warn.
|
|
19
19
|
|
|
@@ -76,7 +76,7 @@ After installing, verify in any pi session:
|
|
|
76
76
|
| ⭐ **favorites** model favorites | `ctrl+A` / `ctrl+J` inside `/model` | favorite the models you use most (marked in bold bright yellow), `ctrl+p` cycles only among favorites |
|
|
77
77
|
| 📥 **stash** prompt stash | `ctrl+alt+y` | a stash slot for one prompt: press to swap, press twice to stash and clear the input box |
|
|
78
78
|
| 🔎 **review** third-party code review | `/ask-review` | summon the configured review model to check + fix the task just finished, focusing on "is this round's requirement implemented / is anything missing / is anything wrong" |
|
|
79
|
-
| 🧭 **
|
|
79
|
+
| 🧭 **spec** browser-reviewed specs | `/ask-spec` | research first, write a spec, review it in your browser paragraph by paragraph, annotate block by block, then implement only after approval |
|
|
80
80
|
| ✅ **uat** acceptance ledger | `/ask-uat` | after `/ask-init`: cluster pending change records into user-facing acceptance items, tick them off on a page (append-only ledger, no submit), and see what shipped without being verified |
|
|
81
81
|
| 🗜️ **compact** dedicated compaction model | `/compact-model` | give `/compact` and auto-compact a cheap fast model to summarize with, leaving the main model free to focus on the conversation; zero overhead when unconfigured, falls back to pi's default on any failure |
|
|
82
82
|
| 🚀 **autostart** session startup automation | `.pi/autostart.toml` | declare slash commands to run automatically at session start, per project (first use case: mounting multi-repo directories with `/add-dir`); never runs in untrusted directories, unregistered commands are skipped instead of being sent to the model |
|
|
@@ -92,7 +92,7 @@ After installing, verify in any pi session:
|
|
|
92
92
|
|
|
93
93
|
Enter with `/ask` (press it again to exit). Meant for the case where you only want to "ask questions and read code": the model may not change the project, but it is not starved of a place to think.
|
|
94
94
|
|
|
95
|
-
Ask is standalone (no `/ask-init` needed). If a
|
|
95
|
+
Ask is standalone (no `/ask-init` needed). If a spec review or the UAT page is active, leave it first — ask refuses to start on top of another phase rather than promise a read-only surface another feature will re-open.
|
|
96
96
|
|
|
97
97
|
**While active**:
|
|
98
98
|
|
|
@@ -281,35 +281,36 @@ After a development task is done, type the `/ask-review` command to summon **a d
|
|
|
281
281
|
|
|
282
282
|
- **Unconfigured / the configured model is no longer available** (e.g. it was deleted from pi's models.json) → a notice is shown and the list opens as usual (with no default entry in that case)
|
|
283
283
|
- Triggered while a task is still in progress (the agent is not idle) → you are told to wait and nothing runs; only one review may be active at a time
|
|
284
|
-
-
|
|
284
|
+
- Spec-review phase → refused (a spec under review must not be edited); ask mode is exited automatically because check + fix needs the full tool set
|
|
285
285
|
- A grey `review` status in the footer means a review model is configured
|
|
286
286
|
|
|
287
287
|
---
|
|
288
288
|
|
|
289
|
-
## 🧭
|
|
289
|
+
## 🧭 spec — write it, review it in the browser, then implement
|
|
290
290
|
|
|
291
|
-
<a name="
|
|
291
|
+
<a name="spec"></a>
|
|
292
292
|
|
|
293
|
-
`/ask-
|
|
293
|
+
`/ask-spec [topic]` opens a spec-review phase: the agent explores the code, asks what it cannot infer, and writes a spec — no code changes while the spec is under review. Then it calls `spec_submit`, the review opens in **your browser**, and you annotate it **paragraph by paragraph**: every blank-line-separated block can carry notes, and every note comes back to the agent as its next message. `/ask-plan` is kept as an alias.
|
|
294
294
|
|
|
295
295
|
- **Blocks are the unit of review.** Each paragraph is one block, with a badge telling you what changed since the previous round: `new`, `modified`, `moved`, `removed`. Unchanged blocks collapse, so a three-line edit does not look like a rewrite. Fenced code blocks stay whole.
|
|
296
296
|
- **Two levels of notes.** On a block, or global. Nothing finer — no text ranges to re-anchor after an edit.
|
|
297
|
-
- **
|
|
298
|
-
- **
|
|
299
|
-
- **
|
|
300
|
-
- **
|
|
297
|
+
- **The page keeps the review in view.** A two-column layout: the spec on the left; the revision stats and a clickable annotation index on the right. Global notes stay visible above the blocks even when the editor is closed.
|
|
298
|
+
- **Approve and deny both carry your notes.** They only choose the next step: approve means "start implementing" (with every note applied on the way), deny means "revise the spec and submit again".
|
|
299
|
+
- **History is kept.** Every submitted revision is stored under `<agent-dir>/ask-spec/<slug>/` and the header lets you reopen any of them read-only. Existing `<agent-dir>/ask-plan/` histories are migrated on first use.
|
|
300
|
+
- **The review phase uses the boundary checks.** `/ask-perm` is switched on with its defaults when the review starts and restored when it ends; the only file the review phase may write is markdown.
|
|
301
|
+
- **No model switching, ever.** The spec is reviewed and implemented with whatever model the session is on. (`/ask-review` is the one command that does switch, because you asked it to.)
|
|
301
302
|
|
|
302
303
|
**Browser on WSL**: the review server binds `0.0.0.0` and the URL is printed with the WSL address, because Windows cannot reach a loopback-only server inside WSL. The opener prefers a Windows-side launcher (`wslview`, `cmd.exe /c start`, `powershell Start-Process`) and only falls back to `xdg-open` elsewhere — that is the difference between "opens your browser" and "opens a browser inside WSL that you cannot see".
|
|
303
304
|
|
|
304
305
|
```text
|
|
305
|
-
/ask-
|
|
306
|
-
/ask-
|
|
307
|
-
/ask-
|
|
306
|
+
/ask-spec build the export feature # start the review
|
|
307
|
+
/ask-spec open # re-open the review page
|
|
308
|
+
/ask-spec off # leave the phase (the draft stays where it is)
|
|
308
309
|
```
|
|
309
310
|
|
|
310
|
-
The spec lands in `specs/<slug>.md` — the same place `/ask-init`
|
|
311
|
-
agent framework the
|
|
312
|
-
until `/ask-init`; the command says so when
|
|
311
|
+
The spec lands in `specs/<slug>.md` — the same place `/ask-init` keeps specs. Without an
|
|
312
|
+
agent framework the review still works, but `record_change` and `/ask-uat` stay unavailable
|
|
313
|
+
until `/ask-init`; the command says so when the review starts. Leave an open UAT page first:
|
|
313
314
|
the two phases do not run on top of each other.
|
|
314
315
|
|
|
315
316
|
---
|
|
@@ -481,7 +482,7 @@ the split between three things that decay when mixed:
|
|
|
481
482
|
|
|
482
483
|
| Family | Location | Answers | Lifetime |
|
|
483
484
|
| --- | --- | --- | --- |
|
|
484
|
-
| **
|
|
485
|
+
| **spec** | `specs/` (roadmap `PLAN.md` + `<unit>.md`) | what to do, how it will be accepted | written before work, status updated at close |
|
|
485
486
|
| **memory** | `.agents/memory/` | what is known, decided, and why | long-lived; append and compact only |
|
|
486
487
|
| **evidence** | `.agents/implementations/` | what changed, when, with what proof | one record per change, never rewritten |
|
|
487
488
|
|
|
@@ -512,7 +513,7 @@ turn; the audit still writes its runtime report. After a package upgrade run `/a
|
|
|
512
513
|
`AGENTS.md`, `.agents/memory/README.md` and `.agents/implementations/` exist. The
|
|
513
514
|
content is yours — small edits do not stop `/ask-uat` or `record_change`. Commands
|
|
514
515
|
that need the framework refuse with the missing list instead of guessing.
|
|
515
|
-
Mutating runs (including `refresh` and `roots`) refuse while `/ask`, a
|
|
516
|
+
Mutating runs (including `refresh` and `roots`) refuse while `/ask`, a spec review
|
|
516
517
|
or the UAT page is active; `check` and `plan` stay available.
|
|
517
518
|
|
|
518
519
|
A project written by an older tool has no template anchor. `/ask-init` reports those
|
|
@@ -748,7 +749,7 @@ src/
|
|
|
748
749
|
├── permission/ # session-scoped boundary permission: modes, panel,
|
|
749
750
|
│ # bash units, policy, session grants, prompt,
|
|
750
751
|
│ # audit payload, tests
|
|
751
|
-
├──
|
|
752
|
+
├── spec/ # browser-reviewed specs: phases, block diff,
|
|
752
753
|
│ # review server, UI, tests
|
|
753
754
|
├── quit-guard/ # quit watchdog: TUI teardown + quit-event triggers,
|
|
754
755
|
│ # settings store, hang report, tests
|
package/README.zh-CN.md
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
[](https://github.com/earendil-works/pi)
|
|
14
14
|
[](https://github.com/andares/pi-toolkits)
|
|
15
15
|
|
|
16
|
-
一句话介绍:目前包含十二个开箱即用的功能——**只读咨询模式** `ask`、**会话级边界权限** `ask-perm`、**模型收藏** `favorites`、**提示词暂存** `stash`、**第三方代码评审** `ask-review`、**独立压缩模型** `compact-model`、**会话启动自动化** `autostart`、**agent 记忆框架** `ask-init
|
|
16
|
+
一句话介绍:目前包含十二个开箱即用的功能——**只读咨询模式** `ask`、**会话级边界权限** `ask-perm`、**模型收藏** `favorites`、**提示词暂存** `stash`、**第三方代码评审** `ask-review`、**独立压缩模型** `compact-model`、**会话启动自动化** `autostart`、**agent 记忆框架** `ask-init`、**浏览器内规格评审** `ask-spec`、**验收台账与浏览器页面** `ask-uat`、**退出看门狗** `quit-guard`、**升级后首次启动的版本变更提示** `whats-new`,后续持续追加。
|
|
17
17
|
|
|
18
18
|
**版本要求**:pi `>=0.99.0`。0.99.0 到 1.5.2 的每一个已发布版本都用完整门禁实测过(install → `tsc --noEmit` → 全量测试 → 键位审计 → 对 patch 目标宿主文件做哈希比对),每个版本都在沙箱中把整个 `@earendil-works/*` 家族钉在同一版本。更新的版本随发布逐个验证,下限只在实测结果允许时移动;`pnpm check:compat` 可复现该结论。注:pi ≥ 0.99 的宿主要求「宿主提供的包」一律声明为 peerDependencies `"*"` —— `@earendil-works/pi-tui` 与 `typebox`(ask 的 `scratchpad` 用它构造参数 schema)都按此声明;若放进 `dependencies`,pi 会告警。
|
|
19
19
|
|
|
@@ -76,7 +76,7 @@ pi -e ./src/index.ts
|
|
|
76
76
|
| ⭐ **favorites** 模型收藏 | `/model` 内 `ctrl+A` / `ctrl+J` | 收藏常用模型(加粗亮黄标记),`ctrl+p` 仅在收藏间循环 |
|
|
77
77
|
| 📥 **stash** 提示词暂存 | `ctrl+alt+y` | 一段提示词的暂存槽,按键交换 / 连按两次暂存并清空输入框 |
|
|
78
78
|
| 🔎 **review** 第三方代码评审 | `/ask-review` | 召唤配置的评审模型,对刚完成的任务做查+修,重点检查「本轮需求实现 / 是否有遗漏 / 是否有错误」 |
|
|
79
|
-
| 🧭 **
|
|
79
|
+
| 🧭 **spec** 浏览器内规格评审 | `/ask-spec` | 先调研、写 spec、在浏览器里逐段评审并逐块批注,批准之后才动代码 |
|
|
80
80
|
| ✅ **uat** 验收台账 | `/ask-uat` | `/ask-init` 之后:把待归类的实施记录聚成用户视角的验收项,在页面里勾选(只追加、无提交),看清哪些已交付但还没验过 |
|
|
81
81
|
| 🗜️ **compact** 独立压缩模型 | `/compact-model` | 给 `/compact` 与 auto-compact 配一个便宜快模型做总结,主模型专注对话;未配置零开销、任何异常回落 pi 默认 |
|
|
82
82
|
| 🚀 **autostart** 会话启动自动化 | `.pi/autostart.toml` | 项目内声明启动时自动执行的斜杠命令(首批用例:`/add-dir` 多仓库挂载);未信任不执行、未注册命令跳过不发给模型 |
|
|
@@ -92,7 +92,7 @@ pi -e ./src/index.ts
|
|
|
92
92
|
|
|
93
93
|
用 `/ask` 进入(再按一次退出)。适合只想要「问问题、读代码」的场景:模型不能改项目,但不会被剥夺思考的落点。
|
|
94
94
|
|
|
95
|
-
ask 是独立的(不需要 `/ask-init
|
|
95
|
+
ask 是独立的(不需要 `/ask-init`)。规格评审或 UAT 页面开着时先退出它们——ask 不会叠在另一个相位上启动,因为那个相位的 `before_agent_start` 会把写工具重新加回来。
|
|
96
96
|
|
|
97
97
|
**进入后**:
|
|
98
98
|
|
|
@@ -281,35 +281,36 @@ run = ["/ask-perm allow allow allow ask"]
|
|
|
281
281
|
|
|
282
282
|
- **未配置 / 配置的模型已不可用**(如在 pi 的 models.json 里删掉了该模型)→ 提示后照常弹出列表(此时无默认项)
|
|
283
283
|
- 任务仍在进行中(agent 未空闲)时触发 → 提示等待,不执行;同一时间只允许一个评审
|
|
284
|
-
-
|
|
284
|
+
- 规格评审期 → 拒绝(评审中的 spec 不能被改);ask 模式会自动退出,因为查+修需要完整工具集
|
|
285
285
|
- footer 出现灰色 `review` 状态 = 已配置评审模型
|
|
286
286
|
|
|
287
287
|
---
|
|
288
288
|
|
|
289
|
-
## 🧭
|
|
289
|
+
## 🧭 spec — 先写规格,浏览器里评审,批准后再动手
|
|
290
290
|
|
|
291
|
-
<a name="
|
|
291
|
+
<a name="spec"></a>
|
|
292
292
|
|
|
293
|
-
`/ask-
|
|
293
|
+
`/ask-spec [主题]` 进入规格评审期:模型先调研、把代码里看不出来的问题问清楚,然后写一份 spec——评审期间不改代码。写完调用 `spec_submit`,评审页在**你的浏览器**里打开,你**逐段**批注:每个空行分隔的块都可以挂批注,批注会作为下一条消息回到模型。`/ask-plan` 保留为别名。
|
|
294
294
|
|
|
295
|
-
- **块是评审单位。**
|
|
296
|
-
-
|
|
297
|
-
-
|
|
298
|
-
-
|
|
299
|
-
-
|
|
300
|
-
-
|
|
295
|
+
- **块是评审单位。** 每个空行分隔的段落是一块,徽标告诉你相对上一版改了什么:`new`、`modified`、`moved`、`removed`。未变的块会折叠,三行小改不会看起来像整篇重写;围栏代码块保持完整。
|
|
296
|
+
- **两级批注。** 段落级,或全局;没有更细的文本范围批注,改完不需要重新锚定。
|
|
297
|
+
- **评审页一直看得见。** 双栏布局:左边是 spec,右边是本版统计和可点击的批注索引;全局批注即使编辑框关着也常显在正文上方。
|
|
298
|
+
- **批准和提意见都携带批注。** 它们只决定下一步:批准是「开始实施」(所有批注都带上),提意见是「改完 spec 再提交一版」。
|
|
299
|
+
- **历史留档。** 每次提交都存在 `<agent-dir>/ask-spec/<slug>/`,页头可以只读回看任意一版;旧的 `<agent-dir>/ask-plan/` 历史会在第一次使用时迁移。
|
|
300
|
+
- **评审期走边界检查。** `/ask-perm` 在评审开始时按默认值开启,结束时恢复;评审期唯一能写的是 markdown。
|
|
301
|
+
- **绝不切模型。** spec 评审与实施都用会话当前的模型。(`/ask-review` 是唯一会切模型的命令,那是你要求的。)
|
|
301
302
|
|
|
302
|
-
**WSL
|
|
303
|
+
**WSL 下的浏览器**:评审服务器绑 `0.0.0.0`,URL 用 WSL 的地址打印,因为 Windows 连不到 WSL 里只绑 loopback 的服务器。打开器优先用 Windows 侧启动器(`wslview`、`cmd.exe /c start`、`powershell Start-Process`),其它平台才回落到 `xdg-open`——这决定了是「打开你的浏览器」还是「在 WSL 里打开一个你看不见的浏览器」。
|
|
303
304
|
|
|
304
305
|
```text
|
|
305
|
-
/ask-
|
|
306
|
-
/ask-
|
|
307
|
-
/ask-
|
|
306
|
+
/ask-spec 做导出功能 # 进入规格评审
|
|
307
|
+
/ask-spec open # 重新打开评审页
|
|
308
|
+
/ask-spec off # 退出评审期(草稿留在原处)
|
|
308
309
|
```
|
|
309
310
|
|
|
310
|
-
spec 落在 `specs/<slug>.md
|
|
311
|
-
但 `record_change` 与 `/ask-uat`
|
|
312
|
-
UAT
|
|
311
|
+
spec 落在 `specs/<slug>.md`——与 `/ask-init` 放 spec 的地方相同。没有 agent 框架时评审仍可用,
|
|
312
|
+
但 `record_change` 与 `/ask-uat` 不可用,直到 `/ask-init`;命令在评审开始时会说明。
|
|
313
|
+
UAT 页面开着时先退出:两个相位不叠在一起跑。
|
|
313
314
|
|
|
314
315
|
---
|
|
315
316
|
|
|
@@ -500,7 +501,7 @@ run = [
|
|
|
500
501
|
**ask 循环说的「已安装」**:`.agents/framework/state.toml`、`AGENTS.md`、
|
|
501
502
|
`.agents/memory/README.md`、`.agents/implementations/` 存在。内容是用户的——小改
|
|
502
503
|
不会让 `/ask-uat` 或 `record_change` 拒绝;需要框架的命令会把缺失项列出来。
|
|
503
|
-
mutating 运行(含 `refresh`、`roots`)在 `/ask
|
|
504
|
+
mutating 运行(含 `refresh`、`roots`)在 `/ask`、规格评审或 UAT 页面开着时拒绝;
|
|
504
505
|
`check` 与 `plan` 仍可用。
|
|
505
506
|
|
|
506
507
|
旧工具写的项目没有模板锚。`/ask-init` 把这些文件报成 `I-FW-01` 并保持原状——它分不清
|
|
@@ -644,7 +645,7 @@ src/
|
|
|
644
645
|
├── permission/ # 会话级边界权限:模式、面板、bash 拆解、
|
|
645
646
|
│ # 策略、会话授权、确认对话框、
|
|
646
647
|
│ # 审计 payload、测试
|
|
647
|
-
├──
|
|
648
|
+
├── spec/ # 浏览器内规格评审:相位、块级 diff、
|
|
648
649
|
│ # 评审服务器、UI、测试
|
|
649
650
|
├── quit-guard/ # 退出看门狗:TUI 收尾 + quit 事件双触发、
|
|
650
651
|
│ # 配置存储、诊断报告、测试
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@andares/pi-toolkits",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Integrated toolkit extension for pi — ask mode (read-only Q&A), browser-reviewed planning, an acceptance ledger with a browser page, session-scoped permission checks, model favorites, prompt stash, third-party code review, session autostart, a dedicated compaction model, an agent memory framework (/ask-init), a quit watchdog, and release notes on the first start after an upgrade",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -37,8 +37,9 @@
|
|
|
37
37
|
"scaffold",
|
|
38
38
|
"init",
|
|
39
39
|
"ask-init",
|
|
40
|
-
"
|
|
41
|
-
"
|
|
40
|
+
"spec",
|
|
41
|
+
"spec-review",
|
|
42
|
+
"ask-spec",
|
|
42
43
|
"uat",
|
|
43
44
|
"ask-uat",
|
|
44
45
|
"acceptance",
|
|
@@ -82,7 +83,7 @@
|
|
|
82
83
|
"ui:dev": "pnpm --filter @andares/pi-toolkits-ui dev",
|
|
83
84
|
"ui:build": "pnpm --filter @andares/pi-toolkits-ui build",
|
|
84
85
|
"ui:typecheck": "pnpm --filter @andares/pi-toolkits-ui typecheck",
|
|
85
|
-
"ui:check": "pnpm ui:build && test -z \"$(git status --porcelain -- src/features/
|
|
86
|
+
"ui:check": "pnpm ui:build && test -z \"$(git status --porcelain -- src/features/spec/assets src/features/uat/assets)\""
|
|
86
87
|
},
|
|
87
88
|
"pi": {
|
|
88
89
|
"extensions": [
|
|
@@ -125,9 +125,9 @@ beforeEach(() => {
|
|
|
125
125
|
describe("ask gate", () => {
|
|
126
126
|
it("refuses to enter while a plan or UAT phase is active", async () => {
|
|
127
127
|
const h = makeHarness({ scratchBaseDir: tempBase() });
|
|
128
|
-
h.setActiveTools(["read", "write", "edit", "bash", "
|
|
128
|
+
h.setActiveTools(["read", "write", "edit", "bash", "spec_submit"]);
|
|
129
129
|
await h.toggle();
|
|
130
|
-
expect(h.notes.some((note) => /ask-
|
|
130
|
+
expect(h.notes.some((note) => /ask-spec/.test(note.message))).toBe(true);
|
|
131
131
|
expect(h.activeTools()).not.toContain(ASK_SCRATCH_TOOL);
|
|
132
132
|
|
|
133
133
|
h.setActiveTools(["read", "write", "edit", "bash", "uat_item"]);
|
|
@@ -186,7 +186,7 @@ export function registerAsk(
|
|
|
186
186
|
}
|
|
187
187
|
|
|
188
188
|
// Planning is deliberately less restrictive than consult mode (markdown may
|
|
189
|
-
// be written and bash stays available), so `/ask-
|
|
189
|
+
// be written and bash stays available), so `/ask-spec` exits through the
|
|
190
190
|
// owning feature rather than trying to restore its tool set itself.
|
|
191
191
|
setAskControl({ isActive: () => enabled, exit });
|
|
192
192
|
|
|
@@ -317,11 +317,11 @@ describe("/ask-init", () => {
|
|
|
317
317
|
const root = installedProject();
|
|
318
318
|
try {
|
|
319
319
|
const plan = harness(root);
|
|
320
|
-
plan.tools.push("
|
|
320
|
+
plan.tools.push("spec_submit");
|
|
321
321
|
registerInit(plan.pi, { now: NOW, toolVersion: "test" });
|
|
322
322
|
await plan.run("--yes");
|
|
323
323
|
expect(plan.sent).toHaveLength(0);
|
|
324
|
-
expect(plan.messages.some((item) => /ask-
|
|
324
|
+
expect(plan.messages.some((item) => /ask-spec/.test(item.message))).toBe(true);
|
|
325
325
|
|
|
326
326
|
const uat = harness(root);
|
|
327
327
|
uat.tools.push("uat_item");
|
|
@@ -6,7 +6,7 @@ This project uses the `@andares/pi-toolkits` ask workflow. The steps run in this
|
|
|
6
6
|
| step | entry | what it does |
|
|
7
7
|
| --- | --- | --- |
|
|
8
8
|
| discuss | `/ask` | read-only consult; `scratchpad` is the only write channel |
|
|
9
|
-
|
|
|
9
|
+
| spec | `/ask-spec <topic>` | research, ask questions, write `specs/<slug>.md`, review it block by block in the browser, implement only after approval |
|
|
10
10
|
| record | `record_change` | after the work: write the change record and one user-visible behaviour sentence |
|
|
11
11
|
| review | `/ask-review` | optional third-party model cross-check (check + fix); it leaves no state behind |
|
|
12
12
|
| accept | `/ask-uat` | cluster pending change records into acceptance items, verify them on the page, tick them off |
|
|
@@ -16,6 +16,6 @@ Rules that are easy to break:
|
|
|
16
16
|
- Change records live in `.agents/implementations/`; new ones carry the minute in the name (`YYYY-MM-DD_HHMM_slug.md`) and repeat it in the first line (`# YYYY-MM-DDTHH:MM±HH:MM — title`).
|
|
17
17
|
- The acceptance ledger is `.agents/uat/ledger.jsonl`, append-only, committed to git, and belongs to the main checkout. Never edit it by hand: the tools and the page write it.
|
|
18
18
|
- Acceptance items are created by clustering on the UAT side, never by an implementation session.
|
|
19
|
-
-
|
|
19
|
+
- Specs go in `specs`, memory in `.agents/memory/`, evidence in `.agents/implementations/`.
|
|
20
20
|
|
|
21
21
|
<!-- ask-init:end workflow -->
|
|
@@ -406,7 +406,7 @@ export function registerPermission(
|
|
|
406
406
|
});
|
|
407
407
|
|
|
408
408
|
// ── Control surface for other features ─────────────────────────────────
|
|
409
|
-
// `/ask-
|
|
409
|
+
// `/ask-spec` needs to switch the checks on for the spec-review phase and put
|
|
410
410
|
// them back afterwards. It gets a handle, not a copy of the state: the
|
|
411
411
|
// session's own `/ask-perm` command stays authoritative, so an operator who
|
|
412
412
|
// changes the mode mid-plan wins over whatever we restore later.
|
|
@@ -33,7 +33,7 @@ import type {
|
|
|
33
33
|
Theme,
|
|
34
34
|
} from "@earendil-works/pi-coding-agent";
|
|
35
35
|
import { getAskControl } from "../../lib/ask-control.js";
|
|
36
|
-
import {
|
|
36
|
+
import { specPhaseActive } from "../../lib/phases.js";
|
|
37
37
|
import {
|
|
38
38
|
modelKey,
|
|
39
39
|
resolveConfiguredModel,
|
|
@@ -140,9 +140,9 @@ export function createReviewRunner(
|
|
|
140
140
|
);
|
|
141
141
|
return;
|
|
142
142
|
}
|
|
143
|
-
if (pi
|
|
143
|
+
if (specPhaseActive(pi)) {
|
|
144
144
|
ctx.ui.notify(
|
|
145
|
-
`${REVIEW_COMMAND}: ask-
|
|
145
|
+
`${REVIEW_COMMAND}: ask-spec is active — approve or /ask-spec off first; a review needs write access.`,
|
|
146
146
|
"warning",
|
|
147
147
|
);
|
|
148
148
|
return;
|
|
@@ -417,13 +417,13 @@ describe("createReviewRunner", () => {
|
|
|
417
417
|
|
|
418
418
|
it("refuses to review while a plan is under review", async () => {
|
|
419
419
|
getReviewStore().setModel("anthropic/claude-sonnet-4");
|
|
420
|
-
const { pi, sendUserMessage } = fakePi(true, ["read", "
|
|
420
|
+
const { pi, sendUserMessage } = fakePi(true, ["read", "spec_submit"]);
|
|
421
421
|
const { ctx, notify, custom } = fakeCtx({ customResult: MODELS[0] });
|
|
422
422
|
await createReviewRunner(pi)(ctx);
|
|
423
423
|
expect(custom).not.toHaveBeenCalled();
|
|
424
424
|
expect(sendUserMessage).not.toHaveBeenCalled();
|
|
425
425
|
expect(notify).toHaveBeenCalledWith(
|
|
426
|
-
expect.stringContaining("ask-
|
|
426
|
+
expect.stringContaining("ask-spec"),
|
|
427
427
|
"warning",
|
|
428
428
|
);
|
|
429
429
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:root{--paper:#fdf9f5;--paper-deep:#f4e7e2;--surface:#fffdfb;--surface-muted:#f6e9e2;--border:#ead8d1;--ink:#2b1a24;--muted:#8a7280;--brand:#e0446b;--brand-2:#f2704f;--accent:#7c5cfc;--success:#0f8a6a;--warning:#c97a15;--danger:#d23b4e;--tint-success:#e7f4ef;--tint-warning:#fbf0dc;--tint-accent:#ede8ff;--tint-danger:#fbe9ea;--tint-blush:#fdf0ec;--tint-paper:#f8ede8;--shadow:0 10px 32px #471b2712;--shadow-soft:0 18px 50px #471b2724;--serif:"P052", "Palatino Linotype", Palatino, "Iowan Old Style", Georgia, "Noto Serif", "Songti SC", serif;--sans:"Ubuntu Sans", "Noto Sans", "Droid Sans Fallback", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;--mono:"Noto Sans Mono", ui-monospace, SFMono-Regular, Menlo, monospace;--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light}*{box-sizing:border-box}body{min-height:100vh;color:var(--ink);font:15px/1.65 var(--sans);background:radial-gradient(680px 680px at 108% -6%, #f8b7ad8c, transparent 68%), radial-gradient(620px 620px at -10% 38%, #cbb9ff59, transparent 70%), radial-gradient(460px 460px at 106% 82%, #ffc7a857, transparent 70%), linear-gradient(180deg, var(--paper), var(--paper-deep));background-attachment:fixed;margin:0}.page{max-width:1440px;margin:0 auto;padding:0 140px 150px}.topbar{border-bottom:1px solid #c8a69c8c;padding:26px 0 18px}.masthead{justify-content:space-between;align-items:center;gap:16px;display:flex}.brand{align-items:center;gap:12px;display:flex}.brand-mark{width:32px;height:32px;color:var(--surface);background:linear-gradient(135deg, var(--brand), var(--brand-2));border-radius:10px;place-items:center;display:grid;box-shadow:0 6px 16px #e0446b59}.brand-mark svg{width:17px;height:17px}.eyebrow{letter-spacing:2.2px;text-transform:uppercase;color:var(--muted);font-size:10px;font-weight:700;line-height:1.2;display:inline-block}.top-actions{align-items:center;gap:10px;display:flex}.title-block{margin-top:18px}h1{font-family:var(--serif);letter-spacing:-.8px;color:var(--ink);overflow-wrap:anywhere;margin:0;font-size:clamp(38px,4.2vw,52px);font-weight:400;line-height:1.05}.meta{color:var(--muted);flex-wrap:wrap;align-items:center;gap:10px;margin-top:12px;font-size:12.5px;display:flex}.meta-path{text-overflow:ellipsis;white-space:nowrap;max-width:360px;font-family:var(--mono);font-size:12px;overflow:hidden}.meta-dot{background:#d9c6c0;border-radius:50%;flex:none;width:4px;height:4px}.meta-changed{color:var(--brand);font-weight:600}.readonly{border:1px solid var(--warning);color:var(--warning);border-radius:999px;padding:1px 8px;font-size:11px;line-height:1.5}.history{flex-wrap:wrap;align-items:center;gap:8px;margin-top:22px;display:flex}.history-label{margin-right:4px}.history-summary{color:var(--muted);margin-left:auto;font-size:11.5px}button{font:inherit;cursor:pointer}button:disabled{opacity:.45;cursor:not-allowed}.ghost{border:1px solid var(--border);height:34px;color:var(--ink);background:#fffdfbb8;border-radius:999px;justify-content:center;align-items:center;padding:0 14px;font-size:12.5px;transition:border-color .15s,background .15s;display:inline-flex}.ghost:hover:not(:disabled){background:var(--surface);border-color:#ddbfb5}.ghost:focus-visible,.chip:focus-visible,.add:focus-visible,.rail-note:focus-visible,.btn-feedback:focus-visible,.btn-approve:focus-visible,.primary:focus-visible,.link:focus-visible,.remove:focus-visible{outline:2px solid var(--brand);outline-offset:2px}.lang{min-width:52px}.link{color:var(--brand);font-size:inherit;background:0 0;border:none;padding:0;font-weight:600;text-decoration:underline}.chip{border:1px solid var(--border);height:30px;color:var(--muted);font-family:var(--mono);background:#fffdfb99;border-radius:999px;align-items:center;gap:6px;padding:0 12px;font-size:12px;transition:border-color .15s,background .15s,color .15s;display:inline-flex}.chip:hover{color:var(--ink);border-color:#ddbfb5}.chip.active{background:linear-gradient(100deg, var(--brand), var(--brand-2));color:var(--surface);border-color:#0000;box-shadow:0 6px 14px #e0446b52}.chip-changed{color:var(--warning);font-size:11px}.chip.active .chip-changed{color:#fffdfbd1}.layout{grid-template-columns:minmax(0,748px) 364px;align-items:start;gap:48px;padding-top:28px;display:grid}.reading{flex-direction:column;gap:14px;display:flex}.rail{flex-direction:column;gap:18px;display:flex}.error{color:#8e2433;background:#fbe9ead9;border:1px solid #d23b4e66;border-radius:14px;margin-bottom:14px;padding:12px 16px;font-size:13px}.banner{color:#7a4a0e;background:#fbf0dccc;border:1px solid #c97a1559;border-radius:14px;justify-content:space-between;align-items:center;gap:12px;padding:10px 14px;font-size:12.5px;display:flex}.done{border:1px solid var(--border);background:var(--surface);box-shadow:var(--shadow);border-radius:16px;padding:18px}.done-title{font-family:var(--serif);font-size:20px;line-height:1.3}.done-hint{color:var(--muted);margin-top:4px;font-size:13px}.empty{border:1px dashed var(--border);color:var(--muted);text-align:center;background:#fffdfb99;border-radius:16px;margin:0;padding:22px}.collapsed{border:1px solid var(--border);height:44px;color:var(--muted);background:#fff9f5b3;border-radius:12px;justify-content:center;align-items:center;gap:8px;font-size:12px;display:flex}.global-card{border:1px solid var(--border);background:var(--surface);box-shadow:var(--shadow);border-radius:16px;flex-direction:column;gap:12px;padding:18px 22px;scroll-margin-top:24px;display:flex}.global-head{align-items:center;gap:10px;display:flex}.global-head .add{margin-left:auto}.global-count{background:var(--tint-blush);color:#b72847;border-radius:999px;justify-content:center;align-items:center;min-width:22px;height:20px;padding:0 8px;font-size:11px;font-weight:700;display:inline-flex}.blocks{flex-direction:column;gap:14px;display:flex}.block{border:1px solid var(--border);background:var(--surface);box-shadow:var(--shadow);border-radius:16px;scroll-margin-top:24px;overflow:hidden}.block-bar{width:100%;height:3px}.bar-added{background:linear-gradient(90deg, var(--success), #0f8a6a00)}.bar-modified{background:linear-gradient(90deg, var(--warning), #c97a1500)}.bar-moved{background:linear-gradient(90deg, var(--accent), #7c5cfc00)}.bar-removed{background:linear-gradient(90deg, var(--danger), #d23b4e00)}.bar-unchanged{background:linear-gradient(90deg,#ead8d1e6,#ead8d100)}.block-inner{flex-direction:column;gap:12px;padding:18px 22px 20px;display:flex}.block.is-removed .block-body{opacity:.68}.block-head{align-items:center;gap:10px;min-height:24px;display:flex}.badge{letter-spacing:1.1px;text-transform:uppercase;white-space:nowrap;border-radius:999px;align-items:center;gap:6px;height:22px;padding:0 9px;font-size:10px;font-weight:700;line-height:1;display:inline-flex}.badge .dot{width:5px;height:5px}.badge-added{background:var(--tint-success);color:var(--success)}.badge-modified{background:var(--tint-warning);color:var(--warning)}.badge-moved{background:var(--tint-accent);color:var(--accent)}.badge-removed{background:var(--tint-danger);color:var(--danger)}.badge-unchanged{background:var(--surface-muted);color:var(--muted)}.dot{border-radius:50%;flex:none;width:6px;height:6px;display:inline-block}.badge .dot-added,.dot-added{background:var(--success)}.badge .dot-modified,.dot-modified{background:var(--warning)}.badge .dot-moved,.dot-moved{background:var(--accent)}.badge .dot-removed,.dot-removed{background:var(--danger)}.badge-unchanged .dot{background:var(--muted)}.rail-row .dot-removed{background:#d9c6c0}.dot-change,.dot-brand{background:var(--brand)}.dot-suggest{background:var(--accent)}.dot-question{background:var(--muted)}.block-id{font-family:var(--mono);color:var(--muted);font-size:10.5px;line-height:1}.add{color:var(--muted);background:0 0;border:none;border-radius:8px;margin-left:auto;padding:4px 6px;font-size:11.5px;transition:color .15s,background .15s}.add:hover{background:var(--tint-blush);color:var(--brand)}.block-body{color:var(--ink);overflow-wrap:anywhere;font-size:15px;line-height:1.65}.block-body>:first-child{margin-top:0}.block-body>:last-child{margin-bottom:0}.block-body p{margin:0 0 12px}.block-body h1,.block-body h2,.block-body h3,.block-body h4{font-family:var(--serif);letter-spacing:-.2px;color:var(--ink);margin:8px 0 10px;font-weight:400;line-height:1.25}.block-body h1{font-size:26px}.block-body h2{font-size:23px}.block-body h3{font-size:19px}.block-body h4{font-size:16px}.block-body ul,.block-body ol{margin:0 0 12px;padding-left:22px}.block-body li{margin:4px 0}.block-body code{color:#a9304a;font-family:var(--mono);background:#f1e4de;border-radius:5px;padding:1px 5px;font-size:.9em}.block-body pre{color:#ffe9e2;font-family:var(--mono);background:#2a1a22;border-radius:12px;margin:0 0 12px;padding:14px 16px;font-size:12.5px;line-height:1.6;overflow:auto}.block-body pre code{color:inherit;font-size:inherit;background:0 0;padding:0}.block-body a{color:var(--brand);text-underline-offset:2px;text-decoration:underline}.block-body blockquote{border-left:3px solid var(--border);color:var(--muted);margin:0 0 12px;padding-left:12px}.block-body table{border-collapse:collapse;width:100%;margin:0 0 12px;font-size:13.5px}.block-body th,.block-body td{border:1px solid var(--border);text-align:left;padding:6px 8px}.block-body th{background:var(--surface-muted);font-weight:600}.block-body hr{border:none;border-top:1px solid var(--border);margin:16px 0}.note{background:var(--tint-blush);border:1px solid #f3d3c8;border-radius:12px;align-items:flex-start;gap:10px;padding:11px 12px;font-size:13px;line-height:1.5;display:flex}.note-suggest{background:#f4f0ff;border-color:#dcd2f5}.note-question{border-color:var(--border);background:#f7f1ed}.note-verdict{letter-spacing:1px;text-transform:uppercase;white-space:nowrap;border-radius:999px;flex:none;padding:4px 8px;font-size:9.5px;font-weight:700;line-height:1}.verdict-change{color:#b72847;background:#f8dde2}.verdict-suggest{color:#5b3fc9;background:#ede8ff}.verdict-question{color:#7a5a4c;background:#efe4de}.note-text{white-space:pre-wrap;overflow-wrap:anywhere;flex:1;min-width:0}.remove{color:var(--muted);background:0 0;border:none;padding:0 0 0 4px;font-size:11.5px}.remove:hover{color:var(--danger)}.editor{background:#fffbf8;border:1px solid #ebcbc1;border-radius:14px;flex-direction:column;gap:10px;padding:14px;display:flex}.verdicts{flex-wrap:wrap;align-items:center;gap:8px;display:flex}.verdicts label{border:1px solid var(--border);height:28px;color:var(--muted);cursor:pointer;border-radius:999px;align-items:center;padding:0 12px;font-size:11.5px;transition:border-color .15s,background .15s,color .15s;display:inline-flex;position:relative}.verdicts label input{opacity:0;pointer-events:none;position:absolute}.verdicts label.active{background:var(--brand);color:var(--surface);border-color:#0000;font-weight:600}.editor textarea{resize:vertical;border:1px solid var(--border);background:var(--surface);width:100%;min-height:62px;color:var(--ink);font:inherit;border-radius:10px;outline:none;padding:10px 12px;font-size:13px;line-height:1.5}.editor textarea:focus{border-color:var(--brand);box-shadow:0 0 0 3px #e0446b1f}.editor-actions{justify-content:flex-end;align-items:center;gap:10px;display:flex}.primary{background:linear-gradient(100deg, var(--brand), var(--brand-2));height:32px;color:var(--surface);border:none;border-radius:999px;padding:0 16px;font-size:12px;font-weight:600}.rail-card{border:1px solid var(--border);background:var(--surface);box-shadow:var(--shadow);border-radius:16px;flex-direction:column;gap:12px;padding:20px;display:flex}.rail-big{align-items:flex-end;gap:10px;display:flex}.rail-number{font-family:var(--serif);color:var(--brand);font-size:50px;line-height:1}.rail-caption{color:var(--ink);flex-direction:column;gap:2px;padding-bottom:6px;font-size:12.5px;display:flex}.rail-caption .muted{color:var(--muted);font-size:11px}.rail-breakdown{flex-direction:column;gap:2px;display:flex}.rail-row{height:22px;color:var(--muted);align-items:center;gap:8px;font-size:12.5px;display:flex}.rail-row>span:nth-child(2){text-transform:capitalize}.rail-row b{color:var(--ink);margin-left:auto;font-weight:600}.rail-head{justify-content:space-between;align-items:center;gap:10px;display:flex}.rail-badge{background:var(--tint-blush);color:#b72847;border-radius:999px;justify-content:center;align-items:center;min-width:22px;height:20px;padding:0 8px;font-size:11px;font-weight:700;display:inline-flex}.rail-notes{flex-direction:column;gap:4px;display:flex}.rail-note{text-align:left;background:0 0;border:none;border-radius:10px;align-items:flex-start;gap:8px;width:100%;padding:8px;display:flex}.rail-note:hover{background:#fbf3ee}.rail-note .dot{margin-top:5px}.rail-note-body{flex-direction:column;gap:2px;min-width:0;display:flex}.rail-note-label{color:var(--muted);letter-spacing:.8px;text-transform:uppercase;white-space:nowrap;text-overflow:ellipsis;font-size:10px;overflow:hidden}.rail-note-text{color:var(--ink);-webkit-line-clamp:2;-webkit-box-orient:vertical;font-size:12.5px;line-height:1.45;display:-webkit-box;overflow:hidden}.rail-empty{color:var(--muted);margin:0;font-size:12.5px;line-height:1.5}.footer{z-index:30;width:min(1232px,100vw - 48px);min-height:76px;box-shadow:var(--shadow-soft);-webkit-backdrop-filter:blur(18px);backdrop-filter:blur(18px);background:#fffdfbf0;border:1px solid #ebd8d1;border-radius:24px;grid-template-columns:1fr auto 1fr;align-items:center;gap:16px;padding:14px 24px;display:grid;position:fixed;bottom:18px;left:50%;transform:translate(-50%)}.footer-left,.footer-actions{align-items:center;gap:10px;display:flex}.footer-actions{justify-self:end}.footer-center{justify-self:center}.notes-count{background:var(--tint-paper);height:30px;color:var(--muted);white-space:nowrap;border-radius:999px;align-items:center;gap:8px;padding:0 12px;font-size:12px;font-weight:600;display:inline-flex}.notes-count .dot{width:7px;height:7px}.btn-feedback{background:var(--surface);color:#a9304a;border:1px solid #e7c9c1;border-radius:999px;height:44px;padding:0 20px;font-size:13px;font-weight:600;transition:background .15s,border-color .15s}.btn-feedback:hover:not(:disabled){background:#fff7f4;border-color:#d9a99c}.btn-approve{background:linear-gradient(100deg, var(--brand), var(--brand-2));height:44px;color:var(--surface);border:none;border-radius:999px;justify-content:center;align-items:center;gap:8px;padding:0 22px;font-size:13px;font-weight:600;transition:filter .15s,box-shadow .15s;display:inline-flex;box-shadow:0 8px 20px #e0446b61}.btn-approve:hover:not(:disabled){filter:brightness(1.03)}.btn-approve svg{width:15px;height:15px}@media (max-width:1200px){.page{padding:0 64px 150px}.layout{grid-template-columns:minmax(0,1fr) 332px;gap:32px}}@media (max-width:1040px){.page{padding:0 40px 150px}.layout{grid-template-columns:minmax(0,1fr)}}@media (max-width:800px){.history-summary{display:none}.footer{border-radius:20px;grid-template-columns:1fr;gap:8px;padding:12px}.footer-left{flex-wrap:wrap;order:1}.footer-center{order:2;justify-self:start}.footer-actions{order:3;justify-self:stretch}.footer-actions .btn-feedback,.footer-actions .btn-approve{flex:1}}@media (max-width:720px){.page{padding:0 20px 220px}.topbar{padding-top:20px}.block-inner{padding:14px 16px 16px}.global-card{padding:14px 16px}.meta-path{max-width:100%}.footer{width:calc(100vw - 24px);bottom:10px}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e={context:void 0,registry:void 0,effects:void 0,done:!1,getContextId(){return t(this.context.count)},getNextContextId(){return t(this.context.count++)}};function t(t){let n=String(t),r=n.length-1;return e.context.id+(r?String.fromCharCode(96+r):``)+n}function n(t){e.context=t}var r=(e,t)=>e===t,i=Symbol(`solid-track`),a={equals:r},o=null,s=P,c=1,l=2,u={owned:null,cleanups:null,context:null,owner:null},d=null,f=null,p=null,m=null,h=null,g=0;function _(e,t){let n=p,r=d,i=e.length===0,a=t===void 0?r:t,o=i?u:{owned:null,cleanups:null,context:a?a.context:null,owner:a},s=i?e:()=>e(v(o));d=o,p=null;try{return M(s,!0)}finally{p=n,d=r}}function v(e){return()=>S(()=>L(e))}function y(e,t){t=t?Object.assign({},a,t):a;let n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0};return[D.bind(n),e=>(typeof e==`function`&&(e=f&&f.running&&f.sources.has(n)?e(n.tValue):e(n.value)),O(n,e))]}function b(e,t,n){k(A(e,t,!1,c))}function ee(e,t,n){s=ie;let r=A(e,t,!1,c),i=E&&T(E);i&&(r.suspense=i),(!n||!n.render)&&(r.user=!0),h?h.push(r):k(r)}function x(e,t,n){n=n?Object.assign({},a,n):a;let r=A(e,t,!0,0);return r.observers=null,r.observerSlots=null,r.comparator=n.equals||void 0,k(r),D.bind(r)}function S(e){if(p===null)return e();let t=p;p=null;try{return e()}finally{p=t}}function te(e){ee(()=>S(e))}function ne(e){return d===null||(d.cleanups===null?d.cleanups=[e]:d.cleanups.push(e)),e}var[C,w]=y(!1);function T(e){let t;return d&&d.context&&(t=d.context[e.id])!==void 0?t:e.defaultValue}var E;function D(){let e=f&&f.running;if(this.sources&&(e?this.tState:this.state)){if((e?this.tState:this.state)===c)k(this);else{let e=m;m=null,M(()=>F(this),!1),m=e}}if(p){let e=this.observers;if(!e||e[e.length-1]!==p){let t=e?e.length:0;p.sources?(p.sources.push(this),p.sourceSlots.push(t)):(p.sources=[this],p.sourceSlots=[t]),e?(e.push(p),this.observerSlots.push(p.sources.length-1)):(this.observers=[p],this.observerSlots=[p.sources.length-1])}}return e&&f.sources.has(this)?this.tValue:this.value}function O(e,t,n){let r=f&&f.running&&f.sources.has(e)?e.tValue:e.value;if(!e.comparator||!e.comparator(r,t)){if(f){let r=f.running;(r||!n&&f.sources.has(e))&&(f.sources.add(e),e.tValue=t),r||(e.value=t)}else e.value=t;e.observers&&e.observers.length&&M(()=>{for(let t=0;t<e.observers.length;t+=1){let n=e.observers[t],r=f&&f.running;r&&f.disposed.has(n)||((r?!n.tState:!n.state)&&(n.pure?m.push(n):h.push(n),n.observers&&I(n)),r?n.tState=c:n.state=c)}if(m.length>1e6)throw m=[],Error()},!1)}return t}function k(e){if(!e.fn)return;L(e);let t=g;re(e,f&&f.running&&f.sources.has(e)?e.tValue:e.value,t),f&&!f.running&&f.sources.has(e)&&queueMicrotask(()=>{M(()=>{f&&(f.running=!0),p=d=e,re(e,e.tValue,t),p=d=null},!1)})}function re(e,t,n){let r,i=d,a=p;p=d=e;try{r=e.fn(t)}catch(t){return e.pure&&(f&&f.running?(e.tState=c,e.tOwned&&e.tOwned.forEach(L),e.tOwned=void 0):(e.state=c,e.owned&&e.owned.forEach(L),e.owned=null)),e.updatedAt=n+1,z(t)}finally{p=a,d=i}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&`observers`in e?O(e,r,!0):f&&f.running&&e.pure?(f.sources.has(e)||(e.value=r),f.sources.add(e),e.tValue=r):e.value=r,e.updatedAt=n)}function A(e,t,n,r=c,i){let a={fn:e,state:r,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:d,context:d?d.context:null,pure:n};return f&&f.running&&(a.state=0,a.tState=r),d===null||d!==u&&(f&&f.running&&d.pure?d.tOwned?d.tOwned.push(a):d.tOwned=[a]:d.owned?d.owned.push(a):d.owned=[a]),a}function j(e){let t=f&&f.running;if((t?e.tState:e.state)===0)return;if((t?e.tState:e.state)===l)return F(e);if(e.suspense&&S(e.suspense.inFallback))return e.suspense.effects.push(e);let n=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<g);){if(t&&f.disposed.has(e))return;(t?e.tState:e.state)&&n.push(e)}for(let r=n.length-1;r>=0;r--){if(e=n[r],t){let t=e,i=n[r+1];for(;(t=t.owner)&&t!==i;)if(f.disposed.has(t))return}if((t?e.tState:e.state)===c)k(e);else if((t?e.tState:e.state)===l){let t=m;m=null,M(()=>F(e,n[0]),!1),m=t}}}function M(e,t){if(m)return e();let n=!1;t||(m=[]),h?n=!0:h=[],g++;try{let t=e();return N(n),t}catch(e){n||(h=null),m=null,z(e)}}function N(e){if(m&&=(P(m),null),e)return;let t;if(f){if(!f.promises.size&&!f.queue.size){let e=f.sources,n=f.disposed;h.push.apply(h,f.effects),t=f.resolve;for(let e of h)`tState`in e&&(e.state=e.tState),delete e.tState;f=null,M(()=>{for(let e of n)L(e);for(let t of e){if(t.value=t.tValue,t.owned)for(let e=0,n=t.owned.length;e<n;e++)L(t.owned[e]);t.tOwned&&(t.owned=t.tOwned),delete t.tValue,delete t.tOwned,t.tState=0}w(!1)},!1)}else if(f.running){f.running=!1,f.effects.push.apply(f.effects,h),h=null,w(!0);return}}let n=h;h=null,n.length&&M(()=>s(n),!1),t&&t()}function P(e){for(let t=0;t<e.length;t++)j(e[t])}function ie(t){let r,i=0;for(r=0;r<t.length;r++){let e=t[r];e.user?t[i++]=e:j(e)}if(e.context){if(e.count){e.effects||=[],e.effects.push(...t.slice(0,i));return}n()}for(e.effects&&(e.done||!e.count)&&(t=[...e.effects,...t],i+=e.effects.length,delete e.effects),r=0;r<i;r++)j(t[r])}function F(e,t){let n=f&&f.running;n?e.tState=0:e.state=0;for(let r=0;r<e.sources.length;r+=1){let i=e.sources[r];if(i.sources){let e=n?i.tState:i.state;e===c?i!==t&&(!i.updatedAt||i.updatedAt<g)&&j(i):e===l&&F(i,t)}}}function I(e){let t=f&&f.running;for(let n=0;n<e.observers.length;n+=1){let r=e.observers[n];(t?!r.tState:!r.state)&&(t?r.tState=l:r.state=l,r.pure?m.push(r):h.push(r),r.observers&&I(r))}}function L(e){let t;if(e.sources)for(;e.sources.length;){let t=e.sources.pop(),n=e.sourceSlots.pop(),r=t.observers;if(r&&r.length){let e=r.pop(),i=t.observerSlots.pop();n<r.length&&(e.sourceSlots[i]=n,r[n]=e,t.observerSlots[n]=i)}}if(e.tOwned){for(t=e.tOwned.length-1;t>=0;t--)L(e.tOwned[t]);delete e.tOwned}if(f&&f.running&&e.pure)R(e,!0);else if(e.owned){for(t=e.owned.length-1;t>=0;t--)L(e.owned[t]);e.owned=null}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null}f&&f.running?e.tState=0:e.state=0}function R(e,t){if(t||(e.tState=0,f.disposed.add(e)),e.owned)for(let t=0;t<e.owned.length;t++)R(e.owned[t])}function ae(e){return e instanceof Error?e:Error(typeof e==`string`?e:`Unknown error`,{cause:e})}function oe(e,t,n){try{for(let n of t)n(e)}catch(e){z(e,n&&n.owner||null)}}function z(e,t=d){let n=o&&t&&t.context&&t.context[o],r=ae(e);if(!n)throw r;h?h.push({fn(){oe(r,n,t)},state:c}):oe(r,n,t)}var se=Symbol(`fallback`);function ce(e){for(let t=0;t<e.length;t++)e[t]()}function le(e,t,n={}){let r=[],a=[],o=[],s=0,c=t.length>1?[]:null;return ne(()=>ce(o)),()=>{let l=e()||[],u=l.length,d,f;return l[i],S(()=>{let e,t,i,m,h,g,v,y,b;if(u===0)s!==0&&(ce(o),o=[],r=[],a=[],s=0,c&&=[]),n.fallback&&(r=[se],a[0]=_(e=>(o[0]=e,n.fallback())),s=1);else if(s===0){for(a=Array(u),f=0;f<u;f++)r[f]=l[f],a[f]=_(p);s=u}else{for(i=Array(u),m=Array(u),c&&(h=Array(u)),g=0,v=Math.min(s,u);g<v&&r[g]===l[g];g++);for(v=s-1,y=u-1;v>=g&&y>=g&&r[v]===l[y];v--,y--)i[y]=a[v],m[y]=o[v],c&&(h[y]=c[v]);for(e=new Map,t=Array(y+1),f=y;f>=g;f--)b=l[f],d=e.get(b),t[f]=d===void 0?-1:d,e.set(b,f);for(d=g;d<=v;d++)b=r[d],f=e.get(b),f!==void 0&&f!==-1?(i[f]=a[d],m[f]=o[d],c&&(h[f]=c[d]),f=t[f],e.set(b,f)):o[d]();for(f=g;f<u;f++)f in i?(a[f]=i[f],o[f]=m[f],c&&(c[f]=h[f],c[f](f))):a[f]=_(p);a=a.slice(0,s=u),r=l.slice(0)}return a});function p(e){if(o[f]=e,c){let[e,n]=y(f);return c[f]=n,t(l[f],e)}return t(l[f])}}}function B(e,t){return S(()=>e(t||{}))}var ue=e=>`Stale read from <${e}>.`;function V(e){let t=`fallback`in e&&{fallback:()=>e.fallback};return x(le(()=>e.each,e.children,t||void 0))}function H(e){let t=e.keyed,n=x(()=>e.when,void 0,void 0),r=t?n:x(n,void 0,{equals:(e,t)=>!e==!t});return x(()=>{let i=r();if(i){let a=e.children;return typeof a==`function`&&a.length>0?S(()=>a(t?i:()=>{if(!S(r))throw ue(`Show`);return n()})):a}return e.fallback},void 0,void 0)}var U=e=>x(()=>e());function de(e,t,n){let r=n.length,i=t.length,a=r,o=0,s=0,c=t[i-1].nextSibling,l=null;for(;o<i||s<a;){if(t[o]===n[s]){o++,s++;continue}for(;t[i-1]===n[a-1];)i--,a--;if(i===o){let t=a<r?s?n[s-1].nextSibling:n[a-s]:c;for(;s<a;)e.insertBefore(n[s++],t)}else if(a===s)for(;o<i;)(!l||!l.has(t[o]))&&t[o].remove(),o++;else if(t[o]===n[a-1]&&n[s]===t[i-1]){let r=t[--i].nextSibling;e.insertBefore(n[s++],t[o++].nextSibling),e.insertBefore(n[--a],r),t[i]=n[a]}else{if(!l){l=new Map;let e=s;for(;e<a;)l.set(n[e],e++)}let r=l.get(t[o]);if(r!=null){if(s<r&&r<a){let c=o,u=1,d;for(;++c<i&&c<a&&(d=l.get(t[c]))!=null&&d===r+u;)u++;if(u>r-s){let i=t[o];for(;s<r;)e.insertBefore(n[s++],i)}else e.replaceChild(n[s++],t[o++])}else o++}else t[o++].remove()}}}var fe=`_$DX_DELEGATE`;function pe(e,t,n,r={}){let i;return _(r=>{i=r,t===document?e():q(t,e(),!n&&t.firstChild?null:void 0,n)},r.owner),()=>{i(),t.textContent=``}}function W(e,t,n,r){let i,a=()=>{let t=r?document.createElementNS(`http://www.w3.org/1998/Math/MathML`,`template`):document.createElement(`template`);return t.innerHTML=e,n?t.content.firstChild.firstChild:r?t.firstChild:t.content.firstChild},o=t?()=>S(()=>document.importNode(i||=a(),!0)):()=>(i||=a()).cloneNode(!0);return o.cloneNode=o,o}function me(e,t=window.document){let n=t[fe]||(t[fe]=new Set);for(let r=0,i=e.length;r<i;r++){let i=e[r];n.has(i)||(n.add(i),t.addEventListener(i,_e))}}function he(e,t,n){J(e)||(n==null?e.removeAttribute(t):e.setAttribute(t,n))}function G(e,t){J(e)||(t==null?e.removeAttribute(`class`):e.className=t)}function K(e,t,n,r){if(r)Array.isArray(n)?(e[`$$${t}`]=n[0],e[`$$${t}Data`]=n[1]):e[`$$${t}`]=n;else if(Array.isArray(n)){let r=n[0];e.addEventListener(t,n[0]=t=>r.call(e,n[1],t))}else e.addEventListener(t,n,typeof n!=`function`&&n)}function ge(e,t,n={}){let r=Object.keys(t||{}),i=Object.keys(n),a,o;for(a=0,o=i.length;a<o;a++){let r=i[a];!r||r===`undefined`||t[r]||(Y(e,r,!1),delete n[r])}for(a=0,o=r.length;a<o;a++){let i=r[a],o=!!t[i];!i||i===`undefined`||n[i]===o||!o||(Y(e,i,!0),n[i]=o)}return n}function q(e,t,n,r){if(n!==void 0&&!r&&(r=[]),typeof t!=`function`)return X(e,t,r,n);b(r=>X(e,t(),r,n),r)}function J(t){return!!e.context&&!e.done&&(!t||t.isConnected)}function Y(e,t,n){let r=t.trim().split(/\s+/);for(let t=0,i=r.length;t<i;t++)e.classList.toggle(r[t],n)}function _e(t){if(e.registry&&e.events&&e.events.find(([e,n])=>n===t))return;let n=t.target,r=`$$${t.type}`,i=t.target,a=t.currentTarget,o=e=>Object.defineProperty(t,"target",{configurable:!0,value:e}),s=()=>{let e=n[r];if(e&&!n.disabled){let i=n[`${r}Data`];if(i===void 0?e.call(n,t):e.call(n,i,t),t.cancelBubble)return}return n.host&&typeof n.host!=`string`&&!n.host._$host&&n.contains(t.target)&&o(n.host),!0},c=()=>{for(;s()&&(n=n._$host||n.parentNode||n.host););};Object.defineProperty(t,"currentTarget",{configurable:!0,get(){return n||document}}),e.registry&&!e.done&&(e.done=_$HY.done=!0);try{if(t.composedPath){let e=t.composedPath();o(e[0]);for(let t=0;t<e.length-2&&(n=e[t],s());t++){if(n._$host){n=n._$host,c();break}if(n.parentNode===a)break}}else c();o(i)}finally{t=n=null}}function X(e,t,n,r,i){let a=J(e);if(a){!n&&(n=[...e.childNodes]);let t=[];for(let e=0;e<n.length;e++){let r=n[e];r.nodeType===8&&r.data.slice(0,2)===`!$`?r.remove():t.push(r)}n=t}for(;typeof n==`function`;)n=n();if(t===n)return n;let o=typeof t,s=r!==void 0;if(e=s&&n[0]&&n[0].parentNode||e,o===`string`||o===`number`){if(a||o===`number`&&(t=t.toString(),t===n))return n;if(s){let i=n[0];i&&i.nodeType===3?i.data!==t&&(i.data=t):i=document.createTextNode(t),n=Q(e,n,r,i)}else n=n!==``&&typeof n==`string`?e.firstChild.data=t:e.textContent=t}else if(t==null||o===`boolean`){if(a)return n;n=Q(e,n,r)}else if(o===`function`)return b(()=>{let i=t();for(;typeof i==`function`;)i=i();n=X(e,i,n,r)}),()=>n;else if(Array.isArray(t)){let o=[],c=n&&Array.isArray(n);if(Z(o,t,n,i))return b(()=>n=X(e,o,n,r,!0)),()=>n;if(a){if(!o.length)return n;if(r===void 0)return n=[...e.childNodes];let t=o[0];if(t.parentNode!==e)return n;let i=[t];for(;(t=t.nextSibling)!==r;)i.push(t);return n=i}if(o.length===0){if(n=Q(e,n,r),s)return n}else c?n.length===0?ve(e,o,r):de(e,n,o):(n&&Q(e),ve(e,o));n=o}else if(t.nodeType){if(a&&t.parentNode)return n=s?[t]:t;if(Array.isArray(n)){if(s)return n=Q(e,n,r,t);Q(e,n,null,t)}else n==null||n===``||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}return n}function Z(e,t,n,r){let i=!1;for(let a=0,o=t.length;a<o;a++){let o=t[a],s=n&&n[e.length],c;if(o!=null&&o!==!0&&o!==!1){if((c=typeof o)==`object`&&o.nodeType)e.push(o);else if(Array.isArray(o))i=Z(e,o,s)||i;else if(c===`function`){if(r){for(;typeof o==`function`;)o=o();i=Z(e,Array.isArray(o)?o:[o],Array.isArray(s)?s:[s])||i}else e.push(o),i=!0}else{let t=String(o);s&&s.nodeType===3&&s.data===t?e.push(s):e.push(document.createTextNode(t))}}}return i}function ve(e,t,n=null){for(let r=0,i=t.length;r<i;r++)e.insertBefore(t[r],n)}function Q(e,t,n,r){if(n===void 0)return e.textContent=``;let i=r||document.createTextNode(``);if(t.length){let r=!1;for(let a=t.length-1;a>=0;a--){let o=t[a];if(i!==o){let t=o.parentNode===e;!r&&!a?t?e.replaceChild(i,o):e.insertBefore(i,n):t&&o.remove()}else r=!0}}else e.insertBefore(i,n);return[i]}var ye=new URLSearchParams(window.location.search).get(`t`)??``;async function be(e,t={}){let n=await fetch(e,{...t,headers:{...t.body?{"content-type":`application/json`}:{},"x-plan-token":ye,...t.headers??{}}});if(!n.ok)throw Error(`${t.method??`GET`} ${e} → HTTP ${n.status}`);return await n.json()}function xe(e){return be(e===void 0?`/api/state`:`/api/state?version=${e}`)}function Se(e,t){return be(`/api/annotate`,{method:`POST`,body:JSON.stringify({version:e,annotations:t})})}function Ce(e,t){return be(`/api/decide`,{method:`POST`,body:JSON.stringify({action:e,version:t})})}function we(e){try{return JSON.parse(e.data)}catch{return}}function Te(e){let t=new EventSource(`/api/events?t=${encodeURIComponent(ye)}`);return t.addEventListener(`revision`,t=>{let n=we(t);n&&e.onRevision(n.version)}),t.addEventListener(`annotations`,()=>e.onAnnotations()),t.addEventListener(`decided`,t=>{let n=we(t);n&&e.onDecided(n)}),()=>t.close()}var Ee=`spec:lang`,De=`plan:lang`;function Oe(){let e=localStorage.getItem(Ee)??localStorage.getItem(De);return e===`en`||e===`zh`?e:navigator.language.toLowerCase().startsWith(`zh`)?`zh`:`en`}function ke(e){localStorage.setItem(Ee,e)}var Ae={en:{title:`Spec review`,version:`v{version} of {total}`,changed:`{count} blocks changed`,changedOne:`1 block changed`,noChange:`no changes`,showAll:`Show unchanged`,onlyChanged:`Only changed`,approve:`Approve spec`,deny:`Send feedback`,globalNotes:`Global notes`,globalNotesTitle:`Global notes`,notePlaceholder:`What should change here?`,addNote:`Add note`,save:`Save note`,cancel:`Cancel`,remove:`Remove`,verdictChange:`must change`,verdictSuggest:`suggest`,verdictQuestion:`question`,history:`History`,historySummary:`{count} blocks`,historySummaryOne:`1 block`,back:`Back to latest`,viewingOld:`Read-only: you are viewing v{v}`,readOnly:`Read-only`,approved:`Spec approved`,denied:`Feedback sent`,closing:`Closing this tab…`,closeHint:`You can close this tab now.`,status_unchanged:`unchanged`,status_moved:`moved`,status_modified:`modified`,status_added:`new`,status_removed:`removed`,unchangedHidden:`{count} unchanged blocks hidden`,unchangedHiddenOne:`1 unchanged block hidden`,error:`Something went wrong: {message}`,emptySpec:`This spec is empty.`,noteCount:`{count} notes`,noteCountOne:`1 note`,thisRevision:`This revision`,blocksChanged:`blocks changed`,ofTotal:`of {total} in the spec`,annotations:`Annotations`,noNotesYet:`No notes yet — annotate a block to see it here.`},zh:{title:`规格评审`,version:`第 {version} / {total} 版`,changed:`{count} 处改动`,changedOne:`1 处改动`,noChange:`无改动`,showAll:`显示未变块`,onlyChanged:`只看改动`,approve:`批准规格`,deny:`提交意见`,globalNotes:`全局批注`,globalNotesTitle:`全局批注`,notePlaceholder:`这里应该怎么改?`,addNote:`添加批注`,save:`保存批注`,cancel:`取消`,remove:`删除`,verdictChange:`必须改`,verdictSuggest:`建议`,verdictQuestion:`疑问`,history:`历史`,historySummary:`{count} 块`,historySummaryOne:`1 块`,back:`回到最新版`,viewingOld:`只读:正在查看第 {v} 版`,readOnly:`只读`,approved:`规格已批准`,denied:`意见已提交`,closing:`正在关闭标签页…`,closeHint:`现在可以关闭这个标签页了。`,status_unchanged:`未变`,status_moved:`位置移动`,status_modified:`已修改`,status_added:`新增`,status_removed:`已删除`,unchangedHidden:`隐藏了 {count} 个未变块`,unchangedHiddenOne:`隐藏了 1 个未变块`,error:`出错了:{message}`,emptySpec:`spec 是空的。`,noteCount:`{count} 条批注`,noteCountOne:`1 条批注`,thisRevision:`本版`,blocksChanged:`处改动`,ofTotal:`共 {total} 块`,annotations:`批注`,noNotesYet:`还没有批注——在段落上写一条就会出现在这里。`}};function je(e,t,n={}){return(Ae[e][t]??t).replace(/\{(\w+)\}/g,(e,t)=>String(n[t]??`{${t}}`))}var Me=W(`<span class=readonly>`),Ne=W(`<div class=error>`),Pe=W(`<div class=banner><span></span><button class=link>`),Fe=W(`<div class=done><div class=done-title></div><div class=done-hint>`),Ie=W(`<button class=add>+ `),Le=W(`<section id=global-notes class=global-card><div class=global-head><span class=eyebrow></span><span class=global-count>`),Re=W(`<p class=empty>`),ze=W(`<div class=collapsed><span></span><button class=link>`),Be=W(`<div class=rail-notes>`),Ve=W(`<button class=ghost>`),He=W(`<div class=page><header class=topbar><div class=masthead><div class=brand><span class=brand-mark aria-hidden=true><svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=1.8><path d="M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8L12 3z"></path><path d="M18.5 15.5l.7 2 2 .7-2 .7-.7 2-.7-2-2-.7 2-.7.7-2z"></path></svg></span><span class=eyebrow></span></div><div class=top-actions><button class="ghost lang"></button></div></div><div class=title-block><h1></h1><div class=meta><span class=meta-path></span><span class=meta-dot aria-hidden=true></span><span class=meta-version></span><span class=meta-dot aria-hidden=true></span><span class=meta-changed></span></div></div><div class=history><span class="eyebrow history-label"></span><span class=history-summary></span></div></header><div class=layout><main class=reading><div class=blocks></div></main><aside class=rail><section class=rail-card><span class=eyebrow></span><div class=rail-big><span class=rail-number></span><div class=rail-caption><span></span><span class=muted></span></div></div><div class=rail-breakdown><div class=rail-row><span class="dot dot-added"aria-hidden=true></span><span></span><b></b></div><div class=rail-row><span class="dot dot-modified"aria-hidden=true></span><span></span><b></b></div><div class=rail-row><span class="dot dot-moved"aria-hidden=true></span><span></span><b></b></div><div class=rail-row><span class="dot dot-removed"aria-hidden=true></span><span></span><b></b></div></div></section><section class=rail-card><div class=rail-head><span class=eyebrow></span><span class=rail-badge></span></div></section></aside></div><footer class=footer><div class=footer-left><button class=ghost> (<!>)</button></div><div class=footer-center><span class=notes-count><span class="dot dot-brand"aria-hidden=true></span></span></div><div class=footer-actions><button class=btn-feedback></button><button class=btn-approve><span></span><svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 aria-hidden=true><path d="M5 12h14M13 6l6 6-6 6">`),Ue=W(`<span class=chip-changed>+`),We=W(`<button class=chip><span class=chip-n>v`),Ge=W(`<button class=remove>`),Ke=W(`<div><span></span><span class=note-text>`),qe=W(`<article class=block><div aria-hidden=true></div><div class=block-inner><div class=block-head><span><span aria-hidden=true></span></span><span class=block-id></span></div><div class=block-body>`),Je=W(`<p class=rail-empty>`),Ye=W(`<button class=rail-note><span aria-hidden=true></span><span class=rail-note-body><span class=rail-note-label></span><span class=rail-note-text>`),Xe=W(`<div class=editor><div class=verdicts></div><textarea></textarea><div class=editor-actions><button class=ghost></button><button class=primary>`),Ze=W(`<label><input type=radio name=verdict>`);function Qe(){let[e,t]=y(Oe()),[n,r]=y(),[i,a]=y(),[o,s]=y(),[c,l]=y(),[u,d]=y(!1),[f,p]=y(),[m,h]=y(``),[g,_]=y(`change`),[v,S]=y(!1),C=(t,n)=>je(e(),t,n);async function w(e){try{let t=await xe(e);r(t),s(void 0),l(t.decided&&t.decision?t.decision.action:void 0)}catch(e){s(e instanceof Error?e.message:String(e))}}te(()=>{w(),ne(Te({onRevision:()=>{i()===void 0&&w()},onAnnotations:()=>{i()===void 0&&w()},onDecided:e=>l(e.action)}))}),ee(()=>{let e=n()?.slug;document.title=e?`${C(`title`)} — ${e}`:C(`title`)});let T=x(()=>n()?.items??[]),E=x(()=>T().filter(e=>e.status!==`unchanged`).length),D=x(()=>!u()&&E()>0),O=x(()=>D()?T().filter(e=>e.status===`unchanged`).length:0),k=x(()=>D()?T().filter(e=>e.status!==`unchanged`):T()),re=x(()=>n()?.history[0]?.n??n()?.version),A=x(()=>{let e=n();return e!==void 0&&e.version!==re()}),j=x(()=>{let e={unchanged:0,moved:0,modified:0,added:0,removed:0};for(let t of T())e[t.status]+=1;return e}),M=x(()=>[...n()?.history??[]].reverse()),N=x(()=>n()?.annotations.global??[]),P=x(()=>f()!==void 0&&f().blockId===void 0),ie=x(()=>N().length>0||P()),F=e=>n()?.annotations.blocks.find(t=>t.blockId===e)?.annotations??[],I=x(()=>{let e=n()?.annotations;if(!e)return 0;let t=e.blocks.reduce((e,t)=>e+t.annotations.length,0);return e.global.length+t}),L=x(()=>{let e=n();if(!e)return[];let t=new Map(e.items.map(e=>[e.id,e.label])),r=e.annotations.global.map((e,t)=>({key:`global-${t}`,label:C(`globalNotesTitle`),annotation:e}));for(let n of e.annotations.blocks){let e=t.get(n.blockId)??n.blockId;n.annotations.forEach((t,i)=>{r.push({key:`${n.blockId}-${i}`,blockId:n.blockId,label:e,annotation:t})})}return r});async function R(e){let t=n();if(!t)return;let i={...t,annotations:e};r(i);try{await Se(t.version,e)}catch(e){s(e instanceof Error?e.message:String(e)),await w(t.version)}}async function ae(e){let t=m().trim();if(t===``)return;let r=n();if(!r)return;let i={verdict:g(),comment:t},a;if(e===void 0)a={...r.annotations,global:[...r.annotations.global,i]};else{let t=r.annotations.blocks.slice(),n=t.findIndex(t=>t.blockId===e);n===-1?t.push({blockId:e,annotations:[i]}):t[n]={...t[n],annotations:[...t[n].annotations,i]},a={...r.annotations,blocks:t}}p(void 0),h(``),await R(a)}async function oe(e,t){let r=n();if(!r)return;let i;i=e===void 0?{...r.annotations,global:r.annotations.global.filter((e,n)=>n!==t)}:{...r.annotations,blocks:r.annotations.blocks.map(n=>n.blockId===e?{...n,annotations:n.annotations.filter((e,n)=>n!==t)}:n).filter(e=>e.annotations.length>0)},await R(i)}function z(){!A()&&!P()&&(p({blockId:void 0}),h(``),_(`change`)),requestAnimationFrame(()=>{document.getElementById(`global-notes`)?.scrollIntoView({behavior:`smooth`,block:`start`})})}function se(){if(!A()){if(P()){p(void 0);return}z()}}function ce(e){if(e.blockId===void 0){z();return}let t=e.blockId;k().some(e=>e.id===t)||d(!0),requestAnimationFrame(()=>{document.getElementById(`block-${t}`)?.scrollIntoView({behavior:`smooth`,block:`center`})})}async function le(e){let t=n();if(t)try{await Ce(e,t.version),l(e),window.close(),setTimeout(()=>S(!0),300)}catch(e){s(e instanceof Error?e.message:String(e))}}let ue=e=>`badge badge-${e}`,de=e=>`verdict${e[0].toUpperCase()}${e.slice(1)}`,fe=e=>`note-verdict verdict-${e}`;return(()=>{var r=He(),s=r.firstChild,l=s.firstChild,y=l.firstChild,ee=y.firstChild.nextSibling,x=y.nextSibling.firstChild,S=l.nextSibling,te=S.firstChild,ne=te.nextSibling,D=ne.firstChild,R=D.nextSibling.nextSibling,z=R.nextSibling.nextSibling,pe=S.nextSibling,W=pe.firstChild,me=W.nextSibling,K=s.nextSibling,J=K.firstChild,Y=J.firstChild,_e=J.nextSibling.firstChild,X=_e.firstChild,Z=X.nextSibling,ve=Z.firstChild,Q=ve.nextSibling.firstChild,ye=Q.nextSibling,be=Z.nextSibling.firstChild,xe=be.firstChild.nextSibling,Se=xe.nextSibling,Ce=be.nextSibling,we=Ce.firstChild.nextSibling,Te=we.nextSibling,Ee=Ce.nextSibling,De=Ee.firstChild.nextSibling,Oe=De.nextSibling,Ae=Ee.nextSibling.firstChild.nextSibling,je=Ae.nextSibling,Xe=_e.nextSibling,Ze=Xe.firstChild.firstChild,Qe=Ze.nextSibling,et=K.nextSibling.firstChild,$=et.firstChild,tt=$.firstChild,nt=tt.nextSibling;nt.nextSibling;var rt=et.nextSibling,it=rt.firstChild;it.firstChild;var at=rt.nextSibling.firstChild,ot=at.nextSibling,st=ot.firstChild;return q(ee,()=>C(`title`)),x.$$click=()=>{let n=e()===`en`?`zh`:`en`;t(n),ke(n)},q(x,()=>e()===`en`?`中文`:`EN`),q(te,()=>n()?.slug??`spec`),q(D,()=>n()?.source??`specs/spec.md`),q(R,()=>C(`version`,{version:n()?.version??0,total:n()?.totalVersions??0})),q(z,(()=>{var e=U(()=>E()>0);return()=>e()?C(E()===1?`changedOne`:`changed`,{count:E()}):C(`noChange`)})()),q(ne,B(H,{get when(){return A()},get children(){var e=Me();return q(e,()=>C(`readOnly`)),e}}),null),q(W,()=>C(`history`)),q(pe,B(V,{get each(){return M()},children:e=>(()=>{var t=We(),r=t.firstChild;return r.firstChild,t.$$click=()=>{e.n===re()?(a(void 0),w()):(a(e.n),w(e.n))},q(r,()=>e.n,null),q(t,B(H,{get when(){return e.changed>0},get children(){var t=Ue();return t.firstChild,q(t,()=>e.changed,null),t}}),null),b(()=>t.classList.toggle(`active`,e.n===n()?.version)),t})()}),me),q(me,()=>C(T().length===1?`historySummaryOne`:`historySummary`,{count:T().length})),q(r,B(H,{get when(){return o()},get children(){var e=Ne();return q(e,()=>C(`error`,{message:o()??``})),e}}),K),q(J,B(H,{get when(){return A()},get children(){var e=Pe(),t=e.firstChild,r=t.nextSibling;return q(t,()=>C(`viewingOld`,{v:i()??n()?.version??0})),r.$$click=()=>{a(void 0),w()},q(r,()=>C(`back`)),e}}),Y),q(J,B(H,{get when(){return c()},get children(){var e=Fe(),t=e.firstChild,n=t.nextSibling;return q(t,(()=>{var e=U(()=>c()===`approve`);return()=>e()?C(`approved`):C(`denied`)})()),q(n,(()=>{var e=U(()=>!!v());return()=>e()?C(`closeHint`):C(`closing`)})()),e}}),Y),q(J,B(H,{get when(){return ie()},get children(){var e=Le(),t=e.firstChild,n=t.firstChild,r=n.nextSibling;return q(n,()=>C(`globalNotesTitle`)),q(r,()=>N().length),q(t,B(H,{get when(){return U(()=>!A())()&&!P()},get children(){var e=Ie();return e.firstChild,e.$$click=()=>{p({blockId:void 0}),h(``),_(`change`)},q(e,()=>C(`addNote`),null),e}}),null),q(e,B(V,{get each(){return N()},children:(e,t)=>(()=>{var n=Ke(),r=n.firstChild,i=r.nextSibling;return q(r,()=>C(de(e.verdict))),q(i,()=>e.comment),q(n,B(H,{get when(){return!A()},get children(){var e=Ge();return e.$$click=()=>void oe(void 0,t()),q(e,()=>C(`remove`)),e}}),null),b(t=>{var i=`note note-${e.verdict}`,a=fe(e.verdict);return i!==t.e&&G(n,t.e=i),a!==t.t&&G(r,t.t=a),t},{e:void 0,t:void 0}),n})()}),null),q(e,B(H,{get when(){return U(()=>!!P())()&&!A()},get children(){return B($e,{draft:m,setDraft:h,verdict:g,setVerdict:_,onSave:()=>void ae(void 0),onCancel:()=>p(void 0),t:C})}}),null),e}}),Y),q(J,B(H,{get when(){return U(()=>!!n())()&&n().items.length===0},get children(){var e=Re();return q(e,()=>C(`emptySpec`)),e}}),Y),q(J,B(H,{get when(){return O()>0},get children(){var e=ze(),t=e.firstChild,n=t.nextSibling;return q(t,()=>C(O()===1?`unchangedHiddenOne`:`unchangedHidden`,{count:O()})),n.$$click=()=>d(!0),q(n,()=>C(`showAll`)),e}}),Y),q(Y,B(V,{get each(){return k()},children:e=>(()=>{var t=qe(),n=t.firstChild,r=n.nextSibling,i=r.firstChild,a=i.firstChild,o=a.firstChild,s=a.nextSibling,c=i.nextSibling;return q(a,()=>C(`status_${e.status}`),null),q(s,()=>e.id),q(i,B(H,{get when(){return!A()},get children(){var t=Ie();return t.firstChild,t.$$click=()=>{p({blockId:e.id}),h(``),_(`change`)},q(t,()=>C(`addNote`),null),t}}),null),q(r,B(V,{get each(){return F(e.id)},children:(t,n)=>(()=>{var r=Ke(),i=r.firstChild,a=i.nextSibling;return q(i,()=>C(de(t.verdict))),q(a,()=>t.comment),q(r,B(H,{get when(){return!A()},get children(){var t=Ge();return t.$$click=()=>void oe(e.id,n()),q(t,()=>C(`remove`)),t}}),null),b(e=>{var n=`note note-${t.verdict}`,a=fe(t.verdict);return n!==e.e&&G(r,e.e=n),a!==e.t&&G(i,e.t=a),e},{e:void 0,t:void 0}),r})()}),null),q(r,B(H,{get when(){return U(()=>f()?.blockId===e.id)()&&!A()},get children(){return B($e,{draft:m,setDraft:h,verdict:g,setVerdict:_,onSave:()=>void ae(e.id),onCancel:()=>p(void 0),t:C})}}),null),b(r=>{var i=`block-${e.id}`,s={[`is-`+e.status]:!0},l=`block-bar bar-${e.status}`,u=ue(e.status),d=`dot dot-${e.status}`,f=e.html;return i!==r.e&&he(t,`id`,r.e=i),r.t=ge(t,s,r.t),l!==r.a&&G(n,r.a=l),u!==r.o&&G(a,r.o=u),d!==r.i&&G(o,r.i=d),f!==r.n&&(c.innerHTML=r.n=f),r},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),t})()})),q(X,()=>C(`thisRevision`)),q(ve,E),q(Q,()=>C(`blocksChanged`)),q(ye,()=>C(`ofTotal`,{total:T().length})),q(xe,()=>C(`status_added`)),q(Se,()=>j().added),q(we,()=>C(`status_modified`)),q(Te,()=>j().modified),q(De,()=>C(`status_moved`)),q(Oe,()=>j().moved),q(Ae,()=>C(`status_removed`)),q(je,()=>j().removed),q(Ze,()=>C(`annotations`)),q(Qe,I),q(Xe,B(H,{get when(){return L().length>0},get fallback(){return(()=>{var e=Je();return q(e,()=>C(`noNotesYet`)),e})()},get children(){var e=Be();return q(e,B(V,{get each(){return L()},children:e=>(()=>{var t=Ye(),n=t.firstChild,r=n.nextSibling.firstChild,i=r.nextSibling;return t.$$click=()=>ce(e),q(r,()=>e.label),q(i,()=>e.annotation.comment),b(()=>G(n,`dot dot-${e.annotation.verdict}`)),t})()})),e}}),null),q(et,B(H,{get when(){return E()>0},get children(){var e=Ve();return e.$$click=()=>d(!u()),q(e,(()=>{var e=U(()=>!!u());return()=>e()?C(`onlyChanged`):C(`showAll`)})()),e}}),$),$.$$click=se,q($,()=>C(`globalNotes`),tt),q($,()=>N().length,nt),q(it,()=>C(I()===1?`noteCountOne`:`noteCount`,{count:I()}),null),at.$$click=()=>void le(`deny`),q(at,()=>C(`deny`)),ot.$$click=()=>void le(`approve`),q(st,()=>C(`approve`)),b(e=>{var t=A(),n=A()||c()!==void 0,r=A()||c()!==void 0;return t!==e.e&&($.disabled=e.e=t),n!==e.t&&(at.disabled=e.t=n),r!==e.a&&(ot.disabled=e.a=r),e},{e:void 0,t:void 0,a:void 0}),r})()}function $e(e){return(()=>{var t=Xe(),n=t.firstChild,r=n.nextSibling,i=r.nextSibling.firstChild,a=i.nextSibling;return q(n,B(V,{each:[`change`,`suggest`,`question`],children:t=>(()=>{var n=Ze(),r=n.firstChild;return r.addEventListener(`change`,()=>e.setVerdict(t)),q(n,()=>e.t(`verdict${t[0].toUpperCase()}${t.slice(1)}`),null),b(()=>n.classList.toggle(`active`,e.verdict()===t)),b(()=>r.checked=e.verdict()===t),n})()})),r.$$input=t=>e.setDraft(t.currentTarget.value),K(i,`click`,e.onCancel,!0),q(i,()=>e.t(`cancel`)),K(a,`click`,e.onSave,!0),q(a,()=>e.t(`save`)),b(t=>{var n=e.t(`notePlaceholder`),i=e.draft().trim()===``;return n!==t.e&&he(r,`placeholder`,t.e=n),i!==t.t&&(a.disabled=t.t=i),t},{e:void 0,t:void 0}),b(()=>r.value=e.draft()),t})()}me([`click`,`input`]);var et=document.getElementById(`root`);et&&pe(()=>B(Qe,{}),et);
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
6
|
<meta name="robots" content="noindex" />
|
|
7
|
-
<title>
|
|
8
|
-
<script type="module" crossorigin src="/index-
|
|
9
|
-
<link rel="stylesheet" crossorigin href="/index-
|
|
7
|
+
<title>Spec review</title>
|
|
8
|
+
<script type="module" crossorigin src="/index-Dv52AIjX.js"></script>
|
|
9
|
+
<link rel="stylesheet" crossorigin href="/index-CdTerMvN.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
|
12
12
|
<div id="root"></div>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Wiring between the built UI and the review server.
|
|
3
3
|
*
|
|
4
4
|
* The UI is a separate Vite app whose output is committed to
|
|
5
|
-
* `src/features/
|
|
5
|
+
* `src/features/spec/assets/` (see `pnpm ui:check`). These assertions catch the
|
|
6
6
|
* failure that would otherwise only show up in a browser: the page shipping a
|
|
7
7
|
* bundle path the server cannot resolve (Vite's `assetsDir` and the server's
|
|
8
8
|
* `/assets/<file>` route have to agree).
|
|
@@ -12,8 +12,8 @@ import { mkdtempSync, rmSync } from "node:fs";
|
|
|
12
12
|
import { tmpdir } from "node:os";
|
|
13
13
|
import { join } from "node:path";
|
|
14
14
|
import { afterAll, beforeAll, describe, expect, it } from "vitest";
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
15
|
+
import { startSpecServer } from "./server.js";
|
|
16
|
+
import { createSpecSession } from "./store.js";
|
|
17
17
|
|
|
18
18
|
const assetsDir = new URL("./assets/", import.meta.url).pathname;
|
|
19
19
|
const built = existsSync(join(assetsDir, "index.html"));
|
|
@@ -29,8 +29,8 @@ afterAll(() => {
|
|
|
29
29
|
|
|
30
30
|
describe.skipIf(!built)("built UI assets", () => {
|
|
31
31
|
it("serves the built page and the bundle it references", async () => {
|
|
32
|
-
const session =
|
|
33
|
-
const server = await
|
|
32
|
+
const session = createSpecSession({ agentDir, slug: "assets", text: "## Spec\n\nbody" });
|
|
33
|
+
const server = await startSpecServer({
|
|
34
34
|
session,
|
|
35
35
|
portStart: 44_000 + Math.floor(Math.random() * 1000),
|
|
36
36
|
portAttempts: 20,
|