@eliya-oss/agent-diff 0.1.0-alpha.146 → 0.1.0-alpha.148

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/dist/main.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import { randomUUID } from "node:crypto";
2
2
  import { appendFile, mkdir, readFile, realpath, rename, rm, stat, writeFile } from "node:fs/promises";
3
- import { homedir, hostname, platform } from "node:os";
4
3
  import { text } from "node:stream/consumers";
5
4
  import { execFile, spawn } from "node:child_process";
6
- import { dirname, join, resolve } from "node:path";
5
+ import { join, resolve } from "node:path";
6
+ import { homedir, hostname, platform } from "node:os";
7
7
  import { promisify } from "node:util";
8
- import { existsSync, lstatSync, mkdirSync, realpathSync, watch } from "node:fs";
9
8
  import { fileURLToPath } from "node:url";
10
9
  import { ASCIIFontRenderable, BoxRenderable, CodeRenderable, LineNumberRenderable, RGBA, StyledText, SyntaxStyle, TextRenderable, TextareaRenderable, bg, createCliRenderer, defaultTextareaKeyBindings, fg, getTreeSitterClient, pathToFiletype, stripAnsiSequences, t } from "@opentui/core";
10
+ import { mkdirSync, watch } from "node:fs";
11
11
  //#region \0rolldown/runtime.js
12
12
  var __defProp = Object.defineProperty;
