@erdemtuna/doc-review 0.8.1 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +112 -22
- package/package.json +4 -2
- package/src/SKILL.md +28 -4
- package/src/chrome-client.js +844 -103
- package/src/chrome.css +253 -8
- package/src/chrome.html +78 -11
- package/src/cli.js +4 -0
- package/src/comment-target.js +87 -0
- package/src/comparison-view.js +337 -0
- package/src/document-execution.js +103 -0
- package/src/document-trust.js +2 -0
- package/src/execution-client.js +63 -0
- package/src/frame-policy.js +38 -0
- package/src/history-client.js +104 -0
- package/src/history-coordinator.js +186 -0
- package/src/history-policy.js +43 -0
- package/src/history-server.js +463 -0
- package/src/paths.js +1 -1
- package/src/review-mode.js +1 -1
- package/src/revision-diff.js +440 -0
- package/src/revision-schema.js +219 -0
- package/src/revision-store.js +177 -0
- package/src/sdk.js +419 -55
- package/src/semantic-snapshot.js +230 -0
- package/src/server.js +217 -49
- package/src/state.js +240 -15
- package/src/view-identity.js +99 -0
package/README.md
CHANGED
|
@@ -65,7 +65,7 @@ Review a page running on localhost:
|
|
|
65
65
|
/doc-review (localhost URL)
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
-
Doc Review opens in **View**
|
|
68
|
+
Doc Review opens in **Review**, with **View** selected, so you can read, use page controls, and comment. Switch to **Edit** to change content directly. Plain HTML saves edits to the file; scripted HTML, Markdown, and localhost pages send edits to your agent. Commenting stays available in both modes.
|
|
69
69
|
|
|
70
70
|
Select text, or hover or focus an element, then use the nearby comment icon. `Ctrl+Alt+M` (`Cmd+Option+M` on macOS) opens a comment for the current selection. Press Enter to submit or Shift+Enter for a new line. On desktop the composer stays beside its target, or pins to the effective top or bottom scrolling edge when that target leaves view. **Back to selection** reveals the target without changing the draft. The full-width sheet is used only at the narrow responsive breakpoint.
|
|
71
71
|
|
|
@@ -73,23 +73,42 @@ Select text, or hover or focus an element, then use the nearby comment icon. `Ct
|
|
|
73
73
|
|
|
74
74
|
Aligned cards show **Edit**, **Close**, and **More**; drawer cards show **Jump to**, **Edit**, and **More**. Delete lives only in **More** and requires an inline confirmation. Quote hints preserve both the beginning and ending of long selections. Editing has explicit **Save** and **Cancel** controls: Enter saves, Shift+Enter adds a line, Escape cancels, and moving focus never autosaves. A draft follows its comment between aligned and drawer cards and keeps its caret through target movement.
|
|
75
75
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
76
|
+
### Files and page interactions
|
|
77
|
+
|
|
78
|
+
Self-contained HTML runs its inline scripts and event handlers automatically.
|
|
79
|
+
There is no approval switch or renewed approval after an agent updates the file.
|
|
80
|
+
Plain HTML, including ordinary JSON data blocks and escaped code examples, keeps
|
|
81
|
+
direct autosave and Revert. Scripted HTML is **feedback-only**: your edits are sent
|
|
82
|
+
to the agent to apply to the original source, rather than writing script-generated
|
|
83
|
+
DOM into the file. The renderer re-evaluates that distinction when the source changes.
|
|
84
|
+
Markdown and localhost also remain feedback-only.
|
|
85
|
+
|
|
86
|
+
If a scripted page is broken, **More > Reload without scripts** provides a
|
|
87
|
+
temporary recovery mode. **Use page interactions** restores automatic behavior.
|
|
88
|
+
That preference belongs to this page in this review session, not to a saved
|
|
89
|
+
approval record. Disabling scripts does not make a scripted file's preview
|
|
90
|
+
edits writable. A changed preference takes effect when the frame is replaced;
|
|
91
|
+
reload handling preserves comment drafts and reports genuine source conflicts.
|
|
92
|
+
|
|
93
|
+
The supported interactive-file mode is for self-contained documents. Separate
|
|
94
|
+
script files, application imports, workers, and embedded applications are not
|
|
95
|
+
made compatible by this change. Use the existing localhost review route for
|
|
96
|
+
application workflows. Dependency limitations appear in contextual details,
|
|
97
|
+
not as a permission task or text inserted into the authored document.
|
|
98
|
+
|
|
99
|
+
Files retain an opaque iframe origin. The parent owns API authentication and
|
|
100
|
+
checks the frame identity for messages and writes. Authored code shares the
|
|
101
|
+
document with the SDK, so frame correlation is not proof of human authorship.
|
|
102
|
+
Relative assets stay scoped to the reviewed file. Localhost reviews retain their
|
|
103
|
+
existing nonopaque artifact origin, popup, and download behavior; they are fetched
|
|
104
|
+
and rewritten by the review server, not guaranteed to reproduce the application's
|
|
105
|
+
original cookies, storage, or origin-sensitive requests.
|
|
106
|
+
|
|
107
|
+
**Compatibility:** the old per-version `/trust` API is retired and returns 410.
|
|
108
|
+
Existing decision files are left unused. The CLI does not reuse background
|
|
109
|
+
servers with the previous protocol. Writable HTML save and revert requests must
|
|
110
|
+
identify their current served frame and source hash so delayed edits cannot
|
|
111
|
+
overwrite a newer file.
|
|
93
112
|
|
|
94
113
|
Agent polling returns an immutable `batch_id`. After applying the batch, the
|
|
95
114
|
agent acknowledges that exact receipt and keeps waiting:
|
|
@@ -101,6 +120,77 @@ npx -y @erdemtuna/doc-review poll path/to/file.html --ack b_0123456789abcdef --t
|
|
|
101
120
|
A stale or repeated batch ID is harmless: it never clears newer feedback. The
|
|
102
121
|
complete acknowledgement command is included in each response's `next_step`.
|
|
103
122
|
|
|
123
|
+
### Review and Changes
|
|
124
|
+
|
|
125
|
+
**Review** keeps the document interactive. **Changes** shows a selected review
|
|
126
|
+
round, with round selection and comparison navigation instead of live-page controls.
|
|
127
|
+
The default comparison is the content captured when feedback was sent against
|
|
128
|
+
the result captured after the agent acknowledged that exact batch. Previous
|
|
129
|
+
rounds retain their own fixed endpoints rather than changing on every reload.
|
|
130
|
+
|
|
131
|
+
Content comparisons use a continuous aligned before/after reading surface with
|
|
132
|
+
expandable unchanged context. Source comparisons use line-numbered source hunks.
|
|
133
|
+
At narrow widths, a unified view retains each change's before/after attribution.
|
|
134
|
+
Content comparisons cover text, structure, formatting, links, and image
|
|
135
|
+
references. File-backed reviews also retain source for a source comparison.
|
|
136
|
+
Deleted passages remain readable even when there is no current element to jump
|
|
137
|
+
to, and uncertain matches do not pretend to identify an exact current target.
|
|
138
|
+
These are changes observed during a round, not proof of agent authorship or that
|
|
139
|
+
every comment was resolved.
|
|
140
|
+
|
|
141
|
+
History works in the normal browser for HTML, Markdown, and localhost pages.
|
|
142
|
+
It does not use screenshots, a browser extension, or automatic Git commits.
|
|
143
|
+
Live history captures the reviewed page's available content, not every possible
|
|
144
|
+
application state. Changes to image bytes at an unchanged URL, canvas pixels,
|
|
145
|
+
external stylesheet appearance, and inaccessible embedded content are outside
|
|
146
|
+
the comparison guarantee.
|
|
147
|
+
|
|
148
|
+
Send waits for edit persistence and writable HTML saves, then makes a short
|
|
149
|
+
best-effort baseline capture. Missing comparison data does not require a second
|
|
150
|
+
decision or prevent feedback from being sent. Available snapshots are retained;
|
|
151
|
+
inactive pages can have incomplete Content coverage. A last-visited live page is
|
|
152
|
+
never described as a fresh Send-time snapshot. Actual save or delivery failures
|
|
153
|
+
are reported without discarding your feedback.
|
|
154
|
+
|
|
155
|
+
When an active tab has reliable authored tab/panel identifiers, Content capture
|
|
156
|
+
records that visible view. A result on a different tab remains pending and asks
|
|
157
|
+
you to return to the original tab. Returning retries capture without clicking
|
|
158
|
+
through other tabs automatically. Unknown views and older snapshots are labelled
|
|
159
|
+
as visible-content comparisons whose matching view is unverified. This does not
|
|
160
|
+
capture all hidden panels or every application state. File Source comparison
|
|
161
|
+
still covers the whole file independently.
|
|
162
|
+
|
|
163
|
+
After acknowledgement, file-source results are captured independently of the
|
|
164
|
+
browser. Content results are captured when the appropriate reviewed page is
|
|
165
|
+
ready. These observations can have different timestamps; neither timestamp
|
|
166
|
+
claims that the document was captured at the instant of acknowledgement.
|
|
167
|
+
Background capture does not disable document interaction and retries transient
|
|
168
|
+
failures a bounded number of times. An unchanged file does not need a new reload
|
|
169
|
+
solely to capture an acknowledged result. Available Source remains readable
|
|
170
|
+
while Content is pending. Contextual retry or return-to-view actions handle
|
|
171
|
+
remaining failures; a continuously changing page may still have no stable Content
|
|
172
|
+
snapshot. Permanent finalization is optional in capture details, not a prerequisite
|
|
173
|
+
for reading the comparison. Failed or limited captures are not reported as zero
|
|
174
|
+
changes, and handled feedback remains archived even when history is unavailable.
|
|
175
|
+
|
|
176
|
+
Snapshots stay in the local Doc Review state directory. The latest five
|
|
177
|
+
completed rounds are retained automatically, while active rounds, pending
|
|
178
|
+
captures, and unsent feedback protect their referenced revisions. History starts
|
|
179
|
+
with this capability; earlier documents cannot be reconstructed from old
|
|
180
|
+
feedback receipts. Review snapshots can contain document content, so treat the
|
|
181
|
+
state directory as private.
|
|
182
|
+
Unreferenced snapshot files are collected at startup and during periodic
|
|
183
|
+
maintenance, with a one-hour grace period protecting interrupted publications.
|
|
184
|
+
Capture and comparison limits fail explicitly rather than publishing truncated
|
|
185
|
+
content as a complete comparison.
|
|
186
|
+
|
|
187
|
+
Default capture limits are 8 MiB of file source and 4 MiB of normalized content,
|
|
188
|
+
with at most 2,000 semantic blocks and 1,000,000 text characters. A single block
|
|
189
|
+
is limited to 100,000 characters. Comparisons have independent size, token, and
|
|
190
|
+
edit-work limits, including a 1,000,000-character budget and a 250 ms processing
|
|
191
|
+
budget. A stored snapshot can therefore exceed comparison limits; the UI reports
|
|
192
|
+
that limitation rather than claiming there were no changes.
|
|
193
|
+
|
|
104
194
|
### Feedback reliability and limits
|
|
105
195
|
|
|
106
196
|
`poll` without `--timeout` waits for at most 12 hours. Explicit timeouts include
|
|
@@ -115,14 +205,14 @@ The agent must not use partial text or HTML as a complete replacement or invent
|
|
|
115
205
|
the rest. It must obtain the full edit from an authoritative source or ask you
|
|
116
206
|
for it before acknowledging the batch.
|
|
117
207
|
|
|
118
|
-
External writes to
|
|
208
|
+
External writes to an HTML or Markdown source refresh its rendered baseline without
|
|
119
209
|
clearing unsent feedback. That preserves your edits; it does not automatically
|
|
120
210
|
resolve conflicts with the changed source. HTML autosaves keep their existing
|
|
121
211
|
behavior.
|
|
122
212
|
|
|
123
|
-
### Upgrading from
|
|
213
|
+
### Upgrading from servers using protocol 14 or earlier
|
|
124
214
|
|
|
125
|
-
The updated CLI requires server protocol
|
|
215
|
+
The updated CLI requires server protocol 15. An older server that is still
|
|
126
216
|
running is not silently reused or forcibly replaced. End active reviews and
|
|
127
217
|
shut down that specific old server (or let it exit when idle) before restarting
|
|
128
218
|
Doc Review. Keep the `.doc-review` state directory: pending batches and their
|
|
@@ -159,7 +249,7 @@ Doc Review works well for editing AI-generated plans, updating landing pages, re
|
|
|
159
249
|
- [`SKILL.md`](src/SKILL.md) teaches Claude Code, Codex, and other agents how to use Doc Review.
|
|
160
250
|
|
|
161
251
|
Everything runs on your computer. Doc Review doesn’t require an account, cloud service, database, or API key.
|
|
162
|
-
Comment geometry remains local, transient presentation data and is never written to review state or sent to the agent. After the agent acknowledges the exact delivered `batch_id`, the comments carried by that batch
|
|
252
|
+
Comment geometry remains local, transient presentation data and is never written to review state or sent to the agent. After the agent acknowledges the exact delivered `batch_id`, the comments carried by that batch leave the active feedback inventory; their round archive remains, and newer comments and corrections stay active.
|
|
163
253
|
|
|
164
254
|
## Upstream project
|
|
165
255
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@erdemtuna/doc-review",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Review and edit agent-generated files and localhost pages in the browser, then send the whole batch back to your agent.",
|
|
5
5
|
"author": "Peter Yang",
|
|
6
6
|
"homepage": "https://github.com/erdemtuna/doc-review#readme",
|
|
@@ -53,6 +53,8 @@
|
|
|
53
53
|
"lucide-static": "^1.34.0"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"
|
|
56
|
+
"diff": "^9.0.0",
|
|
57
|
+
"marked": "^18.0.7",
|
|
58
|
+
"parse5": "^8.0.1"
|
|
57
59
|
}
|
|
58
60
|
}
|
package/src/SKILL.md
CHANGED
|
@@ -18,10 +18,19 @@ end it; stop if they cancel or switch to a different task.
|
|
|
18
18
|
|
|
19
19
|
## Review behavior
|
|
20
20
|
|
|
21
|
-
The user reviews your HTML, Markdown, or localhost page in a real browser. It starts in View
|
|
22
|
-
|
|
21
|
+
The user reviews your HTML, Markdown, or localhost page in a real browser. It starts in View.
|
|
22
|
+
Native page controls work; supported self-contained HTML scripts run automatically.
|
|
23
|
+
They can switch to Edit, comment explicitly in either mode,
|
|
23
24
|
and send the whole batch at once.
|
|
24
25
|
|
|
26
|
+
Plain HTML retains direct autosave. Scripted HTML edits are feedback-only:
|
|
27
|
+
apply them to the original source, never serialize the script-modified runtime
|
|
28
|
+
page over the file. Source changes do not require renewed approval.
|
|
29
|
+
Reload without scripts is a temporary recovery option, not permission to write
|
|
30
|
+
a scripted preview over its source. Reloads can wait for unresolved editing work.
|
|
31
|
+
Applications requiring external script dependencies should use localhost review;
|
|
32
|
+
automatic inline execution does not add support for application imports or workers.
|
|
33
|
+
|
|
25
34
|
Markdown files open rendered. Their quotes and edits reference the rendered text,
|
|
26
35
|
and the file itself is never touched — apply every change to the Markdown source,
|
|
27
36
|
keeping its formatting syntax.
|
|
@@ -96,6 +105,17 @@ carried; newer comments and corrections survive.
|
|
|
96
105
|
The response's `next_step` contains the complete acknowledgement command.
|
|
97
106
|
Never acknowledge a different or guessed ID.
|
|
98
107
|
|
|
108
|
+
Acknowledgement means that you handled the feedback; it is separate from
|
|
109
|
+
browser result-capture readiness. Do not wait for history capture before
|
|
110
|
+
acknowledging completed work, and do not acknowledge merely because a page
|
|
111
|
+
looks stable. The browser captures round results automatically when possible.
|
|
112
|
+
Missing comparison data does not prevent the user from sending feedback.
|
|
113
|
+
Captured differences are observations, not proof that you alone authored them.
|
|
114
|
+
Content results may wait for the same identifiable tab as the baseline.
|
|
115
|
+
The user sees a return-to-tab prompt; do not automate tab clicking to force
|
|
116
|
+
capture. Source comparison remains independent. Unknown view identity is
|
|
117
|
+
labelled unverified, not asserted as a whole-application comparison.
|
|
118
|
+
|
|
99
119
|
Repeat 3–4 until the user says they are done.
|
|
100
120
|
|
|
101
121
|
Not sure whether feedback is already waiting — say, at the start of a new turn?
|
|
@@ -173,8 +193,12 @@ One batch covers every page the user visited, grouped by file or localhost URL.
|
|
|
173
193
|
- Find each comment by its `quote`; that exact string is in the file.
|
|
174
194
|
- `kind: "element"` points at a whole block, so `quote` is its label, not body text.
|
|
175
195
|
- Fix every page in `pages`, not just the first.
|
|
176
|
-
- **Do not write a reply.** There is no chat. The user sees
|
|
177
|
-
|
|
196
|
+
- **Do not write a reply.** There is no chat. The user sees the updated page and
|
|
197
|
+
can choose Changes for a fixed Send-to-result comparison. Reload may wait
|
|
198
|
+
for the user to handle unsaved review work. Live result capture may require
|
|
199
|
+
a contextual retry; never describe unavailable history as no changes.
|
|
200
|
+
- Review history uses local content/source snapshots, not screenshots or Git
|
|
201
|
+
commits. Do not create commits or alter repository state to populate history.
|
|
178
202
|
|
|
179
203
|
## Better edit labels (optional)
|
|
180
204
|
|