trismegistus 1.1.4 → 1.1.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.
Files changed (2) hide show
  1. package/dist/cli.js +7 -13
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -634,10 +634,11 @@ function startTunnel(name, options = {}) {
634
634
  )
635
635
  );
636
636
  }
637
+ const safeName = name.replace(/[^\w-=]/g, "").slice(0, 50) || "tmg-tunnel";
637
638
  return new Promise((resolve, reject) => {
638
639
  const child = spawn2(
639
640
  "code",
640
- ["tunnel", "--name", name, "--accept-server-license-terms"],
641
+ ["tunnel", "--name", safeName, "--accept-server-license-terms"],
641
642
  { stdio: ["ignore", "pipe", "pipe"] }
642
643
  );
643
644
  let stderr = "";
@@ -655,17 +656,8 @@ function startTunnel(name, options = {}) {
655
656
  ${stderr}` : `Timed out waiting for tunnel URL. You may need to authenticate \u2014 run \`code tunnel\` manually first.`;
656
657
  settle(() => reject(new Error(msg)));
657
658
  }, TIMEOUT_MS);
658
- child.stderr?.on("data", (chunk) => {
659
- const text = chunk.toString();
660
- stderr += text;
661
- if (options.onOutput) {
662
- for (const line of text.split("\n").filter(Boolean)) {
663
- options.onOutput(line);
664
- }
665
- }
666
- });
667
- child.stdout?.on("data", (chunk) => {
668
- const text = chunk.toString();
659
+ function handleOutput(text, isStderr) {
660
+ if (isStderr) stderr += text;
669
661
  if (options.onOutput) {
670
662
  for (const line of text.split("\n").filter(Boolean)) {
671
663
  options.onOutput(line);
@@ -676,7 +668,9 @@ ${stderr}` : `Timed out waiting for tunnel URL. You may need to authenticate \u2
676
668
  clearTimeout(timer);
677
669
  settle(() => resolve({ url: match[1], process: child }));
678
670
  }
679
- });
671
+ }
672
+ child.stderr?.on("data", (chunk) => handleOutput(chunk.toString(), true));
673
+ child.stdout?.on("data", (chunk) => handleOutput(chunk.toString(), false));
680
674
  child.on("error", (err) => {
681
675
  clearTimeout(timer);
682
676
  settle(() => reject(err));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trismegistus",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
4
4
  "description": "A local persistent daemon that runs AI sessions from a task queue, with mobile support.",
5
5
  "type": "module",
6
6
  "bin": {