@browserbasehq/orca 3.5.1-preview.0 → 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 (186) hide show
  1. package/README.md +0 -12
  2. package/dist/cjs/lib/utils.d.ts +6 -0
  3. package/dist/cjs/lib/utils.js +11 -0
  4. package/dist/cjs/lib/utils.js.map +1 -1
  5. package/dist/cjs/lib/v3/agent/AgentProvider.js +4 -3
  6. package/dist/cjs/lib/v3/agent/AgentProvider.js.map +1 -1
  7. package/dist/cjs/lib/v3/agent/AnthropicCUAClient.js +10 -9
  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/handleDoneToolCall.js +10 -1
  12. package/dist/cjs/lib/v3/agent/utils/handleDoneToolCall.js.map +1 -1
  13. package/dist/cjs/lib/v3/cache/ActCache.js +1 -1
  14. package/dist/cjs/lib/v3/cache/ActCache.js.map +1 -1
  15. package/dist/cjs/lib/v3/cache/utils.d.ts +7 -0
  16. package/dist/cjs/lib/v3/cache/utils.js +19 -0
  17. package/dist/cjs/lib/v3/cache/utils.js.map +1 -1
  18. package/dist/cjs/lib/v3/handlers/v3AgentHandler.d.ts +2 -1
  19. package/dist/cjs/lib/v3/handlers/v3AgentHandler.js +25 -9
  20. package/dist/cjs/lib/v3/handlers/v3AgentHandler.js.map +1 -1
  21. package/dist/cjs/lib/v3/index.d.ts +2 -2
  22. package/dist/cjs/lib/v3/index.js.map +1 -1
  23. package/dist/cjs/lib/v3/launch/local.js +1 -0
  24. package/dist/cjs/lib/v3/launch/local.js.map +1 -1
  25. package/dist/cjs/lib/v3/llm/LLMProvider.js +1 -0
  26. package/dist/cjs/lib/v3/llm/LLMProvider.js.map +1 -1
  27. package/dist/cjs/lib/v3/llm/aisdk.js +4 -0
  28. package/dist/cjs/lib/v3/llm/aisdk.js.map +1 -1
  29. package/dist/cjs/lib/v3/llm/anthropicOptions.d.ts +57 -0
  30. package/dist/cjs/lib/v3/llm/anthropicOptions.js +115 -0
  31. package/dist/cjs/lib/v3/llm/anthropicOptions.js.map +1 -0
  32. package/dist/cjs/lib/v3/types/public/agent.d.ts +1 -1
  33. package/dist/cjs/lib/v3/types/public/agent.js +2 -0
  34. package/dist/cjs/lib/v3/types/public/agent.js.map +1 -1
  35. package/dist/cjs/lib/v3/types/public/model.d.ts +3 -2
  36. package/dist/cjs/lib/v3/types/public/model.js.map +1 -1
  37. package/dist/cjs/lib/v3/understudy/page.js +1 -1
  38. package/dist/cjs/lib/v3/understudy/page.js.map +1 -1
  39. package/dist/cjs/lib/v3/v3.js +4 -1
  40. package/dist/cjs/lib/v3/v3.js.map +1 -1
  41. package/dist/cjs/lib/v3/verifier/errorTaxonomy.d.ts +35 -0
  42. package/dist/cjs/lib/v3/verifier/errorTaxonomy.js +291 -0
  43. package/dist/cjs/lib/v3/verifier/errorTaxonomy.js.map +1 -0
  44. package/dist/cjs/lib/v3/verifier/evidence.d.ts +44 -0
  45. package/dist/cjs/lib/v3/verifier/evidence.js +432 -0
  46. package/dist/cjs/lib/v3/verifier/evidence.js.map +1 -0
  47. package/dist/cjs/lib/v3/verifier/index.d.ts +1 -1
  48. package/dist/cjs/lib/v3/verifier/index.js.map +1 -1
  49. package/dist/cjs/lib/v3/verifier/prompts/batchedRelevance.d.ts +21 -0
  50. package/dist/cjs/lib/v3/verifier/prompts/batchedRelevance.js +71 -0
  51. package/dist/cjs/lib/v3/verifier/prompts/batchedRelevance.js.map +1 -0
  52. package/dist/cjs/lib/v3/verifier/prompts/firstPointOfFailure.d.ts +3 -0
  53. package/dist/cjs/lib/v3/verifier/prompts/firstPointOfFailure.js +166 -0
  54. package/dist/cjs/lib/v3/verifier/prompts/firstPointOfFailure.js.map +1 -0
  55. package/dist/cjs/lib/v3/verifier/prompts/fusedJudgment.d.ts +35 -0
  56. package/dist/cjs/lib/v3/verifier/prompts/fusedJudgment.js +158 -0
  57. package/dist/cjs/lib/v3/verifier/prompts/fusedJudgment.js.map +1 -0
  58. package/dist/cjs/lib/v3/verifier/prompts/fusedOutcome.d.ts +26 -0
  59. package/dist/cjs/lib/v3/verifier/prompts/fusedOutcome.js +137 -0
  60. package/dist/cjs/lib/v3/verifier/prompts/fusedOutcome.js.map +1 -0
  61. package/dist/cjs/lib/v3/verifier/prompts/index.d.ts +8 -0
  62. package/dist/cjs/lib/v3/verifier/prompts/index.js +22 -0
  63. package/dist/cjs/lib/v3/verifier/prompts/index.js.map +1 -0
  64. package/dist/cjs/lib/v3/verifier/prompts/perCriterionScore.d.ts +23 -0
  65. package/dist/cjs/lib/v3/verifier/prompts/perCriterionScore.js +77 -0
  66. package/dist/cjs/lib/v3/verifier/prompts/perCriterionScore.js.map +1 -0
  67. package/dist/cjs/lib/v3/verifier/prompts/render.d.ts +23 -0
  68. package/dist/cjs/lib/v3/verifier/prompts/render.js +45 -0
  69. package/dist/cjs/lib/v3/verifier/prompts/render.js.map +1 -0
  70. package/dist/cjs/lib/v3/verifier/prompts/rubricGeneration.d.ts +16 -0
  71. package/dist/cjs/lib/v3/verifier/prompts/rubricGeneration.js +321 -0
  72. package/dist/cjs/lib/v3/verifier/prompts/rubricGeneration.js.map +1 -0
  73. package/dist/cjs/lib/v3/verifier/prompts/taskValidity.d.ts +1 -0
  74. package/dist/cjs/lib/v3/verifier/prompts/taskValidity.js +116 -0
  75. package/dist/cjs/lib/v3/verifier/prompts/taskValidity.js.map +1 -0
  76. package/dist/cjs/lib/v3/verifier/rubricVerifier.d.ts +91 -0
  77. package/dist/cjs/lib/v3/verifier/rubricVerifier.js +1645 -0
  78. package/dist/cjs/lib/v3/verifier/rubricVerifier.js.map +1 -0
  79. package/dist/cjs/lib/v3/verifier/trajectory.d.ts +3 -3
  80. package/dist/cjs/lib/v3/verifier/trajectory.js +26 -26
  81. package/dist/cjs/lib/v3/verifier/trajectory.js.map +1 -1
  82. package/dist/cjs/lib/v3/verifier/types.d.ts +163 -15
  83. package/dist/cjs/lib/v3/verifier/types.js +0 -7
  84. package/dist/cjs/lib/v3/verifier/types.js.map +1 -1
  85. package/dist/cjs/lib/v3Evaluator.d.ts +5 -0
  86. package/dist/cjs/lib/v3Evaluator.js +47 -7
  87. package/dist/cjs/lib/v3Evaluator.js.map +1 -1
  88. package/dist/cjs/lib/version.d.ts +1 -1
  89. package/dist/cjs/lib/version.js +1 -1
  90. package/dist/cjs/lib/version.js.map +1 -1
  91. package/dist/esm/lib/utils.d.ts +6 -0
  92. package/dist/esm/lib/utils.js +10 -0
  93. package/dist/esm/lib/utils.js.map +1 -1
  94. package/dist/esm/lib/v3/agent/AgentProvider.js +4 -3
  95. package/dist/esm/lib/v3/agent/AgentProvider.js.map +1 -1
  96. package/dist/esm/lib/v3/agent/AnthropicCUAClient.js +10 -9
  97. package/dist/esm/lib/v3/agent/AnthropicCUAClient.js.map +1 -1
  98. package/dist/esm/lib/v3/agent/GoogleCUAClient.js +124 -28
  99. package/dist/esm/lib/v3/agent/GoogleCUAClient.js.map +1 -1
  100. package/dist/esm/lib/v3/agent/utils/handleDoneToolCall.js +10 -1
  101. package/dist/esm/lib/v3/agent/utils/handleDoneToolCall.js.map +1 -1
  102. package/dist/esm/lib/v3/cache/ActCache.js +2 -2
  103. package/dist/esm/lib/v3/cache/ActCache.js.map +1 -1
  104. package/dist/esm/lib/v3/cache/utils.d.ts +7 -0
  105. package/dist/esm/lib/v3/cache/utils.js +18 -0
  106. package/dist/esm/lib/v3/cache/utils.js.map +1 -1
  107. package/dist/esm/lib/v3/handlers/v3AgentHandler.d.ts +2 -1
  108. package/dist/esm/lib/v3/handlers/v3AgentHandler.js +25 -9
  109. package/dist/esm/lib/v3/handlers/v3AgentHandler.js.map +1 -1
  110. package/dist/esm/lib/v3/index.d.ts +2 -2
  111. package/dist/esm/lib/v3/index.js.map +1 -1
  112. package/dist/esm/lib/v3/launch/local.js +1 -0
  113. package/dist/esm/lib/v3/launch/local.js.map +1 -1
  114. package/dist/esm/lib/v3/llm/LLMProvider.js +1 -0
  115. package/dist/esm/lib/v3/llm/LLMProvider.js.map +1 -1
  116. package/dist/esm/lib/v3/llm/aisdk.js +4 -0
  117. package/dist/esm/lib/v3/llm/aisdk.js.map +1 -1
  118. package/dist/esm/lib/v3/llm/anthropicOptions.d.ts +57 -0
  119. package/dist/esm/lib/v3/llm/anthropicOptions.js +106 -0
  120. package/dist/esm/lib/v3/llm/anthropicOptions.js.map +1 -0
  121. package/dist/esm/lib/v3/types/public/agent.d.ts +1 -1
  122. package/dist/esm/lib/v3/types/public/agent.js +2 -0
  123. package/dist/esm/lib/v3/types/public/agent.js.map +1 -1
  124. package/dist/esm/lib/v3/types/public/model.d.ts +3 -2
  125. package/dist/esm/lib/v3/types/public/model.js.map +1 -1
  126. package/dist/esm/lib/v3/understudy/page.js +1 -1
  127. package/dist/esm/lib/v3/understudy/page.js.map +1 -1
  128. package/dist/esm/lib/v3/v3.js +4 -1
  129. package/dist/esm/lib/v3/v3.js.map +1 -1
  130. package/dist/esm/lib/v3/verifier/errorTaxonomy.d.ts +35 -0
  131. package/dist/esm/lib/v3/verifier/errorTaxonomy.js +285 -0
  132. package/dist/esm/lib/v3/verifier/errorTaxonomy.js.map +1 -0
  133. package/dist/esm/lib/v3/verifier/evidence.d.ts +44 -0
  134. package/dist/esm/lib/v3/verifier/evidence.js +393 -0
  135. package/dist/esm/lib/v3/verifier/evidence.js.map +1 -0
  136. package/dist/esm/lib/v3/verifier/index.d.ts +1 -1
  137. package/dist/esm/lib/v3/verifier/index.js.map +1 -1
  138. package/dist/esm/lib/v3/verifier/prompts/batchedRelevance.d.ts +21 -0
  139. package/dist/esm/lib/v3/verifier/prompts/batchedRelevance.js +68 -0
  140. package/dist/esm/lib/v3/verifier/prompts/batchedRelevance.js.map +1 -0
  141. package/dist/esm/lib/v3/verifier/prompts/firstPointOfFailure.d.ts +3 -0
  142. package/dist/esm/lib/v3/verifier/prompts/firstPointOfFailure.js +162 -0
  143. package/dist/esm/lib/v3/verifier/prompts/firstPointOfFailure.js.map +1 -0
  144. package/dist/esm/lib/v3/verifier/prompts/fusedJudgment.d.ts +35 -0
  145. package/dist/esm/lib/v3/verifier/prompts/fusedJudgment.js +155 -0
  146. package/dist/esm/lib/v3/verifier/prompts/fusedJudgment.js.map +1 -0
  147. package/dist/esm/lib/v3/verifier/prompts/fusedOutcome.d.ts +26 -0
  148. package/dist/esm/lib/v3/verifier/prompts/fusedOutcome.js +134 -0
  149. package/dist/esm/lib/v3/verifier/prompts/fusedOutcome.js.map +1 -0
  150. package/dist/esm/lib/v3/verifier/prompts/index.d.ts +8 -0
  151. package/dist/esm/lib/v3/verifier/prompts/index.js +9 -0
  152. package/dist/esm/lib/v3/verifier/prompts/index.js.map +1 -0
  153. package/dist/esm/lib/v3/verifier/prompts/perCriterionScore.d.ts +23 -0
  154. package/dist/esm/lib/v3/verifier/prompts/perCriterionScore.js +74 -0
  155. package/dist/esm/lib/v3/verifier/prompts/perCriterionScore.js.map +1 -0
  156. package/dist/esm/lib/v3/verifier/prompts/render.d.ts +23 -0
  157. package/dist/esm/lib/v3/verifier/prompts/render.js +41 -0
  158. package/dist/esm/lib/v3/verifier/prompts/render.js.map +1 -0
  159. package/dist/esm/lib/v3/verifier/prompts/rubricGeneration.d.ts +16 -0
  160. package/dist/esm/lib/v3/verifier/prompts/rubricGeneration.js +318 -0
  161. package/dist/esm/lib/v3/verifier/prompts/rubricGeneration.js.map +1 -0
  162. package/dist/esm/lib/v3/verifier/prompts/taskValidity.d.ts +1 -0
  163. package/dist/esm/lib/v3/verifier/prompts/taskValidity.js +113 -0
  164. package/dist/esm/lib/v3/verifier/prompts/taskValidity.js.map +1 -0
  165. package/dist/esm/lib/v3/verifier/rubricVerifier.d.ts +91 -0
  166. package/dist/esm/lib/v3/verifier/rubricVerifier.js +1640 -0
  167. package/dist/esm/lib/v3/verifier/rubricVerifier.js.map +1 -0
  168. package/dist/esm/lib/v3/verifier/trajectory.d.ts +3 -3
  169. package/dist/esm/lib/v3/verifier/trajectory.js +26 -26
  170. package/dist/esm/lib/v3/verifier/trajectory.js.map +1 -1
  171. package/dist/esm/lib/v3/verifier/types.d.ts +163 -15
  172. package/dist/esm/lib/v3/verifier/types.js +0 -7
  173. package/dist/esm/lib/v3/verifier/types.js.map +1 -1
  174. package/dist/esm/lib/v3Evaluator.d.ts +5 -0
  175. package/dist/esm/lib/v3Evaluator.js +47 -7
  176. package/dist/esm/lib/v3Evaluator.js.map +1 -1
  177. package/dist/esm/lib/version.d.ts +1 -1
  178. package/dist/esm/lib/version.js +1 -1
  179. package/dist/esm/lib/version.js.map +1 -1
  180. package/package.json +8 -8
  181. package/dist/cjs/lib/v3/dom/build/selectorRuntime.generated.d.ts +0 -24
  182. package/dist/cjs/lib/v3/dom/build/selectorRuntime.generated.js +0 -31
  183. package/dist/cjs/lib/v3/dom/build/selectorRuntime.generated.js.map +0 -1
  184. package/dist/esm/lib/v3/dom/build/selectorRuntime.generated.d.ts +0 -24
  185. package/dist/esm/lib/v3/dom/build/selectorRuntime.generated.js +0 -28
  186. package/dist/esm/lib/v3/dom/build/selectorRuntime.generated.js.map +0 -1
