@morphllm/morphsdk 0.2.64 → 0.2.65
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/{chunk-LVY5LPEX.js → chunk-IZISG7DL.js} +41 -4
- package/dist/chunk-IZISG7DL.js.map +1 -0
- package/dist/{chunk-DT6MPBD4.js → chunk-NTKQXKGM.js} +2 -2
- package/dist/client.cjs +39 -3
- package/dist/client.cjs.map +1 -1
- package/dist/client.js +2 -2
- package/dist/index.cjs +39 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/tools/browser/anthropic.cjs.map +1 -1
- package/dist/tools/browser/anthropic.js +1 -1
- package/dist/tools/browser/core.cjs +41 -3
- package/dist/tools/browser/core.cjs.map +1 -1
- package/dist/tools/browser/core.d.ts +38 -8
- package/dist/tools/browser/core.js +3 -1
- package/dist/tools/browser/index.cjs +41 -3
- package/dist/tools/browser/index.cjs.map +1 -1
- package/dist/tools/browser/index.d.ts +2 -2
- package/dist/tools/browser/index.js +3 -1
- package/dist/tools/browser/openai.cjs.map +1 -1
- package/dist/tools/browser/openai.js +1 -1
- package/dist/tools/browser/types.cjs.map +1 -1
- package/dist/tools/browser/types.d.ts +38 -1
- package/dist/tools/browser/vercel.cjs.map +1 -1
- package/dist/tools/browser/vercel.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-LVY5LPEX.js.map +0 -1
- /package/dist/{chunk-DT6MPBD4.js.map → chunk-NTKQXKGM.js.map} +0 -0
package/dist/client.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MorphClient
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-NTKQXKGM.js";
|
|
4
4
|
import "./chunk-NTCSWQEM.js";
|
|
5
5
|
import "./chunk-BLKHVDYQ.js";
|
|
6
6
|
import "./chunk-IQFKDBQD.js";
|
|
@@ -27,7 +27,7 @@ import "./chunk-5QIWYEHJ.js";
|
|
|
27
27
|
import "./chunk-QZNGKOCZ.js";
|
|
28
28
|
import "./chunk-CKTA4AXM.js";
|
|
29
29
|
import "./chunk-63WE2C5R.js";
|
|
30
|
-
import "./chunk-
|
|
30
|
+
import "./chunk-IZISG7DL.js";
|
|
31
31
|
import "./chunk-SQN4DUQS.js";
|
|
32
32
|
import "./chunk-GZMUGMOZ.js";
|
|
33
33
|
import "./chunk-VJU3BRET.js";
|
package/dist/index.cjs
CHANGED
|
@@ -604,6 +604,12 @@ var BrowserClient = class {
|
|
|
604
604
|
async getErrors(recordingId) {
|
|
605
605
|
return getErrors(recordingId, this.config);
|
|
606
606
|
}
|
|
607
|
+
/**
|
|
608
|
+
* Get animated WebP preview of recording
|
|
609
|
+
*/
|
|
610
|
+
async getWebp(recordingId, options) {
|
|
611
|
+
return getWebp(recordingId, this.config, options);
|
|
612
|
+
}
|
|
607
613
|
/**
|
|
608
614
|
* Check if browser worker service is healthy
|
|
609
615
|
*/
|
|
@@ -710,9 +716,13 @@ async function getRecording(recordingId, config = {}) {
|
|
|
710
716
|
if (debug) console.error(`[Browser] getRecording error: ${response.status} - ${errorText}`);
|
|
711
717
|
throw new Error(`HTTP ${response.status}: ${errorText}`);
|
|
712
718
|
}
|
|
713
|
-
const
|
|
714
|
-
if (debug) console.log(`[Browser] Recording status: ${
|
|
715
|
-
return
|
|
719
|
+
const data = await response.json();
|
|
720
|
+
if (debug) console.log(`[Browser] Recording status: ${data.status}`);
|
|
721
|
+
return {
|
|
722
|
+
...data,
|
|
723
|
+
getWebp: (options) => getWebp(recordingId, config, options),
|
|
724
|
+
getErrors: () => getErrors(recordingId, config)
|
|
725
|
+
};
|
|
716
726
|
}
|
|
717
727
|
async function waitForRecording(recordingId, config = {}, options = {}) {
|
|
718
728
|
const timeout = options.timeout ?? 6e4;
|
|
@@ -931,6 +941,32 @@ function wrapTaskResponseWithSchema(result, config, schema) {
|
|
|
931
941
|
};
|
|
932
942
|
return wrapped;
|
|
933
943
|
}
|
|
944
|
+
async function getWebp(recordingId, config = {}, options = {}) {
|
|
945
|
+
const apiUrl = config.apiUrl || DEFAULT_CONFIG2.apiUrl;
|
|
946
|
+
const debug = config.debug || false;
|
|
947
|
+
if (!config.apiKey) {
|
|
948
|
+
throw new Error("API key required for getWebp");
|
|
949
|
+
}
|
|
950
|
+
const params = new URLSearchParams();
|
|
951
|
+
if (options.max_duration !== void 0) params.set("max_duration", String(options.max_duration));
|
|
952
|
+
if (options.fps !== void 0) params.set("fps", String(options.fps));
|
|
953
|
+
if (options.width !== void 0) params.set("width", String(options.width));
|
|
954
|
+
if (options.quality !== void 0) params.set("quality", String(options.quality));
|
|
955
|
+
const url = `${apiUrl}/recordings/${recordingId}/webp${params.toString() ? "?" + params.toString() : ""}`;
|
|
956
|
+
if (debug) console.log(`[Browser] getWebp: ${url}`);
|
|
957
|
+
const response = await fetch(url, {
|
|
958
|
+
method: "GET",
|
|
959
|
+
headers: { "Authorization": `Bearer ${config.apiKey}` }
|
|
960
|
+
});
|
|
961
|
+
if (!response.ok) {
|
|
962
|
+
const errorText = await response.text().catch(() => response.statusText);
|
|
963
|
+
if (debug) console.error(`[Browser] getWebp error: ${response.status} - ${errorText}`);
|
|
964
|
+
throw new Error(`HTTP ${response.status}: ${errorText}`);
|
|
965
|
+
}
|
|
966
|
+
const result = await response.json();
|
|
967
|
+
if (debug) console.log(`[Browser] WebP ready: ${result.webp_url} (cached: ${result.cached})`);
|
|
968
|
+
return result;
|
|
969
|
+
}
|
|
934
970
|
async function checkHealth(config = {}) {
|
|
935
971
|
const apiUrl = config.apiUrl || DEFAULT_CONFIG2.apiUrl;
|
|
936
972
|
try {
|