@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.
- package/README.md +0 -12
- package/dist/cjs/lib/utils.d.ts +6 -0
- package/dist/cjs/lib/utils.js +11 -0
- package/dist/cjs/lib/utils.js.map +1 -1
- package/dist/cjs/lib/v3/agent/AgentProvider.js +4 -3
- package/dist/cjs/lib/v3/agent/AgentProvider.js.map +1 -1
- package/dist/cjs/lib/v3/agent/AnthropicCUAClient.js +10 -9
- package/dist/cjs/lib/v3/agent/AnthropicCUAClient.js.map +1 -1
- package/dist/cjs/lib/v3/agent/GoogleCUAClient.js +124 -28
- package/dist/cjs/lib/v3/agent/GoogleCUAClient.js.map +1 -1
- package/dist/cjs/lib/v3/agent/utils/handleDoneToolCall.js +10 -1
- package/dist/cjs/lib/v3/agent/utils/handleDoneToolCall.js.map +1 -1
- package/dist/cjs/lib/v3/cache/ActCache.js +1 -1
- package/dist/cjs/lib/v3/cache/ActCache.js.map +1 -1
- package/dist/cjs/lib/v3/cache/utils.d.ts +7 -0
- package/dist/cjs/lib/v3/cache/utils.js +19 -0
- package/dist/cjs/lib/v3/cache/utils.js.map +1 -1
- package/dist/cjs/lib/v3/handlers/v3AgentHandler.d.ts +2 -1
- package/dist/cjs/lib/v3/handlers/v3AgentHandler.js +25 -9
- package/dist/cjs/lib/v3/handlers/v3AgentHandler.js.map +1 -1
- package/dist/cjs/lib/v3/index.d.ts +2 -2
- package/dist/cjs/lib/v3/index.js.map +1 -1
- package/dist/cjs/lib/v3/launch/local.js +1 -0
- package/dist/cjs/lib/v3/launch/local.js.map +1 -1
- package/dist/cjs/lib/v3/llm/LLMProvider.js +1 -0
- package/dist/cjs/lib/v3/llm/LLMProvider.js.map +1 -1
- package/dist/cjs/lib/v3/llm/aisdk.js +4 -0
- package/dist/cjs/lib/v3/llm/aisdk.js.map +1 -1
- package/dist/cjs/lib/v3/llm/anthropicOptions.d.ts +57 -0
- package/dist/cjs/lib/v3/llm/anthropicOptions.js +115 -0
- package/dist/cjs/lib/v3/llm/anthropicOptions.js.map +1 -0
- package/dist/cjs/lib/v3/types/public/agent.d.ts +1 -1
- package/dist/cjs/lib/v3/types/public/agent.js +2 -0
- package/dist/cjs/lib/v3/types/public/agent.js.map +1 -1
- package/dist/cjs/lib/v3/types/public/model.d.ts +3 -2
- package/dist/cjs/lib/v3/types/public/model.js.map +1 -1
- package/dist/cjs/lib/v3/understudy/page.js +1 -1
- package/dist/cjs/lib/v3/understudy/page.js.map +1 -1
- package/dist/cjs/lib/v3/v3.js +4 -1
- package/dist/cjs/lib/v3/v3.js.map +1 -1
- package/dist/cjs/lib/v3/verifier/errorTaxonomy.d.ts +35 -0
- package/dist/cjs/lib/v3/verifier/errorTaxonomy.js +291 -0
- package/dist/cjs/lib/v3/verifier/errorTaxonomy.js.map +1 -0
- package/dist/cjs/lib/v3/verifier/evidence.d.ts +44 -0
- package/dist/cjs/lib/v3/verifier/evidence.js +432 -0
- package/dist/cjs/lib/v3/verifier/evidence.js.map +1 -0
- package/dist/cjs/lib/v3/verifier/index.d.ts +1 -1
- package/dist/cjs/lib/v3/verifier/index.js.map +1 -1
- package/dist/cjs/lib/v3/verifier/prompts/batchedRelevance.d.ts +21 -0
- package/dist/cjs/lib/v3/verifier/prompts/batchedRelevance.js +71 -0
- package/dist/cjs/lib/v3/verifier/prompts/batchedRelevance.js.map +1 -0
- package/dist/cjs/lib/v3/verifier/prompts/firstPointOfFailure.d.ts +3 -0
- package/dist/cjs/lib/v3/verifier/prompts/firstPointOfFailure.js +166 -0
- package/dist/cjs/lib/v3/verifier/prompts/firstPointOfFailure.js.map +1 -0
- package/dist/cjs/lib/v3/verifier/prompts/fusedJudgment.d.ts +35 -0
- package/dist/cjs/lib/v3/verifier/prompts/fusedJudgment.js +158 -0
- package/dist/cjs/lib/v3/verifier/prompts/fusedJudgment.js.map +1 -0
- package/dist/cjs/lib/v3/verifier/prompts/fusedOutcome.d.ts +26 -0
- package/dist/cjs/lib/v3/verifier/prompts/fusedOutcome.js +137 -0
- package/dist/cjs/lib/v3/verifier/prompts/fusedOutcome.js.map +1 -0
- package/dist/cjs/lib/v3/verifier/prompts/index.d.ts +8 -0
- package/dist/cjs/lib/v3/verifier/prompts/index.js +22 -0
- package/dist/cjs/lib/v3/verifier/prompts/index.js.map +1 -0
- package/dist/cjs/lib/v3/verifier/prompts/perCriterionScore.d.ts +23 -0
- package/dist/cjs/lib/v3/verifier/prompts/perCriterionScore.js +77 -0
- package/dist/cjs/lib/v3/verifier/prompts/perCriterionScore.js.map +1 -0
- package/dist/cjs/lib/v3/verifier/prompts/render.d.ts +23 -0
- package/dist/cjs/lib/v3/verifier/prompts/render.js +45 -0
- package/dist/cjs/lib/v3/verifier/prompts/render.js.map +1 -0
- package/dist/cjs/lib/v3/verifier/prompts/rubricGeneration.d.ts +16 -0
- package/dist/cjs/lib/v3/verifier/prompts/rubricGeneration.js +321 -0
- package/dist/cjs/lib/v3/verifier/prompts/rubricGeneration.js.map +1 -0
- package/dist/cjs/lib/v3/verifier/prompts/taskValidity.d.ts +1 -0
- package/dist/cjs/lib/v3/verifier/prompts/taskValidity.js +116 -0
- package/dist/cjs/lib/v3/verifier/prompts/taskValidity.js.map +1 -0
- package/dist/cjs/lib/v3/verifier/rubricVerifier.d.ts +91 -0
- package/dist/cjs/lib/v3/verifier/rubricVerifier.js +1645 -0
- package/dist/cjs/lib/v3/verifier/rubricVerifier.js.map +1 -0
- package/dist/cjs/lib/v3/verifier/trajectory.d.ts +3 -3
- package/dist/cjs/lib/v3/verifier/trajectory.js +26 -26
- package/dist/cjs/lib/v3/verifier/trajectory.js.map +1 -1
- package/dist/cjs/lib/v3/verifier/types.d.ts +163 -15
- package/dist/cjs/lib/v3/verifier/types.js +0 -7
- package/dist/cjs/lib/v3/verifier/types.js.map +1 -1
- package/dist/cjs/lib/v3Evaluator.d.ts +5 -0
- package/dist/cjs/lib/v3Evaluator.js +47 -7
- package/dist/cjs/lib/v3Evaluator.js.map +1 -1
- package/dist/cjs/lib/version.d.ts +1 -1
- package/dist/cjs/lib/version.js +1 -1
- package/dist/cjs/lib/version.js.map +1 -1
- package/dist/esm/lib/utils.d.ts +6 -0
- package/dist/esm/lib/utils.js +10 -0
- package/dist/esm/lib/utils.js.map +1 -1
- package/dist/esm/lib/v3/agent/AgentProvider.js +4 -3
- package/dist/esm/lib/v3/agent/AgentProvider.js.map +1 -1
- package/dist/esm/lib/v3/agent/AnthropicCUAClient.js +10 -9
- package/dist/esm/lib/v3/agent/AnthropicCUAClient.js.map +1 -1
- package/dist/esm/lib/v3/agent/GoogleCUAClient.js +124 -28
- package/dist/esm/lib/v3/agent/GoogleCUAClient.js.map +1 -1
- package/dist/esm/lib/v3/agent/utils/handleDoneToolCall.js +10 -1
- package/dist/esm/lib/v3/agent/utils/handleDoneToolCall.js.map +1 -1
- package/dist/esm/lib/v3/cache/ActCache.js +2 -2
- package/dist/esm/lib/v3/cache/ActCache.js.map +1 -1
- package/dist/esm/lib/v3/cache/utils.d.ts +7 -0
- package/dist/esm/lib/v3/cache/utils.js +18 -0
- package/dist/esm/lib/v3/cache/utils.js.map +1 -1
- package/dist/esm/lib/v3/handlers/v3AgentHandler.d.ts +2 -1
- package/dist/esm/lib/v3/handlers/v3AgentHandler.js +25 -9
- package/dist/esm/lib/v3/handlers/v3AgentHandler.js.map +1 -1
- package/dist/esm/lib/v3/index.d.ts +2 -2
- package/dist/esm/lib/v3/index.js.map +1 -1
- package/dist/esm/lib/v3/launch/local.js +1 -0
- package/dist/esm/lib/v3/launch/local.js.map +1 -1
- package/dist/esm/lib/v3/llm/LLMProvider.js +1 -0
- package/dist/esm/lib/v3/llm/LLMProvider.js.map +1 -1
- package/dist/esm/lib/v3/llm/aisdk.js +4 -0
- package/dist/esm/lib/v3/llm/aisdk.js.map +1 -1
- package/dist/esm/lib/v3/llm/anthropicOptions.d.ts +57 -0
- package/dist/esm/lib/v3/llm/anthropicOptions.js +106 -0
- package/dist/esm/lib/v3/llm/anthropicOptions.js.map +1 -0
- package/dist/esm/lib/v3/types/public/agent.d.ts +1 -1
- package/dist/esm/lib/v3/types/public/agent.js +2 -0
- package/dist/esm/lib/v3/types/public/agent.js.map +1 -1
- package/dist/esm/lib/v3/types/public/model.d.ts +3 -2
- package/dist/esm/lib/v3/types/public/model.js.map +1 -1
- package/dist/esm/lib/v3/understudy/page.js +1 -1
- package/dist/esm/lib/v3/understudy/page.js.map +1 -1
- package/dist/esm/lib/v3/v3.js +4 -1
- package/dist/esm/lib/v3/v3.js.map +1 -1
- package/dist/esm/lib/v3/verifier/errorTaxonomy.d.ts +35 -0
- package/dist/esm/lib/v3/verifier/errorTaxonomy.js +285 -0
- package/dist/esm/lib/v3/verifier/errorTaxonomy.js.map +1 -0
- package/dist/esm/lib/v3/verifier/evidence.d.ts +44 -0
- package/dist/esm/lib/v3/verifier/evidence.js +393 -0
- package/dist/esm/lib/v3/verifier/evidence.js.map +1 -0
- package/dist/esm/lib/v3/verifier/index.d.ts +1 -1
- package/dist/esm/lib/v3/verifier/index.js.map +1 -1
- package/dist/esm/lib/v3/verifier/prompts/batchedRelevance.d.ts +21 -0
- package/dist/esm/lib/v3/verifier/prompts/batchedRelevance.js +68 -0
- package/dist/esm/lib/v3/verifier/prompts/batchedRelevance.js.map +1 -0
- package/dist/esm/lib/v3/verifier/prompts/firstPointOfFailure.d.ts +3 -0
- package/dist/esm/lib/v3/verifier/prompts/firstPointOfFailure.js +162 -0
- package/dist/esm/lib/v3/verifier/prompts/firstPointOfFailure.js.map +1 -0
- package/dist/esm/lib/v3/verifier/prompts/fusedJudgment.d.ts +35 -0
- package/dist/esm/lib/v3/verifier/prompts/fusedJudgment.js +155 -0
- package/dist/esm/lib/v3/verifier/prompts/fusedJudgment.js.map +1 -0
- package/dist/esm/lib/v3/verifier/prompts/fusedOutcome.d.ts +26 -0
- package/dist/esm/lib/v3/verifier/prompts/fusedOutcome.js +134 -0
- package/dist/esm/lib/v3/verifier/prompts/fusedOutcome.js.map +1 -0
- package/dist/esm/lib/v3/verifier/prompts/index.d.ts +8 -0
- package/dist/esm/lib/v3/verifier/prompts/index.js +9 -0
- package/dist/esm/lib/v3/verifier/prompts/index.js.map +1 -0
- package/dist/esm/lib/v3/verifier/prompts/perCriterionScore.d.ts +23 -0
- package/dist/esm/lib/v3/verifier/prompts/perCriterionScore.js +74 -0
- package/dist/esm/lib/v3/verifier/prompts/perCriterionScore.js.map +1 -0
- package/dist/esm/lib/v3/verifier/prompts/render.d.ts +23 -0
- package/dist/esm/lib/v3/verifier/prompts/render.js +41 -0
- package/dist/esm/lib/v3/verifier/prompts/render.js.map +1 -0
- package/dist/esm/lib/v3/verifier/prompts/rubricGeneration.d.ts +16 -0
- package/dist/esm/lib/v3/verifier/prompts/rubricGeneration.js +318 -0
- package/dist/esm/lib/v3/verifier/prompts/rubricGeneration.js.map +1 -0
- package/dist/esm/lib/v3/verifier/prompts/taskValidity.d.ts +1 -0
- package/dist/esm/lib/v3/verifier/prompts/taskValidity.js +113 -0
- package/dist/esm/lib/v3/verifier/prompts/taskValidity.js.map +1 -0
- package/dist/esm/lib/v3/verifier/rubricVerifier.d.ts +91 -0
- package/dist/esm/lib/v3/verifier/rubricVerifier.js +1640 -0
- package/dist/esm/lib/v3/verifier/rubricVerifier.js.map +1 -0
- package/dist/esm/lib/v3/verifier/trajectory.d.ts +3 -3
- package/dist/esm/lib/v3/verifier/trajectory.js +26 -26
- package/dist/esm/lib/v3/verifier/trajectory.js.map +1 -1
- package/dist/esm/lib/v3/verifier/types.d.ts +163 -15
- package/dist/esm/lib/v3/verifier/types.js +0 -7
- package/dist/esm/lib/v3/verifier/types.js.map +1 -1
- package/dist/esm/lib/v3Evaluator.d.ts +5 -0
- package/dist/esm/lib/v3Evaluator.js +47 -7
- package/dist/esm/lib/v3Evaluator.js.map +1 -1
- package/dist/esm/lib/version.d.ts +1 -1
- package/dist/esm/lib/version.js +1 -1
- package/dist/esm/lib/version.js.map +1 -1
- package/package.json +8 -8
- package/dist/cjs/lib/v3/dom/build/selectorRuntime.generated.d.ts +0 -24
- package/dist/cjs/lib/v3/dom/build/selectorRuntime.generated.js +0 -31
- package/dist/cjs/lib/v3/dom/build/selectorRuntime.generated.js.map +0 -1
- package/dist/esm/lib/v3/dom/build/selectorRuntime.generated.d.ts +0 -24
- package/dist/esm/lib/v3/dom/build/selectorRuntime.generated.js +0 -28
- package/dist/esm/lib/v3/dom/build/selectorRuntime.generated.js.map +0 -1
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FIRST_POINT_OF_FAILURE_PROMPT = void 0;
|
|
4
|
+
exports.parseFailureStepNumbers = parseFailureStepNumbers;
|
|
5
|
+
/**
|
|
6
|
+
* First-point-of-failure prompt — Step 9a of the rubric verifier pipeline.
|
|
7
|
+
*
|
|
8
|
+
* Identifies ALL distinct failure points in a trajectory and pinpoints the
|
|
9
|
+
* earliest one (the "first" failure). Diagnostic signal only — does NOT
|
|
10
|
+
* affect scoring. Surfaced in EvaluationResult.firstPointOfFailure.
|
|
11
|
+
*
|
|
12
|
+
* Uses error-taxonomy categories 1–6 (the agent-controllable error space):
|
|
13
|
+
* Selection, Hallucination, Execution & Strategy, Critical Point,
|
|
14
|
+
* Side-Effect, Tool Interaction. Categories 7–8 (task ambiguity / invalid
|
|
15
|
+
* task) are handled by Steps 10 / 9b.
|
|
16
|
+
*
|
|
17
|
+
* The taxonomy is pre-rendered into the prompt body at module load time
|
|
18
|
+
* (the data is static). Variables substituted at call time:
|
|
19
|
+
* - task_definition
|
|
20
|
+
* - init_url_context
|
|
21
|
+
* - action_history
|
|
22
|
+
* - predicted_output
|
|
23
|
+
* - rubric_summary
|
|
24
|
+
* - evidence_summary
|
|
25
|
+
* - outcome_verification
|
|
26
|
+
*/
|
|
27
|
+
const errorTaxonomy_js_1 = require("../errorTaxonomy.js");
|
|
28
|
+
// Pre-render the taxonomy + summary table (categories 1–6) once at load.
|
|
29
|
+
const TAXONOMY_TEXT = (0, errorTaxonomy_js_1.getTaxonomyText)(1, 6, 3);
|
|
30
|
+
const SUMMARY_TABLE = (0, errorTaxonomy_js_1.getSummaryTable)(1, 6);
|
|
31
|
+
exports.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.
|
|
32
|
+
|
|
33
|
+
You are given:
|
|
34
|
+
- The task the agent was asked to complete
|
|
35
|
+
- 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)
|
|
36
|
+
- The agent's predicted output (final answer)
|
|
37
|
+
- A scored rubric with multimodal screenshot evidence showing how the agent performed on each criterion
|
|
38
|
+
- The outcome verification result (whether the task was deemed successful overall)
|
|
39
|
+
|
|
40
|
+
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).
|
|
41
|
+
|
|
42
|
+
**Calibration:** ${errorTaxonomy_js_1.CALIBRATION_NOTE}
|
|
43
|
+
|
|
44
|
+
## Error Taxonomy
|
|
45
|
+
|
|
46
|
+
${TAXONOMY_TEXT}
|
|
47
|
+
|
|
48
|
+
${SUMMARY_TABLE}
|
|
49
|
+
|
|
50
|
+
## Context
|
|
51
|
+
|
|
52
|
+
Task: "$task_definition"$init_url_context
|
|
53
|
+
|
|
54
|
+
Action History: >>>
|
|
55
|
+
$action_history
|
|
56
|
+
<<<
|
|
57
|
+
|
|
58
|
+
Predicted Output: >>>
|
|
59
|
+
$predicted_output
|
|
60
|
+
<<<
|
|
61
|
+
|
|
62
|
+
Scored Rubric (post-multimodal verification): >>>
|
|
63
|
+
$rubric_summary
|
|
64
|
+
<<<
|
|
65
|
+
|
|
66
|
+
Screenshot Evidence by Criterion: >>>
|
|
67
|
+
$evidence_summary
|
|
68
|
+
<<<
|
|
69
|
+
|
|
70
|
+
Outcome Verification Result: >>>
|
|
71
|
+
$outcome_verification
|
|
72
|
+
<<<
|
|
73
|
+
|
|
74
|
+
## Instructions
|
|
75
|
+
|
|
76
|
+
Analyze the trajectory and identify ALL distinct failure points. For each failure point:
|
|
77
|
+
1. Identify the exact step number(s) in the action history where the failure occurred.
|
|
78
|
+
2. Classify it using the error taxonomy above (use exact category and error type names).
|
|
79
|
+
3. Ground your classification in concrete evidence (screenshot index, action-history quote, or tool output).
|
|
80
|
+
|
|
81
|
+
**IMPORTANT**
|
|
82
|
+
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:
|
|
83
|
+
|
|
84
|
+
{{
|
|
85
|
+
"reasoning": str,
|
|
86
|
+
"has_failure": bool,
|
|
87
|
+
"failure_points": [
|
|
88
|
+
{{
|
|
89
|
+
"step_numbers": str,
|
|
90
|
+
"error_code": str,
|
|
91
|
+
"error_category": str,
|
|
92
|
+
"error_type": str,
|
|
93
|
+
"what_happened": str,
|
|
94
|
+
"agent_reasoning": str,
|
|
95
|
+
"evidence": str,
|
|
96
|
+
"impact": str
|
|
97
|
+
}}
|
|
98
|
+
]
|
|
99
|
+
}}
|
|
100
|
+
`;
|
|
101
|
+
/**
|
|
102
|
+
* Parse the model's flexible step-numbers field into a sorted array of step
|
|
103
|
+
* indices.
|
|
104
|
+
*
|
|
105
|
+
* Accepts:
|
|
106
|
+
* "5" → [5]
|
|
107
|
+
* "5-7" → [5, 6, 7]
|
|
108
|
+
* "5,8,12" → [5, 8, 12]
|
|
109
|
+
* "5,7-9,12" → [5, 7, 8, 9, 12]
|
|
110
|
+
*
|
|
111
|
+
* Returns an empty array for unparseable input rather than throwing — failure
|
|
112
|
+
* analysis is best-effort and a malformed step-numbers field shouldn't tank
|
|
113
|
+
* the whole EvaluationResult.
|
|
114
|
+
*/
|
|
115
|
+
const DEFAULT_MAX_EXPANDED_STEPS = 1000;
|
|
116
|
+
function parseFailureStepNumbers(raw, opts = {}) {
|
|
117
|
+
if (typeof raw !== "string" || raw.length === 0)
|
|
118
|
+
return [];
|
|
119
|
+
const maxExpandedSteps = sanitizeNonNegativeInt(opts.maxExpandedSteps, DEFAULT_MAX_EXPANDED_STEPS);
|
|
120
|
+
if (maxExpandedSteps === 0)
|
|
121
|
+
return [];
|
|
122
|
+
const maxStep = opts.maxStep === undefined
|
|
123
|
+
? undefined
|
|
124
|
+
: sanitizeNonNegativeInt(opts.maxStep, 0);
|
|
125
|
+
const out = new Set();
|
|
126
|
+
const addStep = (n) => {
|
|
127
|
+
if (!Number.isFinite(n) || n < 0)
|
|
128
|
+
return out.size < maxExpandedSteps;
|
|
129
|
+
if (maxStep !== undefined && n > maxStep)
|
|
130
|
+
return out.size < maxExpandedSteps;
|
|
131
|
+
out.add(n);
|
|
132
|
+
return out.size < maxExpandedSteps;
|
|
133
|
+
};
|
|
134
|
+
for (const segment of raw.split(",")) {
|
|
135
|
+
const seg = segment.trim();
|
|
136
|
+
if (!seg)
|
|
137
|
+
continue;
|
|
138
|
+
const dashIdx = seg.indexOf("-");
|
|
139
|
+
if (dashIdx > 0) {
|
|
140
|
+
const lo = Number.parseInt(seg.slice(0, dashIdx), 10);
|
|
141
|
+
const hi = Number.parseInt(seg.slice(dashIdx + 1), 10);
|
|
142
|
+
if (Number.isFinite(lo) && Number.isFinite(hi) && lo <= hi) {
|
|
143
|
+
const cappedHi = Math.min(hi, maxStep ?? hi, lo + (maxExpandedSteps - out.size) - 1);
|
|
144
|
+
for (let i = lo; i <= cappedHi; i++) {
|
|
145
|
+
if (!addStep(i))
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
const n = Number.parseInt(seg, 10);
|
|
152
|
+
if (!addStep(n))
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
155
|
+
if (out.size >= maxExpandedSteps)
|
|
156
|
+
break;
|
|
157
|
+
}
|
|
158
|
+
// De-dup + sort ascending.
|
|
159
|
+
return Array.from(out).sort((a, b) => a - b);
|
|
160
|
+
}
|
|
161
|
+
function sanitizeNonNegativeInt(value, fallback) {
|
|
162
|
+
if (value === undefined || !Number.isFinite(value))
|
|
163
|
+
return fallback;
|
|
164
|
+
return Math.max(0, Math.floor(value));
|
|
165
|
+
}
|
|
166
|
+
//# sourceMappingURL=firstPointOfFailure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"firstPointOfFailure.js","sourceRoot":"","sources":["../../../../../../lib/v3/verifier/prompts/firstPointOfFailure.ts"],"names":[],"mappings":";;;AAwHA,0DA+CC;AAvKD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,0DAI6B;AAG7B,yEAAyE;AACzE,MAAM,aAAa,GAAG,IAAA,kCAAe,EAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAC/C,MAAM,aAAa,GAAG,IAAA,kCAAe,EAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAE/B,QAAA,6BAA6B,GAAG;;;;;;;;;;;mBAW1B,mCAAgB;;;;EAIjC,aAAa;;EAEb,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoDd,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,MAAM,0BAA0B,GAAG,IAAI,CAAC;AAExC,SAAgB,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,158 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Fused judgment prompt — Approach B's single-call replacement for
|
|
4
|
+
* Steps 4+6+8 (and optionally folded 9a + 10).
|
|
5
|
+
*
|
|
6
|
+
* One multimodal call grades every rubric criterion, emits an independent
|
|
7
|
+
* outcome verdict, surfaces findings, optionally identifies the first point
|
|
8
|
+
* of failure, and optionally classifies task validity. The structured
|
|
9
|
+
* response is rich enough to populate the full `EvaluationResult` object without
|
|
10
|
+
* additional LLM calls.
|
|
11
|
+
*
|
|
12
|
+
* Variables:
|
|
13
|
+
* - task_definition — instruction string
|
|
14
|
+
* - init_url_context — "Starting URL: ..." or empty
|
|
15
|
+
* - action_history — compact textual action history
|
|
16
|
+
* - agent_predicted_output — agent's final answer / message
|
|
17
|
+
* - rubric_block — full rubric: index, criterion, description,
|
|
18
|
+
* max_points, optional condition
|
|
19
|
+
* - evidence_block — per-criterion top-K evidence manifest
|
|
20
|
+
* (image refs + ariaTree snippets). Each image
|
|
21
|
+
* in the message body is keyed by its label
|
|
22
|
+
* here (e.g., "Evidence #3 — step=12, probe").
|
|
23
|
+
* - taxonomy_block — error taxonomy text (only when
|
|
24
|
+
* fold_failure_analysis = true). Otherwise
|
|
25
|
+
* empty string.
|
|
26
|
+
* - fold_failure_analysis — "true" / "false" — whether to emit failure
|
|
27
|
+
* analysis in the response.
|
|
28
|
+
* - fold_task_validity — "true" / "false" — whether to emit task
|
|
29
|
+
* validity classification in the response.
|
|
30
|
+
* - final_state_block — always-attached final URL + ariaTree of the
|
|
31
|
+
* last step probe and finalObservation; this
|
|
32
|
+
* bypasses the per-criterion top-K selection
|
|
33
|
+
* so the judge always has the closing page
|
|
34
|
+
* content available.
|
|
35
|
+
*/
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.FUSED_JUDGMENT_PROMPT = void 0;
|
|
38
|
+
exports.FUSED_JUDGMENT_PROMPT = `Task: $task_definition$init_url_context
|
|
39
|
+
|
|
40
|
+
**Current Date:** $current_date
|
|
41
|
+
|
|
42
|
+
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.
|
|
43
|
+
|
|
44
|
+
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).
|
|
45
|
+
|
|
46
|
+
**Action History:**
|
|
47
|
+
$action_history
|
|
48
|
+
|
|
49
|
+
**Agent's Predicted Output (Final Answer):**
|
|
50
|
+
$agent_predicted_output
|
|
51
|
+
|
|
52
|
+
**Rubric:**
|
|
53
|
+
$rubric_block
|
|
54
|
+
|
|
55
|
+
**Evidence (grouped by criterion):**
|
|
56
|
+
$evidence_block
|
|
57
|
+
|
|
58
|
+
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**.
|
|
59
|
+
|
|
60
|
+
**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):
|
|
61
|
+
$final_state_block
|
|
62
|
+
|
|
63
|
+
**Optional sections to include in the response:**
|
|
64
|
+
- Failure analysis: $fold_failure_analysis
|
|
65
|
+
- Task validity classification: $fold_task_validity
|
|
66
|
+
|
|
67
|
+
When failure analysis is requested and you judge \`output_success: false\`, you must populate \`failure_point\` using the error taxonomy below:
|
|
68
|
+
|
|
69
|
+
$taxonomy_block
|
|
70
|
+
|
|
71
|
+
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.
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
**Core Evaluation Principles** (these OVERRIDE the criterion descriptions when they conflict):
|
|
76
|
+
|
|
77
|
+
1. **Best Effort Evaluation.** The agent should be evaluated on helpfulness and effort within constraints it cannot control.
|
|
78
|
+
|
|
79
|
+
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.
|
|
80
|
+
|
|
81
|
+
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.
|
|
82
|
+
|
|
83
|
+
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.
|
|
84
|
+
|
|
85
|
+
5. **Ambiguous Wording — Don't Penalize for One Valid Interpretation.** If the task has multiple defensible readings, the agent picking one is fine.
|
|
86
|
+
|
|
87
|
+
6. **Cascading Dependencies:**
|
|
88
|
+
- Scenario A: Blocker is uncontrollable → award full credit for downstream criteria that couldn't be attempted.
|
|
89
|
+
- Scenario B: Blocker is a controllable error → cascade partial/zero credit downstream.
|
|
90
|
+
- Scenario C: Don't re-penalize for the same deviation across multiple criteria.
|
|
91
|
+
- Scenario D: Shared platform blockers across sibling sub-tasks → award full credit for all affected siblings.
|
|
92
|
+
|
|
93
|
+
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).
|
|
94
|
+
|
|
95
|
+
8. **Distinguish nitpicks from critical errors:**
|
|
96
|
+
- Only nitpicks → 75–100% of max
|
|
97
|
+
- Correct approach, wrong final answer → 40–80%
|
|
98
|
+
- Critical error → penalize per severity
|
|
99
|
+
- Mix of nitpicks + a critical error → score based on the critical error
|
|
100
|
+
|
|
101
|
+
**Outcome Judgment:**
|
|
102
|
+
|
|
103
|
+
\`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).
|
|
104
|
+
|
|
105
|
+
**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.
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
**Output Format:**
|
|
110
|
+
|
|
111
|
+
Output one JSON object matching this schema. Include the optional sections only when requested above.
|
|
112
|
+
|
|
113
|
+
{{
|
|
114
|
+
"outcome": {{
|
|
115
|
+
"primary_intent": "<one-sentence restatement of what the task was asking for>",
|
|
116
|
+
"reasoning": "<your reasoning for the success / failure verdict>",
|
|
117
|
+
"output_success": true,
|
|
118
|
+
"findings": [
|
|
119
|
+
{{
|
|
120
|
+
"category": "agent_tool_usage|agent_strategy|rubric_quality|trajectory_capture|task_specification|verifier_uncertainty|other",
|
|
121
|
+
"severity": "info|warning|blocking",
|
|
122
|
+
"description": "...",
|
|
123
|
+
"suggestedAction": "...",
|
|
124
|
+
"relatedSteps": [3, 4]
|
|
125
|
+
}}
|
|
126
|
+
]
|
|
127
|
+
}},
|
|
128
|
+
"per_criterion": [
|
|
129
|
+
{{
|
|
130
|
+
"criterion_idx": 0,
|
|
131
|
+
"applicable_evidence": "Which evidence is applicable; cite by 'Screenshot N — step=K' or aria-tree step number.",
|
|
132
|
+
"justification": "How the visual / textual evidence supports your score.",
|
|
133
|
+
"earned_points": 4,
|
|
134
|
+
"evidence_sufficient": true
|
|
135
|
+
}}
|
|
136
|
+
],
|
|
137
|
+
"failure_point": {{
|
|
138
|
+
"step_index": 17,
|
|
139
|
+
"error_code": "1.4",
|
|
140
|
+
"error_category": "Selection",
|
|
141
|
+
"description": "<one-line description of what went wrong at this step>"
|
|
142
|
+
}},
|
|
143
|
+
"task_validity": {{
|
|
144
|
+
"is_ambiguous": false,
|
|
145
|
+
"ambiguity_reason": "",
|
|
146
|
+
"is_invalid": false,
|
|
147
|
+
"invalid_reason": ""
|
|
148
|
+
}}
|
|
149
|
+
}}
|
|
150
|
+
|
|
151
|
+
- Omit \`failure_point\` when \`output_success\` is true or when failure analysis was not requested.
|
|
152
|
+
- Omit \`task_validity\` when task-validity classification was not requested.
|
|
153
|
+
- You MUST emit exactly one \`per_criterion\` entry per rubric item, in rubric order.
|
|
154
|
+
- \`earned_points\` must be in [0, max_points] for that criterion.
|
|
155
|
+
|
|
156
|
+
DO NOT OUTPUT ANYTHING OTHER THAN JSON.
|
|
157
|
+
`;
|
|
158
|
+
//# 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;;;AAEU,QAAA,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,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FUSED_OUTCOME_PROMPT = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Fused outcome prompt — Approach A's combined Step 8 + optional folded
|
|
6
|
+
* 9a/10 call. Consumes a pre-scored rubric (computed deterministically from
|
|
7
|
+
* Approach A's per-criterion analyses) and emits the outcome verdict,
|
|
8
|
+
* findings, and optionally the first point of failure + task validity.
|
|
9
|
+
*
|
|
10
|
+
* Variables:
|
|
11
|
+
* - task_definition — instruction string
|
|
12
|
+
* - init_url_context — "Starting URL: ..." or empty
|
|
13
|
+
* - action_history — compact textual action history
|
|
14
|
+
* - outcome_evidence_summary — selected text evidence snippets from the
|
|
15
|
+
* trajectory, ordered by step
|
|
16
|
+
* - agent_predicted_output — agent's final answer / message
|
|
17
|
+
* - rubric_summary — pre-scored rubric: per-criterion earned/max
|
|
18
|
+
* + the justifications from per-criterion calls
|
|
19
|
+
* - taxonomy_block — error taxonomy text (only when
|
|
20
|
+
* fold_failure_analysis is true; "" otherwise)
|
|
21
|
+
* - fold_failure_analysis — "true" / "false"
|
|
22
|
+
* - fold_task_validity — "true" / "false"
|
|
23
|
+
* - final_state_block — always-attached final URL + ariaTree of the
|
|
24
|
+
* last step probe and finalObservation; this
|
|
25
|
+
* bypasses the keyword-based excerpt selection
|
|
26
|
+
* used by outcome_evidence_summary so the
|
|
27
|
+
* judge always has the closing page content.
|
|
28
|
+
*/
|
|
29
|
+
exports.FUSED_OUTCOME_PROMPT = `Task: $task_definition$init_url_context
|
|
30
|
+
|
|
31
|
+
**Current Date:** $current_date
|
|
32
|
+
|
|
33
|
+
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.
|
|
34
|
+
|
|
35
|
+
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).
|
|
36
|
+
|
|
37
|
+
**Action History:**
|
|
38
|
+
$action_history
|
|
39
|
+
|
|
40
|
+
**Selected Trajectory Evidence:**
|
|
41
|
+
$outcome_evidence_summary
|
|
42
|
+
|
|
43
|
+
**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):
|
|
44
|
+
$final_state_block
|
|
45
|
+
|
|
46
|
+
**Agent's Predicted Output (Final Answer):**
|
|
47
|
+
$agent_predicted_output
|
|
48
|
+
|
|
49
|
+
**Pre-Scored Rubric (per-criterion earned points + justifications):**
|
|
50
|
+
$rubric_summary
|
|
51
|
+
|
|
52
|
+
**Optional sections in the response:**
|
|
53
|
+
- Failure analysis: $fold_failure_analysis
|
|
54
|
+
- Task validity classification: $fold_task_validity
|
|
55
|
+
|
|
56
|
+
When failure analysis is requested and you judge \`output_success: false\`, populate \`failure_point\` using the error taxonomy below:
|
|
57
|
+
|
|
58
|
+
$taxonomy_block
|
|
59
|
+
|
|
60
|
+
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.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
**Outcome judgment:**
|
|
65
|
+
\`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.
|
|
66
|
+
|
|
67
|
+
Apply these rules when making the outcome verdict:
|
|
68
|
+
|
|
69
|
+
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.
|
|
70
|
+
|
|
71
|
+
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.
|
|
72
|
+
|
|
73
|
+
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.
|
|
74
|
+
|
|
75
|
+
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.
|
|
76
|
+
|
|
77
|
+
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.
|
|
78
|
+
|
|
79
|
+
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.
|
|
80
|
+
|
|
81
|
+
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.
|
|
82
|
+
|
|
83
|
+
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.
|
|
84
|
+
|
|
85
|
+
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.
|
|
86
|
+
|
|
87
|
+
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.
|
|
88
|
+
|
|
89
|
+
Use this decision order:
|
|
90
|
+
|
|
91
|
+
- 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.
|
|
92
|
+
- 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.
|
|
93
|
+
- 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.
|
|
94
|
+
|
|
95
|
+
**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.
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
**Output Format:**
|
|
100
|
+
|
|
101
|
+
Output one JSON object:
|
|
102
|
+
|
|
103
|
+
{{
|
|
104
|
+
"outcome": {{
|
|
105
|
+
"primary_intent": "<one-sentence restatement of what the task was asking for>",
|
|
106
|
+
"reasoning": "<your reasoning for the success / failure verdict>",
|
|
107
|
+
"output_success": true,
|
|
108
|
+
"findings": [
|
|
109
|
+
{{
|
|
110
|
+
"category": "agent_tool_usage|agent_strategy|rubric_quality|trajectory_capture|task_specification|verifier_uncertainty|other",
|
|
111
|
+
"severity": "info|warning|blocking",
|
|
112
|
+
"description": "...",
|
|
113
|
+
"suggestedAction": "...",
|
|
114
|
+
"relatedSteps": [3, 4]
|
|
115
|
+
}}
|
|
116
|
+
]
|
|
117
|
+
}},
|
|
118
|
+
"failure_point": {{
|
|
119
|
+
"step_index": 17,
|
|
120
|
+
"error_code": "1.4",
|
|
121
|
+
"error_category": "Selection",
|
|
122
|
+
"description": "<one-line description of what went wrong at this step>"
|
|
123
|
+
}},
|
|
124
|
+
"task_validity": {{
|
|
125
|
+
"is_ambiguous": false,
|
|
126
|
+
"ambiguity_reason": "",
|
|
127
|
+
"is_invalid": false,
|
|
128
|
+
"invalid_reason": ""
|
|
129
|
+
}}
|
|
130
|
+
}}
|
|
131
|
+
|
|
132
|
+
- Omit \`failure_point\` when \`output_success\` is true or failure analysis was not requested.
|
|
133
|
+
- Omit \`task_validity\` when task-validity classification was not requested.
|
|
134
|
+
|
|
135
|
+
DO NOT OUTPUT ANYTHING OTHER THAN JSON.
|
|
136
|
+
`;
|
|
137
|
+
//# 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;AACU,QAAA,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"]}
|