@getmonoceros/workbench 1.21.2 → 1.21.3

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/bin.js CHANGED
@@ -4967,6 +4967,13 @@ function generateAgentsMd(input) {
4967
4967
  }
4968
4968
  }
4969
4969
  lines.push("");
4970
+ lines.push(
4971
+ "To show the user a running app, open it in their host browser with",
4972
+ `\`xdg-open http://${input.containerName}.localhost\` \u2014 Monoceros relays`,
4973
+ "browser-opens from the container to the host machine. Also tell the user",
4974
+ "the URL, so they can open it themselves if no bridge is active."
4975
+ );
4976
+ lines.push("");
4970
4977
  }
4971
4978
  lines.push("## How to extend this container");
4972
4979
  lines.push("");
@@ -6699,7 +6706,7 @@ var CLI_VERSION;
6699
6706
  var init_version = __esm({
6700
6707
  "src/version.ts"() {
6701
6708
  "use strict";
6702
- CLI_VERSION = true ? "1.21.2" : "dev";
6709
+ CLI_VERSION = true ? "1.21.3" : "dev";
6703
6710
  }
6704
6711
  });
6705
6712
 
@@ -9011,6 +9018,10 @@ function parseCallbackTarget(authUrl) {
9011
9018
  return null;
9012
9019
  }
9013
9020
  }
9021
+ function nextRelayUrl(content, lastOpened) {
9022
+ const url = content.trim();
9023
+ return url && url !== lastOpened ? url : null;
9024
+ }
9014
9025
  function openInBrowser(url) {
9015
9026
  const platform = process.platform;
9016
9027
  const [cmd, args] = platform === "darwin" ? ["open", [url]] : platform === "win32" ? ["cmd", ["/c", "start", "", url]] : ["xdg-open", [url]];
@@ -9041,7 +9052,7 @@ exit 0
9041
9052
  );
9042
9053
  await fsp4.chmod(relayScript, 493);
9043
9054
  const servers = [];
9044
- let handled = false;
9055
+ let lastOpened = null;
9045
9056
  const onUrl = (url) => {
9046
9057
  openInBrowser(url);
9047
9058
  const target = parseCallbackTarget(url);
@@ -9072,16 +9083,17 @@ exit 0
9072
9083
  servers.push(server);
9073
9084
  };
9074
9085
  const poll = setInterval(() => {
9075
- if (handled || !existsSync14(urlFile)) return;
9086
+ if (!existsSync14(urlFile)) return;
9076
9087
  let content = "";
9077
9088
  try {
9078
9089
  content = readFileSync6(urlFile, "utf8");
9079
9090
  } catch {
9080
9091
  return;
9081
9092
  }
9082
- if (!content.trim()) return;
9083
- handled = true;
9084
- onUrl(content.trim());
9093
+ const url = nextRelayUrl(content, lastOpened);
9094
+ if (!url) return;
9095
+ lastOpened = url;
9096
+ onUrl(url);
9085
9097
  }, 250);
9086
9098
  return {
9087
9099
  relayDirInContainer: `/workspaces/${opts.name}/${RELAY_DIRNAME}`,