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
@@ -1105,9 +1105,9 @@ function detectThemeFromEnv(env) {
1105
1105
  const colorFGBG = env.COLORFGBG;
1106
1106
  if (typeof colorFGBG === "string") {
1107
1107
  const parts = colorFGBG.split(";").map((part) => Number.parseInt(part, 10));
1108
- const background = parts.at(-1);
1109
- if (Number.isFinite(background)) {
1110
- return background >= 8 ? "light" : "dark";
1108
+ const background2 = parts.at(-1);
1109
+ if (Number.isFinite(background2)) {
1110
+ return background2 >= 8 ? "light" : "dark";
1111
1111
  }
1112
1112
  }
1113
1113
  return void 0;
@@ -2963,6 +2963,19 @@ var storage = new AsyncLocalStorage2();
2963
2963
  import readline from "node:readline";
2964
2964
  import { PassThrough } from "node:stream";
2965
2965
 
2966
+ // ../toolcraft-design/src/screen/style.ts
2967
+ var STYLE_BOLD = 1 << 0;
2968
+ var STYLE_DIM = 1 << 1;
2969
+ var STYLE_UNDERLINE = 1 << 2;
2970
+ var STYLE_INVERSE = 1 << 3;
2971
+
2972
+ // ../toolcraft-design/src/explorer/runtime.ts
2973
+ import { appendFileSync } from "node:fs";
2974
+
2975
+ // ../toolcraft-design/src/terminal/input.ts
2976
+ var PASTE_START = Buffer.from("\x1B[200~");
2977
+ var PASTE_END = Buffer.from("\x1B[201~");
2978
+
2966
2979
  // ../toolcraft-design/src/explorer/state.ts
2967
2980
  var REGION_HEADER = 1 << 0;
2968
2981
  var REGION_LIST = 1 << 1;
@@ -4011,6 +4024,9 @@ function cloneRequires(requires) {
4011
4024
  check: requires.check
4012
4025
  };
4013
4026
  }
4027
+ function cloneToolAnnotations(annotations) {
4028
+ return annotations === void 0 ? void 0 : { ...annotations };
4029
+ }
4014
4030
  function cloneStringArray(values) {
4015
4031
  return values === void 0 ? void 0 : [...values];
4016
4032
  }
@@ -4280,16 +4296,24 @@ function resolveGroupScope(ownScope, inheritedScope) {
4280
4296
  return cloneScope(ownScope ?? inheritedScope);
4281
4297
  }
4282
4298
  function createBaseCommand(config2) {
4299
+ if (config2.mcpResult !== void 0 && config2.result === void 0) {
4300
+ throw new ToolcraftBugError(
4301
+ `Command "${config2.name}" defines mcpResult without a result schema.`
4302
+ );
4303
+ }
4283
4304
  const command = {
4284
4305
  kind: "command",
4285
4306
  name: config2.name,
4307
+ title: config2.title,
4286
4308
  description: config2.description,
4309
+ annotations: cloneToolAnnotations(config2.annotations),
4287
4310
  hidden: config2.hidden ?? false,
4288
4311
  examples: cloneCommandExamples(config2.examples),
4289
4312
  aliases: [...config2.aliases ?? []],
4290
4313
  positional: [...config2.positional ?? []],
4291
4314
  params: config2.params,
4292
4315
  result: config2.result,
4316
+ mcpResult: config2.mcpResult,
4293
4317
  stream: void 0,
4294
4318
  secrets: cloneSecrets(config2.secrets),
4295
4319
  scope: resolveCommandScope(config2.scope, void 0),
@@ -4301,10 +4325,13 @@ function createBaseCommand(config2) {
4301
4325
  };
4302
4326
  Object.defineProperty(command, commandConfigSymbol, {
4303
4327
  value: {
4328
+ title: config2.title,
4329
+ annotations: cloneToolAnnotations(config2.annotations),
4304
4330
  scope: cloneScope(config2.scope),
4305
4331
  hidden: config2.hidden ?? false,
4306
4332
  examples: cloneCommandExamples(config2.examples),
4307
4333
  result: config2.result,
4334
+ mcpResult: config2.mcpResult,
4308
4335
  humanInLoop: config2.humanInLoop,
4309
4336
  secrets: cloneSecrets(config2.secrets),
4310
4337
  requires: cloneRequires(config2.requires),
@@ -4352,13 +4379,16 @@ function materializeCommand(command, inherited) {
4352
4379
  const materialized = {
4353
4380
  kind: "command",
4354
4381
  name: command.name,
4382
+ title: internal.title,
4355
4383
  description: command.description,
4384
+ annotations: cloneToolAnnotations(internal.annotations),
4356
4385
  hidden: internal.hidden,
4357
4386
  examples: cloneCommandExamples(internal.examples),
4358
4387
  aliases: [...command.aliases],
4359
4388
  positional: [...command.positional],
4360
4389
  params: command.params,
4361
4390
  result: internal.result,
4391
+ mcpResult: internal.mcpResult,
4362
4392
  stream: command.stream,
4363
4393
  secrets: mergeSecrets(inherited.secrets, internal.secrets),
4364
4394
  scope: resolveCommandScope(internal.scope, inherited.scope),
@@ -4370,10 +4400,13 @@ function materializeCommand(command, inherited) {
4370
4400
  };
4371
4401
  Object.defineProperty(materialized, commandConfigSymbol, {
4372
4402
  value: {
4403
+ title: internal.title,
4404
+ annotations: cloneToolAnnotations(internal.annotations),
4373
4405
  scope: cloneScope(internal.scope),
4374
4406
  hidden: internal.hidden,
4375
4407
  examples: cloneCommandExamples(internal.examples),
4376
4408
  result: internal.result,
4409
+ mcpResult: internal.mcpResult,
4377
4410
  humanInLoop: internal.humanInLoop,
4378
4411
  secrets: cloneSecrets(internal.secrets),
4379
4412
  requires: cloneRequires(internal.requires),
@@ -5321,23 +5354,11 @@ function displayScalar(value) {
5321
5354
  }
5322
5355
  return stringifyValue(value) || "\u2014";
5323
5356
  }
5324
- function isUrl(value) {
5325
- return typeof value === "string" && (value.startsWith("https://") || value.startsWith("http://"));
5326
- }
5327
- function compactUrl(value) {
5328
- try {
5329
- const url = new URL(value);
5330
- const tail = url.pathname.split("/").filter(Boolean).at(-1);
5331
- return tail ? `${url.hostname}/\u2026/${tail}` : url.hostname;
5332
- } catch {
5333
- return value;
5334
- }
5335
- }
5336
5357
  function stackedList(value) {
5337
5358
  return value.map((entry) => displayScalar(entry)).join("\n") || "\u2014";
5338
5359
  }
5339
5360
  function displayRowValue(value) {
5340
- return isUrl(value) ? compactUrl(value) : displayScalar(value);
5361
+ return displayScalar(value);
5341
5362
  }
5342
5363
  function directScalarRows(result) {
5343
5364
  return Object.entries(result).filter(([, value]) => !isObject2(value) && !Array.isArray(value)).map(([key, value]) => ({ label: humanizeKey(key), value: displayRowValue(value) }));
@@ -6309,6 +6330,9 @@ function isNegativeNumericArrayToken(token, schema) {
6309
6330
  return items.length > 0 && items.every((item) => isValidNumberSchemaValue(Number(item), itemSchema));
6310
6331
  }
6311
6332
  function isNextArrayOptionToken(token, schema) {
6333
+ if (token === "-" && unwrapOptional2(schema.item).kind === "string") {
6334
+ return false;
6335
+ }
6312
6336
  return token.startsWith("-") && !isNegativeNumericArrayToken(token, schema);
6313
6337
  }
6314
6338
  function validateArrayBounds(value, schema, label) {
@@ -6377,10 +6401,14 @@ function validateOutputFormats(formats) {
6377
6401
  );
6378
6402
  }
6379
6403
  if (BUILT_IN_OUTPUT_FORMATS.includes(name)) {
6380
- throw new ToolcraftBugError(`Custom output format "${name}" conflicts with a built-in format.`);
6404
+ throw new ToolcraftBugError(
6405
+ `Custom output format "${name}" conflicts with a built-in format.`
6406
+ );
6381
6407
  }
6382
6408
  if (typeof renderer !== "function") {
6383
- throw new ToolcraftBugError(`Custom output format "${name}" must define a renderer function.`);
6409
+ throw new ToolcraftBugError(
6410
+ `Custom output format "${name}" must define a renderer function.`
6411
+ );
6384
6412
  }
6385
6413
  }
6386
6414
  }
@@ -7212,10 +7240,8 @@ ${formatHelpOptionList(optionRows)}`);
7212
7240
  }
7213
7241
  const secretRows = formatSecretRows(command.secrets);
7214
7242
  if (secretRows.length > 0) {
7215
- sections.push(
7216
- `${text.section("Secrets (environment):")}
7217
- ${formatHelpOptionList(secretRows)}`
7218
- );
7243
+ sections.push(`${text.section("Secrets (environment):")}
7244
+ ${formatHelpOptionList(secretRows)}`);
7219
7245
  }
7220
7246
  if (command.examples.length > 0) {
7221
7247
  sections.push(
@@ -8295,8 +8321,7 @@ function renderCliErrorPattern(pattern, outputEmitter) {
8295
8321
  if (pattern.kind === "definition") {
8296
8322
  logger2.error(
8297
8323
  `Command definition error: ${pattern.error.message}
8298
- This is a bug in the generated command definition, not in your command arguments.
8299
- Run with --debug for a stack trace.`
8324
+ This is a bug in the generated command definition, not in your command arguments.` + (pattern.debugControlEnabled ? "\nRun with --debug for a stack trace." : "")
8300
8325
  );
8301
8326
  if (pattern.debugStackMode !== void 0 && pattern.error.stack) {
8302
8327
  process.stderr.write(`${formatDebugStack(pattern.error.stack, pattern.debugStackMode)}
@@ -8308,7 +8333,7 @@ Run with --debug for a stack trace.`
8308
8333
  if (pattern.kind === "toolcraft-bug") {
8309
8334
  logger2.error(
8310
8335
  `toolcraft hit an internal invariant: ${pattern.error.message}
8311
- 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.`
8336
+ 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.")
8312
8337
  );
8313
8338
  if (pattern.debugStackMode !== void 0 && pattern.error.stack) {
8314
8339
  process.stderr.write(`${formatDebugStack(pattern.error.stack, pattern.debugStackMode)}
@@ -8318,7 +8343,7 @@ This is a bug in toolcraft or in the command definition; it cannot be worked aro
8318
8343
  return;
8319
8344
  }
8320
8345
  logger2.error(
8321
- pattern.debugStackMode !== void 0 ? pattern.message : `${pattern.message} Use --debug for a stack trace.`
8346
+ pattern.debugStackMode !== void 0 || !pattern.debugControlEnabled ? pattern.message : `${pattern.message} Use --debug for a stack trace.`
8322
8347
  );
8323
8348
  if (pattern.debugStackMode !== void 0 && pattern.stack !== void 0) {
8324
8349
  process.stderr.write(`${formatDebugStack(pattern.stack, pattern.debugStackMode)}
@@ -9389,7 +9414,9 @@ function renderHttpError(error3, options) {
9389
9414
  } else {
9390
9415
  lines.push(`Response body: ${formatHttpErrorSnippet(error3.response.body)}`);
9391
9416
  }
9392
- lines.push("Re-run with --verbose to see headers and full body.");
9417
+ if (options.verboseControlEnabled) {
9418
+ lines.push("Re-run with --verbose to see headers and full body.");
9419
+ }
9393
9420
  }
9394
9421
  process.stderr.write(`${lines.join("\n")}
9395
9422
  `);
@@ -9407,6 +9434,7 @@ async function handleRunError(error3, options) {
9407
9434
  options.userErrorPattern === "definition" ? {
9408
9435
  kind: "definition",
9409
9436
  error: error3,
9437
+ debugControlEnabled: options.debugControlEnabled,
9410
9438
  debugStackMode: options.debugStackMode
9411
9439
  } : options.userErrorPattern === "usage" ? {
9412
9440
  kind: "usage",
@@ -9426,6 +9454,7 @@ async function handleRunError(error3, options) {
9426
9454
  {
9427
9455
  kind: "toolcraft-bug",
9428
9456
  error: error3,
9457
+ debugControlEnabled: options.debugControlEnabled,
9429
9458
  debugStackMode: options.debugStackMode
9430
9459
  },
9431
9460
  options.outputEmitter
@@ -9478,6 +9507,7 @@ async function handleRunError(error3, options) {
9478
9507
  kind: "unexpected",
9479
9508
  message: message2,
9480
9509
  stack: error3 instanceof Error ? error3.stack : void 0,
9510
+ debugControlEnabled: options.debugControlEnabled,
9481
9511
  debugStackMode: options.debugStackMode
9482
9512
  },
9483
9513
  options.outputEmitter
@@ -9874,9 +9904,11 @@ async function runCLI(roots, options = {}) {
9874
9904
  `);
9875
9905
  }
9876
9906
  await handleRunError(error3, {
9877
- debugStackMode: resolvedFlags !== void 0 ? resolveDebugStackMode(resolvedFlags.debug) : getDebugStackModeFromArgv(argv),
9907
+ debugControlEnabled: controls.debug,
9908
+ debugStackMode: controls.debug ? resolvedFlags !== void 0 ? resolveDebugStackMode(resolvedFlags.debug) : getDebugStackModeFromArgv(argv) : void 0,
9878
9909
  output: resolvedFlags !== void 0 ? resolveOutput(resolvedFlags) : resolveOutputFromArgv(argv, controls.outputFormats),
9879
9910
  verbose: resolvedFlags ? Boolean(resolvedFlags.verbose) : argv.includes("--verbose"),
9911
+ verboseControlEnabled: controls.verbose,
9880
9912
  program,
9881
9913
  argv,
9882
9914
  rootUsageName,
@@ -14478,9 +14510,9 @@ function renderBackgrounds(line, startX, y, height) {
14478
14510
  const rectangles = [];
14479
14511
  for (const run of line) {
14480
14512
  const width = displayWidth4(run.text, column);
14481
- const background = resolveBackgroundColor(run);
14482
- if (background !== BACKGROUND && width > 0) {
14483
- rectangles.push(`<rect x="${formatNumber(startX + column * CHARACTER_WIDTH)}" y="${formatNumber(y)}" width="${formatNumber(width * CHARACTER_WIDTH)}" height="${formatNumber(height)}" fill="${escapeXmlAttribute(background)}" />`);
14513
+ const background2 = resolveBackgroundColor(run);
14514
+ if (background2 !== BACKGROUND && width > 0) {
14515
+ rectangles.push(`<rect x="${formatNumber(startX + column * CHARACTER_WIDTH)}" y="${formatNumber(y)}" width="${formatNumber(width * CHARACTER_WIDTH)}" height="${formatNumber(height)}" fill="${escapeXmlAttribute(background2)}" />`);
14484
14516
  }
14485
14517
  column += width;
14486
14518
  }
@@ -15256,7 +15288,7 @@ function sleep2(ms) {
15256
15288
  // src/cli.ts
15257
15289
  configureTheme({ brand: "green", label: "Terminal Pilot" });
15258
15290
  function getBundledPackageVersion() {
15259
- return true ? "0.0.49" : void 0;
15291
+ return true ? "0.0.51" : void 0;
15260
15292
  }
15261
15293
  var pilotOptionsWithValues = /* @__PURE__ */ new Set([
15262
15294
  "--session",