@eliya-oss/agent-diff 0.1.0-alpha.195 → 0.1.0-alpha.196
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 +12 -0
- package/dist/main.js +35 -20
- package/package.json +1 -1
- package/skills/adiff/SKILL.md +66 -25
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @eliya-oss/agent-diff
|
|
2
2
|
|
|
3
|
+
## 0.1.0-alpha.196
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- feat(CLI): `comment take --new` hands over only comments the review has not handed over before, so a `--wait` ends on a new comment, a reply, or a thread reopened or restored rather than on one the agent is already working on.
|
|
8
|
+
|
|
9
|
+
<details><summary>What was wrong</summary>
|
|
10
|
+
|
|
11
|
+
A wait returned at once whenever any comment was still owed an answer, so an agent listening in the background was woken again and again by the comment it was already working on.
|
|
12
|
+
|
|
13
|
+
</details>
|
|
14
|
+
|
|
3
15
|
## 0.1.0-alpha.195
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/main.js
CHANGED
|
@@ -10083,7 +10083,7 @@ var init_config = __esmMin((() => {
|
|
|
10083
10083
|
//#region package.json
|
|
10084
10084
|
init_pane();
|
|
10085
10085
|
init_config();
|
|
10086
|
-
var version$1 = "0.1.0-alpha.
|
|
10086
|
+
var version$1 = "0.1.0-alpha.196";
|
|
10087
10087
|
//#endregion
|
|
10088
10088
|
//#region src/cli/error.ts
|
|
10089
10089
|
var UnknownCommand, MissingOption, UnknownField, UnknownOption, BadOption, RegistryUnanswered, NotServed, BadRequest;
|
|
@@ -10602,14 +10602,23 @@ var init_catalog = __esmMin((() => {
|
|
|
10602
10602
|
group: ANSWER_COMMENTS,
|
|
10603
10603
|
addresses: "review",
|
|
10604
10604
|
safety: "read",
|
|
10605
|
-
options: [
|
|
10606
|
-
|
|
10607
|
-
|
|
10608
|
-
|
|
10609
|
-
|
|
10610
|
-
|
|
10605
|
+
options: [
|
|
10606
|
+
...addressing,
|
|
10607
|
+
{
|
|
10608
|
+
name: "wait",
|
|
10609
|
+
required: false,
|
|
10610
|
+
value: "seconds",
|
|
10611
|
+
about: `Block until a comment arrives or the timeout elapses. A whole number of seconds from 1 to ${WAIT_MOST}; anything else is refused`
|
|
10612
|
+
},
|
|
10613
|
+
{
|
|
10614
|
+
name: "new",
|
|
10615
|
+
required: false,
|
|
10616
|
+
value: "flag",
|
|
10617
|
+
about: "Hand over only comments this review has not handed over before, so a wait ends on something new"
|
|
10618
|
+
}
|
|
10619
|
+
],
|
|
10611
10620
|
dataKey: "comments",
|
|
10612
|
-
example: "adiff comment take --worktree . --wait
|
|
10621
|
+
example: "adiff comment take --worktree . --new --wait 6900"
|
|
10613
10622
|
},
|
|
10614
10623
|
{
|
|
10615
10624
|
name: "comment answer",
|
|
@@ -12852,11 +12861,12 @@ var init_service$1 = __esmMin((() => {
|
|
|
12852
12861
|
}
|
|
12853
12862
|
});
|
|
12854
12863
|
cursorOps = (state, inbox, spoken, changeState) => {
|
|
12855
|
-
const
|
|
12864
|
+
const handedIn = fn("Store.handedIn")(function* (worktreePath, handing) {
|
|
12856
12865
|
const batches = yield* inbox(worktreePath);
|
|
12857
12866
|
const current = yield* state(worktreePath);
|
|
12858
12867
|
const answered = new Set((yield* spoken(worktreePath)).map((entry) => entry.comment));
|
|
12859
|
-
const
|
|
12868
|
+
const taken = current.taken ?? {};
|
|
12869
|
+
const owed = (comment) => !answered.has(comment.id) && !Object.hasOwn(current.settled, comment.id) && !Object.hasOwn(current.removed, comment.id) && (handing === "owed" || !Object.hasOwn(taken, comment.id));
|
|
12860
12870
|
return batches.flatMap((batch) => {
|
|
12861
12871
|
const comments = batch.comments.filter(owed);
|
|
12862
12872
|
return comments.length === 0 ? [] : [{
|
|
@@ -12867,9 +12877,10 @@ var init_service$1 = __esmMin((() => {
|
|
|
12867
12877
|
}];
|
|
12868
12878
|
});
|
|
12869
12879
|
});
|
|
12880
|
+
const owedIn = (worktreePath) => handedIn(worktreePath, "owed");
|
|
12870
12881
|
return {
|
|
12871
|
-
take: fn("Store.take")(function* (worktreePath, at) {
|
|
12872
|
-
const batches = yield*
|
|
12882
|
+
take: fn("Store.take")(function* (worktreePath, at, handing = "owed") {
|
|
12883
|
+
const batches = yield* handedIn(worktreePath, handing);
|
|
12873
12884
|
const ids = idsIn$1(batches);
|
|
12874
12885
|
if (ids.length > 0) yield* changeState(worktreePath, takes(ids, at));
|
|
12875
12886
|
return batches;
|
|
@@ -14135,12 +14146,12 @@ var init_comments$1 = __esmMin((() => {
|
|
|
14135
14146
|
onSome: (held) => held.layers
|
|
14136
14147
|
});
|
|
14137
14148
|
});
|
|
14138
|
-
take = fn("Review.Comment.take")(function* (worktreePath) {
|
|
14149
|
+
take = fn("Review.Comment.take")(function* (worktreePath, handing = "owed") {
|
|
14139
14150
|
const store = yield* Store;
|
|
14140
14151
|
const resolved = yield* realOf(worktreePath);
|
|
14141
14152
|
const at = (/* @__PURE__ */ new Date()).toISOString();
|
|
14142
14153
|
yield* ignore(store.noteWatching(resolved, at));
|
|
14143
|
-
const owed = flatten(yield* store.take(resolved, at));
|
|
14154
|
+
const owed = flatten(yield* store.take(resolved, at, handing));
|
|
14144
14155
|
if (owed.length === 0) return owed;
|
|
14145
14156
|
const layers = yield* layersOn(resolved);
|
|
14146
14157
|
const under = (one) => {
|
|
@@ -14153,7 +14164,7 @@ var init_comments$1 = __esmMin((() => {
|
|
|
14153
14164
|
const carried = (one) => one.replyTo === void 0 ? one : Object.assign({}, one, { thread: threadBefore(one, held, spoken) });
|
|
14154
14165
|
return owed.map(carried).map(under);
|
|
14155
14166
|
});
|
|
14156
|
-
awaitTaken = (worktreePath, deadline) => take(worktreePath).pipe(flatMap((comments) => comments.length > 0 || Date.now() >= deadline ? succeed$1(comments) : sleep(POLL).pipe(flatMap(() => awaitTaken(worktreePath, deadline)))));
|
|
14167
|
+
awaitTaken = (worktreePath, deadline, handing = "owed") => take(worktreePath, handing).pipe(flatMap((comments) => comments.length > 0 || Date.now() >= deadline ? succeed$1(comments) : sleep(POLL).pipe(flatMap(() => awaitTaken(worktreePath, deadline, handing)))));
|
|
14157
14168
|
markRead = fn("Review.Comment.markRead")(function* (worktree, id) {
|
|
14158
14169
|
const store = yield* Store;
|
|
14159
14170
|
const spoken = yield* store.answers(worktree.path);
|
|
@@ -14370,7 +14381,8 @@ var init_threads$1 = __esmMin((() => {
|
|
|
14370
14381
|
yield* store.changeState(worktree.path, (was) => ({
|
|
14371
14382
|
...was,
|
|
14372
14383
|
settled: without$1(was.settled, id),
|
|
14373
|
-
read: without$1(was.read, id)
|
|
14384
|
+
read: without$1(was.read, id),
|
|
14385
|
+
taken: without$1(was.taken ?? {}, id)
|
|
14374
14386
|
}));
|
|
14375
14387
|
return { unsettled: id };
|
|
14376
14388
|
});
|
|
@@ -14397,7 +14409,8 @@ var init_threads$1 = __esmMin((() => {
|
|
|
14397
14409
|
yield* known(worktree, id);
|
|
14398
14410
|
yield* store.changeState(worktree.path, (was) => ({
|
|
14399
14411
|
...was,
|
|
14400
|
-
removed: without$1(was.removed, id)
|
|
14412
|
+
removed: without$1(was.removed, id),
|
|
14413
|
+
taken: without$1(was.taken ?? {}, id)
|
|
14401
14414
|
}));
|
|
14402
14415
|
return { restored: id };
|
|
14403
14416
|
});
|
|
@@ -16226,7 +16239,8 @@ const banner = () => [
|
|
|
16226
16239
|
"",
|
|
16227
16240
|
"An agent working in that worktree answers them:",
|
|
16228
16241
|
"",
|
|
16229
|
-
" adiff comment take --worktree .
|
|
16242
|
+
" adiff comment take --worktree . collect every comment owed an answer",
|
|
16243
|
+
" adiff comment take --worktree . --new --wait 6900 block until a new comment arrives",
|
|
16230
16244
|
" adiff comment answer --worktree . --id <id> --body '…'",
|
|
16231
16245
|
" adiff layers set --worktree . --json - publish a reading order, when asked",
|
|
16232
16246
|
"",
|
|
@@ -26038,11 +26052,12 @@ const commentReply = fn("Main.commentReply")(function* (options) {
|
|
|
26038
26052
|
});
|
|
26039
26053
|
yield* answer(options, { batch });
|
|
26040
26054
|
});
|
|
26041
|
-
const NOTHING_WAITING = "No comment is waiting. Pass --wait <seconds> to block until one arrives, and answer what you collect with `adiff comment answer --worktree . --id <id> --body '…'`.";
|
|
26055
|
+
const NOTHING_WAITING = "No comment is waiting. Pass --new --wait <seconds> to block until a new one arrives, and answer what you collect with `adiff comment answer --worktree . --id <id> --body '…'`.";
|
|
26042
26056
|
const commentTake = fn("Main.commentTake")(function* (options) {
|
|
26043
26057
|
const worktree = yield* required(options, "worktree");
|
|
26044
26058
|
const wait = yield* seconds(options, "wait");
|
|
26045
|
-
const
|
|
26059
|
+
const handing = options["new"] === void 0 ? "owed" : "new";
|
|
26060
|
+
const comments = wait > 0 ? yield* awaitTaken(worktree, Date.now() + wait * WAIT_UNIT, handing) : yield* take(worktree, handing);
|
|
26046
26061
|
const hint = comments.length === 0 ? { hint: NOTHING_WAITING } : {};
|
|
26047
26062
|
yield* answer(options, {
|
|
26048
26063
|
comments,
|
package/package.json
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"bin": {
|
|
24
24
|
"adiff": "./bin/adiff.js"
|
|
25
25
|
},
|
|
26
|
-
"version": "0.1.0-alpha.
|
|
26
|
+
"version": "0.1.0-alpha.196",
|
|
27
27
|
"description": "Review the work an agent left you without losing the thread: comments live on the lines, the agent answers them, and each point stays open until you settle it.",
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"repository": {
|
package/skills/adiff/SKILL.md
CHANGED
|
@@ -29,8 +29,8 @@ revision has it. The code the layer describes is about to change under your hand
|
|
|
29
29
|
stale the moment you act on the comment: write a new revision with `adiff layers set` before you
|
|
30
30
|
answer, and say in the answer that you did.
|
|
31
31
|
|
|
32
|
-
A comment keeps coming back until it is answered. A second `take` returns it again, so answer
|
|
33
|
-
you take. Settling or removing it also retires it: those are the reviewer saying they no longer
|
|
32
|
+
A comment keeps coming back until it is answered. A second plain `take` returns it again, so answer
|
|
33
|
+
what you take. Settling or removing it also retires it: those are the reviewer saying they no longer
|
|
34
34
|
need one.
|
|
35
35
|
|
|
36
36
|
## A remark is context, a comment is work
|
|
@@ -43,12 +43,35 @@ one. Never act on a remark that has not been accepted, and never accept one your
|
|
|
43
43
|
|
|
44
44
|
## Wait for the next one
|
|
45
45
|
|
|
46
|
+
Start a session with a plain take, which collects everything still owed an answer:
|
|
47
|
+
|
|
46
48
|
```bash
|
|
47
|
-
adiff comment take --worktree .
|
|
49
|
+
adiff comment take --worktree .
|
|
48
50
|
```
|
|
49
51
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
Then listen for what comes next:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
adiff comment take --worktree . --new --wait 6900
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
`--new` hands back only comments this review has not handed you before: a new comment, a reply to
|
|
59
|
+
one of your answers, or a comment the reviewer reopened or restored. Comments you already took
|
|
60
|
+
and are still working on never end the wait, so it wakes you only for something new. It blocks until
|
|
61
|
+
such a comment arrives or the timeout in seconds elapses, then returns the same envelope.
|
|
62
|
+
|
|
63
|
+
An empty `comments` array means only that the wait ran out. It is not an error and not news: run the
|
|
64
|
+
same wait again and say nothing to the user about it.
|
|
65
|
+
|
|
66
|
+
Run it in the background, never in the foreground. In Claude Code that is the Bash tool with
|
|
67
|
+
`run_in_background` and a `timeout` of 7200000. 6900 seconds keeps the wait under the harness's
|
|
68
|
+
two-hour limit on a background command, so it ends with an empty answer rather than being killed. A
|
|
69
|
+
foreground wait holds the turn, so you cannot do anything else and the person you are working with
|
|
70
|
+
cannot talk to you. Backgrounded, the harness brings you back the moment a comment lands.
|
|
71
|
+
|
|
72
|
+
Do not run it under a Monitor, do not re-arm a short wait on a timer, and do not schedule wakeups to
|
|
73
|
+
check on it. Each of those wakes you for nothing; the background wait already brings you back when a
|
|
74
|
+
comment arrives.
|
|
52
75
|
|
|
53
76
|
`--wait` takes a whole number of seconds from 1 to 86400. A value outside that is refused on
|
|
54
77
|
stderr with exit 2, because an instant empty answer would read exactly like a wait that expired:
|
|
@@ -58,21 +81,17 @@ Arm the wait as the first thing you do in a turn, before the work. A turn that i
|
|
|
58
81
|
half-way then still leaves a listener running, and a wait armed at the end of a turn is a wait that
|
|
59
82
|
often never gets armed.
|
|
60
83
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
harness brings you back the moment a comment lands.
|
|
84
|
+
Keep one wait per worktree. Two waits running at once hand the same comment to both, which is two of
|
|
85
|
+
you answering one comment. Before starting one, check whether one is already running.
|
|
64
86
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
Re-arm it after each comment you handle, and keep it running while you work. A reviewer reads at
|
|
70
|
-
their own pace, so comments arrive minutes apart, and the whole point is that they reach you as
|
|
71
|
-
events rather than by you asking. When you finish a piece of work, say you are still listening.
|
|
87
|
+
Re-arm it as soon as it returns, before you handle what it returned, and keep it running while you
|
|
88
|
+
work. A reviewer reads at their own pace, so comments arrive minutes apart, and the whole point is
|
|
89
|
+
that they reach you as events rather than by you asking. When you finish a piece of work, say you are
|
|
90
|
+
still listening.
|
|
72
91
|
|
|
73
92
|
A backgrounded wait that is killed rather than expiring is not the reviewer going quiet, and not a
|
|
74
|
-
reason to stop listening. A kill loses
|
|
75
|
-
|
|
93
|
+
reason to stop listening. A kill loses nothing: taking is what records a comment as handed over, so a
|
|
94
|
+
comment that arrived after the kill is still new to the next `--new` wait. Arm a new one.
|
|
76
95
|
|
|
77
96
|
## Answering a comment
|
|
78
97
|
|
|
@@ -149,7 +168,8 @@ answer as many comments as it addresses. When a comment is a question rather tha
|
|
|
149
168
|
it with `adiff comment answer` too; an answer written into a commit message never reaches the
|
|
150
169
|
reviewer's screen.
|
|
151
170
|
|
|
152
|
-
Handle every comment in the batch
|
|
171
|
+
Handle every comment in the batch. The `--new` wait you re-armed does not hand them back, so a
|
|
172
|
+
comment you skip waits for your next plain take.
|
|
153
173
|
|
|
154
174
|
## Failure
|
|
155
175
|
|
|
@@ -168,8 +188,9 @@ about, because the reviewer has not opened it; report that rather than looping.
|
|
|
168
188
|
## Handing work over
|
|
169
189
|
|
|
170
190
|
Finishing is not a reason to publish anything. Say the work is ready, put the review in front of
|
|
171
|
-
them if they asked for one, and say how to read it. That is the whole handover. A reading order
|
|
172
|
-
extra work you do on request, and it has its own section further down.
|
|
191
|
+
them if they asked for one, and say how to read it. That is the whole handover. A first reading order
|
|
192
|
+
is extra work you do on request, and it has its own section further down. A reading order that
|
|
193
|
+
already exists is different: keep it current before you say the work is ready, without being asked.
|
|
173
194
|
|
|
174
195
|
## Put the review in front of them
|
|
175
196
|
|
|
@@ -209,13 +230,15 @@ the branch in a list. `--branch` takes the name `branch list` reports; without i
|
|
|
209
230
|
on the worktree list.
|
|
210
231
|
|
|
211
232
|
Say what you want looked at hardest, and where you are unsure. A reviewer who knows which part you
|
|
212
|
-
doubt spends their attention there.
|
|
213
|
-
long enough that the order matters, say you can publish one and let
|
|
233
|
+
doubt spends their attention there. When the branch has no reading order, offer one rather than
|
|
234
|
+
writing one: if the change is long enough that the order matters, say you can publish one and let
|
|
235
|
+
them decide.
|
|
214
236
|
|
|
215
237
|
## Publishing a reading order, when you are asked for one
|
|
216
238
|
|
|
217
|
-
|
|
218
|
-
nobody wanted spends their attention on your summary rather than on the code.
|
|
239
|
+
Write a first reading order only when the reviewer asks. A reading order is a real piece of work, it
|
|
240
|
+
can be wrong, and one nobody wanted spends their attention on your summary rather than on the code.
|
|
241
|
+
Once one exists, keeping it current is not a new ask: see the next section.
|
|
219
242
|
|
|
220
243
|
The ask often arrives as a comment. Pressing `L` in the review sends you one of these:
|
|
221
244
|
|
|
@@ -319,13 +342,31 @@ each claim their own run. Done means `uncovered` is empty **and** `shared` is ze
|
|
|
319
342
|
|
|
320
343
|
Setting layers again supersedes the previous set and bumps `version`; the set records the commit it
|
|
321
344
|
was written for, and adiff reports it as `stale` once the branch moves past that commit. Once a
|
|
322
|
-
reviewer has a reading order, keep it true
|
|
345
|
+
reviewer has a reading order, keep it true, as the next section says.
|
|
323
346
|
|
|
324
347
|
When you have published one, tell them the sidebar now holds it: `s` swaps between the layers and
|
|
325
348
|
the files, each layer shows the files it covers with the ones already reviewed ticked off, and `]`
|
|
326
349
|
and `[` walk those files in the order you put them in — from the last file of one layer into the
|
|
327
350
|
first of the next.
|
|
328
351
|
|
|
352
|
+
## Keep an existing reading order current, unasked
|
|
353
|
+
|
|
354
|
+
Once a branch has layers, check them after each change you make (a commit, an answered comment, a
|
|
355
|
+
rebase) and before you say the work is ready:
|
|
356
|
+
|
|
357
|
+
```bash
|
|
358
|
+
adiff layers show --worktree . --fields stale,uncovered,shared,vanished
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
If `uncovered` is not empty, `stale` is true or `vanished` names a path, write a new revision with
|
|
362
|
+
`adiff layers set` right away. Put new runs into the layer whose claim they serve, and add a final
|
|
363
|
+
layer only for lines that serve none. When the base moved, read the diff again rather than patching
|
|
364
|
+
line numbers. Done means `uncovered` is empty and `shared` is zero.
|
|
365
|
+
|
|
366
|
+
Do it silently: it is upkeep, not news, so do not ask first and do not report it unless the reviewer
|
|
367
|
+
asks. `NoLayers` (exit 3) means the branch has no reading order, and then you write one only when
|
|
368
|
+
asked.
|
|
369
|
+
|
|
329
370
|
## Helping draft a review of somebody else's pull request
|
|
330
371
|
|
|
331
372
|
Sometimes the reviewer is not reading your work — they are reading a stranger's pull request,
|