terminal-pilot 0.0.7 → 0.0.8

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.
Files changed (51) hide show
  1. package/dist/cli.js +52 -105
  2. package/dist/cli.js.map +4 -4
  3. package/dist/commands/close-session.js +19 -83
  4. package/dist/commands/close-session.js.map +3 -3
  5. package/dist/commands/create-session.js +19 -83
  6. package/dist/commands/create-session.js.map +3 -3
  7. package/dist/commands/fill.js +19 -83
  8. package/dist/commands/fill.js.map +3 -3
  9. package/dist/commands/get-session.js +19 -83
  10. package/dist/commands/get-session.js.map +3 -3
  11. package/dist/commands/index.js +27 -94
  12. package/dist/commands/index.js.map +4 -4
  13. package/dist/commands/install.js +2 -5
  14. package/dist/commands/install.js.map +4 -4
  15. package/dist/commands/installer.js +2 -5
  16. package/dist/commands/installer.js.map +4 -4
  17. package/dist/commands/list-sessions.js +19 -83
  18. package/dist/commands/list-sessions.js.map +3 -3
  19. package/dist/commands/press-key.js +19 -83
  20. package/dist/commands/press-key.js.map +3 -3
  21. package/dist/commands/read-history.js +19 -83
  22. package/dist/commands/read-history.js.map +3 -3
  23. package/dist/commands/read-screen.js +19 -83
  24. package/dist/commands/read-screen.js.map +3 -3
  25. package/dist/commands/resize.js +19 -83
  26. package/dist/commands/resize.js.map +3 -3
  27. package/dist/commands/runtime.js +19 -83
  28. package/dist/commands/runtime.js.map +3 -3
  29. package/dist/commands/screenshot.js +19 -83
  30. package/dist/commands/screenshot.js.map +3 -3
  31. package/dist/commands/send-signal.js +19 -83
  32. package/dist/commands/send-signal.js.map +3 -3
  33. package/dist/commands/type.js +19 -83
  34. package/dist/commands/type.js.map +3 -3
  35. package/dist/commands/uninstall.js +1 -4
  36. package/dist/commands/uninstall.js.map +4 -4
  37. package/dist/commands/wait-for-exit.js +19 -83
  38. package/dist/commands/wait-for-exit.js.map +3 -3
  39. package/dist/commands/wait-for.js +19 -83
  40. package/dist/commands/wait-for.js.map +3 -3
  41. package/dist/index.js +19 -83
  42. package/dist/index.js.map +3 -3
  43. package/dist/terminal-pilot.js +19 -83
  44. package/dist/terminal-pilot.js.map +3 -3
  45. package/dist/terminal-session.js +19 -83
  46. package/dist/terminal-session.js.map +3 -3
  47. package/dist/testing/cli-repl.js +52 -105
  48. package/dist/testing/cli-repl.js.map +4 -4
  49. package/dist/testing/qa-cli.js +52 -105
  50. package/dist/testing/qa-cli.js.map +4 -4
  51. package/package.json +1 -1
