@ulpi/browse 2.3.3 → 2.4.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.
Files changed (279) hide show
  1. package/README.md +8 -2
  2. package/dist/browse.cjs +3445 -1636
  3. package/dist/lib.mjs +29504 -0
  4. package/dist/types/a11y.d.ts +32 -0
  5. package/dist/types/a11y.d.ts.map +1 -0
  6. package/dist/types/app/android/bridge.d.ts +41 -0
  7. package/dist/types/app/android/bridge.d.ts.map +1 -0
  8. package/dist/types/app/android/emulator.d.ts +32 -0
  9. package/dist/types/app/android/emulator.d.ts.map +1 -0
  10. package/dist/types/app/android/manager.d.ts +62 -0
  11. package/dist/types/app/android/manager.d.ts.map +1 -0
  12. package/dist/types/app/android/protocol.d.ts +162 -0
  13. package/dist/types/app/android/protocol.d.ts.map +1 -0
  14. package/dist/types/app/android/sim-service.d.ts +33 -0
  15. package/dist/types/app/android/sim-service.d.ts.map +1 -0
  16. package/dist/types/app/index.d.ts +15 -0
  17. package/dist/types/app/index.d.ts.map +1 -0
  18. package/dist/types/app/ios/bridge.d.ts +53 -0
  19. package/dist/types/app/ios/bridge.d.ts.map +1 -0
  20. package/dist/types/app/ios/controller.d.ts +131 -0
  21. package/dist/types/app/ios/controller.d.ts.map +1 -0
  22. package/dist/types/app/ios/manager.d.ts +96 -0
  23. package/dist/types/app/ios/manager.d.ts.map +1 -0
  24. package/dist/types/app/ios/protocol.d.ts +122 -0
  25. package/dist/types/app/ios/protocol.d.ts.map +1 -0
  26. package/dist/types/app/ios/sim-service.d.ts +37 -0
  27. package/dist/types/app/ios/sim-service.d.ts.map +1 -0
  28. package/dist/types/app/macos/bridge.d.ts +22 -0
  29. package/dist/types/app/macos/bridge.d.ts.map +1 -0
  30. package/dist/types/app/manager.d.ts +50 -0
  31. package/dist/types/app/manager.d.ts.map +1 -0
  32. package/dist/types/app/normalize.d.ts +27 -0
  33. package/dist/types/app/normalize.d.ts.map +1 -0
  34. package/dist/types/app/resolve-app.d.ts +31 -0
  35. package/dist/types/app/resolve-app.d.ts.map +1 -0
  36. package/dist/types/app/types.d.ts +77 -0
  37. package/dist/types/app/types.d.ts.map +1 -0
  38. package/dist/types/automation/action-context.d.ts +110 -0
  39. package/dist/types/automation/action-context.d.ts.map +1 -0
  40. package/dist/types/automation/command.d.ts +138 -0
  41. package/dist/types/automation/command.d.ts.map +1 -0
  42. package/dist/types/automation/events.d.ts +72 -0
  43. package/dist/types/automation/events.d.ts.map +1 -0
  44. package/dist/types/automation/executor.d.ts +39 -0
  45. package/dist/types/automation/executor.d.ts.map +1 -0
  46. package/dist/types/automation/index.d.ts +11 -0
  47. package/dist/types/automation/index.d.ts.map +1 -0
  48. package/dist/types/automation/registry.d.ts +38 -0
  49. package/dist/types/automation/registry.d.ts.map +1 -0
  50. package/dist/types/automation/rules.d.ts +52 -0
  51. package/dist/types/automation/rules.d.ts.map +1 -0
  52. package/dist/types/automation/target.d.ts +76 -0
  53. package/dist/types/automation/target.d.ts.map +1 -0
  54. package/dist/types/browser/consent.d.ts +13 -0
  55. package/dist/types/browser/consent.d.ts.map +1 -0
  56. package/dist/types/browser/cookie-import.d.ts +94 -0
  57. package/dist/types/browser/cookie-import.d.ts.map +1 -0
  58. package/dist/types/browser/detection.d.ts +22 -0
  59. package/dist/types/browser/detection.d.ts.map +1 -0
  60. package/dist/types/browser/emulation.d.ts +30 -0
  61. package/dist/types/browser/emulation.d.ts.map +1 -0
  62. package/dist/types/browser/events.d.ts +19 -0
  63. package/dist/types/browser/events.d.ts.map +1 -0
  64. package/dist/types/browser/index.d.ts +17 -0
  65. package/dist/types/browser/index.d.ts.map +1 -0
  66. package/dist/types/browser/macros.d.ts +9 -0
  67. package/dist/types/browser/macros.d.ts.map +1 -0
  68. package/dist/types/browser/manager.d.ts +272 -0
  69. package/dist/types/browser/manager.d.ts.map +1 -0
  70. package/dist/types/browser/png-compare.d.ts +36 -0
  71. package/dist/types/browser/png-compare.d.ts.map +1 -0
  72. package/dist/types/browser/profiles.d.ts +29 -0
  73. package/dist/types/browser/profiles.d.ts.map +1 -0
  74. package/dist/types/browser/react-devtools.d.ts +75 -0
  75. package/dist/types/browser/react-devtools.d.ts.map +1 -0
  76. package/dist/types/browser/readiness.d.ts +19 -0
  77. package/dist/types/browser/readiness.d.ts.map +1 -0
  78. package/dist/types/browser/refs.d.ts +70 -0
  79. package/dist/types/browser/refs.d.ts.map +1 -0
  80. package/dist/types/browser/serp.d.ts +16 -0
  81. package/dist/types/browser/serp.d.ts.map +1 -0
  82. package/dist/types/browser/snapshot-window.d.ts +31 -0
  83. package/dist/types/browser/snapshot-window.d.ts.map +1 -0
  84. package/dist/types/browser/snapshot.d.ts +41 -0
  85. package/dist/types/browser/snapshot.d.ts.map +1 -0
  86. package/dist/types/browser/tabs.d.ts +67 -0
  87. package/dist/types/browser/tabs.d.ts.map +1 -0
  88. package/dist/types/browser/target.d.ts +106 -0
  89. package/dist/types/browser/target.d.ts.map +1 -0
  90. package/dist/types/browser/youtube.d.ts +26 -0
  91. package/dist/types/browser/youtube.d.ts.map +1 -0
  92. package/dist/types/cli.d.ts +14 -0
  93. package/dist/types/cli.d.ts.map +1 -0
  94. package/dist/types/cloud/auth.d.ts +80 -0
  95. package/dist/types/cloud/auth.d.ts.map +1 -0
  96. package/dist/types/cloud/docker.d.ts +76 -0
  97. package/dist/types/cloud/docker.d.ts.map +1 -0
  98. package/dist/types/cloud/firecracker.d.ts +142 -0
  99. package/dist/types/cloud/firecracker.d.ts.map +1 -0
  100. package/dist/types/cloud/golden-snapshot.d.ts +122 -0
  101. package/dist/types/cloud/golden-snapshot.d.ts.map +1 -0
  102. package/dist/types/cloud/index.d.ts +26 -0
  103. package/dist/types/cloud/index.d.ts.map +1 -0
  104. package/dist/types/cloud/orchestrator-interface.d.ts +63 -0
  105. package/dist/types/cloud/orchestrator-interface.d.ts.map +1 -0
  106. package/dist/types/cloud/orchestrator.d.ts +58 -0
  107. package/dist/types/cloud/orchestrator.d.ts.map +1 -0
  108. package/dist/types/cloud/proxy.d.ts +34 -0
  109. package/dist/types/cloud/proxy.d.ts.map +1 -0
  110. package/dist/types/cloud/reaper.d.ts +49 -0
  111. package/dist/types/cloud/reaper.d.ts.map +1 -0
  112. package/dist/types/cloud/server.d.ts +19 -0
  113. package/dist/types/cloud/server.d.ts.map +1 -0
  114. package/dist/types/cloud/sessions.d.ts +85 -0
  115. package/dist/types/cloud/sessions.d.ts.map +1 -0
  116. package/dist/types/cloud/vm-orchestrator.d.ts +133 -0
  117. package/dist/types/cloud/vm-orchestrator.d.ts.map +1 -0
  118. package/dist/types/cloud/vm-warm-pool.d.ts +104 -0
  119. package/dist/types/cloud/vm-warm-pool.d.ts.map +1 -0
  120. package/dist/types/cloud/warm-pool.d.ts +85 -0
  121. package/dist/types/cloud/warm-pool.d.ts.map +1 -0
  122. package/dist/types/cloud/ws.d.ts +61 -0
  123. package/dist/types/cloud/ws.d.ts.map +1 -0
  124. package/dist/types/commands/meta/auth.d.ts +6 -0
  125. package/dist/types/commands/meta/auth.d.ts.map +1 -0
  126. package/dist/types/commands/meta/flows.d.ts +15 -0
  127. package/dist/types/commands/meta/flows.d.ts.map +1 -0
  128. package/dist/types/commands/meta/index.d.ts +14 -0
  129. package/dist/types/commands/meta/index.d.ts.map +1 -0
  130. package/dist/types/commands/meta/inspection.d.ts +7 -0
  131. package/dist/types/commands/meta/inspection.d.ts.map +1 -0
  132. package/dist/types/commands/meta/profile.d.ts +11 -0
  133. package/dist/types/commands/meta/profile.d.ts.map +1 -0
  134. package/dist/types/commands/meta/recording.d.ts +7 -0
  135. package/dist/types/commands/meta/recording.d.ts.map +1 -0
  136. package/dist/types/commands/meta/screenshots.d.ts +7 -0
  137. package/dist/types/commands/meta/screenshots.d.ts.map +1 -0
  138. package/dist/types/commands/meta/sessions.d.ts +7 -0
  139. package/dist/types/commands/meta/sessions.d.ts.map +1 -0
  140. package/dist/types/commands/meta/sim.d.ts +10 -0
  141. package/dist/types/commands/meta/sim.d.ts.map +1 -0
  142. package/dist/types/commands/meta/system.d.ts +8 -0
  143. package/dist/types/commands/meta/system.d.ts.map +1 -0
  144. package/dist/types/commands/meta/tabs.d.ts +6 -0
  145. package/dist/types/commands/meta/tabs.d.ts.map +1 -0
  146. package/dist/types/commands/meta/youtube.d.ts +7 -0
  147. package/dist/types/commands/meta/youtube.d.ts.map +1 -0
  148. package/dist/types/commands/read.d.ts +16 -0
  149. package/dist/types/commands/read.d.ts.map +1 -0
  150. package/dist/types/commands/write.d.ts +17 -0
  151. package/dist/types/commands/write.d.ts.map +1 -0
  152. package/dist/types/config.d.ts +101 -0
  153. package/dist/types/config.d.ts.map +1 -0
  154. package/dist/types/constants.d.ts +36 -0
  155. package/dist/types/constants.d.ts.map +1 -0
  156. package/dist/types/detection/frameworks.d.ts +27 -0
  157. package/dist/types/detection/frameworks.d.ts.map +1 -0
  158. package/dist/types/detection/index.d.ts +64 -0
  159. package/dist/types/detection/index.d.ts.map +1 -0
  160. package/dist/types/detection/infrastructure.d.ts +82 -0
  161. package/dist/types/detection/infrastructure.d.ts.map +1 -0
  162. package/dist/types/detection/saas.d.ts +39 -0
  163. package/dist/types/detection/saas.d.ts.map +1 -0
  164. package/dist/types/enable.d.ts +10 -0
  165. package/dist/types/enable.d.ts.map +1 -0
  166. package/dist/types/engine/chrome.d.ts +45 -0
  167. package/dist/types/engine/chrome.d.ts.map +1 -0
  168. package/dist/types/engine/index.d.ts +9 -0
  169. package/dist/types/engine/index.d.ts.map +1 -0
  170. package/dist/types/engine/providers.d.ts +36 -0
  171. package/dist/types/engine/providers.d.ts.map +1 -0
  172. package/dist/types/engine/resolver.d.ts +36 -0
  173. package/dist/types/engine/resolver.d.ts.map +1 -0
  174. package/dist/types/expect.d.ts +68 -0
  175. package/dist/types/expect.d.ts.map +1 -0
  176. package/dist/types/export/index.d.ts +8 -0
  177. package/dist/types/export/index.d.ts.map +1 -0
  178. package/dist/types/export/record.d.ts +28 -0
  179. package/dist/types/export/record.d.ts.map +1 -0
  180. package/dist/types/export/replay.d.ts +9 -0
  181. package/dist/types/export/replay.d.ts.map +1 -0
  182. package/dist/types/flow-parser.d.ts +32 -0
  183. package/dist/types/flow-parser.d.ts.map +1 -0
  184. package/dist/types/install-skill.d.ts +8 -0
  185. package/dist/types/install-skill.d.ts.map +1 -0
  186. package/dist/types/lib.d.ts +27 -0
  187. package/dist/types/lib.d.ts.map +1 -0
  188. package/dist/types/mcp/index.d.ts +10 -0
  189. package/dist/types/mcp/index.d.ts.map +1 -0
  190. package/dist/types/mcp/server.d.ts +9 -0
  191. package/dist/types/mcp/server.d.ts.map +1 -0
  192. package/dist/types/mcp/tools/index.d.ts +36 -0
  193. package/dist/types/mcp/tools/index.d.ts.map +1 -0
  194. package/dist/types/network/buffers.d.ts +53 -0
  195. package/dist/types/network/buffers.d.ts.map +1 -0
  196. package/dist/types/network/har.d.ts +10 -0
  197. package/dist/types/network/har.d.ts.map +1 -0
  198. package/dist/types/network/index.d.ts +6 -0
  199. package/dist/types/network/index.d.ts.map +1 -0
  200. package/dist/types/perf-audit/diff.d.ts +43 -0
  201. package/dist/types/perf-audit/diff.d.ts.map +1 -0
  202. package/dist/types/perf-audit/dom-analysis.d.ts +74 -0
  203. package/dist/types/perf-audit/dom-analysis.d.ts.map +1 -0
  204. package/dist/types/perf-audit/formatter.d.ts +34 -0
  205. package/dist/types/perf-audit/formatter.d.ts.map +1 -0
  206. package/dist/types/perf-audit/index.d.ts +128 -0
  207. package/dist/types/perf-audit/index.d.ts.map +1 -0
  208. package/dist/types/perf-audit/persist.d.ts +40 -0
  209. package/dist/types/perf-audit/persist.d.ts.map +1 -0
  210. package/dist/types/perf-audit/recommendations.d.ts +18 -0
  211. package/dist/types/perf-audit/recommendations.d.ts.map +1 -0
  212. package/dist/types/perf-audit/resource-analyzer.d.ts +46 -0
  213. package/dist/types/perf-audit/resource-analyzer.d.ts.map +1 -0
  214. package/dist/types/perf-audit/web-vitals.d.ts +73 -0
  215. package/dist/types/perf-audit/web-vitals.d.ts.map +1 -0
  216. package/dist/types/proxy/index.d.ts +6 -0
  217. package/dist/types/proxy/index.d.ts.map +1 -0
  218. package/dist/types/proxy/pool.d.ts +44 -0
  219. package/dist/types/proxy/pool.d.ts.map +1 -0
  220. package/dist/types/proxy/providers.d.ts +32 -0
  221. package/dist/types/proxy/providers.d.ts.map +1 -0
  222. package/dist/types/sdk/client.d.ts +37 -0
  223. package/dist/types/sdk/client.d.ts.map +1 -0
  224. package/dist/types/sdk/index.d.ts +17 -0
  225. package/dist/types/sdk/index.d.ts.map +1 -0
  226. package/dist/types/sdk/session.d.ts +95 -0
  227. package/dist/types/sdk/session.d.ts.map +1 -0
  228. package/dist/types/sdk/transports/cloud.d.ts +89 -0
  229. package/dist/types/sdk/transports/cloud.d.ts.map +1 -0
  230. package/dist/types/sdk/transports/index.d.ts +3 -0
  231. package/dist/types/sdk/transports/index.d.ts.map +1 -0
  232. package/dist/types/sdk/transports/local.d.ts +56 -0
  233. package/dist/types/sdk/transports/local.d.ts.map +1 -0
  234. package/dist/types/sdk.d.ts +35 -0
  235. package/dist/types/sdk.d.ts.map +1 -0
  236. package/dist/types/security/auth-vault.d.ts +32 -0
  237. package/dist/types/security/auth-vault.d.ts.map +1 -0
  238. package/dist/types/security/domain-filter.d.ts +31 -0
  239. package/dist/types/security/domain-filter.d.ts.map +1 -0
  240. package/dist/types/security/index.d.ts +10 -0
  241. package/dist/types/security/index.d.ts.map +1 -0
  242. package/dist/types/security/policy.d.ts +20 -0
  243. package/dist/types/security/policy.d.ts.map +1 -0
  244. package/dist/types/security/sanitize.d.ts +6 -0
  245. package/dist/types/security/sanitize.d.ts.map +1 -0
  246. package/dist/types/server.d.ts +13 -0
  247. package/dist/types/server.d.ts.map +1 -0
  248. package/dist/types/session/concurrency.d.ts +28 -0
  249. package/dist/types/session/concurrency.d.ts.map +1 -0
  250. package/dist/types/session/encryption.d.ts +8 -0
  251. package/dist/types/session/encryption.d.ts.map +1 -0
  252. package/dist/types/session/index.d.ts +7 -0
  253. package/dist/types/session/index.d.ts.map +1 -0
  254. package/dist/types/session/manager.d.ts +110 -0
  255. package/dist/types/session/manager.d.ts.map +1 -0
  256. package/dist/types/session/persist.d.ts +87 -0
  257. package/dist/types/session/persist.d.ts.map +1 -0
  258. package/dist/types/session/tab-lock.d.ts +26 -0
  259. package/dist/types/session/tab-lock.d.ts.map +1 -0
  260. package/dist/types/session/target-factory.d.ts +88 -0
  261. package/dist/types/session/target-factory.d.ts.map +1 -0
  262. package/dist/types/sim-cli.d.ts +8 -0
  263. package/dist/types/sim-cli.d.ts.map +1 -0
  264. package/dist/types/types.d.ts +45 -0
  265. package/dist/types/types.d.ts.map +1 -0
  266. package/dist/types/visual.d.ts +79 -0
  267. package/dist/types/visual.d.ts.map +1 -0
  268. package/package.json +22 -3
  269. package/skill/browse/SKILL.md +286 -0
  270. package/skill/{references → browse/references}/commands.md +203 -18
  271. package/skill/browse-aeo/SKILL.md +148 -0
  272. package/skill/browse-config/SKILL.md +200 -0
  273. package/skill/browse-geo/SKILL.md +225 -0
  274. package/skill/browse-qa/SKILL.md +143 -0
  275. package/skill/browse-seo/SKILL.md +188 -0
  276. package/skill/browse-stealth/SKILL.md +246 -0
  277. package/skill/SKILL.md +0 -496
  278. /package/skill/{references → browse/references}/guides.md +0 -0
  279. /package/skill/{references → browse/references}/permissions.md +0 -0
