@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
@@ -921,6 +921,7 @@ export function streamGoogleGenAI<T extends "google-generative-ai" | "google-ver
921
921
  options.toolChoice !== "auto" &&
922
922
  options.toolChoice !== "none";
923
923
  const fetchImpl = plan.fetch ?? options?.fetch ?? (globalThis.fetch.bind(globalThis) as FetchImpl);
924
+ options?.onStreamCreated?.();
924
925
  let response = await fetchImpl(plan.url, {
925
926
  method: "POST",
926
927
  headers: { ...plan.headers, "Content-Type": "application/json", Accept: "text/event-stream" },
@@ -935,6 +936,7 @@ export function streamGoogleGenAI<T extends "google-generative-ai" | "google-ver
935
936
  );
936
937
  if (
937
938
  !options?.fallbackManaged &&
939
+ !options?.disableProviderRetries &&
938
940
  firstTokenTime === undefined &&
939
941
  isForcedToolChoiceUnsupportedError(error, true)
940
942
  ) {
@@ -957,6 +959,7 @@ export function streamGoogleGenAI<T extends "google-generative-ai" | "google-ver
957
959
  params = retryParams;
958
960
  rawRequestDump = { ...rawRequestDump, body: params };
959
961
  wireBody = paramsToWireBody(params);
962
+ options?.onStreamCreated?.();
960
963
  response = await fetchImpl(plan.url, {
961
964
  method: "POST",
962
965
  headers: { ...plan.headers, "Content-Type": "application/json", Accept: "text/event-stream" },
@@ -0,0 +1,50 @@
1
+ import type { Model, StreamFunction } from "../types";
2
+ export declare function isKiroApiKey(value: string | undefined): value is string;
3
+ export declare function kiroApiRegion(options?: {
4
+ region?: string;
5
+ }): string;
6
+ export declare function kiroApiBaseUrl(region: string): string;
7
+ export declare function toKiroModelId(modelId: string): string;
8
+ export declare function kiroApiStaticModels(): Model<"kiro-codewhisperer-stream">[];
9
+ /** Discover models this API key can use. Returns null when the key is missing. */
10
+ export declare function fetchKiroApiModels(apiKey: string, region?: string): Promise<Model<"kiro-codewhisperer-stream">[]>;
11
+ type KiroStreamEvent = {
12
+ type: "content";
13
+ data: string;
14
+ } | {
15
+ type: "toolUse";
16
+ data: {
17
+ name: string;
18
+ toolUseId: string;
19
+ input: string;
20
+ stop?: boolean;
21
+ };
22
+ } | {
23
+ type: "toolUseInput";
24
+ data: {
25
+ input: string;
26
+ };
27
+ } | {
28
+ type: "toolUseStop";
29
+ data: {
30
+ stop: boolean;
31
+ };
32
+ } | {
33
+ type: "usage";
34
+ data: {
35
+ inputTokens?: number;
36
+ outputTokens?: number;
37
+ };
38
+ } | {
39
+ type: "error";
40
+ data: {
41
+ error: string;
42
+ message?: string;
43
+ };
44
+ };
45
+ export declare function parseKiroApiEvents(buffer: string): {
46
+ events: KiroStreamEvent[];
47
+ remaining: string;
48
+ };
49
+ export declare const streamKiroApiKey: StreamFunction<"kiro-codewhisperer-stream">;
50
+ export {};