pi-agent-browser-native 0.9.4 → 0.9.6

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 (388) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/README.md +60 -812
  3. package/dist/extensions/agent-browser/index.js +2381 -1706
  4. package/dist/packaged/lib/browser-session-conversion.js +2810 -0
  5. package/dist/packaged/lib/config-policy.js +599 -0
  6. package/dist/packaged/lib/parsing.js +34 -0
  7. package/dist/packaged/lib/playbook.js +694 -0
  8. package/dist/packaged/lib/results/snapshot.js +2671 -0
  9. package/dist/packaged/lib/runtime.js +3027 -0
  10. package/docs/ARCHITECTURE.md +14 -3
  11. package/docs/CODE_QUALITY.md +39 -3
  12. package/docs/COMMAND_REFERENCE.md +22 -22
  13. package/docs/ELECTRON.md +24 -2
  14. package/docs/PERFORMANCE.md +243 -0
  15. package/docs/REFERENCE.md +869 -0
  16. package/docs/RELEASE.md +9 -9
  17. package/docs/REQUIREMENTS.md +1 -1
  18. package/docs/SESSION_STORAGE.md +11 -3
  19. package/docs/SUPPORT_MATRIX.md +16 -11
  20. package/docs/TOOL_CONTRACT.md +17 -13
  21. package/docs/performance/2026-10-12.json +7257 -0
  22. package/docs/platform-smoke.md +3 -3
  23. package/package.json +15 -3
  24. package/scripts/build.mjs +16 -5
  25. package/scripts/config.mjs +24 -20
  26. package/scripts/convert-browser-session.mjs +1 -1
  27. package/scripts/doctor.mjs +2 -2
  28. package/scripts/platform-smoke/lease-evidence.mjs +2 -4
  29. package/scripts/platform-smoke/linux-image/Dockerfile +8 -2
  30. package/scripts/platform-smoke/targets.mjs +1 -5
  31. package/dist/extensions/agent-browser/lib/argv-descriptor.js +0 -123
  32. package/dist/extensions/agent-browser/lib/argv-grammar.js +0 -320
  33. package/dist/extensions/agent-browser/lib/bash-guard.js +0 -193
  34. package/dist/extensions/agent-browser/lib/batch-lifecycle.js +0 -131
  35. package/dist/extensions/agent-browser/lib/browser-execution-claim-codec.js +0 -61
  36. package/dist/extensions/agent-browser/lib/browser-execution-claim-storage.js +0 -232
  37. package/dist/extensions/agent-browser/lib/browser-execution-claims.js +0 -202
  38. package/dist/extensions/agent-browser/lib/browser-execution-identity.js +0 -77
  39. package/dist/extensions/agent-browser/lib/browser-journal-branch.js +0 -98
  40. package/dist/extensions/agent-browser/lib/browser-journal-contracts.js +0 -1
  41. package/dist/extensions/agent-browser/lib/browser-journal-projection.js +0 -221
  42. package/dist/extensions/agent-browser/lib/browser-journal-reader.js +0 -89
  43. package/dist/extensions/agent-browser/lib/browser-journal-replay.js +0 -246
  44. package/dist/extensions/agent-browser/lib/browser-journal.js +0 -148
  45. package/dist/extensions/agent-browser/lib/browser-legacy-pages.js +0 -220
  46. package/dist/extensions/agent-browser/lib/browser-legacy-projection.js +0 -282
  47. package/dist/extensions/agent-browser/lib/browser-legacy-types.js +0 -1
  48. package/dist/extensions/agent-browser/lib/browser-session-conversion-stream.js +0 -217
  49. package/dist/extensions/agent-browser/lib/browser-session-conversion.js +0 -126
  50. package/dist/extensions/agent-browser/lib/browser-transcript-contracts.js +0 -35
  51. package/dist/extensions/agent-browser/lib/browser-transcript-validation.js +0 -166
  52. package/dist/extensions/agent-browser/lib/browser-transcript.js +0 -189
  53. package/dist/extensions/agent-browser/lib/browser-value-parsing.js +0 -15
  54. package/dist/extensions/agent-browser/lib/command-capabilities.js +0 -340
  55. package/dist/extensions/agent-browser/lib/command-policy.js +0 -155
  56. package/dist/extensions/agent-browser/lib/command-taxonomy.js +0 -105
  57. package/dist/extensions/agent-browser/lib/config-policy.js +0 -450
  58. package/dist/extensions/agent-browser/lib/config-providers.js +0 -71
  59. package/dist/extensions/agent-browser/lib/config-validation.js +0 -218
  60. package/dist/extensions/agent-browser/lib/config.js +0 -69
  61. package/dist/extensions/agent-browser/lib/electron/cdp.js +0 -58
  62. package/dist/extensions/agent-browser/lib/electron/cleanup.js +0 -308
  63. package/dist/extensions/agent-browser/lib/electron/discovery-darwin.js +0 -109
  64. package/dist/extensions/agent-browser/lib/electron/discovery-desktop.js +0 -136
  65. package/dist/extensions/agent-browser/lib/electron/discovery-evidence.js +0 -89
  66. package/dist/extensions/agent-browser/lib/electron/discovery-linux.js +0 -93
  67. package/dist/extensions/agent-browser/lib/electron/discovery-packages.js +0 -162
  68. package/dist/extensions/agent-browser/lib/electron/discovery-types.js +0 -2
  69. package/dist/extensions/agent-browser/lib/electron/discovery.js +0 -217
  70. package/dist/extensions/agent-browser/lib/electron/launch-monitor.js +0 -102
  71. package/dist/extensions/agent-browser/lib/electron/launch-process.js +0 -209
  72. package/dist/extensions/agent-browser/lib/electron/launch-types.js +0 -2
  73. package/dist/extensions/agent-browser/lib/electron/launch.js +0 -329
  74. package/dist/extensions/agent-browser/lib/executable-path.js +0 -29
  75. package/dist/extensions/agent-browser/lib/execution-cwd.js +0 -67
  76. package/dist/extensions/agent-browser/lib/fs-utils.js +0 -18
  77. package/dist/extensions/agent-browser/lib/input-modes/electron.js +0 -201
  78. package/dist/extensions/agent-browser/lib/input-modes/job.js +0 -195
  79. package/dist/extensions/agent-browser/lib/input-modes/lookup-network-evidence.js +0 -104
  80. package/dist/extensions/agent-browser/lib/input-modes/lookup-plan.js +0 -132
  81. package/dist/extensions/agent-browser/lib/input-modes/lookup-redaction.js +0 -57
  82. package/dist/extensions/agent-browser/lib/input-modes/lookup-source-evidence.js +0 -151
  83. package/dist/extensions/agent-browser/lib/input-modes/lookup-workspace.js +0 -142
  84. package/dist/extensions/agent-browser/lib/input-modes/lookups.js +0 -83
  85. package/dist/extensions/agent-browser/lib/input-modes/params.js +0 -195
  86. package/dist/extensions/agent-browser/lib/input-modes/qa-analysis.js +0 -268
  87. package/dist/extensions/agent-browser/lib/input-modes/qa-presentation.js +0 -117
  88. package/dist/extensions/agent-browser/lib/input-modes/script-child.js +0 -396
  89. package/dist/extensions/agent-browser/lib/input-modes/script-protocol.js +0 -86
  90. package/dist/extensions/agent-browser/lib/input-modes/script-types.js +0 -1
  91. package/dist/extensions/agent-browser/lib/input-modes/script-validation.js +0 -60
  92. package/dist/extensions/agent-browser/lib/input-modes/script.js +0 -108
  93. package/dist/extensions/agent-browser/lib/input-modes/semantic-action.js +0 -243
  94. package/dist/extensions/agent-browser/lib/input-modes/shared.js +0 -48
  95. package/dist/extensions/agent-browser/lib/input-modes/types.js +0 -65
  96. package/dist/extensions/agent-browser/lib/json-schema.js +0 -65
  97. package/dist/extensions/agent-browser/lib/launch-scoped-flags.js +0 -212
  98. package/dist/extensions/agent-browser/lib/managed-session-policy-lock.js +0 -165
  99. package/dist/extensions/agent-browser/lib/managed-session-posix-storage.js +0 -58
  100. package/dist/extensions/agent-browser/lib/managed-session-project-identity.js +0 -244
  101. package/dist/extensions/agent-browser/lib/managed-session-restore-context.js +0 -84
  102. package/dist/extensions/agent-browser/lib/managed-session-restore-policy.js +0 -119
  103. package/dist/extensions/agent-browser/lib/managed-session-restore-state.js +0 -83
  104. package/dist/extensions/agent-browser/lib/managed-session-restore.js +0 -212
  105. package/dist/extensions/agent-browser/lib/managed-session-snapshot-records.js +0 -277
  106. package/dist/extensions/agent-browser/lib/managed-session-snapshots.js +0 -181
  107. package/dist/extensions/agent-browser/lib/managed-session-storage.js +0 -126
  108. package/dist/extensions/agent-browser/lib/native-confirmation.js +0 -140
  109. package/dist/extensions/agent-browser/lib/native-output.js +0 -81
  110. package/dist/extensions/agent-browser/lib/orchestration/batch-stdin.js +0 -182
  111. package/dist/extensions/agent-browser/lib/orchestration/browser-run/artifact-merge.js +0 -30
  112. package/dist/extensions/agent-browser/lib/orchestration/browser-run/artifact-paths.js +0 -188
  113. package/dist/extensions/agent-browser/lib/orchestration/browser-run/browser-observation-result.js +0 -82
  114. package/dist/extensions/agent-browser/lib/orchestration/browser-run/click-dispatch.js +0 -406
  115. package/dist/extensions/agent-browser/lib/orchestration/browser-run/diagnostic-values.js +0 -31
  116. package/dist/extensions/agent-browser/lib/orchestration/browser-run/diagnostics.js +0 -240
  117. package/dist/extensions/agent-browser/lib/orchestration/browser-run/electron-observation.js +0 -202
  118. package/dist/extensions/agent-browser/lib/orchestration/browser-run/electron-text-diagnostics.js +0 -109
  119. package/dist/extensions/agent-browser/lib/orchestration/browser-run/fill-diagnostics.js +0 -119
  120. package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-action-recovery.js +0 -147
  121. package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-actions.js +0 -144
  122. package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-content.js +0 -123
  123. package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-contracts.js +0 -1
  124. package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-details.js +0 -156
  125. package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-electron.js +0 -179
  126. package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-evidence.js +0 -39
  127. package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-missing-binary.js +0 -89
  128. package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-recovery.js +0 -97
  129. package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-redaction.js +0 -106
  130. package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-timeout.js +0 -110
  131. package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result.js +0 -53
  132. package/dist/extensions/agent-browser/lib/orchestration/browser-run/index.js +0 -224
  133. package/dist/extensions/agent-browser/lib/orchestration/browser-run/interaction-diagnostics.js +0 -290
  134. package/dist/extensions/agent-browser/lib/orchestration/browser-run/managed-session-close.js +0 -167
  135. package/dist/extensions/agent-browser/lib/orchestration/browser-run/managed-session-daemon-inspection.js +0 -108
  136. package/dist/extensions/agent-browser/lib/orchestration/browser-run/managed-session-daemon-policy.js +0 -174
  137. package/dist/extensions/agent-browser/lib/orchestration/browser-run/native-helper-observation.js +0 -65
  138. package/dist/extensions/agent-browser/lib/orchestration/browser-run/observation-types.js +0 -1
  139. package/dist/extensions/agent-browser/lib/orchestration/browser-run/overlay-diagnostics.js +0 -120
  140. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/network-page-filter.js +0 -192
  141. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/scroll-shims.js +0 -225
  142. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/snapshot-filter-data.js +0 -150
  143. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/snapshot-filter.js +0 -165
  144. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/snapshot-rendered-text.js +0 -147
  145. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/wait-timeouts.js +0 -145
  146. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-artifacts.js +0 -159
  147. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-command.js +0 -131
  148. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-contracts.js +0 -1
  149. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-daemon.js +0 -93
  150. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-failure.js +0 -42
  151. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-guards.js +0 -242
  152. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-input.js +0 -75
  153. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-observations.js +0 -92
  154. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-page-selection.js +0 -254
  155. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-page-state.js +0 -121
  156. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-refs.js +0 -130
  157. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-resources.js +0 -114
  158. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-semantic.js +0 -121
  159. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-session-plan.js +0 -222
  160. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-timeouts.js +0 -68
  161. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare.js +0 -202
  162. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-analysis.js +0 -191
  163. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-confirmation.js +0 -152
  164. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-diagnostics.js +0 -182
  165. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-electron.js +0 -150
  166. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-lifecycle-contracts.js +0 -1
  167. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-lifecycle-phase-contracts.js +0 -1
  168. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-lifecycle-phase.js +0 -115
  169. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-lifecycle.js +0 -256
  170. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-managed-contracts.js +0 -1
  171. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-managed.js +0 -256
  172. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-native-phase-contracts.js +0 -1
  173. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-native-phase.js +0 -93
  174. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-native.js +0 -113
  175. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-navigation-contracts.js +0 -1
  176. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-navigation.js +0 -316
  177. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-ownership.js +0 -28
  178. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-page-phase-contracts.js +0 -1
  179. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-page-phase.js +0 -142
  180. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-presentation-contracts.js +0 -1
  181. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-presentation.js +0 -333
  182. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-publication-phase-contracts.js +0 -1
  183. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-publication-phase.js +0 -71
  184. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-publication.js +0 -201
  185. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-receipts.js +0 -183
  186. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-refs.js +0 -200
  187. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-tabs.js +0 -142
  188. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output.js +0 -25
  189. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prompt-guards.js +0 -50
  190. package/dist/extensions/agent-browser/lib/orchestration/browser-run/recording-receipt-reconciliation.js +0 -198
  191. package/dist/extensions/agent-browser/lib/orchestration/browser-run/recording-recovery-contracts.js +0 -1
  192. package/dist/extensions/agent-browser/lib/orchestration/browser-run/recording-recovery-presentation.js +0 -154
  193. package/dist/extensions/agent-browser/lib/orchestration/browser-run/recording-recovery.js +0 -80
  194. package/dist/extensions/agent-browser/lib/orchestration/browser-run/screenshot-capture.js +0 -14
  195. package/dist/extensions/agent-browser/lib/orchestration/browser-run/screenshot-observation.js +0 -206
  196. package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-commands.js +0 -130
  197. package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-electron.js +0 -210
  198. package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-observations.js +0 -61
  199. package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-outcomes.js +0 -187
  200. package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-refs.js +0 -171
  201. package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-tabs.js +0 -228
  202. package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state.js +0 -117
  203. package/dist/extensions/agent-browser/lib/orchestration/browser-run/text-visibility-diagnostics.js +0 -182
  204. package/dist/extensions/agent-browser/lib/orchestration/browser-run/timeout-diagnostics.js +0 -256
  205. package/dist/extensions/agent-browser/lib/orchestration/browser-run/timeout-progress.js +0 -108
  206. package/dist/extensions/agent-browser/lib/orchestration/browser-run/types.js +0 -1
  207. package/dist/extensions/agent-browser/lib/orchestration/code-artifact-observation.js +0 -39
  208. package/dist/extensions/agent-browser/lib/orchestration/code-image-observation.js +0 -119
  209. package/dist/extensions/agent-browser/lib/orchestration/electron-host/branch.js +0 -92
  210. package/dist/extensions/agent-browser/lib/orchestration/electron-host/cleanup-result.js +0 -58
  211. package/dist/extensions/agent-browser/lib/orchestration/electron-host/cleanup.js +0 -78
  212. package/dist/extensions/agent-browser/lib/orchestration/electron-host/contracts.js +0 -1
  213. package/dist/extensions/agent-browser/lib/orchestration/electron-host/discovery.js +0 -106
  214. package/dist/extensions/agent-browser/lib/orchestration/electron-host/index.js +0 -60
  215. package/dist/extensions/agent-browser/lib/orchestration/electron-host/policy.js +0 -86
  216. package/dist/extensions/agent-browser/lib/orchestration/electron-host/probe-collection.js +0 -69
  217. package/dist/extensions/agent-browser/lib/orchestration/electron-host/probe-data.js +0 -167
  218. package/dist/extensions/agent-browser/lib/orchestration/electron-host/probe-presentation.js +0 -164
  219. package/dist/extensions/agent-browser/lib/orchestration/electron-host/probe.js +0 -161
  220. package/dist/extensions/agent-browser/lib/orchestration/electron-host/status.js +0 -165
  221. package/dist/extensions/agent-browser/lib/orchestration/execution-queue.js +0 -98
  222. package/dist/extensions/agent-browser/lib/orchestration/extension-artifact-preflight.js +0 -211
  223. package/dist/extensions/agent-browser/lib/orchestration/extension-artifacts.js +0 -23
  224. package/dist/extensions/agent-browser/lib/orchestration/extension-attachment-replay.js +0 -99
  225. package/dist/extensions/agent-browser/lib/orchestration/extension-branch-restore.js +0 -275
  226. package/dist/extensions/agent-browser/lib/orchestration/extension-code.js +0 -280
  227. package/dist/extensions/agent-browser/lib/orchestration/extension-command-admission.js +0 -303
  228. package/dist/extensions/agent-browser/lib/orchestration/extension-command-output.js +0 -36
  229. package/dist/extensions/agent-browser/lib/orchestration/extension-command-result.js +0 -335
  230. package/dist/extensions/agent-browser/lib/orchestration/extension-command-run.js +0 -227
  231. package/dist/extensions/agent-browser/lib/orchestration/extension-command-state.js +0 -1
  232. package/dist/extensions/agent-browser/lib/orchestration/extension-electron-ownership.js +0 -204
  233. package/dist/extensions/agent-browser/lib/orchestration/extension-execution-locks.js +0 -139
  234. package/dist/extensions/agent-browser/lib/orchestration/extension-execution-queue.js +0 -24
  235. package/dist/extensions/agent-browser/lib/orchestration/extension-host-coordination.js +0 -98
  236. package/dist/extensions/agent-browser/lib/orchestration/extension-host-run.js +0 -295
  237. package/dist/extensions/agent-browser/lib/orchestration/extension-intent-replay.js +0 -41
  238. package/dist/extensions/agent-browser/lib/orchestration/extension-invocation.js +0 -7
  239. package/dist/extensions/agent-browser/lib/orchestration/extension-lifecycle.js +0 -102
  240. package/dist/extensions/agent-browser/lib/orchestration/extension-managed-ownership.js +0 -133
  241. package/dist/extensions/agent-browser/lib/orchestration/extension-observation.js +0 -120
  242. package/dist/extensions/agent-browser/lib/orchestration/extension-prompt.js +0 -180
  243. package/dist/extensions/agent-browser/lib/orchestration/extension-recording.js +0 -290
  244. package/dist/extensions/agent-browser/lib/orchestration/extension-resource-contracts.js +0 -1
  245. package/dist/extensions/agent-browser/lib/orchestration/extension-resource-replay.js +0 -269
  246. package/dist/extensions/agent-browser/lib/orchestration/extension-result-state.js +0 -113
  247. package/dist/extensions/agent-browser/lib/orchestration/extension-runtime.js +0 -146
  248. package/dist/extensions/agent-browser/lib/orchestration/extension-script-leases.js +0 -58
  249. package/dist/extensions/agent-browser/lib/orchestration/extension-tool-boundary.js +0 -62
  250. package/dist/extensions/agent-browser/lib/orchestration/extension-version-check.js +0 -54
  251. package/dist/extensions/agent-browser/lib/orchestration/input-plan-types.js +0 -1
  252. package/dist/extensions/agent-browser/lib/orchestration/input-plan.js +0 -313
  253. package/dist/extensions/agent-browser/lib/orchestration/input-redaction.js +0 -62
  254. package/dist/extensions/agent-browser/lib/orchestration/native-config.js +0 -144
  255. package/dist/extensions/agent-browser/lib/orchestration/native-root-launch.js +0 -77
  256. package/dist/extensions/agent-browser/lib/orchestration/native-session-defaults.js +0 -231
  257. package/dist/extensions/agent-browser/lib/orchestration/operation-paths.js +0 -142
  258. package/dist/extensions/agent-browser/lib/orchestration/output-file.js +0 -276
  259. package/dist/extensions/agent-browser/lib/orchestration/script-mode.js +0 -220
  260. package/dist/extensions/agent-browser/lib/owned-managed-session-context.js +0 -55
  261. package/dist/extensions/agent-browser/lib/page-target-batch.js +0 -118
  262. package/dist/extensions/agent-browser/lib/page-target-guards.js +0 -50
  263. package/dist/extensions/agent-browser/lib/page-target-navigation.js +0 -104
  264. package/dist/extensions/agent-browser/lib/page-target-validation.js +0 -90
  265. package/dist/extensions/agent-browser/lib/parsing.js +0 -30
  266. package/dist/extensions/agent-browser/lib/pi-tool-rendering.js +0 -343
  267. package/dist/extensions/agent-browser/lib/playbook.js +0 -146
  268. package/dist/extensions/agent-browser/lib/process-child.js +0 -284
  269. package/dist/extensions/agent-browser/lib/process-environment.js +0 -48
  270. package/dist/extensions/agent-browser/lib/process-errors.js +0 -23
  271. package/dist/extensions/agent-browser/lib/process-identity.js +0 -127
  272. package/dist/extensions/agent-browser/lib/process-socket-storage.js +0 -256
  273. package/dist/extensions/agent-browser/lib/process-stdout.js +0 -74
  274. package/dist/extensions/agent-browser/lib/process.js +0 -216
  275. package/dist/extensions/agent-browser/lib/prompt-artifacts.js +0 -287
  276. package/dist/extensions/agent-browser/lib/prompt-policy.js +0 -54
  277. package/dist/extensions/agent-browser/lib/read-command.js +0 -41
  278. package/dist/extensions/agent-browser/lib/read-confirmation.js +0 -162
  279. package/dist/extensions/agent-browser/lib/recording-reservations.js +0 -208
  280. package/dist/extensions/agent-browser/lib/redaction-fields.js +0 -75
  281. package/dist/extensions/agent-browser/lib/redaction-json.js +0 -149
  282. package/dist/extensions/agent-browser/lib/redaction-url.js +0 -88
  283. package/dist/extensions/agent-browser/lib/results/action-contracts.js +0 -1
  284. package/dist/extensions/agent-browser/lib/results/action-recommendations.js +0 -38
  285. package/dist/extensions/agent-browser/lib/results/artifact-contracts.js +0 -1
  286. package/dist/extensions/agent-browser/lib/results/artifact-manifest-validation.js +0 -133
  287. package/dist/extensions/agent-browser/lib/results/artifact-manifest.js +0 -173
  288. package/dist/extensions/agent-browser/lib/results/artifact-recommendations.js +0 -73
  289. package/dist/extensions/agent-browser/lib/results/categories.js +0 -152
  290. package/dist/extensions/agent-browser/lib/results/confirmation.js +0 -75
  291. package/dist/extensions/agent-browser/lib/results/contracts.js +0 -1
  292. package/dist/extensions/agent-browser/lib/results/editable-ref-evidence.js +0 -99
  293. package/dist/extensions/agent-browser/lib/results/electron-recommendations.js +0 -83
  294. package/dist/extensions/agent-browser/lib/results/envelope-decoding.js +0 -48
  295. package/dist/extensions/agent-browser/lib/results/envelope.js +0 -198
  296. package/dist/extensions/agent-browser/lib/results/evidence-contracts.js +0 -1
  297. package/dist/extensions/agent-browser/lib/results/failure-recommendations.js +0 -180
  298. package/dist/extensions/agent-browser/lib/results/network-routes.js +0 -133
  299. package/dist/extensions/agent-browser/lib/results/network.js +0 -89
  300. package/dist/extensions/agent-browser/lib/results/next-actions.js +0 -111
  301. package/dist/extensions/agent-browser/lib/results/presentation/artifact-files.js +0 -320
  302. package/dist/extensions/agent-browser/lib/results/presentation/artifact-format.js +0 -138
  303. package/dist/extensions/agent-browser/lib/results/presentation/artifact-images.js +0 -113
  304. package/dist/extensions/agent-browser/lib/results/presentation/artifact-verification.js +0 -145
  305. package/dist/extensions/agent-browser/lib/results/presentation/artifacts.js +0 -165
  306. package/dist/extensions/agent-browser/lib/results/presentation/batch-contracts.js +0 -1
  307. package/dist/extensions/agent-browser/lib/results/presentation/batch-recording.js +0 -118
  308. package/dist/extensions/agent-browser/lib/results/presentation/batch-redaction.js +0 -68
  309. package/dist/extensions/agent-browser/lib/results/presentation/batch-rendering.js +0 -135
  310. package/dist/extensions/agent-browser/lib/results/presentation/batch-step.js +0 -227
  311. package/dist/extensions/agent-browser/lib/results/presentation/batch-summary.js +0 -91
  312. package/dist/extensions/agent-browser/lib/results/presentation/batch.js +0 -123
  313. package/dist/extensions/agent-browser/lib/results/presentation/browser-profile-recovery.js +0 -54
  314. package/dist/extensions/agent-browser/lib/results/presentation/command-presenters.js +0 -216
  315. package/dist/extensions/agent-browser/lib/results/presentation/common.js +0 -81
  316. package/dist/extensions/agent-browser/lib/results/presentation/content.js +0 -119
  317. package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-a11y.js +0 -67
  318. package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-health.js +0 -79
  319. package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-identity.js +0 -199
  320. package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-logs.js +0 -75
  321. package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-network-actions.js +0 -216
  322. package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-network.js +0 -124
  323. package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-redaction.js +0 -64
  324. package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-storage.js +0 -209
  325. package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-stream.js +0 -69
  326. package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-summary.js +0 -222
  327. package/dist/extensions/agent-browser/lib/results/presentation/diagnostics.js +0 -124
  328. package/dist/extensions/agent-browser/lib/results/presentation/early-result.js +0 -70
  329. package/dist/extensions/agent-browser/lib/results/presentation/errors.js +0 -285
  330. package/dist/extensions/agent-browser/lib/results/presentation/input-contracts.js +0 -1
  331. package/dist/extensions/agent-browser/lib/results/presentation/large-output.js +0 -117
  332. package/dist/extensions/agent-browser/lib/results/presentation/navigation.js +0 -231
  333. package/dist/extensions/agent-browser/lib/results/presentation/notices.js +0 -75
  334. package/dist/extensions/agent-browser/lib/results/presentation/observation-contracts.js +0 -1
  335. package/dist/extensions/agent-browser/lib/results/presentation/observation-rendering.js +0 -127
  336. package/dist/extensions/agent-browser/lib/results/presentation/outcomes.js +0 -120
  337. package/dist/extensions/agent-browser/lib/results/presentation/output-completion.js +0 -77
  338. package/dist/extensions/agent-browser/lib/results/presentation/output-spill.js +0 -51
  339. package/dist/extensions/agent-browser/lib/results/presentation/registry.js +0 -145
  340. package/dist/extensions/agent-browser/lib/results/presentation/semantic-action.js +0 -104
  341. package/dist/extensions/agent-browser/lib/results/presentation/skills.js +0 -178
  342. package/dist/extensions/agent-browser/lib/results/presentation/source.js +0 -109
  343. package/dist/extensions/agent-browser/lib/results/presentation.js +0 -19
  344. package/dist/extensions/agent-browser/lib/results/recommendation-contracts.js +0 -1
  345. package/dist/extensions/agent-browser/lib/results/recording.js +0 -88
  346. package/dist/extensions/agent-browser/lib/results/recovery-actions.js +0 -118
  347. package/dist/extensions/agent-browser/lib/results/recovery-next-actions.js +0 -60
  348. package/dist/extensions/agent-browser/lib/results/selector-recovery-target.js +0 -83
  349. package/dist/extensions/agent-browser/lib/results/selector-recovery.js +0 -261
  350. package/dist/extensions/agent-browser/lib/results/snapshot-compact.js +0 -266
  351. package/dist/extensions/agent-browser/lib/results/snapshot-content.js +0 -32
  352. package/dist/extensions/agent-browser/lib/results/snapshot-high-value-controls.js +0 -240
  353. package/dist/extensions/agent-browser/lib/results/snapshot-refs.js +0 -103
  354. package/dist/extensions/agent-browser/lib/results/snapshot-segments.js +0 -383
  355. package/dist/extensions/agent-browser/lib/results/snapshot-spill.js +0 -53
  356. package/dist/extensions/agent-browser/lib/results/snapshot.js +0 -44
  357. package/dist/extensions/agent-browser/lib/results/text.js +0 -44
  358. package/dist/extensions/agent-browser/lib/runtime-args-validation.js +0 -133
  359. package/dist/extensions/agent-browser/lib/runtime-compatibility.js +0 -81
  360. package/dist/extensions/agent-browser/lib/runtime-contracts.js +0 -1
  361. package/dist/extensions/agent-browser/lib/runtime-redaction.js +0 -118
  362. package/dist/extensions/agent-browser/lib/runtime-replay-events.js +0 -144
  363. package/dist/extensions/agent-browser/lib/runtime-session-identity.js +0 -76
  364. package/dist/extensions/agent-browser/lib/runtime-session-plan.js +0 -114
  365. package/dist/extensions/agent-browser/lib/runtime-session-replay.js +0 -123
  366. package/dist/extensions/agent-browser/lib/runtime-tab-correction.js +0 -65
  367. package/dist/extensions/agent-browser/lib/runtime-timeouts.js +0 -28
  368. package/dist/extensions/agent-browser/lib/runtime.js +0 -163
  369. package/dist/extensions/agent-browser/lib/session-identity.js +0 -51
  370. package/dist/extensions/agent-browser/lib/session-page-observation.js +0 -357
  371. package/dist/extensions/agent-browser/lib/session-page-state.js +0 -353
  372. package/dist/extensions/agent-browser/lib/session-page-types.js +0 -1
  373. package/dist/extensions/agent-browser/lib/string-enum-schema.js +0 -8
  374. package/dist/extensions/agent-browser/lib/temp-artifact-budget.js +0 -78
  375. package/dist/extensions/agent-browser/lib/temp-mutation-queue.js +0 -7
  376. package/dist/extensions/agent-browser/lib/temp-root-ownership.js +0 -234
  377. package/dist/extensions/agent-browser/lib/temp-root.js +0 -207
  378. package/dist/extensions/agent-browser/lib/temp.js +0 -91
  379. package/dist/extensions/agent-browser/lib/tool-surface.js +0 -239
  380. package/dist/extensions/agent-browser/lib/upstream-version.js +0 -15
  381. package/dist/extensions/agent-browser/lib/web-search-providers.js +0 -229
  382. package/dist/extensions/agent-browser/lib/web-search-request.js +0 -108
  383. package/dist/extensions/agent-browser/lib/web-search-results.js +0 -281
  384. package/dist/extensions/agent-browser/lib/web-search-schema.js +0 -82
  385. package/dist/extensions/agent-browser/lib/web-search.js +0 -149
  386. package/dist/extensions/agent-browser/lib/webmcp-observation.js +0 -35
  387. package/dist/extensions/agent-browser/lib/windows-stock-launcher.js +0 -96
  388. package/dist/scripts/agent-browser-target.mjs +0 -23