@@ -0,0 +1,9 @@
1
+ /**
2
+ * MCP (Model Context Protocol) server for @ulpi/browse.
3
+ *
4
+ * Exposes all browse commands as MCP tools over stdio transport.
5
+ * Each tool call maps to a browse command executed against a local
6
+ * BrowserTarget instance (no HTTP server needed).
7
+ */
8
+ export declare function startMcpServer(jsonMode: boolean): Promise<void>;
9
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/mcp/server.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAyBH,wBAAsB,cAAc,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAkKrE"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * MCP tool definitions registry — derives tool definitions from the
3
+ * command registry's MCP metadata. No hand-maintained tool arrays.
4
+ */
5
+ export interface ToolProperty {
6
+ type: string;
7
+ description: string;
8
+ enum?: string[];
9
+ default?: unknown;
10
+ }
11
+ export interface ToolDefinition {
12
+ name: string;
13
+ description: string;
14
+ inputSchema: {
15
+ type: 'object';
16
+ properties: Record<string, ToolProperty>;
17
+ required?: string[];
18
+ };
19
+ }
20
+ /**
21
+ * Returns all MCP tool definitions for browse commands.
22
+ * Derived from registry — commands with `mcp` metadata are exposed as tools.
23
+ */
24
+ export declare function getToolDefinitions(): ToolDefinition[];
25
+ /**
26
+ * Map an MCP tool call to a browse command + args array.
27
+ *
28
+ * Looks up the command definition (preferred) or spec in the registry and uses
29
+ * its argDecode function to convert MCP params into CLI args. Virtual tools
30
+ * (e.g. perf-audit-save) use `mcp.commandName` to route to the actual handler.
31
+ */
32
+ export declare function mapToolCallToCommand(toolName: string, params: Record<string, unknown>): {
33
+ command: string;
34
+ args: string[];
35
+ };
36
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/mcp/tools/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ,CAAC;QACf,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;QACzC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;KACrB,CAAC;CACH;AAID;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,cAAc,EAAE,CAQrD;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,CAuBrC"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Shared buffers and types — extracted to break circular dependency
3
+ * between server.ts and browser-manager.ts
4
+ */
5
+ export interface LogEntry {
6
+ timestamp: number;
7
+ level: string;
8
+ text: string;
9
+ }
10
+ export interface NetworkEntry {
11
+ timestamp: number;
12
+ method: string;
13
+ url: string;
14
+ status?: number;
15
+ duration?: number;
16
+ size?: number;
17
+ /** Request headers (populated when body capture is enabled) */
18
+ requestHeaders?: Record<string, string>;
19
+ /** Request body — POST/PUT/PATCH only (populated when body capture is enabled) */
20
+ requestBody?: string;
21
+ /** Response headers (populated when body capture is enabled) */
22
+ responseHeaders?: Record<string, string>;
23
+ /** Response body — text-like content types only, capped at NETWORK_BODY_LIMIT (populated when body capture is enabled) */
24
+ responseBody?: string;
25
+ }
26
+ /**
27
+ * Per-session buffer container.
28
+ * Each session (or parallel agent) gets its own instance so buffers
29
+ * don't bleed across concurrent operations.
30
+ */
31
+ export declare class SessionBuffers {
32
+ consoleBuffer: LogEntry[];
33
+ networkBuffer: NetworkEntry[];
34
+ consoleTotalAdded: number;
35
+ networkTotalAdded: number;
36
+ lastConsoleFlushed: number;
37
+ lastNetworkFlushed: number;
38
+ consoleErrorCount: number;
39
+ networkPendingCount: number;
40
+ onConsoleEntry?: (entry: LogEntry) => void;
41
+ onNetworkEntry?: (entry: NetworkEntry) => void;
42
+ addConsoleEntry(entry: LogEntry): void;
43
+ addNetworkEntry(entry: NetworkEntry): void;
44
+ /** Called when a network entry gets its status (response arrived). */
45
+ resolveNetworkEntry(): void;
46
+ }
47
+ export declare const consoleBuffer: LogEntry[];
48
+ export declare const networkBuffer: NetworkEntry[];
49
+ export declare let consoleTotalAdded: number;
50
+ export declare let networkTotalAdded: number;
51
+ export declare function addConsoleEntry(entry: LogEntry): void;
52
+ export declare function addNetworkEntry(entry: NetworkEntry): void;
53
+ //# sourceMappingURL=buffers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buffers.d.ts","sourceRoot":"","sources":["../../../src/network/buffers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,MAAM,WAAW,QAAQ;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,+DAA+D;IAC/D,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,kFAAkF;IAClF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gEAAgE;IAChE,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,0HAA0H;IAC1H,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;GAIG;AACH,qBAAa,cAAc;IACzB,aAAa,EAAE,QAAQ,EAAE,CAAM;IAC/B,aAAa,EAAE,YAAY,EAAE,CAAM;IACnC,iBAAiB,SAAK;IACtB,iBAAiB,SAAK;IAEtB,kBAAkB,SAAK;IACvB,kBAAkB,SAAK;IAEvB,iBAAiB,SAAK;IACtB,mBAAmB,SAAK;IAGxB,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAC;IAC3C,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;IAE/C,eAAe,CAAC,KAAK,EAAE,QAAQ;IAW/B,eAAe,CAAC,KAAK,EAAE,YAAY;IAWnC,sEAAsE;IACtE,mBAAmB;CAGpB;AAOD,eAAO,MAAM,aAAa,EAAE,QAAQ,EAAO,CAAC;AAC5C,eAAO,MAAM,aAAa,EAAE,YAAY,EAAO,CAAC;AAIhD,eAAO,IAAI,iBAAiB,QAAI,CAAC;AACjC,eAAO,IAAI,iBAAiB,QAAI,CAAC;AAEjC,wBAAgB,eAAe,CAAC,KAAK,EAAE,QAAQ,QAM9C;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,YAAY,QAMlD"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * HAR 1.2 export — converts NetworkEntry[] to HTTP Archive format
3
+ */
4
+ import type { NetworkEntry } from './buffers';
5
+ export interface HarRecording {
6
+ startTime: number;
7
+ active: boolean;
8
+ }
9
+ export declare function formatAsHar(entries: NetworkEntry[], startTime: number): object;
10
+ //# sourceMappingURL=har.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"har.d.ts","sourceRoot":"","sources":["../../../src/network/har.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE9C,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;CACjB;AAWD,wBAAgB,WAAW,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CA+C9E"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Network domain — buffers, HAR export, and network types.
3
+ */
4
+ export { type LogEntry, type NetworkEntry, SessionBuffers, consoleBuffer, networkBuffer, consoleTotalAdded, networkTotalAdded, addConsoleEntry, addNetworkEntry, } from './buffers';
5
+ export { type HarRecording, formatAsHar, } from './har';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/network/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,YAAY,EACjB,cAAc,EACd,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,eAAe,GAChB,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,KAAK,YAAY,EACjB,WAAW,GACZ,MAAM,OAAO,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Diff engine for perf-audit reports.
3
+ *
4
+ * Compares two PerfAuditReport snapshots (baseline vs current) and produces
5
+ * a structured diff with regression/improvement detection. Thresholds are
6
+ * aligned with Web Vitals "good" boundaries so small natural variance does
7
+ * not trigger false positives.
8
+ */
9
+ import type { PerfAuditReport } from './index';
10
+ export interface MetricDelta {
11
+ metric: string;
12
+ baseline: number | null;
13
+ current: number | null;
14
+ /** Absolute change (current - baseline) for timing/size metrics */
15
+ deltaMs?: number;
16
+ /** Percentage change ((current - baseline) / baseline * 100) */
17
+ deltaPct?: number;
18
+ verdict: 'regression' | 'improvement' | 'unchanged' | 'new' | 'missing';
19
+ }
20
+ export interface AuditDiff {
21
+ webVitals: MetricDelta[];
22
+ resourceSize: MetricDelta[];
23
+ coverage: MetricDelta[];
24
+ fixableCount: {
25
+ baseline: number;
26
+ current: number;
27
+ delta: number;
28
+ };
29
+ summary: {
30
+ regressions: number;
31
+ improvements: number;
32
+ unchanged: number;
33
+ };
34
+ }
35
+ /**
36
+ * Compare two PerfAuditReport snapshots and produce a structured diff.
37
+ *
38
+ * @param baseline - The earlier (reference) report
39
+ * @param current - The later (comparison) report
40
+ * @returns AuditDiff with per-metric verdicts and a summary
41
+ */
42
+ export declare function diffAuditReports(baseline: PerfAuditReport, current: PerfAuditReport): AuditDiff;
43
+ //# sourceMappingURL=diff.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../../src/perf-audit/diff.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAkB,MAAM,SAAS,CAAC;AAM/D,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,mEAAmE;IACnE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gEAAgE;IAChE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,YAAY,GAAG,aAAa,GAAG,WAAW,GAAG,KAAK,GAAG,SAAS,CAAC;CACzE;AAED,MAAM,WAAW,SAAS;IACxB,SAAS,EAAE,WAAW,EAAE,CAAC;IACzB,YAAY,EAAE,WAAW,EAAE,CAAC;IAC5B,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,YAAY,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IACnE,OAAO,EAAE;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;CAC3E;AA4LD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,eAAe,GACvB,SAAS,CAuEX"}
@@ -0,0 +1,74 @@
1
+ /**
2
+ * DOM complexity analysis and cross-metric correlation engine.
3
+ *
4
+ * analyzeDOMComplexity() evaluates the page DOM for node count, nesting
5
+ * depth, and largest subtree -- all factors that affect rendering cost.
6
+ *
7
+ * buildCorrelationReport() cross-references Web Vitals, resource data,
8
+ * and network entries to produce actionable attribution for LCP, CLS,
9
+ * TBT, and font-blocking issues.
10
+ */
11
+ import type { Page } from 'playwright';
12
+ import type { WebVitalsReport } from './web-vitals';
13
+ import type { ResourceReport } from './resource-analyzer';
14
+ import type { NetworkEntry } from '../network/buffers';
15
+ export interface DOMComplexityReport {
16
+ totalNodes: number;
17
+ maxDepth: number;
18
+ largestSubtree: {
19
+ tag: string;
20
+ id: string | null;
21
+ className: string | null;
22
+ descendants: number;
23
+ } | null;
24
+ htmlSizeKB: number;
25
+ }
26
+ export interface CorrelationReport {
27
+ lcpAnalysis: {
28
+ element: string;
29
+ networkEntry: {
30
+ url: string;
31
+ sizeBytes: number;
32
+ durationMs: number;
33
+ } | null;
34
+ blockingResources: string[];
35
+ criticalPath: string;
36
+ } | null;
37
+ clsAttribution: Array<{
38
+ time: number;
39
+ value: number;
40
+ reason: string;
41
+ sourceElement: string;
42
+ }>;
43
+ longTaskAttribution: Array<{
44
+ domain: string;
45
+ totalTbtMs: number;
46
+ taskCount: number;
47
+ scripts: string[];
48
+ }>;
49
+ fontBlockingFcp: Array<{
50
+ family: string;
51
+ fontDisplay: string | null;
52
+ blockingMs: number | null;
53
+ }>;
54
+ }
55
+ /**
56
+ * Evaluate the page DOM for total node count, maximum nesting depth,
57
+ * the largest direct-child subtree of <body>, and overall HTML size.
58
+ *
59
+ * Runs inside page.evaluate() to avoid serializing the entire DOM across
60
+ * the Playwright wire. The subtree scan is limited to body > * children
61
+ * to avoid O(n^2) cost on deeply nested pages.
62
+ */
63
+ export declare function analyzeDOMComplexity(page: Page): Promise<DOMComplexityReport>;
64
+ /**
65
+ * Cross-reference Web Vitals, resource analysis, and raw network entries
66
+ * to produce actionable attribution for each core metric:
67
+ *
68
+ * - LCP: identify the element, its network cost, blocking resources, critical path
69
+ * - CLS: attribute each layout shift to images, fonts, ads, or dynamic content
70
+ * - Long Tasks: group by domain with TBT contribution
71
+ * - Font blocking: identify fonts that may have blocked FCP via FOIT
72
+ */
73
+ export declare function buildCorrelationReport(webVitals: WebVitalsReport, resources: ResourceReport, networkEntries: NetworkEntry[]): CorrelationReport;
74
+ //# sourceMappingURL=dom-analysis.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dom-analysis.d.ts","sourceRoot":"","sources":["../../../src/perf-audit/dom-analysis.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAMvD,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE;QACd,GAAG,EAAE,MAAM,CAAC;QACZ,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;QAClB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;QACzB,WAAW,EAAE,MAAM,CAAC;KACrB,GAAG,IAAI,CAAC;IACT,UAAU,EAAE,MAAM,CAAC;CACpB;AAMD,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE;QACX,OAAO,EAAE,MAAM,CAAC;QAChB,YAAY,EAAE;YAAE,GAAG,EAAE,MAAM,CAAC;YAAC,SAAS,EAAE,MAAM,CAAC;YAAC,UAAU,EAAE,MAAM,CAAA;SAAE,GAAG,IAAI,CAAC;QAC5E,iBAAiB,EAAE,MAAM,EAAE,CAAC;QAC5B,YAAY,EAAE,MAAM,CAAC;KACtB,GAAG,IAAI,CAAC;IAET,cAAc,EAAE,KAAK,CAAC;QACpB,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,aAAa,EAAE,MAAM,CAAC;KACvB,CAAC,CAAC;IAEH,mBAAmB,EAAE,KAAK,CAAC;QACzB,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,EAAE,CAAC;KACnB,CAAC,CAAC;IAEH,eAAe,EAAE,KAAK,CAAC;QACrB,MAAM,EAAE,MAAM,CAAC;QACf,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;QAC3B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;KAC3B,CAAC,CAAC;CACJ;AAMD;;;;;;;GAOG;AACH,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAuDnF;AA8ID;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,eAAe,EAC1B,SAAS,EAAE,cAAc,EACzB,cAAc,EAAE,YAAY,EAAE,GAC7B,iBAAiB,CA6JnB"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Performance audit report formatter -- converts PerfAuditReport into
3
+ * human-readable text output (14 sections) or JSON output.
4
+ *
5
+ * The text formatter uses Google's Web Vitals thresholds for rating each
6
+ * metric, generates platform-aware recommendations when a SaaS platform
7
+ * is detected, and separates fixable items from platform constraints.
8
+ */
9
+ import type { PerfAuditReport, BudgetEvalResult } from './index';
10
+ /**
11
+ * Format a PerfAuditReport for output. When `json` is true, returns the
12
+ * report as pretty-printed JSON. Otherwise returns a human-readable text
13
+ * report with 14 sections, platform-aware recommendations, and Google
14
+ * Web Vitals ratings.
15
+ */
16
+ export declare function formatPerfAudit(report: PerfAuditReport, json?: boolean): string;
17
+ /**
18
+ * Format a BudgetEvalResult as a pass/fail table.
19
+ *
20
+ * Example output:
21
+ * Budget:
22
+ * ✓ LCP 1200ms ≤ 2500ms
23
+ * ✗ TBT 450ms > 300ms
24
+ * - INP --- (not measured, skipped)
25
+ */
26
+ export declare function formatBudgetResult(result: BudgetEvalResult): string;
27
+ import type { AuditDiff } from './diff';
28
+ /**
29
+ * Format an AuditDiff for output. When `json` is true, returns the diff as
30
+ * pretty-printed JSON. Otherwise returns a human-readable text report with
31
+ * Web Vitals, Resources, Coverage, and a summary line.
32
+ */
33
+ export declare function formatAuditDiff(diff: AuditDiff, json?: boolean): string;
34
+ //# sourceMappingURL=formatter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatter.d.ts","sourceRoot":"","sources":["../../../src/perf-audit/formatter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAkB,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAgFjF;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,eAAe,EACvB,IAAI,GAAE,OAAe,GACpB,MAAM,CAGR;AA+mBD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAyBnE;AAMD,OAAO,KAAK,EAAE,SAAS,EAAe,MAAM,QAAQ,CAAC;AAUrD;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,SAAS,EACf,IAAI,GAAE,OAAe,GACpB,MAAM,CAGR"}
@@ -0,0 +1,128 @@
1
+ /**
2
+ * Performance audit orchestrator -- ties together Web Vitals collection,
3
+ * resource analysis, DOM complexity measurement, coverage, and stack
4
+ * detection into a single actionable report.
5
+ *
6
+ * The audit flow:
7
+ * 1. Inject Web Vitals init script into the browser context
8
+ * 2. Optionally start code coverage (JS + CSS)
9
+ * 3. Reload the page to trigger fresh observers
10
+ * 4. Collect all metrics in parallel (web vitals, resources, DOM)
11
+ * 5. Optionally detect the technology stack
12
+ * 6. Stop coverage and compute unused bytes
13
+ * 7. Cross-reference metrics into a correlation report
14
+ * 8. Separate findings into fixable items vs platform limitations
15
+ */
16
+ import type { BrowserTarget } from '../browser/target';
17
+ import type { NetworkEntry } from '../network/buffers';
18
+ import type { WebVitalsReport } from './web-vitals';
19
+ import type { ResourceReport } from './resource-analyzer';
20
+ import type { DOMComplexityReport, CorrelationReport } from './dom-analysis';
21
+ import type { StackFingerprint } from '../detection';
22
+ export interface PerfAuditOptions {
23
+ /** Collect JS and CSS coverage data (default: true) */
24
+ includeCoverage?: boolean;
25
+ /** Run stack/framework/SaaS detection (default: true) */
26
+ includeDetection?: boolean;
27
+ }
28
+ /**
29
+ * Performance budget thresholds.
30
+ * Keys are metric names (case-insensitive), values are numeric thresholds.
31
+ * Supported keys: lcp, cls, tbt, fcp, ttfb, inp
32
+ */
33
+ export type PerfBudget = Record<string, number>;
34
+ export interface BudgetLineResult {
35
+ /** Metric key (lowercase), e.g. "lcp" */
36
+ key: string;
37
+ /** The measured value (null means metric was not available — skipped) */
38
+ measured: number | null;
39
+ /** The budget threshold */
40
+ threshold: number;
41
+ /** true = metric was not measured, skip rather than fail */
42
+ skipped: boolean;
43
+ /** true = metric passes budget, false = exceeds budget */
44
+ passed: boolean;
45
+ }
46
+ export interface BudgetEvalResult {
47
+ lines: BudgetLineResult[];
48
+ /** true when all non-skipped metrics pass their budgets */
49
+ allPassed: boolean;
50
+ }
51
+ /**
52
+ * Parse a budget string like "lcp:2500,cls:0.1,tbt:300" into a Record.
53
+ * Unknown keys are silently ignored. Throws on malformed numeric values.
54
+ */
55
+ export declare function parseBudget(raw: string): PerfBudget;
56
+ /**
57
+ * Evaluate measured web vitals against a budget.
58
+ * Pure function — deterministic, no I/O, safe to unit-test with fixed fixtures.
59
+ *
60
+ * @param vitals - Partial map of metric key -> measured value (null = not measured)
61
+ * @param budget - Budget thresholds (from parseBudget)
62
+ */
63
+ export declare function evaluateBudget(vitals: Partial<Record<string, number | null>>, budget: PerfBudget): BudgetEvalResult;
64
+ export interface CoverageResult {
65
+ js: Array<{
66
+ url: string;
67
+ totalBytes: number;
68
+ usedBytes: number;
69
+ unusedBytes: number;
70
+ unusedPct: number;
71
+ }>;
72
+ css: Array<{
73
+ url: string;
74
+ totalBytes: number;
75
+ usedBytes: number;
76
+ unusedBytes: number;
77
+ unusedPct: number;
78
+ }>;
79
+ }
80
+ export type SectionStatus = 'ok' | 'partial' | 'skipped' | 'failed';
81
+ export interface PerfAuditReport {
82
+ webVitals: WebVitalsReport;
83
+ resources: ResourceReport;
84
+ domComplexity: DOMComplexityReport;
85
+ correlations: CorrelationReport;
86
+ detection: StackFingerprint | null;
87
+ coverage: CoverageResult | null;
88
+ /** Actionable items the developer can fix */
89
+ fixable: string[];
90
+ /** Things constrained by the platform (SaaS/hosted) */
91
+ platformLimitations: string[];
92
+ /** Per-section status — tells agents exactly what worked and what didn't */
93
+ status: {
94
+ reload: SectionStatus;
95
+ webVitals: SectionStatus;
96
+ resources: SectionStatus;
97
+ domComplexity: SectionStatus;
98
+ detection: SectionStatus;
99
+ coverage: SectionStatus;
100
+ correlations: SectionStatus;
101
+ };
102
+ /** Human-readable warnings about partial failures or fallbacks */
103
+ warnings: string[];
104
+ /** Timing breakdown in ms — how long each phase took */
105
+ timing: {
106
+ totalMs: number;
107
+ reloadMs: number;
108
+ settleMs: number;
109
+ collectMs: number;
110
+ detectionMs: number;
111
+ coverageMs: number;
112
+ };
113
+ }
114
+ /**
115
+ * Run a full performance audit on the current page. Collects Web Vitals,
116
+ * analyzes resources, measures DOM complexity, optionally collects
117
+ * coverage and detects the technology stack, then cross-references
118
+ * everything into a single actionable report.
119
+ *
120
+ * The page is reloaded as part of the audit to inject the Web Vitals
121
+ * init script and collect fresh data.
122
+ *
123
+ * @param bm - BrowserManager with an active page
124
+ * @param networkEntries - Network entries from the session buffer
125
+ * @param options - Optional flags to skip coverage or detection
126
+ */
127
+ export declare function runPerfAudit(bm: BrowserTarget, networkEntries: NetworkEntry[], options?: PerfAuditOptions): Promise<PerfAuditReport>;
128
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/perf-audit/index.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Persistence layer for perf-audit reports.
3
+ *
4
+ * Saves, loads, lists, and deletes JSON report files under
5
+ * `<localDir>/audits/`. Follows the same patterns as the
6
+ * `state save/load/list` implementation in `commands/meta.ts`.
7
+ */
8
+ import type { PerfAuditReport } from './index';
9
+ /**
10
+ * Persist a perf-audit report as pretty-printed JSON.
11
+ *
12
+ * Creates the `audits/` directory if it does not exist.
13
+ * Returns the absolute path of the written file.
14
+ */
15
+ export declare function saveAudit(localDir: string, name: string, report: PerfAuditReport): string;
16
+ /**
17
+ * Load a previously-saved perf-audit report by name.
18
+ *
19
+ * Throws a descriptive error when the file does not exist so the
20
+ * caller (or the AI agent) knows exactly what to do next.
21
+ */
22
+ export declare function loadAudit(localDir: string, name: string): PerfAuditReport;
23
+ /**
24
+ * List every saved audit report.
25
+ *
26
+ * Returns an empty array (no crash) when the `audits/` directory
27
+ * does not yet exist. Results are sorted newest-first.
28
+ */
29
+ export declare function listAudits(localDir: string): Array<{
30
+ name: string;
31
+ sizeBytes: number;
32
+ date: string;
33
+ }>;
34
+ /**
35
+ * Delete a saved audit report by name.
36
+ *
37
+ * Throws when the file does not exist.
38
+ */
39
+ export declare function deleteAudit(localDir: string, name: string): void;
40
+ //# sourceMappingURL=persist.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"persist.d.ts","sourceRoot":"","sources":["../../../src/perf-audit/persist.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAkB/C;;;;;GAKG;AACH,wBAAgB,SAAS,CACvB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,eAAe,GACtB,MAAM,CAOR;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CACvB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,GACX,eAAe,CAQjB;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CACxB,QAAQ,EAAE,MAAM,GACf,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAoB1D;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAQhE"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Recommendation engine for performance audit reports.
3
+ *
4
+ * Generates 3-5 prioritized, actionable recommendations from actual measured
5
+ * data. When a SaaS platform is detected, includes platform-specific
6
+ * suggestions tailored to Shopify, WordPress, Magento, and Wix.
7
+ *
8
+ * Recommendations are scored by estimated impact (bytes saved or ms reduced)
9
+ * and returned sorted by priority.
10
+ */
11
+ import type { PerfAuditReport } from './index';
12
+ /**
13
+ * Analyze the full PerfAuditReport and produce a prioritized list of
14
+ * actionable recommendation strings. Returns up to ~15 candidates
15
+ * sorted by estimated impact; the caller should cap at 3-5.
16
+ */
17
+ export declare function generateRecommendations(report: PerfAuditReport): string[];
18
+ //# sourceMappingURL=recommendations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recommendations.d.ts","sourceRoot":"","sources":["../../../src/perf-audit/recommendations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAkB,MAAM,SAAS,CAAC;AAiD/D;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,EAAE,CAkIzE"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Resource analyzer — categorizes network resources and audits images,
3
+ * fonts, and render-blocking elements for performance issues.
4
+ */
5
+ import type { Page } from 'playwright';
6
+ import type { NetworkEntry } from '../network/buffers';
7
+ export interface ResourceCategory {
8
+ count: number;
9
+ totalSizeBytes: number;
10
+ largest: {
11
+ url: string;
12
+ sizeBytes: number;
13
+ } | null;
14
+ }
15
+ export interface ImageAuditItem {
16
+ src: string;
17
+ issues: string[];
18
+ }
19
+ export interface FontAuditItem {
20
+ family: string;
21
+ weight: string;
22
+ fontDisplay: string | null;
23
+ preloaded: boolean;
24
+ foitRisk: boolean;
25
+ }
26
+ export interface RenderBlockingItem {
27
+ type: 'script' | 'stylesheet';
28
+ url: string;
29
+ sizeBytes: number | null;
30
+ }
31
+ export interface ResourceReport {
32
+ categories: Record<string, ResourceCategory>;
33
+ thirdPartyByDomain: Record<string, {
34
+ count: number;
35
+ totalSizeBytes: number;
36
+ }>;
37
+ imageAudit: ImageAuditItem[];
38
+ fontAudit: FontAuditItem[];
39
+ renderBlocking: RenderBlockingItem[];
40
+ }
41
+ /**
42
+ * Analyze network resources and audit images, fonts, and render-blocking
43
+ * elements on the current page.
44
+ */
45
+ export declare function analyzeResources(networkEntries: NetworkEntry[], page: Page): Promise<ResourceReport>;
46
+ //# sourceMappingURL=resource-analyzer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource-analyzer.d.ts","sourceRoot":"","sources":["../../../src/perf-audit/resource-analyzer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAIvD,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CACpD;AAED,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,QAAQ,GAAG,YAAY,CAAC;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAC7C,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,cAAc,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC9E,UAAU,EAAE,cAAc,EAAE,CAAC;IAC7B,SAAS,EAAE,aAAa,EAAE,CAAC;IAC3B,cAAc,EAAE,kBAAkB,EAAE,CAAC;CACtC;AAibD;;;GAGG;AACH,wBAAsB,gBAAgB,CACpC,cAAc,EAAE,YAAY,EAAE,EAC9B,IAAI,EAAE,IAAI,GACT,OAAO,CAAC,cAAc,CAAC,CAwDzB"}
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Web Vitals observer injection and collection for performance auditing.
3
+ *
4
+ * WEB_VITALS_INIT_SCRIPT is a plain string IIFE injected via context.addInitScript()
5
+ * before any page JS runs. It sets up buffered PerformanceObservers for LCP, CLS,
6
+ * INP, long tasks, and paint timings on window.__BROWSE_PERF_METRICS.
7
+ *
8
+ * collectWebVitals() reads the accumulated metrics after navigation completes.
9
+ */
10
+ import type { Page } from 'playwright';
11
+ export interface WebVitalsReport {
12
+ /** Time to First Byte (ms) from Navigation Timing API */
13
+ ttfb: number;
14
+ /** First Contentful Paint (ms), null if not observed */
15
+ fcp: number | null;
16
+ /** Largest Contentful Paint (ms), null if not observed */
17
+ lcp: number | null;
18
+ /** Cumulative Layout Shift (unitless), null if not observed */
19
+ cls: number | null;
20
+ /** Total Blocking Time (ms), null if no long tasks */
21
+ tbt: number | null;
22
+ /** Interaction to Next Paint (ms) -- p98 of interaction durations, null if none */
23
+ inp: number | null;
24
+ /** Details about the LCP element */
25
+ lcpElement: {
26
+ tag: string;
27
+ id?: string;
28
+ url?: string;
29
+ size: number;
30
+ fetchpriority?: string;
31
+ loading?: string;
32
+ } | null;
33
+ /** Individual layout shift entries (excluding input-driven shifts) */
34
+ layoutShifts: Array<{
35
+ time: number;
36
+ value: number;
37
+ sources: Array<{
38
+ tag: string;
39
+ id?: string;
40
+ shift: string;
41
+ }>;
42
+ }>;
43
+ /** Long tasks (>50ms) observed during page load */
44
+ longTasks: Array<{
45
+ time: number;
46
+ duration: number;
47
+ scriptUrl: string | null;
48
+ }>;
49
+ /** Raw paint timing entries */
50
+ paintTimings: {
51
+ fp: number | null;
52
+ fcp: number | null;
53
+ };
54
+ }
55
+ /**
56
+ * IIFE string that installs buffered PerformanceObservers on
57
+ * window.__BROWSE_PERF_METRICS. Each observer type is wrapped in its own
58
+ * try/catch so unsupported entry types degrade gracefully.
59
+ *
60
+ * Must be a plain string (not a function reference) because Playwright's
61
+ * addInitScript serialises string arguments directly into the page context.
62
+ */
63
+ export declare const WEB_VITALS_INIT_SCRIPT = "(function() {\n if (window.__BROWSE_PERF_METRICS) return;\n\n var m = window.__BROWSE_PERF_METRICS = {\n lcp: null,\n lcpElement: null,\n cls: 0,\n clsShifts: [],\n inp: null,\n _interactions: [],\n longTasks: [],\n tbt: 0,\n paintFP: null,\n paintFCP: null\n };\n\n // 1. Largest Contentful Paint -------------------------------------------\n try {\n new PerformanceObserver(function(list) {\n var entries = list.getEntries();\n for (var i = 0; i < entries.length; i++) {\n var e = entries[i];\n m.lcp = e.startTime;\n var el = e.element;\n m.lcpElement = {\n tag: el ? el.tagName.toLowerCase() : 'unknown',\n id: el && el.id ? el.id : undefined,\n className: el && el.className ? String(el.className) : undefined,\n url: e.url || undefined,\n size: e.size || 0,\n fetchpriority: el ? el.getAttribute('fetchpriority') || undefined : undefined,\n loading: el ? el.getAttribute('loading') || undefined : undefined\n };\n }\n }).observe({ type: 'largest-contentful-paint', buffered: true });\n } catch(_) {}\n\n // 2. Layout Shift (CLS) -------------------------------------------------\n try {\n new PerformanceObserver(function(list) {\n var entries = list.getEntries();\n for (var i = 0; i < entries.length; i++) {\n var e = entries[i];\n var sources = [];\n if (e.sources) {\n for (var j = 0; j < e.sources.length; j++) {\n var s = e.sources[j];\n var node = s.node;\n sources.push({\n tag: node ? node.tagName.toLowerCase() : 'unknown',\n id: node && node.id ? node.id : undefined,\n currentRect: s.currentRect\n ? s.currentRect.x + ',' + s.currentRect.y + ' ' + s.currentRect.width + 'x' + s.currentRect.height\n : null,\n previousRect: s.previousRect\n ? s.previousRect.x + ',' + s.previousRect.y + ' ' + s.previousRect.width + 'x' + s.previousRect.height\n : null\n });\n }\n }\n m.clsShifts.push({\n value: e.value,\n startTime: e.startTime,\n hadRecentInput: e.hadRecentInput,\n sources: sources\n });\n // CLS excludes input-driven shifts\n if (!e.hadRecentInput) {\n m.cls += e.value;\n }\n }\n }).observe({ type: 'layout-shift', buffered: true });\n } catch(_) {}\n\n // 3. Event timing (INP) -------------------------------------------------\n try {\n new PerformanceObserver(function(list) {\n var entries = list.getEntries();\n for (var i = 0; i < entries.length; i++) {\n var e = entries[i];\n m._interactions.push(e.duration);\n }\n }).observe({ type: 'event', buffered: true, durationThreshold: 16 });\n } catch(_) {}\n\n // 4. Long Tasks (TBT) ---------------------------------------------------\n try {\n new PerformanceObserver(function(list) {\n var entries = list.getEntries();\n for (var i = 0; i < entries.length; i++) {\n var e = entries[i];\n var attr = e.attribution && e.attribution[0];\n m.longTasks.push({\n startTime: e.startTime,\n duration: e.duration,\n containerSrc: attr ? attr.containerSrc || null : null,\n containerName: attr ? attr.containerName || null : null\n });\n // TBT = sum of (duration - 50ms) for each long task\n if (e.duration > 50) {\n m.tbt += (e.duration - 50);\n }\n }\n }).observe({ type: 'longtask', buffered: true });\n } catch(_) {}\n\n // 5. Paint (FP + FCP) ---------------------------------------------------\n try {\n new PerformanceObserver(function(list) {\n var entries = list.getEntries();\n for (var i = 0; i < entries.length; i++) {\n var e = entries[i];\n if (e.name === 'first-paint') m.paintFP = e.startTime;\n if (e.name === 'first-contentful-paint') m.paintFCP = e.startTime;\n }\n }).observe({ type: 'paint', buffered: true });\n } catch(_) {}\n})();";
64
+ /**
65
+ * Collect Web Vitals metrics from a page that had WEB_VITALS_INIT_SCRIPT
66
+ * injected before navigation. Also reads TTFB from the Navigation Timing API.
67
+ *
68
+ * Returns a structured WebVitalsReport. Fields are null when the browser did
69
+ * not emit the corresponding PerformanceObserver entries (e.g. no interactions
70
+ * means INP is null).
71
+ */
72
+ export declare function collectWebVitals(page: Page): Promise<WebVitalsReport>;
73
+ //# sourceMappingURL=web-vitals.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web-vitals.d.ts","sourceRoot":"","sources":["../../../src/perf-audit/web-vitals.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAMvC,MAAM,WAAW,eAAe;IAC9B,yDAAyD;IACzD,IAAI,EAAE,MAAM,CAAC;IACb,wDAAwD;IACxD,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,0DAA0D;IAC1D,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,+DAA+D;IAC/D,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,sDAAsD;IACtD,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,mFAAmF;IACnF,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,oCAAoC;IACpC,UAAU,EAAE;QACV,GAAG,EAAE,MAAM,CAAC;QACZ,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,GAAG,IAAI,CAAC;IACT,sEAAsE;IACtE,YAAY,EAAE,KAAK,CAAC;QAClB,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,KAAK,CAAC;YAAE,GAAG,EAAE,MAAM,CAAC;YAAC,EAAE,CAAC,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KAC7D,CAAC,CAAC;IACH,mDAAmD;IACnD,SAAS,EAAE,KAAK,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;KAC1B,CAAC,CAAC;IACH,+BAA+B;IAC/B,YAAY,EAAE;QAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;CACzD;AAMD;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,imIAqH7B,CAAC;AAMP;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,eAAe,CAAC,CA2H3E"}