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
@@ -16,6 +16,16 @@ The package install path is the primary product path. Local checkout development
16
16
 
17
17
  Runtime graphs that use Pi host APIs are statically imported through Pi's extension loader, which supplies the host-peer mapping. Native ESM lazy imports must not bypass that mapping: a runtime-only global package does not install its optional Pi peers. The browser runner and observation/image publication retain Pi's native image primitives without a package-owned resolver or bundled host.
18
18
 
19
+ The build keeps the complete emitted checkout tree, with its shared module-owned
20
+ process environment and temporary-artifact cleanup state. Only the canonical
21
+ `dist/extensions/agent-browser/index.js` is replaced by its bundle; the worker and
22
+ all emitted libraries remain untouched. Six private package-only helper bundles
23
+ live under `dist/packaged/lib/`: config policy, offline session conversion, parsing,
24
+ playbook, snapshot, and runtime. npm publishes those helpers, the canonical extension,
25
+ and the unchanged permissioned worker through exact `package.json` paths. CLI imports
26
+ use the private packaged helpers; package imports stay external, including optional
27
+ Pi peers. GitHub/source installs retain the same `prepare` build.
28
+
19
29
  ## Chosen shape
20
30
 
21
31
  ### Compact tools and native discovery
@@ -60,7 +70,7 @@ All participating Pi processes must restart with the updated package. The lock i
60
70
 
61
71
  `lib/browser-transcript.ts` defines one canonical `data.event` format and optional once-stored `data.snapshot`. Direct, advanced, code and Electron host operations record begin/finish receipts before dispatch and after observed effects, using outer tool-call ID plus inner index and a unique operation ID. The shared page reducer retains an inaccessible candidate during unresolved work and requires explicit reuse/replace/invalidate/unknown disposition. Ordinary results omit unchanged maps and unrelated artifact receipts; journal events carry redacted artifact-row changes in commit order. Final rendering queues actual spill writes and manifest publication, allowing unrelated small observations to finish while another namespace holds its artifact/lifecycle operation. `lib/orchestration/browser-run/artifact-merge.ts` preserves concurrent three-way manifest updates and recording lifecycle order. Native lifecycle evidence is retained before presentation/export. Failed begin blocks dispatch; failed finish stops dependent work and requires inspection without mutation replay. A named persistent journal requires actual publication even before Pi's first conversation. Disabled/no-file sessions use the native current in-memory ancestry for direct browser work without claiming durability; code still requires a published intent journal. Observation-only artifact receipts are optional without a published journal, so sessionless local results retain complete redacted private spills and selected files. Code lifecycle joins include outer finalization, and the shared generation guard keeps prior-branch observation spills process-private and prevents their artifact publication onto the new branch. JavaScript variables are never persisted.
62
72
 
63
- `lib/browser-journal.ts` token-projects published envelopes and ancestry through public Pi file/header/leaf APIs, loading only winning snapshot definitions. It captures the selected leaf before asynchronous reads and validates that same branch through public `getEntry()` ancestry on both hosts. Capture-local admission reuses a validated append-only prefix while checking endpoint identity/parent and new suffixes; publication/durability checks remain independent. Startup/tree restoration uses one queued captured replay for branch state and cleanup leases, with one per-session launch-configuration fold. Stock official 1.0.0 still eagerly loads native history before extension startup. Legacy adapters live only in `lib/browser-session-conversion.ts`, which publishes a validated stopped separate copy while retaining the source. Native generation checks use PID/start and socket identity, never saved URL or delta revision alone. Filtered/helper captures share this check. Small owner-qualified launch receipts retain observed restore-key provenance; restart verifies the current native generation and key before treating that provenance as live. Full storage, migration and consumer-memory boundaries are documented in [`SESSION_STORAGE.md`](SESSION_STORAGE.md).
73
+ `lib/browser-journal.ts` token-projects published envelopes and ancestry through public Pi file/header/leaf APIs, loading only winning snapshot definitions. It captures the selected leaf before asynchronous reads and validates that same branch through public `getEntry()` ancestry on both hosts. Capture-local admission reuses a validated append-only prefix while checking endpoint identity/parent and new suffixes; publication/durability checks remain independent. Startup/tree restoration uses one queued captured replay for branch state and cleanup leases, with one per-session launch-configuration fold. Stock official 1.0.0 still eagerly loads native history before extension startup. `lib/browser-legacy-projection.ts` and its shared field projection normalize historical receipts read-only into this same canonical reducer at the journal boundary. Normal resume keeps the original bytes and locator; mixed-format ancestry, confirmation settings/provenance and cleanup ownership remain branch-relative. Non-winning legacy maps are discarded after each receipt. Native event validation cannot downgrade to the legacy path. `lib/browser-session-conversion.ts` reuses that decoder only when an operator explicitly requests a validated stopped separate archive copy. Native generation checks use PID/start and socket identity, never saved URL or delta revision alone. Filtered/helper captures share this check. Small owner-qualified launch receipts retain observed restore-key provenance; restart verifies the current native generation and key before treating that provenance as live. Full storage, migration and consumer-memory boundaries are documented in [`SESSION_STORAGE.md`](SESSION_STORAGE.md).
64
74
 
65
75
  ### Canonical observations and image geometry
66
76
 
@@ -197,6 +207,7 @@ Practical policy:
197
207
  - record successful `connect`, `--cdp`, enabled `--auto-connect`, environment-configured CDP/auto-connect, and wrapper Electron attachment identities in branch-visible state. First-use and later content-bearing calls live-check `get url` because attached targets can drift outside Pi. Caller config, file access, launch arguments, and environment pass through unchanged; only wrapper-injected compatibility launch arguments are omitted on active attachments. A terminal successful close removes the marker; a close followed by a later step whose lifecycle reports a browser launch preserves it, while a non-launching diagnostic such as `stream status` leaves the close terminal
198
208
  - when a successful close targets the current extension-managed session, including an explicit `--session <current> close` or an `electron.cleanup` managed-session step, clear page/ref state, mark that session inactive, untrack cleanup ownership, and rotate the next default auto call to a fresh wrapper-generated session name rather than reusing the closed name
199
209
  - on non-quit shutdown such as `/reload`, close off-branch owned managed sessions and off-branch owned Electron launches before clearing process-local ownership, but preserve the current branch-visible active managed session and Electron launch plus that launch's isolated `userDataDir` so reload continuity still works from the active transcript branch. First reuse of a restored Electron attachment checks the recorded namespace/session, live PID/profile presence, and exact browser WebSocket identity against current CDP metadata, then uses upstream `get cdp-url` to verify that the named daemon still targets that browser or one of its current pages. The metadata probe cannot commit daemon provenance merely by spawning; only a matching result permits the existing policy to record it. Ordinary calls, status, and probe share this path under the existing lock. Generic restore-disabled sessions, mismatched connections, quit, and off-branch cleanup are unchanged
210
+ - require a nonempty, non-whitespace `Browser`/`browser` string in `/json/version` for Electron CDP readiness and debug-port liveness; other version metadata is optional. Before signaling a live restored Electron PID without a tracked child handle, require the process start identity recorded at launch to match the live process (the same `process-identity.ts` PID-reuse proof used for execution claims and temp-root ownership); a missing, unreadable, or mismatched identity retains the process/profile
200
211
  - expose still-owned off-branch Electron launch records to `electron.status { launchId }`, `electron.status { all: true }`, `electron.probe { launchId }`, and `electron.cleanup`, while leaving default `electron.probe` scoped to the current managed session
201
212
  - if an unnamed fresh launch replaces an active extension-managed session, best-effort close the old managed session after the switch succeeds; `managedSessionOutcome.replacedSessionClosed` records whether that cleanup succeeded, and a failed close keeps the older identity wrapper-owned across transcript resume for explicit follow-up or cleanup
202
213
  - expose `details.browserWindow` and one visible login handoff only when a successful first/fresh local wrapper-managed headed result, including `batch`, is not an attachment and has upstream `lifecycle.effectiveLaunch.browserLaunched: true` and a `created`/`replaced` managed-session outcome. Keep `visibility: "unverified"`: this is launch evidence, never a claim about the user's OS desktop
@@ -205,12 +216,12 @@ Practical policy:
205
216
  - once the wrapper observes tab-drift risk for a session (profile restore correction, overlapping stale opens, or restored session state), later active-tab commands verify the intended tab under the existing session queue before semantic/ref helpers and user commands. Targets retain native CDP `targetId` across transcript replay; exact identity distinguishes duplicate URL/title tabs, while older targets without an ID keep URL-based matching. A cold managed reopen replaces the old ID. Native selection runs only when the intended tab is not already active, because upstream selection clears refs and frame scope even on same-tab reselection. Missing targets, failed selection, and post-selection target mismatches fail before user commands. Caller argv/stdin and native `--pin-tab` / `--no-pin-tab` preferences remain unchanged. Local commands, live `get url`, explicit HTTP `read <url>` (including its flags), URL `a11y`/`vitals`/`web-vitals`, `diff url`, `window new`, URL-bearing recording commands, and explicit tab/navigation/`connect`/`state load` recovery do not require the old target; history back/forward/reload, `pushstate`, and page-content operations still do. The same classifier scans effective batch rows past non-page prefixes until a page dependency or explicit context change, without rewriting user rows or changing bail behavior. For `window new` and `diff url`, observe the resulting URL instead of retaining the old target or treating the requested second URL as redirect evidence. Fold only reached native batch rows when available, discard targets before failed navigation/context transitions and live-verify the final page, discard observations and refs from before window/diff transitions, and let later successful snapshots rebuild refs even when another batch row fails. Retain an observed blank destination after either command instead of recovering the old page; if no final target is observed, use the existing unknown-target state. Caller batch arguments, stdin and bail behavior stay unchanged. Successful batches containing navigation-observable actions use the same final live page/identity observation as direct actions, so same-address popup tabs replace the pre-batch target before later pinning. Terminal batch closes do not trigger a page probe, and pending WebMCP targets remain unknown. Routine same-session commands avoid `tab list` preflights
