@tumnel/codex 0.1.1 → 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 +10 -2
- package/dist/cli.js +30 -6
- package/dist/cli.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,10 +5,18 @@ Standalone connector that bridges the Codex CLI agent to Tumnel web clients. It
|
|
|
5
5
|
through the Tumnel bridge protocol, and lets Tumnel web clients build and control Codex threads
|
|
6
6
|
with the same experience as the OpenCode connector: sessions, streaming turns, tools, and pairing.
|
|
7
7
|
|
|
8
|
-
##
|
|
8
|
+
## Install and run the connector
|
|
9
|
+
|
|
10
|
+
The standard setup command prepares the host identity and starts the connector:
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
npx @tumnel/codex@0.1.3 install
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
`connect` remains available as an explicit alias:
|
|
9
17
|
|
|
10
18
|
```sh
|
|
11
|
-
npx @tumnel/codex connect
|
|
19
|
+
npx @tumnel/codex@0.1.3 connect
|
|
12
20
|
```
|
|
13
21
|
|
|
14
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.
|
|
1507
|
+
agentVersion: "0.1.3",
|
|
1508
1508
|
connectorId: "codex"
|
|
1509
1509
|
};
|
|
1510
1510
|
socket.send(encodeBridgeMessage(hello));
|
|
@@ -1812,11 +1812,23 @@ 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
|
|
|
1818
1825
|
Usage:
|
|
1819
|
-
tumnel-codex [options]
|
|
1826
|
+
tumnel-codex install [options]
|
|
1827
|
+
tumnel-codex connect [options]
|
|
1828
|
+
|
|
1829
|
+
The install command is the standard one-command setup for Codex. It prepares the
|
|
1830
|
+
Tumnel identity and starts the connector. The connect command remains available
|
|
1831
|
+
as an explicit alias.
|
|
1820
1832
|
|
|
1821
1833
|
Options:
|
|
1822
1834
|
--model <model> Codex model id (e.g. gpt-5-mini)
|
|
@@ -1845,7 +1857,7 @@ var printVersion = async () => {
|
|
|
1845
1857
|
console.log(`@tumnel/codex ${version}`);
|
|
1846
1858
|
};
|
|
1847
1859
|
var run = async () => {
|
|
1848
|
-
const command = process.argv[2] ?? "
|
|
1860
|
+
const command = process.argv[2] ?? "install";
|
|
1849
1861
|
if (command === "--help" || command === "-h" || command === "help") {
|
|
1850
1862
|
printHelp();
|
|
1851
1863
|
return;
|
|
@@ -1854,10 +1866,10 @@ var run = async () => {
|
|
|
1854
1866
|
printVersion();
|
|
1855
1867
|
return;
|
|
1856
1868
|
}
|
|
1857
|
-
if (command !== "connect" && !command.startsWith("-")) {
|
|
1869
|
+
if (command !== "install" && command !== "connect" && !command.startsWith("-")) {
|
|
1858
1870
|
throw new Error(`Unknown command: ${command}`);
|
|
1859
1871
|
}
|
|
1860
|
-
const args = command === "connect" ? process.argv.slice(3) : process.argv.slice(2);
|
|
1872
|
+
const args = command === "install" || command === "connect" ? process.argv.slice(3) : process.argv.slice(2);
|
|
1861
1873
|
if (args.includes("--help") || args.includes("-h")) {
|
|
1862
1874
|
printHelp();
|
|
1863
1875
|
return;
|
|
@@ -1887,11 +1899,23 @@ var run = async () => {
|
|
|
1887
1899
|
flag("--relay-url");
|
|
1888
1900
|
flag("--sandbox");
|
|
1889
1901
|
flag("--approval-policy");
|
|
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}`);
|
|
1890
1908
|
const connector = await createCodexConnector({ config });
|
|
1891
1909
|
const port = connector.pairingServer?.port;
|
|
1892
|
-
console.log("Tumnel Codex connector
|
|
1910
|
+
console.log("Starting Tumnel Codex connector...");
|
|
1893
1911
|
console.log(` Device ID: ${connector.bridge.deviceId}`);
|
|
1894
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
|
+
}
|
|
1895
1919
|
console.log("Press Ctrl+C to stop.\n");
|
|
1896
1920
|
let stopping = false;
|
|
1897
1921
|
const stop = async () => {
|