pi-agent-browser-native 0.9.5 → 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 (380) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +3 -0
  3. package/dist/extensions/agent-browser/index.js +1214 -583
  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 +11 -1
  11. package/docs/CODE_QUALITY.md +11 -0
  12. package/docs/COMMAND_REFERENCE.md +2 -2
  13. package/docs/PERFORMANCE.md +243 -0
  14. package/docs/REFERENCE.md +3 -3
  15. package/docs/SESSION_STORAGE.md +11 -3
  16. package/docs/SUPPORT_MATRIX.md +8 -4
  17. package/docs/TOOL_CONTRACT.md +4 -4
  18. package/docs/performance/2026-10-12.json +7257 -0
  19. package/package.json +13 -2
  20. package/scripts/build.mjs +16 -5
  21. package/scripts/config.mjs +1 -1
  22. package/scripts/convert-browser-session.mjs +1 -1
  23. package/dist/extensions/agent-browser/lib/argv-descriptor.js +0 -123
  24. package/dist/extensions/agent-browser/lib/argv-grammar.js +0 -320
  25. package/dist/extensions/agent-browser/lib/bash-guard.js +0 -193
  26. package/dist/extensions/agent-browser/lib/batch-lifecycle.js +0 -131
  27. package/dist/extensions/agent-browser/lib/browser-execution-claim-codec.js +0 -61
  28. package/dist/extensions/agent-browser/lib/browser-execution-claim-storage.js +0 -232
  29. package/dist/extensions/agent-browser/lib/browser-execution-claims.js +0 -202
  30. package/dist/extensions/agent-browser/lib/browser-execution-identity.js +0 -77
  31. package/dist/extensions/agent-browser/lib/browser-journal-branch.js +0 -98
  32. package/dist/extensions/agent-browser/lib/browser-journal-contracts.js +0 -1
  33. package/dist/extensions/agent-browser/lib/browser-journal-projection.js +0 -221
  34. package/dist/extensions/agent-browser/lib/browser-journal-reader.js +0 -89
  35. package/dist/extensions/agent-browser/lib/browser-journal-replay.js +0 -246
  36. package/dist/extensions/agent-browser/lib/browser-journal.js +0 -148
  37. package/dist/extensions/agent-browser/lib/browser-legacy-pages.js +0 -220
  38. package/dist/extensions/agent-browser/lib/browser-legacy-projection.js +0 -282
  39. package/dist/extensions/agent-browser/lib/browser-legacy-types.js +0 -1
  40. package/dist/extensions/agent-browser/lib/browser-session-conversion-stream.js +0 -217
  41. package/dist/extensions/agent-browser/lib/browser-session-conversion.js +0 -126
  42. package/dist/extensions/agent-browser/lib/browser-transcript-contracts.js +0 -35
  43. package/dist/extensions/agent-browser/lib/browser-transcript-validation.js +0 -166
  44. package/dist/extensions/agent-browser/lib/browser-transcript.js +0 -189
  45. package/dist/extensions/agent-browser/lib/browser-value-parsing.js +0 -15
  46. package/dist/extensions/agent-browser/lib/command-capabilities.js +0 -340
  47. package/dist/extensions/agent-browser/lib/command-policy.js +0 -155
  48. package/dist/extensions/agent-browser/lib/command-taxonomy.js +0 -105
  49. package/dist/extensions/agent-browser/lib/config-policy.js +0 -450
  50. package/dist/extensions/agent-browser/lib/config-providers.js +0 -71
  51. package/dist/extensions/agent-browser/lib/config-validation.js +0 -231
  52. package/dist/extensions/agent-browser/lib/config.js +0 -69
  53. package/dist/extensions/agent-browser/lib/electron/cdp.js +0 -62
  54. package/dist/extensions/agent-browser/lib/electron/cleanup.js +0 -274
  55. package/dist/extensions/agent-browser/lib/electron/discovery-darwin.js +0 -109
  56. package/dist/extensions/agent-browser/lib/electron/discovery-desktop.js +0 -136
  57. package/dist/extensions/agent-browser/lib/electron/discovery-evidence.js +0 -90
  58. package/dist/extensions/agent-browser/lib/electron/discovery-linux.js +0 -93
  59. package/dist/extensions/agent-browser/lib/electron/discovery-packages.js +0 -162
  60. package/dist/extensions/agent-browser/lib/electron/discovery-types.js +0 -2
  61. package/dist/extensions/agent-browser/lib/electron/discovery.js +0 -217
  62. package/dist/extensions/agent-browser/lib/electron/launch-monitor.js +0 -102
  63. package/dist/extensions/agent-browser/lib/electron/launch-process.js +0 -209
  64. package/dist/extensions/agent-browser/lib/electron/launch-types.js +0 -2
  65. package/dist/extensions/agent-browser/lib/electron/launch.js +0 -340
  66. package/dist/extensions/agent-browser/lib/executable-path.js +0 -29
  67. package/dist/extensions/agent-browser/lib/execution-cwd.js +0 -67
  68. package/dist/extensions/agent-browser/lib/fs-utils.js +0 -10
  69. package/dist/extensions/agent-browser/lib/input-modes/electron.js +0 -201
  70. package/dist/extensions/agent-browser/lib/input-modes/job.js +0 -198
  71. package/dist/extensions/agent-browser/lib/input-modes/lookup-network-evidence.js +0 -116
  72. package/dist/extensions/agent-browser/lib/input-modes/lookup-plan.js +0 -132
  73. package/dist/extensions/agent-browser/lib/input-modes/lookup-redaction.js +0 -57
  74. package/dist/extensions/agent-browser/lib/input-modes/lookup-source-evidence.js +0 -151
  75. package/dist/extensions/agent-browser/lib/input-modes/lookup-workspace.js +0 -142
  76. package/dist/extensions/agent-browser/lib/input-modes/lookups.js +0 -84
  77. package/dist/extensions/agent-browser/lib/input-modes/params.js +0 -195
  78. package/dist/extensions/agent-browser/lib/input-modes/qa-analysis.js +0 -268
  79. package/dist/extensions/agent-browser/lib/input-modes/qa-presentation.js +0 -117
  80. package/dist/extensions/agent-browser/lib/input-modes/script-child.js +0 -396
  81. package/dist/extensions/agent-browser/lib/input-modes/script-protocol.js +0 -86
  82. package/dist/extensions/agent-browser/lib/input-modes/script-types.js +0 -1
  83. package/dist/extensions/agent-browser/lib/input-modes/script-validation.js +0 -60
  84. package/dist/extensions/agent-browser/lib/input-modes/script.js +0 -108
  85. package/dist/extensions/agent-browser/lib/input-modes/semantic-action.js +0 -243
  86. package/dist/extensions/agent-browser/lib/input-modes/shared.js +0 -48
  87. package/dist/extensions/agent-browser/lib/input-modes/types.js +0 -65
  88. package/dist/extensions/agent-browser/lib/json-schema.js +0 -65
  89. package/dist/extensions/agent-browser/lib/launch-scoped-flags.js +0 -212
  90. package/dist/extensions/agent-browser/lib/managed-session-policy-lock.js +0 -165
  91. package/dist/extensions/agent-browser/lib/managed-session-posix-storage.js +0 -58
  92. package/dist/extensions/agent-browser/lib/managed-session-project-identity.js +0 -244
  93. package/dist/extensions/agent-browser/lib/managed-session-restore-context.js +0 -84
  94. package/dist/extensions/agent-browser/lib/managed-session-restore-policy.js +0 -119
  95. package/dist/extensions/agent-browser/lib/managed-session-restore-state.js +0 -83
  96. package/dist/extensions/agent-browser/lib/managed-session-restore.js +0 -212
  97. package/dist/extensions/agent-browser/lib/managed-session-snapshot-records.js +0 -277
  98. package/dist/extensions/agent-browser/lib/managed-session-snapshots.js +0 -181
  99. package/dist/extensions/agent-browser/lib/managed-session-storage.js +0 -126
  100. package/dist/extensions/agent-browser/lib/native-confirmation.js +0 -140
  101. package/dist/extensions/agent-browser/lib/native-output.js +0 -81
  102. package/dist/extensions/agent-browser/lib/orchestration/batch-stdin.js +0 -182
  103. package/dist/extensions/agent-browser/lib/orchestration/browser-run/artifact-merge.js +0 -30
  104. package/dist/extensions/agent-browser/lib/orchestration/browser-run/artifact-paths.js +0 -188
  105. package/dist/extensions/agent-browser/lib/orchestration/browser-run/browser-observation-result.js +0 -82
  106. package/dist/extensions/agent-browser/lib/orchestration/browser-run/click-dispatch.js +0 -406
  107. package/dist/extensions/agent-browser/lib/orchestration/browser-run/diagnostic-values.js +0 -31
  108. package/dist/extensions/agent-browser/lib/orchestration/browser-run/diagnostics.js +0 -240
  109. package/dist/extensions/agent-browser/lib/orchestration/browser-run/electron-observation.js +0 -203
  110. package/dist/extensions/agent-browser/lib/orchestration/browser-run/electron-text-diagnostics.js +0 -109
  111. package/dist/extensions/agent-browser/lib/orchestration/browser-run/fill-diagnostics.js +0 -119
  112. package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-action-recovery.js +0 -147
  113. package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-actions.js +0 -144
  114. package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-content.js +0 -123
  115. package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-contracts.js +0 -1
  116. package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-details.js +0 -156
  117. package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-electron.js +0 -187
  118. package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-evidence.js +0 -39
  119. package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-missing-binary.js +0 -89
  120. package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-recovery.js +0 -97
  121. package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-redaction.js +0 -106
  122. package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-timeout.js +0 -110
  123. package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result.js +0 -53
  124. package/dist/extensions/agent-browser/lib/orchestration/browser-run/index.js +0 -224
  125. package/dist/extensions/agent-browser/lib/orchestration/browser-run/interaction-diagnostics.js +0 -290
  126. package/dist/extensions/agent-browser/lib/orchestration/browser-run/managed-session-close.js +0 -167
  127. package/dist/extensions/agent-browser/lib/orchestration/browser-run/managed-session-daemon-inspection.js +0 -108
  128. package/dist/extensions/agent-browser/lib/orchestration/browser-run/managed-session-daemon-policy.js +0 -174
  129. package/dist/extensions/agent-browser/lib/orchestration/browser-run/native-helper-observation.js +0 -65
  130. package/dist/extensions/agent-browser/lib/orchestration/browser-run/observation-types.js +0 -1
  131. package/dist/extensions/agent-browser/lib/orchestration/browser-run/overlay-diagnostics.js +0 -120
  132. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/network-page-filter.js +0 -192
  133. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/scroll-shims.js +0 -225
  134. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/snapshot-filter-data.js +0 -150
  135. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/snapshot-filter.js +0 -174
  136. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/snapshot-rendered-text.js +0 -147
  137. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/wait-timeouts.js +0 -145
  138. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-artifacts.js +0 -159
  139. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-command.js +0 -131
  140. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-contracts.js +0 -1
  141. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-daemon.js +0 -93
  142. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-failure.js +0 -42
  143. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-guards.js +0 -242
  144. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-input.js +0 -75
  145. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-observations.js +0 -92
  146. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-page-selection.js +0 -254
  147. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-page-state.js +0 -121
  148. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-refs.js +0 -130
  149. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-resources.js +0 -114
  150. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-semantic.js +0 -121
  151. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-session-plan.js +0 -222
  152. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-timeouts.js +0 -68
  153. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare.js +0 -202
  154. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-analysis.js +0 -191
  155. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-confirmation.js +0 -152
  156. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-diagnostics.js +0 -182
  157. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-electron.js +0 -150
  158. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-lifecycle-contracts.js +0 -1
  159. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-lifecycle-phase-contracts.js +0 -1
  160. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-lifecycle-phase.js +0 -115
  161. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-lifecycle.js +0 -256
  162. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-managed-contracts.js +0 -1
  163. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-managed.js +0 -256
  164. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-native-phase-contracts.js +0 -1
  165. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-native-phase.js +0 -93
  166. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-native.js +0 -113
  167. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-navigation-contracts.js +0 -1
  168. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-navigation.js +0 -316
  169. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-ownership.js +0 -28
  170. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-page-phase-contracts.js +0 -1
  171. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-page-phase.js +0 -142
  172. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-presentation-contracts.js +0 -1
  173. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-presentation.js +0 -333
  174. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-publication-phase-contracts.js +0 -1
  175. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-publication-phase.js +0 -71
  176. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-publication.js +0 -201
  177. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-receipts.js +0 -183
  178. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-refs.js +0 -200
  179. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-tabs.js +0 -142
  180. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output.js +0 -25
  181. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prompt-guards.js +0 -50
  182. package/dist/extensions/agent-browser/lib/orchestration/browser-run/recording-receipt-reconciliation.js +0 -198
  183. package/dist/extensions/agent-browser/lib/orchestration/browser-run/recording-recovery-contracts.js +0 -1
  184. package/dist/extensions/agent-browser/lib/orchestration/browser-run/recording-recovery-presentation.js +0 -154
  185. package/dist/extensions/agent-browser/lib/orchestration/browser-run/recording-recovery.js +0 -80
  186. package/dist/extensions/agent-browser/lib/orchestration/browser-run/screenshot-capture.js +0 -14
  187. package/dist/extensions/agent-browser/lib/orchestration/browser-run/screenshot-observation.js +0 -206
  188. package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-commands.js +0 -130
  189. package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-electron.js +0 -212
  190. package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-observations.js +0 -61
  191. package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-outcomes.js +0 -187
  192. package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-refs.js +0 -169
  193. package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-tabs.js +0 -228
  194. package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state.js +0 -117
  195. package/dist/extensions/agent-browser/lib/orchestration/browser-run/text-visibility-diagnostics.js +0 -182
  196. package/dist/extensions/agent-browser/lib/orchestration/browser-run/timeout-diagnostics.js +0 -256
  197. package/dist/extensions/agent-browser/lib/orchestration/browser-run/timeout-progress.js +0 -108
  198. package/dist/extensions/agent-browser/lib/orchestration/browser-run/types.js +0 -1
  199. package/dist/extensions/agent-browser/lib/orchestration/code-artifact-observation.js +0 -39
  200. package/dist/extensions/agent-browser/lib/orchestration/code-image-observation.js +0 -119
  201. package/dist/extensions/agent-browser/lib/orchestration/electron-host/branch.js +0 -93
  202. package/dist/extensions/agent-browser/lib/orchestration/electron-host/cleanup-result.js +0 -58
  203. package/dist/extensions/agent-browser/lib/orchestration/electron-host/cleanup.js +0 -78
  204. package/dist/extensions/agent-browser/lib/orchestration/electron-host/contracts.js +0 -1
  205. package/dist/extensions/agent-browser/lib/orchestration/electron-host/discovery.js +0 -106
  206. package/dist/extensions/agent-browser/lib/orchestration/electron-host/index.js +0 -60
  207. package/dist/extensions/agent-browser/lib/orchestration/electron-host/policy.js +0 -86
  208. package/dist/extensions/agent-browser/lib/orchestration/electron-host/probe-collection.js +0 -68
  209. package/dist/extensions/agent-browser/lib/orchestration/electron-host/probe-data.js +0 -169
  210. package/dist/extensions/agent-browser/lib/orchestration/electron-host/probe-presentation.js +0 -182
  211. package/dist/extensions/agent-browser/lib/orchestration/electron-host/probe.js +0 -161
  212. package/dist/extensions/agent-browser/lib/orchestration/electron-host/status.js +0 -167
  213. package/dist/extensions/agent-browser/lib/orchestration/execution-queue.js +0 -98
  214. package/dist/extensions/agent-browser/lib/orchestration/extension-artifact-preflight.js +0 -211
  215. package/dist/extensions/agent-browser/lib/orchestration/extension-artifacts.js +0 -23
  216. package/dist/extensions/agent-browser/lib/orchestration/extension-attachment-replay.js +0 -99
  217. package/dist/extensions/agent-browser/lib/orchestration/extension-branch-restore.js +0 -275
  218. package/dist/extensions/agent-browser/lib/orchestration/extension-code.js +0 -280
  219. package/dist/extensions/agent-browser/lib/orchestration/extension-command-admission.js +0 -303
  220. package/dist/extensions/agent-browser/lib/orchestration/extension-command-output.js +0 -36
  221. package/dist/extensions/agent-browser/lib/orchestration/extension-command-result.js +0 -335
  222. package/dist/extensions/agent-browser/lib/orchestration/extension-command-run.js +0 -227
  223. package/dist/extensions/agent-browser/lib/orchestration/extension-command-state.js +0 -1
  224. package/dist/extensions/agent-browser/lib/orchestration/extension-electron-ownership.js +0 -204
  225. package/dist/extensions/agent-browser/lib/orchestration/extension-execution-locks.js +0 -139
  226. package/dist/extensions/agent-browser/lib/orchestration/extension-execution-queue.js +0 -24
  227. package/dist/extensions/agent-browser/lib/orchestration/extension-host-coordination.js +0 -98
  228. package/dist/extensions/agent-browser/lib/orchestration/extension-host-run.js +0 -295
  229. package/dist/extensions/agent-browser/lib/orchestration/extension-intent-replay.js +0 -41
  230. package/dist/extensions/agent-browser/lib/orchestration/extension-invocation.js +0 -7
  231. package/dist/extensions/agent-browser/lib/orchestration/extension-lifecycle.js +0 -102
  232. package/dist/extensions/agent-browser/lib/orchestration/extension-managed-ownership.js +0 -133
  233. package/dist/extensions/agent-browser/lib/orchestration/extension-observation.js +0 -120
  234. package/dist/extensions/agent-browser/lib/orchestration/extension-prompt.js +0 -180
  235. package/dist/extensions/agent-browser/lib/orchestration/extension-recording.js +0 -290
  236. package/dist/extensions/agent-browser/lib/orchestration/extension-resource-contracts.js +0 -1
  237. package/dist/extensions/agent-browser/lib/orchestration/extension-resource-replay.js +0 -269
  238. package/dist/extensions/agent-browser/lib/orchestration/extension-result-state.js +0 -113
  239. package/dist/extensions/agent-browser/lib/orchestration/extension-runtime.js +0 -146
  240. package/dist/extensions/agent-browser/lib/orchestration/extension-script-leases.js +0 -58
  241. package/dist/extensions/agent-browser/lib/orchestration/extension-tool-boundary.js +0 -62
  242. package/dist/extensions/agent-browser/lib/orchestration/extension-version-check.js +0 -54
  243. package/dist/extensions/agent-browser/lib/orchestration/input-plan-types.js +0 -1
  244. package/dist/extensions/agent-browser/lib/orchestration/input-plan.js +0 -313
  245. package/dist/extensions/agent-browser/lib/orchestration/input-redaction.js +0 -62
  246. package/dist/extensions/agent-browser/lib/orchestration/native-config.js +0 -144
  247. package/dist/extensions/agent-browser/lib/orchestration/native-root-launch.js +0 -77
  248. package/dist/extensions/agent-browser/lib/orchestration/native-session-defaults.js +0 -231
  249. package/dist/extensions/agent-browser/lib/orchestration/operation-paths.js +0 -142
  250. package/dist/extensions/agent-browser/lib/orchestration/output-file.js +0 -276
  251. package/dist/extensions/agent-browser/lib/orchestration/script-mode.js +0 -220
  252. package/dist/extensions/agent-browser/lib/owned-managed-session-context.js +0 -55
  253. package/dist/extensions/agent-browser/lib/page-target-batch.js +0 -118
  254. package/dist/extensions/agent-browser/lib/page-target-guards.js +0 -50
  255. package/dist/extensions/agent-browser/lib/page-target-navigation.js +0 -104
  256. package/dist/extensions/agent-browser/lib/page-target-validation.js +0 -90
  257. package/dist/extensions/agent-browser/lib/parsing.js +0 -30
  258. package/dist/extensions/agent-browser/lib/pi-tool-rendering.js +0 -343
  259. package/dist/extensions/agent-browser/lib/playbook.js +0 -146
  260. package/dist/extensions/agent-browser/lib/process-child.js +0 -284
  261. package/dist/extensions/agent-browser/lib/process-environment.js +0 -48
  262. package/dist/extensions/agent-browser/lib/process-errors.js +0 -23
  263. package/dist/extensions/agent-browser/lib/process-identity.js +0 -127
  264. package/dist/extensions/agent-browser/lib/process-socket-storage.js +0 -256
  265. package/dist/extensions/agent-browser/lib/process-stdout.js +0 -74
  266. package/dist/extensions/agent-browser/lib/process.js +0 -216
  267. package/dist/extensions/agent-browser/lib/prompt-artifacts.js +0 -287
  268. package/dist/extensions/agent-browser/lib/prompt-policy.js +0 -54
  269. package/dist/extensions/agent-browser/lib/read-command.js +0 -41
  270. package/dist/extensions/agent-browser/lib/read-confirmation.js +0 -162
  271. package/dist/extensions/agent-browser/lib/recording-reservations.js +0 -208
  272. package/dist/extensions/agent-browser/lib/redaction-fields.js +0 -75
  273. package/dist/extensions/agent-browser/lib/redaction-json.js +0 -149
  274. package/dist/extensions/agent-browser/lib/redaction-url.js +0 -88
  275. package/dist/extensions/agent-browser/lib/results/action-contracts.js +0 -1
  276. package/dist/extensions/agent-browser/lib/results/action-recommendations.js +0 -38
  277. package/dist/extensions/agent-browser/lib/results/artifact-contracts.js +0 -1
  278. package/dist/extensions/agent-browser/lib/results/artifact-manifest-validation.js +0 -133
  279. package/dist/extensions/agent-browser/lib/results/artifact-manifest.js +0 -173
  280. package/dist/extensions/agent-browser/lib/results/artifact-recommendations.js +0 -73
  281. package/dist/extensions/agent-browser/lib/results/categories.js +0 -152
  282. package/dist/extensions/agent-browser/lib/results/confirmation.js +0 -75
  283. package/dist/extensions/agent-browser/lib/results/contracts.js +0 -1
  284. package/dist/extensions/agent-browser/lib/results/editable-ref-evidence.js +0 -99
  285. package/dist/extensions/agent-browser/lib/results/electron-recommendations.js +0 -83
  286. package/dist/extensions/agent-browser/lib/results/envelope-decoding.js +0 -48
  287. package/dist/extensions/agent-browser/lib/results/envelope.js +0 -198
  288. package/dist/extensions/agent-browser/lib/results/evidence-contracts.js +0 -1
  289. package/dist/extensions/agent-browser/lib/results/failure-recommendations.js +0 -180
  290. package/dist/extensions/agent-browser/lib/results/network-routes.js +0 -133
  291. package/dist/extensions/agent-browser/lib/results/network.js +0 -89
  292. package/dist/extensions/agent-browser/lib/results/next-actions.js +0 -111
  293. package/dist/extensions/agent-browser/lib/results/presentation/artifact-files.js +0 -320
  294. package/dist/extensions/agent-browser/lib/results/presentation/artifact-format.js +0 -138
  295. package/dist/extensions/agent-browser/lib/results/presentation/artifact-images.js +0 -113
  296. package/dist/extensions/agent-browser/lib/results/presentation/artifact-verification.js +0 -145
  297. package/dist/extensions/agent-browser/lib/results/presentation/artifacts.js +0 -165
  298. package/dist/extensions/agent-browser/lib/results/presentation/batch-contracts.js +0 -1
  299. package/dist/extensions/agent-browser/lib/results/presentation/batch-recording.js +0 -118
  300. package/dist/extensions/agent-browser/lib/results/presentation/batch-redaction.js +0 -68
  301. package/dist/extensions/agent-browser/lib/results/presentation/batch-rendering.js +0 -135
  302. package/dist/extensions/agent-browser/lib/results/presentation/batch-step.js +0 -227
  303. package/dist/extensions/agent-browser/lib/results/presentation/batch-summary.js +0 -91
  304. package/dist/extensions/agent-browser/lib/results/presentation/batch.js +0 -123
  305. package/dist/extensions/agent-browser/lib/results/presentation/browser-profile-recovery.js +0 -54
  306. package/dist/extensions/agent-browser/lib/results/presentation/command-presenters.js +0 -216
  307. package/dist/extensions/agent-browser/lib/results/presentation/common.js +0 -81
  308. package/dist/extensions/agent-browser/lib/results/presentation/content.js +0 -119
  309. package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-a11y.js +0 -67
  310. package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-health.js +0 -79
  311. package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-identity.js +0 -199
  312. package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-logs.js +0 -75
  313. package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-network-actions.js +0 -216
  314. package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-network.js +0 -124
  315. package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-redaction.js +0 -64
  316. package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-storage.js +0 -209
  317. package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-stream.js +0 -69
  318. package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-summary.js +0 -222
  319. package/dist/extensions/agent-browser/lib/results/presentation/diagnostics.js +0 -124
  320. package/dist/extensions/agent-browser/lib/results/presentation/early-result.js +0 -70
  321. package/dist/extensions/agent-browser/lib/results/presentation/errors.js +0 -285
  322. package/dist/extensions/agent-browser/lib/results/presentation/input-contracts.js +0 -1
  323. package/dist/extensions/agent-browser/lib/results/presentation/large-output.js +0 -117
  324. package/dist/extensions/agent-browser/lib/results/presentation/navigation.js +0 -231
  325. package/dist/extensions/agent-browser/lib/results/presentation/notices.js +0 -75
  326. package/dist/extensions/agent-browser/lib/results/presentation/observation-contracts.js +0 -1
  327. package/dist/extensions/agent-browser/lib/results/presentation/observation-rendering.js +0 -127
  328. package/dist/extensions/agent-browser/lib/results/presentation/outcomes.js +0 -120
  329. package/dist/extensions/agent-browser/lib/results/presentation/output-completion.js +0 -77
  330. package/dist/extensions/agent-browser/lib/results/presentation/output-spill.js +0 -51
  331. package/dist/extensions/agent-browser/lib/results/presentation/registry.js +0 -145
  332. package/dist/extensions/agent-browser/lib/results/presentation/semantic-action.js +0 -104
  333. package/dist/extensions/agent-browser/lib/results/presentation/skills.js +0 -183
  334. package/dist/extensions/agent-browser/lib/results/presentation/source.js +0 -109
  335. package/dist/extensions/agent-browser/lib/results/presentation.js +0 -19
  336. package/dist/extensions/agent-browser/lib/results/recommendation-contracts.js +0 -1
  337. package/dist/extensions/agent-browser/lib/results/recording.js +0 -88
  338. package/dist/extensions/agent-browser/lib/results/recovery-actions.js +0 -118
  339. package/dist/extensions/agent-browser/lib/results/recovery-next-actions.js +0 -60
  340. package/dist/extensions/agent-browser/lib/results/selector-recovery-target.js +0 -83
  341. package/dist/extensions/agent-browser/lib/results/selector-recovery.js +0 -261
  342. package/dist/extensions/agent-browser/lib/results/snapshot-compact.js +0 -266
  343. package/dist/extensions/agent-browser/lib/results/snapshot-content.js +0 -32
  344. package/dist/extensions/agent-browser/lib/results/snapshot-high-value-controls.js +0 -240
  345. package/dist/extensions/agent-browser/lib/results/snapshot-refs.js +0 -103
  346. package/dist/extensions/agent-browser/lib/results/snapshot-segments.js +0 -383
  347. package/dist/extensions/agent-browser/lib/results/snapshot-spill.js +0 -53
  348. package/dist/extensions/agent-browser/lib/results/snapshot.js +0 -44
  349. package/dist/extensions/agent-browser/lib/results/text.js +0 -44
  350. package/dist/extensions/agent-browser/lib/runtime-args-validation.js +0 -133
  351. package/dist/extensions/agent-browser/lib/runtime-compatibility.js +0 -81
  352. package/dist/extensions/agent-browser/lib/runtime-contracts.js +0 -1
  353. package/dist/extensions/agent-browser/lib/runtime-redaction.js +0 -118
  354. package/dist/extensions/agent-browser/lib/runtime-replay-events.js +0 -144
  355. package/dist/extensions/agent-browser/lib/runtime-session-identity.js +0 -76
  356. package/dist/extensions/agent-browser/lib/runtime-session-plan.js +0 -114
  357. package/dist/extensions/agent-browser/lib/runtime-session-replay.js +0 -123
  358. package/dist/extensions/agent-browser/lib/runtime-tab-correction.js +0 -65
  359. package/dist/extensions/agent-browser/lib/runtime-timeouts.js +0 -28
  360. package/dist/extensions/agent-browser/lib/runtime.js +0 -163
  361. package/dist/extensions/agent-browser/lib/session-identity.js +0 -51
  362. package/dist/extensions/agent-browser/lib/session-page-observation.js +0 -357
  363. package/dist/extensions/agent-browser/lib/session-page-state.js +0 -353
  364. package/dist/extensions/agent-browser/lib/session-page-types.js +0 -1
  365. package/dist/extensions/agent-browser/lib/string-enum-schema.js +0 -8
  366. package/dist/extensions/agent-browser/lib/temp-artifact-budget.js +0 -81
  367. package/dist/extensions/agent-browser/lib/temp-mutation-queue.js +0 -7
  368. package/dist/extensions/agent-browser/lib/temp-root-ownership.js +0 -234
  369. package/dist/extensions/agent-browser/lib/temp-root.js +0 -211
  370. package/dist/extensions/agent-browser/lib/temp.js +0 -91
  371. package/dist/extensions/agent-browser/lib/tool-surface.js +0 -239
  372. package/dist/extensions/agent-browser/lib/upstream-version.js +0 -15
  373. package/dist/extensions/agent-browser/lib/web-search-providers.js +0 -193
  374. package/dist/extensions/agent-browser/lib/web-search-request.js +0 -102
  375. package/dist/extensions/agent-browser/lib/web-search-results.js +0 -281
  376. package/dist/extensions/agent-browser/lib/web-search-schema.js +0 -82
  377. package/dist/extensions/agent-browser/lib/web-search.js +0 -167
  378. package/dist/extensions/agent-browser/lib/webmcp-observation.js +0 -35
  379. package/dist/extensions/agent-browser/lib/windows-stock-launcher.js +0 -96
  380. package/dist/scripts/agent-browser-target.mjs +0 -23
