pi-agent-browser-native 0.9.5 → 0.9.7

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 (398) hide show
  1. package/CHANGELOG.md +114 -1
  2. package/README.md +17 -6
  3. package/dist/extensions/agent-browser/index.js +2482 -925
  4. package/dist/packaged/lib/browser-session-conversion.js +2946 -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 +728 -0
  8. package/dist/packaged/lib/results/snapshot.js +2800 -0
  9. package/dist/packaged/lib/runtime.js +3075 -0
  10. package/docs/ARCHITECTURE.md +29 -10
  11. package/docs/CODE_QUALITY.md +32 -5
  12. package/docs/COMMAND_REFERENCE.md +156 -40
  13. package/docs/ELECTRON.md +1 -1
  14. package/docs/PERFORMANCE.md +252 -0
  15. package/docs/REFERENCE.md +15 -15
  16. package/docs/RELEASE.md +41 -18
  17. package/docs/REQUIREMENTS.md +6 -0
  18. package/docs/SESSION_STORAGE.md +13 -5
  19. package/docs/SUPPORT_MATRIX.md +31 -25
  20. package/docs/TOOL_CONTRACT.md +41 -18
  21. package/docs/performance/2026-10-12.json +7257 -0
  22. package/docs/platform-smoke.md +18 -14
  23. package/package.json +18 -4
  24. package/platform-smoke.config.mjs +3 -2
  25. package/scripts/agent-browser-capability-baseline.mjs +16 -2
  26. package/scripts/agent-browser-target.mjs +1 -1
  27. package/scripts/build.mjs +16 -5
  28. package/scripts/capability-options.mjs +20 -0
  29. package/scripts/capability-samples.mjs +23 -10
  30. package/scripts/config.mjs +1 -1
  31. package/scripts/convert-browser-session.mjs +1 -1
  32. package/scripts/platform-smoke/commands.mjs +30 -4
  33. package/scripts/platform-smoke/doctor-support.mjs +11 -2
  34. package/scripts/platform-smoke/doctor-windows.mjs +1 -1
  35. package/scripts/platform-smoke/doctor.mjs +26 -11
  36. package/scripts/platform-smoke/linux-image/Dockerfile +6 -3
  37. package/scripts/platform-smoke/platform-build-windows.ps1 +23 -3
  38. package/scripts/platform-smoke/suite-checks.mjs +11 -1
  39. package/scripts/platform-smoke/targets.mjs +4 -3
  40. package/scripts/platform-smoke.mjs +68 -25
  41. package/dist/extensions/agent-browser/lib/argv-descriptor.js +0 -123
  42. package/dist/extensions/agent-browser/lib/argv-grammar.js +0 -320
  43. package/dist/extensions/agent-browser/lib/bash-guard.js +0 -193
  44. package/dist/extensions/agent-browser/lib/batch-lifecycle.js +0 -131
  45. package/dist/extensions/agent-browser/lib/browser-execution-claim-codec.js +0 -61
  46. package/dist/extensions/agent-browser/lib/browser-execution-claim-storage.js +0 -232
  47. package/dist/extensions/agent-browser/lib/browser-execution-claims.js +0 -202
  48. package/dist/extensions/agent-browser/lib/browser-execution-identity.js +0 -77
  49. package/dist/extensions/agent-browser/lib/browser-journal-branch.js +0 -98
  50. package/dist/extensions/agent-browser/lib/browser-journal-contracts.js +0 -1
  51. package/dist/extensions/agent-browser/lib/browser-journal-projection.js +0 -221
  52. package/dist/extensions/agent-browser/lib/browser-journal-reader.js +0 -89
  53. package/dist/extensions/agent-browser/lib/browser-journal-replay.js +0 -246
  54. package/dist/extensions/agent-browser/lib/browser-journal.js +0 -148
  55. package/dist/extensions/agent-browser/lib/browser-legacy-pages.js +0 -220
  56. package/dist/extensions/agent-browser/lib/browser-legacy-projection.js +0 -282
  57. package/dist/extensions/agent-browser/lib/browser-legacy-types.js +0 -1
  58. package/dist/extensions/agent-browser/lib/browser-session-conversion-stream.js +0 -217
  59. package/dist/extensions/agent-browser/lib/browser-session-conversion.js +0 -126
  60. package/dist/extensions/agent-browser/lib/browser-transcript-contracts.js +0 -35
  61. package/dist/extensions/agent-browser/lib/browser-transcript-validation.js +0 -166
  62. package/dist/extensions/agent-browser/lib/browser-transcript.js +0 -189
  63. package/dist/extensions/agent-browser/lib/browser-value-parsing.js +0 -15
  64. package/dist/extensions/agent-browser/lib/command-capabilities.js +0 -340
  65. package/dist/extensions/agent-browser/lib/command-policy.js +0 -155
  66. package/dist/extensions/agent-browser/lib/command-taxonomy.js +0 -105
  67. package/dist/extensions/agent-browser/lib/config-policy.js +0 -450
  68. package/dist/extensions/agent-browser/lib/config-providers.js +0 -71
  69. package/dist/extensions/agent-browser/lib/config-validation.js +0 -231
  70. package/dist/extensions/agent-browser/lib/config.js +0 -69
  71. package/dist/extensions/agent-browser/lib/electron/cdp.js +0 -62
  72. package/dist/extensions/agent-browser/lib/electron/cleanup.js +0 -274
  73. package/dist/extensions/agent-browser/lib/electron/discovery-darwin.js +0 -109
  74. package/dist/extensions/agent-browser/lib/electron/discovery-desktop.js +0 -136
  75. package/dist/extensions/agent-browser/lib/electron/discovery-evidence.js +0 -90
  76. package/dist/extensions/agent-browser/lib/electron/discovery-linux.js +0 -93
  77. package/dist/extensions/agent-browser/lib/electron/discovery-packages.js +0 -162
  78. package/dist/extensions/agent-browser/lib/electron/discovery-types.js +0 -2
  79. package/dist/extensions/agent-browser/lib/electron/discovery.js +0 -217
  80. package/dist/extensions/agent-browser/lib/electron/launch-monitor.js +0 -102
  81. package/dist/extensions/agent-browser/lib/electron/launch-process.js +0 -209
  82. package/dist/extensions/agent-browser/lib/electron/launch-types.js +0 -2
  83. package/dist/extensions/agent-browser/lib/electron/launch.js +0 -340
  84. package/dist/extensions/agent-browser/lib/executable-path.js +0 -29
  85. package/dist/extensions/agent-browser/lib/execution-cwd.js +0 -67
  86. package/dist/extensions/agent-browser/lib/fs-utils.js +0 -10
  87. package/dist/extensions/agent-browser/lib/input-modes/electron.js +0 -201
  88. package/dist/extensions/agent-browser/lib/input-modes/job.js +0 -198
  89. package/dist/extensions/agent-browser/lib/input-modes/lookup-network-evidence.js +0 -116
  90. package/dist/extensions/agent-browser/lib/input-modes/lookup-plan.js +0 -132
  91. package/dist/extensions/agent-browser/lib/input-modes/lookup-redaction.js +0 -57
  92. package/dist/extensions/agent-browser/lib/input-modes/lookup-source-evidence.js +0 -151
  93. package/dist/extensions/agent-browser/lib/input-modes/lookup-workspace.js +0 -142
  94. package/dist/extensions/agent-browser/lib/input-modes/lookups.js +0 -84
  95. package/dist/extensions/agent-browser/lib/input-modes/params.js +0 -195
  96. package/dist/extensions/agent-browser/lib/input-modes/qa-analysis.js +0 -268
  97. package/dist/extensions/agent-browser/lib/input-modes/qa-presentation.js +0 -117
  98. package/dist/extensions/agent-browser/lib/input-modes/script-child.js +0 -396
  99. package/dist/extensions/agent-browser/lib/input-modes/script-protocol.js +0 -86
  100. package/dist/extensions/agent-browser/lib/input-modes/script-types.js +0 -1
  101. package/dist/extensions/agent-browser/lib/input-modes/script-validation.js +0 -60
  102. package/dist/extensions/agent-browser/lib/input-modes/script.js +0 -108
  103. package/dist/extensions/agent-browser/lib/input-modes/semantic-action.js +0 -243
  104. package/dist/extensions/agent-browser/lib/input-modes/shared.js +0 -48
  105. package/dist/extensions/agent-browser/lib/input-modes/types.js +0 -65
  106. package/dist/extensions/agent-browser/lib/json-schema.js +0 -65
  107. package/dist/extensions/agent-browser/lib/launch-scoped-flags.js +0 -212
  108. package/dist/extensions/agent-browser/lib/managed-session-policy-lock.js +0 -165
  109. package/dist/extensions/agent-browser/lib/managed-session-posix-storage.js +0 -58
  110. package/dist/extensions/agent-browser/lib/managed-session-project-identity.js +0 -244
  111. package/dist/extensions/agent-browser/lib/managed-session-restore-context.js +0 -84
  112. package/dist/extensions/agent-browser/lib/managed-session-restore-policy.js +0 -119
  113. package/dist/extensions/agent-browser/lib/managed-session-restore-state.js +0 -83
  114. package/dist/extensions/agent-browser/lib/managed-session-restore.js +0 -212
  115. package/dist/extensions/agent-browser/lib/managed-session-snapshot-records.js +0 -277
  116. package/dist/extensions/agent-browser/lib/managed-session-snapshots.js +0 -181
  117. package/dist/extensions/agent-browser/lib/managed-session-storage.js +0 -126
  118. package/dist/extensions/agent-browser/lib/native-confirmation.js +0 -140
  119. package/dist/extensions/agent-browser/lib/native-output.js +0 -81
  120. package/dist/extensions/agent-browser/lib/orchestration/batch-stdin.js +0 -182
  121. package/dist/extensions/agent-browser/lib/orchestration/browser-run/artifact-merge.js +0 -30
  122. package/dist/extensions/agent-browser/lib/orchestration/browser-run/artifact-paths.js +0 -188
  123. package/dist/extensions/agent-browser/lib/orchestration/browser-run/browser-observation-result.js +0 -82
  124. package/dist/extensions/agent-browser/lib/orchestration/browser-run/click-dispatch.js +0 -406
  125. package/dist/extensions/agent-browser/lib/orchestration/browser-run/diagnostic-values.js +0 -31
  126. package/dist/extensions/agent-browser/lib/orchestration/browser-run/diagnostics.js +0 -240
  127. package/dist/extensions/agent-browser/lib/orchestration/browser-run/electron-observation.js +0 -203
  128. package/dist/extensions/agent-browser/lib/orchestration/browser-run/electron-text-diagnostics.js +0 -109
  129. package/dist/extensions/agent-browser/lib/orchestration/browser-run/fill-diagnostics.js +0 -119
  130. package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-action-recovery.js +0 -147
  131. package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-actions.js +0 -144
  132. package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-content.js +0 -123
  133. package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-contracts.js +0 -1
  134. package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-details.js +0 -156
  135. package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-electron.js +0 -187
  136. package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-evidence.js +0 -39
  137. package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-missing-binary.js +0 -89
  138. package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-recovery.js +0 -97
  139. package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-redaction.js +0 -106
  140. package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-timeout.js +0 -110
  141. package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result.js +0 -53
  142. package/dist/extensions/agent-browser/lib/orchestration/browser-run/index.js +0 -224
  143. package/dist/extensions/agent-browser/lib/orchestration/browser-run/interaction-diagnostics.js +0 -290
  144. package/dist/extensions/agent-browser/lib/orchestration/browser-run/managed-session-close.js +0 -167
  145. package/dist/extensions/agent-browser/lib/orchestration/browser-run/managed-session-daemon-inspection.js +0 -108
  146. package/dist/extensions/agent-browser/lib/orchestration/browser-run/managed-session-daemon-policy.js +0 -174
  147. package/dist/extensions/agent-browser/lib/orchestration/browser-run/native-helper-observation.js +0 -65
  148. package/dist/extensions/agent-browser/lib/orchestration/browser-run/observation-types.js +0 -1
  149. package/dist/extensions/agent-browser/lib/orchestration/browser-run/overlay-diagnostics.js +0 -120
  150. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/network-page-filter.js +0 -192
  151. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/scroll-shims.js +0 -225
  152. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/snapshot-filter-data.js +0 -150
  153. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/snapshot-filter.js +0 -174
  154. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/snapshot-rendered-text.js +0 -147
  155. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/wait-timeouts.js +0 -145
  156. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-artifacts.js +0 -159
  157. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-command.js +0 -131
  158. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-contracts.js +0 -1
  159. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-daemon.js +0 -93
  160. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-failure.js +0 -42
  161. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-guards.js +0 -242
  162. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-input.js +0 -75
  163. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-observations.js +0 -92
  164. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-page-selection.js +0 -254
  165. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-page-state.js +0 -121
  166. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-refs.js +0 -130
  167. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-resources.js +0 -114
  168. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-semantic.js +0 -121
  169. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-session-plan.js +0 -222
  170. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-timeouts.js +0 -68
  171. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare.js +0 -202
  172. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-analysis.js +0 -191
  173. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-confirmation.js +0 -152
  174. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-diagnostics.js +0 -182
  175. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-electron.js +0 -150
  176. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-lifecycle-contracts.js +0 -1
  177. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-lifecycle-phase-contracts.js +0 -1
  178. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-lifecycle-phase.js +0 -115
  179. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-lifecycle.js +0 -256
  180. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-managed-contracts.js +0 -1
  181. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-managed.js +0 -256
  182. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-native-phase-contracts.js +0 -1
  183. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-native-phase.js +0 -93
  184. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-native.js +0 -113
  185. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-navigation-contracts.js +0 -1
  186. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-navigation.js +0 -316
  187. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-ownership.js +0 -28
  188. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-page-phase-contracts.js +0 -1
  189. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-page-phase.js +0 -142
  190. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-presentation-contracts.js +0 -1
  191. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-presentation.js +0 -333
  192. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-publication-phase-contracts.js +0 -1
  193. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-publication-phase.js +0 -71
  194. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-publication.js +0 -201
  195. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-receipts.js +0 -183
  196. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-refs.js +0 -200
  197. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-tabs.js +0 -142
  198. package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output.js +0 -25
  199. package/dist/extensions/agent-browser/lib/orchestration/browser-run/prompt-guards.js +0 -50
  200. package/dist/extensions/agent-browser/lib/orchestration/browser-run/recording-receipt-reconciliation.js +0 -198
  201. package/dist/extensions/agent-browser/lib/orchestration/browser-run/recording-recovery-contracts.js +0 -1
  202. package/dist/extensions/agent-browser/lib/orchestration/browser-run/recording-recovery-presentation.js +0 -154
  203. package/dist/extensions/agent-browser/lib/orchestration/browser-run/recording-recovery.js +0 -80
  204. package/dist/extensions/agent-browser/lib/orchestration/browser-run/screenshot-capture.js +0 -14
  205. package/dist/extensions/agent-browser/lib/orchestration/browser-run/screenshot-observation.js +0 -206
  206. package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-commands.js +0 -130
  207. package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-electron.js +0 -212
  208. package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-observations.js +0 -61
  209. package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-outcomes.js +0 -187
  210. package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-refs.js +0 -169
  211. package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-tabs.js +0 -228
  212. package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state.js +0 -117
  213. package/dist/extensions/agent-browser/lib/orchestration/browser-run/text-visibility-diagnostics.js +0 -182
  214. package/dist/extensions/agent-browser/lib/orchestration/browser-run/timeout-diagnostics.js +0 -256
  215. package/dist/extensions/agent-browser/lib/orchestration/browser-run/timeout-progress.js +0 -108
  216. package/dist/extensions/agent-browser/lib/orchestration/browser-run/types.js +0 -1
  217. package/dist/extensions/agent-browser/lib/orchestration/code-artifact-observation.js +0 -39
  218. package/dist/extensions/agent-browser/lib/orchestration/code-image-observation.js +0 -119
  219. package/dist/extensions/agent-browser/lib/orchestration/electron-host/branch.js +0 -93
  220. package/dist/extensions/agent-browser/lib/orchestration/electron-host/cleanup-result.js +0 -58
  221. package/dist/extensions/agent-browser/lib/orchestration/electron-host/cleanup.js +0 -78
  222. package/dist/extensions/agent-browser/lib/orchestration/electron-host/contracts.js +0 -1
  223. package/dist/extensions/agent-browser/lib/orchestration/electron-host/discovery.js +0 -106
  224. package/dist/extensions/agent-browser/lib/orchestration/electron-host/index.js +0 -60
  225. package/dist/extensions/agent-browser/lib/orchestration/electron-host/policy.js +0 -86
  226. package/dist/extensions/agent-browser/lib/orchestration/electron-host/probe-collection.js +0 -68
  227. package/dist/extensions/agent-browser/lib/orchestration/electron-host/probe-data.js +0 -169
  228. package/dist/extensions/agent-browser/lib/orchestration/electron-host/probe-presentation.js +0 -182
  229. package/dist/extensions/agent-browser/lib/orchestration/electron-host/probe.js +0 -161
  230. package/dist/extensions/agent-browser/lib/orchestration/electron-host/status.js +0 -167
  231. package/dist/extensions/agent-browser/lib/orchestration/execution-queue.js +0 -98
  232. package/dist/extensions/agent-browser/lib/orchestration/extension-artifact-preflight.js +0 -211
  233. package/dist/extensions/agent-browser/lib/orchestration/extension-artifacts.js +0 -23
  234. package/dist/extensions/agent-browser/lib/orchestration/extension-attachment-replay.js +0 -99
  235. package/dist/extensions/agent-browser/lib/orchestration/extension-branch-restore.js +0 -275
  236. package/dist/extensions/agent-browser/lib/orchestration/extension-code.js +0 -280
  237. package/dist/extensions/agent-browser/lib/orchestration/extension-command-admission.js +0 -303
  238. package/dist/extensions/agent-browser/lib/orchestration/extension-command-output.js +0 -36
  239. package/dist/extensions/agent-browser/lib/orchestration/extension-command-result.js +0 -335
  240. package/dist/extensions/agent-browser/lib/orchestration/extension-command-run.js +0 -227
  241. package/dist/extensions/agent-browser/lib/orchestration/extension-command-state.js +0 -1
  242. package/dist/extensions/agent-browser/lib/orchestration/extension-electron-ownership.js +0 -204
  243. package/dist/extensions/agent-browser/lib/orchestration/extension-execution-locks.js +0 -139
  244. package/dist/extensions/agent-browser/lib/orchestration/extension-execution-queue.js +0 -24
  245. package/dist/extensions/agent-browser/lib/orchestration/extension-host-coordination.js +0 -98
  246. package/dist/extensions/agent-browser/lib/orchestration/extension-host-run.js +0 -295
  247. package/dist/extensions/agent-browser/lib/orchestration/extension-intent-replay.js +0 -41
  248. package/dist/extensions/agent-browser/lib/orchestration/extension-invocation.js +0 -7
  249. package/dist/extensions/agent-browser/lib/orchestration/extension-lifecycle.js +0 -102
  250. package/dist/extensions/agent-browser/lib/orchestration/extension-managed-ownership.js +0 -133
  251. package/dist/extensions/agent-browser/lib/orchestration/extension-observation.js +0 -120
  252. package/dist/extensions/agent-browser/lib/orchestration/extension-prompt.js +0 -180
  253. package/dist/extensions/agent-browser/lib/orchestration/extension-recording.js +0 -290
  254. package/dist/extensions/agent-browser/lib/orchestration/extension-resource-contracts.js +0 -1
  255. package/dist/extensions/agent-browser/lib/orchestration/extension-resource-replay.js +0 -269
  256. package/dist/extensions/agent-browser/lib/orchestration/extension-result-state.js +0 -113
  257. package/dist/extensions/agent-browser/lib/orchestration/extension-runtime.js +0 -146
  258. package/dist/extensions/agent-browser/lib/orchestration/extension-script-leases.js +0 -58
  259. package/dist/extensions/agent-browser/lib/orchestration/extension-tool-boundary.js +0 -62
  260. package/dist/extensions/agent-browser/lib/orchestration/extension-version-check.js +0 -54
  261. package/dist/extensions/agent-browser/lib/orchestration/input-plan-types.js +0 -1
  262. package/dist/extensions/agent-browser/lib/orchestration/input-plan.js +0 -313
  263. package/dist/extensions/agent-browser/lib/orchestration/input-redaction.js +0 -62
  264. package/dist/extensions/agent-browser/lib/orchestration/native-config.js +0 -144
  265. package/dist/extensions/agent-browser/lib/orchestration/native-root-launch.js +0 -77
  266. package/dist/extensions/agent-browser/lib/orchestration/native-session-defaults.js +0 -231
  267. package/dist/extensions/agent-browser/lib/orchestration/operation-paths.js +0 -142
  268. package/dist/extensions/agent-browser/lib/orchestration/output-file.js +0 -276
  269. package/dist/extensions/agent-browser/lib/orchestration/script-mode.js +0 -220
  270. package/dist/extensions/agent-browser/lib/owned-managed-session-context.js +0 -55
  271. package/dist/extensions/agent-browser/lib/page-target-batch.js +0 -118
  272. package/dist/extensions/agent-browser/lib/page-target-guards.js +0 -50
  273. package/dist/extensions/agent-browser/lib/page-target-navigation.js +0 -104
  274. package/dist/extensions/agent-browser/lib/page-target-validation.js +0 -90
  275. package/dist/extensions/agent-browser/lib/parsing.js +0 -30
  276. package/dist/extensions/agent-browser/lib/pi-tool-rendering.js +0 -343
  277. package/dist/extensions/agent-browser/lib/playbook.js +0 -146
  278. package/dist/extensions/agent-browser/lib/process-child.js +0 -284
  279. package/dist/extensions/agent-browser/lib/process-environment.js +0 -48
  280. package/dist/extensions/agent-browser/lib/process-errors.js +0 -23
  281. package/dist/extensions/agent-browser/lib/process-identity.js +0 -127
  282. package/dist/extensions/agent-browser/lib/process-socket-storage.js +0 -256
  283. package/dist/extensions/agent-browser/lib/process-stdout.js +0 -74
  284. package/dist/extensions/agent-browser/lib/process.js +0 -216
  285. package/dist/extensions/agent-browser/lib/prompt-artifacts.js +0 -287
  286. package/dist/extensions/agent-browser/lib/prompt-policy.js +0 -54
  287. package/dist/extensions/agent-browser/lib/read-command.js +0 -41
  288. package/dist/extensions/agent-browser/lib/read-confirmation.js +0 -162
  289. package/dist/extensions/agent-browser/lib/recording-reservations.js +0 -208
  290. package/dist/extensions/agent-browser/lib/redaction-fields.js +0 -75
  291. package/dist/extensions/agent-browser/lib/redaction-json.js +0 -149
  292. package/dist/extensions/agent-browser/lib/redaction-url.js +0 -88
  293. package/dist/extensions/agent-browser/lib/results/action-contracts.js +0 -1
  294. package/dist/extensions/agent-browser/lib/results/action-recommendations.js +0 -38
  295. package/dist/extensions/agent-browser/lib/results/artifact-contracts.js +0 -1
  296. package/dist/extensions/agent-browser/lib/results/artifact-manifest-validation.js +0 -133
  297. package/dist/extensions/agent-browser/lib/results/artifact-manifest.js +0 -173
  298. package/dist/extensions/agent-browser/lib/results/artifact-recommendations.js +0 -73
  299. package/dist/extensions/agent-browser/lib/results/categories.js +0 -152
  300. package/dist/extensions/agent-browser/lib/results/confirmation.js +0 -75
  301. package/dist/extensions/agent-browser/lib/results/contracts.js +0 -1
  302. package/dist/extensions/agent-browser/lib/results/editable-ref-evidence.js +0 -99
  303. package/dist/extensions/agent-browser/lib/results/electron-recommendations.js +0 -83
  304. package/dist/extensions/agent-browser/lib/results/envelope-decoding.js +0 -48
  305. package/dist/extensions/agent-browser/lib/results/envelope.js +0 -198
  306. package/dist/extensions/agent-browser/lib/results/evidence-contracts.js +0 -1
  307. package/dist/extensions/agent-browser/lib/results/failure-recommendations.js +0 -180
  308. package/dist/extensions/agent-browser/lib/results/network-routes.js +0 -133
  309. package/dist/extensions/agent-browser/lib/results/network.js +0 -89
  310. package/dist/extensions/agent-browser/lib/results/next-actions.js +0 -111
  311. package/dist/extensions/agent-browser/lib/results/presentation/artifact-files.js +0 -320
  312. package/dist/extensions/agent-browser/lib/results/presentation/artifact-format.js +0 -138
  313. package/dist/extensions/agent-browser/lib/results/presentation/artifact-images.js +0 -113
  314. package/dist/extensions/agent-browser/lib/results/presentation/artifact-verification.js +0 -145
  315. package/dist/extensions/agent-browser/lib/results/presentation/artifacts.js +0 -165
  316. package/dist/extensions/agent-browser/lib/results/presentation/batch-contracts.js +0 -1
  317. package/dist/extensions/agent-browser/lib/results/presentation/batch-recording.js +0 -118
  318. package/dist/extensions/agent-browser/lib/results/presentation/batch-redaction.js +0 -68
  319. package/dist/extensions/agent-browser/lib/results/presentation/batch-rendering.js +0 -135
  320. package/dist/extensions/agent-browser/lib/results/presentation/batch-step.js +0 -227
  321. package/dist/extensions/agent-browser/lib/results/presentation/batch-summary.js +0 -91
  322. package/dist/extensions/agent-browser/lib/results/presentation/batch.js +0 -123
  323. package/dist/extensions/agent-browser/lib/results/presentation/browser-profile-recovery.js +0 -54
  324. package/dist/extensions/agent-browser/lib/results/presentation/command-presenters.js +0 -216
  325. package/dist/extensions/agent-browser/lib/results/presentation/common.js +0 -81
  326. package/dist/extensions/agent-browser/lib/results/presentation/content.js +0 -119
  327. package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-a11y.js +0 -67
  328. package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-health.js +0 -79
  329. package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-identity.js +0 -199
  330. package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-logs.js +0 -75
  331. package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-network-actions.js +0 -216
  332. package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-network.js +0 -124
  333. package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-redaction.js +0 -64
  334. package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-storage.js +0 -209
  335. package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-stream.js +0 -69
  336. package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-summary.js +0 -222
  337. package/dist/extensions/agent-browser/lib/results/presentation/diagnostics.js +0 -124
  338. package/dist/extensions/agent-browser/lib/results/presentation/early-result.js +0 -70
  339. package/dist/extensions/agent-browser/lib/results/presentation/errors.js +0 -285
  340. package/dist/extensions/agent-browser/lib/results/presentation/input-contracts.js +0 -1
  341. package/dist/extensions/agent-browser/lib/results/presentation/large-output.js +0 -117
  342. package/dist/extensions/agent-browser/lib/results/presentation/navigation.js +0 -231
  343. package/dist/extensions/agent-browser/lib/results/presentation/notices.js +0 -75
  344. package/dist/extensions/agent-browser/lib/results/presentation/observation-contracts.js +0 -1
  345. package/dist/extensions/agent-browser/lib/results/presentation/observation-rendering.js +0 -127
  346. package/dist/extensions/agent-browser/lib/results/presentation/outcomes.js +0 -120
  347. package/dist/extensions/agent-browser/lib/results/presentation/output-completion.js +0 -77
  348. package/dist/extensions/agent-browser/lib/results/presentation/output-spill.js +0 -51
  349. package/dist/extensions/agent-browser/lib/results/presentation/registry.js +0 -145
  350. package/dist/extensions/agent-browser/lib/results/presentation/semantic-action.js +0 -104
  351. package/dist/extensions/agent-browser/lib/results/presentation/skills.js +0 -183
  352. package/dist/extensions/agent-browser/lib/results/presentation/source.js +0 -109
  353. package/dist/extensions/agent-browser/lib/results/presentation.js +0 -19
  354. package/dist/extensions/agent-browser/lib/results/recommendation-contracts.js +0 -1
  355. package/dist/extensions/agent-browser/lib/results/recording.js +0 -88
  356. package/dist/extensions/agent-browser/lib/results/recovery-actions.js +0 -118
  357. package/dist/extensions/agent-browser/lib/results/recovery-next-actions.js +0 -60
  358. package/dist/extensions/agent-browser/lib/results/selector-recovery-target.js +0 -83
  359. package/dist/extensions/agent-browser/lib/results/selector-recovery.js +0 -261
  360. package/dist/extensions/agent-browser/lib/results/snapshot-compact.js +0 -266
  361. package/dist/extensions/agent-browser/lib/results/snapshot-content.js +0 -32
  362. package/dist/extensions/agent-browser/lib/results/snapshot-high-value-controls.js +0 -240
  363. package/dist/extensions/agent-browser/lib/results/snapshot-refs.js +0 -103
  364. package/dist/extensions/agent-browser/lib/results/snapshot-segments.js +0 -383
  365. package/dist/extensions/agent-browser/lib/results/snapshot-spill.js +0 -53
  366. package/dist/extensions/agent-browser/lib/results/snapshot.js +0 -44
  367. package/dist/extensions/agent-browser/lib/results/text.js +0 -44
  368. package/dist/extensions/agent-browser/lib/runtime-args-validation.js +0 -133
  369. package/dist/extensions/agent-browser/lib/runtime-compatibility.js +0 -81
  370. package/dist/extensions/agent-browser/lib/runtime-contracts.js +0 -1
  371. package/dist/extensions/agent-browser/lib/runtime-redaction.js +0 -118
  372. package/dist/extensions/agent-browser/lib/runtime-replay-events.js +0 -144
  373. package/dist/extensions/agent-browser/lib/runtime-session-identity.js +0 -76
  374. package/dist/extensions/agent-browser/lib/runtime-session-plan.js +0 -114
  375. package/dist/extensions/agent-browser/lib/runtime-session-replay.js +0 -123
  376. package/dist/extensions/agent-browser/lib/runtime-tab-correction.js +0 -65
  377. package/dist/extensions/agent-browser/lib/runtime-timeouts.js +0 -28
  378. package/dist/extensions/agent-browser/lib/runtime.js +0 -163
  379. package/dist/extensions/agent-browser/lib/session-identity.js +0 -51
  380. package/dist/extensions/agent-browser/lib/session-page-observation.js +0 -357
  381. package/dist/extensions/agent-browser/lib/session-page-state.js +0 -353
  382. package/dist/extensions/agent-browser/lib/session-page-types.js +0 -1
  383. package/dist/extensions/agent-browser/lib/string-enum-schema.js +0 -8
  384. package/dist/extensions/agent-browser/lib/temp-artifact-budget.js +0 -81
  385. package/dist/extensions/agent-browser/lib/temp-mutation-queue.js +0 -7
  386. package/dist/extensions/agent-browser/lib/temp-root-ownership.js +0 -234
  387. package/dist/extensions/agent-browser/lib/temp-root.js +0 -211
  388. package/dist/extensions/agent-browser/lib/temp.js +0 -91
  389. package/dist/extensions/agent-browser/lib/tool-surface.js +0 -239
  390. package/dist/extensions/agent-browser/lib/upstream-version.js +0 -15
  391. package/dist/extensions/agent-browser/lib/web-search-providers.js +0 -193
  392. package/dist/extensions/agent-browser/lib/web-search-request.js +0 -102
  393. package/dist/extensions/agent-browser/lib/web-search-results.js +0 -281
  394. package/dist/extensions/agent-browser/lib/web-search-schema.js +0 -82
  395. package/dist/extensions/agent-browser/lib/web-search.js +0 -167
  396. package/dist/extensions/agent-browser/lib/webmcp-observation.js +0 -35
  397. package/dist/extensions/agent-browser/lib/windows-stock-launcher.js +0 -96
  398. 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
- }