hopwire 0.0.0-stage → 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.
- package/LICENSE +201 -0
- package/NOTICE +8 -0
- package/README.md +29 -2
- package/dist/account.js +168 -0
- package/dist/agent/redact.js +101 -0
- package/dist/agent/summary.js +32 -0
- package/dist/agent-socket.js +93 -0
- package/dist/bin.js +22 -0
- package/dist/body-capture.js +28 -0
- package/dist/browser.js +42 -0
- package/dist/cli.js +674 -0
- package/dist/commands/connect.js +221 -0
- package/dist/commands/doctor.js +107 -0
- package/dist/commands/http.js +108 -0
- package/dist/commands/login.js +133 -0
- package/dist/commands/mcp.js +69 -0
- package/dist/commands/rotate.js +57 -0
- package/dist/commands/up.js +149 -0
- package/dist/commands/watch.js +146 -0
- package/dist/config.js +302 -0
- package/dist/control-plane-client.js +300 -0
- package/dist/data-dir-holder.js +178 -0
- package/dist/edge-bridge.js +1031 -0
- package/dist/errors.js +53 -0
- package/dist/identity.js +134 -0
- package/dist/inspector/THIRD-PARTY-NOTICES.txt +330 -0
- package/dist/inspector/assets/index-BvwyMIFs.css +2 -0
- package/dist/inspector/assets/index-Ctrz3UJp.js +2 -0
- package/dist/inspector/assets/jetbrains-mono-latin-400-normal-V6pRDFza.woff2 +0 -0
- package/dist/inspector/assets/jetbrains-mono-latin-500-normal-BWZEU5yA.woff2 +0 -0
- package/dist/inspector/assets/jetbrains-mono-latin-ext-400-normal-Bc8Ftmh3.woff2 +0 -0
- package/dist/inspector/assets/jetbrains-mono-latin-ext-500-normal-Cut-4mMH.woff2 +0 -0
- package/dist/inspector/assets/space-grotesk-latin-400-normal-CJ-V5oYT.woff2 +0 -0
- package/dist/inspector/assets/space-grotesk-latin-500-normal-lFbtlQH6.woff2 +0 -0
- package/dist/inspector/assets/space-grotesk-latin-ext-400-normal-CfP_5XZW.woff2 +0 -0
- package/dist/inspector/assets/space-grotesk-latin-ext-500-normal-DUe3BAxM.woff2 +0 -0
- package/dist/inspector/favicon.svg +1 -0
- package/dist/inspector/index.html +16 -0
- package/dist/inspector-api.js +508 -0
- package/dist/inspector-server.js +150 -0
- package/dist/interceptor.js +480 -0
- package/dist/log.js +393 -0
- package/dist/main.js +37 -0
- package/dist/mcp/body.js +134 -0
- package/dist/mcp/client.js +169 -0
- package/dist/mcp/jsonrpc.js +170 -0
- package/dist/mcp/tools.js +715 -0
- package/dist/output.js +249 -0
- package/dist/p2p-stream.js +226 -0
- package/dist/p2p.js +389 -0
- package/dist/prompt.js +62 -0
- package/dist/proxy-server.js +252 -0
- package/dist/serve.js +234 -0
- package/dist/style.js +60 -0
- package/dist/supervisor.js +146 -0
- package/dist/team-keys.js +129 -0
- package/dist/update-notice.js +67 -0
- package/dist/urls.js +45 -0
- package/dist/websocket.js +99 -0
- package/node_modules/@hopwire/protocol/LICENSE +201 -0
- package/node_modules/@hopwire/protocol/NOTICE +8 -0
- package/node_modules/@hopwire/protocol/dist/basic-auth.d.ts +9 -0
- package/node_modules/@hopwire/protocol/dist/basic-auth.js +21 -0
- package/node_modules/@hopwire/protocol/dist/constants.d.ts +91 -0
- package/node_modules/@hopwire/protocol/dist/constants.js +89 -0
- package/node_modules/@hopwire/protocol/dist/exchange.d.ts +54 -0
- package/node_modules/@hopwire/protocol/dist/exchange.js +71 -0
- package/node_modules/@hopwire/protocol/dist/frames.d.ts +177 -0
- package/node_modules/@hopwire/protocol/dist/frames.js +191 -0
- package/node_modules/@hopwire/protocol/dist/headers.d.ts +20 -0
- package/node_modules/@hopwire/protocol/dist/headers.js +58 -0
- package/node_modules/@hopwire/protocol/dist/index.d.ts +10 -0
- package/node_modules/@hopwire/protocol/dist/index.js +10 -0
- package/node_modules/@hopwire/protocol/dist/inspector.d.ts +46 -0
- package/node_modules/@hopwire/protocol/dist/inspector.js +42 -0
- package/node_modules/@hopwire/protocol/dist/p2p.d.ts +52 -0
- package/node_modules/@hopwire/protocol/dist/p2p.js +119 -0
- package/node_modules/@hopwire/protocol/dist/plan.d.ts +104 -0
- package/node_modules/@hopwire/protocol/dist/plan.js +180 -0
- package/node_modules/@hopwire/protocol/dist/subdomain.d.ts +10 -0
- package/node_modules/@hopwire/protocol/dist/subdomain.js +30 -0
- package/node_modules/@hopwire/protocol/dist/websocket.d.ts +70 -0
- package/node_modules/@hopwire/protocol/dist/websocket.js +113 -0
- package/node_modules/@hopwire/protocol/package.json +13 -0
- package/package.json +38 -5
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** Keeps the first `limit` bytes of a body that streams past, and remembers whether there was more. */
|
|
2
|
+
export class BodyCapture {
|
|
3
|
+
limit;
|
|
4
|
+
chunks = [];
|
|
5
|
+
size = 0;
|
|
6
|
+
overflowed = false;
|
|
7
|
+
constructor(limit) {
|
|
8
|
+
this.limit = limit;
|
|
9
|
+
}
|
|
10
|
+
push(chunk) {
|
|
11
|
+
const room = this.limit - this.size;
|
|
12
|
+
if (chunk.byteLength > room) {
|
|
13
|
+
this.overflowed = true;
|
|
14
|
+
}
|
|
15
|
+
if (room <= 0) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const kept = Buffer.from(chunk.subarray(0, room));
|
|
19
|
+
this.chunks.push(kept);
|
|
20
|
+
this.size += kept.byteLength;
|
|
21
|
+
}
|
|
22
|
+
get truncated() {
|
|
23
|
+
return this.overflowed;
|
|
24
|
+
}
|
|
25
|
+
toBase64() {
|
|
26
|
+
return Buffer.concat(this.chunks).toString('base64');
|
|
27
|
+
}
|
|
28
|
+
}
|
package/dist/browser.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
/**
|
|
3
|
+
* Opens a web page in the user's browser for `hopwire login`, with the opener of the operating system: open on macOS,
|
|
4
|
+
* the URL handler on Windows, xdg-open elsewhere. Says whether it tried: not over SSH or without a display, where the
|
|
5
|
+
* page would open on another screen or nowhere. A failure to open is ignored; the URL is printed either way. The URL
|
|
6
|
+
* is passed as one argument, never through a shell.
|
|
7
|
+
*/
|
|
8
|
+
export function openBrowser(url, env = process.env, platform = process.platform) {
|
|
9
|
+
if (!/^https?:\/\//.test(url)) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
const display = Boolean(env.DISPLAY || env.WAYLAND_DISPLAY);
|
|
13
|
+
if (env.SSH_CONNECTION && !display) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
let command;
|
|
17
|
+
let args;
|
|
18
|
+
if (platform === 'darwin') {
|
|
19
|
+
command = 'open';
|
|
20
|
+
args = [url];
|
|
21
|
+
}
|
|
22
|
+
else if (platform === 'win32') {
|
|
23
|
+
command = 'rundll32';
|
|
24
|
+
args = ['url.dll,FileProtocolHandler', url];
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
if (!display) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
command = 'xdg-open';
|
|
31
|
+
args = [url];
|
|
32
|
+
}
|
|
33
|
+
try {
|
|
34
|
+
const child = spawn(command, args, { stdio: 'ignore', detached: true });
|
|
35
|
+
child.on('error', () => { });
|
|
36
|
+
child.unref();
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
}
|