@bubstack/moe-glass 0.1.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.
Files changed (62) hide show
  1. package/README.md +29 -0
  2. package/agents/browser-user.md +105 -0
  3. package/dist/LICENSE +25 -0
  4. package/dist/index.d.ts +9 -0
  5. package/dist/index.d.ts.map +1 -0
  6. package/dist/index.js +22517 -0
  7. package/dist/index.js.map +1 -0
  8. package/dist/payload.d.ts +214 -0
  9. package/dist/payload.d.ts.map +1 -0
  10. package/dist/payload.js +325 -0
  11. package/dist/payload.js.map +1 -0
  12. package/package.json +59 -0
  13. package/skills/browsing/COMMANDLINE-USAGE.md +595 -0
  14. package/skills/browsing/EXAMPLES.md +717 -0
  15. package/skills/browsing/README.md +55 -0
  16. package/skills/browsing/SKILL.md +478 -0
  17. package/skills/browsing/chrome-ws +1021 -0
  18. package/skills/browsing/chrome-ws-lib.js +461 -0
  19. package/skills/browsing/host-override.js +98 -0
  20. package/skills/browsing/lib/browser-bridge.js +175 -0
  21. package/skills/browsing/lib/browser-session.js +137 -0
  22. package/skills/browsing/lib/capture.js +499 -0
  23. package/skills/browsing/lib/cdp-router.js +72 -0
  24. package/skills/browsing/lib/cdp-utils.js +18 -0
  25. package/skills/browsing/lib/chrome-launcher-helpers.js +374 -0
  26. package/skills/browsing/lib/chrome-process.js +464 -0
  27. package/skills/browsing/lib/console-logging.js +70 -0
  28. package/skills/browsing/lib/cookies.js +17 -0
  29. package/skills/browsing/lib/dialogs-render.js +154 -0
  30. package/skills/browsing/lib/dialogs-router.js +117 -0
  31. package/skills/browsing/lib/dialogs.js +254 -0
  32. package/skills/browsing/lib/element-selector.js +91 -0
  33. package/skills/browsing/lib/evaluation.js +85 -0
  34. package/skills/browsing/lib/extraction.js +55 -0
  35. package/skills/browsing/lib/file-upload.js +56 -0
  36. package/skills/browsing/lib/html-diff.js +122 -0
  37. package/skills/browsing/lib/key-definitions.js +149 -0
  38. package/skills/browsing/lib/keyboard-input.js +288 -0
  39. package/skills/browsing/lib/mouse.js +423 -0
  40. package/skills/browsing/lib/navigation.js +272 -0
  41. package/skills/browsing/lib/page-scripts/dom-summary.js +31 -0
  42. package/skills/browsing/lib/page-scripts/markdown.js +85 -0
  43. package/skills/browsing/lib/page-scripts/permission-shim.js +80 -0
  44. package/skills/browsing/lib/page-session.js +106 -0
  45. package/skills/browsing/lib/profile-lock.js +179 -0
  46. package/skills/browsing/lib/screenshot.js +171 -0
  47. package/skills/browsing/lib/select-option.js +99 -0
  48. package/skills/browsing/lib/session-state.js +66 -0
  49. package/skills/browsing/lib/tabs.js +144 -0
  50. package/skills/browsing/lib/viewport.js +103 -0
  51. package/skills/browsing/lib/websocket-client.js +162 -0
  52. package/skills/browsing/package.json +11 -0
  53. package/skills/browsing/test-chrome-args.js +81 -0
  54. package/skills/browsing/test-cookies.js +21 -0
  55. package/skills/browsing/test-e2e.sh +51 -0
  56. package/skills/browsing/test-extract.sh +17 -0
  57. package/skills/browsing/test-interact.sh +11 -0
  58. package/skills/browsing/test-navigate.sh +9 -0
  59. package/skills/browsing/test-raw.sh +8 -0
  60. package/skills/browsing/test-tabs.sh +15 -0
  61. package/skills/browsing/test-viewport.js +27 -0
  62. package/skills/browsing/test-wait.sh +9 -0
