terminal-pilot 0.0.17 → 0.0.18

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 (62) hide show
  1. package/dist/cli.js +2993 -774
  2. package/dist/cli.js.map +4 -4
  3. package/dist/commands/close-session.d.ts +4 -4
  4. package/dist/commands/close-session.js +32 -18
  5. package/dist/commands/close-session.js.map +2 -2
  6. package/dist/commands/create-session.d.ts +16 -16
  7. package/dist/commands/create-session.js +32 -18
  8. package/dist/commands/create-session.js.map +2 -2
  9. package/dist/commands/fill.d.ts +6 -6
  10. package/dist/commands/fill.js +32 -18
  11. package/dist/commands/fill.js.map +2 -2
  12. package/dist/commands/get-session.d.ts +4 -4
  13. package/dist/commands/get-session.js +32 -18
  14. package/dist/commands/get-session.js.map +2 -2
  15. package/dist/commands/index.d.ts +106 -106
  16. package/dist/commands/index.js +864 -94
  17. package/dist/commands/index.js.map +4 -4
  18. package/dist/commands/install.d.ts +8 -8
  19. package/dist/commands/install.js +815 -57
  20. package/dist/commands/install.js.map +4 -4
  21. package/dist/commands/installer.js +494 -16
  22. package/dist/commands/installer.js.map +4 -4
  23. package/dist/commands/list-sessions.d.ts +2 -2
  24. package/dist/commands/list-sessions.js +32 -18
  25. package/dist/commands/list-sessions.js.map +2 -2
  26. package/dist/commands/press-key.d.ts +6 -6
  27. package/dist/commands/press-key.js +32 -18
  28. package/dist/commands/press-key.js.map +2 -2
  29. package/dist/commands/read-history.d.ts +6 -6
  30. package/dist/commands/read-history.js +32 -18
  31. package/dist/commands/read-history.js.map +2 -2
  32. package/dist/commands/read-screen.d.ts +4 -4
  33. package/dist/commands/read-screen.js +32 -18
  34. package/dist/commands/read-screen.js.map +2 -2
  35. package/dist/commands/resize.d.ts +8 -8
  36. package/dist/commands/resize.js +32 -18
  37. package/dist/commands/resize.js.map +2 -2
  38. package/dist/commands/runtime.js +2 -2
  39. package/dist/commands/runtime.js.map +2 -2
  40. package/dist/commands/screenshot.d.ts +10 -10
  41. package/dist/commands/screenshot.js +32 -18
  42. package/dist/commands/screenshot.js.map +2 -2
  43. package/dist/commands/send-signal.d.ts +6 -6
  44. package/dist/commands/send-signal.js +32 -18
  45. package/dist/commands/send-signal.js.map +2 -2
  46. package/dist/commands/type.d.ts +6 -6
  47. package/dist/commands/type.js +32 -18
  48. package/dist/commands/type.js.map +2 -2
  49. package/dist/commands/uninstall.d.ts +4 -4
  50. package/dist/commands/uninstall.js +521 -29
  51. package/dist/commands/uninstall.js.map +4 -4
  52. package/dist/commands/wait-for-exit.d.ts +6 -6
  53. package/dist/commands/wait-for-exit.js +32 -18
  54. package/dist/commands/wait-for-exit.js.map +2 -2
  55. package/dist/commands/wait-for.d.ts +10 -10
  56. package/dist/commands/wait-for.js +32 -18
  57. package/dist/commands/wait-for.js.map +2 -2
  58. package/dist/testing/cli-repl.js +2993 -774
  59. package/dist/testing/cli-repl.js.map +4 -4
  60. package/dist/testing/qa-cli.js +3017 -798
  61. package/dist/testing/qa-cli.js.map +4 -4
  62. package/package.json +1 -4
@@ -1,10 +1,10 @@
1
1
  import { type TerminalPilotCommandServices } from "./runtime.js";
