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,166 +0,0 @@
1
- import { isRecord } from "./parsing.js";
2
- import { isBrowserStringArray } from "./browser-value-parsing.js";
3
- import { isSessionArtifactManifest } from "./results/artifact-manifest.js";
4
- import { normalizeSessionTabTarget, } from "./session-page-observation.js";
5
- function validRefText(value) {
6
- return ((value.role === undefined || typeof value.role === "string") &&
7
- (value.name === undefined || typeof value.name === "string"));
8
- }
9
- function validRefFlags(value) {
10
- return ((value.isEditable === undefined || typeof value.isEditable === "boolean") &&
11
- (value.isContentEditable === undefined || typeof value.isContentEditable === "boolean"));
12
- }
13
- export function isBrowserSnapshotReference(value) {
14
- return isRecord(value) && validRefText(value) && validRefFlags(value);
15
- }
16
- export function isNamedBrowserSnapshotReference(value) {
17
- return (isBrowserSnapshotReference(value) &&
18
- typeof value.name === "string" &&
19
- typeof value.role === "string");
20
- }
21
- function invalidEvent() {
22
- throw new Error("Invalid browser event; inspect or convert the retained session before browser work.");
23
- }
24
- function invalidPage() {
25
- throw new Error("Invalid browser page disposition; refs cannot be restored.");
26
- }
27
- function parseInvalidation(value) {
28
- if (value === undefined) {
29
- return undefined;
30
- }
31
- if (!isRecord(value) ||
32
- (value.reason !== "page-transition" && value.reason !== "no-active-page") ||
33
- typeof value.summary !== "string") {
34
- return invalidPage();
35
- }
36
- return { ...value, reason: value.reason, summary: value.summary };
37
- }
38
- function parseRefs(value) {
39
- if (!isRecord(value)) {
40
- return invalidPage();
41
- }
42
- if (value.kind === "reuse" || value.kind === "replace") {
43
- if (typeof value.snapshotId !== "string" || value.snapshotId.length === 0) {
44
- return invalidPage();
45
- }
46
- return { ...value, kind: value.kind, snapshotId: value.snapshotId };
47
- }
48
- if (value.kind !== "unknown" && value.kind !== "invalidate") {
49
- return invalidPage();
50
- }
51
- const invalidation = parseInvalidation(value.invalidation);
52
- return { ...value, kind: value.kind, ...(invalidation ? { invalidation } : {}) };
53
- }
54
- export function decodeBrowserTarget(value) {
55
- if (!isRecord(value) || typeof value.url !== "string") {
56
- return undefined;
57
- }
58
- if ((value.title !== undefined && typeof value.title !== "string") ||
59
- (value.targetId !== undefined && typeof value.targetId !== "string")) {
60
- return undefined;
61
- }
62
- const target = { ...value, url: value.url };
63
- return normalizeSessionTabTarget(target) === undefined ? undefined : target;
64
- }
65
- function parseBrowserTarget(value) {
66
- if (value === undefined) {
67
- return undefined;
68
- }
69
- return decodeBrowserTarget(value) ?? invalidPage();
70
- }
71
- function pageScalarsValid(value) {
72
- return ((value.confirmActions === undefined ||
73
- value.confirmActions === null ||
74
- typeof value.confirmActions === "string") &&
75
- (value.unknown === undefined || value.unknown === true) &&
76
- (value.clear === undefined || value.clear === true));
77
- }
78
- function pagePolicyValid(value) {
79
- return ((value.reopenPending === undefined || typeof value.reopenPending === "boolean") &&
80
- (value.pinningReason === undefined ||
81
- value.pinningReason === "restore" ||
82
- value.pinningReason === "drift"));
83
- }
84
- function parsePage(value) {
85
- if (!isRecord(value) ||
86
- typeof value.key !== "string" ||
87
- !pageScalarsValid(value) ||
88
- !pagePolicyValid(value)) {
89
- return invalidPage();
90
- }
91
- const target = parseBrowserTarget(value.target);
92
- return { ...value, key: value.key, refs: parseRefs(value.refs), ...(target ? { target } : {}) };
93
- }
94
- function parsePages(value) {
95
- if (value === undefined) {
96
- return undefined;
97
- }
98
- if (!Array.isArray(value)) {
99
- return invalidPage();
100
- }
101
- const pages = value;
102
- return pages.map(parsePage);
103
- }
104
- function parseArtifacts(value) {
105
- if (value === undefined) {
106
- return undefined;
107
- }
108
- if (!isRecord(value) || !isBrowserStringArray(value.removals)) {
109
- throw new Error("Invalid browser artifact changes; inspect the retained journal.");
110
- }
111
- const manifest = {
112
- version: 1,
113
- entries: value.upserts,
114
- maxEntries: value.maxEntries,
115
- updatedAtMs: value.updatedAtMs,
116
- liveCount: 0,
117
- evictedCount: 0,
118
- };
119
- if (!isSessionArtifactManifest(manifest)) {
120
- throw new Error("Invalid browser artifact changes; inspect the retained journal.");
121
- }
122
- return {
123
- ...value,
124
- upserts: manifest.entries,
125
- removals: value.removals,
126
- maxEntries: manifest.maxEntries,
127
- updatedAtMs: manifest.updatedAtMs,
128
- };
129
- }
130
- function eventIdentity(value) {
131
- if (typeof value.operationId !== "string" ||
132
- typeof value.toolCallId !== "string" ||
133
- typeof value.commandIndex !== "number" ||
134
- !Number.isSafeInteger(value.commandIndex) ||
135
- value.commandIndex < 0 ||
136
- typeof value.isError !== "boolean") {
137
- return invalidEvent();
138
- }
139
- return {
140
- operationId: value.operationId,
141
- toolCallId: value.toolCallId,
142
- commandIndex: value.commandIndex,
143
- isError: value.isError,
144
- };
145
- }
146
- export function parseBrowserEvent(value) {
147
- const phase = value.phase;
148
- if (phase !== "begin" && phase !== "finish" && phase !== "state") {
149
- return invalidEvent();
150
- }
151
- if (!isRecord(value.state)) {
152
- return invalidEvent();
153
- }
154
- const identity = eventIdentity(value);
155
- const pages = parsePages(value.pages);
156
- const artifacts = parseArtifacts(value.artifacts);
157
- return {
158
- ...value,
159
- ...identity,
160
- version: 1,
161
- phase,
162
- state: value.state,
163
- ...(pages ? { pages } : {}),
164
- ...(artifacts ? { artifacts } : {}),
165
- };
166
- }
@@ -1,189 +0,0 @@
1
- import { isRecord } from "./parsing.js";
2
- import { redactSensitiveValue } from "./runtime-redaction.js";
3
- import { buildPageTransitionRefSnapshotInvalidation, targetsMatch, } from "./session-page-observation.js";
4
- import { getSessionArtifactManifestEntryKey, isPendingRecordingArtifact, isSessionArtifactManifest, } from "./results/artifact-manifest.js";
5
- import { extractAgentBrowserLifecycle } from "./results/presentation/common.js";
6
- import { BROWSER_TRANSITION_ENTRY, BROWSER_STATE_FIELDS, } from "./browser-transcript-contracts.js";
7
- export { BROWSER_TRANSITION_ENTRY, BROWSER_STATE_FIELDS, BROWSER_RESULT_TOOLS, } from "./browser-transcript-contracts.js";
8
- const BROWSER_EVENT_VERSION = 1;
9
- import { parseBrowserEvent, decodeBrowserTarget, isBrowserSnapshotReference, isNamedBrowserSnapshotReference, } from "./browser-transcript-validation.js";
10
- export function browserStateEffects(details) {
11
- const state = Object.fromEntries(BROWSER_STATE_FIELDS.filter((key) => details[key] !== undefined).map((key) => [
12
- key,
13
- details[key],
14
- ]));
15
- if (Array.isArray(details.batchSteps)) {
16
- state.batchSteps = details.batchSteps.filter(isRecord).map((step) => ({
17
- command: step.command,
18
- success: step.success,
19
- lifecycle: extractAgentBrowserLifecycle(step),
20
- }));
21
- }
22
- if (isRecord(details.electron) &&
23
- (details.electron.launch !== undefined || details.electron.cleanup !== undefined)) {
24
- state.electron = { launch: details.electron.launch, cleanup: details.electron.cleanup };
25
- }
26
- return state;
27
- }
28
- export function getBrowserRecord(entry) {
29
- if (!isRecord(entry) || !isRecord(entry.data)) {
30
- return undefined;
31
- }
32
- if (entry.type !== "message" &&
33
- !(entry.type === "custom" && entry.customType === BROWSER_TRANSITION_ENTRY)) {
34
- return undefined;
35
- }
36
- const event = entry.data.event;
37
- if (!isRecord(event) || event.version !== BROWSER_EVENT_VERSION) {
38
- return undefined;
39
- }
40
- return { ...entry.data, event: parseBrowserEvent(event) };
41
- }
42
- /** Only canonical receipts participate in live replay. Legacy shapes belong to the offline converter. */
43
- export function getBrowserResultMessage(entry) {
44
- const record = getBrowserRecord(entry);
45
- return record
46
- ? {
47
- details: record.event.state,
48
- isError: typeof record.event.state.nativeSucceeded === "boolean"
49
- ? !record.event.state.nativeSucceeded
50
- : record.event.isError,
51
- }
52
- : undefined;
53
- }
54
- export function snapshotDefinition(snapshot) {
55
- if (snapshot.snapshotId === undefined || snapshot.snapshotId.length === 0) {
56
- throw new Error("A snapshot capture must have an identity before publication.");
57
- }
58
- return {
59
- id: snapshot.snapshotId,
60
- refs: Object.fromEntries(snapshot.refIds.map((id) => [id, snapshot.refs?.[id] ?? {}])),
61
- target: snapshot.target,
62
- generation: snapshot.generation,
63
- };
64
- }
65
- function snapshotMetadataValid(definition) {
66
- return ((definition.target === undefined || decodeBrowserTarget(definition.target) !== undefined) &&
67
- (definition.generation === undefined || typeof definition.generation === "string"));
68
- }
69
- export function snapshotFromDefinition(definition) {
70
- if (!isRecord(definition) ||
71
- typeof definition.id !== "string" ||
72
- definition.id.length === 0 ||
73
- !isRecord(definition.refs) ||
74
- !snapshotMetadataValid(definition) ||
75
- !Object.entries(definition.refs).every(([id, ref]) => /^e\d+$/.test(id) && isBrowserSnapshotReference(ref))) {
76
- throw new Error("Missing or invalid browser snapshot definition; take a new complete snapshot before using refs.");
77
- }
78
- const refs = Object.fromEntries(Object.entries(definition.refs).flatMap(([id, ref]) => isNamedBrowserSnapshotReference(ref) ? [[id, ref]] : []));
79
- return {
80
- snapshotId: definition.id,
81
- refIds: Object.keys(definition.refs),
82
- ...(Object.keys(refs).length > 0 ? { refs } : {}),
83
- target: definition.target === undefined ? undefined : decodeBrowserTarget(definition.target),
84
- generation: typeof definition.generation === "string" ? definition.generation : undefined,
85
- };
86
- }
87
- function driftedRefDisposition(page) {
88
- return {
89
- kind: "invalidate",
90
- invalidation: buildPageTransitionRefSnapshotInvalidation(`The saved refs came from a snapshot for ${page.refSnapshot?.target?.url ?? "unknown"}; the current session target is ${page.tabTarget?.url ?? "unknown"}. Take a fresh snapshot before using page-scoped refs.`),
91
- };
92
- }
93
- function pageRefDisposition(page, previousSnapshotId) {
94
- if (page.tabTargetUnknown === true) {
95
- return { kind: "unknown", invalidation: page.refSnapshotInvalidation };
96
- }
97
- if (page.refSnapshot && !targetsMatch(page.refSnapshot.target, page.tabTarget)) {
98
- return driftedRefDisposition(page);
99
- }
100
- const id = page.refSnapshot?.snapshotId;
101
- if (id !== undefined && id.length > 0) {
102
- return { kind: id === previousSnapshotId ? "reuse" : "replace", snapshotId: id };
103
- }
104
- return { kind: "invalidate", invalidation: page.refSnapshotInvalidation };
105
- }
106
- export function pageChange(key, page, previousSnapshotId) {
107
- return {
108
- key,
109
- confirmActions: page.confirmActions ?? null,
110
- target: page.tabTarget,
111
- unknown: page.tabTargetUnknown,
112
- reopenPending: page.tabReopenPending,
113
- pinningReason: page.pinningReason,
114
- refs: pageRefDisposition(page, previousSnapshotId),
115
- };
116
- }
117
- function indexedArtifacts(manifest) {
118
- return new Map((manifest?.entries ?? []).map((row) => [getSessionArtifactManifestEntryKey(row), row]));
119
- }
120
- function redactedArtifact(row) {
121
- const manifest = {
122
- version: 1,
123
- entries: [redactSensitiveValue(row)],
124
- maxEntries: 1,
125
- updatedAtMs: row.createdAtMs,
126
- liveCount: 0,
127
- evictedCount: 0,
128
- };
129
- if (!isSessionArtifactManifest(manifest)) {
130
- throw new Error("Redacted browser artifact has no valid manifest receipt.");
131
- }
132
- return manifest.entries[0];
133
- }
134
- export function artifactChanges(previous, next) {
135
- if (previous === next) {
136
- return undefined;
137
- }
138
- const before = indexedArtifacts(previous);
139
- const after = indexedArtifacts(next);
140
- const upserts = [...after]
141
- .filter(([key, row]) => JSON.stringify(before.get(key)) !== JSON.stringify(row))
142
- .map(([, row]) => redactedArtifact(row));
143
- const removals = [...before.keys()].filter((key) => !after.has(key));
144
- return upserts.length > 0 || removals.length > 0
145
- ? {
146
- upserts,
147
- removals,
148
- maxEntries: (next ?? previous)?.maxEntries ?? 100,
149
- updatedAtMs: next?.updatedAtMs ?? Date.now(),
150
- }
151
- : undefined;
152
- }
153
- export function applyArtifactChanges(previous, changes) {
154
- if (!changes) {
155
- return previous;
156
- }
157
- const rows = new Map((previous?.entries ?? []).map((row) => [getSessionArtifactManifestEntryKey(row), row]));
158
- for (const key of changes.removals) {
159
- rows.delete(key);
160
- }
161
- for (const row of changes.upserts) {
162
- rows.set(getSessionArtifactManifestEntryKey(row), row);
163
- }
164
- const entries = [...rows.values()]
165
- .sort((a, b) => {
166
- const age = (b.evictedAtMs ?? b.createdAtMs) - (a.evictedAtMs ?? a.createdAtMs);
167
- if (age !== 0) {
168
- return age;
169
- }
170
- const pending = Number(isPendingRecordingArtifact(b)) - Number(isPendingRecordingArtifact(a));
171
- return pending !== 0 ? pending : a.path.localeCompare(b.path);
172
- })
173
- .slice(0, changes.maxEntries);
174
- const manifest = {
175
- version: 1,
176
- entries,
177
- maxEntries: changes.maxEntries,
178
- updatedAtMs: changes.updatedAtMs,
179
- liveCount: entries.filter((row) => row.retentionState === "live").length,
180
- evictedCount: entries.filter((row) => row.retentionState === "evicted").length,
181
- };
182
- if (!isSessionArtifactManifest(manifest)) {
183
- throw new Error("Invalid browser artifact changes; inspect the retained journal.");
184
- }
185
- return entries.length > 0 ? manifest : undefined;
186
- }
187
- export function appendBrowserTransition(pi, record) {
188
- pi.appendEntry(BROWSER_TRANSITION_ENTRY, record);
189
- }
@@ -1,15 +0,0 @@
1
- export function isBrowserStringArray(value) {
2
- if (!Array.isArray(value)) {
3
- return false;
4
- }
5
- const rows = value;
6
- return rows.every((row) => typeof row === "string");
7
- }
8
- /** Normalize only string rows from an untrusted native/transcript array, retaining their order. */
9
- export function browserStringArray(value) {
10
- if (!Array.isArray(value)) {
11
- return [];
12
- }
13
- const rows = value;
14
- return rows.filter((row) => typeof row === "string");
15
- }
@@ -1,340 +0,0 @@
1
- const ADDITIONAL_COMMAND_TOKENS = [
2
- "a11y",
3
- "auth",
4
- "chat",
5
- "clipboard",
6
- "confirm",
7
- "connect",
8
- "dashboard",
9
- "deny",
10
- "device",
11
- "dialog",
12
- "diff",
13
- "doctor",
14
- "errors",
15
- "eval",
16
- "find",
17
- "frame",
18
- "get",
19
- "highlight",
20
- "inspect",
21
- "install",
22
- "is",
23
- "mcp",
24
- "plugin",
25
- "plugins",
26
- "profiles",
27
- "profiler",
28
- "react",
29
- "record",
30
- "removeinitscript",
31
- "session",
32
- "set",
33
- "skills",
34
- "snapshot",
35
- "state",
36
- "stream",
37
- "trace",
38
- "upgrade",
39
- "vitals",
40
- "wait",
41
- "web-vitals",
42
- "webmcp",
43
- "window",
44
- ];
45
- const COMMAND_CAPABILITIES = [
46
- {
47
- command: "back",
48
- eligibleForElectronHealthProbe: true,
49
- eligibleForPageChangeSummary: true,
50
- invalidatesBatchRefs: true,
51
- navigationObservable: true,
52
- triggersPostMutationSnapshot: true,
53
- },
54
- {
55
- command: "batch",
56
- excludedFromPostCommandCorrection: true,
57
- },
58
- {
59
- command: "check",
60
- eligibleForElectronHealthProbe: true,
61
- eligibleForPageChangeSummary: true,
62
- guardsPageRefs: true,
63
- invalidatesBatchRefs: true,
64
- triggersPostMutationSnapshot: true,
65
- },
66
- {
67
- command: "click",
68
- eligibleForElectronHealthProbe: true,
69
- eligibleForPageChangeSummary: true,
70
- guardsPageRefs: true,
71
- invalidatesBatchRefs: true,
72
- navigationObservable: true,
73
- triggersPostMutationSnapshot: true,
74
- },
75
- {
76
- aliases: ["quit", "exit"],
77
- closesSession: true,
78
- command: "close",
79
- excludedFromPinning: true,
80
- excludedFromPostCommandCorrection: true,
81
- },
82
- {
83
- command: "console",
84
- readOnlyDiagnosticSessionTarget: true,
85
- },
86
- {
87
- command: "cookies",
88
- readOnlyDiagnosticSessionTarget: true,
89
- },
90
- {
91
- command: "dblclick",
92
- eligibleForElectronHealthProbe: true,
93
- eligibleForPageChangeSummary: true,
94
- guardsPageRefs: true,
95
- invalidatesBatchRefs: true,
96
- navigationObservable: true,
97
- triggersPostMutationSnapshot: true,
98
- },
99
- {
100
- command: "dialog",
101
- eligibleForPageChangeSummary: true,
102
- invalidatesBatchRefs: true,
103
- triggersPostMutationSnapshot: true,
104
- },
105
- {
106
- command: "diff",
107
- guardsPageRefs: true,
108
- },
109
- {
110
- command: "download",
111
- eligibleForPageChangeSummary: true,
112
- guardsPageRefs: true,
113
- },
114
- {
115
- command: "drag",
116
- guardsPageRefs: true,
117
- invalidatesBatchRefs: true,
118
- },
119
- {
120
- command: "errors",
121
- readOnlyDiagnosticSessionTarget: true,
122
- },
123
- {
124
- command: "eval",
125
- invalidatesBatchRefs: true,
126
- navigationObservable: true,
127
- triggersPostMutationSnapshot: true,
128
- },
129
- {
130
- command: "fill",
131
- eligibleForElectronHealthProbe: true,
132
- eligibleForPageChangeSummary: true,
133
- guardsPageRefs: true,
134
- triggersPostMutationSnapshot: true,
135
- },
136
- {
137
- command: "find",
138
- eligibleForElectronHealthProbe: true,
139
- },
140
- {
141
- command: "frame",
142
- guardsPageRefs: true,
143
- },
144
- {
145
- command: "focus",
146
- guardsPageRefs: true,
147
- },
148
- {
149
- command: "forward",
150
- eligibleForElectronHealthProbe: true,
151
- eligibleForPageChangeSummary: true,
152
- invalidatesBatchRefs: true,
153
- navigationObservable: true,
154
- triggersPostMutationSnapshot: true,
155
- },
156
- {
157
- command: "get",
158
- guardsPageRefs: true,
159
- },
160
- {
161
- command: "highlight",
162
- guardsPageRefs: true,
163
- },
164
- {
165
- command: "hover",
166
- eligibleForPageChangeSummary: true,
167
- guardsPageRefs: true,
168
- invalidatesBatchRefs: true,
169
- triggersPostMutationSnapshot: true,
170
- },
171
- {
172
- command: "is",
173
- guardsPageRefs: true,
174
- },
175
- {
176
- command: "keydown",
177
- eligibleForElectronHealthProbe: true,
178
- eligibleForPageChangeSummary: true,
179
- invalidatesBatchRefs: true,
180
- triggersPostMutationSnapshot: true,
181
- },
182
- {
183
- command: "keyboard",
184
- eligibleForElectronHealthProbe: true,
185
- eligibleForPageChangeSummary: true,
186
- invalidatesBatchRefs: true,
187
- triggersPostMutationSnapshot: true,
188
- },
189
- {
190
- command: "keyup",
191
- eligibleForElectronHealthProbe: true,
192
- eligibleForPageChangeSummary: true,
193
- invalidatesBatchRefs: true,
194
- triggersPostMutationSnapshot: true,
195
- },
196
- {
197
- command: "mouse",
198
- eligibleForElectronHealthProbe: true,
199
- invalidatesBatchRefs: true,
200
- },
201
- {
202
- command: "network",
203
- readOnlyDiagnosticSessionTarget: true,
204
- },
205
- {
206
- aliases: ["goto", "navigate"],
207
- command: "open",
208
- eligibleForPageChangeSummary: true,
209
- excludedFromPinning: true,
210
- invalidatesBatchRefs: true,
211
- openNavigation: true,
212
- },
213
- {
214
- command: "pdf",
215
- eligibleForPageChangeSummary: true,
216
- },
217
- {
218
- aliases: ["key"],
219
- command: "press",
220
- eligibleForElectronHealthProbe: true,
221
- eligibleForPageChangeSummary: true,
222
- invalidatesBatchRefs: true,
223
- triggersPostMutationSnapshot: true,
224
- },
225
- {
226
- command: "pushstate",
227
- eligibleForPageChangeSummary: true,
228
- invalidatesBatchRefs: true,
229
- triggersPostMutationSnapshot: true,
230
- },
231
- {
232
- command: "reload",
233
- eligibleForElectronHealthProbe: true,
234
- eligibleForPageChangeSummary: true,
235
- invalidatesBatchRefs: true,
236
- navigationObservable: true,
237
- triggersPostMutationSnapshot: true,
238
- },
239
- {
240
- command: "read",
241
- readOnlyDiagnosticSessionTarget: true,
242
- },
243
- {
244
- command: "screenshot",
245
- eligibleForPageChangeSummary: true,
246
- guardsPageRefs: true,
247
- },
248
- {
249
- command: "scroll",
250
- eligibleForPageChangeSummary: true,
251
- guardsPageRefs: true,
252
- invalidatesBatchRefs: true,
253
- triggersPostMutationSnapshot: true,
254
- },
255
- {
256
- aliases: ["scrollinto"],
257
- command: "scrollintoview",
258
- eligibleForPageChangeSummary: true,
259
- guardsPageRefs: true,
260
- invalidatesBatchRefs: true,
261
- triggersPostMutationSnapshot: true,
262
- },
263
- {
264
- command: "select",
265
- eligibleForElectronHealthProbe: true,
266
- eligibleForPageChangeSummary: true,
267
- guardsPageRefs: true,
268
- invalidatesBatchRefs: true,
269
- triggersPostMutationSnapshot: true,
270
- },
271
- {
272
- command: "session",
273
- excludedFromPinning: true,
274
- excludedFromPostCommandCorrection: true,
275
- },
276
- {
277
- command: "storage",
278
- readOnlyDiagnosticSessionTarget: true,
279
- },
280
- {
281
- command: "swipe",
282
- eligibleForPageChangeSummary: true,
283
- invalidatesBatchRefs: true,
284
- triggersPostMutationSnapshot: true,
285
- },
286
- {
287
- command: "tab",
288
- excludedFromPinning: true,
289
- excludedFromPostCommandCorrection: true,
290
- },
291
- {
292
- command: "tap",
293
- eligibleForElectronHealthProbe: true,
294
- eligibleForPageChangeSummary: true,
295
- guardsPageRefs: true,
296
- invalidatesBatchRefs: true,
297
- triggersPostMutationSnapshot: true,
298
- },
299
- {
300
- command: "type",
301
- eligibleForElectronHealthProbe: true,
302
- eligibleForPageChangeSummary: true,
303
- guardsPageRefs: true,
304
- invalidatesBatchRefs: true,
305
- triggersPostMutationSnapshot: true,
306
- },
307
- {
308
- command: "uncheck",
309
- eligibleForElectronHealthProbe: true,
310
- eligibleForPageChangeSummary: true,
311
- guardsPageRefs: true,
312
- invalidatesBatchRefs: true,
313
- triggersPostMutationSnapshot: true,
314
- },
315
- {
316
- command: "upload",
317
- guardsPageRefs: true,
318
- invalidatesBatchRefs: true,
319
- },
320
- ];
321
- const COMMAND_CAPABILITY_BY_NAME = new Map();
322
- for (const entry of COMMAND_CAPABILITIES) {
323
- COMMAND_CAPABILITY_BY_NAME.set(entry.command, entry);
324
- for (const alias of entry.aliases ?? []) {
325
- COMMAND_CAPABILITY_BY_NAME.set(alias, entry);
326
- }
327
- }
328
- const KNOWN_COMMAND_TOKENS = new Set([
329
- ...COMMAND_CAPABILITY_BY_NAME.keys(),
330
- ...ADDITIONAL_COMMAND_TOKENS,
331
- ]);
332
- export function isKnownCommandToken(token) {
333
- return KNOWN_COMMAND_TOKENS.has(token);
334
- }
335
- function getCommandCapability(command) {
336
- return command === undefined ? undefined : COMMAND_CAPABILITY_BY_NAME.get(command);
337
- }
338
- export function hasCommandCapability(command, capability) {
339
- return getCommandCapability(command)?.[capability] === true;
340
- }