@gajae-code/ai 0.15.4 → 0.15.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.
Files changed (77) hide show
  1. package/CHANGELOG.md +27 -1
  2. package/dist/types/auth-broker/client.d.ts +6 -2
  3. package/dist/types/auth-broker/remote-store.d.ts +14 -2
  4. package/dist/types/auth-broker/types.d.ts +6 -0
  5. package/dist/types/auth-broker/wire-schemas.d.ts +19 -0
  6. package/dist/types/auth-gateway/server.d.ts +39 -5
  7. package/dist/types/auth-gateway/types.d.ts +16 -2
  8. package/dist/types/auth-storage.d.ts +116 -34
  9. package/dist/types/provider-models/openai-compat.d.ts +1 -0
  10. package/dist/types/provider-models/special.d.ts +2 -1
  11. package/dist/types/providers/kiro-api-key.d.ts +50 -0
  12. package/dist/types/providers/kiro-codewhisperer.d.ts +3 -0
  13. package/dist/types/providers/register-builtins.d.ts +12 -12
  14. package/dist/types/stream.d.ts +2 -1
  15. package/dist/types/types.d.ts +35 -24
  16. package/dist/types/utils/fallback-transport.d.ts +7 -0
  17. package/dist/types/utils/json-parse.d.ts +5 -3
  18. package/dist/types/utils/oauth/api-key-login.d.ts +4 -1
  19. package/dist/types/utils/oauth/api-key-validation.d.ts +12 -6
  20. package/dist/types/utils/oauth/commandcode.d.ts +1 -0
  21. package/dist/types/utils/oauth/types.d.ts +1 -1
  22. package/dist/types/utils/retry.d.ts +2 -0
  23. package/dist/types/utils/tool-call-healing.d.ts +4 -4
  24. package/package.json +3 -3
  25. package/src/auth-broker/client.ts +41 -13
  26. package/src/auth-broker/redact.ts +25 -1
  27. package/src/auth-broker/remote-store.ts +374 -115
  28. package/src/auth-broker/server.ts +131 -91
  29. package/src/auth-broker/types.ts +6 -0
  30. package/src/auth-broker/wire-schemas.ts +6 -0
  31. package/src/auth-gateway/server.ts +447 -79
  32. package/src/auth-gateway/types.ts +28 -2
  33. package/src/auth-storage.ts +742 -157
  34. package/src/cli.ts +1 -0
  35. package/src/model-thinking.ts +16 -0
  36. package/src/models.json +1054 -0
  37. package/src/models.ts +9 -1
  38. package/src/provider-models/descriptors.ts +3 -1
  39. package/src/provider-models/openai-compat.ts +41 -1
  40. package/src/provider-models/special.ts +15 -3
  41. package/src/providers/anthropic.ts +7 -1
  42. package/src/providers/azure-openai-responses.ts +4 -1
  43. package/src/providers/cursor.ts +256 -101
  44. package/src/providers/gitlab-duo.ts +18 -1
  45. package/src/providers/google-gemini-cli.ts +3 -0
  46. package/src/providers/google-shared.ts +3 -0
  47. package/src/providers/kiro-api-key.d.ts +50 -0
  48. package/src/providers/kiro-api-key.ts +786 -0
  49. package/src/providers/kiro-codewhisperer.d.ts +3 -0
  50. package/src/providers/kiro-codewhisperer.ts +34 -9
  51. package/src/providers/ollama.ts +3 -0
  52. package/src/providers/openai-codex-responses.ts +24 -6
  53. package/src/providers/openai-completions.ts +11 -1
  54. package/src/providers/openai-responses-shared.ts +23 -2
  55. package/src/providers/openai-responses.ts +10 -1
  56. package/src/providers/pi-native-client.ts +1 -0
  57. package/src/providers/pi-native-server.ts +24 -0
  58. package/src/providers/register-builtins.d.ts +12 -12
  59. package/src/providers/register-builtins.ts +16 -3
  60. package/src/stream.d.ts +2 -1
  61. package/src/stream.ts +180 -70
  62. package/src/types.d.ts +35 -24
  63. package/src/types.ts +40 -23
  64. package/src/utils/fallback-transport.d.ts +7 -0
  65. package/src/utils/fallback-transport.ts +21 -4
  66. package/src/utils/json-parse.d.ts +5 -3
  67. package/src/utils/json-parse.ts +6 -6
  68. package/src/utils/oauth/api-key-login.ts +13 -2
  69. package/src/utils/oauth/api-key-validation.ts +242 -41
  70. package/src/utils/oauth/commandcode.ts +17 -0
  71. package/src/utils/oauth/index.ts +20 -5
  72. package/src/utils/oauth/types.d.ts +1 -1
  73. package/src/utils/oauth/types.ts +1 -0
  74. package/src/utils/retry.d.ts +2 -0
  75. package/src/utils/retry.ts +15 -2
  76. package/src/utils/tool-call-healing.d.ts +4 -4
  77. package/src/utils/tool-call-healing.ts +4 -4
