terminal-pilot 0.0.46 → 0.0.47

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 (33) hide show
  1. package/dist/cli.js +43 -13
  2. package/dist/cli.js.map +4 -4
  3. package/dist/commands/close-session.js.map +1 -1
  4. package/dist/commands/create-session.js.map +1 -1
  5. package/dist/commands/daemon-runtime.js.map +1 -1
  6. package/dist/commands/fill.js.map +1 -1
  7. package/dist/commands/get-session.js.map +1 -1
  8. package/dist/commands/index.js.map +1 -1
  9. package/dist/commands/install.js.map +1 -1
  10. package/dist/commands/installer.js.map +1 -1
  11. package/dist/commands/list-sessions.js.map +1 -1
  12. package/dist/commands/press-key.js.map +1 -1
  13. package/dist/commands/read-history.js.map +1 -1
  14. package/dist/commands/read-screen.js.map +1 -1
  15. package/dist/commands/resize.js.map +1 -1
  16. package/dist/commands/runtime.js.map +1 -1
  17. package/dist/commands/screenshot.js.map +1 -1
  18. package/dist/commands/send-signal.js.map +1 -1
  19. package/dist/commands/type.js.map +1 -1
  20. package/dist/commands/uninstall.js.map +1 -1
  21. package/dist/commands/wait-for-exit.js.map +1 -1
  22. package/dist/commands/wait-for.js.map +1 -1
  23. package/dist/composition.json +1 -1
  24. package/dist/testing/cli-repl.js +43 -13
  25. package/dist/testing/cli-repl.js.map +4 -4
  26. package/dist/testing/qa-cli.js +43 -13
  27. package/dist/testing/qa-cli.js.map +4 -4
  28. package/node_modules/@poe-code/agent-defs/package.json +0 -2
  29. package/node_modules/@poe-code/agent-skill-config/package.json +0 -2
  30. package/node_modules/@poe-code/config-mutations/package.json +0 -2
  31. package/node_modules/@poe-code/frontmatter/package.json +0 -2
  32. package/node_modules/toolcraft-design/package.json +0 -2
  33. package/package.json +3 -3
@@ -53,7 +53,7 @@
53
53
  },
54
54
  {
55
55
  "name": "terminal-pilot",
56
- "version": "0.0.46",
56
+ "version": "0.0.47",
57
57
  "license": "MIT"
58
58
  },
59
59
  {
@@ -4813,6 +4813,41 @@ async function writeErrorReport(context) {
4813
4813
  };
4814
4814
  }
4815
4815
 
4816
+ // ../toolcraft/src/human-in-loop/wiring.ts
4817
+ var WIRING_HINT = 'pass { humanInLoop: createHumanInLoop({ provider, ... }) } from "toolcraft/human-in-loop"';
4818
+ function assertHumanInLoopWired(root, humanInLoop) {
4819
+ if (humanInLoop !== void 0) {
4820
+ return;
4821
+ }
4822
+ const commandPath = findHumanInLoopCommandPath(root, []);
4823
+ if (commandPath !== void 0) {
4824
+ throw new UserError(
4825
+ `command '${commandPath}' declares humanInLoop but no runtime is wired \u2014 ${WIRING_HINT}`
4826
+ );
4827
+ }
4828
+ }
4829
+ function mergeApprovalsRoot(root, options) {
4830
+ if (options.approvals !== true) {
4831
+ return root;
4832
+ }
4833
+ if (options.humanInLoop === void 0) {
4834
+ throw new UserError(`approvals: true requires a wired humanInLoop runtime \u2014 ${WIRING_HINT}`);
4835
+ }
4836
+ return options.humanInLoop.mergeApprovalsGroup(root);
4837
+ }
4838
+ function findHumanInLoopCommandPath(node, path17) {
4839
+ if (node.kind === "command") {
4840
+ return node.humanInLoop ? path17.join(".") || node.name : void 0;
4841
+ }
4842
+ for (const child of node.children) {
4843
+ const found = findHumanInLoopCommandPath(child, [...path17, child.name]);
4844
+ if (found !== void 0) {
4845
+ return found;
4846
+ }
4847
+ }
4848
+ return void 0;
4849
+ }
4850
+
4816
4851
  // ../toolcraft/src/number-schema.ts
