@aluvia/sdk 1.4.0 → 2.0.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.
Files changed (57) hide show
  1. package/CHANGELOG.md +188 -0
  2. package/README.md +162 -477
  3. package/dist/cjs/api/apiUtils.js +4 -1
  4. package/dist/cjs/client/AluviaClient.js +30 -32
  5. package/dist/cjs/client/BlockDetection.js +69 -87
  6. package/dist/cjs/client/rules.js +12 -2
  7. package/dist/cjs/connect.js +2 -2
  8. package/dist/cjs/index.js +12 -1
  9. package/dist/cjs/session/lock.js +40 -4
  10. package/dist/esm/api/apiUtils.js +4 -1
  11. package/dist/esm/client/AluviaClient.js +38 -40
  12. package/dist/esm/client/BlockDetection.js +69 -87
  13. package/dist/esm/client/rules.js +12 -2
  14. package/dist/esm/connect.js +2 -2
  15. package/dist/esm/index.js +6 -4
  16. package/dist/esm/session/lock.js +40 -4
  17. package/dist/types/client/AluviaClient.d.ts +2 -2
  18. package/dist/types/client/BlockDetection.d.ts +4 -4
  19. package/dist/types/client/types.d.ts +11 -11
  20. package/dist/types/index.d.ts +9 -7
  21. package/package.json +15 -23
  22. package/dist/cjs/bin/account.js +0 -31
  23. package/dist/cjs/bin/api-helpers.js +0 -58
  24. package/dist/cjs/bin/cli-adapter.js +0 -16
  25. package/dist/cjs/bin/cli.js +0 -245
  26. package/dist/cjs/bin/close.js +0 -120
  27. package/dist/cjs/bin/geos.js +0 -10
  28. package/dist/cjs/bin/mcp-helpers.js +0 -57
  29. package/dist/cjs/bin/mcp-server.js +0 -220
  30. package/dist/cjs/bin/mcp-tools.js +0 -90
  31. package/dist/cjs/bin/open.js +0 -293
  32. package/dist/cjs/bin/session.js +0 -259
  33. package/dist/cjs/client/PageLoadDetection.js +0 -175
  34. package/dist/esm/bin/account.js +0 -28
  35. package/dist/esm/bin/api-helpers.js +0 -53
  36. package/dist/esm/bin/cli-adapter.js +0 -8
  37. package/dist/esm/bin/cli.js +0 -242
  38. package/dist/esm/bin/close.js +0 -117
  39. package/dist/esm/bin/geos.js +0 -7
  40. package/dist/esm/bin/mcp-helpers.js +0 -51
  41. package/dist/esm/bin/mcp-server.js +0 -185
  42. package/dist/esm/bin/mcp-tools.js +0 -78
  43. package/dist/esm/bin/open.js +0 -256
  44. package/dist/esm/bin/session.js +0 -252
  45. package/dist/esm/client/PageLoadDetection.js +0 -171
  46. package/dist/types/bin/account.d.ts +0 -1
  47. package/dist/types/bin/api-helpers.d.ts +0 -20
  48. package/dist/types/bin/cli-adapter.d.ts +0 -8
  49. package/dist/types/bin/cli.d.ts +0 -2
  50. package/dist/types/bin/close.d.ts +0 -1
  51. package/dist/types/bin/geos.d.ts +0 -1
  52. package/dist/types/bin/mcp-helpers.d.ts +0 -28
  53. package/dist/types/bin/mcp-server.d.ts +0 -2
  54. package/dist/types/bin/mcp-tools.d.ts +0 -46
  55. package/dist/types/bin/open.d.ts +0 -21
  56. package/dist/types/bin/session.d.ts +0 -11
  57. package/dist/types/client/PageLoadDetection.d.ts +0 -93
