devwing 0.1.17 → 0.1.19

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.
package/dist/index.js CHANGED
@@ -2693,19 +2693,16 @@ async function showToolCall(tool, args) {
2693
2693
  console.log(chalk7.yellow(` ${icon} ${chalk7.bold(tool)}`) + chalk7.dim(" \u2014 requires permission"));
2694
2694
  if (args) console.log(chalk7.dim(` ${args}`));
2695
2695
  console.log();
2696
- const readline2 = await import('readline');
2697
- const rl = readline2.createInterface({ input: process.stdin, output: process.stdout });
2698
- const label = tool === "write_file" ? `Write ${args}?` : tool === "run_command" ? `Run command: ${chalk7.cyan(args)}?` : tool === "git_commit" ? `Create git commit?` : tool === "delete_file" ? `Delete ${args}?` : `Execute ${tool}?`;
2699
- const answer = await new Promise((resolve) => {
2700
- rl.question(
2701
- ` ${chalk7.bold.yellow("DevWing")} wants to ${chalk7.white(label)} ${chalk7.dim("(y/N) ")}`,
2702
- (ans) => {
2703
- rl.close();
2704
- resolve(ans.trim().toLowerCase());
2705
- }
2706
- );
2707
- });
2708
- if (answer !== "y" && answer !== "yes") {
2696
+ const label = tool === "write_file" ? `Write ${args}` : tool === "run_command" ? `Run: ${args}` : tool === "git_commit" ? `Create git commit` : tool === "delete_file" ? `Delete ${args}` : `Execute ${tool}`;
2697
+ const { allowed } = await inquirer5.prompt([
2698
+ {
2699
+ type: "confirm",
2700
+ name: "allowed",
2701
+ message: `${chalk7.bold.yellow("DevWing")} wants to ${chalk7.white(label)}`,
2702
+ default: true
2703
+ }
2704
+ ]);
2705
+ if (!allowed) {
2709
2706
  console.log(chalk7.dim(" \u2717 Skipped"));
2710
2707
  throw Object.assign(new Error("TOOL_SKIPPED"), { skipped: true });
2711
2708
  }
@@ -2778,7 +2775,7 @@ function getVersion() {
2778
2775
  continue;
2779
2776
  }
2780
2777
  }
2781
- return "0.1.17";
2778
+ return "0.1.19";
2782
2779
  }
2783
2780
  var DEMO_USER2 = {
2784
2781
  id: "usr_a1b2c3d4-e5f6-7890-abcd-ef1234567890",
@@ -2908,6 +2905,22 @@ var InteractiveSession = class {
2908
2905
  }
2909
2906
  });
2910
2907
  }
2908
+ resetStdin() {
2909
+ try {
2910
+ if (process.stdin.isPaused()) {
2911
+ process.stdin.resume();
2912
+ }
2913
+ process.stdin.removeAllListeners("keypress");
2914
+ process.stdin.removeAllListeners("data");
2915
+ if (typeof process.stdin.setRawMode === "function") {
2916
+ try {
2917
+ process.stdin.setRawMode(false);
2918
+ } catch {
2919
+ }
2920
+ }
2921
+ } catch {
2922
+ }
2923
+ }
2911
2924
  recreateReadline() {
2912
2925
  this.createReadline();
2913
2926
  this.rl.prompt();
@@ -3059,6 +3072,7 @@ var InteractiveSession = class {
3059
3072
  } catch (error) {
3060
3073
  logger.error(error.message || "Command failed");
3061
3074
  }
3075
+ this.resetStdin();
3062
3076
  this.recreateReadline();
3063
3077
  }
3064
3078
  // ============================================================
@@ -3072,16 +3086,19 @@ var InteractiveSession = class {
3072
3086
  }
3073
3087
  console.log();
3074
3088
  if (this.isDemo) {
3075
- this.rl.pause();
3089
+ this.isBusy = true;
3090
+ this.rl.close();
3076
3091
  try {
3077
3092
  await demoPromptCommand(input, { ...this.options, mode: this.currentMode });
3078
- } finally {
3079
- this.rl.resume();
3093
+ this.conversationHistory.push(
3094
+ { role: "user", content: input, timestamp: /* @__PURE__ */ new Date() },
3095
+ { role: "assistant", content: "[demo response]", timestamp: /* @__PURE__ */ new Date() }
3096
+ );
3097
+ } catch (error) {
3098
+ logger.error(error.message || "Command failed");
3080
3099
  }
3081
- this.conversationHistory.push(
3082
- { role: "user", content: input, timestamp: /* @__PURE__ */ new Date() },
3083
- { role: "assistant", content: "[demo response]", timestamp: /* @__PURE__ */ new Date() }
3084
- );
3100
+ this.resetStdin();
3101
+ this.recreateReadline();
3085
3102
  return;
3086
3103
  }
3087
3104
  if (!this.sessionContext) {