terminal-pilot 0.0.7 → 0.0.9
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/cli.js +66 -103
- package/dist/cli.js.map +4 -4
- package/dist/commands/close-session.js +33 -81
- package/dist/commands/close-session.js.map +3 -3
- package/dist/commands/create-session.js +33 -81
- package/dist/commands/create-session.js.map +3 -3
- package/dist/commands/fill.js +33 -81
- package/dist/commands/fill.js.map +3 -3
- package/dist/commands/get-session.js +33 -81
- package/dist/commands/get-session.js.map +3 -3
- package/dist/commands/index.js +41 -92
- package/dist/commands/index.js.map +4 -4
- package/dist/commands/install.js +2 -5
- package/dist/commands/install.js.map +4 -4
- package/dist/commands/installer.js +2 -5
- package/dist/commands/installer.js.map +4 -4
- package/dist/commands/list-sessions.js +33 -81
- package/dist/commands/list-sessions.js.map +3 -3
- package/dist/commands/press-key.js +33 -81
- package/dist/commands/press-key.js.map +3 -3
- package/dist/commands/read-history.js +33 -81
- package/dist/commands/read-history.js.map +3 -3
- package/dist/commands/read-screen.js +33 -81
- package/dist/commands/read-screen.js.map +3 -3
- package/dist/commands/resize.js +33 -81
- package/dist/commands/resize.js.map +3 -3
- package/dist/commands/runtime.js +33 -81
- package/dist/commands/runtime.js.map +3 -3
- package/dist/commands/screenshot.js +33 -81
- package/dist/commands/screenshot.js.map +3 -3
- package/dist/commands/send-signal.js +33 -81
- package/dist/commands/send-signal.js.map +3 -3
- package/dist/commands/type.js +33 -81
- package/dist/commands/type.js.map +3 -3
- package/dist/commands/uninstall.js +1 -4
- package/dist/commands/uninstall.js.map +4 -4
- package/dist/commands/wait-for-exit.js +33 -81
- package/dist/commands/wait-for-exit.js.map +3 -3
- package/dist/commands/wait-for.js +33 -81
- package/dist/commands/wait-for.js.map +3 -3
- package/dist/index.js +33 -81
- package/dist/index.js.map +3 -3
- package/dist/terminal-pilot.js +33 -81
- package/dist/terminal-pilot.js.map +3 -3
- package/dist/terminal-session.js +33 -81
- package/dist/terminal-session.js.map +3 -3
- package/dist/testing/cli-repl.js +66 -103
- package/dist/testing/cli-repl.js.map +4 -4
- package/dist/testing/qa-cli.js +66 -103
- package/dist/testing/qa-cli.js.map +4 -4
- package/package.json +1 -1
|
@@ -253,8 +253,10 @@ function defineCommand(config) {
|
|
|
253
253
|
import { randomUUID } from "node:crypto";
|
|
254
254
|
|
|
255
255
|
// src/terminal-session.ts
|
|
256
|
-
import { spawn as spawnChildProcess } from "node:child_process";
|
|
257
256
|
import { EventEmitter } from "node:events";
|
|
257
|
+
import { accessSync, chmodSync, constants } from "node:fs";
|
|
258
|
+
import { createRequire } from "node:module";
|
|
259
|
+
import { dirname, join } from "node:path";
|
|
258
260
|
import * as nodePty from "node-pty";
|
|
259
261
|
|
|
260
262
|
// src/ansi.ts
|
|
@@ -1165,93 +1167,43 @@ function createPtyProcess({
|
|
|
1165
1167
|
cols,
|
|
1166
1168
|
rows
|
|
1167
1169
|
}) {
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
cwd,
|
|
1171
|
-
env,
|
|
1172
|
-
cols,
|
|
1173
|
-
rows,
|
|
1174
|
-
encoding: "utf8"
|
|
1175
|
-
});
|
|
1176
|
-
} catch {
|
|
1177
|
-
return createChildProcessFallback({ command, args, cwd, env });
|
|
1178
|
-
}
|
|
1179
|
-
}
|
|
1180
|
-
function createChildProcessFallback({
|
|
1181
|
-
command,
|
|
1182
|
-
args,
|
|
1183
|
-
cwd,
|
|
1184
|
-
env
|
|
1185
|
-
}) {
|
|
1186
|
-
const child = spawnChildProcess(command, args, {
|
|
1170
|
+
ensureSpawnHelperExecutable();
|
|
1171
|
+
return nodePty.spawn(command, args, {
|
|
1187
1172
|
cwd,
|
|
1188
1173
|
env,
|
|
1189
|
-
|
|
1174
|
+
cols,
|
|
1175
|
+
rows,
|
|
1176
|
+
encoding: "utf8"
|
|
1190
1177
|
});
|
|
1191
|
-
return new ChildProcessFallback(child);
|
|
1192
1178
|
}
|
|
1193
|
-
var
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
}
|
|
1212
|
-
write(data) {
|
|
1213
|
-
this.child.stdin.write(data);
|
|
1214
|
-
}
|
|
1215
|
-
resize() {
|
|
1216
|
-
}
|
|
1217
|
-
kill(signal) {
|
|
1218
|
-
this.child.kill(signal);
|
|
1219
|
-
}
|
|
1220
|
-
onData(listener) {
|
|
1221
|
-
this.dataEmitter.on("data", listener);
|
|
1222
|
-
return {
|
|
1223
|
-
dispose: () => {
|
|
1224
|
-
this.dataEmitter.off("data", listener);
|
|
1225
|
-
}
|
|
1226
|
-
};
|
|
1227
|
-
}
|
|
1228
|
-
onExit(listener) {
|
|
1229
|
-
this.exitEmitter.on("exit", listener);
|
|
1230
|
-
return {
|
|
1231
|
-
dispose: () => {
|
|
1232
|
-
this.exitEmitter.off("exit", listener);
|
|
1179
|
+
var spawnHelperChecked = false;
|
|
1180
|
+
function ensureSpawnHelperExecutable() {
|
|
1181
|
+
if (spawnHelperChecked) return;
|
|
1182
|
+
spawnHelperChecked = true;
|
|
1183
|
+
const require2 = createRequire(import.meta.url);
|
|
1184
|
+
const nodePtyDir = dirname(require2.resolve("node-pty"));
|
|
1185
|
+
const helper = join(nodePtyDir, "..", "prebuilds", `${process.platform}-${process.arch}`, "spawn-helper");
|
|
1186
|
+
try {
|
|
1187
|
+
accessSync(helper, constants.X_OK);
|
|
1188
|
+
} catch (error) {
|
|
1189
|
+
if (isMissingFileError(error)) {
|
|
1190
|
+
return;
|
|
1191
|
+
}
|
|
1192
|
+
try {
|
|
1193
|
+
chmodSync(helper, 493);
|
|
1194
|
+
} catch (chmodError) {
|
|
1195
|
+
if (isMissingFileError(chmodError)) {
|
|
1196
|
+
return;
|
|
1233
1197
|
}
|
|
1234
|
-
|
|
1198
|
+
throw chmodError;
|
|
1199
|
+
}
|
|
1235
1200
|
}
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
function signalToExitCode(signal) {
|
|
1241
|
-
if (signal === null) {
|
|
1242
|
-
return 0;
|
|
1243
|
-
}
|
|
1244
|
-
const signalNumbers = {
|
|
1245
|
-
SIGTERM: 15,
|
|
1246
|
-
SIGINT: 2,
|
|
1247
|
-
SIGHUP: 1,
|
|
1248
|
-
SIGKILL: 9
|
|
1249
|
-
};
|
|
1250
|
-
const signalNumber = signalNumbers[signal];
|
|
1251
|
-
if (signalNumber === void 0) {
|
|
1252
|
-
return 1;
|
|
1201
|
+
}
|
|
1202
|
+
function isMissingFileError(error) {
|
|
1203
|
+
if (!(error instanceof Error)) {
|
|
1204
|
+
return false;
|
|
1253
1205
|
}
|
|
1254
|
-
return
|
|
1206
|
+
return "code" in error && error.code === "ENOENT";
|
|
1255
1207
|
}
|
|
1256
1208
|
function matchPattern(buffer, pattern) {
|
|
1257
1209
|
const clean = normalizeHistoryBuffer(stripAnsi(buffer));
|