terminal-pilot 0.0.49 → 0.0.51

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 (108) hide show
  1. package/dist/assets/jetbrains-mono-400-italic.ttf +0 -0
  2. package/dist/assets/jetbrains-mono-400-normal.ttf +0 -0
  3. package/dist/assets/jetbrains-mono-700-italic.ttf +0 -0
  4. package/dist/assets/jetbrains-mono-700-normal.ttf +0 -0
  5. package/dist/cli.js +64 -32
  6. package/dist/cli.js.map +4 -4
  7. package/dist/commands/close-session.js +26 -0
  8. package/dist/commands/close-session.js.map +2 -2
  9. package/dist/commands/create-session.js +26 -0
  10. package/dist/commands/create-session.js.map +2 -2
  11. package/dist/commands/daemon-runtime.js.map +1 -1
  12. package/dist/commands/fill.js +26 -0
  13. package/dist/commands/fill.js.map +2 -2
  14. package/dist/commands/get-session.js +26 -0
  15. package/dist/commands/get-session.js.map +2 -2
  16. package/dist/commands/index.js +39 -6
  17. package/dist/commands/index.js.map +4 -4
  18. package/dist/commands/install.js +42 -3
  19. package/dist/commands/install.js.map +4 -4
  20. package/dist/commands/installer.js +16 -3
  21. package/dist/commands/installer.js.map +4 -4
  22. package/dist/commands/list-sessions.js +26 -0
  23. package/dist/commands/list-sessions.js.map +2 -2
  24. package/dist/commands/press-key.js +26 -0
  25. package/dist/commands/press-key.js.map +2 -2
  26. package/dist/commands/read-history.js +26 -0
  27. package/dist/commands/read-history.js.map +2 -2
  28. package/dist/commands/read-screen.js +26 -0
  29. package/dist/commands/read-screen.js.map +2 -2
  30. package/dist/commands/resize.js +26 -0
  31. package/dist/commands/resize.js.map +2 -2
  32. package/dist/commands/runtime.js.map +1 -1
  33. package/dist/commands/screenshot.js +26 -0
  34. package/dist/commands/screenshot.js.map +2 -2
  35. package/dist/commands/send-signal.js +26 -0
  36. package/dist/commands/send-signal.js.map +2 -2
  37. package/dist/commands/type.js +26 -0
  38. package/dist/commands/type.js.map +2 -2
  39. package/dist/commands/uninstall.js +42 -3
  40. package/dist/commands/uninstall.js.map +4 -4
  41. package/dist/commands/wait-for-exit.js +26 -0
  42. package/dist/commands/wait-for-exit.js.map +2 -2
  43. package/dist/commands/wait-for.js +26 -0
  44. package/dist/commands/wait-for.js.map +2 -2
  45. package/dist/composition.json +1 -1
  46. package/dist/testing/cli-repl.js +64 -32
  47. package/dist/testing/cli-repl.js.map +4 -4
  48. package/dist/testing/qa-cli.js +64 -32
  49. package/dist/testing/qa-cli.js.map +4 -4
  50. package/node_modules/@poe-code/user-error/README.md +56 -0
  51. package/node_modules/@poe-code/user-error/dist/index.d.ts +17 -0
  52. package/node_modules/@poe-code/user-error/dist/index.js +21 -0
  53. package/node_modules/@poe-code/user-error/package.json +24 -0
  54. package/node_modules/toolcraft-design/README.md +30 -0
  55. package/node_modules/toolcraft-design/dist/dashboard/terminal-width.d.ts +1 -0
  56. package/node_modules/toolcraft-design/dist/dashboard/terminal-width.js +18 -1
  57. package/node_modules/toolcraft-design/dist/explorer/actions.d.ts +3 -2
  58. package/node_modules/toolcraft-design/dist/explorer/actions.js +50 -4
  59. package/node_modules/toolcraft-design/dist/explorer/events.d.ts +7 -2
  60. package/node_modules/toolcraft-design/dist/explorer/filter.js +1 -1
  61. package/node_modules/toolcraft-design/dist/explorer/index.d.ts +2 -4
  62. package/node_modules/toolcraft-design/dist/explorer/index.js +1 -2
  63. package/node_modules/toolcraft-design/dist/explorer/jobs.d.ts +2 -2
  64. package/node_modules/toolcraft-design/dist/explorer/jobs.js +3 -5
  65. package/node_modules/toolcraft-design/dist/explorer/keymap.d.ts +13 -3
  66. package/node_modules/toolcraft-design/dist/explorer/keymap.js +89 -348
  67. package/node_modules/toolcraft-design/dist/explorer/layout.d.ts +1 -0
  68. package/node_modules/toolcraft-design/dist/explorer/layout.js +14 -4
  69. package/node_modules/toolcraft-design/dist/explorer/reducer.js +116 -16
  70. package/node_modules/toolcraft-design/dist/explorer/render/detail.d.ts +1 -1
  71. package/node_modules/toolcraft-design/dist/explorer/render/detail.js +45 -7
  72. package/node_modules/toolcraft-design/dist/explorer/render/footer.d.ts +1 -1
  73. package/node_modules/toolcraft-design/dist/explorer/render/footer.js +18 -3
  74. package/node_modules/toolcraft-design/dist/explorer/render/header.d.ts +1 -1
  75. package/node_modules/toolcraft-design/dist/explorer/render/header.js +6 -2
  76. package/node_modules/toolcraft-design/dist/explorer/render/index.d.ts +1 -1
  77. package/node_modules/toolcraft-design/dist/explorer/render/index.js +2 -1
  78. package/node_modules/toolcraft-design/dist/explorer/render/list.d.ts +16 -2
  79. package/node_modules/toolcraft-design/dist/explorer/render/list.js +13 -34
  80. package/node_modules/toolcraft-design/dist/explorer/render/modal.d.ts +1 -1
  81. package/node_modules/toolcraft-design/dist/explorer/render/modal.js +11 -11
  82. package/node_modules/toolcraft-design/dist/explorer/render/pane.d.ts +5 -2
  83. package/node_modules/toolcraft-design/dist/explorer/render/pane.js +9 -6
  84. package/node_modules/toolcraft-design/dist/explorer/render/test-fixtures.js +2 -3
  85. package/node_modules/toolcraft-design/dist/explorer/runtime.js +115 -73
  86. package/node_modules/toolcraft-design/dist/explorer/runtime.test-helpers.d.ts +23 -37
  87. package/node_modules/toolcraft-design/dist/explorer/runtime.test-helpers.js +32 -83
  88. package/node_modules/toolcraft-design/dist/explorer/state.d.ts +79 -8
  89. package/node_modules/toolcraft-design/dist/explorer/state.js +70 -18
  90. package/node_modules/toolcraft-design/dist/index.d.ts +8 -2
  91. package/node_modules/toolcraft-design/dist/index.js +5 -1
  92. package/node_modules/toolcraft-design/dist/screen/ansi-text.d.ts +2 -0
  93. package/node_modules/toolcraft-design/dist/screen/ansi-text.js +35 -0
  94. package/node_modules/toolcraft-design/dist/screen/screen.d.ts +40 -0
  95. package/node_modules/toolcraft-design/dist/screen/screen.js +122 -0
  96. package/node_modules/toolcraft-design/dist/screen/style.d.ts +16 -0
  97. package/node_modules/toolcraft-design/dist/screen/style.js +55 -0
  98. package/node_modules/toolcraft-design/dist/terminal/driver.d.ts +34 -0
  99. package/node_modules/toolcraft-design/dist/terminal/driver.js +65 -0
  100. package/node_modules/toolcraft-design/dist/terminal/input.d.ts +25 -0
  101. package/node_modules/toolcraft-design/dist/terminal/input.js +181 -0
  102. package/node_modules/toolcraft-design/dist/terminal/output.d.ts +10 -0
  103. package/node_modules/toolcraft-design/dist/terminal/output.js +44 -0
  104. package/package.json +2 -1
  105. package/node_modules/toolcraft-design/dist/explorer/two-pane.d.ts +0 -102
  106. package/node_modules/toolcraft-design/dist/explorer/two-pane.js +0 -510
  107. package/node_modules/toolcraft-design/dist/run-two-pane-explorer.d.ts +0 -2
  108. package/node_modules/toolcraft-design/dist/run-two-pane-explorer.js +0 -1