@@ -180,6 +180,11 @@ const builtInOAuthProviders: OAuthProviderInfo[] = [
180
180
  name: "OpenCode Go",
181
181
  available: true,
182
182
  },
183
+ {
184
+ id: "commandcode-goat",
185
+ name: "Command Code GOAT",
186
+ available: true,
187
+ },
183
188
  {
184
189
  id: "openrouter",
185
190
  name: "OpenRouter",
@@ -400,6 +405,7 @@ export async function refreshOAuthToken(
400
405
  case "huggingface":
401
406
  case "opencode-zen":
402
407
  case "opencode-go":
408
+ case "commandcode-goat":
403
409
  case "cerebras":
404
410
  case "deepinfra":
405
411
  case "fireworks":
@@ -534,10 +540,19 @@ export function resolveOAuthStorageProvider(provider: OAuthProviderId): OAuthPro
534
540
  * Get list of OAuth providers.
535
541
  */
536
542
  export function getOAuthProviders(): OAuthProviderInfo[] {
537
- const customProviders = Array.from(customOAuthProviders.values(), provider => ({
538
- id: provider.id,
539
- name: provider.name,
540
- available: true,
541
- }));
543
+ const builtInIds = new Set(builtInOAuthProviders.map(provider => provider.id));
544
+ // A custom provider colliding with a built-in id (e.g. an external
545
+ // integration mistakenly registering "kiro") must never produce a
546
+ // duplicate list entry: AuthStorage.login()'s switch statement always
547
+ // dispatches a matched built-in `case` before falling through to the
548
+ // custom-provider registry, so the built-in always wins the route and
549
+ // the advertised list must reflect that, not double-list the id.
550
+ const customProviders = Array.from(customOAuthProviders.values())
551
+ .filter(provider => !builtInIds.has(provider.id))
552
+ .map(provider => ({
553
+ id: provider.id,
554
+ name: provider.name,
555
+ available: true,
556
+ }));
542
557
  return [...builtInOAuthProviders, ...customProviders];
543
558
  }
@@ -7,7 +7,7 @@ export type OAuthCredentials = {
7
7
  email?: string;
8
8
  accountId?: string;
9
9
  };
10
- export type OAuthProvider = "kiro" | "alibaba-token-plan" | "anthropic" | "bizrouter" | "mara" | "cerebras" | "cloudflare-ai-gateway" | "cursor" | "deepseek" | "deepinfra" | "fireworks" | "firepass" | "fugu" | "github-copilot" | "google-gemini-cli" | "google-antigravity" | "gitlab-duo" | "huggingface" | "kimi-code" | "kilo" | "kagi" | "litellm" | "lm-studio" | "minimax-code" | "minimax-code-cn" | "moonshot" | "nvidia" | "nanogpt" | "ollama" | "ollama-cloud" | "openai-codex" | "openai-codex-device" | "opencode-go" | "opencode-zen" | "opengateway" | "openrouter" | "parallel" | "perplexity" | "qianfan" | "qwen-portal" | "sglang" | "synthetic" | "tavily" | "together" | "venice" | "vercel-ai-gateway" | "vllm" | "xai" | "glm-zcode" | "xiaomi" | "xiaomi-token-plan-sgp" | "xiaomi-token-plan-ams" | "xiaomi-token-plan-cn" | "zenmux" | "opencodex" | "zai";
10
+ export type OAuthProvider = "kiro" | "alibaba-token-plan" | "anthropic" | "bizrouter" | "mara" | "cerebras" | "cloudflare-ai-gateway" | "cursor" | "deepseek" | "deepinfra" | "fireworks" | "firepass" | "fugu" | "github-copilot" | "google-gemini-cli" | "google-antigravity" | "gitlab-duo" | "huggingface" | "kimi-code" | "kilo" | "kagi" | "litellm" | "lm-studio" | "minimax-code" | "minimax-code-cn" | "moonshot" | "nvidia" | "nanogpt" | "ollama" | "ollama-cloud" | "openai-codex" | "openai-codex-device" | "opencode-go" | "opencode-zen" | "commandcode-goat" | "opengateway" | "openrouter" | "parallel" | "perplexity" | "qianfan" | "qwen-portal" | "sglang" | "synthetic" | "tavily" | "together" | "venice" | "vercel-ai-gateway" | "vllm" | "xai" | "glm-zcode" | "xiaomi" | "xiaomi-token-plan-sgp" | "xiaomi-token-plan-ams" | "xiaomi-token-plan-cn" | "zenmux" | "opencodex" | "zai";
11
11
  export type OAuthProviderId = OAuthProvider | (string & {});
12
12
  export type OAuthPrompt = {
13
13
  message: string;
@@ -43,6 +43,7 @@ export type OAuthProvider =
43
43
  | "openai-codex-device"
44
44
  | "opencode-go"
45
45
  | "opencode-zen"
46
+ | "commandcode-goat"
46
47
  | "opengateway"
47
48
  | "openrouter"
48
49
  | "parallel"
@@ -24,4 +24,6 @@ export declare function callWithCopilotModelRetry<T>(fn: () => Promise<T>, optio
24
24
  signal?: AbortSignal;
25
25
  retryBaseDelayMs?: number;
26
26
  fallbackManaged?: boolean;
27
+ requestMaxRetries?: number;
28
+ disableProviderRetries?: boolean;
27
29
  }): Promise<T>;
@@ -34,9 +34,22 @@ const COPILOT_MODEL_RETRY_BASE_DELAY_MS = 400;
34
34
  */
35
35
  export async function callWithCopilotModelRetry<T>(
36
36
  fn: () => Promise<T>,
37
- options: { provider: string; signal?: AbortSignal; retryBaseDelayMs?: number; fallbackManaged?: boolean },
37
+ options: {
38
+ provider: string;
39
+ signal?: AbortSignal;
40
+ retryBaseDelayMs?: number;
41
+ fallbackManaged?: boolean;
42
+ requestMaxRetries?: number;
43
+ disableProviderRetries?: boolean;
44
+ },
38
45
  ): Promise<T> {
39
- if (options.provider !== "github-copilot" || options.fallbackManaged) return fn();
46
+ if (
47
+ options.provider !== "github-copilot" ||
48
+ options.fallbackManaged ||
49
+ options.requestMaxRetries === 0 ||
50
+ options.disableProviderRetries
51
+ )
52
+ return fn();
40
53
 
41
54
  let lastError: unknown;
42
55
  const retryBaseDelayMs = options.retryBaseDelayMs ?? COPILOT_MODEL_RETRY_BASE_DELAY_MS;
@@ -22,10 +22,10 @@ export interface HealedToolCall {
22
22
  readonly name: string;
23
23
  readonly arguments: string;
24
24
  /**
25
- * Whether the raw leaked payload spelled a printable non-ASCII character as a
26
- * `\uXXXX` escape. Captured BEFORE the normalizing round-trip below, which
27
- * decodes escapes into literal characters and would otherwise erase the only
28
- * evidence that the text is unverifiable.
25
+ * Whether the raw leaked payload carried unsafe Unicode argument data.
26
+ * Captured before the normalizing round-trip below, which would otherwise
27
+ * erase malformed escape evidence. Valid `\uXXXX` spellings decode
28
+ * canonically and leave this false.
29
29
  */
30
30
  readonly escapedNonAsciiArguments: boolean;
31
31
  readonly escapedUnicodeArgumentEvidence?: UnicodeEscapeEvidence;
@@ -40,10 +40,10 @@ export interface HealedToolCall {
40
40
  readonly name: string;
41
41
  readonly arguments: string;
42
42
  /**
43
- * Whether the raw leaked payload spelled a printable non-ASCII character as a
44
- * `\uXXXX` escape. Captured BEFORE the normalizing round-trip below, which
45
- * decodes escapes into literal characters and would otherwise erase the only
46
- * evidence that the text is unverifiable.
43
+ * Whether the raw leaked payload carried unsafe Unicode argument data.
44
+ * Captured before the normalizing round-trip below, which would otherwise
45
+ * erase malformed escape evidence. Valid `\uXXXX` spellings decode
46
+ * canonically and leave this false.
47
47
  */
48
48
  readonly escapedNonAsciiArguments: boolean;
49
49
  readonly escapedUnicodeArgumentEvidence?: UnicodeEscapeEvidence;