@eliya-oss/agent-diff 0.1.0-alpha.140 → 0.1.0-alpha.141

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.
@@ -124,9 +124,13 @@ Not:
124
124
  - ~~`fix(diff): a binary file that adiff cannot show`~~ — a title, not a statement.
125
125
 
126
126
  **No gerund titles.** "Saying what is not there", "Opening onto one branch", "Asking before
127
- leaving" are all wrong. Write a statement with a verb in it: "a file with no newline says so".
128
- This holds for the sentence, the branch name, the changeset filename, the PR title and the test
129
- filename.
127
+ leaving" are all wrong. Write a statement with a verb in it: "a file with no newline is drawn as
128
+ one line, not two". This holds for the sentence, the branch name, the changeset filename, the PR
129
+ title and the test filename.
130
+
131
+ Do not write "says so". It carries no meaning of its own: it borrows the subject clause beside it,
132
+ and the moment the sentence is split across a `describe` and a `test`, or read off a PR page or a
133
+ recording's title card, nothing is left. Name what is said.
130
134
 
131
135
  For `perf`, give both numbers and what they were measured on. A speed claim with no measurement is
132
136
  not a release note.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @eliya-oss/agent-diff
2
2
 
3
+ ## 0.1.0-alpha.141
4
+
5
+ ### Patch Changes
6
+
7
+ - fix(CLI): `comment take --wait` refuses a number of seconds it cannot honour instead of answering as though nothing arrived.
8
+
9
+ <details><summary>What was wrong</summary>
10
+
11
+ `--wait` was read with nothing checking it. A value that was not a positive whole number of seconds
12
+ — a word, an empty value, a zero — fell through to a single poll and answered
13
+ `{"ok":true,"comments":[]}` at once. That is byte for byte what an expired wait answers, so an agent
14
+ that asked to listen for an hour was told "nothing arrived" and reported itself armed while it was
15
+ not listening at all.
16
+
17
+ `--wait` now takes a whole number of seconds from 1 to 86400 and refuses anything else on stderr
18
+ with exit 2, naming the most it takes. `--help` and `adiff describe` say the bound. An empty answer
19
+ now only ever means the inbox was empty.
20
+
21
+ </details>
22
+
3
23
  ## 0.1.0-alpha.140
4
24
 
5
25
  ### Patch Changes
package/dist/main.js CHANGED
@@ -2103,7 +2103,7 @@ var init_Context = __esmMin((() => {
2103
2103
  }));
2104
2104
  //#endregion
2105
2105
  //#region node_modules/.pnpm/effect@4.0.0-rc.110/node_modules/effect/dist/Duration.js
