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
@@ -1,133 +0,0 @@
1
- import { isRecord } from "../parsing.js";
2
- function finiteNonnegative(value) {
3
- return typeof value === "number" && Number.isFinite(value) && value >= 0;
4
- }
5
- function safeCount(value) {
6
- return finiteNonnegative(value) && Number.isSafeInteger(value);
7
- }
8
- function optionalStrings(value, keys) {
9
- return keys.every((key) => value[key] === undefined || typeof value[key] === "string");
10
- }
11
- function nullableStrings(value, keys) {
12
- return keys.every((key) => value[key] === null || typeof value[key] === "string");
13
- }
14
- function nullableNumbers(value, keys) {
15
- return keys.every((key) => value[key] === null || finiteNonnegative(value[key]));
16
- }
17
- function nullableBoolean(value) {
18
- return value === null || typeof value === "boolean";
19
- }
20
- function captureIsValid(value) {
21
- return (nullableStrings(value, [
22
- "startedAt",
23
- "endedAt",
24
- "firstFrameAt",
25
- "lastFrameAt",
26
- "timestampSource",
27
- ]) &&
28
- nullableNumbers(value, [
29
- "durationMs",
30
- "firstFrameAfterMs",
31
- "lastFrameAfterMs",
32
- "averageFps",
33
- "maxFrameGapMs",
34
- ]));
35
- }
36
- function outputIsValid(value) {
37
- return (nullableStrings(value, ["durationSource"]) &&
38
- nullableNumbers(value, [
39
- "frames",
40
- "fps",
41
- "encodedFrames",
42
- "durationMs",
43
- "heldFrames",
44
- "droppedFrames",
45
- "skippedFrames",
46
- ]) &&
47
- nullableBoolean(value.encoderSucceeded));
48
- }
49
- function recordingIsValid(value) {
50
- if (!isRecord(value) ||
51
- !isRecord(value.capture) ||
52
- !isRecord(value.output) ||
53
- !isRecord(value.file)) {
54
- return false;
55
- }
56
- return (recordingScalarsAreValid(value) &&
57
- captureIsValid(value.capture) &&
58
- outputIsValid(value.output) &&
59
- nullableBoolean(value.file.exists) &&
60
- nullableNumbers(value.file, ["sizeBytes"]));
61
- }
62
- function recordingScalarsAreValid(value) {
63
- return (typeof value.warning === "string" &&
64
- typeof value.path === "string" &&
65
- nullableStrings(value, ["recordingId", "error"]) &&
66
- nullableBoolean(value.success) &&
67
- nullableNumbers(value, ["frames", "capturedFrames", "fps"]));
68
- }
69
- function optionalNumbersAreValid(value) {
70
- return (["evictedAtMs", "recordingStartedAtMs"].every((key) => value[key] === undefined || (typeof value[key] === "number" && Number.isFinite(value[key]))) &&
71
- (value.sizeBytes === undefined || finiteNonnegative(value.sizeBytes)));
72
- }
73
- function optionalRecordingIsValid(value) {
74
- return ((value.recordingState === undefined || value.recordingState === "openRecording") &&
75
- (value.recording === undefined || recordingIsValid(value.recording)) &&
76
- (value.status === undefined ||
77
- [
78
- "failed",
79
- "missing",
80
- "pending",
81
- "repaired-from-temp",
82
- "saved",
83
- "stale",
84
- "unverified",
85
- "upstream-temp-only",
86
- ].some((status) => status === value.status)));
87
- }
88
- function optionalEvidenceIsValid(value) {
89
- return (optionalStrings(value, [
90
- "absolutePath",
91
- "command",
92
- "cwd",
93
- "extension",
94
- "mediaType",
95
- "namespace",
96
- "requestedPath",
97
- "session",
98
- "subcommand",
99
- ]) &&
100
- (value.exists === undefined || typeof value.exists === "boolean") &&
101
- optionalNumbersAreValid(value) &&
102
- optionalRecordingIsValid(value));
103
- }
104
- function isManifestEntry(value) {
105
- if (!isRecord(value)) {
106
- return false;
107
- }
108
- return (typeof value.path === "string" &&
109
- value.path.trim().length > 0 &&
110
- typeof value.createdAtMs === "number" &&
111
- Number.isFinite(value.createdAtMs) &&
112
- ["evicted", "ephemeral", "live", "missing"].some((state) => state === value.retentionState) &&
113
- ["explicit-path", "persistent-session", "process-temp"].some((scope) => scope === value.storageScope) &&
114
- ["download", "file", "har", "image", "pdf", "profile", "trace", "video", "spill"].some((kind) => kind === value.kind) &&
115
- optionalEvidenceIsValid(value));
116
- }
117
- function manifestCountsAreValid(value) {
118
- return (safeCount(value.maxEntries) &&
119
- value.maxEntries !== 0 &&
120
- safeCount(value.liveCount) &&
121
- safeCount(value.evictedCount));
122
- }
123
- export function isSessionArtifactManifest(value) {
124
- if (!isRecord(value)) {
125
- return false;
126
- }
127
- return (value.version === 1 &&
128
- Array.isArray(value.entries) &&
129
- value.entries.every(isManifestEntry) &&
130
- typeof value.updatedAtMs === "number" &&
131
- Number.isFinite(value.updatedAtMs) &&
132
- manifestCountsAreValid(value));
133
- }
@@ -1,173 +0,0 @@
1
- import { getAgentBrowserSessionIdentityKey } from "../argv-grammar.js";
2
- export { isSessionArtifactManifest } from "./artifact-manifest-validation.js";
3
- export function isPendingRecordingCommand(command, subcommand, kind) {
4
- return (command === "record" && (subcommand === "start" || subcommand === "restart") && kind === "video");
5
- }
6
- export function isPendingRecordingArtifact(artifact) {
7
- return (artifact.recordingState === "openRecording" ||
8
- artifact.status === "pending" ||
9
- (artifact.status === undefined &&
10
- isPendingRecordingCommand(artifact.command, artifact.subcommand, artifact.kind)));
11
- }
12
- const SESSION_ARTIFACT_MANIFEST_VERSION = 1;
13
- const SESSION_ARTIFACT_MANIFEST_MAX_ENTRIES_ENV = "PI_AGENT_BROWSER_SESSION_ARTIFACT_MANIFEST_MAX_ENTRIES";
14
- export const DEFAULT_SESSION_ARTIFACT_MANIFEST_MAX_ENTRIES = 100;
15
- function parsePositiveSafeInteger(value) {
16
- if (value === undefined) {
17
- return undefined;
18
- }
19
- const parsed = Number(value);
20
- if (!Number.isSafeInteger(parsed) || parsed <= 0) {
21
- return undefined;
22
- }
23
- return parsed;
24
- }
25
- export function getSessionArtifactManifestMaxEntries(env = process.env) {
26
- return (parsePositiveSafeInteger(env[SESSION_ARTIFACT_MANIFEST_MAX_ENTRIES_ENV]) ??
27
- DEFAULT_SESSION_ARTIFACT_MANIFEST_MAX_ENTRIES);
28
- }
29
- export function buildEvictedSessionArtifactEntries(evictedArtifacts, nowMs) {
30
- return evictedArtifacts.map((artifact) => ({
31
- createdAtMs: artifact.mtimeMs,
32
- evictedAtMs: nowMs,
33
- kind: "spill",
34
- path: artifact.path,
35
- retentionState: "evicted",
36
- sizeBytes: artifact.sizeBytes,
37
- storageScope: "persistent-session",
38
- }));
39
- }
40
- export function formatSessionArtifactRetentionSummary(manifest) {
41
- const ephemeralCount = manifest.entries.filter((entry) => entry.retentionState === "ephemeral").length;
42
- const missingCount = manifest.entries.filter((entry) => entry.retentionState === "missing").length;
43
- const parts = [`${manifest.liveCount} live`, `${manifest.evictedCount} evicted`];
44
- if (ephemeralCount > 0) {
45
- parts.push(`${ephemeralCount} ephemeral`);
46
- }
47
- if (missingCount > 0) {
48
- parts.push(`${missingCount} missing`);
49
- }
50
- return `Session artifacts: ${parts.join(", ")} (${manifest.entries.length}/${manifest.maxEntries} recent).`;
51
- }
52
- export function getSessionArtifactManifestEntryKey(entry) {
53
- const pathKey = entry.storageScope === "explicit-path" &&
54
- entry.absolutePath !== undefined &&
55
- entry.absolutePath.length > 0
56
- ? `${entry.storageScope}:${entry.absolutePath}`
57
- : `${entry.storageScope}:${entry.path}`;
58
- const recordingSessionKey = entry.command === "record" &&
59
- entry.kind === "video" &&
60
- entry.session !== undefined &&
61
- entry.session.length > 0
62
- ? getAgentBrowserSessionIdentityKey(entry.session, entry.namespace)
63
- : undefined;
64
- return recordingSessionKey !== undefined && recordingSessionKey.length > 0
65
- ? `${pathKey}\0${recordingSessionKey}`
66
- : pathKey;
67
- }
68
- export function retirePendingRecordingManifestEntries(manifest, sessionName, namespace, nowMs = Date.now()) {
69
- const sessionKey = sessionName !== undefined && sessionName.length > 0
70
- ? getAgentBrowserSessionIdentityKey(sessionName, namespace)
71
- : undefined;
72
- const entries = manifest.entries.map((entry) => {
73
- if (sessionKey === undefined ||
74
- sessionKey.length === 0 ||
75
- entry.session === undefined ||
76
- entry.session.length === 0 ||
77
- getAgentBrowserSessionIdentityKey(entry.session, entry.namespace) !== sessionKey ||
78
- entry.kind !== "video" ||
79
- !isPendingRecordingArtifact(entry)) {
80
- return entry;
81
- }
82
- return {
83
- ...entry,
84
- recordingState: undefined,
85
- status: "unverified",
86
- subcommand: "close-abandoned",
87
- };
88
- });
89
- if (entries.every((entry, index) => entry === manifest.entries[index])) {
90
- return manifest;
91
- }
92
- return {
93
- ...manifest,
94
- entries,
95
- evictedCount: entries.filter((entry) => entry.retentionState === "evicted").length,
96
- liveCount: entries.filter((entry) => entry.retentionState === "live").length,
97
- updatedAtMs: nowMs,
98
- };
99
- }
100
- function getSupersededRecordingKeys(candidates, entry, key) {
101
- if (entry.command !== "record" || entry.kind !== "video") {
102
- return [];
103
- }
104
- const entrySessionKey = entry.session !== undefined && entry.session.length > 0
105
- ? getAgentBrowserSessionIdentityKey(entry.session, entry.namespace)
106
- : undefined;
107
- return candidates
108
- .filter(([candidateKey, candidate]) => {
109
- const sameRecordingSession = entrySessionKey === undefined
110
- ? candidate.session === undefined
111
- : candidate.session !== undefined &&
112
- getAgentBrowserSessionIdentityKey(candidate.session, candidate.namespace) ===
113
- entrySessionKey;
114
- return (candidateKey !== key &&
115
- sameRecordingSession &&
116
- candidate.kind === "video" &&
117
- isPendingRecordingArtifact(candidate));
118
- })
119
- .map(([candidateKey]) => candidateKey);
120
- }
121
- function mergeManifestEntry(existing, entry, nowMs) {
122
- return {
123
- ...existing,
124
- ...entry,
125
- createdAtMs: entry.command === "record" && entry.kind === "video"
126
- ? entry.createdAtMs
127
- : (existing?.createdAtMs ?? entry.createdAtMs),
128
- evictedAtMs: entry.retentionState === "evicted" ? (entry.evictedAtMs ?? nowMs) : entry.evictedAtMs,
129
- };
130
- }
131
- function compareManifestEntries(left, right) {
132
- const difference = (right.evictedAtMs ?? right.createdAtMs) - (left.evictedAtMs ?? left.createdAtMs);
133
- if (difference !== 0 && !Number.isNaN(difference)) {
134
- return difference;
135
- }
136
- const pendingDifference = Number(isPendingRecordingArtifact(right)) - Number(isPendingRecordingArtifact(left));
137
- return pendingDifference !== 0 ? pendingDifference : left.path.localeCompare(right.path);
138
- }
139
- export function mergeSessionArtifactManifest(options) {
140
- const nowMs = options.nowMs ?? Date.now();
141
- const maxEntries = getSessionArtifactManifestMaxEntries();
142
- const byPath = new Map();
143
- for (const entry of options.base?.entries ?? []) {
144
- byPath.set(getSessionArtifactManifestEntryKey(entry), entry);
145
- }
146
- const orderedEntries = (options.entries ?? [])
147
- .map((entry, index) => ({ entry, index }))
148
- .sort((left, right) => {
149
- const difference = left.entry.createdAtMs - right.entry.createdAtMs;
150
- return difference !== 0 && !Number.isNaN(difference) ? difference : left.index - right.index;
151
- })
152
- .map(({ entry }) => entry);
153
- for (const entry of orderedEntries) {
154
- const key = getSessionArtifactManifestEntryKey(entry);
155
- for (const candidateKey of getSupersededRecordingKeys([...byPath], entry, key)) {
156
- byPath.delete(candidateKey);
157
- }
158
- const existing = byPath.get(key);
159
- byPath.set(key, mergeManifestEntry(existing, entry, nowMs));
160
- }
161
- if (byPath.size === 0) {
162
- return undefined;
163
- }
164
- const entries = [...byPath.values()].sort(compareManifestEntries).slice(0, maxEntries);
165
- return {
166
- entries,
167
- evictedCount: entries.filter((entry) => entry.retentionState === "evicted").length,
168
- liveCount: entries.filter((entry) => entry.retentionState === "live").length,
169
- maxEntries,
170
- updatedAtMs: nowMs,
171
- version: SESSION_ARTIFACT_MANIFEST_VERSION,
172
- };
173
- }
@@ -1,73 +0,0 @@
1
- import { isPendingRecordingArtifact } from "./artifact-manifest.js";
2
- import { buildNextToolAction } from "./next-actions.js";
3
- function buildArtifactAction(path) {
4
- return {
5
- artifactPath: path,
6
- id: "use-saved-artifact",
7
- reason: "Use the saved artifact path from the structured result instead of scraping it from text.",
8
- safety: "Verify artifact metadata such as exists/status before treating the file as durable.",
9
- tool: "agent_browser",
10
- };
11
- }
12
- function buildArtifactVerificationAction(artifact) {
13
- return {
14
- artifactPath: artifact.path,
15
- id: "verify-artifact-path",
16
- reason: "The wrapper has artifact metadata but did not verify this file as present on disk.",
17
- safety: "Check details.artifactVerification and the filesystem before treating the artifact as durable.",
18
- tool: "agent_browser",
19
- };
20
- }
21
- function buildMissingArtifactAction(artifact, afterFailure) {
22
- if (artifact.kind !== "download") {
23
- return buildArtifactVerificationAction(artifact);
24
- }
25
- return buildNextToolAction({
26
- args: ["wait", "--download", artifact.path],
27
- id: "wait-for-download",
28
- reason: afterFailure
29
- ? "The requested download artifact was not found on disk after upstream reported completion."
30
- : "Upstream reported a download path, but the wrapper did not verify the file on disk.",
31
- safety: "Use an explicit wait timeout; if you set top-level timeoutMs, keep it above the wait duration plus a small grace window.",
32
- });
33
- }
34
- export function buildSavedArtifactNextActions(options) {
35
- const artifacts = options.artifacts ?? [];
36
- const savedFilePath = options.savedFilePath;
37
- const actions = [];
38
- if (savedFilePath !== undefined &&
39
- savedFilePath.length > 0 &&
40
- artifacts.find((artifact) => artifact.path === savedFilePath)?.exists !== false) {
41
- actions.push(buildArtifactAction(savedFilePath));
42
- }
43
- for (const artifact of artifacts) {
44
- if (isPendingRecordingArtifact(artifact)) {
45
- continue;
46
- }
47
- if (artifact.exists === false) {
48
- actions.push(buildMissingArtifactAction(artifact, false));
49
- }
50
- else if (artifact.path !== savedFilePath) {
51
- actions.push(buildArtifactAction(artifact.path));
52
- }
53
- }
54
- return actions;
55
- }
56
- export function buildMissingArtifactNextActions(artifacts) {
57
- return (artifacts ?? [])
58
- .filter((artifact) => !isPendingRecordingArtifact(artifact) &&
59
- (artifact.exists === false || artifact.status === "stale"))
60
- .map((artifact) => buildMissingArtifactAction(artifact, true));
61
- }
62
- export function buildPendingRecordingNextActions(artifacts) {
63
- return (artifacts ?? []).some(isPendingRecordingArtifact)
64
- ? [
65
- buildNextToolAction({
66
- args: ["record", "stop"],
67
- id: "stop-pending-recording",
68
- reason: "Stop the active recording so the requested video can be finalized and verified on disk.",
69
- safety: "The file remains pending until record stop succeeds; verify details.artifactVerification afterward.",
70
- }),
71
- ]
72
- : [];
73
- }
@@ -1,152 +0,0 @@
1
- import { isPendingRecordingArtifact } from "./artifact-manifest.js";
2
- function hasUnverifiedFileArtifact(artifacts) {
3
- return (artifacts ?? []).some((artifact) => !isPendingRecordingArtifact(artifact) &&
4
- (artifact.exists !== true ||
5
- ["failed", "stale", "unverified"].includes(artifact.status ?? "")));
6
- }
7
- export function classifyAgentBrowserSuccessCategory(options) {
8
- if (options.inspection === true) {
9
- return "inspection";
10
- }
11
- if (hasUnverifiedFileArtifact(options.artifacts)) {
12
- return "artifact-unverified";
13
- }
14
- if ((options.artifacts ?? []).some(isPendingRecordingArtifact)) {
15
- return "artifact-pending";
16
- }
17
- return (options.artifacts ?? []).length > 0 || options.savedFile !== undefined
18
- ? "artifact-saved"
19
- : "completed";
20
- }
21
- function hasScopedNamesSeen(text, command) {
22
- return (/\bNames seen:/i.test(text) &&
23
- (command === "find" || /\belement has role\b|\bnone match name\b|\bgetByRole\b/i.test(text)));
24
- }
25
- function isUpstreamLocatorMiss(text, command) {
26
- return (/\bNo element found:\s*(?:getBy[A-Za-z]+|role=|text=|label=|placeholder=|alt=|title=|testid=)/i.test(text) ||
27
- (/\bElement not found:/i.test(text) && /\bVerify the selector, role, or name\b/i.test(text)) ||
28
- /\bnone match name\b/i.test(text) ||
29
- hasScopedNamesSeen(text, command) ||
30
- /\belement has role\b[\s\S]*\bnone match\b/i.test(text));
31
- }
32
- function classifyNativeFailure(context) {
33
- const { options, text, command } = context;
34
- // Explicit native flags and prefixes win over accessible-name text and lastUrl substrings.
35
- if (options.confirmationRequired === true) {
36
- return "confirmation-required";
37
- }
38
- if (/\btab_gone:/i.test(text)) {
39
- return "tab-gone";
40
- }
41
- if (isUpstreamLocatorMiss(text, command)) {
42
- return "selector-not-found";
43
- }
44
- if (/confirmation required|pending confirmation|requires confirmation/i.test(text)) {
45
- return "confirmation-required";
46
- }
47
- return undefined;
48
- }
49
- function classifyProcessFailure(context) {
50
- const { options, text } = context;
51
- // Bare "timeout" may be an accessible name; require actual timeout phrasing.
52
- if (options.timedOut === true ||
53
- /\b(?:timed\s+out|timeout exceeded|watchdog|IPC read timeout)\b|must stay under its 30s IPC read timeout|Operation timed out/i.test(text)) {
54
- return "timeout";
55
- }
56
- if (/ENOENT|not found on PATH|could not find.*agent-browser|agent-browser is required but was not found/i.test(text)) {
57
- return "missing-binary";
58
- }
59
- if ((options.parseError ?? "") !== "" ||
60
- /invalid JSON|missing boolean success|success field must be boolean|returned no JSON output/i.test(text)) {
61
- return "parse-failure";
62
- }
63
- if (/aborted/i.test(text)) {
64
- return "aborted";
65
- }
66
- return undefined;
67
- }
68
- function classifyLifecycleFailure(context) {
69
- const { options, text } = context;
70
- if (/policy[- ]blocked|blocked by caller policy|caller deny policy|caller allow policy/i.test(text)) {
71
- return "policy-blocked";
72
- }
73
- if (/cleanup failed|cleanup.*partial|partial cleanup|remaining resources/i.test(text)) {
74
- return "cleanup-failed";
75
- }
76
- if ((options.validationError ?? "") !== "" ||
77
- /Agent-browser Unix socket path would be|Agent-browser socket storage .* is unusable/i.test(text)) {
78
- return "validation-error";
79
- }
80
- if (options.tabDrift === true ||
81
- /could not re-select the intended tab|about:blank|selected tab looks wrong|tab drift|tab.*wrong/i.test(text)) {
82
- return "tab-drift";
83
- }
84
- return undefined;
85
- }
86
- function reportsSelectorMatchFailure(text) {
87
- return (/\b(?:no elements? found|failed to find|could not find|unable to find)\b.*\b(?:selector|locator)\b/i.test(text) ||
88
- /\b(?:selector|locator)\b.*\b(?:no elements? found|not found|missing|failed to find|could not find|unable to find)\b/i.test(text));
89
- }
90
- function reportsUnsupportedSelector(text) {
91
- return (/\b(?:unsupported|unknown|invalid)\s+(?:selector|locator)\b/i.test(text) ||
92
- /\bfailed to parse selector\b/i.test(text) ||
93
- /\bselector\b.*\b(?:parse|syntax|unsupported|invalid)\b/i.test(text) ||
94
- (/(?:\btext=|:has-text\(|\bgetByRole\b|\bgetByText\b)/i.test(text) &&
95
- reportsSelectorMatchFailure(text)));
96
- }
97
- function classifySelectorFailure(context) {
98
- const { options, text, command } = context;
99
- if (/\bUnknown ref\b|\bstale ref\b|@ref may be stale|\bref\b.*\b(?:not found|missing|expired)\b/i.test(text)) {
100
- return "stale-ref";
101
- }
102
- const usedRef = options.args?.some((arg) => /^@e\d+\b/.test(arg)) ?? false;
103
- if (usedRef && /could not locate element|element not found|no element/i.test(text)) {
104
- return "stale-ref";
105
- }
106
- if (reportsUnsupportedSelector(text)) {
107
- return "selector-unsupported";
108
- }
109
- if (command === "find" &&
110
- /could not locate element|element not found|no elements? found|unable to find/i.test(text)) {
111
- return "selector-not-found";
112
- }
113
- return reportsSelectorMatchFailure(text) ? "selector-not-found" : undefined;
114
- }
115
- function classifyDownloadFailure(context) {
116
- const { text, command } = context;
117
- return (command === "download" ||
118
- text.includes("wait --download") ||
119
- /\bdownload\b/i.test(text)) &&
120
- /missing|not verified|not found|failed|timeout|timed out/i.test(text)
121
- ? "download-not-verified"
122
- : "upstream-error";
123
- }
124
- export function classifyAgentBrowserFailureCategory(options) {
125
- const text = [
126
- options.errorText,
127
- options.validationError,
128
- options.parseError,
129
- options.spawnError,
130
- options.stderr,
131
- ]
132
- .filter(Boolean)
133
- .join("\n");
134
- const context = { options, text, command: options.command ?? "" };
135
- return (classifyNativeFailure(context) ??
136
- classifyProcessFailure(context) ??
137
- classifyLifecycleFailure(context) ??
138
- classifySelectorFailure(context) ??
139
- classifyDownloadFailure(context));
140
- }
141
- export function buildAgentBrowserResultCategoryDetails(options) {
142
- if (options.succeeded) {
143
- return {
144
- resultCategory: "success",
145
- successCategory: classifyAgentBrowserSuccessCategory(options),
146
- };
147
- }
148
- return {
149
- failureCategory: options.failureCategory ?? classifyAgentBrowserFailureCategory(options),
150
- resultCategory: "failure",
151
- };
152
- }
@@ -1,75 +0,0 @@
1
- import { isRecord } from "../parsing.js";
2
- const CONFIRMATION_REQUIRED_FIELD_NAMES = [
3
- "confirmation_required",
4
- "confirmationRequired",
5
- "requires_confirmation",
6
- "requiresConfirmation",
7
- ];
8
- const CONFIRMATION_REQUIRED_RECORD_FIELD_NAMES = [
9
- "confirmation",
10
- "pendingConfirmation",
11
- "pending_confirmation",
12
- ];
13
- const CONFIRMATION_ID_FIELD_NAMES = ["confirmation_id", "confirmationId", "id"];
14
- const CONFIRMATION_ACTION_TEXT_FIELD_NAMES = [
15
- "action",
16
- "description",
17
- "message",
18
- "summary",
19
- ];
20
- const CONFIRMATION_REQUIRED_MARKER = "confirmation_required";
21
- function getTrimmedStringField(data, fieldNames) {
22
- for (const fieldName of fieldNames) {
23
- const value = data[fieldName];
24
- if (typeof value === "string" && value.trim().length > 0) {
25
- return value.trim();
26
- }
27
- }
28
- return undefined;
29
- }
30
- function hasConfirmationRequiredMarker(data) {
31
- return (CONFIRMATION_REQUIRED_FIELD_NAMES.some((fieldName) => data[fieldName] === true) ||
32
- data.type === CONFIRMATION_REQUIRED_MARKER ||
33
- data.status === CONFIRMATION_REQUIRED_MARKER ||
34
- data.kind === CONFIRMATION_REQUIRED_MARKER);
35
- }
36
- function getNestedConfirmationRecord(data) {
37
- for (const fieldName of CONFIRMATION_REQUIRED_RECORD_FIELD_NAMES) {
38
- const value = data[fieldName];
39
- if (isRecord(value)) {
40
- return value;
41
- }
42
- }
43
- return undefined;
44
- }
45
- function getConfirmationPayload(data) {
46
- // Native confirm can acknowledge one action while its original compound command remains pending.
47
- return isRecord(data) &&
48
- data.confirmed === true &&
49
- isRecord(data.result) &&
50
- data.result.success === true
51
- ? data.result.data
52
- : data;
53
- }
54
- export function detectConfirmationRequired(data) {
55
- const payload = getConfirmationPayload(data);
56
- if (!isRecord(payload)) {
57
- return undefined;
58
- }
59
- const nestedRecord = getNestedConfirmationRecord(payload);
60
- const candidateRecords = nestedRecord ? [payload, nestedRecord] : [payload];
61
- if (!candidateRecords.some(hasConfirmationRequiredMarker)) {
62
- return undefined;
63
- }
64
- for (const record of candidateRecords) {
65
- const id = getTrimmedStringField(record, CONFIRMATION_ID_FIELD_NAMES);
66
- if (id === undefined || id.length === 0) {
67
- continue;
68
- }
69
- return {
70
- actionText: getTrimmedStringField(record, CONFIRMATION_ACTION_TEXT_FIELD_NAMES),
71
- id,
72
- };
73
- }
74
- return undefined;
75
- }