@andares/pi-toolkits 1.2.0 → 1.2.2

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 CHANGED
@@ -11,6 +11,19 @@ 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.2.2 — 2026-11-26
15
+
16
+ <!-- Notes for the next release go here; `pnpm release` renames this heading. -->
17
+
18
+ - **release** — `pnpm release` now treats a green `publish` workflow run as the release's success criterion and stops there: no more polling npm for the version and its attestation, just a summary with the tag, the run URL, the Release URL and a package-page link. Every child process it spawns has a deadline (ssh included), so the wait can no longer sit silently on a dead connection.
19
+ - **quit-guard** — removed: `/quit-guard`, its settings file and the hang reports are gone. Force-exiting a hung shutdown never fixed the hang and hid the real cause, so pi is left to hang instead.
20
+
21
+ ## 1.2.1 — 2026-11-26
22
+
23
+ - **spec/talk** — both pages have a confirmed **Close** action that stops the review server without sending a decision or a reply, including a closed-state fallback when the server is already gone.
24
+
25
+ <!-- Notes for the next release go here; `pnpm release` renames this heading. -->
26
+
14
27
  ## 1.2.0 — 2026-11-26
15
28
 
16
29
  - **talk** — `/ask-talk` opens the agent's last reply in the review page: one note per block plus a composer, and `Continue` sends just the notes and your message back — the reply itself is not re-quoted.
@@ -92,3 +105,5 @@ renames that heading to the version being published and refuses an empty section
92
105
 
93
106
 
94
107
 
