tab-agent 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/README.md +62 -0
- package/bin/tab-agent.js +40 -0
- package/cli/detect-extension.js +131 -0
- package/cli/setup.js +133 -0
- package/cli/start.js +19 -0
- package/cli/status.js +70 -0
- package/extension/content-script.js +510 -0
- package/extension/icons/icon128.png +0 -0
- package/extension/icons/icon16.png +0 -0
- package/extension/icons/icon48.png +0 -0
- package/extension/manifest.json +40 -0
- package/extension/popup/popup.html +142 -0
- package/extension/popup/popup.js +104 -0
- package/extension/service-worker.js +471 -0
- package/extension/snapshot.js +194 -0
- package/package.json +25 -0
- package/relay/install-native-host.sh +57 -0
- package/relay/native-host-wrapper.cmd +3 -0
- package/relay/native-host-wrapper.sh +29 -0
- package/relay/native-host.js +128 -0
- package/relay/node_modules/.package-lock.json +29 -0
- package/relay/node_modules/ws/LICENSE +20 -0
- package/relay/node_modules/ws/README.md +548 -0
- package/relay/node_modules/ws/browser.js +8 -0
- package/relay/node_modules/ws/index.js +13 -0
- package/relay/node_modules/ws/lib/buffer-util.js +131 -0
- package/relay/node_modules/ws/lib/constants.js +19 -0
- package/relay/node_modules/ws/lib/event-target.js +292 -0
- package/relay/node_modules/ws/lib/extension.js +203 -0
- package/relay/node_modules/ws/lib/limiter.js +55 -0
- package/relay/node_modules/ws/lib/permessage-deflate.js +528 -0
- package/relay/node_modules/ws/lib/receiver.js +706 -0
- package/relay/node_modules/ws/lib/sender.js +602 -0
- package/relay/node_modules/ws/lib/stream.js +161 -0
- package/relay/node_modules/ws/lib/subprotocol.js +62 -0
- package/relay/node_modules/ws/lib/validation.js +152 -0
- package/relay/node_modules/ws/lib/websocket-server.js +554 -0
- package/relay/node_modules/ws/lib/websocket.js +1393 -0
- package/relay/node_modules/ws/package.json +69 -0
- package/relay/node_modules/ws/wrapper.mjs +8 -0
- package/relay/package-lock.json +36 -0
- package/relay/package.json +12 -0
- package/relay/server.js +114 -0
- package/skills/claude-code/tab-agent.md +53 -0
- package/skills/codex/tab-agent.md +40 -0
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
// snapshot.js
|
|
2
|
+
// Builds AI-readable snapshots from the DOM accessibility tree
|
|
3
|
+
|
|
4
|
+
(function() {
|
|
5
|
+
let refCounter = 0;
|
|
6
|
+
const refMap = new Map();
|
|
7
|
+
|
|
8
|
+
function resetRefs() {
|
|
9
|
+
refCounter = 0;
|
|
10
|
+
refMap.clear();
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function nextRef() {
|
|
14
|
+
return `e${++refCounter}`;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function storeRef(ref, element) {
|
|
18
|
+
refMap.set(ref, element);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
window.__tabAgent_getElementByRef = function(ref) {
|
|
22
|
+
return refMap.get(ref);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
function getRole(element) {
|
|
26
|
+
if (element.getAttribute('role')) {
|
|
27
|
+
return element.getAttribute('role');
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const tag = element.tagName.toLowerCase();
|
|
31
|
+
const type = element.getAttribute('type');
|
|
32
|
+
|
|
33
|
+
const roleMap = {
|
|
34
|
+
'a': 'link',
|
|
35
|
+
'button': 'button',
|
|
36
|
+
'input': type === 'submit' ? 'button' :
|
|
37
|
+
type === 'checkbox' ? 'checkbox' :
|
|
38
|
+
type === 'radio' ? 'radio' :
|
|
39
|
+
type === 'text' || type === 'email' || type === 'password' || type === 'search' ? 'textbox' :
|
|
40
|
+
'input',
|
|
41
|
+
'textarea': 'textbox',
|
|
42
|
+
'select': 'combobox',
|
|
43
|
+
'img': 'img',
|
|
44
|
+
'h1': 'heading',
|
|
45
|
+
'h2': 'heading',
|
|
46
|
+
'h3': 'heading',
|
|
47
|
+
'h4': 'heading',
|
|
48
|
+
'h5': 'heading',
|
|
49
|
+
'h6': 'heading',
|
|
50
|
+
'nav': 'navigation',
|
|
51
|
+
'main': 'main',
|
|
52
|
+
'footer': 'contentinfo',
|
|
53
|
+
'header': 'banner',
|
|
54
|
+
'form': 'form',
|
|
55
|
+
'table': 'table',
|
|
56
|
+
'ul': 'list',
|
|
57
|
+
'ol': 'list',
|
|
58
|
+
'li': 'listitem',
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
return roleMap[tag] || 'generic';
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function getName(element) {
|
|
65
|
+
if (element.getAttribute('aria-label')) {
|
|
66
|
+
return element.getAttribute('aria-label');
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (element.getAttribute('aria-labelledby')) {
|
|
70
|
+
const labelId = element.getAttribute('aria-labelledby');
|
|
71
|
+
const labelEl = document.getElementById(labelId);
|
|
72
|
+
if (labelEl) return labelEl.textContent.trim();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (element.tagName === 'INPUT' || element.tagName === 'TEXTAREA' || element.tagName === 'SELECT') {
|
|
76
|
+
const id = element.id;
|
|
77
|
+
if (id) {
|
|
78
|
+
const label = document.querySelector(`label[for="${id}"]`);
|
|
79
|
+
if (label) return label.textContent.trim();
|
|
80
|
+
}
|
|
81
|
+
if (element.placeholder) return element.placeholder;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (element.tagName === 'IMG') {
|
|
85
|
+
return element.alt || '';
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (element.tagName === 'BUTTON' || element.tagName === 'A') {
|
|
89
|
+
return element.textContent.trim().substring(0, 100);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (/^H[1-6]$/.test(element.tagName)) {
|
|
93
|
+
return element.textContent.trim().substring(0, 100);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (element.title) {
|
|
97
|
+
return element.title;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return '';
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function isInteractive(element) {
|
|
104
|
+
const tag = element.tagName.toLowerCase();
|
|
105
|
+
const interactiveTags = ['a', 'button', 'input', 'textarea', 'select', 'details', 'summary'];
|
|
106
|
+
|
|
107
|
+
if (interactiveTags.includes(tag)) return true;
|
|
108
|
+
if (element.getAttribute('onclick')) return true;
|
|
109
|
+
if (element.getAttribute('role') === 'button') return true;
|
|
110
|
+
if (element.getAttribute('tabindex') !== null) return true;
|
|
111
|
+
if (element.contentEditable === 'true') return true;
|
|
112
|
+
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function isVisible(element) {
|
|
117
|
+
const style = window.getComputedStyle(element);
|
|
118
|
+
if (style.display === 'none') return false;
|
|
119
|
+
if (style.visibility === 'hidden') return false;
|
|
120
|
+
if (style.opacity === '0') return false;
|
|
121
|
+
|
|
122
|
+
const rect = element.getBoundingClientRect();
|
|
123
|
+
if (rect.width === 0 && rect.height === 0) return false;
|
|
124
|
+
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function buildSnapshot(element, depth = 0, maxDepth = 10) {
|
|
129
|
+
if (depth > maxDepth) return [];
|
|
130
|
+
if (!isVisible(element)) return [];
|
|
131
|
+
|
|
132
|
+
const lines = [];
|
|
133
|
+
const role = getRole(element);
|
|
134
|
+
const name = getName(element);
|
|
135
|
+
const interactive = isInteractive(element);
|
|
136
|
+
|
|
137
|
+
const includedRoles = [
|
|
138
|
+
'link', 'button', 'textbox', 'checkbox', 'radio', 'combobox',
|
|
139
|
+
'heading', 'img', 'navigation', 'main', 'form', 'listitem',
|
|
140
|
+
'tab', 'tabpanel', 'menu', 'menuitem', 'dialog', 'alert'
|
|
141
|
+
];
|
|
142
|
+
|
|
143
|
+
const shouldInclude = includedRoles.includes(role) || interactive;
|
|
144
|
+
|
|
145
|
+
if (shouldInclude && (name || interactive)) {
|
|
146
|
+
const ref = nextRef();
|
|
147
|
+
storeRef(ref, element);
|
|
148
|
+
|
|
149
|
+
let line = `[${ref}] ${role}`;
|
|
150
|
+
if (name) {
|
|
151
|
+
line += ` "${name.substring(0, 80)}"`;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (element.tagName === 'INPUT') {
|
|
155
|
+
const type = element.type;
|
|
156
|
+
if (type === 'checkbox' || type === 'radio') {
|
|
157
|
+
line += element.checked ? ' (checked)' : ' (unchecked)';
|
|
158
|
+
}
|
|
159
|
+
if (element.value && type !== 'password') {
|
|
160
|
+
line += ` value="${element.value.substring(0, 30)}"`;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if (element.tagName === 'SELECT') {
|
|
165
|
+
const selected = element.options[element.selectedIndex];
|
|
166
|
+
if (selected) {
|
|
167
|
+
line += ` selected="${selected.text}"`;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
lines.push(line);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
for (const child of element.children) {
|
|
175
|
+
lines.push(...buildSnapshot(child, depth + 1, maxDepth));
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
return lines;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
window.__tabAgent_snapshot = function() {
|
|
182
|
+
resetRefs();
|
|
183
|
+
|
|
184
|
+
const lines = ['== Page Snapshot ==', `URL: ${window.location.href}`, `Title: ${document.title}`, ''];
|
|
185
|
+
lines.push(...buildSnapshot(document.body));
|
|
186
|
+
|
|
187
|
+
return {
|
|
188
|
+
url: window.location.href,
|
|
189
|
+
title: document.title,
|
|
190
|
+
snapshot: lines.join('\n'),
|
|
191
|
+
refCount: refCounter,
|
|
192
|
+
};
|
|
193
|
+
};
|
|
194
|
+
})();
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "tab-agent",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Browser control for Claude Code and Codex via WebSocket",
|
|
5
|
+
"bin": {
|
|
6
|
+
"tab-agent": "./bin/tab-agent.js"
|
|
7
|
+
},
|
|
8
|
+
"main": "relay/server.js",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"start": "node relay/server.js"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"bin/",
|
|
14
|
+
"cli/",
|
|
15
|
+
"relay/",
|
|
16
|
+
"skills/",
|
|
17
|
+
"extension/"
|
|
18
|
+
],
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"ws": "^8.16.0"
|
|
21
|
+
},
|
|
22
|
+
"keywords": ["chrome", "extension", "browser", "automation", "claude", "codex"],
|
|
23
|
+
"repository": "https://github.com/DrHB/tab-agent",
|
|
24
|
+
"license": "MIT"
|
|
25
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -e
|
|
3
|
+
|
|
4
|
+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
5
|
+
HOST_NAME="com.tabagent.relay"
|
|
6
|
+
HOST_DIR="$HOME/Library/Application Support/TabAgent"
|
|
7
|
+
WRAPPER_PATH="$HOST_DIR/native-host-wrapper.sh"
|
|
8
|
+
|
|
9
|
+
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
10
|
+
MANIFEST_DIR="$HOME/Library/Application Support/Google/Chrome/NativeMessagingHosts"
|
|
11
|
+
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
|
12
|
+
MANIFEST_DIR="$HOME/.config/google-chrome/NativeMessagingHosts"
|
|
13
|
+
else
|
|
14
|
+
echo "Unsupported OS: $OSTYPE"
|
|
15
|
+
exit 1
|
|
16
|
+
fi
|
|
17
|
+
|
|
18
|
+
mkdir -p "$MANIFEST_DIR"
|
|
19
|
+
|
|
20
|
+
if [ -z "$1" ]; then
|
|
21
|
+
echo "Usage: ./install-native-host.sh <extension-id>"
|
|
22
|
+
echo ""
|
|
23
|
+
echo "Find your extension ID at chrome://extensions (enable Developer mode)"
|
|
24
|
+
exit 1
|
|
25
|
+
fi
|
|
26
|
+
|
|
27
|
+
EXTENSION_ID="$1"
|
|
28
|
+
|
|
29
|
+
if [ ! -d "$SCRIPT_DIR/node_modules/ws" ]; then
|
|
30
|
+
echo "Dependencies missing: run 'npm install' in $SCRIPT_DIR first."
|
|
31
|
+
exit 1
|
|
32
|
+
fi
|
|
33
|
+
|
|
34
|
+
mkdir -p "$HOST_DIR"
|
|
35
|
+
rm -rf "$HOST_DIR/node_modules"
|
|
36
|
+
cp "$SCRIPT_DIR/native-host.js" "$HOST_DIR/native-host.js"
|
|
37
|
+
cp "$SCRIPT_DIR/native-host-wrapper.sh" "$HOST_DIR/native-host-wrapper.sh"
|
|
38
|
+
cp -R "$SCRIPT_DIR/node_modules" "$HOST_DIR/node_modules"
|
|
39
|
+
|
|
40
|
+
cat > "$MANIFEST_DIR/$HOST_NAME.json" << EOF
|
|
41
|
+
{
|
|
42
|
+
"name": "$HOST_NAME",
|
|
43
|
+
"description": "Tab Agent Native Messaging Host",
|
|
44
|
+
"path": "$WRAPPER_PATH",
|
|
45
|
+
"type": "stdio",
|
|
46
|
+
"allowed_origins": [
|
|
47
|
+
"chrome-extension://$EXTENSION_ID/"
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
EOF
|
|
51
|
+
|
|
52
|
+
chmod +x "$WRAPPER_PATH"
|
|
53
|
+
chmod +x "$HOST_DIR/native-host.js"
|
|
54
|
+
|
|
55
|
+
echo "Native messaging host installed!"
|
|
56
|
+
echo "Manifest: $MANIFEST_DIR/$HOST_NAME.json"
|
|
57
|
+
echo "Extension ID: $EXTENSION_ID"
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Wrapper script to ensure correct working directory for native-host.js
|
|
3
|
+
|
|
4
|
+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
5
|
+
cd "$SCRIPT_DIR"
|
|
6
|
+
|
|
7
|
+
LOG_FILE="$SCRIPT_DIR/wrapper.log"
|
|
8
|
+
echo "$(date): Starting native host from $SCRIPT_DIR" >> "$LOG_FILE"
|
|
9
|
+
export TAB_AGENT_LOG="/tmp/tab-agent-native-host.log"
|
|
10
|
+
|
|
11
|
+
NODE_BIN="/opt/homebrew/bin/node"
|
|
12
|
+
if [ ! -x "$NODE_BIN" ]; then
|
|
13
|
+
NODE_BIN="/usr/local/bin/node"
|
|
14
|
+
fi
|
|
15
|
+
if [ ! -x "$NODE_BIN" ]; then
|
|
16
|
+
NODE_BIN="/usr/bin/node"
|
|
17
|
+
fi
|
|
18
|
+
if [ ! -x "$NODE_BIN" ]; then
|
|
19
|
+
NODE_BIN="$(command -v node 2>/dev/null)"
|
|
20
|
+
fi
|
|
21
|
+
if [ -z "$NODE_BIN" ] || [ ! -x "$NODE_BIN" ]; then
|
|
22
|
+
echo "$(date): Node.js not found" >> "$LOG_FILE"
|
|
23
|
+
exit 1
|
|
24
|
+
fi
|
|
25
|
+
|
|
26
|
+
export NODE_PATH="$SCRIPT_DIR/node_modules"
|
|
27
|
+
echo "$(date): Using node at $NODE_BIN" >> "$LOG_FILE"
|
|
28
|
+
echo "$(date): TAB_AGENT_LOG=$TAB_AGENT_LOG" >> "$LOG_FILE"
|
|
29
|
+
exec "$NODE_BIN" "$SCRIPT_DIR/native-host.js" 2>> "$LOG_FILE"
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// native-host.js
|
|
3
|
+
const WebSocket = require('ws');
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
|
|
6
|
+
const LOG_PATH = process.env.TAB_AGENT_LOG || '';
|
|
7
|
+
|
|
8
|
+
function log(msg) {
|
|
9
|
+
if (!LOG_PATH) return;
|
|
10
|
+
try {
|
|
11
|
+
fs.appendFileSync(LOG_PATH, `${new Date().toISOString()} ${msg}\n`);
|
|
12
|
+
} catch (error) {
|
|
13
|
+
// Logging must never crash the host.
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function sendMessage(message) {
|
|
18
|
+
const json = JSON.stringify(message);
|
|
19
|
+
const length = Buffer.alloc(4);
|
|
20
|
+
length.writeUInt32LE(json.length, 0);
|
|
21
|
+
process.stdout.write(length);
|
|
22
|
+
process.stdout.write(json);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
let inputBuffer = Buffer.alloc(0);
|
|
26
|
+
let ws = null;
|
|
27
|
+
let reconnectTimer = null;
|
|
28
|
+
let lastErrorAt = 0;
|
|
29
|
+
|
|
30
|
+
process.stdin.on('data', (chunk) => {
|
|
31
|
+
inputBuffer = Buffer.concat([inputBuffer, chunk]);
|
|
32
|
+
|
|
33
|
+
while (inputBuffer.length >= 4) {
|
|
34
|
+
const length = inputBuffer.readUInt32LE(0);
|
|
35
|
+
if (inputBuffer.length < 4 + length) break;
|
|
36
|
+
|
|
37
|
+
let message = null;
|
|
38
|
+
try {
|
|
39
|
+
message = JSON.parse(inputBuffer.slice(4, 4 + length).toString());
|
|
40
|
+
} catch (error) {
|
|
41
|
+
sendMessage({ type: 'error', error: `Invalid message: ${error.message}` });
|
|
42
|
+
}
|
|
43
|
+
inputBuffer = inputBuffer.slice(4 + length);
|
|
44
|
+
|
|
45
|
+
if (message) {
|
|
46
|
+
handleMessage(message);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
process.stdin.on('end', () => {
|
|
52
|
+
log('stdin ended - extension disconnected');
|
|
53
|
+
if (ws) {
|
|
54
|
+
try {
|
|
55
|
+
ws.close();
|
|
56
|
+
} catch (error) {
|
|
57
|
+
// Ignore shutdown errors.
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
process.exit(0);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
process.stdin.on('error', (err) => {
|
|
64
|
+
log(`stdin error: ${err.message}`);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
function scheduleReconnect() {
|
|
68
|
+
if (reconnectTimer) return;
|
|
69
|
+
reconnectTimer = setTimeout(() => {
|
|
70
|
+
reconnectTimer = null;
|
|
71
|
+
connectWebSocket();
|
|
72
|
+
}, 1000);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function connectWebSocket() {
|
|
76
|
+
try {
|
|
77
|
+
ws = new WebSocket('ws://localhost:9876', {
|
|
78
|
+
headers: { 'x-client-type': 'extension' }
|
|
79
|
+
});
|
|
80
|
+
} catch (error) {
|
|
81
|
+
const now = Date.now();
|
|
82
|
+
if (now - lastErrorAt > 2000) {
|
|
83
|
+
lastErrorAt = now;
|
|
84
|
+
sendMessage({ type: 'error', error: error.message });
|
|
85
|
+
}
|
|
86
|
+
scheduleReconnect();
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
ws.on('open', () => {
|
|
91
|
+
sendMessage({ type: 'connected' });
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
ws.on('message', (data) => {
|
|
95
|
+
let message = null;
|
|
96
|
+
try {
|
|
97
|
+
message = JSON.parse(data);
|
|
98
|
+
} catch (error) {
|
|
99
|
+
sendMessage({ type: 'error', error: `Invalid relay message: ${error.message}` });
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
sendMessage({ type: 'command', ...message });
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
ws.on('error', (error) => {
|
|
106
|
+
const now = Date.now();
|
|
107
|
+
if (now - lastErrorAt > 2000) {
|
|
108
|
+
lastErrorAt = now;
|
|
109
|
+
sendMessage({ type: 'error', error: error.message });
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
ws.on('close', () => {
|
|
114
|
+
scheduleReconnect();
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function handleMessage(message) {
|
|
119
|
+
if (message.type === 'response') {
|
|
120
|
+
if (ws && ws.readyState === WebSocket.OPEN) {
|
|
121
|
+
ws.send(JSON.stringify(message));
|
|
122
|
+
} else {
|
|
123
|
+
sendMessage({ type: 'error', error: 'Relay not connected' });
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
connectWebSocket();
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "tab-agent-relay",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"lockfileVersion": 3,
|
|
5
|
+
"requires": true,
|
|
6
|
+
"packages": {
|
|
7
|
+
"node_modules/ws": {
|
|
8
|
+
"version": "8.19.0",
|
|
9
|
+
"resolved": "https://registry.npmjs.org/ws/-/ws-8.19.0.tgz",
|
|
10
|
+
"integrity": "sha512-blAT2mjOEIi0ZzruJfIhb3nps74PRWTCz1IjglWEEpQl5XS/UNama6u2/rjFkDDouqr4L67ry+1aGIALViWjDg==",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"engines": {
|
|
13
|
+
"node": ">=10.0.0"
|
|
14
|
+
},
|
|
15
|
+
"peerDependencies": {
|
|
16
|
+
"bufferutil": "^4.0.1",
|
|
17
|
+
"utf-8-validate": ">=5.0.2"
|
|
18
|
+
},
|
|
19
|
+
"peerDependenciesMeta": {
|
|
20
|
+
"bufferutil": {
|
|
21
|
+
"optional": true
|
|
22
|
+
},
|
|
23
|
+
"utf-8-validate": {
|
|
24
|
+
"optional": true
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright (c) 2011 Einar Otto Stangvik <einaros@gmail.com>
|
|
2
|
+
Copyright (c) 2013 Arnout Kazemier and contributors
|
|
3
|
+
Copyright (c) 2016 Luigi Pinca and contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
7
|
+
the Software without restriction, including without limitation the rights to
|
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
10
|
+
subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|