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.
- package/dist/cli.js +584 -163
- package/dist/cli.js.map +4 -4
- package/dist/commands/close-session.js.map +1 -1
- package/dist/commands/create-session.js.map +1 -1
- package/dist/commands/daemon-runtime.js.map +1 -1
- package/dist/commands/fill.js.map +1 -1
- package/dist/commands/get-session.js.map +1 -1
- package/dist/commands/index.js +61 -11
- package/dist/commands/index.js.map +4 -4
- package/dist/commands/install.js +65 -15
- package/dist/commands/install.js.map +4 -4
- package/dist/commands/installer.js +21 -7
- package/dist/commands/installer.js.map +2 -2
- package/dist/commands/list-sessions.js.map +1 -1
- package/dist/commands/press-key.js.map +1 -1
- package/dist/commands/read-history.js.map +1 -1
- package/dist/commands/read-screen.js.map +1 -1
- package/dist/commands/resize.js.map +1 -1
- package/dist/commands/runtime.js.map +1 -1
- package/dist/commands/screenshot.js.map +1 -1
- package/dist/commands/send-signal.js.map +1 -1
- package/dist/commands/type.js.map +1 -1
- package/dist/commands/uninstall.js +21 -7
- package/dist/commands/uninstall.js.map +2 -2
- package/dist/commands/wait-for-exit.js.map +1 -1
- package/dist/commands/wait-for.js.map +1 -1
- package/dist/composition.json +6 -1
- package/dist/testing/cli-repl.js +584 -163
- package/dist/testing/cli-repl.js.map +4 -4
- package/dist/testing/qa-cli.js +584 -163
- package/dist/testing/qa-cli.js.map +4 -4
- package/node_modules/@poe-code/agent-defs/README.md +14 -1
- package/node_modules/@poe-code/agent-defs/dist/agents/claude-code.js +2 -1
- package/node_modules/@poe-code/agent-defs/dist/agents/claude-desktop.js +1 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/codex.js +2 -1
- package/node_modules/@poe-code/agent-defs/dist/agents/cursor.js +1 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/gemini-cli.js +2 -1
- package/node_modules/@poe-code/agent-defs/dist/agents/goose.js +1 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/kimi.js +2 -1
- package/node_modules/@poe-code/agent-defs/dist/agents/opencode.js +2 -1
- package/node_modules/@poe-code/agent-defs/dist/agents/pi.js +2 -1
- package/node_modules/@poe-code/agent-defs/dist/agents/poe-agent.js +1 -0
- package/node_modules/@poe-code/agent-defs/dist/capabilities.d.ts +14 -0
- package/node_modules/@poe-code/agent-defs/dist/capabilities.js +63 -0
- package/node_modules/@poe-code/agent-defs/dist/index.d.ts +2 -1
- package/node_modules/@poe-code/agent-defs/dist/index.js +1 -0
- package/node_modules/@poe-code/agent-defs/dist/registry.js +3 -0
- package/node_modules/@poe-code/agent-defs/dist/types.d.ts +7 -0
- package/node_modules/@poe-code/agent-skill-config/dist/apply.d.ts +2 -0
- package/node_modules/@poe-code/agent-skill-config/dist/apply.js +18 -14
- package/node_modules/@poe-code/agent-skill-config/dist/bridge-active-skills.js +3 -1
- package/node_modules/@poe-code/agent-skill-config/dist/configs.d.ts +2 -0
- package/node_modules/@poe-code/agent-skill-config/dist/configs.js +2 -1
- package/node_modules/@poe-code/frontmatter/README.md +3 -0
- package/node_modules/@poe-code/frontmatter/dist/index.d.ts +1 -1
- package/node_modules/@poe-code/frontmatter/dist/index.js +1 -1
- package/node_modules/@poe-code/frontmatter/dist/parse.d.ts +9 -0
- package/node_modules/@poe-code/frontmatter/dist/parse.js +16 -0
- package/node_modules/@poe-code/user-error/README.md +56 -0
- package/node_modules/@poe-code/user-error/dist/index.d.ts +17 -0
- package/node_modules/@poe-code/user-error/dist/index.js +21 -0
- package/node_modules/@poe-code/user-error/package.json +24 -0
- package/node_modules/toolcraft-design/dist/acp/components.d.ts +8 -1
- package/node_modules/toolcraft-design/dist/acp/components.js +11 -6
- package/node_modules/toolcraft-design/dist/acp/index.d.ts +1 -0
- package/node_modules/toolcraft-design/dist/components/command-errors.d.ts +2 -0
- package/node_modules/toolcraft-design/dist/components/command-errors.js +8 -2
- package/node_modules/toolcraft-design/dist/components/help-formatter-plain.js +61 -25
- package/node_modules/toolcraft-design/dist/components/help-formatter.d.ts +15 -0
- package/node_modules/toolcraft-design/dist/components/help-formatter.js +128 -29
- package/node_modules/toolcraft-design/dist/components/index.d.ts +3 -3
- package/node_modules/toolcraft-design/dist/components/index.js +2 -2
- package/node_modules/toolcraft-design/dist/components/table.d.ts +1 -0
- package/node_modules/toolcraft-design/dist/components/table.js +52 -5
- package/node_modules/toolcraft-design/dist/components/template.d.ts +9 -0
- package/node_modules/toolcraft-design/dist/components/template.js +27 -2
- package/node_modules/toolcraft-design/dist/help-formatter.d.ts +2 -2
- package/node_modules/toolcraft-design/dist/help-formatter.js +1 -1
- package/node_modules/toolcraft-design/dist/index.d.ts +4 -4
- package/node_modules/toolcraft-design/dist/index.js +3 -3
- package/node_modules/toolcraft-design/dist/prompts/interactive/core.d.ts +5 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/core.js +15 -1
- package/node_modules/toolcraft-design/dist/prompts/primitives/spinner.js +1 -1
- 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
|
"<": "<",
|
|
@@ -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
|
|
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
|
|
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(
|
|
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.
|
|
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
|
},
|