draw2agent 2.0.3 → 2.0.5

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
@@ -13837,9 +13837,6 @@ function clearState() {
13837
13837
  function setProxyInfo(url2) {
13838
13838
  proxyInfo = { running: true, url: url2 };
13839
13839
  }
13840
- function clearProxyInfo() {
13841
- proxyInfo = { running: false, url: "" };
13842
- }
13843
13840
  function getProxyInfo() {
13844
13841
  return proxyInfo;
13845
13842
  }
@@ -13978,8 +13975,8 @@ function startHttpServer(targetUrl, port) {
13978
13975
  server.on("upgrade", (req, socket, head) => {
13979
13976
  proxy.ws(req, socket, head);
13980
13977
  });
13981
- server.listen(port, () => {
13982
- const proxyUrl = `http://localhost:${port}`;
13978
+ server.listen(port, "127.0.0.1", () => {
13979
+ const proxyUrl = `http://127.0.0.1:${port}`;
13983
13980
  console.error(`[draw2agent] \u{1F680} Proxy running at ${proxyUrl} \u2192 ${targetUrl}`);
13984
13981
  resolve(proxyUrl);
13985
13982
  });
@@ -13988,12 +13985,6 @@ function startHttpServer(targetUrl, port) {
13988
13985
  });
13989
13986
  });
13990
13987
  }
13991
- function stopHttpServer() {
13992
- if (server) {
13993
- server.close();
13994
- server = null;
13995
- }
13996
- }
13997
13988
 
13998
13989
  // src/scratch-server.ts
13999
13990
  import http2 from "http";
@@ -14136,8 +14127,8 @@ function startScratchServer(port) {
14136
14127
  res.writeHead(404, { "Content-Type": "text/plain" });
14137
14128
  res.end("Not found");
14138
14129
  });
14139
- scratchServer.listen(port, () => {
14140
- const url2 = `http://localhost:${port}`;
14130
+ scratchServer.listen(port, "127.0.0.1", () => {
14131
+ const url2 = `http://127.0.0.1:${port}`;
14141
14132
  console.error(`[draw2agent] \u{1F3A8} Scratch whiteboard at ${url2}`);
14142
14133
  resolve(url2);
14143
14134
  });
@@ -14146,19 +14137,13 @@ function startScratchServer(port) {
14146
14137
  });
14147
14138
  });
14148
14139
  }
14149
- function stopScratchServer() {
14150
- if (scratchServer) {
14151
- scratchServer.close();
14152
- scratchServer = null;
14153
- }
14154
- }
14155
14140
 
14156
14141
  // src/tunnel.ts
14157
14142
  import localtunnel from "localtunnel";
14158
14143
  var activeTunnel = null;
14159
14144
  async function startTunnel(localPort) {
14160
14145
  await stopTunnel();
14161
- const tunnel = await localtunnel({ port: localPort });
14146
+ const tunnel = await localtunnel({ port: localPort, local_host: "127.0.0.1" });
14162
14147
  tunnel.on("close", () => {
14163
14148
  console.error("[draw2agent] \u{1F50C} Tunnel closed");
14164
14149
  activeTunnel = null;
@@ -14231,11 +14216,7 @@ function handleToolError(err, toolName) {
14231
14216
  );
14232
14217
  customInstructions = customInstructions.replace(/launch_canvas/g, toolName);
14233
14218
  isErrorResult = false;
14234
- stopHttpServer();
14235
- stopScratchServer();
14236
14219
  stopTunnel();
14237
- clearProxyInfo();
14238
- } else {
14239
14220
  customInstructions = readPromptFile(ERROR_INSTRUCTIONS_PATH, customInstructions).replace("{{ERROR_MESSAGE}}", message);
14240
14221
  }
14241
14222
  return {