@asiyst/sdk 0.1.19 → 0.1.20

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.cjs CHANGED
@@ -73,7 +73,7 @@ var ALL_ACTION_KINDS = [
73
73
  // src/core/constants.ts
74
74
  function resolveSdkVersion() {
75
75
  {
76
- return "0.1.18";
76
+ return "0.1.19";
77
77
  }
78
78
  }
79
79
  var SDK_VERSION = resolveSdkVersion();
@@ -372,7 +372,11 @@ function validateInitOptions(options) {
372
372
  if (typeof options.publicKey !== "string" || !options.publicKey.trim()) {
373
373
  throw new ConfigurationError("publicKey is required");
374
374
  }
375
- if (projectIdValue.length > 128 || options.publicKey.trim().length > 256) {
375
+ const trimmedKey = options.publicKey.trim();
376
+ if (trimmedKey.startsWith("as_")) {
377
+ throw new ConfigurationError("Secret project API keys (as_...) must never be used in browser client code. Use the public project key.");
378
+ }
379
+ if (projectIdValue.length > 128 || trimmedKey.length > 256) {
376
380
  throw new ConfigurationError("project credentials exceed allowed length");
377
381
  }
378
382
  const avatarId = typeof options.avatarId === "string" ? options.avatarId.trim() : "";
@@ -669,6 +673,9 @@ var CloudClient = class {
669
673
  conversationId: this.conversationId
670
674
  }, "assistant:conversation");
671
675
  if (!response.ok || !response.data?.message?.text) {
676
+ if (response.status === 401 || response.status === 403) {
677
+ throw new NetworkError("AI request authorization failed. The project credentials may be inactive, revoked, or inaccessible.");
678
+ }
672
679
  throw new NetworkError("Conversation service is unavailable");
673
680
  }
674
681
  return response.data;