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
package/dist/cli.js CHANGED
@@ -1022,9 +1022,9 @@ function detectThemeFromEnv(env) {
1022
1022
  const colorFGBG = env.COLORFGBG;
1023
1023
  if (typeof colorFGBG === "string") {
1024
1024
  const parts = colorFGBG.split(";").map((part) => Number.parseInt(part, 10));
1025
- const background = parts.at(-1);
1026
- if (Number.isFinite(background)) {
1027
- return background >= 8 ? "light" : "dark";
1025
+ const background2 = parts.at(-1);
1026
+ if (Number.isFinite(background2)) {
1027
+ return background2 >= 8 ? "light" : "dark";
1028
1028
  }
1029
1029
  }
1030
1030
  return void 0;
@@ -2880,6 +2880,19 @@ var storage = new AsyncLocalStorage2();
2880
2880
  import readline from "node:readline";
2881
2881
  import { PassThrough } from "node:stream";
2882
2882
 
2883
+ // ../toolcraft-design/src/screen/style.ts
2884
+ var STYLE_BOLD = 1 << 0;
2885
+ var STYLE_DIM = 1 << 1;
2886
+ var STYLE_UNDERLINE = 1 << 2;
2887
+ var STYLE_INVERSE = 1 << 3;
2888
+
2889
+ // ../toolcraft-design/src/explorer/runtime.ts
2890
+ import { appendFileSync } from "node:fs";
2891
+
2892
+ // ../toolcraft-design/src/terminal/input.ts
2893
+ var PASTE_START = Buffer.from("\x1B[200~");
2894
+ var PASTE_END = Buffer.from("\x1B[201~");
2895
+
2883
2896
  // ../toolcraft-design/src/explorer/state.ts
2884
2897
  var REGION_HEADER = 1 << 0;
2885
2898
  var REGION_LIST = 1 << 1;
@@ -3928,6 +3941,9 @@ function cloneRequires(requires) {
3928
3941
  check: requires.check
3929
3942
  };
3930
3943
  }
3944
+ function cloneToolAnnotations(annotations) {
3945
+ return annotations === void 0 ? void 0 : { ...annotations };
3946
+ }
3931
3947
  function cloneStringArray(values) {
3932
3948
  return values === void 0 ? void 0 : [...values];
3933
3949
  }
@@ -4197,16 +4213,24 @@ function resolveGroupScope(ownScope, inheritedScope) {
4197
4213
  return cloneScope(ownScope ?? inheritedScope);
4198
4214
  }
4199
4215
  function createBaseCommand(config2) {
4216
+ if (config2.mcpResult !== void 0 && config2.result === void 0) {
4217
+ throw new ToolcraftBugError(
4218
+ `Command "${config2.name}" defines mcpResult without a result schema.`
4219
+ );
4220
+ }
4200
4221
  const command = {
4201
4222
  kind: "command",
4202
4223
  name: config2.name,
4224
+ title: config2.title,
4203
4225
  description: config2.description,
4226
+ annotations: cloneToolAnnotations(config2.annotations),
4204
4227
  hidden: config2.hidden ?? false,
4205
4228
  examples: cloneCommandExamples(config2.examples),
4206
4229
  aliases: [...config2.aliases ?? []],
4207
4230
  positional: [...config2.positional ?? []],
4208
4231
  params: config2.params,
4209
4232
  result: config2.result,
4233
+ mcpResult: config2.mcpResult,
4210
4234
  stream: void 0,
4211
4235
  secrets: cloneSecrets(config2.secrets),
4212
4236
  scope: resolveCommandScope(config2.scope, void 0),
@@ -4218,10 +4242,13 @@ function createBaseCommand(config2) {
4218
4242
  };
4219
4243
  Object.defineProperty(command, commandConfigSymbol, {
4220
4244
  value: {
4245
+ title: config2.title,
4246
+ annotations: cloneToolAnnotations(config2.annotations),
4221
4247
  scope: cloneScope(config2.scope),
4222
4248
  hidden: config2.hidden ?? false,
4223
4249
  examples: cloneCommandExamples(config2.examples),
4224
4250
  result: config2.result,
4251
+ mcpResult: config2.mcpResult,
4225
4252
  humanInLoop: config2.humanInLoop,
4226
4253
  secrets: cloneSecrets(config2.secrets),
4227
4254
  requires: cloneRequires(config2.requires),
@@ -4269,13 +4296,16 @@ function materializeCommand(command, inherited) {
4269
4296
  const materialized = {
4270
4297
  kind: "command",
4271
4298
  name: command.name,
4299
+ title: internal.title,
4272
4300
  description: command.description,
4301
+ annotations: cloneToolAnnotations(internal.annotations),
4273
4302
  hidden: internal.hidden,
4274
4303
  examples: cloneCommandExamples(internal.examples),
4275
4304
  aliases: [...command.aliases],
4276
4305
  positional: [...command.positional],
4277
4306
  params: command.params,
4278
4307
  result: internal.result,
4308
+ mcpResult: internal.mcpResult,
4279
4309
  stream: command.stream,
4280
4310
  secrets: mergeSecrets(inherited.secrets, internal.secrets),
4281
4311
  scope: resolveCommandScope(internal.scope, inherited.scope),
@@ -4287,10 +4317,13 @@ function materializeCommand(command, inherited) {
4287
4317
  };
4288
4318
  Object.defineProperty(materialized, commandConfigSymbol, {
4289
4319
  value: {
4320
+ title: internal.title,
4321
+ annotations: cloneToolAnnotations(internal.annotations),
4290
4322
  scope: cloneScope(internal.scope),
4291
4323
  hidden: internal.hidden,
4292
4324
  examples: cloneCommandExamples(internal.examples),
4293
4325
  result: internal.result,
4326
+ mcpResult: internal.mcpResult,
4294
4327
  humanInLoop: internal.humanInLoop,
4295
4328
  secrets: cloneSecrets(internal.secrets),
4296
4329
  requires: cloneRequires(internal.requires),
@@ -5238,23 +5271,11 @@ function displayScalar(value) {
5238
5271
  }
5239
5272
  return stringifyValue(value) || "\u2014";
5240
5273
  }
5241
- function isUrl(value) {
5242
- return typeof value === "string" && (value.startsWith("https://") || value.startsWith("http://"));
5243
- }
5244
- function compactUrl(value) {
5245
- try {
5246
- const url = new URL(value);
5247
- const tail = url.pathname.split("/").filter(Boolean).at(-1);
5248
- return tail ? `${url.hostname}/\u2026/${tail}` : url.hostname;
5249
- } catch {
5250
- return value;
5251
- }
5252
- }
5253
5274
  function stackedList(value) {
5254
5275
  return value.map((entry) => displayScalar(entry)).join("\n") || "\u2014";
5255
5276
  }
5256
5277
  function displayRowValue(value) {
5257
- return isUrl(value) ? compactUrl(value) : displayScalar(value);
5278
+ return displayScalar(value);
5258
5279
  }
5259
5280
  function directScalarRows(result) {
5260
5281
  return Object.entries(result).filter(([, value]) => !isObject2(value) && !Array.isArray(value)).map(([key, value]) => ({ label: humanizeKey(key), value: displayRowValue(value) }));
@@ -6226,6 +6247,9 @@ function isNegativeNumericArrayToken(token, schema) {
6226
6247
  return items.length > 0 && items.every((item) => isValidNumberSchemaValue(Number(item), itemSchema));
6227
6248
  }
6228
6249
  function isNextArrayOptionToken(token, schema) {
6250
+ if (token === "-" && unwrapOptional2(schema.item).kind === "string") {
6251
+ return false;
6252
+ }
6229
6253
  return token.startsWith("-") && !isNegativeNumericArrayToken(token, schema);
6230
6254
  }
6231
6255
  function validateArrayBounds(value, schema, label) {
@@ -6294,10 +6318,14 @@ function validateOutputFormats(formats) {
6294
6318
  );
6295
6319
  }
6296
6320
  if (BUILT_IN_OUTPUT_FORMATS.includes(name)) {
6297
- throw new ToolcraftBugError(`Custom output format "${name}" conflicts with a built-in format.`);
6321
+ throw new ToolcraftBugError(
6322
+ `Custom output format "${name}" conflicts with a built-in format.`
6323
+ );
6298
6324
  }
6299
6325
  if (typeof renderer !== "function") {
6300
- throw new ToolcraftBugError(`Custom output format "${name}" must define a renderer function.`);
6326
+ throw new ToolcraftBugError(
6327
+ `Custom output format "${name}" must define a renderer function.`
6328
+ );
6301
6329
  }
6302
6330
  }
6303
6331
  }
@@ -7129,10 +7157,8 @@ ${formatHelpOptionList(optionRows)}`);
7129
7157
  }
7130
7158
  const secretRows = formatSecretRows(command.secrets);
7131
7159
  if (secretRows.length > 0) {
7132
- sections.push(
7133
- `${text.section("Secrets (environment):")}
7134
- ${formatHelpOptionList(secretRows)}`
7135
- );
7160
+ sections.push(`${text.section("Secrets (environment):")}
7161
+ ${formatHelpOptionList(secretRows)}`);
7136
7162
  }
7137
7163
  if (command.examples.length > 0) {
7138
7164
  sections.push(
@@ -8212,8 +8238,7 @@ function renderCliErrorPattern(pattern, outputEmitter) {
8212
8238
  if (pattern.kind === "definition") {
8213
8239
  logger2.error(
8214
8240
  `Command definition error: ${pattern.error.message}
8215
- This is a bug in the generated command definition, not in your command arguments.
8216
- Run with --debug for a stack trace.`
8241
+ This is a bug in the generated command definition, not in your command arguments.` + (pattern.debugControlEnabled ? "\nRun with --debug for a stack trace." : "")
8217
8242
  );
8218
8243
  if (pattern.debugStackMode !== void 0 && pattern.error.stack) {
8219
8244
  process.stderr.write(`${formatDebugStack(pattern.error.stack, pattern.debugStackMode)}
@@ -8225,7 +8250,7 @@ Run with --debug for a stack trace.`
8225
8250
  if (pattern.kind === "toolcraft-bug") {
8226
8251
  logger2.error(
8227
8252
  `toolcraft hit an internal invariant: ${pattern.error.message}
8228
- 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.`
8253
+ 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.")
8229
8254
  );
8230
8255
  if (pattern.debugStackMode !== void 0 && pattern.error.stack) {
8231
8256
  process.stderr.write(`${formatDebugStack(pattern.error.stack, pattern.debugStackMode)}
@@ -8235,7 +8260,7 @@ This is a bug in toolcraft or in the command definition; it cannot be worked aro
8235
8260
  return;
8236
8261
  }
8237
8262
  logger2.error(
8238
- pattern.debugStackMode !== void 0 ? pattern.message : `${pattern.message} Use --debug for a stack trace.`
8263
+ pattern.debugStackMode !== void 0 || !pattern.debugControlEnabled ? pattern.message : `${pattern.message} Use --debug for a stack trace.`
8239
8264
  );
8240
8265
  if (pattern.debugStackMode !== void 0 && pattern.stack !== void 0) {
8241
8266
  process.stderr.write(`${formatDebugStack(pattern.stack, pattern.debugStackMode)}
@@ -9306,7 +9331,9 @@ function renderHttpError(error3, options) {
9306
9331
  } else {
9307
9332
  lines.push(`Response body: ${formatHttpErrorSnippet(error3.response.body)}`);
9308
9333
  }
9309
- lines.push("Re-run with --verbose to see headers and full body.");
9334
+ if (options.verboseControlEnabled) {
9335
+ lines.push("Re-run with --verbose to see headers and full body.");
9336
+ }
9310
9337
  }
9311
9338
  process.stderr.write(`${lines.join("\n")}
9312
9339
  `);
@@ -9324,6 +9351,7 @@ async function handleRunError(error3, options) {
9324
9351
  options.userErrorPattern === "definition" ? {
9325
9352
  kind: "definition",
9326
9353
  error: error3,
9354
+ debugControlEnabled: options.debugControlEnabled,
9327
9355
  debugStackMode: options.debugStackMode
9328
9356
  } : options.userErrorPattern === "usage" ? {
9329
9357
  kind: "usage",
@@ -9343,6 +9371,7 @@ async function handleRunError(error3, options) {
9343
9371
  {
9344
9372
  kind: "toolcraft-bug",
9345
9373
  error: error3,
9374
+ debugControlEnabled: options.debugControlEnabled,
9346
9375
  debugStackMode: options.debugStackMode
9347
9376
  },
9348
9377
  options.outputEmitter
@@ -9395,6 +9424,7 @@ async function handleRunError(error3, options) {
9395
9424
  kind: "unexpected",
9396
9425
  message: message2,
9397
9426
  stack: error3 instanceof Error ? error3.stack : void 0,
9427
+ debugControlEnabled: options.debugControlEnabled,
9398
9428
  debugStackMode: options.debugStackMode
9399
9429
  },
9400
9430
  options.outputEmitter
@@ -9791,9 +9821,11 @@ async function runCLI(roots, options = {}) {
9791
9821
  `);
9792
9822
  }
9793
9823
  await handleRunError(error3, {
9794
- debugStackMode: resolvedFlags !== void 0 ? resolveDebugStackMode(resolvedFlags.debug) : getDebugStackModeFromArgv(argv),
9824
+ debugControlEnabled: controls.debug,
9825
+ debugStackMode: controls.debug ? resolvedFlags !== void 0 ? resolveDebugStackMode(resolvedFlags.debug) : getDebugStackModeFromArgv(argv) : void 0,
9795
9826
  output: resolvedFlags !== void 0 ? resolveOutput(resolvedFlags) : resolveOutputFromArgv(argv, controls.outputFormats),
9796
9827
  verbose: resolvedFlags ? Boolean(resolvedFlags.verbose) : argv.includes("--verbose"),
9828
+ verboseControlEnabled: controls.verbose,
9797
9829
  program,
9798
9830
  argv,
9799
9831
  rootUsageName,
@@ -14468,9 +14500,9 @@ function renderBackgrounds(line, startX, y, height) {
14468
14500
  const rectangles = [];
14469
14501
  for (const run of line) {
14470
14502
  const width = displayWidth4(run.text, column);
14471
- const background = resolveBackgroundColor(run);
14472
- if (background !== BACKGROUND && width > 0) {
14473
- rectangles.push(`<rect x="${formatNumber(startX + column * CHARACTER_WIDTH)}" y="${formatNumber(y)}" width="${formatNumber(width * CHARACTER_WIDTH)}" height="${formatNumber(height)}" fill="${escapeXmlAttribute(background)}" />`);
14503
+ const background2 = resolveBackgroundColor(run);
14504
+ if (background2 !== BACKGROUND && width > 0) {
14505
+ rectangles.push(`<rect x="${formatNumber(startX + column * CHARACTER_WIDTH)}" y="${formatNumber(y)}" width="${formatNumber(width * CHARACTER_WIDTH)}" height="${formatNumber(height)}" fill="${escapeXmlAttribute(background2)}" />`);
14474
14506
  }
14475
14507
  column += width;
14476
14508
  }
@@ -15246,7 +15278,7 @@ function sleep2(ms) {
15246
15278
  // src/cli.ts
15247
15279
  configureTheme({ brand: "green", label: "Terminal Pilot" });
15248
15280
  function getBundledPackageVersion() {
15249
- return true ? "0.0.49" : void 0;
15281
+ return true ? "0.0.51" : void 0;
15250
15282
  }
15251
15283
  var pilotOptionsWithValues = /* @__PURE__ */ new Set([
15252
15284
  "--session",