unbrowse 3.1.0-experiments.5e7a7bb → 3.1.0-experiments.92b9fb5
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 +47 -46
- package/dist/index.js +2 -6
- package/dist/mcp.js +26 -22
- package/dist/server.js +25798 -0
- package/package.json +1 -1
- package/runtime-src/api/browse-index.ts +10 -2
- package/runtime-src/api/routes.ts +15 -4
- package/runtime-src/browser/index.ts +0 -1
- package/runtime-src/build-info.generated.ts +4 -4
- package/runtime-src/capture/index.ts +27 -5
- package/runtime-src/client/index.ts +15 -3
- package/runtime-src/execution/index.ts +11 -10
- package/runtime-src/execution/token-resolver.ts +62 -10
- package/runtime-src/orchestrator/browser-agent.ts +0 -1
- package/runtime-src/reverse-engineer/token-sources.ts +30 -8
- package/runtime-src/runtime/local-server.ts +7 -1
- package/vendor/kuri/darwin-arm64/kuri +0 -0
- package/vendor/kuri/darwin-x64/kuri +0 -0
- package/vendor/kuri/linux-arm64/kuri +0 -0
- package/vendor/kuri/linux-x64/kuri +0 -0
- package/vendor/kuri/manifest.json +7 -10
- package/vendor/kuri/win-x64/kuri.exe +0 -0
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 = "3.1.0-experiments.
|
|
34
|
+
var BUILD_RELEASE_VERSION = "3.1.0-experiments.92b9fb5", BUILD_GIT_SHA = "92b9fb58eddd", BUILD_CODE_HASH = "1488fc1d92b7", BUILD_RELEASE_MANIFEST_BASE64 = "eyJzY2hlbWFfdmVyc2lvbiI6MSwicmVsZWFzZV92ZXJzaW9uIjoiMy4xLjAtZXhwZXJpbWVudHMuOTJiOWZiNSIsImdpdF9zaGEiOiI5MmI5ZmI1OGVkZGQiLCJjb2RlX2hhc2giOiIxNDg4ZmMxZDkyYjciLCJ0cmFjZV92ZXJzaW9uIjoiMTQ4OGZjMWQ5MmI3QDkyYjlmYjU4ZWRkZCIsImlzc3VlZF9hdCI6IjIwMjYtMDQtMDZUMDM6MDc6MDAuNTgzWiJ9", BUILD_RELEASE_MANIFEST_SIGNATURE = "fI_nQuzBXfxK99ojHmxAzOC_WpqWBqGOwzyNuAww2lc", BUILD_DEFAULT_BACKEND_URL = "https://unbrowse-backend-experiments.lewis-6d8.workers.dev";
|
|
35
35
|
|
|
36
36
|
// ../../src/version.ts
|
|
37
37
|
import { createHash } from "crypto";
|
|
@@ -586,7 +586,7 @@ var init_logger = __esm(() => {
|
|
|
586
586
|
|
|
587
587
|
// ../../src/kuri/client.ts
|
|
588
588
|
import { execFileSync as execFileSync2, spawn as spawn2 } from "node:child_process";
|
|
589
|
-
import { existsSync as
|
|
589
|
+
import { existsSync as existsSync9 } from "node:fs";
|
|
590
590
|
import path5 from "node:path";
|
|
591
591
|
function createBrokerState(port = KURI_DEFAULT_PORT) {
|
|
592
592
|
return {
|
|
@@ -661,7 +661,7 @@ function findKuriBinary() {
|
|
|
661
661
|
if (process.env.KURI_BIN)
|
|
662
662
|
return process.env.KURI_BIN;
|
|
663
663
|
const candidates = getKuriBinaryCandidates();
|
|
664
|
-
return candidates.find((candidate) =>
|
|
664
|
+
return candidates.find((candidate) => existsSync9(candidate)) ?? candidates[0] ?? kuriBinaryName();
|
|
665
665
|
}
|
|
666
666
|
var KURI_DEFAULT_PORT = 7700, defaultBrokerState, brokerClients;
|
|
667
667
|
var init_client2 = __esm(() => {
|
|
@@ -899,18 +899,6 @@ var init_extraction = __esm(() => {
|
|
|
899
899
|
CHROME_TAGS = new Set(["nav", "footer", "header"]);
|
|
900
900
|
});
|
|
901
901
|
|
|
902
|
-
// ../../src/graph/agent-augment.ts
|
|
903
|
-
var DEFAULT_MODEL, ENABLED, AUGMENT_TIMEOUT_MS, MAX_AUGMENT_ENDPOINTS, MAX_AUGMENT_PAYLOAD_CHARS, GENERIC_SEMANTIC_TYPES;
|
|
904
|
-
var init_agent_augment = __esm(() => {
|
|
905
|
-
init_graph();
|
|
906
|
-
DEFAULT_MODEL = process.env.UNBROWSE_AGENT_SEMANTIC_MODEL ?? process.env.UNBROWSE_AGENT_JUDGE_MODEL ?? "gpt-4.1-mini";
|
|
907
|
-
ENABLED = process.env.UNBROWSE_AGENT_SEMANTIC_AUGMENT !== "0";
|
|
908
|
-
AUGMENT_TIMEOUT_MS = Number(process.env.UNBROWSE_AGENT_SEMANTIC_TIMEOUT_MS ?? 8000);
|
|
909
|
-
MAX_AUGMENT_ENDPOINTS = Math.max(1, Number(process.env.UNBROWSE_AGENT_SEMANTIC_MAX_ENDPOINTS ?? 6));
|
|
910
|
-
MAX_AUGMENT_PAYLOAD_CHARS = Math.max(4000, Number(process.env.UNBROWSE_AGENT_SEMANTIC_MAX_PAYLOAD_CHARS ?? 24000));
|
|
911
|
-
GENERIC_SEMANTIC_TYPES = new Set(["identifier", "input", "resource", "entity", "item"]);
|
|
912
|
-
});
|
|
913
|
-
|
|
914
902
|
// ../../src/execution/search-forms.ts
|
|
915
903
|
var SEARCH_FIELD_NAMES, LOGIN_FIELD_NAMES, SUPPORTED_INPUT_TYPES;
|
|
916
904
|
var init_search_forms = __esm(() => {
|
|
@@ -1036,7 +1024,6 @@ var init_execution = __esm(async () => {
|
|
|
1036
1024
|
init_domain();
|
|
1037
1025
|
init_extraction();
|
|
1038
1026
|
init_graph();
|
|
1039
|
-
init_agent_augment();
|
|
1040
1027
|
init_logger();
|
|
1041
1028
|
init_version();
|
|
1042
1029
|
init_search_forms();
|
|
@@ -1165,7 +1152,7 @@ var init_routing_telemetry = __esm(() => {
|
|
|
1165
1152
|
});
|
|
1166
1153
|
// ../../src/orchestrator/index.ts
|
|
1167
1154
|
import { nanoid as nanoid9 } from "nanoid";
|
|
1168
|
-
import { existsSync as
|
|
1155
|
+
import { existsSync as existsSync10, writeFileSync as writeFileSync3, readFileSync as readFileSync6, mkdirSync as mkdirSync5, readdirSync as readdirSync3 } from "node:fs";
|
|
1169
1156
|
import { dirname as dirname3, join as join9 } from "node:path";
|
|
1170
1157
|
var LIVE_CAPTURE_TIMEOUT_MS, capturedDomainCache, captureInFlight, captureDomainLocks, skillRouteCache, ROUTE_CACHE_FILE, SKILL_SNAPSHOT_DIR2, domainSkillCache, DOMAIN_CACHE_FILE, _routeCacheDirty = false, routeCacheFlushTimer, routeResultCache, ROUTE_CACHE_TTL, MARKETPLACE_HYDRATE_LIMIT, MARKETPLACE_GET_SKILL_TIMEOUT_MS, MARKETPLACE_DOMAIN_SEARCH_K, MARKETPLACE_GLOBAL_SEARCH_K, SEARCH_INTENT_STOPWORDS;
|
|
1171
1158
|
var init_orchestrator = __esm(async () => {
|
|
@@ -1201,7 +1188,7 @@ var init_orchestrator = __esm(async () => {
|
|
|
1201
1188
|
domainSkillCache = new Map;
|
|
1202
1189
|
DOMAIN_CACHE_FILE = join9(process.env.HOME ?? "/tmp", ".unbrowse", "domain-skill-cache.json");
|
|
1203
1190
|
try {
|
|
1204
|
-
if (
|
|
1191
|
+
if (existsSync10(DOMAIN_CACHE_FILE)) {
|
|
1205
1192
|
const data = JSON.parse(readFileSync6(DOMAIN_CACHE_FILE, "utf-8"));
|
|
1206
1193
|
for (const [k, v] of Object.entries(data)) {
|
|
1207
1194
|
const entry = v;
|
|
@@ -1218,7 +1205,7 @@ var init_orchestrator = __esm(async () => {
|
|
|
1218
1205
|
_routeCacheDirty = false;
|
|
1219
1206
|
try {
|
|
1220
1207
|
const dir = dirname3(ROUTE_CACHE_FILE);
|
|
1221
|
-
if (!
|
|
1208
|
+
if (!existsSync10(dir))
|
|
1222
1209
|
mkdirSync5(dir, { recursive: true });
|
|
1223
1210
|
const entries = Object.fromEntries(skillRouteCache);
|
|
1224
1211
|
writeFileSync3(ROUTE_CACHE_FILE, JSON.stringify(entries), "utf-8");
|
|
@@ -1226,7 +1213,7 @@ var init_orchestrator = __esm(async () => {
|
|
|
1226
1213
|
}, 5000);
|
|
1227
1214
|
routeCacheFlushTimer.unref?.();
|
|
1228
1215
|
try {
|
|
1229
|
-
if (
|
|
1216
|
+
if (existsSync10(ROUTE_CACHE_FILE)) {
|
|
1230
1217
|
const data = JSON.parse(readFileSync6(ROUTE_CACHE_FILE, "utf-8"));
|
|
1231
1218
|
for (const [k, v] of Object.entries(data)) {
|
|
1232
1219
|
const entry = v;
|
|
@@ -1323,7 +1310,7 @@ __export(exports_wallet, {
|
|
|
1323
1310
|
getWalletContext: () => getWalletContext2,
|
|
1324
1311
|
checkWalletConfigured: () => checkWalletConfigured2
|
|
1325
1312
|
});
|
|
1326
|
-
import { existsSync as
|
|
1313
|
+
import { existsSync as existsSync14, readFileSync as readFileSync9 } from "node:fs";
|
|
1327
1314
|
import { homedir as homedir6 } from "node:os";
|
|
1328
1315
|
import { join as join11 } from "node:path";
|
|
1329
1316
|
function asNonEmptyString2(value) {
|
|
@@ -1331,7 +1318,7 @@ function asNonEmptyString2(value) {
|
|
|
1331
1318
|
}
|
|
1332
1319
|
function getLobsterWalletFromLocalConfig2() {
|
|
1333
1320
|
const agentsPath = join11(process.env.HOME || homedir6(), ".lobster", "agents.json");
|
|
1334
|
-
if (!
|
|
1321
|
+
if (!existsSync14(agentsPath))
|
|
1335
1322
|
return;
|
|
1336
1323
|
try {
|
|
1337
1324
|
const raw = JSON.parse(readFileSync9(agentsPath, "utf8"));
|
|
@@ -1382,7 +1369,7 @@ init_wallet();
|
|
|
1382
1369
|
init_telemetry_attribution();
|
|
1383
1370
|
import { readFileSync as readFileSync3, writeFileSync, existsSync as existsSync4, mkdirSync, readdirSync as readdirSync2 } from "fs";
|
|
1384
1371
|
import { join as join4 } from "path";
|
|
1385
|
-
import { homedir as homedir3, hostname } from "os";
|
|
1372
|
+
import { homedir as homedir3, hostname, release as osRelease } from "os";
|
|
1386
1373
|
import { randomBytes, createHash as createHash2 } from "crypto";
|
|
1387
1374
|
import { createInterface } from "readline";
|
|
1388
1375
|
var API_URL = process.env.UNBROWSE_BACKEND_URL || DEFAULT_BACKEND_URL;
|
|
@@ -1575,9 +1562,19 @@ async function recordInstallTelemetryEvent(source, options) {
|
|
|
1575
1562
|
skill_version: options?.skillVersion,
|
|
1576
1563
|
status: options?.status ?? "installed",
|
|
1577
1564
|
created_at: createdAt,
|
|
1578
|
-
properties: mergeTelemetryProperties(options?.properties, getTelemetryAttribution())
|
|
1565
|
+
properties: mergeTelemetryProperties({ ...getRuntimeContext(), ...options?.properties }, getTelemetryAttribution())
|
|
1579
1566
|
});
|
|
1580
1567
|
}
|
|
1568
|
+
function getRuntimeContext() {
|
|
1569
|
+
return {
|
|
1570
|
+
cli_version: PACKAGE_VERSION,
|
|
1571
|
+
code_hash: CODE_HASH,
|
|
1572
|
+
node_version: process.version,
|
|
1573
|
+
platform: process.platform,
|
|
1574
|
+
arch: process.arch,
|
|
1575
|
+
os_release: osRelease()
|
|
1576
|
+
};
|
|
1577
|
+
}
|
|
1581
1578
|
async function recordFunnelTelemetryEvent(name, options) {
|
|
1582
1579
|
const createdAt = options?.createdAt ?? new Date().toISOString();
|
|
1583
1580
|
const landingToken = getLandingToken();
|
|
@@ -1589,7 +1586,7 @@ async function recordFunnelTelemetryEvent(name, options) {
|
|
|
1589
1586
|
source: options?.source ?? "cli",
|
|
1590
1587
|
host_type: options?.hostType ?? detectTelemetryHostType(),
|
|
1591
1588
|
created_at: createdAt,
|
|
1592
|
-
properties: mergeTelemetryProperties(options?.properties, getTelemetryAttribution())
|
|
1589
|
+
properties: mergeTelemetryProperties({ ...getRuntimeContext(), ...options?.properties }, getTelemetryAttribution())
|
|
1593
1590
|
});
|
|
1594
1591
|
}
|
|
1595
1592
|
var EMAIL_RE = /^[^\s@]+@[^\s@]+\.[^\s@]+$/i;
|
|
@@ -2300,7 +2297,7 @@ function buildDepsMetadata(pack, taskName) {
|
|
|
2300
2297
|
init_paths();
|
|
2301
2298
|
init_supervisor();
|
|
2302
2299
|
init_version();
|
|
2303
|
-
import { openSync, readFileSync as readFileSync5, unlinkSync as unlinkSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
2300
|
+
import { existsSync as existsSync7, openSync, readFileSync as readFileSync5, unlinkSync as unlinkSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
2304
2301
|
import path2 from "node:path";
|
|
2305
2302
|
import { spawn } from "node:child_process";
|
|
2306
2303
|
function isServerVersionMismatch(runningVersion, installedVersion, runningCodeHash, installedCodeHash) {
|
|
@@ -2366,6 +2363,10 @@ function getServerSpawnSpec(metaUrl, entrypoint = resolveSiblingEntrypoint(metaU
|
|
|
2366
2363
|
recordedEntrypoint: `${process.execPath} serve`
|
|
2367
2364
|
};
|
|
2368
2365
|
}
|
|
2366
|
+
const serverJs = path2.join(path2.dirname(entrypoint), "server.js");
|
|
2367
|
+
if (path2.extname(entrypoint) !== ".js" && existsSync7(serverJs)) {
|
|
2368
|
+
entrypoint = serverJs;
|
|
2369
|
+
}
|
|
2369
2370
|
return {
|
|
2370
2371
|
command: process.execPath,
|
|
2371
2372
|
args: runtimeArgsForEntrypoint(metaUrl, entrypoint),
|
|
@@ -2511,7 +2512,7 @@ async function restartServer(baseUrl, metaUrl) {
|
|
|
2511
2512
|
}
|
|
2512
2513
|
|
|
2513
2514
|
// ../../src/runtime/paths.ts
|
|
2514
|
-
import { existsSync as
|
|
2515
|
+
import { existsSync as existsSync8, mkdirSync as mkdirSync4, realpathSync as realpathSync2 } from "node:fs";
|
|
2515
2516
|
import path3 from "node:path";
|
|
2516
2517
|
import { createRequire as createRequire3 } from "node:module";
|
|
2517
2518
|
import { fileURLToPath as fileURLToPath3, pathToFileURL as pathToFileURL2 } from "node:url";
|
|
@@ -2531,7 +2532,7 @@ function runtimeArgsForEntrypoint2(metaUrl, entrypoint) {
|
|
|
2531
2532
|
const req = createRequire3(metaUrl);
|
|
2532
2533
|
const tsxPkg = req.resolve("tsx/package.json");
|
|
2533
2534
|
const tsxLoader = path3.join(path3.dirname(tsxPkg), "dist", "loader.mjs");
|
|
2534
|
-
if (
|
|
2535
|
+
if (existsSync8(tsxLoader))
|
|
2535
2536
|
return ["--import", pathToFileURL2(tsxLoader).href, entrypoint];
|
|
2536
2537
|
} catch {}
|
|
2537
2538
|
return ["--import", "tsx", entrypoint];
|
|
@@ -2600,13 +2601,13 @@ init_client2();
|
|
|
2600
2601
|
init_logger();
|
|
2601
2602
|
init_wallet();
|
|
2602
2603
|
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
2603
|
-
import { existsSync as
|
|
2604
|
+
import { existsSync as existsSync12, mkdirSync as mkdirSync7, writeFileSync as writeFileSync5 } from "node:fs";
|
|
2604
2605
|
import os4 from "node:os";
|
|
2605
2606
|
import path7 from "node:path";
|
|
2606
2607
|
|
|
2607
2608
|
// ../../src/runtime/update-hints.ts
|
|
2608
2609
|
init_paths();
|
|
2609
|
-
import { existsSync as
|
|
2610
|
+
import { existsSync as existsSync11, mkdirSync as mkdirSync6, readFileSync as readFileSync7, writeFileSync as writeFileSync4 } from "node:fs";
|
|
2610
2611
|
import os3 from "node:os";
|
|
2611
2612
|
import path6 from "node:path";
|
|
2612
2613
|
var DEFAULT_INTERVAL_MS = 12 * 60 * 60 * 1000;
|
|
@@ -2620,7 +2621,7 @@ function getConfigDir2() {
|
|
|
2620
2621
|
return path6.join(getHomeDir(), ".unbrowse");
|
|
2621
2622
|
}
|
|
2622
2623
|
function ensureDir3(dir) {
|
|
2623
|
-
if (!
|
|
2624
|
+
if (!existsSync11(dir))
|
|
2624
2625
|
mkdirSync6(dir, { recursive: true });
|
|
2625
2626
|
return dir;
|
|
2626
2627
|
}
|
|
@@ -2643,7 +2644,7 @@ function detectRepoRoot(start2) {
|
|
|
2643
2644
|
let dir = path6.resolve(start2);
|
|
2644
2645
|
const root = path6.parse(dir).root;
|
|
2645
2646
|
while (dir !== root) {
|
|
2646
|
-
if (
|
|
2647
|
+
if (existsSync11(path6.join(dir, ".git")))
|
|
2647
2648
|
return dir;
|
|
2648
2649
|
dir = path6.dirname(dir);
|
|
2649
2650
|
}
|
|
@@ -2722,12 +2723,12 @@ codex_hooks = true
|
|
|
2722
2723
|
}
|
|
2723
2724
|
function writeCodexHook(metaUrl) {
|
|
2724
2725
|
const configPath = getCodexConfigPath();
|
|
2725
|
-
if (!
|
|
2726
|
+
if (!existsSync11(path6.dirname(configPath))) {
|
|
2726
2727
|
return { host: "codex", action: "not-detected", config_file: configPath };
|
|
2727
2728
|
}
|
|
2728
2729
|
try {
|
|
2729
2730
|
const hookScript = getHookScriptPath(metaUrl).replace(/\\/g, "/");
|
|
2730
|
-
const fileExistsBefore =
|
|
2731
|
+
const fileExistsBefore = existsSync11(configPath);
|
|
2731
2732
|
let content = fileExistsBefore ? readFileSync7(configPath, "utf8") : "";
|
|
2732
2733
|
const previous = content;
|
|
2733
2734
|
content = ensureCodexHooksFeature(content);
|
|
@@ -2762,13 +2763,13 @@ command = ${JSON.stringify(command)}
|
|
|
2762
2763
|
}
|
|
2763
2764
|
function writeClaudeHook(metaUrl) {
|
|
2764
2765
|
const settingsPath = getClaudeSettingsPath();
|
|
2765
|
-
if (!
|
|
2766
|
+
if (!existsSync11(path6.dirname(settingsPath))) {
|
|
2766
2767
|
return { host: "claude", action: "not-detected", config_file: settingsPath };
|
|
2767
2768
|
}
|
|
2768
2769
|
try {
|
|
2769
2770
|
const hookScript = getHookScriptPath(metaUrl).replace(/\\/g, "/");
|
|
2770
2771
|
const command = `node "${hookScript}"`;
|
|
2771
|
-
const fileExistsBefore =
|
|
2772
|
+
const fileExistsBefore = existsSync11(settingsPath);
|
|
2772
2773
|
const settings = readJsonFile(settingsPath) ?? {};
|
|
2773
2774
|
settings.hooks ??= {};
|
|
2774
2775
|
settings.hooks.SessionStart ??= [];
|
|
@@ -2833,7 +2834,7 @@ function getOpenCodeProjectCommandsDir(cwd) {
|
|
|
2833
2834
|
return path7.join(cwd, ".opencode", "commands");
|
|
2834
2835
|
}
|
|
2835
2836
|
function detectOpenCode(cwd) {
|
|
2836
|
-
return hasBinary("opencode") ||
|
|
2837
|
+
return hasBinary("opencode") || existsSync12(path7.join(resolveConfigHome(), "opencode")) || existsSync12(path7.join(cwd, ".opencode"));
|
|
2837
2838
|
}
|
|
2838
2839
|
function renderOpenCodeCommand() {
|
|
2839
2840
|
return `---
|
|
@@ -2861,11 +2862,11 @@ function writeOpenCodeCommand(scope, cwd) {
|
|
|
2861
2862
|
if (scope === "auto" && !detected) {
|
|
2862
2863
|
return { detected: false, action: "not-detected", scope: "off" };
|
|
2863
2864
|
}
|
|
2864
|
-
const resolvedScope = scope === "project" ? "project" : scope === "global" ? "global" :
|
|
2865
|
+
const resolvedScope = scope === "project" ? "project" : scope === "global" ? "global" : existsSync12(path7.join(cwd, ".opencode")) ? "project" : "global";
|
|
2865
2866
|
const commandsDir = resolvedScope === "project" ? getOpenCodeProjectCommandsDir(cwd) : getOpenCodeGlobalCommandsDir();
|
|
2866
2867
|
const commandFile = path7.join(ensureDir2(commandsDir), "unbrowse.md");
|
|
2867
2868
|
const content = renderOpenCodeCommand();
|
|
2868
|
-
const action2 =
|
|
2869
|
+
const action2 = existsSync12(commandFile) ? "updated" : "installed";
|
|
2869
2870
|
mkdirSync7(path7.dirname(commandFile), { recursive: true });
|
|
2870
2871
|
writeFileSync5(commandFile, content);
|
|
2871
2872
|
return {
|
|
@@ -2877,10 +2878,10 @@ function writeOpenCodeCommand(scope, cwd) {
|
|
|
2877
2878
|
}
|
|
2878
2879
|
async function ensureBrowserEngineInstalled() {
|
|
2879
2880
|
const binary = findKuriBinary();
|
|
2880
|
-
if (
|
|
2881
|
+
if (existsSync12(binary)) {
|
|
2881
2882
|
return { installed: true, action: "already-installed" };
|
|
2882
2883
|
}
|
|
2883
|
-
const sourceDir = getKuriSourceCandidates().find((candidate) =>
|
|
2884
|
+
const sourceDir = getKuriSourceCandidates().find((candidate) => existsSync12(path7.join(candidate, "build.zig")));
|
|
2884
2885
|
if (!sourceDir) {
|
|
2885
2886
|
return {
|
|
2886
2887
|
installed: false,
|
|
@@ -2902,7 +2903,7 @@ async function ensureBrowserEngineInstalled() {
|
|
|
2902
2903
|
timeout: 300000
|
|
2903
2904
|
});
|
|
2904
2905
|
const builtBinary = findKuriBinary();
|
|
2905
|
-
if (
|
|
2906
|
+
if (existsSync12(builtBinary)) {
|
|
2906
2907
|
return {
|
|
2907
2908
|
installed: true,
|
|
2908
2909
|
action: "installed",
|
|
@@ -2927,7 +2928,7 @@ async function runSetup(options) {
|
|
|
2927
2928
|
const browser = options?.installBrowser === false ? { installed: false, action: "skipped" } : await ensureBrowserEngineInstalled();
|
|
2928
2929
|
const walletCheck = checkWalletConfigured();
|
|
2929
2930
|
const skipWalletSetup = process.env.UNBROWSE_SKIP_WALLET_SETUP === "1";
|
|
2930
|
-
const lobsterInstalled = hasBinary("lobstercash") ||
|
|
2931
|
+
const lobsterInstalled = hasBinary("lobstercash") || existsSync12(path7.join(os4.homedir(), ".agents", "skills", "lobstercash", "SKILL.md"));
|
|
2931
2932
|
if (!skipWalletSetup && !walletCheck.configured && lobsterInstalled) {
|
|
2932
2933
|
console.log("[unbrowse] Crossmint lobster.cash detected but wallet not configured — running wallet setup...");
|
|
2933
2934
|
try {
|
|
@@ -2967,7 +2968,7 @@ async function runSetup(options) {
|
|
|
2967
2968
|
|
|
2968
2969
|
// ../../src/runtime/update-hints.ts
|
|
2969
2970
|
init_paths();
|
|
2970
|
-
import { existsSync as
|
|
2971
|
+
import { existsSync as existsSync13, mkdirSync as mkdirSync8, readFileSync as readFileSync8, writeFileSync as writeFileSync6 } from "node:fs";
|
|
2971
2972
|
import os5 from "node:os";
|
|
2972
2973
|
import path8 from "node:path";
|
|
2973
2974
|
var INSTALL_SCRIPT_URL = "https://unbrowse.ai/install.sh";
|
|
@@ -2981,7 +2982,7 @@ function getConfigDir3() {
|
|
|
2981
2982
|
return path8.join(getHomeDir2(), ".unbrowse");
|
|
2982
2983
|
}
|
|
2983
2984
|
function ensureDir4(dir) {
|
|
2984
|
-
if (!
|
|
2985
|
+
if (!existsSync13(dir))
|
|
2985
2986
|
mkdirSync8(dir, { recursive: true });
|
|
2986
2987
|
return dir;
|
|
2987
2988
|
}
|
|
@@ -3007,7 +3008,7 @@ function detectRepoRoot2(start2) {
|
|
|
3007
3008
|
let dir = path8.resolve(start2);
|
|
3008
3009
|
const root = path8.parse(dir).root;
|
|
3009
3010
|
while (dir !== root) {
|
|
3010
|
-
if (
|
|
3011
|
+
if (existsSync13(path8.join(dir, ".git")))
|
|
3011
3012
|
return dir;
|
|
3012
3013
|
dir = path8.dirname(dir);
|
|
3013
3014
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { spawn } from "node:child_process";
|
|
3
|
-
import { createRequire } from "node:module";
|
|
4
3
|
import path from "node:path";
|
|
5
4
|
import { fileURLToPath } from "node:url";
|
|
6
5
|
|
|
7
6
|
const packageRoot = path.dirname(path.dirname(fileURLToPath(import.meta.url)));
|
|
8
|
-
const serverEntrypoint = path.join(packageRoot, "
|
|
9
|
-
const req = createRequire(import.meta.url);
|
|
10
|
-
const tsxPkg = req.resolve("tsx/package.json");
|
|
11
|
-
const tsxLoader = path.join(path.dirname(tsxPkg), "dist", "loader.mjs");
|
|
7
|
+
const serverEntrypoint = path.join(packageRoot, "dist", "server.js");
|
|
12
8
|
|
|
13
|
-
const child = spawn(process.execPath, [
|
|
9
|
+
const child = spawn(process.execPath, [serverEntrypoint, ...process.argv.slice(2)], {
|
|
14
10
|
stdio: "inherit",
|
|
15
11
|
cwd: process.cwd(),
|
|
16
12
|
env: {
|
package/dist/mcp.js
CHANGED
|
@@ -20,7 +20,7 @@ __export(exports_lobster_pay, {
|
|
|
20
20
|
isLobsterAvailable: () => isLobsterAvailable
|
|
21
21
|
});
|
|
22
22
|
import { execFile, execFileSync } from "node:child_process";
|
|
23
|
-
import { existsSync as
|
|
23
|
+
import { existsSync as existsSync6 } from "node:fs";
|
|
24
24
|
import { homedir as homedir3 } from "node:os";
|
|
25
25
|
import { join as join4 } from "node:path";
|
|
26
26
|
function getLobsterCommand() {
|
|
@@ -31,7 +31,7 @@ function getLobsterCommand() {
|
|
|
31
31
|
try {
|
|
32
32
|
const npmPrefix = execFileSync("npm", ["config", "get", "prefix"], { encoding: "utf8", timeout: 5000 }).trim();
|
|
33
33
|
const lobsterPath = join4(npmPrefix, "bin", "lobstercash");
|
|
34
|
-
if (
|
|
34
|
+
if (existsSync6(lobsterPath)) {
|
|
35
35
|
execFileSync(lobsterPath, ["--version"], { stdio: "ignore", timeout: 3000 });
|
|
36
36
|
return { cmd: lobsterPath, prefix: [] };
|
|
37
37
|
}
|
|
@@ -45,7 +45,7 @@ function lobsterCmd() {
|
|
|
45
45
|
}
|
|
46
46
|
function isLobsterAvailable() {
|
|
47
47
|
const agentsPath = join4(process.env.HOME || homedir3(), ".lobster", "agents.json");
|
|
48
|
-
return
|
|
48
|
+
return existsSync6(agentsPath);
|
|
49
49
|
}
|
|
50
50
|
function lobsterX402Fetch(url, options) {
|
|
51
51
|
return new Promise((resolve) => {
|
|
@@ -121,12 +121,12 @@ var init_lobster_pay = () => {};
|
|
|
121
121
|
// ../../src/mcp.ts
|
|
122
122
|
import { config as loadEnv } from "dotenv";
|
|
123
123
|
import { createInterface } from "readline";
|
|
124
|
-
import { existsSync as
|
|
124
|
+
import { existsSync as existsSync8, readFileSync as readFileSync6 } from "fs";
|
|
125
125
|
import path4 from "path";
|
|
126
126
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
127
127
|
|
|
128
128
|
// ../../src/runtime/local-server.ts
|
|
129
|
-
import { openSync, readFileSync as readFileSync2, unlinkSync, writeFileSync } from "node:fs";
|
|
129
|
+
import { existsSync as existsSync3, openSync, readFileSync as readFileSync2, unlinkSync, writeFileSync } from "node:fs";
|
|
130
130
|
import path2 from "node:path";
|
|
131
131
|
import { spawn } from "node:child_process";
|
|
132
132
|
|
|
@@ -225,11 +225,11 @@ import { dirname, join, parse } from "path";
|
|
|
225
225
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
226
226
|
|
|
227
227
|
// ../../src/build-info.generated.ts
|
|
228
|
-
var BUILD_RELEASE_VERSION = "3.1.0-experiments.
|
|
229
|
-
var BUILD_GIT_SHA = "
|
|
228
|
+
var BUILD_RELEASE_VERSION = "3.1.0-experiments.92b9fb5";
|
|
229
|
+
var BUILD_GIT_SHA = "92b9fb58eddd";
|
|
230
230
|
var BUILD_CODE_HASH = "1488fc1d92b7";
|
|
231
|
-
var BUILD_RELEASE_MANIFEST_BASE64 = "
|
|
232
|
-
var BUILD_RELEASE_MANIFEST_SIGNATURE = "
|
|
231
|
+
var BUILD_RELEASE_MANIFEST_BASE64 = "eyJzY2hlbWFfdmVyc2lvbiI6MSwicmVsZWFzZV92ZXJzaW9uIjoiMy4xLjAtZXhwZXJpbWVudHMuOTJiOWZiNSIsImdpdF9zaGEiOiI5MmI5ZmI1OGVkZGQiLCJjb2RlX2hhc2giOiIxNDg4ZmMxZDkyYjciLCJ0cmFjZV92ZXJzaW9uIjoiMTQ4OGZjMWQ5MmI3QDkyYjlmYjU4ZWRkZCIsImlzc3VlZF9hdCI6IjIwMjYtMDQtMDZUMDM6MDc6MDAuNTgzWiJ9";
|
|
232
|
+
var BUILD_RELEASE_MANIFEST_SIGNATURE = "fI_nQuzBXfxK99ojHmxAzOC_WpqWBqGOwzyNuAww2lc";
|
|
233
233
|
var BUILD_DEFAULT_BACKEND_URL = "https://unbrowse-backend-experiments.lewis-6d8.workers.dev";
|
|
234
234
|
|
|
235
235
|
// ../../src/version.ts
|
|
@@ -400,6 +400,10 @@ function getServerSpawnSpec(metaUrl, entrypoint = resolveSiblingEntrypoint(metaU
|
|
|
400
400
|
recordedEntrypoint: `${process.execPath} serve`
|
|
401
401
|
};
|
|
402
402
|
}
|
|
403
|
+
const serverJs = path2.join(path2.dirname(entrypoint), "server.js");
|
|
404
|
+
if (path2.extname(entrypoint) !== ".js" && existsSync3(serverJs)) {
|
|
405
|
+
entrypoint = serverJs;
|
|
406
|
+
}
|
|
403
407
|
return {
|
|
404
408
|
command: process.execPath,
|
|
405
409
|
args: runtimeArgsForEntrypoint(metaUrl, entrypoint),
|
|
@@ -540,7 +544,7 @@ function stopServer(baseUrl) {
|
|
|
540
544
|
}
|
|
541
545
|
|
|
542
546
|
// ../../src/workflow/publish.ts
|
|
543
|
-
import { existsSync as
|
|
547
|
+
import { existsSync as existsSync4, mkdirSync as mkdirSync2, readFileSync as readFileSync3, readdirSync as readdirSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
544
548
|
import { homedir } from "node:os";
|
|
545
549
|
import { join as join2 } from "node:path";
|
|
546
550
|
|
|
@@ -567,7 +571,7 @@ function workflowPublishArtifactPathForSkill(skillId) {
|
|
|
567
571
|
}
|
|
568
572
|
function readWorkflowPublishArtifact(skillId) {
|
|
569
573
|
const target = workflowPublishArtifactPathForSkill(skillId);
|
|
570
|
-
if (!
|
|
574
|
+
if (!existsSync4(target))
|
|
571
575
|
return null;
|
|
572
576
|
try {
|
|
573
577
|
return JSON.parse(readFileSync3(target, "utf-8"));
|
|
@@ -577,13 +581,13 @@ function readWorkflowPublishArtifact(skillId) {
|
|
|
577
581
|
}
|
|
578
582
|
function listWorkflowPublishArtifacts() {
|
|
579
583
|
const dir = getWorkflowExportDir();
|
|
580
|
-
if (!
|
|
584
|
+
if (!existsSync4(dir))
|
|
581
585
|
return [];
|
|
582
586
|
return readdirSync2(dir).filter((entry) => entry.endsWith(".json")).map((entry) => join2(dir, entry));
|
|
583
587
|
}
|
|
584
588
|
|
|
585
589
|
// ../../src/impact-log.ts
|
|
586
|
-
import { existsSync as
|
|
590
|
+
import { existsSync as existsSync5, mkdirSync as mkdirSync3, appendFileSync, statSync, readFileSync as readFileSync4, renameSync, unlinkSync as unlinkSync2 } from "node:fs";
|
|
587
591
|
import { homedir as homedir2 } from "node:os";
|
|
588
592
|
import { dirname as dirname2, join as join3 } from "node:path";
|
|
589
593
|
var MAX_LOG_BYTES = 5 * 1024 * 1024;
|
|
@@ -599,19 +603,19 @@ function getImpactLogPath() {
|
|
|
599
603
|
}
|
|
600
604
|
function ensureDir2(path4) {
|
|
601
605
|
const dir = dirname2(path4);
|
|
602
|
-
if (!
|
|
606
|
+
if (!existsSync5(dir))
|
|
603
607
|
mkdirSync3(dir, { recursive: true });
|
|
604
608
|
}
|
|
605
609
|
function rotateIfNeeded(path4) {
|
|
606
610
|
try {
|
|
607
|
-
if (!
|
|
611
|
+
if (!existsSync5(path4))
|
|
608
612
|
return;
|
|
609
613
|
const size = statSync(path4).size;
|
|
610
614
|
if (size < MAX_LOG_BYTES)
|
|
611
615
|
return;
|
|
612
616
|
for (let i = MAX_ROTATIONS;i >= 1; i--) {
|
|
613
617
|
const older = `${path4}.${i}`;
|
|
614
|
-
if (!
|
|
618
|
+
if (!existsSync5(older))
|
|
615
619
|
continue;
|
|
616
620
|
if (i === MAX_ROTATIONS) {
|
|
617
621
|
try {
|
|
@@ -681,10 +685,10 @@ function readImpactSummary() {
|
|
|
681
685
|
const files = [];
|
|
682
686
|
for (let i = MAX_ROTATIONS;i >= 1; i--) {
|
|
683
687
|
const rotated = `${path4}.${i}`;
|
|
684
|
-
if (
|
|
688
|
+
if (existsSync5(rotated))
|
|
685
689
|
files.push(rotated);
|
|
686
690
|
}
|
|
687
|
-
if (
|
|
691
|
+
if (existsSync5(path4))
|
|
688
692
|
files.push(path4);
|
|
689
693
|
if (files.length === 0)
|
|
690
694
|
return summary;
|
|
@@ -741,9 +745,9 @@ function readImpactSummary() {
|
|
|
741
745
|
}
|
|
742
746
|
|
|
743
747
|
// ../../src/client/index.ts
|
|
744
|
-
import { readFileSync as readFileSync5, writeFileSync as writeFileSync3, existsSync as
|
|
748
|
+
import { readFileSync as readFileSync5, writeFileSync as writeFileSync3, existsSync as existsSync7, mkdirSync as mkdirSync4, readdirSync as readdirSync3 } from "fs";
|
|
745
749
|
import { join as join5 } from "path";
|
|
746
|
-
import { homedir as homedir4, hostname } from "os";
|
|
750
|
+
import { homedir as homedir4, hostname, release as osRelease } from "os";
|
|
747
751
|
|
|
748
752
|
// ../../src/payments/cascade.ts
|
|
749
753
|
import bs58 from "bs58";
|
|
@@ -792,7 +796,7 @@ function sanitizeProfileName2(value) {
|
|
|
792
796
|
function loadConfig() {
|
|
793
797
|
try {
|
|
794
798
|
const configPath = getConfigPath();
|
|
795
|
-
if (
|
|
799
|
+
if (existsSync7(configPath)) {
|
|
796
800
|
return JSON.parse(readFileSync5(configPath, "utf-8"));
|
|
797
801
|
}
|
|
798
802
|
} catch {}
|
|
@@ -1312,7 +1316,7 @@ function getPackageRoot2() {
|
|
|
1312
1316
|
let dir = path4.dirname(fileURLToPath3(import.meta.url));
|
|
1313
1317
|
const root = path4.parse(dir).root;
|
|
1314
1318
|
while (dir !== root) {
|
|
1315
|
-
if (path4.basename(dir) === "src" &&
|
|
1319
|
+
if (path4.basename(dir) === "src" && existsSync8(path4.join(path4.dirname(dir), "package.json"))) {
|
|
1316
1320
|
return path4.dirname(dir);
|
|
1317
1321
|
}
|
|
1318
1322
|
try {
|