@weavetab/mcp 2.5.0-beta.2 → 2.5.0-beta.5
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/AGENTS.md +1 -1
- package/ARCHITECTURE.md +6 -6
- package/LICENSE +216 -631
- package/README.md +153 -1074
- package/SECURITY.md +33 -22
- package/TROUBLESHOOTING.md +2 -2
- package/dist/cdp/bridge.js +2 -1
- package/dist/cdp/connector.d.ts +2 -0
- package/dist/cdp/connector.js +10 -6
- package/dist/cdp/helpers.d.ts +4 -0
- package/dist/cdp/helpers.js +181 -0
- package/dist/cdp/omni_broker.d.ts +1 -1
- package/dist/cdp/omni_broker.js +1 -1
- package/dist/cdp/walker.d.ts +25 -1
- package/dist/cdp/walker.js +304 -7
- package/dist/cli/plugin.d.ts +1 -0
- package/dist/cli/plugin.js +81 -18
- package/dist/cli/updater.d.ts +1 -1
- package/dist/cli/updater.js +27 -7
- package/dist/config/loader.d.ts +9 -1
- package/dist/config/loader.js +42 -3
- package/dist/desktop/discovery.d.ts +44 -0
- package/dist/desktop/discovery.js +364 -0
- package/dist/index.js +137 -21
- package/dist/intelligence/marks.d.ts +36 -0
- package/dist/intelligence/marks.js +30 -0
- package/dist/intelligence/patternCompiler.d.ts +118 -0
- package/dist/intelligence/patternCompiler.js +259 -0
- package/dist/intelligence/sessionMemory.d.ts +2 -0
- package/dist/intelligence/sessionMemory.js +18 -8
- package/dist/overlay/injector.js +2 -2
- package/dist/plugin/interface.d.ts +88 -5
- package/dist/plugin/loader.d.ts +12 -1
- package/dist/plugin/loader.js +280 -70
- package/dist/plugin/pipeline.d.ts +75 -0
- package/dist/plugin/pipeline.js +183 -0
- package/dist/plugin/registry.d.ts +2 -1
- package/dist/plugin/registry.js +24 -14
- package/dist/security/secrets.d.ts +7 -0
- package/dist/security/secrets.js +37 -0
- package/dist/sensors/actionability.js +1 -2
- package/dist/sensors/guard.js +4 -10
- package/dist/sensors/mutations.js +12 -0
- package/dist/sensors/operation_monitor.js +1 -0
- package/dist/server.d.ts +1 -1
- package/dist/server.js +453 -178
- package/dist/state/agent.d.ts +1 -0
- package/dist/state/agent.js +3 -0
- package/dist/state/delta.d.ts +12 -4
- package/dist/state/delta.js +67 -14
- package/dist/state/session.d.ts +6 -0
- package/dist/state/session.js +27 -0
- package/dist/tools/browser_detect.d.ts +16 -3
- package/dist/tools/browser_detect.js +52 -7
- package/dist/tools/burst.d.ts +17 -8
- package/dist/tools/burst.js +236 -77
- package/dist/tools/captcha.js +1 -1
- package/dist/tools/checkpoint.d.ts +38 -0
- package/dist/tools/checkpoint.js +271 -0
- package/dist/tools/click.d.ts +1 -0
- package/dist/tools/click.js +74 -70
- package/dist/tools/design_extract.js +1 -1
- package/dist/tools/eval.js +1 -1
- package/dist/tools/fill.d.ts +20 -1
- package/dist/tools/fill.js +199 -40
- package/dist/tools/find.d.ts +16 -0
- package/dist/tools/find.js +67 -44
- package/dist/tools/github/index.d.ts +19 -4
- package/dist/tools/github/index.js +40 -4
- package/dist/tools/highlight.d.ts +6 -2
- package/dist/tools/highlight.js +158 -72
- package/dist/tools/inspect.js +1 -1
- package/dist/tools/key.js +65 -56
- package/dist/tools/navigate.d.ts +1 -1
- package/dist/tools/navigate.js +34 -39
- package/dist/tools/pdf.js +21 -13
- package/dist/tools/pointer.d.ts +18 -3
- package/dist/tools/pointer.js +89 -1
- package/dist/tools/read.d.ts +28 -8
- package/dist/tools/read.js +230 -56
- package/dist/tools/scrape.js +67 -13
- package/dist/tools/screenshot.js +21 -16
- package/dist/tools/scroll.js +6 -11
- package/dist/tools/select.js +8 -2
- package/dist/tools/snapshot.js +3 -34
- package/dist/tools/tabs.js +15 -7
- package/dist/tools/thought.d.ts +2 -0
- package/dist/tools/thought.js +13 -14
- package/dist/tools/type.d.ts +2 -0
- package/dist/tools/type.js +107 -58
- package/dist/tools/type_secret.js +42 -76
- package/dist/tools/upload.js +1 -1
- package/dist/tools/video_compiler.d.ts +1 -1
- package/dist/tools/video_compiler.js +11 -12
- package/dist/version.d.ts +5 -0
- package/dist/version.js +5 -0
- package/docs/DOCUMENTATION.md +37 -41
- package/docs/PLUGINS.md +121 -0
- package/docs/TOOLS.md +54 -0
- package/docs/architecture/blind-injection.md +83 -20
- package/docs/architecture/overview.md +49 -49
- package/docs/architecture/security.md +8 -7
- package/docs/architecture/transport.md +2 -2
- package/docs/cli/cli-commands.md +7 -1
- package/docs/cli/cli-flags.md +15 -7
- package/docs/cli/cli-scripting.md +6 -3
- package/docs/configuration/config-locations.md +3 -4
- package/docs/configuration/env-variables.md +4 -4
- package/docs/configuration/folders.md +55 -54
- package/docs/desktop-automation/electron-apps.md +214 -162
- package/docs/get-started/introduction.md +60 -60
- package/docs/get-started/setup-wizard.md +7 -6
- package/docs/intelligence/site-profiles.md +151 -0
- package/docs/tools/tools.md +631 -293
- package/docs/troubleshooting/trouble-browser.md +1 -1
- package/docs/troubleshooting/trouble-loop.md +31 -31
- package/ext-dist/background.js +10 -62
- package/ext-dist/content.js +333 -920
- package/ext-dist/hud/hud.js +9 -9
- package/ext-dist/manifest.json +2 -6
- package/ext-dist/styles.css +6 -1
- package/icon.png +0 -0
- package/mcp.json +87 -71
- package/package.json +118 -119
- package/server.json +5 -5
- package/ext-dist/sidepanel/sidepanel.js +0 -25
- package/ext-dist/sidepanel.html +0 -547
package/package.json
CHANGED
|
@@ -1,119 +1,118 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@weavetab/mcp",
|
|
3
|
-
"version": "2.5.0-beta.
|
|
4
|
-
"description": "Direct Layer 0 interface for AI agents across web and desktop applications. No WebDriver. No cloud. Pure control.",
|
|
5
|
-
"author": {
|
|
6
|
-
"name": "fy2ne",
|
|
7
|
-
"email": "hello@fy2ne.me",
|
|
8
|
-
"url": "https://fy2ne.me"
|
|
9
|
-
},
|
|
10
|
-
"license": "AGPL-3.0-only",
|
|
11
|
-
"homepage": "https://github.com/weavetab/mcp",
|
|
12
|
-
"repository": {
|
|
13
|
-
"type": "git",
|
|
14
|
-
"url": "https://github.com/weavetab/mcp.git"
|
|
15
|
-
},
|
|
16
|
-
"bugs": {
|
|
17
|
-
"url": "https://github.com/weavetab/mcp/issues"
|
|
18
|
-
},
|
|
19
|
-
"keywords": [
|
|
20
|
-
"mcp server",
|
|
21
|
-
"mcp",
|
|
22
|
-
"model context protocol",
|
|
23
|
-
"browser automation",
|
|
24
|
-
"electron automation",
|
|
25
|
-
"desktop automation",
|
|
26
|
-
"ai agent",
|
|
27
|
-
"claude mcp",
|
|
28
|
-
"cursor mcp",
|
|
29
|
-
"cdp",
|
|
30
|
-
"chrome devtools protocol",
|
|
31
|
-
"local mcp",
|
|
32
|
-
"Weavetab",
|
|
33
|
-
"Weavetab MCP",
|
|
34
|
-
"@weavetab/mcp",
|
|
35
|
-
"puppeteer alternative",
|
|
36
|
-
"playwright alternative",
|
|
37
|
-
"autonomous agent"
|
|
38
|
-
],
|
|
39
|
-
"engines": {
|
|
40
|
-
"node": "^20.19.0 || ^22.12.0 || >=23"
|
|
41
|
-
},
|
|
42
|
-
"type": "module",
|
|
43
|
-
"main": "./dist/index.js",
|
|
44
|
-
"bin": {
|
|
45
|
-
"weavetab": "dist/index.js"
|
|
46
|
-
},
|
|
47
|
-
"publishConfig": {
|
|
48
|
-
"access": "public"
|
|
49
|
-
},
|
|
50
|
-
"mcpName": "io.github.
|
|
51
|
-
"files": [
|
|
52
|
-
"dist/",
|
|
53
|
-
"!dist/**/*.map",
|
|
54
|
-
"!dist/**/*.tsbuildinfo",
|
|
55
|
-
"ext-dist/",
|
|
56
|
-
"!ext-dist/**/src/**",
|
|
57
|
-
"!ext-dist/**/*.ts",
|
|
58
|
-
"docs/",
|
|
59
|
-
"mcp.json",
|
|
60
|
-
"server.json",
|
|
61
|
-
"smithery.yaml",
|
|
62
|
-
"AGENTS.md",
|
|
63
|
-
"SECURITY.md",
|
|
64
|
-
"TROUBLESHOOTING.md",
|
|
65
|
-
"ARCHITECTURE.md",
|
|
66
|
-
"icon.png",
|
|
67
|
-
"LICENSE",
|
|
68
|
-
"README.md"
|
|
69
|
-
],
|
|
70
|
-
"scripts": {
|
|
71
|
-
"build": "npm run build:ext && npm run build:hud &&
|
|
72
|
-
"build:hud": "esbuild ext-dist/hud/src/index.ts --bundle --minify --outfile=ext-dist/hud/hud.js --format=iife",
|
|
73
|
-
"build:
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"verify:
|
|
77
|
-
"verify
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"test": "node --
|
|
83
|
-
"test:
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
"@
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
"
|
|
97
|
-
"
|
|
98
|
-
"
|
|
99
|
-
"
|
|
100
|
-
"
|
|
101
|
-
"
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
"@types/
|
|
109
|
-
"@types/
|
|
110
|
-
"@types/
|
|
111
|
-
"@types/
|
|
112
|
-
"@types/
|
|
113
|
-
"@types/
|
|
114
|
-
"
|
|
115
|
-
"
|
|
116
|
-
"
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@weavetab/mcp",
|
|
3
|
+
"version": "2.5.0-beta.5",
|
|
4
|
+
"description": "Direct Layer 0 interface for AI agents across web and desktop applications. No WebDriver. No cloud. Pure control.",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "fy2ne",
|
|
7
|
+
"email": "hello@fy2ne.me",
|
|
8
|
+
"url": "https://fy2ne.me"
|
|
9
|
+
},
|
|
10
|
+
"license": "AGPL-3.0-only",
|
|
11
|
+
"homepage": "https://github.com/weavetab/mcp",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/weavetab/mcp.git"
|
|
15
|
+
},
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/weavetab/mcp/issues"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [
|
|
20
|
+
"mcp server",
|
|
21
|
+
"mcp",
|
|
22
|
+
"model context protocol",
|
|
23
|
+
"browser automation",
|
|
24
|
+
"electron automation",
|
|
25
|
+
"desktop automation",
|
|
26
|
+
"ai agent",
|
|
27
|
+
"claude mcp",
|
|
28
|
+
"cursor mcp",
|
|
29
|
+
"cdp",
|
|
30
|
+
"chrome devtools protocol",
|
|
31
|
+
"local mcp",
|
|
32
|
+
"Weavetab",
|
|
33
|
+
"Weavetab MCP",
|
|
34
|
+
"@weavetab/mcp",
|
|
35
|
+
"puppeteer alternative",
|
|
36
|
+
"playwright alternative",
|
|
37
|
+
"autonomous agent"
|
|
38
|
+
],
|
|
39
|
+
"engines": {
|
|
40
|
+
"node": "^20.19.0 || ^22.12.0 || >=23"
|
|
41
|
+
},
|
|
42
|
+
"type": "module",
|
|
43
|
+
"main": "./dist/index.js",
|
|
44
|
+
"bin": {
|
|
45
|
+
"weavetab": "dist/index.js"
|
|
46
|
+
},
|
|
47
|
+
"publishConfig": {
|
|
48
|
+
"access": "public"
|
|
49
|
+
},
|
|
50
|
+
"mcpName": "io.github.Weavetab/mcp",
|
|
51
|
+
"files": [
|
|
52
|
+
"dist/",
|
|
53
|
+
"!dist/**/*.map",
|
|
54
|
+
"!dist/**/*.tsbuildinfo",
|
|
55
|
+
"ext-dist/",
|
|
56
|
+
"!ext-dist/**/src/**",
|
|
57
|
+
"!ext-dist/**/*.ts",
|
|
58
|
+
"docs/",
|
|
59
|
+
"mcp.json",
|
|
60
|
+
"server.json",
|
|
61
|
+
"smithery.yaml",
|
|
62
|
+
"AGENTS.md",
|
|
63
|
+
"SECURITY.md",
|
|
64
|
+
"TROUBLESHOOTING.md",
|
|
65
|
+
"ARCHITECTURE.md",
|
|
66
|
+
"icon.png",
|
|
67
|
+
"LICENSE",
|
|
68
|
+
"README.md"
|
|
69
|
+
],
|
|
70
|
+
"scripts": {
|
|
71
|
+
"build": "npm run build:ext && npm run build:hud && tsc",
|
|
72
|
+
"build:hud": "esbuild ext-dist/hud/src/index.ts --bundle --minify --outfile=ext-dist/hud/hud.js --format=iife",
|
|
73
|
+
"build:ext": "node scripts/build-ext.js",
|
|
74
|
+
"docs:generate": "node scripts/generate-docs.js",
|
|
75
|
+
"verify:versions": "node scripts/verify-versions.js",
|
|
76
|
+
"verify:package": "node scripts/verify-package.js",
|
|
77
|
+
"verify": "npm run verify:versions && npm run verify:package",
|
|
78
|
+
"dev": "tsx src/index.ts",
|
|
79
|
+
"start": "node dist/index.js",
|
|
80
|
+
"prepublishOnly": "npm run verify && npm run build",
|
|
81
|
+
"test": "npm run test:unit",
|
|
82
|
+
"test:unit": "node --import tsx/esm --test \"tests/unit/cache.test.ts\" \"tests/unit/delta.test.ts\" \"tests/unit/sessionMemory.test.ts\" \"tests/unit/site_memory.test.ts\" \"tests/unit/trail.test.ts\" \"tests/unit/walker.test.ts\" \"tests/unit/burst.test.ts\" \"tests/unit/navigate.test.ts\" \"tests/unit/select.test.ts\" \"tests/unit/design_extract.test.ts\" \"tests/unit/plugin.test.ts\" \"tests/unit/plugin_lifecycle.test.ts\" \"tests/unit/plugin_interceptors.test.ts\" \"tests/unit/electron.test.ts\" \"tests/unit/stale_ref_recovery.test.ts\" \"tests/unit/secret_containment.test.ts\" \"tests/unit/checkpoint.test.ts\" \"tests/unit/marks.test.ts\" \"tests/unit/highlight.test.ts\"",
|
|
83
|
+
"test:e2e": "tsx tests/e2e/smoke_test.ts"
|
|
84
|
+
},
|
|
85
|
+
"dependencies": {
|
|
86
|
+
"@clack/prompts": "^1.3.0",
|
|
87
|
+
"@modelcontextprotocol/sdk": "^1.10.2",
|
|
88
|
+
"boxen": "^8.0.1",
|
|
89
|
+
"chalk": "^5.6.2",
|
|
90
|
+
"chrome-remote-interface": "^0.33.2",
|
|
91
|
+
"clipboardy": "^5.3.1",
|
|
92
|
+
"csv-parse": "^5.5.0",
|
|
93
|
+
"mammoth": "^1.6.0",
|
|
94
|
+
"open": "^11.0.0",
|
|
95
|
+
"ora": "^9.4.0",
|
|
96
|
+
"pdf-parse": "^1.1.1",
|
|
97
|
+
"picocolors": "^1.1.1",
|
|
98
|
+
"proper-lockfile": "^4.1.2",
|
|
99
|
+
"ws": "^8.20.0",
|
|
100
|
+
"xlsx": "^0.18.5",
|
|
101
|
+
"zod": "^3.25.76"
|
|
102
|
+
},
|
|
103
|
+
"optionalDependencies": {
|
|
104
|
+
"sharp": "^0.34.5"
|
|
105
|
+
},
|
|
106
|
+
"devDependencies": {
|
|
107
|
+
"@types/chrome-remote-interface": "^0.33.0",
|
|
108
|
+
"@types/cors": "^2.8.19",
|
|
109
|
+
"@types/express": "^4.17.25",
|
|
110
|
+
"@types/node": "^22.10.0",
|
|
111
|
+
"@types/pdf-parse": "^1.1.4",
|
|
112
|
+
"@types/proper-lockfile": "^4.1.4",
|
|
113
|
+
"@types/ws": "^8.18.1",
|
|
114
|
+
"esbuild": "^0.28.0",
|
|
115
|
+
"tsx": "^4.19.2",
|
|
116
|
+
"typescript": "^6.0.3"
|
|
117
|
+
}
|
|
118
|
+
}
|
package/server.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
|
|
3
|
-
"name": "io.github.
|
|
3
|
+
"name": "io.github.Weavetab/mcp",
|
|
4
4
|
"title": "Weavetab MCP",
|
|
5
|
-
"description": "
|
|
5
|
+
"description": "Give AI agents full control over live browsers and apps to navigate, click, extract, and automate.",
|
|
6
6
|
"repository": {
|
|
7
|
-
"url": "https://github.com/
|
|
7
|
+
"url": "https://github.com/Weavetab/mcp",
|
|
8
8
|
"source": "github"
|
|
9
9
|
},
|
|
10
|
-
"version": "2.5.0-beta.
|
|
10
|
+
"version": "2.5.0-beta.5",
|
|
11
11
|
"packages": [
|
|
12
12
|
{
|
|
13
13
|
"registryType": "npm",
|
|
14
14
|
"registryBaseUrl": "https://registry.npmjs.org",
|
|
15
15
|
"identifier": "@weavetab/mcp",
|
|
16
|
-
"version": "2.5.0-beta.
|
|
16
|
+
"version": "2.5.0-beta.5",
|
|
17
17
|
"transport": {
|
|
18
18
|
"type": "stdio"
|
|
19
19
|
},
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";(()=>{var s=typeof browser<"u"?browser:chrome,Y=s.runtime.connect({name:"wt-sidepanel"});Y.onDisconnect.addListener(()=>{});var f=document.getElementById("tool-feed-container"),E=document.getElementById("thoughts-feed"),S=document.getElementById("notes-list"),$=document.getElementById("status-dot"),P=document.getElementById("status-label"),R=document.getElementById("badge-devmode"),w=document.getElementById("notes-input"),Z=document.getElementById("btn-send"),T=!1,c=!0,tt=500,et=200;function b(t){let e={idle:{dot:"#6b7280",label:"IDLE",color:"#6b7280"},weaving:{dot:"#3b82f6",label:"WEAVING",color:"#3b82f6"},stuck:{dot:"#f59e0b",label:"STUCK",color:"#f59e0b"},done:{dot:"#10b981",label:"DONE",color:"#10b981"}},{dot:n,label:a,color:d}=e[t]??e.idle;$.style.background=n,$.style.boxShadow=`0 0 6px ${n}`,P.textContent=a,P.style.color=d}var y=new Map;function N(t){let{name:e,status:n,args:a,result:d,id:z}=t,I=z??e,r=y.get(I),k=!r;k&&(r=document.createElement("div"),r.className="tool-call",y.set(I,r));let B={pending:{icon:"\u23F3",cls:"status-pending"},done:{icon:"\u2713",cls:"status-done"},error:{icon:"\u2717",cls:"status-error"}},{icon:J,cls:A}=B[n]??B.pending,O=a?JSON.stringify(a).slice(0,150):"",H=d?String(d).slice(0,120):"",j=new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"});if(r.innerHTML=`
|
|
2
|
-
<div class="tool-header">
|
|
3
|
-
<span style="font-weight:600;color:var(--text);">${v(e??"?")}</span>
|
|
4
|
-
<div style="display:flex;align-items:center;gap:6px;">
|
|
5
|
-
<span style="font-size:9px;color:var(--text-muted);">${j}</span>
|
|
6
|
-
<span class="${A}">${J}</span>
|
|
7
|
-
</div>
|
|
8
|
-
</div>
|
|
9
|
-
${O?`<div class="tool-args">${v(O)}</div>`:""}
|
|
10
|
-
${H?`<div class="tool-result ${A}">${v(H)}</div>`:""}
|
|
11
|
-
`,k){let x=f.querySelector(".empty");for(x&&x.remove(),f.prepend(r);f.children.length>tt;){let M=f.lastElementChild;if(M){let C=[...y.entries()].find(([,Q])=>Q===M)?.[0];C&&y.delete(C),M.remove()}}}}function G(t,e="thought"){let n=E.querySelector(".empty");n&&n.remove();let a=document.createElement("div");a.className=`thought-item thought-${e}`;let d=new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"});for(a.innerHTML=`<span class="thought-ts">${d}</span><span class="thought-text">${v(t)}</span>`,E.prepend(a);E.children.length>et;)E.lastElementChild?.remove()}function V(t){if(S.innerHTML="",!t?.length){S.innerHTML='<div class="task-item"><span class="task-icon" style="color:var(--text-muted)">\u25CB</span><span style="color:var(--text-muted)">No active mission</span></div>';return}t.forEach(e=>{let n=document.createElement("div");n.className="task-item",n.innerHTML=`<span class="task-icon">\u25C8</span><span>${v(e)}</span>`,S.appendChild(n)})}s.runtime.onMessage.addListener(t=>{switch(t.type){case"Weavetab_GROUP_STATE":case"WT_AGENT_STATUS":{let e=t.state??t.status;(e==="weaving"||e==="idle"||e==="stuck"||e==="done")&&b(e);break}case"Weavetab_STATE":{if(t.hud?.action){let e=String(t.hud.action).trim();if(e){let n=e.startsWith("[ERR]")?"error":e.startsWith("[OK]")?"done":"pending";N({id:`wt-state-${Date.now()}-${Math.random()}`,name:e,status:n,timestamp:Date.now()})}}break}case"TOOL_CALL_EVENT":case"WT_TOOL_CALL":{let e=t.payload??t.data??t;e?.name&&N(e),(e?.status==="pending"||e?.status==="done")&&b((e.status==="pending","weaving"));break}case"WT_THOUGHT":{t.text&&G(t.text,t.kind??"thought");break}case"WT_PLAN_UPDATE":{V(t.data?.tasks??[]);break}case"WT_CONFIG_UPDATE":case"Weavetab_CONFIG":{T=!!t.devMode,R.style.display=T?"inline-block":"none";break}}});var p=!0,l=document.getElementById("btn-master-visuals"),g=document.getElementById("btn-scripted-pill");s.storage.local.get(["wt_devMode","wt_plan","wt_agent_status","wt_scripted_pill","wt_master_visuals"],t=>{T=!!t.wt_devMode,R.style.display=T?"inline-block":"none",t.wt_plan?.tasks&&V(t.wt_plan.tasks),t.wt_agent_status&&b(t.wt_agent_status),c=t.wt_scripted_pill!==!1,F(),p=t.wt_master_visuals!==!1,U()});function U(){l&&(p?(l.textContent="Visuals: ON",l.classList.remove("off")):(l.textContent="Visuals: OFF",l.classList.add("off")))}function nt(t){s.runtime.sendMessage({type:"WT_TOGGLE_MASTER_VISUALS",enabled:t}).catch(()=>{}),s.tabs.query({},e=>{e.forEach(n=>{n.id&&s.tabs.sendMessage(n.id,{type:"WT_TOGGLE_MASTER_VISUALS",enabled:t}).catch(()=>{})})})}l&&l.addEventListener("click",()=>{p=!p,s.storage.local.set({wt_master_visuals:p}),U(),nt(p)});function F(){g&&(g.textContent=c?"Cursor Pills: ON":"Cursor Pills: OFF",g.style.opacity=c?"1":"0.5")}function st(t){s.tabs.query({},e=>{e.forEach(n=>{n.id&&s.tabs.sendMessage(n.id,{type:"WT_SCRIPTED_PILL_TOGGLE",enabled:t}).catch(()=>{})})})}g&&g.addEventListener("click",()=>{c=!c,s.storage.local.set({wt_scripted_pill:c}),F(),st(c)});var W="dom_target",u=null,i=document.getElementById("btn-snipe-trigger"),o=document.getElementById("snipe-popover"),_=document.getElementById("popover-opt-dom"),h=document.getElementById("popover-opt-vision"),L=document.getElementById("snipe-badge-container"),m=document.getElementById("snipe-badge-content"),D=document.getElementById("btn-remove-snipe");function it(t){if(t.stopPropagation(),!o)return;let e=o.style.display==="none";o.style.display=e?"flex":"none",i&&i.classList.toggle("active",e)}document.addEventListener("click",t=>{o&&o.style.display!=="none"&&!o.contains(t.target)&&t.target!==i&&(o.style.display="none",i&&i.classList.remove("active"))});i&&i.addEventListener("click",it);function q(t){W=t,o&&(o.style.display="none"),i&&i.classList.add("active"),_&&_.classList.toggle("active",t==="dom_target"),h&&h.classList.toggle("active",t==="visual_crop"),s.tabs.query({active:!0,currentWindow:!0},e=>{e[0]?.id&&s.tabs.sendMessage(e[0].id,{type:"WT_START_SNIPE",mode:W}).catch(()=>{})})}_&&_.addEventListener("click",()=>q("dom_target"));h&&h.addEventListener("click",()=>q("visual_crop"));function K(){u=null,L&&(L.style.display="none"),m&&(m.innerHTML=""),i&&i.classList.remove("active")}D&&D.addEventListener("click",K);function ot(t){if(u=t,i&&i.classList.remove("active"),!(!L||!m))if(L.style.display="flex",t.mode==="visual_crop"&&t.cropImage){let e=t.boundingRect?`${t.boundingRect.width}\xD7${t.boundingRect.height}px`:"WebP Image",n=t.cropImage?Math.round(t.cropImage.length/120):100;m.innerHTML=`
|
|
12
|
-
<img class="snipe-badge-thumb" src="${t.cropImage}" alt="crop preview" />
|
|
13
|
-
<div class="snipe-badge-meta">
|
|
14
|
-
<span class="snipe-badge-title">Vision Crop Attachment</span>
|
|
15
|
-
<span class="snipe-badge-subtitle">${e} \u2022 WebP Image (~${n} tokens)</span>
|
|
16
|
-
</div>
|
|
17
|
-
`}else{let e=t.elements?.length||0,n=t.elements?.[0]?.selector||t.elements?.[0]?.tag||"DOM Target";m.innerHTML=`
|
|
18
|
-
<div class="snipe-badge-icon-box">
|
|
19
|
-
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="16 18 22 12 16 6"/><polyline points="8 6 2 12 8 18"/></svg>
|
|
20
|
-
</div>
|
|
21
|
-
<div class="snipe-badge-meta">
|
|
22
|
-
<span class="snipe-badge-title">DOM Target Attachment</span>
|
|
23
|
-
<span class="snipe-badge-subtitle">${e} elements \u2022 0 image tokens</span>
|
|
24
|
-
</div>
|
|
25
|
-
`}}s.runtime.onMessage.addListener(t=>{t.type==="WT_SNIPE_COMPLETED"&&t.payload&&ot(t.payload)});function X(){let t=w.value.trim();if(!t&&!u)return;let e={type:"WT_USER_NOTE",text:t||"(Targeted area annotation sent)",ts:Date.now()};u&&(e.snipe=u),s.runtime.sendMessage(e).catch(()=>{}),G(`[you] ${u?"[Snipe Attached] ":""}${t||"Annotation attached"}`,"action"),w.value="",K()}Z.addEventListener("click",X);w.addEventListener("keydown",t=>{t.key==="Enter"&&X()});function v(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}b("idle");})();
|