@e2edev/e2e 0.9.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 +12 -6
- 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 +2 -2
- package/dist/agent/act-validation.js.map +1 -1
- package/dist/agent/act.d.ts +1 -0
- package/dist/agent/act.d.ts.map +1 -1
- package/dist/agent/act.js +41 -18
- 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/index.d.ts.map +1 -1
- package/dist/agent/index.js +17 -12
- package/dist/agent/index.js.map +1 -1
- package/dist/agent/invocation.d.ts +26 -6
- package/dist/agent/invocation.d.ts.map +1 -1
- package/dist/agent/invocation.js +9 -6
- package/dist/agent/invocation.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 +121 -33
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/init/engine-versions.json +1 -0
- package/dist/cli/init/engines.d.ts +13 -8
- package/dist/cli/init/engines.d.ts.map +1 -1
- package/dist/cli/init/engines.js +26 -7
- package/dist/cli/init/engines.js.map +1 -1
- 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 +26 -13
- package/dist/cli/init/scaffold.js.map +1 -1
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +51 -13
- 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 +13 -4
- package/dist/collect/registry.js.map +1 -1
- package/dist/collect/select.d.ts +2 -0
- package/dist/collect/select.d.ts.map +1 -1
- package/dist/collect/select.js +9 -0
- package/dist/collect/select.js.map +1 -1
- package/dist/config/agent.d.ts +16 -33
- package/dist/config/agent.d.ts.map +1 -1
- package/dist/config/agent.js +50 -140
- package/dist/config/agent.js.map +1 -1
- package/dist/config/esm-hooks.d.ts +28 -0
- package/dist/config/esm-hooks.d.ts.map +1 -0
- package/dist/config/esm-hooks.js +35 -0
- package/dist/config/esm-hooks.js.map +1 -0
- package/dist/config/load.d.ts +6 -0
- package/dist/config/load.d.ts.map +1 -1
- package/dist/config/load.js +52 -5
- package/dist/config/load.js.map +1 -1
- package/dist/config/resolve.d.ts +7 -0
- package/dist/config/resolve.d.ts.map +1 -1
- package/dist/config/resolve.js +53 -13
- package/dist/config/resolve.js.map +1 -1
- package/dist/engine/index.d.ts +8 -2
- package/dist/engine/index.d.ts.map +1 -1
- package/dist/engine/index.js.map +1 -1
- package/dist/engine/surface.d.ts +2 -2
- package/dist/engine/surface.d.ts.map +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/internal/atomic-write.d.ts +1 -1
- package/dist/internal/atomic-write.d.ts.map +1 -1
- package/dist/internal/atomic-write.js.map +1 -1
- package/dist/internal/package-version.d.ts +2 -0
- package/dist/internal/package-version.d.ts.map +1 -1
- package/dist/internal/package-version.js +9 -0
- package/dist/internal/package-version.js.map +1 -1
- package/dist/internal/redact.d.ts +12 -4
- package/dist/internal/redact.d.ts.map +1 -1
- package/dist/internal/redact.js +61 -12
- package/dist/internal/redact.js.map +1 -1
- package/dist/internal/zip.d.ts +32 -0
- package/dist/internal/zip.d.ts.map +1 -0
- package/dist/internal/zip.js +183 -0
- package/dist/internal/zip.js.map +1 -0
- package/dist/report/build.d.ts +55 -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/report/list.d.ts.map +1 -1
- package/dist/report/list.js +2 -0
- package/dist/report/list.js.map +1 -1
- package/dist/run/artifacts.d.ts.map +1 -1
- package/dist/run/artifacts.js +8 -6
- package/dist/run/artifacts.js.map +1 -1
- package/dist/run/events.d.ts +4 -2
- package/dist/run/events.d.ts.map +1 -1
- package/dist/run/events.js.map +1 -1
- package/dist/run/execute.d.ts.map +1 -1
- package/dist/run/execute.js +29 -2
- package/dist/run/execute.js.map +1 -1
- package/dist/run/fixtures.d.ts +10 -1
- package/dist/run/fixtures.d.ts.map +1 -1
- package/dist/run/fixtures.js +39 -22
- package/dist/run/fixtures.js.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/records.d.ts +8 -6
- package/dist/run/records.d.ts.map +1 -1
- package/dist/run/runner.d.ts +22 -1
- package/dist/run/runner.d.ts.map +1 -1
- package/dist/run/runner.js +22 -14
- package/dist/run/runner.js.map +1 -1
- package/dist/run/secrecy.d.ts +23 -0
- package/dist/run/secrecy.d.ts.map +1 -0
- package/dist/run/secrecy.js +22 -0
- package/dist/run/secrecy.js.map +1 -0
- package/dist/run/steps.d.ts +11 -0
- package/dist/run/steps.d.ts.map +1 -1
- package/dist/run/steps.js +1 -0
- package/dist/run/steps.js.map +1 -1
- package/dist/run/trace-redaction.d.ts +17 -0
- package/dist/run/trace-redaction.d.ts.map +1 -0
- package/dist/run/trace-redaction.js +148 -0
- package/dist/run/trace-redaction.js.map +1 -0
- package/dist/run/worker-models.d.ts +14 -14
- package/dist/run/worker-models.d.ts.map +1 -1
- package/dist/run/worker-models.js +34 -26
- 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 +32 -25
- package/dist/types.d.ts.map +1 -1
- package/package.json +6 -4
- package/skills/e2e/SKILL.md +12 -5
- package/skills/e2e/references/agent.md +22 -17
- package/skills/e2e/references/debugging.md +3 -2
- package/skills/e2e/references/explore.md +83 -0
- package/skills/e2e/references/running.md +8 -3
- package/skills/e2e/references/setup.md +17 -13
- package/skills/e2e/references/writing-tests.md +1 -0
- package/dist/config/esm.d.ts +0 -4
- package/dist/config/esm.d.ts.map +0 -1
- package/dist/config/esm.js +0 -35
- package/dist/config/esm.js.map +0 -1
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The planner: between exploration steps, one structured model call decides
|
|
3
|
+
* the next charter or finishes the run. It runs as an `agent.extract` step,
|
|
4
|
+
* so it reads the current screen and the ledger of prior steps the same way
|
|
5
|
+
* every judgment does, under the same budgets and repair loop.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
import type { Agent } from '../types.ts';
|
|
9
|
+
import { type ExploreState } from './state.ts';
|
|
10
|
+
/**
|
|
11
|
+
* A flat object with every field required rather than a union: OpenAI's
|
|
12
|
+
* strict structured output rejects a schema whose `required` omits a
|
|
13
|
+
* property, and every provider renders a flat object. Fields the decision
|
|
14
|
+
* does not use are empty strings. The shape is lenient on purpose: a model
|
|
15
|
+
* that puts the whole charter into `title` and leaves `instruction` empty
|
|
16
|
+
* (seen live) has still planned a step, and `repairPlan` derives the missing
|
|
17
|
+
* field rather than spending the repair round on it.
|
|
18
|
+
*/
|
|
19
|
+
export declare const PLAN_SCHEMA: z.ZodObject<{
|
|
20
|
+
decision: z.ZodEnum<{
|
|
21
|
+
finish: "finish";
|
|
22
|
+
step: "step";
|
|
23
|
+
}>;
|
|
24
|
+
title: z.ZodString;
|
|
25
|
+
instruction: z.ZodString;
|
|
26
|
+
summary: z.ZodString;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
type PlanAnswer = z.output<typeof PLAN_SCHEMA>;
|
|
29
|
+
export type PlanDecision = {
|
|
30
|
+
readonly kind: 'step';
|
|
31
|
+
readonly title: string;
|
|
32
|
+
readonly instruction: string;
|
|
33
|
+
} | {
|
|
34
|
+
readonly kind: 'finish';
|
|
35
|
+
readonly summary: string;
|
|
36
|
+
};
|
|
37
|
+
/** One configured credential the explorer can sign in with, by name; the password stays out of every prompt. */
|
|
38
|
+
export interface PlanAccount {
|
|
39
|
+
readonly name: string;
|
|
40
|
+
readonly username: string;
|
|
41
|
+
}
|
|
42
|
+
export interface PlanRequest {
|
|
43
|
+
/** The run must end now; the planner is asked for the closing assessment only. */
|
|
44
|
+
readonly mustFinish: boolean;
|
|
45
|
+
/** The accounts the explorer can sign in with. */
|
|
46
|
+
readonly accounts?: readonly PlanAccount[] | undefined;
|
|
47
|
+
/** Why it must end, in the planner's prompt. */
|
|
48
|
+
readonly reason?: string | undefined;
|
|
49
|
+
readonly remainingMs: number;
|
|
50
|
+
readonly timeoutMs: number;
|
|
51
|
+
}
|
|
52
|
+
/** Asks the model for the next charter or the closing assessment. */
|
|
53
|
+
export declare function planNext(agent: Agent, state: ExploreState, request: PlanRequest): Promise<PlanDecision>;
|
|
54
|
+
/**
|
|
55
|
+
* The decision, after the repairs live providers' answers have needed. Every
|
|
56
|
+
* repair the planner makes is here:
|
|
57
|
+
*
|
|
58
|
+
* - Digit runs a provider pads a field with (seen live: a title followed by
|
|
59
|
+
* hundreds of `1234567890`) are removed; they carry no meaning and would
|
|
60
|
+
* otherwise become the charter's tail. The threshold sits past any number a
|
|
61
|
+
* charter can mean: phone numbers, order ids, card numbers, and amounts all
|
|
62
|
+
* stop short of twenty digits.
|
|
63
|
+
* - A step with only one of `title` and `instruction` filled has the other
|
|
64
|
+
* derived: a charter with no title takes its first clause, a title with no
|
|
65
|
+
* charter is the charter.
|
|
66
|
+
*
|
|
67
|
+
* Length is not repaired here: the grammar accepts long fields, and the state
|
|
68
|
+
* clips them to the report's ceilings when the step opens.
|
|
69
|
+
*/
|
|
70
|
+
export declare function repairPlan(answer: PlanAnswer): PlanDecision;
|
|
71
|
+
/** The planner's instruction: the goal, the record so far, the budget, and how to decide. */
|
|
72
|
+
export declare function planInstruction(state: ExploreState, request: PlanRequest): string;
|
|
73
|
+
export {};
|
|
74
|
+
//# sourceMappingURL=plan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../src/explore/plan.ts"],"names":[],"mappings":"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AeG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,UAAU,GAAG,YAAY,CAS3D;AAmBD,6FAA6F;AAC7F,wBAAgB,eAAe,CAAC,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,WAAW,GAAG,MAAM,CA2DjF"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The planner: between exploration steps, one structured model call decides
|
|
3
|
+
* the next charter or finishes the run. It runs as an `agent.extract` step,
|
|
4
|
+
* so it reads the current screen and the ledger of prior steps the same way
|
|
5
|
+
* every judgment does, under the same budgets and repair loop.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
import { MAX_TITLE_CHARS } from './state.js';
|
|
9
|
+
const MIN_SUMMARY_CHARS = 10;
|
|
10
|
+
/** A title derived from an instruction stops at the first clause or here. */
|
|
11
|
+
const DERIVED_TITLE_CHARS = 80;
|
|
12
|
+
/**
|
|
13
|
+
* The most the grammar accepts in one field. Well above the report's ceilings,
|
|
14
|
+
* which the state clips to when the step opens: a model that pours a whole
|
|
15
|
+
* charter into one field (seen live, past 2000 characters) has still planned
|
|
16
|
+
* a step, and a rejection would cost a repair round for nothing.
|
|
17
|
+
*/
|
|
18
|
+
const MAX_FIELD_CHARS = 8_000;
|
|
19
|
+
/**
|
|
20
|
+
* A flat object with every field required rather than a union: OpenAI's
|
|
21
|
+
* strict structured output rejects a schema whose `required` omits a
|
|
22
|
+
* property, and every provider renders a flat object. Fields the decision
|
|
23
|
+
* does not use are empty strings. The shape is lenient on purpose: a model
|
|
24
|
+
* that puts the whole charter into `title` and leaves `instruction` empty
|
|
25
|
+
* (seen live) has still planned a step, and `repairPlan` derives the missing
|
|
26
|
+
* field rather than spending the repair round on it.
|
|
27
|
+
*/
|
|
28
|
+
export const PLAN_SCHEMA = z
|
|
29
|
+
.object({
|
|
30
|
+
decision: z.enum(['step', 'finish']),
|
|
31
|
+
title: z.string().max(MAX_FIELD_CHARS).describe('For a step: the area or flow in a few words. Empty for finish.'),
|
|
32
|
+
instruction: z.string().max(MAX_FIELD_CHARS).describe('For a step: the concrete charter. Empty for finish.'),
|
|
33
|
+
summary: z.string().max(MAX_FIELD_CHARS).describe('For finish: the overall assessment. Empty for a step.'),
|
|
34
|
+
})
|
|
35
|
+
.superRefine((value, context) => {
|
|
36
|
+
if (value.decision === 'step') {
|
|
37
|
+
if (`${value.title}${value.instruction}`.trim() === '') {
|
|
38
|
+
context.addIssue({ code: 'custom', path: ['instruction'], message: 'a step needs a concrete instruction' });
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
else if (value.summary.trim().length < MIN_SUMMARY_CHARS) {
|
|
42
|
+
context.addIssue({ code: 'custom', path: ['summary'], message: 'finishing needs an overall assessment' });
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
/** Asks the model for the next charter or the closing assessment. */
|
|
46
|
+
export async function planNext(agent, state, request) {
|
|
47
|
+
return repairPlan(await agent.extract(planInstruction(state, request), { schema: PLAN_SCHEMA, timeout: request.timeoutMs }));
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* The decision, after the repairs live providers' answers have needed. Every
|
|
51
|
+
* repair the planner makes is here:
|
|
52
|
+
*
|
|
53
|
+
* - Digit runs a provider pads a field with (seen live: a title followed by
|
|
54
|
+
* hundreds of `1234567890`) are removed; they carry no meaning and would
|
|
55
|
+
* otherwise become the charter's tail. The threshold sits past any number a
|
|
56
|
+
* charter can mean: phone numbers, order ids, card numbers, and amounts all
|
|
57
|
+
* stop short of twenty digits.
|
|
58
|
+
* - A step with only one of `title` and `instruction` filled has the other
|
|
59
|
+
* derived: a charter with no title takes its first clause, a title with no
|
|
60
|
+
* charter is the charter.
|
|
61
|
+
*
|
|
62
|
+
* Length is not repaired here: the grammar accepts long fields, and the state
|
|
63
|
+
* clips them to the report's ceilings when the step opens.
|
|
64
|
+
*/
|
|
65
|
+
export function repairPlan(answer) {
|
|
66
|
+
if (answer.decision === 'finish')
|
|
67
|
+
return { kind: 'finish', summary: unpad(answer.summary) };
|
|
68
|
+
const title = unpad(answer.title);
|
|
69
|
+
const instruction = unpad(answer.instruction);
|
|
70
|
+
const charter = instruction === '' ? title : instruction;
|
|
71
|
+
// A title that stood in for the charter is a heading only while it is short.
|
|
72
|
+
const longest = instruction === '' ? DERIVED_TITLE_CHARS : MAX_TITLE_CHARS;
|
|
73
|
+
const heading = title !== '' && title.length <= longest ? title : deriveTitle(charter);
|
|
74
|
+
return { kind: 'step', title: heading, instruction: charter };
|
|
75
|
+
}
|
|
76
|
+
function unpad(text) {
|
|
77
|
+
return text.replace(/\s*\d{20,}\s*/g, ' ').trim();
|
|
78
|
+
}
|
|
79
|
+
function deriveTitle(charter) {
|
|
80
|
+
const clause = charter.split(/[.:;\n]/, 1)[0].trim();
|
|
81
|
+
const short = clause === '' ? charter : clause;
|
|
82
|
+
return short.length <= DERIVED_TITLE_CHARS ? short : `${short.slice(0, DERIVED_TITLE_CHARS - 1)}…`;
|
|
83
|
+
}
|
|
84
|
+
const STATUS_MARKS = {
|
|
85
|
+
passed: 'passed',
|
|
86
|
+
failed: 'FAILED',
|
|
87
|
+
blocked: 'blocked',
|
|
88
|
+
exhausted: 'ended at its limit',
|
|
89
|
+
};
|
|
90
|
+
/** The planner's instruction: the goal, the record so far, the budget, and how to decide. */
|
|
91
|
+
export function planInstruction(state, request) {
|
|
92
|
+
const used = state.steps.length;
|
|
93
|
+
const minutesLeft = Math.max(0, Math.round(request.remainingMs / 60_000));
|
|
94
|
+
const steps = used === 0
|
|
95
|
+
? '(none yet: this is the first step)'
|
|
96
|
+
: state.steps
|
|
97
|
+
.map((step) => `${step.index}. [${STATUS_MARKS[step.status]}] ${step.title}${step.summary === undefined ? '' : ` — ${step.summary}`}`)
|
|
98
|
+
.join('\n');
|
|
99
|
+
const findings = state.findings.length === 0
|
|
100
|
+
? '(none yet)'
|
|
101
|
+
: state.findings.map((finding) => `- [${finding.kind}, severity ${finding.severity}] ${finding.title}`).join('\n');
|
|
102
|
+
const header = [
|
|
103
|
+
request.mustFinish
|
|
104
|
+
? 'Finish an exploratory test run with your overall assessment.'
|
|
105
|
+
: 'Plan the next step of an exploratory test run, or finish it.',
|
|
106
|
+
'',
|
|
107
|
+
`Goal: ${state.goal}`,
|
|
108
|
+
`Budget: ${used} of ${state.budgets.maxSteps} steps used, about ${minutesLeft} minute(s) left.`,
|
|
109
|
+
'',
|
|
110
|
+
'Steps so far:',
|
|
111
|
+
steps,
|
|
112
|
+
'',
|
|
113
|
+
'Findings so far:',
|
|
114
|
+
findings,
|
|
115
|
+
...(request.accounts === undefined || request.accounts.length === 0
|
|
116
|
+
? []
|
|
117
|
+
: [
|
|
118
|
+
'',
|
|
119
|
+
'Accounts the agent can sign in with (it fills the password itself, by name):',
|
|
120
|
+
...request.accounts.map((account) => `- ${account.name} (username: ${account.username})`),
|
|
121
|
+
]),
|
|
122
|
+
'',
|
|
123
|
+
];
|
|
124
|
+
if (request.mustFinish) {
|
|
125
|
+
return [
|
|
126
|
+
...header,
|
|
127
|
+
`The run must end now: ${request.reason ?? 'its budget is spent'}.`,
|
|
128
|
+
'Respond with {"decision": "finish", "title": "", "instruction": "", "summary": "..."}: the overall assessment in two to five sentences,',
|
|
129
|
+
'what was explored, the key findings, and your verdict on the goal. Ground it in the steps and findings above.',
|
|
130
|
+
].join('\n');
|
|
131
|
+
}
|
|
132
|
+
return [
|
|
133
|
+
...header,
|
|
134
|
+
'Decide from the goal, the steps so far, and the current screen:',
|
|
135
|
+
'- "step": the next exploration charter. "title" names the area or flow in a few words. "instruction" is a concrete,',
|
|
136
|
+
' self-contained charter for an agent that sees only the screen and that text: which flow to exercise, what inputs',
|
|
137
|
+
' to try, what to check. One flow or screen per step, sized for five to fifteen actions; split anything bigger.',
|
|
138
|
+
' Ask the agent to interact, not only to look: submit forms with made-up test data, save and revisit, sign in with',
|
|
139
|
+
' the accounts listed above (or made-up credentials when none are configured), act on a non-first item of a list. Prefer breadth: touch the main',
|
|
140
|
+
' flows the goal names before drilling deeper into one. Do not re-test an area a passed step already covered, and',
|
|
141
|
+
' never plan a step to re-confirm a finding already recorded above. When a step ended at its limit, continue where',
|
|
142
|
+
' it stopped or move on. When a step summary mentions something odd that is not among the findings, spend the next',
|
|
143
|
+
' step confirming it.',
|
|
144
|
+
'- "finish": the goal is covered, or nothing new is reachable. "summary" is the overall assessment in two to',
|
|
145
|
+
' five sentences: what was explored, the key findings, and your verdict on the goal.',
|
|
146
|
+
'Respond with every field present: {"decision": "step", "title": "...", "instruction": "...", "summary": ""} or {"decision": "finish", "title": "", "instruction": "", "summary": "..."}.',
|
|
147
|
+
].join('\n');
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=plan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan.js","sourceRoot":"","sources":["../../src/explore/plan.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,eAAe,EAAqB,MAAM,YAAY,CAAC;AAEhE,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAC7B,6EAA6E;AAC7E,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAC/B;;;;;GAKG;AACH,MAAM,eAAe,GAAG,KAAK,CAAC;AAE9B;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC;KACzB,MAAM,CAAC;IACN,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACpC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,QAAQ,CAAC,gEAAgE,CAAC;IACjH,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,QAAQ,CAAC,qDAAqD,CAAC;IAC5G,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC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F,eAAe;QACf,KAAK;QACL,EAAE;QACF,kBAAkB;QAClB,QAAQ;QACR,GAAG,CAAC,OAAO,CAAC,QAAQ,KAAK,SAAS,IAAI,OAAO,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC;YACjE,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC;gBACE,EAAE;gBACF,8EAA8E;gBAC9E,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,KAAK,OAAO,CAAC,IAAI,eAAe,OAAO,CAAC,QAAQ,GAAG,CAAC;aAC1F,CAAC;QACN,EAAE;KACH,CAAC;IACF,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;QACvB,OAAO;YACL,GAAG,MAAM;YACT,yBAAyB,OAAO,CAAC,MAAM,IAAI,qBAAqB,GAAG;YACnE,yIAAyI;YACzI,+GAA+G;SAChH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACf,CAAC;IACD,OAAO;QACL,GAAG,MAAM;QACT,iEAAiE;QACjE,qHAAqH;QACrH,oHAAoH;QACpH,iHAAiH;QACjH,oHAAoH;QACpH,kJAAkJ;QAClJ,mHAAmH;QACnH,oHAAoH;QACpH,oHAAoH;QACpH,uBAAuB;QACvB,6GAA6G;QAC7G,sFAAsF;QACtF,0LAA0L;KAC3L,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The exploration summary under the run summary: a `Reporter` whose
|
|
3
|
+
* `onRunFinished` rows the list reporter prints, so the findings appear where
|
|
4
|
+
* a reporter's own rows do, and the JSON reporter is left to the report.
|
|
5
|
+
*/
|
|
6
|
+
import type { Reporter, ReporterSummary } from '../types.ts';
|
|
7
|
+
import type { ExploreState } from './state.ts';
|
|
8
|
+
export declare function exploreReporter(state: ExploreState): Reporter;
|
|
9
|
+
/** The rows: what was explored, what was found, one row per finding, and the assessment. */
|
|
10
|
+
export declare function summaryRows(state: ExploreState): ReporterSummary;
|
|
11
|
+
//# sourceMappingURL=reporter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reporter.d.ts","sourceRoot":"","sources":["../../src/explore/reporter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,wBAAgB,eAAe,CAAC,KAAK,EAAE,YAAY,GAAG,QAAQ,CAK7D;AAED,4FAA4F;AAC5F,wBAAgB,WAAW,CAAC,KAAK,EAAE,YAAY,GAAG,eAAe,CAgChE"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The exploration summary under the run summary: a `Reporter` whose
|
|
3
|
+
* `onRunFinished` rows the list reporter prints, so the findings appear where
|
|
4
|
+
* a reporter's own rows do, and the JSON reporter is left to the report.
|
|
5
|
+
*/
|
|
6
|
+
export function exploreReporter(state) {
|
|
7
|
+
return {
|
|
8
|
+
name: 'explore',
|
|
9
|
+
onRunFinished: async () => summaryRows(state),
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
/** The rows: what was explored, what was found, one row per finding, and the assessment. */
|
|
13
|
+
export function summaryRows(state) {
|
|
14
|
+
const counts = { passed: 0, failed: 0, blocked: 0, exhausted: 0 };
|
|
15
|
+
for (const step of state.steps)
|
|
16
|
+
counts[step.status] += 1;
|
|
17
|
+
const parts = [
|
|
18
|
+
`${counts.passed} passed`,
|
|
19
|
+
...(counts.failed > 0 ? [`${counts.failed} failed`] : []),
|
|
20
|
+
...(counts.exhausted > 0 ? [`${counts.exhausted} ended at their limit`] : []),
|
|
21
|
+
...(counts.blocked > 0 ? [`${counts.blocked} blocked`] : []),
|
|
22
|
+
];
|
|
23
|
+
const issues = state.issues.length;
|
|
24
|
+
const warnings = state.findings.length - issues;
|
|
25
|
+
const rows = [
|
|
26
|
+
{
|
|
27
|
+
label: 'Explored',
|
|
28
|
+
text: `${state.steps.length} step${state.steps.length === 1 ? '' : 's'} (${parts.join(', ')}); ended: ${ENDED_TEXT[state.ended]}`,
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
label: 'Findings',
|
|
32
|
+
text: state.findings.length === 0
|
|
33
|
+
? 'none'
|
|
34
|
+
: `${issues} issue${issues === 1 ? '' : 's'}, ${warnings} warning${warnings === 1 ? '' : 's'}`,
|
|
35
|
+
},
|
|
36
|
+
];
|
|
37
|
+
for (const finding of [...state.findings].toSorted((a, b) => b.severity - a.severity || a.index - b.index)) {
|
|
38
|
+
rows.push({
|
|
39
|
+
label: ` S${finding.severity} ${finding.kind}`,
|
|
40
|
+
text: `${finding.title}${finding.path === undefined ? '' : ` (${finding.path})`}`,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
if (state.summary !== undefined)
|
|
44
|
+
rows.push({ label: 'Assessment', text: state.summary });
|
|
45
|
+
return rows;
|
|
46
|
+
}
|
|
47
|
+
const ENDED_TEXT = {
|
|
48
|
+
finished: 'the agent covered the goal',
|
|
49
|
+
'step-limit': 'the step limit was reached',
|
|
50
|
+
time: 'the time budget ran out',
|
|
51
|
+
stuck: 'steps kept failing',
|
|
52
|
+
aborted: 'the run was cut short',
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=reporter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reporter.js","sourceRoot":"","sources":["../../src/explore/reporter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,MAAM,UAAU,eAAe,CAAC,KAAmB;IACjD,OAAO;QACL,IAAI,EAAE,SAAS;QACf,aAAa,EAAE,KAAK,IAAI,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC;KAC9C,CAAC;AACJ,CAAC;AAED,4FAA4F;AAC5F,MAAM,UAAU,WAAW,CAAC,KAAmB;IAC7C,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
3
|
+
* planned and ran, and the findings it reported. One instance is shared by
|
|
4
|
+
* the planner, the explorer's finding tool, the exploration body, and the
|
|
5
|
+
* summary reporter, and its snapshot becomes `run.explore` in the report.
|
|
6
|
+
* The state is the report boundary: every free text is bounded to the
|
|
7
|
+
* schema's ceilings here, and nowhere else.
|
|
8
|
+
*/
|
|
9
|
+
import type { ReportExplore, ReportExploreFinding, ReportExploreStep } from '../report/build.ts';
|
|
10
|
+
export interface ExploreBudgets {
|
|
11
|
+
readonly maxSteps: number;
|
|
12
|
+
readonly timeoutMs: number;
|
|
13
|
+
}
|
|
14
|
+
/** A finding as the tool reports it; the state assigns identity, position, and time. */
|
|
15
|
+
export type FindingInput = Omit<ReportExploreFinding, 'id' | 'index' | 'step' | 'reportedAt' | 'artifactId'>;
|
|
16
|
+
/** A step as opened: title and charter bounded to the report's ceilings, which is what the step runs with. */
|
|
17
|
+
export type OpenedStep = Pick<ReportExploreStep, 'index' | 'title' | 'instruction'>;
|
|
18
|
+
/** Ceilings mirroring `schema/report-v1.schema.json` `explore`. */
|
|
19
|
+
export declare const MAX_TITLE_CHARS = 200;
|
|
20
|
+
export declare class ExploreState {
|
|
21
|
+
#private;
|
|
22
|
+
readonly goal: string;
|
|
23
|
+
readonly budgets: ExploreBudgets;
|
|
24
|
+
private readonly now;
|
|
25
|
+
readonly steps: ReportExploreStep[];
|
|
26
|
+
readonly findings: ReportExploreFinding[];
|
|
27
|
+
constructor(goal: string, budgets: ExploreBudgets, now?: () => number);
|
|
28
|
+
/** Why exploration stopped; `aborted` until `end` says otherwise. */
|
|
29
|
+
get ended(): ReportExplore['ended'];
|
|
30
|
+
/** The agent's closing assessment, once it gave one. */
|
|
31
|
+
get summary(): string | undefined;
|
|
32
|
+
/** Opens the next step; the index is one-based. */
|
|
33
|
+
beginStep(title: string, instruction: string): OpenedStep;
|
|
34
|
+
/** Closes the open step with its outcome. */
|
|
35
|
+
endStep(status: ReportExploreStep['status'], summary?: string, errorCode?: string): ReportExploreStep;
|
|
36
|
+
/** Records one finding against the step in progress. */
|
|
37
|
+
addFinding(input: FindingInput): ReportExploreFinding;
|
|
38
|
+
/** Attaches the evidence screenshot kept for a finding, by its artifact id. */
|
|
39
|
+
attachEvidence(id: string, artifactId: string): void;
|
|
40
|
+
/** Closes the record: why exploration stopped and, when the agent gave one, its closing assessment. */
|
|
41
|
+
end(ended: ReportExplore['ended'], summary?: string): void;
|
|
42
|
+
get issues(): readonly ReportExploreFinding[];
|
|
43
|
+
/**
|
|
44
|
+
* How many steps in a row made no progress, newest first: failed or blocked
|
|
45
|
+
* without recording a finding. A failed step that reported a defect did its
|
|
46
|
+
* job, and a step that ended at its budget is a time-boxed charter, not a
|
|
47
|
+
* failure; neither breaks the streak nor adds to it.
|
|
48
|
+
*/
|
|
49
|
+
consecutiveFailures(): number;
|
|
50
|
+
snapshot(): ReportExplore;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Trims and bounds free text so the report stays inside the schema's
|
|
54
|
+
* ceilings. Counted in code points, as the schema counts, so a cut never
|
|
55
|
+
* splits a surrogate pair.
|
|
56
|
+
*/
|
|
57
|
+
export declare function clip(text: string, max: number): string;
|
|
58
|
+
//# sourceMappingURL=state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/explore/state.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEjG,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED,wFAAwF;AACxF,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,oBAAoB,EAAE,IAAI,GAAG,OAAO,GAAG,MAAM,GAAG,YAAY,GAAG,YAAY,CAAC,CAAC;AAE7G,8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AI,MAAM,CAU5B;IAED,QAAQ,IAAI,aAAa,CASxB;CACF;AAED;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAItD"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The record of one exploration: the goal, its budgets, the steps the agent
|
|
3
|
+
* planned and ran, and the findings it reported. One instance is shared by
|
|
4
|
+
* the planner, the explorer's finding tool, the exploration body, and the
|
|
5
|
+
* summary reporter, and its snapshot becomes `run.explore` in the report.
|
|
6
|
+
* The state is the report boundary: every free text is bounded to the
|
|
7
|
+
* schema's ceilings here, and nowhere else.
|
|
8
|
+
*/
|
|
9
|
+
import { timestamp, uuidv7 } from '../internal/ids.js';
|
|
10
|
+
/** Ceilings mirroring `schema/report-v1.schema.json` `explore`. */
|
|
11
|
+
export const MAX_TITLE_CHARS = 200;
|
|
12
|
+
const MAX_INSTRUCTION_CHARS = 2_000;
|
|
13
|
+
const MAX_SUMMARY_CHARS = 4_000;
|
|
14
|
+
const MAX_DETAIL_CHARS = 2_000;
|
|
15
|
+
const MAX_REPRODUCTION_STEPS = 20;
|
|
16
|
+
const MAX_REPRODUCTION_CHARS = 500;
|
|
17
|
+
const MAX_PATH_CHARS = 2_048;
|
|
18
|
+
export class ExploreState {
|
|
19
|
+
goal;
|
|
20
|
+
budgets;
|
|
21
|
+
now;
|
|
22
|
+
steps = [];
|
|
23
|
+
findings = [];
|
|
24
|
+
#ended = 'aborted';
|
|
25
|
+
#summary;
|
|
26
|
+
#open;
|
|
27
|
+
constructor(goal, budgets, now = Date.now) {
|
|
28
|
+
this.goal = goal;
|
|
29
|
+
this.budgets = budgets;
|
|
30
|
+
this.now = now;
|
|
31
|
+
}
|
|
32
|
+
/** Why exploration stopped; `aborted` until `end` says otherwise. */
|
|
33
|
+
get ended() {
|
|
34
|
+
return this.#ended;
|
|
35
|
+
}
|
|
36
|
+
/** The agent's closing assessment, once it gave one. */
|
|
37
|
+
get summary() {
|
|
38
|
+
return this.#summary;
|
|
39
|
+
}
|
|
40
|
+
/** Opens the next step; the index is one-based. */
|
|
41
|
+
beginStep(title, instruction) {
|
|
42
|
+
if (this.#open !== undefined)
|
|
43
|
+
throw new Error(`exploration step ${this.#open.index} is still open`);
|
|
44
|
+
this.#open = {
|
|
45
|
+
index: this.steps.length + 1,
|
|
46
|
+
title: clip(title, MAX_TITLE_CHARS),
|
|
47
|
+
instruction: clip(instruction, MAX_INSTRUCTION_CHARS),
|
|
48
|
+
startedAt: timestamp(new Date(this.now())),
|
|
49
|
+
startedMs: this.now(),
|
|
50
|
+
};
|
|
51
|
+
const { index, title: heading, instruction: charter } = this.#open;
|
|
52
|
+
return { index, title: heading, instruction: charter };
|
|
53
|
+
}
|
|
54
|
+
/** Closes the open step with its outcome. */
|
|
55
|
+
endStep(status, summary, errorCode) {
|
|
56
|
+
const open = this.#open;
|
|
57
|
+
if (open === undefined)
|
|
58
|
+
throw new Error('no exploration step is open');
|
|
59
|
+
this.#open = undefined;
|
|
60
|
+
const step = {
|
|
61
|
+
index: open.index,
|
|
62
|
+
title: open.title,
|
|
63
|
+
instruction: open.instruction,
|
|
64
|
+
status,
|
|
65
|
+
...(summary === undefined || summary === '' ? {} : { summary: clip(summary, MAX_SUMMARY_CHARS) }),
|
|
66
|
+
...(errorCode === undefined ? {} : { errorCode }),
|
|
67
|
+
startedAt: open.startedAt,
|
|
68
|
+
durationMs: Math.max(0, this.now() - open.startedMs),
|
|
69
|
+
};
|
|
70
|
+
this.steps.push(step);
|
|
71
|
+
return step;
|
|
72
|
+
}
|
|
73
|
+
/** Records one finding against the step in progress. */
|
|
74
|
+
addFinding(input) {
|
|
75
|
+
const finding = {
|
|
76
|
+
id: uuidv7(this.now()),
|
|
77
|
+
index: this.findings.length,
|
|
78
|
+
...(this.#open === undefined ? {} : { step: this.#open.index }),
|
|
79
|
+
kind: input.kind,
|
|
80
|
+
severity: input.severity,
|
|
81
|
+
title: clip(input.title, MAX_TITLE_CHARS),
|
|
82
|
+
expected: clip(input.expected, MAX_DETAIL_CHARS),
|
|
83
|
+
actual: clip(input.actual, MAX_DETAIL_CHARS),
|
|
84
|
+
reproduction: input.reproduction.slice(0, MAX_REPRODUCTION_STEPS).map((entry) => clip(entry, MAX_REPRODUCTION_CHARS)),
|
|
85
|
+
...(input.path === undefined ? {} : { path: clip(input.path, MAX_PATH_CHARS) }),
|
|
86
|
+
...(input.observationRevision === undefined ? {} : { observationRevision: input.observationRevision }),
|
|
87
|
+
reportedAt: timestamp(new Date(this.now())),
|
|
88
|
+
};
|
|
89
|
+
this.findings.push(finding);
|
|
90
|
+
return finding;
|
|
91
|
+
}
|
|
92
|
+
/** Attaches the evidence screenshot kept for a finding, by its artifact id. */
|
|
93
|
+
attachEvidence(id, artifactId) {
|
|
94
|
+
const index = this.findings.findIndex((finding) => finding.id === id);
|
|
95
|
+
if (index === -1)
|
|
96
|
+
return;
|
|
97
|
+
this.findings[index] = { ...this.findings[index], artifactId };
|
|
98
|
+
}
|
|
99
|
+
/** Closes the record: why exploration stopped and, when the agent gave one, its closing assessment. */
|
|
100
|
+
end(ended, summary) {
|
|
101
|
+
this.#ended = ended;
|
|
102
|
+
this.#summary = summary === undefined || summary.trim() === '' ? undefined : clip(summary, MAX_SUMMARY_CHARS);
|
|
103
|
+
}
|
|
104
|
+
get issues() {
|
|
105
|
+
return this.findings.filter((finding) => finding.kind === 'issue');
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* How many steps in a row made no progress, newest first: failed or blocked
|
|
109
|
+
* without recording a finding. A failed step that reported a defect did its
|
|
110
|
+
* job, and a step that ended at its budget is a time-boxed charter, not a
|
|
111
|
+
* failure; neither breaks the streak nor adds to it.
|
|
112
|
+
*/
|
|
113
|
+
consecutiveFailures() {
|
|
114
|
+
const productive = new Set(this.findings.map((finding) => finding.step));
|
|
115
|
+
let count = 0;
|
|
116
|
+
for (let index = this.steps.length - 1; index >= 0; index -= 1) {
|
|
117
|
+
const step = this.steps[index];
|
|
118
|
+
if (step.status === 'passed')
|
|
119
|
+
break;
|
|
120
|
+
if (step.status === 'exhausted' || productive.has(step.index))
|
|
121
|
+
continue;
|
|
122
|
+
count += 1;
|
|
123
|
+
}
|
|
124
|
+
return count;
|
|
125
|
+
}
|
|
126
|
+
snapshot() {
|
|
127
|
+
return {
|
|
128
|
+
goal: this.goal,
|
|
129
|
+
budgets: { maxSteps: this.budgets.maxSteps, timeoutMs: this.budgets.timeoutMs },
|
|
130
|
+
ended: this.#ended,
|
|
131
|
+
...(this.#summary === undefined ? {} : { summary: this.#summary }),
|
|
132
|
+
steps: [...this.steps],
|
|
133
|
+
findings: [...this.findings],
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Trims and bounds free text so the report stays inside the schema's
|
|
139
|
+
* ceilings. Counted in code points, as the schema counts, so a cut never
|
|
140
|
+
* splits a surrogate pair.
|
|
141
|
+
*/
|
|
142
|
+
export function clip(text, max) {
|
|
143
|
+
const trimmed = text.trim();
|
|
144
|
+
const points = Array.from(trimmed);
|
|
145
|
+
return points.length <= max ? trimmed : `${points.slice(0, max - 1).join('')}…`;
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/explore/state.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAcvD,mEAAmE;AACnE,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,CAAC;AACnC,MAAM,qBAAqB,GAAG,KAAK,CAAC;AACpC,MAAM,iBAAiB,GAAG,KAAK,CAAC;AAChC,MAAM,gBAAgB,GAAG,KAAK,CAAC;AAC/B,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAClC,MAAM,sBAAsB,GAAG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;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE;YAC/E,KAAK,EAAE,IAAI,CAAC,MAAM;YAClB,GAAG,CAAC,IAAI,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClE,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC;YACtB,QAAQ,EAAE,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC;SAC7B,CAAC;IACJ,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,UAAU,IAAI,CAAC,IAAY,EAAE,GAAW;IAC5C,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IAC5B,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACnC,OAAO,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC;AAClF,CAAC"}
|
|
@@ -11,7 +11,7 @@ export interface AtomicWriteOptions {
|
|
|
11
11
|
readonly mode?: number;
|
|
12
12
|
}
|
|
13
13
|
/** Writes `content` to `filePath` atomically; a failed write leaves no temporary file behind. */
|
|
14
|
-
export declare function writeFileAtomic(filePath: string, content: string, options?: AtomicWriteOptions): Promise<void>;
|
|
14
|
+
export declare function writeFileAtomic(filePath: string, content: string | Uint8Array, options?: AtomicWriteOptions): Promise<void>;
|
|
15
15
|
/** The synchronous twin, for a store that is read and written from synchronous code. */
|
|
16
16
|
export declare function writeFileAtomicSync(filePath: string, content: string, options?: AtomicWriteOptions): void;
|
|
17
17
|
//# sourceMappingURL=atomic-write.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"atomic-write.d.ts","sourceRoot":"","sources":["../../src/internal/atomic-write.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,MAAM,WAAW,kBAAkB;IACjC,8EAA8E;IAC9E,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AAMD,iGAAiG;AACjG,wBAAsB,eAAe,CACnC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"atomic-write.d.ts","sourceRoot":"","sources":["../../src/internal/atomic-write.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,MAAM,WAAW,kBAAkB;IACjC,8EAA8E;IAC9E,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AAMD,iGAAiG;AACjG,wBAAsB,eAAe,CACnC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,GAAG,UAAU,EAC5B,OAAO,GAAE,kBAAuB,GAC/B,OAAO,CAAC,IAAI,CAAC,CASf;AAED,wFAAwF;AACxF,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,kBAAuB,GAAG,IAAI,CAa7G"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"atomic-write.js","sourceRoot":"","sources":["../../src/internal/atomic-write.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAO7D,SAAS,aAAa,CAAC,QAAgB;IACrC,OAAO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AuB,EAAE;IACrG,MAAM,SAAS,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAC;IAC1C,IAAI,CAAC;QACH,aAAa,CAAC,SAAS,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;QAC5E,UAAU,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IAClC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,CAAC;YACH,UAAU,CAAC,SAAS,CAAC,CAAC;QACxB,CAAC;QAAC,MAAM,CAAC;YACP,+DAA+D;QACjE,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -3,4 +3,6 @@
|
|
|
3
3
|
* caller's module URL, falling back when the package cannot be resolved.
|
|
4
4
|
*/
|
|
5
5
|
export declare function packageVersion(fromUrl: string, specifier: string, fallback: string): string;
|
|
6
|
+
/** Reads a JSON file through require resolution relative to the caller's module URL, or undefined when absent. */
|
|
7
|
+
export declare function readJson(fromUrl: string, specifier: string): unknown;
|
|
6
8
|
//# sourceMappingURL=package-version.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-version.d.ts","sourceRoot":"","sources":["../../src/internal/package-version.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAM3F"}
|
|
1
|
+
{"version":3,"file":"package-version.d.ts","sourceRoot":"","sources":["../../src/internal/package-version.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAM3F;AAED,kHAAkH;AAClH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAMpE"}
|
|
@@ -11,4 +11,13 @@ export function packageVersion(fromUrl, specifier, fallback) {
|
|
|
11
11
|
return fallback;
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
+
/** Reads a JSON file through require resolution relative to the caller's module URL, or undefined when absent. */
|
|
15
|
+
export function readJson(fromUrl, specifier) {
|
|
16
|
+
try {
|
|
17
|
+
return createRequire(fromUrl)(specifier);
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
14
23
|
//# sourceMappingURL=package-version.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-version.js","sourceRoot":"","sources":["../../src/internal/package-version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,OAAe,EAAE,SAAiB,EAAE,QAAgB;IACjF,IAAI,CAAC;QACH,OAAQ,aAAa,CAAC,OAAO,CAAC,CAAC,SAAS,CAAyB,CAAC,OAAO,CAAC;IAC5E,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,QAAQ,CAAC;IAClB,CAAC;AACH,CAAC"}
|
|
1
|
+
{"version":3,"file":"package-version.js","sourceRoot":"","sources":["../../src/internal/package-version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,OAAe,EAAE,SAAiB,EAAE,QAAgB;IACjF,IAAI,CAAC;QACH,OAAQ,aAAa,CAAC,OAAO,CAAC,CAAC,SAAS,CAAyB,CAAC,OAAO,CAAC;IAC5E,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,QAAQ,CAAC;IAClB,CAAC;AACH,CAAC;AAED,kHAAkH;AAClH,MAAM,UAAU,QAAQ,CAAC,OAAe,EAAE,SAAiB;IACzD,IAAI,CAAC;QACH,OAAO,aAAa,CAAC,OAAO,CAAC,CAAC,SAAS,CAAY,CAAC;IACtD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/** Runner-side secret redaction. */
|
|
2
2
|
/**
|
|
3
|
-
* Builds a redactor replacing every
|
|
4
|
-
* stable secret
|
|
3
|
+
* Builds a redactor replacing every registered secret value, in each form the
|
|
4
|
+
* value takes in text the runner writes or rewrites, with its stable secret
|
|
5
|
+
* name.
|
|
5
6
|
*
|
|
6
|
-
* Longer
|
|
7
|
+
* Longer forms are substituted first, so a secret that contains another secret
|
|
7
8
|
* is not left half-rewritten.
|
|
8
9
|
*/
|
|
9
10
|
export declare function createRedactor(secrets: Iterable<readonly [string, string]>): (text: string) => string;
|
|
@@ -23,11 +24,18 @@ export declare class SecretLedger {
|
|
|
23
24
|
* captures, and an earlier value that stopped redacting would leak there.
|
|
24
25
|
*/
|
|
25
26
|
private readonly values;
|
|
26
|
-
private
|
|
27
|
+
private compiled;
|
|
27
28
|
constructor(initial?: Iterable<readonly [string, string]>);
|
|
28
29
|
/** Registers one resolved value; earlier values for the name keep redacting. */
|
|
29
30
|
register(name: string, value: string): void;
|
|
30
31
|
/** Bound so it can be handed out as a plain function. */
|
|
31
32
|
readonly redact: (text: string) => string;
|
|
33
|
+
/**
|
|
34
|
+
* Whether any registered value, in any of its forms, occurs in `bytes`.
|
|
35
|
+
* The check for content that is not text and so cannot be rewritten: what
|
|
36
|
+
* holds a secret has to be withheld instead.
|
|
37
|
+
*/
|
|
38
|
+
appearsIn(bytes: Uint8Array): boolean;
|
|
39
|
+
private compile;
|
|
32
40
|
}
|
|
33
41
|
//# sourceMappingURL=redact.d.ts.map
|