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.
Files changed (63) hide show
  1. package/dist/cli.js +7210 -470
  2. package/dist/cli.js.map +4 -4
  3. package/dist/commands/close-session.d.ts +5 -5
  4. package/dist/commands/close-session.js +107 -13
  5. package/dist/commands/close-session.js.map +4 -4
  6. package/dist/commands/create-session.d.ts +17 -17
  7. package/dist/commands/create-session.js +107 -13
  8. package/dist/commands/create-session.js.map +4 -4
  9. package/dist/commands/fill.d.ts +7 -7
  10. package/dist/commands/fill.js +107 -13
  11. package/dist/commands/fill.js.map +4 -4
  12. package/dist/commands/get-session.d.ts +5 -5
  13. package/dist/commands/get-session.js +107 -13
  14. package/dist/commands/get-session.js.map +4 -4
  15. package/dist/commands/index.d.ts +124 -124
  16. package/dist/commands/index.js +184 -27
  17. package/dist/commands/index.js.map +4 -4
  18. package/dist/commands/install.d.ts +9 -9
  19. package/dist/commands/install.js +107 -13
  20. package/dist/commands/install.js.map +4 -4
  21. package/dist/commands/installer.js +3 -1
  22. package/dist/commands/installer.js.map +3 -3
  23. package/dist/commands/list-sessions.d.ts +3 -3
  24. package/dist/commands/list-sessions.js +107 -13
  25. package/dist/commands/list-sessions.js.map +4 -4
  26. package/dist/commands/press-key.d.ts +7 -7
  27. package/dist/commands/press-key.js +107 -13
  28. package/dist/commands/press-key.js.map +4 -4
  29. package/dist/commands/read-history.d.ts +7 -7
  30. package/dist/commands/read-history.js +107 -13
  31. package/dist/commands/read-history.js.map +4 -4
  32. package/dist/commands/read-screen.d.ts +5 -5
  33. package/dist/commands/read-screen.js +107 -13
  34. package/dist/commands/read-screen.js.map +4 -4
  35. package/dist/commands/resize.d.ts +9 -9
  36. package/dist/commands/resize.js +107 -13
  37. package/dist/commands/resize.js.map +4 -4
  38. package/dist/commands/runtime.d.ts +1 -1
  39. package/dist/commands/runtime.js +3 -1
  40. package/dist/commands/runtime.js.map +3 -3
  41. package/dist/commands/screenshot.d.ts +11 -11
  42. package/dist/commands/screenshot.js +107 -13
  43. package/dist/commands/screenshot.js.map +4 -4
  44. package/dist/commands/send-signal.d.ts +7 -7
  45. package/dist/commands/send-signal.js +107 -13
  46. package/dist/commands/send-signal.js.map +4 -4
  47. package/dist/commands/type.d.ts +7 -7
  48. package/dist/commands/type.js +107 -13
  49. package/dist/commands/type.js.map +4 -4
  50. package/dist/commands/uninstall.d.ts +5 -5
  51. package/dist/commands/uninstall.js +107 -13
  52. package/dist/commands/uninstall.js.map +4 -4
  53. package/dist/commands/wait-for-exit.d.ts +7 -7
  54. package/dist/commands/wait-for-exit.js +107 -13
  55. package/dist/commands/wait-for-exit.js.map +4 -4
  56. package/dist/commands/wait-for.d.ts +11 -11
  57. package/dist/commands/wait-for.js +107 -13
  58. package/dist/commands/wait-for.js.map +4 -4
  59. package/dist/testing/cli-repl.js +7209 -470
  60. package/dist/testing/cli-repl.js.map +4 -4
  61. package/dist/testing/qa-cli.js +7218 -479
  62. package/dist/testing/qa-cli.js.map +4 -4
  63. package/package.json +3 -3
@@ -1,12 +1,12 @@
1
1
  import { type TerminalPilotCommandServices } from "./runtime.js";
2
- export declare const resize: import("@poe-code/cmdkit").Command<TerminalPilotCommandServices, import("@poe-code/cmdkit-schema").ObjectSchema<{
3
- readonly cols: import("@poe-code/cmdkit-schema").NumberSchema;
4
- readonly rows: import("@poe-code/cmdkit-schema").NumberSchema;
5
- readonly session: import("@poe-code/cmdkit-schema").OptionalSchema<import("@poe-code/cmdkit-schema").StringSchema>;
2
+ export declare const resize: import("toolcraft").Command<TerminalPilotCommandServices, import("toolcraft-schema").ObjectSchema<{
3
+ readonly cols: import("toolcraft-schema").NumberSchema;
4
+ readonly rows: import("toolcraft-schema").NumberSchema;
5
+ readonly session: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
6
6
  }>, undefined, undefined> & {
7
- readonly __cmdkitCommandTypeInfo: import("@poe-code/cmdkit").CommandTypeInfo<"resize", import("@poe-code/cmdkit-schema").ObjectSchema<{
8
- readonly cols: import("@poe-code/cmdkit-schema").NumberSchema;
9
- readonly rows: import("@poe-code/cmdkit-schema").NumberSchema;
10
- readonly session: import("@poe-code/cmdkit-schema").OptionalSchema<import("@poe-code/cmdkit-schema").StringSchema>;
11
- }>, undefined, readonly ["cli", "mcp", "sdk"]>;
7
+ readonly __agentKitCommandTypeInfo: import("toolcraft").CommandTypeInfo<"resize", import("toolcraft-schema").ObjectSchema<{
8
+ readonly cols: import("toolcraft-schema").NumberSchema;
9
+ readonly rows: import("toolcraft-schema").NumberSchema;
10
+ readonly session: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
11
+ }>, undefined, readonly ["cli", "mcp", "sdk"], undefined>;
12
12
  };
@@ -1,7 +1,97 @@
1
- // ../cmdkit/src/index.ts
1
+ // ../toolcraft/src/index.ts
2
2
  import { fileURLToPath } from "node:url";
3
3
 
4
- // ../cmdkit-schema/src/index.ts
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
- // ../cmdkit/src/index.ts
64
- var commandConfigSymbol = /* @__PURE__ */ Symbol("cmdkit.command.config");
65
- var commandSourcePathSymbol = /* @__PURE__ */ Symbol("cmdkit.command.sourcePath");
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/cmdkit/src/index.ts") || candidate.includes("/packages/cmdkit/dist/index.js")) {
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
  });