@deepseek-ai/dsh-terminal-bash 0.1.6-alpha.1 → 0.1.6-alpha.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/lib/index.js +19 -9
- package/package.json +19 -18
package/lib/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { createRequire } from "node:module";
|
|
2
1
|
import { TerminalBackendCleanupError, TerminalError } from "@deepseek-ai/dsh-terminal";
|
|
3
2
|
import { ENCODING_PREAMBLE, resolvePwshPath } from "@deepseek-ai/dsh-pwsh-local";
|
|
4
3
|
import z from "@deepseek-ai/schemastery";
|
|
5
4
|
import { Buffer } from "node:buffer";
|
|
5
|
+
import { createLazyRequire } from "@deepseek-ai/dsh-lazy-require";
|
|
6
6
|
//#region lib/types/config.js
|
|
7
7
|
/** Validated configuration for the local PTY backend. */
|
|
8
8
|
/** Bash dialect default executable. */
|
|
@@ -232,7 +232,7 @@ function normalizeTerminalText(text) {
|
|
|
232
232
|
//#endregion
|
|
233
233
|
//#region lib/types/session.js
|
|
234
234
|
/** Persistent PTY session with bounded output, readiness, and terminal-protocol replies. */
|
|
235
|
-
const
|
|
235
|
+
const requireHeadless = createLazyRequire("@xterm/headless", import.meta.url);
|
|
236
236
|
function utf8Tail(text, maxBytes) {
|
|
237
237
|
if (Buffer.byteLength(text) <= maxBytes) return {
|
|
238
238
|
text,
|
|
@@ -450,6 +450,7 @@ var LocalPtySession = class {
|
|
|
450
450
|
this.terminal = terminal;
|
|
451
451
|
this.config = config;
|
|
452
452
|
this.pid = terminal.pid;
|
|
453
|
+
const { Terminal: HeadlessTerminal } = requireHeadless();
|
|
453
454
|
this.emulator = new HeadlessTerminal({
|
|
454
455
|
cols: config.cols,
|
|
455
456
|
rows: config.rows,
|
|
@@ -1010,6 +1011,15 @@ async function startupSession(session, dialect, timeoutMs, signal) {
|
|
|
1010
1011
|
if (signal !== void 0 && onAbort !== void 0) signal.removeEventListener("abort", onAbort);
|
|
1011
1012
|
}
|
|
1012
1013
|
}
|
|
1014
|
+
/** Reject a failed startup only after its unpublished resources reach quiescence. */
|
|
1015
|
+
async function rejectAfterStartupCleanup(error, cleanup) {
|
|
1016
|
+
try {
|
|
1017
|
+
await cleanup();
|
|
1018
|
+
} catch (cleanupError) {
|
|
1019
|
+
throw new TerminalBackendCleanupError(error, cleanupError);
|
|
1020
|
+
}
|
|
1021
|
+
throw error;
|
|
1022
|
+
}
|
|
1013
1023
|
/** Local shell backend registered under the configured type. */
|
|
1014
1024
|
var BashTerminalBackend = class {
|
|
1015
1025
|
ctx;
|
|
@@ -1041,17 +1051,17 @@ var BashTerminalBackend = class {
|
|
|
1041
1051
|
graceMs: this.config.disposeGraceMs,
|
|
1042
1052
|
signal: spec.signal
|
|
1043
1053
|
});
|
|
1044
|
-
|
|
1054
|
+
let session;
|
|
1055
|
+
try {
|
|
1056
|
+
session = this.createSession(terminal, this.config);
|
|
1057
|
+
} catch (error) {
|
|
1058
|
+
return rejectAfterStartupCleanup(error, () => terminal.terminate());
|
|
1059
|
+
}
|
|
1045
1060
|
try {
|
|
1046
1061
|
await startupSession(session, this.config.shellDialect, this.config.timeoutMs, spec.signal);
|
|
1047
1062
|
return session;
|
|
1048
1063
|
} catch (error) {
|
|
1049
|
-
|
|
1050
|
-
await session.close("PTY startup failed");
|
|
1051
|
-
} catch (closeError) {
|
|
1052
|
-
throw new TerminalBackendCleanupError(error, closeError);
|
|
1053
|
-
}
|
|
1054
|
-
throw error;
|
|
1064
|
+
return rejectAfterStartupCleanup(error, () => session.close("PTY startup failed"));
|
|
1055
1065
|
}
|
|
1056
1066
|
}
|
|
1057
1067
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-terminal-bash",
|
|
3
3
|
"description": "Persistent shell PTY backend over the DeepSeek Harness subprocess terminal primitive",
|
|
4
|
-
"version": "0.1.6-alpha.
|
|
4
|
+
"version": "0.1.6-alpha.2",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -27,29 +27,30 @@
|
|
|
27
27
|
],
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"@deepseek-ai/dsh-
|
|
31
|
-
"@deepseek-ai/dsh-
|
|
32
|
-
"@deepseek-ai/dsh-sandbox
|
|
33
|
-
"@deepseek-ai/dsh-
|
|
34
|
-
"@deepseek-ai/dsh-
|
|
35
|
-
"@deepseek-ai/dsh-subprocess": "^0.1.6-alpha.1",
|
|
30
|
+
"@deepseek-ai/dsh-agent": "^0.1.6-alpha.2",
|
|
31
|
+
"@deepseek-ai/dsh-terminal": "^0.1.6-alpha.2",
|
|
32
|
+
"@deepseek-ai/dsh-sandbox": "^0.1.6-alpha.2",
|
|
33
|
+
"@deepseek-ai/dsh-session": "^0.1.6-alpha.2",
|
|
34
|
+
"@deepseek-ai/dsh-subprocess": "^0.1.6-alpha.2",
|
|
36
35
|
"@deepseek-ai/cordis": "^4.0.2",
|
|
37
|
-
"@deepseek-ai/dsh-
|
|
36
|
+
"@deepseek-ai/dsh-sandbox-policy": "^0.1.6-alpha.2",
|
|
37
|
+
"@deepseek-ai/dsh-session-projection": "^0.1.6-alpha.2"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@xterm/headless": "^6.0.0",
|
|
41
|
-
"@deepseek-ai/dsh-
|
|
41
|
+
"@deepseek-ai/dsh-lazy-require": "^0.1.6-alpha.2",
|
|
42
|
+
"@deepseek-ai/dsh-pwsh-local": "^0.1.6-alpha.2",
|
|
42
43
|
"@deepseek-ai/schemastery": "^3.18.2"
|
|
43
44
|
},
|
|
44
45
|
"devDependencies": {
|
|
45
|
-
"@deepseek-ai/dsh-agent": "^0.1.6-alpha.
|
|
46
|
-
"@deepseek-ai/dsh-agent-loop-testkit": "^0.1.6-alpha.
|
|
47
|
-
"@deepseek-ai/dsh-terminal": "^0.1.6-alpha.
|
|
48
|
-
"@deepseek-ai/dsh-sandbox": "^0.1.6-alpha.
|
|
49
|
-
"@deepseek-ai/dsh-
|
|
50
|
-
"@deepseek-ai/dsh-
|
|
51
|
-
"@deepseek-ai/dsh-subprocess-local": "^0.1.6-alpha.
|
|
52
|
-
"@deepseek-ai/
|
|
53
|
-
"@deepseek-ai/
|
|
46
|
+
"@deepseek-ai/dsh-agent": "^0.1.6-alpha.2",
|
|
47
|
+
"@deepseek-ai/dsh-agent-loop-testkit": "^0.1.6-alpha.2",
|
|
48
|
+
"@deepseek-ai/dsh-terminal": "^0.1.6-alpha.2",
|
|
49
|
+
"@deepseek-ai/dsh-sandbox": "^0.1.6-alpha.2",
|
|
50
|
+
"@deepseek-ai/dsh-sandbox-policy": "^0.1.6-alpha.2",
|
|
51
|
+
"@deepseek-ai/dsh-session": "^0.1.6-alpha.2",
|
|
52
|
+
"@deepseek-ai/dsh-subprocess-local": "^0.1.6-alpha.2",
|
|
53
|
+
"@deepseek-ai/dsh-subprocess": "^0.1.6-alpha.2",
|
|
54
|
+
"@deepseek-ai/cordis": "^4.0.2"
|
|
54
55
|
}
|
|
55
56
|
}
|