larkin 0.2.85 → 0.2.86
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.
|
@@ -850,8 +850,12 @@ async function createPiRpcBackend(input, dependencies, spawn) {
|
|
|
850
850
|
if (!available?.models?.length)
|
|
851
851
|
throw new Error("Pi has no authenticated available models. Run the official `pi` login flow or configure provider credentials; Larkin will not create a fallback session.");
|
|
852
852
|
const effectiveModel = state.model?.provider && state.model.id ? `${state.model.provider}/${state.model.id}` : null;
|
|
853
|
-
|
|
853
|
+
// pi 回报的是 provider/model 两段式;Larkin 配置允许只存 model 段(内置 Pi 单 provider)。
|
|
854
|
+
const effectiveMatches = (candidate) => effectiveModel === candidate
|
|
855
|
+
|| (effectiveModel ? effectiveModel.endsWith(`/${candidate}`) : false);
|
|
856
|
+
if (requestedModel && !effectiveMatches(requestedModel)) {
|
|
854
857
|
throw new Error(`Pi model fallback refused: requested ${requestedModel}, effective ${effectiveModel || "none"}`);
|
|
858
|
+
}
|
|
855
859
|
if (requestedEffort && state.thinkingLevel !== requestedEffort)
|
|
856
860
|
throw new Error(`Pi thinking level ${requestedEffort} was not accepted by effective model ${effectiveModel || "unknown"}`);
|
|
857
861
|
return new PiRpcBackend(client, state);
|