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

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,19 @@
1
1
  # @eliya-oss/agent-diff
2
2
 
3
+ ## 0.1.0-alpha.153
4
+
5
+ ### Patch Changes
6
+
7
+ - fix(layers): a layer shows the runs it claims, and a change another layer explains is one line saying which layer that is.
8
+
9
+ <details><summary>What was wrong</summary>
10
+
11
+ Eleven layers over one file drew that file's whole diff eleven times, with the layer's words landing
12
+ somewhere different each time and nothing saying which part you were meant to be reading. A layer
13
+ whose runs sat at line 1,600 also opened at line 800 and left you to find them.
14
+
15
+ </details>
16
+
3
17
  ## 0.1.0-alpha.152
4
18
 
5
19
  ### 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.153";
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, 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)) {
@@ -13584,9 +13585,10 @@ const helpUnder = (noun) => {
13584
13585
  };
13585
13586
  //#endregion
13586
13587
  //#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;
13588
+ var sourceLength, markerText, lastNewLine, spansOf, linesFrom, push, markGap, openOf, countOf$1, openAbove, openBelow, changedIn, elsewhereText, markElsewhere, makeRows, compose, cache, keyOf$1, saidOf, claimOf, shownOf, gapAtRow, gapNumbered, gapRowSet;
13588
13589
  var init_gaps = __esmMin((() => {
13589
13590
  init_dist();
13591
+ init_layers$1();
13590
13592
  sourceLength = (source) => source.at(-1)?.trim() === "" ? source.length - 1 : source.length;
13591
13593
  markerText = (hidden) => {
13592
13594
  const said = `⋯ ${hidden} ${hidden === 1 ? "line" : "lines"} hidden`;
@@ -13663,6 +13665,19 @@ var init_gaps = __esmMin((() => {
13663
13665
  for (const row of linesFrom(build, span.lo, span.lo + open - 1)) push(made, row);
13664
13666
  if (count - open > 0) markGap(made, index, count - open);
13665
13667
  };
13668
+ changedIn = (hunk) => hunk.rows.filter((row) => row.kind !== "context").length;
13669
+ elsewhereText = (hunk, said) => {
13670
+ const lines = changedIn(hunk);
13671
+ return `⋯ ${lines} changed ${lines === 1 ? "line" : "lines"} · ${said}`;
13672
+ };
13673
+ markElsewhere = (made, hunk, said) => {
13674
+ push(made, {
13675
+ kind: "context",
13676
+ oldLine: none(),
13677
+ newLine: none(),
13678
+ text: elsewhereText(hunk, said)
13679
+ });
13680
+ };
13666
13681
  makeRows = (build) => {
13667
13682
  const made = {
13668
13683
  rows: [],
@@ -13671,6 +13686,11 @@ var init_gaps = __esmMin((() => {
13671
13686
  };
13672
13687
  for (const [index, hunk] of build.base.hunks.entries()) {
13673
13688
  const left = openAbove(made, build, index);
13689
+ const said = build.claim === void 0 || build.claim.claimed.has(index) ? void 0 : build.claim.explains.get(index) ?? "no layer claims them";
13690
+ if (said !== void 0) {
13691
+ markElsewhere(made, hunk, said);
13692
+ continue;
13693
+ }
13674
13694
  const startRow = made.rows.length;
13675
13695
  for (const row of hunk.rows) push(made, row);
13676
13696
  made.hunks.push({
@@ -13695,18 +13715,44 @@ var init_gaps = __esmMin((() => {
13695
13715
  };
13696
13716
  };
13697
13717
  cache = /* @__PURE__ */ new WeakMap();
13698
- keyOf$1 = (total, full, reveals) => [
13718
+ keyOf$1 = (total, full, reveals, claim) => [
13699
13719
  total,
13700
13720
  full === void 0 ? 0 : full.rows.length,
13701
- reveals.map((entry) => `${entry.gap}-${entry.lines}`).join(",")
13721
+ reveals.map((entry) => `${entry.gap}-${entry.lines}`).join(","),
13722
+ claim === void 0 ? "all" : [...claim.claimed].toSorted((a, b) => a - b).join("-")
13702
13723
  ].join(":");
13724
+ saidOf = (state, at) => {
13725
+ if (at === -1) return "no layer claims them";
13726
+ const layer = state.layers[at];
13727
+ if (layer === void 0 || layer.title === "not in any layer") return "no layer claims them";
13728
+ return `layer ${at + 1} explains them`;
13729
+ };
13730
+ claimOf = (state, base) => {
13731
+ if (state.rail !== "layers" || state.layers.length === 0) return void 0;
13732
+ const layer = state.layers[state.layerIndex];
13733
+ if (layer === void 0) return void 0;
13734
+ const claimed = /* @__PURE__ */ new Set();
13735
+ const explains = /* @__PURE__ */ new Map();
13736
+ for (const [at, hunk] of base.hunks.entries()) {
13737
+ if (claimsHunk(layer.spans, base.path, hunk)) {
13738
+ claimed.add(at);
13739
+ continue;
13740
+ }
13741
+ explains.set(at, saidOf(state, state.layers.findIndex((one) => claimsHunk(one.spans, base.path, hunk))));
13742
+ }
13743
+ return claimed.size === base.hunks.length ? void 0 : {
13744
+ claimed,
13745
+ explains
13746
+ };
13747
+ };
13703
13748
  shownOf = (state) => {
13704
13749
  const base = state.patches[state.patchIndex];
13705
13750
  if (base === void 0) return void 0;
13706
13751
  const full = state.full.find((patch) => patch.path === base.path);
13707
13752
  const total = sourceLength(state.source);
13708
13753
  const reveals = state.revealed.filter((entry) => entry.file === base.path);
13709
- const key = keyOf$1(total, full, reveals);
13754
+ const claim = claimOf(state, base);
13755
+ const key = keyOf$1(total, full, reveals, claim);
13710
13756
  const known = cache.get(base);
13711
13757
  const found = known?.get(key);
13712
13758
  if (found !== void 0) return found;
@@ -13714,7 +13760,8 @@ var init_gaps = __esmMin((() => {
13714
13760
  base,
13715
13761
  full,
13716
13762
  spans: spansOf(base, total),
13717
- reveals
13763
+ reveals,
13764
+ claim
13718
13765
  });
13719
13766
  const map = known ?? /* @__PURE__ */ new Map();
13720
13767
  map.set(key, made);
@@ -15824,7 +15871,10 @@ var init_reduce = __esmMin((() => {
15824
15871
  patchIndex: landed.file,
15825
15872
  railScroll: -1,
15826
15873
  top: 0,
15827
- cursor: landingOn(state, landed.file),
15874
+ cursor: landingOn({
15875
+ ...state,
15876
+ layerIndex: landed.layer
15877
+ }, landed.file),
15828
15878
  anchorRow: 0,
15829
15879
  selecting: false
15830
15880
  };
@@ -15993,7 +16043,10 @@ var init_reduce = __esmMin((() => {
15993
16043
  const drawn = shownOf(held);
15994
16044
  if (drawn === void 0) return openingRow(state, patchIndex);
15995
16045
  const hidden = gapRowSet(drawn);
15996
- const at = drawn.patch.rows.findIndex((row) => !hidden.has(row.index) && carriesLine(row));
16046
+ const shows = (row) => !hidden.has(row.index) && carriesLine(row);
16047
+ const changed = onLayers(held) ? drawn.patch.rows.findIndex((row) => shows(row) && row.kind !== "context") : -1;
16048
+ if (changed !== -1) return changed;
16049
+ const at = drawn.patch.rows.findIndex(shows);
15997
16050
  return at === -1 ? openingRow(state, patchIndex) : at;
15998
16051
  };
15999
16052
  revealing = (state, patchIndex) => {
@@ -16020,7 +16073,10 @@ var init_reduce = __esmMin((() => {
16020
16073
  closed: revealing(state, next),
16021
16074
  patchIndex: next,
16022
16075
  top: 0,
16023
- cursor: landingOn(state, next),
16076
+ cursor: landingOn({
16077
+ ...state,
16078
+ layerIndex: layer
16079
+ }, next),
16024
16080
  anchorRow: 0,
16025
16081
  selecting: false
16026
16082
  };
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.153",
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": {