2106
- var TypeId$16, bigint0$1, bigint1, bigint2, bigint10, bigint1e3, roundTiesAwayFromZero, roundMillisToNanos, parseNanos, DURATION_REGEXP, fromInputUnsafe, invalid, zeroDurationValue, infinityDurationValue, negativeInfinityDurationValue, DurationProto, make$14, isDuration, isFinite$1, isZero, zero$1, infinity, negativeInfinity, nanos, millis, seconds, minutes, hours, days, weeks, toMillis, toNanosUnsafe, match$1, matchPair, Equivalence$2, equals;
2106
+ var TypeId$16, bigint0$1, bigint1, bigint2, bigint10, bigint1e3, roundTiesAwayFromZero, roundMillisToNanos, parseNanos, DURATION_REGEXP, fromInputUnsafe, invalid, zeroDurationValue, infinityDurationValue, negativeInfinityDurationValue, DurationProto, make$14, isDuration, isFinite$1, isZero, zero$1, infinity, negativeInfinity, nanos, millis, seconds$1, minutes, hours, days, weeks, toMillis, toNanosUnsafe, match$1, matchPair, Equivalence$2, equals;
2107
2107
  var init_Duration = __esmMin((() => {
2108
2108
  init_Equal();
2109
2109
  init_Function();
@@ -2147,7 +2147,7 @@ var init_Duration = __esmMin((() => {
2147
2147
  case "milli":
2148
2148
  case "millis": return millis(value);
2149
2149
  case "second":
2150
- case "seconds": return seconds(value);
2150
+ case "seconds": return seconds$1(value);
2151
2151
  case "minute":
2152
2152
  case "minutes": return minutes(value);
2153
2153
  case "hour":
@@ -2278,7 +2278,7 @@ var init_Duration = __esmMin((() => {
2278
2278
  negativeInfinity = /*#__PURE__*/ make$14(-Infinity);
2279
2279
  nanos = (nanos) => make$14(nanos);
2280
2280
  millis = (millis) => make$14(millis);
2281
- seconds = (seconds) => make$14(seconds * 1e3);
2281
+ seconds$1 = (seconds) => make$14(seconds * 1e3);
2282
2282
  minutes = (minutes) => make$14(minutes * 6e4);
2283
2283
  hours = (hours) => make$14(hours * 36e5);
2284
2284
  days = (days) => make$14(days * 864e5);
@@ -11116,7 +11116,7 @@ var init_pane = __esmMin((() => {
11116
11116
  init_drafts();
11117
11117
  init_init();
11118
11118
  init_pane();
11119
- var version$1 = "0.1.0-alpha.140";
11119
+ var version$1 = "0.1.0-alpha.141";
11120
11120
  //#endregion
11121
11121
  //#region src/cli/upgrade.ts
11122
11122
  var PACKAGE, TAG, RELEASES, REGISTRY, ASK_MS, RUN_MS, CELLAR, COMPILED, INSTALLED, BUN_GLOBAL, routeOf, ROUTES, asRoute, checkoutOf, assetOf, commandFor, NOTES, RUNNABLE, NUMBERS, numbersIn, compare$1, partsOf, newer, tagIn, fetched, askLatest, here, findUpgrade, willUpgrade, ranChild, runUpgrade, statusOf$1, sayFound, sayDone, attempted, REFRESH_MS, refreshSkills, updatedIn, sayRefreshed, upgradeReport;
@@ -11913,91 +11913,10 @@ var init_threads = __esmMin((() => {
11913
11913
  });
11914
11914
  }));
11915
11915
  //#endregion
11916
- //#region src/cli/parse.ts
11917
- var FLAG, flagOn, tokenOn, optionsFrom, onlyKnown, oneOf, required, numeric;
11918
- var init_parse = __esmMin((() => {
11919
- init_dist();
11920
- init_error();
11921
- FLAG = /^--(?<name>[^=]+)(?:=(?<value>[\s\S]*))?$/;
11922
- flagOn = (taken, token, valued) => {
11923
- const found = FLAG.exec(token)?.groups;
11924
- if (found === void 0) return taken;
11925
- const name = found["name"] ?? "";
11926
- const given = found["value"];
11927
- if (given !== void 0) return {
11928
- options: {
11929
- ...taken.options,
11930
- [name]: given
11931
- },
11932
- held: void 0
11933
- };
11934
- if (valued.has(name)) return {
11935
- options: taken.options,
11936
- held: name
11937
- };
11938
- return {
11939
- options: {
11940
- ...taken.options,
11941
- [name]: "true"
11942
- },
11943
- held: void 0
11944
- };
11945
- };
11946
- tokenOn = (taken, token, valued) => taken.held === void 0 ? flagOn(taken, token, valued) : {
11947
- options: {
11948
- ...taken.options,
11949
- [taken.held]: token
11950
- },
11951
- held: void 0
11952
- };
11953
- optionsFrom = (argv, valued = /* @__PURE__ */ new Set()) => {
11954
- const taken = argv.reduce((held, token) => tokenOn(held, token, valued), {
11955
- options: {},
11956
- held: void 0
11957
- });
11958
- return taken.held === void 0 ? taken.options : {
11959
- ...taken.options,
11960
- [taken.held]: ""
11961
- };
11962
- };
11963
- onlyKnown = (options, known) => {
11964
- const strange = Object.keys(options).find((name) => !known.has(name));
11965
- return strange === void 0 ? succeed$1(options) : fail(new UnknownOption({
11966
- option: strange,
11967
- known: [...known].toSorted()
11968
- }));
11969
- };
11970
- oneOf = (options, name, allowed, byDefault) => {
11971
- const given = options[name];
11972
- if (given === void 0) return succeed$1(byDefault);
11973
- const found = allowed.find((one) => one === given);
11974
- return found === void 0 ? fail(new BadOption({
11975
- option: name,
11976
- given,
11977
- allowed
11978
- })) : succeed$1(found);
11979
- };
11980
- required = fn("Cli.required")(function* (options, name) {
11981
- const value = fromNullishOr(options[name]);
11982
- return yield* match$3(value, {
11983
- onNone: () => new MissingOption({ option: name }),
11984
- onSome: succeed$1
11985
- });
11986
- });
11987
- numeric = fn("Cli.numeric")(function* (options, name) {
11988
- const raw = yield* required(options, name);
11989
- const parsed = Number(raw);
11990
- return yield* Number.isInteger(parsed) && parsed >= 1 ? succeed$1(parsed) : new BadOption({
11991
- option: name,
11992
- given: raw,
11993
- allowed: ["a whole number of 1 or more"]
11994
- });
11995
- });
11996
- }));
11997
- //#endregion
11998
11916
  //#region src/cli/catalog.ts
11999
- var worktreeOf, repoOf, branchOf, fieldsOption, addressing, baseOf, based, repo, opening$2, file, range, READ_A_BRANCH, WRITE_COMMENTS, ANSWER_COMMENTS, FOLLOW_UP, DRAFTS, SET_UP, withFields, commands$1, catalog, commandNames, findCommand, VALUED_ANYWHERE, KNOWN_ANYWHERE, valuedIn, knownIn, verbsUnder, groups, MIN_EDITS, distance, CHARS_PER_EDIT, nearestCommand;
11917
+ var WAIT_MOST, worktreeOf, repoOf, branchOf, fieldsOption, addressing, baseOf, based, repo, opening$2, file, range, READ_A_BRANCH, WRITE_COMMENTS, ANSWER_COMMENTS, FOLLOW_UP, DRAFTS, SET_UP, withFields, commands$1, catalog, commandNames, findCommand, VALUED_ANYWHERE, KNOWN_ANYWHERE, valuedIn, knownIn, verbsUnder, groups, MIN_EDITS, distance, CHARS_PER_EDIT, nearestCommand;
12000
11918
  var init_catalog = __esmMin((() => {
11919
+ WAIT_MOST = 86400;
12001
11920
  worktreeOf = {
12002
11921
  name: "worktree",
12003
11922
  required: false,
@@ -12217,7 +12136,7 @@ var init_catalog = __esmMin((() => {
12217
12136
  name: "wait",
12218
12137
  required: false,
12219
12138
  value: "seconds",
12220
- about: "Block until a comment arrives or the timeout elapses"
12139
+ about: `Block until a comment arrives or the timeout elapses. A whole number of seconds from 1 to ${WAIT_MOST}; anything else is refused`
12221
12140
  }],
12222
12141
  dataKey: "comments",
12223
12142
  example: "adiff comment take --worktree . --wait 300"
@@ -12567,6 +12486,99 @@ var init_catalog = __esmMin((() => {
12567
12486
  })).toSorted((left, right) => left.gap - right.gap)[0];
12568
12487
  return scored !== void 0 && scored.gap <= room ? scored.known : void 0;
12569
12488
  };
12489
+ }));
12490
+ //#endregion
12491
+ //#region src/cli/parse.ts
12492
+ var FLAG, flagOn, tokenOn, optionsFrom, onlyKnown, oneOf, required, numeric, seconds;
12493
+ var init_parse = __esmMin((() => {
12494
+ init_dist();
12495
+ init_catalog();
12496
+ init_error();
12497
+ FLAG = /^--(?<name>[^=]+)(?:=(?<value>[\s\S]*))?$/;
12498
+ flagOn = (taken, token, valued) => {
12499
+ const found = FLAG.exec(token)?.groups;
12500
+ if (found === void 0) return taken;
12501
+ const name = found["name"] ?? "";
12502
+ const given = found["value"];
12503
+ if (given !== void 0) return {
12504
+ options: {
12505
+ ...taken.options,
12506
+ [name]: given
12507
+ },
12508
+ held: void 0
12509
+ };
12510
+ if (valued.has(name)) return {
12511
+ options: taken.options,
12512
+ held: name
12513
+ };
12514
+ return {
12515
+ options: {
12516
+ ...taken.options,
12517
+ [name]: "true"
12518
+ },
12519
+ held: void 0
12520
+ };
12521
+ };
12522
+ tokenOn = (taken, token, valued) => taken.held === void 0 ? flagOn(taken, token, valued) : {
12523
+ options: {
12524
+ ...taken.options,
12525
+ [taken.held]: token
12526
+ },
12527
+ held: void 0
12528
+ };
12529
+ optionsFrom = (argv, valued = /* @__PURE__ */ new Set()) => {
12530
+ const taken = argv.reduce((held, token) => tokenOn(held, token, valued), {
12531
+ options: {},
12532
+ held: void 0
12533
+ });
12534
+ return taken.held === void 0 ? taken.options : {
12535
+ ...taken.options,
12536
+ [taken.held]: ""
12537
+ };
12538
+ };
12539
+ onlyKnown = (options, known) => {
12540
+ const strange = Object.keys(options).find((name) => !known.has(name));
12541
+ return strange === void 0 ? succeed$1(options) : fail(new UnknownOption({
12542
+ option: strange,
12543
+ known: [...known].toSorted()
12544
+ }));
12545
+ };
12546
+ oneOf = (options, name, allowed, byDefault) => {
12547
+ const given = options[name];
12548
+ if (given === void 0) return succeed$1(byDefault);
12549
+ const found = allowed.find((one) => one === given);
12550
+ return found === void 0 ? fail(new BadOption({
12551
+ option: name,
12552
+ given,
12553
+ allowed
12554
+ })) : succeed$1(found);
12555
+ };
12556
+ required = fn("Cli.required")(function* (options, name) {
12557
+ const value = fromNullishOr(options[name]);
12558
+ return yield* match$3(value, {
12559
+ onNone: () => new MissingOption({ option: name }),
12560
+ onSome: succeed$1
12561
+ });
12562
+ });
12563
+ numeric = fn("Cli.numeric")(function* (options, name) {
12564
+ const raw = yield* required(options, name);
12565
+ const parsed = Number(raw);
12566
+ return yield* Number.isInteger(parsed) && parsed >= 1 ? succeed$1(parsed) : new BadOption({
12567
+ option: name,
12568
+ given: raw,
12569
+ allowed: ["a whole number of 1 or more"]
12570
+ });
12571
+ });
12572
+ seconds = fn("Cli.seconds")(function* (options, name) {
12573
+ const raw = options[name];
12574
+ if (raw === void 0) return 0;
12575
+ const asked = Number(raw);
12576
+ return yield* Number.isInteger(asked) && asked >= 1 && asked <= 86400 ? succeed$1(asked) : new BadOption({
12577
+ option: name,
12578
+ given: raw,
12579
+ allowed: [`a whole number of seconds from 1 to ${WAIT_MOST}`]
12580
+ });
12581
+ });
12570
12582
  })), ADVICE, FALLBACK, tagOf, project, fieldsOf, narrow, keysIn, strangeField, sharpen, failure;
12571
12583
  var init_report$1 = __esmMin((() => {
12572
12584
  ADVICE = {
@@ -19967,7 +19979,7 @@ const commentReply = fn("Main.commentReply")(function* (options) {
19967
19979
  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 '…'`.";
19968
19980
  const commentTake = fn("Main.commentTake")(function* (options) {
19969
19981
  const worktree = yield* required(options, "worktree");
19970
- const wait = Number(options["wait"] ?? 0);
19982
+ const wait = yield* seconds(options, "wait");
19971
19983
  const comments = wait > 0 ? yield* awaitComments(worktree, Date.now() + wait * WAIT_UNIT) : yield* takeComments(worktree);
19972
19984
  const hint = comments.length === 0 ? { hint: NOTHING_WAITING } : {};
19973
19985
  yield* answer(options, {
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.140",
26
+ "version": "0.1.0-alpha.141",
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": {
@@ -37,6 +37,14 @@ adiff comment take --worktree . --wait 300
37
37
  Blocks until a comment arrives or the timeout in seconds elapses, then returns the same envelope.
38
38
  An empty `comments` array means the wait expired with nothing new — that is not an error.
39
39
 
40
+ `--wait` takes a whole number of seconds from 1 to 86400. A value outside that is refused on
41
+ stderr with exit 2, because an instant empty answer would read exactly like a wait that expired:
42
+ if a wait comes back at once, you are not waiting.
43
+
44
+ Arm the wait as the first thing you do in a turn, before the work. A turn that is interrupted
45
+ half-way then still leaves a listener running, and a wait armed at the end of a turn is a wait that
46
+ often never gets armed.
47
+
40
48
  Run the wait in the background, not in the foreground. A foreground wait holds the turn, so you
41
49
  cannot do anything else and the person you are working with cannot talk to you. Backgrounded, the
42
50
  harness brings you back the moment a comment lands.
@@ -49,6 +57,10 @@ Re-arm it after each comment you handle, and keep it running while you work. A r
49
57
  their own pace, so comments arrive minutes apart, and the whole point is that they reach you as
50
58
  events rather than by you asking. When you finish a piece of work, say you are still listening.
51
59
 
60
+ A backgrounded wait that is killed rather than expiring is not the reviewer going quiet, and not a
61
+ reason to stop listening. A kill loses whatever the wait would have handed you, so take once
62
+ without `--wait` to collect what landed, then arm a new wait.
63
+
52
64
  ## Answering a comment
53
65
 
54
66
  Say what you did, against the comment you were handed:
@@ -245,6 +257,15 @@ with:
245
257
  adiff layers show --worktree . --fields covered,partial,total,uncovered
246
258
  ```
247
259
 
260
+ `uncovered` does not always empty out by claiming lines you can see. A deleted line is counted at
261
+ the number it had in the old file, so a branch that cuts a file from 409 lines to 394 reports an
262
+ uncovered run at 395-409 — line numbers past the end of the file as it now stands. A span over the
263
+ new file cannot reach them; only a span whose `end` runs past the end of the file can. Write one, or
264
+ say the run is unreachable, rather than reading the leftover as a layer you forgot.
265
+
266
+ That is also the case for spans generally: `start` 1 to past the last line covers a file whatever
267
+ happens to it, while a tight range goes stale on the next push that moves the lines under it.
268
+
248
269
  Setting layers again supersedes the previous set and bumps `version`; the set records the commit it
249
270
  was written for, and adiff reports it as `stale` once the branch moves past that commit. Once a
250
271
  reviewer has a reading order, keep it true: write it again after you address their comments.