Skip to content

Commit 8f5cb7f

Browse files
committed
fix: auto-detect wss:// for HTTPS (ngrok/tunnels), fix Lyzr provider key resolution
1 parent 687f539 commit 8f5cb7f

3 files changed

Lines changed: 14 additions & 8 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gitclaw",
3-
"version": "1.3.1",
3+
"version": "1.3.2",
44
"description": "A universal git-native multimodal always learning AI Agent (TinyHuman)",
55
"author": "shreyaskapale",
66
"license": "MIT",

src/loader.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -402,12 +402,18 @@ Do NOT track trivial single-command tasks (e.g. "what time is it"). But DO check
402402
}
403403

404404
// For custom providers not in pi-ai's env key map, ensure an API key is available.
405-
// pi-ai looks up keys by provider name — unknown providers get undefined and throw.
406-
// Set OPENAI_API_KEY as fallback since custom models use the openai-completions API.
407-
const knownProviders = new Set(["openai", "anthropic", "google", "google-vertex", "groq", "cerebras", "xai", "openrouter", "mistral", "amazon-bedrock", "azure-openai-responses"]);
408-
if (model.baseUrl && !knownProviders.has(provider) && !process.env.OPENAI_API_KEY) {
409-
const fallbackKey = process.env[`${provider.toUpperCase()}_API_KEY`] || process.env.LYZR_API_KEY || "dummy";
410-
process.env.OPENAI_API_KEY = fallbackKey;
405+
// pi-ai calls getEnvApiKey(model.provider) which only knows built-in providers.
406+
// For unknown providers using openai-completions API, set provider to "openai" so
407+
// pi-ai finds OPENAI_API_KEY. The actual auth happens via custom headers on the model.
408+
const knownProviders = new Set(["openai", "anthropic", "google", "google-vertex", "groq", "cerebras", "xai", "openrouter", "mistral", "amazon-bedrock", "azure-openai-responses", "huggingface", "opencode", "kimi-coding", "github-copilot"]);
409+
if (model.baseUrl && !knownProviders.has(provider)) {
410+
// Use provider-specific key if available, otherwise use LYZR key or dummy
411+
const providerKey = process.env[`${provider.toUpperCase()}_API_KEY`] || process.env.LYZR_API_KEY;
412+
if (providerKey && !process.env.OPENAI_API_KEY) {
413+
process.env.OPENAI_API_KEY = providerKey;
414+
}
415+
// Override provider to "openai" so pi-ai resolves the API key correctly
416+
(model as any).provider = "openai";
411417
}
412418

413419
return {

src/voice/ui.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1856,7 +1856,7 @@ <h3 style="margin:0 0 16px;color:#e6edf3;font-size:16px;">Settings</h3>
18561856

18571857
function setStatus(t,s){statusText.textContent=t;statusDot.className='status-dot '+(s||'');}
18581858
function appendConv(h,c){var d=document.createElement('div');d.className='conv-msg '+(c||'');d.innerHTML=h;conv.appendChild(d);conv.scrollTop=conv.scrollHeight;}
1859-
function connectWS(){if(ws)return;setStatus('Connecting...','');ws=new WebSocket('ws://'+window.location.host);ws.onopen=function(){setStatus('Connected','connected');if(auditMode)loadExplorerTree();};ws.onmessage=function(e){try{handleServerMessage(JSON.parse(e.data));}catch(x){}};ws.onerror=function(){setStatus('Connection error','error');};ws.onclose=function(){ws=null;setStatus('Disconnected','');stopMic();stopCamera();stopScreen();};}
1859+
function connectWS(){if(ws)return;setStatus('Connecting...','');ws=new WebSocket((window.location.protocol==='https:'?'wss://':'ws://')+window.location.host);ws.onopen=function(){setStatus('Connected','connected');if(auditMode)loadExplorerTree();};ws.onmessage=function(e){try{handleServerMessage(JSON.parse(e.data));}catch(x){}};ws.onerror=function(){setStatus('Connection error','error');};ws.onclose=function(){ws=null;setStatus('Disconnected','');stopMic();stopCamera();stopScreen();};}
18601860
function sendMsg(m){if(ws&&ws.readyState===WebSocket.OPEN)ws.send(JSON.stringify(m));}
18611861

18621862
// Agent Vitals

0 commit comments

Comments
 (0)