pi-freeflow 1.1.1 → 1.1.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/extensions/index.ts +15 -8
- package/package.json +1 -1
package/extensions/index.ts
CHANGED
|
@@ -160,7 +160,8 @@ function isRetriableStatus(status: number): boolean {
|
|
|
160
160
|
status === 408 ||
|
|
161
161
|
status === 402 ||
|
|
162
162
|
status === 403 ||
|
|
163
|
-
status === 500
|
|
163
|
+
status === 500 ||
|
|
164
|
+
status === 400
|
|
164
165
|
);
|
|
165
166
|
}
|
|
166
167
|
|
|
@@ -931,10 +932,13 @@ function normalizeRequestBody(
|
|
|
931
932
|
}
|
|
932
933
|
|
|
933
934
|
// 2. Reasoning normalization
|
|
935
|
+
const modelId = typeof body.model === "string" ? body.model : "";
|
|
936
|
+
const isResponsesApi = modelId === "muse-spark-1.2-contributor-free";
|
|
937
|
+
|
|
934
938
|
if (typeof body.reasoning_effort === "string") {
|
|
935
939
|
const re = body.reasoning_effort.toLowerCase();
|
|
936
940
|
if (re === "xhigh" || re === "max") {
|
|
937
|
-
body.reasoning_effort = "max";
|
|
941
|
+
body.reasoning_effort = isResponsesApi ? "xhigh" : (modelId === "x-preview-f-free" ? "max" : "xhigh");
|
|
938
942
|
} else if (re === "high" || re === "medium") {
|
|
939
943
|
body.reasoning_effort = "high";
|
|
940
944
|
} else if (re === "minimal") {
|
|
@@ -951,18 +955,21 @@ function normalizeRequestBody(
|
|
|
951
955
|
delete r.effort;
|
|
952
956
|
} else if (typeof r.effort === "string") {
|
|
953
957
|
const re = r.effort.toLowerCase();
|
|
954
|
-
if (re === "xhigh" || re === "max")
|
|
955
|
-
|
|
956
|
-
else if (re === "
|
|
957
|
-
|
|
958
|
+
if (re === "xhigh" || re === "max") {
|
|
959
|
+
r.effort = "xhigh"; // OpenCode Zen Responses API strictly requires "xhigh"
|
|
960
|
+
} else if (re === "high" || re === "medium") {
|
|
961
|
+
r.effort = "high";
|
|
962
|
+
} else if (re === "minimal") {
|
|
963
|
+
r.effort = "minimal";
|
|
964
|
+
} else {
|
|
965
|
+
r.effort = "low";
|
|
966
|
+
}
|
|
958
967
|
}
|
|
959
968
|
}
|
|
960
969
|
|
|
961
970
|
// 3. Max & Min tokens clamping (model-specific clamp + Vercel relay clamp)
|
|
962
|
-
const modelId = typeof body.model === "string" ? body.model : "";
|
|
963
971
|
const modelDef = MODEL_MAP.get(modelId);
|
|
964
972
|
const modelMax = modelDef?.maxTokens ?? RELAY_MAX_TOKENS;
|
|
965
|
-
|
|
966
973
|
const clampTokens = (val: number): number => {
|
|
967
974
|
let clamped = val;
|
|
968
975
|
if (!isKilo && clamped < 16) clamped = 16;
|