openfleet 0.3.14 → 0.3.15
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.js +9 -0
- package/dist/lib/fallback.d.ts +3 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1144,6 +1144,9 @@ function isCreditBalanceError(message) {
|
|
|
1144
1144
|
function isSessionInFallback(sessionID) {
|
|
1145
1145
|
return fallbackSessions.has(sessionID);
|
|
1146
1146
|
}
|
|
1147
|
+
function markSessionFallback(sessionID) {
|
|
1148
|
+
fallbackSessions.add(sessionID);
|
|
1149
|
+
}
|
|
1147
1150
|
function getFallbackModelOverride() {
|
|
1148
1151
|
const [providerID, modelID] = fallbackModel.split("/");
|
|
1149
1152
|
return { providerID, modelID };
|
|
@@ -1440,6 +1443,12 @@ function createTranscriptHooks(ctx) {
|
|
|
1440
1443
|
}
|
|
1441
1444
|
},
|
|
1442
1445
|
event: async ({ event }) => {
|
|
1446
|
+
if (event.type === "session.created") {
|
|
1447
|
+
const { info } = event.properties;
|
|
1448
|
+
if (info.parentID && isSessionInFallback(info.parentID)) {
|
|
1449
|
+
markSessionFallback(info.id);
|
|
1450
|
+
}
|
|
1451
|
+
}
|
|
1443
1452
|
if (event.type === "session.status") {
|
|
1444
1453
|
const { sessionID, status } = event.properties;
|
|
1445
1454
|
if (status.type === "retry" && isCreditBalanceError(status.message)) {
|
package/dist/lib/fallback.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { PluginInput } from "@opencode-ai/plugin";
|
|
2
2
|
/** Returns true if the message contains a known Anthropic credit balance error pattern. */
|
|
3
3
|
export declare function isCreditBalanceError(message: string): boolean;
|
|
4
|
-
/** Returns true if the given session has
|
|
4
|
+
/** Returns true if the given session or any ancestor has fallen back to the free model. */
|
|
5
5
|
export declare function isSessionInFallback(sessionID: string): boolean;
|
|
6
|
+
/** Marks a session as requiring fallback (used for child session propagation). */
|
|
7
|
+
export declare function markSessionFallback(sessionID: string): void;
|
|
6
8
|
/** Returns the fallback model split into providerID and modelID. */
|
|
7
9
|
export declare function getFallbackModelOverride(): {
|
|
8
10
|
providerID: string;
|