@browserbasehq/orca 3.5.0-vertex-test → 3.6.0-gemini-cua

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 (290) hide show
  1. package/README.md +7 -15
  2. package/dist/cjs/lib/utils.d.ts +8 -0
  3. package/dist/cjs/lib/utils.js +31 -0
  4. package/dist/cjs/lib/utils.js.map +1 -1
  5. package/dist/cjs/lib/v3/agent/AgentProvider.js +5 -3
  6. package/dist/cjs/lib/v3/agent/AgentProvider.js.map +1 -1
  7. package/dist/cjs/lib/v3/agent/AnthropicCUAClient.js +10 -8
  8. package/dist/cjs/lib/v3/agent/AnthropicCUAClient.js.map +1 -1
  9. package/dist/cjs/lib/v3/agent/GoogleCUAClient.js +124 -28
  10. package/dist/cjs/lib/v3/agent/GoogleCUAClient.js.map +1 -1
  11. package/dist/cjs/lib/v3/agent/utils/captureAriaTreeProbe.d.ts +35 -0
  12. package/dist/cjs/lib/v3/agent/utils/captureAriaTreeProbe.js +38 -0
  13. package/dist/cjs/lib/v3/agent/utils/captureAriaTreeProbe.js.map +1 -0
  14. package/dist/cjs/lib/v3/agent/utils/handleDoneToolCall.js +10 -1
  15. package/dist/cjs/lib/v3/agent/utils/handleDoneToolCall.js.map +1 -1
  16. package/dist/cjs/lib/v3/agent/utils/postStepProbeEvidence.d.ts +19 -0
  17. package/dist/cjs/lib/v3/agent/utils/postStepProbeEvidence.js +54 -0
  18. package/dist/cjs/lib/v3/agent/utils/postStepProbeEvidence.js.map +1 -0
  19. package/dist/cjs/lib/v3/agent/utils/toolOutputEvidence.d.ts +2 -0
  20. package/dist/cjs/lib/v3/agent/utils/toolOutputEvidence.js +62 -0
  21. package/dist/cjs/lib/v3/agent/utils/toolOutputEvidence.js.map +1 -0
  22. package/dist/cjs/lib/v3/agent/utils/wrapEvidenceCallback.d.ts +3 -0
  23. package/dist/cjs/lib/v3/agent/utils/wrapEvidenceCallback.js +25 -0
  24. package/dist/cjs/lib/v3/agent/utils/wrapEvidenceCallback.js.map +1 -0
  25. package/dist/cjs/lib/v3/api.d.ts +1 -0
  26. package/dist/cjs/lib/v3/api.js +37 -16
  27. package/dist/cjs/lib/v3/api.js.map +1 -1
  28. package/dist/cjs/lib/v3/cache/ActCache.js +1 -1
  29. package/dist/cjs/lib/v3/cache/ActCache.js.map +1 -1
  30. package/dist/cjs/lib/v3/cache/utils.d.ts +7 -0
  31. package/dist/cjs/lib/v3/cache/utils.js +19 -0
  32. package/dist/cjs/lib/v3/cache/utils.js.map +1 -1
  33. package/dist/cjs/lib/v3/dom/build/locatorScripts.generated.d.ts +24 -24
  34. package/dist/cjs/lib/v3/dom/build/locatorScripts.generated.js +24 -24
  35. package/dist/cjs/lib/v3/dom/build/locatorScripts.generated.js.map +1 -1
  36. package/dist/cjs/lib/v3/dom/locatorScripts/xpathResolver.js +79 -10
  37. package/dist/cjs/lib/v3/dom/locatorScripts/xpathResolver.js.map +1 -1
  38. package/dist/cjs/lib/v3/handlers/v3AgentHandler.d.ts +3 -1
  39. package/dist/cjs/lib/v3/handlers/v3AgentHandler.js +108 -16
  40. package/dist/cjs/lib/v3/handlers/v3AgentHandler.js.map +1 -1
  41. package/dist/cjs/lib/v3/handlers/v3CuaAgentHandler.d.ts +11 -0
  42. package/dist/cjs/lib/v3/handlers/v3CuaAgentHandler.js +119 -5
  43. package/dist/cjs/lib/v3/handlers/v3CuaAgentHandler.js.map +1 -1
  44. package/dist/cjs/lib/v3/index.d.ts +13 -1
  45. package/dist/cjs/lib/v3/index.js +19 -1
  46. package/dist/cjs/lib/v3/index.js.map +1 -1
  47. package/dist/cjs/lib/v3/launch/local.js +1 -0
  48. package/dist/cjs/lib/v3/launch/local.js.map +1 -1
  49. package/dist/cjs/lib/v3/llm/LLMProvider.d.ts +3 -0
  50. package/dist/cjs/lib/v3/llm/LLMProvider.js +45 -3
  51. package/dist/cjs/lib/v3/llm/LLMProvider.js.map +1 -1
  52. package/dist/cjs/lib/v3/llm/aisdk.js +4 -0
  53. package/dist/cjs/lib/v3/llm/aisdk.js.map +1 -1
  54. package/dist/cjs/lib/v3/llm/anthropicOptions.d.ts +57 -0
  55. package/dist/cjs/lib/v3/llm/anthropicOptions.js +115 -0
  56. package/dist/cjs/lib/v3/llm/anthropicOptions.js.map +1 -0
  57. package/dist/cjs/lib/v3/types/public/agent.d.ts +8 -2
  58. package/dist/cjs/lib/v3/types/public/agent.js +3 -0
  59. package/dist/cjs/lib/v3/types/public/agent.js.map +1 -1
  60. package/dist/cjs/lib/v3/types/public/agentEvidenceEvents.d.ts +85 -0
  61. package/dist/cjs/lib/v3/types/public/agentEvidenceEvents.js +15 -0
  62. package/dist/cjs/lib/v3/types/public/agentEvidenceEvents.js.map +1 -0
  63. package/dist/cjs/lib/v3/types/public/api.d.ts +925 -182
  64. package/dist/cjs/lib/v3/types/public/api.js +138 -20
  65. package/dist/cjs/lib/v3/types/public/api.js.map +1 -1
  66. package/dist/cjs/lib/v3/types/public/clipboard.d.ts +15 -0
  67. package/dist/cjs/lib/v3/types/public/clipboard.js +3 -0
  68. package/dist/cjs/lib/v3/types/public/clipboard.js.map +1 -0
  69. package/dist/cjs/lib/v3/types/public/index.d.ts +2 -0
  70. package/dist/cjs/lib/v3/types/public/index.js +2 -0
  71. package/dist/cjs/lib/v3/types/public/index.js.map +1 -1
  72. package/dist/cjs/lib/v3/types/public/model.d.ts +33 -8
  73. package/dist/cjs/lib/v3/types/public/model.js.map +1 -1
  74. package/dist/cjs/lib/v3/types/public/page.d.ts +29 -0
  75. package/dist/cjs/lib/v3/types/public/page.js.map +1 -1
  76. package/dist/cjs/lib/v3/types/public/sdkErrors.d.ts +3 -0
  77. package/dist/cjs/lib/v3/types/public/sdkErrors.js +8 -2
  78. package/dist/cjs/lib/v3/types/public/sdkErrors.js.map +1 -1
  79. package/dist/cjs/lib/v3/understudy/clipboard.d.ts +24 -0
  80. package/dist/cjs/lib/v3/understudy/clipboard.js +166 -0
  81. package/dist/cjs/lib/v3/understudy/clipboard.js.map +1 -0
  82. package/dist/cjs/lib/v3/understudy/context.d.ts +3 -0
  83. package/dist/cjs/lib/v3/understudy/context.js +15 -0
  84. package/dist/cjs/lib/v3/understudy/context.js.map +1 -1
  85. package/dist/cjs/lib/v3/understudy/page.d.ts +23 -1
  86. package/dist/cjs/lib/v3/understudy/page.js +283 -0
  87. package/dist/cjs/lib/v3/understudy/page.js.map +1 -1
  88. package/dist/cjs/lib/v3/v3.js +19 -7
  89. package/dist/cjs/lib/v3/v3.js.map +1 -1
  90. package/dist/cjs/lib/v3/verifier/errorTaxonomy.d.ts +35 -0
  91. package/dist/cjs/lib/v3/verifier/errorTaxonomy.js +291 -0
  92. package/dist/cjs/lib/v3/verifier/errorTaxonomy.js.map +1 -0
  93. package/dist/cjs/lib/v3/verifier/evidence.d.ts +44 -0
  94. package/dist/cjs/lib/v3/verifier/evidence.js +432 -0
  95. package/dist/cjs/lib/v3/verifier/evidence.js.map +1 -0
  96. package/dist/cjs/lib/v3/verifier/evidenceNormalization.d.ts +7 -0
  97. package/dist/cjs/lib/v3/verifier/evidenceNormalization.js +100 -0
  98. package/dist/cjs/lib/v3/verifier/evidenceNormalization.js.map +1 -0
  99. package/dist/cjs/lib/v3/verifier/index.d.ts +6 -0
  100. package/dist/cjs/lib/v3/verifier/index.js +16 -0
  101. package/dist/cjs/lib/v3/verifier/index.js.map +1 -0
  102. package/dist/cjs/lib/v3/verifier/prompts/batchedRelevance.d.ts +21 -0
  103. package/dist/cjs/lib/v3/verifier/prompts/batchedRelevance.js +71 -0
  104. package/dist/cjs/lib/v3/verifier/prompts/batchedRelevance.js.map +1 -0
  105. package/dist/cjs/lib/v3/verifier/prompts/firstPointOfFailure.d.ts +3 -0
  106. package/dist/cjs/lib/v3/verifier/prompts/firstPointOfFailure.js +166 -0
  107. package/dist/cjs/lib/v3/verifier/prompts/firstPointOfFailure.js.map +1 -0
  108. package/dist/cjs/lib/v3/verifier/prompts/fusedJudgment.d.ts +35 -0
  109. package/dist/cjs/lib/v3/verifier/prompts/fusedJudgment.js +158 -0
  110. package/dist/cjs/lib/v3/verifier/prompts/fusedJudgment.js.map +1 -0
  111. package/dist/cjs/lib/v3/verifier/prompts/fusedOutcome.d.ts +26 -0
  112. package/dist/cjs/lib/v3/verifier/prompts/fusedOutcome.js +137 -0
  113. package/dist/cjs/lib/v3/verifier/prompts/fusedOutcome.js.map +1 -0
  114. package/dist/cjs/lib/v3/verifier/prompts/index.d.ts +8 -0
  115. package/dist/cjs/lib/v3/verifier/prompts/index.js +22 -0
  116. package/dist/cjs/lib/v3/verifier/prompts/index.js.map +1 -0
  117. package/dist/cjs/lib/v3/verifier/prompts/perCriterionScore.d.ts +23 -0
  118. package/dist/cjs/lib/v3/verifier/prompts/perCriterionScore.js +77 -0
  119. package/dist/cjs/lib/v3/verifier/prompts/perCriterionScore.js.map +1 -0
  120. package/dist/cjs/lib/v3/verifier/prompts/render.d.ts +23 -0
  121. package/dist/cjs/lib/v3/verifier/prompts/render.js +45 -0
  122. package/dist/cjs/lib/v3/verifier/prompts/render.js.map +1 -0
  123. package/dist/cjs/lib/v3/verifier/prompts/rubricGeneration.d.ts +16 -0
  124. package/dist/cjs/lib/v3/verifier/prompts/rubricGeneration.js +321 -0
  125. package/dist/cjs/lib/v3/verifier/prompts/rubricGeneration.js.map +1 -0
  126. package/dist/cjs/lib/v3/verifier/prompts/taskValidity.d.ts +1 -0
  127. package/dist/cjs/lib/v3/verifier/prompts/taskValidity.js +116 -0
  128. package/dist/cjs/lib/v3/verifier/prompts/taskValidity.js.map +1 -0
  129. package/dist/cjs/lib/v3/verifier/rubricVerifier.d.ts +91 -0
  130. package/dist/cjs/lib/v3/verifier/rubricVerifier.js +1645 -0
  131. package/dist/cjs/lib/v3/verifier/rubricVerifier.js.map +1 -0
  132. package/dist/cjs/lib/v3/verifier/trajectory.d.ts +50 -0
  133. package/dist/cjs/lib/v3/verifier/trajectory.js +316 -0
  134. package/dist/cjs/lib/v3/verifier/trajectory.js.map +1 -0
  135. package/dist/cjs/lib/v3/verifier/types.d.ts +429 -0
  136. package/dist/cjs/lib/v3/verifier/types.js +3 -0
  137. package/dist/cjs/lib/v3/verifier/types.js.map +1 -0
  138. package/dist/cjs/lib/v3Evaluator.d.ts +14 -4
  139. package/dist/cjs/lib/v3Evaluator.js +189 -1
  140. package/dist/cjs/lib/v3Evaluator.js.map +1 -1
  141. package/dist/cjs/lib/v3LegacyEvaluator.js +5 -1
  142. package/dist/cjs/lib/v3LegacyEvaluator.js.map +1 -1
  143. package/dist/cjs/lib/version.d.ts +1 -1
  144. package/dist/cjs/lib/version.js +1 -1
  145. package/dist/cjs/lib/version.js.map +1 -1
  146. package/dist/esm/lib/utils.d.ts +8 -0
  147. package/dist/esm/lib/utils.js +28 -0
  148. package/dist/esm/lib/utils.js.map +1 -1
  149. package/dist/esm/lib/v3/agent/AgentProvider.js +5 -3
  150. package/dist/esm/lib/v3/agent/AgentProvider.js.map +1 -1
  151. package/dist/esm/lib/v3/agent/AnthropicCUAClient.js +10 -8
  152. package/dist/esm/lib/v3/agent/AnthropicCUAClient.js.map +1 -1
  153. package/dist/esm/lib/v3/agent/GoogleCUAClient.js +124 -28
  154. package/dist/esm/lib/v3/agent/GoogleCUAClient.js.map +1 -1
  155. package/dist/esm/lib/v3/agent/utils/captureAriaTreeProbe.d.ts +35 -0
  156. package/dist/esm/lib/v3/agent/utils/captureAriaTreeProbe.js +35 -0
  157. package/dist/esm/lib/v3/agent/utils/captureAriaTreeProbe.js.map +1 -0
  158. package/dist/esm/lib/v3/agent/utils/handleDoneToolCall.js +10 -1
  159. package/dist/esm/lib/v3/agent/utils/handleDoneToolCall.js.map +1 -1
  160. package/dist/esm/lib/v3/agent/utils/postStepProbeEvidence.d.ts +19 -0
  161. package/dist/esm/lib/v3/agent/utils/postStepProbeEvidence.js +50 -0
  162. package/dist/esm/lib/v3/agent/utils/postStepProbeEvidence.js.map +1 -0
  163. package/dist/esm/lib/v3/agent/utils/toolOutputEvidence.d.ts +2 -0
  164. package/dist/esm/lib/v3/agent/utils/toolOutputEvidence.js +59 -0
  165. package/dist/esm/lib/v3/agent/utils/toolOutputEvidence.js.map +1 -0
  166. package/dist/esm/lib/v3/agent/utils/wrapEvidenceCallback.d.ts +3 -0
  167. package/dist/esm/lib/v3/agent/utils/wrapEvidenceCallback.js +22 -0
  168. package/dist/esm/lib/v3/agent/utils/wrapEvidenceCallback.js.map +1 -0
  169. package/dist/esm/lib/v3/api.d.ts +1 -0
  170. package/dist/esm/lib/v3/api.js +38 -17
  171. package/dist/esm/lib/v3/api.js.map +1 -1
  172. package/dist/esm/lib/v3/cache/ActCache.js +2 -2
  173. package/dist/esm/lib/v3/cache/ActCache.js.map +1 -1
  174. package/dist/esm/lib/v3/cache/utils.d.ts +7 -0
  175. package/dist/esm/lib/v3/cache/utils.js +18 -0
  176. package/dist/esm/lib/v3/cache/utils.js.map +1 -1
  177. package/dist/esm/lib/v3/dom/build/locatorScripts.generated.d.ts +24 -24
  178. package/dist/esm/lib/v3/dom/build/locatorScripts.generated.js +24 -24
  179. package/dist/esm/lib/v3/dom/build/locatorScripts.generated.js.map +1 -1
  180. package/dist/esm/lib/v3/dom/locatorScripts/xpathResolver.js +79 -10
  181. package/dist/esm/lib/v3/dom/locatorScripts/xpathResolver.js.map +1 -1
  182. package/dist/esm/lib/v3/handlers/v3AgentHandler.d.ts +3 -1
  183. package/dist/esm/lib/v3/handlers/v3AgentHandler.js +108 -16
  184. package/dist/esm/lib/v3/handlers/v3AgentHandler.js.map +1 -1
  185. package/dist/esm/lib/v3/handlers/v3CuaAgentHandler.d.ts +11 -0
  186. package/dist/esm/lib/v3/handlers/v3CuaAgentHandler.js +119 -5
  187. package/dist/esm/lib/v3/handlers/v3CuaAgentHandler.js.map +1 -1
  188. package/dist/esm/lib/v3/index.d.ts +13 -1
  189. package/dist/esm/lib/v3/index.js +10 -0
  190. package/dist/esm/lib/v3/index.js.map +1 -1
  191. package/dist/esm/lib/v3/launch/local.js +1 -0
  192. package/dist/esm/lib/v3/launch/local.js.map +1 -1
  193. package/dist/esm/lib/v3/llm/LLMProvider.d.ts +3 -0
  194. package/dist/esm/lib/v3/llm/LLMProvider.js +44 -3
  195. package/dist/esm/lib/v3/llm/LLMProvider.js.map +1 -1
  196. package/dist/esm/lib/v3/llm/aisdk.js +4 -0
  197. package/dist/esm/lib/v3/llm/aisdk.js.map +1 -1
  198. package/dist/esm/lib/v3/llm/anthropicOptions.d.ts +57 -0
  199. package/dist/esm/lib/v3/llm/anthropicOptions.js +106 -0
  200. package/dist/esm/lib/v3/llm/anthropicOptions.js.map +1 -0
  201. package/dist/esm/lib/v3/types/public/agent.d.ts +8 -2
  202. package/dist/esm/lib/v3/types/public/agent.js +3 -0
  203. package/dist/esm/lib/v3/types/public/agent.js.map +1 -1
  204. package/dist/esm/lib/v3/types/public/agentEvidenceEvents.d.ts +85 -0
  205. package/dist/esm/lib/v3/types/public/agentEvidenceEvents.js +14 -0
  206. package/dist/esm/lib/v3/types/public/agentEvidenceEvents.js.map +1 -0
  207. package/dist/esm/lib/v3/types/public/api.d.ts +925 -182
  208. package/dist/esm/lib/v3/types/public/api.js +136 -18
  209. package/dist/esm/lib/v3/types/public/api.js.map +1 -1
  210. package/dist/esm/lib/v3/types/public/clipboard.d.ts +15 -0
  211. package/dist/esm/lib/v3/types/public/clipboard.js +2 -0
  212. package/dist/esm/lib/v3/types/public/clipboard.js.map +1 -0
  213. package/dist/esm/lib/v3/types/public/index.d.ts +2 -0
  214. package/dist/esm/lib/v3/types/public/index.js +2 -0
  215. package/dist/esm/lib/v3/types/public/index.js.map +1 -1
  216. package/dist/esm/lib/v3/types/public/model.d.ts +33 -8
  217. package/dist/esm/lib/v3/types/public/model.js.map +1 -1
  218. package/dist/esm/lib/v3/types/public/page.d.ts +29 -0
  219. package/dist/esm/lib/v3/types/public/page.js.map +1 -1
  220. package/dist/esm/lib/v3/types/public/sdkErrors.d.ts +3 -0
  221. package/dist/esm/lib/v3/types/public/sdkErrors.js +5 -0
  222. package/dist/esm/lib/v3/types/public/sdkErrors.js.map +1 -1
  223. package/dist/esm/lib/v3/understudy/clipboard.d.ts +24 -0
  224. package/dist/esm/lib/v3/understudy/clipboard.js +163 -0
  225. package/dist/esm/lib/v3/understudy/clipboard.js.map +1 -0
  226. package/dist/esm/lib/v3/understudy/context.d.ts +3 -0
  227. package/dist/esm/lib/v3/understudy/context.js +15 -0
  228. package/dist/esm/lib/v3/understudy/context.js.map +1 -1
  229. package/dist/esm/lib/v3/understudy/page.d.ts +23 -1
  230. package/dist/esm/lib/v3/understudy/page.js +284 -1
  231. package/dist/esm/lib/v3/understudy/page.js.map +1 -1
  232. package/dist/esm/lib/v3/v3.js +20 -8
  233. package/dist/esm/lib/v3/v3.js.map +1 -1
  234. package/dist/esm/lib/v3/verifier/errorTaxonomy.d.ts +35 -0
  235. package/dist/esm/lib/v3/verifier/errorTaxonomy.js +285 -0
  236. package/dist/esm/lib/v3/verifier/errorTaxonomy.js.map +1 -0
  237. package/dist/esm/lib/v3/verifier/evidence.d.ts +44 -0
  238. package/dist/esm/lib/v3/verifier/evidence.js +393 -0
  239. package/dist/esm/lib/v3/verifier/evidence.js.map +1 -0
  240. package/dist/esm/lib/v3/verifier/evidenceNormalization.d.ts +7 -0
  241. package/dist/esm/lib/v3/verifier/evidenceNormalization.js +93 -0
  242. package/dist/esm/lib/v3/verifier/evidenceNormalization.js.map +1 -0
  243. package/dist/esm/lib/v3/verifier/index.d.ts +6 -0
  244. package/dist/esm/lib/v3/verifier/index.js +3 -0
  245. package/dist/esm/lib/v3/verifier/index.js.map +1 -0
  246. package/dist/esm/lib/v3/verifier/prompts/batchedRelevance.d.ts +21 -0
  247. package/dist/esm/lib/v3/verifier/prompts/batchedRelevance.js +68 -0
  248. package/dist/esm/lib/v3/verifier/prompts/batchedRelevance.js.map +1 -0
  249. package/dist/esm/lib/v3/verifier/prompts/firstPointOfFailure.d.ts +3 -0
  250. package/dist/esm/lib/v3/verifier/prompts/firstPointOfFailure.js +162 -0
  251. package/dist/esm/lib/v3/verifier/prompts/firstPointOfFailure.js.map +1 -0
  252. package/dist/esm/lib/v3/verifier/prompts/fusedJudgment.d.ts +35 -0
  253. package/dist/esm/lib/v3/verifier/prompts/fusedJudgment.js +155 -0
  254. package/dist/esm/lib/v3/verifier/prompts/fusedJudgment.js.map +1 -0
  255. package/dist/esm/lib/v3/verifier/prompts/fusedOutcome.d.ts +26 -0
  256. package/dist/esm/lib/v3/verifier/prompts/fusedOutcome.js +134 -0
  257. package/dist/esm/lib/v3/verifier/prompts/fusedOutcome.js.map +1 -0
  258. package/dist/esm/lib/v3/verifier/prompts/index.d.ts +8 -0
  259. package/dist/esm/lib/v3/verifier/prompts/index.js +9 -0
  260. package/dist/esm/lib/v3/verifier/prompts/index.js.map +1 -0
  261. package/dist/esm/lib/v3/verifier/prompts/perCriterionScore.d.ts +23 -0
  262. package/dist/esm/lib/v3/verifier/prompts/perCriterionScore.js +74 -0
  263. package/dist/esm/lib/v3/verifier/prompts/perCriterionScore.js.map +1 -0
  264. package/dist/esm/lib/v3/verifier/prompts/render.d.ts +23 -0
  265. package/dist/esm/lib/v3/verifier/prompts/render.js +41 -0
  266. package/dist/esm/lib/v3/verifier/prompts/render.js.map +1 -0
  267. package/dist/esm/lib/v3/verifier/prompts/rubricGeneration.d.ts +16 -0
  268. package/dist/esm/lib/v3/verifier/prompts/rubricGeneration.js +318 -0
  269. package/dist/esm/lib/v3/verifier/prompts/rubricGeneration.js.map +1 -0
  270. package/dist/esm/lib/v3/verifier/prompts/taskValidity.d.ts +1 -0
  271. package/dist/esm/lib/v3/verifier/prompts/taskValidity.js +113 -0
  272. package/dist/esm/lib/v3/verifier/prompts/taskValidity.js.map +1 -0
  273. package/dist/esm/lib/v3/verifier/rubricVerifier.d.ts +91 -0
  274. package/dist/esm/lib/v3/verifier/rubricVerifier.js +1640 -0
  275. package/dist/esm/lib/v3/verifier/rubricVerifier.js.map +1 -0
  276. package/dist/esm/lib/v3/verifier/trajectory.d.ts +50 -0
  277. package/dist/esm/lib/v3/verifier/trajectory.js +273 -0
  278. package/dist/esm/lib/v3/verifier/trajectory.js.map +1 -0
  279. package/dist/esm/lib/v3/verifier/types.d.ts +429 -0
  280. package/dist/esm/lib/v3/verifier/types.js +2 -0
  281. package/dist/esm/lib/v3/verifier/types.js.map +1 -0
  282. package/dist/esm/lib/v3Evaluator.d.ts +14 -4
  283. package/dist/esm/lib/v3Evaluator.js +189 -1
  284. package/dist/esm/lib/v3Evaluator.js.map +1 -1
  285. package/dist/esm/lib/v3LegacyEvaluator.js +5 -1
  286. package/dist/esm/lib/v3LegacyEvaluator.js.map +1 -1
  287. package/dist/esm/lib/version.d.ts +1 -1
  288. package/dist/esm/lib/version.js +1 -1
  289. package/dist/esm/lib/version.js.map +1 -1
  290. package/package.json +18 -12
