@space3-npm/cybersoul-client 1.4.11 → 1.4.12

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.
Files changed (2) hide show
  1. package/dist/client.js +13 -1
  2. package/package.json +1 -1
package/dist/client.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { InteractRequestType, } from "./types.js";
2
2
  import { robustJsonParse } from "./utils/json.utils.js";
3
3
  import { GenericLLMProvider } from "./llm.provider.js";
4
- import { CyberSoulApiError, CyberSoulAuthError, CyberSoulInsufficientPointsError, CyberSoulNetworkError, CyberSoulTimeoutError, CyberSoulWalletError, } from "./errors.js";
4
+ import { CyberSoulApiError, CyberSoulAuthError, CyberSoulError, CyberSoulInsufficientPointsError, CyberSoulNetworkError, CyberSoulTimeoutError, CyberSoulWalletError, } from "./errors.js";
5
5
  export class CyberSoulClient {
6
6
  config;
7
7
  llm;
@@ -802,6 +802,14 @@ Note: Always include "isEndTurn". If "imageParams", "voiceArgs", "triggerEvent",
802
802
  };
803
803
  }
804
804
  catch (error) {
805
+ // Typed SDK errors (insufficient points, wallet failure, auth, etc.)
806
+ // are part of the public contract — let callers branch on
807
+ // `instanceof` instead of string-sniffing a generic status:"error"
808
+ // envelope. Only truly-unexpected throws fall back to the legacy
809
+ // envelope so we don't break callers that don't yet handle throws.
810
+ if (error instanceof CyberSoulError) {
811
+ throw error;
812
+ }
805
813
  console.error("[CyberSoulClient] Interface Error: ", error);
806
814
  return {
807
815
  status: "error",
@@ -1054,6 +1062,10 @@ If "shouldSkipProactive" is false, "textResponse" is required and "stateUpdate"
1054
1062
  };
1055
1063
  }
1056
1064
  catch (error) {
1065
+ // Mirror `interact()`: preserve typed SDK errors for the caller.
1066
+ if (error instanceof CyberSoulError) {
1067
+ throw error;
1068
+ }
1057
1069
  console.error("[CyberSoulClient] Proactive Interact Error: ", error);
1058
1070
  return { status: "error", error: error.message };
1059
1071
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@space3-npm/cybersoul-client",
3
- "version": "1.4.11",
3
+ "version": "1.4.12",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",