dsh-coding-subscription-oauth 0.5.2 → 0.5.4

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 (44) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/INSTALL.md +11 -11
  3. package/README.de.md +34 -9
  4. package/README.es.md +35 -9
  5. package/README.fr.md +35 -9
  6. package/README.ja.md +35 -9
  7. package/README.ko.md +35 -9
  8. package/README.md +34 -13
  9. package/README.pt-BR.md +35 -9
  10. package/README.ru.md +35 -9
  11. package/README.zh-CN.md +34 -13
  12. package/docs/02-architecture.md +4 -3
  13. package/docs/02-architecture.zh-CN.md +8 -3
  14. package/lib/adapter.d.ts.map +1 -1
  15. package/lib/alias-adapter.d.ts.map +1 -1
  16. package/lib/client.js +1 -1
  17. package/lib/client.js.map +4 -4
  18. package/lib/grok-errors.d.ts +13 -0
  19. package/lib/grok-errors.d.ts.map +1 -0
  20. package/lib/index.js +13 -3
  21. package/lib/index.js.map +3 -3
  22. package/media/settings_accounts.png +0 -0
  23. package/media/settings_capabilities.png +0 -0
  24. package/media/settings_gateway.png +0 -0
  25. package/media/settings_overview.png +0 -0
  26. package/package.json +2 -1
  27. package/src/adapter.ts +7 -2
  28. package/src/alias-adapter.ts +2 -1
  29. package/src/client/GrokBuildSettings.tsx +247 -1772
  30. package/src/client/api.ts +88 -0
  31. package/src/client/components/AboutTab.tsx +20 -0
  32. package/src/client/components/AccountsTab.tsx +224 -0
  33. package/src/client/components/CapabilitiesTab.tsx +214 -0
  34. package/src/client/components/CliPullPreview.tsx +107 -0
  35. package/src/client/components/GatewayTab.tsx +287 -0
  36. package/src/client/components/ProviderCard.tsx +322 -0
  37. package/src/client/components/SettingsTabs.tsx +65 -0
  38. package/src/client/constants.ts +206 -0
  39. package/src/client/display.ts +61 -0
  40. package/src/client/locales.ts +47 -15
  41. package/src/client/parsers.ts +386 -0
  42. package/src/client/styles.ts +180 -0
  43. package/src/client/types.ts +185 -0
  44. package/src/grok-errors.ts +24 -0
@@ -0,0 +1,13 @@
1
+ /**
2
+ * xAI / Grok Build error remapping.
3
+ * @module dsh-coding-subscription-oauth/grok-errors
4
+ */
5
+ export declare function isXaiCapacityError(detail: string): boolean;
6
+ export declare function remapXaiCapacityFailure(failure: {
7
+ message: string;
8
+ code: string;
9
+ }): {
10
+ message: string;
11
+ code: string;
12
+ };
13
+ //# sourceMappingURL=grok-errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grok-errors.d.ts","sourceRoot":"","sources":["../../src/grok-errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE1D;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IACpF,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACb,CAGA"}
package/lib/index.js CHANGED
@@ -25616,6 +25616,16 @@ import { PiAiAdapter } from "@deepseek-ai/dsh-llm-pi-ai";
25616
25616
  // src/alias-adapter.ts
25617
25617
  import { LlmAdapter, LlmError } from "@deepseek-ai/dsh-llm";
25618
25618
 
25619
+ // src/grok-errors.ts
25620
+ var XAI_CAPACITY = /\b(?:at\s+capacity|high\s+demand|priority\s+processing|overloaded)\b/i;
25621
+ function isXaiCapacityError(detail) {
25622
+ return XAI_CAPACITY.test(detail);
25623
+ }
25624
+ function remapXaiCapacityFailure(failure) {
25625
+ if (!isXaiCapacityError(failure.message)) return failure;
25626
+ return { ...failure, code: "RATE_LIMIT" };
25627
+ }
25628
+
25619
25629
  // src/kimi-errors.ts
25620
25630
  import { CONTEXT_WINDOW_EXCEEDED_CODE, isContextWindowExceededError } from "@deepseek-ai/dsh-llm";
25621
25631
  var KIMI_CONTEXT_CAPACITY = /\bsupports only\s+\d+\s*k\s+context\b/i;
@@ -25697,7 +25707,7 @@ var AliasLlmAdapter = class extends LlmAdapter {
25697
25707
  ...raw,
25698
25708
  reason: {
25699
25709
  ...raw.reason,
25700
- failure: remapAuthFailureIfContextOverflow(raw.reason.failure)
25710
+ failure: remapXaiCapacityFailure(remapAuthFailureIfContextOverflow(raw.reason.failure))
25701
25711
  }
25702
25712
  } : raw;
25703
25713
  if (!authFailureNotified && chunk.type === "finish" && chunk.reason.kind === "error" && chunk.reason.failure.code === "AUTH") {
@@ -26632,9 +26642,9 @@ function missingCredential(name2) {
26632
26642
  var MIN_OAUTH_VALIDITY_MS = 6e4;
26633
26643
  var CODING_OAUTH_RETRY_POLICY = {
26634
26644
  mode: "normal",
26635
- maxRetries: 2,
26645
+ maxRetries: 5,
26636
26646
  retryableCodes: ["EMPTY_RESPONSE", "RATE_LIMIT", "SERVER", "TIMEOUT", "TRANSPORT", "AUTH"],
26637
- backoff: { initialDelayMs: 500, maxDelayMs: 1e4, jitterRatio: 0.1 }
26647
+ backoff: { initialDelayMs: 5e3, maxDelayMs: 8e4, jitterRatio: 0.1 }
26638
26648
  };
26639
26649
  function profile(provider, displayName, piProvider, retryPolicy, headers) {
26640
26650
  return {