@@ -342,8 +342,10 @@ function defineGroup(config) {
342
342
  import { randomUUID } from "node:crypto";
343
343
 
344
344
  // src/terminal-session.ts
345
- import { spawn as spawnChildProcess } from "node:child_process";
346
345
  import { EventEmitter } from "node:events";
346
+ import { accessSync, chmodSync, constants } from "node:fs";
347
+ import { createRequire } from "node:module";
348
+ import { dirname, join } from "node:path";
347
349
  import * as nodePty from "node-pty";
348
350
 
349
351
  // src/ansi.ts
@@ -1254,93 +1256,27 @@ function createPtyProcess({
1254
1256
  cols,
1255
1257
  rows
1256
1258
  }) {
1257
- try {
1258
- return nodePty.spawn(command, args, {
1259
- cwd,
1260
- env,
1261
- cols,
1262
- rows,
1263
- encoding: "utf8"
1264
- });
1265
- } catch {
1266
- return createChildProcessFallback({ command, args, cwd, env });
1267
- }
1268
- }
1269
- function createChildProcessFallback({
1270
- command,
1271
- args,
1272
- cwd,
1273
- env
1274
- }) {
1275
- const child = spawnChildProcess(command, args, {
1259
+ ensureSpawnHelperExecutable();
1260
+ return nodePty.spawn(command, args, {
1276
1261
  cwd,
1277
1262
  env,
1278
- stdio: ["pipe", "pipe", "pipe"]
1263
+ cols,
1264
+ rows,
1265
+ encoding: "utf8"
1279
1266
  });
1280
- return new ChildProcessFallback(child);
1281
1267
  }
1282
- var ChildProcessFallback = class {
1283
- pid;
1284
- child;
1285
- dataEmitter = new EventEmitter();
1286
- exitEmitter = new EventEmitter();
1287
- constructor(child) {
1288
- this.child = child;
1289
- this.pid = child.pid ?? -1;
1290
- child.stdout.setEncoding("utf8");
1291
- child.stderr.setEncoding("utf8");
1292
- child.stdout.on("data", this.handleData);
1293
- child.stderr.on("data", this.handleData);
1294
- child.on("exit", (exitCode, signal) => {
1295
- this.exitEmitter.emit("exit", {
1296
- exitCode: exitCode ?? signalToExitCode(signal),
1297
- signal: void 0
1298
- });
1299
- });
1300
- }
1301
- write(data) {
1302
- this.child.stdin.write(data);
1303
- }
1304
- resize() {
1305
- }
1306
- kill(signal) {
1307
- this.child.kill(signal);
1308
- }
1309
- onData(listener) {
1310
- this.dataEmitter.on("data", listener);
1311
- return {
1312
- dispose: () => {
1313
- this.dataEmitter.off("data", listener);
1314
- }
1315
- };
1316
- }
1317
- onExit(listener) {
1318
- this.exitEmitter.on("exit", listener);
1319
- return {
1320
- dispose: () => {
1321
- this.exitEmitter.off("exit", listener);
1322
- }
1323
- };
1324
- }
1325
- handleData = (chunk) => {
1326
- this.dataEmitter.emit("data", String(chunk));
1327
- };
1328
- };
1329
- function signalToExitCode(signal) {
1330
- if (signal === null) {
1331
- return 0;
1332
- }
1333
- const signalNumbers = {
1334
- SIGTERM: 15,
1335
- SIGINT: 2,
1336
- SIGHUP: 1,
1337
- SIGKILL: 9
1338
- };
1339
- const signalNumber = signalNumbers[signal];
1340
- if (signalNumber === void 0) {
1341
- return 1;
1268
+ var spawnHelperChecked = false;
1269
+ function ensureSpawnHelperExecutable() {
1270
+ if (spawnHelperChecked) return;
1271
+ spawnHelperChecked = true;
1272
+ const require3 = createRequire(import.meta.url);
1273
+ const nodePtyDir = dirname(require3.resolve("node-pty"));
1274
+ const helper = join(nodePtyDir, "..", "prebuilds", `${process.platform}-${process.arch}`, "spawn-helper");
1275
+ try {
1276
+ accessSync(helper, constants.X_OK);
1277
+ } catch {
1278
+ chmodSync(helper, 493);
1342
1279
  }
1343
- return 128 + signalNumber;
1344
1280
  }
1345
1281
  function matchPattern(buffer, pattern) {
1346
1282
  const clean = normalizeHistoryBuffer(stripAnsi(buffer));
@@ -2720,9 +2656,6 @@ async function executeMutation(mutation, context, options) {
2720
2656
  import Mustache2 from "mustache";
2721
2657
  var originalEscape = Mustache2.escape;
2722
2658
 
2723
- // ../agent-skill-config/src/templates.ts
2724
- import { readFile } from "node:fs/promises";
2725
-
2726
2659
  // ../agent-skill-config/src/apply.ts
2727
2660
  var UnsupportedAgentError = class extends Error {
2728
2661
  constructor(agentId) {
@@ -2781,7 +2714,7 @@ async function installSkill(agentId, skill, options) {
2781
2714
  import os2 from "node:os";
2782
2715
  import path3 from "node:path";
2783
2716
  import * as nodeFs from "node:fs/promises";
2784
- import { readFile as readFile2 } from "node:fs/promises";
2717
+ import { readFile } from "node:fs/promises";
2785
2718
  var DEFAULT_INSTALL_AGENT = "claude-code";
2786
2719
  var DEFAULT_INSTALL_SCOPE = "local";
2787
2720
  var TERMINAL_PILOT_SKILL_NAME = "terminal-pilot";
@@ -2831,7 +2764,7 @@ async function loadTerminalPilotTemplate() {
2831
2764
  ];
2832
2765
  for (const candidate of candidates) {
2833
2766
  try {
2834
- terminalPilotTemplateCache = await readFile2(candidate, "utf8");
2767
+ terminalPilotTemplateCache = await readFile(candidate, "utf8");
2835
2768
  return terminalPilotTemplateCache;
2836
2769
  } catch (error) {
2837
2770
  if (!isNotFoundError(error)) {
@@ -3266,14 +3199,14 @@ import { Resvg } from "@resvg/resvg-js";
3266
3199
 
3267
3200
  // ../terminal-png/src/font.ts
3268
3201
  import { readFileSync } from "node:fs";
3269
- import { createRequire } from "node:module";
3270
- import { dirname, join } from "node:path";
3202
+ import { createRequire as createRequire2 } from "node:module";
3203
+ import { dirname as dirname2, join as join2 } from "node:path";
3271
3204
  import { fileURLToPath as fileURLToPath2 } from "node:url";
3272
- var require2 = createRequire(import.meta.url);
3273
- var fontPackageRoot = dirname(require2.resolve("jetbrains-mono/package.json"));
3274
- var webfontRoot = join(fontPackageRoot, "fonts/webfonts");
3205
+ var require2 = createRequire2(import.meta.url);
3206
+ var fontPackageRoot = dirname2(require2.resolve("jetbrains-mono/package.json"));
3207
+ var webfontRoot = join2(fontPackageRoot, "fonts/webfonts");
3275
3208
  function readWebfontBase64(filename) {
3276
- return readFileSync(join(webfontRoot, filename)).toString("base64");
3209
+ return readFileSync(join2(webfontRoot, filename)).toString("base64");
3277
3210
  }
3278
3211
  function resolveAssetPath(filename) {
3279
3212
  return fileURLToPath2(new URL(`../assets/${filename}`, import.meta.url));