devwing 0.1.9 → 0.1.11

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
@@ -2128,7 +2128,7 @@ var DEMO_WORKSPACE = {
2128
2128
  name: "Kano State Government",
2129
2129
  plan: "enterprise"};
2130
2130
  var DEMO_PROJECT = {
2131
- name: "Kano Smart API"};
2131
+ name: "Tallon SaaS ERP"};
2132
2132
  var DEMO_MEMORIES = [
2133
2133
  { id: "mem_001", type: "rule", content: "All API responses must include Hausa language support", created_at: "2026-03-01T10:00:00Z" },
2134
2134
  { id: "mem_002", type: "context", content: "Auth uses JWT with RS256 signing, 1hr expiry, refresh tokens in Redis", created_at: "2026-03-05T14:00:00Z" },
@@ -2176,7 +2176,6 @@ async function demoLoginCommand() {
2176
2176
  } catch (error) {
2177
2177
  logger.error("Login failed");
2178
2178
  if (error.message) logger.error(error.message);
2179
- process.exit(1);
2180
2179
  }
2181
2180
  }
2182
2181
  async function demoLoginEmail() {
@@ -2752,28 +2751,29 @@ async function showUsage(tokensIn, tokensOut, cost, mode) {
2752
2751
  async function requireDemoAuth() {
2753
2752
  const apiKey = await configManager.getApiKey();
2754
2753
  if (!apiKey) {
2755
- logger.error('Not authenticated. Run "devwing login" first.');
2756
- process.exit(1);
2754
+ throw new Error('Not authenticated. Run "devwing login" or type /login first.');
2757
2755
  }
2758
2756
  }
2759
2757
  function isDemoMode() {
2760
2758
  return process.env.DEVWING_DEMO === "1" || process.env.DEVWING_DEMO === "true";
2761
2759
  }
2762
- var __filename3 = fileURLToPath(import.meta.url);
2763
- var __dirname3 = dirname(__filename3);
2760
+ var __sessionFile = fileURLToPath(import.meta.url);
2761
+ var __sessionDir = dirname(__sessionFile);
2764
2762
  function getVersion() {
2765
2763
  const paths = [
2766
- join(__dirname3, "../../package.json"),
2767
- join(__dirname3, "../../../package.json")
2764
+ join(__sessionDir, "../package.json"),
2765
+ join(__sessionDir, "../../package.json"),
2766
+ join(__sessionDir, "../../../package.json")
2768
2767
  ];
2769
2768
  for (const p of paths) {
2770
2769
  try {
2771
- return JSON.parse(readFileSync(p, "utf-8")).version;
2770
+ const pkg = JSON.parse(readFileSync(p, "utf-8"));
2771
+ if (pkg.name === "devwing" && pkg.version) return pkg.version;
2772
2772
  } catch {
2773
2773
  continue;
2774
2774
  }
2775
2775
  }
2776
- return "0.1.8";
2776
+ return "0.1.10";
2777
2777
  }
2778
2778
  var DEMO_USER2 = {
2779
2779
  id: "usr_a1b2c3d4-e5f6-7890-abcd-ef1234567890",
@@ -2791,7 +2791,7 @@ var DEMO_WORKSPACE2 = {
2791
2791
  name: "Kano State Government",
2792
2792
  plan: "enterprise"};
2793
2793
  var DEMO_PROJECT2 = {
2794
- name: "Kano Smart API"};
2794
+ name: "Tallon SaaS ERP"};
2795
2795
  var DEMO_MODELS = [
2796
2796
  { name: "devwing-general-1", display_name: "DevWing General", domain: "general", status: "active", min_plan: "free", context_window: 32768, tokens_per_sec: 85, version: "1.0" },
2797
2797
  { name: "devwing-frontend-1", display_name: "DevWing Frontend", domain: "frontend", status: "active", min_plan: "pro", context_window: 32768, tokens_per_sec: 78, version: "1.0" },
@@ -2827,6 +2827,8 @@ var InteractiveSession = class {
2827
2827
  sigintCount = 0;
2828
2828
  sigintTimer = null;
2829
2829
  version;
2830
+ isBusy = false;
2831
+ // prevent readline events during command execution
2830
2832
  constructor(options) {
2831
2833
  this.options = options;
2832
2834
  this.isDemo = isDemoMode();
@@ -2843,6 +2845,15 @@ var InteractiveSession = class {
2843
2845
  this.printStartupBanner();
2844
2846
  await this.checkAuthStatus();
2845
2847
  this.printSystemInfo();
2848
+ this.createReadline();
2849
+ console.log();
2850
+ this.rl.prompt();
2851
+ }
2852
+ // ============================================================
2853
+ // READLINE MANAGEMENT
2854
+ // ============================================================
2855
+ createReadline() {
2856
+ this.isBusy = false;
2846
2857
  this.rl = readline.createInterface({
2847
2858
  input: process.stdin,
2848
2859
  output: process.stdout,
@@ -2861,28 +2872,39 @@ var InteractiveSession = class {
2861
2872
  }, 1500);
2862
2873
  this.rl.prompt();
2863
2874
  });
2875
+ const currentRl = this.rl;
2864
2876
  this.rl.on("line", async (input) => {
2877
+ if (this.isBusy) return;
2865
2878
  const trimmed = input.trim();
2866
2879
  if (!trimmed) {
2867
2880
  this.rl.prompt();
2868
2881
  return;
2869
2882
  }
2883
+ this.isBusy = true;
2870
2884
  try {
2871
2885
  if (trimmed.startsWith("/")) {
2872
2886
  await this.handleSlashCommand(trimmed);
2887
+ return;
2873
2888
  } else {
2874
2889
  await this.handleAIPrompt(trimmed);
2875
2890
  }
2876
2891
  } catch (error) {
2877
2892
  logger.error(error.message || "An error occurred");
2878
2893
  }
2879
- this.rl.setPrompt(this.buildPrompt());
2880
- this.rl.prompt();
2894
+ this.isBusy = false;
2895
+ if (this.rl === currentRl) {
2896
+ this.rl.setPrompt(this.buildPrompt());
2897
+ this.rl.prompt();
2898
+ }
2881
2899
  });
2882
2900
  this.rl.on("close", () => {
2883
- this.exitSession();
2901
+ if (!this.isBusy) {
2902
+ this.exitSession();
2903
+ }
2884
2904
  });
2885
- console.log();
2905
+ }
2906
+ recreateReadline() {
2907
+ this.createReadline();
2886
2908
  this.rl.prompt();
2887
2909
  }
2888
2910
  // ============================================================
@@ -3012,12 +3034,14 @@ var InteractiveSession = class {
3012
3034
  logger.warn("You need to be logged in for this command. Type /login first.");
3013
3035
  return;
3014
3036
  }
3015
- this.rl.pause();
3037
+ this.isBusy = true;
3038
+ this.rl.close();
3016
3039
  try {
3017
3040
  await command.handler(args);
3018
- } finally {
3019
- this.rl.resume();
3041
+ } catch (error) {
3042
+ logger.error(error.message || "Command failed");
3020
3043
  }
3044
+ this.recreateReadline();
3021
3045
  }
3022
3046
  // ============================================================
3023
3047
  // AI PROMPT HANDLER