2
- export declare const sendSignal: import("toolcraft").Command<TerminalPilotCommandServices, import("toolcraft-schema").ObjectSchema<{
3
- readonly signal: import("toolcraft-schema").StringSchema;
4
- readonly session: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
2
+ export declare const sendSignal: import("toolcraft").Command<TerminalPilotCommandServices, import("toolcraft").ObjectSchema<{
3
+ readonly signal: import("toolcraft").StringSchema;
4
+ readonly session: import("toolcraft").OptionalSchema<import("toolcraft").StringSchema>;
5
5
  }>, undefined, undefined> & {
6
- readonly __agentKitCommandTypeInfo: import("toolcraft").CommandTypeInfo<"send-signal", import("toolcraft-schema").ObjectSchema<{
7
- readonly signal: import("toolcraft-schema").StringSchema;
8
- readonly session: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
6
+ readonly __agentKitCommandTypeInfo: import("toolcraft").CommandTypeInfo<"send-signal", import("toolcraft").ObjectSchema<{
7
+ readonly signal: import("toolcraft").StringSchema;
8
+ readonly session: import("toolcraft").OptionalSchema<import("toolcraft").StringSchema>;
9
9
  }>, undefined, readonly ["cli", "mcp", "sdk"], undefined>;
10
10
  };
@@ -3,8 +3,8 @@ import { fileURLToPath as fileURLToPath2 } from "node:url";
3
3
 
4
4
  // ../toolcraft/src/user-error.ts
5
5
  var UserError = class extends Error {
6
- constructor(message) {
7
- super(message);
6
+ constructor(message, options) {
7
+ super(message, options);
8
8
  this.name = "UserError";
9
9
  }
10
10
  };
@@ -66,22 +66,33 @@ function Record(value) {
66
66
  function isOptionalSchema(schema) {
67
67
  return schema.kind === "optional";
68
68
  }
69
+ function getRequiredKeys(schema) {
70
+ return Object.keys(schema.shape).filter((key) => !isOptionalSchema(schema.shape[key])).sort();
71
+ }
69
72
  function getRequiredKeyFingerprint(schema) {
70
- const requiredKeys = Object.keys(schema.shape).filter((key) => !isOptionalSchema(schema.shape[key])).sort();
71
- return JSON.stringify(requiredKeys);
73
+ return getRequiredKeys(schema).join("+");
74
+ }
75
+ function assertUniqueRequiredKeyFingerprints(branches) {
76
+ const fingerprints = /* @__PURE__ */ new Map();
77
+ branches.forEach((branch, index) => {
78
+ const fingerprint = getRequiredKeyFingerprint(branch);
79
+ const indices = fingerprints.get(fingerprint) ?? [];
80
+ indices.push(index);
81
+ fingerprints.set(fingerprint, indices);
82
+ });
83
+ for (const [fingerprint, indices] of fingerprints) {
84
+ if (indices.length > 1) {
85
+ throw new Error(
86
+ `Union branches [${indices.join(", ")}] share required-key fingerprint "${fingerprint}". Each branch must require a distinct set of keys.`
87
+ );
88
+ }
89
+ }
72
90
  }
73
91
  function assertValidBranches2(branches) {
74
92
  if (branches.length === 0) {
75
93
  throw new Error("Union schema requires at least one branch");
76
94
  }
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
- }
95
+ assertUniqueRequiredKeyFingerprints(branches);
85
96
  }
86
97
  function Union(branches) {
87
98
  assertValidBranches2(branches);
@@ -341,12 +352,15 @@ function materializeCommand(command, inherited) {
341
352
  }
342
353
  function defineCommand(config) {
343
354
  validateHumanInLoopOnDefine(config);
344
- return materializeCommand(createBaseCommand(config), {
345
- scope: void 0,
346
- humanInLoop: void 0,
347
- secrets: {},
348
- requires: void 0
349
- });
355
+ return materializeCommand(
356
+ createBaseCommand(config),
357
+ {
358
+ scope: void 0,
359
+ humanInLoop: void 0,
360
+ secrets: {},
361
+ requires: void 0
362
+ }
363
+ );
350
364
  }
351
365
 
352
366
  // src/terminal-pilot.ts