@dikshanty94/webnav 0.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/LICENSE +202 -0
- package/README.md +283 -0
- package/bin/webnav +18 -0
- package/dist/agent/loop.d.ts +59 -0
- package/dist/agent/loop.js +267 -0
- package/dist/agent/server.d.ts +60 -0
- package/dist/agent/server.js +254 -0
- package/dist/cli-help.d.ts +3 -0
- package/dist/cli-help.js +111 -0
- package/dist/cli-spec.d.ts +24 -0
- package/dist/cli-spec.js +460 -0
- package/dist/cli.d.ts +208 -0
- package/dist/cli.js +2558 -0
- package/dist/contract.d.ts +20 -0
- package/dist/contract.js +15 -0
- package/dist/creds.d.ts +46 -0
- package/dist/creds.js +126 -0
- package/dist/dashboard/server.d.ts +137 -0
- package/dist/dashboard/server.js +395 -0
- package/dist/dashboard/shell.d.ts +1 -0
- package/dist/dashboard/shell.js +1343 -0
- package/dist/explorer/analyse.d.ts +25 -0
- package/dist/explorer/analyse.js +39 -0
- package/dist/explorer/diff.d.ts +11 -0
- package/dist/explorer/diff.js +22 -0
- package/dist/explorer/draft.d.ts +81 -0
- package/dist/explorer/draft.js +1658 -0
- package/dist/explorer/fingerprint-page.d.ts +11 -0
- package/dist/explorer/fingerprint-page.js +19 -0
- package/dist/explorer/fingerprint.d.ts +14 -0
- package/dist/explorer/fingerprint.js +18 -0
- package/dist/explorer/infer.d.ts +85 -0
- package/dist/explorer/infer.js +370 -0
- package/dist/explorer/pattern-propose.d.ts +27 -0
- package/dist/explorer/pattern-propose.js +81 -0
- package/dist/explorer/patterns.d.ts +49 -0
- package/dist/explorer/patterns.js +290 -0
- package/dist/explorer/shadow.d.ts +3 -0
- package/dist/explorer/shadow.js +95 -0
- package/dist/graph/coverage.d.ts +33 -0
- package/dist/graph/coverage.js +155 -0
- package/dist/graph/edit.d.ts +47 -0
- package/dist/graph/edit.js +211 -0
- package/dist/graph/frontier.d.ts +24 -0
- package/dist/graph/frontier.js +95 -0
- package/dist/graph/seed.d.ts +23 -0
- package/dist/graph/seed.js +29 -0
- package/dist/graph/show.d.ts +8 -0
- package/dist/graph/show.js +6 -0
- package/dist/graph/teach.d.ts +8 -0
- package/dist/graph/teach.js +10 -0
- package/dist/hosted.d.ts +36 -0
- package/dist/hosted.js +69 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4 -0
- package/dist/mapstore/record.d.ts +128 -0
- package/dist/mapstore/record.js +224 -0
- package/dist/mapstore/schema.sql +47 -0
- package/dist/mapstore/store.d.ts +108 -0
- package/dist/mapstore/store.js +399 -0
- package/dist/mapstore/types.d.ts +87 -0
- package/dist/mapstore/types.js +29 -0
- package/dist/mcp/server.d.ts +46 -0
- package/dist/mcp/server.js +163 -0
- package/dist/paths.d.ts +10 -0
- package/dist/paths.js +33 -0
- package/dist/playwright/adapter.d.ts +62 -0
- package/dist/playwright/adapter.js +145 -0
- package/dist/playwright/ax-adapter.d.ts +33 -0
- package/dist/playwright/ax-adapter.js +76 -0
- package/dist/playwright/capture.d.ts +2 -0
- package/dist/playwright/capture.js +10 -0
- package/dist/playwright/fingerprint.d.ts +40 -0
- package/dist/playwright/fingerprint.js +139 -0
- package/dist/playwright/profile-lock.d.ts +15 -0
- package/dist/playwright/profile-lock.js +51 -0
- package/dist/playwright/sessions.d.ts +72 -0
- package/dist/playwright/sessions.js +229 -0
- package/dist/playwright/snapshot.d.ts +10 -0
- package/dist/playwright/snapshot.js +52 -0
- package/dist/playwright/throttle.d.ts +14 -0
- package/dist/playwright/throttle.js +76 -0
- package/dist/playwright/video.d.ts +13 -0
- package/dist/playwright/video.js +32 -0
- package/dist/protocol.d.ts +49 -0
- package/dist/protocol.js +3 -0
- package/dist/recorder/agent-session.d.ts +59 -0
- package/dist/recorder/agent-session.js +230 -0
- package/dist/recorder/capture-loop.d.ts +19 -0
- package/dist/recorder/capture-loop.js +40 -0
- package/dist/recorder/coverage.d.ts +22 -0
- package/dist/recorder/coverage.js +49 -0
- package/dist/recorder/hover-probe.d.ts +35 -0
- package/dist/recorder/hover-probe.js +100 -0
- package/dist/recorder/ingest.d.ts +39 -0
- package/dist/recorder/ingest.js +138 -0
- package/dist/recorder/live-record.d.ts +41 -0
- package/dist/recorder/live-record.js +255 -0
- package/dist/recorder/live.d.ts +53 -0
- package/dist/recorder/live.js +400 -0
- package/dist/recorder/probe.d.ts +14 -0
- package/dist/recorder/probe.js +33 -0
- package/dist/recorder/replay.d.ts +60 -0
- package/dist/recorder/replay.js +401 -0
- package/dist/recorder/review.d.ts +73 -0
- package/dist/recorder/review.js +171 -0
- package/dist/recorder/snapshot-dom.d.ts +7 -0
- package/dist/recorder/snapshot-dom.js +25 -0
- package/dist/router/auth-status.d.ts +20 -0
- package/dist/router/auth-status.js +55 -0
- package/dist/router/browse.d.ts +108 -0
- package/dist/router/browse.js +214 -0
- package/dist/router/catalog.d.ts +18 -0
- package/dist/router/catalog.js +6 -0
- package/dist/router/extract-content.d.ts +13 -0
- package/dist/router/extract-content.js +87 -0
- package/dist/router/live-extension-browser.d.ts +35 -0
- package/dist/router/live-extension-browser.js +175 -0
- package/dist/router/path.d.ts +7 -0
- package/dist/router/path.js +55 -0
- package/dist/router/read.d.ts +26 -0
- package/dist/router/read.js +30 -0
- package/dist/router/readiness.d.ts +9 -0
- package/dist/router/readiness.js +55 -0
- package/dist/router/replay.d.ts +14 -0
- package/dist/router/replay.js +23 -0
- package/dist/router/resolve.d.ts +21 -0
- package/dist/router/resolve.js +33 -0
- package/dist/router/search-live.d.ts +21 -0
- package/dist/router/search-live.js +98 -0
- package/dist/router/search-providers.d.ts +5 -0
- package/dist/router/search-providers.js +12 -0
- package/dist/router/search.d.ts +6 -0
- package/dist/router/search.js +62 -0
- package/dist/router/suite.d.ts +69 -0
- package/dist/router/suite.js +226 -0
- package/dist/router/tokens.d.ts +13 -0
- package/dist/router/tokens.js +26 -0
- package/dist/router/walk-live.d.ts +57 -0
- package/dist/router/walk-live.js +308 -0
- package/dist/router/walk-session.d.ts +49 -0
- package/dist/router/walk-session.js +90 -0
- package/dist/router/walk.d.ts +48 -0
- package/dist/router/walk.js +384 -0
- package/package.json +59 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { StoredActionEffect, ActionRef } from '../mapstore/record.js';
|
|
2
|
+
export interface AnalysedObservation {
|
|
3
|
+
fromUrl: string;
|
|
4
|
+
action: ActionRef | null;
|
|
5
|
+
toUrl: string;
|
|
6
|
+
navigated: boolean;
|
|
7
|
+
addedSummary: string[];
|
|
8
|
+
removedSummary: string[];
|
|
9
|
+
}
|
|
10
|
+
export interface AnalysedSite {
|
|
11
|
+
node: string;
|
|
12
|
+
observations: AnalysedObservation[];
|
|
13
|
+
}
|
|
14
|
+
export interface AnalysisResult {
|
|
15
|
+
sites: AnalysedSite[];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Structure-NEUTRAL presentation of recorded action-effects. Groups by host
|
|
19
|
+
* (the only grouping — a convenience), and returns each observation as-is:
|
|
20
|
+
* what page, what action, where it went, whether it navigated, and a readable
|
|
21
|
+
* diff summary. webnav imposes NO structure (no states/clusters/edges) — the
|
|
22
|
+
* calling AGENT reads this and decides the site's structure, then writes it via
|
|
23
|
+
* graph-edit. The full raw snapshots remain in the record buffer for the agent.
|
|
24
|
+
*/
|
|
25
|
+
export declare function analyseActionEffects(effects: StoredActionEffect[]): AnalysisResult;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
function host(url) {
|
|
2
|
+
try {
|
|
3
|
+
return new URL(url).host;
|
|
4
|
+
}
|
|
5
|
+
catch {
|
|
6
|
+
return null;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
const summarize = (nodes) => nodes.map((n) => `${n.role}${n.name ? ` "${n.name}"` : ''}`);
|
|
10
|
+
/**
|
|
11
|
+
* Structure-NEUTRAL presentation of recorded action-effects. Groups by host
|
|
12
|
+
* (the only grouping — a convenience), and returns each observation as-is:
|
|
13
|
+
* what page, what action, where it went, whether it navigated, and a readable
|
|
14
|
+
* diff summary. webnav imposes NO structure (no states/clusters/edges) — the
|
|
15
|
+
* calling AGENT reads this and decides the site's structure, then writes it via
|
|
16
|
+
* graph-edit. The full raw snapshots remain in the record buffer for the agent.
|
|
17
|
+
*/
|
|
18
|
+
export function analyseActionEffects(effects) {
|
|
19
|
+
const byHost = new Map();
|
|
20
|
+
for (const e of effects) {
|
|
21
|
+
// Group by the page the action was taken ON (fromUrl). A navigation
|
|
22
|
+
// observation (from A → to B) is "what happened on A", so it belongs to A's
|
|
23
|
+
// host — including the act of leaving for another site. Fall back to toUrl
|
|
24
|
+
// only when fromUrl has no host (e.g. a null-action initial landing).
|
|
25
|
+
const h = host(e.fromUrl) ?? host(e.toUrl);
|
|
26
|
+
if (!h)
|
|
27
|
+
continue;
|
|
28
|
+
if (!byHost.has(h))
|
|
29
|
+
byHost.set(h, []);
|
|
30
|
+
byHost.get(h).push({
|
|
31
|
+
fromUrl: e.fromUrl, action: e.action, toUrl: e.toUrl, navigated: e.navigated,
|
|
32
|
+
addedSummary: summarize(e.diff.added), removedSummary: summarize(e.diff.removed),
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
const sites = [...byHost.entries()]
|
|
36
|
+
.map(([node, observations]) => ({ node, observations }))
|
|
37
|
+
.sort((a, b) => a.node.localeCompare(b.node));
|
|
38
|
+
return { sites };
|
|
39
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SnapNode } from '../playwright/snapshot.js';
|
|
2
|
+
export interface SnapshotDiff {
|
|
3
|
+
added: SnapNode[];
|
|
4
|
+
removed: SnapNode[];
|
|
5
|
+
}
|
|
6
|
+
/** Mechanical set-difference of two parsed snapshots by node identity
|
|
7
|
+
* (role|name|ref). Pure convenience over the raw snapshots — not a judgment. */
|
|
8
|
+
export declare function diffSnapshots(before: SnapNode[], after: SnapNode[]): SnapshotDiff;
|
|
9
|
+
/** Did the action navigate to a different page? Compares host+pathname only
|
|
10
|
+
* (query/hash changes are same-page). Unparseable → treat as navigation. */
|
|
11
|
+
export declare function didNavigate(fromUrl: string, toUrl: string): boolean;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const idOf = (n) => `${n.role}|${n.name ?? ''}|${n.ref ?? ''}`;
|
|
2
|
+
/** Mechanical set-difference of two parsed snapshots by node identity
|
|
3
|
+
* (role|name|ref). Pure convenience over the raw snapshots — not a judgment. */
|
|
4
|
+
export function diffSnapshots(before, after) {
|
|
5
|
+
const beforeIds = new Set(before.map(idOf));
|
|
6
|
+
const afterIds = new Set(after.map(idOf));
|
|
7
|
+
return {
|
|
8
|
+
added: after.filter((n) => !beforeIds.has(idOf(n))),
|
|
9
|
+
removed: before.filter((n) => !afterIds.has(idOf(n))),
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
/** Did the action navigate to a different page? Compares host+pathname only
|
|
13
|
+
* (query/hash changes are same-page). Unparseable → treat as navigation. */
|
|
14
|
+
export function didNavigate(fromUrl, toUrl) {
|
|
15
|
+
try {
|
|
16
|
+
const a = new URL(fromUrl), b = new URL(toUrl);
|
|
17
|
+
return a.host !== b.host || a.pathname !== b.pathname;
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return fromUrl !== toUrl;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { StoredActionEffect } from '../mapstore/record.js';
|
|
2
|
+
import { type ElementFingerprint } from '../playwright/fingerprint.js';
|
|
3
|
+
import { type DeclaredShadow } from '../mapstore/types.js';
|
|
4
|
+
import { type PatternPack } from './patterns.js';
|
|
5
|
+
export interface DraftAffordance {
|
|
6
|
+
id: string;
|
|
7
|
+
label: string;
|
|
8
|
+
kind: 'navigate' | 'input' | 'mutate' | 'reveal';
|
|
9
|
+
to?: string;
|
|
10
|
+
elementFp?: ElementFingerprint | null;
|
|
11
|
+
acceptsInput?: string;
|
|
12
|
+
needs?: string[];
|
|
13
|
+
core?: boolean;
|
|
14
|
+
children?: DraftAffordance[];
|
|
15
|
+
needsClassification?: boolean;
|
|
16
|
+
scope?: 'row' | 'widget';
|
|
17
|
+
}
|
|
18
|
+
export declare const COMMIT_WORDS: RegExp;
|
|
19
|
+
export interface DraftState {
|
|
20
|
+
label: string;
|
|
21
|
+
urlPattern: string;
|
|
22
|
+
fingerprint: string[];
|
|
23
|
+
affordances: DraftAffordance[];
|
|
24
|
+
template?: string | null;
|
|
25
|
+
declaredShadow?: DeclaredShadow;
|
|
26
|
+
role?: 'hub' | 'section' | 'detail' | 'shell';
|
|
27
|
+
parentState?: string | null;
|
|
28
|
+
provisional?: string | null;
|
|
29
|
+
_warning?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface DegenerateState {
|
|
32
|
+
label: string;
|
|
33
|
+
urlPattern: string;
|
|
34
|
+
reason: string;
|
|
35
|
+
affordances: number;
|
|
36
|
+
}
|
|
37
|
+
export interface Unknown {
|
|
38
|
+
kind: 'undetected-overlay' | 'ambiguous-cluster' | 'unresolved-affordance' | 'degenerate-landing' | 'pack-tripwire';
|
|
39
|
+
evidence: string;
|
|
40
|
+
context: string;
|
|
41
|
+
extensionPoint: 'overlay-open' | 'value-domain' | 'core-design';
|
|
42
|
+
}
|
|
43
|
+
export interface DraftGraph {
|
|
44
|
+
states: DraftState[];
|
|
45
|
+
edges: never[];
|
|
46
|
+
needsFix?: DegenerateState[];
|
|
47
|
+
unknowns?: Unknown[];
|
|
48
|
+
unknownsTruncated?: number;
|
|
49
|
+
receipt: {
|
|
50
|
+
entry: string | null;
|
|
51
|
+
states: string[];
|
|
52
|
+
walkExample: string | null;
|
|
53
|
+
requests: string[];
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
export interface TrippedPack {
|
|
57
|
+
pack: PatternPack;
|
|
58
|
+
excised: number;
|
|
59
|
+
total: number;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Build a draft graph from recorded action-effects. Observation-based identity (2026-07-10):
|
|
63
|
+
* 1. KEY: infer the site's URL model from every observed url; alias a pre-redirect ghost
|
|
64
|
+
* (requestedUrl ≠ settled toUrl) to the settled key so the ghost merges. `key(url)` =
|
|
65
|
+
* follow-alias(keyOf(url)) — Task 8's mesh reuses it.
|
|
66
|
+
* 2. LANDINGS: a page's identity landings = navigated toSnapshots (+ the first effect's
|
|
67
|
+
* fromSnapshot) that classifyReadiness==='ready'. Non-nav toSnapshots feed affordances
|
|
68
|
+
* only (Task 9), not identity.
|
|
69
|
+
* 3. PROPOSE/DISPOSE: proposeTemplates over the keys; a group merges iff every member's
|
|
70
|
+
* first-landing face is jaccard≥0.5 with the group's first member — same-structure param
|
|
71
|
+
* URLs collapse, a list-vs-detail pair does not.
|
|
72
|
+
* 4. SPA SPLIT: within one key with ≥2 landings, cluster faces at jaccard≥0.5; >1 cluster →
|
|
73
|
+
* split states named by a distinguishing heading (else needsFix).
|
|
74
|
+
* 5. CORE: templateCore(faces) minus shell (shell arrives Task 8); coreNodes = first landing
|
|
75
|
+
* filtered to core tokens.
|
|
76
|
+
* 6. NAME: labelFromKey(template ?? key); collisions broken by a distinguishing core heading
|
|
77
|
+
* (else both to needsFix). NO numeric suffixes.
|
|
78
|
+
* Then (unchanged, some re-pointed in Tasks 8–10): uniqueness fingerprint, affordance synthesis,
|
|
79
|
+
* hierarchy, self-verify, needsFix assembly.
|
|
80
|
+
*/
|
|
81
|
+
export declare function draftFromEffects(effects: StoredActionEffect[], packs?: PatternPack[]): DraftGraph;
|