@eliya-oss/agent-diff 0.1.0-alpha.188 → 0.1.0-alpha.189

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.189
4
+
5
+ ### Patch Changes
6
+
7
+ - perf(CLI): `adiff serve` answers a repeated question in half the time, by remembering for a moment what git already said.
8
+
9
+ <details><summary>Measured</summary>
10
+
11
+ On a 20-file branch, through one `adiff serve`: `comment list` 214ms to 104ms, `review progress` 216ms to 102ms, the four calls a review page makes at once 300ms to 147ms, and one whole file 240ms to 117ms. The first read of a branch, while nothing is remembered yet, fell from 1112ms to 627ms, because the default branch is now found by checking every candidate at once. Heads are never remembered, so a commit or a new branch shows on the next request.
12
+
13
+ </details>
14
+
3
15
  ## 0.1.0-alpha.188
4
16
 
5
17
  ### Patch Changes
package/dist/main.js CHANGED
@@ -10044,7 +10044,7 @@ var init_config = __esmMin((() => {
10044
10044
  //#region package.json
10045
10045
  init_pane();
10046
10046
  init_config();
10047
- var version$1 = "0.1.0-alpha.188";
10047
+ var version$1 = "0.1.0-alpha.189";
10048
10048
  //#endregion
10049
10049
  //#region src/cli/error.ts
10050
10050
  var UnknownCommand, MissingOption, UnknownField, UnknownOption, BadOption, RegistryUnanswered, NotServed, BadRequest;
@@ -11982,7 +11982,7 @@ var init_run = __esmMin((() => {
11982
11982
  gitOrEmpty = fn("Git.runOrEmpty")(function* (cwd, args) {
11983
11983
  return yield* git(cwd, args).pipe(catchTag("GitCommandFailed", () => succeed$1("")));
11984
11984
  });
11985
- })), CACHE_SIZE, NAME_TTL, FRESH_TTL, SPLIT$1, DEFAULT_BRANCH_CANDIDATES, PLAIN_PATHS, STAT, Git, parseStat, readEntries, findDefaultBranch, partsOf$1, findMergeBase, toWorktree, branchTips, findParent, splitLines, absent, readText, settled, seenAs, listWorktrees, readDiff, readStat, readSource, readBlob, readGrep, GENERATED_SAID, markedGenerated, readGenerated, findRepo, LINKED_GIT_DIR, HEAD_REF, gitDirOf, findCommonDir, readHead, REFS_MOST, readCommits, readRefs, refResolves, sharedCommit, makeCaches, shapeWith, makeGit, GitLive;
11985
+ })), CACHE_SIZE, NAME_TTL, FRESH_TTL, SPLIT$1, DEFAULT_BRANCH_CANDIDATES, PLAIN_PATHS, STAT, Git, parseStat, readEntries, verifiedIn, findDefaultBranch, partsOf$1, findMergeBase, toWorktree, branchTips, findParent, splitLines, absent, readText, settled, seenAs, listWorktrees, readDiff, readStat, readSource, readBlob, readGrep, GENERATED_SAID, markedGenerated, readGenerated, askRepo, LINKED_GIT_DIR, HEAD_REF, gitDirOf, findCommonDir, readHead, REFS_MOST, readCommits, readRefs, refResolves, sharedCommit, makeCaches, shapeWith, makeGit, GitLive;
11986
11986
  var init_service$2 = __esmMin((() => {
11987
11987
  init_dist();
11988
11988
  init_error$4();
@@ -12025,15 +12025,15 @@ var init_service$2 = __esmMin((() => {
12025
12025
  }
12026
12026
  return entries;
12027
12027
  };
12028
+ verifiedIn = (repo, candidate) => map$1(gitOrEmpty(repo, [
12029
+ "rev-parse",
12030
+ "--verify",
12031
+ candidate
12032
+ ]), (said) => said.trim().length > 0);
12028
12033
  findDefaultBranch = fn("Git.findDefaultBranch")(function* (repo) {
12029
- const symbolic = yield* gitOrEmpty(repo, ["symbolic-ref", "refs/remotes/origin/HEAD"]);
12034
+ const [symbolic, verified] = yield* all([gitOrEmpty(repo, ["symbolic-ref", "refs/remotes/origin/HEAD"]), forEach(DEFAULT_BRANCH_CANDIDATES, (candidate) => verifiedIn(repo, candidate), { concurrency: "unbounded" })], { concurrency: 2 });
12030
12035
  if (symbolic.trim().length > 0) return symbolic.trim().replace("refs/remotes/", "");
12031
- for (const candidate of DEFAULT_BRANCH_CANDIDATES) if ((yield* gitOrEmpty(repo, [
12032
- "rev-parse",
12033
- "--verify",
12034
- candidate
12035
- ])).trim().length > 0) return candidate;
12036
- return "HEAD";
12036
+ return DEFAULT_BRANCH_CANDIDATES.find((_, at) => verified[at] === true) ?? "HEAD";
12037
12037
  });
12038
12038
  partsOf$1 = (key) => key.split(SPLIT$1);
12039
12039
  findMergeBase = fn("Git.mergeBase")(function* (key) {
@@ -12167,7 +12167,7 @@ var init_service$2 = __esmMin((() => {
12167
12167
  ]);
12168
12168
  return new Set(raw.split("\n").flatMap(markedGenerated));
12169
12169
  });
12170
- findRepo = fn("Git.repoOf")(function* (worktree) {
12170
+ askRepo = fn("Git.askRepo")(function* (worktree) {
12171
12171
  const trimmed = (yield* gitOrEmpty(worktree, [
12172
12172
  "rev-parse",
12173
12173
  "--path-format=absolute",
@@ -12222,14 +12222,16 @@ var init_service$2 = __esmMin((() => {
12222
12222
  "refs/remotes"
12223
12223
  ])).split("\n").map((line) => line.trim()).filter((line) => line.length > 0 && !line.endsWith("/HEAD"));
12224
12224
  });
12225
- refResolves = fn("Git.resolves")(function* (repo, ref) {
12225
+ refResolves = fn("Git.resolves")(function* (asked) {
12226
+ const [repo = "", ref = ""] = asked.split(SPLIT$1);
12226
12227
  return (yield* gitOrEmpty(repo, [
12227
12228
  "rev-parse",
12228
12229
  "--verify",
12229
12230
  `${ref}^{commit}`
12230
12231
  ])).trim().length > 0;
12231
12232
  });
12232
- sharedCommit = fn("Git.sharedWith")(function* (repo, branch, ref) {
12233
+ sharedCommit = fn("Git.sharedWith")(function* (asked) {
12234
+ const [repo = "", branch = "", ref = ""] = asked.split(SPLIT$1);
12233
12235
  return (yield* gitOrEmpty(repo, [
12234
12236
  "merge-base",
12235
12237
  branch,
@@ -12252,12 +12254,27 @@ var init_service$2 = __esmMin((() => {
12252
12254
  capacity: CACHE_SIZE,
12253
12255
  timeToLive: FRESH_TTL,
12254
12256
  lookup: findParent
12257
+ }),
12258
+ resolved: yield* make$11({
12259
+ capacity: CACHE_SIZE,
12260
+ timeToLive: FRESH_TTL,
12261
+ lookup: refResolves
12262
+ }),
12263
+ shared: yield* make$11({
12264
+ capacity: CACHE_SIZE,
12265
+ timeToLive: FRESH_TTL,
12266
+ lookup: sharedCommit
12267
+ }),
12268
+ repos: yield* make$11({
12269
+ capacity: CACHE_SIZE,
12270
+ timeToLive: NAME_TTL,
12271
+ lookup: askRepo
12255
12272
  })
12256
12273
  };
12257
12274
  });
12258
12275
  shapeWith = (caches) => ({
12259
12276
  worktrees: (repo) => listWorktrees(caches, repo),
12260
- repoOf: findRepo,
12277
+ repoOf: (worktree) => get(caches.repos, worktree),
12261
12278
  commonDirOf: findCommonDir,
12262
12279
  realPathOf: settled,
12263
12280
  headOf: readHead,
@@ -12271,8 +12288,8 @@ var init_service$2 = __esmMin((() => {
12271
12288
  stackParent: (repo, branch) => get(caches.baseName, repo).pipe(flatMap((fallback) => get(caches.parent, `${repo}${SPLIT$1}${branch}${SPLIT$1}${fallback}`))),
12272
12289
  refs: readRefs,
12273
12290
  commits: (repo, branch, most) => readCommits(repo, branch, most),
12274
- resolves: refResolves,
12275
- sharedWith: sharedCommit
12291
+ resolves: (repo, ref) => get(caches.resolved, `${repo}${SPLIT$1}${ref}`),
12292
+ sharedWith: (repo, branch, ref) => get(caches.shared, `${repo}${SPLIT$1}${branch}${SPLIT$1}${ref}`)
12276
12293
  });
12277
12294
  makeGit = fn("Git.make")(function* () {
12278
12295
  return shapeWith(yield* makeCaches());
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.188",
26
+ "version": "0.1.0-alpha.189",
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": {