mboaai-sdk 1.0.4 → 1.0.5
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.d.ts +1 -1
- package/dist/mboaai-sdk.esm.js +1 -1
- package/dist/mboaai-sdk.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
@@ -13,7 +13,7 @@ declare class T {
|
|
13
13
|
private static defaultType;
|
14
14
|
/** Call once near app start */
|
15
15
|
static init(opts: InitOptions): Promise<void>;
|
16
|
-
/** Translate text – returns original text on failure */
|
16
|
+
/** Translate text – returns original text on failure or malformed JSON */
|
17
17
|
static translate(text: string, targetLang: string, type?: TranslateType): Promise<string>;
|
18
18
|
}
|
19
19
|
declare global {
|
package/dist/mboaai-sdk.esm.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
import{MCPClient as
|
1
|
+
import{MCPClient as t}from"mcp-client";class e{static async init(r){if(!(null==r?void 0:r.apiKey))throw new Error("MboaAI-SDK: apiKey is required");if(e.ready)return;const{apiKey:a,mcpUrl:n="https://api.filparty.com:8001/mcp",name:o="MboaAI-SDK",version:i="1.0.0",defaultType:l="standard"}=r;e.client=new t({name:o,version:i}),await e.client.connect({type:"sse",url:n,headers:{"x-api-key":a}}),e.defaultType=l,e.ready=!0}static async translate(t,r,a){var n,o,i;if(!e.ready)throw new Error("MboaAI-SDK: call init() first");const l=`Translate "${t}" into ${r} for ${null!=a?a:e.defaultType}`;try{const r=await e.client.callTool({name:"run_translate",arguments:{message:l}}),a=String(null!==(i=null===(o=null===(n=null==r?void 0:r.content)||void 0===n?void 0:n[0])||void 0===o?void 0:o.text)&&void 0!==i?i:"");if((t=>{const e=t.trim().charAt(0);return"{"===e||"["===e})(a))try{const e=JSON.parse(a);return e.reply||e.text||t}catch(t){}return a||t}catch(e){return console.error("[MboaAI-SDK] translate error → returning source",e),t}}}e.ready=!1,e.defaultType="standard","undefined"!=typeof window&&(window.MboaAI=window.MboaAI||{},window.MboaAI.T=e);export{e as T,e as default};
|
package/dist/mboaai-sdk.umd.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("mcp-client")):"function"==typeof define&&define.amd?define(["exports","mcp-client"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).MboaAI={},e.mcpClient)}(this,(function(e,t){"use strict";class n{static async init(e){if(!(null==e?void 0:e.apiKey))throw new Error("MboaAI-SDK: apiKey is required");if(n.ready)return;const{apiKey:
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("mcp-client")):"function"==typeof define&&define.amd?define(["exports","mcp-client"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).MboaAI={},e.mcpClient)}(this,(function(e,t){"use strict";class n{static async init(e){if(!(null==e?void 0:e.apiKey))throw new Error("MboaAI-SDK: apiKey is required");if(n.ready)return;const{apiKey:r,mcpUrl:a="https://api.filparty.com:8001/mcp",name:i="MboaAI-SDK",version:o="1.0.0",defaultType:l="standard"}=e;n.client=new t.MCPClient({name:i,version:o}),await n.client.connect({type:"sse",url:a,headers:{"x-api-key":r}}),n.defaultType=l,n.ready=!0}static async translate(e,t,r){var a,i,o;if(!n.ready)throw new Error("MboaAI-SDK: call init() first");const l=`Translate "${e}" into ${t} for ${null!=r?r:n.defaultType}`;try{const t=await n.client.callTool({name:"run_translate",arguments:{message:l}}),r=String(null!==(o=null===(i=null===(a=null==t?void 0:t.content)||void 0===a?void 0:a[0])||void 0===i?void 0:i.text)&&void 0!==o?o:"");if((e=>{const t=e.trim().charAt(0);return"{"===t||"["===t})(r))try{const t=JSON.parse(r);return t.reply||t.text||e}catch(e){}return r||e}catch(t){return console.error("[MboaAI-SDK] translate error → returning source",t),e}}}n.ready=!1,n.defaultType="standard","undefined"!=typeof window&&(window.MboaAI=window.MboaAI||{},window.MboaAI.T=n),e.T=n,e.default=n,Object.defineProperty(e,"__esModule",{value:!0})}));
|