@eliya-oss/agent-diff 0.1.0-alpha.154 → 0.1.0-alpha.155

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
@@ -1,5 +1,30 @@
1
1
  # @eliya-oss/agent-diff
2
2
 
3
+ ## 0.1.0-alpha.155
4
+
5
+ ### Patch Changes
6
+
7
+ - feat(report): a bug report says the base, the preferences away from their default, what the reading order holds, whether remarks are read, the shape of the file on screen, and the slowest actions.
8
+
9
+ <details><summary>Why</summary>
10
+
11
+ Two reports cost a day between them. Neither said which base the diff was computed against, that the
12
+ branch had a reading order at all, or whether the slow thing took three seconds or thirty — so each
13
+ one had to be reproduced by hand against a real repository before it could be read. Counts, spans,
14
+ flags and timings name nothing, so they are in a minimal report too; a layer's title is the agent's
15
+ prose, so a minimal report says which layer by number.
16
+
17
+ </details>
18
+
19
+ feat(CLI): `layers set` says how many hunks more than one layer claims, which coverage cannot express.
20
+
21
+ <details><summary>Why</summary>
22
+
23
+ A reading order whose layers all claim the whole diff reports perfect coverage, and so does one
24
+ whose layers each claim their own run. The number that tells them apart was the one nothing counted.
25
+
26
+ </details>
27
+
3
28
  ## 0.1.0-alpha.154
4
29
 
5
30
  ### Patch Changes