4817
4852
  function isValidNumberSchemaValue(value, schema) {
4818
4853
  return typeof value === "number" && Number.isFinite(value) && (schema.jsonType !== "integer" || Number.isInteger(value)) && (schema.minimum === void 0 || value >= schema.minimum) && (schema.maximum === void 0 || value <= schema.maximum);
@@ -5461,8 +5496,6 @@ function validateServices(services) {
5461
5496
  configureTheme({ brand: "blue", label: "Toolcraft" });
5462
5497
  var NULL_OPTION_VALUE = /* @__PURE__ */ Symbol("toolcraft.cli.null");
5463
5498
  var optionalModulePaths = {
5464
- approvals: "./human-in-loop/approvals-commands.js",
5465
- humanInLoop: "./human-in-loop/gate.js",
5466
5499
  mcpProxy: "./mcp-proxy.js"
5467
5500
  };
5468
5501
  function importOptionalModule(specifier) {
@@ -8530,7 +8563,7 @@ function getResolvedFlags(command) {
8530
8563
  const flags = command.optsWithGlobals();
8531
8564
  return flags;
8532
8565
  }
8533
- async function executeCommand(state, services, requirementOptions, runtimeFetch, runtimeOptions, runtimeEnv, runtimeFs, outputEmitter, outputFormats, promptStreams, diagnosticsOptions, onErrorReportContext) {
8566
+ async function executeCommand(state, services, requirementOptions, runtimeFetch, humanInLoop, runtimeEnv, runtimeFs, outputEmitter, outputFormats, promptStreams, diagnosticsOptions, onErrorReportContext) {
8534
8567
  const logger2 = createLogger(outputEmitter);
8535
8568
  const optionValues = state.actionCommand.optsWithGlobals();
8536
8569
  const resolvedFlags = optionValues;
@@ -8681,9 +8714,7 @@ async function executeCommand(state, services, requirementOptions, runtimeFetch,
8681
8714
  throw new UserError("Operation cancelled.");
8682
8715
  }
8683
8716
  }
8684
- const result = state.command.humanInLoop ? await (await importOptionalModule(
8685
- optionalModulePaths.humanInLoop
8686
- )).invokeWithHumanInLoop(state.command, context, runtimeOptions, state.commandPath) : await state.command.handler(context);
8717
+ const result = state.command.humanInLoop && humanInLoop !== void 0 ? await humanInLoop.invoke(state.command, context, state.commandPath) : await state.command.handler(context);
8687
8718
  if (output === "rich" && runtime.isFixture) {
8688
8719
  writeRichHeader(`${state.command.name} (fixture)`);
8689
8720
  }
@@ -9269,20 +9300,19 @@ async function runCLI(roots, options = {}) {
9269
9300
  let errorReportContext;
9270
9301
  try {
9271
9302
  const normalizedRoot = normalizeRoots(roots, argv);
9272
- const root = options.approvals === true ? (await importOptionalModule(
9273
- optionalModulePaths.approvals
9274
- )).mergeApprovalsGroup(normalizedRoot) : normalizedRoot;
9303
+ const root = mergeApprovalsRoot(normalizedRoot, options);
9304
+ assertHumanInLoopWired(root, options.humanInLoop);
9275
9305
  if (hasMcpProxyConfig(root)) {
9276
9306
  await (await importOptionalModule(optionalModulePaths.mcpProxy)).resolveMcpProxies(root, { projectRoot: options.projectRoot });
9277
9307
  }
9278
9308
  const casing = options.casing ?? "kebab";
9279
9309
  const services = options.services ?? {};
9280
- const runtimeOptions = options.humanInLoop ?? {};
9310
+ const humanInLoop = options.humanInLoop;
9281
9311
  const runtimeFetch = options.fetch ?? globalThis.fetch;
9282
9312
  version = options.version ?? findEntrypointPackageMetadata(argv[1])?.version;
9283
9313
  const servicesWithBuiltIns = {
9284
9314
  ...services,
9285
- runtimeOptions,
9315
+ humanInLoop,
9286
9316
  root
9287
9317
  };
9288
9318
  const requirementOptions = {
@@ -9328,7 +9358,7 @@ async function runCLI(roots, options = {}) {
9328
9358
  servicesWithBuiltIns,
9329
9359
  requirementOptions,
9330
9360
  runtimeFetch,
9331
- runtimeOptions,
9361
+ humanInLoop,
9332
9362
  options.env,
9333
9363
  options.fs,
9334
9364
  options.outputEmitter,
@@ -14743,7 +14773,7 @@ function sleep2(ms) {
14743
14773
  // src/cli.ts
14744
14774
  configureTheme({ brand: "green", label: "Terminal Pilot" });
14745
14775
  function getBundledPackageVersion() {
14746
- return true ? "0.0.46" : void 0;
14776
+ return true ? "0.0.47" : void 0;
14747
14777
  }
14748
14778
  function normalizeArgv(argv) {
14749
14779
  if (argv.includes("--json") && !argv.some((argument) => argument === "--output" || argument.startsWith("--output="))) {