@aiwayds/dsh-opentui 0.7.0 → 0.8.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.
@@ -5065,6 +5065,14 @@ function parseSubagentRoundLimits(value) {
5065
5065
  maxRoundsGrace: maxRoundsGrace ?? DEFAULT_SUBAGENT_ROUND_LIMITS.maxRoundsGrace
5066
5066
  };
5067
5067
  }
5068
+ function bareAgentLabel(label) {
5069
+ const trimmed = label.trim();
5070
+ for (const prefix of FOREGROUND_LABEL_PREFIXES) {
5071
+ if (trimmed.startsWith(prefix))
5072
+ return trimmed.slice(prefix.length).trim();
5073
+ }
5074
+ return trimmed;
5075
+ }
5068
5076
  function earlyFloor(cap) {
5069
5077
  return Math.max(10, Math.floor(cap / 3));
5070
5078
  }
@@ -5273,9 +5281,10 @@ class SubagentRoundPolicy {
5273
5281
  this.#spinState.clear();
5274
5282
  }
5275
5283
  }
5276
- var DEFAULT_SUBAGENT_ROUND_LIMITS, SPIN_HIGH_SEGMENT_AT = 0.75, SPIN_STRIKE_STALE_MS = 90000, EARLY_STOP_SPIN_STREAK = 2;
5284
+ var DEFAULT_SUBAGENT_ROUND_LIMITS, FOREGROUND_LABEL_PREFIXES, SPIN_HIGH_SEGMENT_AT = 0.75, SPIN_STRIKE_STALE_MS = 90000, EARLY_STOP_SPIN_STREAK = 2;
5277
5285
  var init_subagent_policy = __esm(() => {
5278
5286
  DEFAULT_SUBAGENT_ROUND_LIMITS = { maxRounds: 0, maxRoundsGrace: 0 };
5287
+ FOREGROUND_LABEL_PREFIXES = ["[fg] ", "[use_agent foreground] "];
5279
5288
  });
5280
5289
 
5281
5290
  // src/client/remote-subagents.ts
