@ours.network/mcp 0.12.0 → 0.14.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/dist/mufl_code/57D7F142BD31F27B99BFB808D032E249235B63971387EFEA402EBA5967BDBD53.muflo
CHANGED
|
Binary file
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
|
|
2
|
+
var w="x-ours-kind=voice-message",_="voice-message-";function F(e,n){let o=(e??"").toLowerCase().split(";").map(r=>r.trim());return o.slice(1).includes(w)?!0:n.toLowerCase().startsWith(_)&&o[0].startsWith("audio/")}function g(e){return(e??"").split(";")[0].trim()||"application/octet-stream"}var T=["openai-compatible","elevenlabs","deepgram","custom"],A=5*1024*1024,E=6e4;function P(e){let n="configure it in config.json `stt: {}` or via OURS_STT_* env";if(!e?.provider)return{ready:!1,reason:`no STT provider configured (stt.provider: ${T.join(" | ")}) \u2014 ${n}`};let o=e.provider.trim().toLowerCase();if(!T.includes(o))return{ready:!1,reason:`unknown STT provider "${e.provider}" (expected: ${T.join(" | ")})`};if(!e.apiKey?.trim())return{ready:!1,reason:`STT provider "${o}" is set but the API key is missing (stt.apiKey / OURS_STT_API_KEY)`};if(o==="openai-compatible"){if(!e.baseUrl?.trim())return{ready:!1,reason:"openai-compatible STT needs stt.baseUrl / OURS_STT_BASE_URL (e.g. your provider's /v1 root) \u2014 no endpoint is assumed"};if(!e.model?.trim())return{ready:!1,reason:"openai-compatible STT needs stt.model / OURS_STT_MODEL (passed to the provider verbatim) \u2014 no model is assumed"}}if(o==="elevenlabs"&&!e.model?.trim())return{ready:!1,reason:"elevenlabs STT needs stt.model / OURS_STT_MODEL (the model_id, e.g. from your ElevenLabs account) \u2014 no model is assumed"};if(o==="custom"){if(!e.custom?.url?.trim())return{ready:!1,reason:"custom STT needs stt.custom.url (the full endpoint URL of your provider)"};if((e.custom.url.includes("{model}")||e.custom.modelField!==void 0&&e.custom.modelField!=="")&&!e.model?.trim())return{ready:!1,reason:"the custom STT template references a model (url {model} or modelField) but stt.model / OURS_STT_MODEL is not set"}}return{ready:!0,provider:o}}function c(e,n){let o=e;for(let r of n.split(".")){if(o===null||typeof o!="object")return;o=o[r]}return typeof o=="string"?o:void 0}async function p(e,n,o){let r=new AbortController,a=setTimeout(()=>r.abort(),o);try{let t=await fetch(e,{...n,signal:r.signal});if(!t.ok){let s=await t.text().catch(()=>"");return{ok:!1,error:`STT HTTP ${t.status}${s?`: ${s.slice(0,200)}`:""}`}}return{ok:!0,json:await t.json()}}catch(t){return t?.name==="AbortError"?{ok:!1,error:`STT timeout after ${o}ms`}:{ok:!1,error:t instanceof Error?t.message:String(t)}}finally{clearTimeout(a)}}var S=(e,n)=>new Blob([new Uint8Array(e)],{type:g(n)}),U=async(e,n,o,r,a)=>{let t=new FormData;t.set("file",S(e,o),n),t.set("model",r.model.trim()),t.set("response_format","json"),r.language?.trim()&&t.set("language",r.language.trim());let s=await p(`${r.baseUrl.trim().replace(/\/$/,"")}/audio/transcriptions`,{method:"POST",headers:{Authorization:`Bearer ${r.apiKey.trim()}`},body:t},a);if(!s.ok)return s;let i=c(s.json,"text");return i!==void 0?{ok:!0,text:i}:{ok:!1,error:"STT response missing text"}},R=async(e,n,o,r,a)=>{let t=new FormData;t.set("file",S(e,o),n),t.set("model_id",r.model.trim()),r.language?.trim()&&t.set("language_code",r.language.trim());let s=await p(`${(r.baseUrl?.trim()||"https://api.elevenlabs.io").replace(/\/$/,"")}/v1/speech-to-text`,{method:"POST",headers:{"xi-api-key":r.apiKey.trim()},body:t},a);if(!s.ok)return s;let i=c(s.json,"text");return i!==void 0?{ok:!0,text:i}:{ok:!1,error:"STT response missing text"}},O=async(e,n,o,r,a)=>{let t=new URLSearchParams;r.model?.trim()&&t.set("model",r.model.trim()),r.language?.trim()&&t.set("language",r.language.trim());let s=t.toString(),i=await p(`${(r.baseUrl?.trim()||"https://api.deepgram.com").replace(/\/$/,"")}/v1/listen${s?`?${s}`:""}`,{method:"POST",headers:{Authorization:`Token ${r.apiKey.trim()}`,"Content-Type":g(o)},body:new Uint8Array(e)},a);if(!i.ok)return i;let l=c(i.json,"results.channels.0.alternatives.0.transcript");return l!==void 0?{ok:!0,text:l}:{ok:!1,error:"STT response missing transcript"}},M=async(e,n,o,r,a)=>{let t=r.custom,s=r.model?.trim()??"",i=t.url.replaceAll("{model}",encodeURIComponent(s)),l={},v=t.authHeaderName?.trim()||"Authorization",y=(t.authHeaderTemplate??"Bearer {key}").replaceAll("{key}",r.apiKey.trim());y&&(l[v]=y);let h=t.bodyMode??"multipart",x=t.fileField?.trim()||"file",d=t.modelField===void 0?"model":t.modelField.trim(),m;if(h==="multipart"){let u=new FormData;u.set(x,S(e,o),n),d&&s&&u.set(d,s);for(let[k,$]of Object.entries(t.extraFields??{}))u.set(k,$);m=u}else h==="raw"?(l["Content-Type"]=g(o),m=new Uint8Array(e)):(l["Content-Type"]="application/json",m=JSON.stringify({[x]:e.toString("base64"),...d&&s?{[d]:s}:{},...t.extraFields??{}}));let f=await p(i,{method:t.method?.trim()||"POST",headers:l,body:m},a);if(!f.ok)return f;let b=c(f.json,t.responseTextPath?.trim()||"text");return b!==void 0?{ok:!0,text:b}:{ok:!1,error:`STT response has no text at "${t.responseTextPath?.trim()||"text"}"`}},B={"openai-compatible":U,elevenlabs:R,deepgram:O,custom:M};async function C(e,n,o,r){let a=P(r);if(!a.ready)return{ok:!1,error:a.reason};let t=r.maxBytes??A;if(e.length>t)return{ok:!1,error:`voice message is ${e.length} B \u2014 over the ${t} B STT limit (stt.maxBytes)`};let s=r.timeoutMs??E;try{return await B[a.provider](e,n,o,r,s)}catch(i){return{ok:!1,error:i instanceof Error?i.message:String(i)}}}function j(e,n){let o=` \u2022 \u{1F3A4} voice message from ${e.sender} (${e.sizeBytes} B)`,r=`audio saved \u2192 ${e.savedPath} {${e.wire}}`;switch(n.kind){case"transcript":return`${o}: "${n.text}" \u2014 transcribed from voice message (STT); ${r}`;case"unconfigured":return`${o}: cannot transcribe \u2014 ${n.reason}. Tell the user you can't listen to voice messages until the operator configures transcription on this ours-mcp server, and ask them to send text meanwhile; ${r}`;case"failed":return`${o}: transcription failed (${n.error}). Tell the user their voice message could not be transcribed right now and ask them to send text or retry; ${r}`}}export{A as STT_MAX_BYTES_DEFAULT,T as STT_PROVIDERS,E as STT_TIMEOUT_MS_DEFAULT,_ as VOICE_MESSAGE_FILENAME_PREFIX,w as VOICE_MESSAGE_MIME_PARAM,g as baseMime,F as isVoiceMessage,P as sttStatus,c as textAtPath,C as transcribeVoice,j as voiceDeliveryLine};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ours.network/mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "MCP server daemon for ours — one native ADAPT wrapper hosting N self-sovereign identities, exposing secure agent-to-agent messaging tools over HTTP (Streamable HTTP). Run `ours-mcp start`.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "FSL-1.1-Apache-2.0",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"serve": "node dist/cli.js serve",
|
|
49
49
|
"prepublishOnly": "node build.mjs",
|
|
50
50
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
51
|
-
"test": "bash ../../scripts/test-receipts-mufl.sh && bash ../../scripts/test-notifications-mufl.sh && node test/loopback-bind.test.mjs && node test/lease-binding.test.mjs && node test/session-restore.test.mjs && node test/daemon-restart-resume.test.mjs && node test/version-advisory.test.mjs && node test/files-helpers.test.mjs && node test/inbox-encryption.test.mjs && node test/validate-name.test.mjs && node test/port-visibility.test.mjs && node test/notify-http-api.test.mjs && node test/unread-http-api.test.mjs && node test/create-root-cli.test.mjs && node test/session-reaper.test.mjs && node test/mig1867-verify.test.mjs && node test/single-root-policy.test.mjs && node test/pre137-blob-import-regression.test.mjs"
|
|
51
|
+
"test": "bash ../../scripts/test-receipts-mufl.sh && bash ../../scripts/test-notifications-mufl.sh && node test/loopback-bind.test.mjs && node test/lease-binding.test.mjs && node test/session-restore.test.mjs && node test/daemon-restart-resume.test.mjs && node test/version-advisory.test.mjs && node test/files-helpers.test.mjs && node test/inbox-encryption.test.mjs && node test/validate-name.test.mjs && node test/port-visibility.test.mjs && node test/notify-http-api.test.mjs && node test/unread-http-api.test.mjs && node test/create-root-cli.test.mjs && node test/session-reaper.test.mjs && node test/mig1867-verify.test.mjs && node test/single-root-policy.test.mjs && node test/pre137-blob-import-regression.test.mjs && node test/transcribe-detect.test.mjs && node test/transcribe-stt.test.mjs"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@adapt-toolkit/sdk": "0.10.12",
|