@aiwayds/dsh-opentui 0.28.2 → 0.29.0

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.
@@ -10804,6 +10804,9 @@ function decodeUnknownEffect(schema, options) {
10804
10804
  const parser = run(schema.ast);
10805
10805
  return options === undefined ? parser : (input, overrideOptions) => parser(input, mergeParseOptions(options, overrideOptions));
10806
10806
  }
10807
+ function decodeUnknownOption(schema, options) {
10808
+ return asOption(decodeUnknownEffect(schema, options));
10809
+ }
10807
10810
  function run(ast) {
10808
10811
  return runWithCompiler(normalCompiler, ast);
10809
10812
  }
@@ -10829,6 +10832,20 @@ function runWithCompiler(compiler, ast) {
10829
10832
  return result[args] === missing ? getValue(missing) : result;
10830
10833
  };
10831
10834
  }
10835
+ function asExit(parser) {
10836
+ return (input, options) => runSyncExit2(parser(input, options));
10837
+ }
10838
+ function asOption(parser) {
10839
+ const parserExit = asExit(parser);
10840
+ return (input, options) => {
10841
+ const exit = parserExit(input, options);
10842
+ if (isSuccess3(exit)) {
10843
+ return some2(exit.value);
10844
+ }
10845
+ getSchemaIssueOrThrow(exit.cause, "Option adapter can only return none for schema issues");
10846
+ return none2();
10847
+ };
10848
+ }
10832
10849
  function runSync2(effect, message) {
10833
10850
  const exit = runSyncExit2(effect);
10834
10851
  if (isSuccess3(exit)) {
@@ -11459,7 +11476,7 @@ function dateTimeArbitraryInteger(minimum, maximum) {
11459
11476
  maximum
11460
11477
  }));
11461
11478
  }