@@ -58,7 +58,7 @@
58
58
  },
59
59
  {
60
60
  "name": "terminal-pilot",
61
- "version": "0.0.49",
61
+ "version": "0.0.51",
62
62
  "license": "MIT"
63
63
  },
64
64
  {
@@ -1098,9 +1098,9 @@ function detectThemeFromEnv(env) {
1098
1098
  const colorFGBG = env.COLORFGBG;
1099
1099
  if (typeof colorFGBG === "string") {
1100
1100
  const parts = colorFGBG.split(";").map((part) => Number.parseInt(part, 10));
1101
- const background = parts.at(-1);
1102
- if (Number.isFinite(background)) {
1103
- return background >= 8 ? "light" : "dark";
1101
+ const background2 = parts.at(-1);
1102
+ if (Number.isFinite(background2)) {
1103
+ return background2 >= 8 ? "light" : "dark";
1104
1104
  }
1105
1105
  }
1106
1106
  return void 0;
@@ -2956,6 +2956,19 @@ var storage = new AsyncLocalStorage2();
2956
2956
  import readline from "node:readline";
2957
2957
  import { PassThrough } from "node:stream";
2958
2958
 
2959
+ // ../toolcraft-design/src/screen/style.ts
2960
+ var STYLE_BOLD = 1 << 0;
2961
+ var STYLE_DIM = 1 << 1;
2962
+ var STYLE_UNDERLINE = 1 << 2;
2963
+ var STYLE_INVERSE = 1 << 3;
2964
+
2965
+ // ../toolcraft-design/src/explorer/runtime.ts
2966
+ import { appendFileSync } from "node:fs";
2967
+
2968
+ // ../toolcraft-design/src/terminal/input.ts
2969
+ var PASTE_START = Buffer.from("\x1B[200~");
2970
+ var PASTE_END = Buffer.from("\x1B[201~");
2971
+
2959
2972
  // ../toolcraft-design/src/explorer/state.ts
2960
2973
  var REGION_HEADER = 1 << 0;
2961
2974
  var REGION_LIST = 1 << 1;
@@ -4004,6 +4017,9 @@ function cloneRequires(requires) {
4004
4017
  check: requires.check
4005
4018
  };
4006
4019
  }
4020
+ function cloneToolAnnotations(annotations) {
4021
+ return annotations === void 0 ? void 0 : { ...annotations };
4022
+ }
4007
4023
  function cloneStringArray(values) {
4008
4024
  return values === void 0 ? void 0 : [...values];
4009
4025
  }
@@ -4273,16 +4289,24 @@ function resolveGroupScope(ownScope, inheritedScope) {
4273
4289
  return cloneScope(ownScope ?? inheritedScope);
4274
4290
  }
4275
4291
  function createBaseCommand(config2) {
4292
+ if (config2.mcpResult !== void 0 && config2.result === void 0) {
4293
+ throw new ToolcraftBugError(
4294
+ `Command "${config2.name}" defines mcpResult without a result schema.`
4295
+ );
4296
+ }
4276
4297
  const command = {
4277
4298
  kind: "command",
4278
4299
  name: config2.name,
4300
+ title: config2.title,
4279
4301
  description: config2.description,
4302
+ annotations: cloneToolAnnotations(config2.annotations),
4280
4303
  hidden: config2.hidden ?? false,
4281
4304
  examples: cloneCommandExamples(config2.examples),
4282
4305
  aliases: [...config2.aliases ?? []],
4283
4306
  positional: [...config2.positional ?? []],
4284
4307
  params: config2.params,
4285
4308
  result: config2.result,
4309
+ mcpResult: config2.mcpResult,
4286
4310
  stream: void 0,
4287
4311
  secrets: cloneSecrets(config2.secrets),
4288
4312
  scope: resolveCommandScope(config2.scope, void 0),
@@ -4294,10 +4318,13 @@ function createBaseCommand(config2) {
4294
4318
  };
4295
4319
  Object.defineProperty(command, commandConfigSymbol, {
4296
4320
  value: {
4321
+ title: config2.title,
4322
+ annotations: cloneToolAnnotations(config2.annotations),
4297
4323
  scope: cloneScope(config2.scope),
4298
4324
  hidden: config2.hidden ?? false,
4299
4325
  examples: cloneCommandExamples(config2.examples),
4300
4326
  result: config2.result,
4327
+ mcpResult: config2.mcpResult,
4301
4328
  humanInLoop: config2.humanInLoop,
4302
4329
  secrets: cloneSecrets(config2.secrets),
4303
4330
  requires: cloneRequires(config2.requires),
@@ -4345,13 +4372,16 @@ function materializeCommand(command, inherited) {
4345
4372
  const materialized = {
4346
4373
  kind: "command",
4347
4374
  name: command.name,
4375
+ title: internal.title,
4348
4376
  description: command.description,
4377
+ annotations: cloneToolAnnotations(internal.annotations),
4349
4378
  hidden: internal.hidden,
4350
4379
  examples: cloneCommandExamples(internal.examples),
4351
4380
  aliases: [...command.aliases],
4352
4381
  positional: [...command.positional],
4353
4382
  params: command.params,
4354
4383
  result: internal.result,
4384
+ mcpResult: internal.mcpResult,
4355
4385
  stream: command.stream,
4356
4386
  secrets: mergeSecrets(inherited.secrets, internal.secrets),
4357
4387
  scope: resolveCommandScope(internal.scope, inherited.scope),
@@ -4363,10 +4393,13 @@ function materializeCommand(command, inherited) {
4363
4393
  };
4364
4394
  Object.defineProperty(materialized, commandConfigSymbol, {
4365
4395
  value: {
4396
+ title: internal.title,
4397
+ annotations: cloneToolAnnotations(internal.annotations),
4366
4398
  scope: cloneScope(internal.scope),
4367
4399
  hidden: internal.hidden,
4368
4400
  examples: cloneCommandExamples(internal.examples),
4369
4401
  result: internal.result,
4402
+ mcpResult: internal.mcpResult,
4370
4403
  humanInLoop: internal.humanInLoop,
4371
4404
  secrets: cloneSecrets(internal.secrets),
4372
4405
  requires: cloneRequires(internal.requires),
@@ -5314,23 +5347,11 @@ function displayScalar(value) {
5314
5347
  }
5315
5348
  return stringifyValue(value) || "\u2014";
5316
5349
  }
5317
- function isUrl(value) {
5318
- return typeof value === "string" && (value.startsWith("https://") || value.startsWith("http://"));
5319
- }
5320
- function compactUrl(value) {
5321
- try {
5322
- const url = new URL(value);
5323
- const tail = url.pathname.split("/").filter(Boolean).at(-1);
5324
- return tail ? `${url.hostname}/\u2026/${tail}` : url.hostname;
5325
- } catch {
5326
- return value;
5327
- }
5328
- }
5329
5350
  function stackedList(value) {
5330
5351
  return value.map((entry) => displayScalar(entry)).join("\n") || "\u2014";
5331
5352
  }
5332
5353
  function displayRowValue(value) {
5333
- return isUrl(value) ? compactUrl(value) : displayScalar(value);
5354
+ return displayScalar(value);
5334
5355
  }
5335
5356
  function directScalarRows(result) {
5336
5357
  return Object.entries(result).filter(([, value]) => !isObject2(value) && !Array.isArray(value)).map(([key, value]) => ({ label: humanizeKey(key), value: displayRowValue(value) }));
@@ -6302,6 +6323,9 @@ function isNegativeNumericArrayToken(token, schema) {
6302
6323
  return items.length > 0 && items.every((item) => isValidNumberSchemaValue(Number(item), itemSchema));
6303
6324
  }
6304
6325
  function isNextArrayOptionToken(token, schema) {
6326
+ if (token === "-" && unwrapOptional2(schema.item).kind === "string") {
6327
+ return false;
6328
+ }
6305
6329
  return token.startsWith("-") && !isNegativeNumericArrayToken(token, schema);
6306
6330
  }
6307
6331
  function validateArrayBounds(value, schema, label) {
@@ -6370,10 +6394,14 @@ function validateOutputFormats(formats) {
6370
6394
  );
6371
6395
  }
6372
6396
  if (BUILT_IN_OUTPUT_FORMATS.includes(name)) {
6373
- throw new ToolcraftBugError(`Custom output format "${name}" conflicts with a built-in format.`);
6397
+ throw new ToolcraftBugError(
6398
+ `Custom output format "${name}" conflicts with a built-in format.`
6399
+ );
6374
6400
  }
6375
6401
  if (typeof renderer !== "function") {
6376
- throw new ToolcraftBugError(`Custom output format "${name}" must define a renderer function.`);
6402
+ throw new ToolcraftBugError(
6403
+ `Custom output format "${name}" must define a renderer function.`
6404
+ );
6377
6405
  }
6378
6406
  }
6379
6407
  }
@@ -7205,10 +7233,8 @@ ${formatHelpOptionList(optionRows)}`);
7205
7233
  }
7206
7234
  const secretRows = formatSecretRows(command.secrets);
7207
7235
  if (secretRows.length > 0) {
7208
- sections.push(
7209
- `${text.section("Secrets (environment):")}
7210
- ${formatHelpOptionList(secretRows)}`
7211
- );
7236
+ sections.push(`${text.section("Secrets (environment):")}
7237
+ ${formatHelpOptionList(secretRows)}`);
7212
7238
  }
7213
7239
  if (command.examples.length > 0) {
7214
7240
  sections.push(
@@ -8288,8 +8314,7 @@ function renderCliErrorPattern(pattern, outputEmitter) {
8288
8314
  if (pattern.kind === "definition") {
8289
8315
  logger2.error(
8290
8316
  `Command definition error: ${pattern.error.message}
8291
- This is a bug in the generated command definition, not in your command arguments.
8292
- Run with --debug for a stack trace.`
8317
+ This is a bug in the generated command definition, not in your command arguments.` + (pattern.debugControlEnabled ? "\nRun with --debug for a stack trace." : "")
8293
8318
  );
8294
8319
  if (pattern.debugStackMode !== void 0 && pattern.error.stack) {
8295
8320
  process.stderr.write(`${formatDebugStack(pattern.error.stack, pattern.debugStackMode)}
@@ -8301,7 +8326,7 @@ Run with --debug for a stack trace.`
8301
8326
  if (pattern.kind === "toolcraft-bug") {
8302
8327
  logger2.error(
8303
8328
  `toolcraft hit an internal invariant: ${pattern.error.message}
8304
- This is a bug in toolcraft or in the command definition; it cannot be worked around by changing argv. Re-run with --debug for a stack trace and file an issue.`
8329
+ This is a bug in toolcraft or in the command definition; it cannot be worked around by changing argv.` + (pattern.debugControlEnabled ? ` Re-run with --debug for a stack trace and file an issue.` : " File an issue.")
8305
8330
  );
8306
8331
  if (pattern.debugStackMode !== void 0 && pattern.error.stack) {
8307
8332
  process.stderr.write(`${formatDebugStack(pattern.error.stack, pattern.debugStackMode)}
@@ -8311,7 +8336,7 @@ This is a bug in toolcraft or in the command definition; it cannot be worked aro
8311
8336
  return;
8312
8337
  }
8313
8338
  logger2.error(
8314
- pattern.debugStackMode !== void 0 ? pattern.message : `${pattern.message} Use --debug for a stack trace.`
8339
+ pattern.debugStackMode !== void 0 || !pattern.debugControlEnabled ? pattern.message : `${pattern.message} Use --debug for a stack trace.`
8315
8340
  );
8316
8341
  if (pattern.debugStackMode !== void 0 && pattern.stack !== void 0) {
8317
8342
  process.stderr.write(`${formatDebugStack(pattern.stack, pattern.debugStackMode)}
@@ -9382,7 +9407,9 @@ function renderHttpError(error3, options) {
9382
9407
  } else {
9383
9408
  lines.push(`Response body: ${formatHttpErrorSnippet(error3.response.body)}`);
9384
9409
  }
9385
- lines.push("Re-run with --verbose to see headers and full body.");
9410
+ if (options.verboseControlEnabled) {
9411
+ lines.push("Re-run with --verbose to see headers and full body.");
9412
+ }
9386
9413
  }
9387
9414
  process.stderr.write(`${lines.join("\n")}
9388
9415
  `);
@@ -9400,6 +9427,7 @@ async function handleRunError(error3, options) {
9400
9427
  options.userErrorPattern === "definition" ? {
9401
9428
  kind: "definition",
9402
9429
  error: error3,
9430
+ debugControlEnabled: options.debugControlEnabled,
9403
9431
  debugStackMode: options.debugStackMode
9404
9432
  } : options.userErrorPattern === "usage" ? {
9405
9433
  kind: "usage",
@@ -9419,6 +9447,7 @@ async function handleRunError(error3, options) {
9419
9447
  {
9420
9448
  kind: "toolcraft-bug",
9421
9449
  error: error3,
9450
+ debugControlEnabled: options.debugControlEnabled,
9422
9451
  debugStackMode: options.debugStackMode
9423
9452
  },
9424
9453
  options.outputEmitter
@@ -9471,6 +9500,7 @@ async function handleRunError(error3, options) {
9471
9500
  kind: "unexpected",
9472
9501
  message: message2,
9473
9502
  stack: error3 instanceof Error ? error3.stack : void 0,
9503
+ debugControlEnabled: options.debugControlEnabled,
9474
9504
  debugStackMode: options.debugStackMode
9475
9505
  },
9476
9506
  options.outputEmitter
@@ -9867,9 +9897,11 @@ async function runCLI(roots, options = {}) {
9867
9897
  `);
9868
9898
  }
9869
9899
  await handleRunError(error3, {
9870
- debugStackMode: resolvedFlags !== void 0 ? resolveDebugStackMode(resolvedFlags.debug) : getDebugStackModeFromArgv(argv),
9900
+ debugControlEnabled: controls.debug,
9901
+ debugStackMode: controls.debug ? resolvedFlags !== void 0 ? resolveDebugStackMode(resolvedFlags.debug) : getDebugStackModeFromArgv(argv) : void 0,
9871
9902
  output: resolvedFlags !== void 0 ? resolveOutput(resolvedFlags) : resolveOutputFromArgv(argv, controls.outputFormats),
9872
9903
  verbose: resolvedFlags ? Boolean(resolvedFlags.verbose) : argv.includes("--verbose"),
9904
+ verboseControlEnabled: controls.verbose,
9873
9905
  program,
9874
9906
  argv,
9875
9907
  rootUsageName,
@@ -14471,9 +14503,9 @@ function renderBackgrounds(line, startX, y, height) {
14471
14503
  const rectangles = [];
14472
14504
  for (const run of line) {
14473
14505
  const width = displayWidth4(run.text, column);
14474
- const background = resolveBackgroundColor(run);
14475
- if (background !== BACKGROUND && width > 0) {
14476
- rectangles.push(`<rect x="${formatNumber(startX + column * CHARACTER_WIDTH)}" y="${formatNumber(y)}" width="${formatNumber(width * CHARACTER_WIDTH)}" height="${formatNumber(height)}" fill="${escapeXmlAttribute(background)}" />`);
14506
+ const background2 = resolveBackgroundColor(run);
14507
+ if (background2 !== BACKGROUND && width > 0) {
14508
+ rectangles.push(`<rect x="${formatNumber(startX + column * CHARACTER_WIDTH)}" y="${formatNumber(y)}" width="${formatNumber(width * CHARACTER_WIDTH)}" height="${formatNumber(height)}" fill="${escapeXmlAttribute(background2)}" />`);
14477
14509
  }
14478
14510
  column += width;
14479
14511
  }
@@ -15249,7 +15281,7 @@ function sleep2(ms) {
15249
15281
  // src/cli.ts
15250
15282
  configureTheme({ brand: "green", label: "Terminal Pilot" });
15251
15283
  function getBundledPackageVersion() {
15252
- return true ? "0.0.49" : void 0;
15284
+ return true ? "0.0.51" : void 0;
15253
15285
  }
15254
15286
  var pilotOptionsWithValues = /* @__PURE__ */ new Set([
15255
15287
  "--session",