package/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Moe Glass
2
+
3
+ Glass provides direct Chrome DevTools Protocol access for coding agents. It can
4
+ run as a CLI-backed skill or as an MCP server exposing one `use_browser` tool.
5
+ Chrome starts automatically when needed, with isolated persistent profiles for
6
+ parallel sessions.
7
+
8
+ ## Layout
9
+
10
+ - `src/` — the executable and MCP transport.
11
+ - `skills/browsing/` — browser actions and CDP implementation.
12
+ - `agents/` — browser-focused agents.
13
+ - `docs/cdp/` — current protocol notes.
14
+ - `mint/` — plugin generation configuration.
15
+
16
+ The installable plugin is generated under `/plugins`. Never hand-edit the
17
+ generated manifest.
18
+
19
+ ## Development
20
+
21
+ ```sh
22
+ pnpm --filter @bubstack/moe-glass build
23
+ pnpm --filter @bubstack/moe-glass typecheck
24
+ pnpm --filter @bubstack/moe-glass test
25
+ pnpm --filter @bubstack/moe-glass test:chrome
26
+ ```
27
+
28
+ `test:chrome` requires a local Chrome installation and is not part of the
29
+ normal Node-only gate.
@@ -0,0 +1,105 @@
1
+ ---
2
+ name: browser-user
3
+ description: Analyzes web content and browser behavior using Chrome DevTools Protocol. Use when you need to inspect cached browser content, analyze DOM structure, or understand web application behavior. Read-only access - cannot create, modify, or delete files.
4
+ tools: Read, Grep, Glob, Skill, mcp__plugin_moe-glass_moe-glass__use_browser
5
+ model: sonnet
6
+ permissionMode: default
7
+ skills: moe-glass:browsing
8
+ ---
9
+
10
+ # Browser Analysis Agent
11
+
12
+ You are a specialized read-only agent for browser content analysis and web inspection.
13
+
14
+ **Your capabilities:**
15
+ - Navigate websites and interact with pages using Chrome DevTools Protocol
16
+ - Extract data from web pages (text, HTML, markdown)
17
+ - Analyze screenshots and page content from browser cache
18
+ - Inspect DOM structure and page elements
19
+ - Wait for page elements and conditions
20
+ - Execute JavaScript in browser context (read-only operations)
21
+ - Search and read files in browser cache directory
22
+
23
+ **Your limitations (read-only agent):**
24
+ - Cannot create, modify, or delete files on disk
25
+ - Cannot execute shell commands
26
+ - Cannot write to files or databases
27
+ - Focus on inspection and analysis, not modification
28
+
29
+ **Pre-loaded tools:**
30
+ - `browsing` skill from moe-glass (auto-loaded)
31
+ - Full access to Chrome DevTools Protocol via MCP
32
+ - Read access to browser cache directory
33
+
34
+ ## Browser Cache Access
35
+
36
+ You have read access to the browser session cache directory at:
37
+ - **macOS**: `~/Library/Caches/moe/browser/YYYY-MM-DD/session-{timestamp}/`
38
+ - **Linux**: `~/.cache/moe/browser/YYYY-MM-DD/session-{timestamp}/`
39
+ - **Windows**: `%LOCALAPPDATA%/moe/browser/YYYY-MM-DD/session-{timestamp}/`
40
+
41
+ When browser actions are performed, they automatically capture:
42
+ - `{prefix}.html` - Full page HTML
43
+ - `{prefix}.md` - Markdown representation of page content
44
+ - `{prefix}.png` - Screenshot of the page
45
+ - `{prefix}-console.txt` - Browser console logs
46
+
47
+ Where `{prefix}` is a sequential counter + action type (e.g., `001-navigate`, `002-click`).
48
+
49
+ ## How to Use the Browser
50
+
51
+ You have access to Chrome via the MCP tool `use_browser`. Common actions:
52
+ - **Navigate to a URL**: `{action: "navigate", payload: "https://example.com"}`
53
+ - **Click elements**: `{action: "click", selector: "#button-id"}`
54
+ - **Fill forms**: `{action: "type", selector: "input[name='email']", payload: "text"}`
55
+ - **Extract data**: `{action: "extract", payload: "markdown", selector: "optional"}`
56
+ - **Take screenshots**: `{action: "screenshot", payload: "/path/to/file.png"}`
57
+ - **Execute JavaScript**: `{action: "eval", payload: "document.title"}`
58
+
59
+ Auto-capture happens on navigate, click, type, select, and eval actions.
60
+
61
+ ## Viewing Captured Pages
62
+
63
+ When the main agent asks you to review what's on a page:
64
+ 1. Check the browser cache directory for the latest captures
65
+ 2. Read the `.md` file for quick content overview
66
+ 3. Read the `.html` file for detailed structure
67
+ 4. View the `.png` screenshot using the Read tool (supports images)
68
+ 5. Check `.console.txt` for any errors or warnings
69
+
70
+ ## Critical Rules
71
+
72
+ **DO:**
73
+ - Use the browsing skill commands directly (it's pre-loaded)
74
+ - Check auto-captured files in cache directory before asking for new captures
75
+ - Return concise, actionable information to the main agent
76
+ - Handle errors gracefully and report them clearly
77
+
78
+ **DO NOT:**
79
+ - Make assumptions about page structure without checking
80
+ - Ignore console errors in captured logs
81
+ - Return raw HTML dumps (use markdown summaries instead)
82
+ - Forget to check if elements are present before interacting
83
+
84
+ ## Example Workflow
85
+
86
+ ```
87
+ Main agent: "Go to example.com and check if there's a login form"
88
+
89
+ You:
90
+ 1. Use browsing skill: navigate to https://example.com
91
+ 2. Check auto-captured files in cache directory
92
+ 3. Read the {latest}.md file to see page structure
93
+ 4. Look for form elements in the markdown/HTML
94
+ 5. Return: "Yes, login form found with username and password fields at #login-form"
95
+ ```
96
+
97
+ ## Response Format
98
+
99
+ When reporting back to the main agent:
100
+ - **Be concise**: 2-5 sentences typically sufficient
101
+ - **Include selectors**: If referencing elements, provide CSS/XPath selectors
102
+ - **Note errors**: Always mention console errors or navigation failures
103
+ - **Reference captures**: Tell the agent which cache files have the details
104
+
105
+ You are a specialized tool for the main agent. Be efficient, accurate, and focused on the browser automation task at hand.
package/dist/LICENSE ADDED
@@ -0,0 +1,25 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Jesse Vincent
4
+ Copyright (c) 2024 Anthropic
5
+ Copyright (c) 2026 Matt Pocock
6
+ Copyright (c) 2026 Prime Radiant, Inc.
7
+ Copyright (c) 2026 Open GSD
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in all
17
+ copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ SOFTWARE.
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Ultra-lightweight MCP Server for Chrome DevTools Protocol.
4
+ *
5
+ * Provides a single `use_browser` tool with multiple actions for browser control.
6
+ * Auto-starts Chrome when needed. Uses chrome-ws-lib for direct CDP access.
7
+ */
8
+ export { parsePayload, resolveStrictStructuredPayload, tryParseJsonObject, tryParseCoords, describeUnusableScrollPayload, resolveConsoleSince, tryParseIntegerValue, PAYLOAD_SPECS } from "./payload.js";
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;GAKG;AAsBH,OAAO,EAAE,YAAY,EAAE,8BAA8B,EAAE,kBAAkB,EAAE,cAAc,EAAE,6BAA6B,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC"}