@gajae-code/ai 0.2.0 → 0.2.2
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 +14 -1
- package/dist/types/providers/anthropic.d.ts +4 -1
- package/dist/types/providers/openai-request-transform.d.ts +4 -0
- package/dist/types/providers/transform-messages.d.ts +3 -1
- package/dist/types/types.d.ts +15 -1
- package/package.json +2 -2
- package/src/models.json +770 -51
- package/src/provider-models/descriptors.ts +1 -0
- package/src/providers/anthropic.ts +48 -4
- package/src/providers/google-gemini-headers.ts +1 -1
- package/src/providers/openai-completions.ts +18 -3
- package/src/providers/openai-request-transform.ts +135 -0
- package/src/providers/openai-responses.ts +21 -3
- package/src/providers/transform-messages.ts +17 -7
- package/src/stream.ts +1 -0
- package/src/types.ts +17 -0
- package/src/utils/http-inspector.ts +36 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.2.2] - 2026-05-31
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- Fixed Anthropic extended-thinking replay after aborted turns by dropping partial `thinking`/`redacted_thinking` blocks before the next request, preserving/synthesizing matching tool results, and retrying once with repaired latest-assistant thinking when Anthropic rejects a replay with the immutable-thinking HTTP 400 ([#107](https://github.com/Yeachan-Heo/gajae-code/issues/107)).
|
|
10
|
+
- Fixed first-class `azure-openai` catalog models so normal provider auth resolution reads `AZURE_OPENAI_API_KEY` when streaming `azure-openai/gpt-*` models.
|
|
11
|
+
|
|
12
|
+
## [0.2.1] - 2026-05-30
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
|
|
16
|
+
- Refreshed AI package metadata for the GJC 0.2.1 release.
|
|
17
|
+
|
|
5
18
|
## [0.2.0] - 2026-05-28
|
|
6
19
|
|
|
7
20
|
### Fixed
|
|
@@ -2660,4 +2673,4 @@ _Dedicated to Peter's shoulder ([@steipete](https://twitter.com/steipete))_
|
|
|
2660
2673
|
|
|
2661
2674
|
## [0.9.4] - 2025-11-26
|
|
2662
2675
|
|
|
2663
|
-
Initial release with multi-provider LLM support.
|
|
2676
|
+
Initial release with multi-provider LLM support.
|
|
@@ -26,6 +26,7 @@ type AnthropicCacheControl = {
|
|
|
26
26
|
*/
|
|
27
27
|
export declare function clearAnthropicFastModeFallback(providerSessionState: Map<string, ProviderSessionState> | undefined): void;
|
|
28
28
|
export declare function isAnthropicFastModeUnsupportedError(error: unknown): boolean;
|
|
29
|
+
export declare function isAnthropicThinkingBlockMutationError(error: unknown): boolean;
|
|
29
30
|
export declare const claudeCodeVersion = "2.1.63";
|
|
30
31
|
export declare const claudeToolPrefix: string;
|
|
31
32
|
export declare const claudeCodeSystemInstruction = "You are a Claude agent, built on Anthropic's Claude Agent SDK.";
|
|
@@ -163,7 +164,9 @@ type SystemBlockOptions = {
|
|
|
163
164
|
export declare function buildAnthropicSystemBlocks(systemPrompt: readonly string[] | undefined, options?: SystemBlockOptions): AnthropicSystemBlock[] | undefined;
|
|
164
165
|
export declare function normalizeExtraBetas(betas?: string[] | string): string[];
|
|
165
166
|
export declare function buildAnthropicClientOptions(args: AnthropicClientOptionsArgs): AnthropicClientOptionsResult;
|
|
166
|
-
export declare function convertAnthropicMessages(messages: Message[], model: Model<"anthropic-messages">, isOAuthToken: boolean
|
|
167
|
+
export declare function convertAnthropicMessages(messages: Message[], model: Model<"anthropic-messages">, isOAuthToken: boolean, options?: {
|
|
168
|
+
repairLatestAssistantThinking?: boolean;
|
|
169
|
+
}): MessageParam[];
|
|
167
170
|
/**
|
|
168
171
|
* Normalize a JSON Schema node for Anthropic tool `input_schema`.
|
|
169
172
|
*
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { FetchImpl, ModelRequestTransform } from "../types";
|
|
2
|
+
export declare function applyOpenAIRequestTransformHeaders(headers: Record<string, string>, transform: ModelRequestTransform | undefined, profileUserAgent: string): Record<string, string>;
|
|
3
|
+
export declare function applyOpenAIRequestTransformBody(params: object, transform: ModelRequestTransform | undefined): void;
|
|
4
|
+
export declare function wrapFetchForOpenAIRequestTransform(baseFetch: FetchImpl, transform: ModelRequestTransform | undefined, profileUserAgent: string): FetchImpl;
|
|
@@ -9,4 +9,6 @@ import type { Api, AssistantMessage, Message, Model } from "../types";
|
|
|
9
9
|
* - Injects synthetic "aborted" tool results
|
|
10
10
|
* - Adds a <turn-aborted> guidance marker for the model
|
|
11
11
|
*/
|
|
12
|
-
export declare function transformMessages<TApi extends Api>(messages: Message[], model: Model<TApi>, normalizeToolCallId?: (id: string, model: Model<TApi>, source: AssistantMessage) => string
|
|
12
|
+
export declare function transformMessages<TApi extends Api>(messages: Message[], model: Model<TApi>, normalizeToolCallId?: (id: string, model: Model<TApi>, source: AssistantMessage) => string, options?: {
|
|
13
|
+
repairLatestAssistantThinking?: boolean;
|
|
14
|
+
}): Message[];
|
package/dist/types/types.d.ts
CHANGED
|
@@ -48,7 +48,7 @@ export interface ThinkingConfig {
|
|
|
48
48
|
/** Provider-specific transport used to encode the selected effort. */
|
|
49
49
|
mode: ThinkingControlMode;
|
|
50
50
|
}
|
|
51
|
-
export type KnownProvider = "alibaba-coding-plan" | "amazon-bedrock" | "anthropic" | "google" | "google-gemini-cli" | "google-antigravity" | "google-vertex" | "openai" | "openai-codex" | "kimi-code" | "minimax-code" | "minimax-code-cn" | "github-copilot" | "fireworks" | "firepass" | "gitlab-duo" | "cursor" | "deepseek" | "xai" | "groq" | "cerebras" | "openrouter" | "kilo" | "vercel-ai-gateway" | "zai" | "mistral" | "minimax" | "opencode-go" | "opencode-zen" | "synthetic" | "cloudflare-ai-gateway" | "huggingface" | "litellm" | "moonshot" | "nvidia" | "nanogpt" | "ollama" | "ollama-cloud" | "qianfan" | "qwen-portal" | "together" | "venice" | "vllm" | "xiaomi" | "zenmux" | "lm-studio";
|
|
51
|
+
export type KnownProvider = "alibaba-coding-plan" | "amazon-bedrock" | "azure-openai" | "anthropic" | "google" | "google-gemini-cli" | "google-antigravity" | "google-vertex" | "openai" | "openai-codex" | "kimi-code" | "minimax-code" | "minimax-code-cn" | "github-copilot" | "fireworks" | "firepass" | "gitlab-duo" | "cursor" | "deepseek" | "xai" | "groq" | "cerebras" | "openrouter" | "kilo" | "vercel-ai-gateway" | "zai" | "mistral" | "minimax" | "opencode-go" | "opencode-zen" | "synthetic" | "cloudflare-ai-gateway" | "huggingface" | "litellm" | "moonshot" | "nvidia" | "nanogpt" | "ollama" | "ollama-cloud" | "qianfan" | "qwen-portal" | "together" | "venice" | "vllm" | "xiaomi" | "zenmux" | "lm-studio";
|
|
52
52
|
export type Provider = KnownProvider | string;
|
|
53
53
|
import type { Effort } from "./model-thinking";
|
|
54
54
|
/** Token budgets for each thinking level (token-based providers only) */
|
|
@@ -689,6 +689,16 @@ export interface VercelGatewayRouting {
|
|
|
689
689
|
/** List of provider slugs to try in order (e.g., ["anthropic", "openai"]). */
|
|
690
690
|
order?: string[];
|
|
691
691
|
}
|
|
692
|
+
export interface ModelRequestTransform {
|
|
693
|
+
/** Named request-shaping preset. `openai-proxy` removes OpenAI SDK telemetry headers and uses a generic Gajae-Code User-Agent. */
|
|
694
|
+
profile?: "openai-proxy";
|
|
695
|
+
/** Header names to remove from the final outbound request. Case-insensitive. */
|
|
696
|
+
stripHeaders?: string[];
|
|
697
|
+
/** Headers to set after stripping; use null to remove a header explicitly. */
|
|
698
|
+
setHeaders?: Record<string, string | null>;
|
|
699
|
+
/** Extra request body fields merged after provider defaults; protected core request keys are ignored. */
|
|
700
|
+
extraBody?: Record<string, unknown>;
|
|
701
|
+
}
|
|
692
702
|
export interface Model<TApi extends Api = any> {
|
|
693
703
|
id: string;
|
|
694
704
|
name: string;
|
|
@@ -727,6 +737,10 @@ export interface Model<TApi extends Api = any> {
|
|
|
727
737
|
preferWebsockets?: boolean;
|
|
728
738
|
/** Preferred model to switch to when context promotion is triggered (model id or provider/id). */
|
|
729
739
|
contextPromotionTarget?: string;
|
|
740
|
+
/** Provider-facing model id when it differs from the local selector id. */
|
|
741
|
+
wireModelId?: string;
|
|
742
|
+
/** Declarative request shaping for OpenAI-compatible proxy providers. */
|
|
743
|
+
requestTransform?: ModelRequestTransform;
|
|
730
744
|
/** Provider-assigned priority value (lower = higher priority). */
|
|
731
745
|
priority?: number;
|
|
732
746
|
/** Canonical thinking capability metadata for this model. */
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@gajae-code/ai",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.2",
|
|
5
5
|
"description": "Unified LLM API with automatic model discovery and provider configuration",
|
|
6
6
|
"homepage": "https://gaebal-gajae.dev",
|
|
7
7
|
"author": "Yeachan-Heo",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@anthropic-ai/sdk": "^0.94.0",
|
|
45
45
|
"@bufbuild/protobuf": "^2.12.0",
|
|
46
|
-
"@gajae-code/utils": "0.2.
|
|
46
|
+
"@gajae-code/utils": "0.2.2",
|
|
47
47
|
"openai": "^6.36.0",
|
|
48
48
|
"partial-json": "^0.1.7",
|
|
49
49
|
"zod": "4.4.3"
|