108
+
109
+
package/README.md CHANGED
@@ -13,9 +13,9 @@
13
13
  [![pi >= 0.99](https://img.shields.io/badge/pi-%3E%3D0.99.0-blueviolet)](https://github.com/earendil-works/pi)
14
14
  [![GitHub](https://img.shields.io/badge/github-andares%2Fpi--toolkits-181717?logo=github)](https://github.com/andares/pi-toolkits)
15
15
 
16
- In a nutshell: fourteen 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`, **reply notes in the browser** `ask-talk`, an **acceptance ledger with a browser page** `ask-uat`, a **quit watchdog** `quit-guard`, a **session backlog for parallel work** `keep`, and **release notes on the first start after an upgrade** `whats-new` — with more to come.
16
+ In a nutshell: thirteen 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`, **reply notes in the browser** `ask-talk`, an **acceptance ledger with a browser page** `ask-uat`, a **session backlog for parallel work** `keep`, and **release notes on the first start after an upgrade** `whats-new` — with more to come.
17
17
 
18
- **Requirements**: pi `>=0.99.0`. Every published pi release from 0.99.0 through 1.6.0 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.
18
+ **Requirements**: pi `>=0.99.0`. Every published pi release from 0.99.0 through 1.6.1 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
 
20
20
  ---
21
21
 
@@ -57,7 +57,6 @@ After installing, verify in any pi session:
57
57
  - [🗜️ compact — dedicated compaction model](#compact)
58
58
  - [🚀 autostart — session startup automation](#autostart)
59
59
  - [🧠 init — agent memory framework](#init)
60
- - [🧯 quit-guard — quit watchdog](#quit-guard)
61
60
  - [🧷 keep — session backlog](#keep)
62
61
  - [🆕 whats-new — release notes after an upgrade](#whats-new)
63
62
  - [Development](#development)
@@ -83,7 +82,6 @@ After installing, verify in any pi session:
83
82
  | 🗜️ **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 |
84
83
  | 🚀 **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 |
85
84
  | 🧠 **init** agent memory framework | `/ask-init` | install or adopt a fixed memory layout (`AGENTS.md` + `specs/` + `.agents/memory` + `.agents/implementations`), migrate an existing one with a snapshot and a coverage table, then audit/refresh it for drift, budgets and duplicated facts |
86
- | 🧯 **quit-guard** quit watchdog | `/quit-guard` | force-exit when an interactive shutdown hangs, whether after the TUI teardown or before it on a signal-triggered quit; write a hang report and give the shell prompt back; TUI restarts and Ctrl+Z resume disarm it |
87
85
  | 🧷 **keep** session backlog | `/keep-quit` · `/keep-load` · `/keep-drop` | mark a session unfinished as you quit, reopen the backlog next time (loaded rows dimmed but still selectable), drop what you finished; an append-only ledger, no lock and no host session listing |
88
86
  | 🆕 **whats-new** release notes after an upgrade | automatic | the first `pi` start after an upgrade shows what changed since the version you last ran, once; no slash command or other global namespace is claimed |
89
87
 
@@ -301,7 +299,8 @@ After a development task is done, type the `/ask-review` command to summon **a d
301
299
  - **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".
302
300
  - **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.
303
301
  - **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.
304
- - **Every revision gets a fresh window.** The review server closes shortly after you send a decision, so the next submitted revision starts a new server (next free port in the 20-port range) and opens a new window instead of pointing you at a dead URL. That is a restart of the page, not of the review: every revision, annotation and decision is kept, and the history drawer still lists the earlier rounds.
302
+ - **Every revision gets a fresh window.** The review server closes shortly after you send a decision, so the next submitted revision starts a new server (the next free port in the shared 7600–7699 pool) and opens a new window instead of pointing you at a dead URL. That is a restart of the page, not of the review: every revision, annotation and decision is kept, and the history drawer still lists the earlier rounds.
303
+ - **Close without replying.** The top-right **Close** button asks for confirmation, stops this review's server and tries to close the tab without sending a decision or any message to the agent. If `/reload` has already removed the server, the page still enters a closed state instead of reconnecting forever.
305
304
  - **Contents and back to top.** A column of warm grey bars sits at the reading column's right edge; pointing at it opens a table of contents (one bar per heading, current section marked) that jumps on click, and the whole column hides in the single-column layout. Once the right column has scrolled out of view, a "Back to top" button appears above the footer. Both are shared with `/ask-talk`.
306
305
  - **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.)
307
306
 
@@ -330,9 +329,11 @@ the two phases do not run on top of each other.
330
329
  No tool is registered, no tool set changes, no permission mode is touched and nothing is added to the system prompt: the command costs nothing until you type it, and it works inside `/ask` and the other phases.
331
330
 
332
331
  - **Only the notes go back.** The message is `## Notes on your last reply` — each note with the block it quotes, clipped to 600 characters — followed by `## Operator's message`. The reply itself is not echoed: it is already in the model's context. If a compaction pushed it out, the reply is repeated once in full so the quotes still point at text the model can see.
333
- - **One note per block, no verdicts.** A conversation annotation is "here is what I think about this part", not a change request to triage; clicking the note edits it.
332
+ - **One note per paragraph, no verdicts.** A conversation annotation is "here is what I think about this part", not a change request to triage; clicking the note edits it. Headings are navigation only — they appear in the contents but carry no notes.
334
333
  - **No versions, no diff, no approval.** It is a snapshot, not a document under revision. Running `/ask-talk` again refreshes it: the same reply keeps your notes, a new reply starts empty.
334
+ - **Titled by session, and every run opens the window.** The page is named after the current session (its first prompt until the session gets a name), so pages from parallel sessions are told apart at a glance; each `/ask-talk` re-opens the window — same reply included — because the previous tab may be gone.
335
335
  - **Continue commits once.** It saves the notes and the composer text, sends one message and closes the port; the page then offers to be closed (a tab opened by an external launcher cannot be closed by script).
336
+ - **Or close without Continue.** The top-right **Close** button asks for confirmation and stops the review server without sending notes, the draft, or any message to the agent. It also works as a closed-state fallback when `/reload` has already made the server unreachable.
336
337
  - **It refuses while the agent is running.** The host persists an assistant message at the end of a run, so annotating mid-run would silently show the *previous* reply.
337
338
 
338
339
  ```text
@@ -414,7 +415,7 @@ pi's `/compact` and auto-compact summarize the context **with the current sessio
414
415
  | auto-compact threshold reached | summarized by the compaction model |
415
416
  | context overflow recovery | summarized by the compaction model, retry behavior unchanged |
416
417
 
417
- **Parts that are identical to pi's built-in behavior after takeover** (the built-in implementation is mirrored verbatim — copied from 0.87.1, byte-identical across 1.2.0 → 1.6.0 apart from the two 1.4.0 fixes adopted here: summaries request the model's output limit instead of a fixed fraction of `reserveTokens`, and `/compact <instructions>` also reaches the split-turn prefix, plus the 1.5.0 `cost.totalFromProvider` merge rule in the usage accounting — and only the executing model changes; the conversation serializer itself is imported from the host, so it follows whatever the running host does, e.g. 1.2.0 stops feeding assistant thinking back into the summarization request):
418
+ **Parts that are identical to pi's built-in behavior after takeover** (the built-in implementation is mirrored verbatim — copied from 0.87.1, byte-identical across 1.2.0 → 1.6.1 apart from the two 1.4.0 fixes adopted here: summaries request the model's output limit instead of a fixed fraction of `reserveTokens`, and `/compact <instructions>` also reaches the split-turn prefix, plus the 1.5.0 `cost.totalFromProvider` merge rule in the usage accounting — and only the executing model changes; the conversation serializer itself is imported from the host, so it follows whatever the running host does, e.g. 1.2.0 stops feeding assistant thinking back into the summarization request):
418
419
 
419
420
  - **Summary format** — the structured Goal / Progress / Key Decisions checkpoint; when a summary already exists, the iterative-update prompt is used so information carries over instead of being lost
420
421
  - **Split behavior** — the `keepRecentTokens` retention policy, and `firstKeptEntryId` / `tokensBefore` passed back unchanged
@@ -495,7 +496,7 @@ An **identical command line** declared by both sources runs once: a duplicate is
495
496
 
496
497
  **Key constraint: extension commands only**. Commands registered via `registerCommand` such as `/add-dir` (pi-add-dir) and `/cd` (pi-cd) work; built-in commands (`/compact`, `/reload`, `/resume`, …) are dispatched in the TUI layer and cannot be triggered from the extension layer; skill commands (`/skill:name`) are an expansion mechanism rather than an execution mechanism. The target extension you depend on (e.g. pi-add-dir) must be installed first.
497
498
 
498
- > **Implementation notes**: execution uses `sendUserMessage(cmd, { expandPromptTemplates: true })` — that option routes `/cmd args` into command dispatch instead of the model prompt path (the wrapper defaults to `false`; `_tryExecuteExtensionCommand` is byte-identical across 1.2.0–1.6.0, and although 1.5.1 moved the rest of `sendUserMessage` into `_preparePrompt`, the extension-command branch is still its first early exit — see the host-compatibility discipline in AGENTS.md). Pre-validation uses `pi.getCommands()` (accepting only `source: "extension"`). Depends on `smol-toml` (zero-dependency, ~10KB, TOML 1.0).
499
+ > **Implementation notes**: execution uses `sendUserMessage(cmd, { expandPromptTemplates: true })` — that option routes `/cmd args` into command dispatch instead of the model prompt path (the wrapper defaults to `false`; `_tryExecuteExtensionCommand` is byte-identical across 1.2.0–1.6.1, and although 1.5.1 moved the rest of `sendUserMessage` into `_preparePrompt`, the extension-command branch is still its first early exit — see the host-compatibility discipline in AGENTS.md). Pre-validation uses `pi.getCommands()` (accepting only `source: "extension"`). Depends on `smol-toml` (zero-dependency, ~10KB, TOML 1.0).
499
500
 
500
501
  ---
501
502
 
@@ -601,113 +602,6 @@ package never directs the model which language to write or reply in.
601
602
  > framework version lives in `.agents/framework/state.toml`; a project whose state
602
603
  > version is newer than the installed tool is never migrated.
603
604
 
604
- ## 🧯 quit-guard — quit watchdog
605
-
606
- <a name="quit-guard"></a>
607
-
608
- **The problem.** pi's interactive `/quit` stops the TUI and then awaits every extension's
609
- `session_shutdown` handler, one after another, **with no timeout**
610
- (`runtimeHost.dispose()` → `emitSessionShutdownEvent()`; upstream
611
- [issue #9997](https://github.com/earendil-works/pi/issues/9997), still unbounded in 1.5.1 and on
612
- `main` — 1.5.1 added `await session.abort()` before the handler loop and a credential-write
613
- settle after it, i.e. more awaits in the same untimed chain). One handler that never settles leaves pi alive at 0% CPU *after* the terminal has
614
- already been restored and the final frame reprinted: the screen looks like a frozen "exit
615
- screen", and the shell prompt never comes back. Ctrl+C and SIGTERM did not end the hung process
616
- in our measurements (SIGKILL did); once that phase starts, the host has no way out of it.
617
- Measured with a 20-extension setup (2026-11-05): a healthy quit spends 0.1–3 s in that phase,
618
- `pi -ne` 0.12 s — and one of three quits with the same setup never finished at all.
619
-
620
- **What this does.** The guard watches the terminal instead of the event stream, so it still
621
- works when the handler that hangs was loaded *before* this package (in that case our own
622
- `session_shutdown` would never run). It arms on the TUI's teardown sequence
623
- (`\x1b[?2004l` / `\x1b[?1049l`) — and, for the signal-triggered path (`kill -TERM`, a closed
624
- window), on `session_shutdown` with reason `quit`, because that path runs every extension
625
- handler *before* the TUI writes its teardown sequence: a stuck handler there would never produce
626
- a marker. If the process is still alive `timeoutMs` later, it writes a hang report, restores the
627
- terminal if the TUI never did (alternate screen, bracketed paste, cursor) and forces the exit.
628
- A TUI that comes back disarms it — an interactive mode switch (`/settings` → TUI mode) and
629
- Ctrl+Z suspend/resume both re-enter the TUI, and a live session must never be killed. The event
630
- trigger is deliberately limited to TUI mode: RPC/JSON/print stdout is machine-readable and is
631
- never given terminal escape sequences.
632
-
633
- **Two hangs, two layers.** The fire path above lives on the main event loop — which is exactly
634
- what can also die: on 2026-11-13 the guard fired, wrote its report, printed "forcing exit" and
635
- called `process.exit(0)` … and the process hung for 18 minutes in `futex_wait` with the pty
636
- already deleted (the user had closed the terminal window to escape). Host code on the exit path
637
- (`process.on("exit")` listeners, bundled graceful-fs patches, stdio flush) can deadlock
638
- synchronously, and a `setTimeout` fallback cannot fire inside a dead loop. Therefore:
639
-
640
- - **arm-time watchdog thread** — arming also starts a `worker_threads` worker that does not
641
- live on the main loop. The main loop beats a 1 Hz heartbeat into shared memory; after the
642
- deadline (plus a head start for the main-loop fire timer, which handles the common hangs with
643
- full context: raw-mode probe, full report, terminal restore) the worker samples the heartbeat
644
- twice. Still beating → the event loop is alive → it steps aside (the fire timer owns the
645
- outcome, including its stray-marker protection). Stopped → the main loop can never fire → the
646
- worker restores the terminal, writes a minimal `-thread.json` report and SIGKILLs. This also
647
- covers the blind spot where the main thread deadlocks *before* the fire deadline — e.g.
648
- synchronously inside `process.exit` right after a fast dispose — because the worker never
649
- needed the main loop in the first place. Every disarm (TUI restart, Ctrl+Z resume, `/reload`)
650
- cancels the worker, so a returning TUI is never killed.
651
- - **fire-time hard kill** — after the report is on disk and "forcing exit" printed, fire()
652
- starts a second worker that unconditionally SIGKILLs 500 ms later; `process.exit(0)` and a
653
- same-loop `setTimeout` SIGKILL run before it, so the worker only matters when the main thread
654
- is blocked inside the exit path (the exact 2026-11-13 shape).
655
-
656
- ### Commands
657
-
658
- | Command | Effect |
659
- | --- | --- |
660
- | `/quit-guard` | status: on/off, timeout, report on/off, newest hang report |
661
- | `/quit-guard on` / `/quit-guard off` | enable/disable, persisted |
662
- | `/quit-guard <ms>` | set the deadline (clamped to 2000–60000 ms), persisted |
663
-
664
- **Configuration** — the guard is **on by default** (8 s after the teardown write, hang report
665
- on), so an install is protected without any setup. It persists to
666
- `<agent-dir>/pi-toolkits-quit-guard.json`, written by the commands; every field is optional:
667
-
668
- ```json
669
- {
670
- "enabled": true,
671
- "timeoutMs": 8000,
672
- "report": true
673
- }
674
- ```
675
-
676
- `timeoutMs` counts **from the teardown write**, not from the moment you press Enter, so the time
677
- the TUI spends stopping is not charged against a slow-but-finishing shutdown. Keep it above your
678
- slowest healthy quit: the default is **8 s**, and the slowest healthy quit measured above was 5 s
679
- end to end (of which ~2 s came after the teardown), leaving ~3 s of margin.
680
-
681
- **Hang reports** — `<agent-dir>/quit-guard/quit-hang-<timestamp>-<pid>.json` records the
682
- arm/fire timing, the teardown marker, and the process state at the deadline (`activeHandles`,
683
- `activeRequests`, and the host's libuv handle table). An empty `libuv` table next to a live
684
- process is the signature of a promise nobody will ever resolve, as opposed to a blocked socket
685
- or a lingering child process. The file is owner-only (0600 in an 0700 directory) and process
686
- arguments are redacted with the same rules as the approval log, so `pi --api-key …` does not
687
- leave the key on disk.
688
-
689
- `PI_QUIT_GUARD_DEBUG=<file>` appends one line per `arm` / `disarm` / `fire` (plus one per
690
- extension registration); once the TUI is gone it is the only channel left. A thread-watchdog
691
- kill appends `thread-kill heartbeat-stopped …` there.
692
-
693
- ### Boundaries
694
-
695
- - Interactive TUI only. Print (`-p`), JSON, and RPC sessions never write the teardown
696
- sequences, so the guard stays inert there.
697
- - The deadline covers the **post-teardown** phase. A shutdown that hangs before the TUI stops
698
- (not observed; `drainInput` is bounded at 1 s) is out of scope.
699
- - When it fires, the remaining extension cleanup is skipped **by design** — that cleanup is what
700
- was hanging. Session entries are appended to the session JSONL as they happen, so the
701
- transcript is intact up to the last written entry. The process exits 0; if the exit path
702
- itself deadlocks (observed for real: host `exit` listeners, stdio flush), the layered
703
- fallbacks — same-loop `setTimeout` SIGKILL, then the watchdog/hard-kill worker threads — end
704
- the process anyway. A worker cannot be constructed only under resource exhaustion; the guard
705
- then degrades to the behavior it had before the thread layers existed.
706
- - This is a workaround for a host gap. If pi ever bounds `session_shutdown`, the guard becomes
707
- a no-op safety net and can be removed.
708
-
709
- ---
710
-
711
605
  ## 🧷 keep — session backlog for parallel work
712
606
 
713
607
  <a name="keep"></a>
@@ -815,8 +709,6 @@ src/
815
709
  │ # audit payload, tests
816
710
  ├── spec/ # browser-reviewed specs: phases, block diff,
817
711
  │ # review server, UI, tests
818
- ├── quit-guard/ # quit watchdog: TUI teardown + quit-event triggers,
819
- │ # settings store, hang report, tests
820
712
  ├── review/ # third-party review: command trigger,
821
713
  │ # review model config store, prompt, tests
822
714
  ├── stash/ # prompt stash: hotkey state machine + tests
@@ -840,7 +732,7 @@ pnpm release:github # create/verify the GitHub Release for the c
840
732
  pnpm release:github --audit # list npm versions vs GitHub Releases vs remote tags
841
733
  ```
842
734
 
843
- Releasing is a **tag push**. `pnpm release` runs the gates (`typecheck`, `test`, UI checks), promotes the `## Unreleased` section of `CHANGELOG.md` to the new version (an empty section aborts the release — `--skip-changelog` opts out), bumps the version, commits, tags `vX.Y.Z`, pushes the branch and the tag — then waits for the GitHub Actions `publish` workflow. That workflow publishes with **npm trusted publishing (OIDC)**: no npm token, no interactive 2FA, and a provenance attestation on every version. The script only reports success once the version is on npm with `dist.attestations` non-empty.
735
+ Releasing is a **tag push**. `pnpm release` runs the gates (`typecheck`, `test`, UI checks), promotes the `## Unreleased` section of `CHANGELOG.md` to the new version (an empty section aborts the release — `--skip-changelog` opts out), bumps the version, commits, tags `vX.Y.Z`, pushes the branch and the tag — then waits for the GitHub Actions `publish` workflow. That workflow publishes with **npm trusted publishing (OIDC)**: no npm token, no interactive 2FA, and a provenance attestation on every version. **A green workflow run is the release's success criterion** — the script does not poll npm afterwards; the package page is the place to check propagation and provenance.
844
736
 
845
737
  `--prepare-only` is the "prepare everything, decide later" switch: it stops after commit+tag and prints the exact push command. `--no-wait` returns right after the push; `--local` is the emergency path that publishes from this machine with the old token. A failed workflow is retried on the same tag (`gh workflow run publish.yml -f tag=vX.Y.Z`); an already-published version is skipped, so the rerun is idempotent.
846
738
 
package/README.zh-CN.md CHANGED
@@ -13,9 +13,9 @@
13
13
  [![pi >= 0.99](https://img.shields.io/badge/pi-%3E%3D0.99.0-blueviolet)](https://github.com/earendil-works/pi)
14
14
  [![GitHub](https://img.shields.io/badge/github-andares%2Fpi--toolkits-181717?logo=github)](https://github.com/andares/pi-toolkits)
15
15
 
16
- 一句话介绍:目前包含十四个开箱即用的功能——**只读咨询模式** `ask`、**会话级边界权限** `ask-perm`、**模型收藏** `favorites`、**提示词暂存** `stash`、**第三方代码评审** `ask-review`、**独立压缩模型** `compact-model`、**会话启动自动化** `autostart`、**agent 记忆框架** `ask-init`、**浏览器内规格评审** `ask-spec`、**回复批注** `ask-talk`、**验收台账与浏览器页面** `ask-uat`、**退出看门狗** `quit-guard`、**并行任务的会话暂存** `keep`、**升级后首次启动的版本变更提示** `whats-new`,后续持续追加。
16
+ 一句话介绍:目前包含十三个开箱即用的功能——**只读咨询模式** `ask`、**会话级边界权限** `ask-perm`、**模型收藏** `favorites`、**提示词暂存** `stash`、**第三方代码评审** `ask-review`、**独立压缩模型** `compact-model`、**会话启动自动化** `autostart`、**agent 记忆框架** `ask-init`、**浏览器内规格评审** `ask-spec`、**回复批注** `ask-talk`、**验收台账与浏览器页面** `ask-uat`、**并行任务的会话暂存** `keep`、**升级后首次启动的版本变更提示** `whats-new`,后续持续追加。
17
17
 
18
- **版本要求**:pi `>=0.99.0`。0.99.0 到 1.6.0 的每一个已发布版本都用完整门禁实测过(install → `tsc --noEmit` → 全量测试 → 键位审计 → 对 patch 目标宿主文件做哈希比对),每个版本都在沙箱中把整个 `@earendil-works/*` 家族钉在同一版本。更新的版本随发布逐个验证,下限只在实测结果允许时移动;`pnpm check:compat` 可复现该结论。注:pi ≥ 0.99 的宿主要求「宿主提供的包」一律声明为 peerDependencies `"*"` —— `@earendil-works/pi-tui` 与 `typebox`(ask 的 `scratchpad` 用它构造参数 schema)都按此声明;若放进 `dependencies`,pi 会告警。
18
+ **版本要求**:pi `>=0.99.0`。0.99.0 到 1.6.1 的每一个已发布版本都用完整门禁实测过(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
 
20
20
  ---
21
21
 
@@ -57,7 +57,6 @@ pi -e ./src/index.ts
57
57
  - [🗜️ compact — 独立压缩模型](#compact)
58
58
  - [🚀 autostart — 会话启动自动化](#autostart)
59
59
  - [🧠 init — agent 记忆框架](#init)
60
- - [🧯 quit-guard — 退出看门狗](#quit-guard)
61
60
  - [🧷 keep — 会话暂存](#keep)
62
61
  - [🆕 whats-new — 升级后的版本变更提示](#whats-new)
63
62
  - [开发](#development)
@@ -83,7 +82,6 @@ pi -e ./src/index.ts
83
82
  | 🗜️ **compact** 独立压缩模型 | `/compact-model` | 给 `/compact` 与 auto-compact 配一个便宜快模型做总结,主模型专注对话;未配置零开销、任何异常回落 pi 默认 |
84
83
  | 🚀 **autostart** 会话启动自动化 | `.pi/autostart.toml` | 项目内声明启动时自动执行的斜杠命令(首批用例:`/add-dir` 多仓库挂载);未信任不执行、未注册命令跳过不发给模型 |
85
84
  | 🧠 **init** agent 记忆框架 | `/ask-init` | 安装或接管一套固定的记忆结构(`AGENTS.md` + `specs/` + `.agents/memory` + `.agents/implementations`),带快照与覆盖表迁移旧文档,之后可随时审计/刷新漂移、预算与重复事实 |
86
- | 🧯 **quit-guard** 退出看门狗 | `/quit-guard` | 交互式退出卡死时,无论发生在 TUI 收尾之后、还是信号触发路径的收尾之前,超时后写诊断报告并强制退出,把命令行提示符还给你;TUI 重启与 Ctrl+Z 恢复都会解除看守 |
87
85
  | 🧷 **keep** 会话暂存 | `/keep-quit` · `/keep-load` · `/keep-drop` | 退出时一条命令把当前会话标记为未完成,下次进来直接看这个待办列表(已载入的置灰但仍可选);做完的用 `/keep-drop` 或列表里的 `ctrl+r` 移出。只追加账本,没有锁,也不读宿主的会话列表 |
88
86
  | 🆕 **whats-new** 升级后的版本变更提示 | 自动 | 升级后的首次 `pi` 启动展示「从你上次运行的版本到现在改了什么」,只展示一次;不注册斜杠命令,不占用宿主的全局命令命名空间 |
89
87
 
@@ -301,7 +299,9 @@ run = ["/ask-perm allow allow allow ask"]
301
299
  - **批准和提意见都携带批注。** 它们只决定下一步:批准是「开始实施」(所有批注都带上),提意见是「改完 spec 再提交一版」。
302
300
  - **历史留档。** 每次提交都存在 `<agent-dir>/ask-spec/<slug>/`,页头可以只读回看任意一版;旧的 `<agent-dir>/ask-plan/` 历史会在第一次使用时迁移。
303
301
  - **评审期走边界检查。** `/ask-perm` 在评审开始时按默认值开启,结束时恢复;评审期唯一能写的是 markdown。
304
- - **每一版都有自己的新窗口。** 你提交决定后评审服务很快关端口,所以下一次提交修订会重起服务(20 个端口段里取下一个空闲的)并弹新窗口,而不是把你指向一个死链接。重启的是页面,不是评审:每一版、每条批注和决定都保留,历史抽屉里前几轮仍在。
302
+ - **每一版都有自己的新窗口。** 你提交决定后评审服务很快关端口,所以下一次提交修订会重起服务(从共享的 7600–7699 端口池取下一个空闲端口)并弹新窗口,而不是把你指向一个死链接。重启的是页面,不是评审:每一版、每条批注和决定都保留,历史抽屉里前几轮仍在。
303
+ - **可以不回复直接关闭。** 顶栏右侧的「关闭」会先二次确认,然后停止本次评审服务并尝试关闭标签页,不向 agent 发送决定或任何消息。如果 `/reload` 后服务已经消失,页面也会进入关闭终态,不会一直重连。
304
+ - **目录与回到顶部。** 阅读列右缘有一列暖灰小横杠,指向即展开标题索引(一根横杠对应一个标题,当前章节高亮),点击跳转;单栏布局下整组隐藏。右侧栏整体滚出视口后,页脚上方出现「回到顶部」。两者与 `/ask-talk` 共用。
305
305
  - **绝不切模型。** spec 评审与实施都用会话当前的模型。(`/ask-review` 是唯一会切模型的命令,那是你要求的。)
306
306
 
307
307
  **WSL 下的浏览器**:评审服务器绑 `0.0.0.0`,URL 用 WSL 的地址打印,因为 Windows 连不到 WSL 里只绑 loopback 的服务器。打开器优先用 Windows 侧启动器(`wslview`、`cmd.exe /c start`、`powershell Start-Process`),其它平台才回落到 `xdg-open`——这决定了是「打开你的浏览器」还是「在 WSL 里打开一个你看不见的浏览器」。
@@ -328,9 +328,11 @@ UAT 页面开着时先退出:两个相位不叠在一起跑。
328
328
  不注册工具、不改工具集、不动权限、不进系统提示:不用它时零成本,且在 `/ask` 等相位期间都能用。
329
329
 
330
330
  - **只发批注。** 消息是 `## Notes on your last reply`(每条批注 + 它引用的块,引用裁到 600 字符)加 `## Operator's message`;回复原文不重复,因为它本来就在模型上下文里。若中途 compact 把它挤掉了,才整篇附一次。
331
- - **每块一条批注、无 verdict。** 对话里的批注就是「这块我想说这句」,点开可改。
331
+ - **每个段落一条批注、无 verdict。** 对话里的批注就是「这段我想说这句」,点开可改;标题只做索引导航,不带批注。
332
332
  - **没有版本、没有 diff、没有批准。** 这是快照不是待修订的文档;再跑一次等于刷新:同一条回复保留批注,换了回复就清空。
333
+ - **标题就是会话标题,且每次都开窗。** 页面以当前会话命名(会话还没名字时用第一条 prompt),并行开发时几个窗口一眼分得清;每次 `/ask-talk` 都会重新打开窗口——同一条回复也一样,因为上一个标签页可能已经关了。
333
334
  - **继续只提交一次。** 保存批注与输入框、发一条消息、关掉端口;页面随后提示可以关闭(外部打开的标签页脚本关不掉)。
335
+ - **也可以不走继续直接关闭。** 顶栏右侧的「关闭」会先二次确认,再停止评审服务,不把批注、草稿或任何消息发给 agent。若 `/reload` 后服务已不可达,也会进入关闭终态。
334
336
  - **agent 还在跑时拒绝。** 宿主在回合结束才落盘 assistant 消息,跑到一半打开只会静默显示**上一轮**。
335
337
 
336
338
  ```text
@@ -406,7 +408,7 @@ pi 的 `/compact` 与 auto-compact 默认**用当前会话模型**做上下文
406
408
  | auto-compact 阈值触发 | 压缩模型总结 |
407
409
  | context overflow 恢复 | 压缩模型总结,重试行为不变 |
408
410
 
409
- **接管后与 pi 内建行为完全一致的部分**(逐字同步 pi 内建实现,复制自 0.87.1、在 1.2.0 → 1.6.0 内字节级不变 —— 除了此处采纳的两项 1.4.0 修正:摘要请求使用模型自身的输出上限而非 `reserveTokens` 的固定比例,以及 `/compact <instructions>` 也会进入 split-turn 前缀,外加 1.5.0 的 `cost.totalFromProvider` 合并规则(用量统计);只换执行模型;对话序列化函数(`serializeConversation`)是直接从宿主导入的,因此跟随宿主行为 —— 例如 1.2.0 起不再把 assistant thinking 回填进摘要请求):
411
+ **接管后与 pi 内建行为完全一致的部分**(逐字同步 pi 内建实现,复制自 0.87.1、在 1.2.0 → 1.6.1 内字节级不变 —— 除了此处采纳的两项 1.4.0 修正:摘要请求使用模型自身的输出上限而非 `reserveTokens` 的固定比例,以及 `/compact <instructions>` 也会进入 split-turn 前缀,外加 1.5.0 的 `cost.totalFromProvider` 合并规则(用量统计);只换执行模型;对话序列化函数(`serializeConversation`)是直接从宿主导入的,因此跟随宿主行为 —— 例如 1.2.0 起不再把 assistant thinking 回填进摘要请求):
410
412
 
411
413
  - **摘要格式** —— Goal / Progress / Key Decisions 结构化 checkpoint;已有摘要时用迭代更新版 prompt,信息延续不丢
412
414
  - **切分行为** —— 保留最近 `keepRecentTokens` 的策略、`firstKeptEntryId` / `tokensBefore` 原样回传,不动
@@ -487,7 +489,7 @@ run = [
487
489
 
488
490
  **关键约束:只支持扩展命令**。`/add-dir`(pi-add-dir)、`/cd`(pi-cd)等 `registerCommand` 注册的命令可以;内置命令(`/compact`、`/reload`、`/resume`…)在 TUI 层分发,扩展层触发不了;skill 命令(`/skill:name`)是展开机制而非执行机制。依赖的目标扩展(如 pi-add-dir)需要先安装。
489
491
 
490
- > **实现说明**:执行用 `sendUserMessage(cmd, { expandPromptTemplates: true })` —— 该选项把 `/cmd args` 路由到命令分发而不是模型 prompt 路径(包装层默认 `false`;`_tryExecuteExtensionCommand` 在 1.2.0–1.6.0 全区间字节级一致,1.5.1 虽把 `sendUserMessage` 其余部分重构进 `_preparePrompt`,扩展命令分支仍是它最前面的早退路径,见 AGENTS.md 宿主兼容纪律)。预校验用 `pi.getCommands()`(只认 `source: "extension"`)。依赖 `smol-toml`(零依赖、~10KB、TOML 1.0)。
492
+ > **实现说明**:执行用 `sendUserMessage(cmd, { expandPromptTemplates: true })` —— 该选项把 `/cmd args` 路由到命令分发而不是模型 prompt 路径(包装层默认 `false`;`_tryExecuteExtensionCommand` 在 1.2.0–1.6.1 全区间字节级一致,1.5.1 虽把 `sendUserMessage` 其余部分重构进 `_preparePrompt`,扩展命令分支仍是它最前面的早退路径,见 AGENTS.md 宿主兼容纪律)。预校验用 `pi.getCommands()`(只认 `source: "extension"`)。依赖 `smol-toml`(零依赖、~10KB、TOML 1.0)。
491
493
 
492
494
  ---
493
495
 
@@ -575,48 +577,6 @@ refresh 就会正常更新它。
575
577
  > **跑完记得 `/reload`**,让新的 `AGENTS.md` 进入提示词。框架版本记在
576
578
  > `.agents/framework/state.toml`;若项目的状态版本比当前工具新,则拒绝迁移。
577
579
 
578
- ## 🧯 quit-guard — 退出看门狗
579
-
580
- <a name="quit-guard"></a>
581
-
582
- **要解决的问题**。pi 的 `/quit` 先停 TUI,然后**逐个 await** 每个扩展的 `session_shutdown` 处理器,且**没有任何超时**(`runtimeHost.dispose()` → `emitSessionShutdownEvent()`;上游
583
- [issue #9997](https://github.com/earendil-works/pi/issues/9997),1.5.1 与 `main` 至今未修,1.5.1 还在处理器循环前加了 `await session.abort()`、之后加了凭据写盘等待——同一条没有超时的链上又多了两个 await)。只要有一个处理器永不 settle,pi 就会在终端已还原、最后一帧已重绘之后,以 0% CPU 永远挂着:画面看起来像「停在退出界面」,提示符再也不回来;实测 Ctrl+C 与 SIGTERM 都无法结束这个进程(只有 SIGKILL 有效)——进了这段收尾,宿主自己也没有出口。20 个扩展的环境实测(2026-11-05):健康退出在这段收尾上花 0.1–3 秒,`pi -ne` 0.12 秒;同一环境三次 `/quit` 就有一次**永远不结束**。
584
-
585
- **这个功能做什么**。看守盯的是**终端写出的收尾序列**,而不是事件流——所以即使卡死的处理器比本包**先**加载(那样我们自己的 `session_shutdown` 根本不会运行),它照样能触发。它在 TUI 收尾序列(`\x1b[?2004l` / `\x1b[?1049l`)出现时开始计时;**信号触发的退出**(`kill -TERM`、关窗 SIGHUP)另有一只触发源:`session_shutdown` 且 reason 为 `quit`——那条路是**先跑完所有扩展处理器再停 TUI**,处理器挂住时收尾序列永远写不出来,只靠序列就会漏掉。若 `timeoutMs` 之后进程还活着,它写一份诊断报告;若 TUI 从没恢复过终端,它先做恢复(退备用屏、关括号粘贴、显示光标)再强制退出。TUI **回来**时自动解除:`/settings` 里切换 TUI 显示模式、Ctrl+Z 挂起后 `fg` 恢复,都会让 TUI 重新进入,绝不能误杀活着的会话。事件触发源只限 TUI 模式:RPC/JSON/print 的 stdout 是机器可读协议,绝不会被写入终端转义序列。
586
-
587
- ### 命令
588
-
589
- | 命令 | 作用 |
590
- | --- | --- |
591
- | `/quit-guard` | 查看状态:开关、超时、报告开关、最近一份诊断报告 |
592
- | `/quit-guard on` / `/quit-guard off` | 开启/关闭,并持久化 |
593
- | `/quit-guard <ms>` | 设置超时(钳制在 2000–60000 ms),并持久化 |
594
-
595
- **配置** —— 看守**默认开启**(收尾序列写出后 8 秒、写诊断报告),装上就有保护,不用先配置。状态持久化在 `<agent-dir>/pi-toolkits-quit-guard.json`,由命令写入;所有字段都可省略:
596
-
597
- ```json
598
- {
599
- "enabled": true,
600
- "timeoutMs": 8000,
601
- "report": true
602
- }
603
- ```
604
-
605
- `timeoutMs` 从**收尾序列写出**那一刻开始算,不是从你按下 Enter 开始算——TUI 自己停下来的时间不计入,所以「慢但能完成」的收尾(记忆库 flush、MCP 关闭)不会被误杀。默认 **8 秒**;上例实测最慢的健康退出端到端 5 秒(其中约 2 秒发生在收尾之后),余量约 3 秒。
606
-
607
- **诊断报告** —— `<agent-dir>/quit-guard/quit-hang-<时间戳>-<pid>.json`,记录开始计时/触发的时间、触发用的收尾序列,以及截止时进程的状态(`activeHandles`、`activeRequests`、宿主 libuv 句柄表)。**进程还活着但 `libuv` 表是空的**,就是「有个 Promise 永远不会 settle」的特征,区别于阻塞的 socket 或残留子进程。报告文件**仅本人可读**(0700 目录下的 0600 文件),进程参数按审批日志同一套规则脱敏,所以 `pi --api-key …` 不会把密钥留在盘上。
608
-
609
- `PI_QUIT_GUARD_DEBUG=<文件>` 会把每次 `arm` / `disarm` / `fire`(以及每次扩展注册)追加一行;TUI 已经没了的时候,这是唯一还能观察的通道。
610
-
611
- ### 边界
612
-
613
- - 只覆盖交互式 TUI。`-p`(print)、JSON、RPC 模式不会写这些收尾序列,看守在那里完全不生效。
614
- - 计时覆盖的是**收尾之后**的阶段;在 TUI 停下之前就卡住的情况(未观察到;`drainInput` 上限 1 秒)不在范围内。
615
- - 触发时**按设计跳过**剩余扩展清理——挂住的就是它。会话条目是随发生随写入 JSONL 的,所以最后一条已写入的记录不会丢。正常路径退出码 0;若 `process.exit()` 本身被 `exit` 监听器变成空操作,500 ms 后会补一记 `SIGKILL`。
616
- - 这是对宿主缺口的权宜之计:哪天 pi 给 `session_shutdown` 加上限时,看守就退化成无害的保险,可以直接删掉。
617
-
618
- ---
619
-
620
580
  ## 🧷 keep — 并行任务的会话暂存
621
581
 
622
582
  <a name="keep"></a>
@@ -704,8 +664,6 @@ src/
704
664
  │ # 审计 payload、测试
705
665
  ├── spec/ # 浏览器内规格评审:相位、块级 diff、
706
666
  │ # 评审服务器、UI、测试
707
- ├── quit-guard/ # 退出看门狗:TUI 收尾 + quit 事件双触发、
708
- │ # 配置存储、诊断报告、测试
709
667
  ├── review/ # 第三方评审:指令触发、
710
668
  │ # 评审模型配置存储、提示词、测试
711
669
  ├── stash/ # 提示词暂存:热键状态机 + 测试
@@ -729,7 +687,7 @@ pnpm release:github # 为当前版本创建/校验 GitHub Releas
729
687
  pnpm release:github --audit # 列出 npm 版本 vs GitHub Release vs 远端 tag
730
688
  ```
731
689
 
732
- **发版 = 推 tag。** `pnpm release` 跑完门禁(`typecheck`、`test`、UI 检查)、把 `CHANGELOG.md` 的 `## Unreleased` 提升为即将发布的版本号(段落为空则中止,`--skip-changelog` 可跳过)、改版本、commit、打 `vX.Y.Z` tag、推分支和 tag,然后等 GitHub Actions 的 `publish` 工作流。该工作流用 **npm trusted publishing(OIDC)** 发布:不需要 npm token、不需要交互式 2FA,每个版本自动附 provenance。脚本只在 npm 上真的出现该版本、且 `dist.attestations` 非空时才报成功。
690
+ **发版 = 推 tag。** `pnpm release` 跑完门禁(`typecheck`、`test`、UI 检查)、把 `CHANGELOG.md` 的 `## Unreleased` 提升为即将发布的版本号(段落为空则中止,`--skip-changelog` 可跳过)、改版本、commit、打 `vX.Y.Z` tag、推分支和 tag,然后等 GitHub Actions 的 `publish` 工作流。该工作流用 **npm trusted publishing(OIDC)** 发布:不需要 npm token、不需要交互式 2FA,每个版本自动附 provenance。**workflow run 绿了就是发版成功的判据** —— 脚本之后不再去查 npm;registry 的传播与 provenance 点开包页面自己看。
733
691
 
734
692
  `--prepare-only` 是「都准备好、发不发最后再说」的开关:停在 commit+tag 后,打印确切的推送命令。`--no-wait` 推完就返回;`--local` 是应急路径(本机用旧 token 发布)。工作流失败后重跑同一个 tag 即可(`gh workflow run publish.yml -f tag=vX.Y.Z`):已发布的版本会跳过,所以重跑是幂等的。
735
693
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@andares/pi-toolkits",
3
- "version": "1.2.0",
4
- "description": "Integrated toolkit extension for pi — ask mode (read-only Q&A), browser-reviewed planning, reply notes in the browser (/ask-talk), 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 session backlog (/keep-quit, /keep-load, /keep-drop), a quit watchdog, and release notes on the first start after an upgrade",
3
+ "version": "1.2.2",
4
+ "description": "Integrated toolkit extension for pi — ask mode (read-only Q&A), browser-reviewed planning, reply notes in the browser (/ask-talk), 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 session backlog (/keep-quit, /keep-load, /keep-drop), and release notes on the first start after an upgrade",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -47,8 +47,6 @@
47
47
  "acceptance",
48
48
  "acceptance-testing",
49
49
  "change-record",
50
- "quit-guard",
51
- "watchdog",
52
50
  "whats-new",
53
51
  "release-notes",
54
52
  "changelog",
@@ -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;--footer-h:96px;--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;padding:0 140px calc(var(--footer-h) + 54px);margin:0 auto}.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}.page-closed{place-items:center;min-height:100vh;display:grid}.manual-close-notice{width:min(520px,100%)}.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}}.bar-talk{background:linear-gradient(90deg,#e0446b4d,#e0446b00)}.block-talk .block-head{justify-content:space-between}.block-talk .block-id{display:none}.note-talk{align-items:center}.verdict-talk{color:#b72847;background:#f8dde2}.note-input{background:var(--surface);width:100%;min-height:84px;color:var(--ink);font:inherit;resize:vertical;border:1px solid #e7c9c1;border-radius:12px;padding:12px 14px;font-size:13px;line-height:1.55}.note-input:focus{border-color:#e0446b8c;outline:none;box-shadow:0 0 0 3px #e0446b1f}.rail-hint{color:var(--muted);margin:10px 0 14px;font-size:12px;line-height:1.5}.block.is-target{animation:1.2s ease-out target-flash}@keyframes target-flash{0%,55%{box-shadow:0 0 0 3px #e0446b29, var(--shadow);border-color:#e0446bbf}to{border-color:var(--border);box-shadow:var(--shadow)}}.footer-talk{grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:18px;padding:14px 20px}.footer-composer{min-width:0}.composer-input{background:var(--surface);width:100%;height:35px;max-height:220px;color:var(--ink);font:inherit;resize:none;border:1px solid #e7c9c1;border-radius:14px;padding:6px 12px;font-size:13.5px;line-height:1.55;transition:border-color .15s,box-shadow .15s,height .12s;display:block;overflow-y:hidden}.composer-input:focus{border-color:#e0446b80;outline:none;box-shadow:0 0 0 3px #e0446b1a}.outline{z-index:40;pointer-events:none;justify-content:flex-end;align-items:center;display:flex;position:fixed;top:40vh;right:max(20px,50vw - 624px)}.outline-bars{overscroll-behavior:contain;scrollbar-width:none;pointer-events:auto;cursor:pointer;flex-direction:column;align-items:flex-end;gap:6px;width:16px;max-height:min(52vh,300px);display:flex;overflow-y:auto}.outline-bars::-webkit-scrollbar{display:none}.outline-bars:hover .outline-bar{background:#a06c70bf}.outline-bar{background:#d3b3ac;border-radius:999px;flex:none;height:2px;transition:background .15s,width .15s}.outline-bar.is-active{background:var(--brand);height:3px}.outline.is-open .outline-bars{opacity:.5}.outline-panel{border:1px solid var(--border);-webkit-backdrop-filter:blur(18px);backdrop-filter:blur(18px);pointer-events:none;opacity:0;transform-origin:100%;background:#fffdfbf7;border-radius:16px;flex-direction:column;width:292px;max-height:min(60vh,460px);transition:opacity .18s,transform .18s;display:flex;position:absolute;top:50%;right:26px;transform:translateY(-50%)translate(10px)scaleX(.96);box-shadow:0 18px 50px #471b2729}.outline.is-open .outline-panel{pointer-events:auto;opacity:1;transform:translateY(-50%)translate(0)scaleX(1)}.outline-head{justify-content:space-between;align-items:baseline;gap:12px;padding:14px 16px 8px;display:flex}.outline-count{color:var(--muted);font-size:10.5px}.outline-list{overscroll-behavior:contain;flex-direction:column;gap:1px;padding:0 6px 10px;display:flex;overflow-y:auto;-webkit-mask-image:linear-gradient(#0000 0,#000 10px calc(100% - 12px),#0000 100%);mask-image:linear-gradient(#0000 0,#000 10px calc(100% - 12px),#0000 100%)}.outline-row{color:var(--ink);font:inherit;text-align:left;white-space:nowrap;text-overflow:ellipsis;background:0 0;border:none;border-radius:8px;padding:7px 10px;font-size:13px;line-height:1.35;transition:background .12s,color .12s;position:relative;overflow:hidden}.outline-row:hover{color:#b79aa2;background:#e0446b0d}.outline-row.is-active{color:var(--brand);background:#e0446b12;font-weight:600}.outline-row.is-active:before{content:"";background:var(--brand);border-radius:999px;width:2px;position:absolute;top:6px;bottom:6px;left:0}.outline-text{text-overflow:ellipsis;display:block;overflow:hidden}.back-to-top{right:max(24px,50vw - 616px);bottom:calc(var(--footer-h) + 16px);z-index:35;border:1px solid var(--border);color:#a9304a;height:38px;font:inherit;-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);cursor:pointer;background:#fffdfbf5;border-radius:999px;align-items:center;gap:8px;padding:0 16px;font-size:12.5px;font-weight:600;animation:.18s ease-out back-to-top-in;display:inline-flex;position:fixed;box-shadow:0 12px 30px #471b2724}.back-to-top svg{width:14px;height:14px}.back-to-top:hover{background:#fff7f4;border-color:#e7c9c1}@keyframes back-to-top-in{0%{opacity:0;transform:translateY(6px)}to{opacity:1;transform:translateY(0)}}@media (max-width:1040px){.outline{display:none}}@media (max-width:800px){.footer-talk{grid-template-columns:1fr;align-items:stretch}.footer-talk .footer-center{justify-self:start}.footer-talk .footer-actions{justify-self:stretch}.footer-talk .btn-approve{flex:1}}@media (prefers-reduced-motion:reduce){.outline-panel,.outline-bar,.composer-input{transition:none}.back-to-top{animation:none}}
@@ -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=I,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 F(s,!0)}finally{p=n,d=r}}function v(e){return()=>C(()=>z(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[k.bind(n),e=>(typeof e==`function`&&(e=f&&f.running&&f.sources.has(n)?e(n.tValue):e(n.value)),A(n,e))]}function b(e,t,n){j(N(e,t,!1,c))}function x(e,t,n){s=L;let r=N(e,t,!1,c),i=O&&ee(O);i&&(r.suspense=i),(!n||!n.render)&&(r.user=!0),h?h.push(r):j(r)}function S(e,t,n){n=n?Object.assign({},a,n):a;let r=N(e,t,!0,0);return r.observers=null,r.observerSlots=null,r.comparator=n.equals||void 0,j(r),k.bind(r)}function C(e){if(p===null)return e();let t=p;p=null;try{return e()}finally{p=t}}function w(e){x(()=>C(e))}function T(e){return d===null||(d.cleanups===null?d.cleanups=[e]:d.cleanups.push(e)),e}var[E,D]=y(!1);function ee(e){let t;return d&&d.context&&(t=d.context[e.id])!==void 0?t:e.defaultValue}var O;function k(){let e=f&&f.running;if(this.sources&&(e?this.tState:this.state)){if((e?this.tState:this.state)===c)j(this);else{let e=m;m=null,F(()=>R(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 A(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&&F(()=>{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&&ne(n)),r?n.tState=c:n.state=c)}if(m.length>1e6)throw m=[],Error()},!1)}return t}function j(e){if(!e.fn)return;z(e);let t=g;M(e,f&&f.running&&f.sources.has(e)?e.tValue:e.value,t),f&&!f.running&&f.sources.has(e)&&queueMicrotask(()=>{F(()=>{f&&(f.running=!0),p=d=e,M(e,e.tValue,t),p=d=null},!1)})}function M(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(z),e.tOwned=void 0):(e.state=c,e.owned&&e.owned.forEach(z),e.owned=null)),e.updatedAt=n+1,ae(t)}finally{p=a,d=i}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&`observers`in e?A(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 N(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 P(e){let t=f&&f.running;if((t?e.tState:e.state)===0)return;if((t?e.tState:e.state)===l)return R(e);if(e.suspense&&C(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)j(e);else if((t?e.tState:e.state)===l){let t=m;m=null,F(()=>R(e,n[0]),!1),m=t}}}function F(e,t){if(m)return e();let n=!1;t||(m=[]),h?n=!0:h=[],g++;try{let t=e();return te(n),t}catch(e){n||(h=null),m=null,ae(e)}}function te(e){if(m&&=(I(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,F(()=>{for(let e of n)z(e);for(let t of e){if(t.value=t.tValue,t.owned)for(let e=0,n=t.owned.length;e<n;e++)z(t.owned[e]);t.tOwned&&(t.owned=t.tOwned),delete t.tValue,delete t.tOwned,t.tState=0}D(!1)},!1)}else if(f.running){f.running=!1,f.effects.push.apply(f.effects,h),h=null,D(!0);return}}let n=h;h=null,n.length&&F(()=>s(n),!1),t&&t()}function I(e){for(let t=0;t<e.length;t++)P(e[t])}function L(t){let r,i=0;for(r=0;r<t.length;r++){let e=t[r];e.user?t[i++]=e:P(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++)P(t[r])}function R(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)&&P(i):e===l&&R(i,t)}}}function ne(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&&ne(r))}}function z(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--)z(e.tOwned[t]);delete e.tOwned}if(f&&f.running&&e.pure)B(e,!0);else if(e.owned){for(t=e.owned.length-1;t>=0;t--)z(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 B(e,t){if(t||(e.tState=0,f.disposed.add(e)),e.owned)for(let t=0;t<e.owned.length;t++)B(e.owned[t])}function re(e){return e instanceof Error?e:Error(typeof e==`string`?e:`Unknown error`,{cause:e})}function ie(e,t,n){try{for(let n of t)n(e)}catch(e){ae(e,n&&n.owner||null)}}function ae(e,t=d){let n=o&&t&&t.context&&t.context[o],r=re(e);if(!n)throw r;h?h.push({fn(){ie(r,n,t)},state:c}):ie(r,n,t)}var oe=Symbol(`fallback`);function V(e){for(let t=0;t<e.length;t++)e[t]()}function se(e,t,n={}){let r=[],a=[],o=[],s=0,c=t.length>1?[]:null;return T(()=>V(o)),()=>{let l=e()||[],u=l.length,d,f;return l[i],C(()=>{let e,t,i,m,h,g,v,y,b;if(u===0)s!==0&&(V(o),o=[],r=[],a=[],s=0,c&&=[]),n.fallback&&(r=[oe],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 H(e,t){return C(()=>e(t||{}))}var ce=e=>`Stale read from <${e}>.`;function U(e){let t=`fallback`in e&&{fallback:()=>e.fallback};return S(se(()=>e.each,e.children,t||void 0))}function W(e){let t=e.keyed,n=S(()=>e.when,void 0,void 0),r=t?n:S(n,void 0,{equals:(e,t)=>!e==!t});return S(()=>{let i=r();if(i){let a=e.children;return typeof a==`function`&&a.length>0?C(()=>a(t?i:()=>{if(!C(r))throw ce(`Show`);return n()})):a}return e.fallback},void 0,void 0)}var G=e=>S(()=>e());function le(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 ue=`_$DX_DELEGATE`;function de(e,t,n,r={}){let i;return _(r=>{i=r,t===document?e():Y(t,e(),!n&&t.firstChild?null:void 0,n)},r.owner),()=>{i(),t.textContent=``}}function K(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?()=>C(()=>document.importNode(i||=a(),!0)):()=>(i||=a()).cloneNode(!0);return o.cloneNode=o,o}function fe(e,t=window.document){let n=t[ue]||(t[ue]=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,X))}}function q(e,t,n){_e(e)||(n==null?e.removeAttribute(t):e.setAttribute(t,n))}function J(e,t){_e(e)||(t==null?e.removeAttribute(`class`):e.className=t)}function pe(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 me(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]||(ve(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||(ve(e,i,!0),n[i]=o)}return n}function he(e,t,n){n==null?e.style.removeProperty(t):e.style.setProperty(t,n)}function ge(e,t,n){return C(()=>e(t,n))}function Y(e,t,n,r){if(n!==void 0&&!r&&(r=[]),typeof t!=`function`)return Z(e,t,r,n);b(r=>Z(e,t(),r,n),r)}function _e(t){return!!e.context&&!e.done&&(!t||t.isConnected)}function ve(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 X(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 Z(e,t,n,r,i){let a=_e(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=Z(e,i,n,r)}),()=>n;else if(Array.isArray(t)){let o=[],c=n&&Array.isArray(n);if(ye(o,t,n,i))return b(()=>n=Z(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?be(e,o,r):le(e,n,o):(n&&Q(e),be(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 ye(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=ye(e,o,s)||i;else if(c===`function`){if(r){for(;typeof o==`function`;)o=o();i=ye(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 be(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 xe=new URLSearchParams(window.location.search).get(`t`)??``;async function $(e,t={}){let n=await fetch(e,{...t,headers:{...t.body?{"content-type":`application/json`}:{},"x-plan-token":xe,...t.headers??{}}});if(!n.ok)throw Error(`${t.method??`GET`} ${e} → HTTP ${n.status}`);return await n.json()}function Se(e){return $(e===void 0?`/api/state`:`/api/state?version=${e}`)}function Ce(e,t){return $(`/api/notes`,{method:`POST`,body:JSON.stringify({notes:e,draft:t})})}function we(e,t){return $(`/api/continue`,{method:`POST`,body:JSON.stringify({notes:e,message:t})})}function Te(){let e=new AbortController,t=setTimeout(()=>e.abort(),3e3);return $(`/api/close`,{method:`POST`,signal:e.signal}).finally(()=>clearTimeout(t))}function Ee(e,t){return $(`/api/annotate`,{method:`POST`,body:JSON.stringify({version:e,annotations:t})})}function De(e,t){return $(`/api/decide`,{method:`POST`,body:JSON.stringify({action:e,version:t})})}function Oe(e){try{return JSON.parse(e.data)}catch{return}}function ke(e){let t=new EventSource(`/api/events?t=${encodeURIComponent(xe)}`);return t.addEventListener(`revision`,t=>{let n=Oe(t);n&&e.onRevision(n.version)}),t.addEventListener(`annotations`,()=>e.onAnnotations()),t.addEventListener(`decided`,t=>{let n=Oe(t);n&&e.onDecided(n)}),t.addEventListener(`refresh`,()=>e.onRefresh?.()),t.addEventListener(`sent`,()=>e.onSent?.()),()=>t.close()}var Ae=`spec:lang`,je=`plan:lang`;function Me(){let e=localStorage.getItem(Ae)??localStorage.getItem(je);return e===`en`||e===`zh`?e:navigator.language.toLowerCase().startsWith(`zh`)?`zh`:`en`}function Ne(e){localStorage.setItem(Ae,e)}var Pe={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.`,closePage:`Close`,closePageHint:`Close this page without sending anything to the agent`,closePageConfirm:`Close this page and stop its review server? Nothing will be sent to the agent.`,closePageDone:`Page closed`,closePageServerClosed:`The review server is closed. Nothing was sent to the agent.`,closePageUnreachable:`The review server could not be reached. Nothing was sent to the agent.`,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.`,talkTitle:`Reply notes`,talkUntitled:`Untitled session`,talkBlocks:`{count} blocks`,talkBlocksOne:`1 block`,talkSentBadge:`sent`,talkSentTitle:`Sent back to pi`,talkNothingToSend:`Write a note or a message first.`,talkNotePlaceholder:`What do you want to say about this part?`,editNote:`Edit note`,yourNote:`your note`,talkAbout:`This reply`,talkAboutBody:`Saved notes and your draft survive a refresh. Continue also includes the open editor, sends once and closes the page.`,talkBlocksLabel:`blocks`,talkChars:`characters`,talkPlaceholder:`Anything else for the agent…`,talkSubmitHint:`Send with Cmd/Ctrl+Enter`,talkContinue:`Continue`},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:`现在可以关闭这个标签页了。`,closePage:`关闭`,closePageHint:`关闭此页面,不向 agent 发送任何信息`,closePageConfirm:`关闭此页面并停止它的评审服务吗?不会向 agent 发送任何信息。`,closePageDone:`页面已关闭`,closePageServerClosed:`评审服务已关闭,没有向 agent 发送任何信息。`,closePageUnreachable:`无法连接评审服务;没有向 agent 发送任何信息。`,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:`还没有批注——在段落上写一条就会出现在这里。`,talkTitle:`回复批注`,talkUntitled:`未命名会话`,talkBlocks:`{count} 块`,talkBlocksOne:`1 块`,talkSentBadge:`已发送`,talkSentTitle:`已发回 pi`,talkNothingToSend:`先写一条批注或一句话。`,talkNotePlaceholder:`这一块你想说什么?`,editNote:`改批注`,yourNote:`你的批注`,talkAbout:`这条回复`,talkAboutBody:`已存批注与输入框草稿刷新后仍在;Continue 也会带上正在编辑的批注,只发一次,然后关页面。`,talkBlocksLabel:`块`,talkChars:`字符`,talkPlaceholder:`还想对 agent 说什么…`,talkSubmitHint:`Cmd/Ctrl+Enter 发送`,talkContinue:`继续`}};function Fe(e,t,n={}){return(Pe[e][t]??t).replace(/\{(\w+)\}/g,(e,t)=>String(n[t]??`{${t}}`))}var Ie=K(`<nav class=outline aria-label=Contents><div class=outline-bars></div><div class=outline-panel><div class=outline-head><span class=eyebrow>CONTENTS</span><span class=outline-count> </span></div><div class=outline-list>`),Le=K(`<span class=outline-bar>`),Re=K(`<button type=button class=outline-row><span class=outline-text>`),ze=K(`<button type=button class=back-to-top><svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 aria-hidden=true><path d="M12 19V5M6 11l6-6 6 6"></path></svg><span>Back to top`),Be=K(`<button type=button class="ghost close-page">`),Ve=K(`<div class="page page-closed"><main class=manual-close-notice role=status><div class=done><div class=done-title></div><div class=done-hint></div><div class=done-hint>`),He=K(`<textarea class=composer-input rows=1>`);function Ue(e,t){let n=[...new Set(t)].sort((e,t)=>e-t).indexOf(e);return n<0?0:Math.min(n,3)}var We=[16,13,10,8],Ge=24;function Ke(e,t,n=Ge){if(n<=0)return[];if(e.length<=n)return[...e];let r=e.findIndex(e=>e.blockId===t);if(n===1)return[e[r>=0?r:0]];let i=new Set;r>=0&&i.add(r),i.add(0);let a=n-i.size,o=a>1?(e.length-1)/(a-1):0;for(let t=0;t<a;t+=1)i.add(a===1?e.length-1:Math.round(t*o));return[...i].sort((e,t)=>e-t).map(t=>e[t]).filter(e=>e!==void 0)}var qe=140;function Je(){return window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?`auto`:`smooth`}function Ye(e){let[t,n]=y(!1),[r,i]=y(),a,o,s,c,l,u=S(()=>e.headings.map(e=>e.level)),d=S(()=>Ke(e.headings,r())),f=e=>Ue(e,u());function p(){a!==void 0&&clearTimeout(a),n(!0)}function m(){a!==void 0&&clearTimeout(a),a=setTimeout(()=>n(!1),200)}w(()=>{let t=()=>{let t;for(let n of e.headings){let e=document.getElementById(`block-${n.blockId}`);if(e){if(e.getBoundingClientRect().top<=qe)t=n.blockId;else break}}i(t)},n=()=>{c===void 0&&(c=requestAnimationFrame(()=>{c=void 0,t()}))};window.addEventListener(`scroll`,n,{passive:!0}),t(),T(()=>{window.removeEventListener(`scroll`,n),c!==void 0&&cancelAnimationFrame(c)})}),T(()=>{a!==void 0&&clearTimeout(a),o!==void 0&&clearTimeout(o),s?.classList.remove(`is-target`)}),x(()=>{let e=r(),t=l;if(!t||e===void 0)return;let n=d().findIndex(t=>t.blockId===e),i=t.children[n];if(!i)return;let a=t.getBoundingClientRect(),o=i.getBoundingClientRect();o.top<a.top?t.scrollTop-=a.top-o.top:o.bottom>a.bottom&&(t.scrollTop+=o.bottom-a.bottom)});function h(t){e.onJump?.(t),requestAnimationFrame(()=>{let e=document.getElementById(`block-${t}`);e&&(e.scrollIntoView({behavior:Je(),block:`start`}),s?.classList.remove(`is-target`),s=e,e.classList.add(`is-target`),o!==void 0&&clearTimeout(o),o=setTimeout(()=>{e.classList.remove(`is-target`),s===e&&(s=void 0)},1200),i(t),n(!1))})}return H(W,{get when(){return e.headings.length>0},get children(){var n=Ie(),i=n.firstChild,a=i.nextSibling,o=a.firstChild,s=o.firstChild.nextSibling,c=s.firstChild,u=o.nextSibling;return n.addEventListener(`mouseleave`,m),n.addEventListener(`mouseenter`,p),ge(e=>l=e,i),Y(i,H(U,{get each(){return d()},children:e=>(()=>{var t=Le();return b(n=>{var i=e.blockId===r(),a=`${We[f(e.level)]}px`;return i!==n.e&&t.classList.toggle(`is-active`,n.e=i),a!==n.t&&he(t,`width`,n.t=a),n},{e:void 0,t:void 0}),t})()})),Y(s,()=>e.headings.length,c),Y(s,()=>e.headings.length===1?`heading`:`headings`,null),Y(u,H(U,{get each(){return e.headings},children:e=>(()=>{var n=Re(),i=n.firstChild;return n.$$click=()=>h(e.blockId),Y(i,()=>e.text),b(i=>{var a=e.blockId===r(),o=`${10+f(e.level)*14}px`,s=t()?0:-1,c=e.text;return a!==i.e&&n.classList.toggle(`is-active`,i.e=a),o!==i.t&&he(n,`padding-left`,i.t=o),s!==i.a&&q(n,`tabindex`,i.a=s),c!==i.o&&q(n,`title`,i.o=c),i},{e:void 0,t:void 0,a:void 0,o:void 0}),n})()})),b(e=>{var r=!!t(),o=t(),s=!t();return r!==e.e&&n.classList.toggle(`is-open`,e.e=r),o!==e.t&&q(i,`aria-hidden`,e.t=o),s!==e.a&&q(a,`aria-hidden`,e.a=s),e},{e:void 0,t:void 0,a:void 0}),n}})}function Xe(){let[e,t]=y(!1);return w(()=>{let e=window.matchMedia(`(max-width: 1040px)`),n=document.querySelector(`.rail`),r,i=()=>t(window.scrollY>window.innerHeight*.8),a=()=>{if(r?.disconnect(),r=void 0,e.matches||!n){i();return}t(!1),r=new IntersectionObserver(e=>{let n=e.at(-1);n&&t(!n.isIntersecting&&n.boundingClientRect.bottom<=0)},{threshold:0}),r.observe(n)},o=()=>{(e.matches||!n)&&i()};a(),window.addEventListener(`scroll`,o,{passive:!0}),e.addEventListener(`change`,a),T(()=>{r?.disconnect(),window.removeEventListener(`scroll`,o),e.removeEventListener(`change`,a)})}),H(W,{get when(){return e()},get children(){var e=ze();return e.$$click=()=>{window.scrollTo({top:0,behavior:Je()})},e}})}function Ze(){w(()=>{let e=document.querySelector(`.footer`);if(!e)return;let t=()=>{document.documentElement.style.setProperty(`--footer-h`,`${e.getBoundingClientRect().height+18}px`)},n=new ResizeObserver(t);n.observe(e),t(),T(()=>n.disconnect())})}function Qe(e){let[t,n]=y(!1),r=t=>Fe(e.lang,t);async function i(){let t=!1;try{await Te(),t=!0}catch{}e.onClosed(t),window.close()}return(()=>{var e=Be();return e.$$click=()=>{t()||!window.confirm(r(`closePageConfirm`))||(n(!0),i())},Y(e,()=>r(`closePage`)),b(n=>{var i=t(),a=r(`closePageHint`);return i!==n.e&&(e.disabled=n.e=i),a!==n.t&&q(e,`title`,n.t=a),n},{e:void 0,t:void 0}),e})()}function $e(e){let t=t=>Fe(e.lang,t);return(()=>{var n=Ve(),r=n.firstChild.firstChild.firstChild,i=r.nextSibling,a=i.nextSibling;return Y(r,()=>t(`closePageDone`)),Y(i,(()=>{var n=G(()=>!!e.serverClosed);return()=>n()?t(`closePageServerClosed`):t(`closePageUnreachable`)})()),Y(a,()=>t(`closeHint`)),n})()}var et=220;function tt(e){let t=getComputedStyle(e),n=e=>Number.parseFloat(e)||0,r=Number.parseFloat(t.lineHeight),i=Number.parseFloat(t.fontSize),a=Number.isFinite(r)?r:i*1.5,o=n(t.borderTopWidth)+n(t.borderBottomWidth);return{oneLine:a+(n(t.paddingTop)+n(t.paddingBottom))+o,border:o}}function nt(e){let t,n=e=>{if(!t)return;let{oneLine:n,border:r}=tt(t),i=Math.min(window.innerHeight*.4,et);t.style.height=`auto`;let a=t.scrollHeight+r,o=e?Math.min(a,i):n;t.style.height=`${Math.max(o,n)}px`,t.style.overflowY=e&&a>i?`auto`:`hidden`};return w(()=>n(document.activeElement===t)),(()=>{var r=He();return r.$$keydown=t=>{(t.metaKey||t.ctrlKey)&&t.key===`Enter`&&(t.preventDefault(),e.onSubmit())},r.$$input=t=>{e.onInput(t.currentTarget.value),n(!0)},r.addEventListener(`blur`,()=>n(!1)),r.addEventListener(`focus`,()=>n(!0)),ge(e=>{t=e},r),b(t=>{var n=e.placeholder,i=e.disabled,a=e.placeholder,o=e.submitLabel;return n!==t.e&&q(r,`placeholder`,t.e=n),i!==t.t&&(r.disabled=t.t=i),a!==t.a&&q(r,`aria-label`,t.a=a),o!==t.o&&q(r,`title`,t.o=o),t},{e:void 0,t:void 0,a:void 0,o:void 0}),b(()=>r.value=e.value()),r})()}fe([`click`,`input`,`keydown`]);var rt=K(`<span class=readonly>`),it=K(`<div class=error>`),at=K(`<div class=banner><span></span><button class=link>`),ot=K(`<div class=done><div class=done-title></div><div class=done-hint>`),st=K(`<button class=add>+ `),ct=K(`<section id=global-notes class=global-card><div class=global-head><span class=eyebrow></span><span class=global-count>`),lt=K(`<p class=empty>`),ut=K(`<div class=collapsed><span></span><button class=link>`),dt=K(`<div class=rail-notes>`),ft=K(`<button class=ghost>`),pt=K(`<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">`),mt=K(`<span class=chip-changed>+`),ht=K(`<button class=chip><span class=chip-n>v`),gt=K(`<button class=remove>`),_t=K(`<div><span></span><span class=note-text>`),vt=K(`<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>`),yt=K(`<p class=rail-empty>`),bt=K(`<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>`),xt=K(`<div class=editor><div class=verdicts></div><textarea></textarea><div class=editor-actions><button class=ghost></button><button class=primary>`),St=K(`<label><input type=radio name=verdict>`);function Ct(e){let[t,n]=y(Me()),[r,i]=y(e.initial),[a,o]=y(),[s,c]=y(),[l,u]=y(e.initial.decided&&e.initial.decision?e.initial.decision.action:void 0),[d,f]=y(!1),[p,m]=y(),[h,g]=y(``),[_,v]=y(`change`),[C,E]=y(!1),[D,ee]=y(),O,k=(e,n)=>Fe(t(),e,n);Ze();async function A(e){try{let t=await Se(e);if(t.mode!==`spec`)return;i(t),c(void 0),u(t.decided&&t.decision?t.decision.action:void 0)}catch(e){c(e instanceof Error?e.message:String(e))}}w(()=>{O=ke({onRevision:()=>{a()===void 0&&A()},onAnnotations:()=>{a()===void 0&&A()},onDecided:e=>u(e.action)}),T(()=>{O?.(),O=void 0})}),x(()=>{let e=r()?.slug;document.title=e?`${k(`title`)} — ${e}`:k(`title`)});let j=S(()=>r()?.items??[]),M=e=>e.status??`unchanged`,N=S(()=>j().filter(e=>M(e)!==`unchanged`).length),P=S(()=>!d()&&N()>0),F=S(()=>P()?j().filter(e=>M(e)===`unchanged`).length:0),te=S(()=>P()?j().filter(e=>M(e)!==`unchanged`):j()),I=S(()=>r()?.history[0]?.n??r()?.version),L=S(()=>{let e=r();return e!==void 0&&e.version!==I()}),R=S(()=>{let e={unchanged:0,moved:0,modified:0,added:0,removed:0};for(let t of j())e[M(t)]+=1;return e}),ne=S(()=>[...r()?.history??[]].reverse()),z=S(()=>r()?.annotations.global??[]),B=S(()=>p()!==void 0&&p().blockId===void 0),re=S(()=>z().length>0||B()),ie=e=>r()?.annotations.blocks.find(t=>t.blockId===e)?.annotations??[],ae=S(()=>{let e=r()?.annotations;if(!e)return 0;let t=e.blocks.reduce((e,t)=>e+t.annotations.length,0);return e.global.length+t}),oe=S(()=>{let e=r();if(!e)return[];let t=new Map(e.items.map(e=>[e.id,e.label])),n=e.annotations.global.map((e,t)=>({key:`global-${t}`,label:k(`globalNotesTitle`),annotation:e}));for(let r of e.annotations.blocks){let e=t.get(r.blockId)??r.blockId;r.annotations.forEach((t,i)=>{n.push({key:`${r.blockId}-${i}`,blockId:r.blockId,label:e,annotation:t})})}return n});async function V(e){let t=r();if(!t)return;let n={...t,annotations:e};i(n);try{await Ee(t.version,e)}catch(e){c(e instanceof Error?e.message:String(e)),await A(t.version)}}async function se(e){let t=h().trim();if(t===``)return;let n=r();if(!n)return;let i={verdict:_(),comment:t},a;if(e===void 0)a={...n.annotations,global:[...n.annotations.global,i]};else{let t=n.annotations.blocks.slice(),r=t.findIndex(t=>t.blockId===e);r===-1?t.push({blockId:e,annotations:[i]}):t[r]={...t[r],annotations:[...t[r].annotations,i]},a={...n.annotations,blocks:t}}m(void 0),g(``),await V(a)}async function ce(e,t){let n=r();if(!n)return;let i;i=e===void 0?{...n.annotations,global:n.annotations.global.filter((e,n)=>n!==t)}:{...n.annotations,blocks:n.annotations.blocks.map(n=>n.blockId===e?{...n,annotations:n.annotations.filter((e,n)=>n!==t)}:n).filter(e=>e.annotations.length>0)},await V(i)}function le(){!L()&&!B()&&(m({blockId:void 0}),g(``),v(`change`)),requestAnimationFrame(()=>{document.getElementById(`global-notes`)?.scrollIntoView({behavior:`smooth`,block:`start`})})}function ue(){if(!L()){if(B()){m(void 0);return}le()}}function de(e){te().some(t=>t.id===e)||f(!0)}function K(e){let t=e.blockId;te().some(e=>e.id===t)||f(!0),requestAnimationFrame(()=>{document.getElementById(`block-${t}`)?.scrollIntoView({behavior:`smooth`,block:`center`})})}function fe(e){O?.(),O=void 0,ee(e)}async function pe(e){let t=r();if(t)try{await De(e,t.version),u(e),window.close(),setTimeout(()=>E(!0),300)}catch(e){c(e instanceof Error?e.message:String(e))}}let he=e=>`badge badge-${e}`,ge=e=>`verdict${e[0].toUpperCase()}${e.slice(1)}`,_e=e=>`note-verdict verdict-${e}`;return H(W,{get when(){return D()===void 0},get fallback(){return H($e,{get lang(){return t()},get serverClosed(){return D()===!0}})},get children(){var e=pt(),i=e.firstChild,c=i.firstChild,u=c.firstChild,y=u.firstChild.nextSibling,x=u.nextSibling,S=x.firstChild,w=c.nextSibling,T=w.firstChild,E=T.nextSibling,D=E.firstChild,ee=D.nextSibling.nextSibling,O=ee.nextSibling.nextSibling,P=w.nextSibling,V=P.firstChild,le=V.nextSibling,ve=i.nextSibling,X=ve.firstChild,Z=X.firstChild,ye=X.nextSibling.firstChild,be=ye.firstChild,Q=be.nextSibling,xe=Q.firstChild,$=xe.nextSibling.firstChild,Se=$.nextSibling,Ce=Q.nextSibling.firstChild,we=Ce.firstChild.nextSibling,Te=we.nextSibling,Ee=Ce.nextSibling,De=Ee.firstChild.nextSibling,Oe=De.nextSibling,ke=Ee.nextSibling,Ae=ke.firstChild.nextSibling,je=Ae.nextSibling,Me=ke.nextSibling.firstChild.nextSibling,Pe=Me.nextSibling,Fe=ye.nextSibling,Ie=Fe.firstChild.firstChild,Le=Ie.nextSibling,Re=ve.nextSibling.firstChild,ze=Re.firstChild,Be=ze.firstChild,Ve=Be.nextSibling;Ve.nextSibling;var He=Re.nextSibling,Ue=He.firstChild;Ue.firstChild;var We=He.nextSibling.firstChild,Ge=We.nextSibling,Ke=Ge.firstChild;return Y(y,()=>k(`title`)),S.$$click=()=>{let e=t()===`en`?`zh`:`en`;n(e),Ne(e)},Y(S,()=>t()===`en`?`中文`:`EN`),Y(x,H(Qe,{get lang(){return t()},onClosed:fe}),null),Y(T,()=>r()?.slug??`spec`),Y(D,()=>r()?.source??`specs/spec.md`),Y(ee,()=>k(`version`,{version:r()?.version??0,total:r()?.totalVersions??0})),Y(O,(()=>{var e=G(()=>N()>0);return()=>e()?k(N()===1?`changedOne`:`changed`,{count:N()}):k(`noChange`)})()),Y(E,H(W,{get when(){return L()},get children(){var e=rt();return Y(e,()=>k(`readOnly`)),e}}),null),Y(V,()=>k(`history`)),Y(P,H(U,{get each(){return ne()},children:e=>(()=>{var t=ht(),n=t.firstChild;return n.firstChild,t.$$click=()=>{e.n===I()?(o(void 0),A()):(o(e.n),A(e.n))},Y(n,()=>e.n,null),Y(t,H(W,{get when(){return e.changed>0},get children(){var t=mt();return t.firstChild,Y(t,()=>e.changed,null),t}}),null),b(()=>t.classList.toggle(`active`,e.n===r()?.version)),t})()}),le),Y(le,()=>k(j().length===1?`historySummaryOne`:`historySummary`,{count:j().length})),Y(e,H(W,{get when(){return s()},get children(){var e=it();return Y(e,()=>k(`error`,{message:s()??``})),e}}),ve),Y(X,H(W,{get when(){return L()},get children(){var e=at(),t=e.firstChild,n=t.nextSibling;return Y(t,()=>k(`viewingOld`,{v:a()??r()?.version??0})),n.$$click=()=>{o(void 0),A()},Y(n,()=>k(`back`)),e}}),Z),Y(X,H(W,{get when(){return l()},get children(){var e=ot(),t=e.firstChild,n=t.nextSibling;return Y(t,(()=>{var e=G(()=>l()===`approve`);return()=>e()?k(`approved`):k(`denied`)})()),Y(n,(()=>{var e=G(()=>!!C());return()=>e()?k(`closeHint`):k(`closing`)})()),e}}),Z),Y(X,H(W,{get when(){return re()},get children(){var e=ct(),t=e.firstChild,n=t.firstChild,r=n.nextSibling;return Y(n,()=>k(`globalNotesTitle`)),Y(r,()=>z().length),Y(t,H(W,{get when(){return G(()=>!L())()&&!B()},get children(){var e=st();return e.firstChild,e.$$click=()=>{m({blockId:void 0}),g(``),v(`change`)},Y(e,()=>k(`addNote`),null),e}}),null),Y(e,H(U,{get each(){return z()},children:(e,t)=>(()=>{var n=_t(),r=n.firstChild,i=r.nextSibling;return Y(r,()=>k(ge(e.verdict))),Y(i,()=>e.comment),Y(n,H(W,{get when(){return!L()},get children(){var e=gt();return e.$$click=()=>void ce(void 0,t()),Y(e,()=>k(`remove`)),e}}),null),b(t=>{var i=`note note-${e.verdict}`,a=_e(e.verdict);return i!==t.e&&J(n,t.e=i),a!==t.t&&J(r,t.t=a),t},{e:void 0,t:void 0}),n})()}),null),Y(e,H(W,{get when(){return G(()=>!!B())()&&!L()},get children(){return H(wt,{draft:h,setDraft:g,verdict:_,setVerdict:v,onSave:()=>void se(void 0),onCancel:()=>m(void 0),t:k})}}),null),e}}),Z),Y(X,H(W,{get when(){return G(()=>!!r())()&&r().items.length===0},get children(){var e=lt();return Y(e,()=>k(`emptySpec`)),e}}),Z),Y(X,H(W,{get when(){return F()>0},get children(){var e=ut(),t=e.firstChild,n=t.nextSibling;return Y(t,()=>k(F()===1?`unchangedHiddenOne`:`unchangedHidden`,{count:F()})),n.$$click=()=>f(!0),Y(n,()=>k(`showAll`)),e}}),Z),Y(Z,H(U,{get each(){return te()},children:e=>(()=>{var t=vt(),n=t.firstChild,r=n.nextSibling,i=r.firstChild,a=i.firstChild,o=a.firstChild,s=a.nextSibling,c=i.nextSibling;return Y(a,()=>k(`status_${M(e)}`),null),Y(s,()=>e.id),Y(i,H(W,{get when(){return!L()},get children(){var t=st();return t.firstChild,t.$$click=()=>{m({blockId:e.id}),g(``),v(`change`)},Y(t,()=>k(`addNote`),null),t}}),null),Y(r,H(U,{get each(){return ie(e.id)},children:(t,n)=>(()=>{var r=_t(),i=r.firstChild,a=i.nextSibling;return Y(i,()=>k(ge(t.verdict))),Y(a,()=>t.comment),Y(r,H(W,{get when(){return!L()},get children(){var t=gt();return t.$$click=()=>void ce(e.id,n()),Y(t,()=>k(`remove`)),t}}),null),b(e=>{var n=`note note-${t.verdict}`,a=_e(t.verdict);return n!==e.e&&J(r,e.e=n),a!==e.t&&J(i,e.t=a),e},{e:void 0,t:void 0}),r})()}),null),Y(r,H(W,{get when(){return G(()=>p()?.blockId===e.id)()&&!L()},get children(){return H(wt,{draft:h,setDraft:g,verdict:_,setVerdict:v,onSave:()=>void se(e.id),onCancel:()=>m(void 0),t:k})}}),null),b(r=>{var i=`block-${e.id}`,s={[`is-`+M(e)]:!0},l=`block-bar bar-${M(e)}`,u=he(M(e)),d=`dot dot-${M(e)}`,f=e.html;return i!==r.e&&q(t,`id`,r.e=i),r.t=me(t,s,r.t),l!==r.a&&J(n,r.a=l),u!==r.o&&J(a,r.o=u),d!==r.i&&J(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})()})),Y(be,()=>k(`thisRevision`)),Y(xe,N),Y($,()=>k(`blocksChanged`)),Y(Se,()=>k(`ofTotal`,{total:j().length})),Y(we,()=>k(`status_added`)),Y(Te,()=>R().added),Y(De,()=>k(`status_modified`)),Y(Oe,()=>R().modified),Y(Ae,()=>k(`status_moved`)),Y(je,()=>R().moved),Y(Me,()=>k(`status_removed`)),Y(Pe,()=>R().removed),Y(Ie,()=>k(`annotations`)),Y(Le,ae),Y(Fe,H(W,{get when(){return oe().length>0},get fallback(){return(()=>{var e=yt();return Y(e,()=>k(`noNotesYet`)),e})()},get children(){var e=dt();return Y(e,H(U,{get each(){return oe()},children:e=>(()=>{var t=bt(),n=t.firstChild,r=n.nextSibling.firstChild,i=r.nextSibling;return t.$$click=()=>K(e),Y(r,()=>e.label),Y(i,()=>e.annotation.comment),b(()=>J(n,`dot dot-${e.annotation.verdict}`)),t})()})),e}}),null),Y(Re,H(W,{get when(){return N()>0},get children(){var e=ft();return e.$$click=()=>f(!d()),Y(e,(()=>{var e=G(()=>!!d());return()=>e()?k(`onlyChanged`):k(`showAll`)})()),e}}),ze),ze.$$click=ue,Y(ze,()=>k(`globalNotes`),Be),Y(ze,()=>z().length,Ve),Y(Ue,()=>k(ae()===1?`noteCountOne`:`noteCount`,{count:ae()}),null),We.$$click=()=>void pe(`deny`),Y(We,()=>k(`deny`)),Ge.$$click=()=>void pe(`approve`),Y(Ke,()=>k(`approve`)),Y(e,H(Ye,{get headings(){return r()?.headings??[]},onJump:de}),null),Y(e,H(Xe,{}),null),b(e=>{var t=L(),n=L()||l()!==void 0,r=L()||l()!==void 0;return t!==e.e&&(ze.disabled=e.e=t),n!==e.t&&(We.disabled=e.t=n),r!==e.a&&(Ge.disabled=e.a=r),e},{e:void 0,t:void 0,a:void 0}),e}})}function wt(e){return(()=>{var t=xt(),n=t.firstChild,r=n.nextSibling,i=r.nextSibling.firstChild,a=i.nextSibling;return Y(n,H(U,{each:[`change`,`suggest`,`question`],children:t=>(()=>{var n=St(),r=n.firstChild;return r.addEventListener(`change`,()=>e.setVerdict(t)),Y(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),pe(i,`click`,e.onCancel,!0),Y(i,()=>e.t(`cancel`)),pe(a,`click`,e.onSave,!0),Y(a,()=>e.t(`save`)),b(t=>{var n=e.t(`notePlaceholder`),i=e.draft().trim()===``;return n!==t.e&&q(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})()}fe([`click`,`input`]);var Tt=K(`<span class=readonly>`),Et=K(`<div class=error>`),Dt=K(`<div class=done><div class=done-title></div><div class=done-hint>`),Ot=K(`<p class=empty>`),kt=K(`<div class=rail-notes>`),At=K(`<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><title>Reply notes</title><path d="M4 5h16M4 11h16M4 17h9"></path></svg></span><span class=eyebrow></span></div><div class=top-actions><button type=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></header><div class=layout><main class=reading><div class=blocks></div></main><aside class=rail><section class=rail-card><span class=eyebrow></span><p class=rail-hint></p><div class=rail-breakdown><div class=rail-row><span></span><b></b></div><div class=rail-row><span></span><b></b></div><div class=rail-row><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 footer-talk"><div class=footer-center><span class=notes-count><span class="dot dot-brand"aria-hidden=true></span></span></div><div class=footer-composer></div><div class=footer-actions><button type=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">`),jt=K(`<button type=button class=add>`),Mt=K(`<div class=block-head><span class=block-id>`),Nt=K(`<button type=button class=remove>`),Pt=K(`<div class="note note-talk"><span class="note-verdict verdict-talk"></span><span class=note-text>`),Ft=K(`<div class=editor><textarea class=note-input></textarea><div class=editor-actions><button type=button class=ghost></button><button type=button class=primary>`),It=K(`<article class="block block-talk"><div class="block-bar bar-talk"aria-hidden=true></div><div class=block-inner><div class=block-body>`),Lt=K(`<p class=rail-empty>`),Rt=K(`<button type=button class=rail-note><span class="dot dot-brand"aria-hidden=true></span><span class=rail-note-body><span class=rail-note-label></span><span class=rail-note-text>`),zt=300;function Bt(e){let[t,n]=y(Me()),[r,i]=y(e.initial),[a,o]=y(e.initial.notes),[s,c]=y(e.initial.draft),[l,u]=y(e.initial.sent),[d,f]=y(!1),[p,m]=y(),[h,g]=y(``),[_,v]=y(),[C,E]=y(!1),[D,ee]=y(),O,k,A=(e,n)=>Fe(t(),e,n);Ze();let j=S(()=>r().items),M=S(()=>l()||d()),N=S(()=>Object.values(a()).filter(e=>e.trim()!==``).length),P=S(()=>j().map(e=>({id:e.id,label:e.label,text:a()[e.id]??``})).filter(e=>e.text.trim()!==``)),F=S(()=>{let e=r().reply.at,t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}),te=S(()=>{let e=r().title?.trim();return e!==void 0&&e!==``?e:A(`talkUntitled`)});async function I(){try{let e=await Se();if(e.mode!==`talk`)return;i(e),o(e.notes),c(e.draft),u(e.sent),m(void 0),g(``),v(void 0)}catch(e){v(e instanceof Error?e.message:String(e))}}w(()=>{O=ke({onRevision:()=>void I(),onAnnotations:()=>void I(),onDecided:()=>void 0,onRefresh:()=>void I(),onSent:()=>u(!0)}),T(()=>{O?.(),O=void 0,k!==void 0&&clearTimeout(k)})}),x(()=>{document.title=te()});function L(e){O?.(),O=void 0,k!==void 0&&(clearTimeout(k),k=void 0),ee(e)}function R(e,t){k!==void 0&&clearTimeout(k),k=setTimeout(()=>{k=void 0,Ce(e,t).catch(e=>{l()||v(e instanceof Error?e.message:String(e))})},zt)}function ne(e,t){let n={...a()};t.trim()===``?delete n[e]:n[e]=t,o(n),R(n,s())}function z(e){let t={...a()};delete t[e],o(t),p()===e&&m(void 0),R(t,s())}function B(e){c(e),R(a(),e)}function re(){let e={...a()},t=p();return t!==void 0&&(h().trim()===``?delete e[t]:e[t]=h()),e}async function ie(){if(M())return;let e=re();if(!Object.values(e).some(e=>e.trim()!==``)&&s().trim()===``){v(A(`talkNothingToSend`));return}o(e),k!==void 0&&(clearTimeout(k),k=void 0),f(!0);try{await we(e,s()),u(!0),f(!1),v(void 0),window.close(),setTimeout(()=>E(!0),300)}catch(e){f(!1),v(e instanceof Error?e.message:String(e))}}function ae(e){requestAnimationFrame(()=>{document.getElementById(`block-${e}`)?.scrollIntoView({behavior:Je(),block:`center`})})}return H(W,{get when(){return D()===void 0},get fallback(){return H($e,{get lang(){return t()},get serverClosed(){return D()===!0}})},get children(){var e=At(),i=e.firstChild,o=i.firstChild,c=o.firstChild,u=c.firstChild.nextSibling,d=c.nextSibling,f=d.firstChild,v=o.nextSibling.firstChild,y=v.nextSibling,x=y.firstChild,S=x.nextSibling.nextSibling,w=S.nextSibling.nextSibling,T=i.nextSibling,E=T.firstChild,D=E.firstChild,ee=E.nextSibling.firstChild,O=ee.firstChild,k=O.nextSibling,I=k.nextSibling.firstChild,R=I.firstChild,re=R.nextSibling,oe=I.nextSibling,V=oe.firstChild,se=V.nextSibling,ce=oe.nextSibling.firstChild,le=ce.nextSibling,ue=ee.nextSibling,de=ue.firstChild.firstChild,K=de.nextSibling,fe=T.nextSibling.firstChild,J=fe.firstChild;J.firstChild;var pe=fe.nextSibling,me=pe.nextSibling.firstChild,he=me.firstChild;return Y(u,()=>A(`talkTitle`)),f.$$click=()=>{let e=t()===`en`?`zh`:`en`;n(e),Ne(e)},Y(f,()=>t()===`en`?`中文`:`EN`),Y(d,H(Qe,{get lang(){return t()},onClosed:L}),null),Y(v,te),Y(x,F),Y(S,()=>r().reply.model??`—`),Y(w,()=>A(j().length===1?`talkBlocksOne`:`talkBlocks`,{count:j().length})),Y(y,H(W,{get when(){return l()},get children(){var e=Tt();return Y(e,()=>A(`talkSentBadge`)),e}}),null),Y(e,H(W,{get when(){return _()},get children(){var e=Et();return Y(e,()=>A(`error`,{message:_()??``})),e}}),T),Y(E,H(W,{get when(){return l()},get children(){var e=Dt(),t=e.firstChild,n=t.nextSibling;return Y(t,()=>A(`talkSentTitle`)),Y(n,(()=>{var e=G(()=>!!C());return()=>e()?A(`closeHint`):A(`closing`)})()),e}}),D),Y(E,H(W,{get when(){return j().length===0},get children(){var e=Ot();return Y(e,()=>A(`emptySpec`)),e}}),D),Y(D,H(U,{get each(){return j()},children:e=>(()=>{var t=It(),n=t.firstChild.nextSibling,r=n.firstChild;return Y(n,H(W,{get when(){return e.kind!==`heading`},get children(){var t=Mt(),n=t.firstChild;return Y(n,()=>e.id),Y(t,H(W,{get when(){return!M()},get children(){var t=jt();return t.$$click=()=>{if(p()===e.id){m(void 0);return}m(e.id),g(a()[e.id]??``)},Y(t,(()=>{var t=G(()=>!!a()[e.id]);return()=>t()?A(`editNote`):`+ ${A(`addNote`)}`})()),t}}),null),t}}),r),Y(n,H(W,{get when(){return a()[e.id]},get children(){var t=Pt(),n=t.firstChild,r=n.nextSibling;return Y(n,()=>A(`yourNote`)),Y(r,()=>a()[e.id]),Y(t,H(W,{get when(){return!M()},get children(){var t=Nt();return t.$$click=()=>z(e.id),Y(t,()=>A(`remove`)),t}}),null),t}}),null),Y(n,H(W,{get when(){return G(()=>p()===e.id)()&&!M()},get children(){var t=Ft(),n=t.firstChild,r=n.nextSibling.firstChild,i=r.nextSibling;return n.$$keydown=t=>{(t.metaKey||t.ctrlKey)&&t.key===`Enter`&&(t.preventDefault(),ne(e.id,h()),m(void 0))},n.$$input=e=>g(e.currentTarget.value),r.$$click=()=>m(void 0),Y(r,()=>A(`cancel`)),i.$$click=()=>{ne(e.id,h()),m(void 0)},Y(i,()=>A(`save`)),b(e=>{var t=A(`talkNotePlaceholder`),r=h().trim()===``;return t!==e.e&&q(n,`placeholder`,e.e=t),r!==e.t&&(i.disabled=e.t=r),e},{e:void 0,t:void 0}),b(()=>n.value=h()),t}}),null),b(n=>{var i=`block-${e.id}`,a=e.html;return i!==n.e&&q(t,`id`,n.e=i),a!==n.t&&(r.innerHTML=n.t=a),n},{e:void 0,t:void 0}),t})()})),Y(O,()=>A(`talkAbout`)),Y(k,()=>A(`talkAboutBody`)),Y(R,()=>A(`talkBlocksLabel`)),Y(re,()=>j().length),Y(V,()=>A(`annotations`)),Y(se,N),Y(ce,()=>A(`talkChars`)),Y(le,()=>r().reply.chars),Y(de,()=>A(`annotations`)),Y(K,N),Y(ue,H(W,{get when(){return P().length>0},get fallback(){return(()=>{var e=Lt();return Y(e,()=>A(`noNotesYet`)),e})()},get children(){var e=kt();return Y(e,H(U,{get each(){return P()},children:e=>(()=>{var t=Rt(),n=t.firstChild.nextSibling.firstChild,r=n.nextSibling;return t.$$click=()=>ae(e.id),Y(n,()=>e.label),Y(r,()=>e.text),t})()})),e}}),null),Y(J,()=>A(N()===1?`noteCountOne`:`noteCount`,{count:N()}),null),Y(pe,H(nt,{value:s,onInput:B,onSubmit:()=>void ie(),get placeholder(){return A(`talkPlaceholder`)},get submitLabel(){return A(`talkSubmitHint`)},get disabled(){return M()}})),me.$$click=()=>void ie(),Y(he,()=>A(`talkContinue`)),Y(e,H(Ye,{get headings(){return r().headings}}),null),Y(e,H(Xe,{}),null),b(()=>me.disabled=M()),e}})}fe([`click`,`input`,`keydown`]);var Vt=K(`<div class=page><p class=empty>`);function Ht(){let[e,t]=y(),[n,r]=y();return w(()=>{Se().then(e=>t(e)).catch(e=>r(e instanceof Error?e.message:String(e)))}),H(W,{get when(){return e()},get fallback(){return(()=>{var e=Vt(),t=e.firstChild;return Y(t,()=>n()??`Loading…`),e})()},children:e=>H(W,{get when(){return e().mode===`talk`},get fallback(){return H(Ct,{get initial(){return e()}})},get children(){return H(Bt,{get initial(){return e()}})}})})}var Ut=document.getElementById(`root`);Ut&&de(()=>H(Ht,{}),Ut);
@@ -5,8 +5,8 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1" />
6
6
  <meta name="robots" content="noindex" />
7
7
  <title>Spec review</title>
8
- <script type="module" crossorigin src="/index-DYxi32gA.js"></script>
9
- <link rel="stylesheet" crossorigin href="/index-CrDwcsqI.css">
8
+ <script type="module" crossorigin src="/index-XxrDCe96.js"></script>
9
+ <link rel="stylesheet" crossorigin href="/index-DPWL_ipb.css">
10
10
  </head>
11
11
  <body>
12
12
  <div id="root"></div>