terminal-pilot 0.0.10 → 0.0.11

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 (54) hide show
  1. package/dist/cli.js +194 -35
  2. package/dist/cli.js.map +4 -4
  3. package/dist/commands/close-session.js +11 -2
  4. package/dist/commands/close-session.js.map +2 -2
  5. package/dist/commands/create-session.js +11 -2
  6. package/dist/commands/create-session.js.map +2 -2
  7. package/dist/commands/fill.js +11 -2
  8. package/dist/commands/fill.js.map +2 -2
  9. package/dist/commands/get-session.js +11 -2
  10. package/dist/commands/get-session.js.map +2 -2
  11. package/dist/commands/index.js +131 -7
  12. package/dist/commands/index.js.map +4 -4
  13. package/dist/commands/install.js +123 -7
  14. package/dist/commands/install.js.map +4 -4
  15. package/dist/commands/installer.js +41 -1
  16. package/dist/commands/installer.js.map +3 -3
  17. package/dist/commands/list-sessions.js +11 -2
  18. package/dist/commands/list-sessions.js.map +2 -2
  19. package/dist/commands/press-key.js +11 -2
  20. package/dist/commands/press-key.js.map +2 -2
  21. package/dist/commands/read-history.js +11 -2
  22. package/dist/commands/read-history.js.map +2 -2
  23. package/dist/commands/read-screen.js +11 -2
  24. package/dist/commands/read-screen.js.map +2 -2
  25. package/dist/commands/resize.js +11 -2
  26. package/dist/commands/resize.js.map +2 -2
  27. package/dist/commands/runtime.js +8 -0
  28. package/dist/commands/runtime.js.map +2 -2
  29. package/dist/commands/screenshot.js +11 -2
  30. package/dist/commands/screenshot.js.map +2 -2
  31. package/dist/commands/send-signal.js +11 -2
  32. package/dist/commands/send-signal.js.map +2 -2
  33. package/dist/commands/type.js +11 -2
  34. package/dist/commands/type.js.map +2 -2
  35. package/dist/commands/uninstall.js +44 -3
  36. package/dist/commands/uninstall.js.map +3 -3
  37. package/dist/commands/wait-for-exit.js +11 -2
  38. package/dist/commands/wait-for-exit.js.map +2 -2
  39. package/dist/commands/wait-for.js +11 -2
  40. package/dist/commands/wait-for.js.map +2 -2
  41. package/dist/index.js +8 -0
  42. package/dist/index.js.map +2 -2
  43. package/dist/terminal-buffer.d.ts +1 -0
  44. package/dist/terminal-buffer.js +8 -0
  45. package/dist/terminal-buffer.js.map +2 -2
  46. package/dist/terminal-pilot.js +8 -0
  47. package/dist/terminal-pilot.js.map +2 -2
  48. package/dist/terminal-session.js +8 -0
  49. package/dist/terminal-session.js.map +2 -2
  50. package/dist/testing/cli-repl.js +194 -35
  51. package/dist/testing/cli-repl.js.map +4 -4
  52. package/dist/testing/qa-cli.js +194 -35
  53. package/dist/testing/qa-cli.js.map +4 -4
  54. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -639,6 +639,12 @@ function renderTable(options) {
639
639
 
640
640
  // ../design-system/src/acp/components.ts
641
641
  import chalk7 from "chalk";
642
+
643
+ // ../design-system/src/acp/writer.ts
644
+ import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
645
+ var storage = new AsyncLocalStorage2();
646
+
647
+ // ../design-system/src/acp/components.ts
642
648
  var AGENT_PREFIX = `${chalk7.green.bold("\u2713")} agent: `;
643
649
 
644
650
  // ../design-system/src/dashboard/buffer.ts
@@ -811,10 +817,11 @@ var S = {
811
817
  ...options
812
818
  };
813
819
  },
