mboaai-sdk 1.0.3 → 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/README.md +3 -3
- 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 +2 -2
package/README.md
CHANGED
@@ -24,7 +24,7 @@ npm i mboaai-sdk # or yarn add mboaai-sdk / pnpm add …
|
|
24
24
|
import { T } from "mboaai-sdk";
|
25
25
|
|
26
26
|
await T.init({
|
27
|
-
apiKey: "
|
27
|
+
apiKey: "yourKey", // ← required
|
28
28
|
defaultType: "website", // optional: default pipeline
|
29
29
|
});
|
30
30
|
|
@@ -52,7 +52,7 @@ const { T } = require("mboaai-sdk");
|
|
52
52
|
<script src="https://cdn.jsdelivr.net/npm/mboaai-sdk"></script>
|
53
53
|
<script>
|
54
54
|
(async () => {
|
55
|
-
await MboaAI.T.init({ apiKey: "
|
55
|
+
await MboaAI.T.init({ apiKey: "yourKey" });
|
56
56
|
const es = await MboaAI.T.translate("Wie geht's?", "ES");
|
57
57
|
console.log(es);
|
58
58
|
})();
|
@@ -83,7 +83,7 @@ import { T } from "mboaai-sdk";
|
|
83
83
|
(async () => {
|
84
84
|
/* 1) Initialise once */
|
85
85
|
await T.init({
|
86
|
-
apiKey : "
|
86
|
+
apiKey : "yourKey", // your secret key
|
87
87
|
defaultType : "website", // optional
|
88
88
|
});
|
89
89
|
|
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})}));
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "mboaai-sdk",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.5",
|
4
4
|
"description": "Lightweight JavaScript SDK for calling MboaAI agents",
|
5
5
|
"type": "module",
|
6
6
|
"main": "./dist/mboaai-sdk.umd.js",
|
@@ -37,4 +37,4 @@
|
|
37
37
|
"README.md",
|
38
38
|
"LICENSE"
|
39
39
|
]
|
40
|
-
}
|
40
|
+
}
|