symbiot 0.31.0 → 0.32.0
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/index.mjs +20 -0
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1666,6 +1666,26 @@ async function cmdApp() {
|
|
|
1666
1666
|
let TOKEN = cfg0.appToken;
|
|
1667
1667
|
if (!TOKEN) { TOKEN = randomBytes(16).toString("hex"); try { saveConfig({ ...loadConfig(), appToken: TOKEN }); } catch {} }
|
|
1668
1668
|
const PORT = Number(process.env.SYMBIOT_PORT || cfg0.appPort) || 7391;
|
|
1669
|
+
// Single instance: if a Symbiot app is already serving this port, don't start
|
|
1670
|
+
// a second one (multiple instances race the config and split the open tabs) —
|
|
1671
|
+
// just open the one that's running. SYMBIOT_FORCE_NEW overrides (e.g. tests).
|
|
1672
|
+
if (!process.env.SYMBIOT_FORCE_NEW) {
|
|
1673
|
+
try {
|
|
1674
|
+
const ctrl = new AbortController(); const to = setTimeout(() => ctrl.abort(), 800);
|
|
1675
|
+
const r = await fetch(`http://127.0.0.1:${PORT}/api/ping`, { headers: { "x-symbiot-token": TOKEN }, signal: ctrl.signal }).catch(() => null);
|
|
1676
|
+
clearTimeout(to);
|
|
1677
|
+
if (r && r.ok) {
|
|
1678
|
+
const p = await r.json().catch(() => ({}));
|
|
1679
|
+
if (p && p.version) {
|
|
1680
|
+
const url = `http://127.0.0.1:${PORT}/?t=${TOKEN}`; const how = openApp(url);
|
|
1681
|
+
console.log(`\n${c.g("●")} ${c.b("Symbiot")} is already running (v${p.version}) at ${c.b(url)}`);
|
|
1682
|
+
console.log(how ? c.d(` Opened the existing window (a ${how}).`) : c.d(" Open that URL in your browser."));
|
|
1683
|
+
console.log(c.d(" (Not starting a second copy. Set SYMBIOT_FORCE_NEW=1 to force one.)"));
|
|
1684
|
+
return;
|
|
1685
|
+
}
|
|
1686
|
+
}
|
|
1687
|
+
} catch {}
|
|
1688
|
+
}
|
|
1669
1689
|
const json = (res, obj) => { res.writeHead(200, { "content-type": "application/json" }); res.end(JSON.stringify(obj)); };
|
|
1670
1690
|
const server = createServer(async (req, res) => {
|
|
1671
1691
|
const u = new URL(req.url, "http://127.0.0.1");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "symbiot",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.32.0",
|
|
4
4
|
"description": "Your week, written from your real work. Reads your local git and writes it up with the AI of your choice — Claude, OpenAI, Gemini, or a local model.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|