@aiwayds/dsh-opentui 0.19.1 → 0.20.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.
@@ -23192,6 +23192,8 @@ var init_keybind = __esm(() => {
23192
23192
  "session.line.down": keybind("ctrl+alt+e", "Scroll messages down by one line"),
23193
23193
  "session.half.page.up": keybind("ctrl+alt+u", "Scroll messages up by half page"),
23194
23194
  "session.half.page.down": keybind("ctrl+alt+d", "Scroll messages down by half page"),
23195
+ "session.dock.scroll.up": keybind("ctrl+alt+up", "Scroll the activity lower zone up"),
23196
+ "session.dock.scroll.down": keybind("ctrl+alt+down", "Scroll the activity lower zone down"),
23195
23197
  "session.first": keybind("ctrl+home,home,alt+home", "Navigate to first message"),
23196
23198
  "session.last": keybind("ctrl+alt+g,end", "Navigate to last message"),
23197
23199
  "session.message.next": keybind("none", "Navigate to next message"),
@@ -48559,7 +48561,7 @@ function brandSegment(theme, presetLabel, mode = "dark") {
48559
48561
  function providerSegment(provider, theme, mode = "dark") {
48560
48562
  if (!provider)
48561
48563
  return null;
48562
- const label = `\u2601\uFE0F ${provider}`;
48564
+ const label = `\uD83C\uDF10 ${provider}`;
48563
48565
  if (!theme)
48564
48566
  return {
48565
48567
  text: label,
@@ -49003,6 +49005,303 @@ var init_powerline = __esm(() => {
49003
49005
  };
49004
49006
  });
49005
49007
 
49008
+ // ../tui-base/src/routes/session/merged-dock.ts
49009
+ function activeTodos(todos) {
49010
+ const out = [];
49011
+ for (let i = 0;i < todos.length; i++) {
49012
+ const todo = todos[i];
49013
+ if (todo.status === "in_progress")
49014
+ out.push({ ...todo, index: i + 1 });
49015
+ }
49016
+ return out;
49017
+ }
49018
+ function attributeAgents(todos, agents) {
49019
+ let parent = null;
49020
+ for (let i = 0;i < todos.length; i++) {
49021
+ const todo = todos[i];
49022
+ if (todo.status === "in_progress")
49023
+ parent = { todo, index: i + 1 };
49024
+ }
49025
+ return { parent, agents: agents.filter((agent) => agent.status === "running") };
49026
+ }
49027
+ function mergedTitle(parts) {
49028
+ if (parts.tool)
49029
+ return parts.subagent ? "\uD83D\uDD27 tool \xB7 \uD83E\uDD16 subagent" : "\uD83D\uDD27 tool";
49030
+ if (parts.subagent)
49031
+ return "\uD83E\uDD16 subagent";
49032
+ if (parts.think)
49033
+ return "\uD83D\uDCAD think";
49034
+ return "\uD83E\uDDE9 activity";
49035
+ }
49036
+ function mergedPositionSuffix(info) {
49037
+ return info.overflow ? `${info.position}/${info.total}` : null;
49038
+ }
49039
+ function lineWidth(line) {
49040
+ return line.segments.reduce((sum, segment) => sum + stringWidth(segment.text), 0);
49041
+ }
49042
+ function padTo(text, width) {
49043
+ return text + " ".repeat(Math.max(0, width - stringWidth(text)));
49044
+ }
49045
+ function clearBrokenMarker(line) {
49046
+ const marker = line.marker;
49047
+ if (marker === undefined)
49048
+ return line;
49049
+ const markerAt = line.markerAt ?? 0;
49050
+ const joined = line.segments.map((segment) => segment.text).join("");
49051
+ if (markerAt < 0 || markerAt + marker.length > joined.length || joined.slice(markerAt, markerAt + marker.length) !== marker) {
49052
+ const { marker: _marker, markerAt: _markerAt, ...rest } = line;
49053
+ return rest;
49054
+ }
49055
+ return line;
49056
+ }
49057
+ function fitLine(line, innerWidth) {
49058
+ const width = Math.max(0, Math.floor(innerWidth));
49059
+ if (lineWidth(line) === width)
49060
+ return line;
49061
+ const segments = line.segments;
49062
+ if (segments.length === 0)
49063
+ return line;
49064
+ const prefixWidth = segments.slice(0, -1).reduce((sum, segment) => sum + stringWidth(segment.text), 0);
49065
+ if (prefixWidth >= width) {
49066
+ const first = segments[0];
49067
+ const full = segments.map((segment) => segment.text).join("");
49068
+ return clearBrokenMarker({ ...line, segments: [{ ...first, text: padTo(takeWidth(full, width), width) }] });
49069
+ }
49070
+ const last = segments[segments.length - 1];
49071
+ const avail = width - prefixWidth;
49072
+ const cropped = takeWidth(last.text, avail);
49073
+ return clearBrokenMarker({ ...line, segments: [...segments.slice(0, -1), { ...last, text: padTo(cropped, avail) }] });
49074
+ }
49075
+ function widthTail(text, maxWidth) {
49076
+ if (maxWidth <= 0)
49077
+ return "";
49078
+ const parts = graphemes(text);
49079
+ let out = "";
49080
+ let used = 0;
49081
+ for (let i = parts.length - 1;i >= 0; i--) {
49082
+ const next = stringWidth(parts[i]);
49083
+ if (used + next > maxWidth)
49084
+ break;
49085
+ out = parts[i] + out;
49086
+ used += next;
49087
+ }
49088
+ return out;
49089
+ }
49090
+ function secsFrom(startedAt, elapsedSec, now) {
49091
+ if (startedAt !== undefined)
49092
+ return `${((now - startedAt) / 1000).toFixed(1)}s`;
49093
+ if (elapsedSec !== undefined)
49094
+ return `${elapsedSec.toFixed(1)}s`;
49095
+ return "0.0s";
49096
+ }
49097
+ function toneForTool(status) {
49098
+ return status === "failed" ? "failed" : status === "done" ? "ok" : "running";
49099
+ }
49100
+ function toolElapsed(tool, now) {
49101
+ return tool.status === "running" ? secsFrom(tool.startedAt, undefined, now) : secsFrom(undefined, tool.elapsedSec, now);
49102
+ }
49103
+ function coexistenceToolLine(tool, now, spin) {
49104
+ spin();
49105
+ const marker = toolMarker(tool.status);
49106
+ const elapsed = toolElapsed(tool, now);
49107
+ const tone = toneForTool(tool.status);
49108
+ return {
49109
+ kind: "tool",
49110
+ segments: [
49111
+ { text: `${marker} `, tone },
49112
+ { text: `${tool.name} \xB7 ${elapsed}`, tone, accent: "tool" }
49113
+ ],
49114
+ id: `dock:tool:${tool.key}`,
49115
+ fadeOutAt: tool.status !== "running" ? skinStopAt(tool) : undefined,
49116
+ marker,
49117
+ markerAt: 0
49118
+ };
49119
+ }
49120
+ function toolOnlyLine(tool, now, spin) {
49121
+ const text = toolLineText(tool, spin, now);
49122
+ const marker = toolMarker(tool.status);
49123
+ const tone = toneForTool(tool.status);
49124
+ return {
49125
+ kind: "tool",
49126
+ segments: [
49127
+ { text: marker, tone },
49128
+ { text: text.slice(marker.length), tone, accent: "tool" }
49129
+ ],
49130
+ id: `dock:tool:${tool.key}`,
49131
+ fadeOutAt: tool.status !== "running" ? skinStopAt(tool) : undefined,
49132
+ marker,
49133
+ markerAt: 0
49134
+ };
49135
+ }
49136
+ function latestThinkRow(rows) {
49137
+ const live = [...rows].reverse().find((row) => row.streaming === true);
49138
+ if (live !== undefined)
49139
+ return live;
49140
+ for (let i = rows.length - 1;i >= 0; i--) {
49141
+ const row = rows[i];
49142
+ if (row.elapsedSec !== undefined)
49143
+ return row;
49144
+ }
49145
+ return;
49146
+ }
49147
+ function thinkLine(row, now, spin) {
49148
+ const text = thinkBlockLines(row, spin, 1, now)[0];
49149
+ if (text === undefined)
49150
+ return;
49151
+ return {
49152
+ kind: "think",
49153
+ segments: [{ text, tone: "running", accent: "think" }],
49154
+ italic: true,
49155
+ id: `dock:think:${row.key}`,
49156
+ fadeOutAt: row.streaming === true ? undefined : skinStopAt(row)
49157
+ };
49158
+ }
49159
+ function todoLine(todo) {
49160
+ const glyph = TODO_STATUS_GLYPHS.in_progress;
49161
+ return {
49162
+ kind: "todo",
49163
+ index: todo.index,
49164
+ segments: [
49165
+ { text: `${glyph} ${todo.index} `, tone: "running" },
49166
+ { text: todo.content, tone: "running" }
49167
+ ]
49168
+ };
49169
+ }
49170
+ function agentLine(agent, position, count, parentIndex, now = Date.now()) {
49171
+ const branch = position === count - 1 ? "\u2514\u2500 " : "\u251C\u2500 ";
49172
+ const indent = parentIndex === undefined ? "" : " ".repeat(stringWidth(`${TODO_STATUS_GLYPHS.in_progress} ${parentIndex} `));
49173
+ const elapsed = secsFrom(agent.startedAt, agent.elapsedSec, now);
49174
+ const tail = widthTail(agent.lastLine ?? "", 32);
49175
+ const content = `${agent.label} \xB7 ${elapsed} \xB7 round ${agent.rounds} \xB7 ${tail}`;
49176
+ return {
49177
+ kind: "agent",
49178
+ index: parentIndex,
49179
+ segments: [
49180
+ { text: `${indent}${branch}`, tone: "muted" },
49181
+ { text: content, tone: "running" }
49182
+ ]
49183
+ };
49184
+ }
49185
+ function indicatorLine(kind, count) {
49186
+ return {
49187
+ kind,
49188
+ segments: [{ text: `${kind === "more-top" ? "\u25B2" : "\u25BC"} ${count} more`, tone: "muted" }]
49189
+ };
49190
+ }
49191
+ function clamp5(value, lo, hi) {
49192
+ return Math.max(lo, Math.min(hi, value));
49193
+ }
49194
+ function mergedDockLines(data, options) {
49195
+ return buildMergedDock(data, options).lines;
49196
+ }
49197
+ function mergedWindowInfo(data, options) {
49198
+ return buildMergedDock(data, options).info;
49199
+ }
49200
+ function buildMergedDock(data, options) {
49201
+ const now = options.now ?? Date.now();
49202
+ const spin = options.spin ?? (() => 0);
49203
+ const active = activeTodos(data.todos);
49204
+ const attribution = attributeAgents(data.todos, data.agents);
49205
+ const agents = attribution.agents;
49206
+ const parent = attribution.parent;
49207
+ const hasLowerContent = active.length > 0 || agents.length > 0;
49208
+ const thinkRow = latestThinkRow(data.think ?? []);
49209
+ const thinkLines = thinkRow === undefined ? [] : [thinkLine(thinkRow, now, spin)].filter((line) => line !== undefined);
49210
+ const tools = data.tools;
49211
+ let toolLines;
49212
+ if (hasLowerContent) {
49213
+ const latest = tools.length > 0 ? tools[tools.length - 1] : undefined;
49214
+ toolLines = latest ? [coexistenceToolLine(latest, now, spin)] : [];
49215
+ } else {
49216
+ toolLines = tools.slice(-MERGED_DOCK_TOOL_ONLY_MAX).map((tool) => toolOnlyLine(tool, now, spin));
49217
+ }
49218
+ const upperLines = [...thinkLines, ...toolLines];
49219
+ const lowerRaw = [];
49220
+ for (const todo of active) {
49221
+ lowerRaw.push(todoLine(todo));
49222
+ if (parent && parent.index === todo.index) {
49223
+ agents.forEach((agent, i) => lowerRaw.push(agentLine(agent, i, agents.length, todo.index, now)));
49224
+ }
49225
+ }
49226
+ if (!parent) {
49227
+ agents.forEach((agent, i) => lowerRaw.push(agentLine(agent, i, agents.length, undefined, now)));
49228
+ }
49229
+ const assembled = assembleZones(upperLines, lowerRaw, options.totalLines ?? MERGED_DOCK_TOTAL_LINES, options.cursor);
49230
+ return { lines: fitAll(assembled.lines, options.innerWidth), info: assembled.info };
49231
+ }
49232
+ function assembleZones(upperLines, lowerRaw, totalLines, cursor) {
49233
+ const n = lowerRaw.length;
49234
+ const noWindow = () => ({ total: n, position: 1, start: 0, size: 0, overflow: false, maxCursor: 0 });
49235
+ if (totalLines <= 0)
49236
+ return { lines: [], info: noWindow() };
49237
+ const upper = upperLines.length <= totalLines ? upperLines : upperLines.slice(-totalLines);
49238
+ const lowerBudget = totalLines - upper.length;
49239
+ if (lowerBudget < 1)
49240
+ return { lines: [...upper], info: noWindow() };
49241
+ if (n <= lowerBudget) {
49242
+ return {
49243
+ lines: [...upper, ...lowerRaw],
49244
+ info: { total: n, position: 1, start: 0, size: n, overflow: false, maxCursor: 0 }
49245
+ };
49246
+ }
49247
+ if (lowerBudget === 1) {
49248
+ const maxCursor = n - 1;
49249
+ const start = clamp5(cursor ?? 0, 0, maxCursor);
49250
+ return {
49251
+ lines: [...upper, lowerRaw[start]],
49252
+ info: { total: n, position: start + 1, start, size: 1, overflow: true, maxCursor }
49253
+ };
49254
+ }
49255
+ let size = lowerBudget - 1;
49256
+ let maxCursor = n - size;
49257
+ let start = clamp5(cursor ?? 0, 0, maxCursor);
49258
+ let needTop = start > 0;
49259
+ let needBottom = start + size < n;
49260
+ if (needTop && needBottom) {
49261
+ if (lowerBudget < 3) {
49262
+ maxCursor = n - lowerBudget;
49263
+ start = clamp5(cursor ?? 0, 0, maxCursor);
49264
+ return {
49265
+ lines: [...upper, ...lowerRaw.slice(start, start + lowerBudget)],
49266
+ info: { total: n, position: start + 1, start, size: lowerBudget, overflow: true, maxCursor }
49267
+ };
49268
+ }
49269
+ size = lowerBudget - 2;
49270
+ maxCursor = n - size - 1;
49271
+ start = clamp5(cursor ?? 0, 1, maxCursor);
49272
+ needTop = start > 0;
49273
+ needBottom = start + size < n;
49274
+ }
49275
+ const topCount = start;
49276
+ const bottomCount = n - (start + size);
49277
+ const window = lowerRaw.slice(start, start + size);
49278
+ const lower = [];
49279
+ if (topCount > 0)
49280
+ lower.push(indicatorLine("more-top", topCount));
49281
+ lower.push(...window);
49282
+ if (bottomCount > 0)
49283
+ lower.push(indicatorLine("more-bottom", bottomCount));
49284
+ return {
49285
+ lines: [...upper, ...lower],
49286
+ info: { total: n, position: start + 1, start, size, overflow: topCount + bottomCount > 0, maxCursor }
49287
+ };
49288
+ }
49289
+ function fitAll(lines, innerWidth) {
49290
+ return lines.map((line) => fitLine(line, innerWidth));
49291
+ }
49292
+ var MERGED_DOCK_TOTAL_LINES = 10, MERGED_DOCK_TOOL_ONLY_MAX = 3, TODO_STATUS_GLYPHS;
49293
+ var init_merged_dock = __esm(() => {
49294
+ init_locale();
49295
+ init_string_width();
49296
+ init_widgets_dock();
49297
+ TODO_STATUS_GLYPHS = {
49298
+ pending: "\u25CB",
49299
+ in_progress: "\u25CF",
49300
+ completed: "\u2713",
49301
+ cancelled: "\u2298"
49302
+ };
49303
+ });
49304
+
49006
49305
  // ../tui-base/src/routes/session/widgets-dock.tsx
49007
49306
  import { parseColor as parseColor3, TextAttributes as TextAttributes5 } from "@opentui/core";
49008
49307
  function mixSkinColor(a, b, t) {
@@ -49116,6 +49415,9 @@ function skinDockLineFg(ctx, target, line) {
49116
49415
  const t = skinLineFadeT(id);
49117
49416
  return t >= 1 ? target : skinFadeInColor(target, ctx.background, t * SKIN_FADE_IN_MS);
49118
49417
  }
49418
+ function resetMergedDockCursor() {
49419
+ setMergedDockCursor(0);
49420
+ }
49119
49421
  function todoArray(text) {
49120
49422
  if (text === undefined || text.trim() === "")
49121
49423
  return;
@@ -49129,47 +49431,6 @@ function todoArray(text) {
49129
49431
  } catch {}
49130
49432
  return;
49131
49433
  }
49132
- function todoIcon(status) {
49133
- if (status === "completed")
49134
- return "\u2611";
49135
- if (status === "in_progress")
49136
- return "\u25D0";
49137
- return "\u2610";
49138
- }
49139
- function statusRank(status) {
49140
- if (status === "in_progress")
49141
- return 0;
49142
- if (status === "completed")
49143
- return 2;
49144
- return 1;
49145
- }
49146
- function compactRanges(numbers) {
49147
- if (numbers.length === 0)
49148
- return "";
49149
- const runs = [];
49150
- let start = numbers[0];
49151
- let prev = start;
49152
- for (const n of numbers.slice(1)) {
49153
- if (n === prev + 1) {
49154
- prev = n;
49155
- continue;
49156
- }
49157
- runs.push(start === prev ? `${start}` : `${start}-${prev}`);
49158
- start = prev = n;
49159
- }
49160
- runs.push(start === prev ? `${start}` : `${start}-${prev}`);
49161
- return runs.join(",");
49162
- }
49163
- function padCell2(text, width, align = "left") {
49164
- const flat = text.replace(/[\r\n]+/g, " ").trim();
49165
- const clipped = clipToWidth(flat, width);
49166
- const pad = Math.max(0, width - stringWidth(clipped));
49167
- return align === "right" ? " ".repeat(pad) + clipped : clipped + " ".repeat(pad);
49168
- }
49169
- function borderedRow(boxWidth, inner) {
49170
- const pad = Math.max(0, boxWidth - 4 - stringWidth(inner));
49171
- return `\u2502 ${inner}${" ".repeat(pad)} \u2502`;
49172
- }
49173
49434
  function latestTodos(rows) {
49174
49435
  const todoTool = [...rows].reverse().find((row) => row.kind === "tool" && TODO_TOOL_NAMES.has(row.name) && row.output !== undefined && row.status !== "failed");
49175
49436
  if (todoTool?.kind !== "tool")
@@ -49191,63 +49452,6 @@ function todosSummaryLine(rows) {
49191
49452
  });
49192
49453
  return active ? `${head} \xB7 ${active.content}` : head;
49193
49454
  }
49194
- function todosTableWidth(terminalColumns) {
49195
- return Math.max(16, terminalColumns - 1);
49196
- }
49197
- function todosTableLines(rows, width, terminalRows) {
49198
- const todos = latestTodos(rows);
49199
- if (todos.length === 0 || todos.every((todo) => todo.status === "completed"))
49200
- return [];
49201
- if (terminalRows !== undefined && terminalRows <= COMPOSER_COMPACT_TERMINAL_ROWS) {
49202
- return [{
49203
- text: todosSummaryLine(rows),
49204
- tone: "muted",
49205
- id: "dock:todos"
49206
- }];
49207
- }
49208
- const boxWidth = Math.max(16, width);
49209
- const innerWidth = boxWidth - 4;
49210
- const colWidths = [3, 2, Math.max(1, innerWidth - 5 - TABLE_SEP.length * 2)];
49211
- const border = "\u2500".repeat(Math.max(0, boxWidth - 2));
49212
- const window = todos.map((todo, index) => ({
49213
- todo,
49214
- index
49215
- })).sort((a, b) => statusRank(a.todo.status) - statusRank(b.todo.status) || (a.todo.status === "completed" ? b.index - a.index : a.index - b.index)).slice(0, TODO_MAX_ROWS).sort((a, b) => a.index - b.index);
49216
- const done = todos.filter((todo) => todo.status === "completed").length;
49217
- const showing = window.length < todos.length ? ` \xB7 ${t("overlay.widgets.todosShowing", {
49218
- ranges: compactRanges(window.map((entry) => entry.index + 1))
49219
- })}` : "";
49220
- const header = clipToWidth(t("overlay.widgets.todosHeader", {
49221
- done,
49222
- total: todos.length
49223
- }) + showing, innerWidth);
49224
- const out = [{
49225
- text: `\u250C${border}\u2510`,
49226
- tone: "muted"
49227
- }, {
49228
- text: borderedRow(boxWidth, header),
49229
- tone: "muted"
49230
- }, {
49231
- text: borderedRow(boxWidth, [padCell2("#", colWidths[0], "right"), padCell2("\u2713", colWidths[1]), padCell2(t("overlay.widgets.taskColumn"), colWidths[2])].join(TABLE_SEP)),
49232
- tone: "muted"
49233
- }];
49234
- for (const {
49235
- todo,
49236
- index
49237
- } of window) {
49238
- const cells = [padCell2(String(index + 1), colWidths[0], "right"), padCell2(todoIcon(todo.status), colWidths[1]), padCell2(todo.content, colWidths[2])].join(TABLE_SEP);
49239
- const tone = todo.status === "completed" ? "ok" : todo.status === "in_progress" ? "running" : "muted";
49240
- out.push({
49241
- text: borderedRow(boxWidth, cells),
49242
- tone
49243
- });
49244
- }
49245
- out.push({
49246
- text: `\u2514${border}\u2518`,
49247
- tone: "muted"
49248
- });
49249
- return out;
49250
- }
49251
49455
  function toolMarker(status) {
49252
49456
  return status === "running" ? "\u2699" : status === "failed" ? "\u2718" : "\u2714";
49253
49457
  }
@@ -49557,6 +49761,34 @@ function createFrameLatch(ms = ACTIVITY_FRAME_DEFER_MS) {
49557
49761
  dispose: clear
49558
49762
  };
49559
49763
  }
49764
+ function mergedToolRows(rows, now, decorated) {
49765
+ return rows.filter((row) => row.kind === "tool" && row.key.startsWith("tool:live:")).filter((row) => {
49766
+ if (row.faded === true && row.status !== "running")
49767
+ return false;
49768
+ if (row.status === "running")
49769
+ return true;
49770
+ const stopAt = skinStopAt(row);
49771
+ return stopAt === undefined || dockLineVisibility(stopAt, now, decorated).phase !== "hidden";
49772
+ });
49773
+ }
49774
+ function mergedThinkRows(rows, now, decorated) {
49775
+ return rows.filter((row) => row.kind === "reasoning").filter((row) => {
49776
+ if (row.streaming === true)
49777
+ return true;
49778
+ const stopAt = skinStopAt(row);
49779
+ return stopAt === undefined || dockLineVisibility(stopAt, now, decorated).phase !== "hidden";
49780
+ });
49781
+ }
49782
+ function mergedRunningAgents(rows) {
49783
+ const tree = [...rows].reverse().find((row) => row.kind === "subagents");
49784
+ return tree?.kind === "subagents" ? tree.children.filter((child) => child.status === "running") : [];
49785
+ }
49786
+ function mergedLowerHasContent(rows) {
49787
+ return latestTodos(rows).some((todo) => todo.status === "in_progress") || mergedRunningAgents(rows).length > 0;
49788
+ }
49789
+ function mergedCompactSummary(rows) {
49790
+ return todosSummaryLine(rows);
49791
+ }
49560
49792
  function WidgetsDock(props) {
49561
49793
  const dimensions = useTerminalSize();
49562
49794
  const theme = useThemeOptional();
@@ -49568,55 +49800,136 @@ function WidgetsDock(props) {
49568
49800
  });
49569
49801
  onAnimationTick(() => motionAnimationRunning() && dockNeedsClock(props.rows) ? motionFrameRate() : undefined, () => setDockSpin((s) => s + 1));
49570
49802
  const width = () => Math.max(16, dimensions().width - 4);
49571
- const tableWidth = () => todosTableWidth(dimensions().width);
49572
- const table = () => todosTableLines(props.rows, tableWidth(), dimensions().height);
49573
49803
  const turnActive = () => props.turnActive?.() ?? dockTurnActive(props.rows);
49574
- createEffect(() => activityFrameLatch.push(turnActive()));
49804
+ createEffect(() => activityFrameLatch.push(turnActive() || mergedLowerHasContent(props.rows)));
49575
49805
  onCleanup(activityFrameLatch.dispose);
49576
49806
  const frame = () => activityFrameMode(dimensions().height);
49577
49807
  const capSpec = () => activityPanelCapSpec(activityPanelGear(), dimensions().height);
49578
49808
  const lineCap = () => capSpec().maxLines;
49579
- const frameBlocks = () => activityBlocks(props.rows, {
49580
- maxLines: lineCap(),
49581
- ...capSpec().totalMaxLines !== undefined ? {
49582
- totalMaxLines: capSpec().totalMaxLines
49583
- } : {}
49584
- });
49585
- const frameHeight = () => 2 + frameBlocks().think.length + frameBlocks().tool.length;
49809
+ const mergedSource = (now) => {
49810
+ dockSpin();
49811
+ return {
49812
+ think: mergedThinkRows(props.rows, now, motionDecorationsEnabled()),
49813
+ tools: mergedToolRows(props.rows, now, motionDecorationsEnabled()),
49814
+ todos: latestTodos(props.rows),
49815
+ agents: mergedRunningAgents(props.rows)
49816
+ };
49817
+ };
49818
+ const gearTotal = () => {
49819
+ const gear = activityPanelGear();
49820
+ if (gear === undefined || gear === "all")
49821
+ return MERGED_DOCK_TOTAL_LINES;
49822
+ return Number(gear);
49823
+ };
49824
+ const mergedFrame = () => {
49825
+ const now = Date.now();
49826
+ const data = mergedSource(now);
49827
+ const options = {
49828
+ innerWidth: width(),
49829
+ now,
49830
+ totalLines: Math.min(gearTotal(), MERGED_DOCK_TOTAL_LINES),
49831
+ cursor: mergedDockCursor()
49832
+ };
49833
+ return {
49834
+ lines: mergedDockLines(data, options),
49835
+ info: mergedWindowInfo(data, options)
49836
+ };
49837
+ };
49838
+ const titleSlotWidth = () => dimensions().width - 4;
49839
+ const mergedTitleText = () => {
49840
+ const {
49841
+ lines,
49842
+ info
49843
+ } = mergedFrame();
49844
+ const base = mergedTitle({
49845
+ tool: lines.some((line) => line.kind === "tool"),
49846
+ think: lines.some((line) => line.kind === "think"),
49847
+ subagent: mergedRunningAgents(props.rows).length > 0
49848
+ });
49849
+ const suffix = mergedPositionSuffix(info);
49850
+ if (suffix === null)
49851
+ return base;
49852
+ const gap = titleSlotWidth() - stringWidth(base) - stringWidth(suffix);
49853
+ if (gap < 1)
49854
+ return `${base} \xB7 ${suffix}`;
49855
+ return base + " ".repeat(gap) + suffix;
49856
+ };
49857
+ const onMergedWheel = (event) => {
49858
+ const info = mergedFrame().info;
49859
+ if (!info.overflow)
49860
+ return;
49861
+ const dir = event.scroll?.direction;
49862
+ if (dir !== "up" && dir !== "down")
49863
+ return;
49864
+ const step = Math.max(1, Math.floor(Math.abs(event.scroll?.delta ?? 0)));
49865
+ setMergedDockCursor((c) => dir === "up" ? Math.max(0, c - step) : Math.min(info.maxCursor, c + step));
49866
+ };
49867
+ const stepMergedDock = (delta) => {
49868
+ const info = mergedFrame().info;
49869
+ if (!info.overflow)
49870
+ return;
49871
+ setMergedDockCursor((c) => Math.max(0, Math.min(info.maxCursor, c + delta)));
49872
+ };
49873
+ const pageOwns = useIsPageOwner();
49874
+ if (Keymap2.useOptional() !== undefined) {
49875
+ Keymap2.createLayer(() => ({
49876
+ mode: "global",
49877
+ enabled: mergedFrame().info.overflow && pageOwns(),
49878
+ commands: [{
49879
+ id: "session.dock.scroll.up",
49880
+ title: "Scroll activity up",
49881
+ group: "Session",
49882
+ run: () => stepMergedDock(-1)
49883
+ }, {
49884
+ id: "session.dock.scroll.down",
49885
+ title: "Scroll activity down",
49886
+ group: "Session",
49887
+ run: () => stepMergedDock(1)
49888
+ }],
49889
+ bindings: ["session.dock.scroll.up", "session.dock.scroll.down"]
49890
+ }));
49891
+ }
49892
+ const frameHeight = () => 2 + mergedFrame().lines.length;
49893
+ const compactSummary = () => mergedCompactSummary(props.rows);
49894
+ const compactHeight = () => 2 + (compactSummary() === "" ? 0 : 1);
49586
49895
  const accentFg = (accent) => dockAccentColor(theme, accent);
49587
49896
  const lineView = (line) => dockLineNode(line, width(), skinCtx(), fgFor, accentFg);
49897
+ const mergedLineView = (line) => {
49898
+ const ctx = skinCtx();
49899
+ const lineFade = {
49900
+ id: line.id,
49901
+ fadeOutAt: line.fadeOutAt
49902
+ };
49903
+ const attributes = line.italic === true ? TextAttributes5.ITALIC : undefined;
49904
+ return (() => {
49905
+ var _el$ = createElement("text");
49906
+ setProp(_el$, "attributes", attributes);
49907
+ setProp(_el$, "wrapMode", "none");
49908
+ insert(_el$, createComponent2(For, {
49909
+ get each() {
49910
+ return line.segments;
49911
+ },
49912
+ children: (segment) => {
49913
+ const target = segment.accent !== undefined ? accentFg(segment.accent) : fgFor(segment.tone);
49914
+ return (() => {
49915
+ var _el$2 = createElement("span");
49916
+ insert(_el$2, () => segment.text);
49917
+ effect((_$p) => setProp(_el$2, "style", {
49918
+ fg: skinDockLineFg(ctx, target, lineFade)
49919
+ }, _$p));
49920
+ return _el$2;
49921
+ })();
49922
+ }
49923
+ }));
49924
+ return _el$;
49925
+ })();
49926
+ };
49588
49927
  return (() => {
49589
- var _el$ = createElement("box");
49590
- setProp(_el$, "flexShrink", 0);
49591
- setProp(_el$, "flexDirection", "column");
49592
- setProp(_el$, "width", "100%");
49593
- insert(_el$, createComponent2(Show, {
49594
- get when() {
49595
- return table().length > 0;
49596
- },
49597
- get children() {
49598
- var _el$2 = createElement("box");
49599
- setProp(_el$2, "flexShrink", 0);
49600
- setProp(_el$2, "flexDirection", "column");
49601
- setProp(_el$2, "width", "100%");
49602
- setProp(_el$2, "paddingLeft", 1);
49603
- insert(_el$2, createComponent2(For, {
49604
- get each() {
49605
- return table();
49606
- },
49607
- children: (line) => (() => {
49608
- var _el$4 = createElement("text");
49609
- setProp(_el$4, "wrapMode", "none");
49610
- insert(_el$4, () => takeWidth(line.text, tableWidth()));
49611
- effect((_$p) => setProp(_el$4, "fg", fgFor(line.tone), _$p));
49612
- return _el$4;
49613
- })()
49614
- }));
49615
- effect((_$p) => setProp(_el$2, "height", table().length, _$p));
49616
- return _el$2;
49617
- }
49618
- }), null);
49619
- insert(_el$, createComponent2(Show, {
49928
+ var _el$3 = createElement("box");
49929
+ setProp(_el$3, "flexShrink", 0);
49930
+ setProp(_el$3, "flexDirection", "column");
49931
+ setProp(_el$3, "width", "100%");
49932
+ insert(_el$3, createComponent2(Show, {
49620
49933
  get when() {
49621
49934
  return activityFrameLatch.shown();
49622
49935
  },
@@ -49652,54 +49965,61 @@ function WidgetsDock(props) {
49652
49965
  setProp(_el$5, "flexShrink", 0);
49653
49966
  setProp(_el$5, "flexDirection", "column");
49654
49967
  setProp(_el$5, "width", "100%");
49655
- setProp(_el$5, "height", 2);
49656
49968
  setProp(_el$5, "paddingLeft", 3);
49657
49969
  insert(_el$5, createComponent2(For, {
49658
49970
  get each() {
49659
49971
  return activityRuleLines(props.rows);
49660
49972
  },
49661
49973
  children: lineView
49662
- }));
49974
+ }), null);
49975
+ insert(_el$5, createComponent2(Show, {
49976
+ get when() {
49977
+ return compactSummary() !== "";
49978
+ },
49979
+ get children() {
49980
+ var _el$6 = createElement("text");
49981
+ setProp(_el$6, "wrapMode", "none");
49982
+ insert(_el$6, () => takeWidth(compactSummary(), width()));
49983
+ effect((_$p) => setProp(_el$6, "fg", fgFor("muted"), _$p));
49984
+ return _el$6;
49985
+ }
49986
+ }), null);
49987
+ effect((_$p) => setProp(_el$5, "height", compactHeight(), _$p));
49663
49988
  return _el$5;
49664
49989
  })();
49665
49990
  },
49666
49991
  get children() {
49667
- var _el$3 = createElement("box");
49668
- setProp(_el$3, "flexShrink", 0);
49669
- setProp(_el$3, "flexDirection", "column");
49670
- setProp(_el$3, "width", "100%");
49671
- setProp(_el$3, "border", ["top", "bottom", "left", "right"]);
49672
- setProp(_el$3, "borderStyle", "heavy");
49673
- setProp(_el$3, "titleAlignment", "left");
49674
- insert(_el$3, createComponent2(For, {
49992
+ var _el$4 = createElement("box");
49993
+ setProp(_el$4, "flexShrink", 0);
49994
+ setProp(_el$4, "flexDirection", "column");
49995
+ setProp(_el$4, "width", "100%");
49996
+ setProp(_el$4, "border", ["top", "bottom", "left", "right"]);
49997
+ setProp(_el$4, "borderStyle", "heavy");
49998
+ setProp(_el$4, "titleAlignment", "left");
49999
+ setProp(_el$4, "onMouseScroll", onMergedWheel);
50000
+ insert(_el$4, createComponent2(For, {
49675
50001
  get each() {
49676
- return frameBlocks().think;
50002
+ return mergedFrame().lines;
49677
50003
  },
49678
- children: lineView
49679
- }), null);
49680
- insert(_el$3, createComponent2(For, {
49681
- get each() {
49682
- return frameBlocks().tool;
49683
- },
49684
- children: lineView
49685
- }), null);
50004
+ children: mergedLineView
50005
+ }));
49686
50006
  effect((_p$) => {
49687
- var _v$ = frameHeight(), _v$2 = activityFrameBorderColor(theme), _v$3 = t("overlay.widgets.frameTitle");
49688
- _v$ !== _p$.e && (_p$.e = setProp(_el$3, "height", _v$, _p$.e));
49689
- _v$2 !== _p$.t && (_p$.t = setProp(_el$3, "borderColor", _v$2, _p$.t));
49690
- _v$3 !== _p$.a && (_p$.a = setProp(_el$3, "title", _v$3, _p$.a));
50007
+ var _v$ = frameHeight(), _v$2 = activityFrameBorderColor(theme), _v$3 = mergedTitleText();
50008
+ _v$ !== _p$.e && (_p$.e = setProp(_el$4, "height", _v$, _p$.e));
50009
+ _v$2 !== _p$.t && (_p$.t = setProp(_el$4, "borderColor", _v$2, _p$.t));
50010
+ _v$3 !== _p$.a && (_p$.a = setProp(_el$4, "title", _v$3, _p$.a));
49691
50011
  return _p$;
49692
50012
  }, {
49693
50013
  e: undefined,
49694
50014
  t: undefined,
49695
50015
  a: undefined
49696
50016
  });
49697
- return _el$3;
50017
+ return _el$4;
49698
50018
  }
49699
50019
  });
49700
50020
  }
49701
- }), null);
49702
- return _el$;
50021
+ }));
50022
+ return _el$3;
49703
50023
  })();