@@ -5542,7 +5551,6 @@ class RemoteSubagentPanel {
5542
5551
  return;
5543
5552
  const frame = typeof value === "object" && value !== null && !Array.isArray(value) ? value : {};
5544
5553
  let changed = false;
5545
- const log = view.log;
5546
5554
  if (frame.type === "assistant-stream") {
5547
5555
  const streamFrame = typeof frame.frame === "object" && frame.frame !== null ? frame.frame : {};
5548
5556
  if (streamFrame.type === "chunk" && view.status === "running") {
@@ -5554,14 +5562,37 @@ class RemoteSubagentPanel {
5554
5562
  }
5555
5563
  return;
5556
5564
  }
5565
+ if (frame.type === "snapshot") {
5566
+ const records = Array.isArray(frame.records) ? frame.records : [];
5567
+ for (const record of records) {
5568
+ const rec = typeof record === "object" && record !== null ? record : {};
5569
+ if (rec.type !== "event")
5570
+ continue;
5571
+ const event = typeof rec.event === "object" && rec.event !== null ? rec.event : {};
5572
+ if (this.#foldChildEvent(id, event, { feedLadder: false }))
5573
+ changed = true;
5574
+ }
5575
+ if (changed)
5576
+ this.#emit();
5577
+ return;
5578
+ }
5557
5579
  if (frame.type !== "event")
5558
5580
  return;
5559
- const event = typeof frame.event === "object" && frame.event !== null ? frame.event : {};
5581
+ if (this.#foldChildEvent(id, typeof frame.event === "object" && frame.event !== null ? frame.event : {}, { feedLadder: true })) {
5582
+ this.#emit();
5583
+ }
5584
+ }
5585
+ #foldChildEvent(id, event, options) {
5586
+ const view = this.#children.get(id);
5587
+ if (view === undefined)
5588
+ return false;
5589
+ const log = view.log;
5590
+ let changed = false;
5560
5591
  const type = String(event.type ?? "");
5561
5592
  const data = typeof event.data === "object" && event.data !== null ? event.data : {};
5562
5593
  if (type === "subagent/descriptor") {
5563
5594
  const descriptor = descriptorOf(data);
5564
- const label = descriptor.label ?? view.label;
5595
+ const label = descriptor.label !== undefined ? bareAgentLabel(descriptor.label) : view.label;
5565
5596
  const model = descriptor.model ?? view.model;
5566
5597
  this.#children.set(id, { ...view, descriptor, ...label !== view.label ? { label } : {}, ...model !== view.model ? { model } : {} });
5567
5598
  changed = true;
@@ -5586,7 +5617,7 @@ class RemoteSubagentPanel {
5586
5617
  };
5587
5618
  this.#children.set(id, next);
5588
5619
  changed = true;
5589
- if (this.#policy !== undefined) {
5620
+ if (this.#policy !== undefined && options.feedLadder) {
5590
5621
  this.#options.refreshLimits?.();
5591
5622
  this.#policy.onRoundCount(id, next.rounds, next.label);
5592
5623
  }
@@ -5604,8 +5635,7 @@ class RemoteSubagentPanel {
5604
5635
  }
5605
5636
  while (log.length > 200)
5606
5637
  log.shift();
5607
- if (changed)
5608
- this.#emit();
5638
+ return changed;
5609
5639
  }
5610
5640
  #emit() {
5611
5641
  try {
@@ -30897,6 +30927,7 @@ var init_theme2 = __esm(() => {
30897
30927
  // ../tui-base/src/routes/session/session-composer.tsx
30898
30928
  import { measureEditText } from "@opentui/core";
30899
30929
  function SessionComposer(props) {
30930
+ const FOOTER_HEIGHT = props.footerHint === false ? 0 : 1;
30900
30931
  const renderer = useRenderer();
30901
30932
  const theme = useThemeOptional();
30902
30933
  const color = {
@@ -30992,9 +31023,8 @@ function SessionComposer(props) {
30992
31023
  }
30993
31024
  }
30994
31025
  return (() => {
30995
- var _el$ = createElement("box"), _el$2 = createElement("textarea"), _el$3 = createElement("box");
31026
+ var _el$ = createElement("box"), _el$2 = createElement("textarea");
30996
31027
  insertNode(_el$, _el$2);
30997
- insertNode(_el$, _el$3);
30998
31028
  setProp(_el$, "flexShrink", 0);
30999
31029
  setProp(_el$, "width", "100%");
31000
31030
  setProp(_el$, "flexDirection", "column");
@@ -31028,29 +31058,36 @@ function SessionComposer(props) {
31028
31058
  props.slashSync?.(textarea.plainText);
31029
31059
  });
31030
31060
  setProp(_el$2, "onSizeChange", syncHeight);
31031
- setProp(_el$3, "height", 1);
31032
- setProp(_el$3, "flexShrink", 0);
31033
- setProp(_el$3, "flexDirection", "row");
31034
- setProp(_el$3, "gap", 2);
31035
- insert(_el$3, createComponent2(Show, {
31036
- get when() {
31037
- return busy();
31038
- },
31039
- get fallback() {
31040
- return (() => {
31041
- var _el$6 = createElement("text");
31042
- insertNode(_el$6, createTextNode(`enter send \xB7 alt+enter newline \xB7 \u2191\u2193 history`));
31043
- effect((_$p) => setProp(_el$6, "fg", color.hint(), _$p));
31044
- return _el$6;
31045
- })();
31046
- },
31061
+ insert(_el$, createComponent2(Show, {
31062
+ when: FOOTER_HEIGHT > 0,
31047
31063
  get children() {
31048
- var _el$4 = createElement("text");
31049
- insertNode(_el$4, createTextNode(`* streaming\u2026 enter steers the running turn`));
31050
- effect((_$p) => setProp(_el$4, "fg", color.busy(), _$p));
31051
- return _el$4;
31064
+ var _el$3 = createElement("box");
31065
+ setProp(_el$3, "height", FOOTER_HEIGHT);
31066
+ setProp(_el$3, "flexShrink", 0);
31067
+ setProp(_el$3, "flexDirection", "row");
31068
+ setProp(_el$3, "gap", 2);
31069
+ insert(_el$3, createComponent2(Show, {
31070
+ get when() {
31071
+ return busy();
31072
+ },
31073
+ get fallback() {
31074
+ return (() => {
31075
+ var _el$6 = createElement("text");
31076
+ insertNode(_el$6, createTextNode(`enter send \xB7 alt+enter newline \xB7 \u2191\u2193 history`));
31077
+ effect((_$p) => setProp(_el$6, "fg", color.hint(), _$p));
31078
+ return _el$6;
31079
+ })();
31080
+ },
31081
+ get children() {
31082
+ var _el$4 = createElement("text");
31083
+ insertNode(_el$4, createTextNode(`* streaming\u2026 enter steers the running turn`));
31084
+ effect((_$p) => setProp(_el$4, "fg", color.busy(), _$p));
31085
+ return _el$4;
31086
+ }
31087
+ }));
31088
+ return _el$3;
31052
31089
  }
31053
- }));
31090
+ }), null);
31054
31091
  effect((_p$) => {
31055
31092
  var _v$ = textareaHeight() + FOOTER_HEIGHT + (props.slashHeight?.() ?? 0), _v$2 = busy() ? color.busy() : color.border(), _v$3 = SplitBorder.customBorderChars, _v$4 = color.background(), _v$5 = maxLines(), _v$6 = props.placeholder ?? "Type a message (enter send, alt+enter newline)", _v$7 = color.placeholder(), _v$8 = color.text(), _v$9 = color.text(), _v$0 = color.text();
31056
31093
  _v$ !== _p$.e && (_p$.e = setProp(_el$, "height", _v$, _p$.e));
@@ -31079,7 +31116,6 @@ function SessionComposer(props) {
31079
31116
  return _el$;
31080
31117
  })();
31081
31118
  }
31082
- var FOOTER_HEIGHT = 1;
31083
31119
  var init_session_composer = __esm(() => {
31084
31120
  init_index_bun();
31085
31121
  init_index_bun();
@@ -31266,6 +31302,174 @@ var init_welcome_hero = __esm(() => {
31266
31302
  home = typeof process !== "undefined" && process.env.HOME || "";
31267
31303
  });
31268
31304
 
31305
+ // ../tui-base/src/util/string-width.bun.ts
31306
+ var stringWidth;
31307
+ var init_string_width_bun = __esm(() => {
31308
+ stringWidth = Bun.stringWidth;
31309
+ });
31310
+
31311
+ // ../tui-base/src/util/string-width.ts
31312
+ var init_string_width = __esm(() => {
31313
+ init_string_width_bun();
31314
+ });
31315
+
31316
+ // ../tui-base/src/routes/session/tool-summarize.ts
31317
+ function clipToWidth(text, limit) {
31318
+ if (limit <= 0)
31319
+ return "";
31320
+ const flat = text.replace(/\s+/u, " ").trim();
31321
+ if (stringWidth(flat) <= limit)
31322
+ return flat;
31323
+ let width = 0;
31324
+ for (let i = 0;i < flat.length; i++) {
31325
+ width += stringWidth(flat[i]);
31326
+ if (width > limit - 1) {
31327
+ return limit <= 1 ? "\u2026" : `${flat.slice(0, i)}\u2026`;
31328
+ }
31329
+ }
31330
+ return flat;
31331
+ }
31332
+ function firstWord(value) {
31333
+ return value.trim().split(/\s+/u)[0] ?? "";
31334
+ }
31335
+ function toolSubject(rawArguments) {
31336
+ const cap = (value) => clipToWidth(value, 24);
31337
+ try {
31338
+ const parsed = JSON.parse(rawArguments);
31339
+ for (const key of ["command", "file_path", "path", "query", "url", "pattern", "description"]) {
31340
+ const value = parsed[key];
31341
+ if (typeof value === "string" && value.trim() !== "")
31342
+ return cap(firstWord(value));
31343
+ }
31344
+ for (const value of Object.values(parsed)) {
31345
+ if (typeof value === "string" && value.trim() !== "")
31346
+ return cap(firstWord(value));
31347
+ }
31348
+ } catch {}
31349
+ return "";
31350
+ }
31351
+ function toolDetail(rawArguments, limit = 120) {
31352
+ try {
31353
+ const parsed = JSON.parse(rawArguments);
31354
+ const parts = [];
31355
+ if (typeof parsed.command === "string")
31356
+ parts.push(`$ ${parsed.command}`);
31357
+ if (typeof parsed.file_path === "string")
31358
+ parts.push(parsed.file_path);
31359
+ if (typeof parsed.path === "string" && parts.length === 0)
31360
+ parts.push(parsed.path);
31361
+ if (typeof parsed.pattern === "string")
31362
+ parts.push(`pattern: ${parsed.pattern}`);
31363
+ if (typeof parsed.query === "string")
31364
+ parts.push(`query: ${parsed.query}`);
31365
+ if (typeof parsed.url === "string")
31366
+ parts.push(parsed.url);
31367
+ if (typeof parsed.description === "string" && parts.length === 0)
31368
+ parts.push(parsed.description);
31369
+ const agentId = typeof parsed.agent_id === "string" ? parsed.agent_id.trim() : "";
31370
+ if (agentId !== "") {
31371
+ const content = typeof parsed.prompt === "string" && parsed.prompt.trim() !== "" ? parsed.prompt : typeof parsed.message === "string" ? parsed.message : "";
31372
+ const summary = content.trim() !== "" ? `\u2192 ${agentId} \xB7 ${content.trim()}` : `\u2192 ${agentId}`;
31373
+ return clipToWidth(summary.replace(/\n/g, " \u23CE "), limit);
31374
+ }
31375
+ if (typeof parsed.agent === "string")
31376
+ parts.push(`agent: ${parsed.agent}`);
31377
+ if (typeof parsed.prompt === "string" && parsed.prompt.trim() !== "") {
31378
+ parts.push(parsed.prompt.trim());
31379
+ }
31380
+ if (parts.length === 0)
31381
+ parts.push(rawArguments.replace(/\s+/g, " "));
31382
+ const joined = parts.join(" ").replace(/\n/g, " \u23CE ");
31383
+ return clipToWidth(joined, limit);
31384
+ } catch {
31385
+ return "";
31386
+ }
31387
+ }
31388
+ function stringLeaves(record, depth) {
31389
+ const out = [];
31390
+ if (depth < 0)
31391
+ return out;
31392
+ for (const [key, value] of Object.entries(record)) {
31393
+ if (typeof value === "string") {
31394
+ if (value.trim() !== "")
31395
+ out.push([key, value.trim().split(`
31396
+ `)[0] ?? value.trim()]);
31397
+ } else if (typeof value === "number" || typeof value === "boolean") {
31398
+ out.push([key, String(value)]);
31399
+ } else if (value !== null && typeof value === "object") {
31400
+ const inner = Array.isArray(value) ? value.find((v) => v !== null && typeof v === "object") : value;
31401
+ if (inner !== null && typeof inner === "object") {
31402
+ out.push(...stringLeaves(inner, depth - 1));
31403
+ } else if (typeof inner === "string" && inner.trim() !== "") {
31404
+ out.push([key, inner.trim()]);
31405
+ }
31406
+ }
31407
+ if (out.length >= 4)
31408
+ break;
31409
+ }
31410
+ return out.slice(0, 4);
31411
+ }
31412
+ function digTruncatedJson(raw) {
31413
+ for (const key of ["text", "content", "output", "result", "message"]) {
31414
+ const match = new RegExp(`"${key}"\\s*:\\s*"((?:[^"\\\\]|\\\\.)*)`, "u").exec(raw);
31415
+ if (match === null)
31416
+ continue;
31417
+ let body = match[1];
31418
+ body = body.replace(/\\(u[0-9a-fA-F]{0,3})?$/u, "");
31419
+ try {
31420
+ const decoded = JSON.parse(`"${body}"`);
31421
+ if (decoded.trim() !== "")
31422
+ return decoded;
31423
+ } catch {}
31424
+ }
31425
+ return;
31426
+ }
31427
+ function toolResultLine(output, limit = 120) {
31428
+ if (output === undefined || output.trim() === "")
31429
+ return "";
31430
+ let text = output;
31431
+ const looksJson = /^\s*[{["]/u.test(output);
31432
+ try {
31433
+ const parsed = JSON.parse(output);
31434
+ if (typeof parsed === "string") {
31435
+ text = parsed;
31436
+ } else if (parsed !== null && typeof parsed === "object") {
31437
+ text = TOOL_RESULT_PLACEHOLDER;
31438
+ const record = parsed;
31439
+ const inner = typeof record.message === "object" && record.message !== null ? record.message : record;
31440
+ const blocks = Array.isArray(inner.content) ? inner.content : Array.isArray(parsed) ? parsed : undefined;
31441
+ const first = blocks?.find((block) => typeof block === "object" && block !== null && typeof block.text === "string");
31442
+ if (first !== undefined) {
31443
+ text = String(first.text);
31444
+ } else if (typeof inner.content === "string" && inner.content.trim() !== "") {
31445
+ text = inner.content;
31446
+ } else if (typeof inner.text === "string") {
31447
+ text = inner.text;
31448
+ } else if (typeof inner.output === "string") {
31449
+ text = inner.output;
31450
+ } else if (blocks === undefined) {
31451
+ const leaves = stringLeaves(inner, 2);
31452
+ if (leaves.length > 0)
31453
+ text = leaves.map(([key, value]) => `${key}: ${value}`).join(" \xB7 ");
31454
+ }
31455
+ }
31456
+ } catch {
31457
+ if (looksJson)
31458
+ text = digTruncatedJson(output) ?? TOOL_RESULT_PLACEHOLDER;
31459
+ }
31460
+ const lines = text.replace(/\s+$/u, "").split(`
31461
+ `).filter((line) => line.trim() !== "");
31462
+ if (lines.length === 0)
31463
+ return "";
31464
+ const first = lines[0];
31465
+ const more = lines.length > 1 ? ` (+${lines.length - 1} lines)` : "";
31466
+ return clipToWidth(first + more, limit);
31467
+ }
31468
+ var TOOL_RESULT_PLACEHOLDER = "tool result";
31469
+ var init_tool_summarize = __esm(() => {
31470
+ init_string_width();
31471
+ });
31472
+
31269
31473
  // ../../node_modules/.pnpm/@opentui+keymap@0.8.1_@opentui+solid@0.8.1_solid-js@1.9.17_typescript@5.9.3_web-tree-si_cf27251ea086cee0c05f2add925b23c0/node_modules/@opentui/keymap/chunks/index-pjh5rp2p.js
31270
31474
  function createLayerSlot(keymap) {
31271
31475
  const { layers } = keymap[KEYMAP_EXTENSION_CONTEXT2]();
@@ -38798,17 +39002,6 @@ var init_dialog = __esm(() => {
38798
39002
  ctx2 = createContext();
38799
39003
  });
38800
39004
 
38801
- // ../tui-base/src/util/string-width.bun.ts
38802
- var stringWidth;
38803
- var init_string_width_bun = __esm(() => {
38804
- stringWidth = Bun.stringWidth;
38805
- });
38806
-
38807
- // ../tui-base/src/util/string-width.ts
38808
- var init_string_width = __esm(() => {
38809
- init_string_width_bun();
38810
- });
38811
-
38812
39005
  // ../tui-base/src/component/spinner-frames.ts
38813
39006
  var SPINNER_FRAMES;
38814
39007
  var init_spinner_frames = __esm(() => {
@@ -39933,7 +40126,6 @@ var init_subagent_markers = __esm(() => {
39933
40126
  });
39934
40127
 
39935
40128
  // ../tui-base/src/routes/session/subagents-picker.tsx
39936
- import { TextAttributes as TextAttributes4 } from "@opentui/core";
39937
40129
  function SubagentsPicker(props) {
39938
40130
  const theme = useThemeOptional();
39939
40131
  const dialog = useDialog();
@@ -39950,12 +40142,15 @@ function SubagentsPicker(props) {
39950
40142
  return showAll() ? views : views.filter((view) => view.status === "running");
39951
40143
  });
39952
40144
  const selectedEntry = createMemo(() => entries()[store.selected]);
39953
- const visibleRows = createMemo(() => Math.min(ROW_CAP, Math.max(1, entries().length)));
39954
40145
  createEffect(() => {
39955
40146
  if (!open())
39956
40147
  return;
39957
40148
  setStore("selected", 0);
39958
40149
  });
40150
+ createEffect(() => {
40151
+ if (open() && pickerShouldAutoClose(subagentMarkerViews()))
40152
+ setOpen(false);
40153
+ });
39959
40154
  function moveTo(next) {
39960
40155
  const count = entries().length;
39961
40156
  if (count === 0)
@@ -40027,7 +40222,7 @@ function SubagentsPicker(props) {
40027
40222
  }));
40028
40223
  Keymap2.createLayer(() => ({
40029
40224
  mode: "global",
40030
- enabled: !open() && dialog.stack.length === 0 && subagentMarkerViews().length > 0,
40225
+ enabled: !open() && dialog.stack.length === 0 && pickerToggleEnabled(subagentMarkerViews()),
40031
40226
  commands: [{
40032
40227
  id: "session.child.first",
40033
40228
  title: "Toggle subagent picker",
@@ -40035,164 +40230,43 @@ function SubagentsPicker(props) {
40035
40230
  run: () => setOpen(true)
40036
40231
  }]
40037
40232
  }));
40233
+ const dimensions = useTerminalDimensions();
40038
40234
  return createComponent2(Show, {
40039
40235
  get when() {
40040
40236
  return open();
40041
40237
  },
40042
40238
  get children() {
40043
- var _el$ = createElement("box"), _el$2 = createElement("box"), _el$3 = createElement("text"), _el$5 = createElement("text"), _el$7 = createElement("box"), _el$8 = createElement("text"), _el$9 = createElement("span"), _el$0 = createElement("b"), _el$10 = createTextNode(` `), _el$11 = createElement("span"), _el$13 = createElement("text"), _el$14 = createElement("span"), _el$15 = createElement("b"), _el$16 = createTextNode(` `), _el$17 = createElement("span");
40239
+ var _el$ = createElement("box"), _el$2 = createElement("text");
40044
40240
  insertNode(_el$, _el$2);
40045
- insertNode(_el$, _el$7);
40046
40241
  setProp(_el$, "flexShrink", 0);
40047
40242
  setProp(_el$, "width", "100%");
40048
- setProp(_el$, "flexDirection", "column");
40049
- setProp(_el$, "border", ["left"]);
40050
- setProp(_el$, "paddingLeft", 1);
40051
- setProp(_el$, "paddingRight", 2);
40052
- setProp(_el$, "paddingTop", 1);
40053
- setProp(_el$, "paddingBottom", 1);
40054
- insertNode(_el$2, _el$3);
40055
- insertNode(_el$2, _el$5);
40056
- setProp(_el$2, "height", 1);
40057
- setProp(_el$2, "flexShrink", 0);
40058
- setProp(_el$2, "flexDirection", "row");
40059
- setProp(_el$2, "justifyContent", "space-between");
40060
- setProp(_el$2, "paddingLeft", 1);
40061
- insertNode(_el$3, createTextNode(`Subagents`));
40062
- insertNode(_el$5, createTextNode(`esc`));
40063
- insert(_el$, createComponent2(Show, {
40064
- get when() {
40065
- return entries().length > 0;
40066
- },
40067
- get fallback() {
40068
- return (() => {
40069
- var _el$19 = createElement("box"), _el$20 = createElement("text"), _el$21 = createTextNode(`No `), _el$22 = createTextNode(` subagents`);
40070
- insertNode(_el$19, _el$20);
40071
- setProp(_el$19, "height", 1);
40072
- setProp(_el$19, "flexShrink", 0);
40073
- setProp(_el$19, "paddingLeft", 1);
40074
- insertNode(_el$20, _el$21);
40075
- insertNode(_el$20, _el$22);
40076
- insert(_el$20, () => showAll() ? "inactive" : "active", _el$22);
40077
- effect((_$p) => setProp(_el$20, "fg", theme?.text.muted ?? "#565f89", _$p));
40078
- return _el$19;
40079
- })();
40080
- },
40081
- get children() {
40082
- return createComponent2(For, {
40083
- get each() {
40084
- return entries().slice(0, ROW_CAP);
40085
- },
40086
- children: (entry, index) => {
40087
- const active = createMemo(() => index() === store.selected);
40088
- return (() => {
40089
- var _el$23 = createElement("box"), _el$24 = createElement("text");
40090
- insertNode(_el$23, _el$24);
40091
- setProp(_el$23, "height", 1);
40092
- setProp(_el$23, "flexShrink", 0);
40093
- setProp(_el$23, "flexDirection", "row");
40094
- setProp(_el$23, "paddingLeft", 1);
40095
- setProp(_el$23, "paddingRight", 1);
40096
- setProp(_el$24, "wrapMode", "none");
40097
- insert(_el$24, () => subagentHardStopGlyph(entry), null);
40098
- insert(_el$24, () => subagentHardStopGlyph(entry) ? " " : "", null);
40099
- insert(_el$24, () => titlecase(entry.label), null);
40100
- insert(_el$23, createComponent2(Show, {
40101
- get when() {
40102
- return entry.status === "running";
40103
- },
40104
- get children() {
40105
- var _el$25 = createElement("text");
40106
- insertNode(_el$25, createTextNode(` Running`));
40107
- setProp(_el$25, "wrapMode", "none");
40108
- effect((_$p) => setProp(_el$25, "fg", active() ? theme?.text.action.primary.focused ?? "#e6e6e6" : theme?.text.muted ?? "#565f89", _$p));
40109
- return _el$25;
40110
- }
40111
- }), null);
40112
- insert(_el$23, createComponent2(Show, {
40113
- get when() {
40114
- return subagentMarkerSuffix(entry);
40115
- },
40116
- get children() {
40117
- var _el$27 = createElement("text");
40118
- setProp(_el$27, "wrapMode", "none");
40119
- insert(_el$27, () => subagentMarkerSuffix(entry));
40120
- effect((_$p) => setProp(_el$27, "fg", theme?.text.muted ?? "#565f89", _$p));
40121
- return _el$27;
40122
- }
40123
- }), null);
40124
- effect((_p$) => {
40125
- var _v$1 = active() ? theme?.text.action.primary.focused ?? "#e6e6e6" : theme?.text.action.primary.base ?? "#e6e6e6", _v$10 = active() ? TextAttributes4.BOLD : undefined;
40126
- _v$1 !== _p$.e && (_p$.e = setProp(_el$24, "fg", _v$1, _p$.e));
40127
- _v$10 !== _p$.t && (_p$.t = setProp(_el$24, "attributes", _v$10, _p$.t));
40128
- return _p$;
40129
- }, {
40130
- e: undefined,
40131
- t: undefined
40132
- });
40133
- return _el$23;
40134
- })();
40135
- }
40136
- });
40137
- }
40138
- }), _el$7);
40139
- insertNode(_el$7, _el$8);
40140
- insertNode(_el$7, _el$13);
40141
- setProp(_el$7, "height", 1);
40142
- setProp(_el$7, "flexShrink", 0);
40143
- setProp(_el$7, "flexDirection", "row");
40144
- setProp(_el$7, "gap", 2);
40145
- setProp(_el$7, "paddingLeft", 1);
40146
- insertNode(_el$8, _el$9);
40147
- insertNode(_el$8, _el$11);
40148
- insertNode(_el$9, _el$0);
40149
- insertNode(_el$9, _el$10);
40150
- insertNode(_el$0, createTextNode(`steer`));
40151
- insertNode(_el$11, createTextNode(`enter`));
40152
- insertNode(_el$13, _el$14);
40153
- insertNode(_el$13, _el$17);
40154
- insertNode(_el$14, _el$15);
40155
- insertNode(_el$14, _el$16);
40156
- insert(_el$15, () => `show ${showAll() ? "inactive" : "active"}`);
40157
- insertNode(_el$17, createTextNode(`ctrl+a`));
40158
- effect((_p$) => {
40159
- var _v$ = 1 + visibleRows() + 1 + 2, _v$2 = theme?.border.base ?? "#7aa2f7", _v$3 = theme?.background.raised.base ?? "#1a1b26", _v$4 = theme?.text.base ?? "#e6e6e6", _v$5 = TextAttributes4.BOLD, _v$6 = theme?.text.muted ?? "#565f89", _v$7 = {
40160
- fg: theme?.text.base ?? "#e6e6e6"
40161
- }, _v$8 = {
40162
- fg: theme?.text.muted ?? "#565f89"
40163
- }, _v$9 = {
40164
- fg: theme?.text.base ?? "#e6e6e6"
40165
- }, _v$0 = {
40166
- fg: theme?.text.muted ?? "#565f89"
40167
- };
40168
- _v$ !== _p$.e && (_p$.e = setProp(_el$, "height", _v$, _p$.e));
40169
- _v$2 !== _p$.t && (_p$.t = setProp(_el$, "borderColor", _v$2, _p$.t));
40170
- _v$3 !== _p$.a && (_p$.a = setProp(_el$, "backgroundColor", _v$3, _p$.a));
40171
- _v$4 !== _p$.o && (_p$.o = setProp(_el$3, "fg", _v$4, _p$.o));
40172
- _v$5 !== _p$.i && (_p$.i = setProp(_el$3, "attributes", _v$5, _p$.i));
40173
- _v$6 !== _p$.n && (_p$.n = setProp(_el$5, "fg", _v$6, _p$.n));
40174
- _v$7 !== _p$.s && (_p$.s = setProp(_el$9, "style", _v$7, _p$.s));
40175
- _v$8 !== _p$.h && (_p$.h = setProp(_el$11, "style", _v$8, _p$.h));
40176
- _v$9 !== _p$.r && (_p$.r = setProp(_el$14, "style", _v$9, _p$.r));
40177
- _v$0 !== _p$.d && (_p$.d = setProp(_el$17, "style", _v$0, _p$.d));
40178
- return _p$;
40179
- }, {
40180
- e: undefined,
40181
- t: undefined,
40182
- a: undefined,
40183
- o: undefined,
40184
- i: undefined,
40185
- n: undefined,
40186
- s: undefined,
40187
- h: undefined,
40188
- r: undefined,
40189
- d: undefined
40190
- });
40243
+ setProp(_el$, "height", 1);
40244
+ setProp(_el$, "flexDirection", "row");
40245
+ setProp(_el$, "paddingLeft", 3);
40246
+ setProp(_el$2, "wrapMode", "none");
40247
+ insert(_el$2, () => clipToWidth(pickerLineText(entries(), store.selected, showAll()), Math.max(16, dimensions().width - 4)));
40248
+ effect((_$p) => setProp(_el$2, "fg", theme?.text.base ?? "#e6e6e6", _$p));
40191
40249
  return _el$;
40192
40250
  }
40193
40251
  });
40194
40252
  }
40195
- var ROW_CAP = 5;
40253
+ function pickerToggleEnabled(views) {
40254
+ return views.some((view) => view.status === "running");
40255
+ }
40256
+ function pickerShouldAutoClose(views) {
40257
+ return !pickerToggleEnabled(views);
40258
+ }
40259
+ function pickerLineText(entries, selected, showAll) {
40260
+ const toggle = `ctrl+a show ${showAll ? "active" : "inactive"}`;
40261
+ const entry = entries[selected];
40262
+ if (entry === undefined)
40263
+ return `Subagents \u25B8 no ${showAll ? "inactive" : "active"} subagents \xB7 ${toggle} \xB7 esc`;
40264
+ const glyph = subagentHardStopGlyph(entry);
40265
+ const suffix = subagentMarkerSuffix(entry);
40266
+ const label = `${glyph ? `${glyph} ` : ""}${titlecase(entry.label)}`;
40267
+ const status = entry.status === "running" ? " \xB7 Running" : "";
40268
+ return `Subagents \u25B8 ${label}${status}${suffix ? ` ${suffix.trim()}` : ""} \xB7 ${selected + 1}/${entries.length} \xB7 \u2191\u2193 select \xB7 enter steer \xB7 ${toggle} \xB7 esc`;
40269
+ }
40196
40270
  var init_subagents_picker = __esm(() => {
40197
40271
  init_index_bun();
40198
40272
  init_index_bun();
@@ -40200,9 +40274,9 @@ var init_subagents_picker = __esm(() => {
40200
40274
  init_index_bun();
40201
40275
  init_index_bun();
40202
40276
  init_index_bun();
40203
- init_index_bun();
40204
- init_index_bun();
40205
40277
  init_server();
40278
+ init_index_bun();
40279
+ init_tool_summarize();
40206
40280
  init_server2();
40207
40281
  init_keymap();
40208
40282
  init_theme2();
@@ -40233,7 +40307,8 @@ function toStoredRow(stored, index) {
40233
40307
  function createSeamRows(seam, sessionID, options) {
40234
40308
  const [rows, setRows] = createStore([]);
40235
40309
  const [hydrated, setHydrated] = createSignal(false);
40236
- const thinkFadeMs = options?.thinkFadeMs ?? 1800;
40310
+ const thinkFadeMs = options?.thinkFadeMs ?? 1000;
40311
+ const toolFadeMs = options?.toolFadeMs ?? 1000;
40237
40312
  let liveOrdinal = 0;
40238
40313
  let turnOpen = false;
40239
40314
  const pendingTurns = [];
@@ -40294,10 +40369,35 @@ function createSeamRows(seam, sessionID, options) {
40294
40369
  if (keys.length > 0)
40295
40370
  dropRows(new Set(keys));
40296
40371
  }
40372
+ const toolFades = new Map;
40373
+ function hideTool(key) {
40374
+ setRows(produce((draft) => {
40375
+ const row = draft.find((r) => r.key === key);
40376
+ if (row !== undefined && row.kind === "tool" && row.status !== "running")
40377
+ row.faded = true;
40378
+ }));
40379
+ }
40380
+ function scheduleToolFade(key) {
40381
+ const prior = toolFades.get(key);
40382
+ if (prior !== undefined)
40383
+ clearTimeout(prior);
40384
+ if (toolFadeMs <= 0) {
40385
+ toolFades.delete(key);
40386
+ hideTool(key);
40387
+ return;
40388
+ }
40389
+ toolFades.set(key, setTimeout(() => {
40390
+ toolFades.delete(key);
40391
+ hideTool(key);
40392
+ }, toolFadeMs));
40393
+ }
40297
40394
  onCleanup(() => {
40298
40395
  for (const timer of thinkFades.values())
40299
40396
  clearTimeout(timer);
40300
40397
  thinkFades.clear();
40398
+ for (const timer of toolFades.values())
40399
+ clearTimeout(timer);
40400
+ toolFades.clear();
40301
40401
  });
40302
40402
  function applySubagentViews(views) {
40303
40403
  const key = "subagents:live";
@@ -40346,6 +40446,13 @@ function createSeamRows(seam, sessionID, options) {
40346
40446
  const details = event.details ?? {};
40347
40447
  if (typeof details.sessionID === "string" && details.sessionID !== sessionID())
40348
40448
  return;
40449
+ if (event.type === "message.updated" && details.role === "notice") {
40450
+ const id = typeof details.id === "string" ? details.id : `local-${++liveOrdinal}`;
40451
+ const text = typeof details.text === "string" ? details.text : "";
40452
+ if (text.trim() !== "")
40453
+ upsert({ key: `notice:${id}`, kind: "assistant", text, final: true });
40454
+ return;
40455
+ }
40349
40456
  if (event.type === "message.updated" && details.role === "user") {
40350
40457
  const id = typeof details.id === "string" ? details.id : `local-${++liveOrdinal}`;
40351
40458
  const text = typeof details.text === "string" ? details.text : "";
@@ -40436,6 +40543,7 @@ function createSeamRows(seam, sessionID, options) {
40436
40543
  streaming: false,
40437
40544
  elapsedSec: Number(((Date.now() - reasoningStartedAt) / 1000).toFixed(1))
40438
40545
  });
40546
+ scheduleThinkFade(reasoningKey);
40439
40547
  };
40440
40548
  return seam.turn(prompt, {
40441
40549
  onThinkingDelta: (delta) => {
@@ -40446,6 +40554,7 @@ function createSeamRows(seam, sessionID, options) {
40446
40554
  reasoningStartedAt = Date.now();
40447
40555
  cancelPendingThinkFades();
40448
40556
  }
40557
+ cancelThinkFade(reasoningKey);
40449
40558
  upsert({
40450
40559
  key: reasoningKey,
40451
40560
  kind: "reasoning",
@@ -40468,7 +40577,8 @@ function createSeamRows(seam, sessionID, options) {
40468
40577
  name: start.name,
40469
40578
  args: start.args,
40470
40579
  status: "running",
40471
- startedAt: Date.now()
40580
+ startedAt: Date.now(),
40581
+ faded: false
40472
40582
  });
40473
40583
  },
40474
40584
  onToolRun: (run) => {
@@ -40483,6 +40593,7 @@ function createSeamRows(seam, sessionID, options) {
40483
40593
  output: run.output,
40484
40594
  ...startedAt !== undefined ? { elapsedSec: Number(((Date.now() - startedAt) / 1000).toFixed(1)) } : {}
40485
40595
  });
40596
+ scheduleToolFade(`tool:live:${run.callId ?? run.name}`);
40486
40597
  },
40487
40598
  onApprove: options?.onApprove ?? approveThrough,
40488
40599
  onError: (message) => {
@@ -40502,17 +40613,22 @@ function createSeamRows(seam, sessionID, options) {
40502
40613
  collapseThinking();
40503
40614
  finalize(reasoningKey, "reasoning", reasoningText);
40504
40615
  finalize(assistantKey, "assistant", assistantText);
40505
- scheduleThinkFade(reasoningKey);
40616
+ if (reasoningStartedAt !== undefined)
40617
+ scheduleThinkFade(reasoningKey);
40618
+ const swept = [];
40506
40619
  setRows(produce((draft) => {
40507
40620
  for (const row of draft) {
40508
40621
  if (row.kind === "tool" && row.status === "running" && row.key.startsWith("tool:live:")) {
40509
40622
  row.status = "done";
40623
+ swept.push(row.key);
40510
40624
  if (row.startedAt !== undefined) {
40511
40625
  row.elapsedSec = Number(((Date.now() - row.startedAt) / 1000).toFixed(1));
40512
40626
  }
40513
40627
  }
40514
40628
  }
40515
40629
  }));
40630
+ for (const key of swept)
40631
+ scheduleToolFade(key);
40516
40632
  if (turnErrored)
40517
40633
  return;
40518
40634
  const id = sessionID();
@@ -40547,220 +40663,10 @@ var init_seam_rows = __esm(() => {
40547
40663
  init_server2();
40548
40664
  });
40549
40665
 
40550
- // ../tui-base/src/routes/session/tool-summarize.ts
40551
- function clipToWidth(text, limit) {
40552
- if (limit <= 0)
40553
- return "";
40554
- const flat = text.replace(/\s+/u, " ").trim();
40555
- if (stringWidth(flat) <= limit)
40556
- return flat;
40557
- let width = 0;
40558
- for (let i = 0;i < flat.length; i++) {
40559
- width += stringWidth(flat[i]);
40560
- if (width > limit - 1) {
40561
- return limit <= 1 ? "\u2026" : `${flat.slice(0, i)}\u2026`;
40562
- }
40563
- }
40564
- return flat;
40565
- }
40566
- function firstWord(value) {
40567
- return value.trim().split(/\s+/u)[0] ?? "";
40568
- }
40569
- function toolSubject(rawArguments) {
40570
- const cap = (value) => clipToWidth(value, 24);
40571
- try {
40572
- const parsed = JSON.parse(rawArguments);
40573
- for (const key of ["command", "file_path", "path", "query", "url", "pattern", "description"]) {
40574
- const value = parsed[key];
40575
- if (typeof value === "string" && value.trim() !== "")
40576
- return cap(firstWord(value));
40577
- }
40578
- for (const value of Object.values(parsed)) {
40579
- if (typeof value === "string" && value.trim() !== "")
40580
- return cap(firstWord(value));
40581
- }
40582
- } catch {}
40583
- return "";
40584
- }
40585
- function toolDetail(rawArguments, limit = 120) {
40586
- try {
40587
- const parsed = JSON.parse(rawArguments);
40588
- const parts = [];
40589
- if (typeof parsed.command === "string")
40590
- parts.push(`$ ${parsed.command}`);
40591
- if (typeof parsed.file_path === "string")
40592
- parts.push(parsed.file_path);
40593
- if (typeof parsed.path === "string" && parts.length === 0)
40594
- parts.push(parsed.path);
40595
- if (typeof parsed.pattern === "string")
40596
- parts.push(`pattern: ${parsed.pattern}`);
40597
- if (typeof parsed.query === "string")
40598
- parts.push(`query: ${parsed.query}`);
40599
- if (typeof parsed.url === "string")
40600
- parts.push(parsed.url);
40601
- if (typeof parsed.description === "string" && parts.length === 0)
40602
- parts.push(parsed.description);
40603
- if (parts.length === 0)
40604
- parts.push(rawArguments.replace(/\s+/g, " "));
40605
- const joined = parts.join(" ").replace(/\n/g, " \u23CE ");
40606
- return clipToWidth(joined, limit);
40607
- } catch {
40608
- return "";
40609
- }
40610
- }
40611
- function toolResultLine(output, limit = 120) {
40612
- if (output === undefined || output.trim() === "")
40613
- return "";
40614
- let text = output;
40615
- try {
40616
- const parsed = JSON.parse(output);
40617
- if (typeof parsed === "string") {
40618
- text = parsed;
40619
- } else if (parsed !== null && typeof parsed === "object") {
40620
- const record = parsed;
40621
- const inner = typeof record.message === "object" && record.message !== null ? record.message : record;
40622
- const content = inner.content;
40623
- if (Array.isArray(content)) {
40624
- const first = content.find((block) => typeof block === "object" && block !== null && typeof block.text === "string");
40625
- if (first !== undefined)
40626
- text = String(first.text);
40627
- } else if (typeof inner.text === "string") {
40628
- text = inner.text;
40629
- } else if (inner !== record && typeof inner.output === "string") {
40630
- text = inner.output;
40631
- }
40632
- }
40633
- } catch {}
40634
- const lines = text.replace(/\s+$/u, "").split(`
40635
- `).filter((line) => line.trim() !== "");
40636
- if (lines.length === 0)
40637
- return "";
40638
- const first = lines[0];
40639
- const more = lines.length > 1 ? ` (+${lines.length - 1} lines)` : "";
40640
- return clipToWidth(first + more, limit);
40641
- }
40642
- var init_tool_summarize = __esm(() => {
40643
- init_string_width();
40644
- });
40645
-
40646
- // ../tui-base/src/routes/session/think-panel.tsx
40647
- function ThinkPanelRow(props) {
40648
- const elapsed = () => {
40649
- const row = props.row();
40650
- if (row.streaming === true && row.startedAt !== undefined) {
40651
- props.spin();
40652
- return `${((Date.now() - row.startedAt) / 1000).toFixed(1)}s`;
40653
- }
40654
- return row.elapsedSec !== undefined ? `${row.elapsedSec.toFixed(1)}s` : undefined;
40655
- };
40656
- const tail = createMemo(() => {
40657
- const lines = props.row().text.replace(/\r/g, "").split(`
40658
- `).filter((line) => line.trim() !== "");
40659
- return lines.slice(-TAIL_LINES).map((line) => clipToWidth(line, Math.max(16, props.width() - 8)));
40660
- });
40661
- const summary = createMemo(() => {
40662
- const first = props.row().text.replace(/\r/g, "").split(`
40663
- `).find((line) => line.trim() !== "") ?? "";
40664
- const secs = elapsed() ?? "0.0s";
40665
- const budget = Math.max(16, props.width() - 5);
40666
- const prefix = clipToWidth(`\uD83D\uDCAD thought \xB7 ${secs}`, budget);
40667
- const rest = clipToWidth(first, Math.max(0, budget - stringWidth(prefix) - 3));
40668
- return {
40669
- prefix,
40670
- rest
40671
- };
40672
- });
40673
- return createComponent2(Show, {
40674
- get when() {
40675
- return props.row().streaming === true;
40676
- },
40677
- get fallback() {
40678
- return (() => {
40679
- var _el$3 = createElement("box"), _el$4 = createElement("text"), _el$5 = createElement("span"), _el$6 = createElement("span");
40680
- insertNode(_el$3, _el$4);
40681
- setProp(_el$3, "flexShrink", 0);
40682
- setProp(_el$3, "paddingLeft", 3);
40683
- insertNode(_el$4, _el$5);
40684
- insertNode(_el$4, _el$6);
40685
- setProp(_el$4, "wrapMode", "none");
40686
- insert(_el$5, () => summary().prefix);
40687
- insert(_el$6, (() => {
40688
- var _c$ = memo2(() => summary().rest === "");
40689
- return () => _c$() ? "" : ` \xB7 ${summary().rest}`;
40690
- })());
40691
- effect((_p$) => {
40692
- var _v$3 = {
40693
- fg: props.color.summaryAccent?.() ?? props.color.text()
40694
- }, _v$4 = {
40695
- fg: props.color.text()
40696
- };
40697
- _v$3 !== _p$.e && (_p$.e = setProp(_el$5, "style", _v$3, _p$.e));
40698
- _v$4 !== _p$.t && (_p$.t = setProp(_el$6, "style", _v$4, _p$.t));
40699
- return _p$;
40700
- }, {
40701
- e: undefined,
40702
- t: undefined
40703
- });
40704
- return _el$3;
40705
- })();
40706
- },
40707
- get children() {
40708
- var _el$ = createElement("box"), _el$2 = createElement("text");
40709
- insertNode(_el$, _el$2);
40710
- setProp(_el$, "flexShrink", 0);
40711
- setProp(_el$, "marginLeft", 2);
40712
- setProp(_el$, "marginRight", 2);
40713
- setProp(_el$, "border", ["top", "right", "bottom", "left"]);
40714
- setProp(_el$, "paddingLeft", 1);
40715
- setProp(_el$, "paddingRight", 1);
40716
- setProp(_el$, "flexDirection", "column");
40717
- setProp(_el$2, "wrapMode", "none");
40718
- insert(_el$2, () => `${SPINNER_FRAMES2[props.spin() % SPINNER_FRAMES2.length]} thinking \xB7 ${elapsed() ?? "0.0s"}`);
40719
- insert(_el$, createComponent2(For, {
40720
- get each() {
40721
- return tail();
40722
- },
40723
- children: (line) => (() => {
40724
- var _el$7 = createElement("text");
40725
- setProp(_el$7, "wrapMode", "none");
40726
- insert(_el$7, line);
40727
- effect((_$p) => setProp(_el$7, "fg", props.color.text(), _$p));
40728
- return _el$7;
40729
- })()
40730
- }), null);
40731
- effect((_p$) => {
40732
- var _v$ = props.color.border(), _v$2 = props.color.spinner();
40733
- _v$ !== _p$.e && (_p$.e = setProp(_el$, "borderColor", _v$, _p$.e));
40734
- _v$2 !== _p$.t && (_p$.t = setProp(_el$2, "fg", _v$2, _p$.t));
40735
- return _p$;
40736
- }, {
40737
- e: undefined,
40738
- t: undefined
40739
- });
40740
- return _el$;
40741
- }
40742
- });
40743
- }
40744
- var SPINNER_FRAMES2, TAIL_LINES = 3;
40745
- var init_think_panel = __esm(() => {
40746
- init_index_bun();
40747
- init_index_bun();
40748
- init_index_bun();
40749
- init_index_bun();
40750
- init_index_bun();
40751
- init_index_bun();
40752
- init_index_bun();
40753
- init_server();
40754
- init_tool_summarize();
40755
- init_string_width();
40756
- SPINNER_FRAMES2 = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
40757
- });
40758
-
40759
40666
  // ../tui-base/src/routes/session/transcript.tsx
40760
40667
  import { SyntaxStyle as SyntaxStyle2 } from "@opentui/core";
40761
40668
  function Transcript(props) {
40762
40669
  const renderer = useRenderer();
40763
- const dimensions = useTerminalDimensions();
40764
40670
  const theme = useThemeOptional();
40765
40671
  const color = {
40766
40672
  text: () => theme?.text.base ?? "#e6e6e6",
@@ -40774,145 +40680,29 @@ function Transcript(props) {
40774
40680
  loading: () => theme?.text.feedback.info.base ?? "#565f89",
40775
40681
  background: () => theme?.background.base ?? "black"
40776
40682
  };
40777
- const stateColor = (state) => state === "running" ? color.running() : state === "ok" ? color.done() : state === "failed" ? color.failed() : color.reasoning();
40778
40683
  const sessionID = () => props.sessionID ?? props.seam.currentSessionId() ?? "";
40779
40684
  const owned = props.projection === undefined;
40780
40685
  const projection = props.projection ?? createSeamRows(props.seam, sessionID);
40781
40686
  const themes = useThemesOptional();
40782
40687
  const syntaxStyle = () => props.syntaxStyle ?? themes?.currentSyntax() ?? SyntaxStyle2.fromStyles({}, renderer.nativeScene);
40783
- const SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
40784
- const [spin, setSpin] = createSignal(0);
40785
- onMount(() => {
40786
- const timer = setInterval(() => setSpin((s) => s + 1), 120);
40787
- onCleanup(() => clearInterval(timer));
40788
- });
40789
- const toolRow = (row) => {
40790
- const subject = toolSubject(row.args);
40791
- const title = subject === "" ? row.name : `${row.name}(${subject})`;
40792
- const state = row.status === "failed" ? "failed" : row.status === "running" ? "running" : "ok";
40793
- const statusColor = stateColor(state);
40794
- const rail = row.status === "done" ? undefined : ["left"];
40795
- const titleLine = createMemo(() => {
40796
- const marker = row.status === "running" ? `${SPINNER_FRAMES[spin() % SPINNER_FRAMES.length]} ` : row.status === "failed" ? "\u2717 " : "\u2713 ";
40797
- const elapsed = row.status === "running" ? row.startedAt !== undefined ? ` \xB7 ${((Date.now() - row.startedAt) / 1000).toFixed(1)}s` : "" : row.elapsedSec !== undefined ? ` \xB7 ${row.elapsedSec.toFixed(1)}s` : "";
40798
- return clipToWidth(`${marker}${title}${elapsed}`, Math.max(16, dimensions().width - 5));
40799
- });
40800
- const track = row.status === "running" ? toolDetail(row.args) : toolResultLine(row.output);
40801
- return (() => {
40802
- var _el$ = createElement("box"), _el$2 = createElement("text");
40803
- insertNode(_el$, _el$2);
40804
- setProp(_el$, "flexShrink", 0);
40805
- setProp(_el$, "flexDirection", "column");
40806
- setProp(_el$, "border", rail);
40807
- setProp(_el$, "borderColor", statusColor);
40808
- setProp(_el$, "paddingLeft", rail ? 2 : 3);
40809
- setProp(_el$2, "fg", statusColor);
40810
- setProp(_el$2, "wrapMode", "none");
40811
- insert(_el$2, titleLine);
40812
- insert(_el$, createComponent2(Show, {
40813
- when: track !== "",
40814
- get children() {
40815
- var _el$3 = createElement("text");
40816
- setProp(_el$3, "wrapMode", "none");
40817
- insert(_el$3, () => ` \u23BF ${clipToWidth(track, Math.max(20, dimensions().width - 10))}`);
40818
- effect((_$p) => setProp(_el$3, "fg", row.status === "failed" ? color.failedMuted() : color.reasoning(), _$p));
40819
- return _el$3;
40820
- }
40821
- }), null);
40822
- return _el$;
40823
- })();
40824
- };
40825
- const thinkRow = (row) => {
40826
- if (row.streaming !== undefined) {
40827
- return createComponent2(ThinkPanelRow, {
40828
- row: () => row,
40829
- spin,
40830
- width: () => dimensions().width,
40831
- get color() {
40832
- return {
40833
- border: color.reasoningBorder,
40834
- spinner: color.running,
40835
- text: color.reasoning,
40836
- summaryAccent: color.done
40837
- };
40838
- }
40839
- });
40840
- }
40841
- return (() => {
40842
- var _el$4 = createElement("box"), _el$5 = createElement("text");
40843
- insertNode(_el$4, _el$5);
40844
- setProp(_el$4, "flexShrink", 0);
40845
- setProp(_el$4, "marginLeft", 3);
40846
- setProp(_el$4, "border", ["left"]);
40847
- setProp(_el$4, "paddingLeft", 1);
40848
- setProp(_el$5, "wrapMode", "word");
40849
- insert(_el$5, () => row.text);
40850
- effect((_p$) => {
40851
- var _v$ = color.reasoningBorder(), _v$2 = color.reasoning();
40852
- _v$ !== _p$.e && (_p$.e = setProp(_el$4, "borderColor", _v$, _p$.e));
40853
- _v$2 !== _p$.t && (_p$.t = setProp(_el$5, "fg", _v$2, _p$.t));
40854
- return _p$;
40855
- }, {
40856
- e: undefined,
40857
- t: undefined
40858
- });
40859
- return _el$4;
40860
- })();
40861
- };
40862
- const subagentsRow = (row) => {
40863
- const glyphs = {
40864
- running: () => `${SPINNER_FRAMES[spin() % SPINNER_FRAMES.length]} `,
40865
- completed: () => "\u2714 ",
40866
- failed: () => "\u2718 ",
40867
- cancelled: () => "\u2298 "
40868
- };
40869
- return (() => {
40870
- var _el$6 = createElement("box");
40871
- setProp(_el$6, "flexShrink", 0);
40872
- setProp(_el$6, "paddingLeft", 3);
40873
- setProp(_el$6, "flexDirection", "column");
40874
- insert(_el$6, createComponent2(For, {
40875
- get each() {
40876
- return row.children;
40877
- },
40878
- children: (child, index) => {
40879
- const track = index() === row.children.length - 1 ? "\u2514\u2500 " : "\u251C\u2500 ";
40880
- const statusColor = stateColor(child.status === "completed" ? "ok" : child.status === "failed" ? "failed" : child.status);
40881
- const label = `${track}${child.label}${child.model ? `(${child.model})` : ""}` + subagentMarkerSuffix(child);
40882
- const line = createMemo(() => {
40883
- const elapsed = child.status === "running" ? child.startedAt !== undefined ? ` \xB7 ${((Date.now() - child.startedAt) / 1000).toFixed(1)}s` : "" : child.elapsedSec !== undefined ? ` \xB7 ${child.elapsedSec.toFixed(1)}s` : "";
40884
- return clipToWidth(`${glyphs[child.status]()}${label}${elapsed}`, Math.max(16, dimensions().width - 5));
40885
- });
40886
- return (() => {
40887
- var _el$7 = createElement("text");
40888
- setProp(_el$7, "fg", statusColor);
40889
- setProp(_el$7, "wrapMode", "none");
40890
- insert(_el$7, line);
40891
- return _el$7;
40892
- })();
40893
- }
40894
- }));
40895
- return _el$6;
40896
- })();
40897
- };
40898
40688
  onMount(() => {
40899
40689
  if (owned)
40900
40690
  projection.load();
40901
40691
  });
40902
40692
  const assistantRow = (row) => (() => {
40903
- var _el$8 = createElement("markdown");
40904
- setProp(_el$8, "internalBlockMode", "top-level");
40905
- setProp(_el$8, "tableOptions", {
40693
+ var _el$ = createElement("markdown");
40694
+ setProp(_el$, "internalBlockMode", "top-level");
40695
+ setProp(_el$, "tableOptions", {
40906
40696
  style: "grid",
40907
40697
  cellPaddingX: 1
40908
40698
  });
40909
40699
  effect((_p$) => {
40910
- var _v$3 = props.renderNode, _v$4 = row.text, _v$5 = !row.final, _v$6 = syntaxStyle(), _v$7 = color.text();
40911
- _v$3 !== _p$.e && (_p$.e = setProp(_el$8, "renderNode", _v$3, _p$.e));
40912
- _v$4 !== _p$.t && (_p$.t = setProp(_el$8, "content", _v$4, _p$.t));
40913
- _v$5 !== _p$.a && (_p$.a = setProp(_el$8, "streaming", _v$5, _p$.a));
40914
- _v$6 !== _p$.o && (_p$.o = setProp(_el$8, "syntaxStyle", _v$6, _p$.o));
40915
- _v$7 !== _p$.i && (_p$.i = setProp(_el$8, "fg", _v$7, _p$.i));
40700
+ var _v$ = props.renderNode, _v$2 = row.text, _v$3 = !row.final, _v$4 = syntaxStyle(), _v$5 = color.text();
40701
+ _v$ !== _p$.e && (_p$.e = setProp(_el$, "renderNode", _v$, _p$.e));
40702
+ _v$2 !== _p$.t && (_p$.t = setProp(_el$, "content", _v$2, _p$.t));
40703
+ _v$3 !== _p$.a && (_p$.a = setProp(_el$, "streaming", _v$3, _p$.a));
40704
+ _v$4 !== _p$.o && (_p$.o = setProp(_el$, "syntaxStyle", _v$4, _p$.o));
40705
+ _v$5 !== _p$.i && (_p$.i = setProp(_el$, "fg", _v$5, _p$.i));
40916
40706
  return _p$;
40917
40707
  }, {
40918
40708
  e: undefined,
@@ -40921,99 +40711,101 @@ function Transcript(props) {
40921
40711
  o: undefined,
40922
40712
  i: undefined
40923
40713
  });
40924
- return _el$8;
40714
+ return _el$;
40925
40715
  })();
40716
+ const visibleRows = createMemo(() => projection.rows.filter((row) => row.kind !== "tool" && row.kind !== "reasoning" && row.kind !== "subagents"));
40926
40717
  const rowView = (row) => {
40927
40718
  switch (row.kind) {
40928
40719
  case "user":
40929
40720
  return (() => {
40930
- var _el$9 = createElement("box"), _el$0 = createElement("text");
40931
- insertNode(_el$9, _el$0);
40932
- setProp(_el$9, "flexShrink", 0);
40933
- setProp(_el$9, "paddingLeft", 3);
40934
- setProp(_el$0, "wrapMode", "word");
40935
- insert(_el$0, () => `\u276F ${row.text}`);
40936
- effect((_$p) => setProp(_el$0, "fg", color.user(), _$p));
40937
- return _el$9;
40721
+ var _el$2 = createElement("box"), _el$3 = createElement("text");
40722
+ insertNode(_el$2, _el$3);
40723
+ setProp(_el$2, "flexShrink", 0);
40724
+ setProp(_el$2, "paddingLeft", 3);
40725
+ setProp(_el$3, "wrapMode", "word");
40726
+ insert(_el$3, () => `\u276F ${row.text}`);
40727
+ effect((_$p) => setProp(_el$3, "fg", color.user(), _$p));
40728
+ return _el$2;
40938
40729
  })();
40939
- case "reasoning":
40940
- return thinkRow(row);
40941
- case "tool":
40942
- return toolRow(row);
40943
- case "subagents":
40944
- return subagentsRow(row);
40945
40730
  case "assistant":
40946
40731
  return assistantRow(row);
40732
+ default:
40733
+ return null;
40947
40734
  }
40948
40735
  };
40949
40736
  onCleanup(() => {
40950
40737
  props.scrollRef?.(undefined);
40951
40738
  });
40952
40739
  return (() => {
40953
- var _el$1 = createElement("box"), _el$10 = createElement("box"), _el$11 = createElement("box"), _el$12 = createElement("scrollbox");
40954
- insertNode(_el$1, _el$10);
40955
- setProp(_el$1, "flexDirection", "column");
40956
- setProp(_el$1, "flexGrow", 1);
40957
- setProp(_el$1, "minHeight", 0);
40958
- setProp(_el$1, "width", "100%");
40959
- insertNode(_el$10, _el$11);
40960
- setProp(_el$10, "flexDirection", "row");
40961
- setProp(_el$10, "flexGrow", 1);
40962
- setProp(_el$10, "minHeight", 0);
40963
- insertNode(_el$11, _el$12);
40964
- setProp(_el$11, "flexGrow", 1);
40965
- setProp(_el$11, "minHeight", 0);
40966
- setProp(_el$11, "position", "relative");
40967
- setProp(_el$11, "paddingBottom", 1);
40740
+ var _el$4 = createElement("box"), _el$5 = createElement("box"), _el$6 = createElement("box"), _el$7 = createElement("scrollbox");
40741
+ insertNode(_el$4, _el$5);
40742
+ setProp(_el$4, "flexDirection", "column");
40743
+ setProp(_el$4, "flexGrow", 1);
40744
+ setProp(_el$4, "minHeight", 0);
40745
+ setProp(_el$4, "width", "100%");
40746
+ insertNode(_el$5, _el$6);
40747
+ setProp(_el$5, "flexDirection", "row");
40748
+ setProp(_el$5, "flexGrow", 1);
40749
+ setProp(_el$5, "minHeight", 0);
40750
+ insertNode(_el$6, _el$7);
40751
+ setProp(_el$6, "flexGrow", 1);
40752
+ setProp(_el$6, "minHeight", 0);
40753
+ setProp(_el$6, "position", "relative");
40754
+ setProp(_el$6, "paddingBottom", 1);
40968
40755
  use((value) => {
40969
40756
  props.scrollRef?.(value);
40970
- }, _el$12);
40971
- setProp(_el$12, "flexGrow", 1);
40972
- setProp(_el$12, "overflow", "hidden");
40973
- setProp(_el$12, "stickyScroll", true);
40974
- setProp(_el$12, "stickyStart", "bottom");
40975
- insert(_el$12, createComponent2(For, {
40757
+ }, _el$7);
40758
+ setProp(_el$7, "flexGrow", 1);
40759
+ setProp(_el$7, "overflow", "hidden");
40760
+ setProp(_el$7, "stickyScroll", true);
40761
+ setProp(_el$7, "stickyStart", "bottom");
40762
+ insert(_el$7, createComponent2(For, {
40976
40763
  get each() {
40977
- return projection.rows;
40764
+ return visibleRows();
40978
40765
  },
40979
40766
  children: (row) => (() => {
40980
- var _el$17 = createElement("box");
40981
- setProp(_el$17, "marginTop", 1);
40982
- setProp(_el$17, "flexShrink", 0);
40983
- insert(_el$17, () => rowView(row));
40984
- effect((_$p) => setProp(_el$17, "id", `seam-row-${row.key}`, _$p));
40985
- return _el$17;
40767
+ var _el$10 = createElement("box");
40768
+ setProp(_el$10, "marginTop", 1);
40769
+ setProp(_el$10, "flexShrink", 0);
40770
+ insert(_el$10, () => rowView(row));
40771
+ effect((_$p) => setProp(_el$10, "id", `seam-row-${row.key}`, _$p));
40772
+ return _el$10;
40986
40773
  })()
40987
40774
  }), null);
40988
- insert(_el$12, createComponent2(Show, {
40775
+ insert(_el$7, createComponent2(Show, {
40989
40776
  get when() {
40990
40777
  return projection.hydrated() === false;
40991
40778
  },
40992
40779
  get children() {
40993
- var _el$13 = createElement("box"), _el$14 = createElement("text");
40994
- insertNode(_el$13, _el$14);
40995
- setProp(_el$13, "flexShrink", 0);
40996
- insertNode(_el$14, createTextNode(`Loading session history\u2026`));
40997
- effect((_$p) => setProp(_el$14, "fg", color.loading(), _$p));
40998
- return _el$13;
40780
+ var _el$8 = createElement("box"), _el$9 = createElement("text");
40781
+ insertNode(_el$8, _el$9);
40782
+ setProp(_el$8, "flexShrink", 0);
40783
+ insertNode(_el$9, createTextNode(`Loading session history\u2026`));
40784
+ effect((_$p) => setProp(_el$9, "fg", color.loading(), _$p));
40785
+ return _el$8;
40999
40786
  }
41000
40787
  }), null);
41001
- insert(_el$1, createComponent2(Show, {
40788
+ insert(_el$4, createComponent2(Show, {
41002
40789
  get when() {
41003
- return props.children;
40790
+ return props.status || props.widgets || props.children || props.footer || props.notices;
41004
40791
  },
41005
40792
  get children() {
41006
- var _el$16 = createElement("box");
41007
- setProp(_el$16, "width", "100%");
41008
- setProp(_el$16, "flexShrink", 0);
41009
- insert(_el$16, () => props.children);
41010
- return _el$16;
40793
+ var _el$1 = createElement("box");
40794
+ setProp(_el$1, "width", "100%");
40795
+ setProp(_el$1, "flexShrink", 0);
40796
+ setProp(_el$1, "flexDirection", "column");
40797
+ insert(_el$1, () => props.status, null);
40798
+ insert(_el$1, () => props.widgets, null);
40799
+ insert(_el$1, () => props.children, null);
40800
+ insert(_el$1, () => props.footer, null);
40801
+ insert(_el$1, () => props.notices, null);
40802
+ return _el$1;
41011
40803
  }
41012
40804
  }), null);
41013
40805
  effect((_p$) => {
41014
- var _v$8 = color.background(), _v$9 = {
40806
+ var _v$6 = color.background(), _v$7 = {
41015
40807
  paddingRight: props.scrollbar ? 1 : 0
41016
- }, _v$0 = {
40808
+ }, _v$8 = {
41017
40809
  paddingLeft: 1,
41018
40810
  visible: props.scrollbar ?? false,
41019
40811
  trackOptions: {
@@ -41021,16 +40813,16 @@ function Transcript(props) {
41021
40813
  foregroundColor: color.reasoningBorder()
41022
40814
  }
41023
40815
  };
41024
- _v$8 !== _p$.e && (_p$.e = setProp(_el$1, "backgroundColor", _v$8, _p$.e));
41025
- _v$9 !== _p$.t && (_p$.t = setProp(_el$12, "viewportOptions", _v$9, _p$.t));
41026
- _v$0 !== _p$.a && (_p$.a = setProp(_el$12, "verticalScrollbarOptions", _v$0, _p$.a));
40816
+ _v$6 !== _p$.e && (_p$.e = setProp(_el$4, "backgroundColor", _v$6, _p$.e));
40817
+ _v$7 !== _p$.t && (_p$.t = setProp(_el$7, "viewportOptions", _v$7, _p$.t));
40818
+ _v$8 !== _p$.a && (_p$.a = setProp(_el$7, "verticalScrollbarOptions", _v$8, _p$.a));
41027
40819
  return _p$;
41028
40820
  }, {
41029
40821
  e: undefined,
41030
40822
  t: undefined,
41031
40823
  a: undefined
41032
40824
  });
41033
- return _el$1;
40825
+ return _el$4;
41034
40826
  })();
41035
40827
  }
41036
40828
  var init_transcript = __esm(() => {
@@ -41042,13 +40834,362 @@ var init_transcript = __esm(() => {
41042
40834
  init_index_bun();
41043
40835
  init_index_bun();
41044
40836
  init_index_bun();
40837
+ init_index_bun();
41045
40838
  init_server();
41046
40839
  init_index_bun();
41047
40840
  init_seam_rows();
40841
+ init_theme2();
40842
+ });
40843
+
40844
+ // ../tui-base/src/util/todo.ts
40845
+ function parseTodos(value) {
40846
+ if (!Array.isArray(value))
40847
+ return [];
40848
+ return value.flatMap((item) => {
40849
+ if (!isRecord4(item) || typeof item.content !== "string" || !item.content)
40850
+ return [];
40851
+ return [{ content: item.content, status: statuses.has(item.status) ? item.status : "pending" }];
40852
+ });
40853
+ }
40854
+ var statuses;
40855
+ var init_todo = __esm(() => {
40856
+ statuses = new Set(["pending", "in_progress", "completed", "cancelled"]);
40857
+ });
40858
+
40859
+ // ../tui-base/src/routes/session/widgets-dock.tsx
40860
+ import { TextAttributes as TextAttributes4 } from "@opentui/core";
40861
+ function todoArray(text) {
40862
+ if (text === undefined || text.trim() === "")
40863
+ return;
40864
+ try {
40865
+ const parsed = JSON.parse(text);
40866
+ if (Array.isArray(parsed))
40867
+ return parsed;
40868
+ if (parsed !== null && typeof parsed === "object" && Array.isArray(parsed.todos)) {
40869
+ return parsed.todos;
40870
+ }
40871
+ } catch {}
40872
+ return;
40873
+ }
40874
+ function todosSummaryLine(output) {
40875
+ const todos = parseTodos(todoArray(output) ?? []);
40876
+ if (todos.length === 0)
40877
+ return "";
40878
+ const done = todos.filter((t) => t.status === "completed").length;
40879
+ if (done === todos.length)
40880
+ return "";
40881
+ const active = todos.find((t) => t.status === "in_progress");
40882
+ const head = `todos [\u2713]${done}/${todos.length}`;
40883
+ return active ? `${head} \xB7 ${active.content}` : head;
40884
+ }
40885
+ function toolLineText(row, spin) {
40886
+ const subject = toolSubject(row.args);
40887
+ const title = subject === "" ? row.name : `${row.name}(${subject})`;
40888
+ const elapsed = row.status === "running" ? row.startedAt !== undefined ? ` \xB7 ${((Date.now() - row.startedAt) / 1000).toFixed(1)}s` : "" : row.elapsedSec !== undefined ? ` \xB7 ${row.elapsedSec.toFixed(1)}s` : "";
40889
+ const marker = row.status === "running" ? SPINNER_FRAMES2[spin() % SPINNER_FRAMES2.length] : row.status === "failed" ? "\u2718" : "\u2714";
40890
+ const tail = row.status === "running" ? toolDetail(row.args) : toolResultLine(row.output);
40891
+ const body = `${title}${elapsed}${tail !== "" ? ` \xB7 ${tail}` : ""}`;
40892
+ return `${marker} \u2699 ${body}`;
40893
+ }
40894
+ function thinkLineText(row, spin) {
40895
+ const lines = row.text.replace(/\r/g, "").split(`
40896
+ `).filter((line) => line.trim() !== "");
40897
+ if (row.streaming === true) {
40898
+ const tail = lines[lines.length - 1] ?? "";
40899
+ const secs = row.startedAt !== undefined ? `${((Date.now() - row.startedAt) / 1000).toFixed(1)}s` : "0.0s";
40900
+ spin();
40901
+ return `\uD83D\uDCAD thinking \xB7 ${secs} \xB7 ${tail}`;
40902
+ }
40903
+ if (row.elapsedSec !== undefined) {
40904
+ const first = lines[0] ?? "";
40905
+ return `\uD83D\uDCAD thought \xB7 ${row.elapsedSec.toFixed(1)}s \xB7 ${first}`;
40906
+ }
40907
+ return;
40908
+ }
40909
+ function dockLines(rows) {
40910
+ const out = [];
40911
+ const all = rows;
40912
+ const todoTool = [...all].reverse().find((row) => row.kind === "tool" && TODO_TOOL_NAMES.has(row.name) && row.output !== undefined && row.status !== "failed");
40913
+ const todos = todoTool?.kind === "tool" ? todosSummaryLine(todoArray(todoTool.args) !== undefined ? todoTool.args : todoTool.output) : "";
40914
+ if (todos !== "")
40915
+ out.push({
40916
+ text: todos,
40917
+ tone: "muted"
40918
+ });
40919
+ const live = [...all].reverse().find((row) => row.kind === "reasoning" && row.streaming === true);
40920
+ const collapsed = [...all].reverse().find((row) => row.kind === "reasoning" && row.elapsedSec !== undefined);
40921
+ const think = live?.kind === "reasoning" ? thinkLineText(live, dockSpin) : collapsed?.kind === "reasoning" ? thinkLineText(collapsed, dockSpin) : undefined;
40922
+ if (think !== undefined)
40923
+ out.push({
40924
+ text: think,
40925
+ tone: "running",
40926
+ italic: true
40927
+ });
40928
+ for (const row of all) {
40929
+ if (row.kind !== "tool" || !row.key.startsWith("tool:live:"))
40930
+ continue;
40931
+ if (row.faded === true && row.status !== "running")
40932
+ continue;
40933
+ out.push({
40934
+ text: toolLineText(row, dockSpin),
40935
+ tone: row.status === "running" ? "running" : row.status === "failed" ? "failed" : "ok"
40936
+ });
40937
+ }
40938
+ return out;
40939
+ }
40940
+ function WidgetsDock(props) {
40941
+ const dimensions = useTerminalDimensions();
40942
+ const theme = useThemeOptional();
40943
+ const fgFor = (tone) => tone === "running" ? theme?.text.feedback.warning.base ?? "#e0af68" : tone === "failed" ? theme?.text.feedback.error.base ?? "#f7768e" : tone === "ok" ? theme?.text.feedback.success.base ?? "#9ece6a" : theme?.text.muted ?? "#9aa5ce";
40944
+ onMount(() => {
40945
+ const timer = setInterval(() => setDockSpin((s) => s + 1), 120);
40946
+ onCleanup(() => clearInterval(timer));
40947
+ });
40948
+ const width = () => Math.max(16, dimensions().width - 4);
40949
+ return (() => {
40950
+ var _el$ = createElement("box");
40951
+ setProp(_el$, "flexShrink", 0);
40952
+ setProp(_el$, "flexDirection", "column");
40953
+ setProp(_el$, "width", "100%");
40954
+ setProp(_el$, "paddingLeft", 3);
40955
+ insert(_el$, createComponent2(For, {
40956
+ get each() {
40957
+ return dockLines(props.rows);
40958
+ },
40959
+ children: (line) => (() => {
40960
+ var _el$2 = createElement("text");
40961
+ setProp(_el$2, "wrapMode", "none");
40962
+ insert(_el$2, () => clipToWidth(line.text, width()));
40963
+ effect((_p$) => {
40964
+ var _v$ = fgFor(line.tone), _v$2 = line.italic === true ? TextAttributes4.ITALIC : undefined;
40965
+ _v$ !== _p$.e && (_p$.e = setProp(_el$2, "fg", _v$, _p$.e));
40966
+ _v$2 !== _p$.t && (_p$.t = setProp(_el$2, "attributes", _v$2, _p$.t));
40967
+ return _p$;
40968
+ }, {
40969
+ e: undefined,
40970
+ t: undefined
40971
+ });
40972
+ return _el$2;
40973
+ })()
40974
+ }));
40975
+ effect((_$p) => setProp(_el$, "height", dockLines(props.rows).length, _$p));
40976
+ return _el$;
40977
+ })();
40978
+ }
40979
+ var SPINNER_FRAMES2, dockSpin, setDockSpin, TODO_TOOL_NAMES;
40980
+ var init_widgets_dock = __esm(() => {
40981
+ init_index_bun();
40982
+ init_index_bun();
40983
+ init_index_bun();
40984
+ init_index_bun();
40985
+ init_index_bun();
40986
+ init_server();
40987
+ init_index_bun();
40988
+ init_tool_summarize();
40989
+ init_todo();
40990
+ init_theme2();
40991
+ SPINNER_FRAMES2 = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
40992
+ [dockSpin, setDockSpin] = createSignal(0);
40993
+ TODO_TOOL_NAMES = new Set(["todowrite", "todo_write"]);
40994
+ });
40995
+
40996
+ // ../tui-base/src/routes/session/lastrequest-dock.tsx
40997
+ function requestEchoLine(text) {
40998
+ if (text === undefined || text.trim() === "")
40999
+ return;
41000
+ const first = text.replace(/\r/g, "").split(`
41001
+ `)[0] ?? text;
41002
+ if (first.trim() === "")
41003
+ return;
41004
+ return `\u25CF ${first}`;
41005
+ }
41006
+ function childLineText(child, isLast, spin) {
41007
+ const track = isLast ? "\u2514\u2500 " : "\u251C\u2500 ";
41008
+ const glyph = `${SPINNER_FRAMES3[spin() % SPINNER_FRAMES3.length]} `;
41009
+ const elapsed = child.startedAt !== undefined ? ` \xB7 ${((Date.now() - child.startedAt) / 1000).toFixed(1)}s` : "";
41010
+ const tail = child.lastLine !== undefined ? ` \xB7 ${child.lastLine.split(`
41011
+ `).pop()?.trim()}` : "";
41012
+ return `${track}${glyph}${child.label}${elapsed}${tail}`;
41013
+ }
41014
+ function lastRequestLines(rows, request) {
41015
+ const out = [];
41016
+ const echo = requestEchoLine(request);
41017
+ if (echo !== undefined)
41018
+ out.push({
41019
+ text: echo,
41020
+ tone: "muted"
41021
+ });
41022
+ const tree = [...rows].reverse().find((row) => row.kind === "subagents");
41023
+ if (tree?.kind === "subagents") {
41024
+ const running = tree.children.filter((child) => child.status === "running");
41025
+ running.forEach((child, index) => {
41026
+ out.push({
41027
+ text: childLineText(child, index === running.length - 1, dockSpin),
41028
+ tone: "running"
41029
+ });
41030
+ });
41031
+ }
41032
+ return out;
41033
+ }
41034
+ function LastRequestDock(props) {
41035
+ const dimensions = useTerminalDimensions();
41036
+ const theme = useThemeOptional();
41037
+ const fgFor = (tone) => tone === "running" ? theme?.text.feedback.warning.base ?? "#e0af68" : theme?.text.muted ?? "#9aa5ce";
41038
+ const width = () => Math.max(16, dimensions().width - 5);
41039
+ const lines = () => lastRequestLines(props.rows, props.lastRequest);
41040
+ return (() => {
41041
+ var _el$ = createElement("box");
41042
+ setProp(_el$, "flexShrink", 0);
41043
+ setProp(_el$, "flexDirection", "column");
41044
+ setProp(_el$, "width", "100%");
41045
+ setProp(_el$, "paddingLeft", 3);
41046
+ insert(_el$, createComponent2(For, {
41047
+ get each() {
41048
+ return lines();
41049
+ },
41050
+ children: (line) => (() => {
41051
+ var _el$2 = createElement("text");
41052
+ setProp(_el$2, "wrapMode", "none");
41053
+ insert(_el$2, () => clipToWidth(line.text, width()));
41054
+ effect((_$p) => setProp(_el$2, "fg", fgFor(line.tone), _$p));
41055
+ return _el$2;
41056
+ })()
41057
+ }));
41058
+ effect((_$p) => setProp(_el$, "height", lines().length, _$p));
41059
+ return _el$;
41060
+ })();
41061
+ }
41062
+ var SPINNER_FRAMES3;
41063
+ var init_lastrequest_dock = __esm(() => {
41064
+ init_index_bun();
41065
+ init_index_bun();
41066
+ init_index_bun();
41067
+ init_index_bun();
41068
+ init_index_bun();
41069
+ init_server();
41070
+ init_index_bun();
41071
+ init_tool_summarize();
41072
+ init_theme2();
41073
+ init_widgets_dock();
41074
+ SPINNER_FRAMES3 = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
41075
+ });
41076
+
41077
+ // ../tui-base/src/routes/session/notices-dock.tsx
41078
+ function retireNotice(id) {
41079
+ const timer = timers.get(id);
41080
+ if (timer !== undefined)
41081
+ clearTimeout(timer);
41082
+ timers.delete(id);
41083
+ setNotices((list) => list.filter((notice) => notice.id !== id));
41084
+ }
41085
+ function showNotice(text, ttlMs = NOTICE_AUTO_DISMISS_MS) {
41086
+ const line = text.replace(/\r?\n/g, " ").trim();
41087
+ if (line === "")
41088
+ return -1;
41089
+ const id = ++ordinal;
41090
+ while (notices().length >= NOTICE_MAX_LINES) {
41091
+ const oldest = notices()[0];
41092
+ if (oldest === undefined)
41093
+ break;
41094
+ retireNotice(oldest.id);
41095
+ }
41096
+ setNotices((list) => [...list, {
41097
+ id,
41098
+ text: line
41099
+ }]);
41100
+ const timer = setTimeout(() => retireNotice(id), ttlMs);
41101
+ timer.unref?.();
41102
+ timers.set(id, timer);
41103
+ return id;
41104
+ }
41105
+ function noticeLines(list, width) {
41106
+ return list.map((notice) => clipToWidth(notice.text, Math.max(8, width)));
41107
+ }
41108
+ function NoticesDock() {
41109
+ const dimensions = useTerminalDimensions();
41110
+ const theme = useThemeOptional();
41111
+ return (() => {
41112
+ var _el$ = createElement("box");
41113
+ setProp(_el$, "flexShrink", 0);
41114
+ setProp(_el$, "flexDirection", "column");
41115
+ setProp(_el$, "width", "100%");
41116
+ setProp(_el$, "paddingLeft", 1);
41117
+ insert(_el$, createComponent2(For, {
41118
+ get each() {
41119
+ return noticeLines(notices(), dimensions().width - 2);
41120
+ },
41121
+ children: (line) => (() => {
41122
+ var _el$2 = createElement("text");
41123
+ setProp(_el$2, "wrapMode", "none");
41124
+ insert(_el$2, line);
41125
+ effect((_$p) => setProp(_el$2, "fg", theme?.text.muted ?? "#9aa5ce", _$p));
41126
+ return _el$2;
41127
+ })()
41128
+ }));
41129
+ effect((_$p) => setProp(_el$, "height", notices().length, _$p));
41130
+ return _el$;
41131
+ })();
41132
+ }
41133
+ var NOTICE_AUTO_DISMISS_MS = 8000, NOTICE_MAX_LINES = 8, notices, setNotices, timers, ordinal = 0;
41134
+ var init_notices_dock = __esm(() => {
41135
+ init_index_bun();
41136
+ init_index_bun();
41137
+ init_index_bun();
41138
+ init_index_bun();
41139
+ init_index_bun();
41140
+ init_server();
41141
+ init_index_bun();
41048
41142
  init_tool_summarize();
41049
- init_subagent_markers();
41050
- init_think_panel();
41051
41143
  init_theme2();
41144
+ [notices, setNotices] = createSignal([]);
41145
+ timers = new Map;
41146
+ });
41147
+
41148
+ // ../tui-base/src/routes/session/hints-line.tsx
41149
+ function hintsText(busy, shown = true, subagentsLive = false) {
41150
+ if (!shown)
41151
+ return "";
41152
+ const parts = [...busy ? BUSY_HINTS : IDLE_HINTS, ...subagentsLive ? ["\u2193 subagents"] : [], ...COMMON_HINTS];
41153
+ return `\u2328 ${parts.join(" \xB7 ")}`;
41154
+ }
41155
+ function HintsLine(props) {
41156
+ const dimensions = useTerminalDimensions();
41157
+ const theme = useThemeOptional();
41158
+ return createComponent2(Show, {
41159
+ get when() {
41160
+ return hintsShown();
41161
+ },
41162
+ get children() {
41163
+ var _el$ = createElement("box"), _el$2 = createElement("text");
41164
+ insertNode(_el$, _el$2);
41165
+ setProp(_el$, "flexShrink", 0);
41166
+ setProp(_el$, "height", 1);
41167
+ setProp(_el$, "width", "100%");
41168
+ setProp(_el$, "paddingLeft", 1);
41169
+ setProp(_el$2, "wrapMode", "none");
41170
+ insert(_el$2, () => clipToWidth(hintsText(props.busy, hintsShown(), subagentMarkerViews().some((v) => v.status === "running")), Math.max(8, dimensions().width - 2)));
41171
+ effect((_$p) => setProp(_el$2, "fg", theme?.text.faint ?? "#565f89", _$p));
41172
+ return _el$;
41173
+ }
41174
+ });
41175
+ }
41176
+ var hintsShown, setHintsShown, IDLE_HINTS, BUSY_HINTS, COMMON_HINTS;
41177
+ var init_hints_line = __esm(() => {
41178
+ init_index_bun();
41179
+ init_index_bun();
41180
+ init_index_bun();
41181
+ init_index_bun();
41182
+ init_index_bun();
41183
+ init_index_bun();
41184
+ init_server();
41185
+ init_index_bun();
41186
+ init_tool_summarize();
41187
+ init_theme2();
41188
+ init_subagent_markers();
41189
+ [hintsShown, setHintsShown] = createSignal(true);
41190
+ IDLE_HINTS = ["enter send", "alt+enter newline", "\u2191\u2193 history"];
41191
+ BUSY_HINTS = ["enter steer", "esc stop"];
41192
+ COMMON_HINTS = ["ctrl+shift+f search", "pgup/pgdn scroll", "ctrl+c \xD72 quit"];
41052
41193
  });
41053
41194
 
41054
41195
  // ../tui-base/src/routes/session/search-overlay.tsx
@@ -44550,6 +44691,14 @@ function coreCommands() {
44550
44691
  ctx.say(`thinking \u2192 ${picked} (next turn)`);
44551
44692
  }
44552
44693
  },
44694
+ {
44695
+ name: "/hints",
44696
+ description: "toggle the key hints row",
44697
+ run(ctx) {
44698
+ setHintsShown((shown) => !shown);
44699
+ ctx.say(hintsShown() ? "key hints: on" : "key hints: off");
44700
+ }
44701
+ },
44553
44702
  {
44554
44703
  name: "/hotkeys",
44555
44704
  description: "show keybinds",
@@ -44722,6 +44871,7 @@ var AGENTS_PROFILES_KEY = "agentsProfiles", AGENTS_PROFILES_VERSION = 1;
44722
44871
  var init_commands = __esm(() => {
44723
44872
  init_hotkeys();
44724
44873
  init_login();
44874
+ init_hints_line();
44725
44875
  });
44726
44876
 
44727
44877
  // ../tui-base/src/routes/session/slash-palette.tsx
@@ -44949,7 +45099,7 @@ function SessionsSearch(props) {
44949
45099
  setBusy(true);
44950
45100
  try {
44951
45101
  const found = await props.seam.searchSessions(needle);
44952
- setHits(found.slice(0, ROW_CAP2));
45102
+ setHits(found.slice(0, ROW_CAP));
44953
45103
  } catch {
44954
45104
  setHits([]);
44955
45105
  } finally {
@@ -45096,7 +45246,7 @@ function SessionsSearch(props) {
45096
45246
  }
45097
45247
  });
45098
45248
  }
45099
- var bridgeOpen, setBridgeOpen, ROW_CAP2 = 8;
45249
+ var bridgeOpen, setBridgeOpen, ROW_CAP = 8;
45100
45250
  var init_sessions_search = __esm(() => {
45101
45251
  init_index_bun();
45102
45252
  init_index_bun();
@@ -45772,10 +45922,6 @@ function sessionFooterSegments(data) {
45772
45922
  add(messagesSegment(data.messages ?? 0, theme));
45773
45923
  add(toolSegment(data.tools ?? 0, theme));
45774
45924
  add(speedSegment(data.tps ?? null, theme));
45775
- add({
45776
- text: "Ctrl+Shift+F: search",
45777
- bg: resolvePalette(theme).thinking.off
45778
- });
45779
45925
  return segs;
45780
45926
  }
45781
45927
  var POWERLINE_COLORS, AUTO_FG_DARK = "#1a1a2e", AUTO_FG_LIGHT = "#ffffff";
@@ -45907,7 +46053,8 @@ function StatusBar(props) {
45907
46053
  paddingLeft: 1,
45908
46054
  paddingRight: 1,
45909
46055
  height: 1,
45910
- flexGrow: 0
46056
+ flexGrow: 0,
46057
+ flexShrink: 0
45911
46058
  });
45912
46059
  insert(_el$, createComponent2(For, {
45913
46060
  get each() {
@@ -45954,6 +46101,7 @@ var init_status_bar = __esm(() => {
45954
46101
  // src/client/session-seam-adapter.ts
45955
46102
  var exports_session_seam_adapter = {};
45956
46103
  __export(exports_session_seam_adapter, {
46104
+ NOTICE_SOURCE_KINDS: () => NOTICE_SOURCE_KINDS,
45957
46105
  RemoteSessionSeam: () => RemoteSessionSeam,
45958
46106
  projectJournalRecord: () => projectJournalRecord
45959
46107
  });
@@ -46188,7 +46336,8 @@ class RemoteSessionSeam {
46188
46336
  ...v.startedAt !== undefined ? v.status === "running" ? { startedAt: v.startedAt } : { elapsedSec: Number(((Date.now() - v.startedAt) / 1000).toFixed(1)) } : {},
46189
46337
  ...v.injectedRound !== undefined ? { injectedRound: v.injectedRound } : {},
46190
46338
  ...v.hardStopRound !== undefined ? { hardStopRound: v.hardStopRound } : {},
46191
- ...v.spinStopRound !== undefined ? { spinStopRound: v.spinStopRound } : {}
46339
+ ...v.spinStopRound !== undefined ? { spinStopRound: v.spinStopRound } : {},
46340
+ ...v.lastLine !== undefined ? { lastLine: v.lastLine } : {}
46192
46341
  }));
46193
46342
  }
46194
46343
  subagentViews() {
@@ -46250,7 +46399,15 @@ function projectJournalRecord(entry, sessionId) {
46250
46399
  if (!text)
46251
46400
  return [];
46252
46401
  const id = typeof entry.data.messageID === "string" ? entry.data.messageID : `journal-${entry.seq}`;
46253
- return [{ type: "message.updated", details: { id, role: "user", text, sessionID: sessionId } }];
46402
+ const source = entry.data.source;
46403
+ const kind = source !== null && typeof source === "object" ? source.kind : undefined;
46404
+ if (kind === undefined || kind === "user") {
46405
+ return [{ type: "message.updated", details: { id, role: "user", text, sessionID: sessionId } }];
46406
+ }
46407
+ if (typeof kind === "string" && NOTICE_SOURCE_KINDS.has(kind)) {
46408
+ return [{ type: "message.updated", details: { id, role: "notice", text, sessionID: sessionId } }];
46409
+ }
46410
+ return [];
46254
46411
  }
46255
46412
  if (entry.type === "assistant/message") {
46256
46413
  const text = assistantTextValue(entry.data);
@@ -46279,7 +46436,8 @@ function blocksText2(content) {
46279
46436
  if (typeof block === "object" && block !== null && block.type === "text") {
46280
46437
  const value = block.text;
46281
46438
  if (typeof value === "string")
46282
- text += value;
46439
+ text += (text === "" ? "" : `
46440
+ `) + value;
46283
46441
  }
46284
46442
  }
46285
46443
  return text.trim();
@@ -46289,10 +46447,12 @@ function assistantTextValue(data) {
46289
46447
  return data.text.trim();
46290
46448
  return blocksText2(data.content ?? data.parts);
46291
46449
  }
46450
+ var NOTICE_SOURCE_KINDS;
46292
46451
  var init_session_seam_adapter = __esm(() => {
46293
46452
  init_remote_follow();
46294
46453
  init_subagent_markers();
46295
46454
  init_server();
46455
+ NOTICE_SOURCE_KINDS = new Set(["subagent-settled", "agent-message", "team-message", "webhook"]);
46296
46456
  });
46297
46457
 
46298
46458
  // ../tui-base/examples/v2-entry.tsx
@@ -46341,10 +46501,12 @@ function V2SessionPage(props) {
46341
46501
  onCleanup(() => clearInterval(timer));
46342
46502
  });
46343
46503
  const elapsed = () => busy() ? Math.max(0, Math.floor((now().getTime() - busySince()) / 1000)) : 0;
46504
+ const [lastRequest, setLastRequest] = createSignal();
46344
46505
  const send = (text) => {
46345
46506
  setMsgs((n) => n + 1);
46346
46507
  setTurnBusy(true);
46347
46508
  setBusySince(Date.now());
46509
+ setLastRequest(text);
46348
46510
  const done = projection.send(text);
46349
46511
  done.finally(() => setTurnBusy(false));
46350
46512
  return done;
@@ -46407,12 +46569,16 @@ function V2SessionPage(props) {
46407
46569
  type: "message.part.updated",
46408
46570
  details: { messageID: "cmd", part: { type: "text", id: `cmd-${++cmdOrdinal}`, text } }
46409
46571
  });
46410
- registerSubagentSteerFeedback(sayLine);
46572
+ registerSubagentSteerFeedback((line) => void showNotice(line));
46411
46573
  const slash = createSlashHost({
46412
46574
  seam,
46413
46575
  say: sayLine,
46414
- clear: () => projection.hydrate([]),
46576
+ clear: () => {
46577
+ projection.hydrate([]);
46578
+ setLastRequest(undefined);
46579
+ },
46415
46580
  reload: () => {
46581
+ setLastRequest(undefined);
46416
46582
  const settled = projection.load();
46417
46583
  seam.currentModelSelection().then(setModel);
46418
46584
  refreshPresetLabel();
@@ -46495,10 +46661,31 @@ function V2SessionPage(props) {
46495
46661
  seam,
46496
46662
  projection,
46497
46663
  scrollRef: (value) => transcriptScroll = value,
46664
+ status: createComponent2(StatusBar, {
46665
+ get phase() {
46666
+ return busy() ? "stream" : null;
46667
+ },
46668
+ elapsed
46669
+ }),
46670
+ widgets: createComponent2(WidgetsDock, {
46671
+ get rows() {
46672
+ return projection.rows;
46673
+ }
46674
+ }),
46675
+ footer: createComponent2(LastRequestDock, {
46676
+ get rows() {
46677
+ return projection.rows;
46678
+ },
46679
+ get lastRequest() {
46680
+ return lastRequest();
46681
+ }
46682
+ }),
46683
+ notices: createComponent2(NoticesDock, {}),
46498
46684
  get children() {
46499
46685
  return createComponent2(SessionComposer, {
46500
46686
  seam,
46501
46687
  send,
46688
+ footerHint: false,
46502
46689
  onBusyChange: setComposerBusy,
46503
46690
  ref: (r) => composerRef = r,
46504
46691
  slashKeyFilter: slash.slashKeyFilter,
@@ -46525,12 +46712,6 @@ function V2SessionPage(props) {
46525
46712
  enabled: () => dialog.stack.length === 0,
46526
46713
  escapeYields: () => slash.controller.open
46527
46714
  }),
46528
- createComponent2(StatusBar, {
46529
- get phase() {
46530
- return busy() ? "stream" : null;
46531
- },
46532
- elapsed
46533
- }),
46534
46715
  createComponent2(PowerlineFooter, {
46535
46716
  get left() {
46536
46717
  return segments();
@@ -46540,6 +46721,11 @@ function V2SessionPage(props) {
46540
46721
  },
46541
46722
  theme
46542
46723
  }),
46724
+ createComponent2(HintsLine, {
46725
+ get busy() {
46726
+ return busy();
46727
+ }
46728
+ }),
46543
46729
  overlayHost
46544
46730
  ];
46545
46731
  }
@@ -46668,6 +46854,10 @@ var init_v2_entry = __esm(() => {
46668
46854
  init_subagent_markers();
46669
46855
  init_seam_rows();
46670
46856
  init_transcript();
46857
+ init_widgets_dock();
46858
+ init_lastrequest_dock();
46859
+ init_notices_dock();
46860
+ init_hints_line();
46671
46861
  init_search_overlay();
46672
46862
  init_transcript_scroll();
46673
46863
  init_turn_cancel();