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
package/dist/cli.js CHANGED
@@ -4737,6 +4737,41 @@ async function writeErrorReport(context) {
4737
4737
  };
4738
4738
  }
4739
4739
 
4740
+ // ../toolcraft/src/human-in-loop/wiring.ts
4741
+ var WIRING_HINT = 'pass { humanInLoop: createHumanInLoop({ provider, ... }) } from "toolcraft/human-in-loop"';
4742
+ function assertHumanInLoopWired(root, humanInLoop) {
4743
+ if (humanInLoop !== void 0) {
4744
+ return;
4745
+ }
4746
+ const commandPath = findHumanInLoopCommandPath(root, []);
4747
+ if (commandPath !== void 0) {
4748
+ throw new UserError(
4749
+ `command '${commandPath}' declares humanInLoop but no runtime is wired \u2014 ${WIRING_HINT}`
4750
+ );
4751
+ }
4752
+ }
4753
+ function mergeApprovalsRoot(root, options) {
4754
+ if (options.approvals !== true) {
4755
+ return root;
4756
+ }
4757
+ if (options.humanInLoop === void 0) {
4758
+ throw new UserError(`approvals: true requires a wired humanInLoop runtime \u2014 ${WIRING_HINT}`);
4759
+ }
4760
+ return options.humanInLoop.mergeApprovalsGroup(root);
4761
+ }
4762
+ function findHumanInLoopCommandPath(node, path16) {
4763
+ if (node.kind === "command") {
4764
+ return node.humanInLoop ? path16.join(".") || node.name : void 0;
4765
+ }
4766
+ for (const child of node.children) {
4767
+ const found = findHumanInLoopCommandPath(child, [...path16, child.name]);
4768
+ if (found !== void 0) {
4769
+ return found;
4770
+ }
4771
+ }
4772
+ return void 0;
4773
+ }
4774
+
4740
4775
  // ../toolcraft/src/number-schema.ts
4741
4776
  function isValidNumberSchemaValue(value, schema) {
4742
4777
  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);
@@ -5385,8 +5420,6 @@ function validateServices(services) {
5385
5420
  configureTheme({ brand: "blue", label: "Toolcraft" });
5386
5421
  var NULL_OPTION_VALUE = /* @__PURE__ */ Symbol("toolcraft.cli.null");
5387
5422
  var optionalModulePaths = {
5388
- approvals: "./human-in-loop/approvals-commands.js",
5389
- humanInLoop: "./human-in-loop/gate.js",
5390
5423
  mcpProxy: "./mcp-proxy.js"
5391
5424
  };
5392
5425
  function importOptionalModule(specifier) {
@@ -8454,7 +8487,7 @@ function getResolvedFlags(command) {
8454
8487
  const flags = command.optsWithGlobals();
8455
8488
  return flags;
8456
8489
  }
8457
- async function executeCommand(state, services, requirementOptions, runtimeFetch, runtimeOptions, runtimeEnv, runtimeFs, outputEmitter, outputFormats, promptStreams, diagnosticsOptions, onErrorReportContext) {
8490
+ async function executeCommand(state, services, requirementOptions, runtimeFetch, humanInLoop, runtimeEnv, runtimeFs, outputEmitter, outputFormats, promptStreams, diagnosticsOptions, onErrorReportContext) {
8458
8491
  const logger2 = createLogger(outputEmitter);
8459
8492
  const optionValues = state.actionCommand.optsWithGlobals();
8460
8493
  const resolvedFlags = optionValues;
@@ -8605,9 +8638,7 @@ async function executeCommand(state, services, requirementOptions, runtimeFetch,
8605
8638
  throw new UserError("Operation cancelled.");
8606
8639
  }
8607
8640
  }
8608
- const result = state.command.humanInLoop ? await (await importOptionalModule(
8609
- optionalModulePaths.humanInLoop
8610
- )).invokeWithHumanInLoop(state.command, context, runtimeOptions, state.commandPath) : await state.command.handler(context);
8641
+ const result = state.command.humanInLoop && humanInLoop !== void 0 ? await humanInLoop.invoke(state.command, context, state.commandPath) : await state.command.handler(context);
8611
8642
  if (output === "rich" && runtime.isFixture) {
8612
8643
  writeRichHeader(`${state.command.name} (fixture)`);
8613
8644
  }
@@ -9193,20 +9224,19 @@ async function runCLI(roots, options = {}) {
9193
9224
  let errorReportContext;
9194
9225
  try {
9195
9226
  const normalizedRoot = normalizeRoots(roots, argv);
9196
- const root = options.approvals === true ? (await importOptionalModule(
9197
- optionalModulePaths.approvals
9198
- )).mergeApprovalsGroup(normalizedRoot) : normalizedRoot;
9227
+ const root = mergeApprovalsRoot(normalizedRoot, options);
9228
+ assertHumanInLoopWired(root, options.humanInLoop);
9199
9229
  if (hasMcpProxyConfig(root)) {
9200
9230
  await (await importOptionalModule(optionalModulePaths.mcpProxy)).resolveMcpProxies(root, { projectRoot: options.projectRoot });
9201
9231
  }
9202
9232
  const casing = options.casing ?? "kebab";
9203
9233
  const services = options.services ?? {};
9204
- const runtimeOptions = options.humanInLoop ?? {};
9234
+ const humanInLoop = options.humanInLoop;
9205
9235
  const runtimeFetch = options.fetch ?? globalThis.fetch;
9206
9236
  version = options.version ?? findEntrypointPackageMetadata(argv[1])?.version;
9207
9237
  const servicesWithBuiltIns = {
9208
9238
  ...services,
9209
- runtimeOptions,
9239
+ humanInLoop,
9210
9240
  root
9211
9241
  };
9212
9242
  const requirementOptions = {
@@ -9252,7 +9282,7 @@ async function runCLI(roots, options = {}) {
9252
9282
  servicesWithBuiltIns,
9253
9283
  requirementOptions,
9254
9284
  runtimeFetch,
9255
- runtimeOptions,
9285
+ humanInLoop,
9256
9286
  options.env,
9257
9287
  options.fs,
9258
9288
  options.outputEmitter,
@@ -14740,7 +14770,7 @@ function sleep2(ms) {
14740
14770
  // src/cli.ts
14741
14771
  configureTheme({ brand: "green", label: "Terminal Pilot" });
14742
14772
  function getBundledPackageVersion() {
14743
- return true ? "0.0.46" : void 0;
14773
+ return true ? "0.0.47" : void 0;
14744
14774
  }
14745
14775
  function normalizeArgv(argv) {
14746
14776
  if (argv.includes("--json") && !argv.some((argument) => argument === "--output" || argument.startsWith("--output="))) {