unbrowse 3.1.0 → 3.2.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/dist/cli.js +455 -96
- package/dist/index.js +2 -6
- package/dist/mcp.js +695 -46
- package/dist/server.js +25811 -0
- package/package.json +1 -2
- 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/runtime-src/agent-outcome.ts +0 -166
- package/runtime-src/analytics-session.ts +0 -55
- package/runtime-src/api/browse-index.ts +0 -317
- package/runtime-src/api/browse-session.ts +0 -572
- package/runtime-src/api/browse-submit-prereqs.ts +0 -48
- package/runtime-src/api/browse-submit.ts +0 -1184
- package/runtime-src/api/routes.ts +0 -1823
- package/runtime-src/auth/browser-cookies.ts +0 -423
- package/runtime-src/auth/index.ts +0 -535
- package/runtime-src/auth/runtime.ts +0 -116
- package/runtime-src/browser/index.ts +0 -659
- package/runtime-src/browser/types.ts +0 -41
- package/runtime-src/build-info.generated.ts +0 -6
- package/runtime-src/capture/index.ts +0 -1794
- package/runtime-src/capture/prefetch.ts +0 -95
- package/runtime-src/capture/rsc.ts +0 -45
- package/runtime-src/cli/shortcuts.ts +0 -273
- package/runtime-src/cli.ts +0 -1572
- package/runtime-src/client/graph-client.ts +0 -100
- package/runtime-src/client/index.ts +0 -1425
- package/runtime-src/debug-trace.ts +0 -18
- package/runtime-src/domain.ts +0 -38
- package/runtime-src/execution/index.ts +0 -3397
- package/runtime-src/execution/retry.ts +0 -46
- package/runtime-src/execution/robots.ts +0 -167
- package/runtime-src/execution/search-forms.ts +0 -188
- package/runtime-src/extraction/index.ts +0 -1507
- package/runtime-src/foundry/publish-bundle.ts +0 -392
- package/runtime-src/graph/agent-augment.ts +0 -315
- package/runtime-src/graph/index.ts +0 -1524
- package/runtime-src/graph/local-fixtures.ts +0 -393
- package/runtime-src/graph/local-harness.ts +0 -646
- package/runtime-src/graph/planner.ts +0 -411
- package/runtime-src/graph/session.ts +0 -294
- package/runtime-src/graph/trace-store.ts +0 -136
- package/runtime-src/index.ts +0 -24
- package/runtime-src/indexer/index.ts +0 -465
- package/runtime-src/intent-match.ts +0 -1515
- package/runtime-src/kuri/client.ts +0 -1839
- package/runtime-src/logger.ts +0 -30
- package/runtime-src/marketplace/index.ts +0 -103
- package/runtime-src/mcp.ts +0 -1747
- package/runtime-src/orchestrator/browser-agent.ts +0 -374
- package/runtime-src/orchestrator/dag-advisor.ts +0 -59
- package/runtime-src/orchestrator/dag-feedback.ts +0 -257
- package/runtime-src/orchestrator/first-pass-action.ts +0 -403
- package/runtime-src/orchestrator/index.ts +0 -4480
- package/runtime-src/orchestrator/passive-publish.ts +0 -187
- package/runtime-src/orchestrator/timing-economics.ts +0 -80
- package/runtime-src/payments/cascade.ts +0 -137
- package/runtime-src/payments/index.ts +0 -270
- package/runtime-src/payments/lobster-pay.ts +0 -182
- package/runtime-src/payments/wallet.ts +0 -98
- package/runtime-src/publish/review-context.ts +0 -93
- package/runtime-src/publish/sanitize.ts +0 -197
- package/runtime-src/publish/schema-review.ts +0 -192
- package/runtime-src/publish-admission.ts +0 -388
- package/runtime-src/ratelimit/index.ts +0 -23
- package/runtime-src/reverse-engineer/bundle-scanner.ts +0 -127
- package/runtime-src/reverse-engineer/description-prompt.ts +0 -213
- package/runtime-src/reverse-engineer/index.ts +0 -1551
- package/runtime-src/router.ts +0 -17
- package/runtime-src/routing-telemetry.ts +0 -395
- package/runtime-src/runtime/browser-access.ts +0 -11
- package/runtime-src/runtime/browser-auth.ts +0 -12
- package/runtime-src/runtime/browser-host.ts +0 -48
- package/runtime-src/runtime/lifecycle.ts +0 -17
- package/runtime-src/runtime/local-server.ts +0 -311
- package/runtime-src/runtime/paths.ts +0 -99
- package/runtime-src/runtime/setup.ts +0 -251
- package/runtime-src/runtime/supervisor.ts +0 -69
- package/runtime-src/runtime/update-hints.ts +0 -351
- package/runtime-src/server.ts +0 -100
- package/runtime-src/session-logs.ts +0 -142
- package/runtime-src/settings.ts +0 -221
- package/runtime-src/single-binary.ts +0 -143
- package/runtime-src/site-policy.ts +0 -54
- package/runtime-src/stale-cleanup-runner.ts +0 -144
- package/runtime-src/stale-cleanup.ts +0 -133
- package/runtime-src/telemetry-attribution.ts +0 -120
- package/runtime-src/telemetry.ts +0 -253
- package/runtime-src/template-params.ts +0 -141
- package/runtime-src/transform/drift.ts +0 -60
- package/runtime-src/transform/index.ts +0 -277
- package/runtime-src/types/index.ts +0 -1
- package/runtime-src/types/skill.ts +0 -912
- package/runtime-src/vault/index.ts +0 -196
- package/runtime-src/verification/auth-gate.ts +0 -8
- package/runtime-src/verification/candidates.ts +0 -27
- package/runtime-src/verification/index.ts +0 -120
- package/runtime-src/verification/matrix.ts +0 -30
- package/runtime-src/version.ts +0 -148
- package/runtime-src/workflow/artifact.ts +0 -161
- package/runtime-src/workflow/compile.ts +0 -808
- package/runtime-src/workflow/publish.ts +0 -225
- package/runtime-src/workflow/runtime.ts +0 -213
- package/vendor/kuri/win-x64/kuri.exe +0 -0
package/runtime-src/logger.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import os from "node:os";
|
|
4
|
-
|
|
5
|
-
const LOG_DIR = path.join(os.homedir(), ".unbrowse", "logs");
|
|
6
|
-
|
|
7
|
-
function getLogFile(): string {
|
|
8
|
-
const date = new Date().toISOString().slice(0, 10); // YYYY-MM-DD
|
|
9
|
-
return path.join(LOG_DIR, `unbrowse-${date}.log`);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
function ensureLogDir(): void {
|
|
13
|
-
fs.mkdirSync(LOG_DIR, { recursive: true });
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Log a message to both stdout and ~/.unbrowse/logs/unbrowse-YYYY-MM-DD.log.
|
|
18
|
-
* Format: [HH:MM:SS] [module] message
|
|
19
|
-
*/
|
|
20
|
-
export function log(module: string, message: string): void {
|
|
21
|
-
const ts = new Date().toTimeString().slice(0, 8); // HH:MM:SS
|
|
22
|
-
const line = `[${ts}] [${module}] ${message}`;
|
|
23
|
-
console.log(line);
|
|
24
|
-
try {
|
|
25
|
-
ensureLogDir();
|
|
26
|
-
fs.appendFileSync(getLogFile(), line + "\n");
|
|
27
|
-
} catch {
|
|
28
|
-
// Never crash the main process if logging fails
|
|
29
|
-
}
|
|
30
|
-
}
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { nanoid } from "nanoid";
|
|
2
|
-
import * as client from "../client/index.js";
|
|
3
|
-
import type { EndpointDescriptor, SkillManifest, VerificationStatus } from "../types/index.js";
|
|
4
|
-
|
|
5
|
-
export async function listSkills(): Promise<SkillManifest[]> {
|
|
6
|
-
return client.listSkills();
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export async function getSkill(skillId: string, scopeId?: string): Promise<SkillManifest | null> {
|
|
10
|
-
return client.getSkill(skillId, scopeId);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export async function publishSkill(
|
|
14
|
-
draft: Omit<SkillManifest, "skill_id" | "created_at" | "updated_at" | "version"> & {
|
|
15
|
-
skill_id?: string;
|
|
16
|
-
version?: string;
|
|
17
|
-
}
|
|
18
|
-
): Promise<SkillManifest> {
|
|
19
|
-
// Pre-cache locally so the skill is immediately available even if the remote publish
|
|
20
|
-
// fails or EmergentDB hasn't indexed it yet (eventual consistency).
|
|
21
|
-
const now = new Date().toISOString();
|
|
22
|
-
const preCache = {
|
|
23
|
-
...draft,
|
|
24
|
-
skill_id: draft.skill_id ?? nanoid(),
|
|
25
|
-
created_at: now,
|
|
26
|
-
updated_at: now,
|
|
27
|
-
version: draft.version ?? "1.0.0",
|
|
28
|
-
} as SkillManifest;
|
|
29
|
-
client.cachePublishedSkill(preCache);
|
|
30
|
-
|
|
31
|
-
if (client.isLocalOnlyMode()) {
|
|
32
|
-
return preCache;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
try {
|
|
36
|
-
const { warnings: _, ...backendFields } = await client.publishSkill(draft);
|
|
37
|
-
// Merge draft with backend response — avoids read-after-write race
|
|
38
|
-
const skill = { ...draft, ...backendFields } as SkillManifest;
|
|
39
|
-
client.cachePublishedSkill(skill);
|
|
40
|
-
return skill;
|
|
41
|
-
} catch (err) {
|
|
42
|
-
console.error("[publish] remote publish failed, using local cache:", (err as Error).message);
|
|
43
|
-
return preCache;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export async function updateEndpointScore(
|
|
48
|
-
skillId: string,
|
|
49
|
-
endpointId: string,
|
|
50
|
-
score: number,
|
|
51
|
-
status?: VerificationStatus
|
|
52
|
-
): Promise<void> {
|
|
53
|
-
await client.updateEndpointScore(skillId, endpointId, score, status);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// --- Pure local helpers (no backend call) ---
|
|
57
|
-
|
|
58
|
-
export function mergeEndpoints(
|
|
59
|
-
existing: EndpointDescriptor[],
|
|
60
|
-
incoming: EndpointDescriptor[]
|
|
61
|
-
): EndpointDescriptor[] {
|
|
62
|
-
const merged = [...existing];
|
|
63
|
-
for (const ep of incoming) {
|
|
64
|
-
const dupeIndex = merged.findIndex(
|
|
65
|
-
(e) =>
|
|
66
|
-
e.method === ep.method &&
|
|
67
|
-
normalizeTemplate(e.url_template) === normalizeTemplate(ep.url_template)
|
|
68
|
-
);
|
|
69
|
-
if (dupeIndex === -1) {
|
|
70
|
-
merged.push(ep);
|
|
71
|
-
continue;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const dupe = merged[dupeIndex]!;
|
|
75
|
-
merged[dupeIndex] = {
|
|
76
|
-
...dupe,
|
|
77
|
-
...ep,
|
|
78
|
-
endpoint_id: dupe.endpoint_id,
|
|
79
|
-
reliability_score: Math.max(dupe.reliability_score ?? 0, ep.reliability_score ?? 0),
|
|
80
|
-
verification_status: dupe.verification_status === "verified" ? dupe.verification_status : ep.verification_status,
|
|
81
|
-
exec_strategy: ep.exec_strategy ?? dupe.exec_strategy,
|
|
82
|
-
dom_extraction: ep.dom_extraction ?? dupe.dom_extraction,
|
|
83
|
-
semantic: ep.semantic ?? dupe.semantic,
|
|
84
|
-
response_schema: ep.response_schema ?? dupe.response_schema,
|
|
85
|
-
headers_template: ep.headers_template ?? dupe.headers_template,
|
|
86
|
-
query: ep.query ?? dupe.query,
|
|
87
|
-
path_params: ep.path_params ?? dupe.path_params,
|
|
88
|
-
body: ep.body ?? dupe.body,
|
|
89
|
-
trigger_url: ep.trigger_url ?? dupe.trigger_url,
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
return merged;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export function normalizeTemplate(t: string): string {
|
|
96
|
-
return t
|
|
97
|
-
.replace(/\{[^}]+\}/g, "{}")
|
|
98
|
-
.replace(/([?&]queryid=)([^?&]+)/gi, (_match, prefix: string, value: string) => {
|
|
99
|
-
if (value === "{}") return `${prefix}${value}`;
|
|
100
|
-
return `${prefix}${value.replace(/\.[a-f0-9]{8,}$/i, "")}`;
|
|
101
|
-
})
|
|
102
|
-
.toLowerCase();
|
|
103
|
-
}
|