terminal-pilot 0.0.48 → 0.0.50

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 (84) hide show
  1. package/dist/cli.js +584 -163
  2. package/dist/cli.js.map +4 -4
  3. package/dist/commands/close-session.js.map +1 -1
  4. package/dist/commands/create-session.js.map +1 -1
  5. package/dist/commands/daemon-runtime.js.map +1 -1
  6. package/dist/commands/fill.js.map +1 -1
  7. package/dist/commands/get-session.js.map +1 -1
  8. package/dist/commands/index.js +61 -11
  9. package/dist/commands/index.js.map +4 -4
  10. package/dist/commands/install.js +65 -15
  11. package/dist/commands/install.js.map +4 -4
  12. package/dist/commands/installer.js +21 -7
  13. package/dist/commands/installer.js.map +2 -2
  14. package/dist/commands/list-sessions.js.map +1 -1
  15. package/dist/commands/press-key.js.map +1 -1
  16. package/dist/commands/read-history.js.map +1 -1
  17. package/dist/commands/read-screen.js.map +1 -1
  18. package/dist/commands/resize.js.map +1 -1
  19. package/dist/commands/runtime.js.map +1 -1
  20. package/dist/commands/screenshot.js.map +1 -1
  21. package/dist/commands/send-signal.js.map +1 -1
  22. package/dist/commands/type.js.map +1 -1
  23. package/dist/commands/uninstall.js +21 -7
  24. package/dist/commands/uninstall.js.map +2 -2
  25. package/dist/commands/wait-for-exit.js.map +1 -1
  26. package/dist/commands/wait-for.js.map +1 -1
  27. package/dist/composition.json +6 -1
  28. package/dist/testing/cli-repl.js +584 -163
  29. package/dist/testing/cli-repl.js.map +4 -4
  30. package/dist/testing/qa-cli.js +584 -163
  31. package/dist/testing/qa-cli.js.map +4 -4
  32. package/node_modules/@poe-code/agent-defs/README.md +14 -1
  33. package/node_modules/@poe-code/agent-defs/dist/agents/claude-code.js +2 -1
  34. package/node_modules/@poe-code/agent-defs/dist/agents/claude-desktop.js +1 -0
  35. package/node_modules/@poe-code/agent-defs/dist/agents/codex.js +2 -1
  36. package/node_modules/@poe-code/agent-defs/dist/agents/cursor.js +1 -0
  37. package/node_modules/@poe-code/agent-defs/dist/agents/gemini-cli.js +2 -1
  38. package/node_modules/@poe-code/agent-defs/dist/agents/goose.js +1 -0
  39. package/node_modules/@poe-code/agent-defs/dist/agents/kimi.js +2 -1
  40. package/node_modules/@poe-code/agent-defs/dist/agents/opencode.js +2 -1
  41. package/node_modules/@poe-code/agent-defs/dist/agents/pi.js +2 -1
  42. package/node_modules/@poe-code/agent-defs/dist/agents/poe-agent.js +1 -0
  43. package/node_modules/@poe-code/agent-defs/dist/capabilities.d.ts +14 -0
  44. package/node_modules/@poe-code/agent-defs/dist/capabilities.js +63 -0
  45. package/node_modules/@poe-code/agent-defs/dist/index.d.ts +2 -1
  46. package/node_modules/@poe-code/agent-defs/dist/index.js +1 -0
  47. package/node_modules/@poe-code/agent-defs/dist/registry.js +3 -0
  48. package/node_modules/@poe-code/agent-defs/dist/types.d.ts +7 -0
  49. package/node_modules/@poe-code/agent-skill-config/dist/apply.d.ts +2 -0
  50. package/node_modules/@poe-code/agent-skill-config/dist/apply.js +18 -14
  51. package/node_modules/@poe-code/agent-skill-config/dist/bridge-active-skills.js +3 -1
  52. package/node_modules/@poe-code/agent-skill-config/dist/configs.d.ts +2 -0
  53. package/node_modules/@poe-code/agent-skill-config/dist/configs.js +2 -1
  54. package/node_modules/@poe-code/frontmatter/README.md +3 -0
  55. package/node_modules/@poe-code/frontmatter/dist/index.d.ts +1 -1
  56. package/node_modules/@poe-code/frontmatter/dist/index.js +1 -1
  57. package/node_modules/@poe-code/frontmatter/dist/parse.d.ts +9 -0
  58. package/node_modules/@poe-code/frontmatter/dist/parse.js +16 -0
  59. package/node_modules/@poe-code/user-error/README.md +56 -0
  60. package/node_modules/@poe-code/user-error/dist/index.d.ts +17 -0
  61. package/node_modules/@poe-code/user-error/dist/index.js +21 -0
  62. package/node_modules/@poe-code/user-error/package.json +24 -0
  63. package/node_modules/toolcraft-design/dist/acp/components.d.ts +8 -1
  64. package/node_modules/toolcraft-design/dist/acp/components.js +11 -6
  65. package/node_modules/toolcraft-design/dist/acp/index.d.ts +1 -0
  66. package/node_modules/toolcraft-design/dist/components/command-errors.d.ts +2 -0
  67. package/node_modules/toolcraft-design/dist/components/command-errors.js +8 -2
  68. package/node_modules/toolcraft-design/dist/components/help-formatter-plain.js +61 -25
  69. package/node_modules/toolcraft-design/dist/components/help-formatter.d.ts +15 -0
  70. package/node_modules/toolcraft-design/dist/components/help-formatter.js +128 -29
  71. package/node_modules/toolcraft-design/dist/components/index.d.ts +3 -3
  72. package/node_modules/toolcraft-design/dist/components/index.js +2 -2
  73. package/node_modules/toolcraft-design/dist/components/table.d.ts +1 -0
  74. package/node_modules/toolcraft-design/dist/components/table.js +52 -5
  75. package/node_modules/toolcraft-design/dist/components/template.d.ts +9 -0
  76. package/node_modules/toolcraft-design/dist/components/template.js +27 -2
  77. package/node_modules/toolcraft-design/dist/help-formatter.d.ts +2 -2
  78. package/node_modules/toolcraft-design/dist/help-formatter.js +1 -1
  79. package/node_modules/toolcraft-design/dist/index.d.ts +4 -4
  80. package/node_modules/toolcraft-design/dist/index.js +3 -3
  81. package/node_modules/toolcraft-design/dist/prompts/interactive/core.d.ts +5 -0
  82. package/node_modules/toolcraft-design/dist/prompts/interactive/core.js +15 -1
  83. package/node_modules/toolcraft-design/dist/prompts/primitives/spinner.js +1 -1
  84. package/package.json +5 -3
