@wrongstack/core 0.292.0 → 0.292.1
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/coordination/index.d.ts +1 -1
- package/dist/coordination/index.d.ts.map +1 -1
- package/dist/coordination/index.js +163 -39
- package/dist/coordination/index.js.map +3 -3
- package/dist/coordination/mailbox-http-router.d.ts +38 -0
- package/dist/coordination/mailbox-http-router.d.ts.map +1 -1
- package/dist/coordination/provider-status-tracker.d.ts.map +1 -1
- package/dist/core/fallback-model.d.ts.map +1 -1
- package/dist/defaults/index.js +5 -1
- package/dist/defaults/index.js.map +2 -2
- package/dist/execution/index.js +8 -1
- package/dist/execution/index.js.map +2 -2
- package/dist/execution/one-shot-llm.d.ts.map +1 -1
- package/dist/index.js +305 -139
- package/dist/index.js.map +4 -4
- package/dist/tools/index.js +8 -1
- package/dist/tools/index.js.map +2 -2
- package/dist/types/index.js +5 -1
- package/dist/types/index.js.map +2 -2
- package/dist/types/provider.d.ts.map +1 -1
- package/dist/utils/connectivity.d.ts +36 -0
- package/dist/utils/connectivity.d.ts.map +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +44 -11
- package/dist/utils/index.js.map +4 -4
- package/package.json +2 -2
package/dist/tools/index.js
CHANGED
|
@@ -2097,7 +2097,8 @@ function evaluateModelCalendar(rules, providerId, model, at = /* @__PURE__ */ ne
|
|
|
2097
2097
|
// src/types/provider.ts
|
|
2098
2098
|
var CONTEXT_OVERFLOW_RE = /context.length|context.window|maximum context|max.*tokens?.*exceeded|prompt is too long|too long|exceeds the context|\btokens\b.*exceed|too many tokens|reduce the length|resulted in \d+ tokens|input.{0,12}too (?:large|long)|context_length_exceeded/i;
|
|
2099
2099
|
var CONTENT_FILTER_RE = /content.(filter|policy|moderation)|safety (system|filter)/i;
|
|
2100
|
-
var QUOTA_EXHAUSTED_RE = /(?:insufficient|exhausted|depleted|exceeded|no|not enough)[-_\s]*(?:quota|credit|balance)|(?:quota|credit|balance)[-_\s]*(?:exhausted|depleted|exceeded|insufficient)|billing[_\s-]*(?:hard[_\s-]*)?limit|payment required|spending limit|plan limit/i;
|
|
2100
|
+
var QUOTA_EXHAUSTED_RE = /(?:insufficient|exhausted|depleted|exceeded|no|not enough)[-_\s]*(?:quota|credit|balance)|(?:quota|credit|balance)[-_\s]*(?:exhausted|depleted|exceeded|insufficient)|billing[_\s-]*(?:hard[_\s-]*)?limit|payment required|spending limit|plan limit|usage[-_\s]*limit[-_\s]*(?:reached|exceeded)/i;
|
|
2101
|
+
var RATE_LIMIT_EXCEEDED_RE = /rate[-_\s]*limit[-_\s]*exceeded/i;
|
|
2101
2102
|
function classifyProviderError(status, body, message) {
|
|
2102
2103
|
const type = body?.type;
|
|
2103
2104
|
const text = [message, body?.message, type, body?.raw].filter(Boolean).join("\n");
|
|
@@ -2105,6 +2106,9 @@ function classifyProviderError(status, body, message) {
|
|
|
2105
2106
|
if (status === 408) return "timeout";
|
|
2106
2107
|
if (status === 599) return "stream_hang";
|
|
2107
2108
|
if (status === 402 || QUOTA_EXHAUSTED_RE.test(text)) return "quota_exhausted";
|
|
2109
|
+
if (status === 429 && body?.message && RATE_LIMIT_EXCEEDED_RE.test(body.message)) {
|
|
2110
|
+
return "quota_exhausted";
|
|
2111
|
+
}
|
|
2108
2112
|
if (type === "rate_limit_error" || status === 429) return "rate_limit";
|
|
2109
2113
|
if (type === "overloaded_error" || status === 529) return "overloaded";
|
|
2110
2114
|
if (status >= 500) return "server";
|
|
@@ -2297,6 +2301,9 @@ var OneShotOrchestrator = class {
|
|
|
2297
2301
|
for (const entry of usableChain) {
|
|
2298
2302
|
if (!evaluateModelCalendar(config.modelAvailabilitySchedule, entry.providerId, entry.model).allowed)
|
|
2299
2303
|
continue;
|
|
2304
|
+
if (tracker && !tracker.isAvailable(entry.providerId, entry.model)) {
|
|
2305
|
+
continue;
|
|
2306
|
+
}
|
|
2300
2307
|
if (entry.providerId === provider.id && entry.model === target.model) continue;
|
|
2301
2308
|
let fbProvider;
|
|
2302
2309
|
try {
|