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,199 +0,0 @@
1
- import { isRecord } from "../../parsing.js";
2
- import { redactSensitiveText } from "../../runtime.js";
3
- import { getArrayField, getStringField, redactModelFacingText, stringifyModelFacing, } from "./common.js";
4
- const AUTH_SHOW_SAFE_FIELDS = [
5
- "name",
6
- "profile",
7
- "url",
8
- "username",
9
- "createdAt",
10
- "updatedAt",
11
- ];
12
- const SESSION_FIELDS = [
13
- "session",
14
- "namespace",
15
- "socketDir",
16
- "active",
17
- "pid",
18
- "version",
19
- "runtimeError",
20
- ];
21
- const RUNTIME_FIELDS = [
22
- "session",
23
- "namespace",
24
- "socketDir",
25
- "backgroundPid",
26
- "browserLaunched",
27
- "browser",
28
- "recording",
29
- "capabilities",
30
- "pageCount",
31
- "engine",
32
- "launchHash",
33
- "compatibilityStatus",
34
- "restoreKey",
35
- "restoreStatus",
36
- "restoreLoadedPath",
37
- "restoreValidationPending",
38
- "restoreSave",
39
- "saveStatus",
40
- "restoreSavedPath",
41
- ];
42
- function tabSelector(tab, label, index) {
43
- if (typeof tab.tabId === "string" && tab.tabId.trim().length > 0) {
44
- return tab.tabId.trim();
45
- }
46
- if (label !== undefined) {
47
- return label;
48
- }
49
- return typeof tab.index === "number" ? String(tab.index) : String(index);
50
- }
51
- function tabLine(tab, index) {
52
- if (!isRecord(tab)) {
53
- return `${index}: <invalid tab>`;
54
- }
55
- const marker = tab.active === true ? "*" : "-";
56
- const title = typeof tab.title === "string" ? tab.title : "(untitled)";
57
- const url = typeof tab.url === "string" ? tab.url : "(no url)";
58
- const label = getStringField(tab, "label");
59
- const selector = tabSelector(tab, label, index);
60
- const labelText = label !== undefined && label !== selector ? ` label=${redactModelFacingText(label)}` : "";
61
- const target = getStringField(tab, "targetId");
62
- const targetText = target !== undefined && target !== selector ? ` target=${redactModelFacingText(target)}` : "";
63
- return `${marker} [${selector}]${labelText}${targetText} ${title} — ${url}`;
64
- }
65
- export function getTabSummary(data) {
66
- const tabs = getArrayField(data, "tabs");
67
- return tabs ? tabs.map(tabLine).join("\n") : undefined;
68
- }
69
- function sessionMetadata(item) {
70
- const url = getStringField(item, "url");
71
- const title = getStringField(item, "title");
72
- const label = getStringField(item, "label");
73
- const tabCount = typeof item.tabCount === "number"
74
- ? `${item.tabCount} tab${item.tabCount === 1 ? "" : "s"}`
75
- : undefined;
76
- return [
77
- `active=${item.active === true ? "true" : "false"}`,
78
- label === undefined ? undefined : `label=${redactModelFacingText(label)}`,
79
- title === undefined ? undefined : `title=${redactSensitiveText(title)}`,
80
- url === undefined ? undefined : `url=${redactSensitiveText(url)}`,
81
- tabCount,
82
- ]
83
- .filter(Boolean)
84
- .join("; ");
85
- }
86
- function sessionLine(item, index) {
87
- if (!isRecord(item)) {
88
- return `${index + 1}. ${stringifyModelFacing(item)}`;
89
- }
90
- const name = redactModelFacingText(getStringField(item, "name") ??
91
- getStringField(item, "session") ??
92
- getStringField(item, "id") ??
93
- `(session ${index + 1})`);
94
- return `${index + 1}. name=${name}${item.active === true ? " *active*" : ""}; ${sessionMetadata(item)}`;
95
- }
96
- function nativeIdentityValue(value) {
97
- if (value === undefined || value === null) {
98
- return "unknown";
99
- }
100
- if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
101
- return String(value);
102
- }
103
- return stringifyModelFacing(value);
104
- }
105
- function formatRuntimeIdentity(data) {
106
- const runtime = data.runtime;
107
- const browser = isRecord(runtime) && isRecord(runtime.browser) ? runtime.browser : undefined;
108
- const identity = [
109
- `Daemon: ${data.active === true ? "active" : "inactive"}; PID: ${nativeIdentityValue(data.pid)}`,
110
- `Browser: ${nativeIdentityValue(browser?.status)}; alive: ${nativeIdentityValue(browser?.alive)}; Chrome PID: ${nativeIdentityValue(browser?.pid)}`,
111
- `Exact profile: ${nativeIdentityValue(browser?.userDataDir)}`,
112
- `Native browser ownership: ${nativeIdentityValue(browser?.ownership)}; Pi cleanup ownership: ${nativeIdentityValue(data.piCleanupOwnership)}`,
113
- ].join("\n");
114
- return `${redactModelFacingText(identity)}\n\n${stringifyModelFacing({
115
- ...Object.fromEntries(SESSION_FIELDS.map((key) => [key, data[key]])),
116
- // Native runtime also includes restore check URLs, text and code; show status/identity only.
117
- runtime: isRecord(runtime)
118
- ? Object.fromEntries(RUNTIME_FIELDS.map((key) => [key, runtime[key]]))
119
- : runtime,
120
- })}`;
121
- }
122
- export function formatSessionText(data) {
123
- const sessions = getArrayField(data, "sessions");
124
- if (sessions) {
125
- return sessions.length === 0 ? "No active sessions." : sessions.map(sessionLine).join("\n");
126
- }
127
- if (typeof data.active === "boolean") {
128
- return formatRuntimeIdentity(data);
129
- }
130
- const session = getStringField(data, "session");
131
- return session === undefined ? undefined : `Current session: ${redactModelFacingText(session)}`;
132
- }
133
- export function formatProfilesText(profiles, label) {
134
- if (profiles.length === 0) {
135
- return `No ${label}.`;
136
- }
137
- return profiles
138
- .map((item, index) => {
139
- if (!isRecord(item)) {
140
- return `${index + 1}. ${stringifyModelFacing(item)}`;
141
- }
142
- const name = redactModelFacingText(getStringField(item, "name") ?? getStringField(item, "profile") ?? `(unnamed ${index + 1})`);
143
- const directory = getStringField(item, "directory") ?? getStringField(item, "path");
144
- return directory === undefined
145
- ? `${index + 1}. ${name}`
146
- : `${index + 1}. ${name} (${redactModelFacingText(directory)})`;
147
- })
148
- .join("\n");
149
- }
150
- export function formatAuthShowText(data) {
151
- const lines = AUTH_SHOW_SAFE_FIELDS.flatMap((key) => {
152
- const value = data[key];
153
- return typeof value === "string" && value.trim().length > 0
154
- ? [`${key}: ${redactModelFacingText(value.trim())}`]
155
- : [];
156
- });
157
- return lines.length > 0 ? lines.join("\n") : undefined;
158
- }
159
- function stateLine(item, index) {
160
- if (!isRecord(item)) {
161
- return `${index + 1}. ${stringifyModelFacing(item)}`;
162
- }
163
- const name = getStringField(item, "name") ??
164
- getStringField(item, "file") ??
165
- getStringField(item, "path") ??
166
- `(state ${index + 1})`;
167
- const url = getStringField(item, "url");
168
- return url === undefined
169
- ? `${index + 1}. ${redactModelFacingText(name)}`
170
- : `${index + 1}. ${redactModelFacingText(name)} — ${redactSensitiveText(url)}`;
171
- }
172
- function stateShowText(data) {
173
- const filename = getStringField(data, "filename") ?? getStringField(data, "name") ?? "saved state";
174
- const summary = getStringField(data, "summary");
175
- const lines = [`Saved state: ${redactModelFacingText(filename)}`];
176
- if (summary !== undefined) {
177
- lines.push(`Summary: ${redactModelFacingText(summary)}`);
178
- }
179
- if (typeof data.encrypted === "boolean") {
180
- lines.push(`Encrypted: ${data.encrypted ? "yes" : "no"}`);
181
- }
182
- if (typeof data.size === "number") {
183
- lines.push(`Size: ${data.size} bytes`);
184
- }
185
- return lines.join("\n");
186
- }
187
- export function formatStateText(data, subcommand) {
188
- if (subcommand === "show") {
189
- return stateShowText(data);
190
- }
191
- const states = getArrayField(data, "states") ?? getArrayField(data, "files");
192
- if (states) {
193
- return states.length === 0 ? "No saved states." : states.map(stateLine).join("\n");
194
- }
195
- if (data.loaded === true) {
196
- return `State loaded: ${redactModelFacingText(getStringField(data, "path") ?? getStringField(data, "name") ?? "ok")}`;
197
- }
198
- return data.cleared === true || data.clear === true ? "State cleared." : undefined;
199
- }
@@ -1,75 +0,0 @@
1
- import { isRecord } from "../../parsing.js";
2
- import { firstLine, getArrayField, getStringField, redactModelFacingText, stringifyModelFacing, } from "./common.js";
3
- import { isClearDiagnosticCommand } from "./diagnostic-summary.js";
4
- const LOG_PREVIEW_LIMIT = 80;
5
- function consoleLine(item, index) {
6
- if (!isRecord(item)) {
7
- return `${index + 1}. ${stringifyModelFacing(item)}`;
8
- }
9
- const type = redactModelFacingText(getStringField(item, "type") ?? "message");
10
- const text = getStringField(item, "text") ?? stringifyModelFacing(item);
11
- return `${index + 1}. [${type}] ${firstLine(redactModelFacingText(text).replace(/\s+/g, " ").trim(), 220)}`;
12
- }
13
- export function formatConsoleText(data, command) {
14
- const messages = getArrayField(data, "messages");
15
- if (isClearDiagnosticCommand(command) && data.cleared === true && !messages) {
16
- return "Console buffer cleared.";
17
- }
18
- if (!messages) {
19
- return undefined;
20
- }
21
- if (isClearDiagnosticCommand(command)) {
22
- return messages.length === 0
23
- ? "Console buffer cleared; no prior message rows were returned. This reset output is not evidence of current-page console activity."
24
- : `Console buffer cleared; upstream returned ${messages.length} cleared/stale message row${messages.length === 1 ? "" : "s"}. Treat these as reset output, not current-page console errors.`;
25
- }
26
- if (messages.length === 0) {
27
- return "No console messages. Scope: upstream session aggregate unless the upstream command output says it was cleared or filtered for this page.";
28
- }
29
- const shown = [
30
- "Scope: upstream session aggregate unless the upstream command output says it was cleared or filtered for this page; do not attribute old messages to the current page without URL/time evidence.",
31
- ...messages.slice(0, LOG_PREVIEW_LIMIT).map(consoleLine),
32
- ];
33
- const previewedCount = Math.min(messages.length, LOG_PREVIEW_LIMIT);
34
- if (messages.length > previewedCount) {
35
- shown.push(`... (${messages.length - previewedCount} additional console messages omitted from preview)`);
36
- }
37
- return shown.join("\n");
38
- }
39
- function errorLine(item, index) {
40
- if (!isRecord(item)) {
41
- return `${index + 1}. ${stringifyModelFacing(item)}`;
42
- }
43
- const text = getStringField(item, "text") ?? stringifyModelFacing(item);
44
- const location = [
45
- getStringField(item, "url"),
46
- typeof item.line === "number" ? `line ${item.line}` : undefined,
47
- typeof item.column === "number" ? `column ${item.column}` : undefined,
48
- ]
49
- .filter((part) => part !== undefined && part.length > 0)
50
- .map((part) => redactModelFacingText(part ?? ""))
51
- .join(":");
52
- const safeText = firstLine(redactModelFacingText(text), 220);
53
- return location.length > 0
54
- ? `${index + 1}. ${safeText} (${location})`
55
- : `${index + 1}. ${safeText}`;
56
- }
57
- export function formatErrorsText(data, command) {
58
- const errors = getArrayField(data, "errors");
59
- if (!errors) {
60
- return undefined;
61
- }
62
- if (isClearDiagnosticCommand(command)) {
63
- return errors.length === 0
64
- ? "Page error buffer cleared; no prior error rows were returned. This reset output is not evidence of current-page errors."
65
- : `Page error buffer cleared; upstream returned ${errors.length} cleared/stale error row${errors.length === 1 ? "" : "s"}. Treat these as reset output, not current-page errors.`;
66
- }
67
- if (errors.length === 0) {
68
- return "No page errors.";
69
- }
70
- const shown = errors.slice(0, LOG_PREVIEW_LIMIT).map(errorLine);
71
- if (errors.length > shown.length) {
72
- shown.push(`... (${errors.length - shown.length} additional errors omitted from preview)`);
73
- }
74
- return shown.join("\n");
75
- }
@@ -1,216 +0,0 @@
1
- import { isRecord } from "../../parsing.js";
2
- import { redactSensitiveText } from "../../runtime.js";
3
- import { classifyNetworkRequestFailure, isApiLikeNetworkRequest, isNetworkArtifactNoiseRequest, } from "../network.js";
4
- import { withOptionalSessionArgs } from "../next-actions.js";
5
- import { getArrayField, getStringField } from "./common.js";
6
- const SENSITIVE_SEGMENT_TERMS = [
7
- "apikey",
8
- "api-key",
9
- "api_key",
10
- "authentication",
11
- "authorization",
12
- "bearer",
13
- "credential",
14
- "credentials",
15
- "jwt",
16
- "passwd",
17
- "password",
18
- "reset",
19
- "secret",
20
- "session",
21
- "token",
22
- ];
23
- const OPAQUE_SEGMENT_PATTERN = /^(?:[A-Fa-f0-9]{16,}|(?=.*[A-Za-z])(?=.*\d)[A-Za-z0-9_-]{16,})$/;
24
- function safeActionValue(value) {
25
- if (value === undefined || value.length === 0) {
26
- return undefined;
27
- }
28
- const trimmed = value.trim();
29
- return trimmed.length === 0 || redactSensitiveText(trimmed) !== trimmed ? undefined : trimmed;
30
- }
31
- function sensitivePathSegment(segment) {
32
- const normalized = segment.toLowerCase();
33
- return normalized === "auth" || SENSITIVE_SEGMENT_TERMS.some((term) => normalized.includes(term));
34
- }
35
- function decodePath(filter) {
36
- try {
37
- return decodeURIComponent(filter);
38
- }
39
- catch {
40
- return filter;
41
- } // Malformed native escapes still undergo literal segment checks.
42
- }
43
- function requestPath(url) {
44
- try {
45
- return new URL(url).pathname;
46
- }
47
- catch {
48
- return url.split(/[?#]/, 1)[0];
49
- } // Native patterns need not be absolute URLs.
50
- }
51
- function requestPathFilter(item) {
52
- const url = getStringField(item, "url");
53
- if (url === undefined) {
54
- return undefined;
55
- }
56
- const filter = requestPath(url)?.trim();
57
- if (filter === undefined || filter.length === 0 || filter === "/" || filter.length > 160) {
58
- return undefined;
59
- }
60
- if (decodePath(filter)
61
- .split("/")
62
- .some((segment) => sensitivePathSegment(segment) || OPAQUE_SEGMENT_PATTERN.test(segment))) {
63
- return undefined;
64
- }
65
- return safeActionValue(filter);
66
- }
67
- function candidateKind(item) {
68
- const classification = classifyNetworkRequestFailure(item);
69
- if (classification?.impact === "actionable") {
70
- return "actionable";
71
- }
72
- if (classification?.impact === "benign") {
73
- return "benign";
74
- }
75
- return isApiLikeNetworkRequest(item) ? "api" : "request";
76
- }
77
- function requestCandidate(item) {
78
- if (!isRecord(item) || isNetworkArtifactNoiseRequest(item)) {
79
- return [];
80
- }
81
- const requestId = safeActionValue(getStringField(item, "requestId") ?? getStringField(item, "id"));
82
- return requestId === undefined
83
- ? []
84
- : [{ filter: requestPathFilter(item), item, kind: candidateKind(item), requestId }];
85
- }
86
- function chooseCandidate(candidates) {
87
- return (candidates.find((candidate) => candidate.kind === "actionable") ??
88
- candidates.find((candidate) => candidate.kind === "api") ??
89
- candidates.find((candidate) => candidate.kind === "benign") ??
90
- candidates[0]);
91
- }
92
- function actionDescriptor(candidate) {
93
- const method = getStringField(candidate.item, "method") ?? "GET";
94
- const status = typeof candidate.item.status === "number" ? String(candidate.item.status) : "pending";
95
- return `${status} ${method}${candidate.filter === undefined ? "" : ` ${candidate.filter}`} [${candidate.requestId}]`;
96
- }
97
- function detailActionId(candidate) {
98
- if (candidate.kind === "actionable") {
99
- return "inspect-actionable-network-request";
100
- }
101
- return candidate.kind === "benign" ? "inspect-benign-network-request" : "inspect-network-request";
102
- }
103
- export function formatNetworkRouteDiagnosticsText(diagnostics) {
104
- if (!diagnostics || diagnostics.length === 0) {
105
- return undefined;
106
- }
107
- const lines = ["Network route diagnostics:"];
108
- for (const diagnostic of diagnostics) {
109
- const target = diagnostic.requestId !== undefined && diagnostic.requestId.length > 0
110
- ? `[${diagnostic.requestId}] ${diagnostic.requestUrl ?? "request"}`
111
- : (diagnostic.requestUrl ?? "request");
112
- lines.push(`- ${diagnostic.reason}: ${target} matched route ${diagnostic.routePattern} (${diagnostic.mode}).`);
113
- }
114
- lines.push("If this route is intended as a mock, inspect the request/headers and treat failed, pending, or CORS-looking rows as unfulfilled until a mocked response is observed.");
115
- return lines.join("\n");
116
- }
117
- function routeActions(diagnostics, sessionName) {
118
- const diagnostic = diagnostics?.find((item) => item.requestId !== undefined && item.requestId.length > 0) ??
119
- diagnostics?.[0];
120
- if (!diagnostic) {
121
- return [];
122
- }
123
- const actions = [];
124
- if (diagnostic.requestId !== undefined && diagnostic.requestId.length > 0) {
125
- actions.push({
126
- id: "inspect-routed-network-request",
127
- params: {
128
- args: withOptionalSessionArgs(sessionName, ["network", "request", diagnostic.requestId]),
129
- },
130
- reason: `Inspect the routed request ${diagnostic.requestId} before assuming the route mock fulfilled normally.`,
131
- safety: "Read-only request diagnostic; look for failed status, pending state, CORS/preflight errors, response body, and headers.",
132
- tool: "agent_browser",
133
- });
134
- }
135
- actions.push({
136
- id: "start-network-har-capture-for-route-mock",
137
- params: { args: withOptionalSessionArgs(sessionName, ["network", "har", "start"]) },
138
- reason: "Capture a HAR before reproducing the route mock so pending/CORS behavior has request and response headers.",
139
- safety: "HARs can contain URLs and headers; stop to an explicit path and avoid sharing sensitive captures.",
140
- tool: "agent_browser",
141
- });
142
- return actions;
143
- }
144
- function candidateActions(selected, sessionName) {
145
- const descriptor = actionDescriptor(selected);
146
- const actions = [
147
- {
148
- id: detailActionId(selected),
149
- params: {
150
- args: withOptionalSessionArgs(sessionName, ["network", "request", selected.requestId]),
151
- },
152
- reason: `Inspect full request details for ${descriptor}.`,
153
- safety: "Read-only network diagnostic; request inspection must not replace the active page/ref context.",
154
- tool: "agent_browser",
155
- },
156
- ];
157
- if (selected.kind === "actionable") {
158
- actions.push({
159
- id: "trace-actionable-network-source",
160
- params: {
161
- requestId: selected.requestId,
162
- ...(sessionName !== undefined && sessionName.length > 0 ? { session: sessionName } : {}),
163
- },
164
- reason: `Look for local source candidates related to ${descriptor}.`,
165
- safety: "Read-only experimental helper; enable network with agent_browser_tools when this tool is inactive. It reports bounded candidates and may miss bundled or dynamic call sites.",
166
- tool: "agent_browser_network_source",
167
- });
168
- }
169
- if (selected.filter !== undefined && selected.filter.length > 0) {
170
- actions.push({
171
- id: "filter-network-requests-by-path",
172
- params: {
173
- args: withOptionalSessionArgs(sessionName, [
174
- "network",
175
- "requests",
176
- "--filter",
177
- selected.filter,
178
- ]),
179
- },
180
- reason: `List captured requests matching ${selected.filter}.`,
181
- safety: "Read-only request-list filter; absence from a compact preview is not proof the request did not happen.",
182
- tool: "agent_browser",
183
- });
184
- }
185
- actions.push({
186
- id: "clear-network-requests-before-repro",
187
- params: { args: withOptionalSessionArgs(sessionName, ["network", "requests", "--clear"]) },
188
- reason: "Clear the aggregate request buffer before reproducing the current-page network behavior.",
189
- safety: "This mutates only diagnostic buffers for the session; capture or inspect needed old rows first.",
190
- tool: "agent_browser",
191
- });
192
- actions.push({
193
- id: "start-network-har-capture",
194
- params: { args: withOptionalSessionArgs(sessionName, ["network", "har", "start"]) },
195
- reason: "Start HAR capture before reproducing the network behavior again.",
196
- safety: "HARs can contain URLs and headers; stop to an explicit path, inspect metadata, and avoid sharing sensitive captures.",
197
- tool: "agent_browser",
198
- });
199
- return actions;
200
- }
201
- export function buildNetworkRequestsNextActions(data, sessionName, routeDiagnostics) {
202
- if (!isRecord(data)) {
203
- return undefined;
204
- }
205
- const requests = getArrayField(data, "requests");
206
- if (!requests) {
207
- return undefined;
208
- }
209
- const selected = chooseCandidate(requests.flatMap(requestCandidate));
210
- return selected
211
- ? [
212
- ...routeActions(routeDiagnostics, sessionName),
213
- ...candidateActions(selected, sessionName),
214
- ].slice(0, 6)
215
- : undefined;
216
- }
@@ -1,124 +0,0 @@
1
- import { isRecord } from "../../parsing.js";
2
- import { redactSensitiveText, redactSensitiveValue } from "../../runtime.js";
3
- import { classifyNetworkRequestFailure, isNetworkArtifactNoiseRequest, summarizeNetworkFailures, } from "../network.js";
4
- import { stringifyUnknown, truncateText } from "../text.js";
5
- import { getArrayField, getStringField, stringifyModelFacing } from "./common.js";
6
- import { isClearDiagnosticCommand } from "./diagnostic-summary.js";
7
- const REQUEST_PREVIEW_LIMIT = 40;
8
- const PREVIEW_FIELDS = {
9
- request: ["postData"],
10
- response: ["responseBody"],
11
- error: ["error", "failureText", "errorText"],
12
- };
13
- function previewCandidate(item, keys) {
14
- for (const key of keys) {
15
- const value = item[key];
16
- if (value !== undefined && value !== null && value !== "") {
17
- return value;
18
- }
19
- }
20
- return undefined;
21
- }
22
- function networkPreview(item, keys, label, maxChars) {
23
- const value = previewCandidate(item, keys);
24
- if (value === undefined || value === null) {
25
- return [];
26
- }
27
- const redacted = redactSensitiveValue(value);
28
- const raw = typeof redacted === "string" ? redacted : stringifyUnknown(redacted);
29
- const normalized = raw.replace(/\s+/g, " ").trim();
30
- return normalized.length === 0
31
- ? []
32
- : [` ${label}: ${truncateText(redactSensitiveText(normalized), maxChars)}`];
33
- }
34
- function networkRequestLine(item, index) {
35
- const method = getStringField(item, "method") ?? "GET";
36
- const status = typeof item.status === "number" ? String(item.status) : "pending";
37
- const type = getStringField(item, "resourceType") ?? getStringField(item, "mimeType");
38
- const url = getStringField(item, "url") ?? "(no url)";
39
- const requestId = getStringField(item, "requestId") ?? getStringField(item, "id");
40
- const idText = requestId === undefined ? "" : ` [${redactSensitiveText(requestId)}]`;
41
- const classification = classifyNetworkRequestFailure(item);
42
- const impactText = classification ? ` [${classification.impact}: ${classification.reason}]` : "";
43
- return [
44
- `${index + 1}. ${status} ${method} ${truncateText(redactSensitiveText(url), 180)}${type === undefined ? "" : ` (${type})`}${idText}${impactText}`,
45
- ...networkPreview(item, PREVIEW_FIELDS.request, "Payload", 280),
46
- ...networkPreview(item, PREVIEW_FIELDS.response, "Response", 280),
47
- ...networkPreview(item, PREVIEW_FIELDS.error, "Error", 220),
48
- ];
49
- }
50
- function failureRank(request) {
51
- const classification = isRecord(request.item)
52
- ? classifyNetworkRequestFailure(request.item)
53
- : undefined;
54
- return classification?.impact === "actionable" ? 0 : 1;
55
- }
56
- function prioritizeRequests(requests) {
57
- const failed = [];
58
- const normal = [];
59
- for (const request of requests) {
60
- if (isRecord(request.item) && classifyNetworkRequestFailure(request.item)) {
61
- failed.push(request);
62
- }
63
- else {
64
- normal.push(request);
65
- }
66
- }
67
- failed.sort((left, right) => {
68
- const rankDifference = failureRank(left) - failureRank(right);
69
- return rankDifference === 0 ? left.index - right.index : rankDifference;
70
- });
71
- return [...failed, ...normal];
72
- }
73
- function requestPreview(request) {
74
- return isRecord(request.item)
75
- ? networkRequestLine(request.item, request.index)
76
- : [`${request.index + 1}. ${stringifyModelFacing(request.item)}`];
77
- }
78
- function networkRequestsPreview(requests) {
79
- const shown = [
80
- "Scope: upstream session aggregate unless the upstream command output says it was cleared or filtered for this page; do not attribute old requests to the current page without URL/time evidence.",
81
- ];
82
- const indexed = requests.map((item, index) => ({ index, item }));
83
- const preview = indexed.filter(({ item }) => !(isRecord(item) && isNetworkArtifactNoiseRequest(item)));
84
- const noiseCount = indexed.length - preview.length;
85
- const summary = summarizeNetworkFailures(preview.map(({ item }) => item));
86
- if (summary.totalCount > 0) {
87
- shown.push(`Network failure summary: ${summary.actionableCount} actionable, ${summary.benignCount} benign low-impact (${summary.totalCount} total).`);
88
- }
89
- if (noiseCount > 0) {
90
- shown.push(`Diagnostic noise hidden from preview: ${noiseCount} data:image/artifact request row${noiseCount === 1 ? "" : "s"}; raw rows remain in details.data.requests.`);
91
- }
92
- const prioritized = prioritizeRequests(preview);
93
- shown.push(...prioritized.slice(0, REQUEST_PREVIEW_LIMIT).flatMap(requestPreview));
94
- const omittedCount = Math.max(0, prioritized.length - REQUEST_PREVIEW_LIMIT);
95
- if (omittedCount > 0) {
96
- shown.push(`... (${omittedCount} additional non-noise requests omitted from preview; failed requests are shown first when present)`);
97
- }
98
- return shown.join("\n");
99
- }
100
- export function formatNetworkRequestsText(data, command) {
101
- const requests = getArrayField(data, "requests");
102
- if (isClearDiagnosticCommand(command) && data.cleared === true && !requests) {
103
- return "Network request buffer cleared.";
104
- }
105
- if (!requests) {
106
- return undefined;
107
- }
108
- if (isClearDiagnosticCommand(command)) {
109
- return requests.length === 0
110
- ? "Network request buffer cleared; no prior request rows were returned. This reset output is not evidence of current-page network activity."
111
- : `Network request buffer cleared; upstream returned ${requests.length} cleared/stale row${requests.length === 1 ? "" : "s"}. Treat these as reset output, not current-page request failures.`;
112
- }
113
- return requests.length === 0
114
- ? "No network requests captured. Scope: upstream session aggregate unless the upstream command output says it was cleared or filtered for this page."
115
- : networkRequestsPreview(requests);
116
- }
117
- export function formatNetworkRequestText(data) {
118
- if (getStringField(data, "url") === undefined &&
119
- getStringField(data, "requestId") === undefined &&
120
- getStringField(data, "id") === undefined) {
121
- return undefined;
122
- }
123
- return networkRequestLine(data, 0).join("\n");
124
- }
@@ -1,64 +0,0 @@
1
- import { isRecord } from "../../parsing.js";
2
- import { getUpstreamEffectiveBatchSteps } from "../../orchestration/batch-stdin.js";
3
- import { redactSensitiveText, redactSensitiveValue } from "../../runtime.js";
4
- import { formatStorageValue, redactStorageData } from "./diagnostic-storage.js";
5
- function redactStatefulValues(value) {
6
- if (Array.isArray(value)) {
7
- return value.map((item) => redactStatefulValues(item));
8
- }
9
- if (!isRecord(value)) {
10
- return redactSensitiveValue(value);
11
- }
12
- return Object.fromEntries(Object.entries(value).map(([key, entryValue]) => [
13
- key,
14
- key.toLowerCase() === "value" ? "[REDACTED]" : redactStatefulValues(entryValue),
15
- ]));
16
- }
17
- function storageTextKey(command) {
18
- const operation = command.commandTokens?.[2];
19
- if (operation === "get") {
20
- return command.commandTokens?.[3];
21
- }
22
- return operation === "set" || operation === "clear" ? undefined : operation;
23
- }
24
- function redactStorageText(command, text) {
25
- const key = storageTextKey(command);
26
- if (key !== undefined && text.startsWith(`${key}: `)) {
27
- const suffix = text.endsWith("\n") ? "\n" : "";
28
- const value = text.slice(key.length + 2, suffix.length > 0 ? -1 : undefined);
29
- return `${key}: ${formatStorageValue(key, value)}${suffix}`;
30
- }
31
- // ponytail: native all-entry/raw-batch text does not escape multiline values.
32
- // Format heuristics cannot separate lookalike entries; use structured JSON for sensitive storage.
33
- return text.replace(/^([^\r\n]*?): ([^\r\n]*)/gm, (_line, entryKey, value) => `${entryKey}: ${formatStorageValue(entryKey, value)}`);
34
- }
35
- function redactNativeContextText(command, text, stdin) {
36
- if (command.command === "batch") {
37
- const steps = getUpstreamEffectiveBatchSteps(command.commandTokens ?? ["batch"], stdin);
38
- const cookieRedacted = steps.some((step) => step[0] === "cookies")
39
- ? redactNativeContextText({ command: "cookies" }, text)
40
- : text;
41
- return steps.some((step) => step[0] === "storage")
42
- ? redactNativeContextText({ command: "storage" }, cookieRedacted)
43
- : cookieRedacted;
44
- }
45
- if (command.command === "cookies") {
46
- return text.replace(/^([^=\r\n]*)=([^\r\n]*)/gm, "$1=[REDACTED]");
47
- }
48
- return command.command === "storage" ? redactStorageText(command, text) : text;
49
- }
50
- export function redactPresentationData(command, data, stdin) {
51
- if (typeof data === "string") {
52
- return redactSensitiveText(redactNativeContextText(command, data, stdin));
53
- }
54
- if (command.command === "cookies") {
55
- return redactStatefulValues(data);
56
- }
57
- if (command.command === "storage") {
58
- return redactStorageData(data);
59
- }
60
- if (command.command === "state" && command.subcommand === "show") {
61
- return redactStatefulValues(data);
62
- }
63
- return redactSensitiveValue(data);
64
- }