@@ -1,4 +1,17 @@
1
1
  const MAX_PARTIAL_DEPTH = 100;
2
+ const MAX_TAG_EXCERPT_LENGTH = 40;
3
+ export class TemplateParseError extends Error {
4
+ description;
5
+ line;
6
+ column;
7
+ constructor(description, position) {
8
+ super(`${description} at line ${position.line}, column ${position.column}`);
9
+ this.name = "TemplateParseError";
10
+ this.description = description;
11
+ this.line = position.line;
12
+ this.column = position.column;
13
+ }
14
+ }
2
15
  const HTML_ESCAPE = {
3
16
  "&": "&",
4
17
  "<": "&lt;",
@@ -114,13 +127,13 @@ function parseTag(template, open) {
114
127
  if (template.startsWith("{{{", open)) {
115
128
  const close = template.indexOf("}}}", open + 3);
116
129
  if (close === -1) {
117
- throw new Error("Unclosed unescaped tag");
130
+ throw unclosedTagError(template, open, "}}}");
118
131
  }
119
132
  return { kind: "unescaped", name: template.slice(open + 3, close).trim(), end: close + 3 };
120
133
  }
121
134
  const close = template.indexOf("}}", open + 2);
122
135
  if (close === -1) {
123
- throw new Error("Unclosed tag");
136
+ throw unclosedTagError(template, open, "}}");
124
137
  }
125
138
  const raw = template.slice(open + 2, close).trim();
126
139
  const sigil = raw[0];
@@ -142,6 +155,18 @@ function parseTag(template, open) {
142
155
  return { kind: "delimiter", name, end };
143
156
  return { kind: "name", name: raw, end };
144
157
  }
158
+ function unclosedTagError(template, open, expected) {
159
+ const before = template.slice(0, open);
160
+ const lineEnd = template.indexOf("\n", open);
161
+ const opened = template.slice(open, lineEnd === -1 ? template.length : lineEnd).trimEnd();
162
+ const tag = opened.length > MAX_TAG_EXCERPT_LENGTH
163
+ ? `${opened.slice(0, MAX_TAG_EXCERPT_LENGTH)}...`
164
+ : opened;
165
+ return new TemplateParseError(`Unclosed tag "${tag}": expected "${expected}"`, {
166
+ line: before.split("\n").length,
167
+ column: open - (before.lastIndexOf("\n") + 1) + 1
168
+ });
169
+ }
145
170
  function getStandalone(template, tagStart, tagEnd, kind) {
146
171
  if (!["section", "inverted", "close", "comment", "partial", "delimiter"].includes(kind)) {
147
172
  return undefined;
@@ -1,2 +1,2 @@
1
- export { helpFormatter } from "./components/help-formatter.js";
2
- export type { CommandInfo, FormatColumnsOptions, OptionInfo } from "./components/help-formatter.js";
1
+ export { helpFormatter, formatColumns, formatCommand, formatUsage, formatOption, formatCommandList, formatOptionList, styleHelpToken, joinHelpTokens, renderHelpTokens } from "./components/help-formatter.js";
2
+ export type { CommandInfo, FormatColumnsOptions, OptionInfo, HelpToken, HelpTokenRole } from "./components/help-formatter.js";
@@ -1 +1 @@
1
- export { helpFormatter } from "./components/help-formatter.js";
1
+ export { helpFormatter, formatColumns, formatCommand, formatUsage, formatOption, formatCommandList, formatOptionList, styleHelpToken, joinHelpTokens, renderHelpTokens } from "./components/help-formatter.js";
@@ -12,12 +12,12 @@ export type { Color } from "./components/color.js";
12
12
  export { symbols } from "./components/symbols.js";
13
13
  export { createLogger, logger } from "./components/logger.js";
14
14
  export type { LoggerOutput } from "./components/logger.js";
15
- export { helpFormatter, formatColumns, formatCommand, formatUsage, formatOption, formatCommandList, formatOptionList } from "./components/help-formatter.js";
15
+ export { helpFormatter, formatColumns, formatCommand, formatUsage, formatOption, formatCommandList, formatOptionList, styleHelpToken, joinHelpTokens, renderHelpTokens } from "./components/help-formatter.js";
16
16
  export * as helpFormatterPlain from "./components/help-formatter-plain.js";
17
- export type { CommandInfo, OptionInfo, FormatColumnsOptions } from "./components/help-formatter.js";
17
+ export type { CommandInfo, OptionInfo, FormatColumnsOptions, HelpToken, HelpTokenRole } from "./components/help-formatter.js";
18
18
  export { formatCommandNotFound } from "./components/command-errors.js";
19
19
  export { formatCommandNotFoundPanel } from "./components/command-errors.js";
20
- export { renderTable } from "./components/table.js";
20
+ export { loggerTableWidth, renderTable } from "./components/table.js";
21
21
  export type { TableColumn, RenderTableOptions } from "./components/table.js";
22
22
  export { renderFileChanges } from "./components/file-changes.js";
23
23
  export type { FileChange, FileChangeDisplayMode, FileChangeKind, FileChangeOutputFormat, RenderFileChangesOptions } from "./components/file-changes.js";
@@ -29,7 +29,7 @@ export { renderInspectorCard } from "./components/inspector-card.js";
29
29
  export type { InspectorField, InspectorSection, RenderInspectorCardOptions } from "./components/inspector-card.js";
30
30
  export { renderResourceBrowser } from "./components/resource-browser.js";
31
31
  export type { RenderResourceBrowserOptions, ResourceBrowserGroup, ResourceBrowserItem } from "./components/resource-browser.js";
32
- export { getTemplatePartialNames, renderTemplate, resolveTemplatePartials } from "./components/template.js";
32
+ export { TemplateParseError, getTemplatePartialNames, renderTemplate, resolveTemplatePartials } from "./components/template.js";
33
33
  export type { RenderTemplateOptions, TemplateEscape } from "./components/template.js";
34
34
  export { openExternal } from "./components/browser.js";
35
35
  export * as acp from "./acp/index.js";
@@ -10,17 +10,17 @@ export { text } from "./components/text.js";
10
10
  export { color } from "./components/color.js";
11
11
  export { symbols } from "./components/symbols.js";
12
12
  export { createLogger, logger } from "./components/logger.js";
13
- export { helpFormatter, formatColumns, formatCommand, formatUsage, formatOption, formatCommandList, formatOptionList } from "./components/help-formatter.js";
13
+ export { helpFormatter, formatColumns, formatCommand, formatUsage, formatOption, formatCommandList, formatOptionList, styleHelpToken, joinHelpTokens, renderHelpTokens } from "./components/help-formatter.js";
14
14
  export * as helpFormatterPlain from "./components/help-formatter-plain.js";
15
15
  export { formatCommandNotFound } from "./components/command-errors.js";
16
16
  export { formatCommandNotFoundPanel } from "./components/command-errors.js";
17
- export { renderTable } from "./components/table.js";
17
+ export { loggerTableWidth, renderTable } from "./components/table.js";
18
18
  export { renderFileChanges } from "./components/file-changes.js";
19
19
  export { renderCatalog } from "./components/catalog.js";
20
20
  export { renderDetailCard } from "./components/detail-card.js";
21
21
  export { renderInspectorCard } from "./components/inspector-card.js";
22
22
  export { renderResourceBrowser } from "./components/resource-browser.js";
23
- export { getTemplatePartialNames, renderTemplate, resolveTemplatePartials } from "./components/template.js";
23
+ export { TemplateParseError, getTemplatePartialNames, renderTemplate, resolveTemplatePartials } from "./components/template.js";
24
24
  export { openExternal } from "./components/browser.js";
25
25
  // ACP rendering
26
26
  export * as acp from "./acp/index.js";
@@ -1,6 +1,11 @@
1
1
  import { EventEmitter } from "node:events";
2
2
  import { CANCEL } from "./cancel-symbol.js";
3
3
  export type PromptStateName = "initial" | "active" | "submit" | "cancel" | "error";
4
+ /**
5
+ * Builds the non-TTY rejection message, naming the documented `--yes` flag for the
6
+ * command being run and keeping `POE_NO_PROMPT=1` as the secondary CI alternative.
7
+ */
8
+ export declare function nonTtyPromptMessage(argv?: string[]): string;
4
9
  export interface PromptState<Value> {
5
10
  state: PromptStateName;
6
11
  value: Value | undefined;
@@ -22,6 +22,20 @@ const cursor = {
22
22
  const erase = {
23
23
  down: "\x1b[J"
24
24
  };
25
+ /**
26
+ * Builds the non-TTY rejection message, naming the documented `--yes` flag for the
27
+ * command being run and keeping `POE_NO_PROMPT=1` as the secondary CI alternative.
28
+ */
29
+ export function nonTtyPromptMessage(argv = process.argv) {
30
+ const tokens = [];
31
+ for (const arg of argv.slice(2)) {
32
+ if (arg.startsWith("-"))
33
+ break;
34
+ tokens.push(arg);
35
+ }
36
+ const retry = [...tokens, "--yes"].join(" ");
37
+ return `Interactive prompt requires a TTY. Re-run with \`${retry}\` to accept defaults non-interactively, or set POE_NO_PROMPT=1 in CI.`;
38
+ }
25
39
  export class Prompt extends EventEmitter {
26
40
  state = "initial";
27
41
  value;
@@ -92,7 +106,7 @@ export class Prompt extends EventEmitter {
92
106
  });
93
107
  }
94
108
  promptNonTty() {
95
- return Promise.reject(new Error("Interactive prompt requires a TTY. Set POE_NO_PROMPT=1 to accept defaults non-interactively."));
109
+ return Promise.reject(new Error(nonTtyPromptMessage()));
96
110
  }
97
111
  readNonTtyLine() {
98
112
  return new Promise((resolve) => {
@@ -33,7 +33,7 @@ export function spinner() {
33
33
  }
34
34
  fallback = process.env.POE_NO_SPINNER === "1" || !process.stdout.isTTY;
35
35
  if (fallback) {
36
- process.stdout.write(`${currentMessage}\n`);
36
+ process.stdout.write(`${color.gray("│")} ${currentMessage}\n`);
37
37
  return;
38
38
  }
39
39
  frameIndex = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "terminal-pilot",
3
- "version": "0.0.48",
3
+ "version": "0.0.50",
4
4
  "description": "Playwright-like SDK and CLI for automating interactive CLI apps through a real PTY",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -24,8 +24,8 @@
24
24
  },
25
25
  "scripts": {
26
26
  "build": "rm -rf dist && tsc --emitDeclarationOnly && node scripts/build.mjs",
27
- "prepack": "node ../../scripts/set-bin-executable.mjs && node ../../scripts/manage-bundled-workspace-deps.mjs prepare . @poe-code/agent-skill-config @poe-code/agent-defs @poe-code/config-mutations toolcraft-design @poe-code/frontmatter fast-string-width fast-wrap-ansi jsonc-parser sisteransi smol-toml yaml",
28
- "postpack": "node ../../scripts/manage-bundled-workspace-deps.mjs cleanup . @poe-code/agent-skill-config @poe-code/agent-defs @poe-code/config-mutations toolcraft-design @poe-code/frontmatter fast-string-width fast-wrap-ansi jsonc-parser sisteransi smol-toml yaml",
27
+ "prepack": "node ../../scripts/set-bin-executable.mjs && node ../../scripts/manage-bundled-workspace-deps.mjs prepare . @poe-code/agent-skill-config @poe-code/agent-defs @poe-code/config-mutations @poe-code/user-error toolcraft-design @poe-code/frontmatter fast-string-width fast-wrap-ansi jsonc-parser sisteransi smol-toml yaml",
28
+ "postpack": "node ../../scripts/manage-bundled-workspace-deps.mjs cleanup . @poe-code/agent-skill-config @poe-code/agent-defs @poe-code/config-mutations @poe-code/user-error toolcraft-design @poe-code/frontmatter fast-string-width fast-wrap-ansi jsonc-parser sisteransi smol-toml yaml",
29
29
  "test": "cd ../.. && vitest run $(rg --files packages/terminal-pilot/src -g '*.test.ts' | sort | tr '\n' ' ')",
30
30
  "test:unit": "cd ../.. && vitest run $(rg --files packages/terminal-pilot/src -g '*.test.ts' | sort | tr '\n' ' ')",
31
31
  "qa:cli": "cd ../.. && tsx packages/terminal-pilot/src/testing/qa-cli.ts",
@@ -72,6 +72,7 @@
72
72
  "@poe-code/agent-skill-config",
73
73
  "@poe-code/agent-defs",
74
74
  "@poe-code/config-mutations",
75
+ "@poe-code/user-error",
75
76
  "toolcraft-design",
76
77
  "@poe-code/frontmatter",
77
78
  "fast-string-width",
@@ -84,6 +85,7 @@
84
85
  "optionalDependencies": {
85
86
  "@poe-code/agent-defs": "*",
86
87
  "@poe-code/config-mutations": "*",
88
+ "@poe-code/user-error": "*",
87
89
  "toolcraft-design": "*",
88
90
  "@poe-code/frontmatter": "*"
89
91
  },