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.
Files changed (51) hide show
  1. package/dist/cli.js +66 -103
  2. package/dist/cli.js.map +4 -4
  3. package/dist/commands/close-session.js +33 -81
  4. package/dist/commands/close-session.js.map +3 -3
  5. package/dist/commands/create-session.js +33 -81
  6. package/dist/commands/create-session.js.map +3 -3
  7. package/dist/commands/fill.js +33 -81
  8. package/dist/commands/fill.js.map +3 -3
  9. package/dist/commands/get-session.js +33 -81
  10. package/dist/commands/get-session.js.map +3 -3
  11. package/dist/commands/index.js +41 -92
  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 +33 -81
  18. package/dist/commands/list-sessions.js.map +3 -3
  19. package/dist/commands/press-key.js +33 -81
  20. package/dist/commands/press-key.js.map +3 -3
  21. package/dist/commands/read-history.js +33 -81
  22. package/dist/commands/read-history.js.map +3 -3
  23. package/dist/commands/read-screen.js +33 -81
  24. package/dist/commands/read-screen.js.map +3 -3
  25. package/dist/commands/resize.js +33 -81
  26. package/dist/commands/resize.js.map +3 -3
  27. package/dist/commands/runtime.js +33 -81
  28. package/dist/commands/runtime.js.map +3 -3
  29. package/dist/commands/screenshot.js +33 -81
  30. package/dist/commands/screenshot.js.map +3 -3
  31. package/dist/commands/send-signal.js +33 -81
  32. package/dist/commands/send-signal.js.map +3 -3
  33. package/dist/commands/type.js +33 -81
  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 +33 -81
  38. package/dist/commands/wait-for-exit.js.map +3 -3
  39. package/dist/commands/wait-for.js +33 -81
  40. package/dist/commands/wait-for.js.map +3 -3
  41. package/dist/index.js +33 -81
  42. package/dist/index.js.map +3 -3
  43. package/dist/terminal-pilot.js +33 -81
  44. package/dist/terminal-pilot.js.map +3 -3
  45. package/dist/terminal-session.js +33 -81
  46. package/dist/terminal-session.js.map +3 -3
  47. package/dist/testing/cli-repl.js +66 -103
  48. package/dist/testing/cli-repl.js.map +4 -4
  49. package/dist/testing/qa-cli.js +66 -103
  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,43 @@ 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);
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 (error) {
1278
+ if (isMissingFileError(error)) {
1279
+ return;
1280
+ }
1281
+ try {
1282
+ chmodSync(helper, 493);
1283
+ } catch (chmodError) {
1284
+ if (isMissingFileError(chmodError)) {
1285
+ return;
1322
1286
  }
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;
1287
+ throw chmodError;
1288
+ }
1332
1289
  }
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;
1290
+ }
1291
+ function isMissingFileError(error) {
1292
+ if (!(error instanceof Error)) {
1293
+ return false;
1342
1294
  }
1343
- return 128 + signalNumber;
1295
+ return "code" in error && error.code === "ENOENT";
1344
1296
  }
1345
1297
  function matchPattern(buffer, pattern) {
1346
1298
  const clean = normalizeHistoryBuffer(stripAnsi(buffer));
@@ -2720,9 +2672,6 @@ async function executeMutation(mutation, context, options) {
2720
2672
  import Mustache2 from "mustache";
2721
2673
  var originalEscape = Mustache2.escape;
2722
2674
 
2723
- // ../agent-skill-config/src/templates.ts
2724
- import { readFile } from "node:fs/promises";
2725
-
2726
2675
  // ../agent-skill-config/src/apply.ts
2727
2676
  var UnsupportedAgentError = class extends Error {
2728
2677
  constructor(agentId) {
@@ -2781,7 +2730,7 @@ async function installSkill(agentId, skill, options) {
2781
2730
  import os2 from "node:os";
2782
2731
  import path3 from "node:path";
2783
2732
  import * as nodeFs from "node:fs/promises";
2784
- import { readFile as readFile2 } from "node:fs/promises";
2733
+ import { readFile } from "node:fs/promises";
2785
2734
  var DEFAULT_INSTALL_AGENT = "claude-code";
2786
2735
  var DEFAULT_INSTALL_SCOPE = "local";
2787
2736
  var TERMINAL_PILOT_SKILL_NAME = "terminal-pilot";
@@ -2831,7 +2780,7 @@ async function loadTerminalPilotTemplate() {
2831
2780
  ];
2832
2781
  for (const candidate of candidates) {
2833
2782
  try {
2834
- terminalPilotTemplateCache = await readFile2(candidate, "utf8");
2783
+ terminalPilotTemplateCache = await readFile(candidate, "utf8");
2835
2784
  return terminalPilotTemplateCache;
2836
2785
  } catch (error) {
2837
2786
  if (!isNotFoundError(error)) {
@@ -3266,14 +3215,14 @@ import { Resvg } from "@resvg/resvg-js";
3266
3215
 
3267
3216
  // ../terminal-png/src/font.ts
3268
3217
  import { readFileSync } from "node:fs";
3269
- import { createRequire } from "node:module";
3270
- import { dirname, join } from "node:path";
3218
+ import { createRequire as createRequire2 } from "node:module";
3219
+ import { dirname as dirname2, join as join2 } from "node:path";
3271
3220
  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");
3221
+ var require2 = createRequire2(import.meta.url);
3222
+ var fontPackageRoot = dirname2(require2.resolve("jetbrains-mono/package.json"));
3223
+ var webfontRoot = join2(fontPackageRoot, "fonts/webfonts");
3275
3224
  function readWebfontBase64(filename) {
3276
- return readFileSync(join(webfontRoot, filename)).toString("base64");
3225
+ return readFileSync(join2(webfontRoot, filename)).toString("base64");
3277
3226
  }
3278
3227
  function resolveAssetPath(filename) {
3279
3228
  return fileURLToPath2(new URL(`../assets/${filename}`, import.meta.url));