seacloud-sdk 0.12.5 → 0.12.6

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 CHANGED
@@ -16,6 +16,25 @@ function isInIframe() {
16
16
  return true;
17
17
  }
18
18
  }
19
+ function notifyParentError(status, errorBody) {
20
+ if (!isInIframe()) {
21
+ return;
22
+ }
23
+ try {
24
+ const errorPayload = {
25
+ type: "seaverse:error",
26
+ error: {
27
+ status,
28
+ message: `HTTP ${status}`,
29
+ body: errorBody,
30
+ timestamp: Date.now()
31
+ }
32
+ };
33
+ globalThis.window.parent.postMessage(errorPayload, "*");
34
+ } catch (e) {
35
+ console.warn("[SeaCloud SDK] Failed to notify parent of error:", e);
36
+ }
37
+ }
19
38
  async function getTokenFromParent(timeout = 5e3) {
20
39
  if (!isInIframe()) {
21
40
  return null;
@@ -206,7 +225,7 @@ function validateConfig(config) {
206
225
  }
207
226
 
208
227
  // src/core/version.ts
209
- var VERSION = "0.12.5";
228
+ var VERSION = "0.9.6";
210
229
 
211
230
  // src/core/client.ts
212
231
  var SeacloudClient = class _SeacloudClient {
@@ -305,6 +324,7 @@ var SeacloudClient = class _SeacloudClient {
305
324
  clearTimeout(timeoutId);
306
325
  if (!response.ok) {
307
326
  const errorBody = await response.text();
327
+ notifyParentError(response.status, errorBody);
308
328
  throw new SeacloudError(
309
329
  `HTTP ${response.status}: ${errorBody}`,
310
330
  response.status,
@@ -2379,8 +2399,8 @@ async function klingOmniVideo(params) {
2379
2399
  async function klingV1(params) {
2380
2400
  const client = await getClient();
2381
2401
  const pollingOptions = {
2382
- intervalMs: 3e3,
2383
- maxAttempts: 60
2402
+ intervalMs: 5e3,
2403
+ maxAttempts: 120
2384
2404
  };
2385
2405
  const result = await createAndWaitTask(
2386
2406
  client,
@@ -5316,7 +5336,7 @@ async function volcesSeedream45I2i(params) {
5316
5336
  client,
5317
5337
  "/model/v1/generation",
5318
5338
  {
5319
- model: "volces_seedream_4_5_i2i",
5339
+ model: "volces_seedream_4_5",
5320
5340
  input: [{ params }]
5321
5341
  },
5322
5342
  pollingOptions
@@ -5479,6 +5499,7 @@ async function llmChatCompletions(params) {
5479
5499
  clearTimeout(timeoutId);
5480
5500
  if (!response.ok) {
5481
5501
  const errorBody = await response.text();
5502
+ notifyParentError(response.status, errorBody);
5482
5503
  throw new SeacloudError(
5483
5504
  `HTTP ${response.status}: ${errorBody}`,
5484
5505
  response.status,
@@ -5574,6 +5595,7 @@ async function agentChatCompletions(params) {
5574
5595
  clearTimeout(timeoutId);
5575
5596
  if (!response.ok) {
5576
5597
  const errorBody = await response.text();
5598
+ notifyParentError(response.status, errorBody);
5577
5599
  throw new SeacloudError(
5578
5600
  `HTTP ${response.status}: ${errorBody}`,
5579
5601
  response.status,
@@ -5955,12 +5977,13 @@ async function youchuanEnhance(params) {
5955
5977
  for (const item of result.output) {
5956
5978
  if (item.content) {
5957
5979
  for (const resource of item.content) {
5980
+ const { usage, ...cleanResource } = resource;
5958
5981
  resources.push({
5959
- type: resource.type || "unknown",
5960
- url: resource.url || "",
5961
- size: resource.size,
5962
- jobId: resource.jobId,
5963
- ...resource
5982
+ type: cleanResource.type || "unknown",
5983
+ url: cleanResource.url || "",
5984
+ size: cleanResource.size,
5985
+ jobId: cleanResource.jobId,
5986
+ ...cleanResource
5964
5987
  });
5965
5988
  }
5966
5989
  }