@eliya-oss/agent-diff 0.1.0-alpha.86 → 0.1.0-alpha.88

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,17 @@
1
1
  # @eliya-oss/agent-diff
2
2
 
3
+ ## 0.1.0-alpha.88
4
+
5
+ ### Patch Changes
6
+
7
+ - Sending a comment, settling a thread and removing one no longer re-read the whole branch from git. On a branch of 131 files: sending 220ms to 72ms, settling 162ms to 37ms, removing 171ms to 38ms.
8
+
9
+ ## 0.1.0-alpha.87
10
+
11
+ ### Patch Changes
12
+
13
+ - Marking a file reviewed no longer re-reads the whole branch from git, taking it from about 124ms to about 37ms on a branch of 131 files.
14
+
3
15
  ## 0.1.0-alpha.86
4
16
 
5
17
  ### Patch Changes
package/dist/main.js CHANGED
@@ -8565,12 +8565,14 @@ var init_service$2 = __esmMin((() => {
8565
8565
  }
8566
8566
  return found;
8567
8567
  });
8568
- readDiff = fn("Git.diff")(function* (worktree, context) {
8568
+ readDiff = fn("Git.diff")(function* (worktree, context, only) {
8569
8569
  const target = worktree.base.length > 0 ? worktree.base : "HEAD";
8570
+ const scope = only === void 0 ? [] : ["--", only];
8570
8571
  return yield* gitOrEmpty(worktree.path, [
8571
8572
  "diff",
8572
8573
  `-U${context}`,
8573
- target
8574
+ target,
8575
+ ...scope
8574
8576
  ]);
8575
8577
  });
8576
8578
  readStat = fn("Git.stat")(function* (worktree) {
@@ -9108,7 +9110,7 @@ var init_error$1 = __esmMin((() => {
9108
9110
  }));
9109
9111
  //#endregion
9110
9112
  //#region src/cli/commands.ts
9111
- var CONTEXT, WHOLE_FILE$1, POLL, AUTO, askedFor, basedOn, worktreeNamed, findBranch, baseFor, patchesOf, findPatch, rowsCovering, waitingOn, AT_ONCE, summaryOf, summaryFor, listBranches, blobOf, toggleVouch, readingOf, progressIn, reviewProgress, bodyOf, saidTo, spunOf, sentOf, sentIn, listSent, submitComment, without$1, submitReply, listPatches, flatten, threadBefore, takeComments, repoOf$1, worktreeOf$1, branchAt, awaitComments, saveReport, fileSource, fileBefore, saveWrap, saveSticky, setBase, clearBase, markRead;
9113
+ var CONTEXT, WHOLE_FILE$1, POLL, AUTO, askedFor, basedOn, worktreeNamed, findBranch, baseFor, patchesOf, findPatch, rowsCovering, waitingOn, AT_ONCE, summaryOf, summaryFor, listBranches, blobOf, vouchIn, toggleVouch, readingOf, progressIn, reviewProgress, bodyOf, saidTo, spunOf, sentOf, sentIn, listSent, commentIn, submitComment, without$1, submitReply, listPatches, flatten, threadBefore, takeComments, repoOf$1, worktreeOf$1, branchAt, awaitComments, saveReport, fileSource, fileBefore, saveWrap, saveSticky, setBase, clearBase, markRead;
9112
9114
  var init_commands = __esmMin((() => {
9113
9115
  init_dist();
9114
9116
  init_patch();
@@ -9191,8 +9193,8 @@ var init_commands = __esmMin((() => {
9191
9193
  baseFor = fn("Cli.baseFor")(function* (repo, branch, base) {
9192
9194
  return yield* basedOn(repo, yield* worktreeNamed(repo, branch), base);
9193
9195
  });
9194
- patchesOf = fn("Cli.patchesOf")(function* (worktree, context = CONTEXT) {
9195
- const raw = yield* (yield* Git).diff(worktree, context);
9196
+ patchesOf = fn("Cli.patchesOf")(function* (worktree, context = CONTEXT, only) {
9197
+ const raw = yield* (yield* Git).diff(worktree, context, only);
9196
9198
  return parsePatches(raw);
9197
9199
  });
9198
9200
  findPatch = (patches, file) => fromNullishOr(patches.find((patch) => patch.path === file));
@@ -9247,20 +9249,19 @@ var init_commands = __esmMin((() => {
9247
9249
  return (yield* forEach(worktrees, (found) => summaryOf(repo, found, base), { concurrency: AT_ONCE })).filter((summary) => summary.files > 0);
9248
9250
  });
9249
9251
  blobOf = (patches, file) => map$4(findPatch(patches, file), (patch) => patch.blob);
9250
- toggleVouch = fn("Cli.toggleVouch")(function* (request) {
9252
+ vouchIn = fn("Cli.vouchIn")(function* (reading, file) {
9251
9253
  const store = yield* Store;
9252
- const worktree = yield* findBranch(request.repo, request.branch);
9253
- const patches = yield* patchesOf(worktree);
9254
- const blob = yield* match$3(blobOf(patches, request.file), {
9254
+ const patches = reading.patches;
9255
+ const blob = yield* match$3(blobOf(patches, file), {
9255
9256
  onNone: () => new UnknownFile({
9256
- file: request.file,
9257
+ file,
9257
9258
  known: patches.map((patch) => patch.path)
9258
9259
  }),
9259
9260
  onSome: succeed$1
9260
9261
  });
9261
- const current = yield* store.state(worktree.path);
9262
- const next = vouch(current.vouches, request.file, blob);
9263
- yield* store.saveState(worktree.path, {
9262
+ const current = yield* store.state(reading.worktree.path);
9263
+ const next = vouch(current.vouches, file, blob);
9264
+ yield* store.saveState(reading.worktree.path, {
9264
9265
  ...current,
9265
9266
  vouches: next
9266
9267
  });
@@ -9268,10 +9269,13 @@ var init_commands = __esmMin((() => {
9268
9269
  vouched: patches.map((patch) => ({
9269
9270
  path: patch.path,
9270
9271
  blob: patch.blob
9271
- })).filter((file) => isVouched(next, file.path, file.blob)).map((file) => file.path),
9272
+ })).filter((one) => isVouched(next, one.path, one.blob)).map((one) => one.path),
9272
9273
  total: patches.length
9273
9274
  };
9274
9275
  });
9276
+ toggleVouch = fn("Cli.toggleVouch")(function* (request) {
9277
+ return yield* vouchIn(yield* readingOf(request.repo, request.branch), request.file);
9278
+ });
9275
9279
  readingOf = fn("Cli.readingOf")(function* (repo, branch, base) {
9276
9280
  const worktree = yield* findBranch(repo, branch, base);
9277
9281
  return {
@@ -9352,10 +9356,10 @@ var init_commands = __esmMin((() => {
9352
9356
  listSent = fn("Cli.listSent")(function* (repo, branch, base) {
9353
9357
  return yield* sentIn(yield* readingOf(repo, branch, base));
9354
9358
  });
9355
- submitComment = fn("Cli.submitComment")(function* (request) {
9359
+ commentIn = fn("Cli.commentIn")(function* (worktree, request) {
9356
9360
  const store = yield* Store;
9357
- const worktree = yield* findBranch(request.repo, request.branch);
9358
- const patches = yield* patchesOf(worktree, WHOLE_FILE$1);
9361
+ const only = yield* patchesOf(worktree, WHOLE_FILE$1, request.file);
9362
+ const patches = only.length > 0 ? only : yield* patchesOf(worktree, WHOLE_FILE$1);
9359
9363
  const patch = findPatch(patches, request.file);
9360
9364
  const resolved = yield* match$3(patch, {
9361
9365
  onNone: () => new UnknownFile({
@@ -9389,6 +9393,9 @@ var init_commands = __esmMin((() => {
9389
9393
  yield* store.submit(worktree.path, batch);
9390
9394
  return batch;
9391
9395
  });
9396
+ submitComment = fn("Cli.submitComment")(function* (request) {
9397
+ return yield* commentIn(yield* findBranch(request.repo, request.branch), request);
9398
+ });
9392
9399
  without$1 = (held, key) => Object.fromEntries(Object.entries(held).filter(([held_]) => held_ !== key));
9393
9400
  submitReply = fn("Cli.submitReply")(function* (request) {
9394
9401
  const store = yield* Store;
@@ -9804,7 +9811,7 @@ var init_pane = __esmMin((() => {
9804
9811
  init_commands();
9805
9812
  init_init();
9806
9813
  init_pane();
9807
- var version$1 = "0.1.0-alpha.86";
9814
+ var version$1 = "0.1.0-alpha.88";
9808
9815
  //#endregion
9809
9816
  //#region src/cli/upgrade.ts
9810
9817
  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, runUpgrade, statusOf$1, sayFound, sayDone, attempted, REFRESH_MS, refreshSkills, updatedIn, sayRefreshed, upgradeReport;
@@ -10372,7 +10379,7 @@ var init_layers = __esmMin((() => {
10372
10379
  }));
10373
10380
  //#endregion
10374
10381
  //#region src/cli/threads.ts
10375
- var stateOf$1, spoken$1, turnsOf, threadOf, threadsIn, idsIn, isKnown, listThreads, answerComment, settleThread, removeComment, without, restoreComment, settleRead;
10382
+ var stateOf$1, spoken$1, turnsOf, threadOf, threadsIn, idsIn, isKnown, listThreads, answerComment, settleIn, settleThread, removeIn, removeComment, without, restoreComment, settleRead;
10376
10383
  var init_threads = __esmMin((() => {
10377
10384
  init_dist();
10378
10385
  init_store();
@@ -10463,9 +10470,8 @@ var init_threads = __esmMin((() => {
10463
10470
  });
10464
10471
  return { answered: (yield* store.answers(worktree.path)).filter((entry) => entry.comment === request.id).length };
10465
10472
  });
10466
- settleThread = fn("Cli.settleThread")(function* (repo, branch, id, at) {
10473
+ settleIn = fn("Cli.settleIn")(function* (worktree, id, at) {
10467
10474
  const store = yield* Store;
10468
- const worktree = yield* findBranch(repo, branch);
10469
10475
  if (!(yield* isKnown(worktree.path, id))) return yield* new UnknownComment({ id });
10470
10476
  const current = yield* store.state(worktree.path);
10471
10477
  const replies = (yield* store.answers(worktree.path)).filter((entry) => entry.comment === id);
@@ -10482,9 +10488,11 @@ var init_threads = __esmMin((() => {
10482
10488
  });
10483
10489
  return { settled: id };
10484
10490
  });
10485
- removeComment = fn("Cli.removeComment")(function* (repo, branch, id, at) {
10491
+ settleThread = fn("Cli.settleThread")(function* (repo, branch, id, at) {
10492
+ return yield* settleIn(yield* findBranch(repo, branch), id, at);
10493
+ });
10494
+ removeIn = fn("Cli.removeIn")(function* (worktree, id, at) {
10486
10495
  const store = yield* Store;
10487
- const worktree = yield* findBranch(repo, branch);
10488
10496
  const current = yield* store.state(worktree.path);
10489
10497
  if (!(yield* isKnown(worktree.path, id))) return yield* new UnknownComment({ id });
10490
10498
  const replies = (yield* store.answers(worktree.path)).filter((entry) => entry.comment === id);
@@ -10501,6 +10509,9 @@ var init_threads = __esmMin((() => {
10501
10509
  });
10502
10510
  return { removed: id };
10503
10511
  });
10512
+ removeComment = fn("Cli.removeComment")(function* (repo, branch, id, at) {
10513
+ return yield* removeIn(yield* findBranch(repo, branch), id, at);
10514
+ });
10504
10515
  without = (entries, id) => Object.fromEntries(Object.entries(entries).filter(([key]) => key !== id));
10505
10516
  restoreComment = fn("Cli.restoreComment")(function* (repo, branch, id) {
10506
10517
  const store = yield* Store;
@@ -15913,6 +15924,7 @@ var init_app = __esmMin((() => {
15913
15924
  intents;
15914
15925
  consuming;
15915
15926
  failure = "";
15927
+ reading;
15916
15928
  renderer;
15917
15929
  repo;
15918
15930
  noticeMs;
@@ -16354,6 +16366,7 @@ var init_app = __esmMin((() => {
16354
16366
  readBranch(name) {
16355
16367
  return gen({ self: this }, function* () {
16356
16368
  const reading = yield* readingOf(this.repo, name);
16369
+ this.reading = reading;
16357
16370
  const [progress, layers, sent] = yield* all([
16358
16371
  progressIn(reading),
16359
16372
  layersIn(reading),
@@ -16523,7 +16536,7 @@ var init_app = __esmMin((() => {
16523
16536
  this.commit(withNotice(this.state, "no thread here"));
16524
16537
  return;
16525
16538
  }
16526
- yield* settleThread(this.repo, branch.branch, id, (/* @__PURE__ */ new Date()).toISOString());
16539
+ yield* this.settling(branch.branch, id);
16527
16540
  const sent = yield* this.loadSent(branch.branch);
16528
16541
  const held = withSent({
16529
16542
  ...this.state,
@@ -16563,7 +16576,7 @@ var init_app = __esmMin((() => {
16563
16576
  this.commit(withNotice(this.state, "no thread here"));
16564
16577
  return;
16565
16578
  }
16566
- yield* removeComment(this.repo, branch.branch, id, (/* @__PURE__ */ new Date()).toISOString());
16579
+ yield* this.removing(branch.branch, id);
16567
16580
  const sent = yield* this.loadSent(branch.branch);
16568
16581
  const held = withSent({
16569
16582
  ...this.state,
@@ -16682,11 +16695,7 @@ var init_app = __esmMin((() => {
16682
16695
  const branch = selectedBranch(this.state);
16683
16696
  const patch = selectedPatch(this.state);
16684
16697
  if (branch === void 0 || patch === void 0) return;
16685
- const report = yield* toggleVouch({
16686
- repo: this.repo,
16687
- branch: branch.branch,
16688
- file: patch.path
16689
- });
16698
+ const report = yield* this.vouching(branch.branch, patch.path);
16690
16699
  const marked = report.vouched.includes(patch.path);
16691
16700
  const next = withVouched(this.state, report.vouched);
16692
16701
  if (!advance) {
@@ -16701,8 +16710,35 @@ var init_app = __esmMin((() => {
16701
16710
  this.commit(withNotice(atFile(next, target), `marked ${patch.path}`));
16702
16711
  });
16703
16712
  }
16713
+ worktreeFor(branch) {
16714
+ const reading = this.reading;
16715
+ return reading === void 0 || reading.worktree.branch !== branch ? void 0 : reading.worktree;
16716
+ }
16717
+ commenting(branch, request) {
16718
+ const worktree = this.worktreeFor(branch);
16719
+ return worktree === void 0 ? submitComment(request) : commentIn(worktree, request);
16720
+ }
16721
+ settling(branch, id) {
16722
+ const at = (/* @__PURE__ */ new Date()).toISOString();
16723
+ const worktree = this.worktreeFor(branch);
16724
+ return worktree === void 0 ? settleThread(this.repo, branch, id, at) : settleIn(worktree, id, at);
16725
+ }
16726
+ removing(branch, id) {
16727
+ const at = (/* @__PURE__ */ new Date()).toISOString();
16728
+ const worktree = this.worktreeFor(branch);
16729
+ return worktree === void 0 ? removeComment(this.repo, branch, id, at) : removeIn(worktree, id, at);
16730
+ }
16731
+ vouching(branch, file) {
16732
+ const held = this.reading;
16733
+ return held === void 0 || held.worktree.branch !== branch ? toggleVouch({
16734
+ repo: this.repo,
16735
+ branch,
16736
+ file
16737
+ }) : vouchIn(held, file);
16738
+ }
16704
16739
  loadSent(branch) {
16705
- return listSent(this.repo, branch);
16740
+ const reading = this.reading;
16741
+ return reading === void 0 || reading.worktree.branch !== branch ? listSent(this.repo, branch) : sentIn(reading);
16706
16742
  }
16707
16743
  showPull() {
16708
16744
  return gen({ self: this }, function* () {
@@ -16833,7 +16869,7 @@ var init_app = __esmMin((() => {
16833
16869
  this.commit(withNotice(this.state, "nothing selected"));
16834
16870
  return;
16835
16871
  }
16836
- yield* submitComment({
16872
+ yield* this.commenting(branch.branch, {
16837
16873
  repo: this.repo,
16838
16874
  branch: branch.branch,
16839
16875
  file: patch.path,
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.86",
26
+ "version": "0.1.0-alpha.88",
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": {