@asiyst/sdk 0.1.19 → 0.1.21

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