package/CHANGELOG.md ADDED
@@ -0,0 +1,188 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@aluvia/sdk` are documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [2.0.0] - 2026-02-20
9
+
10
+ ### Removed
11
+ - CLI extracted to separate package `@aluvia/cli`. Subpath `@aluvia/sdk/cli` has been removed. For CLI commands use `npm install -g @aluvia/cli` (run `aluvia session start`, etc.). For programmatic use (e.g. MCP), import from `@aluvia/cli`.
12
+
13
+ ## [1.4.1] - 2026-02-17
14
+
15
+ ### Fixed
16
+ - Fix CLI hanging indefinitely on `session start` due to unresolved Promise in `handleOpen`.
17
+ - Fix reliability issue when spawning daemon process by resolving CLI path absolutely (replaces brittle `process.argv[1]` usage).
18
+
19
+ ## [1.3.0] - 2026-02-13
20
+
21
+ ### Added
22
+ - `--auto-unblock` CLI flag to enable automatic block detection and page reload through Aluvia proxy.
23
+ - Multi-session CLI support. Multiple browser sessions can now run in parallel, each with an auto-generated name (e.g. `swift-falcon`, `calm-river`). Use `--browser-session <name>` to specify a custom name.
24
+ - Full CLI command surface for agent workflows: `session start`, `session close`, `session list`, `session get`, `session rotate-ip`, `session set-geo`, `session set-rules`, `account`, `account usage`, `geos`, `help`.
25
+ - `--all` flag on `session close` command to stop all sessions at once.
26
+ - `--run <script>` option on `session start` to execute a script with `page`, `browser`, `context` injected as globals.
27
+ - `connect()` helper for AI agents to attach to running browser sessions via CDP.
28
+ - `--help` / `-h` flag support at all command levels.
29
+
30
+ ### Changed
31
+ - Overhaul website block detection with weighted scoring system. Replaces binary keyword/status matching with probabilistic signal combination across 8 detector types (HTTP status, WAF headers, title keywords, challenge selectors, visible text, text-to-HTML ratio, redirect chains, meta refresh). Adds two-pass analysis (fast pass at `domcontentloaded`, full pass after `networkidle`), SPA navigation detection, word-boundary matching to prevent false positives, and hostname-level persistent block escalation. Detection results now include `blockStatus` (`blocked`/`suspected`/`clear`), `score`, and `signals` array.
32
+ - `onDetection` callback now fires on every page analysis, including `clear` results. Previously only fired for `blocked` and `suspected` results.
33
+ - Add `autoUnblock` option to `BlockDetectionConfig` (default: `false`). Set to `true` to automatically add blocked hostnames to routing rules and reload the page. When `false` (the default), detection-only mode lets agents receive scores via `onDetection` and decide how to respond.
34
+ - Rename `pageLoadDetection` option to `blockDetection` and `PageLoadDetectionConfig`/`PageLoadDetectionResult` types to `BlockDetectionConfig`/`BlockDetectionResult` for clarity.
35
+ - Restructure CLI: replace `open`/`close`/`status` with `session start`/`session close`/`session list`/`session get` and add `session rotate-ip`, `session set-geo`, `session set-rules` subcommands.
36
+ - Lock files are now per-session (`cli-<name>.lock`) instead of a single `cli.lock`.
37
+ - `session close` now returns exit code 1 when no sessions are found.
38
+ - `session set-rules` now deduplicates rules on append and errors when both positional rules and `--remove` are specified.
39
+
40
+ ### Fixed
41
+ - Fix control-flow bug in `close` command where missing `return` before `output()` calls caused fall-through execution, potentially sending SIGTERM to undefined PIDs.
42
+ - Fix `handleOpen` crash when `spawn` throws (e.g. invalid executable path).
43
+ - Fix invalid session names causing a 60-second timeout instead of an immediate error.
44
+ - Fix `connect()` error messages referencing removed `open` and `status` commands.
45
+ - Fix `--connection-id` validation missing in daemon argument parser.
46
+
47
+ ### Removed
48
+ - Remove gateway mode (`localProxy: false`). The SDK now always runs a local proxy on `127.0.0.1`. The `localProxy` option has been removed from `AluviaClientOptions`.
49
+
50
+ ## [1.2.0] - 2026-02-11
51
+
52
+ ### Added
53
+ - Auto reload a page on block detection. See [docs](https://docs.aluvia.io/aluvia-client/auto-unblock) for details.
54
+ - CLI for managing browser sessions: `npx @aluvia/sdk session start <url>` and `npx @aluvia/sdk session close`.
55
+ - Daemon mode: browser runs as a detached background process that survives terminal close.
56
+ - CDP (Chrome DevTools Protocol) endpoint exposed via `--remote-debugging-port`, enabling external tools to connect with `connectOverCDP()` and share browser contexts/pages.
57
+ - `cdpUrl` field on `AluviaClientConnection` for programmatic CDP access.
58
+ - `headless` option on `AluviaClientOptions` (default: `true`). CLI flag `--headful` to launch a visible browser.
59
+ - `--connection-id <id>` flag on CLI `session start` command to reuse an existing connection.
60
+ - Lock file (`/tmp/aluvia-sdk/cli-<name>.lock`) for per-session state persistence with full session metadata.
61
+ - JSON output by default on all CLI commands for AI agent consumption.
62
+ - `help` command with plain-text output.
63
+
64
+ ### Changed
65
+ - Playwright browser launch uses `chromium.launch()` with `--remote-debugging-port` instead of `chromium.launchServer()` + `connect()`, enabling shared browser state across CDP connections.
66
+
67
+
68
+ ## [1.1.0] - 2026-01-26
69
+
70
+ ### Added
71
+ - Option for the client to launch Playwright browser instances directly with built-in proxy settings.
72
+
73
+
74
+ ## [1.0.0] - 2025-01-12
75
+
76
+ ### Added
77
+ - Initial release of `@aluvia/sdk`
78
+ - `AluviaClient` — main entry point for SDK
79
+ - Client proxy mode (default) — local proxy on `127.0.0.1`
80
+ - Gateway mode — direct gateway proxy settings
81
+ - `connection.asPlaywright()` — Playwright proxy configuration
82
+ - `connection.asPuppeteer()` — Puppeteer proxy arguments
83
+ - `connection.asSelenium()` — Selenium proxy arguments
84
+ - `connection.asAxiosConfig()` — Axios HTTP client configuration
85
+ - `connection.asGotOptions()` — Got HTTP client configuration
86
+ - `connection.asNodeAgents()` — Node.js HTTP/HTTPS agents
87
+ - `connection.asUndiciDispatcher()` — Undici dispatcher
88
+ - `connection.asUndiciFetch()` — Fetch function via Undici
89
+ - `client.updateRules()` — update routing rules at runtime
90
+ - `client.updateSessionId()` — update upstream session
91
+ - `client.updateTargetGeo()` — update geo targeting
92
+ - `AluviaApi` — typed wrapper for Aluvia REST API
93
+ - Hostname-based routing rules with wildcard support
94
+ - ETag-based config polling for live updates
95
+ - Error classes: `MissingApiKeyError`, `InvalidApiKeyError`, `ApiError`, `ProxyStartError`
96
+
97
+ ---
98
+
99
+ ## Changelog Policy
100
+
101
+ ### When to Update
102
+
103
+ Update this changelog for **every release**. Add entries to `[Unreleased]` during development.
104
+
105
+ ### Categories
106
+
107
+ Use these categories (in order):
108
+
109
+ | Category | Description |
110
+ |----------|-------------|
111
+ | **Added** | New features |
112
+ | **Changed** | Changes to existing functionality |
113
+ | **Deprecated** | Features that will be removed |
114
+ | **Removed** | Features that were removed |
115
+ | **Fixed** | Bug fixes |
116
+ | **Security** | Security vulnerability fixes |
117
+
118
+ ### Entry Format
119
+
120
+ Each entry should:
121
+ - Start with a verb (Add, Fix, Change, Remove, etc.)
122
+ - Be concise but descriptive
123
+ - Reference issues/PRs when relevant
124
+
125
+ **Good:**
126
+ ```markdown
127
+ - Add `updateTargetGeo()` method for geo targeting (#42)
128
+ - Fix hostname extraction for origin-form URLs
129
+ - Change default poll interval from 10s to 5s
130
+ ```
131
+
132
+ **Bad:**
133
+ ```markdown
134
+ - updateTargetGeo
135
+ - Fixed bug
136
+ - Changes
137
+ ```
138
+
139
+ ### Release Process
140
+
141
+ 1. Move entries from `[Unreleased]` to new version section
142
+ 2. Add release date
143
+ 3. Commit changelog with version bump
144
+ 4. Tag release
145
+
146
+ ### Conventional Commits
147
+
148
+ We use Conventional Commits for commit messages. The changelog can be auto-generated from commits:
149
+
150
+ ```bash
151
+ # Install standard-version (optional)
152
+ npm install -D standard-version
153
+
154
+ # Generate changelog from commits
155
+ npx standard-version
156
+ ```
157
+
158
+ Commit types map to changelog categories:
159
+
160
+ | Commit Type | Changelog Category |
161
+ |-------------|-------------------|
162
+ | `feat:` | Added |
163
+ | `fix:` | Fixed |
164
+ | `perf:` | Changed |
165
+ | `refactor:` | Changed |
166
+ | `docs:` | (usually not included) |
167
+ | `chore:` | (usually not included) |
168
+ | `BREAKING CHANGE:` | Changed (major version) |
169
+
170
+ ### Version Links
171
+
172
+ At the bottom of the file, add comparison links:
173
+
174
+ ```markdown
175
+ [Unreleased]: https://github.com/aluvia-connect/sdk-node/compare/v1.0.0...HEAD
176
+ [1.0.0]: https://github.com/aluvia-connect/sdk-node/releases/tag/v1.0.0
177
+ ```
178
+
179
+ ---
180
+
181
+ [Unreleased]: https://github.com/aluvia-connect/sdk-node/compare/v2.0.0...HEAD
182
+ [2.0.0]: https://github.com/aluvia-connect/sdk-node/compare/v1.4.1...v2.0.0
183
+ [1.4.1]: https://github.com/aluvia-connect/sdk-node/compare/v1.4.0...v1.4.1
184
+ [1.4.0]: https://github.com/aluvia-connect/sdk-node/compare/v1.3.0...v1.4.0
185
+ [1.3.0]: https://github.com/aluvia-connect/sdk-node/compare/v1.2.0...v1.3.0
186
+ [1.2.0]: https://github.com/aluvia-connect/sdk-node/compare/v1.1.0...v1.2.0
187
+ [1.1.0]: https://github.com/aluvia-connect/sdk-node/compare/v1.0.0...v1.1.0
188
+ [1.0.0]: https://github.com/aluvia-connect/sdk-node/releases/tag/v1.0.0