@prestyj/ai 4.13.3 → 5.0.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/dist/index.cjs +30 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +30 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -112,6 +112,7 @@ var PROVIDER_DISPLAY = {
|
|
|
112
112
|
moonshot: "Moonshot",
|
|
113
113
|
deepseek: "DeepSeek",
|
|
114
114
|
openrouter: "OpenRouter",
|
|
115
|
+
sakana: "Sakana",
|
|
115
116
|
xiaomi: "Xiaomi (MiMo)",
|
|
116
117
|
minimax: "MiniMax"
|
|
117
118
|
};
|
|
@@ -1020,8 +1021,12 @@ function toOpenAIToolChoice(choice) {
|
|
|
1020
1021
|
if (choice === "required") return "required";
|
|
1021
1022
|
return { type: "function", function: { name: choice.name } };
|
|
1022
1023
|
}
|
|
1023
|
-
function toOpenAIReasoningEffort(level,
|
|
1024
|
-
|
|
1024
|
+
function toOpenAIReasoningEffort(level, model) {
|
|
1025
|
+
const effort = level === "max" ? "xhigh" : level;
|
|
1026
|
+
if (model.startsWith("fugu") && (effort === "low" || effort === "medium")) {
|
|
1027
|
+
return "high";
|
|
1028
|
+
}
|
|
1029
|
+
return effort;
|
|
1025
1030
|
}
|
|
1026
1031
|
function normalizeAnthropicStopReason(reason) {
|
|
1027
1032
|
switch (reason) {
|
|
@@ -1144,7 +1149,13 @@ async function prewarmAnthropicCache(options) {
|
|
|
1144
1149
|
},
|
|
1145
1150
|
{
|
|
1146
1151
|
signal: options.signal ?? void 0,
|
|
1147
|
-
...
|
|
1152
|
+
...(() => {
|
|
1153
|
+
const betas = [
|
|
1154
|
+
...isOAuth ? ["claude-code-20250219", "oauth-2025-04-20"] : [],
|
|
1155
|
+
...cacheControl?.ttl === "1h" ? ["extended-cache-ttl-2025-04-11"] : []
|
|
1156
|
+
];
|
|
1157
|
+
return betas.length ? { headers: { "anthropic-beta": betas.join(",") } } : {};
|
|
1158
|
+
})()
|
|
1148
1159
|
}
|
|
1149
1160
|
);
|
|
1150
1161
|
} catch {
|
|
@@ -1228,7 +1239,12 @@ async function* runStream(options) {
|
|
|
1228
1239
|
...options.compaction ? ["compact-2026-01-12"] : [],
|
|
1229
1240
|
...options.clearToolUses ? ["context-management-2025-06-27"] : [],
|
|
1230
1241
|
"fine-grained-tool-streaming-2025-05-14",
|
|
1231
|
-
...!hasAdaptiveThinking ? ["interleaved-thinking-2025-05-14"] : []
|
|
1242
|
+
...!hasAdaptiveThinking ? ["interleaved-thinking-2025-05-14"] : [],
|
|
1243
|
+
// The 1-h cache TTL (cacheRetention "long") is gated behind this beta. Without
|
|
1244
|
+
// it Anthropic silently ignores ttl:"1h" and falls back to the 5-min default,
|
|
1245
|
+
// so a pre-warmed cache expires before the user's first turn. cacheControl.ttl
|
|
1246
|
+
// is only "1h" on the first-party endpoint (see toAnthropicCacheControl).
|
|
1247
|
+
...cacheControl?.ttl === "1h" ? ["extended-cache-ttl-2025-04-11"] : []
|
|
1232
1248
|
];
|
|
1233
1249
|
const requestOptions = {
|
|
1234
1250
|
signal: options.signal ?? void 0,
|
|
@@ -3184,6 +3200,16 @@ providerRegistry.register("openrouter", {
|
|
|
3184
3200
|
baseUrl: options.baseUrl ?? "https://openrouter.ai/api/v1"
|
|
3185
3201
|
})
|
|
3186
3202
|
});
|
|
3203
|
+
providerRegistry.register("sakana", {
|
|
3204
|
+
// Sakana Fugu is a multi-agent system exposed as a standard LLM through the
|
|
3205
|
+
// OpenAI-compatible Sakana API. We ride the Chat Completions transport (the
|
|
3206
|
+
// Responses API is also offered). Fugu models only accept "high"/"xhigh"
|
|
3207
|
+
// reasoning effort — clamped centrally in toOpenAIReasoningEffort.
|
|
3208
|
+
stream: (options) => streamOpenAI({
|
|
3209
|
+
...options,
|
|
3210
|
+
baseUrl: options.baseUrl ?? "https://api.sakana.ai/v1"
|
|
3211
|
+
})
|
|
3212
|
+
});
|
|
3187
3213
|
providerRegistry.register("minimax", {
|
|
3188
3214
|
stream: (options) => streamAnthropic({
|
|
3189
3215
|
...options,
|