@e2edev/e2e 0.10.0 → 0.11.0
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 +11 -5
- package/dist/agent/act-validation.d.ts +2 -0
- package/dist/agent/act-validation.d.ts.map +1 -1
- package/dist/agent/act-validation.js +1 -1
- package/dist/agent/act-validation.js.map +1 -1
- package/dist/agent/act.d.ts.map +1 -1
- package/dist/agent/act.js +14 -0
- package/dist/agent/act.js.map +1 -1
- package/dist/agent/ai-sdk.d.ts +2 -2
- package/dist/agent/ai-sdk.d.ts.map +1 -1
- package/dist/agent/ai-sdk.js +3 -4
- package/dist/agent/ai-sdk.js.map +1 -1
- package/dist/agent/default-agent.d.ts +17 -2
- package/dist/agent/default-agent.d.ts.map +1 -1
- package/dist/agent/default-agent.js +17 -3
- package/dist/agent/default-agent.js.map +1 -1
- package/dist/agent/error.d.ts.map +1 -1
- package/dist/agent/error.js +1 -0
- package/dist/agent/error.js.map +1 -1
- package/dist/agent/executor.d.ts +13 -0
- package/dist/agent/executor.d.ts.map +1 -1
- package/dist/agent/executor.js.map +1 -1
- package/dist/agent/model/adapter.d.ts +3 -0
- package/dist/agent/model/adapter.d.ts.map +1 -1
- package/dist/agent/model/adapter.js.map +1 -1
- package/dist/agent/model/overflow.d.ts +20 -0
- package/dist/agent/model/overflow.d.ts.map +1 -0
- package/dist/agent/model/overflow.js +82 -0
- package/dist/agent/model/overflow.js.map +1 -0
- package/dist/agent/model/prompt-cache.d.ts +47 -0
- package/dist/agent/model/prompt-cache.d.ts.map +1 -0
- package/dist/agent/model/prompt-cache.js +78 -0
- package/dist/agent/model/prompt-cache.js.map +1 -0
- package/dist/agent/model/sdk.d.ts +41 -24
- package/dist/agent/model/sdk.d.ts.map +1 -1
- package/dist/agent/model/sdk.js +64 -91
- package/dist/agent/model/sdk.js.map +1 -1
- package/dist/agent/primitives.d.ts.map +1 -1
- package/dist/agent/primitives.js +2 -1
- package/dist/agent/primitives.js.map +1 -1
- package/dist/agent/public.d.ts +1 -1
- package/dist/agent/public.d.ts.map +1 -1
- package/dist/agent/public.js.map +1 -1
- package/dist/agent/screen-update.d.ts +8 -3
- package/dist/agent/screen-update.d.ts.map +1 -1
- package/dist/agent/screen-update.js +18 -5
- package/dist/agent/screen-update.js.map +1 -1
- package/dist/agent/tool-loop.d.ts.map +1 -1
- package/dist/agent/tool-loop.js +149 -33
- package/dist/agent/tool-loop.js.map +1 -1
- package/dist/agent/tool-output.d.ts +31 -0
- package/dist/agent/tool-output.d.ts.map +1 -0
- package/dist/agent/tool-output.js +60 -0
- package/dist/agent/tool-output.js.map +1 -0
- package/dist/agent/tool.d.ts +9 -3
- package/dist/agent/tool.d.ts.map +1 -1
- package/dist/agent/tool.js +2 -2
- package/dist/agent/tool.js.map +1 -1
- package/dist/agent/usage.d.ts +7 -0
- package/dist/agent/usage.d.ts.map +1 -1
- package/dist/agent/usage.js +11 -0
- package/dist/agent/usage.js.map +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +119 -34
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/init/engines.d.ts +2 -2
- package/dist/cli/init/engines.js +3 -3
- package/dist/cli/init/gateways.d.ts +22 -0
- package/dist/cli/init/gateways.d.ts.map +1 -0
- package/dist/cli/init/gateways.js +50 -0
- package/dist/cli/init/gateways.js.map +1 -0
- package/dist/cli/init/scaffold.d.ts +7 -1
- package/dist/cli/init/scaffold.d.ts.map +1 -1
- package/dist/cli/init/scaffold.js +21 -10
- package/dist/cli/init/scaffold.js.map +1 -1
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +51 -7
- package/dist/cli/init.js.map +1 -1
- package/dist/collect/collect.d.ts +7 -0
- package/dist/collect/collect.d.ts.map +1 -1
- package/dist/collect/collect.js +16 -0
- package/dist/collect/collect.js.map +1 -1
- package/dist/collect/registry.d.ts.map +1 -1
- package/dist/collect/registry.js +10 -4
- package/dist/collect/registry.js.map +1 -1
- package/dist/config/agent.d.ts +13 -32
- package/dist/config/agent.d.ts.map +1 -1
- package/dist/config/agent.js +32 -123
- package/dist/config/agent.js.map +1 -1
- package/dist/config/resolve.js +1 -1
- package/dist/explore/body.d.ts +36 -0
- package/dist/explore/body.d.ts.map +1 -0
- package/dist/explore/body.js +168 -0
- package/dist/explore/body.js.map +1 -0
- package/dist/explore/executor.d.ts +25 -0
- package/dist/explore/executor.d.ts.map +1 -0
- package/dist/explore/executor.js +86 -0
- package/dist/explore/executor.js.map +1 -0
- package/dist/explore/index.d.ts +64 -0
- package/dist/explore/index.d.ts.map +1 -0
- package/dist/explore/index.js +183 -0
- package/dist/explore/index.js.map +1 -0
- package/dist/explore/plan.d.ts +74 -0
- package/dist/explore/plan.d.ts.map +1 -0
- package/dist/explore/plan.js +149 -0
- package/dist/explore/plan.js.map +1 -0
- package/dist/explore/reporter.d.ts +11 -0
- package/dist/explore/reporter.d.ts.map +1 -0
- package/dist/explore/reporter.js +54 -0
- package/dist/explore/reporter.js.map +1 -0
- package/dist/explore/state.d.ts +58 -0
- package/dist/explore/state.d.ts.map +1 -0
- package/dist/explore/state.js +147 -0
- package/dist/explore/state.js.map +1 -0
- package/dist/report/build.d.ts +53 -0
- package/dist/report/build.d.ts.map +1 -1
- package/dist/report/build.js +10 -1
- package/dist/report/build.js.map +1 -1
- package/dist/report/debug-steps.d.ts.map +1 -1
- package/dist/report/debug-steps.js +15 -0
- package/dist/report/debug-steps.js.map +1 -1
- package/dist/report/format.d.ts +11 -1
- package/dist/report/format.d.ts.map +1 -1
- package/dist/report/format.js +15 -3
- package/dist/report/format.js.map +1 -1
- package/dist/run/events.d.ts +2 -2
- package/dist/run/events.d.ts.map +1 -1
- package/dist/run/in-process.d.ts +8 -0
- package/dist/run/in-process.d.ts.map +1 -1
- package/dist/run/in-process.js +3 -3
- package/dist/run/in-process.js.map +1 -1
- package/dist/run/runner.d.ts +20 -1
- package/dist/run/runner.d.ts.map +1 -1
- package/dist/run/runner.js +19 -14
- package/dist/run/runner.js.map +1 -1
- package/dist/run/steps.d.ts +7 -0
- package/dist/run/steps.d.ts.map +1 -1
- package/dist/run/steps.js.map +1 -1
- package/dist/run/worker-models.d.ts +4 -4
- package/dist/run/worker-models.js +6 -13
- package/dist/run/worker-models.js.map +1 -1
- package/dist/telemetry/events.d.ts.map +1 -1
- package/dist/telemetry/events.js +17 -2
- package/dist/telemetry/events.js.map +1 -1
- package/dist/types.d.ts +12 -16
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -2
- package/skills/e2e/SKILL.md +11 -4
- package/skills/e2e/references/agent.md +19 -14
- package/skills/e2e/references/debugging.md +2 -1
- package/skills/e2e/references/explore.md +83 -0
- package/skills/e2e/references/running.md +4 -3
- package/skills/e2e/references/setup.md +10 -7
package/dist/config/agent.js
CHANGED
|
@@ -3,13 +3,10 @@ import { isStepExecutor } from '../agent/executor.js';
|
|
|
3
3
|
import { boundedInt } from './validate.js';
|
|
4
4
|
import { ConfigurationError } from '../internal/errors.js';
|
|
5
5
|
import { didYouMean } from '../internal/suggest.js';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export const GATEWAY_API_KEY_ENV = 'AI_GATEWAY_API_KEY';
|
|
11
|
-
/** Environment override for the model endpoint; `agent.model.endpoint` wins over it. */
|
|
12
|
-
const MODEL_ENDPOINT_ENV = 'E2E_MODEL_ENDPOINT';
|
|
6
|
+
/** A resolved model as reports and diagnostics name it: the instance's `provider/model-id`. */
|
|
7
|
+
export function modelLabel(model) {
|
|
8
|
+
return `${model.provider}/${model.id}`;
|
|
9
|
+
}
|
|
13
10
|
const AGENT_KEYS = new Set([
|
|
14
11
|
'executor',
|
|
15
12
|
'model',
|
|
@@ -21,14 +18,12 @@ const AGENT_KEYS = new Set([
|
|
|
21
18
|
'vision',
|
|
22
19
|
'providerOptions',
|
|
23
20
|
]);
|
|
24
|
-
const MODEL_KEYS = new Set(['provider', 'id', 'endpoint', 'apiKeyEnv']);
|
|
25
21
|
/**
|
|
26
22
|
* Default observation byte budget, shared with the report's pre-config fallback
|
|
27
23
|
* limits. A quarter mebibyte of tree is already tens of thousands of tokens on
|
|
28
24
|
* every act turn; the per-call token ceiling clamps a dense screen below it.
|
|
29
25
|
*/
|
|
30
26
|
export const DEFAULT_OBSERVATION_BYTES = 262_144;
|
|
31
|
-
const ENV_NAME_PATTERN = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
32
27
|
/** Hard ceilings mirroring `schema/report-v1.schema.json` `limits`. */
|
|
33
28
|
const LIMIT_BOUNDS = {
|
|
34
29
|
maxAgentContextBytes: [1_024, 65_536, 16_384],
|
|
@@ -37,9 +32,8 @@ const LIMIT_BOUNDS = {
|
|
|
37
32
|
maxModelTokensPerCall: [1, 1_000_000, 64_000],
|
|
38
33
|
};
|
|
39
34
|
/**
|
|
40
|
-
* Resolves `config.agent`
|
|
41
|
-
*
|
|
42
|
-
* in exactly one direction.
|
|
35
|
+
* Resolves `config.agent`. `limits` must be resolved first: the context budget
|
|
36
|
+
* is a limits key, and the dependency runs in exactly one direction.
|
|
43
37
|
*/
|
|
44
38
|
export function resolveAgentConfig(value, env, ci, limits,
|
|
45
39
|
/** The config path of this agent in diagnostics: `agents.default`, `agents.ux`. */
|
|
@@ -77,8 +71,8 @@ label = 'agents.default') {
|
|
|
77
71
|
}
|
|
78
72
|
return {
|
|
79
73
|
executor,
|
|
80
|
-
model: resolveCanonicalModel(agent?.model, executor?.model,
|
|
81
|
-
visionModel: resolveModel(agent?.visionModel,
|
|
74
|
+
model: resolveCanonicalModel(agent?.model, executor?.model, label),
|
|
75
|
+
visionModel: resolveModel(agent?.visionModel, `${label}.visionModel`),
|
|
82
76
|
maxSteps,
|
|
83
77
|
maxModelCalls,
|
|
84
78
|
maxObservationBytes,
|
|
@@ -158,124 +152,45 @@ export function isModelInstance(value) {
|
|
|
158
152
|
}
|
|
159
153
|
/**
|
|
160
154
|
* The one model both tiers use. The model the executor brought
|
|
161
|
-
* (`createAgent({ model })`) is it; without one, `agent.model
|
|
162
|
-
* `
|
|
163
|
-
*
|
|
155
|
+
* (`createAgent({ model })`) is it; without one, `agent.model`. An
|
|
156
|
+
* `agent.model` naming a different model than the executor's is rejected: two
|
|
157
|
+
* configured models would split the tiers silently.
|
|
164
158
|
*/
|
|
165
|
-
function resolveCanonicalModel(configured, executorModel,
|
|
159
|
+
function resolveCanonicalModel(configured, executorModel, label) {
|
|
166
160
|
if (executorModel === undefined)
|
|
167
|
-
return resolveModel(configured,
|
|
168
|
-
const own = {
|
|
169
|
-
kind: 'instance',
|
|
170
|
-
provider: executorModel.provider,
|
|
171
|
-
id: executorModel.modelId,
|
|
172
|
-
model: asSdkLanguageModel(executorModel),
|
|
173
|
-
};
|
|
161
|
+
return resolveModel(configured, `${label}.model`);
|
|
162
|
+
const own = resolveModel(executorModel, `${label}.model`);
|
|
174
163
|
if (configured === undefined)
|
|
175
164
|
return own;
|
|
176
|
-
const explicit = resolveModel(configured,
|
|
177
|
-
if (explicit
|
|
178
|
-
throw new ConfigurationError('INVALID_CONFIG', `${label}.model (${explicit
|
|
165
|
+
const explicit = resolveModel(configured, `${label}.model`);
|
|
166
|
+
if (explicit.provider !== own.provider || explicit.id !== own.id) {
|
|
167
|
+
throw new ConfigurationError('INVALID_CONFIG', `${label}.model (${modelLabel(explicit)}) and the executor's own model (${modelLabel(own)}) differ; configure the model in one place`);
|
|
179
168
|
}
|
|
180
169
|
return own;
|
|
181
170
|
}
|
|
182
171
|
/**
|
|
183
|
-
* Resolves one model
|
|
184
|
-
*
|
|
185
|
-
*
|
|
186
|
-
*
|
|
187
|
-
*
|
|
188
|
-
* model fails at its first model call, so a custom-executor run needs none.
|
|
172
|
+
* Resolves one model slot. `label` is a parameter because the same check
|
|
173
|
+
* serves `agent.model` and `agent.visionModel`; every diagnostic then names
|
|
174
|
+
* the key the author actually wrote. There is no implicit default model and
|
|
175
|
+
* no environment fallback; an unconfigured model fails at its first model
|
|
176
|
+
* call, so a custom-executor run needs none.
|
|
189
177
|
*/
|
|
190
|
-
function resolveModel(model,
|
|
191
|
-
if (model === undefined)
|
|
192
|
-
|
|
193
|
-
if (fromEnv === undefined || fromEnv.trim() === '')
|
|
194
|
-
return undefined;
|
|
195
|
-
return parseModelReference(fromEnv.trim(), envName, env);
|
|
196
|
-
}
|
|
178
|
+
function resolveModel(model, label) {
|
|
179
|
+
if (model === undefined)
|
|
180
|
+
return undefined;
|
|
197
181
|
if (typeof model === 'string') {
|
|
198
|
-
|
|
199
|
-
}
|
|
200
|
-
if (typeof model !== 'object' || model === null || Array.isArray(model)) {
|
|
201
|
-
throw new ConfigurationError('INVALID_CONFIG', `${label} must be "provider/model-id", a model object, or an AI SDK model instance`);
|
|
182
|
+
throw new ConfigurationError('INVALID_CONFIG', `${label} must be an AI SDK model instance, not the string ${JSON.stringify(model)}: import a provider and construct the model, e.g. gateway(${JSON.stringify(model)}) from 'ai' or openrouter(${JSON.stringify(model)}) from '@openrouter/ai-sdk-provider'`);
|
|
202
183
|
}
|
|
203
|
-
if (isModelInstance(model)) {
|
|
204
|
-
|
|
205
|
-
kind: 'instance',
|
|
206
|
-
provider: model.provider,
|
|
207
|
-
id: model.modelId,
|
|
208
|
-
// Structurally verified above; the AI SDK duck-types models the same way.
|
|
209
|
-
model: model,
|
|
210
|
-
};
|
|
184
|
+
if (!isModelInstance(model)) {
|
|
185
|
+
throw new ConfigurationError('INVALID_CONFIG', `${label} must be an AI SDK model instance, e.g. gateway('openai/gpt-5.4-mini') from 'ai'`);
|
|
211
186
|
}
|
|
212
|
-
for (const key of Object.keys(model)) {
|
|
213
|
-
if (!MODEL_KEYS.has(key)) {
|
|
214
|
-
throw new ConfigurationError('INVALID_CONFIG', `unknown ${label} key "${key}"${didYouMean(key, [...MODEL_KEYS])}`);
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
const provider = requireNonEmpty(model.provider, `${label}.provider`);
|
|
218
|
-
const id = requireNonEmpty(model.id, `${label}.id`);
|
|
219
|
-
return gatewayModel(provider, id, model.endpoint, model.apiKeyEnv, env, label);
|
|
220
|
-
}
|
|
221
|
-
/** Splits `provider/model-id` at the first slash. */
|
|
222
|
-
function parseModelReference(reference, label, env) {
|
|
223
|
-
const separator = reference.indexOf('/');
|
|
224
|
-
if (separator <= 0 || separator === reference.length - 1) {
|
|
225
|
-
throw new ConfigurationError('INVALID_CONFIG', `${label} must be "provider/model-id", got ${JSON.stringify(reference)}`);
|
|
226
|
-
}
|
|
227
|
-
return gatewayModel(reference.slice(0, separator), reference.slice(separator + 1), undefined, undefined, env, label);
|
|
228
|
-
}
|
|
229
|
-
function gatewayModel(provider, id, endpoint, apiKeyEnv, env, label) {
|
|
230
|
-
const keyEnv = validateApiKeyEnv(apiKeyEnv, label);
|
|
231
|
-
const apiKeySource = [keyEnv, GATEWAY_API_KEY_ENV].find((name) => {
|
|
232
|
-
const value = env[name];
|
|
233
|
-
return value !== undefined && value.trim() !== '';
|
|
234
|
-
});
|
|
235
187
|
return {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
apiKeyEnv: keyEnv,
|
|
241
|
-
apiKeySource,
|
|
242
|
-
apiKey: apiKeySource === undefined ? undefined : env[apiKeySource],
|
|
188
|
+
provider: model.provider,
|
|
189
|
+
id: model.modelId,
|
|
190
|
+
// Structurally verified above; the AI SDK duck-types models the same way.
|
|
191
|
+
model: model,
|
|
243
192
|
};
|
|
244
193
|
}
|
|
245
|
-
/**
|
|
246
|
-
* The endpoint from config when set, else `E2E_MODEL_ENDPOINT`, else undefined
|
|
247
|
-
* for the gateway default. Diagnostics name whichever source supplied the value.
|
|
248
|
-
*/
|
|
249
|
-
function resolveEndpoint(endpoint, env, label) {
|
|
250
|
-
if (endpoint !== undefined)
|
|
251
|
-
return validateEndpoint(endpoint, `${label}.endpoint`);
|
|
252
|
-
const fromEnv = env[MODEL_ENDPOINT_ENV]?.trim();
|
|
253
|
-
if (fromEnv === undefined || fromEnv === '')
|
|
254
|
-
return undefined;
|
|
255
|
-
return validateEndpoint(fromEnv, MODEL_ENDPOINT_ENV);
|
|
256
|
-
}
|
|
257
|
-
function validateEndpoint(endpoint, name) {
|
|
258
|
-
let parsed;
|
|
259
|
-
try {
|
|
260
|
-
parsed = new URL(endpoint);
|
|
261
|
-
}
|
|
262
|
-
catch {
|
|
263
|
-
throw new ConfigurationError('INVALID_CONFIG', `invalid ${name} "${endpoint}"`);
|
|
264
|
-
}
|
|
265
|
-
if (parsed.protocol === 'https:')
|
|
266
|
-
return parsed.href;
|
|
267
|
-
if (parsed.protocol === 'http:' && isLoopbackHost(parsed.hostname))
|
|
268
|
-
return parsed.href;
|
|
269
|
-
throw new ConfigurationError('INVALID_CONFIG', `${name} must use HTTPS unless it is a loopback host: ${endpoint}`);
|
|
270
|
-
}
|
|
271
|
-
function validateApiKeyEnv(apiKeyEnv, label) {
|
|
272
|
-
if (apiKeyEnv === undefined)
|
|
273
|
-
return DEFAULT_API_KEY_ENV;
|
|
274
|
-
if (!ENV_NAME_PATTERN.test(apiKeyEnv)) {
|
|
275
|
-
throw new ConfigurationError('INVALID_CONFIG', `${label}.apiKeyEnv must be a valid environment variable name, got "${apiKeyEnv}"`);
|
|
276
|
-
}
|
|
277
|
-
return apiKeyEnv;
|
|
278
|
-
}
|
|
279
194
|
function resolveContext(context, maxBytes, label) {
|
|
280
195
|
if (context === undefined)
|
|
281
196
|
return undefined;
|
|
@@ -288,10 +203,4 @@ function resolveContext(context, maxBytes, label) {
|
|
|
288
203
|
}
|
|
289
204
|
return context;
|
|
290
205
|
}
|
|
291
|
-
function requireNonEmpty(value, label) {
|
|
292
|
-
if (typeof value !== 'string' || value.length === 0) {
|
|
293
|
-
throw new ConfigurationError('INVALID_CONFIG', `${label} is required`);
|
|
294
|
-
}
|
|
295
|
-
return value;
|
|
296
|
-
}
|
|
297
206
|
//# sourceMappingURL=agent.js.map
|
package/dist/config/agent.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version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AG,QAAQ,EAAE,CAAC;QACrB,MAAM,IAAI,kBAAkB,CAC1B,gBAAgB,EAChB,GAAG,KAAK,eAAe,KAAK,mCAAmC,QAAQ,EAAE,CAC1E,CAAC;IACJ,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/dist/config/resolve.js
CHANGED
|
@@ -477,7 +477,7 @@ const DEFAULT_AGENT_NAME = 'default';
|
|
|
477
477
|
const AGENT_NAME_PATTERN = TARGET_NAME_PATTERN;
|
|
478
478
|
/**
|
|
479
479
|
* Resolves `agents`: every named entry, and `default` even when the config
|
|
480
|
-
* names none (the built-in agent
|
|
480
|
+
* names none (the built-in agent, which then needs `createAgent({ model })`). The run's agent is
|
|
481
481
|
* `default` unless `--agent` picked another; an unknown name is a config
|
|
482
482
|
* error before anything starts.
|
|
483
483
|
*/
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The exploration body: the test `e2e explore` registers in memory. A loop
|
|
3
|
+
* of ordinary `agent.act` steps, one per charter the planner writes, under
|
|
4
|
+
* the exploration's own budgets. The outcome policy is the one TesterArmy's
|
|
5
|
+
* discovery runs settled on: a step that ends at its budget is a time-boxed
|
|
6
|
+
* charter and not a failure; a failed step is a finding and the run goes on;
|
|
7
|
+
* three failed or blocked steps in a row, the step cap, or the clock end the
|
|
8
|
+
* run with a closing assessment; findings of kind `issue` fail the run; a run
|
|
9
|
+
* that explored nothing and found nothing is blocked, never a pass.
|
|
10
|
+
*/
|
|
11
|
+
import type { TestFn } from '../types.ts';
|
|
12
|
+
import { type PlanAccount } from './plan.ts';
|
|
13
|
+
import type { ExploreState } from './state.ts';
|
|
14
|
+
/** Failed or blocked steps in a row, none with a finding, that end the run: the approach is not working. */
|
|
15
|
+
export declare const CONSECUTIVE_FAILURE_LIMIT = 3;
|
|
16
|
+
export interface ExploreBodyOptions {
|
|
17
|
+
readonly state: ExploreState;
|
|
18
|
+
/** Each step's own deadline, before the run's remaining time caps it. */
|
|
19
|
+
readonly stepTimeoutMs: number;
|
|
20
|
+
/**
|
|
21
|
+
* Whether to open the app first. `app.open()` needs a target with a declared
|
|
22
|
+
* URL; a device target without one is already showing the app when the
|
|
23
|
+
* attempt starts.
|
|
24
|
+
*/
|
|
25
|
+
readonly openApp: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* The configured accounts. Each travels with every charter as a step
|
|
28
|
+
* secret, so the explorer can sign in with `type_secret` by name; the
|
|
29
|
+
* password itself never reaches the model.
|
|
30
|
+
*/
|
|
31
|
+
readonly accounts?: readonly PlanAccount[] | undefined;
|
|
32
|
+
readonly now?: (() => number) | undefined;
|
|
33
|
+
}
|
|
34
|
+
/** Builds the test body for one exploration. */
|
|
35
|
+
export declare function createExploreBody(options: ExploreBodyOptions): TestFn;
|
|
36
|
+
//# sourceMappingURL=body.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"body.d.ts","sourceRoot":"","sources":["../../src/explore/body.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,OAAO,KAAK,EAAsB,MAAM,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAY,KAAK,WAAW,EAAqB,MAAM,WAAW,CAAC;AAC1E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,4GAA4G;AAC5G,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAU3C,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B,yEAAyE;IACzE,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,WAAW,EAAE,GAAG,SAAS,CAAC;IACvD,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,MAAM,MAAM,CAAC,GAAG,SAAS,CAAC;CAC3C;AAmBD,gDAAgD;AAChD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,kBAAkB,GAAG,MAAM,CAkBrE"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The exploration body: the test `e2e explore` registers in memory. A loop
|
|
3
|
+
* of ordinary `agent.act` steps, one per charter the planner writes, under
|
|
4
|
+
* the exploration's own budgets. The outcome policy is the one TesterArmy's
|
|
5
|
+
* discovery runs settled on: a step that ends at its budget is a time-boxed
|
|
6
|
+
* charter and not a failure; a failed step is a finding and the run goes on;
|
|
7
|
+
* three failed or blocked steps in a row, the step cap, or the clock end the
|
|
8
|
+
* run with a closing assessment; findings of kind `issue` fail the run; a run
|
|
9
|
+
* that explored nothing and found nothing is blocked, never a pass.
|
|
10
|
+
*/
|
|
11
|
+
import { AgentError, isAgentError } from '../agent/error.js';
|
|
12
|
+
import { credentials } from '../credentials.js';
|
|
13
|
+
import { planNext } from './plan.js';
|
|
14
|
+
/** Failed or blocked steps in a row, none with a finding, that end the run: the approach is not working. */
|
|
15
|
+
export const CONSECUTIVE_FAILURE_LIMIT = 3;
|
|
16
|
+
/** Time kept back for the closing assessment once no step can start. */
|
|
17
|
+
const FINISH_RESERVE_MS = 60_000;
|
|
18
|
+
/** The least time a step is worth starting with. */
|
|
19
|
+
const MIN_STEP_MS = 45_000;
|
|
20
|
+
/** The planner's deadline: one structured call plus a repair round, on a slow provider. */
|
|
21
|
+
const PLAN_TIMEOUT_MS = 90_000;
|
|
22
|
+
/** Below this, not even the closing assessment is asked for. */
|
|
23
|
+
const MIN_PLAN_TIMEOUT_MS = 30_000;
|
|
24
|
+
/** Builds the test body for one exploration. */
|
|
25
|
+
export function createExploreBody(options) {
|
|
26
|
+
const { state } = options;
|
|
27
|
+
const now = options.now ?? Date.now;
|
|
28
|
+
const accounts = options.accounts ?? [];
|
|
29
|
+
return async ({ agent, app }) => {
|
|
30
|
+
const deadline = now() + state.budgets.timeoutMs;
|
|
31
|
+
if (options.openApp)
|
|
32
|
+
await app.open();
|
|
33
|
+
// Resolved here, once the runner has the credential registry up.
|
|
34
|
+
const secrets = accounts.length === 0
|
|
35
|
+
? undefined
|
|
36
|
+
: Object.fromEntries(accounts.map((account) => [account.name, { username: account.username, password: credentials.user(account.name).password }]));
|
|
37
|
+
const ending = await runSteps({ agent, state, accounts, secrets, stepTimeoutMs: options.stepTimeoutMs, remaining: () => deadline - now() });
|
|
38
|
+
state.end(ending.ended, ending.summary);
|
|
39
|
+
conclude(state);
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Plan, act, repeat, until something ends the run; returns why. A cancelled
|
|
44
|
+
* step or a failing provider throws out instead, and the record keeps its
|
|
45
|
+
* `aborted` default.
|
|
46
|
+
*/
|
|
47
|
+
async function runSteps(loop) {
|
|
48
|
+
const { agent, state, remaining } = loop;
|
|
49
|
+
/** Planner answers outside the grammar in a row; one is covered, two end the run. */
|
|
50
|
+
let plannerFailures = 0;
|
|
51
|
+
for (;;) {
|
|
52
|
+
const stop = mustFinish(state, remaining());
|
|
53
|
+
if (stop !== undefined && remaining() < MIN_PLAN_TIMEOUT_MS)
|
|
54
|
+
return { ended: stop.ended };
|
|
55
|
+
let plan;
|
|
56
|
+
try {
|
|
57
|
+
plan = await planNext(agent, state, {
|
|
58
|
+
mustFinish: stop !== undefined,
|
|
59
|
+
reason: stop?.reason,
|
|
60
|
+
accounts: loop.accounts,
|
|
61
|
+
remainingMs: remaining(),
|
|
62
|
+
timeoutMs: Math.max(MIN_PLAN_TIMEOUT_MS, Math.min(PLAN_TIMEOUT_MS, remaining())),
|
|
63
|
+
});
|
|
64
|
+
plannerFailures = 0;
|
|
65
|
+
}
|
|
66
|
+
catch (cause) {
|
|
67
|
+
// A model that cannot produce a plan in the grammar, even after the
|
|
68
|
+
// repair round, is a model shortcoming, not the end of the world: one
|
|
69
|
+
// failure is covered by a built-in charter (a survey first, a
|
|
70
|
+
// continuation later); two in a row end the exploration with the
|
|
71
|
+
// record so far; a failed closing assessment leaves the run to end for
|
|
72
|
+
// the reason it had to, without one. Anything else (the provider, the
|
|
73
|
+
// clock, a cancellation) is the run's error.
|
|
74
|
+
if (!isAgentError(cause) || cause.code !== 'MODEL_OUTPUT_INVALID')
|
|
75
|
+
throw cause;
|
|
76
|
+
if (stop !== undefined)
|
|
77
|
+
return { ended: stop.ended };
|
|
78
|
+
plannerFailures += 1;
|
|
79
|
+
if (plannerFailures > 1)
|
|
80
|
+
return { ended: 'aborted' };
|
|
81
|
+
plan = state.steps.length === 0 ? SURVEY_STEP : CONTINUE_STEP;
|
|
82
|
+
}
|
|
83
|
+
if (plan.kind === 'finish')
|
|
84
|
+
return { ended: stop?.ended ?? 'finished', summary: plan.summary };
|
|
85
|
+
// Asked to finish, the model planned a step anyway: the budget wins.
|
|
86
|
+
if (stop !== undefined)
|
|
87
|
+
return { ended: stop.ended };
|
|
88
|
+
// The plan call took its own time; a step still has to fit before the
|
|
89
|
+
// reserve, or the run is out of time whatever the check above said.
|
|
90
|
+
const room = remaining() - FINISH_RESERVE_MS;
|
|
91
|
+
if (room < MIN_STEP_MS)
|
|
92
|
+
return { ended: 'time' };
|
|
93
|
+
const step = state.beginStep(plan.title, plan.instruction);
|
|
94
|
+
const params = stepParams(state, loop.secrets);
|
|
95
|
+
try {
|
|
96
|
+
const result = await agent.act(step.instruction, {
|
|
97
|
+
timeout: Math.min(loop.stepTimeoutMs, room),
|
|
98
|
+
...(params === undefined ? {} : { params }),
|
|
99
|
+
});
|
|
100
|
+
state.endStep('passed', result.summary);
|
|
101
|
+
}
|
|
102
|
+
catch (cause) {
|
|
103
|
+
if (!isAgentError(cause))
|
|
104
|
+
throw cause;
|
|
105
|
+
state.endStep(stepStatus(cause), cause.explanation, cause.code);
|
|
106
|
+
if (cause.code === 'CANCELLED')
|
|
107
|
+
throw cause;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/** Why the loop can no longer start a step, if it cannot. */
|
|
112
|
+
function mustFinish(state, remainingMs) {
|
|
113
|
+
if (state.steps.length >= state.budgets.maxSteps) {
|
|
114
|
+
return { ended: 'step-limit', reason: `the step limit of ${state.budgets.maxSteps} is reached` };
|
|
115
|
+
}
|
|
116
|
+
const streak = state.consecutiveFailures();
|
|
117
|
+
if (streak >= CONSECUTIVE_FAILURE_LIMIT) {
|
|
118
|
+
return { ended: 'stuck', reason: `${streak} steps failed in a row without a finding; exploration is stuck` };
|
|
119
|
+
}
|
|
120
|
+
if (remainingMs < FINISH_RESERVE_MS + MIN_STEP_MS) {
|
|
121
|
+
return { ended: 'time', reason: 'the time budget is nearly spent' };
|
|
122
|
+
}
|
|
123
|
+
return undefined;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* The step parameters a charter carries: the findings so far, so the agent
|
|
127
|
+
* neither reports one twice nor spends the step re-confirming it, and the
|
|
128
|
+
* configured accounts as secrets it can fill by name. Undefined when there
|
|
129
|
+
* is nothing to carry.
|
|
130
|
+
*/
|
|
131
|
+
function stepParams(state, secrets) {
|
|
132
|
+
const reported = state.findings.map((finding) => finding.title);
|
|
133
|
+
const params = {
|
|
134
|
+
...(reported.length === 0 ? {} : { reportedFindings: reported }),
|
|
135
|
+
...(secrets === undefined ? {} : { credentials: secrets }),
|
|
136
|
+
};
|
|
137
|
+
return Object.keys(params).length === 0 ? undefined : params;
|
|
138
|
+
}
|
|
139
|
+
/** How a step that threw ended: a charter that ran out of room ended, it did not fail. */
|
|
140
|
+
function stepStatus(cause) {
|
|
141
|
+
if (cause.code === 'STEP_BUDGET_EXHAUSTED' || cause.code === 'STEP_TIMEOUT')
|
|
142
|
+
return 'exhausted';
|
|
143
|
+
return cause.code === 'CANCELLED' || cause.blocked ? 'blocked' : 'failed';
|
|
144
|
+
}
|
|
145
|
+
/** The first charter when the planner could not write one: look around. */
|
|
146
|
+
const SURVEY_STEP = {
|
|
147
|
+
kind: 'step',
|
|
148
|
+
title: 'Survey the app',
|
|
149
|
+
instruction: 'Survey the app: visit each top-level page or screen the navigation offers once, note what each one is for and which controls it has, and try one obvious action on each. Report any defect you see on the way.',
|
|
150
|
+
};
|
|
151
|
+
/** A later charter when the planner could not write one: carry on with what the goal names and no step covered. */
|
|
152
|
+
const CONTINUE_STEP = {
|
|
153
|
+
kind: 'step',
|
|
154
|
+
title: 'Continue exploring',
|
|
155
|
+
instruction: 'Continue the exploration: from the goal in the project context and the previously completed steps, pick the flow or screen the goal names that no step has covered yet, exercise it end to end with realistic inputs, and report any defect you see on the way.',
|
|
156
|
+
};
|
|
157
|
+
/** Turns the record into the run's verdict. */
|
|
158
|
+
function conclude(state) {
|
|
159
|
+
if (state.steps.length === 0 && state.findings.length === 0) {
|
|
160
|
+
throw new AgentError('AUTOMATION_UNSUPPORTED', 'exploration concluded nothing: no step ran and no finding was recorded', { blocked: true });
|
|
161
|
+
}
|
|
162
|
+
const issues = state.issues;
|
|
163
|
+
if (issues.length > 0) {
|
|
164
|
+
const titles = issues.map((finding) => `[severity ${finding.severity}] ${finding.title}`).join('; ');
|
|
165
|
+
throw new AgentError('ASSERTION_FAILED', `exploration found ${issues.length} issue(s): ${titles}`);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
//# sourceMappingURL=body.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"body.js","sourceRoot":"","sources":["../../src/explore/body.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,QAAQ,EAAuC,MAAM,WAAW,CAAC;AAG1E,4GAA4G;AAC5G,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC;AAC3C,wEAAwE;AACxE,MAAM,iBAAiB,GAAG,MAAM,CAAC;AACjC,oDAAoD;AACpD,MAAM,WAAW,GAAG,MAAM,CAAC;AA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QACtB,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,aAAa,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrG,MAAM,IAAI,UAAU,CAAC,kBAAkB,EAAE,qBAAqB,MAAM,CAAC,MAAM,cAAc,MAAM,EAAE,CAAC,CAAC;IACrG,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The explorer: the built-in agent (`createAgent`) with exploration guidance
|
|
3
|
+
* appended to the project's and one tool added to the project's vocabulary,
|
|
4
|
+
* `report_finding`. Nothing else changes: budgets, loop guards, wind-down,
|
|
5
|
+
* secrets, origin policy, and the transcript are the harness's, and each
|
|
6
|
+
* exploration step runs as one ordinary `agent.act` step.
|
|
7
|
+
*/
|
|
8
|
+
import { type DefaultAgent } from '../agent/default-agent.ts';
|
|
9
|
+
import type { StepExecutor } from '../agent/executor.ts';
|
|
10
|
+
import type { ExploreState } from './state.ts';
|
|
11
|
+
export declare const FINDING_TOOL_NAME = "report_finding";
|
|
12
|
+
export interface ExplorerOptions {
|
|
13
|
+
readonly state: ExploreState;
|
|
14
|
+
/** The executor the agent the exploration runs as resolved to; undefined is the built-in agent. */
|
|
15
|
+
readonly from: StepExecutor | undefined;
|
|
16
|
+
/** Told when a hand-rolled executor is replaced. */
|
|
17
|
+
readonly notice: (message: string) => void;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Builds the explorer. An executor `createAgent` built lends its tools,
|
|
21
|
+
* guidance, model, and provider options; a hand-rolled one has no readable
|
|
22
|
+
* vocabulary and is replaced, with a notice, keeping the model it brought.
|
|
23
|
+
*/
|
|
24
|
+
export declare function createExplorer(options: ExplorerOptions): DefaultAgent;
|
|
25
|
+
//# sourceMappingURL=executor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../src/explore/executor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAA+B,KAAK,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC3F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,eAAO,MAAM,iBAAiB,mBAAmB,CAAC;AAYlD,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B,mGAAmG;IACnG,QAAQ,CAAC,IAAI,EAAE,YAAY,GAAG,SAAS,CAAC;IACxC,oDAAoD;IACpD,QAAQ,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5C;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,eAAe,GAAG,YAAY,CAgBrE"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The explorer: the built-in agent (`createAgent`) with exploration guidance
|
|
3
|
+
* appended to the project's and one tool added to the project's vocabulary,
|
|
4
|
+
* `report_finding`. Nothing else changes: budgets, loop guards, wind-down,
|
|
5
|
+
* secrets, origin policy, and the transcript are the harness's, and each
|
|
6
|
+
* exploration step runs as one ordinary `agent.act` step.
|
|
7
|
+
*/
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
import { createAgent, isDefaultAgent } from '../agent/default-agent.js';
|
|
10
|
+
import { defineTool, getToolContext } from '../agent/tool.js';
|
|
11
|
+
import { asSdkLanguageModel } from '../config/agent.js';
|
|
12
|
+
export const FINDING_TOOL_NAME = 'report_finding';
|
|
13
|
+
/** Appended to the project's own guidance; the goal itself travels as agent context. */
|
|
14
|
+
const EXPLORE_RULES = `Exploration mode: this run has no scripted test. Each step is an exploration charter the planner wrote toward the goal given in the project context.
|
|
15
|
+
- Think like a curious first-time user hunting for bugs: exercise the flow the charter names end to end, with realistic inputs and edge cases. Interact, do not just look: fill forms with obviously made-up test data and submit them, save and come back to check what was kept, sign in with made-up credentials when none are configured, and when a list has several items act on one that is not the first and check that the right one changed.
|
|
16
|
+
- On every screen, sanity-check beyond "it renders": totals equal the sum of their parts and quantities multiply; counts match the items listed; nothing is negative that cannot be; dates are plausible and in order, not an epoch default; copy has no template tokens, placeholders, or misspellings; every control does what its name says; what a screen claims happened (saved, added, removed) is true on the next screen; a password is never shown as you type it.
|
|
17
|
+
- Report every defect with ${FINDING_TOOL_NAME} the moment the evidence is on screen, one call per distinct defect: what you expected, what the screen shows, and the actions that reach it. Do not save findings for the conclusion: a defect that appears only in a summary is lost, since the report reads the tool, not the prose. Findings listed under "reportedFindings" in the step parameters are already recorded: never report them again and spend no actions re-confirming them.
|
|
18
|
+
- Accounts listed under "credentials" in the step parameters are yours to sign in with: type the username as text and fill the password with type_secret by the account's name. Never type a password as text, and never ask for one. If no type_secret tool is offered, this engine cannot fill a password securely: skip signing in, note it in the step summary, and explore what is reachable without it.
|
|
19
|
+
- Report defects, not wishes. A defect is something the screen breaks or contradicts: a wrong value, a dead control, a navigation that lands wrong, a claim that turns out false, leaked template text, a misspelling. A missing feature, a design choice, a form the browser refuses to submit while a required field is empty, or something you merely expected is not a defect unless the screen or the goal promised it. A failed tool call, a refused action, or a limit of this harness is not a product defect either.
|
|
20
|
+
- Stay inside the application under test. Do not destroy data that existed before this run (deleting accounts, wiping lists) unless the goal asks for it; creating and editing your own data is fine.
|
|
21
|
+
- When the charter is covered, or nothing new is reachable within it, call complete_step. "passed" means you carried the charter out, however many defects you reported on the way: reported findings never make a step fail. "failed" is only for a charter the application would not let you carry out at all: a flow that cannot be completed, a page that cannot be reached. Keep to the charter: a step is one flow, not the whole app. The summary is read by the planner of the next step: say what was covered, what was found, and what looks worth exploring next.`;
|
|
22
|
+
/**
|
|
23
|
+
* Builds the explorer. An executor `createAgent` built lends its tools,
|
|
24
|
+
* guidance, model, and provider options; a hand-rolled one has no readable
|
|
25
|
+
* vocabulary and is replaced, with a notice, keeping the model it brought.
|
|
26
|
+
*/
|
|
27
|
+
export function createExplorer(options) {
|
|
28
|
+
const { from } = options;
|
|
29
|
+
const base = isDefaultAgent(from) ? from.options : undefined;
|
|
30
|
+
if (from !== undefined && base === undefined) {
|
|
31
|
+
options.notice(`the configured agent "${from.name}" is a custom executor; explore runs the built-in agent instead` +
|
|
32
|
+
(from.model === undefined ? '' : ', with the model that executor brought'));
|
|
33
|
+
}
|
|
34
|
+
const carried = base === undefined && from?.model !== undefined ? { model: asSdkLanguageModel(from.model) } : {};
|
|
35
|
+
return createAgent({
|
|
36
|
+
...base,
|
|
37
|
+
...carried,
|
|
38
|
+
system: [base?.system, EXPLORE_RULES].filter((part) => part !== undefined && part.trim() !== '').join('\n\n'),
|
|
39
|
+
tools: { ...base?.tools, [FINDING_TOOL_NAME]: createFindingTool(options.state) },
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
const FINDING_SCHEMA = z.object({
|
|
43
|
+
title: z
|
|
44
|
+
.string()
|
|
45
|
+
.min(4)
|
|
46
|
+
.max(200)
|
|
47
|
+
.describe('A short, specific name for the defect, e.g. "Checkout total shows $0.00 with two items in the cart".'),
|
|
48
|
+
kind: z
|
|
49
|
+
.enum(['issue', 'warning'])
|
|
50
|
+
.describe('issue = a defect a user would hit: a broken flow, wrong data, a dead control, a navigation that lands wrong. warning = cosmetic or polish; blocks no task.'),
|
|
51
|
+
severity: z
|
|
52
|
+
.literal([1, 2, 3, 4, 5])
|
|
53
|
+
.describe('5: a core journey is impossible, data is lost, or money or security is wrong. 4: a core feature is broken but a workaround exists, or wrong money or quantity values are shown. 3: a secondary feature is broken, or wrong non-monetary content. 2: a cosmetic or layout defect that blocks nothing. 1: a trivial polish item (usually a warning).'),
|
|
54
|
+
expected: z.string().min(1).max(2000).describe('What a user would expect here.'),
|
|
55
|
+
actual: z.string().min(1).max(2000).describe('What the screen shows instead, quoted from the observation.'),
|
|
56
|
+
reproduction: z
|
|
57
|
+
.array(z.string().min(1).max(500))
|
|
58
|
+
.min(1)
|
|
59
|
+
.max(20)
|
|
60
|
+
.describe('The actions that reach the defect from the start of the app, one per entry.'),
|
|
61
|
+
});
|
|
62
|
+
/**
|
|
63
|
+
* The finding tool. Read-only: it observes the screen for the location and
|
|
64
|
+
* the evidence pixels, records the finding against the step in progress,
|
|
65
|
+
* keeps the pixels as a screenshot artifact of the step, and answers the
|
|
66
|
+
* model with the finding's number so it is not reported twice.
|
|
67
|
+
*/
|
|
68
|
+
function createFindingTool(state) {
|
|
69
|
+
return defineTool({
|
|
70
|
+
description: 'Report one product defect you have evidence of on the current screen: what you expected, what the screen shows, and how to reach it. Call it the moment the evidence is visible, once per distinct defect. Not for tool errors or refused actions.',
|
|
71
|
+
inputSchema: FINDING_SCHEMA,
|
|
72
|
+
execute: async (input, executionOptions) => {
|
|
73
|
+
const { observe, attachScreenshot } = getToolContext(executionOptions);
|
|
74
|
+
const observation = await observe({ pixels: true }).catch(() => undefined);
|
|
75
|
+
const finding = state.addFinding({ ...input, path: observation?.path, observationRevision: observation?.revision });
|
|
76
|
+
if (observation?.pixels !== undefined) {
|
|
77
|
+
// Evidence is worth keeping, never worth failing the finding for.
|
|
78
|
+
const artifactId = await attachScreenshot(observation.pixels, `finding-${finding.index + 1}`).catch(() => undefined);
|
|
79
|
+
if (artifactId !== undefined)
|
|
80
|
+
state.attachEvidence(finding.id, artifactId);
|
|
81
|
+
}
|
|
82
|
+
return `Finding ${finding.index + 1} recorded (${finding.kind}, severity ${finding.severity}): ${finding.title}. Do not report it again; continue the charter or conclude the step.`;
|
|
83
|
+
},
|
|
84
|
+
}, { mutates: false });
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../src/explore/executor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;A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