@eliya-oss/agent-diff 0.1.0-alpha.147 → 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
@@ -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, 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,7 +3466,7 @@ var CurrentStackFrame, TracerEnabled, TracerTimingEnabled, TracerSpanAnnotations
3464
3466
  onSuccess: (_) => void_$2
3465
3467
  });
3466
3468
  });
3467
- result = (self) => matchEager(self, {
3469
+ result$1 = (self) => matchEager(self, {
3468
3470
  onFailure: fail$3,
3469
3471
  onSuccess: succeed$6
3470
3472
  });
@@ -3662,11 +3664,11 @@ var CurrentStackFrame, TracerEnabled, TracerTimingEnabled, TracerSpanAnnotations
3662
3664
  return f(interruptible);
3663
3665
  });
3664
3666
  all$1 = (arg, options) => {
3665
- if (isIterable(arg)) return options?.mode === "result" ? forEach$1(arg, result, options) : forEach$1(arg, identity, options);
3666
- 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);
3667
3669
  return suspend$1(() => {
3668
3670
  const out = {};
3669
- 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) => {
3670
3672
  assignProperty(out, key, value);
3671
3673
  }), {
3672
3674
  discard: true,
@@ -4686,7 +4688,7 @@ var retryOrElse, retry$1, passthroughForever, buildFromOptions, init_schedule =
4686
4688
  if (options.times !== void 0) schedule = while_(schedule, ({ attempt }) => succeed$5(attempt <= options.times));
4687
4689
  return schedule;
4688
4690
  };
