@memberjunction/remote-browser-base 0.0.1 → 5.42.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 +160 -43
- package/dist/base-remote-browser-provider.d.ts +149 -0
- package/dist/base-remote-browser-provider.d.ts.map +1 -0
- package/dist/base-remote-browser-provider.js +95 -0
- package/dist/base-remote-browser-provider.js.map +1 -0
- package/dist/capability-errors.d.ts +47 -0
- package/dist/capability-errors.d.ts.map +1 -0
- package/dist/capability-errors.js +44 -0
- package/dist/capability-errors.js.map +1 -0
- package/dist/control.d.ts +69 -0
- package/dist/control.d.ts.map +1 -0
- package/dist/control.js +52 -0
- package/dist/control.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/remote-browser-engine-base.d.ts +76 -0
- package/dist/remote-browser-engine-base.d.ts.map +1 -0
- package/dist/remote-browser-engine-base.js +116 -0
- package/dist/remote-browser-engine-base.js.map +1 -0
- package/dist/remote-browser-features.d.ts +46 -0
- package/dist/remote-browser-features.d.ts.map +1 -0
- package/dist/remote-browser-features.js +37 -0
- package/dist/remote-browser-features.js.map +1 -0
- package/dist/remote-browser-session.d.ts +488 -0
- package/dist/remote-browser-session.d.ts.map +1 -0
- package/dist/remote-browser-session.js +15 -0
- package/dist/remote-browser-session.js.map +1 -0
- package/package.json +32 -7
package/dist/control.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Determines whether a {@link RemoteBrowserControlMode} is valid given a backend's capabilities.
|
|
3
|
+
*
|
|
4
|
+
* A mode is only valid when the backend supports the capabilities it requires:
|
|
5
|
+
* - `AgentOnly` — always valid (the agent drives; no viewing/takeover prerequisite).
|
|
6
|
+
* - `ViewOnly` — requires `LiveView` (humans must be able to watch).
|
|
7
|
+
* - `Collaborative` — requires `LiveView` **and** `HumanTakeover` (humans watch *and* can take over).
|
|
8
|
+
*
|
|
9
|
+
* @param mode The control mode to validate.
|
|
10
|
+
* @param features The backend's capability flags.
|
|
11
|
+
* @returns `true` when the backend can support the mode, `false` otherwise.
|
|
12
|
+
*/
|
|
13
|
+
export function isControlModeSupported(mode, features) {
|
|
14
|
+
switch (mode) {
|
|
15
|
+
case 'AgentOnly':
|
|
16
|
+
return true;
|
|
17
|
+
case 'ViewOnly':
|
|
18
|
+
return features.LiveView === true;
|
|
19
|
+
case 'Collaborative':
|
|
20
|
+
return features.LiveView === true && features.HumanTakeover === true;
|
|
21
|
+
default:
|
|
22
|
+
// Exhaustive — `mode` is `never` here; any unhandled member is a compile error above.
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Resolves which {@link RemoteBrowserControlStrategy} the engine should use for a backend, honoring an
|
|
28
|
+
* optional caller preference.
|
|
29
|
+
*
|
|
30
|
+
* **Precedence (highest to lowest):**
|
|
31
|
+
* 1. **`NativeAI`** — chosen *only* when the backend advertises `NativeAIControl` **and** the caller
|
|
32
|
+
* did not explicitly pin `ComputerUse`. (A caller preference of `'NativeAI'` is honored only if the
|
|
33
|
+
* backend actually supports it; an explicit `'ComputerUse'` always suppresses native delegation.)
|
|
34
|
+
* 2. **`ComputerUse`** — the universal default, chosen whenever the backend exposes the
|
|
35
|
+
* `RawCdpControl` substrate and native control was not selected above.
|
|
36
|
+
* 3. **`ComputerUse`** — also the fallback when neither flag is set, because CDP-connect is the one
|
|
37
|
+
* primitive every backend is expected to provide; emitting `ComputerUse` lets the caller surface a
|
|
38
|
+
* clear downstream error if the backend genuinely cannot be driven, rather than this helper
|
|
39
|
+
* inventing an unsupported strategy.
|
|
40
|
+
*
|
|
41
|
+
* @param features The backend's capability flags.
|
|
42
|
+
* @param preferred An optional caller preference; `'ComputerUse'` pins the universal loop and
|
|
43
|
+
* suppresses native delegation even when the backend supports it.
|
|
44
|
+
* @returns The resolved control strategy.
|
|
45
|
+
*/
|
|
46
|
+
export function resolveControlStrategy(features, preferred) {
|
|
47
|
+
if (features.NativeAIControl === true && preferred !== 'ComputerUse') {
|
|
48
|
+
return 'NativeAI';
|
|
49
|
+
}
|
|
50
|
+
return 'ComputerUse';
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=control.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"control.js","sourceRoot":"","sources":["../src/control.ts"],"names":[],"mappings":"AAqCA;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,sBAAsB,CAClC,IAA8B,EAC9B,QAAwC;IAExC,QAAQ,IAAI,EAAE,CAAC;QACX,KAAK,WAAW;YACZ,OAAO,IAAI,CAAC;QAChB,KAAK,UAAU;YACX,OAAO,QAAQ,CAAC,QAAQ,KAAK,IAAI,CAAC;QACtC,KAAK,eAAe;YAChB,OAAO,QAAQ,CAAC,QAAQ,KAAK,IAAI,IAAI,QAAQ,CAAC,aAAa,KAAK,IAAI,CAAC;QACzE;YACI,sFAAsF;YACtF,OAAO,KAAK,CAAC;IACrB,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,sBAAsB,CAClC,QAAwC,EACxC,SAAwC;IAExC,IAAI,QAAQ,CAAC,eAAe,KAAK,IAAI,IAAI,SAAS,KAAK,aAAa,EAAE,CAAC;QACnE,OAAO,UAAU,CAAC;IACtB,CAAC;IACD,OAAO,aAAa,CAAC;AACzB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './capability-errors.js';
|
|
2
|
+
export * from './remote-browser-features.js';
|
|
3
|
+
export * from './control.js';
|
|
4
|
+
export * from './remote-browser-session.js';
|
|
5
|
+
export * from './base-remote-browser-provider.js';
|
|
6
|
+
export * from './remote-browser-engine-base.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,WAAW,CAAC;AAC1B,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './capability-errors.js';
|
|
2
|
+
export * from './remote-browser-features.js';
|
|
3
|
+
export * from './control.js';
|
|
4
|
+
export * from './remote-browser-session.js';
|
|
5
|
+
export * from './base-remote-browser-provider.js';
|
|
6
|
+
export * from './remote-browser-engine-base.js';
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,WAAW,CAAC;AAC1B,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { BaseEngine, IMetadataProvider, UserInfo } from '@memberjunction/core';
|
|
2
|
+
import { MJAIRemoteBrowserProviderEntity } from '@memberjunction/core-entities';
|
|
3
|
+
import { IRemoteBrowserProviderFeatures } from './remote-browser-features.js';
|
|
4
|
+
/**
|
|
5
|
+
* Cross-platform, **metadata-only** engine for the Remote Browser plane.
|
|
6
|
+
*
|
|
7
|
+
* `RemoteBrowserEngineBase` mirrors `AIBridgeEngineBase` (and `AIEngineBase`) exactly: it is a
|
|
8
|
+
* {@link BaseEngine} subclass that caches the remote-browser provider registry rows (backends + their
|
|
9
|
+
* capability flags) and exposes synchronous resolution helpers over them. It performs **no
|
|
10
|
+
* execution** — live browser sessions, control arbitration, and the viewport→screen-track encode all
|
|
11
|
+
* live in `RemoteBrowserEngine` (the server package) which *composes over* this base. Keeping the
|
|
12
|
+
* metadata layer free of execution lets it be used anywhere (client or server) and stay reactive via
|
|
13
|
+
* the inherited {@link BaseEngine} event integration.
|
|
14
|
+
*
|
|
15
|
+
* Because the cached dataset is a small reference table, all lookups filter the in-memory array
|
|
16
|
+
* client-side rather than issuing RunViews.
|
|
17
|
+
*
|
|
18
|
+
* @see `/plans/realtime/realtime-bridges-architecture.md` §4d-i — the
|
|
19
|
+
* `RemoteBrowserEngineBase` / `RemoteBrowserEngine` pair.
|
|
20
|
+
*/
|
|
21
|
+
export declare class RemoteBrowserEngineBase extends BaseEngine<RemoteBrowserEngineBase> {
|
|
22
|
+
private _providers;
|
|
23
|
+
/**
|
|
24
|
+
* Loads (or refreshes) the remote-browser metadata cache.
|
|
25
|
+
*
|
|
26
|
+
* Registers the provider registry as locally-cached and delegates to the inherited
|
|
27
|
+
* {@link BaseEngine.Load}, which wires up event-driven invalidation so the cache stays fresh as
|
|
28
|
+
* rows change. Idempotent — a no-op when already loaded unless `forceRefresh` is set.
|
|
29
|
+
*
|
|
30
|
+
* @param forceRefresh When `true`, reloads even if already loaded.
|
|
31
|
+
* @param contextUser Required on the server side for proper data isolation.
|
|
32
|
+
* @param provider Optional explicit metadata provider (multi-provider scenarios); defaults to the engine's provider.
|
|
33
|
+
* @returns A promise that resolves once the cache is populated.
|
|
34
|
+
*/
|
|
35
|
+
Config(forceRefresh?: boolean, contextUser?: UserInfo, provider?: IMetadataProvider): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* All cached `MJ: AI Remote Browser Providers` rows (the backend registry + capability flags).
|
|
38
|
+
*/
|
|
39
|
+
get Providers(): MJAIRemoteBrowserProviderEntity[];
|
|
40
|
+
/**
|
|
41
|
+
* Resolves a backend by its display name, case-insensitively and trim-tolerant.
|
|
42
|
+
*
|
|
43
|
+
* @param name The backend name (e.g. `'Browserbase'`, `'Self-Hosted Chrome'`).
|
|
44
|
+
* @returns The matching provider row, or `undefined` if none matches.
|
|
45
|
+
*/
|
|
46
|
+
ProviderByName(name: string): MJAIRemoteBrowserProviderEntity | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* Resolves a backend by its `DriverClass` (the `ClassFactory` key used to instantiate the concrete
|
|
49
|
+
* provider driver via `MJGlobal.ClassFactory.CreateInstance(BaseRemoteBrowserProvider, driverClass)`),
|
|
50
|
+
* case-insensitively and trim-tolerant.
|
|
51
|
+
*
|
|
52
|
+
* @param driverClass The driver class key (e.g. `'BrowserbaseRemoteBrowser'`).
|
|
53
|
+
* @returns The matching provider row, or `undefined` if none matches.
|
|
54
|
+
*/
|
|
55
|
+
ProviderByDriverClass(driverClass: string): MJAIRemoteBrowserProviderEntity | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Returns the backends currently available for use (those with `Status === 'Active'`). Disabled
|
|
58
|
+
* backends cannot start new remote-browser sessions and are excluded.
|
|
59
|
+
*
|
|
60
|
+
* @returns The active provider rows.
|
|
61
|
+
*/
|
|
62
|
+
ActiveProviders(): MJAIRemoteBrowserProviderEntity[];
|
|
63
|
+
/**
|
|
64
|
+
* Null-safely reads a backend's typed capability flags from its `SupportedFeaturesObject`
|
|
65
|
+
* accessor, substituting an empty (all-unsupported) set when none are declared.
|
|
66
|
+
*
|
|
67
|
+
* @param provider The provider row to read.
|
|
68
|
+
* @returns The backend's capability flags, or an empty object when none are declared.
|
|
69
|
+
*/
|
|
70
|
+
FeaturesFor(provider: MJAIRemoteBrowserProviderEntity): IRemoteBrowserProviderFeatures;
|
|
71
|
+
/**
|
|
72
|
+
* The singleton accessor (via {@link BaseEngine}'s global object store).
|
|
73
|
+
*/
|
|
74
|
+
static get Instance(): RemoteBrowserEngineBase;
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=remote-browser-engine-base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote-browser-engine-base.d.ts","sourceRoot":"","sources":["../src/remote-browser-engine-base.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,UAAU,EAEV,iBAAiB,EAEjB,QAAQ,EACX,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,+BAA+B,EAAE,MAAM,+BAA+B,CAAC;AAChF,OAAO,EAAE,8BAA8B,EAAE,MAAM,2BAA2B,CAAC;AAE3E;;;;;;;;;;;;;;;;GAgBG;AACH,qBACa,uBAAwB,SAAQ,UAAU,CAAC,uBAAuB,CAAC;IAC5E,OAAO,CAAC,UAAU,CAAyC;IAE3D;;;;;;;;;;;OAWG;IACU,MAAM,CACf,YAAY,CAAC,EAAE,OAAO,EACtB,WAAW,CAAC,EAAE,QAAQ,EACtB,QAAQ,CAAC,EAAE,iBAAiB,GAC7B,OAAO,CAAC,IAAI,CAAC;IAWhB;;OAEG;IACH,IAAW,SAAS,IAAI,+BAA+B,EAAE,CAExD;IAED;;;;;OAKG;IACI,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,+BAA+B,GAAG,SAAS;IAQhF;;;;;;;OAOG;IACI,qBAAqB,CAAC,WAAW,EAAE,MAAM,GAAG,+BAA+B,GAAG,SAAS;IAQ9F;;;;;OAKG;IACI,eAAe,IAAI,+BAA+B,EAAE;IAI3D;;;;;;OAMG;IACI,WAAW,CACd,QAAQ,EAAE,+BAA+B,GAC1C,8BAA8B;IAIjC;;OAEG;IACH,WAAkB,QAAQ,IAAI,uBAAuB,CAEpD;CACJ"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
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;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { BaseEngine, RegisterForStartup, } from '@memberjunction/core';
|
|
8
|
+
/**
|
|
9
|
+
* Cross-platform, **metadata-only** engine for the Remote Browser plane.
|
|
10
|
+
*
|
|
11
|
+
* `RemoteBrowserEngineBase` mirrors `AIBridgeEngineBase` (and `AIEngineBase`) exactly: it is a
|
|
12
|
+
* {@link BaseEngine} subclass that caches the remote-browser provider registry rows (backends + their
|
|
13
|
+
* capability flags) and exposes synchronous resolution helpers over them. It performs **no
|
|
14
|
+
* execution** — live browser sessions, control arbitration, and the viewport→screen-track encode all
|
|
15
|
+
* live in `RemoteBrowserEngine` (the server package) which *composes over* this base. Keeping the
|
|
16
|
+
* metadata layer free of execution lets it be used anywhere (client or server) and stay reactive via
|
|
17
|
+
* the inherited {@link BaseEngine} event integration.
|
|
18
|
+
*
|
|
19
|
+
* Because the cached dataset is a small reference table, all lookups filter the in-memory array
|
|
20
|
+
* client-side rather than issuing RunViews.
|
|
21
|
+
*
|
|
22
|
+
* @see `/plans/realtime/realtime-bridges-architecture.md` §4d-i — the
|
|
23
|
+
* `RemoteBrowserEngineBase` / `RemoteBrowserEngine` pair.
|
|
24
|
+
*/
|
|
25
|
+
let RemoteBrowserEngineBase = class RemoteBrowserEngineBase extends BaseEngine {
|
|
26
|
+
constructor() {
|
|
27
|
+
super(...arguments);
|
|
28
|
+
this._providers = [];
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Loads (or refreshes) the remote-browser metadata cache.
|
|
32
|
+
*
|
|
33
|
+
* Registers the provider registry as locally-cached and delegates to the inherited
|
|
34
|
+
* {@link BaseEngine.Load}, which wires up event-driven invalidation so the cache stays fresh as
|
|
35
|
+
* rows change. Idempotent — a no-op when already loaded unless `forceRefresh` is set.
|
|
36
|
+
*
|
|
37
|
+
* @param forceRefresh When `true`, reloads even if already loaded.
|
|
38
|
+
* @param contextUser Required on the server side for proper data isolation.
|
|
39
|
+
* @param provider Optional explicit metadata provider (multi-provider scenarios); defaults to the engine's provider.
|
|
40
|
+
* @returns A promise that resolves once the cache is populated.
|
|
41
|
+
*/
|
|
42
|
+
async Config(forceRefresh, contextUser, provider) {
|
|
43
|
+
const params = [
|
|
44
|
+
{
|
|
45
|
+
PropertyName: '_providers',
|
|
46
|
+
EntityName: 'MJ: AI Remote Browser Providers',
|
|
47
|
+
CacheLocal: true,
|
|
48
|
+
},
|
|
49
|
+
];
|
|
50
|
+
return await this.Load(params, provider, forceRefresh, contextUser);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* All cached `MJ: AI Remote Browser Providers` rows (the backend registry + capability flags).
|
|
54
|
+
*/
|
|
55
|
+
get Providers() {
|
|
56
|
+
return this._providers;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Resolves a backend by its display name, case-insensitively and trim-tolerant.
|
|
60
|
+
*
|
|
61
|
+
* @param name The backend name (e.g. `'Browserbase'`, `'Self-Hosted Chrome'`).
|
|
62
|
+
* @returns The matching provider row, or `undefined` if none matches.
|
|
63
|
+
*/
|
|
64
|
+
ProviderByName(name) {
|
|
65
|
+
const target = (name ?? '').trim().toLowerCase();
|
|
66
|
+
if (target.length === 0) {
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
return this._providers.find(p => (p.Name ?? '').trim().toLowerCase() === target);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Resolves a backend by its `DriverClass` (the `ClassFactory` key used to instantiate the concrete
|
|
73
|
+
* provider driver via `MJGlobal.ClassFactory.CreateInstance(BaseRemoteBrowserProvider, driverClass)`),
|
|
74
|
+
* case-insensitively and trim-tolerant.
|
|
75
|
+
*
|
|
76
|
+
* @param driverClass The driver class key (e.g. `'BrowserbaseRemoteBrowser'`).
|
|
77
|
+
* @returns The matching provider row, or `undefined` if none matches.
|
|
78
|
+
*/
|
|
79
|
+
ProviderByDriverClass(driverClass) {
|
|
80
|
+
const target = (driverClass ?? '').trim().toLowerCase();
|
|
81
|
+
if (target.length === 0) {
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
return this._providers.find(p => (p.DriverClass ?? '').trim().toLowerCase() === target);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Returns the backends currently available for use (those with `Status === 'Active'`). Disabled
|
|
88
|
+
* backends cannot start new remote-browser sessions and are excluded.
|
|
89
|
+
*
|
|
90
|
+
* @returns The active provider rows.
|
|
91
|
+
*/
|
|
92
|
+
ActiveProviders() {
|
|
93
|
+
return this._providers.filter(p => p.Status === 'Active');
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Null-safely reads a backend's typed capability flags from its `SupportedFeaturesObject`
|
|
97
|
+
* accessor, substituting an empty (all-unsupported) set when none are declared.
|
|
98
|
+
*
|
|
99
|
+
* @param provider The provider row to read.
|
|
100
|
+
* @returns The backend's capability flags, or an empty object when none are declared.
|
|
101
|
+
*/
|
|
102
|
+
FeaturesFor(provider) {
|
|
103
|
+
return provider.SupportedFeaturesObject ?? {};
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* The singleton accessor (via {@link BaseEngine}'s global object store).
|
|
107
|
+
*/
|
|
108
|
+
static get Instance() {
|
|
109
|
+
return super.getInstance();
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
RemoteBrowserEngineBase = __decorate([
|
|
113
|
+
RegisterForStartup()
|
|
114
|
+
], RemoteBrowserEngineBase);
|
|
115
|
+
export { RemoteBrowserEngineBase };
|
|
116
|
+
//# sourceMappingURL=remote-browser-engine-base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote-browser-engine-base.js","sourceRoot":"","sources":["../src/remote-browser-engine-base.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACH,UAAU,EAGV,kBAAkB,GAErB,MAAM,sBAAsB,CAAC;AAI9B;;;;;;;;;;;;;;;;GAgBG;AAEI,IAAM,uBAAuB,GAA7B,MAAM,uBAAwB,SAAQ,UAAmC;IAAzE;;QACK,eAAU,GAAsC,EAAE,CAAC;IA+F/D,CAAC;IA7FG;;;;;;;;;;;OAWG;IACI,KAAK,CAAC,MAAM,CACf,YAAsB,EACtB,WAAsB,EACtB,QAA4B;QAE5B,MAAM,MAAM,GAA6C;YACrD;gBACI,YAAY,EAAE,YAAY;gBAC1B,UAAU,EAAE,iCAAiC;gBAC7C,UAAU,EAAE,IAAI;aACnB;SACJ,CAAC;QACF,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,WAAW,CAAC,CAAC;IACxE,CAAC;IAED;;OAEG;IACH,IAAW,SAAS;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAED;;;;;OAKG;IACI,cAAc,CAAC,IAAY;QAC9B,MAAM,MAAM,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QACjD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACtB,OAAO,SAAS,CAAC;QACrB,CAAC;QACD,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,MAAM,CAAC,CAAC;IACrF,CAAC;IAED;;;;;;;OAOG;IACI,qBAAqB,CAAC,WAAmB;QAC5C,MAAM,MAAM,GAAG,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QACxD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACtB,OAAO,SAAS,CAAC;QACrB,CAAC;QACD,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,MAAM,CAAC,CAAC;IAC5F,CAAC;IAED;;;;;OAKG;IACI,eAAe;QAClB,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC;IAC9D,CAAC;IAED;;;;;;OAMG;IACI,WAAW,CACd,QAAyC;QAEzC,OAAO,QAAQ,CAAC,uBAAuB,IAAI,EAAE,CAAC;IAClD,CAAC;IAED;;OAEG;IACI,MAAM,KAAK,QAAQ;QACtB,OAAO,KAAK,CAAC,WAAW,EAA2B,CAAC;IACxD,CAAC;CACJ,CAAA;AAhGY,uBAAuB;IADnC,kBAAkB,EAAE;GACR,uBAAuB,CAgGnC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { MJAIRemoteBrowserProviderEntity, MJAIRemoteBrowserProviderEntity_IRemoteBrowserProviderFeatures } from '@memberjunction/core-entities';
|
|
2
|
+
/**
|
|
3
|
+
* Strongly-typed shape of a remote-browser backend's `SupportedFeatures` JSON.
|
|
4
|
+
*
|
|
5
|
+
* This is an **alias** of the CodeGen-generated
|
|
6
|
+
* `MJAIRemoteBrowserProviderEntity_IRemoteBrowserProviderFeatures` (emitted from the
|
|
7
|
+
* `IRemoteBrowserProviderFeatures` JSONType interface bound to the
|
|
8
|
+
* `MJ: AI Remote Browser Providers.SupportedFeatures` column). It is re-exported here under the
|
|
9
|
+
* short source-interface name so channel/engine/driver code can refer to
|
|
10
|
+
* `IRemoteBrowserProviderFeatures` without importing the verbose generated name.
|
|
11
|
+
*
|
|
12
|
+
* Per repo convention we do not re-export TYPES from other packages as a dependency chain — this is a
|
|
13
|
+
* documented type alias of a generated entity shape for ergonomics, and the canonical source remains
|
|
14
|
+
* `@memberjunction/core-entities`.
|
|
15
|
+
*
|
|
16
|
+
* The capability flags are *transport / control* concerns only — the universal CDP substrate
|
|
17
|
+
* (`RawCdpControl`), an optional provider-native AI-control harness (`NativeAIControl`), viewing &
|
|
18
|
+
* collaboration (`LiveView`, `HumanTakeover`, `ScreenStreaming`), and operational capabilities
|
|
19
|
+
* (`Stealth`, `ProxyEgress`, `SessionRecording`, `PersistentContext`, `MultiTab`, `FileDownloads`,
|
|
20
|
+
* `CaptchaSolving`). Every flag is optional; an omitted flag means the feature is **not** supported.
|
|
21
|
+
*
|
|
22
|
+
* @see `/plans/realtime/realtime-bridges-architecture.md` §4d / §4d-i.
|
|
23
|
+
*/
|
|
24
|
+
export type IRemoteBrowserProviderFeatures = MJAIRemoteBrowserProviderEntity_IRemoteBrowserProviderFeatures;
|
|
25
|
+
/**
|
|
26
|
+
* The complete set of `IRemoteBrowserProviderFeatures` keys, as a readonly tuple.
|
|
27
|
+
*
|
|
28
|
+
* Useful for validators, diffing a driver's declared overrides against its provider metadata, and any
|
|
29
|
+
* code that must iterate over every known capability flag. Typed as `ReadonlyArray<keyof
|
|
30
|
+
* IRemoteBrowserProviderFeatures>` so the list stays in lock-step with the interface — adding a flag
|
|
31
|
+
* to the interface surfaces a compile error here until the key is added.
|
|
32
|
+
*/
|
|
33
|
+
export declare const KNOWN_REMOTE_BROWSER_FEATURE_KEYS: ReadonlyArray<keyof IRemoteBrowserProviderFeatures>;
|
|
34
|
+
/**
|
|
35
|
+
* Null-safely reads a provider's typed capability flags.
|
|
36
|
+
*
|
|
37
|
+
* Reads `provider.SupportedFeaturesObject` (the generated, lazily-parsed JSON accessor — never
|
|
38
|
+
* `JSON.parse(provider.SupportedFeatures)`) and substitutes an empty feature set when the column is
|
|
39
|
+
* NULL/omitted, so callers can dereference flags without a null guard. An empty set means every
|
|
40
|
+
* capability reads as `undefined` (i.e. unsupported), which is the intended fail-closed default.
|
|
41
|
+
*
|
|
42
|
+
* @param provider The remote-browser provider metadata row.
|
|
43
|
+
* @returns The provider's capability flags, or an empty object when none are declared.
|
|
44
|
+
*/
|
|
45
|
+
export declare function featuresOf(provider: MJAIRemoteBrowserProviderEntity): IRemoteBrowserProviderFeatures;
|
|
46
|
+
//# sourceMappingURL=remote-browser-features.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote-browser-features.d.ts","sourceRoot":"","sources":["../src/remote-browser-features.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,+BAA+B,EAC/B,8DAA8D,EACjE,MAAM,+BAA+B,CAAC;AAEvC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,MAAM,8BAA8B,GAAG,8DAA8D,CAAC;AAE5G;;;;;;;GAOG;AACH,eAAO,MAAM,iCAAiC,EAAE,aAAa,CAAC,MAAM,8BAA8B,CAajG,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CACtB,QAAQ,EAAE,+BAA+B,GAC1C,8BAA8B,CAEhC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The complete set of `IRemoteBrowserProviderFeatures` keys, as a readonly tuple.
|
|
3
|
+
*
|
|
4
|
+
* Useful for validators, diffing a driver's declared overrides against its provider metadata, and any
|
|
5
|
+
* code that must iterate over every known capability flag. Typed as `ReadonlyArray<keyof
|
|
6
|
+
* IRemoteBrowserProviderFeatures>` so the list stays in lock-step with the interface — adding a flag
|
|
7
|
+
* to the interface surfaces a compile error here until the key is added.
|
|
8
|
+
*/
|
|
9
|
+
export const KNOWN_REMOTE_BROWSER_FEATURE_KEYS = [
|
|
10
|
+
'RawCdpControl',
|
|
11
|
+
'NativeAIControl',
|
|
12
|
+
'LiveView',
|
|
13
|
+
'HumanTakeover',
|
|
14
|
+
'ScreenStreaming',
|
|
15
|
+
'Stealth',
|
|
16
|
+
'ProxyEgress',
|
|
17
|
+
'SessionRecording',
|
|
18
|
+
'PersistentContext',
|
|
19
|
+
'MultiTab',
|
|
20
|
+
'FileDownloads',
|
|
21
|
+
'CaptchaSolving',
|
|
22
|
+
];
|
|
23
|
+
/**
|
|
24
|
+
* Null-safely reads a provider's typed capability flags.
|
|
25
|
+
*
|
|
26
|
+
* Reads `provider.SupportedFeaturesObject` (the generated, lazily-parsed JSON accessor — never
|
|
27
|
+
* `JSON.parse(provider.SupportedFeatures)`) and substitutes an empty feature set when the column is
|
|
28
|
+
* NULL/omitted, so callers can dereference flags without a null guard. An empty set means every
|
|
29
|
+
* capability reads as `undefined` (i.e. unsupported), which is the intended fail-closed default.
|
|
30
|
+
*
|
|
31
|
+
* @param provider The remote-browser provider metadata row.
|
|
32
|
+
* @returns The provider's capability flags, or an empty object when none are declared.
|
|
33
|
+
*/
|
|
34
|
+
export function featuresOf(provider) {
|
|
35
|
+
return provider.SupportedFeaturesObject ?? {};
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=remote-browser-features.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote-browser-features.js","sourceRoot":"","sources":["../src/remote-browser-features.ts"],"names":[],"mappings":"AA6BA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAwD;IAClG,eAAe;IACf,iBAAiB;IACjB,UAAU;IACV,eAAe;IACf,iBAAiB;IACjB,SAAS;IACT,aAAa;IACb,kBAAkB;IAClB,mBAAmB;IACnB,UAAU;IACV,eAAe;IACf,gBAAgB;CACnB,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,UAAU,UAAU,CACtB,QAAyC;IAEzC,OAAO,QAAQ,CAAC,uBAAuB,IAAI,EAAE,CAAC;AAClD,CAAC"}
|