@lifeaitools/clauth 1.5.71 → 1.5.74

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.
Files changed (2) hide show
  1. package/cli/commands/serve.js +36 -113
  2. package/package.json +1 -1
@@ -579,18 +579,12 @@ function dashboardHtml(port, whitelist, isStaged = false) {
579
579
  .build-label{font-size:.85rem;color:#94a3b8;flex:1}
580
580
  .build-label strong{color:#e2e8f0}
581
581
  .build-meta{font-family:'Courier New',monospace;font-size:.75rem;color:#64748b}
582
- .mcp-setup{background:#0f1d2d;border:1px solid #1e3a5f;border-radius:8px;padding:1rem 1.25rem;margin-bottom:1.25rem;display:none}
583
- .mcp-setup.open{display:block}
584
- .mcp-setup-title{font-size:.85rem;font-weight:600;color:#e2e8f0;margin-bottom:.75rem}
585
582
  .mcp-row{display:flex;align-items:center;gap:8px;margin-bottom:8px}
586
583
  .mcp-label{font-size:.72rem;color:#64748b;min-width:80px;text-transform:uppercase;letter-spacing:.5px;font-weight:600}
587
584
  .mcp-val{flex:1;font-family:'Courier New',monospace;font-size:.82rem;color:#60a5fa;background:#0a0f1a;border:1px solid #1e3a5f;border-radius:4px;padding:6px 10px;word-break:break-all;user-select:all}
588
585
  .mcp-copy{background:none;border:1px solid #334155;color:#94a3b8;border-radius:4px;padding:4px 8px;cursor:pointer;font-size:.75rem;font-family:'Courier New',monospace;transition:all .15s;flex-shrink:0}
589
586
  .mcp-copy:hover{border-color:#60a5fa;color:#60a5fa}
590
587
  .mcp-copy.ok{border-color:#4ade80;color:#4ade80}
591
- .btn-mcp-setup{background:#1e293b;color:#94a3b8;border:1px solid #334155;padding:6px 12px;font-size:.8rem;border-radius:6px;cursor:pointer;font-weight:500;transition:all .15s}
592
- .btn-mcp-setup:hover{border-color:#60a5fa;color:#60a5fa}
593
- .btn-mcp-setup:disabled{opacity:.4;cursor:not-allowed}
594
588
  .btn-add{background:#1a2e1a;color:#4ade80;border:1px solid #166534;padding:7px 16px;font-size:.85rem;border-radius:7px;cursor:pointer;font-weight:500;transition:all .15s}
595
589
  .btn-add:hover{background:#1a3d22;border-color:#4ade80}
596
590
  .add-panel{display:none;background:#1a1f2e;border:1px solid #334155;border-radius:8px;padding:1.25rem;margin-bottom:1.5rem}
@@ -620,7 +614,6 @@ function dashboardHtml(port, whitelist, isStaged = false) {
620
614
  .project-edit .pe-msg{font-size:.72rem;color:#4ade80}
621
615
  .btn-project{font-size:.68rem;color:#64748b;background:none;border:1px solid #1e293b;border-radius:3px;padding:2px 6px;cursor:pointer;transition:all .15s}
622
616
  .btn-project:hover{color:#3b82f6;border-color:#3b82f6}
623
- .btn-mcp-setup.open{border-color:#f59e0b;color:#f59e0b;background:#1a1500}
624
617
  .footer{margin-top:2rem;font-size:.75rem;color:#475569;text-align:center}
625
618
  .oauth-fields{display:flex;flex-direction:column;gap:8px;margin-bottom:8px}
626
619
  .oauth-field{display:flex;flex-direction:column;gap:3px}
@@ -837,7 +830,6 @@ function dashboardHtml(port, whitelist, isStaged = false) {
837
830
  <div class="tunnel-label"><strong>claude.ai MCP</strong> — <span class="tunnel-url"><a href="" target="_blank" id="tunnel-live-url"></a></span></div>
838
831
  <button class="btn-check" style="padding:6px 12px;font-size:.8rem" onclick="testTunnel()">Test</button>
839
832
  <button class="btn-claude" onclick="openClaude()">Connect claude.ai</button>
840
- <button class="btn-mcp-setup" id="btn-mcp-setup" onclick="toggleMcpSetup()">Setup MCP</button>
841
833
  <button class="btn-tunnel-stop" onclick="toggleTunnel('stop')">Stop</button>
842
834
  </div>
843
835
  <!-- error -->
@@ -854,35 +846,6 @@ function dashboardHtml(port, whitelist, isStaged = false) {
854
846
  </div>
855
847
  </div>
856
848
 
857
- <div class="mcp-setup" id="mcp-setup-panel">
858
- <div class="mcp-setup-title">claude.ai MCP Integration</div>
859
- <div class="oauth-fields">
860
- <div class="mcp-row">
861
- <span class="mcp-label">Clauth</span>
862
- <span class="mcp-val" id="mcp-url">—</span>
863
- <button class="mcp-copy" onclick="copyMcp('mcp-url')">copy</button>
864
- </div>
865
- <div class="mcp-row">
866
- <span class="mcp-label">GWS</span>
867
- <span class="mcp-val" id="mcp-gws-url">—</span>
868
- <button class="mcp-copy" onclick="copyMcp('mcp-gws-url')">copy</button>
869
- </div>
870
- <div class="mcp-row">
871
- <span class="mcp-label">Client ID</span>
872
- <span class="mcp-val" id="mcp-client-id">—</span>
873
- <button class="mcp-copy" onclick="copyMcp('mcp-client-id')">copy</button>
874
- </div>
875
- <div class="mcp-row">
876
- <span class="mcp-label">Secret</span>
877
- <span class="mcp-val" id="mcp-client-secret">—</span>
878
- <button class="mcp-copy" onclick="copyMcp('mcp-client-secret')">copy</button>
879
- </div>
880
- </div>
881
- <div style="display:flex;align-items:center;gap:8px;margin-top:6px">
882
- <div style="font-size:.72rem;color:#64748b">Paste into <a href="https://claude.ai/settings/integrations" target="_blank" style="color:#60a5fa">claude.ai → Integrations</a></div>
883
- <button class="mcp-copy" onclick="rollMcpCreds()" style="font-size:.7rem">Roll Credentials</button>
884
- </div>
885
- </div>
886
849
 
887
850
  <div class="wizard-panel" id="wizard-panel">
888
851
  <div class="wizard-header">
@@ -1886,12 +1849,6 @@ function renderTunnelPanel(status, url, error) {
1886
1849
  const liveUrlEl = document.getElementById("tunnel-live-url");
1887
1850
  if (liveUrlEl) { liveUrlEl.href = sseUrl; liveUrlEl.textContent = sseUrl; }
1888
1851
  }
1889
- // Close MCP setup panel when not live
1890
- if (status !== "live") {
1891
- document.getElementById("mcp-setup-panel").classList.remove("open");
1892
- const mcpBtn = document.getElementById("btn-mcp-setup");
1893
- if (mcpBtn) mcpBtn.classList.remove("open");
1894
- }
1895
1852
  }
1896
1853
 
1897
1854
  async function toggleTunnel(action) {
@@ -1949,47 +1906,6 @@ function openClaude() {
1949
1906
  });
1950
1907
  }
1951
1908
 
1952
- async function toggleMcpSetup() {
1953
- const panel = document.getElementById("mcp-setup-panel");
1954
- const btn = document.getElementById("btn-mcp-setup");
1955
- const isOpen = panel.classList.toggle("open");
1956
- btn.classList.toggle("open", isOpen);
1957
- btn.textContent = isOpen ? "Close MCP" : "Setup MCP";
1958
- if (isOpen) {
1959
- try {
1960
- const m = await fetch(BASE + "/mcp-setup").then(r => r.json());
1961
- document.getElementById("mcp-url").textContent = m.url || "(tunnel not running)";
1962
- document.getElementById("mcp-gws-url").textContent = m.gwsUrl || "(tunnel not running)";
1963
- document.getElementById("mcp-client-id").textContent = m.clientId || "—";
1964
- document.getElementById("mcp-client-secret").textContent = m.clientSecret || "—";
1965
- } catch {
1966
- document.getElementById("mcp-url").textContent = "(error fetching)";
1967
- document.getElementById("mcp-gws-url").textContent = "(error fetching)";
1968
- }
1969
- }
1970
- }
1971
-
1972
- function copyMcp(elId) {
1973
- const val = document.getElementById(elId).textContent;
1974
- if (!val || val === "—" || val.startsWith("(")) return;
1975
- const btn = document.getElementById(elId).nextElementSibling;
1976
- navigator.clipboard.writeText(val).then(() => {
1977
- btn.textContent = "ok";
1978
- btn.classList.add("ok");
1979
- setTimeout(() => { btn.textContent = "copy"; btn.classList.remove("ok"); }, 1500);
1980
- }).catch(() => {});
1981
- }
1982
-
1983
- async function rollMcpCreds() {
1984
- if (!confirm("Invalidate all OAuth tokens? Claude.ai connectors will need to re-authenticate.")) return;
1985
- try {
1986
- const resp = await fetch(BASE + "/roll-mcp-creds", { method: "POST" }).then(r => r.json());
1987
- if (resp.tokens_invalidated) {
1988
- alert("All OAuth clients and tokens invalidated. Claude.ai will re-register automatically on next connection.");
1989
- }
1990
- } catch(e) { alert("Failed: " + e.message); }
1991
- }
1992
-
1993
1909
  // ── Tunnel Setup Wizard ─────────────────────
1994
1910
  let wizStep = null;
1995
1911
  let wizData = {};
@@ -2341,44 +2257,37 @@ async function wizRunCreateTunnel() {
2341
2257
  // Step: MCP setup in claude.ai
2342
2258
  async function wizShowMcpSetup(hostname) {
2343
2259
  wizStep = "mcp_setup";
2344
- const clauthUrl = \`https://\${hostname}/clauth\`;
2345
- const gwsUrl = \`https://\${hostname}/gws\`;
2346
-
2347
- const mcpData = await apiFetch("/mcp-setup");
2260
+ const base = \`https://\${hostname}\`;
2348
2261
 
2349
2262
  renderWizBody(\`
2350
- <div class="wiz-desc">Add two MCP connectors in claude.ai one for Clauth, one for GWS:</div>
2263
+ <div class="wiz-desc">Tunnel is live. Add connectors in claude.ai Integrations.</div>
2351
2264
  <div style="display:flex;flex-direction:column;gap:8px;margin-top:10px">
2352
2265
  <div class="mcp-row">
2353
- <span class="mcp-label">Clauth URL</span>
2354
- <span class="mcp-val" id="wiz-mcp-url">\${clauthUrl}</span>
2266
+ <span class="mcp-label">Clauth</span>
2267
+ <span class="mcp-val" id="wiz-mcp-url">\${base}/clauth</span>
2355
2268
  <button class="mcp-copy" onclick="wizCopy('wiz-mcp-url',this)">copy</button>
2356
2269
  </div>
2357
2270
  <div class="mcp-row">
2358
- <span class="mcp-label">GWS URL</span>
2359
- <span class="mcp-val" id="wiz-mcp-gws">\${gwsUrl}</span>
2271
+ <span class="mcp-label">GWS</span>
2272
+ <span class="mcp-val" id="wiz-mcp-gws">\${base}/gws</span>
2360
2273
  <button class="mcp-copy" onclick="wizCopy('wiz-mcp-gws',this)">copy</button>
2361
2274
  </div>
2362
2275
  <div class="mcp-row">
2363
- <span class="mcp-label">Client ID</span>
2364
- <span class="mcp-val" id="wiz-mcp-cid">\${mcpData?.clientId || '(unlock required)'}</span>
2365
- <button class="mcp-copy" onclick="wizCopy('wiz-mcp-cid',this)">copy</button>
2276
+ <span class="mcp-label">FS</span>
2277
+ <span class="mcp-val" id="wiz-mcp-fs">\${base}/fs</span>
2278
+ <button class="mcp-copy" onclick="wizCopy('wiz-mcp-fs',this)">copy</button>
2366
2279
  </div>
2367
2280
  <div class="mcp-row">
2368
- <span class="mcp-label">Secret</span>
2369
- <span class="mcp-val" id="wiz-mcp-sec">\${mcpData?.clientSecret || '(unlock required)'}</span>
2370
- <button class="mcp-copy" onclick="wizCopy('wiz-mcp-sec',this)">copy</button>
2281
+ <span class="mcp-label">Talk with CLI</span>
2282
+ <span class="mcp-val" id="wiz-mcp-chitchat">\${base}/chitchat</span>
2283
+ <button class="mcp-copy" onclick="wizCopy('wiz-mcp-chitchat',this)">copy</button>
2371
2284
  </div>
2372
2285
  </div>
2373
2286
  <div style="margin-top:10px;font-size:.78rem;color:#64748b">
2374
- Paste into <a class="wiz-link" href="https://claude.ai/settings/integrations" target="_blank">claude.ai Settings Integrations</a>
2375
- </div>
2376
- <div style="margin-top:8px;font-size:.78rem;color:#64748b">
2377
- Same Client ID/Secret for both connectors.
2287
+ MCP endpoints for direct servers (Regen Media, Web Research) are stored as <code>mcp-*</code> services in the vault.
2378
2288
  </div>
2379
2289
  \`, [], [
2380
2290
  \`<button class="btn-wiz-primary" onclick="window.open('https://claude.ai/settings/integrations','_blank');wizShowTest()">I've Added It — Test Now</button>\`,
2381
- \`<button class="btn-wiz-secondary" onclick="wizRollCreds()">Roll Credentials</button>\`,
2382
2291
  \`<button class="btn-wiz-secondary" onclick="wizShowTest()">Skip Test</button>\`,
2383
2292
  \`<button class="btn-wiz-secondary" onclick="closeSetupWizard()">Done</button>\`
2384
2293
  ]);
@@ -3584,15 +3493,6 @@ function createServer(initPassword, whitelist, port, tunnelHostnameInit = null,
3584
3493
  });
3585
3494
  }
3586
3495
 
3587
- // GET /mcp-setup — OAuth setup info for claude.ai MCP (localhost only)
3588
- if (method === "GET" && reqPath === "/mcp-setup") {
3589
- const base = tunnelUrl && tunnelUrl.startsWith("http") ? tunnelUrl : null;
3590
- return ok(res, {
3591
- url: base ? `${base}/clauth` : null,
3592
- gwsUrl: base ? `${base}/gws` : null,
3593
- note: "OAuth 2.1 public client — Claude registers dynamically, no client_secret needed",
3594
- });
3595
- }
3596
3496
 
3597
3497
  // POST /roll-mcp-creds — invalidate all tokens and clear all dynamic clients
3598
3498
  if (method === "POST" && reqPath === "/roll-mcp-creds") {
@@ -3716,6 +3616,29 @@ function createServer(initPassword, whitelist, port, tunnelHostnameInit = null,
3716
3616
  return;
3717
3617
  }
3718
3618
 
3619
+ // POST /chitchat/send — send a message to an active chitchat session's inbox (REST mirror of MCP chitchat_send)
3620
+ if (method === "POST" && reqPath === "/chitchat/send") {
3621
+ let body = "";
3622
+ req.on("data", d => body += d);
3623
+ req.on("end", () => {
3624
+ try {
3625
+ const { session_id, message } = JSON.parse(body || "{}");
3626
+ if (!session_id || !message) {
3627
+ res.writeHead(400, { "Content-Type": "application/json", ...CORS });
3628
+ return res.end(JSON.stringify({ error: "session_id and message required" }));
3629
+ }
3630
+ const result = sendChitchatMessage(session_id, message);
3631
+ const status = result.error === 'not_found' ? 404 : result.error ? 400 : 200;
3632
+ res.writeHead(status, { "Content-Type": "application/json", ...CORS });
3633
+ res.end(JSON.stringify(result));
3634
+ } catch {
3635
+ res.writeHead(400, { "Content-Type": "application/json", ...CORS });
3636
+ res.end(JSON.stringify({ error: "invalid JSON" }));
3637
+ }
3638
+ });
3639
+ return;
3640
+ }
3641
+
3719
3642
  // POST /terminal/start — start a named terminal session
3720
3643
  if (method === "POST" && reqPath === "/terminal/start") {
3721
3644
  let body = "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lifeaitools/clauth",
3
- "version": "1.5.71",
3
+ "version": "1.5.74",
4
4
  "description": "Hardware-bound credential vault for the LIFEAI infrastructure stack",
5
5
  "type": "module",
6
6
  "bin": {