@staff0rd/assist 0.305.0 → 0.305.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 +44 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.305.
|
|
9
|
+
version: "0.305.3",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -5703,7 +5703,7 @@ function isDone(session) {
|
|
|
5703
5703
|
return session.status === "done";
|
|
5704
5704
|
}
|
|
5705
5705
|
function logEvent(event, session) {
|
|
5706
|
-
const origin = isWindowsSessionId(session.id) ? "windows" :
|
|
5706
|
+
const origin = isWindowsSessionId(session.id) ? "windows" : detectPlatform();
|
|
5707
5707
|
console.log(
|
|
5708
5708
|
`${(/* @__PURE__ */ new Date()).toISOString()} session ${event}: ${session.id}${describe(session)} [${origin} daemon]`
|
|
5709
5709
|
);
|
|
@@ -18902,6 +18902,36 @@ function greetClient(client, sessions, windowsProxy) {
|
|
|
18902
18902
|
void windowsProxy.discover();
|
|
18903
18903
|
}
|
|
18904
18904
|
|
|
18905
|
+
// src/commands/sessions/daemon/watchEscInterrupt.ts
|
|
18906
|
+
var ESC2 = "\x1B";
|
|
18907
|
+
var SETTLE_MS = 1e3;
|
|
18908
|
+
function isInterruptKey(data) {
|
|
18909
|
+
return data === ESC2;
|
|
18910
|
+
}
|
|
18911
|
+
function scheduleSettle(session, onStatusChange) {
|
|
18912
|
+
if (session.escInterruptTimer) clearTimeout(session.escInterruptTimer);
|
|
18913
|
+
session.escInterruptTimer = setTimeout(() => {
|
|
18914
|
+
session.escInterruptTimer = void 0;
|
|
18915
|
+
if (session.status !== "running") return;
|
|
18916
|
+
daemonLog(`session ${session.id} esc-interrupt settled -> waiting`);
|
|
18917
|
+
onStatusChange(session, "waiting");
|
|
18918
|
+
}, SETTLE_MS);
|
|
18919
|
+
}
|
|
18920
|
+
function watchEscInterrupt(session, data, onStatusChange) {
|
|
18921
|
+
if (session.status !== "running") return;
|
|
18922
|
+
if (!isInterruptKey(data)) return;
|
|
18923
|
+
scheduleSettle(session, onStatusChange);
|
|
18924
|
+
}
|
|
18925
|
+
function noteOutputForEscInterrupt(session, onStatusChange) {
|
|
18926
|
+
if (!session.escInterruptTimer) return;
|
|
18927
|
+
scheduleSettle(session, onStatusChange);
|
|
18928
|
+
}
|
|
18929
|
+
function disarmEscInterrupt(session) {
|
|
18930
|
+
if (!session.escInterruptTimer) return;
|
|
18931
|
+
clearTimeout(session.escInterruptTimer);
|
|
18932
|
+
session.escInterruptTimer = void 0;
|
|
18933
|
+
}
|
|
18934
|
+
|
|
18905
18935
|
// src/commands/sessions/daemon/shouldAutoDismiss.ts
|
|
18906
18936
|
function shouldAutoDismiss(session, exitCode) {
|
|
18907
18937
|
const args = session.assistArgs;
|
|
@@ -18924,6 +18954,7 @@ function shouldAutoRun(session, exitCode) {
|
|
|
18924
18954
|
|
|
18925
18955
|
// src/commands/sessions/daemon/applyStatusChange.ts
|
|
18926
18956
|
function applyStatusChange(session, status2, exitCode, dismiss, notify2, reuseForRun) {
|
|
18957
|
+
disarmEscInterrupt(session);
|
|
18927
18958
|
if (session.status === status2) return;
|
|
18928
18959
|
daemonLog(`session ${session.id} status: ${session.status} -> ${status2}`);
|
|
18929
18960
|
session.status = status2;
|
|
@@ -19119,6 +19150,7 @@ function wirePtyEvents(session, clients, onStatusChange) {
|
|
|
19119
19150
|
if (!session.pty) return;
|
|
19120
19151
|
session.pty.onData((data) => {
|
|
19121
19152
|
appendScrollback(session, data);
|
|
19153
|
+
noteOutputForEscInterrupt(session, onStatusChange);
|
|
19122
19154
|
broadcast(clients, { type: "output", sessionId: session.id, data });
|
|
19123
19155
|
});
|
|
19124
19156
|
session.pty.onExit(({ exitCode }) => {
|
|
@@ -19195,6 +19227,7 @@ function windowsDaemonHost() {
|
|
|
19195
19227
|
function connectToWindowsDaemon() {
|
|
19196
19228
|
return new Promise((resolve16, reject) => {
|
|
19197
19229
|
const socket = net2.connect(windowsDaemonPort(), windowsDaemonHost());
|
|
19230
|
+
socket.setKeepAlive(true, 1e4);
|
|
19198
19231
|
socket.once("connect", () => resolve16(socket));
|
|
19199
19232
|
socket.once("error", reject);
|
|
19200
19233
|
});
|
|
@@ -19961,9 +19994,11 @@ function isBacklogRun2(session) {
|
|
|
19961
19994
|
}
|
|
19962
19995
|
|
|
19963
19996
|
// src/commands/sessions/daemon/writeToSession.ts
|
|
19964
|
-
function writeToSession(sessions, id2, data) {
|
|
19997
|
+
function writeToSession(sessions, id2, data, onStatusChange) {
|
|
19965
19998
|
const s = sessions.get(id2);
|
|
19966
|
-
if (s
|
|
19999
|
+
if (!s || s.status === "done") return;
|
|
20000
|
+
s.pty?.write(data);
|
|
20001
|
+
watchEscInterrupt(s, data, onStatusChange);
|
|
19967
20002
|
}
|
|
19968
20003
|
function resizeSession(sessions, id2, cols, rows) {
|
|
19969
20004
|
const s = sessions.get(id2);
|
|
@@ -20057,7 +20092,7 @@ var SessionManager = class {
|
|
|
20057
20092
|
this.notify();
|
|
20058
20093
|
}
|
|
20059
20094
|
writeToSession(id2, data) {
|
|
20060
|
-
writeToSession(this.sessions, id2, data);
|
|
20095
|
+
writeToSession(this.sessions, id2, data, this.onStatusChange);
|
|
20061
20096
|
}
|
|
20062
20097
|
resizeSession(id2, cols, rows) {
|
|
20063
20098
|
resizeSession(this.sessions, id2, cols, rows);
|
|
@@ -20382,9 +20417,10 @@ function startDaemonServer(manager, checkAutoExit) {
|
|
|
20382
20417
|
}
|
|
20383
20418
|
function startWindowsBridge(manager) {
|
|
20384
20419
|
const port = windowsDaemonPort();
|
|
20385
|
-
const bridge = net3.createServer(
|
|
20386
|
-
|
|
20387
|
-
|
|
20420
|
+
const bridge = net3.createServer((socket) => {
|
|
20421
|
+
socket.setKeepAlive(true, 1e4);
|
|
20422
|
+
handleConnection(socket, manager);
|
|
20423
|
+
});
|
|
20388
20424
|
bridge.on(
|
|
20389
20425
|
"error",
|
|
20390
20426
|
(e) => daemonLog(`windows bridge error: ${e.message}`)
|