@gajae-code/ai 0.13.3 → 0.14.0
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 +45 -2
- package/dist/types/auth-broker/client.d.ts +9 -1
- package/dist/types/auth-broker/redact.d.ts +7 -0
- package/dist/types/auth-broker/remote-store.d.ts +50 -9
- package/dist/types/auth-broker/types.d.ts +14 -0
- package/dist/types/auth-broker/wire-schemas.d.ts +25 -0
- package/dist/types/auth-storage.d.ts +200 -6
- package/dist/types/core.d.ts +1 -0
- package/dist/types/model-cache.d.ts +4 -1
- package/dist/types/model-manager.d.ts +11 -0
- package/dist/types/provider-models/openai-compat.d.ts +5 -0
- package/dist/types/providers/anthropic.d.ts +31 -0
- package/dist/types/providers/cursor.d.ts +9 -1
- package/dist/types/providers/mock.d.ts +7 -1
- package/dist/types/providers/transform-messages.d.ts +18 -0
- package/dist/types/types.d.ts +28 -14
- package/dist/types/usage/grok-cli.d.ts +5 -0
- package/dist/types/usage.d.ts +6 -0
- package/dist/types/utils/discovery/openai-compatible.d.ts +5 -0
- package/dist/types/utils/event-stream.d.ts +4 -2
- package/dist/types/utils/fallback-transport.d.ts +10 -0
- package/dist/types/utils/http-inspector.d.ts +1 -0
- package/dist/types/utils/idle-iterator.d.ts +13 -1
- package/dist/types/utils/oauth/callback-server.d.ts +13 -0
- package/dist/types/utils/parse-bind.d.ts +8 -5
- package/dist/types/utils/tool-call-healing.d.ts +7 -0
- package/dist/types/utils/tool-choice-capability.d.ts +11 -0
- package/package.json +3 -2
- package/src/auth-broker/client.ts +30 -0
- package/src/auth-broker/redact.ts +15 -0
- package/src/auth-broker/refresher.ts +4 -2
- package/src/auth-broker/remote-store.ts +693 -70
- package/src/auth-broker/server.ts +57 -12
- package/src/auth-broker/types.ts +16 -0
- package/src/auth-broker/wire-schemas.ts +21 -0
- package/src/auth-gateway/server.ts +84 -19
- package/src/auth-storage.ts +985 -41
- package/src/core.ts +1 -0
- package/src/model-cache.ts +23 -4
- package/src/model-manager.ts +70 -11
- package/src/model-thinking.ts +21 -1
- package/src/models.json +1733 -392
- package/src/provider-models/descriptors.ts +5 -1
- package/src/provider-models/openai-compat.ts +52 -28
- package/src/providers/amazon-bedrock.ts +2 -1
- package/src/providers/anthropic.ts +824 -29
- package/src/providers/cursor.ts +83 -3
- package/src/providers/mock.ts +13 -3
- package/src/providers/ollama.ts +9 -2
- package/src/providers/openai-codex-responses.ts +16 -9
- package/src/providers/openai-completions.ts +5 -3
- package/src/providers/openai-responses-shared.ts +175 -21
- package/src/providers/register-builtins.ts +5 -2
- package/src/providers/transform-messages.ts +64 -1
- package/src/stream.ts +12 -2
- package/src/types.ts +28 -13
- package/src/usage/grok-cli.ts +86 -1
- package/src/usage.ts +7 -0
- package/src/utils/discovery/openai-compatible.ts +89 -4
- package/src/utils/event-stream.ts +11 -2
- package/src/utils/fallback-transport.ts +44 -2
- package/src/utils/http-inspector.ts +1 -0
- package/src/utils/idle-iterator.ts +29 -6
- package/src/utils/oauth/callback-server.ts +31 -1
- package/src/utils/parse-bind.ts +27 -0
- package/src/utils/tool-call-healing.ts +13 -2
- package/src/utils/tool-choice-capability.ts +386 -6
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
nanoGptModelManagerOptions,
|
|
33
33
|
nvidiaModelManagerOptions,
|
|
34
34
|
ollamaModelManagerOptions,
|
|
35
|
+
omlxModelManagerOptions,
|
|
35
36
|
openaiModelManagerOptions,
|
|
36
37
|
opencodeGoModelManagerOptions,
|
|
37
38
|
opencodeZenModelManagerOptions,
|
|
@@ -269,6 +270,9 @@ export const PROVIDER_DESCRIPTORS: readonly ProviderDescriptor[] = [
|
|
|
269
270
|
catalog("LiteLLM", ["LITELLM_API_KEY"], { allowUnauthenticated: true }),
|
|
270
271
|
),
|
|
271
272
|
descriptor("lm-studio", "llama-3-8b", config => lmStudioModelManagerOptions(config), { allowUnauthenticated: true }),
|
|
273
|
+
descriptor("omlx", "Qwen3.5-122B-A10B-Q4", config => omlxModelManagerOptions(config), {
|
|
274
|
+
allowUnauthenticated: true,
|
|
275
|
+
}),
|
|
272
276
|
catalogDescriptor(
|
|
273
277
|
"vllm",
|
|
274
278
|
"gpt-oss-20b",
|
|
@@ -341,7 +345,7 @@ export const PROVIDER_DESCRIPTORS: readonly ProviderDescriptor[] = [
|
|
|
341
345
|
config => maraModelManagerOptions(config),
|
|
342
346
|
catalog("Mara Cloud", ["MARA_API_KEY"]),
|
|
343
347
|
),
|
|
344
|
-
catalogDescriptor("zai", "glm-5.
|
|
348
|
+
catalogDescriptor("zai", "glm-5.3", config => zaiModelManagerOptions(config), catalog("zAI", ["ZAI_API_KEY"])),
|
|
345
349
|
catalogDescriptor(
|
|
346
350
|
"glm-zcode",
|
|
347
351
|
"glm-5.2",
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
fetchOpenAICompatibleModels,
|
|
9
9
|
type OpenAICompatibleModelMapperContext,
|
|
10
10
|
type OpenAICompatibleModelRecord,
|
|
11
|
+
resolveLoopbackOpenAIBaseUrl,
|
|
11
12
|
} from "../utils/discovery/openai-compatible";
|
|
12
13
|
import { toFireworksPublicModelId } from "../utils/fireworks-model-id";
|
|
13
14
|
import { getGitHubCopilotBaseUrl, OPENCODE_HEADERS, parseGitHubCopilotApiKey } from "../utils/oauth/github-copilot";
|
|
@@ -226,7 +227,6 @@ function mapLmStudioModel(
|
|
|
226
227
|
),
|
|
227
228
|
};
|
|
228
229
|
}
|
|
229
|
-
|
|
230
230
|
function normalizeAnthropicBaseUrl(baseUrl: string | undefined, fallback: string): string {
|
|
231
231
|
const value = baseUrl?.trim();
|
|
232
232
|
if (!value) {
|
|
@@ -1398,6 +1398,30 @@ export function lmStudioModelManagerOptions(
|
|
|
1398
1398
|
};
|
|
1399
1399
|
}
|
|
1400
1400
|
|
|
1401
|
+
// ---------------------------------------------------------------------------
|
|
1402
|
+
// 12.6. oMLX (Apple Silicon MLX Local Server)
|
|
1403
|
+
// ---------------------------------------------------------------------------
|
|
1404
|
+
|
|
1405
|
+
export interface OmlxModelManagerConfig {
|
|
1406
|
+
apiKey?: string;
|
|
1407
|
+
baseUrl?: string;
|
|
1408
|
+
}
|
|
1409
|
+
|
|
1410
|
+
export function omlxModelManagerOptions(config?: OmlxModelManagerConfig): ModelManagerOptions<"openai-completions"> {
|
|
1411
|
+
const apiKey = config?.apiKey;
|
|
1412
|
+
const baseUrl = resolveLoopbackOpenAIBaseUrl(config?.baseUrl ?? Bun.env.OMLX_BASE_URL, "http://127.0.0.1:8080/v1");
|
|
1413
|
+
return {
|
|
1414
|
+
providerId: "omlx",
|
|
1415
|
+
fetchDynamicModels: () =>
|
|
1416
|
+
fetchOpenAICompatibleModels({
|
|
1417
|
+
api: "openai-completions",
|
|
1418
|
+
provider: "omlx",
|
|
1419
|
+
baseUrl,
|
|
1420
|
+
apiKey,
|
|
1421
|
+
}),
|
|
1422
|
+
};
|
|
1423
|
+
}
|
|
1424
|
+
|
|
1401
1425
|
// ---------------------------------------------------------------------------
|
|
1402
1426
|
// 13. Synthetic
|
|
1403
1427
|
// ---------------------------------------------------------------------------
|
|
@@ -1977,36 +2001,36 @@ export function anthropicModelManagerOptions(
|
|
|
1977
2001
|
.then(payload => mapAnthropicModelsDev(payload, baseUrl))
|
|
1978
2002
|
.catch(() => []);
|
|
1979
2003
|
const references = buildAnthropicReferenceMap(modelsDevModels);
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
if (!reference) {
|
|
1994
|
-
return {
|
|
1995
|
-
...defaults,
|
|
1996
|
-
name: discoveredName,
|
|
1997
|
-
};
|
|
1998
|
-
}
|
|
2004
|
+
const models = await fetchOpenAICompatibleModels({
|
|
2005
|
+
api: "anthropic-messages",
|
|
2006
|
+
provider: "anthropic",
|
|
2007
|
+
baseUrl,
|
|
2008
|
+
headers: buildAnthropicDiscoveryHeaders(apiKey),
|
|
2009
|
+
mapModel: (
|
|
2010
|
+
entry: OpenAICompatibleModelRecord,
|
|
2011
|
+
defaults: Model<"anthropic-messages">,
|
|
2012
|
+
_context: OpenAICompatibleModelMapperContext<"anthropic-messages">,
|
|
2013
|
+
): Model<"anthropic-messages"> => {
|
|
2014
|
+
const discoveredName = typeof entry.display_name === "string" ? entry.display_name : defaults.name;
|
|
2015
|
+
const reference = references.get(defaults.id);
|
|
2016
|
+
if (!reference) {
|
|
1999
2017
|
return {
|
|
2000
|
-
...
|
|
2001
|
-
id: defaults.id,
|
|
2018
|
+
...defaults,
|
|
2002
2019
|
name: discoveredName,
|
|
2003
|
-
api: "anthropic-messages",
|
|
2004
|
-
provider: "anthropic",
|
|
2005
|
-
baseUrl,
|
|
2006
2020
|
};
|
|
2007
|
-
}
|
|
2008
|
-
|
|
2009
|
-
|
|
2021
|
+
}
|
|
2022
|
+
return {
|
|
2023
|
+
...reference,
|
|
2024
|
+
id: defaults.id,
|
|
2025
|
+
name: discoveredName,
|
|
2026
|
+
api: "anthropic-messages",
|
|
2027
|
+
provider: "anthropic",
|
|
2028
|
+
baseUrl,
|
|
2029
|
+
};
|
|
2030
|
+
},
|
|
2031
|
+
});
|
|
2032
|
+
if (models === null) return null;
|
|
2033
|
+
return models;
|
|
2010
2034
|
},
|
|
2011
2035
|
}),
|
|
2012
2036
|
};
|
|
@@ -36,7 +36,7 @@ import { normalizeToolCallId, resolveCacheRetention, sanitizeJsonStrings } from
|
|
|
36
36
|
import { AssistantMessageEventStream } from "../utils/event-stream";
|
|
37
37
|
import { transportFailureFacts } from "../utils/fallback-transport";
|
|
38
38
|
import { appendRawHttpRequestDumpFor400, type RawHttpRequestDump, withHttpStatus } from "../utils/http-inspector";
|
|
39
|
-
import { parseStreamingJson } from "../utils/json-parse";
|
|
39
|
+
import { findUnnecessaryUnicodeEscape, parseStreamingJson } from "../utils/json-parse";
|
|
40
40
|
import { resolveRetryBudget } from "../utils/retry-budget";
|
|
41
41
|
import { flattenToolRootCombinators, toolWireSchema } from "../utils/schema";
|
|
42
42
|
import {
|
|
@@ -597,6 +597,7 @@ function handleContentBlockStop(
|
|
|
597
597
|
break;
|
|
598
598
|
case "toolCall":
|
|
599
599
|
block.arguments = parseStreamingJson(block.partialJson);
|
|
600
|
+
if (findUnnecessaryUnicodeEscape(block.partialJson ?? "")) block.escapedNonAsciiArguments = true;
|
|
600
601
|
delete (block as Block).partialJson;
|
|
601
602
|
stream.push({ type: "toolcall_end", contentIndex: index, toolCall: block, partial: output });
|
|
602
603
|
break;
|