@tumnel/codex 0.1.2 → 0.1.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/README.md CHANGED
@@ -10,13 +10,13 @@ with the same experience as the OpenCode connector: sessions, streaming turns, t
10
10
  The standard setup command prepares the host identity and starts the connector:
11
11
 
12
12
  ```sh
13
- npx @tumnel/codex@0.1.2 install
13
+ npx @tumnel/codex@0.1.3 install
14
14
  ```
15
15
 
16
16
  `connect` remains available as an explicit alias:
17
17
 
18
18
  ```sh
19
- npx @tumnel/codex@0.1.2 connect
19
+ npx @tumnel/codex@0.1.3 connect
20
20
  ```
21
21
 
22
22
  The connector starts the Codex agent bridge and keeps it connected to the Tumnel relay until
package/dist/cli.js CHANGED
@@ -1504,7 +1504,7 @@ var TumnelBridgeClient = class {
1504
1504
  version: BRIDGE_PROTOCOL_VERSION,
1505
1505
  type: "device.hello",
1506
1506
  clientId: this.identity.deviceId,
1507
- agentVersion: "0.1.1",
1507
+ agentVersion: "0.1.3",
1508
1508
  connectorId: "codex"
1509
1509
  };
1510
1510
  socket.send(encodeBridgeMessage(hello));
@@ -1812,6 +1812,13 @@ async function createCodexConnector(options = {}) {
1812
1812
  }
1813
1813
 
1814
1814
  // src/cli.ts
1815
+ var waitForTumnelConnector = async (bridge, timeoutMs = 15e3) => {
1816
+ const deadline = Date.now() + timeoutMs;
1817
+ while (bridge.state !== "connected" && Date.now() < deadline) {
1818
+ await new Promise((resolve) => setTimeout(resolve, 100));
1819
+ }
1820
+ return bridge.state === "connected";
1821
+ };
1815
1822
  var printHelp = () => {
1816
1823
  console.log(`Tumnel connector for Codex
1817
1824
 
@@ -1892,14 +1899,23 @@ var run = async () => {
1892
1899
  flag("--relay-url");
1893
1900
  flag("--sandbox");
1894
1901
  flag("--approval-policy");
1895
- if (command === "install") {
1896
- console.log("Tumnel Codex connector is installed and ready.");
1897
- }
1902
+ const packageJson = JSON.parse(
1903
+ await import("fs/promises").then(
1904
+ ({ readFile: readFile3 }) => readFile3(new URL("../package.json", import.meta.url), "utf8")
1905
+ )
1906
+ );
1907
+ if (command === "install") console.log(`Installed @tumnel/codex@${packageJson.version}`);
1898
1908
  const connector = await createCodexConnector({ config });
1899
1909
  const port = connector.pairingServer?.port;
1900
- console.log("Tumnel Codex connector started");
1910
+ console.log("Starting Tumnel Codex connector...");
1901
1911
  console.log(` Device ID: ${connector.bridge.deviceId}`);
1902
1912
  if (port) console.log(` Pairing port: http://127.0.0.1:${port}`);
1913
+ console.log("Waiting for the Tumnel connector...");
1914
+ if (await waitForTumnelConnector(connector.bridge)) {
1915
+ console.log("Tumnel connected.");
1916
+ } else {
1917
+ console.log("Tumnel connector started; waiting for the relay in background.");
1918
+ }
1903
1919
  console.log("Press Ctrl+C to stop.\n");
1904
1920
  let stopping = false;
1905
1921
  const stop = async () => {