814
- Object(shape) {
820
+ Object(shape, options = {}) {
815
821
  return {
816
822
  kind: "object",
817
- shape
823
+ shape,
824
+ ...options
818
825
  };
819
826
  },
820
827
  Optional(inner) {
@@ -1198,6 +1205,14 @@ function getCommandSourcePath(command) {
1198
1205
  return command[commandSourcePathSymbol];
1199
1206
  }
1200
1207
 
1208
+ // ../cmdkit/src/number-schema.ts
1209
+ function isValidNumberSchemaValue(value, schema) {
1210
+ return typeof value === "number" && Number.isFinite(value) && (schema.jsonType !== "integer" || Number.isInteger(value));
1211
+ }
1212
+ function getExpectedNumberDescription(schema) {
1213
+ return schema.jsonType === "integer" ? "an integer" : "a number";
1214
+ }
1215
+
1201
1216
  // ../cmdkit/src/renderer.ts
1202
1217
  function isObject(value) {
1203
1218
  return value !== null && typeof value === "object" && !Array.isArray(value);
@@ -1548,8 +1563,10 @@ function parseScalarValue(value, schema, label) {
1548
1563
  return value;
1549
1564
  case "number": {
1550
1565
  const parsed = Number(value);
1551
- if (!Number.isFinite(parsed)) {
1552
- throw new InvalidArgumentError(`Invalid value for "${label}". Expected a number.`);
1566
+ if (!isValidNumberSchemaValue(parsed, schema)) {
1567
+ throw new InvalidArgumentError(
1568
+ `Invalid value for "${label}". Expected ${getExpectedNumberDescription(schema)}.`
1569
+ );
1553
1570
  }
1554
1571
  return parsed;
1555
1572
  }
@@ -1637,6 +1654,9 @@ function resolveHelpOutput(argv) {
1637
1654
  if (value === "rich" || value === "md" || value === "json") {
1638
1655
  return value;
1639
1656
  }
1657
+ if (value === "markdown") {
1658
+ return "md";
1659
+ }
1640
1660
  continue;
1641
1661
  }
1642
1662
  if (token.startsWith("--output=")) {
@@ -1644,6 +1664,9 @@ function resolveHelpOutput(argv) {
1644
1664
  if (value === "rich" || value === "md" || value === "json") {
1645
1665
  return value;
1646
1666
  }
1667
+ if (value === "markdown") {
1668
+ return "md";
1669
+ }
1647
1670
  }
1648
1671
  }
1649
1672
  return "rich";
@@ -1652,7 +1675,7 @@ function isNodeVisibleInScope(node, scope) {
1652
1675
  if (node.kind === "command") {
1653
1676
  return node.scope.includes(scope);
1654
1677
  }
1655
- return getVisibleChildren(node, scope).length > 0 || Boolean(node.default && node.default.scope.includes(scope));
1678
+ return getVisibleChildren(node, scope).length > 0 || Boolean(node.default && node.default.scope.includes(scope)) || node.scope === void 0 || node.scope.includes(scope);
1656
1679
  }
1657
1680
  function getVisibleChildren(group, scope) {
1658
1681
  return group.children.filter((child) => isNodeVisibleInScope(child, scope));
@@ -1894,10 +1917,10 @@ function createNodeCommand(node, casing, execute) {
1894
1917
  });
1895
1918
  return command;
1896
1919
  }
1897
- const visibleChildren = node.children.map((child) => createNodeCommand(child, casing, execute)).filter((child) => child !== null);
1898
- if (visibleChildren.length === 0 && node.default === void 0) {
1920
+ if (!isNodeVisibleInScope(node, "cli")) {
1899
1921
  return null;
1900
1922
  }
1923
+ const visibleChildren = node.children.map((child) => createNodeCommand(child, casing, execute)).filter((child) => child !== null);
1901
1924
  const group = new CommanderCommand(node.name);
1902
1925
  if (node.description !== void 0) {
1903
1926
  group.description(node.description);
@@ -1916,7 +1939,10 @@ function addGlobalOptions(command) {
1916
1939
  if (value === "rich" || value === "md" || value === "json") {
1917
1940
  return value;
1918
1941
  }
1919
- throw new InvalidArgumentError('Invalid value for "--output". Expected one of: rich, md, json.');
1942
+ if (value === "markdown") {
1943
+ return "md";
1944
+ }
1945
+ throw new InvalidArgumentError('Invalid value for "--output". Expected one of: rich, md, markdown, json.');
1920
1946
  }).option("--verbose", "Print stack traces for unexpected errors.");
1921
1947
  }
1922
1948
  function setNestedValue(target, path6, value) {
@@ -1994,20 +2020,22 @@ async function promptForField(field) {
1994
2020
  }
1995
2021
  return parseScalarValue(entered, field.schema, field.displayPath);
1996
2022
  }
1997
- function resolveOutput(globalFlags) {
1998
- if (globalFlags.output !== void 0) {
1999
- return globalFlags.output;
2023
+ function resolveOutput(resolvedFlags) {
2024
+ if (resolvedFlags.json === true) {
2025
+ return "json";
2026
+ }
2027
+ if (resolvedFlags.output !== void 0) {
2028
+ return resolvedFlags.output;
2000
2029
  }
2001
2030
  return "rich";
2002
2031
  }
2032
+ var DESIGN_SYSTEM_OUTPUT_BY_MODE = {
2033
+ rich: "terminal",
2034
+ md: "markdown",
2035
+ json: "json"
2036
+ };
2003
2037
  function toDesignSystemOutput(output) {
2004
- if (output === "md") {
2005
- return "markdown";
2006
- }
2007
- if (output === "json") {
2008
- return "json";
2009
- }
2010
- return "terminal";
2038
+ return DESIGN_SYSTEM_OUTPUT_BY_MODE[output];
2011
2039
  }
2012
2040
  async function withOutputFormat2(output, fn) {
2013
2041
  const previous = process.env.OUTPUT_FORMAT;
@@ -2016,7 +2044,11 @@ async function withOutputFormat2(output, fn) {
2016
2044
  try {
2017
2045
  return await fn();
2018
2046
  } finally {
2019
- process.env.OUTPUT_FORMAT = previous;
2047
+ if (previous === void 0) {
2048
+ delete process.env.OUTPUT_FORMAT;
2049
+ } else {
2050
+ process.env.OUTPUT_FORMAT = previous;
2051
+ }
2020
2052
  resetOutputFormatCache();
2021
2053
  }
2022
2054
  }
@@ -2064,6 +2096,9 @@ function describeExpectedPresetValue(schema) {
2064
2096
  return `a ${schema.kind}`;
2065
2097
  }
2066
2098
  function validatePresetScalarValue(value, schema, fieldPath, presetPath) {
2099
+ if (value === null && schema.nullable === true) {
2100
+ return null;
2101
+ }
2067
2102
  switch (schema.kind) {
2068
2103
  case "string":
2069
2104
  if (typeof value !== "string") {
@@ -2071,7 +2106,7 @@ function validatePresetScalarValue(value, schema, fieldPath, presetPath) {
2071
2106
  }
2072
2107
  return value;
2073
2108
  case "number":
2074
- if (typeof value !== "number" || !Number.isFinite(value)) {
2109
+ if (!isValidNumberSchemaValue(value, schema)) {
2075
2110
  break;
2076
2111
  }
2077
2112
  return value;
@@ -2489,7 +2524,7 @@ async function resolveParams(fields, positionalValues, optionValues, presetPath,
2489
2524
  }
2490
2525
  return params17;
2491
2526
  }
2492
- function getGlobalFlags(command) {
2527
+ function getResolvedFlags(command) {
2493
2528
  const flags = command.optsWithGlobals();
2494
2529
  return flags;
2495
2530
  }
@@ -2501,9 +2536,10 @@ async function executeCommand(state, services, requirementOptions) {
2501
2536
  getTheme,
2502
2537
  note
2503
2538
  };
2504
- const globalFlags = getGlobalFlags(state.actionCommand);
2505
- const output = resolveOutput(globalFlags);
2506
- const shouldPrompt = !globalFlags.yes && Boolean(process.stdin.isTTY);
2539
+ const optionValues = state.actionCommand.optsWithGlobals();
2540
+ const resolvedFlags = optionValues;
2541
+ const output = resolveOutput(resolvedFlags);
2542
+ const shouldPrompt = !resolvedFlags.yes && Boolean(process.stdin.isTTY);
2507
2543
  const runtime = await resolveFixtureRuntime(state.command, services, requirementOptions);
2508
2544
  const preflightContext = {
2509
2545
  ...runtime.services,
@@ -2520,15 +2556,15 @@ async function executeCommand(state, services, requirementOptions) {
2520
2556
  const params17 = await resolveParams(
2521
2557
  state.fields,
2522
2558
  state.positionalValues,
2523
- state.actionCommand.optsWithGlobals(),
2524
- globalFlags.preset,
2559
+ optionValues,
2560
+ resolvedFlags.preset,
2525
2561
  shouldPrompt
2526
2562
  );
2527
2563
  const context = {
2528
2564
  ...preflightContext,
2529
2565
  params: params17
2530
2566
  };
2531
- if (state.command.confirm && !globalFlags.yes && process.stdin.isTTY) {
2567
+ if (state.command.confirm && !resolvedFlags.yes && process.stdin.isTTY) {
2532
2568
  for (const field of state.fields) {
2533
2569
  const value = field.path.reduce(
2534
2570
  (current, segment) => current && typeof current === "object" ? current[segment] : void 0,
@@ -2604,7 +2640,7 @@ async function runCLI(roots, options = {}) {
2604
2640
  try {
2605
2641
  await executeCommand(state, services, requirementOptions);
2606
2642
  } catch (error2) {
2607
- handleRunError(error2, Boolean(getGlobalFlags(state.actionCommand).verbose));
2643
+ handleRunError(error2, Boolean(getResolvedFlags(state.actionCommand).verbose));
2608
2644
  }
2609
2645
  };
2610
2646
  for (const child of root.children) {
@@ -2719,6 +2755,7 @@ var TerminalBuffer = class {
2719
2755
  _state = 0 /* Normal */;
2720
2756
  _csiParams = "";
2721
2757
  _csiPrivate = "";
2758
+ _autoWrap = true;
2722
2759
  _style = createDefaultStyleState();
2723
2760
  _styleSequence = "";
2724
2761
  displayBuffer;
@@ -2846,6 +2883,9 @@ var TerminalBuffer = class {
2846
2883
  const p1 = params17[1] ?? 0;
2847
2884
  if (this._csiPrivate === "?") {
2848
2885
  if (final === "h" || final === "l") {
2886
+ if (params17.includes(7)) {
2887
+ this._autoWrap = final === "h";
2888
+ }
2849
2889
  if (params17.includes(1049)) {
2850
2890
  if (final === "h") {
2851
2891
  this._screen = this._makeScreen(this._cols, this._rows);
@@ -3060,6 +3100,10 @@ var TerminalBuffer = class {
3060
3100
  } else if (code >= 32 && code !== 127) {
3061
3101
  this._setChar(this._cursorY, this._cursorX, ch);
3062
3102
  this._cursorX++;
3103
+ if (!this._autoWrap) {
3104
+ this._cursorX = Math.min(this._cursorX, this._cols - 1);
3105
+ return;
3106
+ }
3063
3107
  if (this._cursorX >= this._cols) {
3064
3108
  this._cursorX = 0;
3065
3109
  this._newline();
@@ -3974,13 +4018,46 @@ var kimiAgent = {
3974
4018
  }
3975
4019
  };
3976
4020
 
4021
+ // ../agent-defs/src/agents/goose.ts
4022
+ var gooseAgent = {
4023
+ id: "goose",
4024
+ name: "goose",
4025
+ label: "Goose",
4026
+ summary: "Block's open-source AI agent with ACP support.",
4027
+ binaryName: "goose",
4028
+ configPath: "~/.config/goose/config.yaml",
4029
+ branding: {
4030
+ colors: {
4031
+ dark: "#FF6B35",
4032
+ light: "#E85D26"
4033
+ }
4034
+ }
4035
+ };
4036
+
4037
+ // ../agent-defs/src/agents/poe-agent.ts
4038
+ var poeAgentAgent = {
4039
+ id: "poe-agent",
4040
+ name: "poe-agent",
4041
+ label: "Poe Agent",
4042
+ summary: "Run one-shot prompts with the built-in Poe agent runtime.",
4043
+ configPath: "~/.poe-code/config.json",
4044
+ branding: {
4045
+ colors: {
4046
+ dark: "#A465F7",
4047
+ light: "#7A3FD3"
4048
+ }
4049
+ }
4050
+ };
4051
+
3977
4052
  // ../agent-defs/src/registry.ts
3978
4053
  var allAgents = [
3979
4054
  claudeCodeAgent,
3980
4055
  claudeDesktopAgent,
3981
4056
  codexAgent,
3982
4057
  openCodeAgent,
3983
- kimiAgent
4058
+ kimiAgent,
4059
+ gooseAgent,
4060
+ poeAgentAgent
3984
4061
  ];
3985
4062
  var lookup = /* @__PURE__ */ new Map();
3986
4063
  for (const agent of allAgents) {
@@ -4012,6 +4089,10 @@ var agentSkillConfigs = {
4012
4089
  opencode: {
4013
4090
  globalSkillDir: "~/.config/opencode/skills",
4014
4091
  localSkillDir: ".opencode/skills"
4092
+ },
4093
+ goose: {
4094
+ globalSkillDir: "~/.agents/skills",
4095
+ localSkillDir: ".agents/skills"
4015
4096
  }
4016
4097
  };
4017
4098
  var supportedAgents = Object.keys(agentSkillConfigs);
@@ -4275,14 +4356,92 @@ var tomlFormat = {
4275
4356
  prune: prune2
4276
4357
  };
4277
4358
 
4359
+ // ../config-mutations/src/formats/yaml.ts
4360
+ import { parse as parseYaml, stringify as stringifyYaml } from "yaml";
4361
+ function isConfigObject3(value) {
4362
+ return typeof value === "object" && value !== null && !Array.isArray(value);
4363
+ }
4364
+ function parse5(content) {
4365
+ if (!content || content.trim() === "") {
4366
+ return {};
4367
+ }
4368
+ const parsed = parseYaml(content);
4369
+ if (parsed === null || parsed === void 0) {
4370
+ return {};
4371
+ }
4372
+ if (!isConfigObject3(parsed)) {
4373
+ throw new Error("Expected YAML object.");
4374
+ }
4375
+ return parsed;
4376
+ }
4377
+ function serialize3(obj) {
4378
+ const serialized = stringifyYaml(obj);
4379
+ return serialized.endsWith("\n") ? serialized : `${serialized}
4380
+ `;
4381
+ }
4382
+ function merge3(base, patch) {
4383
+ const result = { ...base };
4384
+ for (const [key, value] of Object.entries(patch)) {
4385
+ if (value === void 0) {
4386
+ continue;
4387
+ }
4388
+ const existing = result[key];
4389
+ if (isConfigObject3(existing) && isConfigObject3(value)) {
4390
+ result[key] = merge3(existing, value);
4391
+ continue;
4392
+ }
4393
+ result[key] = value;
4394
+ }
4395
+ return result;
4396
+ }
4397
+ function prune3(obj, shape) {
4398
+ let changed = false;
4399
+ const result = { ...obj };
4400
+ for (const [key, pattern] of Object.entries(shape)) {
4401
+ if (!(key in result)) {
4402
+ continue;
4403
+ }
4404
+ const current = result[key];
4405
+ if (isConfigObject3(pattern) && Object.keys(pattern).length === 0) {
4406
+ delete result[key];
4407
+ changed = true;
4408
+ continue;
4409
+ }
4410
+ if (isConfigObject3(pattern) && isConfigObject3(current)) {
4411
+ const { changed: childChanged, result: childResult } = prune3(current, pattern);
4412
+ if (childChanged) {
4413
+ changed = true;
4414
+ }
4415
+ if (Object.keys(childResult).length === 0) {
4416
+ delete result[key];
4417
+ } else {
4418
+ result[key] = childResult;
4419
+ }
4420
+ continue;
4421
+ }
4422
+ delete result[key];
4423
+ changed = true;
4424
+ }
4425
+ return { changed, result };
4426
+ }
4427
+ var yamlFormat = {
4428
+ parse: parse5,
4429
+ serialize: serialize3,
4430
+ merge: merge3,
4431
+ prune: prune3
4432
+ };
4433
+
4278
4434
  // ../config-mutations/src/formats/index.ts
4279
4435
  var formatRegistry = {
4280
4436
  json: jsonFormat,
4281
- toml: tomlFormat
4437
+ toml: tomlFormat,
4438
+ yaml: yamlFormat
4282
4439
  };
4283
4440
  var extensionMap = {
4284
4441
  ".json": "json",
4285
- ".toml": "toml"
4442
+ ".toml": "toml",
4443
+ ".yaml": "yaml",
4444
+ ".yml": "yaml"
4286
4445
  };
4287
4446
  function getConfigFormat(pathOrFormat) {
4288
4447
  if (pathOrFormat in formatRegistry) {
@@ -4431,7 +4590,7 @@ function pruneKeysByPrefix(table, prefix) {
4431
4590
  }
4432
4591
  return result;
4433
4592
  }
4434
- function isConfigObject3(value) {
4593
+ function isConfigObject4(value) {
4435
4594
  return typeof value === "object" && value !== null && !Array.isArray(value);
4436
4595
  }
4437
4596
  function mergeWithPruneByPrefix(base, patch, pruneByPrefix) {
@@ -4440,7 +4599,7 @@ function mergeWithPruneByPrefix(base, patch, pruneByPrefix) {
4440
4599
  for (const [key, value] of Object.entries(patch)) {
4441
4600
  const current = result[key];
4442
4601
  const prefix = prefixMap[key];
4443
- if (isConfigObject3(current) && isConfigObject3(value)) {
4602
+ if (isConfigObject4(current) && isConfigObject4(value)) {
4444
4603
  if (prefix) {
4445
4604
  const pruned = pruneKeysByPrefix(current, prefix);
4446
4605
  result[key] = { ...pruned, ...value };
@@ -5464,7 +5623,7 @@ function applySgr(style, paramsText) {
5464
5623
  }
5465
5624
  return nextStyle;
5466
5625
  }
5467
- function parseAnsi(input) {
5626
+ function parseAnsi2(input) {
5468
5627
  const runs = [];
5469
5628
  let style = createDefaultStyle();
5470
5629
  let textStart = 0;
@@ -5999,7 +6158,7 @@ function formatNumber(value) {
5999
6158
 
6000
6159
  // ../terminal-png/src/index.ts
6001
6160
  async function renderTerminalPng(ansiText, options = {}) {
6002
- const runs = parseAnsi(ansiText);
6161
+ const runs = parseAnsi2(ansiText);
6003
6162
  const svg = renderSvg(runs, {
6004
6163
  padding: options.padding,
6005
6164
  window: options.window