@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.
- package/CHANGELOG.md +27 -1
- package/dist/types/auth-broker/client.d.ts +6 -2
- package/dist/types/auth-broker/remote-store.d.ts +14 -2
- package/dist/types/auth-broker/types.d.ts +6 -0
- package/dist/types/auth-broker/wire-schemas.d.ts +19 -0
- package/dist/types/auth-gateway/server.d.ts +39 -5
- package/dist/types/auth-gateway/types.d.ts +16 -2
- package/dist/types/auth-storage.d.ts +116 -34
- package/dist/types/provider-models/openai-compat.d.ts +1 -0
- package/dist/types/provider-models/special.d.ts +2 -1
- package/dist/types/providers/kiro-api-key.d.ts +50 -0
- package/dist/types/providers/kiro-codewhisperer.d.ts +3 -0
- package/dist/types/providers/register-builtins.d.ts +12 -12
- package/dist/types/stream.d.ts +2 -1
- package/dist/types/types.d.ts +35 -24
- package/dist/types/utils/fallback-transport.d.ts +7 -0
- package/dist/types/utils/json-parse.d.ts +5 -3
- package/dist/types/utils/oauth/api-key-login.d.ts +4 -1
- package/dist/types/utils/oauth/api-key-validation.d.ts +12 -6
- package/dist/types/utils/oauth/commandcode.d.ts +1 -0
- package/dist/types/utils/oauth/types.d.ts +1 -1
- package/dist/types/utils/retry.d.ts +2 -0
- package/dist/types/utils/tool-call-healing.d.ts +4 -4
- package/package.json +3 -3
- package/src/auth-broker/client.ts +41 -13
- package/src/auth-broker/redact.ts +25 -1
- package/src/auth-broker/remote-store.ts +374 -115
- package/src/auth-broker/server.ts +131 -91
- package/src/auth-broker/types.ts +6 -0
- package/src/auth-broker/wire-schemas.ts +6 -0
- package/src/auth-gateway/server.ts +447 -79
- package/src/auth-gateway/types.ts +28 -2
- package/src/auth-storage.ts +742 -157
- package/src/cli.ts +1 -0
- package/src/model-thinking.ts +16 -0
- package/src/models.json +1054 -0
- package/src/models.ts +9 -1
- package/src/provider-models/descriptors.ts +3 -1
- package/src/provider-models/openai-compat.ts +41 -1
- package/src/provider-models/special.ts +15 -3
- package/src/providers/anthropic.ts +7 -1
- package/src/providers/azure-openai-responses.ts +4 -1
- package/src/providers/cursor.ts +256 -101
- package/src/providers/gitlab-duo.ts +18 -1
- package/src/providers/google-gemini-cli.ts +3 -0
- package/src/providers/google-shared.ts +3 -0
- package/src/providers/kiro-api-key.d.ts +50 -0
- package/src/providers/kiro-api-key.ts +786 -0
- package/src/providers/kiro-codewhisperer.d.ts +3 -0
- package/src/providers/kiro-codewhisperer.ts +34 -9
- package/src/providers/ollama.ts +3 -0
- package/src/providers/openai-codex-responses.ts +24 -6
- package/src/providers/openai-completions.ts +11 -1
- package/src/providers/openai-responses-shared.ts +23 -2
- package/src/providers/openai-responses.ts +10 -1
- package/src/providers/pi-native-client.ts +1 -0
- package/src/providers/pi-native-server.ts +24 -0
- package/src/providers/register-builtins.d.ts +12 -12
- package/src/providers/register-builtins.ts +16 -3
- package/src/stream.d.ts +2 -1
- package/src/stream.ts +180 -70
- package/src/types.d.ts +35 -24
- package/src/types.ts +40 -23
- package/src/utils/fallback-transport.d.ts +7 -0
- package/src/utils/fallback-transport.ts +21 -4
- package/src/utils/json-parse.d.ts +5 -3
- package/src/utils/json-parse.ts +6 -6
- package/src/utils/oauth/api-key-login.ts +13 -2
- package/src/utils/oauth/api-key-validation.ts +242 -41
- package/src/utils/oauth/commandcode.ts +17 -0
- package/src/utils/oauth/index.ts +20 -5
- package/src/utils/oauth/types.d.ts +1 -1
- package/src/utils/oauth/types.ts +1 -0
- package/src/utils/retry.d.ts +2 -0
- package/src/utils/retry.ts +15 -2
- package/src/utils/tool-call-healing.d.ts +4 -4
- 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 {};
|