oc-phone-link 2.4.1 → 2.4.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/CHANGELOG.md +14 -1
- package/README.md +12 -1
- package/assets/icon.svg +8 -0
- package/beacon.mjs +20 -5
- package/index.js +7 -10
- package/package.json +8 -6
package/CHANGELOG.md
CHANGED
|
@@ -9,7 +9,7 @@ are attributed to the app repository's own changelog
|
|
|
9
9
|
|
|
10
10
|
## [Unreleased]
|
|
11
11
|
|
|
12
|
-
## [2.4.
|
|
12
|
+
## [2.4.3] - 2026-11-30
|
|
13
13
|
|
|
14
14
|
Ships with the 2.4.0 app. The app and beacon must be upgraded together.
|
|
15
15
|
|
|
@@ -54,6 +54,19 @@ Proof: `node --test beacon.test.mjs` EXIT 0 — 42 tests, 42 pass, 0 fail
|
|
|
54
54
|
unrelated `packages/janua` MCP conformance timeout; the `oc-phone-link`
|
|
55
55
|
workspace portion passes 37/37.
|
|
56
56
|
|
|
57
|
+
On-device verification (2026-11-29): the owner installed the 2.4.0 app APK
|
|
58
|
+
attached to the `oc-phone-link@2.4.1` release (asset sha256
|
|
59
|
+
`2550d7bea6b10966f52d9fa2b271a98cf2735c7f018e88b9a2c1c5120d3009ed`) on a
|
|
60
|
+
phone and confirmed it paired and worked against the 2.4.1 server. This is the
|
|
61
|
+
first on-device evidence for this pairing; every earlier report had on-device
|
|
62
|
+
behaviour unverified.
|
|
63
|
+
|
|
64
|
+
## [2.4.2] - 2026-11-30
|
|
65
|
+
|
|
66
|
+
### Changed
|
|
67
|
+
|
|
68
|
+
- Documentation only: the README now leads with the official `opencode plugin add` command, keeps the config-array route as an alternative, and states the Windows and macOS/Linux config paths once each. No runtime behaviour changed.
|
|
69
|
+
|
|
57
70
|
## 2.3.3
|
|
58
71
|
|
|
59
72
|
- Tagged as `oc-phone-link@2.3.3` (commit `680ff40`) and published as npm
|
package/README.md
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
<p align="center"><img src="https://raw.githubusercontent.com/nathwn12/oc-collections/main/packages/oc-phone-link/assets/icon.svg" width="120" height="120" alt="oc-phone-link icon" /></p>
|
|
1
2
|
<h1 align="center">oc-phone-link</h1>
|
|
2
3
|
|
|
3
4
|
<p align="center"><strong>Drive OpenCode from an Android phone on the same Wi-Fi: in-server beacon, pinned TLS, one PIN, no tray, no QR.</strong></p>
|
|
@@ -10,12 +11,22 @@
|
|
|
10
11
|
|
|
11
12
|
## Install
|
|
12
13
|
|
|
13
|
-
Install the published [oc-phone-link plugin](https://www.npmjs.com/package/oc-phone-link)
|
|
14
|
+
Install the published [oc-phone-link plugin](https://www.npmjs.com/package/oc-phone-link) with the official OpenCode command, then restart OpenCode:
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
opencode plugin add oc-phone-link
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Or add the plugin to your config yourself:
|
|
14
21
|
|
|
15
22
|
```json
|
|
16
23
|
{ "plugins": ["oc-phone-link"] }
|
|
17
24
|
```
|
|
18
25
|
|
|
26
|
+
Config file: `%USERPROFILE%\.config\opencode\opencode.jsonc` on Windows or `~/.config/opencode/opencode.jsonc` on macOS/Linux.
|
|
27
|
+
|
|
28
|
+
Inside config values OpenCode also substitutes `{env:USERPROFILE}` (Windows) and `{env:HOME}` (macOS/Linux) — config-string syntax, not shell syntax.
|
|
29
|
+
|
|
19
30
|
There is no version pin here on purpose: npm's published version changes on every release of this package, so the install line stays true after the next publish. The PC plugin and Android app use separate version numbers. The plugin starts the beacon during setup and stops it when the session disposes. There is no tray app, no separate service and no QR code: the beacon is a keyed reverse proxy in front of the OpenCode server your PC already runs.
|
|
20
31
|
|
|
21
32
|
## Upgrading from 2.2.0 or 2.3.x
|
package/assets/icon.svg
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
|
2
|
+
<rect x="16" y="16" width="480" height="480" rx="112" fill="#0B0F14"/>
|
|
3
|
+
<rect x="64" y="128" width="232" height="176" rx="28" fill="#EEF3F6"/>
|
|
4
|
+
<rect x="88" y="328" width="184" height="16" rx="8" fill="#EEF3F6"/>
|
|
5
|
+
<rect x="296" y="160" width="128" height="240" rx="28" fill="#4DD4E8"/>
|
|
6
|
+
<path d="M296,256 H350" stroke="#0B0F14" stroke-width="16" stroke-linecap="round"/>
|
|
7
|
+
<circle cx="180" cy="216" r="28" fill="#4DD4E8"/>
|
|
8
|
+
</svg>
|
package/beacon.mjs
CHANGED
|
@@ -922,7 +922,11 @@ function proxy(req, res) {
|
|
|
922
922
|
req.pipe(upstream);
|
|
923
923
|
}
|
|
924
924
|
|
|
925
|
-
function upgradeProxy(req, clientSocket, head) {
|
|
925
|
+
function upgradeProxy(req, clientSocket, head, sockets) {
|
|
926
|
+
if (sockets) {
|
|
927
|
+
sockets.add(clientSocket);
|
|
928
|
+
clientSocket.once("close", () => sockets.delete(clientSocket));
|
|
929
|
+
}
|
|
926
930
|
let why = "pin";
|
|
927
931
|
try { why = gate(req); } catch (e) { why = "pin"; }
|
|
928
932
|
if (why) {
|
|
@@ -943,6 +947,10 @@ function upgradeProxy(req, clientSocket, head) {
|
|
|
943
947
|
return k + ": " + v + "\r\n";
|
|
944
948
|
}).join("");
|
|
945
949
|
const upstream = connect({ host: "127.0.0.1", port: port() });
|
|
950
|
+
if (sockets) {
|
|
951
|
+
sockets.add(upstream);
|
|
952
|
+
upstream.once("close", () => sockets.delete(upstream));
|
|
953
|
+
}
|
|
946
954
|
let replied = false;
|
|
947
955
|
upstream.on("connect", () => {
|
|
948
956
|
try {
|
|
@@ -1370,10 +1378,11 @@ export function startBeacon(opts) {
|
|
|
1370
1378
|
const proxyServer = createHttpsServer({ key: tls.key, cert: tls.cert }, (req, res) => proxy(req, res));
|
|
1371
1379
|
proxyServer.requestTimeout = 0;
|
|
1372
1380
|
proxyServer.headersTimeout = 60000;
|
|
1373
|
-
proxyServer.on("upgrade", (req, socket, head) => upgradeProxy(req, socket, head));
|
|
1381
|
+
proxyServer.on("upgrade", (req, socket, head) => upgradeProxy(req, socket, head, upgradeSockets));
|
|
1374
1382
|
const loopback = createHttpServer((req, res) => { handleLoopback(req, res); });
|
|
1375
1383
|
|
|
1376
1384
|
const servers = [];
|
|
1385
|
+
const upgradeSockets = new Set();
|
|
1377
1386
|
const retryTimers = new Set();
|
|
1378
1387
|
let stopping = false;
|
|
1379
1388
|
const listen = (srv, portNum, host, tag) => {
|
|
@@ -1381,7 +1390,7 @@ export function startBeacon(opts) {
|
|
|
1381
1390
|
let retry = null;
|
|
1382
1391
|
let tracked = false;
|
|
1383
1392
|
srv.on("listening", () => {
|
|
1384
|
-
if (stopping) { try { srv.close(); } catch {} return; }
|
|
1393
|
+
if (stopping) { try { srv.closeAllConnections(); } catch {} try { srv.close(); } catch {} return; }
|
|
1385
1394
|
wait = 2000;
|
|
1386
1395
|
if (!tracked) { tracked = true; servers.push(srv); }
|
|
1387
1396
|
log(tag + " listening", portNum);
|
|
@@ -1417,7 +1426,7 @@ export function startBeacon(opts) {
|
|
|
1417
1426
|
const exposed = createHttpServer((req, res) => { handleAgent(req, res, { exposed: true }); });
|
|
1418
1427
|
let exposedTracked = false;
|
|
1419
1428
|
exposed.on("listening", () => {
|
|
1420
|
-
if (stopping) { try { exposed.close(); } catch {} return; }
|
|
1429
|
+
if (stopping) { try { exposed.closeAllConnections(); } catch {} try { exposed.close(); } catch {} return; }
|
|
1421
1430
|
if (!exposedTracked) { exposedTracked = true; servers.push(exposed); }
|
|
1422
1431
|
});
|
|
1423
1432
|
exposed.on("error", (e) => log("exposed listener unavailable", e.code || e.message));
|
|
@@ -1446,7 +1455,13 @@ export function startBeacon(opts) {
|
|
|
1446
1455
|
clearInterval(announce);
|
|
1447
1456
|
clearInterval(aliveTimer);
|
|
1448
1457
|
try { if (udp) udp.close(); } catch {}
|
|
1449
|
-
for (const
|
|
1458
|
+
for (const sock of upgradeSockets) { try { sock.destroy(); } catch {} }
|
|
1459
|
+
upgradeSockets.clear();
|
|
1460
|
+
try { agent.destroy(); } catch {}
|
|
1461
|
+
for (const srv of servers) {
|
|
1462
|
+
try { srv.closeAllConnections(); } catch {}
|
|
1463
|
+
try { srv.close(); } catch {}
|
|
1464
|
+
}
|
|
1450
1465
|
if (globalThis[Symbol.for("oc-phone-link.beacon")] === stop) globalThis[Symbol.for("oc-phone-link.beacon")] = null;
|
|
1451
1466
|
log("beacon stopped");
|
|
1452
1467
|
};
|
package/index.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { Plugin } from "@opencode/plugin";
|
|
2
2
|
import { startBeacon } from "./beacon.mjs";
|
|
3
3
|
|
|
4
|
-
let stop = null;
|
|
5
|
-
|
|
6
4
|
function portFrom(ctx) {
|
|
7
5
|
const raw = ctx && (ctx.port ?? ctx.server?.port ?? ctx.server?.url);
|
|
8
6
|
if (typeof raw === "number" && Number.isFinite(raw) && raw > 0) return raw;
|
|
@@ -21,14 +19,13 @@ function portFrom(ctx) {
|
|
|
21
19
|
export default Plugin.define({
|
|
22
20
|
id: "oc-phone-link",
|
|
23
21
|
setup(ctx) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
22
|
+
let stop = null;
|
|
23
|
+
try {
|
|
24
|
+
const port = portFrom(ctx);
|
|
25
|
+
stop = startBeacon(port ? { port } : {}) || null;
|
|
26
|
+
} catch (e) {
|
|
27
|
+
console.error("oc-phone-link: beacon failed to start:", e?.message || e);
|
|
28
|
+
stop = null;
|
|
32
29
|
}
|
|
33
30
|
return () => {
|
|
34
31
|
if (stop) { stop(); stop = null; }
|
package/package.json
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oc-phone-link",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.3",
|
|
4
4
|
"description": "Drive OpenCode from an Android phone on the same Wi-Fi: in-server beacon, pinned TLS, one PIN, no tray, no QR.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "nathwn12",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"opencode",
|
|
9
9
|
"opencode-plugin",
|
|
10
|
-
"plugin",
|
|
10
|
+
"opencode-plugin-local",
|
|
11
|
+
"ai-agent",
|
|
12
|
+
"ai-coding-agent",
|
|
11
13
|
"android",
|
|
12
|
-
"
|
|
13
|
-
"remote",
|
|
14
|
+
"remote-control",
|
|
14
15
|
"beacon",
|
|
15
|
-
"
|
|
16
|
+
"phone"
|
|
16
17
|
],
|
|
17
18
|
"engines": {
|
|
18
19
|
"node": ">=22"
|
|
@@ -35,7 +36,8 @@
|
|
|
35
36
|
"whitelist.json",
|
|
36
37
|
"README.md",
|
|
37
38
|
"LICENSE",
|
|
38
|
-
"CHANGELOG.md"
|
|
39
|
+
"CHANGELOG.md",
|
|
40
|
+
"assets"
|
|
39
41
|
],
|
|
40
42
|
"scripts": {
|
|
41
43
|
"test": "node --test beacon.test.mjs"
|