unbrowse 10.1.7 → 10.1.8
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 +33 -24
- package/runtime/mcp.js +33 -24
package/package.json
CHANGED
package/runtime/cli.js
CHANGED
|
@@ -63674,6 +63674,22 @@ async function indexContractRows(rows, embed, store) {
|
|
|
63674
63674
|
}
|
|
63675
63675
|
return n;
|
|
63676
63676
|
}
|
|
63677
|
+
function hashEmbedder(dim = 256) {
|
|
63678
|
+
return {
|
|
63679
|
+
async embed(text) {
|
|
63680
|
+
const v = new Array(dim).fill(0);
|
|
63681
|
+
for (const tok of text.toLowerCase().split(/[^a-z0-9]+/).filter(Boolean)) {
|
|
63682
|
+
let h = 2166136261;
|
|
63683
|
+
for (let i = 0;i < tok.length; i++) {
|
|
63684
|
+
h ^= tok.charCodeAt(i);
|
|
63685
|
+
h = Math.imul(h, 16777619);
|
|
63686
|
+
}
|
|
63687
|
+
v[(h >>> 0) % dim] += 1;
|
|
63688
|
+
}
|
|
63689
|
+
return v;
|
|
63690
|
+
}
|
|
63691
|
+
};
|
|
63692
|
+
}
|
|
63677
63693
|
function openAiEmbedder(env = process.env) {
|
|
63678
63694
|
const key = env.OPENAI_API_KEY?.trim();
|
|
63679
63695
|
if (!key)
|
|
@@ -63805,6 +63821,12 @@ async function resolveLiveEmbedder(env = process.env) {
|
|
|
63805
63821
|
|
|
63806
63822
|
// .tmp-runtime-src/values/contract-everything.ts
|
|
63807
63823
|
import { createHash as createHash4 } from "node:crypto";
|
|
63824
|
+
async function embedderForIndexing(env = process.env) {
|
|
63825
|
+
const live = await resolveLiveEmbedder(env);
|
|
63826
|
+
if (live)
|
|
63827
|
+
return live;
|
|
63828
|
+
return { embed: hashEmbedder(1536), provider: "embedded-hash-1536" };
|
|
63829
|
+
}
|
|
63808
63830
|
function emergentKey() {
|
|
63809
63831
|
const k = (typeof process !== "undefined" ? process.env?.EMERGENTDB_API_KEY : undefined)?.trim();
|
|
63810
63832
|
if (!k)
|
|
@@ -63897,19 +63919,13 @@ async function persistContract(c, opts = {}) {
|
|
|
63897
63919
|
try {
|
|
63898
63920
|
let embed = opts.embedder;
|
|
63899
63921
|
if (!embed) {
|
|
63900
|
-
const
|
|
63901
|
-
|
|
63902
|
-
|
|
63903
|
-
out.embedder = live.provider;
|
|
63904
|
-
}
|
|
63905
|
-
}
|
|
63906
|
-
if (!embed) {
|
|
63907
|
-
out.notes.push("rag: no 1536-dim embedder available (contract-native llama.cpp / OPENAI_API_KEY / Nebius) — skipped");
|
|
63908
|
-
} else {
|
|
63909
|
-
const row = { id: c.id, text: c.text };
|
|
63910
|
-
await indexContractRows([row], embed, emergentVectorStore(namespace));
|
|
63911
|
-
out.rag = true;
|
|
63922
|
+
const chosen = await embedderForIndexing(process.env);
|
|
63923
|
+
embed = chosen.embed;
|
|
63924
|
+
out.embedder = chosen.provider;
|
|
63912
63925
|
}
|
|
63926
|
+
const row = { id: c.id, text: c.text };
|
|
63927
|
+
await indexContractRows([row], embed, emergentVectorStore(namespace));
|
|
63928
|
+
out.rag = true;
|
|
63913
63929
|
} catch (e) {
|
|
63914
63930
|
out.notes.push(`rag: ${e instanceof Error ? e.message : String(e)}`);
|
|
63915
63931
|
}
|
|
@@ -63931,17 +63947,10 @@ async function mirrorToEmergent(id, text, value, opts = {}) {
|
|
|
63931
63947
|
}
|
|
63932
63948
|
try {
|
|
63933
63949
|
let embed = opts.embedder;
|
|
63934
|
-
if (!embed)
|
|
63935
|
-
|
|
63936
|
-
|
|
63937
|
-
|
|
63938
|
-
}
|
|
63939
|
-
if (!embed) {
|
|
63940
|
-
r.notes.push("rag: no embedder available — skipped");
|
|
63941
|
-
} else {
|
|
63942
|
-
await indexContractRows([{ id, text }], embed, emergentVectorStore(namespace));
|
|
63943
|
-
r.rag = true;
|
|
63944
|
-
}
|
|
63950
|
+
if (!embed)
|
|
63951
|
+
embed = (await embedderForIndexing(process.env)).embed;
|
|
63952
|
+
await indexContractRows([{ id, text }], embed, emergentVectorStore(namespace));
|
|
63953
|
+
r.rag = true;
|
|
63945
63954
|
} catch (e) {
|
|
63946
63955
|
r.notes.push(`rag: ${e instanceof Error ? e.message : String(e)}`);
|
|
63947
63956
|
}
|
|
@@ -64923,7 +64932,7 @@ var init_telemetry = __esm(() => {
|
|
|
64923
64932
|
});
|
|
64924
64933
|
|
|
64925
64934
|
// .tmp-runtime-src/build-info.generated.ts
|
|
64926
|
-
var BUILD_RELEASE_VERSION = "10.1.
|
|
64935
|
+
var BUILD_RELEASE_VERSION = "10.1.8", BUILD_GIT_SHA = "19288fa59909", BUILD_CODE_HASH = "5d9ebf619c61", BUILD_RELEASE_MANIFEST_BASE64 = "eyJzY2hlbWFfdmVyc2lvbiI6MSwicmVsZWFzZV92ZXJzaW9uIjoiMTAuMS44IiwiZ2l0X3NoYSI6IjE5Mjg4ZmE1OTkwOSIsImNvZGVfaGFzaCI6IjVkOWViZjYxOWM2MSIsInRyYWNlX3ZlcnNpb24iOiI1ZDllYmY2MTljNjFAMTkyODhmYTU5OTA5IiwiaXNzdWVkX2F0IjoiMjAyNi0wNi0yM1QxMjozOTowMC41NTRaIn0", BUILD_RELEASE_MANIFEST_SIGNATURE = "sOsI7qC2tg6Pbtm69qJt58JRVAVS4IozNeI50MGo4NI", BUILD_DEFAULT_BACKEND_URL = "https://beta-api.unbrowse.ai", BUILD_DEFAULT_PROFILE = "";
|
|
64927
64936
|
|
|
64928
64937
|
// .tmp-runtime-src/version.ts
|
|
64929
64938
|
import { createHash as createHash8 } from "crypto";
|
package/runtime/mcp.js
CHANGED
|
@@ -94766,6 +94766,22 @@ async function indexContractRows(rows, embed, store) {
|
|
|
94766
94766
|
}
|
|
94767
94767
|
return n;
|
|
94768
94768
|
}
|
|
94769
|
+
function hashEmbedder(dim = 256) {
|
|
94770
|
+
return {
|
|
94771
|
+
async embed(text) {
|
|
94772
|
+
const v = new Array(dim).fill(0);
|
|
94773
|
+
for (const tok of text.toLowerCase().split(/[^a-z0-9]+/).filter(Boolean)) {
|
|
94774
|
+
let h = 2166136261;
|
|
94775
|
+
for (let i = 0;i < tok.length; i++) {
|
|
94776
|
+
h ^= tok.charCodeAt(i);
|
|
94777
|
+
h = Math.imul(h, 16777619);
|
|
94778
|
+
}
|
|
94779
|
+
v[(h >>> 0) % dim] += 1;
|
|
94780
|
+
}
|
|
94781
|
+
return v;
|
|
94782
|
+
}
|
|
94783
|
+
};
|
|
94784
|
+
}
|
|
94769
94785
|
function openAiEmbedder(env = process.env) {
|
|
94770
94786
|
const key = env.OPENAI_API_KEY?.trim();
|
|
94771
94787
|
if (!key)
|
|
@@ -94897,6 +94913,12 @@ async function resolveLiveEmbedder(env = process.env) {
|
|
|
94897
94913
|
|
|
94898
94914
|
// .tmp-runtime-src/values/contract-everything.ts
|
|
94899
94915
|
import { createHash as createHash4 } from "node:crypto";
|
|
94916
|
+
async function embedderForIndexing(env = process.env) {
|
|
94917
|
+
const live = await resolveLiveEmbedder(env);
|
|
94918
|
+
if (live)
|
|
94919
|
+
return live;
|
|
94920
|
+
return { embed: hashEmbedder(1536), provider: "embedded-hash-1536" };
|
|
94921
|
+
}
|
|
94900
94922
|
function emergentKey() {
|
|
94901
94923
|
const k = (typeof process !== "undefined" ? process.env?.EMERGENTDB_API_KEY : undefined)?.trim();
|
|
94902
94924
|
if (!k)
|
|
@@ -94989,19 +95011,13 @@ async function persistContract(c, opts = {}) {
|
|
|
94989
95011
|
try {
|
|
94990
95012
|
let embed = opts.embedder;
|
|
94991
95013
|
if (!embed) {
|
|
94992
|
-
const
|
|
94993
|
-
|
|
94994
|
-
|
|
94995
|
-
out.embedder = live.provider;
|
|
94996
|
-
}
|
|
94997
|
-
}
|
|
94998
|
-
if (!embed) {
|
|
94999
|
-
out.notes.push("rag: no 1536-dim embedder available (contract-native llama.cpp / OPENAI_API_KEY / Nebius) — skipped");
|
|
95000
|
-
} else {
|
|
95001
|
-
const row = { id: c.id, text: c.text };
|
|
95002
|
-
await indexContractRows([row], embed, emergentVectorStore(namespace));
|
|
95003
|
-
out.rag = true;
|
|
95014
|
+
const chosen = await embedderForIndexing(process.env);
|
|
95015
|
+
embed = chosen.embed;
|
|
95016
|
+
out.embedder = chosen.provider;
|
|
95004
95017
|
}
|
|
95018
|
+
const row = { id: c.id, text: c.text };
|
|
95019
|
+
await indexContractRows([row], embed, emergentVectorStore(namespace));
|
|
95020
|
+
out.rag = true;
|
|
95005
95021
|
} catch (e) {
|
|
95006
95022
|
out.notes.push(`rag: ${e instanceof Error ? e.message : String(e)}`);
|
|
95007
95023
|
}
|
|
@@ -95023,17 +95039,10 @@ async function mirrorToEmergent(id, text, value, opts = {}) {
|
|
|
95023
95039
|
}
|
|
95024
95040
|
try {
|
|
95025
95041
|
let embed = opts.embedder;
|
|
95026
|
-
if (!embed)
|
|
95027
|
-
|
|
95028
|
-
|
|
95029
|
-
|
|
95030
|
-
}
|
|
95031
|
-
if (!embed) {
|
|
95032
|
-
r.notes.push("rag: no embedder available — skipped");
|
|
95033
|
-
} else {
|
|
95034
|
-
await indexContractRows([{ id, text }], embed, emergentVectorStore(namespace));
|
|
95035
|
-
r.rag = true;
|
|
95036
|
-
}
|
|
95042
|
+
if (!embed)
|
|
95043
|
+
embed = (await embedderForIndexing(process.env)).embed;
|
|
95044
|
+
await indexContractRows([{ id, text }], embed, emergentVectorStore(namespace));
|
|
95045
|
+
r.rag = true;
|
|
95037
95046
|
} catch (e) {
|
|
95038
95047
|
r.notes.push(`rag: ${e instanceof Error ? e.message : String(e)}`);
|
|
95039
95048
|
}
|
|
@@ -101443,7 +101452,7 @@ async function mergedAuthHeaders(key, signer) {
|
|
|
101443
101452
|
var AUTH_DOMAIN = "unbrowse-auth:v1";
|
|
101444
101453
|
|
|
101445
101454
|
// .tmp-runtime-src/build-info.generated.ts
|
|
101446
|
-
var BUILD_RELEASE_VERSION = "10.1.
|
|
101455
|
+
var BUILD_RELEASE_VERSION = "10.1.8", BUILD_GIT_SHA = "19288fa59909", BUILD_CODE_HASH = "5d9ebf619c61", BUILD_RELEASE_MANIFEST_BASE64 = "eyJzY2hlbWFfdmVyc2lvbiI6MSwicmVsZWFzZV92ZXJzaW9uIjoiMTAuMS44IiwiZ2l0X3NoYSI6IjE5Mjg4ZmE1OTkwOSIsImNvZGVfaGFzaCI6IjVkOWViZjYxOWM2MSIsInRyYWNlX3ZlcnNpb24iOiI1ZDllYmY2MTljNjFAMTkyODhmYTU5OTA5IiwiaXNzdWVkX2F0IjoiMjAyNi0wNi0yM1QxMjozOTowMC41NTRaIn0", BUILD_RELEASE_MANIFEST_SIGNATURE = "sOsI7qC2tg6Pbtm69qJt58JRVAVS4IozNeI50MGo4NI", BUILD_DEFAULT_BACKEND_URL = "https://beta-api.unbrowse.ai", BUILD_DEFAULT_PROFILE = "";
|
|
101447
101456
|
|
|
101448
101457
|
// .tmp-runtime-src/version.ts
|
|
101449
101458
|
import { createHash as createHash6 } from "crypto";
|