@venturewild/workspace 0.1.8 → 0.1.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@venturewild/workspace",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "Claude Code Web — Replit/Lovable-style chat-first browser UI that wraps the AI agent already installed on your machine.",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -684,6 +684,24 @@ async function main() {
684
684
  return;
685
685
  }
686
686
 
687
+ // If a workspace server is already serving this port — always-on started it at
688
+ // login, or another `wild-workspace` is running — don't fight it for the socket
689
+ // (createServer would reject on EADDRINUSE and crash). Just open the browser to
690
+ // the one already up. This is the common case now that always-on is real.
691
+ {
692
+ const probeCfg = buildConfig(opts);
693
+ if (await probeHealth(probeCfg.port)) {
694
+ const host = probeCfg.host === '0.0.0.0' ? '127.0.0.1' : probeCfg.host;
695
+ const url = `http://${host}:${probeCfg.port}`;
696
+ console.log(`\n wild-workspace is already running at ${url}`);
697
+ if (probeCfg.openBrowser) {
698
+ console.log(' opening it in your browser…');
699
+ try { const open = (await import('open')).default; await open(url); } catch { /* best-effort */ }
700
+ }
701
+ return;
702
+ }
703
+ }
704
+
687
705
  const server = await createServer(opts);
688
706
  const { config } = server;
689
707
  console.log(`\n wild-workspace v${APP_VERSION}`);
@@ -581,18 +581,16 @@ export async function createServer(overrides = {}) {
581
581
 
582
582
  // In-app "Sign in to Claude" — drives `claude auth login` in a real PTY so the
583
583
  // browser OAuth callback auto-completes and the user never touches a terminal.
584
- // (See agent-login.mjs.) Degrades to `{status:'unsupported'}` if node-pty is
585
- // absent, and the gate falls back to the terminal instruction. The OAuth URL is
586
- // opened on this machine the server runs locally, so it's the user's browser.
584
+ // (See agent-login.mjs.) Claude opens the OAuth URL in the user's browser itself
585
+ // (the server is local), so we do NOT open it again here doing so spawned a
586
+ // duplicate tab; the UI surfaces the captured URL as a "didn't open?" fallback.
587
+ // Degrades to `{status:'unsupported'}` if node-pty is absent (gate → terminal).
587
588
  let _loginSession = null;
588
- const openUrl = async (u) => {
589
- try { const open = (await import('open')).default; await open(u); } catch { /* best-effort */ }
590
- };
591
589
  const emptyLoginSnap = { status: 'idle', url: null, error: null, verdict: null };
592
590
  app.post('/api/agent/login/start', async (c) => {
593
591
  const forbidden = require(c, 'chatWrite');
594
592
  if (forbidden) return forbidden;
595
- if (!_loginSession) _loginSession = new ClaudeLoginSession({ agent: activeAgent, openImpl: openUrl });
593
+ if (!_loginSession) _loginSession = new ClaudeLoginSession({ agent: activeAgent });
596
594
  _loginSession.agent = activeAgent; // track the active agent if it changed
597
595
  const snap = await _loginSession.start();
598
596
  _readinessCache = null; // a sign-in is about to change auth state — don't serve stale