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

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,33 @@
1
1
  # @eliya-oss/agent-diff
2
2
 
3
+ ## 0.1.0-alpha.154
4
+
5
+ ### Patch Changes
6
+
7
+ - fix(layers): a layer shows the changed lines it claims, and the lines another layer claims are one line saying which layer that is, even inside the run it is showing.
8
+
9
+ <details><summary>What was wrong</summary>
10
+
11
+ A reading order written one layer to a commit splits a long run of changed lines between several
12
+ layers. Scoping a layer to whole runs still drew all of a 276-line run for every layer that claimed
13
+ any line of it, so a reviewer walking eleven commits read the same block eleven times.
14
+
15
+ </details>
16
+
17
+ ## 0.1.0-alpha.153
18
+
19
+ ### Patch Changes
20
+
21
+ - fix(layers): a layer shows the runs it claims, and a change another layer explains is one line saying which layer that is.
22
+
23
+ <details><summary>What was wrong</summary>
24
+
25
+ Eleven layers over one file drew that file's whole diff eleven times, with the layer's words landing
26
+ somewhere different each time and nothing saying which part you were meant to be reading. A layer
27
+ whose runs sat at line 1,600 also opened at line 800 and left you to find them.
28
+
29
+ </details>
30
+
3
31
  ## 0.1.0-alpha.152
4
32
 
5
33
  ### 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.152";
11312
+ var version$1 = "0.1.0-alpha.154";
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;
@@ -13584,9 +13584,10 @@ const helpUnder = (noun) => {
13584
13584
  };
13585
13585
  //#endregion
13586
13586
  //#region src/tui/gaps.ts