package/dist/main.js CHANGED
@@ -11309,7 +11309,7 @@ var init_pane = __esmMin((() => {
11309
11309
  //#region package.json
11310
11310
  init_drafts();
11311
11311
  init_pane();
11312
- var version$1 = "0.1.0-alpha.154";
11312
+ var version$1 = "0.1.0-alpha.155";
11313
11313
  //#endregion
11314
11314
  //#region src/cli/upgrade.ts
11315
11315
  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$1, newer, tagIn, fetched, askLatest, here, findUpgrade, willUpgrade, ranChild, runUpgrade, statusOf$1, sayFound, sayDone, attempted, SAY_SKILL_TOO, upgradeReport;
@@ -11715,7 +11715,7 @@ var init_model$1 = __esmMin((() => {
11715
11715
  }));
11716
11716
  //#endregion
11717
11717
  //#region src/domain/layers/coverage.ts
11718
- var codeBlockOf$1, codeBlocks, noteOf, spansOf$1, changedLines, holds, runsOf, tallyOf, coverage, runsSaid, filesSaid, leftSaid, unordered, withFullCoverage, proseAnchors;
11718
+ var codeBlockOf$1, codeBlocks, noteOf, spansOf$1, changedLines, holds, claimsHunk, runsOf, tallyOf, coverage, sharedHunks, runsSaid, filesSaid, leftSaid, unordered, withFullCoverage, proseAnchors;
11719
11719
  var init_coverage = __esmMin((() => {
11720
11720
  init_dist();
11721
11721
  init_model$1();
@@ -11737,6 +11737,7 @@ var init_coverage = __esmMin((() => {
11737
11737
  onSome: (line) => [line]
11738
11738
  }));
11739
11739
  holds = (span, path, line) => span.path === path && span.start <= line && span.end >= line;
11740
+ claimsHunk = (spans, path, hunk) => changedLines(hunk).some((line) => spans.some((span) => holds(span, path, line)));
11740
11741
  runsOf = (path, lines) => {
11741
11742
  const runs = [];
11742
11743
  for (const line of lines.toSorted((a, b) => a - b)) {
@@ -11771,6 +11772,10 @@ var init_coverage = __esmMin((() => {
11771
11772
  missing: tallies.flatMap((tally) => tally.missing)
11772
11773
  };
11773
11774
  };
11775
+ sharedHunks = (patches, layers) => {
11776
+ const claiming = (patch, hunk) => layers.filter((layer) => claimsHunk(spansOf$1([layer]), patch.path, hunk)).length;
11777
+ return patches.reduce((sum, patch) => sum + patch.hunks.filter((hunk) => changedLines(hunk).length > 0 && claiming(patch, hunk) > 1).length, 0);
11778
+ };
11774
11779
  runsSaid = (count) => count === 1 ? "One run of changed lines the layers do not account for." : `${count} runs of changed lines the layers do not account for.`;
11775
11780
  filesSaid = (count) => count === 1 ? "One file the layers had no lines to order." : `${count} files the layers had no lines to order.`;
11776
11781
  leftSaid = (runs, files) => {
@@ -12003,6 +12008,7 @@ var init_layers = __esmMin((() => {
12003
12008
  partial: status.partial,
12004
12009
  total: status.total,
12005
12010
  uncovered: status.uncovered,
12011
+ shared: sharedHunks(patches, layers.layers),
12006
12012
  vanished: status.vanished,
12007
12013
  layers: reportedLayers(patches, layers)
12008
12014
  };
@@ -14757,10 +14763,11 @@ var init_model = __esmMin((() => {
14757
14763
  }));
14758
14764
  //#endregion
14759
14765
  //#region src/tui/report.ts
14760
- var AROUND_CURSOR, TREE_ROWS, sign, visibleRows, visibleTree, whereabouts, facts, fenced, fully, minimal, lastFailure, buildReport;
14766
+ var AROUND_CURSOR, TREE_ROWS, sign, visibleRows, visibleTree, whereabouts, said$1, chosenAway, standingOn, layersLine, remarksLine, shapeLine, tookLine, facts, fenced, fully, minimal, lastFailure, buildReport;
14761
14767
  var init_report = __esmMin((() => {
14762
14768
  init_dist();
14763
14769
  init_model();
14770
+ init_preferences();
14764
14771
  AROUND_CURSOR = 8;
14765
14772
  TREE_ROWS = 12;
14766
14773
  sign = (kind) => {
@@ -14784,15 +14791,49 @@ var init_report = __esmMin((() => {
14784
14791
  });
14785
14792
  whereabouts = (state, around) => [
14786
14793
  `- repo \`${around.repo}\``,
14787
- `- branch \`${selectedBranch(state)?.branch ?? "none"}\``,
14794
+ `- branch \`${selectedBranch(state)?.branch ?? "none"}\`, base \`${around.base.length === 0 ? "resolved by adiff" : around.base}\``,
14788
14795
  `- file \`${selectedPatch(state)?.path ?? "none"}\`, row ${state.cursor + 1}`
14789
14796
  ];
14797
+ said$1 = (many, one) => `${many} ${one}${many === 1 ? "" : "s"}`;
14798
+ chosenAway = (state) => {
14799
+ const held = chosenNow(state);
14800
+ const away = preferences.filter((one) => (held[one.name] ?? one.byDefault) !== one.byDefault);
14801
+ return away.length === 0 ? "every preference at its default" : away.map((one) => one.name).join(", ");
14802
+ };
14803
+ standingOn = (state) => {
14804
+ if (!state.reportFull) return `standing on layer ${state.layerIndex + 1}`;
14805
+ return `standing on \`${state.layers[state.layerIndex]?.title ?? "none"}\``;
14806
+ };
14807
+ layersLine = (state) => {
14808
+ if (state.layers.length === 0) return "- no reading order on this branch";
14809
+ const spans = state.layers.reduce((sum, layer) => sum + layer.spans.length, 0);
14810
+ return `- reading order: ${said$1(state.layers.length, "layer")} over ${said$1(spans, "span")}, rail on ${state.rail}, ${state.layersStale ? "stale" : "current"}, ${standingOn(state)}`;
14811
+ };
14812
+ remarksLine = (state) => {
14813
+ if (!state.remarksOn) return "- the pull request's remarks are off";
14814
+ const waiting = state.remarks.filter((one) => one.state === "waiting").length;
14815
+ return `- remarks on: ${said$1(state.remarks.length, "remark")}, ${waiting} waiting`;
14816
+ };
14817
+ shapeLine = (state) => {
14818
+ const hunks = selectedPatch(state)?.hunks.length ?? 0;
14819
+ const whole = state.context >= 1e5 ? "the whole file" : `${state.context} lines of context`;
14820
+ return `- this file: ${said$1(hunks, "hunk")} shown, ${whole}, ${state.wrap ? "wrapped" : "not wrapped"}`;
14821
+ };
14822
+ tookLine = (around) => {
14823
+ if (around.slowest.length === 0) return [];
14824
+ return [`- slowest: ${around.slowest.map((one) => `${one.action} ${one.ms}ms`).join(", ")}`];
14825
+ };
14790
14826
  facts = (state, around) => [
14791
14827
  `- adiff ${version$1} on Node ${process.version}, ${platform()}${state.reportFull ? `, ${hostname()}` : ""}`,
14792
14828
  `- terminal ${around.width}x${around.height}`,
14793
14829
  ...state.reportFull ? whereabouts(state, around) : [],
14794
14830
  `- screen \`${state.screen}\`, focus \`${state.focus}\`, selecting ${String(state.selecting)}`,
14795
- `- ${state.vouched.length} of ${state.patches.length} reviewed`
14831
+ `- ${state.vouched.length} of ${state.patches.length} reviewed`,
14832
+ `- preferences away from default: ${chosenAway(state)}`,
14833
+ layersLine(state),
14834
+ remarksLine(state),
14835
+ shapeLine(state),
14836
+ ...tookLine(around)
14796
14837
  ];
14797
14838
  fenced = (title, lines) => [
14798
14839
  `## ${title}`,
@@ -19363,7 +19404,7 @@ var init_upgrade = __esmMin((() => {
19363
19404
  }));
19364
19405
  //#endregion
19365
19406
  //#region src/tui/app.ts
19366
- var LEAVING_MS, LOOK_MS, LEAST_TERM, AGE_TICK_MS, LEAVING_SAID, NOTHING_WRITTEN, NOTHING_COUNTED, READING_PULL, FORGE_QUIET, countOf, leavingSaid, LAYERS_ASK_LEAD, layersAsk, askedFor, alongFrom, NOTICE_MS, KEY_HISTORY, DRAIN_PASSES, TRAIL_HISTORY, clockOf, momentOf, noticeOf, COPIERS, wayland, seedFor, handOver, throughMultiplexer, copyToClipboard, lineUnder, asKey, openedPull, LISTENS, WRITES, OVER, overReview, writesInto, listens, LETTER, laidOut, ARROWS, SHIFTED, keyName, App, sentAway, turnedOver, settledPath, restsWhereItLanded, lonelyGaps, chosenIn, settingsHeld, firstBranches, missing, openingOn, launch, told, untilDestroyed, runOn, runTui;
19407
+ var LEAVING_MS, LOOK_MS, LEAST_TERM, AGE_TICK_MS, LEAVING_SAID, NOTHING_WRITTEN, WORTH_TIMING_MS, TIMES_KEPT, SLOWEST_KEPT, NOTHING_COUNTED, READING_PULL, FORGE_QUIET, countOf, leavingSaid, LAYERS_ASK_LEAD, layersAsk, askedFor, alongFrom, NOTICE_MS, KEY_HISTORY, DRAIN_PASSES, TRAIL_HISTORY, clockOf, momentOf, noticeOf, COPIERS, wayland, seedFor, handOver, throughMultiplexer, copyToClipboard, lineUnder, asKey, openedPull, LISTENS, WRITES, OVER, overReview, writesInto, listens, LETTER, laidOut, ARROWS, SHIFTED, keyName, App, sentAway, turnedOver, settledPath, restsWhereItLanded, lonelyGaps, chosenIn, settingsHeld, firstBranches, missing, openingOn, launch, told, untilDestroyed, runOn, runTui;
19367
19408
  var init_app = __esmMin((() => {
19368
19409
  init_dist();
19369
19410
  init_report();
@@ -19387,6 +19428,9 @@ var init_app = __esmMin((() => {
19387
19428
  AGE_TICK_MS = 3e4;
19388
19429
  LEAVING_SAID = "press ctrl+c again to leave";
19389
19430
  NOTHING_WRITTEN = "nothing written yet";
19431
+ WORTH_TIMING_MS = 250;
19432
+ TIMES_KEPT = 40;
19433
+ SLOWEST_KEPT = 3;
19390
19434
  NOTHING_COUNTED = {
19391
19435
  file: 0,
19392
19436
  branch: 0,
@@ -19558,6 +19602,7 @@ var init_app = __esmMin((() => {
19558
19602
  ticking;
19559
19603
  grewWithShift = false;
19560
19604
  keys = [];
19605
+ took = [];
19561
19606
  trail = [];
19562
19607
  began = Date.now();
19563
19608
  fading;
@@ -19634,6 +19679,9 @@ var init_app = __esmMin((() => {
19634
19679
  noticeOnList() {
19635
19680
  return sync(() => this.commit(withWaiting(this.state, "the agent answered · press r")));
19636
19681
  }
19682
+ slowest() {
19683
+ return [...this.took].toSorted((left, right) => right.ms - left.ms).slice(0, SLOWEST_KEPT);
19684
+ }
19637
19685
  dispatchTask(task) {
19638
19686
  offerUnsafe(this.intents, Intent.Task({ run: task }));
19639
19687
  }
@@ -19641,7 +19689,17 @@ var init_app = __esmMin((() => {
19641
19689
  return runForEach(fromQueue(this.intents), (intent) => this.act(intent));
19642
19690
  }
19643
19691
  act(intent) {
19644
- return this.answer(intent).pipe(catchCause((cause) => sync(() => this.fail(squash(cause)))));
19692
+ const began = Date.now();
19693
+ return this.answer(intent).pipe(catchCause((cause) => sync(() => this.fail(squash(cause)))), ensuring(sync(() => this.timed(began))));
19694
+ }
19695
+ timed(began) {
19696
+ const ms = Date.now() - began;
19697
+ if (ms < WORTH_TIMING_MS) return;
19698
+ this.took.push({
19699
+ action: this.trail.at(-1)?.trim().split(/\s+/)[1] ?? "a key",
19700
+ ms
19701
+ });
19702
+ if (this.took.length > TIMES_KEPT) this.took.shift();
19645
19703
  }
19646
19704
  answer(intent) {
19647
19705
  return Intent.$match(intent, {
@@ -20833,6 +20891,8 @@ var init_app = __esmMin((() => {
20833
20891
  }
20834
20892
  const text = buildReport(this.state, {
20835
20893
  repo: this.repo,
20894
+ base: this.base ?? "",
20895
+ slowest: this.slowest(),
20836
20896
  keys: this.keys,
20837
20897
  trail: this.trail,
20838
20898
  failure: this.failure,
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.154",
26
+ "version": "0.1.0-alpha.155",
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": {
@@ -43,7 +43,7 @@
43
43
  "check": "pnpm run typecheck && pnpm run lint && pnpm run build && pnpm test",
44
44
  "build": "rolldown -c rolldown.config.ts",
45
45
  "typecheck": "tsc --noEmit",
46
- "lint": "oxlint && node scripts/check-rules.ts",
46
+ "lint": "oxlint && node scripts/check-rules.ts && node scripts/check-film.ts",
47
47
  "test": "NODE_OPTIONS=--experimental-ffi vitest run",
48
48
  "test:watch": "NODE_OPTIONS=--experimental-ffi vitest",
49
49
  "dev": "node --experimental-ffi --disable-warning=ExperimentalWarning src/main.ts",