unbrowse 9.5.0 → 9.6.0
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/package.json +1 -1
- package/runtime/cli.js +106 -4
- package/runtime/mcp.js +214 -7
- package/vendor/kuri/darwin-arm64/libkuri_ffi.dylib +0 -0
- package/vendor/kuri/darwin-x64/libkuri_ffi.dylib +0 -0
- package/vendor/kuri/linux-arm64/libkuri_ffi.so +0 -0
- package/vendor/kuri/linux-x64/kuri +0 -0
- package/vendor/kuri/linux-x64/libkuri_ffi.so +0 -0
- package/vendor/kuri/manifest.json +7 -7
- package/vendor/kuri/win-x64/kuri.exe +0 -0
package/package.json
CHANGED
package/runtime/cli.js
CHANGED
|
@@ -2223,7 +2223,7 @@ var init_telemetry = __esm(() => {
|
|
|
2223
2223
|
});
|
|
2224
2224
|
|
|
2225
2225
|
// .tmp-runtime-src/build-info.generated.ts
|
|
2226
|
-
var BUILD_RELEASE_VERSION = "9.
|
|
2226
|
+
var BUILD_RELEASE_VERSION = "9.6.0", BUILD_GIT_SHA = "5b6b9dc9e8e1", BUILD_CODE_HASH = "5d9ebf619c61", BUILD_RELEASE_MANIFEST_BASE64 = "eyJzY2hlbWFfdmVyc2lvbiI6MSwicmVsZWFzZV92ZXJzaW9uIjoiOS42LjAiLCJnaXRfc2hhIjoiNWI2YjlkYzllOGUxIiwiY29kZV9oYXNoIjoiNWQ5ZWJmNjE5YzYxIiwidHJhY2VfdmVyc2lvbiI6IjVkOWViZjYxOWM2MUA1YjZiOWRjOWU4ZTEiLCJpc3N1ZWRfYXQiOiIyMDI2LTA2LTE3VDIyOjAyOjQ0LjA3MVoifQ", BUILD_RELEASE_MANIFEST_SIGNATURE = "MqIyb1B_GA8W5Nv_Jictwt1jVCCTgxxdIjUFJqLoeAU", BUILD_DEFAULT_BACKEND_URL = "https://beta-api.unbrowse.ai", BUILD_DEFAULT_PROFILE = "";
|
|
2227
2227
|
|
|
2228
2228
|
// .tmp-runtime-src/version.ts
|
|
2229
2229
|
import { createHash as createHash7 } from "crypto";
|
|
@@ -132128,6 +132128,35 @@ var init_mount = __esm(() => {
|
|
|
132128
132128
|
import { existsSync as existsSync33, writeFileSync as writeFileSync20, readFileSync as readFileSync28, mkdirSync as mkdirSync22, readdirSync as readdirSync9 } from "node:fs";
|
|
132129
132129
|
import { dirname as dirname7, join as join36 } from "node:path";
|
|
132130
132130
|
import { createHash as createHash19 } from "node:crypto";
|
|
132131
|
+
function registrableHost(u) {
|
|
132132
|
+
if (!u)
|
|
132133
|
+
return null;
|
|
132134
|
+
try {
|
|
132135
|
+
return new URL(u).hostname.replace(/^www\./, "").split(".").slice(-2).join(".");
|
|
132136
|
+
} catch {
|
|
132137
|
+
return null;
|
|
132138
|
+
}
|
|
132139
|
+
}
|
|
132140
|
+
function shouldAutoWalk(requestedUrl, topUrl, topScore, minScore = 0.8) {
|
|
132141
|
+
if (!topUrl)
|
|
132142
|
+
return false;
|
|
132143
|
+
const reqReg = registrableHost(requestedUrl);
|
|
132144
|
+
const topReg = registrableHost(topUrl);
|
|
132145
|
+
return !!reqReg && reqReg === topReg || (topScore ?? 0) >= minScore;
|
|
132146
|
+
}
|
|
132147
|
+
function pickWalkTarget(requestedUrl, ranked, minScore = 0.8) {
|
|
132148
|
+
const eligible = ranked.filter((c) => c?.url && shouldAutoWalk(requestedUrl, c.url, c.score, minScore));
|
|
132149
|
+
if (eligible.length === 0)
|
|
132150
|
+
return null;
|
|
132151
|
+
const hasPath = (u) => {
|
|
132152
|
+
try {
|
|
132153
|
+
return new URL(u).pathname.replace(/\/+$/, "").length > 0;
|
|
132154
|
+
} catch {
|
|
132155
|
+
return false;
|
|
132156
|
+
}
|
|
132157
|
+
};
|
|
132158
|
+
return eligible.find((c) => hasPath(c.url)) ?? eligible[0];
|
|
132159
|
+
}
|
|
132131
132160
|
function artifactResultWithShortlist(artifact, skillId, triggerUrl) {
|
|
132132
132161
|
const ep = artifact.endpoint;
|
|
132133
132162
|
const res = artifact.result;
|
|
@@ -132667,6 +132696,19 @@ function promoteResultSnapshot(cacheKey2, skill, endpointId, result, trace) {
|
|
|
132667
132696
|
expires: Date.now() + ROUTE_CACHE_TTL
|
|
132668
132697
|
});
|
|
132669
132698
|
}
|
|
132699
|
+
function persistWalkedRoute(scope, cacheKey2, walked) {
|
|
132700
|
+
try {
|
|
132701
|
+
const skill = walked.skill;
|
|
132702
|
+
if (!skill)
|
|
132703
|
+
return;
|
|
132704
|
+
const endpointId = walked.trace?.endpoint_id;
|
|
132705
|
+
const isReplayableRoute = (walked.source === "marketplace" || walked.source === "route-cache" || walked.source === "live-capture" || walked.source === "direct-fetch") && !!skill.endpoints?.length;
|
|
132706
|
+
if (isReplayableRoute) {
|
|
132707
|
+
promoteLearnedSkill(scope, cacheKey2, skill, endpointId, undefined);
|
|
132708
|
+
}
|
|
132709
|
+
promoteResultSnapshot(cacheKey2, skill, endpointId, walked.result, walked.trace);
|
|
132710
|
+
} catch {}
|
|
132711
|
+
}
|
|
132670
132712
|
function buildCachedResultResponse(cached4, source, timing) {
|
|
132671
132713
|
const now = new Date().toISOString();
|
|
132672
132714
|
return {
|
|
@@ -133812,6 +133854,7 @@ function resolveEndpointTemplateBindings(endpoint, params = {}, contextUrl) {
|
|
|
133812
133854
|
}
|
|
133813
133855
|
async function resolveAndExecute(intent, params = {}, context, projection, options) {
|
|
133814
133856
|
const t0 = Date.now();
|
|
133857
|
+
const walkDepth = options?.__walkDepth ?? 0;
|
|
133815
133858
|
const timing = {
|
|
133816
133859
|
search_ms: 0,
|
|
133817
133860
|
get_skill_ms: 0,
|
|
@@ -135361,7 +135404,7 @@ async function resolveAndExecute(intent, params = {}, context, projection, optio
|
|
|
135361
135404
|
}
|
|
135362
135405
|
} catch {}
|
|
135363
135406
|
}
|
|
135364
|
-
if (exaHits.length > 0) {
|
|
135407
|
+
if (walkDepth === 0 && exaHits.length > 0) {
|
|
135365
135408
|
const intentTokens = (queryIntent || "").toLowerCase().match(/[a-z0-9]{3,}/g) ?? [];
|
|
135366
135409
|
const stop2 = new Set(["get", "the", "for", "from", "with", "and", "any", "all", "new", "top", "top1", "top10"]);
|
|
135367
135410
|
const intentTokenSet = new Set(intentTokens.filter((t) => !stop2.has(t)));
|
|
@@ -135389,7 +135432,7 @@ async function resolveAndExecute(intent, params = {}, context, projection, optio
|
|
|
135389
135432
|
console.log(`[exa] raw-candidate mode (UNBROWSE_EXA_RAW=1): keeping ${exaHits.length} low-score hits for the agent to judge`);
|
|
135390
135433
|
}
|
|
135391
135434
|
}
|
|
135392
|
-
if (exaHits.length > 0) {
|
|
135435
|
+
if (walkDepth === 0 && exaHits.length > 0) {
|
|
135393
135436
|
const richHit = pickAnswerHit(exaHits, raceProbeDomain);
|
|
135394
135437
|
const candidates = exaHits.map((hit) => ({
|
|
135395
135438
|
url: hit.url,
|
|
@@ -135422,6 +135465,40 @@ async function resolveAndExecute(intent, params = {}, context, projection, optio
|
|
|
135422
135465
|
skill_id: "exa-web-search",
|
|
135423
135466
|
domain: exaSkillDomain
|
|
135424
135467
|
};
|
|
135468
|
+
const topWalk = pickWalkTarget(raceContextUrl, exaHits);
|
|
135469
|
+
if (topWalk?.url && walkDepth < 1) {
|
|
135470
|
+
try {
|
|
135471
|
+
const walked = await resolveAndExecute(intent, params, { url: topWalk.url, domain: registrableHost(topWalk.url) ?? undefined }, projection, { ...options ?? {}, __walkDepth: walkDepth + 1 });
|
|
135472
|
+
if (walked && walked.source !== "exa" && !walked.result?.exec_unsupported) {
|
|
135473
|
+
console.log(`[exa→walk] resolved candidate ${topWalk.url} via ${walked.source} (pointer pipe d${walkDepth + 1})`);
|
|
135474
|
+
{
|
|
135475
|
+
const wDom = context?.domain ?? (() => {
|
|
135476
|
+
try {
|
|
135477
|
+
return new URL(raceContextUrl).hostname;
|
|
135478
|
+
} catch {
|
|
135479
|
+
return null;
|
|
135480
|
+
}
|
|
135481
|
+
})();
|
|
135482
|
+
persistWalkedRoute(clientScope, scopedCacheKey(clientScope, buildResolveCacheKey(wDom ?? null, intent, raceContextUrl)), walked);
|
|
135483
|
+
}
|
|
135484
|
+
return {
|
|
135485
|
+
...walked,
|
|
135486
|
+
result: {
|
|
135487
|
+
...walked.result,
|
|
135488
|
+
walked_from: "exa-web-search",
|
|
135489
|
+
exa_candidates: candidates,
|
|
135490
|
+
run_plan: [
|
|
135491
|
+
{ step: "resolve", mode: "web-search", status: "hit", label: "fallback", error: null, source: webProvider ?? "exa" },
|
|
135492
|
+
{ step: "walk", mode: walked.source, status: "hit", label: "top-candidate", error: null, source: walked.source }
|
|
135493
|
+
]
|
|
135494
|
+
}
|
|
135495
|
+
};
|
|
135496
|
+
}
|
|
135497
|
+
console.log(`[exa→walk] candidate ${topWalk.url} produced no ladder rung — candidate leaf`);
|
|
135498
|
+
} catch (e) {
|
|
135499
|
+
console.log(`[exa→walk] walk error (${e.message}) — candidate leaf`);
|
|
135500
|
+
}
|
|
135501
|
+
}
|
|
135425
135502
|
return {
|
|
135426
135503
|
result: {
|
|
135427
135504
|
...richHit ? {
|
|
@@ -136198,7 +136275,7 @@ async function resolveAndExecute(intent, params = {}, context, projection, optio
|
|
|
136198
136275
|
console.log(`[ddg] $0 fallback failed: ${err.message}`);
|
|
136199
136276
|
}
|
|
136200
136277
|
}
|
|
136201
|
-
if (viable.length === 0 && exaResults?.length) {
|
|
136278
|
+
if (walkDepth === 0 && viable.length === 0 && exaResults?.length) {
|
|
136202
136279
|
const richHit = pickAnswerHit(exaResults, requestedDomain);
|
|
136203
136280
|
if (richHit) {
|
|
136204
136281
|
console.log(`[exa] returning highlights answer from ${richHit.url} (${(richHit.highlights ?? []).join(" ").length} chars) + ${exaResults.length} ranked candidate(s)`);
|
|
@@ -136221,6 +136298,31 @@ async function resolveAndExecute(intent, params = {}, context, projection, optio
|
|
|
136221
136298
|
fetch: `unbrowse fetch --url ${JSON.stringify(hit.url)}`
|
|
136222
136299
|
}
|
|
136223
136300
|
}));
|
|
136301
|
+
const topWalk = pickWalkTarget(context?.url, exaResults);
|
|
136302
|
+
if (topWalk?.url && walkDepth < 1) {
|
|
136303
|
+
try {
|
|
136304
|
+
const walked = await resolveAndExecute(intent, params, { url: topWalk.url, domain: registrableHost(topWalk.url) ?? undefined }, projection, { ...options ?? {}, __walkDepth: walkDepth + 1 });
|
|
136305
|
+
if (walked && walked.source !== "exa" && !walked.result?.exec_unsupported) {
|
|
136306
|
+
console.log(`[exa→walk] resolved candidate ${topWalk.url} via ${walked.source} (pointer pipe d${walkDepth + 1})`);
|
|
136307
|
+
persistWalkedRoute(clientScope, cacheKey2, walked);
|
|
136308
|
+
return {
|
|
136309
|
+
...walked,
|
|
136310
|
+
result: {
|
|
136311
|
+
...walked.result,
|
|
136312
|
+
walked_from: "exa-web-search",
|
|
136313
|
+
exa_candidates: candidates2,
|
|
136314
|
+
run_plan: [
|
|
136315
|
+
{ step: "resolve", mode: "web-search", status: "hit", label: "fallback", error: null, source: serialWebProvider ?? "exa" },
|
|
136316
|
+
{ step: "walk", mode: walked.source, status: "hit", label: "top-candidate", error: null, source: walked.source }
|
|
136317
|
+
]
|
|
136318
|
+
}
|
|
136319
|
+
};
|
|
136320
|
+
}
|
|
136321
|
+
console.log(`[exa→walk] candidate ${topWalk.url} produced no ladder rung — exa leaf`);
|
|
136322
|
+
} catch (e) {
|
|
136323
|
+
console.log(`[exa→walk] walk error (${e.message}) — exa leaf`);
|
|
136324
|
+
}
|
|
136325
|
+
}
|
|
136224
136326
|
return {
|
|
136225
136327
|
result: {
|
|
136226
136328
|
data: richHit.highlights,
|
package/runtime/mcp.js
CHANGED
|
@@ -36310,7 +36310,7 @@ var init_cached_resolution = __esm(() => {
|
|
|
36310
36310
|
});
|
|
36311
36311
|
|
|
36312
36312
|
// .tmp-runtime-src/build-info.generated.ts
|
|
36313
|
-
var BUILD_RELEASE_VERSION = "9.
|
|
36313
|
+
var BUILD_RELEASE_VERSION = "9.6.0", BUILD_GIT_SHA = "5b6b9dc9e8e1", BUILD_CODE_HASH = "5d9ebf619c61", BUILD_RELEASE_MANIFEST_BASE64 = "eyJzY2hlbWFfdmVyc2lvbiI6MSwicmVsZWFzZV92ZXJzaW9uIjoiOS42LjAiLCJnaXRfc2hhIjoiNWI2YjlkYzllOGUxIiwiY29kZV9oYXNoIjoiNWQ5ZWJmNjE5YzYxIiwidHJhY2VfdmVyc2lvbiI6IjVkOWViZjYxOWM2MUA1YjZiOWRjOWU4ZTEiLCJpc3N1ZWRfYXQiOiIyMDI2LTA2LTE3VDIyOjAyOjQ0LjA3MVoifQ", BUILD_RELEASE_MANIFEST_SIGNATURE = "MqIyb1B_GA8W5Nv_Jictwt1jVCCTgxxdIjUFJqLoeAU", BUILD_DEFAULT_BACKEND_URL = "https://beta-api.unbrowse.ai", BUILD_DEFAULT_PROFILE = "";
|
|
36314
36314
|
|
|
36315
36315
|
// .tmp-runtime-src/version.ts
|
|
36316
36316
|
import { createHash as createHash4 } from "crypto";
|
|
@@ -130540,6 +130540,35 @@ var init_mount = __esm(() => {
|
|
|
130540
130540
|
import { existsSync as existsSync27, writeFileSync as writeFileSync17, readFileSync as readFileSync23, mkdirSync as mkdirSync19, readdirSync as readdirSync8 } from "node:fs";
|
|
130541
130541
|
import { dirname as dirname6, join as join33 } from "node:path";
|
|
130542
130542
|
import { createHash as createHash14 } from "node:crypto";
|
|
130543
|
+
function registrableHost(u) {
|
|
130544
|
+
if (!u)
|
|
130545
|
+
return null;
|
|
130546
|
+
try {
|
|
130547
|
+
return new URL(u).hostname.replace(/^www\./, "").split(".").slice(-2).join(".");
|
|
130548
|
+
} catch {
|
|
130549
|
+
return null;
|
|
130550
|
+
}
|
|
130551
|
+
}
|
|
130552
|
+
function shouldAutoWalk(requestedUrl, topUrl, topScore, minScore = 0.8) {
|
|
130553
|
+
if (!topUrl)
|
|
130554
|
+
return false;
|
|
130555
|
+
const reqReg = registrableHost(requestedUrl);
|
|
130556
|
+
const topReg = registrableHost(topUrl);
|
|
130557
|
+
return !!reqReg && reqReg === topReg || (topScore ?? 0) >= minScore;
|
|
130558
|
+
}
|
|
130559
|
+
function pickWalkTarget(requestedUrl, ranked, minScore = 0.8) {
|
|
130560
|
+
const eligible = ranked.filter((c) => c?.url && shouldAutoWalk(requestedUrl, c.url, c.score, minScore));
|
|
130561
|
+
if (eligible.length === 0)
|
|
130562
|
+
return null;
|
|
130563
|
+
const hasPath = (u) => {
|
|
130564
|
+
try {
|
|
130565
|
+
return new URL(u).pathname.replace(/\/+$/, "").length > 0;
|
|
130566
|
+
} catch {
|
|
130567
|
+
return false;
|
|
130568
|
+
}
|
|
130569
|
+
};
|
|
130570
|
+
return eligible.find((c) => hasPath(c.url)) ?? eligible[0];
|
|
130571
|
+
}
|
|
130543
130572
|
function artifactResultWithShortlist(artifact, skillId, triggerUrl) {
|
|
130544
130573
|
const ep = artifact.endpoint;
|
|
130545
130574
|
const res = artifact.result;
|
|
@@ -131079,6 +131108,19 @@ function promoteResultSnapshot(cacheKey2, skill, endpointId, result, trace) {
|
|
|
131079
131108
|
expires: Date.now() + ROUTE_CACHE_TTL
|
|
131080
131109
|
});
|
|
131081
131110
|
}
|
|
131111
|
+
function persistWalkedRoute(scope, cacheKey2, walked) {
|
|
131112
|
+
try {
|
|
131113
|
+
const skill = walked.skill;
|
|
131114
|
+
if (!skill)
|
|
131115
|
+
return;
|
|
131116
|
+
const endpointId = walked.trace?.endpoint_id;
|
|
131117
|
+
const isReplayableRoute = (walked.source === "marketplace" || walked.source === "route-cache" || walked.source === "live-capture" || walked.source === "direct-fetch") && !!skill.endpoints?.length;
|
|
131118
|
+
if (isReplayableRoute) {
|
|
131119
|
+
promoteLearnedSkill(scope, cacheKey2, skill, endpointId, undefined);
|
|
131120
|
+
}
|
|
131121
|
+
promoteResultSnapshot(cacheKey2, skill, endpointId, walked.result, walked.trace);
|
|
131122
|
+
} catch {}
|
|
131123
|
+
}
|
|
131082
131124
|
function buildCachedResultResponse(cached4, source, timing) {
|
|
131083
131125
|
const now = new Date().toISOString();
|
|
131084
131126
|
return {
|
|
@@ -132224,6 +132266,7 @@ function resolveEndpointTemplateBindings(endpoint, params = {}, contextUrl) {
|
|
|
132224
132266
|
}
|
|
132225
132267
|
async function resolveAndExecute(intent, params = {}, context, projection, options) {
|
|
132226
132268
|
const t0 = Date.now();
|
|
132269
|
+
const walkDepth = options?.__walkDepth ?? 0;
|
|
132227
132270
|
const timing = {
|
|
132228
132271
|
search_ms: 0,
|
|
132229
132272
|
get_skill_ms: 0,
|
|
@@ -133773,7 +133816,7 @@ async function resolveAndExecute(intent, params = {}, context, projection, optio
|
|
|
133773
133816
|
}
|
|
133774
133817
|
} catch {}
|
|
133775
133818
|
}
|
|
133776
|
-
if (exaHits.length > 0) {
|
|
133819
|
+
if (walkDepth === 0 && exaHits.length > 0) {
|
|
133777
133820
|
const intentTokens = (queryIntent || "").toLowerCase().match(/[a-z0-9]{3,}/g) ?? [];
|
|
133778
133821
|
const stop2 = new Set(["get", "the", "for", "from", "with", "and", "any", "all", "new", "top", "top1", "top10"]);
|
|
133779
133822
|
const intentTokenSet = new Set(intentTokens.filter((t) => !stop2.has(t)));
|
|
@@ -133801,7 +133844,7 @@ async function resolveAndExecute(intent, params = {}, context, projection, optio
|
|
|
133801
133844
|
console.log(`[exa] raw-candidate mode (UNBROWSE_EXA_RAW=1): keeping ${exaHits.length} low-score hits for the agent to judge`);
|
|
133802
133845
|
}
|
|
133803
133846
|
}
|
|
133804
|
-
if (exaHits.length > 0) {
|
|
133847
|
+
if (walkDepth === 0 && exaHits.length > 0) {
|
|
133805
133848
|
const richHit = pickAnswerHit(exaHits, raceProbeDomain);
|
|
133806
133849
|
const candidates = exaHits.map((hit) => ({
|
|
133807
133850
|
url: hit.url,
|
|
@@ -133834,6 +133877,40 @@ async function resolveAndExecute(intent, params = {}, context, projection, optio
|
|
|
133834
133877
|
skill_id: "exa-web-search",
|
|
133835
133878
|
domain: exaSkillDomain
|
|
133836
133879
|
};
|
|
133880
|
+
const topWalk = pickWalkTarget(raceContextUrl, exaHits);
|
|
133881
|
+
if (topWalk?.url && walkDepth < 1) {
|
|
133882
|
+
try {
|
|
133883
|
+
const walked = await resolveAndExecute(intent, params, { url: topWalk.url, domain: registrableHost(topWalk.url) ?? undefined }, projection, { ...options ?? {}, __walkDepth: walkDepth + 1 });
|
|
133884
|
+
if (walked && walked.source !== "exa" && !walked.result?.exec_unsupported) {
|
|
133885
|
+
console.log(`[exa→walk] resolved candidate ${topWalk.url} via ${walked.source} (pointer pipe d${walkDepth + 1})`);
|
|
133886
|
+
{
|
|
133887
|
+
const wDom = context?.domain ?? (() => {
|
|
133888
|
+
try {
|
|
133889
|
+
return new URL(raceContextUrl).hostname;
|
|
133890
|
+
} catch {
|
|
133891
|
+
return null;
|
|
133892
|
+
}
|
|
133893
|
+
})();
|
|
133894
|
+
persistWalkedRoute(clientScope, scopedCacheKey(clientScope, buildResolveCacheKey(wDom ?? null, intent, raceContextUrl)), walked);
|
|
133895
|
+
}
|
|
133896
|
+
return {
|
|
133897
|
+
...walked,
|
|
133898
|
+
result: {
|
|
133899
|
+
...walked.result,
|
|
133900
|
+
walked_from: "exa-web-search",
|
|
133901
|
+
exa_candidates: candidates,
|
|
133902
|
+
run_plan: [
|
|
133903
|
+
{ step: "resolve", mode: "web-search", status: "hit", label: "fallback", error: null, source: webProvider ?? "exa" },
|
|
133904
|
+
{ step: "walk", mode: walked.source, status: "hit", label: "top-candidate", error: null, source: walked.source }
|
|
133905
|
+
]
|
|
133906
|
+
}
|
|
133907
|
+
};
|
|
133908
|
+
}
|
|
133909
|
+
console.log(`[exa→walk] candidate ${topWalk.url} produced no ladder rung — candidate leaf`);
|
|
133910
|
+
} catch (e) {
|
|
133911
|
+
console.log(`[exa→walk] walk error (${e.message}) — candidate leaf`);
|
|
133912
|
+
}
|
|
133913
|
+
}
|
|
133837
133914
|
return {
|
|
133838
133915
|
result: {
|
|
133839
133916
|
...richHit ? {
|
|
@@ -134610,7 +134687,7 @@ async function resolveAndExecute(intent, params = {}, context, projection, optio
|
|
|
134610
134687
|
console.log(`[ddg] $0 fallback failed: ${err.message}`);
|
|
134611
134688
|
}
|
|
134612
134689
|
}
|
|
134613
|
-
if (viable.length === 0 && exaResults?.length) {
|
|
134690
|
+
if (walkDepth === 0 && viable.length === 0 && exaResults?.length) {
|
|
134614
134691
|
const richHit = pickAnswerHit(exaResults, requestedDomain);
|
|
134615
134692
|
if (richHit) {
|
|
134616
134693
|
console.log(`[exa] returning highlights answer from ${richHit.url} (${(richHit.highlights ?? []).join(" ").length} chars) + ${exaResults.length} ranked candidate(s)`);
|
|
@@ -134633,6 +134710,31 @@ async function resolveAndExecute(intent, params = {}, context, projection, optio
|
|
|
134633
134710
|
fetch: `unbrowse fetch --url ${JSON.stringify(hit.url)}`
|
|
134634
134711
|
}
|
|
134635
134712
|
}));
|
|
134713
|
+
const topWalk = pickWalkTarget(context?.url, exaResults);
|
|
134714
|
+
if (topWalk?.url && walkDepth < 1) {
|
|
134715
|
+
try {
|
|
134716
|
+
const walked = await resolveAndExecute(intent, params, { url: topWalk.url, domain: registrableHost(topWalk.url) ?? undefined }, projection, { ...options ?? {}, __walkDepth: walkDepth + 1 });
|
|
134717
|
+
if (walked && walked.source !== "exa" && !walked.result?.exec_unsupported) {
|
|
134718
|
+
console.log(`[exa→walk] resolved candidate ${topWalk.url} via ${walked.source} (pointer pipe d${walkDepth + 1})`);
|
|
134719
|
+
persistWalkedRoute(clientScope, cacheKey2, walked);
|
|
134720
|
+
return {
|
|
134721
|
+
...walked,
|
|
134722
|
+
result: {
|
|
134723
|
+
...walked.result,
|
|
134724
|
+
walked_from: "exa-web-search",
|
|
134725
|
+
exa_candidates: candidates2,
|
|
134726
|
+
run_plan: [
|
|
134727
|
+
{ step: "resolve", mode: "web-search", status: "hit", label: "fallback", error: null, source: serialWebProvider ?? "exa" },
|
|
134728
|
+
{ step: "walk", mode: walked.source, status: "hit", label: "top-candidate", error: null, source: walked.source }
|
|
134729
|
+
]
|
|
134730
|
+
}
|
|
134731
|
+
};
|
|
134732
|
+
}
|
|
134733
|
+
console.log(`[exa→walk] candidate ${topWalk.url} produced no ladder rung — exa leaf`);
|
|
134734
|
+
} catch (e) {
|
|
134735
|
+
console.log(`[exa→walk] walk error (${e.message}) — exa leaf`);
|
|
134736
|
+
}
|
|
134737
|
+
}
|
|
134636
134738
|
return {
|
|
134637
134739
|
result: {
|
|
134638
134740
|
data: richHit.highlights,
|
|
@@ -236100,11 +236202,13 @@ __export(exports_orchestrator, {
|
|
|
236100
236202
|
shouldReuseRouteResultSnapshot: () => shouldReuseRouteResultSnapshot2,
|
|
236101
236203
|
shouldFallbackToLiveCaptureAfterAutoexecFailure: () => shouldFallbackToLiveCaptureAfterAutoexecFailure2,
|
|
236102
236204
|
shouldBypassLiveCaptureQueue: () => shouldBypassLiveCaptureQueue2,
|
|
236205
|
+
shouldAutoWalk: () => shouldAutoWalk2,
|
|
236103
236206
|
selectSkillIdsToHydrate: () => selectSkillIdsToHydrate2,
|
|
236104
236207
|
selectSearchTermsForExecution: () => selectSearchTermsForExecution2,
|
|
236105
236208
|
scopedCacheKey: () => scopedCacheKey2,
|
|
236106
236209
|
resolveEndpointTemplateBindings: () => resolveEndpointTemplateBindings2,
|
|
236107
236210
|
resolveAndExecute: () => resolveAndExecute2,
|
|
236211
|
+
registrableHost: () => registrableHost2,
|
|
236108
236212
|
readSkillSnapshot: () => readSkillSnapshot2,
|
|
236109
236213
|
readComposite: () => readComposite2,
|
|
236110
236214
|
pruneLocalCacheEntriesForSkill: () => pruneLocalCacheEntriesForSkill2,
|
|
@@ -236112,6 +236216,7 @@ __export(exports_orchestrator, {
|
|
|
236112
236216
|
probeLooksLikeFetchableHtmlDocument: () => probeLooksLikeFetchableHtmlDocument2,
|
|
236113
236217
|
probeLooksLikeDirectJsonApi: () => probeLooksLikeDirectJsonApi2,
|
|
236114
236218
|
planPrereqOrder: () => planPrereqOrder2,
|
|
236219
|
+
pickWalkTarget: () => pickWalkTarget2,
|
|
236115
236220
|
pickPreferredSkillSnapshot: () => pickPreferredSkillSnapshot2,
|
|
236116
236221
|
persistDomainCache: () => persistDomainCache2,
|
|
236117
236222
|
marketplaceSkillMatchesContext: () => marketplaceSkillMatchesContext2,
|
|
@@ -236143,6 +236248,35 @@ __export(exports_orchestrator, {
|
|
|
236143
236248
|
import { existsSync as existsSync60, writeFileSync as writeFileSync35, readFileSync as readFileSync49, mkdirSync as mkdirSync39, readdirSync as readdirSync17 } from "node:fs";
|
|
236144
236249
|
import { dirname as dirname15, join as join68 } from "node:path";
|
|
236145
236250
|
import { createHash as createHash48 } from "node:crypto";
|
|
236251
|
+
function registrableHost2(u) {
|
|
236252
|
+
if (!u)
|
|
236253
|
+
return null;
|
|
236254
|
+
try {
|
|
236255
|
+
return new URL(u).hostname.replace(/^www\./, "").split(".").slice(-2).join(".");
|
|
236256
|
+
} catch {
|
|
236257
|
+
return null;
|
|
236258
|
+
}
|
|
236259
|
+
}
|
|
236260
|
+
function shouldAutoWalk2(requestedUrl, topUrl, topScore, minScore = 0.8) {
|
|
236261
|
+
if (!topUrl)
|
|
236262
|
+
return false;
|
|
236263
|
+
const reqReg = registrableHost2(requestedUrl);
|
|
236264
|
+
const topReg = registrableHost2(topUrl);
|
|
236265
|
+
return !!reqReg && reqReg === topReg || (topScore ?? 0) >= minScore;
|
|
236266
|
+
}
|
|
236267
|
+
function pickWalkTarget2(requestedUrl, ranked, minScore = 0.8) {
|
|
236268
|
+
const eligible = ranked.filter((c) => c?.url && shouldAutoWalk2(requestedUrl, c.url, c.score, minScore));
|
|
236269
|
+
if (eligible.length === 0)
|
|
236270
|
+
return null;
|
|
236271
|
+
const hasPath = (u) => {
|
|
236272
|
+
try {
|
|
236273
|
+
return new URL(u).pathname.replace(/\/+$/, "").length > 0;
|
|
236274
|
+
} catch {
|
|
236275
|
+
return false;
|
|
236276
|
+
}
|
|
236277
|
+
};
|
|
236278
|
+
return eligible.find((c) => hasPath(c.url)) ?? eligible[0];
|
|
236279
|
+
}
|
|
236146
236280
|
function artifactResultWithShortlist2(artifact, skillId, triggerUrl) {
|
|
236147
236281
|
const ep = artifact.endpoint;
|
|
236148
236282
|
const res = artifact.result;
|
|
@@ -236682,6 +236816,19 @@ function promoteResultSnapshot2(cacheKey2, skill, endpointId, result, trace) {
|
|
|
236682
236816
|
expires: Date.now() + ROUTE_CACHE_TTL2
|
|
236683
236817
|
});
|
|
236684
236818
|
}
|
|
236819
|
+
function persistWalkedRoute2(scope, cacheKey2, walked) {
|
|
236820
|
+
try {
|
|
236821
|
+
const skill = walked.skill;
|
|
236822
|
+
if (!skill)
|
|
236823
|
+
return;
|
|
236824
|
+
const endpointId = walked.trace?.endpoint_id;
|
|
236825
|
+
const isReplayableRoute = (walked.source === "marketplace" || walked.source === "route-cache" || walked.source === "live-capture" || walked.source === "direct-fetch") && !!skill.endpoints?.length;
|
|
236826
|
+
if (isReplayableRoute) {
|
|
236827
|
+
promoteLearnedSkill2(scope, cacheKey2, skill, endpointId, undefined);
|
|
236828
|
+
}
|
|
236829
|
+
promoteResultSnapshot2(cacheKey2, skill, endpointId, walked.result, walked.trace);
|
|
236830
|
+
} catch {}
|
|
236831
|
+
}
|
|
236685
236832
|
function buildCachedResultResponse2(cached5, source, timing) {
|
|
236686
236833
|
const now = new Date().toISOString();
|
|
236687
236834
|
return {
|
|
@@ -237832,6 +237979,7 @@ function resolveEndpointTemplateBindings2(endpoint, params = {}, contextUrl) {
|
|
|
237832
237979
|
}
|
|
237833
237980
|
async function resolveAndExecute2(intent, params = {}, context, projection, options) {
|
|
237834
237981
|
const t0 = Date.now();
|
|
237982
|
+
const walkDepth = options?.__walkDepth ?? 0;
|
|
237835
237983
|
const timing = {
|
|
237836
237984
|
search_ms: 0,
|
|
237837
237985
|
get_skill_ms: 0,
|
|
@@ -239381,7 +239529,7 @@ async function resolveAndExecute2(intent, params = {}, context, projection, opti
|
|
|
239381
239529
|
}
|
|
239382
239530
|
} catch {}
|
|
239383
239531
|
}
|
|
239384
|
-
if (exaHits.length > 0) {
|
|
239532
|
+
if (walkDepth === 0 && exaHits.length > 0) {
|
|
239385
239533
|
const intentTokens = (queryIntent || "").toLowerCase().match(/[a-z0-9]{3,}/g) ?? [];
|
|
239386
239534
|
const stop2 = new Set(["get", "the", "for", "from", "with", "and", "any", "all", "new", "top", "top1", "top10"]);
|
|
239387
239535
|
const intentTokenSet = new Set(intentTokens.filter((t) => !stop2.has(t)));
|
|
@@ -239409,7 +239557,7 @@ async function resolveAndExecute2(intent, params = {}, context, projection, opti
|
|
|
239409
239557
|
console.log(`[exa] raw-candidate mode (UNBROWSE_EXA_RAW=1): keeping ${exaHits.length} low-score hits for the agent to judge`);
|
|
239410
239558
|
}
|
|
239411
239559
|
}
|
|
239412
|
-
if (exaHits.length > 0) {
|
|
239560
|
+
if (walkDepth === 0 && exaHits.length > 0) {
|
|
239413
239561
|
const richHit = pickAnswerHit(exaHits, raceProbeDomain);
|
|
239414
239562
|
const candidates = exaHits.map((hit) => ({
|
|
239415
239563
|
url: hit.url,
|
|
@@ -239442,6 +239590,40 @@ async function resolveAndExecute2(intent, params = {}, context, projection, opti
|
|
|
239442
239590
|
skill_id: "exa-web-search",
|
|
239443
239591
|
domain: exaSkillDomain
|
|
239444
239592
|
};
|
|
239593
|
+
const topWalk = pickWalkTarget2(raceContextUrl, exaHits);
|
|
239594
|
+
if (topWalk?.url && walkDepth < 1) {
|
|
239595
|
+
try {
|
|
239596
|
+
const walked = await resolveAndExecute2(intent, params, { url: topWalk.url, domain: registrableHost2(topWalk.url) ?? undefined }, projection, { ...options ?? {}, __walkDepth: walkDepth + 1 });
|
|
239597
|
+
if (walked && walked.source !== "exa" && !walked.result?.exec_unsupported) {
|
|
239598
|
+
console.log(`[exa→walk] resolved candidate ${topWalk.url} via ${walked.source} (pointer pipe d${walkDepth + 1})`);
|
|
239599
|
+
{
|
|
239600
|
+
const wDom = context?.domain ?? (() => {
|
|
239601
|
+
try {
|
|
239602
|
+
return new URL(raceContextUrl).hostname;
|
|
239603
|
+
} catch {
|
|
239604
|
+
return null;
|
|
239605
|
+
}
|
|
239606
|
+
})();
|
|
239607
|
+
persistWalkedRoute2(clientScope, scopedCacheKey2(clientScope, buildResolveCacheKey2(wDom ?? null, intent, raceContextUrl)), walked);
|
|
239608
|
+
}
|
|
239609
|
+
return {
|
|
239610
|
+
...walked,
|
|
239611
|
+
result: {
|
|
239612
|
+
...walked.result,
|
|
239613
|
+
walked_from: "exa-web-search",
|
|
239614
|
+
exa_candidates: candidates,
|
|
239615
|
+
run_plan: [
|
|
239616
|
+
{ step: "resolve", mode: "web-search", status: "hit", label: "fallback", error: null, source: webProvider ?? "exa" },
|
|
239617
|
+
{ step: "walk", mode: walked.source, status: "hit", label: "top-candidate", error: null, source: walked.source }
|
|
239618
|
+
]
|
|
239619
|
+
}
|
|
239620
|
+
};
|
|
239621
|
+
}
|
|
239622
|
+
console.log(`[exa→walk] candidate ${topWalk.url} produced no ladder rung — candidate leaf`);
|
|
239623
|
+
} catch (e) {
|
|
239624
|
+
console.log(`[exa→walk] walk error (${e.message}) — candidate leaf`);
|
|
239625
|
+
}
|
|
239626
|
+
}
|
|
239445
239627
|
return {
|
|
239446
239628
|
result: {
|
|
239447
239629
|
...richHit ? {
|
|
@@ -240218,7 +240400,7 @@ async function resolveAndExecute2(intent, params = {}, context, projection, opti
|
|
|
240218
240400
|
console.log(`[ddg] $0 fallback failed: ${err.message}`);
|
|
240219
240401
|
}
|
|
240220
240402
|
}
|
|
240221
|
-
if (viable.length === 0 && exaResults?.length) {
|
|
240403
|
+
if (walkDepth === 0 && viable.length === 0 && exaResults?.length) {
|
|
240222
240404
|
const richHit = pickAnswerHit(exaResults, requestedDomain);
|
|
240223
240405
|
if (richHit) {
|
|
240224
240406
|
console.log(`[exa] returning highlights answer from ${richHit.url} (${(richHit.highlights ?? []).join(" ").length} chars) + ${exaResults.length} ranked candidate(s)`);
|
|
@@ -240241,6 +240423,31 @@ async function resolveAndExecute2(intent, params = {}, context, projection, opti
|
|
|
240241
240423
|
fetch: `unbrowse fetch --url ${JSON.stringify(hit.url)}`
|
|
240242
240424
|
}
|
|
240243
240425
|
}));
|
|
240426
|
+
const topWalk = pickWalkTarget2(context?.url, exaResults);
|
|
240427
|
+
if (topWalk?.url && walkDepth < 1) {
|
|
240428
|
+
try {
|
|
240429
|
+
const walked = await resolveAndExecute2(intent, params, { url: topWalk.url, domain: registrableHost2(topWalk.url) ?? undefined }, projection, { ...options ?? {}, __walkDepth: walkDepth + 1 });
|
|
240430
|
+
if (walked && walked.source !== "exa" && !walked.result?.exec_unsupported) {
|
|
240431
|
+
console.log(`[exa→walk] resolved candidate ${topWalk.url} via ${walked.source} (pointer pipe d${walkDepth + 1})`);
|
|
240432
|
+
persistWalkedRoute2(clientScope, cacheKey2, walked);
|
|
240433
|
+
return {
|
|
240434
|
+
...walked,
|
|
240435
|
+
result: {
|
|
240436
|
+
...walked.result,
|
|
240437
|
+
walked_from: "exa-web-search",
|
|
240438
|
+
exa_candidates: candidates2,
|
|
240439
|
+
run_plan: [
|
|
240440
|
+
{ step: "resolve", mode: "web-search", status: "hit", label: "fallback", error: null, source: serialWebProvider ?? "exa" },
|
|
240441
|
+
{ step: "walk", mode: walked.source, status: "hit", label: "top-candidate", error: null, source: walked.source }
|
|
240442
|
+
]
|
|
240443
|
+
}
|
|
240444
|
+
};
|
|
240445
|
+
}
|
|
240446
|
+
console.log(`[exa→walk] candidate ${topWalk.url} produced no ladder rung — exa leaf`);
|
|
240447
|
+
} catch (e) {
|
|
240448
|
+
console.log(`[exa→walk] walk error (${e.message}) — exa leaf`);
|
|
240449
|
+
}
|
|
240450
|
+
}
|
|
240244
240451
|
return {
|
|
240245
240452
|
result: {
|
|
240246
240453
|
data: richHit.highlights,
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"repo_url": "https://github.com/justrach/kuri.git",
|
|
3
3
|
"branch": "adding-extensions",
|
|
4
4
|
"source_sha": "149881254046a20778f642b69f20f0c6468f6fb4",
|
|
5
|
-
"built_at": "2026-06-
|
|
5
|
+
"built_at": "2026-06-17T21:47:52.749Z",
|
|
6
6
|
"binaries": {
|
|
7
7
|
"darwin-arm64": {
|
|
8
8
|
"zig_target": "aarch64-macos",
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
},
|
|
22
22
|
"linux-x64": {
|
|
23
23
|
"zig_target": "x86_64-linux",
|
|
24
|
-
"sha256": "
|
|
24
|
+
"sha256": "250b2dfafc912dfda669416984036cf745749a0f5322c85acf0f95d7902e2dff"
|
|
25
25
|
},
|
|
26
26
|
"win-x64": {
|
|
27
27
|
"zig_target": "x86_64-windows-gnu",
|
|
28
|
-
"sha256": "
|
|
28
|
+
"sha256": "f920a3a3f95e38c3245c52af11989a046a0c8c87b4091d8b3c0a1638b44b6179",
|
|
29
29
|
"source": "pre-staged"
|
|
30
30
|
}
|
|
31
31
|
},
|
|
@@ -33,22 +33,22 @@
|
|
|
33
33
|
"darwin-arm64": {
|
|
34
34
|
"zig_target": "aarch64-macos",
|
|
35
35
|
"lib": "libkuri_ffi.dylib",
|
|
36
|
-
"sha256": "
|
|
36
|
+
"sha256": "898a9290964371d9814d98de79bc62678833a0b914c47f765d46d6080ee391d5"
|
|
37
37
|
},
|
|
38
38
|
"darwin-x64": {
|
|
39
39
|
"zig_target": "x86_64-macos",
|
|
40
40
|
"lib": "libkuri_ffi.dylib",
|
|
41
|
-
"sha256": "
|
|
41
|
+
"sha256": "730a09622d95ee3a5c9f5c41a7971d8ab93e7ca401be717c54c13bbbe498f604"
|
|
42
42
|
},
|
|
43
43
|
"linux-arm64": {
|
|
44
44
|
"zig_target": "aarch64-linux",
|
|
45
45
|
"lib": "libkuri_ffi.so",
|
|
46
|
-
"sha256": "
|
|
46
|
+
"sha256": "ef27e02d48f90d159b0bbcbc35b07970354af2924653ba0b00a863d9153c0313"
|
|
47
47
|
},
|
|
48
48
|
"linux-x64": {
|
|
49
49
|
"zig_target": "x86_64-linux",
|
|
50
50
|
"lib": "libkuri_ffi.so",
|
|
51
|
-
"sha256": "
|
|
51
|
+
"sha256": "de4075e2444204d2f860d1293577d4389247c6fe55049c7505196d9e8eb5f4fb"
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
}
|
|
Binary file
|