@nodetool-ai/browser 0.8.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.
Files changed (43) hide show
  1. package/README.md +60 -0
  2. package/dist/.nodetool-build-stamp +1 -0
  3. package/dist/actions.d.ts +64 -0
  4. package/dist/actions.d.ts.map +1 -0
  5. package/dist/actions.js +468 -0
  6. package/dist/actions.js.map +1 -0
  7. package/dist/capture.d.ts +17 -0
  8. package/dist/capture.d.ts.map +1 -0
  9. package/dist/capture.js +95 -0
  10. package/dist/capture.js.map +1 -0
  11. package/dist/cdp-page.d.ts +125 -0
  12. package/dist/cdp-page.d.ts.map +1 -0
  13. package/dist/cdp-page.js +458 -0
  14. package/dist/cdp-page.js.map +1 -0
  15. package/dist/extension/channel.d.ts +28 -0
  16. package/dist/extension/channel.d.ts.map +1 -0
  17. package/dist/extension/channel.js +30 -0
  18. package/dist/extension/channel.js.map +1 -0
  19. package/dist/extension/client.d.ts +129 -0
  20. package/dist/extension/client.d.ts.map +1 -0
  21. package/dist/extension/client.js +352 -0
  22. package/dist/extension/client.js.map +1 -0
  23. package/dist/extension/page.d.ts +38 -0
  24. package/dist/extension/page.d.ts.map +1 -0
  25. package/dist/extension/page.js +50 -0
  26. package/dist/extension/page.js.map +1 -0
  27. package/dist/extension/protocol.d.ts +162 -0
  28. package/dist/extension/protocol.d.ts.map +1 -0
  29. package/dist/extension/protocol.js +45 -0
  30. package/dist/extension/protocol.js.map +1 -0
  31. package/dist/index.d.ts +30 -0
  32. package/dist/index.d.ts.map +1 -0
  33. package/dist/index.js +30 -0
  34. package/dist/index.js.map +1 -0
  35. package/dist/schemas.d.ts +698 -0
  36. package/dist/schemas.d.ts.map +1 -0
  37. package/dist/schemas.js +262 -0
  38. package/dist/schemas.js.map +1 -0
  39. package/dist/upload.d.ts +24 -0
  40. package/dist/upload.d.ts.map +1 -0
  41. package/dist/upload.js +144 -0
  42. package/dist/upload.js.map +1 -0
  43. package/package.json +66 -0
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Builds a {@link CdpPage} backed by the Chrome extension instead of a
3
+ * locally-launched Chrome.
4
+ *
5
+ * The single seam from the design: feed the *existing* `CdpPage.create(client,
6
+ * viewport)` a synthetic `client` whose namespaced methods tunnel CDP over the
7
+ * extension WebSocket. Everything downstream (element indexing, screenshots, the
8
+ * action loop) is reused verbatim.
9
+ */
10
+ import { CdpPage } from "../cdp-page.js";
11
+ import { ExtensionCdpClient } from "./client.js";
12
+ /** Default viewport for the extension-driven page. */
13
+ const DEFAULT_VIEWPORT = { width: 1280, height: 900 };
14
+ /**
15
+ * Attach to the extension's active tab and return a ready {@link CdpPage}.
16
+ *
17
+ * @param transport In-process {@link ExtensionChannel} or a `ws://` URL (or
18
+ * `undefined` to use `NODETOOL_EXTENSION_WS_URL`).
19
+ */
20
+ export async function createExtensionPage(transport, options = {}) {
21
+ const viewport = options.viewport ?? DEFAULT_VIEWPORT;
22
+ const cdp = new ExtensionCdpClient(transport, { sessionId: options.sessionId });
23
+ let attached = false;
24
+ try {
25
+ await cdp.attach();
26
+ attached = true;
27
+ const page = await CdpPage.create(cdp.client, viewport);
28
+ await cdp.client.Emulation.setDeviceMetricsOverride({
29
+ width: viewport.width,
30
+ height: viewport.height,
31
+ deviceScaleFactor: 1,
32
+ mobile: false
33
+ });
34
+ return {
35
+ page,
36
+ client: cdp.client,
37
+ close: async () => {
38
+ cdp.detach();
39
+ await cdp.close();
40
+ }
41
+ };
42
+ }
43
+ catch (err) {
44
+ if (attached)
45
+ cdp.detach();
46
+ await cdp.close();
47
+ throw err instanceof Error ? err : new Error(String(err));
48
+ }
49
+ }
50
+ //# sourceMappingURL=page.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"page.js","sourceRoot":"","sources":["../../src/extension/page.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EACL,kBAAkB,EAInB,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AAI,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5D,CAAC;AACH,CAAC"}
@@ -0,0 +1,162 @@
1
+ /**
2
+ * Wire-protocol types for the `/ws/extension` side channel.
3
+ *
4
+ * This is the host-side canonical copy. An IDENTICAL mirror of the type
5
+ * definitions lives at `chrome-extension/src/lib/protocol.ts` (the extension is
6
+ * a separate greenfield build that cannot import from `packages/`). Keep the two
7
+ * files byte-identical in their type/guard definitions; only the header comment
8
+ * differs.
9
+ *
10
+ * Frames are JSON text on `/ws/extension` (the main `/ws` stays MsgPack).
11
+ * Every frame is discriminated by `kind`.
12
+ *
13
+ * Direction legend:
14
+ * host→ext : nodetool server / action loop -> Chrome extension
15
+ * ext→host : Chrome extension -> nodetool server / action loop
16
+ */
17
+ /** A CDP command invocation. host→ext. */
18
+ export interface CdpCommandFrame {
19
+ kind: "cdp";
20
+ /** Monotonic request id, unique per host connection. */
21
+ id: number;
22
+ /** Fully-qualified CDP method, e.g. `"Page.navigate"`. */
23
+ method: string;
24
+ /** CDP command parameters. */
25
+ params?: Record<string, unknown>;
26
+ /** Optional CDP session id (flat-session multi-target). */
27
+ sessionId?: string;
28
+ }
29
+ /** Result (or error) for a previously sent {@link CdpCommandFrame}. ext→host. */
30
+ export interface CdpResultFrame {
31
+ kind: "cdp_result";
32
+ /** Echoes the {@link CdpCommandFrame.id} this responds to. */
33
+ id: number;
34
+ /** CDP command result. Present when the command succeeded. */
35
+ result?: Record<string, unknown>;
36
+ /**
37
+ * Present when the command failed. Surfaced host-side as
38
+ * `throw new Error(error.message)` to match `chrome-remote-interface`.
39
+ */
40
+ error?: {
41
+ message: string;
42
+ };
43
+ }
44
+ /** A forwarded CDP event from the attached tab. ext→host. */
45
+ export interface CdpEventFrame {
46
+ kind: "cdp_event";
47
+ /** Fully-qualified CDP event name, e.g. `"Page.loadEventFired"`. */
48
+ method: string;
49
+ /** CDP event payload. */
50
+ params?: Record<string, unknown>;
51
+ /** Optional CDP session id the event originated from. */
52
+ sessionId?: string;
53
+ }
54
+ /** Request the extension to attach the debugger to the active tab. host→ext. */
55
+ export interface AttachFrame {
56
+ kind: "attach";
57
+ /** Logical session key the host uses to route frames. */
58
+ sessionId?: string;
59
+ }
60
+ /** Acknowledges a successful {@link AttachFrame}. ext→host. */
61
+ export interface AttachedFrame {
62
+ kind: "attached";
63
+ /** The Chrome tab id the debugger attached to. */
64
+ tabId: number;
65
+ /** Logical session key, echoing {@link AttachFrame.sessionId}. */
66
+ sessionId?: string;
67
+ }
68
+ /** Request the extension to detach the debugger. host→ext or ext→host. */
69
+ export interface DetachFrame {
70
+ kind: "detach";
71
+ /** Logical session key. */
72
+ sessionId?: string;
73
+ /** Optional human-readable reason (e.g. user closed the tab). */
74
+ reason?: string;
75
+ }
76
+ /** Heartbeat. host→ext. */
77
+ export interface PingFrame {
78
+ kind: "ping";
79
+ /** Monotonic ping sequence, echoed back in {@link PongFrame}. */
80
+ ts: number;
81
+ }
82
+ /** Heartbeat reply. ext→host. */
83
+ export interface PongFrame {
84
+ kind: "pong";
85
+ /** Echoes {@link PingFrame.ts}. */
86
+ ts: number;
87
+ }
88
+ /**
89
+ * Fatal channel error. ext→host. The host rejects all pending commands and
90
+ * surfaces a restart-needed error; this is not used for per-command failures
91
+ * (those ride {@link CdpResultFrame.error}).
92
+ */
93
+ export interface ErrorFrame {
94
+ kind: "error";
95
+ /** Human-readable description of the fatal condition. */
96
+ message: string;
97
+ }
98
+ /**
99
+ * A chunk of asset bytes streamed from host to extension (e.g. for
100
+ * `upload_asset`'s DataTransfer fallback). host→ext.
101
+ */
102
+ export interface AssetChunkFrame {
103
+ kind: "asset_chunk";
104
+ /** Transfer id grouping the chunks of a single asset. */
105
+ transferId: string;
106
+ /** Zero-based chunk index. */
107
+ seq: number;
108
+ /** Base64-encoded chunk payload. */
109
+ data: string;
110
+ /** MIME type of the asset; sent on every chunk for convenience. */
111
+ mime?: string;
112
+ /** Suggested file name for the materialized `File`. */
113
+ fileName?: string;
114
+ /** True on the final chunk. */
115
+ last: boolean;
116
+ }
117
+ /**
118
+ * A chunk of captured media bytes streamed from extension to host (the
119
+ * `chrome.downloads` capture fallback). ext→host.
120
+ */
121
+ export interface MediaChunkFrame {
122
+ kind: "media_chunk";
123
+ /** Transfer id grouping the chunks of a single capture. */
124
+ transferId: string;
125
+ /** Zero-based chunk index. */
126
+ seq: number;
127
+ /** Base64-encoded chunk payload. */
128
+ data: string;
129
+ }
130
+ /** Terminates a {@link MediaChunkFrame} stream. ext→host. */
131
+ export interface MediaEndFrame {
132
+ kind: "media_end";
133
+ /** Transfer id this terminates. */
134
+ transferId: string;
135
+ /** Total byte count across all chunks (for integrity checks). */
136
+ totalBytes: number;
137
+ /** MIME type of the captured media, if known. */
138
+ mime?: string;
139
+ /** Source file name from `chrome.downloads`, if known. */
140
+ fileName?: string;
141
+ /** Present when the capture failed. */
142
+ error?: {
143
+ message: string;
144
+ };
145
+ }
146
+ /** Any frame sent host→ext. */
147
+ export type ExtensionHostToExtFrame = CdpCommandFrame | AttachFrame | DetachFrame | PingFrame | AssetChunkFrame;
148
+ /** Any frame sent ext→host. */
149
+ export type ExtensionExtToHostFrame = CdpResultFrame | CdpEventFrame | AttachedFrame | DetachFrame | PongFrame | ErrorFrame | MediaChunkFrame | MediaEndFrame;
150
+ /** The full discriminated union of all `/ws/extension` frames. */
151
+ export type ExtensionFrame = ExtensionHostToExtFrame | ExtensionExtToHostFrame;
152
+ /** Narrow an {@link ExtensionFrame} to a {@link CdpResultFrame}. */
153
+ export declare function isCdpResultFrame(frame: ExtensionFrame): frame is CdpResultFrame;
154
+ /** Narrow an {@link ExtensionFrame} to a {@link CdpEventFrame}. */
155
+ export declare function isCdpEventFrame(frame: ExtensionFrame): frame is CdpEventFrame;
156
+ /**
157
+ * Best-effort runtime parse of an inbound JSON text frame. Returns the typed
158
+ * frame when it has a string `kind`, otherwise `null`. Does not validate the
159
+ * full shape of each variant — callers narrow with the discriminant.
160
+ */
161
+ export declare function parseExtensionFrame(raw: string): ExtensionFrame | null;
162
+ //# sourceMappingURL=protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../src/extension/protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,0CAA0C;AAC1C,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,KAAK,CAAC;IACZ,wDAAwD;IACxD,EAAE,EAAE,MAAM,CAAC;IACX,0DAA0D;IAC1D,MAAM,EAAE,MAAM,CAAC;IACf,8BAA8B;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,2DAA2D;IAC3D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,iFAAiF;AACjF,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,YAAY,CAAC;IACnB,8DAA8D;IAC9D,EAAE,EAAE,MAAM,CAAC;IACX,8DAA8D;IAC9D,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC;;;OAGG;IACH,KAAK,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CAC7B;AAED,6DAA6D;AAC7D,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,WAAW,CAAC;IAClB,oEAAoE;IACpE,MAAM,EAAE,MAAM,CAAC;IACf,yBAAyB;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,yDAAyD;IACzD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,gFAAgF;AAChF,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,QAAQ,CAAC;IACf,yDAAyD;IACzD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,+DAA+D;AAC/D,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,UAAU,CAAC;IACjB,kDAAkD;IAClD,KAAK,E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IAClB,mCAAmC;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,iEAAiE;IACjE,UAAU,EAAE,MAAM,CAAC;IACnB,iDAAiD;IACjD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uCAAuC;IACvC,KAAK,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CAC7B;AAED,+BAA+B;AAC/B,MAAM,MAAM,uBAAuB,GAC/B,eAAe,GACf,WAAW,GACX,WAAW,GACX,SAAS,GACT,eAAe,CAAC;AAEpB,+BAA+B;AAC/B,MAAM,MAAM,uBAAuB,GAC/B,cAAc,GACd,aAAa,GACb,aAAa,GACb,WAAW,GACX,SAAS,GACT,UAAU,GACV,eAAe,GACf,aAAa,CAAC;AAElB,kEAAkE;AAClE,MAAM,MAAM,cAAc,GAAG,uBAAuB,GAAG,uBAAuB,CAAC;AAE/E,oEAAoE;AACpE,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,cAAc,GAAG,KAAK,IAAI,cAAc,CAE/E;AAED,mEAAmE;AACnE,wBAAgB,eAAe,CAAC,KAAK,EAAE,cAAc,GAAG,KAAK,IAAI,aAAa,CAE7E;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CAetE"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Wire-protocol types for the `/ws/extension` side channel.
3
+ *
4
+ * This is the host-side canonical copy. An IDENTICAL mirror of the type
5
+ * definitions lives at `chrome-extension/src/lib/protocol.ts` (the extension is
6
+ * a separate greenfield build that cannot import from `packages/`). Keep the two
7
+ * files byte-identical in their type/guard definitions; only the header comment
8
+ * differs.
9
+ *
10
+ * Frames are JSON text on `/ws/extension` (the main `/ws` stays MsgPack).
11
+ * Every frame is discriminated by `kind`.
12
+ *
13
+ * Direction legend:
14
+ * host→ext : nodetool server / action loop -> Chrome extension
15
+ * ext→host : Chrome extension -> nodetool server / action loop
16
+ */
17
+ /** Narrow an {@link ExtensionFrame} to a {@link CdpResultFrame}. */
18
+ export function isCdpResultFrame(frame) {
19
+ return frame.kind === "cdp_result";
20
+ }
21
+ /** Narrow an {@link ExtensionFrame} to a {@link CdpEventFrame}. */
22
+ export function isCdpEventFrame(frame) {
23
+ return frame.kind === "cdp_event";
24
+ }
25
+ /**
26
+ * Best-effort runtime parse of an inbound JSON text frame. Returns the typed
27
+ * frame when it has a string `kind`, otherwise `null`. Does not validate the
28
+ * full shape of each variant — callers narrow with the discriminant.
29
+ */
30
+ export function parseExtensionFrame(raw) {
31
+ let value;
32
+ try {
33
+ value = JSON.parse(raw);
34
+ }
35
+ catch {
36
+ return null;
37
+ }
38
+ if (typeof value === "object" &&
39
+ value !== null &&
40
+ typeof value.kind === "string") {
41
+ return value;
42
+ }
43
+ return null;
44
+ }
45
+ //# sourceMappingURL=protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../src/extension/protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAiKH,oEAAoE;AACpE,MAAM,UAAU,gBAAgB,CAAC,KAAqB;IACpD,OAAO,KAAK,CAAC,IAAI,KAAK,YAAY,CAAC;AACrC,CAAC;AAED,mEAAmE;AACnE,MAAM,UAAU,eAAe,CAAC,KAAqB;IACnD,OAAO,KAAK,CAAC,IAAI,KAAK,WAAW,CAAC;AACpC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,GAAW;IAC7C,IAAI,KAAc,CAAC;IACnB,IAAI,CAAC;QACH,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC1B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IACE,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,OAAQ,KAA4B,CAAC,IAAI,KAAK,QAAQ,EACtD,CAAC;QACD,OAAO,KAAuB,CAAC;IACjC,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * `@nodetool-ai/browser` — driving one real Chrome page.
3
+ *
4
+ * The page is either a headless Chrome this process launched or, through the
5
+ * NodeTool Chrome extension's `/ws/extension` relay, the tab the user is
6
+ * already signed in to. Nothing above {@link ensureSession} knows which: the
7
+ * action loop is transport-agnostic, so the only two entry points that mention
8
+ * transports are {@link browserStatus}, which reports the one in force, and
9
+ * {@link browserRestart}, which changes it.
10
+ *
11
+ * The package deliberately knows nothing about NodeTool's agents, nodes,
12
+ * assets or workflows. It takes plain inputs, returns plain data — a
13
+ * screenshot comes back as base64, not as a persisted asset — so the layer
14
+ * that has a `ProcessingContext` decides what to do with the bytes. That is
15
+ * what lets the agent capabilities and the `lib.browser.Screenshot` node share
16
+ * one implementation without either depending on the other.
17
+ *
18
+ * Chrome itself is reached through dynamic imports, so importing this package
19
+ * loads no browser and launches no process until an action runs.
20
+ */
21
+ export { CdpPage, launchBrowser, withPage, type WaitUntil, type LaunchOptions } from "./cdp-page.js";
22
+ export { browserView, browserNavigate, browserRestart, browserClick, browserInput, browserMoveMouse, browserPressKey, browserSelectOption, browserScroll, browserConsoleExec, browserConsoleView, browserCaptureMedia, browserUploadAsset, browserStatus, closeBrowserSession } from "./actions.js";
23
+ export * from "./schemas.js";
24
+ export { captureMediaInPage } from "./capture.js";
25
+ export { uploadAssetToInput } from "./upload.js";
26
+ export { parseExtensionFrame, isCdpResultFrame, isCdpEventFrame, type ExtensionFrame, type ExtensionHostToExtFrame, type ExtensionExtToHostFrame, type CdpCommandFrame, type CdpResultFrame, type CdpEventFrame, type AttachFrame, type AttachedFrame, type DetachFrame, type PingFrame, type PongFrame, type ErrorFrame, type AssetChunkFrame, type MediaChunkFrame, type MediaEndFrame } from "./extension/protocol.js";
27
+ export { ExtensionCdpClient, type ExtensionChannel, type ExtensionCdpClientApi, type ExtensionCdpClientOptions } from "./extension/client.js";
28
+ export { createExtensionPage, type ExtensionPageHandle } from "./extension/page.js";
29
+ export { setExtensionChannelProvider, getInProcessExtensionChannel, type ExtensionChannelProvider } from "./extension/channel.js";
30
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EACL,OAAO,EACP,aAAa,EACb,QAAQ,EACR,KAAK,SAAS,EACd,KAAK,aAAa,EACnB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,WAAW,EACX,eAAe,EACf,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACnB,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,aAAa,EACb,mBAAmB,EACpB,MAAM,cAAc,CAAC;AAEtB,cAAc,cAAc,CAAC;AAE7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,eAAe,EACf,KAAK,cAAc,EACnB,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,aAAa,EACnB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,kBAAkB,EAClB,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC/B,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,mBAAmB,EACnB,KAAK,mBAAmB,EACzB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,EAC5B,KAAK,wBAAwB,EAC9B,MAAM,wBAAwB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,30 @@
1
+ /**
2
+ * `@nodetool-ai/browser` — driving one real Chrome page.
3
+ *
4
+ * The page is either a headless Chrome this process launched or, through the
5
+ * NodeTool Chrome extension's `/ws/extension` relay, the tab the user is
6
+ * already signed in to. Nothing above {@link ensureSession} knows which: the
7
+ * action loop is transport-agnostic, so the only two entry points that mention
8
+ * transports are {@link browserStatus}, which reports the one in force, and
9
+ * {@link browserRestart}, which changes it.
10
+ *
11
+ * The package deliberately knows nothing about NodeTool's agents, nodes,
12
+ * assets or workflows. It takes plain inputs, returns plain data — a
13
+ * screenshot comes back as base64, not as a persisted asset — so the layer
14
+ * that has a `ProcessingContext` decides what to do with the bytes. That is
15
+ * what lets the agent capabilities and the `lib.browser.Screenshot` node share
16
+ * one implementation without either depending on the other.
17
+ *
18
+ * Chrome itself is reached through dynamic imports, so importing this package
19
+ * loads no browser and launches no process until an action runs.
20
+ */
21
+ export { CdpPage, launchBrowser, withPage } from "./cdp-page.js";
22
+ export { browserView, browserNavigate, browserRestart, browserClick, browserInput, browserMoveMouse, browserPressKey, browserSelectOption, browserScroll, browserConsoleExec, browserConsoleView, browserCaptureMedia, browserUploadAsset, browserStatus, closeBrowserSession } from "./actions.js";
23
+ export * from "./schemas.js";
24
+ export { captureMediaInPage } from "./capture.js";
25
+ export { uploadAssetToInput } from "./upload.js";
26
+ export { parseExtensionFrame, isCdpResultFrame, isCdpEventFrame } from "./extension/protocol.js";
27
+ export { ExtensionCdpClient } from "./extension/client.js";
28
+ export { createExtensionPage } from "./extension/page.js";
29
+ export { setExtensionChannelProvider, getInProcessExtensionChannel } from "./extension/channel.js";
30
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EACL,OAAO,EACP,aAAa,EACb,QAAQ,EAGT,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,WAAW,EACX,eAAe,EACf,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACnB,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,aAAa,EACb,mBAAmB,EACpB,MAAM,cAAc,CAAC;AAEtB,cAAc,cAAc,CAAC;AAE7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,eAAe,EAgBhB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,kBAAkB,EAInB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,mBAAmB,EAEpB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,EAE7B,MAAM,wBAAwB,CAAC"}