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/cli.js CHANGED
@@ -20,6 +20,25 @@ function isInIframe() {
20
20
  return true;
21
21
  }
22
22
  }
23
+ function notifyParentError(status, errorBody) {
24
+ if (!isInIframe()) {
25
+ return;
26
+ }
27
+ try {
28
+ const errorPayload = {
29
+ type: "seaverse:error",
30
+ error: {
31
+ status,
32
+ message: `HTTP ${status}`,
33
+ body: errorBody,
34
+ timestamp: Date.now()
35
+ }
36
+ };
37
+ globalThis.window.parent.postMessage(errorPayload, "*");
38
+ } catch (e) {
39
+ console.warn("[SeaCloud SDK] Failed to notify parent of error:", e);
40
+ }
41
+ }
23
42
  async function getTokenFromParent(timeout = 5e3) {
24
43
  if (!isInIframe()) {
25
44
  return null;
@@ -173,7 +192,7 @@ function validateConfig(config) {
173
192
  }
174
193
 
175
194
  // src/core/version.ts
176
- var VERSION = "0.12.5";
195
+ var VERSION = "0.9.6";
177
196
 
178
197
  // src/core/client.ts
179
198
  var SeacloudClient = class _SeacloudClient {
@@ -272,6 +291,7 @@ var SeacloudClient = class _SeacloudClient {
272
291
  clearTimeout(timeoutId);
273
292
  if (!response.ok) {
274
293
  const errorBody = await response.text();
294
+ notifyParentError(response.status, errorBody);
275
295
  throw new SeacloudError(
276
296
  `HTTP ${response.status}: ${errorBody}`,
277
297
  response.status,
@@ -376,6 +396,7 @@ async function llmChatCompletions(params) {
376
396
  clearTimeout(timeoutId);
377
397
  if (!response.ok) {
378
398
  const errorBody = await response.text();
399
+ notifyParentError(response.status, errorBody);
379
400
  throw new SeacloudError(
380
401
  `HTTP ${response.status}: ${errorBody}`,
381
402
  response.status,
@@ -471,6 +492,7 @@ async function agentChatCompletions(params) {
471
492
  clearTimeout(timeoutId);
472
493
  if (!response.ok) {
473
494
  const errorBody = await response.text();
495
+ notifyParentError(response.status, errorBody);
474
496
  throw new SeacloudError(
475
497
  `HTTP ${response.status}: ${errorBody}`,
476
498
  response.status,