@phenx-inc/ctlsurf 0.5.0 → 0.5.1
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/out/headless/index.mjs +36 -18
- package/out/headless/index.mjs.map +2 -2
- package/package.json +1 -1
- package/src/main/tui.ts +39 -17
package/out/headless/index.mjs
CHANGED
|
@@ -5471,7 +5471,7 @@ var require_package = __commonJS({
|
|
|
5471
5471
|
"package.json"(exports, module) {
|
|
5472
5472
|
module.exports = {
|
|
5473
5473
|
name: "@phenx-inc/ctlsurf",
|
|
5474
|
-
version: "0.5.
|
|
5474
|
+
version: "0.5.1",
|
|
5475
5475
|
description: "Agent-agnostic terminal and desktop app for ctlsurf \u2014 run Claude Code, Codex, or any coding agent with live session logging and remote control",
|
|
5476
5476
|
main: "out/main/index.js",
|
|
5477
5477
|
bin: {
|
|
@@ -7758,6 +7758,9 @@ var Tui = class {
|
|
|
7758
7758
|
let selected = 0;
|
|
7759
7759
|
let trackTime = options.initialTrackTime;
|
|
7760
7760
|
let logChat = options.initialLogChat;
|
|
7761
|
+
const trackIdx = agents.length;
|
|
7762
|
+
const logIdx = agents.length + 1;
|
|
7763
|
+
const itemCount = agents.length + 2;
|
|
7761
7764
|
const modalWidth = 44;
|
|
7762
7765
|
const modalHeight = agents.length + 4 + 3;
|
|
7763
7766
|
const startCol = Math.max(1, Math.floor((this.cols - modalWidth) / 2));
|
|
@@ -7796,23 +7799,23 @@ var Tui = class {
|
|
|
7796
7799
|
const innerSep = "\u251C" + "\u2500".repeat(modalWidth - 2) + "\u2524";
|
|
7797
7800
|
const sepRow = startRow + 3 + agents.length;
|
|
7798
7801
|
this.write(`${CSI}${sepRow};${startCol}H${BG_MODAL}${FG_DIM}${innerSep}${RESET}`);
|
|
7802
|
+
const drawCheckboxRow = (row, label, checked, isSelected) => {
|
|
7803
|
+
const bg = isSelected ? BG_SELECTED : BG_MODAL;
|
|
7804
|
+
const pointer = isSelected ? `${FG_ACCENT}\u25B8 ` : " ";
|
|
7805
|
+
const checkbox = checked ? `${FG_GREEN}[\u2713]${RESET}${bg}` : `${FG_DIM}[ ]${RESET}${bg}`;
|
|
7806
|
+
const labelFg = checked || isSelected ? FG_WHITE : FG_DIM;
|
|
7807
|
+
const content = `${pointer}${checkbox} ${labelFg}${label}${RESET}${bg}`;
|
|
7808
|
+
const contentLen = 2 + 3 + 1 + label.length;
|
|
7809
|
+
const pad = " ".repeat(Math.max(0, modalWidth - 2 - contentLen));
|
|
7810
|
+
this.write(`${CSI}${row};${startCol}H${bg}${FG_DIM}\u2502${RESET}${bg}${content}${pad}${RESET}${BG_MODAL}${FG_DIM}\u2502${RESET}`);
|
|
7811
|
+
};
|
|
7799
7812
|
const trackRow = sepRow + 1;
|
|
7800
|
-
|
|
7801
|
-
const trackLabelFg = trackTime ? FG_WHITE : FG_DIM;
|
|
7802
|
-
const trackContent = ` ${checkbox} ${trackLabelFg}Track time${RESET}${BG_MODAL}`;
|
|
7803
|
-
const trackContentLen = 2 + 3 + 1 + "Track time".length;
|
|
7804
|
-
const trackPad = " ".repeat(Math.max(0, modalWidth - 2 - trackContentLen));
|
|
7805
|
-
this.write(`${CSI}${trackRow};${startCol}H${BG_MODAL}${FG_DIM}\u2502${RESET}${BG_MODAL}${trackContent}${trackPad}${FG_DIM}\u2502${RESET}`);
|
|
7813
|
+
drawCheckboxRow(trackRow, "Track time", trackTime, selected === trackIdx);
|
|
7806
7814
|
const logRow = trackRow + 1;
|
|
7807
|
-
|
|
7808
|
-
const logLabelFg = logChat ? FG_WHITE : FG_DIM;
|
|
7809
|
-
const logContent = ` ${logCheckbox} ${logLabelFg}Log chat${RESET}${BG_MODAL}`;
|
|
7810
|
-
const logContentLen = 2 + 3 + 1 + "Log chat".length;
|
|
7811
|
-
const logPad = " ".repeat(Math.max(0, modalWidth - 2 - logContentLen));
|
|
7812
|
-
this.write(`${CSI}${logRow};${startCol}H${BG_MODAL}${FG_DIM}\u2502${RESET}${BG_MODAL}${logContent}${logPad}${FG_DIM}\u2502${RESET}`);
|
|
7815
|
+
drawCheckboxRow(logRow, "Log chat", logChat, selected === logIdx);
|
|
7813
7816
|
const botRow = logRow + 1;
|
|
7814
7817
|
this.write(`${CSI}${botRow};${startCol}H${BG_MODAL}${FG_DIM}${botBorder}${RESET}`);
|
|
7815
|
-
const hint = "\u2191\u2193 nav \xB7 Enter
|
|
7818
|
+
const hint = "\u2191\u2193 nav \xB7 Enter select \xB7 Space toggle \xB7 q quit";
|
|
7816
7819
|
const hintCol = Math.max(1, Math.floor((this.cols - hint.length) / 2));
|
|
7817
7820
|
this.write(`${CSI}${botRow + 2};${hintCol}H${FG_DIM}${hint}${RESET}`);
|
|
7818
7821
|
};
|
|
@@ -7823,11 +7826,22 @@ var Tui = class {
|
|
|
7823
7826
|
process.stdin.resume();
|
|
7824
7827
|
const onKey = (data) => {
|
|
7825
7828
|
const key = data.toString();
|
|
7829
|
+
const toggleSelected = () => {
|
|
7830
|
+
if (selected === trackIdx) {
|
|
7831
|
+
trackTime = !trackTime;
|
|
7832
|
+
} else if (selected === logIdx) {
|
|
7833
|
+
logChat = !logChat;
|
|
7834
|
+
} else {
|
|
7835
|
+
return false;
|
|
7836
|
+
}
|
|
7837
|
+
drawModal();
|
|
7838
|
+
return true;
|
|
7839
|
+
};
|
|
7826
7840
|
if (key === "\x1B[A" || key === "k") {
|
|
7827
|
-
selected = (selected - 1 +
|
|
7841
|
+
selected = (selected - 1 + itemCount) % itemCount;
|
|
7828
7842
|
drawModal();
|
|
7829
7843
|
} else if (key === "\x1B[B" || key === "j") {
|
|
7830
|
-
selected = (selected + 1) %
|
|
7844
|
+
selected = (selected + 1) % itemCount;
|
|
7831
7845
|
drawModal();
|
|
7832
7846
|
} else if (key === "t" || key === "T") {
|
|
7833
7847
|
trackTime = !trackTime;
|
|
@@ -7835,9 +7849,13 @@ var Tui = class {
|
|
|
7835
7849
|
} else if (key === "l" || key === "L") {
|
|
7836
7850
|
logChat = !logChat;
|
|
7837
7851
|
drawModal();
|
|
7852
|
+
} else if (key === " ") {
|
|
7853
|
+
toggleSelected();
|
|
7838
7854
|
} else if (key === "\r" || key === "\n") {
|
|
7839
|
-
|
|
7840
|
-
|
|
7855
|
+
if (!toggleSelected()) {
|
|
7856
|
+
cleanup();
|
|
7857
|
+
resolve({ agentIdx: selected, trackTime, logChat });
|
|
7858
|
+
}
|
|
7841
7859
|
} else if (key === "q" || key === "\x1B" || key === "") {
|
|
7842
7860
|
cleanup();
|
|
7843
7861
|
this.write(`${CSI}?25h`);
|