4689
- })), all, forEach, whileLoop, promise, tryPromise, succeed$1, succeedNone, suspend, sync, void_, callback$1, gen, fail, failCause, failCauseSync, try_, withFiber, flatMap, andThen, tap, 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;
4690
4692
  var init_Effect = __esmMin((() => {
4691
4693
  init_Context();
4692
4694
  init_core();
@@ -4713,6 +4715,7 @@ var init_Effect = __esmMin((() => {
4713
4715
  flatMap = flatMap$1;
4714
4716
  andThen = andThen$1;
4715
4717
  tap = tap$1;
4718
+ result = result$1;
4716
4719
  exit = exit$1;
4717
4720
  map = map$2;
4718
4721
  as = as$1;
@@ -6065,7 +6068,7 @@ function getConstructorDescriptor(ast) {
6065
6068
  const getDescriptor = ast.annotations?.[CONSTRUCTOR_ANNOTATION_KEY];
6066
6069
  return isFunction(getDescriptor) ? getDescriptor(ast.typeParameters) : void 0;
6067
6070
  }
6068
- 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;
6069
6072
  var init_SchemaAST = __esmMin((() => {
6070
6073
  init_Array();
6071
6074
  init_Cause();
@@ -6129,7 +6132,7 @@ var init_SchemaAST = __esmMin((() => {
6129
6132
  return `<${this._tag}>`;
6130
6133
  }
6131
6134
  };
6132
- Null = class extends Base {
6135
+ Null$1 = class extends Base {
6133
6136
  _tag = "Null";
6134
6137
  /** @internal */
6135
6138
  getParser() {
@@ -6140,7 +6143,7 @@ var init_SchemaAST = __esmMin((() => {
6140
6143
  return "null";
6141
6144
  }
6142
6145
  };
6143
- null_ = /*#__PURE__*/ new Null();
6146
+ null_ = /*#__PURE__*/ new Null$1();
6144
6147
  Undefined$1 = class extends Base {
6145
6148
  _tag = "Undefined";
6146
6149
  /** @internal */
@@ -8552,7 +8555,7 @@ function isInt(annotations) {
8552
8555
  ...annotations
8553
8556
  });
8554
8557
  }
8555
- 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;
8556
8559
  var init_Schema = __esmMin((() => {
8557
8560
  init_BigDecimal();
8558
8561
  init_Cause();
@@ -8588,12 +8591,18 @@ var init_Schema = __esmMin((() => {
8588
8591
  make$1 = make$2;
8589
8592
  optionalKey = /*#__PURE__*/ lambda((schema) => make$1(optionalKey$1(schema.ast), { schema }));
8590
8593
  toEncoded = /*#__PURE__*/ lambda((schema) => make$1(toEncoded$1(schema.ast), { schema }));
8594
+ Null = /*#__PURE__*/ make$1(null_);
8591
8595
  Undefined = /*#__PURE__*/ make$1(undefined_);
8592
8596
  String$1 = /*#__PURE__*/ make$1(string);
8593
8597
  Number$1 = /*#__PURE__*/ make$1(number);
8594
8598
  Boolean = /*#__PURE__*/ make$1(boolean);
8595
8599
  ArraySchema = /*#__PURE__*/ lambda((schema) => make$1(new Arrays(false, [], [schema.ast]), { value: schema }));
8596
8600
  UndefinedOr = /*#__PURE__*/ lambda((self) => Union([self, Undefined]));
8601
+ NullishOr = /*#__PURE__*/ lambda((self) => Union([
8602
+ self,
8603
+ Null,
8604
+ Undefined
8605
+ ]));
8597
8606
  makeFilter = makeFilter$1;
8598
8607
  Int = /*#__PURE__*/ Number$1.check(/*#__PURE__*/ isInt());
8599
8608
  globalThis.RegExp;
@@ -8814,7 +8823,7 @@ var init_error$3 = __esmMin((() => {
8814
8823
  }));
8815
8824
  //#endregion
8816
8825
  //#region src/service/forge/service.ts
8817
- 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;
8818
8827
  var init_service$2 = __esmMin((() => {
8819
8828
  init_dist();
8820
8829
  init_error$3();
@@ -8835,7 +8844,7 @@ var init_service$2 = __esmMin((() => {
8835
8844
  "MERGED",
8836
8845
  "CLOSED"
8837
8846
  ];
8838
- stateOf$1 = (row) => {
8847
+ stateOf$2 = (row) => {
8839
8848
  const said = SAID.find((known) => known === row.state);
8840
8849
  switch (said) {
8841
8850
  case "OPEN": return row.isDraft ? "draft" : "open";
@@ -8901,7 +8910,7 @@ var init_service$2 = __esmMin((() => {
8901
8910
  reason: String(cause)
8902
8911
  }))).map((row) => ({
8903
8912
  branch: row.headRefName,
8904
- state: stateOf$1(row)
8913
+ state: stateOf$2(row)
8905
8914
  }));
8906
8915
  });
8907
8916
  pulls = fn("Forge.pulls")(function* (repo) {
@@ -9000,6 +9009,183 @@ var init_service$2 = __esmMin((() => {
9000
9009
  return [at];
9001
9010
  });
9002
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
+ });
9003
9189
  review = fn("Forge.review")(function* (repo, branch, comments) {
9004
9190
  const pull = yield* named$1(repo, branch);
9005
9191
  const route = `repos/${(yield* gh(repo, [
@@ -9027,7 +9213,9 @@ var init_service$2 = __esmMin((() => {
9027
9213
  pulls,
9028
9214
  openPull,
9029
9215
  head,
9030
- review
9216
+ review,
9217
+ remarks,
9218
+ answer: answer$1
9031
9219
  });
9032
9220
  }));
9033
9221
  //#endregion
@@ -9055,12 +9243,13 @@ var init_model$4 = __esmMin((() => {
9055
9243
  settled: {},
9056
9244
  removed: {},
9057
9245
  base: "",
9058
- read: {}
9246
+ read: {},
9247
+ dismissed: {}
9059
9248
  };
9060
9249
  }));
9061
9250
  //#endregion
9062
9251
  //#region src/service/store/schema.ts
9063
- 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;
9064
9253
  var init_schema = __esmMin((() => {
9065
9254
  init_dist();
9066
9255
  Side = Literals(["old", "new"]);
@@ -9076,7 +9265,8 @@ var init_schema = __esmMin((() => {
9076
9265
  id: String$1,
9077
9266
  anchor: Anchor,
9078
9267
  body: String$1,
9079
- replyTo: optionalKey(String$1)
9268
+ replyTo: optionalKey(String$1),
9269
+ remark: optionalKey(String$1)
9080
9270
  });
9081
9271
  StoredDraft = Struct({
9082
9272
  id: String$1,
@@ -9112,7 +9302,33 @@ var init_schema = __esmMin((() => {
9112
9302
  settled: Stamps.pipe(noStamps),
9113
9303
  removed: Stamps.pipe(noStamps),
9114
9304
  base: String$1.pipe(withDecodingDefaultKey(succeed$1(""))),
9115
- 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)
9116
9332
  });
9117
9333
  Settings = Struct({
9118
9334
  wrap: optionalKey(Boolean),
@@ -9156,7 +9372,7 @@ var init_schema = __esmMin((() => {
9156
9372
  }));
9157
9373
  //#endregion
9158
9374
  //#region src/service/store/paths.ts
9159
- 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;
9160
9376
  var init_paths = __esmMin((() => {
9161
9377
  NON_SLUG = /[^a-zA-Z0-9]+/g;
9162
9378
  slugOf = (worktreePath) => worktreePath.replace(NON_SLUG, "-");
@@ -9168,6 +9384,7 @@ var init_paths = __esmMin((() => {
9168
9384
  watchPath = (root, worktreePath) => join(branchDir(root, worktreePath), "watch.json");
9169
9385
  draftsPath = (root, worktreePath) => join(branchDir(root, worktreePath), "drafts.json");
9170
9386
  layersPath = (root, worktreePath) => join(branchDir(root, worktreePath), "layers.json");
9387
+ remarksPath = (root, worktreePath) => join(branchDir(root, worktreePath), "remarks.json");
9171
9388
  settingsPath = (root) => join(root, "settings.json");
9172
9389
  upgradePath = (root) => join(root, "upgrade.json");
9173
9390
  reportsDir = (root) => join(root, "reports");
@@ -9175,7 +9392,7 @@ var init_paths = __esmMin((() => {
9175
9392
  }));
9176
9393
  //#endregion
9177
9394
  //#region src/service/store/service.ts
9178
- 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;
9179
9396
  var init_service$1 = __esmMin((() => {
9180
9397
  init_dist();
9181
9398
  init_error$2();
@@ -9244,6 +9461,7 @@ var init_service$1 = __esmMin((() => {
9244
9461
  writeUpgradeCheck = writes(UpgradeCheck, INDENT);
9245
9462
  writeState = writes(BranchState, INDENT);
9246
9463
  writeLayers = writes(StoredLayers, INDENT);
9464
+ writeRemarks = writes(StoredRemarks, INDENT);
9247
9465
  writeDrafts = writes(Drafts, INDENT);
9248
9466
  writeBatch = appends(Batch);
9249
9467
  writeAnswer = appends(StoredAnswer);
@@ -9253,6 +9471,7 @@ var init_service$1 = __esmMin((() => {
9253
9471
  asAnswer = decoded(StoredAnswer);
9254
9472
  asState = decoded(BranchState);
9255
9473
  asLayers = decoded(StoredLayers);
9474
+ asRemarks = decoded(StoredRemarks);
9256
9475
  asDrafts = decoded(Drafts);
9257
9476
  asWatching = decoded(Watching);
9258
9477
  linesOf = (raw) => raw.split("\n").filter((line) => line.trim().length > 0);
@@ -9271,6 +9490,9 @@ var init_service$1 = __esmMin((() => {
9271
9490
  parseLayers = fn("Store.parseLayers")(function* (path, raw) {
9272
9491
  return yield* asLayers(path, yield* jsonOf$1(path, raw));
9273
9492
  });
9493
+ parseRemarks = fn("Store.parseRemarks")(function* (path, raw) {
9494
+ return yield* asRemarks(path, yield* jsonOf$1(path, raw));
9495
+ });
9274
9496
  idsIn$1 = (batches) => batches.flatMap((batch) => batch.comments.map((one) => one.id));
9275
9497
  takes = (ids, at) => (was) => ({
9276
9498
  ...was,
@@ -9411,6 +9633,31 @@ var init_service$1 = __esmMin((() => {
9411
9633
  })
9412
9634
  };
9413
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
+ };
9414
9661
  inboxOps = (root, adopted) => {
9415
9662
  return {
9416
9663
  submit: fn("Store.submit")(function* (worktreePath, batch) {
@@ -9556,6 +9803,7 @@ var init_service$1 = __esmMin((() => {
9556
9803
  ...upgradeOps(root),
9557
9804
  ...talk,
9558
9805
  ...layersOps(root, adopted),
9806
+ ...remarksOps(root, adopted),
9559
9807
  ...watchOps(root, adopted),
9560
9808
  ...draftsOps(root, adopted),
9561
9809
  ...cursors
@@ -9587,7 +9835,7 @@ var init_model$3 = __esmMin((() => {
9587
9835
  }));
9588
9836
  //#endregion
9589
9837
  //#region src/domain/patch/anchor.ts
9590
- 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;
9591
9839
  var init_anchor = __esmMin((() => {
9592
9840
  init_dist();
9593
9841
  init_model$3();
@@ -9654,7 +9902,7 @@ var init_anchor = __esmMin((() => {
9654
9902
  return room >= SHORTEST_NEAR && edits(one, other) <= Math.floor(room / PER_EDIT);
9655
9903
  };
9656
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;
9657
- foundAgain = (patch, wanted) => {
9905
+ foundExactly = (patch, wanted) => {
9658
9906
  const said = wanted.snippet.split("\n");
9659
9907
  if (said.every((text) => text.trim().length === 0)) return none();
9660
9908
  const lines = sideLines(patch, wanted.side);
@@ -9665,15 +9913,25 @@ var init_anchor = __esmMin((() => {
9665
9913
  end: whole + said.length - 1
9666
9914
  });
9667
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] ?? "";
9668
9926
  if (first.trim().length === 0) return none();
9669
- const alike = (said.length === 1 ? void 0 : nearestRun(lines, [first], wanted.start)) ?? nearestLike(lines, first, wanted.start);
9670
- if (alike === void 0) return none();
9671
- return some({
9927
+ const alike = nearestLike(sideLines(patch, wanted.side), first, wanted.start);
9928
+ return alike === void 0 ? none() : some({
9672
9929
  side: wanted.side,
9673
9930
  start: alike,
9674
9931
  end: alike
9675
9932
  });
9676
9933
  };
9934
+ foundAgain = (patch, wanted) => orElse(foundExactly(patch, wanted), () => foundAlike(patch, wanted));
9677
9935
  }));
9678
9936
  //#endregion
9679
9937
  //#region src/domain/patch/parse.ts
@@ -10260,13 +10518,16 @@ var init_model$2 = __esmMin((() => {
10260
10518
  //#region src/domain/preferences/index.ts
10261
10519
  var init_preferences = __esmMin((() => {
10262
10520
  init_model$2();
10263
- })), UnknownBranch, UnknownBase, UnknownFile, UnknownComment, UnknownPreference, UnknownPreferenceValue, UnselectableRange, UnknownCommand, MissingOption, UnknownWorktree, MalformedLayers, UnknownField, UnknownOption, BadOption, UnknownDraft, NothingDrafted, PartlySent, PullMoved, NoLayers;
10521
+ })), UnknownBranch, UnknownBase, UnknownFile, UnknownComment, UnknownRemark, NothingSaid, RemarkTaken, UnknownPreference, UnknownPreferenceValue, UnselectableRange, UnknownCommand, MissingOption, UnknownWorktree, MalformedLayers, UnknownField, UnknownOption, BadOption, UnknownDraft, NothingDrafted, PartlySent, PullMoved, NoLayers;
10264
10522
  var init_error = __esmMin((() => {
10265
10523
  init_dist();
10266
10524
  UnknownBranch = class extends TaggedError("UnknownBranch") {};
10267
10525
  UnknownBase = class extends TaggedError("UnknownBase") {};
10268
10526
  UnknownFile = class extends TaggedError("UnknownFile") {};
10269
10527
  UnknownComment = class extends TaggedError("UnknownComment") {};
10528
+ UnknownRemark = class extends TaggedError("UnknownRemark") {};
10529
+ NothingSaid = class extends TaggedError("NothingSaid") {};
10530
+ RemarkTaken = class extends TaggedError("RemarkTaken") {};
10270
10531
  UnknownPreference = class extends TaggedError("UnknownPreference") {};
10271
10532
  UnknownPreferenceValue = class extends TaggedError("UnknownPreferenceValue") {};
10272
10533
  UnselectableRange = class extends TaggedError("UnselectableRange") {};
@@ -10286,7 +10547,7 @@ var init_error = __esmMin((() => {
10286
10547
  }));
10287
10548
  //#endregion
10288
10549
  //#region src/cli/commands.ts
10289
- 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;
10290
10551
  var init_commands = __esmMin((() => {
10291
10552
  init_dist();
10292
10553
  init_patch();
@@ -10522,6 +10783,10 @@ var init_commands = __esmMin((() => {
10522
10783
  ...comment,
10523
10784
  placed: false
10524
10785
  };
10786
+ if (comment.start === 1e5) return {
10787
+ ...comment,
10788
+ placed: false
10789
+ };
10525
10790
  if (comment.snippet.trim().length === 0) return {
10526
10791
  ...comment,
10527
10792
  placed: true
@@ -10590,7 +10855,8 @@ var init_commands = __esmMin((() => {
10590
10855
  return {
10591
10856
  id: request.id,
10592
10857
  anchor,
10593
- body: request.body
10858
+ body: request.body,
10859
+ ...request.remark === void 0 ? {} : { remark: request.remark }
10594
10860
  };
10595
10861
  });
10596
10862
  const anchored = yield* forEach(requests, anchoring);
@@ -10613,7 +10879,7 @@ var init_commands = __esmMin((() => {
10613
10879
  const worktree = yield* findBranch(requests[0].repo, requests[0].branch);
10614
10880
  return yield* commentsIn(worktree, requests);
10615
10881
  });
10616
- 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));
10617
10883
  submitReply = fn("Cli.submitReply")(function* (request) {
10618
10884
  const store = yield* Store;
10619
10885
  const worktree = yield* findBranch(request.repo, request.branch);
@@ -10635,7 +10901,7 @@ var init_commands = __esmMin((() => {
10635
10901
  const current = yield* store.state(worktree.path);
10636
10902
  if (Object.hasOwn(current.settled, root)) yield* store.changeState(worktree.path, (was) => ({
10637
10903
  ...was,
10638
- settled: without$1(was.settled, root)
10904
+ settled: without$2(was.settled, root)
10639
10905
  }));
10640
10906
  return batch;
10641
10907
  });
@@ -10701,13 +10967,13 @@ var init_commands = __esmMin((() => {
10701
10967
  const git = yield* Git;
10702
10968
  const worktree = yield* findBranch(repo, branch);
10703
10969
  const found = yield* git.source(worktree, file);
10704
- return getOrElse(found, () => []);
10970
+ return getOrElse$1(found, () => []);
10705
10971
  });
10706
10972
  fileBefore = fn("Cli.fileBefore")(function* (repo, branch, file) {
10707
10973
  const git = yield* Git;
10708
10974
  const worktree = yield* findBranch(repo, branch);
10709
10975
  const found = yield* git.blob(worktree, file);
10710
- return getOrElse(found, () => []);
10976
+ return getOrElse$1(found, () => []);
10711
10977
  });
10712
10978
  readPreferences = fn("Cli.readPreferences")(function* () {
10713
10979
  const kept = yield* (yield* Store).settings;
@@ -11034,7 +11300,7 @@ var init_pane = __esmMin((() => {
11034
11300
  //#region package.json
11035
11301
  init_drafts();
11036
11302
  init_pane();
11037
- var version$1 = "0.1.0-alpha.147";
11303
+ var version$1 = "0.1.0-alpha.148";
11038
11304
  //#endregion
11039
11305
  //#region src/cli/upgrade.ts
11040
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;
@@ -11633,7 +11899,7 @@ var init_layers = __esmMin((() => {
11633
11899
  }));
11634
11900
  //#endregion
11635
11901
  //#region src/cli/threads.ts
11636
- 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;
11637
11903
  var init_threads = __esmMin((() => {
11638
11904
  init_dist();
11639
11905
  init_patch();
@@ -11641,7 +11907,7 @@ var init_threads = __esmMin((() => {
11641
11907
  init_commands();
11642
11908
  init_layers();
11643
11909
  init_error();
11644
- stateOf = (turns, asked, isSettled, isRemoved) => {
11910
+ stateOf$1 = (turns, asked, isSettled, isRemoved) => {
11645
11911
  if (isRemoved) return "removed";
11646
11912
  if (isSettled) return "done";
11647
11913
  const last = turns.at(-1);
@@ -11698,7 +11964,7 @@ var init_threads = __esmMin((() => {
11698
11964
  start: sits.start,
11699
11965
  end: sits.end,
11700
11966
  body: comment.body,
11701
- 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)),
11702
11968
  stale: batch.head !== reading.head,
11703
11969
  outside: !reading.shown.has(comment.anchor.path) || !sits.placed,
11704
11970
  unread: Math.max(0, mine.length - seen),
@@ -11790,13 +12056,13 @@ var init_threads = __esmMin((() => {
11790
12056
  removeComment = fn("Cli.removeComment")(function* (repo, branch, id, at) {
11791
12057
  return yield* removeIn(yield* findBranch(repo, branch), id, at);
11792
12058
  });
11793
- 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));
11794
12060
  restoreIn = fn("Cli.restoreIn")(function* (worktree, id) {
11795
12061
  const store = yield* Store;
11796
12062
  if (!(yield* isKnown(worktree.path, id))) return yield* new UnknownComment({ id });
11797
12063
  yield* store.changeState(worktree.path, (was) => ({
11798
12064
  ...was,
11799
- removed: without(was.removed, id)
12065
+ removed: without$1(was.removed, id)
11800
12066
  }));
11801
12067
  return { restored: id };
11802
12068
  });
@@ -11806,7 +12072,7 @@ var init_threads = __esmMin((() => {
11806
12072
  if (!(yield* isKnown(worktree.path, id))) return yield* new UnknownComment({ id });
11807
12073
  yield* store.changeState(worktree.path, (was) => ({
11808
12074
  ...was,
11809
- removed: without(was.removed, id)
12075
+ removed: without$1(was.removed, id)
11810
12076
  }));
11811
12077
  return { restored: id };
11812
12078
  });
@@ -12195,6 +12461,94 @@ var init_catalog = __esmMin((() => {
12195
12461
  dataKey: "comments",
12196
12462
  example: "adiff comment list --worktree . --fields id,body,settled"
12197
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
+ },
12198
12552
  {
12199
12553
  name: "comment resolve",
12200
12554
  about: "Mark a comment settled. Only the reviewer who raised it can",
@@ -12518,6 +12872,21 @@ var init_report$1 = __esmMin((() => {
12518
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.",
12519
12873
  retriable: false
12520
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
+ },
12521
12890
  UnknownField: {
12522
12891
  exit: 2,
12523
12892
  suggestion: "That is not a field this answer carries. The ones it does are named above.",
@@ -12658,6 +13027,269 @@ var init_report$1 = __esmMin((() => {
12658
13027
  exit: advice.exit
12659
13028
  };
12660
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
+ });
12661
13293
  }));
12662
13294
  //#endregion
12663
13295
  //#region src/cli/index.ts
@@ -12671,6 +13303,7 @@ var init_cli = __esmMin((() => {
12671
13303
  init_catalog();
12672
13304
  init_report$1();
12673
13305
  init_error();
13306
+ init_remarks();
12674
13307
  }));
12675
13308
  //#endregion
12676
13309
  //#region src/cli/help.ts
@@ -12785,7 +13418,7 @@ var init_gaps = __esmMin((() => {
12785
13418
  };
12786
13419
  lastNewLine = (patch) => {
12787
13420
  const found = patch.rows.findLast((row) => isSome(row.newLine));
12788
- return found === void 0 ? 0 : getOrElse(found.newLine, () => 0);
13421
+ return found === void 0 ? 0 : getOrElse$1(found.newLine, () => 0);
12789
13422
  };
12790
13423
  spansOf = (patch, total) => {
12791
13424
  const leading = {
@@ -13043,7 +13676,7 @@ var init_tree = __esmMin((() => {
13043
13676
  return node.children.reduce((total, child) => total + filesUnder(tree, child), 0);
13044
13677
  };
13045
13678
  crowdedDirectories = (tree, limit) => tree.nodes.filter((node) => node.kind === "directory" && directFiles(tree, node.id) > limit).map((node) => node.path);
13046
- })), 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;
13047
13680
  var init_model = __esmMin((() => {
13048
13681
  init_dist();
13049
13682
  init_patch();
@@ -13120,6 +13753,7 @@ var init_model = __esmMin((() => {
13120
13753
  closed: [],
13121
13754
  vouched: [],
13122
13755
  sent: [],
13756
+ remarks: [],
13123
13757
  viewport: 20,
13124
13758
  context: 3,
13125
13759
  contextWas: 3,
@@ -13506,6 +14140,7 @@ var init_model = __esmMin((() => {
13506
14140
  composeRoom$1 = (columns) => Math.max(COMPOSE_LEAST, composeBox(columns) - COMPOSE_PAD);
13507
14141
  composeTarget = (state) => {
13508
14142
  const patch = selectedPatch(state);
14143
+ if (state.answerTo !== void 0) return answerTarget(state);
13509
14144
  if (state.replyTo !== void 0) return replyTarget(state);
13510
14145
  if (patch === void 0) return "";
13511
14146
  const [from, to] = selectionRange(state);
@@ -13516,6 +14151,11 @@ var init_model = __esmMin((() => {
13516
14151
  });
13517
14152
  return span === "" ? `Comment on ${patch.path}` : `Comment on ${patch.path}:${span}`;
13518
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
+ };
13519
14159
  replyTarget = (state) => {
13520
14160
  const thread = threadReplying(state);
13521
14161
  if (thread === void 0) return "Reply";
@@ -13611,6 +14251,7 @@ var init_model = __esmMin((() => {
13611
14251
  onSome: (value) => value === line
13612
14252
  }))?.index;
13613
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);
13614
14255
  commentRowsIn = (state, fileIndex) => {
13615
14256
  const patch = fileIndex === state.patchIndex ? selectedPatch(state) : state.patches[fileIndex];
13616
14257
  if (patch === void 0) return [];
@@ -13623,9 +14264,72 @@ var init_model = __esmMin((() => {
13623
14264
  if (patch === void 0 || here === void 0) return [];
13624
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);
13625
14266
  };
13626
- stopsAtRow = (state, row) => 1 + threadsAtRow(state, row).length;
13627
- threadHere = (state) => threadChosen(state) ?? threadAtStop(state) ?? threadAtRow(state, state.cursor);
13628
- 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
+ };
13629
14333
  threadAtRow = (state, row) => {
13630
14334
  const patch = selectedPatch(state);
13631
14335
  const here = patch?.rows[row];
@@ -13636,18 +14340,20 @@ var init_model = __esmMin((() => {
13636
14340
  const patch = selectedPatch(state);
13637
14341
  if (patch === void 0) return [];
13638
14342
  const open = state.sent.filter((entry) => entry.file === patch.path && entry.settled !== true && entry.removed !== true && entry.outside !== true);
13639
- 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);
13640
14344
  };
13641
- 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] : []);
13642
14346
  answerCount = (comments) => comments.reduce((total, entry) => total + (entry.answers?.length ?? 0), 0);
13643
14347
  PANEL_SECTIONS = [
14348
+ "remarks",
13644
14349
  "held",
13645
14350
  "asked",
13646
14351
  "filed",
13647
14352
  "with",
13648
14353
  "answered",
13649
14354
  "settled",
13650
- "removed"
14355
+ "removed",
14356
+ "dismissed"
13651
14357
  ];
13652
14358
  answersIn = (comment) => comment.answers?.length ?? 0;
13653
14359
  newerOf = (state, comment) => {
@@ -13669,20 +14375,33 @@ var init_model = __esmMin((() => {
13669
14375
  sentEntry = (state, comment) => {
13670
14376
  const newer = newerOf(state, comment);
13671
14377
  return {
14378
+ kind: "comment",
13672
14379
  section: sectionOf(newer),
13673
14380
  comment: newer,
13674
14381
  fresh: newer !== comment,
13675
14382
  unread: newer.unread ?? 0
13676
14383
  };
13677
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
+ }));
13678
14390
  panelEntries = (state) => {
13679
14391
  const shown = state.hideSettled ? state.sent.filter((comment) => comment.settled !== true) : state.sent;
13680
- const delivered = [...state.held.map((comment) => ({
14392
+ const waiting = state.held.map((comment) => ({
14393
+ kind: "comment",
13681
14394
  section: "held",
13682
14395
  comment,
13683
14396
  fresh: false,
13684
14397
  unread: 0
13685
- })), ...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
+ ];
13686
14405
  const ordered = (section) => {
13687
14406
  const found = delivered.filter((entry) => entry.section === section);
13688
14407
  return state.newestFirst ? found.toReversed() : found;
@@ -13692,7 +14411,8 @@ var init_model = __esmMin((() => {
13692
14411
  panelEntry = (state) => panelEntries(state)[state.panelIndex];
13693
14412
  threadChosen = (state) => {
13694
14413
  if (state.focus !== "review") return void 0;
13695
- return panelEntry(state)?.comment;
14414
+ const entry = panelEntry(state);
14415
+ return entry?.kind === "comment" ? entry.comment : void 0;
13696
14416
  };
13697
14417
  spokenSince = (seen, now) => Math.max(0, answerCount(now) - answerCount(seen));
13698
14418
  hunkStarts = (state) => {
@@ -13887,6 +14607,8 @@ var init_command = __esmMin((() => {
13887
14607
  whenLayers: false,
13888
14608
  whenStale: false,
13889
14609
  whenThread: false,
14610
+ whenRemark: false,
14611
+ whenAnswerable: false,
13890
14612
  whenSelecting: false,
13891
14613
  whenReviewed: false,
13892
14614
  whenPull: false,
@@ -14268,6 +14990,22 @@ var init_command = __esmMin((() => {
14268
14990
  hint: "settle read",
14269
14991
  rank: 1
14270
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
+ }),
14271
15009
  command({
14272
15010
  action: "thread.reply",
14273
15011
  also: [
@@ -14279,11 +15017,11 @@ var init_command = __esmMin((() => {
14279
15017
  panes: ["review", "diff"],
14280
15018
  hint: "reply",
14281
15019
  rank: 1,
14282
- title: "Write back to the thread here",
15020
+ title: "Write back to the thread or remark here",
14283
15021
  category: "Comments",
14284
15022
  keys: ["R"],
14285
15023
  screens: ["review"],
14286
- whenThread: true
15024
+ whenAnswerable: true
14287
15025
  }),
14288
15026
  command({
14289
15027
  action: "thread.remove",
@@ -14675,6 +15413,8 @@ var init_command = __esmMin((() => {
14675
15413
  };
14676
15414
  heldOrRemoved = (offered) => {
14677
15415
  if (offered.onHeld) return "drop";
15416
+ if (offered.onDismissed) return "restore";
15417
+ if (offered.onRemark) return "dismiss";
14678
15418
  return offered.onRemoved ? "restore" : "remove";
14679
15419
  };
14680
15420
  SWAPPED = {
@@ -14689,7 +15429,7 @@ var init_command = __esmMin((() => {
14689
15429
  if (swapped !== void 0) return swapped(offered);
14690
15430
  return entry.counted ? `${entry.hint} ${offered.comments}` : entry.hint;
14691
15431
  };
14692
- 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) => ({
14693
15433
  key: displayKey(entry.keys[0] ?? ""),
14694
15434
  hint: hintOf(entry, offered),
14695
15435
  press: entry.keys[0] ?? ""
@@ -14733,7 +15473,7 @@ var init_match = __esmMin((() => {
14733
15473
  }));
14734
15474
  //#endregion
14735
15475
  //#region src/tui/reduce.ts
14736
- 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;
14737
15477
  var init_reduce = __esmMin((() => {
14738
15478
  init_dist();
14739
15479
  init_patch();
@@ -14849,13 +15589,13 @@ var init_reduce = __esmMin((() => {
14849
15589
  anchorRow: 0,
14850
15590
  selecting: false
14851
15591
  };
14852
- const rows = commentRowsIn(moved, file);
15592
+ const rows = needingRowsIn(moved, file);
14853
15593
  const landing = delta > 0 ? rows[0] : rows.at(-1);
14854
15594
  return landing === void 0 ? moved : atRow(moved, landing);
14855
15595
  };
14856
15596
  nothingOpen = (state) => {
14857
- const any = commentRowsIn(state, state.patchIndex).length > 0;
14858
- 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");
14859
15599
  };
14860
15600
  layerComment = (state, delta) => {
14861
15601
  const here = openCommentRows(state);
@@ -15258,6 +15998,7 @@ var init_reduce = __esmMin((() => {
15258
15998
  "compose.submit": (state) => state,
15259
15999
  "held.send": (state) => state,
15260
16000
  "thread.reply": (state) => state,
16001
+ "remark.accept": (state) => state,
15261
16002
  "focus.toggle": (state) => ({
15262
16003
  ...state,
15263
16004
  focus: focusStepped(state, 1)
@@ -15414,6 +16155,10 @@ var init_reduce = __esmMin((() => {
15414
16155
  ...state,
15415
16156
  pan: Math.max(0, state.pan + delta)
15416
16157
  };
16158
+ withRemarks = (state, remarks) => ({
16159
+ ...state,
16160
+ remarks
16161
+ });
15417
16162
  withSent = (state, sent) => ({
15418
16163
  ...state,
15419
16164
  sent,
@@ -15750,7 +16495,7 @@ var init_theme = __esmMin((() => {
15750
16495
  }));
15751
16496
  //#endregion
15752
16497
  //#region src/tui/diffview.ts
15753
- 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;
15754
16499
  var init_diffview = __esmMin((() => {
15755
16500
  init_dist();
15756
16501
  init_patch();
@@ -16321,7 +17066,9 @@ var init_diffview = __esmMin((() => {
16321
17066
  }
16322
17067
  return lines;
16323
17068
  };
16324
- headOf = (note) => {
17069
+ REMARK_MARK$1 = "◇";
17070
+ remarkHead = (note, from) => `${REMARK_MARK$1} @${from}${note.stale ? " · outdated" : ""}`;
17071
+ commentHead = (note) => {
16325
17072
  const moved = note.stale ? ", the branch moved on" : "";
16326
17073
  if (note.settled) return `${marks().done} settled${moved}`;
16327
17074
  if (note.asks) return `${marks().asked} asked back${moved}`;
@@ -16330,17 +17077,26 @@ var init_diffview = __esmMin((() => {
16330
17077
  if (note.takenAt === void 0) return `${marks().sent} sent${moved}`;
16331
17078
  return `${marks().waiting} picked up ${sinceThen(note.takenAt, note.now)}${moved}`;
16332
17079
  };
17080
+ headOf = (note) => note.from === void 0 ? commentHead(note) : remarkHead(note, note.from);
16333
17081
  spokenLines = (body, room, mark) => {
16334
17082
  return body.split("\n").flatMap((line) => wrap(line, Math.max(NOTE_MIN, room - 2))).map((text, at) => at === 0 ? `${mark} ${text}` : ` ${text}`);
16335
17083
  };
16336
- 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
+ };
16337
17092
  noteLines = (note, room) => note.folded ? [`${headOf(note)} · press l`] : [
16338
17093
  headOf(note),
16339
- ...note.body.split("\n").flatMap((line) => wrap(line, room)),
17094
+ ...bodyLines(note, room),
16340
17095
  ...answerLines(note, room)
16341
17096
  ];
17097
+ REMARK_RULE = "┊";
16342
17098
  noteRows = (note, row, room, stop) => noteLines(note, room).map((line, index) => ({
16343
- text: `${marks().rule} ${line}`,
17099
+ text: `${note.from === void 0 ? marks().rule : REMARK_RULE} ${line}`,
16344
17100
  row,
16345
17101
  stop,
16346
17102
  comment: true,
@@ -16444,7 +17200,7 @@ var init_diffview = __esmMin((() => {
16444
17200
  }));
16445
17201
  //#endregion
16446
17202
  //#region src/tui/render.ts
16447
- 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;
16448
17204
  var init_render = __esmMin((() => {
16449
17205
  init_dist();
16450
17206
  init_command();
@@ -17069,10 +17825,30 @@ var init_render = __esmMin((() => {
17069
17825
  takenAt: entry.takenAt,
17070
17826
  now: shown.now
17071
17827
  }));
17072
- 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, {
17073
17849
  opened: state.opened,
17074
17850
  now: state.now
17075
- });
17851
+ }), ...remarksOf(state, path)];
17076
17852
  paired = (chunks) => {
17077
17853
  const chips = [];
17078
17854
  for (let at = 0; at < chunks.length; at += CHIP_CHUNKS) chips.push(chunks.slice(at, at + CHIP_CHUNKS));
@@ -17283,11 +18059,16 @@ var init_render = __esmMin((() => {
17283
18059
  return `${row.here === true ? marks().cursor : " "}${look.mark.padStart(GUTTER - 1)}`;
17284
18060
  };
17285
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;
17286
18065
  offeredIn = (state) => ({
17287
18066
  comments: state.sent.length,
17288
18067
  held: state.held.length,
17289
18068
  layers: state.layers.length,
17290
- onThread: state.stop > 0 || threadChosen(state) !== void 0,
18069
+ onThread: standingOnThread(state),
18070
+ onRemark: standingOnRemark(state),
18071
+ onDismissed: standingOnDismissed(state),
17291
18072
  selecting: state.selecting,
17292
18073
  reviewed: reviewedCountIn(state),
17293
18074
  pull: pullHere(state).length > 0,
@@ -17300,6 +18081,8 @@ var init_render = __esmMin((() => {
17300
18081
  onHeld: state.focus === "review" && panelEntry(state)?.section === "held"
17301
18082
  });
17302
18083
  PANEL_TITLES = {
18084
+ remarks: "Remarks",
18085
+ dismissed: "Dismissed",
17303
18086
  held: "Waiting to be sent",
17304
18087
  asked: "Waiting on you",
17305
18088
  filed: "Not picked up",
@@ -17359,17 +18142,34 @@ var init_render = __esmMin((() => {
17359
18142
  chunks: kept.flatMap((block) => block.chunks)
17360
18143
  };
17361
18144
  };
17362
- panelWhere = (entry, room) => {
17363
- const where = entry.comment.outside === true ? " · not in the diff" : `:${entry.comment.end}`;
17364
- 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}`;
17365
18162
  };
17366
- panelBody = (entry) => entry.comment.body.split("\n").find((line) => line.trim().length > 0) ?? "";
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) ?? "";
18165
+ };
18166
+ panelMark = (entry) => entry.kind === "remark" ? REMARK_MARK : standMark(threadStand(entry.comment));
17367
18167
  panelPair = (state, placed, room) => {
17368
18168
  const { entry } = placed;
17369
- const lead = ` ${standMark(threadStand(entry.comment))} `;
18169
+ const lead = ` ${panelMark(entry)} `;
17370
18170
  const here = placed.at === state.panelIndex;
17371
18171
  return [{
17372
- text: `${lead}${panelWhere(entry, room - PANEL_LEAD)}`,
18172
+ text: `${lead}${panelWhere(state, entry, room - PANEL_LEAD)}`,
17373
18173
  tone: palette.ink,
17374
18174
  here
17375
18175
  }, {
@@ -17418,8 +18218,8 @@ var init_render = __esmMin((() => {
17418
18218
  entry,
17419
18219
  at
17420
18220
  }));
17421
- const fresh = placed.filter((one) => one.entry.fresh).length;
17422
- 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;
17423
18223
  const said = fresh > 0 ? `${fresh} ${PULL_HINT}` : unread > 0 ? `${unread} unread` : "";
17424
18224
  const banner = said.length === 0 ? [] : [{
17425
18225
  text: clip(said, room),
@@ -18774,6 +19574,7 @@ var init_app = __esmMin((() => {
18774
19574
  "thread.settleRead": () => this.settleWhatIsRead(),
18775
19575
  "thread.remove": () => this.removeHere(),
18776
19576
  "thread.reply": () => this.replyHere(),
19577
+ "remark.accept": () => this.acceptRemarkHere(),
18777
19578
  "selection.copy": () => sync(() => this.copySelection(false)),
18778
19579
  "search.open": () => this.findSelection(),
18779
19580
  "search.jump": () => this.runFinder(),
@@ -18891,13 +19692,16 @@ var init_app = __esmMin((() => {
18891
19692
  return gen({ self: this }, function* () {
18892
19693
  const reading = yield* readingOf(this.repo, name, this.base);
18893
19694
  this.reading = reading;
18894
- const [progress, layers, sent] = yield* all([
19695
+ const [progress, layers, sent, remarks] = yield* all([
18895
19696
  progressIn(reading),
18896
19697
  layersIn(reading),
18897
- sentIn(reading)
19698
+ sentIn(reading),
19699
+ result(remarksIn(this.repo, reading))
18898
19700
  ], { concurrency: "unbounded" });
18899
19701
  const opened = withVouched(withPatches(this.state, reading.patches), progress.vouched);
18900
- 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");
18901
19705
  });
18902
19706
  }
18903
19707
  openBranch() {
@@ -19039,6 +19843,10 @@ var init_app = __esmMin((() => {
19039
19843
  this.commit(withNoticeHere(this.state, "nothing in the review yet"));
19040
19844
  return;
19041
19845
  }
19846
+ if (entry.kind === "remark") {
19847
+ yield* this.openRemark(entry.remark);
19848
+ return;
19849
+ }
19042
19850
  const at = this.state.patches.findIndex((patch) => patch.path === entry.comment.file);
19043
19851
  if (this.state.patches[at] === void 0) {
19044
19852
  yield* this.readAnswers(entry.comment.id);
@@ -19109,7 +19917,7 @@ var init_app = __esmMin((() => {
19109
19917
  settleHere() {
19110
19918
  return gen({ self: this }, function* () {
19111
19919
  const branch = selectedBranch(this.state);
19112
- const id = (threadChosen(this.state) ?? threadAtStop(this.state) ?? threadAtRow(this.state, this.state.cursor))?.id;
19920
+ const id = threadHere(this.state)?.id;
19113
19921
  if (branch === void 0 || id === void 0) {
19114
19922
  this.commit(withNotice(this.state, "no thread here"));
19115
19923
  return;
@@ -19126,8 +19934,18 @@ var init_app = __esmMin((() => {
19126
19934
  }
19127
19935
  replyHere() {
19128
19936
  return sync(() => {
19129
- const thread = threadChosen(this.state) ?? threadAtStop(this.state) ?? threadAtRow(this.state, this.state.cursor);
19130
- 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) {
19131
19949
  this.commit(withNotice(this.state, "no thread here"));
19132
19950
  return;
19133
19951
  }
@@ -19135,10 +19953,45 @@ var init_app = __esmMin((() => {
19135
19953
  ...this.state,
19136
19954
  screen: "compose",
19137
19955
  draft: "",
19138
- replyTo: thread.id
19956
+ answerTo: remark.id
19139
19957
  });
19140
19958
  });
19141
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
+ }
19142
19995
  staying(state, was) {
19143
19996
  const last = Math.max(0, panelEntries(state).length - 1);
19144
19997
  return {
@@ -19149,11 +20002,76 @@ var init_app = __esmMin((() => {
19149
20002
  heldUnderCursor() {
19150
20003
  if (this.state.focus !== "review") return -1;
19151
20004
  const entry = panelEntry(this.state);
19152
- if (entry?.section !== "held") return -1;
20005
+ if (entry === void 0 || entry.kind !== "comment" || entry.section !== "held") return -1;
19153
20006
  return this.state.held.indexOf(entry.comment);
19154
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
+ }
19155
20068
  removeHere() {
19156
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
+ }
19157
20075
  const waiting = this.heldUnderCursor();
19158
20076
  if (waiting !== -1) {
19159
20077
  yield* this.dropHeld(waiting);
@@ -19179,7 +20097,9 @@ var init_app = __esmMin((() => {
19179
20097
  opened: this.state.opened.filter((one) => one !== id)
19180
20098
  };
19181
20099
  const said = back ? "restored" : "removed, it is under Removed in the review";
19182
- 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));
19183
20103
  });
19184
20104
  }
19185
20105
  fillBranches() {
@@ -19475,7 +20395,9 @@ var init_app = __esmMin((() => {
19475
20395
  const widened = withContext(this.state, next, patches, 0);
19476
20396
  const patch = selectedPatch(widened);
19477
20397
  const cursor = patch === void 0 || line === void 0 ? 0 : rowAtSourceLine(patch, line);
19478
- 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));
19479
20401
  });
19480
20402
  }
19481
20403
  remember(action, key) {
@@ -19513,6 +20435,7 @@ var init_app = __esmMin((() => {
19513
20435
  });
19514
20436
  }
19515
20437
  send() {
20438
+ if (this.state.answerTo !== void 0) return this.sendRemarkAnswer(this.state.answerTo);
19516
20439
  return this.state.replyTo === void 0 ? this.sendComment() : this.sendReply(this.state.replyTo);
19517
20440
  }
19518
20441
  sendReply(to) {
@@ -19628,7 +20551,8 @@ var init_app = __esmMin((() => {
19628
20551
  end: comment.end,
19629
20552
  body: comment.body,
19630
20553
  id: randomUUID(),
19631
- at
20554
+ at,
20555
+ ...comment.remark === void 0 ? {} : { remark: comment.remark }
19632
20556
  });
19633
20557
  const many = this.state.held.length;
19634
20558
  yield* this.sending(branch.branch, [asked(first), ...rest.map(asked)]);
@@ -19889,6 +20813,38 @@ const commentAnswer = fn("Main.commentAnswer")(function* (options) {
19889
20813
  });
19890
20814
  yield* answer(options, { answered: report.answered });
19891
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
+ });
19892
20848
  const commentList = fn("Main.commentList")(function* (options) {
19893
20849
  const comments = yield* listThreads(yield* required(options, "repo"), yield* required(options, "branch"));
19894
20850
  yield* answer(options, { comments });
@@ -19976,6 +20932,11 @@ const routes = {
19976
20932
  "comment take": commentTake,
19977
20933
  "comment answer": commentAnswer,
19978
20934
  "comment list": commentList,
20935
+ "remark list": remarkList,
20936
+ "remark accept": remarkAccept,
20937
+ "remark reply": remarkReply,
20938
+ "remark dismiss": remarkDismiss,
20939
+ "remark restore": remarkRestore,
19979
20940
  "draft list": draftList,
19980
20941
  "draft add": draftAdd,
19981
20942
  "draft edit": draftEdit,