@@ -0,0 +1,429 @@
1
+ /**
2
+ * Shared verifier types for trajectories, rubrics, evidence, and results.
3
+ *
4
+ * The verifier consumes saved trajectories instead of a live browser. DOM and
5
+ * Hybrid runs preserve tool-return text/JSON evidence, while CUA runs preserve
6
+ * screenshots sent to the provider plus independent harness probes.
7
+ */
8
+ import type { LLMClient } from "../llm/LLMClient.js";
9
+ import type { LogLine } from "../types/public/logs.js";
10
+ /** Token usage for one or more LLM calls. Matches AgentResult.usage shape. */
11
+ export interface TrajectoryUsage {
12
+ input_tokens: number;
13
+ output_tokens: number;
14
+ reasoning_tokens?: number;
15
+ cached_input_tokens?: number;
16
+ inference_time_ms?: number;
17
+ }
18
+ /** A single criterion in a Stagehand rubric. */
19
+ export interface RubricCriterion {
20
+ /** Short name of the criterion (e.g., "Add ground beef to cart"). */
21
+ criterion: string;
22
+ /** What to evaluate and how to award partial credit. */
23
+ description: string;
24
+ /** Maximum points for this criterion. */
25
+ maxPoints: number;
26
+ /**
27
+ * Applicability rule for situational criteria. When this condition is not
28
+ * met, the criterion is excluded from scoring rather than counted as failed.
29
+ */
30
+ condition?: string;
31
+ }
32
+ /** A rubric — list of criteria for a task. */
33
+ export interface Rubric {
34
+ items: RubricCriterion[];
35
+ }
36
+ /**
37
+ * Spec for a single task being verified. Carried both at runtime and into the
38
+ * verifier alongside the trajectory.
39
+ */
40
+ export interface TaskSpec {
41
+ /** Stable identifier (e.g., "united_13" for WebTailBench, task_id for Mind2Web). */
42
+ id: string;
43
+ /** Task instruction shown to the agent. */
44
+ instruction: string;
45
+ /** Starting URL, if any. */
46
+ initUrl?: string;
47
+ /** Rubric carried by the dataset or generated by a verifier backend. */
48
+ precomputedRubric?: Rubric;
49
+ /** Optional reference answer (set when dataset ships one). */
50
+ expectedAnswer?: string;
51
+ }
52
+ /**
53
+ * A single modality unit in tier-1 agent evidence. Mirrors the shape of
54
+ * ModelMessage content parts so we can reproduce what the LLM ingested.
55
+ */
56
+ export type AgentEvidenceModality = {
57
+ type: "text";
58
+ content: string;
59
+ } | {
60
+ type: "image";
61
+ bytes: Buffer;
62
+ mediaType: string;
63
+ } | {
64
+ type: "json";
65
+ content: unknown;
66
+ };
67
+ /**
68
+ * Tier 1 — exactly the bytes/strings/objects the agent's LLM ingested as the
69
+ * tool result for this step.
70
+ *
71
+ * Modes:
72
+ * - CUA: usually a single image modality (the screenshot sent to the provider).
73
+ * - Hybrid: tool result with optional screenshotBase64 → one image + one text.
74
+ * - DOM: tool returns (extract JSON, ariaTree text, etc.) → text/json modalities.
75
+ */
76
+ export interface AgentEvidence {
77
+ modalities: AgentEvidenceModality[];
78
+ }
79
+ /**
80
+ * Tier 2 — independent harness probes around this step.
81
+ *
82
+ * If a probe wasn't captured, the field is absent (not null).
83
+ */
84
+ export interface ProbeEvidence {
85
+ /** URL after the step's tool execution. */
86
+ url?: string;
87
+ /**
88
+ * Bus screenshot captured after the step. Path on disk is preferred once
89
+ * persisted; in-memory Buffer is used during a live run.
90
+ */
91
+ screenshot?: Buffer;
92
+ /** Reference to the persisted screenshot file under the trajectory dir. */
93
+ screenshotPath?: string;
94
+ /** Accessibility tree snapshot. */
95
+ ariaTree?: string;
96
+ /** Verifier-requested probes, keyed by criterion id. */
97
+ onDemand?: Record<string, unknown>;
98
+ }
99
+ /** Outcome of a single tool execution as seen by the harness. */
100
+ export interface ToolOutput {
101
+ ok: boolean;
102
+ /**
103
+ * The tool's return value. Same payload that flowed into agentEvidence
104
+ * modalities, but in its native shape (e.g., the extract result, the act
105
+ * describe-string) rather than serialized for the LLM.
106
+ */
107
+ result: unknown;
108
+ error?: string;
109
+ }
110
+ /** One step in a trajectory: action + reasoning + evidence + outcome. */
111
+ export interface TrajectoryStep {
112
+ actionName: string;
113
+ actionArgs: Record<string, unknown>;
114
+ /** From AgentAction.reasoning. May be empty for tools that don't surface reasoning. */
115
+ reasoning: string;
116
+ agentEvidence: AgentEvidence;
117
+ probeEvidence: ProbeEvidence;
118
+ toolOutput: ToolOutput;
119
+ }
120
+ /** Terminal status of the agent run. */
121
+ export type TrajectoryStatus = "complete" | "aborted" | "stalled" | "error";
122
+ /**
123
+ * Full trajectory for one task run.
124
+ *
125
+ * The on-disk layout is one directory per task:
126
+ *
127
+ * .trajectories/<run-id>/<task-id>/
128
+ * ├── task_data.json — TaskSpec + result metadata
129
+ * ├── trajectory.json — this object, with image paths instead of bytes
130
+ * ├── screenshots/
131
+ * │ ├── probe/<N>.png — tier-2 probe screenshot per step
132
+ * │ ├── probe/final.png — final terminal observation screenshot
133
+ * │ └── agent/<N>.png — tier-1 image the model received per step
134
+ * ├── scores/
135
+ * │ └── result.json — Result from V3Evaluator.verify()
136
+ * └── core.log — captured action log
137
+ */
138
+ export interface Trajectory {
139
+ task: TaskSpec;
140
+ steps: TrajectoryStep[];
141
+ finalAnswer?: string;
142
+ /** Terminal page observation captured after the agent finishes. */
143
+ finalObservation?: ProbeEvidence;
144
+ status: TrajectoryStatus;
145
+ usage: TrajectoryUsage;
146
+ }
147
+ /** A single screenshot kept by Step 1, ready for downstream relevance scoring. */
148
+ export interface CanonicalScreenshot {
149
+ /** 0-based position in the kept-screenshots array. Stable across the pipeline. */
150
+ canonicalIndex: number;
151
+ /**
152
+ * 0-based position in `Trajectory.steps` this screenshot came from
153
+ * (steps.length for the final observation). Lets downstream prompts
154
+ * cross-reference the action history.
155
+ */
156
+ originalStepIndex: number;
157
+ /** The resized PNG/JPEG buffer (or native bytes if sharp unavailable). */
158
+ bytes: Buffer;
159
+ /** MIME media type. Always "image/png" after the optional resize. */
160
+ mediaType: string;
161
+ /** Reason this frame was kept: "first" / "last" / "diverges". */
162
+ keptReason: "first" | "last" | "diverges" | "no-dedup";
163
+ }
164
+ /**
165
+ * A text evidence point sourced from tier-2 probes or tier-1 tool outputs.
166
+ * These feed the same relevance + scoring path as screenshots, letting DOM
167
+ * and hybrid agents preserve extract/aria/tool-return evidence without a
168
+ * separate verifier architecture.
169
+ */
170
+ export interface CanonicalTextEvidence {
171
+ /** 0-based position in the combined evidence-point array. */
172
+ canonicalIndex: number;
173
+ originalStepIndex: number;
174
+ /** Where the text came from. */
175
+ source: "probe-aria" | "agent-text" | "agent-json" | "tool-output";
176
+ /** The text payload, already truncated. */
177
+ content: string;
178
+ }
179
+ export type CanonicalEvidence = CanonicalScreenshot | CanonicalTextEvidence;
180
+ /** Result of Step 1 evidence loading. */
181
+ export interface EvidenceLoadResult {
182
+ /** Kept frames, in chronological order. */
183
+ screenshots: CanonicalScreenshot[];
184
+ /**
185
+ * Maps trajectory step position → canonical index in `screenshots`. Steps
186
+ * whose screenshots were deduplicated point to the surviving canonical frame
187
+ * (typically the prior kept frame). Useful for "find me the screenshot for
188
+ * step K" lookups in downstream prompts.
189
+ */
190
+ stepIndexToCanonical: Map<number, number>;
191
+ /** Number of original frames considered. */
192
+ originalCount: number;
193
+ /** Number of frames kept post-dedup (== screenshots.length). */
194
+ keptCount: number;
195
+ /** Effective thresholds used (resolved from env). */
196
+ thresholds: {
197
+ ssim: number;
198
+ mse: number;
199
+ resize: number;
200
+ };
201
+ }
202
+ /** Options for evidence loading; primarily test seams over the defaults. */
203
+ export interface EvidenceLoadOptions {
204
+ /** SSIM similarity threshold for dedup (default 0.75). */
205
+ ssimThreshold?: number;
206
+ /** MSE similarity threshold for dedup (default 30). */
207
+ mseThreshold?: number;
208
+ /** Scale factor applied before relevance scoring (default 0.7). */
209
+ imageResize?: number;
210
+ }
211
+ /** Score for a single rubric criterion after evidence analysis + rescoring. */
212
+ export interface CriterionScore {
213
+ /** Matches RubricCriterion.criterion (the criterion's short name). */
214
+ criterion: string;
215
+ /** Maximum possible points for this criterion. */
216
+ maxPoints: number;
217
+ /**
218
+ * Points earned after evidence analysis. Null when the criterion is
219
+ * conditional and its condition was not met — excluded from both numerator
220
+ * and denominator in the process score.
221
+ */
222
+ earnedPoints: number | null;
223
+ /** Verifier's explanation for the score. */
224
+ explanation: string;
225
+ /**
226
+ * True if the criterion is conditional and its condition was determined to
227
+ * be met. Absent for non-conditional criteria.
228
+ */
229
+ conditionMet?: boolean;
230
+ /**
231
+ * Set when the verifier had no evidence to ground this criterion in either
232
+ * tier. Treated as uncontrollable failure (full credit) but surfaced here
233
+ * so dashboards can flag low-confidence results.
234
+ */
235
+ evidenceInsufficient?: boolean;
236
+ }
237
+ /**
238
+ * Earliest step where the agent's trajectory went off-track, classified
239
+ * against the error taxonomy (7 top-level categories, 1.1–7.4 sub-codes).
240
+ */
241
+ export interface FirstPointOfFailure {
242
+ stepIndex: number;
243
+ /** Sub-code from the error taxonomy (e.g., "2.3" for a specific hallucination type). */
244
+ errorCode: string;
245
+ /** Top-level category name (Selection, Hallucination, etc.). */
246
+ category: string;
247
+ /** Verifier's reasoning for selecting this point. */
248
+ description?: string;
249
+ }
250
+ /**
251
+ * Structured observation surfaced by the verifier that another agent or
252
+ * tooling could act on. Findings are emitted opportunistically by Step 8
253
+ * (outcome verification) when the verifier notices actionable patterns —
254
+ * repeated tool-call failures, ambiguous task specs, evidence gaps, etc.
255
+ *
256
+ * Not produced for every task: when nothing actionable surfaces, the
257
+ * `findings` array on the EvaluationResult is empty. Consumers should treat the
258
+ * field as advisory, not as part of the formal score.
259
+ */
260
+ export interface VerifierFinding {
261
+ /**
262
+ * Category of the observation. Open-ended enum — additional categories may
263
+ * be added as verifier backends surface new failure modes.
264
+ */
265
+ category: "agent_tool_usage" | "agent_strategy" | "rubric_quality" | "trajectory_capture" | "task_specification" | "verifier_uncertainty" | "other";
266
+ /** Impact: info (FYI), warning (worth investigating), blocking (broke the task). */
267
+ severity: "info" | "warning" | "blocking";
268
+ /** What the verifier noticed. Plain prose, grounded in evidence from the trajectory. */
269
+ description: string;
270
+ /**
271
+ * Optional concrete next action another agent could take. Should be
272
+ * specific enough that it can be acted on without further reasoning —
273
+ * e.g., "Try double_click instead of triple_click to clear placeholder
274
+ * text on this form field."
275
+ */
276
+ suggestedAction?: string;
277
+ /** Step indices in the trajectory where this pattern showed up. */
278
+ relatedSteps?: number[];
279
+ }
280
+ /** Stable debugging summary emitted by verifier backends. */
281
+ export interface VerifierRawSteps {
282
+ backend?: "legacy" | "verifier";
283
+ reason?: string;
284
+ primaryIntent?: string;
285
+ reasoning?: string;
286
+ rubricSource?: "precomputed" | "generated" | "none";
287
+ approach?: "a" | "b" | "outcome-only";
288
+ optionalsMode?: "folded" | "separate" | "skip";
289
+ totalEarned?: number;
290
+ totalMax?: number;
291
+ evidenceImages?: number;
292
+ evidenceTexts?: number;
293
+ evidenceOriginalScreenshots?: number;
294
+ screenshotsAttached?: number;
295
+ legacyEvaluation?: string;
296
+ screenshotCount?: number;
297
+ }
298
+ /** Task-validity classification: whether the task is even answerable. */
299
+ export interface TaskValidity {
300
+ /** True if the task is underspecified / has multiple valid interpretations. */
301
+ isAmbiguous: boolean;
302
+ /** Explanation for why the task is ambiguous, when available. */
303
+ ambiguityReason?: string;
304
+ /** True if the task is impossible / illegal / NSFW / otherwise infeasible. */
305
+ isInvalid: boolean;
306
+ /** Explanation for why the task is invalid, when available. */
307
+ invalidReason?: string;
308
+ /** Optional sub-codes from the task-classification taxonomy. */
309
+ ambiguityCodes?: string[];
310
+ invalidTaskCodes?: string[];
311
+ }
312
+ /**
313
+ * Evaluator output. Legacy evaluation may only populate outcome fields; richer
314
+ * verifier backends can also populate process scoring and diagnostics.
315
+ *
316
+ * Process and outcome are deliberately independent when both are present:
317
+ * an agent can follow the right steps but get blocked (high process, low
318
+ * outcome), or succeed through an unexpected path (variable process, high
319
+ * outcome).
320
+ */
321
+ export interface EvaluationResult {
322
+ /** Did the agent accomplish the task from the user's perspective? */
323
+ outcomeSuccess: boolean;
324
+ /** Human-readable explanation for the outcome. */
325
+ explanation?: string;
326
+ /** Aggregated earned/max across applicable criteria, in [0, 1]. */
327
+ processScore?: number;
328
+ /** Per-criterion breakdown after rescoring. */
329
+ perCriterion?: CriterionScore[];
330
+ /** Step 9a — first step where the trajectory went off-track, if any. */
331
+ firstPointOfFailure?: FirstPointOfFailure;
332
+ /** Step 10 — task-itself ambiguity / validity. */
333
+ taskValidity?: TaskValidity;
334
+ /**
335
+ * Ids (RubricCriterion.criterion strings) of criteria where neither tier of
336
+ * evidence resolved the question. Treated as uncontrollable → full credit,
337
+ * but flagged here so consumers can decide whether to discount the score.
338
+ */
339
+ evidenceInsufficient?: string[];
340
+ /**
341
+ * Structured observations from the verifier that a downstream tool or
342
+ * follow-up agent could act on. Opportunistic — empty when the verifier
343
+ * doesn't notice anything actionable. Not part of the score; advisory.
344
+ */
345
+ findings?: VerifierFinding[];
346
+ /** Debugging summary from the active evaluator backend. */
347
+ rawSteps?: VerifierRawSteps;
348
+ }
349
+ /**
350
+ * Verifier interface. Implementations consume a Trajectory and return an
351
+ * EvaluationResult — they MUST NOT touch a live browser.
352
+ */
353
+ export interface Verifier {
354
+ verify(trajectory: Trajectory): Promise<EvaluationResult>;
355
+ }
356
+ export interface RubricVerifierOptions {
357
+ /** Factory that returns a configured LLMClient. Called per pipeline step so callers can supply step-specific clients. */
358
+ getClient: () => LLMClient;
359
+ /** Optional factory for rubric generation so callers can route it to a stronger model. */
360
+ getRubricGenClient?: () => LLMClient;
361
+ /** Logger; defaults to a no-op so the verifier stays quiet inside V3Evaluator. */
362
+ logger?: (line: LogLine) => void;
363
+ /**
364
+ * Override any verifier knob. Env vars supply the defaults; values here win.
365
+ * Useful for tests and for cross-verify sweeps that want different budgets
366
+ * per run.
367
+ */
368
+ config?: Partial<VerifierConfig>;
369
+ }
370
+ /**
371
+ * Resolved verifier knobs. Constructed once from env (and optional overrides)
372
+ * by RubricVerifier's constructor; subsequent verify() calls can pass a
373
+ * Partial to shift any field.
374
+ */
375
+ export interface VerifierConfig {
376
+ /** Which pipeline path to take: per-criterion (a), fused (b), or skip rubric entirely (outcome-only). */
377
+ approach: "a" | "b" | "outcome-only";
378
+ /** Folded (in fused call), separate (own calls), or skip (omit). */
379
+ optionalSteps: "folded" | "separate" | "skip";
380
+ /** Top-K evidence points selected per criterion. */
381
+ topK: number;
382
+ /** Batch size for the relevance-scoring LLM call. */
383
+ relevanceBatchSize: number;
384
+ /** Image cap on the outcome-only path. */
385
+ outcomeMaxImages: number;
386
+ /** Concurrent LLM calls across batches / criteria. */
387
+ maxParallel: number;
388
+ /** Token budgets for the three evidence channels. */
389
+ evidenceTokenBudget: number;
390
+ outcomeEvidenceTokenBudget: number;
391
+ actionHistoryTokenBudget: number;
392
+ /** Per-section character limits applied during evidence-text assembly. */
393
+ truncation: {
394
+ /** Master switch: when true, all per-section limits go to MAX_SAFE_INTEGER. */
395
+ disabled: boolean;
396
+ evidenceTextPreview: number;
397
+ groupedEvidenceText: number;
398
+ buildEvidenceText: number;
399
+ buildEvidenceAria: number;
400
+ actionHistoryReasoning: number;
401
+ };
402
+ }
403
+ export interface ErrorTaxonomySubCategory {
404
+ /** Sub-code (e.g., "2.3"). */
405
+ code: string;
406
+ /** Human-readable name (e.g., "Output fabrication"). */
407
+ name: string;
408
+ /** Detailed description ported from the .md. Markdown formatting preserved. */
409
+ description: string;
410
+ }
411
+ export interface ErrorTaxonomyCategory {
412
+ /** Top-level number (1-8). */
413
+ number: number;
414
+ /** Top-level name (e.g., "Hallucination Errors"). */
415
+ name: string;
416
+ /** One-sentence summary of the category. */
417
+ summary: string;
418
+ /** Sub-categories. The last one is always an "Other" catch-all. */
419
+ subCategories: ErrorTaxonomySubCategory[];
420
+ }
421
+ export interface ParseFailureStepNumbersOptions {
422
+ /**
423
+ * Maximum unique step numbers to expand from ranges. Protects the verifier
424
+ * from malformed model output such as "0-2147483647".
425
+ */
426
+ maxExpandedSteps?: number;
427
+ /** Optional inclusive upper bound for accepted step numbers. */
428
+ maxStep?: number;
429
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../lib/v3/verifier/types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Shared verifier types for trajectories, rubrics, evidence, and results.\n *\n * The verifier consumes saved trajectories instead of a live browser. DOM and\n * Hybrid runs preserve tool-return text/JSON evidence, while CUA runs preserve\n * screenshots sent to the provider plus independent harness probes.\n */\nimport type { LLMClient } from \"../llm/LLMClient.js\";\nimport type { LogLine } from \"../types/public/logs.js\";\n\n/** Token usage for one or more LLM calls. Matches AgentResult.usage shape. */\nexport interface TrajectoryUsage {\n input_tokens: number;\n output_tokens: number;\n reasoning_tokens?: number;\n cached_input_tokens?: number;\n inference_time_ms?: number;\n}\n\n/** A single criterion in a Stagehand rubric. */\nexport interface RubricCriterion {\n /** Short name of the criterion (e.g., \"Add ground beef to cart\"). */\n criterion: string;\n /** What to evaluate and how to award partial credit. */\n description: string;\n /** Maximum points for this criterion. */\n maxPoints: number;\n /**\n * Applicability rule for situational criteria. When this condition is not\n * met, the criterion is excluded from scoring rather than counted as failed.\n */\n condition?: string;\n}\n\n/** A rubric — list of criteria for a task. */\nexport interface Rubric {\n items: RubricCriterion[];\n}\n\n/**\n * Spec for a single task being verified. Carried both at runtime and into the\n * verifier alongside the trajectory.\n */\nexport interface TaskSpec {\n /** Stable identifier (e.g., \"united_13\" for WebTailBench, task_id for Mind2Web). */\n id: string;\n /** Task instruction shown to the agent. */\n instruction: string;\n /** Starting URL, if any. */\n initUrl?: string;\n /** Rubric carried by the dataset or generated by a verifier backend. */\n precomputedRubric?: Rubric;\n /** Optional reference answer (set when dataset ships one). */\n expectedAnswer?: string;\n}\n\n/**\n * A single modality unit in tier-1 agent evidence. Mirrors the shape of\n * ModelMessage content parts so we can reproduce what the LLM ingested.\n */\nexport type AgentEvidenceModality =\n | { type: \"text\"; content: string }\n | { type: \"image\"; bytes: Buffer; mediaType: string }\n | { type: \"json\"; content: unknown };\n\n/**\n * Tier 1 — exactly the bytes/strings/objects the agent's LLM ingested as the\n * tool result for this step.\n *\n * Modes:\n * - CUA: usually a single image modality (the screenshot sent to the provider).\n * - Hybrid: tool result with optional screenshotBase64 → one image + one text.\n * - DOM: tool returns (extract JSON, ariaTree text, etc.) → text/json modalities.\n */\nexport interface AgentEvidence {\n modalities: AgentEvidenceModality[];\n}\n\n/**\n * Tier 2 — independent harness probes around this step.\n *\n * If a probe wasn't captured, the field is absent (not null).\n */\nexport interface ProbeEvidence {\n /** URL after the step's tool execution. */\n url?: string;\n /**\n * Bus screenshot captured after the step. Path on disk is preferred once\n * persisted; in-memory Buffer is used during a live run.\n */\n screenshot?: Buffer;\n /** Reference to the persisted screenshot file under the trajectory dir. */\n screenshotPath?: string;\n /** Accessibility tree snapshot. */\n ariaTree?: string;\n /** Verifier-requested probes, keyed by criterion id. */\n onDemand?: Record<string, unknown>;\n}\n\n/** Outcome of a single tool execution as seen by the harness. */\nexport interface ToolOutput {\n ok: boolean;\n /**\n * The tool's return value. Same payload that flowed into agentEvidence\n * modalities, but in its native shape (e.g., the extract result, the act\n * describe-string) rather than serialized for the LLM.\n */\n result: unknown;\n error?: string;\n}\n\n/** One step in a trajectory: action + reasoning + evidence + outcome. */\nexport interface TrajectoryStep {\n actionName: string;\n actionArgs: Record<string, unknown>;\n /** From AgentAction.reasoning. May be empty for tools that don't surface reasoning. */\n reasoning: string;\n agentEvidence: AgentEvidence;\n probeEvidence: ProbeEvidence;\n toolOutput: ToolOutput;\n}\n\n/** Terminal status of the agent run. */\nexport type TrajectoryStatus = \"complete\" | \"aborted\" | \"stalled\" | \"error\";\n\n/**\n * Full trajectory for one task run.\n *\n * The on-disk layout is one directory per task:\n *\n * .trajectories/<run-id>/<task-id>/\n * ├── task_data.json — TaskSpec + result metadata\n * ├── trajectory.json — this object, with image paths instead of bytes\n * ├── screenshots/\n * │ ├── probe/<N>.png — tier-2 probe screenshot per step\n * │ ├── probe/final.png — final terminal observation screenshot\n * │ └── agent/<N>.png — tier-1 image the model received per step\n * ├── scores/\n * │ └── result.json — Result from V3Evaluator.verify()\n * └── core.log — captured action log\n */\nexport interface Trajectory {\n task: TaskSpec;\n steps: TrajectoryStep[];\n finalAnswer?: string;\n /** Terminal page observation captured after the agent finishes. */\n finalObservation?: ProbeEvidence;\n status: TrajectoryStatus;\n usage: TrajectoryUsage;\n}\n\n/** A single screenshot kept by Step 1, ready for downstream relevance scoring. */\nexport interface CanonicalScreenshot {\n /** 0-based position in the kept-screenshots array. Stable across the pipeline. */\n canonicalIndex: number;\n /**\n * 0-based position in `Trajectory.steps` this screenshot came from\n * (steps.length for the final observation). Lets downstream prompts\n * cross-reference the action history.\n */\n originalStepIndex: number;\n /** The resized PNG/JPEG buffer (or native bytes if sharp unavailable). */\n bytes: Buffer;\n /** MIME media type. Always \"image/png\" after the optional resize. */\n mediaType: string;\n /** Reason this frame was kept: \"first\" / \"last\" / \"diverges\". */\n keptReason: \"first\" | \"last\" | \"diverges\" | \"no-dedup\";\n}\n\n/**\n * A text evidence point sourced from tier-2 probes or tier-1 tool outputs.\n * These feed the same relevance + scoring path as screenshots, letting DOM\n * and hybrid agents preserve extract/aria/tool-return evidence without a\n * separate verifier architecture.\n */\nexport interface CanonicalTextEvidence {\n /** 0-based position in the combined evidence-point array. */\n canonicalIndex: number;\n originalStepIndex: number;\n /** Where the text came from. */\n source: \"probe-aria\" | \"agent-text\" | \"agent-json\" | \"tool-output\";\n /** The text payload, already truncated. */\n content: string;\n}\n\nexport type CanonicalEvidence = CanonicalScreenshot | CanonicalTextEvidence;\n\n/** Result of Step 1 evidence loading. */\nexport interface EvidenceLoadResult {\n /** Kept frames, in chronological order. */\n screenshots: CanonicalScreenshot[];\n /**\n * Maps trajectory step position → canonical index in `screenshots`. Steps\n * whose screenshots were deduplicated point to the surviving canonical frame\n * (typically the prior kept frame). Useful for \"find me the screenshot for\n * step K\" lookups in downstream prompts.\n */\n stepIndexToCanonical: Map<number, number>;\n /** Number of original frames considered. */\n originalCount: number;\n /** Number of frames kept post-dedup (== screenshots.length). */\n keptCount: number;\n /** Effective thresholds used (resolved from env). */\n thresholds: {\n ssim: number;\n mse: number;\n resize: number;\n };\n}\n\n/** Options for evidence loading; primarily test seams over the defaults. */\nexport interface EvidenceLoadOptions {\n /** SSIM similarity threshold for dedup (default 0.75). */\n ssimThreshold?: number;\n /** MSE similarity threshold for dedup (default 30). */\n mseThreshold?: number;\n /** Scale factor applied before relevance scoring (default 0.7). */\n imageResize?: number;\n}\n\n/** Score for a single rubric criterion after evidence analysis + rescoring. */\nexport interface CriterionScore {\n /** Matches RubricCriterion.criterion (the criterion's short name). */\n criterion: string;\n /** Maximum possible points for this criterion. */\n maxPoints: number;\n /**\n * Points earned after evidence analysis. Null when the criterion is\n * conditional and its condition was not met — excluded from both numerator\n * and denominator in the process score.\n */\n earnedPoints: number | null;\n /** Verifier's explanation for the score. */\n explanation: string;\n /**\n * True if the criterion is conditional and its condition was determined to\n * be met. Absent for non-conditional criteria.\n */\n conditionMet?: boolean;\n /**\n * Set when the verifier had no evidence to ground this criterion in either\n * tier. Treated as uncontrollable failure (full credit) but surfaced here\n * so dashboards can flag low-confidence results.\n */\n evidenceInsufficient?: boolean;\n}\n\n/**\n * Earliest step where the agent's trajectory went off-track, classified\n * against the error taxonomy (7 top-level categories, 1.1–7.4 sub-codes).\n */\nexport interface FirstPointOfFailure {\n stepIndex: number;\n /** Sub-code from the error taxonomy (e.g., \"2.3\" for a specific hallucination type). */\n errorCode: string;\n /** Top-level category name (Selection, Hallucination, etc.). */\n category: string;\n /** Verifier's reasoning for selecting this point. */\n description?: string;\n}\n\n/**\n * Structured observation surfaced by the verifier that another agent or\n * tooling could act on. Findings are emitted opportunistically by Step 8\n * (outcome verification) when the verifier notices actionable patterns —\n * repeated tool-call failures, ambiguous task specs, evidence gaps, etc.\n *\n * Not produced for every task: when nothing actionable surfaces, the\n * `findings` array on the EvaluationResult is empty. Consumers should treat the\n * field as advisory, not as part of the formal score.\n */\nexport interface VerifierFinding {\n /**\n * Category of the observation. Open-ended enum — additional categories may\n * be added as verifier backends surface new failure modes.\n */\n category:\n | \"agent_tool_usage\" // agent's tool calls had repeated issues (misclicks, wrong args, retries)\n | \"agent_strategy\" // higher-level planning / decision-making problems\n | \"rubric_quality\" // criteria were overly strict, ambiguous, or contradictory\n | \"trajectory_capture\" // gaps in evidence (missing screenshots, empty steps)\n | \"task_specification\" // task instruction was ambiguous / under- or over-specified\n | \"verifier_uncertainty\" // verifier itself couldn't confidently decide\n | \"other\";\n /** Impact: info (FYI), warning (worth investigating), blocking (broke the task). */\n severity: \"info\" | \"warning\" | \"blocking\";\n /** What the verifier noticed. Plain prose, grounded in evidence from the trajectory. */\n description: string;\n /**\n * Optional concrete next action another agent could take. Should be\n * specific enough that it can be acted on without further reasoning —\n * e.g., \"Try double_click instead of triple_click to clear placeholder\n * text on this form field.\"\n */\n suggestedAction?: string;\n /** Step indices in the trajectory where this pattern showed up. */\n relatedSteps?: number[];\n}\n\n/** Stable debugging summary emitted by verifier backends. */\nexport interface VerifierRawSteps {\n backend?: \"legacy\" | \"verifier\";\n reason?: string;\n primaryIntent?: string;\n reasoning?: string;\n rubricSource?: \"precomputed\" | \"generated\" | \"none\";\n approach?: \"a\" | \"b\" | \"outcome-only\";\n optionalsMode?: \"folded\" | \"separate\" | \"skip\";\n totalEarned?: number;\n totalMax?: number;\n evidenceImages?: number;\n evidenceTexts?: number;\n evidenceOriginalScreenshots?: number;\n screenshotsAttached?: number;\n legacyEvaluation?: string;\n screenshotCount?: number;\n}\n\n/** Task-validity classification: whether the task is even answerable. */\nexport interface TaskValidity {\n /** True if the task is underspecified / has multiple valid interpretations. */\n isAmbiguous: boolean;\n /** Explanation for why the task is ambiguous, when available. */\n ambiguityReason?: string;\n /** True if the task is impossible / illegal / NSFW / otherwise infeasible. */\n isInvalid: boolean;\n /** Explanation for why the task is invalid, when available. */\n invalidReason?: string;\n /** Optional sub-codes from the task-classification taxonomy. */\n ambiguityCodes?: string[];\n invalidTaskCodes?: string[];\n}\n\n/**\n * Evaluator output. Legacy evaluation may only populate outcome fields; richer\n * verifier backends can also populate process scoring and diagnostics.\n *\n * Process and outcome are deliberately independent when both are present:\n * an agent can follow the right steps but get blocked (high process, low\n * outcome), or succeed through an unexpected path (variable process, high\n * outcome).\n */\nexport interface EvaluationResult {\n /** Did the agent accomplish the task from the user's perspective? */\n outcomeSuccess: boolean;\n /** Human-readable explanation for the outcome. */\n explanation?: string;\n /** Aggregated earned/max across applicable criteria, in [0, 1]. */\n processScore?: number;\n /** Per-criterion breakdown after rescoring. */\n perCriterion?: CriterionScore[];\n /** Step 9a — first step where the trajectory went off-track, if any. */\n firstPointOfFailure?: FirstPointOfFailure;\n /** Step 10 — task-itself ambiguity / validity. */\n taskValidity?: TaskValidity;\n /**\n * Ids (RubricCriterion.criterion strings) of criteria where neither tier of\n * evidence resolved the question. Treated as uncontrollable → full credit,\n * but flagged here so consumers can decide whether to discount the score.\n */\n evidenceInsufficient?: string[];\n /**\n * Structured observations from the verifier that a downstream tool or\n * follow-up agent could act on. Opportunistic — empty when the verifier\n * doesn't notice anything actionable. Not part of the score; advisory.\n */\n findings?: VerifierFinding[];\n /** Debugging summary from the active evaluator backend. */\n rawSteps?: VerifierRawSteps;\n}\n\n/**\n * Verifier interface. Implementations consume a Trajectory and return an\n * EvaluationResult — they MUST NOT touch a live browser.\n */\nexport interface Verifier {\n verify(trajectory: Trajectory): Promise<EvaluationResult>;\n}\n\nexport interface RubricVerifierOptions {\n /** Factory that returns a configured LLMClient. Called per pipeline step so callers can supply step-specific clients. */\n getClient: () => LLMClient;\n /** Optional factory for rubric generation so callers can route it to a stronger model. */\n getRubricGenClient?: () => LLMClient;\n /** Logger; defaults to a no-op so the verifier stays quiet inside V3Evaluator. */\n logger?: (line: LogLine) => void;\n /**\n * Override any verifier knob. Env vars supply the defaults; values here win.\n * Useful for tests and for cross-verify sweeps that want different budgets\n * per run.\n */\n config?: Partial<VerifierConfig>;\n}\n\n/**\n * Resolved verifier knobs. Constructed once from env (and optional overrides)\n * by RubricVerifier's constructor; subsequent verify() calls can pass a\n * Partial to shift any field.\n */\nexport interface VerifierConfig {\n /** Which pipeline path to take: per-criterion (a), fused (b), or skip rubric entirely (outcome-only). */\n approach: \"a\" | \"b\" | \"outcome-only\";\n /** Folded (in fused call), separate (own calls), or skip (omit). */\n optionalSteps: \"folded\" | \"separate\" | \"skip\";\n /** Top-K evidence points selected per criterion. */\n topK: number;\n /** Batch size for the relevance-scoring LLM call. */\n relevanceBatchSize: number;\n /** Image cap on the outcome-only path. */\n outcomeMaxImages: number;\n /** Concurrent LLM calls across batches / criteria. */\n maxParallel: number;\n /** Token budgets for the three evidence channels. */\n evidenceTokenBudget: number;\n outcomeEvidenceTokenBudget: number;\n actionHistoryTokenBudget: number;\n /** Per-section character limits applied during evidence-text assembly. */\n truncation: {\n /** Master switch: when true, all per-section limits go to MAX_SAFE_INTEGER. */\n disabled: boolean;\n evidenceTextPreview: number;\n groupedEvidenceText: number;\n buildEvidenceText: number;\n buildEvidenceAria: number;\n actionHistoryReasoning: number;\n };\n}\n\nexport interface ErrorTaxonomySubCategory {\n /** Sub-code (e.g., \"2.3\"). */\n code: string;\n /** Human-readable name (e.g., \"Output fabrication\"). */\n name: string;\n /** Detailed description ported from the .md. Markdown formatting preserved. */\n description: string;\n}\n\nexport interface ErrorTaxonomyCategory {\n /** Top-level number (1-8). */\n number: number;\n /** Top-level name (e.g., \"Hallucination Errors\"). */\n name: string;\n /** One-sentence summary of the category. */\n summary: string;\n /** Sub-categories. The last one is always an \"Other\" catch-all. */\n subCategories: ErrorTaxonomySubCategory[];\n}\n\nexport interface ParseFailureStepNumbersOptions {\n /**\n * Maximum unique step numbers to expand from ranges. Protects the verifier\n * from malformed model output such as \"0-2147483647\".\n */\n maxExpandedSteps?: number;\n /** Optional inclusive upper bound for accepted step numbers. */\n maxStep?: number;\n}\n"]}
@@ -1,6 +1,7 @@
1
1
  import type { AvailableModel, ClientOptions } from "./v3/types/public/model.js";
