@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/execution/index.js
CHANGED
|
@@ -3870,7 +3870,8 @@ function extractText2(result) {
|
|
|
3870
3870
|
// src/types/provider.ts
|
|
3871
3871
|
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;
|
|
3872
3872
|
var CONTENT_FILTER_RE = /content.(filter|policy|moderation)|safety (system|filter)/i;
|
|
3873
|
-
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;
|
|
3873
|
+
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;
|
|
3874
|
+
var RATE_LIMIT_EXCEEDED_RE = /rate[-_\s]*limit[-_\s]*exceeded/i;
|
|
3874
3875
|
function classifyProviderError(status, body, message) {
|
|
3875
3876
|
const type = body?.type;
|
|
3876
3877
|
const text = [message, body?.message, type, body?.raw].filter(Boolean).join("\n");
|
|
@@ -3878,6 +3879,9 @@ function classifyProviderError(status, body, message) {
|
|
|
3878
3879
|
if (status === 408) return "timeout";
|
|
3879
3880
|
if (status === 599) return "stream_hang";
|
|
3880
3881
|
if (status === 402 || QUOTA_EXHAUSTED_RE.test(text)) return "quota_exhausted";
|
|
3882
|
+
if (status === 429 && body?.message && RATE_LIMIT_EXCEEDED_RE.test(body.message)) {
|
|
3883
|
+
return "quota_exhausted";
|
|
3884
|
+
}
|
|
3881
3885
|
if (type === "rate_limit_error" || status === 429) return "rate_limit";
|
|
3882
3886
|
if (type === "overloaded_error" || status === 529) return "overloaded";
|
|
3883
3887
|
if (status >= 500) return "server";
|
|
@@ -15308,6 +15312,9 @@ var OneShotOrchestrator = class {
|
|
|
15308
15312
|
for (const entry of usableChain) {
|
|
15309
15313
|
if (!evaluateModelCalendar(config.modelAvailabilitySchedule, entry.providerId, entry.model).allowed)
|
|
15310
15314
|
continue;
|
|
15315
|
+
if (tracker && !tracker.isAvailable(entry.providerId, entry.model)) {
|
|
15316
|
+
continue;
|
|
15317
|
+
}
|
|
15311
15318
|
if (entry.providerId === provider.id && entry.model === target.model) continue;
|
|
15312
15319
|
let fbProvider;
|
|
15313
15320
|
try {
|