visionclaw 0.1.201 → 0.1.202-beta.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/agent/provider-fallback.d.ts +3 -0
- package/dist/agent/provider-fallback.d.ts.map +1 -1
- package/dist/agent/provider-fallback.js +28 -1
- package/dist/agent/provider-fallback.js.map +1 -1
- package/dist/agent/runtime-surface.js +6 -6
- package/dist/agent/runtime-surface.js.map +1 -1
- package/dist/agent/wake-cycle-runner.d.ts.map +1 -1
- package/dist/agent/wake-cycle-runner.js +19 -4
- package/dist/agent/wake-cycle-runner.js.map +1 -1
- package/dist/config/types.d.ts.map +1 -1
- package/dist/config/types.js +6 -6
- package/dist/config/types.js.map +1 -1
- package/dist/event-trigger/client.d.ts +5 -2
- package/dist/event-trigger/client.d.ts.map +1 -1
- package/dist/event-trigger/client.js.map +1 -1
- package/dist/factcheck/agent.d.ts +2 -2
- package/dist/factcheck/agent.d.ts.map +1 -1
- package/dist/factcheck/agent.js +13 -14
- package/dist/factcheck/agent.js.map +1 -1
- package/dist/factcheck/web-searcher.js +2 -2
- package/dist/factcheck/web-searcher.js.map +1 -1
- package/dist/onboarding/setup-shared.js +1 -1
- package/dist/onboarding/setup-shared.js.map +1 -1
- package/dist/realtime/tools.js +3 -3
- package/dist/realtime/tools.js.map +1 -1
- package/dist/tools/event-trigger.d.ts +8 -0
- package/dist/tools/event-trigger.d.ts.map +1 -1
- package/dist/tools/event-trigger.js +15 -8
- package/dist/tools/event-trigger.js.map +1 -1
- package/dist-agent/bundle.cjs +76 -39
- package/package.json +1 -1
package/dist-agent/bundle.cjs
CHANGED
|
@@ -14368,7 +14368,7 @@ var init_models = __esm({
|
|
|
14368
14368
|
|
|
14369
14369
|
// dist/config/types.js
|
|
14370
14370
|
function inferModelFromProvider(provider) {
|
|
14371
|
-
return provider === "openai" || provider === "azure-openai" ? GPT_MODEL : CLAUDE_SONNET_MODEL;
|
|
14371
|
+
return provider === "openai" || provider === "azure-openai" || provider === "9router" ? GPT_MODEL : CLAUDE_SONNET_MODEL;
|
|
14372
14372
|
}
|
|
14373
14373
|
function getSupportedProvidersForModel(model) {
|
|
14374
14374
|
return MODEL_PROVIDER_COMPATIBILITY[model];
|
|
@@ -14467,8 +14467,8 @@ var init_types = __esm({
|
|
|
14467
14467
|
CLAUDE_OPUS_4_6_MODEL,
|
|
14468
14468
|
CLAUDE_SONNET_MODEL,
|
|
14469
14469
|
GPT_MODEL
|
|
14470
|
-
]).default(
|
|
14471
|
-
ProviderSchema = external_exports.enum(["anthropic", "bedrock", "vertex", "9router", "openai", "azure-openai"]).default("
|
|
14470
|
+
]).default(GPT_MODEL);
|
|
14471
|
+
ProviderSchema = external_exports.enum(["anthropic", "bedrock", "vertex", "9router", "openai", "azure-openai"]).default("9router");
|
|
14472
14472
|
MODEL_PROVIDER_COMPATIBILITY = {
|
|
14473
14473
|
[CLAUDE_SONNET_MODEL]: ["anthropic", "bedrock", "vertex", "9router"],
|
|
14474
14474
|
[CLAUDE_OPUS_MODEL]: ["anthropic", "bedrock", "vertex", "9router"],
|
|
@@ -14551,9 +14551,9 @@ var init_types = __esm({
|
|
|
14551
14551
|
// Async Fact-Check Sidecar (issue #530). An independent, in-process sidecar
|
|
14552
14552
|
// that audits the main agent's recent tool-call history asynchronously and
|
|
14553
14553
|
// injects corrections (e.g. wrong market caps, mismatched tickers) before the
|
|
14554
|
-
// next reasoning step.
|
|
14554
|
+
// next reasoning step. Disabled by default; opt in per profile with /fact-check on.
|
|
14555
14555
|
factCheck: external_exports.object({
|
|
14556
|
-
enabled: external_exports.boolean().default(
|
|
14556
|
+
enabled: external_exports.boolean().default(false),
|
|
14557
14557
|
// Number of consecutive whitelisted (non-trivial) tool calls that fires
|
|
14558
14558
|
// a counter-based audit. Suggested 5 per the design.
|
|
14559
14559
|
triggerEveryNToolCalls: external_exports.number().int().positive().default(5),
|
|
@@ -14563,7 +14563,7 @@ var init_types = __esm({
|
|
|
14563
14563
|
// Hard cap on how long a single audit may run before it is abandoned.
|
|
14564
14564
|
auditTimeoutMs: external_exports.number().int().positive().default(12e4)
|
|
14565
14565
|
}).default({
|
|
14566
|
-
enabled:
|
|
14566
|
+
enabled: false,
|
|
14567
14567
|
triggerEveryNToolCalls: 5,
|
|
14568
14568
|
financialVerification: true,
|
|
14569
14569
|
auditTimeoutMs: 12e4
|
|
@@ -20670,7 +20670,7 @@ var require_prompts3 = __commonJS({
|
|
|
20670
20670
|
|
|
20671
20671
|
// dist/utils/version-check.js
|
|
20672
20672
|
function isBundled() {
|
|
20673
|
-
const v14 = "0.1.
|
|
20673
|
+
const v14 = "0.1.202-beta.1";
|
|
20674
20674
|
return typeof v14 === "string" && v14 !== "undefined";
|
|
20675
20675
|
}
|
|
20676
20676
|
function getPackageRoot() {
|
|
@@ -20687,7 +20687,7 @@ function getInstallationInfo() {
|
|
|
20687
20687
|
};
|
|
20688
20688
|
}
|
|
20689
20689
|
function getCurrentVersion() {
|
|
20690
|
-
const bundledVersion = "0.1.
|
|
20690
|
+
const bundledVersion = "0.1.202-beta.1";
|
|
20691
20691
|
if (bundledVersion && bundledVersion !== "undefined") {
|
|
20692
20692
|
return bundledVersion;
|
|
20693
20693
|
}
|
|
@@ -688412,7 +688412,7 @@ function buildVisionClawConfig(input) {
|
|
|
688412
688412
|
tunnelHostname
|
|
688413
688413
|
},
|
|
688414
688414
|
factCheck: {
|
|
688415
|
-
enabled:
|
|
688415
|
+
enabled: false,
|
|
688416
688416
|
triggerEveryNToolCalls: 5,
|
|
688417
688417
|
financialVerification: true,
|
|
688418
688418
|
auditTimeoutMs: 12e4
|
|
@@ -989964,7 +989964,7 @@ var init_event_trigger = __esm({
|
|
|
989964
989964
|
Unlike calendar reminders ("wake me at 9am"), event triggers fire when a condition becomes true \u2014 e.g. "wake me when TSLA drops to 350" or "alert me if BTC rises 5% intraday". The service monitors market data while you sleep and delivers a wake message when the condition fires; that message includes the price snapshot, the condition, and the trigger time.
|
|
989965
989965
|
|
|
989966
989966
|
Actions:
|
|
989967
|
-
- register: Create a market_price trigger. Provide symbol, field, operator, threshold.
|
|
989967
|
+
- register: Create a market_price trigger. Provide symbol, field, operator, threshold. For Polymarket, set market=polymarket and provide symbol/marketId/conditionId or tokenId, plus optional outcome=Yes/No.
|
|
989968
989968
|
- list: List your triggers (optionally filter by status).
|
|
989969
989969
|
- cancel: Delete a trigger by id.
|
|
989970
989970
|
|
|
@@ -989975,9 +989975,12 @@ Operators:
|
|
|
989975
989975
|
|
|
989976
989976
|
Use fireMode "once" (default) for a one-shot alert, or "repeat" (rate-limited by cooldownSeconds) for ongoing monitoring. Set cooldownSeconds to prevent repeated wakes near the threshold (default 3600). Optionally set expiresAt (ISO timestamp) and tradingHoursOnly (US regular hours).`, {
|
|
989977
989977
|
action: external_exports.enum(["register", "list", "cancel"]).describe("Action to perform"),
|
|
989978
|
-
symbol: external_exports.string().optional().describe("Ticker/symbol (e.g. TSLA, AAPL, 00700, 600519, BTC-USD) \u2014 for register"),
|
|
989979
|
-
|
|
989980
|
-
|
|
989978
|
+
symbol: external_exports.string().optional().describe("Ticker/symbol (e.g. TSLA, AAPL, 00700, 600519, BTC-USD); for Polymarket use market slug/id/conditionId \u2014 for register"),
|
|
989979
|
+
marketId: external_exports.string().optional().describe("Polymarket market slug/id/conditionId; equivalent to symbol for polymarket triggers"),
|
|
989980
|
+
tokenId: external_exports.string().optional().describe("Polymarket CLOB token id; may be used instead of outcome"),
|
|
989981
|
+
market: external_exports.enum(["US", "HK", "CN", "crypto", "futures", "polymarket"]).optional().describe("Market hint (auto-detected if omitted); use polymarket for prediction markets"),
|
|
989982
|
+
outcome: external_exports.enum(["Yes", "No"]).optional().describe("Polymarket outcome to monitor (default Yes)"),
|
|
989983
|
+
field: external_exports.enum(["last", "bid", "ask", "mid", "mark", "open", "close"]).optional().describe("Quote field to evaluate (default: last)"),
|
|
989981
989984
|
operator: external_exports.enum(["lte", "gte", "crosses_below", "crosses_above", "pct_change_lte", "pct_change_gte"]).optional().describe("Comparison operator \u2014 for register"),
|
|
989982
989985
|
threshold: external_exports.number().optional().describe("Threshold value (price, or percent for pct_change_* operators) \u2014 for register"),
|
|
989983
989986
|
fireMode: external_exports.enum(["once", "repeat"]).optional().describe("once (default) fires a single time; repeat keeps firing subject to cooldown"),
|
|
@@ -989997,14 +990000,18 @@ Use fireMode "once" (default) for a one-shot alert, or "repeat" (rate-limited by
|
|
|
989997
990000
|
try {
|
|
989998
990001
|
switch (args.action) {
|
|
989999
990002
|
case "register": {
|
|
990000
|
-
|
|
990001
|
-
|
|
990003
|
+
const triggerSymbol = args.symbol ?? args.marketId ?? args.tokenId;
|
|
990004
|
+
if (!triggerSymbol || !args.operator || args.threshold === void 0) {
|
|
990005
|
+
return err6("register requires symbol/marketId/tokenId, operator, and threshold.");
|
|
990002
990006
|
}
|
|
990003
990007
|
const input = {
|
|
990004
990008
|
condition: {
|
|
990005
990009
|
kind: "market_price",
|
|
990006
|
-
symbol:
|
|
990010
|
+
symbol: triggerSymbol,
|
|
990011
|
+
marketId: args.marketId,
|
|
990012
|
+
tokenId: args.tokenId,
|
|
990007
990013
|
market: args.market,
|
|
990014
|
+
outcome: args.outcome,
|
|
990008
990015
|
field: args.field ?? "last",
|
|
990009
990016
|
operator: args.operator,
|
|
990010
990017
|
threshold: args.threshold,
|
|
@@ -990357,7 +990364,7 @@ var init_browser_launcher = __esm({
|
|
|
990357
990364
|
|
|
990358
990365
|
// dist/utils/playwriter-relay.js
|
|
990359
990366
|
function isBundled2() {
|
|
990360
|
-
const v14 = "0.1.
|
|
990367
|
+
const v14 = "0.1.202-beta.1";
|
|
990361
990368
|
return typeof v14 === "string" && v14 !== "undefined";
|
|
990362
990369
|
}
|
|
990363
990370
|
function resolveRelayEntryPath() {
|
|
@@ -990392,7 +990399,7 @@ function getPm2RelayProcess() {
|
|
|
990392
990399
|
}
|
|
990393
990400
|
}
|
|
990394
990401
|
function pm2Start(entryPath, host, port) {
|
|
990395
|
-
const versionStr = "0.1.
|
|
990402
|
+
const versionStr = "0.1.202-beta.1";
|
|
990396
990403
|
(0, import_node_child_process19.execFileSync)("pm2", ["start", entryPath, "--name", PM2_PROCESS_NAME, "--update-env"], {
|
|
990397
990404
|
encoding: "utf-8",
|
|
990398
990405
|
stdio: "pipe",
|
|
@@ -990418,7 +990425,7 @@ function pm2Delete() {
|
|
|
990418
990425
|
}
|
|
990419
990426
|
}
|
|
990420
990427
|
function pm2Restart(host, port) {
|
|
990421
|
-
const versionStr = "0.1.
|
|
990428
|
+
const versionStr = "0.1.202-beta.1";
|
|
990422
990429
|
(0, import_node_child_process19.execFileSync)("pm2", ["restart", PM2_PROCESS_NAME, "--update-env"], {
|
|
990423
990430
|
encoding: "utf-8",
|
|
990424
990431
|
stdio: "pipe",
|
|
@@ -990588,7 +990595,7 @@ function reconcilePlaywriterRelay(host = "127.0.0.1", port = 19988) {
|
|
|
990588
990595
|
pm2Restart(host, port);
|
|
990589
990596
|
return;
|
|
990590
990597
|
}
|
|
990591
|
-
const currentVersion = "0.1.
|
|
990598
|
+
const currentVersion = "0.1.202-beta.1";
|
|
990592
990599
|
if (currentEnv.VISIONCLAW_VERSION && currentEnv.VISIONCLAW_VERSION !== currentVersion) {
|
|
990593
990600
|
logger.system(`Playwriter relay: VisionClaw version changed (${currentEnv.VISIONCLAW_VERSION} \u2192 ${currentVersion}), recreating`);
|
|
990594
990601
|
pm2Delete();
|
|
@@ -1319086,7 +1319093,7 @@ function openWebSearcher(config3) {
|
|
|
1319086
1319093
|
}
|
|
1319087
1319094
|
function buildSearchBaseUrl(apiKey) {
|
|
1319088
1319095
|
if (/^[0-9a-f]{32}$/.test(apiKey)) {
|
|
1319089
|
-
return "https://
|
|
1319096
|
+
return "https://serpapi.visionclaw.workers.dev/search";
|
|
1319090
1319097
|
}
|
|
1319091
1319098
|
return "https://serpapi.com/search";
|
|
1319092
1319099
|
}
|
|
@@ -1319339,7 +1319346,7 @@ ${snapshot}`,
|
|
|
1319339
1319346
|
timeoutMs,
|
|
1319340
1319347
|
signal
|
|
1319341
1319348
|
});
|
|
1319342
|
-
claims = prioritizeClaims(dedupeClaims(extraction.claims)).slice(0, MAX_CLAIMS_PER_AUDIT);
|
|
1319349
|
+
claims = prioritizeClaims(dedupeClaims(extraction.claims.filter((claim) => claim.isFinancial))).slice(0, MAX_CLAIMS_PER_AUDIT);
|
|
1319343
1319350
|
} catch (err9) {
|
|
1319344
1319351
|
logger.warn(`[factcheck] claim extraction failed: ${err9 instanceof Error ? err9.message : String(err9)}`);
|
|
1319345
1319352
|
return { findings: [], claimResults: [] };
|
|
@@ -1319613,11 +1319620,9 @@ function buildWebQuery(claim) {
|
|
|
1319613
1319620
|
}
|
|
1319614
1319621
|
function prioritizeClaims(claims) {
|
|
1319615
1319622
|
const score = (c13) => {
|
|
1319616
|
-
if (c13.
|
|
1319623
|
+
if (c13.symbols.length > 0)
|
|
1319617
1319624
|
return 2;
|
|
1319618
|
-
|
|
1319619
|
-
return 1;
|
|
1319620
|
-
return 0;
|
|
1319625
|
+
return 1;
|
|
1319621
1319626
|
};
|
|
1319622
1319627
|
return claims.map((claim, index2) => ({ claim, index: index2 })).sort((a13, b16) => score(b16.claim) - score(a13.claim) || a13.index - b16.index).map((entry) => entry.claim);
|
|
1319623
1319628
|
}
|
|
@@ -1319692,8 +1319697,8 @@ var init_agent3 = __esm({
|
|
|
1319692
1319697
|
to: external_exports.string().describe("End date of the window, as YYYY-MM-DD. For a single past date/month, use the last day of that period.")
|
|
1319693
1319698
|
});
|
|
1319694
1319699
|
ExtractedClaimSchema = external_exports.object({
|
|
1319695
|
-
claim: external_exports.string().describe("The factual assertion, quoted as closely as possible to the original text."),
|
|
1319696
|
-
isFinancial: external_exports.boolean().describe("
|
|
1319700
|
+
claim: external_exports.string().describe("The financial/market factual assertion, quoted as closely as possible to the original text."),
|
|
1319701
|
+
isFinancial: external_exports.boolean().describe("Must be true. Fact-check only handles financial/market claims."),
|
|
1319697
1319702
|
symbols: external_exports.array(external_exports.string()).describe("Ticker symbols or instrument codes referenced by the claim (e.g. AAPL, NVDA, 0700.HK, 600519). Empty if none."),
|
|
1319698
1319703
|
market: external_exports.enum(MARKET_VALUES).nullable().describe("Market hint for the symbols when known: A (China A-share), HK, US, or crypto. Null if unknown."),
|
|
1319699
1319704
|
historicalRange: HistoricalRangeSchema.nullable().describe('When the claim references a PAST price, close, or period return (e.g. "June 2025 close", "1-year return", "up 80% since last year"), the concrete date window to pull historical bars for. Null for current/real-time claims.'),
|
|
@@ -1319716,18 +1319721,19 @@ var init_agent3 = __esm({
|
|
|
1319716
1319721
|
MAX_BARS_FETCHES = 6;
|
|
1319717
1319722
|
EXTRACT_SYSTEM_PROMPT = [
|
|
1319718
1319723
|
"You are a fact-extraction component of a fact-checking system.",
|
|
1319719
|
-
"Extract concrete, verifiable factual claims that the agent itself asserted in its reasoning and messages.",
|
|
1319724
|
+
"Extract only concrete, verifiable financial/market factual claims that the agent itself asserted in its reasoning and messages.",
|
|
1319720
1319725
|
"These are the agent's own opinions/statements \u2014 not data it merely read from a tool. Each claim must be something the agent stated as fact.",
|
|
1319721
1319726
|
"",
|
|
1319722
|
-
"
|
|
1319727
|
+
"Ignore all non-financial factual claims, even if objectively verifiable. Focus only on financial/market assertions, including:",
|
|
1319723
1319728
|
"- Stock/ETF/crypto prices and percentage moves",
|
|
1319724
1319729
|
'- Market caps and rankings / comparisons ("A exceeds B", "A+B+C combined")',
|
|
1319725
1319730
|
"- Ticker \u2194 company-name / ETF-name mappings (especially A-share and HK numeric codes)",
|
|
1319726
1319731
|
"- Financial ratios (P/E, revenue, earnings)",
|
|
1319732
|
+
"- Macroeconomic or market-rate claims when tied to investable markets (rates, yields, FX, commodities, indexes)",
|
|
1319727
1319733
|
"- Option-chain claims, including option contract prices, expirations, strikes, calls/puts, implied volatility, Greeks, volume, and open interest",
|
|
1319728
1319734
|
"",
|
|
1319729
|
-
"Ignore: opinions, plans, instructions, questions, hedged statements, and anything not objectively verifiable.",
|
|
1319730
|
-
"
|
|
1319735
|
+
"Ignore: non-financial claims, opinions, plans, instructions, questions, hedged statements, and anything not objectively verifiable.",
|
|
1319736
|
+
"Every returned claim must have `isFinancial: true`. Populate `symbols` with the relevant tickers and set `market` when you can infer it",
|
|
1319731
1319737
|
"(A = China A-share, HK = Hong Kong, US = United States, crypto = cryptocurrency).",
|
|
1319732
1319738
|
'When a claim references a PAST price, close, or a period return (e.g. "June 2025 close", "1-year return",',
|
|
1319733
1319739
|
'"up 80% since last year"), set `historicalRange` to the concrete date window so historical price bars can be',
|
|
@@ -1319736,7 +1319742,7 @@ var init_agent3 = __esm({
|
|
|
1319736
1319742
|
"`historicalRange` to null for current/real-time claims (latest price, today's move) \u2014 those use live snapshots.",
|
|
1319737
1319743
|
"For option-chain claims, set `optionContract` with any contract dimensions stated in the claim: expiration (YYYY-MM-DD),",
|
|
1319738
1319744
|
"type (call/put/any), and strike. Leave unknown dimensions null; set `optionContract` to null for non-option claims.",
|
|
1319739
|
-
"If there are no verifiable
|
|
1319745
|
+
"If there are no verifiable financial/market claims, return an empty list."
|
|
1319740
1319746
|
].join("\n");
|
|
1319741
1319747
|
VERIFY_SINGLE_SYSTEM_PROMPT = [
|
|
1319742
1319748
|
"You are the verification component of a fact-checking system.",
|
|
@@ -1320721,7 +1320727,7 @@ async function buildBuiltinExternalMcpServers(config3, resolvedBrowserBackend) {
|
|
|
1320721
1320727
|
function buildSerpApiMcpUrl(apiKey) {
|
|
1320722
1320728
|
const trimmed = apiKey.trim();
|
|
1320723
1320729
|
if (/^[0-9a-f]{32}$/.test(trimmed)) {
|
|
1320724
|
-
return `https://
|
|
1320730
|
+
return `https://serpapi.visionclaw.workers.dev/${trimmed}/mcp`;
|
|
1320725
1320731
|
}
|
|
1320726
1320732
|
return `https://mcp.serpapi.com/${trimmed}/mcp`;
|
|
1320727
1320733
|
}
|
|
@@ -1331668,7 +1331674,7 @@ function memory(args) {
|
|
|
1331668
1331674
|
}
|
|
1331669
1331675
|
function buildSerpApiSearchBaseUrl(apiKey) {
|
|
1331670
1331676
|
if (/^[0-9a-f]{32}$/.test(apiKey)) {
|
|
1331671
|
-
return "https://
|
|
1331677
|
+
return "https://serpapi.visionclaw.workers.dev/search";
|
|
1331672
1331678
|
}
|
|
1331673
1331679
|
return "https://serpapi.com/search";
|
|
1331674
1331680
|
}
|
|
@@ -1393578,9 +1393584,11 @@ var ProviderFallbackManager = class {
|
|
|
1393578
1393584
|
config;
|
|
1393579
1393585
|
priorityList = [];
|
|
1393580
1393586
|
states = /* @__PURE__ */ new Map();
|
|
1393587
|
+
configScopeKey;
|
|
1393581
1393588
|
onSwitched = null;
|
|
1393582
1393589
|
constructor(config3) {
|
|
1393583
1393590
|
this.config = config3;
|
|
1393591
|
+
this.configScopeKey = this.getConfigScopeKey();
|
|
1393584
1393592
|
}
|
|
1393585
1393593
|
/**
|
|
1393586
1393594
|
* Register a callback to run after every provider switch performed by
|
|
@@ -1393617,6 +1393625,7 @@ var ProviderFallbackManager = class {
|
|
|
1393617
1393625
|
* effect cleanly.
|
|
1393618
1393626
|
*/
|
|
1393619
1393627
|
setPriorityList(serverPriority) {
|
|
1393628
|
+
this.resetIfConfigScopeChanged();
|
|
1393620
1393629
|
const parsed = [];
|
|
1393621
1393630
|
for (const candidate of serverPriority) {
|
|
1393622
1393631
|
const result = ProviderSchema.safeParse(candidate);
|
|
@@ -1393627,8 +1393636,14 @@ var ProviderFallbackManager = class {
|
|
|
1393627
1393636
|
continue;
|
|
1393628
1393637
|
parsed.push(p5);
|
|
1393629
1393638
|
}
|
|
1393630
|
-
if (parsed.length === 0)
|
|
1393639
|
+
if (parsed.length === 0) {
|
|
1393640
|
+
if (this.priorityList.length > 0) {
|
|
1393641
|
+
logger.system(`No compatible provider priority entries for model ${this.config.model}; clearing provider fallback state`);
|
|
1393642
|
+
}
|
|
1393643
|
+
this.priorityList = [];
|
|
1393644
|
+
this.states.clear();
|
|
1393631
1393645
|
return;
|
|
1393646
|
+
}
|
|
1393632
1393647
|
const changed = parsed.length !== this.priorityList.length || parsed.some((p5, i14) => p5 !== this.priorityList[i14]);
|
|
1393633
1393648
|
if (changed) {
|
|
1393634
1393649
|
if (this.priorityList.length > 0) {
|
|
@@ -1393639,9 +1393654,11 @@ var ProviderFallbackManager = class {
|
|
|
1393639
1393654
|
}
|
|
1393640
1393655
|
}
|
|
1393641
1393656
|
get activeProvider() {
|
|
1393657
|
+
this.resetIfConfigScopeChanged();
|
|
1393642
1393658
|
return this.config.provider;
|
|
1393643
1393659
|
}
|
|
1393644
1393660
|
get disabledProviders() {
|
|
1393661
|
+
this.resetIfConfigScopeChanged();
|
|
1393645
1393662
|
const now = Date.now();
|
|
1393646
1393663
|
const result = [];
|
|
1393647
1393664
|
for (const [provider, state4] of this.states) {
|
|
@@ -1393661,6 +1393678,7 @@ var ProviderFallbackManager = class {
|
|
|
1393661
1393678
|
* should be attempted.
|
|
1393662
1393679
|
*/
|
|
1393663
1393680
|
recordNetworkFailure() {
|
|
1393681
|
+
this.resetIfConfigScopeChanged();
|
|
1393664
1393682
|
const state4 = this.getOrCreateState(this.config.provider);
|
|
1393665
1393683
|
state4.consecutiveNetworkFailures++;
|
|
1393666
1393684
|
if (state4.consecutiveNetworkFailures >= NETWORK_FAILURE_THRESHOLD) {
|
|
@@ -1393670,6 +1393688,7 @@ var ProviderFallbackManager = class {
|
|
|
1393670
1393688
|
}
|
|
1393671
1393689
|
/** Reset the network failure counter for the current provider (on success). */
|
|
1393672
1393690
|
clearNetworkFailures() {
|
|
1393691
|
+
this.resetIfConfigScopeChanged();
|
|
1393673
1393692
|
const state4 = this.states.get(this.config.provider);
|
|
1393674
1393693
|
if (state4) {
|
|
1393675
1393694
|
state4.consecutiveNetworkFailures = 0;
|
|
@@ -1393680,6 +1393699,7 @@ var ProviderFallbackManager = class {
|
|
|
1393680
1393699
|
* Returns true if a switch was made, false if all providers are exhausted.
|
|
1393681
1393700
|
*/
|
|
1393682
1393701
|
disableAndSwitch(reason) {
|
|
1393702
|
+
this.resetIfConfigScopeChanged();
|
|
1393683
1393703
|
const current = this.config.provider;
|
|
1393684
1393704
|
const cooldownMs = reason === "auth" ? AUTH_COOLDOWN_MS : reason === "network" ? NETWORK_COOLDOWN_MS : SILENCE_COOLDOWN_MS;
|
|
1393685
1393705
|
const state4 = this.getOrCreateState(current);
|
|
@@ -1393723,6 +1393743,7 @@ var ProviderFallbackManager = class {
|
|
|
1393723
1393743
|
* priority list.
|
|
1393724
1393744
|
*/
|
|
1393725
1393745
|
resetAll() {
|
|
1393746
|
+
this.configScopeKey = this.getConfigScopeKey();
|
|
1393726
1393747
|
this.states.clear();
|
|
1393727
1393748
|
for (const provider of this.priorityList) {
|
|
1393728
1393749
|
if (hasProviderCredentials(provider, this.config)) {
|
|
@@ -1393748,8 +1393769,20 @@ var ProviderFallbackManager = class {
|
|
|
1393748
1393769
|
}
|
|
1393749
1393770
|
/** Whether the fallback manager has a priority list configured. */
|
|
1393750
1393771
|
get hasPriorityList() {
|
|
1393772
|
+
this.resetIfConfigScopeChanged();
|
|
1393751
1393773
|
return this.priorityList.length > 0;
|
|
1393752
1393774
|
}
|
|
1393775
|
+
getConfigScopeKey() {
|
|
1393776
|
+
return this.config.model;
|
|
1393777
|
+
}
|
|
1393778
|
+
resetIfConfigScopeChanged() {
|
|
1393779
|
+
const current = this.getConfigScopeKey();
|
|
1393780
|
+
if (current === this.configScopeKey)
|
|
1393781
|
+
return;
|
|
1393782
|
+
logger.system(`Provider fallback config scope changed: ${this.configScopeKey} \u2192 ${current} \u2014 clearing provider states`);
|
|
1393783
|
+
this.configScopeKey = current;
|
|
1393784
|
+
this.states.clear();
|
|
1393785
|
+
}
|
|
1393753
1393786
|
getOrCreateState(provider) {
|
|
1393754
1393787
|
let state4 = this.states.get(provider);
|
|
1393755
1393788
|
if (!state4) {
|
|
@@ -1399915,9 +1399948,8 @@ var WakeCycleRunner = class {
|
|
|
1399915
1399948
|
consecutiveErrors = 0;
|
|
1399916
1399949
|
continue wakeLoop;
|
|
1399917
1399950
|
}
|
|
1399918
|
-
|
|
1399919
|
-
|
|
1399920
|
-
await providerFallback.sleepAndReset();
|
|
1399951
|
+
logger.system("All provider fallbacks exhausted for transient silence; resetting provider states without all-unavailable notification");
|
|
1399952
|
+
providerFallback.resetAll();
|
|
1399921
1399953
|
consecutiveErrors = 0;
|
|
1399922
1399954
|
continue wakeLoop;
|
|
1399923
1399955
|
}
|
|
@@ -1400242,6 +1400274,11 @@ var WakeCycleRunner = class {
|
|
|
1400242
1400274
|
if (switched) {
|
|
1400243
1400275
|
return { kind: "continue_with_reset" };
|
|
1400244
1400276
|
}
|
|
1400277
|
+
if (reason !== "auth") {
|
|
1400278
|
+
logger.system(`All provider fallbacks exhausted for transient ${reason}; resetting provider states without all-unavailable notification`);
|
|
1400279
|
+
fallback2.resetAll();
|
|
1400280
|
+
return { kind: "continue_with_reset" };
|
|
1400281
|
+
}
|
|
1400245
1400282
|
const locale2 = resolveLocale(ownerConfig.language);
|
|
1400246
1400283
|
void notifyOwner(t8("llm.providers_exhausted", locale2), config3).catch((err9) => {
|
|
1400247
1400284
|
logger.warn(`Failed to send providers-exhausted notification: ${err9 instanceof Error ? err9.message : String(err9)}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "visionclaw",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.202-beta.1",
|
|
4
4
|
"description": "A personal assistant agent that runs on your desktop, receives commands from messaging channels, and executes tasks autonomously.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|