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,20 +1,20 @@
1
1
  import type { TerminalPilotCommandServices } from "./runtime.js";
2
- export declare const install: import("@poe-code/cmdkit").Command<TerminalPilotCommandServices, import("@poe-code/cmdkit-schema").ObjectSchema<{
3
- readonly agent: import("@poe-code/cmdkit-schema").EnumSchema<[string, ...string[]]>;
4
- readonly local: import("@poe-code/cmdkit-schema").OptionalSchema<import("@poe-code/cmdkit-schema").BooleanSchema>;
5
- readonly global: import("@poe-code/cmdkit-schema").OptionalSchema<import("@poe-code/cmdkit-schema").BooleanSchema>;
2
+ export declare const install: import("toolcraft").Command<TerminalPilotCommandServices, import("toolcraft-schema").ObjectSchema<{
3
+ readonly agent: import("toolcraft-schema").EnumSchema<[string, ...string[]]>;
4
+ readonly local: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").BooleanSchema>;
5
+ readonly global: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").BooleanSchema>;
6
6
  }>, undefined, {
7
7
  agent: string;
8
8
  scope: "local" | "global";
9
9
  skillPath: string;
10
10
  }> & {
11
- readonly __cmdkitCommandTypeInfo: import("@poe-code/cmdkit").CommandTypeInfo<"install", import("@poe-code/cmdkit-schema").ObjectSchema<{
12
- readonly agent: import("@poe-code/cmdkit-schema").EnumSchema<[string, ...string[]]>;
13
- readonly local: import("@poe-code/cmdkit-schema").OptionalSchema<import("@poe-code/cmdkit-schema").BooleanSchema>;
14
- readonly global: import("@poe-code/cmdkit-schema").OptionalSchema<import("@poe-code/cmdkit-schema").BooleanSchema>;
11
+ readonly __agentKitCommandTypeInfo: import("toolcraft").CommandTypeInfo<"install", import("toolcraft-schema").ObjectSchema<{
12
+ readonly agent: import("toolcraft-schema").EnumSchema<[string, ...string[]]>;
13
+ readonly local: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").BooleanSchema>;
14
+ readonly global: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").BooleanSchema>;
15
15
  }>, {
16
16
  agent: string;
17
17
  scope: "local" | "global";
18
18
  skillPath: string;
19
- }, readonly ["cli"]>;
19
+ }, readonly ["cli"], undefined>;
20
20
  };
@@ -1235,10 +1235,100 @@ async function installSkill(agentId, skill, options) {
1235
1235
  return { skillPath: skillFilePath, displayPath };
1236
1236
  }
1237
1237
 
1238
- // ../cmdkit/src/index.ts
1238
+ // ../toolcraft/src/index.ts
1239
1239
  import { fileURLToPath as fileURLToPath2 } from "node:url";
1240
1240
 
1241
- // ../cmdkit-schema/src/index.ts
1241
+ // ../toolcraft/src/user-error.ts
1242
+ var UserError = class extends Error {
1243
+ constructor(message) {
1244
+ super(message);
1245
+ this.name = "UserError";
1246
+ }
1247
+ };
1248
+
1249
+ // ../toolcraft/src/human-in-loop/config.ts
1250
+ function validateHumanInLoopOnDefine(config) {
1251
+ const label = Array.isArray(config.children) ? "group" : "command";
1252
+ if (config.confirm === true && config.humanInLoop !== void 0 && config.humanInLoop !== null) {
1253
+ throw new Error(`${label} '${config.name}': use either confirm or humanInLoop, not both`);
1254
+ }
1255
+ if (config.humanInLoop === void 0 || config.humanInLoop === null) {
1256
+ return;
1257
+ }
1258
+ if (config.humanInLoop.mode !== "sync" && config.humanInLoop.mode !== "async") {
1259
+ throw new Error(`${label} '${config.name}': humanInLoop.mode must be "sync" or "async"`);
1260
+ }
1261
+ if (typeof config.humanInLoop.message !== "function") {
1262
+ throw new Error(`${label} '${config.name}': humanInLoop.message must be a function`);
1263
+ }
1264
+ }
1265
+ function mergeHumanInLoopFromGroup(groupHumanInLoop, childHumanInLoop) {
1266
+ if (childHumanInLoop !== void 0) {
1267
+ return childHumanInLoop;
1268
+ }
1269
+ return groupHumanInLoop;
1270
+ }
1271
+
1272
+ // ../toolcraft-schema/src/json.ts
1273
+ function Json() {
1274
+ return {
1275
+ kind: "json"
1276
+ };
1277
+ }
1278
+
1279
+ // ../toolcraft-schema/src/oneof.ts
1280
+ function assertValidBranches(branches) {
1281
+ if (Object.keys(branches).length === 0) {
1282
+ throw new Error("OneOf schema requires at least one branch");
1283
+ }
1284
+ }
1285
+ function OneOf(config) {
1286
+ assertValidBranches(config.branches);
1287
+ return {
1288
+ kind: "oneOf",
1289
+ discriminator: config.discriminator,
1290
+ branches: config.branches
1291
+ };
1292
+ }
1293
+
1294
+ // ../toolcraft-schema/src/record.ts
1295
+ function Record(value) {
1296
+ return {
1297
+ kind: "record",
1298
+ value
1299
+ };
1300
+ }
1301
+
1302
+ // ../toolcraft-schema/src/union.ts
1303
+ function isOptionalSchema(schema) {
1304
+ return schema.kind === "optional";
1305
+ }
1306
+ function getRequiredKeyFingerprint(schema) {
1307
+ const requiredKeys = Object.keys(schema.shape).filter((key) => !isOptionalSchema(schema.shape[key])).sort();
1308
+ return JSON.stringify(requiredKeys);
1309
+ }
1310
+ function assertValidBranches2(branches) {
1311
+ if (branches.length === 0) {
1312
+ throw new Error("Union schema requires at least one branch");
1313
+ }
1314
+ const fingerprints = /* @__PURE__ */ new Set();
1315
+ for (const branch of branches) {
1316
+ const fingerprint = getRequiredKeyFingerprint(branch);
1317
+ if (fingerprints.has(fingerprint)) {
1318
+ throw new Error("Union schema branches must have unique required-key fingerprints");
1319
+ }
1320
+ fingerprints.add(fingerprint);
1321
+ }
1322
+ }
1323
+ function Union(branches) {
1324
+ assertValidBranches2(branches);
1325
+ return {
1326
+ kind: "union",
1327
+ branches
1328
+ };
1329
+ }
1330
+
1331
+ // ../toolcraft-schema/src/index.ts
1242
1332
  function assertValidEnumValues(values) {
1243
1333
  if (values.length === 0) {
1244
1334
  throw new Error("Enum schema requires at least one value");
@@ -1294,18 +1384,16 @@ var S = {
1294
1384
  kind: "optional",
1295
1385
  inner
1296
1386
  };
1297
- }
1387
+ },
1388
+ OneOf,
1389
+ Union,
1390
+ Record,
1391
+ Json
1298
1392
  };