13587
- var sourceLength, markerText, lastNewLine, spansOf, linesFrom, push, markGap, openOf, countOf$1, openAbove, openBelow, makeRows, compose, cache, keyOf$1, shownOf, gapAtRow, gapNumbered, gapRowSet;
13587
+ var sourceLength, markerText, lastNewLine, spansOf, linesFrom, push, markGap, openOf, countOf$1, openAbove, openBelow, elsewhereText, markElsewhere, flushed, someRows, changedIn, firstChanged, makeRows, compose, cache, keyOf$1, saidOf, lineOf$1, inSpans, spansFor, claimOf, shownOf, gapAtRow, gapNumbered, gapRowSet;
13588
13588
  var init_gaps = __esmMin((() => {
13589
13589
  init_dist();
13590
+ init_layers$1();
13590
13591
  sourceLength = (source) => source.at(-1)?.trim() === "" ? source.length - 1 : source.length;
13591
13592
  markerText = (hidden) => {
13592
13593
  const said = `⋯ ${hidden} ${hidden === 1 ? "line" : "lines"} hidden`;
@@ -13663,6 +13664,35 @@ var init_gaps = __esmMin((() => {
13663
13664
  for (const row of linesFrom(build, span.lo, span.lo + open - 1)) push(made, row);
13664
13665
  if (count - open > 0) markGap(made, index, count - open);
13665
13666
  };
13667
+ elsewhereText = (lines, said) => `⋯ ${lines} changed ${lines === 1 ? "line" : "lines"} · ${said}`;
13668
+ markElsewhere = (made, lines, said) => {
13669
+ push(made, {
13670
+ kind: "context",
13671
+ oldLine: none(),
13672
+ newLine: none(),
13673
+ text: elsewhereText(lines, said)
13674
+ });
13675
+ };
13676
+ flushed = (made, run) => {
13677
+ if (run !== void 0) markElsewhere(made, run.lines, run.said);
13678
+ };
13679
+ someRows = (made, hunk, claim) => {
13680
+ let run;
13681
+ for (const row of hunk.rows) {
13682
+ if (row.kind === "context" || claim.mine(row)) {
13683
+ run = flushed(made, run);
13684
+ push(made, row);
13685
+ continue;
13686
+ }
13687
+ run = {
13688
+ lines: (run?.lines ?? 0) + 1,
13689
+ said: run?.said ?? claim.said(row)
13690
+ };
13691
+ }
13692
+ flushed(made, run);
13693
+ };
13694
+ changedIn = (hunk) => hunk.rows.filter((row) => row.kind !== "context").length;
13695
+ firstChanged = (hunk) => hunk.rows.find((row) => row.kind !== "context");
13666
13696
  makeRows = (build) => {
13667
13697
  const made = {
13668
13698
  rows: [],
@@ -13671,8 +13701,15 @@ var init_gaps = __esmMin((() => {
13671
13701
  };
13672
13702
  for (const [index, hunk] of build.base.hunks.entries()) {
13673
13703
  const left = openAbove(made, build, index);
13704
+ const claim = build.claim;
13705
+ const gone = firstChanged(hunk);
13706
+ if (claim !== void 0 && gone !== void 0 && !claim.holds(hunk)) {
13707
+ markElsewhere(made, changedIn(hunk), claim.said(gone));
13708
+ continue;
13709
+ }
13674
13710
  const startRow = made.rows.length;
13675
- for (const row of hunk.rows) push(made, row);
13711
+ if (claim === void 0) for (const row of hunk.rows) push(made, row);
13712
+ else someRows(made, hunk, claim);
13676
13713
  made.hunks.push({
13677
13714
  ...hunk,
13678
13715
  startRow,
@@ -13695,18 +13732,49 @@ var init_gaps = __esmMin((() => {
13695
13732
  };
13696
13733
  };
13697
13734
  cache = /* @__PURE__ */ new WeakMap();
13698
- keyOf$1 = (total, full, reveals) => [
13735
+ keyOf$1 = (total, full, reveals, spans) => [
13699
13736
  total,
13700
13737
  full === void 0 ? 0 : full.rows.length,
13701
- reveals.map((entry) => `${entry.gap}-${entry.lines}`).join(",")
13738
+ reveals.map((entry) => `${entry.gap}-${entry.lines}`).join(","),
13739
+ spans.map((span) => `${span.start}-${span.end}`).join(",")
13702
13740
  ].join(":");
13741
+ saidOf = (state, at) => {
13742
+ if (at === -1) return "no layer claims them";
13743
+ const layer = state.layers[at];
13744
+ if (layer === void 0 || layer.title === "not in any layer") return "no layer claims them";
13745
+ return `layer ${at + 1} explains them`;
13746
+ };
13747
+ lineOf$1 = (row) => getOrUndefined$1(orElse(row.newLine, () => row.oldLine));
13748
+ inSpans = (spans, path, line) => spans.some((span) => span.path === path && span.start <= line && span.end >= line);
13749
+ spansFor = (state, path) => (state.layers[state.layerIndex]?.spans ?? []).filter((span) => span.path === path);
13750
+ claimOf = (state, base) => {
13751
+ if (state.rail !== "layers" || state.layers.length === 0) return void 0;
13752
+ if (state.layers[state.layerIndex] === void 0) return void 0;
13753
+ const mineSpans = spansFor(state, base.path);
13754
+ const mine = (row) => {
13755
+ const line = lineOf$1(row);
13756
+ return line !== void 0 && inSpans(mineSpans, base.path, line);
13757
+ };
13758
+ const said = (row) => {
13759
+ const line = lineOf$1(row);
13760
+ if (line === void 0) return "no layer claims them";
13761
+ return saidOf(state, state.layers.findIndex((one) => inSpans(one.spans, base.path, line)));
13762
+ };
13763
+ const holds = (hunk) => hunk.rows.some((row) => row.kind !== "context" && mine(row));
13764
+ return base.hunks.every(holds) && base.hunks.every((hunk) => hunk.rows.every((row) => row.kind === "context" || mine(row))) ? void 0 : {
13765
+ mine,
13766
+ said,
13767
+ holds
13768
+ };
13769
+ };
13703
13770
  shownOf = (state) => {
13704
13771
  const base = state.patches[state.patchIndex];
13705
13772
  if (base === void 0) return void 0;
13706
13773
  const full = state.full.find((patch) => patch.path === base.path);
13707
13774
  const total = sourceLength(state.source);
13708
13775
  const reveals = state.revealed.filter((entry) => entry.file === base.path);
13709
- const key = keyOf$1(total, full, reveals);
13776
+ const claim = claimOf(state, base);
13777
+ const key = keyOf$1(total, full, reveals, claim === void 0 ? [] : spansFor(state, base.path));
13710
13778
  const known = cache.get(base);
13711
13779
  const found = known?.get(key);
13712
13780
  if (found !== void 0) return found;
@@ -13714,7 +13782,8 @@ var init_gaps = __esmMin((() => {
13714
13782
  base,
13715
13783
  full,
13716
13784
  spans: spansOf(base, total),
13717
- reveals
13785
+ reveals,
13786
+ claim
13718
13787
  });
13719
13788
  const map = known ?? /* @__PURE__ */ new Map();
13720
13789
  map.set(key, made);
@@ -15824,7 +15893,10 @@ var init_reduce = __esmMin((() => {
15824
15893
  patchIndex: landed.file,
15825
15894
  railScroll: -1,
15826
15895
  top: 0,
15827
- cursor: landingOn(state, landed.file),
15896
+ cursor: landingOn({
15897
+ ...state,
15898
+ layerIndex: landed.layer
15899
+ }, landed.file),
15828
15900
  anchorRow: 0,
15829
15901
  selecting: false
15830
15902
  };
@@ -15993,7 +16065,10 @@ var init_reduce = __esmMin((() => {
15993
16065
  const drawn = shownOf(held);
15994
16066
  if (drawn === void 0) return openingRow(state, patchIndex);
15995
16067
  const hidden = gapRowSet(drawn);
15996
- const at = drawn.patch.rows.findIndex((row) => !hidden.has(row.index) && carriesLine(row));
16068
+ const shows = (row) => !hidden.has(row.index) && carriesLine(row);
16069
+ const changed = onLayers(held) ? drawn.patch.rows.findIndex((row) => shows(row) && row.kind !== "context") : -1;
16070
+ if (changed !== -1) return changed;
16071
+ const at = drawn.patch.rows.findIndex(shows);
15997
16072
  return at === -1 ? openingRow(state, patchIndex) : at;
15998
16073
  };
15999
16074
  revealing = (state, patchIndex) => {
@@ -16020,7 +16095,10 @@ var init_reduce = __esmMin((() => {
16020
16095
  closed: revealing(state, next),
16021
16096
  patchIndex: next,
16022
16097
  top: 0,
16023
- cursor: landingOn(state, next),
16098
+ cursor: landingOn({
16099
+ ...state,
16100
+ layerIndex: layer
16101
+ }, next),
16024
16102
  anchorRow: 0,
16025
16103
  selecting: false
16026
16104
  };
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.152",
26
+ "version": "0.1.0-alpha.154",
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": {