@neuvybe/jarvis 0.29.1 → 0.29.2
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/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -74,7 +74,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
74
74
|
`+Object.keys(i).map(r=>`${r}: ${i[r]}`).join(`\r
|
|
75
75
|
`)+`\r
|
|
76
76
|
\r
|
|
77
|
-
`+n)}function Ar(t,e,n,i,r,o){if(t.listenerCount("wsClientError")){let s=new Error(r);Error.captureStackTrace(s,Ar),t.emit("wsClientError",s,n,e)}else Xi(n,i,r,o)}});var fP,pP,mP,gP,vP,yP,cm,_P,Lw=g(()=>{fP=Ke(kw(),1),pP=Ke(Ma(),1),mP=Ke(On(),1),gP=Ke(Yp(),1),vP=Ke(em(),1),yP=Ke(sm(),1),cm=Ke(Fa(),1),_P=Ke(Dw(),1)});function bP(t){return Array.isArray(t)?Buffer.concat(t).toString("utf8"):Buffer.isBuffer(t)?t.toString("utf8"):Buffer.from(t).toString("utf8")}var Ln,Za=g(()=>{"use strict";Lw();Ln=(t,e)=>{let n=new cm.default(t,{headers:e});return{send:i=>n.send(i),close:()=>n.close(),onOpen:i=>{n.on("open",i)},onMessage:i=>{n.on("message",r=>i(bP(r)))},onError:i=>{n.on("error",i)},onClose:i=>{n.on("close",()=>i())}}}});function Ga(t){return t>=200&&t<300?{ok:!0,status:"valid"}:t===401||t===403?{ok:!1,status:"invalid",detail:`key rejected (HTTP ${t})`}:{ok:!1,status:"unreachable",detail:`unexpected response (HTTP ${t})`}}function kP(t){try{let e=new URL(t);return e.username="",e.password="",e.toString()}catch{return"the configured url"}}function tr(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}async function Wa(t,e,n,i){let r=await n(t,{headers:e,signal:i});if(!r.ok)throw new Ba(r.status);try{return await r.json()}catch{throw new Error("invalid JSON response")}}function um(t){let e={};for(let[n,i]of Object.entries(t))i!==void 0&&i.length>0&&(e[n]=i);if(Object.keys(e).length===0)throw new Error("catalogue curated to nothing");return e}function OP(t){return!/^gpt-(4\.1|4o|5)/.test(t)&&!/^o\d/.test(t)||AP.test(t)?!1:!/-(audio|realtime|transcribe|tts|image|search|codex|chat-latest|instruct|deep-research|pro)\b/.test(t)}function Pr(t){let e=Ha[t];return e===void 0||e.keyEnv!==void 0}var $P,wP,xP,SP,EP,IP,Ba,TP,AP,PP,CP,RP,Ha,Or,qa=g(()=>{"use strict";he();Yt();Up();Ta();Za();$P=async(t,e,n)=>{let i=await e("https://api.openai.com/v1/models",{headers:{Authorization:`Bearer ${t}`},signal:n});return Ga(i.status)},wP=async(t,e,n)=>{let i=await e("https://api.anthropic.com/v1/models",{headers:{"x-api-key":t,"anthropic-version":"2023-06-01"},signal:n});return Ga(i.status)},xP=async(t,e,n)=>{let i=await e("https://api.deepgram.com/v1/projects",{headers:{Authorization:`Token ${t}`},signal:n});return Ga(i.status)},SP=async(t,e,n)=>{let i=await e("https://api.elevenlabs.io/v1/user",{headers:{"xi-api-key":t},signal:n});return i.status===401||i.status===403?{ok:!1,status:"unverifiable",detail:"an ElevenLabs key scoped to the voice endpoints cannot reach a free validation endpoint; it will be confirmed at first use"}:Ga(i.status)},EP=(t,e,n,i)=>new Promise(r=>{let o=!1,s=null,a=l=>{o||(o=!0,s?.close(),r(l))};if(n.aborted){a({ok:!1,status:"unreachable",detail:"request timed out"});return}n.addEventListener("abort",()=>a({ok:!1,status:"unreachable",detail:"request timed out"}),{once:!0});let c=i?.url??ka,u=i?.socketFactory??Ln;try{let l=u(c,{});s=l,l.onOpen(()=>a({ok:!0,status:"valid",detail:`server reachable at ${c}`})),l.onError(d=>a({ok:!1,status:"unreachable",detail:be(d,t)})),l.onClose(()=>a({ok:!1,status:"unreachable",detail:"connection closed before open"}))}catch(l){a({ok:!1,status:"unreachable",detail:be(l,t)})}}),IP=async(t,e,n,i)=>{let r=i?.url??Mp;try{return(await e(r,{signal:n})).body?.cancel().catch(()=>{}),{ok:!0,status:"valid",detail:`server reachable at ${kP(r)}`}}catch(o){return{ok:!1,status:"unreachable",detail:be(o,t)}}};Ba=class extends Error{status;constructor(e){super(`HTTP ${e}`),this.status=e,this.name="CatalogueHttpError"}};TP=async(t,e,n)=>{if(!t)throw new Error("API key required");let i=await Wa("https://api.anthropic.com/v1/models?limit=100",{"x-api-key":t,"anthropic-version":"2023-06-01"},e,n),r=tr(i)&&Array.isArray(i.data)?i.data:[],o=[];for(let s of r){if(!tr(s)||typeof s.id!="string")continue;let a=typeof s.display_name=="string"?s.display_name:void 0;o.push(a===void 0?{id:s.id}:{id:s.id,label:a})}return um({text:o})},AP=/-\d{4}-\d{2}-\d{2}$/;PP=async(t,e,n)=>{if(!t)throw new Error("API key required");let i=await Wa("https://api.openai.com/v1/models",{Authorization:`Bearer ${t}`},e,n),r=tr(i)&&Array.isArray(i.data)?i.data:[],o=[];for(let a of r)tr(a)&&typeof a.id=="string"&&o.push(a.id);o.sort();let s=a=>o.filter(a).map(c=>({id:c}));return um({text:s(OP),stt:s(a=>a==="whisper-1"||a.endsWith("-transcribe")),tts:s(a=>/^tts-1(-hd)?$/.test(a)||a.endsWith("-tts")),embedding:s(a=>a.startsWith("text-embedding-3-"))})},CP=async(t,e,n)=>{let i=await Wa("https://api.deepgram.com/v1/models",{},e,n),r=tr(i)&&Array.isArray(i.stt)?i.stt:[],o=new Set,s=[];for(let a of r){if(!tr(a)||a.streaming!==!0)continue;let{canonical_name:c,architecture:u}=a;typeof c!="string"||typeof u!="string"||u.startsWith("nova-")&&(o.has(c)||(o.add(c),s.push({id:c,architecture:u})))}return s.sort((a,c)=>a.architecture===c.architecture?a.id.localeCompare(c.id,"en"):c.architecture.localeCompare(a.architecture,"en",{numeric:!0})),um({stt:s.map(({id:a})=>({id:a}))})},RP=async(t,e,n)=>{let i=await Wa("https://api.elevenlabs.io/v2/voices?page_size=100",{"xi-api-key":t},e,n),r=tr(i)&&Array.isArray(i.voices)?i.voices:[],o=[];for(let s of r){if(!tr(s))continue;let{voice_id:a,name:c,category:u}=s;typeof a!="string"||a.length===0||typeof c!="string"||c.length===0||o.push({voiceId:a,name:c,...typeof u=="string"&&u.length>0&&{category:u}})}return o},Ha={elevenlabs:{capabilities:["stt","tts"],defaultModel:{stt:"scribe_v2_realtime",tts:"eleven_flash_v2_5"},keyEnv:"ELEVENLABS_API_KEY",probe:SP,listVoices:RP},anthropic:{capabilities:["text"],defaultModel:{text:"claude-opus-
|
|
77
|
+
`+n)}function Ar(t,e,n,i,r,o){if(t.listenerCount("wsClientError")){let s=new Error(r);Error.captureStackTrace(s,Ar),t.emit("wsClientError",s,n,e)}else Xi(n,i,r,o)}});var fP,pP,mP,gP,vP,yP,cm,_P,Lw=g(()=>{fP=Ke(kw(),1),pP=Ke(Ma(),1),mP=Ke(On(),1),gP=Ke(Yp(),1),vP=Ke(em(),1),yP=Ke(sm(),1),cm=Ke(Fa(),1),_P=Ke(Dw(),1)});function bP(t){return Array.isArray(t)?Buffer.concat(t).toString("utf8"):Buffer.isBuffer(t)?t.toString("utf8"):Buffer.from(t).toString("utf8")}var Ln,Za=g(()=>{"use strict";Lw();Ln=(t,e)=>{let n=new cm.default(t,{headers:e});return{send:i=>n.send(i),close:()=>n.close(),onOpen:i=>{n.on("open",i)},onMessage:i=>{n.on("message",r=>i(bP(r)))},onError:i=>{n.on("error",i)},onClose:i=>{n.on("close",()=>i())}}}});function Ga(t){return t>=200&&t<300?{ok:!0,status:"valid"}:t===401||t===403?{ok:!1,status:"invalid",detail:`key rejected (HTTP ${t})`}:{ok:!1,status:"unreachable",detail:`unexpected response (HTTP ${t})`}}function kP(t){try{let e=new URL(t);return e.username="",e.password="",e.toString()}catch{return"the configured url"}}function tr(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}async function Wa(t,e,n,i){let r=await n(t,{headers:e,signal:i});if(!r.ok)throw new Ba(r.status);try{return await r.json()}catch{throw new Error("invalid JSON response")}}function um(t){let e={};for(let[n,i]of Object.entries(t))i!==void 0&&i.length>0&&(e[n]=i);if(Object.keys(e).length===0)throw new Error("catalogue curated to nothing");return e}function OP(t){return!/^gpt-(4\.1|4o|5)/.test(t)&&!/^o\d/.test(t)||AP.test(t)?!1:!/-(audio|realtime|transcribe|tts|image|search|codex|chat-latest|instruct|deep-research|pro)\b/.test(t)}function Pr(t){let e=Ha[t];return e===void 0||e.keyEnv!==void 0}var $P,wP,xP,SP,EP,IP,Ba,TP,AP,PP,CP,RP,Ha,Or,qa=g(()=>{"use strict";he();Yt();Up();Ta();Za();$P=async(t,e,n)=>{let i=await e("https://api.openai.com/v1/models",{headers:{Authorization:`Bearer ${t}`},signal:n});return Ga(i.status)},wP=async(t,e,n)=>{let i=await e("https://api.anthropic.com/v1/models",{headers:{"x-api-key":t,"anthropic-version":"2023-06-01"},signal:n});return Ga(i.status)},xP=async(t,e,n)=>{let i=await e("https://api.deepgram.com/v1/projects",{headers:{Authorization:`Token ${t}`},signal:n});return Ga(i.status)},SP=async(t,e,n)=>{let i=await e("https://api.elevenlabs.io/v1/user",{headers:{"xi-api-key":t},signal:n});return i.status===401||i.status===403?{ok:!1,status:"unverifiable",detail:"an ElevenLabs key scoped to the voice endpoints cannot reach a free validation endpoint; it will be confirmed at first use"}:Ga(i.status)},EP=(t,e,n,i)=>new Promise(r=>{let o=!1,s=null,a=l=>{o||(o=!0,s?.close(),r(l))};if(n.aborted){a({ok:!1,status:"unreachable",detail:"request timed out"});return}n.addEventListener("abort",()=>a({ok:!1,status:"unreachable",detail:"request timed out"}),{once:!0});let c=i?.url??ka,u=i?.socketFactory??Ln;try{let l=u(c,{});s=l,l.onOpen(()=>a({ok:!0,status:"valid",detail:`server reachable at ${c}`})),l.onError(d=>a({ok:!1,status:"unreachable",detail:be(d,t)})),l.onClose(()=>a({ok:!1,status:"unreachable",detail:"connection closed before open"}))}catch(l){a({ok:!1,status:"unreachable",detail:be(l,t)})}}),IP=async(t,e,n,i)=>{let r=i?.url??Mp;try{return(await e(r,{signal:n})).body?.cancel().catch(()=>{}),{ok:!0,status:"valid",detail:`server reachable at ${kP(r)}`}}catch(o){return{ok:!1,status:"unreachable",detail:be(o,t)}}};Ba=class extends Error{status;constructor(e){super(`HTTP ${e}`),this.status=e,this.name="CatalogueHttpError"}};TP=async(t,e,n)=>{if(!t)throw new Error("API key required");let i=await Wa("https://api.anthropic.com/v1/models?limit=100",{"x-api-key":t,"anthropic-version":"2023-06-01"},e,n),r=tr(i)&&Array.isArray(i.data)?i.data:[],o=[];for(let s of r){if(!tr(s)||typeof s.id!="string")continue;let a=typeof s.display_name=="string"?s.display_name:void 0;o.push(a===void 0?{id:s.id}:{id:s.id,label:a})}return um({text:o})},AP=/-\d{4}-\d{2}-\d{2}$/;PP=async(t,e,n)=>{if(!t)throw new Error("API key required");let i=await Wa("https://api.openai.com/v1/models",{Authorization:`Bearer ${t}`},e,n),r=tr(i)&&Array.isArray(i.data)?i.data:[],o=[];for(let a of r)tr(a)&&typeof a.id=="string"&&o.push(a.id);o.sort();let s=a=>o.filter(a).map(c=>({id:c}));return um({text:s(OP),stt:s(a=>a==="whisper-1"||a.endsWith("-transcribe")),tts:s(a=>/^tts-1(-hd)?$/.test(a)||a.endsWith("-tts")),embedding:s(a=>a.startsWith("text-embedding-3-"))})},CP=async(t,e,n)=>{let i=await Wa("https://api.deepgram.com/v1/models",{},e,n),r=tr(i)&&Array.isArray(i.stt)?i.stt:[],o=new Set,s=[];for(let a of r){if(!tr(a)||a.streaming!==!0)continue;let{canonical_name:c,architecture:u}=a;typeof c!="string"||typeof u!="string"||u.startsWith("nova-")&&(o.has(c)||(o.add(c),s.push({id:c,architecture:u})))}return s.sort((a,c)=>a.architecture===c.architecture?a.id.localeCompare(c.id,"en"):c.architecture.localeCompare(a.architecture,"en",{numeric:!0})),um({stt:s.map(({id:a})=>({id:a}))})},RP=async(t,e,n)=>{let i=await Wa("https://api.elevenlabs.io/v2/voices?page_size=100",{"xi-api-key":t},e,n),r=tr(i)&&Array.isArray(i.voices)?i.voices:[],o=[];for(let s of r){if(!tr(s))continue;let{voice_id:a,name:c,category:u}=s;typeof a!="string"||a.length===0||typeof c!="string"||c.length===0||o.push({voiceId:a,name:c,...typeof u=="string"&&u.length>0&&{category:u}})}return o},Ha={elevenlabs:{capabilities:["stt","tts"],defaultModel:{stt:"scribe_v2_realtime",tts:"eleven_flash_v2_5"},keyEnv:"ELEVENLABS_API_KEY",probe:SP,listVoices:RP},anthropic:{capabilities:["text"],defaultModel:{text:"claude-opus-5"},fastModel:{text:"claude-sonnet-5"},keyEnv:"ANTHROPIC_API_KEY",probe:wP,listModels:TP},openai:{capabilities:["text","stt","tts","embedding"],defaultModel:{text:"gpt-5.5",stt:"whisper-1",tts:"tts-1",embedding:"text-embedding-3-small"},fastModel:{text:"gpt-5.4-mini"},keyEnv:"OPENAI_API_KEY",probe:$P,listModels:PP},deepgram:{capabilities:["stt"],defaultModel:{stt:"nova-3-general"},keyEnv:"DEEPGRAM_API_KEY",probe:xP,listModels:CP,keylessLister:!0},"sherpa-onnx":{capabilities:["stt"],defaultModel:{stt:"parakeet-tdt-0.6b-v3"},probe:EP},"openai-compat":{capabilities:["stt"],defaultModel:{stt:zp},probe:IP}};Or=class{fetchImpl;socketFactory;timeoutMs=3e3;providers;constructor(e=fetch,n=Ln){this.fetchImpl=e,this.socketFactory=n,this.providers=Ha}async probe(e,n,i){let r=this.providers[e]?.probe;if(!r)return{ok:!1,status:"unimplemented",detail:`no probe for provider '${e}'`};let o=i?.signal??AbortSignal.timeout(this.timeoutMs),s={socketFactory:this.socketFactory,...i?.url!==void 0&&{url:i.url}};try{return await r(n,this.fetchImpl,o,s)}catch(a){return{ok:!1,status:"unreachable",detail:be(a,n)}}}async listVoices(e,n,i){let r=this.providers[e]?.listVoices;if(!r)return{ok:!1,reason:"no_catalogue"};let o=i?.signal??AbortSignal.timeout(this.timeoutMs);try{let s=await r(n,this.fetchImpl,o);return s.length===0?{ok:!1,reason:"empty"}:{ok:!0,voices:s}}catch(s){return j.debug("voice catalogue unavailable",{provider:e,detail:be(s,n)}),s instanceof Ba&&(s.status===401||s.status===403)?{ok:!1,reason:"unauthorized"}:{ok:!1,reason:"unreachable",detail:be(s,n)}}}providersFor(e){return Object.keys(this.providers).filter(n=>this.providers[n].capabilities.includes(e))}defaultModel(e,n){return this.providers[e]?.defaultModel[n]}fastModel(e,n){return this.providers[e]?.fastModel?.[n]}requiresKey(e){return Pr(e)}}});var Mw,zw,Qi,lm=g(()=>{"use strict";Mw="You are Jarvis, a voice-first personal agent and a continuous, trusted collaborator - not a disposable chat assistant. You help with software engineering work. Be concise, direct, and technical; skip filler and preamble. When you are unsure, say so plainly rather than guessing. You reason and explain; you do not yet take actions or use tools, so propose the next steps for the human to run rather than claiming to have run them.",zw=`This conversation is spoken aloud. Follow the voice register:
|
|
78
78
|
- Lead with the answer. Add reasoning only after it, and only if it earns its airtime.
|
|
79
79
|
- Speak plainly: no lists, no headings, no markdown, no emphasis markers - formatting is read aloud as noise.
|
|
80
80
|
- Keep replies to about fifteen seconds of speech - a few sentences. Go longer only when explicitly asked to go deeper or walk through something.
|