@eliya-oss/agent-diff 0.1.0-alpha.53 → 0.1.0-alpha.54

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,13 @@
1
1
  # @eliya-oss/agent-diff
2
2
 
3
+ ## 0.1.0-alpha.54
4
+
5
+ ### Patch Changes
6
+
7
+ - A review now follows its branch instead of the folder it was read in. State was keyed on the worktree path, so renaming a worktree — or checking the same branch out somewhere else — left the entire review behind with nothing on screen to say it had happened. The key is the repository and the branch now, where the repository is the common git directory every worktree of it shares, so all the worktrees of one repo agree on where a review lives and different branches still keep their own. A store written under the old key is adopted the first time the branch is opened, so nothing already written is stranded.
8
+
9
+ - Comments handed to an agent that never answered them are no longer lost. The cursor advanced the moment `comment take` read a comment, so an agent that collected five and answered three left two that nothing would ever hand over again — and the terminal went on showing them as sent, with no sign anything was wrong. An answer is what retires a comment now, so one the agent dropped comes back on its next take and keeps coming back until it is answered. Settling or removing retires it too, since both are the reviewer saying they no longer need one. The branch list counts what the agent still owes rather than what it has yet to read, which is the number that was missing when a comment went quietly missing.
10
+
3
11
  ## 0.1.0-alpha.53
4
12
 
5
13
  ### Patch Changes
package/dist/main.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { randomUUID } from "node:crypto";
2
- import { appendFile, mkdir, readFile, realpath, writeFile } from "node:fs/promises";
2
+ import { appendFile, mkdir, readFile, realpath, rename, stat, writeFile } from "node:fs/promises";
3
3
  import { homedir, hostname, platform } from "node:os";
4
4
  import { text } from "node:stream/consumers";
5
5
  import { dirname, join, resolve } from "node:path";
