terminal-pilot 0.0.13 → 0.0.15
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 +7210 -470
- package/dist/cli.js.map +4 -4
- package/dist/commands/close-session.d.ts +5 -5
- package/dist/commands/close-session.js +107 -13
- package/dist/commands/close-session.js.map +4 -4
- package/dist/commands/create-session.d.ts +17 -17
- package/dist/commands/create-session.js +107 -13
- package/dist/commands/create-session.js.map +4 -4
- package/dist/commands/fill.d.ts +7 -7
- package/dist/commands/fill.js +107 -13
- package/dist/commands/fill.js.map +4 -4
- package/dist/commands/get-session.d.ts +5 -5
- package/dist/commands/get-session.js +107 -13
- package/dist/commands/get-session.js.map +4 -4
- package/dist/commands/index.d.ts +124 -124
- package/dist/commands/index.js +184 -27
- package/dist/commands/index.js.map +4 -4
- package/dist/commands/install.d.ts +9 -9
- package/dist/commands/install.js +107 -13
- package/dist/commands/install.js.map +4 -4
- package/dist/commands/installer.js +3 -1
- package/dist/commands/installer.js.map +3 -3
- package/dist/commands/list-sessions.d.ts +3 -3
- package/dist/commands/list-sessions.js +107 -13
- package/dist/commands/list-sessions.js.map +4 -4
- package/dist/commands/press-key.d.ts +7 -7
- package/dist/commands/press-key.js +107 -13
- package/dist/commands/press-key.js.map +4 -4
- package/dist/commands/read-history.d.ts +7 -7
- package/dist/commands/read-history.js +107 -13
- package/dist/commands/read-history.js.map +4 -4
- package/dist/commands/read-screen.d.ts +5 -5
- package/dist/commands/read-screen.js +107 -13
- package/dist/commands/read-screen.js.map +4 -4
- package/dist/commands/resize.d.ts +9 -9
- package/dist/commands/resize.js +107 -13
- package/dist/commands/resize.js.map +4 -4
- package/dist/commands/runtime.d.ts +1 -1
- package/dist/commands/runtime.js +3 -1
- package/dist/commands/runtime.js.map +3 -3
- package/dist/commands/screenshot.d.ts +11 -11
- package/dist/commands/screenshot.js +107 -13
- package/dist/commands/screenshot.js.map +4 -4
- package/dist/commands/send-signal.d.ts +7 -7
- package/dist/commands/send-signal.js +107 -13
- package/dist/commands/send-signal.js.map +4 -4
- package/dist/commands/type.d.ts +7 -7
- package/dist/commands/type.js +107 -13
- package/dist/commands/type.js.map +4 -4
- package/dist/commands/uninstall.d.ts +5 -5
- package/dist/commands/uninstall.js +107 -13
- package/dist/commands/uninstall.js.map +4 -4
- package/dist/commands/wait-for-exit.d.ts +7 -7
- package/dist/commands/wait-for-exit.js +107 -13
- package/dist/commands/wait-for-exit.js.map +4 -4
- package/dist/commands/wait-for.d.ts +11 -11
- package/dist/commands/wait-for.js +107 -13
- package/dist/commands/wait-for.js.map +4 -4
- package/dist/testing/cli-repl.js +7209 -470
- package/dist/testing/cli-repl.js.map +4 -4
- package/dist/testing/qa-cli.js +7218 -479
- package/dist/testing/qa-cli.js.map +4 -4
- package/package.json +3 -3
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import { type TerminalPilotCommandServices } from "./runtime.js";
|
|
2
|
-
export declare const createSession: import("
|
|
3
|
-
readonly command: import("
|
|
4
|
-
readonly args: import("
|
|
5
|
-
readonly session: import("
|
|
6
|
-
readonly cwd: import("
|
|
7
|
-
readonly cols: import("
|
|
8
|
-
readonly rows: import("
|
|
9
|
-
readonly observe: import("
|
|
2
|
+
export declare const createSession: import("toolcraft").Command<TerminalPilotCommandServices, import("toolcraft-schema").ObjectSchema<{
|
|
3
|
+
readonly command: import("toolcraft-schema").StringSchema;
|
|
4
|
+
readonly args: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").ArraySchema<import("toolcraft-schema").StringSchema>>;
|
|
5
|
+
readonly session: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
6
|
+
readonly cwd: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
7
|
+
readonly cols: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").NumberSchema>;
|
|
8
|
+
readonly rows: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").NumberSchema>;
|
|
9
|
+
readonly observe: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").BooleanSchema>;
|
|
10
10
|
}>, undefined, {
|
|
11
11
|
session: string;
|
|
12
12
|
pid: number;
|
|
13
13
|
}> & {
|
|
14
|
-
readonly
|
|
15
|
-
readonly command: import("
|
|
16
|
-
readonly args: import("
|
|
17
|
-
readonly session: import("
|
|
18
|
-
readonly cwd: import("
|
|
19
|
-
readonly cols: import("
|
|
20
|
-
readonly rows: import("
|
|
21
|
-
readonly observe: import("
|
|
14
|
+
readonly __agentKitCommandTypeInfo: import("toolcraft").CommandTypeInfo<"create-session", import("toolcraft-schema").ObjectSchema<{
|
|
15
|
+
readonly command: import("toolcraft-schema").StringSchema;
|
|
16
|
+
readonly args: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").ArraySchema<import("toolcraft-schema").StringSchema>>;
|
|
17
|
+
readonly session: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
18
|
+
readonly cwd: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
19
|
+
readonly cols: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").NumberSchema>;
|
|
20
|
+
readonly rows: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").NumberSchema>;
|
|
21
|
+
readonly observe: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").BooleanSchema>;
|
|
22
22
|
}>, {
|
|
23
23
|
session: string;
|
|
24
24
|
pid: number;
|
|
25
|
-
}, readonly ["cli", "mcp", "sdk"]>;
|
|
25
|
+
}, readonly ["cli", "mcp", "sdk"], undefined>;
|
|
26
26
|
};
|
|
@@ -1,7 +1,97 @@
|
|
|
1
|
-
// ../
|
|
1
|
+
// ../toolcraft/src/index.ts
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
3
|
|
|
4
|
-
// ../
|
|
4
|
+
// ../toolcraft/src/user-error.ts
|
|
5
|
+
var UserError = class extends Error {
|
|
6
|
+
constructor(message) {
|
|
7
|
+
super(message);
|
|
8
|
+
this.name = "UserError";
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
// ../toolcraft/src/human-in-loop/config.ts
|
|
13
|
+
function validateHumanInLoopOnDefine(config) {
|
|
14
|
+
const label = Array.isArray(config.children) ? "group" : "command";
|
|
15
|
+
if (config.confirm === true && config.humanInLoop !== void 0 && config.humanInLoop !== null) {
|
|
16
|
+
throw new Error(`${label} '${config.name}': use either confirm or humanInLoop, not both`);
|
|
17
|
+
}
|
|
18
|
+
if (config.humanInLoop === void 0 || config.humanInLoop === null) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
if (config.humanInLoop.mode !== "sync" && config.humanInLoop.mode !== "async") {
|
|
22
|
+
throw new Error(`${label} '${config.name}': humanInLoop.mode must be "sync" or "async"`);
|
|
23
|
+
}
|
|
24
|
+
if (typeof config.humanInLoop.message !== "function") {
|
|
25
|
+
throw new Error(`${label} '${config.name}': humanInLoop.message must be a function`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function mergeHumanInLoopFromGroup(groupHumanInLoop, childHumanInLoop) {
|
|
29
|
+
if (childHumanInLoop !== void 0) {
|
|
30
|
+
return childHumanInLoop;
|
|
31
|
+
}
|
|
32
|
+
return groupHumanInLoop;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// ../toolcraft-schema/src/json.ts
|
|
36
|
+
function Json() {
|
|
37
|
+
return {
|
|
38
|
+
kind: "json"
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// ../toolcraft-schema/src/oneof.ts
|
|
43
|
+
function assertValidBranches(branches) {
|
|
44
|
+
if (Object.keys(branches).length === 0) {
|
|
45
|
+
throw new Error("OneOf schema requires at least one branch");
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function OneOf(config) {
|
|
49
|
+
assertValidBranches(config.branches);
|
|
50
|
+
return {
|
|
51
|
+
kind: "oneOf",
|
|
52
|
+
discriminator: config.discriminator,
|
|
53
|
+
branches: config.branches
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// ../toolcraft-schema/src/record.ts
|
|
58
|
+
function Record(value) {
|
|
59
|
+
return {
|
|
60
|
+
kind: "record",
|
|
61
|
+
value
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// ../toolcraft-schema/src/union.ts
|
|
66
|
+
function isOptionalSchema(schema) {
|
|
67
|
+
return schema.kind === "optional";
|
|
68
|
+
}
|
|
69
|
+
function getRequiredKeyFingerprint(schema) {
|
|
70
|
+
const requiredKeys = Object.keys(schema.shape).filter((key) => !isOptionalSchema(schema.shape[key])).sort();
|
|
71
|
+
return JSON.stringify(requiredKeys);
|
|
72
|
+
}
|
|
73
|
+
function assertValidBranches2(branches) {
|
|
74
|
+
if (branches.length === 0) {
|
|
75
|
+
throw new Error("Union schema requires at least one branch");
|
|
76
|
+
}
|
|
77
|
+
const fingerprints = /* @__PURE__ */ new Set();
|
|
78
|
+
for (const branch of branches) {
|
|
79
|
+
const fingerprint = getRequiredKeyFingerprint(branch);
|
|
80
|
+
if (fingerprints.has(fingerprint)) {
|
|
81
|
+
throw new Error("Union schema branches must have unique required-key fingerprints");
|
|
82
|
+
}
|
|
83
|
+
fingerprints.add(fingerprint);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function Union(branches) {
|
|
87
|
+
assertValidBranches2(branches);
|
|
88
|
+
return {
|
|
89
|
+
kind: "union",
|
|
90
|
+
branches
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// ../toolcraft-schema/src/index.ts
|
|
5
95
|
function assertValidEnumValues(values) {
|
|
6
96
|
if (values.length === 0) {
|
|
7
97
|
throw new Error("Enum schema requires at least one value");
|
|
@@ -57,18 +147,16 @@ var S = {
|
|
|
57
147
|
kind: "optional",
|
|
58
148
|
inner
|
|
59
149
|
};
|
|
60
|
-
}
|
|
150
|
+
},
|
|
151
|
+
OneOf,
|
|
152
|
+
Union,
|
|
153
|
+
Record,
|
|
154
|
+
Json
|
|
61
155
|
};
|
|
62
156
|
|
|
63
|
-
// ../
|
|
64
|
-
var commandConfigSymbol = /* @__PURE__ */ Symbol("
|
|
65
|
-
var commandSourcePathSymbol = /* @__PURE__ */ Symbol("
|
|
66
|
-
var UserError = class extends Error {
|
|
67
|
-
constructor(message) {
|
|
68
|
-
super(message);
|
|
69
|
-
this.name = "UserError";
|
|
70
|
-
}
|
|
71
|
-
};
|
|
157
|
+
// ../toolcraft/src/index.ts
|
|
158
|
+
var commandConfigSymbol = /* @__PURE__ */ Symbol("toolcraft.command.config");
|
|
159
|
+
var commandSourcePathSymbol = /* @__PURE__ */ Symbol("toolcraft.command.sourcePath");
|
|
72
160
|
function cloneScope(scope) {
|
|
73
161
|
return scope === void 0 ? void 0 : [...scope];
|
|
74
162
|
}
|
|
@@ -140,7 +228,7 @@ function inferCommandSourcePath() {
|
|
|
140
228
|
if (candidate === void 0) {
|
|
141
229
|
continue;
|
|
142
230
|
}
|
|
143
|
-
if (candidate.includes("/packages/
|
|
231
|
+
if (candidate.includes("/packages/toolcraft/src/index.ts") || candidate.includes("/packages/toolcraft/dist/index.js") || candidate.includes("/node_modules/toolcraft/dist/index.js")) {
|
|
144
232
|
continue;
|
|
145
233
|
}
|
|
146
234
|
return candidate;
|
|
@@ -196,6 +284,7 @@ function createBaseCommand(config) {
|
|
|
196
284
|
secrets: cloneSecrets(config.secrets),
|
|
197
285
|
scope: resolveCommandScope(config.scope, void 0),
|
|
198
286
|
confirm: config.confirm ?? false,
|
|
287
|
+
humanInLoop: config.humanInLoop,
|
|
199
288
|
requires: cloneRequires(config.requires),
|
|
200
289
|
handler: config.handler,
|
|
201
290
|
render: config.render
|
|
@@ -203,6 +292,7 @@ function createBaseCommand(config) {
|
|
|
203
292
|
Object.defineProperty(command, commandConfigSymbol, {
|
|
204
293
|
value: {
|
|
205
294
|
scope: cloneScope(config.scope),
|
|
295
|
+
humanInLoop: config.humanInLoop,
|
|
206
296
|
secrets: cloneSecrets(config.secrets),
|
|
207
297
|
requires: cloneRequires(config.requires),
|
|
208
298
|
sourcePath: inferCommandSourcePath()
|
|
@@ -225,6 +315,7 @@ function materializeCommand(command, inherited) {
|
|
|
225
315
|
secrets: mergeSecrets(inherited.secrets, internal.secrets),
|
|
226
316
|
scope: resolveCommandScope(internal.scope, inherited.scope),
|
|
227
317
|
confirm: command.confirm,
|
|
318
|
+
humanInLoop: mergeHumanInLoopFromGroup(inherited.humanInLoop, internal.humanInLoop),
|
|
228
319
|
requires: mergeRequires(inherited.requires, internal.requires),
|
|
229
320
|
handler: command.handler,
|
|
230
321
|
render: command.render
|
|
@@ -232,6 +323,7 @@ function materializeCommand(command, inherited) {
|
|
|
232
323
|
Object.defineProperty(materialized, commandConfigSymbol, {
|
|
233
324
|
value: {
|
|
234
325
|
scope: cloneScope(internal.scope),
|
|
326
|
+
humanInLoop: internal.humanInLoop,
|
|
235
327
|
secrets: cloneSecrets(internal.secrets),
|
|
236
328
|
requires: cloneRequires(internal.requires),
|
|
237
329
|
sourcePath: internal.sourcePath
|
|
@@ -243,8 +335,10 @@ function materializeCommand(command, inherited) {
|
|
|
243
335
|
return materialized;
|
|
244
336
|
}
|
|
245
337
|
function defineCommand(config) {
|
|
338
|
+
validateHumanInLoopOnDefine(config);
|
|
246
339
|
return materializeCommand(createBaseCommand(config), {
|
|
247
340
|
scope: void 0,
|
|
341
|
+
humanInLoop: void 0,
|
|
248
342
|
secrets: {},
|
|
249
343
|
requires: void 0
|
|
250
344
|
});
|