@standardagents/code 0.13.2 → 0.13.3
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/dist/index.js +67 -37
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1628,6 +1628,11 @@ function ensureImagePlaceholders(text, images) {
|
|
|
1628
1628
|
if (!missing.length) return text;
|
|
1629
1629
|
return [text.trimEnd(), ...missing].filter(Boolean).join(" ");
|
|
1630
1630
|
}
|
|
1631
|
+
function restoreTuiInput(input3 = process.stdin) {
|
|
1632
|
+
readline.emitKeypressEvents(input3);
|
|
1633
|
+
if (input3.isTTY) input3.setRawMode(true);
|
|
1634
|
+
input3.resume();
|
|
1635
|
+
}
|
|
1631
1636
|
var INPUT_BOX_MARGIN = 1;
|
|
1632
1637
|
function inputBoxBorderColor() {
|
|
1633
1638
|
return "\x1B[38;5;240m";
|
|
@@ -1903,10 +1908,10 @@ function sanitizeHudRow(s) {
|
|
|
1903
1908
|
var Tui = class _Tui {
|
|
1904
1909
|
constructor(level = 1) {
|
|
1905
1910
|
this.level = level;
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1911
|
+
process.stdin.on("keypress", (str, key) => {
|
|
1912
|
+
if (this.inputSuspendDepth === 0) this.dispatch(str, key);
|
|
1913
|
+
});
|
|
1914
|
+
restoreTuiInput();
|
|
1910
1915
|
process.stdout.write("\x1B[?2004h");
|
|
1911
1916
|
process.on("exit", () => process.stdout.write("\x1B[?2004l\x1B[?25h"));
|
|
1912
1917
|
process.stdout.on("resize", () => this.scheduleResizeRedraw());
|
|
@@ -1989,6 +1994,10 @@ var Tui = class _Tui {
|
|
|
1989
1994
|
// takeover (approval / menu) state
|
|
1990
1995
|
takeoverHandler = null;
|
|
1991
1996
|
bufferedPrints = [];
|
|
1997
|
+
// Plain readline prompts (notably the inline daemon installer) temporarily
|
|
1998
|
+
// own stdin. While they do, ignore the duplicate keypress events delivered
|
|
1999
|
+
// to this TUI; the outermost handoff restores raw/resumed input on return.
|
|
2000
|
+
inputSuspendDepth = 0;
|
|
1992
2001
|
// double-press-to-quit state: the first ctrl-c arms a brief window and shows a
|
|
1993
2002
|
// transient hint; a second ctrl-c within the window actually quits.
|
|
1994
2003
|
quitArmed = false;
|
|
@@ -2034,6 +2043,25 @@ var Tui = class _Tui {
|
|
|
2034
2043
|
lastDraftSeen = "";
|
|
2035
2044
|
onQuit = () => process.exit(0);
|
|
2036
2045
|
levelListeners = [];
|
|
2046
|
+
/**
|
|
2047
|
+
* Let a plain readline flow own stdin, then reliably hand it back to the TUI.
|
|
2048
|
+
* Supports nesting so a shared command may open more than one prompt.
|
|
2049
|
+
*/
|
|
2050
|
+
async withSuspendedInput(run3) {
|
|
2051
|
+
this.inputSuspendDepth++;
|
|
2052
|
+
if (this.inputSuspendDepth === 1) {
|
|
2053
|
+
process.stdout.write("\x1B[?2004l\x1B[?25h");
|
|
2054
|
+
}
|
|
2055
|
+
try {
|
|
2056
|
+
return await run3();
|
|
2057
|
+
} finally {
|
|
2058
|
+
this.inputSuspendDepth--;
|
|
2059
|
+
if (this.inputSuspendDepth === 0) {
|
|
2060
|
+
restoreTuiInput();
|
|
2061
|
+
process.stdout.write("\x1B[?2004h");
|
|
2062
|
+
}
|
|
2063
|
+
}
|
|
2064
|
+
}
|
|
2037
2065
|
/**
|
|
2038
2066
|
* Terminal resize fires continuously while the user drags. Redrawing on every
|
|
2039
2067
|
* event desyncs the region-height math (each paint uses a half-rewrapped
|
|
@@ -3910,7 +3938,7 @@ function readVersion() {
|
|
|
3910
3938
|
if (typeof pkg.version === "string" && pkg.version) return pkg.version;
|
|
3911
3939
|
} catch {
|
|
3912
3940
|
}
|
|
3913
|
-
return "0.13.
|
|
3941
|
+
return "0.13.3" ;
|
|
3914
3942
|
}
|
|
3915
3943
|
function isLocalHost(host) {
|
|
3916
3944
|
return host === "localhost" || host === "127.0.0.1" || host === "::1" || host.endsWith(".local") || host.endsWith(".localhost") || /^10\./.test(host) || /^192\.168\./.test(host) || /^172\.(1[6-9]|2\d|3[01])\./.test(host);
|
|
@@ -7802,45 +7830,47 @@ ${c5.dim}Install it with \`standardcode daemon install\`, or run this session on
|
|
|
7802
7830
|
return false;
|
|
7803
7831
|
}
|
|
7804
7832
|
localOfferAnswered = true;
|
|
7805
|
-
|
|
7806
|
-
|
|
7833
|
+
return tui.withSuspendedInput(async () => {
|
|
7834
|
+
stdout.write(
|
|
7835
|
+
`
|
|
7807
7836
|
${c5.bold}This machine has no always-on daemon${c5.reset} ${c5.dim}\u2014 the daemon is what runs sessions here.${c5.reset}
|
|
7808
7837
|
`
|
|
7809
|
-
|
|
7810
|
-
|
|
7811
|
-
|
|
7812
|
-
|
|
7813
|
-
|
|
7814
|
-
|
|
7815
|
-
|
|
7816
|
-
|
|
7817
|
-
|
|
7818
|
-
|
|
7819
|
-
|
|
7820
|
-
|
|
7821
|
-
|
|
7822
|
-
|
|
7823
|
-
|
|
7824
|
-
|
|
7838
|
+
);
|
|
7839
|
+
const promptRl = readline3.createInterface({ input: stdin, output: stdout });
|
|
7840
|
+
let answer = "";
|
|
7841
|
+
try {
|
|
7842
|
+
answer = (await promptRl.question(
|
|
7843
|
+
`${c5.white}Install it now so this machine can run sessions?${c5.reset} ${c5.dim}[Y/n]${c5.reset} `
|
|
7844
|
+
)).trim().toLowerCase();
|
|
7845
|
+
} catch {
|
|
7846
|
+
answer = "n";
|
|
7847
|
+
} finally {
|
|
7848
|
+
promptRl.close();
|
|
7849
|
+
}
|
|
7850
|
+
if (answer !== "" && answer !== "y" && answer !== "yes") {
|
|
7851
|
+
savePrefs({ daemon_install_declined_at: Date.now() });
|
|
7852
|
+
stdout.write(
|
|
7853
|
+
`${c5.dim}Okay \u2014 this machine can't run sessions until the daemon is installed.
|
|
7825
7854
|
Run \`standardcode daemon install\` any time, or pick another machine.${c5.reset}
|
|
7826
7855
|
|
|
7827
7856
|
`
|
|
7828
|
-
|
|
7829
|
-
|
|
7830
|
-
|
|
7831
|
-
|
|
7832
|
-
|
|
7833
|
-
|
|
7834
|
-
|
|
7835
|
-
|
|
7836
|
-
|
|
7837
|
-
|
|
7838
|
-
|
|
7857
|
+
);
|
|
7858
|
+
return false;
|
|
7859
|
+
}
|
|
7860
|
+
await runDaemonCommand(endpointOverride ? ["install", "--endpoint", endpoint] : ["install"]);
|
|
7861
|
+
stdout.write("\n");
|
|
7862
|
+
self = await loadMachine(api, identity.machine_id).catch(() => null) ?? self;
|
|
7863
|
+
localDaemonOnline = Boolean(self && daemonOnline(self));
|
|
7864
|
+
if (self) session.localName = machineDisplayName(self);
|
|
7865
|
+
if (!localDaemonOnline) {
|
|
7866
|
+
stdout.write(
|
|
7867
|
+
`${c5.dim}The daemon hasn't connected yet \u2014 check \`standardcode daemon status\`, or pick another machine.${c5.reset}
|
|
7839
7868
|
|
|
7840
7869
|
`
|
|
7841
|
-
|
|
7842
|
-
|
|
7843
|
-
|
|
7870
|
+
);
|
|
7871
|
+
}
|
|
7872
|
+
return localDaemonOnline;
|
|
7873
|
+
});
|
|
7844
7874
|
};
|
|
7845
7875
|
const launchDir = projectDir;
|
|
7846
7876
|
let tags = [];
|