sweetlink 0.1.0 → 0.2.1
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/CHANGELOG.md +20 -0
- package/LICENSE +1 -1
- package/README.md +22 -11
- package/dist/daemon/src/codename.d.ts.map +1 -1
- package/dist/daemon/src/codename.js +11 -11
- package/dist/daemon/src/codename.js.map +1 -1
- package/dist/daemon/src/index.d.ts +1 -1
- package/dist/daemon/src/index.js +131 -122
- package/dist/daemon/src/index.js.map +1 -1
- package/dist/shared/src/env.d.ts.map +1 -1
- package/dist/shared/src/env.js +12 -12
- package/dist/shared/src/env.js.map +1 -1
- package/dist/shared/src/index.d.ts +30 -30
- package/dist/shared/src/index.d.ts.map +1 -1
- package/dist/shared/src/index.js +17 -17
- package/dist/shared/src/index.js.map +1 -1
- package/dist/shared/src/node.d.ts +1 -1
- package/dist/shared/src/node.d.ts.map +1 -1
- package/dist/shared/src/node.js +18 -18
- package/dist/shared/src/node.js.map +1 -1
- package/dist/src/codex.d.ts +1 -1
- package/dist/src/codex.js +19 -19
- package/dist/src/codex.js.map +1 -1
- package/dist/src/commands/click.d.ts +1 -1
- package/dist/src/commands/click.d.ts.map +1 -1
- package/dist/src/commands/click.js +32 -24
- package/dist/src/commands/click.js.map +1 -1
- package/dist/src/commands/run-js.d.ts +1 -1
- package/dist/src/commands/run-js.d.ts.map +1 -1
- package/dist/src/commands/run-js.js +10 -10
- package/dist/src/commands/run-js.js.map +1 -1
- package/dist/src/commands/trust-ca.d.ts +1 -1
- package/dist/src/commands/trust-ca.js +15 -15
- package/dist/src/core/config-file.d.ts +6 -0
- package/dist/src/core/config-file.d.ts.map +1 -1
- package/dist/src/core/config-file.js +73 -38
- package/dist/src/core/config-file.js.map +1 -1
- package/dist/src/core/config.d.ts +3 -2
- package/dist/src/core/config.d.ts.map +1 -1
- package/dist/src/core/config.js +31 -18
- package/dist/src/core/config.js.map +1 -1
- package/dist/src/core/dev-bootstrap.d.ts +10 -0
- package/dist/src/core/dev-bootstrap.d.ts.map +1 -0
- package/dist/src/core/dev-bootstrap.js +112 -0
- package/dist/src/core/dev-bootstrap.js.map +1 -0
- package/dist/src/core/env.d.ts +1 -1
- package/dist/src/core/env.d.ts.map +1 -1
- package/dist/src/core/env.js +3 -3
- package/dist/src/core/env.js.map +1 -1
- package/dist/src/devtools-registry.d.ts.map +1 -1
- package/dist/src/devtools-registry.js +48 -46
- package/dist/src/devtools-registry.js.map +1 -1
- package/dist/src/env.d.ts +1 -1
- package/dist/src/env.js +1 -1
- package/dist/src/http.d.ts.map +1 -1
- package/dist/src/http.js +7 -6
- package/dist/src/http.js.map +1 -1
- package/dist/src/index.d.ts +7 -7
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +450 -363
- package/dist/src/index.js.map +1 -1
- package/dist/src/runtime/browser/client.d.ts +3 -3
- package/dist/src/runtime/browser/client.d.ts.map +1 -1
- package/dist/src/runtime/browser/client.js +79 -72
- package/dist/src/runtime/browser/client.js.map +1 -1
- package/dist/src/runtime/browser/commands/index.d.ts +2 -2
- package/dist/src/runtime/browser/commands/index.js +17 -17
- package/dist/src/runtime/browser/commands/index.js.map +1 -1
- package/dist/src/runtime/browser/dom-to-image-loader.d.ts.map +1 -1
- package/dist/src/runtime/browser/dom-to-image-loader.js +7 -7
- package/dist/src/runtime/browser/dom-to-image-loader.js.map +1 -1
- package/dist/src/runtime/browser/index.d.ts +3 -3
- package/dist/src/runtime/browser/index.js +2 -2
- package/dist/src/runtime/browser/module-loader.js +2 -2
- package/dist/src/runtime/browser/screenshot/hooks.d.ts +25 -53
- package/dist/src/runtime/browser/screenshot/hooks.d.ts.map +1 -1
- package/dist/src/runtime/browser/screenshot/hooks.js +32 -29
- package/dist/src/runtime/browser/screenshot/hooks.js.map +1 -1
- package/dist/src/runtime/browser/screenshot/index.d.ts +3 -3
- package/dist/src/runtime/browser/screenshot/index.d.ts.map +1 -1
- package/dist/src/runtime/browser/screenshot/index.js +17 -15
- package/dist/src/runtime/browser/screenshot/index.js.map +1 -1
- package/dist/src/runtime/browser/screenshot/renderers/dom-to-image.d.ts +1 -1
- package/dist/src/runtime/browser/screenshot/renderers/dom-to-image.js +13 -13
- package/dist/src/runtime/browser/screenshot/renderers/dom-to-image.js.map +1 -1
- package/dist/src/runtime/browser/screenshot/renderers/html2canvas.d.ts +1 -1
- package/dist/src/runtime/browser/screenshot/renderers/html2canvas.d.ts.map +1 -1
- package/dist/src/runtime/browser/screenshot/renderers/html2canvas.js +24 -24
- package/dist/src/runtime/browser/screenshot/renderers/html2canvas.js.map +1 -1
- package/dist/src/runtime/browser/screenshot/targets.d.ts +2 -2
- package/dist/src/runtime/browser/screenshot/targets.js +9 -9
- package/dist/src/runtime/browser/screenshot/utils.d.ts +1 -1
- package/dist/src/runtime/browser/screenshot/utils.d.ts.map +1 -1
- package/dist/src/runtime/browser/screenshot/utils.js +73 -71
- package/dist/src/runtime/browser/screenshot/utils.js.map +1 -1
- package/dist/src/runtime/browser/selector-discovery.d.ts +1 -1
- package/dist/src/runtime/browser/selector-discovery.d.ts.map +1 -1
- package/dist/src/runtime/browser/selector-discovery.js +24 -22
- package/dist/src/runtime/browser/selector-discovery.js.map +1 -1
- package/dist/src/runtime/browser/storage/session-storage.d.ts +1 -1
- package/dist/src/runtime/browser/storage/session-storage.d.ts.map +1 -1
- package/dist/src/runtime/browser/storage/session-storage.js +12 -10
- package/dist/src/runtime/browser/storage/session-storage.js.map +1 -1
- package/dist/src/runtime/browser/types.d.ts +7 -7
- package/dist/src/runtime/browser/types.js +1 -1
- package/dist/src/runtime/browser/utils/console.d.ts +1 -1
- package/dist/src/runtime/browser/utils/console.js +16 -16
- package/dist/src/runtime/browser/utils/console.js.map +1 -1
- package/dist/src/runtime/browser/utils/environment.js +2 -2
- package/dist/src/runtime/browser/utils/errors.d.ts.map +1 -1
- package/dist/src/runtime/browser/utils/errors.js +11 -11
- package/dist/src/runtime/browser/utils/number.d.ts.map +1 -1
- package/dist/src/runtime/browser/utils/number.js.map +1 -1
- package/dist/src/runtime/browser/utils/object.d.ts.map +1 -1
- package/dist/src/runtime/browser/utils/object.js +2 -2
- package/dist/src/runtime/browser/utils/object.js.map +1 -1
- package/dist/src/runtime/browser/utils/sanitize.js +2 -2
- package/dist/src/runtime/browser/utils/time.d.ts.map +1 -1
- package/dist/src/runtime/browser/utils/time.js +1 -1
- package/dist/src/runtime/chrome/cookies.d.ts +4 -4
- package/dist/src/runtime/chrome/cookies.d.ts.map +1 -1
- package/dist/src/runtime/chrome/cookies.js +31 -31
- package/dist/src/runtime/chrome/cookies.js.map +1 -1
- package/dist/src/runtime/chrome/deep-link.d.ts +13 -0
- package/dist/src/runtime/chrome/deep-link.d.ts.map +1 -0
- package/dist/src/runtime/chrome/deep-link.js +292 -0
- package/dist/src/runtime/chrome/deep-link.js.map +1 -0
- package/dist/src/runtime/chrome/diagnostics.d.ts.map +1 -1
- package/dist/src/runtime/chrome/diagnostics.js +13 -11
- package/dist/src/runtime/chrome/diagnostics.js.map +1 -1
- package/dist/src/runtime/chrome/focus.d.ts.map +1 -1
- package/dist/src/runtime/chrome/focus.js +5 -5
- package/dist/src/runtime/chrome/focus.js.map +1 -1
- package/dist/src/runtime/chrome/launch.d.ts.map +1 -1
- package/dist/src/runtime/chrome/launch.js +30 -30
- package/dist/src/runtime/chrome/launch.js.map +1 -1
- package/dist/src/runtime/chrome/puppeteer.d.ts +2 -2
- package/dist/src/runtime/chrome/puppeteer.d.ts.map +1 -1
- package/dist/src/runtime/chrome/puppeteer.js +16 -11
- package/dist/src/runtime/chrome/puppeteer.js.map +1 -1
- package/dist/src/runtime/chrome/reuse.d.ts.map +1 -1
- package/dist/src/runtime/chrome/reuse.js +38 -35
- package/dist/src/runtime/chrome/reuse.js.map +1 -1
- package/dist/src/runtime/chrome/session.d.ts +1 -1
- package/dist/src/runtime/chrome/session.d.ts.map +1 -1
- package/dist/src/runtime/chrome/session.js +12 -10
- package/dist/src/runtime/chrome/session.js.map +1 -1
- package/dist/src/runtime/chrome.d.ts +8 -8
- package/dist/src/runtime/chrome.js +8 -8
- package/dist/src/runtime/cookies.d.ts +1 -16
- package/dist/src/runtime/cookies.d.ts.map +1 -1
- package/dist/src/runtime/cookies.js +177 -281
- package/dist/src/runtime/cookies.js.map +1 -1
- package/dist/src/runtime/devstack.d.ts +1 -1
- package/dist/src/runtime/devstack.d.ts.map +1 -1
- package/dist/src/runtime/devstack.js +31 -28
- package/dist/src/runtime/devstack.js.map +1 -1
- package/dist/src/runtime/devtools/background.js +22 -22
- package/dist/src/runtime/devtools/cdp.d.ts +3 -2
- package/dist/src/runtime/devtools/cdp.d.ts.map +1 -1
- package/dist/src/runtime/devtools/cdp.js +61 -56
- package/dist/src/runtime/devtools/cdp.js.map +1 -1
- package/dist/src/runtime/devtools/config.d.ts +44 -1
- package/dist/src/runtime/devtools/config.d.ts.map +1 -1
- package/dist/src/runtime/devtools/config.js +15 -15
- package/dist/src/runtime/devtools/config.js.map +1 -1
- package/dist/src/runtime/devtools/constants.d.ts.map +1 -1
- package/dist/src/runtime/devtools/constants.js +18 -10
- package/dist/src/runtime/devtools/constants.js.map +1 -1
- package/dist/src/runtime/devtools/diagnostics.d.ts +6 -3
- package/dist/src/runtime/devtools/diagnostics.d.ts.map +1 -1
- package/dist/src/runtime/devtools/diagnostics.js +40 -38
- package/dist/src/runtime/devtools/diagnostics.js.map +1 -1
- package/dist/src/runtime/devtools/oauth.d.ts +1 -1
- package/dist/src/runtime/devtools/oauth.d.ts.map +1 -1
- package/dist/src/runtime/devtools/oauth.js +35 -28
- package/dist/src/runtime/devtools/oauth.js.map +1 -1
- package/dist/src/runtime/devtools/types.d.ts +3 -48
- package/dist/src/runtime/devtools/types.d.ts.map +1 -1
- package/dist/src/runtime/devtools.d.ts +7 -7
- package/dist/src/runtime/devtools.js +7 -7
- package/dist/src/runtime/next-devtools.d.ts.map +1 -1
- package/dist/src/runtime/next-devtools.js +12 -12
- package/dist/src/runtime/next-devtools.js.map +1 -1
- package/dist/src/runtime/screenshot.d.ts +9 -9
- package/dist/src/runtime/screenshot.d.ts.map +1 -1
- package/dist/src/runtime/screenshot.js +65 -46
- package/dist/src/runtime/screenshot.js.map +1 -1
- package/dist/src/runtime/scripts.d.ts +1 -1
- package/dist/src/runtime/scripts.d.ts.map +1 -1
- package/dist/src/runtime/scripts.js +28 -28
- package/dist/src/runtime/scripts.js.map +1 -1
- package/dist/src/runtime/session.d.ts +6 -6
- package/dist/src/runtime/session.d.ts.map +1 -1
- package/dist/src/runtime/session.js +35 -35
- package/dist/src/runtime/session.js.map +1 -1
- package/dist/src/runtime/smoke.d.ts +3 -3
- package/dist/src/runtime/smoke.d.ts.map +1 -1
- package/dist/src/runtime/smoke.js +85 -79
- package/dist/src/runtime/smoke.js.map +1 -1
- package/dist/src/runtime/url.d.ts +2 -2
- package/dist/src/runtime/url.d.ts.map +1 -1
- package/dist/src/runtime/url.js +20 -20
- package/dist/src/runtime/url.js.map +1 -1
- package/dist/src/screenshot-hooks.d.ts +1 -1
- package/dist/src/screenshot-hooks.d.ts.map +1 -1
- package/dist/src/screenshot-hooks.js +12 -12
- package/dist/src/screenshot-hooks.js.map +1 -1
- package/dist/src/shared/env.d.ts.map +1 -1
- package/dist/src/shared/env.js +11 -11
- package/dist/src/shared/env.js.map +1 -1
- package/dist/src/shared/index.d.ts +30 -30
- package/dist/src/shared/index.d.ts.map +1 -1
- package/dist/src/shared/index.js +17 -17
- package/dist/src/shared/index.js.map +1 -1
- package/dist/src/shared/node.d.ts +1 -1
- package/dist/src/shared/node.d.ts.map +1 -1
- package/dist/src/shared/node.js +18 -18
- package/dist/src/shared/node.js.map +1 -1
- package/dist/src/token.d.ts +1 -1
- package/dist/src/token.d.ts.map +1 -1
- package/dist/src/token.js +21 -18
- package/dist/src/token.js.map +1 -1
- package/dist/src/types.d.ts +7 -1
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/util/app-label.js +4 -4
- package/dist/src/util/errors.d.ts.map +1 -1
- package/dist/src/util/errors.js +12 -10
- package/dist/src/util/errors.js.map +1 -1
- package/dist/src/util/path.js +2 -2
- package/dist/src/util/regex.js +4 -4
- package/package.json +48 -40
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.1 — 2026-06-11
|
|
4
|
+
|
|
5
|
+
- **Click defaults restored**: `sweetlink click` now scrolls targets into view and dispatches bubbling clicks by default again, with explicit `--no-scroll` and `--no-bubbles` opt-outs. Thanks @devYRPauli.
|
|
6
|
+
- **Cookie collection modernized**: Chrome cookie sync now uses `@steipete/sweet-cookie`, preserves the `~/.oracle` inline fallback, and drops the old native SQLite/keytar dependency path.
|
|
7
|
+
- **Smoke route corrected**: the built-in `main` preset now targets `/timeline` and no longer treats the removed `/timeline/home` route as equivalent.
|
|
8
|
+
- **Node 24 baseline**: package metadata, CI, TypeScript builds, linting, and runtime dependencies now target Node.js 24 or newer.
|
|
9
|
+
- **Runtime maintenance**: updated Commander, Puppeteer Core, Playwright Core, WebSocket, Vite, and supporting dependencies.
|
|
10
|
+
|
|
11
|
+
## 0.2.0 — 2025-12-26
|
|
12
|
+
|
|
13
|
+
- **Browser runtime tests moved in**: migrated Sweetistics runtime/browser test coverage into SweetLink’s own suite.
|
|
14
|
+
- **JSDOM-backed runtime specs**: added `jsdom` dev dependency to support browser runtime tests.
|
|
15
|
+
- **DevTools cleanup**: removed an unused DevTools CDP import to keep lint noise down.
|
|
16
|
+
- **OAuth deep linking**: `sweetlink open` now auto-kicks OAuth and re-navigates to deep paths when a sign-in flow is required.
|
|
17
|
+
- **Cookie sync stability**: Chrome cookie harvesting runs sequentially to avoid dropped reads; added regression coverage.
|
|
18
|
+
- **Daemon entrypoints**: added the `sweetlinkd` bin plus `sweetlink daemon` subcommand for daemon starts.
|
|
19
|
+
- **Reuse fallback**: when a reused DevTools session fails to reach the deep link, `sweetlink open` now launches a fresh controlled window and retries.
|
|
20
|
+
- **Daemon shared resolution**: `sweetlinkd` now loads shared helpers via bundled paths so local installs and links run cleanly.
|
|
21
|
+
- **Dev bootstrap**: optional `devBootstrap.path` can mint a local admin API key + dev login URL for Sweetistics.
|
|
22
|
+
|
|
3
23
|
## 0.1.0 — 2025-11-22 (Initial release)
|
|
4
24
|
|
|
5
25
|
### Highlights
|
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
|
-
# SweetLink 🍭
|
|
1
|
+
# SweetLink 🍭 - Playwright vibes in your current tab; close the agent loop
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="docs/assets/sweetlink-header.png" alt="SweetLink header banner" width="1100">
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://www.npmjs.com/package/sweetlink"><img src="https://img.shields.io/npm/v/sweetlink?style=for-the-badge&logo=npm&logoColor=white" alt="npm version"></a>
|
|
9
|
+
<a href="https://github.com/steipete/sweetlink/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/steipete/sweetlink/ci.yml?branch=main&style=for-the-badge&label=tests" alt="CI Status"></a>
|
|
10
|
+
<a href="https://github.com/steipete/sweetlink"><img src="https://img.shields.io/badge/platforms-macOS%20%7C%20Linux%20%7C%20Windows-blue?style=for-the-badge" alt="Platforms"></a>
|
|
11
|
+
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green?style=for-the-badge" alt="MIT License"></a>
|
|
12
|
+
</p>
|
|
4
13
|
|
|
5
|
-
|
|
14
|
+
SweetLink is the agent-ready way to "connect your agent to your web app. Like Playwright, but it works in your current tab. Close the loop." It drives a real browser session through the SweetLink daemon so you can authenticate, capture screenshots, run smoke tests, and gather DevTools telemetry without wiring up a headless automation stack.
|
|
6
15
|
|
|
7
16
|
## Features
|
|
8
17
|
|
|
@@ -14,10 +23,10 @@ SweetLink is the agent-ready way to "connect your agent to your web app. Like Pl
|
|
|
14
23
|
|
|
15
24
|
## Prerequisites
|
|
16
25
|
|
|
17
|
-
- Node.js
|
|
26
|
+
- Node.js 24+
|
|
18
27
|
- `pnpm` (managed via Corepack)
|
|
19
28
|
- TLS requirements: `brew install mkcert nss`
|
|
20
|
-
- SweetLink daemon (`
|
|
29
|
+
- SweetLink daemon running locally (`pnpm exec sweetlink daemon` or `pnpm exec sweetlinkd`)
|
|
21
30
|
- Trust the local certificate once: `pnpm sweetlink trust-ca`
|
|
22
31
|
|
|
23
32
|
## Installation
|
|
@@ -37,6 +46,7 @@ pnpm sweetlink --help
|
|
|
37
46
|
|
|
38
47
|
Common workflows:
|
|
39
48
|
|
|
49
|
+
- `pnpm exec sweetlink daemon` – start the SweetLink daemon (alias: `pnpm exec sweetlinkd`).
|
|
40
50
|
- `pnpm sweetlink open --controlled --path /dashboard` – launch/reuse the controlled Chrome window.
|
|
41
51
|
- `pnpm sweetlink open --url http://localhost:4100/dashboard` – target a non-default host/port for one-off runs.
|
|
42
52
|
- `pnpm sweetlink sessions` – view active sessions (codename, heartbeat, socket state, buffered console errors).
|
|
@@ -70,7 +80,7 @@ SweetLink defaults to `https://localhost:4455` for daemon traffic. Run `pnpm swe
|
|
|
70
80
|
SweetLink consists of two cooperating pieces:
|
|
71
81
|
|
|
72
82
|
- **CLI** – a Node.js client that parses your commands (`open`, `smoke`, `sessions`, etc.), reads `sweetlink.json`, and establishes a control session with your browser.
|
|
73
|
-
- **Daemon** – a long-lived service (`pnpm sweetlink
|
|
83
|
+
- **Daemon** – a long-lived service (`pnpm exec sweetlink daemon` or `pnpm exec sweetlinkd`) that launches or attaches to a DevTools-enabled Chrome instance, forwards console/network telemetry, and executes remote evaluations on behalf of the CLI.
|
|
74
84
|
|
|
75
85
|
The typical flow looks like this:
|
|
76
86
|
|
|
@@ -130,6 +140,7 @@ Place the config file in your project root (or any parent directory). With the f
|
|
|
130
140
|
- `prodUrl` – Base URL for `--env prod` runs (smoke tests, screenshots). Falls back to the same origin as `appUrl` when omitted or when `SWEETLINK_PROD_URL` is unset.
|
|
131
141
|
- `daemonUrl` – Location of the SweetLink daemon. Defaults to `https://localhost:4455`; override when you run the daemon remotely.
|
|
132
142
|
- `adminKey` – Admin API key used when the CLI requests short-lived session tokens. Provide it via config/`--admin-key`, `SWEETLINK_LOCAL_ADMIN_API_KEY` (preferred for dev), `SWEETLINK_ADMIN_API_KEY` (prod), or the legacy `SWEETISTICS_*` variables for backwards compatibility.
|
|
143
|
+
- `devBootstrap` – Optional dev bootstrap settings that let the CLI fetch a local admin key + dev login URL on demand (endpoint + login path).
|
|
133
144
|
- `port` – Injected into `appUrl` when no explicit host is provided. Handy for per-service configs (`4100`, `5173`, etc.).
|
|
134
145
|
- `healthChecks.paths` – Additional paths the CLI and watchdog probe before assuming the app is healthy. Include JSON APIs or custom `/healthz` endpoints to catch silent failures.
|
|
135
146
|
- `cookieMappings` – List of `{ hosts, origins }` entries that teach SweetLink which Chrome profiles to harvest cookies from. Map every hostname your app serves (including wildcards) to the origins you need (auth providers, REST APIs, CDNs). SweetLink combines these with the primary origin for the target URL; no extra domains are assumed automatically.
|
|
@@ -139,11 +150,11 @@ Place the config file in your project root (or any parent directory). With the f
|
|
|
139
150
|
- `oauthScript` – Absolute or relative path to an OAuth automation script (ESM module). When set, SweetLink loads the module at runtime and calls its `authorize(context)` export to approve third-party consent dialogs.
|
|
140
151
|
|
|
141
152
|
SweetLink reads the config once at start-up. When you edit `sweetlink.json` rerun the CLI command to pick up the new defaults. Multiple projects on the same machine can keep their own config files; SweetLink stops at the first file it finds while walking up the directory tree, so place project-specific configs as close to the repo root as possible.
|
|
142
|
-
See `
|
|
153
|
+
See `docs/config.md` for a full configuration reference (including environment overrides).
|
|
143
154
|
|
|
144
155
|
### OAuth automation scripts
|
|
145
156
|
|
|
146
|
-
Out of the box SweetLink no longer ships opinionated OAuth heuristics. Instead you can point `oauthScript` at a small ESM module that exports an `authorize(context)` function. The helper receives a `SweetLinkOauthAuthorizeContext` with DevTools and Puppeteer helpers, so you can fully control how SweetLink approves third-party consent prompts. A ready-to-use implementation for Twitter/X lives at `
|
|
157
|
+
Out of the box SweetLink no longer ships opinionated OAuth heuristics. Instead you can point `oauthScript` at a small ESM module that exports an `authorize(context)` function. The helper receives a `SweetLinkOauthAuthorizeContext` with DevTools and Puppeteer helpers, so you can fully control how SweetLink approves third-party consent prompts. A ready-to-use implementation for Twitter/X lives at `examples/oauth/twitter-oauth-automation.ts`; copy it into your project (or tweak it) and set `oauthScript` to that path to re-enable the previous behaviour. If the script is omitted, SweetLink will log that auto-authorization is disabled and leave the prompt untouched.
|
|
147
158
|
|
|
148
159
|
You can also specify the script through runtime inputs:
|
|
149
160
|
|
|
@@ -193,11 +204,11 @@ export const sweetLinkClient = createSweetLinkClient({
|
|
|
193
204
|
|
|
194
205
|
The runtime mirrors everything we ship in production: websocket lifecycle, console buffering, screenshot hooks/renderers, selector discovery, and auto-reconnect with stored-session resume. Tests can import `sweetLinkBrowserTestHelpers` to reuse `createHookRunner`, `stripDataUrlPrefix`, and `commandSelectorSummary` without reaching into private modules.
|
|
195
206
|
|
|
196
|
-
👉 See [`
|
|
207
|
+
👉 See [`browser.md`](./browser.md) for a step-by-step integration guide (handshake endpoint, custom storage adapters, DOM events) plus a reference implementation you can copy into other apps.
|
|
197
208
|
|
|
198
209
|
## Example App
|
|
199
210
|
|
|
200
|
-
Looking for a minimal integration? Launch the demo web app under `
|
|
211
|
+
Looking for a minimal integration? Launch the demo web app under `examples/basic-web`:
|
|
201
212
|
|
|
202
213
|
```bash
|
|
203
214
|
cd examples/basic-web
|
|
@@ -228,7 +239,7 @@ pnpm test
|
|
|
228
239
|
|
|
229
240
|
## License
|
|
230
241
|
|
|
231
|
-
SweetLink (CLI, daemon, and shared packages) is licensed under the MIT License. See `
|
|
242
|
+
SweetLink (CLI, daemon, and shared packages) is licensed under the MIT License. See `LICENSE` for the full text.
|
|
232
243
|
|
|
233
244
|
## TLS Onboarding
|
|
234
245
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codename.d.ts","sourceRoot":"","sources":["../../../daemon/src/codename.ts"],"names":[],"mappings":"AAGA,UAAU,eAAe;IACvB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,MAAM,CAAC;IACpC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,MAAM,CAAC;IACpC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,MAAM,CAAC;CAC1C;AA0BD,wBAAgB,uBAAuB,
|
|
1
|
+
{"version":3,"file":"codename.d.ts","sourceRoot":"","sources":["../../../daemon/src/codename.ts"],"names":[],"mappings":"AAGA,UAAU,eAAe;IACvB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,MAAM,CAAC;IACpC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,MAAM,CAAC;IACpC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,MAAM,CAAC;CAC1C;AA0BD,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,EAC1B,OAAO,GAAE,eAAoB,GAC5B,MAAM,CA0BR"}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { randomInt } from
|
|
2
|
-
import { generateSlug } from
|
|
1
|
+
import { randomInt } from "node:crypto";
|
|
2
|
+
import { generateSlug } from "random-word-slugs";
|
|
3
3
|
const MAX_ATTEMPTS = 12;
|
|
4
4
|
const ensureNonEmptyString = (value, label) => {
|
|
5
|
-
if (typeof value !==
|
|
5
|
+
if (typeof value !== "string" || value.trim().length === 0) {
|
|
6
6
|
throw new TypeError(`${label} must return a non-empty string`);
|
|
7
7
|
}
|
|
8
8
|
return value;
|
|
9
9
|
};
|
|
10
10
|
const defaultSlugFactory = () => {
|
|
11
11
|
const slug = generateSlug(2, {
|
|
12
|
-
partsOfSpeech: [
|
|
13
|
-
format:
|
|
12
|
+
partsOfSpeech: ["adjective", "noun"],
|
|
13
|
+
format: "kebab",
|
|
14
14
|
});
|
|
15
|
-
return ensureNonEmptyString(slug,
|
|
15
|
+
return ensureNonEmptyString(slug, "slugFactory");
|
|
16
16
|
};
|
|
17
17
|
const defaultSaltFactory = () => randomInt(36 ** 2)
|
|
18
18
|
.toString(36)
|
|
19
|
-
.padStart(2,
|
|
19
|
+
.padStart(2, "0");
|
|
20
20
|
const defaultTimestampFactory = () => Date.now();
|
|
21
21
|
export function generateSessionCodename(existing, options = {}) {
|
|
22
22
|
const used = new Set(existing);
|
|
@@ -24,18 +24,18 @@ export function generateSessionCodename(existing, options = {}) {
|
|
|
24
24
|
const saltFactory = options.saltFactory ?? defaultSaltFactory;
|
|
25
25
|
const timestampFactory = options.timestampFactory ?? defaultTimestampFactory;
|
|
26
26
|
for (let attempt = 0; attempt < MAX_ATTEMPTS; attempt += 1) {
|
|
27
|
-
const candidate = ensureNonEmptyString(slugFactory(),
|
|
27
|
+
const candidate = ensureNonEmptyString(slugFactory(), "slugFactory");
|
|
28
28
|
if (!used.has(candidate)) {
|
|
29
29
|
return candidate;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
const withSalt = `${ensureNonEmptyString(slugFactory(),
|
|
32
|
+
const withSalt = `${ensureNonEmptyString(slugFactory(), "slugFactory")}-${ensureNonEmptyString(saltFactory(), "saltFactory")}`;
|
|
33
33
|
if (!used.has(withSalt)) {
|
|
34
34
|
return withSalt;
|
|
35
35
|
}
|
|
36
36
|
const timestamp = timestampFactory();
|
|
37
|
-
if (typeof timestamp !==
|
|
38
|
-
throw new TypeError(
|
|
37
|
+
if (typeof timestamp !== "number" || Number.isNaN(timestamp)) {
|
|
38
|
+
throw new TypeError("timestampFactory must return a numeric timestamp");
|
|
39
39
|
}
|
|
40
40
|
return `${withSalt}-${Math.abs(timestamp).toString(36).slice(-2)}`;
|
|
41
41
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codename.js","sourceRoot":"","sources":["../../../daemon/src/codename.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,S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