@nxxxsooo/opencode-annotate 0.9.1 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -0
- package/README.md +165 -71
- package/agy/cli.mjs +7 -25
- package/agy/cli.test.mjs +8 -16
- package/agy/skills/annotate/SKILL.md +5 -5
- package/agy/skills/annotate/agents/openai.yaml +3 -0
- package/auto-review.mjs +64 -0
- package/configuration.mjs +56 -0
- package/package.json +24 -5
- package/reference-command.mjs +80 -0
- package/review.mjs +45 -15
- package/scripts/verify-tui.mjs +16 -0
- package/server-history.mjs +58 -0
- package/server.ts +11 -0
- package/session-reference.mjs +109 -0
- package/session-tools.mjs +55 -0
- package/theme.mjs +3 -3
- package/tui/LICENSE +21 -0
- package/tui/README.md +75 -0
- package/tui/bin/darwin-arm64/annotate-tui +0 -0
- package/tui/bin/darwin-x64/annotate-tui +0 -0
- package/tui/bin/linux-arm64/annotate-tui +0 -0
- package/tui/bin/linux-x64/annotate-tui +0 -0
- package/tui/bin/win32-x64/annotate-tui.exe +0 -0
- package/tui/binary.mjs +19 -0
- package/tui/run.mjs +15 -0
- package/tui.ts +35 -3
- package/web-review.mjs +21 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.10.1 — automatic review and blank-session web pairing
|
|
4
|
+
|
|
5
|
+
- Let `/annotate-web` start from the blank home screen by creating and pairing an empty
|
|
6
|
+
session in the current directory with the selected model. No prompt or model turn is
|
|
7
|
+
needed before annotating; feedback remains bound to that session after switching tabs.
|
|
8
|
+
|
|
9
|
+
- Add opt-in automatic review of long replies through `autoAnnotate` and
|
|
10
|
+
`autoAnnotateThreshold` in the plugin's JSONC options (default: off, 2,000 characters).
|
|
11
|
+
Open the exact completed reply once after a successful turn in the active session;
|
|
12
|
+
keep feedback sending explicit and skip background, failed and interrupted turns.
|
|
13
|
+
- Read plugin options through a location-scoped RPC so OpenCode 2.2's server-loaded
|
|
14
|
+
TUI receives its JSONC settings, including updates to the auto-annotation switch.
|
|
15
|
+
|
|
16
|
+
## 0.10.0 — integrated TUI and conversation references
|
|
17
|
+
|
|
18
|
+
- Own the terminal reviewer under `tui/`, with its source, tests, native build and
|
|
19
|
+
platform executables released with this package. OpenCode and AGY resolve that bundled
|
|
20
|
+
reviewer; builds and CI no longer download or depend on a separate Plannotator fork.
|
|
21
|
+
- Keep theme inheritance, one-key send, input-method handling, Markdown bold-label fixes
|
|
22
|
+
and existing annotation storage intact. User configuration lives in
|
|
23
|
+
`~/.config/opencode-annotate/tui.toml`; clear the old launcher `binary` option to use the
|
|
24
|
+
bundled reviewer, and copy any customized layout from the old configuration once.
|
|
25
|
+
|
|
26
|
+
- Add `/ref [title or session ID]` and `/ref --all [title]` to attach a bounded,
|
|
27
|
+
attributed conversation snapshot to the captured session without resuming an idle assistant.
|
|
28
|
+
- Add `annotate.session_search` and `annotate.session_read` server tools with project-scoped
|
|
29
|
+
title search, explicit cross-project lookup, pagination and long-message continuation.
|
|
30
|
+
- Add a server entrypoint to the existing package. Move its entry from `cli.json` to
|
|
31
|
+
`opencode.json(c)` to enable both tools and TUI commands; retain existing options.
|
|
32
|
+
- Require OpenCode 2.2.0+. Full-history tools use the managed service's authenticated
|
|
33
|
+
CLI HTTP API, guarded by a same-process check. `/ref` uses the connected TUI client.
|
|
34
|
+
|
|
3
35
|
## 0.9.1 — no steer error after sending
|
|
4
36
|
|
|
5
37
|
- Send TUI annotations to an idle session as steering input instead of queued input.
|
package/README.md
CHANGED
|
@@ -6,10 +6,12 @@
|
|
|
6
6
|
|
|
7
7
|
**Annotate replies, documents, or live HTML pages, then send feedback to the originating OpenCode session.**
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
Use `/ref` to bring a previous conversation into the current session, or let the agent
|
|
10
|
+
find and read it through the bundled session-reference tools.
|
|
11
|
+
|
|
12
|
+
This is an **unofficial OpenCode plugin**. Its owned [terminal reviewer](tui/README.md)
|
|
13
|
+
and [browser companion](browser/UPSTREAM.md) live together in this repository, alongside
|
|
14
|
+
routing, native messaging, session targeting and confirmed feedback delivery.
|
|
13
15
|
|
|
14
16
|
Published on npm as `@nxxxsooo/opencode-annotate`. It replaces `opencode-plannotator-tui`
|
|
15
17
|
(0.4.2 and earlier); to switch, run
|
|
@@ -22,10 +24,14 @@ Published on npm as `@nxxxsooo/opencode-annotate`. It replaces `opencode-plannot
|
|
|
22
24
|
/annotate ~/Documents/notes.txt Review a plain-text document
|
|
23
25
|
/annotate-pick Choose a recent reply or mid-turn progress update
|
|
24
26
|
/annotate-selection Review the message containing your last transcript selection
|
|
25
|
-
/annotate-web
|
|
27
|
+
/annotate-web Pair this session, or create an empty one from home
|
|
26
28
|
/annotate-web page.html Review the specified local HTML in Chrome
|
|
27
29
|
/annotate-web https://example.com Review the specified webpage
|
|
28
30
|
/annotate-web off Revoke this session's browser pairing
|
|
31
|
+
/ref Choose a conversation from this project
|
|
32
|
+
/ref authentication Search conversation titles in this project
|
|
33
|
+
/ref --all authentication Search titles across projects
|
|
34
|
+
/ref ses_… Attach a specific conversation
|
|
29
35
|
```
|
|
30
36
|
|
|
31
37
|
`/annotate-last` always reviews the latest completed reply; any supplied argument is ignored.
|
|
@@ -37,61 +43,116 @@ or just the selected text when it spans messages. Numbered `/annotate N` is reti
|
|
|
37
43
|
|
|
38
44
|
## Install
|
|
39
45
|
|
|
40
|
-
Requires **OpenCode 2.0
|
|
41
|
-
|
|
42
|
-
|
|
46
|
+
Requires **OpenCode 2.2.0+**. The npm package includes **Annotate TUI**, built from
|
|
47
|
+
[`tui/`](tui/README.md) for macOS arm64/x64, Linux arm64/x64 and Windows x64.
|
|
48
|
+
See its [platform requirements](tui/README.md#source-and-build). The OpenCode terminal
|
|
49
|
+
handoff has been tested on macOS; Windows handoff has not yet been verified.
|
|
43
50
|
|
|
44
|
-
Install the
|
|
51
|
+
Install the plugin:
|
|
45
52
|
|
|
46
53
|
```sh
|
|
47
|
-
|
|
54
|
+
opencode plugin add @nxxxsooo/opencode-annotate@latest
|
|
48
55
|
```
|
|
49
56
|
|
|
50
|
-
|
|
51
|
-
`cargo install plannotator-tui --locked` or the upstream
|
|
52
|
-
[prebuilt binaries](https://github.com/plannotator/plannotator-tui/releases).
|
|
53
|
-
|
|
54
|
-
Then install the plugin:
|
|
57
|
+
Update an existing installation explicitly:
|
|
55
58
|
|
|
56
59
|
```sh
|
|
57
|
-
opencode plugin
|
|
60
|
+
opencode plugin update @nxxxsooo/opencode-annotate@latest
|
|
58
61
|
```
|
|
59
62
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
+
`@latest` selects the current npm release when installing or updating; publishing a
|
|
64
|
+
release does not itself replace an installed copy. Keep your existing plugin `options`.
|
|
65
|
+
|
|
66
|
+
OpenCode loads the server tools and TUI commands from one entry in your global
|
|
67
|
+
**`opencode.json`** or **`opencode.jsonc`**. Run `/reload` if the command list has not refreshed.
|
|
63
68
|
|
|
64
69
|
Manual configuration, preserving other entries:
|
|
65
70
|
|
|
66
71
|
```json
|
|
67
72
|
{
|
|
73
|
+
"$schema": "https://opencode.ai/config.json",
|
|
68
74
|
"plugins": ["@nxxxsooo/opencode-annotate@latest"]
|
|
69
75
|
}
|
|
70
76
|
```
|
|
71
77
|
|
|
78
|
+
**Upgrading from the TUI-only package:** move its entry from `cli.json` to
|
|
79
|
+
`opencode.json(c)`, retaining the whole entry and any `options`. Keep one entry so
|
|
80
|
+
the TUI is loaded once. A remaining CLI-only installation provides `/ref` and annotation
|
|
81
|
+
commands, but cannot register the agent tools.
|
|
82
|
+
|
|
83
|
+
## Reference another conversation
|
|
84
|
+
|
|
85
|
+
Run `/ref` or `/ref <title words>`, select the source, then choose **Attach reference**.
|
|
86
|
+
The confirmation names both conversations and shows whether the text is an excerpt.
|
|
87
|
+
The source is attached to the session where you invoked `/ref`, even if you switch tabs.
|
|
88
|
+
It is queued as historical context with `resume: false`: an idle assistant stays idle
|
|
89
|
+
until your next prompt. An already-running session can consume it at a later queue boundary.
|
|
90
|
+
Escape cancels without attaching anything.
|
|
91
|
+
|
|
92
|
+
Search defaults to the current session's project, including its worktrees. `/ref --all`
|
|
93
|
+
searches every project on the connected server. Titles can be ambiguous, so title searches
|
|
94
|
+
always show a chooser with directory, time and session ID. An exact `ses_…` ID selects
|
|
95
|
+
that source directly, including a source in another project.
|
|
96
|
+
|
|
97
|
+
The server part adds two Code Mode tools:
|
|
98
|
+
|
|
99
|
+
- `annotate.session_search`: title search, with `query`, optional `allProjects`, `limit`
|
|
100
|
+
and `cursor`. It excludes the current conversation and child sessions. Repeat
|
|
101
|
+
`allProjects: true` when paging a cross-project search.
|
|
102
|
+
- `annotate.session_read`: read by `sessionID`; pass `nextCursor` back as `cursor` for
|
|
103
|
+
older history. For a shortened message, pass its `messageID` and `nextOffset` as
|
|
104
|
+
`offset` to retrieve the rest.
|
|
105
|
+
|
|
106
|
+
References include user text and completed assistant text, source IDs and timestamps.
|
|
107
|
+
Tool payloads, reasoning, binary attachments and unfinished output are excluded. Each
|
|
108
|
+
page contains at most 24,000 characters of message text, distributed across the messages;
|
|
109
|
+
truncation and continuation are explicit. Historical claims may no longer match the code.
|
|
110
|
+
Search matches titles, not words inside messages.
|
|
111
|
+
|
|
112
|
+
**Server requirement:** the full-history read tool currently uses the official `opencode api`
|
|
113
|
+
command because OpenCode 2.2's plugin context exposes only post-compaction context. The
|
|
114
|
+
server must run as the managed OpenCode service with `opencode` on PATH. A process-ID
|
|
115
|
+
check rejects a different discovered server; standalone and embedded servers are not
|
|
116
|
+
supported by this tool. `/ref` uses the TUI's connected client directly. No separate
|
|
117
|
+
transcript index or database access is needed.
|
|
118
|
+
|
|
119
|
+
Permission actions are `annotate_session_search` (project ID, or `*` for cross-project
|
|
120
|
+
search) and `annotate_session_read` (source session ID).
|
|
121
|
+
|
|
122
|
+
### Reference verification
|
|
123
|
+
|
|
124
|
+
`npm run test:references` exercises the server tools and `/ref` against source or an
|
|
125
|
+
extracted npm package. The checks cover pre-compaction history, API responses larger than 256 KiB,
|
|
126
|
+
pagination, long-message continuation, attachment and cancellation without a model
|
|
127
|
+
turn. Unit checks also cover tab changes, permission denial and private-file cleanup.
|
|
128
|
+
|
|
129
|
+
Recovery starts in `reference-command.mjs` for `/ref`, `session-tools.mjs` for agent
|
|
130
|
+
tools, and `session-reference.mjs` for bounded history. `server-history.mjs` captures
|
|
131
|
+
CLI output in private temporary files to avoid v2.2.0 pipe truncation, then removes
|
|
132
|
+
them. Regression entrypoints are `session-reference.test.mjs`,
|
|
133
|
+
`server-history.test.mjs` and `tests/references-smoke.py`; release ownership remains in
|
|
134
|
+
[docs/releasing.md](docs/releasing.md).
|
|
135
|
+
|
|
72
136
|
## Antigravity (AGY) support
|
|
73
137
|
|
|
74
138
|
`opencode-annotate` provides companion support for Google Antigravity CLI (`agy`) via `agy-annotate`:
|
|
75
139
|
|
|
76
140
|
- **Slash commands `/annotate` & `/annotate-web`**: Built-in AGY skill at `agy/skills/annotate/` handles review directly within active AGY sessions.
|
|
77
|
-
- **Interactive TUI**:
|
|
141
|
+
- **Interactive TUI**: Uses the same bundled reviewer as OpenCode, with Dracula theme inheritance and one-key send.
|
|
78
142
|
- **Native Delivery**: Hooks into AGY lifecycle (`SessionStart`, `PreInvocation`, `Stop`) to deliver feedback directly into the conversation turn without network listeners.
|
|
79
143
|
- **CLI Commands**:
|
|
80
144
|
```sh
|
|
81
|
-
npx agy-annotate status
|
|
82
|
-
npx agy-annotate tui
|
|
83
|
-
npx agy-annotate web
|
|
84
|
-
npx agy-annotate queue
|
|
145
|
+
npx --package @nxxxsooo/opencode-annotate@latest agy-annotate status
|
|
146
|
+
npx --package @nxxxsooo/opencode-annotate@latest agy-annotate tui
|
|
147
|
+
npx --package @nxxxsooo/opencode-annotate@latest agy-annotate web
|
|
148
|
+
npx --package @nxxxsooo/opencode-annotate@latest agy-annotate queue
|
|
85
149
|
```
|
|
86
150
|
|
|
87
|
-
### Match OpenCode's colors
|
|
151
|
+
### Match OpenCode's colors
|
|
88
152
|
|
|
89
|
-
Set `"inheritTheme": true` in the plugin's `options
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
`local/opencode`); upstream 0.9.4 does not support it. The same branch adds `[ui].doc_width`
|
|
93
|
-
to cap the text column on wide terminals (proposed upstream in
|
|
94
|
-
[plannotator/plannotator-tui#108](https://github.com/plannotator/plannotator-tui/pull/108)). See [TUI theme integration](docs/tui-theme.md).
|
|
153
|
+
Set `"inheritTheme": true` in the plugin's `options`. The bundled reviewer supports the
|
|
154
|
+
full palette and `[ui].doc_width` for a readable text column on wide terminals.
|
|
155
|
+
See [TUI theme integration](docs/tui-theme.md).
|
|
95
156
|
|
|
96
157
|
Each review uses OpenCode's current resolved colors for the canvas, text, Markdown,
|
|
97
158
|
borders, highlights, cursor and selection. The plugin asks the chosen binary for its
|
|
@@ -110,7 +171,9 @@ Requirements: macOS and Chrome 116+, plus Node 22+ for the native host.
|
|
|
110
171
|
opens no HTTP port.
|
|
111
172
|
3. Reopen the OpenCode terminal client; the shared service needs no restart.
|
|
112
173
|
|
|
113
|
-
Run `/annotate-web
|
|
174
|
+
Run `/annotate-web`, then open the Chrome extension. From the blank home screen, it
|
|
175
|
+
creates an empty session in the current directory using the selected model; no first
|
|
176
|
+
prompt is needed. In an existing session, it pairs that session. A sole live
|
|
114
177
|
session is shown automatically; with several sessions, choose one once. Click the
|
|
115
178
|
destination beside **To** to change or refresh it. Its title stays visible beside Send,
|
|
116
179
|
including while disconnected, with its directory available on hover and in the chooser.
|
|
@@ -200,22 +263,13 @@ The manifest version alone cannot identify edits to an unpacked extension.
|
|
|
200
263
|
2. Select text by dragging, or press `v` and use movement keys.
|
|
201
264
|
3. Press `c` to comment, `a` for “looks good,” or `d` to request deletion.
|
|
202
265
|
Without a selection, `c` comments on the current block. Enter saves a comment.
|
|
203
|
-
4. Press **`q`** to return to OpenCode.
|
|
204
|
-
5. Choose **Send and continue** to submit the annotations. Escape or **Cancel**
|
|
205
|
-
cancels.
|
|
206
|
-
|
|
207
|
-
The upstream **`E`** action copies to the clipboard. This adapter's automatic
|
|
208
|
-
delivery path is **q → confirm** and does not need clipboard access.
|
|
266
|
+
4. Press **`q`** to send your notes and return to OpenCode.
|
|
209
267
|
|
|
210
|
-
|
|
211
|
-
upstream in [plannotator/plannotator-tui#109](https://github.com/plannotator/plannotator-tui/pull/109)),
|
|
212
|
-
**`q`** with notes returns and submits them without the OpenCode dialog. **`Ctrl+S`**
|
|
213
|
-
does the same mid-comment, saving the comment first. The header's **Send N back (q)**
|
|
268
|
+
**`Ctrl+S`** does the same mid-comment, saving the comment first. The header's **Send N back (q)**
|
|
214
269
|
button does the same as `q`.
|
|
215
270
|
**`Ctrl+C`** returns without sending, and OpenCode asks whether to send. `E` and `S` send as well,
|
|
216
271
|
following any `[keys]` rebinding, and the clipboard copy and Review menu (resend, finish, archive) are hidden
|
|
217
|
-
because OpenCode owns delivery.
|
|
218
|
-
**q → confirm**.
|
|
272
|
+
because OpenCode owns delivery.
|
|
219
273
|
|
|
220
274
|
### Chinese and other input methods
|
|
221
275
|
|
|
@@ -223,10 +277,10 @@ An input method holds plain letters while it composes, so review keys such as `e
|
|
|
223
277
|
and `s`, and OpenCode's permission shortcuts, do nothing. With
|
|
224
278
|
[Slash Saver](https://github.com/nxxxsooo/slash-saver) 1.1+ installed in `/Applications`,
|
|
225
279
|
the plugin selects its configured ASCII source while you browse a review or answer a
|
|
226
|
-
permission prompt, and restores your source afterwards.
|
|
280
|
+
permission prompt, and restores your source afterwards. The comment and edit
|
|
227
281
|
boxes switch back to your writing source while open. Set `"inputSource": false` in the
|
|
228
282
|
plugin's `options` to turn this off, or a path to another helper with the same
|
|
229
|
-
`input-source current|select|ascii` commands. The
|
|
283
|
+
`input-source current|select|ascii` commands. The reviewer also binds **`Ctrl+E`** to edit,
|
|
230
284
|
which an input method passes through.
|
|
231
285
|
|
|
232
286
|
Opening a review makes no model call. Confirming sends a normal user prompt and
|
|
@@ -237,9 +291,8 @@ cancelled reviews submit nothing.
|
|
|
237
291
|
|
|
238
292
|
**Replies:** the latest completed text reply, with paginated history lookup.
|
|
239
293
|
Reasoning, in-progress messages and tool-call commentary are excluded.
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
plugin reports that instead of opening another reply.
|
|
294
|
+
Use `/annotate-pick` for an earlier reply or progress update, or `/annotate-selection`
|
|
295
|
+
for selected transcript text. Numbered reply arguments are retired.
|
|
243
296
|
|
|
244
297
|
**Documents:** local UTF-8 `.md`, `.mdx`, `.markdown` and `.txt` files up to 2 MiB.
|
|
245
298
|
Relative paths resolve against the captured session's working directory, not the
|
|
@@ -260,8 +313,8 @@ it does not follow this repository's commits. Update just this plugin with:
|
|
|
260
313
|
opencode plugin update @nxxxsooo/opencode-annotate@latest
|
|
261
314
|
```
|
|
262
315
|
|
|
263
|
-
|
|
264
|
-
|
|
316
|
+
Run `/reload` if the command list has not refreshed. Check the installed version with
|
|
317
|
+
`opencode plugin list`.
|
|
265
318
|
|
|
266
319
|
To remove it:
|
|
267
320
|
|
|
@@ -271,25 +324,59 @@ opencode plugin remove @nxxxsooo/opencode-annotate@latest
|
|
|
271
324
|
|
|
272
325
|
## Configuration
|
|
273
326
|
|
|
274
|
-
|
|
327
|
+
### Automatically review long replies
|
|
328
|
+
|
|
329
|
+
Enable auto-annotation in the plugin entry in **`opencode.jsonc`** (or `opencode.json`):
|
|
330
|
+
|
|
331
|
+
```jsonc
|
|
332
|
+
{
|
|
333
|
+
"$schema": "https://opencode.ai/config.json",
|
|
334
|
+
"plugins": [
|
|
335
|
+
{
|
|
336
|
+
"package": "@nxxxsooo/opencode-annotate@latest",
|
|
337
|
+
"options": {
|
|
338
|
+
"autoAnnotate": true,
|
|
339
|
+
"autoAnnotateThreshold": 2000, // Open when the reply exceeds this many characters.
|
|
340
|
+
},
|
|
341
|
+
},
|
|
342
|
+
],
|
|
343
|
+
}
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
Add these options to your existing entry, keeping any other options. Auto-annotation
|
|
347
|
+
is **off by default**; set `autoAnnotate` to `false` to disable it. The threshold defaults
|
|
348
|
+
to **2,000 characters** and accepts a non-negative integer; `0` reviews every non-empty
|
|
349
|
+
reply. It counts Unicode characters in the trimmed reply text, including Markdown and
|
|
350
|
+
code, excluding reasoning and tool output. A reply exactly at the threshold does not open.
|
|
351
|
+
|
|
352
|
+
After a successful turn, a new qualifying reply in the active session opens the normal
|
|
353
|
+
reviewer once. Progress updates, failed or interrupted turns, historical replies and
|
|
354
|
+
background sessions do not trigger it. A reply is skipped if another review is open,
|
|
355
|
+
you switch sessions before it opens, or a new turn starts. Dismissing the reviewer or
|
|
356
|
+
reloading the plugin does not reopen that reply. Sending remains your explicit action.
|
|
357
|
+
OpenCode reloads saved configuration automatically; use `/reload` if needed.
|
|
358
|
+
|
|
359
|
+
### Reviewer binary and layout
|
|
360
|
+
|
|
361
|
+
The bundled reviewer is selected automatically. Use `binary` only to override it with
|
|
362
|
+
another locally built Annotate TUI executable:
|
|
275
363
|
|
|
276
364
|
```json
|
|
277
365
|
{
|
|
278
366
|
"plugins": [
|
|
279
367
|
{
|
|
280
368
|
"package": "@nxxxsooo/opencode-annotate@latest",
|
|
281
|
-
"options": { "binary": "/path/to/
|
|
369
|
+
"options": { "binary": "/path/to/annotate-tui" }
|
|
282
370
|
}
|
|
283
371
|
]
|
|
284
372
|
}
|
|
285
373
|
```
|
|
286
374
|
|
|
287
|
-
The adapter launches
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
The
|
|
291
|
-
|
|
292
|
-
build or launcher without replacing the system installation.
|
|
375
|
+
The adapter launches Annotate TUI in the current terminal. Layout and key settings live
|
|
376
|
+
in `~/.config/opencode-annotate/tui.toml`; font family and size belong to the terminal.
|
|
377
|
+
The adapter supplies `PLANNOTATOR_TUI_THEME` to follow OpenCode's light/dark mode.
|
|
378
|
+
The existing environment and annotation-field names are local protocol identifiers;
|
|
379
|
+
they do not connect to or install another project.
|
|
293
380
|
|
|
294
381
|
## Draft recovery
|
|
295
382
|
|
|
@@ -302,22 +389,26 @@ store, and a status message gives its directory.
|
|
|
302
389
|
|
|
303
390
|
```sh
|
|
304
391
|
PLANNOTATOR_DATA_DIR="<retained-directory>/data" \
|
|
305
|
-
|
|
392
|
+
npx --package @nxxxsooo/opencode-annotate annotate-tui "<retained-directory>/<snapshot>"
|
|
306
393
|
```
|
|
307
394
|
|
|
308
395
|
Use the `snapshot` value from `review.json`. Press `H` to restore archived notes,
|
|
309
|
-
then `E` to copy them for pasting into OpenCode. An
|
|
396
|
+
then `E` to copy them for pasting into OpenCode. An **E → F** archive is
|
|
310
397
|
preserved even when `--export` reports “No annotations.”
|
|
311
398
|
|
|
312
399
|
## Development
|
|
313
400
|
|
|
314
401
|
```sh
|
|
315
402
|
npm ci
|
|
403
|
+
npm run build:tui
|
|
404
|
+
npm run check:tui
|
|
316
405
|
npm run check
|
|
317
406
|
npm run test:smoke
|
|
407
|
+
npm run test:references
|
|
318
408
|
```
|
|
319
409
|
|
|
320
|
-
Unit tests use the
|
|
410
|
+
Rust 1.96+ is needed to build from source. Unit tests use the bundled annotation/export
|
|
411
|
+
binary, including theme inheritance tests. The optional smoke test
|
|
321
412
|
also requires Python 3, tmux and OpenCode. It runs a detached terminal, verifies
|
|
322
413
|
commands and feedback through the actual API, then removes its test session.
|
|
323
414
|
Its submission uses `resume: false`, so it makes no model call or visible window.
|
|
@@ -327,25 +418,28 @@ real configuration path. For a build with a centered 120-column viewport, also
|
|
|
327
418
|
set `ANNOTATE_EXPECT_MARGIN=10` to assert blank margins in the 140-column smoke
|
|
328
419
|
terminal. These variables configure the test, not the shipped plugin.
|
|
329
420
|
|
|
330
|
-
For development loading,
|
|
331
|
-
|
|
332
|
-
|
|
421
|
+
For development loading, set the plugin entry in `opencode.json(c)` to this checkout's
|
|
422
|
+
absolute directory, preserving its `options`, and run `/reload`. Remove any duplicate
|
|
423
|
+
entry in `cli.json`. The older `npm run install:plugin` helper switches **only the TUI**
|
|
424
|
+
entry in `cli.json`; use it only for TUI-only development. The reference smoke test loads
|
|
425
|
+
both entrypoints in its own temporary location without changing your global configuration.
|
|
333
426
|
|
|
334
427
|
See [release instructions](docs/releasing.md) and [changelog](CHANGELOG.md).
|
|
335
428
|
|
|
336
429
|
## 中文速用
|
|
337
430
|
|
|
338
|
-
这是**非官方 OpenCode
|
|
431
|
+
这是**非官方 OpenCode 批注插件**:文本用本仓库 `tui/` 中的 Annotate TUI,网页用 Chrome 伴随扩展。
|
|
339
432
|
|
|
340
433
|
- `/annotate`:批注上一条完整回复。
|
|
341
434
|
- `/annotate 文档.md`:批注文档,支持中文、空格和相对路径。
|
|
342
435
|
- `/annotate-pick`:从最近的回复和运行中的进度说明里选一条批注。
|
|
343
436
|
- `/annotate-selection`:先在会话里拖选文字,再批注包含这段文字的消息。
|
|
344
437
|
- `/annotate-last`:固定批注最新一条完整回复,忽略附带参数。
|
|
345
|
-
- `/
|
|
346
|
-
-
|
|
347
|
-
-
|
|
438
|
+
- `/ref`:选择并引用同项目的历史会话;`/ref --all 关键词` 跨项目搜索;`/ref ses_…` 直接指定。确认后附加上下文,不启动空闲助手。
|
|
439
|
+
- `/annotate-web`:配对 Chrome;空白首页会先创建空会话,无需先发提示词。`/annotate-web 页面.html`、`/annotate-web https://…` 批注网页;`/annotate-web off` 撤销配对。
|
|
440
|
+
- 选中文字 → `c` 写批注 → Enter 保存 → `q` 发送并返回。
|
|
441
|
+
- 写批注中途按 `Ctrl+S`,一步保存、返回并发送(中文输入法开着也有效);`Ctrl+C` 返回后由 OpenCode 询问。
|
|
348
442
|
- 文档采用独立快照,反馈附原文件路径,确认后发回发起批注的会话。
|
|
349
|
-
- 更新:`opencode plugin update @nxxxsooo/opencode-annotate@latest
|
|
443
|
+
- 更新:`opencode plugin update @nxxxsooo/opencode-annotate@latest`,命令未刷新时运行 `/reload`。
|
|
350
444
|
|
|
351
|
-
MIT licensed.
|
|
445
|
+
MIT licensed. Original terminal-reviewer copyright notices are preserved in [tui/LICENSE](tui/LICENSE).
|
package/agy/cli.mjs
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import { spawn, execFile } from "node:child_process"
|
|
3
3
|
import { promisify } from "node:util"
|
|
4
4
|
import { mkdtemp, mkdir, rm, readFile, writeFile } from "node:fs/promises"
|
|
5
|
-
import { statSync } from "node:fs"
|
|
6
5
|
import path from "node:path"
|
|
7
6
|
import os from "node:os"
|
|
8
7
|
import { fileURLToPath } from "node:url"
|
|
@@ -15,18 +14,10 @@ import { listTargets, registryRoot } from "../bridge/receiver.mjs"
|
|
|
15
14
|
import { browserTarget } from "../targets.mjs"
|
|
16
15
|
import { prepareTheme } from "../theme.mjs"
|
|
17
16
|
import { createInputSource } from "../input-source.mjs"
|
|
17
|
+
import { resolveTuiBinary } from "../tui/binary.mjs"
|
|
18
18
|
|
|
19
19
|
const execute = promisify(execFile)
|
|
20
20
|
|
|
21
|
-
export function resolveAdaptedBinary(customBinary) {
|
|
22
|
-
if (customBinary) return customBinary
|
|
23
|
-
const localAnnotate = path.join(os.homedir(), ".local/bin/plannotator-tui-annotate")
|
|
24
|
-
try {
|
|
25
|
-
if (statSync(localAnnotate).isFile()) return localAnnotate
|
|
26
|
-
} catch {}
|
|
27
|
-
return "plannotator-tui"
|
|
28
|
-
}
|
|
29
|
-
|
|
30
21
|
export function getAdaptedThemeTokens() {
|
|
31
22
|
const rgba = (r, g, b, a = 1) => ({ r: r / 255, g: g / 255, b: b / 255, a })
|
|
32
23
|
const text = rgba(248, 248, 242), bg = rgba(40, 42, 54), accent = rgba(189, 147, 249)
|
|
@@ -50,12 +41,12 @@ function usage() {
|
|
|
50
41
|
Commands:
|
|
51
42
|
status Show active AGY sessions and annotation pairing state
|
|
52
43
|
web [target] Pair browser companion with current AGY session (or open URL/HTML)
|
|
53
|
-
tui [path] Review latest AGY reply or markdown document in
|
|
44
|
+
tui [path] Review latest AGY reply or markdown document in Annotate TUI
|
|
54
45
|
queue List pending annotations queued for current AGY session
|
|
55
46
|
|
|
56
47
|
Options:
|
|
57
48
|
--session <id> Explicit AGY conversation ID (defaults to cwd-matched active session)
|
|
58
|
-
--binary <path>
|
|
49
|
+
--binary <path> Override the bundled Annotate TUI executable
|
|
59
50
|
`)
|
|
60
51
|
}
|
|
61
52
|
|
|
@@ -157,7 +148,7 @@ async function cmdQueue(options) {
|
|
|
157
148
|
|
|
158
149
|
async function cmdTui(targetPath, options) {
|
|
159
150
|
const session = await resolveSession(options.session)
|
|
160
|
-
const binary =
|
|
151
|
+
const binary = resolveTuiBinary(options.binary)
|
|
161
152
|
const brainDir = defaultBrainDir(session.conversationId)
|
|
162
153
|
const calledByAgent = Boolean(process.env.ANTIGRAVITY_AGENT || process.env.AGENT_TOOL_CALL)
|
|
163
154
|
const isInteractiveTTY = Boolean(options.interactiveTty) || (!calledByAgent && Boolean(process.stdin.isTTY) && !options.spawnWindow)
|
|
@@ -190,7 +181,7 @@ async function cmdTui(targetPath, options) {
|
|
|
190
181
|
}
|
|
191
182
|
}
|
|
192
183
|
|
|
193
|
-
console.log(`Opened interactive
|
|
184
|
+
console.log(`Opened interactive Annotate TUI window for "${session.title}".`)
|
|
194
185
|
console.log("Waiting for user to complete annotations (press 'q' or Ctrl+S to finish)...")
|
|
195
186
|
|
|
196
187
|
for (let i = 0; i < 300; i++) {
|
|
@@ -257,16 +248,7 @@ async function cmdTui(targetPath, options) {
|
|
|
257
248
|
PLANNOTATOR_TUI_SEND_INTENT: intentPath,
|
|
258
249
|
}
|
|
259
250
|
|
|
260
|
-
|
|
261
|
-
env = await prepareTheme({
|
|
262
|
-
binary,
|
|
263
|
-
theme: getAdaptedThemeTokens(),
|
|
264
|
-
directory: tempDir,
|
|
265
|
-
env,
|
|
266
|
-
})
|
|
267
|
-
} catch {
|
|
268
|
-
// If binary does not support theme command, fallback to base env
|
|
269
|
-
}
|
|
251
|
+
env = await prepareTheme({ binary, theme: getAdaptedThemeTokens(), directory: tempDir, env })
|
|
270
252
|
|
|
271
253
|
// Browse in ASCII so an input method cannot swallow review keys; see input-source.mjs.
|
|
272
254
|
const inputSource = createInputSource()
|
|
@@ -277,7 +259,7 @@ async function cmdTui(targetPath, options) {
|
|
|
277
259
|
}
|
|
278
260
|
|
|
279
261
|
try {
|
|
280
|
-
// Run
|
|
262
|
+
// Run the bundled reviewer interactively.
|
|
281
263
|
const child = spawn(binary, [snapshotFile], {
|
|
282
264
|
cwd: tempDir,
|
|
283
265
|
env,
|
package/agy/cli.test.mjs
CHANGED
|
@@ -3,16 +3,14 @@ import assert from "node:assert/strict"
|
|
|
3
3
|
import path from "node:path"
|
|
4
4
|
import os from "node:os"
|
|
5
5
|
import { mkdir, rm } from "node:fs/promises"
|
|
6
|
-
import {
|
|
6
|
+
import { getAdaptedThemeTokens } from "./cli.mjs"
|
|
7
|
+
import { bundledBinary, resolveTuiBinary } from "../tui/binary.mjs"
|
|
7
8
|
import { prepareTheme } from "../theme.mjs"
|
|
8
9
|
|
|
9
|
-
test("
|
|
10
|
-
const custom = "/custom/bin/
|
|
11
|
-
assert.equal(
|
|
12
|
-
|
|
13
|
-
const resolved = resolveAdaptedBinary()
|
|
14
|
-
// On this system, ~/.local/bin/plannotator-tui-annotate exists
|
|
15
|
-
assert.match(resolved, /(plannotator-tui-annotate|plannotator-tui)$/)
|
|
10
|
+
test("both adapters resolve the packaged reviewer or an explicit custom binary", () => {
|
|
11
|
+
const custom = "/custom/bin/annotate-tui"
|
|
12
|
+
assert.equal(resolveTuiBinary(custom), custom)
|
|
13
|
+
assert.equal(resolveTuiBinary(), bundledBinary())
|
|
16
14
|
})
|
|
17
15
|
|
|
18
16
|
test("getAdaptedThemeTokens returns valid RGBA palette tokens", () => {
|
|
@@ -26,8 +24,8 @@ test("getAdaptedThemeTokens returns valid RGBA palette tokens", () => {
|
|
|
26
24
|
assert.equal(typeof tokens.text.base.a, "number")
|
|
27
25
|
})
|
|
28
26
|
|
|
29
|
-
test("
|
|
30
|
-
const binary =
|
|
27
|
+
test("AGY theme tokens work with the bundled reviewer", async () => {
|
|
28
|
+
const binary = resolveTuiBinary()
|
|
31
29
|
const tempDir = path.join(os.tmpdir(), `agy-cli-test-${Date.now()}`)
|
|
32
30
|
await mkdir(tempDir, { recursive: true })
|
|
33
31
|
try {
|
|
@@ -39,12 +37,6 @@ test("prepareTheme succeeds with getAdaptedThemeTokens when fork is available",
|
|
|
39
37
|
})
|
|
40
38
|
assert.ok(env.PLANNOTATOR_TUI_CONFIG)
|
|
41
39
|
assert.ok(env.PLANNOTATOR_TUI_CONFIG.endsWith("theme.toml"))
|
|
42
|
-
} catch (err) {
|
|
43
|
-
if (/color-capable Plannotator fork/i.test(err.message)) {
|
|
44
|
-
t.skip("Upstream plannotator-tui does not support theme command")
|
|
45
|
-
return
|
|
46
|
-
}
|
|
47
|
-
throw err
|
|
48
40
|
} finally {
|
|
49
41
|
await rm(tempDir, { recursive: true, force: true })
|
|
50
42
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: annotate
|
|
3
|
-
description: Review assistant replies or local documents in
|
|
3
|
+
description: Review assistant replies or local documents in the bundled Annotate TUI, or pair the Chrome companion for webpage annotation. Use for /annotate, /annotate-web, reply/document annotation, or webpage review in an AGY session.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Annotate (`agy-annotate`)
|
|
@@ -12,19 +12,19 @@ Use this skill when the user runs `/annotate`, `/annotate-web`, or asks to annot
|
|
|
12
12
|
### 1. When the user types `/annotate` (or asks to review the last reply):
|
|
13
13
|
Run the command:
|
|
14
14
|
```bash
|
|
15
|
-
|
|
15
|
+
npx --yes --package @nxxxsooo/opencode-annotate@latest agy-annotate tui
|
|
16
16
|
```
|
|
17
|
-
This
|
|
17
|
+
This opens the bundled reviewer in an interactive window (via Ghostty or Terminal). When the user finishes adding annotations and presses `q` (or `Ctrl+S`), the window closes, the command outputs the feedback, and you proceed to apply the requested changes.
|
|
18
18
|
|
|
19
19
|
### 2. When the user specifies a document (e.g., `/annotate path/to/doc.md`):
|
|
20
20
|
Run the command:
|
|
21
21
|
```bash
|
|
22
|
-
|
|
22
|
+
npx --yes --package @nxxxsooo/opencode-annotate@latest agy-annotate tui "<path/to/doc.md>"
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
### 3. When the user types `/annotate-web` (or provides a URL/HTML file):
|
|
26
26
|
Run the command:
|
|
27
27
|
```bash
|
|
28
|
-
|
|
28
|
+
npx --yes --package @nxxxsooo/opencode-annotate@latest agy-annotate web [url-or-html-path]
|
|
29
29
|
```
|
|
30
30
|
Inform the user that the session is paired with Chrome and ready in the Annotate side panel (`Alt+Shift+A`). When the user sends notes from Chrome, they are delivered directly to this session.
|