@@ -8336,7 +8336,7 @@ var init_paths = __esmMin((() => {
8336
8336
  upgradePath = (root) => join(root, "upgrade.json");
8337
8337
  reportsDir = (root) => join(root, "reports");
8338
8338
  reportPath = (root, stamp) => join(reportsDir(root), `${stamp}.md`);
8339
- })), Store, ensureDir, readOptional, missing, damaged, jsonOf, decoded, asSettings, asUpgradeCheck, asBatch, asAnswer, asState, asLayers, linesOf, readLines, parseSettings, parseUpgradeCheck, parseState, parseLayers, cursorOps, settingsOps, upgradeOps, reportOps, HEAD_REF, headOf$1, keyOf$2, answerOps, layersOps, inboxOps, stateOps, makeStore, storeAt;
8339
+ })), Store, ensureDir, readOptional, missing, damaged, jsonOf, decoded, asSettings, asUpgradeCheck, asBatch, asAnswer, asState, asLayers, linesOf, readLines, parseSettings, parseUpgradeCheck, parseState, parseLayers, cursorOps, settingsOps, upgradeOps, reportOps, HEAD_REF, gitDirOf, headOf$1, repoOf$2, keyOf$2, wasKeyOf, there, adopted, moved, adopt, keyIn, answerOps, layersOps, inboxOps, stateOps, makeStore, storeAt;
8340
8340
  var init_service$1 = __esmMin((() => {
8341
8341
  init_dist();
8342
8342
  init_error$2();
@@ -8514,18 +8514,40 @@ var init_service$1 = __esmMin((() => {
8514
8514
  return path;
8515
8515
  });
8516
8516
  HEAD_REF = /^ref:\s*refs\/heads\/(.+)$/;
8517
- headOf$1 = (worktreePath) => readFile(join(worktreePath, ".git"), "utf8").then((raw) => {
8517
+ gitDirOf = (worktreePath) => readFile(join(worktreePath, ".git"), "utf8").then((raw) => {
8518
8518
  const linked = raw.match(/^gitdir:\s*(.+)$/m);
8519
8519
  return linked?.[1] === void 0 ? join(worktreePath, ".git") : linked[1].trim();
8520
- }).catch(() => join(worktreePath, ".git")).then((dir) => readFile(join(dir, "HEAD"), "utf8")).then((raw) => {
8520
+ }).catch(() => join(worktreePath, ".git"));
8521
+ headOf$1 = (worktreePath) => gitDirOf(worktreePath).then((dir) => readFile(join(dir, "HEAD"), "utf8")).then((raw) => {
8521
8522
  const named = raw.trim().match(HEAD_REF);
8522
8523
  return named?.[1] === void 0 ? raw.trim() : named[1];
8523
8524
  }).catch(() => "");
8524
- keyOf$2 = (worktreePath) => promise(() => headOf$1(worktreePath).then((head) => `${worktreePath}#${head}`));
8525
+ repoOf$2 = (worktreePath) => gitDirOf(worktreePath).then((dir) => readFile(join(dir, "commondir"), "utf8").then((raw) => resolve(dir, raw.trim())).catch(() => dir));
8526
+ keyOf$2 = (worktreePath) => promise(() => Promise.all([repoOf$2(worktreePath), headOf$1(worktreePath)]).then(([repo, head]) => `${repo}#${head}`));
8527
+ wasKeyOf = (worktreePath) => promise(() => headOf$1(worktreePath).then((head) => `${worktreePath}#${head}`));
8528
+ there = (path) => stat(path).then(() => true, () => false);
8529
+ adopted = /* @__PURE__ */ new Set();
8530
+ moved = (from, to) => rename(from, to).catch(() => void 0);
8531
+ adopt = fn("Store.adopt")(function* (root, key, was) {
8532
+ const here = branchDir(root, key);
8533
+ if (yield* promise(() => there(here))) return key;
8534
+ const older = branchDir(root, was);
8535
+ if (!(yield* promise(() => there(older)))) return key;
8536
+ yield* promise(() => moved(older, here));
8537
+ return key;
8538
+ });
8539
+ keyIn = (root, worktreePath) => gen(function* () {
8540
+ const key = yield* keyOf$2(worktreePath);
8541
+ const mark = `${root}#${key}`;
8542
+ if (adopted.has(mark)) return key;
8543
+ adopted.add(mark);
8544
+ const was = yield* wasKeyOf(worktreePath);
8545
+ return key === was ? key : yield* adopt(root, key, was);
8546
+ });
8525
8547
  answerOps = (root) => {
8526
8548
  return {
8527
8549
  answer: fn("Store.answer")(function* (worktreePath, entry) {
8528
- const key = yield* keyOf$2(worktreePath);
8550
+ const key = yield* keyIn(root, worktreePath);
8529
8551
  const path = outboxPath(root, key);
8530
8552
  yield* ensureDir(branchDir(root, key));
8531
8553
  yield* tryPromise({
@@ -8537,7 +8559,7 @@ var init_service$1 = __esmMin((() => {
8537
8559
  });
8538
8560
  }),
8539
8561
  answers: fn("Store.answers")(function* (worktreePath) {
8540
- const key = yield* keyOf$2(worktreePath);
8562
+ const key = yield* keyIn(root, worktreePath);
8541
8563
  const path = outboxPath(root, key);
8542
8564
  const raw = yield* readOptional(path);
8543
8565
  return yield* match$3(raw, {
@@ -8550,14 +8572,14 @@ var init_service$1 = __esmMin((() => {
8550
8572
  layersOps = (root) => {
8551
8573
  return {
8552
8574
  layers: fn("Store.layers")(function* (worktreePath) {
8553
- const key = yield* keyOf$2(worktreePath);
8575
+ const key = yield* keyIn(root, worktreePath);
8554
8576
  const path = layersPath(root, key);
8555
8577
  const raw = yield* readOptional(path);
8556
8578
  if (isNone(raw)) return none();
8557
8579
  return some(yield* parseLayers(path, raw.value));
8558
8580
  }),
8559
8581
  saveLayers: fn("Store.saveLayers")(function* (worktreePath, next) {
8560
- const key = yield* keyOf$2(worktreePath);
8582
+ const key = yield* keyIn(root, worktreePath);
8561
8583
  const path = layersPath(root, key);
8562
8584
  yield* ensureDir(branchDir(root, key));
8563
8585
  yield* tryPromise({
@@ -8573,7 +8595,7 @@ var init_service$1 = __esmMin((() => {
8573
8595
  inboxOps = (root) => {
8574
8596
  return {
8575
8597
  submit: fn("Store.submit")(function* (worktreePath, batch) {
8576
- const key = yield* keyOf$2(worktreePath);
8598
+ const key = yield* keyIn(root, worktreePath);
8577
8599
  const path = inboxPath(root, key);
8578
8600
  yield* ensureDir(branchDir(root, key));
8579
8601
  yield* tryPromise({
@@ -8585,7 +8607,7 @@ var init_service$1 = __esmMin((() => {
8585
8607
  });
8586
8608
  }),
8587
8609
  inbox: fn("Store.inbox")(function* (worktreePath) {
8588
- const key = yield* keyOf$2(worktreePath);
8610
+ const key = yield* keyIn(root, worktreePath);
8589
8611
  const path = inboxPath(root, key);
8590
8612
  const raw = yield* readOptional(path);
8591
8613
  return yield* match$3(raw, {
@@ -8598,7 +8620,7 @@ var init_service$1 = __esmMin((() => {
8598
8620
  stateOps = (root) => {
8599
8621
  return {
8600
8622
  state: fn("Store.state")(function* (worktreePath) {
8601
- const key = yield* keyOf$2(worktreePath);
8623
+ const key = yield* keyIn(root, worktreePath);
8602
8624
  const path = statePath(root, key);
8603
8625
  const raw = yield* readOptional(path);
8604
8626
  return yield* match$3(raw, {
@@ -8607,7 +8629,7 @@ var init_service$1 = __esmMin((() => {
8607
8629
  });
8608
8630
  }),
8609
8631
  saveState: fn("Store.saveState")(function* (worktreePath, next) {
8610
- const key = yield* keyOf$2(worktreePath);
8632
+ const key = yield* keyIn(root, worktreePath);
8611
8633
  const path = statePath(root, key);
8612
8634
  yield* ensureDir(branchDir(root, key));
8613
8635
  yield* tryPromise({
@@ -9236,7 +9258,7 @@ var init_pane = __esmMin((() => {
9236
9258
  init_commands();
9237
9259
  init_init();
9238
9260
  init_pane();
9239
- var version$1 = "0.1.0-alpha.53";
9261
+ var version$1 = "0.1.0-alpha.54";
9240
9262
  //#endregion
9241
9263
  //#region src/cli/upgrade.ts
9242
9264
  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;
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.53",
26
+ "version": "0.1.0-alpha.54",
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": {