@@ -1,68 +0,0 @@
1
- import { extractUpstreamCommandTokens } from "../../argv-descriptor.js";
2
- import { redactSensitiveText, redactSensitiveValue } from "../../runtime-redaction.js";
3
- import { isRecord } from "../../parsing.js";
4
- import { getClipboardWritePayloadCandidates, redactClipboardPermissionErrorValue, } from "./errors.js";
5
- export function hasModelFacingArgRedaction(args) {
6
- return (args?.some((arg) => arg === "[REDACTED]" || arg.includes("%5BREDACTED%5D") || arg.includes("[REDACTED]")) === true);
7
- }
8
- function getPasswordValues(tokens) {
9
- const values = [];
10
- for (let index = 0; index < tokens.length; index += 1) {
11
- const token = tokens[index];
12
- const next = tokens.at(index + 1);
13
- if (token === "--password" && next !== undefined && next.length > 0) {
14
- values.push(next);
15
- }
16
- else if (token.startsWith("--password=")) {
17
- values.push(token.slice("--password=".length));
18
- }
19
- }
20
- return values;
21
- }
22
- function getStatefulValue(tokens) {
23
- if (tokens[0] === "cookies" && tokens[1] === "set" && !tokens.slice(2).includes("--curl")) {
24
- return tokens.at(3);
25
- }
26
- if (tokens[0] === "storage" &&
27
- ["local", "session"].includes(tokens[1] ?? "") &&
28
- tokens[2] === "set") {
29
- return tokens.at(4);
30
- }
31
- return undefined;
32
- }
33
- function getStatefulCommandSensitiveValues(command) {
34
- if (!command) {
35
- return [];
36
- }
37
- const tokens = extractUpstreamCommandTokens(command);
38
- const statefulValue = getStatefulValue(tokens);
39
- const values = getPasswordValues(tokens);
40
- if (statefulValue !== undefined) {
41
- values.unshift(statefulValue);
42
- }
43
- return values.filter((value) => value.length > 0);
44
- }
45
- function redactExactValues(value, sensitiveValues) {
46
- if (sensitiveValues.length === 0) {
47
- return redactSensitiveValue(value);
48
- }
49
- if (typeof value === "string") {
50
- let redacted = value;
51
- for (const sensitive of sensitiveValues) {
52
- redacted = redacted.split(sensitive).join("[REDACTED]");
53
- }
54
- return redactSensitiveText(redacted);
55
- }
56
- if (Array.isArray(value)) {
57
- return value.map((item) => redactExactValues(item, sensitiveValues));
58
- }
59
- if (!isRecord(value)) {
60
- return value;
61
- }
62
- return redactSensitiveValue(Object.fromEntries(Object.entries(value).map(([key, item]) => [key, redactExactValues(item, sensitiveValues)])));
63
- }
64
- export function redactBatchStepErrorData(command, value) {
65
- return command?.[0] === "clipboard"
66
- ? redactSensitiveValue(redactClipboardPermissionErrorValue({ command: "clipboard", subcommand: command[1] }, value, getClipboardWritePayloadCandidates(command)))
67
- : redactExactValues(value, getStatefulCommandSensitiveValues(command));
68
- }
@@ -1,135 +0,0 @@
1
- import { getPresentationImages } from "./content.js";
2
- function getTypedTextLength(command) {
3
- return command?.[0] === "keyboard" && command[1] === "type" && typeof command.at(2) === "string"
4
- ? Array.from(command[2]).length
5
- : undefined;
6
- }
7
- function getWaitDelayMs(command) {
8
- const delay = command?.at(1);
9
- return command?.[0] === "wait" && delay !== undefined && /^\d+$/.test(delay) ? delay : undefined;
10
- }
11
- function getTypingDelayBetween(steps, index) {
12
- const delay = steps.at(index + 1)?.details;
13
- const next = steps.at(index + 2)?.details;
14
- if (!delay ||
15
- !next ||
16
- !delay.success ||
17
- !next.success ||
18
- getTypedTextLength(next.command) === undefined) {
19
- return undefined;
20
- }
21
- return getWaitDelayMs(delay.command);
22
- }
23
- function getTypedPulse(steps, index) {
24
- const step = steps.at(index)?.details;
25
- if (!step || !step.success) {
26
- return undefined;
27
- }
28
- const chars = getTypedTextLength(step.command);
29
- if (chars === undefined) {
30
- return undefined;
31
- }
32
- const delay = getTypingDelayBetween(steps, index);
33
- return { chars, delay, nextIndex: index + (delay === undefined ? 1 : 2) };
34
- }
35
- function scanTypingRun(steps, start) {
36
- let index = start;
37
- let typedCharCount = 0;
38
- let typedStepCount = 0;
39
- let delayMs;
40
- while (index < steps.length) {
41
- const pulse = getTypedPulse(steps, index);
42
- if (!pulse) {
43
- break;
44
- }
45
- typedCharCount += pulse.chars;
46
- typedStepCount += 1;
47
- if (pulse.delay !== undefined) {
48
- if (delayMs !== undefined && delayMs !== pulse.delay) {
49
- return undefined;
50
- }
51
- delayMs = pulse.delay;
52
- }
53
- index = pulse.nextIndex;
54
- }
55
- return typedStepCount >= 2 ? { nextIndex: index, typedCharCount, delayMs } : undefined;
56
- }
57
- function getTypingStart(steps, index) {
58
- const details = steps.at(index)?.details;
59
- if (!details || !details.success) {
60
- return undefined;
61
- }
62
- if (details.command?.[0] === "focus" && typeof details.command.at(1) === "string") {
63
- return { firstIndex: details.index, typingIndex: index + 1, target: details.command[1] };
64
- }
65
- return { firstIndex: details.index, typingIndex: index };
66
- }
67
- function getPressAfterTyping(steps, index) {
68
- const details = steps.at(index)?.details;
69
- if (!details || !details.success || details.command?.[0] !== "press") {
70
- return undefined;
71
- }
72
- return details.command.at(1);
73
- }
74
- function formatTypedSequenceSummary(steps, startIndex) {
75
- const start = getTypingStart(steps, startIndex);
76
- if (!start) {
77
- return undefined;
78
- }
79
- const run = scanTypingRun(steps, start.typingIndex);
80
- if (!run) {
81
- return undefined;
82
- }
83
- const pressedKey = getPressAfterTyping(steps, run.nextIndex);
84
- const nextIndex = run.nextIndex + (pressedKey !== undefined ? 1 : 0);
85
- const firstStep = start.firstIndex + 1;
86
- const lastIndex = steps.at(nextIndex - 1)?.details.index;
87
- const lastStep = lastIndex === undefined ? undefined : lastIndex + 1;
88
- const range = lastStep !== undefined && lastStep > firstStep ? `${firstStep}-${lastStep}` : String(firstStep);
89
- return { nextIndex, text: formatTypingSummaryText(range, start.target, run, pressedKey) };
90
- }
91
- function formatTypingSummaryText(range, target, run, pressedKey) {
92
- const label = target !== undefined && target.length > 0 ? `type ${target}` : "keyboard type";
93
- const lines = [
94
- `Step ${range} — ${label} (succeeded)`,
95
- `Typed ${run.typedCharCount} char${run.typedCharCount === 1 ? "" : "s"}${run.delayMs !== undefined ? ` with delayMs=${run.delayMs}` : ""}.`,
96
- ];
97
- if (pressedKey !== undefined && pressedKey.length > 0) {
98
- lines.push(`Pressed ${pressedKey}.`);
99
- }
100
- return lines.join("\n");
101
- }
102
- function formatBatchStepDetails(step) {
103
- const details = step.details;
104
- const images = getPresentationImages(step.presentation).length;
105
- const lines = [
106
- `Step ${details.index + 1} — ${details.commandText} (${details.success ? "succeeded" : "failed"})`,
107
- ];
108
- if (details.text.length > 0) {
109
- lines.push(details.text);
110
- }
111
- if (images > 0) {
112
- lines.push(`(${images} inline image attachment${images === 1 ? "" : "s"} below)`);
113
- }
114
- return lines.join("\n");
115
- }
116
- export function formatBatchStepsText(steps) {
117
- if (steps.length === 0) {
118
- return "(no batch steps)";
119
- }
120
- const lines = [];
121
- for (let index = 0; index < steps.length;) {
122
- const sequence = formatTypedSequenceSummary(steps, index);
123
- if (sequence) {
124
- lines.push(sequence.text);
125
- index = sequence.nextIndex;
126
- continue;
127
- }
128
- const step = steps.at(index);
129
- if (step) {
130
- lines.push(formatBatchStepDetails(step));
131
- }
132
- index += 1;
133
- }
134
- return lines.join("\n\n");
135
- }
@@ -1,227 +0,0 @@
1
- import { parseCommandInfo } from "../../argv-descriptor.js";
2
- import { isRecord } from "../../parsing.js";
3
- import { redactInvocationArgs } from "../../runtime-redaction.js";
4
- import { buildAgentBrowserNextActions } from "../action-recommendations.js";
5
- import { buildPendingWebMcpNextActions } from "../recovery-next-actions.js";
6
- import { classifyAgentBrowserFailureCategory } from "../categories.js";
7
- import { detectConfirmationRequired } from "../confirmation.js";
8
- import { applyNamespaceToNextActions, withOptionalSessionArgs } from "../next-actions.js";
9
- import { buildNetworkRouteDiagnostics } from "../network-routes.js";
10
- import { extractAgentBrowserLifecycle, stringifyModelFacing } from "./common.js";
11
- import { classifyPresentationSuccessCategory } from "./artifacts.js";
12
- import { formatBatchStepCommand, getPresentationPaths, getPresentationText, isStringArray, } from "./content.js";
13
- import { buildPageChangeSummary } from "./navigation.js";
14
- import { appendSelectorRecoveryHint, isOverlayBlockedClickError } from "./errors.js";
15
- import { hasModelFacingArgRedaction, redactBatchStepErrorData } from "./batch-redaction.js";
16
- function createStepIdentity(item, index) {
17
- const command = isStringArray(item.command) ? item.command : undefined;
18
- const redactedCommand = command ? redactInvocationArgs(command) : undefined;
19
- return {
20
- command,
21
- redactedCommand,
22
- index,
23
- commandText: formatBatchStepCommand(hasModelFacingArgRedaction(redactedCommand) ? redactedCommand : command, index),
24
- lifecycle: extractAgentBrowserLifecycle(item.result),
25
- };
26
- }
27
- function formatBatchStepError(error) {
28
- const text = stringifyModelFacing(error).trim();
29
- return appendSelectorRecoveryHint(text.length > 0 ? `Error: ${text}` : "Error: batch step failed.");
30
- }
31
- function buildWaitTextAssertionFailureAction(sessionName) {
32
- return {
33
- id: "inspect-after-text-assertion-failure",
34
- params: { args: withOptionalSessionArgs(sessionName, ["snapshot", "-i"]) },
35
- reason: "Inspect the current page after the text assertion failed before concluding the expected text is absent.",
36
- safety: "Read-only snapshot; use current refs or visible text from this page before retrying the assertion.",
37
- tool: "agent_browser",
38
- };
39
- }
40
- function describeStepFailure(command, error) {
41
- const data = redactBatchStepErrorData(command, error);
42
- const text = formatBatchStepError(data);
43
- return {
44
- data,
45
- text,
46
- category: classifyAgentBrowserFailureCategory({
47
- args: command,
48
- command: command?.[0],
49
- errorText: text,
50
- }),
51
- confirmationId: detectConfirmationRequired(error)?.id,
52
- overlayBlocked: isOverlayBlockedClickError(command?.[0], text, command),
53
- };
54
- }
55
- function buildFailedStepActions(command, failure, scope) {
56
- const recovery = buildAgentBrowserNextActions({
57
- args: command,
58
- command: command?.[0],
59
- confirmationId: failure.confirmationId,
60
- failureCategory: failure.category,
61
- overlayBlockedClick: failure.overlayBlocked,
62
- resultCategory: "failure",
63
- sessionName: scope.sessionName,
64
- subcommand: command?.[1],
65
- });
66
- const waitAction = command?.[0] === "wait" && command.includes("--text")
67
- ? [buildWaitTextAssertionFailureAction(scope.sessionName)]
68
- : [];
69
- const seen = new Set();
70
- const actions = [...waitAction, ...(recovery ?? [])].filter((action) => {
71
- if (seen.has(action.id)) {
72
- return false;
73
- }
74
- seen.add(action.id);
75
- return true;
76
- });
77
- return applyNamespaceToNextActions(actions.length > 0 ? actions : undefined, scope.namespace);
78
- }
79
- function buildFailedStep(item, identity, scope) {
80
- const failure = describeStepFailure(identity.command, item.error);
81
- const { data, text, category: failureCategory } = failure;
82
- const nextActions = buildFailedStepActions(identity.command, failure, scope);
83
- const presentation = {
84
- content: [{ type: "text", text }],
85
- failureCategory,
86
- nextActions,
87
- resultCategory: "failure",
88
- summary: text,
89
- };
90
- return {
91
- presentation,
92
- details: {
93
- artifactVerification: presentation.artifactVerification,
94
- artifacts: presentation.artifacts,
95
- command: identity.redactedCommand,
96
- commandText: identity.commandText,
97
- data,
98
- failureCategory,
99
- index: identity.index,
100
- lifecycle: identity.lifecycle,
101
- nextActions,
102
- resultCategory: "failure",
103
- success: false,
104
- summary: text,
105
- text,
106
- },
107
- };
108
- }
109
- function buildNestedRequest(options, command) {
110
- const commandInfo = parseCommandInfo(command ?? []);
111
- return {
112
- modelVisible: options.modelVisible,
113
- artifactManifest: options.artifactManifest,
114
- artifactMaxUpdatedAtMs: options.artifactMaxUpdatedAtMs,
115
- artifactMinUpdatedAtMs: options.artifactMinUpdatedAtMs,
116
- artifactRequest: options.artifactRequest,
117
- commandInfo: command ? { ...commandInfo, commandTokens: command } : commandInfo,
118
- cwd: options.cwd,
119
- args: command,
120
- envelope: {
121
- data: options.item.result,
122
- success: options.item.success !== false,
123
- error: options.item.error,
124
- },
125
- errorText: options.item.success === false
126
- ? formatBatchStepError(redactBatchStepErrorData(command, options.item.error))
127
- : undefined,
128
- piCleanupOwnership: options.piCleanupOwnership,
129
- networkRouteDiagnostics: commandInfo.command === "network" && commandInfo.subcommand === "requests"
130
- ? buildNetworkRouteDiagnostics(options.item.result, options.networkRoutes)
131
- : undefined,
132
- namespace: options.namespace,
133
- persistentArtifactStore: options.persistentArtifactStore,
134
- sessionName: options.sessionName,
135
- };
136
- }
137
- function isPendingWebMcpMutation(command, data) {
138
- return (command.command === "webmcp" &&
139
- ["invoke", "result"].includes(command.subcommand ?? "") &&
140
- isRecord(data) &&
141
- data.status === "pending");
142
- }
143
- function buildStandardStepActions(presentation, command, sessionName) {
144
- return (presentation.nextActions ??
145
- buildAgentBrowserNextActions({
146
- artifacts: presentation.artifacts,
147
- args: command,
148
- command: command?.[0],
149
- failureCategory: presentation.failureCategory,
150
- resultCategory: presentation.resultCategory !== "failure" ? "success" : "failure",
151
- savedFilePath: presentation.savedFilePath,
152
- sessionName,
153
- subcommand: command?.[1],
154
- successCategory: presentation.successCategory,
155
- }));
156
- }
157
- function getStepNextActions(presentation, commandInfo, command, scope) {
158
- const actions = presentation.resultCategory !== "failure" &&
159
- isPendingWebMcpMutation(commandInfo, presentation.data)
160
- ? buildPendingWebMcpNextActions(scope.sessionName)
161
- : buildStandardStepActions(presentation, command, scope.sessionName);
162
- return applyNamespaceToNextActions(actions, scope.namespace);
163
- }
164
- function buildStepDetails(presentation, identity, command, scope) {
165
- const fullOutputPaths = getPresentationPaths({
166
- primaryPath: presentation.fullOutputPath,
167
- secondaryPaths: presentation.fullOutputPaths,
168
- });
169
- const imagePaths = getPresentationPaths({
170
- primaryPath: presentation.imagePath,
171
- secondaryPaths: presentation.imagePaths,
172
- });
173
- const text = getPresentationText(presentation);
174
- const succeeded = presentation.resultCategory !== "failure";
175
- const nextActions = getStepNextActions(presentation, command, identity.command, scope);
176
- return {
177
- artifactVerification: presentation.artifactVerification,
178
- artifacts: presentation.artifacts,
179
- command: identity.redactedCommand,
180
- commandText: identity.commandText,
181
- data: presentation.data,
182
- failureCategory: succeeded ? undefined : presentation.failureCategory,
183
- fullOutputPath: fullOutputPaths.at(0),
184
- fullOutputPaths: fullOutputPaths.length > 0 ? fullOutputPaths : undefined,
185
- imagePath: imagePaths.at(0),
186
- imagePaths: imagePaths.length > 0 ? imagePaths : undefined,
187
- imageObservations: presentation.imageObservations,
188
- index: identity.index,
189
- lifecycle: identity.lifecycle,
190
- networkRouteDiagnostics: presentation.networkRouteDiagnostics,
191
- nextActions,
192
- pageChangeSummary: buildPageChangeSummary({
193
- artifacts: presentation.artifacts,
194
- commandInfo: command,
195
- data: presentation.data,
196
- nextActions,
197
- savedFilePath: presentation.savedFilePath,
198
- summary: presentation.summary,
199
- }),
200
- resultCategory: succeeded ? "success" : "failure",
201
- savedFile: presentation.savedFile,
202
- savedFilePath: presentation.savedFilePath,
203
- success: succeeded,
204
- successCategory: succeeded
205
- ? classifyPresentationSuccessCategory({
206
- artifactVerification: presentation.artifactVerification,
207
- artifacts: presentation.artifacts,
208
- savedFile: presentation.savedFile,
209
- })
210
- : undefined,
211
- summary: presentation.summary,
212
- text: text.length > 0 ? text : presentation.summary,
213
- };
214
- }
215
- export async function buildBatchStepPresentation(options) {
216
- const identity = createStepIdentity(options.item, options.index);
217
- const scope = { namespace: options.namespace, sessionName: options.sessionName };
218
- if (options.item.success === false && identity.command?.[0] !== "record") {
219
- return buildFailedStep(options.item, identity, scope);
220
- }
221
- const request = buildNestedRequest(options, identity.command);
222
- const presentation = await options.buildNestedToolPresentation(request);
223
- return {
224
- details: buildStepDetails(presentation, identity, request.commandInfo, scope),
225
- presentation,
226
- };
227
- }
@@ -1,91 +0,0 @@
1
- import { formatBatchStepsText } from "./batch-rendering.js";
2
- import { buildPageChangeSummary } from "./navigation.js";
3
- function getBatchFailure(steps) {
4
- const failed = steps.filter((step) => !step.details.success);
5
- const first = failed.at(0);
6
- return first
7
- ? {
8
- failedStep: first.details,
9
- failureCount: failed.length,
10
- successCount: steps.length - failed.length,
11
- totalCount: steps.length,
12
- }
13
- : undefined;
14
- }
15
- function countUnverifiedMutations(steps) {
16
- return steps.filter((step) => step.details.pageChangeSummary?.changeType === "mutation" &&
17
- !step.details.pageChangeSummary.observed).length;
18
- }
19
- export function summarizeBatchStatus(steps, requestedSummary) {
20
- const failure = getBatchFailure(steps);
21
- const summary = failure
22
- ? `Batch failed: ${failure.successCount}/${failure.totalCount} succeeded`
23
- : requestedSummary;
24
- const mutations = countUnverifiedMutations(steps);
25
- return {
26
- failure,
27
- summary,
28
- header: failure
29
- ? [
30
- summary,
31
- `First failing step: ${failure.failedStep.index + 1} — ${failure.failedStep.commandText}`,
32
- failure.failureCount > 1
33
- ? `${failure.failureCount} steps failed. See the per-step results below.`
34
- : "See the per-step results below.",
35
- ].join("\n")
36
- : undefined,
37
- mutationEvidenceText: mutations > 0
38
- ? `Mutation evidence: ${mutations} action result${mutations === 1 ? " proves" : "s prove"} dispatch only, not application state change. Use explicit later assertions or external receipts as postconditions; fixed waits are not postconditions.`
39
- : undefined,
40
- };
41
- }
42
- export function formatBatchStatusText(steps, status, modelVisible) {
43
- return [
44
- status.header,
45
- status.mutationEvidenceText,
46
- modelVisible === false ? "" : formatBatchStepsText(steps),
47
- ]
48
- .filter((line) => line !== undefined)
49
- .join("\n\n");
50
- }
51
- export function serializeBatchData(steps) {
52
- return steps.map(({ details }) => details.success
53
- ? { command: details.command, result: details.data, success: true }
54
- : {
55
- command: details.command,
56
- error: details.text,
57
- ...(details.command?.[0] === "record" ? { result: details.data } : {}),
58
- success: false,
59
- });
60
- }
61
- function formatBatchChangeText(observed, unverified) {
62
- if (observed === 0) {
63
- return `batch → ${unverified} action${unverified === 1 ? "" : "s"} dispatched → application change unverified`;
64
- }
65
- return `batch → ${observed} observed change${observed === 1 ? "" : "s"}${unverified > 0 ? `; ${unverified} dispatched action${unverified === 1 ? "" : "s"} unverified` : ""}`;
66
- }
67
- export function buildBatchPageChangeSummary(steps, artifacts, nextActions, summary) {
68
- if (artifacts.length > 0) {
69
- return buildPageChangeSummary({
70
- artifacts,
71
- commandInfo: { command: "batch" },
72
- data: serializeBatchData(steps),
73
- nextActions,
74
- summary,
75
- });
76
- }
77
- const changed = steps
78
- .map((step) => step.details)
79
- .filter((details) => details.pageChangeSummary !== undefined);
80
- if (changed.length === 0) {
81
- return undefined;
82
- }
83
- const observed = changed.filter((details) => details.pageChangeSummary?.observed === true).length;
84
- return {
85
- changeType: "mutation",
86
- command: "batch",
87
- nextActionIds: nextActions?.map((action) => action.id),
88
- observed: observed > 0,
89
- summary: formatBatchChangeText(observed, countUnverifiedMutations(steps)),
90
- };
91
- }
@@ -1,123 +0,0 @@
1
- import { extractUpstreamCommandTokens } from "../../argv-descriptor.js";
2
- import { isRecord } from "../../parsing.js";
3
- import { buildAgentBrowserNextActions } from "../action-recommendations.js";
4
- import { formatSessionArtifactRetentionSummary } from "../artifact-manifest.js";
5
- import { applyNetworkRouteRecords } from "../network-routes.js";
6
- import { appendUniqueAgentBrowserNextActions, applyNamespaceToNextActions, } from "../next-actions.js";
7
- import { buildArtifactVerificationSummary, classifyPresentationSuccessCategory, manifestHasNewNoticeWorthyEntries, } from "./artifacts.js";
8
- import { getPresentationImages, getPresentationPaths, isStringArray } from "./content.js";
9
- import { buildBatchStepPresentation } from "./batch-step.js";
10
- import { coalesceTerminalBatchRecordingArtifacts } from "./batch-recording.js";
11
- import { buildBatchPageChangeSummary, formatBatchStatusText, serializeBatchData, summarizeBatchStatus, } from "./batch-summary.js";
12
- export { redactBatchStepErrorData } from "./batch-redaction.js";
13
- export function isAgentBrowserBatchResultArray(value) {
14
- return (Array.isArray(value) &&
15
- value.every((row) => isRecord(row) &&
16
- (row.command === undefined || isStringArray(row.command)) &&
17
- (row.success === undefined || typeof row.success === "boolean")));
18
- }
19
- async function collectPresentedSteps(options) {
20
- const steps = [];
21
- const protectedPaths = [];
22
- let manifest = options.artifactManifest;
23
- let routes = options.networkRoutes;
24
- for (const [index, item] of options.data.entries()) {
25
- // Each row updates artifact protection/manifest and route state required by the following row.
26
- // oxlint-disable-next-line no-await-in-loop
27
- const step = await buildBatchStepPresentation({
28
- modelVisible: options.modelVisible,
29
- artifactManifest: manifest,
30
- artifactMaxUpdatedAtMs: options.artifactMaxUpdatedAtMs,
31
- artifactMinUpdatedAtMs: options.artifactMinUpdatedAtMs,
32
- artifactRequest: options.artifactRequests?.[index],
33
- buildNestedToolPresentation: options.buildNestedToolPresentation,
34
- cwd: options.cwd,
35
- index,
36
- item,
37
- piCleanupOwnership: options.piCleanupOwnership,
38
- namespace: options.namespace,
39
- networkRoutes: routes,
40
- persistentArtifactStore: options.persistentArtifactStore
41
- ? { ...options.persistentArtifactStore, protectedPaths }
42
- : undefined,
43
- sessionName: options.sessionName,
44
- });
45
- steps.push(step);
46
- manifest = step.presentation.artifactManifest ?? manifest;
47
- routes = applyNetworkRouteRecords(routes, isStringArray(item.command) ? extractUpstreamCommandTokens(item.command) : undefined, item.success !== false && step.details.success);
48
- protectedPaths.push(...getPresentationPaths({
49
- primaryPath: step.presentation.fullOutputPath,
50
- secondaryPaths: step.presentation.fullOutputPaths,
51
- }));
52
- }
53
- return { steps, manifest };
54
- }
55
- export async function buildBatchPresentation(options) {
56
- const { steps, manifest } = await collectPresentedSteps(options);
57
- const status = summarizeBatchStatus(steps, options.summary);
58
- const artifacts = await coalesceTerminalBatchRecordingArtifacts(steps, options.sessionName, options.namespace);
59
- const artifactVerification = buildArtifactVerificationSummary(artifacts);
60
- const paths = collectBatchOutputPaths(steps);
61
- const text = formatBatchStatusText(steps, status, options.modelVisible);
62
- const artifactRetentionSummary = manifest
63
- ? formatSessionArtifactRetentionSummary(manifest)
64
- : undefined;
65
- const contentText = addRetentionNotice(text, artifactRetentionSummary, options.artifactManifest, manifest);
66
- const lifecycleActions = applyNamespaceToNextActions(buildAgentBrowserNextActions({
67
- artifacts,
68
- command: "batch",
69
- resultCategory: status.failure ? "failure" : "success",
70
- sessionName: options.sessionName,
71
- }), options.namespace);
72
- const nextActions = status.failure
73
- ? appendUniqueAgentBrowserNextActions([...(status.failure.failedStep.nextActions ?? [])], lifecycleActions)
74
- : lifecycleActions;
75
- return {
76
- artifactManifest: manifest,
77
- artifactRetentionSummary,
78
- artifactVerification,
79
- artifacts: artifacts.length > 0 ? artifacts : undefined,
80
- batchFailure: status.failure,
81
- batchSteps: steps.map((step) => step.details),
82
- content: options.modelVisible === false
83
- ? []
84
- : [
85
- { type: "text", text: contentText },
86
- ...steps.flatMap((step) => getPresentationImages(step.presentation)),
87
- ],
88
- failureCategory: status.failure?.failedStep.failureCategory,
89
- data: serializeBatchData(steps),
90
- ...paths,
91
- imageObservations: steps.flatMap((step) => step.presentation.imageObservations ?? []),
92
- nextActions,
93
- pageChangeSummary: buildBatchPageChangeSummary(steps, artifacts, nextActions, status.summary),
94
- resultCategory: status.failure ? "failure" : "success",
95
- successCategory: status.failure
96
- ? undefined
97
- : classifyPresentationSuccessCategory({ artifactVerification, artifacts }),
98
- summary: status.summary,
99
- };
100
- }
101
- function collectBatchOutputPaths(steps) {
102
- const fullOutputPaths = steps.flatMap((step) => getPresentationPaths({
103
- primaryPath: step.presentation.fullOutputPath,
104
- secondaryPaths: step.presentation.fullOutputPaths,
105
- }));
106
- const imagePaths = steps.flatMap((step) => getPresentationPaths({
107
- primaryPath: step.presentation.imagePath,
108
- secondaryPaths: step.presentation.imagePaths,
109
- }));
110
- return {
111
- fullOutputPath: fullOutputPaths.at(0),
112
- fullOutputPaths: fullOutputPaths.length > 0 ? fullOutputPaths : undefined,
113
- imagePath: imagePaths.at(0),
114
- imagePaths: imagePaths.length > 0 ? imagePaths : undefined,
115
- };
116
- }
117
- function addRetentionNotice(text, notice, original, current) {
118
- return notice !== undefined &&
119
- notice.length > 0 &&
120
- manifestHasNewNoticeWorthyEntries(original, current)
121
- ? `${text}\n\n${notice}`
122
- : text;
123
- }