@@ -0,0 +1,162 @@
1
+ /**
2
+ * First-point-of-failure prompt — Step 9a of the rubric verifier pipeline.
3
+ *
4
+ * Identifies ALL distinct failure points in a trajectory and pinpoints the
5
+ * earliest one (the "first" failure). Diagnostic signal only — does NOT
6
+ * affect scoring. Surfaced in EvaluationResult.firstPointOfFailure.
7
+ *
8
+ * Uses error-taxonomy categories 1–6 (the agent-controllable error space):
9
+ * Selection, Hallucination, Execution & Strategy, Critical Point,
10
+ * Side-Effect, Tool Interaction. Categories 7–8 (task ambiguity / invalid
11
+ * task) are handled by Steps 10 / 9b.
12
+ *
13
+ * The taxonomy is pre-rendered into the prompt body at module load time
14
+ * (the data is static). Variables substituted at call time:
15
+ * - task_definition
16
+ * - init_url_context
17
+ * - action_history
18
+ * - predicted_output
19
+ * - rubric_summary
20
+ * - evidence_summary
21
+ * - outcome_verification
22
+ */
23
+ import { CALIBRATION_NOTE, getSummaryTable, getTaxonomyText, } from "../errorTaxonomy.js";
24
+ // Pre-render the taxonomy + summary table (categories 1–6) once at load.
25
+ const TAXONOMY_TEXT = getTaxonomyText(1, 6, 3);
26
+ const SUMMARY_TABLE = getSummaryTable(1, 6);
27
+ export const FIRST_POINT_OF_FAILURE_PROMPT = `You are an expert failure analyst for computer-use web agents. You will analyze a single task trajectory to identify all failure points and pinpoint the first (earliest) point of failure.
28
+
29
+ You are given:
30
+ - The task the agent was asked to complete
31
+ - The agent's full step-by-step action history (each step has a step number, the agent's reasoning, the action taken, the URL, and a human-readable description)
32
+ - The agent's predicted output (final answer)
33
+ - A scored rubric with multimodal screenshot evidence showing how the agent performed on each criterion
34
+ - The outcome verification result (whether the task was deemed successful overall)
35
+
36
+ Your job is to identify **every distinct failure point** in the trajectory, pinpoint the **exact step number(s)** where it occurred, classify it using the error taxonomy below, and determine which failure occurred **first** (earliest step number).
37
+
38
+ **Calibration:** ${CALIBRATION_NOTE}
39
+
40
+ ## Error Taxonomy
41
+
42
+ ${TAXONOMY_TEXT}
43
+
44
+ ${SUMMARY_TABLE}
45
+
46
+ ## Context
47
+
48
+ Task: "$task_definition"$init_url_context
49
+
50
+ Action History: >>>
51
+ $action_history
52
+ <<<
53
+
54
+ Predicted Output: >>>
55
+ $predicted_output
56
+ <<<
57
+
58
+ Scored Rubric (post-multimodal verification): >>>
59
+ $rubric_summary
60
+ <<<
61
+
62
+ Screenshot Evidence by Criterion: >>>
63
+ $evidence_summary
64
+ <<<
65
+
66
+ Outcome Verification Result: >>>
67
+ $outcome_verification
68
+ <<<
69
+
70
+ ## Instructions
71
+
72
+ Analyze the trajectory and identify ALL distinct failure points. For each failure point:
73
+ 1. Identify the exact step number(s) in the action history where the failure occurred.
74
+ 2. Classify it using the error taxonomy above (use exact category and error type names).
75
+ 3. Ground your classification in concrete evidence (screenshot index, action-history quote, or tool output).
76
+
77
+ **IMPORTANT**
78
+ Output your answer in pure JSON format according to the following schema. The JSON object must be parsable as-is. DO NOT OUTPUT ANYTHING OTHER THAN JSON, AND DO NOT DEVIATE FROM THIS SCHEMA:
79
+
80
+ {{
81
+ "reasoning": str,
82
+ "has_failure": bool,
83
+ "failure_points": [
84
+ {{
85
+ "step_numbers": str,
86
+ "error_code": str,
87
+ "error_category": str,
88
+ "error_type": str,
89
+ "what_happened": str,
90
+ "agent_reasoning": str,
91
+ "evidence": str,
92
+ "impact": str
93
+ }}
94
+ ]
95
+ }}
96
+ `;
97
+ /**
98
+ * Parse the model's flexible step-numbers field into a sorted array of step
99
+ * indices.
100
+ *
101
+ * Accepts:
102
+ * "5" → [5]
103
+ * "5-7" → [5, 6, 7]
104
+ * "5,8,12" → [5, 8, 12]
105
+ * "5,7-9,12" → [5, 7, 8, 9, 12]
106
+ *
107
+ * Returns an empty array for unparseable input rather than throwing — failure
108
+ * analysis is best-effort and a malformed step-numbers field shouldn't tank
109
+ * the whole EvaluationResult.
110
+ */
111
+ const DEFAULT_MAX_EXPANDED_STEPS = 1000;
112
+ export function parseFailureStepNumbers(raw, opts = {}) {
113
+ if (typeof raw !== "string" || raw.length === 0)
114
+ return [];
115
+ const maxExpandedSteps = sanitizeNonNegativeInt(opts.maxExpandedSteps, DEFAULT_MAX_EXPANDED_STEPS);
116
+ if (maxExpandedSteps === 0)
117
+ return [];
118
+ const maxStep = opts.maxStep === undefined
119
+ ? undefined
120
+ : sanitizeNonNegativeInt(opts.maxStep, 0);
121
+ const out = new Set();
122
+ const addStep = (n) => {
123
+ if (!Number.isFinite(n) || n < 0)
124
+ return out.size < maxExpandedSteps;
125
+ if (maxStep !== undefined && n > maxStep)
126
+ return out.size < maxExpandedSteps;
127
+ out.add(n);
128
+ return out.size < maxExpandedSteps;
129
+ };
130
+ for (const segment of raw.split(",")) {
131
+ const seg = segment.trim();
132
+ if (!seg)
133
+ continue;
134
+ const dashIdx = seg.indexOf("-");
135
+ if (dashIdx > 0) {
136
+ const lo = Number.parseInt(seg.slice(0, dashIdx), 10);
137
+ const hi = Number.parseInt(seg.slice(dashIdx + 1), 10);
138
+ if (Number.isFinite(lo) && Number.isFinite(hi) && lo <= hi) {
139
+ const cappedHi = Math.min(hi, maxStep ?? hi, lo + (maxExpandedSteps - out.size) - 1);
140
+ for (let i = lo; i <= cappedHi; i++) {
141
+ if (!addStep(i))
142
+ break;
143
+ }
144
+ }
145
+ }
146
+ else {
147
+ const n = Number.parseInt(seg, 10);
148
+ if (!addStep(n))
149
+ break;
150
+ }
151
+ if (out.size >= maxExpandedSteps)
152
+ break;
153
+ }
154
+ // De-dup + sort ascending.
155
+ return Array.from(out).sort((a, b) => a - b);
156
+ }
157
+ function sanitizeNonNegativeInt(value, fallback) {
158
+ if (value === undefined || !Number.isFinite(value))
159
+ return fallback;
160
+ return Math.max(0, Math.floor(value));
161
+ }
162
+ //# sourceMappingURL=firstPointOfFailure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"firstPointOfFailure.js","sourceRoot":"","sources":["../../../../../../lib/v3/verifier/prompts/firstPointOfFailure.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAG7B,yEAAyE;AACzE,MAAM,aAAa,GAAG,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAC/C,MAAM,aAAa,GAAG,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAE5C,MAAM,CAAC,MAAM,6BAA6B,GAAG;;;;;;;;;;;mBAW1B,gBAAgB;;;;EAIjC,aAAa;;EAEb,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoDd,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,MAAM,0BAA0B,GAAG,IAAI,CAAC;AAExC,MAAM,UAAU,uBAAuB,CACrC,GAAW,EACX,OAAuC,EAAE;IAEzC,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAC3D,MAAM,gBAAgB,GAAG,sBAAsB,CAC7C,IAAI,CAAC,gBAAgB,EACrB,0BAA0B,CAC3B,CAAC;IACF,IAAI,gBAAgB,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACtC,MAAM,OAAO,GACX,IAAI,CAAC,OAAO,KAAK,SAAS;QACxB,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,sBAAsB,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IAC9C,MAAM,GAAG,GAAG,IAAI,GAAG,EAAU,CAAC;IAC9B,MAAM,OAAO,GAAG,CAAC,CAAS,EAAW,EAAE;QACrC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;YAAE,OAAO,GAAG,CAAC,IAAI,GAAG,gBAAgB,CAAC;QACrE,IAAI,OAAO,KAAK,SAAS,IAAI,CAAC,GAAG,OAAO;YACtC,OAAO,GAAG,CAAC,IAAI,GAAG,gBAAgB,CAAC;QACrC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACX,OAAO,GAAG,CAAC,IAAI,GAAG,gBAAgB,CAAC;IACrC,CAAC,CAAC;IACF,KAAK,MAAM,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QACrC,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;QAC3B,IAAI,CAAC,GAAG;YAAE,SAAS;QACnB,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACjC,IAAI,OAAO,GAAG,CAAC,EAAE,CAAC;YAChB,MAAM,EAAE,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;YACtD,MAAM,EAAE,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACvD,IAAI,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC;gBAC3D,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CACvB,EAAE,EACF,OAAO,IAAI,EAAE,EACb,EAAE,GAAG,CAAC,gBAAgB,GAAG,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CACvC,CAAC;gBACF,KAAK,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,QAAQ,EAAE,CAAC,EAAE,EAAE,CAAC;oBACpC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;wBAAE,MAAM;gBACzB,CAAC;YACH,CAAC;QACH,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YACnC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;gBAAE,MAAM;QACzB,CAAC;QACD,IAAI,GAAG,CAAC,IAAI,IAAI,gBAAgB;YAAE,MAAM;IAC1C,CAAC;IACD,2BAA2B;IAC3B,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AAC/C,CAAC;AAED,SAAS,sBAAsB,CAC7B,KAAyB,EACzB,QAAgB;IAEhB,IAAI,KAAK,KAAK,SAAS,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,QAAQ,CAAC;IACpE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;AACxC,CAAC","sourcesContent":["/**\n * First-point-of-failure prompt — Step 9a of the rubric verifier pipeline.\n *\n * Identifies ALL distinct failure points in a trajectory and pinpoints the\n * earliest one (the \"first\" failure). Diagnostic signal only — does NOT\n * affect scoring. Surfaced in EvaluationResult.firstPointOfFailure.\n *\n * Uses error-taxonomy categories 1–6 (the agent-controllable error space):\n * Selection, Hallucination, Execution & Strategy, Critical Point,\n * Side-Effect, Tool Interaction. Categories 7–8 (task ambiguity / invalid\n * task) are handled by Steps 10 / 9b.\n *\n * The taxonomy is pre-rendered into the prompt body at module load time\n * (the data is static). Variables substituted at call time:\n * - task_definition\n * - init_url_context\n * - action_history\n * - predicted_output\n * - rubric_summary\n * - evidence_summary\n * - outcome_verification\n */\nimport {\n CALIBRATION_NOTE,\n getSummaryTable,\n getTaxonomyText,\n} from \"../errorTaxonomy.js\";\nimport type { ParseFailureStepNumbersOptions } from \"../types.js\";\n\n// Pre-render the taxonomy + summary table (categories 1–6) once at load.\nconst TAXONOMY_TEXT = getTaxonomyText(1, 6, 3);\nconst SUMMARY_TABLE = getSummaryTable(1, 6);\n\nexport const FIRST_POINT_OF_FAILURE_PROMPT = `You are an expert failure analyst for computer-use web agents. You will analyze a single task trajectory to identify all failure points and pinpoint the first (earliest) point of failure.\n\nYou are given:\n- The task the agent was asked to complete\n- The agent's full step-by-step action history (each step has a step number, the agent's reasoning, the action taken, the URL, and a human-readable description)\n- The agent's predicted output (final answer)\n- A scored rubric with multimodal screenshot evidence showing how the agent performed on each criterion\n- The outcome verification result (whether the task was deemed successful overall)\n\nYour job is to identify **every distinct failure point** in the trajectory, pinpoint the **exact step number(s)** where it occurred, classify it using the error taxonomy below, and determine which failure occurred **first** (earliest step number).\n\n**Calibration:** ${CALIBRATION_NOTE}\n\n## Error Taxonomy\n\n${TAXONOMY_TEXT}\n\n${SUMMARY_TABLE}\n\n## Context\n\nTask: \"$task_definition\"$init_url_context\n\nAction History: >>>\n$action_history\n<<<\n\nPredicted Output: >>>\n$predicted_output\n<<<\n\nScored Rubric (post-multimodal verification): >>>\n$rubric_summary\n<<<\n\nScreenshot Evidence by Criterion: >>>\n$evidence_summary\n<<<\n\nOutcome Verification Result: >>>\n$outcome_verification\n<<<\n\n## Instructions\n\nAnalyze the trajectory and identify ALL distinct failure points. For each failure point:\n1. Identify the exact step number(s) in the action history where the failure occurred.\n2. Classify it using the error taxonomy above (use exact category and error type names).\n3. Ground your classification in concrete evidence (screenshot index, action-history quote, or tool output).\n\n**IMPORTANT**\nOutput your answer in pure JSON format according to the following schema. The JSON object must be parsable as-is. DO NOT OUTPUT ANYTHING OTHER THAN JSON, AND DO NOT DEVIATE FROM THIS SCHEMA:\n\n{{\n \"reasoning\": str,\n \"has_failure\": bool,\n \"failure_points\": [\n {{\n \"step_numbers\": str,\n \"error_code\": str,\n \"error_category\": str,\n \"error_type\": str,\n \"what_happened\": str,\n \"agent_reasoning\": str,\n \"evidence\": str,\n \"impact\": str\n }}\n ]\n}}\n`;\n\n/**\n * Parse the model's flexible step-numbers field into a sorted array of step\n * indices.\n *\n * Accepts:\n * \"5\" → [5]\n * \"5-7\" → [5, 6, 7]\n * \"5,8,12\" → [5, 8, 12]\n * \"5,7-9,12\" → [5, 7, 8, 9, 12]\n *\n * Returns an empty array for unparseable input rather than throwing — failure\n * analysis is best-effort and a malformed step-numbers field shouldn't tank\n * the whole EvaluationResult.\n */\nconst DEFAULT_MAX_EXPANDED_STEPS = 1000;\n\nexport function parseFailureStepNumbers(\n raw: string,\n opts: ParseFailureStepNumbersOptions = {},\n): number[] {\n if (typeof raw !== \"string\" || raw.length === 0) return [];\n const maxExpandedSteps = sanitizeNonNegativeInt(\n opts.maxExpandedSteps,\n DEFAULT_MAX_EXPANDED_STEPS,\n );\n if (maxExpandedSteps === 0) return [];\n const maxStep =\n opts.maxStep === undefined\n ? undefined\n : sanitizeNonNegativeInt(opts.maxStep, 0);\n const out = new Set<number>();\n const addStep = (n: number): boolean => {\n if (!Number.isFinite(n) || n < 0) return out.size < maxExpandedSteps;\n if (maxStep !== undefined && n > maxStep)\n return out.size < maxExpandedSteps;\n out.add(n);\n return out.size < maxExpandedSteps;\n };\n for (const segment of raw.split(\",\")) {\n const seg = segment.trim();\n if (!seg) continue;\n const dashIdx = seg.indexOf(\"-\");\n if (dashIdx > 0) {\n const lo = Number.parseInt(seg.slice(0, dashIdx), 10);\n const hi = Number.parseInt(seg.slice(dashIdx + 1), 10);\n if (Number.isFinite(lo) && Number.isFinite(hi) && lo <= hi) {\n const cappedHi = Math.min(\n hi,\n maxStep ?? hi,\n lo + (maxExpandedSteps - out.size) - 1,\n );\n for (let i = lo; i <= cappedHi; i++) {\n if (!addStep(i)) break;\n }\n }\n } else {\n const n = Number.parseInt(seg, 10);\n if (!addStep(n)) break;\n }\n if (out.size >= maxExpandedSteps) break;\n }\n // De-dup + sort ascending.\n return Array.from(out).sort((a, b) => a - b);\n}\n\nfunction sanitizeNonNegativeInt(\n value: number | undefined,\n fallback: number,\n): number {\n if (value === undefined || !Number.isFinite(value)) return fallback;\n return Math.max(0, Math.floor(value));\n}\n"]}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Fused judgment prompt — Approach B's single-call replacement for
3
+ * Steps 4+6+8 (and optionally folded 9a + 10).
4
+ *
5
+ * One multimodal call grades every rubric criterion, emits an independent
6
+ * outcome verdict, surfaces findings, optionally identifies the first point
7
+ * of failure, and optionally classifies task validity. The structured
8
+ * response is rich enough to populate the full `EvaluationResult` object without
9
+ * additional LLM calls.
10
+ *
11
+ * Variables:
12
+ * - task_definition — instruction string
13
+ * - init_url_context — "Starting URL: ..." or empty
14
+ * - action_history — compact textual action history
15
+ * - agent_predicted_output — agent's final answer / message
16
+ * - rubric_block — full rubric: index, criterion, description,
17
+ * max_points, optional condition
18
+ * - evidence_block — per-criterion top-K evidence manifest
19
+ * (image refs + ariaTree snippets). Each image
20
+ * in the message body is keyed by its label
21
+ * here (e.g., "Evidence #3 — step=12, probe").
22
+ * - taxonomy_block — error taxonomy text (only when
23
+ * fold_failure_analysis = true). Otherwise
24
+ * empty string.
25
+ * - fold_failure_analysis — "true" / "false" — whether to emit failure
26
+ * analysis in the response.
27
+ * - fold_task_validity — "true" / "false" — whether to emit task
28
+ * validity classification in the response.
29
+ * - final_state_block — always-attached final URL + ariaTree of the
30
+ * last step probe and finalObservation; this
31
+ * bypasses the per-criterion top-K selection
32
+ * so the judge always has the closing page
33
+ * content available.
34
+ */
35
+ export declare const FUSED_JUDGMENT_PROMPT = "Task: $task_definition$init_url_context\n\n**Current Date:** $current_date\n\nYou are an expert evaluator of web-navigation agent trajectories. You will grade the agent's run against a rubric, decide whether the overall task succeeded, and surface diagnostics \u2014 all in one structured response.\n\nUse the current date above to assess time-sensitive constraints in the task (e.g., a task referencing dates in the past relative to the current date is impossible \u2014 classify as task_validity.is_invalid with code 8.1).\n\n**Action History:**\n$action_history\n\n**Agent's Predicted Output (Final Answer):**\n$agent_predicted_output\n\n**Rubric:**\n$rubric_block\n\n**Evidence (grouped by criterion):**\n$evidence_block\n\nEach evidence reference points to an image attached below or to a text snippet inline above. Screenshots are listed in chronological order across the trajectory; when two screenshots show the same element, **the LATER screenshot reflects the final state and takes precedence**.\n\n**Final trajectory state** (authoritative \u2014 this is the page content and screenshot captured at the very end of the run; treat it as ground truth for what the agent saw on its final page, even if no `extract`/`observe` step appears in the action history):\n$final_state_block\n\n**Optional sections to include in the response:**\n- Failure analysis: $fold_failure_analysis\n- Task validity classification: $fold_task_validity\n\nWhen failure analysis is requested and you judge `output_success: false`, you must populate `failure_point` using the error taxonomy below:\n\n$taxonomy_block\n\nWhen task validity is requested, you must populate `task_validity` with the booleans `is_ambiguous` / `is_invalid` and, when each is true, a single one-line free-form reason in `ambiguity_reason` / `invalid_reason` (e.g., \"Requested dates are in the past relative to the current date\"). Leave the reason field empty when the corresponding flag is false.\n\n---\n\n**Core Evaluation Principles** (these OVERRIDE the criterion descriptions when they conflict):\n\n1. **Best Effort Evaluation.** The agent should be evaluated on helpfulness and effort within constraints it cannot control.\n\n2. **Uncontrollable Blockers** (award full credit when these prevent task completion): platform issues (site down, CAPTCHA, login walls), entity non-existence, availability constraints (out of stock, sold out), platform limitations. If screenshots CONFIRM the blocker, award full credit even for downstream dependent criteria.\n\n3. **Controllable Failures** (penalize): wrong selections when correct options are available, poor execution (not using filters, not attempting specified platforms), hallucinations (claiming success without evidence), insufficient effort.\n\n4. **Tasks with Explicit Constraints.** Distinguish \"searched for the constraint\" from \"found results that actually satisfy it\". If the hard constraint is NOT met in the evidence, award only minimal partial credit for the search effort.\n\n5. **Ambiguous Wording \u2014 Don't Penalize for One Valid Interpretation.** If the task has multiple defensible readings, the agent picking one is fine.\n\n6. **Cascading Dependencies:**\n - Scenario A: Blocker is uncontrollable \u2192 award full credit for downstream criteria that couldn't be attempted.\n - Scenario B: Blocker is a controllable error \u2192 cascade partial/zero credit downstream.\n - Scenario C: Don't re-penalize for the same deviation across multiple criteria.\n - Scenario D: Shared platform blockers across sibling sub-tasks \u2192 award full credit for all affected siblings.\n\n7. **Conditional Criteria.** Some criteria have a \"condition\" field. Only score them when the condition is met; otherwise mark the criterion as not applicable (give it max_points so it doesn't drag down the process score).\n\n8. **Distinguish nitpicks from critical errors:**\n - Only nitpicks \u2192 75\u2013100% of max\n - Correct approach, wrong final answer \u2192 40\u201380%\n - Critical error \u2192 penalize per severity\n - Mix of nitpicks + a critical error \u2192 score based on the critical error\n\n**Outcome Judgment:**\n\n`output_success` is your independent binary verdict on whether the agent completed the task. It is informed by the per-criterion scores but is not a function of them \u2014 a task can have high process score and still fail (right approach, wrong final answer) or have lower process score and still succeed (the answer is right, intermediate steps were inelegant).\n\n**Findings:** Surface actionable patterns: failed tool usage, agent-strategy issues, rubric quality problems, capture gaps. Each finding gets a category, severity, description, and (optional) related steps + suggested action. Keep findings sparse and load-bearing.\n\n---\n\n**Output Format:**\n\nOutput one JSON object matching this schema. Include the optional sections only when requested above.\n\n{{\n \"outcome\": {{\n \"primary_intent\": \"<one-sentence restatement of what the task was asking for>\",\n \"reasoning\": \"<your reasoning for the success / failure verdict>\",\n \"output_success\": true,\n \"findings\": [\n {{\n \"category\": \"agent_tool_usage|agent_strategy|rubric_quality|trajectory_capture|task_specification|verifier_uncertainty|other\",\n \"severity\": \"info|warning|blocking\",\n \"description\": \"...\",\n \"suggestedAction\": \"...\",\n \"relatedSteps\": [3, 4]\n }}\n ]\n }},\n \"per_criterion\": [\n {{\n \"criterion_idx\": 0,\n \"applicable_evidence\": \"Which evidence is applicable; cite by 'Screenshot N \u2014 step=K' or aria-tree step number.\",\n \"justification\": \"How the visual / textual evidence supports your score.\",\n \"earned_points\": 4,\n \"evidence_sufficient\": true\n }}\n ],\n \"failure_point\": {{\n \"step_index\": 17,\n \"error_code\": \"1.4\",\n \"error_category\": \"Selection\",\n \"description\": \"<one-line description of what went wrong at this step>\"\n }},\n \"task_validity\": {{\n \"is_ambiguous\": false,\n \"ambiguity_reason\": \"\",\n \"is_invalid\": false,\n \"invalid_reason\": \"\"\n }}\n}}\n\n- Omit `failure_point` when `output_success` is true or when failure analysis was not requested.\n- Omit `task_validity` when task-validity classification was not requested.\n- You MUST emit exactly one `per_criterion` entry per rubric item, in rubric order.\n- `earned_points` must be in [0, max_points] for that criterion.\n\nDO NOT OUTPUT ANYTHING OTHER THAN JSON.\n";
@@ -0,0 +1,155 @@
1
+ /**
2
+ * Fused judgment prompt — Approach B's single-call replacement for
3
+ * Steps 4+6+8 (and optionally folded 9a + 10).
4
+ *
5
+ * One multimodal call grades every rubric criterion, emits an independent
6
+ * outcome verdict, surfaces findings, optionally identifies the first point
7
+ * of failure, and optionally classifies task validity. The structured
8
+ * response is rich enough to populate the full `EvaluationResult` object without
9
+ * additional LLM calls.
10
+ *
11
+ * Variables:
12
+ * - task_definition — instruction string
13
+ * - init_url_context — "Starting URL: ..." or empty
14
+ * - action_history — compact textual action history
15
+ * - agent_predicted_output — agent's final answer / message
16
+ * - rubric_block — full rubric: index, criterion, description,
17
+ * max_points, optional condition
18
+ * - evidence_block — per-criterion top-K evidence manifest
19
+ * (image refs + ariaTree snippets). Each image
20
+ * in the message body is keyed by its label
21
+ * here (e.g., "Evidence #3 — step=12, probe").
22
+ * - taxonomy_block — error taxonomy text (only when
23
+ * fold_failure_analysis = true). Otherwise
24
+ * empty string.
25
+ * - fold_failure_analysis — "true" / "false" — whether to emit failure
26
+ * analysis in the response.
27
+ * - fold_task_validity — "true" / "false" — whether to emit task
28
+ * validity classification in the response.
29
+ * - final_state_block — always-attached final URL + ariaTree of the
30
+ * last step probe and finalObservation; this
31
+ * bypasses the per-criterion top-K selection
32
+ * so the judge always has the closing page
33
+ * content available.
34
+ */
35
+ export const FUSED_JUDGMENT_PROMPT = `Task: $task_definition$init_url_context
36
+
37
+ **Current Date:** $current_date
38
+
39
+ You are an expert evaluator of web-navigation agent trajectories. You will grade the agent's run against a rubric, decide whether the overall task succeeded, and surface diagnostics — all in one structured response.
40
+
41
+ Use the current date above to assess time-sensitive constraints in the task (e.g., a task referencing dates in the past relative to the current date is impossible — classify as task_validity.is_invalid with code 8.1).
42
+
43
+ **Action History:**
44
+ $action_history
45
+
46
+ **Agent's Predicted Output (Final Answer):**
47
+ $agent_predicted_output
48
+
49
+ **Rubric:**
50
+ $rubric_block
51
+
52
+ **Evidence (grouped by criterion):**
53
+ $evidence_block
54
+
55
+ Each evidence reference points to an image attached below or to a text snippet inline above. Screenshots are listed in chronological order across the trajectory; when two screenshots show the same element, **the LATER screenshot reflects the final state and takes precedence**.
56
+
57
+ **Final trajectory state** (authoritative — this is the page content and screenshot captured at the very end of the run; treat it as ground truth for what the agent saw on its final page, even if no \`extract\`/\`observe\` step appears in the action history):
58
+ $final_state_block
59
+
60
+ **Optional sections to include in the response:**
61
+ - Failure analysis: $fold_failure_analysis
62
+ - Task validity classification: $fold_task_validity
63
+
64
+ When failure analysis is requested and you judge \`output_success: false\`, you must populate \`failure_point\` using the error taxonomy below:
65
+
66
+ $taxonomy_block
67
+
68
+ When task validity is requested, you must populate \`task_validity\` with the booleans \`is_ambiguous\` / \`is_invalid\` and, when each is true, a single one-line free-form reason in \`ambiguity_reason\` / \`invalid_reason\` (e.g., "Requested dates are in the past relative to the current date"). Leave the reason field empty when the corresponding flag is false.
69
+
70
+ ---
71
+
72
+ **Core Evaluation Principles** (these OVERRIDE the criterion descriptions when they conflict):
73
+
74
+ 1. **Best Effort Evaluation.** The agent should be evaluated on helpfulness and effort within constraints it cannot control.
75
+
76
+ 2. **Uncontrollable Blockers** (award full credit when these prevent task completion): platform issues (site down, CAPTCHA, login walls), entity non-existence, availability constraints (out of stock, sold out), platform limitations. If screenshots CONFIRM the blocker, award full credit even for downstream dependent criteria.
77
+
78
+ 3. **Controllable Failures** (penalize): wrong selections when correct options are available, poor execution (not using filters, not attempting specified platforms), hallucinations (claiming success without evidence), insufficient effort.
79
+
80
+ 4. **Tasks with Explicit Constraints.** Distinguish "searched for the constraint" from "found results that actually satisfy it". If the hard constraint is NOT met in the evidence, award only minimal partial credit for the search effort.
81
+
82
+ 5. **Ambiguous Wording — Don't Penalize for One Valid Interpretation.** If the task has multiple defensible readings, the agent picking one is fine.
83
+
84
+ 6. **Cascading Dependencies:**
85
+ - Scenario A: Blocker is uncontrollable → award full credit for downstream criteria that couldn't be attempted.
86
+ - Scenario B: Blocker is a controllable error → cascade partial/zero credit downstream.
87
+ - Scenario C: Don't re-penalize for the same deviation across multiple criteria.
88
+ - Scenario D: Shared platform blockers across sibling sub-tasks → award full credit for all affected siblings.
89
+
90
+ 7. **Conditional Criteria.** Some criteria have a "condition" field. Only score them when the condition is met; otherwise mark the criterion as not applicable (give it max_points so it doesn't drag down the process score).
91
+
92
+ 8. **Distinguish nitpicks from critical errors:**
93
+ - Only nitpicks → 75–100% of max
94
+ - Correct approach, wrong final answer → 40–80%
95
+ - Critical error → penalize per severity
96
+ - Mix of nitpicks + a critical error → score based on the critical error
97
+
98
+ **Outcome Judgment:**
99
+
100
+ \`output_success\` is your independent binary verdict on whether the agent completed the task. It is informed by the per-criterion scores but is not a function of them — a task can have high process score and still fail (right approach, wrong final answer) or have lower process score and still succeed (the answer is right, intermediate steps were inelegant).
101
+
102
+ **Findings:** Surface actionable patterns: failed tool usage, agent-strategy issues, rubric quality problems, capture gaps. Each finding gets a category, severity, description, and (optional) related steps + suggested action. Keep findings sparse and load-bearing.
103
+
104
+ ---
105
+
106
+ **Output Format:**
107
+
108
+ Output one JSON object matching this schema. Include the optional sections only when requested above.
109
+
110
+ {{
111
+ "outcome": {{
112
+ "primary_intent": "<one-sentence restatement of what the task was asking for>",
113
+ "reasoning": "<your reasoning for the success / failure verdict>",
114
+ "output_success": true,
115
+ "findings": [
116
+ {{
117
+ "category": "agent_tool_usage|agent_strategy|rubric_quality|trajectory_capture|task_specification|verifier_uncertainty|other",
118
+ "severity": "info|warning|blocking",
119
+ "description": "...",
120
+ "suggestedAction": "...",
121
+ "relatedSteps": [3, 4]
122
+ }}
123
+ ]
124
+ }},
125
+ "per_criterion": [
126
+ {{
127
+ "criterion_idx": 0,
128
+ "applicable_evidence": "Which evidence is applicable; cite by 'Screenshot N — step=K' or aria-tree step number.",
129
+ "justification": "How the visual / textual evidence supports your score.",
130
+ "earned_points": 4,
131
+ "evidence_sufficient": true
132
+ }}
133
+ ],
134
+ "failure_point": {{
135
+ "step_index": 17,
136
+ "error_code": "1.4",
137
+ "error_category": "Selection",
138
+ "description": "<one-line description of what went wrong at this step>"
139
+ }},
140
+ "task_validity": {{
141
+ "is_ambiguous": false,
142
+ "ambiguity_reason": "",
143
+ "is_invalid": false,
144
+ "invalid_reason": ""
145
+ }}
146
+ }}
147
+
148
+ - Omit \`failure_point\` when \`output_success\` is true or when failure analysis was not requested.
149
+ - Omit \`task_validity\` when task-validity classification was not requested.
150
+ - You MUST emit exactly one \`per_criterion\` entry per rubric item, in rubric order.
151
+ - \`earned_points\` must be in [0, max_points] for that criterion.
152
+
153
+ DO NOT OUTPUT ANYTHING OTHER THAN JSON.
154
+ `;
155
+ //# sourceMappingURL=fusedJudgment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fusedJudgment.js","sourceRoot":"","sources":["../../../../../../lib/v3/verifier/prompts/fusedJudgment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuHpC,CAAC","sourcesContent":["/**\n * Fused judgment prompt — Approach B's single-call replacement for\n * Steps 4+6+8 (and optionally folded 9a + 10).\n *\n * One multimodal call grades every rubric criterion, emits an independent\n * outcome verdict, surfaces findings, optionally identifies the first point\n * of failure, and optionally classifies task validity. The structured\n * response is rich enough to populate the full `EvaluationResult` object without\n * additional LLM calls.\n *\n * Variables:\n * - task_definition — instruction string\n * - init_url_context — \"Starting URL: ...\" or empty\n * - action_history — compact textual action history\n * - agent_predicted_output — agent's final answer / message\n * - rubric_block — full rubric: index, criterion, description,\n * max_points, optional condition\n * - evidence_block — per-criterion top-K evidence manifest\n * (image refs + ariaTree snippets). Each image\n * in the message body is keyed by its label\n * here (e.g., \"Evidence #3 — step=12, probe\").\n * - taxonomy_block — error taxonomy text (only when\n * fold_failure_analysis = true). Otherwise\n * empty string.\n * - fold_failure_analysis — \"true\" / \"false\" — whether to emit failure\n * analysis in the response.\n * - fold_task_validity — \"true\" / \"false\" — whether to emit task\n * validity classification in the response.\n * - final_state_block — always-attached final URL + ariaTree of the\n * last step probe and finalObservation; this\n * bypasses the per-criterion top-K selection\n * so the judge always has the closing page\n * content available.\n */\n\nexport const FUSED_JUDGMENT_PROMPT = `Task: $task_definition$init_url_context\n\n**Current Date:** $current_date\n\nYou are an expert evaluator of web-navigation agent trajectories. You will grade the agent's run against a rubric, decide whether the overall task succeeded, and surface diagnostics — all in one structured response.\n\nUse the current date above to assess time-sensitive constraints in the task (e.g., a task referencing dates in the past relative to the current date is impossible — classify as task_validity.is_invalid with code 8.1).\n\n**Action History:**\n$action_history\n\n**Agent's Predicted Output (Final Answer):**\n$agent_predicted_output\n\n**Rubric:**\n$rubric_block\n\n**Evidence (grouped by criterion):**\n$evidence_block\n\nEach evidence reference points to an image attached below or to a text snippet inline above. Screenshots are listed in chronological order across the trajectory; when two screenshots show the same element, **the LATER screenshot reflects the final state and takes precedence**.\n\n**Final trajectory state** (authoritative — this is the page content and screenshot captured at the very end of the run; treat it as ground truth for what the agent saw on its final page, even if no \\`extract\\`/\\`observe\\` step appears in the action history):\n$final_state_block\n\n**Optional sections to include in the response:**\n- Failure analysis: $fold_failure_analysis\n- Task validity classification: $fold_task_validity\n\nWhen failure analysis is requested and you judge \\`output_success: false\\`, you must populate \\`failure_point\\` using the error taxonomy below:\n\n$taxonomy_block\n\nWhen task validity is requested, you must populate \\`task_validity\\` with the booleans \\`is_ambiguous\\` / \\`is_invalid\\` and, when each is true, a single one-line free-form reason in \\`ambiguity_reason\\` / \\`invalid_reason\\` (e.g., \"Requested dates are in the past relative to the current date\"). Leave the reason field empty when the corresponding flag is false.\n\n---\n\n**Core Evaluation Principles** (these OVERRIDE the criterion descriptions when they conflict):\n\n1. **Best Effort Evaluation.** The agent should be evaluated on helpfulness and effort within constraints it cannot control.\n\n2. **Uncontrollable Blockers** (award full credit when these prevent task completion): platform issues (site down, CAPTCHA, login walls), entity non-existence, availability constraints (out of stock, sold out), platform limitations. If screenshots CONFIRM the blocker, award full credit even for downstream dependent criteria.\n\n3. **Controllable Failures** (penalize): wrong selections when correct options are available, poor execution (not using filters, not attempting specified platforms), hallucinations (claiming success without evidence), insufficient effort.\n\n4. **Tasks with Explicit Constraints.** Distinguish \"searched for the constraint\" from \"found results that actually satisfy it\". If the hard constraint is NOT met in the evidence, award only minimal partial credit for the search effort.\n\n5. **Ambiguous Wording — Don't Penalize for One Valid Interpretation.** If the task has multiple defensible readings, the agent picking one is fine.\n\n6. **Cascading Dependencies:**\n - Scenario A: Blocker is uncontrollable → award full credit for downstream criteria that couldn't be attempted.\n - Scenario B: Blocker is a controllable error → cascade partial/zero credit downstream.\n - Scenario C: Don't re-penalize for the same deviation across multiple criteria.\n - Scenario D: Shared platform blockers across sibling sub-tasks → award full credit for all affected siblings.\n\n7. **Conditional Criteria.** Some criteria have a \"condition\" field. Only score them when the condition is met; otherwise mark the criterion as not applicable (give it max_points so it doesn't drag down the process score).\n\n8. **Distinguish nitpicks from critical errors:**\n - Only nitpicks → 75–100% of max\n - Correct approach, wrong final answer → 40–80%\n - Critical error → penalize per severity\n - Mix of nitpicks + a critical error → score based on the critical error\n\n**Outcome Judgment:**\n\n\\`output_success\\` is your independent binary verdict on whether the agent completed the task. It is informed by the per-criterion scores but is not a function of them — a task can have high process score and still fail (right approach, wrong final answer) or have lower process score and still succeed (the answer is right, intermediate steps were inelegant).\n\n**Findings:** Surface actionable patterns: failed tool usage, agent-strategy issues, rubric quality problems, capture gaps. Each finding gets a category, severity, description, and (optional) related steps + suggested action. Keep findings sparse and load-bearing.\n\n---\n\n**Output Format:**\n\nOutput one JSON object matching this schema. Include the optional sections only when requested above.\n\n{{\n \"outcome\": {{\n \"primary_intent\": \"<one-sentence restatement of what the task was asking for>\",\n \"reasoning\": \"<your reasoning for the success / failure verdict>\",\n \"output_success\": true,\n \"findings\": [\n {{\n \"category\": \"agent_tool_usage|agent_strategy|rubric_quality|trajectory_capture|task_specification|verifier_uncertainty|other\",\n \"severity\": \"info|warning|blocking\",\n \"description\": \"...\",\n \"suggestedAction\": \"...\",\n \"relatedSteps\": [3, 4]\n }}\n ]\n }},\n \"per_criterion\": [\n {{\n \"criterion_idx\": 0,\n \"applicable_evidence\": \"Which evidence is applicable; cite by 'Screenshot N — step=K' or aria-tree step number.\",\n \"justification\": \"How the visual / textual evidence supports your score.\",\n \"earned_points\": 4,\n \"evidence_sufficient\": true\n }}\n ],\n \"failure_point\": {{\n \"step_index\": 17,\n \"error_code\": \"1.4\",\n \"error_category\": \"Selection\",\n \"description\": \"<one-line description of what went wrong at this step>\"\n }},\n \"task_validity\": {{\n \"is_ambiguous\": false,\n \"ambiguity_reason\": \"\",\n \"is_invalid\": false,\n \"invalid_reason\": \"\"\n }}\n}}\n\n- Omit \\`failure_point\\` when \\`output_success\\` is true or when failure analysis was not requested.\n- Omit \\`task_validity\\` when task-validity classification was not requested.\n- You MUST emit exactly one \\`per_criterion\\` entry per rubric item, in rubric order.\n- \\`earned_points\\` must be in [0, max_points] for that criterion.\n\nDO NOT OUTPUT ANYTHING OTHER THAN JSON.\n`;\n"]}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Fused outcome prompt — Approach A's combined Step 8 + optional folded
3
+ * 9a/10 call. Consumes a pre-scored rubric (computed deterministically from
4
+ * Approach A's per-criterion analyses) and emits the outcome verdict,
5
+ * findings, and optionally the first point of failure + task validity.
6
+ *
7
+ * Variables:
8
+ * - task_definition — instruction string
9
+ * - init_url_context — "Starting URL: ..." or empty
10
+ * - action_history — compact textual action history
11
+ * - outcome_evidence_summary — selected text evidence snippets from the
12
+ * trajectory, ordered by step
13
+ * - agent_predicted_output — agent's final answer / message
14
+ * - rubric_summary — pre-scored rubric: per-criterion earned/max
15
+ * + the justifications from per-criterion calls
16
+ * - taxonomy_block — error taxonomy text (only when
17
+ * fold_failure_analysis is true; "" otherwise)
18
+ * - fold_failure_analysis — "true" / "false"
19
+ * - fold_task_validity — "true" / "false"
20
+ * - final_state_block — always-attached final URL + ariaTree of the
21
+ * last step probe and finalObservation; this
22
+ * bypasses the keyword-based excerpt selection
23
+ * used by outcome_evidence_summary so the
24
+ * judge always has the closing page content.
25
+ */
26
+ export declare const FUSED_OUTCOME_PROMPT = "Task: $task_definition$init_url_context\n\n**Current Date:** $current_date\n\nYou are an expert evaluator of web-navigation agent trajectories. The rubric has already been scored per criterion (results below). Your job is to produce the overall outcome verdict.\n\nUse the current date above to assess time-sensitive constraints in the task (e.g., a task referencing dates in the past relative to the current date is impossible \u2014 classify as task_validity.is_invalid with code 8.1).\n\n**Action History:**\n$action_history\n\n**Selected Trajectory Evidence:**\n$outcome_evidence_summary\n\n**Final trajectory state** (authoritative \u2014 page content and screenshot captured at the very end of the run; treat as ground truth for what the agent saw on its final page, even when no `extract`/`observe` step appears in the action history):\n$final_state_block\n\n**Agent's Predicted Output (Final Answer):**\n$agent_predicted_output\n\n**Pre-Scored Rubric (per-criterion earned points + justifications):**\n$rubric_summary\n\n**Optional sections in the response:**\n- Failure analysis: $fold_failure_analysis\n- Task validity classification: $fold_task_validity\n\nWhen failure analysis is requested and you judge `output_success: false`, populate `failure_point` using the error taxonomy below:\n\n$taxonomy_block\n\nWhen task validity is requested, populate `task_validity` with the booleans `is_ambiguous` / `is_invalid` and, when each is true, a single one-line free-form reason in `ambiguity_reason` / `invalid_reason` (e.g., \"Requested dates are in the past relative to the current date\"). Leave the reason field empty when the corresponding flag is false.\n\n---\n\n**Outcome judgment:**\n`output_success` is your independent binary verdict on whether the agent completed the task. It is informed by the per-criterion scores but is not a function of them \u2014 a task can have high process score and still fail (right approach, wrong final answer), or have lower process score and still succeed.\n\nApply these rules when making the outcome verdict:\n\n1. **Judge the delivered result, not the route.** If the final answer satisfies the user's requested deliverable and the trajectory does not contradict it, mark success even if the agent used an inefficient path, clicked around after finding the answer, or used a slightly different but reasonable search control. Do not fail solely because the process was imperfect.\n\n2. **Use the simulated trajectory as truth.** Do not use outside/current-world knowledge to override what the saved browser state shows. If search results, page text, URLs, or screenshots in the trajectory support a concrete answer, judge against that evidence even if the real web may differ. Do not introduce an alternate \"correct\" answer from your own knowledge unless that alternate answer is visible in the supplied trajectory evidence.\n\n3. **Treat attached screenshots as partial evidence.** Screenshots may be sampled from a longer trajectory. If the final answer is concrete and the action history shows the agent reached a relevant source (page, list, chart, search result, product page, map result), assume the answer may have been extracted from that source unless the attached screenshots or action history directly contradict it. Do not call a concrete answer fabricated merely because the exact supporting text is absent from the sampled screenshots.\n\n4. **Require the actual deliverable.** The final answer is the user-visible deliverable. For tasks asking to find, show, get, browse, list, summarize, report, compare, or provide values/content, the final answer must contain the requested content or a direct correct link to the requested document/page. Merely saying the agent \"found\", \"extracted\", \"provided\", \"displayed\", \"retrieved\", or \"located\" the information is not enough, even if the browser reached the right page. The selected trajectory evidence is only context; it cannot fill in missing values, lists, links, or summaries that are absent from the final answer. Only purely navigational tasks phrased as opening a page can succeed from navigation alone.\n\n5. **Report/document tasks need the report/document.** If the task asks to get, open, retrieve, download, or provide a report/document/page, the final answer must include a direct correct URL, the opened document/page itself must be the final browser state, or the final answer must include the requested document content. Merely naming the document title is not enough unless the user only asked for the title/name.\n\n6. **Do not invent equivalence.** If the final answer gives a URL, document, article id, product, entity, date, or value that differs from what the trajectory visibly reached, do not assume an unseen redirect, canonicalization, or equivalence. Treat the mismatch as a contradiction unless the supplied trajectory evidence itself shows they are equivalent.\n\n7. **Hard constraints still matter.** If the latest relevant attached screenshot, selected trajectory evidence, or action-history URL clearly shows that an explicit constraint was not met (for example wrong sort/filter/date/class, permanently closed location reported as active, visible product/list item outside the requested color/size/status, wrong URL/article id, or wrong entity), that is a critical issue.\n\n8. **Dynamic sources can disagree.** Search results, charts, rankings, prices, and listings can differ across pages or update times in the saved trajectory. If the final answer is concrete and matches at least one relevant trajectory source, do not fail solely because another relevant source in the trajectory shows a different dynamic value, unless the final answer clearly used the contradicted source or the task required that exact source.\n\n9. **Shopping/search constraints may be source-level.** For product-search tasks, a search query, filter, result page, or product title/snippet can satisfy a descriptive constraint such as \"hypoallergenic\" when the final answer provides concrete candidate products and no supplied evidence directly contradicts the constraint. Do not fail solely because a later product page does not repeat every search constraint as a formal specification.\n\n10. **Separate nitpicks from critical issues.** Minor wording, harmless method choices, unsupported extra details that are not part of the requested deliverable, caveats about imperfect verification, or small presentation differences should not flip a successful answer to failure when the final answer still provides concrete requested content and the trajectory does not directly contradict it. Wrong requested entities, unsupported fabricated requested facts, active-vs-closed mistakes, wrong sort/filter results, wrong dates/classes, and missing requested content are critical.\n\nUse this decision order:\n\n- First ask whether the final answer contains the requested user-facing artifact: values, list items, summary, comparison, report link, product candidates, or page/document URL. If it only narrates that the artifact was found/extracted/provided, mark failure.\n- Then check for direct contradictions in the supplied trajectory evidence. Contradictions must come from the provided action history, URLs, screenshots, or final answer, not from outside knowledge.\n- If the final answer is concrete, the trajectory reached a relevant source, and the supplied evidence does not directly contradict the final answer, mark success.\n\n**Findings:** Surface actionable patterns: failed tool usage, agent-strategy issues, rubric quality problems, capture gaps. Each finding gets a category, severity, description, and (optional) related steps + suggested action. Keep findings sparse and load-bearing.\n\n---\n\n**Output Format:**\n\nOutput one JSON object:\n\n{{\n \"outcome\": {{\n \"primary_intent\": \"<one-sentence restatement of what the task was asking for>\",\n \"reasoning\": \"<your reasoning for the success / failure verdict>\",\n \"output_success\": true,\n \"findings\": [\n {{\n \"category\": \"agent_tool_usage|agent_strategy|rubric_quality|trajectory_capture|task_specification|verifier_uncertainty|other\",\n \"severity\": \"info|warning|blocking\",\n \"description\": \"...\",\n \"suggestedAction\": \"...\",\n \"relatedSteps\": [3, 4]\n }}\n ]\n }},\n \"failure_point\": {{\n \"step_index\": 17,\n \"error_code\": \"1.4\",\n \"error_category\": \"Selection\",\n \"description\": \"<one-line description of what went wrong at this step>\"\n }},\n \"task_validity\": {{\n \"is_ambiguous\": false,\n \"ambiguity_reason\": \"\",\n \"is_invalid\": false,\n \"invalid_reason\": \"\"\n }}\n}}\n\n- Omit `failure_point` when `output_success` is true or failure analysis was not requested.\n- Omit `task_validity` when task-validity classification was not requested.\n\nDO NOT OUTPUT ANYTHING OTHER THAN JSON.\n";
@@ -0,0 +1,134 @@
1
+ /**
2
+ * Fused outcome prompt — Approach A's combined Step 8 + optional folded
3
+ * 9a/10 call. Consumes a pre-scored rubric (computed deterministically from
4
+ * Approach A's per-criterion analyses) and emits the outcome verdict,
5
+ * findings, and optionally the first point of failure + task validity.
6
+ *
7
+ * Variables:
8
+ * - task_definition — instruction string
9
+ * - init_url_context — "Starting URL: ..." or empty
10
+ * - action_history — compact textual action history
11
+ * - outcome_evidence_summary — selected text evidence snippets from the
12
+ * trajectory, ordered by step
13
+ * - agent_predicted_output — agent's final answer / message
14
+ * - rubric_summary — pre-scored rubric: per-criterion earned/max
15
+ * + the justifications from per-criterion calls
16
+ * - taxonomy_block — error taxonomy text (only when
17
+ * fold_failure_analysis is true; "" otherwise)
18
+ * - fold_failure_analysis — "true" / "false"
19
+ * - fold_task_validity — "true" / "false"
20
+ * - final_state_block — always-attached final URL + ariaTree of the
21
+ * last step probe and finalObservation; this
22
+ * bypasses the keyword-based excerpt selection
23
+ * used by outcome_evidence_summary so the
24
+ * judge always has the closing page content.
25
+ */
26
+ export const FUSED_OUTCOME_PROMPT = `Task: $task_definition$init_url_context
27
+
28
+ **Current Date:** $current_date
29
+
30
+ You are an expert evaluator of web-navigation agent trajectories. The rubric has already been scored per criterion (results below). Your job is to produce the overall outcome verdict.
31
+
32
+ Use the current date above to assess time-sensitive constraints in the task (e.g., a task referencing dates in the past relative to the current date is impossible — classify as task_validity.is_invalid with code 8.1).
33
+
34
+ **Action History:**
35
+ $action_history
36
+
37
+ **Selected Trajectory Evidence:**
38
+ $outcome_evidence_summary
39
+
40
+ **Final trajectory state** (authoritative — page content and screenshot captured at the very end of the run; treat as ground truth for what the agent saw on its final page, even when no \`extract\`/\`observe\` step appears in the action history):
41
+ $final_state_block
42
+
43
+ **Agent's Predicted Output (Final Answer):**
44
+ $agent_predicted_output
45
+
46
+ **Pre-Scored Rubric (per-criterion earned points + justifications):**
47
+ $rubric_summary
48
+
49
+ **Optional sections in the response:**
50
+ - Failure analysis: $fold_failure_analysis
51
+ - Task validity classification: $fold_task_validity
52
+
53
+ When failure analysis is requested and you judge \`output_success: false\`, populate \`failure_point\` using the error taxonomy below:
54
+
55
+ $taxonomy_block
56
+
57
+ When task validity is requested, populate \`task_validity\` with the booleans \`is_ambiguous\` / \`is_invalid\` and, when each is true, a single one-line free-form reason in \`ambiguity_reason\` / \`invalid_reason\` (e.g., "Requested dates are in the past relative to the current date"). Leave the reason field empty when the corresponding flag is false.
58
+
59
+ ---
60
+
61
+ **Outcome judgment:**
62
+ \`output_success\` is your independent binary verdict on whether the agent completed the task. It is informed by the per-criterion scores but is not a function of them — a task can have high process score and still fail (right approach, wrong final answer), or have lower process score and still succeed.
63
+
64
+ Apply these rules when making the outcome verdict:
65
+
66
+ 1. **Judge the delivered result, not the route.** If the final answer satisfies the user's requested deliverable and the trajectory does not contradict it, mark success even if the agent used an inefficient path, clicked around after finding the answer, or used a slightly different but reasonable search control. Do not fail solely because the process was imperfect.
67
+
68
+ 2. **Use the simulated trajectory as truth.** Do not use outside/current-world knowledge to override what the saved browser state shows. If search results, page text, URLs, or screenshots in the trajectory support a concrete answer, judge against that evidence even if the real web may differ. Do not introduce an alternate "correct" answer from your own knowledge unless that alternate answer is visible in the supplied trajectory evidence.
69
+
70
+ 3. **Treat attached screenshots as partial evidence.** Screenshots may be sampled from a longer trajectory. If the final answer is concrete and the action history shows the agent reached a relevant source (page, list, chart, search result, product page, map result), assume the answer may have been extracted from that source unless the attached screenshots or action history directly contradict it. Do not call a concrete answer fabricated merely because the exact supporting text is absent from the sampled screenshots.
71
+
72
+ 4. **Require the actual deliverable.** The final answer is the user-visible deliverable. For tasks asking to find, show, get, browse, list, summarize, report, compare, or provide values/content, the final answer must contain the requested content or a direct correct link to the requested document/page. Merely saying the agent "found", "extracted", "provided", "displayed", "retrieved", or "located" the information is not enough, even if the browser reached the right page. The selected trajectory evidence is only context; it cannot fill in missing values, lists, links, or summaries that are absent from the final answer. Only purely navigational tasks phrased as opening a page can succeed from navigation alone.
73
+
74
+ 5. **Report/document tasks need the report/document.** If the task asks to get, open, retrieve, download, or provide a report/document/page, the final answer must include a direct correct URL, the opened document/page itself must be the final browser state, or the final answer must include the requested document content. Merely naming the document title is not enough unless the user only asked for the title/name.
75
+
76
+ 6. **Do not invent equivalence.** If the final answer gives a URL, document, article id, product, entity, date, or value that differs from what the trajectory visibly reached, do not assume an unseen redirect, canonicalization, or equivalence. Treat the mismatch as a contradiction unless the supplied trajectory evidence itself shows they are equivalent.
77
+
78
+ 7. **Hard constraints still matter.** If the latest relevant attached screenshot, selected trajectory evidence, or action-history URL clearly shows that an explicit constraint was not met (for example wrong sort/filter/date/class, permanently closed location reported as active, visible product/list item outside the requested color/size/status, wrong URL/article id, or wrong entity), that is a critical issue.
79
+
80
+ 8. **Dynamic sources can disagree.** Search results, charts, rankings, prices, and listings can differ across pages or update times in the saved trajectory. If the final answer is concrete and matches at least one relevant trajectory source, do not fail solely because another relevant source in the trajectory shows a different dynamic value, unless the final answer clearly used the contradicted source or the task required that exact source.
81
+
82
+ 9. **Shopping/search constraints may be source-level.** For product-search tasks, a search query, filter, result page, or product title/snippet can satisfy a descriptive constraint such as "hypoallergenic" when the final answer provides concrete candidate products and no supplied evidence directly contradicts the constraint. Do not fail solely because a later product page does not repeat every search constraint as a formal specification.
83
+
84
+ 10. **Separate nitpicks from critical issues.** Minor wording, harmless method choices, unsupported extra details that are not part of the requested deliverable, caveats about imperfect verification, or small presentation differences should not flip a successful answer to failure when the final answer still provides concrete requested content and the trajectory does not directly contradict it. Wrong requested entities, unsupported fabricated requested facts, active-vs-closed mistakes, wrong sort/filter results, wrong dates/classes, and missing requested content are critical.
85
+
86
+ Use this decision order:
87
+
88
+ - First ask whether the final answer contains the requested user-facing artifact: values, list items, summary, comparison, report link, product candidates, or page/document URL. If it only narrates that the artifact was found/extracted/provided, mark failure.
89
+ - Then check for direct contradictions in the supplied trajectory evidence. Contradictions must come from the provided action history, URLs, screenshots, or final answer, not from outside knowledge.
90
+ - If the final answer is concrete, the trajectory reached a relevant source, and the supplied evidence does not directly contradict the final answer, mark success.
91
+
92
+ **Findings:** Surface actionable patterns: failed tool usage, agent-strategy issues, rubric quality problems, capture gaps. Each finding gets a category, severity, description, and (optional) related steps + suggested action. Keep findings sparse and load-bearing.
93
+
94
+ ---
95
+
96
+ **Output Format:**
97
+
98
+ Output one JSON object:
99
+
100
+ {{
101
+ "outcome": {{
102
+ "primary_intent": "<one-sentence restatement of what the task was asking for>",
103
+ "reasoning": "<your reasoning for the success / failure verdict>",
104
+ "output_success": true,
105
+ "findings": [
106
+ {{
107
+ "category": "agent_tool_usage|agent_strategy|rubric_quality|trajectory_capture|task_specification|verifier_uncertainty|other",
108
+ "severity": "info|warning|blocking",
109
+ "description": "...",
110
+ "suggestedAction": "...",
111
+ "relatedSteps": [3, 4]
112
+ }}
113
+ ]
114
+ }},
115
+ "failure_point": {{
116
+ "step_index": 17,
117
+ "error_code": "1.4",
118
+ "error_category": "Selection",
119
+ "description": "<one-line description of what went wrong at this step>"
120
+ }},
121
+ "task_validity": {{
122
+ "is_ambiguous": false,
123
+ "ambiguity_reason": "",
124
+ "is_invalid": false,
125
+ "invalid_reason": ""
126
+ }}
127
+ }}
128
+
129
+ - Omit \`failure_point\` when \`output_success\` is true or failure analysis was not requested.
130
+ - Omit \`task_validity\` when task-validity classification was not requested.
131
+
132
+ DO NOT OUTPUT ANYTHING OTHER THAN JSON.
133
+ `;
134
+ //# sourceMappingURL=fusedOutcome.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fusedOutcome.js","sourceRoot":"","sources":["../../../../../../lib/v3/verifier/prompts/fusedOutcome.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2GnC,CAAC","sourcesContent":["/**\n * Fused outcome prompt — Approach A's combined Step 8 + optional folded\n * 9a/10 call. Consumes a pre-scored rubric (computed deterministically from\n * Approach A's per-criterion analyses) and emits the outcome verdict,\n * findings, and optionally the first point of failure + task validity.\n *\n * Variables:\n * - task_definition — instruction string\n * - init_url_context — \"Starting URL: ...\" or empty\n * - action_history — compact textual action history\n * - outcome_evidence_summary — selected text evidence snippets from the\n * trajectory, ordered by step\n * - agent_predicted_output — agent's final answer / message\n * - rubric_summary — pre-scored rubric: per-criterion earned/max\n * + the justifications from per-criterion calls\n * - taxonomy_block — error taxonomy text (only when\n * fold_failure_analysis is true; \"\" otherwise)\n * - fold_failure_analysis — \"true\" / \"false\"\n * - fold_task_validity — \"true\" / \"false\"\n * - final_state_block — always-attached final URL + ariaTree of the\n * last step probe and finalObservation; this\n * bypasses the keyword-based excerpt selection\n * used by outcome_evidence_summary so the\n * judge always has the closing page content.\n */\nexport const FUSED_OUTCOME_PROMPT = `Task: $task_definition$init_url_context\n\n**Current Date:** $current_date\n\nYou are an expert evaluator of web-navigation agent trajectories. The rubric has already been scored per criterion (results below). Your job is to produce the overall outcome verdict.\n\nUse the current date above to assess time-sensitive constraints in the task (e.g., a task referencing dates in the past relative to the current date is impossible — classify as task_validity.is_invalid with code 8.1).\n\n**Action History:**\n$action_history\n\n**Selected Trajectory Evidence:**\n$outcome_evidence_summary\n\n**Final trajectory state** (authoritative — page content and screenshot captured at the very end of the run; treat as ground truth for what the agent saw on its final page, even when no \\`extract\\`/\\`observe\\` step appears in the action history):\n$final_state_block\n\n**Agent's Predicted Output (Final Answer):**\n$agent_predicted_output\n\n**Pre-Scored Rubric (per-criterion earned points + justifications):**\n$rubric_summary\n\n**Optional sections in the response:**\n- Failure analysis: $fold_failure_analysis\n- Task validity classification: $fold_task_validity\n\nWhen failure analysis is requested and you judge \\`output_success: false\\`, populate \\`failure_point\\` using the error taxonomy below:\n\n$taxonomy_block\n\nWhen task validity is requested, populate \\`task_validity\\` with the booleans \\`is_ambiguous\\` / \\`is_invalid\\` and, when each is true, a single one-line free-form reason in \\`ambiguity_reason\\` / \\`invalid_reason\\` (e.g., \"Requested dates are in the past relative to the current date\"). Leave the reason field empty when the corresponding flag is false.\n\n---\n\n**Outcome judgment:**\n\\`output_success\\` is your independent binary verdict on whether the agent completed the task. It is informed by the per-criterion scores but is not a function of them — a task can have high process score and still fail (right approach, wrong final answer), or have lower process score and still succeed.\n\nApply these rules when making the outcome verdict:\n\n1. **Judge the delivered result, not the route.** If the final answer satisfies the user's requested deliverable and the trajectory does not contradict it, mark success even if the agent used an inefficient path, clicked around after finding the answer, or used a slightly different but reasonable search control. Do not fail solely because the process was imperfect.\n\n2. **Use the simulated trajectory as truth.** Do not use outside/current-world knowledge to override what the saved browser state shows. If search results, page text, URLs, or screenshots in the trajectory support a concrete answer, judge against that evidence even if the real web may differ. Do not introduce an alternate \"correct\" answer from your own knowledge unless that alternate answer is visible in the supplied trajectory evidence.\n\n3. **Treat attached screenshots as partial evidence.** Screenshots may be sampled from a longer trajectory. If the final answer is concrete and the action history shows the agent reached a relevant source (page, list, chart, search result, product page, map result), assume the answer may have been extracted from that source unless the attached screenshots or action history directly contradict it. Do not call a concrete answer fabricated merely because the exact supporting text is absent from the sampled screenshots.\n\n4. **Require the actual deliverable.** The final answer is the user-visible deliverable. For tasks asking to find, show, get, browse, list, summarize, report, compare, or provide values/content, the final answer must contain the requested content or a direct correct link to the requested document/page. Merely saying the agent \"found\", \"extracted\", \"provided\", \"displayed\", \"retrieved\", or \"located\" the information is not enough, even if the browser reached the right page. The selected trajectory evidence is only context; it cannot fill in missing values, lists, links, or summaries that are absent from the final answer. Only purely navigational tasks phrased as opening a page can succeed from navigation alone.\n\n5. **Report/document tasks need the report/document.** If the task asks to get, open, retrieve, download, or provide a report/document/page, the final answer must include a direct correct URL, the opened document/page itself must be the final browser state, or the final answer must include the requested document content. Merely naming the document title is not enough unless the user only asked for the title/name.\n\n6. **Do not invent equivalence.** If the final answer gives a URL, document, article id, product, entity, date, or value that differs from what the trajectory visibly reached, do not assume an unseen redirect, canonicalization, or equivalence. Treat the mismatch as a contradiction unless the supplied trajectory evidence itself shows they are equivalent.\n\n7. **Hard constraints still matter.** If the latest relevant attached screenshot, selected trajectory evidence, or action-history URL clearly shows that an explicit constraint was not met (for example wrong sort/filter/date/class, permanently closed location reported as active, visible product/list item outside the requested color/size/status, wrong URL/article id, or wrong entity), that is a critical issue.\n\n8. **Dynamic sources can disagree.** Search results, charts, rankings, prices, and listings can differ across pages or update times in the saved trajectory. If the final answer is concrete and matches at least one relevant trajectory source, do not fail solely because another relevant source in the trajectory shows a different dynamic value, unless the final answer clearly used the contradicted source or the task required that exact source.\n\n9. **Shopping/search constraints may be source-level.** For product-search tasks, a search query, filter, result page, or product title/snippet can satisfy a descriptive constraint such as \"hypoallergenic\" when the final answer provides concrete candidate products and no supplied evidence directly contradicts the constraint. Do not fail solely because a later product page does not repeat every search constraint as a formal specification.\n\n10. **Separate nitpicks from critical issues.** Minor wording, harmless method choices, unsupported extra details that are not part of the requested deliverable, caveats about imperfect verification, or small presentation differences should not flip a successful answer to failure when the final answer still provides concrete requested content and the trajectory does not directly contradict it. Wrong requested entities, unsupported fabricated requested facts, active-vs-closed mistakes, wrong sort/filter results, wrong dates/classes, and missing requested content are critical.\n\nUse this decision order:\n\n- First ask whether the final answer contains the requested user-facing artifact: values, list items, summary, comparison, report link, product candidates, or page/document URL. If it only narrates that the artifact was found/extracted/provided, mark failure.\n- Then check for direct contradictions in the supplied trajectory evidence. Contradictions must come from the provided action history, URLs, screenshots, or final answer, not from outside knowledge.\n- If the final answer is concrete, the trajectory reached a relevant source, and the supplied evidence does not directly contradict the final answer, mark success.\n\n**Findings:** Surface actionable patterns: failed tool usage, agent-strategy issues, rubric quality problems, capture gaps. Each finding gets a category, severity, description, and (optional) related steps + suggested action. Keep findings sparse and load-bearing.\n\n---\n\n**Output Format:**\n\nOutput one JSON object:\n\n{{\n \"outcome\": {{\n \"primary_intent\": \"<one-sentence restatement of what the task was asking for>\",\n \"reasoning\": \"<your reasoning for the success / failure verdict>\",\n \"output_success\": true,\n \"findings\": [\n {{\n \"category\": \"agent_tool_usage|agent_strategy|rubric_quality|trajectory_capture|task_specification|verifier_uncertainty|other\",\n \"severity\": \"info|warning|blocking\",\n \"description\": \"...\",\n \"suggestedAction\": \"...\",\n \"relatedSteps\": [3, 4]\n }}\n ]\n }},\n \"failure_point\": {{\n \"step_index\": 17,\n \"error_code\": \"1.4\",\n \"error_category\": \"Selection\",\n \"description\": \"<one-line description of what went wrong at this step>\"\n }},\n \"task_validity\": {{\n \"is_ambiguous\": false,\n \"ambiguity_reason\": \"\",\n \"is_invalid\": false,\n \"invalid_reason\": \"\"\n }}\n}}\n\n- Omit \\`failure_point\\` when \\`output_success\\` is true or failure analysis was not requested.\n- Omit \\`task_validity\\` when task-validity classification was not requested.\n\nDO NOT OUTPUT ANYTHING OTHER THAN JSON.\n`;\n"]}
@@ -0,0 +1,8 @@
1
+ export { RUBRIC_GENERATION_PROMPT } from "./rubricGeneration.js";
2
+ export { FIRST_POINT_OF_FAILURE_PROMPT, parseFailureStepNumbers, } from "./firstPointOfFailure.js";
3
+ export { TASK_VALIDITY_PROMPT } from "./taskValidity.js";
4
+ export { MM_BATCHED_RELEVANCE_PROMPT } from "./batchedRelevance.js";
5
+ export { MM_PER_CRITERION_SCORE_PROMPT } from "./perCriterionScore.js";
6
+ export { FUSED_JUDGMENT_PROMPT } from "./fusedJudgment.js";
7
+ export { FUSED_OUTCOME_PROMPT } from "./fusedOutcome.js";
8
+ export { renderPrompt, buildInitUrlContext } from "./render.js";