neuralos 3.2.1 → 3.2.2
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/bin/gybackend.cjs +45 -15
- package/package.json +2 -2
package/bin/gybackend.cjs
CHANGED
|
@@ -295047,7 +295047,7 @@ var normalizeTerminalResizeTarget = (cols, rows) => {
|
|
|
295047
295047
|
rows: Math.max(1, Math.floor(rows))
|
|
295048
295048
|
};
|
|
295049
295049
|
};
|
|
295050
|
-
var TerminalService = class {
|
|
295050
|
+
var TerminalService = class _TerminalService {
|
|
295051
295051
|
backends = /* @__PURE__ */ new Map();
|
|
295052
295052
|
terminals = /* @__PURE__ */ new Map();
|
|
295053
295053
|
terminalConfigs = /* @__PURE__ */ new Map();
|
|
@@ -295058,6 +295058,8 @@ var TerminalService = class {
|
|
|
295058
295058
|
/** Buffered writes for terminals that aren't writable yet (prevents keystroke loss during reconnection). */
|
|
295059
295059
|
pendingWrites = /* @__PURE__ */ new Map();
|
|
295060
295060
|
pendingWriteTimers = /* @__PURE__ */ new Map();
|
|
295061
|
+
pendingWriteRetries = /* @__PURE__ */ new Map();
|
|
295062
|
+
static MAX_WRITE_RETRIES = 3;
|
|
295061
295063
|
selectionByTerminal = /* @__PURE__ */ new Map();
|
|
295062
295064
|
tasksByTerminal = /* @__PURE__ */ new Map();
|
|
295063
295065
|
activeTaskByTerminal = /* @__PURE__ */ new Map();
|
|
@@ -295619,21 +295621,28 @@ var TerminalService = class {
|
|
|
295619
295621
|
handleData(terminalId, data) {
|
|
295620
295622
|
const sanitizedData = stripInternalControlMarkers(data);
|
|
295621
295623
|
const tab = this.terminals.get(terminalId);
|
|
295622
|
-
|
|
295623
|
-
|
|
295624
|
-
|
|
295625
|
-
|
|
295626
|
-
|
|
295627
|
-
|
|
295628
|
-
|
|
295629
|
-
|
|
295630
|
-
|
|
295631
|
-
|
|
295632
|
-
|
|
295633
|
-
|
|
295634
|
-
|
|
295624
|
+
if (sanitizedData) {
|
|
295625
|
+
const recordingId = this.activeRecordings.get(terminalId);
|
|
295626
|
+
if (recordingId || this.sessionLogger && tab) {
|
|
295627
|
+
const captureData = sanitizedData;
|
|
295628
|
+
const captureTab = tab;
|
|
295629
|
+
const captureId = recordingId;
|
|
295630
|
+
setImmediate(() => {
|
|
295631
|
+
if (captureId && this.sessionRecorder) {
|
|
295632
|
+
try {
|
|
295633
|
+
this.sessionRecorder.out(captureId, captureData);
|
|
295634
|
+
} catch {
|
|
295635
|
+
}
|
|
295636
|
+
}
|
|
295637
|
+
if (this.sessionLogger && captureTab) {
|
|
295638
|
+
if (!this.sessionLogStarted.has(terminalId)) {
|
|
295639
|
+
this.sessionLogStarted.add(terminalId);
|
|
295640
|
+
this.sessionLogger.start(terminalId, { title: captureTab.title || terminalId, type: captureTab.type });
|
|
295641
|
+
}
|
|
295642
|
+
this.sessionLogger.write(terminalId, captureData);
|
|
295643
|
+
}
|
|
295644
|
+
});
|
|
295635
295645
|
}
|
|
295636
|
-
this.sessionLogger.write(terminalId, sanitizedData);
|
|
295637
295646
|
}
|
|
295638
295647
|
if (tab) {
|
|
295639
295648
|
let shouldPublishTabsChanged = false;
|
|
@@ -295952,7 +295961,24 @@ ${promptPrefix}`;
|
|
|
295952
295961
|
if (terminal && this.canWriteToTerminal(terminal)) {
|
|
295953
295962
|
const backend = this.getBackend(terminal.type);
|
|
295954
295963
|
backend.write(terminal.ptyId, data);
|
|
295964
|
+
this.pendingWriteRetries.delete(terminalId);
|
|
295955
295965
|
} else if (terminal) {
|
|
295966
|
+
if (terminal.runtimeState === "exited") {
|
|
295967
|
+
this.pendingWrites.delete(terminalId);
|
|
295968
|
+
this.pendingWriteRetries.delete(terminalId);
|
|
295969
|
+
const timer = this.pendingWriteTimers.get(terminalId);
|
|
295970
|
+
if (timer) {
|
|
295971
|
+
clearTimeout(timer);
|
|
295972
|
+
this.pendingWriteTimers.delete(terminalId);
|
|
295973
|
+
}
|
|
295974
|
+
return;
|
|
295975
|
+
}
|
|
295976
|
+
const retries = this.pendingWriteRetries.get(terminalId) ?? 0;
|
|
295977
|
+
if (retries >= _TerminalService.MAX_WRITE_RETRIES) {
|
|
295978
|
+
this.pendingWrites.delete(terminalId);
|
|
295979
|
+
this.pendingWriteRetries.delete(terminalId);
|
|
295980
|
+
return;
|
|
295981
|
+
}
|
|
295956
295982
|
const pending = this.pendingWrites.get(terminalId) ?? "";
|
|
295957
295983
|
this.pendingWrites.set(terminalId, pending + data);
|
|
295958
295984
|
if (!this.pendingWriteTimers.has(terminalId)) {
|
|
@@ -295962,8 +295988,11 @@ ${promptPrefix}`;
|
|
|
295962
295988
|
const buffered = this.pendingWrites.get(terminalId);
|
|
295963
295989
|
if (term && buffered && this.canWriteToTerminal(term)) {
|
|
295964
295990
|
this.pendingWrites.delete(terminalId);
|
|
295991
|
+
this.pendingWriteRetries.delete(terminalId);
|
|
295965
295992
|
const b = this.getBackend(term.type);
|
|
295966
295993
|
b.write(term.ptyId, buffered);
|
|
295994
|
+
} else {
|
|
295995
|
+
this.pendingWriteRetries.set(terminalId, retries + 1);
|
|
295967
295996
|
}
|
|
295968
295997
|
}, 500);
|
|
295969
295998
|
this.pendingWriteTimers.set(terminalId, timer);
|
|
@@ -296023,6 +296052,7 @@ ${promptPrefix}`;
|
|
|
296023
296052
|
kill(terminalId) {
|
|
296024
296053
|
this.pendingResizeByTerminal.delete(terminalId);
|
|
296025
296054
|
this.pendingWrites.delete(terminalId);
|
|
296055
|
+
this.pendingWriteRetries.delete(terminalId);
|
|
296026
296056
|
const writeTimer = this.pendingWriteTimers.get(terminalId);
|
|
296027
296057
|
if (writeTimer) {
|
|
296028
296058
|
clearTimeout(writeTimer);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "neuralos",
|
|
3
|
-
"version": "3.2.
|
|
4
|
-
"description": "Headless AI-native backend for RTerm / neuralOS — v3.2.
|
|
3
|
+
"version": "3.2.2",
|
|
4
|
+
"description": "Headless AI-native backend for RTerm / neuralOS — v3.2.2: 5 edge case fixes (session-busy race, heavy output batching, stop-during-approval, stop debounce, write-retry limit). 11 plugins, 55 plugin tools wired. Transports (SSH/serial/local), SQLite, and NATS libs install automatically.",
|
|
5
5
|
"main": "bin/gybackend.cjs",
|
|
6
6
|
"bin": { "gybackend": "bin/gybackend.cjs" },
|
|
7
7
|
"license": "MIT",
|