206
217
  - for sessions with observed tab-drift risk, after a successful command on a known tab target, the wrapper may best-effort restore that same target again if restored/background tabs steal focus after the command returns; routine same-session commands skip focus correction, while observed pages without a returned native ID use `tab list` to establish current identity rather than inheriting an earlier tab's ID
207
218
  - after successful tab creation, selection, or close, including dispatched native batch rows, read the now-active URL and fresh non-blank title—even when two tabs share a URL—before updating per-session page state; retain the deliberate blank target instead of treating it as accidental drift
208
- - keep a per-session `refSnapshot` aligned with the last successful `snapshot` (including refs merged from a successful `batch` by taking the last successful `snapshot` step in batch result order): restore its once-stored ancestral definition when reloading, resuming, or moving to a different Pi session-tree branch, retain full membership and accessible metadata from that capture for wrapper-side diagnostics, drop it on successful close commands (`close`, `quit`, or `exit`), replace it with a persisted `page-transition` invalidation after any upstream-executed `record start` attempt (direct or batch; older supported natives can swap the page before their already-active check, so failed starts count; the warning and persisted summary explicitly describe conservative ref invalidation, not an observed page change), a `record restart` with a URL operand, `window new`, `diff url`, or WebMCP `invoke` / `result` / `cancel` (these page-provided tools can mutate, rerender, or navigate; when a spawned `batch` yields no parseable result rows, for example after a wrapper timeout, planned transition steps still record the invalidation), or after a failed transition command (`eval`, `back`, `forward`, `reload`, `connect`, `state load`, `tab` selection), including reached batch transitions and failed batch `open` rows whose live URL re-verification probe observed the page (a failed transition can still have mutated or replaced the document before throwing, so keeping the verified URL must not keep the prior refs; transcript replay preserves the persisted invalidation summary), and refuse page-scoped `@e…` argv before spawn when the active tab URL no longer matches the snapshot URL, when a ref id was never in that snapshot, when the snapshot state is invalidated, or when a `batch` step would reuse `@e…` on a guarded getter or mutation step after an earlier invalidating step (including `record start`, URL-bearing `record restart`, and WebMCP `invoke` / `result` / `cancel`) without a later `snapshot` step in the same plan; batch steps come from the source upstream actually executes (raw batch argument strings exclusively when any exist — filtering only the exact `--bail` token like upstream — stdin only otherwise, via `getUpstreamEffectiveBatchSteps` in `extensions/agent-browser/lib/orchestration/batch-stdin.ts`); tab recovery (which leaves user argv/stdin and continue-on-error control flow unchanged), artifact/recording preflight, batch screenshot path preparation (parent directories are created for effective raw rows too, without rewriting raw strings), and stale-ref echo args use that same selection so pinning and preflights cannot act on upstream-ignored stdin, while the pre-spawn state-policy validator deliberately keeps scanning parseable stdin alongside argv as a fail-closed content superset and treats stdin parse failures as fatal only when upstream would actually read stdin (its raw-token filter also uses the exact `--bail` token only). Same-snapshot `fill @e…` rows are guarded but do not themselves set that invalidation latch, so ordinary form fills can precede a click/submit row in one batch—see [`TOOL_CONTRACT.md`](TOOL_CONTRACT.md#details) for the agent-visible contract and failure text; typed per-session tab/ref/pinning state lives in `extensions/agent-browser/lib/session-page-state.ts` and is updated by `orchestration/extension-observation.ts` after each tool result
219
+ - keep a per-session `refSnapshot` aligned with the last successful `snapshot` (including refs merged from a successful `batch` by taking the last successful `snapshot` step in batch result order): restore its once-stored ancestral definition when reloading, resuming, or moving to a different Pi session-tree branch, retain full membership and accessible metadata from that capture for wrapper-side diagnostics, drop it on successful close commands (`close`, `quit`, or `exit`), replace it with a persisted `page-transition` invalidation after any upstream-executed `record start` attempt (direct or batch; older supported natives can swap the page before their already-active check, so failed starts count; the warning and persisted summary explicitly describe conservative ref invalidation, not an observed page change), a `record restart` with a URL operand, `window new`, `diff url`, or WebMCP `invoke` / `result` / `cancel` (these page-provided tools can mutate, rerender, or navigate; when a spawned `batch` yields no parseable result rows, for example after a wrapper timeout, planned transition steps still record the invalidation), or after a failed transition command (`eval`, `back`, `forward`, `reload`, `connect`, `state load`, `tab` selection), including reached batch transitions and failed batch `open` rows whose live URL re-verification probe observed the page (a failed transition can still have mutated or replaced the document before throwing, so keeping the verified URL must not keep the prior refs; transcript replay preserves the persisted invalidation summary), and refuse page-scoped `@e…` argv before spawn when the active tab URL no longer matches the snapshot URL, when a ref id was never in that snapshot, when the snapshot state is invalidated, or when a `batch` step would reuse `@e…` on a guarded getter or mutation step after an earlier invalidating step (including `record start`, URL-bearing `record restart`, and WebMCP `invoke` / `result` / `cancel`) without a later `snapshot` step in the same plan; the latch scan covers the whole plan, including rows after its first snapshot even when no earlier refs exist, so a non-form click between snapshot and ref getter still requires another snapshot. Batch steps come from the source upstream actually executes (raw batch argument strings exclusively when any exist — filtering only the exact `--bail` token like upstream — stdin only otherwise, via `getUpstreamEffectiveBatchSteps` in `extensions/agent-browser/lib/orchestration/batch-stdin.ts`); tab recovery (which leaves user argv/stdin and continue-on-error control flow unchanged), artifact/recording preflight, batch screenshot path preparation (parent directories are created for effective raw rows too, without rewriting raw strings), and stale-ref echo args use that same selection so pinning and preflights cannot act on upstream-ignored stdin, while the pre-spawn state-policy validator deliberately keeps scanning parseable stdin alongside argv as a fail-closed content superset and treats stdin parse failures as fatal only when upstream would actually read stdin (its raw-token filter also uses the exact `--bail` token only). Same-snapshot `fill @e…` rows are guarded but do not themselves set that invalidation latch, so ordinary form fills can precede a click/submit row in one batch—see [`TOOL_CONTRACT.md`](TOOL_CONTRACT.md#details) for the agent-visible contract and failure text; typed per-session tab/ref/pinning state lives in `extensions/agent-browser/lib/session-page-state.ts` and is updated by `orchestration/extension-observation.ts` after each tool result
209
220
  - native 0.37 owns first-document setup inheritance for new tabs; the wrapper does not copy headers, user agents or other browser setup itself. The page-summary formatter displays native positive WebMCP availability while retaining raw details; it adds no discovery probe
210
221
  - when a direct or batched WebMCP call returns `status: "pending"`, or `result` / `cancel` fails while that target is unknown, keep its tab target unknown and discard same-call snapshot evidence instead of treating an immediate post-dispatch URL probe as stable; `webmcp result` / `cancel`, `get url`, and explicit navigation remain available while unknown; replace the generic blocked snapshot action with `verify-page-target-after-pending-webmcp` (`get url`), and let a completed `batch --bail` use that verification before `snapshot -i` to re-establish both target and refs
211
222
  - for top-level non-Electron direct `click` commands with an eligible target, install a bounded in-page target-specific event probe before upstream runs; if upstream reports success but no trusted pointer/mouse/click event reached the resolved target, fail the tool and report `details.clickDispatch` with explicit retry/inspect next actions (the wrapper does not replay clicks in-page). The probe covers `xpath=` targets and current `@e…` / `ref=` refs whose latest stored `refSnapshot.refs` role is `button`, `checkbox`, `menuitem`, `radio`, `switch`, or `tab`; it requires a unique role/name in the saved snapshot and the live candidates instead of taking a fresh pre-click snapshot that could recycle upstream refs. Ref and XPath candidates must additionally prove identity through a per-probe temporary DOM attribute read back by native `get attr <original-selector> <marker>`. Missing or mismatched identity, including XPath/frame scope mismatches, cleans up the probe and lets native click run without dispatch verification; candidate naming heuristics alone are never proof. Duplicate-name refs pass through without a probe: their old ordinal is not target identity. The probe is intentionally skipped when the effective native confirmation list guards `evaluate`, avoiding an optional-eval approval loop without bypassing native click policy. Dynamic action-policy files stay native-owned. It is also skipped for CSS selector clicks, unresolved `find … click` locators, and `batch`/`qa` click steps
212
223
  - skip unrelated tools and harmless Bash inspections before building prompt policy. Seed the latest raw user message on start/tree, update it on user `message_end`, and re-read its current content before parsing policy so native content replacement cannot leave stale intent. Capture that policy at queued admission without a whole-branch scan on every event. Derive narrow prompt guards only for concrete evidence invariants: explicitly requested screenshot/recording output paths block browser close until the artifact manifest verifies those paths, while bare inbound attachment paths remain inputs. The wrapper intentionally does not infer broad business/user intent from prompt text such as order/payment/post boundaries; agents must follow those instructions themselves. The artifact guard is bounded preflight policy (`details.promptGuard`, `failureCategory: "policy-blocked"`), not a reusable browser recipe layer
213
- - keep the existing page/selector scroll API; explicit CSS-container movement uses `Element.scrollBy` with `behavior: "instant"` before measuring offsets so smooth-scroll CSS cannot cause a premature no-movement failure
224
+ - keep the existing page/selector scroll API; shims intercept only complete recognized shapes (`scroll to end|top` with exactly three tokens, or CSS-container scroll with three/four), passing surplus operands through to native execution without dropping them. Explicit CSS-container movement uses `Element.scrollBy` with `behavior: "instant"` before measuring offsets so smooth-scroll CSS cannot cause a premature no-movement failure
214
225
  - reject direct and effective batch `scrollintoview text=...` / `scrollinto text=...` before dispatch because current upstream can falsely report success without movement, while leaving help forms untouched; return only native recovery (`find text ... hover` or fresh snapshot/ref), leaving CSS, XPath, and current-ref behavior upstream-owned
215
226
  - after successful `get text` on a qualifying non-ref CSS selector, optionally issue one read-only `eval --stdin` probe per selector when multiple DOM matches or a hidden first match with visible peers could misread tabbed or off-screen content; simple id selectors and sensitive-looking literals skip this probe. Merge `details.selectorTextVisibility` / `selectorTextVisibilityAll`, visible warning lines, and `inspect-visible-text-candidates*` next actions as documented in [`TOOL_CONTRACT.md`](TOOL_CONTRACT.md#details) and `RQ-0074` in [`SUPPORT_MATRIX.md`](SUPPORT_MATRIX.md)
216
227
  - caller-owned sessions honor native `AGENT_BROWSER_SOCKET_DIR` unless `PI_AGENT_BROWSER_SOCKET_DIR` overrides it, with the same socket integrity checks. For other local Unix launches, set a short private socket directory so extension-generated session names do not fail on the upstream Unix socket-path length limit; require the selected path to be absolute, owned by the current uid, mode `0700`, under checked ancestry, and free of symlink, foreign-owner, or special planted entries; reject pre-existing unsafe modes instead of repairing them, then recheck before spawn. The actual filesystem root `/` is supplied by the trusted operating environment: a directory without group/other write bits is accepted regardless of its reported owner, which can be unmapped in a Linux user namespace. Existing root-owned sticky-directory acceptance is unchanged. This boundary does not protect against whoever controls the root filesystem. Every non-root ancestor still needs trusted ownership and permissions, including the destination ancestry of root-owned aliases; a matching overflow UID is not trusted. Android/Termux uses `/data/data/<package>/piab`, treats the owner-only app-data directory as the trust anchor, permits the app's matching private uid/gid ancestry, compacts generated managed identities to one 80-bit digest so ordinary namespace plus fresh-session paths remain within the limit, and places policy-lock coordination under `os.tmpdir()` because Android `/tmp` is shell-owned and inaccessible
@@ -32,6 +32,38 @@ Review fixes before committing; dangerous fixes and suggestion fixes are not par
32
32
  `lint:fix`. Run formatting after reviewed lint fixes and rerun acceptance. Failures
33
33
  are never converted to success by these commands.
34
34
 
35
+ The default, quality, pre-pr, platform-target, and release facades run scope and
36
+ suppression-policy validation once through `lint`, before the corrected checker.
37
+ Standalone `quality:policy` and `quality:scope` remain available for focused
38
+ inspection and intentional scope regeneration; running them separately in the
39
+ facade would repeat the same validation without adding coverage.
40
+
41
+ ### Test scheduling
42
+
43
+ `npm test` builds once and prepares the corrected checker once, then runs
44
+ `tsx --test "test/**/!(*.serial).test.ts"` with Node's default file concurrency, followed by
45
+ `tsx --test --test-concurrency=1 "test/**/*.serial.test.ts"`.
46
+ The default/quality verification gates use the same two stages. File isolation
47
+ keeps environment patches process-local; the shared browser harness supplies a
48
+ private short socket directory unless `PI_AGENT_BROWSER_SOCKET_DIR` is already set.
49
+ The harness also clears inherited Pi/delegation identity variables; root-default
50
+ tests set their identities explicitly after import. No in-file concurrency is enabled.
51
+
52
+ The serial lane contains `test/agent-browser.startup.serial.test.ts` and
53
+ `test/agent-browser.prompt-policy.serial.test.ts` for wall-clock budgets, plus
54
+ `test/agent-browser.managed-session-policy-lock.serial.test.ts` for fixtures in
55
+ the shared policy collector directory. Their timing and global-GC contracts must
56
+ not compete with the parallel lane. Build/pack fixtures must use disposable source trees rather
57
+ than rewriting this checkout's `dist/` while other files consume it.
58
+ `platform-target` retains its explicit serial subset; `quality:probes` remains a
59
+ focused serial checker suite. The allowance-isolation mutation must fail in the
60
+ parallel stage with its named `code-quality.test.ts` diagnostic.
61
+
62
+ The real prepare/pack fixture in `test/verify-package.test.ts` also runs a plain
63
+ Node child against emitted checkout modules. It verifies shared process-environment
64
+ session/namespace propagation and snapshot-spill cleanup through the imported temp
65
+ owner; source-loaded tests cannot detect bundles overwriting these shared modules.
66
+
35
67
  ## Language and role scope
36
68
 
37
69
  The root `.oxlintrc.json` enables type-aware rules and compiler diagnostics. The
@@ -153,9 +185,13 @@ Non-generic TS/JSDoc array aliases retain exact declared identity without introd
153
185
  wrapper types. Built-in browser `URL` and Node's `node:url` `URL` have distinct
154
186
  origins; the filesystem `PathLike` contract requires the Node-qualified allowance.
155
187
 
156
- `test/code-quality.test.ts` exercises actual language/compiler scope, consumer
157
- resolution, test-role boundaries, framework diagnostics, declaration isolation,
158
- mutable intersections, suppression policy, and formatting idempotence. Probes
188
+ The real-CLI probes are split by contract: `test/code-quality.test.ts` covers
189
+ framework diagnostics and qualified registration isolation;
190
+ `test/code-quality-scope.test.ts` covers language/compiler scope, consumer resolution,
191
+ test-role boundaries, suppression policy, and formatting idempotence;
192
+ `test/code-quality-subtests.test.ts` covers subtest promise ownership and nested
193
+ registration; `test/code-quality-readonly.test.ts` covers declaration isolation and
194
+ mutable additions/intersections. `npm run quality:probes` runs all four files. Probes
159
195
  check expected rule identities; setup/configuration/parser failures are not valid
160
196
  negative evidence. Keep minimal unsuppressed checker reproductions when upgrading
161
197
  the backend and retire the patch only after the same controls pass.
@@ -348,7 +348,7 @@ For desktop, contenteditable, or host-controlled rich inputs, treat a semantic `
348
348
 
349
349
  Do not assume Playwright selector dialects such as `text=Close` or `button:has-text('Close')` are supported wrapper syntax. In particular, current upstream can report successful `scrollintoview text=...` without moving the page, so the wrapper rejects that form before dispatch—directly or in an effective raw/stdin batch row—and shows executable `find text <label> hover` plus snapshot/ref recovery payloads in visible failure text and `details.nextActions`. `scrollintoview ... --help` and `-h` remain native help calls. Use `scrollintoview` with CSS, `xpath=...`, or a current `@e…` ref; use `find` for semantic text targets.
350
350
 
351
- Treat `@eN`, `eN`, and `ref=eN` selector refs as page-scoped. Ref-looking fill/type text, select values, paths, and keyboard/mouse data remain literal. After a successful `snapshot`, the wrapper records the latest refs and page target for that session; getter or mutation ref commands such as `get text @e4`, `click @e4`, `select @e5 chocolate`, or batch steps with old refs fail with `failureCategory: "stale-ref"` when the page target changed or the ref is absent from the latest same-page snapshot. If a session `snapshot -i` fails with `No active page`, the wrapper invalidates prior refs for that session; later mutation-prone `@e…` calls fail before upstream until a successful fresh `snapshot -i` records refs again. Inside `batch` stdin JSON, the wrapper also walks steps in order before spawn: steps whose first token can navigate or mutate set a latch; a later step whose first token is `snapshot` clears that latch for following rows; guarded steps that still mention `@e…` after an uncleared latch fail with the same `stale-ref` bucket without launching upstream. Same-snapshot form fills and native form-control steps are allowed before a click or submit step, so `fill`, `check`/`uncheck` checkbox or radio refs, checkbox/radio `click`/`tap` refs, `select` combobox refs, then a final submit `click` can run from one snapshot. Split dynamic or autosubmit forms with a fresh snapshot if a control interaction rerenders the targets. Follow the `refresh-interactive-refs` next action (it includes `--session <name>` when needed) and prefer stable `find` or `agent_browser_action` locators when navigation or rerendering is likely. Contract detail: [`TOOL_CONTRACT.md`](TOOL_CONTRACT.md#details) (`refSnapshot`, `refSnapshotInvalidation`).
351
+ Treat `@eN`, `eN`, and `ref=eN` selector refs as page-scoped. Ref-looking fill/type text, select values, paths, and keyboard/mouse data remain literal. After a successful `snapshot`, the wrapper records the latest refs and page target for that session; getter or mutation ref commands such as `get text @e4`, `click @e4`, `select @e5 chocolate`, or batch steps with old refs fail with `failureCategory: "stale-ref"` when the page target changed or the ref is absent from the latest same-page snapshot. If a session `snapshot -i` fails with `No active page`, the wrapper invalidates prior refs for that session; later mutation-prone `@e…` calls fail before upstream until a successful fresh `snapshot -i` records refs again. Inside effective raw-argument or stdin `batch` steps, the wrapper also walks the full plan in order before spawn: steps whose first token can navigate or mutate set a latch; a later step whose first token is `snapshot` clears that latch for following rows; guarded steps that still mention `@e…` after an uncleared latch fail with the same `stale-ref` bucket without launching upstream. This scan continues after a snapshot even when no refs appear before it: `snapshot -i`, a non-form `click @e1`, then `get value @e2` is rejected. Put another `snapshot -i` after the click or split the batch and inspect before continuing. Same-snapshot form fills and native form-control steps are allowed before a click or submit step, so `fill`, `check`/`uncheck` checkbox or radio refs, checkbox/radio `click`/`tap` refs, `select` combobox refs, then a final submit `click` can run from one snapshot. Split dynamic or autosubmit forms with a fresh snapshot if a control interaction rerenders the targets. Follow the `refresh-interactive-refs` next action (it includes `--session <name>` when needed) and prefer stable `find` or `agent_browser_action` locators when navigation or rerendering is likely. Contract detail: [`TOOL_CONTRACT.md`](TOOL_CONTRACT.md#details) (`refSnapshot`, `refSnapshotInvalidation`).
352
352
 
353
353
  A successful `click` result means upstream reported a target, not that the app definitely handled the event. For top-level non-Electron direct clicks on `xpath=` targets and eligible current `@e…` refs, the wrapper installs a bounded target-specific DOM-event probe when it can; when upstream reports success but no trusted event reaches the resolved target, it fails the tool and exposes `details.clickDispatch` plus a `Click dispatch diagnostic` line with explicit retry/inspect next actions (no in-page click replay). Raw `find … click` locator calls are not probed because the wrapper has no concrete element before upstream resolves the locator, and document-level probes can falsely fail frame-scoped clicks. Direct `@e…` click probes are role-gated to current snapshot refs whose accessible role is `button`, `checkbox`, `menuitem`, `radio`, `switch`, or `tab`, with a unique role/name in both the saved snapshot and the live candidates. For both ref and XPath candidates, the wrapper requires native `get attr <original-selector> <marker>` to read back a per-probe temporary DOM marker on that candidate. Missing or mismatched identity (including frame/XPath scope mismatches) cleans up the probe and lets the native click run without dispatch verification. Duplicate-name refs pass through without a probe because their old ordinal does not prove target identity. Probe listeners and the window marker self-expire after the call's process-timeout budget plus the existing two-second cleanup grace if a pending decision blocks normal cleanup; collection cancels the timer. This uses no extra browser command while pending. If the probe evidence shows the target is outside a nested scroll container or viewport, `details.clickDispatch.scrollContainer` and `scroll-target-into-view-after-dispatch-miss` point to `scrollintoview <target>` before retry. When the workflow depends on a mutation, use `details.pageChangeSummary`, a wait, URL/text extraction, or a fresh `snapshot -i` before trusting the state; if nothing changed, retry with a current visible ref or stable selector and report the workflow issue. For static local fixtures or debugging where the user explicitly accepts scripted activation, `eval --stdin` can call `document.querySelector(...).click()` to exercise inline handlers and app code; treat that as an untrusted programmatic event, not as evidence that CDP/user-like clicking works. Respect explicit user stop boundaries yourself: if the user says to stop before a final order, post, purchase, or submit action, gather evidence from that page and do not click the final action or use scripted activation to bypass the stop. The wrapper does not infer broad business intent from prompt text; `details.promptGuard` is reserved for concrete artifact-before-close checks. `press`, `key`, `keydown`, and `keyup` accept exactly one key token; focus or click the target first, then run `press Enter` or another single-key command.
354
354
 
@@ -410,7 +410,7 @@ Paced input uses explicit native rows, preserving the former job's behavior with
410
410
 
411
411
  For longer text, code can construct the rows and call native batch; keep the former 200-character pacing bound when porting a job. Add a final `press` only when submission is intended. Fixed waits are not postconditions. Timeout partial progress remains available through the same batch path. See [all job step equivalents](TOOL_CONTRACT.md#07-migration).
412
412
 
413
- For quick smoke/QA checks, enable `qa` and call `agent_browser_qa` with flat fields. It clears enabled network/console buffers and snapshots any page-error residue after the unreliable upstream clear, then opens the target URL and gives immediate post-load console/page-error callbacks a bounded 150 ms settle, waits for page readiness, checks expected text/selector, then inspects fresh network requests, console messages, and page errors only if preceding assertions pass, and can capture an evidence screenshot. Successful reset rows are labeled as reset-scoped diagnostic output. If final page-error rows match a nonempty post-clear baseline, QA is non-pass with “page-error check could not be verified”: identical new errors can replace old rows in the native FIFO buffer without changing the result. Those matches are not proof of new application errors. Definitely new rows, including errors after an empty baseline, count separately as page errors; a clean final buffer can pass. Explicit `checkErrors: false` omits this check for a more limited smoke test. The preset compiles to `batch --bail` so a missing text/selector assertion fails crisply instead of letting slower diagnostics burn the wrapper watchdog. Expected text compiles to bounded visible-text `wait --fn … --timeout 5000` predicates after load so dense pages can pass on visible headings/copy without dumping `body` text; missing text reports a crisp QA failure. The readiness wait defaults to `loadState: "domcontentloaded"`; set `loadState` to `"load"` or `"networkidle"` only when that stricter state is useful and the site is not expected to keep background requests alive. QA network diagnostics classify failed requests by likely impact and list failed rows first in the network preview: actionable document/script/API-style failures fail the preset, while common low-impact browser icon misses such as `favicon.ico` are surfaced as warnings (`qaPreset.warnings`) so they do not fail an otherwise healthy page. Successful QA with no failed checks returns compact model-visible prose (page URL/title when known, checks run, optional screenshot verification) while keeping the full step matrix in `details.qaPreset` and `details.batchSteps`. Failed QA presets report `details.resultCategory: "failure"`, `failureCategory: "qa-failure"`, show compact failure reasons with the full matrix in `details.batchSteps`, and real Pi sessions treat the diagnostic as a failed tool result. Prose output also gets a model-visible result-category line including `Pi tool isError: true`; caller-requested `--json` output keeps the JSON string parseable and relies on the patched `isError` plus `details` fields.
413
+ For quick smoke/QA checks, enable `qa` and call `agent_browser_qa` with flat fields. It clears enabled network/console buffers and snapshots any page-error residue after the unreliable upstream clear, then opens the target URL and gives immediate post-load console/page-error callbacks a bounded 150 ms settle, waits for page readiness, checks expected text/selector, then inspects fresh network requests, console messages, and page errors only if preceding assertions pass, and can capture an evidence screenshot. Successful reset rows are labeled as reset-scoped diagnostic output. If final page-error rows match a nonempty post-clear baseline, QA is non-pass with “page-error check could not be verified”: identical new errors can replace old rows in the native FIFO buffer without changing the result. Those matches are not proof of new application errors. Definitely new rows, including errors after an empty baseline, count separately as page errors; a clean final buffer can pass. Explicit `checkErrors: false` omits this check for a more limited smoke test. The preset compiles to `batch --bail` so a missing text/selector assertion fails crisply instead of letting slower diagnostics burn the wrapper watchdog. Expected text compiles to bounded visible-text `wait --fn … --timeout 5000` predicates after load so dense pages can pass on visible headings/copy without dumping `body` text; missing text reports a crisp QA failure. Text and control values under `display: none` or `opacity: 0` ancestors, or whose computed visibility is hidden, are excluded even when the control itself has a visible layout box; `display: contents` wrappers and `visibility: visible` overrides still count. The readiness wait defaults to `loadState: "domcontentloaded"`; set `loadState` to `"load"` or `"networkidle"` only when that stricter state is useful and the site is not expected to keep background requests alive. QA network diagnostics classify failed requests by likely impact and list failed rows first in the network preview: actionable document/script/API-style failures fail the preset, while common low-impact browser icon misses such as `favicon.ico` are surfaced as warnings (`qaPreset.warnings`) so they do not fail an otherwise healthy page. Successful QA with no failed checks returns compact model-visible prose (page URL/title when known, checks run, optional screenshot verification) while keeping the full step matrix in `details.qaPreset` and `details.batchSteps`. Failed QA presets report `details.resultCategory: "failure"`, `failureCategory: "qa-failure"`, show compact failure reasons with the full matrix in `details.batchSteps`, and real Pi sessions treat the diagnostic as a failed tool result. Prose output also gets a model-visible result-category line including `Pi tool isError: true`; caller-requested `--json` output keeps the JSON string parseable and relies on the patched `isError` plus `details` fields.
414
414
 
415
415
  For failed QA, inspect `details.qaPreset.failedChecks` separately from `notRunChecks`: a reported fail-fast error leaves later checks not run, rather than proving their assertions failed. Failure prose leads with the redacted cause and reports received execution coverage; missing timeout receipts mean an unknown executed count. Incomplete receipts without a reported failure are unverified, never proof of a pass or of unreached checks.
416
416
 
@@ -481,7 +481,7 @@ For local app debugging, enable `source`; `agent_browser_source` can gather cand
481
481
  { "selector": "#save", "reactFiberId": "2", "componentName": "SaveButton" }
482
482
  ```
483
483
 
484
- Enable `network` and call `agent_browser_network_source` for failed browser requests. `requestId` adds `network request <requestId>`; `filter` or `url` adds `network requests --filter …`, with explicit filter winning. Optional `namespace` and `session` select the native target; `namespace: ""` overrides an ambient namespace. HTTP status ≥ 400, `failed: true`, and error fields identify failed rows. Filter/URL limits correlation by substring. Workspace URL-literal search uses the captured execution directory and the source tool's bounds: 2,000 files by default, 5,000 maximum, eight needles and ten matches. Results retain `details.networkSourceLookup` with status, failed requests, candidate evidence, and limitations. They never assign definitive blame or replace the active page target and same-page refs.
484
+ Enable `network` and call `agent_browser_network_source` for failed browser requests. `requestId` adds `network request <requestId>`; `filter` or `url` adds `network requests --filter …`, with explicit filter winning. Optional `namespace` and `session` select the native target; `namespace: ""` overrides an ambient namespace. HTTP status ≥ 400, `failed: true`, and error fields identify failed rows. The same explicit-filter-wins query limits failed-request and initiator analysis by substring; unrelated failed-request initiators are ignored. Repeated request IDs count once, keeping the first matching failed row; anonymous rows and different IDs sharing one URL remain distinct. Workspace URL-literal search uses the captured execution directory and the source tool's bounds: 2,000 files by default, 5,000 maximum, eight needles and ten matches. Results retain `details.networkSourceLookup` with status, failed requests, candidate evidence, and limitations. They never assign definitive blame or replace the active page target and same-page refs.
485
485
 
486
486
  ```json
487
487
  { "requestId": "req-1", "url": "/api/fail" }
@@ -544,7 +544,7 @@ Wrapper result rendering is metadata-first for saved files. Image MIME types com
544
544
 
545
545
  `diff screenshot` follows the file-artifact path above for the **diff** image: model-visible text and `details.artifacts` focus on that output, while baseline paths stay out of the artifact summary block, and Pi does **not** auto-inline the diff the way it inlines trusted `screenshot` captures. `state load` may print the loaded path in prose but does not add a saved-file artifact entry the way `state save` does.
546
546
 
547
- For screenshot paths under dot-directories such as `.dogfood/run/foo.png`, the wrapper normalizes the requested path to an absolute path before invoking upstream `agent-browser`, verifies the requested file exists, and repairs from an upstream temp screenshot when possible. For direct artifact commands and batch artifact steps (`download`, `pdf`, `screenshot`, `state save`, and `wait --download`), the wrapper creates missing parent directories before launch. A parent-directory failure returns `validation-error` with the attempted directory and `verify-artifact-path` guidance before the browser command runs. Prefer **absolute paths in raw batch artifact rows** because the daemon's working directory may differ from Pi's. When `pi-change-working-dir` selects a different execution root, the wrapper binds relative file operands in direct, stdin, and raw batch rows to that invocation's root; upstream's raw-argument precedence over stdin is unchanged. Otherwise raw strings stay unchanged and screenshot path normalization applies only to direct calls and stdin rows. See [working-directory changes](../README.md#working-directory-changes). Known caller paths appear as `Requested path`; `Absolute path` is the resolved location checked on disk, and `Reported path` exposes a differing screenshot report (including a canonical `/private/tmp` alias) through the existing `tempPath` metadata. No extra canonicalization rewrites upstream arguments.
547
+ For screenshot paths under dot-directories such as `.dogfood/run/foo.png`, the wrapper normalizes the requested path to an absolute path before invoking upstream `agent-browser`, verifies the requested file exists, and repairs from an upstream temp screenshot when possible. For direct artifact commands and batch artifact steps (`download`, `pdf`, `screenshot`, `state save`, and `wait --download`), the wrapper creates missing parent directories before launch. A parent-directory failure returns `validation-error` with the attempted directory and `verify-artifact-path` guidance before the browser command runs. Prefer **absolute paths in raw batch artifact rows** because the daemon's working directory may differ from Pi's. When `pi-change-working-dir` selects a different execution root, the wrapper binds relative file operands in direct, stdin, and raw batch rows to that invocation's root; upstream's raw-argument precedence over stdin is unchanged. Otherwise raw strings stay unchanged and screenshot path normalization applies only to direct calls and stdin rows. See [working-directory changes](REFERENCE.md#working-directory-changes). Known caller paths appear as `Requested path`; `Absolute path` is the resolved location checked on disk, and `Reported path` exposes a differing screenshot report (including a canonical `/private/tmp` alias) through the existing `tempPath` metadata. No extra canonicalization rewrites upstream arguments.
548
548
 
549
549
  For annotated screenshots in `batch`, put `--annotate` in top-level args instead of inside the screenshot step:
550
550
 
@@ -567,7 +567,7 @@ Detailed receipt/live-browser fields and browser-independent native read/confirm
567
567
 
568
568
  #### Artifact retention and dogfood-heavy QA runs
569
569
 
570
- The wrapper's internal recent artifact view defaults to 100 metadata rows, configurable with `PI_AGENT_BROWSER_SESSION_ARTIFACT_MANIFEST_MAX_ENTRIES=<count>`. That cap bounds the current view, not append-only history. Journal events store row changes; `details.artifactManifest` contains changed or referenced receipts for this invocation rather than the unchanged history. Complete reference captures are likewise defined once, with small reuse/invalidation events. See [browser session storage and stopped-copy conversion](SESSION_STORAGE.md).
570
+ The wrapper's internal recent artifact view defaults to 100 metadata rows, configurable with `PI_AGENT_BROWSER_SESSION_ARTIFACT_MANIFEST_MAX_ENTRIES=<count>`. That cap bounds the current view, not append-only history. Journal events store row changes; `details.artifactManifest` contains changed or referenced receipts for this invocation rather than the unchanged history. Complete reference captures are likewise defined once, with small reuse/invalidation events. Historical browser journals resume automatically at the original path without rewriting history; the same ref and native-generation checks still apply. See [browser session storage](SESSION_STORAGE.md).
571
571
 
572
572
  This cap controls the internal recent view and summaries such as `Session artifacts: 42 live, 0 evicted (42/100 recent)`. It does not delete explicit files that upstream saved to paths you chose, such as screenshots, PDFs, downloads, traces, HAR files, or WebM recordings.
573
573
 
@@ -663,7 +663,7 @@ The command groups below intentionally list more than the recommended workflow.
663
663
 
664
664
  ### Built-in skills
665
665
 
666
- Native-tool note: upstream skills are written for the standalone `agent-browser` CLI and may show bash/heredoc examples. In pi, convert those examples to `agent_browser` calls: pass CLI tokens in `args`, and pass heredoc/stdin bodies through the tool `stdin` field for `batch`, `eval --stdin`, or `auth save --password-stdin`.
666
+ Native-tool note: upstream skills are written for the standalone `agent-browser` CLI and may show bash/heredoc examples. In pi, convert those examples to `agent_browser` calls: pass CLI tokens in `args`, and pass heredoc/stdin bodies through the tool `stdin` field for `batch`, `eval --stdin`, or `auth save --password-stdin`. The wrapper's copyable skill calls preserve quoted empty and whitespace-only operands: `fill '#name' ""` becomes `args: ["fill", "#name", ""]`, not a missing value.
667
667
 
668
668
  Session note: `skills list`, `skills get …`, and `skills path …` are **stateless** in this wrapper. Even with default `sessionMode: "auto"`, the extension does not prepend the implicit managed `--session` for those commands, so reading bundled skills does not attach to or rotate the active browser session (same intent as plain-text `--help` / `--version` inspection). Other `skills` subcommands follow normal session rules until explicitly allowlisted in `extensions/agent-browser/lib/runtime.ts` alongside regression coverage in `test/agent-browser.runtime.test.ts`.
669
669
 
@@ -718,7 +718,7 @@ Skill-source debugging note: upstream honors `AGENT_BROWSER_SKILLS_DIR` as an ov
718
718
  - `tap <selector>` — Touch-oriented tap alias for iOS/provider workflows.
719
719
  - `swipe <direction> [distance]` — Touch-oriented swipe for iOS/provider workflows.
720
720
 
721
- On dashboards and other apps with nested scroll containers, `scroll <dir> [px]` can miss because a page-level wheel does not move the document or the intended pane. Without startup-scoped launch flags, the wrapper first applies ordinary `scroll <up|down|left|right> [px|percent]` directly to `document.scrollingElement` with smooth scrolling temporarily disabled; successful movement reports `details.scrollPage`. If the document cannot move, it falls back to upstream wheel behavior. For large fallback calls on an existing or fresh managed session, the wrapper samples viewport and prominent scroll-container positions before and after the command; when nothing changes it reclassifies the nominal upstream success as `failureCategory: "upstream-error"`, prepends `Scroll completed with no observed movement`, appends `Scroll diagnostic: no observed scroll movement`, exposes `details.scrollNoop`, marks `details.data.scrolled: false`, and adds exact `details.nextActions` for a fresh `snapshot -i` and screenshot. Explicit CSS-container calls `scroll <selector> <up|down|left|right> [px|percent]` remain wrapper-handled, use `Element.scrollBy` with `behavior: "instant"` so smooth-scroll CSS cannot delay the measured movement, and report `details.scrollContainer`; `scroll to end` / `scroll to top` report `details.scrollPage`. Calls with startup-scoped flags skip all helper shims so the requested launch configuration runs first. Use these paths before repeating page scrolls; when you need a specific element, prefer `scrollintoview <@ref>` or target the actual scrollable region. Do not pass `text=...` to `scrollintoview`: the wrapper rejects that upstream false-success path and returns `scroll-semantic-text-target` (`find text ... hover`) plus `refresh-refs-for-scroll-target` (`snapshot -i`) actions.
721
+ On dashboards and other apps with nested scroll containers, `scroll <dir> [px]` can miss because a page-level wheel does not move the document or the intended pane. Without startup-scoped launch flags, the wrapper first applies ordinary `scroll <up|down|left|right> [px|percent]` directly to `document.scrollingElement` with smooth scrolling temporarily disabled; successful movement reports `details.scrollPage`. If the document cannot move, it falls back to upstream wheel behavior. For large fallback calls on an existing or fresh managed session, the wrapper samples viewport and prominent scroll-container positions before and after the command; when nothing changes it reclassifies the nominal upstream success as `failureCategory: "upstream-error"`, prepends `Scroll completed with no observed movement`, appends `Scroll diagnostic: no observed scroll movement`, exposes `details.scrollNoop`, marks `details.data.scrolled: false`, and adds exact `details.nextActions` for a fresh `snapshot -i` and screenshot. Explicit CSS-container calls `scroll <selector> <up|down|left|right> [px|percent]` remain wrapper-handled, use `Element.scrollBy` with `behavior: "instant"` so smooth-scroll CSS cannot delay the measured movement, and report `details.scrollContainer`; `scroll to end` / `scroll to top` report `details.scrollPage`. These shims intercept only complete recognized shapes: `scroll to end|top` has no extra operands, and CSS-container scroll accepts only the selector, direction, and optional amount. Surplus operands such as `scroll to end --selector #panel` or `scroll #panel down 500 extra` pass through to native agent-browser unchanged rather than being silently dropped. Calls with startup-scoped flags skip all helper shims so the requested launch configuration runs first. Use these paths before repeating page scrolls; when you need a specific element, prefer `scrollintoview <@ref>` or target the actual scrollable region. Do not pass `text=...` to `scrollintoview`: the wrapper rejects that upstream false-success path and returns `scroll-semantic-text-target` (`find text ... hover`) plus `refresh-refs-for-scroll-target` (`snapshot -i`) actions.
722
722
 
723
723
  Comboboxes vary by app. For native `<select>` controls, prefer raw `select <selector> <value...>`, flat `agent_browser_action` select fields or active-session semantic role/name/label select instead of clicking option refs; native option refs can be non-boxed in CDP and fail before a real selection. A `click` or `agent_browser_action` role/name click may focus a searchable custom combobox without opening its option list. For explicit combobox-targeted actions such as `agent_browser_action` role `combobox`, the wrapper checks whether a combobox-like element is focused, has explicit `aria-expanded` state, and has no visible listbox/options open; this still applies when the semantic action first resolves to a current visible `@ref` before execution. When that happens it appends `Combobox diagnostic: focused combobox did not expose visible options`, exposes `details.comboboxFocus`, and adds exact `details.nextActions` for a fresh `snapshot -i`, `press ArrowDown`, and `press Enter`. Use those instead of assuming click alone expanded the control. To search the focused input, use `keyboard type <text>`; raw `type` requires both a selector and text. Reserve visible option refs for custom comboboxes after a fresh snapshot shows the intended option.
724
724
 
@@ -951,21 +951,21 @@ JSON
951
951
  `pi install` does not add package helper binaries to your shell `PATH`. Use direct JSON config edits, or run the helper only through `npm exec`:
952
952
 
953
953
  ```bash
954
- npm exec --yes --package pi-agent-browser-native@latest -- pi-agent-browser-config paths
955
- npm exec --yes --package pi-agent-browser-native@latest -- pi-agent-browser-config show
956
- npm exec --yes --package pi-agent-browser-native@latest -- pi-agent-browser-config web-search set-env EXA_API_KEY --global
957
- npm exec --yes --package pi-agent-browser-native@latest -- pi-agent-browser-config web-search set-env BRAVE_API_KEY --global
958
- npm exec --yes --package pi-agent-browser-native@latest -- pi-agent-browser-config web-search set-env EXA_API_KEY --project
959
- npm exec --yes --package pi-agent-browser-native@latest -- pi-agent-browser-config web-search prefer brave --global
960
- npm exec --yes --package pi-agent-browser-native@latest -- pi-agent-browser-config web-search disable --global
961
- npm exec --yes --package pi-agent-browser-native@latest -- pi-agent-browser-config web-search disable --project
962
- npm exec --yes --package pi-agent-browser-native@latest -- pi-agent-browser-config web-search set-command "op read 'op://Private/Brave Search/API Key'" --provider brave --global
963
- printf '%s' "$EXA_API_KEY" | npm exec --yes --package pi-agent-browser-native@latest -- pi-agent-browser-config web-search set-key --provider exa --stdin
964
- npm exec --yes --package pi-agent-browser-native@latest -- pi-agent-browser-config browser profile set "Profile 1" --policy authenticated-only
965
- npm exec --yes --package pi-agent-browser-native@latest -- pi-agent-browser-config browser executable set "/Applications/Brave Browser.app/Contents/MacOS/Brave Browser"
954
+ npm exec --yes --package pi-agent-browser-native -- pi-agent-browser-config paths
955
+ npm exec --yes --package pi-agent-browser-native -- pi-agent-browser-config show
956
+ npm exec --yes --package pi-agent-browser-native -- pi-agent-browser-config web-search set-env EXA_API_KEY --global
957
+ npm exec --yes --package pi-agent-browser-native -- pi-agent-browser-config web-search set-env BRAVE_API_KEY --global
958
+ npm exec --yes --package pi-agent-browser-native -- pi-agent-browser-config web-search set-env EXA_API_KEY --project
959
+ npm exec --yes --package pi-agent-browser-native -- pi-agent-browser-config web-search prefer brave --global
960
+ npm exec --yes --package pi-agent-browser-native -- pi-agent-browser-config web-search disable --global
961
+ npm exec --yes --package pi-agent-browser-native -- pi-agent-browser-config web-search disable --project
962
+ npm exec --yes --package pi-agent-browser-native -- pi-agent-browser-config web-search set-command "op read 'op://Private/Brave Search/API Key'" --provider brave --global
963
+ printf '%s' "$EXA_API_KEY" | npm exec --yes --package pi-agent-browser-native -- pi-agent-browser-config web-search set-key --provider exa --stdin
964
+ npm exec --yes --package pi-agent-browser-native -- pi-agent-browser-config browser profile set "Profile 1" --policy authenticated-only
965
+ npm exec --yes --package pi-agent-browser-native -- pi-agent-browser-config browser executable set "/Applications/Brave Browser.app/Contents/MacOS/Brave Browser"
966
966
  ```
967
967
 
968
- The optional `agent_browser_web_search` tool is available when Exa or Brave credentials are visible from startup config or trusted session config and the runtime config has not set `webSearch.enabled` to `false`. It is a separate custom tool, not an `agent_browser` input mode, and does not launch a browser. Prefer it for current/live external web facts and URL discovery; use `agent_browser` for browser interaction, screenshots, authenticated/profile pages, and DOM inspection after you have a target URL. Prefer it over driving public search-engine forms such as Google with browser typing flows, which can redirect headless automation to anti-bot or CAPTCHA pages; do not attempt CAPTCHA bypass. Disable scope is explicit: `web-search disable --global` sets the normal user default, `web-search disable --project` disables it for one repo, and a `PI_AGENT_BROWSER_CONFIG` override containing `{ "version": 1, "webSearch": { "enabled": false } }` wins over both for a hard per-run disable. Loaded config may use plaintext, custom env aliases, interpolation literals, malformed-or-late-bound `$` values, and command-backed web-search keys; the resolved secret reaches the provider request while model-facing tool output and status text stay redacted. `web-search set-key`, `set-command`, and `clear` require `--provider`; `set-env` infers Exa/Brave from `EXA_API_KEY` or `BRAVE_API_KEY` unless you pass `--provider`.
968
+ The optional `agent_browser_web_search` tool is available when Exa or Brave credentials are visible from startup config or trusted session config and the runtime config has not set `webSearch.enabled` to `false`. It is a separate custom tool, not an `agent_browser` input mode, and does not launch a browser. Prefer it for current/live external web facts and URL discovery; use `agent_browser` for browser interaction, screenshots, authenticated/profile pages, and DOM inspection after you have a target URL. Prefer it over driving public search-engine forms such as Google with browser typing flows, which can redirect headless automation to anti-bot or CAPTCHA pages; do not attempt CAPTCHA bypass. Disable scope is explicit: `web-search disable --global` sets the normal user default, `web-search disable --project` disables it for one repo, and a `PI_AGENT_BROWSER_CONFIG` override containing `{ "version": 1, "webSearch": { "enabled": false } }` wins over both for a hard per-run disable. Loaded config may use plaintext, custom env aliases, interpolation literals, malformed-or-late-bound `$` values, and command-backed web-search keys; the resolved secret reaches the provider request while model-facing tool output and status text stay redacted. Malformed config files report their scope/path and `Invalid JSON`, plus the parser's numeric position/line/column when available; malformed provider JSON reports a provider-specific invalid-JSON error. Neither includes parser previews or parser causes that could echo partial credentials, and provider HTTP failures report only the status with a fixed hint. `web-search set-key`, `set-command`, and `clear` require `--provider`; `set-env` infers Exa/Brave from `EXA_API_KEY` or `BRAVE_API_KEY` unless you pass `--provider`.
969
969
 
970
970
  For Exa, effective search type precedence is per-call `searchType` → `webSearch.defaultSearchType` → `auto`, with regular `contents.highlights: true`. Typical latencies are `instant` ~250 ms, `fast` ~450 ms, `auto` ~1 second, `deep-lite` ~4 seconds, `deep` 4–15 seconds, and `deep-reasoning` 12–40 seconds. Prefer `deep-lite` for research before implementation, `deep` for hard multi-source work, and `deep-reasoning` only for exhaustive or still-thin research. Searches are serialized; do not launch several in parallel.
971
971
 
@@ -1003,7 +1003,7 @@ Example config:
1003
1003
  }
1004
1004
  ```
1005
1005
 
1006
- Browser defaults are scoped: global/override `defaultProfile` with `policy: "always"` and a Chrome profile name (not a path), plus `executablePath`, become native subprocess defaults only for automatic root browsers and their helpers when the effective engine is Chrome. Lightpanda omits these wrapper defaults, without changing caller-selected launch settings. Roots have distinct named sessions and restore keys; parents and descendants share one root through `PI_SUBAGENT_ROOT_SESSION_ID`. These defaults never apply to unrelated explicit sessions or Electron launches. Code selecting the ordinary root browser uses the same defaults. Profile paths, other policies, and project-only guidance remain advisory. Native restore keeps cookies/localStorage/sessionStorage, not new IndexedDB, service workers, or memory-only grants; verify app access after a real restart. Avoid global native profile changes or a shared writable profile path; see [shared browser defaults](../README.md#shared-browser-defaults). Configure profile/executable guidance globally, in trusted project config, or through `PI_AGENT_BROWSER_CONFIG`. Ask the agent to run `profiles` and `doctor` when profile resolution fails, then use the reported Chrome profile directory name, a full profile/user-data directory path if upstream accepts one, or the configured `browser.executablePath` with top-level `sessionMode: "fresh"`.
1006
+ Browser defaults are scoped: global/override `defaultProfile` with `policy: "always"` and a Chrome profile name (not a path), plus `executablePath`, become native subprocess defaults only for automatic root browsers and their helpers when the effective engine is Chrome. Lightpanda omits these wrapper defaults, without changing caller-selected launch settings. Roots have distinct named sessions and restore keys; parents and descendants share one root through `PI_SUBAGENT_ROOT_SESSION_ID`. These defaults never apply to unrelated explicit sessions or Electron launches. Code selecting the ordinary root browser uses the same defaults. Profile paths, other policies, and project-only guidance remain advisory. Native restore keeps cookies/localStorage/sessionStorage, not new IndexedDB, service workers, or memory-only grants; verify app access after a real restart. Avoid global native profile changes or a shared writable profile path; see [shared browser defaults](REFERENCE.md#shared-browser-defaults). Configure profile/executable guidance globally, in trusted project config, or through `PI_AGENT_BROWSER_CONFIG`. Ask the agent to run `profiles` and `doctor` when profile resolution fails, then use the reported Chrome profile directory name, a full profile/user-data directory path if upstream accepts one, or the configured `browser.executablePath` with top-level `sessionMode: "fresh"`.
1007
1007
 
1008
1008
  ## Important global flags, config, and environment
1009
1009
 
@@ -1129,7 +1129,7 @@ Other useful environment variables include `AGENT_BROWSER_DEFAULT_TIMEOUT`, `AGE
1129
1129
 
1130
1130
  <!-- agent-browser-playbook:end wrapper-tab-recovery -->
1131
1131
 
1132
- - Wrapper-spawned commands clamp `AGENT_BROWSER_DEFAULT_TIMEOUT` to the upstream documented 25-second default and use a 35-second child-process watchdog (`PI_AGENT_BROWSER_PROCESS_TIMEOUT_MS` overrides the default 35s budget; top-level `timeoutMs` overrides it per browser CLI call). Explicit `wait <ms>`, `wait --timeout <ms>`, and WebMCP `invoke` / `result --timeout <ms>` calls can exceed that default; when top-level `timeoutMs` is omitted, the wrapper derives a subprocess watchdog from the requested command duration plus a small grace window. Batch budgeting and timeout recovery read the same effective source as upstream: raw command strings when present, otherwise stdin rows. Dialog commands are additionally bounded to 5 seconds (`PI_AGENT_BROWSER_DIALOG_PROCESS_TIMEOUT_MS`), and click/tap/find refs or tokens plus `eval --stdin` snippets that look like alert/confirm/prompt/dialog triggers are bounded to 8 seconds (`PI_AGENT_BROWSER_DIALOG_TRIGGER_PROCESS_TIMEOUT_MS`). A `session info` timeout returns only an exact-session `retry-session-info` status action, without page probes, liveness claims, or changes to existing page/ref state. When a browser-operation watchdog fires, `details.timeoutPartialProgress` may include a planned step list with `status: "unknown"` (including `generatedFrom` labels for generated QA rows). Current URLs and existing files do not establish which steps ran, failed, or remained pending. Multi-step timeouts offer `inspect-current-page-after-timeout` when the target is already verified, rather than guessing a retry position. A single read-only or idempotent step may offer a `retry-timeout-step` candidate with a one-row native batch (`args: ["batch"]` plus `stdin`); inspect the current state before retrying because its outcome is still unknown. If the target is unknown, standalone snapshots are removed and visible failure text plus `details.nextActions` show `verify-page-target-after-timeout`, including its session-scoped `batch --bail` args and short stdin for fail-fast `get url` then `snapshot -i`; dialog status/accept/dismiss actions remain allowed for blocking-dialog recovery. It also includes current page URL from best-effort session `get url`, followed by `get title` only after a URL is recovered (or a planned URL inferred from the step list when the session cannot answer), and declared artifact paths such as `screenshot`, `pdf`, `download`, or `wait --download` outputs with existence/state checks; the same evidence is appended under `Timeout partial progress` in visible text with URL/path redaction.
1132
+ - Wrapper-spawned commands clamp `AGENT_BROWSER_DEFAULT_TIMEOUT` to the upstream documented 25-second default and use a 35-second child-process watchdog (`PI_AGENT_BROWSER_PROCESS_TIMEOUT_MS` overrides the default 35s budget; top-level `timeoutMs` overrides it per browser CLI call). Explicit `wait <ms>`, `wait --timeout <ms>`, and WebMCP `invoke` / `result --timeout <ms>` calls can exceed that default; when top-level `timeoutMs` is omitted, the wrapper derives a subprocess watchdog from the requested command duration plus a small grace window. Batch budgeting and timeout recovery read the same effective source as upstream: raw command strings when present, otherwise stdin rows. Dialog commands are additionally bounded to 5 seconds (`PI_AGENT_BROWSER_DIALOG_PROCESS_TIMEOUT_MS`), and click/tap/find refs or tokens plus `eval --stdin` snippets that look like alert/confirm/prompt/dialog triggers are bounded to 8 seconds (`PI_AGENT_BROWSER_DIALOG_TRIGGER_PROCESS_TIMEOUT_MS`). A `session info` timeout returns only an exact-session `retry-session-info` status action, without page probes, liveness claims, or changes to existing page/ref state. When a browser-operation watchdog fires, `details.timeoutPartialProgress` may include a planned step list with `status: "unknown"` (including `generatedFrom` labels for generated QA rows). Current URLs and existing files do not establish which steps ran, failed, or remained pending. Multi-step timeouts offer `inspect-current-page-after-timeout` when the target is already verified, rather than guessing a retry position. A single read-only or idempotent step may offer a `retry-timeout-step` candidate with a one-row native batch (`args: ["batch"]` plus `stdin`); inspect the current state before retrying because its outcome is still unknown. If the target is unknown, standalone snapshots are removed and visible failure text plus `details.nextActions` show `verify-page-target-after-timeout`, including its session-scoped `batch --bail` args and short stdin for fail-fast `get url` then `snapshot -i`; dialog status/accept/dismiss actions remain allowed for blocking-dialog recovery. It also includes current page URL from best-effort session `get url`, followed by `get title` only after a URL is recovered (or a planned URL inferred from the step list when the session cannot answer), and declared artifact paths such as `screenshot`, `pdf`, `download`, or `wait --download` outputs with existence/state checks. Independent artifact retry windows overlap (up to three checks per path, 25 ms apart), preserve plan order, and settle before page inspection; files finishing after their own window may remain missing. The same evidence is appended under `Timeout partial progress` in visible text with URL/path redaction.
1133
1133
  - Oversized snapshots and oversized generic outputs may be compacted in tool content, with the full redacted output written to a spill file path shown directly in the tool result. Recent artifact metadata is bounded by `PI_AGENT_BROWSER_SESSION_ARTIFACT_MANIFEST_MAX_ENTRIES` (default 100); persisted spill files have a separate `PI_AGENT_BROWSER_SESSION_ARTIFACT_MAX_BYTES` budget (default 32 MiB; `0` disables automatic eviction).
1134
1134
  - The wrapper keeps `--help` and `--version` stateless so they do not consume the implicit managed-session slot.
1135
1135
 
package/docs/ELECTRON.md CHANGED
@@ -131,7 +131,19 @@ Returns app metadata under `details.electron.apps`: `name`, optional `bundleId`/
131
131
 
132
132
  ### `electron.launch` — launch and attach
133
133
 
134
- Pass **exactly one** target: `appPath`, `appName`, `bundleId`, or `executablePath`. The wrapper resolves the target, verifies Electron framework evidence, applies optional caller-owned `allow` / `deny` policy, creates an isolated temp `userDataDir`, launches with `--remote-debugging-port=0` plus safe defaults, reads `DevToolsActivePort`, then attaches through upstream `connect` as a fresh managed session.
134
+ Pass **exactly one** target: `appPath`, `appName`, `bundleId`, or `executablePath`. The wrapper resolves the target, verifies Electron runtime and app payload evidence, applies optional caller-owned `allow` / `deny` policy, creates an isolated temp `userDataDir`, launches with `--remote-debugging-port=0` plus safe defaults, reads `DevToolsActivePort`, then attaches through upstream `connect` as a fresh managed session.
135
+
136
+ Payload evidence accepts `app.asar`, an `app/` directory, or the stock npm Electron runtime's `default_app.asar`. macOS also requires `Contents/Frameworks/Electron Framework.framework`; Linux/Windows require the existing Chromium resource evidence. These checks apply to discovery and explicit paths alike, and remain a correctness gate rather than a security boundary.
137
+
138
+ For an unpackaged development app, point `executablePath` at the stock Electron binary and put the app directory in `appArgs`:
139
+
140
+ ```json
141
+ {
142
+ "action": "launch",
143
+ "executablePath": "/path/to/node_modules/electron/dist/Electron.app/Contents/MacOS/Electron",
144
+ "appArgs": ["/path/to/fixture-app"]
145
+ }
146
+ ```
135
147
 
136
148
  ```json
137
149
  {
@@ -154,6 +166,8 @@ Handoff selection (`handoff` field):
154
166
 
155
167
  `targetType` defaults to `"page"`; use `"webview"` or `"any"` for apps whose useful UI is exposed as a webview target.
156
168
 
169
+ CDP readiness requires `/json/version` to contain a nonempty, non-whitespace `Browser` or `browser` string. An arbitrary JSON object is not readiness evidence; other version metadata is optional. The same rule determines debug-port liveness in status and cleanup.
170
+
157
171
  Optional `timeoutMs` on `electron.launch` sets the host readiness polling budget for `DevToolsActivePort` and CDP metadata. The clock starts after target discovery and policy checks; upstream attach and handoff have separate subprocess budgets. When omitted, the default is **15 seconds** with a hard maximum of **120 seconds**, matching `ELECTRON_LAUNCH_DEFAULT_TIMEOUT_MS` and `ELECTRON_LAUNCH_MAX_TIMEOUT_MS` in `extensions/agent-browser/lib/electron/launch.ts`. Pi cancellation is separate: an already-cancelled call never launches the app, while cancellation during readiness polling or URL/tab/snapshot handoff closes the managed session, stops the tracked process, removes its isolated profile, and returns `failureCategory: "aborted"` without waiting for the launch timeout.
158
172
 
159
173
  Wrapper-owned launches **always** use an isolated temp profile and an OS-chosen port. If wrapper validation, managed-session policy, or the post-attach live-URL handoff guard fails after the host app starts, the wrapper immediately stops that process and removes the isolated profile; it retains a partial tracked record only when cleanup itself cannot finish. `--user-data-dir`, `--remote-debugging-port`, `--remote-debugging-address`, `--remote-debugging-pipe`, and bare `--` in `appArgs` are rejected. There is no caller-supplied port and no way to make `electron.launch` reuse the app's normal signed-in profile or attach to an already-running app — by design. Use the manual path described above when those are the actual requirements.
@@ -170,6 +184,8 @@ Read-only inspection of one or more tracked launches. Without `launchId` or `all
170
184
 
171
185
  Reports `cleanupState`, current debug-port and PID liveness, bounded CDP targets, and freshly measured `userDataDirState` under `details.electron.statuses`. An explicit `launchId` can inspect a **historical cleaned launch record**; default and `all: true` selection exclude cleaned records. Cleanup history does not determine current liveness. The tracked profile path is `present`, `absent` (only native `lstat` ENOENT), or `unknown` (other filesystem errors); a dangling symlink is present. This measures that path only, not all app residue, and is not stored in the launch record. Its managed-session title/URL reads hold the normal daemon-policy lock and owned restore context. Mismatch fields surface when the current managed session or tab no longer matches a live wrapper launch target — typically the cue to follow `reattach-electron-launch` before trusting old refs.
172
186
 
187
+ Status and probe compare complete URLs before shortening them for display. Managed-session/probe URL summaries remain capped at 300 characters (probe tab URLs at 240); probe page-target/ref state retains the full URL.
188
+
173
189
  ### `electron.probe` — compact state read
174
190
 
175
191
  `probe` collapses what would otherwise be separate `get url` / `get title` / focused-element `eval` / `tab list` / `snapshot -i` calls into one bounded result. Use it instead of chaining those reads when you just need a quick "where are we?" check. The wrapper holds the managed-session daemon-policy lock for the probe and runs every underlying read with the session's owned restore decision, so probing cannot restart the daemon under a different restore key.
@@ -185,7 +201,7 @@ Output appears under `details.electron.probe`: `title`, `url`, `focusedElement`,
185
201
 
186
202
  ### `electron.cleanup` — wrapper-owned only
187
203
 
188
- Closes the tracked managed session, stops only the wrapper-tracked process, verifies that the debug port no longer serves `/json/version`, and removes the wrapper-created `userDataDir`. Cleanup waits for actual exit when it has a tracked child handle. For a live restored PID without that handle, it first checks the native process command line for the recorded profile: `Win32_Process.CommandLine` through Windows PowerShell on Windows, or `ps` on POSIX. If inspection fails or the profile does not match, cleanup leaves the process and profile intact.
204
+ Closes the tracked managed session, stops only the wrapper-tracked process, verifies that the debug port no longer serves `/json/version`, and removes the wrapper-created `userDataDir`. Cleanup waits for actual exit when it has a tracked child handle. For a live restored PID without that handle, it signals only when the process start identity recorded at launch matches the live process, which proves the PID was not reused. Records without an identity (for example from older versions), unreadable identities, and mismatches leave the process and profile intact; stop such a process manually.
189
205
 
190
206
  Cleanup partial failures fail the tool result with `failureCategory: "cleanup-failed"` and the `retry-electron-cleanup` next action references the same `launchId` so retries are bounded.
191
207
 
@@ -331,6 +347,11 @@ Single-instance Electron behavior is a common cause of `timeout` and `upstream-e
331
347
  - On macOS, apps installed outside `/Applications` and `~/Applications` are not scanned in v1. Pass `appPath` or `executablePath` explicitly.
332
348
  - Windows hosts report `platform: "unsupported"` from `electron.list`; always pass `executablePath` (or a resolvable `appPath`) for `launch`.
333
349
 
350
+ ### Launch rejects the target as non-Electron
351
+
352
+ - Verify both runtime resources and an app payload (`app.asar`, `app/`, or `default_app.asar`) exist beside the executable. On macOS, the Electron Framework is also required; Chromium paks alone do not establish an Electron target.
353
+ - The stock npm Electron runtime is supported without repackaging. Pass its binary as `executablePath` and your unpackaged app directory as an `appArgs` operand.
354
+
334
355
  ### Attach succeeds but `snapshot -i` returns no refs
335
356
 
336
357
  - Some Electron apps take a beat to render. The default `handoff: "snapshot"` already retries briefly; if it still reports no refs, run `tab list`, select the intended stable `t<N>` app tab, then run `snapshot -i` again.
@@ -356,6 +377,7 @@ Single-instance Electron behavior is a common cause of `timeout` and `upstream-e
356
377
 
357
378
  ### Mismatch between `status` and the active session
358
379
 
380
+ - A shortened URL ending in `...` is display-only; long URLs alone do not cause mismatch or reattach guidance. Status/probe compare full normalized URLs.
359
381
  - `electron.status` may report a live wrapper launch while the managed session has drifted to `about:blank`. Follow `reattach-electron-launch`, then refresh refs before reusing old `@e…` handles. For non-wrapper tab drift where `details.nextActions` names `select-intended-tab-after-drift`, use that stable `t<N>` action plus `snapshot-after-tab-recovery` before continuing.
360
382
 
361
383
  ## Code and shared-session coordination