@memberjunction/remote-browser-steel 0.0.1 → 5.41.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 +59 -28
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/steel-client.d.ts +85 -0
- package/dist/steel-client.d.ts.map +1 -0
- package/dist/steel-client.js +28 -0
- package/dist/steel-client.js.map +1 -0
- package/dist/steel-remote-browser.d.ts +85 -0
- package/dist/steel-remote-browser.d.ts.map +1 -0
- package/dist/steel-remote-browser.js +136 -0
- package/dist/steel-remote-browser.js.map +1 -0
- package/package.json +32 -7
package/README.md
CHANGED
|
@@ -1,45 +1,76 @@
|
|
|
1
1
|
# @memberjunction/remote-browser-steel
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The **Steel** ([steel.dev](https://steel.dev)) backend driver for the MemberJunction Remote Browser
|
|
4
|
+
channel.
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
Steel is a browser-as-a-service: a CDP connect endpoint plus a hosted session viewer (with human
|
|
7
|
+
takeover), stealth, proxy egress, session recording, persistent contexts, multi-tab, downloads, and
|
|
8
|
+
CAPTCHA solving — but **no first-party AI-control harness**. Steel sessions are driven by MJ's own
|
|
9
|
+
computer-use control (or OSS Stagehand-over-CDP). This package contributes the `SteelRemoteBrowser`
|
|
10
|
+
driver that the channel resolves for the "Steel" provider metadata row.
|
|
6
11
|
|
|
7
|
-
|
|
12
|
+
## How trivial the driver is
|
|
8
13
|
|
|
9
|
-
|
|
14
|
+
All Remote Browser backends drive the page **identically over CDP** — the shared
|
|
15
|
+
[`@memberjunction/remote-browser-cdp`](../../Cdp) kit owns that entire control path (action translation,
|
|
16
|
+
capability gating, screencast, human takeover, `Connect`/`Disconnect`, teardown). A driver subclasses
|
|
17
|
+
`BaseCdpRemoteBrowserProvider` and fills in just **one hook**:
|
|
10
18
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
3. Establish provenance for packages published under this name
|
|
19
|
+
```ts
|
|
20
|
+
protected async AcquireSession(ctx): Promise<{ CdpEndpoint: string; Backend: ICdpSessionBackend }>
|
|
21
|
+
```
|
|
15
22
|
|
|
16
|
-
|
|
23
|
+
`SteelRemoteBrowser.AcquireSession` calls the client's `CreateSession` and returns its CDP endpoint plus
|
|
24
|
+
a small `ICdpSessionBackend`:
|
|
17
25
|
|
|
18
|
-
|
|
26
|
+
| Backend hook | Steel mapping |
|
|
27
|
+
| --- | --- |
|
|
28
|
+
| `GetLiveViewUrl()` | the hosted session-viewer URL from `CreateSession` |
|
|
29
|
+
| `InvokeNativeAIControl(intent)` | **throws** `RemoteBrowserCapabilityNotSupportedError('NativeAIControl', 'Steel')` — no first-party AI harness |
|
|
30
|
+
| `Release()` | `client.ReleaseSession(...)` |
|
|
19
31
|
|
|
20
|
-
##
|
|
32
|
+
## Capabilities
|
|
21
33
|
|
|
22
|
-
|
|
34
|
+
Mirrors the "Steel" seed row's `SupportedFeatures`: LiveView, HumanTakeover, ScreenStreaming, Stealth,
|
|
35
|
+
ProxyEgress, SessionRecording, PersistentContext, MultiTab, FileDownloads, CaptchaSolving (plus
|
|
36
|
+
`RawCdpControl`). **`NativeAIControl` is intentionally absent** — and the driver enforces that by throwing
|
|
37
|
+
when it is invoked.
|
|
23
38
|
|
|
24
|
-
|
|
25
|
-
2. Configure the trusted publisher (e.g., GitHub Actions)
|
|
26
|
-
3. Specify the repository and workflow that should be allowed to publish
|
|
27
|
-
4. Use the configured workflow to publish your actual package
|
|
39
|
+
## The injectable client seam
|
|
28
40
|
|
|
29
|
-
|
|
41
|
+
All Steel I/O goes through `ISteelClient`, so this package builds and unit-tests with **no network, no
|
|
42
|
+
real SDK, and no API keys**:
|
|
30
43
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
44
|
+
```ts
|
|
45
|
+
export interface ISteelClient {
|
|
46
|
+
CreateSession(opts): Promise<{ SessionId: string; CdpEndpoint: string; SessionViewerUrl: string }>;
|
|
47
|
+
ReleaseSession(sessionId: string): Promise<void>;
|
|
48
|
+
}
|
|
49
|
+
```
|
|
36
50
|
|
|
37
|
-
|
|
51
|
+
The default factory throws until you bind a real one — production must opt in explicitly:
|
|
38
52
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
- [GitHub Actions OIDC Documentation](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect)
|
|
53
|
+
```ts
|
|
54
|
+
import { SteelRemoteBrowser } from '@memberjunction/remote-browser-steel';
|
|
42
55
|
|
|
43
|
-
|
|
56
|
+
SteelRemoteBrowser.SetClientFactory((config) => new MySteelClientAdapter(config));
|
|
57
|
+
```
|
|
44
58
|
|
|
45
|
-
|
|
59
|
+
## Production binding
|
|
60
|
+
|
|
61
|
+
Bind `ISteelClient` to the official **[`steel-sdk`](https://www.npmjs.com/package/steel-sdk)**:
|
|
62
|
+
|
|
63
|
+
- `CreateSession` → `Steel.sessions.create(...)` (session id + CDP `websocketUrl` + `sessionViewerUrl`).
|
|
64
|
+
- `ReleaseSession` → `Steel.sessions.release(id)`.
|
|
65
|
+
|
|
66
|
+
Declare `steel-sdk` as an optional dependency wherever the production factory is bound — none of the SDK
|
|
67
|
+
types leak into this package.
|
|
68
|
+
|
|
69
|
+
## Install & build
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
npm install # from the repo root
|
|
73
|
+
cd packages/AI/RemoteBrowser/Providers/Steel
|
|
74
|
+
npm run build
|
|
75
|
+
npm run test
|
|
76
|
+
```
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@memberjunction/remote-browser-steel` — the Steel ([steel.dev](https://steel.dev)) backend driver for
|
|
3
|
+
* the Remote Browser channel.
|
|
4
|
+
*
|
|
5
|
+
* Exports the injectable client seam ({@link ISteelClient} + factory types) and the driver
|
|
6
|
+
* ({@link SteelRemoteBrowser}), and statically anchors the driver's `@RegisterClass` registration so
|
|
7
|
+
* bundlers cannot tree-shake it away.
|
|
8
|
+
*
|
|
9
|
+
* @module @memberjunction/remote-browser-steel
|
|
10
|
+
*/
|
|
11
|
+
export * from './steel-client.js';
|
|
12
|
+
export * from './steel-remote-browser.js';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@memberjunction/remote-browser-steel` — the Steel ([steel.dev](https://steel.dev)) backend driver for
|
|
3
|
+
* the Remote Browser channel.
|
|
4
|
+
*
|
|
5
|
+
* Exports the injectable client seam ({@link ISteelClient} + factory types) and the driver
|
|
6
|
+
* ({@link SteelRemoteBrowser}), and statically anchors the driver's `@RegisterClass` registration so
|
|
7
|
+
* bundlers cannot tree-shake it away.
|
|
8
|
+
*
|
|
9
|
+
* @module @memberjunction/remote-browser-steel
|
|
10
|
+
*/
|
|
11
|
+
export * from './steel-client.js';
|
|
12
|
+
export * from './steel-remote-browser.js';
|
|
13
|
+
import { LoadSteelRemoteBrowser } from './steel-remote-browser.js';
|
|
14
|
+
// Static reference so bundlers cannot tree-shake the
|
|
15
|
+
// @RegisterClass(BaseRemoteBrowserProvider, 'SteelRemoteBrowser') registration. Calling the no-op here
|
|
16
|
+
// keeps the driver resolvable by the engine's ClassFactory.
|
|
17
|
+
LoadSteelRemoteBrowser();
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AAEvC,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,qDAAqD;AACrD,uGAAuG;AACvG,4DAA4D;AAC5D,sBAAsB,EAAE,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The injectable **Steel service-client seam** — the minimal set of operations the
|
|
3
|
+
* {@link import('./steel-remote-browser.js').SteelRemoteBrowser} driver needs from Steel
|
|
4
|
+
* ([steel.dev](https://steel.dev)), declared as an interface so the driver builds and unit-tests against
|
|
5
|
+
* an in-memory fake with **no network, no real Steel SDK, and no API keys**.
|
|
6
|
+
*
|
|
7
|
+
* ## Production binding (at deployment)
|
|
8
|
+
* In production this interface is bound to the **`steel-sdk`** package. The named operations map to the
|
|
9
|
+
* SDK as follows:
|
|
10
|
+
* - {@link ISteelClient.CreateSession} → `Steel.sessions.create(...)`, returning the session id, its CDP
|
|
11
|
+
* connect endpoint (`websocketUrl` / `connectUrl`), and the hosted session-viewer URL
|
|
12
|
+
* (`sessionViewerUrl`).
|
|
13
|
+
* - {@link ISteelClient.ReleaseSession} → `Steel.sessions.release(id)`.
|
|
14
|
+
*
|
|
15
|
+
* Steel has **no first-party AI-control harness** — sessions are driven by MJ's own computer-use control
|
|
16
|
+
* (or OSS Stagehand-over-CDP) — so this seam intentionally has no `Act`-style operation; the driver
|
|
17
|
+
* throws `RemoteBrowserCapabilityNotSupportedError('NativeAIControl', 'Steel')` for native AI control,
|
|
18
|
+
* matching the seed row.
|
|
19
|
+
*
|
|
20
|
+
* Binding the real SDK is a thin adapter that implements this interface; the driver and its tests do not
|
|
21
|
+
* change. **None of the SDK types leak into this package** — declare `steel-sdk` as an optional
|
|
22
|
+
* dependency wherever the production factory is bound.
|
|
23
|
+
*
|
|
24
|
+
* @module @memberjunction/remote-browser-steel
|
|
25
|
+
* @author MemberJunction.com
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* The session-creation options the driver passes through to the Steel client. Deliberately a thin,
|
|
29
|
+
* opaque pass-through of the resolved provider/session configuration (region, stealth/proxy settings,
|
|
30
|
+
* persistent-context id, …) — the driver does not interpret these; the bound client does. Never carries
|
|
31
|
+
* inline secrets: credentials resolve through MJ's credential system upstream.
|
|
32
|
+
*/
|
|
33
|
+
export interface SteelCreateSessionOptions {
|
|
34
|
+
/**
|
|
35
|
+
* The opaque, backend-specific configuration to create the session with (region, proxy, stealth,
|
|
36
|
+
* persistent-context id, …). Typed as a record of unknown values rather than `any` so it stays
|
|
37
|
+
* inspectable without losing type-safety at the boundary; the bound client narrows it.
|
|
38
|
+
*/
|
|
39
|
+
Configuration?: Record<string, unknown>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The handles the seam returns after a successful {@link ISteelClient.CreateSession}.
|
|
43
|
+
*/
|
|
44
|
+
export interface SteelSessionHandles {
|
|
45
|
+
/** The Steel session id — the durable external connection id, used to release the session. */
|
|
46
|
+
SessionId: string;
|
|
47
|
+
/**
|
|
48
|
+
* The Chrome DevTools Protocol connect endpoint for the created session. The shared CDP kit attaches
|
|
49
|
+
* the computer-use adapter to this over CDP.
|
|
50
|
+
*/
|
|
51
|
+
CdpEndpoint: string;
|
|
52
|
+
/** The hosted, embeddable session-viewer URL so humans can watch (and take over) the browser. */
|
|
53
|
+
SessionViewerUrl: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* The minimal Steel service surface the {@link import('./steel-remote-browser.js').SteelRemoteBrowser} driver
|
|
57
|
+
* depends on. Production binds this to the real `steel-sdk`; tests inject a `FakeSteelClient`.
|
|
58
|
+
*/
|
|
59
|
+
export interface ISteelClient {
|
|
60
|
+
/**
|
|
61
|
+
* Creates a new Steel session and returns its id, CDP connect endpoint, and hosted session-viewer
|
|
62
|
+
* URL.
|
|
63
|
+
*
|
|
64
|
+
* @param options The session-creation options (opaque resolved configuration).
|
|
65
|
+
* @returns The created session's handles.
|
|
66
|
+
*/
|
|
67
|
+
CreateSession(options: SteelCreateSessionOptions): Promise<SteelSessionHandles>;
|
|
68
|
+
/**
|
|
69
|
+
* Releases a Steel session, freeing the backing browser. Should be idempotent / non-throwing for an
|
|
70
|
+
* already-released session so teardown is safe to run more than once.
|
|
71
|
+
*
|
|
72
|
+
* @param sessionId The Steel session id to release.
|
|
73
|
+
*/
|
|
74
|
+
ReleaseSession(sessionId: string): Promise<void>;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* A factory that constructs an {@link ISteelClient} for a session — the dependency-injection seam.
|
|
78
|
+
* Production supplies a factory that builds the real `steel-sdk` adapter from resolved config; tests
|
|
79
|
+
* supply one that returns a `FakeSteelClient`.
|
|
80
|
+
*
|
|
81
|
+
* @param config The resolved provider/session configuration (region, credential refs already resolved upstream).
|
|
82
|
+
* @returns The Steel client instance the driver creates and drives sessions with.
|
|
83
|
+
*/
|
|
84
|
+
export type SteelClientFactory = (config?: Record<string, unknown>) => ISteelClient;
|
|
85
|
+
//# sourceMappingURL=steel-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"steel-client.d.ts","sourceRoot":"","sources":["../src/steel-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH;;;;;GAKG;AACH,MAAM,WAAW,yBAAyB;IACtC;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC3C;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC,8FAA8F;IAC9F,SAAS,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB,iGAAiG;IACjG,gBAAgB,EAAE,MAAM,CAAC;CAC5B;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IACzB;;;;;;OAMG;IACH,aAAa,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAEhF;;;;;OAKG;IACH,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACpD;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,YAAY,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The injectable **Steel service-client seam** — the minimal set of operations the
|
|
3
|
+
* {@link import('./steel-remote-browser.js').SteelRemoteBrowser} driver needs from Steel
|
|
4
|
+
* ([steel.dev](https://steel.dev)), declared as an interface so the driver builds and unit-tests against
|
|
5
|
+
* an in-memory fake with **no network, no real Steel SDK, and no API keys**.
|
|
6
|
+
*
|
|
7
|
+
* ## Production binding (at deployment)
|
|
8
|
+
* In production this interface is bound to the **`steel-sdk`** package. The named operations map to the
|
|
9
|
+
* SDK as follows:
|
|
10
|
+
* - {@link ISteelClient.CreateSession} → `Steel.sessions.create(...)`, returning the session id, its CDP
|
|
11
|
+
* connect endpoint (`websocketUrl` / `connectUrl`), and the hosted session-viewer URL
|
|
12
|
+
* (`sessionViewerUrl`).
|
|
13
|
+
* - {@link ISteelClient.ReleaseSession} → `Steel.sessions.release(id)`.
|
|
14
|
+
*
|
|
15
|
+
* Steel has **no first-party AI-control harness** — sessions are driven by MJ's own computer-use control
|
|
16
|
+
* (or OSS Stagehand-over-CDP) — so this seam intentionally has no `Act`-style operation; the driver
|
|
17
|
+
* throws `RemoteBrowserCapabilityNotSupportedError('NativeAIControl', 'Steel')` for native AI control,
|
|
18
|
+
* matching the seed row.
|
|
19
|
+
*
|
|
20
|
+
* Binding the real SDK is a thin adapter that implements this interface; the driver and its tests do not
|
|
21
|
+
* change. **None of the SDK types leak into this package** — declare `steel-sdk` as an optional
|
|
22
|
+
* dependency wherever the production factory is bound.
|
|
23
|
+
*
|
|
24
|
+
* @module @memberjunction/remote-browser-steel
|
|
25
|
+
* @author MemberJunction.com
|
|
26
|
+
*/
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=steel-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"steel-client.js","sourceRoot":"","sources":["../src/steel-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview `SteelRemoteBrowser` — the Steel ([steel.dev](https://steel.dev)) backend driver for the
|
|
3
|
+
* MemberJunction Remote Browser channel. Steel is a browser-as-a-service with a CDP connect endpoint and
|
|
4
|
+
* a hosted session viewer (with human takeover), stealth, proxy egress, session recording, persistent
|
|
5
|
+
* contexts, multi-tab, downloads, and CAPTCHA solving — but **no first-party AI-control harness**.
|
|
6
|
+
*
|
|
7
|
+
* The driver is trivial by design: it subclasses {@link BaseCdpRemoteBrowserProvider} and fills in only
|
|
8
|
+
* the one backend-specific hook — {@link SteelRemoteBrowser.AcquireSession} — plus the small
|
|
9
|
+
* {@link ICdpSessionBackend} it returns. The shared CDP kit owns everything else (action translation,
|
|
10
|
+
* capability gating, screencast, human takeover, Connect/Disconnect orchestration, teardown).
|
|
11
|
+
*
|
|
12
|
+
* Because Steel has no native AI harness, the backend's `InvokeNativeAIControl` throws
|
|
13
|
+
* {@link RemoteBrowserCapabilityNotSupportedError} (the `NativeAIControl` capability is absent from the
|
|
14
|
+
* "Steel" seed row); Steel sessions are driven by MJ's own computer-use control instead.
|
|
15
|
+
*
|
|
16
|
+
* All Steel I/O goes through the injectable {@link ISteelClient} seam, so the driver builds and
|
|
17
|
+
* unit-tests with NO network, NO real Steel SDK, and NO API keys. Production binds the real `steel-sdk`
|
|
18
|
+
* via {@link SteelRemoteBrowser.SetClientFactory}.
|
|
19
|
+
*
|
|
20
|
+
* Registered via `@RegisterClass(BaseRemoteBrowserProvider, 'SteelRemoteBrowser')` — the `DriverClass`
|
|
21
|
+
* of the "Steel" provider metadata row.
|
|
22
|
+
*
|
|
23
|
+
* @module @memberjunction/remote-browser-steel
|
|
24
|
+
* @author MemberJunction.com
|
|
25
|
+
*/
|
|
26
|
+
import { RemoteBrowserProviderContext } from '@memberjunction/remote-browser-base';
|
|
27
|
+
import { AcquiredCdpSession, BaseCdpRemoteBrowserProvider } from '@memberjunction/remote-browser-cdp';
|
|
28
|
+
import { SteelClientFactory } from './steel-client.js';
|
|
29
|
+
/**
|
|
30
|
+
* The `DriverClass` identifier this driver registers under — matches the "Steel" provider metadata
|
|
31
|
+
* row's `DriverClass` so the engine's `ClassFactory` resolves it.
|
|
32
|
+
*/
|
|
33
|
+
export declare const STEEL_DRIVER_CLASS = "SteelRemoteBrowser";
|
|
34
|
+
/**
|
|
35
|
+
* The Steel backend driver. Subclasses {@link BaseCdpRemoteBrowserProvider}, implementing only the
|
|
36
|
+
* `AcquireSession` hook (and the backend it returns); all CDP control is inherited.
|
|
37
|
+
*/
|
|
38
|
+
export declare class SteelRemoteBrowser extends BaseCdpRemoteBrowserProvider {
|
|
39
|
+
/**
|
|
40
|
+
* The process-wide factory used to construct the Steel client for each session. Defaults to a
|
|
41
|
+
* factory that throws until {@link SteelRemoteBrowser.SetClientFactory} binds a real one.
|
|
42
|
+
*/
|
|
43
|
+
private static clientFactory;
|
|
44
|
+
/**
|
|
45
|
+
* Binds the {@link SteelClientFactory} every {@link SteelRemoteBrowser} instance uses to construct its
|
|
46
|
+
* Steel client. Production binds a factory that builds the real `steel-sdk` adapter; tests bind one
|
|
47
|
+
* that returns a fake. The dependency-injection seam that keeps this package free of a hard
|
|
48
|
+
* SDK/network dependency.
|
|
49
|
+
*
|
|
50
|
+
* @param factory The factory to use for subsequently-opened sessions.
|
|
51
|
+
*/
|
|
52
|
+
static SetClientFactory(factory: SteelClientFactory): void;
|
|
53
|
+
/**
|
|
54
|
+
* The Steel client for the live session, retained so the backend's `Release` can use it. `null`
|
|
55
|
+
* before {@link SteelRemoteBrowser.AcquireSession}.
|
|
56
|
+
*/
|
|
57
|
+
private client;
|
|
58
|
+
/**
|
|
59
|
+
* Acquires a CDP session from Steel: constructs the client from the bound factory, creates a session,
|
|
60
|
+
* and returns its CDP endpoint plus the {@link ICdpSessionBackend} that answers Steel's live-view /
|
|
61
|
+
* native-AI / release concerns.
|
|
62
|
+
*
|
|
63
|
+
* @param ctx The provider context (features, configuration, control mode, context user).
|
|
64
|
+
* @returns The acquired CDP endpoint + Steel-specific backend hooks.
|
|
65
|
+
*/
|
|
66
|
+
protected AcquireSession(ctx: RemoteBrowserProviderContext): Promise<AcquiredCdpSession>;
|
|
67
|
+
/**
|
|
68
|
+
* Builds the {@link ICdpSessionBackend} for a live Steel session, capturing the client, session id,
|
|
69
|
+
* and session-viewer URL the lifecycle-specific calls need. `InvokeNativeAIControl` always throws —
|
|
70
|
+
* Steel has no first-party AI harness.
|
|
71
|
+
*
|
|
72
|
+
* @param client The Steel client driving this session.
|
|
73
|
+
* @param sessionId The Steel session id.
|
|
74
|
+
* @param sessionViewerUrl The hosted session-viewer URL for the session.
|
|
75
|
+
* @returns The backend hooks the shared session delegates its backend-specific concerns to.
|
|
76
|
+
*/
|
|
77
|
+
private buildBackend;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Tree-shaking-prevention loader. Modern bundlers cannot see the `@RegisterClass` dynamic registration,
|
|
81
|
+
* so a static reference to this no-op (called from `index.ts`) keeps the driver resolvable by the
|
|
82
|
+
* engine's `ClassFactory`.
|
|
83
|
+
*/
|
|
84
|
+
export declare function LoadSteelRemoteBrowser(): void;
|
|
85
|
+
//# sourceMappingURL=steel-remote-browser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"steel-remote-browser.d.ts","sourceRoot":"","sources":["../src/steel-remote-browser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAGH,OAAO,EAIH,4BAA4B,EAC/B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACH,kBAAkB,EAClB,4BAA4B,EAE/B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAEH,kBAAkB,EACrB,MAAM,gBAAgB,CAAC;AAExB;;;GAGG;AACH,eAAO,MAAM,kBAAkB,uBAAuB,CAAC;AAmBvD;;;GAGG;AACH,qBACa,kBAAmB,SAAQ,4BAA4B;IAChE;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,aAAa,CAA4C;IAExE;;;;;;;OAOG;WACW,gBAAgB,CAAC,OAAO,EAAE,kBAAkB,GAAG,IAAI;IAIjE;;;OAGG;IACH,OAAO,CAAC,MAAM,CAA6B;IAE3C;;;;;;;OAOG;cACa,cAAc,CAAC,GAAG,EAAE,4BAA4B,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAY9F;;;;;;;;;OASG;IACH,OAAO,CAAC,YAAY;CAgBvB;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,IAAI,IAAI,CAE7C"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview `SteelRemoteBrowser` — the Steel ([steel.dev](https://steel.dev)) backend driver for the
|
|
3
|
+
* MemberJunction Remote Browser channel. Steel is a browser-as-a-service with a CDP connect endpoint and
|
|
4
|
+
* a hosted session viewer (with human takeover), stealth, proxy egress, session recording, persistent
|
|
5
|
+
* contexts, multi-tab, downloads, and CAPTCHA solving — but **no first-party AI-control harness**.
|
|
6
|
+
*
|
|
7
|
+
* The driver is trivial by design: it subclasses {@link BaseCdpRemoteBrowserProvider} and fills in only
|
|
8
|
+
* the one backend-specific hook — {@link SteelRemoteBrowser.AcquireSession} — plus the small
|
|
9
|
+
* {@link ICdpSessionBackend} it returns. The shared CDP kit owns everything else (action translation,
|
|
10
|
+
* capability gating, screencast, human takeover, Connect/Disconnect orchestration, teardown).
|
|
11
|
+
*
|
|
12
|
+
* Because Steel has no native AI harness, the backend's `InvokeNativeAIControl` throws
|
|
13
|
+
* {@link RemoteBrowserCapabilityNotSupportedError} (the `NativeAIControl` capability is absent from the
|
|
14
|
+
* "Steel" seed row); Steel sessions are driven by MJ's own computer-use control instead.
|
|
15
|
+
*
|
|
16
|
+
* All Steel I/O goes through the injectable {@link ISteelClient} seam, so the driver builds and
|
|
17
|
+
* unit-tests with NO network, NO real Steel SDK, and NO API keys. Production binds the real `steel-sdk`
|
|
18
|
+
* via {@link SteelRemoteBrowser.SetClientFactory}.
|
|
19
|
+
*
|
|
20
|
+
* Registered via `@RegisterClass(BaseRemoteBrowserProvider, 'SteelRemoteBrowser')` — the `DriverClass`
|
|
21
|
+
* of the "Steel" provider metadata row.
|
|
22
|
+
*
|
|
23
|
+
* @module @memberjunction/remote-browser-steel
|
|
24
|
+
* @author MemberJunction.com
|
|
25
|
+
*/
|
|
26
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
27
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
28
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
29
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
30
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
31
|
+
};
|
|
32
|
+
var SteelRemoteBrowser_1;
|
|
33
|
+
import { RegisterClass } from '@memberjunction/global';
|
|
34
|
+
import { BaseRemoteBrowserProvider, RemoteBrowserCapabilityNotSupportedError, } from '@memberjunction/remote-browser-base';
|
|
35
|
+
import { BaseCdpRemoteBrowserProvider, } from '@memberjunction/remote-browser-cdp';
|
|
36
|
+
/**
|
|
37
|
+
* The `DriverClass` identifier this driver registers under — matches the "Steel" provider metadata
|
|
38
|
+
* row's `DriverClass` so the engine's `ClassFactory` resolves it.
|
|
39
|
+
*/
|
|
40
|
+
export const STEEL_DRIVER_CLASS = 'SteelRemoteBrowser';
|
|
41
|
+
/** The backend display name used in capability-error messages for this driver. */
|
|
42
|
+
const STEEL_PROVIDER_NAME = 'Steel';
|
|
43
|
+
/**
|
|
44
|
+
* The default {@link SteelClientFactory}: refuses to run until a real factory is bound via
|
|
45
|
+
* {@link SteelRemoteBrowser.SetClientFactory}. This keeps the package free of any real SDK / network
|
|
46
|
+
* dependency — production must explicitly bind `steel-sdk`, and tests bind a fake.
|
|
47
|
+
*
|
|
48
|
+
* @throws {Error} always — instructing the caller to bind a real client factory.
|
|
49
|
+
*/
|
|
50
|
+
const defaultClientFactory = () => {
|
|
51
|
+
throw new Error('SteelRemoteBrowser has no Steel client bound. Call SteelRemoteBrowser.SetClientFactory(...) ' +
|
|
52
|
+
'to bind the real Steel client (steel-sdk) before opening a session.');
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* The Steel backend driver. Subclasses {@link BaseCdpRemoteBrowserProvider}, implementing only the
|
|
56
|
+
* `AcquireSession` hook (and the backend it returns); all CDP control is inherited.
|
|
57
|
+
*/
|
|
58
|
+
let SteelRemoteBrowser = class SteelRemoteBrowser extends BaseCdpRemoteBrowserProvider {
|
|
59
|
+
constructor() {
|
|
60
|
+
super(...arguments);
|
|
61
|
+
/**
|
|
62
|
+
* The Steel client for the live session, retained so the backend's `Release` can use it. `null`
|
|
63
|
+
* before {@link SteelRemoteBrowser.AcquireSession}.
|
|
64
|
+
*/
|
|
65
|
+
this.client = null;
|
|
66
|
+
}
|
|
67
|
+
static { SteelRemoteBrowser_1 = this; }
|
|
68
|
+
/**
|
|
69
|
+
* The process-wide factory used to construct the Steel client for each session. Defaults to a
|
|
70
|
+
* factory that throws until {@link SteelRemoteBrowser.SetClientFactory} binds a real one.
|
|
71
|
+
*/
|
|
72
|
+
static { this.clientFactory = defaultClientFactory; }
|
|
73
|
+
/**
|
|
74
|
+
* Binds the {@link SteelClientFactory} every {@link SteelRemoteBrowser} instance uses to construct its
|
|
75
|
+
* Steel client. Production binds a factory that builds the real `steel-sdk` adapter; tests bind one
|
|
76
|
+
* that returns a fake. The dependency-injection seam that keeps this package free of a hard
|
|
77
|
+
* SDK/network dependency.
|
|
78
|
+
*
|
|
79
|
+
* @param factory The factory to use for subsequently-opened sessions.
|
|
80
|
+
*/
|
|
81
|
+
static SetClientFactory(factory) {
|
|
82
|
+
SteelRemoteBrowser_1.clientFactory = factory;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Acquires a CDP session from Steel: constructs the client from the bound factory, creates a session,
|
|
86
|
+
* and returns its CDP endpoint plus the {@link ICdpSessionBackend} that answers Steel's live-view /
|
|
87
|
+
* native-AI / release concerns.
|
|
88
|
+
*
|
|
89
|
+
* @param ctx The provider context (features, configuration, control mode, context user).
|
|
90
|
+
* @returns The acquired CDP endpoint + Steel-specific backend hooks.
|
|
91
|
+
*/
|
|
92
|
+
async AcquireSession(ctx) {
|
|
93
|
+
const client = SteelRemoteBrowser_1.clientFactory(ctx.Configuration);
|
|
94
|
+
this.client = client;
|
|
95
|
+
const handles = await client.CreateSession({ Configuration: ctx.Configuration });
|
|
96
|
+
return {
|
|
97
|
+
CdpEndpoint: handles.CdpEndpoint,
|
|
98
|
+
Backend: this.buildBackend(client, handles.SessionId, handles.SessionViewerUrl),
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Builds the {@link ICdpSessionBackend} for a live Steel session, capturing the client, session id,
|
|
103
|
+
* and session-viewer URL the lifecycle-specific calls need. `InvokeNativeAIControl` always throws —
|
|
104
|
+
* Steel has no first-party AI harness.
|
|
105
|
+
*
|
|
106
|
+
* @param client The Steel client driving this session.
|
|
107
|
+
* @param sessionId The Steel session id.
|
|
108
|
+
* @param sessionViewerUrl The hosted session-viewer URL for the session.
|
|
109
|
+
* @returns The backend hooks the shared session delegates its backend-specific concerns to.
|
|
110
|
+
*/
|
|
111
|
+
buildBackend(client, sessionId, sessionViewerUrl) {
|
|
112
|
+
return {
|
|
113
|
+
GetLiveViewUrl: async () => sessionViewerUrl,
|
|
114
|
+
InvokeNativeAIControl: () => {
|
|
115
|
+
throw new RemoteBrowserCapabilityNotSupportedError('NativeAIControl', STEEL_PROVIDER_NAME);
|
|
116
|
+
},
|
|
117
|
+
Release: async () => {
|
|
118
|
+
await client.ReleaseSession(sessionId);
|
|
119
|
+
this.client = null;
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
SteelRemoteBrowser = SteelRemoteBrowser_1 = __decorate([
|
|
125
|
+
RegisterClass(BaseRemoteBrowserProvider, STEEL_DRIVER_CLASS)
|
|
126
|
+
], SteelRemoteBrowser);
|
|
127
|
+
export { SteelRemoteBrowser };
|
|
128
|
+
/**
|
|
129
|
+
* Tree-shaking-prevention loader. Modern bundlers cannot see the `@RegisterClass` dynamic registration,
|
|
130
|
+
* so a static reference to this no-op (called from `index.ts`) keeps the driver resolvable by the
|
|
131
|
+
* engine's `ClassFactory`.
|
|
132
|
+
*/
|
|
133
|
+
export function LoadSteelRemoteBrowser() {
|
|
134
|
+
// Intentionally empty — exists only to anchor a static import of this module.
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=steel-remote-browser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"steel-remote-browser.js","sourceRoot":"","sources":["../src/steel-remote-browser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;;;;;;;;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EACH,yBAAyB,EAEzB,wCAAwC,GAE3C,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAEH,4BAA4B,GAE/B,MAAM,oCAAoC,CAAC;AAM5C;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,oBAAoB,CAAC;AAEvD,kFAAkF;AAClF,MAAM,mBAAmB,GAAG,OAAO,CAAC;AAEpC;;;;;;GAMG;AACH,MAAM,oBAAoB,GAAuB,GAAG,EAAE;IAClD,MAAM,IAAI,KAAK,CACX,8FAA8F;QAC1F,qEAAqE,CAC5E,CAAC;AACN,CAAC,CAAC;AAEF;;;GAGG;AAEI,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,4BAA4B;IAA7D;;QAmBH;;;WAGG;QACK,WAAM,GAAwB,IAAI,CAAC;IAgD/C,CAAC;;IAtEG;;;OAGG;aACY,kBAAa,GAAuB,oBAAoB,AAA3C,CAA4C;IAExE;;;;;;;OAOG;IACI,MAAM,CAAC,gBAAgB,CAAC,OAA2B;QACtD,oBAAkB,CAAC,aAAa,GAAG,OAAO,CAAC;IAC/C,CAAC;IAQD;;;;;;;OAOG;IACO,KAAK,CAAC,cAAc,CAAC,GAAiC;QAC5D,MAAM,MAAM,GAAG,oBAAkB,CAAC,aAAa,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QACnE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,EAAE,aAAa,EAAE,GAAG,CAAC,aAAa,EAAE,CAAC,CAAC;QAEjF,OAAO;YACH,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,gBAAgB,CAAC;SAClF,CAAC;IACN,CAAC;IAED;;;;;;;;;OASG;IACK,YAAY,CAChB,MAAoB,EACpB,SAAiB,EACjB,gBAAwB;QAExB,OAAO;YACH,cAAc,EAAE,KAAK,IAAqB,EAAE,CAAC,gBAAgB;YAC7D,qBAAqB,EAAE,GAAuC,EAAE;gBAC5D,MAAM,IAAI,wCAAwC,CAAC,iBAAiB,EAAE,mBAAmB,CAAC,CAAC;YAC/F,CAAC;YACD,OAAO,EAAE,KAAK,IAAmB,EAAE;gBAC/B,MAAM,MAAM,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;gBACvC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;YACvB,CAAC;SACJ,CAAC;IACN,CAAC;;AAtEQ,kBAAkB;IAD9B,aAAa,CAAC,yBAAyB,EAAE,kBAAkB,CAAC;GAChD,kBAAkB,CAuE9B;;AAED;;;;GAIG;AACH,MAAM,UAAU,sBAAsB;IAClC,8EAA8E;AAClF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/remote-browser-steel",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "5.41.0",
|
|
5
|
+
"description": "MemberJunction: Steel (steel.dev) backend driver for the Remote Browser channel. Acquires a CDP session from Steel via an injectable client seam and exposes its hosted session-viewer URL. Steel has no first-party AI harness, so native AI control is unsupported (driven by MJ computer-use instead). Everything else is inherited from @memberjunction/remote-browser-cdp.",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"/dist"
|
|
10
|
+
],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"start": "ts-node-dev src/index.ts",
|
|
13
|
+
"build": "tsc && tsc-alias -f",
|
|
14
|
+
"test": "vitest run",
|
|
15
|
+
"test:watch": "vitest"
|
|
16
|
+
},
|
|
17
|
+
"author": "MemberJunction.com",
|
|
18
|
+
"license": "ISC",
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@memberjunction/core": "5.41.0",
|
|
21
|
+
"@memberjunction/global": "5.41.0",
|
|
22
|
+
"@memberjunction/remote-browser-base": "5.41.0",
|
|
23
|
+
"@memberjunction/remote-browser-cdp": "5.41.0"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@types/node": "24.10.11",
|
|
27
|
+
"ts-node-dev": "^2.0.0",
|
|
28
|
+
"typescript": "^5.9.3",
|
|
29
|
+
"vitest": "^4.0.18"
|
|
30
|
+
},
|
|
31
|
+
"repository": {
|
|
32
|
+
"type": "git",
|
|
33
|
+
"url": "https://github.com/MemberJunction/MJ"
|
|
34
|
+
}
|
|
10
35
|
}
|