@ai-agent-forge/plugin-browser-playwright 0.88.3
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/MANUAL.md +60 -0
- package/README.md +79 -0
- package/agent-forge.json +25 -0
- package/dist/capability.d.ts +25 -0
- package/dist/capability.d.ts.map +1 -0
- package/dist/capability.js +612 -0
- package/dist/capability.js.map +1 -0
- package/dist/entry.d.ts +13 -0
- package/dist/entry.d.ts.map +1 -0
- package/dist/entry.js +14 -0
- package/dist/entry.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/operations.d.ts +69 -0
- package/dist/operations.d.ts.map +1 -0
- package/dist/operations.js +149 -0
- package/dist/operations.js.map +1 -0
- package/dist/playwright-driver.d.ts +275 -0
- package/dist/playwright-driver.d.ts.map +1 -0
- package/dist/playwright-driver.js +953 -0
- package/dist/playwright-driver.js.map +1 -0
- package/dist/setup.d.ts +68 -0
- package/dist/setup.d.ts.map +1 -0
- package/dist/setup.js +179 -0
- package/dist/setup.js.map +1 -0
- package/dist/types.d.ts +270 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +57 -0
- package/plugin.json +20 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser capability contracts for the built-in Playwright plugin.
|
|
3
|
+
*
|
|
4
|
+
* The plugin is the product's single browser channel. Playwright itself is
|
|
5
|
+
* never bundled: the driver resolves it from `<agentDir>/browser-deps` at
|
|
6
|
+
* connect time and `browser_setup` installs it on first use. Everything here
|
|
7
|
+
* is host-independent; hosts and tests inject a `BrowserRuntimeV1` whose
|
|
8
|
+
* `connect()` yields a driver, so the capability layer never imports
|
|
9
|
+
* Playwright types.
|
|
10
|
+
*/
|
|
11
|
+
import type { PluginResultV1 } from "@agent-forge/plugin-sdk";
|
|
12
|
+
export type BrowserLocatorKindV1 = "css" | "id" | "role" | "text" | "test-id";
|
|
13
|
+
export interface BrowserLocatorV1 {
|
|
14
|
+
readonly kind: BrowserLocatorKindV1;
|
|
15
|
+
readonly value: string;
|
|
16
|
+
/** Accessible name refinement for `kind: "role"`. */
|
|
17
|
+
readonly name?: string;
|
|
18
|
+
}
|
|
19
|
+
export type BrowserWaitUntilV1 = "commit" | "domcontentloaded" | "load" | "networkidle";
|
|
20
|
+
export interface BrowserNavigateInputV1 {
|
|
21
|
+
readonly url: string;
|
|
22
|
+
readonly waitUntil?: BrowserWaitUntilV1;
|
|
23
|
+
}
|
|
24
|
+
export interface BrowserSnapshotInputV1 {
|
|
25
|
+
readonly includeDom?: boolean;
|
|
26
|
+
readonly includeA11y?: boolean;
|
|
27
|
+
readonly includeStyles?: boolean;
|
|
28
|
+
readonly includeScreenshot?: boolean;
|
|
29
|
+
}
|
|
30
|
+
export type BrowserLocatorActionKindV1 = "click" | "dblclick" | "rightclick" | "fill" | "type" | "press" | "hover" | "select" | "check" | "uncheck" | "clear" | "upload" | "scroll";
|
|
31
|
+
export interface BrowserLocatorActionInputV1 {
|
|
32
|
+
readonly locator: BrowserLocatorV1;
|
|
33
|
+
readonly action: BrowserLocatorActionKindV1;
|
|
34
|
+
/**
|
|
35
|
+
* Value for `fill`, `type`, and `select`; for `upload` a single absolute
|
|
36
|
+
* file path or a JSON array of paths; for `scroll` a `<direction>:<pixels>`
|
|
37
|
+
* directive (`down:500`, `up:200`, `left:100`, `right:100`).
|
|
38
|
+
*/
|
|
39
|
+
readonly value?: string;
|
|
40
|
+
/** Key sequence for `press`. */
|
|
41
|
+
readonly key?: string;
|
|
42
|
+
/** Inter-key delay in milliseconds for `type`. */
|
|
43
|
+
readonly delay?: number;
|
|
44
|
+
}
|
|
45
|
+
export interface BrowserEvaluateInputV1 {
|
|
46
|
+
/**
|
|
47
|
+
* JavaScript expression evaluated via `page.evaluate`. Keep it a plain
|
|
48
|
+
* expression (`document.title`, `1 + 1`); for multi-statement logic use an
|
|
49
|
+
* IIFE string (`(() => { ... return x; })()`) — a bare `() => ...` string is
|
|
50
|
+
* not invoked by Playwright and serializes to `undefined`.
|
|
51
|
+
*/
|
|
52
|
+
readonly expression: string;
|
|
53
|
+
/** JSON-serializable argument passed through to the page context. */
|
|
54
|
+
readonly arg?: unknown;
|
|
55
|
+
}
|
|
56
|
+
export interface BrowserConsoleReadInputV1 {
|
|
57
|
+
/** Comma-combined level filter: error/warning/info/debug (`info` also matches `log`). */
|
|
58
|
+
readonly level?: string;
|
|
59
|
+
/** Substring filter on the message text. */
|
|
60
|
+
readonly contains?: string;
|
|
61
|
+
/** Most-recent count to return; defaults to 50. */
|
|
62
|
+
readonly limit?: number;
|
|
63
|
+
}
|
|
64
|
+
export interface BrowserConsoleEntryV1 {
|
|
65
|
+
readonly type: string;
|
|
66
|
+
readonly text: string;
|
|
67
|
+
readonly location?: {
|
|
68
|
+
readonly url: string;
|
|
69
|
+
readonly lineNumber: number;
|
|
70
|
+
readonly columnNumber: number;
|
|
71
|
+
};
|
|
72
|
+
readonly timestamp: number;
|
|
73
|
+
}
|
|
74
|
+
export interface BrowserNetworkReadInputV1 {
|
|
75
|
+
readonly containsUrl?: string;
|
|
76
|
+
readonly status?: number;
|
|
77
|
+
readonly method?: string;
|
|
78
|
+
/** Most-recent count to return; defaults to 50. */
|
|
79
|
+
readonly limit?: number;
|
|
80
|
+
}
|
|
81
|
+
export interface BrowserNetworkEntryV1 {
|
|
82
|
+
readonly method: string;
|
|
83
|
+
readonly url: string;
|
|
84
|
+
readonly status: number;
|
|
85
|
+
readonly timestamp: number;
|
|
86
|
+
/** Wall-clock duration in milliseconds when the request timing is available. */
|
|
87
|
+
readonly durationMs?: number;
|
|
88
|
+
/** Response `content-length` in bytes when the header is present. */
|
|
89
|
+
readonly sizeBytes?: number;
|
|
90
|
+
}
|
|
91
|
+
/** Raw in-page performance collection; the driver shapes it into {@link BrowserPerformancePayloadV1}. */
|
|
92
|
+
export interface BrowserPerformanceRawV1 {
|
|
93
|
+
readonly navigation: {
|
|
94
|
+
readonly ttfbMs: number;
|
|
95
|
+
readonly domContentLoadedMs: number;
|
|
96
|
+
readonly loadMs: number;
|
|
97
|
+
} | null;
|
|
98
|
+
readonly paints: readonly {
|
|
99
|
+
readonly name: string;
|
|
100
|
+
readonly startTimeMs: number;
|
|
101
|
+
}[];
|
|
102
|
+
readonly resources: readonly {
|
|
103
|
+
readonly url: string;
|
|
104
|
+
readonly durationMs: number;
|
|
105
|
+
readonly transferBytes: number;
|
|
106
|
+
}[];
|
|
107
|
+
readonly domNodes: number;
|
|
108
|
+
}
|
|
109
|
+
export interface BrowserPerformancePayloadV1 {
|
|
110
|
+
readonly navigation?: {
|
|
111
|
+
readonly ttfbMs: number;
|
|
112
|
+
readonly domContentLoadedMs: number;
|
|
113
|
+
readonly loadMs: number;
|
|
114
|
+
};
|
|
115
|
+
readonly paint: {
|
|
116
|
+
readonly firstPaintMs?: number;
|
|
117
|
+
readonly firstContentfulPaintMs?: number;
|
|
118
|
+
};
|
|
119
|
+
readonly resources: {
|
|
120
|
+
readonly count: number;
|
|
121
|
+
readonly totalTransferBytes: number;
|
|
122
|
+
readonly slowest: readonly {
|
|
123
|
+
readonly url: string;
|
|
124
|
+
readonly durationMs: number;
|
|
125
|
+
}[];
|
|
126
|
+
};
|
|
127
|
+
readonly domNodes: number;
|
|
128
|
+
}
|
|
129
|
+
export type BrowserWaitUntilKindV1 = "selector" | "navigation" | "networkidle" | "time";
|
|
130
|
+
export interface BrowserWaitInputV1 {
|
|
131
|
+
readonly until: BrowserWaitUntilKindV1;
|
|
132
|
+
/** Locator for `until: "selector"` (waits for the element to be visible). */
|
|
133
|
+
readonly locator?: BrowserLocatorV1;
|
|
134
|
+
/** Milliseconds; required for `until: "time"`, optional timeout for the others. Clamped to 30000. */
|
|
135
|
+
readonly ms?: number;
|
|
136
|
+
}
|
|
137
|
+
export interface BrowserDragInputV1 {
|
|
138
|
+
readonly from: BrowserLocatorV1;
|
|
139
|
+
readonly to: BrowserLocatorV1;
|
|
140
|
+
/** Number of intermediate mouse moves over the target; defaults to 8. */
|
|
141
|
+
readonly steps?: number;
|
|
142
|
+
}
|
|
143
|
+
export type BrowserMouseActionKindV1 = "move" | "click" | "dblclick" | "rightclick" | "wheel";
|
|
144
|
+
export type BrowserMouseButtonV1 = "left" | "right" | "middle";
|
|
145
|
+
export interface BrowserMouseInputV1 {
|
|
146
|
+
readonly action: BrowserMouseActionKindV1;
|
|
147
|
+
/** Non-negative integer viewport x coordinate. */
|
|
148
|
+
readonly x: number;
|
|
149
|
+
/** Non-negative integer viewport y coordinate. */
|
|
150
|
+
readonly y: number;
|
|
151
|
+
/** Horizontal wheel delta in pixels (`wheel`). */
|
|
152
|
+
readonly deltaX?: number;
|
|
153
|
+
/** Vertical wheel delta in pixels (`wheel`). */
|
|
154
|
+
readonly deltaY?: number;
|
|
155
|
+
readonly button?: BrowserMouseButtonV1;
|
|
156
|
+
}
|
|
157
|
+
export interface BrowserPressKeyInputV1 {
|
|
158
|
+
/** Playwright key name, e.g. `Control+a`, `Enter`, `Meta+c`. */
|
|
159
|
+
readonly key: string;
|
|
160
|
+
/** Delay between keydown and keyup in milliseconds. */
|
|
161
|
+
readonly delay?: number;
|
|
162
|
+
}
|
|
163
|
+
export type BrowserTabsActionKindV1 = "list" | "new" | "switch" | "close";
|
|
164
|
+
export interface BrowserTabsInputV1 {
|
|
165
|
+
readonly action: BrowserTabsActionKindV1;
|
|
166
|
+
/** Tab index for `switch` and `close`. */
|
|
167
|
+
readonly index?: number;
|
|
168
|
+
/** URL for `new`; defaults to `about:blank`. */
|
|
169
|
+
readonly url?: string;
|
|
170
|
+
}
|
|
171
|
+
export type BrowserStorageActionKindV1 = "get-cookies" | "set-cookie" | "clear-cookies" | "get-local" | "set-local" | "clear-local";
|
|
172
|
+
export interface BrowserStorageInputV1 {
|
|
173
|
+
readonly action: BrowserStorageActionKindV1;
|
|
174
|
+
/** Cookie name for `set-cookie`. */
|
|
175
|
+
readonly name?: string;
|
|
176
|
+
/** Cookie value for `set-cookie`; localStorage value for `set-local`. */
|
|
177
|
+
readonly value?: string;
|
|
178
|
+
/** Cookie domain for `set-cookie` (Playwright requires domain or url). */
|
|
179
|
+
readonly domain?: string;
|
|
180
|
+
readonly path?: string;
|
|
181
|
+
/** Cookie expiry as Unix seconds; omit for a session cookie. */
|
|
182
|
+
readonly expires?: number;
|
|
183
|
+
/** localStorage key for `get-local` and `set-local`. */
|
|
184
|
+
readonly key?: string;
|
|
185
|
+
}
|
|
186
|
+
export type BrowserViewportActionKindV1 = "set" | "get";
|
|
187
|
+
export interface BrowserViewportInputV1 {
|
|
188
|
+
readonly action: BrowserViewportActionKindV1;
|
|
189
|
+
/** Requested width; clamped into 320..7680. */
|
|
190
|
+
readonly width?: number;
|
|
191
|
+
/** Requested height; clamped into 320..7680. */
|
|
192
|
+
readonly height?: number;
|
|
193
|
+
}
|
|
194
|
+
export type BrowserElementStateV1 = "visible" | "hidden" | "value";
|
|
195
|
+
export type BrowserPostconditionV1 = {
|
|
196
|
+
readonly kind: "url";
|
|
197
|
+
readonly equals?: string;
|
|
198
|
+
readonly contains?: string;
|
|
199
|
+
} | {
|
|
200
|
+
readonly kind: "element";
|
|
201
|
+
readonly locator: BrowserLocatorV1;
|
|
202
|
+
readonly state: BrowserElementStateV1;
|
|
203
|
+
readonly value?: string;
|
|
204
|
+
} | {
|
|
205
|
+
readonly kind: "text";
|
|
206
|
+
readonly locator?: BrowserLocatorV1;
|
|
207
|
+
readonly contains: string;
|
|
208
|
+
} | {
|
|
209
|
+
readonly kind: "console";
|
|
210
|
+
readonly contains: string;
|
|
211
|
+
readonly level?: string;
|
|
212
|
+
} | {
|
|
213
|
+
readonly kind: "network";
|
|
214
|
+
readonly containsUrl: string;
|
|
215
|
+
readonly status?: number;
|
|
216
|
+
};
|
|
217
|
+
/** `browser_collect_evidence` kinds; console/network come from bounded page ring buffers. */
|
|
218
|
+
export type BrowserEvidenceKindV1 = "console" | "network" | "snapshot";
|
|
219
|
+
export interface BrowserOperationOptionsV1 {
|
|
220
|
+
readonly operationId?: string;
|
|
221
|
+
readonly signal?: AbortSignal;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Driver contract behind `BrowserRuntimeV1`. Every operation returns a
|
|
225
|
+
* validated `PluginResultV1`; failures are structured results, not throws
|
|
226
|
+
* (module/install problems surface as thrown errors at `connect` time and are
|
|
227
|
+
* sanitized by the capability layer). Structured payloads (console/network
|
|
228
|
+
* entries, performance metrics, evaluate results, storage and tab state) are
|
|
229
|
+
* carried as bounded JSON text in evidence summaries.
|
|
230
|
+
*/
|
|
231
|
+
export interface BrowserDriverV1 {
|
|
232
|
+
navigate(input: BrowserNavigateInputV1, options?: BrowserOperationOptionsV1): Promise<PluginResultV1>;
|
|
233
|
+
snapshot(input?: BrowserSnapshotInputV1, options?: BrowserOperationOptionsV1): Promise<PluginResultV1>;
|
|
234
|
+
locatorAction(input: BrowserLocatorActionInputV1, options?: BrowserOperationOptionsV1): Promise<PluginResultV1>;
|
|
235
|
+
assertPostcondition(input: BrowserPostconditionV1 | readonly BrowserPostconditionV1[], options?: BrowserOperationOptionsV1): Promise<PluginResultV1>;
|
|
236
|
+
collectEvidence(kind: BrowserEvidenceKindV1, options?: BrowserOperationOptionsV1): Promise<PluginResultV1>;
|
|
237
|
+
/** Escape hatch: runs a JS expression in the page context; use only when no built-in tool covers the operation. */
|
|
238
|
+
evaluate(input: BrowserEvaluateInputV1, options?: BrowserOperationOptionsV1): Promise<PluginResultV1>;
|
|
239
|
+
consoleEntries(input: BrowserConsoleReadInputV1, options?: BrowserOperationOptionsV1): Promise<PluginResultV1>;
|
|
240
|
+
networkEntries(input: BrowserNetworkReadInputV1, options?: BrowserOperationOptionsV1): Promise<PluginResultV1>;
|
|
241
|
+
/** Navigation Timing, paint, resource summary, and DOM node count; read-only. */
|
|
242
|
+
performance(options?: BrowserOperationOptionsV1): Promise<PluginResultV1>;
|
|
243
|
+
wait(input: BrowserWaitInputV1, options?: BrowserOperationOptionsV1): Promise<PluginResultV1>;
|
|
244
|
+
drag(input: BrowserDragInputV1, options?: BrowserOperationOptionsV1): Promise<PluginResultV1>;
|
|
245
|
+
mouse(input: BrowserMouseInputV1, options?: BrowserOperationOptionsV1): Promise<PluginResultV1>;
|
|
246
|
+
pressKey(input: BrowserPressKeyInputV1, options?: BrowserOperationOptionsV1): Promise<PluginResultV1>;
|
|
247
|
+
tabs(input: BrowserTabsInputV1, options?: BrowserOperationOptionsV1): Promise<PluginResultV1>;
|
|
248
|
+
storage(input: BrowserStorageInputV1, options?: BrowserOperationOptionsV1): Promise<PluginResultV1>;
|
|
249
|
+
viewport(input: BrowserViewportInputV1, options?: BrowserOperationOptionsV1): Promise<PluginResultV1>;
|
|
250
|
+
/** Idempotent, best-effort teardown; never throws. */
|
|
251
|
+
close(): void;
|
|
252
|
+
}
|
|
253
|
+
export type BrowserSetupOutcomeV1 = {
|
|
254
|
+
readonly ok: true;
|
|
255
|
+
readonly alreadyInstalled: boolean;
|
|
256
|
+
readonly log: string;
|
|
257
|
+
} | {
|
|
258
|
+
readonly ok: false;
|
|
259
|
+
readonly message: string;
|
|
260
|
+
};
|
|
261
|
+
/**
|
|
262
|
+
* Injection face for the capability factory. Tests bind a fake runtime over a
|
|
263
|
+
* mock driver; the production entry binds `PlaywrightBrowserRuntimeV1`, whose
|
|
264
|
+
* optional `setup()` self-installs Playwright into `<agentDir>/browser-deps`.
|
|
265
|
+
*/
|
|
266
|
+
export interface BrowserRuntimeV1 {
|
|
267
|
+
connect(): Promise<BrowserDriverV1>;
|
|
268
|
+
setup?(): Promise<BrowserSetupOutcomeV1>;
|
|
269
|
+
}
|
|
270
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;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Ac,CAAC,CAAC;IAChG,QAAQ,CAAC,KAAK,EAAE,sBAAsB,EAAE,OAAO,CAAC,EAAE,yBAAyB,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IACtG,IAAI,CAAC,KAAK,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,yBAAyB,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAC9F,OAAO,CAAC,KAAK,EAAE,qBAAqB,EAAE,OAAO,CAAC,EAAE,yBAAyB,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IACpG,QAAQ,CAAC,KAAK,EAAE,sBAAsB,EAAE,OAAO,CAAC,EAAE,yBAAyB,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IACtG,sDAAsD;IACtD,KAAK,IAAI,IAAI,CAAC;CACd;AAED,MAAM,MAAM,qBAAqB,GAC9B;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAC/E;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpD;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAChC,OAAO,IAAI,OAAO,CAAC,eAAe,CAAC,CAAC;IACpC,KAAK,CAAC,IAAI,OAAO,CAAC,qBAAqB,CAAC,CAAC;CACzC","sourcesContent":["/**\n * Browser capability contracts for the built-in Playwright plugin.\n *\n * The plugin is the product's single browser channel. Playwright itself is\n * never bundled: the driver resolves it from `<agentDir>/browser-deps` at\n * connect time and `browser_setup` installs it on first use. Everything here\n * is host-independent; hosts and tests inject a `BrowserRuntimeV1` whose\n * `connect()` yields a driver, so the capability layer never imports\n * Playwright types.\n */\nimport type { PluginResultV1 } from \"@agent-forge/plugin-sdk\";\n\nexport type BrowserLocatorKindV1 = \"css\" | \"id\" | \"role\" | \"text\" | \"test-id\";\n\nexport interface BrowserLocatorV1 {\n\treadonly kind: BrowserLocatorKindV1;\n\treadonly value: string;\n\t/** Accessible name refinement for `kind: \"role\"`. */\n\treadonly name?: string;\n}\n\nexport type BrowserWaitUntilV1 = \"commit\" | \"domcontentloaded\" | \"load\" | \"networkidle\";\n\nexport interface BrowserNavigateInputV1 {\n\treadonly url: string;\n\treadonly waitUntil?: BrowserWaitUntilV1;\n}\n\nexport interface BrowserSnapshotInputV1 {\n\treadonly includeDom?: boolean;\n\treadonly includeA11y?: boolean;\n\treadonly includeStyles?: boolean;\n\treadonly includeScreenshot?: boolean;\n}\n\nexport type BrowserLocatorActionKindV1 =\n\t| \"click\"\n\t| \"dblclick\"\n\t| \"rightclick\"\n\t| \"fill\"\n\t| \"type\"\n\t| \"press\"\n\t| \"hover\"\n\t| \"select\"\n\t| \"check\"\n\t| \"uncheck\"\n\t| \"clear\"\n\t| \"upload\"\n\t| \"scroll\";\n\nexport interface BrowserLocatorActionInputV1 {\n\treadonly locator: BrowserLocatorV1;\n\treadonly action: BrowserLocatorActionKindV1;\n\t/**\n\t * Value for `fill`, `type`, and `select`; for `upload` a single absolute\n\t * file path or a JSON array of paths; for `scroll` a `<direction>:<pixels>`\n\t * directive (`down:500`, `up:200`, `left:100`, `right:100`).\n\t */\n\treadonly value?: string;\n\t/** Key sequence for `press`. */\n\treadonly key?: string;\n\t/** Inter-key delay in milliseconds for `type`. */\n\treadonly delay?: number;\n}\n\nexport interface BrowserEvaluateInputV1 {\n\t/**\n\t * JavaScript expression evaluated via `page.evaluate`. Keep it a plain\n\t * expression (`document.title`, `1 + 1`); for multi-statement logic use an\n\t * IIFE string (`(() => { ... return x; })()`) — a bare `() => ...` string is\n\t * not invoked by Playwright and serializes to `undefined`.\n\t */\n\treadonly expression: string;\n\t/** JSON-serializable argument passed through to the page context. */\n\treadonly arg?: unknown;\n}\n\nexport interface BrowserConsoleReadInputV1 {\n\t/** Comma-combined level filter: error/warning/info/debug (`info` also matches `log`). */\n\treadonly level?: string;\n\t/** Substring filter on the message text. */\n\treadonly contains?: string;\n\t/** Most-recent count to return; defaults to 50. */\n\treadonly limit?: number;\n}\n\nexport interface BrowserConsoleEntryV1 {\n\treadonly type: string;\n\treadonly text: string;\n\treadonly location?: { readonly url: string; readonly lineNumber: number; readonly columnNumber: number };\n\treadonly timestamp: number;\n}\n\nexport interface BrowserNetworkReadInputV1 {\n\treadonly containsUrl?: string;\n\treadonly status?: number;\n\treadonly method?: string;\n\t/** Most-recent count to return; defaults to 50. */\n\treadonly limit?: number;\n}\n\nexport interface BrowserNetworkEntryV1 {\n\treadonly method: string;\n\treadonly url: string;\n\treadonly status: number;\n\treadonly timestamp: number;\n\t/** Wall-clock duration in milliseconds when the request timing is available. */\n\treadonly durationMs?: number;\n\t/** Response `content-length` in bytes when the header is present. */\n\treadonly sizeBytes?: number;\n}\n\n/** Raw in-page performance collection; the driver shapes it into {@link BrowserPerformancePayloadV1}. */\nexport interface BrowserPerformanceRawV1 {\n\treadonly navigation: {\n\t\treadonly ttfbMs: number;\n\t\treadonly domContentLoadedMs: number;\n\t\treadonly loadMs: number;\n\t} | null;\n\treadonly paints: readonly { readonly name: string; readonly startTimeMs: number }[];\n\treadonly resources: readonly { readonly url: string; readonly durationMs: number; readonly transferBytes: number }[];\n\treadonly domNodes: number;\n}\n\nexport interface BrowserPerformancePayloadV1 {\n\treadonly navigation?: { readonly ttfbMs: number; readonly domContentLoadedMs: number; readonly loadMs: number };\n\treadonly paint: { readonly firstPaintMs?: number; readonly firstContentfulPaintMs?: number };\n\treadonly resources: {\n\t\treadonly count: number;\n\t\treadonly totalTransferBytes: number;\n\t\treadonly slowest: readonly { readonly url: string; readonly durationMs: number }[];\n\t};\n\treadonly domNodes: number;\n}\n\nexport type BrowserWaitUntilKindV1 = \"selector\" | \"navigation\" | \"networkidle\" | \"time\";\n\nexport interface BrowserWaitInputV1 {\n\treadonly until: BrowserWaitUntilKindV1;\n\t/** Locator for `until: \"selector\"` (waits for the element to be visible). */\n\treadonly locator?: BrowserLocatorV1;\n\t/** Milliseconds; required for `until: \"time\"`, optional timeout for the others. Clamped to 30000. */\n\treadonly ms?: number;\n}\n\nexport interface BrowserDragInputV1 {\n\treadonly from: BrowserLocatorV1;\n\treadonly to: BrowserLocatorV1;\n\t/** Number of intermediate mouse moves over the target; defaults to 8. */\n\treadonly steps?: number;\n}\n\nexport type BrowserMouseActionKindV1 = \"move\" | \"click\" | \"dblclick\" | \"rightclick\" | \"wheel\";\nexport type BrowserMouseButtonV1 = \"left\" | \"right\" | \"middle\";\n\nexport interface BrowserMouseInputV1 {\n\treadonly action: BrowserMouseActionKindV1;\n\t/** Non-negative integer viewport x coordinate. */\n\treadonly x: number;\n\t/** Non-negative integer viewport y coordinate. */\n\treadonly y: number;\n\t/** Horizontal wheel delta in pixels (`wheel`). */\n\treadonly deltaX?: number;\n\t/** Vertical wheel delta in pixels (`wheel`). */\n\treadonly deltaY?: number;\n\treadonly button?: BrowserMouseButtonV1;\n}\n\nexport interface BrowserPressKeyInputV1 {\n\t/** Playwright key name, e.g. `Control+a`, `Enter`, `Meta+c`. */\n\treadonly key: string;\n\t/** Delay between keydown and keyup in milliseconds. */\n\treadonly delay?: number;\n}\n\nexport type BrowserTabsActionKindV1 = \"list\" | \"new\" | \"switch\" | \"close\";\n\nexport interface BrowserTabsInputV1 {\n\treadonly action: BrowserTabsActionKindV1;\n\t/** Tab index for `switch` and `close`. */\n\treadonly index?: number;\n\t/** URL for `new`; defaults to `about:blank`. */\n\treadonly url?: string;\n}\n\nexport type BrowserStorageActionKindV1 =\n\t| \"get-cookies\"\n\t| \"set-cookie\"\n\t| \"clear-cookies\"\n\t| \"get-local\"\n\t| \"set-local\"\n\t| \"clear-local\";\n\nexport interface BrowserStorageInputV1 {\n\treadonly action: BrowserStorageActionKindV1;\n\t/** Cookie name for `set-cookie`. */\n\treadonly name?: string;\n\t/** Cookie value for `set-cookie`; localStorage value for `set-local`. */\n\treadonly value?: string;\n\t/** Cookie domain for `set-cookie` (Playwright requires domain or url). */\n\treadonly domain?: string;\n\treadonly path?: string;\n\t/** Cookie expiry as Unix seconds; omit for a session cookie. */\n\treadonly expires?: number;\n\t/** localStorage key for `get-local` and `set-local`. */\n\treadonly key?: string;\n}\n\nexport type BrowserViewportActionKindV1 = \"set\" | \"get\";\n\nexport interface BrowserViewportInputV1 {\n\treadonly action: BrowserViewportActionKindV1;\n\t/** Requested width; clamped into 320..7680. */\n\treadonly width?: number;\n\t/** Requested height; clamped into 320..7680. */\n\treadonly height?: number;\n}\n\nexport type BrowserElementStateV1 = \"visible\" | \"hidden\" | \"value\";\n\nexport type BrowserPostconditionV1 =\n\t| { readonly kind: \"url\"; readonly equals?: string; readonly contains?: string }\n\t| {\n\t\t\treadonly kind: \"element\";\n\t\t\treadonly locator: BrowserLocatorV1;\n\t\t\treadonly state: BrowserElementStateV1;\n\t\t\treadonly value?: string;\n\t }\n\t| { readonly kind: \"text\"; readonly locator?: BrowserLocatorV1; readonly contains: string }\n\t| { readonly kind: \"console\"; readonly contains: string; readonly level?: string }\n\t| { readonly kind: \"network\"; readonly containsUrl: string; readonly status?: number };\n\n/** `browser_collect_evidence` kinds; console/network come from bounded page ring buffers. */\nexport type BrowserEvidenceKindV1 = \"console\" | \"network\" | \"snapshot\";\n\nexport interface BrowserOperationOptionsV1 {\n\treadonly operationId?: string;\n\treadonly signal?: AbortSignal;\n}\n\n/**\n * Driver contract behind `BrowserRuntimeV1`. Every operation returns a\n * validated `PluginResultV1`; failures are structured results, not throws\n * (module/install problems surface as thrown errors at `connect` time and are\n * sanitized by the capability layer). Structured payloads (console/network\n * entries, performance metrics, evaluate results, storage and tab state) are\n * carried as bounded JSON text in evidence summaries.\n */\nexport interface BrowserDriverV1 {\n\tnavigate(input: BrowserNavigateInputV1, options?: BrowserOperationOptionsV1): Promise<PluginResultV1>;\n\tsnapshot(input?: BrowserSnapshotInputV1, options?: BrowserOperationOptionsV1): Promise<PluginResultV1>;\n\tlocatorAction(input: BrowserLocatorActionInputV1, options?: BrowserOperationOptionsV1): Promise<PluginResultV1>;\n\tassertPostcondition(\n\t\tinput: BrowserPostconditionV1 | readonly BrowserPostconditionV1[],\n\t\toptions?: BrowserOperationOptionsV1,\n\t): Promise<PluginResultV1>;\n\tcollectEvidence(kind: BrowserEvidenceKindV1, options?: BrowserOperationOptionsV1): Promise<PluginResultV1>;\n\t/** Escape hatch: runs a JS expression in the page context; use only when no built-in tool covers the operation. */\n\tevaluate(input: BrowserEvaluateInputV1, options?: BrowserOperationOptionsV1): Promise<PluginResultV1>;\n\tconsoleEntries(input: BrowserConsoleReadInputV1, options?: BrowserOperationOptionsV1): Promise<PluginResultV1>;\n\tnetworkEntries(input: BrowserNetworkReadInputV1, options?: BrowserOperationOptionsV1): Promise<PluginResultV1>;\n\t/** Navigation Timing, paint, resource summary, and DOM node count; read-only. */\n\tperformance(options?: BrowserOperationOptionsV1): Promise<PluginResultV1>;\n\twait(input: BrowserWaitInputV1, options?: BrowserOperationOptionsV1): Promise<PluginResultV1>;\n\tdrag(input: BrowserDragInputV1, options?: BrowserOperationOptionsV1): Promise<PluginResultV1>;\n\tmouse(input: BrowserMouseInputV1, options?: BrowserOperationOptionsV1): Promise<PluginResultV1>;\n\tpressKey(input: BrowserPressKeyInputV1, options?: BrowserOperationOptionsV1): Promise<PluginResultV1>;\n\ttabs(input: BrowserTabsInputV1, options?: BrowserOperationOptionsV1): Promise<PluginResultV1>;\n\tstorage(input: BrowserStorageInputV1, options?: BrowserOperationOptionsV1): Promise<PluginResultV1>;\n\tviewport(input: BrowserViewportInputV1, options?: BrowserOperationOptionsV1): Promise<PluginResultV1>;\n\t/** Idempotent, best-effort teardown; never throws. */\n\tclose(): void;\n}\n\nexport type BrowserSetupOutcomeV1 =\n\t| { readonly ok: true; readonly alreadyInstalled: boolean; readonly log: string }\n\t| { readonly ok: false; readonly message: string };\n\n/**\n * Injection face for the capability factory. Tests bind a fake runtime over a\n * mock driver; the production entry binds `PlaywrightBrowserRuntimeV1`, whose\n * optional `setup()` self-installs Playwright into `<agentDir>/browser-deps`.\n */\nexport interface BrowserRuntimeV1 {\n\tconnect(): Promise<BrowserDriverV1>;\n\tsetup?(): Promise<BrowserSetupOutcomeV1>;\n}\n"]}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Browser capability contracts for the built-in Playwright plugin.\n *\n * The plugin is the product's single browser channel. Playwright itself is\n * never bundled: the driver resolves it from `<agentDir>/browser-deps` at\n * connect time and `browser_setup` installs it on first use. Everything here\n * is host-independent; hosts and tests inject a `BrowserRuntimeV1` whose\n * `connect()` yields a driver, so the capability layer never imports\n * Playwright types.\n */\nimport type { PluginResultV1 } from \"@agent-forge/plugin-sdk\";\n\nexport type BrowserLocatorKindV1 = \"css\" | \"id\" | \"role\" | \"text\" | \"test-id\";\n\nexport interface BrowserLocatorV1 {\n\treadonly kind: BrowserLocatorKindV1;\n\treadonly value: string;\n\t/** Accessible name refinement for `kind: \"role\"`. */\n\treadonly name?: string;\n}\n\nexport type BrowserWaitUntilV1 = \"commit\" | \"domcontentloaded\" | \"load\" | \"networkidle\";\n\nexport interface BrowserNavigateInputV1 {\n\treadonly url: string;\n\treadonly waitUntil?: BrowserWaitUntilV1;\n}\n\nexport interface BrowserSnapshotInputV1 {\n\treadonly includeDom?: boolean;\n\treadonly includeA11y?: boolean;\n\treadonly includeStyles?: boolean;\n\treadonly includeScreenshot?: boolean;\n}\n\nexport type BrowserLocatorActionKindV1 =\n\t| \"click\"\n\t| \"dblclick\"\n\t| \"rightclick\"\n\t| \"fill\"\n\t| \"type\"\n\t| \"press\"\n\t| \"hover\"\n\t| \"select\"\n\t| \"check\"\n\t| \"uncheck\"\n\t| \"clear\"\n\t| \"upload\"\n\t| \"scroll\";\n\nexport interface BrowserLocatorActionInputV1 {\n\treadonly locator: BrowserLocatorV1;\n\treadonly action: BrowserLocatorActionKindV1;\n\t/**\n\t * Value for `fill`, `type`, and `select`; for `upload` a single absolute\n\t * file path or a JSON array of paths; for `scroll` a `<direction>:<pixels>`\n\t * directive (`down:500`, `up:200`, `left:100`, `right:100`).\n\t */\n\treadonly value?: string;\n\t/** Key sequence for `press`. */\n\treadonly key?: string;\n\t/** Inter-key delay in milliseconds for `type`. */\n\treadonly delay?: number;\n}\n\nexport interface BrowserEvaluateInputV1 {\n\t/**\n\t * JavaScript expression evaluated via `page.evaluate`. Keep it a plain\n\t * expression (`document.title`, `1 + 1`); for multi-statement logic use an\n\t * IIFE string (`(() => { ... return x; })()`) — a bare `() => ...` string is\n\t * not invoked by Playwright and serializes to `undefined`.\n\t */\n\treadonly expression: string;\n\t/** JSON-serializable argument passed through to the page context. */\n\treadonly arg?: unknown;\n}\n\nexport interface BrowserConsoleReadInputV1 {\n\t/** Comma-combined level filter: error/warning/info/debug (`info` also matches `log`). */\n\treadonly level?: string;\n\t/** Substring filter on the message text. */\n\treadonly contains?: string;\n\t/** Most-recent count to return; defaults to 50. */\n\treadonly limit?: number;\n}\n\nexport interface BrowserConsoleEntryV1 {\n\treadonly type: string;\n\treadonly text: string;\n\treadonly location?: { readonly url: string; readonly lineNumber: number; readonly columnNumber: number };\n\treadonly timestamp: number;\n}\n\nexport interface BrowserNetworkReadInputV1 {\n\treadonly containsUrl?: string;\n\treadonly status?: number;\n\treadonly method?: string;\n\t/** Most-recent count to return; defaults to 50. */\n\treadonly limit?: number;\n}\n\nexport interface BrowserNetworkEntryV1 {\n\treadonly method: string;\n\treadonly url: string;\n\treadonly status: number;\n\treadonly timestamp: number;\n\t/** Wall-clock duration in milliseconds when the request timing is available. */\n\treadonly durationMs?: number;\n\t/** Response `content-length` in bytes when the header is present. */\n\treadonly sizeBytes?: number;\n}\n\n/** Raw in-page performance collection; the driver shapes it into {@link BrowserPerformancePayloadV1}. */\nexport interface BrowserPerformanceRawV1 {\n\treadonly navigation: {\n\t\treadonly ttfbMs: number;\n\t\treadonly domContentLoadedMs: number;\n\t\treadonly loadMs: number;\n\t} | null;\n\treadonly paints: readonly { readonly name: string; readonly startTimeMs: number }[];\n\treadonly resources: readonly { readonly url: string; readonly durationMs: number; readonly transferBytes: number }[];\n\treadonly domNodes: number;\n}\n\nexport interface BrowserPerformancePayloadV1 {\n\treadonly navigation?: { readonly ttfbMs: number; readonly domContentLoadedMs: number; readonly loadMs: number };\n\treadonly paint: { readonly firstPaintMs?: number; readonly firstContentfulPaintMs?: number };\n\treadonly resources: {\n\t\treadonly count: number;\n\t\treadonly totalTransferBytes: number;\n\t\treadonly slowest: readonly { readonly url: string; readonly durationMs: number }[];\n\t};\n\treadonly domNodes: number;\n}\n\nexport type BrowserWaitUntilKindV1 = \"selector\" | \"navigation\" | \"networkidle\" | \"time\";\n\nexport interface BrowserWaitInputV1 {\n\treadonly until: BrowserWaitUntilKindV1;\n\t/** Locator for `until: \"selector\"` (waits for the element to be visible). */\n\treadonly locator?: BrowserLocatorV1;\n\t/** Milliseconds; required for `until: \"time\"`, optional timeout for the others. Clamped to 30000. */\n\treadonly ms?: number;\n}\n\nexport interface BrowserDragInputV1 {\n\treadonly from: BrowserLocatorV1;\n\treadonly to: BrowserLocatorV1;\n\t/** Number of intermediate mouse moves over the target; defaults to 8. */\n\treadonly steps?: number;\n}\n\nexport type BrowserMouseActionKindV1 = \"move\" | \"click\" | \"dblclick\" | \"rightclick\" | \"wheel\";\nexport type BrowserMouseButtonV1 = \"left\" | \"right\" | \"middle\";\n\nexport interface BrowserMouseInputV1 {\n\treadonly action: BrowserMouseActionKindV1;\n\t/** Non-negative integer viewport x coordinate. */\n\treadonly x: number;\n\t/** Non-negative integer viewport y coordinate. */\n\treadonly y: number;\n\t/** Horizontal wheel delta in pixels (`wheel`). */\n\treadonly deltaX?: number;\n\t/** Vertical wheel delta in pixels (`wheel`). */\n\treadonly deltaY?: number;\n\treadonly button?: BrowserMouseButtonV1;\n}\n\nexport interface BrowserPressKeyInputV1 {\n\t/** Playwright key name, e.g. `Control+a`, `Enter`, `Meta+c`. */\n\treadonly key: string;\n\t/** Delay between keydown and keyup in milliseconds. */\n\treadonly delay?: number;\n}\n\nexport type BrowserTabsActionKindV1 = \"list\" | \"new\" | \"switch\" | \"close\";\n\nexport interface BrowserTabsInputV1 {\n\treadonly action: BrowserTabsActionKindV1;\n\t/** Tab index for `switch` and `close`. */\n\treadonly index?: number;\n\t/** URL for `new`; defaults to `about:blank`. */\n\treadonly url?: string;\n}\n\nexport type BrowserStorageActionKindV1 =\n\t| \"get-cookies\"\n\t| \"set-cookie\"\n\t| \"clear-cookies\"\n\t| \"get-local\"\n\t| \"set-local\"\n\t| \"clear-local\";\n\nexport interface BrowserStorageInputV1 {\n\treadonly action: BrowserStorageActionKindV1;\n\t/** Cookie name for `set-cookie`. */\n\treadonly name?: string;\n\t/** Cookie value for `set-cookie`; localStorage value for `set-local`. */\n\treadonly value?: string;\n\t/** Cookie domain for `set-cookie` (Playwright requires domain or url). */\n\treadonly domain?: string;\n\treadonly path?: string;\n\t/** Cookie expiry as Unix seconds; omit for a session cookie. */\n\treadonly expires?: number;\n\t/** localStorage key for `get-local` and `set-local`. */\n\treadonly key?: string;\n}\n\nexport type BrowserViewportActionKindV1 = \"set\" | \"get\";\n\nexport interface BrowserViewportInputV1 {\n\treadonly action: BrowserViewportActionKindV1;\n\t/** Requested width; clamped into 320..7680. */\n\treadonly width?: number;\n\t/** Requested height; clamped into 320..7680. */\n\treadonly height?: number;\n}\n\nexport type BrowserElementStateV1 = \"visible\" | \"hidden\" | \"value\";\n\nexport type BrowserPostconditionV1 =\n\t| { readonly kind: \"url\"; readonly equals?: string; readonly contains?: string }\n\t| {\n\t\t\treadonly kind: \"element\";\n\t\t\treadonly locator: BrowserLocatorV1;\n\t\t\treadonly state: BrowserElementStateV1;\n\t\t\treadonly value?: string;\n\t }\n\t| { readonly kind: \"text\"; readonly locator?: BrowserLocatorV1; readonly contains: string }\n\t| { readonly kind: \"console\"; readonly contains: string; readonly level?: string }\n\t| { readonly kind: \"network\"; readonly containsUrl: string; readonly status?: number };\n\n/** `browser_collect_evidence` kinds; console/network come from bounded page ring buffers. */\nexport type BrowserEvidenceKindV1 = \"console\" | \"network\" | \"snapshot\";\n\nexport interface BrowserOperationOptionsV1 {\n\treadonly operationId?: string;\n\treadonly signal?: AbortSignal;\n}\n\n/**\n * Driver contract behind `BrowserRuntimeV1`. Every operation returns a\n * validated `PluginResultV1`; failures are structured results, not throws\n * (module/install problems surface as thrown errors at `connect` time and are\n * sanitized by the capability layer). Structured payloads (console/network\n * entries, performance metrics, evaluate results, storage and tab state) are\n * carried as bounded JSON text in evidence summaries.\n */\nexport interface BrowserDriverV1 {\n\tnavigate(input: BrowserNavigateInputV1, options?: BrowserOperationOptionsV1): Promise<PluginResultV1>;\n\tsnapshot(input?: BrowserSnapshotInputV1, options?: BrowserOperationOptionsV1): Promise<PluginResultV1>;\n\tlocatorAction(input: BrowserLocatorActionInputV1, options?: BrowserOperationOptionsV1): Promise<PluginResultV1>;\n\tassertPostcondition(\n\t\tinput: BrowserPostconditionV1 | readonly BrowserPostconditionV1[],\n\t\toptions?: BrowserOperationOptionsV1,\n\t): Promise<PluginResultV1>;\n\tcollectEvidence(kind: BrowserEvidenceKindV1, options?: BrowserOperationOptionsV1): Promise<PluginResultV1>;\n\t/** Escape hatch: runs a JS expression in the page context; use only when no built-in tool covers the operation. */\n\tevaluate(input: BrowserEvaluateInputV1, options?: BrowserOperationOptionsV1): Promise<PluginResultV1>;\n\tconsoleEntries(input: BrowserConsoleReadInputV1, options?: BrowserOperationOptionsV1): Promise<PluginResultV1>;\n\tnetworkEntries(input: BrowserNetworkReadInputV1, options?: BrowserOperationOptionsV1): Promise<PluginResultV1>;\n\t/** Navigation Timing, paint, resource summary, and DOM node count; read-only. */\n\tperformance(options?: BrowserOperationOptionsV1): Promise<PluginResultV1>;\n\twait(input: BrowserWaitInputV1, options?: BrowserOperationOptionsV1): Promise<PluginResultV1>;\n\tdrag(input: BrowserDragInputV1, options?: BrowserOperationOptionsV1): Promise<PluginResultV1>;\n\tmouse(input: BrowserMouseInputV1, options?: BrowserOperationOptionsV1): Promise<PluginResultV1>;\n\tpressKey(input: BrowserPressKeyInputV1, options?: BrowserOperationOptionsV1): Promise<PluginResultV1>;\n\ttabs(input: BrowserTabsInputV1, options?: BrowserOperationOptionsV1): Promise<PluginResultV1>;\n\tstorage(input: BrowserStorageInputV1, options?: BrowserOperationOptionsV1): Promise<PluginResultV1>;\n\tviewport(input: BrowserViewportInputV1, options?: BrowserOperationOptionsV1): Promise<PluginResultV1>;\n\t/** Idempotent, best-effort teardown; never throws. */\n\tclose(): void;\n}\n\nexport type BrowserSetupOutcomeV1 =\n\t| { readonly ok: true; readonly alreadyInstalled: boolean; readonly log: string }\n\t| { readonly ok: false; readonly message: string };\n\n/**\n * Injection face for the capability factory. Tests bind a fake runtime over a\n * mock driver; the production entry binds `PlaywrightBrowserRuntimeV1`, whose\n * optional `setup()` self-installs Playwright into `<agentDir>/browser-deps`.\n */\nexport interface BrowserRuntimeV1 {\n\tconnect(): Promise<BrowserDriverV1>;\n\tsetup?(): Promise<BrowserSetupOutcomeV1>;\n}\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ai-agent-forge/plugin-browser-playwright",
|
|
3
|
+
"version": "0.88.3",
|
|
4
|
+
"description": "Built-in Playwright browser capability plugin for Agent Forge (seventeen prewritten browser tools: navigate/snapshot/locator_action with 13 actions/assert/collect/console/network/performance/wait/drag/mouse/press_key/tabs/storage/viewport, evaluate as the escape hatch, self-installing browser_setup; Playwright is never bundled)",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"MANUAL.md",
|
|
17
|
+
"agent-forge.json",
|
|
18
|
+
"plugin.json",
|
|
19
|
+
"README.md"
|
|
20
|
+
],
|
|
21
|
+
"scripts": {
|
|
22
|
+
"clean": "shx rm -rf dist",
|
|
23
|
+
"build": "tsgo -p tsconfig.build.json",
|
|
24
|
+
"test": "vitest --run",
|
|
25
|
+
"prepublishOnly": "npm run clean && npm run build"
|
|
26
|
+
},
|
|
27
|
+
"keywords": [
|
|
28
|
+
"agent-forge",
|
|
29
|
+
"plugin",
|
|
30
|
+
"browser",
|
|
31
|
+
"playwright",
|
|
32
|
+
"automation",
|
|
33
|
+
"evidence"
|
|
34
|
+
],
|
|
35
|
+
"author": "Agent Forge contributors",
|
|
36
|
+
"license": "MIT",
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "git+https://github.com/agent-forge/agent-forge.git",
|
|
40
|
+
"directory": "plugins/browser-playwright"
|
|
41
|
+
},
|
|
42
|
+
"bugs": {
|
|
43
|
+
"url": "https://github.com/agent-forge/agent-forge/issues"
|
|
44
|
+
},
|
|
45
|
+
"homepage": "https://github.com/agent-forge/agent-forge#readme",
|
|
46
|
+
"engines": {
|
|
47
|
+
"node": ">=22.19.0"
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"typebox": "1.3.27",
|
|
51
|
+
"@ai-agent-forge/plugin-sdk": "^0.88.3"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"shx": "0.4.0",
|
|
55
|
+
"vitest": "4.1.11"
|
|
56
|
+
}
|
|
57
|
+
}
|
package/plugin.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "agent-forge.plugin.browser-playwright",
|
|
3
|
+
"version": "0.88.3",
|
|
4
|
+
"apiVersion": "1-draft",
|
|
5
|
+
"entry": "./dist/entry.js",
|
|
6
|
+
"hostVersion": ">=0.84.4",
|
|
7
|
+
"description": "浏览器调试/测试/抓取:Playwright 17 工具(导航/DOM 与 a11y 快照/点击填写/拖拽/滚动/截图/console/网络/性能/存储/多标签),首次使用先 browser_setup 自装 Playwright",
|
|
8
|
+
"activation": "on-demand",
|
|
9
|
+
"manual": "./MANUAL.md",
|
|
10
|
+
"requiredCapabilities": [
|
|
11
|
+
"tools"
|
|
12
|
+
],
|
|
13
|
+
"provides": [
|
|
14
|
+
{
|
|
15
|
+
"id": "browser",
|
|
16
|
+
"version": 1,
|
|
17
|
+
"kind": "contribution"
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
}
|