@@ -0,0 +1,694 @@
1
+ // dist/extensions/agent-browser/lib/command-capabilities.js
2
+ var ADDITIONAL_COMMAND_TOKENS = [
3
+ "a11y",
4
+ "auth",
5
+ "chat",
6
+ "clipboard",
7
+ "confirm",
8
+ "connect",
9
+ "dashboard",
10
+ "deny",
11
+ "device",
12
+ "dialog",
13
+ "diff",
14
+ "doctor",
15
+ "errors",
16
+ "eval",
17
+ "find",
18
+ "frame",
19
+ "get",
20
+ "highlight",
21
+ "inspect",
22
+ "install",
23
+ "is",
24
+ "mcp",
25
+ "plugin",
26
+ "plugins",
27
+ "profiles",
28
+ "profiler",
29
+ "react",
30
+ "record",
31
+ "removeinitscript",
32
+ "session",
33
+ "set",
34
+ "skills",
35
+ "snapshot",
36
+ "state",
37
+ "stream",
38
+ "trace",
39
+ "upgrade",
40
+ "vitals",
41
+ "wait",
42
+ "web-vitals",
43
+ "webmcp",
44
+ "window"
45
+ ];
46
+ var COMMAND_CAPABILITIES = [
47
+ {
48
+ command: "back",
49
+ eligibleForElectronHealthProbe: true,
50
+ eligibleForPageChangeSummary: true,
51
+ invalidatesBatchRefs: true,
52
+ navigationObservable: true,
53
+ triggersPostMutationSnapshot: true
54
+ },
55
+ {
56
+ command: "batch",
57
+ excludedFromPostCommandCorrection: true
58
+ },
59
+ {
60
+ command: "check",
61
+ eligibleForElectronHealthProbe: true,
62
+ eligibleForPageChangeSummary: true,
63
+ guardsPageRefs: true,
64
+ invalidatesBatchRefs: true,
65
+ triggersPostMutationSnapshot: true
66
+ },
67
+ {
68
+ command: "click",
69
+ eligibleForElectronHealthProbe: true,
70
+ eligibleForPageChangeSummary: true,
71
+ guardsPageRefs: true,
72
+ invalidatesBatchRefs: true,
73
+ navigationObservable: true,
74
+ triggersPostMutationSnapshot: true
75
+ },
76
+ {
77
+ aliases: ["quit", "exit"],
78
+ closesSession: true,
79
+ command: "close",
80
+ excludedFromPinning: true,
81
+ excludedFromPostCommandCorrection: true
82
+ },
83
+ {
84
+ command: "console",
85
+ readOnlyDiagnosticSessionTarget: true
86
+ },
87
+ {
88
+ command: "cookies",
89
+ readOnlyDiagnosticSessionTarget: true
90
+ },
91
+ {
92
+ command: "dblclick",
93
+ eligibleForElectronHealthProbe: true,
94
+ eligibleForPageChangeSummary: true,
95
+ guardsPageRefs: true,
96
+ invalidatesBatchRefs: true,
97
+ navigationObservable: true,
98
+ triggersPostMutationSnapshot: true
99
+ },
100
+ {
101
+ command: "dialog",
102
+ eligibleForPageChangeSummary: true,
103
+ invalidatesBatchRefs: true,
104
+ triggersPostMutationSnapshot: true
105
+ },
106
+ {
107
+ command: "diff",
108
+ guardsPageRefs: true
109
+ },
110
+ {
111
+ command: "download",
112
+ eligibleForPageChangeSummary: true,
113
+ guardsPageRefs: true
114
+ },
115
+ {
116
+ command: "drag",
117
+ guardsPageRefs: true,
118
+ invalidatesBatchRefs: true
119
+ },
120
+ {
121
+ command: "errors",
122
+ readOnlyDiagnosticSessionTarget: true
123
+ },
124
+ {
125
+ command: "eval",
126
+ invalidatesBatchRefs: true,
127
+ navigationObservable: true,
128
+ triggersPostMutationSnapshot: true
129
+ },
130
+ {
131
+ command: "fill",
132
+ eligibleForElectronHealthProbe: true,
133
+ eligibleForPageChangeSummary: true,
134
+ guardsPageRefs: true,
135
+ triggersPostMutationSnapshot: true
136
+ },
137
+ {
138
+ command: "find",
139
+ eligibleForElectronHealthProbe: true
140
+ },
141
+ {
142
+ command: "frame",
143
+ guardsPageRefs: true
144
+ },
145
+ {
146
+ command: "focus",
147
+ guardsPageRefs: true
148
+ },
149
+ {
150
+ command: "forward",
151
+ eligibleForElectronHealthProbe: true,
152
+ eligibleForPageChangeSummary: true,
153
+ invalidatesBatchRefs: true,
154
+ navigationObservable: true,
155
+ triggersPostMutationSnapshot: true
156
+ },
157
+ {
158
+ command: "get",
159
+ guardsPageRefs: true
160
+ },
161
+ {
162
+ command: "highlight",
163
+ guardsPageRefs: true
164
+ },
165
+ {
166
+ command: "hover",
167
+ eligibleForPageChangeSummary: true,
168
+ guardsPageRefs: true,
169
+ invalidatesBatchRefs: true,
170
+ triggersPostMutationSnapshot: true
171
+ },
172
+ {
173
+ command: "is",
174
+ guardsPageRefs: true
175
+ },
176
+ {
177
+ command: "keydown",
178
+ eligibleForElectronHealthProbe: true,
179
+ eligibleForPageChangeSummary: true,
180
+ invalidatesBatchRefs: true,
181
+ triggersPostMutationSnapshot: true
182
+ },
183
+ {
184
+ command: "keyboard",
185
+ eligibleForElectronHealthProbe: true,
186
+ eligibleForPageChangeSummary: true,
187
+ invalidatesBatchRefs: true,
188
+ triggersPostMutationSnapshot: true
189
+ },
190
+ {
191
+ command: "keyup",
192
+ eligibleForElectronHealthProbe: true,
193
+ eligibleForPageChangeSummary: true,
194
+ invalidatesBatchRefs: true,
195
+ triggersPostMutationSnapshot: true
196
+ },
197
+ {
198
+ command: "mouse",
199
+ eligibleForElectronHealthProbe: true,
200
+ invalidatesBatchRefs: true
201
+ },
202
+ {
203
+ command: "network",
204
+ readOnlyDiagnosticSessionTarget: true
205
+ },
206
+ {
207
+ aliases: ["goto", "navigate"],
208
+ command: "open",
209
+ eligibleForPageChangeSummary: true,
210
+ excludedFromPinning: true,
211
+ invalidatesBatchRefs: true,
212
+ openNavigation: true
213
+ },
214
+ {
215
+ command: "pdf",
216
+ eligibleForPageChangeSummary: true
217
+ },
218
+ {
219
+ aliases: ["key"],
220
+ command: "press",
221
+ eligibleForElectronHealthProbe: true,
222
+ eligibleForPageChangeSummary: true,
223
+ invalidatesBatchRefs: true,
224
+ triggersPostMutationSnapshot: true
225
+ },
226
+ {
227
+ command: "pushstate",
228
+ eligibleForPageChangeSummary: true,
229
+ invalidatesBatchRefs: true,
230
+ triggersPostMutationSnapshot: true
231
+ },
232
+ {
233
+ command: "reload",
234
+ eligibleForElectronHealthProbe: true,
235
+ eligibleForPageChangeSummary: true,
236
+ invalidatesBatchRefs: true,
237
+ navigationObservable: true,
238
+ triggersPostMutationSnapshot: true
239
+ },
240
+ {
241
+ command: "read",
242
+ readOnlyDiagnosticSessionTarget: true
243
+ },
244
+ {
245
+ command: "screenshot",
246
+ eligibleForPageChangeSummary: true,
247
+ guardsPageRefs: true
248
+ },
249
+ {
250
+ command: "scroll",
251
+ eligibleForPageChangeSummary: true,
252
+ guardsPageRefs: true,
253
+ invalidatesBatchRefs: true,
254
+ triggersPostMutationSnapshot: true
255
+ },
256
+ {
257
+ aliases: ["scrollinto"],
258
+ command: "scrollintoview",
259
+ eligibleForPageChangeSummary: true,
260
+ guardsPageRefs: true,
261
+ invalidatesBatchRefs: true,
262
+ triggersPostMutationSnapshot: true
263
+ },
264
+ {
265
+ command: "select",
266
+ eligibleForElectronHealthProbe: true,
267
+ eligibleForPageChangeSummary: true,
268
+ guardsPageRefs: true,
269
+ invalidatesBatchRefs: true,
270
+ triggersPostMutationSnapshot: true
271
+ },
272
+ {
273
+ command: "session",
274
+ excludedFromPinning: true,
275
+ excludedFromPostCommandCorrection: true
276
+ },
277
+ {
278
+ command: "storage",
279
+ readOnlyDiagnosticSessionTarget: true
280
+ },
281
+ {
282
+ command: "swipe",
283
+ eligibleForPageChangeSummary: true,
284
+ invalidatesBatchRefs: true,
285
+ triggersPostMutationSnapshot: true
286
+ },
287
+ {
288
+ command: "tab",
289
+ excludedFromPinning: true,
290
+ excludedFromPostCommandCorrection: true
291
+ },
292
+ {
293
+ command: "tap",
294
+ eligibleForElectronHealthProbe: true,
295
+ eligibleForPageChangeSummary: true,
296
+ guardsPageRefs: true,
297
+ invalidatesBatchRefs: true,
298
+ triggersPostMutationSnapshot: true
299
+ },
300
+ {
301
+ command: "type",
302
+ eligibleForElectronHealthProbe: true,
303
+ eligibleForPageChangeSummary: true,
304
+ guardsPageRefs: true,
305
+ invalidatesBatchRefs: true,
306
+ triggersPostMutationSnapshot: true
307
+ },
308
+ {
309
+ command: "uncheck",
310
+ eligibleForElectronHealthProbe: true,
311
+ eligibleForPageChangeSummary: true,
312
+ guardsPageRefs: true,
313
+ invalidatesBatchRefs: true,
314
+ triggersPostMutationSnapshot: true
315
+ },
316
+ {
317
+ command: "upload",
318
+ guardsPageRefs: true,
319
+ invalidatesBatchRefs: true
320
+ }
321
+ ];
322
+ var COMMAND_CAPABILITY_BY_NAME = /* @__PURE__ */ new Map();
323
+ for (const entry of COMMAND_CAPABILITIES) {
324
+ COMMAND_CAPABILITY_BY_NAME.set(entry.command, entry);
325
+ for (const alias of entry.aliases ?? []) {
326
+ COMMAND_CAPABILITY_BY_NAME.set(alias, entry);
327
+ }
328
+ }
329
+ var KNOWN_COMMAND_TOKENS = /* @__PURE__ */ new Set([
330
+ ...COMMAND_CAPABILITY_BY_NAME.keys(),
331
+ ...ADDITIONAL_COMMAND_TOKENS
332
+ ]);
333
+
334
+ // dist/extensions/agent-browser/lib/argv-grammar.js
335
+ var GLOBAL_VALUE_FLAGS = [
336
+ "--session",
337
+ "--namespace",
338
+ "--cdp",
339
+ "--config",
340
+ "--profile",
341
+ "--session-name",
342
+ "--restore-save",
343
+ "--restore-check-url",
344
+ "--restore-check-text",
345
+ "--restore-check-fn",
346
+ "--proxy",
347
+ "--proxy-bypass",
348
+ "--ca-cert",
349
+ "--headers",
350
+ "--executable-path",
351
+ "--extension",
352
+ "--init-script",
353
+ "--enable",
354
+ "--provider",
355
+ "-p",
356
+ "--engine",
357
+ "--state",
358
+ "--download-path",
359
+ "--screenshot-dir",
360
+ "--screenshot-format",
361
+ "--screenshot-quality",
362
+ "--color-scheme",
363
+ "--device",
364
+ "--args",
365
+ "--user-agent",
366
+ "--allowed-domains",
367
+ "--action-policy",
368
+ "--confirm-actions",
369
+ "--max-output",
370
+ "--model",
371
+ "--idle-timeout",
372
+ "--input-mode"
373
+ ];
374
+ var COMMAND_VALUE_FLAGS = [
375
+ "--allowed-origins",
376
+ "--baseline",
377
+ "--body",
378
+ "--categories",
379
+ "--content",
380
+ "--curl",
381
+ "--depth",
382
+ "-d",
383
+ "--domain",
384
+ "--expires",
385
+ "--filter",
386
+ "--frame",
387
+ "--fn",
388
+ "--label",
389
+ "--load",
390
+ "--method",
391
+ "--name",
392
+ "--older-than",
393
+ "--output",
394
+ "--prefix",
395
+ "--path",
396
+ "--port",
397
+ "--params",
398
+ "--resource-type",
399
+ "--resource-types",
400
+ "--sameSite",
401
+ "--scope",
402
+ "--selector",
403
+ "-s",
404
+ "--status",
405
+ "--tags",
406
+ "--text",
407
+ "--threshold",
408
+ "--timeout",
409
+ "--type",
410
+ "--url",
411
+ "--username",
412
+ "--password",
413
+ "--wait-until"
414
+ ];
415
+ var VALUE_FLAGS = /* @__PURE__ */ new Set([
416
+ ...GLOBAL_VALUE_FLAGS,
417
+ ...COMMAND_VALUE_FLAGS
418
+ ]);
419
+ var PREVALIDATED_VALUE_FLAGS = new Set(GLOBAL_VALUE_FLAGS);
420
+
421
+ // dist/extensions/agent-browser/lib/launch-scoped-flags.js
422
+ var LAUNCH_SCOPED_FLAG_DEFINITIONS = [
423
+ {
424
+ flag: "--auto-connect",
425
+ reason: "attaches to an already-running browser at launch time instead of reusing an existing named session"
426
+ },
427
+ {
428
+ flag: "--allowed-domains",
429
+ reason: "installs upstream network and WebRTC containment on a fresh controllable browser context"
430
+ },
431
+ {
432
+ flag: "--namespace",
433
+ reason: "selects the upstream daemon/socket and restore-state namespace before session lookup"
434
+ },
435
+ {
436
+ flag: "--cdp",
437
+ reason: "selects the browser/CDP endpoint used when an upstream session is launched"
438
+ },
439
+ {
440
+ flag: "--ca-cert",
441
+ reason: "selects isolated Chromium CA trust and may relaunch the browser"
442
+ },
443
+ {
444
+ flag: "--no-ca-cert",
445
+ reason: "clears retained isolated Chromium CA trust and may relaunch the browser"
446
+ },
447
+ {
448
+ flag: "--enable",
449
+ reason: "selects built-in page init scripts before the upstream browser session is launched"
450
+ },
451
+ {
452
+ flag: "--engine",
453
+ reason: "selects the browser engine used for the upstream launch"
454
+ },
455
+ {
456
+ flag: "--executable-path",
457
+ reason: "selects the browser executable used for the upstream launch"
458
+ },
459
+ {
460
+ flag: "--webgpu",
461
+ reason: "selects the platform-specific WebGPU browser launch preset"
462
+ },
463
+ {
464
+ flag: "--no-webmcp",
465
+ reason: "selects whether locally launched Chrome enables experimental WebMCP support"
466
+ },
467
+ {
468
+ flag: "--init-script",
469
+ reason: "registers page init scripts before the upstream browser session is launched"
470
+ },
471
+ {
472
+ flag: "--idle-timeout",
473
+ reason: "configures background browser lifecycle for the launched session"
474
+ },
475
+ {
476
+ flag: "--args",
477
+ reason: "selects raw Chrome arguments for the browser launch"
478
+ },
479
+ {
480
+ flag: "--user-agent",
481
+ reason: "selects the browser user agent at launch time"
482
+ },
483
+ {
484
+ flag: "--headed",
485
+ reason: "selects whether the launched browser has a visible window"
486
+ },
487
+ {
488
+ flag: "--device",
489
+ reason: "selects the provider device for the upstream launch"
490
+ },
491
+ {
492
+ flag: "--profile",
493
+ reason: "selects Chrome profile state for the upstream launch"
494
+ },
495
+ {
496
+ flag: "--provider",
497
+ reason: "selects the upstream browser provider for the launch"
498
+ },
499
+ {
500
+ flag: "-p",
501
+ reason: "selects the upstream browser provider for the launch"
502
+ },
503
+ {
504
+ flag: "--session-name",
505
+ reason: "selects upstream saved auth/session state for the launch"
506
+ },
507
+ {
508
+ flag: "--restore",
509
+ reason: "selects upstream saved auth/session restore state for the launch"
510
+ },
511
+ {
512
+ flag: "--restore-save",
513
+ reason: "configures upstream restore auto-save policy for the launched session"
514
+ },
515
+ {
516
+ flag: "--restore-check-url",
517
+ reason: "configures restore validation before the launched session can auto-save"
518
+ },
519
+ {
520
+ flag: "--restore-check-text",
521
+ reason: "configures restore validation before the launched session can auto-save"
522
+ },
523
+ {
524
+ flag: "--restore-check-fn",
525
+ reason: "configures restore validation before the launched session can auto-save"
526
+ },
527
+ {
528
+ flag: "--state",
529
+ reason: "loads persisted upstream browser/auth state at launch time"
530
+ }
531
+ ];
532
+ var LAUNCH_SCOPED_FLAGS = LAUNCH_SCOPED_FLAG_DEFINITIONS.map((definition) => definition.flag);
533
+ var LAUNCH_SCOPED_FLAG_LABEL = LAUNCH_SCOPED_FLAGS.join(", ");
534
+
535
+ // dist/extensions/agent-browser/lib/playbook.js
536
+ var PROJECT_RULE_PROMPT = "Project rule: when browser automation is needed, prefer the native `agent_browser` tool. Do not run direct `agent-browser` bash commands unless the user explicitly asks for a bash-oriented workflow or browser-integration debugging.";
537
+ var TOOL_PROMPT_GUIDELINES_PREFIX = [
538
+ "Use agent_browser for real browser or live web content."
539
+ ];
540
+ function buildInstalledDocsGuideline(paths) {
541
+ return `For detailed agent_browser docs, read targeted sections: ${paths.readmePath} (setup), ${paths.commandReferencePath} (commands), ${paths.toolContractPath} (result/details). Do not load the full command reference unless needed.`;
542
+ }
543
+ var QUICK_START_GUIDELINES = [
544
+ "Choose agent_browser for one native command, native batch --bail with JSON-array stdin for a known fixed sequence, or agent_browser_code for loops, branches, and aggregation. Return to the model when a fresh observation needs judgment. Neither tool is a named recipe registry.",
545
+ 'agent_browser takes args (argv after the binary), optional stdin, outputPath, timeoutMs, and sessionMode. Start with { args: ["open", "<url>"] }, then { args: ["snapshot", "-i"] }; act on current @refs and re-snapshot after navigation or DOM changes. Native commands, providers, plugins, profiles, auth, file access, and caller paths remain available through args.',
546
+ 'Use { args: ["batch", "--bail"], stdin: "[[\\"fill\\",\\"@e1\\",\\"text\\"],[\\"click\\",\\"@e2\\"]]" } for same-snapshot form fields followed by submit. Split if a fill rerenders later fields. Add native condition waits after navigation-prone actions; a click alone does not prove the destination loaded. Avoid blind mutation retries after timeout.',
547
+ "agent_browser_code takes { code, session?, namespace?, timeoutMs?, outputPath? }. JavaScript globals are fresh for every call; the selected browser persists and is shared with agent_browser. Use await browser({ args, stdin?, timeoutMs? }), inspect result.success, and emit selected JSON instead of whole envelopes. Use emitImage(result.imageObservations[0]) only when image inspection is needed; image handles belong to the current code call. No imports or host filesystem/network/process APIs are exposed.",
548
+ `Example agent_browser_code: { code: 'const result = await browser({args:["get","title"]}); if (!result.success) { emit(result); } else { emit({title:result.data}); }' }. Native batch still avoids extra CLI processes for fixed segments inside code. Explicit session/namespace controls select the browser for this cell without changing the default browser.`,
549
+ 'Call agent_browser_tools with no fields for inventory, or { enable: ["action", "qa", "electron", "source", "network"] } for advanced native tools. It adds agent_browser_action, agent_browser_qa, agent_browser_electron, agent_browser_source, and agent_browser_network_source without disabling other tools. The browser instructions cover these capabilities; activation reveals their selected tool declarations.',
550
+ "Use read <url> for readable web text; get title/url, get text/html/value/count <selector>, or get attr <selector> <name> for targeted state. For eval --stdin, put JavaScript in stdin and return the desired value. outputPath saves result data and must differ from screenshot/download/recording paths. Use --json only when JSON text is needed.",
551
+ "For artifacts, verify artifactVerification and artifacts before reporting success. A pending recording is not verified output; install ffmpeg before starting and pair start with stop. Native download owns the click and saves Blob/redirect downloads. Close keeps explicitly saved files. Save promptGuard-required paths before close. Screenshot pixels are not browser CSS coordinates: use imageObservations geometry (dimensions, viewport, crop/origin, scroll and DPR) before any visual-coordinate action; full-page and element captures are not current-viewport coordinates, and Pi resizing only maps sent pixels to original image pixels. Lightpanda images are text-rendered, not graphical layout; rendering:text never supports CSS/mouse-coordinate input.",
552
+ "Follow model-visible nextActions when present, including identity and stdin, instead of guessing commands. Treat native pending confirmations and unknown mutation outcomes as inspection boundaries. For dense snapshots, inspect Omitted high-value controls before reading a full spill."
553
+ ];
554
+ var ADVANCED_TOOL_PROMPT_GUIDELINES = {
555
+ action: [
556
+ "agent_browser_action uses flat action/locator/value/role/name/text/selector fields. Use current @refs or stable visible labels. Select uses selector plus value/values, or role=combobox/listbox plus values, or locator=label with value=label text and values=options; it preserves unique accessible-target selection. Use native uncheck through agent_browser.",
557
+ "For agent_browser_action fill misses, follow nextActions/richInputRecovery to a current editable ref, then use agent_browser keyboard type for framework-controlled editors. keyboard inserttext may change only DOM state; verify application state. Do not submit unless the requested flow calls for it."
558
+ ],
559
+ qa: [
560
+ "agent_browser_qa returns a QA verdict from fail-fast native batch, visible-text/selector waits and actionable diagnostics. URL mode defaults console/errors/network checks on; attached:true preserves the current page and defaults those checks off to avoid attributing old errors. Set checks explicitly when needed. attached:true cannot use url or sessionMode:fresh.",
561
+ "agent_browser_qa defaults loadState to domcontentloaded; use networkidle only without long-lived requests. Use exact observed expectedText, not guessed copy. Verify screenshot artifacts; benign icon failures are warnings rather than failed checks. A timeout or partial mutation requires inspection before retry."
562
+ ],
563
+ electron: [
564
+ "agent_browser_electron uses flat action fields: list before launch; default handoff=snapshot and targetType=page. Launch owns an isolated temporary profile, not the app's existing signed-in profile. Use probe/status for readiness and always cleanup the returned launchId. Native browser close alone does not perform owned app/profile cleanup.",
565
+ "For a user-requested existing signed-in app, host-launch its normal profile with remote debugging when appropriate, then use agent_browser connect, get url, tab list/selection and a fresh snapshot. agent_browser_electron timeoutMs belongs to the host action; list has no timeout option. Caller-owned app shutdown remains with its owner."
566
+ ],
567
+ source: [
568
+ "agent_browser_source provides experimental DOM/React/workspace candidates, not proven DOM-to-file mappings. For React, launch with --enable react-devtools before navigation. componentName scans bounded local source files even when separate filesystem tools are absent; includeDomHints:false skips the HTML probe."
569
+ ],
570
+ network: [
571
+ "agent_browser_network_source correlates failed request IDs/filters/URLs with initiator evidence and bounded local URL literals. Results are experimental candidates, not definitive blame; preserve explicit session/namespace for the request being diagnosed."
572
+ ]
573
+ };
574
+ var WEB_SEARCH_PROMPT_GUIDELINE = "Prefer agent_browser_web_search for current or external web facts and URL discovery over public search-engine forms that can hit anti-bot/CAPTCHA-gated pages. For research before implementation, pass searchType: deep-lite unless webSearch.defaultSearchType already does; omit it for everyday lookups so config/auto wins. Provider rank is not proof of authority: when correctness or version matters, prefer the vendor or project's primary current docs, inspect page-date and version clues, and constrain one follow-up after discovering the official domain (Exa includeDomains; Brave site: in query). Do not count URL aliases as independent sources. Use agent_browser after you have a target URL that needs interaction, screenshots, or DOM inspection.";
575
+ var WEB_SEARCH_TOOL_PROMPT_GUIDELINES = [
576
+ WEB_SEARCH_PROMPT_GUIDELINE,
577
+ "agent_browser_web_search chooses Exa or Brave from configured keys; when both are available, Exa is preferred by default unless webSearch.preferredProvider says otherwise. Use provider only when the user/config calls for a specific provider.",
578
+ "Use Exa deep only when deep-lite may miss angles, and deep-reasoning only for exhaustive or still-thin research. Do not run parallel agent_browser_web_search calls; make one high-signal query, inspect its results, then at most one follow-up.",
579
+ "If agent_browser_web_search returns HTTP 429, stop searching and tell the user the API plan/rate limit needs time or a plan change.",
580
+ "After using agent_browser_web_search, cite result URLs in the final answer when web evidence informed the answer."
581
+ ];
582
+ var SHARED_BROWSER_PLAYBOOK_GUIDELINES = [
583
+ QUICK_START_GUIDELINES[0],
584
+ QUICK_START_GUIDELINES[3],
585
+ "Standard workflow: open the page, snapshot -i, interact using current @refs from that snapshot, and re-snapshot after navigation, scrolling, rerendering, or other major DOM changes because refs are page-scoped; the wrapper fails mutation-prone stale/recycled refs before upstream can silently target a different current-page element. On dense pages, use wrapper-side snapshot -i --search <text> or snapshot -i --filter role=<role> to render matching refs while preserving the full ref map in details.refSnapshot, add snapshot --viewport when scroll position or above/below-fold context matters, and add snapshot --diff when a quick before/after ref-map delta would prevent reading a full spill file.",
586
+ "For ordinary forms from one snapshot, batch multiple fill @refs before the submit/click step to avoid serial tool calls; if a fill may autosubmit, navigate, or rerender later fields, split the flow and refresh refs first.",
587
+ "Do not use browser automation to drive public search-engine forms such as Google for discovery; headless jobs that type a query and press Enter can be redirected to anti-bot or CAPTCHA pages. Prefer agent_browser_web_search for live discovery, then agent_browser on a target URL. Do not attempt CAPTCHA bypass.",
588
+ "Snapshot choice: prefer snapshot -i for routine clicks/fills (interactive @refs, main-content-first). Use snapshot --compact when you need a denser same-page tree without full spill; use full snapshot (no -i) only when you need the complete accessibility tree. Re-snapshot after navigation or major DOM changes. When snapshot -i compacts because the tree is oversized, scan visible output for Omitted high-value controls and optional details.data.highValueControlRefIds before opening the spill file: those list bounded searchboxes, textboxes, comboboxes, buttons, named action links, tabs, checkboxes, radios, options, and menuitems that did not fit the key/other ref previews.",
589
+ "When a visible text or accessible-name target should survive ref churn, prefer find locators such as role, text, label, placeholder, alt, title, or testid with the intended action instead of guessing a CSS selector.",
590
+ "For desktop or host-controlled rich inputs, if agent_browser_action fill misses, refresh refs and prefer a current editable @ref from details.richInputRecovery or the latest snapshot; focus or click that ref, then use keyboard type for framework-controlled editors that require real key events. keyboard inserttext is paste-like and can change a DOM value without updating application state, so use it only when later application-state evidence proves the edit was accepted. Do not auto-submit with Enter or a submit button unless the user flow explicitly calls for it.",
591
+ "Do not assume Playwright selector dialects such as text=Close or button:has-text('Close') are supported wrapper syntax unless current upstream agent-browser behavior has been verified.",
592
+ "For authenticated or user-specific content explicitly requested by the user, such as feeds, inboxes, account pages, or private dashboards, use a real profile only when the user/config asks for it or profiles have been inspected; do not assume --profile Default exists on every machine. Do not use a real profile for public pages just because they are dashboards. Treat visible page content from real profiles as model-visible transcript data. On macOS, copied Chrome profiles may omit encrypted cookies, so profile selection alone is not proof of authentication; verify the target page and use a user-approved headed login once when needed. Use --auto-connect only if profile-based reuse is unavailable or the task is specifically about attaching to a running debug-enabled browser. If profile/user-data-dir resolution fails, stop retrying opens, run profiles and/or doctor through agent_browser, then report what the user needs to configure.",
593
+ "Ordinary bare calls share one native browser within your root Pi parent/subagent group; unrelated roots browse independently. Coordinate multi-call navigation inside your group with existing subagent/intercom tools. Explicit native session defaults still win. Pi quit does not close group browsers; never close an unrelated browser.",
594
+ `When using launch-scoped flags (${LAUNCH_SCOPED_FLAG_LABEL}), put them on the first command for that session. If you intentionally use an explicit --session, keep using that same explicit session for follow-ups.`,
595
+ "Cooperating Pi processes serialize each complete browser operation and code cell by native socket context, namespace, and session, including target/ref helpers and state updates. Different identities remain concurrent; namespace-wide close waits for matching operations. All participating Pi instances must load this release; humans, third-party clients, and older extensions are outside that coordination. It is not a transaction or rollback. For raw batches whose later content depends on navigation, use exact batch --bail or split the calls.",
596
+ "After a successful `connect`, `--cdp`, or enabled `--auto-connect` call, verify with get url and keep using the resulting session without repeating the attach flag. The wrapper remembers that attachment across active-branch reload/resume and live-checks the URL before later page reads/interactions because an attached browser can drift externally; caller config, file access, launch arguments, and environment pass through unchanged. A successful close clears the marker. When several named sessions share one Chrome, pass --pin-tab once (AGENT_BROWSER_PIN_TAB) so a closed bound tab fails as tab_gone instead of acting on a neighbor; recover with tab new or tab list. --no-pin-tab turns the sticky pin off. tab list includes each tab's CDP targetId, accepted as a tab ref.",
597
+ `If you already used the implicit session and now need launch-scoped flags (${LAUNCH_SCOPED_FLAG_LABEL}), retry with top-level sessionMode set to fresh or pass an explicit --session for the new launch; never pass --session-mode inside args. After a successful unnamed fresh launch, later auto calls follow that new session.`,
598
+ "Chrome is the default. Use separately installed Lightpanda only when explicitly selected with --engine lightpanda, environment or native config; --engine is launch-scoped, so use sessionMode:fresh to change a managed browser. Lightpanda text-rendered screenshots do not prove graphical layout/visibility or mouse coordinates. Chrome profiles, headed mode, multi-tab, WebGPU and native WebMCP are not parity capabilities; choose Chrome explicitly when needed, never assume automatic fallback.",
599
+ 'For WebGPU pages, use args ["--webgpu", "open", "<url>"] on a fresh local browser launch; use doctor --webgpu (or --headed on Linux/Windows capture paths) to prove rendering before trusting a non-black screenshot. WebGPU cannot be combined with --cdp, --auto-connect, or provider launches unless --webgpu false overrides an enabled config/environment default.',
600
+ "For experimental WebMCP page tools, use webmcp list, then webmcp invoke <tool> with --params and optional --frame/--detach/--timeout; use webmcp result or cancel for detached calls. Locally managed Chrome enables WebMCP by default; a positive navigation hint means the page has tools to list. --no-webmcp is launch-scoped and requires a fresh session; invoke/result/cancel can mutate or navigate, so refresh snapshot refs afterward.",
601
+ "For --allowed-domains, use a fresh local Chrome context. Upstream rejects CDP/auto-connect, profiles, restore/state replay, direct-page providers, iOS/Safari, and startup/profile Chrome args because they cannot guarantee containment; Chromium also disables RTCPeerConnection while the allowlist is active.",
602
+ "For React introspection, launch the page with --enable react-devtools before first navigation, then use react tree, react inspect <fiberId>, agent_browser_source candidates for local UI source hints, react renders start/stop, or react suspense; agent_browser_source is experimental and reports confidence/evidence instead of guaranteed DOM-to-file mappings. For failed fetches and APIs, agent_browser_network_source (experimental) correlates failed network requests with initiator metadata and bounded workspace URL literals\u2014candidates only, not definitive blame. Use vitals [url] for Core Web Vitals and hydration timing, and pushstate <url> for client-side SPA navigation.",
603
+ "For first-navigation setup, use open without a URL plus network route --resource-type <csv>, cookies set --curl <file>, or --init-script/--enable before navigate/opening the target page.",
604
+ "For stateful browser context work, use auth save --password-stdin with the tool stdin field for credentials, auth list/show/delete/remove for local auth-profile maintenance, auth login when you need the browser to fill a saved profile, and state save/load/list/show/rename/clear/clean for upstream saved-state lifecycle. State paths, restore identifiers, wrapper-prefixed sessions, and all upstream list rows remain available; credential values inside cookie/storage/auth payloads are still redacted from presentation.",
605
+ "Upstream restore sessions periodically autosave cookies and localStorage while the browser stays open, including page-driven background changes; AGENT_BROWSER_AUTOSAVE_INTERVAL_MS controls the interval (30000 by default; 0 disables periodic saves but keeps save-on-close), while the never value for --restore-save disables automatic saves for that restore session. For wrapper-owned headed launches, the wrapper defaults the interval to 0 because upstream 0.33.2 collects multi-origin storage through visible temporary tabs, then records and reapplies the effective launch-time value to helpers and follow-ups so daemon configuration remains stable. Native close still saves, but direct window close can lose newer state because upstream exempts headed browsers from idle shutdown; set AGENT_BROWSER_AUTOSAVE_INTERVAL_MS before launch when periodic preservation matters, because changing it on a running wrapper-owned headed session requires close plus a fresh launch.",
606
+ "For batch chains that touch cookies, storage, auth, or other secret-bearing commands, use details.batchSteps for per-step artifacts, categories, spill paths, and full structured errors; top-level details.data on batch is only a compact redacted step matrix (success, argv-redacted command, redacted result or scrubbed error text) built from the same presentation rules as standalone calls.",
607
+ "For non-core families, pass current upstream commands through the native tool directly: network requests, network route <url>, network har start/stop [path], diff snapshot, diff screenshot --baseline <file>, diff url <u1> <u2>, trace start, trace stop [path], profiler start, profiler stop [path], record start <path>, record stop, console/errors [--clear], highlight <selector>, inspect, clipboard read, clipboard write <text>, clipboard copy/paste, stream enable/disable/status, dashboard start/stop, device list for iOS simulator inventory, and chat <message>. For compact network requests output, prefer details.nextActions for request detail, route-mock diagnostics, actionable failed-request agent_browser_network_source, filtering, clearing the aggregate buffer before repro, or HAR capture follow-ups instead of guessing request-id syntax. Artifact-producing commands report details.artifacts and verification state; long-running starts such as stream, dashboard, trace/profiler, and record should be paired with the matching stop/disable command when the task is done; stream enable already-enabled outcomes are treated as idempotent success with status/disable follow-ups.",
608
+ 'For Electron desktop apps, enable agent_browser_electron through agent_browser_tools for wrapper-owned discovery, isolated launch, status, compact probe, and cleanup: list first, treat likely-sensitive annotations as hints rather than enforcement, launch with the default snapshot handoff unless handoff: "tabs" is the safer diagnostic starting point, use agent_browser_electron probe or snapshot -i/agent_browser_qa attached:true for current-session state, and always cleanup the returned launchId when done. agent_browser_electron launch uses an isolated temporary profile; it does not reuse the app\'s normal signed-in profile or attach to an already-running authenticated app. For signed-in local app state, host-launch the normal app with --remote-debugging-port when appropriate, then use raw args connect <port|url>; after connect, run get url to verify the active target before page-content reads, inspect tab list, select the stable tab id such as tab t2, verify it again with get url, then run a condition wait or snapshot -i before using refs. close commands (`close`, `quit`, or `exit`) only close the browser/CDP session; leave manually launched app shutdown, profile cleanup, and explicit artifacts to the host owner.',
609
+ "For provider or specialized app workflows, load version-matched upstream guidance with skills get agentcore|electron|slack|dogfood|vercel-sandbox|derive-client through the native tool; add --full when you need references/templates, and use skills get --all only for broad skill audits. Use derive-client when recording HAR traffic to generate a standalone API client; prefer network har start (text bodies by default) or network har start --content all|none before multi-step capture. For accessibility audits use a11y or a11y --tags wcag2a,wcag2aa (CDP browsers only). Hosted sandbox workflows should use upstream @agent-browser/sandbox helpers outside this wrapper. Provider launches such as -p ios, --provider browserbase/kernel/browseruse/browserless/agentcore, and iOS --device are upstream-owned setup paths; use sessionMode fresh when switching providers and expect external credentials or local Appium/Xcode setup to be required.",
610
+ "For dialogs and frames, use dialog status/accept/dismiss and frame <selector|main> through native args; dialog commands and eval snippets that look like alert/confirm/prompt/dialog triggers are shorter-bounded than normal browser calls, and timed-out dialog-like interactions may add inspect-dialog-after-timeout, dismiss-dialog-after-timeout, or recover-fresh-session-after-dialog-timeout nextActions. Set --confirm-actions on the session's first command; selected strings, including an explicit empty string, follow same-identity helpers and resumed follow-ups until successful close. Native unset keeps ordinary native defaults. Changing a running daemon's policy can discard pending confirmations. When it produces a pending confirmation, including a cold-reopen helper, follow the exact details.nextActions or confirm <id> / deny <id> calls without repeating the policy or inventing ids. Matching native guarded controls avoid page helpers that could replace the pending action; this is not native ID-validation proof or browser independence. In native batch, only a matching first effective decision gets that helper suppression; later page/ref checks remain. Nested decisions remain pending; failed inner actions fail, and completed browser actions reconcile their page state. A pending tab_new transport may show a validated after_confirmation open request and conditional guidance: follow it in the same session and new tab only after successful tab approval, never after denial. The extension does not execute that continuation. Confirmed full snapshots install returned refs; a final confirmed capture supplies the next same-identity call's freshness sample once, including semantic role click/check/fill and unique accessible select resolution, with target/membership/invalidation checks intact. On this one use, live verification compares the complete capture URL, including fragments, and rejects refs when it changes\u2014including wrapper-owned managed sessions and warm sessions without resume. Ordinary ref/tab URL comparisons remain fragment-insensitive. Pending snapshots display confirmation required, not an empty page. Intervening calls or later rows consume it; DOM-only renames on the same page after that sample are not resampled on this one use.",
611
+ 'If a session lands on the wrong page or tab, an interaction changes origin unexpectedly, or an open call returns blocked, blank, or otherwise unexpected results, use tab list / tab <tab-id-or-label> / snapshot -i to recover state before retrying different URLs or fallback strategies. For headed demos, put --headed on the first launch with sessionMode=fresh and verify with screenshot/tab/get-url evidence because tool success cannot prove the OS window is visible to the user. For desktop readiness, prefer real conditions first: wait --text, wait --url, wait --fn, wait --load <state>, wait --download, or agent_browser_qa attached:true; for disappearance checks, use wait --fn predicates instead of stale upstream-help examples like wait <selector> --state hidden. Use agent_browser_electron probe/status for wrapper-owned launch health or target mismatch. Fixed waits are a last resort: their duration is positional (wait <ms>, not wait --time <ms>). Use explicit --timeout or top-level timeoutMs for legitimately slow waits, and treat a successful payload like "waited":"timeout" as elapsed time only\u2014verify completion with an observed condition, fresh snapshot, or screenshot.',
612
+ "For feed, timeline, or inbox reading tasks, focus on the main timeline/list region and read the first item there rather than unrelated composer or sidebar content.",
613
+ "For read-only browsing tasks, use read <url> for documentation or other unstructured text without requiring a Chrome page, or read with no URL for rendered active-tab DOM. Prefer the current snapshot, structured ref labels, getters, or scoped eval --stdin when you need interactive structure or targeted page state. Only click into media viewers, detail routes, or new pages when the current view does not contain the needed information.",
614
+ "For downloads, prefer download <selector> <path> when an element click should save a file; native download owns the click and download, including loopback links, generated Blob exports, and redirects. Do not rely on click alone when you need the downloaded file on disk.",
615
+ "On dashboards with nested scroll containers, verify scroll with a screenshot or fresh snapshot -i; if the viewport did not move, details.data.scrolled may be false/noMovement true and you should prefer scrollintoview <@ref> or target the actual scrollable region with scroll <selector> <dir> [px|percent]. For native selects, use select <selector> <value...> (or agent_browser_action select) instead of clicking option refs; for custom comboboxes, a click/agent_browser_action may only focus the field, so re-snapshot and use keyboard type <text> for focused input, press ArrowDown or press Enter, or visible option refs. Raw type requires both <selector> and <text>.",
616
+ "When using eval --stdin, scope checks and actions to the target element or route whenever possible instead of relying on broad page-wide text heuristics.",
617
+ "When using eval --stdin for extraction, pass the JavaScript through the native tool stdin field, not as an extra args token after --stdin, and return the value you want instead of relying on console.log as the primary result channel. Prefer plain expressions like ({ title: document.title }) or explicitly invoked functions like (() => ({ title: document.title }))(); use outputPath when the eval/get/snapshot data should be saved as a durable local file, but never reuse a screenshot, download, recording, or other browser artifact destination as outputPath. If a function-shaped snippet returns {}, details.evalStdinHint may warn that the function was serialized instead of called. Local file pages and caller-selected output paths are supported when upstream allows them. If get text on a broad CSS selector surfaces details.selectorTextVisibility or selectorTextVisibilityAll, prefer a visible @ref, a more specific selector, or the inspect-visible-text-candidates nextAction over hidden tab content.",
618
+ "When details.pageChangeSummary is present, use changeType and summary as a compact signal for navigation, DOM mutation, confirmations, or artifacts; when nextActionIds is set, match those ids to entries in details.nextActions (or per-step nextActions inside batch) for concrete follow-up payloads instead of inferring from prose alone. Optional click-dispatch probes are skipped when native confirmation settings guard evaluate, without bypassing native click policy. Otherwise probes require native get attr readback of a temporary marker on the candidate target; unproven ref or XPath identity leaves the native click unverified, not failed. If details.clickDispatch reports a click-dispatch miss, refresh/inspect/retry the real click first; for static local fixtures only, an explicit eval --stdin programmatic .click() can exercise app handlers, but treat it as an untrusted scripted workaround and never use it to bypass stop-before-submit/order/purchase boundaries. If an upstream click failure says the target is covered by another element at the target's click point, use the inspect-overlay-state nextAction to refresh refs and inspect the blocker before deciding whether to retry; do not blindly repeat the blocked click. If a no-navigation click surfaces details.overlayBlockers, inspect the fresh snapshot evidence before using a close/dismiss candidate nextAction; ordinary page chrome without dialog/alertdialog evidence should not trigger this diagnostic.",
619
+ "On upstream 0.38+, use snapshot --delta for native full/unchanged/changed revisions; --delta --full resets its baseline. Surviving DOM nodes keep refs, but refresh after navigation or replacement. Wrapper filters use full trees. screenshot --if-changed or --threshold 0.01 can return changed:false with no path or image; use ordinary screenshots when a file is required. --input-mode instant|smooth|human controls sticky pointer behavior; click/drag --human and mouse move --duration/--steps/--human/--seed pass through. record start/restart accept --cursor, --contact-sheet, and --contact-sheet-threshold; stop and verify both video and reported contact sheet. auth login <name> --no-navigate fills a prepared login page only after native origin checks. WebMCP catalog updates are untrusted page data; webmcp list supplies full schemas.",
620
+ "When commands save or spill files (screenshots, downloads, PDFs, traces, recordings, HAR, large snapshot spills), use the user's exact requested paths when given and treat paths as provisional until details.artifactVerification shows every row verified: branch on missingCount, pendingCount, unverifiedCount, per-entry state, and optional limitation before downstream file use or PASS/FAIL reporting.",
621
+ "For evidence-only screenshots, QA captures, or other audit artifacts, save to an explicit path and branch on details.artifactVerification plus details.artifacts before reporting PASS/FAIL; do not require vision review of inline image attachments unless the user asked for visual inspection.",
622
+ "Respect explicit user stop boundaries yourself. When the surrounding authenticated employee or automation context is explicitly unattended/auto-approved, ordinary non-destructive form submissions within the requested flow may proceed without separate confirmation. Still require explicit authorization for purchases, production-control actions, destructive or irreversible actions, and account, security, or privacy changes. The wrapper does not infer broad business intent from prompt text; details.promptGuard is reserved for concrete artifact-before-close checks.",
623
+ "Recording needs ffmpeg on PATH before start. Current upstream checks it at startup; older natives may defer failure. A pending recording is not verified output.",
624
+ "Do not call --help or other exploratory inspection commands unless the user explicitly asks for them or debugging the browser integration is necessary."
625
+ ];
626
+ var TOOL_PROMPT_GUIDELINES_SUFFIX = [
627
+ "Prefer agent_browser over bash, osascript, AppleScript, or generic browser shell for sites, docs, clicks, fills, screenshots, eval, and batch."
628
+ ];
629
+ var INSPECTION_TOOL_CALL_EXAMPLES = [
630
+ '{ "args": ["--help"] }',
631
+ '{ "args": ["--version"] }'
632
+ ];
633
+ var WRAPPER_TAB_RECOVERY_BEHAVIOR = [
634
+ "After open/goto/navigate calls with --profile, --restore, --session-name, or --state, agent_browser best-effort re-selects the tab whose URL matches the returned page when restored tabs steal focus during launch or reconnect.",
635
+ "After confirmed shutdown of an automatically restored managed session, the wrapper retains its complete recorded URL, including the fragment, until the first current-page operation (including get url and reload). Non-page calls such as tab list may start a daemon without fulfilling that reopen; explicit URL reads leave the managed browser and pending reopen untouched. The wrapper uses native open once, verifies the observed tab, and discards old refs/frame scope; it does not restore unsaved forms, JavaScript memory, or history. Explicit navigation, caller-owned/attached sessions, and restore-disabled sessions are not auto-reopened.",
636
+ "For a still-live browser after tab drift or resume, the wrapper verifies/selects the intended tab before ref/semantic helpers and page commands; failed selection stops the call without navigating. Local commands, read <url>, URL a11y/vitals, diff url, window new, and explicit tab/navigation/connection/state recovery do not require the prior tab. Batch checks follow effective rows past non-page prefixes and stop at explicit context changes, preserving caller argv/stdin and continue-on-error behavior. Same-tab reselection is avoided because it clears refs. Use exact batch --bail for fail-fast, not --bail=<value>. Routine same-session calls skip tab-list preflights.",
637
+ "For sessions with observed tab-drift risk, after a successful command on a known target tab, agent_browser also best-effort restores that intended tab if a restored/background tab steals focus after the command completes. Routine same-session commands skip focus correction; observed pages without a native targetId use tab list to establish their identity.",
638
+ "If a known session target unexpectedly reports about:blank, agent_browser best-effort re-selects the prior intended target when it still exists; if recovery fails, it records the observed about:blank target and reports exact recovery guidance instead of treating the prior page as active.",
639
+ "If upstream reports tab_gone, the pinned bound tab is gone; use details.nextActions (tab list / tab new) instead of assuming another tab is yours."
640
+ ];
641
+ var RUNTIME_PROMPT_GUIDELINES = [
642
+ "Use agent_browser for one native command; batch --bail with JSON-array stdin for fixed sequences; agent_browser_code for loops/branches/aggregation. Return to the model at judgment boundaries. Use agent_browser_tools to discover/enable action, qa, electron, source, or network tools.",
643
+ "agent_browser_code runs fresh JavaScript against the persistent browser: await browser({args, stdin?, timeoutMs?}), check result.success, emit(selected JSON), or emitImage(result.imageObservations[0]). No host APIs/imports; globals do not persist. Explicit session/namespace selects this cell's browser without changing the default.",
644
+ "For agent_browser, use open \u2192 snapshot -i \u2192 current @refs; re-snapshot after changes. Batch same-snapshot fills before submit; split on rerenders/navigation. Native args, profiles, auth, providers, paths, config and environment pass through. Use requested/configured profiles and verify authentication after restart.",
645
+ "agent_browser bare calls share a root Pi browser with descendants, not unrelated roots; coordinate navigation within the group. Native explicit sessions win. sessionMode:fresh intentionally launches a separate managed browser. Never close an unrelated browser.",
646
+ "For agent_browser and agent_browser_code, follow visible nextActions. Inspect unknown mutation outcomes before retry. Use exact user paths; verify artifactVerification/artifacts before success claims. Save promptGuard-required files before close; close keeps files; waited:timeout proves nothing.",
647
+ "For agent_browser screenshot coordinates, use imageObservations dimensions/viewport/crop/origin/scroll/DPR; full-page and element images are not viewport CSS coordinates. Pi image resizing maps sent pixels to original image pixels only. Lightpanda rendering:text images never establish CSS/mouse coordinates. Prefer refs; inspect screenshots only when the task needs vision.",
648
+ "In agent_browser workflows, ordinary requested non-destructive submissions may proceed in authenticated unattended/auto-approved flows. Honor explicit stops; require explicit authorization for purchases, production-control, destructive/irreversible, or account/security/privacy changes.",
649
+ "agent_browser: read <url> for text, get title/url, get text/html/value/count <selector>, get attr <selector> <name>; heed visibility warnings and Omitted high-value controls. Verify nested scrolling via snapshot/screenshot. Use --json only for JSON text; recording needs ffmpeg before start and a verified stop."
650
+ ];
651
+ function buildBrowserExecutablePathGuideline(executablePath) {
652
+ if (executablePath === void 0 || executablePath.length === 0) {
653
+ return void 0;
654
+ }
655
+ return `agent_browser config sets browser.executablePath to ${JSON.stringify(executablePath)}. Global/override values bootstrap inactive automatic root Chrome browsers, not Lightpanda; bare calls preserve active native launch settings. Project-only values remain guidance for explicit --executable-path launches. Use sessionMode:fresh only for an intentionally separate managed browser, not routine root-group browsing. Upstream profiles lists Chrome profiles only; use a supported explicit profile path for other Chromium browsers.`;
656
+ }
657
+ function buildBrowserDefaultProfileGuideline(profile) {
658
+ if (!profile || profile.policy === "explicit-only") {
659
+ return void 0;
660
+ }
661
+ if (profile.policy === "always") {
662
+ return `agent_browser config sets browser.defaultProfile.name to ${JSON.stringify(profile.name)} with policy always. Global/override Chrome profile names bootstrap automatic root Chrome browsers, not Lightpanda, through independent native copies with per-root restore; bare calls and helpers preserve the active native launch settings without resending bootstrap options. Paths and project-only settings stay advisory. Explicit unrelated sessions are unchanged. Verify actual app auth after restart: native JSON restore omits new IndexedDB and memory-only credentials; use a supported per-root persistent profile if needed. Profile content is model-visible user data.`;
663
+ }
664
+ return `agent_browser config sets browser.defaultProfile.name to ${JSON.stringify(profile.name)}; for signed-in/account-specific browser tasks, reuse a configured native shared session with bare calls, otherwise start with --profile ${JSON.stringify(profile.name)} plus sessionMode:fresh unless the user asks for a different profile.`;
665
+ }
666
+ function buildToolPromptGuidelines(options) {
667
+ const browserDefaultProfileGuideline = buildBrowserDefaultProfileGuideline(options.browserDefaultProfile);
668
+ const browserExecutablePathGuideline = buildBrowserExecutablePathGuideline(options.browserExecutablePath);
669
+ return [
670
+ ...options.includeWebSearch ? ["Prefer agent_browser_web_search for facts; agent_browser for pages."] : TOOL_PROMPT_GUIDELINES_PREFIX,
671
+ ...options.docs ? [buildInstalledDocsGuideline(options.docs)] : [],
672
+ ...RUNTIME_PROMPT_GUIDELINES,
673
+ ...browserExecutablePathGuideline !== void 0 ? [browserExecutablePathGuideline] : [],
674
+ ...browserDefaultProfileGuideline !== void 0 ? [browserDefaultProfileGuideline] : [],
675
+ TOOL_PROMPT_GUIDELINES_SUFFIX[0]
676
+ ];
677
+ }
678
+ export {
679
+ ADVANCED_TOOL_PROMPT_GUIDELINES,
680
+ INSPECTION_TOOL_CALL_EXAMPLES,
681
+ PROJECT_RULE_PROMPT,
682
+ QUICK_START_GUIDELINES,
683
+ RUNTIME_PROMPT_GUIDELINES,
684
+ SHARED_BROWSER_PLAYBOOK_GUIDELINES,
685
+ TOOL_PROMPT_GUIDELINES_PREFIX,
686
+ TOOL_PROMPT_GUIDELINES_SUFFIX,
687
+ WEB_SEARCH_PROMPT_GUIDELINE,
688
+ WEB_SEARCH_TOOL_PROMPT_GUIDELINES,
689
+ WRAPPER_TAB_RECOVERY_BEHAVIOR,
690
+ buildBrowserDefaultProfileGuideline,
691
+ buildBrowserExecutablePathGuideline,
692
+ buildInstalledDocsGuideline,
693
+ buildToolPromptGuidelines
694
+ };