@router-for-me/pi-cliproxyapi-provider 1.4.19 → 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 -18
- 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?.();
|
|
@@ -943,24 +953,33 @@ export default async function (pi: ExtensionAPI): Promise<void> {
|
|
|
943
953
|
let notifiedStaleModelId: string | undefined;
|
|
944
954
|
|
|
945
955
|
const checkAndNotifyStaleModel = (ctx: ExtensionContext): void => {
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
(
|
|
950
|
-
(
|
|
951
|
-
|
|
952
|
-
|
|
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
|
+
);
|
|
953
964
|
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
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;
|
|
961
975
|
}
|
|
962
|
-
}
|
|
963
|
-
|
|
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;
|
|
964
983
|
}
|
|
965
984
|
};
|
|
966
985
|
|
|
@@ -1041,6 +1060,11 @@ export default async function (pi: ExtensionAPI): Promise<void> {
|
|
|
1041
1060
|
};
|
|
1042
1061
|
} catch (error) {
|
|
1043
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
|
+
}
|
|
1044
1068
|
if (options.forceRefresh) {
|
|
1045
1069
|
scheduleActiveRecovery();
|
|
1046
1070
|
}
|
package/package.json
CHANGED