@aiwayds/dsh-opentui 0.19.0 → 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.
- package/CHANGELOG.md +50 -0
- package/bin/dsh-opentui.mjs +30 -6
- package/dist/client/index.js +539 -199
- package/dist/client/index.js.map +12 -11
- package/dist/host-launch.mjs +8 -4
- package/dist/host-launch.mjs.map +5 -5
- package/dist/watchdog.mjs +15 -6
- package/dist/watchdog.mjs.map +4 -4
- package/package.json +1 -1
package/dist/client/index.js
CHANGED
|
@@ -581,7 +581,7 @@ function defaultPidAlive(pid) {
|
|
|
581
581
|
return false;
|
|
582
582
|
return true;
|
|
583
583
|
}
|
|
584
|
-
function evidencesAgree(pid, registryPid, hooks) {
|
|
584
|
+
function evidencesAgree(pid, registryPid, hooks, expectedProfile = HOST_PROFILE) {
|
|
585
585
|
if (!Number.isInteger(pid) || pid <= 0)
|
|
586
586
|
return false;
|
|
587
587
|
if (registryPid !== pid)
|
|
@@ -590,7 +590,7 @@ function evidencesAgree(pid, registryPid, hooks) {
|
|
|
590
590
|
if (!cmd)
|
|
591
591
|
return false;
|
|
592
592
|
const profiles = [...cmd.matchAll(/--profile[= ]+([^\s]+)/g)].map((m) => m[1]);
|
|
593
|
-
if (profiles.length === 0 || profiles.some((p) => p !==
|
|
593
|
+
if (profiles.length === 0 || profiles.some((p) => p !== expectedProfile))
|
|
594
594
|
return false;
|
|
595
595
|
if (hooks.hasServerEnv(pid))
|
|
596
596
|
return true;
|
|
@@ -617,13 +617,14 @@ async function safeStopHost(options) {
|
|
|
617
617
|
pid,
|
|
618
618
|
registryPid,
|
|
619
619
|
hooks,
|
|
620
|
+
profile = HOST_PROFILE,
|
|
620
621
|
termGraceMs = DEFAULT_TERM_GRACE_MS,
|
|
621
622
|
killGraceMs = DEFAULT_KILL_GRACE_MS,
|
|
622
623
|
sleep = defaultSleep,
|
|
623
624
|
pidAlive = hooks.pidAlive ?? defaultPidAlive,
|
|
624
625
|
now = Date.now
|
|
625
626
|
} = options;
|
|
626
|
-
if (!evidencesAgree(pid, registryPid, hooks)) {
|
|
627
|
+
if (!evidencesAgree(pid, registryPid, hooks, profile)) {
|
|
627
628
|
return { attempted: false, evidencesOk: false, signals: [], stopped: !pidAlive(pid) };
|
|
628
629
|
}
|
|
629
630
|
const signals = [];
|
|
@@ -1125,6 +1126,7 @@ async function ensureHost(deps = {}) {
|
|
|
1125
1126
|
pid: forcePid,
|
|
1126
1127
|
registryPid: forcePid,
|
|
1127
1128
|
hooks: o.killHooks,
|
|
1129
|
+
profile: o.profile,
|
|
1128
1130
|
termGraceMs: FORCE_TERM_GRACE_MS,
|
|
1129
1131
|
killGraceMs: FORCE_KILL_GRACE_MS,
|
|
1130
1132
|
sleep: o.sleep,
|
|
@@ -1183,6 +1185,7 @@ async function ensureHost(deps = {}) {
|
|
|
1183
1185
|
pid: read.value.pid,
|
|
1184
1186
|
registryPid: read.value.pid,
|
|
1185
1187
|
hooks: o.killHooks,
|
|
1188
|
+
profile: o.profile,
|
|
1186
1189
|
termGraceMs: FORCE_TERM_GRACE_MS,
|
|
1187
1190
|
killGraceMs: FORCE_KILL_GRACE_MS,
|
|
1188
1191
|
sleep: o.sleep,
|
|
@@ -1265,6 +1268,7 @@ async function ensureHost(deps = {}) {
|
|
|
1265
1268
|
pid: child.pid,
|
|
1266
1269
|
registryPid,
|
|
1267
1270
|
hooks: o.killHooks,
|
|
1271
|
+
profile: o.profile,
|
|
1268
1272
|
termGraceMs: FORCE_TERM_GRACE_MS,
|
|
1269
1273
|
killGraceMs: FORCE_KILL_GRACE_MS,
|
|
1270
1274
|
sleep: o.sleep,
|
|
@@ -2500,6 +2504,7 @@ __export(exports_client_lifecycle, {
|
|
|
2500
2504
|
ENV_WATCHDOG_PROFILE: () => ENV_WATCHDOG_PROFILE,
|
|
2501
2505
|
ForceNeedsYesError: () => ForceNeedsYesError,
|
|
2502
2506
|
IncompleteLifecycleFsError: () => IncompleteLifecycleFsError,
|
|
2507
|
+
WATCHDOG_MAX_BACKOFF_MS: () => WATCHDOG_MAX_BACKOFF_MS,
|
|
2503
2508
|
assertForceAllowed: () => assertForceAllowed,
|
|
2504
2509
|
clientsDir: () => clientsDir,
|
|
2505
2510
|
freshClients: () => freshClients,
|
|
@@ -2718,6 +2723,7 @@ async function lastOneGracefulShutdown(home, options) {
|
|
|
2718
2723
|
pid: read.value.pid,
|
|
2719
2724
|
registryPid: read.value.pid,
|
|
2720
2725
|
hooks: options.hooks,
|
|
2726
|
+
profile,
|
|
2721
2727
|
termGraceMs: options.termGraceMs,
|
|
2722
2728
|
killGraceMs: options.killGraceMs,
|
|
2723
2729
|
sleep,
|
|
@@ -2760,9 +2766,11 @@ async function runWatchdog(home, options) {
|
|
|
2760
2766
|
const sleep = options.sleep ?? defaultSleep3;
|
|
2761
2767
|
const alive = options.hooks.pidAlive ?? defaultPidAlive;
|
|
2762
2768
|
const fs = options.fs ?? nodeLifecycleFs;
|
|
2769
|
+
let failStreak = 0;
|
|
2763
2770
|
for (let tick = 0;options.maxTicks === undefined || tick < options.maxTicks; tick++) {
|
|
2764
2771
|
const read = readRegistry(home, profile, fs);
|
|
2765
2772
|
if (read.kind !== "v2" || read.value.pid <= 0 || !alive(read.value.pid)) {
|
|
2773
|
+
failStreak = 0;
|
|
2766
2774
|
if (read.kind === "v2" && !alive(read.value.pid)) {
|
|
2767
2775
|
try {
|
|
2768
2776
|
fs.unlinkSync(registryPath(home, profile));
|
|
@@ -2773,6 +2781,7 @@ async function runWatchdog(home, options) {
|
|
|
2773
2781
|
const freshCount = freshClients(home, options, options.ttlMs).length;
|
|
2774
2782
|
options.onTick?.({ tick, freshCount, hostPid: read.value.pid });
|
|
2775
2783
|
if (freshCount > 0) {
|
|
2784
|
+
failStreak = 0;
|
|
2776
2785
|
await sleep(pollMs);
|
|
2777
2786
|
continue;
|
|
2778
2787
|
}
|
|
@@ -2780,14 +2789,17 @@ async function runWatchdog(home, options) {
|
|
|
2780
2789
|
const again = readRegistry(home, profile, fs);
|
|
2781
2790
|
if (again.kind !== "v2" || again.value.pid !== read.value.pid)
|
|
2782
2791
|
continue;
|
|
2783
|
-
if (freshClients(home, options, options.ttlMs).length > 0)
|
|
2792
|
+
if (freshClients(home, options, options.ttlMs).length > 0) {
|
|
2793
|
+
failStreak = 0;
|
|
2784
2794
|
continue;
|
|
2795
|
+
}
|
|
2785
2796
|
if (!alive(again.value.pid))
|
|
2786
2797
|
continue;
|
|
2787
2798
|
const stop = await safeStopHost({
|
|
2788
2799
|
pid: again.value.pid,
|
|
2789
2800
|
registryPid: again.value.pid,
|
|
2790
2801
|
hooks: options.hooks,
|
|
2802
|
+
profile,
|
|
2791
2803
|
termGraceMs: options.termGraceMs,
|
|
2792
2804
|
killGraceMs: options.killGraceMs,
|
|
2793
2805
|
sleep,
|
|
@@ -2796,6 +2808,8 @@ async function runWatchdog(home, options) {
|
|
|
2796
2808
|
});
|
|
2797
2809
|
if (!stop.stopped) {
|
|
2798
2810
|
options.onEvidenceRefused?.({ pid: again.value.pid, evidencesOk: stop.evidencesOk });
|
|
2811
|
+
await sleep(Math.min(graceMs * 2 ** failStreak, WATCHDOG_MAX_BACKOFF_MS));
|
|
2812
|
+
failStreak = Math.min(failStreak + 1, 30);
|
|
2799
2813
|
continue;
|
|
2800
2814
|
}
|
|
2801
2815
|
clearRegistryIfPid(home, profile, again, again.value.pid, fs);
|
|
@@ -2826,7 +2840,7 @@ function defaultSpawnWatchdog(command, args, options) {
|
|
|
2826
2840
|
child.unref();
|
|
2827
2841
|
return child;
|
|
2828
2842
|
}
|
|
2829
|
-
var CLIENTS_DIR_NAME = "opentui-clients", DEFAULT_HEARTBEAT_INTERVAL_MS = 3000, DEFAULT_CLIENT_TTL_MS = 15000, DEFAULT_LAST_ONE_GRACE_MS = 2000, ENV_IDLE_MS = "DSH_OPENTUI_HOST_IDLE_MS", DEFAULT_WATCHDOG_POLL_MS = 1000, ENV_WATCHDOG = "DSH_OPENTUI_WATCHDOG", ENV_WATCHDOG_HOME = "DSH_OPENTUI_WATCHDOG_HOME", ENV_WATCHDOG_PROFILE = "DSH_OPENTUI_WATCHDOG_PROFILE", nodeLifecycleFs, defaultSleep3 = (ms) => new Promise((resolve) => setTimeout(resolve, ms)), ForceNeedsYesError, IncompleteLifecycleFsError;
|
|
2843
|
+
var CLIENTS_DIR_NAME = "opentui-clients", DEFAULT_HEARTBEAT_INTERVAL_MS = 3000, DEFAULT_CLIENT_TTL_MS = 15000, DEFAULT_LAST_ONE_GRACE_MS = 2000, ENV_IDLE_MS = "DSH_OPENTUI_HOST_IDLE_MS", DEFAULT_WATCHDOG_POLL_MS = 1000, WATCHDOG_MAX_BACKOFF_MS = 30000, ENV_WATCHDOG = "DSH_OPENTUI_WATCHDOG", ENV_WATCHDOG_HOME = "DSH_OPENTUI_WATCHDOG_HOME", ENV_WATCHDOG_PROFILE = "DSH_OPENTUI_WATCHDOG_PROFILE", nodeLifecycleFs, defaultSleep3 = (ms) => new Promise((resolve) => setTimeout(resolve, ms)), ForceNeedsYesError, IncompleteLifecycleFsError;
|
|
2830
2844
|
var init_client_lifecycle = __esm(() => {
|
|
2831
2845
|
init_host_registry();
|
|
2832
2846
|
init_safe_kill();
|
|
@@ -23178,6 +23192,8 @@ var init_keybind = __esm(() => {
|
|
|
23178
23192
|
"session.line.down": keybind("ctrl+alt+e", "Scroll messages down by one line"),
|
|
23179
23193
|
"session.half.page.up": keybind("ctrl+alt+u", "Scroll messages up by half page"),
|
|
23180
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"),
|
|
23181
23197
|
"session.first": keybind("ctrl+home,home,alt+home", "Navigate to first message"),
|
|
23182
23198
|
"session.last": keybind("ctrl+alt+g,end", "Navigate to last message"),
|
|
23183
23199
|
"session.message.next": keybind("none", "Navigate to next message"),
|
|
@@ -48545,7 +48561,7 @@ function brandSegment(theme, presetLabel, mode = "dark") {
|
|
|
48545
48561
|
function providerSegment(provider, theme, mode = "dark") {
|
|
48546
48562
|
if (!provider)
|
|
48547
48563
|
return null;
|
|
48548
|
-
const label = `\
|
|
48564
|
+
const label = `\uD83C\uDF10 ${provider}`;
|
|
48549
48565
|
if (!theme)
|
|
48550
48566
|
return {
|
|
48551
48567
|
text: label,
|
|
@@ -48989,6 +49005,303 @@ var init_powerline = __esm(() => {
|
|
|
48989
49005
|
};
|
|
48990
49006
|
});
|
|
48991
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
|
+
|
|
48992
49305
|
// ../tui-base/src/routes/session/widgets-dock.tsx
|
|
48993
49306
|
import { parseColor as parseColor3, TextAttributes as TextAttributes5 } from "@opentui/core";
|
|
48994
49307
|
function mixSkinColor(a, b, t) {
|
|
@@ -49102,6 +49415,9 @@ function skinDockLineFg(ctx, target, line) {
|
|
|
49102
49415
|
const t = skinLineFadeT(id);
|
|
49103
49416
|
return t >= 1 ? target : skinFadeInColor(target, ctx.background, t * SKIN_FADE_IN_MS);
|
|
49104
49417
|
}
|
|
49418
|
+
function resetMergedDockCursor() {
|
|
49419
|
+
setMergedDockCursor(0);
|
|
49420
|
+
}
|
|
49105
49421
|
function todoArray(text) {
|
|
49106
49422
|
if (text === undefined || text.trim() === "")
|
|
49107
49423
|
return;
|
|
@@ -49115,47 +49431,6 @@ function todoArray(text) {
|
|
|
49115
49431
|
} catch {}
|
|
49116
49432
|
return;
|
|
49117
49433
|
}
|
|
49118
|
-
function todoIcon(status) {
|
|
49119
|
-
if (status === "completed")
|
|
49120
|
-
return "\u2611";
|
|
49121
|
-
if (status === "in_progress")
|
|
49122
|
-
return "\u25D0";
|
|
49123
|
-
return "\u2610";
|
|
49124
|
-
}
|
|
49125
|
-
function statusRank(status) {
|
|
49126
|
-
if (status === "in_progress")
|
|
49127
|
-
return 0;
|
|
49128
|
-
if (status === "completed")
|
|
49129
|
-
return 2;
|
|
49130
|
-
return 1;
|
|
49131
|
-
}
|
|
49132
|
-
function compactRanges(numbers) {
|
|
49133
|
-
if (numbers.length === 0)
|
|
49134
|
-
return "";
|
|
49135
|
-
const runs = [];
|
|
49136
|
-
let start = numbers[0];
|
|
49137
|
-
let prev = start;
|
|
49138
|
-
for (const n of numbers.slice(1)) {
|
|
49139
|
-
if (n === prev + 1) {
|
|
49140
|
-
prev = n;
|
|
49141
|
-
continue;
|
|
49142
|
-
}
|
|
49143
|
-
runs.push(start === prev ? `${start}` : `${start}-${prev}`);
|
|
49144
|
-
start = prev = n;
|
|
49145
|
-
}
|
|
49146
|
-
runs.push(start === prev ? `${start}` : `${start}-${prev}`);
|
|
49147
|
-
return runs.join(",");
|
|
49148
|
-
}
|
|
49149
|
-
function padCell2(text, width, align = "left") {
|
|
49150
|
-
const flat = text.replace(/[\r\n]+/g, " ").trim();
|
|
49151
|
-
const clipped = clipToWidth(flat, width);
|
|
49152
|
-
const pad = Math.max(0, width - stringWidth(clipped));
|
|
49153
|
-
return align === "right" ? " ".repeat(pad) + clipped : clipped + " ".repeat(pad);
|
|
49154
|
-
}
|
|
49155
|
-
function borderedRow(boxWidth, inner) {
|
|
49156
|
-
const pad = Math.max(0, boxWidth - 4 - stringWidth(inner));
|
|
49157
|
-
return `\u2502 ${inner}${" ".repeat(pad)} \u2502`;
|
|
49158
|
-
}
|
|
49159
49434
|
function latestTodos(rows) {
|
|
49160
49435
|
const todoTool = [...rows].reverse().find((row) => row.kind === "tool" && TODO_TOOL_NAMES.has(row.name) && row.output !== undefined && row.status !== "failed");
|
|
49161
49436
|
if (todoTool?.kind !== "tool")
|
|
@@ -49177,63 +49452,6 @@ function todosSummaryLine(rows) {
|
|
|
49177
49452
|
});
|
|
49178
49453
|
return active ? `${head} \xB7 ${active.content}` : head;
|
|
49179
49454
|
}
|
|
49180
|
-
function todosTableWidth(terminalColumns) {
|
|
49181
|
-
return Math.max(16, terminalColumns - 1);
|
|
49182
|
-
}
|
|
49183
|
-
function todosTableLines(rows, width, terminalRows) {
|
|
49184
|
-
const todos = latestTodos(rows);
|
|
49185
|
-
if (todos.length === 0 || todos.every((todo) => todo.status === "completed"))
|
|
49186
|
-
return [];
|
|
49187
|
-
if (terminalRows !== undefined && terminalRows <= COMPOSER_COMPACT_TERMINAL_ROWS) {
|
|
49188
|
-
return [{
|
|
49189
|
-
text: todosSummaryLine(rows),
|
|
49190
|
-
tone: "muted",
|
|
49191
|
-
id: "dock:todos"
|
|
49192
|
-
}];
|
|
49193
|
-
}
|
|
49194
|
-
const boxWidth = Math.max(16, width);
|
|
49195
|
-
const innerWidth = boxWidth - 4;
|
|
49196
|
-
const colWidths = [3, 2, Math.max(1, innerWidth - 5 - TABLE_SEP.length * 2)];
|
|
49197
|
-
const border = "\u2500".repeat(Math.max(0, boxWidth - 2));
|
|
49198
|
-
const window = todos.map((todo, index) => ({
|
|
49199
|
-
todo,
|
|
49200
|
-
index
|
|
49201
|
-
})).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);
|
|
49202
|
-
const done = todos.filter((todo) => todo.status === "completed").length;
|
|
49203
|
-
const showing = window.length < todos.length ? ` \xB7 ${t("overlay.widgets.todosShowing", {
|
|
49204
|
-
ranges: compactRanges(window.map((entry) => entry.index + 1))
|
|
49205
|
-
})}` : "";
|
|
49206
|
-
const header = clipToWidth(t("overlay.widgets.todosHeader", {
|
|
49207
|
-
done,
|
|
49208
|
-
total: todos.length
|
|
49209
|
-
}) + showing, innerWidth);
|
|
49210
|
-
const out = [{
|
|
49211
|
-
text: `\u250C${border}\u2510`,
|
|
49212
|
-
tone: "muted"
|
|
49213
|
-
}, {
|
|
49214
|
-
text: borderedRow(boxWidth, header),
|
|
49215
|
-
tone: "muted"
|
|
49216
|
-
}, {
|
|
49217
|
-
text: borderedRow(boxWidth, [padCell2("#", colWidths[0], "right"), padCell2("\u2713", colWidths[1]), padCell2(t("overlay.widgets.taskColumn"), colWidths[2])].join(TABLE_SEP)),
|
|
49218
|
-
tone: "muted"
|
|
49219
|
-
}];
|
|
49220
|
-
for (const {
|
|
49221
|
-
todo,
|
|
49222
|
-
index
|
|
49223
|
-
} of window) {
|
|
49224
|
-
const cells = [padCell2(String(index + 1), colWidths[0], "right"), padCell2(todoIcon(todo.status), colWidths[1]), padCell2(todo.content, colWidths[2])].join(TABLE_SEP);
|
|
49225
|
-
const tone = todo.status === "completed" ? "ok" : todo.status === "in_progress" ? "running" : "muted";
|
|
49226
|
-
out.push({
|
|
49227
|
-
text: borderedRow(boxWidth, cells),
|
|
49228
|
-
tone
|
|
49229
|
-
});
|
|
49230
|
-
}
|
|
49231
|
-
out.push({
|
|
49232
|
-
text: `\u2514${border}\u2518`,
|
|
49233
|
-
tone: "muted"
|
|
49234
|
-
});
|
|
49235
|
-
return out;
|
|
49236
|
-
}
|
|
49237
49455
|
function toolMarker(status) {
|
|
49238
49456
|
return status === "running" ? "\u2699" : status === "failed" ? "\u2718" : "\u2714";
|
|
49239
49457
|
}
|
|
@@ -49543,6 +49761,34 @@ function createFrameLatch(ms = ACTIVITY_FRAME_DEFER_MS) {
|
|
|
49543
49761
|
dispose: clear
|
|
49544
49762
|
};
|
|
49545
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
|
+
}
|
|
49546
49792
|
function WidgetsDock(props) {
|
|
49547
49793
|
const dimensions = useTerminalSize();
|
|
49548
49794
|
const theme = useThemeOptional();
|
|
@@ -49554,55 +49800,136 @@ function WidgetsDock(props) {
|
|
|
49554
49800
|
});
|
|
49555
49801
|
onAnimationTick(() => motionAnimationRunning() && dockNeedsClock(props.rows) ? motionFrameRate() : undefined, () => setDockSpin((s) => s + 1));
|
|
49556
49802
|
const width = () => Math.max(16, dimensions().width - 4);
|
|
49557
|
-
const tableWidth = () => todosTableWidth(dimensions().width);
|
|
49558
|
-
const table = () => todosTableLines(props.rows, tableWidth(), dimensions().height);
|
|
49559
49803
|
const turnActive = () => props.turnActive?.() ?? dockTurnActive(props.rows);
|
|
49560
|
-
createEffect(() => activityFrameLatch.push(turnActive()));
|
|
49804
|
+
createEffect(() => activityFrameLatch.push(turnActive() || mergedLowerHasContent(props.rows)));
|
|
49561
49805
|
onCleanup(activityFrameLatch.dispose);
|
|
49562
49806
|
const frame = () => activityFrameMode(dimensions().height);
|
|
49563
49807
|
const capSpec = () => activityPanelCapSpec(activityPanelGear(), dimensions().height);
|
|
49564
49808
|
const lineCap = () => capSpec().maxLines;
|
|
49565
|
-
const
|
|
49566
|
-
|
|
49567
|
-
|
|
49568
|
-
|
|
49569
|
-
|
|
49570
|
-
|
|
49571
|
-
|
|
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);
|
|
49572
49895
|
const accentFg = (accent) => dockAccentColor(theme, accent);
|
|
49573
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
|
+
};
|
|
49574
49927
|
return (() => {
|
|
49575
|
-
var _el$ = createElement("box");
|
|
49576
|
-
setProp(_el
|
|
49577
|
-
setProp(_el
|
|
49578
|
-
setProp(_el
|
|
49579
|
-
insert(_el
|
|
49580
|
-
get when() {
|
|
49581
|
-
return table().length > 0;
|
|
49582
|
-
},
|
|
49583
|
-
get children() {
|
|
49584
|
-
var _el$2 = createElement("box");
|
|
49585
|
-
setProp(_el$2, "flexShrink", 0);
|
|
49586
|
-
setProp(_el$2, "flexDirection", "column");
|
|
49587
|
-
setProp(_el$2, "width", "100%");
|
|
49588
|
-
setProp(_el$2, "paddingLeft", 1);
|
|
49589
|
-
insert(_el$2, createComponent2(For, {
|
|
49590
|
-
get each() {
|
|
49591
|
-
return table();
|
|
49592
|
-
},
|
|
49593
|
-
children: (line) => (() => {
|
|
49594
|
-
var _el$4 = createElement("text");
|
|
49595
|
-
setProp(_el$4, "wrapMode", "none");
|
|
49596
|
-
insert(_el$4, () => takeWidth(line.text, tableWidth()));
|
|
49597
|
-
effect((_$p) => setProp(_el$4, "fg", fgFor(line.tone), _$p));
|
|
49598
|
-
return _el$4;
|
|
49599
|
-
})()
|
|
49600
|
-
}));
|
|
49601
|
-
effect((_$p) => setProp(_el$2, "height", table().length, _$p));
|
|
49602
|
-
return _el$2;
|
|
49603
|
-
}
|
|
49604
|
-
}), null);
|
|
49605
|
-
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, {
|
|
49606
49933
|
get when() {
|
|
49607
49934
|
return activityFrameLatch.shown();
|
|
49608
49935
|
},
|
|
@@ -49638,54 +49965,61 @@ function WidgetsDock(props) {
|
|
|
49638
49965
|
setProp(_el$5, "flexShrink", 0);
|
|
49639
49966
|
setProp(_el$5, "flexDirection", "column");
|
|
49640
49967
|
setProp(_el$5, "width", "100%");
|
|
49641
|
-
setProp(_el$5, "height", 2);
|
|
49642
49968
|
setProp(_el$5, "paddingLeft", 3);
|
|
49643
49969
|
insert(_el$5, createComponent2(For, {
|
|
49644
49970
|
get each() {
|
|
49645
49971
|
return activityRuleLines(props.rows);
|
|
49646
49972
|
},
|
|
49647
49973
|
children: lineView
|
|
49648
|
-
}));
|
|
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));
|
|
49649
49988
|
return _el$5;
|
|
49650
49989
|
})();
|
|
49651
49990
|
},
|
|
49652
49991
|
get children() {
|
|
49653
|
-
var _el$
|
|
49654
|
-
setProp(_el$
|
|
49655
|
-
setProp(_el$
|
|
49656
|
-
setProp(_el$
|
|
49657
|
-
setProp(_el$
|
|
49658
|
-
setProp(_el$
|
|
49659
|
-
setProp(_el$
|
|
49660
|
-
|
|
49661
|
-
|
|
49662
|
-
return frameBlocks().think;
|
|
49663
|
-
},
|
|
49664
|
-
children: lineView
|
|
49665
|
-
}), null);
|
|
49666
|
-
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, {
|
|
49667
50001
|
get each() {
|
|
49668
|
-
return
|
|
50002
|
+
return mergedFrame().lines;
|
|
49669
50003
|
},
|
|
49670
|
-
children:
|
|
49671
|
-
})
|
|
50004
|
+
children: mergedLineView
|
|
50005
|
+
}));
|
|
49672
50006
|
effect((_p$) => {
|
|
49673
|
-
var _v$ = frameHeight(), _v$2 = activityFrameBorderColor(theme), _v$3 =
|
|
49674
|
-
_v$ !== _p$.e && (_p$.e = setProp(_el$
|
|
49675
|
-
_v$2 !== _p$.t && (_p$.t = setProp(_el$
|
|
49676
|
-
_v$3 !== _p$.a && (_p$.a = setProp(_el$
|
|
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));
|
|
49677
50011
|
return _p$;
|
|
49678
50012
|
}, {
|
|
49679
50013
|
e: undefined,
|
|
49680
50014
|
t: undefined,
|
|
49681
50015
|
a: undefined
|
|
49682
50016
|
});
|
|
49683
|
-
return _el$
|
|
50017
|
+
return _el$4;
|
|
49684
50018
|
}
|
|
49685
50019
|
});
|
|
49686
50020
|
}
|
|
49687
|
-
})
|
|
49688
|
-
return _el
|
|
50021
|
+
}));
|
|
50022
|
+
return _el$3;
|
|
49689
50023
|
})();
|
|
49690
50024
|
}
|
|
49691
50025
|
function FlatDock(props) {
|
|
@@ -49696,19 +50030,19 @@ function FlatDock(props) {
|
|
|
49696
50030
|
} : {}
|
|
49697
50031
|
});
|
|
49698
50032
|
return (() => {
|
|
49699
|
-
var _el$
|
|
49700
|
-
setProp(_el$
|
|
49701
|
-
setProp(_el$
|
|
49702
|
-
setProp(_el$
|
|
49703
|
-
setProp(_el$
|
|
49704
|
-
insert(_el$
|
|
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, {
|
|
49705
50039
|
get each() {
|
|
49706
50040
|
return dockLines(props.rows, dockOptions());
|
|
49707
50041
|
},
|
|
49708
50042
|
children: (line) => dockLineNode(line, props.width, props.skinCtx, props.fgFor, props.accentFg)
|
|
49709
50043
|
}));
|
|
49710
|
-
effect((_$p) => setProp(_el$
|
|
49711
|
-
return _el$
|
|
50044
|
+
effect((_$p) => setProp(_el$7, "height", dockLines(props.rows, dockOptions()).length, _$p));
|
|
50045
|
+
return _el$7;
|
|
49712
50046
|
})();
|
|
49713
50047
|
}
|
|
49714
50048
|
function dockLineNode(line, width, ctx, fgFor, accentFg) {
|
|
@@ -49719,12 +50053,12 @@ function dockLineNode(line, width, ctx, fgFor, accentFg) {
|
|
|
49719
50053
|
const markerAt = line.markerAt ?? 0;
|
|
49720
50054
|
if (marker === undefined || line.text.slice(markerAt, markerAt + marker.length) !== marker) {
|
|
49721
50055
|
return (() => {
|
|
49722
|
-
var _el$
|
|
49723
|
-
setProp(_el$
|
|
49724
|
-
setProp(_el$
|
|
49725
|
-
setProp(_el$
|
|
49726
|
-
insert(_el$
|
|
49727
|
-
return _el$
|
|
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;
|
|
49728
50062
|
})();
|
|
49729
50063
|
}
|
|
49730
50064
|
const before = clipToWidth(line.text.slice(0, markerAt), width);
|
|
@@ -49733,21 +50067,21 @@ function dockLineNode(line, width, ctx, fgFor, accentFg) {
|
|
|
49733
50067
|
const after = clipToWidth(line.text.slice(markerAt + marker.length), Math.max(0, markerBudget - stringWidth(clippedMarker)));
|
|
49734
50068
|
const markerFg = skinDockLineFg(ctx, toneFg, line);
|
|
49735
50069
|
return (() => {
|
|
49736
|
-
var _el$
|
|
49737
|
-
insertNode(_el$
|
|
49738
|
-
setProp(_el$
|
|
49739
|
-
setProp(_el$
|
|
49740
|
-
setProp(_el$
|
|
49741
|
-
insert(_el$
|
|
49742
|
-
setProp(_el$
|
|
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", {
|
|
49743
50077
|
fg: markerFg
|
|
49744
50078
|
});
|
|
49745
|
-
insert(_el$
|
|
49746
|
-
insert(_el$
|
|
49747
|
-
return _el$
|
|
50079
|
+
insert(_el$0, clippedMarker);
|
|
50080
|
+
insert(_el$9, after, null);
|
|
50081
|
+
return _el$9;
|
|
49748
50082
|
})();
|
|
49749
50083
|
}
|
|
49750
|
-
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,
|
|
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;
|
|
49751
50085
|
var init_widgets_dock = __esm(() => {
|
|
49752
50086
|
init_index_bun();
|
|
49753
50087
|
init_index_bun();
|
|
@@ -49768,10 +50102,14 @@ var init_widgets_dock = __esm(() => {
|
|
|
49768
50102
|
init_semantic();
|
|
49769
50103
|
init_dock_visibility();
|
|
49770
50104
|
init_powerline();
|
|
50105
|
+
init_merged_dock();
|
|
50106
|
+
init_keymap();
|
|
50107
|
+
init_input_ownership();
|
|
49771
50108
|
ACTIVITY_PANEL_GEARS = ["1", "5", "7", "10", "all"];
|
|
49772
50109
|
[activityPanelGear, setActivityPanelGear] = createSignal(undefined);
|
|
49773
50110
|
lineFirstSeen = new Map;
|
|
49774
50111
|
[dockSpin, setDockSpin] = createSignal(0);
|
|
50112
|
+
[mergedDockCursor, setMergedDockCursor] = createSignal(0);
|
|
49775
50113
|
TODO_TOOL_NAMES = new Set(["todowrite", "todo_write"]);
|
|
49776
50114
|
ACTIVITY_BLUE_STEPS = [200, 100, 300, 400, 500, 600, 700];
|
|
49777
50115
|
DOCK_ACCENT_STEPS = {
|
|
@@ -50295,7 +50633,7 @@ function LastRequestDock(props) {
|
|
|
50295
50633
|
const fgFor = (tone) => tone === "running" ? theme?.text.feedback.warning.base ?? "#e0af68" : theme?.text.muted ?? "#9aa5ce";
|
|
50296
50634
|
const contentWidth = () => Math.max(16, dimensions().width - 1);
|
|
50297
50635
|
const lineWidth = (line) => Math.max(1, contentWidth() - (line.indent ?? 0));
|
|
50298
|
-
const lines = () => lastRequestLines(props.rows, props.lastRequest, contentWidth());
|
|
50636
|
+
const lines = () => lastRequestLines(props.rows, props.lastRequest, contentWidth()).filter((line) => line.id === "lr:echo");
|
|
50299
50637
|
const lineFg = (line) => {
|
|
50300
50638
|
const target = fgFor(line.tone);
|
|
50301
50639
|
if (!motionDecorationsEnabled() || line.id === undefined)
|
|
@@ -62418,7 +62756,7 @@ var init_subagents_viewer = __esm(() => {
|
|
|
62418
62756
|
import { TextAttributes as TextAttributes12 } from "@opentui/core";
|
|
62419
62757
|
function resolveVersion() {
|
|
62420
62758
|
try {
|
|
62421
|
-
return "0.
|
|
62759
|
+
return "0.20.0";
|
|
62422
62760
|
} catch {
|
|
62423
62761
|
return "dev";
|
|
62424
62762
|
}
|
|
@@ -65290,6 +65628,7 @@ function V2SessionPageBody(props) {
|
|
|
65290
65628
|
setComposerPending([]);
|
|
65291
65629
|
setTools(0);
|
|
65292
65630
|
resetSkinLineFades();
|
|
65631
|
+
resetMergedDockCursor();
|
|
65293
65632
|
const settled = projection.load(sessionId);
|
|
65294
65633
|
seam.currentModelSelection().then(setModel);
|
|
65295
65634
|
resetFooterProbe();
|
|
@@ -65318,6 +65657,7 @@ function V2SessionPageBody(props) {
|
|
|
65318
65657
|
resetFooterProbe();
|
|
65319
65658
|
refreshFooterData();
|
|
65320
65659
|
resetSkinLineFades();
|
|
65660
|
+
resetMergedDockCursor();
|
|
65321
65661
|
setSkillRows(props.skills ?? []);
|
|
65322
65662
|
setContextRevision((n) => n + 1);
|
|
65323
65663
|
},
|
|
@@ -66056,5 +66396,5 @@ export {
|
|
|
66056
66396
|
themeNameFromConfig
|
|
66057
66397
|
};
|
|
66058
66398
|
|
|
66059
|
-
//# debugId=
|
|
66399
|
+
//# debugId=5C4571E79EDDA20064756E2164756E21
|
|
66060
66400
|
//# sourceMappingURL=index.js.map
|