49704
50024
  }
49705
50025
  function FlatDock(props) {
@@ -49710,19 +50030,19 @@ function FlatDock(props) {
49710
50030
  } : {}
49711
50031
  });
49712
50032
  return (() => {
49713
- var _el$6 = createElement("box");
49714
- setProp(_el$6, "flexShrink", 0);
49715
- setProp(_el$6, "flexDirection", "column");
49716
- setProp(_el$6, "width", "100%");
49717
- setProp(_el$6, "paddingLeft", 3);
49718
- insert(_el$6, createComponent2(For, {
50033
+ var _el$7 = createElement("box");
50034
+ setProp(_el$7, "flexShrink", 0);
50035
+ setProp(_el$7, "flexDirection", "column");
50036
+ setProp(_el$7, "width", "100%");
50037
+ setProp(_el$7, "paddingLeft", 3);
50038
+ insert(_el$7, createComponent2(For, {
49719
50039
  get each() {
49720
50040
  return dockLines(props.rows, dockOptions());
49721
50041
  },
49722
50042
  children: (line) => dockLineNode(line, props.width, props.skinCtx, props.fgFor, props.accentFg)
49723
50043
  }));
49724
- effect((_$p) => setProp(_el$6, "height", dockLines(props.rows, dockOptions()).length, _$p));
49725
- return _el$6;
50044
+ effect((_$p) => setProp(_el$7, "height", dockLines(props.rows, dockOptions()).length, _$p));
50045
+ return _el$7;
49726
50046
  })();
49727
50047
  }
49728
50048
  function dockLineNode(line, width, ctx, fgFor, accentFg) {
@@ -49733,12 +50053,12 @@ function dockLineNode(line, width, ctx, fgFor, accentFg) {
49733
50053
  const markerAt = line.markerAt ?? 0;
49734
50054
  if (marker === undefined || line.text.slice(markerAt, markerAt + marker.length) !== marker) {
49735
50055
  return (() => {
49736
- var _el$7 = createElement("text");
49737
- setProp(_el$7, "fg", bodyFg);
49738
- setProp(_el$7, "attributes", attributes);
49739
- setProp(_el$7, "wrapMode", "none");
49740
- insert(_el$7, () => clipToWidth(line.text, width));
49741
- return _el$7;
50056
+ var _el$8 = createElement("text");
50057
+ setProp(_el$8, "fg", bodyFg);
50058
+ setProp(_el$8, "attributes", attributes);
50059
+ setProp(_el$8, "wrapMode", "none");
50060
+ insert(_el$8, () => clipToWidth(line.text, width));
50061
+ return _el$8;
49742
50062
  })();
49743
50063
  }
49744
50064
  const before = clipToWidth(line.text.slice(0, markerAt), width);
@@ -49747,21 +50067,21 @@ function dockLineNode(line, width, ctx, fgFor, accentFg) {
49747
50067
  const after = clipToWidth(line.text.slice(markerAt + marker.length), Math.max(0, markerBudget - stringWidth(clippedMarker)));
49748
50068
  const markerFg = skinDockLineFg(ctx, toneFg, line);
49749
50069
  return (() => {
49750
- var _el$8 = createElement("text"), _el$9 = createElement("span");
49751
- insertNode(_el$8, _el$9);
49752
- setProp(_el$8, "fg", bodyFg);
49753
- setProp(_el$8, "attributes", attributes);
49754
- setProp(_el$8, "wrapMode", "none");
49755
- insert(_el$8, before, _el$9);
49756
- setProp(_el$9, "style", {
50070
+ var _el$9 = createElement("text"), _el$0 = createElement("span");
50071
+ insertNode(_el$9, _el$0);
50072
+ setProp(_el$9, "fg", bodyFg);
50073
+ setProp(_el$9, "attributes", attributes);
50074
+ setProp(_el$9, "wrapMode", "none");
50075
+ insert(_el$9, before, _el$0);
50076
+ setProp(_el$0, "style", {
49757
50077
  fg: markerFg
49758
50078
  });
49759
- insert(_el$9, clippedMarker);
49760
- insert(_el$8, after, null);
49761
- return _el$8;
50079
+ insert(_el$0, clippedMarker);
50080
+ insert(_el$9, after, null);
50081
+ return _el$9;
49762
50082
  })();
49763
50083
  }
49764
- 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, PANEL_UNBOUNDED_LINES = 1e6, activityPanelGear, setActivityPanelGear, LINE_FIRST_SEEN_MAX = 512, lineFirstSeen, dockSpin, setDockSpin, TODO_MAX_ROWS = 5, TABLE_SEP = " \u2502 ", TODO_TOOL_NAMES, ACTIVITY_FRAME_BORDER_FALLBACK = "#7aa2f7", ACTIVITY_FRAME_MIN_CONTRAST = 6, ACTIVITY_BLUE_STEPS, BLUE_HUE_MIN = 190, BLUE_HUE_MAX = 250, BLUE_MIN_SATURATION = 0.25, AUTO_POLE_LIGHT = "#ffffff", AUTO_POLE_DARK = "#000000", DOCK_ACCENT_STEPS, DOCK_ACCENT_HUES, DOCK_ACCENT_FALLBACK, ACTIVITY_FRAME_DEFER_MS = 60, activityFrameLatch;
50084
+ 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, PANEL_UNBOUNDED_LINES = 1e6, activityPanelGear, setActivityPanelGear, LINE_FIRST_SEEN_MAX = 512, lineFirstSeen, dockSpin, setDockSpin, mergedDockCursor, setMergedDockCursor, TODO_TOOL_NAMES, ACTIVITY_FRAME_BORDER_FALLBACK = "#7aa2f7", ACTIVITY_FRAME_MIN_CONTRAST = 6, ACTIVITY_BLUE_STEPS, BLUE_HUE_MIN = 190, BLUE_HUE_MAX = 250, BLUE_MIN_SATURATION = 0.25, AUTO_POLE_LIGHT = "#ffffff", AUTO_POLE_DARK = "#000000", DOCK_ACCENT_STEPS, DOCK_ACCENT_HUES, DOCK_ACCENT_FALLBACK, ACTIVITY_FRAME_DEFER_MS = 60, activityFrameLatch;
49765
50085
  var init_widgets_dock = __esm(() => {
49766
50086
  init_index_bun();
49767
50087
  init_index_bun();
@@ -49782,10 +50102,14 @@ var init_widgets_dock = __esm(() => {
49782
50102
  init_semantic();
49783
50103
  init_dock_visibility();
49784
50104
  init_powerline();
50105
+ init_merged_dock();
50106
+ init_keymap();
50107
+ init_input_ownership();
49785
50108
  ACTIVITY_PANEL_GEARS = ["1", "5", "7", "10", "all"];
49786
50109
  [activityPanelGear, setActivityPanelGear] = createSignal(undefined);
49787
50110
  lineFirstSeen = new Map;
49788
50111
  [dockSpin, setDockSpin] = createSignal(0);
50112
+ [mergedDockCursor, setMergedDockCursor] = createSignal(0);
49789
50113
  TODO_TOOL_NAMES = new Set(["todowrite", "todo_write"]);
49790
50114
  ACTIVITY_BLUE_STEPS = [200, 100, 300, 400, 500, 600, 700];
49791
50115
  DOCK_ACCENT_STEPS = {
@@ -50309,7 +50633,7 @@ function LastRequestDock(props) {
50309
50633
  const fgFor = (tone) => tone === "running" ? theme?.text.feedback.warning.base ?? "#e0af68" : theme?.text.muted ?? "#9aa5ce";
50310
50634
  const contentWidth = () => Math.max(16, dimensions().width - 1);
50311
50635
  const lineWidth = (line) => Math.max(1, contentWidth() - (line.indent ?? 0));
50312
- const lines = () => lastRequestLines(props.rows, props.lastRequest, contentWidth());
50636
+ const lines = () => lastRequestLines(props.rows, props.lastRequest, contentWidth()).filter((line) => line.id === "lr:echo");
50313
50637
  const lineFg = (line) => {
50314
50638
  const target = fgFor(line.tone);
50315
50639
  if (!motionDecorationsEnabled() || line.id === undefined)
@@ -62432,7 +62756,7 @@ var init_subagents_viewer = __esm(() => {
62432
62756
  import { TextAttributes as TextAttributes12 } from "@opentui/core";
62433
62757
  function resolveVersion() {
62434
62758
  try {
62435
- return "0.19.1";
62759
+ return "0.20.0";
62436
62760
  } catch {
62437
62761
  return "dev";
62438
62762
  }
@@ -65304,6 +65628,7 @@ function V2SessionPageBody(props) {
65304
65628
  setComposerPending([]);
65305
65629
  setTools(0);
65306
65630
  resetSkinLineFades();
65631
+ resetMergedDockCursor();
65307
65632
  const settled = projection.load(sessionId);
65308
65633
  seam.currentModelSelection().then(setModel);
65309
65634
  resetFooterProbe();
@@ -65332,6 +65657,7 @@ function V2SessionPageBody(props) {
65332
65657
  resetFooterProbe();
65333
65658
  refreshFooterData();
65334
65659
  resetSkinLineFades();
65660
+ resetMergedDockCursor();
65335
65661
  setSkillRows(props.skills ?? []);
65336
65662
  setContextRevision((n) => n + 1);
65337
65663
  },
@@ -66070,5 +66396,5 @@ export {
66070
66396
  themeNameFromConfig
66071
66397
  };
66072
66398
 
66073
- //# debugId=9C95BF45B128B31364756E2164756E21
66399
+ //# debugId=5C4571E79EDDA20064756E2164756E21
66074
66400
  //# sourceMappingURL=index.js.map