2
- import type { EvaluateOptions, BatchAskOptions, EvaluationResult } from "./v3/types/private/evaluator.js";
2
+ import type { EvaluateOptions, BatchAskOptions, EvaluationResult as LegacyEvaluationResult } from "./v3/types/private/evaluator.js";
3
3
  import { V3 } from "./v3/v3.js";
4
+ import type { Trajectory, TaskSpec, EvaluationResult, Rubric, Verifier } from "./v3/verifier/index.js";
4
5
  export type V3EvaluatorBackend = "legacy" | "verifier";
5
6
  export type V3EvaluatorOptions = {
6
7
  /**
@@ -17,11 +18,20 @@ export type V3EvaluatorConstructorOptions = V3EvaluatorOptions & {
17
18
  modelName?: AvailableModel;
18
19
  modelClientOptions?: ClientOptions;
19
20
  };
20
- export declare class V3Evaluator {
21
+ export declare class V3Evaluator implements Verifier {
22
+ private readonly v3;
21
23
  private readonly backend;
24
+ private readonly modelName;
25
+ private readonly modelClientOptions;
22
26
  private readonly legacyEvaluator;
23
27
  constructor(v3: V3, modelNameOrOptions?: AvailableModel | V3EvaluatorConstructorOptions, modelClientOptions?: ClientOptions, options?: V3EvaluatorOptions);
24
- ask(options: EvaluateOptions): Promise<EvaluationResult>;
25
- batchAsk(options: BatchAskOptions): Promise<EvaluationResult[]>;
28
+ ask(options: EvaluateOptions): Promise<LegacyEvaluationResult>;
29
+ batchAsk(options: BatchAskOptions): Promise<LegacyEvaluationResult[]>;
30
+ verify(trajectory: Trajectory): Promise<EvaluationResult>;
31
+ generateRubric(taskSpec: TaskSpec): Promise<Rubric>;
26
32
  private getLegacyBackend;
33
+ private unavailableVerifierBackend;
34
+ private getClient;
35
+ private getRubricGenClient;
36
+ private verifyTrajectoryWithLegacyEvaluator;
27
37
  }