chrome-ai-bridge 2.3.9 → 2.3.10
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/build/extension/README.md +181 -0
- package/build/extension/background.mjs +1263 -0
- package/build/extension/debug-logger.mjs +148 -0
- package/build/extension/icons/icon-128.png +0 -0
- package/build/extension/icons/icon-16.png +0 -0
- package/build/extension/icons/icon-32.png +0 -0
- package/build/extension/icons/icon-48.png +0 -0
- package/build/extension/icons/icon.svg +19 -0
- package/build/extension/manifest.json +28 -0
- package/build/extension/relay-server.ts +505 -0
- package/build/extension/ui/connect.html +429 -0
- package/build/extension/ui/connect.js +491 -0
- package/package.json +2 -1
|
@@ -0,0 +1,429 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<title>chrome-ai-bridge - Select Tab</title>
|
|
6
|
+
<style>
|
|
7
|
+
:root {
|
|
8
|
+
--bg-primary: #ffffff;
|
|
9
|
+
--bg-secondary: #f6f8fa;
|
|
10
|
+
--bg-hover: #f3f4f6;
|
|
11
|
+
--text-primary: #24292f;
|
|
12
|
+
--text-secondary: #57606a;
|
|
13
|
+
--text-muted: #8b949e;
|
|
14
|
+
--border-color: #d0d7de;
|
|
15
|
+
--border-hover: #1f6feb;
|
|
16
|
+
--accent-color: #1f6feb;
|
|
17
|
+
--success-bg: #dafbe1;
|
|
18
|
+
--success-text: #1a7f37;
|
|
19
|
+
--error-bg: #ffebe9;
|
|
20
|
+
--error-text: #cf222e;
|
|
21
|
+
--info-bg: #ddf4ff;
|
|
22
|
+
--info-text: #0969da;
|
|
23
|
+
--active-bg: #fff8c5;
|
|
24
|
+
--active-border: #d4a72c;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
* {
|
|
28
|
+
box-sizing: border-box;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
body {
|
|
32
|
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
|
|
33
|
+
margin: 0;
|
|
34
|
+
padding: 20px;
|
|
35
|
+
background: var(--bg-secondary);
|
|
36
|
+
min-width: 500px;
|
|
37
|
+
color: var(--text-primary);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.container {
|
|
41
|
+
background: var(--bg-primary);
|
|
42
|
+
border-radius: 12px;
|
|
43
|
+
padding: 24px;
|
|
44
|
+
box-shadow: 0 1px 3px rgba(27, 31, 35, 0.12), 0 8px 24px rgba(66, 74, 83, 0.12);
|
|
45
|
+
max-width: 640px;
|
|
46
|
+
margin: 0 auto;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.header {
|
|
50
|
+
display: flex;
|
|
51
|
+
align-items: center;
|
|
52
|
+
gap: 12px;
|
|
53
|
+
margin-bottom: 20px;
|
|
54
|
+
padding-bottom: 16px;
|
|
55
|
+
border-bottom: 1px solid var(--border-color);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.header-icon {
|
|
59
|
+
font-size: 28px;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.header-title {
|
|
63
|
+
margin: 0;
|
|
64
|
+
font-size: 20px;
|
|
65
|
+
font-weight: 600;
|
|
66
|
+
color: var(--text-primary);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.status {
|
|
70
|
+
padding: 12px 16px;
|
|
71
|
+
border-radius: 6px;
|
|
72
|
+
margin-bottom: 16px;
|
|
73
|
+
font-size: 14px;
|
|
74
|
+
display: flex;
|
|
75
|
+
align-items: center;
|
|
76
|
+
gap: 8px;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.status.info {
|
|
80
|
+
background: var(--info-bg);
|
|
81
|
+
color: var(--info-text);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.status.success {
|
|
85
|
+
background: var(--success-bg);
|
|
86
|
+
color: var(--success-text);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.status.error {
|
|
90
|
+
background: var(--error-bg);
|
|
91
|
+
color: var(--error-text);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.status-icon {
|
|
95
|
+
font-size: 16px;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.section-label {
|
|
99
|
+
font-size: 13px;
|
|
100
|
+
font-weight: 500;
|
|
101
|
+
color: var(--text-secondary);
|
|
102
|
+
margin-bottom: 12px;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.tabs-list {
|
|
106
|
+
max-height: 450px;
|
|
107
|
+
overflow-y: auto;
|
|
108
|
+
border: 1px solid var(--border-color);
|
|
109
|
+
border-radius: 8px;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.tab-item {
|
|
113
|
+
display: flex;
|
|
114
|
+
align-items: center;
|
|
115
|
+
padding: 12px 16px;
|
|
116
|
+
border-bottom: 1px solid var(--border-color);
|
|
117
|
+
cursor: pointer;
|
|
118
|
+
transition: background 0.15s ease;
|
|
119
|
+
gap: 12px;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.tab-item:last-child {
|
|
123
|
+
border-bottom: none;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.tab-item:hover {
|
|
127
|
+
background: var(--bg-hover);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.tab-item.active {
|
|
131
|
+
background: var(--active-bg);
|
|
132
|
+
border-left: 3px solid var(--active-border);
|
|
133
|
+
padding-left: 13px;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.tab-favicon {
|
|
137
|
+
width: 20px;
|
|
138
|
+
height: 20px;
|
|
139
|
+
border-radius: 4px;
|
|
140
|
+
flex-shrink: 0;
|
|
141
|
+
background: var(--bg-secondary);
|
|
142
|
+
display: flex;
|
|
143
|
+
align-items: center;
|
|
144
|
+
justify-content: center;
|
|
145
|
+
font-size: 12px;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.tab-favicon img {
|
|
149
|
+
width: 16px;
|
|
150
|
+
height: 16px;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.tab-info {
|
|
154
|
+
flex: 1;
|
|
155
|
+
min-width: 0;
|
|
156
|
+
overflow: hidden;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.tab-title-row {
|
|
160
|
+
display: flex;
|
|
161
|
+
align-items: center;
|
|
162
|
+
gap: 8px;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.tab-title {
|
|
166
|
+
font-weight: 500;
|
|
167
|
+
color: var(--text-primary);
|
|
168
|
+
font-size: 14px;
|
|
169
|
+
white-space: nowrap;
|
|
170
|
+
overflow: hidden;
|
|
171
|
+
text-overflow: ellipsis;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.tab-active-badge {
|
|
175
|
+
font-size: 11px;
|
|
176
|
+
padding: 2px 6px;
|
|
177
|
+
background: var(--active-border);
|
|
178
|
+
color: white;
|
|
179
|
+
border-radius: 10px;
|
|
180
|
+
flex-shrink: 0;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.tab-url {
|
|
184
|
+
font-size: 12px;
|
|
185
|
+
color: var(--text-secondary);
|
|
186
|
+
margin-top: 2px;
|
|
187
|
+
white-space: nowrap;
|
|
188
|
+
overflow: hidden;
|
|
189
|
+
text-overflow: ellipsis;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.tab-id {
|
|
193
|
+
font-size: 11px;
|
|
194
|
+
color: var(--text-muted);
|
|
195
|
+
margin-top: 2px;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.tab-connect-btn {
|
|
199
|
+
padding: 6px 14px;
|
|
200
|
+
font-size: 13px;
|
|
201
|
+
font-weight: 500;
|
|
202
|
+
border-radius: 6px;
|
|
203
|
+
border: 1px solid var(--border-color);
|
|
204
|
+
background: var(--bg-secondary);
|
|
205
|
+
color: var(--text-primary);
|
|
206
|
+
cursor: pointer;
|
|
207
|
+
transition: all 0.15s ease;
|
|
208
|
+
flex-shrink: 0;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.tab-connect-btn:hover {
|
|
212
|
+
background: var(--accent-color);
|
|
213
|
+
color: white;
|
|
214
|
+
border-color: var(--accent-color);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.tab-connect-btn:disabled {
|
|
218
|
+
background: var(--bg-secondary);
|
|
219
|
+
color: var(--text-muted);
|
|
220
|
+
cursor: not-allowed;
|
|
221
|
+
border-color: var(--border-color);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.hidden {
|
|
225
|
+
display: none !important;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.connected-view {
|
|
229
|
+
text-align: center;
|
|
230
|
+
padding: 24px;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.connected-icon {
|
|
234
|
+
font-size: 48px;
|
|
235
|
+
margin-bottom: 16px;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.connected-title {
|
|
239
|
+
font-size: 16px;
|
|
240
|
+
font-weight: 600;
|
|
241
|
+
color: var(--text-primary);
|
|
242
|
+
margin-bottom: 8px;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.connected-details {
|
|
246
|
+
font-size: 13px;
|
|
247
|
+
color: var(--text-secondary);
|
|
248
|
+
margin-bottom: 20px;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.disconnect-btn {
|
|
252
|
+
padding: 8px 20px;
|
|
253
|
+
font-size: 14px;
|
|
254
|
+
font-weight: 500;
|
|
255
|
+
border-radius: 6px;
|
|
256
|
+
border: 1px solid var(--error-text);
|
|
257
|
+
background: var(--bg-primary);
|
|
258
|
+
color: var(--error-text);
|
|
259
|
+
cursor: pointer;
|
|
260
|
+
transition: all 0.15s ease;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
.disconnect-btn:hover {
|
|
264
|
+
background: var(--error-text);
|
|
265
|
+
color: white;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/* Debug Panel Styles */
|
|
269
|
+
#debug-toggle {
|
|
270
|
+
margin-top: 20px;
|
|
271
|
+
padding: 8px 16px;
|
|
272
|
+
font-size: 12px;
|
|
273
|
+
font-weight: 500;
|
|
274
|
+
border-radius: 6px;
|
|
275
|
+
border: 1px solid var(--border-color);
|
|
276
|
+
background: var(--bg-secondary);
|
|
277
|
+
color: var(--text-secondary);
|
|
278
|
+
cursor: pointer;
|
|
279
|
+
transition: all 0.15s ease;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
#debug-toggle:hover {
|
|
283
|
+
background: var(--bg-hover);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
#debug-panel {
|
|
287
|
+
margin-top: 20px;
|
|
288
|
+
border-top: 1px solid var(--border-color);
|
|
289
|
+
padding-top: 16px;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
#debug-panel h3 {
|
|
293
|
+
margin: 0 0 12px 0;
|
|
294
|
+
font-size: 14px;
|
|
295
|
+
color: var(--text-secondary);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
.debug-controls {
|
|
299
|
+
display: flex;
|
|
300
|
+
gap: 8px;
|
|
301
|
+
margin-bottom: 12px;
|
|
302
|
+
flex-wrap: wrap;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
.debug-controls select {
|
|
306
|
+
padding: 6px 10px;
|
|
307
|
+
border: 1px solid var(--border-color);
|
|
308
|
+
border-radius: 4px;
|
|
309
|
+
font-size: 13px;
|
|
310
|
+
background: white;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
.debug-controls button {
|
|
314
|
+
padding: 6px 12px;
|
|
315
|
+
font-size: 13px;
|
|
316
|
+
border-radius: 4px;
|
|
317
|
+
border: 1px solid var(--border-color);
|
|
318
|
+
background: var(--bg-secondary);
|
|
319
|
+
cursor: pointer;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
.debug-controls button.danger {
|
|
323
|
+
background: var(--error-bg);
|
|
324
|
+
color: var(--error-text);
|
|
325
|
+
border-color: var(--error-text);
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
#debug-stats {
|
|
329
|
+
font-size: 12px;
|
|
330
|
+
color: var(--text-secondary);
|
|
331
|
+
margin-bottom: 8px;
|
|
332
|
+
padding: 8px;
|
|
333
|
+
background: var(--bg-secondary);
|
|
334
|
+
border-radius: 4px;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
#log-output {
|
|
338
|
+
font-family: 'SF Mono', 'Menlo', 'Monaco', monospace;
|
|
339
|
+
font-size: 11px;
|
|
340
|
+
line-height: 1.4;
|
|
341
|
+
background: #1e1e1e;
|
|
342
|
+
color: #d4d4d4;
|
|
343
|
+
padding: 12px;
|
|
344
|
+
border-radius: 6px;
|
|
345
|
+
max-height: 300px;
|
|
346
|
+
overflow-y: auto;
|
|
347
|
+
white-space: pre-wrap;
|
|
348
|
+
word-break: break-all;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
.log-entry .ts { color: #6a9955; }
|
|
352
|
+
.log-entry .cat-ws { color: #569cd6; }
|
|
353
|
+
.log-entry .cat-cdp { color: #ce9178; }
|
|
354
|
+
.log-entry .cat-tab { color: #dcdcaa; }
|
|
355
|
+
.log-entry .cat-relay { color: #c586c0; }
|
|
356
|
+
.log-entry .cat-error { color: #f44747; }
|
|
357
|
+
.log-entry .msg { color: #d4d4d4; }
|
|
358
|
+
.log-entry .data { color: #9cdcfe; margin-left: 4px; }
|
|
359
|
+
|
|
360
|
+
.empty-state {
|
|
361
|
+
padding: 40px 20px;
|
|
362
|
+
text-align: center;
|
|
363
|
+
color: var(--text-secondary);
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
.empty-state-icon {
|
|
367
|
+
font-size: 32px;
|
|
368
|
+
margin-bottom: 12px;
|
|
369
|
+
}
|
|
370
|
+
</style>
|
|
371
|
+
</head>
|
|
372
|
+
<body>
|
|
373
|
+
<div class="container">
|
|
374
|
+
<div class="header">
|
|
375
|
+
<span class="header-icon">🎭</span>
|
|
376
|
+
<h1 class="header-title">chrome-ai-bridge - Select Tab</h1>
|
|
377
|
+
</div>
|
|
378
|
+
|
|
379
|
+
<div id="status" class="status info">
|
|
380
|
+
<span class="status-icon">⏳</span>
|
|
381
|
+
<span id="status-text">Initializing...</span>
|
|
382
|
+
</div>
|
|
383
|
+
|
|
384
|
+
<div id="tab-selection" class="hidden">
|
|
385
|
+
<div class="section-label">Select page to expose to MCP server:</div>
|
|
386
|
+
<div class="tabs-list" id="tabs-list"></div>
|
|
387
|
+
</div>
|
|
388
|
+
|
|
389
|
+
<div id="connected-view" class="hidden connected-view">
|
|
390
|
+
<div class="connected-icon">✅</div>
|
|
391
|
+
<div class="connected-title">Connected to <span id="connected-tab-title"></span></div>
|
|
392
|
+
<div class="connected-details">
|
|
393
|
+
Tab ID: <span id="connected-tab-id"></span>
|
|
394
|
+
</div>
|
|
395
|
+
<button id="disconnect-btn" class="disconnect-btn">Disconnect</button>
|
|
396
|
+
</div>
|
|
397
|
+
|
|
398
|
+
<div id="error-view" class="hidden">
|
|
399
|
+
<div class="empty-state">
|
|
400
|
+
<div class="empty-state-icon">❌</div>
|
|
401
|
+
<div id="error-message">An error occurred</div>
|
|
402
|
+
</div>
|
|
403
|
+
</div>
|
|
404
|
+
|
|
405
|
+
<button id="debug-toggle">Show Debug Logs</button>
|
|
406
|
+
|
|
407
|
+
<div id="debug-panel" class="hidden">
|
|
408
|
+
<h3>Debug Logs</h3>
|
|
409
|
+
<div class="debug-controls">
|
|
410
|
+
<select id="log-filter">
|
|
411
|
+
<option value="">All Categories</option>
|
|
412
|
+
<option value="ws">WebSocket</option>
|
|
413
|
+
<option value="cdp">CDP</option>
|
|
414
|
+
<option value="tab">Tab</option>
|
|
415
|
+
<option value="relay">Relay</option>
|
|
416
|
+
<option value="error">Error</option>
|
|
417
|
+
</select>
|
|
418
|
+
<button id="refresh-logs">Refresh</button>
|
|
419
|
+
<button id="clear-logs" class="danger">Clear</button>
|
|
420
|
+
<button id="export-logs">Export</button>
|
|
421
|
+
</div>
|
|
422
|
+
<div id="debug-stats"></div>
|
|
423
|
+
<div id="log-output"></div>
|
|
424
|
+
</div>
|
|
425
|
+
</div>
|
|
426
|
+
|
|
427
|
+
<script src="connect.js" type="module"></script>
|
|
428
|
+
</body>
|
|
429
|
+
</html>
|