@eliya-oss/agent-diff 0.1.0-alpha.27 → 0.1.0-alpha.28

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,11 @@
1
1
  # @eliya-oss/agent-diff
2
2
 
3
+ ## 0.1.0-alpha.28
4
+
5
+ ### Patch Changes
6
+
7
+ - An agent can open the review in a split pane beside the conversation.
8
+
3
9
  ## 0.1.0-alpha.27
4
10
 
5
11
  ### Minor Changes
package/dist/main.js CHANGED
@@ -13714,7 +13714,7 @@ const make$6 = (value) => {
13714
13714
  * @category general
13715
13715
  * @since 2.0.0
13716
13716
  */
13717
- const set$1 = /*#__PURE__*/ dual(2, (self, value) => {
13717
+ const set$2 = /*#__PURE__*/ dual(2, (self, value) => {
13718
13718
  self.current = value;
13719
13719
  return self;
13720
13720
  });
@@ -13922,7 +13922,7 @@ const subscribe = (self) => uninterruptible(contextWith((services) => {
13922
13922
  return addFinalizer(scope, unsubscribe(subscription)).pipe(andThen(addFinalizerExit(localScope, (exit) => close(scope, exit))), as(subscription));
13923
13923
  }));
13924
13924
  const unsubscribe = (self) => uninterruptible(withFiber((state) => {
13925
- set$1(self.shutdownFlag, true);
13925
+ set$2(self.shutdownFlag, true);
13926
13926
  return forEach(takeAll$2(self.pollers), (d) => interruptWith(d, state.id), {
13927
13927
  discard: true,
13928
13928
  concurrency: "unbounded"
@@ -16256,7 +16256,7 @@ const setUnsafe = (self, value) => {
16256
16256
  * @category setters
16257
16257
  * @since 2.0.0
16258
16258
  */
16259
- const set = /*#__PURE__*/ dual(2, (self, value) => self.semaphore.withPermit(sync(() => setUnsafe(self, value))));
16259
+ const set$1 = /*#__PURE__*/ dual(2, (self, value) => self.semaphore.withPermit(sync(() => setUnsafe(self, value))));
16260
16260
  String$1.pipe(brand("@adiff/Blob"));
16261
16261
  String$1.pipe(brand("@adiff/FilePath"));
16262
16262
  const lineOn = (row, side) => side === "new" ? row.newLine : row.oldLine;
@@ -17245,6 +17245,100 @@ const initRepository = fn("Cli.initRepository")(function* (request) {
17245
17245
  };
17246
17246
  });
17247
17247
  //#endregion
17248
+ //#region src/cli/pane.ts
17249
+ const TIMEOUT_MS$1 = 5e3;
17250
+ const set = (name) => (process.env[name] ?? "").length > 0;
17251
+ const splitters = [
17252
+ {
17253
+ pane: "tmux",
17254
+ binary: "tmux",
17255
+ present: () => set("TMUX"),
17256
+ args: (repo, run) => [
17257
+ "split-window",
17258
+ "-h",
17259
+ "-c",
17260
+ repo,
17261
+ ...run
17262
+ ]
17263
+ },
17264
+ {
17265
+ pane: "zellij",
17266
+ binary: "zellij",
17267
+ present: () => set("ZELLIJ"),
17268
+ args: (repo, run) => [
17269
+ "action",
17270
+ "new-pane",
17271
+ "-d",
17272
+ "right",
17273
+ "--cwd",
17274
+ repo,
17275
+ "--",
17276
+ ...run
17277
+ ]
17278
+ },
17279
+ {
17280
+ pane: "wezterm",
17281
+ binary: "wezterm",
17282
+ present: () => set("WEZTERM_PANE"),
17283
+ args: (repo, run) => [
17284
+ "cli",
17285
+ "split-pane",
17286
+ "--right",
17287
+ "--cwd",
17288
+ repo,
17289
+ "--",
17290
+ ...run
17291
+ ]
17292
+ },
17293
+ {
17294
+ pane: "kitty",
17295
+ binary: "kitten",
17296
+ present: () => set("KITTY_LISTEN_ON"),
17297
+ args: (repo, run) => [
17298
+ "@",
17299
+ "launch",
17300
+ "--type=window",
17301
+ "--cwd",
17302
+ repo,
17303
+ ...run
17304
+ ]
17305
+ }
17306
+ ];
17307
+ const selfInvocation = (repo) => {
17308
+ const entry = process.argv[1];
17309
+ return [
17310
+ ...entry === void 0 ? ["adiff"] : [
17311
+ process.execPath,
17312
+ ...process.execArgv,
17313
+ entry
17314
+ ],
17315
+ "review",
17316
+ "open",
17317
+ "--repo",
17318
+ repo
17319
+ ];
17320
+ };
17321
+ const ran = (binary, args) => callback$1((resume) => {
17322
+ execFile(binary, [...args], { timeout: TIMEOUT_MS$1 }, (cause) => resume(succeed(cause === null)));
17323
+ });
17324
+ const split = fn("Cli.split")(function* (chosen, repo) {
17325
+ return yield* ran(chosen.binary, chosen.args(repo, selfInvocation(repo)));
17326
+ });
17327
+ const openPane = fn("Cli.openPane")(function* (repo) {
17328
+ const command = `adiff review open --repo ${repo}`;
17329
+ const chosen = splitters.find((candidate) => candidate.present());
17330
+ if (chosen === void 0) return {
17331
+ opened: false,
17332
+ pane: "none",
17333
+ command
17334
+ };
17335
+ return {
17336
+ opened: yield* split(chosen, repo),
17337
+ pane: chosen.pane,
17338
+ command
17339
+ };
17340
+ });
17341
+ //#endregion
17248
17342
  //#region src/cli/search.ts
17249
17343
  const HIT = /^(.+?):(\d+):(.*)$/;
17250
17344
  const NEAR = /^(.+?)-(\d+)-(.*)$/;
@@ -17943,6 +18037,14 @@ const catalog = [
17943
18037
  dataKey: "",
17944
18038
  example: "adiff review open --repo ."
17945
18039
  },
18040
+ {
18041
+ name: "review pane",
18042
+ about: "Open the review beside the conversation, in whichever multiplexer is running. Answers with the command when none is",
18043
+ safety: "read",
18044
+ options: [repo],
18045
+ dataKey: "pane",
18046
+ example: "adiff review pane --repo ."
18047
+ },
17946
18048
  {
17947
18049
  name: "init",
17948
18050
  about: "Write the review loop into this repository's agent instructions, so an agent finds it unprompted",
@@ -21641,7 +21743,7 @@ var App = class {
21641
21743
  return getUnsafe(this.held);
21642
21744
  }
21643
21745
  write(next) {
21644
- runSync(set(this.held, next));
21746
+ runSync(set$1(this.held, next));
21645
21747
  }
21646
21748
  commit(next) {
21647
21749
  const appeared = next.notice.length > 0 && next.notice !== this.state.notice;
@@ -22289,6 +22391,26 @@ const documentAt = fn("Main.documentAt")(function* (source) {
22289
22391
  catch: (cause) => new MalformedLayers({ reason: String(cause) })
22290
22392
  });
22291
22393
  });
22394
+ const layersSet = fn("Main.layersSet")(function* (options) {
22395
+ const document = yield* documentAt(yield* required(options, "json"));
22396
+ const layers = yield* setLayers(yield* required(options, "worktree"), document, options["at"] ?? (/* @__PURE__ */ new Date()).toISOString());
22397
+ yield* answer(options, { layers });
22398
+ });
22399
+ const layersShow = fn("Main.layersShow")(function* (options) {
22400
+ const layers = yield* showLayers(yield* required(options, "worktree"));
22401
+ yield* answer(options, { layers });
22402
+ });
22403
+ const init = fn("Main.init")(function* (options) {
22404
+ const report = yield* initRepository({
22405
+ repo: yield* required(options, "repo"),
22406
+ write: options["write"] !== void 0,
22407
+ skill: options["skill"] !== void 0
22408
+ });
22409
+ yield* answer(options, {
22410
+ wrote: report.wrote,
22411
+ changes: report.changes
22412
+ });
22413
+ });
22292
22414
  const routes = {
22293
22415
  "branch list": branchList,
22294
22416
  "comment add": commentAdd,
@@ -22300,27 +22422,18 @@ const routes = {
22300
22422
  "comment threads": commentThreads,
22301
22423
  "comment resolve": commentResolve,
22302
22424
  "review submit": reviewSubmit,
22303
- "review progress": reviewStatus,
22304
- "layers set": fn("Main.layersSet")(function* (options) {
22305
- const document = yield* documentAt(yield* required(options, "json"));
22306
- const layers = yield* setLayers(yield* required(options, "worktree"), document, options["at"] ?? (/* @__PURE__ */ new Date()).toISOString());
22307
- yield* answer(options, { layers });
22308
- }),
22309
- "layers show": fn("Main.layersShow")(function* (options) {
22310
- const layers = yield* showLayers(yield* required(options, "worktree"));
22311
- yield* answer(options, { layers });
22312
- }),
22313
- init: fn("Main.init")(function* (options) {
22314
- const report = yield* initRepository({
22315
- repo: yield* required(options, "repo"),
22316
- write: options["write"] !== void 0,
22317
- skill: options["skill"] !== void 0
22318
- });
22425
+ "review pane": fn("Main.reviewPane")(function* (options) {
22426
+ const report = yield* openPane(yield* required(options, "repo"));
22319
22427
  yield* answer(options, {
22320
- wrote: report.wrote,
22321
- changes: report.changes
22428
+ opened: report.opened,
22429
+ pane: report.pane,
22430
+ command: report.command
22322
22431
  });
22323
22432
  }),
22433
+ "review progress": reviewStatus,
22434
+ "layers set": layersSet,
22435
+ "layers show": layersShow,
22436
+ init,
22324
22437
  describe: fn("Main.describe")(function* (options) {
22325
22438
  const wanted = options["command"];
22326
22439
  const asked = wanted === void 0 || wanted === "true" ? void 0 : wanted;
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.27",
26
+ "version": "0.1.0-alpha.28",
27
27
  "description": "Review agent work across git worktrees like a PR, and hand the comments back to the agent.",
28
28
  "license": "MIT",
29
29
  "repository": {
@@ -156,11 +156,32 @@ Setting a layers again supersedes the previous one and bumps `version`; the laye
156
156
  it was written for, and adiff reports it as `stale` once the branch moves past that commit. After
157
157
  you address a review, write the layers again.
158
158
 
159
+ ## Put the review in front of them
160
+
161
+ When someone asks you for a review, open it rather than describing how:
162
+
163
+ ```bash
164
+ adiff review pane --repo <repo>
165
+ ```
166
+
167
+ It splits the pane they are already looking at, so their next move is to look right rather than to
168
+ type. The answer says what happened:
169
+
170
+ ```json
171
+ {"ok":true,"opened":true,"pane":"tmux","command":"adiff review open --repo /work/api"}
172
+ ```
173
+
174
+ `opened:false` means nothing could be split, which is ordinary: a terminal without tmux, Zellij,
175
+ WezTerm or kitty has nowhere to put a pane. The answer carries `command` either way, so quote that
176
+ line and let them run it.
177
+
178
+ Open a pane when a review was asked for. Finishing work is not a reason on its own, and taking over
179
+ someone's screen uninvited is worse than a line they have to copy.
180
+
159
181
  ## Tell the reviewer how to read it
160
182
 
161
- The person you are handing work to has to open the review themselves, so end your reply with the
162
- command and the keys. Name the repository they should point at, which is the repository the
163
- worktree belongs to:
183
+ Whether or not a pane opened, say what to do with it. Name the repository they should point at,
184
+ which is the repository the worktree belongs to:
164
185
 
165
186
  > Open it with `adiff review open --repo <repo>`, then press `enter` on this branch. The sidebar
166
187
  > lists the layers in reading order; `j` and `k` move between them and the diff follows. Inside a