13
13
  var __esmMin = (fn, res, err) => () => {
@@ -1584,7 +1584,7 @@ var init_option = __esmMin((() => {
1584
1584
  }));
1585
1585
  //#endregion
1586
1586
  //#region node_modules/.pnpm/effect@4.0.0-rc.110/node_modules/effect/dist/internal/result.js
1587
- var TypeId$19, CommonProto, SuccessProto, FailureProto, isResult, isFailure$1, isSuccess$1, fail$4, succeed$7;
1587
+ var TypeId$19, CommonProto, SuccessProto, FailureProto, isResult, isFailure$1, isSuccess$2, fail$4, succeed$7;
1588
1588
  var init_result = __esmMin((() => {
1589
1589
  init_Equal();
1590
1590
  init_Formatter();
@@ -1609,7 +1609,7 @@ var init_result = __esmMin((() => {
1609
1609
  _tag: "Success",
1610
1610
  _op: "Success",
1611
1611
  [symbol](that) {
1612
- return isResult(that) && isSuccess$1(that) && equals$2(this.success, that.success);
1612
+ return isResult(that) && isSuccess$2(that) && equals$2(this.success, that.success);
1613
1613
  },
1614
1614
  [symbol$1]() {
1615
1615
  return combine(hash(this._tag))(hash(this.success));
@@ -1647,7 +1647,7 @@ var init_result = __esmMin((() => {
1647
1647
  });
1648
1648
  isResult = (input) => hasProperty(input, TypeId$19);
1649
1649
  isFailure$1 = (result) => result._tag === "Failure";
1650
- isSuccess$1 = (result) => result._tag === "Success";
1650
+ isSuccess$2 = (result) => result._tag === "Success";
1651
1651
  fail$4 = (failure) => {
1652
1652
  const a = Object.create(FailureProto);
1653
1653
  a.failure = failure;
@@ -1713,7 +1713,7 @@ var init_Order = __esmMin((() => {
1713
1713
  }));
1714
1714
  //#endregion
1715
1715
  //#region node_modules/.pnpm/effect@4.0.0-rc.110/node_modules/effect/dist/Option.js
1716
- var none, some, isNone, isSome, match$3, getOrElse, orElse, fromNullishOr, getOrUndefined$1, liftThrowable, map$4, flatMap$2, filter$1;
1716
+ var none, some, isNone, isSome, match$3, getOrElse$1, orElse, fromNullishOr, getOrUndefined$1, liftThrowable, map$4, flatMap$2, filter$1;
1717
1717
  var init_Option = __esmMin((() => {
1718
1718
  init_Function();
1719
1719
  init_option();
@@ -1722,10 +1722,10 @@ var init_Option = __esmMin((() => {
1722
1722
  isNone = isNone$1;
1723
1723
  isSome = isSome$1;
1724
1724
  match$3 = /*#__PURE__*/ dual(2, (self, { onNone, onSome }) => isNone(self) ? onNone() : onSome(self.value));
1725
- getOrElse = /*#__PURE__*/ dual(2, (self, onNone) => isNone(self) ? onNone() : self.value);
1725
+ getOrElse$1 = /*#__PURE__*/ dual(2, (self, onNone) => isNone(self) ? onNone() : self.value);
1726
1726
  orElse = /*#__PURE__*/ dual(2, (self, that) => isNone(self) ? that() : self);
1727
1727
  fromNullishOr = (a) => a == null ? none() : some(a);
1728
- getOrUndefined$1 = /*#__PURE__*/ getOrElse(constUndefined);
1728
+ getOrUndefined$1 = /*#__PURE__*/ getOrElse$1(constUndefined);
1729
1729
  liftThrowable = (f) => (...a) => {
1730
1730
  try {
1731
1731
  return some(f(...a));
@@ -1736,13 +1736,15 @@ var init_Option = __esmMin((() => {
1736
1736
  map$4 = /*#__PURE__*/ dual(2, (self, f) => isNone(self) ? none() : some(f(self.value)));
1737
1737
  flatMap$2 = /*#__PURE__*/ dual(2, (self, f) => isNone(self) ? none() : f(self.value));
1738
1738
  filter$1 = /*#__PURE__*/ dual(2, (self, predicate) => isNone(self) ? none() : predicate(self.value) ? some(self.value) : none());
1739
- })), succeed$6, fail$3, isFailure;
1739
+ })), succeed$6, fail$3, isFailure, isSuccess$1, getOrElse;
1740
1740
  var init_Result = __esmMin((() => {
1741
1741
  init_Function();
1742
1742
  init_result();
1743
1743
  succeed$6 = succeed$7;
1744
1744
  fail$3 = fail$4;
1745
1745
  isFailure = isFailure$1;
1746
+ isSuccess$1 = isSuccess$2;
1747
+ getOrElse = /*#__PURE__*/ dual(2, (self, onFailure) => isFailure(self) ? onFailure(self.failure) : self.success);
1746
1748
  })), Array$1, fromIterable$1, append$1, appendAll, isArrayNonEmpty, isReadonlyArrayNonEmpty, lastNonEmpty, hashBucketsAdd, union$1, empty$2, of, map$3, dedupe, init_Array = __esmMin((() => {
1747
1749
  init_Equal();
1748
1750
  init_Function();
@@ -2647,7 +2649,7 @@ var CurrentStackFrame, TracerEnabled, TracerTimingEnabled, TracerSpanAnnotations
2647
2649
  };
2648
2650
  };
2649
2651
  spanCleaner = /*#__PURE__*/ makeStackCleaner(3);
2650
- })), Interrupt, causeInterrupt, findFail, findError$1, hasInterrupts, causeFilterInterruptors, causeCombine, causeMap, causePartition, causeSquash, causePrettyErrors, causePrettyError, causePrettyMessage, locationRegExp, cleanErrorStack, addStackAnnotations, interruptCauseStack, currentStackTrace, causePretty, renderPrettyError, renderErrorCause, FiberTypeId, fiberVariance, fiberIdStore, getCurrentFiber, FiberImpl, deferredInterruptCont, fiberMiddleware, fiberStackAnnotations, fiberAwait, fiberAwaitAll, fiberJoin, fiberInterrupt, fiberInterruptAs, fiberInterruptAll, succeed$5, failCause$3, fail$2, sync$2, suspend$1, yieldNowWith, yieldNow, succeedNone$1, failCauseSync$1, die, failSync, void_$2, try_$1, promise$1, tryPromise$1, withFiberId, callbackOptions, asyncFinalizer, callback$2, never, gen$1, fnUntraced$1, defineFunctionLength, fnStackCleaner, fn$1, makeFn, fnUntracedEager$1, fromIteratorEagerUnsafe, fromIteratorUnsafe, as$1, asSome, andThen$1, tap$1, asVoid$1, raceAllFirst, raceFirst$1, flatMap$1, OnSuccessProto, effectIsExit, flatMapEager$1, map$2, mapEager$1, exitInterrupt$1, exitIsSuccess, exitFilterCause, exitHasInterrupts, exitVoid, exitMap, exitAsVoidAll, updateContext, updateService, contextWith$1, provideContext, provideService, provideServiceImpl, when$1, forever$2, catchCause$1, OnFailureProto, catchCauseFilter, catch_, catchIf, catchTag$1, mapError$1, orElseSucceed$1, ignore$1, option$2, result, matchCauseEffect, OnSuccessAndFailureProto, matchEffect$1, match, matchEager, exit$1, exitPrimitive, ScopeTypeId, ScopeCloseableTypeId, scopeTag, scopeClose, scopeCloseUnsafe, scopeCloseFinalizers, scopeForkUnsafe, scopeAddFinalizerExit, scopeAddFinalizer, scopeAddFinalizerUnsafe, scopeRemoveFinalizerUnsafe, scopeMakeUnsafe, constScopeEmpty, scope, provideScope, scopedWith, acquireRelease$1, onExitPrimitive, onExit$1, ensuring$1, onExitFilter, onError$1, onErrorFilter, onInterrupt$1, acquireUseRelease$1, interrupt$2, uninterruptible$1, setInterruptible, setInterruptibleTrue, setInterruptibleFalse, setFiberInterruptible, interruptible, uninterruptibleMask, all$1, whileLoop$1, forEach$1, forEachSequential, iterateEagerImpl, iterateEager, forEachConcurrent, forkUnsafe$1, forkDetach$1, forkIn$1, runForkWith, runFork$1, runPromiseExitWith, runPromiseWith, runPromise$1, runSyncExitWith, runSyncExit$1, runSyncWith, runSync$1, succeedTrue, succeedFalse, Latch, makeLatchUnsafe, bigint0, NoopSpanProto, noopSpan, filterDisablePropagation, makeSpanUnsafe, provideSpanStackFrame, endSpan, useSpan, provideParentSpan, withParentSpan, withSpan$1, ClockRef, MAX_TIMER_MILLIS, ClockImpl, nanosPerMilli, monotonicNowNanos, wallTimeNanos, clockWith, sleep$1, AsyncFiberErrorTypeId, AsyncFiberError, UnknownErrorTypeId, UnknownError, ConsoleRef, logLevelToOrder, LogLevelOrder, isLogLevelGreaterThan, CurrentLoggers, LogToStderr, LoggerTypeId, LoggerProto, loggerMake, formatLabel, formatLogSpan, logWithLevel, colors, defaultDateFormat, defaultLogger, tracerLogger, init_effect = __esmMin((() => {
2652
+ })), Interrupt, causeInterrupt, findFail, findError$1, hasInterrupts, causeFilterInterruptors, causeCombine, causeMap, causePartition, causeSquash, causePrettyErrors, causePrettyError, causePrettyMessage, locationRegExp, cleanErrorStack, addStackAnnotations, interruptCauseStack, currentStackTrace, causePretty, renderPrettyError, renderErrorCause, FiberTypeId, fiberVariance, fiberIdStore, getCurrentFiber, FiberImpl, deferredInterruptCont, fiberMiddleware, fiberStackAnnotations, fiberAwait, fiberAwaitAll, fiberJoin, fiberInterrupt, fiberInterruptAs, fiberInterruptAll, succeed$5, failCause$3, fail$2, sync$2, suspend$1, yieldNowWith, yieldNow, succeedNone$1, failCauseSync$1, die, failSync, void_$2, try_$1, promise$1, tryPromise$1, withFiberId, callbackOptions, asyncFinalizer, callback$2, never, gen$1, fnUntraced$1, defineFunctionLength, fnStackCleaner, fn$1, makeFn, fnUntracedEager$1, fromIteratorEagerUnsafe, fromIteratorUnsafe, as$1, asSome, andThen$1, tap$1, asVoid$1, raceAllFirst, raceFirst$1, flatMap$1, OnSuccessProto, effectIsExit, flatMapEager$1, map$2, mapEager$1, exitInterrupt$1, exitIsSuccess, exitFilterCause, exitHasInterrupts, exitVoid, exitMap, exitAsVoidAll, updateContext, updateService, contextWith$1, provideContext, provideService, provideServiceImpl, when$1, forever$2, catchCause$1, OnFailureProto, catchCauseFilter, catch_, catchIf, catchTag$1, mapError$1, orElseSucceed$1, ignore$1, result$1, matchCauseEffect, OnSuccessAndFailureProto, matchEffect$1, match, matchEager, exit$1, exitPrimitive, ScopeTypeId, ScopeCloseableTypeId, scopeTag, scopeClose, scopeCloseUnsafe, scopeCloseFinalizers, scopeForkUnsafe, scopeAddFinalizerExit, scopeAddFinalizer, scopeAddFinalizerUnsafe, scopeRemoveFinalizerUnsafe, scopeMakeUnsafe, constScopeEmpty, scope, provideScope, scopedWith, acquireRelease$1, onExitPrimitive, onExit$1, ensuring$1, onExitFilter, onError$1, onErrorFilter, onInterrupt$1, acquireUseRelease$1, interrupt$2, uninterruptible$1, setInterruptible, setInterruptibleTrue, setInterruptibleFalse, setFiberInterruptible, interruptible, uninterruptibleMask, all$1, whileLoop$1, forEach$1, forEachSequential, iterateEagerImpl, iterateEager, forEachConcurrent, forkUnsafe$1, forkDetach$1, forkIn$1, runForkWith, runFork$1, runPromiseExitWith, runPromiseWith, runPromise$1, runSyncExitWith, runSyncExit$1, runSyncWith, runSync$1, succeedTrue, succeedFalse, Latch, makeLatchUnsafe, bigint0, NoopSpanProto, noopSpan, filterDisablePropagation, makeSpanUnsafe, provideSpanStackFrame, endSpan, useSpan, provideParentSpan, withParentSpan, withSpan$1, ClockRef, MAX_TIMER_MILLIS, ClockImpl, nanosPerMilli, monotonicNowNanos, wallTimeNanos, clockWith, sleep$1, AsyncFiberErrorTypeId, AsyncFiberError, UnknownErrorTypeId, UnknownError, ConsoleRef, logLevelToOrder, LogLevelOrder, isLogLevelGreaterThan, CurrentLoggers, LogToStderr, LoggerTypeId, LoggerProto, loggerMake, formatLabel, formatLogSpan, logWithLevel, colors, defaultDateFormat, defaultLogger, tracerLogger, init_effect = __esmMin((() => {
2651
2653
  init_Array();
2652
2654
  init_Context();
2653
2655
  init_Duration();
@@ -3464,11 +3466,7 @@ var CurrentStackFrame, TracerEnabled, TracerTimingEnabled, TracerSpanAnnotations
3464
3466
  onSuccess: (_) => void_$2
3465
3467
  });
3466
3468
  });
3467
- option$2 = (self) => match(self, {
3468
- onFailure: none,
3469
- onSuccess: some
3470
- });
3471
- result = (self) => matchEager(self, {
3469
+ result$1 = (self) => matchEager(self, {
3472
3470
  onFailure: fail$3,
3473
3471
  onSuccess: succeed$6
3474
3472
  });
@@ -3666,11 +3664,11 @@ var CurrentStackFrame, TracerEnabled, TracerTimingEnabled, TracerSpanAnnotations
3666
3664
  return f(interruptible);
3667
3665
  });
3668
3666
  all$1 = (arg, options) => {
3669
- if (isIterable(arg)) return options?.mode === "result" ? forEach$1(arg, result, options) : forEach$1(arg, identity, options);
3670
- else if (options?.discard) return options.mode === "result" ? forEach$1(Object.values(arg), result, options) : forEach$1(Object.values(arg), identity, options);
3667
+ if (isIterable(arg)) return options?.mode === "result" ? forEach$1(arg, result$1, options) : forEach$1(arg, identity, options);
3668
+ else if (options?.discard) return options.mode === "result" ? forEach$1(Object.values(arg), result$1, options) : forEach$1(Object.values(arg), identity, options);
3671
3669
  return suspend$1(() => {
3672
3670
  const out = {};
3673
- return as$1(forEach$1(Object.entries(arg), ([key, effect]) => map$2(options?.mode === "result" ? result(effect) : effect, (value) => {
3671
+ return as$1(forEach$1(Object.entries(arg), ([key, effect]) => map$2(options?.mode === "result" ? result$1(effect) : effect, (value) => {
3674
3672
  assignProperty(out, key, value);
3675
3673
  }), {
3676
3674
  discard: true,
@@ -4690,7 +4688,7 @@ var retryOrElse, retry$1, passthroughForever, buildFromOptions, init_schedule =
4690
4688
  if (options.times !== void 0) schedule = while_(schedule, ({ attempt }) => succeed$5(attempt <= options.times));
4691
4689
  return schedule;
4692
4690
  };
4693
- })), all, forEach, whileLoop, promise, tryPromise, succeed$1, succeedNone, suspend, sync, void_, callback$1, gen, fail, failCause, failCauseSync, try_, withFiber, flatMap, andThen, tap, option$1, exit, map, as, asVoid, catchTag, catchCause, mapError, retry, ignore, orElseSucceed, sleep, raceFirst, when, contextWith, provide, acquireRelease, acquireUseRelease, ensuring, onError, onExit, interrupt$1, onInterrupt, uninterruptible, forever, withSpan, forkIn, forkDetach, runFork, runPromise, runSync, runSyncExit, fnUntraced, fn, mapEager, flatMapEager, fnUntracedEager;
4691
+ })), all, forEach, whileLoop, promise, tryPromise, succeed$1, succeedNone, suspend, sync, void_, callback$1, gen, fail, failCause, failCauseSync, try_, withFiber, flatMap, andThen, tap, result, exit, map, as, asVoid, catchTag, catchCause, mapError, retry, ignore, orElseSucceed, sleep, raceFirst, when, contextWith, provide, acquireRelease, acquireUseRelease, ensuring, onError, onExit, interrupt$1, onInterrupt, uninterruptible, forever, withSpan, forkIn, forkDetach, runFork, runPromise, runSync, runSyncExit, fnUntraced, fn, mapEager, flatMapEager, fnUntracedEager;
4694
4692
  var init_Effect = __esmMin((() => {
4695
4693
  init_Context();
4696
4694
  init_core();
@@ -4717,7 +4715,7 @@ var init_Effect = __esmMin((() => {
4717
4715
  flatMap = flatMap$1;
4718
4716
  andThen = andThen$1;
4719
4717
  tap = tap$1;
4720
- option$1 = option$2;
4718
+ result = result$1;
4721
4719
  exit = exit$1;
4722
4720
  map = map$2;
4723
4721
  as = as$1;
@@ -6070,7 +6068,7 @@ function getConstructorDescriptor(ast) {
6070
6068
  const getDescriptor = ast.annotations?.[CONSTRUCTOR_ANNOTATION_KEY];
6071
6069
  return isFunction(getDescriptor) ? getDescriptor(ast.typeParameters) : void 0;
6072
6070
  }
6073
- var isDeclaration, isNever, isLiteral, isUniqueSymbol, isArrays, isObjects, isSuspend, Link, defaultParseOptions, Context, TypeId$9, Base, Null, null_, Undefined$1, undefinedToNull, undefined_, Unknown, unknown$1, Literal$1, String$2, string, Number$2, number, Boolean$1, boolean, Arrays, parseArray, resolveConcurrency, wrapPropertyKeyIssue, FINITE_PATTERN, PropertySignature, IndexSignature, Objects, parseProperties, toCandidate, candidateIndexCache, emptyCandidates, Union$1, parseUnion, nonFiniteLiterals, Filter, FilterGroup, finite, contextOwners, optionalKey$1, optionalKeyLastLink, toType, toEncoded$1, flip, parameterFromPropertyKey, isStringFiniteRegExp, isStringNumberRegExp, finiteString, finiteToString, numberToString;
6071
+ var isDeclaration, isNever, isLiteral, isUniqueSymbol, isArrays, isObjects, isSuspend, Link, defaultParseOptions, Context, TypeId$9, Base, Null$1, null_, Undefined$1, undefinedToNull, undefined_, Unknown, unknown$1, Literal$1, String$2, string, Number$2, number, Boolean$1, boolean, Arrays, parseArray, resolveConcurrency, wrapPropertyKeyIssue, FINITE_PATTERN, PropertySignature, IndexSignature, Objects, parseProperties, toCandidate, candidateIndexCache, emptyCandidates, Union$1, parseUnion, nonFiniteLiterals, Filter, FilterGroup, finite, contextOwners, optionalKey$1, optionalKeyLastLink, toType, toEncoded$1, flip, parameterFromPropertyKey, isStringFiniteRegExp, isStringNumberRegExp, finiteString, finiteToString, numberToString;
6074
6072
  var init_SchemaAST = __esmMin((() => {
6075
6073
  init_Array();
6076
6074
  init_Cause();
@@ -6134,7 +6132,7 @@ var init_SchemaAST = __esmMin((() => {
6134
6132
  return `<${this._tag}>`;
6135
6133
  }
6136
6134
  };
6137
- Null = class extends Base {
6135
+ Null$1 = class extends Base {
6138
6136
  _tag = "Null";
6139
6137
  /** @internal */
6140
6138
  getParser() {
@@ -6145,7 +6143,7 @@ var init_SchemaAST = __esmMin((() => {
6145
6143
  return "null";
6146
6144
  }
6147
6145
  };
6148
- null_ = /*#__PURE__*/ new Null();
6146
+ null_ = /*#__PURE__*/ new Null$1();
6149
6147
  Undefined$1 = class extends Base {
6150
6148
  _tag = "Undefined";
6151
6149
  /** @internal */
@@ -8557,7 +8555,7 @@ function isInt(annotations) {
8557
8555
  ...annotations
8558
8556
  });
8559
8557
  }
8560
- var SchemaErrorTypeId, SchemaError, decodeUnknownOption, encodeEffect, make$1, optionalKey, toEncoded, Undefined, String$1, Number$1, Boolean, ArraySchema, UndefinedOr, makeFilter, Int;
8558
+ var SchemaErrorTypeId, SchemaError, decodeUnknownOption, encodeEffect, make$1, optionalKey, toEncoded, Null, Undefined, String$1, Number$1, Boolean, ArraySchema, UndefinedOr, NullishOr, makeFilter, Int;
8561
8559
  var init_Schema = __esmMin((() => {
8562
8560
  init_BigDecimal();
8563
8561
  init_Cause();
@@ -8593,12 +8591,18 @@ var init_Schema = __esmMin((() => {
8593
8591
  make$1 = make$2;
8594
8592
  optionalKey = /*#__PURE__*/ lambda((schema) => make$1(optionalKey$1(schema.ast), { schema }));
8595
8593
  toEncoded = /*#__PURE__*/ lambda((schema) => make$1(toEncoded$1(schema.ast), { schema }));
8594
+ Null = /*#__PURE__*/ make$1(null_);
8596
8595
  Undefined = /*#__PURE__*/ make$1(undefined_);
8597
8596
  String$1 = /*#__PURE__*/ make$1(string);
8598
8597
  Number$1 = /*#__PURE__*/ make$1(number);
8599
8598
  Boolean = /*#__PURE__*/ make$1(boolean);
8600
8599
  ArraySchema = /*#__PURE__*/ lambda((schema) => make$1(new Arrays(false, [], [schema.ast]), { value: schema }));
8601
8600
  UndefinedOr = /*#__PURE__*/ lambda((self) => Union([self, Undefined]));
8601
+ NullishOr = /*#__PURE__*/ lambda((self) => Union([
8602
+ self,
8603
+ Null,
8604
+ Undefined
8605
+ ]));
8602
8606
  makeFilter = makeFilter$1;
8603
8607
  Int = /*#__PURE__*/ Number$1.check(/*#__PURE__*/ isInt());
8604
8608
  globalThis.RegExp;
@@ -8819,7 +8823,7 @@ var init_error$3 = __esmMin((() => {
8819
8823
  }));
8820
8824
  //#endregion
8821
8825
  //#region src/service/forge/service.ts
8822
- var Forge, LIMIT, TIMEOUT_MS$1, SEND_TIMEOUT_MS, MOST_OUTPUT, FIELDS$1, Row, decode$1, SAID, stateOf$1, ended, ask, show, read, pulls, openPull, NUMBER_FIELDS, Named, readNamed, gh, named$1, head, sideName, commentBody, bodyFor, Landed, readLanded, keyOf$2, counted, acknowledged, landedIn, review, ForgeLive;
8826
+ var Forge, LIMIT, TIMEOUT_MS$1, SEND_TIMEOUT_MS, MOST_OUTPUT, FIELDS$1, Row, decode$1, SAID, stateOf$2, ended, ask, show, read, pulls, openPull, NUMBER_FIELDS, Named, readNamed, gh, named$1, head, sideName, commentBody, bodyFor, Landed, readLanded, keyOf$2, counted, acknowledged, landedIn, THREADS, Said, Thread, Page, Threads, readThreads, ANONYMOUS, heardFrom$1, someLine, hasNoLine, quotedIn, spanIn, remarkOf, ownerOf, asked, whereOf, threadsIn$1, unresolved, PAGES, everyThread, answer$1, remarks, review, ForgeLive;
8823
8827
  var init_service$2 = __esmMin((() => {
8824
8828
  init_dist();
8825
8829
  init_error$3();
@@ -8840,7 +8844,7 @@ var init_service$2 = __esmMin((() => {
8840
8844
  "MERGED",
8841
8845
  "CLOSED"
8842
8846
  ];
8843
- stateOf$1 = (row) => {
8847
+ stateOf$2 = (row) => {
8844
8848
  const said = SAID.find((known) => known === row.state);
8845
8849
  switch (said) {
8846
8850
  case "OPEN": return row.isDraft ? "draft" : "open";
@@ -8906,7 +8910,7 @@ var init_service$2 = __esmMin((() => {
8906
8910
  reason: String(cause)
8907
8911
  }))).map((row) => ({
8908
8912
  branch: row.headRefName,
8909
- state: stateOf$1(row)
8913
+ state: stateOf$2(row)
8910
8914
  }));
8911
8915
  });
8912
8916
  pulls = fn("Forge.pulls")(function* (repo) {
@@ -9005,6 +9009,183 @@ var init_service$2 = __esmMin((() => {
9005
9009
  return [at];
9006
9010
  });
9007
9011
  };
9012
+ THREADS = `query($owner:String!,$name:String!,$number:Int!,$after:String){
9013
+ repository(owner:$owner,name:$name){
9014
+ pullRequest(number:$number){
9015
+ reviewThreads(first:50,after:$after){
9016
+ pageInfo{ hasNextPage endCursor }
9017
+ nodes{
9018
+ id isResolved isOutdated path diffSide
9019
+ line originalLine startLine originalStartLine
9020
+ comments(first:50){
9021
+ totalCount
9022
+ nodes{ databaseId author{login} body diffHunk originalCommit{oid} }
9023
+ }
9024
+ }
9025
+ }
9026
+ }
9027
+ }
9028
+ }`;
9029
+ Said = Struct({
9030
+ databaseId: optionalKey(NullishOr(Int)),
9031
+ author: optionalKey(NullishOr(Struct({ login: String$1 }))),
9032
+ body: String$1,
9033
+ diffHunk: optionalKey(NullishOr(String$1)),
9034
+ originalCommit: optionalKey(NullishOr(Struct({ oid: String$1 })))
9035
+ });
9036
+ Thread = Struct({
9037
+ id: String$1,
9038
+ isResolved: Boolean,
9039
+ isOutdated: Boolean,
9040
+ path: String$1,
9041
+ line: optionalKey(NullishOr(Int)),
9042
+ originalLine: optionalKey(NullishOr(Int)),
9043
+ startLine: optionalKey(NullishOr(Int)),
9044
+ originalStartLine: optionalKey(NullishOr(Int)),
9045
+ diffSide: String$1,
9046
+ comments: Struct({
9047
+ totalCount: optionalKey(NullishOr(Int)),
9048
+ nodes: ArraySchema(Said)
9049
+ })
9050
+ });
9051
+ Page = Struct({
9052
+ hasNextPage: Boolean,
9053
+ endCursor: optionalKey(NullishOr(String$1))
9054
+ });
9055
+ Threads = Struct({ data: Struct({ repository: Struct({ pullRequest: Struct({ reviewThreads: Struct({
9056
+ pageInfo: optionalKey(Page),
9057
+ nodes: ArraySchema(Thread)
9058
+ }) }) }) }) });
9059
+ readThreads = decodeUnknownEffect(Threads);
9060
+ ANONYMOUS = "someone";
9061
+ heardFrom$1 = (said) => ({
9062
+ by: said.author?.login ?? ANONYMOUS,
9063
+ body: said.body
9064
+ });
9065
+ someLine = (...found) => found.find((one) => one !== null && one !== void 0) ?? void 0;
9066
+ hasNoLine = (thread) => thread.line === null || thread.line === void 0;
9067
+ quotedIn = (said) => ({
9068
+ hunk: said.diffHunk ?? "",
9069
+ commit: said.originalCommit?.oid ?? ""
9070
+ });
9071
+ spanIn = (thread, line) => ({
9072
+ line,
9073
+ start: someLine(thread.startLine, thread.originalStartLine) ?? line
9074
+ });
9075
+ remarkOf = (thread) => {
9076
+ const [first, ...rest] = thread.comments.nodes;
9077
+ const line = someLine(thread.line, thread.originalLine);
9078
+ if (first === void 0 || line === void 0) return void 0;
9079
+ return {
9080
+ id: thread.id,
9081
+ answerTo: first.databaseId ?? 0,
9082
+ moreReplies: Math.max(0, (thread.comments.totalCount ?? 0) - thread.comments.nodes.length),
9083
+ path: thread.path,
9084
+ side: thread.diffSide === "LEFT" ? "old" : "new",
9085
+ ...spanIn(thread, line),
9086
+ ...heardFrom$1(first),
9087
+ ...quotedIn(first),
9088
+ replies: rest.map(heardFrom$1),
9089
+ outdated: thread.isOutdated || hasNoLine(thread)
9090
+ };
9091
+ };
9092
+ ownerOf = fn("Forge.owner")(function* (repo) {
9093
+ const [owner = "", name = ""] = (yield* gh(repo, [
9094
+ "repo",
9095
+ "view",
9096
+ "--json",
9097
+ "nameWithOwner",
9098
+ "-q",
9099
+ ".nameWithOwner"
9100
+ ])).trim().split("/");
9101
+ return {
9102
+ owner,
9103
+ name
9104
+ };
9105
+ });
9106
+ asked = (repo, where, after) => gh(repo, [
9107
+ "api",
9108
+ "graphql",
9109
+ "-f",
9110
+ `query=${THREADS}`,
9111
+ "-f",
9112
+ `owner=${where.owner}`,
9113
+ "-f",
9114
+ `name=${where.name}`,
9115
+ "-F",
9116
+ `number=${where.number}`,
9117
+ ...after === void 0 ? [] : ["-f", `after=${after}`]
9118
+ ]);
9119
+ whereOf = fn("Forge.whereOf")(function* (repo, branch) {
9120
+ const pull = yield* named$1(repo, branch);
9121
+ const here = yield* ownerOf(repo);
9122
+ return {
9123
+ owner: here.owner,
9124
+ name: here.name,
9125
+ number: pull.number
9126
+ };
9127
+ });
9128
+ threadsIn$1 = fn("Forge.threadsIn")(function* (repo, raw) {
9129
+ const parsed = yield* try_({
9130
+ try: () => JSON.parse(raw),
9131
+ catch: (cause) => new ForgeUnavailable({
9132
+ repo,
9133
+ reason: String(cause)
9134
+ })
9135
+ });
9136
+ return (yield* mapError(readThreads(parsed), (cause) => new ForgeUnavailable({
9137
+ repo,
9138
+ reason: String(cause)
9139
+ }))).data.repository.pullRequest.reviewThreads;
9140
+ });
9141
+ unresolved = (nodes) => nodes.filter((thread) => !thread.isResolved).flatMap((thread) => {
9142
+ const found = remarkOf(thread);
9143
+ return found === void 0 ? [] : [found];
9144
+ });
9145
+ PAGES = 20;
9146
+ everyThread = fn("Forge.everyThread")(function* (repo, where) {
9147
+ const held = [];
9148
+ let after;
9149
+ for (let page = 0; page < PAGES; page += 1) {
9150
+ const raw = yield* asked(repo, where, after);
9151
+ const found = yield* threadsIn$1(repo, raw);
9152
+ held.push(...found.nodes);
9153
+ if (found.pageInfo?.hasNextPage !== true) return held;
9154
+ const next = found.pageInfo.endCursor;
9155
+ if (next === null || next === void 0) return held;
9156
+ after = next;
9157
+ }
9158
+ return held;
9159
+ });
9160
+ answer$1 = fn("Forge.answer")(function* (repo, branch, answerTo, body) {
9161
+ const where = yield* whereOf(repo, branch);
9162
+ const route = `repos/${where.owner}/${where.name}/pulls/${where.number}/comments`;
9163
+ const said = yield* gh(repo, [
9164
+ "api",
9165
+ "--method",
9166
+ "POST",
9167
+ route,
9168
+ "--input",
9169
+ "-"
9170
+ ], JSON.stringify({
9171
+ body,
9172
+ in_reply_to: answerTo
9173
+ }));
9174
+ return yield* (yield* try_({
9175
+ try: () => JSON.parse(said),
9176
+ catch: (cause) => new ForgeUnavailable({
9177
+ repo,
9178
+ reason: String(cause)
9179
+ })
9180
+ })).id === void 0 ? new ForgeUnavailable({
9181
+ repo,
9182
+ reason: "the reply came back with no id"
9183
+ }) : void_;
9184
+ });
9185
+ remarks = fn("Forge.remarks")(function* (repo, branch) {
9186
+ if (!(yield* pulls(repo)).some((one) => one.branch === branch)) return [];
9187
+ return unresolved(yield* everyThread(repo, yield* whereOf(repo, branch)));
9188
+ });
9008
9189
  review = fn("Forge.review")(function* (repo, branch, comments) {
9009
9190
  const pull = yield* named$1(repo, branch);
9010
9191
  const route = `repos/${(yield* gh(repo, [
@@ -9032,7 +9213,9 @@ var init_service$2 = __esmMin((() => {
9032
9213
  pulls,
9033
9214
  openPull,
9034
9215
  head,
9035
- review
9216
+ review,
9217
+ remarks,
9218
+ answer: answer$1
9036
9219
  });
9037
9220
  }));
9038
9221
  //#endregion
@@ -9060,12 +9243,13 @@ var init_model$4 = __esmMin((() => {
9060
9243
  settled: {},
9061
9244
  removed: {},
9062
9245
  base: "",
9063
- read: {}
9246
+ read: {},
9247
+ dismissed: {}
9064
9248
  };
9065
9249
  }));
9066
9250
  //#endregion
9067
9251
  //#region src/service/store/schema.ts
9068
- var Side, Anchor, StoredComment, StoredDraft, Drafts, StoredAnswer, Batch, Stamps, Counts, noStamps, BranchState, Settings, Watching, UpgradeCheck, Prose, Code, StoredLayer, StoredLayers;
9252
+ var Side, Anchor, StoredComment, StoredDraft, Drafts, StoredAnswer, Batch, Stamps, Counts, noStamps, BranchState, StoredSaid, StoredRemark, StoredRemarks, Settings, Watching, UpgradeCheck, Prose, Code, StoredLayer, StoredLayers;
9069
9253
  var init_schema = __esmMin((() => {
9070
9254
  init_dist();
9071
9255
  Side = Literals(["old", "new"]);
@@ -9081,7 +9265,8 @@ var init_schema = __esmMin((() => {
9081
9265
  id: String$1,
9082
9266
  anchor: Anchor,
9083
9267
  body: String$1,
9084
- replyTo: optionalKey(String$1)
9268
+ replyTo: optionalKey(String$1),
9269
+ remark: optionalKey(String$1)
9085
9270
  });
9086
9271
  StoredDraft = Struct({
9087
9272
  id: String$1,
@@ -9117,7 +9302,33 @@ var init_schema = __esmMin((() => {
9117
9302
  settled: Stamps.pipe(noStamps),
9118
9303
  removed: Stamps.pipe(noStamps),
9119
9304
  base: String$1.pipe(withDecodingDefaultKey(succeed$1(""))),
9120
- read: Counts.pipe(withDecodingDefaultKey(succeed$1({})))
9305
+ read: Counts.pipe(withDecodingDefaultKey(succeed$1({}))),
9306
+ dismissed: Stamps.pipe(noStamps)
9307
+ });
9308
+ StoredSaid = Struct({
9309
+ by: String$1,
9310
+ body: String$1
9311
+ });
9312
+ StoredRemark = Struct({
9313
+ id: String$1,
9314
+ answerTo: Int.pipe(withDecodingDefaultKey(succeed$1(0))),
9315
+ moreReplies: Int.pipe(withDecodingDefaultKey(succeed$1(0))),
9316
+ path: String$1,
9317
+ side: Side,
9318
+ line: Int,
9319
+ start: Int.pipe(withDecodingDefaultKey(succeed$1(0))),
9320
+ by: String$1,
9321
+ body: String$1,
9322
+ replies: ArraySchema(StoredSaid),
9323
+ hunk: String$1,
9324
+ commit: String$1,
9325
+ outdated: Boolean
9326
+ });
9327
+ StoredRemarks = Struct({
9328
+ version: Int,
9329
+ head: String$1,
9330
+ read: String$1,
9331
+ remarks: ArraySchema(StoredRemark)
9121
9332
  });
9122
9333
  Settings = Struct({
9123
9334
  wrap: optionalKey(Boolean),
@@ -9161,7 +9372,7 @@ var init_schema = __esmMin((() => {
9161
9372
  }));
9162
9373
  //#endregion
9163
9374
  //#region src/service/store/paths.ts
9164
- var NON_SLUG, slugOf, defaultRoot, branchDir, inboxPath, outboxPath, statePath, watchPath, draftsPath, layersPath, settingsPath, upgradePath, reportsDir, reportPath;
9375
+ var NON_SLUG, slugOf, defaultRoot, branchDir, inboxPath, outboxPath, statePath, watchPath, draftsPath, layersPath, remarksPath, settingsPath, upgradePath, reportsDir, reportPath;
9165
9376
  var init_paths = __esmMin((() => {
9166
9377
  NON_SLUG = /[^a-zA-Z0-9]+/g;
9167
9378
  slugOf = (worktreePath) => worktreePath.replace(NON_SLUG, "-");
@@ -9173,6 +9384,7 @@ var init_paths = __esmMin((() => {
9173
9384
  watchPath = (root, worktreePath) => join(branchDir(root, worktreePath), "watch.json");
9174
9385
  draftsPath = (root, worktreePath) => join(branchDir(root, worktreePath), "drafts.json");
9175
9386
  layersPath = (root, worktreePath) => join(branchDir(root, worktreePath), "layers.json");
9387
+ remarksPath = (root, worktreePath) => join(branchDir(root, worktreePath), "remarks.json");
9176
9388
  settingsPath = (root) => join(root, "settings.json");
9177
9389
  upgradePath = (root) => join(root, "upgrade.json");
9178
9390
  reportsDir = (root) => join(root, "reports");
@@ -9180,7 +9392,7 @@ var init_paths = __esmMin((() => {
9180
9392
  }));
9181
9393
  //#endregion
9182
9394
  //#region src/service/store/service.ts
9183
- var Store, ensureDir, readOptional, missing$1, damaged, jsonOf$1, decoded, unwritable, wrote, added, INDENT, DRAFTS_VERSION, encoded, writes, appends, writeSettings, writeUpgradeCheck, writeState, writeLayers, writeDrafts, writeBatch, writeAnswer, asSettings, asUpgradeCheck, asBatch, asAnswer, asState, asLayers, asDrafts, asWatching, linesOf, readLines, parseSettings, parseUpgradeCheck, parseState, parseLayers, idsIn$1, takes, cursorOps, settingsOps, upgradeOps, reportOps, HEAD_REF, gitDirOf, headOf$1, repoOf$2, branchKeyOf, wasKeyOf, there, moved, adopt, SPLIT$1, ADOPT_SIZE, adopting, keyIn, answerOps, layersOps, inboxOps, STATE_LOCK, DRAFTS_LOCK, held$1, stale$1, stolen, taken, freed, alone, watchOps, draftsOps, stateOps, makeStore, madeStore, storeAt;
9395
+ var Store, ensureDir, readOptional, missing$1, damaged, jsonOf$1, decoded, unwritable, wrote, added, INDENT, DRAFTS_VERSION, encoded, writes, appends, writeSettings, writeUpgradeCheck, writeState, writeLayers, writeRemarks, writeDrafts, writeBatch, writeAnswer, asSettings, asUpgradeCheck, asBatch, asAnswer, asState, asLayers, asRemarks, asDrafts, asWatching, linesOf, readLines, parseSettings, parseUpgradeCheck, parseState, parseLayers, parseRemarks, idsIn$1, takes, cursorOps, settingsOps, upgradeOps, reportOps, HEAD_REF, gitDirOf, headOf$1, repoOf$2, branchKeyOf, wasKeyOf, there, moved, adopt, SPLIT$1, ADOPT_SIZE, adopting, keyIn, answerOps, layersOps, remarksOps, inboxOps, STATE_LOCK, DRAFTS_LOCK, held$1, stale$1, stolen, taken, freed, alone, watchOps, draftsOps, stateOps, makeStore, madeStore, storeAt;
9184
9396
  var init_service$1 = __esmMin((() => {
9185
9397
  init_dist();
9186
9398
  init_error$2();
@@ -9249,6 +9461,7 @@ var init_service$1 = __esmMin((() => {
9249
9461
  writeUpgradeCheck = writes(UpgradeCheck, INDENT);
9250
9462
  writeState = writes(BranchState, INDENT);
9251
9463
  writeLayers = writes(StoredLayers, INDENT);
9464
+ writeRemarks = writes(StoredRemarks, INDENT);
9252
9465
  writeDrafts = writes(Drafts, INDENT);
9253
9466
  writeBatch = appends(Batch);
9254
9467
  writeAnswer = appends(StoredAnswer);
@@ -9258,6 +9471,7 @@ var init_service$1 = __esmMin((() => {
9258
9471
  asAnswer = decoded(StoredAnswer);
9259
9472
  asState = decoded(BranchState);
9260
9473
  asLayers = decoded(StoredLayers);
9474
+ asRemarks = decoded(StoredRemarks);
9261
9475
  asDrafts = decoded(Drafts);
9262
9476
  asWatching = decoded(Watching);
9263
9477
  linesOf = (raw) => raw.split("\n").filter((line) => line.trim().length > 0);
@@ -9276,6 +9490,9 @@ var init_service$1 = __esmMin((() => {
9276
9490
  parseLayers = fn("Store.parseLayers")(function* (path, raw) {
9277
9491
  return yield* asLayers(path, yield* jsonOf$1(path, raw));
9278
9492
  });
9493
+ parseRemarks = fn("Store.parseRemarks")(function* (path, raw) {
9494
+ return yield* asRemarks(path, yield* jsonOf$1(path, raw));
9495
+ });
9279
9496
  idsIn$1 = (batches) => batches.flatMap((batch) => batch.comments.map((one) => one.id));
9280
9497
  takes = (ids, at) => (was) => ({
9281
9498
  ...was,
@@ -9416,6 +9633,31 @@ var init_service$1 = __esmMin((() => {
9416
9633
  })
9417
9634
  };
9418
9635
  };
9636
+ remarksOps = (root, adopted) => {
9637
+ const remarks = fn("Store.remarks")(function* (worktreePath) {
9638
+ const key = yield* keyIn(adopted, worktreePath);
9639
+ const path = remarksPath(root, key);
9640
+ const raw = yield* readOptional(path);
9641
+ if (isNone(raw)) return none();
9642
+ return some(yield* parseRemarks(path, raw.value));
9643
+ });
9644
+ const saveRemarks = fn("Store.saveRemarks")(function* (worktreePath, next) {
9645
+ const key = yield* keyIn(adopted, worktreePath);
9646
+ const path = remarksPath(root, key);
9647
+ yield* ensureDir(branchDir(root, key));
9648
+ yield* writeRemarks(path, next);
9649
+ });
9650
+ const whileHoldingRemarks = (worktreePath, work) => gen(function* () {
9651
+ const key = yield* keyIn(adopted, worktreePath);
9652
+ yield* ensureDir(branchDir(root, key));
9653
+ return yield* alone(`${remarksPath(root, key)}.lock`, DRAFTS_LOCK, work);
9654
+ }).pipe(withSpan("Store.whileHoldingRemarks"));
9655
+ return {
9656
+ remarks,
9657
+ saveRemarks,
9658
+ whileHoldingRemarks
9659
+ };
9660
+ };
9419
9661
  inboxOps = (root, adopted) => {
9420
9662
  return {
9421
9663
  submit: fn("Store.submit")(function* (worktreePath, batch) {
@@ -9561,6 +9803,7 @@ var init_service$1 = __esmMin((() => {
9561
9803
  ...upgradeOps(root),
9562
9804
  ...talk,
9563
9805
  ...layersOps(root, adopted),
9806
+ ...remarksOps(root, adopted),
9564
9807
  ...watchOps(root, adopted),
9565
9808
  ...draftsOps(root, adopted),
9566
9809
  ...cursors
@@ -9592,7 +9835,7 @@ var init_model$3 = __esmMin((() => {
9592
9835
  }));
9593
9836
  //#endregion
9594
9837
  //#region src/domain/patch/anchor.ts
9595
- var sideOf, linesOn, anchorFor, rowsForRange, sideLines, runsAt, nearestRun, SHORTEST_NEAR, PER_EDIT, edits, isNear, nearestLike, foundAgain;
9838
+ var sideOf, linesOn, anchorFor, rowsForRange, sideLines, runsAt, nearestRun, SHORTEST_NEAR, PER_EDIT, edits, isNear, nearestLike, foundExactly, foundAlike, foundAgain;
9596
9839
  var init_anchor = __esmMin((() => {
9597
9840
  init_dist();
9598
9841
  init_model$3();
@@ -9659,7 +9902,7 @@ var init_anchor = __esmMin((() => {
9659
9902
  return room >= SHORTEST_NEAR && edits(one, other) <= Math.floor(room / PER_EDIT);
9660
9903
  };
9661
9904
  nearestLike = (lines, said, near) => lines.filter((here) => isNear(here.text, said)).toSorted((one, other) => Math.abs(one.line - near) - Math.abs(other.line - near))[0]?.line;
9662
- foundAgain = (patch, wanted) => {
9905
+ foundExactly = (patch, wanted) => {
9663
9906
  const said = wanted.snippet.split("\n");
9664
9907
  if (said.every((text) => text.trim().length === 0)) return none();
9665
9908
  const lines = sideLines(patch, wanted.side);
@@ -9670,15 +9913,25 @@ var init_anchor = __esmMin((() => {
9670
9913
  end: whole + said.length - 1
9671
9914
  });
9672
9915
  const first = said[0] ?? "";
9916
+ if (said.length === 1 || first.trim().length === 0) return none();
9917
+ const opening = nearestRun(lines, [first], wanted.start);
9918
+ return opening === void 0 ? none() : some({
9919
+ side: wanted.side,
9920
+ start: opening,
9921
+ end: opening
9922
+ });
9923
+ };
9924
+ foundAlike = (patch, wanted) => {
9925
+ const first = wanted.snippet.split("\n")[0] ?? "";
9673
9926
  if (first.trim().length === 0) return none();
9674
- const alike = (said.length === 1 ? void 0 : nearestRun(lines, [first], wanted.start)) ?? nearestLike(lines, first, wanted.start);
9675
- if (alike === void 0) return none();
9676
- return some({
9927
+ const alike = nearestLike(sideLines(patch, wanted.side), first, wanted.start);
9928
+ return alike === void 0 ? none() : some({
9677
9929
  side: wanted.side,
9678
9930
  start: alike,
9679
9931
  end: alike
9680
9932
  });
9681
9933
  };
9934
+ foundAgain = (patch, wanted) => orElse(foundExactly(patch, wanted), () => foundAlike(patch, wanted));
9682
9935
  }));
9683
9936
  //#endregion
9684
9937
  //#region src/domain/patch/parse.ts
@@ -10265,16 +10518,16 @@ var init_model$2 = __esmMin((() => {
10265
10518
  //#region src/domain/preferences/index.ts
10266
10519
  var init_preferences = __esmMin((() => {
10267
10520
  init_model$2();
10268
- }));
10269
- //#endregion
10270
- //#region src/cli/error.ts
10271
- var UnknownBranch, UnknownBase, UnknownFile, UnknownComment, UnknownPreference, UnknownPreferenceValue, UnselectableRange, UnknownCommand, MissingOption, UnknownWorktree, MalformedLayers, UnknownField, UnknownOption, BadOption, UnknownDraft, NothingDrafted, PartlySent, PullMoved, NoLayers, InitUnwritable;
10521
+ })), UnknownBranch, UnknownBase, UnknownFile, UnknownComment, UnknownRemark, NothingSaid, RemarkTaken, UnknownPreference, UnknownPreferenceValue, UnselectableRange, UnknownCommand, MissingOption, UnknownWorktree, MalformedLayers, UnknownField, UnknownOption, BadOption, UnknownDraft, NothingDrafted, PartlySent, PullMoved, NoLayers;
10272
10522
  var init_error = __esmMin((() => {
10273
10523
  init_dist();
10274
10524
  UnknownBranch = class extends TaggedError("UnknownBranch") {};
10275
10525
  UnknownBase = class extends TaggedError("UnknownBase") {};
10276
10526
  UnknownFile = class extends TaggedError("UnknownFile") {};
10277
10527
  UnknownComment = class extends TaggedError("UnknownComment") {};
10528
+ UnknownRemark = class extends TaggedError("UnknownRemark") {};
10529
+ NothingSaid = class extends TaggedError("NothingSaid") {};
10530
+ RemarkTaken = class extends TaggedError("RemarkTaken") {};
10278
10531
  UnknownPreference = class extends TaggedError("UnknownPreference") {};
10279
10532
  UnknownPreferenceValue = class extends TaggedError("UnknownPreferenceValue") {};
10280
10533
  UnselectableRange = class extends TaggedError("UnselectableRange") {};
@@ -10290,11 +10543,11 @@ var init_error = __esmMin((() => {
10290
10543
  PartlySent = class extends TaggedError("PartlySent") {};
10291
10544
  PullMoved = class extends TaggedError("PullMoved") {};
10292
10545
  NoLayers = class extends TaggedError("NoLayers") {};
10293
- InitUnwritable = class extends TaggedError("InitUnwritable") {};
10546
+ TaggedError("InitUnwritable");
10294
10547
  }));
10295
10548
  //#endregion
10296
10549
  //#region src/cli/commands.ts
10297
- var realOf, CONTEXT, POLL, AUTO, askedFor$1, basedOn, worktreeNamed, findBranch, baseFor, patchesOf, findPatch, waitingOn, summaryOf, summaryFor, listBranches, blobOf, vouchIn, toggleVouch, readingOf, progressIn, reviewProgress, bodyOf, saidTo, spunOf, sentOf, whereItSitsNow$1, sentIn, listSent, anchorIn, commentsIn, commentIn, submitComment, submitComments, without$1, submitReply, listPatches, patchIn, flatten, threadBefore, takeComments, repoOf$1, worktreeOf$1, branchAt, awaitComments, saveReport, fileSource, fileBefore, readPreferences, readPreference, ON, OFF, preferenceValue, savePreference, setBase, clearBase, markRead;
10550
+ var realOf, CONTEXT, POLL, AUTO, askedFor$1, basedOn, worktreeNamed, findBranch, baseFor, patchesOf, findPatch, waitingOn, summaryOf, summaryFor, listBranches, blobOf, vouchIn, toggleVouch, readingOf, progressIn, reviewProgress, bodyOf, saidTo, spunOf, sentOf, whereItSitsNow$1, sentIn, listSent, anchorIn, commentsIn, commentIn, submitComment, submitComments, without$2, submitReply, listPatches, patchIn, flatten, threadBefore, takeComments, repoOf$1, worktreeOf$1, branchAt, awaitComments, saveReport, fileSource, fileBefore, readPreferences, readPreference, ON, OFF, preferenceValue, savePreference, setBase, clearBase, markRead;
10298
10551
  var init_commands = __esmMin((() => {
10299
10552
  init_dist();
10300
10553
  init_patch();
@@ -10530,6 +10783,10 @@ var init_commands = __esmMin((() => {
10530
10783
  ...comment,
10531
10784
  placed: false
10532
10785
  };
10786
+ if (comment.start === 1e5) return {
10787
+ ...comment,
10788
+ placed: false
10789
+ };
10533
10790
  if (comment.snippet.trim().length === 0) return {
10534
10791
  ...comment,
10535
10792
  placed: true
@@ -10598,7 +10855,8 @@ var init_commands = __esmMin((() => {
10598
10855
  return {
10599
10856
  id: request.id,
10600
10857
  anchor,
10601
- body: request.body
10858
+ body: request.body,
10859
+ ...request.remark === void 0 ? {} : { remark: request.remark }
10602
10860
  };
10603
10861
  });
10604
10862
  const anchored = yield* forEach(requests, anchoring);
@@ -10621,7 +10879,7 @@ var init_commands = __esmMin((() => {
10621
10879
  const worktree = yield* findBranch(requests[0].repo, requests[0].branch);
10622
10880
  return yield* commentsIn(worktree, requests);
10623
10881
  });
10624
- without$1 = (held, key) => Object.fromEntries(Object.entries(held).filter(([held_]) => held_ !== key));
10882
+ without$2 = (held, key) => Object.fromEntries(Object.entries(held).filter(([held_]) => held_ !== key));
10625
10883
  submitReply = fn("Cli.submitReply")(function* (request) {
10626
10884
  const store = yield* Store;
10627
10885
  const worktree = yield* findBranch(request.repo, request.branch);
@@ -10643,7 +10901,7 @@ var init_commands = __esmMin((() => {
10643
10901
  const current = yield* store.state(worktree.path);
10644
10902
  if (Object.hasOwn(current.settled, root)) yield* store.changeState(worktree.path, (was) => ({
10645
10903
  ...was,
10646
- settled: without$1(was.settled, root)
10904
+ settled: without$2(was.settled, root)
10647
10905
  }));
10648
10906
  return batch;
10649
10907
  });
@@ -10709,13 +10967,13 @@ var init_commands = __esmMin((() => {
10709
10967
  const git = yield* Git;
10710
10968
  const worktree = yield* findBranch(repo, branch);
10711
10969
  const found = yield* git.source(worktree, file);
10712
- return getOrElse(found, () => []);
10970
+ return getOrElse$1(found, () => []);
10713
10971
  });
10714
10972
  fileBefore = fn("Cli.fileBefore")(function* (repo, branch, file) {
10715
10973
  const git = yield* Git;
10716
10974
  const worktree = yield* findBranch(repo, branch);
10717
10975
  const found = yield* git.blob(worktree, file);
10718
- return getOrElse(found, () => []);
10976
+ return getOrElse$1(found, () => []);
10719
10977
  });
10720
10978
  readPreferences = fn("Cli.readPreferences")(function* () {
10721
10979
  const kept = yield* (yield* Store).settings;
@@ -10936,398 +11194,6 @@ var init_drafts = __esmMin((() => {
10936
11194
  });
10937
11195
  }));
10938
11196
  //#endregion
10939
- //#region src/cli/shipped-skill.ts
10940
- var SHIPPED_SKILL;
10941
- var init_shipped_skill = __esmMin((() => {
10942
- SHIPPED_SKILL = [
10943
- "---",
10944
- "name: adiff",
10945
- "description: Pick up review comments left on this worktree's diff in the adiff terminal, act on them, and answer them by id. Use when the user says they left comments, asks you to check adiff, asks you to watch for review feedback, or asks you to hand work over for review.",
10946
- "---",
10947
- "",
10948
- "# adiff",
10949
- "",
10950
- "A human is reviewing your work in the adiff terminal. When they select lines and comment, the",
10951
- "comment is filed against this worktree. This skill is how you collect those comments.",
10952
- "",
10953
- "## Collect what is waiting",
10954
- "",
10955
- "```bash",
10956
- "adiff comment take --worktree .",
10957
- "```",
10958
- "",
10959
- "Returns one JSON line:",
10960
- "",
10961
- "```json",
10962
- "{\"ok\":true,\"comments\":[{\"at\":\"2026-07-30T09:12:04.881Z\",\"head\":\"8e67f663\",\"file\":\"src/api.ts\",\"side\":\"new\",\"start\":4,\"end\":5,\"snippet\":\" const third = 3\\n return first + second + third\",\"body\":\"third is unused outside this sum\"}]}",
10963
- "```",
10964
- "",
10965
- "Each comment carries the code it is about. `snippet` is the exact text the reviewer had selected,",
10966
- "`side` says whether the line numbers are in the new file (`new`) or the version being replaced",
10967
- "(`old`), and `head` is the commit the diff was read at.",
10968
- "",
10969
- "A comment keeps coming back until it is answered. A second `take` returns it again, so answer what",
10970
- "you take. Settling or removing it also retires it: those are the reviewer saying they no longer",
10971
- "need one.",
10972
- "",
10973
- "## Wait for the next one",
10974
- "",
10975
- "```bash",
10976
- "adiff comment take --worktree . --wait 300",
10977
- "```",
10978
- "",
10979
- "Blocks until a comment arrives or the timeout in seconds elapses, then returns the same envelope.",
10980
- "An empty `comments` array means the wait expired with nothing new — that is not an error.",
10981
- "",
10982
- "`--wait` takes a whole number of seconds from 1 to 86400. A value outside that is refused on",
10983
- "stderr with exit 2, because an instant empty answer would read exactly like a wait that expired:",
10984
- "if a wait comes back at once, you are not waiting.",
10985
- "",
10986
- "Arm the wait as the first thing you do in a turn, before the work. A turn that is interrupted",
10987
- "half-way then still leaves a listener running, and a wait armed at the end of a turn is a wait that",
10988
- "often never gets armed.",
10989
- "",
10990
- "Run the wait in the background, not in the foreground. A foreground wait holds the turn, so you",
10991
- "cannot do anything else and the person you are working with cannot talk to you. Backgrounded, the",
10992
- "harness brings you back the moment a comment lands.",
10993
- "",
10994
- "Keep one wait per worktree. A second wait returns the same comments as the first, so two of them",
10995
- "running at once is two of you answering the same comment. Before starting one, check whether one is",
10996
- "already running.",
10997
- "",
10998
- "Re-arm it after each comment you handle, and keep it running while you work. A reviewer reads at",
10999
- "their own pace, so comments arrive minutes apart, and the whole point is that they reach you as",
11000
- "events rather than by you asking. When you finish a piece of work, say you are still listening.",
11001
- "",
11002
- "A backgrounded wait that is killed rather than expiring is not the reviewer going quiet, and not a",
11003
- "reason to stop listening. A kill loses whatever the wait would have handed you, so take once",
11004
- "without `--wait` to collect what landed, then arm a new wait.",
11005
- "",
11006
- "## Answering a comment",
11007
- "",
11008
- "Say what you did, against the comment you were handed:",
11009
- "",
11010
- "```bash",
11011
- "adiff comment answer --worktree . --id <id> --body \"Dropped it, and the import with it.\"",
11012
- "```",
11013
- "",
11014
- "The id comes from `comment take`. The reviewer sees the answer under their own words the next time",
11015
- "they read the branch, so this is how they learn a point was addressed rather than ignored.",
11016
- "",
11017
- "Answer when the change alone does not carry the reasoning: what you did instead of what was asked,",
11018
- "what you found while doing it, or why the comment does not apply. A comment that asked a question",
11019
- "deserves an answer even when nothing changed.",
11020
- "",
11021
- "Add `--question` when you need the reviewer to decide before you continue:",
11022
- "",
11023
- "```bash",
11024
- "adiff comment answer --worktree . --id <id> --question --body \"Drop it, or keep it and map the error?\"",
11025
- "```",
11026
- "",
11027
- "That marks the thread as waiting on them rather than on you. Do not use it to check in; use it when",
11028
- "the work genuinely stops without an answer.",
11029
- "",
11030
- "## When the reviewer writes back",
11031
- "",
11032
- "A reviewer can reply to an answer, and the reply arrives through `comment take` like any other",
11033
- "comment — with an `id` of its own that you answer against, and a `thread` carrying what was said",
11034
- "before it, oldest first:",
11035
- "",
11036
- "```json",
11037
- "{\"body\":\"the imports\",\"replyTo\":\"c1\",\"thread\":[{\"voice\":\"reviewer\",\"body\":\"why two of these\"},{\"voice\":\"agent\",\"body\":\"which two did you mean\"}]}",
11038
- "```",
11039
- "",
11040
- "Read the thread before answering. A reply is usually short because it is the rest of a sentence you",
11041
- "already have: \"the imports\" only means something next to the question it answers. Answer it against",
11042
- "its own id, not the id of the comment that started the thread.",
11043
- "",
11044
- "Settling a thread is the reviewer's to do, not yours. They raised the point, so they decide it is",
11045
- "closed.",
11046
- "",
11047
- "## Acting on a comment",
11048
- "",
11049
- "Read `snippet` before opening the file: the reviewer commented on the diff, and the file may have",
11050
- "moved on since. If `head` no longer matches `git rev-parse --short HEAD`, the change you are being",
11051
- "asked about may already be gone — say so rather than guessing at what they meant.",
11052
- "",
11053
- "Answer the comment by doing the work, not by replying. The reviewer is watching the diff; your",
11054
- "next commit is the reply. When a comment is a question rather than a request, answer it in the",
11055
- "commit message of the change it concerns, or plainly in chat if no change is needed.",
11056
- "",
11057
- "Handle every comment in the batch before taking again.",
11058
- "",
11059
- "## Failure",
11060
- "",
11061
- "Failures go to **stderr**, never stdout, so stdout is always safe to parse. The shape is",
11062
- "`{\"ok\":false,\"error\":{\"type\":\"...\",\"retriable\":false,\"suggestion\":\"...\"}}`, and the exit code says",
11063
- "what kind of problem it is: `2` the request was malformed, `3` the branch or file does not exist,",
11064
- "`1` something unexpected.",
11065
- "",
11066
- "Every command that acts on a review takes either `--worktree <path>` or `--repo <path>` with",
11067
- "`--branch <name>`. Standing in the worktree, `--worktree .` is always enough.",
11068
- "",
11069
- "Read `suggestion` before doing anything else — it names the command that resolves the failure.",
11070
- "Retry only when `retriable` is true. `UnknownBranch` means this worktree is not one adiff knows",
11071
- "about, because the reviewer has not opened it; report that rather than looping.",
11072
- "",
11073
- "## Handing work over",
11074
- "",
11075
- "Finishing is not a reason to publish anything. Say the work is ready, put the review in front of",
11076
- "them if they asked for one, and say how to read it. That is the whole handover. A reading order is",
11077
- "extra work you do on request, and it has its own section further down.",
11078
- "",
11079
- "## Put the review in front of them",
11080
- "",
11081
- "When someone asks you for a review, open it rather than describing how:",
11082
- "",
11083
- "```bash",
11084
- "adiff review pane --repo <repo> --branch <branch>",
11085
- "```",
11086
- "",
11087
- "It splits the pane they are already looking at, so their next move is to look right rather than to",
11088
- "type. The answer says what happened:",
11089
- "",
11090
- "```json",
11091
- "{\"ok\":true,\"opened\":true,\"pane\":\"tmux\",\"command\":\"adiff review open --repo /work/api --branch add-invitations\"}",
11092
- "```",
11093
- "",
11094
- "`opened:false` means nothing could be split, which is ordinary: a terminal without tmux, Zellij,",
11095
- "WezTerm or kitty has nowhere to put a pane. The answer carries `command` either way, so quote that",
11096
- "line and let them run it.",
11097
- "",
11098
- "Open a pane when a review was asked for. Finishing work is not a reason on its own, and taking over",
11099
- "someone's screen uninvited is worse than a line they have to copy.",
11100
- "",
11101
- "## Tell the reviewer how to read it",
11102
- "",
11103
- "Whether or not a pane opened, say what to do with it. Name the repository they should point at,",
11104
- "which is the repository the worktree belongs to:",
11105
- "",
11106
- "> Open it with `adiff review open --repo <repo> --branch <branch>`, which lands on this branch's",
11107
- "> diff. The sidebar lists the files; `j` and `k` move down the diff, `]` and `[` walk between",
11108
- "> files, `}` and `{` jump to the next and previous change, `G` goes to the end. Select lines with",
11109
- "> `v`, write a comment with `c`, and send it with `ctrl+s`. Press `?` for the rest.",
11110
- "",
11111
- "Fill the repository path and the branch in yourself, so nobody has to compose the command or find",
11112
- "the branch in a list. `--branch` takes the name `branch list` reports; without it the review opens",
11113
- "on the worktree list.",
11114
- "",
11115
- "Say what you want looked at hardest, and where you are unsure. A reviewer who knows which part you",
11116
- "doubt spends their attention there. Offer a reading order rather than writing one: if the change is",
11117
- "long enough that the order matters, say you can publish one and let them decide.",
11118
- "",
11119
- "## Publishing a reading order, when you are asked for one",
11120
- "",
11121
- "Only when the reviewer asks. A reading order is a real piece of work, it can be wrong, and one",
11122
- "nobody wanted spends their attention on your summary rather than on the code.",
11123
- "",
11124
- "The ask often arrives as a comment. Pressing `L` in the review sends you one of these:",
11125
- "",
11126
- "- \"Please write a reading order for this branch with `adiff layers set` …\" — there is none yet.",
11127
- "- \"The reading order on this branch describes an older commit …\" — read the diff again from",
11128
- " scratch. Do not patch the old layers; line numbers have moved.",
11129
- "- \"Please revise the reading order …\" — there is one and the reviewer wants it different. Ask what",
11130
- " is wrong with it if the comment does not say.",
11131
- "",
11132
- "Answer it like any other comment when you are done.",
11133
- "",
11134
- "When they do ask, write **layers**: an ordered set over the diff, each one a claim about a span of",
11135
- "code. The reviewer then walks the argument instead of the filesystem.",
11136
- "",
11137
- "```bash",
11138
- "adiff layers set --worktree . --json - <<'JSON'",
11139
- "{",
11140
- " \"summary\": \"Team invitations, end to end\",",
11141
- " \"layers\": [",
11142
- " {",
11143
- " \"title\": \"Add the invitation data model\",",
11144
- " \"note\": \"The record every later layer leans on\",",
11145
- " \"spans\": [{ \"path\": \"src/db/invites.ts\", \"start\": 1, \"end\": 48 }]",
11146
- " },",
11147
- " {",
11148
- " \"title\": \"Add the invitation API\",",
11149
- " \"spans\": [",
11150
- " { \"path\": \"src/api/invites.ts\", \"start\": 1, \"end\": 96 },",
11151
- " { \"path\": \"src/api/router.ts\", \"start\": 12, \"end\": 14 }",
11152
- " ]",
11153
- " },",
11154
- " {",
11155
- " \"title\": \"Build the invite & members UI\",",
11156
- " \"spans\": [{ \"path\": \"src/ui/Members.tsx\", \"start\": 1, \"end\": 210 }]",
11157
- " }",
11158
- " ]",
11159
- "}",
11160
- "JSON",
11161
- "```",
11162
- "",
11163
- "Rules that make a layers worth reading:",
11164
- "",
11165
- "- **Order is the point.** Layer 1 is what the reader must understand before layer 2 makes sense.",
11166
- " Data model, then the code that uses it, then the surface, then the mechanical bits last.",
11167
- "- **A title is a claim, not a file name.** \"Add the invitation API\", never \"changes to",
11168
- " src/api/invites.ts\".",
11169
- "- **Line numbers are the new side of the diff**, the same numbers `adiff comment take` reports.",
11170
- "- **Cover everything.** adiff computes coverage itself and answers with the changed lines no layer",
11171
- " claims; those show up for the reviewer under \"not in any layer\" whatever you do. A layer set that",
11172
- " quietly skips a third of the diff is worse than none, so put the leftovers in a final layer and",
11173
- " say they are mechanical. Claim the lines you actually read: a span reaching past them counts only",
11174
- " the changed lines inside it, so padding the range buys nothing.",
11175
- "",
11176
- "The answer to `layers set` is the honest report — check it before you claim to be done:",
11177
- "",
11178
- "```json",
11179
- "{\"ok\":true,\"layers\":{\"version\":1,\"stale\":false,\"covered\":7,\"partial\":1,\"total\":9,\"uncovered\":[{\"path\":\"src/api/router.ts\",\"start\":40,\"end\":52}],\"vanished\":[],\"layers\":[{\"title\":\"Add the invitation data model\",\"files\":[\"src/db/invites.ts\"],\"covered\":1,\"partial\":0,\"vanished\":[]}]}}",
11180
- "",
11181
- "`covered`, `partial` and `vanished` appear per layer as well as for the document, so you can tell",
11182
- "which of your own layers is the thin one. `vanished` on a layer names paths it claims that are not",
11183
- "in the diff — usually a typo or a file that moved.",
11184
- "",
11185
- "`layers set` refuses a document it cannot use and says which layer is wrong and why: a span that",
11186
- "ends before it starts, a span starting below line 1, a start or end that is not a whole number, a",
11187
- "block with no `kind`, a layer with no title. It no longer drops a bad span quietly, so a layer that",
11188
- "used to cover less than you thought now fails loudly instead.",
11189
- "```",
11190
- "",
11191
- "`total` counts hunks. `covered` counts the ones where every changed line sits inside a layer, and",
11192
- "`partial` the ones a layer explains only some of. `uncovered` names the runs of changed lines no",
11193
- "layer claims, so it reads as line numbers a reviewer would otherwise have to find alone: claim them",
11194
- "and set the layers again. Done means `uncovered` is empty. `vanished` names paths a layer points at",
11195
- "that this branch does not change, which usually means a typo in a path. Read it back at any time",
11196
- "with:",
11197
- "",
11198
- "```bash",
11199
- "adiff layers show --worktree . --fields covered,partial,total,uncovered",
11200
- "```",
11201
- "",
11202
- "`uncovered` does not always empty out by claiming lines you can see. A deleted line is counted at",
11203
- "the number it had in the old file, so a branch that cuts a file from 409 lines to 394 reports an",
11204
- "uncovered run at 395-409 — line numbers past the end of the file as it now stands. A span over the",
11205
- "new file cannot reach them; only a span whose `end` runs past the end of the file can. Write one, or",
11206
- "say the run is unreachable, rather than reading the leftover as a layer you forgot.",
11207
- "",
11208
- "That is also the case for spans generally: `start` 1 to past the last line covers a file whatever",
11209
- "happens to it, while a tight range goes stale on the next push that moves the lines under it.",
11210
- "",
11211
- "Setting layers again supersedes the previous set and bumps `version`; the set records the commit it",
11212
- "was written for, and adiff reports it as `stale` once the branch moves past that commit. Once a",
11213
- "reviewer has a reading order, keep it true: write it again after you address their comments.",
11214
- "",
11215
- "When you have published one, tell them the sidebar now holds it: `s` swaps between the layers and",
11216
- "the files, each layer shows the files it covers with the ones already reviewed ticked off, and `]`",
11217
- "and `[` walk those files in the order you put them in — from the last file of one layer into the",
11218
- "first of the next.",
11219
- "",
11220
- "## Helping draft a review of somebody else's pull request",
11221
- "",
11222
- "Sometimes the reviewer is not reading your work — they are reading a stranger's pull request and",
11223
- "want you to think it through with them before they say anything on it. There, a comment is not an",
11224
- "instruction to you. It is a draft of what the reviewer will say, in the reviewer's name.",
11225
- "",
11226
- "Comments on a pull request are **held**. Nothing reaches the forge until the reviewer sends them.",
11227
- "",
11228
- "```bash",
11229
- "adiff draft list --repo . --branch their-change",
11230
- "adiff draft add --repo . --branch their-change --file src/api.ts --start 40 --end 52 --body \"…\"",
11231
- "adiff draft edit --repo . --branch their-change --id d1 --body \"…\"",
11232
- "adiff draft drop --repo . --branch their-change --id d1",
11233
- "```",
11234
- "",
11235
- "`draft add` anchors the same way `comment send` does, so `--side old` is the version being replaced.",
11236
- "",
11237
- "Rules for drafting on somebody else's behalf:",
11238
- "",
11239
- "- **You never send.** There is no command that dispatches, on purpose. The reviewer signs the",
11240
- " review, so the reviewer sends it.",
11241
- "- **Write what the reviewer meant, not what you would say.** They told you the point; your job is",
11242
- " the wording. If you are not sure what the point is, ask rather than inventing one.",
11243
- "- **One draft per point.** A held comment that covers three things cannot be dropped in part.",
11244
- "- **Say what you drafted.** List the drafts back after you write them, so the reviewer can read",
11245
- " them over rather than discovering them at the moment of sending.",
11246
- "- **A draft is not a review of the reviewer.** Do not soften a point they meant sharply, or sharpen",
11247
- " one they meant gently.",
11248
- "",
11249
- "## Discovering the rest",
11250
- "",
11251
- "```bash",
11252
- "adiff describe",
11253
- "```",
11254
- "",
11255
- "Returns every command with its options, which are required, which part of the loop it belongs to,",
11256
- "and where its payload sits. `adiff <command> --help` says the same for one command in plain text.",
11257
- "Use either instead of guessing, and use `--fields` to keep answers small:",
11258
- "",
11259
- "```bash",
11260
- "adiff branch list --repo . --fields branch,files",
11261
- "```",
11262
- ""
11263
- ].join("\n");
11264
- }));
11265
- //#endregion
11266
- //#region src/cli/skill.ts
11267
- var readAt, writeAt, SKILL_AT, isLink, refreshAt, settledRoot, refreshSkill;
11268
- var init_skill = __esmMin((() => {
11269
- init_dist();
11270
- init_error();
11271
- init_shipped_skill();
11272
- readAt = fn("Cli.readAt")(function* (path) {
11273
- return yield* tryPromise({
11274
- try: () => readFile(path, "utf8"),
11275
- catch: () => new InitUnwritable({
11276
- path,
11277
- reason: "unreadable"
11278
- })
11279
- }).pipe(option$1);
11280
- });
11281
- writeAt = fn("Cli.writeAt")(function* (path, text) {
11282
- yield* tryPromise({
11283
- try: () => mkdir(dirname(path), { recursive: true }).then(() => writeFile(path, text, "utf8")),
11284
- catch: (cause) => new InitUnwritable({
11285
- path,
11286
- reason: String(cause)
11287
- })
11288
- });
11289
- });
11290
- SKILL_AT = join(".claude", "skills", "adiff", "SKILL.md");
11291
- isLink = (path) => {
11292
- try {
11293
- return lstatSync(path).isSymbolicLink();
11294
- } catch {
11295
- return false;
11296
- }
11297
- };
11298
- refreshAt = fn("Cli.refreshAt")(function* (root, wanted) {
11299
- const path = join(root, SKILL_AT);
11300
- if (!existsSync(path)) return [];
11301
- if (isLink(path)) return [{
11302
- path,
11303
- action: "linked"
11304
- }];
11305
- const current = yield* readAt(path);
11306
- if (getOrUndefined$1(current) === wanted) return [{
11307
- path,
11308
- action: "unchanged"
11309
- }];
11310
- yield* writeAt(path, wanted);
11311
- return [{
11312
- path,
11313
- action: "update"
11314
- }];
11315
- });
11316
- settledRoot = (root) => {
11317
- try {
11318
- return realpathSync(root);
11319
- } catch {
11320
- return root;
11321
- }
11322
- };
11323
- refreshSkill = fn("Cli.refreshSkill")(function* (roots) {
11324
- const seen = [...new Set(roots.map(settledRoot))];
11325
- const found = [];
11326
- for (const root of seen) found.push(...yield* refreshAt(root, SHIPPED_SKILL));
11327
- return { changes: found };
11328
- });
11329
- }));
11330
- //#endregion
11331
11197
  //#region src/cli/pane.ts
11332
11198
  var TIMEOUT_MS, set, splitters, named, selfInvocation, ran, split, openPane;
11333
11199
  var init_pane = __esmMin((() => {
@@ -11433,12 +11299,11 @@ var init_pane = __esmMin((() => {
11433
11299
  //#endregion
11434
11300
  //#region package.json
11435
11301
  init_drafts();
11436
- init_skill();
11437
11302
  init_pane();
11438
- var version$1 = "0.1.0-alpha.146";
11303
+ var version$1 = "0.1.0-alpha.148";
11439
11304
  //#endregion
11440
11305
  //#region src/cli/upgrade.ts
11441
- 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, ranChild, runUpgrade, statusOf$1, sayFound, sayDone, attempted, REFRESH_MS, NOT_ASKED, refreshSkills, updatedIn, sayRefreshed, upgradeReport;
11306
+ 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, ranChild, runUpgrade, statusOf$1, sayFound, sayDone, attempted, SAY_SKILL_TOO, upgradeReport;
11442
11307
  var init_upgrade$1 = __esmMin((() => {
11443
11308
  init_dist();
11444
11309
  PACKAGE = "@eliya-oss/agent-diff";
@@ -11595,41 +11460,7 @@ var init_upgrade$1 = __esmMin((() => {
11595
11460
  if (found.latest === void 0) return `Ran \`${found.command}\`. Run \`adiff --version\` to see which build you have now.`;
11596
11461
  return `Ran \`${found.command}\`, and adiff ${found.latest} is installed now.`;
11597
11462
  };
11598
- REFRESH_MS = 1e4;
11599
- NOT_ASKED = {
11600
- updated: [],
11601
- failed: false
11602
- };
11603
- refreshSkills = ranChild({
11604
- command: "adiff",
11605
- args: [
11606
- "skill",
11607
- "refresh",
11608
- "--json"
11609
- ],
11610
- timeout: REFRESH_MS,
11611
- stdio: [
11612
- "ignore",
11613
- "pipe",
11614
- "ignore"
11615
- ]
11616
- }, (code, said) => code === 0 ? {
11617
- updated: updatedIn(said),
11618
- failed: false
11619
- } : {
11620
- updated: [],
11621
- failed: true
11622
- }, NOT_ASKED).pipe(withSpan("Cli.refreshedSkill"));
11623
- updatedIn = (said) => {
11624
- return (runSync(try_(() => JSON.parse(said)).pipe(orElseSucceed(() => ({})))).changes ?? []).filter((change) => change.action === "update").flatMap((change) => change.path === void 0 ? [] : [change.path]);
11625
- };
11626
- sayRefreshed = (refreshed) => {
11627
- if (refreshed.failed) return "The skill installed beside this could not be rewritten, so it still describes the older adiff. Run `adiff skill refresh` to see why.";
11628
- const first = refreshed.updated[0];
11629
- if (first === void 0) return void 0;
11630
- const rest = refreshed.updated.length - 1;
11631
- return rest === 0 ? `The skill at ${first} is the newest one too.` : `The skill at ${first} and ${rest} more is the newest one too.`;
11632
- };
11463
+ SAY_SKILL_TOO = "Run `npx skills update adiff` to bring the skill up with it.";
11633
11464
  upgradeReport = (found, ran, check) => {
11634
11465
  const note = found.current === true ? statusOf$1(found) : willUpgrade(found, check) ? `${statusOf$1(found)} ${attempted(found, ran)}` : `${statusOf$1(found)} ${NOTES[found.route]} Run \`${found.command}\` to upgrade.`;
11635
11466
  return {
@@ -12068,7 +11899,7 @@ var init_layers = __esmMin((() => {
12068
11899
  }));
12069
11900
  //#endregion
12070
11901
  //#region src/cli/threads.ts
12071
- var stateOf, whereItSitsNow, spoken$1, turnsOf, threadOf, threadsIn, idsIn, isKnown, listThreads, answerComment, settleIn, settleThread, removeIn, removeComment, without, restoreIn, restoreComment, settleRead;
11902
+ var stateOf$1, whereItSitsNow, spoken$1, turnsOf, threadOf, threadsIn, idsIn, isKnown, listThreads, answerComment, settleIn, settleThread, removeIn, removeComment, without$1, restoreIn, restoreComment, settleRead;
12072
11903
  var init_threads = __esmMin((() => {
12073
11904
  init_dist();
12074
11905
  init_patch();
@@ -12076,7 +11907,7 @@ var init_threads = __esmMin((() => {
12076
11907
  init_commands();
12077
11908
  init_layers();
12078
11909
  init_error();
12079
- stateOf = (turns, asked, isSettled, isRemoved) => {
11910
+ stateOf$1 = (turns, asked, isSettled, isRemoved) => {
12080
11911
  if (isRemoved) return "removed";
12081
11912
  if (isSettled) return "done";
12082
11913
  const last = turns.at(-1);
@@ -12133,7 +11964,7 @@ var init_threads = __esmMin((() => {
12133
11964
  start: sits.start,
12134
11965
  end: sits.end,
12135
11966
  body: comment.body,
12136
- state: stateOf(turns, mine.at(-1)?.asks === true, settled, Object.hasOwn(reading.removed, comment.id)),
11967
+ state: stateOf$1(turns, mine.at(-1)?.asks === true, settled, Object.hasOwn(reading.removed, comment.id)),
12137
11968
  stale: batch.head !== reading.head,
12138
11969
  outside: !reading.shown.has(comment.anchor.path) || !sits.placed,
12139
11970
  unread: Math.max(0, mine.length - seen),
@@ -12225,13 +12056,13 @@ var init_threads = __esmMin((() => {
12225
12056
  removeComment = fn("Cli.removeComment")(function* (repo, branch, id, at) {
12226
12057
  return yield* removeIn(yield* findBranch(repo, branch), id, at);
12227
12058
  });
12228
- without = (entries, id) => Object.fromEntries(Object.entries(entries).filter(([key]) => key !== id));
12059
+ without$1 = (entries, id) => Object.fromEntries(Object.entries(entries).filter(([key]) => key !== id));
12229
12060
  restoreIn = fn("Cli.restoreIn")(function* (worktree, id) {
12230
12061
  const store = yield* Store;
12231
12062
  if (!(yield* isKnown(worktree.path, id))) return yield* new UnknownComment({ id });
12232
12063
  yield* store.changeState(worktree.path, (was) => ({
12233
12064
  ...was,
12234
- removed: without(was.removed, id)
12065
+ removed: without$1(was.removed, id)
12235
12066
  }));
12236
12067
  return { restored: id };
12237
12068
  });
@@ -12241,7 +12072,7 @@ var init_threads = __esmMin((() => {
12241
12072
  if (!(yield* isKnown(worktree.path, id))) return yield* new UnknownComment({ id });
12242
12073
  yield* store.changeState(worktree.path, (was) => ({
12243
12074
  ...was,
12244
- removed: without(was.removed, id)
12075
+ removed: without$1(was.removed, id)
12245
12076
  }));
12246
12077
  return { restored: id };
12247
12078
  });
@@ -12630,6 +12461,94 @@ var init_catalog = __esmMin((() => {
12630
12461
  dataKey: "comments",
12631
12462
  example: "adiff comment list --worktree . --fields id,body,settled"
12632
12463
  },
12464
+ {
12465
+ name: "remark list",
12466
+ about: "Every remark on the branch's pull request, with who left it and whether it is triaged",
12467
+ group: FOLLOW_UP,
12468
+ addresses: "review",
12469
+ safety: "read",
12470
+ options: [...addressing],
12471
+ dataKey: "remarks",
12472
+ example: "adiff remark list --repo . --branch add-invitations"
12473
+ },
12474
+ {
12475
+ name: "remark accept",
12476
+ about: "Take a remark on as your own comment, so the agent picks it up",
12477
+ group: FOLLOW_UP,
12478
+ addresses: "review",
12479
+ safety: "write",
12480
+ options: [
12481
+ ...addressing,
12482
+ {
12483
+ name: "id",
12484
+ required: true,
12485
+ value: "id",
12486
+ about: "The remark to accept"
12487
+ },
12488
+ {
12489
+ name: "body",
12490
+ required: false,
12491
+ value: "text",
12492
+ about: "What to tell the agent, instead of the remark's own words"
12493
+ }
12494
+ ],
12495
+ dataKey: "accepted",
12496
+ example: "adiff remark accept --repo . --branch add-invitations --id PRRT_kw"
12497
+ },
12498
+ {
12499
+ name: "remark reply",
12500
+ about: "Answer a remark in its thread on the pull request",
12501
+ group: FOLLOW_UP,
12502
+ addresses: "review",
12503
+ safety: "write",
12504
+ options: [
12505
+ ...addressing,
12506
+ {
12507
+ name: "id",
12508
+ required: true,
12509
+ value: "id",
12510
+ about: "The remark to answer"
12511
+ },
12512
+ {
12513
+ name: "body",
12514
+ required: true,
12515
+ value: "text",
12516
+ about: "What to say in the thread"
12517
+ }
12518
+ ],
12519
+ dataKey: "answered",
12520
+ example: "adiff remark reply --repo . --branch add-invitations --id PRRT_kw --body \"fair, done\""
12521
+ },
12522
+ {
12523
+ name: "remark dismiss",
12524
+ about: "Take a remark out of this review. It stays on the pull request",
12525
+ group: FOLLOW_UP,
12526
+ addresses: "review",
12527
+ safety: "write",
12528
+ options: [...addressing, {
12529
+ name: "id",
12530
+ required: true,
12531
+ value: "id",
12532
+ about: "The remark to dismiss"
12533
+ }],
12534
+ dataKey: "dismissed",
12535
+ example: "adiff remark dismiss --repo . --branch add-invitations --id PRRT_kw"
12536
+ },
12537
+ {
12538
+ name: "remark restore",
12539
+ about: "Put a dismissed remark back into this review",
12540
+ group: FOLLOW_UP,
12541
+ addresses: "review",
12542
+ safety: "write",
12543
+ options: [...addressing, {
12544
+ name: "id",
12545
+ required: true,
12546
+ value: "id",
12547
+ about: "The remark to restore"
12548
+ }],
12549
+ dataKey: "restored",
12550
+ example: "adiff remark restore --repo . --branch add-invitations --id PRRT_kw"
12551
+ },
12633
12552
  {
12634
12553
  name: "comment resolve",
12635
12554
  about: "Mark a comment settled. Only the reviewer who raised it can",
@@ -12720,16 +12639,6 @@ var init_catalog = __esmMin((() => {
12720
12639
  dataKey: "preference",
12721
12640
  example: "adiff config set --name hold --value on"
12722
12641
  },
12723
- {
12724
- name: "skill refresh",
12725
- about: "Rewrite the adiff skill wherever it is already installed, in this directory and in your home directory. Installs nothing that is not already there",
12726
- group: SET_UP,
12727
- addresses: "none",
12728
- safety: "write",
12729
- options: [],
12730
- dataKey: "changes",
12731
- example: "adiff skill refresh"
12732
- },
12733
12642
  {
12734
12643
  name: "upgrade",
12735
12644
  about: "Upgrade this install to the newest build, using whatever installed it. Answers a person in plain text, and a caller in JSON with --json",
@@ -12963,6 +12872,21 @@ var init_report$1 = __esmMin((() => {
12963
12872
  suggestion: "No comment carries that id. `adiff comment take` reports the ids an agent can answer, and `adiff comment list` reports every id on a review.",
12964
12873
  retriable: false
12965
12874
  },
12875
+ UnknownRemark: {
12876
+ exit: 3,
12877
+ suggestion: "No remark on this pull request carries that id. `adiff remark list` reports the ids it holds.",
12878
+ retriable: false
12879
+ },
12880
+ NothingSaid: {
12881
+ exit: 3,
12882
+ suggestion: "Nothing was written. Pass `--body` with what you mean to say.",
12883
+ retriable: false
12884
+ },
12885
+ RemarkTaken: {
12886
+ exit: 3,
12887
+ suggestion: "That remark is already a comment on this review. `adiff comment list` reports it, and removing that comment frees the remark.",
12888
+ retriable: false
12889
+ },
12966
12890
  UnknownField: {
12967
12891
  exit: 2,
12968
12892
  suggestion: "That is not a field this answer carries. The ones it does are named above.",
@@ -13103,6 +13027,269 @@ var init_report$1 = __esmMin((() => {
13103
13027
  exit: advice.exit
13104
13028
  };
13105
13029
  };
13030
+ })), VERSION, OPENING, CLOSING, heldOf, bared, dropped, quotedCode, snippetOf$1, spokenWithout, spanOf, showsLine, placedNow, stateOf, heldPair, acceptedIn, shownOf$1, remarksIn, listRemarks, heldRemarks, remarksAgainst, remarksHeldIn, remarkNamed, without, notTaken, dismissIn, undismissIn, dismissRemark, restoreRemark, quoted, anchorFrom, takingOn, acceptIn, acceptRemark, answerRemark;
13031
+ var init_remarks = __esmMin((() => {
13032
+ init_dist();
13033
+ init_patch();
13034
+ init_forge();
13035
+ init_store();
13036
+ init_commands();
13037
+ init_error();
13038
+ VERSION = 1;
13039
+ OPENING = /^```suggestion[^\n]*\n?/gm;
13040
+ CLOSING = /^```[ \t]*$/gm;
13041
+ heldOf = (one) => ({
13042
+ id: one.id,
13043
+ answerTo: one.answerTo,
13044
+ moreReplies: one.moreReplies,
13045
+ path: one.path,
13046
+ side: one.side,
13047
+ line: one.line,
13048
+ start: one.start,
13049
+ by: one.by,
13050
+ body: one.body,
13051
+ replies: one.replies,
13052
+ hunk: one.hunk,
13053
+ commit: one.commit,
13054
+ outdated: one.outdated
13055
+ });
13056
+ bared = (line) => line.startsWith("+") || line.startsWith("-") || line.startsWith(" ") ? line.slice(1) : line;
13057
+ dropped = (line, side) => {
13058
+ if (line.length === 0 || line.startsWith("@@") || line.startsWith("\\ ")) return true;
13059
+ return side === "old" ? line.startsWith("+") : line.startsWith("-");
13060
+ };
13061
+ quotedCode = (hunk, side) => hunk.split("\n").filter((line) => !dropped(line, side)).map(bared);
13062
+ snippetOf$1 = (held) => quotedCode(held.hunk, held.side).findLast((line) => line.trim().length > 0) ?? "";
13063
+ spokenWithout = (body) => body.replace(OPENING, "").replace(CLOSING, "").trimEnd();
13064
+ spanOf = (held, end) => held.start > 0 && held.start <= held.line ? end - (held.line - held.start) : end;
13065
+ showsLine = (patch, side, line) => patch.rows.some((row) => getOrUndefined$1(lineOn(row, side)) === line);
13066
+ placedNow = (patches, held) => {
13067
+ const patch = patches.find((candidate) => candidate.path === held.path);
13068
+ const asRead = {
13069
+ start: held.line,
13070
+ end: held.line,
13071
+ placed: false
13072
+ };
13073
+ if (patch === void 0 || held.outdated) return asRead;
13074
+ const snippet = snippetOf$1(held);
13075
+ if (snippet.trim().length === 0) {
13076
+ const shown = showsLine(patch, held.side, held.line);
13077
+ return {
13078
+ start: spanOf(held, held.line),
13079
+ end: held.line,
13080
+ placed: shown
13081
+ };
13082
+ }
13083
+ return match$3(foundExactly(patch, {
13084
+ side: held.side,
13085
+ start: held.line,
13086
+ snippet
13087
+ }), {
13088
+ onNone: () => asRead,
13089
+ onSome: (range) => ({
13090
+ start: spanOf(held, range.end),
13091
+ end: range.end,
13092
+ placed: true
13093
+ })
13094
+ });
13095
+ };
13096
+ stateOf = (held, dismissed, accepted) => {
13097
+ if (Object.hasOwn(accepted, held.id)) return "accepted";
13098
+ return Object.hasOwn(dismissed, held.id) ? "dismissed" : "waiting";
13099
+ };
13100
+ heldPair = (comment, gone) => comment.remark === void 0 || Object.hasOwn(gone, comment.id) ? [] : [[comment.remark, comment.id]];
13101
+ acceptedIn = fn("Cli.acceptedRemarks")(function* (worktreePath) {
13102
+ const store = yield* Store;
13103
+ const batches = yield* store.inbox(worktreePath);
13104
+ const current = yield* store.state(worktreePath);
13105
+ const held = batches.flatMap((batch) => batch.comments);
13106
+ return Object.fromEntries(held.flatMap((comment) => heldPair(comment, current.removed)));
13107
+ });
13108
+ shownOf$1 = (held, patches, dismissed, accepted) => {
13109
+ const sits = placedNow(patches, held);
13110
+ const comment = accepted[held.id];
13111
+ return {
13112
+ id: held.id,
13113
+ file: held.path,
13114
+ side: held.side,
13115
+ start: sits.start,
13116
+ end: sits.end,
13117
+ by: held.by,
13118
+ body: spokenWithout(held.body),
13119
+ replies: held.replies,
13120
+ moreReplies: held.moreReplies,
13121
+ outdated: held.outdated,
13122
+ placed: sits.placed,
13123
+ state: stateOf(held, dismissed, accepted),
13124
+ comment: comment ?? ""
13125
+ };
13126
+ };
13127
+ remarksIn = fn("Cli.remarksIn")(function* (repo, reading) {
13128
+ const store = yield* Store;
13129
+ const forge = yield* Forge;
13130
+ const worktree = reading.worktree;
13131
+ const found = yield* forge.remarks(repo, worktree.branch);
13132
+ const held = [...new Map(found.map((one) => [one.id, one])).values()].map(heldOf);
13133
+ yield* store.saveRemarks(worktree.path, {
13134
+ version: VERSION,
13135
+ head: worktree.head,
13136
+ read: (/* @__PURE__ */ new Date()).toISOString(),
13137
+ remarks: held
13138
+ });
13139
+ const known = new Set(held.map((one) => one.id));
13140
+ const kept = (was) => Object.fromEntries(Object.entries(was).filter(([id]) => known.has(id)));
13141
+ yield* store.changeState(worktree.path, (was) => ({
13142
+ ...was,
13143
+ dismissed: kept(was.dismissed)
13144
+ }));
13145
+ const current = yield* store.state(worktree.path);
13146
+ const accepted = yield* acceptedIn(worktree.path);
13147
+ return held.map((one) => shownOf$1(one, reading.patches, current.dismissed, accepted));
13148
+ });
13149
+ listRemarks = fn("Cli.listRemarks")(function* (repo, branch, base) {
13150
+ return yield* remarksIn(repo, yield* readingOf(repo, branch, base));
13151
+ });
13152
+ heldRemarks = fn("Cli.heldRemarks")(function* (worktreePath) {
13153
+ const found = yield* (yield* Store).remarks(worktreePath);
13154
+ return match$3(found, {
13155
+ onNone: () => [],
13156
+ onSome: (snapshot) => snapshot.remarks
13157
+ });
13158
+ });
13159
+ remarksAgainst = fn("Cli.remarksAgainst")(function* (worktreePath, patches) {
13160
+ const store = yield* Store;
13161
+ const held = yield* heldRemarks(worktreePath);
13162
+ const current = yield* store.state(worktreePath);
13163
+ const accepted = yield* acceptedIn(worktreePath);
13164
+ return held.map((one) => shownOf$1(one, patches, current.dismissed, accepted));
13165
+ });
13166
+ remarksHeldIn = fn("Cli.remarksHeldIn")(function* (reading) {
13167
+ return yield* remarksAgainst(reading.worktree.path, reading.patches);
13168
+ });
13169
+ remarkNamed = fn("Cli.remarkNamed")(function* (worktreePath, id) {
13170
+ const held = yield* heldRemarks(worktreePath);
13171
+ const found = held.find((one) => one.id === id);
13172
+ return yield* found === void 0 ? new UnknownRemark({
13173
+ id,
13174
+ known: held.map((one) => one.id)
13175
+ }) : succeed$1(found);
13176
+ });
13177
+ without = (entries, id) => Object.fromEntries(Object.entries(entries).filter(([key]) => key !== id));
13178
+ notTaken = fn("Cli.remarkNotTaken")(function* (worktreePath, id) {
13179
+ const already = (yield* acceptedIn(worktreePath))[id];
13180
+ return yield* already === void 0 ? void_ : new RemarkTaken({
13181
+ id,
13182
+ comment: already
13183
+ });
13184
+ });
13185
+ dismissIn = fn("Cli.dismissIn")(function* (worktreePath, id, at) {
13186
+ const store = yield* Store;
13187
+ const found = yield* remarkNamed(worktreePath, id);
13188
+ yield* notTaken(worktreePath, found.id);
13189
+ yield* store.changeState(worktreePath, (was) => ({
13190
+ ...was,
13191
+ dismissed: {
13192
+ ...was.dismissed,
13193
+ [found.id]: at
13194
+ }
13195
+ }));
13196
+ return { dismissed: found.id };
13197
+ });
13198
+ undismissIn = fn("Cli.undismissIn")(function* (worktreePath, id) {
13199
+ const store = yield* Store;
13200
+ const found = yield* remarkNamed(worktreePath, id);
13201
+ yield* notTaken(worktreePath, found.id);
13202
+ yield* store.changeState(worktreePath, (was) => ({
13203
+ ...was,
13204
+ dismissed: without(was.dismissed, found.id)
13205
+ }));
13206
+ return { restored: found.id };
13207
+ });
13208
+ dismissRemark = fn("Cli.dismissRemark")(function* (repo, branch, id, at) {
13209
+ return yield* dismissIn((yield* findBranch(repo, branch)).path, id, at);
13210
+ });
13211
+ restoreRemark = fn("Cli.restoreRemark")(function* (repo, branch, id) {
13212
+ return yield* undismissIn((yield* findBranch(repo, branch)).path, id);
13213
+ });
13214
+ quoted = (held) => {
13215
+ const said = spokenWithout(held.body).trim();
13216
+ return said.length === 0 ? `@${held.by} left a remark with no words on the pull request` : `@${held.by} on the pull request: ${said}`;
13217
+ };
13218
+ anchorFrom = (reading, held) => {
13219
+ const patch = reading.patches.find((candidate) => candidate.path === held.path);
13220
+ const sits = placedNow(reading.patches, held);
13221
+ const rows = patch === void 0 || !sits.placed ? none() : rowsForRange(patch, {
13222
+ side: held.side,
13223
+ start: sits.start,
13224
+ end: sits.end
13225
+ });
13226
+ const anchor = flatMap$2(rows, ([first, last]) => patch === void 0 ? none() : anchorFor(patch, first, last, held.side));
13227
+ return getOrElse$1(anchor, () => ({
13228
+ path: held.path,
13229
+ blob: patch?.blob ?? "",
13230
+ side: held.side,
13231
+ start: spanOf(held, held.line),
13232
+ end: held.line,
13233
+ snippet: quotedCode(held.hunk, held.side).join("\n")
13234
+ }));
13235
+ };
13236
+ takingOn = fn("Cli.takingOnRemark")(function* (request) {
13237
+ const store = yield* Store;
13238
+ const worktree = request.reading.worktree;
13239
+ const held = yield* remarkNamed(worktree.path, request.id);
13240
+ const already = (yield* acceptedIn(worktree.path))[held.id];
13241
+ if (already !== void 0) return yield* new RemarkTaken({
13242
+ id: held.id,
13243
+ comment: already
13244
+ });
13245
+ yield* store.submit(worktree.path, {
13246
+ id: request.commentId,
13247
+ at: request.at,
13248
+ head: worktree.head,
13249
+ comments: [{
13250
+ id: request.commentId,
13251
+ anchor: anchorFrom(request.reading, held),
13252
+ body: (request.body ?? "").trim().length === 0 ? quoted(held) : request.body ?? "",
13253
+ remark: held.id
13254
+ }]
13255
+ });
13256
+ yield* store.changeState(worktree.path, (was) => ({
13257
+ ...was,
13258
+ dismissed: without(was.dismissed, held.id)
13259
+ }));
13260
+ return {
13261
+ accepted: held.id,
13262
+ comment: request.commentId
13263
+ };
13264
+ });
13265
+ acceptIn = fn("Cli.acceptRemarkAlone")(function* (request) {
13266
+ return yield* (yield* Store).whileHoldingRemarks(request.reading.worktree.path, takingOn(request));
13267
+ });
13268
+ acceptRemark = fn("Cli.acceptRemark")(function* (request) {
13269
+ const reading = yield* readingOf(request.repo, request.branch);
13270
+ return yield* acceptIn({
13271
+ reading,
13272
+ id: request.id,
13273
+ body: request.body,
13274
+ at: request.at,
13275
+ commentId: request.commentId
13276
+ });
13277
+ });
13278
+ answerRemark = fn("Cli.answerRemark")(function* (request) {
13279
+ const forge = yield* Forge;
13280
+ const worktree = yield* findBranch(request.repo, request.branch);
13281
+ const held = yield* remarkNamed(worktree.path, request.id);
13282
+ if (request.body.trim().length === 0) return yield* new NothingSaid({ what: "a reply to a remark" });
13283
+ yield* forge.answer(request.repo, worktree.branch, held.answerTo, request.body);
13284
+ return { answered: held.id };
13285
+ });
13286
+ fn("Cli.waitingRemarks")(function* (worktreePath) {
13287
+ const store = yield* Store;
13288
+ const held = yield* heldRemarks(worktreePath);
13289
+ const current = yield* store.state(worktreePath);
13290
+ const accepted = yield* acceptedIn(worktreePath);
13291
+ return held.filter((one) => stateOf(one, current.dismissed, accepted) === "waiting").length;
13292
+ });
13106
13293
  }));
13107
13294
  //#endregion
13108
13295
  //#region src/cli/index.ts
@@ -13116,6 +13303,7 @@ var init_cli = __esmMin((() => {
13116
13303
  init_catalog();
13117
13304
  init_report$1();
13118
13305
  init_error();
13306
+ init_remarks();
13119
13307
  }));
13120
13308
  //#endregion
13121
13309
  //#region src/cli/help.ts
@@ -13230,7 +13418,7 @@ var init_gaps = __esmMin((() => {
13230
13418
  };
13231
13419
  lastNewLine = (patch) => {
13232
13420
  const found = patch.rows.findLast((row) => isSome(row.newLine));
13233
- return found === void 0 ? 0 : getOrElse(found.newLine, () => 0);
13421
+ return found === void 0 ? 0 : getOrElse$1(found.newLine, () => 0);
13234
13422
  };
13235
13423
  spansOf = (patch, total) => {
13236
13424
  const leading = {
@@ -13488,7 +13676,7 @@ var init_tree = __esmMin((() => {
13488
13676
  return node.children.reduce((total, child) => total + filesUnder(tree, child), 0);
13489
13677
  };
13490
13678
  crowdedDirectories = (tree, limit) => tree.nodes.filter((node) => node.kind === "directory" && directFiles(tree, node.id) > limit).map((node) => node.path);
13491
- })), HOLDS, chosenNow, withChosen, preferenceRows, nothingReviewed, initialState, TREE_MAX, TREE_ROOMY, TREE_WIDE, TREE_MIN, TREE_SHARE, DIFF_MIN, DIFF_ROOMY, bodyRoom, treeWidth, tooSmall, reviewWidth, panelFits, panelShown, onLayers, selectedLayer, proseFor, kept, layerHolds, layerFiles, layerHolding, layerOpen, chunked, packed, shortened, wordWrapped, wrapped, clip, TITLE_ROWS, titleRows, shortDir, fileRow$1, shownFiles, dirOf, fileRows, layerRead, layerDone, countRow, NOTHING_LEFT, textRows, emptyRows, layerBody, holdsCursor, layerCard, layerRows, nearFirst, layerFitted, restingAt, railTop, PANE_CHROME$1, layerRoomIn, railWindow, selectedBranch, selectedPatch, pullHere, knownToHaveNoPull, treeOf, reviewedCountIn, CROWDED, treeRows, crowdedOf, foldersOfFile, isReviewed, treeStart, treeWindow, MINUTE, HOUR, DAY, sinceThen, threadStand, STAND_WEIGHT, louder, threadsOn, hiddenLines, rowsUnder, markedStands, carriesLine, selectedRows, snippetOf, selectedLineCount, lineOf, brokenAt, laidLine, laidDraft, COMPOSE_BOX, COMPOSE_MARGIN, COMPOSE_PAD, COMPOSE_LEAST, composeBox, composeRoom$1, composeTarget, replyTarget, threadReplying, VOICES, threadQuote, pickedText, takenRows, selectedLines, shownMatches, matchHere, selectionReadout, CONTEXT_STEPS, wholeFileOff, contextToggled, layerContext, newLineAt, sourceLineAt, rowAtSourceLine, rowShowing, lineOnSide, commentRowsIn, threadsAtRow, stopsAtRow, threadHere, threadAtStop, threadAtRow, openCommentRows, filesWithComments, answerCount, PANEL_SECTIONS, answersIn, newerOf, spokeLast, SECTION_OF, sectionOf, sentEntry, panelEntries, panelEntry, threadChosen, spokenSince, hunkStarts, openingRow, changeAround, nextUnreviewed, reviewedCount, fileOrder, filePlace, readingOrder, placeIn, layerFile, layerAfter, selectionRange;
13679
+ })), HOLDS, chosenNow, withChosen, preferenceRows, nothingReviewed, initialState, TREE_MAX, TREE_ROOMY, TREE_WIDE, TREE_MIN, TREE_SHARE, DIFF_MIN, DIFF_ROOMY, bodyRoom, treeWidth, tooSmall, reviewWidth, panelFits, panelShown, onLayers, selectedLayer, proseFor, kept, layerHolds, layerFiles, layerHolding, layerOpen, chunked, packed, shortened, wordWrapped, wrapped, clip, TITLE_ROWS, titleRows, shortDir, fileRow$1, shownFiles, dirOf, fileRows, layerRead, layerDone, countRow, NOTHING_LEFT, textRows, emptyRows, layerBody, holdsCursor, layerCard, layerRows, nearFirst, layerFitted, restingAt, railTop, PANE_CHROME$1, layerRoomIn, railWindow, selectedBranch, selectedPatch, pullHere, knownToHaveNoPull, treeOf, reviewedCountIn, CROWDED, treeRows, crowdedOf, foldersOfFile, isReviewed, treeStart, treeWindow, MINUTE, HOUR, DAY, sinceThen, threadStand, STAND_WEIGHT, louder, threadsOn, hiddenLines, rowsUnder, markedStands, carriesLine, selectedRows, snippetOf, selectedLineCount, lineOf, brokenAt, laidLine, laidDraft, COMPOSE_BOX, COMPOSE_MARGIN, COMPOSE_PAD, COMPOSE_LEAST, composeBox, composeRoom$1, composeTarget, remarkAnswering, answerTarget, replyTarget, threadReplying, VOICES, threadQuote, pickedText, takenRows, selectedLines, shownMatches, matchHere, selectionReadout, CONTEXT_STEPS, wholeFileOff, contextToggled, layerContext, newLineAt, sourceLineAt, rowAtSourceLine, rowShowing, lineOnSide, needingRowsIn, commentRowsIn, threadsAtRow, remarkShown, remarksAtRow, remarkRowsIn, stopsIn, stopsAtRow, remarkAtStop, remarkAtRow, remarkInPanel, remarkInDiff, remarkUnderCursor, remarkToTakeOn, remarkHere, threadHere, threadAtStop, threadAtRow, openCommentRows, filesWithComments, answerCount, PANEL_SECTIONS, answersIn, newerOf, spokeLast, SECTION_OF, sectionOf, sentEntry, remarkRows, panelEntries, panelEntry, threadChosen, spokenSince, hunkStarts, openingRow, changeAround, nextUnreviewed, reviewedCount, fileOrder, filePlace, readingOrder, placeIn, layerFile, layerAfter, selectionRange;
13492
13680
  var init_model = __esmMin((() => {
13493
13681
  init_dist();
13494
13682
  init_patch();
@@ -13565,6 +13753,7 @@ var init_model = __esmMin((() => {
13565
13753
  closed: [],
13566
13754
  vouched: [],
13567
13755
  sent: [],
13756
+ remarks: [],
13568
13757
  viewport: 20,
13569
13758
  context: 3,
13570
13759
  contextWas: 3,
@@ -13951,6 +14140,7 @@ var init_model = __esmMin((() => {
13951
14140
  composeRoom$1 = (columns) => Math.max(COMPOSE_LEAST, composeBox(columns) - COMPOSE_PAD);
13952
14141
  composeTarget = (state) => {
13953
14142
  const patch = selectedPatch(state);
14143
+ if (state.answerTo !== void 0) return answerTarget(state);
13954
14144
  if (state.replyTo !== void 0) return replyTarget(state);
13955
14145
  if (patch === void 0) return "";
13956
14146
  const [from, to] = selectionRange(state);
@@ -13961,6 +14151,11 @@ var init_model = __esmMin((() => {
13961
14151
  });
13962
14152
  return span === "" ? `Comment on ${patch.path}` : `Comment on ${patch.path}:${span}`;
13963
14153
  };
14154
+ remarkAnswering = (state) => state.answerTo === void 0 ? void 0 : state.remarks.find((one) => one.id === state.answerTo);
14155
+ answerTarget = (state) => {
14156
+ const remark = remarkAnswering(state);
14157
+ return remark === void 0 ? "Reply on the pull request" : `Reply to @${remark.by} on the pull request, ${remark.file}:${remark.end}`;
14158
+ };
13964
14159
  replyTarget = (state) => {
13965
14160
  const thread = threadReplying(state);
13966
14161
  if (thread === void 0) return "Reply";
@@ -14056,6 +14251,7 @@ var init_model = __esmMin((() => {
14056
14251
  onSome: (value) => value === line
14057
14252
  }))?.index;
14058
14253
  lineOnSide = (row, side) => getOrUndefined$1(side === "old" ? row.oldLine : row.newLine);
14254
+ needingRowsIn = (state, fileIndex) => [...commentRowsIn(state, fileIndex), ...remarkRowsIn(state, fileIndex)].toSorted((left, right) => left - right);
14059
14255
  commentRowsIn = (state, fileIndex) => {
14060
14256
  const patch = fileIndex === state.patchIndex ? selectedPatch(state) : state.patches[fileIndex];
14061
14257
  if (patch === void 0) return [];
@@ -14068,9 +14264,72 @@ var init_model = __esmMin((() => {
14068
14264
  if (patch === void 0 || here === void 0) return [];
14069
14265
  return state.sent.filter((entry) => entry.file === patch.path && entry.id !== void 0 && entry.removed !== true && entry.outside !== true && lineOnSide(here, entry.side) === entry.end);
14070
14266
  };
14071
- stopsAtRow = (state, row) => 1 + threadsAtRow(state, row).length;
14072
- threadHere = (state) => threadChosen(state) ?? threadAtStop(state) ?? threadAtRow(state, state.cursor);
14073
- threadAtStop = (state) => state.stop === 0 ? void 0 : threadsAtRow(state, state.cursor)[state.stop - 1];
14267
+ remarkShown = (remark) => remark.state === "waiting" && remark.placed;
14268
+ remarksAtRow = (state, row) => {
14269
+ const patch = selectedPatch(state);
14270
+ const here = patch?.rows[row];
14271
+ if (patch === void 0 || here === void 0) return [];
14272
+ return state.remarks.filter((one) => one.file === patch.path && remarkShown(one) && lineOnSide(here, one.side) === one.end);
14273
+ };
14274
+ remarkRowsIn = (state, fileIndex) => {
14275
+ const patch = fileIndex === state.patchIndex ? selectedPatch(state) : state.patches[fileIndex];
14276
+ if (patch === void 0) return [];
14277
+ const here = state.remarks.filter((one) => one.file === patch.path && remarkShown(one));
14278
+ return patch.rows.filter((row) => here.some((one) => lineOnSide(row, one.side) === one.end)).map((row) => row.index);
14279
+ };
14280
+ stopsIn = (state, row) => [...threadsAtRow(state, row).map((comment) => ({
14281
+ kind: "comment",
14282
+ comment
14283
+ })), ...remarksAtRow(state, row).map((remark) => ({
14284
+ kind: "remark",
14285
+ remark
14286
+ }))];
14287
+ stopsAtRow = (state, row) => 1 + stopsIn(state, row).length;
14288
+ remarkAtStop = (state) => {
14289
+ if (state.stop === 0) return void 0;
14290
+ const found = stopsIn(state, state.cursor)[state.stop - 1];
14291
+ return found?.kind === "remark" ? found.remark : void 0;
14292
+ };
14293
+ remarkAtRow = (state, row) => remarksAtRow(state, row)[0];
14294
+ remarkInPanel = (state) => {
14295
+ if (state.focus !== "review") return void 0;
14296
+ const chosen = panelEntry(state);
14297
+ return chosen?.kind === "remark" ? {
14298
+ remark: chosen.remark,
14299
+ dismissed: chosen.section === "dismissed"
14300
+ } : void 0;
14301
+ };
14302
+ remarkInDiff = (state, shy) => {
14303
+ if (state.focus !== "diff") return void 0;
14304
+ const standing = remarkAtStop(state);
14305
+ if (standing !== void 0) return standing;
14306
+ if (state.stop > 0) return void 0;
14307
+ if (shy && threadAtRow(state, state.cursor) !== void 0) return void 0;
14308
+ return remarkAtRow(state, state.cursor);
14309
+ };
14310
+ remarkUnderCursor = (state) => {
14311
+ const chosen = remarkInPanel(state);
14312
+ if (chosen !== void 0) return chosen;
14313
+ const here = remarkInDiff(state, true);
14314
+ return here === void 0 ? void 0 : {
14315
+ remark: here,
14316
+ dismissed: false
14317
+ };
14318
+ };
14319
+ remarkToTakeOn = (state) => remarkInPanel(state)?.remark ?? remarkInDiff(state, false);
14320
+ remarkHere = (state) => remarkToTakeOn(state);
14321
+ threadHere = (state) => {
14322
+ if (state.focus === "review") {
14323
+ const entry = panelEntry(state);
14324
+ return entry?.kind === "comment" ? entry.comment : void 0;
14325
+ }
14326
+ return threadAtStop(state) ?? threadAtRow(state, state.cursor);
14327
+ };
14328
+ threadAtStop = (state) => {
14329
+ if (state.stop === 0) return void 0;
14330
+ const found = stopsIn(state, state.cursor)[state.stop - 1];
14331
+ return found?.kind === "comment" ? found.comment : void 0;
14332
+ };
14074
14333
  threadAtRow = (state, row) => {
14075
14334
  const patch = selectedPatch(state);
14076
14335
  const here = patch?.rows[row];
@@ -14081,18 +14340,20 @@ var init_model = __esmMin((() => {
14081
14340
  const patch = selectedPatch(state);
14082
14341
  if (patch === void 0) return [];
14083
14342
  const open = state.sent.filter((entry) => entry.file === patch.path && entry.settled !== true && entry.removed !== true && entry.outside !== true);
14084
- return patch.rows.filter((row) => open.some((note) => lineOnSide(row, note.side) === note.end)).map((row) => row.index);
14343
+ return patch.rows.filter((row) => open.some((note) => lineOnSide(row, note.side) === note.end) || state.remarks.some((one) => one.file === patch.path && remarkShown(one) && lineOnSide(row, one.side) === one.end)).map((row) => row.index);
14085
14344
  };
14086
- filesWithComments = (state) => state.patches.flatMap((patch, index) => state.sent.some((entry) => entry.file === patch.path) ? [index] : []);
14345
+ filesWithComments = (state) => state.patches.flatMap((patch, index) => state.sent.some((entry) => entry.file === patch.path) || state.remarks.some((one) => one.file === patch.path && remarkShown(one)) ? [index] : []);
14087
14346
  answerCount = (comments) => comments.reduce((total, entry) => total + (entry.answers?.length ?? 0), 0);
14088
14347
  PANEL_SECTIONS = [
14348
+ "remarks",
14089
14349
  "held",
14090
14350
  "asked",
14091
14351
  "filed",
14092
14352
  "with",
14093
14353
  "answered",
14094
14354
  "settled",
14095
- "removed"
14355
+ "removed",
14356
+ "dismissed"
14096
14357
  ];
14097
14358
  answersIn = (comment) => comment.answers?.length ?? 0;
14098
14359
  newerOf = (state, comment) => {
@@ -14114,20 +14375,33 @@ var init_model = __esmMin((() => {
14114
14375
  sentEntry = (state, comment) => {
14115
14376
  const newer = newerOf(state, comment);
14116
14377
  return {
14378
+ kind: "comment",
14117
14379
  section: sectionOf(newer),
14118
14380
  comment: newer,
14119
14381
  fresh: newer !== comment,
14120
14382
  unread: newer.unread ?? 0
14121
14383
  };
14122
14384
  };
14385
+ remarkRows = (state, section) => state.remarks.filter((one) => section === "remarks" ? one.state === "waiting" : one.state === "dismissed").map((remark) => ({
14386
+ kind: "remark",
14387
+ section,
14388
+ remark
14389
+ }));
14123
14390
  panelEntries = (state) => {
14124
14391
  const shown = state.hideSettled ? state.sent.filter((comment) => comment.settled !== true) : state.sent;
14125
- const delivered = [...state.held.map((comment) => ({
14392
+ const waiting = state.held.map((comment) => ({
14393
+ kind: "comment",
14126
14394
  section: "held",
14127
14395
  comment,
14128
14396
  fresh: false,
14129
14397
  unread: 0
14130
- })), ...shown.map((comment) => sentEntry(state, comment))];
14398
+ }));
14399
+ const delivered = [
14400
+ ...remarkRows(state, "remarks"),
14401
+ ...waiting,
14402
+ ...shown.map((comment) => sentEntry(state, comment)),
14403
+ ...remarkRows(state, "dismissed")
14404
+ ];
14131
14405
  const ordered = (section) => {
14132
14406
  const found = delivered.filter((entry) => entry.section === section);
14133
14407
  return state.newestFirst ? found.toReversed() : found;
@@ -14137,7 +14411,8 @@ var init_model = __esmMin((() => {
14137
14411
  panelEntry = (state) => panelEntries(state)[state.panelIndex];
14138
14412
  threadChosen = (state) => {
14139
14413
  if (state.focus !== "review") return void 0;
14140
- return panelEntry(state)?.comment;
14414
+ const entry = panelEntry(state);
14415
+ return entry?.kind === "comment" ? entry.comment : void 0;
14141
14416
  };
14142
14417
  spokenSince = (seen, now) => Math.max(0, answerCount(now) - answerCount(seen));
14143
14418
  hunkStarts = (state) => {
@@ -14332,6 +14607,8 @@ var init_command = __esmMin((() => {
14332
14607
  whenLayers: false,
14333
14608
  whenStale: false,
14334
14609
  whenThread: false,
14610
+ whenRemark: false,
14611
+ whenAnswerable: false,
14335
14612
  whenSelecting: false,
14336
14613
  whenReviewed: false,
14337
14614
  whenPull: false,
@@ -14713,6 +14990,22 @@ var init_command = __esmMin((() => {
14713
14990
  hint: "settle read",
14714
14991
  rank: 1
14715
14992
  }),
14993
+ command({
14994
+ action: "remark.accept",
14995
+ also: [
14996
+ "accept",
14997
+ "take it on",
14998
+ "agree"
14999
+ ],
15000
+ panes: ["review", "diff"],
15001
+ hint: "accept",
15002
+ rank: 1,
15003
+ title: "Take the remark here on as your own comment",
15004
+ category: "Comments",
15005
+ keys: ["A"],
15006
+ screens: ["review"],
15007
+ whenRemark: true
15008
+ }),
14716
15009
  command({
14717
15010
  action: "thread.reply",
14718
15011
  also: [
@@ -14724,11 +15017,11 @@ var init_command = __esmMin((() => {
14724
15017
  panes: ["review", "diff"],
14725
15018
  hint: "reply",
14726
15019
  rank: 1,
14727
- title: "Write back to the thread here",
15020
+ title: "Write back to the thread or remark here",
14728
15021
  category: "Comments",
14729
15022
  keys: ["R"],
14730
15023
  screens: ["review"],
14731
- whenThread: true
15024
+ whenAnswerable: true
14732
15025
  }),
14733
15026
  command({
14734
15027
  action: "thread.remove",
@@ -15120,6 +15413,8 @@ var init_command = __esmMin((() => {
15120
15413
  };
15121
15414
  heldOrRemoved = (offered) => {
15122
15415
  if (offered.onHeld) return "drop";
15416
+ if (offered.onDismissed) return "restore";
15417
+ if (offered.onRemark) return "dismiss";
15123
15418
  return offered.onRemoved ? "restore" : "remove";
15124
15419
  };
15125
15420
  SWAPPED = {
@@ -15134,7 +15429,7 @@ var init_command = __esmMin((() => {
15134
15429
  if (swapped !== void 0) return swapped(offered);
15135
15430
  return entry.counted ? `${entry.hint} ${offered.comments}` : entry.hint;
15136
15431
  };
15137
- hintsFor = (screen, offered) => commandsFor(screen).filter((entry) => entry.hint.length > 0).filter((entry) => !entry.whenComments || offered.comments > 0).filter((entry) => !entry.whenLayers || offered.layers > 0).filter((entry) => !entry.whenStale || offered.stale).filter((entry) => !entry.whenThread || offered.onThread).filter((entry) => !entry.whenSelecting || offered.selecting).filter((entry) => !entry.whenReviewed || offered.reviewed > 0).filter((entry) => !entry.whenPull || offered.pull).filter((entry) => !entry.whenHeld || offered.held > 0).filter((entry) => entry.panes.includes(offered.pane)).toSorted((left, right) => left.rank - right.rank).map((entry) => ({
15432
+ hintsFor = (screen, offered) => commandsFor(screen).filter((entry) => entry.hint.length > 0).filter((entry) => !entry.whenComments || offered.comments > 0).filter((entry) => !entry.whenLayers || offered.layers > 0).filter((entry) => !entry.whenStale || offered.stale).filter((entry) => !entry.whenThread || offered.onThread).filter((entry) => !entry.whenRemark || offered.onRemark || offered.onDismissed).filter((entry) => !entry.whenAnswerable || offered.onThread || offered.onRemark).filter((entry) => !entry.whenSelecting || offered.selecting).filter((entry) => !entry.whenReviewed || offered.reviewed > 0).filter((entry) => !entry.whenPull || offered.pull).filter((entry) => !entry.whenHeld || offered.held > 0).filter((entry) => entry.panes.includes(offered.pane)).toSorted((left, right) => left.rank - right.rank).map((entry) => ({
15138
15433
  key: displayKey(entry.keys[0] ?? ""),
15139
15434
  hint: hintOf(entry, offered),
15140
15435
  press: entry.keys[0] ?? ""
@@ -15178,7 +15473,7 @@ var init_match = __esmMin((() => {
15178
15473
  }));
15179
15474
  //#endregion
15180
15475
  //#region src/tui/reduce.ts
15181
- var clamp, lastRow, rowsIn, withCursorVisible, moveCursor, stepStop, scrolled, restingOn, draggedTo, pickedIn, atRow, noneLeft, layerHunk, nextFileWithComments, atComment, nothingOpen, layerComment, PAN_STEP, panned, moveLayer, inRail, railScrolled, movePanel, layerDown, stepsToEnd, toTop, farOff, byHalf, boundedStep, PANEL_FAR, PANES, paneShown, panesShown, focusStepped, togglePanel, toggleNav, packedAway, zoom, toggleRail, foldDirectory, foldLayer, foldThread, fold, moveBranch, landingOn, revealing, atTheEnd, moveFile, selectHunk, swapEnds, atBranch, grownBy, startSelection, draftMark, openCompose, outOfDiff, BACK_FROM, goBack, walkMatches, openPalette, openKeys, openSettings, moveSettings, flipSetting, movePalette, paletteMatches, keyMatches, offered, paletteChoice, transitions, reduce, resumedAt, atFile, withContext, withFull, allRevealed, revealsAfter, gapShown, gapOpened, panBy, withSent, withArrived, withColumns, laidOver, onLayerHolding, withLayers, withPulls, withSilentForge, withBranches, withSource, withVouched, restoredTo, openedAt, withPatches, TAB_WIDTH, SPACE_CODE, ERASED_FROM, ERASED_TO, readable, legible, withDraft, paletteMoved, paletteClosed, withWaiting, withFinder, withMatches, withNoticeHere, withNotice;
15476
+ var clamp, lastRow, rowsIn, withCursorVisible, moveCursor, stepStop, scrolled, restingOn, draggedTo, pickedIn, atRow, noneLeft, layerHunk, nextFileWithComments, atComment, nothingOpen, layerComment, PAN_STEP, panned, moveLayer, inRail, railScrolled, movePanel, layerDown, stepsToEnd, toTop, farOff, byHalf, boundedStep, PANEL_FAR, PANES, paneShown, panesShown, focusStepped, togglePanel, toggleNav, packedAway, zoom, toggleRail, foldDirectory, foldLayer, foldThread, fold, moveBranch, landingOn, revealing, atTheEnd, moveFile, selectHunk, swapEnds, atBranch, grownBy, startSelection, draftMark, openCompose, outOfDiff, BACK_FROM, goBack, walkMatches, openPalette, openKeys, openSettings, moveSettings, flipSetting, movePalette, paletteMatches, keyMatches, offered, paletteChoice, transitions, reduce, resumedAt, atFile, withContext, withFull, allRevealed, revealsAfter, gapShown, gapOpened, panBy, withRemarks, withSent, withArrived, withColumns, laidOver, onLayerHolding, withLayers, withPulls, withSilentForge, withBranches, withSource, withVouched, restoredTo, openedAt, withPatches, TAB_WIDTH, SPACE_CODE, ERASED_FROM, ERASED_TO, readable, legible, withDraft, paletteMoved, paletteClosed, withWaiting, withFinder, withMatches, withNoticeHere, withNotice;
15182
15477
  var init_reduce = __esmMin((() => {
15183
15478
  init_dist();
15184
15479
  init_patch();
@@ -15294,13 +15589,13 @@ var init_reduce = __esmMin((() => {
15294
15589
  anchorRow: 0,
15295
15590
  selecting: false
15296
15591
  };
15297
- const rows = commentRowsIn(moved, file);
15592
+ const rows = needingRowsIn(moved, file);
15298
15593
  const landing = delta > 0 ? rows[0] : rows.at(-1);
15299
15594
  return landing === void 0 ? moved : atRow(moved, landing);
15300
15595
  };
15301
15596
  nothingOpen = (state) => {
15302
- const any = commentRowsIn(state, state.patchIndex).length > 0;
15303
- return withNotice(state, any ? "no open comment" : "no comments yet");
15597
+ const any = needingRowsIn(state, state.patchIndex).length > 0;
15598
+ return withNotice(state, any ? "nothing else waiting on you here" : "nothing waiting on you here");
15304
15599
  };
15305
15600
  layerComment = (state, delta) => {
15306
15601
  const here = openCommentRows(state);
@@ -15703,6 +15998,7 @@ var init_reduce = __esmMin((() => {
15703
15998
  "compose.submit": (state) => state,
15704
15999
  "held.send": (state) => state,
15705
16000
  "thread.reply": (state) => state,
16001
+ "remark.accept": (state) => state,
15706
16002
  "focus.toggle": (state) => ({
15707
16003
  ...state,
15708
16004
  focus: focusStepped(state, 1)
@@ -15859,6 +16155,10 @@ var init_reduce = __esmMin((() => {
15859
16155
  ...state,
15860
16156
  pan: Math.max(0, state.pan + delta)
15861
16157
  };
16158
+ withRemarks = (state, remarks) => ({
16159
+ ...state,
16160
+ remarks
16161
+ });
15862
16162
  withSent = (state, sent) => ({
15863
16163
  ...state,
15864
16164
  sent,
@@ -16195,7 +16495,7 @@ var init_theme = __esmMin((() => {
16195
16495
  }));
16196
16496
  //#endregion
16197
16497
  //#region src/tui/diffview.ts
16198
- var WASH, NOTE_MIN, ANSWER_MARK, REPLY_MARK, OVERSCAN, SIGN_WIDTH, SCROLL_ROWS, PAN_COLUMNS, WAYS, notchesIn, takenOver, wheelTo, SIGNS, numberFor, DiffView, startsOf, numbered, bareOf, noteKey, keyOf, groupOf, isChrome, alike, heldAt, sameLine, NO_SPANS, lineStarts, overLine, shifted, acrossLines, spansByLine, textAt, noteSpans, NOTE_PAINT, wrap, headOf, spokenLines, answerLines, noteLines, noteRows, proseRows, freshLines, proseAt, notesAt, TRAILING, shownText, codeRow, rowsFor, replacedBy, layout, lineNumbers, BARE_SIGN, signFor, lineSigns, sideLineOf;
16498
+ var WASH, NOTE_MIN, ANSWER_MARK, REPLY_MARK, OVERSCAN, SIGN_WIDTH, SCROLL_ROWS, PAN_COLUMNS, WAYS, notchesIn, takenOver, wheelTo, SIGNS, numberFor, DiffView, startsOf, numbered, bareOf, noteKey, keyOf, groupOf, isChrome, alike, heldAt, sameLine, NO_SPANS, lineStarts, overLine, shifted, acrossLines, spansByLine, textAt, noteSpans, NOTE_PAINT, wrap, REMARK_MARK$1, remarkHead, commentHead, headOf, spokenLines, heardFrom, answerLines, REMARK_LINES, capped, bodyLines, noteLines, REMARK_RULE, noteRows, proseRows, freshLines, proseAt, notesAt, TRAILING, shownText, codeRow, rowsFor, replacedBy, layout, lineNumbers, BARE_SIGN, signFor, lineSigns, sideLineOf;
16199
16499
  var init_diffview = __esmMin((() => {
16200
16500
  init_dist();
16201
16501
  init_patch();
@@ -16766,7 +17066,9 @@ var init_diffview = __esmMin((() => {
16766
17066
  }
16767
17067
  return lines;
16768
17068
  };
16769
- headOf = (note) => {
17069
+ REMARK_MARK$1 = "◇";
17070
+ remarkHead = (note, from) => `${REMARK_MARK$1} @${from}${note.stale ? " · outdated" : ""}`;
17071
+ commentHead = (note) => {
16770
17072
  const moved = note.stale ? ", the branch moved on" : "";
16771
17073
  if (note.settled) return `${marks().done} settled${moved}`;
16772
17074
  if (note.asks) return `${marks().asked} asked back${moved}`;
@@ -16775,17 +17077,26 @@ var init_diffview = __esmMin((() => {
16775
17077
  if (note.takenAt === void 0) return `${marks().sent} sent${moved}`;
16776
17078
  return `${marks().waiting} picked up ${sinceThen(note.takenAt, note.now)}${moved}`;
16777
17079
  };
17080
+ headOf = (note) => note.from === void 0 ? commentHead(note) : remarkHead(note, note.from);
16778
17081
  spokenLines = (body, room, mark) => {
16779
17082
  return body.split("\n").flatMap((line) => wrap(line, Math.max(NOTE_MIN, room - 2))).map((text, at) => at === 0 ? `${mark} ${text}` : ` ${text}`);
16780
17083
  };
16781
- answerLines = (note, room) => note.turns.length > 0 ? note.turns.flatMap((turn) => spokenLines(turn.body, room, turn.voice === "agent" ? ANSWER_MARK : REPLY_MARK)) : note.answers.flatMap((body) => spokenLines(body, room, ANSWER_MARK));
17084
+ heardFrom = (turn) => turn.by === void 0 ? void 0 : `@${turn.by}`;
17085
+ answerLines = (note, room) => note.turns.length > 0 ? note.turns.flatMap((turn) => spokenLines(turn.body, room, heardFrom(turn) ?? (turn.voice === "agent" ? ANSWER_MARK : REPLY_MARK))) : note.answers.flatMap((body) => spokenLines(body, room, ANSWER_MARK));
17086
+ REMARK_LINES = 8;
17087
+ capped = (lines, most) => lines.length <= most ? lines : [...lines.slice(0, most), `⋯ ${lines.length - most} more lines, press p to read it on the pull request`];
17088
+ bodyLines = (note, room) => {
17089
+ const said = note.body.split("\n").flatMap((line) => wrap(line, room));
17090
+ return note.from === void 0 ? said : capped(said, REMARK_LINES);
17091
+ };
16782
17092
  noteLines = (note, room) => note.folded ? [`${headOf(note)} · press l`] : [
16783
17093
  headOf(note),
16784
- ...note.body.split("\n").flatMap((line) => wrap(line, room)),
17094
+ ...bodyLines(note, room),
16785
17095
  ...answerLines(note, room)
16786
17096
  ];
17097
+ REMARK_RULE = "┊";
16787
17098
  noteRows = (note, row, room, stop) => noteLines(note, room).map((line, index) => ({
16788
- text: `${marks().rule} ${line}`,
17099
+ text: `${note.from === void 0 ? marks().rule : REMARK_RULE} ${line}`,
16789
17100
  row,
16790
17101
  stop,
16791
17102
  comment: true,
@@ -16889,7 +17200,7 @@ var init_diffview = __esmMin((() => {
16889
17200
  }));
16890
17201
  //#endregion
16891
17202
  //#region src/tui/render.ts
16892
- var ROW_HEIGHT, COMPOSE_WIDTH, GUTTER_X, CHIP_GAP, MODAL_ROOM, COMPOSE_CHROME, COMPOSE_ACTION_ROWS, reportActions, actionsText, SNIPPET_LINES, PALETTE_KEY, PALETTE_TITLE, PALETTE_GAP, PALETTE_CHROME, PENDING_CHROME, keysTitle, PALETTE_WIDTH, PANEL_SHARE, PANEL_MAX, PANEL_FLOOR, PANEL_FOOT, PANEL_QUARTER, PANEL_FIFTH, PANE_CHROME, PANE_EDGES, PANE_INSET, DIFF_FLOOR, COMPOSE_EDGE, CRAMPED, CRAMPED_ROWS, DIFF_CHROME_MOST, BRANCH_WIDTH, BRANCH_NAME_MIN, BRANCH_FIXED, STATE_MIN, EMPTY_LIST, MODAL_MARGIN, shareOf, homeWidth, longestName, longestState, keysOf, commandRow, modalWidth, panelWidth, panelTop, panelRows, composeRoom, laidOut$1, STICKY_MAX, pickPaint, PLAIN_PICKED, PICKED, PLAIN_CURSOR, UNDER_CURSOR, GAP_PAINT, frameRoot, crampedBar, bar, makeList, makeDiffPane, makePanel, makeListParts, makeListText, makeGutter, makeScroller, makeScrim, makeScroll, makePalette, asking, makePaletteParts, makeChoices, LIST_LEAD, windowed, listText, SHEET_GAP, sheetRow, groupedBy, sheetBlock, splitInTwo, sheetPaint, sheetDeep, sheetText, SETTING_LEAD, settingsText, stack, makeBody, makeHome, makeModals, makeSettingsParts, makeKeysParts, makeFoundParts, FONTS, logoFont, makeLanding, makeLogo, MAC_KEYS, makeComposeParts, makeCompose, stillThere, quotedFor, clipHead, clipMiddle, clipPath, INDENT_MAX, treeLabel, waitingLabel, inRange, notesOf, notesFor, paired, chipWidth, WAYS_OUT, keptWithin, CHIP_CHUNKS, shortPath, HOME_PATH_MIN, HOME_PATH_CHROME, elide, SUMMARY_LINES, summaryLines, contextLabel, nameRoom, stateRoom, columns, FORGE_SILENT, unaskedForge, branchHeading, atHome, layersCell, baseLabel, stateCell, branchCells, placeLabel, headerParts, panLabel, HEADER_GAP, HEADER_PATH_MIN, headerRoom, headerFitted, fallbackScope, treeMarks, treeTail, treeLine, GUTTER, DIR_LEAD, TITLE_LEAD, FILE_LEAD, STALE_ROOM, STALE_ASKING, STALE_LONG, STALE_MIDDLE, STALE_SHORT, staleSaid, staleBanner, litRow, leftOver, titlePaint, titleMark, titleLook, fileMark, fileLook, layerLook, layerGutter, layerText, offeredIn, PANEL_TITLES, PANEL_ORDER, PANEL_LEAD, PANEL_EMPTY, restingOrHere, FOUND_LEAST, nothingYet, foundTitle, CHANGED_MARK, fileRow, blockOf, aroundRow, windowedBlocks, panelWhere, panelBody, panelPair, panelSection, PULL_HINT, panelWindow, moreLine, panelText, Screen;
17203
+ var ROW_HEIGHT, COMPOSE_WIDTH, GUTTER_X, CHIP_GAP, MODAL_ROOM, COMPOSE_CHROME, COMPOSE_ACTION_ROWS, reportActions, actionsText, SNIPPET_LINES, PALETTE_KEY, PALETTE_TITLE, PALETTE_GAP, PALETTE_CHROME, PENDING_CHROME, keysTitle, PALETTE_WIDTH, PANEL_SHARE, PANEL_MAX, PANEL_FLOOR, PANEL_FOOT, PANEL_QUARTER, PANEL_FIFTH, PANE_CHROME, PANE_EDGES, PANE_INSET, DIFF_FLOOR, COMPOSE_EDGE, CRAMPED, CRAMPED_ROWS, DIFF_CHROME_MOST, BRANCH_WIDTH, BRANCH_NAME_MIN, BRANCH_FIXED, STATE_MIN, EMPTY_LIST, MODAL_MARGIN, shareOf, homeWidth, longestName, longestState, keysOf, commandRow, modalWidth, panelWidth, panelTop, panelRows, composeRoom, laidOut$1, STICKY_MAX, pickPaint, PLAIN_PICKED, PICKED, PLAIN_CURSOR, UNDER_CURSOR, GAP_PAINT, frameRoot, crampedBar, bar, makeList, makeDiffPane, makePanel, makeListParts, makeListText, makeGutter, makeScroller, makeScrim, makeScroll, makePalette, asking, makePaletteParts, makeChoices, LIST_LEAD, windowed, listText, SHEET_GAP, sheetRow, groupedBy, sheetBlock, splitInTwo, sheetPaint, sheetDeep, sheetText, SETTING_LEAD, settingsText, stack, makeBody, makeHome, makeModals, makeSettingsParts, makeKeysParts, makeFoundParts, FONTS, logoFont, makeLanding, makeLogo, MAC_KEYS, makeComposeParts, makeCompose, stillThere, quotedFor, clipHead, clipMiddle, clipPath, INDENT_MAX, treeLabel, waitingLabel, inRange, notesOf, remarksOf, notesFor, paired, chipWidth, WAYS_OUT, keptWithin, CHIP_CHUNKS, shortPath, HOME_PATH_MIN, HOME_PATH_CHROME, elide, SUMMARY_LINES, summaryLines, contextLabel, nameRoom, stateRoom, columns, FORGE_SILENT, unaskedForge, branchHeading, atHome, layersCell, baseLabel, stateCell, branchCells, placeLabel, headerParts, panLabel, HEADER_GAP, HEADER_PATH_MIN, headerRoom, headerFitted, fallbackScope, treeMarks, treeTail, treeLine, GUTTER, DIR_LEAD, TITLE_LEAD, FILE_LEAD, STALE_ROOM, STALE_ASKING, STALE_LONG, STALE_MIDDLE, STALE_SHORT, staleSaid, staleBanner, litRow, leftOver, titlePaint, titleMark, titleLook, fileMark, fileLook, layerLook, layerGutter, layerText, standingOnThread, standingOnRemark, standingOnDismissed, offeredIn, PANEL_TITLES, PANEL_ORDER, PANEL_LEAD, PANEL_EMPTY, restingOrHere, FOUND_LEAST, nothingYet, foundTitle, CHANGED_MARK, fileRow, blockOf, aroundRow, windowedBlocks, REMARK_MARK, remarkWhere, wherePart, panelFile, panelWhere, panelBody, panelMark, panelPair, panelSection, PULL_HINT, panelWindow, moreLine, panelText, Screen;
16893
17204
  var init_render = __esmMin((() => {
16894
17205
  init_dist();
16895
17206
  init_command();
@@ -17514,10 +17825,30 @@ var init_render = __esmMin((() => {
17514
17825
  takenAt: entry.takenAt,
17515
17826
  now: shown.now
17516
17827
  }));
17517
- notesFor = (state, path) => notesOf(stillThere(state.sent), path, true, {
17828
+ remarksOf = (state, path) => state.remarks.filter((one) => one.file === path && remarkShown(one)).map((one) => ({
17829
+ id: one.id,
17830
+ from: one.by,
17831
+ folded: false,
17832
+ side: one.side,
17833
+ line: one.end,
17834
+ body: one.body,
17835
+ sent: false,
17836
+ settled: false,
17837
+ stale: one.outdated,
17838
+ asks: false,
17839
+ answers: [],
17840
+ turns: one.replies.map((said) => ({
17841
+ voice: "reviewer",
17842
+ by: said.by,
17843
+ body: said.body
17844
+ })),
17845
+ takenAt: void 0,
17846
+ now: state.now
17847
+ }));
17848
+ notesFor = (state, path) => [...notesOf(stillThere(state.sent), path, true, {
17518
17849
  opened: state.opened,
17519
17850
  now: state.now
17520
- });
17851
+ }), ...remarksOf(state, path)];
17521
17852
  paired = (chunks) => {
17522
17853
  const chips = [];
17523
17854
  for (let at = 0; at < chunks.length; at += CHIP_CHUNKS) chips.push(chunks.slice(at, at + CHIP_CHUNKS));
@@ -17728,11 +18059,16 @@ var init_render = __esmMin((() => {
17728
18059
  return `${row.here === true ? marks().cursor : " "}${look.mark.padStart(GUTTER - 1)}`;
17729
18060
  };
17730
18061
  layerText = (row, look, room) => row.kind === "gap" ? "" : `${layerGutter(row, look)}${" ".repeat(look.lead - GUTTER)}${row.text}`.padEnd(room.title + TITLE_LEAD);
18062
+ standingOnThread = (state) => state.stop > 0 && threadAtStop(state) !== void 0 || threadChosen(state) !== void 0;
18063
+ standingOnRemark = (state) => remarkToTakeOn(state) !== void 0;
18064
+ standingOnDismissed = (state) => remarkUnderCursor(state)?.dismissed === true;
17731
18065
  offeredIn = (state) => ({
17732
18066
  comments: state.sent.length,
17733
18067
  held: state.held.length,
17734
18068
  layers: state.layers.length,
17735
- onThread: state.stop > 0 || threadChosen(state) !== void 0,
18069
+ onThread: standingOnThread(state),
18070
+ onRemark: standingOnRemark(state),
18071
+ onDismissed: standingOnDismissed(state),
17736
18072
  selecting: state.selecting,
17737
18073
  reviewed: reviewedCountIn(state),
17738
18074
  pull: pullHere(state).length > 0,
@@ -17745,6 +18081,8 @@ var init_render = __esmMin((() => {
17745
18081
  onHeld: state.focus === "review" && panelEntry(state)?.section === "held"
17746
18082
  });
17747
18083
  PANEL_TITLES = {
18084
+ remarks: "Remarks",
18085
+ dismissed: "Dismissed",
17748
18086
  held: "Waiting to be sent",
17749
18087
  asked: "Waiting on you",
17750
18088
  filed: "Not picked up",
@@ -17804,17 +18142,34 @@ var init_render = __esmMin((() => {
17804
18142
  chunks: kept.flatMap((block) => block.chunks)
17805
18143
  };
17806
18144
  };
17807
- panelWhere = (entry, room) => {
17808
- const where = entry.comment.outside === true ? " · not in the diff" : `:${entry.comment.end}`;
17809
- return `${clipPath(entry.comment.file, Math.max(4, room - where.length))}${where}`;
18145
+ REMARK_MARK = "◇";
18146
+ remarkWhere = (remark, known) => {
18147
+ if (remark.placed) return `:${remark.end}`;
18148
+ if (remark.outdated) return " · outdated";
18149
+ return known ? " · outside this diff" : " · not in the diff";
18150
+ };
18151
+ wherePart = (state, entry) => {
18152
+ if (entry.kind === "remark") {
18153
+ const known = state.patches.some((patch) => patch.path === entry.remark.file);
18154
+ return remarkWhere(entry.remark, known);
18155
+ }
18156
+ return entry.comment.outside === true ? " · not in the diff" : `:${entry.comment.end}`;
18157
+ };
18158
+ panelFile = (entry) => entry.kind === "remark" ? entry.remark.file : entry.comment.file;
18159
+ panelWhere = (state, entry, room) => {
18160
+ const where = wherePart(state, entry);
18161
+ return `${clipPath(panelFile(entry), Math.max(4, room - where.length))}${where}`;
18162
+ };
18163
+ panelBody = (entry) => {
18164
+ return (entry.kind === "remark" ? `@${entry.remark.by} ${entry.remark.body}` : entry.comment.body).split("\n").find((line) => line.trim().length > 0) ?? "";
17810
18165
  };
17811
- panelBody = (entry) => entry.comment.body.split("\n").find((line) => line.trim().length > 0) ?? "";
18166
+ panelMark = (entry) => entry.kind === "remark" ? REMARK_MARK : standMark(threadStand(entry.comment));
17812
18167
  panelPair = (state, placed, room) => {
17813
18168
  const { entry } = placed;
17814
- const lead = ` ${standMark(threadStand(entry.comment))} `;
18169
+ const lead = ` ${panelMark(entry)} `;
17815
18170
  const here = placed.at === state.panelIndex;
17816
18171
  return [{
17817
- text: `${lead}${panelWhere(entry, room - PANEL_LEAD)}`,
18172
+ text: `${lead}${panelWhere(state, entry, room - PANEL_LEAD)}`,
17818
18173
  tone: palette.ink,
17819
18174
  here
17820
18175
  }, {
@@ -17863,8 +18218,8 @@ var init_render = __esmMin((() => {
17863
18218
  entry,
17864
18219
  at
17865
18220
  }));
17866
- const fresh = placed.filter((one) => one.entry.fresh).length;
17867
- const unread = placed.filter((one) => one.entry.unread > 0).length;
18221
+ const fresh = placed.filter((one) => one.entry.kind === "comment" && one.entry.fresh).length;
18222
+ const unread = placed.filter((one) => one.entry.kind === "comment" && one.entry.unread > 0).length;
17868
18223
  const said = fresh > 0 ? `${fresh} ${PULL_HINT}` : unread > 0 ? `${unread} unread` : "";
17869
18224
  const banner = said.length === 0 ? [] : [{
17870
18225
  text: clip(said, room),
@@ -19219,6 +19574,7 @@ var init_app = __esmMin((() => {
19219
19574
  "thread.settleRead": () => this.settleWhatIsRead(),
19220
19575
  "thread.remove": () => this.removeHere(),
19221
19576
  "thread.reply": () => this.replyHere(),
19577
+ "remark.accept": () => this.acceptRemarkHere(),
19222
19578
  "selection.copy": () => sync(() => this.copySelection(false)),
19223
19579
  "search.open": () => this.findSelection(),
19224
19580
  "search.jump": () => this.runFinder(),
@@ -19336,13 +19692,16 @@ var init_app = __esmMin((() => {
19336
19692
  return gen({ self: this }, function* () {
19337
19693
  const reading = yield* readingOf(this.repo, name, this.base);
19338
19694
  this.reading = reading;
19339
- const [progress, layers, sent] = yield* all([
19695
+ const [progress, layers, sent, remarks] = yield* all([
19340
19696
  progressIn(reading),
19341
19697
  layersIn(reading),
19342
- sentIn(reading)
19698
+ sentIn(reading),
19699
+ result(remarksIn(this.repo, reading))
19343
19700
  ], { concurrency: "unbounded" });
19344
19701
  const opened = withVouched(withPatches(this.state, reading.patches), progress.vouched);
19345
- return withLayers(withSent(opened, sent), layers);
19702
+ const read = withRemarks(withLayers(withSent(opened, sent), layers), getOrElse(remarks, () => []));
19703
+ const hasPull = (this.state.pulls[reading.worktree.branch] ?? "").length > 0;
19704
+ return isSuccess$1(remarks) || !hasPull ? read : withNoticeHere(read, "the forge did not answer, so no remarks are shown");
19346
19705
  });
19347
19706
  }
19348
19707
  openBranch() {
@@ -19484,6 +19843,10 @@ var init_app = __esmMin((() => {
19484
19843
  this.commit(withNoticeHere(this.state, "nothing in the review yet"));
19485
19844
  return;
19486
19845
  }
19846
+ if (entry.kind === "remark") {
19847
+ yield* this.openRemark(entry.remark);
19848
+ return;
19849
+ }
19487
19850
  const at = this.state.patches.findIndex((patch) => patch.path === entry.comment.file);
19488
19851
  if (this.state.patches[at] === void 0) {
19489
19852
  yield* this.readAnswers(entry.comment.id);
@@ -19554,7 +19917,7 @@ var init_app = __esmMin((() => {
19554
19917
  settleHere() {
19555
19918
  return gen({ self: this }, function* () {
19556
19919
  const branch = selectedBranch(this.state);
19557
- const id = (threadChosen(this.state) ?? threadAtStop(this.state) ?? threadAtRow(this.state, this.state.cursor))?.id;
19920
+ const id = threadHere(this.state)?.id;
19558
19921
  if (branch === void 0 || id === void 0) {
19559
19922
  this.commit(withNotice(this.state, "no thread here"));
19560
19923
  return;
@@ -19571,8 +19934,18 @@ var init_app = __esmMin((() => {
19571
19934
  }
19572
19935
  replyHere() {
19573
19936
  return sync(() => {
19574
- const thread = threadChosen(this.state) ?? threadAtStop(this.state) ?? threadAtRow(this.state, this.state.cursor);
19575
- if (thread?.id === void 0) {
19937
+ const thread = threadHere(this.state);
19938
+ if (thread?.id !== void 0) {
19939
+ this.commit({
19940
+ ...this.state,
19941
+ screen: "compose",
19942
+ draft: "",
19943
+ replyTo: thread.id
19944
+ });
19945
+ return;
19946
+ }
19947
+ const remark = remarkToTakeOn(this.state);
19948
+ if (remark === void 0) {
19576
19949
  this.commit(withNotice(this.state, "no thread here"));
19577
19950
  return;
19578
19951
  }
@@ -19580,10 +19953,45 @@ var init_app = __esmMin((() => {
19580
19953
  ...this.state,
19581
19954
  screen: "compose",
19582
19955
  draft: "",
19583
- replyTo: thread.id
19956
+ answerTo: remark.id
19584
19957
  });
19585
19958
  });
19586
19959
  }
19960
+ sendRemarkAnswer(to) {
19961
+ return gen({ self: this }, function* () {
19962
+ const branch = selectedBranch(this.state);
19963
+ if (branch === void 0) return;
19964
+ if (this.state.draft.trim().length === 0) {
19965
+ this.commit(withNotice(this.state, NOTHING_WRITTEN));
19966
+ return;
19967
+ }
19968
+ const said = yield* this.display.written;
19969
+ const done = yield* as(answerRemark({
19970
+ repo: this.repo,
19971
+ branch: branch.branch,
19972
+ id: to,
19973
+ body: said
19974
+ }), true).pipe(catchTag("ForgeUnavailable", () => succeed$1(false)));
19975
+ const clear = {
19976
+ ...sentAway(this.state),
19977
+ answerTo: void 0
19978
+ };
19979
+ if (!done) {
19980
+ this.commit(withNotice(clear, "the forge would not take that reply"));
19981
+ return;
19982
+ }
19983
+ this.commit(clear);
19984
+ yield* this.reloadFromForge("replied on the pull request");
19985
+ });
19986
+ }
19987
+ reloadFromForge(said) {
19988
+ return gen({ self: this }, function* () {
19989
+ const reading = this.reading;
19990
+ if (reading === void 0) return;
19991
+ const remarks = yield* orElseSucceed(remarksIn(this.repo, reading), () => this.state.remarks);
19992
+ this.commit(withNoticeHere(withRemarks(this.state, remarks), said));
19993
+ });
19994
+ }
19587
19995
  staying(state, was) {
19588
19996
  const last = Math.max(0, panelEntries(state).length - 1);
19589
19997
  return {
@@ -19594,11 +20002,76 @@ var init_app = __esmMin((() => {
19594
20002
  heldUnderCursor() {
19595
20003
  if (this.state.focus !== "review") return -1;
19596
20004
  const entry = panelEntry(this.state);
19597
- if (entry?.section !== "held") return -1;
20005
+ if (entry === void 0 || entry.kind !== "comment" || entry.section !== "held") return -1;
19598
20006
  return this.state.held.indexOf(entry.comment);
19599
20007
  }
20008
+ openRemark(remark) {
20009
+ return gen({ self: this }, function* () {
20010
+ const at = this.state.patches.findIndex((patch) => patch.path === remark.file);
20011
+ if (this.state.patches[at] === void 0 || !remark.placed) {
20012
+ this.commit(withNoticeHere(this.state, `${remark.file} is not in this diff`));
20013
+ return;
20014
+ }
20015
+ this.commit(openedAt(this.measured(), at, remark.end));
20016
+ yield* this.turnedTo();
20017
+ });
20018
+ }
20019
+ acceptRemarkHere() {
20020
+ return gen({ self: this }, function* () {
20021
+ const remark = remarkHere(this.state);
20022
+ const reading = this.reading;
20023
+ if (remark === void 0 || reading === void 0) {
20024
+ this.commit(withNoticeHere(this.state, "no remark here"));
20025
+ return;
20026
+ }
20027
+ if (this.state.hold) {
20028
+ this.holding({
20029
+ file: remark.file,
20030
+ side: remark.side,
20031
+ start: remark.start,
20032
+ end: remark.end,
20033
+ body: quoted(remark),
20034
+ remark: remark.id
20035
+ });
20036
+ return;
20037
+ }
20038
+ if (!(yield* as(acceptIn({
20039
+ reading,
20040
+ id: remark.id,
20041
+ at: (/* @__PURE__ */ new Date()).toISOString(),
20042
+ commentId: randomUUID()
20043
+ }), true).pipe(catchTag("RemarkTaken", () => succeed$1(false))))) {
20044
+ this.commit(withNoticeHere(this.state, "that remark is already a comment of yours"));
20045
+ return;
20046
+ }
20047
+ yield* this.reloadRemarks("accepted, the agent has it");
20048
+ });
20049
+ }
20050
+ dismissRemarkHere(remark, back) {
20051
+ return gen({ self: this }, function* () {
20052
+ const reading = this.reading;
20053
+ if (reading === void 0) return;
20054
+ const at = (/* @__PURE__ */ new Date()).toISOString();
20055
+ yield* back ? undismissIn(reading.worktree.path, remark.id) : dismissIn(reading.worktree.path, remark.id, at);
20056
+ yield* this.reloadRemarks(back ? "restored" : "dismissed, it is under Dismissed");
20057
+ });
20058
+ }
20059
+ reloadRemarks(said) {
20060
+ return gen({ self: this }, function* () {
20061
+ const reading = this.reading;
20062
+ if (reading === void 0) return;
20063
+ const [remarks, sent] = yield* all([remarksHeldIn(reading), sentIn(reading)], { concurrency: "unbounded" });
20064
+ const held = this.staying(withRemarks(withSent(this.state, sent), remarks), this.state.panelIndex);
20065
+ this.commit(withNoticeHere(held, said));
20066
+ });
20067
+ }
19600
20068
  removeHere() {
19601
20069
  return gen({ self: this }, function* () {
20070
+ const triaged = this.heldUnderCursor() === -1 ? remarkUnderCursor(this.state) : void 0;
20071
+ if (triaged !== void 0) {
20072
+ yield* this.dismissRemarkHere(triaged.remark, triaged.dismissed);
20073
+ return;
20074
+ }
19602
20075
  const waiting = this.heldUnderCursor();
19603
20076
  if (waiting !== -1) {
19604
20077
  yield* this.dropHeld(waiting);
@@ -19624,7 +20097,9 @@ var init_app = __esmMin((() => {
19624
20097
  opened: this.state.opened.filter((one) => one !== id)
19625
20098
  };
19626
20099
  const said = back ? "restored" : "removed, it is under Removed in the review";
19627
- this.commit(withNotice(this.staying(withSent(kept, sent), was), said));
20100
+ const held = this.reading;
20101
+ const remarks = held === void 0 ? this.state.remarks : yield* remarksHeldIn(held);
20102
+ this.commit(withNotice(this.staying(withRemarks(withSent(kept, sent), remarks), was), said));
19628
20103
  });
19629
20104
  }
19630
20105
  fillBranches() {
@@ -19920,7 +20395,9 @@ var init_app = __esmMin((() => {
19920
20395
  const widened = withContext(this.state, next, patches, 0);
19921
20396
  const patch = selectedPatch(widened);
19922
20397
  const cursor = patch === void 0 || line === void 0 ? 0 : rowAtSourceLine(patch, line);
19923
- this.commit(withContext(this.state, next, patches, cursor));
20398
+ const held = this.reading;
20399
+ const remarks = held === void 0 ? this.state.remarks : yield* remarksAgainst(held.worktree.path, patches);
20400
+ this.commit(withRemarks(withContext(this.state, next, patches, cursor), remarks));
19924
20401
  });
19925
20402
  }
19926
20403
  remember(action, key) {
@@ -19958,6 +20435,7 @@ var init_app = __esmMin((() => {
19958
20435
  });
19959
20436
  }
19960
20437
  send() {
20438
+ if (this.state.answerTo !== void 0) return this.sendRemarkAnswer(this.state.answerTo);
19961
20439
  return this.state.replyTo === void 0 ? this.sendComment() : this.sendReply(this.state.replyTo);
19962
20440
  }
19963
20441
  sendReply(to) {
@@ -20073,7 +20551,8 @@ var init_app = __esmMin((() => {
20073
20551
  end: comment.end,
20074
20552
  body: comment.body,
20075
20553
  id: randomUUID(),
20076
- at
20554
+ at,
20555
+ ...comment.remark === void 0 ? {} : { remark: comment.remark }
20077
20556
  });
20078
20557
  const many = this.state.held.length;
20079
20558
  yield* this.sending(branch.branch, [asked(first), ...rest.map(asked)]);
@@ -20334,6 +20813,38 @@ const commentAnswer = fn("Main.commentAnswer")(function* (options) {
20334
20813
  });
20335
20814
  yield* answer(options, { answered: report.answered });
20336
20815
  });
20816
+ const remarkList = fn("Main.remarkList")(function* (options) {
20817
+ const remarks = yield* listRemarks(yield* required(options, "repo"), yield* required(options, "branch"));
20818
+ yield* answer(options, { remarks });
20819
+ });
20820
+ const remarkAccept = fn("Main.remarkAccept")(function* (options) {
20821
+ const report = yield* acceptRemark({
20822
+ repo: yield* required(options, "repo"),
20823
+ branch: yield* required(options, "branch"),
20824
+ id: yield* required(options, "id"),
20825
+ body: options["body"],
20826
+ at: options["at"] ?? (/* @__PURE__ */ new Date()).toISOString(),
20827
+ commentId: options["comment"] ?? randomUUID()
20828
+ });
20829
+ yield* answer(options, report);
20830
+ });
20831
+ const remarkReply = fn("Main.remarkReply")(function* (options) {
20832
+ const report = yield* answerRemark({
20833
+ repo: yield* required(options, "repo"),
20834
+ branch: yield* required(options, "branch"),
20835
+ id: yield* required(options, "id"),
20836
+ body: yield* required(options, "body")
20837
+ });
20838
+ yield* answer(options, { answered: report.answered });
20839
+ });
20840
+ const remarkDismiss = fn("Main.remarkDismiss")(function* (options) {
20841
+ const report = yield* dismissRemark(yield* required(options, "repo"), yield* required(options, "branch"), yield* required(options, "id"), options["at"] ?? (/* @__PURE__ */ new Date()).toISOString());
20842
+ yield* answer(options, { dismissed: report.dismissed });
20843
+ });
20844
+ const remarkRestore = fn("Main.remarkRestore")(function* (options) {
20845
+ const report = yield* restoreRemark(yield* required(options, "repo"), yield* required(options, "branch"), yield* required(options, "id"));
20846
+ yield* answer(options, { restored: report.restored });
20847
+ });
20337
20848
  const commentList = fn("Main.commentList")(function* (options) {
20338
20849
  const comments = yield* listThreads(yield* required(options, "repo"), yield* required(options, "branch"));
20339
20850
  yield* answer(options, { comments });
@@ -20383,10 +20894,6 @@ const layersShow = fn("Main.layersShow")(function* (options) {
20383
20894
  const layers = yield* showLayers(yield* required(options, "worktree"));
20384
20895
  yield* answer(options, { layers });
20385
20896
  });
20386
- const skillRefresh = fn("Main.skillRefresh")(function* (options) {
20387
- const report = yield* refreshSkill([process.cwd(), homedir()]);
20388
- yield* answer(options, { changes: report.changes });
20389
- });
20390
20897
  const configList = fn("Main.configList")(function* (options) {
20391
20898
  yield* answer(options, { preferences: yield* readPreferences() });
20392
20899
  });
@@ -20408,18 +20915,13 @@ const reviewPane = fn("Main.reviewPane")(function* (options) {
20408
20915
  });
20409
20916
  });
20410
20917
  const say = (line) => sync(() => process.stdout.write(line));
20411
- const NOTHING_REFRESHED = {
20412
- updated: [],
20413
- failed: false
20414
- };
20415
20918
  const settledUpgrade = (found, check, ran) => sync(() => {
20416
20919
  if (check || found.current === true || ran) return;
20417
20920
  process.exitCode = 1;
20418
20921
  });
20419
- const saidUpgrade = fn("Main.saidUpgrade")(function* (found, ran, skills) {
20922
+ const saidUpgrade = fn("Main.saidUpgrade")(function* (found, ran) {
20420
20923
  yield* say(`\n${sayDone(found, ran)}\n`);
20421
- const also = sayRefreshed(skills);
20422
- if (also !== void 0) yield* say(`${also}\n`);
20924
+ yield* say(`${SAY_SKILL_TOO}\n`);
20423
20925
  });
20424
20926
  const routes = {
20425
20927
  "branch list": branchList,
@@ -20430,6 +20932,11 @@ const routes = {
20430
20932
  "comment take": commentTake,
20431
20933
  "comment answer": commentAnswer,
20432
20934
  "comment list": commentList,
20935
+ "remark list": remarkList,
20936
+ "remark accept": remarkAccept,
20937
+ "remark reply": remarkReply,
20938
+ "remark dismiss": remarkDismiss,
20939
+ "remark restore": remarkRestore,
20433
20940
  "draft list": draftList,
20434
20941
  "draft add": draftAdd,
20435
20942
  "draft edit": draftEdit,
@@ -20445,7 +20952,6 @@ const routes = {
20445
20952
  "review progress": reviewStatus,
20446
20953
  "layers set": layersSet,
20447
20954
  "layers show": layersShow,
20448
- "skill refresh": skillRefresh,
20449
20955
  upgrade: fn("Main.upgrade")(function* (options) {
20450
20956
  const check = options["check"] !== void 0;
20451
20957
  const quiet = options["json"] !== void 0;
@@ -20453,15 +20959,8 @@ const routes = {
20453
20959
  const upgrading = willUpgrade(found, check);
20454
20960
  if (!quiet) yield* say(`${sayFound(found, check)}\n${upgrading ? "\n" : ""}`);
20455
20961
  const ran = upgrading ? yield* runUpgrade(found, quiet) : false;
20456
- const skills = ran ? yield* refreshSkills : NOTHING_REFRESHED;
20457
- if (quiet) {
20458
- const also = skills.updated.length === 0 ? {} : { skills: skills.updated };
20459
- return yield* answer(options, {
20460
- upgrade: upgradeReport(found, ran, check),
20461
- ...also
20462
- });
20463
- }
20464
- if (upgrading) yield* saidUpgrade(found, ran, skills);
20962
+ if (quiet) return yield* answer(options, { upgrade: upgradeReport(found, ran, check) });
20963
+ if (upgrading) yield* saidUpgrade(found, ran);
20465
20964
  return yield* settledUpgrade(found, check, ran);
20466
20965
  }),
20467
20966
  describe: fn("Main.describe")(function* (options) {