@eyeglass/bridge 0.1.5 → 0.1.6

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 (3) hide show
  1. package/README.md +17 -2
  2. package/dist/store.js +32 -1
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # @eyeglass/bridge
2
2
 
3
- MCP server that connects the browser inspector to Claude Code for [Eyeglass](https://github.com/donutboyband/eyeglass).
3
+ Server that connects the browser inspector to AI coding agents for [Eyeglass](https://github.com/donutboyband/eyeglass).
4
+
5
+ **Supported agents:** Claude Code, GitHub Copilot CLI, OpenAI Codex CLI
4
6
 
5
7
  ## Installation
6
8
 
@@ -12,7 +14,9 @@ npm install @eyeglass/bridge
12
14
 
13
15
  ## Usage
14
16
 
15
- The bridge runs as an MCP server. Add to `.claude/settings.json`:
17
+ The bridge runs as an MCP server (Claude, Copilot) or HTTP server (Codex).
18
+
19
+ **MCP config** (`.claude/settings.json` or `.copilot/mcp-config.json`):
16
20
 
17
21
  ```json
18
22
  {
@@ -37,8 +41,19 @@ The bridge runs as an MCP server. Add to `.claude/settings.json`:
37
41
  | `wait_for_request` | Long-poll for new requests |
38
42
  | `get_focus_history` | Get previously focused elements |
39
43
 
44
+ ## HTTP API (for Codex)
45
+
46
+ | Endpoint | Description |
47
+ |----------|-------------|
48
+ | `GET /api/focus` | Get current focus as markdown |
49
+ | `GET /api/wait` | Long-poll for new requests |
50
+ | `POST /api/status` | Update status |
51
+ | `POST /api/thought` | Send thought |
52
+ | `POST /api/action` | Report action |
53
+
40
54
  ## Features
41
55
 
56
+ - **Rich context** - element info, accessibility, styles, and DOM neighborhood (parent layout context)
42
57
  - **Auto-commits** changes on success with `[eyeglass:<id>]` tags
43
58
  - **One-click undo** via `git revert`
44
59
  - **Real-time updates** via Server-Sent Events
package/dist/store.js CHANGED
@@ -376,7 +376,28 @@ ${styles.gridTemplate ? `- Grid Template: ${styles.gridTemplate}` : ''}
376
376
  - Detected: ${framework.name}
377
377
  ${framework.ancestry ? `- Component Tree: ${framework.ancestry.join(' > ')}` : ''}
378
378
  ${framework.props ? `- Props: ${JSON.stringify(framework.props, null, 2)}` : ''}
379
+ ${snapshot.neighborhood ? `
380
+ ### DOM Neighborhood
381
+ **Parents (layout context):**
382
+ ${snapshot.neighborhood.parents.length > 0 ? snapshot.neighborhood.parents.map((p, i) => {
383
+ const styleInfo = [
384
+ p.styles.display,
385
+ p.styles.position !== 'static' ? p.styles.position : null,
386
+ p.styles.flexDirection,
387
+ p.styles.alignItems ? `align: ${p.styles.alignItems}` : null,
388
+ p.styles.justifyContent ? `justify: ${p.styles.justifyContent}` : null,
389
+ p.styles.gap ? `gap: ${p.styles.gap}` : null,
390
+ p.styles.gridTemplate ? `grid: ${p.styles.gridTemplate}` : null,
391
+ ].filter(Boolean).join(', ');
392
+ return `${i + 1}. \`<${p.tagName}>\`${p.className ? ` .${p.className.split(' ')[0]}` : ''} — ${styleInfo}`;
393
+ }).join('\n') : '(none)'}
379
394
 
395
+ **Children:**
396
+ ${snapshot.neighborhood.children.length > 0 ? snapshot.neighborhood.children.map(c => {
397
+ const countStr = c.count && c.count > 1 ? ` x${c.count}` : '';
398
+ return `- \`<${c.tagName}>\`${c.className ? ` .${c.className.split(' ')[0]}` : ''}${countStr}`;
399
+ }).join('\n') : '(none)'}
400
+ ` : ''}
380
401
  ### Page Context
381
402
  - URL: ${snapshot.url}
382
403
  - Timestamp: ${new Date(snapshot.timestamp).toISOString()}
@@ -426,7 +447,17 @@ ${styles.gridTemplate ? `- Grid Template: ${styles.gridTemplate}` : ''}
426
447
  - Detected: ${framework.name}
427
448
  ${framework.ancestry ? `- Component Tree: ${framework.ancestry.join(' > ')}` : ''}
428
449
  ${framework.props ? `- Props: ${JSON.stringify(framework.props, null, 2)}` : ''}
429
- `;
450
+ ${snapshot.neighborhood ? `
451
+ ### DOM Neighborhood
452
+ **Parents:** ${snapshot.neighborhood.parents.length > 0 ? snapshot.neighborhood.parents.map(p => {
453
+ const styleInfo = [p.styles.display, p.styles.flexDirection, p.styles.gap].filter(Boolean).join(', ');
454
+ return `\`<${p.tagName}>\` (${styleInfo})`;
455
+ }).join(' > ') : '(none)'}
456
+ **Children:** ${snapshot.neighborhood.children.length > 0 ? snapshot.neighborhood.children.map(c => {
457
+ const countStr = c.count && c.count > 1 ? ` x${c.count}` : '';
458
+ return `\`<${c.tagName}>\`${countStr}`;
459
+ }).join(', ') : '(none)'}
460
+ ` : ''}`;
430
461
  }).join('\n---\n\n');
431
462
  return `# User Focus Request (${snapshots.length} Elements)
432
463
  **Interaction ID:** ${interactionId}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eyeglass/bridge",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "MCP server bridge for Eyeglass",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",