terminal-pilot 0.0.39 → 0.0.41
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/README.md +13 -1
- package/dist/cli.js +24 -4
- package/dist/cli.js.map +2 -2
- package/dist/commands/close-session.js +9 -1
- package/dist/commands/close-session.js.map +2 -2
- package/dist/commands/create-session.js +9 -1
- package/dist/commands/create-session.js.map +2 -2
- package/dist/commands/daemon-runtime.js +13 -2
- package/dist/commands/daemon-runtime.js.map +2 -2
- package/dist/commands/fill.js +9 -1
- package/dist/commands/fill.js.map +2 -2
- package/dist/commands/get-session.js +9 -1
- package/dist/commands/get-session.js.map +2 -2
- package/dist/commands/index.d.ts +4 -0
- package/dist/commands/index.js +19 -2
- package/dist/commands/index.js.map +2 -2
- package/dist/commands/list-sessions.js +9 -1
- package/dist/commands/list-sessions.js.map +2 -2
- package/dist/commands/press-key.js +9 -1
- package/dist/commands/press-key.js.map +2 -2
- package/dist/commands/read-history.js +9 -1
- package/dist/commands/read-history.js.map +2 -2
- package/dist/commands/read-screen.js +9 -1
- package/dist/commands/read-screen.js.map +2 -2
- package/dist/commands/resize.js +9 -1
- package/dist/commands/resize.js.map +2 -2
- package/dist/commands/runtime.js +9 -1
- package/dist/commands/runtime.js.map +2 -2
- package/dist/commands/screenshot.js +9 -1
- package/dist/commands/screenshot.js.map +2 -2
- package/dist/commands/send-signal.js +9 -1
- package/dist/commands/send-signal.js.map +2 -2
- package/dist/commands/type.js +9 -1
- package/dist/commands/type.js.map +2 -2
- package/dist/commands/wait-for-exit.js +9 -1
- package/dist/commands/wait-for-exit.js.map +2 -2
- package/dist/commands/wait-for.d.ts +2 -0
- package/dist/commands/wait-for.js +19 -2
- package/dist/commands/wait-for.js.map +2 -2
- package/dist/index.js +9 -1
- package/dist/index.js.map +2 -2
- package/dist/terminal-pilot.js +9 -1
- package/dist/terminal-pilot.js.map +2 -2
- package/dist/terminal-session.d.ts +1 -0
- package/dist/terminal-session.js +9 -1
- package/dist/terminal-session.js.map +2 -2
- package/dist/testing/cli-repl.js +24 -4
- package/dist/testing/cli-repl.js.map +2 -2
- package/dist/testing/qa-cli.js +24 -4
- package/dist/testing/qa-cli.js.map +2 -2
- package/node_modules/toolcraft-design/dist/index.d.ts +2 -2
- package/node_modules/toolcraft-design/dist/index.js +1 -1
- package/node_modules/toolcraft-design/dist/render-markdown-plaintext.d.ts +2 -0
- package/node_modules/toolcraft-design/dist/render-markdown-plaintext.js +1 -0
- package/node_modules/toolcraft-design/dist/terminal-markdown/index.d.ts +2 -0
- package/node_modules/toolcraft-design/dist/terminal-markdown/index.js +1 -0
- package/node_modules/toolcraft-design/dist/terminal-markdown/parser/inline.js +38 -2
- package/node_modules/toolcraft-design/dist/terminal-markdown/plaintext-renderer.d.ts +11 -0
- package/node_modules/toolcraft-design/dist/terminal-markdown/plaintext-renderer.js +228 -0
- package/node_modules/toolcraft-design/package.json +4 -0
- package/package.json +1 -1
|
@@ -3,6 +3,7 @@ export declare const waitFor: import("toolcraft").Command<TerminalPilotCommandSe
|
|
|
3
3
|
readonly pattern: import("toolcraft").StringSchema;
|
|
4
4
|
readonly session: import("toolcraft").OptionalSchema<import("toolcraft").StringSchema>;
|
|
5
5
|
readonly timeout: import("toolcraft").OptionalSchema<import("toolcraft").NumberSchema>;
|
|
6
|
+
readonly scope: import("toolcraft").OptionalSchema<import("toolcraft").EnumSchema<readonly ["history", "screen"]>>;
|
|
6
7
|
readonly literal: import("toolcraft").OptionalSchema<import("toolcraft").BooleanSchema>;
|
|
7
8
|
}>, undefined, {
|
|
8
9
|
matched: true;
|
|
@@ -12,6 +13,7 @@ export declare const waitFor: import("toolcraft").Command<TerminalPilotCommandSe
|
|
|
12
13
|
readonly pattern: import("toolcraft").StringSchema;
|
|
13
14
|
readonly session: import("toolcraft").OptionalSchema<import("toolcraft").StringSchema>;
|
|
14
15
|
readonly timeout: import("toolcraft").OptionalSchema<import("toolcraft").NumberSchema>;
|
|
16
|
+
readonly scope: import("toolcraft").OptionalSchema<import("toolcraft").EnumSchema<readonly ["history", "screen"]>>;
|
|
15
17
|
readonly literal: import("toolcraft").OptionalSchema<import("toolcraft").BooleanSchema>;
|
|
16
18
|
}>, {
|
|
17
19
|
matched: true;
|
|
@@ -1986,10 +1986,13 @@ var TerminalSession = class {
|
|
|
1986
1986
|
}
|
|
1987
1987
|
async waitFor(pattern, opts) {
|
|
1988
1988
|
const timeout = opts?.timeout ?? DEFAULT_TIMEOUT_MS;
|
|
1989
|
+
const scope = opts?.scope ?? "history";
|
|
1989
1990
|
assertTimeout(timeout);
|
|
1991
|
+
assertWaitScope(scope);
|
|
1990
1992
|
const startedAt = Date.now();
|
|
1991
1993
|
while (Date.now() - startedAt <= timeout) {
|
|
1992
|
-
const
|
|
1994
|
+
const source = scope === "screen" ? (await this.screen()).text : this.rawBuffer;
|
|
1995
|
+
const matched = matchPattern(source, pattern);
|
|
1993
1996
|
if (matched !== null) {
|
|
1994
1997
|
return matched;
|
|
1995
1998
|
}
|
|
@@ -2110,6 +2113,11 @@ function assertTimeout(timeout) {
|
|
|
2110
2113
|
throw new Error("Timeout must be a finite non-negative number.");
|
|
2111
2114
|
}
|
|
2112
2115
|
}
|
|
2116
|
+
function assertWaitScope(scope) {
|
|
2117
|
+
if (scope !== "history" && scope !== "screen") {
|
|
2118
|
+
throw new Error('Wait scope must be either "history" or "screen".');
|
|
2119
|
+
}
|
|
2120
|
+
}
|
|
2113
2121
|
function assertQuietPeriod(duration) {
|
|
2114
2122
|
if (!Number.isFinite(duration) || duration < 0) {
|
|
2115
2123
|
throw new Error("Quiet period must be a finite non-negative number.");
|
|
@@ -2465,6 +2473,11 @@ var params = S.Object({
|
|
|
2465
2473
|
timeout: S.Optional(
|
|
2466
2474
|
S.Number({ short: "t", description: "Maximum wait time in milliseconds", minimum: 0 })
|
|
2467
2475
|
),
|
|
2476
|
+
scope: S.Optional(
|
|
2477
|
+
S.Enum(["history", "screen"], {
|
|
2478
|
+
description: "Search all captured output or only the current visible screen"
|
|
2479
|
+
})
|
|
2480
|
+
),
|
|
2468
2481
|
literal: S.Optional(
|
|
2469
2482
|
S.Boolean({
|
|
2470
2483
|
short: "l",
|
|
@@ -2488,7 +2501,11 @@ var waitFor = defineCommand({
|
|
|
2488
2501
|
env
|
|
2489
2502
|
);
|
|
2490
2503
|
const pattern = params2.literal === true ? params2.pattern : new RegExp(params2.pattern);
|
|
2491
|
-
const
|
|
2504
|
+
const options = params2.timeout === void 0 && params2.scope === void 0 ? void 0 : {
|
|
2505
|
+
...params2.timeout === void 0 ? {} : { timeout: params2.timeout },
|
|
2506
|
+
...params2.scope === void 0 ? {} : { scope: params2.scope }
|
|
2507
|
+
};
|
|
2508
|
+
const line = await namedSession.session.waitFor(pattern, options);
|
|
2492
2509
|
return { matched: true, line };
|
|
2493
2510
|
}
|
|
2494
2511
|
});
|