@mlola/backend-playwright 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 MLola
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,14 @@
1
+ # @mlola/backend-playwright
2
+
3
+ The Playwright browser backend for the
4
+ [MLola Browser Runtime](https://mlola.com/browser-runtime): atomic in-page
5
+ snapshots, node identity, freshness/occlusion preflight, typed execution, tabs,
6
+ downloads, uploads, dialogs and cleanup guarantees.
7
+
8
+ Uses `playwright-core` and the installed Chrome by default (`channel: "chrome"`),
9
+ so no browser download is required. `mode: "cdp"` attaches to an existing Chrome
10
+ over the DevTools protocol.
11
+
12
+ ```ts
13
+ import { PlaywrightBackend } from "@mlola/backend-playwright";
14
+ ```
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Playwright browser backend (PRD §9.2, §9.3, §48).
3
+ *
4
+ * Browser mechanics only: sessions, atomic observation, typed execution,
5
+ * freshness/preflight checks, tabs, downloads, uploads, diagnostics and
6
+ * screenshots. No decisions, no model output, no policy.
7
+ */
8
+ import { type BrowserSnapshot, type SnapshotDiagnostics, type TabId, type TabInfo, type TypedAction } from "@mlola/browser-protocol";
9
+ import type { ActionOutcome, BrowserBackend, BrowserSession, CleanupReport, HumanHelpHandler, PreflightResult, ScreenshotResult, StartSessionInput } from "@mlola/browser-backend";
10
+ export declare class PlaywrightBackend implements BrowserBackend {
11
+ #private;
12
+ readonly name = "playwright";
13
+ readonly capabilities: {
14
+ readonly observe: true;
15
+ readonly click: true;
16
+ readonly type: true;
17
+ readonly select: true;
18
+ readonly scroll: true;
19
+ readonly press: true;
20
+ readonly history: true;
21
+ readonly tabs: true;
22
+ readonly open_tab: true;
23
+ readonly close_tab: true;
24
+ readonly borrow: false;
25
+ readonly return_tab: false;
26
+ readonly human_help: false;
27
+ readonly download: true;
28
+ readonly upload: true;
29
+ readonly console: true;
30
+ readonly network: true;
31
+ readonly screenshot: true;
32
+ readonly canvas: false;
33
+ readonly dialog_handling: true;
34
+ readonly clipboard: false;
35
+ };
36
+ startSession(input: StartSessionInput): Promise<BrowserSession>;
37
+ stopSession(_sessionId: string): Promise<CleanupReport>;
38
+ setHumanHelpHandler(handler: HumanHelpHandler): void;
39
+ observe(sessionId: string): Promise<BrowserSnapshot>;
40
+ preflight(_sessionId: string, action: TypedAction): Promise<PreflightResult>;
41
+ execute(_sessionId: string, action: TypedAction): Promise<ActionOutcome>;
42
+ navigate(_sessionId: string, url: string): Promise<ActionOutcome>;
43
+ listTabs(_sessionId: string): Promise<TabInfo[]>;
44
+ switchTab(_sessionId: string, tabId: TabId): Promise<void>;
45
+ getDiagnostics(_sessionId: string): Promise<SnapshotDiagnostics>;
46
+ screenshot(_sessionId: string, reason: string): Promise<ScreenshotResult>;
47
+ }
48
+ export declare const createPlaywrightBackend: () => PlaywrightBackend;
49
+ //# sourceMappingURL=backend.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backend.d.ts","sourceRoot":"","sources":["../src/backend.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAeH,OAAO,EAML,KAAK,eAAe,EAGpB,KAAK,mBAAmB,EACxB,KAAK,KAAK,EACV,KAAK,OAAO,EAEZ,KAAK,WAAW,EACjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAEV,aAAa,EACb,cAAc,EACd,cAAc,EACd,aAAa,EAEb,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,wBAAwB,CAAC;AAuChC,qBAAa,iBAAkB,YAAW,cAAc;;IACtD,QAAQ,CAAC,IAAI,gBAAgB;IAC7B,QAAQ,CAAC,YAAY;;;;;;;;;;;;;;;;;;;;;;MAAgB;IA0B/B,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,cAAc,CAAC;IAuK/D,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAqD7D,mBAAmB,CAAC,OAAO,EAAE,gBAAgB,GAAG,IAAI;IAM9C,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAgLpD,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,eAAe,CAAC;IA6D5E,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC;IA4SxE,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IA2BjE,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAIhD,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC;IAO1D,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAOhE,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAuGhF;AAED,eAAO,MAAM,uBAAuB,QAAO,iBAA4C,CAAC"}