@router-for-me/pi-cliproxyapi-provider 1.4.18 → 1.4.20
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 +42 -21
- package/package.json +1 -1
package/extensions/index.ts
CHANGED
|
@@ -122,7 +122,12 @@ class ModelRefreshCoordinator {
|
|
|
122
122
|
if (this.stopped) return;
|
|
123
123
|
void action().catch((error) => {
|
|
124
124
|
const message = error instanceof Error ? error.message : String(error);
|
|
125
|
-
|
|
125
|
+
if (message.includes("is stale after session replacement or reload")) {
|
|
126
|
+
this.clearRecovery();
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
// Suppressed: logging this into the TUI corrupts the display.
|
|
130
|
+
// The refresh path already reschedules the next attempt.
|
|
126
131
|
});
|
|
127
132
|
}, delay);
|
|
128
133
|
this.recoveryTimer.unref?.();
|
|
@@ -145,7 +150,12 @@ class ModelRefreshCoordinator {
|
|
|
145
150
|
if (this.stopped) return;
|
|
146
151
|
void snapshot.action().catch((error) => {
|
|
147
152
|
const message = error instanceof Error ? error.message : String(error);
|
|
148
|
-
|
|
153
|
+
if (message.includes("is stale after session replacement or reload")) {
|
|
154
|
+
this.clearRecovery();
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
// Suppressed: logging this into the TUI corrupts the display.
|
|
158
|
+
// The refresh path already reschedules the next attempt.
|
|
149
159
|
});
|
|
150
160
|
}, snapshot.delayMs);
|
|
151
161
|
this.recoveryTimer.unref?.();
|
|
@@ -913,9 +923,6 @@ export default async function (pi: ExtensionAPI): Promise<void> {
|
|
|
913
923
|
latestStaleModelIds = staleModels.map((m) => m.id);
|
|
914
924
|
|
|
915
925
|
if (staleModels.length > 0) {
|
|
916
|
-
logWarn(
|
|
917
|
-
`upstream catalog omitted ${staleModels.length} model(s) (${latestStaleModelIds.join(", ")}); retaining cached entries temporarily.`,
|
|
918
|
-
);
|
|
919
926
|
if (activeContext) {
|
|
920
927
|
checkAndNotifyStaleModel(activeContext);
|
|
921
928
|
}
|
|
@@ -946,24 +953,33 @@ export default async function (pi: ExtensionAPI): Promise<void> {
|
|
|
946
953
|
let notifiedStaleModelId: string | undefined;
|
|
947
954
|
|
|
948
955
|
const checkAndNotifyStaleModel = (ctx: ExtensionContext): void => {
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
(
|
|
953
|
-
(
|
|
954
|
-
|
|
955
|
-
|
|
956
|
+
try {
|
|
957
|
+
const currentModel = ctx.model;
|
|
958
|
+
const configured = loadConfiguredDefaultSettings(agentDir);
|
|
959
|
+
const affectedStaleId = latestStaleModelIds.find(
|
|
960
|
+
(staleId) =>
|
|
961
|
+
(currentModel && currentModel.provider === identity.providerId && currentModel.id === staleId) ||
|
|
962
|
+
isModelReferencedAsDefault(configured, staleId, identity.providerId),
|
|
963
|
+
);
|
|
956
964
|
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
965
|
+
if (affectedStaleId) {
|
|
966
|
+
if (notifiedStaleModelId !== affectedStaleId) {
|
|
967
|
+
notifiedStaleModelId = affectedStaleId;
|
|
968
|
+
ctx.ui.notify(
|
|
969
|
+
`Model '${affectedStaleId}' is temporarily unavailable from upstream (retaining cached entry).`,
|
|
970
|
+
"warning",
|
|
971
|
+
);
|
|
972
|
+
}
|
|
973
|
+
} else {
|
|
974
|
+
notifiedStaleModelId = undefined;
|
|
964
975
|
}
|
|
965
|
-
}
|
|
966
|
-
|
|
976
|
+
} catch (error) {
|
|
977
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
978
|
+
if (message.includes("is stale after session replacement or reload")) {
|
|
979
|
+
activeContext = undefined;
|
|
980
|
+
return;
|
|
981
|
+
}
|
|
982
|
+
throw error;
|
|
967
983
|
}
|
|
968
984
|
};
|
|
969
985
|
|
|
@@ -1044,6 +1060,11 @@ export default async function (pi: ExtensionAPI): Promise<void> {
|
|
|
1044
1060
|
};
|
|
1045
1061
|
} catch (error) {
|
|
1046
1062
|
if (!modelRefreshCoordinator.isCurrent(refresh.generation)) return undefined;
|
|
1063
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1064
|
+
if (message.includes("is stale after session replacement or reload")) {
|
|
1065
|
+
modelRefreshCoordinator.clearRecovery();
|
|
1066
|
+
return undefined;
|
|
1067
|
+
}
|
|
1047
1068
|
if (options.forceRefresh) {
|
|
1048
1069
|
scheduleActiveRecovery();
|
|
1049
1070
|
}
|
package/package.json
CHANGED