unbrowse 6.1.0 → 6.1.2
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/cli.js +9 -2
- package/dist/mcp.js +4 -4
- package/dist/server.js +39 -4
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -31,7 +31,7 @@ var __promiseAll = (args) => Promise.all(args);
|
|
|
31
31
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
32
32
|
|
|
33
33
|
// ../../src/build-info.generated.ts
|
|
34
|
-
var BUILD_RELEASE_VERSION = "6.1.
|
|
34
|
+
var BUILD_RELEASE_VERSION = "6.1.2", BUILD_GIT_SHA = "cff8a0fffd8e", BUILD_CODE_HASH = "5d9ebf619c61", BUILD_RELEASE_MANIFEST_BASE64 = "eyJzY2hlbWFfdmVyc2lvbiI6MSwicmVsZWFzZV92ZXJzaW9uIjoiNi4xLjIiLCJnaXRfc2hhIjoiY2ZmOGEwZmZmZDhlIiwiY29kZV9oYXNoIjoiNWQ5ZWJmNjE5YzYxIiwidHJhY2VfdmVyc2lvbiI6IjVkOWViZjYxOWM2MUBjZmY4YTBmZmZkOGUiLCJpc3N1ZWRfYXQiOiIyMDI2LTA1LTAxVDAwOjU3OjM1LjUzNloifQ", BUILD_RELEASE_MANIFEST_SIGNATURE = "SqPbqF2Q5YN-Vkwfdn2WMiQ83Jc9IFE7dmQhSmdt9lY", BUILD_DEFAULT_BACKEND_URL = "https://beta-api.unbrowse.ai";
|
|
35
35
|
|
|
36
36
|
// ../../src/version.ts
|
|
37
37
|
import { createHash } from "crypto";
|
|
@@ -4447,7 +4447,13 @@ function parseArgs(argv) {
|
|
|
4447
4447
|
} else if (a.startsWith("--")) {
|
|
4448
4448
|
const key = a.slice(2);
|
|
4449
4449
|
const next = rest[i + 1];
|
|
4450
|
-
|
|
4450
|
+
const valueExpectedFlags = new Set(["skill", "endpoint", "intent", "url", "domain", "params", "path", "extract", "limit"]);
|
|
4451
|
+
if (valueExpectedFlags.has(key)) {
|
|
4452
|
+
if (next === undefined)
|
|
4453
|
+
die(`--${key} requires a value`);
|
|
4454
|
+
flags[key] = next;
|
|
4455
|
+
i++;
|
|
4456
|
+
} else if (!next || next.startsWith("--") || next === "-p" || next === "--param") {
|
|
4451
4457
|
flags[key] = true;
|
|
4452
4458
|
} else {
|
|
4453
4459
|
flags[key] = next;
|
|
@@ -4544,6 +4550,7 @@ function slimTrace(obj) {
|
|
|
4544
4550
|
success: trace.success,
|
|
4545
4551
|
status_code: trace.status_code,
|
|
4546
4552
|
trace_version: trace.trace_version,
|
|
4553
|
+
...typeof trace.error === "string" ? { error: trace.error } : {},
|
|
4547
4554
|
...trace.schema_backfilled ? { schema_backfilled: true } : {}
|
|
4548
4555
|
} : undefined
|
|
4549
4556
|
};
|
package/dist/mcp.js
CHANGED
|
@@ -226,11 +226,11 @@ import { dirname, join, parse } from "path";
|
|
|
226
226
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
227
227
|
|
|
228
228
|
// ../../src/build-info.generated.ts
|
|
229
|
-
var BUILD_RELEASE_VERSION = "6.1.
|
|
230
|
-
var BUILD_GIT_SHA = "
|
|
229
|
+
var BUILD_RELEASE_VERSION = "6.1.2";
|
|
230
|
+
var BUILD_GIT_SHA = "cff8a0fffd8e";
|
|
231
231
|
var BUILD_CODE_HASH = "5d9ebf619c61";
|
|
232
|
-
var BUILD_RELEASE_MANIFEST_BASE64 = "
|
|
233
|
-
var BUILD_RELEASE_MANIFEST_SIGNATURE = "
|
|
232
|
+
var BUILD_RELEASE_MANIFEST_BASE64 = "eyJzY2hlbWFfdmVyc2lvbiI6MSwicmVsZWFzZV92ZXJzaW9uIjoiNi4xLjIiLCJnaXRfc2hhIjoiY2ZmOGEwZmZmZDhlIiwiY29kZV9oYXNoIjoiNWQ5ZWJmNjE5YzYxIiwidHJhY2VfdmVyc2lvbiI6IjVkOWViZjYxOWM2MUBjZmY4YTBmZmZkOGUiLCJpc3N1ZWRfYXQiOiIyMDI2LTA1LTAxVDAwOjU3OjM1LjUzNloifQ";
|
|
233
|
+
var BUILD_RELEASE_MANIFEST_SIGNATURE = "SqPbqF2Q5YN-Vkwfdn2WMiQ83Jc9IFE7dmQhSmdt9lY";
|
|
234
234
|
var BUILD_DEFAULT_BACKEND_URL = "https://beta-api.unbrowse.ai";
|
|
235
235
|
|
|
236
236
|
// ../../src/version.ts
|
package/dist/server.js
CHANGED
|
@@ -7285,7 +7285,7 @@ var init_capture = __esm(async () => {
|
|
|
7285
7285
|
});
|
|
7286
7286
|
|
|
7287
7287
|
// ../../src/build-info.generated.ts
|
|
7288
|
-
var BUILD_RELEASE_VERSION = "6.1.
|
|
7288
|
+
var BUILD_RELEASE_VERSION = "6.1.2", BUILD_GIT_SHA = "cff8a0fffd8e", BUILD_CODE_HASH = "5d9ebf619c61", BUILD_RELEASE_MANIFEST_BASE64 = "eyJzY2hlbWFfdmVyc2lvbiI6MSwicmVsZWFzZV92ZXJzaW9uIjoiNi4xLjIiLCJnaXRfc2hhIjoiY2ZmOGEwZmZmZDhlIiwiY29kZV9oYXNoIjoiNWQ5ZWJmNjE5YzYxIiwidHJhY2VfdmVyc2lvbiI6IjVkOWViZjYxOWM2MUBjZmY4YTBmZmZkOGUiLCJpc3N1ZWRfYXQiOiIyMDI2LTA1LTAxVDAwOjU3OjM1LjUzNloifQ", BUILD_RELEASE_MANIFEST_SIGNATURE = "SqPbqF2Q5YN-Vkwfdn2WMiQ83Jc9IFE7dmQhSmdt9lY", BUILD_DEFAULT_BACKEND_URL = "https://beta-api.unbrowse.ai";
|
|
7289
7289
|
|
|
7290
7290
|
// ../../src/version.ts
|
|
7291
7291
|
import { createHash as createHash2 } from "crypto";
|
|
@@ -17401,8 +17401,19 @@ async function executeEndpoint(skill, endpoint, params = {}, projection, options
|
|
|
17401
17401
|
urlTemplate = restoreTemplatePlaceholderEncoding(u.toString()).replace(/%28/gi, "(").replace(/%29/gi, ")").replace(/%2C/gi, ",").replace(/%3A/gi, ":");
|
|
17402
17402
|
} catch {}
|
|
17403
17403
|
}
|
|
17404
|
-
|
|
17404
|
+
let __gqlDecomp = decomposeGraphqlEndpoint(endpoint);
|
|
17405
17405
|
if (__gqlDecomp.isGraphql) {
|
|
17406
|
+
if (__gqlDecomp.operationName && (!__gqlDecomp.variablesTemplate || Object.keys(__gqlDecomp.variablesTemplate).length === 0)) {
|
|
17407
|
+
const siblings = (skill.endpoints ?? []).filter((e) => e.endpoint_id !== endpoint.endpoint_id);
|
|
17408
|
+
for (const sib of siblings) {
|
|
17409
|
+
const sibDecomp = decomposeGraphqlEndpoint(sib);
|
|
17410
|
+
if (sibDecomp.isGraphql && sibDecomp.operationName === __gqlDecomp.operationName && sibDecomp.variablesTemplate && Object.keys(sibDecomp.variablesTemplate).length > 0) {
|
|
17411
|
+
log("exec", `D8 graphql-template-borrow: ${endpoint.endpoint_id} → ${sib.endpoint_id} for ${__gqlDecomp.operationName}`);
|
|
17412
|
+
__gqlDecomp = sibDecomp;
|
|
17413
|
+
break;
|
|
17414
|
+
}
|
|
17415
|
+
}
|
|
17416
|
+
}
|
|
17406
17417
|
const __gqlEnc = buildGraphqlRequestParams(__gqlDecomp, mergedParams);
|
|
17407
17418
|
if (mergedParams.variables == null || mergedParams.variables === "{variables}") {
|
|
17408
17419
|
mergedParams.variables = encodeURIComponent(__gqlEnc.variables);
|
|
@@ -17855,7 +17866,14 @@ async function executeEndpoint(skill, endpoint, params = {}, projection, options
|
|
|
17855
17866
|
status_code: status
|
|
17856
17867
|
});
|
|
17857
17868
|
if (!trace.success) {
|
|
17858
|
-
trace.error = status === 404 ? `HTTP 404 — endpoint may be stale. Re-run via POST /v1/intent/resolve to get fresh endpoints.` : `HTTP ${status}`;
|
|
17869
|
+
trace.error = status === 0 ? `HTTP 0 — network failure or browser fetch was blocked (DNS, TLS, CORS, anti-bot, or kuri tab error). Try \`unbrowse go\` to open a live session, then re-run.` : status === 404 ? `HTTP 404 — endpoint may be stale. Re-run via POST /v1/intent/resolve to get fresh endpoints.` : `HTTP ${status}`;
|
|
17870
|
+
if (data == null) {
|
|
17871
|
+
data = {
|
|
17872
|
+
error: status === 0 ? "network_failure" : `http_${status}`,
|
|
17873
|
+
message: trace.error,
|
|
17874
|
+
status_code: status
|
|
17875
|
+
};
|
|
17876
|
+
}
|
|
17859
17877
|
} else {
|
|
17860
17878
|
trace.result = data;
|
|
17861
17879
|
}
|
|
@@ -21883,7 +21901,8 @@ async function resolveAndExecute(intent, params = {}, context, projection, optio
|
|
|
21883
21901
|
});
|
|
21884
21902
|
const isSameHostResolve = !!context?.url && !!endpointScopedSkill.domain;
|
|
21885
21903
|
const hostMatches = isSameHostResolve && new URL(context.url).hostname === endpointScopedSkill.domain;
|
|
21886
|
-
|
|
21904
|
+
const allNegative = epRanked.length > 0 && epRanked.every((r) => r.score < 0);
|
|
21905
|
+
if ((epRanked.length === 0 || allNegative) && hostMatches) {
|
|
21887
21906
|
return {
|
|
21888
21907
|
result: {
|
|
21889
21908
|
status: "resolve_hard_handoff",
|
|
@@ -27651,6 +27670,22 @@ async function registerRoutes(app) {
|
|
|
27651
27670
|
recovered = true;
|
|
27652
27671
|
}
|
|
27653
27672
|
}
|
|
27673
|
+
if (!recovered) {
|
|
27674
|
+
const wantUrl = execResult.result?.message;
|
|
27675
|
+
const errResult = execResult.result;
|
|
27676
|
+
const want = String(execParams.endpoint_id);
|
|
27677
|
+
const fromResolve = (skill.endpoints ?? []).find((e) => e.url_template === context_url || e.trigger_url === context_url);
|
|
27678
|
+
if (fromResolve && fromResolve.endpoint_id !== want) {
|
|
27679
|
+
console.log(`[exec] D7 sibling-by-url: rewriting endpoint_id ${want} → ${fromResolve.endpoint_id}`);
|
|
27680
|
+
execParams.endpoint_id = fromResolve.endpoint_id;
|
|
27681
|
+
recovered = true;
|
|
27682
|
+
} else if (errResult.available_endpoints?.length === 1) {
|
|
27683
|
+
const only = errResult.available_endpoints[0].endpoint_id;
|
|
27684
|
+
console.log(`[exec] D7 single-endpoint skill: rewriting endpoint_id ${want} → ${only}`);
|
|
27685
|
+
execParams.endpoint_id = only;
|
|
27686
|
+
recovered = true;
|
|
27687
|
+
}
|
|
27688
|
+
}
|
|
27654
27689
|
if (recovered) {
|
|
27655
27690
|
execResult = await executeSkill(skill, execParams, projection, { confirm_unsafe, confirm_third_party_terms, dry_run, skip_robots_check, intent, contextUrl: context_url, client_scope: clientScope });
|
|
27656
27691
|
}
|