11462
- var TypeId23, SchemaError, make10, optionalKey2, optional2, toType2, Any2, Unknown2, Undefined2, String6, Number6, Boolean3, Symbol3, BigInt6, ArraySchema, NonEmptyArray, UndefinedOr, makeFilter2, Finite, isGreaterThan3, isGreaterThanOrEqualTo3, isLessThanOrEqualTo3, isBetween2, Int, NonEmptyString, RegExp3, URLString, URL2, File, URLSearchParams2, Base64String, Uint8Array2, dateTimeUtcFromString, arbitraryMinimumDateTimestamp = -8640000000000000, arbitraryMaximumDateTimestamp = 8640000000000000, arbitraryMinimumZonedDateTimeTimestamp, arbitraryMaximumZonedDateTimeTimestamp, arbitraryMinimumTimeZoneOffset, arbitraryMaximumTimeZoneOffset, DateTimeUtc, Json2, JsonObject;
11479
+ var TypeId23, SchemaError, decodeUnknownOption2, make10, optionalKey2, optional2, toType2, Any2, Unknown2, Undefined2, String6, Number6, Boolean3, Symbol3, BigInt6, ArraySchema, NonEmptyArray, UndefinedOr, makeFilter2, Finite, isGreaterThan3, isGreaterThanOrEqualTo3, isLessThanOrEqualTo3, isBetween2, Int, NonEmptyString, RegExp3, URLString, URL2, File, URLSearchParams2, Base64String, Uint8Array2, dateTimeUtcFromString, arbitraryMinimumDateTimestamp = -8640000000000000, arbitraryMaximumDateTimestamp = 8640000000000000, arbitraryMinimumZonedDateTimeTimestamp, arbitraryMaximumZonedDateTimeTimestamp, arbitraryMinimumTimeZoneOffset, arbitraryMaximumTimeZoneOffset, DateTimeUtc, Json2, JsonObject;
11463
11480
  var init_Schema = __esm(() => {
11464
11481
  init_Cause();
11465
11482
  init_Data();
@@ -11514,6 +11531,7 @@ var init_Schema = __esm(() => {
11514
11531
  return `SchemaError(${this.message})`;
11515
11532
  }
11516
11533
  };
11534
+ decodeUnknownOption2 = decodeUnknownOption;
11517
11535
  make10 = make9;
11518
11536
  optionalKey2 = /* @__PURE__ */ lambda((schema) => make10(optionalKey(schema.ast), {
11519
11537
  schema
@@ -13134,6 +13152,7 @@ var init_keybind = __esm(() => {
13134
13152
  "session.dock.tab.todo": keybind("alt+2", "Show activity todo details"),
13135
13153
  "session.first": keybind("ctrl+home,home,alt+home", "Navigate to first message"),
13136
13154
  "session.last": keybind("ctrl+alt+g,end", "Navigate to last message"),
13155
+ "session.scroll.to_bottom": keybind("alt+shift+end", "Scroll to the latest message"),
13137
13156
  "session.message.next": keybind("none", "Navigate to next message"),
13138
13157
  "session.message.previous": keybind("none", "Navigate to previous message"),
13139
13158
  "session.message.user.next": keybind("none", "Navigate to next user message"),
@@ -38521,21 +38540,18 @@ function applyActivityPanelConfig(config) {
38521
38540
  } catch {}
38522
38541
  }
38523
38542
  function activityPanelCapSpec(gear, terminalRows) {
38524
- if (gear === undefined)
38525
- return {
38526
- maxLines: dockLineCap(terminalRows)
38527
- };
38528
38543
  if (terminalRows !== undefined && terminalRows <= COMPOSER_COMPACT_TERMINAL_ROWS) {
38529
38544
  return {
38530
38545
  maxLines: dockLineCap(terminalRows)
38531
38546
  };
38532
38547
  }
38533
- if (gear === "all")
38548
+ const effective = gear ?? DEFAULT_ACTIVITY_PANEL_GEAR;
38549
+ if (effective === "all")
38534
38550
  return {
38535
38551
  maxLines: ACTIVITY_PANEL_ALL_LINES
38536
38552
  };
38537
38553
  return {
38538
- maxLines: Math.min(Number(gear), MERGED_DOCK_TOTAL_LINES)
38554
+ maxLines: Math.min(Number(effective), MERGED_DOCK_TOTAL_LINES)
38539
38555
  };
38540
38556
  }
38541
38557
  function dockHeightEase(t) {
@@ -39655,7 +39671,7 @@ function dockLineNode(line, width, ctx, fgFor, accentFg) {
39655
39671
  return _el$0;
39656
39672
  })();
39657
39673
  }
39658
- var SKIN_FADE_IN_MS = 400, SKIN_NOTICE_FADE_MS = 500, SKIN_PULSE_MS = 1200, SKIN_PULSE_CYCLES = 3, SKIN_PULSE_DIM = 0.45, SKIN_FAINT_MIX = 0.78, ACTIVITY_PANEL_GEARS, ACTIVITY_PANEL_ALL_LINES = 10, activityPanelGear, setActivityPanelGear, DOCK_HEIGHT_ANIM_MS = 200, dockHeightTween, setDockHeightTween, dockHeightSettled = undefined, dockFrameNow = 0, LINE_FIRST_SEEN_MAX = 512, lineFirstSeen, dockSpin, setDockSpin, mergedDockCursor, setMergedDockCursor, activityDockTab, setActivityDockTab, DOCK_TAB_ICON, DOCK_TAB_PADDING_STEPS, dockTabDigit = (label) => label.match(/^\d+/)?.[0] ?? "", todoSetSignature = (todos) => todos.map((todo) => todo.content).sort().join("\x01"), todoSetFirstSeen, subagentBatchStartedAt, prevSubagentRunning = 0, TODO_TOOL_NAMES, AUTO_POLE_LIGHT = "#ffffff", AUTO_POLE_DARK = "#000000", DOCK_ACCENT_STEPS, DOCK_ACCENT_HUES, DOCK_ACCENT_MIN_CONTRAST = 4.5, DOCK_ACCENT_FALLBACK, ACTIVITY_FRAME_DEFER_MS = 60, activityFrameLatch, COMPACT_TREE_MAX_LINES = 8;
39674
+ var SKIN_FADE_IN_MS = 400, SKIN_NOTICE_FADE_MS = 500, SKIN_PULSE_MS = 1200, SKIN_PULSE_CYCLES = 3, SKIN_PULSE_DIM = 0.45, SKIN_FAINT_MIX = 0.78, ACTIVITY_PANEL_GEARS, DEFAULT_ACTIVITY_PANEL_GEAR = "5", ACTIVITY_PANEL_ALL_LINES = 10, activityPanelGear, setActivityPanelGear, DOCK_HEIGHT_ANIM_MS = 200, dockHeightTween, setDockHeightTween, dockHeightSettled = undefined, dockFrameNow = 0, LINE_FIRST_SEEN_MAX = 512, lineFirstSeen, dockSpin, setDockSpin, mergedDockCursor, setMergedDockCursor, activityDockTab, setActivityDockTab, DOCK_TAB_ICON, DOCK_TAB_PADDING_STEPS, dockTabDigit = (label) => label.match(/^\d+/)?.[0] ?? "", todoSetSignature = (todos) => todos.map((todo) => todo.content).sort().join("\x01"), todoSetFirstSeen, subagentBatchStartedAt, prevSubagentRunning = 0, TODO_TOOL_NAMES, AUTO_POLE_LIGHT = "#ffffff", AUTO_POLE_DARK = "#000000", DOCK_ACCENT_STEPS, DOCK_ACCENT_HUES, DOCK_ACCENT_MIN_CONTRAST = 4.5, DOCK_ACCENT_FALLBACK, ACTIVITY_FRAME_DEFER_MS = 60, activityFrameLatch, COMPACT_TREE_MAX_LINES = 8;
39659
39675
  var init_widgets_dock = __esm(() => {
39660
39676
  init_index_bun();
39661
39677
  init_index_bun();
@@ -39729,6 +39745,40 @@ var init_widgets_dock = __esm(() => {
39729
39745
  activityFrameLatch = createFrameLatch();
39730
39746
  });
39731
39747
 
39748
+ // ../tui-base/src/routes/session/transcript-scroll-hints.ts
39749
+ function awayFromBottom(pos) {
39750
+ const { scrollTop, viewportHeight, scrollHeight } = pos;
39751
+ if (!Number.isFinite(scrollTop) || !Number.isFinite(viewportHeight) || !Number.isFinite(scrollHeight) || viewportHeight <= 0 || scrollHeight <= 0)
39752
+ return false;
39753
+ return scrollTop + viewportHeight < scrollHeight;
39754
+ }
39755
+ function newMessageCount(rows, baseline) {
39756
+ return Math.max(0, Math.floor(rows) - Math.floor(baseline));
39757
+ }
39758
+ function shouldPulse(previousCount, nextCount) {
39759
+ return nextCount > previousCount;
39760
+ }
39761
+ function newMessageCopyKey(count) {
39762
+ return count === 1 ? "transcript.scroll.newMessage" : "transcript.scroll.newMessages";
39763
+ }
39764
+ function keybindLabel(value) {
39765
+ if (typeof value === "string")
39766
+ return value.split(",")[0]?.trim() ?? "";
39767
+ if (Array.isArray(value))
39768
+ return keybindLabel(value[0]);
39769
+ if (value && typeof value === "object" && "key" in value)
39770
+ return keybindLabel(value.key);
39771
+ return "";
39772
+ }
39773
+ function pulseLevel(elapsedMs) {
39774
+ if (!Number.isFinite(elapsedMs) || elapsedMs <= 0 || elapsedMs >= HINT_PULSE_TOTAL_MS)
39775
+ return 0;
39776
+ const cycleMs = HINT_PULSE_TOTAL_MS / HINT_PULSE_CYCLES;
39777
+ const within = elapsedMs % cycleMs / cycleMs;
39778
+ return within < 0.5 ? within * 2 : (1 - within) * 2;
39779
+ }
39780
+ var HINT_PULSE_TOTAL_MS = 600, HINT_PULSE_CYCLES = 2;
39781
+
39732
39782
  // ../tui-base/src/routes/session/transcript.tsx
39733
39783
  import { BoxRenderable as BoxRenderable3, SyntaxStyle as SyntaxStyle2, TextAttributes as TextAttributes6 } from "@opentui/core";
39734
39784
  function codeBlockForm(isFinal) {
@@ -39885,6 +39935,88 @@ function Transcript(props) {
39885
39935
  row
39886
39936
  });
39887
39937
  const visibleRows = createMemo(() => projection.rows.filter((row) => row.kind !== "tool" && row.kind !== "reasoning" && row.kind !== "subagents"));
39938
+ const [away, setAway] = createSignal(false);
39939
+ const [newRows, setNewRows] = createSignal(0);
39940
+ const [pulseTick, setPulseTick] = createSignal(0);
39941
+ let transcriptScroll;
39942
+ let rowsAtBottom = 0;
39943
+ let lastCount = 0;
39944
+ let wasAway = false;
39945
+ let pulseStartedAt;
39946
+ const syncAway = () => {
39947
+ const scroll = transcriptScroll;
39948
+ if (!scroll || scroll.isDestroyed)
39949
+ return;
39950
+ const awayNow = awayFromBottom({
39951
+ scrollTop: scroll.scrollTop,
39952
+ viewportHeight: scroll.viewport.height,
39953
+ scrollHeight: scroll.scrollHeight
39954
+ });
39955
+ const rows = visibleRows().length;
39956
+ if (!awayNow) {
39957
+ rowsAtBottom = rows;
39958
+ lastCount = 0;
39959
+ wasAway = false;
39960
+ pulseStartedAt = undefined;
39961
+ setNewRows(0);
39962
+ setAway(false);
39963
+ return;
39964
+ }
39965
+ if (!wasAway) {
39966
+ rowsAtBottom = rows;
39967
+ lastCount = 0;
39968
+ }
39969
+ const count = newMessageCount(rows, rowsAtBottom);
39970
+ setAway(true);
39971
+ setNewRows(count);
39972
+ if (shouldPulse(lastCount, count) && motionDecorationsEnabled()) {
39973
+ pulseStartedAt = Date.now();
39974
+ setPulseTick((t) => t + 1);
39975
+ }
39976
+ lastCount = count;
39977
+ wasAway = true;
39978
+ };
39979
+ createEffect(() => {
39980
+ visibleRows().length;
39981
+ syncAway();
39982
+ });
39983
+ const toBottom = () => {
39984
+ if (!transcriptScroll || transcriptScroll.isDestroyed)
39985
+ return;
39986
+ transcriptScroll.scrollTo(Infinity);
39987
+ rowsAtBottom = visibleRows().length;
39988
+ lastCount = 0;
39989
+ wasAway = false;
39990
+ pulseStartedAt = undefined;
39991
+ setNewRows(0);
39992
+ setAway(false);
39993
+ };
39994
+ const pulsing = () => {
39995
+ pulseTick();
39996
+ return motionDecorationsEnabled() && pulseStartedAt !== undefined && Date.now() - pulseStartedAt < HINT_PULSE_TOTAL_MS;
39997
+ };
39998
+ onAnimationTick(() => pulsing() && motionAnimationRunning() ? motionFrameRate() : undefined, () => setPulseTick((t) => t + 1));
39999
+ const keymap = Keymap2.useOptional();
40000
+ const liveToBottomKeys = keymap ? Keymap2.useShortcut("session.scroll.to_bottom") : undefined;
40001
+ const toBottomKeys = () => liveToBottomKeys?.() ?? keybindLabel(defaultValue("session.scroll.to_bottom"));
40002
+ const hintText = () => {
40003
+ const keys = toBottomKeys();
40004
+ const count = newRows();
40005
+ return count > 0 ? t(newMessageCopyKey(count), {
40006
+ count,
40007
+ keys
40008
+ }) : t("transcript.scroll.toLatest", {
40009
+ keys
40010
+ });
40011
+ };
40012
+ const hintColor = () => {
40013
+ const target = color.loading();
40014
+ pulseTick();
40015
+ if (!motionDecorationsEnabled() || pulseStartedAt === undefined)
40016
+ return target;
40017
+ const level = pulseLevel(Date.now() - pulseStartedAt);
40018
+ return level > 0 ? mixSkinColor2(target, skinFaintColor(target, color.background()), level * SKIN_PULSE_DIM) : target;
40019
+ };
39888
40020
  const rowView = (row) => {
39889
40021
  switch (row.kind) {
39890
40022
  case "user":
@@ -39957,10 +40089,12 @@ function Transcript(props) {
39957
40089
  }
39958
40090
  };
39959
40091
  onCleanup(() => {
40092
+ if (transcriptScroll && !transcriptScroll.isDestroyed)
40093
+ transcriptScroll.verticalScrollBar.off("change", syncAway);
39960
40094
  props.scrollRef?.(undefined);
39961
40095
  });
39962
40096
  return (() => {
39963
- var _el$8 = createElement("box"), _el$9 = createElement("box"), _el$0 = createElement("box"), _el$1 = createElement("scrollbox");
40097
+ var _el$8 = createElement("box"), _el$9 = createElement("box"), _el$0 = createElement("box"), _el$1 = createElement("scrollbox"), _el$12 = createElement("box");
39964
40098
  insertNode(_el$8, _el$9);
39965
40099
  setProp(_el$8, "flexDirection", "column");
39966
40100
  setProp(_el$8, "flexGrow", 1);
@@ -39971,12 +40105,15 @@ function Transcript(props) {
39971
40105
  setProp(_el$9, "flexGrow", 1);
39972
40106
  setProp(_el$9, "minHeight", 0);
39973
40107
  insertNode(_el$0, _el$1);
40108
+ insertNode(_el$0, _el$12);
39974
40109
  setProp(_el$0, "flexGrow", 1);
39975
40110
  setProp(_el$0, "minHeight", 0);
39976
- setProp(_el$0, "position", "relative");
39977
- setProp(_el$0, "paddingBottom", 1);
40111
+ setProp(_el$0, "flexDirection", "column");
39978
40112
  use((value) => {
40113
+ transcriptScroll = value;
39979
40114
  props.scrollRef?.(value);
40115
+ value.verticalScrollBar.off("change", syncAway);
40116
+ value.verticalScrollBar.on("change", syncAway);
39980
40117
  }, _el$1);
39981
40118
  setProp(_el$1, "flexGrow", 1);
39982
40119
  setProp(_el$1, "overflow", "hidden");
@@ -39987,12 +40124,12 @@ function Transcript(props) {
39987
40124
  return visibleRows();
39988
40125
  },
39989
40126
  children: (row) => (() => {
39990
- var _el$13 = createElement("box");
39991
- setProp(_el$13, "marginTop", 1);
39992
- setProp(_el$13, "flexShrink", 0);
39993
- insert(_el$13, () => rowView(row));
39994
- effect((_$p) => setProp(_el$13, "id", `seam-row-${row.key}`, _$p));
39995
- return _el$13;
40127
+ var _el$15 = createElement("box");
40128
+ setProp(_el$15, "marginTop", 1);
40129
+ setProp(_el$15, "flexShrink", 0);
40130
+ insert(_el$15, () => rowView(row));
40131
+ effect((_$p) => setProp(_el$15, "id", `seam-row-${row.key}`, _$p));
40132
+ return _el$15;
39996
40133
  })()
39997
40134
  }), null);
39998
40135
  insert(_el$1, createComponent2(Show, {
@@ -40013,15 +40150,15 @@ function Transcript(props) {
40013
40150
  return props.pending?.() ?? [];
40014
40151
  },
40015
40152
  children: (row) => (() => {
40016
- var _el$14 = createElement("box");
40017
- setProp(_el$14, "marginTop", 1);
40018
- setProp(_el$14, "flexShrink", 0);
40019
- insert(_el$14, (() => {
40153
+ var _el$16 = createElement("box");
40154
+ setProp(_el$16, "marginTop", 1);
40155
+ setProp(_el$16, "flexShrink", 0);
40156
+ insert(_el$16, (() => {
40020
40157
  var _c$ = memo2(() => row.kind === "queue");
40021
40158
  return () => _c$() ? (() => {
40022
- var _el$15 = createElement("text");
40023
- setProp(_el$15, "wrapMode", "word");
40024
- insert(_el$15, (() => {
40159
+ var _el$17 = createElement("text");
40160
+ setProp(_el$17, "wrapMode", "word");
40161
+ insert(_el$17, (() => {
40025
40162
  var _c$2 = memo2(() => row.state === "paused");
40026
40163
  return () => _c$2() ? t("transcript.pending.queue.paused", {
40027
40164
  order: row.order ?? 1,
@@ -40033,18 +40170,18 @@ function Transcript(props) {
40033
40170
  })());
40034
40171
  effect((_p$) => {
40035
40172
  var _v$14 = color.pendingQueue(), _v$15 = TextAttributes6.ITALIC;
40036
- _v$14 !== _p$.e && (_p$.e = setProp(_el$15, "fg", _v$14, _p$.e));
40037
- _v$15 !== _p$.t && (_p$.t = setProp(_el$15, "attributes", _v$15, _p$.t));
40173
+ _v$14 !== _p$.e && (_p$.e = setProp(_el$17, "fg", _v$14, _p$.e));
40174
+ _v$15 !== _p$.t && (_p$.t = setProp(_el$17, "attributes", _v$15, _p$.t));
40038
40175
  return _p$;
40039
40176
  }, {
40040
40177
  e: undefined,
40041
40178
  t: undefined
40042
40179
  });
40043
- return _el$15;
40180
+ return _el$17;
40044
40181
  })() : (() => {
40045
- var _el$16 = createElement("text");
40046
- setProp(_el$16, "wrapMode", "word");
40047
- insert(_el$16, (() => {
40182
+ var _el$18 = createElement("text");
40183
+ setProp(_el$18, "wrapMode", "word");
40184
+ insert(_el$18, (() => {
40048
40185
  var _c$3 = memo2(() => row.state === "delivered");
40049
40186
  return () => _c$3() ? t("transcript.pending.steer.delivered", {
40050
40187
  text: row.text
@@ -40052,29 +40189,46 @@ function Transcript(props) {
40052
40189
  text: row.text
40053
40190
  });
40054
40191
  })());
40055
- effect((_$p) => setProp(_el$16, "fg", color.pendingSteer(), _$p));
40056
- return _el$16;
40192
+ effect((_$p) => setProp(_el$18, "fg", color.pendingSteer(), _$p));
40193
+ return _el$18;
40057
40194
  })();
40058
40195
  })());
40059
- effect((_$p) => setProp(_el$14, "id", `pending-row-${row.id}`, _$p));
40060
- return _el$14;
40196
+ effect((_$p) => setProp(_el$16, "id", `pending-row-${row.id}`, _$p));
40197
+ return _el$16;
40061
40198
  })()
40062
40199
  }), null);
40200
+ setProp(_el$12, "id", "transcript-scroll-hint");
40201
+ setProp(_el$12, "flexShrink", 0);
40202
+ setProp(_el$12, "height", 1);
40203
+ setProp(_el$12, "flexDirection", "row");
40204
+ setProp(_el$12, "justifyContent", "flex-end");
40205
+ setProp(_el$12, "onMouseUp", toBottom);
40206
+ insert(_el$12, createComponent2(Show, {
40207
+ get when() {
40208
+ return away();
40209
+ },
40210
+ get children() {
40211
+ var _el$13 = createElement("text");
40212
+ insert(_el$13, hintText);
40213
+ effect((_$p) => setProp(_el$13, "fg", hintColor(), _$p));
40214
+ return _el$13;
40215
+ }
40216
+ }));
40063
40217
  insert(_el$8, createComponent2(Show, {
40064
40218
  get when() {
40065
40219
  return props.status || props.widgets || props.children || props.footer || props.notices;
40066
40220
  },
40067
40221
  get children() {
40068
- var _el$12 = createElement("box");
40069
- setProp(_el$12, "width", "100%");
40070
- setProp(_el$12, "flexShrink", 0);
40071
- setProp(_el$12, "flexDirection", "column");
40072
- insert(_el$12, () => props.status, null);
40073
- insert(_el$12, () => props.widgets, null);
40074
- insert(_el$12, () => props.children, null);
40075
- insert(_el$12, () => props.footer, null);
40076
- insert(_el$12, () => props.notices, null);
40077
- return _el$12;
40222
+ var _el$14 = createElement("box");
40223
+ setProp(_el$14, "width", "100%");
40224
+ setProp(_el$14, "flexShrink", 0);
40225
+ setProp(_el$14, "flexDirection", "column");
40226
+ insert(_el$14, () => props.status, null);
40227
+ insert(_el$14, () => props.widgets, null);
40228
+ insert(_el$14, () => props.children, null);
40229
+ insert(_el$14, () => props.footer, null);
40230
+ insert(_el$14, () => props.notices, null);
40231
+ return _el$14;
40078
40232
  }
40079
40233
  }), null);
40080
40234
  effect((_p$) => {
@@ -40117,55 +40271,55 @@ function AskReplayBlock(props) {
40117
40271
  const askAnswerOf = (entry) => entry.selected.map((label) => splitRecommended(label).label).join(", ") || entry.custom || t("transcript.ask.declined");
40118
40272
  const askDeclinedOf = (entry) => entry.declined || entry.selected.length === 0 && !entry.custom;
40119
40273
  return (() => {
40120
- var _el$17 = createElement("box");
40121
- setProp(_el$17, "flexDirection", "column");
40122
- setProp(_el$17, "gap", 1);
40123
- insert(_el$17, createComponent2(For, {
40274
+ var _el$19 = createElement("box");
40275
+ setProp(_el$19, "flexDirection", "column");
40276
+ setProp(_el$19, "gap", 1);
40277
+ insert(_el$19, createComponent2(For, {
40124
40278
  get each() {
40125
40279
  return props.row.entries;
40126
40280
  },
40127
40281
  children: (entry) => (() => {
40128
- var _el$18 = createElement("box"), _el$19 = createElement("text"), _el$20 = createElement("text");
40129
- insertNode(_el$18, _el$19);
40130
- insertNode(_el$18, _el$20);
40131
- setProp(_el$18, "flexDirection", "column");
40132
- insert(_el$18, createComponent2(Show, {
40282
+ var _el$20 = createElement("box"), _el$21 = createElement("text"), _el$22 = createElement("text");
40283
+ insertNode(_el$20, _el$21);
40284
+ insertNode(_el$20, _el$22);
40285
+ setProp(_el$20, "flexDirection", "column");
40286
+ insert(_el$20, createComponent2(Show, {
40133
40287
  get when() {
40134
40288
  return entry.header;
40135
40289
  },
40136
40290
  children: (header) => (() => {
40137
- var _el$21 = createElement("text");
40138
- insert(_el$21, header);
40139
- effect((_$p) => setProp(_el$21, "fg", reasoning(), _$p));
40140
- return _el$21;
40291
+ var _el$23 = createElement("text");
40292
+ insert(_el$23, header);
40293
+ effect((_$p) => setProp(_el$23, "fg", reasoning(), _$p));
40294
+ return _el$23;
40141
40295
  })()
40142
- }), _el$19);
40143
- insert(_el$19, () => `\u2713 ${entry.question}`);
40144
- insert(_el$18, createComponent2(Show, {
40296
+ }), _el$21);
40297
+ insert(_el$21, () => `\u2713 ${entry.question}`);
40298
+ insert(_el$20, createComponent2(Show, {
40145
40299
  get when() {
40146
40300
  return entry.detail;
40147
40301
  },
40148
40302
  children: (detail) => (() => {
40149
- var _el$22 = createElement("text");
40150
- insert(_el$22, detail);
40151
- effect((_$p) => setProp(_el$22, "fg", reasoning(), _$p));
40152
- return _el$22;
40303
+ var _el$24 = createElement("text");
40304
+ insert(_el$24, detail);
40305
+ effect((_$p) => setProp(_el$24, "fg", reasoning(), _$p));
40306
+ return _el$24;
40153
40307
  })()
40154
- }), _el$20);
40155
- insert(_el$20, () => ` \u2192 ${askAnswerOf(entry)}`);
40308
+ }), _el$22);
40309
+ insert(_el$22, () => ` \u2192 ${askAnswerOf(entry)}`);
40156
40310
  effect((_p$) => {
40157
40311
  var _v$16 = reasoning(), _v$17 = askDeclinedOf(entry) ? reasoning() : answer();
40158
- _v$16 !== _p$.e && (_p$.e = setProp(_el$19, "fg", _v$16, _p$.e));
40159
- _v$17 !== _p$.t && (_p$.t = setProp(_el$20, "fg", _v$17, _p$.t));
40312
+ _v$16 !== _p$.e && (_p$.e = setProp(_el$21, "fg", _v$16, _p$.e));
40313
+ _v$17 !== _p$.t && (_p$.t = setProp(_el$22, "fg", _v$17, _p$.t));
40160
40314
  return _p$;
40161
40315
  }, {
40162
40316
  e: undefined,
40163
40317
  t: undefined
40164
40318
  });
40165
- return _el$18;
40319
+ return _el$20;
40166
40320
  })()
40167
40321
  }));
40168
- return _el$17;
40322
+ return _el$19;
40169
40323
  })();
40170
40324
  }
40171
40325
  var SIDES_RULE, SIDES_FRAME, CODE_RENDER_NODE_CACHE_MAX = 256, codeRenderNodeCache;
@@ -40184,7 +40338,9 @@ var init_transcript = __esm(() => {
40184
40338
  init_seam_rows();
40185
40339
  init_ask_options();
40186
40340
  init_theme3();
40341
+ init_keymap();
40187
40342
  init_i18n();
40343
+ init_keybind();
40188
40344
  init_motion();
40189
40345
  init_semantic();
40190
40346
  init_widgets_dock();
@@ -41572,6 +41728,23 @@ function TranscriptScrollKeys(props) {
41572
41728
  }],
41573
41729
  bindings: ["session.first", "session.last"]
41574
41730
  }));
41731
+ const toBottom = () => {
41732
+ const scroll = props.scroll();
41733
+ if (!scroll || scroll.isDestroyed)
41734
+ return;
41735
+ scroll.scrollTo(Infinity);
41736
+ };
41737
+ Keymap2.createLayer(() => ({
41738
+ capture: "main",
41739
+ enabled: props.enabled(),
41740
+ commands: [{
41741
+ id: "session.scroll.to_bottom",
41742
+ title: "Jump to latest",
41743
+ group: "Session",
41744
+ run: toBottom
41745
+ }],
41746
+ bindings: ["session.scroll.to_bottom"]
41747
+ }));
41575
41748
  return createComponent2(Show, {
41576
41749
  when: false,
41577
41750
  children: null
@@ -44215,6 +44388,91 @@ function persistLang(seam, lang) {
44215
44388
  function seamFailureReason(error) {
44216
44389
  return String(error instanceof Error ? error.message : error).slice(0, 150);
44217
44390
  }
44391
+ function pruneReasonLabel(reason) {
44392
+ const key = PRUNE_REASON_KEYS[reason];
44393
+ return key === undefined ? t("command.prune.reason.other", { reason }) : t(key);
44394
+ }
44395
+ function formatPruneBytes(bytes) {
44396
+ if (!Number.isFinite(bytes) || bytes <= 0)
44397
+ return "0 B";
44398
+ const units = ["B", "KB", "MB", "GB", "TB"];
44399
+ let value = bytes;
44400
+ let unit = 0;
44401
+ while (value >= 1024 && unit < units.length - 1) {
44402
+ value /= 1024;
44403
+ unit++;
44404
+ }
44405
+ const shown = unit === 0 || value >= 10 ? String(Math.round(value)) : value.toFixed(1);
44406
+ return `${shown} ${units[unit]}`;
44407
+ }
44408
+ function pruneBytes(plan, sizeById) {
44409
+ let total = 0;
44410
+ for (const entry of plan.entries) {
44411
+ if (entry.decision !== "prune")
44412
+ continue;
44413
+ const size = sizeById.get(entry.sessionId);
44414
+ if (typeof size === "number" && Number.isFinite(size) && size > 0)
44415
+ total += size;
44416
+ }
44417
+ return total;
44418
+ }
44419
+ function formatPrunePlanRows(plan, sizeById = new Map) {
44420
+ const rows = [
44421
+ t("command.prune.summary", {
44422
+ count: String(plan.counts.prune),
44423
+ skipped: String(plan.counts.skip),
44424
+ bytes: formatPruneBytes(pruneBytes(plan, sizeById)),
44425
+ days: String(plan.retentionDays)
44426
+ })
44427
+ ];
44428
+ const candidates = plan.entries.filter((entry) => entry.decision === "prune" && typeof entry.ageDays === "number" && Number.isFinite(entry.ageDays));
44429
+ if (candidates.length > 0) {
44430
+ const oldest = candidates.reduce((a, b) => b.ageDays > a.ageDays ? b : a);
44431
+ const newest = candidates.reduce((a, b) => b.ageDays < a.ageDays ? b : a);
44432
+ rows.push(t("command.prune.oldest", { id: oldest.sessionId, days: oldest.ageDays.toFixed(1) }));
44433
+ rows.push(t("command.prune.newest", { id: newest.sessionId, days: newest.ageDays.toFixed(1) }));
44434
+ }
44435
+ const reasons = Object.entries(plan.counts.byReason).sort((a, b) => b[1] - a[1]).slice(0, 5);
44436
+ if (reasons.length > 0) {
44437
+ rows.push(t("command.prune.skipSummary", {
44438
+ list: reasons.map(([reason, count]) => `${pruneReasonLabel(reason)}:${count}`).join(", ")
44439
+ }));
44440
+ }
44441
+ return rows;
44442
+ }
44443
+ function formatPurgePrepareRows(result) {
44444
+ const rows = [t("command.prunePurge.count", { count: String(result.candidates.length) })];
44445
+ for (const candidate of result.candidates) {
44446
+ rows.push(t("command.prunePurge.entry", {
44447
+ id: candidate.id,
44448
+ days: candidate.ageDays.toFixed(1)
44449
+ }));
44450
+ }
44451
+ if (result.rejected.length > 0) {
44452
+ rows.push(t("command.prunePurge.rejected", {
44453
+ count: String(result.rejected.length),
44454
+ codes: [...new Set(result.rejected.map((row) => row.code))].join(", ")
44455
+ }));
44456
+ }
44457
+ return rows;
44458
+ }
44459
+ function formatRestoreListRows(list) {
44460
+ const rows = [t("command.pruneRestore.count", { count: String(list.entries.length) })];
44461
+ for (const entry of list.entries) {
44462
+ rows.push(t("command.pruneRestore.entry", {
44463
+ id: entry.id,
44464
+ movedAt: new Date(entry.movedAt).toISOString(),
44465
+ size: entry.size === undefined ? t("command.pruneRestore.unknownSize") : formatPruneBytes(entry.size)
44466
+ }));
44467
+ }
44468
+ if (list.rejected.length > 0) {
44469
+ rows.push(t("command.pruneRestore.rejected", {
44470
+ count: String(list.rejected.length),
44471
+ codes: [...new Set(list.rejected.map((row) => row.code))].join(", ")
44472
+ }));
44473
+ }
44474
+ return rows;
44475
+ }
44218
44476
  function presetNextRow(rows, currentId) {
44219
44477
  if (rows.length <= 1)
44220
44478
  return;
@@ -45432,6 +45690,163 @@ function coreCommands() {
45432
45690
  ctx.say(t("command.cwd.failed", { reason: seamFailureReason(error) }));
45433
45691
  }
45434
45692
  }
45693
+ },
45694
+ {
45695
+ name: "/prune",
45696
+ description: t("command.prune.description"),
45697
+ async run(ctx) {
45698
+ if (!ctx.seam.planPrune || !ctx.seam.applyPrune) {
45699
+ ctx.say(t("command.prune.unavailable"));
45700
+ return;
45701
+ }
45702
+ try {
45703
+ const plan = await ctx.seam.planPrune();
45704
+ const sizeById = new Map;
45705
+ try {
45706
+ for (const row of await ctx.seam.listSessions(1e4)) {
45707
+ if (typeof row.sizeBytes === "number" && Number.isFinite(row.sizeBytes)) {
45708
+ sizeById.set(row.id, row.sizeBytes);
45709
+ }
45710
+ }
45711
+ } catch {}
45712
+ for (const line of formatPrunePlanRows(plan, sizeById))
45713
+ ctx.say(line);
45714
+ if (plan.counts.prune === 0) {
45715
+ ctx.say(t("command.prune.nothingToApply"));
45716
+ return;
45717
+ }
45718
+ if (!ctx.promptText) {
45719
+ ctx.say(t("command.prune.promptUnavailable"));
45720
+ return;
45721
+ }
45722
+ if (typeof plan.fingerprint !== "string" || typeof plan.configFingerprint !== "string") {
45723
+ ctx.say(t("command.prune.stalePlan"));
45724
+ return;
45725
+ }
45726
+ const answer = await ctx.promptText(t("command.prune.confirmTitle"), {
45727
+ placeholder: t("command.prune.confirmPlaceholder")
45728
+ });
45729
+ if (answer?.trim() !== "prune") {
45730
+ ctx.say(t("command.prune.cancelled"));
45731
+ return;
45732
+ }
45733
+ const result = await ctx.seam.applyPrune({
45734
+ fingerprint: plan.fingerprint,
45735
+ configFingerprint: plan.configFingerprint,
45736
+ generatedAt: plan.generatedAt
45737
+ });
45738
+ ctx.say(t("command.prune.applied", {
45739
+ count: String(result.applied.length),
45740
+ failed: String(result.failed.length)
45741
+ }));
45742
+ for (const row of result.failed) {
45743
+ ctx.say(t("command.prune.applyFailed", {
45744
+ id: row.id,
45745
+ code: row.code,
45746
+ message: row.message
45747
+ }));
45748
+ }
45749
+ if (result.markedOrphans > 0) {
45750
+ ctx.say(t("command.prune.orphans", { count: String(result.markedOrphans) }));
45751
+ }
45752
+ } catch (error) {
45753
+ ctx.say(t("command.prune.failed", { reason: seamFailureReason(error) }));
45754
+ }
45755
+ }
45756
+ },
45757
+ {
45758
+ name: "/prune-purge",
45759
+ description: t("command.prunePurge.description"),
45760
+ async run(ctx) {
45761
+ if (!ctx.seam.preparePurge || !ctx.seam.commitPurge) {
45762
+ ctx.say(t("command.prunePurge.unavailable"));
45763
+ return;
45764
+ }
45765
+ try {
45766
+ const prepared = await ctx.seam.preparePurge();
45767
+ for (const line of formatPurgePrepareRows(prepared))
45768
+ ctx.say(line);
45769
+ if (prepared.candidates.length === 0) {
45770
+ ctx.say(t("command.prunePurge.empty"));
45771
+ return;
45772
+ }
45773
+ if (!ctx.promptText) {
45774
+ ctx.say(t("command.prunePurge.promptUnavailable"));
45775
+ return;
45776
+ }
45777
+ const answer = await ctx.promptText(t("command.prunePurge.confirmTitle"), {
45778
+ placeholder: t("command.prunePurge.confirmPlaceholder")
45779
+ });
45780
+ if (answer?.trim() !== "purge") {
45781
+ ctx.say(t("command.prunePurge.cancelled"));
45782
+ return;
45783
+ }
45784
+ const result = await ctx.seam.commitPurge({ token: prepared.token });
45785
+ ctx.say(t("command.prunePurge.done", {
45786
+ count: String(result.purged.length),
45787
+ failed: String(result.failed.length)
45788
+ }));
45789
+ for (const row of result.failed) {
45790
+ ctx.say(t("command.prunePurge.failed", {
45791
+ code: row.code,
45792
+ message: row.message
45793
+ }));
45794
+ }
45795
+ } catch (error) {
45796
+ ctx.say(t("command.prunePurge.failed", {
45797
+ code: "INTERNAL",
45798
+ message: seamFailureReason(error)
45799
+ }));
45800
+ }
45801
+ }
45802
+ },
45803
+ {
45804
+ name: "/prune-restore",
45805
+ description: t("command.pruneRestore.description"),
45806
+ async run(ctx, argText) {
45807
+ if (!ctx.seam.listPruneRestore || !ctx.seam.restorePrune) {
45808
+ ctx.say(t("command.pruneRestore.unavailable"));
45809
+ return;
45810
+ }
45811
+ let id = argText.trim();
45812
+ try {
45813
+ if (id === "") {
45814
+ const list = await ctx.seam.listPruneRestore();
45815
+ for (const line of formatRestoreListRows(list))
45816
+ ctx.say(line);
45817
+ if (list.entries.length === 0) {
45818
+ ctx.say(t("command.pruneRestore.empty"));
45819
+ return;
45820
+ }
45821
+ if (!ctx.pickOne) {
45822
+ ctx.say(t("command.pruneRestore.promptUnavailable"));
45823
+ return;
45824
+ }
45825
+ const picked = await ctx.pickOne(t("command.pruneRestore.pickTitle"), list.entries.map((entry) => ({
45826
+ title: entry.id,
45827
+ value: entry.id,
45828
+ description: new Date(entry.movedAt).toISOString()
45829
+ })), t("command.pruneRestore.pickHeader"));
45830
+ if (picked === undefined) {
45831
+ ctx.say(t("command.pruneRestore.cancelled"));
45832
+ return;
45833
+ }
45834
+ id = picked;
45835
+ }
45836
+ const result = await ctx.seam.restorePrune(id);
45837
+ ctx.say(t("command.pruneRestore.done", { id: result.id }));
45838
+ } catch (error) {
45839
+ const rawCode = error?.code;
45840
+ const code = typeof rawCode === "string" && rawCode !== "" ? rawCode : "INTERNAL";
45841
+ if (code === "CONFLICT" || code === "LIVE_AGENT") {
45842
+ ctx.say(t("command.pruneRestore.conflict", { id }));
45843
+ }
45844
+ ctx.say(t("command.pruneRestore.failed", {
45845
+ code,
45846
+ message: seamFailureReason(error)
45847
+ }));
45848
+ }
45849
+ }
45435
45850
  }
45436
45851
  ];
45437
45852
  }
@@ -45455,7 +45870,7 @@ function dispatchLine(commands, line) {
45455
45870
  function unknownCommandRow(name) {
45456
45871
  return `unknown command: ${name} (try /help)`;
45457
45872
  }
45458
- var MODEL_DEFAULT_EFFORT_PICK = "__model_default__";
45873
+ var MODEL_DEFAULT_EFFORT_PICK = "__model_default__", PRUNE_REASON_KEYS;
45459
45874
  var init_commands = __esm(() => {
45460
45875
  init_i18n();
45461
45876
  init_hotkeys();
@@ -45464,6 +45879,28 @@ var init_commands = __esm(() => {
45464
45879
  init_hints_line();
45465
45880
  init_motion();
45466
45881
  init_export();
45882
+ PRUNE_REASON_KEYS = {
45883
+ "retention-disabled": "command.prune.reason.retentionDisabled",
45884
+ "field-anomaly": "command.prune.reason.fieldAnomaly",
45885
+ current: "command.prune.reason.current",
45886
+ staged: "command.prune.reason.staged",
45887
+ "agent-available": "command.prune.reason.agentAvailable",
45888
+ running: "command.prune.reason.running",
45889
+ "missing-time": "command.prune.reason.missingTime",
45890
+ "future-time": "command.prune.reason.futureTime",
45891
+ "subtree-running": "command.prune.reason.subtreeRunning",
45892
+ unknown: "command.prune.reason.unknown",
45893
+ "no-location": "command.prune.reason.noLocation",
45894
+ "header-mismatch": "command.prune.reason.headerMismatch",
45895
+ "basename-mismatch": "command.prune.reason.basenameMismatch",
45896
+ "not-directory": "command.prune.reason.notDirectory",
45897
+ "escaped-root": "command.prune.reason.escapedRoot",
45898
+ "lock-fresh": "command.prune.reason.lockFresh",
45899
+ "lock-held": "command.prune.reason.lockHeld",
45900
+ "fresh-mtime": "command.prune.reason.freshMtime",
45901
+ "blank-grace": "command.prune.reason.blankGrace",
45902
+ "within-retention": "command.prune.reason.withinRetention"
45903
+ };
45467
45904
  });
45468
45905
 
45469
45906
  // ../tui-base/src/routes/session/slash-complete.ts
@@ -50500,9 +50937,49 @@ function narrowCacheHitMode(value) {
50500
50937
  function readCacheHitMode(config) {
50501
50938
  return narrowCacheHitMode(config?.cacheHitMode);
50502
50939
  }
50503
- var DEFAULT_CACHE_HIT_MODE = "lastMessage";
50940
+ function configNonNegativeInt(value) {
50941
+ if (typeof value === "number" && Number.isFinite(value) && value >= 0)
50942
+ return Math.floor(value);
50943
+ if (typeof value === "string" && /^\d+$/.test(value.trim()))
50944
+ return Number(value.trim());
50945
+ return;
50946
+ }
50947
+ function readMaxRounds(config) {
50948
+ return configNonNegativeInt(config?.maxRounds) ?? DEFAULT_MAX_ROUNDS;
50949
+ }
50950
+ function readRetentionDays(config) {
50951
+ return configNonNegativeInt(config?.retentionDays) ?? DEFAULT_RETENTION_DAYS;
50952
+ }
50953
+ function readSessionScrollbar(...configs) {
50954
+ for (const config of configs) {
50955
+ const decoded = decodeScrollbar(config ?? {});
50956
+ if (decoded._tag === "Some" && decoded.value.session?.scrollbar !== undefined) {
50957
+ return decoded.value.session.scrollbar;
50958
+ }
50959
+ }
50960
+ return;
50961
+ }
50962
+ function resolveSessionScrollbar(...configs) {
50963
+ return readSessionScrollbar(...configs) ?? DEFAULT_SESSION_SCROLLBAR;
50964
+ }
50965
+ var DEFAULT_CACHE_HIT_MODE = "lastMessage", DEFAULT_MAX_ROUNDS = 50, DEFAULT_RETENTION_DAYS = 90, SessionScrollbarConfig, decodeScrollbar, DEFAULT_SESSION_SCROLLBAR = true;
50966
+ var init_config2 = __esm(() => {
50967
+ init_dist();
50968
+ SessionScrollbarConfig = Struct({
50969
+ session: optional2(Struct({ scrollbar: Boolean3 }))
50970
+ });
50971
+ decodeScrollbar = decodeUnknownOption2(SessionScrollbarConfig);
50972
+ });
50504
50973
 
50505
50974
  // ../tui-base/src/routes/session/settings-panel.tsx
50975
+ function unsetNumeric(config, key) {
50976
+ const value = config[key];
50977
+ if (typeof value === "number")
50978
+ return !Number.isFinite(value) || value < 0;
50979
+ if (typeof value === "string")
50980
+ return !/^\d+$/.test(value.trim());
50981
+ return true;
50982
+ }
50506
50983
  function str(value) {
50507
50984
  return typeof value === "string" && value !== "" ? value : undefined;
50508
50985
  }
@@ -50530,6 +51007,7 @@ function buildLocalItems(input) {
50530
51007
  zone: "local",
50531
51008
  editable: writable
50532
51009
  };
51010
+ const storedGear = activityPanelHeightFromConfig(merged.session?.activity_panel_height);
50533
51011
  const items = [{
50534
51012
  ...base,
50535
51013
  id: "theme",
@@ -50619,10 +51097,13 @@ function buildLocalItems(input) {
50619
51097
  ...base,
50620
51098
  id: "activityPanelHeight",
50621
51099
  label: t("settings.row.activityPanelHeight"),
50622
- value: activityPanelHeightFromConfig(merged.session?.activity_panel_height) ?? "default",
51100
+ value: storedGear ?? DEFAULT_ACTIVITY_PANEL_GEAR,
50623
51101
  source: "config.json \xB7 session.activity_panel_height",
50624
51102
  kind: "enum",
50625
51103
  options: ["default", "1", "5", "7", "10", "all"],
51104
+ ...storedGear === undefined ? {
51105
+ note: effectiveDefaultNote(DEFAULT_ACTIVITY_PANEL_GEAR)
51106
+ } : {},
50626
51107
  write: {
50627
51108
  via: "config",
50628
51109
  key: "session.activity_panel_height"
@@ -50631,10 +51112,13 @@ function buildLocalItems(input) {
50631
51112
  ...base,
50632
51113
  id: "retentionDays",
50633
51114
  label: "retentionDays",
50634
- value: num(merged.retentionDays)?.toString() ?? unknownValue(),
51115
+ value: readRetentionDays(merged).toString(),
50635
51116
  source: "config.json \xB7 retentionDays",
50636
51117
  kind: "number",
50637
51118
  min: 0,
51119
+ ...unsetNumeric(merged, "retentionDays") ? {
51120
+ note: effectiveDefaultNote(String(readRetentionDays(undefined)))
51121
+ } : {},
50638
51122
  write: {
50639
51123
  via: "config",
50640
51124
  key: "retentionDays"
@@ -50643,10 +51127,13 @@ function buildLocalItems(input) {
50643
51127
  ...base,
50644
51128
  id: "maxRounds",
50645
51129
  label: "maxRounds",
50646
- value: num(merged.maxRounds)?.toString() ?? unknownValue(),
51130
+ value: readMaxRounds(merged).toString(),
50647
51131
  source: "config.json \xB7 maxRounds (subagent round cap)",
50648
51132
  kind: "number",
50649
51133
  min: 0,
51134
+ ...unsetNumeric(merged, "maxRounds") ? {
51135
+ note: effectiveDefaultNote(String(readMaxRounds(undefined)))
51136
+ } : {},
50650
51137
  write: {
50651
51138
  via: "config",
50652
51139
  key: "maxRounds"
@@ -51258,13 +51745,16 @@ function applySettingsLive(item, applied, hints, themes) {
51258
51745
  function setSettingsBridge(value) {
51259
51746
  setBridgeOpen4(value);
51260
51747
  }
51261
- var unknownValue = () => t("settings.value.unset"), naValue = () => t("settings.value.na"), readonlyNote = () => t("settings.zone.readonlyNote"), HOST_SETTINGS_WHITELIST, HIDDEN_NAMESPACES, LOCAL_SETTING_IDS, bridgeOpen4, setBridgeOpen4, panelOpen5, setPanelOpen5, settingsPanelOpen, settingsBridgeOpen;
51748
+ var unknownValue = () => t("settings.value.unset"), naValue = () => t("settings.value.na"), readonlyNote = () => t("settings.zone.readonlyNote"), effectiveDefaultNote = (value) => t("settings.note.effectiveDefault", {
51749
+ value
51750
+ }), HOST_SETTINGS_WHITELIST, HIDDEN_NAMESPACES, LOCAL_SETTING_IDS, bridgeOpen4, setBridgeOpen4, panelOpen5, setPanelOpen5, settingsPanelOpen, settingsBridgeOpen;
51262
51751
  var init_settings_panel = __esm(() => {
51263
51752
  init_server();
51264
51753
  init_i18n();
51265
51754
  init_string_width();
51266
51755
  init_motion();
51267
51756
  init_hints_line();
51757
+ init_config2();
51268
51758
  init_widgets_dock();
51269
51759
  HOST_SETTINGS_WHITELIST = [{
51270
51760
  id: "subagent.maxActiveSubagents",
@@ -54637,6 +55127,21 @@ function SubagentsViewer(props) {
54637
55127
  return [];
54638
55128
  return seam.subagentTranscript(id);
54639
55129
  });
55130
+ const transcriptStatus = createMemo(() => {
55131
+ tick();
55132
+ const id = browsingId();
55133
+ if (id === undefined || props.seam.subagentTranscriptStatus === undefined)
55134
+ return;
55135
+ return props.seam.subagentTranscriptStatus(id);
55136
+ });
55137
+ const emptyTranscriptKey = () => {
55138
+ const state = transcriptStatus();
55139
+ if (state === "read-failed")
55140
+ return "panel.subagents.transcript.readFailed";
55141
+ if (state === "not-running")
55142
+ return "panel.subagents.transcript.ended";
55143
+ return "panel.subagents.transcript.empty";
55144
+ };
54640
55145
  const window = createMemo(() => transcriptWindow(transcript().length, scrollOffset(), TRANSCRIPT_ROWS));
54641
55146
  function startTicking() {
54642
55147
  if (tickTimer !== undefined)
@@ -54956,7 +55461,7 @@ function SubagentsViewer(props) {
54956
55461
  var _el$10 = createElement("text");
54957
55462
  setProp(_el$10, "fg", muted);
54958
55463
  setProp(_el$10, "wrapMode", "none");
54959
- insert(_el$10, () => t("panel.subagents.transcript.empty"));
55464
+ insert(_el$10, () => t(emptyTranscriptKey()));
54960
55465
  return _el$10;
54961
55466
  })();
54962
55467
  },
@@ -55049,7 +55554,7 @@ var init_subagents_viewer = __esm(() => {
55049
55554
  import { TextAttributes as TextAttributes12 } from "@opentui/core";
55050
55555
  function resolveVersion() {
55051
55556
  try {
55052
- return "0.28.2";
55557
+ return "0.29.0";
55053
55558
  } catch {
55054
55559
  return "dev";
55055
55560
  }
@@ -55223,7 +55728,7 @@ function buildOpentuiRows(ctx) {
55223
55728
  writable: ctx.local
55224
55729
  }).filter((item) => item.id !== "lang").map((row) => row.id === "activityPanelHeight" ? {
55225
55730
  ...row,
55226
- note: t("settings.row.activityPanelHeightNote")
55731
+ note: row.note === undefined ? t("settings.row.activityPanelHeightNote") : `${t("settings.row.activityPanelHeightNote")} \xB7 ${row.note}`
55227
55732
  } : row).map(fromItem);
55228
55733
  return settingsRowsForMode(rows, ctx);
55229
55734
  }
@@ -57641,7 +58146,7 @@ function journalToTranscriptRows(entries, skip = 0) {
57641
58146
  if (callId)
57642
58147
  toolCalls.delete(callId);
57643
58148
  const ok = entry.data.isError !== true && message.isError !== true;
57644
- const brief = JSON.stringify(entry.data.output ?? entry.data).slice(0, 300);
58149
+ const brief = toolResultText(entry.data).slice(0, 300);
57645
58150
  items.push({
57646
58151
  kind: "tool",
57647
58152
  name: known?.name ?? "tool",
@@ -57663,6 +58168,31 @@ function sourceKind2(data) {
57663
58168
  function assistantText(data) {
57664
58169
  return blocksText2(asRecord4(data.message).content);
57665
58170
  }
58171
+ function toolResultText(data) {
58172
+ const message = asRecord4(data.message);
58173
+ const output = asRecord4(data.output);
58174
+ const nestedMessage = asRecord4(output.message);
58175
+ const candidates = [
58176
+ message.content,
58177
+ data.content,
58178
+ data.output,
58179
+ data.text,
58180
+ message.text,
58181
+ output.content,
58182
+ output.text,
58183
+ nestedMessage.content
58184
+ ];
58185
+ for (const candidate of candidates) {
58186
+ if (typeof candidate === "string" && candidate !== "")
58187
+ return candidate;
58188
+ if (Array.isArray(candidate)) {
58189
+ const text = blocksText2(candidate);
58190
+ if (text !== "")
58191
+ return text;
58192
+ }
58193
+ }
58194
+ return "";
58195
+ }
57666
58196
  var init_remote_session_ops = __esm(() => {
57667
58197
  init_remote_follow();
57668
58198
  init_remote_stream();
@@ -58823,6 +59353,8 @@ var init_local_config_faces = __esm(() => {
58823
59353
  "stepsDisplay",
58824
59354
  "stepsCollapse",
58825
59355
  "stepsFolded",
59356
+ "maxRounds",
59357
+ "retentionDays",
58826
59358
  "agentPreset",
58827
59359
  "skinMigration",
58828
59360
  "workspaceTheme",
@@ -59379,6 +59911,261 @@ var init_bridge_settings_route = __esm(() => {
59379
59911
  };
59380
59912
  });
59381
59913
 
59914
+ // src/subagent-policy.ts
59915
+ function nonNegativeInt(value) {
59916
+ if (typeof value === "number" && Number.isFinite(value) && value >= 0)
59917
+ return Math.floor(value);
59918
+ if (typeof value === "string" && /^\d+$/.test(value.trim()))
59919
+ return Number(value.trim());
59920
+ return;
59921
+ }
59922
+ function parseSubagentRoundLimits(value) {
59923
+ if (value === null || typeof value !== "object")
59924
+ return { ...DEFAULT_SUBAGENT_ROUND_LIMITS };
59925
+ const record = value;
59926
+ const maxRounds = nonNegativeInt(record.maxRounds);
59927
+ const maxRoundsGrace = nonNegativeInt(record.maxRoundsGrace);
59928
+ return {
59929
+ maxRounds: maxRounds ?? DEFAULT_SUBAGENT_ROUND_LIMITS.maxRounds,
59930
+ maxRoundsGrace: maxRoundsGrace ?? DEFAULT_SUBAGENT_ROUND_LIMITS.maxRoundsGrace
59931
+ };
59932
+ }
59933
+ function earlyFloor(cap) {
59934
+ return Math.max(10, Math.floor(cap / 3));
59935
+ }
59936
+ function spinDecision(input) {
59937
+ if (input.cap <= 0)
59938
+ return "none";
59939
+ if (input.settled)
59940
+ return "none";
59941
+ if (input.streak < EARLY_STOP_SPIN_STREAK)
59942
+ return "none";
59943
+ if (input.now - input.lastStrikeAt >= SPIN_STRIKE_STALE_MS)
59944
+ return "none";
59945
+ if (!input.wrapupDelivered) {
59946
+ return input.count >= earlyFloor(input.cap) && input.count < input.cap ? "wrapup-early" : "none";
59947
+ }
59948
+ if (input.grace <= 0)
59949
+ return "none";
59950
+ if (input.wrapupDeliveredAt === undefined)
59951
+ return "none";
59952
+ if (input.lastStrikeAt <= input.wrapupDeliveredAt)
59953
+ return "none";
59954
+ if ((input.roundsSinceWrapup ?? 0) < 1)
59955
+ return "none";
59956
+ return "force-stop-early";
59957
+ }
59958
+ function ladderDecision(input) {
59959
+ if (input.cap <= 0)
59960
+ return "none";
59961
+ if (input.settled)
59962
+ return "none";
59963
+ if (!input.wrapupDelivered) {
59964
+ return input.count >= input.cap ? "wrapup" : "none";
59965
+ }
59966
+ if (input.grace <= 0)
59967
+ return "none";
59968
+ return input.count >= input.cap + input.grace ? "force-stop" : "none";
59969
+ }
59970
+ function wrapupMessage(maxRounds, grace) {
59971
+ const base = `Round limit reached (${maxRounds} LLM round-trips, set by the dsh-opentui maxRounds policy). ` + "Do NOT call any more tools. Finish this task NOW: summarize what you have accomplished so far, " + "state clearly what remains undone, and return that summary as your final answer.";
59972
+ return grace > 0 ? `${base} You have ${grace} more round${grace === 1 ? "" : "s"} before this run is force-stopped.` : base;
59973
+ }
59974
+ function wrapupMessageEarly() {
59975
+ return "This run appears to be going in circles \u2014 repeating work without forward progress, " + "as judged by the dsh-opentui attention policy. Do NOT call any more tools. Finish NOW with what you have: " + "summarize what was accomplished, state clearly what remains undone, and return that summary as your final answer. " + "If this judgment looks wrong, say so in the summary and stop.";
59976
+ }
59977
+
59978
+ class SubagentRoundPolicy {
59979
+ #options;
59980
+ #injected = new Set;
59981
+ #hardStopped = new Set;
59982
+ #resolvedCaps = new Map;
59983
+ #injectedLabel = new Map;
59984
+ #injectedRound = new Map;
59985
+ #injectedAt = new Map;
59986
+ #spinState = new Map;
59987
+ #disposed = false;
59988
+ constructor(options) {
59989
+ this.#options = options;
59990
+ }
59991
+ noteSpinVerdict(childId, score, now = Date.now()) {
59992
+ if (this.#disposed || !childId)
59993
+ return;
59994
+ if (typeof score !== "number" || !Number.isFinite(score))
59995
+ return;
59996
+ const previous = this.#spinState.get(childId) ?? { streak: 0, lastStrikeAt: 0 };
59997
+ if (score >= SPIN_HIGH_SEGMENT_AT) {
59998
+ this.#spinState.set(childId, { streak: previous.streak + 1, lastStrikeAt: now });
59999
+ } else {
60000
+ this.#spinState.set(childId, { streak: 0, lastStrikeAt: 0 });
60001
+ }
60002
+ }
60003
+ getSpinState(childId) {
60004
+ return this.#spinState.get(childId) ?? { streak: 0, lastStrikeAt: 0 };
60005
+ }
60006
+ onRoundCount(childId, count, label) {
60007
+ if (this.#disposed || !childId)
60008
+ return;
60009
+ if (this.#hardStopped.has(childId))
60010
+ return;
60011
+ const caps = this.#resolveCaps(childId, label ?? this.#injectedLabel.get(childId));
60012
+ if (caps === undefined)
60013
+ return;
60014
+ const settled = this.#options.isSettled?.(childId) ?? false;
60015
+ const spin = this.#spinState.get(childId) ?? { streak: 0, lastStrikeAt: 0 };
60016
+ const injectedRound = this.#injectedRound.get(childId);
60017
+ const spinAction = spinDecision({
60018
+ streak: spin.streak,
60019
+ lastStrikeAt: spin.lastStrikeAt,
60020
+ now: Date.now(),
60021
+ count,
60022
+ cap: caps.cap,
60023
+ grace: caps.grace,
60024
+ wrapupDelivered: this.#injected.has(childId),
60025
+ wrapupDeliveredAt: this.#injectedAt.get(childId),
60026
+ roundsSinceWrapup: injectedRound !== undefined ? count - injectedRound : undefined,
60027
+ settled
60028
+ });
60029
+ if (spinAction === "force-stop-early") {
60030
+ this.#hardStopped.add(childId);
60031
+ const reportEarlyStop = (stopped) => {
60032
+ if (!stopped)
60033
+ return;
60034
+ try {
60035
+ this.#options.onHardStop?.({ childId, round: count, cap: caps.cap, grace: caps.grace, early: true });
60036
+ } catch {}
60037
+ try {
60038
+ this.#options.onSpinStop?.(childId, count);
60039
+ } catch {}
60040
+ };
60041
+ let stoppedEarly = false;
60042
+ try {
60043
+ stoppedEarly = this.#options.forceStop(childId);
60044
+ } catch {
60045
+ stoppedEarly = false;
60046
+ }
60047
+ if (stoppedEarly instanceof Promise) {
60048
+ stoppedEarly.then(reportEarlyStop, () => {});
60049
+ } else {
60050
+ reportEarlyStop(stoppedEarly);
60051
+ }
60052
+ return;
60053
+ }
60054
+ const action = ladderDecision({
60055
+ count,
60056
+ cap: caps.cap,
60057
+ grace: caps.grace,
60058
+ wrapupDelivered: this.#injected.has(childId),
60059
+ settled
60060
+ });
60061
+ if (action === "none" && spinAction !== "wrapup-early")
60062
+ return;
60063
+ if (action === "wrapup" || spinAction === "wrapup-early") {
60064
+ if (this.#injected.has(childId))
60065
+ return;
60066
+ const rememberedLabel = label ?? this.#injectedLabel.get(childId);
60067
+ const early = spinAction === "wrapup-early";
60068
+ queueMicrotask(() => {
60069
+ if (this.#disposed || this.#injected.has(childId))
60070
+ return;
60071
+ if (this.#options.isSettled?.(childId) === true)
60072
+ return;
60073
+ let delivered = false;
60074
+ try {
60075
+ delivered = this.#options.wrapup(childId, early ? wrapupMessageEarly() : wrapupMessage(caps.cap, caps.grace), rememberedLabel);
60076
+ } catch {
60077
+ delivered = false;
60078
+ }
60079
+ const latch = (ok) => {
60080
+ if (this.#disposed || this.#injected.has(childId) || this.#hardStopped.has(childId))
60081
+ return;
60082
+ if (!ok)
60083
+ return;
60084
+ this.#injected.add(childId);
60085
+ if (rememberedLabel !== undefined)
60086
+ this.#injectedLabel.set(childId, rememberedLabel);
60087
+ this.#injectedRound.set(childId, count);
60088
+ this.#injectedAt.set(childId, Date.now());
60089
+ try {
60090
+ this.#options.onWrapUp?.(childId, count);
60091
+ } catch {}
60092
+ };
60093
+ if (delivered instanceof Promise) {
60094
+ delivered.then(latch, () => {});
60095
+ return;
60096
+ }
60097
+ latch(delivered);
60098
+ });
60099
+ return;
60100
+ }
60101
+ this.#hardStopped.add(childId);
60102
+ const reportStop = (stopped) => {
60103
+ if (!stopped)
60104
+ return;
60105
+ try {
60106
+ this.#options.onHardStop?.({ childId, round: count, cap: caps.cap, grace: caps.grace });
60107
+ } catch {}
60108
+ try {
60109
+ this.#options.onForceStop?.(childId, count);
60110
+ } catch {}
60111
+ };
60112
+ let stopped = false;
60113
+ try {
60114
+ stopped = this.#options.forceStop(childId);
60115
+ } catch {
60116
+ stopped = false;
60117
+ }
60118
+ if (stopped instanceof Promise) {
60119
+ stopped.then(reportStop, () => {});
60120
+ } else {
60121
+ reportStop(stopped);
60122
+ }
60123
+ }
60124
+ #resolveCaps(childId, label) {
60125
+ const cached = this.#resolvedCaps.get(childId);
60126
+ if (cached !== undefined)
60127
+ return cached;
60128
+ const limits = this.#options.limits();
60129
+ const globalCap = limits.maxRounds;
60130
+ if (globalCap <= 0)
60131
+ return;
60132
+ let cap = globalCap;
60133
+ if (label !== undefined && this.#options.resolveAgentCap !== undefined) {
60134
+ try {
60135
+ const perAgent = this.#options.resolveAgentCap(label);
60136
+ if (perAgent !== undefined && perAgent > 0)
60137
+ cap = perAgent;
60138
+ } catch {}
60139
+ }
60140
+ const caps = { cap, grace: limits.maxRoundsGrace };
60141
+ this.#resolvedCaps.set(childId, caps);
60142
+ return caps;
60143
+ }
60144
+ forgetChild(childId) {
60145
+ this.#injected.delete(childId);
60146
+ this.#hardStopped.delete(childId);
60147
+ this.#resolvedCaps.delete(childId);
60148
+ this.#injectedLabel.delete(childId);
60149
+ this.#injectedRound.delete(childId);
60150
+ this.#injectedAt.delete(childId);
60151
+ this.#spinState.delete(childId);
60152
+ }
60153
+ dispose() {
60154
+ this.#disposed = true;
60155
+ this.#injected.clear();
60156
+ this.#hardStopped.clear();
60157
+ this.#resolvedCaps.clear();
60158
+ this.#injectedLabel.clear();
60159
+ this.#injectedRound.clear();
60160
+ this.#injectedAt.clear();
60161
+ this.#spinState.clear();
60162
+ }
60163
+ }
60164
+ var DEFAULT_MAX_ROUNDS2 = 50, DEFAULT_SUBAGENT_ROUND_LIMITS, SPIN_HIGH_SEGMENT_AT = 0.75, SPIN_STRIKE_STALE_MS = 90000, EARLY_STOP_SPIN_STREAK = 2;
60165
+ var init_subagent_policy = __esm(() => {
60166
+ DEFAULT_SUBAGENT_ROUND_LIMITS = { maxRounds: DEFAULT_MAX_ROUNDS2, maxRoundsGrace: 0 };
60167
+ });
60168
+
59382
60169
  // src/client/bridge-session-seam.ts
59383
60170
  import { existsSync as existsSync8, readFileSync as readFileSync9, readdirSync as readdirSync4 } from "fs";
59384
60171
  import { join as join10 } from "path";
@@ -59515,6 +60302,177 @@ function accountClientMeta() {
59515
60302
  timezoneOffsetSeconds: -new Date().getTimezoneOffset() * 60
59516
60303
  };
59517
60304
  }
60305
+ function projectBridgePrunePlan(value) {
60306
+ const record = asRecord12(value);
60307
+ if (!Array.isArray(record.entries)) {
60308
+ throw new BridgeProtocolError("INTERNAL", "session.prune.plan returned no entries array");
60309
+ }
60310
+ const entries = [];
60311
+ for (const raw of record.entries) {
60312
+ const row = asRecord12(raw);
60313
+ if (typeof row.sessionId !== "string" || row.decision !== "prune" && row.decision !== "skip")
60314
+ continue;
60315
+ const entry = { sessionId: row.sessionId, decision: row.decision };
60316
+ if (typeof row.reason === "string")
60317
+ entry.reason = row.reason;
60318
+ if (typeof row.location === "string")
60319
+ entry.location = row.location;
60320
+ if (typeof row.ageDays === "number" && Number.isFinite(row.ageDays))
60321
+ entry.ageDays = row.ageDays;
60322
+ entries.push(entry);
60323
+ }
60324
+ if (typeof record.generatedAt !== "number" || !Number.isFinite(record.generatedAt)) {
60325
+ throw new BridgeProtocolError("INTERNAL", "session.prune.plan returned no valid generatedAt");
60326
+ }
60327
+ if (typeof record.retentionDays !== "number" || !Number.isFinite(record.retentionDays)) {
60328
+ throw new BridgeProtocolError("INTERNAL", "session.prune.plan returned no valid retentionDays");
60329
+ }
60330
+ const countsRaw = record.counts;
60331
+ if (countsRaw === null || typeof countsRaw !== "object" || Array.isArray(countsRaw) || typeof countsRaw.prune !== "number" || typeof countsRaw.skip !== "number" || countsRaw.byReason === null || typeof countsRaw.byReason !== "object" || Array.isArray(countsRaw.byReason)) {
60332
+ throw new BridgeProtocolError("INTERNAL", "session.prune.plan returned no valid counts");
60333
+ }
60334
+ const byReason = {};
60335
+ let prune = 0;
60336
+ let skip = 0;
60337
+ for (const entry of entries) {
60338
+ if (entry.decision === "prune") {
60339
+ prune += 1;
60340
+ } else {
60341
+ skip += 1;
60342
+ const reason = entry.reason ?? "unknown";
60343
+ byReason[reason] = (byReason[reason] ?? 0) + 1;
60344
+ }
60345
+ }
60346
+ return {
60347
+ generatedAt: record.generatedAt,
60348
+ retentionDays: record.retentionDays,
60349
+ entries,
60350
+ counts: { prune, skip, byReason },
60351
+ ...typeof record.fingerprint === "string" ? { fingerprint: record.fingerprint } : {},
60352
+ ...typeof record.configFingerprint === "string" ? { configFingerprint: record.configFingerprint } : {}
60353
+ };
60354
+ }
60355
+ function projectBridgePruneApply(value) {
60356
+ const record = asRecord12(value);
60357
+ if (typeof record.opId !== "string" || record.opId === "") {
60358
+ throw new BridgeProtocolError("INTERNAL", "session.prune.apply returned no valid opId");
60359
+ }
60360
+ if (!Array.isArray(record.applied) || !Array.isArray(record.failed)) {
60361
+ throw new BridgeProtocolError("INTERNAL", "session.prune.apply returned no applied/failed arrays");
60362
+ }
60363
+ const applied = [];
60364
+ for (const raw of record.applied) {
60365
+ const row = asRecord12(raw);
60366
+ if (typeof row.id === "string" && row.id !== "")
60367
+ applied.push({ id: row.id });
60368
+ }
60369
+ const failed = [];
60370
+ for (const raw of record.failed) {
60371
+ const row = asRecord12(raw);
60372
+ if (typeof row.id !== "string" || typeof row.code !== "string" || typeof row.message !== "string")
60373
+ continue;
60374
+ failed.push({ id: row.id, code: row.code, message: row.message.slice(0, 300) });
60375
+ }
60376
+ return {
60377
+ opId: record.opId,
60378
+ applied,
60379
+ failed,
60380
+ markedOrphans: Array.isArray(record.markedOrphans) ? record.markedOrphans.length : 0
60381
+ };
60382
+ }
60383
+ function projectBridgePurgePrepare(value) {
60384
+ const record = asRecord12(value);
60385
+ if (typeof record.opId !== "string" || typeof record.token !== "string" || record.token === "") {
60386
+ throw new BridgeProtocolError("INTERNAL", "session.prune.purge prepare returned no opId/token");
60387
+ }
60388
+ if (!Array.isArray(record.candidates) || !Array.isArray(record.rejected)) {
60389
+ throw new BridgeProtocolError("INTERNAL", "session.prune.purge prepare returned no candidates/rejected arrays");
60390
+ }
60391
+ const candidates = [];
60392
+ for (const raw of record.candidates) {
60393
+ const row = asRecord12(raw);
60394
+ if (typeof row.id !== "string" || row.id === "")
60395
+ continue;
60396
+ if (typeof row.ageDays !== "number" || !Number.isFinite(row.ageDays))
60397
+ continue;
60398
+ if (typeof row.appliedAt !== "number" || !Number.isFinite(row.appliedAt))
60399
+ continue;
60400
+ candidates.push({ id: row.id, ageDays: row.ageDays, appliedAt: row.appliedAt });
60401
+ }
60402
+ const rejected = [];
60403
+ for (const raw of record.rejected) {
60404
+ const row = asRecord12(raw);
60405
+ if (typeof row.code !== "string" || typeof row.message !== "string")
60406
+ continue;
60407
+ rejected.push({
60408
+ ...typeof row.id === "string" ? { id: row.id } : {},
60409
+ code: row.code,
60410
+ message: row.message.slice(0, 300)
60411
+ });
60412
+ }
60413
+ return { opId: record.opId, token: record.token, candidates, rejected };
60414
+ }
60415
+ function projectBridgePurgeCommit(value) {
60416
+ const record = asRecord12(value);
60417
+ if (typeof record.opId !== "string" || record.opId === "") {
60418
+ throw new BridgeProtocolError("INTERNAL", "session.prune.purge commit returned no valid opId");
60419
+ }
60420
+ if (!Array.isArray(record.purged) || !Array.isArray(record.failed)) {
60421
+ throw new BridgeProtocolError("INTERNAL", "session.prune.purge commit returned no purged/failed arrays");
60422
+ }
60423
+ const purged = [];
60424
+ for (const raw of record.purged) {
60425
+ const row = asRecord12(raw);
60426
+ if (typeof row.id === "string" && row.id !== "")
60427
+ purged.push({ id: row.id });
60428
+ }
60429
+ const failed = [];
60430
+ for (const raw of record.failed) {
60431
+ const row = asRecord12(raw);
60432
+ if (typeof row.code !== "string" || typeof row.message !== "string")
60433
+ continue;
60434
+ failed.push({
60435
+ ...typeof row.id === "string" ? { id: row.id } : {},
60436
+ code: row.code,
60437
+ message: row.message.slice(0, 300)
60438
+ });
60439
+ }
60440
+ return { opId: record.opId, purged, failed };
60441
+ }
60442
+ function projectBridgePruneRestoreList(value) {
60443
+ const record = asRecord12(value);
60444
+ if (!Array.isArray(record.entries) || !Array.isArray(record.rejected)) {
60445
+ throw new BridgeProtocolError("INTERNAL", "session.prune.restore list returned no entries/rejected arrays");
60446
+ }
60447
+ const entries = [];
60448
+ for (const raw of record.entries) {
60449
+ const row = asRecord12(raw);
60450
+ if (typeof row.id !== "string" || row.id === "")
60451
+ continue;
60452
+ if (typeof row.movedAt !== "number" || !Number.isFinite(row.movedAt))
60453
+ continue;
60454
+ entries.push({
60455
+ id: row.id,
60456
+ movedAt: row.movedAt,
60457
+ ...typeof row.size === "number" && Number.isFinite(row.size) && row.size > 0 ? { size: row.size } : {}
60458
+ });
60459
+ }
60460
+ const rejected = [];
60461
+ for (const raw of record.rejected) {
60462
+ const row = asRecord12(raw);
60463
+ if (typeof row.code !== "string" || typeof row.message !== "string")
60464
+ continue;
60465
+ rejected.push({ code: row.code, message: row.message.slice(0, 300) });
60466
+ }
60467
+ return { entries, rejected };
60468
+ }
60469
+ function projectBridgePruneRestore(value) {
60470
+ const record = asRecord12(value);
60471
+ if (typeof record.id !== "string" || record.id === "" || record.restored !== true || typeof record.opId !== "string" || record.opId === "") {
60472
+ throw new BridgeProtocolError("INTERNAL", "session.prune.restore returned no valid id/restored/opId");
60473
+ }
60474
+ return { id: record.id, restored: true, opId: record.opId };
60475
+ }
59518
60476
  function unsupported(capability) {
59519
60477
  throw new BridgeProtocolError("UNSUPPORTED", `${capability} is not backed by the in-process bridge`, { capability });
59520
60478
  }
@@ -60116,6 +61074,52 @@ function bridgeReplayRowsToChildLog(rows) {
60116
61074
  return row.text;
60117
61075
  }).filter((line) => line !== "");
60118
61076
  }
61077
+ function childTranscriptBytes(line) {
61078
+ return childTextEncoder.encode(line).length;
61079
+ }
61080
+ function childTranscriptTruncate(line) {
61081
+ const bytes = childTextEncoder.encode(line);
61082
+ if (bytes.length <= CHILD_TRANSCRIPT_LINE_BUDGET)
61083
+ return line;
61084
+ const cutBudget = CHILD_TRANSCRIPT_LINE_BUDGET - CHILD_TRANSCRIPT_TRUNCATION_MARKER_BYTES;
61085
+ for (let end = cutBudget;end > 0; end -= 1) {
61086
+ try {
61087
+ return childStrictTextDecoder.decode(bytes.slice(0, end)) + CHILD_TRANSCRIPT_TRUNCATION_MARKER;
61088
+ } catch {}
61089
+ }
61090
+ return CHILD_TRANSCRIPT_TRUNCATION_MARKER;
61091
+ }
61092
+ function capChildLog(lines) {
61093
+ const out = lines.map((line) => childTranscriptTruncate(line));
61094
+ let bytes = out.reduce((total, line) => total + childTranscriptBytes(line) + 1, 0);
61095
+ while (out.length > CHILD_TRANSCRIPT_MAX_LINES || out.length > 0 && bytes > CHILD_TRANSCRIPT_MAX_BYTES) {
61096
+ const dropped = out.shift();
61097
+ bytes -= childTranscriptBytes(dropped) + 1;
61098
+ }
61099
+ return out;
61100
+ }
61101
+ function childTranscriptRowToLine(row) {
61102
+ const r = asRecord12(row);
61103
+ if (r.kind !== "assistant" && r.kind !== "tool")
61104
+ return "";
61105
+ const text = typeof r.text === "string" ? r.text : "";
61106
+ const output = typeof r.output === "string" ? r.output : "";
61107
+ if (r.kind === "tool")
61108
+ return output !== "" ? `\u25B6 ${text}
61109
+ \u23BF ${output}` : `\u25B6 ${text}`;
61110
+ return text;
61111
+ }
61112
+ function splitChildLogLines(lines) {
61113
+ const out = [];
61114
+ for (const line of lines) {
61115
+ for (const part of line.split(`
61116
+ `)) {
61117
+ if (part !== "")
61118
+ out.push(part);
61119
+ }
61120
+ }
61121
+ return out;
61122
+ }
60119
61123
  function bridgeChildStopReason(rows) {
60120
61124
  for (let i = rows.length - 1;i >= 0; i -= 1) {
60121
61125
  const row = rows[i];
@@ -60625,10 +61629,14 @@ class BridgeSessionSeam {
60625
61629
  #subagentLiveStarts = new Set;
60626
61630
  #subagentListeners = new Set;
60627
61631
  #subagentProgress = new Map;
61632
+ #roundPolicy;
60628
61633
  #subagentSessionId;
60629
61634
  #subagentJournalLoaded = new Set;
60630
61635
  #subagentJournalMeta = new Map;
60631
61636
  #subagentTranscripts = new Map;
61637
+ #subagentTranscriptRuns = new Map;
61638
+ #subagentTranscriptSettled = new Set;
61639
+ #subagentTranscriptReadFailed = new Set;
60632
61640
  #sweepSettledRuns = new Map;
60633
61641
  #subagentSettleSnapshots = new Map;
60634
61642
  #interruptInFlight = new Map;
@@ -61266,6 +62274,17 @@ class BridgeSessionSeam {
61266
62274
  subagentTranscript(id) {
61267
62275
  return [...this.#subagentTranscripts.get(id) ?? []];
61268
62276
  }
62277
+ subagentTranscriptStatus(id) {
62278
+ const lines = this.#subagentTranscripts.get(id);
62279
+ if (lines !== undefined && lines.length > 0)
62280
+ return "ready";
62281
+ if (this.#subagentTranscriptReadFailed.has(id))
62282
+ return "read-failed";
62283
+ const view = this.#subagentViews.get(id);
62284
+ if (view === undefined || view.status !== "running")
62285
+ return "not-running";
62286
+ return "pending";
62287
+ }
61269
62288
  steerChild(id, text) {
61270
62289
  const view = this.#subagentViews.get(id);
61271
62290
  if (view === undefined || view.status !== "running")
@@ -61388,6 +62407,7 @@ class BridgeSessionSeam {
61388
62407
  const view = this.#subagentViews.get(childId);
61389
62408
  if (view === undefined || view.status === "running")
61390
62409
  continue;
62410
+ this.#roundPolicy?.forgetChild(childId);
61391
62411
  if (view.elapsedSec === undefined || view.endedAt === undefined)
61392
62412
  continue;
61393
62413
  const runKey = `${childId}@${startedAt ?? ""}`;
@@ -61468,13 +62488,17 @@ class BridgeSessionSeam {
61468
62488
  try {
61469
62489
  const value = asRecord12(await this.#transport.request("journal.replay", { sessionId: childId }));
61470
62490
  const rows = value.rows;
61471
- if (!Array.isArray(rows))
62491
+ if (!Array.isArray(rows)) {
62492
+ this.#subagentTranscriptReadFailed.add(childId);
61472
62493
  return;
62494
+ }
61473
62495
  const cleanRows = rows.filter((row) => row !== null && typeof row === "object" && !Array.isArray(row));
61474
62496
  const meta = bridgeChildJournalMeta(cleanRows);
61475
62497
  if (this.#subagentSessionId !== sessionAtStart || this.#disposed)
61476
62498
  return;
61477
- this.#subagentTranscripts.set(childId, bridgeReplayRowsToChildLog(cleanRows));
62499
+ this.#subagentTranscripts.set(childId, capChildLog(splitChildLogLines(bridgeReplayRowsToChildLog(cleanRows))));
62500
+ this.#subagentTranscriptReadFailed.delete(childId);
62501
+ this.#subagentTranscriptRuns.delete(childId);
61478
62502
  this.#subagentJournalMeta.set(key, meta);
61479
62503
  const existing = this.#subagentViews.get(childId);
61480
62504
  if (existing === undefined || bridgeChildJournalKey(existing) !== key)
@@ -61486,7 +62510,9 @@ class BridgeSessionSeam {
61486
62510
  ...meta.model !== undefined ? { model: meta.model } : {}
61487
62511
  });
61488
62512
  this.#emitSubagentViews();
61489
- } catch {}
62513
+ } catch {
62514
+ this.#subagentTranscriptReadFailed.add(childId);
62515
+ }
61490
62516
  }
61491
62517
  #syncSubagentMeta(emit = true) {
61492
62518
  let changed = false;
@@ -61587,10 +62613,21 @@ class BridgeSessionSeam {
61587
62613
  if (frame.type === "agent.spawn") {
61588
62614
  const runId = typeof payload.runId === "string" ? payload.runId : "";
61589
62615
  const childId = typeof payload.childId === "string" ? payload.childId : "";
62616
+ if (childId !== "") {
62617
+ this.#subagentTranscriptRuns.delete(childId);
62618
+ this.#subagentTranscriptSettled.delete(childId);
62619
+ this.#subagentTranscriptReadFailed.delete(childId);
62620
+ }
62621
+ if (this.#subagentSessionId === undefined && frameSession !== "") {
62622
+ this.#subagentSessionId = frameSession;
62623
+ }
61590
62624
  changed = runId === `${BRIDGE_CATALOG_RUN_PREFIX}${childId}` ? this.#foldWithFrozenSettle(BRIDGE_SUBAGENT_CATALOG, payload, now, true) : this.#foldWithFrozenSettle(BRIDGE_AGENT_START, payload, now, true);
61591
62625
  } else if (frame.type === "agent.settle") {
61592
62626
  const childId = typeof payload.childId === "string" ? payload.childId : "";
61593
62627
  const existing = childId !== "" ? this.#subagentViews.get(childId) : undefined;
62628
+ const lockedChild = childId !== "" ? childId : this.#subagentRunSeq.get(bridgeAgentRunKey(typeof payload.runId === "string" ? payload.runId : "", typeof payload.seq === "number" ? payload.seq : -1));
62629
+ if (lockedChild !== undefined)
62630
+ this.#subagentTranscriptSettled.add(lockedChild);
61594
62631
  if (existing !== undefined && existing.status === "running") {
61595
62632
  if (this.#subagentSessionId === undefined && frameSession !== "") {
61596
62633
  this.#subagentSessionId = frameSession;
@@ -61604,6 +62641,41 @@ class BridgeSessionSeam {
61604
62641
  this.#emitSubagentViews();
61605
62642
  }
61606
62643
  }
62644
+ #ensureRoundPolicy() {
62645
+ if (this.#roundPolicy === undefined) {
62646
+ this.#roundPolicy = new SubagentRoundPolicy({
62647
+ limits: () => parseSubagentRoundLimits(this.configLoad()),
62648
+ isSettled: (childId) => {
62649
+ const view = this.#subagentViews.get(childId);
62650
+ return view === undefined || view.status !== "running";
62651
+ },
62652
+ wrapup: (childId, message) => this.steerChild(childId, message),
62653
+ forceStop: (childId) => this.interruptChild(childId).then(() => true, () => false),
62654
+ onWrapUp: (childId, round) => this.#markRoundPolicy(childId, "injectedRound", round),
62655
+ onForceStop: (childId, round) => this.#markRoundPolicy(childId, "hardStopRound", round),
62656
+ onSpinStop: (childId, round) => this.#markRoundPolicy(childId, "spinStopRound", round)
62657
+ });
62658
+ }
62659
+ return this.#roundPolicy;
62660
+ }
62661
+ #resetRoundPolicy() {
62662
+ this.#roundPolicy?.dispose();
62663
+ this.#roundPolicy = undefined;
62664
+ }
62665
+ #markRoundPolicy(childId, field, round) {
62666
+ const view = this.#subagentViews.get(childId);
62667
+ if (view === undefined || view[field] !== undefined)
62668
+ return;
62669
+ const next = { ...view };
62670
+ if (field === "injectedRound")
62671
+ next.injectedRound = round;
62672
+ else if (field === "hardStopRound")
62673
+ next.hardStopRound = round;
62674
+ else
62675
+ next.spinStopRound = round;
62676
+ this.#subagentViews.set(childId, next);
62677
+ this.#emitSubagentViews();
62678
+ }
61607
62679
  #foldAgentProgress(frame) {
61608
62680
  const payload = asRecord12(frame.payload);
61609
62681
  const frameSession = typeof payload.sessionId === "string" ? payload.sessionId : "";
@@ -61619,14 +62691,56 @@ class BridgeSessionSeam {
61619
62691
  const lastLine = typeof payload.lastLine === "string" ? payload.lastLine : undefined;
61620
62692
  const elapsedSec = typeof payload.elapsedSec === "number" && Number.isFinite(payload.elapsedSec) ? payload.elapsedSec : undefined;
61621
62693
  const prev = this.#subagentProgress.get(childId);
61622
- this.#subagentProgress.set(childId, {
62694
+ const merged = {
61623
62695
  rounds: Math.max(prev?.rounds ?? 0, rounds),
61624
62696
  ...lastLine !== undefined ? { lastLine } : prev?.lastLine !== undefined ? { lastLine: prev.lastLine } : {},
61625
62697
  ...elapsedSec !== undefined ? { elapsedSec } : prev?.elapsedSec !== undefined ? { elapsedSec: prev.elapsedSec } : {}
61626
- });
62698
+ };
62699
+ this.#subagentProgress.set(childId, merged);
62700
+ if (merged.rounds > (prev?.rounds ?? 0)) {
62701
+ this.#ensureRoundPolicy().onRoundCount(childId, merged.rounds, view.label);
62702
+ }
61627
62703
  this.#syncSubagentMeta(false);
61628
62704
  this.#emitSubagentViews();
61629
62705
  }
62706
+ #foldAgentTranscript(frame) {
62707
+ const payload = asRecord12(frame.payload);
62708
+ const frameSession = typeof payload.sessionId === "string" ? payload.sessionId : "";
62709
+ const childId = typeof payload.childId === "string" ? payload.childId : "";
62710
+ const turnId = typeof payload.turnId === "string" ? payload.turnId : "";
62711
+ const runId = typeof payload.runId === "string" && payload.runId !== "" ? payload.runId : turnId;
62712
+ const seq = typeof payload.seq === "number" && Number.isFinite(payload.seq) ? payload.seq : -1;
62713
+ const rows = payload.rows;
62714
+ if (childId === "" || turnId === "" || seq < 0 || !Array.isArray(rows))
62715
+ return;
62716
+ if (this.#subagentTranscriptSettled.has(childId))
62717
+ return;
62718
+ const view = this.#subagentViews.get(childId);
62719
+ if (view === undefined || view.status !== "running")
62720
+ return;
62721
+ if (this.#subagentSessionId === undefined) {
62722
+ if (frameSession !== "")
62723
+ this.#subagentSessionId = frameSession;
62724
+ } else if (frameSession !== "" && frameSession !== this.#subagentSessionId)
62725
+ return;
62726
+ let run = this.#subagentTranscriptRuns.get(childId);
62727
+ if (run === undefined || run.runId !== runId) {
62728
+ run = { runId, seen: new Set };
62729
+ this.#subagentTranscriptRuns.set(childId, run);
62730
+ }
62731
+ if (run.seen.has(seq))
62732
+ return;
62733
+ run.seen.add(seq);
62734
+ const lines = [...this.#subagentTranscripts.get(childId) ?? []];
62735
+ for (const row of rows) {
62736
+ const line = childTranscriptRowToLine(row);
62737
+ if (line !== "")
62738
+ lines.push(line);
62739
+ }
62740
+ this.#subagentTranscripts.set(childId, capChildLog(splitChildLogLines(lines)));
62741
+ this.#subagentTranscriptReadFailed.delete(childId);
62742
+ this.#emitSubagentViews();
62743
+ }
61630
62744
  #foldAgentReplayRows(rows, sessionId) {
61631
62745
  let rosterReset = false;
61632
62746
  if (sessionId !== this.#subagentSessionId) {
@@ -61634,9 +62748,13 @@ class BridgeSessionSeam {
61634
62748
  this.#subagentRunSeq.clear();
61635
62749
  this.#subagentLiveStarts.clear();
61636
62750
  this.#subagentProgress.clear();
62751
+ this.#resetRoundPolicy();
61637
62752
  this.#subagentJournalLoaded.clear();
61638
62753
  this.#subagentJournalMeta.clear();
61639
62754
  this.#subagentTranscripts.clear();
62755
+ this.#subagentTranscriptRuns.clear();
62756
+ this.#subagentTranscriptSettled.clear();
62757
+ this.#subagentTranscriptReadFailed.clear();
61640
62758
  this.#sweepSettledRuns.clear();
61641
62759
  this.#subagentSettleSnapshots.clear();
61642
62760
  this.#interruptInFlight.clear();
@@ -61684,6 +62802,44 @@ class BridgeSessionSeam {
61684
62802
  const value = await this.#transport.request("session.list");
61685
62803
  return projectBridgeSessionList(asRecord12(value).items, limit);
61686
62804
  }
62805
+ async planPrune(params) {
62806
+ const staged = this.stagedSessionId();
62807
+ const ids = new Set(params?.stagedIds ?? []);
62808
+ if (staged !== undefined && staged !== "")
62809
+ ids.add(staged);
62810
+ const wireParams = ids.size > 0 ? { ...params ?? {}, stagedIds: [...ids] } : { ...params ?? {} };
62811
+ const value = await this.#transport.request("session.prune.plan", wireParams);
62812
+ return projectBridgePrunePlan(value);
62813
+ }
62814
+ async applyPrune(params) {
62815
+ const staged = this.stagedSessionId();
62816
+ const ids = new Set(params.stagedIds ?? []);
62817
+ if (staged !== undefined && staged !== "")
62818
+ ids.add(staged);
62819
+ const value = await this.#transport.request("session.prune.apply", {
62820
+ fingerprint: params.fingerprint,
62821
+ configFingerprint: params.configFingerprint,
62822
+ generatedAt: params.generatedAt,
62823
+ ...ids.size > 0 ? { stagedIds: [...ids] } : {}
62824
+ });
62825
+ return projectBridgePruneApply(value);
62826
+ }
62827
+ async preparePurge() {
62828
+ const value = await this.#transport.request("session.prune.purge", { phase: "prepare" });
62829
+ return projectBridgePurgePrepare(value);
62830
+ }
62831
+ async commitPurge(params) {
62832
+ const value = await this.#transport.request("session.prune.purge", { phase: "commit", token: params.token });
62833
+ return projectBridgePurgeCommit(value);
62834
+ }
62835
+ async listPruneRestore() {
62836
+ const value = await this.#transport.request("session.prune.restore", { phase: "list" });
62837
+ return projectBridgePruneRestoreList(value);
62838
+ }
62839
+ async restorePrune(id) {
62840
+ const value = await this.#transport.request("session.prune.restore", { phase: "restore", id });
62841
+ return projectBridgePruneRestore(value);
62842
+ }
61687
62843
  async cwd() {
61688
62844
  const sessionId = this.currentSessionId();
61689
62845
  if (sessionId === undefined || sessionId === "")
@@ -61935,8 +63091,13 @@ class BridgeSessionSeam {
61935
63091
  this.#subagentRunSeq.clear();
61936
63092
  this.#subagentLiveStarts.clear();
61937
63093
  this.#subagentProgress.clear();
63094
+ this.#resetRoundPolicy();
61938
63095
  this.#subagentJournalLoaded.clear();
61939
63096
  this.#subagentJournalMeta.clear();
63097
+ this.#subagentTranscripts.clear();
63098
+ this.#subagentTranscriptRuns.clear();
63099
+ this.#subagentTranscriptSettled.clear();
63100
+ this.#subagentTranscriptReadFailed.clear();
61940
63101
  this.#sweepSettledRuns.clear();
61941
63102
  this.#subagentSettleSnapshots.clear();
61942
63103
  this.#interruptInFlight.clear();
@@ -62331,6 +63492,10 @@ class BridgeSessionSeam {
62331
63492
  this.#foldAgentProgress(frame);
62332
63493
  return;
62333
63494
  }
63495
+ if (frame.type === "agent.transcript") {
63496
+ this.#foldAgentTranscript(frame);
63497
+ return;
63498
+ }
62334
63499
  if (frame.type === "bridge.dead") {
62335
63500
  const cause = asDeadCause(frame.payload);
62336
63501
  if (this.#inFlightGeneration !== 0 && this.#inFlightTurnId !== undefined && this.#inFlightTurnId !== "") {
@@ -62431,7 +63596,7 @@ class BridgeSessionSeam {
62431
63596
  }
62432
63597
  }
62433
63598
  }
62434
- var CONFIRM_REQUIRED = (method) => new BridgeProtocolError("CONFIRM_REQUIRED", `${method}: write requires a confirmed TUI modal token`), BridgeProtocolError, ACCOUNT_STATUSES, ACCOUNT_PHASES, ROUTE_ROW_TYPES, BRIDGE_AGENT_START = "tool-workflow/agent-start", BRIDGE_AGENT_END = "tool-workflow/agent-end", BRIDGE_SUBAGENT_CATALOG = "subagent/catalog", BRIDGE_SUBAGENT_SETTLED = "subagent-settled", BRIDGE_CATALOG_RUN_PREFIX = "catalog:", CONFIRM_POLL_INITIAL_MS = 250, CONFIRM_POLL_MAX_MS = 1000, CONFIRM_TIMEOUT_MS = 45000, fmtTokens = (n) => n >= 1000 ? `${(n / 1000).toFixed(1)}k` : `${n}`;
63599
+ var CONFIRM_REQUIRED = (method) => new BridgeProtocolError("CONFIRM_REQUIRED", `${method}: write requires a confirmed TUI modal token`), BridgeProtocolError, ACCOUNT_STATUSES, ACCOUNT_PHASES, ROUTE_ROW_TYPES, BRIDGE_AGENT_START = "tool-workflow/agent-start", BRIDGE_AGENT_END = "tool-workflow/agent-end", BRIDGE_SUBAGENT_CATALOG = "subagent/catalog", BRIDGE_SUBAGENT_SETTLED = "subagent-settled", BRIDGE_CATALOG_RUN_PREFIX = "catalog:", CHILD_TRANSCRIPT_MAX_LINES = 500, CHILD_TRANSCRIPT_MAX_BYTES, childTextEncoder, childStrictTextDecoder, CHILD_TRANSCRIPT_LINE_BUDGET, CHILD_TRANSCRIPT_TRUNCATION_MARKER = "\u2026", CHILD_TRANSCRIPT_TRUNCATION_MARKER_BYTES, CONFIRM_POLL_INITIAL_MS = 250, CONFIRM_POLL_MAX_MS = 1000, CONFIRM_TIMEOUT_MS = 45000, fmtTokens = (n) => n >= 1000 ? `${(n / 1000).toFixed(1)}k` : `${n}`;
62435
63600
  var init_bridge_session_seam = __esm(() => {
62436
63601
  init_remote_session_ops();
62437
63602
  init_journal_projection();
@@ -62443,6 +63608,7 @@ var init_bridge_session_seam = __esm(() => {
62443
63608
  init_profile_constants();
62444
63609
  init_bridge_goals();
62445
63610
  init_bridge_settings_route();
63611
+ init_subagent_policy();
62446
63612
  BridgeProtocolError = class BridgeProtocolError extends Error {
62447
63613
  code;
62448
63614
  detail;
@@ -62466,6 +63632,11 @@ var init_bridge_session_seam = __esm(() => {
62466
63632
  "failed"
62467
63633
  ]);
62468
63634
  ROUTE_ROW_TYPES = new Set(["model/selection", "request/header", "request/context"]);
63635
+ CHILD_TRANSCRIPT_MAX_BYTES = 64 * 1024;
63636
+ childTextEncoder = new TextEncoder;
63637
+ childStrictTextDecoder = new TextDecoder("utf-8", { fatal: true });
63638
+ CHILD_TRANSCRIPT_LINE_BUDGET = CHILD_TRANSCRIPT_MAX_BYTES - 1;
63639
+ CHILD_TRANSCRIPT_TRUNCATION_MARKER_BYTES = childTextEncoder.encode(CHILD_TRANSCRIPT_TRUNCATION_MARKER).length;
62469
63640
  });
62470
63641
 
62471
63642
  // scripts/lib/bridge-failfast-text.mjs
@@ -62828,6 +63999,17 @@ function V2SessionPageBody(props) {
62828
63999
  showNotice(pendingAgentsHomeNotice);
62829
64000
  pendingAgentsHomeNotice = undefined;
62830
64001
  }
64002
+ let pruneNoticeDisposed = false;
64003
+ onCleanup(() => {
64004
+ pruneNoticeDisposed = true;
64005
+ });
64006
+ if (seam.planPrune) {
64007
+ seam.planPrune().then((plan) => {
64008
+ if (pruneNoticeDisposed || plan.counts.prune <= 0)
64009
+ return;
64010
+ showNotice(t("notice.prune.available", { n: String(plan.counts.prune) }));
64011
+ }).catch(() => {});
64012
+ }
62831
64013
  const timer = setInterval(() => setNow(new Date), 1000);
62832
64014
  onCleanup(() => clearInterval(timer));
62833
64015
  });
@@ -62838,6 +64020,7 @@ function V2SessionPageBody(props) {
62838
64020
  turnAborted = false;
62839
64021
  setTurnBusy(true);
62840
64022
  setLastRequest(text);
64023
+ transcriptScroll?.scrollTo(Infinity);
62841
64024
  const done = projection.send(text);
62842
64025
  done.finally(() => setTurnBusy(false));
62843
64026
  return done;
@@ -63308,6 +64491,9 @@ function V2SessionPageBody(props) {
63308
64491
  createComponent2(Transcript, {
63309
64492
  seam,
63310
64493
  projection,
64494
+ get scrollbar() {
64495
+ return resolveSessionScrollbar(seam.workspaceConfig?.(), seam.configRaw?.(), seam.configLoad?.());
64496
+ },
63311
64497
  focused: paneFocus.transcriptFocused,
63312
64498
  scrollRef: (value) => transcriptScroll = value,
63313
64499
  widgets: createComponent2(WidgetsDock, {
@@ -63643,6 +64829,7 @@ var init_v2_entry = __esm(() => {
63643
64829
  init_subagents_viewer();
63644
64830
  init_settings_modal();
63645
64831
  init_btw_overlay();
64832
+ init_config2();
63646
64833
  init_dialog_select();
63647
64834
  init_dialog_prompt();
63648
64835
  init_dialog_confirm();
@@ -63977,5 +65164,5 @@ if (import.meta.main) {
63977
65164
  main();
63978
65165
  }
63979
65166
 
63980
- //# debugId=DAD2522A36CE287C64756E2164756E21
65167
+ //# debugId=2A5F7C9D91CE94DC64756E2164756E21
63981
65168
  //# sourceMappingURL=index.js.map