1299
1393
 
1300
- // ../cmdkit/src/index.ts
1301
- var commandConfigSymbol = /* @__PURE__ */ Symbol("cmdkit.command.config");
1302
- var commandSourcePathSymbol = /* @__PURE__ */ Symbol("cmdkit.command.sourcePath");
1303
- var UserError = class extends Error {
1304
- constructor(message) {
1305
- super(message);
1306
- this.name = "UserError";
1307
- }
1308
- };
1394
+ // ../toolcraft/src/index.ts
1395
+ var commandConfigSymbol = /* @__PURE__ */ Symbol("toolcraft.command.config");
1396
+ var commandSourcePathSymbol = /* @__PURE__ */ Symbol("toolcraft.command.sourcePath");
1309
1397
  function cloneScope(scope) {
1310
1398
  return scope === void 0 ? void 0 : [...scope];
1311
1399
  }
@@ -1377,7 +1465,7 @@ function inferCommandSourcePath() {
1377
1465
  if (candidate === void 0) {
1378
1466
  continue;
1379
1467
  }
1380
- if (candidate.includes("/packages/cmdkit/src/index.ts") || candidate.includes("/packages/cmdkit/dist/index.js")) {
1468
+ if (candidate.includes("/packages/toolcraft/src/index.ts") || candidate.includes("/packages/toolcraft/dist/index.js") || candidate.includes("/node_modules/toolcraft/dist/index.js")) {
1381
1469
  continue;
1382
1470
  }
1383
1471
  return candidate;
@@ -1433,6 +1521,7 @@ function createBaseCommand(config) {
1433
1521
  secrets: cloneSecrets(config.secrets),
1434
1522
  scope: resolveCommandScope(config.scope, void 0),
1435
1523
  confirm: config.confirm ?? false,
1524
+ humanInLoop: config.humanInLoop,
1436
1525
  requires: cloneRequires(config.requires),
1437
1526
  handler: config.handler,
1438
1527
  render: config.render
@@ -1440,6 +1529,7 @@ function createBaseCommand(config) {
1440
1529
  Object.defineProperty(command, commandConfigSymbol, {
1441
1530
  value: {
1442
1531
  scope: cloneScope(config.scope),
1532
+ humanInLoop: config.humanInLoop,
1443
1533
  secrets: cloneSecrets(config.secrets),
1444
1534
  requires: cloneRequires(config.requires),
1445
1535
  sourcePath: inferCommandSourcePath()
@@ -1462,6 +1552,7 @@ function materializeCommand(command, inherited) {
1462
1552
  secrets: mergeSecrets(inherited.secrets, internal.secrets),
1463
1553
  scope: resolveCommandScope(internal.scope, inherited.scope),
1464
1554
  confirm: command.confirm,
1555
+ humanInLoop: mergeHumanInLoopFromGroup(inherited.humanInLoop, internal.humanInLoop),
1465
1556
  requires: mergeRequires(inherited.requires, internal.requires),
1466
1557
  handler: command.handler,
1467
1558
  render: command.render
@@ -1469,6 +1560,7 @@ function materializeCommand(command, inherited) {
1469
1560
  Object.defineProperty(materialized, commandConfigSymbol, {
1470
1561
  value: {
1471
1562
  scope: cloneScope(internal.scope),
1563
+ humanInLoop: internal.humanInLoop,
1472
1564
  secrets: cloneSecrets(internal.secrets),
1473
1565
  requires: cloneRequires(internal.requires),
1474
1566
  sourcePath: internal.sourcePath
@@ -1480,8 +1572,10 @@ function materializeCommand(command, inherited) {
1480
1572
  return materialized;
1481
1573
  }
1482
1574
  function defineCommand(config) {
1575
+ validateHumanInLoopOnDefine(config);
1483
1576
  return materializeCommand(createBaseCommand(config), {
1484
1577
  scope: void 0,
1578
+ humanInLoop: void 0,
1485
1579
  secrets: {},
1486
1580
  requires: void 0
1487
1581
  });