asyx 0.5.2 → 0.5.4

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 (2) hide show
  1. package/README.md +166 -97
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,169 +1,238 @@
1
1
  # Asyx CLI
2
2
 
3
- Secure, device-bound tunnels for HTTP, TCP, and UDP. The CLI handles device auth, JWT refresh, and resilient control-plane connectivity so you can expose local services without managing relay infrastructure.
3
+ **Turn `localhost:3000` into `https://yourname.tunnel.asyx.ai` in one command.**
4
4
 
5
- > Beta access is open — create an account at https://www.asyx.ai/register (email + magic link; no invite code).
5
+ Coding assistants—Cursor, Claude Code, Copilot, Windsurf, and others—build apps that run on your machine. Stakeholders cannot see that work until you share a public URL. Asyx closes that gap: install the CLI, enroll once, then tunnel whatever port your dev server uses.
6
6
 
7
- **Documentation:** https://www.asyx.ai/docs
7
+ > **Free account** — [asyx.ai/register](https://www.asyx.ai/register) (email + magic link; no invite code).
8
8
 
9
- | Guide | Link |
10
- |-------|------|
11
- | Getting started | https://www.asyx.ai/docs/getting-started |
12
- | Publish in 60 seconds | https://www.asyx.ai/docs/publish-local-project |
13
- | Expose localhost | https://www.asyx.ai/docs/expose-localhost |
14
- | AI coding agents | https://www.asyx.ai/docs/ai-agents |
15
- | Cursor + Asyx | https://www.asyx.ai/docs/cursor-asyx |
16
- | vs ngrok & Cloudflare | https://www.asyx.ai/docs/vs-ngrok-cloudflare |
17
- | Quickpass (guest access) | https://www.asyx.ai/docs/quickpass |
9
+ **Full documentation:** https://www.asyx.ai/docs
18
10
 
19
11
  ---
20
12
 
21
- ## 0. Install & Update
13
+ ## Publish what your agent built
14
+
15
+ ```text
16
+ Agent writes code → dev server starts → asyx tunnel → share HTTPS link
17
+ ```
18
+
19
+ | Step | Who | What to do |
20
+ | --- | --- | --- |
21
+ | Account + enroll | **You** (once per machine) | `asyx setup` after [registering](https://www.asyx.ai/register) |
22
+ | Build / edit code | **Agent** | Implements the feature locally |
23
+ | Start dev server | **Agent or you** | `npm run dev`, `vite`, `flask run`, etc. |
24
+ | Open public URL | **Agent or you** (terminal) | `asyx tunnel --http --port <port>` |
25
+ | Share the link | **You** | PR comment, Slack, email, client review |
26
+
27
+ Enrollment is human-gated (browser verification) so prompts alone cannot open tunnels from an unbound machine. After `asyx setup`, your agent only needs the port and one tunnel command.
28
+
29
+ ### 60-second path to a public link
30
+
22
31
  ```bash
23
- npm install -g asyx # install
24
- npm update -g asyx # upgrade
25
- npm uninstall -g asyx # remove
32
+ npm install -g asyx # 1. install (Node 18.17+)
33
+ asyx setup # 2. enroll once — browser opens, pick your subdomain
34
+ npm run dev # 3. start your app (note the port, often 3000 or 5173)
35
+ asyx tunnel --http --port 3000 # 4. second terminal — copy the printed URL
36
+ ```
37
+
38
+ Share `https://yourname.tunnel.asyx.ai`. Press `Ctrl+C` in the tunnel terminal when the demo ends.
39
+
40
+ Works with React, Next.js, Vite, Flask, FastAPI, Express, static sites, local LLM UIs—anything speaking HTTP on localhost.
41
+
42
+ Prefer no global install?
43
+
44
+ ```bash
45
+ npx asyx@latest tunnel --http --port 3000
26
46
  ```
27
- - Node.js 18.17+ recommended. Prefer `npx asyx <cmd>` if you cannot install globally.
47
+
48
+ ### Copy-paste for your agent
49
+
50
+ Add this to a Cursor rule, Claude project, or task prompt:
51
+
52
+ ```text
53
+ PUBLISHING CONTRACT — Asyx tunnel
54
+
55
+ Prerequisites (human completes once per machine):
56
+ - asyx CLI installed (npm install -g asyx)
57
+ - asyx setup completed (browser enrollment)
58
+
59
+ When a local HTTP server is running on PORT:
60
+ 1. Run: asyx tunnel --http --port PORT
61
+ 2. Return the https://*.tunnel.asyx.ai URL as "public_demo_url"
62
+ 3. Do NOT read, print, or commit ~/.asyx/ or any private.pem files
63
+ 4. Stop tunnel with Ctrl+C when the user says the demo is over
64
+
65
+ If asyx setup was never run, tell the human to run it before tunneling.
66
+ ```
67
+
68
+ Replace `PORT` with the actual port (e.g. `3000`, `5173`, `8080`).
69
+
70
+ ### Example Cursor prompt
71
+
72
+ ```text
73
+ Implement the settings page, run the dev server on port 3000, then run
74
+ asyx tunnel --http --port 3000 and give me the public demo URL.
75
+ I already ran asyx setup on this machine.
76
+ ```
77
+
78
+ **Can the agent run the tunnel itself?** Yes—if your IDE grants terminal access and `asyx` is installed. Many teams run the tunnel command themselves for visibility.
79
+
80
+ **More guides:** [AI agents](https://www.asyx.ai/docs/ai-agents) · [Cursor + Asyx](https://www.asyx.ai/docs/cursor-asyx) · [Agent checklist](https://www.asyx.ai/docs/ai-agent-checklist) · [Publish in 60 seconds](https://www.asyx.ai/docs/publish-local-project)
28
81
 
29
82
  ---
30
83
 
31
- ## What's New in 0.4.0
84
+ ## Install & update
85
+
86
+ ```bash
87
+ npm install -g asyx # install
88
+ npm update -g asyx # upgrade
89
+ npm uninstall -g asyx # remove
90
+ ```
32
91
 
33
- **Improved large file downloads**: HTTP tunnels now automatically use streaming transport for large responses (8 MiB+ or unknown size). This enables reliable downloads of any size without hitting memory limits or connection timeouts. The switch happens automatically—no flags or configuration needed. Small responses continue to work exactly as before.
92
+ Node.js **18.17+** recommended.
34
93
 
35
94
  ---
36
95
 
37
- ## 1. Set up the device (once per host)
96
+ ## One-time device setup
97
+
38
98
  ```bash
39
99
  asyx setup
40
100
  ```
41
- - Opens a browser for passwordless approval and lets you choose `<subdomain>.tunnel.asyx.ai`.
101
+
102
+ - Opens your browser for passwordless approval; you choose `<subdomain>.tunnel.asyx.ai`.
42
103
  - Provisions a device certificate and client ID under `~/.asyx/certs/<clientId>/`.
43
104
  - Hardware fingerprint is hashed locally; raw attributes never leave the device.
44
- - Certificates are single-device; run `asyx setup` on each host.
105
+ - Run `asyx setup` on each host you want to trust—certificates are single-device.
45
106
 
46
107
  ---
47
108
 
48
- ## 2. Open tunnels
49
- All tunnels are loopback-only. The CLI never binds your app port; it forwards to your existing listener. Public port comes from your tenant’s 10-port block (auto-assigned unless you request one with `--external-port`).
109
+ ## HTTP tunnels (most common)
50
110
 
51
- ### HTTP
52
111
  ```bash
53
112
  asyx tunnel --http --port 3000
54
113
  ```
55
- - Forwards HTTP traffic to `127.0.0.1:3000`.
56
- - Forward-only proxy; automatic JWT refresh.
57
114
 
58
- ### TCP
115
+ - Forwards to `127.0.0.1:3000` (loopback only).
116
+ - Prints your stable `https://<subdomain>.tunnel.asyx.ai` URL.
117
+ - TLS and JWT refresh handled automatically; your app keeps its port.
118
+
119
+ ### Private demos (Quickpass)
120
+
121
+ For client-only or team-only previews—not open to the whole internet:
122
+
123
+ ```bash
124
+ asyx tunnel --http --port 3000 --secgroup reviewers
125
+ ```
126
+
127
+ Guests enroll via Quickpass; the relay enforces membership. See https://www.asyx.ai/docs/quickpass
128
+
129
+ ---
130
+
131
+ ## Other tunnel types
132
+
133
+ All tunnels are loopback-only. The CLI forwards to your existing listener—it never binds your app port.
134
+
135
+ **TCP** — databases, SSH, games:
136
+
59
137
  ```bash
60
138
  asyx tunnel --tcp --port <targetPort> [--name <alias>] [--external-port <publicPort>]
61
139
  ```
62
- - For raw TCP services (databases, SSH, games).
63
- - `--port`: local app port on loopback.
64
- - `--name` (optional): CNAME alias `<name>.<subdomain>.tunnel.asyx.ai`; otherwise use `fqdn:publicPort`.
65
- - `--external-port` (optional): must be inside your tenant block; otherwise rejected.
66
- - Uses tcpWs transport; guests connect with native TCP on the public port.
67
140
 
68
- ### UDP
141
+ **UDP** — games, realtime apps:
142
+
69
143
  ```bash
70
144
  asyx tunnel --udp --port <targetPort> [--external-port <publicPort>]
71
145
  ```
72
- - For UDP services (games, realtime apps).
73
- - `--port`: local app port on loopback.
74
- - `--external-port`: optional request within your tenant block.
75
- - CLI uses an **ephemeral** socket; it never claims your service port. Forwards to your app.
76
- - Loopback-only is enforced by CLI and relay.
77
- - Uses udpWs transport; guests send native UDP to the public port.
78
-
79
- ### Minecraft (shortcut)
146
+
147
+ **Minecraft** — shortcut with SRV record (players use hostname only):
148
+
80
149
  ```bash
81
- asyx tunnel --minecraft [--port <localPort>] [--name <alias>]
150
+ asyx tunnel --minecraft [--port 25565] [--name <alias>]
82
151
  ```
83
- - One command to share a Minecraft server (defaults to 25565).
84
- - SRV record created so players use the hostname only (no port needed).
85
152
 
86
- After a tunnel opens, the CLI prints:
87
- - `fqdn` and `fqdn:publicPort` for guests.
88
- - Target shown as `tcp://127.0.0.1:<port>` or `udp://127.0.0.1:<port>` so you know your app keeps the port.
153
+ After a tunnel opens, the CLI prints the public `fqdn` (and port for TCP/UDP) plus the local target (`tcp://127.0.0.1:<port>` or `udp://127.0.0.1:<port>`).
89
154
 
90
155
  ---
91
156
 
92
- ## 3. Command quick reference
157
+ ## Command quick reference
158
+
93
159
  ```bash
94
- asyx setup # Provision device cert & client ID
95
- asyx tunnel --http --port <n> # HTTP tunnel
160
+ asyx setup
161
+ asyx tunnel --http --port <n> [--secgroup <slug>]
96
162
  asyx tunnel --tcp --port <n> [--name <alias>] [--external-port <p>]
97
163
  asyx tunnel --udp --port <n> [--external-port <p>]
98
164
  asyx tunnel --minecraft [--port <n>] [--name <alias>]
99
165
  ```
100
- - Targets are loopback-only; non-loopback hosts are rejected.
101
- - `--external-port` must be inside your assigned block; omit to auto-assign blockStart.
102
166
 
103
167
  ---
104
168
 
105
- ## 4. Protocol details (high level)
106
- - **Transport**: TCP/UDP tunnels use WebSocket to the relay (tcpWs/udpWs); guests see native TCP/UDP on the public port.
107
- - **Assignments**: Coordinator returns `fqdn`, `publicPort`, `relayUrl`, and JWT. CLI validates JWT via JWKS before connecting.
108
- - **Aliases & SRV**: TCP can create CNAME aliases via `--name`; Minecraft auto-provisions SRV so players use the hostname only.
109
- - **Loopback-only**: CLI validates; relay enforces at admission/binding. Targets must resolve to loopback.
110
- - **Owner-only auth**: HTTP can use Quickpass groups; TCP/UDP are owner-authenticated via JWT (no per-guest auth in v4.1).
111
-
112
- ### Quickpass (HTTP guest access control)
113
- - Passwordless guest access: invite guests into a **security group** and run `asyx tunnel --http --port <n> --secgroup <slug>`.
114
- - Relay-enforced: guests must present a valid Quickpass cookie; unauthorized requests are rejected at the relay (no app changes).
115
- - Perfect for sharing dashboards/dev tools without opening them publicly; no VPN, no basic auth.
116
- - Zero extra infra: no DNS edits, no reverse proxies; the relay does the policy check.
117
- - Coming extensions: the same flow will back future sharing for TCP/UDP when per-guest auth is added.
118
- - TCP/UDP today remain owner-only via JWT (no per-guest auth in v4.1).
169
+ ## What's new in 0.5.x
170
+
171
+ **Tunnel-only CLI (0.5.0)** — npm ships tunnel commands only: `setup`, `mqtt`, and `tunnel`. Focused on secure localhost exposure (HTTP, TCP, UDP). Docs at https://www.asyx.ai/docs
172
+
173
+ **Reliable global install (0.5.2)** — `asyx setup` uses Node's built-in Web Crypto. `npm install -g asyx` works on Node 18+ without module-resolution errors.
174
+
175
+ **Earlier (0.4.0)** — HTTP tunnels auto-switch to streaming transport for large responses (8 MiB+), so big downloads do not hit memory limits.
119
176
 
120
177
  ---
121
178
 
122
- ## 5. Logging
123
- Set verbosity with `ASYX_LOG_LEVEL` (`error|warn|info|debug`, default `info`):
124
- ```bash
125
- ASYX_LOG_LEVEL=debug asyx tunnel --tcp --port 25565
126
- ```
127
- Structured logs go to stdout/stderr; user banners remain.
179
+ ## Documentation
180
+
181
+ | Guide | Link |
182
+ | --- | --- |
183
+ | Getting started | https://www.asyx.ai/docs/getting-started |
184
+ | Publish in 60 seconds | https://www.asyx.ai/docs/publish-local-project |
185
+ | AI coding agents | https://www.asyx.ai/docs/ai-agents |
186
+ | Cursor + Asyx | https://www.asyx.ai/docs/cursor-asyx |
187
+ | Agent checklist | https://www.asyx.ai/docs/ai-agent-checklist |
188
+ | Expose localhost | https://www.asyx.ai/docs/expose-localhost |
189
+ | Quickpass (guest access) | https://www.asyx.ai/docs/quickpass |
190
+ | vs ngrok & Cloudflare | https://www.asyx.ai/docs/vs-ngrok-cloudflare |
128
191
 
129
192
  ---
130
193
 
131
- ## 6. Behavior notes
132
- - Short-lived JWTs with in-band refresh; tunnels stay up without reconnecting.
133
- - MQTT/JWT control plane is shared across HTTP/TCP/UDP.
134
- - CLI never binds your app port (TCP/UDP); it forwards to it.
135
- - Loopback-only enforcement at both CLI and relay.
136
- - Idle/heartbeat handled automatically; no tuning needed.
194
+ ## Agent workflow safety
195
+
196
+ - **Never** paste device certificates or private keys into chat or git.
197
+ - **Do not** tunnel database admin ports without authentication.
198
+ - **Stop** the tunnel when the demo ends (`Ctrl+C`).
199
+ - Treat the public URL as a temporary preview—not a production deploy.
200
+ - Agents **cannot** enroll a device (`asyx setup` requires browser verification) or open tunnels from a machine that has not been set up.
137
201
 
138
202
  ---
139
203
 
140
- ## 7. Why Asyx
141
- - **Device-bound identity**: Each `setup` issues a unique cert + uuLID per host; backend rejects duplicates to prevent credential reuse.
142
- - **Hardware attestation without PII**: Fingerprint is hashed locally from safe fields; raw hardware data never leaves the device.
143
- - **Resilient control plane**: In-band JWT refresh, bounded reconnects, and structured logs (`ASYX_LOG_LEVEL`, `ASYX_DEBUG`) keep long sessions stable.
144
- - **Zero manual relay config**: Assignments route traffic for you—no DNS edits, firewall poking, or relay setup.
145
- - **Multi-protocol, one system**: HTTP, TCP, and UDP share the same assignment/JWT/MQTT fabric; pick the protocol that fits your service.
146
- - **Secure proxy architecture**: Forward-only; avoids local port conflicts and isolates your app from the CLI process.
147
- - **Observability-first UX**: Clear errors, deterministic exits, optional debug traces.
148
- - **Future-ready auth**: Today’s magic-link flow extends to sharing via Asyx Quickpass (passwordless downstream approvals).
204
+ ## Logging
205
+
206
+ ```bash
207
+ ASYX_LOG_LEVEL=debug asyx tunnel --http --port 3000
208
+ ```
209
+
210
+ Levels: `error` | `warn` | `info` | `debug` (default `info`).
149
211
 
150
212
  ---
151
213
 
152
- ## 7. Troubleshooting (quick)
153
- - **External port rejected**: ensure `--external-port` is inside your 10-port block.
154
- - **Relay unavailable**: check network/WSS reachability; see logs for `...RELAY_UNAVAILABLE`.
155
- - **No traffic to app**: confirm your service is listening on `127.0.0.1:<port>` and the tunnel is active; for UDP ensure the WS is still connected.
156
- - **Windows MQTT handshake issues**: rerun `asyx setup` to regenerate keys (PKCS#1).
214
+ ## Troubleshooting
215
+
216
+ | Issue | Fix |
217
+ | --- | --- |
218
+ | `asyx: command not found` | `npm install -g asyx` or `npx asyx@latest` |
219
+ | Setup browser did not open | Run `asyx setup` again; open the printed URL manually |
220
+ | Tunnel URL 502 / unreachable | Dev server not running on the same port |
221
+ | Link dies overnight | Expected—tunnel stops when CLI exits or machine sleeps |
222
+ | External port rejected | `--external-port` must be inside your assigned 10-port block |
223
+ | Windows MQTT handshake issues | Re-run `asyx setup` to regenerate keys (PKCS#1) |
157
224
 
158
225
  ---
159
226
 
160
- ## 8. Security (brief)
227
+ ## Security
228
+
161
229
  - Device-bound identity per host; hardware fingerprint hashed locally.
162
230
  - Mutual TLS to control plane; RS256 JWTs validated via JWKS.
163
- - Forward-only proxy: your app remains isolated; no direct inbound to your host.
164
- - Report issues: [security@asyx.ai](mailto:security@asyx.ai) (no public issues for security).
231
+ - Forward-only proxy—your app stays isolated; no direct inbound to your host.
232
+ - Report issues: [security@asyx.ai](mailto:security@asyx.ai)
165
233
 
166
234
  ---
167
235
 
168
- ## 9. License
236
+ ## License
237
+
169
238
  [Apache-2.0](./LICENSE)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asyx",
3
- "version": "0.5.2",
3
+ "version": "0.5.4",
4
4
  "description": "Asyx tunnel CLI — secure localhost exposure (HTTP, TCP, UDP)",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",